X-url: <http://www.isi.edu/~johnh/>
To: Paul Walker <pwalker@ncsa.uiuc.edu>
Subject: xgraph port to linux
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="----- =_aaaaaaaaaa0"
Content-ID: <4158.865968417.0@dash.isi.edu>
Date: Tue, 10 Jun 1997 11:47:35 -0700
From: John Heidemann <johnh@dash.isi.edu>

------- =_aaaaaaaaaa0
Content-Type: text/plain; charset="us-ascii"
Content-ID: <4158.865968417.1@dash.isi.edu>

Attached are patches to the current release of xgraph to port it to
Linux.  It think they'll be useful elsewhere to (probably at least
with *BSD), they generally seem to improve Posix-ness.
Also derivative.* was missing from the Imakefile

Also, the current xgraph dies on the surface{,2}.xg sample data sets
for me.  Here's the traceback:

	(gdb) run examples/surface.xg
	Starting program: /usr/src/MISC/xgraph/xgraph examples/surface.xg
	warning: Unable to find dynamic linker breakpoint function.
	warning: GDB will be unable to debug shared library initializers
	warning: and track explicitly loaded dynamic code.
	
	Program received signal SIGSEGV, Segmentation fault.
	0x805b2dc in Der1 () at derivative.c:33
	(gdb) p theList
	$1 = (PointList *) 0x806e700
	(gdb) p D1List
	$2 = (PointList *) 0x82445d8
	(gdb) p D2List
	$3 = (PointList *) 0x0
	(gdb) bt
	#0  0x805b2dc in Der1 () at derivative.c:33
	#1  0x805ad15 in ReadData (stream=0x806e660, 
	    filename=0xbffffaf1 "examples/surface.xg") at read.c:342
	#2  0x8049e6e in main (argc=2, argv=0xbffff9ac) at xgraph.c:130
	#3  0x8049ccb in ___crt_dummy__ ()
	(gdb) 

Finally, if you want I can send you a Linux ELF binary.

   -John


------- =_aaaaaaaaaa0
Content-Type: text/plain; charset="us-ascii"
Content-ID: <4158.865968417.2@dash.isi.edu>
Content-Description: xgraph.patch

diff -u xgraph-/Imakefile xgraph/Imakefile
--- xgraph-/Imakefile	Tue Jun 11 12:14:13 1991
+++ xgraph/Imakefile	Tue Jun 10 11:21:06 1997
@@ -30,10 +30,10 @@
   SYS_LIBRARIES = -lm
            SRCS = xgraph.c xgX.c hard_devices.c dialog.c hpgl.c \
 		  ps.c idraw.c xtb.c st.c params.c alloc.c draw.c \
-		  init.c read.c tgif.c
+		  init.c read.c tgif.c derivative.c
            OBJS = xgraph.o xgX.o hard_devices.o dialog.o hpgl.o \
 		  ps.o idraw.o xtb.o st.o params.o alloc.o draw.o \
-		  init.o read.o tgif.o
+		  init.o read.o tgif.o derivative.o
 
 ComplexProgramTarget(xgraph)
 
diff -u xgraph-/xgraph.h xgraph/xgraph.h
--- xgraph-/xgraph.h	Tue Oct 12 09:53:50 1993
+++ xgraph/xgraph.h	Tue Jun 10 11:45:58 1997
@@ -28,6 +28,8 @@
 #define HARDCOPY_IN_PROGRESS	0x01
 
 /* Portability */
+#include <math.h>   /* try to get MAXFLOAT */
+
 #ifdef  CRAY
 #undef  MAXFLOAT
 #define MAXFLOAT 10.e300
@@ -144,7 +146,17 @@
 /* To make lint happy */
 extern char *Malloc();
 extern char *Realloc();
-#ifdef _AIX370
+extern void Free();
+#ifdef _POSIX_SOURCE
+/*
+ * Get definitions from headers.
+ */
+#include <stdio.h>   /* sprintf */
+#include <string.h>  /* str* */
+#include <unistd.h>  /* exit, abort */
+#include <stdlib.h>  /* atof */
+#else /* ! _POSIX_SOURCE */
+#if defined(_AIX370)
 extern int sprintf();
 #else
 extern char *sprintf();
@@ -154,8 +166,8 @@
 extern char *rindex();
 extern char *index();
 extern void exit();
-extern void Free();
 extern double atof();
 extern void abort();
+#endif /* _POSIX_SOURCE */
 
 #endif				/* _XGRAPH_H_ */

------- =_aaaaaaaaaa0--

