🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

1 total messages Started by Tim Theisen Mon, 31 Aug 1992 16:53
Internal compiler error on hppa1.1-bsd.
#1034
Author: Tim Theisen
Date: Mon, 31 Aug 1992 16:53
1706 lines
49426 bytes
gcc 2.2.2 encounters and internal compiler error when invoked as follows:

$ gcc -v -c -O2 spinfo.c
Reading specs from /usr/gnu/lib/gcc-lib/hppa1.1-bsd/2.2.2/specs
gcc version 2.2.2
 /usr/gnu/lib/gcc-lib/hppa1.1-bsd/2.2.2/cpp -lang-c -v -undef -D__GNUC__=2 -Dhppa -Dhp9000s800 -D__hp9000s800 -Dhp9k8 -Dunix -D_HPUX_SOURCE -Dhp9000 -Dhp800 -Dspectrum -DREVARGV -D__hppa__ -D__hp9000s800__ -D__hp9000s800 -D__hp9k8__ -D__unix__ -D___HPUX_SOURCE__ -D__hp9000__ -D__hp800__ -D__spectrum__ -D__REVARGV__ -D__hppa -D__hp9000s800 -D__hp9000s800 -D__hp9k8 -D__unix -D___HPUX_SOURCE -D__hp9000 -D__hp800 -D__spectrum -D__REVARGV -D__OPTIMIZE__ spinfo.c /usr/tmp/cc019387.i
GNU CPP version 2.2.2 (hp9000s800)
 /usr/gnu/lib/gcc-lib/hppa1.1-bsd/2.2.2/cc1 /usr/tmp/cc019387.i -quiet -dumpbase spinfo.c -O2 -version -o /usr/tmp/cc019387.s
