Local hacks from jaap.
SCCS-vsn: local/ditroff/ditroff.okeeffe/pic/arcgen.c 3.1
SCCS-vsn: local/ditroff/ditroff.okeeffe/pic/blockgen.c 3.1
SCCS-vsn: local/ditroff/ditroff.okeeffe/pic/boxgen.c 3.1
SCCS-vsn: local/ditroff/ditroff.okeeffe/pic/circgen.c 3.1
SCCS-vsn: local/ditroff/ditroff.okeeffe/pic/for.c 3.1
SCCS-vsn: local/ditroff/ditroff.okeeffe/pic/input.c 3.1
SCCS-vsn: local/ditroff/ditroff.okeeffe/pic/linegen.c 3.1
SCCS-vsn: local/ditroff/ditroff.okeeffe/pic/main.c 3.1
SCCS-vsn: local/ditroff/ditroff.okeeffe/pic/misc.c 3.1
SCCS-vsn: local/ditroff/ditroff.okeeffe/pic/movegen.c 3.1
SCCS-vsn: local/ditroff/ditroff.okeeffe/pic/pic.h 3.1
SCCS-vsn: local/ditroff/ditroff.okeeffe/pic/picy.y 3.1
SCCS-vsn: local/ditroff/ditroff.okeeffe/pic/pltroff.c 3.1
SCCS-vsn: local/ditroff/ditroff.okeeffe/pic/print.c 3.1
SCCS-vsn: local/ditroff/ditroff.okeeffe/pic/symtab.c 3.1
SCCS-vsn: local/ditroff/ditroff.okeeffe/pic/textgen.c 3.1
SCCS-vsn: local/ditroff/ditroff.okeeffe/pic/PS-PEmacros 3.1
SCCS-vsn: local/ditroff/ditroff.okeeffe/pic/UNDOC 3.1
17 files changed:
+May 85:
+
+"solid" is now a valid (though uninteresting) attribute.
+
+Mar 85:
+
+Limited amount of point arithmetic:
+ point +/- point
+works
+
-static char sccsid[] = "@(#)arcgen.c 2.1 (CWI) 85/07/23";
+static char sccsid[] = "@(#)arcgen.c 3.1 (CWI) 85/07/30";
#include <stdio.h>
#include <math.h>
#include "pic.h"
#include <stdio.h>
#include <math.h>
#include "pic.h"
-static char sccsid[] = "@(#)blockgen.c 2.1 (CWI) 85/07/23";
+static char sccsid[] = "@(#)blockgen.c 3.1 (CWI) 85/07/30";
#include <stdio.h>
#include "pic.h"
#include "y.tab.h"
#include <stdio.h>
#include "pic.h"
#include "y.tab.h"
with = PLACE;
break;
case AT:
with = PLACE;
break;
case AT:
ppos = ap->a_val.o;
curx = ppos->o_x;
cury = ppos->o_y;
ppos = ap->a_val.o;
curx = ppos->o_x;
cury = ppos->o_y;
-static char sccsid[] = "@(#)boxgen.c 2.1 (CWI) 85/07/23";
+static char sccsid[] = "@(#)boxgen.c 3.1 (CWI) 85/07/30";
#include <stdio.h>
#include "pic.h"
#include "y.tab.h"
#include <stdio.h>
#include "pic.h"
#include "y.tab.h"
-static char sccsid[] = "@(#)circgen.c 2.1 (CWI) 85/07/23";
+static char sccsid[] = "@(#)circgen.c 3.1 (CWI) 85/07/30";
#include <stdio.h>
#include "pic.h"
#include "y.tab.h"
#include <stdio.h>
#include "pic.h"
#include "y.tab.h"
-static char sccsid[] = "@(#)for.c 2.1 (CWI) 85/07/23";
+static char sccsid[] = "@(#)for.c 3.1 (CWI) 85/07/30";
#include <stdio.h>
#include "pic.h"
#include "y.tab.h"
#include <stdio.h>
#include "pic.h"
#include "y.tab.h"
-static char sccsid[] = "@(#)input.c 2.1 (CWI) 85/07/23";
+static char sccsid[] = "@(#)input.c 3.1 (CWI) 85/07/30";
#include <stdio.h>
#include <ctype.h>
#include <errno.h>
#include <stdio.h>
#include <ctype.h>
#include <errno.h>
-static char sccsid[] = "@(#)linegen.c 2.1 (CWI) 85/07/23";
+static char sccsid[] = "@(#)linegen.c 3.1 (CWI) 85/07/30";
#include <stdio.h>
#include "pic.h"
#include "y.tab.h"
#include <stdio.h>
#include "pic.h"
#include "y.tab.h"
if (chop) {
if (chop == 1 && chop1 == 0) /* just said "chop", so use default */
chop1 = chop2 = getfval("circlerad");
if (chop) {
if (chop == 1 && chop1 == 0) /* just said "chop", so use default */
chop1 = chop2 = getfval("circlerad");
- theta = atan2((float) defy, (float) defx);
+ theta = atan2(dy[0], dx[0]);
x0 = chop1 * cos(theta);
y0 = chop1 * sin(theta);
curx += x0;
cury += y0;
x0 = chop1 * cos(theta);
y0 = chop1 * sin(theta);
curx += x0;
cury += y0;
+ dx[0] -= x0;
+ dy[0] -= y0;
+
+ theta = atan2(dy[ndxy-1], dx[ndxy-1]);
x1 = chop2 * cos(theta);
y1 = chop2 * sin(theta);
nx -= x1;
ny -= y1;
x1 = chop2 * cos(theta);
y1 = chop2 * sin(theta);
nx -= x1;
ny -= y1;
- dx[0] -= x0;
- dy[0] -= y0;
dx[ndxy-1] -= x1;
dy[ndxy-1] -= y1;
dprintf("chopping %g %g %g %g; cur=%g,%g end=%g,%g\n",
dx[ndxy-1] -= x1;
dy[ndxy-1] -= y1;
dprintf("chopping %g %g %g %g; cur=%g,%g end=%g,%g\n",
-static char sccsid[] = "@(#)main.c 2.1 (CWI) 85/07/23";
+static char sccsid[] = "@(#)main.c 3.1 (CWI) 85/07/30";
#include <stdio.h>
#include <signal.h>
#include "pic.h"
#include <stdio.h>
#include <signal.h>
#include "pic.h"
int nobjlist = 0; /* size of objlist array */
int nobj = 0;
int nobjlist = 0; /* size of objlist array */
int nobj = 0;
-Attr *attr; /* attributes stored here as collected */
+Attr *attr; /*;attributes stored here as collected */
int nattrlist = 0;
int nattr = 0; /* number of entries in attr_list */
int nattrlist = 0;
int nattr = 0; /* number of entries in attr_list */
-static char sccsid[] = "@(#)misc.c 2.1 (CWI) 85/07/23";
+static char sccsid[] = "@(#)misc.c 3.1 (CWI) 85/07/30";
#include <stdio.h>
#include "pic.h"
#include "y.tab.h"
#include <stdio.h>
#include "pic.h"
#include "y.tab.h"
switch (p->o_type) {
case BOX:
case BLOCK:
switch (p->o_type) {
case BOX:
case BLOCK:
return p->o_val[0];
case CIRCLE:
case ELLIPSE:
return p->o_val[0];
case CIRCLE:
case ELLIPSE:
switch (p->o_type) {
case BOX:
case BLOCK:
switch (p->o_type) {
case BOX:
case BLOCK:
return p->o_val[1];
case CIRCLE:
case ELLIPSE:
return p->o_val[1];
case CIRCLE:
case ELLIPSE:
break;
case BOX:
case BLOCK:
break;
case BOX:
case BLOCK:
switch (corner) {
case NORTH: y += y1 / 2; break;
case SOUTH: y -= y1 / 2; break;
switch (corner) {
case NORTH: y += y1 / 2; break;
case SOUTH: y -= y1 / 2; break;
+float getblkvar(p, s) /* find variable s2 in block p */
+ obj *p;
+ char *s;
+{
+ YYSTYPE y, getblk();
+
+ y = getblk(p, s);
+ return y.f;
+}
+
obj *getblock(p, s) /* find variable s in block p */
obj *p;
char *s;
{
obj *getblock(p, s) /* find variable s in block p */
obj *p;
char *s;
{
+ YYSTYPE y, getblk();
+
+ y = getblk(p, s);
+ return y.o;
+}
+
+YYSTYPE getblk(p, s) /* find union type for s in p */
+ obj *p;
+ char *s;
+{
+ static YYSTYPE bug;
struct symtab *stp;
if (p->o_type != BLOCK) {
yyerror(".%s is not in that block", s);
struct symtab *stp;
if (p->o_type != BLOCK) {
yyerror(".%s is not in that block", s);
}
for (stp = p->o_symtab; stp != NULL; stp = stp->s_next)
if (strcmp(s, stp->s_name) == 0) {
}
for (stp = p->o_symtab; stp != NULL; stp = stp->s_next)
if (strcmp(s, stp->s_name) == 0) {
- dprintf("getblock found x,y= %g,%g\n",
+ dprintf("getblk found x,y= %g,%g\n",
(stp->s_val.o)->o_x, (stp->s_val.o)->o_y);
(stp->s_val.o)->o_x, (stp->s_val.o)->o_y);
}
yyerror("there is no .%s in that []", s);
}
yyerror("there is no .%s in that []", s);
-static char sccsid[] = "@(#)movegen.c 2.1 (CWI) 85/07/23";
+static char sccsid[] = "@(#)movegen.c 3.1 (CWI) 85/07/30";
#include <stdio.h>
#include "pic.h"
#include "y.tab.h"
#include <stdio.h>
#include "pic.h"
#include "y.tab.h"
#define dprintf if(dbg)printf
#define dprintf if(dbg)printf
+#ifndef PI
+#define PI 3.141592654
+#endif
#define HEAD12 (HEAD1+HEAD2)
#define INVIS 4
#define CW_ARC 8 /* clockwise arc */
#define HEAD12 (HEAD1+HEAD2)
#define INVIS 4
#define CW_ARC 8 /* clockwise arc */
-#ifndef PI
-#define PI 3.141592654
-#endif
#define DOTBIT 16
#define DASHBIT 32
#define DOTBIT 16
#define DASHBIT 32
extern int hvmode;
extern int codegen;
extern char *malloc(), *realloc(), *tostring(), *grow();
extern int hvmode;
extern int codegen;
extern char *malloc(), *realloc(), *tostring(), *grow();
-extern float getfval(), getcomp();
+extern float getfval(), getcomp(), getblkvar();
extern YYSTYPE getvar();
extern struct symtab *lookup(), *makevar();
extern char *ifstat(), *delimstr(), *sprintgen();
extern YYSTYPE getvar();
extern struct symtab *lookup(), *makevar();
extern char *ifstat(), *delimstr(), *sprintgen();
| position '-' expr ',' expr { $$ = fixpos($1, -$3, -$5); }
| position '+' '(' expr ',' expr ')' { $$ = fixpos($1, $4, $6); }
| position '-' '(' expr ',' expr ')' { $$ = fixpos($1, -$4, -$6); }
| position '-' expr ',' expr { $$ = fixpos($1, -$3, -$5); }
| position '+' '(' expr ',' expr ')' { $$ = fixpos($1, $4, $6); }
| position '-' '(' expr ',' expr ')' { $$ = fixpos($1, -$4, -$6); }
+ | position '+' place { $$ = addpos($1, $3); }
+ | position '-' place { $$ = subpos($1, $3); }
| '(' place ',' place ')' { $$ = makepos(getcomp($2,DOTX), getcomp($4,DOTY)); }
| expr LT position ',' position GT { $$ = makebetween($1, $3, $5); }
| expr BETWEEN position AND position { $$ = makebetween($1, $3, $5); }
| '(' place ',' place ')' { $$ = makepos(getcomp($2,DOTX), getcomp($4,DOTY)); }
| expr LT position ',' position GT { $$ = makebetween($1, $3, $5); }
| expr BETWEEN position AND position { $$ = makebetween($1, $3, $5); }
yyerror("division by 0"); $3 = 1; }
$$ = $1 / $3; }
| expr '%' expr { if ((long)$3 == 0) {
yyerror("division by 0"); $3 = 1; }
$$ = $1 / $3; }
| expr '%' expr { if ((long)$3 == 0) {
- yyerror("mod does division by 0"); $3 = 1; }
+ yyerror("mod division by 0"); $3 = 1; }
$$ = (long)$1 % (long)$3; }
| '-' expr %prec UMINUS { $$ = -$2; }
| '(' expr ')' { $$ = $2; }
$$ = (long)$1 % (long)$3; }
| '-' expr %prec UMINUS { $$ = -$2; }
| '(' expr ')' { $$ = $2; }
| place DOTHT { $$ = getcomp($1, $2); }
| place DOTWID { $$ = getcomp($1, $2); }
| place DOTRAD { $$ = getcomp($1, $2); }
| place DOTHT { $$ = getcomp($1, $2); }
| place DOTWID { $$ = getcomp($1, $2); }
| place DOTRAD { $$ = getcomp($1, $2); }
+ | PLACENAME '.' VARNAME { y = getvar($1); $$ = getblkvar(y.o, $3); }
+ | last BLOCK '.' VARNAME { $$ = getblkvar(getlast($1,$2), $4); }
+ | NTH BLOCK '.' VARNAME { $$ = getblkvar(getfirst($1,$2), $4); }
| expr GT expr { $$ = $1 > $3; }
| expr LT expr { $$ = $1 < $3; }
| expr LE expr { $$ = $1 <= $3; }
| expr GT expr { $$ = $1 > $3; }
| expr LT expr { $$ = $1 < $3; }
| expr LE expr { $$ = $1 <= $3; }
-static char sccsid[] = "@(#)pltroff.c 2.1 (CWI) 85/07/23";
+static char sccsid[] = "@(#)pltroff.c 3.1 (CWI) 85/07/30";
#include <stdio.h>
#include <math.h>
#include "pic.h"
#include <stdio.h>
#include <math.h>
#include "pic.h"
+spline(x, y, n, p, dashed, ddval)
float x, y, *p;
float n; /* sic */
float x, y, *p;
float n; /* sic */
+ int dashed;
+ float ddval;
{
int i;
float dx, dy;
float xerr, yerr;
{
int i;
float dx, dy;
float xerr, yerr;
+ if (dashed && ddval)
+ printf(".nr 99 %.3fi\n", ddval);
+ if (dashed) {
+ if (ddval)
+ printf("\\X'Pd \\n(99'\\D'q 0 0");
+ else
+ printf("\\X'Pd'\\D'q 0 0");
+ } else
+ printf("\\D'~");
for (i = 0; i < 2 * n; i += 2) {
dx = xsc(xerr += p[i]);
xerr -= dx/xscale;
for (i = 0; i < 2 * n; i += 2) {
dx = xsc(xerr += p[i]);
xerr -= dx/xscale;
yerr -= dy/yscale;
printf(" %.3fi %.3fi", dx, -dy); /* WATCH SIGN */
}
yerr -= dy/yscale;
printf(" %.3fi %.3fi", dx, -dy); /* WATCH SIGN */
}
+ if (dashed)
+ printf(" 0 0'\\X'Ps'\n");
+ else
+ printf("'\n");
-static char sccsid[] = "@(#)print.c 2.1 (CWI) 85/07/23";
+static char sccsid[] = "@(#)print.c 3.1 (CWI) 85/07/30";
#include <stdio.h>
#include "pic.h"
#include "y.tab.h"
#include <stdio.h>
#include "pic.h"
#include "y.tab.h"
if (p->o_attr & INVIS)
move(x1, y1);
else if (p->o_type == SPLINE)
if (p->o_attr & INVIS)
move(x1, y1);
else if (p->o_type == SPLINE)
- spline(ox, oy, p->o_val[4], &p->o_val[5]);
+ spline(ox, oy, p->o_val[4], &p->o_val[5], p->o_attr & (DOTBIT|DASHBIT), p->o_ddval);
-static char sccsid[] = "@(#)symtab.c 2.1 (CWI) 85/07/23";
+static char sccsid[] = "@(#)symtab.c 3.1 (CWI) 85/07/30";
#include <stdio.h>
#include <ctype.h>
#include "pic.h"
#include <stdio.h>
#include <ctype.h>
#include "pic.h"
-static char sccsid[] = "@(#)textgen.c 2.1 (CWI) 85/07/23";
+static char sccsid[] = "@(#)textgen.c 3.1 (CWI) 85/07/30";
#include <stdio.h>
#include "pic.h"
#include "y.tab.h"
#include <stdio.h>
#include "pic.h"
#include "y.tab.h"