[net.sources.bugs] TGRAPH

bruce@bnr-vpa.UUCP (11/06/86)

----------------------------------

	There are two bugs in the tgraph routines for SysVr2 curses,
which were distributed in net.sources a few days ago, and context
diff patches for both are below.

	The first is that the character storage in the structure
__g__ch_ is a char sized variable, which is insufficient, as it
must have 16 bits to hold the 7-bit character and 9-bit video
enhancements.  This is found in both tgraph.h and tgload.c.  No
doubt the previous version works by accident on some machines due
to word alignment considerations; it did not work here (HP9000 s500).

	The second is that the upper/lower right corner characters
are reversed at one point in tgload.c.

	Both bugs are fixed below, if your machine has at least 16
bits in a "short".  If not, change to "int".

-Bruce Townsend (bnr-vpa!bruce)

*** tgraph.h.old	Thu Nov  6 13:25:48 1986
--- tgraph.h	Thu Nov  6 13:31:42 1986
***************
*** 15,21
  
  extern struct __g__ch_ {
  	char g_name[6];
! 	char g_graph;
  } __graph[];
  
  #define ACS_HLINE	(__graph[0].g_graph)

--- 15,21 -----
  
  extern struct __g__ch_ {
  	char g_name[6];
! 	short g_graph;
  } __graph[];
  
  #define ACS_HLINE	(__graph[0].g_graph)


*** tgload.c.old	Thu Nov  6 13:25:47 1986
--- tgload.c	Thu Nov  6 13:31:47 1986
***************
*** 27,33
  
  struct graph {
  	char g_name[6];
! 	char g_graph;
  } __graph[] = {
  	"hor",		'-',
  	"vert",		'|',

--- 27,33 -----
  
  struct graph {
  	char g_name[6];
! 	short g_graph;
  } __graph[] = {
  	"hor",		'-',
  	"vert",		'|',
***************
*** 38,44
  	"dtee",		'+',
  	"ll",		'+',
  	"ul",		'+',
- 	"lr",		'+',
  	"ur",		'+',
  	"scan9",	'_',
  	"scan1",	'-',

--- 38,43 -----
  	"dtee",		'+',
  	"ll",		'+',
  	"ul",		'+',
  	"ur",		'+',
  	"lr",		'+',
  	"scan9",	'_',
***************
*** 40,45
  	"ul",		'+',
  	"lr",		'+',
  	"ur",		'+',
  	"scan9",	'_',
  	"scan1",	'-',
  	"up",		'^',

--- 39,45 -----
  	"ll",		'+',
  	"ul",		'+',
  	"ur",		'+',
+ 	"lr",		'+',
  	"scan9",	'_',
  	"scan1",	'-',
  	"up",		'^',
***************
*** 56,61
  	"block",	'#',
  	"",		'\0',
  };
  
  extern char *getenv();
  

--- 56,63 -----
  	"block",	'#',
  	"",		'\0',
  };
+ 
+ #endif ACS_DIAMOND
  
  extern char *getenv();
  
-- 
			Bruce Townsend (bnr-vpa!bruce)
			Bell-Northern Research,
			Ottawa, Ontario.
Phone:	(613) 726-3008
Mail path: {utzoo, utcs}!bnr-vpa!bruce