From: kgor@zeus.UUCP (Kent S. Gordon)
Subject: Optimization bug on RS6000
Organization: GNUs Not Usenet
Distribution: gnu
Date: Fri, 21 Aug 1992 10:54:12 GMT

I found the following bug in gcc 2.2.2 on the ibm RS6000 while
compiling the X11R5 distribution.  The bug appears when compiling
with optimization (either -O, -O2, -O3).  The code is appended to the end of this mail.
I also have a question of if it is possible to change the binder 
flags that are sent to the loader when using gcc (as -b flag is used
to send binder flags to xlc but specifies target for gcc)?
This is the command and output for the bug identified.

$ gcc -v -O -c x.c
Reading specs from /usr/gnu/lib/gcc-lib/rs6000-ibm-aix315/2.2.2/specs
gcc version 2.2.2
 /usr/gnu/lib/gcc-lib/rs6000-ibm-aix315/2.2.2/cpp -lang-c -v -undef -D__GNUC__=2 -D_IBMR2 -D_AIX -D___IBMR2__ -D___AIX__ -D___IBMR2 -D___AIX -D__CHAR_UNSIGNED__ -D__OPTIMIZE__ x.c /usr/tmp/ccXbMDM2.i
GNU CPP version 2.2.2
 /usr/gnu/lib/gcc-lib/rs6000-ibm-aix315/2.2.2/cc1 /usr/tmp/ccXbMDM2.i -quiet -dumpbase x.c -O -version -o /usr/tmp/ccXbMDM2.s
