diff options
Diffstat (limited to 'nx-X11/lib/dps')
79 files changed, 0 insertions, 22673 deletions
diff --git a/nx-X11/lib/dps/DPSCAP.h b/nx-X11/lib/dps/DPSCAP.h deleted file mode 100644 index cb36016c2..000000000 --- a/nx-X11/lib/dps/DPSCAP.h +++ /dev/null @@ -1,77 +0,0 @@ -/* - * DPSCAP.h -- CAP constants, analogous to X.h - * - * (c) Copyright 1990-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 - */ - -#ifndef _DPSCAP_h -#define _DPSCAP_h - -/* DPSCAPConnSetup functional hint flags */ - -#define DPSCAPNONEFLAG 0x0000 - -/* Values for DPSCAPNotify */ - -#define DPSCAPNOTE_GRAB 0 -#define DPSCAPNOTE_UNGRAB 1 -#define DPSCAPNOTE_FREEGC 2 -#define DPSCAPNOTE_SYNC 3 -#define DPSCAPNOTE_PAUSE 4 - -/* Minor opcodes for CAP errors */ - -#define DPSCAPDEADLOCK 0 - -/* Pnames for ClientMessage type atoms */ - - -#define DPSCAP_TYPE_PSOUTPUT "_ADOBE_DPSCAP_TYPE_PSOUTPUT" -#define DPSCAP_TYPE_PSOUTPUT_LEN "_ADOBE_DPSCAP_TYPE_PSOUTPUT_WITH_LEN" -#define DPSCAP_TYPE_PSSTATUS "_ADOBE_DPSCAP_TYPE_PSSTATUS" -#define DPSCAP_TYPE_NOOP "_ADOBE_DPSCAP_TYPE_NOOP" -#define DPSCAP_TYPE_SYNC "_ADOBE_DPSCAP_TYPE_SYNC" -#define DPSCAP_TYPE_XERROR "_ADOBE_DPSCAP_TYPE_XERROR" -#define DPSCAP_TYPE_PSREADY "_ADOBE_DPSCAP_TYPE_PSREADY" -#define DPSCAP_TYPE_RESUME "_ADOBE_DPSCAP_TYPE_RESUME" - -#define DPSCAP_ATOMS 8 - -/* Translate argument names for X_CAPSetArg, see dpsNXargs.h */ - -#define DPSCAP_ARG_SMALLFONTS 1 -#define DPSCAP_ARG_PIXMEM 2 - -#endif /* _DPSCAP_h */ diff --git a/nx-X11/lib/dps/DPSCAPClient.h b/nx-X11/lib/dps/DPSCAPClient.h deleted file mode 100644 index 803acf3ed..000000000 --- a/nx-X11/lib/dps/DPSCAPClient.h +++ /dev/null @@ -1,139 +0,0 @@ -/* - * DPSCAPClient.h -- DPSCAP client definitions - * - * (c) Copyright 1990-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 - */ - -#ifndef DPSCAPCLIENT_H -#define DPSCAPCLIENT_H 1 - -#include "DPSCAP.h" -#include "DPSCAPproto.h" -#include <X11/Xlib.h> -#ifndef Xmalloc -#endif -#include <DPS/XDPSlib.h> - -/* === DEFINES === */ - -#ifndef _NFILE -#define _NFILE 128 -#endif - -#define DPSCAPFAILED -1 -#define DPSCAPSUCCESS 0 - -#define DPSGCBITS \ -(GCPlaneMask|GCSubwindowMode|GCClipXOrigin|GCClipYOrigin|GCClipMask) - -/* === TYPEDEFS === */ - -typedef enum { - dpscap_nopad, - dpscap_pad, - dpscap_insert, - dpscap_append -} DPSCAPIOFlags; - -typedef struct _t_DPSCAPData { - struct _t_DPSCAPData *next; - Display *dpy; - /* shadow connection to agent */ - Display *agent; /* Dummy display structure is agent */ - char *otherConnID; /* VMS AST? */ - XExtCodes *codes; - XExtData *extData; /* Back pointer for clearing private */ - Atom typePSOutput; - Atom typePSOutputWithLen; - Atom typePSStatus; - Atom typeNoop; - Atom typeSync; - Atom typeXError; - Atom typePSReady; /* L2-DPS/PROTO 9 addition */ - Atom typeResume; - unsigned long saveseq; - int dpscapVersion; - Window agentWindow; -} DPSCAPDataRec, *DPSCAPData; - -typedef struct { - struct _t_DPSCAPData *head; /* list of active agent connections */ - char *defaultAgentName; /* settable agent name */ - char *map[_NFILE]; /* map DPY_NUMBER to agent name */ -} DPSCAPGlobalsRec, *DPSCAPGlobals; - -/* === GLOBALS === */ - -extern DPSCAPGlobals gCSDPS; - -/* === PUBLIC PROCS === */ - -extern int CSDPSInit(Display * /* dpy */, int * /* numberType */, char ** /* floatingName */); - -extern XExtData **CSDPSHeadOfDpyExt(Display * /* dpy */); - -/* === SUPPORT PROCS === */ - -extern void DPSCAPChangeGC(Display * /* agent */, GC /* gc */, unsigned long /* valuemask */, XGCValues * /* values */); - -extern DPSCAPData DPSCAPCreate(Display * /* dpy */, Display * /* agent */); - -extern int DPSCAPDestroy(XExtData * /* extData */); - -extern XExtData * DPSCAPOpenAgent(Display * /* dpy */, char * /* trueDisplayName */); - -extern void DPSCAPRead(DPSCAPData /* my */, char * /* buf */, unsigned /* len */, DPSCAPIOFlags /* includePad */); - -extern void DPSCAPStartUp(void); - -extern void DPSCAPWrite(Display * /* my */, char * /* buf */, unsigned /* len */, DPSCAPIOFlags /* writePad */, DPSCAPIOFlags /* bufMode */); - -/* ext callback hooks */ - -extern int DPSCAPCloseDisplayProc(Display * /* dpy */, XExtCodes * /* codes */); - -extern int DPSCAPGrabServerProc(Display * /* dpy */, XExtCodes * /* codes */); - -extern int DPSCAPUngrabServerProc(Display * /* dpy */, XExtCodes * /* codes */); - -extern void DPSCAPCloseAgent(Display * /* agent */); - -extern int DPSCAPCopyGCProc(Display * /* dpy */, GC /* gc */, XExtCodes * /* codes */); - -extern int DPSCAPFreeGCProc(Display * /* pdpy */, GC /* gc */, XExtCodes * /* codes */); - -extern int DPSCAPFlushGCProc(Display * /* dpy */, GC /* gc */, XExtCodes * /* codes */); - -#endif /* DPSCAPCLIENT_H */ diff --git a/nx-X11/lib/dps/DPSCAPproto.h b/nx-X11/lib/dps/DPSCAPproto.h deleted file mode 100644 index e35487b2b..000000000 --- a/nx-X11/lib/dps/DPSCAPproto.h +++ /dev/null @@ -1,180 +0,0 @@ -/* - * DPSCAPproto.h -- CAP requests constants and alignment values, - * analgous to Xproto.h - * - * (c) Copyright 1991-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 - */ - - -#ifndef _DPSCAPproto_h -#define _DPSCAPproto_h - -/* === DEFINITIONS === */ - -#define DPSCAPPROTOVERSION 3 -#define DPSCAPPROTOVERSION_2 2 - -#define CSDPSPORT 6016 /* add agent instance number */ -#define DPS_NX_SERV_NAME "dpsnx" /* name to look up in /etc/services */ - -/* Request Opcodes */ - -#define DPSCAPOPCODEBASE 126 -#define DPSXOPCODEBASE 125 - -#define X_CAPFlushAgent 1 -#define X_CAPNotify 2 -#define X_CAPSetArg 3 - -/* === REQUESTS === */ - -typedef struct _CAPConnSetup { - BYTE byteorder; /* #x42 MSB, #x6C LSB */ - BYTE dpscapVersion; /* proto version of connecting client */ - CARD16 flags B16; /* functional hint flags */ - CARD32 libraryversion B32; /* as for XPSInit */ - CARD16 authProtoNameLength B16; /* in bytes */ - CARD16 authProtoDataLength B16; /* in bytes */ - CARD16 displayStringLength B16; /* in bytes */ - CARD16 nodeStringLength B16; /* in bytes */ - CARD16 transportStringLength B16; /* in bytes */ - CARD16 display B16; /* Display number */ - CARD16 screen B16; /* Screen number */ - CARD16 reserved B16; - CARD32 clientWindow B32; /* window for ClientMessage */ -} xCAPConnSetupReq; -#define sz_xCAPConnSetupReq 28 - -typedef struct { - BYTE success; - BYTE reasonLength; - CARD16 additionalLength B16; -} xCAPConnReplyPrefix; -#define sz_xCAPConnReplyPrefix 4 - -typedef struct _CAPConnFailed { - BYTE success; /* failed = 0, success = 1 */ - BYTE reasonLength; /* in bytes if failed, ignore if success */ - CARD16 additionalLength B16;/* quadbytes ADDITIONAL length */ - CARD32 serverVersion B32; /* as for XPSInit */ - CARD8 dpscapVersion; /* proto version of agent */ - CARD8 pad; - CARD16 reserved B16; -} xCAPConnFailed; -#define sz_xCAPConnFailed 12 - -typedef struct _CAPConnSuccess { - BYTE success; /* failed = 0, success = 1 */ - BYTE reasonLength; /* in bytes if failed, ignore if success */ - CARD16 additionalLength B16;/* quadbytes ADDITIONAL length */ - CARD32 serverVersion B32; /* as for XPSInit */ - CARD8 dpscapVersion; /* proto version of agent */ - CARD8 reserved; - CARD16 flagsUsed B16; /* mask of functional hint flags used */ - CARD32 preferredNumberFormat B32; /* as for XPSInit */ - CARD32 floatingNameLength B32; /* as for XPSInit */ - CARD32 agentWindow B32; /* client sends messages to this window */ -} xCAPConnSuccess; -#define sz_xCAPConnSuccess 24 - -typedef struct _CAPFlushAgent { - CARD8 reqType; /* always DPSCAPOPCODEBASE */ - CARD8 type; /* always X_CAPFlushAgent */ - CARD16 length B16; /* quadbyte length of request */ - CARD32 cxid B32; /* context XID */ -} xCAPFlushAgentReq; -#define sz_xCAPFlushAgentReq 8 - -typedef struct _CAPNotify { - CARD8 reqType; /* always DPSCAPOPCODEBASE */ - CARD8 type; /* always X_CAPNotify */ - CARD16 length B16; /* quadbyte length of request */ - CARD32 cxid B32; /* context XID */ - CARD32 notification B32; /* notify code */ - CARD32 data B32; /* data word */ - CARD32 extra B32; /* extra word */ -} xCAPNotifyReq; -#define sz_xCAPNotifyReq 20 - -typedef struct _CAPSetArg { - CARD8 reqType; /* always DPSCAPOPCODEBASE */ - CARD8 type; /* always X_CAPNotify */ - CARD16 length B16; /* quadbyte length of request */ - CARD32 arg B32; /* argument type */ - CARD32 val B32; /* value */ -} xCAPSetArgReq; -#define sz_xCAPSetArgReq 12 - -/* === ERRORS === */ - -typedef struct _DPSCAPError { - BYTE type; /* always 0 */ - BYTE errorCode; /* always 255 */ - CARD16 sequenceNumber B16; /* the nth request from this client */ - CARD8 subLength; /* how much of 21 bytes are used */ - CARD8 unused; - CARD16 reserved B16; - CARD16 minorOpcode B16; - CARD8 majorOpcode; /* always 0 */ - BYTE subData1; - CARD32 subData2 B32; - CARD32 subData3 B32; - CARD32 subData4 B32; - CARD32 subData5 B32; - CARD32 subData6 B32; - CARD32 subData7 B32; -} xDPSCAPError; - -/* === EVENTS === */ - -/* Events sent from agent to client via XSendEvent */ - -#define DPSCAP_OUTPUT_OVERHEAD 4 -#define DPSCAP_BYTESPEROUTPUTEVENT (20 - DPSCAP_OUTPUT_OVERHEAD) -#define DPSCAP_DATA_LEN (DPSCAP_BYTESPEROUTPUTEVENT-1) - -typedef struct { - CARD32 cxid; - CARD8 data[DPSCAP_BYTESPEROUTPUTEVENT]; -} DPSCAPOutputEvent; - -typedef struct { - BYTE status; - BYTE unused; - CARD16 sequenceNumber; - CARD32 cxid; -} DPSCAPStatusEvent; - -#endif /* _DPSCAPproto_h */ diff --git a/nx-X11/lib/dps/Imakefile b/nx-X11/lib/dps/Imakefile deleted file mode 100644 index 119b3429e..000000000 --- a/nx-X11/lib/dps/Imakefile +++ /dev/null @@ -1,265 +0,0 @@ -XCOMM $XFree86: xc/lib/dps/Imakefile,v 1.16tsi Exp $ - -#define DoNormalLib NormalLibDps -#define DoSharedLib SharedLibDps -#define DoExtraLib SharedLibDps -#define DoDebugLib DebugLibDps -#define DoProfileLib ProfileLibDps -#define LibName dps -#define SoRev SODPSREV -#define IncSubdir DPS - -#ifdef SharedDPSReqs -REQUIREDLIBS = SharedDPSReqs -#endif - -XCOMM The Client Library uses definitions just like Xlib for network -XCOMM capabilities, such as TCPCONN, UNIXCONN, and DNETCONN. See -XCOMM csconndi.c and csopendi.c - -XCOMM The connection code should be rewritten to use xtrans. The STREAMSCONN -XCOMM code here needs work. For now force ConnectionFlags to be -XCOMM -DTCPCONN -DUNIXCONN - -#undef ConnectionFlags -#define ConnectionFlags -DTCPCONN -DUNIXCONN - - DEFINES = -DXDPS -DCSDPS ConnectionFlags - CAT = cat - SED = sed - AWK = awk - SORT = sort - PSWRAP = PsWrap - -COMMONOBJECTFILES = \ - dpsclient.o\ - dpsprintf.o\ - dpsexcept.o\ - dpsdict.o\ - dpsabbrev.o - -COMMONSOURCEFILES = \ - dpsclient.c\ - dpsprintf.c\ - dpsexcept.c\ - dpsdict.c\ - dpsabbrev.c - -XOBJECTFILES = \ - dpsXclient.o\ - dpssysnames.o\ - dpsXpriv.o\ - XDPS.o\ - dpsXtdisp.o\ - dpsXcmu.o - -XSOURCEFILES = \ - dpsXclient.c\ - dpssysnames.c\ - dpsXpriv.c\ - XDPS.c\ - dpsXtdisp.c\ - dpsXcmu.c - -XCSDPSOBJECTFILES = \ - cslibext.o\ - csopendi.o\ - csconndi.o\ - csstartNX.o\ - csfindNX.o\ - cslibint.o - -XCSDPSSOURCEFILES = \ - cslibext.c\ - csopendi.c\ - csconndi.c\ - csstartNX.c\ - csfindNX.c\ - cslibint.c - -DPSOPSOBJECTS = \ - dpsclrops.o\ - dpsctrlops.o\ - dpsctxtops.o\ - dpsdataops.o\ - dpsfontops.o\ - dpsgsttops.o\ - dpsioops.o\ - dpsmathops.o\ - dpsmtrxops.o\ - dpsmiscops.o\ - dpspntops.o\ - dpspathops.o\ - dpssysops.o\ - dpswinops.o\ - dpsopstack.o\ - dpsXops.o\ - dpsl2ops.o - -PSOPSOBJECTS = \ - psclrops.o\ - psctrlops.o\ - psctxtops.o\ - psdataops.o\ - psfontops.o\ - psgsttops.o\ - psioops.o\ - psmathops.o\ - psmtrxops.o\ - psmiscops.o\ - pspntops.o\ - pspathops.o\ - pssysops.o\ - pswinops.o\ - psopstack.o\ - psXops.o\ - psl2ops.o - -DPSOPSHEADERFILES = \ - dpsclrops.h\ - dpsctrlops.h\ - dpsctxtops.h\ - dpsdataops.h\ - dpsfontops.h\ - dpsgsttops.h\ - dpsioops.h\ - dpsmathops.h\ - dpsmtrxops.h\ - dpsmiscops.h\ - dpsopstack.h\ - dpspntops.h\ - dpspathops.h\ - dpssysops.h\ - dpswinops.h\ - dpsXops.h\ - dpsl2ops.h - -PSOPSHEADERFILES = \ - psclrops.h\ - psctrlops.h\ - psctxtops.h\ - psdataops.h\ - psfontops.h\ - psgsttops.h\ - psioops.h\ - psmathops.h\ - psmtrxops.h\ - psmiscops.h\ - pspntops.h\ - pspathops.h\ - pssysops.h\ - pswinops.h\ - psopstack.h\ - psXops.h\ - psl2ops.h - -DPSOPSCFILES = \ - dpsclrops.c\ - dpsctrlops.c\ - dpsctxtops.c\ - dpsdataops.c\ - dpsfontops.c\ - dpsgsttops.c\ - dpsioops.c\ - dpsmathops.c\ - dpsmtrxops.c\ - dpsmiscops.c\ - dpsopstack.c\ - dpspntops.c\ - dpspathops.c\ - dpssysops.c\ - dpswinops.c\ - dpsXops.c\ - dpsl2ops.c - -PSOPSCFILES = \ - psclrops.c\ - psctrlops.c\ - psctxtops.c\ - psdataops.c\ - psfontops.c\ - psgsttops.c\ - psioops.c\ - psmathops.c\ - psmtrxops.c\ - psmiscops.c\ - pspntops.c\ - pspathops.c\ - pssysops.c\ - pswinops.c\ - psopstack.c\ - psXops.c\ - psl2ops.c - -/* - * hv: HEADERS must be here, otherwise IncSubdir-triggered BuildIncludes - * will fail on systems without ln cmd - */ -HEADERS = psops.h dpsops.h - -all:: $(HEADERS) - -includes:: $(DPSOPSCFILES) $(PSOPSCFILES) $(HEADERS) - -$(DPSOPSCFILES) $(PSOPSCFILES): HostProgramTargetName($(PSWRAP)) - -SRCS = \ - ${COMMONSOURCEFILES} \ - ${XSOURCEFILES} \ - ${XCSDPSSOURCEFILES} \ - ${DPSOPSCFILES} \ - ${PSOPSCFILES} - -OBJS = \ - ${COMMONOBJECTFILES} \ - ${XOBJECTFILES} \ - ${XCSDPSOBJECTFILES} \ - ${DPSOPSOBJECTS} \ - ${PSOPSOBJECTS} - -DERIVED_FILES = $(DPSOPSHEADERFILES) $(PSOPSHEADERFILES) \ - $(DPSOPSCFILES) $(PSOPSCFILES) - -#include <Library.tmpl> - -.SUFFIXES: .psw .h - -.psw.c : HostProgramTargetName($(PSWRAP)) - RunProgram(PSWRAP,-a -o $*.c -h $*.h $<) - -.psw.h : HostProgramTargetName($(PSWRAP)) - RunProgram(PSWRAP,-a -h $*.h $< > /dev/null) - -HostProgramTargetName($(PSWRAP)): - @echo "checking $@ over in $(PSWRAPSRC) first..."; \ - test -d $(PSWRAPSRC) && cd $(PSWRAPSRC) && $(MAKE) pswraponly; \ - echo "okay, continuing in $(CURRENT_DIR)" - -includes :: $(HEADERS) -depend :: $(DPSOPSCFILES) $(PSOPSCFILES) - -psops.h : $(PSOPSHEADERFILES) - RemoveFile($@) - ${CAT} $(PSOPSHEADERFILES) |\ - ${SED} -e '/^$$/D' -e '/#/D' -e '/^\//D'\ - -e '/^ gener/D' -e '/^.\//D' |\ - ${SORT} > .sort - ${AWK} '/;/ {print; printf("\n");}' .sort > .ttt - ${CAT} psname.txt header.txt psifdef.txt .ttt psendif.txt > psops.h - RemoveFiles(.sort .ttt .attt) - -dpsops.h : psops.h $(DPSOPSHEADERFILES) - RemoveFile($@) - ${CAT} $(DPSOPSHEADERFILES) |\ - ${SED} -e '/^$$/D' -e '/#/D' -e '/^\//D'\ - -e '/^ gener/D' -e '/^.\//D' |\ - ${SORT} > .sort - ${AWK} '/;/ {print; printf("\n");}' .sort > .ttt - ${CAT} dpsname.txt header.txt dpsifdef.txt .ttt dpsendif.txt > dpsops.h - RemoveFiles(.sort .ttt .attt) - -clean :: - ${RM} $(DERIVED_FILES) .sort .ttt .att psops.h dpsops.h *% - -DependTarget() - diff --git a/nx-X11/lib/dps/XDPS.c b/nx-X11/lib/dps/XDPS.c deleted file mode 100644 index 5b1614e4c..000000000 --- a/nx-X11/lib/dps/XDPS.c +++ /dev/null @@ -1,2235 +0,0 @@ -/* - * XDPS.c -- implementation of low-level Xlib routines for XDPS extension - * - * (c) Copyright 1989-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/XDPS.c,v 1.4tsi Exp $ */ - -#define NEED_EVENTS -#define NEED_REPLIES - -#include <stdio.h> -/* Include this first so that Xasync.h, included from Xlibint.h, can find - the definition of NOFILE */ -#include <stdlib.h> -#include <sys/param.h> -#include <X11/Xlibint.h> -#include <X11/Xatom.h> -#include <X11/Xutil.h> - -#include "DPS/XDPS.h" -#include "DPS/XDPSproto.h" -#include "DPS/XDPSlib.h" -#include "DPS/dpsNXargs.h" - -#include "cslibint.h" -#include "dpsassert.h" -#include "DPSCAPClient.h" - -#include "publictypes.h" -#include "dpsXpriv.h" - -/* === DEFINITIONS === */ - -#ifndef _NFILE -#define DPSMAXDISPLAYS 128 -#else -#define DPSMAXDISPLAYS _NFILE -#endif /* _NFILE */ - -#define MajorOpCode(dpy) (Codes[DPY_NUMBER(dpy)] ? \ - Codes[DPY_NUMBER(dpy)]->major_opcode : \ - Punt()) - -#define DPSCAP_INITCTXTS 4 /* per display */ - -/* === TYPES === */ - -typedef Status (*PSCMProc)(Display *, XEvent *, xEvent *); - -typedef struct { - char passEvents; - char wrapWaiting; - char syncMask; /* CSDPS only */ - char debugMask; /* CSDPS only */ -} DPSDisplayFlags; - -/* For now DPSDisplayFlags is no larger than a pointer. Revisit this if the - structure grows. */ - -typedef int (*GenericProcPtrReturnsInt)(Display *); - -typedef struct _t_DPSCAPPausedContextData { - struct _t_DPSCAPPausedContextData *next; - Bool paused; - ContextXID cxid; - unsigned int seqnum; -} DPSCAPPausedContextData; - -typedef struct { - char showSmallSizes; - char pixMem; -} DPSCAPAgentArgs; - -typedef struct { - void (*Flush)(Display *); - int (*Read)(Display*, char*, long); - void (*ReadPad)(Display*, char*, long); - Status (*Reply)(Display*, xReply*, int, Bool); - void (*Send)(Display*, _Xconst char*, long); -} XDPSLIOProcs; - -/* === GLOBALS === */ - -/* For debugging, allows client to force the library to use an agent */ -int gForceCSDPS = 0; - -/* Force all DPS NX protocol requests to flush if CSDPS */ -int gAutoFlush = 1; - -/* Force all NX XDPSLGiveInputs to flush independent of gAutoFlush */ -int gForceFlush = 1; - -/* Quick check for any paused contexts */ -int gTotalPaused = 0; - -/* === LOCALS === */ - -/* Common stuff */ -static XExtCodes *Codes[DPSMAXDISPLAYS]; -static int version[DPSMAXDISPLAYS]; -static XDPSLEventHandler StatusProc[DPSMAXDISPLAYS]; -static DPSDisplayFlags displayFlags[DPSMAXDISPLAYS]; -static XDPSLEventHandler TextProc = NULL; -static XDPSLEventHandler ReadyProc[DPSMAXDISPLAYS]; /* L2-DPS/PROTO 9 */ -static int NumberType[DPSMAXDISPLAYS]; /* Garbage okay after dpy closed */ -static char *FloatingName[DPSMAXDISPLAYS]; /* Garbage okay after dpy closed */ - -/* CSDPS stuff */ -static Display *ShuntMap[DPSMAXDISPLAYS]; -static PSCMProc ClientMsgProc[DPSMAXDISPLAYS]; -static GenericProcPtrReturnsInt AfterProcs[DPSMAXDISPLAYS]; -static DPSCAPPausedContextData *PausedPerDisplay[DPSMAXDISPLAYS]; -static DPSCAPAgentArgs AgentArgs[DPSMAXDISPLAYS]; -static unsigned int LastXRequest[DPSMAXDISPLAYS]; -static int GCFlushMode[DPSMAXDISPLAYS]; - -#ifdef VMS -static Display *dpys[DPSMAXDISPLAYS]; -static nextDpy = 0; -#endif /* VMS */ - -static void DPSCAPInitGC(Display *dpy, Display *agent, GC gc); -static Status DPSCAPClientMessageProc(Display *dpy, XEvent *re, xEvent *event); -static int DPSCAPAfterProc(Display *xdpy); -static unsigned int DPSCAPSetPause(Display *xdpy, ContextXID cxid); -static Bool DPSCAPResumeContext(Display *xdpy, ContextXID cxid); -static Bool WaitForSyncProc(Display *xdpy, XEvent *event, char *arg); - -static XDPSLIOProcs xlProcs = { /* Use these for DPS/X extension */ - _XFlush, - _XRead, - _XReadPad, - _XReply, - _XSend - }; - -static XDPSLIOProcs nxlProcs = { /* Use these for NX */ - N_XFlush, - N_XRead, - N_XReadPad, - N_XReply, - N_XSend - }; - -/* === MACROS === */ - -#define IFNXSETCALL(a, x) call = ((a) != (x)) ? &nxlProcs : &xlProcs - -/* === PRIVATE PROCS === */ - -static int Punt(void) -{ - DPSFatalProc(NULL, "Extension has not been initialized"); - exit(1); -} - -#ifdef VMS -/* This is a terribly inefficient way to find a per-display index, but we - need it till we get dpy->fd fixed in VMS%%%%%*/ -static int FindDpyNum(Display *dpy) -{ -int i; -for (i=0; dpys[i] != dpy ; i++) - { - if (i == nextDpy) - { - dpys[nextDpy++]=dpy; - break; - } - } -return i; -} -#define DPY_NUMBER(dpy) FindDpyNum(dpy) -#else /* VMS */ -#define DPY_NUMBER(dpy) ((dpy)->fd) -#endif /* VMS */ - -/* === PROCEDURES === */ - -/* ARGSUSED */ -void -XDPSLSetTextEventHandler(Display *dpy, XDPSLEventHandler proc) -{ - TextProc = proc; -} - -/* ARGSUSED */ -void -XDPSLCallOutputEventHandler(Display *dpy, XEvent *event) -{ - (*TextProc)(event); -} - -void -XDPSLSetStatusEventHandler(Display *dpy, XDPSLEventHandler proc) -{ - StatusProc[DPY_NUMBER(dpy)] = proc; -} - -void -XDPSLCallStatusEventHandler(Display *dpy, XEvent *event) -{ - (*(StatusProc[DPY_NUMBER(dpy)]))(event); -} - -/* Added for L2-DPS/PROTO 9 */ -void -XDPSLSetReadyEventHandler(Display *dpy, XDPSLEventHandler proc) -{ - ReadyProc[DPY_NUMBER(dpy)] = proc; -} - -/* Added for L2-DPS/PROTO 9 */ -void -XDPSLCallReadyEventHandler(Display *dpy, XEvent *event) -{ - (*(ReadyProc[DPY_NUMBER(dpy)]))(event); -} - -/* Added for L2-DPS/PROTO 9 */ -int -XDPSLGetVersion(Display *dpy) -{ - return(version[DPY_NUMBER(dpy)]); -} -/* See CSDPS additions for XDPSLSetVersion */ - -void -XDPSLInitDisplayFlags(Display *dpy) -{ - int d = DPY_NUMBER(dpy); - displayFlags[d].wrapWaiting = False; - - /* Instead of explicitly setting the pass-event flag, rely upon the fact - that it gets initialized to 0 by the compiler. This means that you - can set the event delivery mode on a display before creating any - contexts, which is a Good Thing */ -} - -XExtCodes *XDPSLGetCodes(Display *dpy) -{ - return Codes[DPY_NUMBER(dpy)]; -} - -/* ARGSUSED */ -static int -CloseDisplayProc(Display *dpy, XExtCodes *codes) -{ - /* This proc is for native DPS/X only, not CSDPS */ - Codes[DPY_NUMBER(dpy)] = NULL; - /* Clear list */ - XDPSPrivZapDpy(dpy); -#ifdef VMS - dpys[DPY_NUMBER(dpy)] = NULL; - /*%%%%Temp till we fix dpy->fd*/ -#endif /* VMS */ - return 0; /* return-value is ignored */ -} - -Bool -XDPSLGetPassEventsFlag(Display *dpy) -{ - return displayFlags[DPY_NUMBER(dpy)].passEvents; -} - -void -XDPSLSetPassEventsFlag(Display *dpy, Bool flag) -{ - displayFlags[DPY_NUMBER(dpy)].passEvents = flag; -} - -Bool -XDPSLGetWrapWaitingFlag(Display *dpy) -{ - return displayFlags[DPY_NUMBER(dpy)].wrapWaiting; -} - -void -XDPSLSetWrapWaitingFlag(Display *dpy, Bool flag) -{ - displayFlags[DPY_NUMBER(dpy)].wrapWaiting = flag; -} - -static Status -ConvertOutputEvent(Display *dpy, XEvent *ce, xEvent *we) -{ - register PSOutputEvent *wireevent = (PSOutputEvent *) we; - register XDPSLOutputEvent *clientevent = (XDPSLOutputEvent *) ce; - - clientevent->type = wireevent->type & 0x7f; - clientevent->serial = _XSetLastRequestRead(dpy, - (xGenericReply *)wireevent); - clientevent->send_event = (wireevent->type & 0x80) != 0; - clientevent->display = dpy; - clientevent->cxid = wireevent->cxid; - clientevent->length = wireevent->length; - bcopy((char *) wireevent->data, clientevent->data, wireevent->length); - if (TextProc && !XDPSLGetPassEventsFlag(dpy)) { - (*TextProc)((XEvent *) clientevent); - return False; - } - return True; -} - -static Status -ConvertStatusEvent(Display *dpy, XEvent *ce, xEvent *we) -{ - register PSStatusEvent *wireevent = (PSStatusEvent *) we; - register XDPSLStatusEvent *clientevent = (XDPSLStatusEvent *) ce; - - clientevent->type = wireevent->type & 0x7f; - clientevent->serial = _XSetLastRequestRead(dpy, - (xGenericReply *)wireevent); - clientevent->send_event = (wireevent->type & 0x80) != 0; - clientevent->display = dpy; - clientevent->cxid = wireevent->cxid; - clientevent->status = wireevent->status; - if (StatusProc[DPY_NUMBER(dpy)] && !XDPSLGetPassEventsFlag(dpy)) { - (*(StatusProc[DPY_NUMBER(dpy)]))((XEvent *) clientevent); - return False; - } - return True; -} - -/* Added for L2-DPS/PROTO 9 */ -static Status -ConvertReadyEvent(Display *dpy, XEvent *ce, xEvent *we) -{ - register PSReadyEvent *wireevent = (PSReadyEvent *) we; - register XDPSLReadyEvent *clientevent = (XDPSLReadyEvent *) ce; - - clientevent->type = wireevent->type & 0x7f; - clientevent->serial = _XSetLastRequestRead(dpy, - (xGenericReply *)wireevent); - clientevent->send_event = (wireevent->type & 0x80) != 0; - clientevent->display = dpy; - clientevent->cxid = wireevent->cxid; - clientevent->val[0] = wireevent->val1; - clientevent->val[1] = wireevent->val2; - clientevent->val[2] = wireevent->val3; - clientevent->val[3] = wireevent->val4; - if (ReadyProc[DPY_NUMBER(dpy)] && !XDPSLGetPassEventsFlag(dpy)) { - (*(ReadyProc[DPY_NUMBER(dpy)]))((XEvent *) clientevent); - return False; - } - return True; -} - -/* Added for L2-DPS/PROTO 9 */ -/* ARGSUSED */ - -static int -CatchBadMatch(Display *dpy, xError *err, XExtCodes *codes, int *ret_code) -{ - if (err->errorCode == BadMatch) - { - *ret_code = 0; - return 1; /* suppress error */ - } - else - { - *ret_code = 1; - return 0; /* pass error along */ - } -} - - -int -XDPSLInit( - Display *dpy, - int *numberType, /* RETURN */ - char **floatingName) /* RETURN: CALLER MUST NOT MODIFY OR FREE! */ -{ - XExtCodes *codes = (XExtCodes *)NULL; - register xPSInitReq *req; - xPSInitReply rep; - char *ptr; - int first_event; - - { - char *ddt; - - if ((ddt = getenv("DPSNXOVER")) != NULL) { - gForceCSDPS = (*ddt == 't' || *ddt == 'T'); - if (gForceCSDPS) - DPSWarnProc(NULL, "*** USING DPS NX ***"); - } - } - - if ((codes = Codes[DPY_NUMBER(dpy)]) != NULL) { - if (numberType) - *numberType = NumberType[DPY_NUMBER(dpy)]; - if (floatingName) - *floatingName = FloatingName[DPY_NUMBER(dpy)]; - return codes->first_event; - } else { - if (gForceCSDPS) - goto try_dps_nx; - codes = XInitExtension(dpy, DPSNAME); - if (codes == NULL) { - /* try DEC UWS 2.2 server */ - codes = XInitExtension(dpy, DECDPSNAME); -try_dps_nx: - if (codes == NULL) { - int myNumberType; - char *myFloatingName; - - first_event = CSDPSInit(dpy, &myNumberType, &myFloatingName); - NumberType[DPY_NUMBER(dpy)] = myNumberType; - FloatingName[DPY_NUMBER(dpy)] = myFloatingName; - if (numberType) - *numberType = myNumberType; - if (floatingName) - *floatingName = myFloatingName; - return first_event; - } - } - Codes[DPY_NUMBER(dpy)] = codes; - ShuntMap[DPY_NUMBER(dpy)] = dpy; - /* set procs for native DPS/X */ - XESetCloseDisplay(dpy, codes->extension, CloseDisplayProc); - XESetWireToEvent(dpy, codes->first_event + PSEVENTOUTPUT, - ConvertOutputEvent); - XESetWireToEvent(dpy, codes->first_event + PSEVENTSTATUS, - ConvertStatusEvent); - XESetWireToEvent(dpy, codes->first_event + PSEVENTREADY, - ConvertReadyEvent); - first_event = codes->first_event; - } - - /* We have to handle a BadMatch error, in the case where - the client has a later (higher) version of - the protocol than the server */ - { - int (*oldErrorProc)(Display*, xError*, XExtCodes*, int*); - int libVersion; - Bool doneIt; - - XSync(dpy, False); - LockDisplay(dpy); - oldErrorProc = XESetError(dpy, codes->extension, CatchBadMatch); - libVersion = DPSPROTOCOLVERSION; - doneIt = False; - while (libVersion >= DPSPROTO_OLDEST) - { - GetReq(PSInit, req); - req->reqType = MajorOpCode(dpy); - req->dpsReqType = X_PSInit; - req->libraryversion = libVersion; - if (_XReply(dpy, (xReply *) &rep, 0, xFalse)) - { - doneIt = True; - break; - } - /* otherwise, try previous version */ - --libVersion; - } - oldErrorProc = XESetError(dpy, codes->extension, oldErrorProc); - if (!doneIt) - { - DPSFatalProc(NULL, "Incompatible protocol versions"); - exit(1); - } - - /* NOTE ************************************************* - We made a boo-boo in the 1007.2 and earlier versions of - our X server glue code. Instead of sending a - BadMatch error if the client's version is newer (higher) - than the server's, it just replies with success. We - could test for that situation here by looking at - rep.serverversion, but it turns out that we don't need - to do anything special. Since rep.serverversion gets - assigned to our version[] array, it is as if we handled - the BadMatch correctly. Just for safety's sake, we'll - do some bulletproofing here instead. - Fixes 2ps_xdps BUG #6 */ - - else if (rep.serverversion < DPSPROTO_OLDEST - || rep.serverversion > DPSPROTOCOLVERSION) - { - DPSFatalProc(NULL, "Server replied with bogus version"); - exit(1); - } - } - - version[DPY_NUMBER(dpy)] = rep.serverversion; - NumberType[DPY_NUMBER(dpy)] = rep.preferredNumberFormat; - if (numberType) - *numberType = rep.preferredNumberFormat; - - ptr = (char *) Xmalloc(rep.floatingNameLength + 1); - _XReadPad(dpy, ptr, rep.floatingNameLength); - ptr[rep.floatingNameLength] = 0; - FloatingName[DPY_NUMBER(dpy)] = ptr; - if (floatingName) - *floatingName = ptr; - - UnlockDisplay(dpy); - SyncHandle(); - return first_event; -} - - - - -static void CopyColorMapsIntoCreateContextReq( - xPSCreateContextReq *req, - XStandardColormap *colorcube, - XStandardColormap *grayramp) -{ - req->cmap = 0; - if (colorcube != NULL) { - req->cmap = colorcube->colormap; - req->redmax = colorcube->red_max; - req->redmult = colorcube->red_mult; - req->greenmax = colorcube->green_max; - req->greenmult = colorcube->green_mult; - req->bluemax = colorcube->blue_max; - req->bluemult = colorcube->blue_mult; - req->colorbase = colorcube->base_pixel; - } - else { - req->redmult = 0; - /* The rest of this shouldn't be necessary, but there are some - servers out there that erroneously check the other fields - even when redmult is 0 */ - req->redmax = 0; - req->greenmult = 0; - req->greenmax = 0; - req->bluemult = 0; - req->bluemax = 0; - req->colorbase = 0; - } - - if (grayramp != NULL) { - req->cmap = grayramp->colormap; - req->graymax = grayramp->red_max; - req->graymult = grayramp->red_mult; - req->graybase = grayramp->base_pixel; - } - else req->graymult = 0; -} - - - - - - -/* ARGSUSED */ -ContextXID -XDPSLCreateContextAndSpace( - register Display *xdpy, - Drawable draw, - GC gc, - int x, int y, - unsigned int eventMask, - XStandardColormap *grayRamp, - XStandardColormap *colorCube, - unsigned int actual, - ContextPSID *cpsid, /* RETURN */ - SpaceXID *sxid, /* RETURN */ - Bool secure) /* Added for L2-DPS/PROTO 9 */ -{ - int dpyix; - register Display *dpy = ShuntMap[dpyix = DPY_NUMBER(xdpy)]; - ContextXID cxid; - register xPSCreateContextReq *req; /* Same struct for CreateSecureContext */ - xPSCreateContextReply rep; - XStandardColormap defColorcube, defGrayramp; - XStandardColormap *requestCube, *requestRamp; - int index; - XDPSLIOProcs *call; - - if (grayRamp == NULL && colorCube == NULL) return(None); - - if (secure && version[dpyix] < DPSPROTO_V09) - return(None); /* No secure contexts before PROTO 9 */ - - /* Index gets encoded as follows: - * - * 0 grayRamp = Default, colorCube = Default - * 1 grayRamp = non-Default, colorcube = Default - * 2 grayRamp = Default, colorcube = non-Default - * 3 grayRamp = non-Default, colorcube = non-Default - * - */ - index = ((grayRamp == DefaultStdCMap || grayRamp == NULL) ? 0 : 1) + - (colorCube == DefaultStdCMap ? 0 : 2); - - switch (index) - { - default: - case 0: /* Both are default */ - XDPSGetDefaultColorMaps(xdpy, (Screen *) NULL, draw, - &defColorcube, &defGrayramp); - requestCube = &defColorcube; - requestRamp = &defGrayramp; - break; - - case 1: /* gray specified, Color default */ - XDPSGetDefaultColorMaps(xdpy, (Screen *) NULL, draw, - &defColorcube, (XStandardColormap *) NULL); - requestCube = &defColorcube; - requestRamp = grayRamp; - break; - - case 2: /* gray default, Color specified */ - XDPSGetDefaultColorMaps(xdpy, (Screen *) NULL, draw, - (XStandardColormap *) NULL, &defGrayramp); - requestCube = colorCube; - requestRamp = &defGrayramp; - break; - - case 3: /* Both specified */ - requestCube = colorCube; - requestRamp = grayRamp; - break; - } - - if (gc != NULL) - XDPSLFlushGC(xdpy, gc); - if (dpy != xdpy) - { - int syncMask = displayFlags[dpyix].syncMask; - - /* Don't worry about pauses here, since we are just - now creating the context! */ - if (syncMask & (DPSCAP_SYNCMASK_SYNC|DPSCAP_SYNCMASK_RECONCILE)) - XSync(xdpy, False); - } - LockDisplay(dpy); - - NXMacroGetReq(PSCreateContext, req); - CopyColorMapsIntoCreateContextReq(req, requestCube, requestRamp); - - req->reqType = MajorOpCode(xdpy); - req->dpsReqType = (secure) ? X_PSCreateSecureContext : X_PSCreateContext; - req->x = x; - req->y = y; - req->drawable = draw; - req->gc = (gc != NULL) ? XGContextFromGC(gc) : None; - cxid = req->cxid = XAllocID(xdpy); - req->sxid = XAllocID(xdpy); - if (sxid) - *sxid = req->sxid; - req->eventmask = 0; /* %%% */ - req->actual = actual; - IFNXSETCALL(dpy, xdpy); - (void) (*call->Reply) (dpy, (xReply *)&rep, 0, xTrue); - - if (cpsid) - *cpsid = (int)rep.cpsid; - - UnlockDisplay(dpy); - /* If the context creation succeeded and we are CSDPS, send GC values */ - if (rep.cpsid && xdpy != dpy && gc != NULL) - { - DPSCAPInitGC(xdpy, dpy, gc); - } - SyncHandle(); - - if (dpy != xdpy) - LastXRequest[dpyix] = XNextRequest(xdpy)-1; - return (cxid); -} - - -/* ARGSUSED */ -ContextXID -XDPSLCreateContext( - register Display *xdpy, - SpaceXID sxid, - Drawable draw, - GC gc, - int x, int y, - unsigned int eventMask, - XStandardColormap *grayRamp, - XStandardColormap *colorCube, - unsigned int actual, - ContextPSID *cpsid, /* RETURN */ - Bool secure) /* L2-DPS/PROTO 9 addition */ -{ - int dpyix; - register Display *dpy = ShuntMap[dpyix = DPY_NUMBER(xdpy)]; - register xPSCreateContextReq *req; - xPSCreateContextReply rep; - ContextXID cxid; /* RETURN */ - XStandardColormap defColorcube, defGrayramp; - XStandardColormap *requestCube, *requestRamp; - int index; - XDPSLIOProcs *call; - - if (secure && version[dpyix] < DPSPROTO_V09) - return(None); /* No secure contexts before PROTO 9 */ - - /* Index gets encoded as follows: - * - * 0 grayRamp = Default, colorCube = Default - * 1 grayRamp = non-Default, colorcube = Default - * 2 grayRamp = Default, colorcube = non-Default - * 3 grayRamp = non-Default, colorcube = non-Default - * - * Note that only the first or last case should ever happen. - */ - index = ((grayRamp == DefaultStdCMap) ? 0 : 1) + - ((colorCube == DefaultStdCMap) ? 0 : 2); - - switch (index) - { - default: - case 0: /* Both are default */ - XDPSGetDefaultColorMaps(xdpy, (Screen *) NULL, draw, - &defColorcube, &defGrayramp); - requestCube = &defColorcube; - requestRamp = &defGrayramp; - break; - - case 1: /* gray specified, Color default */ - XDPSGetDefaultColorMaps(xdpy, (Screen *) NULL, draw, - &defColorcube, (XStandardColormap *) NULL); - requestCube = &defColorcube; - requestRamp = grayRamp; - break; - - case 2: /* gray default, Color specified */ - XDPSGetDefaultColorMaps(xdpy, (Screen *) NULL, draw, - (XStandardColormap *) NULL, &defGrayramp); - requestCube = colorCube; - requestRamp = &defGrayramp; - break; - - case 3: /* Both specified */ - requestCube = colorCube; - requestRamp = grayRamp; - break; - } - - - if (gc != NULL) - XDPSLFlushGC(xdpy, gc); - if (dpy != xdpy) - { - int syncMask = displayFlags[dpyix].syncMask; - - /* Don't worry about pauses here, since we are - just now creating this context! */ - if (syncMask & (DPSCAP_SYNCMASK_SYNC|DPSCAP_SYNCMASK_RECONCILE)) - XSync(xdpy, False); - } - LockDisplay(dpy); - - NXMacroGetReq(PSCreateContext, req); - CopyColorMapsIntoCreateContextReq(req, requestCube, requestRamp); - - req->reqType = MajorOpCode(xdpy); - req->dpsReqType = (secure) ? X_PSCreateSecureContext : X_PSCreateContext; - req->x = x; - req->y = y; - req->drawable = draw; - req->gc = (gc != NULL) ? XGContextFromGC(gc) : None; - cxid = req->cxid = XAllocID(xdpy); - req->sxid = sxid; - req->actual = actual; - - IFNXSETCALL(dpy, xdpy); - (void) (*call->Reply) (dpy, (xReply *)&rep, 0, xTrue); - if (cpsid) - *cpsid = (int)rep.cpsid; - - UnlockDisplay(dpy); - /* If the context creation succeeded and we are CSDPS, send GC values */ - if (rep.cpsid && xdpy != dpy && gc != NULL) - { - DPSCAPInitGC(xdpy, dpy, gc); - } - - SyncHandle(); - - if (dpy != xdpy) - LastXRequest[dpyix] = XNextRequest(xdpy)-1; - return cxid; -} - -SpaceXID -XDPSLCreateSpace(Display *xdpy) -{ - int dpyix; - register Display *dpy = ShuntMap[dpyix = DPY_NUMBER(xdpy)]; - register xPSCreateSpaceReq *req; - SpaceXID sxid; - - LockDisplay(dpy); - - NXMacroGetReq(PSCreateSpace, req); - req->reqType = MajorOpCode(xdpy); - req->dpsReqType = X_PSCreateSpace; - sxid = req->sxid = XAllocID(xdpy); - - UnlockDisplay(dpy); - SyncHandle(); - if (dpy != xdpy) - LastXRequest[dpyix] = XNextRequest(xdpy)-1; - return sxid; -} - - - -/* - * I'm not sure how portable my coalescing code is, so I've provided the - * below define. If it turns out this code just breaks somewhere, you - * can simply undefine COALESCEGIVEINPUT, and then everything will work - * (but slower). 6/16/89 (tw) - */ - -#define COALESCEGIVEINPUT - -void -XDPSLGiveInput(Display *xdpy, ContextXID cxid, char *data, int length) -{ - int dpyix; - register Display *dpy = ShuntMap[dpyix = DPY_NUMBER(xdpy)]; - register xPSGiveInputReq *req; - Bool didFlush = False; - - if (dpy != xdpy) - { - register int syncMask = displayFlags[dpyix].syncMask; - - if (syncMask & DPSCAP_SYNCMASK_RECONCILE) - { - XDPSLReconcileRequests(xdpy, cxid); - didFlush = True; - } - - /* If this context got paused, no matter how, ignore - mode and resume it */ - if (gTotalPaused && DPSCAPResumeContext(xdpy, cxid)) - { - /* xdpy was flushed by DPSCAPResumeContext */ - if (!didFlush) - { - N_XFlush(dpy); - didFlush = True; - } - } - else if (syncMask & DPSCAP_SYNCMASK_SYNC) - { - didFlush = True; - XSync(xdpy, False); - } - } - LockDisplay(dpy); - -#ifdef COALESCEGIVEINPUT - req = (xPSGiveInputReq *) dpy->last_req; - if (req->reqType == MajorOpCode(xdpy) - && req->dpsReqType == X_PSGiveInput - && req->cxid == cxid - && dpy->bufptr + length + 3 < dpy->bufmax) { - bcopy(data, ((char *) req) + sizeof(xPSGiveInputReq) + req->nunits, - length); - req->nunits += length; - req->length = (sizeof(xPSGiveInputReq) + req->nunits + 3) >> 2; - dpy->bufptr = dpy->last_req + sizeof(xPSGiveInputReq) + - ((req->nunits + 3) & ~3); - } else -#endif /* COALESCEGIVEINPUT */ - { - int flushOnce = 1; - int maxedOutLen = xdpy->max_request_size - sizeof(xPSGiveInputReq) - 4; - int nunits; - - /* We have the rare opportunity to chop up a buffer that is larger - than the max request size into separate requests, unlike - most other X requests (such as DrawText). The -4 is to - force these maxed out requests to be less than the maximum - padding that would ever be needed, and to minimize padding - in the case where the input buffer is several times - larger than max request length. */ - - nunits = maxedOutLen; - do { - if (length < maxedOutLen) - nunits = length; /* Normal size block */ - NXMacroGetReq(PSGiveInput, req); - req->reqType = MajorOpCode(xdpy); - req->dpsReqType = X_PSGiveInput; - req->cxid = cxid; - req->nunits = nunits; - req->length += ((nunits + 3) >> 2); - if (dpy != xdpy) { - if (flushOnce && !didFlush) { - LockDisplay(xdpy); - _XFlush(xdpy); - UnlockDisplay(xdpy); - flushOnce = 0; - } - NXProcData(dpy, (char *) data, nunits); - } else - {Data(dpy, (char *) data, nunits);} - data += nunits; - length -= nunits; - } while (length); - } - - /* In the NX case (didFlush is always False for the non-NX case), - the xdpy may have been flushed, but there is stuff left - buffered in dpy (NX connection). We can't leave the stuff - there, since we may never call a DPS routine again. Until - we can be notified about xdpy being flushed, we have to - clear out the dpy buffer after we cleared out the xdpy - buffer (didFlush == True). */ - - if (dpy != xdpy - && dpy->bufptr != dpy->buffer - && (gForceFlush || didFlush)) - N_XFlush(dpy); - - UnlockDisplay(dpy); - SyncHandle(); - if (dpy != xdpy) - LastXRequest[dpyix] = XNextRequest(xdpy)-1; -} - - -int -XDPSLGetStatus(Display *xdpy, ContextXID cxid) -{ - int dpyix; - Display *dpy = ShuntMap[dpyix = DPY_NUMBER(xdpy)]; - register xPSGetStatusReq *req; - xPSGetStatusReply rep; - XDPSLIOProcs *call; - - if (dpy != xdpy) - { - register int syncMask = displayFlags[dpyix].syncMask; - - /* ASSERT: There is no reason to pause the context for this - request, so just sync. */ - if (syncMask & (DPSCAP_SYNCMASK_SYNC|DPSCAP_SYNCMASK_RECONCILE)) - XSync(xdpy, False); - } - LockDisplay(dpy); - - NXMacroGetReq(PSGetStatus, req); - req->reqType = MajorOpCode(xdpy); - req->dpsReqType = X_PSGetStatus; - req->cxid = cxid; - req->notifyIfChange = 0; - - IFNXSETCALL(dpy, xdpy); - if (! (*call->Reply)(dpy, (xReply *)&rep, 0, xTrue)) - rep.status = PSSTATUSERROR; - UnlockDisplay(dpy); - SyncHandle(); - /* For CSDPS, guarantee that status events arrive just like DPS/X */ - if (dpy != xdpy) - { - XDPSLSync(xdpy); - LastXRequest[dpyix] = XNextRequest(xdpy)-1; - } - return (int) rep.status; -} - -void -XDPSLDestroySpace(Display *xdpy, SpaceXID sxid) -{ - int dpyix; - register Display *dpy = ShuntMap[dpyix = DPY_NUMBER(xdpy)]; - register xPSDestroySpaceReq *req; - - if (dpy != xdpy) - { - int syncMask = displayFlags[dpyix].syncMask; - - /* ASSERT: There is no reason to pause the context for this - request, so just sync. */ - if (syncMask & (DPSCAP_SYNCMASK_SYNC|DPSCAP_SYNCMASK_RECONCILE)) - XSync(xdpy, False); - } - LockDisplay(dpy); - - NXMacroGetReq(PSDestroySpace, req); - req->reqType = MajorOpCode(xdpy); - req->dpsReqType = X_PSDestroySpace; - req->sxid = sxid; - - if (gAutoFlush && dpy != xdpy) - { - N_XFlush(dpy); - } - UnlockDisplay(dpy); - SyncHandle(); - if (dpy != xdpy) - LastXRequest[dpyix] = XNextRequest(xdpy)-1; -} - - -void -XDPSLReset(Display *xdpy, ContextXID cxid) -{ - int dpyix; - register Display *dpy = ShuntMap[dpyix = DPY_NUMBER(xdpy)]; - register xPSResetReq *req; - - if (dpy != xdpy) - { - register int syncMask = displayFlags[dpyix].syncMask; - - /* ASSERT: There is no reason to pause the context for this - request, so just sync. */ - if (syncMask & (DPSCAP_SYNCMASK_SYNC|DPSCAP_SYNCMASK_RECONCILE)) - XSync(xdpy, False); - } - LockDisplay(dpy); - - NXMacroGetReq(PSReset, req); - req->reqType = MajorOpCode(xdpy); - req->dpsReqType = X_PSReset; - req->cxid = cxid; - - if (gAutoFlush && dpy != xdpy) - { - N_XFlush(dpy); - } - UnlockDisplay(dpy); - SyncHandle(); - if (dpy != xdpy) - LastXRequest[dpyix] = XNextRequest(xdpy)-1; -} - -void -XDPSLNotifyContext( - Display *xdpy, - ContextXID cxid, - int ntype) /* should this be an enum?? %%% */ -{ - int dpyix; - register Display *dpy = ShuntMap[dpyix = DPY_NUMBER(xdpy)]; - register xPSNotifyContextReq *req; - - if (dpy != xdpy) - { - register int syncMask = displayFlags[dpyix].syncMask; - - /* ASSERT: There is no reason to pause the context for this - request, so just sync. */ - if (syncMask & (DPSCAP_SYNCMASK_SYNC|DPSCAP_SYNCMASK_RECONCILE)) - XSync(xdpy, False); - } - LockDisplay(dpy); - - NXMacroGetReq(PSNotifyContext, req); - req->reqType = MajorOpCode(xdpy); - req->dpsReqType = X_PSNotifyContext; - req->cxid = cxid; - req->notifyType = ntype; - - if (dpy != xdpy) - { - N_XFlush(dpy); /* THIS IS CRITICAL TO AVOID HANGING! */ - } - - UnlockDisplay(dpy); - SyncHandle(); - - if (dpy != xdpy) - { - if (ntype == PSKILL) - XDPSLCleanContext(xdpy, cxid); - LastXRequest[dpyix] = XNextRequest(xdpy)-1; - } -} - - -ContextXID -XDPSLCreateContextFromID( - Display *xdpy, - ContextPSID cpsid, - SpaceXID *sxid) /* RETURN */ -{ - int dpyix; - register Display *dpy = ShuntMap[dpyix = DPY_NUMBER(xdpy)]; - register xPSCreateContextFromIDReq *req; - xPSCreateContextFromIDReply rep; - ContextXID cxid; - XDPSLIOProcs *call; - - if (dpy != xdpy) - { - int syncMask = displayFlags[dpyix].syncMask; - - /* ASSERT: There is no reason to pause the context for this - request, so just sync. */ - if (syncMask & (DPSCAP_SYNCMASK_SYNC|DPSCAP_SYNCMASK_RECONCILE)) - XSync(xdpy, False); - } - LockDisplay(dpy); - - NXMacroGetReq(PSCreateContextFromID, req); - req->reqType = MajorOpCode(xdpy); - req->dpsReqType = X_PSCreateContextFromID; - req->cpsid = cpsid; - cxid = req->cxid = XAllocID(xdpy); - - IFNXSETCALL(dpy, xdpy); - (void) (*call->Reply) (dpy, (xReply *)&rep, 0, xTrue); - if (sxid) - *sxid = (int)rep.sxid; - - UnlockDisplay(dpy); - SyncHandle(); - if (dpy != xdpy) - LastXRequest[dpyix] = XNextRequest(xdpy)-1; - return(cxid); -} - - -/* Returns 1 on success, 0 on failure (cpsid not a valid context). */ - -Status -XDPSLIDFromContext( - Display *xdpy, - ContextPSID cpsid, - ContextXID *cxid, /* RETURN */ - SpaceXID *sxid) /* RETURN */ -{ - int dpyix; - register Display *dpy = ShuntMap[dpyix = DPY_NUMBER(xdpy)]; - register xPSXIDFromContextReq *req; - xPSXIDFromContextReply rep; - XDPSLIOProcs *call; - - if (dpy != xdpy) - { - int syncMask = displayFlags[dpyix].syncMask; - - /* ASSERT: There is no reason to pause the context for this - request, so just sync. */ - if (syncMask & (DPSCAP_SYNCMASK_SYNC|DPSCAP_SYNCMASK_RECONCILE)) - XSync(xdpy, False); - } - LockDisplay(dpy); - - NXMacroGetReq(PSXIDFromContext, req); - req->reqType = MajorOpCode(xdpy); - req->dpsReqType = X_PSXIDFromContext; - req->cpsid = cpsid; - - IFNXSETCALL(dpy, xdpy); - (void) (*call->Reply) (dpy, (xReply *)&rep, 0, xTrue); - *sxid = (int)rep.sxid; - *cxid = (int)rep.cxid; - - UnlockDisplay(dpy); - SyncHandle(); - - if (dpy != xdpy) - LastXRequest[dpyix] = XNextRequest(xdpy)-1; - return((Status)(*sxid != None && *cxid != None)); -} - - -ContextPSID -XDPSLContextFromXID(Display *xdpy, ContextXID cxid) -{ - int dpyix; - register Display *dpy = ShuntMap[dpyix = DPY_NUMBER(xdpy)]; - register xPSContextFromXIDReq *req; - xPSContextFromXIDReply rep; - XDPSLIOProcs *call; - - if (dpy != xdpy) - { - int syncMask = displayFlags[dpyix].syncMask; - - /* ASSERT: There is no reason to pause the context for this - request, so just sync. */ - if (syncMask & (DPSCAP_SYNCMASK_SYNC|DPSCAP_SYNCMASK_RECONCILE)) - XSync(xdpy, False); - } - LockDisplay(dpy); - - NXMacroGetReq(PSContextFromXID, req); - req->reqType = MajorOpCode(xdpy); - req->dpsReqType = X_PSContextFromXID; - req->cxid = cxid; - - IFNXSETCALL(dpy, xdpy); - (void) (*call->Reply) (dpy, (xReply *)&rep, 0, xTrue); - - UnlockDisplay(dpy); - SyncHandle(); - - if (dpy != xdpy) - LastXRequest[dpyix] = XNextRequest(xdpy)-1; - return (int)rep.cpsid; -} - - -void -XDPSLSetStatusMask( - Display *xdpy, - ContextXID cxid, - unsigned int enableMask, - unsigned int disableMask, - unsigned int nextMask) -{ - int dpyix; - register Display *dpy = ShuntMap[dpyix = DPY_NUMBER(xdpy)]; - register xPSSetStatusMaskReq *req; - - if (dpy != xdpy) - { - register int syncMask = displayFlags[dpyix].syncMask; - - /* ASSERT: There is no reason to pause the context for this - request, so just sync. */ - if (syncMask & (DPSCAP_SYNCMASK_SYNC|DPSCAP_SYNCMASK_RECONCILE)) - XSync(xdpy, False); - } - LockDisplay(dpy); - - NXMacroGetReq(PSSetStatusMask, req); - req->reqType = MajorOpCode(xdpy); - req->dpsReqType = X_PSSetStatusMask; - req->cxid = cxid; - req->enableMask = enableMask; - req->disableMask = disableMask; - req->nextMask = nextMask; - - if (gAutoFlush && dpy != xdpy) - { - N_XFlush(dpy); - } - UnlockDisplay(dpy); - SyncHandle(); - if (dpy != xdpy) - LastXRequest[dpyix] = XNextRequest(xdpy)-1; -} - - -#ifdef VMS -/* - * _XReadPad - Read bytes from the socket taking into account incomplete - * reads. If the number of bytes is not 0 mod 32, read additional pad - * bytes. This routine may have to be reworked if int < long. - */ - -/* This is really in xlib, but is not in the sharable image transfer vector - * so I am copying it here for now. BF - -The following notice applies only to the functions -_XReadPad and XFlush - -Copyright 1985, 1986, 1987, 1988, 1989 by the -Massachusetts Institute of Technology - -Permission to use, copy, modify, distribute, and sell this software and its -documentation for any purpose is hereby granted without fee, provided that -the above copyright notice appear in all copies and that both that -copyright notice and this permission notice appear in supporting -documentation, and that the name of M.I.T. not be used in advertising or -publicity pertaining to distribution of the software without specific, -written prior permission. M.I.T. makes no representations about the -suitability of this software for any purpose. It is provided "as is" -without express or implied warranty. - -*/ -void -_XReadPad (Display *dpy, char *data, long size) -{ - static int padlength[4] = {0,3,2,1}; - register long bytes_read; - char pad[3]; - - CheckLock(dpy); - if (size == 0) return; - _XRead( dpy, data, size ); - if ( padlength[size & 3] ) { - _XRead( dpy, pad, padlength[size & 3] ); - } - -} -#endif /* VMS */ - -/* _____________ LEVEL 2 DPS/PROTOCOL 9 ADDITIONS _____________ */ - -void -XDPSLNotifyWhenReady( - Display *xdpy, - ContextXID cxid, - int val[4]) -{ - int dpyix; - register Display *dpy = ShuntMap[dpyix = DPY_NUMBER(xdpy)]; - register xPSNotifyWhenReadyReq *req; - - if (version[dpyix] < DPSPROTO_V09) - { - DPSWarnProc(NULL, "Attempted use of XDPSLNotifyWhenReady with incompatible server ignored"); - return; /* PROTO 9 or later only */ - } - - if (dpy != xdpy) - { - register int syncMask = displayFlags[dpyix].syncMask; - - if (syncMask & DPSCAP_SYNCMASK_RECONCILE) - XDPSLReconcileRequests(xdpy, cxid); - - /* If this context got paused, no matter how, ignore - mode and resume it */ - if (gTotalPaused && DPSCAPResumeContext(xdpy, cxid)) - { - /* xdpy was flushed by DPSCAPResumeContext */ - if (gAutoFlush) - N_XFlush(dpy); - } - else if (syncMask & DPSCAP_SYNCMASK_SYNC) - XSync(xdpy, False); - } - LockDisplay(dpy); - - NXMacroGetReq(PSNotifyWhenReady, req); - req->reqType = MajorOpCode(xdpy); - req->dpsReqType = X_PSNotifyWhenReady; - req->cxid = cxid; - req->val1 = val[0]; - req->val2 = val[1]; - req->val3 = val[2]; - req->val4 = val[3]; - - if (gAutoFlush && dpy != xdpy) - { - N_XFlush(dpy); - } - UnlockDisplay(dpy); - SyncHandle(); - if (dpy != xdpy) - LastXRequest[dpyix] = XNextRequest(xdpy)-1; -} - -XDPSLPSErrors -XDPSLTestErrorCode(Display *dpy, int ecode) -{ - XExtCodes *c = XDPSLGetCodes(dpy); - - if (c == NULL) - return not_pserror; - - switch (ecode - c->first_error) - { - case PSERRORBADCONTEXT: return(pserror_badcontext); - case PSERRORBADSPACE: return(pserror_badspace); - case PSERRORABORT: - if (version[DPY_NUMBER(dpy)] < DPSPROTO_V09) - return(not_pserror); - else - return(pserror_abort); - default: return(not_pserror); - } -} - -/* _____________ CLIENT SIDE DPS ADDITIONS _____________ */ - -/* === NEW HOOKS INTO XDPS === */ - -void -XDPSLSetVersion(Display *dpy, unsigned ver) -{ - version[DPY_NUMBER(dpy)] = ver; -} - -void -XDPSLSetCodes(Display *dpy, XExtCodes *codes) -{ - Codes[DPY_NUMBER(dpy)] = codes; -} - -Display * -XDPSLGetShunt(Display *dpy_in) -{ - return(ShuntMap[DPY_NUMBER(dpy_in)]); -} - -void -XDPSLSetShunt(Display *dpy_in, Display *dpy_out) -{ - ShuntMap[DPY_NUMBER(dpy_in)] = dpy_out; -} - -int -XDPSLGetSyncMask(Display *dpy) -{ - return (int)displayFlags[DPY_NUMBER(dpy)].syncMask; -} - -void -XDPSLSetSyncMask(Display *dpy, int mask) -{ - displayFlags[DPY_NUMBER(dpy)].syncMask = (char)mask; - gForceFlush = (mask & DPSCAP_SYNCMASK_RECONCILE); -} - -void -XDPSLFlush(Display *xdpy) -{ - register Display *dpy = ShuntMap[DPY_NUMBER(xdpy)]; - - _XFlush(xdpy); - if (dpy != xdpy) - N_XFlush(dpy); -} - -void -XDPSLSyncGCClip(Display *xdpy, GC gc) -{ - register unsigned long oldDirty; - register int dpyix; - register Display *dpy = ShuntMap[dpyix = DPY_NUMBER(xdpy)]; - - /* We DON'T want to notice all gc changes, just the clip */ - oldDirty = gc->dirty; - gc->dirty = (GCClipXOrigin|GCClipYOrigin); - XDPSLFlushGC(xdpy, gc); - gc->dirty = oldDirty; - if (dpy == xdpy || gNXSyncGCMode != 1) /* 1 means sync always */ - { - /* For DPS NX and SLOW mode, flushing the gc cache has - the side-effect of synching agent and server connections. - So, to have consistent behavior, we sync for the DPS/X - or FAST cases too. */ - - if (GCFlushMode[dpyix] == XDPSNX_GC_UPDATES_FAST - || dpy == xdpy) - XDPSLSync(xdpy); - } -} - - -#ifdef VMS -void -XDPSLSetDisplay(Display *dpy) -{ - dpys[DPY_NUMBER(dpy)] = dpy; -} -#endif /* VMS */ - -char * -XDPSLSetAgentName(Display *dpy, char *name, int deflt) -{ - char *old; - - if (gCSDPS == NULL) - DPSCAPStartUp(); - if (deflt) - { - old = gCSDPS->defaultAgentName; - gCSDPS->defaultAgentName = name; - } - else - { - old = gCSDPS->map[DPY_NUMBER(dpy)]; - gCSDPS->map[DPY_NUMBER(dpy)] = name; - } - return(old); -} - - -void -XDPSLSetClientMessageHandler(Display *dpy) -{ - if (dpy == NULL) return; - ClientMsgProc[DPY_NUMBER(dpy)] = XESetWireToEvent( - dpy, - ClientMessage, - DPSCAPClientMessageProc); -} - -void -XDPSLSetAfterProc(Display *xdpy) -{ - if (xdpy == NULL) return; - AfterProcs[DPY_NUMBER(xdpy)] = (GenericProcPtrReturnsInt) - XSetAfterFunction(xdpy, DPSCAPAfterProc); - /* +++ Consider using agent->synchandler to store old proc */ -} - - -CSDPSFakeEventTypes -XDPSLGetCSDPSFakeEventType(Display *dpy, XEvent *event) -{ - XExtCodes *codes = Codes[DPY_NUMBER(dpy)]; - XExtData *extData; - DPSCAPData my; - - if (event->type != ClientMessage || codes == NULL) - return(csdps_not); - extData = XFindOnExtensionList( - CSDPSHeadOfDpyExt(dpy), - codes->extension); - if (!extData) - return(csdps_not); - my = (DPSCAPData) extData->private_data; - - if (event->xclient.message_type == my->typePSOutput) - return(csdps_output); - if (event->xclient.message_type == my->typePSOutputWithLen) - return(csdps_output_with_len); - if (event->xclient.message_type == my->typePSStatus) - return(csdps_status); - if (event->xclient.message_type == my->typeNoop) - return(csdps_noop); - if (event->xclient.message_type == my->typePSReady) - return(csdps_ready); - return(csdps_not); -} - -Bool -XDPSLDispatchCSDPSFakeEvent( - Display *dpy, - XEvent *event, - CSDPSFakeEventTypes t) -{ - register XDPSLOutputEvent *oce; - register DPSCAPOutputEvent *oev; - XDPSLOutputEvent fakeOutput; - XExtCodes *codes = Codes[DPY_NUMBER(dpy)]; - - if (codes == NULL) - return(False); - - /* Fake up an event in the client's format. Bypasses - extension wire-to-event conversion */ - switch (t) - { - case csdps_output: - oce = &fakeOutput; - oev = (DPSCAPOutputEvent *)event->xclient.data.b; - oce->length = DPSCAP_BYTESPEROUTPUTEVENT; - goto samo_samo; - case csdps_output_with_len: - oce = &fakeOutput; - oev = (DPSCAPOutputEvent *)event->xclient.data.b; - oce->length = oev->data[DPSCAP_DATA_LEN]; -samo_samo: - oce->type = codes->first_event + PSEVENTOUTPUT; - oce->serial = event->xclient.serial; - oce->send_event = True; /* ??? */ - oce->display = dpy; - oce->cxid = oev->cxid; - bcopy((char *) oev->data, oce->data, oce->length); - XDPSLCallOutputEventHandler(dpy, (XEvent *) oce); - break; - case csdps_status: - { - register XDPSLStatusEvent *sce; - register DPSCAPStatusEvent *sev; - XDPSLStatusEvent fakeStatus; - - sev = (DPSCAPStatusEvent *)event->xclient.data.b; - sce = &fakeStatus; - sce->type = codes->first_event + PSEVENTSTATUS; - sce->serial = event->xclient.serial; - sce->send_event = True; /* ??? */ - sce->display = dpy; - sce->status = sev->status; - sce->cxid = sev->cxid; - XDPSLCallStatusEventHandler(dpy, (XEvent *) sce); - break; - } - case csdps_ready: /* L2-DPS/PROTO 9 addition */ - { - register XDPSLReadyEvent *rce; - XDPSLReadyEvent fakeReady; - - rce = &fakeReady; - rce->type = codes->first_event + PSEVENTREADY; - rce->serial = event->xclient.serial; - rce->send_event = True; - rce->display = dpy; - rce->cxid = event->xclient.data.l[0]; - rce->val[0] = event->xclient.data.l[1]; - rce->val[1] = event->xclient.data.l[2]; - rce->val[2] = event->xclient.data.l[3]; - rce->val[3] = event->xclient.data.l[4]; - XDPSLCallReadyEventHandler(dpy, (XEvent *) rce); - break; - } - default: - return(False); - } - return(True); -} - -void -XDPSLGetCSDPSStatus( - Display *xdpy, - XEvent *event, - void **ret_ctxt, - int *ret_status) -{ - register DPSCAPStatusEvent *sev; - - /* Assert: event is ClientMessage with typePSStatus */ - sev = (DPSCAPStatusEvent *)event->xclient.data.b; - - if (ret_ctxt != NULL) - *ret_ctxt = XDPSContextFromXID(xdpy, sev->cxid); - if (ret_status != NULL) - *ret_status = sev->status; -} - -void -XDPSLGetCSDPSReady( - Display *xdpy, - XEvent *event, - void **ret_ctxt, - int *ret_val) -{ - /* Assert: event is ClientMessage with typePSReady */ - - if (ret_ctxt != NULL) - *ret_ctxt = - XDPSContextFromXID(xdpy, (ContextXID)event->xclient.data.l[0]); - if (ret_val != NULL) - { - ret_val[0] = event->xclient.data.l[1]; - ret_val[1] = event->xclient.data.l[2]; - ret_val[2] = event->xclient.data.l[3]; - ret_val[3] = event->xclient.data.l[4]; - } -} - -void -XDPSLCAPNotify( - Display *xdpy, - ContextXID cxid, - unsigned int ntype, /* should this be an enum?? %%% */ - unsigned int data, - unsigned int extra) -{ - int dpyix; - register Display *dpy = ShuntMap[dpyix = DPY_NUMBER(xdpy)]; - register xCAPNotifyReq *req; - - if (dpy == xdpy) return; - - /* We _have_ to sync client and server here in order to guarantee - correct execution sequencing. We call this procedure alot - to keep track of GC's going away, so this is a major - performance hit. */ - if (ntype == DPSCAPNOTE_FREEGC) - XSync(xdpy, False); - - LockDisplay(dpy); - - NXMacroGetReq(CAPNotify, req); - req->reqType = DPSCAPOPCODEBASE; - req->type = X_CAPNotify; - req->cxid = cxid; - req->notification = ntype; - req->data = data; - req->extra = extra; - - if (gAutoFlush) - N_XFlush(dpy); - - UnlockDisplay(dpy); - SyncHandle(); - LastXRequest[dpyix] = XNextRequest(xdpy)-1; -} - -void -XDPSLSync(Display *xdpy) -{ - register Display *dpy = ShuntMap[DPY_NUMBER(xdpy)]; - - if (dpy == xdpy) - { - /* DPS/X */ - XSync(dpy, False); - } - else - { - /* CSDPS */ - XEvent event; - DPSCAPData my; - XExtData *extData; - XExtCodes *codes = Codes[DPY_NUMBER(xdpy)]; - - if (codes == NULL) - return; - /* Get private data */ - extData = XFindOnExtensionList( - CSDPSHeadOfDpyExt(xdpy), - codes->extension); - if (!extData) - return; - my = (DPSCAPData) extData->private_data; - my->saveseq = XNextRequest(dpy)-1; - /* first send notification to agent */ - XDPSLCAPNotify(xdpy, 0, DPSCAPNOTE_SYNC, my->saveseq, 0); -#ifdef XXX -fprintf(stderr, "\nXDPSLSync(DPSCAPNOTE_SYNC) sending ... "); -#endif - _XFlush(xdpy); - N_XFlush(dpy); -#ifdef XXX -fprintf(stderr, "sent.\nWaiting for reply ... "); -#endif - /* agent should send a ClientMessage, so wait for it */ - XIfEvent(xdpy, &event, WaitForSyncProc, (char *) my); - -#ifdef XXX -fprintf(stderr, "received.\n"); -#endif - /* now client, agent, and server are synchronized */ - } -} - -void -XDPSLReconcileRequests(Display *xdpy, ContextXID cxid) -{ - int dpyix; - unsigned int seqnum; - register Display *dpy = ShuntMap[dpyix = DPY_NUMBER(xdpy)]; - - if (dpy == xdpy) - return; /* No-op for DPS/X */ - - /* Get the sequence number and set the pause flag - IFF we are sure that some X protocol has occurred - since the last time we did a DPS request. This - minimizes pause/resume requests */ - - if (LastXRequest[dpyix] == XNextRequest(xdpy)-1) - { - if (gAutoFlush) - N_XFlush(dpy); /* This is what XDPSLCAPNotify would do */ - return; - } - else - seqnum = DPSCAPSetPause(xdpy, cxid); - - /* Pause the context specified. */ - XDPSLCAPNotify(xdpy, cxid, DPSCAPNOTE_PAUSE, seqnum, 0); - - /* We don't even need to flush. All we have to do is make - sure that the notify request is queued before any - DPS requests that follow. */ -} - -Status -XDPSLSetAgentArg(Display *xdpy, int arg, int val) -{ - int dpyix; - register Display *dpy = ShuntMap[dpyix = DPY_NUMBER(xdpy)]; - CARD32 capArg; - register xCAPSetArgReq *req; - - if (dpy == xdpy) - return(Success); /* No-op for DPS/X */ - - /* dpy will be NIL if we haven't opened a connection yet, - but that's okay since we need to save the value anyway. */ - - if (dpy) - { - int syncMask = displayFlags[dpyix].syncMask; - - /* ASSERT: There is no reason to pause the context for this - request, so just sync. */ - if (syncMask & (DPSCAP_SYNCMASK_SYNC|DPSCAP_SYNCMASK_RECONCILE)) - XSync(xdpy, False); - } - - switch (arg) - { - case AGENT_ARG_SMALLFONTS: - AgentArgs[dpyix].showSmallSizes = val; - capArg = DPSCAP_ARG_SMALLFONTS; - break; - case AGENT_ARG_PIXMEM: - AgentArgs[dpyix].pixMem = val; - capArg = DPSCAP_ARG_PIXMEM; - break; - default: - return(!Success); - } - if (!dpy) - return(Success); - - LockDisplay(dpy); - - NXMacroGetReq(CAPSetArg, req); - req->reqType = DPSCAPOPCODEBASE; - req->type = X_CAPSetArg; - req->arg = capArg; - req->val = val; - - if (gAutoFlush) - N_XFlush(dpy); - - UnlockDisplay(dpy); - SyncHandle(); - LastXRequest[dpyix] = XNextRequest(xdpy)-1; - return(Success); -} - - -void -XDPSLCleanAll(xdpy) - register Display *xdpy; -{ - /* Clean up all state associated with dpy */ - register DPSCAPPausedContextData *slot; - int dpyix = DPY_NUMBER(xdpy); - - /* Clean up paused context list */ - for (slot = PausedPerDisplay[dpyix]; slot; slot = PausedPerDisplay[dpyix]) - { - PausedPerDisplay[dpyix] = slot->next; - Xfree(slot); - } - - /* Clear agent args */ - AgentArgs[dpyix].showSmallSizes = 0; - AgentArgs[dpyix].pixMem = 0; -} - -void -XDPSLUpdateAgentArgs(xdpy) - register Display *xdpy; -{ - int dpyix = DPY_NUMBER(xdpy); - - if (AgentArgs[dpyix].showSmallSizes) - XDPSLSetAgentArg(xdpy, AGENT_ARG_SMALLFONTS, AgentArgs[dpyix].showSmallSizes); - if (AgentArgs[dpyix].pixMem) - XDPSLSetAgentArg(xdpy, AGENT_ARG_PIXMEM, AgentArgs[dpyix].pixMem); -} - -void -XDPSLCleanContext(xdpy, cxid) - Display *xdpy; - ContextXID cxid; -{ - /* Clean up all state associated with cxid on this dpy */ - register DPSCAPPausedContextData *slot, *prev; - int dpyix = DPY_NUMBER(xdpy); - - /* If this is DPS/X, then slot will never have been initialized. - See XDPSLNotifyContext */ - - /* Clean up paused context list */ - prev = (DPSCAPPausedContextData *)NULL; - for (slot = PausedPerDisplay[dpyix]; slot; prev = slot, slot = slot->next) - { - if (slot->cxid != cxid) - continue; - if (!prev) - PausedPerDisplay[dpyix] = slot->next; - else - prev->next = slot->next; - Xfree(slot); - break; - } -} - -/* DPS NX 2.0 */ -void -XDPSLSetGCFlushMode(dpy, value) - Display *dpy; - int value; -{ - int dpyix; - register Display *agent = ShuntMap[dpyix = DPY_NUMBER(dpy)]; - - if (value != XDPSNX_GC_UPDATES_SLOW && value != XDPSNX_GC_UPDATES_FAST) - { - DPSWarnProc(NULL, "DPS NX: Bogus GC flush mode.\n"); - return; - } - /* 0 means no NX */ - GCFlushMode[dpyix] = (agent == dpy) ? 0 : value; -} - -int -XDPSLGetGCFlushMode(dpy) - Display *dpy; -{ - return(GCFlushMode[DPY_NUMBER(dpy)]); -} - -void -XDPSLFlushGC(xdpy, gc) - Display *xdpy; - GC gc; -{ - int dpyix; - register Display *dpy = ShuntMap[dpyix = DPY_NUMBER(xdpy)]; - - if (!gc->dirty) return; - - if (GCFlushMode[dpyix] == XDPSNX_GC_UPDATES_FAST) - { - XGCValues vals; - static unsigned long valuemask = DPSGCBITS & ~(GCClipMask); - - /* Okay to call Xlib, since dpy isn't locked */ - DPSAssertWarn(XGetGCValues(xdpy, gc, valuemask, &vals), - NULL, "DPS NX: XGetGCValues returned False\n"); - vals.clip_mask = gc->values.clip_mask; - LockDisplay(dpy); - DPSCAPChangeGC(dpy, gc, DPSGCBITS, &vals); - UnlockDisplay(dpy); - SyncHandle(); - } - /* Fall thru. Either the GCFlushMode is SLOW, which means - we will DPSCAPChangeGC as a side-effect of FlushGC when - the GC hook is called, or we just did it in the FAST case. */ - FlushGC(xdpy, gc); - XDPSLFlush(xdpy); -} - -/* === PRIVATE CSDPS PROCS === */ - -static Status -DPSCAPClientMessageProc( - Display *dpy, - XEvent *re, - xEvent *event) -{ - register XDPSLOutputEvent *oce; - register DPSCAPOutputEvent *oev; - XDPSLOutputEvent fakeOutput; - XExtCodes *codes = Codes[DPY_NUMBER(dpy)]; - PSCMProc oldProc = ClientMsgProc[DPY_NUMBER(dpy)]; - - if (codes != NULL) - { - /* Get private data */ - XExtData *extData = XFindOnExtensionList( - CSDPSHeadOfDpyExt(dpy), - codes->extension); - DPSCAPData my; - - /* There's no extension, or there is an extension but we are - passing events uninterpreted, so just pass it along - unless it is a DPSCAP error. */ - - if (!extData) - goto pass_the_buck; - my = (DPSCAPData) extData->private_data; - if (XDPSLGetPassEventsFlag(dpy) && - (event->u.clientMessage.u.l.type != my->typeXError)) - goto pass_the_buck; - - /* Fake up a DPS extension event and handle it transparently, - without going through the Xlib event queue */ - - if (event->u.clientMessage.u.b.type == my->typePSOutput) - { - oce = &fakeOutput; - oce->length = DPSCAP_BYTESPEROUTPUTEVENT; - oev = (DPSCAPOutputEvent *)event->u.clientMessage.u.b.bytes; - goto common_stuff; - } - else if (event->u.clientMessage.u.b.type == my->typePSOutputWithLen) - { - oce = &fakeOutput; - oev = (DPSCAPOutputEvent *)event->u.clientMessage.u.b.bytes; - oce->length = oev->data[DPSCAP_DATA_LEN]; -common_stuff: - oce->type = codes->first_event + PSEVENTOUTPUT; - oce->serial = _XSetLastRequestRead(dpy, (xGenericReply *)event); - oce->send_event = True; /* ??? */ - oce->display = dpy; - oce->cxid = oev->cxid; - bcopy((char *) oev->data, oce->data, oce->length); - /* We've converted the event, give it to DPS */ - if (TextProc) - (*TextProc)((XEvent *) oce); - return(False); - } - else if (event->u.clientMessage.u.b.type == my->typePSStatus) - { - register XDPSLStatusEvent *sce; - register DPSCAPStatusEvent *sev; - XDPSLStatusEvent fakeStatus; - - sev = (DPSCAPStatusEvent *)event->u.clientMessage.u.b.bytes; - sce = &fakeStatus; - sce->type = codes->first_event + PSEVENTSTATUS; - sce->serial = _XSetLastRequestRead(dpy, (xGenericReply *)event); - sce->send_event = True; /* ??? */ - sce->display = dpy; - sce->cxid = sev->cxid; - sce->status = sev->status; - /* We've converted the event, give it to DPS */ - if (StatusProc[DPY_NUMBER(dpy)]) - (*(StatusProc[DPY_NUMBER(dpy)]))((XEvent *) sce); - return(False); - } - else if (event->u.clientMessage.u.l.type == my->typeXError) - { - xError err; - register xError *e = &err; - - e->type = X_Error; - e->errorCode = event->u.clientMessage.u.l.longs0; - e->sequenceNumber = event->u.u.sequenceNumber; - e->resourceID = event->u.clientMessage.u.l.longs3; - e->minorCode = event->u.clientMessage.u.l.longs2; - e->majorCode = event->u.clientMessage.u.l.longs1; - /* Smash the wire event here, before going off deep end */ - event->u.clientMessage.u.l.type = my->typeNoop; - /* Jump! */ - return(_XError(dpy, e)); - } - else if (event->u.clientMessage.u.l.type == my->typePSReady) - /* L2-DPS/PROTO 9 addition */ - { - register XDPSLReadyEvent *rce; - XDPSLReadyEvent fakeReady; - - rce = &fakeReady; - rce->type = codes->first_event + PSEVENTREADY; - rce->serial = _XSetLastRequestRead(dpy, (xGenericReply *)event); - rce->send_event = True; - rce->display = dpy; - rce->cxid = event->u.clientMessage.u.l.longs0; - rce->val[0] = event->u.clientMessage.u.l.longs1; - rce->val[1] = event->u.clientMessage.u.l.longs2; - rce->val[2] = event->u.clientMessage.u.l.longs3; - rce->val[3] = event->u.clientMessage.u.l.longs4; - XDPSLCallReadyEventHandler(dpy, (XEvent *) rce); - return(False); - } - } - - /* Put the event on the queue, so that Xlib is happy */ -pass_the_buck: - return(oldProc(dpy, re, event)); -} - - -static void -DPSCAPInitGC(Display *dpy, Display *agent, GC gc) -{ - XGCValues values; - unsigned long valuemask = DPSGCBITS & ~(GCClipMask); - - /* Okay to call Xlib, since dpy isn't locked */ - DPSAssertWarn(XGetGCValues(dpy, gc, valuemask, &values), - NULL, "DPS NX: XGetGCValues returned False\n"); - values.clip_mask = gc->values.clip_mask; - DPSCAPChangeGC(agent, gc, DPSGCBITS, &values); - SyncHandle(); - XDPSLSync(dpy); -} - - -/* ARGSUSED */ - -static Bool -WaitForSyncProc(Display *xdpy, XEvent *event, char *arg) -{ - DPSCAPData my = (DPSCAPData)arg; - - if ((event->type & 0x7F) == ClientMessage - && event->xclient.message_type == my->typeSync - && event->xclient.data.l[0] == (long) my->saveseq) { - return(True); - } else { - return(False); - } -} - - -static int -DPSCAPAfterProc(Display *xdpy) -{ - register Display *dpy = ShuntMap[DPY_NUMBER(xdpy)]; - GenericProcPtrReturnsInt proc; - - if (dpy != (Display *)NULL && dpy != xdpy) - { - LockDisplay(dpy); - N_XFlush(dpy); - UnlockDisplay(dpy); - LockDisplay(xdpy); - _XFlush(xdpy); - UnlockDisplay(xdpy); - } - if ((proc = AfterProcs[DPY_NUMBER(xdpy)]) != NULL) - return((*proc)(xdpy)); - else - return(0); -} - - -static unsigned int -DPSCAPSetPause(Display *xdpy, ContextXID cxid) -{ - register DPSCAPPausedContextData *slot; - int dpyix; - unsigned int ret; - - /* Find or create slot */ - - slot = PausedPerDisplay[dpyix = DPY_NUMBER(xdpy)]; - if (!slot) - { - slot = (DPSCAPPausedContextData *) - Xcalloc(1, sizeof(DPSCAPPausedContextData)); - PausedPerDisplay[dpyix] = slot; - goto common_code; - /* IMPLICATION: it is okay to fall through common_code - and do test_ret. */ - } - while (1) - if (slot->cxid == cxid) - { - if (!slot->paused) - { - slot->paused = True; - ++gTotalPaused; - } - /* Back-to-back pauses get different sequence numbers */ - ret = ++slot->seqnum; - goto test_ret; - } - else if (slot->next) slot = slot->next; - else break; - /* cxid wasn't found, so add it */ - /* ASSERT: slot points to last record of the list */ - slot->next = (DPSCAPPausedContextData *) - Xcalloc(1, sizeof(DPSCAPPausedContextData)); - slot = slot->next; -common_code: - slot->paused = True; - ++gTotalPaused; - slot->cxid = cxid; - ret = ++slot->seqnum; -test_ret: - if (!ret) - { - DPSWarnProc(NULL, "Pause sequence wrapped around!"); - } - return(ret); -} - -static Bool -DPSCAPResumeContext(Display *xdpy, ContextXID cxid) -{ - register DPSCAPPausedContextData *slot; - int dpyix = DPY_NUMBER(xdpy); - - /* Try to match cxid to list of paused contexts */ - for (slot = PausedPerDisplay[dpyix]; slot; slot = slot->next) - if (slot->cxid == cxid && slot->paused) - { - /* Send resume event */ - register XClientMessageEvent *ee; - XEvent e; - XExtData *extData; - DPSCAPData my; - XExtCodes *codes = Codes[dpyix]; - - extData = XFindOnExtensionList( - CSDPSHeadOfDpyExt(xdpy), - codes->extension); - if (!extData) - return(False); - my = (DPSCAPData) extData->private_data; - - ee = &e.xclient; - ee->type = ClientMessage; - ee->display = xdpy; - ee->window = my->agentWindow; - ee->format = 32; - ee->message_type = my->typeResume; - ee->data.l[0] = cxid; - ee->data.l[1] = slot->seqnum; - (void) XSendEvent( - xdpy, - my->agentWindow, - False, - NoEventMask, - &e); - XFlush(xdpy); - /* Turn off flag */ - slot->paused = False; - --gTotalPaused; - return(True); - } - /* Fall thru */ - return(False); -} diff --git a/nx-X11/lib/dps/Xlibnet.h b/nx-X11/lib/dps/Xlibnet.h deleted file mode 100644 index f86c3542b..000000000 --- a/nx-X11/lib/dps/Xlibnet.h +++ /dev/null @@ -1,284 +0,0 @@ -/* $XConsortium: Xlibnet.h,v 1.18 91/07/23 19:01:27 rws Exp $ */ - -/* -Copyright 1991 Massachusetts Institute of Technology - -Permission to use, copy, modify, distribute, and sell this software and its -documentation for any purpose is hereby granted without fee, provided that -the above copyright notice appear in all copies and that both that -copyright notice and this permission notice appear in supporting -documentation, and that the name of M.I.T. not be used in advertising or -publicity pertaining to distribution of the software without specific, -written prior permission. M.I.T. makes no representations about the -suitability of this software for any purpose. It is provided "as is" -without express or implied warranty. -*/ -/* $XFree86: xc/lib/dps/Xlibnet.h,v 1.6 2001/06/30 22:41:44 tsi Exp $ */ -/* - * Xlibnet.h - Xlib networking include files for UNIX Systems. - */ - -#ifndef X_UNIX_PATH -#ifdef hpux -#define X_UNIX_PATH "/usr/spool/sockets/X11/" -#define OLD_UNIX_PATH "/tmp/.X11-unix/X" -#else -#define X_UNIX_PATH "/tmp/.X11-unix/X" -#endif -#endif /* X_UNIX_PATH */ - -#ifdef STREAMSCONN -#ifdef SYSV -/* - * UNIX System V Release 3.2 - */ -#define BytesReadable(fd,ptr) (_XBytesReadable ((fd), (ptr))) -#define MALLOC_0_RETURNS_NULL -#include <sys/ioctl.h> - -#endif /* SYSV */ -#ifdef SVR4 -/* - * TLI (Streams-based) networking - */ -#define BytesReadable(fd,ptr) (_XBytesReadable ((fd), (ptr))) -#include <sys/uio.h> /* define struct iovec */ - -#endif /* SVR4 */ -#else /* not STREAMSCONN */ -/* - * socket-based systems - */ -#include <netinet/in.h> -#include <sys/ioctl.h> -#include <netdb.h> -#include <sys/uio.h> /* needed for XlibInt.c */ -#ifdef SVR4 -#include <sys/filio.h> -#endif - -#if defined(i386) && defined(SYSV) -#if !defined(__SCO__) -#include <net/errno.h> -#endif -#include <sys/stropts.h> -#define BytesReadable(fd,ptr) ioctl((fd), I_NREAD, (ptr)) -#else -#define BytesReadable(fd, ptr) ioctl ((fd), FIONREAD, (ptr)) -#endif - -#endif /* STREAMSCONN else */ - -/* - * If your BytesReadable correctly detects broken connections, then - * you should NOT define XCONN_CHECK_FREQ. - */ -#define XCONN_CHECK_FREQ 256 - -#ifndef X_NOT_POSIX -#ifdef _POSIX_SOURCE -#include <limits.h> -#else -#define _POSIX_SOURCE -#include <limits.h> -#undef _POSIX_SOURCE -#endif -#endif -#ifndef OPEN_MAX -#ifdef SVR4 -#define OPEN_MAX 256 -#else -#include <sys/param.h> -#ifndef OPEN_MAX -#ifdef NOFILE -#define OPEN_MAX NOFILE -#else -#if !defined(__UNIXOS2__) && !defined(__QNX__) -#define OPEN_MAX NOFILES_MAX -#else -#define OPEN_MAX 256 -#endif -#endif -#endif -#endif -#endif - -#if OPEN_MAX > 256 -#undef OPEN_MAX -#define OPEN_MAX 256 -#endif - -/* Adobe additions */ -#ifdef MSKCNT -#undef MSKCNT -#endif -#ifdef BITMASK -#undef BITMASK -#endif -#ifdef MASKIDX -#undef MASKIDX -#endif - -#define MSKCNT ((OPEN_MAX + 31) / 32) - -#if (MSKCNT==1) -#define BITMASK(i) (1 << (i)) -#define MASKIDX(i) 0 -#endif -#if (MSKCNT>1) -#define BITMASK(i) (1 << ((i) & 31)) -#define MASKIDX(i) ((i) >> 5) -#endif - -#define MASKWORD(buf, i) buf[MASKIDX(i)] -#define BITSET(buf, i) MASKWORD(buf, i) |= BITMASK(i) -#define BITCLEAR(buf, i) MASKWORD(buf, i) &= ~BITMASK(i) -#define GETBIT(buf, i) (MASKWORD(buf, i) & BITMASK(i)) - -/* Adobe additions */ -#ifdef COPYBITS -#undef COPYBITS -#undef CLEARBITS -#undef MASKANDSETBITS -#undef ORBITS -#undef UNSETBITS -#endif - -#if (MSKCNT==1) -#define COPYBITS(src, dst) dst[0] = src[0] -#define CLEARBITS(buf) buf[0] = 0 -#define MASKANDSETBITS(dst, b1, b2) dst[0] = (b1[0] & b2[0]) -#define ORBITS(dst, b1, b2) dst[0] = (b1[0] | b2[0]) -#define UNSETBITS(dst, b1) (dst[0] &= ~b1[0]) -#define _XANYSET(src) (src[0]) -#endif -#if (MSKCNT==2) -#define COPYBITS(src, dst) { dst[0] = src[0]; dst[1] = src[1]; } -#define CLEARBITS(buf) { buf[0] = 0; buf[1] = 0; } -#define MASKANDSETBITS(dst, b1, b2) {\ - dst[0] = (b1[0] & b2[0]);\ - dst[1] = (b1[1] & b2[1]); } -#define ORBITS(dst, b1, b2) {\ - dst[0] = (b1[0] | b2[0]);\ - dst[1] = (b1[1] | b2[1]); } -#define UNSETBITS(dst, b1) {\ - dst[0] &= ~b1[0]; \ - dst[1] &= ~b1[1]; } -#define _XANYSET(src) (src[0] || src[1]) -#endif -#if (MSKCNT==3) -#define COPYBITS(src, dst) { dst[0] = src[0]; dst[1] = src[1]; \ - dst[2] = src[2]; } -#define CLEARBITS(buf) { buf[0] = 0; buf[1] = 0; buf[2] = 0; } -#define MASKANDSETBITS(dst, b1, b2) {\ - dst[0] = (b1[0] & b2[0]);\ - dst[1] = (b1[1] & b2[1]);\ - dst[2] = (b1[2] & b2[2]); } -#define ORBITS(dst, b1, b2) {\ - dst[0] = (b1[0] | b2[0]);\ - dst[1] = (b1[1] | b2[1]);\ - dst[2] = (b1[2] | b2[2]); } -#define UNSETBITS(dst, b1) {\ - dst[0] &= ~b1[0]; \ - dst[1] &= ~b1[1]; \ - dst[2] &= ~b1[2]; } -#define _XANYSET(src) (src[0] || src[1] || src[2]) -#endif -#if (MSKCNT==4) -#define COPYBITS(src, dst) dst[0] = src[0]; dst[1] = src[1]; \ - dst[2] = src[2]; dst[3] = src[3] -#define CLEARBITS(buf) buf[0] = 0; buf[1] = 0; buf[2] = 0; buf[3] = 0 -#define MASKANDSETBITS(dst, b1, b2) \ - dst[0] = (b1[0] & b2[0]);\ - dst[1] = (b1[1] & b2[1]);\ - dst[2] = (b1[2] & b2[2]);\ - dst[3] = (b1[3] & b2[3]) -#define ORBITS(dst, b1, b2) \ - dst[0] = (b1[0] | b2[0]);\ - dst[1] = (b1[1] | b2[1]);\ - dst[2] = (b1[2] | b2[2]);\ - dst[3] = (b1[3] | b2[3]) -#define UNSETBITS(dst, b1) \ - dst[0] &= ~b1[0]; \ - dst[1] &= ~b1[1]; \ - dst[2] &= ~b1[2]; \ - dst[3] &= ~b1[3] -#define _XANYSET(src) (src[0] || src[1] || src[2] || src[3]) -#endif - -#if (MSKCNT>4) -#define COPYBITS(src, dst) bcopy((char *) src, (char *) dst,\ - MSKCNT*sizeof(long)) -#define CLEARBITS(buf) bzero((char *) buf, MSKCNT*sizeof(long)) -#define MASKANDSETBITS(dst, b1, b2) \ - { int cri; \ - for (cri=MSKCNT; --cri>=0; ) \ - dst[cri] = (b1[cri] & b2[cri]); } -#define ORBITS(dst, b1, b2) \ - { int cri; \ - for (cri=MSKCNT; --cri>=0; ) \ - dst[cri] = (b1[cri] | b2[cri]); } -#define UNSETBITS(dst, b1) \ - { int cri; \ - for (cri=MSKCNT; --cri>=0; ) \ - dst[cri] &= ~b1[cri]; } -/* - * If MSKCNT>4, then _XANYSET is a routine defined in XlibInt.c. - * - * #define _XANYSET(src) (src[0] || src[1] || src[2] || src[3] || src[4] ...) - */ -extern int N_XANYSET(unsigned long *); -#endif - -/* - * ReadvFromServer and WritevToSever use struct iovec, normally found - * in Berkeley systems in <sys/uio.h>. See the readv(2) and writev(2) - * manual pages for details. - * - * struct iovec { - * caddr_t iov_base; - * int iov_len; - * }; - */ -#if defined(USG) && !defined(CRAY) && !defined(umips) && !defined(MOTOROLA) -struct iovec { - caddr_t iov_base; - int iov_len; -}; -#endif /* USG */ - - -#ifdef STREAMSCONN -#include "Xstreams.h" - -extern char _XsTypeOfStream[]; -extern Xstream _XsStream[]; - -#define ReadFromServer(dpy, data, size) \ - (*_XsStream[_XsTypeOfStream[dpy]].ReadFromStream)((dpy), (data), (size), \ - BUFFERING) -#define WriteToServer(dpy, bufind, size) \ - (*_XsStream[_XsTypeOfStream[dpy]].WriteToStream)((dpy), (bufind), (size)) - -#else /* else not STREAMSCONN */ - -/* - * bsd can read from sockets directly - */ -#define ReadFromServer(dpy, data, size) read((dpy), (data), (size)) -#define WriteToServer(dpy, bufind, size) write((dpy), (bufind), (size)) - -#endif /* STREAMSCONN */ - - -#ifndef USL_COMPAT -#if !defined(USG) || defined(MOTOROLA) || \ - defined(__SCO__) || (!(defined(SYSV) && defined(i386))) || \ - defined(__UNIXWARE__) -#define _XReadV readv -#define _XWriteV writev -#endif -#endif /* !USL_COMPAT */ - -#define ReadvFromServer(dpy, iov, iovcnt) _XReadV((dpy), (iov), (iovcnt)) -#define WritevToServer(dpy, iov, iovcnt) _XWriteV((dpy), (iov), (iovcnt)) diff --git a/nx-X11/lib/dps/Xstreams.h b/nx-X11/lib/dps/Xstreams.h deleted file mode 100644 index a7419131b..000000000 --- a/nx-X11/lib/dps/Xstreams.h +++ /dev/null @@ -1,218 +0,0 @@ -/* $XConsortium: Xstreams.h,v 1.6 91/07/19 23:22:53 gildea Exp $ */ -/* Copyright (c) 1990, 1991 UNIX System Laboratories, Inc. */ -/* Copyright (c) 1988 AT&T */ -/* All Rights Reserved */ - -/* - * Permission to use, copy, modify, and distribute this software and its - * documentation for any purpose and without fee is hereby granted, provided - * that the above copyright notice appear in all copies and that both that - * copyright notice and this permission notice appear in supporting - * documentation, and that the name of AT&T or USL not be used in advertising - * or publicity pertaining to distribution of the software without specific, - * written prior permission. AT&T and USL make no representations about the - * suitability of this software for any purpose. It is provided "as is" - * without express or implied warranty. - * - * AT&T and USL DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, - * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN - * NO EVENT SHALL AT&T or USL BE LIABLE FOR ANY SPECIAL, INDIRECT OR - * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS - * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, - * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN - * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ -/* $XFree86$ */ - - -#ifndef _XSTREAMS_H_ -#define _XSTREAMS_H_ -/* - Xstreams.h (C header file) - Acc: 575304412 Tue Apr 26 09:46:52 1988 - Mod: 574017273 Tue Apr 26 12:14:33 1988 - Sta: 574017273 Tue Apr 26 12:14:33 1988 - Owner: 2011 - Group: 1985 - Permissions: 644 -*/ -/* - START USER STAMP AREA -*/ -/* - END USER STAMP AREA -*/ - - - -#define MEM_ALLIGN(ptr) ((((unsigned) (ptr + 3)) >> 2) << 2) - -#define CONNECT_TIMEOUT 60 -#define MAX_AUTO_BUF_LEN 256 -#define MAX_DISP_DIGITS 20 -#define MAX_NETS 8 - -typedef struct _host { - char host_name[32]; - int host_len; - struct _host *next; -} HOST; - -/* - * Structure for handling multiple connection requests on the same stream. - */ - -struct listenCall { - struct t_call *CurrentCall; - struct listenCall *NextCall; -}; - -struct listenQue { - struct listenCall *QueHead; - struct listenCall *QueTail; -}; - -#define EMPTY(p) (p->QueHead == (struct listenCall *) NULL) - - -typedef struct { - int flags; - char type; - int display; - char *inputbuf; - int buflen; - int bufptr; - int msglen; - } IOBUFFER; - -typedef struct { - int _nnets; -#ifdef SVR4 - struct netconfig *_net[MAX_NETS]; -#else - char *_net[MAX_NETS]; -#endif - struct listenQue FreeList[MAX_NETS]; - struct listenQue PendingQue[MAX_NETS]; - int _npeers; - char **_peer; - int *_peerlen; - HOST *_validhosts; - } networkInfo; - - -typedef struct _Xstream { - int (*SetupTheListener)(); - int (*ConnectNewClient)(); - int (*CallTheListener)(); - int (*ReadFromStream)(); - int (*BytesCanBeRead)(); - int (*WriteToStream)(); - int (*CloseStream)(); - int (*CreateAddress)(); - union ext { - int (*NameServer)(); - networkInfo *NetInfo; - } u; - } Xstream; - -/* old shared libraries have the names already fixed */ -#ifdef USL_COMPAT -#define _XsStream xstream -#define _XReadV _readv -#define _XWriteV _writev -#define _XSelect XSelect -#define _XsErrorCall ErrorCall -#define _XsSetupLocalStream SetupLocalStream -#define _XsConnectLocalClient ConnectLocalClient -#define _XsOpenSpServer OpenSpServer -#define _XsReadLocalStream ReadLocalStream -#define _XsConnectTliClient ConnectTliClient -#define _XsSetupTliStrean SetupTliStream -#define _XsCallTliServer CallTliServer -#define _XsCallLocalServer CallLocalServer -#define _XsTypeOfStream TypeOfStream -#ifdef SVR4 -#define _XsSetupNamedStream SetupNamedStream -#define _XsSetupSpStream SetupSpStream -#endif /* SVR4 */ -#endif /* USL_COMPAT */ - -extern Xstream _XsStream[]; - -#define NO_BUFFERING 0 -#define BUFFERING 1 - -/* Network services */ - -#define OpenDaemonConnection 0 -#define PEER_NAME 1 -#define PEER_ALLOC 2 -#define PEER_FREE 3 -#define ConvertNetAddrToName 4 -#define ConvertNameToNetAddr 5 -#define ConvertNameToTliCall 6 -#define ConvertTliCallToName 7 -#define ConvertNameToTliBind 8 - -#define UNAME_LENGTH 14 - -#define X_LOCAL_STREAM 0 -#define X_NAMED_STREAM 1 -/* Enhanced Application Compatibility Support */ -#define X_SP_STREAM 2 -/* End Enhanced Application Compatibility Support */ - -#define X_TLI_STREAM 3 -#define CLOSED_STREAM -1 - -/* - The following are defined in X.h. Any changes to FamilyUname - should take X.h into consideration. -*/ - /* protocol families */ - - /* - - #define FamilyInternet 0 - #define FamilyDECnet 1 - #define FamilyChaos 2 - - */ - -#define FamilyUname 3 - -#define X_TCP_PORT 6000 - -#define NAMED_LISTENER "/dev/X/Nserver" -#define LOCAL_LISTENER "/dev/X/server" -/* Enhanced Application Compatibility Support */ -/* End Enhanced Application Compatibility Support */ - -#define NAME_SERVER_NODE "/dev/X/nameserver" -#define XNETSPECDIR "lib/net" -#define XROOTDIR "/usr/X" - -#define MAX_SIMUL_TLI_CALLS 20 - -#define SetupNetworkInfo() _XsStream[X_LOCAL_STREAM].u.NetInfo = &Network; \ - _XsStream[X_NAMED_STREAM].u.NetInfo = &Network; \ -/* Enhanced Application Compatibility Support */ \ -/* End Enhanced Application Compatibility Support */ \ - _XsStream[X_TLI_STREAM].u.NameServer = nameserver - -#define NetworkInfo (_XsStream[X_LOCAL_STREAM].u.NetInfo) -#define GetNetworkInfo (*_XsStream[X_TLI_STREAM].u.NameServer) -#define validhosts _XsStream[X_LOCAL_STREAM].u.NetInfo->_validhosts - -/* - * header of messages sent by X to the nameserver - * 1st int: the size of the entire message. - * 2nd int: the size of the header itself. - * 3rd int: the service number. - * 4th int: the display number. - * 5th int: the length of the network name. - */ - -#define HEADERSIZE (5*sizeof(int)) -#endif /* _XSTREAMS_H_ */ diff --git a/nx-X11/lib/dps/csconndi.c b/nx-X11/lib/dps/csconndi.c deleted file mode 100644 index 64205f8dc..000000000 --- a/nx-X11/lib/dps/csconndi.c +++ /dev/null @@ -1,839 +0,0 @@ -/* - * csconndi.c -- low level connection maker for CSDPS - * - * (c) Copyright 1990-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 - * - * Portions Copyright 1989 Massachusetts Institute of Technology - * - * Permission to use, copy, modify, distribute, and sell this software and its - * documentation for any purpose is hereby granted without fee, provided that - * the above copyright notice appear in all copies and that both that - * copyright notice and this permission notice appear in supporting - * documentation, and that the name of M.I.T. not be used in advertising or - * publicity pertaining to distribution of the software without specific, - * written prior permission. M.I.T. makes no representations about the - * suitability of this software for any purpose. It is provided "as is" - * without express or implied warranty. - * - * Author: Adobe Systems Incorporated and MIT X Consortium - */ -/* $XFree86: xc/lib/dps/csconndi.c,v 1.11tsi Exp $ */ - -#if defined(sun) && !defined(SVR4) -#define memmove(t,f,c) bcopy(f,t,c) -#endif - -#define NEED_EVENTS - -#include <stdio.h> -#include <stdlib.h> -#include <X11/Xos.h> -/* Include this first so that Xasync.h, included from Xlibint.h, can find - the definition of NOFILE */ -#include <sys/param.h> -#include <X11/Xlibint.h> -#include "Xlibnet.h" /* New for R5, delete for R4 */ -#include <arpa/inet.h> - -#ifndef hpux /* HP doesn't include Xauth.h :-( */ -#include <X11/Xauth.h> -#else -#define FamilyLocal (256) -#endif - -#include <ctype.h> -#ifdef DNETCONN -#include <netdnet/dn.h> -#include <netdnet/dnetdb.h> -#endif - -#include <netdb.h> - -#include "DPSCAPproto.h" -#include "cslibint.h" -#include "dpsassert.h" - -#if defined(hpux) || defined(AIXV3) -#define SELECT_TYPE int * -#else -#define SELECT_TYPE fd_set * -#endif - -#ifndef _XANYSET -#define _XANYSET N_XANYSET -#endif /* _XANYSET */ - -#ifndef X_CONNECTION_RETRIES /* number retries on ECONNREFUSED */ -#define X_CONNECTION_RETRIES 5 -#endif - -#define CONN_PARAMS char *, int , int , int *, int *, char ** - -#ifdef DNETCONN -static int MakeDECnetConnection(CONN_PARAMS); -#endif -#ifdef UNIXCONN -static int MakeUNIXSocketConnection(CONN_PARAMS); -#endif -#ifdef TCPCONN -static int MakeTCPConnection(CONN_PARAMS); -#endif -#ifdef STREAMSCONN -extern int _XMakeStreamsConnection(CONN_PARAMS); -#endif - -/* This global controls the size of the output socket buffer. Zero - means to use the system default size. */ -int gNXSndBufSize = 0; - -static char *copystring (char *src, int len) -{ - char *dst = Xmalloc (len + 1); - - if (dst) { - strncpy (dst, src, len); - dst[len] = '\0'; - } - - return dst; -} - - -/* - * Attempts to connect to agent, given name. Returns file descriptor - * (network socket) or -1 if connection fails. Names may be of the - * following format: - * - * [hostname] : [:] agentnumber - * - * The second colon indicates a DECnet style name. No hostname is interpretted - * as the most efficient local connection to a server on the same machine. - * This is usually: - * - * o shared memory - * o local stream - * o UNIX domain socket - * o TCP to local host - */ - -int -DPSCAPConnect( - char *display_name, - char **fullnamep, /* RETURN */ - int *dpynump, /* RETURN */ - int *familyp, /* RETURN */ - int *saddrlenp, /* RETURN */ - char **saddrp) /* RETURN, freed by caller */ -{ - char *lastp, *p; /* char pointers */ - char *phostname = NULL; /* start of host of display */ - char *pdpynum = NULL; /* start of dpynum of display */ - char *pscrnum = NULL; /* start of screen of display */ - Bool dnet = False; /* if true, then DECnet format */ - int iagent; /* required display number */ - int (*connfunc)(CONN_PARAMS); /* method to create connection */ - int fd = -1; /* file descriptor to return */ - int len; /* length tmp variable */ - - p = display_name; - - *saddrlenp = 0; /* set so that we can clear later */ - *saddrp = NULL; - - /* - * Step 1, find the hostname. This is delimited by the required - * first colon. - */ - for (lastp = p; *p && *p != ':'; p++) ; - if (!*p) return -1; /* must have a colon */ - - if (p != lastp) { /* no hostname given */ - phostname = copystring (lastp, p - lastp); - if (!phostname) goto bad; /* no memory */ - } - - - /* - * Step 2, see if this is a DECnet address by looking for the optional - * second colon. - */ - if (p[1] == ':') { /* then DECnet format */ - dnet = True; - p++; - } - - /* - * see if we're allowed to have a DECnet address - */ -#ifndef DNETCONN - if (dnet) goto bad; -#endif - - - /* - * Step 3, find the port number. This field is required. - * Zero is acceptable as a port number, meaning use the default. - */ - - for (lastp = ++p; *p && isascii(*p) && isdigit(*p); p++) ; - if ((p == lastp) || /* required field */ - (*p != '\0' && *p != '.') || /* invalid non-digit terminator */ - !(pdpynum = copystring (lastp, p - lastp))) /* no memory */ - goto bad; - iagent = atoi (pdpynum); - - - /* - * At this point, we know the following information: - * - * phostname hostname string or NULL - * iagent agent port number - * dnet DECnet boolean - * - * We can now decide which transport to use based on the ConnectionFlags - * build parameter the hostname string. If phostname is NULL or equals - * the string "local", then choose the best transport. If phostname - * is "unix", then choose BSD UNIX domain sockets (if configured). - * - * First, choose default transports: DECnet else (TCP or STREAMS) - */ - - -#ifdef DNETCONN - if (dnet) - connfunc = MakeDECnetConnection; - else -#endif -#ifdef TCPCONN - connfunc = MakeTCPConnection; -#else -#ifdef STREAMSCONN - connfunc = _XMakeStreamsConnection; -#else - connfunc = NULL; -#endif -#endif - -#ifdef UNIXCONN - /* - * Now that the defaults have been established, see if we have any - * special names that we have to override: - * - * :N => if UNIXCONN then unix-domain-socket - * ::N => if UNIXCONN then unix-domain-socket - * unix:N => if UNIXCONN then unix-domain-socket - * - * Note that if UNIXCONN isn't defined, then we can use the default - * transport connection function set above. - */ - if (!phostname) { - connfunc = MakeUNIXSocketConnection; - } - else if (strcmp (phostname, "unix") == 0) { - connfunc = MakeUNIXSocketConnection; - } -#endif - if (!connfunc) - goto bad; - - -#ifdef UNIXCONN -#define LOCALCONNECTION (!phostname || connfunc == MakeUNIXSocketConnection) -#else -#define LOCALCONNECTION (!phostname) -#endif - - if (LOCALCONNECTION) { - /* - * Get the auth info for local hosts so that it doesn't have to be - * repeated everywhere; the particular values in these fields are - * not part of the protocol. - */ - char hostnamebuf[256]; - int len = N_XGetHostname (hostnamebuf, sizeof hostnamebuf); - - *familyp = FamilyLocal; - if (len > 0) { - *saddrp = Xmalloc (len + 1); - if (*saddrp) { - strcpy (*saddrp, hostnamebuf); - *saddrlenp = len; - } else { - *saddrlenp = 0; - } - } - } -#undef LOCALCONNECTION - -#ifndef ultrix - /* Ultrix has a nasty bug in getservbyname(); if the name passed to - it is not in the services list it seg faults! *sigh* So, we - don't ever look in the services info for ultrix... */ - if (iagent == 0) { /* find service default, if one's defined */ - struct servent *serventInfo; - - if ((serventInfo = getservbyname(DPS_NX_SERV_NAME, - (char *) NULL)) != NULL) { - if (strcmp("tcp", serventInfo->s_proto) != 0) { - DPSWarnProc(NULL, "Services database specifies a protocol other than tcp. Using default port.\n"); - } else /* extract the port number */ - iagent = ntohs(serventInfo->s_port); - } - } -#endif /* ultrix */ - /* - * Make the connection, also need to get the auth address info for - * non-local connections. Do retries in case server host has hit its - * backlog (which, unfortunately, isn't distinguishable from there not - * being a server listening at all, which is why we have to not retry - * too many times). - */ - if ((fd = (*connfunc) (phostname, iagent, X_CONNECTION_RETRIES, - familyp, saddrlenp, saddrp)) < 0) - goto bad; - - - /* - * Set the connection non-blocking since we use select() to block; also - * set close-on-exec so that programs that fork() doesn't get confused. - */ -#ifdef FIOSNBIO - { - int arg = 1; - ioctl (fd, FIOSNBIO, &arg); - } -#else -#if defined(O_NONBLOCK) - (void) fcntl (fd, F_SETFL, O_NONBLOCK); -#elif defined(FNDELAY) - (void) fcntl (fd, F_SETFL, FNDELAY); -#else - (void) fcntl (fd, F_SETFL, O_NDELAY); -#endif /* O_NONBLOCK/FNDELAY */ -#endif /* FIOSNBIO */ - - (void) fcntl (fd, F_SETFD, 1); - - - /* - * Build the expanded display name: - * - * [host] : [:] agent \0 - */ - len = ((phostname ? strlen(phostname) : 0) + 1 + (dnet ? 1 : 0) + - strlen(pdpynum) + 1); - *fullnamep = (char *) Xmalloc (len); - if (!*fullnamep) goto bad; - - sprintf (*fullnamep, "%s%s%d", - (phostname ? phostname : ""), (dnet ? "::" : ":"), - iagent); - - *dpynump = iagent; - if (phostname) Xfree (phostname); - if (pdpynum) Xfree (pdpynum); - if (pscrnum) Xfree (pscrnum); - return fd; - - - /* - * error return; make sure everything is cleaned up. - */ - bad: - if (fd >= 0) (void) close (fd); - if (*saddrp) { - Xfree (*saddrp); - *saddrp = NULL; - } - *saddrlenp = 0; - if (phostname) Xfree (phostname); - if (pdpynum) Xfree (pdpynum); - return -1; - -} - - -/***************************************************************************** - * * - * Make Connection Routines * - * * - *****************************************************************************/ - -#ifdef DNETCONN /* stupid makedepend */ -#define NEED_BSDISH -#endif -#ifdef UNIXCONN -#define NEED_BSDISH -#endif -#ifdef TCPCONN -#define NEED_BSDISH -#endif - -#ifdef NEED_BSDISH /* makedepend can't handle #if */ -/* - * 4.2bsd-based systems - */ -#include <sys/socket.h> - -#ifndef hpux -#ifdef apollo /* nest if(n)defs because makedepend is broken */ -#ifndef NO_TCP_H -#include <netinet/tcp.h> -#endif /* NO_TCP_H */ -#else /* apollo */ -#include <netinet/tcp.h> -#endif /* apollo */ -#endif -#endif /* NEED_BSDISH */ - - -#ifdef DNETCONN -static int MakeDECnetConnection (phostname, iagent, retries, - familyp, saddrlenp, saddrp) - char *phostname; - int iagent; - int retries; - int *familyp; /* RETURN */ - int *saddrlenp; /* RETURN */ - char **saddrp; /* RETURN */ -{ - int fd; - char objname[20]; - extern int dnet_conn(); - struct dn_naddr *dnaddrp, dnaddr; - struct nodeent *np; - - if (!phostname) phostname = "0"; - - /* - * build the target object name. - */ - sprintf (objname, "DPS$EXECUTIVE_%d", iagent); - - /* - * Attempt to open the DECnet connection, return -1 if fails; ought to - * do some retries here.... - */ - if ((fd = dnet_conn (phostname, objname, SOCK_STREAM, 0, 0, 0, 0)) < 0) { - return -1; - } - - *familyp = FamilyDECnet; - if (dnaddrp = dnet_addr (phostname)) { /* stolen from xhost */ - dnaddr = *dnaddrp; - } else { - if ((np = getnodebyname (phostname)) == NULL) { - (void) close (fd); - return -1; - } - dnaddr.a_len = np->n_length; - memmove(dnaddr.a_addr, np->n_addr, np->n_length); - } - - *saddrlenp = sizeof (struct dn_naddr); - *saddrp = Xmalloc (*saddrlenp); - if (!*saddrp) { - (void) close (fd); - return -1; - } - memmove (*saddrp, (char *)&dnaddr, *saddrlenp); - return fd; -} -#endif /* DNETCONN */ - - -#ifdef UNIXCONN - -#ifndef X_NO_SYS_UN -#include <sys/un.h> -#endif - -#ifndef CSDPS_UNIX_PATH -#ifdef hpux -#define CSDPS_UNIX_DIR "/usr/spool/sockets/DPSNX" -#define CSDPS_UNIX_PATH "/usr/spool/sockets/DPSNX/" -#else -#define CSDPS_UNIX_DIR "/tmp/.DPSNX-unix" -#define CSDPS_UNIX_PATH "/tmp/.DPSNX-unix/AGENT" -#endif -#endif - -static int MakeUNIXSocketConnection ( - char *phostname, - int iagent, - int retries, - int *familyp, /* RETURN */ - int *saddrlenp, /* RETURN */ - char **saddrp) /* RETURN */ -{ - struct sockaddr_un unaddr; /* UNIX socket data block */ - struct sockaddr *addr; /* generic socket pointer */ - int addrlen; /* length of addr */ - int fd; /* socket file descriptor */ - int port = (iagent == 0) ? CSDPSPORT : iagent; - - unaddr.sun_family = AF_UNIX; - sprintf (unaddr.sun_path, "%s_%d", CSDPS_UNIX_PATH, port); - - addr = (struct sockaddr *) &unaddr; - addrlen = strlen(unaddr.sun_path) + sizeof(unaddr.sun_family); - - /* - * Open the network connection. - */ - do { - if ((fd = socket ((int) addr->sa_family, SOCK_STREAM, 0)) < 0) { - return -1; - } - - if (gNXSndBufSize > 0) - setsockopt(fd, SOL_SOCKET, SO_SNDBUF, (char *) &gNXSndBufSize, sizeof(gNXSndBufSize)); - - if (connect (fd, addr, addrlen) < 0) { - int olderrno = errno; - (void) close (fd); - if (olderrno != ENOENT || retries <= 0) { - errno = olderrno; - return -1; - } - sleep (1); - } else { - break; - } - } while (retries-- > 0); - - /* - * Don't need to get auth info since we're local - */ - return fd; -} -#endif /* UNIXCONN */ - - -#ifdef TCPCONN -static int MakeTCPConnection ( - char *phostname, - int iagent, - int retries, - int *familyp, /* RETURN */ - int *saddrlenp, /* RETURN */ - char **saddrp) /* RETURN */ -{ - char hostnamebuf[256]; /* tmp space */ - unsigned long hostinetaddr; /* result of inet_addr of arpa addr */ - struct sockaddr_in inaddr; /* IP socket */ - struct sockaddr *addr; /* generic socket pointer */ - int addrlen; /* length of addr */ - struct hostent *hp; /* entry in hosts table */ - char *cp; /* character pointer iterator */ - int fd; /* file descriptor to return */ - int len; /* length tmp variable */ - -#define INVALID_INETADDR ((unsigned long) -1) - - if (!phostname) { - hostnamebuf[0] = '\0'; - (void) N_XGetHostname (hostnamebuf, sizeof hostnamebuf); - phostname = hostnamebuf; - } - - /* - * if numeric host name then try to parse it as such; do the number - * first because some systems return garbage instead of INVALID_INETADDR - */ - if (isascii(phostname[0]) && isdigit(phostname[0])) { - hostinetaddr = inet_addr (phostname); - } else { - hostinetaddr = INVALID_INETADDR; - } - - /* - * try numeric - */ - if (hostinetaddr == INVALID_INETADDR) { - if ((hp = gethostbyname(phostname)) == NULL) { - /* No such host! */ - return -1; - } - if (hp->h_addrtype != AF_INET) { /* is IP host? */ - /* Not an Internet host! */ - return -1; - } - - /* Set up the socket data. */ - inaddr.sin_family = hp->h_addrtype; -#if defined(CRAY) && defined(OLDTCP) - /* Only Cray UNICOS3 and UNICOS4 will define this */ - { - long t; - memmove ((char *)&t, (char *)hp->h_addr, sizeof(t)); - inaddr.sin_addr = t; - } -#else - memmove ((char *)&inaddr.sin_addr, (char *)hp->h_addr, - sizeof(inaddr.sin_addr)); -#endif /* CRAY and OLDTCP */ - } else { -#if defined(CRAY) && defined(OLDTCP) - /* Only Cray UNICOS3 and UNICOS4 will define this */ - inaddr.sin_addr = hostinetaddr; -#else - inaddr.sin_addr.s_addr = hostinetaddr; -#endif /* CRAY and OLDTCP */ - inaddr.sin_family = AF_INET; - } - - addr = (struct sockaddr *) &inaddr; - addrlen = sizeof (struct sockaddr_in); - inaddr.sin_port = (iagent == 0) ? CSDPSPORT : iagent; - inaddr.sin_port = htons (inaddr.sin_port); /* may be funky macro */ - - - /* - * Open the network connection. - */ - do { - if ((fd = socket ((int) addr->sa_family, SOCK_STREAM, 0)) < 0) { - return -1; - } - - /* - * turn off TCP coalescence - */ -#ifdef TCP_NODELAY - { - int tmp = 1; - setsockopt (fd, IPPROTO_TCP, TCP_NODELAY, (char *)&tmp, sizeof (int)); - } -#endif - if (gNXSndBufSize > 0) - len = setsockopt(fd, SOL_SOCKET, SO_SNDBUF, (char *) &gNXSndBufSize, sizeof(gNXSndBufSize)); - - /* - * connect to the socket; if there is no X server or if the backlog has - * been reached, then ECONNREFUSED will be returned. - */ - if (connect (fd, addr, addrlen) < 0) { - int olderrno = errno; - (void) close (fd); - if (olderrno != ECONNREFUSED || retries <= 0) { - errno = olderrno; - return -1; - } - sleep (1); - } else { - break; - } - } while (retries-- > 0); - - - /* - * Success! So, save the auth information - */ -#ifdef CRAY -#ifdef OLDTCP - len = sizeof(inaddr.sin_addr); -#else - len = SIZEOF_in_addr; -#endif /* OLDTCP */ - cp = (char *) &inaddr.sin_addr; -#else /* else not CRAY */ - len = sizeof(inaddr.sin_addr.s_addr); - cp = (char *) &inaddr.sin_addr.s_addr; -#endif /* CRAY */ - - /* - * We are special casing the BSD hack localhost address - * 127.0.0.1, since this address shouldn't be copied to - * other machines. So, we simply omit generating the auth info - * since we set it to the local machine before calling this routine! - */ - if (!((len == 4) && (cp[0] == 127) && (cp[1] == 0) && - (cp[2] == 0) && (cp[3] == 1))) { - *saddrp = Xmalloc (len); - if (*saddrp) { - *saddrlenp = len; - memmove (*saddrp, cp, len); - *familyp = FamilyInternet; - } else { - *saddrlenp = 0; - } - } - - return fd; -} -#undef INVALID_INETADDR -#endif /* TCPCONN */ - - -/***************************************************************************** - * * - * Connection Utility Routines * - * * - *****************************************************************************/ - -/* - * Disconnect from server. - */ - -int N_XDisconnectDisplay (int server) -{ - (void) close(server); - return 0; -} - - -#include <stddef.h> -/* - * This is an OS dependent routine which: - * 1) returns as soon as the connection can be written on.... - * 2) if the connection can be read, must enqueue events and handle errors, - * until the connection is writable. - */ -void N_XWaitForWritable(Display *dpy) -{ - unsigned long r_mask[MSKCNT]; - unsigned long w_mask[MSKCNT]; - int nfound; - - CLEARBITS(r_mask); - CLEARBITS(w_mask); - - while (1) { - BITSET(r_mask, dpy->fd); - BITSET(w_mask, dpy->fd); - - do { - nfound = select (dpy->fd + 1, (SELECT_TYPE) r_mask, - (SELECT_TYPE) w_mask, (SELECT_TYPE) NULL, - (struct timeval *) NULL); - if (nfound < 0 && errno != EINTR) - _XIOError(dpy); - } while (nfound <= 0); - - if (_XANYSET(r_mask)) { - char buf[BUFSIZE]; - long pend_not_register; - register long pend; - register xEvent *ev; - - /* find out how much data can be read */ - if (BytesReadable(dpy->fd, (char *) &pend_not_register) < 0) - _XIOError(dpy); - pend = pend_not_register; - - /* must read at least one xEvent; if none is pending, then - we'll just block waiting for it */ - if (pend < SIZEOF(xEvent)) pend = SIZEOF(xEvent); - - /* but we won't read more than the max buffer size */ - if (pend > BUFSIZE) pend = BUFSIZE; - - /* round down to an integral number of XReps */ - pend = (pend / SIZEOF(xEvent)) * SIZEOF(xEvent); - - N_XRead (dpy, buf, pend); - - /* no space between comma and type or else macro will die */ - STARTITERATE (ev,xEvent, buf, (pend > 0), - (pend -= SIZEOF(xEvent))) { - if (ev->u.u.type == X_Error) - _XError (dpy, (xError *) ev); - else /* it's an event packet; die */ - DPSFatalProc((DPSContext)0, "N_XWaitForWritable read bogus X event"); - } - ENDITERATE - } - if (_XANYSET(w_mask)) - return; - } -} - - -void N_XWaitForReadable(Display *dpy) -{ - unsigned long r_mask[MSKCNT]; - int result; - - CLEARBITS(r_mask); - do { - BITSET(r_mask, dpy->fd); - result = select(dpy->fd + 1, (SELECT_TYPE) r_mask, (SELECT_TYPE) NULL, - (SELECT_TYPE) NULL, (struct timeval *) NULL); - if (result == -1 && errno != EINTR) _XIOError(dpy); - } while (result <= 0); -} - -#ifdef XXX - -static int padlength[4] = {0, 3, 2, 1}; /* make sure auth is multiple of 4 */ - -_XSendClientPrefix ( - Display *dpy, - xConnClientPrefix *client, /* contains count for auth_* */ - char *auth_proto, /* NOT null-terminated */ - char char *auth_string) /* NOT null-terminated */ -{ - int auth_length = client->nbytesAuthProto; - int auth_strlen = client->nbytesAuthString; - char padbuf[3]; /* for padding to 4x bytes */ - int pad; - struct iovec iovarray[5], *iov = iovarray; - int niov = 0; - -#define add_to_iov(b,l) \ - { iov->iov_base = (b); iov->iov_len = (l); iov++, niov++; } - - add_to_iov ((caddr_t) client, SIZEOF(xConnClientPrefix)); - - /* - * write authorization protocol name and data - */ - if (auth_length > 0) { - add_to_iov (auth_proto, auth_length); - pad = padlength [auth_length & 3]; - if (pad) add_to_iov (padbuf, pad); - } - if (auth_strlen > 0) { - add_to_iov (auth_string, auth_strlen); - pad = padlength [auth_strlen & 3]; - if (pad) add_to_iov (padbuf, pad); - } - -#undef add_to_iov - - (void) WritevToServer (dpy->fd, iovarray, niov); - return; -} - -#endif /* XXX */ diff --git a/nx-X11/lib/dps/csfindNX.c b/nx-X11/lib/dps/csfindNX.c deleted file mode 100644 index 63b40acbc..000000000 --- a/nx-X11/lib/dps/csfindNX.c +++ /dev/null @@ -1,657 +0,0 @@ -/* - * csfindNX.c -- DPSCAP client Xlib extension hookup - * - * (c) Copyright 1992-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/csfindNX.c,v 1.7tsi Exp $ */ - -#include <sys/param.h> /* for MAXHOSTNAMELEN */ -#include <stdlib.h> -#include <stdio.h> -#include <unistd.h> /* getuid() */ -#include <string.h> -#include <pwd.h> - -#include <X11/X.h> -#include <X11/Xlib.h> -#include <X11/Xlibint.h> -#include <X11/Xatom.h> -#include <X11/Xresource.h> - -#include "csfindNX.h" -#include "dpsNXprops.h" -#include "Xlibnet.h" -#include "DPS/dpsXclient.h" -#include "DPS/dpsNXargs.h" -#include <DPS/XDPSlib.h> - -#include "dpsassert.h" -#include "cslibint.h" - -/* ---Defines--- */ - -#define CANTSTARTAGENT "Unable to start agent.\n" - -/* ---Types--- */ - -typedef struct { - Window id; - int willingness; -} Agent, *AgentIdList; - -/* ---Globals--- */ - -static char *XDPSLNXHost = NULL; -static int XDPSLNXPort = 0; /* default port to be used */ -static int XDPSLNXTrans = XDPSNX_TRANS_UNIX; -static int gXDPSNXLaunchedAgentTrans = XDPSNX_USE_BEST; -static int gXDPSNXLaunchedAgentPort = XDPSNX_USE_BEST; -static char *gXDPSNXExecObj = XDPSNX_DEFAULT_EXEC_NAME; /* NX object file */ -static char **gXDPSNXExecArgs = NULL; /* the args for gXDPSNXExecObj */ -static Bool gWasAgentSet = False; -static Bool gXDPSNXAutoLaunch = False; -unsigned char gXDPSNXErrorCode; -extern int gNXSndBufSize; /* Output buffer size, zero means default */ - -static char *getHomeDir(char *); - -/* ---Private Functions--- */ - -static int -TmpErrorHandler( - Display *dpy, - XErrorEvent *err) -{ - gXDPSNXErrorCode = err->error_code; - return 0; -} - - -static int -GetProperty( - Display *dpy, - Window w, - Atom prop, - Atom type, - unsigned long *nitems, /* IN: if non-null then RETURN val */ - char **data) /* RETURN */ -{ - long largest_len = ((((unsigned long) -1) >> 1) / 4); - Atom actual_type; - int actual_format; - unsigned long actual_number; - unsigned long remaining; - - if (type == None) return(!Success); /* We need to have a type */ - if ((XGetWindowProperty(dpy, w, prop, 0, largest_len, False, type, - &actual_type, &actual_format, &actual_number, - &remaining, (unsigned char **) data) == Success) - && (actual_type == type)) { - if (nitems != NULL) *nitems = actual_number; - return(Success); - } else { - if (*nitems != 0) { /* if data returned, clean up */ - XFree(*data); - *data = NULL; /* is this necessary? */ - *nitems = 0; - } - return(!Success); - } -} - - -/* - GetAgentIdList returns a list of agents advertising on the passed display (dpy), - and it returns the number of agents in the list in the parameter nAgents. - The returned list is sorted in most to least willing order. - GetAgentIdList assumes that it has exclusive access to the server associated with - dpy (ie. it assumes that the caller has done an XGrabServer). - */ -static AgentIdList -GetAgentIdList( - Display *dpy, - unsigned long *nAgents) /* RETURN: number of agents in list */ -{ - Atom serverListAtom = XInternAtom(dpy, XDPSNX_BILLBOARD_PROP, True); - Window *agents = NULL; - AgentIdList agentList = NULL; - int (*oldErrorHandler)(Display *, XErrorEvent *) = 0; /* the current error handler */ - unsigned long i, current; - - if (serverListAtom == None) { /* Servers registered on dpy */ - goto failed; - } - - XSync(dpy, False); /* force processing of pending requests */ - - if (GetProperty(dpy, RootWindow(dpy, DefaultScreen(dpy)), - serverListAtom, XA_WINDOW, nAgents, - (char **) &agents) != Success) { - goto failed; - } - - if ((agentList = (AgentIdList) - Xcalloc(*nAgents, (unsigned) sizeof(Agent))) == NULL) - goto failed; - - /* let's go through the list and figure out which servers are okay */ - oldErrorHandler = XSetErrorHandler(TmpErrorHandler); - current = 0; - for (i=0; i < *nAgents; i++) { - unsigned long len; - int *agentWillingness; - unsigned long k; - - for (k=0; k < i; k++) /* Search for duplicate ids */ - if (agents[i] == agents[k]) { /* uh oh... */ - agents[i] = None; - break; - } - if (k == i) { /* No duplicate ids */ - if (GetProperty(dpy, agents[i], - XInternAtom(dpy, XDPSNX_WILLINGNESS_PROP, True), - XA_INTEGER, &len, (char **) &agentWillingness) - != Success) { - /* Assume that Agent i is dead... */ - /* reap the agent */ - agents[i] = None; - gXDPSNXErrorCode = None; - } else { - unsigned long j = 0; - - /* insert the agents into agentList in "most to least willing" order */ - while ((j < current) && (agentList[j].willingness > *agentWillingness)) - j++; - if (j < current) - (void) bcopy((char *) &agentList[j], (char *) &agentList[j+1], - sizeof(Agent) * (*nAgents - j - 1)); - agents[current] = agents[i]; - agentList[j].id = agents[current++]; - agentList[j].willingness = *agentWillingness; - XFree(agentWillingness); - } - } - } - (void) XSetErrorHandler(oldErrorHandler); - oldErrorHandler = NULL; - if (*nAgents != current) { /* agent list changed */ - if (current > 0) { /* are there living ones? */ - *nAgents = current; - /* write the list back out onto the root window */ - (void) XChangeProperty(dpy, RootWindow(dpy, DefaultScreen(dpy)), - serverListAtom, XA_WINDOW, 32, - PropModeReplace, (unsigned char *) agents, *nAgents); - } else { - (void) XDeleteProperty(dpy, RootWindow(dpy, DefaultScreen(dpy)), - serverListAtom); - goto failed; - } - } - (void) XFree(agents); - return(agentList); - - failed: - if (agents != NULL) XFree(agents); - if (agentList != NULL) XFree(agentList); - if (oldErrorHandler != NULL) (void) XSetErrorHandler(oldErrorHandler); - *nAgents = 0; - return(NULL); -} - - -static int -XDPSNXOnDisplay( - Display *dpy, - char *licenseMethod, - char **host, - int *transport, - int *port) -{ - unsigned long nAgents = 0; - AgentIdList agentList = NULL; - Bool match = False; - unsigned long i = 0; - int status = !Success; - -#ifdef DPSLNKL - extern unsigned ANXKFunc(); -#endif /* DPSLNKL */ - - (void) XGrabServer(dpy); /* Can we do this later? */ - if ((agentList = GetAgentIdList(dpy, &nAgents)) == NULL) - goto cleanup; - /* NOTE: agentList was sorted most to least willing by GetAgentIdList */ - if (agentList[i].willingness <= 0) { /* Is there a willing agent? */ - DPSWarnProc(NULL, "Found agent(s) for display, but none willing to accept connections.\n"); - goto cleanup; - } - -#ifdef DPSLNKL - /* Masterkey bypass code */ - if (ANXKFunc() != 0) { - /* We have a willing agent and the client has masterkeys so... */ - match = True; - } else /* Search for appropriate agent */ -#endif /* DPSLNKL */ - { - /* need to get licensing info from dpy */ - Atom desiredLicenseMethod, openLicenseMethod; - char openLicenseString[256]; - - (void) sprintf(openLicenseString, "%s:%d", - LICENSE_METHOD_OPEN, - OPEN_LICENSE_VERSION); - openLicenseMethod = XInternAtom(dpy, openLicenseString, True); - - if (licenseMethod != NULL) - desiredLicenseMethod = XInternAtom(dpy, licenseMethod, True); - else - desiredLicenseMethod = None; - - if ((desiredLicenseMethod != None) || (openLicenseMethod != None)) { - for (i=0; - (i < nAgents) && (agentList[i].willingness > 0) && (match == False); - i++) { - Atom *licenseMethods = NULL; - unsigned long nMethods; - unsigned long j; - - if (GetProperty(dpy, agentList[i].id, - XInternAtom(dpy, XDPSNX_LICENSE_METHOD_PROP, True), - XA_ATOM, - &nMethods, (char **) &licenseMethods) != Success) - goto cleanup; - - /* - Check to see if the agent supports either our desired license method or - if it is an open service. - */ - j = 0; - while((j < nMethods) - && (licenseMethods[j] != desiredLicenseMethod) - && (licenseMethods[j] != openLicenseMethod)) j++; - if (j < nMethods) { /* We found one */ - match = True; - break; - } - (void) XFree(licenseMethods); - } - } - } - - if (match) { /* We had a match on license method */ - TransportInfo *transInfo; - - if (GetProperty(dpy, agentList[i].id, - XInternAtom(dpy, XDPSNX_TRANSPORT_INFO_PROP, True), - XA_INTEGER, NULL, (char **) &transInfo) != Success) { - goto cleanup; - } else { /* We got one! */ - *transport = transInfo->transport; - *port = transInfo->port; - match = True; - XFree(transInfo); - } - if (GetProperty(dpy, agentList[i].id, - XInternAtom(dpy, XDPSNX_HOST_NAME_PROP, True), XA_STRING, - NULL, (char **) host) == Success) { - status = Success; - /* - * If transport is TCP, but we are on the same host as the agent then - * trade-up to the more efficient UNIX transport... - */ - if (*transport == XDPSNX_TRANS_TCP) { - char hostname[MAXHOSTNAMELEN]; - (void) N_XGetHostname(hostname, MAXHOSTNAMELEN); - if (strcmp(hostname, *host) == 0) - *transport = XDPSNX_TRANS_UNIX; - } - } - } - /* - * Exit Clauses: status inited to FAILURE. Therefore cleanup "assumes" - * a failure unless noted otherwise. - */ - cleanup: - (void) XUngrabServer(dpy); - (void) XDPSLFlush(dpy); /* Flush the ungrab */ - if (agentList != NULL) XFree(agentList); - return(status); -} - - -static int -ParseAgentString( - char *string, - char **hostname, /* RETURN */ - int *transport, /* RETURN */ - int *port) /* RETURN */ -{ - int dnet = 0; - Bool transportSpecified = False; - char namebuf[255]; - char *p; - - (void) strncpy(namebuf, string, strlen(string)+1); - p = &namebuf[0]; - /* - * Step 1, find the hostname. This is delimited by a required colon. - */ - for (; *p && *p != ':'; p++); - if (!*p) return(!Success); /* There must be a colon */ - - if (*(p+1) == ':') { - dnet++; - *(p++) = '\0'; - } - *(p++) = '\0'; - - /* - * Step 2, get the port number. It follows the colon(s) - */ - if (*p == '\0') /* No port number specified... */ - return(!Success); - - *port = atoi(p); - - /* - * Step 3, transport? - */ - if (namebuf[0] == '\0') { /* no transport/hostname specified... */ - if (dnet) - (void) strcpy(namebuf, "0"); - else { /* no hostname, so must be UNIX */ - *hostname = NULL; - *transport = XDPSNX_TRANS_UNIX; - return(Success); - } - } else { - /* find the delimiting '/' */ - for (p = &namebuf[0]; *p && *p != '/'; p++); - if (*p == '/') { - transportSpecified = True; - *p = '\0'; - p++; - } else /* no transport specified */ - p = &namebuf[0]; - if ((*hostname = (char *) Xmalloc(strlen(p))) == NULL) - return(!Success); /* can't alloc space for hostname */ - (void) strcpy(*hostname, p); - - /* identify protocol */ - if (dnet) - *transport = XDPSNX_TRANS_DECNET; - else if (transportSpecified) { - if (strcmp(namebuf, "unix") == 0) - *transport = XDPSNX_TRANS_UNIX; - else /* assume tcp */ - *transport = XDPSNX_TRANS_TCP; - } else - *transport = XDPSNX_TRANS_TCP; - } - return(Success); -} - -static int -FindXDPSNXInXrmDatabase( - Display *dpy, - char **host, - int *transport, - int *port) -{ - XrmDatabase rDB = NULL; /* for merged database */ - XrmDatabase serverDB; - char filenamebuf[1024]; - char *filename = &filenamebuf[0]; - char *env, *str_type; - char name[255]; - XrmValue value; - int retVal = !Success; - - XrmInitialize(); - (void) strcpy(name, "/usr/lib/X11/app-defaults/"); - (void) strcat(name, XDPSNX_X_CLASS_NAME); - - /* try to get application defaults file, if there is any */ - XrmMergeDatabases(XrmGetFileDatabase(name), &rDB); - - /* try to merge the server defaults. if not defined then use .Xdefaults */ - if (XResourceManagerString(dpy) != NULL) { - serverDB = XrmGetStringDatabase(XResourceManagerString(dpy)); - } else { /* use the .Xdefaults */ - (void) getHomeDir(filename); - (void) strcat(filename, "/.Xdefaults"); - - serverDB = XrmGetFileDatabase(filename); - } - XrmMergeDatabases(serverDB, &rDB); - - /* try the XENVIRONMENT file, or if not defined, then .Xdefaults */ - if ((env = getenv("XENVIRONMENT")) == NULL) { - int len; - env = getHomeDir(filename); - (void) strcat(filename, "/.Xdefaults-"); - len = strlen(env); - (void) gethostname(env+len, 1024-len); - } - XrmMergeDatabases(XrmGetFileDatabase(env), &rDB); - - /* Now that the database is built, try to extract the values we want. */ - - if (XrmGetResource(rDB, XDPSNX_X_RESOURCE, XDPSNX_X_CLASS_NAME, &str_type, - &value) == True) { - retVal = ParseAgentString((char *) value.addr, host, transport, port); - } - (void) XrmDestroyDatabase(rDB); - return(retVal); -} - - -static char * -getHomeDir(char *dest) -{ - register char *ptr; - - if ((ptr = getenv("HOME")) != NULL) { - (void) strcpy(dest, ptr); - } else { - struct passwd *pw; - - if ((ptr = getenv("USER")) != NULL) { - pw = getpwnam(ptr); - } else { - pw = getpwuid(getuid()); - } - if (pw) { - (void) strcpy(dest, pw->pw_dir); - } else { - *dest = ' '; - } - } - return (dest); -} - - - -/* ---Public Functions--- */ - -int gForceLaunchHack = 0; /* Undocumented way to force autolaunch */ - -XDPSNXFindNXResult -XDPSNXFindNX( - Display *dpy, - char *licenseMethod, - char **host, - int *transport, - int *port) -{ - char *agentenv; - - if (gForceLaunchHack) - return(findnx_not_found); - - if (gWasAgentSet) { /* check if client set up host */ - *host = XDPSLNXHost; - *transport = XDPSLNXTrans; - *port = XDPSLNXPort; - return(findnx_found); - /* check DPSNXHOST environment variable */ - } else if ((agentenv = getenv(AGENT_ENV_VAR)) != NULL) { - int status = ParseAgentString(agentenv, host, transport, port); - if (status != Success) { - DPSWarnProc((DPSContext) NULL, "Illegal syntax for DPSNXHOST"); - return(findnx_error); - } else return(findnx_found); - /* check advertisements... */ - } else if (XDPSNXOnDisplay(dpy, licenseMethod, host, transport, port) == - Success) { - return(findnx_found); - /* check XrmDatabase */ - } else if (FindXDPSNXInXrmDatabase(dpy, host, transport, port) == Success) { - return(findnx_found); - } - /* Nada */ - return(findnx_not_found); -} - - -Status -XDPSNXSetClientArg(int arg, void *value) -{ - Display *dpy; - - if (arg == XDPSNX_AGENT) { - gWasAgentSet = True; - return(ParseAgentString(value, - &XDPSLNXHost, &XDPSLNXTrans, &XDPSLNXPort)); - } - else if (arg == XDPSNX_EXEC_FILE) { - if ((gXDPSNXExecObj = Xmalloc(strlen((char *) value) + 1)) == NULL) { - return(!Success); - } - gXDPSNXExecObj = strcpy(gXDPSNXExecObj, (char *) value); - } else if (arg == XDPSNX_EXEC_ARGS) { - int i; - char **cpp, **execInfo; - - execInfo = (char **) value; - for(cpp = execInfo, i = 1; *cpp != NULL; i++, cpp++); /* count */ - gXDPSNXExecArgs = (char **) Xcalloc(i, sizeof(char *)); - if (gXDPSNXExecArgs == NULL) return(!Success); - for(cpp = gXDPSNXExecArgs; *execInfo != NULL; - execInfo++, cpp++) { - /* copy each entry */ - if ((*cpp = Xmalloc(strlen(*execInfo) + 1)) == NULL) - return(!Success); - *cpp = strcpy(*cpp, *execInfo); - } - } else if (arg == XDPSNX_AUTO_LAUNCH) { - gXDPSNXAutoLaunch = (Bool)(long) value; - } else if (arg == XDPSNX_LAUNCHED_AGENT_TRANS) { - gXDPSNXLaunchedAgentTrans = (long) value; - } else if (arg == XDPSNX_LAUNCHED_AGENT_PORT) { - gXDPSNXLaunchedAgentPort = (long) value; - } else if (arg == XDPSNX_REQUEST_XSYNC) { - dpy = (Display *) value; - if (dpy == (Display *)NULL) - return(Success); - XDPSLSetSyncMask(dpy, DPSCAP_SYNCMASK_SYNC); - } else if (arg == XDPSNX_REQUEST_RECONCILE) { - dpy = (Display *) value; - if (dpy == (Display *)NULL) - return(Success); - XDPSLSetSyncMask(dpy, DPSCAP_SYNCMASK_RECONCILE); - } else if (arg == XDPSNX_REQUEST_BUFFER) { - dpy = (Display *) value; - if (dpy == (Display *)NULL) - return(Success); - XDPSLSetSyncMask(dpy, DPSCAP_SYNCMASK_BUFFER); - } else if (arg == XDPSNX_GC_UPDATES_SLOW) { - dpy = (Display *) value; - if (dpy == (Display *)NULL) - return(Success); - XDPSLSetGCFlushMode(dpy, XDPSNX_GC_UPDATES_SLOW); - } else if (arg == XDPSNX_GC_UPDATES_FAST) { - dpy = (Display *) value; - if (dpy == (Display *)NULL) - return(Success); - XDPSLSetGCFlushMode(dpy, XDPSNX_GC_UPDATES_FAST); - } else if (arg == XDPSNX_SEND_BUF_SIZE) { - int i = (long)value; - if (i >= 4096 && i <= 65536) gNXSndBufSize = i; - } - return(Success); -} - - -void -XDPSGetNXArg(int arg, void **value) -{ - static char agentBuffer[255]; - - if (arg == XDPSNX_AGENT) { - switch(XDPSLNXTrans) { - case XDPSNX_TRANS_UNIX: - (void) sprintf(agentBuffer, "unix/"); - break; - case XDPSNX_TRANS_TCP: - (void) sprintf(agentBuffer, "tcp/"); - break; - case XDPSNX_TRANS_DECNET: - (void) sprintf(agentBuffer, "decnet/"); - break; - default: - DPSWarnProc(NULL, "Unknown transport passed to XDPSGetNXArg ignored.\n"); - agentBuffer[0] = '\0'; - break; - } - (void) strcat(agentBuffer, XDPSLNXHost); - (void) strcat(agentBuffer, - (XDPSLNXTrans == XDPSNX_TRANS_DECNET ? "::" : ":")); - (void) sprintf(&agentBuffer[strlen(agentBuffer)], "%d", XDPSLNXPort); - *value = (void *) agentBuffer; - } - else if (arg == XDPSNX_EXEC_FILE) { - *value = (void *) gXDPSNXExecObj; - } else if (arg == XDPSNX_EXEC_ARGS) { - *value = (void *) gXDPSNXExecArgs; - } else if (arg == XDPSNX_AUTO_LAUNCH) { - *value = (void *) (long)gXDPSNXAutoLaunch; - } else if (arg == XDPSNX_LAUNCHED_AGENT_TRANS) { - *value = (void *) (long)gXDPSNXLaunchedAgentTrans; - } else if (arg == XDPSNX_LAUNCHED_AGENT_PORT) { - *value = (void *) (long)gXDPSNXLaunchedAgentPort; - } -} diff --git a/nx-X11/lib/dps/csfindNX.h b/nx-X11/lib/dps/csfindNX.h deleted file mode 100644 index f5bf3bdc9..000000000 --- a/nx-X11/lib/dps/csfindNX.h +++ /dev/null @@ -1,93 +0,0 @@ -/* - * csfindNX.h - * - * (c) Copyright 1992-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 - */ - -#ifndef CSFINDNX_H -#define CSFINDNX_H - - -/* ---DEFINES--- */ - -#define XDPSNX_DEFAULT_EXEC_NAME "dpsnx.agent" - -/* ---TYPES--- */ - -typedef enum { - findnx_found, - findnx_not_found, - findnx_error -} XDPSNXFindNXResult; - - -/* ---Functions--- */ - -extern XDPSNXFindNXResult -XDPSNXFindNX ( - Display *dpy, /* Display client wants to attach to */ - char *licenseMethod, /* license method client speaks */ - char **host, /* RETURN: Agent host name */ - int *transport, /* RETURN: Agent transport */ - int *port); /* RETURN: Agent's port */ - /* - * Find an agent for this client that will service display dpy. - * The licenseMethod arg. specifies the type of licensing that the client - * is capable of speaking. A (char *) NULL, means that it can handle - * any type (i.e. master key in lock & key). - * Return values indicates success in finding an agent. - * Success: host, transport, and port indicate where the agent is. - * !Success: the values of host, transport, and port are undefined. - * The client of the call is responsible for freeing the space (XFree()) - * allocated for the host name string. - */ - - -extern void -XDPSGetNXArg ( - int arg, /* Argument to be retrieved */ - void **value); /* value of the argument */ - /* - Gets the value of the given argument. Returns the value in val. If the - value will fit in val (ie, a Bool) then the value is placed there, - otherwise a pointer to the value is placed there. It is assumed that - the caller will know the correct type. The types of arguments are - detailed with the argument definitions in dpsNXargs.h. - NOTE: the caller should NOT modify any values returned via pointer. - XDPSGetNXArg does not copy the data, rather it returns a pointer to the - internally held structure. - */ - -#endif /* CSFINDNX_H */ diff --git a/nx-X11/lib/dps/cslibext.c b/nx-X11/lib/dps/cslibext.c deleted file mode 100644 index 831f0ad65..000000000 --- a/nx-X11/lib/dps/cslibext.c +++ /dev/null @@ -1,762 +0,0 @@ -/* - * cslibext.c -- DPSCAP client Xlib extension hookup - * - * (c) Copyright 1991-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/cslibext.c,v 1.4tsi Exp $ */ - -#include <stdio.h> -#include <stdlib.h> - -#include <sys/param.h> /* for MAXHOSTNAMELEN */ -#include <X11/X.h> -#include <X11/Xlib.h> -#include <X11/Xlibint.h> -#include "cslibint.h" -#include <DPS/XDPS.h> -#include <DPS/XDPSproto.h> -#include <DPS/dpsXclient.h> -#include <DPS/dpsNXargs.h> -#include "DPSCAPClient.h" -#include "dpsassert.h" -#include <DPS/XDPSlib.h> - -#include "publictypes.h" -#include "dpsXpriv.h" - -/* === DEFINES === */ - -#define DPSNXSYNCGCMODE_FLUSH 0 -#define DPSNXSYNCGCMODE_SYNC 1 -#define DPSNXSYNCGCMODE_DELAYED 2 -#define DPSNXSYNCGCMODE_DEFAULT DPSNXSYNCGCMODE_DELAYED - -/* === GLOBALS === */ - -DPSCAPGlobals gCSDPS = NULL; - -#ifdef DPSLNKL -#define ANXCYAN -#define ANXMAGENTA -#define ANXYELLOW -#define ANXBLACK -#define ANXSPOT -#include "dpslnkl.inc" -#endif /* DPSLNKL */ - -int gNXSyncGCMode = DPSNXSYNCGCMODE_DEFAULT; - -/* === PUBLIC PROCS === */ - -#ifdef MAHALO -static int -DPSCAPFlushAfterProc(Display *agent) -{ - LockDisplay(agent); - N_XFlush(agent); - UnlockDisplay(agent); -} -#endif - -int -CSDPSInit( - Display *dpy, - int *numberType, /* RETURN */ - char **floatingName) /* RETURN */ -{ - register Display *agent; - register xCAPConnReplyPrefix *p; - register char *c; - DPSCAPData my; - xCAPConnSetupReq setup; - union { - xCAPConnSuccess good; - xCAPConnFailed bad; - } reply; - XExtData *extData; - XExtCodes *codes; - int indian; - int rest; - Window clientWindow; - char fullDisplayName[MAXHOSTNAMELEN+10]; - - if (gCSDPS == NULL) - DPSCAPStartUp(); - - /* To fix dps-nx #68, Motif too slow on HP */ - if ((c = getenv("DPSNXGCMODE")) != 0) - { - gNXSyncGCMode = atoi(c); - if (gNXSyncGCMode < DPSNXSYNCGCMODE_FLUSH - || gNXSyncGCMode > DPSNXSYNCGCMODE_DELAYED) - gNXSyncGCMode = DPSNXSYNCGCMODE_DEFAULT; - } - - /* We may have already called this routine via XDPSExtensionPresent, - so don't do it again! */ - - if ((codes = XDPSLGetCodes(dpy)) - && (agent = XDPSLGetShunt(dpy)) - && agent != dpy - && codes->major_opcode == DPSXOPCODEBASE) - return(DPSCAPSUCCESS); - - /* Try to create a window for ClientMessage communication */ - - clientWindow = XCreateSimpleWindow( - dpy, - DefaultRootWindow(dpy), - 0, 0, - 1, 1, - 0, - BlackPixel(dpy, DefaultScreen(dpy)), - WhitePixel(dpy, DefaultScreen(dpy))); - if (clientWindow == None) - return(DPSCAPFAILED); - - /* Try to open a connection to an agent */ - - if ((extData = DPSCAPOpenAgent(dpy, fullDisplayName)) == NULL) - { - XDestroyWindow(dpy, clientWindow); - return(DPSCAPFAILED); - } - - /* DPSCAPOpenAgent only partially fills in extData, so finish it */ - - codes = XAddExtension(dpy); - codes->major_opcode = DPSXOPCODEBASE; - codes->first_event = 0; /* REQUIRED */ - codes->first_error = FirstExtensionError; - extData->number = codes->extension; - extData->free_private = DPSCAPDestroy; - my = (DPSCAPData) extData->private_data; - my->codes = codes; - agent = my->agent; - /* +++ Is this all we have to do here? */ - - /* Send opening handshake */ - - indian = 1; - if (*(char *) &indian) - setup.byteorder = 'l'; - else - setup.byteorder = 'B'; - setup.dpscapVersion = DPSCAPPROTOVERSION; - setup.flags = DPSCAPNONEFLAG; - setup.libraryversion = DPSPROTOCOLVERSION; - setup.authProtoNameLength = 0; - setup.authProtoDataLength = 0; - setup.displayStringLength = strlen(fullDisplayName); - setup.nodeStringLength = 0; - setup.transportStringLength = 0; - setup.display = 0; - setup.screen = 0; - setup.reserved = 0; - setup.clientWindow = clientWindow; - -#ifndef DPSLNKL - DPSCAPWrite(agent, (char *)&setup, sizeof(xCAPConnSetupReq), dpscap_nopad,dpscap_insert); - DPSCAPWrite(agent, fullDisplayName, setup.displayStringLength, dpscap_pad, dpscap_append); - N_XFlush(agent); -#else /* DPSLNKL */ - if (CSDPSConfirmDisplay(agent, dpy, &setup, &reply, fullDisplayName) == 1) - { - p = (xCAPConnReplyPrefix *)&reply.good; - goto skip_read; - } - /* Read normal reply */ -#endif /* DPSLNKL */ - - /* Read common reply prefix */ - - p = (xCAPConnReplyPrefix *)&reply.good; - N_XRead(agent, (char *)p, (long)sizeof(xCAPConnReplyPrefix)); -#ifdef DPSLNKL -skip_read: -#endif - if (!p->success) - { - char mbuf[512]; - /* read the rest */ - c = (char *)&reply.bad.serverVersion; - N_XRead(agent, c, sz_xCAPConnFailed - sz_xCAPConnReplyPrefix); - sprintf(mbuf, "DPS NX: connection to \"%s\" refused by agent.", DisplayString(agent)); - DPSWarnProc(NULL, mbuf); - c = (char *)Xmalloc(reply.bad.reasonLength); - if (!c) return(DPSCAPFAILED); - N_XReadPad(agent, c, (long)reply.bad.reasonLength); - if (!reply.bad.reasonLength) - sprintf(mbuf, "DPS NX: (no reason given)\n"); - else - { - strcpy(mbuf, "DPS NX: "); - strncat(mbuf, c, reply.bad.reasonLength); - mbuf[reply.bad.reasonLength+7] = '\0'; - } - DPSWarnProc(NULL, mbuf); - Xfree(c); - DPSCAPDestroy(extData); - Xfree(extData); - XDestroyWindow(dpy, clientWindow); - return(DPSCAPFAILED); - } - - /* read the rest of the fixed length reply */ - c = (char *)&reply.good.serverVersion; - rest = sizeof(xCAPConnSuccess) - sizeof(xCAPConnReplyPrefix); - N_XRead(agent, c, rest); - - /* verify */ - - if (reply.good.serverVersion < DPSPROTOCOLVERSION) - { - /* Fine, we downgrade the client */ - char qbuf[256]; - sprintf(qbuf, "NX: server version %ld older than expected %d, client will downgrade", (long)reply.good.serverVersion, DPSPROTOCOLVERSION); - DPSWarnProc(NULL, qbuf); - } - my->dpscapVersion = reply.good.dpscapVersion; - if (my->dpscapVersion < DPSCAPPROTOVERSION) - { - /* Fine, we downgrade the client */ - char kbuf[256]; - sprintf(kbuf, "NX: agent version %d older than expected %d, client will downgrade", my->dpscapVersion, DPSCAPPROTOVERSION); - DPSWarnProc(NULL, kbuf); -#ifdef XXX - /* Saving this code as a reminder about what needs to be - cleaned up if we exit here */ - DPSCAPDestroy(extData); - Xfree(extData); - XDestroyWindow(clientWindow); - return(DPSCAPFAILED); -#endif - } - - if (numberType) - *numberType = reply.good.preferredNumberFormat; - - /* read additional data */ - - c = (char *)Xmalloc(reply.good.floatingNameLength + 1); - N_XReadPad(agent, c, reply.good.floatingNameLength); - c[reply.good.floatingNameLength] = 0; - if (floatingName) - *floatingName = c; - else - Xfree(c); - - /* set library extension data */ - - XDPSLSetVersion(agent, reply.good.serverVersion); - XDPSLSetVersion(dpy, reply.good.serverVersion); - XDPSLSetShunt(dpy, agent); - XDPSLSetCodes(dpy, codes); - if (XDPSLGetSyncMask(dpy) == DPSCAP_SYNCMASK_NONE) - XDPSLSetSyncMask(dpy, DPSCAP_SYNCMASK_DFLT); - my->agentWindow = reply.good.agentWindow; - XDPSLSetGCFlushMode(dpy, XDPSNX_GC_UPDATES_SLOW); /* default */ - - /* Hook my extension data on the dpy */ - - my->extData = extData; - XAddToExtensionList(CSDPSHeadOfDpyExt(dpy), extData); - (void) XESetCloseDisplay(dpy, codes->extension, DPSCAPCloseDisplayProc); - (void) XESetCopyGC(dpy, codes->extension, DPSCAPCopyGCProc); - (void) XESetFreeGC(dpy, codes->extension, DPSCAPFreeGCProc); - (void) XESetFlushGC(dpy, codes->extension, DPSCAPFlushGCProc); - XDPSLSetClientMessageHandler(dpy); - - /* Chain my data on global list */ - - my->next = gCSDPS->head; - gCSDPS->head = my; - -#ifdef MAHALO - /* Set function that is called after every Xlib protocol proc */ - XDPSLSetAfterProc(dpy); - - /* All CSDPS protocol is auto-flushed */ - (void) XSetAfterFunction(agent, DPSCAPFlushAfterProc); -#endif /* MAHALO */ - - /* set agent arguments, if needed */ - /* must follow setting of ShuntMap at least, so safest to - do here when everything has been setup */ - XDPSLUpdateAgentArgs(dpy); - - return(DPSCAPSUCCESS); -} - - -XExtData ** -CSDPSHeadOfDpyExt( - Display *dpy) -{ - XEDataObject object; - - object.display = dpy; - return(XEHeadOfExtensionList(object)); -} - -void -XDPSSyncGCClip( - register Display *dpy, - register GC gc) -{ - /* The primary utility of this function is for DPS NX correctness, - but it also helps DPS/X do less work in tracking GC changes. */ - XDPSLSyncGCClip(dpy, gc); -} - -void -XDPSReconcileRequests( - register DPSContext ctxt) -{ - Display *dpy; - register ContextXID cxid; - register DPSContext curCtxt; - - for (curCtxt = ctxt; curCtxt; curCtxt = curCtxt->chainChild) - { - cxid = XDPSXIDFromContext(&dpy, curCtxt); - if (dpy == (Display *)NULL || cxid == None) - break; /* Skip text contexts */ - XDPSLReconcileRequests(dpy, cxid); - } -} - -Status -XDPSNXSetAgentArg( - Display *dpy, - int arg, int val) -{ - if (!dpy || arg >= 0 || arg < AGENTLASTARG) - return(!Success); - else - return(XDPSLSetAgentArg(dpy, arg, val)); -} - -/* New for DPS NX 2.0 */ -void -XDPSFlushGC( - Display *dpy, - GC gc) -{ - if (dpy && gc) - XDPSLFlushGC(dpy, gc); -} - -/* === SUPPORT PROCS === */ - -void -DPSCAPChangeGC( - register Display *agent, - GC gc, - unsigned long valuemask, - XGCValues *values) -{ - register xChangeGCReq *req; - unsigned long oldDirty = gc->dirty; - - /* ASSERT: called from within LockDisplay section */ - - /* Always include the clip_mask */ - valuemask |= GCClipMask; - /* +++ HACK! Hide the gc->rects flag in arc_mode */ - valuemask |= GCArcMode; - valuemask &= (1L << (GCLastBit + 1)) - 1; - - /* Stupid macro insists on Display being called 'dpy' */ - { - Display *dpy = agent; - Display *xdpy = (Display *)NULL; - NXMacroGetReq(ChangeGC, req); - } - req->gc = XGContextFromGC(gc); - gc->dirty = req->mask = valuemask; - { -/* Derived from MIT XCrGC.c, _XGenerateGCList: -Copyright 1985, 1986, 1987, 1988, 1989 by the -Massachusetts Institute of Technology - -Permission to use, copy, modify, distribute, and sell this software and its -documentation for any purpose is hereby granted without fee, provided that -the above copyright notice appear in all copies and that both that -copyright notice and this permission notice appear in supporting -documentation, and that the name of M.I.T. not be used in advertising or -publicity pertaining to distribution of the software without specific, -written prior permission. M.I.T. makes no representations about the -suitability of this software for any purpose. It is provided "as is" -without express or implied warranty. -*/ - /* Warning! This code assumes that "unsigned int" is 32-bits wide */ - - unsigned int vals[32]; - register unsigned int *value = vals; - long nvalues; - register XGCValues *gv = values; - register unsigned long dirty = gc->dirty; - - /* - * Note: The order of these tests are critical; the order must be the - * same as the GC mask bits in the word. - */ - if (dirty & GCFunction) *value++ = gv->function; - if (dirty & GCPlaneMask) *value++ = gv->plane_mask; - if (dirty & GCForeground) *value++ = gv->foreground; - if (dirty & GCBackground) *value++ = gv->background; - if (dirty & GCLineWidth) *value++ = gv->line_width; - if (dirty & GCLineStyle) *value++ = gv->line_style; - if (dirty & GCCapStyle) *value++ = gv->cap_style; - if (dirty & GCJoinStyle) *value++ = gv->join_style; - if (dirty & GCFillStyle) *value++ = gv->fill_style; - if (dirty & GCFillRule) *value++ = gv->fill_rule; - if (dirty & GCTile) *value++ = gv->tile; - if (dirty & GCStipple) *value++ = gv->stipple; - if (dirty & GCTileStipXOrigin) *value++ = gv->ts_x_origin; - if (dirty & GCTileStipYOrigin) *value++ = gv->ts_y_origin; - if (dirty & GCFont) *value++ = gv->font; - if (dirty & GCSubwindowMode) *value++ = gv->subwindow_mode; - if (dirty & GCGraphicsExposures) *value++ = gv->graphics_exposures; - if (dirty & GCClipXOrigin) *value++ = gv->clip_x_origin; - if (dirty & GCClipYOrigin) *value++ = gv->clip_y_origin; - if (dirty & GCClipMask) *value++ = gv->clip_mask; - if (dirty & GCDashOffset) *value++ = gv->dash_offset; - if (dirty & GCDashList) *value++ = gv->dashes; - /* +++ HACK! Hide gc->rects flag in GCArcMode */ - if (dirty & GCArcMode) *value++ = gc->rects; - - req->length += (nvalues = value - vals); - - /* - * note: Data is a macro that uses its arguments multiple - * times, so "nvalues" is changed in a separate assignment - * statement - */ - - nvalues <<= 2; - Data32 (agent, (long *) vals, nvalues); - } - - gc->dirty = oldDirty; - - /* ASSERT: SyncHandle called by caller */ -} - - -DPSCAPData -DPSCAPCreate( - Display *dpy, Display *agent) -{ - register DPSCAPData my = (DPSCAPData)Xcalloc(1, sizeof(DPSCAPDataRec)); - - if (my == (DPSCAPData)NULL) return(NULL); - my->dpy = dpy; - my->agent = agent; - my->typePSOutput = XInternAtom( - dpy, - DPSCAP_TYPE_PSOUTPUT, - False); - my->typePSOutputWithLen = XInternAtom( - dpy, - DPSCAP_TYPE_PSOUTPUT_LEN, - False); - my->typePSStatus = XInternAtom( - dpy, - DPSCAP_TYPE_PSSTATUS, - False); - my->typeNoop = XInternAtom( - dpy, - DPSCAP_TYPE_NOOP, - False); - my->typeSync = XInternAtom( - dpy, - DPSCAP_TYPE_SYNC, - False); - my->typeXError = XInternAtom( - dpy, - DPSCAP_TYPE_XERROR, - False); - my->typePSReady = XInternAtom( - dpy, - DPSCAP_TYPE_PSREADY, - False); - my->typeResume = XInternAtom( - dpy, - DPSCAP_TYPE_RESUME, - False); - return(my); -} - -int -DPSCAPDestroy( - XExtData *extData) -{ - register DPSCAPData my = (DPSCAPData) extData->private_data; - register DPSCAPData n; - - if (my == (DPSCAPData)NULL) return(0); - DPSCAPCloseAgent(my->agent); - my->agent = NULL; - /* my->extData->private_data = NIL; ???? +++ */ - if (my == gCSDPS->head) - gCSDPS->head = my->next; - else for (n = gCSDPS->head; n != NULL; n = n->next) - if (n->next == my) - { - n->next = my->next; - break; - } - Xfree(my); - /* extData freed by caller (e.g., _XFreeExtData) */ - return(0); -} - -void -DPSCAPStartUp(void) -{ - gCSDPS = (DPSCAPGlobals)Xcalloc(1, sizeof(DPSCAPGlobalsRec)); -} - - -static unsigned char padAdd[] = {0, 3, 2, 1}; - -void -DPSCAPWrite( - Display *agent, - char *buf, - unsigned len, - DPSCAPIOFlags writePad, - DPSCAPIOFlags bufMode) -{ - int pad = padAdd[len & 3]; - unsigned fullLen = (writePad == dpscap_pad) ? len + pad : len; - - if (agent->bufptr + fullLen > agent->bufmax) - N_XFlush(agent); - if (agent->max_request_size && fullLen > agent->max_request_size) - { - DPSWarnProc(NULL, "DPS Client Library: request length exceeds max request size. Truncated.\n"); - len = agent->max_request_size; - pad = 0; - } - if (bufMode == dpscap_insert) - { - agent->last_req = agent->bufptr; - agent->request++; - } - bcopy(buf, agent->bufptr, len); - agent->bufptr += len; - if (writePad == dpscap_pad && pad) - { - bcopy((char *) padAdd, agent->bufptr, pad); - agent->bufptr += pad; - } -} - - -/* === EXT CALLBACK HOOKS === */ - -int -DPSCAPCloseDisplayProc( - Display *dpy, - XExtCodes *codes) -{ -#ifdef CSDPS - fprintf(stderr, "NX: Closing agent \"%s\"\n", dpy->display_name); -#endif - - /* Although it seems that we should free codes here, we can't - because Xlib owns the storage */ - - XDPSLSetShunt(dpy, (Display *) NULL); - XDPSLSetCodes(dpy, (XExtCodes *) NULL); - XDPSLSetSyncMask(dpy, DPSCAP_SYNCMASK_NONE); - XDPSLCleanAll(dpy); - XDPSPrivZapDpy(dpy); - return(0); -} - - -int -DPSCAPCopyGCProc( - Display *dpy, - GC gc, - XExtCodes *codes) -{ - XGCValues values; - DPSCAPData my; - XExtData *extData = XFindOnExtensionList( - CSDPSHeadOfDpyExt(dpy), - codes->extension); - - if (extData) - my = (DPSCAPData) extData->private_data; - else - return(0); - - /* We change the GC unconditionally, since friggin' XCopyGC - clears the dirty bits of the values that are copied! */ - - DPSAssertWarn(XGetGCValues(dpy, gc, DPSGCBITS & ~(GCClipMask), &values), - NULL, "DPS NX: XGetGCValues returned False\n"); - values.clip_mask = gc->values.clip_mask; - DPSCAPChangeGC(my->agent, gc, DPSGCBITS, &values); - /* We have to make sure that the agent completely processes - the change to the GC. If we allow the agent to update the - GC in its own sweet time, the stupid client may delete the - GC after the agent has already queued a request to, e.g., - copy the GC, but before the request is flushed. */ - XDPSLSync(dpy); - return(1); -} - -int -DPSCAPFreeGCProc( - Display *pdpy, - GC gc, - XExtCodes *codes) -{ - register xCAPNotifyReq *req; - DPSCAPData my; - Display *dpy = pdpy; /* Stupid macros insists on Display being 'dpy' */ - XExtData *extData = XFindOnExtensionList( - CSDPSHeadOfDpyExt(dpy), - codes->extension); - - if (extData) - my = (DPSCAPData) extData->private_data; - else - return(0); - - /* Notify the agent that the client deleted a GC. Let the - agent figure out if it cares. */ - - /* ASSERT: called from within LockDisplay section */ - - dpy = my->agent; - if (dpy == (Display *)NULL || dpy == pdpy) - return(0); - - /* May need to sync changes to GC */ - if (gNXSyncGCMode == DPSNXSYNCGCMODE_DELAYED) - XDPSLSync(pdpy); - - { - Display *xdpy = pdpy; /* pdpy is X server */ - NXMacroGetReq(CAPNotify, req); - } - req->reqType = DPSCAPOPCODEBASE; - req->type = X_CAPNotify; - req->cxid = 0; - req->notification = DPSCAPNOTE_FREEGC; - req->data = XGContextFromGC(gc); - req->extra = 0; - /* Guarantee that everyone sees GC go away */ - XSync(pdpy, False); /* pdpy is X server */ - if (gNXSyncGCMode == DPSNXSYNCGCMODE_FLUSH) - { - LockDisplay(dpy); /* dpy means agent here */ - N_XFlush(dpy); - UnlockDisplay(dpy); - } - else - XDPSLSync(pdpy); - - /* ASSERT: SynchHandle called by caller */ - return(1); -} - -#ifdef CSDPSDEBUG -static unsigned int gcCountFlushedClean = 0; -static unsigned int gcCountFlushedDirty = 0; -#endif /* CSDPSDEBUG */ - -int -DPSCAPFlushGCProc( - Display *dpy, - GC gc, - XExtCodes *codes) -{ - XGCValues values; - DPSCAPData my; - XExtData *extData; -#ifdef CSDPSDEBUG - unsigned long int dirty; -#endif /* CSDPSDEBUG */ - - /* When GC is created, it is flushed with no dirty bits set, - so we have to notice that situation. */ - - if (gc->dirty) - { - if (XDPSLGetGCFlushMode(dpy) == XDPSNX_GC_UPDATES_FAST - || !(gc->dirty & DPSGCBITS)) - return(0); - } - extData = XFindOnExtensionList(CSDPSHeadOfDpyExt(dpy), codes->extension); - if (extData) - my = (DPSCAPData) extData->private_data; - else - return(0); - /* HERE IF (gc->dirty & DPSGCBITS || !gc->dirty) */ -#ifdef CSDPSDEBUG - dirty = gc->dirty; -#endif /* CSDPSDEBUG */ - DPSAssertWarn(XGetGCValues(dpy, gc, DPSGCBITS & ~(GCClipMask), &values), - NULL, "NX: XGetGCValues returned False\n"); - values.clip_mask = gc->values.clip_mask; - /* Must guarantee that gc change is registered by X server - before notification is sent to agent. */ - XSync(dpy, False); - DPSCAPChangeGC(my->agent, gc, DPSGCBITS, &values); - /* We have to make sure that the agent completely processes - the change to the GC. If we allow the agent to update the - GC in its own sweet time, the stupid client may delete the - GC after the agent has already queued a request to, e.g., - copy the GC, but before the request is flushed. */ - if (gNXSyncGCMode == DPSNXSYNCGCMODE_SYNC) - XDPSLSync(dpy); - else - XDPSLFlush(dpy); -#ifdef CSDPSDEBUG - if (dirty) - ++gcCountFlushedDirty; - else - ++gcCountFlushedClean; -#endif /* CSDPSDEBUG */ - return(1); -} diff --git a/nx-X11/lib/dps/cslibint.c b/nx-X11/lib/dps/cslibint.c deleted file mode 100644 index 84d7b753e..000000000 --- a/nx-X11/lib/dps/cslibint.c +++ /dev/null @@ -1,1910 +0,0 @@ -/* - * cslibint.c -- low level I/O - * - * (c) Copyright 1993-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 - * - * Portions Copyright 1985, 1986, 1987 Massachusetts Institute of Technology - * - * Permission to use, copy, modify, distribute, and sell this software and its - * documentation for any purpose is hereby granted without fee, provided that - * the above copyright notice appear in all copies and that both that - * copyright notice and this permission notice appear in supporting - * documentation, and that the name of M.I.T. not be used in advertising or - * publicity pertaining to distribution of the software without specific, - * written prior permission. M.I.T. makes no representations about the - * suitability of this software for any purpose. It is provided "as is" - * without express or implied warranty. - * - * Author: Adobe Systems Incorporated and MIT X Consortium - */ -/* $XFree86: xc/lib/dps/cslibint.c,v 1.4tsi Exp $ */ - -/* - * XlibInternal.c - Internal support routines for the C subroutine - * interface library (Xlib) to the X Window System Protocol V11.0. - */ -#define NEED_EVENTS -#define NEED_REPLIES - -#include <X11/Xlibint.h> -#include <X11/Xos.h> -#include "Xlibnet.h" -#include <stdio.h> - -#include "dpsassert.h" -#include "cslibint.h" - -static void _EatData32 (Display *dpy, unsigned long n); - -/* check for both EAGAIN and EWOULDBLOCK, because some supposedly POSIX - * systems are broken and return EWOULDBLOCK when they should return EAGAIN - */ -#if defined(EAGAIN) && defined(EWOULDBLOCK) -#define ETEST(err) (err == EAGAIN || err == EWOULDBLOCK) -#else -#ifdef EAGAIN -#define ETEST(err) (err == EAGAIN) -#else -#define ETEST(err) (err == EWOULDBLOCK) -#endif -#endif - -#ifdef LACHMAN -#ifdef EMSGSIZE -#undef EMSGSIZE -#endif -#define EMSGSIZE ERANGE -#endif - -#if defined(SVR4) && defined(sun) -#define SUNSYSV 1 -#endif - -/* - * The following routines are internal routines used by Xlib for protocol - * packet transmission and reception. - * - * XIOError(Display *) will be called if any sort of system call error occurs. - * This is assumed to be a fatal condition, i.e., XIOError should not return. - * - * XError(Display *, XErrorEvent *) will be called whenever an X_Error event is - * received. This is not assumed to be a fatal condition, i.e., it is - * acceptable for this procedure to return. However, XError should NOT - * perform any operations (directly or indirectly) on the DISPLAY. - * - * Routines declared with a return type of 'Status' return 0 on failure, - * and non 0 on success. Routines with no declared return type don't - * return anything. Whenever possible routines that create objects return - * the object they have created. - */ - -extern _XQEvent *_qfree; - -static int padlength[4] = {0, 3, 2, 1}; - /* lookup table for adding padding bytes to data that is read from - or written to the X socket. */ - -static xReq _dummy_request = { - 0, 0, 0 -}; -/* - * N_XFlush - Flush the X request buffer. If the buffer is empty, no - * action is taken. This routine correctly handles incremental writes. - * This routine may have to be reworked if int < long. - */ -void N_XFlush (Display *dpy) -{ - register long size, todo; - register int write_stat; - register char *bufindex; - - if (!dpy) return; - - if (dpy->flags & XlibDisplayIOError) return; - - size = todo = dpy->bufptr - dpy->buffer; - bufindex = dpy->bufptr = dpy->buffer; - /* - * While write has not written the entire buffer, keep looping - * until the entire buffer is written. bufindex will be incremented - * and size decremented as buffer is written out. - */ - while (size) { - errno = 0; - write_stat = WriteToServer(dpy->fd, bufindex, (int) todo); - if (write_stat >= 0) { - size -= write_stat; - todo = size; - bufindex += write_stat; - } else if (ETEST(errno)) { - N_XWaitForWritable(dpy); -#ifdef SUNSYSV - } else if (errno == 0) { - N_XWaitForWritable(dpy); -#endif -#ifdef EMSGSIZE - } else if (errno == EMSGSIZE) { - if (todo > 1) - todo >>= 1; - else - N_XWaitForWritable(dpy); -#endif - } else if (errno != EINTR) { - /* Write failed! */ - /* errno set by write system call. */ - _XIOError(dpy); - } - } - dpy->last_req = (char *)&_dummy_request; -} - -#ifdef NEEDFORNX - -int -_XEventsQueued (Display *dpy, int mode) -{ - register int len; - int pend; - char buf[BUFSIZE]; - register xReply *rep; - - if (mode == QueuedAfterFlush) - { - _XFlush(dpy); - if (dpy->qlen) - return(dpy->qlen); - } - if (dpy->flags & XlibDisplayIOError) return(dpy->qlen); - if (BytesReadable(dpy->fd, (char *) &pend) < 0) - _XIOError(dpy); -#ifdef XCONN_CHECK_FREQ - /* This is a crock, required because FIONREAD or equivalent is - * not guaranteed to detect a broken connection. - */ - if (!pend && !dpy->qlen && ++dpy->conn_checker >= XCONN_CHECK_FREQ) - { - unsigned long r_mask[MSKCNT]; - static struct timeval zero_time; - - dpy->conn_checker = 0; - CLEARBITS(r_mask); - BITSET(r_mask, dpy->fd); - if (pend = select(dpy->fd + 1, (int *)r_mask, NULL, NULL, - &zero_time)) - { - if (pend > 0) - { - if (BytesReadable(dpy->fd, (char *) &pend) < 0) - _XIOError(dpy); - /* we should not get zero, if we do, force a read */ - if (!pend) - pend = SIZEOF(xReply); - } - else if (pend < 0 && errno != EINTR) - _XIOError(dpy); - } - } -#endif /* XCONN_CHECK_FREQ */ - if (!(len = pend)) - return(dpy->qlen); /* _XFlush can enqueue events */ - /* Force a read if there is not enough data. Otherwise, - * a select() loop at a higher-level will spin undesirably, - * and we've seen at least one OS that appears to not update - * the result from FIONREAD once it has returned nonzero. - */ - if (len < SIZEOF(xReply)) - len = SIZEOF(xReply); - else if (len > BUFSIZE) - len = BUFSIZE; - len /= SIZEOF(xReply); - pend = len * SIZEOF(xReply); -#ifdef XCONN_CHECK_FREQ - dpy->conn_checker = 0; -#endif - _XRead (dpy, buf, (long) pend); - - /* no space between comma and type or else macro will die */ - STARTITERATE (rep,xReply, buf, (len > 0), len--) { - if (rep->generic.type == X_Error) - _XError(dpy, (xError *)rep); - else /* must be an event packet */ - _XEnq(dpy, (xEvent *) rep); - } - ENDITERATE - return(dpy->qlen); -} - -/* _XReadEvents - Flush the output queue, - * then read as many events as possible (but at least 1) and enqueue them - */ -void _XReadEvents(Display *dpy) -{ - char buf[BUFSIZE]; - long pend_not_register; /* because can't "&" a register variable */ - register long pend; - register xEvent *ev; - Bool not_yet_flushed = True; - - do { - /* find out how much data can be read */ - if (BytesReadable(dpy->fd, (char *) &pend_not_register) < 0) - _XIOError(dpy); - pend = pend_not_register; - - /* must read at least one xEvent; if none is pending, then - we'll just flush and block waiting for it */ - if (pend < SIZEOF(xEvent)) { - pend = SIZEOF(xEvent); - /* don't flush until we block the first time */ - if (not_yet_flushed) { - int qlen = dpy->qlen; - _XFlush (dpy); - if (qlen != dpy->qlen) return; - not_yet_flushed = False; - } - } - - /* but we won't read more than the max buffer size */ - if (pend > BUFSIZE) - pend = BUFSIZE; - - /* round down to an integral number of XReps */ - pend = (pend / SIZEOF(xEvent)) * SIZEOF(xEvent); - - _XRead (dpy, buf, pend); - - /* no space between comma and type or else macro will die */ - STARTITERATE (ev,xEvent, buf, (pend > 0), - pend -= SIZEOF(xEvent)) { - if (ev->u.u.type == X_Error) - _XError (dpy, (xError *) ev); - else /* it's an event packet; enqueue it */ - _XEnq (dpy, ev); - } - ENDITERATE - } while (dpy->head == NULL); -} - -#endif /* NEEDFORNX */ - -/* - * N_XRead - Read bytes from the socket taking into account incomplete - * reads. This routine may have to be reworked if int < long. - */ -int N_XRead (Display *dpy, char *data, long size) -{ - register long bytes_read; - - if (!dpy) return 0; - if ((dpy->flags & XlibDisplayIOError) || size == 0) return 0; - errno = 0; - while ((bytes_read = ReadFromServer(dpy->fd, data, (int)size)) - != size) { - - if (bytes_read > 0) { - size -= bytes_read; - data += bytes_read; - } - else if (ETEST(errno)) { - N_XWaitForReadable(dpy); - errno = 0; - } -#ifdef SUNSYSV - else if (errno == 0) { - N_XWaitForReadable(dpy); - } -#endif - else if (bytes_read == 0) { - /* Read failed because of end of file! */ - errno = EPIPE; - _XIOError(dpy); - } - - else /* bytes_read is less than 0; presumably -1 */ { - /* If it's a system call interrupt, it's not an error. */ - if (errno != EINTR) - _XIOError(dpy); - } - } - return 0; -} - -#ifdef WORD64 - -/* - * XXX This is a *really* stupid way of doing this.... - * PACKBUFFERSIZE must be a multiple of 4. - */ - -#define PACKBUFFERSIZE 4096 - - -/* - * _XRead32 - Read bytes from the socket unpacking each 32 bits - * into a long (64 bits on a CRAY computer). - * - */ -static void _doXRead32 (Display *dpy, long *data, long size, char *packbuffer) -{ - long *lpack,*lp; - long mask32 = 0x00000000ffffffff; - long maskw, nwords, i, bits; - - _XReadPad (dpy, packbuffer, size); - - lp = data; - lpack = (long *) packbuffer; - nwords = size >> 2; - bits = 32; - - for(i=0;i<nwords;i++){ - maskw = mask32 << bits; - *lp++ = ( *lpack & maskw ) >> bits; - bits = bits ^32; - if(bits){ - lpack++; - } - } -} - -void _XRead32 (Display *dpy, long *data, long len) -{ - char packbuffer[PACKBUFFERSIZE]; - unsigned nunits = PACKBUFFERSIZE >> 2; - - for (; len > PACKBUFFERSIZE; len -= PACKBUFFERSIZE, data += nunits) { - _doXRead32 (dpy, data, PACKBUFFERSIZE, packbuffer); - } - if (len) _doXRead32 (dpy, data, len, packbuffer); -} - - - -/* - * _XRead16 - Read bytes from the socket unpacking each 16 bits - * into a long (64 bits on a CRAY computer). - * - */ -static void _doXRead16 (Display *dpy, short *data, long size, char *packbuffer) -{ - long *lpack,*lp; - long mask16 = 0x000000000000ffff; - long maskw, nwords, i, bits; - - _XRead(dpy,packbuffer,size); /* don't do a padded read... */ - - lp = (long *) data; - lpack = (long *) packbuffer; - nwords = size >> 1; /* number of 16 bit words to be unpacked */ - bits = 48; - for(i=0;i<nwords;i++){ - maskw = mask16 << bits; - *lp++ = ( *lpack & maskw ) >> bits; - bits -= 16; - if(bits < 0){ - lpack++; - bits = 48; - } - } -} - -void _XRead16 (Display *dpy, short *data, long len) -{ - char packbuffer[PACKBUFFERSIZE]; - unsigned nunits = PACKBUFFERSIZE >> 1; - - for (; len > PACKBUFFERSIZE; len -= PACKBUFFERSIZE, data += nunits) { - _doXRead16 (dpy, data, PACKBUFFERSIZE, packbuffer); - } - if (len) _doXRead16 (dpy, data, len, packbuffer); -} - -void _XRead16Pad (Display *dpy, short *data, long size) -{ - int slop = (size & 3); - short slopbuf[3]; - - _XRead16 (dpy, data, size); - if (slop > 0) { - _XRead16 (dpy, slopbuf, 4 - slop); - } -} -#endif /* WORD64 */ - - -/* - * N_XReadPad - Read bytes from the socket taking into account incomplete - * reads. If the number of bytes is not 0 mod 32, read additional pad - * bytes. This routine may have to be reworked if int < long. - */ -void N_XReadPad (Display *dpy, char *data, long size) -{ - register long bytes_read; - struct iovec iov[2]; - char pad[3]; - - if (!dpy) return; - if ((dpy->flags & XlibDisplayIOError) || size == 0) return; - iov[0].iov_len = (int)size; - iov[0].iov_base = data; - /* - * The following hack is used to provide 32 bit long-word - * aligned padding. The [1] vector is of length 0, 1, 2, or 3, - * whatever is needed. - */ - - iov[1].iov_len = padlength[size & 3]; - iov[1].iov_base = pad; - size += iov[1].iov_len; - errno = 0; - while ((bytes_read = ReadvFromServer (dpy->fd, iov, 2)) != size) { - - if (bytes_read > 0) { - size -= bytes_read; - if (iov[0].iov_len < bytes_read) { - iov[1].iov_len += iov[0].iov_len - bytes_read; - iov[1].iov_base = - (char *)iov[1].iov_base + bytes_read - iov[0].iov_len; - iov[0].iov_len = 0; - } - else { - iov[0].iov_len -= bytes_read; - iov[0].iov_base = (char *)iov[0].iov_base + bytes_read; - } - } - else if (ETEST(errno)) { - N_XWaitForReadable(dpy); - errno = 0; - } -#ifdef SUNSYSV - else if (errno == 0) { - N_XWaitForReadable(dpy); - } -#endif - else if (bytes_read == 0) { - /* Read failed because of end of file! */ - errno = EPIPE; - _XIOError(dpy); - } - - else /* bytes_read is less than 0; presumably -1 */ { - /* If it's a system call interrupt, it's not an error. */ - if (errno != EINTR) - _XIOError(dpy); - } - } -} - -/* - * N_XSend - Flush the buffer and send the client data. 32 bit word aligned - * transmission is used, if size is not 0 mod 4, extra bytes are transmitted. - * This routine may have to be reworked if int < long; - */ -void N_XSend (Display *dpy, _Xconst char *data, long size) -{ - struct iovec iov[3]; - static char pad[3] = {0, 0, 0}; - /* XText8 and XText16 require that the padding bytes be zero! */ - - long skip = 0; - long dpybufsize = (dpy->bufptr - dpy->buffer); - long padsize = padlength[size & 3]; - long total = dpybufsize + size + padsize; - long todo = total; - - if (dpy->flags & XlibDisplayIOError) return; - - /* - * There are 3 pieces that may need to be written out: - * - * o whatever is in the display buffer - * o the data passed in by the user - * o any padding needed to 32bit align the whole mess - * - * This loop looks at all 3 pieces each time through. It uses skip - * to figure out whether or not a given piece is needed. - */ - while (total) { - long before = skip; /* amount of whole thing written */ - long remain = todo; /* amount to try this time, <= total */ - int i = 0; - long len; - - /* You could be very general here and have "in" and "out" iovecs - * and write a loop without using a macro, but what the heck. This - * translates to: - * - * how much of this piece is new? - * if more new then we are trying this time, clamp - * if nothing new - * then bump down amount already written, for next piece - * else put new stuff in iovec, will need all of next piece - * - * Note that todo had better be at least 1 or else we'll end up - * writing 0 iovecs. - */ -#define InsertIOV(pointer, length) \ - len = (length) - before; \ - if (len > remain) \ - len = remain; \ - if (len <= 0) { \ - before = (-len); \ - } else { \ - iov[i].iov_len = len; \ - iov[i].iov_base = (pointer) + before; \ - i++; \ - remain -= len; \ - before = 0; \ - } - - InsertIOV (dpy->buffer, dpybufsize) - InsertIOV ((char *)data, size) - InsertIOV (pad, padsize) - - errno = 0; - if ((len = WritevToServer(dpy->fd, iov, i)) >= 0) { - skip += len; - total -= len; - todo = total; - } else if (ETEST(errno)) { - N_XWaitForWritable(dpy); -#ifdef SUNSYSV - } else if (errno == 0) { - N_XWaitForWritable(dpy); -#endif -#ifdef EMSGSIZE - } else if (errno == EMSGSIZE) { - if (todo > 1) - todo >>= 1; - else - N_XWaitForWritable(dpy); -#endif - } else if (errno != EINTR) { - _XIOError(dpy); - } - } - - dpy->bufptr = dpy->buffer; - dpy->last_req = (char *) & _dummy_request; - return; -} - -#ifdef NEEDFORNX -/* - * _XAllocID - normal resource ID allocation routine. A client - * can roll his own and instatantiate it if he wants, but must - * follow the rules. - */ -XID _XAllocID(Display *dpy) -{ - XID id; - - id = dpy->resource_id << dpy->resource_shift; - if (id <= dpy->resource_mask) { - dpy->resource_id++; - return (dpy->resource_base + id); - } - if (id != 0x10000000) { - (void) fprintf(stderr, - "Xlib: resource ID allocation space exhausted!\n"); - id = 0x10000000; - dpy->resource_id = id >> dpy->resource_shift; - } - return id; -} - -/* - * The hard part about this is that we only get 16 bits from a reply. Well, - * then, we have three values that will march along, with the following - * invariant: - * dpy->last_request_read <= rep->sequenceNumber <= dpy->request - * The right choice for rep->sequenceNumber is the largest that - * still meets these constraints. - */ - -unsigned long -_XSetLastRequestRead(Display *dpy, xGenericReply *rep) -{ - register unsigned long newseq, lastseq; - - /* - * KeymapNotify has no sequence number, but is always guaranteed - * to immediately follow another event, except when generated via - * SendEvent (hmmm). - */ - if ((rep->type & 0x7f) == KeymapNotify) - return(dpy->last_request_read); - - newseq = (dpy->last_request_read & ~((unsigned long)0xffff)) | - rep->sequenceNumber; - lastseq = dpy->last_request_read; - while (newseq < lastseq) { - newseq += 0x10000; - if (newseq > dpy->request) { - (void) fprintf (stderr, - "Xlib: sequence lost (0x%lx > 0x%lx) in reply type 0x%x!\n", - newseq, dpy->request, - (unsigned int) rep->type); - newseq -= 0x10000; - break; - } - } - - dpy->last_request_read = newseq; - return(newseq); -} - -#endif /* NEEDFORNX */ - -/* - * N_XReply - Wait for a reply packet and copy its contents into the - * specified rep. Mean while we must handle error and event packets that - * we may encounter. - */ -Status N_XReply ( - Display *dpy, - xReply *rep, - int extra, /* number of 32-bit words expected after the reply */ - Bool discard) /* should I discard data following "extra" words? */ -{ - /* Pull out the serial number now, so that (currently illegal) requests - * generated by an error handler don't confuse us. - */ - unsigned long cur_request = dpy->request; - - if (dpy->flags & XlibDisplayIOError) return (0); - - N_XFlush(dpy); - while (1) { - N_XRead(dpy, (char *)rep, (long)SIZEOF(xReply)); - switch ((int)rep->generic.type) { - - case X_Reply: - /* Reply received. Fast update for synchronous replies, - * but deal with multiple outstanding replies. - */ - if (rep->generic.sequenceNumber == (cur_request & 0xffff)) - dpy->last_request_read = cur_request; - else - (void) _XSetLastRequestRead(dpy, &rep->generic); - if (extra == 0) { - if (discard && (rep->generic.length > 0)) - /* unexpectedly long reply! */ - _EatData32 (dpy, rep->generic.length); - return (1); - } - if ((unsigned) extra == rep->generic.length) { - /* - * Read the extra data into storage immediately following - * the GenericReply structure. - */ - N_XRead (dpy, (char *) (NEXTPTR(rep,xReply)), - ((long)extra) << 2); - return (1); - } - if ((unsigned) extra < rep->generic.length) { - /* Actual reply is longer than "extra" */ - N_XRead (dpy, (char *) (NEXTPTR(rep,xReply)), - ((long)extra) << 2); - if (discard) - _EatData32 (dpy, rep->generic.length - extra); - return (1); - } - /* - *if we get here, then extra > rep->generic.length--meaning we - * read a reply that's shorter than we expected. This is an - * error, but we still need to figure out how to handle it... - */ - N_XRead (dpy, (char *) (NEXTPTR(rep,xReply)), - ((long) rep->generic.length) << 2); - _XIOError (dpy); - return (0); - - case X_Error: - { - register _XExtension *ext; - register Bool ret = False; - int ret_code; - xError *err = (xError *) rep; - unsigned long serial; - - serial = _XSetLastRequestRead(dpy, (xGenericReply *)rep); - /* - * we better see if there is an extension who may - * want to suppress the error. - */ - for (ext = dpy->ext_procs; !ret && ext; ext = ext->next) { - if (ext->error) - ret = (*ext->error)(dpy, err, &ext->codes, &ret_code); - } - if (!ret) { - _XError(dpy, err); - ret_code = 0; - } - if (serial == cur_request) - return(ret_code); - } - break; - default: - /* There should never be any events on this connection! */ - DPSFatalProc(NULL, "N_XReply read bogus X event"); - break; - } - } -} - - -/* Read and discard "n" 8-bit bytes of data */ - -static void -N_XEatData (Display *dpy, unsigned long n) -{ -#define SCRATCHSIZE 2048 - char buf[SCRATCHSIZE]; - - while (n > 0) { - register long bytes_read = (n > SCRATCHSIZE) ? SCRATCHSIZE : n; - N_XRead (dpy, buf, bytes_read); - n -= bytes_read; - } -#undef SCRATCHSIZE -} - - -/* Read and discard "n" 32-bit words. */ - -static void _EatData32 (Display *dpy, unsigned long n) -{ - N_XEatData (dpy, n << 2); -} - - -#ifdef NEEDFORNX -/* - * _XEnq - Place event packets on the display's queue. - * note that no squishing of move events in V11, since there - * is pointer motion hints.... - */ -void _XEnq (Display *dpy, xEvent *event) -{ - register _XQEvent *qelt; - -/*NOSTRICT*/ - if (qelt = _qfree) { - /* If _qfree is non-NULL do this, else malloc a new one. */ - _qfree = qelt->next; - } - else if ((qelt = - (_XQEvent *) Xmalloc((unsigned)sizeof(_XQEvent))) == NULL) { - /* Malloc call failed! */ - errno = ENOMEM; - _XIOError(dpy); - } - qelt->next = NULL; - /* go call through display to find proper event reformatter */ - if ((*dpy->event_vec[event->u.u.type & 0177])(dpy, &qelt->event, event)) { - if (dpy->tail) dpy->tail->next = qelt; - else dpy->head = qelt; - - dpy->tail = qelt; - dpy->qlen++; - } else { - /* ignored, or stashed away for many-to-one compression */ - qelt->next = _qfree; - _qfree = qelt; - } -} -/* - * EventToWire in separate file in that often not needed. - */ -#endif /* NEEDFORNX */ - -/*ARGSUSED*/ -Bool -N_XUnknownWireEvent( - Display *dpy, /* pointer to display structure */ - XEvent *re, /* pointer to where event should be reformatted */ - xEvent *event) /* wire protocol event */ -{ - char mbuf[256]; - - sprintf(mbuf, "NX: unhandled wire event %d, agent = %lx", re->type, (long)dpy); - DPSWarnProc(NULL, mbuf); - return(False); -} - -/*ARGSUSED*/ -Status -N_XUnknownNativeEvent( - Display *dpy, /* pointer to display structure */ - XEvent *re, /* pointer to where event should be reformatted */ - xEvent *event) /* wire protocol event */ -{ - char mbuf[256]; - - sprintf(mbuf, "NX: unhandled native event %d, agent = %lx", re->type, (long)dpy); - DPSWarnProc(NULL, mbuf); - return(0); -} - -#ifdef NEEDFORNX -/* - * reformat a wire event into an XEvent structure of the right type. - */ -Bool -_XWireToEvent( - Display *dpy, /* pointer to display structure */ - XEvent *re, /* pointer to where event should be reformatted */ - xEvent *event) /* wire protocol event */ -{ - - re->type = event->u.u.type & 0x7f; - ((XAnyEvent *)re)->serial = _XSetLastRequestRead(dpy, - (xGenericReply *)event); - ((XAnyEvent *)re)->send_event = ((event->u.u.type & 0x80) != 0); - ((XAnyEvent *)re)->display = dpy; - - /* Ignore the leading bit of the event type since it is set when a - client sends an event rather than the server. */ - - switch (event-> u.u.type & 0177) { - case KeyPress: - case KeyRelease: - { - register XKeyEvent *ev = (XKeyEvent*) re; - ev->root = event->u.keyButtonPointer.root; - ev->window = event->u.keyButtonPointer.event; - ev->subwindow = event->u.keyButtonPointer.child; - ev->time = event->u.keyButtonPointer.time; - ev->x = cvtINT16toInt(event->u.keyButtonPointer.eventX); - ev->y = cvtINT16toInt(event->u.keyButtonPointer.eventY); - ev->x_root = cvtINT16toInt(event->u.keyButtonPointer.rootX); - ev->y_root = cvtINT16toInt(event->u.keyButtonPointer.rootY); - ev->state = event->u.keyButtonPointer.state; - ev->same_screen = event->u.keyButtonPointer.sameScreen; - ev->keycode = event->u.u.detail; - } - break; - case ButtonPress: - case ButtonRelease: - { - register XButtonEvent *ev = (XButtonEvent *) re; - ev->root = event->u.keyButtonPointer.root; - ev->window = event->u.keyButtonPointer.event; - ev->subwindow = event->u.keyButtonPointer.child; - ev->time = event->u.keyButtonPointer.time; - ev->x = cvtINT16toInt(event->u.keyButtonPointer.eventX); - ev->y = cvtINT16toInt(event->u.keyButtonPointer.eventY); - ev->x_root = cvtINT16toInt(event->u.keyButtonPointer.rootX); - ev->y_root = cvtINT16toInt(event->u.keyButtonPointer.rootY); - ev->state = event->u.keyButtonPointer.state; - ev->same_screen = event->u.keyButtonPointer.sameScreen; - ev->button = event->u.u.detail; - } - break; - case MotionNotify: - { - register XMotionEvent *ev = (XMotionEvent *)re; - ev->root = event->u.keyButtonPointer.root; - ev->window = event->u.keyButtonPointer.event; - ev->subwindow = event->u.keyButtonPointer.child; - ev->time = event->u.keyButtonPointer.time; - ev->x = cvtINT16toInt(event->u.keyButtonPointer.eventX); - ev->y = cvtINT16toInt(event->u.keyButtonPointer.eventY); - ev->x_root = cvtINT16toInt(event->u.keyButtonPointer.rootX); - ev->y_root = cvtINT16toInt(event->u.keyButtonPointer.rootY); - ev->state = event->u.keyButtonPointer.state; - ev->same_screen = event->u.keyButtonPointer.sameScreen; - ev->is_hint = event->u.u.detail; - } - break; - case EnterNotify: - case LeaveNotify: - { - register XCrossingEvent *ev = (XCrossingEvent *) re; - ev->root = event->u.enterLeave.root; - ev->window = event->u.enterLeave.event; - ev->subwindow = event->u.enterLeave.child; - ev->time = event->u.enterLeave.time; - ev->x = cvtINT16toInt(event->u.enterLeave.eventX); - ev->y = cvtINT16toInt(event->u.enterLeave.eventY); - ev->x_root = cvtINT16toInt(event->u.enterLeave.rootX); - ev->y_root = cvtINT16toInt(event->u.enterLeave.rootY); - ev->state = event->u.enterLeave.state; - ev->mode = event->u.enterLeave.mode; - ev->same_screen = (event->u.enterLeave.flags & - ELFlagSameScreen) && True; - ev->focus = (event->u.enterLeave.flags & - ELFlagFocus) && True; - ev->detail = event->u.u.detail; - } - break; - case FocusIn: - case FocusOut: - { - register XFocusChangeEvent *ev = (XFocusChangeEvent *) re; - ev->window = event->u.focus.window; - ev->mode = event->u.focus.mode; - ev->detail = event->u.u.detail; - } - break; - case KeymapNotify: - { - register XKeymapEvent *ev = (XKeymapEvent *) re; - ev->window = dpy->current; - bcopy ((char *)((xKeymapEvent *) event)->map, - &ev->key_vector[1], - sizeof (((xKeymapEvent *) event)->map)); - } - break; - case Expose: - { - register XExposeEvent *ev = (XExposeEvent *) re; - ev->window = event->u.expose.window; - ev->x = event->u.expose.x; - ev->y = event->u.expose.y; - ev->width = event->u.expose.width; - ev->height = event->u.expose.height; - ev->count = event->u.expose.count; - } - break; - case GraphicsExpose: - { - register XGraphicsExposeEvent *ev = - (XGraphicsExposeEvent *) re; - ev->drawable = event->u.graphicsExposure.drawable; - ev->x = event->u.graphicsExposure.x; - ev->y = event->u.graphicsExposure.y; - ev->width = event->u.graphicsExposure.width; - ev->height = event->u.graphicsExposure.height; - ev->count = event->u.graphicsExposure.count; - ev->major_code = event->u.graphicsExposure.majorEvent; - ev->minor_code = event->u.graphicsExposure.minorEvent; - } - break; - case NoExpose: - { - register XNoExposeEvent *ev = (XNoExposeEvent *) re; - ev->drawable = event->u.noExposure.drawable; - ev->major_code = event->u.noExposure.majorEvent; - ev->minor_code = event->u.noExposure.minorEvent; - } - break; - case VisibilityNotify: - { - register XVisibilityEvent *ev = (XVisibilityEvent *) re; - ev->window = event->u.visibility.window; - ev->state = event->u.visibility.state; - } - break; - case CreateNotify: - { - register XCreateWindowEvent *ev = - (XCreateWindowEvent *) re; - ev->window = event->u.createNotify.window; - ev->parent = event->u.createNotify.parent; - ev->x = cvtINT16toInt(event->u.createNotify.x); - ev->y = cvtINT16toInt(event->u.createNotify.y); - ev->width = event->u.createNotify.width; - ev->height = event->u.createNotify.height; - ev->border_width = event->u.createNotify.borderWidth; - ev->override_redirect = event->u.createNotify.override; - } - break; - case DestroyNotify: - { - register XDestroyWindowEvent *ev = - (XDestroyWindowEvent *) re; - ev->window = event->u.destroyNotify.window; - ev->event = event->u.destroyNotify.event; - } - break; - case UnmapNotify: - { - register XUnmapEvent *ev = (XUnmapEvent *) re; - ev->window = event->u.unmapNotify.window; - ev->event = event->u.unmapNotify.event; - ev->from_configure = event->u.unmapNotify.fromConfigure; - } - break; - case MapNotify: - { - register XMapEvent *ev = (XMapEvent *) re; - ev->window = event->u.mapNotify.window; - ev->event = event->u.mapNotify.event; - ev->override_redirect = event->u.mapNotify.override; - } - break; - case MapRequest: - { - register XMapRequestEvent *ev = (XMapRequestEvent *) re; - ev->window = event->u.mapRequest.window; - ev->parent = event->u.mapRequest.parent; - } - break; - case ReparentNotify: - { - register XReparentEvent *ev = (XReparentEvent *) re; - ev->event = event->u.reparent.event; - ev->window = event->u.reparent.window; - ev->parent = event->u.reparent.parent; - ev->x = cvtINT16toInt(event->u.reparent.x); - ev->y = cvtINT16toInt(event->u.reparent.y); - ev->override_redirect = event->u.reparent.override; - } - break; - case ConfigureNotify: - { - register XConfigureEvent *ev = (XConfigureEvent *) re; - ev->event = event->u.configureNotify.event; - ev->window = event->u.configureNotify.window; - ev->above = event->u.configureNotify.aboveSibling; - ev->x = cvtINT16toInt(event->u.configureNotify.x); - ev->y = cvtINT16toInt(event->u.configureNotify.y); - ev->width = event->u.configureNotify.width; - ev->height = event->u.configureNotify.height; - ev->border_width = event->u.configureNotify.borderWidth; - ev->override_redirect = event->u.configureNotify.override; - } - break; - case ConfigureRequest: - { - register XConfigureRequestEvent *ev = - (XConfigureRequestEvent *) re; - ev->window = event->u.configureRequest.window; - ev->parent = event->u.configureRequest.parent; - ev->above = event->u.configureRequest.sibling; - ev->x = cvtINT16toInt(event->u.configureRequest.x); - ev->y = cvtINT16toInt(event->u.configureRequest.y); - ev->width = event->u.configureRequest.width; - ev->height = event->u.configureRequest.height; - ev->border_width = event->u.configureRequest.borderWidth; - ev->value_mask = event->u.configureRequest.valueMask; - ev->detail = event->u.u.detail; - } - break; - case GravityNotify: - { - register XGravityEvent *ev = (XGravityEvent *) re; - ev->window = event->u.gravity.window; - ev->event = event->u.gravity.event; - ev->x = cvtINT16toInt(event->u.gravity.x); - ev->y = cvtINT16toInt(event->u.gravity.y); - } - break; - case ResizeRequest: - { - register XResizeRequestEvent *ev = - (XResizeRequestEvent *) re; - ev->window = event->u.resizeRequest.window; - ev->width = event->u.resizeRequest.width; - ev->height = event->u.resizeRequest.height; - } - break; - case CirculateNotify: - { - register XCirculateEvent *ev = (XCirculateEvent *) re; - ev->window = event->u.circulate.window; - ev->event = event->u.circulate.event; - ev->place = event->u.circulate.place; - } - break; - case CirculateRequest: - { - register XCirculateRequestEvent *ev = - (XCirculateRequestEvent *) re; - ev->window = event->u.circulate.window; - ev->parent = event->u.circulate.event; - ev->place = event->u.circulate.place; - } - break; - case PropertyNotify: - { - register XPropertyEvent *ev = (XPropertyEvent *) re; - ev->window = event->u.property.window; - ev->atom = event->u.property.atom; - ev->time = event->u.property.time; - ev->state = event->u.property.state; - } - break; - case SelectionClear: - { - register XSelectionClearEvent *ev = - (XSelectionClearEvent *) re; - ev->window = event->u.selectionClear.window; - ev->selection = event->u.selectionClear.atom; - ev->time = event->u.selectionClear.time; - } - break; - case SelectionRequest: - { - register XSelectionRequestEvent *ev = - (XSelectionRequestEvent *) re; - ev->owner = event->u.selectionRequest.owner; - ev->requestor = event->u.selectionRequest.requestor; - ev->selection = event->u.selectionRequest.selection; - ev->target = event->u.selectionRequest.target; - ev->property = event->u.selectionRequest.property; - ev->time = event->u.selectionRequest.time; - } - break; - case SelectionNotify: - { - register XSelectionEvent *ev = (XSelectionEvent *) re; - ev->requestor = event->u.selectionNotify.requestor; - ev->selection = event->u.selectionNotify.selection; - ev->target = event->u.selectionNotify.target; - ev->property = event->u.selectionNotify.property; - ev->time = event->u.selectionNotify.time; - } - break; - case ColormapNotify: - { - register XColormapEvent *ev = (XColormapEvent *) re; - ev->window = event->u.colormap.window; - ev->colormap = event->u.colormap.colormap; - ev->new = event->u.colormap.new; - ev->state = event->u.colormap.state; - } - break; - case ClientMessage: - { - register int i; - register XClientMessageEvent *ev - = (XClientMessageEvent *) re; - ev->window = event->u.clientMessage.window; - ev->format = event->u.u.detail; - switch (ev->format) { - case 8: - ev->message_type = event->u.clientMessage.u.b.type; - for (i = 0; i < 20; i++) - ev->data.b[i] = event->u.clientMessage.u.b.bytes[i]; - break; - case 16: - ev->message_type = event->u.clientMessage.u.s.type; - ev->data.s[0] = cvtINT16toShort(event->u.clientMessage.u.s.shorts0); - ev->data.s[1] = cvtINT16toShort(event->u.clientMessage.u.s.shorts1); - ev->data.s[2] = cvtINT16toShort(event->u.clientMessage.u.s.shorts2); - ev->data.s[3] = cvtINT16toShort(event->u.clientMessage.u.s.shorts3); - ev->data.s[4] = cvtINT16toShort(event->u.clientMessage.u.s.shorts4); - ev->data.s[5] = cvtINT16toShort(event->u.clientMessage.u.s.shorts5); - ev->data.s[6] = cvtINT16toShort(event->u.clientMessage.u.s.shorts6); - ev->data.s[7] = cvtINT16toShort(event->u.clientMessage.u.s.shorts7); - ev->data.s[8] = cvtINT16toShort(event->u.clientMessage.u.s.shorts8); - ev->data.s[9] = cvtINT16toShort(event->u.clientMessage.u.s.shorts9); - break; - case 32: - ev->message_type = event->u.clientMessage.u.l.type; - ev->data.l[0] = cvtINT32toLong(event->u.clientMessage.u.l.longs0); - ev->data.l[1] = cvtINT32toLong(event->u.clientMessage.u.l.longs1); - ev->data.l[2] = cvtINT32toLong(event->u.clientMessage.u.l.longs2); - ev->data.l[3] = cvtINT32toLong(event->u.clientMessage.u.l.longs3); - ev->data.l[4] = cvtINT32toLong(event->u.clientMessage.u.l.longs4); - break; - default: /* XXX should never occur */ - break; - } - } - break; - case MappingNotify: - { - register XMappingEvent *ev = (XMappingEvent *)re; - ev->window = 0; - ev->first_keycode = event->u.mappingNotify.firstKeyCode; - ev->request = event->u.mappingNotify.request; - ev->count = event->u.mappingNotify.count; - } - break; - default: - return(_XUnknownWireEvent(dpy, re, event)); - } - return(True); -} - - -#ifndef USL_SHARELIB - -static char *_SysErrorMsg (int n) -{ - extern char *sys_errlist[]; - extern int sys_nerr; - char *s = ((n >= 0 && n < sys_nerr) ? sys_errlist[n] : "unknown error"); - - return (s ? s : "no such error"); -} - -#endif /* USL sharedlibs in don't define for SVR3.2 */ - - -/* - * _XDefaultIOError - Default fatal system error reporting routine. Called - * when an X internal system error is encountered. - */ -_XDefaultIOError (Display *dpy) -{ - (void) fprintf (stderr, - "XIO: fatal IO error %d (%s) on X server \"%s\"\r\n", - errno, _SysErrorMsg (errno), DisplayString (dpy)); - (void) fprintf (stderr, - " after %lu requests (%lu known processed) with %d events remaining.\r\n", - NextRequest(dpy) - 1, LastKnownRequestProcessed(dpy), - QLength(dpy)); - - if (errno == EPIPE) { - (void) fprintf (stderr, - " The connection was probably broken by a server shutdown or KillClient.\r\n"); - } - exit(1); -} - - -static int _XPrintDefaultError (Display *dpy, XErrorEvent *event, FILE *fp) -{ - char buffer[BUFSIZ]; - char mesg[BUFSIZ]; - char number[32]; - char *mtype = "XlibMessage"; - register _XExtension *ext = (_XExtension *)NULL; - _XExtension *bext = (_XExtension *)NULL; - XGetErrorText(dpy, event->error_code, buffer, BUFSIZ); - XGetErrorDatabaseText(dpy, mtype, "XError", "X Error", mesg, BUFSIZ); - (void) fprintf(fp, "%s: %s\n ", mesg, buffer); - XGetErrorDatabaseText(dpy, mtype, "MajorCode", "Request Major code %d", - mesg, BUFSIZ); - (void) fprintf(fp, mesg, event->request_code); - if (event->request_code < 128) { - sprintf(number, "%d", event->request_code); - XGetErrorDatabaseText(dpy, "XRequest", number, "", buffer, BUFSIZ); - } else { - for (ext = dpy->ext_procs; - ext && (ext->codes.major_opcode != event->request_code); - ext = ext->next) - ; - if (ext) - strcpy(buffer, ext->name); - else - buffer[0] = '\0'; - } - (void) fprintf(fp, " (%s)\n", buffer); - if (event->request_code >= 128) { - XGetErrorDatabaseText(dpy, mtype, "MinorCode", "Request Minor code %d", - mesg, BUFSIZ); - fputs(" ", fp); - (void) fprintf(fp, mesg, event->minor_code); - if (ext) { - sprintf(mesg, "%s.%d", ext->name, event->minor_code); - XGetErrorDatabaseText(dpy, "XRequest", mesg, "", buffer, BUFSIZ); - (void) fprintf(fp, " (%s)", buffer); - } - fputs("\n", fp); - } - if (event->error_code >= 128) { - /* kludge, try to find the extension that caused it */ - buffer[0] = '\0'; - for (ext = dpy->ext_procs; ext; ext = ext->next) { - if (ext->error_string) - (*ext->error_string)(dpy, event->error_code, &ext->codes, - buffer, BUFSIZ); - if (buffer[0]) { - bext = ext; - break; - } - if (ext->codes.first_error && - ext->codes.first_error < event->error_code && - (!bext || ext->codes.first_error > bext->codes.first_error)) - bext = ext; - } - if (bext) - sprintf(buffer, "%s.%d", bext->name, - event->error_code - bext->codes.first_error); - else - strcpy(buffer, "Value"); - XGetErrorDatabaseText(dpy, mtype, buffer, "", mesg, BUFSIZ); - if (mesg[0]) { - fputs(" ", fp); - (void) fprintf(fp, mesg, event->resourceid); - fputs("\n", fp); - } - /* let extensions try to print the values */ - for (ext = dpy->ext_procs; ext; ext = ext->next) { - if (ext->error_values) - (*ext->error_values)(dpy, event, fp); - } - } else if ((event->error_code == BadWindow) || - (event->error_code == BadPixmap) || - (event->error_code == BadCursor) || - (event->error_code == BadFont) || - (event->error_code == BadDrawable) || - (event->error_code == BadColor) || - (event->error_code == BadGC) || - (event->error_code == BadIDChoice) || - (event->error_code == BadValue) || - (event->error_code == BadAtom)) { - if (event->error_code == BadValue) - XGetErrorDatabaseText(dpy, mtype, "Value", "Value 0x%x", - mesg, BUFSIZ); - else if (event->error_code == BadAtom) - XGetErrorDatabaseText(dpy, mtype, "AtomID", "AtomID 0x%x", - mesg, BUFSIZ); - else - XGetErrorDatabaseText(dpy, mtype, "ResourceID", "ResourceID 0x%x", - mesg, BUFSIZ); - fputs(" ", fp); - (void) fprintf(fp, mesg, event->resourceid); - fputs("\n", fp); - } - XGetErrorDatabaseText(dpy, mtype, "ErrorSerial", "Error Serial #%d", - mesg, BUFSIZ); - fputs(" ", fp); - (void) fprintf(fp, mesg, event->serial); - XGetErrorDatabaseText(dpy, mtype, "CurrentSerial", "Current Serial #%d", - mesg, BUFSIZ); - fputs("\n ", fp); - (void) fprintf(fp, mesg, dpy->request); - fputs("\n", fp); - if (event->error_code == BadImplementation) return 0; - return 1; -} - -int _XDefaultError(Display *dpy, XErrorEvent *event) -{ - if (_XPrintDefaultError (dpy, event, stderr) == 0) return 0; - exit(1); - /*NOTREACHED*/ -} - -/*ARGSUSED*/ -Bool _XDefaultWireError(Display *display, XErrorEvent *he, xError *we) -{ - return True; -} - -/* - * _XError - prepare to upcall user protocol error handler - */ -int _XError (Display *dpy, xError *rep) -{ - /* - * X_Error packet encountered! We need to unpack the error before - * giving it to the user. - */ - XEvent event; /* make it a large event */ - - event.xerror.display = dpy; - event.xerror.type = X_Error; - event.xerror.serial = _XSetLastRequestRead(dpy, (xGenericReply *)rep); - event.xerror.resourceid = rep->resourceID; - event.xerror.error_code = rep->errorCode; - event.xerror.request_code = rep->majorCode; - event.xerror.minor_code = rep->minorCode; - if (dpy->error_vec && - !(*dpy->error_vec[rep->errorCode])(dpy, &event.xerror, rep)) - return 0; - if (_XErrorFunction != NULL) { - return ((*_XErrorFunction)(dpy, &event)); /* upcall */ - } else { - return _XDefaultError(dpy, &event); - } -} - -/* - * _XIOError - call user connection error handler and exit - */ -int _XIOError (Display *dpy) -{ - dpy->flags |= XlibDisplayIOError; - if (_XIOErrorFunction != NULL) - (*_XIOErrorFunction)(dpy); - else - _XDefaultIOError(dpy); - exit (1); -} - - -/* - * This routine can be used to (cheaply) get some memory within a single - * Xlib routine for scratch space. It is reallocated from the same place - * each time, unless the library needs a large scratch space. - */ -char *_XAllocScratch (Display *dpy, unsigned long nbytes) -{ - if (nbytes > dpy->scratch_length) { - if (dpy->scratch_buffer) Xfree (dpy->scratch_buffer); - if (dpy->scratch_buffer = Xmalloc((unsigned) nbytes)) - dpy->scratch_length = nbytes; - else dpy->scratch_length = 0; - } - return (dpy->scratch_buffer); -} - -/* - * Given a visual id, find the visual structure for this id on this display. - */ -Visual *_XVIDtoVisual (Display *dpy, VisualID id) -{ - register int i, j, k; - register Screen *sp; - register Depth *dp; - register Visual *vp; - for (i = 0; i < dpy->nscreens; i++) { - sp = &dpy->screens[i]; - for (j = 0; j < sp->ndepths; j++) { - dp = &sp->depths[j]; - /* if nvisuals == 0 then visuals will be NULL */ - for (k = 0; k < dp->nvisuals; k++) { - vp = &dp->visuals[k]; - if (vp->visualid == id) return (vp); - } - } - } - return (NULL); -} - -void XFree (void *data) -{ - Xfree (data); -} - -#ifdef _XNEEDBCOPYFUNC -void _Xbcopy(char *b1, char *b2, length) -{ - if (b1 < b2) { - b2 += length; - b1 += length; - while (length--) - *--b2 = *--b1; - } else { - while (length--) - *b2++ = *b1++; - } -} -#endif - -#endif /* NEEDFORNX */ - -void NXProcData (Display *dpy, char *data, long len) -{ - if (dpy->bufptr + (len) <= dpy->bufmax) { - bcopy(data, dpy->bufptr, (int)len); - dpy->bufptr += ((len) + 3) & ~3; - } else { - N_XSend(dpy, data, len); - } -} - - -#ifdef WORD64 - -/* - * XXX This is a *really* stupid way of doing this. It should just use - * dpy->bufptr directly, taking into account where in the word it is. - */ - -/* - * Data16 - Place 16 bit data in the buffer. - * - * "dpy" is a pointer to a Display. - * "data" is a pointer to the data. - * "len" is the length in bytes of the data. - */ - -static void -doData16(Display *dpy, short *data, unsigned len, char *packbuffer) -{ - long *lp,*lpack; - long i, nwords,bits; - long mask16 = 0x000000000000ffff; - - lp = (long *)data; - lpack = (long *)packbuffer; - -/* nwords is the number of 16 bit values to be packed, - * the low order 16 bits of each word will be packed - * into 64 bit words - */ - nwords = len >> 1; - bits = 48; - - for(i=0;i<nwords;i++){ - if (bits == 48) *lpack = 0; - *lpack ^= (*lp & mask16) << bits; - bits -= 16 ; - lp++; - if(bits < 0){ - lpack++; - bits = 48; - } - } - Data(dpy, packbuffer, len); -} - -void -Data16 (Display *dpy, short *data, unsigned len) -{ - char packbuffer[PACKBUFFERSIZE]; - unsigned nunits = PACKBUFFERSIZE >> 1; - - for (; len > PACKBUFFERSIZE; len -= PACKBUFFERSIZE, data += nunits) { - doData16 (dpy, data, PACKBUFFERSIZE, packbuffer); - } - if (len) doData16 (dpy, data, len, packbuffer); -} - -/* - * Data32 - Place 32 bit data in the buffer. - * - * "dpy" is a pointer to a Display. - * "data" is a pointer to the data. - * "len" is the length in bytes of the data. - */ - -static doData32 (Display *dpy, long *data, unsigned len, char *packbuffer) -{ - long *lp,*lpack; - long i,bits,nwords; - long mask32 = 0x00000000ffffffff; - - lpack = (long *) packbuffer; - lp = data; - -/* nwords is the number of 32 bit values to be packed - * the low order 32 bits of each word will be packed - * into 64 bit words - */ - nwords = len >> 2; - bits = 32; - - for(i=0;i<nwords;i++){ - if (bits == 32) *lpack = 0; - *lpack ^= (*lp & mask32) << bits; - bits = bits ^32; - lp++; - if(bits) - lpack++; - } - Data(dpy, packbuffer, len); -} - -Data32 (Display *dpy, long *data, unsigned len) -{ - char packbuffer[PACKBUFFERSIZE]; - unsigned nunits = PACKBUFFERSIZE >> 2; - - for (; len > PACKBUFFERSIZE; len -= PACKBUFFERSIZE, data += nunits) { - doData32 (dpy, data, PACKBUFFERSIZE, packbuffer); - } - if (len) doData32 (dpy, data, len, packbuffer); -} - -#endif /* WORD64 */ - - -#ifdef NEEDFORNX - -/* - * _XFreeQ - free the queue of events, called by XCloseDisplay - */ - -void _XFreeQ (void) -{ - register _XQEvent *qelt = _qfree; - - while (qelt) { - register _XQEvent *qnxt = qelt->next; - Xfree ((char *) qelt); - qelt = qnxt; - } - _qfree = NULL; - return; -} -#endif /* NEEDFORNX */ - -/* Make sure this produces the same string as DefineLocal/DefineSelf in xdm. - * Otherwise, Xau will not be able to find your cookies in the Xauthority file. - * - * Note: POSIX says that the ``nodename'' member of utsname does _not_ have - * to have sufficient information for interfacing to the network, - * and so, you may be better off using gethostname (if it exists). - */ - -#if (defined(_POSIX_SOURCE) && !defined(AIXV3)) || defined(hpux) || defined(USG) || defined(SVR4) -#define NEED_UTSNAME -#include <sys/utsname.h> -#endif - -/* - * N_XGetHostname - similar to gethostname but allows special processing. - */ -int N_XGetHostname (char *buf, int maxlen) -{ - int len; - -#ifdef NEED_UTSNAME - struct utsname name; - - uname (&name); - len = strlen (name.nodename); - if (len >= maxlen) len = maxlen - 1; - strncpy (buf, name.nodename, len); - buf[len] = '\0'; -#else - buf[0] = '\0'; - (void) gethostname (buf, maxlen); - buf [maxlen - 1] = '\0'; - len = strlen(buf); -#endif /* NEED_UTSNAME */ - return len; -} - -#ifdef NEEDFORNX -/* - * _XScreenOfWindow - get the Screen of a given window - */ - -Screen *_XScreenOfWindow (Display *dpy, Window w) -{ - register int i; - Window root; - int x, y; /* dummy variables */ - unsigned int width, height, bw, depth; /* dummy variables */ - - if (XGetGeometry (dpy, w, &root, &x, &y, &width, &height, - &bw, &depth) == False) { - return None; - } - for (i = 0; i < ScreenCount (dpy); i++) { /* find root from list */ - if (root == RootWindow (dpy, i)) { - return ScreenOfDisplay (dpy, i); - } - } - return NULL; -} -#endif /* NEEDFORNX */ - -#if (MSKCNT > 4) -/* - * This is a macro if MSKCNT <= 4 - */ -int -N_XANYSET(unsigned long *src) -{ - int i; - - for (i=0; i<MSKCNT; i++) - if (src[ i ]) - return (1); - return (0); -} -#endif - -#ifdef NEEDFORNX -#ifdef CRAY -/* - * Cray UniCOS does not have readv and writev so we emulate - */ -#include <sys/socket.h> - -int _XReadV (int fd, struct iovec *iov, int iovcnt) -{ - struct msghdr hdr; - - hdr.msg_iov = iov; - hdr.msg_iovlen = iovcnt; - hdr.msg_accrights = 0; - hdr.msg_accrightslen = 0; - hdr.msg_name = 0; - hdr.msg_namelen = 0; - - return (recvmsg (fd, &hdr, 0)); -} - -int _XWriteV (int fd, struct iovec *iov, int iovcnt) -{ - struct msghdr hdr; - - hdr.msg_iov = iov; - hdr.msg_iovlen = iovcnt; - hdr.msg_accrights = 0; - hdr.msg_accrightslen = 0; - hdr.msg_name = 0; - hdr.msg_namelen = 0; - - return (sendmsg (fd, &hdr, 0)); -} - -#endif /* CRAY */ - -#if defined(SYSV) && defined(i386) && !defined(STREAMSCONN) -/* - * SYSV/386 does not have readv so we emulate - */ -#include <sys/uio.h> - -int _XReadV (int fd, struct iovec *iov, int iovcnt) -{ - int i, len, total; - char *base; - - errno = 0; - for (i=0, total=0; i<iovcnt; i++, iov++) { - len = iov->iov_len; - base = iov->iov_base; - while (len > 0) { - register int nbytes; - nbytes = read(fd, base, len); - if (nbytes < 0 && total == 0) return -1; - if (nbytes <= 0) return total; - errno = 0; - len -= nbytes; - total += nbytes; - base += nbytes; - } - } - return total; -} - -#endif /* SYSV && i386 && !STREAMSCONN */ - -#ifdef STREAMSCONN -/* - * Copyright 1988, 1989 AT&T, Inc. - * - * Permission to use, copy, modify, and distribute this software and its - * documentation for any purpose and without fee is hereby granted, provided - * that the above copyright notice appear in all copies and that both that - * copyright notice and this permission notice appear in supporting - * documentation, and that the name of AT&T not be used in advertising - * or publicity pertaining to distribution of the software without specific, - * written prior permission. AT&T makes no representations about the - * suitability of this software for any purpose. It is provided "as is" - * without express or implied warranty. - * - * AT&T DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL AT&T - * BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION - * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN - * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - * - */ - -/* - iovec.c (C source file) - Acc: 575557389 Mon Mar 28 08:03:09 1988 - Mod: 575557397 Mon Mar 28 08:03:17 1988 - Sta: 575557397 Mon Mar 28 08:03:17 1988 - Owner: 2011 - Group: 1985 - Permissions: 664 -*/ -/* - START USER STAMP AREA -*/ -/* - END USER STAMP AREA -*/ - - -extern char _XsTypeofStream[]; -extern Xstream _XsStream[]; - -#define MAX_WORKAREA 4096 -static char workarea[MAX_WORKAREA]; - - - -int -_XReadV (int fd, struct iovec v[], int n) -{ - int i, rc, len, size = 0; - char * buf = workarea; - char * p; - - if (n <= 0 || n > 16) - { - errno = EINVAL; - return (-1); - } - for (i = 0; i < n; ++i) - { - if ((len = v[i].iov_len) < 0 || v[i].iov_base == NULL) - { - errno = EINVAL; - return (-1); - } - size += len; - } - if ((size > MAX_WORKAREA) && ((buf = malloc (size)) == NULL)) - { - errno = EINVAL; - return (-1); - } - if((rc = (*_XsStream[_XsTypeOfStream[fd]].ReadFromStream)(fd, buf, size, - BUFFERING))> 0) - { - for (i = 0, p = buf; i < n; ++i) - { - memcpy (v[i].iov_base, p, len = v[i].iov_len); - p += len; - } - } - if (size > MAX_WORKAREA) - free (buf); - - return (rc); -} - -int -_XWriteV (int fd, struct iovec v[], int n) -{ - int i, rc, len, size = 0; - char * buf = workarea; - char * p; - - if (n <= 0 || n > 16) - { - errno = EINVAL; - return (-1); - } - for (i = 0; i < n; ++i) - { - if ((len = v[i].iov_len) < 0 || v[i].iov_base == NULL) - { - errno = EINVAL; - return (-1); - } - size += len; - } - - if ((size > MAX_WORKAREA) && ((buf = malloc (size)) == NULL)) - { - errno = EINVAL; - return (-1); - } - for (i = 0, p = buf; i < n; ++i) - { - memcpy (p, v[i].iov_base, len = v[i].iov_len); - p += len; - } - rc = (*_XsStream[_XsTypeOfStream[fd]].WriteToStream)(fd, buf, size); - - if (size > MAX_WORKAREA) - free (buf); - - return (rc); -} - - - -#endif /* STREAMSCONN */ -#endif /* NEEDFORNX */ diff --git a/nx-X11/lib/dps/cslibint.h b/nx-X11/lib/dps/cslibint.h deleted file mode 100644 index b16770504..000000000 --- a/nx-X11/lib/dps/cslibint.h +++ /dev/null @@ -1,302 +0,0 @@ -/* - * cslibint.h -- low level I/O - * - * (c) Copyright 1993-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 - * - * Portions Copyright 1984, 1985, 1987, 1989 Massachusetts Institute of - * Technology - * Permission to use, copy, modify, distribute, and sell this software and its - * documentation for any purpose is hereby granted without fee, provided that - * the above copyright notice appear in all copies and that both that - * copyright notice and this permission notice appear in supporting - * documentation, and that the name of M.I.T. not be used in advertising or - * publicity pertaining to distribution of the software without specific, - * written prior permission. M.I.T. makes no representations about the - * suitability of this software for any purpose. It is provided "as is" - * without express or implied warranty. - * - * Author: Adobe Systems Incorporated and MIT X Consortium - */ -/* $XFree86: xc/lib/dps/cslibint.h,v 1.3 2001/06/30 22:41:44 tsi Exp $ */ - -/* - * XlibInternal.h - Header definition and support file for the internal - * support routines (XlibInternal) used by the C subroutine interface - * library (Xlib) to the X Window System. - * - * Warning, there be dragons here.... - */ - -#ifndef _CSLIBINT_H -#define _CSLIBINT_H - -#include <X11/Xlibint.h> -#include <X11/Xutil.h> - -/* For SYSV, no gethostname, so fake it */ -#include <sys/param.h> -#if defined(__SCO__) -/* SCO systems define MAXHOSTNAMELEN here */ -#include <sys/socket.h> -#endif - -#ifndef MAXHOSTNAMELEN -#define MAXHOSTNAMELEN 64 -#endif - - -/* === MACROS === */ - -/* - * GetReq - Get the next avilable X request packet in the buffer and - * return it. - * - * "name" is the name of the request, e.g. CreatePixmap, OpenFont, etc. - * "req" is the name of the request pointer. - * - */ - -#if !defined(UNIXCPP) -#define NXMacroGetReq(name, req) \ - WORD64ALIGN\ - if ((dpy->bufptr + SIZEOF(x##name##Req)) > dpy->bufmax)\ - {if (dpy != xdpy) N_XFlush(dpy); else _XFlush(dpy);}\ - req = (x##name##Req *)(dpy->last_req = dpy->bufptr);\ - req->reqType = X_##name;\ - req->length = (SIZEOF(x##name##Req))>>2;\ - dpy->bufptr += SIZEOF(x##name##Req);\ - dpy->request++ - -#else /* non-ANSI C uses empty comment instead of "##" for token concatenation */ -#define NXMacroGetReq(name, req) \ - WORD64ALIGN\ - if ((dpy->bufptr + SIZEOF(x/**/name/**/Req)) > dpy->bufmax)\ - {if (dpy != xdpy) N_XFlush(dpy); else _XFlush(dpy);}\ - req = (x/**/name/**/Req *)(dpy->last_req = dpy->bufptr);\ - req->reqType = X_/**/name;\ - req->length = (SIZEOF(x/**/name/**/Req))>>2;\ - dpy->bufptr += SIZEOF(x/**/name/**/Req);\ - dpy->request++ -#endif - -#ifdef NEEDFORNX - -/* GetReqExtra is the same as GetReq, but allocates "n" additional - bytes after the request. "n" must be a multiple of 4! */ - -#if !defined(UNIXCPP) -#define GetReqExtra(name, n, req) \ - WORD64ALIGN\ - if ((dpy->bufptr + SIZEOF(x##name##Req) + n) > dpy->bufmax)\ - _XFlush(dpy);\ - req = (x##name##Req *)(dpy->last_req = dpy->bufptr);\ - req->reqType = X_##name;\ - req->length = (SIZEOF(x##name##Req) + n)>>2;\ - dpy->bufptr += SIZEOF(x##name##Req) + n;\ - dpy->request++ -#else -#define GetReqExtra(name, n, req) \ - WORD64ALIGN\ - if ((dpy->bufptr + SIZEOF(x/**/name/**/Req) + n) > dpy->bufmax)\ - _XFlush(dpy);\ - req = (x/**/name/**/Req *)(dpy->last_req = dpy->bufptr);\ - req->reqType = X_/**/name;\ - req->length = (SIZEOF(x/**/name/**/Req) + n)>>2;\ - dpy->bufptr += SIZEOF(x/**/name/**/Req) + n;\ - dpy->request++ -#endif - - -/* - * GetResReq is for those requests that have a resource ID - * (Window, Pixmap, GContext, etc.) as their single argument. - * "rid" is the name of the resource. - */ - -#if !defined(UNIXCPP) -#define GetResReq(name, rid, req) \ - WORD64ALIGN\ - if ((dpy->bufptr + SIZEOF(xResourceReq)) > dpy->bufmax)\ - _XFlush(dpy);\ - req = (xResourceReq *) (dpy->last_req = dpy->bufptr);\ - req->reqType = X_##name;\ - req->length = 2;\ - req->id = (rid);\ - dpy->bufptr += SIZEOF(xResourceReq);\ - dpy->request++ -#else -#define GetResReq(name, rid, req) \ - WORD64ALIGN\ - if ((dpy->bufptr + SIZEOF(xResourceReq)) > dpy->bufmax)\ - _XFlush(dpy);\ - req = (xResourceReq *) (dpy->last_req = dpy->bufptr);\ - req->reqType = X_/**/name;\ - req->length = 2;\ - req->id = (rid);\ - dpy->bufptr += SIZEOF(xResourceReq);\ - dpy->request++ -#endif - -/* - * GetEmptyReq is for those requests that have no arguments - * at all. - */ -#if !defined(UNIXCPP) -#define GetEmptyReq(name, req) \ - WORD64ALIGN\ - if ((dpy->bufptr + SIZEOF(xReq)) > dpy->bufmax)\ - _XFlush(dpy);\ - req = (xReq *) (dpy->last_req = dpy->bufptr);\ - req->reqType = X_##name;\ - req->length = 1;\ - dpy->bufptr += SIZEOF(xReq);\ - dpy->request++ -#else -#define GetEmptyReq(name, req) \ - WORD64ALIGN\ - if ((dpy->bufptr + SIZEOF(xReq)) > dpy->bufmax)\ - _XFlush(dpy);\ - req = (xReq *) (dpy->last_req = dpy->bufptr);\ - req->reqType = X_/**/name;\ - req->length = 1;\ - dpy->bufptr += SIZEOF(xReq);\ - dpy->request++ -#endif - - -#define SyncHandle() \ - if (dpy->synchandler) (*dpy->synchandler)(dpy) - -#define FlushGC(dpy, gc) \ - if ((gc)->dirty) _XFlushGCCache((dpy), (gc)) -/* - * Data - Place data in the buffer and pad the end to provide - * 32 bit word alignment. Transmit if the buffer fills. - * - * "dpy" is a pointer to a Display. - * "data" is a pinter to a data buffer. - * "len" is the length of the data buffer. - * we can presume buffer less than 2^16 bytes, so bcopy can be used safely. - */ -#ifndef DataRoutineIsProcedure -#define Data(dpy, data, len) \ - if (dpy->bufptr + (len) <= dpy->bufmax) {\ - bcopy(data, dpy->bufptr, (int)len);\ - dpy->bufptr += ((len) + 3) & ~3;\ - } else\ - _XSend(dpy, data, len) -#endif /* DataRoutineIsProcedure */ - - -/* Allocate bytes from the buffer. No padding is done, so if - * the length is not a multiple of 4, the caller must be - * careful to leave the buffer aligned after sending the - * current request. - * - * "type" is the type of the pointer being assigned to. - * "ptr" is the pointer being assigned to. - * "n" is the number of bytes to allocate. - * - * Example: - * xTextElt *elt; - * BufAlloc (xTextElt *, elt, nbytes) - */ - -#define BufAlloc(type, ptr, n) \ - if (dpy->bufptr + (n) > dpy->bufmax) \ - _XFlush (dpy); \ - ptr = (type) dpy->bufptr; \ - dpy->bufptr += (n); - -/* - * provide emulation routines for smaller architectures - */ -#ifndef WORD64 -#define Data16(dpy, data, len) Data((dpy), (char *)(data), (len)) -#define Data32(dpy, data, len) Data((dpy), (char *)(data), (len)) -#define _XRead16Pad(dpy, data, len) _XReadPad((dpy), (char *)(data), (len)) -#define _XRead16(dpy, data, len) _XRead((dpy), (char *)(data), (len)) -#define _XRead32(dpy, data, len) _XRead((dpy), (char *)(data), (len)) -#endif /* not WORD64 */ - -#define PackData16(dpy,data,len) Data16 (dpy, data, len) -#define PackData32(dpy,data,len) Data32 (dpy, data, len) - -/* Xlib manual is bogus */ -#define PackData(dpy,data,len) PackData16 (dpy, data, len) - - - -#endif /* NEEDFORNX */ - -#if !defined(STARTITERATE) && !defined(WORD64) - -#define STARTITERATE(tpvar,type,start,endcond,decr) \ - for (tpvar = (type *) start; endcond; tpvar++, decr) { -#define ENDITERATE } - -#endif /* STARTITERATE */ - - -#ifndef WORD64 -#undef Data32 -#define Data32(dpy, data, len) NXProcData((dpy), (char *)(data), (len)) -#endif /* not WORD64 */ - -extern int gNXSyncGCMode; - -/* extension hooks */ - -extern Bool N_XUnknownWireEvent(Display *, XEvent *, xEvent *); -extern Status N_XReply(Display *, xReply *, int, Bool); -extern Status N_XUnknownNativeEvent(Display *, XEvent *, xEvent *); -extern int DPSCAPConnect( char *, char **, int *, int *, int *, char **); -extern int N_XDisconnectDisplay(int); -extern int N_XGetHostname (char *, int); -extern int N_XRead(Display*, char *, long); -extern void NXProcData (Display *, char *, long); -extern void N_XFlush(Display *); -extern void N_XReadPad(Display*, char *, long); -extern void N_XSend(Display *, _Xconst char *, long); -extern void N_XWaitForReadable(Display *); -extern void N_XWaitForWritable(Display *); - -extern void XDPSGetDefaultColorMaps( - Display *dpy, - Screen *screen, - Drawable drawable, - XStandardColormap *colorCube, - XStandardColormap *grayRamp); - -#endif /* _CSLIBINT_H */ - diff --git a/nx-X11/lib/dps/csopendi.c b/nx-X11/lib/dps/csopendi.c deleted file mode 100644 index c0eb1d373..000000000 --- a/nx-X11/lib/dps/csopendi.c +++ /dev/null @@ -1,567 +0,0 @@ -/* - * csopendi.c -- open connection to CSDPS agent - * - * (c) Copyright 1990-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 - * - * Portions Copyright Massachusetts Institute of Technology 1985, 1986 - * Permission to use, copy, modify, distribute, and sell this software and its - * documentation for any purpose is hereby granted without fee, provided that - * the above copyright notice appear in all copies and that both that - * copyright notice and this permission notice appear in supporting - * documentation, and that the name of M.I.T. not be used in advertising or - * publicity pertaining to distribution of the software without specific, - * written prior permission. M.I.T. makes no representations about the - * suitability of this software for any purpose. It is provided "as is" - * without express or implied warranty. - * - * Author: Adobe Systems Incorporated and MIT X Consortium - */ -/* $XFree86$ */ - -#include <stdlib.h> -#include <stdio.h> -#include <sys/param.h> /* for MAXHOSTNAMELEN */ -#define NEED_EVENTS -#include <X11/Xlibint.h> -#include <X11/Xos.h> -#include "cslibint.h" -#ifdef XXX -#include <X11/Xauth.h> -#include <X11/Xatom.h> - -extern int _Xdebug; -extern Display *_XHeadOfDisplayList; - -#ifndef lint -static int lock; /* get rid of ifdefs when locking implemented */ -#endif - -#endif /* XXX */ - -#include <X11/X.h> -#include <X11/Xproto.h> - -#include "DPSCAPClient.h" -#include <DPS/dpsXclient.h> -#include <DPS/dpsNXargs.h> -#include "dpsassert.h" -#include "dpsNXprops.h" -#include "csfindNX.h" -#include "csstartNX.h" - -#ifdef DPSLNKL -#include "dpslnkl.inc" -#endif /* DPSLNKL */ - - -/* +++ Someday make this common with XDPS.c version */ -#define DPY_NUMBER(dpy) ((dpy)->fd) - -static xReq _dummy_request = { - 0, 0, 0 -}; - -static void OutOfMemory (Display *); - -#ifdef XXX -/* - * First, a routine for setting authorization data - */ -static int xauth_namelen = 0; -static char *xauth_name = NULL; /* NULL means use default mechanism */ -static int xauth_datalen = 0; -static char *xauth_data = NULL; /* NULL means get default data */ - -void XSetAuthorization (char *name, int namelen, char *data, int datalen) -{ - char *tmpname, *tmpdata; - - if (xauth_name) Xfree (xauth_name); /* free any existing data */ - if (xauth_data) Xfree (xauth_data); - - xauth_name = xauth_data = NULL; /* mark it no longer valid */ - xauth_namelen = xauth_datalen = 0; - - if (namelen < 0) namelen = 0; /* check for bogus inputs */ - if (datalen < 0) datalen = 0; /* maybe should return? */ - - if (namelen > 0) { /* try to allocate space */ - tmpname = Xmalloc ((unsigned) namelen); - if (!tmpname) return; - bcopy (name, tmpname, namelen); - } else { - tmpname = NULL; - } - - if (datalen > 0) { - tmpdata = Xmalloc ((unsigned) datalen); - if (!tmpdata) { - if (tmpname) (void) Xfree (tmpname); - return; - } - bcopy (data, tmpdata, datalen); - } else { - tmpdata = NULL; - } - - xauth_name = tmpname; /* and store the suckers */ - xauth_namelen = namelen; - xauth_data = tmpdata; - xauth_datalen = datalen; - return; -} - -#endif /* XXX */ - -/* - * Connects to a server, creates a Display object and returns a pointer to - * the newly created Display back to the caller. - */ -XExtData * -DPSCAPOpenAgent(Display *dpy, char *trueDisplayName) -{ - register Display *agent; - char *agentHost = (char *)NULL; - register int i; - char display_name[256]; /* pointer to display name */ - char licMethBuf[256]; - char *licMeth = licMethBuf; - char *fullname = NULL; - int idisplay; - char *server_addr = NULL; - int server_addrlen = 0; - int conn_family; - int transport, port; - XExtData *ext; - DPSCAPData my; - char hostname[MAXHOSTNAMELEN]; - -/* - * Find an agent to talk to. - */ -#ifdef DPSLNKL - extern unsigned ANXPFunc(); -#ifdef PSUSEPN - (void) sprintf(licMeth, "%s%s:%d", - LICENSE_METHOD_PREFIX, - ANXVENDOR, /* From dpslnkl.inc */ - ANXPFunc()); -#else /* PSUSEPN */ - (void) sprintf(licMeth, "%s%s", - LICENSE_METHOD_PREFIX, - ANXVENDOR); /* From dpslnkl.inc */ -#endif /* PSUSEPN */ -#else /* DPSLNKL */ - licMeth = NULL; /* We want an open service */ -#endif /* DPSLNKL */ - (void) N_XGetHostname(hostname, MAXHOSTNAMELEN); - switch(XDPSNXFindNX(dpy, licMeth, &agentHost, &transport, &port)) { - case findnx_not_found: { - /* try to start-up an NX? */ - Bool autoLaunch; - - XDPSGetNXArg(XDPSNX_AUTO_LAUNCH, (void **) &autoLaunch); - if (autoLaunch == True) { - int requestedTrans; - int requestedPort = 0; - char **args = NULL; - char *additionalArgs[2]; - char transportArg[256]; - - (void) DPSWarnProc(NULL, "Auto-launching DPS NX agent."); - XDPSGetNXArg(XDPSNX_LAUNCHED_AGENT_TRANS, (void **) &requestedTrans); - if (requestedTrans == XDPSNX_USE_BEST) { - XDPSNXSetClientArg(XDPSNX_LAUNCHED_AGENT_TRANS, - (void *)XDPSNX_TRANS_UNIX); - requestedTrans = XDPSNX_TRANS_UNIX; - } - /* cons-up an arg. to pass to Agent we are forking */ - - additionalArgs[1] = (char *) NULL; - additionalArgs[0] = transportArg; - XDPSGetNXArg(XDPSNX_LAUNCHED_AGENT_PORT, (void **) &requestedPort); - if (requestedPort == XDPSNX_USE_BEST) { - requestedPort = XDPSNXRecommendPort(requestedTrans); - if (requestedPort < 0) { - DPSWarnProc(NULL, "Auto-launcher can't get a port."); - return(NULL); - } - } - (void) sprintf(transportArg, "%s/%d", - (requestedTrans == XDPSNX_TRANS_DECNET ? - "dec" : "tcp"), - requestedPort); - args = additionalArgs; - /* ASSERT: first argument in additionalArgs must be - transport/port, unless agent changes to take this - anywhere */ - if (StartXDPSNX(args) != Success) { - char tb[256], *fs, **as; - (void) XDPSGetNXArg(XDPSNX_EXEC_FILE, (void **) &fs); - (void) XDPSGetNXArg(XDPSNX_EXEC_ARGS, (void **) &as); - (void) sprintf(tb, "FAILED to auto-launch:\n %s", fs); - if (as != NULL) - for (; *as != NULL; as++) { - if ((int) (strlen(*as) + 1 + (i = strlen(tb))) > 256-1) { - if (i > 256-1-4) - strcpy(&(tb[256-1-1-4]), " ..."); - else - strcat(tb, " ..."); - break; - } - (void) strcat(tb, " "); - (void) strcat(tb, *as); - } - DPSWarnProc(NULL, tb); - return(NULL); - } else { - (void) sprintf(display_name, "%s%s%d", hostname, - (requestedTrans == XDPSNX_TRANS_DECNET ? - "::" : ":"), - requestedPort); - } - } else { /* autoLaunch != True */ - return(NULL); - } - } - break; - case findnx_found: { /* XDPSNXFindNX() == Success */ - (void) sprintf(display_name, "%s%s%d", - (transport == XDPSNX_TRANS_UNIX ? - "unix" : agentHost), - (transport == XDPSNX_TRANS_DECNET ? "::" : ":"), - port); - /* Free agentHost later */ - } - break; - case findnx_error: - return(NULL); - break; - default: - DPSFatalProc(NULL, "Illegal value returned by XDPSNXFindNX"); - break; - } - - -/* - * Attempt to allocate a display structure. Return NULL if allocation fails. - */ - if ((agent = (Display *)Xcalloc(1, sizeof(Display))) == NULL) { - return(NULL); - } - -/* - * Call the Connect routine to get the network socket. If -1 is returned, the - * connection failed. The connect routine will set fullname to point to the - * expanded name. - */ - - if ((agent->fd = DPSCAPConnect(display_name, &fullname, &idisplay, - &conn_family, - &server_addrlen, &server_addr)) < 0) { - Xfree ((char *) agent); - return(NULL); - } -#ifdef XXX -/* - * Look up the authorization protocol name and data if necessary. - */ - if (xauth_name && xauth_data) { - conn_auth_namelen = xauth_namelen; - conn_auth_name = xauth_name; - conn_auth_datalen = xauth_datalen; - conn_auth_data = xauth_data; - } else { - char dpynumbuf[40]; /* big enough to hold 2^64 and more */ - (void) sprintf (dpynumbuf, "%d", idisplay); - - authptr = XauGetAuthByAddr ((unsigned short) conn_family, - (unsigned short) server_addrlen, - server_addr, - (unsigned short) strlen (dpynumbuf), - dpynumbuf, - (unsigned short) xauth_namelen, - xauth_name); - if (authptr) { - conn_auth_namelen = authptr->name_length; - conn_auth_name = (char *)authptr->name; - conn_auth_datalen = authptr->data_length; - conn_auth_data = (char *)authptr->data; - } else { - conn_auth_namelen = 0; - conn_auth_name = NULL; - conn_auth_datalen = 0; - conn_auth_data = NULL; - } - } -#ifdef HASDES - /* - * build XDM-AUTHORIZATION-1 data - */ - if (conn_auth_namelen == 19 && - !strncmp (conn_auth_name, "XDM-AUTHORIZATION-1", 19)) - { - static char encrypted_data[192/8]; - int i, j; - struct sockaddr_in in_addr; - int addrlen; - long now; - - j = 0; - for (i = 0; i < 8; i++) - { - encrypted_data[j] = conn_auth_data[i]; - j++; - } - addrlen = sizeof (in_addr); - getsockname (dpy->fd, (struct sockaddr *) &in_addr, &addrlen); - if (in_addr.sin_family == 2) - { - encrypted_data[j] = in_addr.sin_addr.s_net; j++; - encrypted_data[j] = in_addr.sin_addr.s_host; j++; - encrypted_data[j] = in_addr.sin_addr.s_lh; j++; - encrypted_data[j] = in_addr.sin_addr.s_impno; j++; - encrypted_data[j] = (in_addr.sin_port >> 8) & 0xff; j++; - encrypted_data[j] = (in_addr.sin_port) & 0xff; j++; - } - else - { - encrypted_data[j] = 0xff; j++; - encrypted_data[j] = 0xff; j++; - encrypted_data[j] = 0xff; j++; - encrypted_data[j] = 0xff; j++; - i = getpid (); - encrypted_data[j] = (i >> 8) & 0xff; j++; - encrypted_data[j] = (i) & 0xff; j++; - } - time (&now); - for (i = 3; i >= 0; i--) - { - encrypted_data[j] = (now >> (i * 8)) & 0xff; - j++; - } - XdmcpEncrypt (encrypted_data, conn_auth_data + 8, - encrypted_data, 192/8); - conn_auth_data = encrypted_data; - conn_auth_datalen = 192 / 8; - } -#endif /* HASDES */ - if (server_addr) (void) Xfree (server_addr); - -#endif /* XXX */ - -/* - * We succeeded at authorization, so let us move the data into - * the display structure. - */ - agent->lock_meaning = NoSymbol; -#ifdef XXX - /* this field is not present in post X11R5 */ - agent->current = None; -#endif - agent->event_vec[X_Error] = N_XUnknownWireEvent; - agent->event_vec[X_Reply] = N_XUnknownWireEvent; - agent->wire_vec[X_Error] = N_XUnknownNativeEvent; - agent->wire_vec[X_Reply] = N_XUnknownNativeEvent; - for (i = KeyPress; i < 128; i++) { - agent->event_vec[i] = N_XUnknownWireEvent; - agent->wire_vec[i] = N_XUnknownNativeEvent; - } - agent->cursor_font = None; - agent->last_req = (char *)&_dummy_request; - - /* Salt away the host:display string for later use. - Storage owned by agent, Xmalloc'd by connection - call above */ - agent->display_name = fullname; - - /* Set up the output buffers. */ - if ((agent->bufptr = agent->buffer = Xmalloc(BUFSIZE)) == NULL) { - OutOfMemory (dpy); - return(NULL); - } - agent->bufmax = agent->buffer + BUFSIZE; - - - /* Create extension data */ - - my = DPSCAPCreate(dpy, agent); - if (my == (DPSCAPData)NULL) - { - OutOfMemory(agent); - return(NULL); - } - ext = (XExtData *)Xcalloc(1, sizeof(XExtData)); - ext->private_data = (char *)my; - - /* Parse names to get true display name */ - if (agentHost && strcmp(hostname, agentHost)) - { - register char *s, *p; - char *dxname; - char nametmp[MAXHOSTNAMELEN]; - /* Agent is not on the same host as client, so fix - up the stupid abbreviations used for the display, - and whoever came up with the syntax should be shot. */ - dxname = DisplayString(dpy); - for (s = dxname, p = nametmp; *s; ++s) - if (*s == ':') - break; - else - *p++ = *s; - *p = '\0'; - if (nametmp[0] == '\0' - || !strcmp(nametmp, "unix") - || !strcmp(nametmp, "localhost")) - { - strcpy(trueDisplayName, hostname); - if (*s) - strcat(trueDisplayName, s); - else - strcat(trueDisplayName, ":0.0"); - } - else - strcpy(trueDisplayName, dxname); - } - else - strcpy(trueDisplayName, DisplayString(dpy)); - if (agentHost) - Xfree(agentHost); - return(ext); -} - - -/* OutOfMemory is called if malloc fails. XOpenDisplay returns NULL - after this returns. */ - -static void OutOfMemory (Display *dpy) -{ - DPSCAPCloseAgent(dpy); -} - -#ifdef NEEDFORNX -/* XFreeDisplayStructure frees all the storage associated with a - * Display. It is used by XOpenDisplay if it runs out of memory, - * and also by XCloseDisplay. It needs to check whether all pointers - * are non-NULL before dereferencing them, since it may be called - * by XOpenDisplay before the Display structure is fully formed. - * XOpenDisplay must be sure to initialize all the pointers to NULL - * before the first possible call on this. - */ - -static void -_XFreeDisplayStructure(register Display *dpy) -{ - if (dpy->screens) { - register int i; - - for (i = 0; i < dpy->nscreens; i++) { - Screen *sp = &dpy->screens[i]; - - if (sp->depths) { - register int j; - - for (j = 0; j < sp->ndepths; j++) { - Depth *dp = &sp->depths[j]; - - if (dp->visuals) { - register int k; - - for (k = 0; k < dp->nvisuals; k++) - _XFreeExtData (dp->visuals[k].ext_data); - Xfree ((char *) dp->visuals); - } - } - - Xfree ((char *) sp->depths); - } - - _XFreeExtData (sp->ext_data); - } - - Xfree ((char *)dpy->screens); - } - - if (dpy->pixmap_format) { - register int i; - - for (i = 0; i < dpy->nformats; i++) - _XFreeExtData (dpy->pixmap_format[i].ext_data); - Xfree ((char *)dpy->pixmap_format); - } - - if (dpy->display_name) - Xfree (dpy->display_name); - if (dpy->vendor) - Xfree (dpy->vendor); - - if (dpy->buffer) - Xfree (dpy->buffer); - if (dpy->atoms) - Xfree ((char *) dpy->atoms); - if (dpy->keysyms) - Xfree ((char *) dpy->keysyms); - if (dpy->modifiermap) - XFreeModifiermap(dpy->modifiermap); - if (dpy->xdefaults) - Xfree (dpy->xdefaults); - if (dpy->key_bindings) - _XFreeKeyBindings(dpy); - - while (dpy->ext_procs) { - _XExtension *ext = dpy->ext_procs; - dpy->ext_procs = ext->next; - if (ext->name) - Xfree (ext->name); - Xfree ((char *)ext); - } - - _XFreeExtData (dpy->ext_data); - - Xfree ((char *)dpy); -} -#endif /* NEEDFORNX */ - - - -void -DPSCAPCloseAgent(Display *agent) -{ - if (!agent) return; - N_XDisconnectDisplay(agent->fd); - if (agent->display_name) - Xfree(agent->display_name); - if (agent->buffer) - Xfree(agent->buffer); - Xfree((char *)agent); -} diff --git a/nx-X11/lib/dps/csstartNX.c b/nx-X11/lib/dps/csstartNX.c deleted file mode 100644 index 0db2cbe5b..000000000 --- a/nx-X11/lib/dps/csstartNX.c +++ /dev/null @@ -1,237 +0,0 @@ -/* - csstartNX.c - - * (c) Copyright 1992-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/csstartNX.c,v 1.6 2001/10/28 03:32:43 tsi Exp $ */ - -#include <sys/param.h> -#include <X11/X.h> -#include <X11/Xlibint.h> -#include <sys/wait.h> -#include <DPS/dpsNXargs.h> -#include <sys/socket.h> -#include <errno.h> -#include <X11/Xos.h> - -#include "DPSCAPproto.h" -#include "Xlibnet.h" /* New for R5, delete for R4 */ -#include "dpsassert.h" -#include "csfindNX.h" -#include "csstartNX.h" - -/* ---Defines--- */ - -#include <stddef.h> - -#define DOZETIME 1 /* time to wait for agent to start up (sec) */ - -#define BASE_TCP_PORT CSDPSPORT - -#ifndef CSDPSMAXPORT -#define CSDPSMAXPORT 16 -#endif - -#ifndef SO_REUSEADDR -#define SO_REUSEADDR 1 -#endif - -/* ---Globals--- */ - -pid_t gSecretAgentPID = 0; /* PID of launched agent *Shh!* Not public! */ - -/* ---Private Functions--- */ - -static int -TryTCP(void) -{ - struct sockaddr_in insock; - int request; - unsigned short port, startPort = 0; - struct servent *serventInfo; - int okay; - -#ifndef ultrix - /* Ultrix has a nasty bug in getservbyname(). If the name passed - to it doesn't exist in the services list it will seg. fault... - * sigh * */ - if ((serventInfo = getservbyname(DPS_NX_SERV_NAME, - (char *) 0)) != 0) - if (strcmp("tcp", serventInfo->s_proto) == 0) { - startPort = ntohs(serventInfo->s_port); - } - /* So, for Ultrix we just default to the default default port :-) */ -#endif /* ultrix */ - if (startPort == 0) startPort = BASE_TCP_PORT; - if ((request = socket (AF_INET, SOCK_STREAM, 0)) < 0) - { - DPSWarnProc(NULL, "Creating TCP socket while recommending port\n"); - return -1; - } -#ifdef SO_REUSEADDR - /* Necesary to restart the server without a reboot */ - { - int one = 1; - setsockopt(request, SOL_SOCKET, SO_REUSEADDR, (char *)&one, sizeof(int)); - } - /* What the hell is all this? I'll tell you. We don't know - a prioi what port is free, so we try to bind to each - in sequence and return the one that works. */ -#if !defined(AIXV3) - { - struct linger lingere; - - lingere.l_onoff = 0; /* off */ - lingere.l_linger = 0; /* don't */ - if(setsockopt(request, SOL_SOCKET, SO_LINGER, (char *)&lingere, - sizeof(struct linger)) != 0) - DPSWarnProc(NULL, - "Couldn't set TCP SO_DONTLINGER while recommending port."); - } -#endif /* AIXV3 */ -#endif /* SO_REUSEADDR */ - bzero((char *)&insock, sizeof (insock)); - insock.sin_family = AF_INET; - insock.sin_addr.s_addr = htonl(INADDR_ANY); - okay = 0; - - for (port = startPort; (int) port < (int) startPort + CSDPSMAXPORT; port++) - { - int result; - insock.sin_port = htons(port); - - errno = 0; - result = bind(request, (struct sockaddr *) &insock, sizeof (insock)); - if (result < 0) - { - if (errno != EADDRINUSE) - { - DPSWarnProc(NULL, "Binding TCP socket while recommending port.\n"); - close(request); - return -1; - } - continue; - } - else - { - /* We have a good port number */ - okay = 1; - break; - } - } - close(request); - return (okay) ? port : -1; -} - -/* ---Functions--- */ - -int -XDPSNXRecommendPort(int transport) -{ - int ret; - - switch (transport) - { - case XDPSNX_TRANS_UNIX: - /* If the TCP socket exists, we just assume the UNIX one - is there too. FALL THRU! */ - case XDPSNX_TRANS_TCP: /* TCP */ - ret = TryTCP(); - break; - default: ret = -1; - } - return(ret); -} - -int -StartXDPSNX(char **additionalArgs) -{ - char **args, **cpp; - pid_t childPid; - int argc = 1; /* 1, args[0]:=path, args[1]:=null */ - int i = 0; - int status = Success; /* assume we'll succeed */ - char *execObj, **execArgs; - - (void) XDPSGetNXArg(XDPSNX_EXEC_FILE, (void **) &execObj); - if (execObj == 0) return (!Success); - - /* Create the argv list for the execl() call */ - (void) XDPSGetNXArg(XDPSNX_EXEC_ARGS, (void **) &execArgs); - if (execArgs != 0) - for(cpp = execArgs; *cpp != 0; cpp++, argc++); /* count args. */ - if (additionalArgs != 0) /* add on the add-on args. */ - for(cpp = additionalArgs; *cpp != 0; cpp++, argc++); - - args = (char **) Xmalloc(sizeof(char *) * (argc+1)); - if (args == 0) - return(!Success); - args[argc] = 0; /* cap end of args */ - args[i++] = execObj; - if (additionalArgs != 0) - for(cpp = additionalArgs; *cpp != 0; cpp++, i++) args[i] = *cpp; - if (execArgs != 0) - for(cpp = execArgs; *cpp != 0; cpp++, i++) args[i] = *cpp; - - /* now try to start up the agent... */ - if ((childPid = fork()) != -1) { - if (childPid == 0) { /* Child process */ -#ifndef __UNIXOS2__ - if (setsid() < 0) - DPSWarnProc(NULL, "Agent unable to create session. Continuing...\n"); -#endif - - /* Try to start the agent */ - if (execvp(args[0], args) < 0) { /* Error!! */ - exit(1); /* This is OKAY, we're the child here */ - } - /* SHOULD NEVER REACH HERE */ - } else { /* Parent (NX Client) */ - (void) sleep(DOZETIME); - /* if decmips, pray that we hesitate long enough for the child... */ - /* Check on child (NX Agent) */ - if (waitpid(childPid, NULL, WNOHANG) != 0) { - /* Server terminated or stopped; don't care, result is same... */ - status = !Success; - } else { /* we think the agent started okay */ - gSecretAgentPID = childPid; /* set secret global */ - } - } - } else { /* Error in fork */ - status = !Success; - } - if (args != 0) (void) XFree(args); - return(status); -} diff --git a/nx-X11/lib/dps/csstartNX.h b/nx-X11/lib/dps/csstartNX.h deleted file mode 100644 index 5e80e60aa..000000000 --- a/nx-X11/lib/dps/csstartNX.h +++ /dev/null @@ -1,67 +0,0 @@ -/* - * csstartNX.h -- handles fork()/execl() for starting DPSNX from dps lib - * - * (c) Copyright 1992-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 - */ - -#ifndef CSSTARTNX_H -#define CSSTARTNX_H - -#include <X11/Xlib.h> - -/* ---Globals--- */ - -extern Bool gStartXDPSNXIsPresent; - /* - * Indicates whether the function "StartXDPSNX" is live or just - * a stubbed out version. - */ - -/* ---Functions--- */ - -extern int StartXDPSNX (char **additionalArgs); - /* - * StartXDPSNX attempts to fork and exec the object file specified by - * the DPSSetNXArg argument "DPSNXEXEC". It passes as arguments to the - * object file the DPSSetNXArg argument "DPSNXEXECARGS" with the - * additionalArgs (if there are any) appended. - * RETURNS: - * StartXDPSNX will return Success if it believes that the child has - * started correctly. Otherwise it returns !Success - */ - -extern int XDPSNXRecommendPort(int transport); - -#endif /* CSSTARTNX_H */ diff --git a/nx-X11/lib/dps/dps-def.cpp b/nx-X11/lib/dps/dps-def.cpp deleted file mode 100644 index d88841d66..000000000 --- a/nx-X11/lib/dps/dps-def.cpp +++ /dev/null @@ -1,991 +0,0 @@ -LIBRARY Dps -VERSION LIBRARY_VERSION -EXPORTS -DPSAddContextExtensionRec -DPSAwaitReturnValues -DPSBinObjSeqWrite -DPSChainContext -DPSCheckInitClientGlobals -DPSCheckRaiseError -DPSCreateContext -DPSCreateTextContext -DPSDefaultErrorProc -DPSDestroyContext -DPSDestroySpace -DPSFlushContext -DPSGenerateExtensionRecID -DPSGetContextExtensionRec -DPSGetContextType -DPSGetCurrentContext -DPSGetCurrentErrorBackstop -DPSGetCurrentTextBackstop -DPSInitCommonContextProcs -DPSInitCommonSpaceProcs -DPSInitCommonTextContextProcs -DPSInitialize -DPSInterruptContext -DPSKnownContext -DPSKnownSpace -DPSMapNames -DPSNameFromIndex -DPSPrivCurrentContext -DPSRemoveContextExtensionRec -DPSResetContext -DPSSafeSetLastNameIndex -DPSSetAbbrevMode -DPSSetContext -DPSSetErrorBackstop -DPSSetNumStringConversion -DPSSetResultTable -DPSSetTextBackstop -DPSSetWh -DPSSetWrapSynchronization -DPSSuppressBinaryConversion -DPSUnchainContext -DPSUpdateNameMap -DPSWaitContext -DPSWriteData -DPSWriteNumString -DPSWritePostScript -DPSWriteStringChars -DPSWriteTypedObjectArray -DPScalloc -DPSclientPrintProc -DPSPrintf -DPSRaise -DPSCreatePSWDict -DPSDestroyPSWDict -DPSMakeAtom -DPSWDictEnter -DPSWDictLookup -DPSWDictRemove -DPSFetchAbbrevList -DPSGetOperatorAbbrev -DPSGetSysnameAbbrev -DPSCantHappen -DPSChangeEncoding -DPSCheckShared -DPSContextFromContextID -DPSDefaultPrivateHandler -DPSFatalProc -DPSHandleBogusError -DPSInitPrivateContextFields -DPSInitPrivateContextProcs -DPSInitPrivateSpaceFields -DPSInitPrivateTextContextFields -DPSNewUserObjectIndex -DPSPrivateCheckWait -DPSPrivateDestroyContext -DPSPrivateDestroySpace -DPSServicePostScript -DPSWarnProc -DPSinnerProcWriteData -XDPSContextFromSharedID -XDPSContextFromXID -XDPSCreateContext -XDPSCreateSecureContext -XDPSCreateSimpleContext -XDPSDispatchEvent -XDPSFindContext -XDPSGetContextStatus -XDPSGetProtocolVersion -XDPSIsDPSEvent -XDPSIsOutputEvent -XDPSIsReadyEvent -XDPSIsStatusEvent -XDPSNotifyWhenReady -XDPSReadyEventHandler -XDPSRegisterReadyProc -XDPSRegisterStatusProc -XDPSSetEventDelivery -XDPSSetProcs -XDPSSetStatusMask -XDPSSpaceFromSharedID -XDPSSpaceFromXID -XDPSStatusEventHandler -XDPSUnfreezeContext -XDPSXIDFromContext -XDPSXIDFromSpace -DPSInitSysNames -DPSCreatePrivContext -DPSDefaultTextBackstop -DPSIncludePrivContext -DPSInitClient -DPSOutOfMemory -DPSSendDestroySpace -DPSSendEOF -DPSSendInterrupt -DPSSendPostScript -DPSSendTerminate -XDPSCreatePrivContextRec -XDPSForceEvents -XDPSNumFormat -XDPSPrivZapDpy -XDPSSendUnfreeze -XDPSSetContextEncoding -XDPSLCAPNotify -XDPSLCallOutputEventHandler -XDPSLCallReadyEventHandler -XDPSLCallStatusEventHandler -XDPSLCleanAll -XDPSLCleanContext -XDPSLContextFromXID -XDPSLCreateContext -XDPSLCreateContextAndSpace -XDPSLCreateContextFromID -XDPSLCreateSpace -XDPSLDestroySpace -XDPSLDispatchCSDPSFakeEvent -XDPSLFlush -XDPSLFlushGC -XDPSLGetCSDPSFakeEventType -XDPSLGetCSDPSReady -XDPSLGetCSDPSStatus -XDPSLGetCodes -XDPSLGetGCFlushMode -XDPSLGetPassEventsFlag -XDPSLGetShunt -XDPSLGetStatus -XDPSLGetSyncMask -XDPSLGetVersion -XDPSLGetWrapWaitingFlag -XDPSLGiveInput -XDPSLIDFromContext -XDPSLInit -XDPSLInitDisplayFlags -XDPSLNotifyContext -XDPSLNotifyWhenReady -XDPSLReconcileRequests -XDPSLReset -XDPSLSetAfterProc -XDPSLSetAgentArg -XDPSLSetAgentName -XDPSLSetClientMessageHandler -XDPSLSetCodes -XDPSLSetGCFlushMode -XDPSLSetPassEventsFlag -XDPSLSetReadyEventHandler -XDPSLSetShunt -XDPSLSetStatusEventHandler -XDPSLSetStatusMask -XDPSLSetSyncMask -XDPSLSetTextEventHandler -XDPSLSetVersion -XDPSLSetWrapWaitingFlag -XDPSLSync -XDPSLSyncGCClip -XDPSLTestErrorCode -XDPSLUpdateAgentArgs -XDPSSetXtEventDispatching -;XDPSCreateStandardColormaps -XDPSGetDefaultColorMaps -CSDPSHeadOfDpyExt -CSDPSInit -DPSCAPChangeGC -DPSCAPCloseDisplayProc -DPSCAPCopyGCProc -DPSCAPCreate -DPSCAPDestroy -DPSCAPFlushGCProc -DPSCAPFreeGCProc -DPSCAPStartUp -DPSCAPWrite -XDPSFlushGC -XDPSNXSetAgentArg -XDPSReconcileRequests -XDPSSyncGCClip -DPSCAPCloseAgent -DPSCAPOpenAgent -DPSCAPConnect -N_XDisconnectDisplay -N_XWaitForReadable -N_XWaitForWritable -StartXDPSNX -XDPSNXRecommendPort -XDPSGetNXArg -XDPSNXFindNX -XDPSNXSetClientArg -NXProcData -N_XANYSET -N_XFlush -N_XGetHostname -N_XRead -N_XReadPad -N_XReply -N_XSend -N_XUnknownNativeEvent -N_XUnknownWireEvent -DPScolorimage -DPScurrentblackgeneration -DPScurrentcmykcolor -DPScurrentcolorscreen -DPScurrentcolortransfer -DPScurrentundercolorremoval -DPSsetblackgeneration -DPSsetcmykcolor -DPSsetcolorscreen -DPSsetcolortransfer -DPSsetundercolorremoval -DPSeq -DPSexit -DPSfalse -DPSfor -DPSforall -DPSge -DPSgt -DPSif -DPSifelse -DPSle -DPSloop -DPSlt -DPSne -DPSnot -DPSor -DPSrepeat -DPSstop -DPSstopped -DPStrue -DPSUserObjects -DPScondition -DPScurrentcontext -DPScurrentobjectformat -DPSdefineusername -DPSdefineuserobject -DPSdetach -DPSexecuserobject -DPSfork -DPSjoin -DPSlock -DPSmonitor -DPSnotify -DPSsetobjectformat -DPSsetvmthreshold -DPSundefineuserobject -DPSwait -DPSyield -DPSaload -DPSanchorsearch -DPSarray -DPSastore -DPSbegin -DPSclear -DPScleartomark -DPScopy -DPScount -DPScounttomark -DPScvi -DPScvlit -DPScvn -DPScvr -DPScvrs -DPScvs -DPScvx -DPSdef -DPSdict -DPSdictstack -DPSdup -DPSend -DPSexch -DPSexecstack -DPSexecuteonly -DPSget -DPSgetinterval -DPSindex -DPSknown -DPSlength -DPSload -DPSmark -DPSmatrix -DPSmaxlength -DPSnoaccess -DPSnull -DPSpackedarray -DPSpop -DPSput -DPSputinterval -DPSrcheck -DPSreadonly -DPSroll -DPSscheck -DPSsearch -DPSshareddict -DPSstatusdict -DPSstore -DPSstring -DPSstringwidth -DPSsystemdict -DPSuserdict -DPSwcheck -DPSwhere -DPSxcheck -DPSFontDirectory -DPSISOLatin1Encoding -DPSSharedFontDirectory -DPSStandardEncoding -DPScachestatus -DPScurrentcacheparams -DPScurrentfont -DPSdefinefont -DPSfindfont -DPSmakefont -DPSscalefont -DPSselectfont -DPSsetcachedevice -DPSsetcachelimit -DPSsetcacheparams -DPSsetcharwidth -DPSsetfont -DPSundefinefont -DPSconcat -DPScurrentdash -DPScurrentflat -DPScurrentgray -DPScurrentgstate -DPScurrenthalftone -DPScurrenthalftonephase -DPScurrenthsbcolor -DPScurrentlinecap -DPScurrentlinejoin -DPScurrentlinewidth -DPScurrentmatrix -DPScurrentmiterlimit -DPScurrentpoint -DPScurrentrgbcolor -DPScurrentscreen -DPScurrentstrokeadjust -DPScurrenttransfer -DPSdefaultmatrix -DPSgrestore -DPSgrestoreall -DPSgsave -DPSgstate -DPSinitgraphics -DPSinitmatrix -DPSrotate -DPSscale -DPSsetdash -DPSsetflat -DPSsetgray -DPSsetgstate -DPSsethalftone -DPSsethalftonephase -DPSsethsbcolor -DPSsetlinecap -DPSsetlinejoin -DPSsetlinewidth -DPSsetmatrix -DPSsetmiterlimit -DPSsetrgbcolor -DPSsetscreen -DPSsetstrokeadjust -DPSsettransfer -DPStranslate -DPSbytesavailable -DPSclosefile -DPScurrentfile -DPSdeletefile -DPSecho -DPSequals -DPSequalsequals -DPSfile -DPSfilenameforall -DPSfileposition -DPSflush -DPSflushfile -DPSprint -DPSprintobject -DPSpstack -DPSread -DPSreadhexstring -DPSreadline -DPSreadstring -DPSrenamefile -DPSresetfile -DPSsetfileposition -DPSstack -DPSstatus -DPStoken -DPSwrite -DPSwritehexstring -DPSwriteobject -DPSwritestring -DPSabs -DPSadd -DPSand -DPSatan -DPSbitshift -DPSceiling -DPScos -DPSdiv -DPSexp -DPSfloor -DPSidiv -DPSln -DPSlog -DPSmod -DPSmul -DPSneg -DPSround -DPSsin -DPSsqrt -DPSsub -DPStruncate -DPSxor -DPSconcatmatrix -DPSdtransform -DPSidentmatrix -DPSidtransform -DPSinvertmatrix -DPSitransform -DPStransform -DPSbanddevice -DPSframedevice -DPSnulldevice -DPSrenderbands -DPSashow -DPSawidthshow -DPScopypage -DPSeofill -DPSerasepage -DPSfill -DPSimage -DPSimagemask -DPSkshow -DPSrectfill -DPSrectstroke -DPSshow -DPSshowpage -DPSstroke -DPSstrokepath -DPSueofill -DPSufill -DPSustroke -DPSustrokepath -DPSwidthshow -DPSxshow -DPSxyshow -DPSyshow -DPSarc -DPSarcn -DPSarct -DPSarcto -DPScharpath -DPSclip -DPSclippath -DPSclosepath -DPScurveto -DPSeoclip -DPSeoviewclip -DPSflattenpath -DPSinitclip -DPSinitviewclip -DPSlineto -DPSmoveto -DPSnewpath -DPSpathbbox -DPSpathforall -DPSrcurveto -DPSrectclip -DPSrectviewclip -DPSreversepath -DPSrlineto -DPSrmoveto -DPSsetbbox -DPSsetucacheparams -DPSuappend -DPSucache -DPSucachestatus -DPSupath -DPSviewclip -DPSviewclippath -DPSbind -DPScleardictstack -DPScountdictstack -DPScountexecstack -DPScurrentdict -DPScurrentpacking -DPScurrentshared -DPSdeviceinfo -DPSerrordict -DPSexec -DPSprompt -DPSquit -DPSrand -DPSrealtime -DPSrestore -DPSrrand -DPSrun -DPSsave -DPSsetpacking -DPSsetshared -DPSsrand -DPSstart -DPStype -DPSundef -DPSusertime -DPSversion -DPSvmreclaim -DPSvmstatus -DPSineofill -DPSinfill -DPSinstroke -DPSinueofill -DPSinufill -DPSinustroke -DPSwtranslation -DPSgetboolean -DPSgetchararray -DPSgetfloat -DPSgetfloatarray -DPSgetint -DPSgetintarray -DPSgetstring -DPSsendboolean -DPSsendchararray -DPSsendfloat -DPSsendfloatarray -DPSsendint -DPSsendintarray -DPSsendstring -DPSclientXready -DPSclientsync -DPScurrentXdrawingfunction -DPScurrentXgcdrawable -DPScurrentXgcdrawablecolor -DPScurrentXoffset -DPSsetXdrawingfunction -DPSsetXgcdrawable -DPSsetXgcdrawablecolor -DPSsetXoffset -DPSsetXrgbactual -DPSGlobalFontDirectory -DPScshow -DPScurrentcolor -DPScurrentcolorrendering -DPScurrentcolorspace -DPScurrentdevparams -DPScurrentglobal -DPScurrentoverprint -DPScurrentpagedevice -DPScurrentsystemparams -DPScurrentuserparams -DPSdefineresource -DPSexecform -DPSfilter -DPSfindencoding -DPSfindresource -DPSgcheck -DPSglobaldict -DPSglyphshow -DPSlanguagelevel -DPSleftbracket -DPSleftleft -DPSmakepattern -DPSproduct -DPSresourceforall -DPSresourcestatus -DPSrevision -DPSrightbracket -DPSrightright -DPSrootfont -DPSserialnumber -DPSsetcolor -DPSsetcolorrendering -DPSsetcolorspace -DPSsetdevparams -DPSsetglobal -DPSsetoverprint -DPSsetpagedevice -DPSsetpattern -DPSsetsystemparams -DPSsetuserparams -DPSstartjob -DPSundefineresource -PScolorimage -PScurrentblackgeneration -PScurrentcmykcolor -PScurrentcolorscreen -PScurrentcolortransfer -PScurrentundercolorremoval -PSsetblackgeneration -PSsetcmykcolor -PSsetcolorscreen -PSsetcolortransfer -PSsetundercolorremoval -PSeq -PSexit -PSfalse -PSfor -PSforall -PSge -PSgt -PSif -PSifelse -PSle -PSloop -PSlt -PSne -PSnot -PSor -PSrepeat -PSstop -PSstopped -PStrue -PSUserObjects -PScondition -PScurrentcontext -PScurrentobjectformat -PSdefineusername -PSdefineuserobject -PSdetach -PSexecuserobject -PSfork -PSjoin -PSlock -PSmonitor -PSnotify -PSsetobjectformat -PSsetvmthreshold -PSundefineuserobject -PSwait -PSyield -PSaload -PSanchorsearch -PSarray -PSastore -PSbegin -PSclear -PScleartomark -PScopy -PScount -PScounttomark -PScvi -PScvlit -PScvn -PScvr -PScvrs -PScvs -PScvx -PSdef -PSdict -PSdictstack -PSdup -PSend -PSexch -PSexecstack -PSexecuteonly -PSget -PSgetinterval -PSindex -PSknown -PSlength -PSload -PSmark -PSmatrix -PSmaxlength -PSnoaccess -PSnull -PSpackedarray -PSpop -PSput -PSputinterval -PSrcheck -PSreadonly -PSroll -PSscheck -PSsearch -PSshareddict -PSstatusdict -PSstore -PSstring -PSstringwidth -PSsystemdict -PSuserdict -PSwcheck -PSwhere -PSxcheck -PSFontDirectory -PSISOLatin1Encoding -PSSharedFontDirectory -PSStandardEncoding -PScachestatus -PScurrentcacheparams -PScurrentfont -PSdefinefont -PSfindfont -PSmakefont -PSscalefont -PSselectfont -PSsetcachedevice -PSsetcachelimit -PSsetcacheparams -PSsetcharwidth -PSsetfont -PSundefinefont -PSconcat -PScurrentdash -PScurrentflat -PScurrentgray -PScurrentgstate -PScurrenthalftone -PScurrenthalftonephase -PScurrenthsbcolor -PScurrentlinecap -PScurrentlinejoin -PScurrentlinewidth -PScurrentmatrix -PScurrentmiterlimit -PScurrentpoint -PScurrentrgbcolor -PScurrentscreen -PScurrentstrokeadjust -PScurrenttransfer -PSdefaultmatrix -PSgrestore -PSgrestoreall -PSgsave -PSgstate -PSinitgraphics -PSinitmatrix -PSrotate -PSscale -PSsetdash -PSsetflat -PSsetgray -PSsetgstate -PSsethalftone -PSsethalftonephase -PSsethsbcolor -PSsetlinecap -PSsetlinejoin -PSsetlinewidth -PSsetmatrix -PSsetmiterlimit -PSsetrgbcolor -PSsetscreen -PSsetstrokeadjust -PSsettransfer -PStranslate -PSbytesavailable -PSclosefile -PScurrentfile -PSdeletefile -PSecho -PSequals -PSequalsequals -PSfile -PSfilenameforall -PSfileposition -PSflush -PSflushfile -PSprint -PSprintobject -PSpstack -PSread -PSreadhexstring -PSreadline -PSreadstring -PSrenamefile -PSresetfile -PSsetfileposition -PSstack -PSstatus -PStoken -PSwrite -PSwritehexstring -PSwriteobject -PSwritestring -PSabs -PSadd -PSand -PSatan -PSbitshift -PSceiling -PScos -PSdiv -PSexp -PSfloor -PSidiv -PSln -PSlog -PSmod -PSmul -PSneg -PSround -PSsin -PSsqrt -PSsub -PStruncate -PSxor -PSconcatmatrix -PSdtransform -PSidentmatrix -PSidtransform -PSinvertmatrix -PSitransform -PStransform -PSbanddevice -PSframedevice -PSnulldevice -PSrenderbands -PSashow -PSawidthshow -PScopypage -PSeofill -PSerasepage -PSfill -PSimage -PSimagemask -PSkshow -PSrectfill -PSrectstroke -PSshow -PSshowpage -PSstroke -PSstrokepath -PSueofill -PSufill -PSustroke -PSustrokepath -PSwidthshow -PSxshow -PSxyshow -PSyshow -PSarc -PSarcn -PSarct -PSarcto -PScharpath -PSclip -PSclippath -PSclosepath -PScurveto -PSeoclip -PSeoviewclip -PSflattenpath -PSinitclip -PSinitviewclip -PSlineto -PSmoveto -PSnewpath -PSpathbbox -PSpathforall -PSrcurveto -PSrectclip -PSrectviewclip -PSreversepath -PSrlineto -PSrmoveto -PSsetbbox -PSsetucacheparams -PSuappend -PSucache -PSucachestatus -PSupath -PSviewclip -PSviewclippath -PSbind -PScleardictstack -PScountdictstack -PScountexecstack -PScurrentdict -PScurrentpacking -PScurrentshared -PSdeviceinfo -PSerrordict -PSexec -PSprompt -PSquit -PSrand -PSrealtime -PSrestore -PSrrand -PSrun -PSsave -PSsetpacking -PSsetshared -PSsrand -PSstart -PStype -PSundef -PSusertime -PSversion -PSvmreclaim -PSvmstatus -PSineofill -PSinfill -PSinstroke -PSinueofill -PSinufill -PSinustroke -PSwtranslation -PSgetboolean -PSgetchararray -PSgetfloat -PSgetfloatarray -PSgetint -PSgetintarray -PSgetstring -PSsendboolean -PSsendchararray -PSsendfloat -PSsendfloatarray -PSsendint -PSsendintarray -PSsendstring -PSclientXready -PSclientsync -PScurrentXdrawingfunction -PScurrentXgcdrawable -PScurrentXgcdrawablecolor -PScurrentXoffset -PSsetXdrawingfunction -PSsetXgcdrawable -PSsetXgcdrawablecolor -PSsetXoffset -PSsetXrgbactual -PSGlobalFontDirectory -PScshow -PScurrentcolor -PScurrentcolorrendering -PScurrentcolorspace -PScurrentdevparams -PScurrentglobal -PScurrentoverprint -PScurrentpagedevice -PScurrentsystemparams -PScurrentuserparams -PSdefineresource -PSexecform -PSfilter -PSfindencoding -PSfindresource -PSgcheck -PSglobaldict -PSglyphshow -PSlanguagelevel -PSleftbracket -PSleftleft -PSmakepattern -PSproduct -PSresourceforall -PSresourcestatus -PSrevision -PSrightbracket -PSrightright -PSrootfont -PSserialnumber -PSsetcolor -PSsetcolorrendering -PSsetcolorspace -PSsetdevparams -PSsetglobal -PSsetoverprint -PSsetpagedevice -PSsetpattern -PSsetsystemparams -PSsetuserparams -PSstartjob -PSundefineresource - -/* $XFree86$ */ diff --git a/nx-X11/lib/dps/dpsNXprops.h b/nx-X11/lib/dps/dpsNXprops.h deleted file mode 100644 index c3a8e8d39..000000000 --- a/nx-X11/lib/dps/dpsNXprops.h +++ /dev/null @@ -1,90 +0,0 @@ -/* - * dpsNXprops.h - * - * (c) Copyright 1992-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$ */ - -#ifndef DPSNXPROPS_H -#define DPSNXPROPS_H - - -/* ---DEFINES--- */ - -/* --- X Window Properties --- */ - -#define XDPSNX_BILLBOARD_PROP "_ADOBE_DPS_NX_BILLBOARD" /* On dpy root win */ - -/* Following are per Agent window properties */ - -#define XDPSNX_WILLINGNESS_PROP "_ADOBE_DPS_NX_WILLINGNESS_PROP" -#define XDPSNX_LICENSE_METHOD_PROP "_ADOBE_DPS_NX_LICENSE_METHODS_PROP" -#define XDPSNX_TRANSPORT_INFO_PROP "_ADOBE_DPS_NX_TRANSPORT_INFO_PROP" -#define XDPSNX_HOST_NAME_PROP "_ADOBE_DPS_NX_HOST_NAME_PROP" - -#define XDPSNX_X_CLASS_NAME "XDPSNX" -#define XDPSNX_X_RESOURCE "xdpsnx.agenthost" -#define XDPSNX_X_CLASS "XDPSNX.AgentHost" - -#define AGENT_ENV_VAR "DPSNXHOST" - - -/* - Predefined Willingness Prop. Values. Range: [0, 100] - */ - -#define XDPSNX_MAX_WILLINGNESS 100 -#define XDPSNX_NOT_WILLING 0 /* 0:= agent wishes to "refuses" service to - new clients */ -#define XDPSNX_MIN_WILLINGNESS 1 /* 1:= agent may delegate a client's request - for a connection to another "more willing" - agent */ - -/* ---Predefined License Method Values--- */ - -#define LICENSE_METHOD_PREFIX "_ADOBE_DPS_NX_LICENSE_LOCK_&_KEY_" -#define LICENSE_METHOD_OPEN "_ADOBE_DPS_NX_LICENSE_OPEN_SERVICE" -#define OPEN_LICENSE_VERSION 1 - -#include <stddef.h> - - -/* ---Types--- */ - -typedef struct { - int transport; - int port; -} TransportInfo; - - -#endif /* DPSNXPROPS_H */ diff --git a/nx-X11/lib/dps/dpsXclient.c b/nx-X11/lib/dps/dpsXclient.c deleted file mode 100644 index 212030ecc..000000000 --- a/nx-X11/lib/dps/dpsXclient.c +++ /dev/null @@ -1,1134 +0,0 @@ -/* - * dpsXclient.c -- Implementation of the Display PostScript Client Library. - * - * (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$ */ - -#include <stdlib.h> -#include <unistd.h> /* sleep() */ -#include <stdio.h> -#include <string.h> -#include <ctype.h> - -#ifdef VMS -/* Xlib does not like UNIX defined to any value under VMS. */ -#undef UNIX -#include <decw$include/X.h> -#include <decw$include/Xlib.h> - -#else /* VMS */ -#include <X11/Xlib.h> -#include <X11/Xutil.h> -#endif /* VMS */ - -#include "DPS/XDPSlib.h" -#include "DPS/XDPS.h" - -#include "publictypes.h" -#include "DPS/dpsclient.h" -#include "dpsprivate.h" - -#include "dpsXpriv.h" -#include "DPS/dpsXclient.h" - -#include "dpsdict.h" -#include "DPS/dpsexcept.h" - -#include "dpsXint.h" - -static DPSPrivContext FindPrivContext ( - Display * dpy, - long int cid) -{ - DPSPrivSpace ss; - DPSPrivContext cc; - - for (ss = spaces; ss != NIL; ss = ss->next) - for (cc = ss->firstContext; cc != NIL; cc = cc->next) - if (cc->cid == cid && ((XDPSPrivContext) cc->wh)->dpy == dpy) - return (cc); - return (NIL); -} - -DPSContext XDPSFindContext ( - Display * dpy, - int cid) -{ - return ((DPSContext) FindPrivContext (dpy, cid)); -} - -DPSContext DPSContextFromContextID( - DPSContext ctxt, - int contextID, - DPSTextProc textProc, - DPSErrorProc errorProc) -{ - DPSPrivSpace ss; - Display *dpy = ((XDPSPrivContext) ((DPSPrivContext) ctxt)->wh)->dpy; - DPSPrivContext c, cc = FindPrivContext (dpy, contextID); - DPSPrivContext oldc = (DPSPrivContext)ctxt; - - if (cc != NIL) return (DPSContext)cc; - - c = (DPSPrivContext)DPScalloc(sizeof(DPSPrivContextRec), 1); - if (!c) return NIL; - *c = *oldc; - ss = (DPSPrivSpace)c->space; - - if (textProc) c->textProc = textProc; - if (errorProc) c->errorProc = errorProc; - - c->eofReceived = false; - c->cid = contextID; - c->buf = c->outBuf = c->objBuf = NIL; - c->chainParent = c->chainChild = NIL; - - c->nBufChars = c->nOutBufChars = c->nObjBufChars = 0; - - c->next = ss->firstContext; - DPSAssert(c->next != c); - ss->firstContext = c; - - /* Note: there's no way to determine whether the new context id was obtained - ** as a result of a fork operation or from another application. so, it must - ** be assumed that the application is the creator of the new context. - ** Otherwise, it would have called the XDPSContextFromSharedID. - */ - c->creator = true; - c->zombie = false; - c->numstringOffsets = NULL; - - DPSIncludePrivContext( - (XDPSPrivContext) c->wh, (DPSContext)c, c->cid, ss->sid, DPSclientPrintProc); - - return (DPSContext)c; -} - -boolean DPSPrivateCheckWait( - DPSContext ctxt) -{ - DPSPrivContext cc = (DPSPrivContext) ctxt; - - if (!cc->creator || cc->zombie) { - DPSSafeSetLastNameIndex(ctxt); - if (cc->errorProc != NIL) { - (*cc->errorProc) (ctxt, cc->zombie ? dps_err_deadContext : - dps_err_invalidAccess, - (unsigned long) ctxt, 0); - } - return true; - } - return false; -} - -static void procFlushContext( - DPSContext ctxt) -{ - DPSPrivContext c = (DPSPrivContext) ctxt; - XDPSLFlush (((XDPSPrivContext) c->wh)->dpy); - if (ctxt->chainChild != NIL) DPSFlushContext(ctxt->chainChild); -} - -/* ARGSUSED */ -static Bool FindDPSEvent( - Display *dpy, - XEvent *event, - char *arg) -{ - return XDPSIsDPSEvent(event); -} - -static void procAwaitReturnValues(DPSContext ctxt) -{ - DPSPrivContext c = (DPSPrivContext)ctxt; - - XDPSPrivContext xwh = (XDPSPrivContext) c->wh; - XEvent ev; - - /* Output currently goes only to creator! */ - if (!c->creator) - { - DPSSafeSetLastNameIndex(ctxt); - c->resultTable = NIL; - c->resultTableLength = 0; - if (c->errorProc != NIL) - (*c->errorProc) (ctxt, dps_err_invalidAccess, 0, 0); - return; - } - if (c->resultTable != NIL) - { - DPSCheckInitClientGlobals(); - - if (XDPSLGetWrapWaitingFlag(xwh->dpy)) { - DPSSafeSetLastNameIndex(ctxt); - c->resultTable = NIL; - c->resultTableLength = 0; - if (c->errorProc != NIL) - (*c->errorProc) (ctxt, dps_err_recursiveWait, - (unsigned long) xwh->dpy, 0); - return; - } - XDPSLSetWrapWaitingFlag(xwh->dpy, True); - - DURING - DPSFlushContext(ctxt); - while (c->resultTable != NIL) - { - /* We may block indefinitely if the context is frozen or it - somehow needs more input. */ - if (c->zombie) - { - DPSSafeSetLastNameIndex(ctxt); - c->resultTable = NIL; - c->resultTableLength = 0; - if (c->errorProc != NIL) - (*c->errorProc) (ctxt, dps_err_deadContext, (unsigned long) c, 0); - XDPSLSetWrapWaitingFlag(xwh->dpy, False); - E_RTRN_VOID; - } - - /* Someone could conceivably change the event delivery mode in the - middle of this...best to check every time */ - - if (XDPSLGetPassEventsFlag(xwh->dpy)) { - XIfEvent(xwh->dpy, &ev, FindDPSEvent, (char *) NULL); - if (!XDPSDispatchEvent(&ev)) DPSCantHappen(); - } else DPSSendPostScript((XDPSPrivContext) c->wh, DPSclientPrintProc, - c->cid, NIL, 0, NIL); - } - HANDLER - XDPSLSetWrapWaitingFlag(xwh->dpy, False); - RERAISE; - END_HANDLER - - XDPSLSetWrapWaitingFlag(xwh->dpy, False); - - } - - /* update space's name map. - space->lastNameIndex is the highest index known to be known to the - server for this space. - c->lastNameIndex is the highest index sent so far to the context - */ - - if (((DPSPrivSpace)(c->space))->lastNameIndex < c->lastNameIndex) - ((DPSPrivSpace)(c->space))->lastNameIndex = c->lastNameIndex; -} - -void DPSinnerProcWriteData( - DPSContext ctxt, - char *buf, - unsigned int count) -{ - DPSPrivContext c = (DPSPrivContext) ctxt; - - /* ASSERT: safe to call with chain */ - - /* No local buffering */ - DPSSendPostScript ((XDPSPrivContext) c->wh, DPSclientPrintProc, - c->cid, buf, count, NIL); -} /* DPSinnerProcWriteData */ - -static void procResetContext(DPSContext ctxt) -{ - DPSPrivContext c = (DPSPrivContext) ctxt; - int currStatus; - register XDPSPrivContext xwh = (XDPSPrivContext) c->wh; - int retries = 0; - int backoff = 2; - - /* First make sure context isn't frozen, try to unfreeze. */ - -#define DPS_SLEEP_SECS 2 - - while((currStatus = XDPSLGetStatus(xwh->dpy, xwh->cxid)) == PSFROZEN) - { - XDPSLNotifyContext(xwh->dpy, xwh->cxid, PSUNFREEZE); - sleep(DPS_SLEEP_SECS); - /* Okay if context is PSRUNNING, since the EOF will - be handled at the next PSNEEDSINPUT */ - } - - /* Remove events from Xlib Qs before sending the reset request. */ - XDPSForceEvents (xwh->dpy); - - if (currStatus == PSSTATUSERROR) - /* +++ report error? */; - else /* Didn't become zombie. */ - { - currStatus = 0; - XDPSLReset(xwh->dpy, xwh->cxid); - XDPSLFlush(xwh->dpy); - /* Be optmistic for the first try. Assume the app set up a status mask - correctly, we should get a status event without asking the - server for status. */ - - XDPSForceEvents(xwh->dpy); - currStatus = c->statusFromEvent; - - while (currStatus != PSNEEDSINPUT && currStatus != PSZOMBIE) - { - if (currStatus == PSFROZEN) - XDPSLNotifyContext(xwh->dpy, xwh->cxid, PSUNFREEZE); - if (retries > backoff) - { - /* Optimism failed. App probably didn't set up a status mask. - Ask the server for status. */ - currStatus = XDPSLGetStatus(xwh->dpy, xwh->cxid); - retries = 0; - backoff = (backoff > 30) ? 2 : backoff + 1; - continue; - } - else - ++retries; - sleep(DPS_SLEEP_SECS); - XDPSForceEvents(xwh->dpy); - currStatus = c->statusFromEvent; - } - } - - c->eofReceived = false; -} - -void DPSPrivateDestroyContext(DPSContext ctxt) -{ - DPSPrivContext c = (DPSPrivContext)ctxt; - DPSPrivSpace s = (DPSPrivSpace) c->space; - - if (c->creator) - DPSSendTerminate((XDPSPrivContext) c->wh, c->cid, DPSclientPrintProc); - else - XDPSSetStatusMask(ctxt, 0, XDPSL_ALL_EVENTS, 0); /* Stop status events */ - /* Don't free the space's wh out from under it */ - if (c->wh != s->wh) free(c->wh); -} - -void DPSPrivateDestroySpace(DPSSpace space) -{ - DPSPrivSpace ss = (DPSPrivSpace) space; - - if (ss->creator) DPSSendDestroySpace((XDPSPrivContext) ss->wh, ss->sid, - DPSclientPrintProc); - - free (ss->wh); -} - -boolean DPSCheckShared(DPSPrivContext ctxt) -{ - return ctxt->creator == false && ctxt->resultTable != NIL; - /* let procAwaitReturnValues generate error */ -} - -/* ARGSUSED */ -void DPSServicePostScript(boolean (*returnControl)(void)) -{ -} /* DPSServicePostScript */ - -void DPSHandleBogusError(DPSContext ctxt, char *prefix, char *suffix) -{ - char *buf = "bogus error output from context"; - DPSDefaultPrivateHandler(ctxt, dps_err_warning, - (long unsigned int)buf, 0, prefix, suffix); -} - -void DPSDefaultPrivateHandler( - DPSContext ctxt, - DPSErrorCode errorCode, - long unsigned int arg1, - long unsigned int arg2, - char *prefix, - char *suffix) -{ - - DPSTextProc textProc = DPSGetCurrentTextBackstop(); - - switch (errorCode) { - case dps_err_invalidAccess: - if (textProc != NIL) - { - char m[100]; - (void) sprintf (m, "%sInvalid context access.%s", prefix, suffix); - (*textProc) (ctxt, m, strlen (m)); - } - break; - case dps_err_encodingCheck: - if (textProc != NIL) - { - char m[100]; - (void) sprintf (m, "%sInvalid name/program encoding: %d/%d.%s", - prefix, (int) arg1, (int) arg2, suffix); - (*textProc) (ctxt, m, strlen (m)); - } - break; - case dps_err_closedDisplay: - if (textProc != NIL) - { - char m[100]; - (void) sprintf (m, "%sBroken display connection %d.%s", - prefix, (int) arg1, suffix); - (*textProc) (ctxt, m, strlen (m)); - } - break; - case dps_err_deadContext: - if (textProc != NIL) - { - char m[100]; - (void) sprintf (m, "%sDead context 0x0%x.%s", prefix, - (int) arg1, suffix); - (*textProc) (ctxt, m, strlen (m)); - } - break; - case dps_err_warning: - if (textProc != NIL) - { - char *warn = (char *)arg1; - char *msg = "%% DPS Client Library Warning:\n "; - (*textProc)(ctxt, msg, strlen(msg)); - (*textProc)(ctxt, warn, strlen(warn)); - msg = "\n"; - (*textProc)(ctxt, msg, strlen(msg)); - /* flush convention */ - (*textProc)(ctxt, msg, 0); - } - break; - case dps_err_fatal: - if (textProc != NIL) - { - char *fatal = (char *)arg1; - char *msg = "%% DPS Client Library Fatal Internal Error:\n "; - (*textProc)(ctxt, msg, strlen(msg)); - (*textProc)(ctxt, fatal, strlen(fatal)); - msg = ".\nAborting ...\n"; - (*textProc)(ctxt, msg, strlen(msg)); - /* flush convention */ - (*textProc)(ctxt, msg, 0); - abort(); - } - break; - case dps_err_recursiveWait: - if (textProc != NIL) - { - char m[100]; - (void) sprintf (m, - "%sRecursive wait for return values, display 0x%x.%s", - prefix, (int) arg1, suffix); - (*textProc) (ctxt, m, strlen (m)); - } - break; - } -} - -void DPSInitPrivateSpaceFields(DPSPrivSpace s) -{ - s->creator = true; -} - -void DPSInitPrivateContextFields(DPSPrivContext c, DPSPrivSpace s) -{ - c->creator = true; - c->zombie = false; - if (!s->creator) { - c->procs = XDPSconvProcs; - c->nameEncoding = dps_strings; - } -} - -void DPSInitPrivateTextContextFields(DPSPrivContext c, DPSPrivSpace s) -{ - c->creator = true; - c->zombie = false; - c->space = (DPSSpace) s; - c->next = s->firstContext; - s->firstContext = c; -} - -long int DPSLastUserObjectIndex = 0; - -long int DPSNewUserObjectIndex (void) -{ - return (DPSLastUserObjectIndex++); -} - -void XDPSSetProcs (void) -{ - DPSCheckInitClientGlobals (); - if (!textCtxProcs) - { - textCtxProcs = (DPSProcs) DPScalloc (sizeof (DPSProcsRec), 1); - DPSInitCommonTextContextProcs(textCtxProcs); - DPSInitSysNames(); - } - if (!ctxProcs) - { - ctxProcs = (DPSProcs) DPScalloc (sizeof (DPSProcsRec), 1); - DPSInitCommonContextProcs(ctxProcs); - DPSInitPrivateContextProcs(ctxProcs); - } - if (!XDPSconvProcs) - XDPSconvProcs = (DPSProcs) DPScalloc (sizeof (DPSProcsRec), 1); - if (!XDPSrawProcs) - XDPSrawProcs = ctxProcs; - *XDPSconvProcs = *ctxProcs; - XDPSconvProcs->BinObjSeqWrite = textCtxProcs->BinObjSeqWrite; - XDPSconvProcs->WriteStringChars = textCtxProcs->WriteStringChars; - XDPSconvProcs->WritePostScript = textCtxProcs->WritePostScript; - XDPSconvProcs->WriteNumString = textCtxProcs->WriteNumString; -} - -void DPSInitPrivateContextProcs(DPSProcs p) -{ - p->FlushContext = procFlushContext; - p->ResetContext = procResetContext; - p->AwaitReturnValues = procAwaitReturnValues; -} - -DPSContext XDPSCreateSimpleContext ( - Display *dpy, - Drawable draw, - GC gc, - int x, - int y, - DPSTextProc textProc, - DPSErrorProc errorProc, - DPSSpace space) -{ - XDPSPrivContext xwh = XDPSCreatePrivContextRec (dpy, draw, gc, x, y, - 0, DefaultStdCMap, - DefaultStdCMap, 0, false); - DPSContext newCtxt; - - if (xwh == NIL) - return (NIL); - else - { - newCtxt = DPSCreateContext ((char *) xwh, textProc, errorProc, space); - if (newCtxt == NIL) - free ((char *) xwh); - return (newCtxt); - } -} - - -DPSContext XDPSCreateContext ( - Display *dpy, - Drawable draw, - GC gc, - int x, - int y, - unsigned int eventmask, - XStandardColormap *grayramp, - XStandardColormap *ccube, - int actual, - DPSTextProc textProc, - DPSErrorProc errorProc, - DPSSpace space) -{ - XDPSPrivContext xwh = XDPSCreatePrivContextRec (dpy, draw, gc, x, y, - eventmask, grayramp, - ccube, actual, false); - DPSContext newCtxt; - - if (xwh == NIL) - return (NIL); - else - { - newCtxt = DPSCreateContext ((char *) xwh, textProc, errorProc, space); - if (newCtxt == NIL) - free ((char *) xwh); - return (newCtxt); - } -} - -DPSContext XDPSCreateSecureContext ( - Display *dpy, - Drawable draw, - GC gc, - int x, - int y, - unsigned int eventmask, - XStandardColormap *grayramp, - XStandardColormap *ccube, - int actual, - DPSTextProc textProc, - DPSErrorProc errorProc, - DPSSpace space) -{ - XDPSPrivContext xwh = XDPSCreatePrivContextRec (dpy, draw, gc, x, y, - eventmask, grayramp, - ccube, actual, true); - DPSContext newCtxt; - - if (xwh == NIL) - return (NIL); - else - { - newCtxt = DPSCreateContext ((char *) xwh, textProc, errorProc, space); - if (newCtxt == NIL) - free ((char *) xwh); - return (newCtxt); - } -} - - -DPSContext XDPSContextFromSharedID (dpy, cid, textProc, errorProc) - Display *dpy; - ContextPSID cid; - DPSTextProc textProc; - DPSErrorProc errorProc; -{ - DPSPrivContext c; - DPSPrivSpace s; - ContextXID cxid; - SpaceXID sxid; - XDPSPrivContext xwh; - - if (DPSInitialize () != 0) - return (NIL); - - c = FindPrivContext (dpy, cid); - if (c != NIL) - return ((DPSContext) c); - - xwh = XDPSCreatePrivContextRec (dpy, 0, 0, 0, 0, 0, NIL, NIL, 0, false); - if (xwh == NIL) - return (NIL); - else if (XDPSLIDFromContext (dpy, cid, &cxid, &sxid) != 1) - { - free ((char *) xwh); - return (NIL); - } - xwh->cxid = cxid; - - if (spaceProcs == NIL) - { - spaceProcs = (DPSSpaceProcs) DPScalloc (sizeof (DPSSpaceProcsRec), 1); - DPSInitCommonSpaceProcs(spaceProcs); - } - - s = spaces; - while (s != NIL) - if ((SpaceXID)s->sid == sxid && ((XDPSPrivContext) s->wh)->dpy == dpy) - break; - else - s = s->next; - - if (s == NIL) /* Create new space record. */ - { - s = (DPSPrivSpace) DPScalloc (sizeof (DPSPrivSpaceRec), 1); - s->procs = spaceProcs; - s->lastNameIndex = -1; - s->sid = sxid; - s->wh = (char *) xwh; - s->creator = false; - s->next = spaces; - spaces = s; - } - - c = (DPSPrivContext) DPScalloc (sizeof (DPSPrivContextRec), 1); - c->space = (DPSSpace) s; - c->procs = XDPSconvProcs; - c->textProc = textProc; - c->errorProc = errorProc; - c->programEncoding = DPSDefaultProgramEncoding; - c->nameEncoding = dps_strings; - c->next = s->firstContext; - s->firstContext = c; - c->lastNameIndex = s->lastNameIndex; - c->cid = cid; - c->numstringOffsets = NULL; - c->creator = false; - c->zombie = false; - c->numFormat = XDPSNumFormat (dpy); - c->wh = (char *) xwh; - - xwh->ctxt = (DPSContext) c; - - return ((DPSContext) c); -} - - -void DPSChangeEncoding (ctxt, newProgEncoding, newNameEncoding) - DPSContext ctxt; - DPSProgramEncoding newProgEncoding; - DPSNameEncoding newNameEncoding; -{ - if (ctxt->programEncoding != newProgEncoding || - ctxt->nameEncoding != newNameEncoding) - { - DPSPrivContext cc = (DPSPrivContext) ctxt; - DPSPrivSpace ss = (DPSPrivSpace) (cc->space); - - if ((!cc->creator || !ss->creator) && newNameEncoding != dps_strings) - { - DPSSafeSetLastNameIndex(ctxt); - if (cc->errorProc != NIL) - (*cc->errorProc) (ctxt, dps_err_encodingCheck, - (unsigned long) newNameEncoding, - (unsigned long) newProgEncoding); - return; - } - if (ctxt->procs == textCtxProcs) - { - ctxt->programEncoding = newProgEncoding; - ctxt->nameEncoding = newNameEncoding; - } - else - XDPSSetContextEncoding (ctxt, newProgEncoding, newNameEncoding); - } -} - - -DPSSpace XDPSSpaceFromSharedID (dpy, sid) - Display *dpy; - SpaceXID sid; -{ - DPSPrivSpace s; - XDPSPrivContext xwh; - - if (DPSInitialize () != 0) - return (NIL); - - if (spaceProcs == NIL) - { - spaceProcs = (DPSSpaceProcs) DPScalloc (sizeof (DPSSpaceProcsRec), 1); - DPSInitCommonSpaceProcs(spaceProcs); - } - - s = spaces; - while (s != NIL) - if ((SpaceXID)s->sid == sid && ((XDPSPrivContext) s->wh)->dpy == dpy) - break; - else - s = s->next; - - if (s == NIL) /* Create new space record. */ - { - xwh = XDPSCreatePrivContextRec (dpy, 0, 0, 0, 0, 0, NIL, NIL, 0, false); - if (xwh == NIL) - return (NIL); - - s = (DPSPrivSpace) DPScalloc (sizeof (DPSPrivSpaceRec), 1); - s->procs = spaceProcs; - s->lastNameIndex = -1; - s->sid = sid; - s->wh = (char *) xwh; - s->creator = false; - s->next = spaces; - spaces = s; - } - - return ((DPSSpace) s); -} - - -void XDPSUnfreezeContext (ctxt) - DPSContext ctxt; -{ - XDPSPrivContext wh = (XDPSPrivContext) (((DPSPrivContext) ctxt)->wh); - - if (wh != NIL && wh->cxid != 0) - XDPSSendUnfreeze (wh->dpy, wh->cxid); -} - - -ContextXID XDPSXIDFromContext (Pdpy, ctxt) - Display **Pdpy; - DPSContext ctxt; -{ - XDPSPrivContext xwh = (XDPSPrivContext) (((DPSPrivContext) ctxt)->wh); - - if (xwh == NIL || xwh->cxid == 0) - { - *Pdpy = NULL; - return (0); - } - else - { - *Pdpy = xwh->dpy; - return (xwh->cxid); - } -} - - -SpaceXID XDPSXIDFromSpace (Pdpy, space) - Display **Pdpy; - DPSSpace space; -{ - DPSPrivSpace ss = (DPSPrivSpace) space; - XDPSPrivContext xwh = (XDPSPrivContext) ss->wh; - - if (xwh != NIL && xwh->dpy != NULL) - { - *Pdpy = xwh->dpy; - return (ss->sid); - } - else - { - *Pdpy = NULL; - return (0); - } -} - - -DPSContext XDPSContextFromXID (dpy, cxid) - Display *dpy; - ContextXID cxid; -{ - DPSPrivContext c; - DPSPrivSpace ss; - - for (ss = spaces; ss != NIL; ss = ss->next) - if (((XDPSPrivContext) ss->wh)->dpy == dpy) - for (c = ss->firstContext; c != NIL; c = c->next) - if (((XDPSPrivContext) c->wh)->cxid == cxid) - return ((DPSContext) c); - - return (NIL); -} - - -DPSSpace XDPSSpaceFromXID (dpy, sxid) - Display *dpy; - SpaceXID sxid; -{ - DPSPrivSpace ss; - - for (ss = spaces; ss != NIL; ss = ss->next) - if ((SpaceXID)ss->sid == sxid && ((XDPSPrivContext) ss->wh)->dpy == dpy) - return ((DPSSpace) ss); - - return (NIL); -} - - -XDPSStatusProc XDPSRegisterStatusProc (ctxt, statusProc) - DPSContext ctxt; - XDPSStatusProc statusProc; -{ - DPSPrivContext c = (DPSPrivContext) ctxt; - XDPSStatusProc old = c->statusProc; - - if (c->wh != NIL) c->statusProc = statusProc; - return old; -} - - -XDPSReadyProc XDPSRegisterReadyProc (ctxt, readyProc) - DPSContext ctxt; - XDPSReadyProc readyProc; -{ - DPSPrivContext c = (DPSPrivContext) ctxt; - XDPSReadyProc old = c->readyProc; - - if (c->wh != NIL) c->readyProc = readyProc; - return old; -} - - -void XDPSSetStatusMask(ctxt, enableMask, disableMask, nextMask) - DPSContext ctxt; - unsigned long enableMask, disableMask, nextMask; -{ - XDPSPrivContext xwh = (XDPSPrivContext) (((DPSPrivContext) ctxt)->wh); - - if (xwh != NIL && xwh->cxid != 0) - XDPSLSetStatusMask(xwh->dpy, xwh->cxid, enableMask, disableMask, nextMask); -} - - -int XDPSGetContextStatus(ctxt) - DPSContext ctxt; -{ - DPSPrivContext c = (DPSPrivContext) ctxt; - XDPSPrivContext xwh = (XDPSPrivContext) c->wh; - - if (xwh != NIL && xwh->cxid != 0) - return (XDPSLGetStatus(xwh->dpy, xwh->cxid)); - else - return (0); -} - -void XDPSNotifyWhenReady(ctxt, i0, i1, i2, i3) - DPSContext ctxt; - int i0, i1, i2, i3; -{ - DPSPrivContext c = (DPSPrivContext) ctxt; - XDPSPrivContext xwh = (XDPSPrivContext) c->wh; - int i[4]; - - i[0] = i0; - i[1] = i1; - i[2] = i2; - i[3] = i3; - - XDPSLNotifyWhenReady(xwh->dpy, xwh->cxid, i); -} - -void XDPSStatusEventHandler (e) - XDPSLStatusEvent *e; -{ - DPSPrivContext c = (DPSPrivContext) XDPSContextFromXID(e->display, e->cxid); - - if (c == NIL) - return; - - c->statusFromEvent = e->status; - if (e->status == PSZOMBIE) - { - c->zombie = true; - if (c->resultTable != NIL) /* Currently waiting for results */ - XDPSQuitBlocking = true; - } - - if (c->statusProc != NIL) - (*(c->statusProc)) ((DPSContext) c, e->status); -} - -void XDPSReadyEventHandler (e) - XDPSLReadyEvent *e; -{ - DPSPrivContext c = (DPSPrivContext) XDPSContextFromXID(e->display, e->cxid); - - if (c == NIL) - return; - - if (c->readyProc != NIL) - (*(c->readyProc)) ((DPSContext) c, e->val); -} - - - -void DPSWarnProc( - DPSContext ctxt, - char *msg) -{ - DPSErrorProc ep; - - if (DPSInitialize() != 0) return; - ep = DPSGetCurrentErrorBackstop(); - if (ep == NULL) ep = DPSDefaultErrorProc; - (*ep)(ctxt, dps_err_warning, (long unsigned int)msg, 0); -} - -void DPSFatalProc( - DPSContext ctxt, - char *msg) -{ - DPSErrorProc ep; - - if (DPSInitialize() != 0) return; - ep = DPSGetCurrentErrorBackstop(); - if (ep == NULL) ep = DPSDefaultErrorProc; - (*ep)(ctxt, dps_err_fatal, (long unsigned int)msg, 0); -} - -void DPSCantHappen(void) -{ - static int locked = 0; - char *msg = "assertion failure or DPSCantHappen"; - if (locked > 0) abort(); - ++locked; - DPSFatalProc((DPSContext)NULL, msg); - /* Fatal proc shouldn't return, but client can override and do anything. */ - --locked; -} - - -/* Procedures for delayed event dispatching */ - -DPSEventDelivery XDPSSetEventDelivery( - Display *dpy, - DPSEventDelivery newMode) -{ - Bool old = XDPSLGetPassEventsFlag(dpy); - - switch (newMode) { - case dps_event_pass_through: - XDPSLSetPassEventsFlag(dpy, True); - break; - case dps_event_internal_dispatch: - XDPSLSetPassEventsFlag(dpy, False); - break; - default: - break; - } - - if (old) return dps_event_pass_through; - else return dps_event_internal_dispatch; -} - -Bool XDPSIsStatusEvent( - XEvent *event, - DPSContext *ctxt, - int *status) -{ - Display *d = event->xany.display; - XExtCodes *c = XDPSLGetCodes(d); - XDPSLStatusEvent *se = (XDPSLStatusEvent *) event; - - if (c == NULL) return False; /* Not inited on that display; - must be False */ - - if (!c->first_event) /* Check CSDPS first */ - { - if (XDPSLGetCSDPSFakeEventType(d, event) == csdps_status) - { /* Check CSDPS first */ - XDPSLGetCSDPSStatus(d, event, (void **)ctxt, status); - return True; - } - else - return False; - } - - if (event->type != c->first_event + PSEVENTSTATUS) return False; - - if (ctxt != NULL) *ctxt = XDPSContextFromXID(d, se->cxid); - if (status != NULL) *status = se->status; - return True; -} - -Bool XDPSIsOutputEvent( - XEvent *event) -{ - Display *d = event->xany.display; - XExtCodes *c = XDPSLGetCodes(d); - CSDPSFakeEventTypes t; - - if (c == NULL) return False; /* Not inited on that display; - must be False */ - - if (!c->first_event) /* Check CSDPS first */ - { - if ((t = XDPSLGetCSDPSFakeEventType(d, event)) == csdps_output - || t == csdps_output_with_len) - return True; - else - return False; - } - - return event->type == c->first_event + PSEVENTOUTPUT; -} - -Bool XDPSIsDPSEvent( - XEvent *event) -{ - Display *d = event->xany.display; - XExtCodes *c = XDPSLGetCodes(d); - - if (c == NULL) return False; /* Not inited on that display; - must be False */ - - if (!c->first_event) /* Check CSDPS first */ - { - if (XDPSLGetCSDPSFakeEventType(d, event) != csdps_not) - return True; - else - return False; - } - - return event->type >= c->first_event && - event->type < c->first_event + NPSEVENTS; -} - -Bool XDPSDispatchEvent( - XEvent *event) -{ - Display *d = event->xany.display; - XExtCodes *c = XDPSLGetCodes(d); - CSDPSFakeEventTypes t; - - if (c == NULL) return False; /* Not inited on that display; - must be False */ - - if (!c->first_event) /* Check CSDPS first */ - { - if ((t = XDPSLGetCSDPSFakeEventType(d, event)) != csdps_not) - return(XDPSLDispatchCSDPSFakeEvent(d, event, t)); - else - return False; - } - - if (event->type == c->first_event + PSEVENTSTATUS) { - XDPSLCallStatusEventHandler(d, event); - } else if (event->type == c->first_event + PSEVENTOUTPUT) { - XDPSLCallOutputEventHandler(d, event); - } else if (event->type == c->first_event + PSEVENTREADY) { - XDPSLCallReadyEventHandler(d, event); - } else return False; - return True; -} - -/* L2-DPS/PROTO 9 addition */ -Bool XDPSIsReadyEvent( - XEvent *event, - DPSContext *ctxt, - int *val) -{ - Display *d = event->xany.display; - XExtCodes *c = XDPSLGetCodes(d); - XDPSLReadyEvent *re = (XDPSLReadyEvent *) event; - - if (c == NULL) return False; /* Not inited on that display; - must be False */ - - if (!c->first_event) /* Check CSDPS first */ - { - if (XDPSLGetCSDPSFakeEventType(d, event) == csdps_ready) - { - XDPSLGetCSDPSReady(d, event, (void **)ctxt, val); - return True; - } - else - return False; - } - - if (event->type != c->first_event + PSEVENTREADY) return False; - - if (ctxt != NULL) *ctxt = XDPSContextFromXID(d, re->cxid); - if (val != NULL) { - val[0] = re->val[0]; - val[1] = re->val[1]; - val[2] = re->val[2]; - val[4] = re->val[3]; - } - return True; -} - -int XDPSGetProtocolVersion( - Display *dpy) -{ - return XDPSLGetVersion(dpy); -} diff --git a/nx-X11/lib/dps/dpsXcmu.c b/nx-X11/lib/dps/dpsXcmu.c deleted file mode 100644 index 502649d51..000000000 --- a/nx-X11/lib/dps/dpsXcmu.c +++ /dev/null @@ -1,1602 +0,0 @@ -/* - * dpsXcmu.c -- Simple color management/allocation utility - * - * (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 - * - * Portions Copyright 1989 by the Massachusetts Institute of Technology - * - * Permission to use, copy, modify, and distribute this software and its - * documentation for any purpose and without fee is hereby granted, provided - * that the above copyright notice appear in all copies and that both that - * copyright notice and this permission notice appear in supporting - * documentation, and that the name of M.I.T. not be used in advertising - * or publicity pertaining to distribution of the software without specific, - * written prior permission. M.I.T. makes no representations about the - * suitability of this software for any purpose. It is provided "as is" - * without express or implied warranty. - * - * M.I.T. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL M.I.T. - * BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION - * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN - * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - * - * Author: Adobe Systems Incorporated and Donna Converse, MIT X Consortium - */ -/* $XFree86: xc/lib/dps/dpsXcmu.c,v 1.4 2000/09/26 15:56:59 tsi Exp $ */ - -#include <X11/X.h> -#include <X11/Xlib.h> -#include <X11/Xutil.h> -#include <X11/Xatom.h> -#include <X11/Xresource.h> -#include <X11/Xos.h> -#include <stdlib.h> -#include <stdio.h> -#include <pwd.h> - -#include "dpsassert.h" -#include "cslibint.h" - -/* Defines for standard colormap routines */ - -#define PrivSort qsort -#include <stddef.h> - -static char redsName[] = "reds"; -static char greensName[] = "greens"; -static char bluesName[] = "blues"; -static char graysName[] = "grays"; - -/* Database containing DPS default color cube values */ - -typedef struct _dpyRec { - Display *dpy; - XrmDatabase db; - Atom XA_GRAY_DEFAULT_MAP; - struct _dpyRec *next; -} DpyRec; - -static DpyRec *dpyRec = NULL; -static DpyRec *curDpyRec; -static DpyRec *FindDpyRec(Display *); - -typedef struct { - unsigned long *pixels; - int npixels; -} PixelRec; - -static Bool AllocateColor(Display *, Colormap, XColor *); -static Bool AllocateColormap(Display *, XStandardColormap *, XVisualInfo *, int *, PixelRec *, int *, int *, unsigned long); -static Bool CheckCube(XColor *, XColor *, XStandardColormap *); -static Bool CubicCube(XStandardColormap *); -static Bool GetColorCubeFromProperty(Display *, XVisualInfo *, XStandardColormap *, XStandardColormap **, int *); -static Bool GetGrayRampFromProperty(Display *, XVisualInfo *, XStandardColormap *, XStandardColormap **, int *); -Status XDPSCreateStandardColormaps(Display *, Drawable, Visual *, int, int, int, int, XStandardColormap *, XStandardColormap *, Bool); -static Status contiguous(unsigned long *, int, int *, unsigned long, int *, int *); -static XVisualInfo *PickCorrectVisual(Display *, XVisualInfo *, int, Colormap); -static int FindRampSize(XColor *, XColor *); -static long NumColors(char *, char *, char *); -static void AllocateColorCube(Display *, XVisualInfo *, XStandardColormap *, PixelRec *); -static void AllocateGrayRamp(Display *, XVisualInfo *, XStandardColormap *, XStandardColormap *, PixelRec *); -static void ColorValuesFromMask(unsigned long, unsigned long *, unsigned long *); -static void CreateDefaultsDb(Display *); -static void DefineProperty(Display *, XStandardColormap *, XVisualInfo *, XStandardColormap *, int, Atom); -static void FindStaticColorCube(Display *, XVisualInfo *, XStandardColormap *); -static void FindStaticGrayRamp(Display *, XVisualInfo *, XStandardColormap *, XStandardColormap *); -static void GetDatabaseValues(Display *, XVisualInfo *, XStandardColormap *, XStandardColormap *); -static void GetHomeDir(char *); -static void SetRamp(XColor *, XColor *, int, int *, unsigned long *); -static void ShrinkMapToFit(XStandardColormap *, int *, XVisualInfo *); -static void UseGrayCorners(XStandardColormap *, XStandardColormap *); -static void UseGrayDiagonal(XStandardColormap *, XStandardColormap *); - -#define SCALE 65535 -#undef ABS -#define ABS(x) ((x) < 0 ? -(x) : (x)) - -void XDPSGetDefaultColorMaps( - Display *dpy, - Screen *screen, - Drawable drawable, - XStandardColormap *colorCube, - XStandardColormap *grayRamp) -{ - Window root; - Visual *visual; - XStandardColormap g; - - /* If there is a screen specified, use it; otherwise use the drawable */ - - if (screen == NULL) { - if (drawable == None || ScreenCount(dpy) == 1) { - root = DefaultRootWindow(dpy); - screen = DefaultScreenOfDisplay(dpy); - } else { - /* Have to get the root for this drawable */ - int x, y; - int i; - unsigned int width, height, bwidth, depth; - if (!XGetGeometry(dpy, drawable, &root, &x, &y, &width, &height, - &bwidth, &depth)) root = DefaultRootWindow(dpy); - for (i = 0; - i < ScreenCount(dpy) && root != RootWindow(dpy, i); - i++) {} - screen = ScreenOfDisplay(dpy, i); - } - } else root = RootWindowOfScreen(screen); - - if (grayRamp == NULL) grayRamp = &g; - - visual = DefaultVisualOfScreen(screen); - grayRamp->colormap = DefaultColormapOfScreen(screen); - if (colorCube != NULL) colorCube->colormap = grayRamp->colormap; - - (void) XDPSCreateStandardColormaps(dpy, root, visual, - 0, 0, 0, 0, colorCube, grayRamp, True); -} - -Status XDPSCreateStandardColormaps( - Display *dpy, - Drawable drawable, - Visual *visual, - int reds, int greens, int blues, int grays, - XStandardColormap *colorCube, - XStandardColormap *grayRamp, - Bool retain) -{ - XVisualInfo vtemp, *vinfo; - int nvis; - XStandardColormap *propCube = NULL, *propRamp = NULL; - int nPropCube = 0, nPropRamp = 0; - Bool gotCube = False, gotRamp; - PixelRec pixels; - - if (grayRamp == NULL) return 0; - if (colorCube != NULL && - colorCube->colormap != grayRamp->colormap) return 0; - - if (dpy == NULL || (drawable == None && visual == NULL)) return 0; - - if (visual == NULL) { - XWindowAttributes attr; - if (XGetWindowAttributes(dpy, drawable, &attr) == 0) return 0; - visual = attr.visual; - } - - if (grayRamp->colormap == None && drawable == None) return 0; - - curDpyRec = FindDpyRec(dpy); - if (curDpyRec == NULL) return 0; - - vtemp.visualid = XVisualIDFromVisual(visual); - vinfo = XGetVisualInfo(dpy, VisualIDMask, &vtemp, &nvis); - if (nvis == 0) return 0; - - if (nvis > 1) { - vinfo = PickCorrectVisual(dpy, vinfo, nvis, grayRamp->colormap); - } - if (vinfo == NULL) return 0; - - if (grays <= 1) grayRamp->red_max = 0; - else grayRamp->red_max = grays - 1; - - if (colorCube != NULL) { - if (reds <= 1) colorCube->red_max = 0; - else colorCube->red_max = reds - 1; - if (greens <= 1) colorCube->green_max = 0; - else colorCube->green_max = greens - 1; - if (blues <= 1) colorCube->blue_max = 0; - else colorCube->blue_max = blues - 1; - } - - if ((vinfo->class == StaticGray || vinfo->class == GrayScale) && - colorCube != NULL) { - /* Can't do a color cube in a gray visual! */ - colorCube->red_max = colorCube->green_max = colorCube->blue_max = - colorCube->red_mult = colorCube->green_mult = colorCube->blue_mult = - colorCube->base_pixel = 0; - colorCube = NULL; - } - - if (retain) { - Display *newDpy = XOpenDisplay(XDisplayString(dpy)); - if (newDpy == NULL) retain = False; - else dpy = newDpy; - XGrabServer(dpy); - } - - if (grayRamp->colormap == None) { - grayRamp->colormap = XCreateColormap(dpy, drawable, vinfo->visual, - AllocNone); - if (colorCube != NULL) colorCube->colormap = grayRamp->colormap; - } - - if (colorCube != NULL) { - gotCube = GetColorCubeFromProperty(dpy, vinfo, colorCube, - &propCube, &nPropCube); - } - gotRamp = GetGrayRampFromProperty(dpy, vinfo, grayRamp, - &propRamp, &nPropRamp); - - if (!gotRamp || (colorCube != NULL && !gotCube)) { - /* Couldn't find at least one thing we wanted, so let's look in the - database */ - - GetDatabaseValues(dpy, vinfo, colorCube, grayRamp); - - pixels.pixels = NULL; - pixels.npixels = 0; - - if (colorCube != NULL) { - if (colorCube->red_max != 0) { - AllocateColorCube(dpy, vinfo, colorCube, &pixels); - } - if (colorCube->red_max == 0) { - colorCube->green_max = colorCube->blue_max = - colorCube->red_mult = colorCube->green_mult = - colorCube->blue_mult = 0; - } - } - - if (grayRamp->red_max != 0) { - AllocateGrayRamp(dpy, vinfo, grayRamp, colorCube, &pixels); - } - - if (pixels.pixels != NULL) { - if (pixels.npixels != 0) { - XFreeColors(dpy, grayRamp->colormap, - pixels.pixels, pixels.npixels, 0); - } - free((char *) pixels.pixels); - } - - if (retain) { - Pixmap p; - - /* Create something to put in killid field so the entries can - be deleted sometime */ - p = XCreatePixmap(dpy, RootWindow(dpy, vinfo->screen), 1, 1, 1); - if (colorCube != NULL && !gotCube && colorCube->red_max != 0) { - colorCube->visualid = vinfo->visualid; - colorCube->killid = p; - DefineProperty(dpy, colorCube, vinfo, propCube, nPropCube, - XA_RGB_DEFAULT_MAP); - } - if (!gotRamp && grayRamp->red_max != 0) { - grayRamp->visualid = vinfo->visualid; - grayRamp->killid = p; - DefineProperty(dpy, grayRamp, vinfo, propRamp, nPropRamp, - (vinfo->class == GrayScale ? XA_RGB_GRAY_MAP : - curDpyRec->XA_GRAY_DEFAULT_MAP)); - } - XSetCloseDownMode(dpy, RetainTemporary); - } - } - - if (grayRamp->red_max == 0) { - /* Use special magic values. If this is a default colormap, - the server recognizes a gray ramp with red_max=1, red_mult=1, - base_pixel=0 to mean a 2 gray ramp with BlackPixel being - the lowest intensity gray and WhitePixel being the highest - intensity gray. If it's not a default colormap, then the - server will either generate a BadValue error, or just happily - use pixel values 0 and 1; either is better than the alternative, - silently converting into a null device. */ - grayRamp->red_max = 1; - grayRamp->red_mult = 1; - grayRamp->base_pixel = 0; - } - - if (retain) { - XUngrabServer(dpy); - XCloseDisplay(dpy); - } - if (propCube != NULL) XFree((void *) propCube); - if (propRamp != NULL) XFree((void *) propRamp); - XFree((void *) vinfo); - return 1; -} - -static DpyRec *FindDpyRec(Display *dpy) -{ - DpyRec *d; - - for (d = dpyRec; d != NULL; d = d->next) { - if (d->dpy == dpy) return d; - } - - d = (DpyRec *) malloc(sizeof(DpyRec)); - if (d == NULL) return NULL; - d->XA_GRAY_DEFAULT_MAP = XInternAtom(dpy, "DEFAULT_GRAY", False); - d->db = NULL; - d->next = dpyRec; - dpyRec = d; - return d; -} - -static XVisualInfo *PickCorrectVisual( - Display *dpy, - XVisualInfo *vlist, - int n, - Colormap cmap) -{ - register int i; - register int screen_number; - Bool def_cmap = False; - - /* A visual id may be valid on multiple screens. Also, there may - * be multiple visuals with identical visual ids at different depths. - * If the colormap is the Default Colormap, use the Default Visual. - * Otherwise, arbitrarily, use the deepest visual. - */ - - for (screen_number = ScreenCount(dpy); --screen_number >= 0; /**/) { - if (cmap == DefaultColormap(dpy, screen_number)) { - def_cmap = True; - break; - } - } - - if (def_cmap) { - for (i = 0; i < n; i++, vlist++) { - if (vlist->visual == DefaultVisual(dpy, screen_number)) { - return vlist; - } - } - return NULL; /* Visual does not match colormap */ - } else { - int maxdepth = 0; - XVisualInfo *v = 0; - - for (i = 0; i < n; i++, vlist++) { - if (vlist->depth > maxdepth) { - maxdepth = vlist->depth; - v = vlist; - } - } - return v; - } -} - -/* Do some rudimentary checking of the properties to avoid obviously bad ones. - How did they get there, anyway? */ - -static Bool ValidCube( - XStandardColormap *c, - XVisualInfo *vinfo) -{ - unsigned long max = 1 << vinfo->depth; - unsigned long pixel; - - if (c->red_max < 1 || c->green_max < 1 || c->blue_max < 1) return False; - if (c->base_pixel > max) return False; - pixel = (c->red_max * c->red_mult + c->green_max * c->green_mult + - c->blue_max * c->blue_mult + c->base_pixel) & 0xFFFFFFFF; - if (pixel > max) return False; - - return True; -} - -static Bool ValidRamp( - XStandardColormap *c, - XVisualInfo *vinfo) -{ - unsigned long max = 1 << vinfo->depth; - unsigned long pixel; - - if (c->red_max < 1) return False; - if (c->base_pixel > max) return False; - pixel = (c->red_max * c->red_mult + c->base_pixel) & 0xFFFFFFFF; - if (pixel > max) return False; - - return True; -} - -static Bool GetColorCubeFromProperty( - Display *dpy, - XVisualInfo *vinfo, - XStandardColormap *colorCube, - XStandardColormap **cube, - int *ncube) -{ - int gotCube; - int i; - register XStandardColormap *c; - - gotCube = XGetRGBColormaps(dpy, RootWindow(dpy, vinfo->screen), cube, - ncube, XA_RGB_DEFAULT_MAP); - - if (gotCube) { - /* Try to find a match with the visual */ - c = *cube; - for (i = 0; i < *ncube; i++) { - if (c->colormap == colorCube->colormap && - c->visualid == vinfo->visualid && - ValidCube(c, vinfo)) { - colorCube->red_max = c->red_max; - colorCube->red_mult = c->red_mult; - colorCube->green_max = c->green_max; - colorCube->green_mult = c->green_mult; - colorCube->blue_max = c->blue_max; - colorCube->blue_mult = c->blue_mult; - colorCube->base_pixel = c->base_pixel; - colorCube->visualid = c->visualid; - colorCube->killid = c->killid; - break; - } - c++; - } - if (i == *ncube) gotCube = False; - } - return gotCube; -} - -static Bool GetGrayRampFromProperty( - Display *dpy, - XVisualInfo *vinfo, - XStandardColormap *grayRamp, - XStandardColormap **ramp, - int *nramp) -{ - int gotRamp; - int i; - Atom grayAtom; - register XStandardColormap *c; - - if (vinfo->class == GrayScale) grayAtom = XA_RGB_GRAY_MAP; - else grayAtom = curDpyRec->XA_GRAY_DEFAULT_MAP; - - gotRamp = XGetRGBColormaps(dpy, RootWindow(dpy, vinfo->screen), ramp, - nramp, grayAtom); - - if (gotRamp) { - /* Try to find a match with the visual */ - c = *ramp; - for (i = 0; i < *nramp; i++) { - if (c->colormap == grayRamp->colormap && - c->visualid == vinfo->visualid && - ValidRamp(c, vinfo)) { - grayRamp->red_max = c->red_max; - grayRamp->red_mult = c->red_mult; - grayRamp->base_pixel = c->base_pixel; - grayRamp->visualid = c->visualid; - grayRamp->killid = c->killid; - break; - } - c++; - } - if (i == *nramp) gotRamp = False; - } - return gotRamp; -} - -static void GetDatabaseValues( - Display *dpy, - XVisualInfo *vinfo, - XStandardColormap *colorCube, - XStandardColormap *grayRamp) -{ - char *class, *depth; - char namePrefix[40], classPrefix[40]; - unsigned long max; - XStandardColormap fakeCube; - - switch (vinfo->class) { - default: - case StaticGray: class = "StaticGray."; break; - case GrayScale: class = "GrayScale."; break; - case StaticColor: class = "StaticColor."; break; - case PseudoColor: class = "PseudoColor."; break; - case TrueColor: class = "TrueColor."; break; - case DirectColor: class = "DirectColor."; break; - } - - if (vinfo->depth >= 24) depth = "24."; - else if (vinfo->depth >= 12) depth = "12."; - else if (vinfo->depth >= 8) depth = "8."; - else if (vinfo->depth >= 4) depth = "4."; - else if (vinfo->depth >= 2) depth = "2."; - else depth = "1."; - - (void) strcpy(namePrefix, "dpsColorCube."); - (void) strcat(strcat(namePrefix, class), depth); - (void) strcpy(classPrefix, "DPSColorCube."); - (void) strcat(strcat(classPrefix, class), depth); - - CreateDefaultsDb(dpy); - - if (colorCube == NULL && vinfo->class == TrueColor) { - /* We'll need the color cube information to compute the gray ramp, - even if it wasn't asked for, so make colorCube point to a - temporary structure */ - colorCube = &fakeCube; - } - - if (colorCube != NULL) { - switch (vinfo->class) { - case StaticGray: - case GrayScale: - /* We can't do a color cube for these visuals */ - break; - - case TrueColor: - /* Rewrite whatever was there before with real values */ - ColorValuesFromMask(vinfo->red_mask, &colorCube->red_max, - &colorCube->red_mult); - ColorValuesFromMask(vinfo->green_mask, &colorCube->green_max, - &colorCube->green_mult); - ColorValuesFromMask(vinfo->blue_mask, &colorCube->blue_max, - &colorCube->blue_mult); - colorCube->base_pixel = 0; - break; - - case DirectColor: - /* Get the mults from the masks; ignore maxes */ - ColorValuesFromMask(vinfo->red_mask, &max, - &colorCube->red_mult); - ColorValuesFromMask(vinfo->green_mask, &max, - &colorCube->green_mult); - ColorValuesFromMask(vinfo->blue_mask, &max, - &colorCube->blue_mult); - /* Get the maxes from the database */ - if (colorCube->red_max == 0) { - colorCube->red_max = - NumColors(namePrefix, classPrefix, redsName) - 1; - } - if (colorCube->green_max == 0) { - colorCube->green_max = - NumColors(namePrefix, classPrefix, greensName) - 1; - } - if (colorCube->blue_max == 0) { - colorCube->blue_max = - NumColors(namePrefix, classPrefix, bluesName) - 1; - } - colorCube->base_pixel = 0; - break; - - case PseudoColor: - if (colorCube->red_max == 0) { - colorCube->red_max = - NumColors(namePrefix, classPrefix, redsName) - 1; - } - if (colorCube->green_max == 0) { - colorCube->green_max = - NumColors(namePrefix, classPrefix, greensName) - 1; - } - if (colorCube->blue_max == 0) { - colorCube->blue_max = - NumColors(namePrefix, classPrefix, bluesName) - 1; - } - colorCube->red_mult = (colorCube->green_max + 1) * - (colorCube->blue_max + 1); - colorCube->green_mult = colorCube->blue_max + 1; - colorCube->blue_mult = 1; - break; - - case StaticColor: - FindStaticColorCube(dpy, vinfo, colorCube); - break; - } - } - - switch (vinfo->class) { - case GrayScale: - case PseudoColor: - case DirectColor: - if (grayRamp->red_max == 0) { - grayRamp->red_max = - NumColors(namePrefix, classPrefix, graysName) - 1; - } - grayRamp->red_mult = 1; - break; - - case TrueColor: - /* If the color cube is truly a cube, use its diagonal. Otherwise - were SOL and have to use a two-element ramp. */ - if (CubicCube(colorCube)) UseGrayDiagonal(colorCube, grayRamp); - else UseGrayCorners(colorCube, grayRamp); - break; - - case StaticColor: - case StaticGray: - FindStaticGrayRamp(dpy, vinfo, grayRamp, colorCube); - break; - } -} - -static Bool CubicCube(XStandardColormap *cube) -{ - return cube->red_max == cube->green_max && cube->red_max == - cube->blue_max; -} - -static void UseGrayDiagonal(XStandardColormap *cube, XStandardColormap *ramp) -{ - ramp->red_max = cube->red_max; - ramp->red_mult = cube->red_mult + cube->green_mult + cube->blue_mult; - ramp->base_pixel = cube->base_pixel; -} - -static void UseGrayCorners(XStandardColormap *cube, XStandardColormap *ramp) -{ - ramp->red_max = 1; - ramp->red_mult = (cube->red_max + 1) * (cube->green_max + 1) * - (cube->blue_max + 1) - 1; - if (* (int *) &(cube->red_mult) < 0) ramp->red_mult *= -1; - ramp->base_pixel = cube->base_pixel; -} - -static void ColorValuesFromMask( - unsigned long mask, - unsigned long *maxColor, - unsigned long *mult) -{ - *mult = 1; - while ((mask & 1) == 0) { - *mult <<= 1; - mask >>= 1; - } - *maxColor = mask; -} - -/* -Resource definitions for default color cube / gray ramp sizes -are based on visual class and depth. Working from least choices -to most, here's motivation for the defaults: - -If unspecified, default is 0 values for red, green, and blue, -and 2 (black and white) for grays. This covers StaticGray, StaticColor, -and depths less than 4 of the other visual classes. - -If we have a choice, we try to allocate a gray ramp with an odd number -of colors; this is so 50% gray can be rendered without dithering. -In general we don't want to allocate a large cube (even when many -colormap entries are available) because allocation of each entry -requires a round-trip to the server (entries allocated read-only -via XAllocColor). - -For GrayScale, any depth less than 4 is treated as monochrome. - -PseudoColor depth 4 we try for a 2x2x2 cube with the gray ramp on -the diagonal. Depth 8 uses a 4x4x4 cube with a separate 9 entry -gray ramp. Depth 12 uses a 6x6x5 "cube" with a separate 17 entry gray -ramp. The cube is non-symmetrical; we don't want to use the diagonal -for a gray ramp and we can get by with fewer blues than reds or greens. - -For DirectColor, allocating a gray ramp separate from the color cube -is wasteful of map entries, so we specify a symmetrical cube and -share the diagonal entries for the gray ramp. - -For TrueColor, # color shades is set equal to the # shades / primary; -we don't actually allocate map entries, but it's handy to be able to -do the resource lookup blindly and get the right value. -*/ - -static char dpsDefaults[] = "\ -*reds: 0\n\ -*greens: 0\n\ -*blues: 0\n\ -*grays: 2\n\ -\ -*GrayScale.4.grays: 9\n\ -*GrayScale.8.grays: 17\n\ -\ -*PseudoColor.4.reds: 2\n\ -*PseudoColor.4.greens: 2\n\ -*PseudoColor.4.blues: 2\n\ -*PseudoColor.4.grays: 2\n\ -*PseudoColor.8.reds: 4\n\ -*PseudoColor.8.greens: 4\n\ -*PseudoColor.8.blues: 4\n\ -*PseudoColor.8.grays: 9\n\ -*PseudoColor.12.reds: 6\n\ -*PseudoColor.12.greens: 6\n\ -*PseudoColor.12.blues: 5\n\ -*PseudoColor.12.grays: 17\n\ -\ -*DirectColor.8.reds: 4\n\ -*DirectColor.8.greens: 4\n\ -*DirectColor.8.blues: 4\n\ -*DirectColor.8.grays: 4\n\ -*DirectColor.12.reds: 6\n\ -*DirectColor.12.greens: 6\n\ -*DirectColor.12.blues: 6\n\ -*DirectColor.12.grays: 6\n\ -*DirectColor.24.reds: 7\n\ -*DirectColor.24.greens: 7\n\ -*DirectColor.24.blues: 7\n\ -*DirectColor.24.grays: 7\n\ -\ -*TrueColor.12.reds: 16\n\ -*TrueColor.12.greens: 16\n\ -*TrueColor.12.blues: 16\n\ -*TrueColor.12.grays: 16\n\ -*TrueColor.24.reds: 256\n\ -*TrueColor.24.greens: 256\n\ -*TrueColor.24.blues: 256\n\ -*TrueColor.24.grays: 256\n\ -"; - -static XrmDatabase defaultDB = NULL; - -static void CreateDefaultsDb(Display *dpy) -{ - char home[256], *dpyDefaults; - - if (defaultDB == NULL) defaultDB = XrmGetStringDatabase(dpsDefaults); - - if (curDpyRec->db != NULL) return; - - dpyDefaults = XResourceManagerString(dpy); - if (dpyDefaults != NULL) { - curDpyRec->db = XrmGetStringDatabase(dpyDefaults); - } - - if (curDpyRec->db == NULL) { - GetHomeDir(home); - strcpy(home, "/.Xdefaults"); - curDpyRec->db = XrmGetFileDatabase(home); - } -} - -static void GetHomeDir(char *buf) -{ -#ifndef X_NOT_POSIX - uid_t uid; -#else - int uid; - extern int getuid(); -#ifndef SYSV386 - extern struct passwd *getpwuid(), *getpwnam(); -#endif -#endif - struct passwd *pw; - static char *ptr = NULL; - - if (ptr == NULL) { - if (!(ptr = getenv("HOME"))) { - if ((ptr = getenv("USER")) != 0) pw = getpwnam(ptr); - else { - uid = getuid(); - pw = getpwuid(uid); - } - if (pw) ptr = pw->pw_dir; - else { - ptr = NULL; - *buf = '\0'; - } - } - } - - if (ptr) - (void) strcpy(buf, ptr); - - buf += strlen(buf); - *buf = '/'; - buf++; - *buf = '\0'; - return; -} - -static long NumColors(char *namePrefix, char *classPrefix, char *color) -{ - char name[40], class[40]; - XrmValue rtnValue; - char *rtnType; - long value; - - (void) strcpy(name, namePrefix); - (void) strcpy(class, classPrefix); - if (! XrmGetResource(curDpyRec->db, strcat(name, color), - strcat(class, color), &rtnType, &rtnValue)) { - if (! XrmGetResource(defaultDB, name, class, &rtnType, &rtnValue)) { - /* This should never happen, as our defaults cover all cases */ - return 0; - } - } - - /* Resource value is number of shades of specified color. If value - is not an integer, atoi returns 0, so we return 0. If value - is less than 2, it is invalid (need at least 2 shades of a color). - Explicitly setting 0 is ok for colors (means to not use a color - cube) but merits a warning for gray. */ - - if (strcmp(rtnValue.addr, "0") == 0 && strcmp(color, "grays") != 0) { - return 0; - } - - value = atol(rtnValue.addr); - if (value < 2) { - char mbuf[512]; - sprintf(mbuf, "%% Value '%s' is invalid for %s resource\n", - rtnValue.addr, name); - DPSWarnProc(NULL, mbuf); - } - return value; -} - -/* Query the entire colormap in the static color case, then try to find - a color cube. Check pairs of black and white cells trying to find - a cube between them and take the first one you find. */ - -static void FindStaticColorCube( - Display *dpy, - XVisualInfo *vinfo, - XStandardColormap *colorCube) -{ - XColor *ramp, *black, *white, *altBlack, *altWhite; - int i, entries; - - entries = 1 << vinfo->depth; - ramp = (XColor *) calloc(entries, sizeof(XColor)); - - if (ramp == NULL) { - colorCube->red_max = 0; - return; - } - - /* Query the colormap */ - for (i = 0; i < entries; i++) ramp[i].pixel = i; - XQueryColors(dpy, colorCube->colormap, ramp, entries); - - /* Find the white and black entries */ - - black = white = altBlack = altWhite = NULL; - for (i = 0; i < entries; i++) { - if (ramp[i].flags != (DoRed | DoBlue | DoGreen)) continue; - if (ramp[i].red == 0 && ramp[i].blue == 0 && - ramp[i].green == 0) { - if (black == NULL) black = ramp+i; - else if (altBlack == NULL) altBlack = ramp+i; - } else if (ramp[i].red == SCALE && ramp[i].blue == SCALE && - ramp[i].green == SCALE) { - if (white == NULL) white = ramp+i; - else if (altWhite == NULL) altWhite = ramp+i; - } - } - - if (black == NULL || white == NULL) { - colorCube->red_max = 0; - free(ramp); - return; - } - - /* Look for cubes between pairs of black & white */ - if (!CheckCube(black, white, colorCube) && - !CheckCube(altBlack, white, colorCube) && - !CheckCube(black, altWhite, colorCube) && - !CheckCube(altBlack, altWhite, colorCube)) { - colorCube->red_max = 0; - } - - free(ramp); -} - -#define R 1 -#define G 2 -#define B 4 -#define C 8 -#define M 16 -#define Y 32 - -#define SMALLSCALE 255 -#define CheckColor(color,r,g,b) ((((color)->red >> 8) == (r) * SMALLSCALE) && \ - (((color)->green >> 8) == (g) * SMALLSCALE) && \ - (((color)->blue >> 8) == (b) * SMALLSCALE)) - -static Bool CheckCube( - XColor *black, - XColor *white, - XStandardColormap *cube) -{ - int r = 0, g = 0, b = 0, c = 0, m = 0, y = 0, k, w; - XColor *color; - unsigned int found = 0; - int small, middle, large; - int smallMult, smallMax, middleMult, middleMax, largeMult, largeMax; - Bool backwards = False; - int mult = 1; - XStandardColormap test; /* Test cube */ - int i; - int size; - - if (black == NULL || white == NULL) return False; - - k = black->pixel; - w = white->pixel - k; - - size = ABS(w); - if (w < 0) { - backwards = True; - mult = -1; - } - - for (i = 1; i < size; i++) { - color = black + i*mult; - if (color->flags != (DoRed | DoBlue | DoGreen)) return False; - - /* If black or white is in the middle of the cube, can't work */ - if (CheckColor(color, 0, 0, 0)) return False; - if (CheckColor(color, 1, 1, 1)) return False; - - /* Check for red, green, blue, cyan, magenta, and yellow */ - if (CheckColor(color, 1, 0, 0)) {r = color->pixel-k; found |= R;} - else if (CheckColor(color, 0, 1, 0)) {g = color->pixel-k; found |= G;} - else if (CheckColor(color, 0, 0, 1)) {b = color->pixel-k; found |= B;} - else if (CheckColor(color, 0, 1, 1)) {c = color->pixel-k; found |= C;} - else if (CheckColor(color, 1, 0, 1)) {m = color->pixel-k; found |= M;} - else if (CheckColor(color, 1, 1, 0)) {y = color->pixel-k; found |= Y;} - } - - /* If any color is missing no cube is possible */ - if (found != (R | G | B | C | M | Y)) return False; - - /* Next test. Make sure B + G = C, R + B = M, R + G = Y, - and R + G + B = W */ - if (b + g != c) return False; - if (r + b != m) return False; - if (r + g != y) return False; - if (r + g + b != w) return False; - - /* Looking good! Compensate for backwards cubes */ - if (backwards) { - w = ABS(w); - r = ABS(r); - g = ABS(g); - b = ABS(b); - } - - /* Find the smallest, middle, and largest difference */ - if (r < b && b < g) { - small = r; middle = b; large = g; - } else if (r < g && g < b) { - small = r; middle = g; large = b; - } else if (b < r && r < g) { - small = b; middle = r; large = g; - } else if (b < g && g < r) { - small = b; middle = g; large = r; - } else if (g < r && r < b) { - small = g; middle = r; large = b; - } else { - small = g; middle = b; large = r; - } - - /* The smallest must divide the middle, and the middle the large */ - if ((middle % (small + 1)) != 0) return False; - if ((large % (small + middle + 1)) != 0) return False; - - /* OK, we believe we have a cube. Compute the description */ - smallMult = 1; - smallMax = small; - middleMult = small + 1; - middleMax = middle / middleMult; - largeMult = small + middle + 1; - largeMax = large / largeMult; - - if (small == r) { - test.red_max = smallMax; test.red_mult = smallMult; - if (middle == b) { - test.blue_max = middleMax; test.blue_mult = middleMult; - test.green_max = largeMax; test.green_mult = largeMult; - } else { - test.green_max = middleMax; test.green_mult = middleMult; - test.blue_max = largeMax; test.blue_mult = largeMult; - } - } else if (small == g) { - test.green_max = smallMax; test.green_mult = smallMult; - if (middle == b) { - test.blue_max = middleMax; test.blue_mult = middleMult; - test.red_max = largeMax; test.red_mult = largeMult; - } else { - test.red_max = middleMax; test.red_mult = middleMult; - test.blue_max = largeMax; test.blue_mult = largeMult; - } - } else { /* small == b */ - test.blue_max = smallMax; test.blue_mult = smallMult; - if (middle == r) { - test.red_max = middleMax; test.red_mult = middleMult; - test.green_max = largeMax; test.green_mult = largeMult; - } else { - test.green_max = middleMax; test.green_mult = middleMult; - test.red_max = largeMax; test.red_mult = largeMult; - } - } - - /* Re-compensate for backwards cube */ - if (backwards) { - test.red_mult *= -1; - test.green_mult *= -1; - test.blue_mult *= -1; - } - - /* Finally, test the hypothesis! The answer must be correct within 1 - bit. Only look at the top 8 bits; the others are too noisy */ - - for (i = 1; i < size; i++) { -#define calc(i, max, mult) ((((i / test.mult) % \ - (test.max + 1)) * SCALE) / test.max) - r = ((unsigned short) calc(i, red_max, red_mult) >> 8) - - (black[i*mult].red >> 8); - g = ((unsigned short) calc(i, green_max, green_mult) >> 8) - - (black[i*mult].green >> 8); - b = ((unsigned short) calc(i, blue_max, blue_mult) >> 8) - - (black[i*mult].blue >> 8); -#undef calc - if (ABS(r) > 2 || ABS(g) > 2 || ABS(b) > 2) return False; - } - cube->red_max = test.red_max; - cube->red_mult = test.red_mult; - cube->green_max = test.green_max; - cube->green_mult = test.green_mult; - cube->blue_max = test.blue_max; - cube->blue_mult = test.blue_mult; - cube->base_pixel = k; - return True; -} - -#undef R -#undef G -#undef B -#undef C -#undef M -#undef Y - -/* Query the entire colormap in the static gray case, then try to find - a gray ramp. This handles there being 2 white or black entries - in the colormap and finds the longest linear ramp between pairs of - white and black. If there is a color cube, also check its diagonal and - use its corners if we need to */ - -static void FindStaticGrayRamp( - Display *dpy, - XVisualInfo *vinfo, - XStandardColormap *grayRamp, - XStandardColormap *colorCube) -{ - XColor *ramp, *black, *white, *altBlack, *altWhite; - int i, r0, r1, r2, r3, size, entries, redMult; - unsigned long base; - - entries = 1 << vinfo->depth; - ramp = (XColor *) calloc(entries, sizeof(XColor)); - - if (ramp == NULL) { - grayRamp->red_max = 0; - return; - } - - /* Query the colormap */ - for (i = 0; i < entries; i++) ramp[i].pixel = i; - XQueryColors(dpy, grayRamp->colormap, ramp, entries); - - /* Find the white and black entries */ - - black = white = altBlack = altWhite = NULL; - for (i = 0; i < entries; i++) { - if (ramp[i].flags != (DoRed | DoBlue | DoGreen)) continue; - if (CheckColor(ramp+i, 0, 0, 0)) { - if (black == NULL) black = ramp+i; - else if (altBlack == NULL) altBlack = ramp+i; - } else if (CheckColor(ramp+i, 1, 1, 1)) { - if (white == NULL) white = ramp+i; - else if (altWhite == NULL) altWhite = ramp+i; - } - } - - if (black == NULL || white == NULL) { - grayRamp->red_max = 0; - free(ramp); - return; - } - - /* Find out how large a ramp exists between pairs of black & white */ - r0 = FindRampSize(black, white); - r1 = FindRampSize(altBlack, white); - r2 = FindRampSize(black, altWhite); - r3 = FindRampSize(altBlack, altWhite); - - size = r0; - if (r1 > size) size = r1; - if (r2 > size) size = r2; - if (r3 > size) size = r3; - if (size == r0) SetRamp(black, white, size, &redMult, &base); - else if (size == r1) SetRamp(altBlack, white, size, &redMult, &base); - else if (size == r2) SetRamp(black, altWhite, size, &redMult, &base); - else if (size == r3) SetRamp(altBlack, altWhite, size, &redMult, &base); - - if (colorCube != NULL && CubicCube(colorCube) && - colorCube->red_max > size) { - UseGrayDiagonal(colorCube, grayRamp); - } else { - grayRamp->red_max = size; - grayRamp->red_mult = redMult; - grayRamp->base_pixel = base; - } - - free(ramp); -} - -static int FindRampSize(XColor *black, XColor *white) -{ - XColor *c; - int r; - int mult = 1; - int i, size; - - if (black == NULL || white == NULL) return 0; - size = ABS(white - black); - - /* See if we have a backwards ramp */ - if (black > white) mult = -1; - - /* See if all cells between black and white are linear, to within 1 bit. - Only look at the high order 8 bits */ - - for (i = 1; i < size; i++) { - c = &black[i*mult]; - if (c->red != c->blue || c->red != c->green) return 1; - r = ((unsigned short) ((i * SCALE) / size) >> 8) - (c->red >> 8); - if (ABS(r) > 2) return 1; - } - return size; -} - -static void SetRamp( - XColor *black, - XColor *white, - int size, - int *mult, - unsigned long *base) -{ - *base = black->pixel; - *mult = (white - black) / size; -} - -#define lowbit(x) ((x) & (~(x) + 1)) - -static unsigned long shiftdown(unsigned long x) -{ - while ((x & 1) == 00) { - x = x >> 1; - } - return x; -} - -static void AllocateColorCube( - Display *dpy, - XVisualInfo *vinfo, - XStandardColormap *colorCube, - PixelRec *pixels) -{ - int count, first, remain, n, j; - unsigned long i; - Colormap cmap = colorCube->colormap; - unsigned long delta; - XColor color; - - /* We do no allocation for TrueColor or StaticColor */ - if (vinfo->class == TrueColor || vinfo->class == StaticColor) return; - - if (vinfo->class == DirectColor) { - if ((i = shiftdown(vinfo->red_mask)) > colorCube->red_max) - colorCube->red_max = i; - if ((i = shiftdown(vinfo->green_mask)) > colorCube->green_max) - colorCube->green_max = i; - if ((i = shiftdown(vinfo->blue_mask)) > colorCube->blue_max) - colorCube->blue_max = i; - - /* We only handle symmetric DirectColor */ - count = colorCube->red_max + 1; - if (colorCube->blue_max + 1 < count) count = colorCube->blue_max + 1; - if (colorCube->green_max + 1 < count) count = colorCube->green_max + 1; - colorCube->red_max = colorCube->blue_max = colorCube->green_max = - count - 1; - - delta = lowbit(vinfo->red_mask) + lowbit(vinfo->green_mask) + - lowbit(vinfo->blue_mask); - } else { - count = (colorCube->red_max + 1) * (colorCube->blue_max + 1) * - (colorCube->green_max + 1); - delta = 1; - } - - colorCube->base_pixel = 0; /* temporary, may change */ - - pixels->pixels = (unsigned long *) calloc(vinfo->colormap_size, - sizeof(unsigned long)); - if (pixels->pixels == NULL) { - colorCube->red_max = 0; - return; - } - - if (!AllocateColormap(dpy, colorCube, vinfo, &count, pixels, - &first, &remain, delta)) { - free((char *) pixels->pixels); - pixels->pixels = NULL; - colorCube->red_max = 0; - return; - } - - colorCube->base_pixel = pixels->pixels[first]; - color.flags = DoRed | DoGreen | DoBlue; - - /* Define colors */ - for (n = 0, j = 0; j < count; ++j, n += delta) { - color.pixel = n + pixels->pixels[first]; - if (vinfo->class == PseudoColor) { -#define calc(i, max, mult) ((((i / colorCube->mult) % \ - (colorCube->max + 1)) * SCALE) / colorCube->max) - color.red = (unsigned short) calc(n, red_max, red_mult); - color.green = (unsigned short) calc(n, green_max, green_mult); - color.blue = (unsigned short) calc(n, blue_max, blue_mult); -#undef calc - } else { - color.red = color.green = color.blue = - (j * SCALE) / colorCube->red_max; - } - if (!AllocateColor(dpy, cmap, &color)) { - XFreeColors(dpy, cmap, pixels->pixels, count+first+remain, 0); - free((char *) pixels->pixels); - pixels->pixels = NULL; - colorCube->red_max = 0; - return; - } - } - - /* Smush down unused pixels, if any */ - - for (j = 0; j < remain; j++) { - pixels->pixels[first+j] = pixels->pixels[first+count+j]; - } - pixels->npixels -= count; -} - -static void AllocateGrayRamp( - Display *dpy, - XVisualInfo *vinfo, - XStandardColormap *grayRamp, - XStandardColormap *colorCube, - PixelRec *pixels) -{ - int count, first, remain, n, i; - Colormap cmap = grayRamp->colormap; - XColor color; - unsigned long delta; - - /* Allocate cells in read/write visuals only */ - if (vinfo->class != PseudoColor && vinfo->class != GrayScale && - vinfo->class != DirectColor) return; - - if (vinfo->class == DirectColor) { - delta = lowbit(vinfo->red_mask) + lowbit(vinfo->green_mask) + - lowbit(vinfo->blue_mask); - } else delta = 1; - - /* First of all see if there's a usable gray ramp in the color cube */ - - if (colorCube != NULL) { - if (CubicCube(colorCube)) { - if (colorCube->red_max >= grayRamp->red_max) { - /* diagonal is long enough! use it */ - UseGrayDiagonal(colorCube, grayRamp); - return; - } - } - } - - grayRamp->base_pixel = 0; /* temporary, may change */ - - count = grayRamp->red_max + 1; - - if (pixels->pixels == NULL) { - pixels->pixels = (unsigned long *) calloc(vinfo->colormap_size, - sizeof(unsigned long)); - if (pixels->pixels == NULL) { - grayRamp->red_max = 0; - return; - } - } - - if (!AllocateColormap(dpy, grayRamp, vinfo, &count, pixels, - &first, &remain, delta)) { - /* Last gasp: try any diagonal or the corners of the color cube */ - if (colorCube != NULL) { - if (CubicCube(colorCube)) UseGrayDiagonal(colorCube, grayRamp); - else UseGrayCorners(colorCube, grayRamp); - } else { - grayRamp->red_max = 0; - } - return; - } - - grayRamp->base_pixel = pixels->pixels[first]; - color.flags = DoRed | DoGreen | DoBlue; - - /* Define colors */ - for (n = 0, i = 0; i < count; ++i, n += delta) { - color.pixel = n + pixels->pixels[first]; - color.red = (unsigned short)((n * SCALE) / (grayRamp->red_max)); - color.green = color.red; - color.blue = color.red; - - if (!AllocateColor(dpy, cmap, &color)) { - /* Don't need to free pixels here; we'll do it on return */ - grayRamp->red_max = 0; - return; - } - } - - /* Smush down unused pixels, if any */ - - for (i = 0; i < remain; i++) { - pixels->pixels[first+i] = pixels->pixels[first+count+i]; - } - pixels->npixels -= count; -} - -static int compare(const void *a1, const void *a2) -{ - register unsigned long *e1 = (unsigned long *) a1, - *e2 = (unsigned long *) a2; - - if (*e1 < *e2) return -1; - if (*e1 > *e2) return 1; - return 0; -} - -static Bool AllocateColormap( - Display *dpy, - XStandardColormap *map, - XVisualInfo *vinfo, - int *count, - PixelRec *pixels, - int *first, int *remain, - unsigned long delta) -{ - Colormap cmap = map->colormap; - int npixels, ok, i; - Bool success = False; - - if (pixels->npixels == 0) { - /* First try to allocate the entire colormap */ - npixels = vinfo->colormap_size; - ok = XAllocColorCells(dpy, cmap, 1, NULL, 0, pixels->pixels, npixels); - if (ok) success = True; - else { - int total; - int top, mid = 0; - - /* If it's a gray ramp or direct color we need at least 2; - others 8 */ - if (map->blue_max == 0 || vinfo->class == DirectColor) total = 2; - else total = 8; - - /* Allocate all available cells, using binary backoff */ - top = vinfo->colormap_size - 1; - while (total <= top) { - mid = total + ((top - total + 1) / 2); - ok = XAllocColorCells(dpy, cmap, 1, NULL, 0, - pixels->pixels, mid); - if (ok) { - if (mid == top) { - success = True; - break; - } else { - XFreeColors(dpy, cmap, pixels->pixels, mid, 0); - total = mid; - } - } else top = mid - 1; - } - if (success) npixels = mid; - else npixels = 0; - } - } else { - /* We must be in the gray ramp case, so we need at least 2 entries */ - npixels = pixels->npixels; - if (map->blue_max != 0 || npixels >= 2) success = True; - } - - if (success) { - /* Avoid pessimal case by testing to see if already sorted */ - for (i = 0; i < npixels-1; ++i) { - if (pixels->pixels[i] != pixels->pixels[i+1]-1) break; - } - - if (i < npixels-1) { - PrivSort((char *)pixels->pixels, npixels, - sizeof(unsigned long), compare); - } - - if (!contiguous(pixels->pixels, npixels, count, delta, - first, remain)) { - /* If there are enough free cells, shrink the map to fit. - Otherwise fail; we'll free the pixels later */ - if (((map->blue_max == 0 || vinfo->class == DirectColor) && - *count >= 2) || *count >=8) { - ShrinkMapToFit(map, count, vinfo); - *remain = npixels - *first - *count; - } else success = False; - } - } - - pixels->npixels = npixels; - return success; -} - -static Bool contiguous( - unsigned long pixels[], /* specifies allocated pixels */ - int npixels, /* specifies count of alloc'd pixels */ - int *ncolors, /* specifies needed sequence length - If not available, returns max - available contiguous sequence */ - unsigned long delta, - int *first, /* returns first index of sequence */ - int *rem) /* returns first index after sequence, - * or 0, if none follow */ -{ - register int i = 1; /* walking index into the pixel array */ - register int count = 1; /* length of sequence discovered so far */ - int max = 1; /* longest sequence we found */ - int maxstart = 0; - - *first = 0; - while (count < *ncolors && i < npixels) { - if (pixels[i-1] + delta == pixels[i]) count++; - else { - if (count > max) { - max = count; - maxstart = *first; - } - count = 1; - *first = i; - } - i++; - } - if (i == npixels && count > max) { - max = count; - maxstart = *first; - } - *rem = npixels - i; - if (count != *ncolors) { - *ncolors = max; - *first = maxstart; - return False; - } return True; -} - -static Bool AllocateColor( - Display *dpy, - Colormap cmap, - XColor *color) -{ - unsigned long pix = color->pixel; - XColor request; - int ok; - - request = *color; - - /* Free RW, Alloc RO, if fails, try RW */ - XFreeColors(dpy, cmap, &pix, 1, 0); - ok = XAllocColor(dpy, cmap, &request); - - /* If the pixel we get back isn't the request one, probably RO - White or Black, so shove it in RW so our cube is correct. - If alloc fails, try RW. */ - - if (!ok || request.pixel != color->pixel) { - ok = XAllocColorCells(dpy, cmap, 0, NULL, 0, &pix, 1); - - if (pix != color->pixel) XFreeColors(dpy, cmap, &pix, 1, 0); - if (!ok || pix != color->pixel) { - return False; - } - request = *color; - XStoreColor(dpy, cmap, &request); - } - return True; -} - -static void ShrinkMapToFit( - XStandardColormap *map, - int *space, - XVisualInfo *vinfo) -{ - if (map->blue_max == 0) map->red_max = *space - 1; - else if (vinfo->class == DirectColor) { - if (map->red_max > *space - 1) map->red_max = *space - 1; - if (map->green_max > *space - 1) map->green_max = *space - 1; - if (map->blue_max > *space - 1) map->blue_max = *space - 1; - } else { - int which = 2; - while ((map->red_max + 1) * (map->green_max + 1) * - (map->blue_max + 1) > *space) { - if (which == 0) { - if (map->red_max > 1) map->red_max--; - which = 1; - } else if (which == 1) { - if (map->green_max > 1) map->green_max--; - which = 2; - } else { - if (map->blue_max > 1) map->blue_max--; - which = 0; - } - } - *space = (map->red_max + 1) * (map->green_max + 1) * - (map->blue_max + 1); - - map->red_mult = (map->green_max + 1) * (map->blue_max + 1); - map->green_mult = map->blue_max + 1; - map->blue_mult = 1; - } -} - -static void DefineProperty( - Display *dpy, - XStandardColormap *map, - XVisualInfo *vinfo, - XStandardColormap *prop, - int nProp, - Atom atom) -{ - XStandardColormap *copy; - int i; - - if (nProp == 0) { - XSetRGBColormaps(dpy, RootWindow(dpy, vinfo->screen), map, 1, atom); - return; - } - - copy = (XStandardColormap *) calloc(nProp+1, sizeof(XStandardColormap)); - - /* Hm. If I can't allocate the list, is it better to just put our - property on, or to leave the ones there? I'll guess the latter... */ - if (copy == NULL) return; - - if (vinfo->visual == DefaultVisual(dpy, vinfo->screen) && - map->colormap == DefaultColormap(dpy, vinfo->screen)) { - /* Put new entry first; it's more likely to be useful */ - for (i = 0; i < nProp; i++) copy[i+1] = prop[i]; - i = 0; - } else { - /* Put it at the end */ - for (i = 0; i < nProp; i++) copy[i] = prop[i]; - /* i = nProp; (it does already) */ - } - - copy[i] = *map; - XSetRGBColormaps(dpy, RootWindow(dpy, vinfo->screen), copy, nProp+1, atom); - - free((void *) copy); -} diff --git a/nx-X11/lib/dps/dpsXint.h b/nx-X11/lib/dps/dpsXint.h deleted file mode 100644 index 08c4d233a..000000000 --- a/nx-X11/lib/dps/dpsXint.h +++ /dev/null @@ -1,104 +0,0 @@ -/* - * dpsXint.h -- internal definitions to dpsXclient.c - * - * (c) Copyright 1989-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 - */ - -#ifndef DPSXINT_H -#define DPSXINT_H - -#include <X11/X.h> -#include <DPS/dpsXclient.h> - -/* The first part of this structure is generic; the last part is - implementation-specific. */ - -typedef struct _t_DPSPrivContextRec { - char *priv; - DPSSpace space; - DPSProgramEncoding programEncoding; - DPSNameEncoding nameEncoding; - DPSProcs procs; - DPSTextProc textProc; - DPSErrorProc errorProc; - DPSResults resultTable; - unsigned int resultTableLength; - struct _t_DPSContextRec *chainParent, *chainChild; - unsigned int contextFlags; - DPSContextExtensionRec *extension; - - struct _t_DPSPrivContextRec *next; - integer lastNameIndex, cid; - boolean eofReceived; - char *wh; - char *buf, *outBuf, *objBuf; - integer nBufChars, nOutBufChars, nObjBufChars; - DPSNumFormat numFormat; - boolean resyncing; /* Error has occurred and waiting ResetContext */ - int *numstringOffsets; /* see comment below */ - -/* Everthing after this is XDPS-specific */ - - boolean creator; /* Did this app. create the context? */ - int statusFromEvent; /* Latest status reported by an event during reset. */ - XDPSStatusProc statusProc; - boolean zombie; /* To avoid DPSAwaitReturnValues */ - XDPSReadyProc readyProc; -} DPSPrivContextRec, *DPSPrivContext; - -/* The numstringOffsets field lists offsets of encoded number strings in - the current buffer. If non NULL, the first entry contains the size of - the allocated offset buffer and the second entry contains the next - available offset entry for use. */ - -/* The first part of this structure is generic; the last part is - implementation-specific. */ - -typedef struct _t_DPSPrivSpaceRec { - DPSSpaceProcs procs; - - struct _t_DPSPrivSpaceRec *next; - long int lastNameIndex, sid; - char *wh; /* KLUDGE to support DPSSendDestroySpace */ - DPSPrivContext firstContext; - -/* Everthing after this is XDPS-specific */ - - boolean creator; /* Did this app. create the space? */ -} DPSPrivSpaceRec, *DPSPrivSpace; - -#include "dpsint.h" - -#endif /* DPSXINT_H */ diff --git a/nx-X11/lib/dps/dpsXops.psw b/nx-X11/lib/dps/dpsXops.psw deleted file mode 100644 index a14335739..000000000 --- a/nx-X11/lib/dps/dpsXops.psw +++ /dev/null @@ -1,80 +0,0 @@ -/* dpsXops.psw - * - * (c) Copyright 1991-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 - */ - -defineps DPSclientsync(DPSContext ctxt) - clientsync -endps - -defineps DPScurrentXgcdrawable(DPSContext ctxt | int *gc, *draw, *x, *y) - currentXgcdrawable y x draw gc -endps - -defineps DPScurrentXgcdrawablecolor(DPSContext ctxt | int *gc, *draw, *x, *y, colorInfo[12]) - currentXgcdrawablecolor colorInfo y x draw gc -endps - -defineps DPScurrentXoffset(DPSContext ctxt | int *x, *y) - currentXoffset y x -endps - -defineps DPSsetXgcdrawable(DPSContext ctxt; int gc, draw, x, y) - gc draw x y setXgcdrawable -endps - -defineps DPSsetXgcdrawablecolor(DPSContext ctxt; int gc, draw, x, y, colorInfo[12]) - gc draw x y colorInfo setXgcdrawablecolor -endps - -defineps DPSsetXoffset(DPSContext ctxt; int x, y) - x y setXoffset -endps - -defineps DPSsetXrgbactual(DPSContext ctxt; float r, g, b | boolean *success) - r g b setXrgbactual success -endps - -defineps DPSclientXready(DPSContext ctxt; int i0, i1, i2, i3) - [ i0 i1 i2 i3 ] clientXready -endps - -defineps DPSsetXdrawingfunction(DPSContext ctxt; int function) - function setXdrawingfunction -endps - -defineps DPScurrentXdrawingfunction(DPSContext ctxt | int *function) - currentXdrawingfunction function -endps diff --git a/nx-X11/lib/dps/dpsXpriv.c b/nx-X11/lib/dps/dpsXpriv.c deleted file mode 100644 index c0f12545c..000000000 --- a/nx-X11/lib/dps/dpsXpriv.c +++ /dev/null @@ -1,534 +0,0 @@ -/* - * dpsXpriv.c - * - * (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> -#include <sys/time.h> - -#ifdef GC -#undef GC -#endif /* GC */ - -#ifdef VMS -/* Xlib does not like UNIX defined to any value under VMS. */ -#undef UNIX -#include <decw$include/X.h> -#include <decw$include/Xproto.h> -#include <decw$include/Xlib.h> -#include <decw$include/Xutil.h> -#else /* VMS */ -#include <X11/X.h> -#include <X11/Xproto.h> -#include <X11/Xlib.h> -#include <X11/Xutil.h> -#endif /* VMS */ -#include "DPS/XDPSlib.h" -#include "DPS/XDPS.h" -#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__ -#include <sys/select.h> -#endif - -#if defined(hpux) || defined(AIXV3) -#define SELECT_TYPE int * -#else -#define SELECT_TYPE fd_set * -#endif - -typedef struct _RegstDPY - { - Display *dpy; - int firstEvent; - struct _RegstDPY *next; - unsigned char ctxtTokenType; /* establish for each context. */ - unsigned char prefTokenType; /* ...of the server. */ - } RegstDPYRec, *PRegstDPY; - - -/* 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. */ -int XDPSContextTimedOut = false; /* Unimplemented */ -DPSProcs XDPSconvProcs = NIL; -DPSProcs XDPSrawProcs = NIL; - -/* 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; - - -static DPSClientPrintProc clientPrintProc = NIL; -static PRegstDPY firstDPY = NIL; -/* operands for "setobjectformat" if we must agree with server. */ -static char *format_operands[] = {"1", "2", "3", "4"}; - - - -static PRegstDPY IsRegistered ( - register Display *dpy) -{ - register PRegstDPY rdpy; - - for (rdpy = firstDPY; rdpy != NIL; rdpy = rdpy->next) - if (rdpy->dpy == dpy) - return (rdpy); - return (NIL); -} - - -void XDPSPrivZapDpy( - register Display *dpy) -{ - register PRegstDPY rdpy, prev = NIL; - - for (rdpy = firstDPY; rdpy != NIL; prev = rdpy,rdpy = rdpy->next) - if (rdpy->dpy == dpy) - { - if (prev == NIL) - firstDPY = rdpy->next; - else - prev->next = rdpy->next; - break; - } - free(rdpy); -} - - -/* ARGSUSED */ -static int UsuallyFalse ( - Display *dpy, - XEvent *event, - char *arg) -{ - return((event->type & 0x7F) == X_Error); -} - -void XDPSForceEvents ( - Display *dpy) -{ - XEvent event; - - while (XCheckIfEvent (dpy, &event, UsuallyFalse, (char *) NULL)) { - int (*proc)(Display *, XErrorEvent *) = XSetErrorHandler(NULL); - (void) XSetErrorHandler(proc); - if (proc != 0 && event.type < 256) - (void)(*proc)(dpy, &event.xerror); - } -} - - -static void OutputEventHandler ( - register XDPSLOutputEvent *event) -{ - PRegstDPY rdpy; - register DPSContext ctxt; - - if ((rdpy = IsRegistered (event->display)) == NIL || - rdpy->firstEvent != event->type) - return; - - ctxt = XDPSContextFromXID (event->display, event->cxid); - if (ctxt != NIL) - { - if (ctxt->resultTable != NIL) - XDPSQuitBlocking = true; - (*clientPrintProc) (ctxt, event->data, event->length); - } -} - - -static int BlockForEvent ( - Display *dpy) -{ - fd_set readfds; - - 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) { - FD_SET(ConnectionNumber(dpy), &readfds); - if (select (ConnectionNumber(dpy)+1, (SELECT_TYPE) &readfds, - (SELECT_TYPE) NULL, (SELECT_TYPE) NULL, - (struct timeval *) NULL) < 0) { - if (errno == EINTR) { - /* Ignore interrupt signals */ - errno = 0; - continue; - } - return (-1); /* Broken connection (errno == EBADF) */ - } else { - XDPSForceEvents (dpy); - if (XDPSQuitBlocking) break; - XNoOp(dpy); - /* 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 ( - DPSContext ctxt, - DPSProgramEncoding progEncoding, - DPSNameEncoding nameEncoding) -{ - /* This routine should not be called if ctxt is a text context */ - - if ((nameEncoding != dps_indexed && nameEncoding != dps_strings) || - (progEncoding != dps_ascii && progEncoding != dps_encodedTokens && - progEncoding != dps_binObjSeq)) - { - if (ctxt->errorProc != NIL) - (*ctxt->errorProc) (ctxt, dps_err_encodingCheck, - nameEncoding, progEncoding); - return; - } - else if (progEncoding == dps_ascii || progEncoding == dps_encodedTokens || - nameEncoding == dps_strings) - ctxt->procs = XDPSconvProcs; - else - ctxt->procs = XDPSrawProcs; - - ctxt->nameEncoding = nameEncoding; - ctxt->programEncoding = progEncoding; -} - - -/* ARGSUSED */ -void DPSDefaultTextBackstop (ctxt, buf, count) - DPSContext ctxt; - char *buf; - long unsigned int count; -{ - if (buf == NULL || count == 0) - { - (void) fflush(stdout); - return; - } - (void) fwrite (buf, sizeof (char), count, stdout); - (void) fflush (stdout); -} - -/* ARGSUSED */ -void DPSInitClient( - DPSTextProc textProc, - void (*releaseProc) (char *, char *)) -{ - DPSAssert (releaseProc != NIL); - XDPSSetProcs (); - DPSSetTextBackstop (DPSDefaultTextBackstop); - DPSSetErrorBackstop (DPSDefaultErrorProc); -} - - -DPSNumFormat XDPSNumFormat ( - Display *dpy) -{ - PRegstDPY rdpy; - - if ((rdpy = IsRegistered (dpy)) == NIL) - return ((DPSNumFormat) -1); - else - return ((rdpy->ctxtTokenType < DPS_HI_NATIVE) ? dps_ieee : dps_native); -} - -XDPSPrivContext XDPSCreatePrivContextRec ( - Display *dpy, - Drawable drawable, - GC gc, - int x, - int y, - unsigned int eventmask, - XStandardColormap *grayramp, - XStandardColormap *ccube, - int actual, - int secure) -{ - int event_base; - int token_type; /* From server. */ - char *num_format_name; /* From server. */ - PRegstDPY rdpy; - XDPSPrivContext wh; - - if (DPSInitialize() != 0) return(NULL); - if ((rdpy = IsRegistered (dpy)) == NIL) - { - /* DPS extension on this dpy? */ - event_base = XDPSLInit (dpy, &token_type, &num_format_name); - if (event_base >= 0 && - (rdpy = (PRegstDPY) calloc (sizeof (RegstDPYRec), 1))) - { - XDPSLSetTextEventHandler (dpy, (XDPSLEventHandler) OutputEventHandler); - XDPSLSetStatusEventHandler (dpy, (XDPSLEventHandler) XDPSStatusEventHandler); - XDPSLSetReadyEventHandler (dpy, (XDPSLEventHandler) XDPSReadyEventHandler); - XDPSLInitDisplayFlags(dpy); - rdpy->dpy = dpy; - rdpy->firstEvent = event_base; - rdpy->next = firstDPY; - - rdpy->prefTokenType = (unsigned char) token_type; - - if (strcmp (num_format_name, DPS_FORMATNAME) == 0) - rdpy->ctxtTokenType = DPS_DEF_TOKENTYPE; - else - /* Everybody must talk ieee! */ -#if SWAPBITS - rdpy->ctxtTokenType = DPS_LO_IEEE; -#else /* SWAPBITS */ - rdpy->ctxtTokenType = DPS_HI_IEEE; -#endif /* SWAPBITS */ - - firstDPY = rdpy; - } - else - return (NULL); - } - - if ((wh = (XDPSPrivContext) calloc (sizeof (XDPSPrivContextRec), 1)) != 0) - { - wh->dpy = dpy; - wh->drawable = drawable; - wh->gc = gc; - wh->x = x; - wh->y = y; - wh->eventmask = eventmask; - wh->grayramp = grayramp; - wh->ccube = ccube; - wh->actual = actual; - wh->newObjFormat = format_operands[rdpy->ctxtTokenType - DPS_HI_IEEE]; - wh->secure = secure; - return (wh); - } - else - return (NULL); -} - - -DPSNumFormat DPSCreatePrivContext ( - XDPSPrivContext wh, - DPSContext ctxt, - ContextPSID *cidP, - SpaceXID *sxidP, - boolean newSpace, - DPSClientPrintProc printProc) -{ - PRegstDPY rdpy; - - if (clientPrintProc == NIL) - clientPrintProc = printProc; - - if ((rdpy = IsRegistered (wh->dpy)) == NIL) - return ((DPSNumFormat) -1); - - if (newSpace || sxidP == NIL) - wh->cxid = XDPSLCreateContextAndSpace (wh->dpy, wh->drawable, wh->gc, - wh->x, wh->y, wh->eventmask, - wh->grayramp, wh->ccube, - wh->actual, cidP, sxidP, - wh->secure); /* L2-DPS/PROTO 9 */ - else - wh->cxid = XDPSLCreateContext (wh->dpy, *sxidP, wh->drawable, wh->gc, - wh->x, wh->y, wh->eventmask, - wh->grayramp, wh->ccube, wh->actual, cidP, - wh->secure); /* L2-DPS/PROTO 9 */ - if (wh->cxid == None) return((DPSNumFormat) -1); - wh->ctxt = ctxt; - if (wh->newObjFormat != NIL) - { - XDPSLGiveInput (wh->dpy, wh->cxid, wh->newObjFormat, 1); - XDPSLGiveInput (wh->dpy, wh->cxid, " setobjectformat\n", 17); - } - - if (rdpy->ctxtTokenType != DPS_DEF_TOKENTYPE) - ctxt->procs = XDPSconvProcs; - return ((rdpy->ctxtTokenType < DPS_HI_NATIVE) ? dps_ieee : dps_native); -} - - -void DPSIncludePrivContext ( - XDPSPrivContext wh, - DPSContext ctxt, - ContextPSID cid, - SpaceXID sxid, - DPSClientPrintProc printProc) -{ - XDPSPrivContext newWh; - SpaceXID space; - - if (clientPrintProc == NIL) - clientPrintProc = printProc; - - newWh = (XDPSPrivContext) calloc (sizeof (XDPSPrivContextRec), 1); - if (!newWh) DPSOutOfMemory(); - *newWh = *wh; - if (IsRegistered (wh->dpy) != NIL) - { - newWh->cxid = XDPSLCreateContextFromID (wh->dpy, cid, &space); - DPSAssertWarn (space == sxid, ctxt, "attempting context from context ID from different space"); - newWh->ctxt = ctxt; - /* 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. */ - if (wh->newObjFormat != NIL) /* Yes, do it for the child too. */ - { - XDPSLGiveInput (wh->dpy, newWh->cxid, wh->newObjFormat, 1); - XDPSLGiveInput (wh->dpy, newWh->cxid, " setobjectformat\n", 17); - } - } - else - { - newWh->cxid = 0; /* Must not refer to a good context. */ - newWh->ctxt = NIL; - } - - (void) DPSSetWh (ctxt, (char *) newWh); -} - -/* ARGSUSED */ -void DPSSendPostScript ( - register XDPSPrivContext wh, - DPSClientPrintProc printProc, - ContextPSID cid, - char *buffer, - long int count, - boolean (*returnControl)(void)) -{ - boolean blocking = buffer == NIL; - - if (IsRegistered (wh->dpy) == NIL) - (*printProc) (wh->ctxt, NIL, 0); - else { - if (count > 0) - XDPSLGiveInput (wh->dpy, wh->cxid, buffer, count); - - if (blocking) { - XDPSLFlush (wh->dpy); - if (BlockForEvent (wh->dpy) < 0 && wh->ctxt->errorProc != NIL) { - (*(wh->ctxt->errorProc)) (wh->ctxt, dps_err_closedDisplay, - ConnectionNumber(wh->dpy), - 0); - } - } - DPSCheckRaiseError(wh->ctxt); - } -} - - -/* ARGSUSED */ -void DPSSendInterrupt ( - XDPSPrivContext wh, - ContextPSID cid, - DPSClientPrintProc printProc) -{ - XDPSLNotifyContext (wh->dpy, wh->cxid, PSINTERRUPT); -} - - -/* ARGSUSED */ -void DPSSendEOF ( - XDPSPrivContext wh, - ContextPSID cid, - DPSClientPrintProc printProc) -{ - XDPSLReset (wh->dpy, wh->cxid); -} - - -/* ARGSUSED */ -void DPSSendTerminate ( - XDPSPrivContext wh, - ContextPSID cid, - DPSClientPrintProc printProc) -{ - XDPSLNotifyContext (wh->dpy, wh->cxid, PSKILL); -} - - -void XDPSSendUnfreeze ( - Display *dpy, - ContextXID cxid) -{ - XDPSLNotifyContext (dpy, cxid, PSUNFREEZE); -} - - -/* ARGSUSED */ -void DPSSendDestroySpace( - XDPSPrivContext wh, - SpaceXID sxid, - DPSClientPrintProc printProc) -{ - XDPSLDestroySpace (wh->dpy, sxid); -} - - -void DPSOutOfMemory (void) -{ - DPSFatalProc(NULL, "DPS Client Library Error: Out of memory.\n"); - exit (1); -} diff --git a/nx-X11/lib/dps/dpsXpriv.h b/nx-X11/lib/dps/dpsXpriv.h deleted file mode 100644 index 56b25b757..000000000 --- a/nx-X11/lib/dps/dpsXpriv.h +++ /dev/null @@ -1,187 +0,0 @@ -/* - * dpsXpriv.h -- client lib internal impl interface for the X version - * - * (c) Copyright 1989-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 - */ - -#ifndef DPSXPRIVATE_H -#define DPSXPRIVATE_H - -#ifdef VMS -#include <decw$include/X.h> -#include <decw$include/Xlib.h> -#include <decw$include/Xutil.h> -#else /* VMS */ -#include <X11/X.h> -#include <X11/Xlib.h> -#include <X11/Xutil.h> -#endif /* VMS */ - -#include <DPS/XDPSlib.h> -#include "DPS/dpsclient.h" -#include "dpsprivate.h" -#include "DPS/dpsXclient.h" -#include "publictypes.h" - -/* typedefs */ - -typedef struct _t_XDPSPrivContextRec - { - Display *dpy; - Drawable drawable; - GC gc; - int x; - int y; - unsigned int eventmask; - XStandardColormap *grayramp; - XStandardColormap *ccube; - int actual; - DPSContext ctxt; /* Points back to its context */ - ContextXID cxid; - char *newObjFormat; /* This is the object format that a */ - /* new context must use for sending */ - /* BOS's to the client. If the */ - /* server and client have the same */ - /* number formats then this will be */ - /* null. */ - int secure; - } XDPSPrivContextRec, *XDPSPrivContext; - - -extern DPSProcs XDPSconvProcs; -extern DPSProcs XDPSrawProcs; -extern int XDPSQuitBlocking; - - -extern XDPSPrivContext XDPSCreatePrivContextRec ( - Display * /* dpy */, - Drawable /* drawable */, - GC /* gc */, - int /* x */, - int /* y */, - unsigned int /* eventmask */, - XStandardColormap * /* grayramp */, - XStandardColormap * /* ccube */, - int /* actual */, - int /* secure */); - - /* See if dpy supports the DPS extension. If not, return NULL. If so, - it sets up a private context object that is used for creating - contexts and spaces. */ - -extern DPSNumFormat DPSCreatePrivContext( - XDPSPrivContext /* wh */, - DPSContext /* ctxt */, - ContextPSID * /* cidP */, - SpaceXID * /* sxidP */, - boolean /* newSpace */, - DPSClientPrintProc /* printProc */); - /* returns -1 if server can't create the context */ - -extern void DPSIncludePrivContext( - XDPSPrivContext /* wh */, - DPSContext /* ctxt */, - ContextPSID /* cid */, - SpaceXID /* sxid */, - DPSClientPrintProc /* printProc */); - -extern void DPSSendPostScript( - XDPSPrivContext /* wh */, - DPSClientPrintProc /* printProc */, - ContextPSID /* cid */, - char * /* buffer */, - long int /* count */, - boolean (* /* returnControl */)(void)); - -extern void DPSSendInterrupt( - XDPSPrivContext /* wh */, - ContextPSID /* cid */, - DPSClientPrintProc /* printProc */); - -extern void DPSSendEOF( - XDPSPrivContext /* wh */, - ContextPSID /* cid */, - DPSClientPrintProc /* printProc */); - -extern void DPSSendTerminate( - XDPSPrivContext /* wh */, - ContextPSID /* cid */, - DPSClientPrintProc /* printProc */); - -extern void XDPSPrivZapDpy( - Display * /* dpy */); - -extern DPSNumFormat XDPSNumFormat (Display * /* dpy */); - - /* Determine the number format for server over the "dpy" connection. */ - -extern void XDPSSetProcs (void); - - /* Set pointers to raw and conversion context procs. */ - -extern void XDPSSetContextEncoding ( - DPSContext /* ctxt */, - DPSProgramEncoding /* progEncoding */, - DPSNameEncoding /* nameEncoding */); - - /* Sets context's program and name encodings to new values. */ - -extern void XDPSStatusEventHandler (XDPSLStatusEvent * /* event */); - - /* Is registered with Xlib and is called when a dps status event is - received. It determines what context the event belongs to and, - if that context has a status event handler, calls its handler - passing it the status type. */ - -extern void XDPSReadyEventHandler (XDPSLReadyEvent * /* event */); - - /* Is registered with Xlib and is called when a dps ready event is - received. It determines what context the event belongs to and, - if that context has a status event handler, calls its handler - passing it the ready data. */ - -extern void XDPSForceEvents (Display * /* dpy */); - - /* Forces processing of events that are pending over the 'dpy' - connection. This causes DPS events to be handled by their handlers. */ - -extern void XDPSSendUnfreeze (Display * /* dpy */, ContextXID /* cxid */); - -extern void DPSSendDestroySpace( - XDPSPrivContext /* wh */, - SpaceXID /* sxid */, - DPSClientPrintProc /* printProc */); - -#endif /* DPSXPRIVATE_H */ diff --git a/nx-X11/lib/dps/dpsXtdisp.c b/nx-X11/lib/dps/dpsXtdisp.c deleted file mode 100644 index d778a3245..000000000 --- a/nx-X11/lib/dps/dpsXtdisp.c +++ /dev/null @@ -1,109 +0,0 @@ -/* - * dpsXtdisp.c - * - * (c) Copyright 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 - */ - -#include <X11/Intrinsic.h> - -#if XtSpecificationRelease < 6 - -#include "dpsassert.h" - -void XDPSSetXtEventDispatching(Display *dpy) -{ - DPSFatalProc(NULL, "Attempt to use XDPSSetXtEventDispatching with pre-R6 Intrinsics\n"); - exit(1); -} - -#else - -#include <DPS/XDPSlib.h> -#include <DPS/dpsXclient.h> - -typedef struct _DpyProcRec { - Display *dpy; - XtEventDispatchProc oldproc; - struct _DpyProcRec *next; -} DpyProcRec; - -static DpyProcRec *dpyProcList = NULL; - -static Boolean NXDispatcher(XEvent *event) -{ - DpyProcRec *d; - - if (XDPSDispatchEvent(event)) return True; - - for (d = dpyProcList; d != NULL && d->dpy != event->xany.display; - d = d->next) {} - if (d != NULL) return (*(d->oldproc))(event); - else return False; -} - -void XDPSSetXtEventDispatching(Display *dpy) -{ - int codes; - XExtCodes *c; - - codes = XDPSLInit(dpy, (int *) NULL, (char **) NULL); - - if (codes == -1) return; /* No extension or NX, so nothing to do */ - else { - (void) XDPSSetEventDelivery(dpy, dps_event_pass_through); - c = XDPSLGetCodes(dpy); - - /* First check for NX */ - if (!c->first_event) { - DpyProcRec *d = XtNew(DpyProcRec); - d->dpy = dpy; - d->next = dpyProcList; - d->oldproc = - XtSetEventDispatcher(dpy, ClientMessage, NXDispatcher); - dpyProcList = d; - - } else { - /* Extension */ - (void) XtSetEventDispatcher(dpy, c->first_event + PSEVENTSTATUS, - (XtEventDispatchProc) XDPSDispatchEvent); - (void) XtSetEventDispatcher(dpy, c->first_event + PSEVENTOUTPUT, - (XtEventDispatchProc) XDPSDispatchEvent); - (void) XtSetEventDispatcher(dpy, c->first_event + PSEVENTREADY, - (XtEventDispatchProc) XDPSDispatchEvent); - } - } -} - -#endif diff --git a/nx-X11/lib/dps/dpsabbrev.c b/nx-X11/lib/dps/dpsabbrev.c deleted file mode 100644 index 20b3ef713..000000000 --- a/nx-X11/lib/dps/dpsabbrev.c +++ /dev/null @@ -1,360 +0,0 @@ -/* - * dpsabbrev.c -- Implementation of Client Library abbrev mode - * - * (c) Copyright 1993-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$ */ - -#include <string.h> -#include "publictypes.h" -#include "DPS/dpsclient.h" -#include "dpsprivate.h" - -static DPSAbbrevRec abbrev[] = { - {1, "add", "!+"}, - {10, "ashow", "!a"}, - {12, "awidthshow", "!A"}, - {13, "begin", "!B"}, - {14, "bind", "!b"}, - {20, "clip", "!CL"}, - {22, "closepath", "!c"}, - {23, "concat", "!CC"}, - {25, "copy", "!CP"}, - {39, "currentmatrix", "!CM"}, - {40, "currentpoint", "!Cp"}, - {43, "curveto", "!C"}, - {51, "def", "!D"}, - {53, "dict", "!d"}, - {62, "exch", "!E"}, - {63, "exec", "!e"}, - {66, "fill", "!F"}, - {67, "findfont", "!f"}, - {77, "grestore", "!G"}, - {78, "gsave", "!g"}, - {85, "ifelse", "!I"}, - {88, "index", "!i"}, - {98, "length", "!LE"}, - {99, "lineto", "!L"}, - {100, "load", "!l"}, - {103, "makefont", "!MF"}, - {104, "matrix", "!m"}, - {107, "moveto", "!M"}, - {111, "newpath", "!N"}, - {113, "null", "!n"}, - {117, "pop", "!p"}, - {122, "rcurveto", "!RC"}, - {127, "rectclip", "!R"}, - {128, "rectfill", "!RF"}, - {129, "rectstroke", "!RS"}, - {131, "repeat", "!RP"}, - {132, "restore", "!Rs"}, - {133, "rlineto", "!r"}, - {134, "rmoveto", "!RM"}, - {135, "roll", "!RL"}, - {136, "rotate", "!RO"}, - {137, "round", "!RN"}, - {138, "save", "!SV"}, - {139, "scale", "!SC"}, - {140, "scalefont", "!SF"}, - {142, "selectfont", "!s"}, - {147, "setcmykcolor", "!Sc"}, - {148, "setdash", "!SD"}, - {149, "setfont", "!Sf"}, - {150, "setgray", "!Sg"}, - {152, "sethsbcolor", "!Sh"}, - {153, "setlinecap", "!SL"}, - {154, "setlinejoin", "!SJ"}, - {155, "setlinewidth", "!SW"}, - {156, "setmatrix", "!SM"}, - {157, "setrgbcolor", "!Sr"}, - {158, "setshared", "!SS"}, - {160, "show", "!S"}, - {161, "showpage", "!SP"}, - {167, "stroke", "!ST"}, - {170, "systemdict", "!Sd"}, - {173, "translate", "!T"}, - {182, "userdict", "!u"}, - {186, "where", "!w"}, - {187, "widthshow", "!W"}, - {194, "xshow", "!X"}, - {195, "xyshow", "!x"}, - {196, "yshow", "!Y"}, -}; - -static short abbrevPtr[] = { - -1, /* 0 */ - 0, /* 1 */ - -1, /* 2 */ - -1, /* 3 */ - -1, /* 4 */ - -1, /* 5 */ - -1, /* 6 */ - -1, /* 7 */ - -1, /* 8 */ - -1, /* 9 */ - 1, /* 10 */ - -1, /* 11 */ - 2, /* 12 */ - 3, /* 13 */ - 4, /* 14 */ - -1, /* 15 */ - -1, /* 16 */ - -1, /* 17 */ - -1, /* 18 */ - -1, /* 19 */ - 5, /* 20 */ - -1, /* 21 */ - 6, /* 22 */ - 7, /* 23 */ - -1, /* 24 */ - 8, /* 25 */ - -1, /* 26 */ - -1, /* 27 */ - -1, /* 28 */ - -1, /* 29 */ - -1, /* 30 */ - -1, /* 31 */ - -1, /* 32 */ - -1, /* 33 */ - -1, /* 34 */ - -1, /* 35 */ - -1, /* 36 */ - -1, /* 37 */ - -1, /* 38 */ - 9, /* 39 */ - 10, /* 40 */ - -1, /* 41 */ - -1, /* 42 */ - 11, /* 43 */ - -1, /* 44 */ - -1, /* 45 */ - -1, /* 46 */ - -1, /* 47 */ - -1, /* 48 */ - -1, /* 49 */ - -1, /* 50 */ - 12, /* 51 */ - -1, /* 52 */ - 13, /* 53 */ - -1, /* 54 */ - -1, /* 55 */ - -1, /* 56 */ - -1, /* 57 */ - -1, /* 58 */ - -1, /* 59 */ - -1, /* 60 */ - -1, /* 61 */ - 14, /* 62 */ - 15, /* 63 */ - -1, /* 64 */ - -1, /* 65 */ - 16, /* 66 */ - 17, /* 67 */ - -1, /* 68 */ - -1, /* 69 */ - -1, /* 70 */ - -1, /* 71 */ - -1, /* 72 */ - -1, /* 73 */ - -1, /* 74 */ - -1, /* 75 */ - -1, /* 76 */ - 18, /* 77 */ - 19, /* 78 */ - -1, /* 79 */ - -1, /* 80 */ - -1, /* 81 */ - -1, /* 82 */ - -1, /* 83 */ - -1, /* 84 */ - 20, /* 85 */ - -1, /* 86 */ - -1, /* 87 */ - 21, /* 88 */ - -1, /* 89 */ - -1, /* 90 */ - -1, /* 91 */ - -1, /* 92 */ - -1, /* 93 */ - -1, /* 94 */ - -1, /* 95 */ - -1, /* 96 */ - -1, /* 97 */ - 22, /* 98 */ - 23, /* 99 */ - 24, /* 100 */ - -1, /* 101 */ - -1, /* 102 */ - 25, /* 103 */ - 26, /* 104 */ - -1, /* 105 */ - -1, /* 106 */ - 27, /* 107 */ - -1, /* 108 */ - -1, /* 109 */ - -1, /* 110 */ - 28, /* 111 */ - -1, /* 112 */ - 29, /* 113 */ - -1, /* 114 */ - -1, /* 115 */ - -1, /* 116 */ - 30, /* 117 */ - -1, /* 118 */ - -1, /* 119 */ - -1, /* 120 */ - -1, /* 121 */ - 31, /* 122 */ - -1, /* 123 */ - -1, /* 124 */ - -1, /* 125 */ - -1, /* 126 */ - 32, /* 127 */ - 33, /* 128 */ - 34, /* 129 */ - -1, /* 130 */ - 35, /* 131 */ - 36, /* 132 */ - 37, /* 133 */ - 38, /* 134 */ - 39, /* 135 */ - 40, /* 136 */ - 41, /* 137 */ - 42, /* 138 */ - 43, /* 139 */ - 44, /* 140 */ - -1, /* 141 */ - 45, /* 142 */ - -1, /* 143 */ - -1, /* 144 */ - -1, /* 145 */ - -1, /* 146 */ - 46, /* 147 */ - 47, /* 148 */ - 48, /* 149 */ - 49, /* 150 */ - -1, /* 151 */ - 50, /* 152 */ - 51, /* 153 */ - 52, /* 154 */ - 53, /* 155 */ - 54, /* 156 */ - 55, /* 157 */ - 56, /* 158 */ - -1, /* 159 */ - 57, /* 160 */ - 58, /* 161 */ - -1, /* 162 */ - -1, /* 163 */ - -1, /* 164 */ - -1, /* 165 */ - -1, /* 166 */ - 59, /* 167 */ - -1, /* 168 */ - -1, /* 169 */ - 60, /* 170 */ - -1, /* 171 */ - -1, /* 172 */ - 61, /* 173 */ - -1, /* 174 */ - -1, /* 175 */ - -1, /* 176 */ - -1, /* 177 */ - -1, /* 178 */ - -1, /* 179 */ - -1, /* 180 */ - -1, /* 181 */ - 62, /* 182 */ - -1, /* 183 */ - -1, /* 184 */ - -1, /* 185 */ - 63, /* 186 */ - 64, /* 187 */ - -1, /* 188 */ - -1, /* 189 */ - -1, /* 190 */ - -1, /* 191 */ - -1, /* 192 */ - -1, /* 193 */ - 65, /* 194 */ - 66, /* 195 */ - 67, /* 196 */ - -1, /* 197 */ - -1, /* 198 */ - -1, /* 199 */ - -1, /* 200 */ - -1, /* 201 */ - -1, /* 202 */ - -1, /* 203 */ - -1, /* 204 */ - -1, /* 205 */ - -1, /* 206 */ - -1, /* 207 */ - -1, /* 208 */ - -1, /* 209 */ - -1, /* 210 */ - -1, /* 211 */ -}; - -void DPSFetchAbbrevList(DPSAbbrevRec **list, int *count) -{ - *list = abbrev; - *count = sizeof(abbrev) / sizeof(abbrev[0]); -} - -char *DPSGetSysnameAbbrev(int n) -{ - if ((unsigned) n > sizeof(abbrevPtr) / sizeof(abbrevPtr[0])) return NULL; - if (abbrevPtr[n] == -1) return NULL; - return abbrev[abbrevPtr[n]].abbrev; -} - -char *DPSGetOperatorAbbrev(char *op) -{ - int min, max, n; - int res; - - min = 0; - max = sizeof(abbrev) / sizeof(abbrev[0]) - 1; - - while (min <= max) { - n = (max + min) / 2; - res = strcmp(op, abbrev[n].operatorName); - if (res == 0) return abbrev[n].abbrev; - if (res < 0) max = n - 1; - if (res > 0) min = n + 1; - } - return NULL; -} diff --git a/nx-X11/lib/dps/dpsassert.h b/nx-X11/lib/dps/dpsassert.h deleted file mode 100644 index 00632a111..000000000 --- a/nx-X11/lib/dps/dpsassert.h +++ /dev/null @@ -1,57 +0,0 @@ -/* - * dpsassert.h - * - * (c) Copyright 1991-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 - */ - -#ifndef DPSASSERT_H -#define DPSASSERT_H - -#include "DPS/dpsclient.h" - -#define DPSAssertWarn(cndtn, cntxt, mssg)\ - if (!(cndtn)) DPSWarnProc((DPSContext)(cntxt),(mssg)) - -extern void DPSWarnProc(DPSContext ctxt, char *msg); -extern void DPSFatalProc(DPSContext ctxt, char *msg); -extern void DPSCantHappen(void); - -#define DPSAssert(condition) \ - if (! (condition)) DPSCantHappen(); -/* Tests whether the specified condition is true and aborts the - entire application if not. - */ - -#endif /* DPSASSERT_H */ diff --git a/nx-X11/lib/dps/dpsclient.c b/nx-X11/lib/dps/dpsclient.c deleted file mode 100644 index c75d76ce8..000000000 --- a/nx-X11/lib/dps/dpsclient.c +++ /dev/null @@ -1,2969 +0,0 @@ -/* - * dpsclient.c -- Implementation of the Display PostScript Client Library. - * - * (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$ */ - -#include <stdlib.h> -#include <stdio.h> -#include <ctype.h> -#include <string.h> - -#include "dpsXpriv.h" -#include "DPS/dpsclient.h" -#include "dpsprivate.h" -#include "dpsdict.h" -#include "DPS/dpsexcept.h" -#include "dpsassert.h" - -#ifdef XDPS -#include "dpsXint.h" -#endif /* XDPS */ - -#if defined(SVR4) || defined(SYSV) || defined(SystemV) -#define os_bcopy(f,t,c) memcpy(t,f,c) -#else -#define os_bcopy(f,t,c) bcopy(f,t,c) -#endif - -#if !IEEEFLOAT -extern void IEEEHighToNative(/* FloatRep *from, real *to */); -/* Converts from IEEE high-byte-first real to native real. */ - -extern void NativeToIEEEHigh(/* real *from, FloatRep *to */); -/* Converts from native real to IEEE high-byte-first real. */ - -extern void IEEELowToNative(/* FloatRep *from, real *to */); -/* Converts from IEEE low-byte-first real to native real. */ - -extern void NativeToIEEELow(/* real *from, FloatRep *to */); -/* Converts from native real to IEEE low-byte-first real. */ -#endif /* !IEEEFLOAT */ - -typedef union { /* 32 bit number representations */ - unsigned int u; - int i; - float f; - unsigned char bytes[4]; - /* raw bytes, in whatever order they appear in memory */ - } Swap32Rec; - -typedef union { /* 16 bit number representations */ - unsigned short u; - short i; - unsigned char bytes[2]; - } Swap16Rec; - -#if SWAPBITS -#define Copy4SrcLo(src, dst)\ - (((Swap32Rec *) dst)->bytes[0] = ((Swap32Rec *) src)->bytes[0], \ - ((Swap32Rec *) dst)->bytes[1] = ((Swap32Rec *) src)->bytes[1], \ - ((Swap32Rec *) dst)->bytes[2] = ((Swap32Rec *) src)->bytes[2], \ - ((Swap32Rec *) dst)->bytes[3] = ((Swap32Rec *) src)->bytes[3] ) -#define Copy4SrcHi(src, dst)\ - (((Swap32Rec *) dst)->bytes[0] = ((Swap32Rec *) src)->bytes[3], \ - ((Swap32Rec *) dst)->bytes[1] = ((Swap32Rec *) src)->bytes[2], \ - ((Swap32Rec *) dst)->bytes[2] = ((Swap32Rec *) src)->bytes[1], \ - ((Swap32Rec *) dst)->bytes[3] = ((Swap32Rec *) src)->bytes[0] ) -#define Copy2SrcLo(src, dst)\ - (((Swap16Rec *) dst)->bytes[0] = ((Swap16Rec *) src)->bytes[0], \ - ((Swap16Rec *) dst)->bytes[1] = ((Swap16Rec *) src)->bytes[1] ) -#define Copy2SrcHi(src, dst)\ - (((Swap16Rec *) dst)->bytes[0] = ((Swap16Rec *) src)->bytes[1], \ - ((Swap16Rec *) dst)->bytes[1] = ((Swap16Rec *) src)->bytes[0] ) -#else /* SWAPBITS */ -#define Copy4SrcHi(src, dst)\ - (((Swap32Rec *) dst)->bytes[0] = ((Swap32Rec *) src)->bytes[0], \ - ((Swap32Rec *) dst)->bytes[1] = ((Swap32Rec *) src)->bytes[1], \ - ((Swap32Rec *) dst)->bytes[2] = ((Swap32Rec *) src)->bytes[2], \ - ((Swap32Rec *) dst)->bytes[3] = ((Swap32Rec *) src)->bytes[3] ) -#define Copy4SrcLo(src, dst)\ - (((Swap32Rec *) dst)->bytes[0] = ((Swap32Rec *) src)->bytes[3], \ - ((Swap32Rec *) dst)->bytes[1] = ((Swap32Rec *) src)->bytes[2], \ - ((Swap32Rec *) dst)->bytes[2] = ((Swap32Rec *) src)->bytes[1], \ - ((Swap32Rec *) dst)->bytes[3] = ((Swap32Rec *) src)->bytes[0] ) -#define Copy2SrcHi(src, dst)\ - (((Swap16Rec *) dst)->bytes[0] = ((Swap16Rec *) src)->bytes[0], \ - ((Swap16Rec *) dst)->bytes[1] = ((Swap16Rec *) src)->bytes[1] ) -#define Copy2SrcLo(src, dst)\ - (((Swap16Rec *) dst)->bytes[0] = ((Swap16Rec *) src)->bytes[1], \ - ((Swap16Rec *) dst)->bytes[1] = ((Swap16Rec *) src)->bytes[0] ) -#endif /* SWAPBITS */ - - -#define DPS_ERR_TAG 250 - -#define CONTEXTBUFFERSIZE 256 -#define MAXQUEUEDBUFFERS 5 - -DPSContext DPSGlobalContext; - -Globals DPSglobals = NULL; - -char *DPScalloc(integer e, integer n) -{ - char *p; - while (!(p = (char *)calloc(e, n))) { - DPSOutOfMemory(); - } - return p; -} - - - -void DPSSafeSetLastNameIndex(DPSContext ctxt) -{ - /* we're about to call the error handler, so roll back the - lastNameIndex to the last known valid index */ - DPSCheckInitClientGlobals(); - if (ctxt != dummyCtx && ctxt->space != NIL) - ((DPSPrivContext)ctxt)->lastNameIndex = ((DPSPrivSpace)(ctxt->space))->lastNameIndex; -} - -void DPSCheckInitClientGlobals(void) -{ - if (!DPSglobals) { - DPSglobals = (Globals)DPScalloc(sizeof(GlobalsRec), 1); - globLastNameIndex = -1; - } -} - -/**************************************************************/ -/* Procedures that support the DPSCreateContext context procs */ -/**************************************************************/ - -/* ARGSUSED */ -static void ReleaseInput( - char *unused, char *buffer) -{ - ContextBuffer cb = (ContextBuffer)buffer; - if (cb == NIL) return; - cb->next = contextBuffers; - contextBuffers = cb; - queuedBuffers--; -} - -/* ARGSUSED */ -static void StuffResultVal( - DPSContext ctxt, - DPSResults result, - integer tag, - DPSBinObj obj) -{ - - integer type = obj->attributedType & ~DPS_EXEC; - integer nObjs = 1; - - /* check if array */ - if (type == DPS_ARRAY) { - nObjs = obj->length; - if (nObjs < 1) return; - if (result->count == -1 && nObjs != 1) { - DPSSafeSetLastNameIndex(ctxt); - if (ctxt->errorProc != NIL) - (*ctxt->errorProc)(ctxt, dps_err_resultTypeCheck, (long unsigned)obj, 0); - return; - } - obj = (DPSBinObj) ((char *)obj + obj->val.arrayVal); - type = obj->attributedType & ~DPS_EXEC; - } - - do { - integer bump = 0; - if (result->count == 0) return; - switch (result->type) { - case dps_tBoolean: - if (type == DPS_BOOL) { - int *b = (int *) result->value; - *b = (int) obj->val.booleanVal; - bump = sizeof(int); - } - break; - case dps_tFloat: { - float *f = (float *) result->value; - if (type == DPS_REAL) { - *f = obj->val.realVal; - bump = sizeof(float); - } - else if (type == DPS_INT) { - *f = (float) obj->val.integerVal; - bump = sizeof(float); - } - break; - } - case dps_tDouble: { - double *d = (double *) result->value; - if (type == DPS_REAL) { - *d = (double) obj->val.realVal; - bump = sizeof(double); - } - else if (type == DPS_INT) { - *d = (double) obj->val.integerVal; - bump = sizeof(double); - } - break; - } - case dps_tShort: - if (type == DPS_INT) { - short *s = (short *) result->value; - *s = (short) obj->val.integerVal; - bump = sizeof(short); - } - break; - case dps_tUShort: - if (type == DPS_INT) { - unsigned short *us = (unsigned short *) result->value; - *us = (unsigned short) obj->val.integerVal; - bump = sizeof(unsigned short); - } - break; - case dps_tInt: - if (type == DPS_INT) { - int *i = (int *) result->value; - *i = (int) obj->val.integerVal; - bump = sizeof(int); - } - break; - case dps_tUInt: - if (type == DPS_INT) { - unsigned int *ui = (unsigned int *) result->value; - *ui = (unsigned int) obj->val.integerVal; - bump = sizeof(unsigned int); - } - break; - case dps_tLong: - if (type == DPS_INT) { - long int *li = (long int *) result->value; - *li = obj->val.integerVal; - bump = sizeof(long int); - } - break; - case dps_tULong: - if (type == DPS_INT) { - unsigned long *u = (unsigned long *) result->value; - *u = (unsigned long) obj->val.integerVal; - bump = sizeof(unsigned long); - } - break; - case dps_tChar: - case dps_tUChar: - if (nObjs != 1) { - DPSSafeSetLastNameIndex(ctxt); - if (ctxt->errorProc != NIL) - (*ctxt->errorProc)(ctxt, dps_err_resultTypeCheck, (long unsigned)obj, 0); - } - else if (type == DPS_STRING) { - if (result->count == -1) { - /* char * result, copy first, ignore subsequent, null terminate */ - os_bcopy(((integer)(obj->val.stringVal)) + (char *)obj, - result->value, obj->length); - (result->value)[obj->length] = '\0'; - result->count = 0; - } - else { - unsigned slen; - if (result->count >= (int) obj->length) { - /* copy entire string into char array */ - slen = obj->length; - } - else if (result->count > 0) { - /* copy partial string into char array */ - slen = result->count; - } - else return; /* ignore string result, no room left */ - os_bcopy(((integer)(obj->val.stringVal)) + (char *)obj, - result->value, slen); - result->value += slen; - result->count -= slen; - } - return; - } - break; - - default: - DPSSafeSetLastNameIndex(ctxt); - if (ctxt->errorProc != NIL) - (*ctxt->errorProc)(ctxt, dps_err_resultTypeCheck, (long unsigned)obj, 0); - } /* switch (result->type) */ - - if (bump == 0) { - DPSSafeSetLastNameIndex(ctxt); - if (ctxt->errorProc != NIL) - (*ctxt->errorProc)(ctxt, dps_err_resultTypeCheck, (long unsigned)obj, 0); - return; - } - if (result->count != -1) { - result->count--; - result->value += bump; - } - obj += 1; - nObjs--; - } while (nObjs > 0); /* do */ - -} /* StuffResultVal */ - - -static void NumFormatFromTokenType( - unsigned char t, - DPSNumFormat *numFormat) -{ - switch (t) { - case DPS_HI_IEEE: - *numFormat = dps_ieee; - break; - case DPS_LO_IEEE: - *numFormat = dps_ieee; - break; - case DPS_HI_NATIVE: - *numFormat = dps_native; - break; - case DPS_LO_NATIVE: - *numFormat = dps_native; - break; - default: DPSCantHappen(); - } -} - - -#if !IEEEFLOAT -/* called to deal with results from the server */ -static void ConvSeqInPlace(nObjs, currObj, base, tokenType) - integer nObjs; - DPSBinObj currObj; - char *base; - unsigned char tokenType; -{ - DPSNumFormat numFormat; - - NumFormatFromTokenType(tokenType, &numFormat); - - while (nObjs--) { - unsigned char t = currObj->attributedType & 0x07f; - integer i; - switch (t) { - case DPS_REAL: { - float f; - if (numFormat == dps_ieee) { - if (DPSDefaultByteOrder == dps_hiFirst) - IEEEHighToNative(&currObj->val.realVal, &f); - else - IEEELowToNative(&currObj->val.realVal, &f); - } - else break; /* switch */ - currObj->val.realVal = f; - break; - } - case DPS_ARRAY: - if (currObj->length > 0) - ConvSeqInPlace(currObj->length, (DPSBinObj)(base + currObj->val.arrayVal), base, tokenType); - break; - case DPS_NAME: - case DPS_STRING: - break; - default:; - } /* end switch */ - ++currObj; - } /* end while */ -} -#endif /* !IEEEFLOAT */ - -boolean DPSKnownContext(DPSContext ctxt) -{ - DPSPrivContext cc, c = (DPSPrivContext) ctxt; - DPSPrivSpace ss; - for (ss = spaces; ss != NIL; ss = ss->next) - for (cc = ss->firstContext; cc != NIL; cc = cc->next) - if (cc == c) return true; - return false; -} - -boolean DPSKnownSpace(DPSSpace space) -{ - DPSPrivSpace ss, s = (DPSPrivSpace) space; - for (ss = spaces; ss != NIL; ss = ss->next) - if (ss == s) return true; - return false; -} - -void DPSclientPrintProc ( - DPSContext ctxt, - char *buf, - unsigned nch) -{ - DPSPrivContext cc = (DPSPrivContext) ctxt; - -#define DPS_SEQ_MIN 2 - - DPSCheckInitClientGlobals(); - if (cc == NIL) cc = (DPSPrivContext)dummyCtx; - if (cc == NIL) return; - - if (nch == 0) { /* this is an EOF */ - DPSAssertWarn(buf == NIL, cc, "non-nil output buffer with 0 length"); - cc->eofReceived = true; - if (cc->objBuf) { - /* we were buffering; drop buffered chars on the floor */ - free(cc->objBuf); - cc->objBuf = NIL; - cc->nObjBufChars = 0; - } - } - while (nch > 0) { - char *oldBuf = NIL; - unsigned oldNch = 0; - unsigned n; - if (cc->objBuf) { /* we're buffering */ - unsigned long int m; - char *b = cc->objBuf + cc->nObjBufChars; - integer minSize; - while (cc->nObjBufChars < DPS_SEQ_MIN) { - if (nch == 0) return; - *b++ = *buf++; - ++cc->nObjBufChars; - --nch; - } - b = cc->objBuf; - minSize = (*(b+1) == 0) ? DPS_EXT_HEADER_SIZE : DPS_HEADER_SIZE; - if (cc->nObjBufChars < minSize) { - if (nch + cc->nObjBufChars < (unsigned) minSize) { - os_bcopy(buf, b + cc->nObjBufChars, nch); - cc->nObjBufChars += nch; - return; - } - else { - os_bcopy(buf, b + cc->nObjBufChars, minSize - cc->nObjBufChars); - buf += minSize - cc->nObjBufChars; - nch -= minSize - cc->nObjBufChars; - cc->nObjBufChars = minSize; - } - } - - if (minSize == DPS_HEADER_SIZE) { - unsigned short *sizeP = (unsigned short *)(cc->objBuf+2); - m = *sizeP; - } - else { - unsigned long *extSizeP = (unsigned long *)(cc->objBuf+4); - m = *extSizeP; - } - - /* here with m = BOS total length in bytes, b = cc->objBuf */ - cc->objBuf = (char *)realloc(b, m); - - if (nch + cc->nObjBufChars < m) { - os_bcopy(buf, cc->objBuf + cc->nObjBufChars, nch); - cc->nObjBufChars += nch; - return; - } - else { - os_bcopy(buf, cc->objBuf + cc->nObjBufChars, m - cc->nObjBufChars); - buf += m - cc->nObjBufChars; - nch -= m - cc->nObjBufChars; - cc->nObjBufChars = m; - } - /* we're here only if cc->objBuf contains a complete BOS */ - oldBuf = buf; - oldNch = nch; - buf = cc->objBuf; - nch = cc->nObjBufChars; - cc->objBuf = NIL; - cc->nObjBufChars = 0; - } /* if we're buffering */ - - /* dispose of any plain text. If no binary conversion, all output - is plain text */ - if (cc->contextFlags & DPS_FLAG_NO_BINARY_CONVERSION) n = nch; - else { - for (n = 0; n < nch && - ((unsigned char) buf[n] < 128 || (unsigned char) buf[n] > 159); n++); - } - if ((n > 0) && (cc->textProc != NIL)) { - (*cc->textProc)((DPSContext)cc, buf, n); - } - buf += n; - nch -= n; - - if (nch != 0) { - /* here with the next binary object sequence from a server */ - DPSExtendedBinObjSeq bos; - DPSExtendedBinObjSeqRec bosRec; - DPSBinObj firstObj; - unsigned t; - unsigned long int m; - unsigned minSize; - - if (nch < DPS_SEQ_MIN) { - /* gotta buffer it */ - DPSAssertWarn(nch == 1 && !oldBuf, cc, "illegal binary output from context (oldBuf)"); - cc->objBuf = (char *)DPScalloc(DPS_EXT_HEADER_SIZE, 1); - cc->nObjBufChars = nch; - *cc->objBuf = *buf; - return; - } - /* check for quadbyte alignment */ - if ((long int)buf & (MIN_POINTER_ALIGN - 1)) { - /* not aligned, we gotta copy the buffer */ - /* we assert that we can't have an oldBuf if we're not aligned, - since we only get an oldBuf if we copied to a new buffer, - and we have already tested nch to be at least DPS_SEQ_MIN */ - DPSAssertWarn(!oldBuf && nch > 1, cc, "return values garbled (oldBuf||nch<DPS_SEQ_MIN"); - /* copy DPS_SEQ_MIN bytes, so we can use existing buffering code */ - cc->objBuf = (char *)DPScalloc(DPS_EXT_HEADER_SIZE, 1); - cc->nObjBufChars = DPS_SEQ_MIN; - os_bcopy(buf, cc->objBuf, cc->nObjBufChars); - buf += DPS_SEQ_MIN; - nch -= DPS_SEQ_MIN; - /* now go to top of loop and go through the buffer update code */ - continue; - } - bos = (DPSExtendedBinObjSeq) buf; - t = bos->tokenType; - minSize = (bos->escape == 0) ? DPS_EXT_HEADER_SIZE : DPS_HEADER_SIZE; - if (nch < minSize) { - /* gotta buffer it */ - char *tb; - DPSAssertWarn(!oldBuf, cc, "return values garbled (oldBuf)"); - tb = cc->objBuf = (char *)DPScalloc(minSize, 1); - cc->nObjBufChars = nch; - while (nch--) *tb++ = *buf++; - return; - } - else if (minSize == DPS_HEADER_SIZE) { - /* this is not an extended BOS */ - DPSBinObjSeq seqHead = (DPSBinObjSeq) buf; - bos = &bosRec; - bos->tokenType = t; - bos->nTopElements = seqHead->nTopElements; - bos->length = seqHead->length; - firstObj = &(seqHead->objects[0]); - } - else firstObj = &(bos->objects[0]); - m = bos->length; - if (nch < m) { - /* gotta buffer it */ - DPSAssertWarn(!oldBuf, cc, "return values garbled (oldBuf&&nch<m"); - cc->objBuf = (char *)DPScalloc(bos->length, 1); - cc->nObjBufChars = nch; - os_bcopy(buf, cc->objBuf, nch); - return; - } - DPSAssertWarn(bos->nTopElements == 1, cc, "illegal binary output detected (bos->nTopElements!=1)"); -#if !IEEEFLOAT - if (t != DPS_DEF_TOKENTYPE) - ConvSeqInPlace(1, firstObj, firstObj, bos->tokenType); -#endif /* !IEEEFLOAT */ - t = firstObj->tag; - if (t == DPS_ERR_TAG) { - cc->resultTable = NIL; - DPSSafeSetLastNameIndex((DPSContext)cc); - DURING - if (cc->errorProc != NIL) - (*cc->errorProc)((DPSContext)cc, dps_err_ps, (unsigned long)buf, m); - HANDLER - if (oldBuf) free(buf); - RERAISE; - END_HANDLER - } - else { /* dispatch this result */ - if (!cc->resultTable || t > cc->resultTableLength) { - if (cc->chainParent == NIL && cc->errorProc != NIL) { - DPSSafeSetLastNameIndex((DPSContext)cc); - (*cc->errorProc)((DPSContext)cc, dps_err_resultTagCheck, (unsigned long)buf, m); - } - } - else if (t == cc->resultTableLength) { - cc->resultTable = NIL; - } - else { - StuffResultVal((DPSContext)cc, &cc->resultTable[t], t, firstObj); - } - } - if (!oldBuf) - buf += m; - nch -= m; - } /* if (nch != 0) ... the next binary object sequence from a server */ - if (oldBuf) { - DPSAssertWarn(nch == 0, cc, "some return values/data lost (nch)"); - free(buf); - buf = oldBuf; - nch = oldNch; - } - } /* while (nch > 0) */ - -} /* DPSclientPrintProc */ - -/**************************************/ -/* Context procs for DPSCreateContext */ -/**************************************/ - - -static void procWaitContext(DPSContext ctxt) -{ - typedef struct { - unsigned char tokenType; - unsigned char topLevelCount; - unsigned short int nBytes; - - DPSBinObjGeneric obj0; - DPSBinObjGeneric obj1; - DPSBinObjGeneric obj2; - DPSBinObjGeneric obj3; - } DPSQ; - static DPSQ dpsF = { - DPS_DEF_TOKENTYPE, 4, sizeof(DPSQ), - {DPS_LITERAL|DPS_INT, 0, 0, -23}, /* arbitrary int */ - {DPS_LITERAL|DPS_INT, 0, 0, 0}, /* termination tag = 0 */ - {DPS_EXEC|DPS_NAME, 0, DPSSYSNAME, 119}, /* printobject */ - {DPS_EXEC|DPS_NAME, 0, DPSSYSNAME, 70}, /* flush */ - }; /* DPSQ */ - DPSResultsRec DPSR; - - if (DPSPrivateCheckWait(ctxt)) return; - - ctxt->resultTable = &DPSR; /* must be non-null for handler to work */ - ctxt->resultTableLength = 0; /* same value as termination tag */ - DPSBinObjSeqWrite(ctxt, (char *) &dpsF,sizeof(DPSQ)); - DPSAwaitReturnValues(ctxt); -} - -static void procUpdateNameMap(DPSContext ctxt) -{ - integer i; - DPSPrivContext c = (DPSPrivContext) ctxt; - DPSPrivSpace s = (DPSPrivSpace) ctxt->space; - DPSContext children = ctxt->chainChild; - - /* unlink context from chain temporarily, so DPSPrintf can be called */ - if (children != NIL) ctxt->chainChild = NIL; - DURING - for (i = s->lastNameIndex+1; i <= globLastNameIndex; i++) - DPSPrintf(ctxt, "%d /%s defineusername\n", i, userNames[i]); - HANDLER - if (children != NIL) ctxt->chainChild = children; - RERAISE; - END_HANDLER - c->lastNameIndex = globLastNameIndex; - if (children != NIL) { - /* update any children */ - ctxt->chainChild = children; - DPSUpdateNameMap(ctxt->chainChild); - } -} - -static void procWriteData( - DPSContext ctxt, - char *buf, - unsigned int count) -{ - /* safe to call with chain */ - DPSinnerProcWriteData(ctxt, buf, count); - if (ctxt->chainChild != NIL) DPSWriteData(ctxt->chainChild, buf, count); -} - -static void procBinObjSeqWrite( - DPSContext ctxt, - char *buf, - unsigned int count) -{ - if (((DPSPrivContext)ctxt)->lastNameIndex < globLastNameIndex) DPSUpdateNameMap(ctxt); - DPSinnerProcWriteData(ctxt, buf, count); - if (ctxt->chainChild != NIL) DPSBinObjSeqWrite(ctxt->chainChild, buf, count); -} - -static void procWriteStringChars( - DPSContext ctxt, - char *buf, - unsigned int count) -{ - DPSinnerProcWriteData(ctxt, buf, count); - if (ctxt->chainChild != NIL) DPSWriteStringChars(ctxt->chainChild, buf, count); -} - -static void procWritePostScript( - DPSContext ctxt, - char *buf, - unsigned int count) -{ - DPSinnerProcWriteData(ctxt, buf, count); - if (ctxt->chainChild != NIL) DPSWritePostScript(ctxt->chainChild, buf, count); -} - -static void innerProcWriteNumstring( - DPSContext ctxt, - DPSDefinedType type, - char *data, - unsigned int size, - int scale, - void (*writeProc)(DPSContext, char *, unsigned)) -{ - unsigned char HNumHeader[4]; - register int i; -#define NBUFSIZE 10 - int ibuf[NBUFSIZE]; /* This needs to be a 32 bit datatype */ - - HNumHeader[0] = 149; - switch (type) { - case dps_tLong: - HNumHeader[1] = (DPS_DEF_TOKENTYPE % 2) * 128 + scale; - break; - - case dps_tInt: - HNumHeader[1] = ((sizeof(int) >= 4) ? 0 : 32) - + ((DPS_DEF_TOKENTYPE % 2) * 128) + scale; - break; - - case dps_tShort: - HNumHeader[1] = 32 + ((DPS_DEF_TOKENTYPE % 2) * 128) + scale; - break; - - case dps_tFloat: - HNumHeader[1] = 48 + ((DPS_DEF_TOKENTYPE % 2) * 128) - + ((DPS_DEF_TOKENTYPE >= 130) ? 1 : 0); - break; - - default: - break; - } - - HNumHeader[(DPS_DEF_TOKENTYPE % 2) ? 2 : 3] = (unsigned char) size; - HNumHeader[(DPS_DEF_TOKENTYPE % 2) ? 3 : 2] = (unsigned char) (size >> 8); - - (*writeProc)(ctxt, (char *)HNumHeader, 4); - - switch (type) { - case dps_tLong: - if (sizeof(long) == 4) { - (*writeProc)(ctxt, (char *) data, size * 4); - } else { - while (size > 0) { - for (i = 0; i < NBUFSIZE && (unsigned) i < size; i++) { - ibuf[i] = ((long *) data)[i]; - } - (*writeProc)(ctxt, (char *) ibuf, - 4 * (size < NBUFSIZE ? size : NBUFSIZE)); - size -= NBUFSIZE; - } - } - break; - - case dps_tInt: - (*writeProc)(ctxt, (char *) data, size * sizeof(int)); - break; - - case dps_tShort: - (*writeProc)(ctxt, (char *) data, size * sizeof(short)); - break; - - case dps_tFloat: - (*writeProc)(ctxt, (char *) data, size * sizeof(float)); - - default: - break; - } -} /* innerProcWriteNumstring */ - -static void procWriteNumstring( - DPSContext ctxt, - DPSDefinedType type, - char *data, - unsigned int size, - int scale) -{ - innerProcWriteNumstring(ctxt, type, data, size, scale, DPSinnerProcWriteData); - if (ctxt->chainChild != NIL) DPSWriteNumString(ctxt->chainChild, type, data, size, scale); -} - -static void writeTypedObjectArray( - DPSContext ctxt, - DPSDefinedType type, - char *array, - unsigned int length) -{ - -#define DPSMAX_SEQ 10 - unsigned int i; - DPSPrivContext c = (DPSPrivContext)(ctxt); - static DPSBinObjGeneric bboolObj[DPSMAX_SEQ] = { - {DPS_LITERAL | DPS_BOOL, 0,0,0}, - {DPS_LITERAL | DPS_BOOL, 0,0,0}, - {DPS_LITERAL | DPS_BOOL, 0,0,0}, - {DPS_LITERAL | DPS_BOOL, 0,0,0}, - {DPS_LITERAL | DPS_BOOL, 0,0,0}, - {DPS_LITERAL | DPS_BOOL, 0,0,0}, - {DPS_LITERAL | DPS_BOOL, 0,0,0}, - {DPS_LITERAL | DPS_BOOL, 0,0,0}, - {DPS_LITERAL | DPS_BOOL, 0,0,0}, - {DPS_LITERAL | DPS_BOOL, 0,0,0}, - }; - static DPSBinObjReal rrealObj[DPSMAX_SEQ] = { - {DPS_LITERAL | DPS_REAL, 0,0,0}, - {DPS_LITERAL | DPS_REAL, 0,0,0}, - {DPS_LITERAL | DPS_REAL, 0,0,0}, - {DPS_LITERAL | DPS_REAL, 0,0,0}, - {DPS_LITERAL | DPS_REAL, 0,0,0}, - {DPS_LITERAL | DPS_REAL, 0,0,0}, - {DPS_LITERAL | DPS_REAL, 0,0,0}, - {DPS_LITERAL | DPS_REAL, 0,0,0}, - {DPS_LITERAL | DPS_REAL, 0,0,0}, - {DPS_LITERAL | DPS_REAL, 0,0,0}, - }; - static DPSBinObjGeneric iintObj[DPSMAX_SEQ] = { - {DPS_LITERAL | DPS_INT, 0,0,0}, - {DPS_LITERAL | DPS_INT, 0,0,0}, - {DPS_LITERAL | DPS_INT, 0,0,0}, - {DPS_LITERAL | DPS_INT, 0,0,0}, - {DPS_LITERAL | DPS_INT, 0,0,0}, - {DPS_LITERAL | DPS_INT, 0,0,0}, - {DPS_LITERAL | DPS_INT, 0,0,0}, - {DPS_LITERAL | DPS_INT, 0,0,0}, - {DPS_LITERAL | DPS_INT, 0,0,0}, - {DPS_LITERAL | DPS_INT, 0,0,0}, - }; - - if (DPSCheckShared(c)) return; - - switch (type) { - case dps_tChar: - case dps_tUChar: - DPSCantHappen(); - break; - - case dps_tBoolean: { - while (length > 0) { - for (i = 0; i < MIN(DPSMAX_SEQ, length); i++) { - bboolObj[i].val = *((int *)array); - array += sizeof(int); - } - DPSWritePostScript(ctxt, (char *) bboolObj, sizeof(DPSBinObjGeneric) * i); - length -= i; - } - break; - } - - case dps_tFloat: { - while (length > 0) { - for (i = 0; i < MIN(DPSMAX_SEQ, length); i++) { - rrealObj[i].realVal = *((float *)array); - array += sizeof(float); - } - DPSWritePostScript(ctxt, (char *) rrealObj, sizeof(DPSBinObjReal) * i); - length -= i; - } - break; - } - - case dps_tDouble: { - while (length > 0) { - for (i = 0; i < MIN(DPSMAX_SEQ, length); i++) { - rrealObj[i].realVal = *((double *)array); - array += sizeof(double); - } - DPSWritePostScript(ctxt, (char *) rrealObj, sizeof(DPSBinObjReal) * i); - length -= i; - } - break; - } - - case dps_tShort: { - while (length > 0) { - for (i = 0; i < MIN(DPSMAX_SEQ, length); i++) { - iintObj[i].val = *((short *)array); - array += sizeof(short); - } - DPSWritePostScript(ctxt, (char *) iintObj, sizeof(DPSBinObjGeneric) * i); - length -= i; - } - break; - } - - case dps_tUShort: { - while (length > 0) { - for (i = 0; i < MIN(DPSMAX_SEQ, length); i++) { - iintObj[i].val = *((unsigned short *)array); - array += sizeof(unsigned short); - } - DPSWritePostScript(ctxt, (char *) iintObj, sizeof(DPSBinObjGeneric) * i); - length -= i; - } - break; - } - - case dps_tInt: { - while (length > 0) { - for (i = 0; i < MIN(DPSMAX_SEQ, length); i++) { - iintObj[i].val = *((int *)array); - array += sizeof(int); - } - DPSWritePostScript(ctxt, (char *) iintObj, sizeof(DPSBinObjGeneric) * i); - length -= i; - } - break; - } - - case dps_tUInt: { - while (length > 0) { - for (i = 0; i < MIN(DPSMAX_SEQ, length); i++) { - iintObj[i].val = *((unsigned int *)array); - array += sizeof(unsigned int); - } - DPSWritePostScript(ctxt, (char *) iintObj, sizeof(DPSBinObjGeneric) * i); - length -= i; - } - break; - } - - case dps_tLong: { - while (length > 0) { - for (i = 0; i < MIN(DPSMAX_SEQ, length); i++) { - iintObj[i].val = *((long *)array); - array += sizeof(long); - } - DPSWritePostScript(ctxt, (char *) iintObj, sizeof(DPSBinObjGeneric) * i); - length -= i; - } - break; - } - - case dps_tULong: { - while (length > 0) { - for (i = 0; i < MIN(DPSMAX_SEQ, length); i++) { - iintObj[i].val = *((unsigned long *)array); - array += sizeof(unsigned long); - } - DPSWritePostScript(ctxt, (char *) iintObj, sizeof(DPSBinObjGeneric) * i); - length -= i; - } - break; - - - } - - default:; - } -} /* writeTypedObjectArray */ - -static void procDestroyContext(DPSContext ctxt) -{ - DPSPrivContext c = (DPSPrivContext)ctxt, cc, prev; - DPSPrivSpace ss = (DPSPrivSpace)(c->space); - - if (c->buf != NIL) { - ContextBuffer b = (ContextBuffer)(c->buf); - b->next = contextBuffers; - contextBuffers = b; - c->buf = NIL; - } - if (c->objBuf != NIL) { - free(c->objBuf); - c->objBuf = NIL; - } - - DPSUnchainContext(ctxt); - - prev = NIL; - DPSAssert(ss != NIL); - for (cc = ss->firstContext; (cc != NIL) && (cc != c); cc = cc->next) - prev = cc; - DPSAssert(cc != NIL); - DPSAssert(cc != prev); - if (prev == NIL) ss->firstContext = cc->next; - else { - prev->next = cc->next; - DPSAssert(prev->next != prev); - } - - DPSPrivateDestroyContext(ctxt); - free(c); -} - -static void procDestroySpace(DPSSpace space) -{ - DPSPrivSpace ns, prevS, ss = (DPSPrivSpace)space; - integer sid = ss->sid; - - while (ss->firstContext != NIL) - DPSDestroyContext((DPSContext)(ss->firstContext)); - - prevS = NIL; - for (ns = spaces; (ns != NIL) && (ns->sid != sid); ns = ns->next) - prevS = ns; - DPSAssert(ns != NIL); - DPSAssert(ns == ss); - if (prevS == NIL) spaces = ns->next; - else { - prevS->next = ns->next; - DPSAssert(prevS->next != prevS); - } - - DPSPrivateDestroySpace(space); - free(ss); -} - -static void procInterrupt(DPSContext ctxt) -{ - DPSPrivContext c = (DPSPrivContext)ctxt; - DPSSendInterrupt((XDPSPrivContext)c->wh, c->cid, DPSclientPrintProc); - if (ctxt->chainChild != NIL) DPSInterruptContext(ctxt->chainChild); -} - - -/****************************************************************/ -/* Procedures that support the DPSCreateTextContext context procs */ -/****************************************************************/ - -/* precondition: (c >= 129 && c <= 159), which means that c is the - first byte of either a binary token or a binary object sequence */ - -static boolean IsBinaryToken(unsigned char c) -{ - return (c != DPS_HI_IEEE && c != DPS_LO_IEEE - && c != DPS_HI_NATIVE && c != DPS_LO_NATIVE); -} - -/* returns the number of initial bytes of a given goody that are - required to figure out how many bytes are needed for the entire goody */ - -static unsigned GetHdrNBytes(unsigned char *t) -{ - if (!IsBinaryToken(*t)) { - if (*(++t) == 0) return DPS_EXT_HEADER_SIZE; - else return DPS_HEADER_SIZE; - } - switch (*t) { - case 137: - case 142: - return(2); - case 143: - case 144: - return(3); - case 149: - return(4); - default: - if (*t > 149 && *t < 160) return(1); /* unassigned */ - else return(1); - } -} - - -static void WriteHomogeneousArrayAsASCII( - DPSContext ctxt, - register unsigned char *buf) -{ - Swap32Rec n32; - Swap16Rec n16; - register unsigned char *b; - - unsigned char r = *buf++; - float f; - boolean hi = (r < 128); - - if (!hi) r -= 128; - DPSPrintf(ctxt, "[ "); - b = n16.bytes; - if (hi) {Copy2SrcHi(buf, b);} else {Copy2SrcLo(buf, b);} - buf += 2; - if (r < 32) /* 32-bit fixed */ - while (n16.u--) { - b = n32.bytes; - if (hi) {Copy4SrcHi(buf, b);} else {Copy4SrcLo(buf, b);} - if (r == 0) - DPSPrintf(ctxt, "%d ", n32.i); - else { - f = n32.i; /* convert to float */ - n32.f = f / (1 << r); /* scale */ - DPSPrintf(ctxt, "%g ", n32.f); - } - buf += 4; - } - else if (r < 48) { /* 16-bit fixed */ - unsigned l = n16.u; - r -= 32; - while (l--) { - b = n16.bytes; - if (hi) {Copy2SrcHi(buf, b);} else {Copy2SrcLo(buf, b);} - if (r == 0) - DPSPrintf(ctxt, "%d ", n16.i); - else { - f = n16.i; /* convert to float */ - n32.f = f / (1 << r); /* scale */ - DPSPrintf(ctxt, "%g ", n32.f); - } - buf += 2; - } - } - else if (r == 48) /* 32-bit IEEE */ - while (n16.u--) { -#if IEEEFLOAT - b = n32.bytes; - if (hi) {Copy4SrcHi(buf, b);} else {Copy4SrcLo(buf, b);} -#else /* IEEEFLOAT */ - if (hi) IEEEHighToNative(buf, &n32.f); - else IEEELowToNative(buf, &n32.f); -#endif /* IEEEFLOAT */ - DPSPrintf(ctxt, "%g ", n32.f); - buf += 4; - } - else if (r == 49) /* 32-bit native */ - while (n16.u--) { - b = n32.bytes; - *b++ = *buf++,*b++ = *buf++,*b++ = *buf++,*b = *buf++; - DPSPrintf(ctxt, "%g ", n32.f); - } - else DPSCantHappen(); - DPSPrintf(ctxt, "\n] "); -} /* WriteHomogeneousArrayAsASCII */ - -/* returns the number of bytes needed for the entire goody. buf points - to enough initial bytes of the goody to figure this out (see above). */ - -static integer GetNBytes(register unsigned char *buf) -{ - unsigned short int nBytes; - register unsigned char *r = (unsigned char *)&nBytes; - - switch (*buf) { - case DPS_HI_IEEE: - case DPS_HI_NATIVE: - if (*(buf+1) == 0) { - unsigned int nb; - r = (unsigned char *)&nb; - buf += 4; - Copy4SrcHi(buf, r); - return(nb); - } - else { - buf += 2; - Copy2SrcHi(buf, r); - } - break; - case DPS_LO_IEEE: - case DPS_LO_NATIVE: - if (*(buf+1) == 0) { - unsigned int nb; - r = (unsigned char *)&nb; - buf += 4; - Copy4SrcLo(buf, r); - return(nb); - } - else { - buf += 2; - Copy2SrcLo(buf, r); - } - break; - case 132: - case 133: - case 138: - case 139: - case 140: - nBytes = 5; break; - case 134: - case 135: - nBytes = 3; break; - case 136: - case 141: - case 145: - case 146: - case 147: - case 148: - nBytes = 2; break; - case 137: { - unsigned int l = *(buf+1); - if (l < 32) {nBytes = 6; break;} - if (l < 48) {nBytes = 4; break;} - if (l-128 < 32) {nBytes = 6; break;} - if (l-128 < 48) {nBytes = 4; break;} - DPSCantHappen(); - } - case 142: - nBytes = *(buf+1); - nBytes += 2; - break; - case 143: - buf++; - Copy2SrcHi(buf, r); - nBytes += 3; - break; - case 144: - buf++; - Copy2SrcLo(buf, r); - nBytes += 3; - break; - case 149: { - unsigned char scale = *(buf+1); - buf += 2; - if (scale < 128) - Copy2SrcHi(buf, r); - else { - scale -= 128; - Copy2SrcLo(buf, r); - } - if (scale < 32) - nBytes *= 4; - else if (scale < 48) - nBytes *= 2; - else - nBytes *= 4; - nBytes += 4; - break; - } - default: nBytes = 1; /* unassigned */ - } - return(nBytes); -} - -static void WriteSeqAsAscii( - DPSContext ctxt, - char *base, - DPSBinObj currObj, - unsigned int nObjs, - unsigned char tokenType, - int *numstringOffsets) -{ - integer nLineObjs = 0; - DPSNumFormat numFormat; - float f; - long int i; - unsigned short int length; - - /* NOTE: It's ok to call DPSPrintf (which calls DPSWritePostScript) - from here since we are only sending text, so there's no problem - with re-entering DPSWritePostScript. Caller guarantees - that this context has no children. */ - - NumFormatFromTokenType(tokenType, &numFormat); - - while (nObjs--) { - unsigned char type = currObj->attributedType & ~DPS_EXEC; - boolean lit = ((currObj->attributedType & DPS_EXEC) == 0); - - switch (type) { - case DPS_NULL: - break; - case DPS_BOOL: - i = currObj->val.booleanVal; - if (i) - DPSPrintf(ctxt, "true "); - else - DPSPrintf(ctxt, "false "); - break; - case DPS_INT: - i = currObj->val.integerVal; - DPSPrintf(ctxt, "%d ", i); - break; - case DPS_REAL: -#if IEEEFLOAT - f = currObj->val.realVal; -#else /* IEEEFLOAT */ - if (numFormat != DPSDefaultNumFormat) -#if SWAPBITS - IEEELowToNative(&currObj->val.realVal, &f); -#else /* SWAPBITS */ - IEEEHighToNative(&currObj->val.realVal, &f); -#endif /* SWAPBITS */ - else - f = currObj->val.realVal; -#endif /* IEEEFLOAT */ - - DPSPrintf(ctxt, "%g ", f); - break; - case DPS_NAME: { - char *p = 0; - integer index; - - index = currObj->val.nameVal; - length = currObj->length; - - if (lit) DPSPrintf(ctxt, "/"); - - if (length == DPSSYSNAME) { /* system name index */ - if (index <= DPS_LAST_COMMON_SYSNAME) { - if (!lit && (ctxt->contextFlags & DPS_FLAG_USE_ABBREVS)) { - p = DPSGetSysnameAbbrev(index); - if (p == NULL) p = DPSSysNames[index]; - } else p = DPSSysNames[index]; - } else if (DPS_FIRST_AUX_SYSNAME <= index - && index <= DPS_LAST_AUX_SYSNAME) - p = DPSSysNamesAux[index - DPS_FIRST_AUX_SYSNAME]; - else DPSCantHappen(); - length = strlen(p); - } - else if (length == 0) { /* user name index */ - p = DPSNameFromIndex(index); - length = strlen(p); - } - else - p = base + index; - - DPSWriteData(ctxt, p, length); - DPSPrintf(ctxt, " "); - break; - } - case DPS_ARRAY: - DPSPrintf(ctxt, (lit ? "[ " : "{ ")); - WriteSeqAsAscii( - ctxt, - base, - (DPSBinObj)(base+currObj->val.arrayVal), - currObj->length, - tokenType, numstringOffsets); - DPSPrintf(ctxt, (lit ? " ] " : " } ")); - break; - case DPS_MARK: - if (lit) - DPSPrintf(ctxt, "/mark "); - else - DPSPrintf(ctxt, "mark "); - break; - case DPS_STRING: { - char *p; - int j; - i = currObj->val.stringVal; - length = currObj->length; - p = base + i; - if (numstringOffsets != NULL) { - for (j = 2; j < numstringOffsets[1] && - numstringOffsets[j] != i; j++) ; - if (numstringOffsets[j] == i) { - DPSAssert(*(unsigned char *) p++ == 149); - WriteHomogeneousArrayAsASCII(ctxt, (unsigned char *) p); - break; - } - } - DPSPrintf(ctxt, "("); -#ifdef VMS - WriteVMSStringBody(ctxt, p, length); /* write this */ -#else /* VMS */ - /* render string bytes correctly */ - while (length--) { - char c = *p++; - if (c == '(' || c == ')' || c == '\\') - DPSPrintf(ctxt, "\\%c", c); - else if (c == '\n') - DPSPrintf(ctxt, "\\n"); - else if (!(isascii(c) && isprint(c))) - DPSPrintf(ctxt, "\\%03.3o", (unsigned char) c); - else DPSWriteData(ctxt, &c, 1); - } -#endif /* VMS */ - DPSPrintf(ctxt, ") "); - break; - } - default: DPSCantHappen(); - } - - currObj++; - if (++nLineObjs == 15) { - nLineObjs = 0; - DPSPrintf(ctxt, "\n "); - } - } /* end while */ - - DPSPrintf(ctxt, "\n"); - -} /* WriteSeqAsAscii */ - -static void ConvertAndWriteSeqAsData( - DPSContext ctxt, - char *bosBuf, - int pass) -{ - DPSPrivContext cc = (DPSPrivContext) ctxt; - DPSExtendedBinObjSeq bos; - DPSExtendedBinObjSeqRec bosRec; - DPSNumFormat numFormat; - unsigned int offset, firstCharOffset; - unsigned int nameOffset; - unsigned int len = 0; - DPSBinObj currObj; - integer headSize; - char *seqBase; - - if (*(bosBuf+1) != 0) { - /* not an extended BOS */ - DPSBinObjSeq seqHead = (DPSBinObjSeq) bosBuf; - bos = &bosRec; - bos->tokenType = seqHead->tokenType; - bos->escape = seqHead->nTopElements; - bos->nTopElements = seqHead->nTopElements; - bos->length = seqHead->length; - currObj = &(seqHead->objects[0]); - seqBase = (char *) &(seqHead->objects[0]); - headSize = DPS_HEADER_SIZE; - } - else { - bos = (DPSExtendedBinObjSeq) bosBuf; - currObj = &(bos->objects[0]); - seqBase = (char *) &(bos->objects[0]); - headSize = DPS_EXT_HEADER_SIZE; - } - firstCharOffset = bos->length - headSize; - nameOffset = firstCharOffset; - - /* Caller guarantees that this context has no children, - so it is okay to call DPSWriteData */ - - NumFormatFromTokenType(bos->tokenType, &numFormat); - - /* Pass 0: If we're expanding name indices, find all name objects, - lookup their strings, sum the lengths. - Write the modified sequence header regardless. - Pass 1: we're converting indices to strings and/or - converting numbers. Write each modified object, and - subsidiary strings. - Pass 2: Find all name objects, lookup and write the strings. */ - - if (pass == 0 && ctxt->nameEncoding != dps_strings) - /* we're just converting numbers, so skip while loop */ - offset = firstCharOffset; - else - offset = 0; - - while (offset < firstCharOffset) { - DPSBinObjRec newObj; - unsigned char type = (currObj->attributedType & ~DPS_EXEC); - - newObj = *currObj; - -#if !IEEEFLOAT - if (type == DPS_REAL) { - if (numFormat != cc->numFormat) { - if (numFormat == dps_ieee) { - if (DPSDefaultByteOrder == dps_loFirst) - IEEELowToNative(&currObj->val.realVal, &newObj.val.realVal); - else - IEEEHighToNative(&currObj->val.realVal, &newObj.val.realVal); - } - else { /* numFormat is native */ - if (DPSDefaultByteOrder == dps_loFirst) - NativeToIEEELow(&currObj->val.realVal, &newObj.val.realVal); - else - NativeToIEEEHigh(&currObj->val.realVal, &newObj.val.realVal); - } - } - } -#endif /* !IEEEFLOAT */ - - if (type == DPS_STRING && newObj.length > 0) { - /* keep track of where strings start */ - firstCharOffset = ((unsigned) newObj.val.stringVal < firstCharOffset) - ? newObj.val.stringVal : firstCharOffset; - } - if (type == DPS_NAME) { - if (newObj.length == DPSSYSNAME) { /* system name index, never expand to string body */ - if (pass != 1) goto next_obj; - } - else if (newObj.length == 0) { /* user name index */ - register char *p = DPSNameFromIndex(newObj.val.nameVal); - switch (pass) { - case 0: len += strlen(p); goto next_obj; - case 1: - if (ctxt->nameEncoding == dps_strings) { - newObj.length = strlen(p); - newObj.val.nameVal = nameOffset; - nameOffset += newObj.length; - } - break; - case 2: DPSWriteData(ctxt, p, strlen(p)); goto next_obj; - default:; - } - } - else { /* name is already a string */ - /* keep track of where strings start */ - firstCharOffset = ((unsigned) newObj.val.nameVal < firstCharOffset) - ? newObj.val.nameVal : firstCharOffset; - } - } /* end if type == DPS_NAME */ - if (pass == 1) { - DPSWriteData(ctxt, (char *) &newObj, sizeof(newObj)); - } - -next_obj: - offset += sizeof(newObj); - ++currObj; - } /* end while */ - - /* finish pass */ - switch (pass) { - case 0: { - unsigned char t; - /* write modified seqHead */ - if (DPSDefaultByteOrder == dps_hiFirst && cc->numFormat == dps_ieee) - t = DPS_HI_IEEE; - else if (DPSDefaultByteOrder == dps_loFirst && cc->numFormat == dps_ieee) - t = DPS_LO_IEEE; - else if (DPSDefaultByteOrder == dps_hiFirst && cc->numFormat == dps_native) - t = DPS_HI_NATIVE; - else - t = DPS_LO_NATIVE; - DPSWriteData(ctxt, (char *) &t, 1); - if (headSize == DPS_HEADER_SIZE) { - unsigned short int nBytes; - unsigned char c = bos->nTopElements; - /* write top level count */ - DPSWriteData(ctxt, (char *) &c, 1); - /* write nBytes */ - nBytes = (ctxt->nameEncoding == dps_strings) ? bos->length + len : - bos->length; - DPSWriteData(ctxt, (char *)&nBytes, 2); - } - else { - unsigned int nBytes; - /* write escape code & top level count */ - DPSWriteData(ctxt, (char *)&bos->escape, 3); - /* write nBytes */ - nBytes = (ctxt->nameEncoding == dps_strings) ? bos->length + len : - bos->length; - DPSWriteData(ctxt, (char *)&nBytes, 4); - } - break; - } - case 1: { - char *stringStart = seqBase + firstCharOffset; - DPSWriteData(ctxt, stringStart, (bos->length - headSize - firstCharOffset)); - break; - } - default:; - } - -} /* ConvertAndWriteSeqAsData */ - -#define MIN16 -32768 -#define MAX16 32767 - -/* TestHomogeneous will return a non-negative representation code 'r' - if all of the array elements are "integers", or all are "reals". - Will return -1 for any other case. */ - -static integer TestHomogeneous( - DPSBinObj aryObj, - unsigned short length, - DPSNumFormat numFormat) -{ - integer tmp, r = -1; - - while (length--) { - switch (aryObj->attributedType & ~DPS_EXEC) { - case DPS_INT: -#if SWAPBITS - tmp = (aryObj->val.integerVal < MIN16 - || aryObj->val.integerVal > MAX16) ? 128 : 128+32; -#else /* SWAPBITS */ - tmp = (aryObj->val.integerVal < MIN16 - || aryObj->val.integerVal > MAX16) ? 0 : 32; -#endif /* SWAPBITS */ - if ((r == -1) || ((r & 0x07F) == 32 && (tmp & 0x07F) == 0)) - r = tmp; /* first element, or was 16-bit => bump to 32-bit */ - else if ((r & 0x07F) == 0 && (tmp & 0x07F) == 32) - goto bump_obj; /* is 32-bit => stay 32-bit */ - else if (r != tmp) - return(-1); - /* else fall thru, r == tmp */ - break; - case DPS_REAL: -#if SWAPBITS - tmp = (numFormat == dps_ieee) ? 128+48 : 128+49; -#else /* SWAPBITS */ - tmp = (numFormat == dps_ieee) ? 48 : 49; -#endif /* SWAPBITS */ - if (r == -1) - r = tmp; - else if (r != tmp) return(-1); - break; - default: return(-1); - } -bump_obj: - ++aryObj; - } - return(r); -} /* TestHomogeneous */ - -static void WriteSeqAsTokens( - DPSContext ctxt, - char *base, - DPSBinObj currObj, - unsigned int nObjs, - unsigned char tokenType, - int *numstringOffsets) -{ - int nLineObjs = 0; - DPSNumFormat numFormat; - unsigned short length; - Swap32Rec n32; - Swap16Rec n16; - unsigned char c; - -#define PB(byte) c = (byte),DPSWriteData(ctxt, (char *) &c, 1) -#if SWAPBITS -#define WTT(byte) PB((byte)+1) -#else /* SWAPBITS */ -#define WTT(byte) PB(byte) -#endif /* SWAPBITS */ - - NumFormatFromTokenType(tokenType, &numFormat); - - while (nObjs--) { - unsigned char type = currObj->attributedType & ~DPS_EXEC; - boolean lit = ((currObj->attributedType & DPS_EXEC) == 0); - - switch (type) { - case DPS_NULL: - break; - case DPS_BOOL: - PB(141); /* boolean */ - if (currObj->val.booleanVal) - PB(true); - else - PB(false); - break; - case DPS_INT: - n32.i = currObj->val.integerVal; - if (n32.i < MIN16 || n32.i > MAX16) { - WTT(132); /* 32-bit int */ - DPSWriteData(ctxt, (char *) n32.bytes, 4); - } - else if (n32.i < -128 || n32.i > 127) { - WTT(134); /* 16-bit int */ - n16.i = n32.i; - DPSWriteData(ctxt, (char *) n16.bytes, 2); - } - else { - WTT(136); /* 8-bit int */ - PB(n32.i); - } - break; - case DPS_REAL: -#if IEEEFLOAT - WTT(138); /* 32-bit IEEE float */ -#else /* IEEEFLOAT */ - if (numFormat != DPSDefaultNumFormat) - /* then it must be IEEE */ - WTT(138); /* 32-bit IEEE float */ - else - PB(140); /* 32-bit native float */ -#endif /* IEEEFLOAT */ - - DPSWriteData(ctxt, (char *) &currObj->val.realVal, 4); - break; - case DPS_NAME: { - char *p = 0; - integer index = currObj->val.nameVal; - - length = currObj->length; - if (length == DPSSYSNAME) {/* system name index */ - if (index >= 0 && index < 256) { - if (lit) - PB(145); /* literal system name */ - else - PB(146); /* exec. system name */ - PB(index); - goto next_obj; - } - else if (DPS_FIRST_AUX_SYSNAME <= index - && index <= DPS_LAST_AUX_SYSNAME) - p = DPSSysNamesAux[index - DPS_FIRST_AUX_SYSNAME]; - else DPSCantHappen(); - length = strlen(p); - } - else if (length == 0) { /* user name index */ - if (ctxt->nameEncoding == dps_indexed && index < 256) { - if (lit) - PB(147); /* literal user name index */ - else - PB(148); /* executable user name index */ - PB(index); - goto next_obj; - } - else { - p = DPSNameFromIndex(index); - length = strlen(p); - } - } - else - p = base + index; - if (lit) DPSPrintf(ctxt, "/"); - DPSWriteData(ctxt, p, length); - DPSPrintf(ctxt, " "); - break; - } - case DPS_ARRAY: { - DPSBinObj aryObj = (DPSBinObj)(base+currObj->val.arrayVal); - integer r; - length = currObj->length; - if (lit && (r = TestHomogeneous(aryObj, length, numFormat)) != -1) { - PB(149); /* homogeneous number array */ - PB(r); - DPSWriteData(ctxt, (char *) &length, 2); - if (r > 127) r -= 128; - while (length--) { - switch (r) { - case 0: - DPSWriteData(ctxt, (char *) &aryObj->val.integerVal, 4); - break; - case 32: - n16.i = aryObj->val.integerVal; - DPSWriteData(ctxt, (char *) n16.bytes, 2); - break; - case 48: - case 49: - DPSWriteData(ctxt, (char *) &aryObj->val.realVal, 4); - break; - default: DPSCantHappen(); - } - ++aryObj; - } - } - else { - DPSPrintf(ctxt, (lit ? "[ " : "{ ")); - WriteSeqAsTokens(ctxt, base, aryObj, length, tokenType, - numstringOffsets); - DPSPrintf(ctxt, (lit ? " ] " : " } ")); - } - break; } - case DPS_MARK: - if (lit) - DPSPrintf(ctxt, "/mark "); - else - DPSPrintf(ctxt, "mark "); - break; - case DPS_STRING: { - char *p = base + currObj->val.stringVal; - int i; - if (numstringOffsets != NULL) { - for (i = 2; i < numstringOffsets[1] && - numstringOffsets[i] != currObj->val.stringVal; i++) ; - if (numstringOffsets[i] == currObj->val.stringVal) { - DPSAssert(*(unsigned char *) p == 149); - DPSWriteData(ctxt, p, length); - break; - } - } - length = currObj->length; - if (length < 256) { - PB(142); /* short string */ - PB(length); - } - else { - WTT(143); /* long string */ - DPSWriteData(ctxt, (char *) &length, 2); - } - DPSWriteData(ctxt, p, length); - break; - } - default: DPSCantHappen(); - } -next_obj: - ++currObj; - if (++nLineObjs == 15) { - nLineObjs = 0; - DPSPrintf(ctxt, "\n "); - } - } /* end while */ - - DPSPrintf(ctxt, "\n"); -} /* WriteSeqAsTokens */ - -static void WriteTokenAsAscii( - DPSContext ctxt, - register unsigned char *buf) -{ - Swap32Rec n32; - Swap16Rec n16; - register unsigned char *b; - - switch (*buf++) { - case 132: /* 32-bit int, hi */ - b = n32.bytes; - Copy4SrcHi(buf, b); - DPSPrintf(ctxt, "%d ", n32.i); - break; - case 133: /* 32-bit int, lo */ - b = n32.bytes; - Copy4SrcLo(buf, b); - DPSPrintf(ctxt, "%d ", n32.i); - break; - case 134: /* 16-bit int, hi */ - b = n16.bytes; - Copy2SrcHi(buf, b); - DPSPrintf(ctxt, "%d ", n16.i); - break; - case 135: /* 16-bit int, lo */ - b = n16.bytes; - Copy2SrcLo(buf, b); - DPSPrintf(ctxt, "%d ", n16.i); - break; - case 136: /* 8-bit int, signed */ - n32.i = (char) *buf; - DPSPrintf(ctxt, "%d ", n32.i); - break; - case 137: { /* 16 or 32-bit fixed */ - unsigned char r = *buf++; - float f = 0.0; - boolean hi = (r < 128); - - if (!hi) r -= 128; - if (r < 32) { /* 32-bit */ - b = n32.bytes; - if (hi) {Copy4SrcHi(buf, b);} else {Copy4SrcLo(buf, b);} - if (r == 0) { - DPSPrintf(ctxt, "%d ", n32.i); - break; - } - else { - f = n32.i; /* convert to float */ - goto do_scale; - } - } - else if (r < 48) { /* 16-bit */ - b = n16.bytes; - if (hi) {Copy2SrcHi(buf, b);} else {Copy2SrcLo(buf, b);}; - if (r == 0) { - DPSPrintf(ctxt, "%d ", n16.i); - break; - } - else { - r -= 32; - f = n16.i; /* convert to float */ - goto do_scale; - } - } - else DPSCantHappen(); -do_scale: - n32.f = f / (1 << r); /* scale */ - DPSPrintf(ctxt, "%g ", n32.f); - break; - } - case 138: /* 32-bit IEEE float, hi */ -#if IEEEFLOAT - b = n32.bytes; - Copy4SrcHi(buf, b); -#else /* IEEEFLOAT */ - IEEEHighToNative(buf, &n32.f); -#endif /* IEEEFLOAT */ - DPSPrintf(ctxt, "%g ", n32.f); - break; - case 139: /* 32-bit IEEE float, lo */ -#if IEEEFLOAT - b = n32.bytes; - Copy4SrcLo(buf, b); -#else /* IEEEFLOAT */ - IEEELowToNative(buf, &n32.f); -#endif /* IEEEFLOAT */ - DPSPrintf(ctxt, "%g ", n32.f); - break; - case 140: /* 32-bit native float */ - b = n32.bytes; - *b++ = *buf++,*b++ = *buf++,*b++ = *buf++,*b = *buf; - DPSPrintf(ctxt, "%g ", n32.f); - break; - case 141: /* boolean */ - if (*buf) - DPSPrintf(ctxt, "true "); - else - DPSPrintf(ctxt, "false "); - break; - case 142: /* short string */ - DPSPrintf(ctxt, "("); - n16.u = *buf++; - goto share_str_code; - case 143: /* long string, hi */ - b = n16.bytes; - Copy2SrcHi(buf, b); - DPSPrintf(ctxt, "("); - buf += 2; - goto share_str_code; - case 144: /* long string, lo */ - b = n16.bytes; - Copy2SrcLo(buf, b); - DPSPrintf(ctxt, "("); - buf += 2; -share_str_code: -#ifdef VMS - WriteVMSStringBody(ctxt, buf, n16.u); /* write this */ -#else /* VMS */ - /* render string bytes correctly */ - while (n16.u--) { - unsigned char c = *buf++; - if (c == '(' || c == ')' || c == '\\') - DPSPrintf(ctxt, "\\%c", c); - else if (c == '\n') - DPSPrintf(ctxt, "\\n"); - else if (!(isascii(c) && isprint(c))) - DPSPrintf(ctxt, "\\%03.3o", c); - else DPSWriteData(ctxt, (char *) &c, 1); - } -#endif /* VMS */ - DPSPrintf(ctxt, ") "); - break; - case 145: /* literal system name index */ - DPSPrintf(ctxt, "/%s ", DPSSysNames[*buf]); - break; - case 146: /* executable system name index */ - DPSPrintf(ctxt, "%s ", DPSSysNames[*buf]); - break; - case 147: /* literal user name index */ - DPSPrintf(ctxt, "/%s ", DPSNameFromIndex(*buf)); - break; - case 148: /* executable user name index */ - DPSPrintf(ctxt, "%s ", DPSNameFromIndex(*buf)); - break; - case 149: { /* homogeneous number array */ - WriteHomogeneousArrayAsASCII(ctxt, buf); - break; - } - default:; /* unassigned */ - } -} /* WriteTokenAsAscii */ - - -/* WriteEntireGoody converts an entire binary token or binary object - sequence as specified by ctxt's encoding parameters. Write the - converted bytes via DPSWriteData. buf points to the complete goody. */ - -static void WriteEntireGoody( - DPSContext ctxt, - unsigned char *buf, - int *numstringOffsets) -{ - - DPSExtendedBinObjSeq bos = (DPSExtendedBinObjSeq) buf; - DPSExtendedBinObjSeqRec bosRec; - DPSBinObj currObj; - DPSPrivContext cc = (DPSPrivContext) ctxt; - - if (IsBinaryToken(*buf)) { - /* only supported conversion is binary token to ASCII */ - WriteTokenAsAscii(ctxt, buf); - if (numstringOffsets) numstringOffsets[1] = 2; - return; - } - - if (bos->escape != 0) { - /* not extended BOS */ - DPSBinObjSeq seqHead = (DPSBinObjSeq) buf; - bos = &bosRec; - bos->tokenType = seqHead->tokenType; - bos->escape = seqHead->nTopElements; - bos->nTopElements = seqHead->nTopElements; - bos->length = seqHead->length; - currObj = &(seqHead->objects[0]); - } - else currObj = &(bos->objects[0]); - - switch (ctxt->programEncoding) { - case dps_binObjSeq: - if (ctxt->nameEncoding == dps_strings) { - /* takes three passes to do conversions */ - ConvertAndWriteSeqAsData(ctxt, (char *) buf, 0); - ConvertAndWriteSeqAsData(ctxt, (char *) buf, 1); - ConvertAndWriteSeqAsData(ctxt, (char *) buf, 2); - } - else if (bos->tokenType != DPS_DEF_TOKENTYPE - || cc->numFormat != DPSDefaultNumFormat) { - /* first pass just writes modified seqHead */ - ConvertAndWriteSeqAsData(ctxt, (char *) buf, 0); - /* second pass converts numbers and writes the sequence */ - ConvertAndWriteSeqAsData(ctxt, (char *) buf, 1); - } - else DPSWriteData(ctxt, (char *) buf, bos->length); - break; - case dps_ascii: - case dps_encodedTokens: { - - if (ctxt->programEncoding == dps_ascii) - { - WriteSeqAsAscii( - ctxt, (char *)currObj, currObj, bos->nTopElements, - bos->tokenType, numstringOffsets); - } - else - WriteSeqAsTokens( - ctxt, (char *)currObj, currObj, bos->nTopElements, - bos->tokenType, numstringOffsets); - DPSWriteData(ctxt, "\n", 1); - break; - } - default:; - } - if (numstringOffsets) numstringOffsets[1] = 2; -} /* WriteEntireGoody */ - - -/**************************************/ -/* Context procs for DPSCreateTextContext */ -/**************************************/ - -static void textWriteData(DPSContext ctxt, char *buf, unsigned int nch) -{ - (*ctxt->textProc)(ctxt, buf, nch); - if (ctxt->chainChild != NIL) DPSWriteData(ctxt->chainChild, buf, nch); -} - -static void textFlushContext(DPSContext ctxt) -{ - if (ctxt->chainChild != NIL) DPSFlushContext(ctxt->chainChild); -} - -static void textInterruptContext(DPSContext ctxt) -{ - if (ctxt->chainChild != NIL) DPSInterruptContext(ctxt->chainChild); -} - -static void textDestroyContext(DPSContext ctxt) -{ - DPSPrivContext c = (DPSPrivContext)ctxt; - - DPSUnchainContext(ctxt); - - free(c); -} - -static void textInnerWritePostScript( - DPSContext ctxt, char *buf, unsigned int nch) -{ - DPSPrivContext cc = (DPSPrivContext)ctxt; - while (nch > 0) { - char *oldBuf = NIL; - integer oldNch = 0; - unsigned n; - if (cc->outBuf) { /* we're buffering */ - unsigned m; - integer bst; - if (!IsBinaryToken(cc->outBuf[0]) && cc->nOutBufChars < DPS_SEQ_MIN) { - char *tb = cc->outBuf + cc->nOutBufChars; - integer nn = DPS_SEQ_MIN - cc->nOutBufChars; - DPSAssert(nn == 1); - cc->nOutBufChars += nn; - nch -= nn; - *tb++ = *buf++; - } - bst = GetHdrNBytes((unsigned char *) cc->outBuf); - /* # bytes needed to determine size */ - if (cc->nOutBufChars < bst) { - char *b = cc->outBuf; - if (nch + cc->nOutBufChars < (unsigned) bst) { - os_bcopy(buf, cc->outBuf + cc->nOutBufChars, nch); - cc->nOutBufChars += nch; - return; - } - os_bcopy(buf, b + cc->nOutBufChars, bst - cc->nOutBufChars); - buf += bst - cc->nOutBufChars; - nch -= bst - cc->nOutBufChars; - cc->nOutBufChars = bst; - m = GetNBytes((unsigned char *) cc->outBuf); - cc->outBuf = (char *)DPScalloc(m, 1); - os_bcopy(b, cc->outBuf, bst); - free(b); - } - else m = GetNBytes((unsigned char *) cc->outBuf); - - /* here with size of entire goody in m and outBuf set up */ - if (nch + cc->nOutBufChars < m) { - os_bcopy(buf, cc->outBuf + cc->nOutBufChars, nch); - cc->nOutBufChars += nch; - return; - } - os_bcopy(buf, cc->outBuf + cc->nOutBufChars, m - cc->nOutBufChars); - buf += m - cc->nOutBufChars; - nch -= m - cc->nOutBufChars; - cc->nOutBufChars = m; - oldBuf = buf; - oldNch = nch; - buf = cc->outBuf; - nch = cc->nOutBufChars; - cc->outBuf = NIL; - cc->nOutBufChars = 0; - } /* if (cc->outBuf) */ - - /* dispose of any plain text. If no binary conversion, all output - is plain text */ - if (cc->contextFlags & DPS_FLAG_NO_BINARY_CONVERSION) n = nch; - else { - for (n = 0; n < nch && - ((unsigned char) buf[n] < 128 || (unsigned char) buf[n] > 159); n++); - } - if (n > 0) { - /* Assumes below that any error proc called uses dpsexcept.h - if it rips control away */ - DURING - DPSWriteData((DPSContext)cc, buf, n); - HANDLER - if (oldBuf) free(buf); - RERAISE; - END_HANDLER - } - buf += n; - nch -= n; - - if (nch != 0) { - /* here with the next binary object sequence or encoded token */ - unsigned m = 0; - integer bst; - if (!IsBinaryToken(buf[0]) && nch < DPS_SEQ_MIN) { - /* gotta buffer it */ - DPSAssertWarn(nch == 1 && !oldBuf, cc, "problem converting binary token/sequence (nch!=1||oldBuf)"); - cc->outBuf = (char *)DPScalloc(DPS_EXT_HEADER_SIZE, 1); - cc->nOutBufChars = nch; - cc->outBuf[0] = *buf; - return; - } - bst = GetHdrNBytes((unsigned char *) buf); - if (nch < (unsigned)bst || nch < (m = GetNBytes((unsigned char *) buf))) { - /* gotta buffer it */ - DPSAssertWarn(!oldBuf, cc, "problem converting binary token/sequence (oldBuf)"); - if (nch < (unsigned) bst) { - cc->outBuf = (char *)DPScalloc(bst, 1); - } - else { - cc->outBuf = (char *)DPScalloc(m, 1); - } - cc->nOutBufChars = nch; - os_bcopy(buf, cc->outBuf, nch); - return; - } - - /* Assumes below that any error proc called uses dpsexcept.h - if it rips control away */ - DURING - WriteEntireGoody(ctxt, (unsigned char *) buf, cc->numstringOffsets); - HANDLER - if (oldBuf) { - DPSAssertWarn(nch == m, cc, "some converted PostScript language may be lost during error recovery (nch!=m)"); - free(buf); - } - RERAISE; - END_HANDLER - - if (oldBuf) { - DPSAssertWarn(nch == m, cc, "some converted PostScript language may be lost (nch!=m)"); - free(buf); - buf = oldBuf; - nch = oldNch; - oldBuf = NIL; - } - else { - buf += m; - nch -= m; - } - } /* if (nch != 0) */ - } /* while (nch > 0) */ -} /* textInnerWritePostScript */ - -static void textWritePostScript( - DPSContext ctxt, char *buf, unsigned int nch) -{ - DPSContext children = ctxt->chainChild; - /* disconnect temporarily so that high level procs can - be called safely */ - if (children != NIL) ctxt->chainChild = NIL; - DURING - textInnerWritePostScript(ctxt, buf, nch); - HANDLER - if (children != NIL) ctxt->chainChild = children; - RERAISE; - END_HANDLER - if (children != NIL) { - ctxt->chainChild = children; - DPSWritePostScript(ctxt->chainChild, buf, nch); - } -} - -static void textWriteStringChars( - DPSContext ctxt, char *buf, unsigned int nch) -{ - DPSContext children = ctxt->chainChild; - - if (DPSCheckShared((DPSPrivContext)ctxt)) return; - /* disconnect temporarily so that high level procs can - be called safely */ - if (children != NIL) ctxt->chainChild = NIL; - DURING - textInnerWritePostScript(ctxt, buf, nch); - HANDLER - if (children != NIL) ctxt->chainChild = children; - RERAISE; - END_HANDLER - if (children != NIL) { - ctxt->chainChild = children; - DPSWriteStringChars(ctxt->chainChild, buf, nch); - } -} - -static void textBinObjSeqWrite( - DPSContext ctxt, char *buf, unsigned int nch) -{ - DPSContext children = ctxt->chainChild; - DPSPrivContext c = (DPSPrivContext) ctxt; - - if (DPSCheckShared(c)) return; - if (c->lastNameIndex < globLastNameIndex) - DPSUpdateNameMap(ctxt); - /* disconnect temporarily so that high level procs can - be called safely */ - if (children != NIL) ctxt->chainChild = NIL; - DURING - textInnerWritePostScript(ctxt, buf, nch); - HANDLER - if (children != NIL) ctxt->chainChild = children; - RERAISE; - END_HANDLER - if (children != NIL) { - ctxt->chainChild = children; - DPSBinObjSeqWrite(ctxt->chainChild, buf, nch); - } -} - -static void textWriteNumstring( - DPSContext ctxt, - DPSDefinedType type, - char *data, - unsigned int size, - int scale) -{ - DPSPrivContext cc = (DPSPrivContext) ctxt; -#define BUFFER_GROW 10 - - if (cc->contextFlags & DPS_FLAG_CONVERT_NUMSTRINGS) { - if (cc->numstringOffsets == NULL) { - cc->numstringOffsets = (int *) DPScalloc(sizeof(int), - BUFFER_GROW + 2); - cc->numstringOffsets[0] = BUFFER_GROW + 2; /* Current size */ - cc->numstringOffsets[1] = 2; /* Next slot */ - } else if (cc->numstringOffsets[1] >= cc->numstringOffsets[0]) { - cc->numstringOffsets[0] += BUFFER_GROW; - cc->numstringOffsets = - (int *) realloc(cc->numstringOffsets, - sizeof(int)* cc->numstringOffsets[0]); - } - - /* Subtract 4 because of binary object sequence header */ - cc->numstringOffsets[cc->numstringOffsets[1]] = cc->nOutBufChars - 4; - cc->numstringOffsets[1] += 1; - } - - innerProcWriteNumstring(ctxt, type, data, size, scale, textInnerWritePostScript); -#undef BUFFER_GROW -} /* textWriteNumstring */ - -/*********************/ -/* Public procedures */ -/*********************/ - -/********************************************/ -/* Public procs for dealing with user names */ - -char *DPSNameFromIndex(long int index) -{ - if (DPSglobals == NIL || index < 0 || index > globLastNameIndex - || userNameDict == NIL) - return NIL; - return (char *) userNames[index]; -} - -void DPSMapNames( - DPSContext ctxt, - unsigned int nNames, - char **names, - int **indices) -{ - unsigned i; - char *last = names[0]; - - DPSCheckInitClientGlobals(); - -#define USERNAMEDICTLENGTH 100 - - if (userNameDict == NIL) { - userNameDict = DPSCreatePSWDict(USERNAMEDICTLENGTH); - userNames = (char **)DPScalloc(sizeof(char *), USERNAMEDICTLENGTH); - userNamesLength = USERNAMEDICTLENGTH; - } - - for (i = 0; i < nNames; i++) { - integer j; - char *n = names[i]; - DPSContext c; - - if (n == NIL) - n = last; - else - last = n; - DPSAssert(n != NIL); - if (strlen(n) > 128) { - DPSSafeSetLastNameIndex(ctxt); - (*ctxt->errorProc)(ctxt, dps_err_nameTooLong, (unsigned long) n, strlen(n)); - return; - } - j = DPSWDictLookup(userNameDict, n); - if (j >= 0) { - *(indices[i]) = j; - /* handle the case where another context in another space has - defined this name */ - if (((DPSPrivContext)ctxt)->lastNameIndex < j) - DPSUpdateNameMap(ctxt); - } - else { - /* handle other cases where another context in another - space has defined names */ - if (((DPSPrivContext)ctxt)->lastNameIndex < globLastNameIndex) - DPSUpdateNameMap(ctxt); - globLastNameIndex++; - if (((globLastNameIndex + 1) > userNamesLength)) { - char **t = (char **)DPScalloc(sizeof(char *), - userNamesLength + USERNAMEDICTLENGTH); - for (j = 0; j < userNamesLength; j++) { - t[j] = userNames[j]; - } - free(userNames); - userNames = t; - userNamesLength += USERNAMEDICTLENGTH; - } - userNames[globLastNameIndex] = n; - DPSWDictEnter(userNameDict, n, globLastNameIndex); - *(indices[i]) = globLastNameIndex; - DPSPrintf(ctxt, "%d /%s defineusername\n", globLastNameIndex, n); - for (c = ctxt; c != NIL; c = c->chainChild) - ((DPSPrivContext)c)->lastNameIndex = globLastNameIndex; - } - } /* for */ -} - -/**********************/ -/* Other public procs */ - -void DPSDefaultErrorProc( - DPSContext ctxt, - DPSErrorCode errorCode, - long unsigned int arg1, long unsigned int arg2) -{ - - DPSTextProc textProc = DPSGetCurrentTextBackstop(); - - char *prefix = "%%[ Error: "; - char *suffix = " ]%%\n"; - - char *infix = "; OffendingCommand: "; - char *nameinfix = "User name too long; Name: "; - char *contextinfix = "Invalid context: "; - char *taginfix = "Unexpected wrap result tag: "; - char *typeinfix = "Unexpected wrap result type; tag: "; - - switch (errorCode) { - case dps_err_ps: { - char *buf = (char *)arg1; - DPSBinObj ary = (DPSBinObj) (buf+DPS_HEADER_SIZE); - DPSBinObj elements; - char *error, *errorName; - integer errorCount, errorNameCount; - boolean resyncFlg; - - if ((ary->attributedType & 0x7f) != DPS_ARRAY - || ary->length != 4) { - DPSHandleBogusError(ctxt, prefix, suffix); - } - - elements = (DPSBinObj)(((char *) ary) + ary->val.arrayVal); - - errorName = (char *)(((char *) ary) + elements[1].val.nameVal); - errorNameCount = elements[1].length; - - error = (char *)(((char *) ary) + elements[2].val.nameVal); - errorCount = elements[2].length; - - resyncFlg = elements[3].val.booleanVal; - - if (textProc != NIL) { - (*textProc)(ctxt, prefix, strlen(prefix)); - (*textProc)(ctxt, errorName, errorNameCount); - (*textProc)(ctxt, infix, strlen(infix)); - (*textProc)(ctxt, error, errorCount); - (*textProc)(ctxt, suffix, strlen(suffix)); - } - if (resyncFlg && (ctxt != dummyCtx) && (ctxt != NULL)) { -#if 0 /* Postpone the raise 'til later to avoid RAISEing through Xlib */ - RAISE(dps_err_ps, (char *) ctxt); - DPSCantHappen(); -#else - DPSPrivContext cc = (DPSPrivContext) ctxt; - cc->resyncing = true; -#endif - } - break; - } - case dps_err_nameTooLong: - if (textProc != NIL) { - char *buf = (char *)arg1; - (*textProc)(ctxt, prefix, strlen(prefix)); - (*textProc)(ctxt, nameinfix, strlen(nameinfix)); - (*textProc)(ctxt, buf, arg2); - (*textProc)(ctxt, suffix, strlen(suffix)); - } - break; - case dps_err_invalidContext: - if (textProc != NIL) { - char m[100]; - (void) sprintf(m, "%s%s%ld%s", prefix, contextinfix, arg1, suffix); - (*textProc)(ctxt, m, strlen(m)); - } - break; - case dps_err_resultTagCheck: - if (textProc != NIL) { - char m[100]; - unsigned char tag = *((unsigned char *) arg1+1); - (void) sprintf(m, "%s%s%d%s", prefix, taginfix, tag, suffix); - (*textProc)(ctxt, m, strlen(m)); - } - break; - case dps_err_resultTypeCheck: - if (textProc != NIL) { - char m[100]; - unsigned char tag = *((unsigned char *) arg1+1); - (void) sprintf(m, "%s%s%d%s", prefix, typeinfix, tag, suffix); - (*textProc)(ctxt, m, strlen(m)); - } - break; - default: - DPSDefaultPrivateHandler(ctxt, errorCode, arg1, arg2, prefix, suffix); - break; - } -} /* DPSDefaultErrorProc */ - -void DPSCheckRaiseError(DPSContext c) -{ - DPSPrivContext cc = (DPSPrivContext) c; - if (cc != NULL && cc->resyncing) { - cc->resyncing = false; - RAISE(dps_err_ps, (char *) c); - DPSCantHappen(); - } -} - -/**************************************/ -/* Public procs for creating contexts */ - -/* dps_err_invalidAccess is now defined for all clients. */ - -static void textAwaitReturnValues(DPSContext ctxt) -{ - (*ctxt->errorProc)(ctxt, dps_err_invalidAccess, 0, 0); -} - -static void Noop(void) -{ -} - -DPSContext DPSCreateTextContext( - DPSTextProc textProc, DPSErrorProc errorProc) -{ - DPSPrivContext c; - - if (DPSInitialize () != 0) return((DPSContext) NIL); - if (!textCtxProcs) { - textCtxProcs = (DPSProcs)DPScalloc(sizeof(DPSProcsRec), 1); - DPSInitCommonTextContextProcs(textCtxProcs); - DPSInitSysNames(); - } - - c = (DPSPrivContext)DPScalloc(sizeof(DPSPrivContextRec), 1); - c->textProc = textProc; - c->procs = textCtxProcs; - c->textProc = textProc; - c->errorProc = errorProc; - c->programEncoding = dps_ascii; - c->nameEncoding = dps_strings; /* don't write user name indices on a file */ - c->contextFlags = DPS_FLAG_CONVERT_NUMSTRINGS; /* Convert by default */ - c->numFormat = DPSDefaultNumFormat; - c->numstringOffsets = NULL; - c->lastNameIndex = -1; - - /* Setup a dummy space */ - if (textSpace == NIL) - { - textSpace = (DPSPrivSpace) DPScalloc(sizeof (DPSPrivSpaceRec), 1); - textSpace->procs = (DPSSpaceProcs) DPScalloc(sizeof (DPSSpaceProcsRec), 1); - textSpace->procs->DestroySpace = (DPSSpaceProc) Noop; - textSpace->lastNameIndex = -1; - DPSInitPrivateSpaceFields(textSpace); - } - c->space = (DPSSpace) textSpace; - - DPSInitPrivateTextContextFields(c, textSpace); - return (DPSContext)c; -} /* DPSCreateTextContext */ - - -static DPSContext CreateDummyContext(void) -{ - DPSPrivContext c; - - DPSCheckInitClientGlobals(); - if (!dummyCtxProcs) { - dummyCtxProcs = (DPSProcs)DPScalloc(sizeof(DPSProcsRec), 1); - dummyCtxProcs->BinObjSeqWrite = (DPSContextBufProc) Noop; - dummyCtxProcs->WriteTypedObjectArray = (DPSContextTypedArrayProc) Noop; - dummyCtxProcs->WriteStringChars = (DPSContextBufProc) Noop; - dummyCtxProcs->WritePostScript = (DPSContextBufProc) Noop; - dummyCtxProcs->WriteData = (DPSContextBufProc) Noop; - dummyCtxProcs->FlushContext = (DPSContextProc) Noop; - dummyCtxProcs->ResetContext = (DPSContextProc) Noop; - dummyCtxProcs->WaitContext = (DPSContextProc) Noop; - dummyCtxProcs->UpdateNameMap = (DPSContextProc) Noop; - dummyCtxProcs->AwaitReturnValues = (DPSContextProc) Noop; - dummyCtxProcs->Interrupt = (DPSContextProc) Noop; - dummyCtxProcs->DestroyContext = (DPSContextProc) Noop; - dummyCtxProcs->WriteNumString = (DPSWriteNumStringProc) Noop; - } - - c = (DPSPrivContext)DPScalloc(sizeof(DPSPrivContextRec), 1); - c->procs = dummyCtxProcs; - c->programEncoding = DPSDefaultProgramEncoding; - c->nameEncoding = DPSDefaultNameEncoding; /* don't care */ - c->numFormat = DPSDefaultNumFormat; - c->lastNameIndex = -1; - c->numstringOffsets = NULL; - - return (DPSContext)c; -} /* CreateDummyContext */ - -void DPSSetTextBackstop(DPSTextProc textProc) -{ - DPSCheckInitClientGlobals(); - if (!dummyCtx) dummyCtx = CreateDummyContext(); - dummyCtx->textProc = textProc; -} - -DPSTextProc DPSGetCurrentTextBackstop(void) -{ - DPSCheckInitClientGlobals(); - if (dummyCtx == NIL) return NIL; - else return dummyCtx->textProc; -} - -void DPSSetErrorBackstop(DPSErrorProc errorProc) -{ - DPSCheckInitClientGlobals(); - if (!dummyCtx) dummyCtx = CreateDummyContext(); - dummyCtx->errorProc = errorProc; -} - -DPSErrorProc DPSGetCurrentErrorBackstop(void) -{ - DPSCheckInitClientGlobals(); - if (dummyCtx == NIL) return NIL; - else return dummyCtx->errorProc; -} - -static void NoteInitFailure(DPSContext ctxt, char *buf, long unsigned length) -{ - initFailed = -1; -} - -int DPSInitialize(void) -{ - DPSCheckInitClientGlobals(); - if (!clientStarted) { - clientStarted = true; - initFailed = 0; - DPSInitClient(NoteInitFailure, ReleaseInput); /* may call DPSCreateContext */ - /* textProc will not be used unless DPS initialization fails */ - } - return initFailed; -} - -DPSContext DPSCreateContext( - char *wh, - DPSTextProc textProc, - DPSErrorProc errorProc, - DPSSpace space) -{ - - DPSPrivSpace ss; - DPSPrivContext c; - - if (DPSInitialize() != 0) return NIL; - - if (!ctxProcs) { - ctxProcs = (DPSProcs)DPScalloc(sizeof(DPSProcsRec), 1); - ctxProcs->BinObjSeqWrite = procBinObjSeqWrite; - ctxProcs->WriteTypedObjectArray = writeTypedObjectArray; - ctxProcs->WriteStringChars = procWriteStringChars; - ctxProcs->WritePostScript = procWritePostScript; - ctxProcs->WriteData = procWriteData; - ctxProcs->UpdateNameMap = procUpdateNameMap; - ctxProcs->Interrupt = procInterrupt; - ctxProcs->WriteNumString = (DPSWriteNumStringProc) procWriteNumstring; - } - if (!spaceProcs) { - spaceProcs = (DPSSpaceProcs)DPScalloc(sizeof(DPSSpaceProcsRec), 1); - DPSInitCommonSpaceProcs(spaceProcs); - } - - ss = (DPSPrivSpace)space; - - if (ss == NIL) { - ss = (DPSPrivSpace)DPScalloc(sizeof(DPSPrivSpaceRec), 1); - ss->procs = spaceProcs; - ss->lastNameIndex = -1; - ss->next = spaces; - DPSAssert(ss->next != ss); - spaces = ss; - DPSInitPrivateSpaceFields(ss); - } - - if (ss->wh == NIL) ss->wh = wh; /* KLUDGE to support DPSSendDestroySpace */ - - c = (DPSPrivContext)DPScalloc(sizeof(DPSPrivContextRec), 1); - c->procs = ctxProcs; - c->wh = wh; - c->textProc = textProc; - c->errorProc = errorProc; - c->programEncoding = DPSDefaultProgramEncoding; - c->nameEncoding = DPSDefaultNameEncoding; - c->lastNameIndex = -1; - c->space = (DPSSpace)ss; - c->numstringOffsets = NULL; - - c->next = ss->firstContext; - DPSAssert(c->next != c); - ss->firstContext = c; - - DPSInitPrivateContextFields(c, ss); - - c->numFormat = DPSCreatePrivContext( - (XDPSPrivContext)wh, - (DPSContext)c, - (ContextPSID *)&c->cid, - (SpaceXID *)&ss->sid, - (space == NIL), DPSclientPrintProc); - if (c->numFormat == (DPSNumFormat) -1) - { /* can't create the context */ - if (space == NIL) { - spaces = ss->next; - free(ss); - } - else ss->firstContext = c->next; - free(c); - return NIL; - } - else return (DPSContext)c; -} /* DPSCreateContext */ - -char *DPSSetWh( - DPSContext ctxt, - char *newWh) -{ - DPSPrivContext cc = (DPSPrivContext) ctxt; - char *tmp = cc->wh; - cc->wh = newWh; - return(tmp); -} - -/* - The chainParent field is non-NIL if this context automatically receives - a copy of the PostScript code sent to the referenced (parent) context. - - The chainChild field is non-NIL if this context automatically sends along - to the referenced (child) context a copy of any PostScript code received. -*/ -int DPSChainContext(DPSContext parent, DPSContext child) -{ - DPSContext cc = child->chainChild; - - if (child->chainParent != NIL) - return -1; /* report an error */ - - /* insert new child between parent and existing children */ - child->chainChild = parent->chainChild; - if (parent->chainChild != NIL) { - DPSAssertWarn(parent->chainChild->chainParent == parent, (DPSPrivContext)parent, "attempting to chain context on invalid chain"); - child->chainChild->chainParent = child; - } - child->chainParent = parent; - parent->chainChild = child; - /* if child has children, recursively chain them */ - if (cc != NIL) { - cc->chainParent = NIL; - (void) DPSChainContext(child, cc); - } - return 0; -} - -void DPSUnchainContext(DPSContext ctxt) -{ - DPSContext p = ctxt->chainParent; - DPSContext c = ctxt->chainChild; - - if (p != NIL) { /* remove ctxt from parent's chain */ - DPSAssertWarn(p->chainChild == ctxt, (DPSPrivContext)p, "attempting to unchain context from wrong chain (parent)"); - p->chainChild = c; - ctxt->chainParent = NIL; - } - if (c != NIL) { /* remove ctxt's child (if any) from ctxt's chain */ - DPSAssertWarn(c->chainParent == ctxt, (DPSPrivContext)c, "attempting to unchain context from wrong chain (child)"); - c->chainParent = p; - ctxt->chainChild = NIL; - } -} - -/****************/ -/* Veneer procs */ - -void DPSAwaitReturnValues(DPSContext ctxt) -{ - (*(ctxt)->procs->AwaitReturnValues)((ctxt)); -} - -void DPSDestroyContext(DPSContext ctxt) -{ - (*(ctxt)->procs->DestroyContext)((ctxt)); -} - -void DPSDestroySpace(DPSSpace spc) -{ - (*(spc)->procs->DestroySpace)((spc)); -} - -void DPSFlushContext(DPSContext ctxt) -{ - (*(ctxt)->procs->FlushContext)((ctxt)); -} - -DPSContext DPSGetCurrentContext(void) { return DPSGlobalContext; } - -void DPSInterruptContext(DPSContext ctxt) -{ - (*(ctxt)->procs->Interrupt)((ctxt)); -} - -DPSContext DPSPrivCurrentContext(void) { return DPSGlobalContext; } - -void DPSResetContext(DPSContext ctxt) -{ - (*(ctxt)->procs->ResetContext)((ctxt)); -} - -void DPSSetResultTable( - register DPSContext ctxt, - DPSResults tbl, - unsigned int len) -{ - (ctxt)->resultTable = (tbl); - (ctxt)->resultTableLength = (len); -} - -void DPSSetContext( - DPSContext ctxt) -{ - DPSGlobalContext = ctxt; -} - -void DPSUpdateNameMap( - DPSContext ctxt) -{ - (*(ctxt)->procs->UpdateNameMap)((ctxt)); -} - -void DPSWaitContext( - DPSContext ctxt) -{ - (*(ctxt)->procs->WaitContext)(ctxt); -} - -void DPSBinObjSeqWrite( - DPSContext ctxt, - char *buf, - unsigned int count) -{ - (*(ctxt)->procs->BinObjSeqWrite)((ctxt), (buf), (count)); -} - -void DPSWriteData( - DPSContext ctxt, - char *buf, - unsigned int count) -{ - (*(ctxt)->procs->WriteData)((ctxt), (buf), (count)); -} - -void DPSWritePostScript( - DPSContext ctxt, - char *buf, - unsigned int count) -{ - (*(ctxt)->procs->WritePostScript)((ctxt), (buf), (count)); -} - -void DPSWriteStringChars( - DPSContext ctxt, - char *buf, - unsigned int count) -{ - (*(ctxt)->procs->WriteStringChars)((ctxt), (buf), (count)); -} - -void DPSWriteNumString(ctxt, type, data, size, scale) - DPSContext ctxt; - DPSDefinedType type; - char *data; - unsigned int size; - int scale; -{ - (*(ctxt)->procs->WriteNumString)((ctxt), (type), (data), (size), (scale)); -} - -void DPSWriteTypedObjectArray(ctxt, type, array, length) - DPSContext ctxt; - DPSDefinedType type; - char *array; - unsigned int length; { - (*(ctxt)->procs->WriteTypedObjectArray)((ctxt), (type), (array), (length)); - } - -void DPSInitCommonTextContextProcs(DPSProcs p) -{ - p->BinObjSeqWrite = textBinObjSeqWrite; - p->WriteTypedObjectArray = writeTypedObjectArray; - p->WriteStringChars = textWriteStringChars; - p->WritePostScript = textWritePostScript; - p->WriteData = textWriteData; - p->FlushContext = textFlushContext; - p->ResetContext = (DPSContextProc) Noop; - p->WaitContext = (DPSContextProc) Noop; - p->UpdateNameMap = procUpdateNameMap; - p->AwaitReturnValues = textAwaitReturnValues; - p->Interrupt = textInterruptContext; - p->DestroyContext = textDestroyContext; - p->WriteNumString = (DPSWriteNumStringProc) textWriteNumstring; -} - -void DPSInitCommonContextProcs(DPSProcs p) -{ - p->BinObjSeqWrite = procBinObjSeqWrite; - p->WriteTypedObjectArray = writeTypedObjectArray; - p->WriteStringChars = procWriteStringChars; - p->WritePostScript = procWritePostScript; - p->WaitContext = procWaitContext; - p->DestroyContext = procDestroyContext; - p->WriteData = procWriteData; - p->UpdateNameMap = procUpdateNameMap; - p->Interrupt = procInterrupt; - p->WriteNumString = (DPSWriteNumStringProc) procWriteNumstring; -} - -void DPSInitCommonSpaceProcs(DPSSpaceProcs p) -{ - p->DestroySpace = procDestroySpace; -} - -void DPSSetNumStringConversion(ctxt, flag) - DPSContext ctxt; - int flag; -{ - if (flag) ctxt->contextFlags |= DPS_FLAG_CONVERT_NUMSTRINGS; - else ctxt->contextFlags &= ~DPS_FLAG_CONVERT_NUMSTRINGS; -} - -void DPSSetWrapSynchronization(ctxt, flag) - DPSContext ctxt; - int flag; -{ - if (flag) ctxt->contextFlags |= DPS_FLAG_SYNC; - else ctxt->contextFlags &= ~DPS_FLAG_SYNC; -} - -void DPSSuppressBinaryConversion(ctxt, flag) - DPSContext ctxt; - int flag; -{ - if (flag) ctxt->contextFlags |= DPS_FLAG_NO_BINARY_CONVERSION; - else ctxt->contextFlags &= ~DPS_FLAG_NO_BINARY_CONVERSION; -} - -void DPSSetAbbrevMode(ctxt, flag) - DPSContext ctxt; - int flag; -{ - if (flag) ctxt->contextFlags |= DPS_FLAG_USE_ABBREVS; - else ctxt->contextFlags &= ~DPS_FLAG_USE_ABBREVS; -} - -DPSContextExtensionRec *DPSGetContextExtensionRec(ctxt, extensionId) - DPSContext ctxt; - int extensionId; -{ - DPSContextExtensionRec *r = ctxt->extension; - - while (r != NULL && r->extensionId != extensionId) r = r->next; - return r; -} - -void DPSAddContextExtensionRec(ctxt, rec) - DPSContext ctxt; - DPSContextExtensionRec *rec; -{ - rec->next = ctxt->extension; - ctxt->extension = rec; -} - -DPSContextExtensionRec *DPSRemoveContextExtensionRec(ctxt, extensionId) - DPSContext ctxt; - int extensionId; -{ - DPSContextExtensionRec *rret, **r = &ctxt->extension; - - - while (*r != NULL && (*r)->extensionId != extensionId) { - r = &(*r)->next; - } - rret = *r; - if (*r != NULL) *r = (*r)->next; - return rret; -} - -int DPSGenerateExtensionRecID(void) -{ - static int id = 1; - - return id++; -} - -DPSContextType DPSGetContextType(ctxt) - DPSContext ctxt; -{ - DPSPrivContext c = (DPSPrivContext) ctxt; - - if (c->procs == textCtxProcs) return dps_context_text; - else return dps_context_execution; -} diff --git a/nx-X11/lib/dps/dpsclrops.psw b/nx-X11/lib/dps/dpsclrops.psw deleted file mode 100644 index f8ec18269..000000000 --- a/nx-X11/lib/dps/dpsclrops.psw +++ /dev/null @@ -1,81 +0,0 @@ -/* dpsclrops.psw - * - * (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 - */ - -defineps DPScolorimage(DPSContext ctxt) - colorimage -endps - -defineps DPScurrentblackgeneration(DPSContext ctxt) - currentblackgeneration -endps - -defineps DPScurrentcmykcolor(DPSContext ctxt | float *c, *m, *y, *k) - currentcmykcolor k y m c -endps - -defineps DPScurrentcolorscreen(DPSContext ctxt) - currentcolorscreen -endps - -defineps DPScurrentcolortransfer(DPSContext ctxt) - currentcolortransfer -endps - -defineps DPScurrentundercolorremoval(DPSContext ctxt) - currentundercolorremoval -endps - -defineps DPSsetblackgeneration(DPSContext ctxt) - setblackgeneration -endps - -defineps DPSsetcmykcolor(DPSContext ctxt; float c, m, y, k) - c m y k setcmykcolor -endps - -defineps DPSsetcolorscreen(DPSContext ctxt) - setcolorscreen -endps - -defineps DPSsetcolortransfer(DPSContext ctxt) - setcolortransfer -endps - -defineps DPSsetundercolorremoval(DPSContext ctxt) - setundercolorremoval -endps - diff --git a/nx-X11/lib/dps/dpsctrlops.psw b/nx-X11/lib/dps/dpsctrlops.psw deleted file mode 100644 index d00707d4c..000000000 --- a/nx-X11/lib/dps/dpsctrlops.psw +++ /dev/null @@ -1,114 +0,0 @@ -/* - * dpsctrlops.psw - * - * (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 - */ - -defineps DPSeq(DPSContext ctxt) - eq -endps - -defineps DPSexit(DPSContext ctxt) - exit -endps - -defineps DPSfalse(DPSContext ctxt) - false -endps - -defineps DPSfor(DPSContext ctxt) - for -endps - -defineps DPSforall(DPSContext ctxt) - forall -endps - -defineps DPSge(DPSContext ctxt) - ge -endps - -defineps DPSgt(DPSContext ctxt) - gt -endps - -defineps DPSif(DPSContext ctxt) - if -endps - -defineps DPSifelse(DPSContext ctxt) - ifelse -endps - -defineps DPSle(DPSContext ctxt) - le -endps - -defineps DPSloop(DPSContext ctxt) - loop -endps - -defineps DPSlt(DPSContext ctxt) - lt -endps - -defineps DPSne(DPSContext ctxt) - ne -endps - -defineps DPSnot(DPSContext ctxt) - not -endps - -defineps DPSor(DPSContext ctxt) - or -endps - -defineps DPSrepeat(DPSContext ctxt) - repeat -endps - -defineps DPSstop(DPSContext ctxt) - stop -endps - -defineps DPSstopped(DPSContext ctxt) - stopped -endps - -defineps DPStrue(DPSContext ctxt) - true -endps - diff --git a/nx-X11/lib/dps/dpsctxtops.psw b/nx-X11/lib/dps/dpsctxtops.psw deleted file mode 100644 index 00f6f8f18..000000000 --- a/nx-X11/lib/dps/dpsctxtops.psw +++ /dev/null @@ -1,110 +0,0 @@ -/* - * dpsctxtops.psw - * - * (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 - */ - -defineps DPSUserObjects(DPSContext ctxt) - UserObjects -endps - -defineps DPScondition(DPSContext ctxt) - condition -endps - -defineps DPScurrentcontext(DPSContext ctxt | int *cid) - currentcontext cid -endps - -defineps DPScurrentobjectformat(DPSContext ctxt | int *code) - currentobjectformat code -endps - -defineps DPSdefineusername(DPSContext ctxt; int i; char *username) - i /username defineusername -endps - -defineps DPSdefineuserobject(DPSContext ctxt) - defineuserobject -endps - -defineps DPSdetach(DPSContext ctxt) - detach -endps - -defineps DPSexecuserobject(DPSContext ctxt; int userObjIndex) - userObjIndex execuserobject -endps - -defineps DPSfork(DPSContext ctxt) - fork -endps - -defineps DPSjoin(DPSContext ctxt) - join -endps - -defineps DPSlock(DPSContext ctxt) - lock -endps - -defineps DPSmonitor(DPSContext ctxt) - monitor -endps - -defineps DPSnotify(DPSContext ctxt) - notify -endps - -defineps DPSsetobjectformat(DPSContext ctxt; int code) - code setobjectformat -endps - -defineps DPSsetvmthreshold(DPSContext ctxt; int i) - i setvmthreshold -endps - -defineps DPSundefineuserobject(DPSContext ctxt; int userObjIndex) - userObjIndex undefineuserobject -endps - -defineps DPSwait(DPSContext ctxt) - wait -endps - -defineps DPSyield(DPSContext ctxt) - yield -endps - diff --git a/nx-X11/lib/dps/dpsdataops.psw b/nx-X11/lib/dps/dpsdataops.psw deleted file mode 100644 index c38893678..000000000 --- a/nx-X11/lib/dps/dpsdataops.psw +++ /dev/null @@ -1,258 +0,0 @@ -/* - * dpsdataops.psw - * - * (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 - */ - -defineps DPSaload(DPSContext ctxt) - aload -endps - -defineps DPSanchorsearch(DPSContext ctxt| boolean *truth) - anchorsearch truth -endps - -defineps DPSarray(DPSContext ctxt; int len) - len array -endps - -defineps DPSastore(DPSContext ctxt) - astore -endps - -defineps DPSbegin(DPSContext ctxt) - begin -endps - -defineps DPSclear(DPSContext ctxt) - clear -endps - -defineps DPScleartomark(DPSContext ctxt) - cleartomark -endps - -defineps DPScopy(DPSContext ctxt; int n) - n copy -endps - -defineps DPScount(DPSContext ctxt | int *n) - count n -endps - -defineps DPScounttomark(DPSContext ctxt | int *n) - counttomark n -endps - -defineps DPScvi(DPSContext ctxt) - cvi -endps - -defineps DPScvlit(DPSContext ctxt) - cvlit -endps - -defineps DPScvn(DPSContext ctxt) - cvn -endps - -defineps DPScvr(DPSContext ctxt) - cvr -endps - -defineps DPScvrs(DPSContext ctxt) - cvrs -endps - -defineps DPScvs(DPSContext ctxt) - cvs -endps - -defineps DPScvx(DPSContext ctxt) - cvx -endps - -defineps DPSdef(DPSContext ctxt) - def -endps - -defineps DPSdict(DPSContext ctxt; int len) - len dict -endps - -defineps DPSdictstack(DPSContext ctxt) - dictstack -endps - -defineps DPSdup(DPSContext ctxt) - dup -endps - -defineps DPSend(DPSContext ctxt) - end -endps - -defineps DPSexch(DPSContext ctxt) - exch -endps - -defineps DPSexecstack(DPSContext ctxt) - execstack -endps - -defineps DPSexecuteonly(DPSContext ctxt) - executeonly -endps - -defineps DPSget(DPSContext ctxt) - get -endps - -defineps DPSgetinterval(DPSContext ctxt) - getinterval -endps - -defineps DPSindex(DPSContext ctxt; int i) - i index -endps - -defineps DPSknown(DPSContext ctxt | boolean *b) - known b -endps - -defineps DPSlength(DPSContext ctxt | int *len) - length len -endps - -defineps DPSload(DPSContext ctxt) - load -endps - -defineps DPSmark(DPSContext ctxt) - mark -endps - -defineps DPSmatrix(DPSContext ctxt) - matrix -endps - -defineps DPSmaxlength(DPSContext ctxt | int *len) - maxlength len -endps - -defineps DPSnoaccess(DPSContext ctxt) - noaccess -endps - -defineps DPSnull(DPSContext ctxt) - null -endps - -defineps DPSpackedarray(DPSContext ctxt) - packedarray -endps - -defineps DPSpop(DPSContext ctxt) - pop -endps - -defineps DPSput(DPSContext ctxt) - put -endps - -defineps DPSputinterval(DPSContext ctxt) - putinterval -endps - -defineps DPSrcheck(DPSContext ctxt | boolean *b) - rcheck b -endps - -defineps DPSreadonly(DPSContext ctxt) - readonly -endps - -defineps DPSroll(DPSContext ctxt; int n, j) - n j roll -endps - -defineps DPSscheck(DPSContext ctxt | boolean *b) - scheck b -endps - -defineps DPSsearch(DPSContext ctxt| boolean *b) - search b -endps - -defineps DPSshareddict(DPSContext ctxt) - shareddict -endps - -defineps DPSstatusdict(DPSContext ctxt) - statusdict -endps - -defineps DPSstore(DPSContext ctxt) - store -endps - -defineps DPSstring(DPSContext ctxt; int len) - len string -endps - -defineps DPSstringwidth(DPSContext ctxt; char *s | float *xp, *yp) - (s) stringwidth yp xp -endps - -defineps DPSsystemdict(DPSContext ctxt) - systemdict -endps - -defineps DPSuserdict(DPSContext ctxt) - userdict -endps - -defineps DPSwcheck(DPSContext ctxt | boolean *b) - wcheck b -endps - -defineps DPSwhere(DPSContext ctxt| boolean *b) - where b -endps - -defineps DPSxcheck(DPSContext ctxt | boolean *b) - xcheck b -endps - diff --git a/nx-X11/lib/dps/dpsdict.c b/nx-X11/lib/dps/dpsdict.c deleted file mode 100644 index b2e8a04b2..000000000 --- a/nx-X11/lib/dps/dpsdict.c +++ /dev/null @@ -1,189 +0,0 @@ -/* - * dpsdict.c - * - * (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$ */ - -/***********/ -/* Imports */ -/***********/ - -#include <stdlib.h> -#include <string.h> - -#include "dpsint.h" - -/********************/ -/* Types */ -/********************/ - -typedef struct _EntryRec { - struct _EntryRec *next; - char *name; - PSWDictValue value; - } EntryRec, *Entry; - - /* The concrete definition for a dictionary */ - typedef struct _PSWDictRec { - integer nEntries; - Entry *entries; - } PSWDictRec; - -static PSWDict atoms; - -/**************************/ -/* Procedure Declarations */ -/**************************/ - -/* Creates and returns a new dictionary. nEntries is a hint. */ -PSWDict DPSCreatePSWDict(integer nEntries) -{ - PSWDict d = (PSWDict)DPScalloc(sizeof(PSWDictRec), 1); - d->nEntries = nEntries; - d->entries = (Entry *)DPScalloc(sizeof(EntryRec), d->nEntries); - return d; -} - -/* Destroys a dictionary */ -void DPSDestroyPSWDict(PSWDict dict) -{ - integer links = dict->nEntries; - Entry next; - Entry prev; - - while (links > 0) - { - next = (dict->entries)[links]; - while (next != NIL) - { - prev = next; - next = next->next; - free (prev); - } - links--; - } - free(dict->entries); - free(dict); -} - -static integer Hash(char *name, integer nEntries) -{ - register integer val = 0; - while (*name) val += *name++; - if (val < 0) val = -val; - return (val % nEntries); -} - -static Entry Probe(PSWDict d, integer x, char *name) -{ - register Entry e; - for (e = (d->entries)[x]; e != NIL; e = e->next) { - if (strcmp(name, e->name) == 0) break; - } - return e; -} - -static Entry PrevProbe(Entry *prev, PSWDict d, integer x, char *name) -{ - register Entry e; - *prev = NIL; - for (e = (d->entries)[x]; e != NIL; e = e->next) { - if (strcmp(name, e->name) == 0) break; - *prev = e; - } - return e; -} - -/* -1 => not found */ -PSWDictValue DPSWDictLookup(PSWDict dict, char *name) -{ - Entry e; - e = Probe(dict, Hash(name, dict->nEntries), name); - if (e == NIL) return -1; - return e->value; -} - -/* 0 => normal return (not found) - -1 => found. If found, value is replaced. */ -PSWDictValue DPSWDictEnter(PSWDict dict, char *name, PSWDictValue value) -{ - Entry e; - integer x = Hash(name, dict->nEntries); - e = Probe(dict, x, name); - if (e != NIL) { - e->value = value; - return -1; - } - e = (Entry)DPScalloc(sizeof(EntryRec), 1); - e->next = (dict->entries)[x]; (dict->entries)[x] = e; - e->value = value; - e->name = name; /* MakeAtom(name); */ - return 0; -} - -/* -1 => not found. If found, value is returned. */ -PSWDictValue DPSWDictRemove(PSWDict dict, char *name) -{ - Entry e, prev; - PSWDictValue value; - integer x = Hash(name, dict->nEntries); - - e = PrevProbe(&prev, dict, x, name); - if (e == NIL) return -1; - value = e->value; - if (prev == NIL) (dict->entries)[x] = e->next; else prev->next = e->next; - free(e); - return value; -} - -Atom DPSMakeAtom(char *name) -{ - Entry e; - integer x = Hash(name, 511); - char *newname; - - if (atoms == NIL) atoms = DPSCreatePSWDict(511); - e = Probe(atoms, x, name); - if (e == NIL) { - e = (Entry)DPScalloc(sizeof(EntryRec), 1); - e->next = (atoms->entries)[x]; (atoms->entries)[x] = e; - e->value = 0; - newname = (char *)DPScalloc(strlen(name)+1, 1); - strcpy(newname, name); - e->name = newname; - } - return (Atom) e->name; -} diff --git a/nx-X11/lib/dps/dpsdict.h b/nx-X11/lib/dps/dpsdict.h deleted file mode 100644 index 18b40d42b..000000000 --- a/nx-X11/lib/dps/dpsdict.h +++ /dev/null @@ -1,78 +0,0 @@ -/* - * dpsdict.h - * - * (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 - */ - -#ifndef PSWDICT_H -#define PSWDICT_H - -#include <X11/X.h> - -#include "publictypes.h" - -typedef struct _PSWDictRec *PSWDict; -/* Opaque designator for a dictionary */ - -typedef int PSWDictValue; /* non-negative */ - -/* PROCEDURES */ - -/* The name parameters defined below are NULL-terminated C strings. - None of the name parameters are handed off, i.e. the caller is - responsible for managing their storage. */ - -extern PSWDict DPSCreatePSWDict(integer /* nEntries */); -/* nEntries is a hint. Creates and returns a new dictionary */ - -extern void DPSDestroyPSWDict(PSWDict /* dict */); -/* Destroys a dictionary */ - -extern PSWDictValue DPSWDictLookup(PSWDict /* dict */, char * /* name */); -/* -1 => not found. */ - -extern PSWDictValue DPSWDictEnter - (PSWDict /* dict */, char * /* name */, PSWDictValue /* value */); -/* 0 => normal return (not found) - -1 => found. If found, the old value gets replaced with the new one. - caller must ensure continuing validity of name. */ - -extern PSWDictValue DPSWDictRemove(PSWDict /* dict */, char * /* name */); -/* -1 => not found. If found, value is returned. */ - -extern Atom DPSMakeAtom(char * /* name */); -/* name characters are copied. */ - -#endif /* PSWDICT_H */ diff --git a/nx-X11/lib/dps/dpsendif.txt b/nx-X11/lib/dps/dpsendif.txt deleted file mode 100644 index 80dd08085..000000000 --- a/nx-X11/lib/dps/dpsendif.txt +++ /dev/null @@ -1,5 +0,0 @@ -#if defined(__cplusplus) || defined(c_plusplus) -} -#endif - -#endif /* DPSOPS_H */ diff --git a/nx-X11/lib/dps/dpsexcept.c b/nx-X11/lib/dps/dpsexcept.c deleted file mode 100644 index cd404dd86..000000000 --- a/nx-X11/lib/dps/dpsexcept.c +++ /dev/null @@ -1,73 +0,0 @@ -/* - * dpsexcept.c - * - * (c) Copyright 1984-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: $ */ - -/* -Original version: Jeffrey Mogul, Stanford, 18 February 1983 -*/ - -#ifdef VMS -/* Add publictype.h to get a lowercase definition of "false" */ -#include "publictypes.h" -#endif /* VMS */ - -#include "DPS/dpsexcept.h" - -_Exc_Buf *_Exc_Header; - - - -void DPSRaise(code, msg) - int code; char *msg; { - register _Exc_Buf *EBp = _Exc_Header; - - if (EBp == 0) { /* uncaught exception */ - DPSCantHappen(); - } - - EBp->Code = code; - EBp->Message = msg; - _Exc_Header = EBp->Prev; - longjmp(EBp->Environ, 1); - } - -#ifndef XDPS -void DPSCantHappen() { - abort(); - } -#endif /* XDPS */ diff --git a/nx-X11/lib/dps/dpsfontops.psw b/nx-X11/lib/dps/dpsfontops.psw deleted file mode 100644 index 9958e776a..000000000 --- a/nx-X11/lib/dps/dpsfontops.psw +++ /dev/null @@ -1,109 +0,0 @@ -/* dpsfontops.psw - * - * (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 - */ - -defineps DPSFontDirectory(DPSContext ctxt) - FontDirectory -endps - -defineps DPSISOLatin1Encoding(DPSContext ctxt) - ISOLatin1Encoding -endps - -defineps DPSSharedFontDirectory(DPSContext ctxt) - SharedFontDirectory -endps - -defineps DPSStandardEncoding(DPSContext ctxt) - StandardEncoding -endps - -defineps DPScachestatus(DPSContext ctxt) - cachestatus -endps - -defineps DPScurrentcacheparams(DPSContext ctxt) - currentcacheparams -endps - -defineps DPScurrentfont(DPSContext ctxt) - currentfont -endps - -defineps DPSdefinefont(DPSContext ctxt) - definefont -endps - -defineps DPSfindfont(DPSContext ctxt; char *name) - /name findfont -endps - -defineps DPSmakefont(DPSContext ctxt) - makefont -endps - -defineps DPSscalefont(DPSContext ctxt; float size) - size scalefont -endps - -defineps DPSselectfont(DPSContext ctxt; char *name; float scale) - /name scale selectfont -endps - -defineps DPSsetcachedevice(DPSContext ctxt; float wx, wy, llx, lly, urx, ury) - wx wy llx lly urx ury setcachedevice -endps - -defineps DPSsetcachelimit(DPSContext ctxt; int n) - n setcachelimit -endps - -defineps DPSsetcacheparams(DPSContext ctxt) - setcacheparams -endps - -defineps DPSsetcharwidth(DPSContext ctxt; float wx, wy) - wx wy setcharwidth -endps - -defineps DPSsetfont(DPSContext ctxt; userobject f) - f setfont -endps - -defineps DPSundefinefont(DPSContext ctxt; char *name) - /name undefinefont -endps - diff --git a/nx-X11/lib/dps/dpsgsttops.psw b/nx-X11/lib/dps/dpsgsttops.psw deleted file mode 100644 index d9b2728e7..000000000 --- a/nx-X11/lib/dps/dpsgsttops.psw +++ /dev/null @@ -1,213 +0,0 @@ -/* dpsgsttops.psw - * - * (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 - */ - -defineps DPSconcat(DPSContext ctxt; float m[6]) - m concat -endps - -defineps DPScurrentdash(DPSContext ctxt) - currentdash -endps - -defineps DPScurrentflat(DPSContext ctxt | float *flatness) - currentflat flatness -endps - -defineps DPScurrentgray(DPSContext ctxt | float *gray) - currentgray gray -endps - -defineps DPScurrentgstate(DPSContext ctxt; userobject gst) - gst currentgstate -endps - -defineps DPScurrenthalftone(DPSContext ctxt) - currenthalftone -endps - -defineps DPScurrenthalftonephase(DPSContext ctxt | float *x, *y) - currenthalftonephase y x -endps - -defineps DPScurrenthsbcolor(DPSContext ctxt | float *h, *s, *b) - currenthsbcolor b s h -endps - -defineps DPScurrentlinecap(DPSContext ctxt | int *linecap) - currentlinecap linecap -endps - -defineps DPScurrentlinejoin(DPSContext ctxt | int *linejoin) - currentlinejoin linejoin -endps - -defineps DPScurrentlinewidth(DPSContext ctxt | float *width) - currentlinewidth width -endps - -defineps DPScurrentmatrix(DPSContext ctxt) - currentmatrix -endps - -defineps DPScurrentmiterlimit(DPSContext ctxt | float *limit) - currentmiterlimit limit -endps - -defineps DPScurrentpoint(DPSContext ctxt | float *x, *y) - currentpoint y x -endps - -defineps DPScurrentrgbcolor(DPSContext ctxt | float *r, *g, *b) - currentrgbcolor b g r -endps - -defineps DPScurrentscreen(DPSContext ctxt) - currentscreen -endps - -defineps DPScurrentstrokeadjust(DPSContext ctxt | boolean *b) - currentstrokeadjust b -endps - -defineps DPScurrenttransfer(DPSContext ctxt) - currenttransfer -endps - -defineps DPSdefaultmatrix(DPSContext ctxt) - defaultmatrix -endps - -defineps DPSgrestore(DPSContext ctxt) - grestore -endps - -defineps DPSgrestoreall(DPSContext ctxt) - grestoreall -endps - -defineps DPSgsave(DPSContext ctxt) - gsave -endps - -defineps DPSgstate(DPSContext ctxt) - gstate -endps - -defineps DPSinitgraphics(DPSContext ctxt) - initgraphics -endps - -defineps DPSinitmatrix(DPSContext ctxt) - initmatrix -endps - -defineps DPSrotate(DPSContext ctxt; float angle) - angle rotate -endps - -defineps DPSscale(DPSContext ctxt; float x, y) - x y scale -endps - -defineps DPSsetdash(DPSContext ctxt; float pat[size]; int size; float offset) - pat offset setdash -endps - -defineps DPSsetflat(DPSContext ctxt; float flatness) - flatness setflat -endps - -defineps DPSsetgray(DPSContext ctxt; float gray) - gray setgray -endps - -defineps DPSsetgstate(DPSContext ctxt; userobject gst) - gst setgstate -endps - -defineps DPSsethalftone(DPSContext ctxt) - sethalftone -endps - -defineps DPSsethalftonephase(DPSContext ctxt; float x, y) - x y sethalftonephase -endps - -defineps DPSsethsbcolor(DPSContext ctxt; float h, s, b) - h s b sethsbcolor -endps - -defineps DPSsetlinecap(DPSContext ctxt; int linecap) - linecap setlinecap -endps - -defineps DPSsetlinejoin(DPSContext ctxt; int linejoin) - linejoin setlinejoin -endps - -defineps DPSsetlinewidth(DPSContext ctxt; float width) - width setlinewidth -endps - -defineps DPSsetmatrix(DPSContext ctxt) - setmatrix -endps - -defineps DPSsetmiterlimit(DPSContext ctxt; float limit) - limit setmiterlimit -endps - -defineps DPSsetrgbcolor(DPSContext ctxt; float r, g, b) - r g b setrgbcolor -endps - -defineps DPSsetscreen(DPSContext ctxt) - setscreen -endps - -defineps DPSsetstrokeadjust(DPSContext ctxt; boolean b) - b setstrokeadjust -endps - -defineps DPSsettransfer(DPSContext ctxt) - settransfer -endps - -defineps DPStranslate(DPSContext ctxt; float x, y) - x y translate -endps - diff --git a/nx-X11/lib/dps/dpsifdef.txt b/nx-X11/lib/dps/dpsifdef.txt deleted file mode 100644 index d44b7c85f..000000000 --- a/nx-X11/lib/dps/dpsifdef.txt +++ /dev/null @@ -1,7 +0,0 @@ -#ifndef DPSOPS_H -#define DPSOPS_H - -#if defined(__cplusplus) || defined(c_plusplus) -extern "C" { -#endif - diff --git a/nx-X11/lib/dps/dpsint.h b/nx-X11/lib/dps/dpsint.h deleted file mode 100644 index 8d5ede870..000000000 --- a/nx-X11/lib/dps/dpsint.h +++ /dev/null @@ -1,125 +0,0 @@ -/* - * dpsint.h -- internal definitions to dpsclient.c - * - * (c) Copyright 1989-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 - */ - -#ifndef DPSINT_H -#define DPSINT_H - -#include <DPS/dpsXclient.h> - -#include "publictypes.h" -#include "dpsassert.h" - -#include "dpsprivate.h" -#include "dpsXint.h" -#include "dpsdict.h" - -typedef struct _t_ContextBufferRec { - struct _t_ContextBufferRec *next; - } ContextBufferRec, *ContextBuffer; - -typedef struct { - ContextBuffer gcontextBuffers; - integer gqueuedBuffers; - DPSProcs gctxProcs, gtextCtxProcs, gdummyCtxProcs; - DPSSpaceProcs gspaceProcs; - DPSPrivSpace gspaces; - char **guserNames; - integer guserNamesLength; - PSWDict guserNameDict; - boolean gclientStarted; - DPSContext gdummyCtx; - integer ginitFailed, gglobLastNameIndex; - DPSPrivSpace gTextSpace; -} GlobalsRec, *Globals; - -extern Globals DPSglobals; - -#define contextBuffers DPSglobals->gcontextBuffers -#define queuedBuffers DPSglobals->gqueuedBuffers -#define ctxProcs DPSglobals->gctxProcs -#define textCtxProcs DPSglobals->gtextCtxProcs -#define dummyCtxProcs DPSglobals->gdummyCtxProcs -#define spaceProcs DPSglobals->gspaceProcs -#define spaces DPSglobals->gspaces -#define userNames DPSglobals->guserNames -#define userNamesLength DPSglobals->guserNamesLength -#define userNameDict DPSglobals->guserNameDict -#define clientStarted DPSglobals->gclientStarted -#define dummyCtx DPSglobals->gdummyCtx -#define initFailed DPSglobals->ginitFailed -#define globLastNameIndex DPSglobals->gglobLastNameIndex -#define textSpace DPSglobals->gTextSpace - -extern boolean DPSCheckShared(DPSPrivContext ctxt); -extern boolean DPSKnownContext(DPSContext ctxt); -extern boolean DPSKnownSpace(DPSSpace space); -extern boolean DPSPrivateCheckWait(DPSContext ctxt); -extern void DPSCheckInitClientGlobals(void); -extern void DPSPrivateDestroyContext(DPSContext ctxt); -extern void DPSPrivateDestroySpace(DPSSpace space); -extern void DPSSafeSetLastNameIndex(DPSContext ctxt); -extern void DPSclientPrintProc(DPSContext ctxt, char *buf, unsigned nch); -extern void DPSinnerProcWriteData(DPSContext ctxt, char *buf, unsigned int count); - -extern void DPSDefaultPrivateHandler( - DPSContext ctxt, - DPSErrorCode errorCode, - long unsigned int arg1, - long unsigned int arg2, - char *prefix, - char *suffix); - -extern char *DPScalloc(integer e, integer n); - -extern DPSContext DPSCreateContext( - char *wh, - DPSTextProc textProc, - DPSErrorProc errorProc, - DPSSpace space); - -extern void DPSHandleBogusError(DPSContext ctxt, char *prefix, char *suffix); -extern void DPSInitCommonContextProcs(DPSProcs p); -extern void DPSInitCommonSpaceProcs(DPSSpaceProcs p); -extern void DPSInitCommonTextContextProcs(DPSProcs p); -extern void DPSInitPrivateContextFields(DPSPrivContext c, DPSPrivSpace s); -extern void DPSInitPrivateContextProcs(DPSProcs p); -extern void DPSInitPrivateSpaceFields(DPSPrivSpace s); -extern void DPSInitPrivateTextContextFields(DPSPrivContext c, DPSPrivSpace s); -extern void DPSServicePostScript(boolean (*returnControl)(void)); - -#endif /* DPSINT_H */ diff --git a/nx-X11/lib/dps/dpsioops.psw b/nx-X11/lib/dps/dpsioops.psw deleted file mode 100644 index dec3bb7c3..000000000 --- a/nx-X11/lib/dps/dpsioops.psw +++ /dev/null @@ -1,153 +0,0 @@ -/* dpsioops.psw - * - * (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 - */ - -defineps DPSequals(DPSContext ctxt) - = -endps - -defineps DPSequalsequals(DPSContext ctxt) - == -endps - -defineps DPSbytesavailable(DPSContext ctxt | int *n) - bytesavailable n -endps - -defineps DPSclosefile(DPSContext ctxt) - closefile -endps - -defineps DPScurrentfile(DPSContext ctxt) - currentfile -endps - -defineps DPSdeletefile(DPSContext ctxt; char *filename) - (filename) deletefile -endps - -defineps DPSecho(DPSContext ctxt; boolean b) - b echo -endps - -defineps DPSfile(DPSContext ctxt; char *name, *access) - (name) (access) file -endps - -defineps DPSfilenameforall(DPSContext ctxt) - filenameforall -endps - -defineps DPSfileposition(DPSContext ctxt | int *pos) - fileposition pos -endps - -defineps DPSflush(DPSContext ctxt) - flush -endps - -defineps DPSflushfile(DPSContext ctxt) - flushfile -endps - -defineps DPSprint(DPSContext ctxt) - print -endps - -defineps DPSprintobject(DPSContext ctxt; int tag) - tag printobject -endps - -defineps DPSpstack(DPSContext ctxt) - pstack -endps - -defineps DPSread(DPSContext ctxt| boolean *b) - read b -endps - -defineps DPSreadhexstring(DPSContext ctxt| boolean *b) - readhexstring b -endps - -defineps DPSreadline(DPSContext ctxt| boolean *b) - readline b -endps - -defineps DPSreadstring(DPSContext ctxt| boolean *b) - readstring b -endps - -defineps DPSrenamefile(DPSContext ctxt; char *oldname, *newname) - (oldname) (newname) renamefile -endps - -defineps DPSresetfile(DPSContext ctxt) - resetfile -endps - -defineps DPSsetfileposition(DPSContext ctxt; int pos) - pos setfileposition -endps - -defineps DPSstack(DPSContext ctxt) - stack -endps - -defineps DPSstatus(DPSContext ctxt | boolean *b) - status b -endps - -defineps DPStoken(DPSContext ctxt| boolean *b) - token b -endps - -defineps DPSwrite(DPSContext ctxt) - write -endps - -defineps DPSwritehexstring(DPSContext ctxt) - writehexstring -endps - -defineps DPSwriteobject(DPSContext ctxt; int tag) - tag writeobject -endps - -defineps DPSwritestring(DPSContext ctxt) - writestring -endps - diff --git a/nx-X11/lib/dps/dpsl2ops.psw b/nx-X11/lib/dps/dpsl2ops.psw deleted file mode 100644 index 67c1aee22..000000000 --- a/nx-X11/lib/dps/dpsl2ops.psw +++ /dev/null @@ -1,208 +0,0 @@ -/* dpsl2ops.psw - * (c) Copyright 1991-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 - */ - -defineps DPSleftbracket(DPSContext ctxt) - mark % [ annoys pswrap -endps - -defineps DPSrightbracket(DPSContext ctxt) - counttomark array astore exch pop % ] annoys pswrap -endps - -defineps DPSleftleft(DPSContext ctxt) - << -endps - -defineps DPSrightright(DPSContext ctxt) - >> -endps - -defineps DPScshow(DPSContext ctxt; char *s) - (s) cshow -endps - -defineps DPScurrentcolor(DPSContext ctxt) - currentcolor -endps - -defineps DPScurrentcolorrendering(DPSContext ctxt) - currentcolorrendering -endps - -defineps DPScurrentcolorspace(DPSContext ctxt) - currentcolorspace -endps - -defineps DPScurrentdevparams(DPSContext ctxt; char *dev) - (dev) currentdevparams -endps - -defineps DPScurrentglobal(DPSContext ctxt | boolean *b) - currentglobal b -endps - -defineps DPScurrentoverprint(DPSContext ctxt | boolean *b) - currentoverprint b -endps - -defineps DPScurrentpagedevice(DPSContext ctxt) - currentpagedevice -endps - -defineps DPScurrentsystemparams(DPSContext ctxt) - currentsystemparams -endps - -defineps DPScurrentuserparams(DPSContext ctxt) - currentuserparams -endps - -defineps DPSdefineresource(DPSContext ctxt; char *category) - /category defineresource -endps - -defineps DPSexecform(DPSContext ctxt) - execform -endps - -defineps DPSfilter(DPSContext ctxt) - filter -endps - -defineps DPSfindencoding(DPSContext ctxt; char *key) - /key findencoding -endps - -defineps DPSfindresource(DPSContext ctxt; char *key, *category) - /key /category findresource -endps - -defineps DPSgcheck(DPSContext ctxt | boolean *b) - gcheck b -endps - -defineps DPSglobaldict(DPSContext ctxt) - globaldict -endps - -defineps DPSGlobalFontDirectory(DPSContext ctxt) - GlobalFontDirectory -endps - -defineps DPSglyphshow(DPSContext ctxt; char *name) - /name glyphshow -endps - -defineps DPSlanguagelevel(DPSContext ctxt | int *n) - languagelevel n -endps - -defineps DPSmakepattern(DPSContext ctxt) - makepattern -endps - -defineps DPSproduct(DPSContext ctxt) - product -endps - -defineps DPSresourceforall(DPSContext ctxt; char *category) - /category resourceforall -endps - -defineps DPSresourcestatus(DPSContext ctxt; char *key, *category; | boolean *b) - /key /category resourcestatus b -endps - -defineps DPSrevision(DPSContext ctxt | int *n) - revision n -endps - -defineps DPSrootfont(DPSContext ctxt) - rootfont -endps - -defineps DPSserialnumber(DPSContext ctxt | int *n) - serialnumber n -endps - -defineps DPSsetcolor(DPSContext ctxt) - setcolor -endps - -defineps DPSsetcolorrendering(DPSContext ctxt) - setcolorrendering -endps - -defineps DPSsetcolorspace(DPSContext ctxt) - setcolorspace -endps - -defineps DPSsetdevparams(DPSContext ctxt) - setdevparams -endps - -defineps DPSsetglobal(DPSContext ctxt; boolean b) - b setglobal -endps - -defineps DPSsetoverprint(DPSContext ctxt; boolean b) - b setoverprint -endps - -defineps DPSsetpagedevice(DPSContext ctxt) - setpagedevice -endps - -defineps DPSsetpattern(DPSContext ctxt) - setpattern -endps - -defineps DPSsetsystemparams(DPSContext ctxt) - setsystemparams -endps - -defineps DPSsetuserparams(DPSContext ctxt) - setuserparams -endps - -defineps DPSstartjob(DPSContext ctxt; boolean b; char *password) - b password startjob -endps - -defineps DPSundefineresource(DPSContext ctxt; char *key, *category) - /key /category undefineresource -endps - diff --git a/nx-X11/lib/dps/dpsmathops.psw b/nx-X11/lib/dps/dpsmathops.psw deleted file mode 100644 index e7ada11af..000000000 --- a/nx-X11/lib/dps/dpsmathops.psw +++ /dev/null @@ -1,125 +0,0 @@ -/* dpsmathops.psw - * - * (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 - */ - -defineps DPSabs(DPSContext ctxt) - abs -endps - -defineps DPSadd(DPSContext ctxt) - add -endps - -defineps DPSand(DPSContext ctxt) - and -endps - -defineps DPSatan(DPSContext ctxt) - atan -endps - -defineps DPSbitshift(DPSContext ctxt; int shift) - shift bitshift -endps - -defineps DPSceiling(DPSContext ctxt) - ceiling -endps - -defineps DPScos(DPSContext ctxt) - cos -endps - -defineps DPSdiv(DPSContext ctxt) - div -endps - -defineps DPSexp(DPSContext ctxt) - exp -endps - -defineps DPSfloor(DPSContext ctxt) - floor -endps - -defineps DPSidiv(DPSContext ctxt) - idiv -endps - -defineps DPSln(DPSContext ctxt) - ln -endps - -defineps DPSlog(DPSContext ctxt) - log -endps - -defineps DPSmod(DPSContext ctxt) - mod -endps - -defineps DPSmul(DPSContext ctxt) - mul -endps - -defineps DPSneg(DPSContext ctxt) - neg -endps - -defineps DPSround(DPSContext ctxt) - round -endps - -defineps DPSsin(DPSContext ctxt) - sin -endps - -defineps DPSsqrt(DPSContext ctxt) - sqrt -endps - -defineps DPSsub(DPSContext ctxt) - sub -endps - -defineps DPStruncate(DPSContext ctxt) - truncate -endps - -defineps DPSxor(DPSContext ctxt) - xor -endps - diff --git a/nx-X11/lib/dps/dpsmiscops.psw b/nx-X11/lib/dps/dpsmiscops.psw deleted file mode 100644 index 6b5bb8078..000000000 --- a/nx-X11/lib/dps/dpsmiscops.psw +++ /dev/null @@ -1,53 +0,0 @@ -/* dpsmiscops.psw - * - * (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 - */ - -defineps DPSbanddevice(DPSContext ctxt) - banddevice -endps - -defineps DPSframedevice(DPSContext ctxt) - framedevice -endps - -defineps DPSnulldevice(DPSContext ctxt) - nulldevice -endps - -defineps DPSrenderbands(DPSContext ctxt) - renderbands -endps - diff --git a/nx-X11/lib/dps/dpsmtrxops.psw b/nx-X11/lib/dps/dpsmtrxops.psw deleted file mode 100644 index 6b5303ba0..000000000 --- a/nx-X11/lib/dps/dpsmtrxops.psw +++ /dev/null @@ -1,65 +0,0 @@ -/* dpsmtrxops.psw - * - * (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 - */ - -defineps DPSconcatmatrix(DPSContext ctxt) - concatmatrix -endps - -defineps DPSdtransform(DPSContext ctxt; float x1, y1 | float *x2, *y2) - x1 y1 dtransform y2 x2 -endps - -defineps DPSidentmatrix(DPSContext ctxt) - identmatrix -endps - -defineps DPSidtransform(DPSContext ctxt; float x1, y1 | float *x2, *y2) - x1 y1 idtransform y2 x2 -endps - -defineps DPSinvertmatrix(DPSContext ctxt) - invertmatrix -endps - -defineps DPSitransform(DPSContext ctxt; float x1, y1 | float *x2, *y2) - x1 y1 itransform y2 x2 -endps - -defineps DPStransform(DPSContext ctxt; float x1, y1 | float *x2, *y2) - x1 y1 transform y2 x2 -endps - diff --git a/nx-X11/lib/dps/dpsname.txt b/nx-X11/lib/dps/dpsname.txt deleted file mode 100644 index ab32b7f7d..000000000 --- a/nx-X11/lib/dps/dpsname.txt +++ /dev/null @@ -1,4 +0,0 @@ -/* - * dpsops.h - */ - diff --git a/nx-X11/lib/dps/dpsopstack.psw b/nx-X11/lib/dps/dpsopstack.psw deleted file mode 100644 index ac10d77c5..000000000 --- a/nx-X11/lib/dps/dpsopstack.psw +++ /dev/null @@ -1,96 +0,0 @@ -/* - * dpsopstack.psw -- wrapped procedures for sending and getting operands - * - * (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 - */ - -defineps DPSgetboolean(DPSContext ctxt | boolean *it) - it -endps - -defineps DPSgetchararray(DPSContext ctxt; int size | char s[size]) - s -endps - -defineps DPSgetfloat(DPSContext ctxt | float *it) - it -endps - -defineps DPSgetfloatarray(DPSContext ctxt; int size | float a[size]) - dup type /arraytype eq { a } { size { a } repeat } ifelse -endps - -defineps DPSgetint(DPSContext ctxt | int *it) - it -endps - -defineps DPSgetintarray(DPSContext ctxt; int size | int a[size]) - dup type /arraytype eq { a } { size { a } repeat } ifelse -endps - -defineps DPSgetstring(DPSContext ctxt | char *s) - s -endps - -defineps DPSsendboolean(DPSContext ctxt; boolean it) - it -endps - -defineps DPSsendchararray(DPSContext ctxt; char s[size]; int size) - (s) -endps - -defineps DPSsendfloat(DPSContext ctxt; float it) - it -endps - -defineps DPSsendfloatarray(DPSContext ctxt; float a[size]; int size) - a -endps - -defineps DPSsendint(DPSContext ctxt; int it) - it -endps - -defineps DPSsendintarray(DPSContext ctxt; int a[size]; int size) - a -endps - -defineps DPSsendstring(DPSContext ctxt; char *s) - (s) -endps - - - diff --git a/nx-X11/lib/dps/dpspathops.psw b/nx-X11/lib/dps/dpspathops.psw deleted file mode 100644 index 7c0ed7600..000000000 --- a/nx-X11/lib/dps/dpspathops.psw +++ /dev/null @@ -1,169 +0,0 @@ -/* dpspathops.psw - * - * (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 - */ - -defineps DPSarc(DPSContext ctxt; float x, y, r, angle1, angle2) - x y r angle1 angle2 arc -endps - -defineps DPSarcn(DPSContext ctxt; float x, y, r, angle1, angle2) - x y r angle1 angle2 arcn -endps - -defineps DPSarct(DPSContext ctxt; float x1, y1, x2, y2, r) - x1 y1 x2 y2 r arct -endps - -defineps DPSarcto(DPSContext ctxt; float x1, y1, x2, y2, r | float *xt1, *yt1, *xt2, *yt2) - x1 y1 x2 y2 r arcto yt2 xt2 yt1 xt1 -endps - -defineps DPScharpath(DPSContext ctxt; char *s; boolean b) - (s) b charpath -endps - -defineps DPSclip(DPSContext ctxt) - clip -endps - -defineps DPSclippath(DPSContext ctxt) - clippath -endps - -defineps DPSclosepath(DPSContext ctxt) - closepath -endps - -defineps DPScurveto(DPSContext ctxt; float x1, y1, x2, y2, x3, y3) - x1 y1 x2 y2 x3 y3 curveto -endps - -defineps DPSeoclip(DPSContext ctxt) - eoclip -endps - -defineps DPSeoviewclip(DPSContext ctxt) - eoviewclip -endps - -defineps DPSflattenpath(DPSContext ctxt) - flattenpath -endps - -defineps DPSinitclip(DPSContext ctxt) - initclip -endps - -defineps DPSinitviewclip(DPSContext ctxt) - initviewclip -endps - -defineps DPSlineto(DPSContext ctxt; float x, y) - x y lineto -endps - -defineps DPSmoveto(DPSContext ctxt; float x, y) - x y moveto -endps - -defineps DPSnewpath(DPSContext ctxt) - newpath -endps - -defineps DPSpathbbox(DPSContext ctxt | float *llx, *lly, *urx, *ury) - pathbbox ury urx lly llx -endps - -defineps DPSpathforall(DPSContext ctxt) - pathforall -endps - -defineps DPSrcurveto(DPSContext ctxt; float x1, y1, x2, y2, x3, y3) - x1 y1 x2 y2 x3 y3 rcurveto -endps - -defineps DPSrectclip(DPSContext ctxt; float x, y, w, h) - x y w h rectclip -endps - -defineps DPSrectviewclip(DPSContext ctxt; float x, y, w, h) - x y w h rectviewclip -endps - -defineps DPSreversepath(DPSContext ctxt) - reversepath -endps - -defineps DPSrlineto(DPSContext ctxt; float x, y) - x y rlineto -endps - -defineps DPSrmoveto(DPSContext ctxt; float x, y) - x y rmoveto -endps - -defineps DPSsetbbox(DPSContext ctxt; float llx, lly, urx, ury) - llx lly urx ury setbbox -endps - -defineps DPSsetucacheparams(DPSContext ctxt) - setucacheparams -endps - -defineps DPSuappend(DPSContext ctxt; char nums[n]; int n; char ops[l]; int l) - [(nums) (ops)] uappend -endps - -defineps DPSucache(DPSContext ctxt) - ucache -endps - -defineps DPSucachestatus(DPSContext ctxt) - ucachestatus -endps - -defineps DPSupath(DPSContext ctxt; boolean b) - b upath -endps - -defineps DPSviewclip(DPSContext ctxt) - viewclip -endps - -defineps DPSviewclippath(DPSContext ctxt) - viewclippath -endps - diff --git a/nx-X11/lib/dps/dpspntops.psw b/nx-X11/lib/dps/dpspntops.psw deleted file mode 100644 index e57de4997..000000000 --- a/nx-X11/lib/dps/dpspntops.psw +++ /dev/null @@ -1,129 +0,0 @@ -/* dpspntops.psw - * - * (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 - */ - -defineps DPSashow(DPSContext ctxt; float x, y; char *s) - x y (s) ashow -endps - -defineps DPSawidthshow(DPSContext ctxt; float cx, cy; int c; float ax, ay; char *s) - cx cy c ax ay (s) awidthshow -endps - -defineps DPScopypage(DPSContext ctxt) - copypage -endps - -defineps DPSeofill(DPSContext ctxt) - eofill -endps - -defineps DPSerasepage(DPSContext ctxt) - erasepage -endps - -defineps DPSfill(DPSContext ctxt) - fill -endps - -defineps DPSimage(DPSContext ctxt) - image -endps - -defineps DPSimagemask(DPSContext ctxt) - imagemask -endps - -defineps DPSkshow(DPSContext ctxt; char *s) - (s) kshow -endps - -defineps DPSrectfill(DPSContext ctxt; float x, y, w, h) - x y w h rectfill -endps - -defineps DPSrectstroke(DPSContext ctxt; float x, y, w, h) - x y w h rectstroke -endps - -defineps DPSshow(DPSContext ctxt; char *s) - (s) show -endps - -defineps DPSshowpage(DPSContext ctxt) - showpage -endps - -defineps DPSstroke(DPSContext ctxt) - stroke -endps - -defineps DPSstrokepath(DPSContext ctxt) - strokepath -endps - -defineps DPSueofill(DPSContext ctxt; char nums[n]; int n; char ops[l]; int l) - [(nums) (ops)] ueofill -endps - -defineps DPSufill(DPSContext ctxt; char nums[n]; int n; char ops[l]; int l) - [(nums) (ops)] ufill -endps - -defineps DPSustroke(DPSContext ctxt; char nums[n]; int n; char ops[l]; int l) - [(nums) (ops)] ustroke -endps - -defineps DPSustrokepath(DPSContext ctxt; char nums[n]; int n; char ops[l]; int l) - [(nums) (ops)] ustrokepath -endps - -defineps DPSwidthshow(DPSContext ctxt; float x, y; int c; char *s) - x y c (s) widthshow -endps - -defineps DPSxshow(DPSContext ctxt; char *s; float numarray[size]; int size) - (s) numarray xshow -endps - -defineps DPSxyshow(DPSContext ctxt; char *s; float numarray[size]; int size) - (s) numarray xyshow -endps - -defineps DPSyshow(DPSContext ctxt; char *s; float numarray[size]; int size) - (s) numarray yshow -endps - diff --git a/nx-X11/lib/dps/dpsprintf.c b/nx-X11/lib/dps/dpsprintf.c deleted file mode 100644 index 79d8172b6..000000000 --- a/nx-X11/lib/dps/dpsprintf.c +++ /dev/null @@ -1,68 +0,0 @@ -/* - * dpsprintf.c - * - * (c) Copyright 1985-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/dpsprintf.c,v 1.3 2000/09/26 15:57:00 tsi Exp $ */ - -#include <stdio.h> -#include <string.h> - -#include "publictypes.h" -#include "DPS/dpsclient.h" - -#ifdef USE_DOPRINT -extern void DPSdoprint(); -#endif /* USE_DOPRINT */ - -#include <stdarg.h> - -void DPSPrintf(DPSContext ctxt, char *fmt, ...) -{ - va_list args; - - va_start(args, fmt); - -#ifdef USE_DOPRINT - DPSdoprint(ctxt, fmt, &args); -#else /* USE_DOPRINT */ - { - char buffer[10000]; - vsprintf(buffer, fmt, args); - DPSWritePostScript(ctxt, buffer, strlen(buffer)); - } -#endif /* USE_DOPRINT */ - va_end(args); -} diff --git a/nx-X11/lib/dps/dpsprivate.h b/nx-X11/lib/dps/dpsprivate.h deleted file mode 100644 index 0392eedd6..000000000 --- a/nx-X11/lib/dps/dpsprivate.h +++ /dev/null @@ -1,127 +0,0 @@ -/* - * dpsprivate.h -- Private interface for the DPS client library implementation. - * - * (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 - */ - -#ifndef DPSPRIVATE_H -#define DPSPRIVATE_H - -#include "DPS/dpsconfig.h" -#include "DPS/dpsclient.h" - -typedef enum { - dps_hiFirst, dps_loFirst - } DPSByteOrder; - -typedef enum { - dps_ieee, dps_native - } DPSNumFormat; - -typedef void (*DPSClientPrintProc)( - DPSContext /* cid */, - char * /* buf */, - unsigned int /* count */); - /* Call-back procedure to handle output from the PostScript server for - context with id 'cid'. Passed to DPSServicePostScript. - 'buf' contains 'count' bytes. */ - -extern void DPSInitClient( - DPSTextProc textProc, - void (* /* releaseProc */) (char *, char *)); -/* Initialize the environment-specific parts of the client library */ - -#ifndef DPSDefaultProgramEncoding -#define DPSDefaultProgramEncoding dps_binObjSeq -#endif /* not DPSDefaultProgramEncoding */ - -#ifndef DPSDefaultByteOrder -#if SWAPBITS -#define DPSDefaultByteOrder dps_loFirst -#else /* SWAPBITS */ -#define DPSDefaultByteOrder dps_hiFirst -#endif /* SWAPBITS */ -#endif /* DPSDefaultByteOrder */ - -#ifndef DPSDefaultNumFormat -#if IEEEFLOAT -#define DPSDefaultNumFormat dps_ieee -#else /* IEEEFLOAT */ -#define DPSDefaultNumFormat dps_native -#endif /* IEEEFLOAT */ -#endif /* not DPSDefaultNumFormat */ - -#ifndef DPSDefaultNameEncoding -#define DPSDefaultNameEncoding dps_indexed -#endif /* not DPSDefaultNameEncoding */ - -extern void DPSCheckRaiseError(DPSContext c); - /* Checks the resynching flag in a DPSPrivContext and raises an exception - if true */ - -/* system name table boundaries */ -#define DPS_LAST_COMMON_SYSNAME 212 -#define DPS_FIRST_AUX_SYSNAME 256 -#define DPS_LAST_AUX_SYSNAME 427 - -extern char **DPSSysNames; -extern char **DPSSysNamesAux; - - /* System name tables. DPSSysNames[index] is the string for the name. - DPSSysNamesAux[index - DPS_FIRST_AUX_SYSNAME] is the string - for an uncommon system name. */ - -extern int DPSInitialize(void); -extern void DPSInitSysNames(void); - -extern char *DPSSetWh(DPSContext /* ctxt */, char * /* newWh */); - /* set new window handle, returns old window handle */ - -extern void DPSOutOfMemory(void); - /* - This is called by the DPS software when it cannot allocate any more - storage from the heap (e.g., when malloc returns NIL). - - MAC ONLY - DPSOutOfMemory calls CantHappen (see dpsexcept.h) unless you - have used DPSSetOutOfMemoryProc to establish a different procedure - to be called, in which case DPSOutOfMemory calls your procedure instead. - If your procedure returns, DPSOutOfMemory returns to its caller, which - re-attempts the allocation. Note that another allocation failure will - cause DPSOutOfMemory to be called again (and again ...). - - */ - -#endif /* DPSPRIVATE_H */ diff --git a/nx-X11/lib/dps/dpssimpint.h b/nx-X11/lib/dps/dpssimpint.h deleted file mode 100644 index 8485bc389..000000000 --- a/nx-X11/lib/dps/dpssimpint.h +++ /dev/null @@ -1,88 +0,0 @@ -/* - * dpsXint.h -- internal definitions to dpsXclient.c - * - * (c) Copyright 1989-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 - */ - -#ifndef DPSXINT_H -#define DPSXINT_H - -/* The first part of this structure is generic; the last part is - implementation-specific. */ - -typedef struct _t_DPSPrivContextRec { - char *priv; - DPSSpace space; - DPSProgramEncoding programEncoding; - DPSNameEncoding nameEncoding; - DPSProcs procs; - void (*textProc)(); - void (*errorProc)(); - DPSResults resultTable; - unsigned int resultTableLength; - struct _t_DPSContextRec *chainParent, *chainChild; - unsigned int contextFlags; - DPSContextExtensionRec *extension; - - struct _t_DPSPrivContextRec *next; - integer lastNameIndex, cid; - boolean eofReceived; - char *wh; - char *buf, *outBuf, *objBuf; - integer nBufChars, nOutBufChars, nObjBufChars; - DPSNumFormat numFormat; - -/* Nothing is simple-specific */ - -} DPSPrivContextRec, *DPSPrivContext; - -/* The first part of this structure is generic; the last part is - implementation-specific. */ - -typedef struct _t_DPSPrivSpaceRec { - DPSSpaceProcs procs; - - struct _t_DPSPrivSpaceRec *next; - long int lastNameIndex, sid; - char *wh; /* KLUDGE to support DPSSendDestroySpace */ - DPSPrivContext firstContext; - -/* Nothing is simple-specific */ - -} DPSPrivSpaceRec, *DPSPrivSpace; - -#include "dpsint.h" - -#endif /* DPSXINT_H */ diff --git a/nx-X11/lib/dps/dpssysnames.c b/nx-X11/lib/dps/dpssysnames.c deleted file mode 100644 index 54bf07431..000000000 --- a/nx-X11/lib/dps/dpssysnames.c +++ /dev/null @@ -1,444 +0,0 @@ -/* dpssysnames.c -- system name table - * - * (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 - */ - -#include "publictypes.h" -#include "DPS/dpsclient.h" -#include "dpsprivate.h" - -char **DPSSysNames; -char **DPSSysNamesAux; - -static char *sysNames[] = { - "abs", - "add", - "aload", - "anchorsearch", - "and", - "arc", - "arcn", - "arct", - "arcto", - "array", - "ashow", - "astore", - "awidthshow", - "begin", - "bind", - "bitshift", - "ceiling", - "charpath", - "clear", - "cleartomark", - "clip", - "clippath", - "closepath", - "concat", - "concatmatrix", - "copy", - "count", - "counttomark", - "currentcmykcolor", - "currentdash", - "currentdict", - "currentfile", - "currentfont", - "currentgray", - "currentgstate", - "currenthsbcolor", - "currentlinecap", - "currentlinejoin", - "currentlinewidth", - "currentmatrix", - "currentpoint", - "currentrgbcolor", - "currentshared", - "curveto", - "cvi", - "cvlit", - "cvn", - "cvr", - "cvrs", - "cvs", - "cvx", - "def", - "defineusername", - "dict", - "div", - "dtransform", - "dup", - "end", - "eoclip", - "eofill", - "eoviewclip", - "eq", - "exch", - "exec", - "exit", - "file", - "fill", - "findfont", - "flattenpath", - "floor", - "flush", - "flushfile", - "for", - "forall", - "ge", - "get", - "getinterval", - "grestore", - "gsave", - "gstate", - "gt", - "identmatrix", - "idiv", - "idtransform", - "if", - "ifelse", - "image", - "imagemask", - "index", - "ineofill", - "infill", - "initviewclip", - "inueofill", - "inufill", - "invertmatrix", - "itransform", - "known", - "le", - "length", - "lineto", - "load", - "loop", - "lt", - "makefont", - "matrix", - "maxlength", - "mod", - "moveto", - "mul", - "ne", - "neg", - "newpath", - "not", - "null", - "or", - "pathbbox", - "pathforall", - "pop", - "print", - "printobject", - "put", - "putinterval", - "rcurveto", - "read", - "readhexstring", - "readline", - "readstring", - "rectclip", - "rectfill", - "rectstroke", - "rectviewclip", - "repeat", - "restore", - "rlineto", - "rmoveto", - "roll", - "rotate", - "round", - "save", - "scale", - "scalefont", - "search", - "selectfont", - "setbbox", - "setcachedevice", - "setcachedevice2", - "setcharwidth", - "setcmykcolor", - "setdash", - "setfont", - "setgray", - "setgstate", - "sethsbcolor", - "setlinecap", - "setlinejoin", - "setlinewidth", - "setmatrix", - "setrgbcolor", - "setshared", - "shareddict", - "show", - "showpage", - "stop", - "stopped", - "store", - "string", - "stringwidth", - "stroke", - "strokepath", - "sub", - "systemdict", - "token", - "transform", - "translate", - "truncate", - "type", - "uappend", - "ucache", - "ueofill", - "ufill", - "undef", - "upath", - "userdict", - "ustroke", - "viewclip", - "viewclippath", - "where", - "widthshow", - "write", - "writehexstring", - "writeobject", - "writestring", - "wtranslation", - "xor", - "xshow", - "xyshow", - "yshow", - "FontDirectory", - "SharedFontDirectory", - "Courier", - "Courier-Bold", - "Courier-BoldOblique", - "Courier-Oblique", - "Helvetica", - "Helvetica-Bold", - "Helvetica-BoldOblique", - "Helvetica-Oblique", - "Symbol", - "Times-Bold", - "Times-BoldItalic", - "Times-Italic", - "Times-Roman", - "execuserobject", /* 212 */ - "" -}; - -static char *sysNamesAux[] = { - "=", /* 256 */ - "==", - "ISOLatin1Encoding", - "StandardEncoding", - "[", - "]", - "atan", - "banddevice", - "bytesavailable", - "cachestatus", - "closefile", - "colorimage", - "condition", - "copypage", - "cos", - "countdictstack", - "countexecstack", - "cshow", - "currentblackgeneration", - "currentcacheparams", - "currentcolorscreen", - "currentcolortransfer", - "currentcontext", - "currentflat", - "currenthalftone", - "currenthalftonephase", - "currentmiterlimit", - "currentobjectformat", - "currentpacking", - "currentscreen", - "currentstrokeadjust", - "currenttransfer", - "currentundercolorremoval", - "defaultmatrix", - "definefont", - "deletefile", - "detach", - "deviceinfo", - "dictstack", - "echo", - "erasepage", - "errordict", - "execstack", - "executeonly", - "exp", - "false", - "filenameforall", - "fileposition", - "fork", - "framedevice", - "grestoreall", - "handleerror", - "initclip", - "initgraphics", - "initmatrix", - "instroke", - "inustroke", - "join", - "kshow", - "ln", - "lock", - "log", - "mark", - "monitor", - "noaccess", - "notify", - "nulldevice", - "packedarray", - "quit", - "rand", - "rcheck", - "readonly", - "realtime", - "renamefile", - "renderbands", - "resetfile", - "reversepath", - "rootfont", - "rrand", - "run", - "scheck", - "setblackgeneration", - "setcachelimit", - "setcacheparams", - "setcolorscreen", - "setcolortransfer", - "setfileposition", - "setflat", - "sethalftone", - "sethalftonephase", - "setmiterlimit", - "setobjectformat", - "setpacking", - "setscreen", - "setstrokeadjust", - "settransfer", - "setucacheparams", - "setundercolorremoval", - "sin", - "sqrt", - "srand", - "stack", - "status", - "statusdict", - "true", - "ucachestatus", - "undefinefont", - "usertime", - "ustrokepath", - "version", - "vmreclaim", - "vmstatus", - "wait", - "wcheck", - "xcheck", - "yield", - "defineuserobject", - "undefineuserobject", - "UserObjects", - "cleardictstack", - "A", /* 376 */ - "B", - "C", - "D", - "E", - "F", - "G", - "H", - "I", - "J", - "K", - "L", - "M", - "N", - "O", - "P", - "Q", - "R", - "S", - "T", - "U", - "V", - "W", - "X", - "Y", - "Z", - "a", - "b", - "c", - "d", - "e", - "f", - "g", - "h", - "i", - "j", - "k", - "l", - "m", - "n", - "o", - "p", - "q", - "r", - "s", - "t", - "u", - "v", - "w", - "x", - "y", - "z", /* 427 */ - "setvmthreshold", /* 428 */ - "<<", /* 429 */ - ">>", /* 430 */ - "" -}; - -void DPSInitSysNames() { - DPSSysNames = (char **)sysNames; - DPSSysNamesAux = (char **)sysNamesAux; - } diff --git a/nx-X11/lib/dps/dpssysops.psw b/nx-X11/lib/dps/dpssysops.psw deleted file mode 100644 index 731287930..000000000 --- a/nx-X11/lib/dps/dpssysops.psw +++ /dev/null @@ -1,149 +0,0 @@ -/* dpssysops.psw - * - * (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 - */ - -defineps DPSbind(DPSContext ctxt) - bind -endps - -defineps DPScleardictstack(DPSContext ctxt) - cleardictstack -endps - -defineps DPScountdictstack(DPSContext ctxt | int *n) - countdictstack n -endps - -defineps DPScountexecstack(DPSContext ctxt | int *n) - countexecstack n -endps - -defineps DPScurrentdict(DPSContext ctxt) - currentdict -endps - -defineps DPScurrentpacking(DPSContext ctxt | boolean *b) - currentpacking b -endps - -defineps DPScurrentshared(DPSContext ctxt | boolean *b) - currentshared b -endps - -defineps DPSdeviceinfo(DPSContext ctxt) - deviceinfo -endps - -defineps DPSerrordict(DPSContext ctxt) - errordict -endps - -defineps DPSexec(DPSContext ctxt) - exec -endps - -defineps DPSprompt(DPSContext ctxt) - prompt -endps - -defineps DPSquit(DPSContext ctxt) - quit -endps - -defineps DPSrand(DPSContext ctxt) - rand -endps - -defineps DPSrealtime(DPSContext ctxt | int *i) - realtime i -endps - -defineps DPSrestore(DPSContext ctxt) - restore -endps - -defineps DPSrrand(DPSContext ctxt) - rrand -endps - -defineps DPSrun(DPSContext ctxt; char *filename) - (filename) run -endps - -defineps DPSsave(DPSContext ctxt) - save -endps - -defineps DPSsetpacking(DPSContext ctxt; boolean b) - b setpacking -endps - -defineps DPSsetshared(DPSContext ctxt; boolean b) - b setshared -endps - -defineps DPSsrand(DPSContext ctxt) - srand -endps - -defineps DPSstart(DPSContext ctxt) - start -endps - -defineps DPStype(DPSContext ctxt) - type -endps - -defineps DPSundef(DPSContext ctxt; char *name) - /name undef -endps - -defineps DPSusertime(DPSContext ctxt | int *milliseconds) - usertime milliseconds -endps - -defineps DPSversion(DPSContext ctxt; int bufsize | char buf[bufsize]) - version buf -endps - -defineps DPSvmreclaim(DPSContext ctxt; int code) - code vmreclaim -endps - -defineps DPSvmstatus(DPSContext ctxt | int *level, *used, *maximum) - vmstatus maximum used level -endps - diff --git a/nx-X11/lib/dps/dpswinops.psw b/nx-X11/lib/dps/dpswinops.psw deleted file mode 100644 index 6ccf77b4c..000000000 --- a/nx-X11/lib/dps/dpswinops.psw +++ /dev/null @@ -1,65 +0,0 @@ -/* dpswinops.psw - * - * (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 - */ - -defineps DPSineofill(DPSContext ctxt; float x, y | boolean *b) - x y ineofill b -endps - -defineps DPSinfill(DPSContext ctxt; float x, y | boolean *b) - x y infill b -endps - -defineps DPSinstroke(DPSContext ctxt; float x, y | boolean *b) - x y instroke b -endps - -defineps DPSinueofill(DPSContext ctxt; float x, y; char nums[n]; int n; char ops[l]; int l | boolean *b) - x y [(nums) (ops)] inueofill b -endps - -defineps DPSinufill(DPSContext ctxt; float x, y; char nums[n]; int n; char ops[l]; int l | boolean *b) - x y [(nums) (ops)] inufill b -endps - -defineps DPSinustroke(DPSContext ctxt; float x, y; char nums[n]; int n; char ops[l]; int l | boolean *b) - x y [(nums) (ops)] inustroke b -endps - -defineps DPSwtranslation(DPSContext ctxt | float *x, *y) - wtranslation y x -endps - diff --git a/nx-X11/lib/dps/else.txt b/nx-X11/lib/dps/else.txt deleted file mode 100644 index b74df412a..000000000 --- a/nx-X11/lib/dps/else.txt +++ /dev/null @@ -1,6 +0,0 @@ -#else /* _NO_PROTO */ - -#if defined(__cplusplus) || defined(c_plusplus) -extern "C" { -#endif - diff --git a/nx-X11/lib/dps/genheader.cmd b/nx-X11/lib/dps/genheader.cmd deleted file mode 100644 index b1784e232..000000000 --- a/nx-X11/lib/dps/genheader.cmd +++ /dev/null @@ -1,14 +0,0 @@ -REM -/* OS/2 generate header files */ -/* $XFree86: xc/lib/dps/genheader.cmd,v 1.1 2000/04/05 18:13:22 dawes Exp $ */ -cat psclrops.h psctrlops.h psctxtops.h psdataops.h psfontops.h psgsttops.h psioops.h psmathops.h psmtrxops.h psmiscops.h pspntops.h pspathops.h pssysops.h pswinops.h psopstack.h psXops.h psl2ops.h >.ph -sed -e "/^$$/D" -e "/#/D" -e "/^\//D" -e "/^ gener/D" -e "/^.\//D" .ph | sort >.sort -awk "/;/ {print;printf(\"\n\");}" .sort >.ttt -cat psname.txt header.txt psifdef.txt .ttt psendif.txt > psops.h.os2 -rm .ph .sort .ttt - -cat dpsclrops.h dpsctrlops.h dpsctxtops.h dpsdataops.h dpsfontops.h dpsgsttops.h dpsioops.h dpsmathops.h dpsmtrxops.h dpsmiscops.h dpspntops.h dpspathops.h dpssysops.h dpswinops.h dpsopstack.h dpsXops.h dpsl2ops.h >.ph -sed -e "/^$$/D" -e "/#/D" -e "/^\//D" -e "/^ gener/D" -e "/^.\//D" .ph | sort >.sort -awk "/;/ {print;printf(\"\n\");}" .sort >.ttt -cat dpsname.txt header.txt dpsifdef.txt .ttt dpsendif.txt > dpsops.h.os2 -rm .ph .sort .ttt diff --git a/nx-X11/lib/dps/header.txt b/nx-X11/lib/dps/header.txt deleted file mode 100644 index 8b37ebe67..000000000 --- a/nx-X11/lib/dps/header.txt +++ /dev/null @@ -1,35 +0,0 @@ -/* - * (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 - */ diff --git a/nx-X11/lib/dps/psXops.psw b/nx-X11/lib/dps/psXops.psw deleted file mode 100644 index 5d350418f..000000000 --- a/nx-X11/lib/dps/psXops.psw +++ /dev/null @@ -1,81 +0,0 @@ -/* psXops.psw - * - * (c) Copyright 1991-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$ */ - -defineps PSclientsync() - clientsync -endps - -defineps PScurrentXgcdrawable(| int *gc, *draw, *x, *y) - currentXgcdrawable y x draw gc -endps - -defineps PScurrentXgcdrawablecolor(| int *gc, *draw, *x, *y, colorInfo[12]) - currentXgcdrawablecolor colorInfo y x draw gc -endps - -defineps PScurrentXoffset(| int *x, *y) - currentXoffset y x -endps - -defineps PSsetXgcdrawable(int gc, draw, x, y) - gc draw x y setXgcdrawable -endps - -defineps PSsetXgcdrawablecolor(int gc, draw, x, y, colorInfo[12]) - gc draw x y colorInfo setXgcdrawablecolor -endps - -defineps PSsetXoffset(int x, y) - x y setXoffset -endps - -defineps PSsetXrgbactual(float r, g, b | boolean *success) - r g b setXrgbactual success -endps - -defineps PSclientXready(int i0, i1, i2, i3) - [ i0 i1 i2 i3 ] clientXready -endps - -defineps PSsetXdrawingfunction(int function) - function setXdrawingfunction -endps - -defineps PScurrentXdrawingfunction(| int *function) - currentXdrawingfunction function -endps diff --git a/nx-X11/lib/dps/psclrops.psw b/nx-X11/lib/dps/psclrops.psw deleted file mode 100644 index 986f85176..000000000 --- a/nx-X11/lib/dps/psclrops.psw +++ /dev/null @@ -1,81 +0,0 @@ -/* psclrops.psw - * - * (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 - */ - -defineps PScolorimage() - colorimage -endps - -defineps PScurrentblackgeneration() - currentblackgeneration -endps - -defineps PScurrentcmykcolor( | float *c, *m, *y, *k) - currentcmykcolor k y m c -endps - -defineps PScurrentcolorscreen() - currentcolorscreen -endps - -defineps PScurrentcolortransfer() - currentcolortransfer -endps - -defineps PScurrentundercolorremoval() - currentundercolorremoval -endps - -defineps PSsetblackgeneration() - setblackgeneration -endps - -defineps PSsetcmykcolor(float c, m, y, k) - c m y k setcmykcolor -endps - -defineps PSsetcolorscreen() - setcolorscreen -endps - -defineps PSsetcolortransfer() - setcolortransfer -endps - -defineps PSsetundercolorremoval() - setundercolorremoval -endps - diff --git a/nx-X11/lib/dps/psctrlops.psw b/nx-X11/lib/dps/psctrlops.psw deleted file mode 100644 index 882020d63..000000000 --- a/nx-X11/lib/dps/psctrlops.psw +++ /dev/null @@ -1,113 +0,0 @@ -/* psctrlops.psw - * - * (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 - */ - -defineps PSeq() - eq -endps - -defineps PSexit() - exit -endps - -defineps PSfalse() - false -endps - -defineps PSfor() - for -endps - -defineps PSforall() - forall -endps - -defineps PSge() - ge -endps - -defineps PSgt() - gt -endps - -defineps PSif() - if -endps - -defineps PSifelse() - ifelse -endps - -defineps PSle() - le -endps - -defineps PSloop() - loop -endps - -defineps PSlt() - lt -endps - -defineps PSne() - ne -endps - -defineps PSnot() - not -endps - -defineps PSor() - or -endps - -defineps PSrepeat() - repeat -endps - -defineps PSstop() - stop -endps - -defineps PSstopped() - stopped -endps - -defineps PStrue() - true -endps - diff --git a/nx-X11/lib/dps/psctxtops.psw b/nx-X11/lib/dps/psctxtops.psw deleted file mode 100644 index 43ca803fc..000000000 --- a/nx-X11/lib/dps/psctxtops.psw +++ /dev/null @@ -1,109 +0,0 @@ -/* psctxtops.psw - * - * (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 - */ - -defineps PSUserObjects() - UserObjects -endps - -defineps PScondition() - condition -endps - -defineps PScurrentcontext( | int *cid) - currentcontext cid -endps - -defineps PScurrentobjectformat( | int *code) - currentobjectformat code -endps - -defineps PSdefineusername(int i; char *username) - i /username defineusername -endps - -defineps PSdefineuserobject() - defineuserobject -endps - -defineps PSdetach() - detach -endps - -defineps PSexecuserobject(int userObjIndex) - userObjIndex execuserobject -endps - -defineps PSfork() - fork -endps - -defineps PSjoin() - join -endps - -defineps PSlock() - lock -endps - -defineps PSmonitor() - monitor -endps - -defineps PSnotify() - notify -endps - -defineps PSsetobjectformat(int code) - code setobjectformat -endps - -defineps PSsetvmthreshold(int i) - i setvmthreshold -endps - -defineps PSundefineuserobject(int userObjIndex) - userObjIndex undefineuserobject -endps - -defineps PSwait() - wait -endps - -defineps PSyield() - yield -endps - diff --git a/nx-X11/lib/dps/psdataops.psw b/nx-X11/lib/dps/psdataops.psw deleted file mode 100644 index ee89313f6..000000000 --- a/nx-X11/lib/dps/psdataops.psw +++ /dev/null @@ -1,257 +0,0 @@ -/* psdataops.psw - * - * (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 - */ - -defineps PSaload() - aload -endps - -defineps PSanchorsearch(| boolean *truth) - anchorsearch truth -endps - -defineps PSarray(int len) - len array -endps - -defineps PSastore() - astore -endps - -defineps PSbegin() - begin -endps - -defineps PSclear() - clear -endps - -defineps PScleartomark() - cleartomark -endps - -defineps PScopy(int n) - n copy -endps - -defineps PScount( | int *n) - count n -endps - -defineps PScounttomark( | int *n) - counttomark n -endps - -defineps PScvi() - cvi -endps - -defineps PScvlit() - cvlit -endps - -defineps PScvn() - cvn -endps - -defineps PScvr() - cvr -endps - -defineps PScvrs() - cvrs -endps - -defineps PScvs() - cvs -endps - -defineps PScvx() - cvx -endps - -defineps PSdef() - def -endps - -defineps PSdict(int len) - len dict -endps - -defineps PSdictstack() - dictstack -endps - -defineps PSdup() - dup -endps - -defineps PSend() - end -endps - -defineps PSexch() - exch -endps - -defineps PSexecstack() - execstack -endps - -defineps PSexecuteonly() - executeonly -endps - -defineps PSget() - get -endps - -defineps PSgetinterval() - getinterval -endps - -defineps PSindex(int i) - i index -endps - -defineps PSknown( | boolean *b) - known b -endps - -defineps PSlength( | int *len) - length len -endps - -defineps PSload() - load -endps - -defineps PSmark() - mark -endps - -defineps PSmatrix() - matrix -endps - -defineps PSmaxlength( | int *len) - maxlength len -endps - -defineps PSnoaccess() - noaccess -endps - -defineps PSnull() - null -endps - -defineps PSpackedarray() - packedarray -endps - -defineps PSpop() - pop -endps - -defineps PSput() - put -endps - -defineps PSputinterval() - putinterval -endps - -defineps PSrcheck( | boolean *b) - rcheck b -endps - -defineps PSreadonly() - readonly -endps - -defineps PSroll(int n, j) - n j roll -endps - -defineps PSscheck( | boolean *b) - scheck b -endps - -defineps PSsearch(| boolean *b) - search b -endps - -defineps PSshareddict() - shareddict -endps - -defineps PSstatusdict() - statusdict -endps - -defineps PSstore() - store -endps - -defineps PSstring(int len) - len string -endps - -defineps PSstringwidth(char *s | float *xp, *yp) - (s) stringwidth yp xp -endps - -defineps PSsystemdict() - systemdict -endps - -defineps PSuserdict() - userdict -endps - -defineps PSwcheck( | boolean *b) - wcheck b -endps - -defineps PSwhere(| boolean *b) - where b -endps - -defineps PSxcheck( | boolean *b) - xcheck b -endps - diff --git a/nx-X11/lib/dps/psendif.txt b/nx-X11/lib/dps/psendif.txt deleted file mode 100644 index cd3eae5f3..000000000 --- a/nx-X11/lib/dps/psendif.txt +++ /dev/null @@ -1,6 +0,0 @@ - -#if defined(__cplusplus) || defined(c_plusplus) -} -#endif - -#endif /* PSOPS_H */ diff --git a/nx-X11/lib/dps/psfontops.psw b/nx-X11/lib/dps/psfontops.psw deleted file mode 100644 index 9d9b99914..000000000 --- a/nx-X11/lib/dps/psfontops.psw +++ /dev/null @@ -1,109 +0,0 @@ -/* psfontops.psw - * - * (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 - */ - -defineps PSFontDirectory() - FontDirectory -endps - -defineps PSISOLatin1Encoding() - ISOLatin1Encoding -endps - -defineps PSSharedFontDirectory() - SharedFontDirectory -endps - -defineps PSStandardEncoding() - StandardEncoding -endps - -defineps PScachestatus() - cachestatus -endps - -defineps PScurrentcacheparams() - currentcacheparams -endps - -defineps PScurrentfont() - currentfont -endps - -defineps PSdefinefont() - definefont -endps - -defineps PSfindfont(char *name) - /name findfont -endps - -defineps PSmakefont() - makefont -endps - -defineps PSscalefont(float size) - size scalefont -endps - -defineps PSselectfont(char *name; float scale) - /name scale selectfont -endps - -defineps PSsetcachedevice(float wx, wy, llx, lly, urx, ury) - wx wy llx lly urx ury setcachedevice -endps - -defineps PSsetcachelimit(int n) - n setcachelimit -endps - -defineps PSsetcacheparams() - setcacheparams -endps - -defineps PSsetcharwidth(float wx, wy) - wx wy setcharwidth -endps - -defineps PSsetfont(userobject f) - f setfont -endps - -defineps PSundefinefont(char *name) - /name undefinefont -endps - diff --git a/nx-X11/lib/dps/psgsttops.psw b/nx-X11/lib/dps/psgsttops.psw deleted file mode 100644 index a6eb87b62..000000000 --- a/nx-X11/lib/dps/psgsttops.psw +++ /dev/null @@ -1,213 +0,0 @@ -/* psgsttops.psw - * - * (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 - */ - -defineps PSconcat(float m[6]) - m concat -endps - -defineps PScurrentdash() - currentdash -endps - -defineps PScurrentflat( | float *flatness) - currentflat flatness -endps - -defineps PScurrentgray( | float *gray) - currentgray gray -endps - -defineps PScurrentgstate(userobject gst) - gst currentgstate -endps - -defineps PScurrenthalftone() - currenthalftone -endps - -defineps PScurrenthalftonephase( | float *x, *y) - currenthalftonephase y x -endps - -defineps PScurrenthsbcolor( | float *h, *s, *b) - currenthsbcolor b s h -endps - -defineps PScurrentlinecap( | int *linecap) - currentlinecap linecap -endps - -defineps PScurrentlinejoin( | int *linejoin) - currentlinejoin linejoin -endps - -defineps PScurrentlinewidth( | float *width) - currentlinewidth width -endps - -defineps PScurrentmatrix() - currentmatrix -endps - -defineps PScurrentmiterlimit( | float *limit) - currentmiterlimit limit -endps - -defineps PScurrentpoint( | float *x, *y) - currentpoint y x -endps - -defineps PScurrentrgbcolor( | float *r, *g, *b) - currentrgbcolor b g r -endps - -defineps PScurrentscreen() - currentscreen -endps - -defineps PScurrentstrokeadjust( | boolean *b) - currentstrokeadjust b -endps - -defineps PScurrenttransfer() - currenttransfer -endps - -defineps PSdefaultmatrix() - defaultmatrix -endps - -defineps PSgrestore() - grestore -endps - -defineps PSgrestoreall() - grestoreall -endps - -defineps PSgsave() - gsave -endps - -defineps PSgstate() - gstate -endps - -defineps PSinitgraphics() - initgraphics -endps - -defineps PSinitmatrix() - initmatrix -endps - -defineps PSrotate(float angle) - angle rotate -endps - -defineps PSscale(float x, y) - x y scale -endps - -defineps PSsetdash(float pat[size]; int size; float offset) - pat offset setdash -endps - -defineps PSsetflat(float flatness) - flatness setflat -endps - -defineps PSsetgray(float gray) - gray setgray -endps - -defineps PSsetgstate(userobject gst) - gst setgstate -endps - -defineps PSsethalftone() - sethalftone -endps - -defineps PSsethalftonephase(float x, y) - x y sethalftonephase -endps - -defineps PSsethsbcolor(float h, s, b) - h s b sethsbcolor -endps - -defineps PSsetlinecap(int linecap) - linecap setlinecap -endps - -defineps PSsetlinejoin(int linejoin) - linejoin setlinejoin -endps - -defineps PSsetlinewidth(float width) - width setlinewidth -endps - -defineps PSsetmatrix() - setmatrix -endps - -defineps PSsetmiterlimit(float limit) - limit setmiterlimit -endps - -defineps PSsetrgbcolor(float r, g, b) - r g b setrgbcolor -endps - -defineps PSsetscreen() - setscreen -endps - -defineps PSsetstrokeadjust(boolean b) - b setstrokeadjust -endps - -defineps PSsettransfer() - settransfer -endps - -defineps PStranslate(float x, y) - x y translate -endps - diff --git a/nx-X11/lib/dps/psifdef.txt b/nx-X11/lib/dps/psifdef.txt deleted file mode 100644 index 0de071a23..000000000 --- a/nx-X11/lib/dps/psifdef.txt +++ /dev/null @@ -1,7 +0,0 @@ -#ifndef PSOPS_H -#define PSOPS_H - -#if defined(__cplusplus) || defined(c_plusplus) -extern "C" { -#endif - diff --git a/nx-X11/lib/dps/psioops.psw b/nx-X11/lib/dps/psioops.psw deleted file mode 100644 index c4d4b4bb9..000000000 --- a/nx-X11/lib/dps/psioops.psw +++ /dev/null @@ -1,153 +0,0 @@ -/* psioops.psw - * - * (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 - */ - -defineps PSequals() - = -endps - -defineps PSequalsequals() - == -endps - -defineps PSbytesavailable( | int *n) - bytesavailable n -endps - -defineps PSclosefile() - closefile -endps - -defineps PScurrentfile() - currentfile -endps - -defineps PSdeletefile(char *filename) - (filename) deletefile -endps - -defineps PSecho(boolean b) - b echo -endps - -defineps PSfile(char *name, *access) - (name) (access) file -endps - -defineps PSfilenameforall() - filenameforall -endps - -defineps PSfileposition( | int *pos) - fileposition pos -endps - -defineps PSflush() - flush -endps - -defineps PSflushfile() - flushfile -endps - -defineps PSprint() - print -endps - -defineps PSprintobject(int tag) - tag printobject -endps - -defineps PSpstack() - pstack -endps - -defineps PSread(| boolean *b) - read b -endps - -defineps PSreadhexstring(| boolean *b) - readhexstring b -endps - -defineps PSreadline(| boolean *b) - readline b -endps - -defineps PSreadstring(| boolean *b) - readstring b -endps - -defineps PSrenamefile(char *oldname, *newname) - (oldname) (newname) renamefile -endps - -defineps PSresetfile() - resetfile -endps - -defineps PSsetfileposition(int pos) - pos setfileposition -endps - -defineps PSstack() - stack -endps - -defineps PSstatus( | boolean *b) - status b -endps - -defineps PStoken(| boolean *b) - token b -endps - -defineps PSwrite() - write -endps - -defineps PSwritehexstring() - writehexstring -endps - -defineps PSwriteobject(int tag) - tag writeobject -endps - -defineps PSwritestring() - writestring -endps - diff --git a/nx-X11/lib/dps/psl2ops.psw b/nx-X11/lib/dps/psl2ops.psw deleted file mode 100644 index 684b5b2e0..000000000 --- a/nx-X11/lib/dps/psl2ops.psw +++ /dev/null @@ -1,208 +0,0 @@ -/* psl2ops.psw - * (c) Copyright 1991-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 - */ - -defineps PSleftbracket() - mark % [ annoys pswrap -endps - -defineps PSrightbracket() - counttomark array astore exch pop % ] annoys pswrap -endps - -defineps PSleftleft() - << -endps - -defineps PSrightright() - >> -endps - -defineps PScshow(char *s) - (s) cshow -endps - -defineps PScurrentcolor() - currentcolor -endps - -defineps PScurrentcolorrendering() - currentcolorrendering -endps - -defineps PScurrentcolorspace() - currentcolorspace -endps - -defineps PScurrentdevparams(char *dev) - (dev) currentdevparams -endps - -defineps PScurrentglobal(| boolean *b) - currentglobal b -endps - -defineps PScurrentoverprint(| boolean *b) - currentoverprint b -endps - -defineps PScurrentpagedevice() - currentpagedevice -endps - -defineps PScurrentsystemparams() - currentsystemparams -endps - -defineps PScurrentuserparams() - currentuserparams -endps - -defineps PSdefineresource(char *category) - /category defineresource -endps - -defineps PSexecform() - execform -endps - -defineps PSfilter() - filter -endps - -defineps PSfindencoding(char *key) - /key findencoding -endps - -defineps PSfindresource(char *key, *category) - /key /category findresource -endps - -defineps PSgcheck(| boolean *b) - gcheck b -endps - -defineps PSglobaldict() - globaldict -endps - -defineps PSGlobalFontDirectory() - GlobalFontDirectory -endps - -defineps PSglyphshow(char *name) - /name glyphshow -endps - -defineps PSlanguagelevel(| int *n) - languagelevel n -endps - -defineps PSmakepattern() - makepattern -endps - -defineps PSproduct() - product -endps - -defineps PSresourceforall(char *category) - /category resourceforall -endps - -defineps PSresourcestatus(char *key, *category; | boolean *b) - /key /category resourcestatus b -endps - -defineps PSrevision(| int *n) - revision n -endps - -defineps PSrootfont() - rootfont -endps - -defineps PSserialnumber(| int *n) - serialnumber n -endps - -defineps PSsetcolor() - setcolor -endps - -defineps PSsetcolorrendering() - setcolorrendering -endps - -defineps PSsetcolorspace() - setcolorspace -endps - -defineps PSsetdevparams() - setdevparams -endps - -defineps PSsetglobal(boolean b) - b setglobal -endps - -defineps PSsetoverprint(boolean b) - b setoverprint -endps - -defineps PSsetpagedevice() - setpagedevice -endps - -defineps PSsetpattern() - setpattern -endps - -defineps PSsetsystemparams() - setsystemparams -endps - -defineps PSsetuserparams() - setuserparams -endps - -defineps PSstartjob(boolean b; char *password) - b password startjob -endps - -defineps PSundefineresource(char *key, *category) - /key /category undefineresource -endps - diff --git a/nx-X11/lib/dps/psmathops.psw b/nx-X11/lib/dps/psmathops.psw deleted file mode 100644 index 268535348..000000000 --- a/nx-X11/lib/dps/psmathops.psw +++ /dev/null @@ -1,125 +0,0 @@ -/* psmathops.psw - * - * (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 - */ - -defineps PSabs() - abs -endps - -defineps PSadd() - add -endps - -defineps PSand() - and -endps - -defineps PSatan() - atan -endps - -defineps PSbitshift(int shift) - shift bitshift -endps - -defineps PSceiling() - ceiling -endps - -defineps PScos() - cos -endps - -defineps PSdiv() - div -endps - -defineps PSexp() - exp -endps - -defineps PSfloor() - floor -endps - -defineps PSidiv() - idiv -endps - -defineps PSln() - ln -endps - -defineps PSlog() - log -endps - -defineps PSmod() - mod -endps - -defineps PSmul() - mul -endps - -defineps PSneg() - neg -endps - -defineps PSround() - round -endps - -defineps PSsin() - sin -endps - -defineps PSsqrt() - sqrt -endps - -defineps PSsub() - sub -endps - -defineps PStruncate() - truncate -endps - -defineps PSxor() - xor -endps - diff --git a/nx-X11/lib/dps/psmiscops.psw b/nx-X11/lib/dps/psmiscops.psw deleted file mode 100644 index 35bc092d0..000000000 --- a/nx-X11/lib/dps/psmiscops.psw +++ /dev/null @@ -1,53 +0,0 @@ -/* psmiscops.psw - * - * (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 - */ - -defineps PSbanddevice() - banddevice -endps - -defineps PSframedevice() - framedevice -endps - -defineps PSnulldevice() - nulldevice -endps - -defineps PSrenderbands() - renderbands -endps - diff --git a/nx-X11/lib/dps/psmtrxops.psw b/nx-X11/lib/dps/psmtrxops.psw deleted file mode 100644 index cd9ae1b79..000000000 --- a/nx-X11/lib/dps/psmtrxops.psw +++ /dev/null @@ -1,65 +0,0 @@ -/* psmtrxops.psw - * - * (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 - */ - -defineps PSconcatmatrix() - concatmatrix -endps - -defineps PSdtransform(float x1, y1 | float *x2, *y2) - x1 y1 dtransform y2 x2 -endps - -defineps PSidentmatrix() - identmatrix -endps - -defineps PSidtransform(float x1, y1 | float *x2, *y2) - x1 y1 idtransform y2 x2 -endps - -defineps PSinvertmatrix() - invertmatrix -endps - -defineps PSitransform(float x1, y1 | float *x2, *y2) - x1 y1 itransform y2 x2 -endps - -defineps PStransform(float x1, y1 | float *x2, *y2) - x1 y1 transform y2 x2 -endps - diff --git a/nx-X11/lib/dps/psname.txt b/nx-X11/lib/dps/psname.txt deleted file mode 100644 index 508b7a86d..000000000 --- a/nx-X11/lib/dps/psname.txt +++ /dev/null @@ -1,3 +0,0 @@ -/* - * psops.h - */ diff --git a/nx-X11/lib/dps/psopstack.psw b/nx-X11/lib/dps/psopstack.psw deleted file mode 100644 index d78ad6b7c..000000000 --- a/nx-X11/lib/dps/psopstack.psw +++ /dev/null @@ -1,96 +0,0 @@ -/* - * psopstack.psw -- wrapped procedures for sending and getting operands - * - * (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 - */ - -defineps PSgetboolean(| boolean *it) - it -endps - -defineps PSgetchararray(int size | char s[size]) - s -endps - -defineps PSgetfloat(| float *it) - it -endps - -defineps PSgetfloatarray(int size | float a[size]) - dup type /arraytype eq { a } { size { a } repeat } ifelse -endps - -defineps PSgetint(| int *it) - it -endps - -defineps PSgetintarray(int size | int a[size]) - dup type /arraytype eq { a } { size { a } repeat } ifelse -endps - -defineps PSgetstring(| char *s) - s -endps - -defineps PSsendboolean(boolean it) - it -endps - -defineps PSsendchararray(char s[size]; int size) - (s) -endps - -defineps PSsendfloat(float it) - it -endps - -defineps PSsendfloatarray(float a[size]; int size) - a -endps - -defineps PSsendint(int it) - it -endps - -defineps PSsendintarray(int a[size]; int size) - a -endps - -defineps PSsendstring(char *s) - (s) -endps - - - diff --git a/nx-X11/lib/dps/pspathops.psw b/nx-X11/lib/dps/pspathops.psw deleted file mode 100644 index e4c378282..000000000 --- a/nx-X11/lib/dps/pspathops.psw +++ /dev/null @@ -1,169 +0,0 @@ -/* pspathops.psw - * - * (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 - */ - -defineps PSarc(float x, y, r, angle1, angle2) - x y r angle1 angle2 arc -endps - -defineps PSarcn(float x, y, r, angle1, angle2) - x y r angle1 angle2 arcn -endps - -defineps PSarct(float x1, y1, x2, y2, r) - x1 y1 x2 y2 r arct -endps - -defineps PSarcto(float x1, y1, x2, y2, r | float *xt1, *yt1, *xt2, *yt2) - x1 y1 x2 y2 r arcto yt2 xt2 yt1 xt1 -endps - -defineps PScharpath(char *s; boolean b) - (s) b charpath -endps - -defineps PSclip() - clip -endps - -defineps PSclippath() - clippath -endps - -defineps PSclosepath() - closepath -endps - -defineps PScurveto(float x1, y1, x2, y2, x3, y3) - x1 y1 x2 y2 x3 y3 curveto -endps - -defineps PSeoclip() - eoclip -endps - -defineps PSeoviewclip() - eoviewclip -endps - -defineps PSflattenpath() - flattenpath -endps - -defineps PSinitclip() - initclip -endps - -defineps PSinitviewclip() - initviewclip -endps - -defineps PSlineto(float x, y) - x y lineto -endps - -defineps PSmoveto(float x, y) - x y moveto -endps - -defineps PSnewpath() - newpath -endps - -defineps PSpathbbox( | float *llx, *lly, *urx, *ury) - pathbbox ury urx lly llx -endps - -defineps PSpathforall() - pathforall -endps - -defineps PSrcurveto(float x1, y1, x2, y2, x3, y3) - x1 y1 x2 y2 x3 y3 rcurveto -endps - -defineps PSrectclip(float x, y, w, h) - x y w h rectclip -endps - -defineps PSrectviewclip(float x, y, w, h) - x y w h rectviewclip -endps - -defineps PSreversepath() - reversepath -endps - -defineps PSrlineto(float x, y) - x y rlineto -endps - -defineps PSrmoveto(float x, y) - x y rmoveto -endps - -defineps PSsetbbox(float llx, lly, urx, ury) - llx lly urx ury setbbox -endps - -defineps PSsetucacheparams() - setucacheparams -endps - -defineps PSuappend(char nums[n]; int n; char ops[l]; int l) - [(nums) (ops)] uappend -endps - -defineps PSucache() - ucache -endps - -defineps PSucachestatus() - ucachestatus -endps - -defineps PSupath(boolean b) - b upath -endps - -defineps PSviewclip() - viewclip -endps - -defineps PSviewclippath() - viewclippath -endps - diff --git a/nx-X11/lib/dps/pspntops.psw b/nx-X11/lib/dps/pspntops.psw deleted file mode 100644 index 2f7beef00..000000000 --- a/nx-X11/lib/dps/pspntops.psw +++ /dev/null @@ -1,129 +0,0 @@ -/* pspntops.psw - * - * (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 - */ - -defineps PSashow(float x, y; char *s) - x y (s) ashow -endps - -defineps PSawidthshow(float cx, cy; int c; float ax, ay; char *s) - cx cy c ax ay (s) awidthshow -endps - -defineps PScopypage() - copypage -endps - -defineps PSeofill() - eofill -endps - -defineps PSerasepage() - erasepage -endps - -defineps PSfill() - fill -endps - -defineps PSimage() - image -endps - -defineps PSimagemask() - imagemask -endps - -defineps PSkshow(char *s) - (s) kshow -endps - -defineps PSrectfill(float x, y, w, h) - x y w h rectfill -endps - -defineps PSrectstroke(float x, y, w, h) - x y w h rectstroke -endps - -defineps PSshow(char *s) - (s) show -endps - -defineps PSshowpage() - showpage -endps - -defineps PSstroke() - stroke -endps - -defineps PSstrokepath() - strokepath -endps - -defineps PSueofill(char nums[n]; int n; char ops[l]; int l) - [(nums) (ops)] ueofill -endps - -defineps PSufill(char nums[n]; int n; char ops[l]; int l) - [(nums) (ops)] ufill -endps - -defineps PSustroke(char nums[n]; int n; char ops[l]; int l) - [(nums) (ops)] ustroke -endps - -defineps PSustrokepath(char nums[n]; int n; char ops[l]; int l) - [(nums) (ops)] ustrokepath -endps - -defineps PSwidthshow(float x, y; int c; char *s) - x y c (s) widthshow -endps - -defineps PSxshow(char *s; float numarray[size]; int size) - (s) numarray xshow -endps - -defineps PSxyshow(char *s; float numarray[size]; int size) - (s) numarray xyshow -endps - -defineps PSyshow(char *s; float numarray[size]; int size) - (s) numarray yshow -endps - diff --git a/nx-X11/lib/dps/pssysops.psw b/nx-X11/lib/dps/pssysops.psw deleted file mode 100644 index 024d4fd52..000000000 --- a/nx-X11/lib/dps/pssysops.psw +++ /dev/null @@ -1,150 +0,0 @@ -/* - * pssysops.psw - * - * (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 - */ - -defineps PSbind() - bind -endps - -defineps PScleardictstack() - cleardictstack -endps - -defineps PScountdictstack( | int *n) - countdictstack n -endps - -defineps PScountexecstack( | int *n) - countexecstack n -endps - -defineps PScurrentdict() - currentdict -endps - -defineps PScurrentpacking( | boolean *b) - currentpacking b -endps - -defineps PScurrentshared( | boolean *b) - currentshared b -endps - -defineps PSdeviceinfo() - deviceinfo -endps - -defineps PSerrordict() - errordict -endps - -defineps PSexec() - exec -endps - -defineps PSprompt() - prompt -endps - -defineps PSquit() - quit -endps - -defineps PSrand() - rand -endps - -defineps PSrealtime( | int *i) - realtime i -endps - -defineps PSrestore() - restore -endps - -defineps PSrrand() - rrand -endps - -defineps PSrun(char *filename) - (filename) run -endps - -defineps PSsave() - save -endps - -defineps PSsetpacking(boolean b) - b setpacking -endps - -defineps PSsetshared(boolean b) - b setshared -endps - -defineps PSsrand() - srand -endps - -defineps PSstart() - start -endps - -defineps PStype() - type -endps - -defineps PSundef(char *name) - /name undef -endps - -defineps PSusertime( | int *milliseconds) - usertime milliseconds -endps - -defineps PSversion(int bufsize | char buf[bufsize]) - version buf -endps - -defineps PSvmreclaim(int code) - code vmreclaim -endps - -defineps PSvmstatus( | int *level, *used, *maximum) - vmstatus maximum used level -endps - diff --git a/nx-X11/lib/dps/pswinops.psw b/nx-X11/lib/dps/pswinops.psw deleted file mode 100644 index 4a6a2db5a..000000000 --- a/nx-X11/lib/dps/pswinops.psw +++ /dev/null @@ -1,66 +0,0 @@ -/* - * pswinops.psw - * - * (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 - */ - -defineps PSineofill(float x, y | boolean *b) - x y ineofill b -endps - -defineps PSinfill(float x, y | boolean *b) - x y infill b -endps - -defineps PSinstroke(float x, y | boolean *b) - x y instroke b -endps - -defineps PSinueofill(float x, y; char nums[n]; int n; char ops[l]; int l | boolean *b) - x y [(nums) (ops)] inueofill b -endps - -defineps PSinufill(float x, y; char nums[n]; int n; char ops[l]; int l | boolean *b) - x y [(nums) (ops)] inufill b -endps - -defineps PSinustroke(float x, y; char nums[n]; int n; char ops[l]; int l | boolean *b) - x y [(nums) (ops)] inustroke b -endps - -defineps PSwtranslation( | float *x, *y) - wtranslation y x -endps - diff --git a/nx-X11/lib/dps/publictypes.h b/nx-X11/lib/dps/publictypes.h deleted file mode 100644 index 871766e69..000000000 --- a/nx-X11/lib/dps/publictypes.h +++ /dev/null @@ -1,71 +0,0 @@ -/* - * publictypes.h - * - * (c) Copyright 1984-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/publictypes.h,v 1.2 2000/06/07 22:02:58 tsi Exp $ */ - -#ifndef PUBLICTYPES_H -#define PUBLICTYPES_H - -/* - * Note: for the moment we depend absolutely on an int being the same - * as a long int and being at least 32 bits. - */ - -/* Inline Functions */ - -#undef MIN -#define MIN(a,b) ((a)<(b)?(a):(b)) -#undef MAX -#define MAX(a,b) ((a)>(b)?(a):(b)) - -/* Declarative Sugar */ - -/* Type boolean based derived from unsigned int */ - -typedef unsigned int boolean; -typedef long int integer; - -#define true 1 -#define false 0 - -/* Generic Pointers */ - -#include <stddef.h> - -#define NIL NULL - -#endif /* PUBLICTYPES_H */ |