Checkpoint.

This commit is contained in:
wkj 2004-05-16 07:57:50 +00:00
parent 5f1cf8e6fb
commit b237df90f9
19 changed files with 324 additions and 283 deletions

View file

@ -2,6 +2,10 @@
#include <stdlib.h>
#include <string.h>
#undef sqrt
#define sqrt p9_sqrt
#define YYSTYPE int /* DEC v. GNU garbage */
enum charclass {
OTHER, OLET, ILET, DIG, LPAR, RPAR, SLASH, PLUS, ILETF, ILETJ, VBAR,
NONE, LAST
@ -53,8 +57,8 @@ extern int lfont[];
extern int rfont[];
extern int lclass[];
extern int rclass[];
extern int yyval;
extern int yylval;
extern YYSTYPE yyval; /* DEC cc wants long */
extern YYSTYPE yylval; /* DEC cc wants long */
extern int eqnreg;
extern double eqnht;
extern int lefteq, righteq;
@ -152,7 +156,6 @@ extern void shift2(int, int, int);
extern void setsize(char *);
extern void size(int, int);
extern void globsize(void);
#define sqrt esqrt
extern void sqrt(int);
extern void text(int, char *);
extern void boverb(int, int);

View file

@ -56,7 +56,7 @@
#define DYAD 57401
#define UTILDE 57402
#line 17 "/usr/local/plan9/src/cmd/eqn/eqn.y"
#line 17 "/home/wkj/src/plan9/src/cmd/eqn/eqn.y"
#include "e.h"
int yylex(void);
@ -72,7 +72,7 @@ YYSTYPE yyval;
#define YYEOFCODE 1
#define YYERRCODE 2
#line 140 "/usr/local/plan9/src/cmd/eqn/eqn.y"
#line 140 "/home/wkj/src/plan9/src/cmd/eqn/eqn.y"
short yyexca[] =
{-1, 0,
@ -431,6 +431,7 @@ yydefault:
printf("%s", yystatname(yystate));
printf("saw %s\n", yytokname(yychar));
}
goto yyerrlab;
yyerrlab:
yynerrs++;
@ -485,256 +486,256 @@ yyerrlab:
switch(yym) {
case 1:
#line 24 "/usr/local/plan9/src/cmd/eqn/eqn.y"
#line 24 "/home/wkj/src/plan9/src/cmd/eqn/eqn.y"
{ putout(yypt[-0].yyv); } break;
case 2:
#line 25 "/usr/local/plan9/src/cmd/eqn/eqn.y"
#line 25 "/home/wkj/src/plan9/src/cmd/eqn/eqn.y"
{ ERROR "syntax error" WARNING; } break;
case 3:
#line 26 "/usr/local/plan9/src/cmd/eqn/eqn.y"
#line 26 "/home/wkj/src/plan9/src/cmd/eqn/eqn.y"
{ eqnreg = 0; } break;
case 5:
#line 30 "/usr/local/plan9/src/cmd/eqn/eqn.y"
#line 30 "/home/wkj/src/plan9/src/cmd/eqn/eqn.y"
{ eqnbox(yypt[-1].yyv, yypt[-0].yyv, 0); } break;
case 6:
#line 31 "/usr/local/plan9/src/cmd/eqn/eqn.y"
#line 31 "/home/wkj/src/plan9/src/cmd/eqn/eqn.y"
{ eqnbox(yypt[-1].yyv, yypt[-0].yyv, 1); } break;
case 7:
#line 32 "/usr/local/plan9/src/cmd/eqn/eqn.y"
#line 32 "/home/wkj/src/plan9/src/cmd/eqn/eqn.y"
{ lineup(0); } break;
case 8:
#line 35 "/usr/local/plan9/src/cmd/eqn/eqn.y"
#line 35 "/home/wkj/src/plan9/src/cmd/eqn/eqn.y"
{ yyval = yypt[-0].yyv; lineup(1); } break;
case 9:
#line 38 "/usr/local/plan9/src/cmd/eqn/eqn.y"
#line 38 "/home/wkj/src/plan9/src/cmd/eqn/eqn.y"
{ yyval = yypt[-0].yyv; } break;
case 10:
#line 39 "/usr/local/plan9/src/cmd/eqn/eqn.y"
#line 39 "/home/wkj/src/plan9/src/cmd/eqn/eqn.y"
{ yyval = 0; } break;
case 11:
#line 42 "/usr/local/plan9/src/cmd/eqn/eqn.y"
#line 42 "/home/wkj/src/plan9/src/cmd/eqn/eqn.y"
{ yyval = yypt[-0].yyv; } break;
case 12:
#line 43 "/usr/local/plan9/src/cmd/eqn/eqn.y"
#line 43 "/home/wkj/src/plan9/src/cmd/eqn/eqn.y"
{ yyval = 0; } break;
case 13:
#line 46 "/usr/local/plan9/src/cmd/eqn/eqn.y"
#line 46 "/home/wkj/src/plan9/src/cmd/eqn/eqn.y"
{ yyval = yypt[-1].yyv; } break;
case 14:
#line 47 "/usr/local/plan9/src/cmd/eqn/eqn.y"
#line 47 "/home/wkj/src/plan9/src/cmd/eqn/eqn.y"
{ text(QTEXT, (char *) yypt[-0].yyv); } break;
case 15:
#line 48 "/usr/local/plan9/src/cmd/eqn/eqn.y"
#line 48 "/home/wkj/src/plan9/src/cmd/eqn/eqn.y"
{ text(CONTIG, (char *) yypt[-0].yyv); } break;
case 16:
#line 49 "/usr/local/plan9/src/cmd/eqn/eqn.y"
#line 49 "/home/wkj/src/plan9/src/cmd/eqn/eqn.y"
{ text(SPACE, (char *) 0); } break;
case 17:
#line 50 "/usr/local/plan9/src/cmd/eqn/eqn.y"
#line 50 "/home/wkj/src/plan9/src/cmd/eqn/eqn.y"
{ text(THIN, (char *) 0); } break;
case 18:
#line 51 "/usr/local/plan9/src/cmd/eqn/eqn.y"
#line 51 "/home/wkj/src/plan9/src/cmd/eqn/eqn.y"
{ text(TAB, (char *) 0); } break;
case 19:
#line 52 "/usr/local/plan9/src/cmd/eqn/eqn.y"
#line 52 "/home/wkj/src/plan9/src/cmd/eqn/eqn.y"
{ funny(SUM); } break;
case 20:
#line 53 "/usr/local/plan9/src/cmd/eqn/eqn.y"
#line 53 "/home/wkj/src/plan9/src/cmd/eqn/eqn.y"
{ funny(PROD); } break;
case 21:
#line 54 "/usr/local/plan9/src/cmd/eqn/eqn.y"
#line 54 "/home/wkj/src/plan9/src/cmd/eqn/eqn.y"
{ funny(UNION); } break;
case 22:
#line 55 "/usr/local/plan9/src/cmd/eqn/eqn.y"
#line 55 "/home/wkj/src/plan9/src/cmd/eqn/eqn.y"
{ funny(INTER); } break;
case 23:
#line 56 "/usr/local/plan9/src/cmd/eqn/eqn.y"
#line 56 "/home/wkj/src/plan9/src/cmd/eqn/eqn.y"
{ boverb(yypt[-2].yyv, yypt[-0].yyv); } break;
case 24:
#line 57 "/usr/local/plan9/src/cmd/eqn/eqn.y"
#line 57 "/home/wkj/src/plan9/src/cmd/eqn/eqn.y"
{ mark(yypt[-0].yyv); } break;
case 25:
#line 58 "/usr/local/plan9/src/cmd/eqn/eqn.y"
#line 58 "/home/wkj/src/plan9/src/cmd/eqn/eqn.y"
{ size(yypt[-1].yyv, yypt[-0].yyv); } break;
case 26:
#line 59 "/usr/local/plan9/src/cmd/eqn/eqn.y"
#line 59 "/home/wkj/src/plan9/src/cmd/eqn/eqn.y"
{ font(yypt[-1].yyv, yypt[-0].yyv); } break;
case 27:
#line 60 "/usr/local/plan9/src/cmd/eqn/eqn.y"
#line 60 "/home/wkj/src/plan9/src/cmd/eqn/eqn.y"
{ fatbox(yypt[-0].yyv); } break;
case 28:
#line 61 "/usr/local/plan9/src/cmd/eqn/eqn.y"
#line 61 "/home/wkj/src/plan9/src/cmd/eqn/eqn.y"
{ sqrt(yypt[-0].yyv); } break;
case 29:
#line 62 "/usr/local/plan9/src/cmd/eqn/eqn.y"
#line 62 "/home/wkj/src/plan9/src/cmd/eqn/eqn.y"
{ps -= deltaps;} break;
case 30:
#line 62 "/usr/local/plan9/src/cmd/eqn/eqn.y"
#line 62 "/home/wkj/src/plan9/src/cmd/eqn/eqn.y"
{ subsup(yypt[-4].yyv, yypt[-1].yyv, yypt[-0].yyv); } break;
case 31:
#line 63 "/usr/local/plan9/src/cmd/eqn/eqn.y"
#line 63 "/home/wkj/src/plan9/src/cmd/eqn/eqn.y"
{ps -= deltaps;} break;
case 32:
#line 63 "/usr/local/plan9/src/cmd/eqn/eqn.y"
#line 63 "/home/wkj/src/plan9/src/cmd/eqn/eqn.y"
{ subsup(yypt[-3].yyv, 0, yypt[-0].yyv); } break;
case 33:
#line 64 "/usr/local/plan9/src/cmd/eqn/eqn.y"
#line 64 "/home/wkj/src/plan9/src/cmd/eqn/eqn.y"
{ps -= deltaps;} break;
case 34:
#line 64 "/usr/local/plan9/src/cmd/eqn/eqn.y"
#line 64 "/home/wkj/src/plan9/src/cmd/eqn/eqn.y"
{ integral(yypt[-4].yyv, yypt[-1].yyv, yypt[-0].yyv); } break;
case 35:
#line 65 "/usr/local/plan9/src/cmd/eqn/eqn.y"
#line 65 "/home/wkj/src/plan9/src/cmd/eqn/eqn.y"
{ps -= deltaps;} break;
case 36:
#line 65 "/usr/local/plan9/src/cmd/eqn/eqn.y"
#line 65 "/home/wkj/src/plan9/src/cmd/eqn/eqn.y"
{ integral(yypt[-3].yyv, 0, yypt[-0].yyv); } break;
case 37:
#line 66 "/usr/local/plan9/src/cmd/eqn/eqn.y"
#line 66 "/home/wkj/src/plan9/src/cmd/eqn/eqn.y"
{ integral(yypt[-0].yyv, 0, 0); } break;
case 38:
#line 67 "/usr/local/plan9/src/cmd/eqn/eqn.y"
#line 67 "/home/wkj/src/plan9/src/cmd/eqn/eqn.y"
{ps -= deltaps;} break;
case 39:
#line 67 "/usr/local/plan9/src/cmd/eqn/eqn.y"
#line 67 "/home/wkj/src/plan9/src/cmd/eqn/eqn.y"
{ fromto(yypt[-4].yyv, yypt[-1].yyv, yypt[-0].yyv); } break;
case 40:
#line 68 "/usr/local/plan9/src/cmd/eqn/eqn.y"
#line 68 "/home/wkj/src/plan9/src/cmd/eqn/eqn.y"
{ps -= deltaps;} break;
case 41:
#line 68 "/usr/local/plan9/src/cmd/eqn/eqn.y"
#line 68 "/home/wkj/src/plan9/src/cmd/eqn/eqn.y"
{ fromto(yypt[-3].yyv, 0, yypt[-0].yyv); } break;
case 42:
#line 69 "/usr/local/plan9/src/cmd/eqn/eqn.y"
#line 69 "/home/wkj/src/plan9/src/cmd/eqn/eqn.y"
{ paren(yypt[-2].yyv, yypt[-1].yyv, yypt[-0].yyv); } break;
case 43:
#line 70 "/usr/local/plan9/src/cmd/eqn/eqn.y"
#line 70 "/home/wkj/src/plan9/src/cmd/eqn/eqn.y"
{ paren(yypt[-1].yyv, yypt[-0].yyv, 0); } break;
case 44:
#line 71 "/usr/local/plan9/src/cmd/eqn/eqn.y"
#line 71 "/home/wkj/src/plan9/src/cmd/eqn/eqn.y"
{ diacrit(yypt[-1].yyv, yypt[-0].yyv); } break;
case 45:
#line 72 "/usr/local/plan9/src/cmd/eqn/eqn.y"
#line 72 "/home/wkj/src/plan9/src/cmd/eqn/eqn.y"
{ move(FWD, yypt[-1].yyv, yypt[-0].yyv); } break;
case 46:
#line 73 "/usr/local/plan9/src/cmd/eqn/eqn.y"
#line 73 "/home/wkj/src/plan9/src/cmd/eqn/eqn.y"
{ move(UP, yypt[-1].yyv, yypt[-0].yyv); } break;
case 47:
#line 74 "/usr/local/plan9/src/cmd/eqn/eqn.y"
#line 74 "/home/wkj/src/plan9/src/cmd/eqn/eqn.y"
{ move(BACK, yypt[-1].yyv, yypt[-0].yyv); } break;
case 48:
#line 75 "/usr/local/plan9/src/cmd/eqn/eqn.y"
#line 75 "/home/wkj/src/plan9/src/cmd/eqn/eqn.y"
{ move(DOWN, yypt[-1].yyv, yypt[-0].yyv); } break;
case 49:
#line 76 "/usr/local/plan9/src/cmd/eqn/eqn.y"
#line 76 "/home/wkj/src/plan9/src/cmd/eqn/eqn.y"
{ pile(yypt[-0].yyv); ct = yypt[-0].yyv; } break;
case 50:
#line 77 "/usr/local/plan9/src/cmd/eqn/eqn.y"
#line 77 "/home/wkj/src/plan9/src/cmd/eqn/eqn.y"
{yyval=ct;} break;
case 51:
#line 77 "/usr/local/plan9/src/cmd/eqn/eqn.y"
#line 77 "/home/wkj/src/plan9/src/cmd/eqn/eqn.y"
{ matrix(yypt[-3].yyv); ct = yypt[-3].yyv; } break;
case 52:
#line 80 "/usr/local/plan9/src/cmd/eqn/eqn.y"
#line 80 "/home/wkj/src/plan9/src/cmd/eqn/eqn.y"
{ setintegral(); } break;
case 53:
#line 83 "/usr/local/plan9/src/cmd/eqn/eqn.y"
#line 83 "/home/wkj/src/plan9/src/cmd/eqn/eqn.y"
{ yyval = atoi((char *) yypt[-1].yyv); } break;
case 54:
#line 84 "/usr/local/plan9/src/cmd/eqn/eqn.y"
#line 84 "/home/wkj/src/plan9/src/cmd/eqn/eqn.y"
{ yyval = atoi((char *) yypt[-1].yyv); } break;
case 55:
#line 85 "/usr/local/plan9/src/cmd/eqn/eqn.y"
#line 85 "/home/wkj/src/plan9/src/cmd/eqn/eqn.y"
{ yyval = atoi((char *) yypt[-1].yyv); } break;
case 56:
#line 86 "/usr/local/plan9/src/cmd/eqn/eqn.y"
#line 86 "/home/wkj/src/plan9/src/cmd/eqn/eqn.y"
{ yyval = atoi((char *) yypt[-1].yyv); } break;
case 57:
#line 88 "/usr/local/plan9/src/cmd/eqn/eqn.y"
#line 88 "/home/wkj/src/plan9/src/cmd/eqn/eqn.y"
{ yyval = HAT; } break;
case 58:
#line 89 "/usr/local/plan9/src/cmd/eqn/eqn.y"
#line 89 "/home/wkj/src/plan9/src/cmd/eqn/eqn.y"
{ yyval = VEC; } break;
case 59:
#line 90 "/usr/local/plan9/src/cmd/eqn/eqn.y"
#line 90 "/home/wkj/src/plan9/src/cmd/eqn/eqn.y"
{ yyval = DYAD; } break;
case 60:
#line 91 "/usr/local/plan9/src/cmd/eqn/eqn.y"
#line 91 "/home/wkj/src/plan9/src/cmd/eqn/eqn.y"
{ yyval = BAR; } break;
case 61:
#line 92 "/usr/local/plan9/src/cmd/eqn/eqn.y"
#line 92 "/home/wkj/src/plan9/src/cmd/eqn/eqn.y"
{ yyval = LOWBAR; } break;
case 62:
#line 93 "/usr/local/plan9/src/cmd/eqn/eqn.y"
#line 93 "/home/wkj/src/plan9/src/cmd/eqn/eqn.y"
{ yyval = HIGHBAR; } break;
case 63:
#line 94 "/usr/local/plan9/src/cmd/eqn/eqn.y"
#line 94 "/home/wkj/src/plan9/src/cmd/eqn/eqn.y"
{ yyval = UNDER; } break;
case 64:
#line 95 "/usr/local/plan9/src/cmd/eqn/eqn.y"
#line 95 "/home/wkj/src/plan9/src/cmd/eqn/eqn.y"
{ yyval = DOT; } break;
case 65:
#line 96 "/usr/local/plan9/src/cmd/eqn/eqn.y"
#line 96 "/home/wkj/src/plan9/src/cmd/eqn/eqn.y"
{ yyval = TILDE; } break;
case 66:
#line 97 "/usr/local/plan9/src/cmd/eqn/eqn.y"
#line 97 "/home/wkj/src/plan9/src/cmd/eqn/eqn.y"
{ yyval = UTILDE; } break;
case 67:
#line 98 "/usr/local/plan9/src/cmd/eqn/eqn.y"
#line 98 "/home/wkj/src/plan9/src/cmd/eqn/eqn.y"
{ yyval = DOTDOT; } break;
case 68:
#line 101 "/usr/local/plan9/src/cmd/eqn/eqn.y"
#line 101 "/home/wkj/src/plan9/src/cmd/eqn/eqn.y"
{ yyval = ((char *)yypt[-0].yyv)[0]; } break;
case 69:
#line 102 "/usr/local/plan9/src/cmd/eqn/eqn.y"
#line 102 "/home/wkj/src/plan9/src/cmd/eqn/eqn.y"
{ yyval = '{'; } break;
case 70:
#line 105 "/usr/local/plan9/src/cmd/eqn/eqn.y"
#line 105 "/home/wkj/src/plan9/src/cmd/eqn/eqn.y"
{ yyval = ((char *)yypt[-0].yyv)[0]; } break;
case 71:
#line 106 "/usr/local/plan9/src/cmd/eqn/eqn.y"
#line 106 "/home/wkj/src/plan9/src/cmd/eqn/eqn.y"
{ yyval = '}'; } break;
case 74:
#line 113 "/usr/local/plan9/src/cmd/eqn/eqn.y"
#line 113 "/home/wkj/src/plan9/src/cmd/eqn/eqn.y"
{ column(yypt[-3].yyv, DEFGAP); } break;
case 75:
#line 114 "/usr/local/plan9/src/cmd/eqn/eqn.y"
#line 114 "/home/wkj/src/plan9/src/cmd/eqn/eqn.y"
{yyval=atoi((char*)yypt[-0].yyv);} break;
case 76:
#line 114 "/usr/local/plan9/src/cmd/eqn/eqn.y"
#line 114 "/home/wkj/src/plan9/src/cmd/eqn/eqn.y"
{ column(yypt[-5].yyv, yypt[-3].yyv); } break;
case 77:
#line 117 "/usr/local/plan9/src/cmd/eqn/eqn.y"
#line 117 "/home/wkj/src/plan9/src/cmd/eqn/eqn.y"
{ yyval = startcol(LCOL); } break;
case 78:
#line 118 "/usr/local/plan9/src/cmd/eqn/eqn.y"
#line 118 "/home/wkj/src/plan9/src/cmd/eqn/eqn.y"
{ yyval = startcol(CCOL); } break;
case 79:
#line 119 "/usr/local/plan9/src/cmd/eqn/eqn.y"
#line 119 "/home/wkj/src/plan9/src/cmd/eqn/eqn.y"
{ yyval = startcol(RCOL); } break;
case 80:
#line 120 "/usr/local/plan9/src/cmd/eqn/eqn.y"
#line 120 "/home/wkj/src/plan9/src/cmd/eqn/eqn.y"
{ yyval = startcol(COL); } break;
case 81:
#line 123 "/usr/local/plan9/src/cmd/eqn/eqn.y"
#line 123 "/home/wkj/src/plan9/src/cmd/eqn/eqn.y"
{ lp[ct++] = yypt[-0].yyv; } break;
case 82:
#line 124 "/usr/local/plan9/src/cmd/eqn/eqn.y"
#line 124 "/home/wkj/src/plan9/src/cmd/eqn/eqn.y"
{ lp[ct++] = yypt[-0].yyv; } break;
case 83:
#line 127 "/usr/local/plan9/src/cmd/eqn/eqn.y"
#line 127 "/home/wkj/src/plan9/src/cmd/eqn/eqn.y"
{ yyval = ps; setsize((char *) yypt[-0].yyv); } break;
case 84:
#line 130 "/usr/local/plan9/src/cmd/eqn/eqn.y"
#line 130 "/home/wkj/src/plan9/src/cmd/eqn/eqn.y"
{ static char R[]="R"; setfont(R); } break;
case 85:
#line 131 "/usr/local/plan9/src/cmd/eqn/eqn.y"
#line 131 "/home/wkj/src/plan9/src/cmd/eqn/eqn.y"
{ static char I[]="I"; setfont(I); } break;
case 86:
#line 132 "/usr/local/plan9/src/cmd/eqn/eqn.y"
#line 132 "/home/wkj/src/plan9/src/cmd/eqn/eqn.y"
{ static char B[]="B"; setfont(B); } break;
case 87:
#line 133 "/usr/local/plan9/src/cmd/eqn/eqn.y"
#line 133 "/home/wkj/src/plan9/src/cmd/eqn/eqn.y"
{ setfont((char *)yypt[-0].yyv); } break;
}
goto yystack; /* stack new state and value */

View file

@ -4,7 +4,7 @@ void eqnbox(int p1, int p2, int lu)
{
double b, h;
char *sh;
extern char *IRspace;
/* extern char *IRspace; */ /* not used */
yyval = p1;
b = max(ebase[p1], ebase[p2]);

View file

@ -15,7 +15,7 @@ int deltaps = 3; /* default change in ps */
int dps_set = 0; /* 1 => -p option used */
int gsize = 10; /* default initial point size */
int ft = '2';
Font ftstack[10] = { '2', "2" }; /* bottom is global font */
Font ftstack[10] = { { '2', "2" } }; /* bottom is global font */
Font *ftp = ftstack;
int szstack[10]; /* non-zero if absolute size set at this level */
int nszstack = 0;

View file

@ -104,6 +104,7 @@ void dodef(tbl *stp) /* collect args and switch input to defn */
pushsrc(Macro, stp->cval);
}
int
getarg(char *p) /* pick up single argument, store in p, return length */
{
int n, c, npar;
@ -139,6 +140,7 @@ char *pb = pbuf-1; /* next pushed back character */
char ebuf[200]; /* collect input here for error reporting */
char *ep = ebuf;
int
input(void)
{
register int c = 0;
@ -208,7 +210,7 @@ input(void)
return c;
}
int
unput(int c)
{
if (++pb >= pbuf + sizeof pbuf)

View file

@ -13,6 +13,7 @@ void ifdef(void);
void include(void);
void delim(void);
int
yylex(void)
{
register int c;
@ -144,6 +145,7 @@ void getstr(char *s, int n)
yylval = (int) s;
}
int
cstr(char *s, int quote, int maxs)
{
int del, c, i;

View file

@ -9,163 +9,163 @@ struct keyword {
char *key;
int keyval;
} keyword[] ={
"sub", SUB,
"sup", SUP,
".EN", DOTEN,
".EQ", DOTEQ,
"from", FROM,
"to", TO,
"sum", SUM,
"hat", HAT,
"vec", VEC,
"dyad", DYAD,
"dot", DOT,
"dotdot", DOTDOT,
"bar", BAR,
"lowbar", LOWBAR,
"highbar", HIGHBAR,
"tilde", TILDE,
"utilde", UTILDE,
"under", UNDER,
"prod", PROD,
"int", INT,
"integral", INT,
"union", UNION,
"inter", INTER,
"matrix", MATRIX,
"col", COL,
"lcol", LCOL,
"ccol", CCOL,
"rcol", RCOL,
"pile", COL, /* synonyms ... */
"lpile", LCOL,
"cpile", CCOL,
"rpile", RCOL,
"over", OVER,
"sqrt", SQRT,
"above", ABOVE,
"size", SIZE,
"font", FONT,
"fat", FAT,
"roman", ROMAN,
"italic", ITALIC,
"bold", BOLD,
"left", LEFT,
"right", RIGHT,
"delim", DELIM,
"define", DEFINE,
"tdefine", DEFINE,
"ndefine", NDEFINE,
"ifdef", IFDEF,
"gsize", GSIZE,
".gsize", GSIZE,
"gfont", GFONT,
"include", INCLUDE,
"copy", INCLUDE,
"space", SPACE,
"up", UP,
"down", DOWN,
"fwd", FWD,
"back", BACK,
"mark", MARK,
"lineup", LINEUP,
0, 0
{ "sub", SUB, },
{ "sup", SUP, },
{ ".EN", DOTEN, },
{ ".EQ", DOTEQ, },
{ "from", FROM, },
{ "to", TO, },
{ "sum", SUM, },
{ "hat", HAT, },
{ "vec", VEC, },
{ "dyad", DYAD, },
{ "dot", DOT, },
{ "dotdot", DOTDOT, },
{ "bar", BAR, },
{ "lowbar", LOWBAR, },
{ "highbar", HIGHBAR, },
{ "tilde", TILDE, },
{ "utilde", UTILDE, },
{ "under", UNDER, },
{ "prod", PROD, },
{ "int", INT, },
{ "integral", INT, },
{ "union", UNION, },
{ "inter", INTER, },
{ "matrix", MATRIX, },
{ "col", COL, },
{ "lcol", LCOL, },
{ "ccol", CCOL, },
{ "rcol", RCOL, },
{ "pile", COL }, /* synonyms ... */
{ "lpile", LCOL, },
{ "cpile", CCOL, },
{ "rpile", RCOL, },
{ "over", OVER, },
{ "sqrt", SQRT, },
{ "above", ABOVE, },
{ "size", SIZE, },
{ "font", FONT, },
{ "fat", FAT, },
{ "roman", ROMAN, },
{ "italic", ITALIC, },
{ "bold", BOLD, },
{ "left", LEFT, },
{ "right", RIGHT, },
{ "delim", DELIM, },
{ "define", DEFINE, },
{ "tdefine", DEFINE, },
{ "ndefine", NDEFINE, },
{ "ifdef", IFDEF, },
{ "gsize", GSIZE, },
{ ".gsize", GSIZE, },
{ "gfont", GFONT, },
{ "include", INCLUDE, },
{ "copy", INCLUDE, },
{ "space", SPACE, },
{ "up", UP, },
{ "down", DOWN, },
{ "fwd", FWD, },
{ "back", BACK, },
{ "mark", MARK, },
{ "lineup", LINEUP, },
{ 0, 0 }
};
struct resword {
char *res;
char *resval;
} resword[] ={
">=", "\\(>=",
"<=", "\\(<=",
"==", "\\(==",
"!=", "\\(!=",
"+-", "\\(+-",
"->", "\\(->",
"<-", "\\(<-",
"inf", "\\(if",
"infinity", "\\(if",
"partial", "\\(pd",
"half", "\\f1\\(12\\fP",
"prime", "\\f1\\v'.5m'\\s+3\\(fm\\s-3\\v'-.5m'\\fP",
"dollar", "\\f1$\\fP",
"nothing", "",
"times", "\\(mu",
"del", "\\(gr",
"grad", "\\(gr",
"approx", "\\v'-.2m'\\z\\(ap\\v'.25m'\\(ap\\v'-.05m'",
"cdot", "\\v'-.3m'.\\v'.3m'",
"...", "\\v'-.25m'\\ .\\ .\\ .\\ \\v'.25m'",
",...,", "\\f1,\\fP\\ .\\ .\\ .\\ \\f1,\\fP\\|",
"alpha", "α",
"ALPHA", "Α",
"beta", "β",
"BETA", "Β",
"gamma", "γ",
"GAMMA", "Γ",
"delta", "δ",
"DELTA", "Δ",
"epsilon", "ε",
"EPSILON", "Ε",
"omega", "ω",
"OMEGA", "Ω",
"lambda", "λ",
"LAMBDA", "Λ",
"mu", "μ",
"MU", "Μ",
"nu", "ν",
"NU", "Ν",
"theta", "θ",
"THETA", "Θ",
"phi", "φ",
"PHI", "Φ",
"pi", "π",
"PI", "Π",
"sigma", "σ",
"SIGMA", "Σ",
"xi", "ξ",
"XI", "Ξ",
"zeta", "ζ",
"ZETA", "Ζ",
"iota", "ι",
"IOTA", "Ι",
"eta", "η",
"ETA", "Η",
"kappa", "κ",
"KAPPA", "Κ",
"rho", "ρ",
"RHO", "Ρ",
"tau", "τ",
"TAU", "Τ",
"omicron", "ο",
"OMICRON", "Ο",
"upsilon", "υ",
"UPSILON", "Υ",
"psi", "ψ",
"PSI", "Ψ",
"chi", "χ",
"CHI", "Χ",
"and", "\\f1and\\fP",
"for", "\\f1for\\fP",
"if", "\\f1if\\fP",
"Re", "\\f1Re\\fP",
"Im", "\\f1Im\\fP",
"sin", "\\f1sin\\fP",
"cos", "\\f1cos\\fP",
"tan", "\\f1tan\\fP",
"arc", "\\f1arc\\fP",
"sinh", "\\f1sinh\\fP",
"coth", "\\f1coth\\fP",
"tanh", "\\f1tanh\\fP",
"cosh", "\\f1cosh\\fP",
"lim", "\\f1lim\\fP",
"log", "\\f1log\\fP",
"ln", "\\f1ln\\fP",
"max", "\\f1max\\fP",
"min", "\\f1min\\fP",
"exp", "\\f1exp\\fP",
"det", "\\f1det\\fP",
0, 0
{ ">=", "\\(>=", },
{ "<=", "\\(<=", },
{ "==", "\\(==", },
{ "!=", "\\(!=", },
{ "+-", "\\(+-", },
{ "->", "\\(->", },
{ "<-", "\\(<-", },
{ "inf", "\\(if", },
{ "infinity", "\\(if", },
{ "partial", "\\(pd", },
{ "half", "\\f1\\(12\\fP", },
{ "prime", "\\f1\\v'.5m'\\s+3\\(fm\\s-3\\v'-.5m'\\fP", },
{ "dollar", "\\f1$\\fP", },
{ "nothing", "", },
{ "times", "\\(mu", },
{ "del", "\\(gr", },
{ "grad", "\\(gr", },
{ "approx", "\\v'-.2m'\\z\\(ap\\v'.25m'\\(ap\\v'-.05m'", },
{ "cdot", "\\v'-.3m'.\\v'.3m'", },
{ "...", "\\v'-.25m'\\ .\\ .\\ .\\ \\v'.25m'", },
{ ",...,", "\\f1,\\fP\\ .\\ .\\ .\\ \\f1,\\fP\\|", },
{ "alpha", "α", },
{ "ALPHA", "Α", },
{ "beta", "β", },
{ "BETA", "Β", },
{ "gamma", "γ", },
{ "GAMMA", "Γ", },
{ "delta", "δ", },
{ "DELTA", "Δ", },
{ "epsilon", "ε", },
{ "EPSILON", "Ε", },
{ "omega", "ω", },
{ "OMEGA", "Ω", },
{ "lambda", "λ", },
{ "LAMBDA", "Λ", },
{ "mu", "μ", },
{ "MU", "Μ", },
{ "nu", "ν", },
{ "NU", "Ν", },
{ "theta", "θ", },
{ "THETA", "Θ", },
{ "phi", "φ", },
{ "PHI", "Φ", },
{ "pi", "π", },
{ "PI", "Π", },
{ "sigma", "σ", },
{ "SIGMA", "Σ", },
{ "xi", "ξ", },
{ "XI", "Ξ", },
{ "zeta", "ζ", },
{ "ZETA", "Ζ", },
{ "iota", "ι", },
{ "IOTA", "Ι", },
{ "eta", "η", },
{ "ETA", "Η", },
{ "kappa", "κ", },
{ "KAPPA", "Κ", },
{ "rho", "ρ", },
{ "RHO", "Ρ", },
{ "tau", "τ", },
{ "TAU", "Τ", },
{ "omicron", "ο", },
{ "OMICRON", "Ο", },
{ "upsilon", "υ", },
{ "UPSILON", "Υ", },
{ "psi", "ψ", },
{ "PSI", "Ψ", },
{ "chi", "χ", },
{ "CHI", "Χ", },
{ "and", "\\f1and\\fP", },
{ "for", "\\f1for\\fP", },
{ "if", "\\f1if\\fP", },
{ "Re", "\\f1Re\\fP", },
{ "Im", "\\f1Im\\fP", },
{ "sin", "\\f1sin\\fP", },
{ "cos", "\\f1cos\\fP", },
{ "tan", "\\f1tan\\fP", },
{ "arc", "\\f1arc\\fP", },
{ "sinh", "\\f1sinh\\fP", },
{ "coth", "\\f1coth\\fP", },
{ "tanh", "\\f1tanh\\fP", },
{ "cosh", "\\f1cosh\\fP", },
{ "lim", "\\f1lim\\fP", },
{ "log", "\\f1log\\fP", },
{ "ln", "\\f1ln\\fP", },
{ "max", "\\f1max\\fP", },
{ "min", "\\f1min\\fP", },
{ "exp", "\\f1exp\\fP", },
{ "det", "\\f1det\\fP", },
{ 0, 0 }
};
int hash(char *s)

View file

@ -1,5 +1,8 @@
#include "e.h"
#undef inline
#define inline _inline
#define MAXLINE 3600 /* maximum input line */
char *version = "version Oct 24, 1991";
@ -12,18 +15,17 @@ int yyparse(void);
void settype(char *);
int getdata(void);
int getline(char *);
#define inline einline
void inline(void);
void init(void);
void init_tbl(void);
void
int
main(int argc, char *argv[])
{
char *p, buf[20];
cmdname = argv[0];
if (p = getenv("TYPESETTER"))
if ((p = getenv("TYPESETTER")))
typesetter = p;
while (argc > 1 && argv[1][0] == '-') {
switch (argv[1][1]) {
@ -71,7 +73,7 @@ main(int argc, char *argv[])
if (curfile->fin != stdin)
fclose(curfile->fin);
}
exit(0);
return 0;
}
void settype(char *s) /* initialize data for particular typesetter */
@ -89,6 +91,7 @@ void settype(char *s) /* initialize data for particular typesetter */
{ minsize = 5; ttype = DEV202; }
}
int
getdata(void)
{
int i, type, ln;
@ -137,9 +140,10 @@ getdata(void)
return(0);
}
int
getline(char *s)
{
register c;
register int c;
while ((c=input()) != '\n' && c != EOF && c != lefteq) {
if (s >= in+MAXLINE) {
@ -230,6 +234,7 @@ void init(void)
printf(".nr 99 \\n(.s\n");
}
int
salloc(void)
{
int i;
@ -306,6 +311,7 @@ char *DPS(int f, int t) /* delta ps (t-f) in printable form \s+d or \s-d or \s+-
return p;
}
int
EFFPS(int n) /* effective value of n */
{
if (n >= minsize)

View file

@ -1,5 +1,6 @@
#include "e.h"
int
startcol(int type) /* mark start of column in lp[] array */
{
int oct = ct;

View file

@ -122,6 +122,7 @@ int isdigitrune(int c)
return ('0'<=c && c<='9');
}
int
trans(int c, char *p1)
{
int f;
@ -304,10 +305,10 @@ void cadd(int c) /* add character c to end of cs */
if (ftp->ft == ITAL) /* usual case */
*csp++ = nextft;
else /* gfont set, use it */
for (p = ftp->name; *csp = *p++; )
for (p = ftp->name; (*csp = *p++); )
csp++;
} else { /* inside some kind of font ... */
for (p = ftp->name; *csp = *p++; )
for (p = ftp->name; (*csp = *p++); )
csp++;
}
lastft = nextft;

View file

@ -98,21 +98,21 @@ struct tune {
char *cval;
} tune[] ={
/* diacrit.c */
"vec_def", "\\f1\\v'-.5m'\\s-3\\(->\\s0\\v'.5m'\\fP", /* was \s-2 & .45m */
"dyad_def", "\\f1\\v'-.5m'\\s-3\\z\\(<-\\|\\(->\\s0\\v'.5m'\\fP",
"hat_def", "\\f1\\v'-.05m'\\s+1^\\s0\\v'.05m'\\fP", /* was .1 */
"tilde_def", "\\f1\\v'-.05m'\\s+1~\\s0\\v'.05m'\\fP",
"dot_def", "\\f1\\v'-.67m'.\\v'.67m'\\fP",
"dotdot_def", "\\f1\\v'-.67m'..\\v'.67m'\\fP",
"utilde_def", "\\f1\\v'1.0m'\\s+2~\\s-2\\v'-1.0m'\\fP",
{ "vec_def", "\\f1\\v'-.5m'\\s-3\\(->\\s0\\v'.5m'\\fP" }, /* was \s-2 & .45m */
{ "dyad_def", "\\f1\\v'-.5m'\\s-3\\z\\(<-\\|\\(->\\s0\\v'.5m'\\fP" },
{ "hat_def", "\\f1\\v'-.05m'\\s+1^\\s0\\v'.05m'\\fP" }, /* was .1 */
{ "tilde_def", "\\f1\\v'-.05m'\\s+1~\\s0\\v'.05m'\\fP" },
{ "dot_def", "\\f1\\v'-.67m'.\\v'.67m'\\fP" },
{ "dotdot_def", "\\f1\\v'-.67m'..\\v'.67m'\\fP" },
{ "utilde_def", "\\f1\\v'1.0m'\\s+2~\\s-2\\v'-1.0m'\\fP" },
/* funny.c */
"sum_def", "\\|\\v'.3m'\\s+5\\(*S\\s-5\\v'-.3m'\\|",
"union_def", "\\|\\v'.3m'\\s+5\\(cu\\s-5\\v'-.3m'\\|",
"inter_def", "\\|\\v'.3m'\\s+5\\(ca\\s-5\\v'-.3m'\\|",
"prod_def", "\\|\\v'.3m'\\s+5\\(*P\\s-5\\v'-.3m'\\|",
{ "sum_def", "\\|\\v'.3m'\\s+5\\(*S\\s-5\\v'-.3m'\\|" },
{ "union_def", "\\|\\v'.3m'\\s+5\\(cu\\s-5\\v'-.3m'\\|" },
{ "inter_def", "\\|\\v'.3m'\\s+5\\(ca\\s-5\\v'-.3m'\\|" },
{ "prod_def", "\\|\\v'.3m'\\s+5\\(*P\\s-5\\v'-.3m'\\|" },
/* integral.c */
"int_def", "\\v'.1m'\\s+4\\(is\\s-4\\v'-.1m'",
0, 0
{ "int_def", "\\v'.1m'\\s+4\\(is\\s-4\\v'-.1m'" },
{ 0, 0 }
};
tbl *ftunetbl[TBLSIZE]; /* user-defined names */
@ -140,6 +140,8 @@ void ftune(char *s, char *t) /* brute force for now */
double f = atof(t);
double *target;
target = (double *) 0; /* gcc */
while (*t == ' ' || *t == '\t')
t++;
if (eq(s, "Subbase"))

View file

@ -1 +1 @@
exec /usr/bin/egrep -n "$1" *.[chyl]
grep $1 *.[ch]

View file

@ -53,6 +53,8 @@ void frameside(int type, Attr *desc) /* create and remember sides */
int n;
char buf[100];
n = 0; /* gcc */
nsides++;
switch (type) {
case 0: /* no side specified; kludge up all */

View file

@ -110,7 +110,7 @@ extern char *grow(char *, char *, int, int);
extern int lineno;
extern int synerr;
extern int codegen;
extern char tempfile[];
extern char *tempfile;
extern FILE *tfd;
extern Point ptmin, ptmax;

View file

@ -135,6 +135,7 @@ char *delimstr(char *s) /* get body of X ... X */
return tostring(buf);
}
int
baldelim(int c, char *s) /* replace c by balancing entry in s */
{
for ( ; *s; s += 2)
@ -175,6 +176,7 @@ void dodef(Obj *stp) /* collect args and switch input to defn */
pushsrc(Macro, stp->val);
}
int
getarg(char *p) /* pick up single argument, store in p, return length */
{
int n, c, npar;
@ -215,6 +217,7 @@ extern int thru;
extern Obj *thrudef;
extern char *untilstr;
int
input(void)
{
register int c;
@ -230,10 +233,13 @@ input(void)
return *ep++ = c;
}
int
nextchar(void)
{
register int c;
c = 0; /* gcc */
loop:
switch (srcp->type) {
case Free: /* free string */
@ -384,6 +390,7 @@ void do_thru(void) /* read one line, make into a macro expansion */
pushsrc(Macro, thrudef->val);
}
int
unput(int c)
{
if (++pb >= pbuf + sizeof pbuf)
@ -533,7 +540,7 @@ void copy(void) /* begin input from file, etc. */
FILE *fin;
if (newfile) {
if ((fin = fopen(unsharp(newfile), "r")) == NULL)
if ((fin = fopen(newfile, "r")) == NULL)
ERROR "can't open file %s", newfile FATAL;
curfile++;
curfile->fin = fin;

View file

@ -2,20 +2,20 @@
#include <signal.h>
#include <math.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#include "grap.h"
#include "y.tab.h"
extern char *unsharp(char*);
int dbg = 0;
#ifndef GRAPDEFINES
#define GRAPDEFINES "#9/sys/lib/grap.defines"
#endif
char *lib_defines = GRAPDEFINES;
char *lib_defines;
int lib = 1; /* 1 to include lib_defines */
FILE *tfd = NULL;
char tempfile[L_tmpnam];
char *tempfile;
int synerr = 0;
int codegen = 0; /* 1=>output for this picture; 0=>no output */
@ -32,17 +32,22 @@ char *version = "version Dec 30, 1995";
extern int yyparse(void);
extern void setdefaults(void);
extern void getdata(void);
extern int unlink(char *);
/* extern int unlink(char *); */ /* in unistd.h */
int
main(int argc, char *argv[])
{
extern void onintr(int), fpecatch(int);
lib_defines = unsharp("#9/lib/grap.defines");
if (signal(SIGINT, SIG_IGN) != SIG_IGN)
signal(SIGINT, onintr);
signal(SIGFPE, fpecatch);
cmdname = argv[0];
tmpnam(tempfile);
tempfile = strdup("grap.XXXXXX");
mkstemp(tempfile);
while (argc > 1 && *argv[1] == '-') {
switch (argv[1][1]) {
case 'd':
@ -85,7 +90,7 @@ main(int argc, char *argv[])
void onintr(int n)
{
n;
//n;
if (!dbg)
unlink(tempfile);
exit(1);
@ -114,11 +119,11 @@ static struct {
char *name;
double val;
} defaults[] ={
"frameht", FRAMEHT,
"framewid", FRAMEWID,
"ticklen", TICKLEN,
"slop", SLOP,
NULL, 0
{ "frameht", FRAMEHT },
{ "framewid", FRAMEWID },
{ "ticklen", TICKLEN },
{ "slop", SLOP },
{ NULL, 0 }
};
void setdefaults(void) /* set default sizes for variables */

View file

@ -184,7 +184,7 @@ void do_first(void) /* done at first .G1: definitions, etc. */
sprintf(buf, "define pid /%d/\n", getpid());
pbstr(buf);
if (lib != 0) {
if ((fp = fopen(unsharp(lib_defines), "r")) != NULL) {
if ((fp = fopen(lib_defines, "r")) != NULL) {
sprintf(buf1, "copy \"%s\"\n", lib_defines);
pbstr(buf1);
fclose(fp);
@ -226,8 +226,8 @@ void opentemp(void)
if (tfd != NULL)
fclose(tfd);
if (tfd != stdout) {
// if (tfd != NULL)
// fclose(tfd);
if (tfd != NULL)
fclose(tfd);
if ((tfd = fopen(tempfile, "w")) == NULL) {
fprintf(stderr, "grap: can't open %s\n", tempfile);
exit(1);

View file

@ -481,6 +481,7 @@ char *desc_str(Attr *a) /* convert DOT to "dotted", etc. */
return p;
}
int
sidelog(int logflag, int side) /* figure out whether to scale a side */
{
if ((logflag & XFLAG) && ((side & (BOT|TOP)) || side == 0))

View file

@ -87,7 +87,7 @@ int conv(float, struct xy *, int *);
int symbol(int, int, int);
void axlab(char, struct xy *, char *);
void main(int argc,char *argv[]){
int main(int argc,char *argv[]){
openpl();
range(0,0,4096,4096);
@ -115,6 +115,7 @@ void main(int argc,char *argv[]){
plot();
closepl();
exits(0);
return 0; /* gcc */
}
void init(struct xy *p){
@ -243,6 +244,12 @@ void limread(struct xy *p, int *argcp, char ***argvp){
p->xqf = 1;
}
#ifdef NOTDEF
isdigit(char c){
return '0'<=c && c<='9';
}
#endif
int
numb(float *np, int *argcp, char ***argvp){
char c;
@ -629,6 +636,7 @@ getfloat(float *p){
i = scanf("%f",p);
return(i==1);
}
int
getstring(void){
int i;