GNU C version 2.2.2 (hp9000s800) compiled by GNU C version 2.2.2.
spinfo.c: In function `compute_sp_bounds':
spinfo.c:1601: internal error--insn does not satisfy its constraints:
(insn 174 164 167 (set (reg:SI 112)
       (reg:SI 77)) 32 {movsi+1} (insn_list:REG_DEP_ANTI 164 (nil))
   (expr_list:REG_EQUAL (const_int 15)
       (nil)))
gcc: Internal compiler error: program cc1 got fatal signal 4


Here is the input file (already preprocessed by cpp):
-----------------8<--- cut here -------- spinfo.c -----------
typedef	unsigned char	u_char;
typedef	unsigned short	u_short;
typedef	unsigned int	u_int;
typedef	unsigned long	u_long;
typedef	unsigned short	ushort;		 
typedef struct  _physadr { int r[1]; } *physadr;
typedef struct  label_t {
	int     lbl_rp;
	int     lbl_sp;
	int     lbl_s[17];
	int     lbl_ss[1];
	double  lbl_sf[10];	 
} label_t;
typedef	u_int	space_t;
typedef	struct	_uquad	{ u_long val[2]; } u_quad_t;
typedef	struct	_quad	{   long val[2]; } quad_t;
typedef	long *	qaddr_t;
typedef	long	daddr_t;
typedef	char *	caddr_t;
typedef	u_long	ino_t;
typedef	long	swblk_t;
typedef	short	dev_t;
typedef	long	off_t;
typedef	u_short	nlink_t;	 
typedef	u_short	uid_t;
typedef	u_short	gid_t;
typedef	short	pid_t;		 
typedef	u_short	mode_t;		 
typedef	u_long	fixpt_t;
typedef	unsigned long			clock_t;
typedef	unsigned int			size_t;
typedef	int				ptrdiff_t;
typedef unsigned short		       wchar_t;
typedef	int				ssize_t;
typedef	long				time_t;
typedef long	fd_mask;
typedef	struct fd_set {
	fd_mask	fds_bits[(((256 )+(( (sizeof(fd_mask) * 8		)	)-1))/( (sizeof(fd_mask) * 8		)	)) ];
} fd_set;
char	*memchr (const void *, int, size_t)		;
int	 memcmp (const void *, const void *, size_t)		;
void	*memcpy (void *, const void *, size_t)		;
char	*memmove (void *, const void *, size_t)		;
char	*memset (void *, int, size_t)		;
char	*strcat (char *, const char *)		;
char	*strchr (const char *, int)		;
int	 strcmp (const char *, const char *)		;
int	 strcoll (const char *, const char *)		;
char	*strcpy (char *, const char *)		;
size_t	 strcspn (const char *, const char *)		;
char	*strerror (int)		;
size_t	 strlen (const char *)		;
char	*strncat (char *, const char *, size_t)		;
int	 strncmp (const char *, const char *, size_t)		;
char	*strncpy (char *, const char *, size_t)		;
char	*strpbrk (const char *, const char *)		;
char	*strrchr (const char *, int)		;
size_t	 strspn (const char *, const char *)		;
char	*strstr (const char *, const char *)		;
char	*strtok (char *, const char *)		;
size_t	 strxfrm (char *, const char *, size_t)		;
int	 bcmp (const void *, const void *, size_t)		;
void	 bcopy (const void *, void *, size_t)		;
void	 bzero (void *, size_t)		;
int	 ffs (int)		;
char	*index (const char *, int)		;
char	*memccpy (void *, const void *, int, size_t)		;
char	*rindex (const char *, int)		;
int	 strcasecmp (const char *, const char *)		;
char	*strdup (const char *)		;
void	 strmode (int, char *)		;
int	 strncasecmp (const char *, const char *, size_t)		;
char	*strsep (char **, const char *)		;
void	 swab (const void *, void *, size_t)		;
struct flock {
	short	l_type;		 
	short	l_whence;	 
	off_t	l_start;	 
	off_t	l_len;		 
	pid_t	l_pid;		 
};
int	open (const char *, int, ...)		;
int	creat (const char *, mode_t)		;
int	fcntl (int, int, ...)		;
int	flock (int, int)		;
struct timeval {
	long	tv_sec;		 
	long	tv_usec;	 
};
struct timezone {
	int	tz_minuteswest;	 
	int	tz_dsttime;	 
};
struct	itimerval {
	struct	timeval it_interval;	 
	struct	timeval it_value;	 
};
struct clockinfo {
	int hz;		 
	int tick;	 
	int phz;	 
	int profhz;	 
};
struct tm {
	int	tm_sec;
	int	tm_min;
	int	tm_hour;
	int	tm_mday;
	int	tm_mon;
	int	tm_year;
	int	tm_wday;
	int	tm_yday;
	int	tm_isdst;
	long	tm_gmtoff;
	char	*tm_zone;
};
extern	struct tm *gmtime(), *localtime();
extern	char *asctime(), *ctime();
int	adjtime (const struct timeval *, struct timeval *)		;
int	getitimer (int, struct itimerval *)		;
int	gettimeofday (struct timeval *, struct timezone *)		;
int	setitimer (int, const struct itimerval *, struct itimerval *)		;
int	settimeofday (const struct timeval *, const struct timezone *)		;
int	utimes (const char *, const struct timeval *)		;
void bcopy();
void bzero();
int bcmp();
typedef unsigned char	*pointer;
typedef int		Bool;
typedef unsigned long	Atom;
typedef unsigned long	XID;
extern char	    *NameForAtom ();
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 struct _xSegment {
    INT16 x1  , y1  , x2  , y2  ;
} xSegment;
typedef struct _xPoint {
	INT16		x  , y  ;
} xPoint;
typedef struct _xRectangle {
    INT16 x  , y  ;
    CARD16  width  , height  ;
} xRectangle;
typedef struct _xArc {
    INT16 x  , y  ;
    CARD16   width  , height  ;
    INT16   angle1  , angle2  ;
} xArc;
typedef CARD16 KeyButMask;
typedef struct {
    CARD8	byteOrder;
    BYTE	pad;
    CARD16	majorVersion  , minorVersion  ;
    CARD16	nbytesAuthProto  ;	 
    CARD16	nbytesAuthString  ;	 
    CARD16	pad2;
} xConnClientPrefix;
typedef struct {
    BOOL           success;
    BYTE           lengthReason;  
    CARD16         majorVersion  , 
                   minorVersion  ;
    CARD16         length  ;   
} xConnSetupPrefix;
typedef struct {
    CARD32         release  ;
    CARD32         ridBase  , 
                   ridMask  ;
    CARD32         motionBufferSize  ;
    CARD16         nbytesVendor  ;   
    CARD16         maxRequestSize  ;
    CARD8          numRoots;           
    CARD8          numFormats;         
    CARD8          imageByteOrder;         
    CARD8          bitmapBitOrder;         
    CARD8          bitmapScanlineUnit,      
                   bitmapScanlinePad;      
    CARD8 	   minKeyCode, maxKeyCode;
    CARD32	   pad2  ;
} xConnSetup;
typedef struct {
    CARD8          depth;
    CARD8          bitsPerPixel;
    CARD8          scanLinePad;
    CARD8          pad1;
    CARD32	   pad2  ;
} xPixmapFormat;
typedef struct {
    CARD8 	depth;
    CARD8 	pad1;
    CARD16	nVisuals  ;   
    CARD32	pad2  ;
    } xDepth;
typedef struct {
    CARD32  visualID  ;
    CARD8 class;
    CARD8 bitsPerRGB;
    CARD16 colormapEntries  ;
    CARD32 redMask  , greenMask  , blueMask  ;
    CARD32 pad  ;
    } xVisualType;
typedef struct {
    CARD32          windowId  ;
    CARD32        defaultColormap  ;
    CARD32         whitePixel  , blackPixel  ;
    CARD32         currentInputMask  ;   
    CARD16         pixWidth  , pixHeight  ;
    CARD16         mmWidth  , mmHeight  ;
    CARD16         minInstalledMaps  , maxInstalledMaps  ;
    CARD32        rootVisualID  ;
    CARD8          backingStore;
    BOOL           saveUnders;
    CARD8          rootDepth;
    CARD8          nDepths;   
} xWindowRoot;

typedef struct {
    CARD32 time  ;
    INT16 x  , y  ;
} xTimecoord;
typedef struct {
    CARD8 family;
    BYTE pad;
    CARD16 length  ;
} xHostEntry;
typedef struct {
    INT16 leftSideBearing  ,
	  rightSideBearing  ,
	  characterWidth  ,
	  ascent  ,
	  descent  ;
    CARD16 attributes  ;
} xCharInfo;
typedef struct {
    CARD32  name  ;
    CARD32 value  ;
} xFontProp;
typedef struct {            
    CARD8 len;	 
    INT8 delta;
} xTextElt;
typedef struct {        
    CARD32 pixel  ;
    CARD16 red  , green  , blue  ;
    CARD8 flags;   
    CARD8 pad;
} xColorItem;
typedef struct {
    CARD16 red  , green  , blue  , pad  ;
} xrgb;
typedef CARD8 KEYCODE;


typedef struct {
    BYTE type;                   
    BYTE errorCode;
    CARD16 sequenceNumber  ;        
    CARD32 resourceID  ;
    CARD16 minorCode  ;
    CARD8 majorCode;
    BYTE pad1;
    CARD32 pad3  ;
    CARD32 pad4  ;
    CARD32 pad5  ;
    CARD32 pad6  ;
    CARD32 pad7  ;
} xError;

typedef struct {
	CARD8 reqType;
	CARD8 data;             
	CARD16 length  ;          
} xReq;
typedef struct {
    CARD8 reqType;
    BYTE pad;
    CARD16 length  ;
    CARD32 id  ;   
    } xResourceReq;
typedef struct {
    CARD8 reqType;
    CARD8 depth;
    CARD16 length  ;
    CARD32  wid  , parent  ;
    INT16 x  , y  ;
    CARD16 width  , height  , borderWidth  ;  
    CARD16 class  ;
    CARD32  visual  ;
    CARD32 mask  ;
} xCreateWindowReq;
typedef struct {
    CARD8 reqType;
    BYTE pad;
    CARD16 length  ;
    CARD32  window  ;
    CARD32 valueMask  ; 
} xChangeWindowAttributesReq;
typedef struct {
    CARD8 reqType;
    BYTE mode;
    CARD16 length  ;
    CARD32  window  ;
} xChangeSaveSetReq;
typedef struct {
    CARD8 reqType;
    BYTE pad;
    CARD16 length  ;
    CARD32  window  , parent  ;
    INT16 x  , y  ;
} xReparentWindowReq;
typedef struct {
    CARD8 reqType;
    CARD8 pad;
    CARD16 length  ;
    CARD32  window  ;
    CARD16 mask  ;
    CARD16 pad2  ;
} xConfigureWindowReq;
typedef struct {
    CARD8 reqType;
    CARD8 direction;
    CARD16 length  ;
    CARD32  window  ;
} xCirculateWindowReq;
typedef struct {     
    CARD8 reqType;
    BOOL onlyIfExists;
    CARD16 length  ;
    CARD16 nbytes   ;     
    CARD16 pad  ;
} xInternAtomReq;
typedef struct {
    CARD8 reqType;
    CARD8 mode;
    CARD16 length  ;
    CARD32  window  ;
    CARD32  property  , type  ;
    CARD8 format;
    BYTE pad[3];
    CARD32 nUnits  ;      
} xChangePropertyReq;
typedef struct {
    CARD8 reqType;
    BYTE pad;
    CARD16 length  ;
    CARD32  window  ;
    CARD32  property  ;
} xDeletePropertyReq;
typedef struct {
    CARD8 reqType;
    BOOL delete;
    CARD16 length  ;
    CARD32  window  ;
    CARD32  property  , type  ;
    CARD32 longOffset  ;
    CARD32 longLength  ;
} xGetPropertyReq;
typedef struct {
    CARD8 reqType;
    BYTE pad;
    CARD16 length  ;
    CARD32  window  ;
    CARD32  selection  ;
    CARD32  time  ;
} xSetSelectionOwnerReq;
typedef struct {
    CARD8 reqType;
    BYTE pad;
    CARD16 length  ;
    CARD32  requestor  ;
    CARD32  selection  , target  , property  ;
    CARD32  time  ;
    } xConvertSelectionReq;
typedef struct {
    CARD8 reqType;
    BOOL ownerEvents;
    CARD16 length  ;
    CARD32  grabWindow  ;
    CARD16 eventMask  ;
    BYTE pointerMode, keyboardMode;
    CARD32  confineTo  ;
    CARD32  cursor  ;
    CARD32  time  ;
} xGrabPointerReq;
typedef struct {
    CARD8 reqType;
    BOOL ownerEvents;
    CARD16 length  ;
    CARD32  grabWindow  ;
    CARD16 eventMask  ;
    BYTE pointerMode, keyboardMode;
    CARD32  confineTo  ;
    CARD32  cursor  ;
    CARD8 button;
    BYTE pad;
    CARD16 modifiers  ;
} xGrabButtonReq;
typedef struct {
    CARD8 reqType;
    CARD8 button;
    CARD16 length  ;
    CARD32  grabWindow  ;
    CARD16 modifiers  ;
    CARD16 pad  ;
} xUngrabButtonReq;
typedef struct {
    CARD8 reqType;
    BYTE pad;
    CARD16 length  ;
    CARD32  cursor  ;
    CARD32  time  ;
    CARD16 eventMask  ;
    CARD16 pad2  ;
} xChangeActivePointerGrabReq;
typedef struct {
    CARD8 reqType;
    BOOL ownerEvents;
    CARD16 length  ;
    CARD32  grabWindow  ;
    CARD32  time  ;
    BYTE pointerMode, keyboardMode;  
    CARD16 pad  ;
} xGrabKeyboardReq;
typedef struct {
    CARD8 reqType;
    BOOL ownerEvents;
    CARD16 length  ;
    CARD32  grabWindow  ;
    CARD16 modifiers  ;
    CARD8 key;
    BYTE pointerMode, keyboardMode;  
    BYTE pad1, pad2, pad3;
} xGrabKeyReq;
typedef struct {
    CARD8 reqType;
    CARD8 key;
    CARD16 length  ;
    CARD32  grabWindow  ;
    CARD16 modifiers  ;
    CARD16 pad  ;
} xUngrabKeyReq;
typedef struct {
    CARD8 reqType;
    CARD8 mode;
    CARD16 length  ;
    CARD32  time  ;
} xAllowEventsReq;
typedef struct {
    CARD8 reqType;
    BYTE pad;
    CARD16 length  ;
    CARD32  window  ;
    CARD32  start  , stop  ;
} xGetMotionEventsReq;
typedef struct {
    CARD8 reqType;
    BYTE pad;
    CARD16 length  ;
    CARD32  srcWid  , dstWid  ;
    INT16 srcX  , srcY  ;
} xTranslateCoordsReq;
typedef struct {
    CARD8 reqType;
    BYTE pad;
    CARD16 length  ;
    CARD32  srcWid  , dstWid  ;
    INT16 srcX  , srcY  ;
    CARD16 srcWidth  , srcHeight  ;
    INT16 dstX  , dstY  ;
} xWarpPointerReq;
typedef struct {
    CARD8 reqType;
    CARD8 revertTo;
    CARD16 length  ;
    CARD32  focus  ;
    CARD32  time  ;
} xSetInputFocusReq;
typedef struct {
    CARD8 reqType;
    BYTE pad;
    CARD16 length  ;
    CARD32  fid  ;
    CARD16 nbytes  ;
    BYTE pad1, pad2;	 
} xOpenFontReq;
typedef struct {
    CARD8 reqType;
    BOOL oddLength;
    CARD16 length  ;
    CARD32  fid  ;
    } xQueryTextExtentsReq;
typedef struct {
    CARD8 reqType;
    BYTE pad;
    CARD16 length  ;
    CARD16 maxNames  ;
    CARD16 nbytes  ;   
} xListFontsReq;
typedef xListFontsReq xListFontsWithInfoReq;
typedef struct {
    CARD8 reqType;
    BYTE pad;
    CARD16 length  ;
    CARD16 nFonts  ;
    BYTE pad1, pad2;	 
} xSetFontPathReq;
typedef struct {
    CARD8 reqType;
    CARD8 depth;
    CARD16 length  ;
    CARD32  pid  ;
    CARD32  drawable  ;
    CARD16 width  , height  ;
} xCreatePixmapReq;
typedef struct {
    CARD8 reqType;
    BYTE pad;
    CARD16 length  ;
    CARD32  gc  ;
    CARD32  drawable  ;
    CARD32 mask  ;
} xCreateGCReq;
typedef struct {
    CARD8 reqType;
    BYTE pad;
    CARD16 length  ;
    CARD32  gc  ;
    CARD32 mask  ;
} xChangeGCReq;    
typedef struct {
    CARD8 reqType;
    BYTE pad;
    CARD16 length  ;
    CARD32  srcGC  , dstGC  ;
    CARD32 mask  ;
} xCopyGCReq;    
typedef struct {
    CARD8 reqType;
    BYTE pad;
    CARD16 length  ;
    CARD32  gc  ;
    CARD16 dashOffset  ;
    CARD16 nDashes  ;         
} xSetDashesReq;    
typedef struct {
    CARD8 reqType;
    BYTE ordering;
    CARD16 length  ;
    CARD32  gc  ;
    INT16 xOrigin  , yOrigin  ;
} xSetClipRectanglesReq;    
typedef struct {
    CARD8 reqType;
    BOOL exposures;
    CARD16 length  ;
    CARD32  window  ;
    INT16 x  , y  ;
    CARD16 width  , height  ;
} xClearAreaReq;
typedef struct {
    CARD8 reqType;
    BYTE pad;
    CARD16 length  ;
    CARD32  srcDrawable  , dstDrawable  ;
    CARD32  gc  ;
    INT16 srcX  , srcY  , dstX  , dstY  ;
    CARD16 width  , height  ;
} xCopyAreaReq;    
typedef struct {
    CARD8 reqType;
    BYTE pad;
    CARD16 length  ;
    CARD32  srcDrawable  , dstDrawable  ;
    CARD32  gc  ;
    INT16 srcX  , srcY  , dstX  , dstY  ;
    CARD16 width  , height  ;
    CARD32 bitPlane  ;
} xCopyPlaneReq;    
typedef struct {
    CARD8 reqType;
    BYTE coordMode;
    CARD16 length  ;
    CARD32  drawable  ;
    CARD32  gc  ;
} xPolyPointReq;    
typedef xPolyPointReq xPolyLineReq;   
typedef struct {
    CARD8 reqType;
    BYTE pad;
    CARD16 length  ;
    CARD32  drawable  ;
    CARD32  gc  ;
} xPolySegmentReq;    
typedef xPolySegmentReq xPolyArcReq;
typedef xPolySegmentReq xPolyRectangleReq;
typedef xPolySegmentReq xPolyFillRectangleReq;
typedef xPolySegmentReq xPolyFillArcReq;
typedef struct _FillPolyReq {
    CARD8 reqType;
    BYTE pad;
    CARD16 length  ;
    CARD32  drawable  ;
    CARD32  gc  ;
    BYTE shape;
    BYTE coordMode;
    CARD16 pad1  ;
} xFillPolyReq;    
typedef struct _PutImageReq {
    CARD8 reqType;
    CARD8 format;
    CARD16 length  ;
    CARD32  drawable  ;
    CARD32  gc  ;
    CARD16 width  , height  ;
    INT16 dstX  , dstY  ;
    CARD8 leftPad;
    CARD8 depth;
    CARD16 pad  ;
} xPutImageReq;    
typedef struct {
    CARD8 reqType;
    CARD8 format;
    CARD16 length  ;
    CARD32  drawable  ;
    INT16 x  , y  ;
    CARD16 width  , height  ;
    CARD32 planeMask  ;
} xGetImageReq;    
typedef struct {
    CARD8 reqType;
    CARD8 pad;
    CARD16 length  ;
    CARD32  drawable  ;
    CARD32  gc  ;
    INT16 x  , y  ;		 
} xPolyTextReq;    
typedef xPolyTextReq xPolyText8Req;
typedef xPolyTextReq xPolyText16Req;
typedef struct {
    CARD8 reqType;
    BYTE nChars;
    CARD16 length  ;
    CARD32  drawable  ;
    CARD32  gc  ;
    INT16 x  , y  ;
} xImageTextReq;    
typedef xImageTextReq xImageText8Req;
typedef xImageTextReq xImageText16Req;
typedef struct {
    CARD8 reqType;
    BYTE alloc;
    CARD16 length  ;
    CARD32  mid  ;
    CARD32  window  ;
    CARD32  visual  ;
} xCreateColormapReq;    
typedef struct {
    CARD8 reqType;
    BYTE pad;
    CARD16 length  ;
    CARD32  mid  ;
    CARD32  srcCmap  ;
} xCopyColormapAndFreeReq;    
typedef struct {
    CARD8 reqType;
    BYTE pad;
    CARD16 length  ;
    CARD32  cmap  ;
    CARD16 red  , green  , blue  ;
    CARD16 pad2  ;
} xAllocColorReq;    
typedef struct {
    CARD8 reqType;
    BYTE pad;
    CARD16 length  ;
    CARD32  cmap  ;
    CARD16 nbytes  ;   
    BYTE pad1, pad2;
} xAllocNamedColorReq;    
typedef struct {
    CARD8 reqType;
    BOOL contiguous;
    CARD16 length  ;
    CARD32  cmap  ;
    CARD16 colors  , planes  ;
} xAllocColorCellsReq;    
typedef struct {
    CARD8 reqType;
    BOOL contiguous;
    CARD16 length  ;
    CARD32  cmap  ;
    CARD16 colors  , red  , green  , blue  ;
} xAllocColorPlanesReq;    
typedef struct {
    CARD8 reqType;
    BYTE pad;
    CARD16 length  ;
    CARD32  cmap  ;
    CARD32 planeMask  ;
} xFreeColorsReq;    
typedef struct {
    CARD8 reqType;
    BYTE pad;
    CARD16 length  ;
    CARD32  cmap  ;
} xStoreColorsReq;    
typedef struct {
    CARD8 reqType;
    CARD8 flags;    
    CARD16 length  ;
    CARD32  cmap  ;
    CARD32 pixel  ;
    CARD16 nbytes  ;   
    BYTE pad1, pad2;
    } xStoreNamedColorReq;
typedef struct {
    CARD8 reqType;
    BYTE pad;
    CARD16 length  ;
    CARD32  cmap  ;
} xQueryColorsReq;    
typedef struct {     
    CARD8 reqType;
    BYTE pad;
    CARD16 length  ;
    CARD32  cmap  ;
    CARD16 nbytes  ;   
    BYTE pad1, pad2;
} xLookupColorReq;    
typedef struct {
    CARD8 reqType;
    BYTE pad;
    CARD16 length  ;
    CARD32  cid  ;
    CARD32  source  , mask  ;
    CARD16 foreRed  , foreGreen  , foreBlue  ;
    CARD16 backRed  , backGreen  , backBlue  ;
    CARD16 x  , y  ;
} xCreateCursorReq;    
typedef struct {
    CARD8 reqType;
    BYTE pad;
    CARD16 length  ;
    CARD32  cid  ;
    CARD32  source  , mask  ;
    CARD16 sourceChar  , maskChar  ;
    CARD16 foreRed  , foreGreen  , foreBlue  ;
    CARD16 backRed  , backGreen  , backBlue  ;
} xCreateGlyphCursorReq;    
typedef struct {
    CARD8 reqType;
    BYTE pad;
    CARD16 length  ;
    CARD32  cursor  ;
    CARD16 foreRed  , foreGreen  , foreBlue  ;
    CARD16 backRed  , backGreen  , backBlue  ;
} xRecolorCursorReq;    
typedef struct {
    CARD8 reqType;
    CARD8 class;
    CARD16 length  ;
    CARD32  drawable  ;
    CARD16 width  , height  ;
} xQueryBestSizeReq;    
typedef struct {
    CARD8 reqType;
    BYTE pad;
    CARD16 length  ;
    CARD16 nbytes  ;   
    BYTE pad1, pad2;
} xQueryExtensionReq;
typedef struct {
    CARD8   reqType;
    CARD8   numKeyPerModifier;
    CARD16  length  ;
} xSetModifierMappingReq;
typedef struct {
    CARD8 reqType;
    CARD8 nElts;   
    CARD16 length  ;
} xSetPointerMappingReq;
typedef struct {
    CARD8 reqType;
    BYTE pad;
    CARD16 length  ;
    CARD8  firstKeyCode;
    CARD8 count;
    CARD16 pad1  ;
} xGetKeyboardMappingReq;    
typedef struct {
    CARD8 reqType;
    CARD8 keyCodes;
    CARD16 length  ;
    CARD8  firstKeyCode;
    CARD8 keySymsPerKeyCode;
    CARD16 pad1  ;
} xChangeKeyboardMappingReq;
typedef struct {
    CARD8 reqType;
    BYTE pad;
    CARD16 length  ;
    CARD32 mask  ;
} xChangeKeyboardControlReq;    
typedef struct {
    CARD8 reqType;
    INT8 percent;   
    CARD16 length  ;
} xBellReq;    
typedef struct {
    CARD8 reqType;
    BYTE pad;
    CARD16 length  ;
    INT16 accelNum  , accelDenum  ;
    INT16 threshold  ;             
    BOOL doAccel, doThresh;
} xChangePointerControlReq;    
typedef struct {
    CARD8 reqType;
    BYTE pad;
    CARD16 length  ;
    INT16 timeout  , interval  ;
    BYTE preferBlank, allowExpose;  
    CARD16 pad2  ;
} xSetScreenSaverReq;    
typedef struct {
    CARD8 reqType;
    BYTE mode;
    CARD16 length  ;
    CARD8 hostFamily;
    BYTE pad;
    CARD16 hostLength  ;
} xChangeHostsReq;    
typedef struct {
    CARD8 reqType;
    BYTE pad;
    CARD16 length  ;
    } xListHostsReq;
typedef struct {
    CARD8 reqType;
    BYTE mode;
    CARD16 length  ;
    } xChangeModeReq;
typedef xChangeModeReq xSetAccessControlReq;
typedef xChangeModeReq xSetCloseDownModeReq;
typedef xChangeModeReq xForceScreenSaverReq;
typedef struct {  
    CARD8 reqType;
    BYTE pad;
    CARD16 length  ;
    CARD32  window  ;
    CARD16 nAtoms  ;
    INT16 nPositions  ;
    } xRotatePropertiesReq;

typedef unsigned long  fsBitmapFormat;
typedef unsigned long  fsBitmapFormatMask;
typedef struct _Font *FontPtr;
typedef struct _FontInfo *FontInfoPtr;
typedef struct _FontProp *FontPropPtr;
typedef struct _ExtentInfo *ExtentInfoPtr;
typedef struct _FontPathElement *FontPathElementPtr;
typedef struct _CharInfo *CharInfoPtr;
typedef struct _FontNames *FontNamesPtr;
typedef struct _FontResolution *FontResolutionPtr;
typedef int DrawDirection;
typedef char *closure;
extern int  StartListFontsWithInfo(   );
extern int  ListFonts(   );
extern FontNamesPtr MakeFontNamesRecord(   );
extern void FreeFontNames();
extern int  AddFontNamesName();
extern int  FontToFSError();
extern FontResolutionPtr GetClientResolution();
typedef struct _FontPatternCache    *FontPatternCachePtr;
extern FontPatternCachePtr  MakeFontPatternCache ();
extern void		    FreeFontPatternCache ();
extern void		    EmtpyFontPatternCache ();
extern void		    CacheFontPattern ();
extern FontPtr		    FindCachedFontPattern ();
extern void		    RemoveCachedFontPattern ();
typedef enum {
    Linear8Bit, TwoD8Bit, Linear16Bit, TwoD16Bit
}           FontEncoding;
typedef struct _FontProp {
    long        name;
    long        value;		 
}           FontPropRec;
typedef struct _FontResolution {
    unsigned short x_resolution;
    unsigned short y_resolution;
    unsigned short point_size;
}           FontResolutionRec;
typedef struct _ExtentInfo {
    DrawDirection drawDirection;
    int         fontAscent;
    int         fontDescent;
    int         overallAscent;
    int         overallDescent;
    int         overallWidth;
    int         overallLeft;
    int         overallRight;
}           ExtentInfoRec;
typedef struct _CharInfo {
    xCharInfo   metrics;	 
    char       *bits;		 
}           CharInfoRec;
typedef struct _FontInfo {
    unsigned short firstCol;
    unsigned short lastCol;
    unsigned short firstRow;
    unsigned short lastRow;
    unsigned short defaultCh;
    unsigned int noOverlap:1;
    unsigned int terminalFont:1;
    unsigned int constantMetrics:1;
    unsigned int constantWidth:1;
    unsigned int inkInside:1;
    unsigned int inkMetrics:1;
    unsigned int allExist:1;
    unsigned int drawDirection:2;
    unsigned int cachable:1;
    unsigned int anamorphic:1;
    short       maxOverlap;
    short       pad;
    xCharInfo   maxbounds;
    xCharInfo   minbounds;
    xCharInfo   ink_maxbounds;
    xCharInfo   ink_minbounds;
    short       fontAscent;
    short       fontDescent;
    int         nprops;
    FontPropPtr props;
    char       *isStringProp;
}           FontInfoRec;
typedef struct _Font {
    int         refcnt;
    FontInfoRec info;
    char        bit;
    char        byte;
    char        glyph;
    char        scan;
    fsBitmapFormat format;
    int         (*get_glyphs) (   );
    int         (*get_metrics) (   );
    void        (*unload_font) (   );
    FontPathElementPtr fpe;
    pointer     svrPrivate;
    pointer     fontPrivate;
    pointer     fpePrivate;
    int		maxPrivate;
    pointer	*devPrivates;
}           FontRec;
extern Bool	_FontSetNewPrivate ( );
extern int	AllocateFontPrivateIndex ();
typedef struct _FontNames {
    int         nnames;
    int         size;
    int        *length;
    char      **names;
}           FontNamesRec;
typedef struct _FontPathElement {
    int         name_length;
    char       *name;
    int         type;
    int         refcount;
    pointer     private;
}           FontPathElementRec;
typedef struct _FPEFunctions {
    int         (*name_check) (   );
    int         (*init_fpe) (   );
    int         (*reset_fpe) (   );
    int         (*free_fpe) (   );
    int         (*open_font) (	 
 );
    int         (*close_font) (   );
    int         (*list_fonts) (	 
 );
    int         (*start_list_fonts_with_info) (	 
 );
    int         (*list_next_font_with_info) (	 
 );
    int         (*wakeup_fpe) (   );
    int		(*client_died) (   );
}           FPEFunctionsRec, FPEFunctions;
extern int  InitFPETypes();
typedef struct _FontEntry	    *FontEntryPtr;
typedef struct _FontTable	    *FontTablePtr;
typedef struct _FontName	    *FontNamePtr;
typedef struct _FontScaled	    *FontScaledPtr;
typedef struct _FontScalableExtra   *FontScalableExtraPtr;
typedef struct _FontScalableEntry   *FontScalableEntryPtr;
typedef struct _FontScaleAliasEntry *FontScaleAliasEntryPtr;
typedef struct _FontBitmapEntry	    *FontBitmapEntryPtr;
typedef struct _FontAliasEntry	    *FontAliasEntryPtr;
typedef struct _FontBCEntry	    *FontBCEntryPtr;
typedef struct _FontDirectory	    *FontDirectoryPtr;
typedef struct _FontRenderer	    *FontRendererPtr;
extern FontEntryPtr	FontFileFindNameInDir ();
extern FontDirectoryPtr	FontFileMakeDir ();
extern FontRendererPtr	FontFileMatchRenderer ();
extern char		*SaveString ();
extern FontScaledPtr	FontFileFindScaledInstance ();
typedef struct _FontScalable {
    int         pixel,
                point,
                x,
                y,
                width;
}           FontScalableRec, *FontScalablePtr;
extern Bool FontParseXLFDName();
typedef struct _FontName {
    char	*name;
    short	length;
    short	ndashes;
} FontNameRec;
typedef struct _FontScaled {
    FontScalableRec	vals;
    FontEntryPtr	bitmap;
    FontPtr		pFont;
} FontScaledRec;
typedef struct _FontScalableExtra {
    FontScalableRec	defaults;
    int			numScaled;
    int			sizeScaled;
    FontScaledPtr	scaled;
    pointer		private;
} FontScalableExtraRec;
typedef struct _FontScalableEntry {
    FontRendererPtr	    renderer;
    char		    *fileName;
    FontScalableExtraPtr   extra;
} FontScalableEntryRec;
typedef struct _FontScaleAliasEntry {
    char		*resolved;
} FontScaleAliasEntryRec;
typedef struct _FontBitmapEntry {
    FontRendererPtr	renderer;
    char		*fileName;
    FontPtr		pFont;
} FontBitmapEntryRec;
typedef struct _FontAliasEntry {
    char	*resolved;
} FontAliasEntryRec;
typedef struct _FontBCEntry {
    FontScalableRec	    vals;
    FontEntryPtr	    entry;
} FontBCEntryRec;
typedef struct _FontEntry {
    FontNameRec	name;
    int		type;
    union _FontEntryParts {
	FontScalableEntryRec	scalable;
	FontBitmapEntryRec	bitmap;
	FontAliasEntryRec	alias;
	FontBCEntryRec		bc;
    } u;
} FontEntryRec;
typedef struct _FontTable {
    int		    used;
    int		    size;
    FontEntryPtr    entries;
    Bool	    sorted;
} FontTableRec;
typedef struct _FontDirectory {
    char	    *directory;
    unsigned long   dir_mtime;
    unsigned long   alias_mtime;
    FontTableRec    scalable;
    FontTableRec    nonScalable;
} FontDirectoryRec;
typedef struct _FontRenderer {
    char    *fileSuffix;
    int	    fileSuffixLen;
    int	    (*OpenBitmap)( );
    int	    (*OpenScalable)( );
    int	    (*GetInfoBitmap)( );
    int	    (*GetInfoScalable)( );
    int	    number;
} FontRendererRec;
typedef struct _FontRenders {
    int		    number;
    FontRendererPtr *renderers;
} FontRenderersRec, *FontRenderersPtr;
typedef struct _BitmapInstance {
    FontScalableRec	vals;
    FontBitmapEntryPtr	bitmap;
} BitmapInstanceRec, *BitmapInstancePtr;
typedef struct _BitmapScalablePrivate {
    int			numInstances;
    BitmapInstancePtr	instances;
} BitmapScalablePrivateRec, *BitmapScalablePrivatePtr;
typedef struct _BitmapSources {
    FontPathElementPtr	*fpe;
    int			size;
    int			count;
} BitmapSourcesRec, *BitmapSourcesPtr;
extern BitmapSourcesRec	FontFileBitmapSources;
extern	struct	_iobuf {
	int	_cnt;
	char	*_ptr;		 
	char	*_base;		 
	int	_bufsiz;
	short	_flag;
	char	_file;		 
} _iob[];
struct _iobuf 	*fopen();
struct _iobuf 	*fdopen();
struct _iobuf 	*freopen();
struct _iobuf 	*popen();
long	ftell();
char	*fgets();
char	*gets();
typedef signed char fix7;
typedef   double   real;
typedef   unsigned char
                   ufix8,
                   boolean;
typedef   short    fix15;
typedef   unsigned short
                   ufix16;
typedef   long     fix31;
typedef   unsigned long
                   ufix32;
typedef
struct buff_tag
    {
    ufix8 					 *org;                    
    ufix32  no_bytes;               
    } 
buff_t;                             
typedef  struct constr_tag
    {
    ufix8 					 *org;                    
    ufix16  font_id;                
    fix15   xppo;                   
    fix15   yppo;                   
    boolean font_id_valid;          
    boolean data_valid;             
    boolean active;                 
    }                  
constr_t;                           
typedef  struct kern_tag
    {
    ufix8 					 *tkorg;                  
    ufix8 					 *pkorg;                  
    fix15   no_tracks;              
    fix15   no_pairs;               
    }                  
kern_t;                             
typedef struct specs_tag
    {
    buff_t 				 *pfont;                  
    fix31   xxmult;                 
    fix31   xymult;                 
    fix31   xoffset;                
    fix31   yxmult;                 
    fix31   yymult;                 
    fix31   yoffset;                
    ufix32  flags;                  
    void *out_info;                 
    }
specs_t;                            
typedef struct tcb_tag
    {
    fix15   xxmult;                 
    fix15   xymult;                 
    fix31   xoffset;                
    fix15   yxmult;                 
    fix15   yymult;                 
    fix31   yoffset;                
    fix15   xppo;                   
    fix15   yppo;                   
    fix15   xpos;                   
    fix15   ypos;                   
    ufix16  xtype;                  
    ufix16  ytype;                  
    ufix16  xmode;                  
    ufix16  ymode;                  
	fix15  mirror;                 
    }
tcb_t;                              
typedef struct point_tag
    {
    fix15   x;                      
    fix15   y;                      
    }
point_t;                            
typedef struct band_tag
    {
    fix15   band_max;
    fix15   band_min;
    fix15   band_array_offset;
    fix15   band_floor;
    fix15   band_ceiling;
    } band_t;
typedef struct bbox_tag
    {
    fix31   xmin;
    fix31   xmax;
    fix31   ymin;
    fix31   ymax;
    } bbox_t;
typedef  ufix16   cdr_t;           
typedef struct speedo_global_data 
	{
         kern_t  kern;               
	 point_t   Psw;              
         fix15  cb_offset;           
	 point_t  P0;                
	 fix15    x_orus;            
	 fix15    y_orus;            
	 fix15    x_pix;             
	 fix15    y_pix;             
	 ufix8    x_int;             
	 ufix8    y_int;             
     band_t   y_band;            
	 struct set_width_tag
        {
        fix31 x;
        fix31 y;
        } set_width;  
	 boolean  first_pass;        
	 boolean  extents_running;   
	 fix15    x0_spxl;           
	 fix15    y0_spxl;           
	 fix15    y_pxl;             
	 fix15    car[1000      ];  
	 cdr_t    cdr[1000      ];  
         ufix8    inttype[1000      ];
         ufix8    leftedge;
         ufix16   fracpix;
	 fix15    bmap_xmin;         
	 fix15    bmap_xmax;         
	 fix15    bmap_ymin;         
	 fix15    bmap_ymax;         
	 fix15    no_y_lists;        
	 fix15    first_offset;      
	 fix15    next_offset;       
	 boolean  intercept_oflo;    
	 fix15    xmin;              
	 fix15    xmax;              
	 fix15    ymin;              
	 fix15    ymax;              
         fix15    no_x_lists;        
         band_t   x_band;            
         boolean  x_scan_active;     
         ufix16   key32;             
         ufix8    key4;              
         ufix8    key6;              
         ufix8    key7;              
         ufix8    key8;              
         buff_t   font;
         buff_t   *pfont;  
         fix31    font_buff_size;  
         ufix8 					 *pchar_dir;  
         fix15    first_char_idx;  
         fix15    no_chars_avail;  
         fix15    orus_per_em;     
         fix15    metric_resolution;  
         tcb_t    tcb0;            
         boolean  specs_valid;     
         fix15    depth_adj;       
         boolean  curves_out;      
         fix15    output_mode;     
         fix15    thresh;          
         boolean  normal;          
         fix15    multshift;       
         fix15    pixshift;        
         fix15    poshift;         
         fix15    mpshift;         
         fix31    multrnd;         
         fix15    pixrnd;          
         fix31    mprnd;           
         fix15    pixfix;          
         fix15    onepix;          
         boolean (*init_out)();
         boolean (*begin_char)(); 
         void    (*begin_sub_char)();
         void    (*begin_contour)(); 
         void    (*curve)();         
         void    (*line)();               
         void    (*end_contour)(); 
         void    (*end_sub_char)();
         boolean (*end_char)();
         specs_t   *pspecs;     
         specs_t specs;                 
         ufix8 					  *font_org;      
         ufix8 					  *hdr2_org;      
         tcb_t    tcb;                  
         ufix8    Y_edge_org;           
         ufix8    Y_int_org;            
         fix31    rnd_xmin;             
         fix15    orus[ 256       ];    
         fix15    pix[ 256       ];     
         fix15    mult[  256       ];     
         fix31    offset[  256       ];   
         fix15    no_X_orus;               
         fix15    no_Y_orus;               
         ufix16   Y_constr_org;            
         constr_t constr;                  
         boolean  c_act[    750       ];       
         fix15    c_pix[    750       ];       
         boolean squeezing_compound;        
	fix31 clip_xmax;
	fix31 clip_ymax;
	fix31 clip_xmin;
	fix31 clip_ymin;
	} SPEEDO_GLOBALS;
extern  SPEEDO_GLOBALS   sp_globals;
boolean sp_make_char();           
ufix16  sp_get_char_id();         
fix31   sp_get_char_width();      
fix15   sp_get_track_kern();      
fix31   sp_get_pair_kern();       
boolean sp_get_char_bbox();
static boolean sp_make_simp_char();  
static boolean sp_make_comp_char();  
static ufix8 					 *sp_get_char_org();    
static fix15   sp_get_posn_arg();    
static fix15   sp_get_scale_arg();   
ufix8 					 *sp_read_bbox();               
void   sp_proc_outl_data();          
static void   sp_split_curve();             
static ufix8 					 *sp_get_args();       
boolean sp_init_black();
boolean sp_begin_char_black();
void sp_begin_contour_black();
void sp_line_black();
boolean sp_end_char_black();
static void    sp_add_intercept_black();
static void    sp_proc_intercepts_black();
void sp_init_char_out();
void sp_begin_sub_char_out();
void sp_curve_out();
void sp_end_contour_out();
void sp_end_sub_char_out();
void sp_init_intercepts_out();
void sp_restart_intercepts_out();
void sp_set_first_band_out();
void sp_reduce_band_size_out();
boolean sp_next_band_out();
void sp_reset();                  
void sp_set_key();
ufix16 sp_get_cust_no();
boolean    sp_set_specs();        
void       sp_type_tcb();            
static void    sp_setup_tcb();       
static fix15 sp_setup_mult();        
static fix31 sp_setup_offset();      
static boolean sp_setup_consts();    
fix31   sp_read_long();       
fix15   sp_read_word_u();     
void    sp_init_tcb();               
void    sp_scale_tcb();              
ufix8 					 *sp_plaid_tcb();              
ufix8 					 *sp_skip_interpolation_table();
ufix8 					 *sp_skip_control_zone();
static void sp_constr_update();      
ufix8 					 *sp_read_oru_table();     
static ufix8 					 *sp_setup_pix_table();    
static ufix8 					 *sp_setup_int_table();    
void sp_open_bitmap();
void sp_set_bitmap_bits();
void sp_close_bitmap();
buff_t *sp_load_char_data();         
boolean sp_init_screen();         
boolean sp_begin_char_screen();       
void    sp_begin_contour_screen();    
void    sp_line_screen();             
void    sp_curve_screen();            
void sp_scan_curve_screen();
void sp_vert_line_screen();
void sp_end_contour_screen();
boolean sp_end_char_screen();         
static void    sp_add_intercept_screen();
static void    sp_proc_intercepts_screen();
boolean sp_init_outline();         
boolean sp_begin_char_outline();       
void    sp_begin_sub_char_outline();   
void    sp_begin_contour_outline();    
void    sp_curve_outline();            
void    sp_line_outline();             
void    sp_end_contour_outline();      
void    sp_end_sub_char_outline();     
boolean sp_end_char_outline();         
boolean sp_init_2d();        
boolean sp_begin_char_2d();      
void    sp_begin_contour_2d();   
void    sp_line_2d();            
boolean sp_end_char_2d();        
static void    sp_add_intercept_2d();
static void    sp_proc_intercepts_2d();
static void    sp_draw_vector_to_2d();
typedef struct _sp_master {
    FontEntryPtr    entry;	 
    struct _iobuf        *fp;
    char       *fname;
    ufix8      *f_buffer;
    ufix8      *c_buffer;
    char       *copyright;
    ufix8      *key;
    buff_t      font;
    buff_t      char_data;
    ufix16      mincharsize;
    int         first_char_id;
    int         num_chars;
    int         max_id;
    int         state;		 
    int         refcount;	 
    int        *enc;
    int         enc_size;
}           SpeedoMasterFontRec, *SpeedoMasterFontPtr;
typedef struct _cur_font_stats {
    fsBitmapFormat format;
    ufix16      char_index;
    ufix16      char_id;
    fix15       bit_width,
                bit_height;
    fix15       cur_y;
    int         bpr;
    fix15       last_y;
    int         trunc;
    pointer     bp;
    int         scanpad;
}           CurrentFontValuesRec, *CurrentFontValuesPtr;
typedef struct _sp_font {
    struct _sp_master *master;
    specs_t     specs;
    FontEntryPtr    entry;
    FontScalableRec vals;
    CharInfoPtr encoding;
    CharInfoPtr pDefault;
    pointer     bitmaps;
}           SpeedoFontRec, *SpeedoFontPtr;
extern SpeedoFontPtr cur_spf;
extern int  open_sp_font();
extern void close_sp_font();
extern void close_master_file();
extern void sp_reset_master();
extern void SpeedoErr();
extern void make_sp_standard_props();
extern void make_sp_header();
extern void compute_sp_bounds();
extern void compute_sp_props();
extern int  build_all_sp_bitmaps();
extern unsigned long compute_sp_data_size();
extern int  bics_map[];
extern int  bics_map_size;
enum scaleType {
    atom, pixel_size, point_size, resolution_x, resolution_y, average_width,
    scaledX, scaledY, unscaled, scaledXoverY, uncomputed
};
typedef struct _fontProp {
    char       *name;
    long        atom;
    enum scaleType type;
}           fontProp;
static fontProp fontNamePropTable[] = {
    "FOUNDRY", 0, atom,
    "FAMILY_NAME", 0, atom,
    "WEIGHT_NAME", 0, atom,
    "SLANT", 0, atom,
    "SETWIDTH_NAME", 0, atom,
    "ADD_STYLE_NAME", 0, atom,
    "PIXEL_SIZE", 0, pixel_size,
    "POINT_SIZE", 0, point_size,
    "RESOLUTION_X", 0, resolution_x,
    "RESOLUTION_Y", 0, resolution_y,
    "SPACING", 0, atom,
    "AVERAGE_WIDTH", 0, average_width,
    "CHARSET_REGISTRY", 0, atom,
    "CHARSET_ENCODING", 0, atom,
};
static fontProp extraProps[] = {
    "FONT", 0, atom,
    "COPYRIGHT", 0, atom,
};
void
make_sp_standard_props()
{
    int         i;
    fontProp   *t;
    i = sizeof(fontNamePropTable) / sizeof(fontProp);
    for (t = fontNamePropTable; i; i--, t++)
	t->atom = MakeAtom(t->name, (unsigned) strlen(t->name), 1 );
    i = sizeof(extraProps) / sizeof(fontProp);
    for (t = extraProps; i; i--, t++)
	t->atom = MakeAtom(t->name, (unsigned) strlen(t->name), 1 );
}
void
make_sp_header(spf, pinfo)
    SpeedoFontPtr spf;
    FontInfoPtr pinfo;
{
    int         pixel_size;
    SpeedoMasterFontPtr spmf = spf->master;
    pinfo->firstCol = spmf->first_char_id & 0xff;
    pinfo->firstRow = spmf->first_char_id >> 8;
    pinfo->lastCol = spmf->max_id & 0xff;
    pinfo->lastRow = spmf->max_id >> 8;
    pinfo->defaultCh = 0;
    pinfo->inkMetrics = 0;
    pinfo->allExist = 0;
    pinfo->drawDirection = 0 ;
    pinfo->cachable = 1;
    pinfo->anamorphic = 0;
    if (spf->specs.xxmult != spf->specs.yymult)
	pinfo->anamorphic = 1 ;
    pixel_size = spf->vals.pixel * 120  / 100;
    pinfo->fontAscent = pixel_size * 764 / 1000;	 
    pinfo->fontDescent = pixel_size - pinfo->fontAscent;
}
static void
adjust_min_max(minc, maxc, tmp)
    xCharInfo  *minc,
               *maxc,
               *tmp;
{
    if (minc->ascent > ( tmp)->ascent) minc->ascent = ( tmp)->ascent; if (maxc->ascent < ( tmp)->ascent) maxc->ascent = ( tmp)->ascent; ;
    if (minc->descent > ( tmp)->descent) minc->descent = ( tmp)->descent; if (maxc->descent < ( tmp)->descent) maxc->descent = ( tmp)->descent; ;
    if (minc->leftSideBearing > ( tmp)->leftSideBearing) minc->leftSideBearing = ( tmp)->leftSideBearing; if (maxc->leftSideBearing < ( tmp)->leftSideBearing) maxc->leftSideBearing = ( tmp)->leftSideBearing; ;
    if (minc->rightSideBearing > ( tmp)->rightSideBearing) minc->rightSideBearing = ( tmp)->rightSideBearing; if (maxc->rightSideBearing < ( tmp)->rightSideBearing) maxc->rightSideBearing = ( tmp)->rightSideBearing; ;
    if (minc->characterWidth > ( tmp)->characterWidth) minc->characterWidth = ( tmp)->characterWidth; if (maxc->characterWidth < ( tmp)->characterWidth) maxc->characterWidth = ( tmp)->characterWidth; ;
}
void
compute_sp_bounds(spf, pinfo, flags)
    SpeedoFontPtr spf;
    FontInfoPtr pinfo;
    unsigned long flags;
{
    int         i,
                id,
                index,
		maxOverlap,
		overlap;
    xCharInfo   minchar,
                maxchar,
                tmpchar;
    bbox_t      bbox;
    fix31       width;
    double      pix_width,
                total_width = 0.0;
    SpeedoMasterFontPtr spmf = spf->master;
    int	firstChar;
    firstChar = spmf->first_char_id;
    minchar.ascent = minchar.descent =
	minchar.leftSideBearing = minchar.rightSideBearing =
	minchar.characterWidth = 32767;
    minchar.attributes = 0;
    maxchar.ascent = maxchar.descent =
	maxchar.leftSideBearing = maxchar.rightSideBearing =
	maxchar.characterWidth = -32767;
    maxchar.attributes = 0;
    maxOverlap = -32767;
    for (i = 0; i < spmf->num_chars; i++) {
	index = spmf->enc[i * 2 + 1];
	width = sp_get_char_width(index);
	 
	pix_width = width * (spf->specs.xxmult / 65536L) +
	    ((ufix32) width * ((ufix32) spf->specs.xxmult & 0xffff))
	    / 65536L;
	width = (pix_width * 720L) / (spf->specs.yymult);
	pix_width /= 65536L;
	(void) sp_get_char_bbox(index, &bbox);
	bbox.ymax = (bbox.ymax + 32768L) >> 16;
	bbox.ymin = (bbox.ymin + 32768L) >> 16;
	bbox.xmin = (bbox.xmin + 32768L) >> 16;
	bbox.xmax = (bbox.xmax + 32768L) >> 16;
	tmpchar.ascent = bbox.ymax;
	tmpchar.descent = -bbox.ymin;
	tmpchar.leftSideBearing = bbox.xmin;
	tmpchar.rightSideBearing = bbox.xmax;
	tmpchar.characterWidth = (int) (pix_width + 0.5);	 
	tmpchar.attributes = 0;
	adjust_min_max(&minchar, &maxchar, &tmpchar);
	overlap = tmpchar.rightSideBearing - tmpchar.characterWidth;
	if (maxOverlap < overlap)
	    maxOverlap = overlap;
	total_width += pix_width;
	if (flags & 0x1 ) {
	    id = spmf->enc[i * 2] - firstChar;
	     ;
	    spf->encoding[id].metrics = tmpchar;
	}
    }
    spf->vals.width = total_width / spmf->num_chars * 10;
    pinfo->maxbounds = maxchar;
    pinfo->minbounds = minchar;
    pinfo->ink_maxbounds = maxchar;
    pinfo->ink_minbounds = minchar;
    pinfo->maxOverlap = maxOverlap;
}
void
compute_sp_props(spf, fontname, pinfo)
    SpeedoFontPtr spf;
    char       *fontname;
    FontInfoPtr pinfo;
{
    FontPropPtr pp;
    int         i,
                nprops;
    fontProp   *fpt;
    char       *is_str;
    char       *ptr1,
               *ptr2;
    nprops = pinfo->nprops = ((sizeof(fontNamePropTable) / sizeof(fontProp))  + (sizeof(extraProps) / sizeof(fontProp)) ) ;
    pinfo->isStringProp = (char *)   Xalloc ((unsigned) sizeof(char) * nprops) ;
    pinfo->props = (FontPropPtr)   Xalloc ((unsigned) sizeof(FontPropRec) * nprops) ;
    if (!pinfo->isStringProp || !pinfo->props) {
	   Xfree ((pointer) pinfo->isStringProp) ;
	pinfo->isStringProp = (char *) 0;
	   Xfree ((pointer) pinfo->props) ;
	pinfo->props = (FontPropPtr) 0;
	return;
    }
    bzero(pinfo->isStringProp, (sizeof(char) * nprops));
    ptr2 = fontname;
    for (i = (sizeof(fontNamePropTable) / sizeof(fontProp)) , pp = pinfo->props, fpt = fontNamePropTable,
	    is_str = pinfo->isStringProp;
	    i;
	    i--, pp++, fpt++, is_str++) {
	ptr1 = ptr2 + 1;
	if (*ptr1 == '-')
	    ptr2 = ptr1;
	else {
	    if (i > 1)
		ptr2 = index(ptr1 + 1, '-');
	    else
		ptr2 = index(ptr1 + 1, '\0');
	}
	pp->name = fpt->atom;
	switch (fpt->type) {
	case atom:
	    *is_str = 1 ;
	    pp->value = MakeAtom(ptr1, ptr2 - ptr1, 1 );
	    break;
	case pixel_size:
	    pp->value = spf->vals.pixel;
	    break;
	case point_size:
	    pp->value = spf->vals.point;
	    break;
	case resolution_x:
	    pp->value = spf->vals.x;
	    break;
	case resolution_y:
	    pp->value = spf->vals.y;
	    break;
	case average_width:
	    pp->value = spf->vals.width;
	    break;
	}
    }
    for (i = 0, fpt = extraProps; i < (sizeof(extraProps) / sizeof(fontProp)) ; i++, is_str++, pp++, fpt++) {
	pp->name = fpt->atom;
	switch (i) {
	case 0 :
	    *is_str = 1 ;
	    pp->value = MakeAtom(fontname, strlen(fontname), 1 );
	    break;
	case 1 :
	    *is_str = 1 ;
	    pp->value = MakeAtom(spf->master->copyright,
				 strlen(spf->master->copyright), 1 );
	    break;
	}
    }
}
-------------------------------------------------------------

Good Luck!   ...Tim

          Tim Theisen           Systems Programmer
Internet: tim@cs.wisc.edu       Department of Computer Sciences
    UUCP: uwvax!tim             University of Wisconsin-Madison
   Phone: (608)262-0438         1210 West Dayton Street
     FAX: (608)262-9777         Madison, WI   53706
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads