Path: utzoo!attcan!utgpu!jarvis.csri.toronto.edu!mailrus!cs.utexas.edu!uunet!mcsun!hafro!gunnar
From: gunnar@hafro.is (Gunnar Stefansson)
Newsgroups: comp.sources.bugs
Subject: Patch 2 to Reldb - Relational database and graphing tools
Keywords: reldb, graphics, scat, plot, database
Message-ID: <138@hafro.is>
Date: 26 Sep 89 12:08:29 GMT
Organization: Marine Research Institute, Reykjavik
Lines: 1617
This is patch 2 to Reldb.
These patches include some corrections to problems that occurred during
distribution (in particular, a newline was missing in one of the
doc-files, causing strange things). Also included are changes
to the plot(1)-filters, xplot, hpglplot and plot itself. Xplot in now
much better than before, and several new extensions have been added to
the standard plot(5)-commands.
Remember to apply patch 1 before this.
cd to where you keep the Reldb programs and run this through 'patch -p'.
Please let me know asap of any problems.
*** patchlevel.h Tue Sep 26 11:26:00 1989
--- patchlevel.h Tue Sep 26 11:40:23 1989
Prereq: 1
***************
*** 1 ****
! #define PATCHLEVEL 1
--- 1 ----
! #define PATCHLEVEL 2
*** doc/scat.1 Tue Sep 26 11:25:08 1989
--- doc/scat.1 Mon Sep 25 22:31:12 1989
***************
*** 59,60 ****
--- 59,76 ----
[
+ .B \-T
+ "x number"
+ ]
+ [
+ .B \-T
+ "y number"
+ ]
+ [
+ .B \-t
+ "x number"
+ ]
+ [
+ .B \-t
+ "y number"
+ ]
+ [
.B \-d
***************
*** 187,188 ****
--- 203,217 ----
.I name.
+ .TP
+ .BI \-T\ xnumber
+ Number of large tick marks on x-axis.
+ .TP
+ .BI \-T\ ynumber
+ Number of large tick marks on y-axis.
+ .TP
+ .BI \-t\ xnumber
+ Number of small tick marks between large tick marks on x-axis.
+ .TP
+ .BI \-t\ xnumber
+ Number of small tick marks between large tick marks on y-axis.
+ .B
.TP
*** doc/subtotal.1 Tue Sep 26 11:25:09 1989
--- doc/subtotal.1 Mon Sep 25 21:01:49 1989
***************
*** 56,117 ****
.I addcol
! to do the work. This is inefficient but the inefficiency is rarely noticable.\Rogue\Monster\
! else
! echo "will not over write ./doc/subtotal.1"
! fi
! if `test ! -s ./doc/union.1`
! then
! echo "writting ./doc/union.1"
! cat > ./doc/union.1 << '\Rogue\Monster\'
! .\" Man page for union(1)
! .TH UNION 1 "1. April 1989"
! .SH NAME
! union - appends one table to another
! .SH SYNOPSIS
! .B union
! .I file1\ file2
! [
! .I >\ outputfile
! ]
! .SH DESCRIPTION
! .LP
! The
! .I union
! command simply concatenates two files, appending the second to the
! first, but using only the header of the first file.
! .LP
! With the two files,
! .I data1:
! .nf
! first second third
! ----- ------ -----
! 1 3 0
! 1 2 3
! .fi
! and
! .I data2:
! .nf
! first second third
! ----- ------ -----
! 2 3 4
! 3 4 5
! 4 5 6
! .fi
! the
! command
! .BI union\ data1\ data2
! yields:
! .nf
! first second third
! ----- ------ -----
! 1 3 0
! 1 2 3
! 2 3 4
! 3 4 5
! 4 5 6
! .fi
! on the standard output.
! .LP
! Note that the two input files must have the same columns,
! in the same order.
! .SH "SEE ALSO"
! .BR reldb(1)\ cat(1).
--- 56,57 ----
.I addcol
! to do the work. This is inefficient but the inefficiency is rarely noticable.
*** /dev/null Tue Sep 26 10:45:31 1989
--- doc/union.1 Wed Apr 19 10:58:05 1989
***************
*** 0 ****
--- 1,53 ----
+ .\" Man page for union(1)
+ .TH UNION 1 "1. April 1989"
+ .SH NAME
+ union - appends one table to another
+ .SH SYNOPSIS
+ .B union
+ .I file1\ file2
+ [
+ .I >\ outputfile
+ ]
+ .SH DESCRIPTION
+ .LP
+ The
+ .I union
+ command simply concatenates two files, appending the second to the
+ first, but using only the header of the first file.
+ .LP
+ With the two files,
+ .I data1:
+ .nf
+ first second third
+ ----- ------ -----
+ 1 3 0
+ 1 2 3
+ .fi
+ and
+ .I data2:
+ .nf
+ first second third
+ ----- ------ -----
+ 2 3 4
+ 3 4 5
+ 4 5 6
+ .fi
+ the
+ command
+ .BI union\ data1\ data2
+ yields:
+ .nf
+ first second third
+ ----- ------ -----
+ 1 3 0
+ 1 2 3
+ 2 3 4
+ 3 4 5
+ 4 5 6
+ .fi
+ on the standard output.
+ .LP
+ Note that the two input files must have the same columns,
+ in the same order.
+ .SH "SEE ALSO"
+ .BR reldb(1)\ cat(1).
*** plot1.src/README Tue Sep 26 11:25:12 1989
--- plot1.src/README Thu Sep 21 21:27:48 1989
***************
*** 21,25 ****
Graplot will take plot(5)-data and write output for the grap-program.
! This is extremely handy for putting into a troff-style paper.
! I (gunnar@hafro) apologize for not having gotten formal permission from
previous authors (notable Jim Constantine and Scott Sutherland)
--- 21,25 ----
Graplot will take plot(5)-data and write output for the grap-program.
! This is extremely handy for putting graphics into a troff-style paper.
! I (gunnar@hafro.is) apologize for not having gotten formal permission from
previous authors (notable Jim Constantine and Scott Sutherland)
*** plot1.src/hpglplot.c Tue Sep 26 11:25:12 1989
--- plot1.src/hpglplot.c Mon Sep 25 21:33:03 1989
***************
*** 1,2 ****
--- 1,20 ----
+ /* This is hpgl.c -- a collection of plot(3) routines */
+ /* which are called upon by the plotfilter.c-program */
+ /* */
+ /* These routines output HPGL plotting commands */
+ /* Some routines have been added to the standard */
+ /* plot(3)-library -- see below */
+ /* */
+ /* Contributors: */
+ /* */
+ /* Modified July 1989 by Jon von Tetzchner Stephenson */
+ /* Several mods added by asta@hafro.is, early 1989 */
+ /* See also comments in xplot.c */
+ /* HP-GL plot(5) library */
+ /* - does NOT do line locking */
+ /* - aspect ratio is not maintained */
+ /* Originally by: Jim Constantine */
+ /* Copyright 1985 Sun Microsystems Inc. */
+
#include
***************
*** 5,19 ****
! /* HP-GL plot(5) library */
! /* - does NOT do line locking */
! /* - aspect ratio is not maintained */
! /* Jim Constantine */
! /* Copyright 1985 Sun Microsystems Inc. */
! /* Extensions by asta@hafro.is (March, 1989) */
! /* Prepared for redistribution by gunnar@hafro.is */
! /* Notable features, which are really bugs: This
! program assumes it is writing to a device. That
! causes problems when writing to e.g. hpgl2ps filters.
! Use of some special HPGL escape sequences may also cause
! problems */
openpl()
--- 23,29 ----
! int loX=-999999,loY=-999999,hiX=999999,hiY=999999;
! int OUT=0;
! int saveX=-100,saveY=-100;
+
openpl()
***************
*** 32,35 ****
! /*printf("IN;\033.P1:"); /* out - gs */
! printf("IN;");
fflush(stdout);
--- 42,44 ----
! printf("IN;\033.P1:");
fflush(stdout);
***************
*** 42,44 ****
{
! printf("PU %d,%d;\n", x, y);
}
--- 51,57 ----
{
! OUT=check(&x,&y);
! saveX=x;
! saveY=y;
! if(! OUT)
! printf("PU %d,%d;\n", x, y);
}
***************
*** 47,49 ****
{
! printf("PU %d,%d PD %d,%d;\n", x1, y1, x2, y2);
}
--- 60,68 ----
{
! int out1,out2;
! out1=check(&x1,&y1);
! out2=check(&x2,&y2);
! if (! (out1 && out2))
! printf("PU %d,%d PD %d,%d;\n", x1, y1, x2, y2);
! saveX=x2;
! saveY=y2;
}
***************
*** 53,54 ****
--- 72,74 ----
{
+ printf("PU %d,%d;\n", saveX, saveY);
printf("LB%s\03;\n", s);
***************
*** 58,60 ****
{
! printf("PG;AF;\n"); /* feed page if paper has been writen on */
}
--- 78,80 ----
{
! printf("PG;AF;\n"); /* feed page if paper has been written on */
}
***************
*** 63,65 ****
{
! printf("PU %d,%d PD PU;\n", x, y);
}
--- 83,87 ----
{
! OUT=check(&x,&y);
! if (! OUT)
! printf("PU %d,%d PD PU;\n", x, y);
}
***************
*** 68,70 ****
{
! printf("PD %d,%d;\n", x, y);
}
--- 90,101 ----
{
! int outside;
! outside=check(&x,&y);
! if (! (outside && OUT))
! {
! OUT=outside;
! printf("PU %d,%d;\n", saveX, saveY);
! printf("PD %d,%d;\n", x, y);
! }
! saveX=x;
! saveY=y;
}
***************
*** 122,124 ****
labelrotation(s)
! char *s;
{
--- 153,155 ----
labelrotation(s)
! char *s;
{
***************
*** 171,173 ****
selectcolor(s)
! char *s;
{
--- 202,204 ----
selectcolor(s)
! int s;
{
***************
*** 174,178 ****
! switch(s[1]) {
! case '1': /* select pen 1 */
printf("SP 1;\n");
--- 205,209 ----
! switch(s) {
! case 1: /* select pen 1 */
printf("SP 1;\n");
***************
*** 180,182 ****
! case '2': /* select pen 2 */
printf("SP 2;\n");
--- 211,213 ----
! case 2: /* select pen 2 */
printf("SP 2;\n");
***************
*** 184,186 ****
! case '3': /* select pen 3 */
printf("SP 3;\n");
--- 215,217 ----
! case 3: /* select pen 3 */
printf("SP 3;\n");
***************
*** 188,190 ****
! case '4': /* select pen 4 */
printf("SP 4;\n");
--- 219,221 ----
! case 4: /* select pen 4 */
printf("SP 4;\n");
***************
*** 192,194 ****
! case '5': /* select pen 5 */
printf("SP 5;\n");
--- 223,225 ----
! case 5: /* select pen 5 */
printf("SP 5;\n");
***************
*** 196,198 ****
! case '6': /* select pen 6 */
printf("SP 6;\n");
--- 227,229 ----
! case 6: /* select pen 6 */
printf("SP 6;\n");
***************
*** 200,202 ****
! case '7': /* select pen 7 */
printf("SP 7;\n");
--- 231,233 ----
! case 7: /* select pen 7 */
printf("SP 7;\n");
***************
*** 204,206 ****
! case '8': /* select pen 8 */
printf("SP 8;\n");
--- 235,237 ----
! case 8: /* select pen 8 */
printf("SP 8;\n");
***************
*** 219 ****
--- 250,314 ----
+
+ /***********************************************************************
+ * check by jvts *
+ ***********************************************************************/
+
+ check(x,y)
+ int *x,*y;
+ {
+ int outside=0;
+ if (*x>hiX) {*x=hiX;outside=1;}
+ else if (*xhiY) {*y=hiY;outside=1;}
+ else if (*y
+ #include
***************
*** 25,26 ****
--- 29,46 ----
+ #define NUMLINES 5 /* for linemod */
+ #define DOTTED_LIST_LENGTH 2
+ #define DOT_DASHED_LIST_LENGTH 4
+ #define SHORT_DASHED_LIST_LENGTH 2
+ #define LONG_DASHED_LIST_LENGTH 2
+
+
+ /* When the window command is not called, these values are used . */
+ /* I hope they are large(small) enaugh. */
+
+ int loX=-999999,loY=-999999,hiX=999999,hiY=999999,oldX,oldY;
+
+ int OUT=0; /* was last drawing outside of window ? */
+
+ int gcnum=4; /* to chose linemod (4=linesolid) */
+
/* plot stuff */
***************
*** 31,33 ****
char *label_pl;
! int xheight, yheight, width;
int winX, winY, winW, winH;
--- 51,53 ----
char *label_pl;
! int xheight, yheight, width,xxwidth,xxheight;
int winX, winY, winW, winH;
***************
*** 65,67 ****
Window win; /* Window ID */
! GC gc; /* GC to draw with */
char *fontName; /* Name of the font to use */
--- 85,87 ----
Window win; /* Window ID */
! GC gc[NUMLINES]; /* GCs to draw with */
char *fontName; /* Name of the font to use */
***************
*** 75,78 ****
char *geomSpec; /* Window geometry string */
! XSetWindowAttributes xswa; /* Temporary Set Window Attribute struct
Window win;
--- 95,164 ----
char *geomSpec; /* Window geometry string */
! XSetWindowAttributes xswa; /* Temporary Set Window Attribute struct */
Window win;
+ int COLOR=0; /* Are we using a color displaay ?? */
+
+ #define MAX_COLORS 9 /* I use 9 colors, no problem to use more */
+ int colors[MAX_COLORS]; /* definitions of colors */
+ int VERTICAL=0;
+
+
+ /*************************************************************************
+ * get_colors is a routine that is called from openpl. It checks if the *
+ * display uses color and if so sets the COLOR variable to 1 (TRUE) *
+ *************************************************************************/
+
+ get_colors()
+ {
+ int depth;
+ Visual *visual;
+ static char *name[]={"Black","Blue","Red","Green","Yellow","Cyan","Pink","Orange","Gold"};
+ XColor exact_def;
+ Colormap cmap;
+ int ncolors=MAX_COLORS;
+
+ int i;
+
+ /* printf("in get colors\n"); */
+
+ depth=DisplayPlanes(dpy,DefaultScreen(dpy));
+ visual=DefaultVisual(dpy,DefaultScreen(dpy));
+ cmap=DefaultColormap(dpy,DefaultScreen(dpy));
+
+ if (depth==1)
+ {
+ /* printf("monocrome\n"); */
+ bd=BlackPixel(dpy,DefaultScreen(dpy));
+ bg=WhitePixel(dpy,DefaultScreen(dpy));
+ fg=BlackPixel(dpy,DefaultScreen(dpy));
+ }
+ else
+ {
+ for (i=0;imax_bounds.ascent + fontstruct->max_bounds.descent;
--- 193,206 ----
if ((fontName = XGetDefault(dpy, argv_copy[0], ARG_FONT)) == NULL) {
! fontName = FONT;
! }
!
if ((fontstruct = XLoadQueryFont(dpy, fontName)) == NULL) {
! if ((fontstruct = XLoadQueryFont(dpy,fontname2))==NULL)
! {
! fprintf(stderr, "%s: display %s doesn't know font %s\n",
! argv_copy[0], DisplayString(dpy), fontname2);
! exit(1);
! }
! }
!
fth = fontstruct->max_bounds.ascent + fontstruct->max_bounds.descent;
***************
*** 116,118 ****
! /*
* Select colors for the border, the window background, and the
--- 209,211 ----
! /*
* Select colors for the border, the window background, and the
***************
*** 120,124 ****
*/
! bd = BlackPixel(dpy, DefaultScreen(dpy));
! bg = WhitePixel(dpy, DefaultScreen(dpy));
! fg = BlackPixel(dpy, DefaultScreen(dpy));
--- 213,216 ----
*/
!
! get_colors();
***************
*** 144,146 ****
}
!
win = XCreateSimpleWindow(dpy, DefaultRootWindow(dpy),
--- 236,241 ----
}
!
! xxwidth=xsh.width;
! xxheight=xsh.height;
!
win = XCreateSimpleWindow(dpy, DefaultRootWindow(dpy),
***************
*** 171,184 ****
! /*
! * Create the GC for plotting. See Section 5.3.
! */
!
! gcv.font = fontstruct->fid;
! gcv.foreground = fg;
! gcv.background = bg;
! /* gcv.function=GXand;
! gcv.plane_mask=BlackPixel(dpy,DefaultScreen(dpy)) ^
! WhitePixel(dpy,DefaultScreen(dpy)); */
! gc = XCreateGC(dpy, win, (GCFont | GCForeground | GCBackground ), &gcv);
!
/*
--- 266,269 ----
! set_dashes();
!
/*
***************
*** 187,189 ****
*/
! XSelectInput(dpy, win, ExposureMask);
--- 272,274 ----
*/
! XSelectInput(dpy, win, ExposureMask| StructureNotifyMask);
***************
*** 193,197 ****
XMapWindow(dpy, win);
! XNextEvent(dpy, &event);
!
}
/************************************************************************/
--- 278,358 ----
XMapWindow(dpy, win);
!
! while(! done1)
! {
!
! XNextEvent(dpy,&event);
! switch(event.type)
! {
! case Expose:
!
! while (XCheckTypedEvent(dpy,Expose,&event)) ;
!
!
! done1=1;
!
! break;
!
! case ConfigureNotify:
!
! xxwidth=event.xconfigure.width;
! xxheight=event.xconfigure.height;
! break;
!
!
! default: /* all events selected by StructureNotifyMask except ConfigureNotify are */
! /* thrown away here, since nothing is done with them */
!
! done1=1; /* because of some problems with hafro */
! break;
! }
! }
!
!
}
+
+ /**********************************************************************/
+ /* set_dashes sets 5 diffrent gcs to be able to alter linemod quickly */
+ /* called by openpl */
+ /**********************************************************************/
+ set_dashes()
+ /*
+ * Create the GC for plotting. See Section 5.3.
+ */
+ {
+ int i;
+ static int dash_list_length[]=
+ {
+ DOTTED_LIST_LENGTH,
+ DOT_DASHED_LIST_LENGTH,
+ SHORT_DASHED_LIST_LENGTH,
+ LONG_DASHED_LIST_LENGTH
+ };
+
+ static unsigned char dotted[DOTTED_LIST_LENGTH]={3,1};
+ static unsigned char dot_dashed[DOT_DASHED_LIST_LENGTH]={3,4,3,1};
+ static unsigned char short_dashed[SHORT_DASHED_LIST_LENGTH]={4,4};
+ static unsigned char long_dashed[LONG_DASHED_LIST_LENGTH]={4,7};
+
+ static unsigned char *dash_list[]=
+ {
+ dotted,dot_dashed,short_dashed,long_dashed
+ };
+ int dash_offset=0;
+ gcv.font = fontstruct->fid;
+ gcv.foreground = fg;
+ gcv.background = bg;
+ /* gcv.function=GXand;
+ gcv.plane_mask=BlackPixel(dpy,DefaultScreen(dpy)) ^
+ WhitePixel(dpy,DefaultScreen(dpy)); */
+
+ gcv.line_style=LineOnOffDash;
+ for (i=0; imax_bounds.ascent;
! XDrawString(dpy, win, gc, x, y, s, strlen(s));
XFlush(dpy);
--- 516,518 ----
y=y-fth/2+fontstruct->max_bounds.ascent;
! XDrawString(dpy, win, gc[gcnum], x, y, s, strlen(s));
XFlush(dpy);
***************
*** 288,290 ****
y=y-fth/2+fontstruct->max_bounds.ascent;
! XDrawString(dpy, win, gc, x, y, s, strlen(s));
XFlush(dpy);
--- 523,525 ----
y=y-fth/2+fontstruct->max_bounds.ascent;
! XDrawString(dpy, win, gc[gcnum], x, y, s, strlen(s));
XFlush(dpy);
***************
*** 296,298 ****
/* y=y+fth/2; */
! XDrawString(dpy, win, gc, x, y, s, strlen(s));
XFlush(dpy);
--- 531,533 ----
/* y=y+fth/2; */
! XDrawString(dpy, win, gc[gcnum], x, y, s, strlen(s));
XFlush(dpy);
***************
*** 299,301 ****
break;
!
default: /* center the label at the point */
--- 534,536 ----
break;
!
default: /* center the label at the point */
***************
*** 304,306 ****
/* y=y+fth/2; */
! XDrawString(dpy, win, gc, x, y, s, strlen(s));
XFlush(dpy);
--- 539,541 ----
/* y=y+fth/2; */
! XDrawString(dpy, win, gc[gcnum], x, y, s, strlen(s));
XFlush(dpy);
***************
*** 316,318 ****
{
-
switch(s[1]) {
--- 551,552 ----
***************
*** 353,355 ****
/* labelrotation - a homemade function */
! /* not implemented */
/************************************************************************/
--- 587,589 ----
/* labelrotation - a homemade function */
! /* by jvts */
/************************************************************************/
***************
*** 362,363 ****
--- 596,598 ----
case 'h': /* horizontal */
+ VERTICAL=0;
break;
***************
*** 365,366 ****
--- 600,602 ----
case 'v': /* vertical */
+ VERTICAL=1;
break;
***************
*** 371,373 ****
/* selectcolor - a homemade function */
! /* not implemented */
/************************************************************************/
--- 607,609 ----
/* selectcolor - a homemade function */
! /* by jvts */
/************************************************************************/
***************
*** 374,407 ****
selectcolor(s)
! char *s;
{
!
! switch(s[1]) {
!
! case '1': /* select pen 1 */
! break;
!
! case '2': /* select pen 2 */
! break;
!
! case '3': /* select pen 3 */
! break;
!
! case '4': /* select pen 4 */
! break;
!
! case '5': /* select pen 5 */
! break;
!
! case '6': /* select pen 6 */
! break;
!
! case '7': /* select pen 7 */
! break;
!
! case '8': /* select pen 8 */
! break;
!
! default: /* select pen 1 */
! break;
! }
}
--- 610,624 ----
selectcolor(s)
! int s;
{
! int i;
! if (COLOR)
! {
! if (s>=0 && shiX) {*x=hiX;outside=1;}
+ else if (*xhiY) {*y=hiY;outside=1;}
+ else if (*y