[comp.text] bug fix for ctex lib/pkfont.c 2.7

chris@mimsy.UUCP (Chris Torek) (08/21/87)

If you are using my prerelease version of ctex and have pkfont
revision 2.7, here is a fix for embedded PK `special' commands.

RCS file: RCS/pkfont.c,v
retrieving revision 2.7
retrieving revision 2.8
diff -c2 -r2.7 -r2.8
*** /tmp/,RCSt1027687	Fri Aug 21 12:46:54 1987
--- /tmp/,RCSt2027687	Fri Aug 21 12:46:56 1987
***************
*** 6,10 ****
  
  #ifndef lint
! static char rcsid[] = "$Header: pkfont.c,v 2.7 87/06/16 18:28:31 chris Exp $";
  #endif
  
--- 6,10 ----
  
  #ifndef lint
! static char rcsid[] = "$Header: pkfont.c,v 2.8 87/08/21 12:44:28 chris Exp $";
  #endif
  
***************
*** 85,89 ****
  	int	pk_gleft;	/* number of valid glyphs left uninterpreted */
  	struct	cp pk_cpack[MAXSTD];	/* for characters in [0..MAXSTD) */
! 	struct	cp *pk_morec;		/* for characters in [MAXSTD..maxc) */
  };
  
--- 85,89 ----
  	int	pk_gleft;	/* number of valid glyphs left uninterpreted */
  	struct	cp pk_cpack[MAXSTD];	/* for characters in [0..MAXSTD) */
! 	struct	cp *pk_morec;		/* for characters in [MAXSTD..maxc] */
  };
  
***************
*** 276,280 ****
  
  	f->f_details = (char *) pk;
- 	skip_specials(f);	/* skip any special commands */
  
  	/* scan the characters, fail if necessary */
--- 276,279 ----
***************
*** 321,325 ****
  	register char *p;
  	register struct cp *cp;
- 	char *packet;
  	int type;
  
--- 320,323 ----
***************
*** 340,348 ****
  	/*
  	 * Loop through the packets until we reach a POST, skipping
! 	 * the glyph instructions themselves after each definition.
  	 */
! 	for (p = pk->pk_ptr; (c = pgetbyte(p)) != PK_POST; p += pl) {
! 		/* remember packet address for this character */
! 		packet = p - 1;
  
  		/*
--- 338,349 ----
  	/*
  	 * Loop through the packets until we reach a POST, skipping
! 	 * the glyph instructions themselves after each definition,
! 	 * and specials (if any) before each.
  	 */
! 	for (;; pk->pk_ptr = p + pl) {
! 		skip_specials(f);
! 		p = pk->pk_ptr;
! 		if ((c = pgetbyte(p)) == PK_POST)
! 			break;	/* whoops, done after all */
  
  		/*
***************
*** 392,396 ****
  			cp = &pk->pk_cpack[c];
  
! 		cp->cp_packet = packet;
  		cp->cp_type = type;
  
--- 393,397 ----
  			cp = &pk->pk_cpack[c];
  
! 		cp->cp_packet = pk->pk_ptr;
  		cp->cp_type = type;
  
***************
*** 425,430 ****
  		if (i < MAXSTD)
  			cp = &pk->pk_cpack[i];
! 		else
  			cp = &pk->pk_morec[i - MAXSTD];
  		p = cp->cp_packet;
  		if (p == NULL)	/* glyph is not valid */
--- 426,434 ----
  		if (i < MAXSTD)
  			cp = &pk->pk_cpack[i];
! 		else {
! 			if (i > pk->pk_maxc)
! 				panic("pk_getgly(%s, %d)", f->f_path, i);
  			cp = &pk->pk_morec[i - MAXSTD];
+ 		}
  		p = cp->cp_packet;
  		if (p == NULL)	/* glyph is not valid */
-- 
In-Real-Life: Chris Torek, Univ of MD Comp Sci Dept (+1 301 454 7690)
Domain:	chris@mimsy.umd.edu	Path:	seismo!mimsy!chris