[comp.sys.hp] texx on HP-UX

philipt@cvaxa.sussex.ac.uk (Philip Taylor) (03/01/89)

Has anyone experience of using the texx (X-windows TeX previewer) on
an HP 9000?

I am running X11R3 on an HP 9000/320 running HP-UX 6.2B. I can build and 
start texx OK, but it always falls over almost immediately with the messages:-

X Error:  BadMatch, invalid parameter attributes
  Request Major code 70 ()
  Request Minor code
  ResourceID 0x0
  Error Serial #32
  Current Serial #386

Can anyone throw any light on this?

Philip Taylor

*=============================================================================*
* Philip Taylor            |            Systems Programmer                    *
* COGS,                    | Tel:   (+44)- (0)273 606755  Ext 4284            *
* Arts Building E,         |                                                  *
* University Of Sussex,    | JANET: philipt@uk.ac.sussex.cogs                 *
* Falmer,                  | UUCP:  ...mcvax!ukc!cvaxa!philipt                *
* Brighton, BN1 9QN        | ARPA:                                            *
* UNITED KINGDOM.          | philipt%uk.ac.sussex.cogs@nss.cs.ucl.ac.uk       *
*                          |                                                  *
*=============================================================================*

grunwald@flute.cs.uiuc.edu (03/22/89)

I post yet again the current texx patches, and ask those using texx to
consider FTPing a copy of texx2.8 from either expo.lcs.mit.edu:contrib
or a.cs.uiuc.edu:pub/TeX.

Also, although texx2 uses the X fonts for speed in repolotting, several
people have noted that it's a royal pain to provide all those fonts. As
far as I see, there's no problem in having texx2 also display bitmapped
fonts, as xdvi or texx did. However, I won't be doing much in this line
until I'm done interviewing & deposit my thesis, so I'd heartily
welcome the fixes for this (or any other part of texx2) if someone does it.

*** texx.c	Mon Aug 29 13:22:08 1988
--- /usr/src/local/X11R3/contrib/clients/texx/previewers/texx.c	Fri Feb 26 01:05:37 1988
***************
*** 18,24 ****
  #include <ctype.h>
  
  #include "dvistuff.h"
! static char *rcsid="$Header: texx.c,v 1.20 88/08/29 13:20:48 grunwald Exp $" ;
  /*
   *	These constants may need to be changed on your implementation
   */
--- 18,24 ----
  #include <ctype.h>
  
  #include "dvistuff.h"
! static char *rcsid="$Header: texx.c,v 1.2 88/02/11 16:55:22 jim Exp $" ;
  /*
   *	These constants may need to be changed on your implementation
   */
***************
*** 30,37 ****
  #define BitsPerByteMask 0x7
  #define BitsPerByteShift 3
  
! #define GCallbits ((1L<<(GCLastBit+1))-1)
! 
  /*
   *	Note that ROUNDUP evaluates Y twice.
   */
--- 30,36 ----
  #define BitsPerByteMask 0x7
  #define BitsPerByteShift 3
  
! #define BytesPerShot 2
  /*
   *	Note that ROUNDUP evaluates Y twice.
   */
***************
*** 104,114 ****
  
  /*
   *	I don't know why this is needed, but our sun seems to thing
!  *	and is or & vice versa. This is true even running X11R2
   */
  
! /*
! #if	defined(sun) || defined(USE_SUN)
  #define GXAND GXand
  #define GXOR GXor
  #else
--- 103,112 ----
  
  /*
   *	I don't know why this is needed, but our sun seems to thing
!  *	and is or & vice versa
   */
  
! #ifdef mc68000
  #define GXAND GXand
  #define GXOR GXor
  #else
***************
*** 115,124 ****
  #define GXAND GXor
  #define GXOR  GXand
  #endif
- */
  
- int Black_Pixel = 0;
- 
  main(argc, argv)
      int argc;
      char **argv;
--- 113,119 ----
***************
*** 159,165 ****
  		ProgName, XDisplayName(display));
  	exit(1);
      }
-     Black_Pixel = XBlackPixel(DISP, 0);
      
      if ((option = XGetDefault(DISP, ProgName, "ReverseVideo")) &&
  	strcmp(option, "on") == 0)