GNU C version 2.2.2 compiled by GNU C version 2.2.2.
x.c: In function `InteriorBundleLUT_inq_entry_address':
x.c:1553: internal error--insn does not satisfy its constraints:
(insn 540 361 362 (parallel[ 
           (set (reg:TI 31)
               (reg:TI 14))
           (clobber (scratch:SI))
       ] ) 189 {movti+1} (nil)
   (nil))
gcc: Internal compiler error: program cc1 got fatal signal 6

The code follows 


/*renamed x.c*/
/*this is a preprocessed  mit/extensions/server/PEX/ddpex/mi/shared/miIntLUT.c
with line number command and blanks removed and some  functions removed*/
typedef unsigned long XID;
typedef XID Window;
typedef XID Drawable;
typedef XID Font;
typedef XID Pixmap;
typedef XID Cursor;
typedef XID Colormap;
typedef XID GContext;
typedef XID KeySym;
typedef unsigned long Mask;
typedef unsigned long Atom;
typedef unsigned long VisualID;
typedef unsigned long Time;
typedef unsigned char KeyCode;
typedef struct _Drawable *DrawablePtr;	
typedef struct _Pixmap *PixmapPtr;
typedef union _PixUnion {
    PixmapPtr		pixmap;
    unsigned long	pixel;
} PixUnion;
typedef struct _PixmapFormat *PixmapFormatPtr;
typedef struct _Visual *VisualPtr;
typedef struct _Depth  *DepthPtr;
typedef struct _Screen *ScreenPtr;
extern unsigned long globalSerialNumber;
extern unsigned long serverGeneration;
typedef long int ptrdiff_t;
typedef long unsigned int size_t;
typedef short unsigned int wchar_t;
typedef unsigned char *pointer;
typedef int Bool;
typedef unsigned long PIXEL;
typedef unsigned long ATOM;
typedef pointer	FID;
typedef struct _FontPathRec *FontPathPtr;
typedef struct _NewClientRec *NewClientPtr;
extern void	*memchr(const void *s, int c, size_t n);
extern void	*memcpy(void *s1, const void *s2, size_t n);
extern void	*memset(void *s, int c, size_t n);
extern size_t 	strcspn(const char *s1, const char *s2);
extern size_t	strlen(const char *s);
extern size_t	strspn(const char *s1, const char *s2);
extern void 	*memmove(void *s1, const void *s2, size_t n);
extern char 	*strcpy(char *s1, const char *s2);
extern char 	*strncpy(char *s1, const char *s2, size_t n);
extern char 	*strcat(char *s1, const char *s2);
extern char	*strncat(char *s1, const char *s2, size_t n);
extern int 	memcmp(const void *s1, const void *s2,size_t n);
extern int	strcmp(const char *s1, const char *s2);
extern int	strcoll(const char *s1, const char *s2);
extern int	strncmp(const char *s1,const char *s2,size_t n);
extern size_t 	strxfrm(char *s1, const char *s2, size_t n);
extern int	strncollen(const char *, const int );
extern char	*strchr(const char *s, int c);
extern char	*strpbrk(const char *s1, const char *s2);
extern char	*strrchr(const char *s, int c);
extern char	*strstr(const char *s1, const char *s2);
extern char 	*strtok(char *s1, const char *s2);
extern char 	*strerror(int errnum);
extern void	*memccpy(void *target, const void *source, int c, size_t n);
extern char     *index(const char *s, int c);
extern char     *rindex(const char *s, int c);
int		ReadRequestFromClient();
Bool		CloseDownConnection();
FontPathPtr	ExpandFontNamePattern();
FID		FiOpenForRead();
void		CreateWellKnownSockets();
int		SetDefaultFontPath();
void		FreeFontRecord();
int		SetFontPath();
void		ErrorF();
void		Error();
void		FatalError();
void		ProcessCommandLine();
void		Xfree();
void		FlushAllOutput();
void		FlushIfCriticalOutputPending();
unsigned long	*Xalloc();
unsigned long	*Xrealloc();
long		GetTimeInMillis();
extern void SwapLongs();
extern void SwapShorts();
typedef struct _DDXPoint *DDXPointPtr;
typedef struct _Box *BoxPtr;
extern unsigned long globalSerialNumber;
typedef struct _DDXPoint {
    short x, y;
} DDXPointRec;
typedef struct _Box {
    short x1, y1, x2, y2;
} BoxRec;
typedef union _DevUnion {
    pointer		ptr;
    long		val;
    unsigned long	uval;
} DevUnion;
typedef struct _Drawable {
    unsigned char	type;	 
    unsigned char	class;	 
    unsigned char	depth;
    unsigned char	bitsPerPixel;
    unsigned long	id;	 
    short		x;	 
    short		y;	 
    unsigned short	width;
    unsigned short	height;
    ScreenPtr		pScreen;
    unsigned long	serialNumber;
} DrawableRec;
typedef struct _Pixmap {
    DrawableRec		drawable;
    int			refcnt;
    int			devKind;
    DevUnion		devPrivate;
} PixmapRec;
typedef char    ddCHAR;
typedef short   ddSHORT;
typedef long    ddLONG;
typedef float   ddFLOAT;
typedef unsigned char   ddUCHAR;
typedef unsigned short  ddUSHORT;
typedef unsigned long   ddULONG;
typedef unsigned char    *ddPointer;
typedef unsigned char   ddBYTE;
typedef unsigned char   ddBOOL;
typedef struct {
	XID	id;
	ddPointer	deviceData;
} ddWKSResource;
typedef struct {
	XID	id;
	ddUSHORT	lutType;
	ddPointer	deviceData;
} ddLUTResource;
typedef ddWKSResource ddStructResource;
typedef ddWKSResource ddNSResource;
typedef ddWKSResource ddFontResource;
typedef ddWKSResource ddPMResource;
typedef ddWKSResource		*diWKSHandle;
typedef ddLUTResource		*diLUTHandle;
typedef ddStructResource	*diStructHandle;
typedef ddNSResource		*diNSHandle;
typedef ddFontResource		*diFontHandle;
typedef ddPMResource		*diPMHandle;
typedef ddPointer		diResourceHandle;
typedef ddULONG		ddBitmask;
typedef	ddUSHORT	ddBitmaskShort;
typedef	ddSHORT		ddEnumTypeIndex;
typedef	XID		ddResourceId;
typedef	ddBYTE		ddSwitch;
typedef	ddUSHORT	ddTableIndex;
typedef struct {
    ddFLOAT	x;
    ddFLOAT	y;
} ddVector2D;
typedef struct {
    ddFLOAT	x;
    ddFLOAT	y;
    ddFLOAT	z;
} ddVector3D;
typedef struct {
    ddFLOAT	x;
    ddFLOAT	y;
} ddCoord2D;
typedef struct {
    ddLONG	x;
    ddLONG	y;
} ddCoord2DL;
typedef struct {
    ddSHORT	x;
    ddSHORT	y;
} ddCoord2DS;
typedef struct {
    ddFLOAT	x;
    ddFLOAT	y;
    ddFLOAT	z;
} ddCoord3D;
typedef struct {
    ddLONG	x;
    ddLONG	y;
    ddLONG	z;
} ddCoord3DL;
typedef struct {
    ddSHORT	x;
    ddSHORT	y;
    ddSHORT	z;
} ddCoord3DS;
typedef struct {
    ddFLOAT	x;
    ddFLOAT	y;
    ddFLOAT	z;
    ddFLOAT	w;
} ddCoord4D;
typedef struct {
	ddSHORT		x;
	ddSHORT 	y;
	ddFLOAT 	z;
} ddDeviceCoord;
typedef struct {
	ddSHORT		xmin;
	ddSHORT		xmax;
	ddSHORT		ymin;
	ddSHORT		ymax;
} ddDeviceRect;
typedef struct {
        ddFLOAT         xmin;
        ddFLOAT         ymin;
        ddFLOAT         zmin;
        ddFLOAT         wmin;
        ddFLOAT         xmax;
        ddFLOAT         ymax;
        ddFLOAT         zmax;
        ddFLOAT         wmax;
} ddListBounds;
typedef struct {
    ddSHORT		approxMethod;
    ddUSHORT		unused;
    ddFLOAT		tolerance;
} ddCurveApprox;
typedef struct {
    ddSHORT		approxMethod;
    ddUSHORT		unused;
    ddFLOAT		uTolerance;
    ddFLOAT		vTolerance;
} ddSurfaceApprox;
typedef struct {
    ddUSHORT		vertical;
    ddUSHORT		horizontal;
} ddTextAlignmentData;
typedef struct {
    ddDeviceCoord	minval;
    ddDeviceCoord	maxval;
    ddUCHAR		useDrawable;
    ddBYTE		pad[3];
} ddViewport;
typedef struct {
    ddCoord3D	minval;
    ddCoord3D	maxval;
} ddNpcSubvolume;
typedef struct {
	ddUSHORT	clipFlags;
	ddUSHORT	unused;
	ddNpcSubvolume	clipLimits;
	ddFLOAT		orientation[4][4];
	ddFLOAT		mapping[4][4];
} ddViewEntry;
typedef struct {
	ddUSHORT	definableEntries;
	ddUSHORT	numPredefined;
	ddUSHORT	predefinedMin;
	ddUSHORT	predefinedMax;
} ddTableInfo;
typedef struct {
        diStructHandle    structure;	 
        ddULONG         offset;		 
} ddElementRef;
typedef struct {
        ddCoord4D       orig_point;	 
        ddCoord4D       point;
        ddVector3D      orig_vector;	 	
        ddVector3D      vector;		 
	ddFLOAT		dist;		 
} ddHalfSpace; 				
typedef struct {
        diStructHandle    structure;	 
        ddULONG         offset;		 
        ddULONG         pickid;
} ddPickPath;
typedef struct {
	ddUSHORT	elementType;
	ddUSHORT	length;
} ddElementInfo;
typedef struct {
    ddFLOAT	red;
    ddFLOAT	green;
    ddFLOAT	blue;
} ddRgbFloatColour;
typedef struct {
    ddFLOAT	hue;
    ddFLOAT	saturation;
    ddFLOAT	value;
} ddHsvColour;
typedef struct {
    ddFLOAT	hue;
    ddFLOAT	lightness;
    ddFLOAT	saturation;
} ddHlsColour;
typedef struct {
    ddFLOAT	x;
    ddFLOAT	y;
    ddFLOAT	z;
} ddCieColour;
typedef struct {
    ddUCHAR	red;
    ddUCHAR	green;
    ddUCHAR	blue;
    ddUCHAR	pad;
} ddRgb8Colour;
typedef struct {
    ddUSHORT	red;
    ddUSHORT	green;
    ddUSHORT	blue;
    ddUSHORT	pad;
} ddRgb16Colour;
typedef struct {
    ddUSHORT		index;
    ddUSHORT		pad;
} ddIndexedColour;
typedef struct {
    ddSHORT       colourType;
    ddSHORT       unused;
    union {
	ddIndexedColour        indexed;
	ddRgb8Colour           rgb8;
	ddRgb16Colour          rgb16;
	ddRgbFloatColour           rgbFloat;
	ddCieColour            cieFloat;
	ddHlsColour            hlsFloat;
	ddHsvColour            hsvFloat;
    }  colour;
} ddColourSpecifier;
typedef union {
	ddRgb8Colour           rgb8;
	ddRgb16Colour          rgb16;
	ddRgbFloatColour           rgbFloat;
	ddCieColour            cieFloat;
	ddHlsColour            hlsFloat;
	ddHsvColour            hsvFloat;
}  ddDirectColour;
typedef struct {
    ddFLOAT		ambient;
    ddFLOAT		diffuse;
    ddFLOAT		specular;
    ddFLOAT		specularConc;
    ddFLOAT		transmission;   
    ddColourSpecifier  specularColour;	    
} ddReflectionAttr;
typedef int ddpex4rtn;
typedef int ddpex43rtn;
typedef int ddpex3rtn;
typedef int ddpex2rtn;
typedef int ddpex1rtn;
typedef struct {
    ddULONG	bufSize;	 
    ddULONG	dataSize;	 
    ddPointer   pBuf;		 
    ddPointer   pHead;		 
} ddBuffer, *ddBufferPtr;
typedef enum {
        DD_ELEMENT_REF=0,
        DD_HALF_SPACE=1,
        DD_PICK_PATH=2,
        DD_RENDERER=3,
        DD_WKS=4,
        DD_NS=5,
	DD_STRUCT=6,
        DD_DEVICE_RECT=7,
	DD_NAME=8,
	DD_INDEX=9,
        DD_NUM_TYPES=10
} ddListType;
typedef struct {
        ddListType      type;
        ddLONG     numObj;
        ddLONG     misc;
        ddLONG     maxObj;
        ddPointer  pList;
} listofObj;
typedef	struct {
	ddUSHORT	placementType;
	ddUSHORT	numUcurves;
	ddUSHORT	numVcurves;
} ddPSC_IsoparametricCurves;
typedef	struct {
	ddCoord3D	origin;
	ddVector3D	direction;
	ddUSHORT	numberIntersections;
	ddCoord3D	*pPoints;
} ddPSC_LevelCurves;
typedef struct {
	ddEnumTypeIndex		type;
	union {
		char				none;
		char				impDep;
		ddPSC_IsoparametricCurves	isoCurves;	
		ddPSC_LevelCurves		mcLevelCurves;	
		ddPSC_LevelCurves		wcLevelCurves;
	} data;
} ddPSurfaceChars;
typedef struct {
	ddEnumTypeIndex		markerType;
	ddFLOAT			markerScale;
	ddColourSpecifier	markerColour;
	ddUSHORT		markerIndex;
	ddUSHORT		textFont;
	ddUSHORT		textPrecision;
	ddFLOAT			charExpansion;
	ddFLOAT			charSpacing;
	ddColourSpecifier	textColour;
	ddFLOAT			charHeight;
	ddVector2D		charUp;
	ddUSHORT		textPath;
	ddTextAlignmentData	textAlignment;
	ddFLOAT			atextHeight;
	ddVector2D		atextUp;
	ddUSHORT		atextPath;
	ddTextAlignmentData	atextAlignment;
	ddEnumTypeIndex		atextStyle;
	ddUSHORT		textIndex;
	ddEnumTypeIndex		lineType;
	ddFLOAT			lineWidth;
	ddColourSpecifier	lineColour;
	ddCurveApprox		curveApprox;
	ddEnumTypeIndex		lineInterp;
	ddUSHORT		lineIndex;
	ddEnumTypeIndex		intStyle;
	ddSHORT			intStyleIndex;
	ddColourSpecifier	surfaceColour;
	ddReflectionAttr	reflAttr;
	ddEnumTypeIndex		reflModel;
	ddEnumTypeIndex		surfInterp;
	ddEnumTypeIndex		bfIntStyle;
	ddSHORT			bfIntStyleIndex;
	ddColourSpecifier	bfSurfColour;
	ddReflectionAttr	bfReflAttr;
	ddEnumTypeIndex		bfReflModel;
	ddEnumTypeIndex		bfSurfInterp;
	ddSurfaceApprox		surfApprox;
	ddUSHORT		cullMode;
	ddBOOL			distFlag;
	ddCoord2D		patternSize;
	ddCoord3D		patternRefPt;
	ddVector3D		patternRefV1;
	ddVector3D		patternRefV2;
	ddUSHORT		intIndex;
	ddUSHORT		edges;
	ddEnumTypeIndex		edgeType;
	ddFLOAT			edgeWidth;
	ddColourSpecifier	edgeColour;
	ddUSHORT		edgeIndex;
	ddFLOAT			localMat[4][4];
	ddFLOAT			globalMat[4][4];
	ddUSHORT		modelClip;
	listofObj		*modelClipVolume;
	ddUSHORT		viewIndex;
	listofObj		*lightState;
	ddUSHORT		depthCueIndex;
	ddUSHORT		colourApproxIndex;
	ddSHORT			rdrColourModel;
	ddPSurfaceChars		psc;
	ddULONG			asfs;
	ddULONG			pickId;
	ddULONG			hlhsrType;
	diNSHandle		pCurrentNS;	 
} ddPCAttr;
typedef struct {
	ddULONG			PCid;
	listofObj		*rendRefs;
	ddPCAttr		*pPCAttr;
} ddPCStr, *ddPCPtr;
typedef	ddpex2rtn	(*ocTableType)();
typedef struct {
	ddBYTE		type;	 
	ddBYTE		class;	
	ddBYTE		depth;	
	ddBYTE		bitsPerPixel;	
	ddBYTE		rootDepth;
	ddULONG		rootVisual;
} ddDrawableInfo;
typedef enum {
	DD_HIGH_INCL_NS=0,
	DD_HIGH_EXCL_NS=1,
	DD_INVIS_INCL_NS=2,
	DD_INVIS_EXCL_NS=3,
	DD_MAX_FILTERS=4
} ddNSFilters; 
typedef struct {
	ddULONG 		rendId;		 
	ddPCPtr			pPC;		 
	ddDrawableInfo		drawExample;	 
	DrawablePtr		pDrawable;	 
	ddULONG			drawableId;	 
	listofObj		*curPath;	 
	ddUSHORT		state;		 
	diLUTHandle		lut[	12 +1]; 
	diNSHandle		ns[DD_MAX_FILTERS]; 
	ddSHORT			hlhsrMode;	 
	ddNpcSubvolume		npcSubvolume;
	ddViewport		viewport;
	listofObj		*clipList;	  
	ddBitmask		tablesMask;	 
	ddBitmask		namesetsMask;	 
	ddBitmask		attrsMask;	 
	ddBitmask		tablesChanges;	 
	ddBitmask		namesetsChanges; 
	ddBitmask		attrsChanges;	 
	ocTableType		executeOCs[		103 +1 ];	
	ddBOOL			immediateMode;
	ddUSHORT		render_mode;
	ddPointer		pDDContext;	 
} ddRendererStr, *ddRendererPtr;
typedef enum { 
	WORKSTATION_RESOURCE=0,
	STRUCTURE_RESOURCE=1,
	PARENT_STRUCTURE_RESOURCE=2,
	CHILD_STRUCTURE_RESOURCE=3,
	SEARCH_CONTEXT_RESOURCE=4,
	PICK_RESOURCE=5,
	LOOKUP_TABLE_RESOURCE=6,
	NAME_SET_RESOURCE=7,
	FONT_RESOURCE=8,
	RENDERER_RESOURCE=9,
	PIPELINE_CONTEXT_RESOURCE=10
} ddResourceType;
typedef enum {
	ADD=0,
	REMOVE=1
} ddAction;
typedef enum {
	X_WINDOW_RESOURCE=0,
	X_DRAWABLE_RESOURCE=1,
	X_FONT_RESOURCE=2,
	X_PIXMAP_RESOURCE=3,
	X_CURSOR_RESOURCE=4,
	X_COLORMAP_RESOURCE=5,
	X_GCONTEXT_RESOURCE=6,
	X_KEYSYM=7
} ddXResourceType;
typedef struct _Region *RegionPtr;
typedef struct _GCInterest *GCInterestPtr;
typedef struct _GC    *GCPtr;
extern void  ValidateGC();
extern int ChangeGC();
extern GCPtr CreateGC();
extern int CopyGC();
extern int FreeGC();
extern void SetGCMask();
extern GCPtr GetScratchGC();
extern void  FreeScratchGC();
typedef unsigned long	Pixel;
typedef struct _CMEntry *EntryPtr;
typedef struct _ColormapRec *ColormapPtr;
extern int CreateColormap();
extern int FindColor();
extern int FreeColormap();
extern int TellLostMap();
extern int TellGainedMap();
extern int IsMapInstalled();
extern void UninstallColormap();
typedef struct _PixmapFormat {
    unsigned char	depth;
    unsigned char	bitsPerPixel;
    unsigned char	scanlinePad;
    } PixmapFormatRec;
typedef struct _Visual {
    unsigned long	vid;
    short		class;
    short		bitsPerRGBValue;
    short		ColormapEntries;
    short		nplanes; 
    unsigned long	redMask, greenMask, blueMask;
    int			offsetRed, offsetGreen, offsetBlue;
  } VisualRec;
typedef struct _Depth {
    unsigned char	depth;
    short		numVids;
    unsigned long	*vids;     
  } DepthRec;
typedef struct _Screen {
    int			myNum;	 
    ATOM		id;
    short		width, height;
    short		mmWidth, mmHeight;
    short		numDepths;
    unsigned char      	rootDepth;
    DepthPtr       	allowedDepths;
    unsigned long      	rootVisual;
    unsigned long	defColormap;
    short		minInstalledCmaps, maxInstalledCmaps;
    char                backingStoreSupport, saveUnderSupport;
    unsigned long	whitePixel, blackPixel;
    unsigned long	rgf;	 
    GCPtr		GCperDepth[8 +1];
    PixmapPtr		PixmapPerDepth[1];
    pointer		devPrivate;
    short       	numVisuals;
    VisualPtr		visuals;
    int			WindowPrivateLen;
    unsigned		*WindowPrivateSizes;
    unsigned		totalWindowSize;
    int			GCPrivateLen;
    unsigned		*GCPrivateSizes;
    unsigned		totalGCSize;
    Bool (* CloseScreen)();		 
    void (* QueryBestSize)();		 
    Bool (* SaveScreen)();		 
    void (* GetImage)();		 
    void (* GetSpans)();		 
    void (* PointerNonInterestBox)();	 
    void (* SourceValidate)();		 
    Bool (* CreateWindow)();		 
    Bool (* DestroyWindow)();		 
    Bool (* PositionWindow)();		 
    Bool (* ChangeWindowAttributes)();	 
    Bool (* RealizeWindow)();		 
    Bool (* UnrealizeWindow)();		 
    int  (* ValidateTree)();		 
    void (* PostValidateTree)();	 
    void (* WindowExposures)();        
    void (* PaintWindowBackground)();	 
    void (* PaintWindowBorder)();	 
    void (* CopyWindow)();		 
    void (* ClearToBackground)();	 
    void (* ClipNotify)();               
    PixmapPtr (* CreatePixmap)(); 	 
    Bool (* DestroyPixmap)();		 
    void (* SaveDoomedAreas)();		 
    RegionPtr (* RestoreAreas)();	 
    void (* ExposeCopy)();		 
    RegionPtr (* TranslateBackingStore)(); 
    RegionPtr (* ClearBackingStore)();	 
    void (* DrawGuarantee)();		 
    Bool (* RealizeFont)();		 
    Bool (* UnrealizeFont)();		 
    void (* ConstrainCursor)();   	 
    void (* CursorLimits)();		 
    Bool (* DisplayCursor)();		 
    Bool (* RealizeCursor)();		 
    Bool (* UnrealizeCursor)();		 
    void (* RecolorCursor)();		 
    Bool (* SetCursorPosition)();	 
    Bool (* CreateGC)();		 
    Bool (* CreateColormap)();		 
    void (* DestroyColormap)();		 
    void (* InstallColormap)();		 
    void (* UninstallColormap)();	 
    int (* ListInstalledColormaps) (); 	 
    void (* StoreColors)();		 
    void (* ResolveColor)();		 
    RegionPtr (* RegionCreate)(); 	 
    void (* RegionInit)();		 
    Bool (* RegionCopy)();		 
    void (* RegionDestroy)();		 
    void (* RegionUninit)();		 
    Bool (* Intersect)();		 
    Bool (* Union)();			 
    Bool (* Subtract)();		 
    Bool (* Inverse)();			 
    void (* RegionReset)();		 
    void (* TranslateRegion)();		 
    int (* RectIn)();			 
    Bool (* PointInRegion)();		 
    Bool (* RegionNotEmpty)();      	 
    void (* RegionEmpty)();        	 
    BoxPtr (* RegionExtents)(); 	 
    Bool (* RegionAppend)();		 
    Bool (* RegionValidate)();		 
    RegionPtr (* BitmapToRegion)();	 
    RegionPtr (* RectsToRegion)();	 
    void (* SendGraphicsExpose)();	 
    void (* BlockHandler)();		 
    void (* WakeupHandler)();		 
    pointer blockData;
    pointer wakeupData;
    DevUnion	*devPrivates;
} ScreenRec;
typedef struct _ScreenInfo {
    int		imageByteOrder;
    int		bitmapScanlineUnit;
    int		bitmapScanlinePad;
    int		bitmapBitOrder;
    int		numPixmapFormats;
    PixmapFormatRec
		formats[8 ];
    int		arraySize;
    int		numScreens;
    ScreenPtr	screens[3 ];
} ScreenInfo;
extern ScreenInfo screenInfo;
extern int AllocateWindowPrivateIndex(), AllocateGCPrivateIndex();
extern Bool AllocateWindowPrivate(), AllocateGCPrivate();
typedef void	(*destroyTableType)();
extern int PexErrorBase;
typedef struct {
	ddEnumTypeIndex index;
	char            *name;
} miEnumType;
typedef enum {
	VIEW_REP_DYNAMIC=0,
	MARKER_BUNDLE_DYNAMIC=1,
	TEXT_BUNDLE_DYNAMIC=2,
	LINE_BUNDLE_DYNAMIC=3,
	INTERIOR_BUNDLE_DYNAMIC=4,
	EDGE_BUNDLE_DYNAMIC=5,
	COLOUR_TABLE_DYNAMIC=6,
	PATTERN_TABLE_DYNAMIC=7,
	WKS_TRANSFORM_DYNAMIC=8,
	HIGH_FILTER_DYNAMIC=9,
	INVIS_FILTER_DYNAMIC=10,
	HLHSR_MODE_DYNAMIC=11,
	STR_MODIFY_DYNAMIC=12,
	POST_STR_DYNAMIC=13,
	UNPOST_STR_DYNAMIC=14,
	DELETE_STR_DYNAMIC=15,
	REF_MODIFY_DYNAMIC=16,
	BUFFER_MODIFY_DYNAMIC=17,
	LIGHT_TABLE_DYNAMIC=18,
	DEPTH_CUE_DYNAMIC=19,
	COLOUR_APPROX_TABLE_DYNAMIC=20,
	MAX_DYNAMIC = 21
} ddDynamic;
typedef struct {
    ddEnumTypeIndex	lineType;
    ddEnumTypeIndex	polylineInterp;
    ddCurveApprox	curveApprox;
    ddFLOAT		lineWidth;	 
    ddColourSpecifier	lineColour;	    
} ddLineBundleEntry;
typedef struct {
    ddEnumTypeIndex	markerType;
    ddSHORT		unused;
    ddFLOAT		markerScale;	 
    ddColourSpecifier	markerColour;	    
} ddMarkerBundleEntry;
typedef struct {
    ddUSHORT		textFontIndex;
    ddUSHORT		textPrecision;
    ddFLOAT		charExpansion;
    ddFLOAT		charSpacing;
    ddColourSpecifier	textColour;	    
} ddTextBundleEntry;
typedef struct {
    ddEnumTypeIndex    interiorStyle;
    ddSHORT	    interiorStyleIndex;
    ddEnumTypeIndex    reflectionModel;
    ddEnumTypeIndex    surfaceInterp;
    ddEnumTypeIndex    bfInteriorStyle;
    ddSHORT	    bfInteriorStyleIndex;
    ddEnumTypeIndex    bfReflectionModel;
    ddEnumTypeIndex    bfSurfaceInterp;
    ddSurfaceApprox	surfaceApprox;
    ddColourSpecifier	surfaceColour; 
    ddReflectionAttr	reflectionAttr; 
    ddColourSpecifier	bfSurfaceColour;
    ddReflectionAttr	bfReflectionAttr;
} ddInteriorBundleEntry;
typedef struct {
    ddSwitch		edges;
    ddUCHAR		unused;
    ddEnumTypeIndex	edgeType;
    ddFLOAT		edgeWidth;	 
    ddColourSpecifier	edgeColour;	    
} ddEdgeBundleEntry;
typedef struct {
    ddSHORT		colourType; 
    ddUSHORT		numx;
    ddUSHORT		numy;
    ddUSHORT		unused;
    union {
	ddIndexedColour	*indexed;
	ddRgb8Colour	*rgb8;
	ddRgb16Colour	*rgb16;
	ddRgbFloatColour	*rgbFloat;
	ddHsvColour	*hsvFloat;
	ddHlsColour	*hlsFloat;
	ddCieColour	*cieFloat;
   }			colours;
} ddPatternEntry;
typedef struct {
    ddULONG		numFonts;
    diFontHandle        fonts[   16 ];     
} ddTextFontEntry;
typedef struct {
    ddEnumTypeIndex	lightType;
    ddSHORT		unused;
    ddVector3D		direction;
    ddCoord3D		point;
    ddFLOAT		concentration;
    ddFLOAT		spreadAngle;
    ddFLOAT		attenuation1;
    ddFLOAT		attenuation2;
    ddColourSpecifier	lightColour;	    
} ddLightEntry;
typedef struct {
    ddUCHAR		mode;
    ddUCHAR		unused;
    ddUSHORT		unused2;
    ddFLOAT		frontPlane;
    ddFLOAT		backPlane;
    ddFLOAT		frontScaling;
    ddFLOAT		backScaling;
    ddColourSpecifier	depthCueColour;	    
} ddDepthCueEntry;
typedef struct {
    ddEnumTypeIndex	approxType;
    ddEnumTypeIndex	approxModel;
    ddUSHORT	max1;
    ddUSHORT	max2;
    ddUSHORT	max3;
    ddUCHAR	dither;
    ddUCHAR	unused;
    ddULONG	mult1;
    ddULONG	mult2;
    ddULONG	mult3;
    ddFLOAT	weight1;
    ddFLOAT	weight2;
    ddFLOAT	weight3;
    ddULONG	basePixel;
} ddColourApproxEntry;
typedef struct {
        ddUSHORT                status;
	ddTableIndex            index;
} miTableEntry;
typedef struct _miLineBundleEntry {
	miTableEntry		entry_info;
	ddLineBundleEntry	entry;		 
	ddLineBundleEntry	real_entry;	 
} miLineBundleEntry;
typedef struct _miMarkerBundleEntry {
	miTableEntry		entry_info;
	ddMarkerBundleEntry	entry;		 
	ddMarkerBundleEntry	real_entry;	 
} miMarkerBundleEntry;
typedef struct _miTextBundleEntry {
	miTableEntry		entry_info;
	ddTextBundleEntry	entry;		 
	ddTextBundleEntry	real_entry;	 
} miTextBundleEntry;
typedef struct _miInteriorBundleEntry {
	miTableEntry		entry_info;
	ddInteriorBundleEntry	entry;		 
	ddInteriorBundleEntry	real_entry;	 
} miInteriorBundleEntry;
typedef struct _miEdgeBundleEntry {
	miTableEntry		entry_info;
	ddEdgeBundleEntry	entry;		 
	ddEdgeBundleEntry	real_entry;	 
} miEdgeBundleEntry;
typedef struct _miPatternEntry {
	miTableEntry		entry_info;
	ddPatternEntry		entry;		 
} miPatternEntry;
typedef struct _miTextFontEntry {
	miTableEntry		entry_info;
	ddTextFontEntry		entry;		 
} miTextFontEntry;
typedef struct _miColourEntry {
	miTableEntry		entry_info;
	ddColourSpecifier	entry;		 
} miColourEntry;
typedef struct _miViewEntry {
	miTableEntry		entry_info;
	ddViewEntry		entry;		 
	ddFLOAT			vom[4][4];	 
	ddFLOAT			vom_inv[4][4];	 
	ddBOOL			inv_flag;	 
} miViewEntry;
typedef struct _miLightEntry {
	miTableEntry		entry_info;
	ddLightEntry		entry;		 
    	double			cosSpreadAngle;	 
} miLightEntry;
typedef struct _miDepthCueEntry {
	miTableEntry		entry_info;
	ddDepthCueEntry		entry;		 
} miDepthCueEntry;
typedef struct _miColourApproxEntry {
	miTableEntry		entry_info;
	ddColourApproxEntry	entry;		 
} miColourApproxEntry;
typedef	ddpex43rtn		(*miOpsTableType)();
typedef struct _miLUTHeader {
	ddDrawableInfo		drawExample;
	ddSHORT			drawType;
	ddUSHORT		startIndex;
	ddUSHORT		defaultIndex;
	ddUSHORT		numDefined;
	ddTableInfo		tableInfo;
	listofObj		*wksRefList;
	listofObj		*rendRefList;
	ddBOOL			freeFlag;
	union {		
		miLineBundleEntry	*line;
		miMarkerBundleEntry	*marker;
		miTextBundleEntry	*text;
		miInteriorBundleEntry	*interior;
		miEdgeBundleEntry	*edge;
		miPatternEntry		*pattern;
		miTextFontEntry		*font;
		miColourEntry		*colour;
		miViewEntry		*view;
		miLightEntry		*light;
		miDepthCueEntry		*depthCue;
		miColourApproxEntry 	*colourApprox;
	 } plut;
	miOpsTableType		ops[(	13   - 	 4   + 1 + 6 ) ];
} miLUTHeader;
typedef struct {
	DrawablePtr     pDrawable;
	Drawable		drawableId;
	diLUTHandle     pMarkerLUT;         
	diLUTHandle     pTextLUT;
	diLUTHandle     pLineLUT;
	diLUTHandle     pIntLUT;
	diLUTHandle     pEdgeLUT;
	diLUTHandle     pColourLUT;
	diLUTHandle     pDepthCueLUT;
	diLUTHandle     pLightLUT;
	diLUTHandle     pColourAppLUT;
	diLUTHandle     pPatternLUT;
	diLUTHandle     pFontLUT;
	diNSHandle      pHighInclSet;
	diNSHandle      pHighExclSet;
	diNSHandle      pInvisInclSet;
	diNSHandle      pInvisExclSet;
	ddEnumTypeIndex	bufferMode;
} ddWksInit;
typedef struct {
	ddBYTE	viewRep;
	ddBYTE	markerBundle;
	ddBYTE	textBundle;
	ddBYTE	lineBundle;
	ddBYTE	interiorBundle;
	ddBYTE	edgeBundle;
	ddBYTE	colourTable;
	ddBYTE	patternTable;
	ddBYTE	wksTransform;
	ddBYTE	highlightFilter;
	ddBYTE	invisFilter;
	ddBYTE	hlhsrMode;
	ddBYTE	strModify;
	ddBYTE	postStr;
	ddBYTE	unpostStr;
	ddBYTE	deleteStr;
	ddBYTE	refModify;
	ddBYTE	bufferModify;
	ddBYTE	lightTable;
	ddBYTE	depthCueTable;
	ddBYTE	colourApproxTable;
} ddWksDynamics;
typedef struct {
	diNSHandle	incl;
	diNSHandle	excl;
} ddNSPair;
typedef struct {
	ddULONG		numPairs;
	ddULONG		maxPairs;
	ddNSPair 	*pPairs;
} listofNSPair;
typedef struct {
	ddULONG		    id;
	ddUSHORT            status;
	ddCoord3D	    position;		 
	ddFLOAT		    distance;		 	
	ddUSHORT	    ceiling;		 
	ddBOOL		    modelClipFlag;	 
	listofObj	    *startPath;		 
	listofNSPair	    normal;
	listofNSPair	    inverted;
} ddSCStr;
typedef struct {
	ddTableIndex	index;
	ddUSHORT	unused;
	ddViewEntry	view;
} ddViewRep;
typedef struct {
	ddUSHORT	whence;
	ddUSHORT	unused;
	ddLONG		offset;
} ddElementPos;
typedef struct {
	ddElementPos	position1;
	ddElementPos	position2;
} ddElementRange;
typedef struct {
        ddSHORT		x;
        ddSHORT		y;
} ddDeviceCoord2D;
typedef struct {
	ddDeviceCoord2D	position;
	ddFLOAT         distance;
} ddPC_DC_HitBox;
typedef  ddNpcSubvolume ddPC_NPC_HitVolume;
typedef ddULONG	ddNamePiece;
typedef ddNamePiece	*ddNamePtr;
typedef struct _miNSHeader {
	listofObj		*wksRefList;
	listofObj		*rendRefList;
	ddULONG			refCount;	 
	ddULONG			nameCount;
	ddNamePiece		names[ ((255  - 0  +1)  / (sizeof(ddNamePiece) * 8) )  ];
	ddBOOL			freeFlag; 
} miNSHeader;
typedef struct {
    ddEnumTypeIndex	    type;	 
    ddUSHORT                status;	 
    listofObj  		    *path;	 
    ddUSHORT                pathOrder;
    diNSHandle              inclusion;
    diNSHandle              exclusion;
    union {
    	char    dc_data_rec;	  
    	char    npc_data_rec; 	 
    }	data_rec;	 
    ddEnumTypeIndex         pet;
    ddViewport              echoVolume;
    ddUSHORT                echoSwitch;
    ddPointer		    devPriv;
} miPickDevice;
typedef struct {
	diWKSHandle	    pWks;	
	ddEnumTypeIndex	    type;	 
	ddUSHORT	    status;	 
	listofObj	   *path;	 
	ddUSHORT            pathOrder;
    diNSHandle              incl_handle;
    diNSHandle              excl_handle;
	union {
		char    dc_data_rec; 
		char    npc_data_rec; 
	}	data_rec;
	union {
		ddPC_DC_HitBox		dc_hit_box;
		ddPC_NPC_HitVolume	npc_hit_volume;
	} input_rec;
    ddPointer		    devPriv;
} miPickMeasureStr;
typedef struct _ddOrdStruct {
	diStructHandle	pstruct;
	ddFLOAT	priority;
	struct _ddOrdStruct	*next;
} ddOrdStruct;
typedef struct {
	ddULONG		numStructs;
	ddOrdStruct	*postruct;	 
} listofOrdStruct;
typedef struct _ddOrdView {
	short		defined;
	ddUSHORT	first_view;	 
	ddUSHORT	last_view;	 
	struct _ddOrdView *higher;	 
	struct _ddOrdView *lower;	 
} ddOrdView;
typedef struct {
	ddULONG		defined_views;	 
	ddOrdView	*highest;	 
	ddOrdView	*lowest;	 
	ddOrdView	*free;		 
	ddOrdView	entries[( 6	 * 2 + 3) ];
} listofOrdView;
typedef struct _miWks {
	ddEnumTypeIndex		displayUpdate;
	ddBYTE			visualState;
	ddBYTE			displaySurface;
	ddBYTE			viewUpdate;
	listofOrdView	views;
	diLUTHandle		reqViewTable;
	ddULONG			deltaviewMask;
	ddBYTE			wksUpdate;
	ddBYTE			wksMask;
	ddNpcSubvolume		reqNpcSubvolume;
	ddViewport		reqviewport;
	ddBYTE			hlhsrUpdate;
	ddEnumTypeIndex		reqhlhsrMode;
	ddRendererPtr		pRend;
	ddBYTE			bufferUpdate;
	ddUSHORT	    	curBufferMode;
	ddUSHORT	    	reqBufferMode;
	listofOrdStruct		postedStructs;
	ddBYTE			dynamics[MAX_DYNAMIC];
	ddBOOL			freeFlag;
	ddLONG			refCount;
	miPickDevice		devices[2  ];
	listofObj		*pwksList;
} miWksStr, *miWksPtr;
typedef int ErrorCode;
typedef long           INT32;
typedef short          INT16;
typedef signed char    INT8;
typedef unsigned long CARD32;
typedef unsigned short CARD16;
typedef unsigned char  CARD8;
typedef unsigned long		BITS32;
typedef unsigned short		BITS16;
typedef unsigned char		BYTE;
typedef unsigned char            BOOL;
typedef float PEXFLOAT;
typedef CARD32  pexAsfAttribute;
typedef CARD8	pexAsfValue;
typedef CARD32	pexBitmask;
typedef CARD16	pexBitmaskShort;
typedef CARD16  pexCoordType; 	 
typedef CARD16	pexComposition;
typedef CARD16	pexCullMode;
typedef BYTE 	pexDynamicType;
typedef INT16	pexEnumTypeIndex;
typedef XID 	pexLookupTable;
typedef CARD32 	pexName;
typedef XID 	pexNameSet;
typedef XID	pexPC;
typedef XID	pexFont;
typedef PEXFLOAT	pexMatrix[4][4];
typedef PEXFLOAT 	pexMatrix3X3[3][3];
typedef XID	pexPhigsWks;
typedef XID	pexPickMeasure;
typedef XID	pexRenderer;
typedef XID	pexSC;
typedef XID	pexStructure;
typedef CARD8	pexSwitch;
typedef CARD16	pexTableIndex;
typedef CARD16	pexTableType;	 
typedef CARD16	pexTextHAlignment;
typedef CARD16	pexTextVAlignment;
typedef CARD16	pexTypeOrTableIndex;
typedef pexEnumTypeIndex	pexColourType; 	 
typedef struct {
    CARD16	length  ;
} pexString;
typedef struct {
    pexStructure	sid  ;
    PEXFLOAT		priority;
} pexStructureInfo;
typedef struct {
    PEXFLOAT	x;
    PEXFLOAT	y;
} pexVector2D;
typedef struct {
    PEXFLOAT	x;
    PEXFLOAT	y;
    PEXFLOAT	z;
} pexVector3D;
typedef struct {
    PEXFLOAT	x;
    PEXFLOAT	y;
} pexCoord2D;
typedef struct {
    PEXFLOAT	x;
    PEXFLOAT	y;
    PEXFLOAT	z;
} pexCoord3D;
typedef struct {
    PEXFLOAT	x;
    PEXFLOAT	y;
    PEXFLOAT	z;
    PEXFLOAT	w;
} pexCoord4D;
typedef struct {
    PEXFLOAT	red;
    PEXFLOAT	green;
    PEXFLOAT	blue;
} pexRgbFloatColour;
typedef struct {
    PEXFLOAT	hue;
    PEXFLOAT	saturation;
    PEXFLOAT	value;
} pexHsvColour;
typedef struct {
    PEXFLOAT	hue;
    PEXFLOAT	lightness;
    PEXFLOAT	saturation;
} pexHlsColour;
typedef struct {
    PEXFLOAT	x;
    PEXFLOAT	y;
    PEXFLOAT	z;
} pexCieColour;
typedef struct {
    CARD8	red;
    CARD8	green;
    CARD8	blue;
    CARD8	pad;
} pexRgb8Colour;
typedef struct {
    CARD16	red  ;
    CARD16	green  ;
    CARD16	blue  ;
    CARD16	pad  ;
} pexRgb16Colour;
typedef struct {
    pexTableIndex	index  ;
    CARD16		pad  ;
} pexIndexedColour;
typedef struct {
    union {
	pexIndexedColour	indexed;
	pexRgb8Colour		rgb8;
	pexRgb16Colour		rgb16;
	pexRgbFloatColour	rgbFloat;
	pexHsvColour		hsvFloat;
	pexHlsColour		hlsFloat;
	pexCieColour		cieFloat;
    } format;
} pexColour;
typedef struct {
    PEXFLOAT   first;
    PEXFLOAT   second;
    PEXFLOAT   third;
} pexFloatColour;
typedef struct {
    pexColourType	colourType  ;	 
    CARD16		unused  ;
} pexColourSpecifier;
typedef struct {
    pexEnumTypeIndex	approxMethod  ;
    CARD16		unused  ;
    PEXFLOAT		tolerance;
} pexCurveApprox;
typedef struct {
    INT16	x  ;
    INT16 	y  ;
    PEXFLOAT 	z;
} pexDeviceCoord;
typedef struct {
    INT16	x  ;
    INT16 	y  ;
} pexDeviceCoord2D;
typedef struct {
    INT16	xmin  ;
    INT16	ymin  ;
    INT16	xmax  ;
    INT16	ymax  ;
} pexDeviceRect;
typedef struct {
    CARD16	elementType  ;
    CARD16	length  ;
} pexElementInfo;
typedef struct {
    CARD16	whence  ;
    CARD16	unused  ;
    INT32	offset  ;
} pexElementPos;
typedef struct {
    pexElementPos	position1;
    pexElementPos	position2;
} pexElementRange;
typedef struct {
    pexStructure	structure  ;
    CARD32		offset  ;
} pexElementRef;
typedef struct {
	pexCoord2D lowerLeft;
	pexCoord2D upperRight;
	pexCoord2D concatpoint;
} pexExtentInfo;
typedef struct {
    pexEnumTypeIndex	index  ;
    pexString		descriptor;
} pexEnumTypeDesc;
typedef struct {
    pexCoord3D	point;
    pexVector3D	vector;
} pexHalfSpace;
typedef struct {
    pexNameSet	incl;
    pexNameSet	excl;
} pexNameSetPair;
typedef struct {
    pexCoord2D	point;
    pexVector2D	vector;
} pexHalfSpace2D;
typedef struct {
    CARD16	composition  ;
    CARD16	unused  ;
    pexMatrix	matrix;
} pexLocalTransform3DData;
typedef struct {
    CARD16		composition  ;
    CARD16		unused  ;
    pexMatrix3X3	matrix;
} pexLocalTransform2DData;
typedef struct {
    pexCoord3D	minval;
    pexCoord3D	maxval;
} pexNpcSubvolume;
typedef struct {
    pexStructure	sid  ;
    CARD32		offset  ;
    CARD32		pickid  ;
} pexPickPath;
typedef struct {
    pexTextVAlignment		vertical  ;
    pexTextHAlignment		horizontal  ;
} pexTextAlignmentData;
typedef struct {
    pexSwitch		visibility;
    CARD8		unused;
    CARD16		order  ;
    pexCoordType	type  ;
    INT16		approxMethod  ;
    PEXFLOAT		tolerance;
    PEXFLOAT		tMin;
    PEXFLOAT		tMax;
    CARD32		numKnots  ;
    CARD32		numCoord  ;
} pexTrimCurve;
typedef struct {
    PEXFLOAT		ambient;
    PEXFLOAT		diffuse;
    PEXFLOAT		specular;
    PEXFLOAT		specularConc;
    PEXFLOAT		transmission;   
    pexColourSpecifier  specularColour;
} pexReflectionAttr;
typedef struct {
    pexEnumTypeIndex	approxMethod  ;
    CARD16		unused  ;
    PEXFLOAT		uTolerance;
    PEXFLOAT		vTolerance;
} pexSurfaceApprox;
typedef struct {
    pexCoord3D	point;
} pexVertex;
typedef struct {
    pexDeviceCoord	minval;
    pexDeviceCoord	maxval;
    pexSwitch		useDrawable;
    BYTE		pad[3];
} pexViewport;
typedef struct {
    CARD16		clipFlags  ;
    CARD16		unused  ;
    pexNpcSubvolume	clipLimits;
    pexMatrix		orientation;
    pexMatrix		mapping;
} pexViewEntry;
typedef struct {
    pexTableIndex	index  ;
    CARD16		unused  ;
    pexViewEntry	view;
} pexViewRep;
typedef struct {
    CARD16	definableEntries  ;
    CARD16	numPredefined  ;
    CARD16	predefinedMin  ;
    CARD16	predefinedMax  ;
} pexTableInfo;
typedef struct {
    pexEnumTypeIndex	lineType  ;
    pexEnumTypeIndex	polylineInterp  ;
    pexCurveApprox	curveApprox;
    PEXFLOAT		lineWidth;
    pexColourSpecifier	lineColour;
} pexLineBundleEntry;
typedef struct {
    pexEnumTypeIndex	markerType  ;
    INT16		unused  ;
    PEXFLOAT		markerScale;
    pexColourSpecifier	markerColour;
} pexMarkerBundleEntry;
typedef struct {
    CARD16		textFontIndex  ;
    CARD16		textPrecision  ;
    PEXFLOAT		charExpansion;
    PEXFLOAT		charSpacing;
    pexColourSpecifier	textColour;
} pexTextBundleEntry;
typedef struct {
    pexEnumTypeIndex    interiorStyle  ;
    INT16		interiorStyleIndex  ;
    pexEnumTypeIndex    reflectionModel  ;
    pexEnumTypeIndex    surfaceInterp  ;
    pexEnumTypeIndex    bfInteriorStyle  ;
    INT16		bfInteriorStyleIndex  ;
    pexEnumTypeIndex    bfReflectionModel  ;
    pexEnumTypeIndex    bfSurfaceInterp  ;
    pexSurfaceApprox    surfaceApprox;
} pexInteriorBundleEntry;
typedef struct {
    pexSwitch		edges;
    CARD8		unused;
    pexEnumTypeIndex	edgeType  ;
    PEXFLOAT		edgeWidth;
    pexColourSpecifier	edgeColour;
} pexEdgeBundleEntry;
typedef struct {
    pexColourType	colourType  ; 
    CARD16		numx  ;
    CARD16		numy  ;
    CARD16		unused  ;
} pexPatternEntry;
typedef struct {
    CARD32	numFonts  ;
} pexTextFontEntry;
typedef struct {
    pexEnumTypeIndex	lightType  ;
    INT16		unused  ;
    pexVector3D		direction;
    pexCoord3D		point;
    PEXFLOAT		concentration;
    PEXFLOAT		spreadAngle;
    PEXFLOAT		attenuation1;
    PEXFLOAT		attenuation2;
    pexColourSpecifier	lightColour;
} pexLightEntry;
typedef struct {
    pexSwitch		mode;
    CARD8		unused;
    CARD16		unused2  ;
    PEXFLOAT		frontPlane;
    PEXFLOAT		backPlane;
    PEXFLOAT		frontScaling;
    PEXFLOAT		backScaling;
    pexColourSpecifier	depthCueColour;
} pexDepthCueEntry;
typedef struct {
    INT16	approxType;
    INT16	approxModel;
    CARD16	max1  ;
    CARD16	max2  ;
    CARD16	max3  ;
    CARD8	dither;
    CARD8	unused;
    CARD32	mult1  ;
    CARD32	mult2  ;
    CARD32	mult3  ;
    PEXFLOAT	weight1;
    PEXFLOAT	weight2;
    PEXFLOAT	weight3;
    CARD32	basePixel  ;
} pexColourApproxEntry;
typedef struct {
    Atom	name  ;
    CARD32	value  ;
} pexFontProp;
typedef struct {
    CARD32	firstGlyph  ;
    CARD32	lastGlyph  ;
    CARD32	defaultGlyph  ;
    pexSwitch	allExist;
    pexSwitch	strokeFont;
    CARD16	unused  ;
    CARD32	numProps  ;
} pexFontInfo;
typedef struct {
    INT16	characterSet  ;
    CARD8	characterSetWidth;
    CARD8	encodingState;
    CARD16	unused  ;
    CARD16	numChars;
} pexMonoEncoding;
typedef struct {
    CARD16	placementType  ;
    CARD16	unused  ;
    CARD16	numUcurves  ;
    CARD16	numVcurves  ;
} pexPSC_IsoparametricCurves;		 
typedef struct {
    pexCoord3D	    origin;
    pexVector3D	    direction;
    CARD16	    numberIntersections  ;
    CARD16	    pad  ;
} pexPSC_LevelCurves;			 
typedef struct {
    pexDeviceCoord2D	position;
    PEXFLOAT		distance;
} pexPD_DC_HitBox;				 
typedef pexNpcSubvolume pexPD_NPC_HitVolume;	 
typedef struct {
    CARD8	type;		     
    CARD8	errorCode;	     
    CARD16	sequenceNumber  ;
    CARD32	resourceId  ;	     
    CARD16	minorCode  ;
    CARD8	majorCode;
    CARD8	unused;
    CARD16	opcode  ;	     
    CARD16	numCommands  ;     
    BYTE	pad[16];
} pexOutputCommandError;
typedef struct {
    pexEnumTypeIndex    interiorStyle;
    INT16               interiorStyleIndex;
    pexEnumTypeIndex    reflectionModel;
    pexEnumTypeIndex    surfaceInterp;
    pexEnumTypeIndex    bfInteriorStyle;
    INT16               bfInteriorStyleIndex;
    pexEnumTypeIndex    bfReflectionModel;
    pexEnumTypeIndex    bfSurfaceInterp;
    pexSurfaceApprox    surfaceApprox;
    pexColourSpecifier  surfaceColour;
    pexIndexedColour	index1;
    pexReflectionAttr   reflectionAttr;
    pexIndexedColour	index2;
    pexColourSpecifier  bfSurfaceColour;
    pexIndexedColour	index3;
    pexReflectionAttr   bfReflectionAttr;
    pexIndexedColour	index4;
} bogus_pexInteriorBundleEntry;
extern	unsigned	colour_type_sizes[];	 
static	ddInteriorBundleEntry 	pdeInteriorBundleEntry[    1 ];
extern listofObj  *puCreateList();
extern void	puDeleteList();
extern short	puInList();
extern short	puAddToList();
extern short	puRemoveFromList();
extern short	puCopyList();
extern short	puMergeLists();
extern int	puBuffRealloc();
extern void	puInitList();
extern int	puCountList();
extern ddpex4rtn miDealWithDynamics();	 
extern  ddpex43rtn      FreeLUT();
extern  ddpex43rtn      InquireLUTPredEntries();
extern  ddpex43rtn      InquireLUTEntries();
static miInteriorBundleEntry 	def_entry;
ddpex43rtn
InteriorBundleLUT_inq_entry_address  (LUTtype, pLUT, index,  pStatus, ppEntry)
    ddUSHORT            LUTtype;   
    diLUTHandle         pLUT;	   
    ddTableIndex        index;	   
    ddUSHORT           *pStatus;   
    ddPointer         *ppEntry;   
{
    miLUTHeader		*pheader;
    miInteriorBundleEntry 	*pentry, *plast;
    pentry = ((void *)0) ;			
    if (!pLUT) 
    {
	(&def_entry)->entry = pdeInteriorBundleEntry[0 ] ;	(&def_entry)->real_entry = pdeInteriorBundleEntry[0 ]  ;
	*ppEntry = (ddPointer)&def_entry;		
    	return (	   0	);
    }
    pheader = ((miLUTHeader *)(pLUT)->deviceData) ;
    pentry = (pheader)->plut.interior  + (pheader)->startIndex  ;
    plast = pentry + (pheader)->tableInfo.definableEntries ;
    while ( (( pentry) < ( plast)) && ((index) != ( pentry)->entry_info.index) )	( pentry)++;	if (( pentry) == ( plast))	 pentry = ((void *)0) ;	else if ((index) != ( pentry)->entry_info.index)	 pentry = ((void *)0)  ;
    if ((pentry == ((void *)0) ) || (pentry->entry_info.status == 0 ))
    {
	*pStatus = 0 ;
    	pentry = (pheader)->plut.interior  + (pheader)->startIndex  ;
	while ( (( pentry) < ( plast)) && (((pheader)->defaultIndex ) != ( pentry)->entry_info.index) )	( pentry)++;	if (( pentry) == ( plast))	 pentry = ((void *)0) ;	else if (((pheader)->defaultIndex ) != ( pentry)->entry_info.index)	 pentry = ((void *)0)  ;
	if (pentry == ((void *)0) )
 	{
		(&def_entry)->entry = pdeInteriorBundleEntry[0 ] ;	(&def_entry)->real_entry = pdeInteriorBundleEntry[0 ]  ;
		*ppEntry = (ddPointer)&def_entry;
	}
	else if (pentry->entry_info.status == 0 )
		{
			(&def_entry)->entry = pdeInteriorBundleEntry[0 ] ;	(&def_entry)->real_entry = pdeInteriorBundleEntry[0 ]  ;
			*ppEntry = (ddPointer)&def_entry;
		}
		else		 
			*ppEntry = (ddPointer)pentry;
    } else	 
    {
	*pStatus = 1 ;
	*ppEntry = (ddPointer)pentry;
    }
    return (	   0	);
}


	Kent S. Gordon