--- 154,159 ----
***************
*** 348,366 ****
   *	Based on the shrink factor, choose a shrink factor for the enlarged
   *	display
   */
      if (shrinkFactor[SHRINK_LARGE] == 0) {
  	shrinkFactor[SHRINK_LARGE] = shrinkFactor[SHRINK_NORMAL] / 2;
      }
      shrinkFactor[SHRINK_LARGE] = MIN(shrinkFactor[SHRINK_LARGE],
  				     shrinkFactor[SHRINK_NORMAL]-1);
      shrinkFactor[SHRINK_LARGE] = MAX(shrinkFactor[SHRINK_LARGE], 1);
      page_h[SHRINK_LARGE]=(rawDviHeight + shrinkFactor[SHRINK_LARGE] - 1)
  	/ shrinkFactor[SHRINK_LARGE];
      leaf_w[SHRINK_LARGE]=(rawDviWidth + shrinkFactor[SHRINK_LARGE] - 1)
  	/ shrinkFactor[SHRINK_LARGE];
  /*
   *	Compute the page size given the number of leaves. We may have
!  *	to scale back if everything cant fit.
   */
      
      if (leaf_w[SHRINK_NORMAL] * Leaves <= maxWidth) {
--- 342,364 ----
   *	Based on the shrink factor, choose a shrink factor for the enlarged
   *	display
   */
+ 
      if (shrinkFactor[SHRINK_LARGE] == 0) {
  	shrinkFactor[SHRINK_LARGE] = shrinkFactor[SHRINK_NORMAL] / 2;
      }
+ 
      shrinkFactor[SHRINK_LARGE] = MIN(shrinkFactor[SHRINK_LARGE],
  				     shrinkFactor[SHRINK_NORMAL]-1);
      shrinkFactor[SHRINK_LARGE] = MAX(shrinkFactor[SHRINK_LARGE], 1);
+ 
      page_h[SHRINK_LARGE]=(rawDviHeight + shrinkFactor[SHRINK_LARGE] - 1)
  	/ shrinkFactor[SHRINK_LARGE];
      leaf_w[SHRINK_LARGE]=(rawDviWidth + shrinkFactor[SHRINK_LARGE] - 1)
  	/ shrinkFactor[SHRINK_LARGE];
+ 
  /*
   *	Compute the page size given the number of leaves. We may have
!  *	to scale back if everything can't fit.
   */
      
      if (leaf_w[SHRINK_NORMAL] * Leaves <= maxWidth) {
***************
*** 378,385 ****
      highpix = XCreateGC(DISP, RootWindow(DISP, defaultScreen), 0, NULL);
      forepix = XCreateGC(DISP, RootWindow(DISP, defaultScreen), 0, NULL);
      
!     XCopyGC(DISP, DefaultGC(DISP, 0), GCallbits, highpix);
!     XCopyGC(DISP, highpix, GCallbits, forepix);
      
      if (reverse) {
  	
--- 376,383 ----
      highpix = XCreateGC(DISP, RootWindow(DISP, defaultScreen), 0, NULL);
      forepix = XCreateGC(DISP, RootWindow(DISP, defaultScreen), 0, NULL);
      
!     XCopyGC(DISP, DefaultGC(DISP, 0), (1L<<(GCLastBit+1))-1, highpix);
!     XCopyGC(DISP, highpix, (1L<<(GCLastBit+1))-1, forepix);
      
      if (reverse) {
  	
***************
*** 388,400 ****
  	backpix = BlackPixel(DISP, defaultScreen);
  	bdrpix  = WhitePixel(DISP, defaultScreen);
  	mouspix = WhitePixel(DISP, defaultScreen);
!         if (Black_Pixel) {
! 	    XSetFunction(DISP, forepix, GXand); /* or */
! 	    XSetFunction(DISP, highpix, GXand);
! 	} else {
! 	    XSetFunction(DISP, forepix, GXor); /* or */
! 	    XSetFunction(DISP, highpix, GXor);
! 	}	
      } else {
  	
  	XSetForeground(DISP, forepix, BlackPixel(DISP, defaultScreen));
--- 386,394 ----
  	backpix = BlackPixel(DISP, defaultScreen);
  	bdrpix  = WhitePixel(DISP, defaultScreen);
  	mouspix = WhitePixel(DISP, defaultScreen);
! 	XSetFunction(DISP, forepix, GXAND); /* or */
! 	XSetFunction(DISP, highpix, GXAND);
! 	
      } else {
  	
  	XSetForeground(DISP, forepix, BlackPixel(DISP, defaultScreen));
***************
*** 402,414 ****
  	backpix = WhitePixel(DISP, defaultScreen);
  	bdrpix  = BlackPixel(DISP, defaultScreen);
  	mouspix = BlackPixel(DISP, defaultScreen);
!         if (Black_Pixel) {
! 	    XSetFunction(DISP, forepix, GXor); /* and */
! 	    XSetFunction(DISP, highpix, GXor);
! 	} else {
! 	    XSetFunction(DISP, forepix, GXand); /* and */
! 	    XSetFunction(DISP, highpix, GXand);
! 	}	
      }
      
      if (DisplayCells(DISP, 0) > 2) {
--- 396,403 ----
  	backpix = WhitePixel(DISP, defaultScreen);
  	bdrpix  = BlackPixel(DISP, defaultScreen);
  	mouspix = BlackPixel(DISP, defaultScreen);
! 	XSetFunction(DISP, forepix, GXOR); /* and */
! 	XSetFunction(DISP, highpix, GXOR);
      }
      
      if (DisplayCells(DISP, 0) > 2) {
***************
*** 486,492 ****
      XFlush(DISP);
  
      specialGC = XCreateGC(DISP, RootWindow(DISP, defaultScreen), 0, NULL);
!     XCopyGC(DISP, forepix, GCallbits, specialGC);
      
      mainLoop();
      stop_output(0);
--- 475,481 ----
      XFlush(DISP);
  
      specialGC = XCreateGC(DISP, RootWindow(DISP, defaultScreen), 0, NULL);
!     XCopyGC(DISP, forepix, (1L<<(GCLastBit+1))-1, specialGC);
      
      mainLoop();
      stop_output(0);
***************
*** 533,541 ****
  		ProgName, shrinkSize);
  	exit(1);
      }
      XFillRectangle(DISP, pasteUpPixmap[shrinkSize][leaf], pasteFillGC, 0, 0,
  		   leaf_w[shrinkSize], page_h[shrinkSize]);
-     XSync(DISP, 0);
  }
  
  static void
--- 522,530 ----
  		ProgName, shrinkSize);
  	exit(1);
      }
+ 
      XFillRectangle(DISP, pasteUpPixmap[shrinkSize][leaf], pasteFillGC, 0, 0,
  		   leaf_w[shrinkSize], page_h[shrinkSize]);
  }
  
  static void
***************
*** 550,562 ****
  allocatePixmaps()
  {
      int i;
-     XWindowAttributes wa;
  
-     XGetWindowAttributes(DISP, RootWindow(DISP,0), &wa);
      for (i = 0; i < Leaves; i++ ) {
  	pasteUpPixmap[SHRINK_NORMAL][i] =
  	    XCreatePixmap(DISP, win, leaf_w[SHRINK_NORMAL],
! 			  page_h[SHRINK_NORMAL], wa.depth);
  	if (pasteUpPixmap[SHRINK_NORMAL][i] == 0) {
  	    fprintf(stderr,"[%s] erp! out of PIXMAP memory!\n",
  		    ProgName);
--- 539,550 ----
  allocatePixmaps()
  {
      int i;
  
      for (i = 0; i < Leaves; i++ ) {
  	pasteUpPixmap[SHRINK_NORMAL][i] =
  	    XCreatePixmap(DISP, win, leaf_w[SHRINK_NORMAL],
! 			  page_h[SHRINK_NORMAL], 1);
! 
  	if (pasteUpPixmap[SHRINK_NORMAL][i] == 0) {
  	    fprintf(stderr,"[%s] erp! out of PIXMAP memory!\n",
  		    ProgName);
***************
*** 569,576 ****
      if (pasteFillGC == 0) {
  	pasteFillGC = XCreateGC(DISP, RootWindow(DISP, defaultScreen),0,NULL);
  	pasteCopyGC = XCreateGC(DISP, RootWindow(DISP, defaultScreen),0,NULL);
! 	XCopyGC(DISP, forepix, GCallbits, pasteFillGC);
! 	XCopyGC(DISP, forepix, GCallbits, pasteCopyGC);
  	if (reverse) {
  	    XSetForeground(DISP, pasteFillGC, BlackPixel(DISP, defaultScreen));
  	} else {
--- 557,564 ----
      if (pasteFillGC == 0) {
  	pasteFillGC = XCreateGC(DISP, RootWindow(DISP, defaultScreen),0,NULL);
  	pasteCopyGC = XCreateGC(DISP, RootWindow(DISP, defaultScreen),0,NULL);
! 	XCopyGC(DISP, forepix, (1L<<(GCLastBit+1))-1, pasteFillGC);
! 	XCopyGC(DISP, forepix, (1L<<(GCLastBit+1))-1, pasteCopyGC);
  	if (reverse) {
  	    XSetForeground(DISP, pasteFillGC, BlackPixel(DISP, defaultScreen));
  	} else {
***************
*** 591,603 ****
  allocateLargePixmaps()
  {
      int i;
-     XWindowAttributes wa;
- 
-     XGetWindowAttributes(DISP, RootWindow(DISP,0), &wa);
      for (i = 0; i < Leaves; i++) {
  	pasteUpPixmap[SHRINK_LARGE][i] =
  	    XCreatePixmap(DISP, win, leaf_w[SHRINK_LARGE],
! 			  page_h[SHRINK_LARGE], wa.depth);
  
  	clearPixmap(i, SHRINK_LARGE);
      }
--- 579,588 ----
  allocateLargePixmaps()
  {
      int i;
      for (i = 0; i < Leaves; i++) {
  	pasteUpPixmap[SHRINK_LARGE][i] =
  	    XCreatePixmap(DISP, win, leaf_w[SHRINK_LARGE],
! 			  page_h[SHRINK_LARGE], 1);
  
  	clearPixmap(i, SHRINK_LARGE);
      }
***************
*** 675,681 ****
  displayLeaves()
  {
      int leaf;
- 
      XClearWindow(DISP,win);
      for (leaf = 0; leaf < Leaves; leaf++) {
  	XCopyArea(DISP, pasteUpPixmap[SHRINK_NORMAL][leaf], win, forepix,
--- 660,665 ----
***************
*** 683,689 ****
  		  leaf_w[SHRINK_NORMAL], page_h[SHRINK_NORMAL],
  		  leaf_w[SHRINK_NORMAL] * leaf, 0);
      }
- 
  }
  
  static void displayLeaf(leaf)
--- 667,672 ----
***************
*** 958,966 ****
  			     g->g_width, g->g_height,
  			     16, 0);
  
- 	image -> bitmap_unit = 8;
- 	image -> bitmap_bit_order = MSBFirst;
- 
  	shrunkenImages[currentShrink][key][charCode] = image;
      }
  
--- 941,946 ----
***************
*** 976,982 ****
  		  0, 0,
  		  x + currentLeaf * leaf_w[currentShrink], y,
  		  g->g_width, g->g_height);
- 	XSync(DISP, 0);
      }
  }
  
--- 956,961 ----
***************
*** 1056,1069 ****
  	XDrawLine(DISP, pasteUpPixmap[currentShrink][currentLeaf],
  		   specialGC, xconv(fx), yconv(fy), xconv(tx), yconv(ty));
      } else {
- 	int offset = currentLeaf * leaf_w[currentShrink];
  	XDrawLine(DISP, win,
! 		   specialGC,
! 		  xconv(fx) + offset, yconv(fy),
! 		  xconv(tx) + offset, yconv(ty));
      }
  }
  
  /*
   * Draw a dot at (x,y)
   */
--- 1035,1046 ----
  	XDrawLine(DISP, pasteUpPixmap[currentShrink][currentLeaf],
  		   specialGC, xconv(fx), yconv(fy), xconv(tx), yconv(ty));
      } else {
  	XDrawLine(DISP, win,
! 		   specialGC, xconv(fx), yconv(fy), xconv(tx), yconv(ty));
      }
  }
  
+ 
  /*
   * Draw a dot at (x,y)
   */
***************
*** 1082,1088 ****
  
  #ifdef UNDEF
  /*
!  *	This is the code as it appears in TeXsun. I dont have the time to
   *	make this do the shading in X-11. If someone does this, please post
   *	diffs to the net.
   *
--- 1059,1065 ----
  
  #ifdef UNDEF
  /*
!  *	This is the code as it appears in TeXsun. I don't have the time to
   *	make this do the shading in X-11. If someone does this, please post
   *	diffs to the net.
   *
***************
*** 1119,1129 ****
  		    PIX_SRC, shade_pr, 0, 0);
  	    }
  	    else {
- 		int offset = currentLeaf*leaf_w[currentShrink]
  		pw_replrop(ptube,
! 		    xconv(last_min_x) + pen_size + offset,
  		    yconv(last_min_y) + pen_size,
! 		    xconv(last_max_x) - xconv(last_min_x) - pen_size + offset,
  		    yconv(last_max_y) - yconv(last_min_y) - pen_size,
  		    PIX_SRC, shade_pr, 0, 0);
  	    }
--- 1096,1106 ----
  		    PIX_SRC, shade_pr, 0, 0);
  	    }
  	    else {
  		pw_replrop(ptube,
! 		    xconv(last_min_x) + currentLeaf*leaf_w[currentShrink]
! 			   + pen_size,
  		    yconv(last_min_y) + pen_size,
! 		    xconv(last_max_x) - xconv(last_min_x) - pen_size,
  		    yconv(last_max_y) - yconv(last_min_y) - pen_size,
  		    PIX_SRC, shade_pr, 0, 0);
  	    }
***************
*** 1207,1215 ****
  	    continue;
  	    
  	case Expose:
-             if ( event.xexpose.count > 0 ) break; /* no more flicker!
-                                                    * [eichin:19880328.1332EST]
-                                                    */
  	    string = "\f";
  	    nbytes = 1;
  	    break;
--- 1184,1189 ----

--
Dirk Grunwald
Univ. of Illinois
grunwald@flute.cs.uiuc.edu