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

View file

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

View file

@ -4,7 +4,7 @@ void eqnbox(int p1, int p2, int lu)
{ {
double b, h; double b, h;
char *sh; char *sh;
extern char *IRspace; /* extern char *IRspace; */ /* not used */
yyval = p1; yyval = p1;
b = max(ebase[p1], ebase[p2]); 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 dps_set = 0; /* 1 => -p option used */
int gsize = 10; /* default initial point size */ int gsize = 10; /* default initial point size */
int ft = '2'; int ft = '2';
Font ftstack[10] = { '2', "2" }; /* bottom is global font */ Font ftstack[10] = { { '2', "2" } }; /* bottom is global font */
Font *ftp = ftstack; Font *ftp = ftstack;
int szstack[10]; /* non-zero if absolute size set at this level */ int szstack[10]; /* non-zero if absolute size set at this level */
int nszstack = 0; int nszstack = 0;

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -98,21 +98,21 @@ struct tune {
char *cval; char *cval;
} tune[] ={ } tune[] ={
/* diacrit.c */ /* diacrit.c */
"vec_def", "\\f1\\v'-.5m'\\s-3\\(->\\s0\\v'.5m'\\fP", /* was \s-2 & .45m */ { "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", { "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 */ { "hat_def", "\\f1\\v'-.05m'\\s+1^\\s0\\v'.05m'\\fP" }, /* was .1 */
"tilde_def", "\\f1\\v'-.05m'\\s+1~\\s0\\v'.05m'\\fP", { "tilde_def", "\\f1\\v'-.05m'\\s+1~\\s0\\v'.05m'\\fP" },
"dot_def", "\\f1\\v'-.67m'.\\v'.67m'\\fP", { "dot_def", "\\f1\\v'-.67m'.\\v'.67m'\\fP" },
"dotdot_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", { "utilde_def", "\\f1\\v'1.0m'\\s+2~\\s-2\\v'-1.0m'\\fP" },
/* funny.c */ /* funny.c */
"sum_def", "\\|\\v'.3m'\\s+5\\(*S\\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'\\|", { "union_def", "\\|\\v'.3m'\\s+5\\(cu\\s-5\\v'-.3m'\\|" },
"inter_def", "\\|\\v'.3m'\\s+5\\(ca\\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'\\|", { "prod_def", "\\|\\v'.3m'\\s+5\\(*P\\s-5\\v'-.3m'\\|" },
/* integral.c */ /* integral.c */
"int_def", "\\v'.1m'\\s+4\\(is\\s-4\\v'-.1m'", { "int_def", "\\v'.1m'\\s+4\\(is\\s-4\\v'-.1m'" },
0, 0 { 0, 0 }
}; };
tbl *ftunetbl[TBLSIZE]; /* user-defined names */ 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 f = atof(t);
double *target; double *target;
target = (double *) 0; /* gcc */
while (*t == ' ' || *t == '\t') while (*t == ' ' || *t == '\t')
t++; t++;
if (eq(s, "Subbase")) 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; int n;
char buf[100]; char buf[100];
n = 0; /* gcc */
nsides++; nsides++;
switch (type) { switch (type) {
case 0: /* no side specified; kludge up all */ 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 lineno;
extern int synerr; extern int synerr;
extern int codegen; extern int codegen;
extern char tempfile[]; extern char *tempfile;
extern FILE *tfd; extern FILE *tfd;
extern Point ptmin, ptmax; extern Point ptmin, ptmax;

View file

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

View file

@ -2,20 +2,20 @@
#include <signal.h> #include <signal.h>
#include <math.h> #include <math.h>
#include <stdlib.h> #include <stdlib.h>
#include <unistd.h>
#include <string.h> #include <string.h>
#include "grap.h" #include "grap.h"
#include "y.tab.h" #include "y.tab.h"
extern char *unsharp(char*);
int dbg = 0; int dbg = 0;
#ifndef GRAPDEFINES char *lib_defines;
#define GRAPDEFINES "#9/sys/lib/grap.defines"
#endif
char *lib_defines = GRAPDEFINES;
int lib = 1; /* 1 to include lib_defines */ int lib = 1; /* 1 to include lib_defines */
FILE *tfd = NULL; FILE *tfd = NULL;
char tempfile[L_tmpnam]; char *tempfile;
int synerr = 0; int synerr = 0;
int codegen = 0; /* 1=>output for this picture; 0=>no output */ 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 int yyparse(void);
extern void setdefaults(void); extern void setdefaults(void);
extern void getdata(void); extern void getdata(void);
extern int unlink(char *);
/* extern int unlink(char *); */ /* in unistd.h */
int
main(int argc, char *argv[]) main(int argc, char *argv[])
{ {
extern void onintr(int), fpecatch(int); extern void onintr(int), fpecatch(int);
lib_defines = unsharp("#9/lib/grap.defines");
if (signal(SIGINT, SIG_IGN) != SIG_IGN) if (signal(SIGINT, SIG_IGN) != SIG_IGN)
signal(SIGINT, onintr); signal(SIGINT, onintr);
signal(SIGFPE, fpecatch); signal(SIGFPE, fpecatch);
cmdname = argv[0]; cmdname = argv[0];
tmpnam(tempfile); tempfile = strdup("grap.XXXXXX");
mkstemp(tempfile);
while (argc > 1 && *argv[1] == '-') { while (argc > 1 && *argv[1] == '-') {
switch (argv[1][1]) { switch (argv[1][1]) {
case 'd': case 'd':
@ -85,7 +90,7 @@ main(int argc, char *argv[])
void onintr(int n) void onintr(int n)
{ {
n; //n;
if (!dbg) if (!dbg)
unlink(tempfile); unlink(tempfile);
exit(1); exit(1);
@ -114,11 +119,11 @@ static struct {
char *name; char *name;
double val; double val;
} defaults[] ={ } defaults[] ={
"frameht", FRAMEHT, { "frameht", FRAMEHT },
"framewid", FRAMEWID, { "framewid", FRAMEWID },
"ticklen", TICKLEN, { "ticklen", TICKLEN },
"slop", SLOP, { "slop", SLOP },
NULL, 0 { NULL, 0 }
}; };
void setdefaults(void) /* set default sizes for variables */ 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()); sprintf(buf, "define pid /%d/\n", getpid());
pbstr(buf); pbstr(buf);
if (lib != 0) { 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); sprintf(buf1, "copy \"%s\"\n", lib_defines);
pbstr(buf1); pbstr(buf1);
fclose(fp); fclose(fp);
@ -226,8 +226,8 @@ void opentemp(void)
if (tfd != NULL) if (tfd != NULL)
fclose(tfd); fclose(tfd);
if (tfd != stdout) { if (tfd != stdout) {
// if (tfd != NULL) if (tfd != NULL)
// fclose(tfd); fclose(tfd);
if ((tfd = fopen(tempfile, "w")) == NULL) { if ((tfd = fopen(tempfile, "w")) == NULL) {
fprintf(stderr, "grap: can't open %s\n", tempfile); fprintf(stderr, "grap: can't open %s\n", tempfile);
exit(1); exit(1);

View file

@ -481,6 +481,7 @@ char *desc_str(Attr *a) /* convert DOT to "dotted", etc. */
return p; return p;
} }
int
sidelog(int logflag, int side) /* figure out whether to scale a side */ sidelog(int logflag, int side) /* figure out whether to scale a side */
{ {
if ((logflag & XFLAG) && ((side & (BOT|TOP)) || side == 0)) 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); int symbol(int, int, int);
void axlab(char, struct xy *, char *); void axlab(char, struct xy *, char *);
void main(int argc,char *argv[]){ int main(int argc,char *argv[]){
openpl(); openpl();
range(0,0,4096,4096); range(0,0,4096,4096);
@ -115,6 +115,7 @@ void main(int argc,char *argv[]){
plot(); plot();
closepl(); closepl();
exits(0); exits(0);
return 0; /* gcc */
} }
void init(struct xy *p){ void init(struct xy *p){
@ -243,6 +244,12 @@ void limread(struct xy *p, int *argcp, char ***argvp){
p->xqf = 1; p->xqf = 1;
} }
#ifdef NOTDEF
isdigit(char c){
return '0'<=c && c<='9';
}
#endif
int int
numb(float *np, int *argcp, char ***argvp){ numb(float *np, int *argcp, char ***argvp){
char c; char c;
@ -629,6 +636,7 @@ getfloat(float *p){
i = scanf("%f",p); i = scanf("%f",p);
return(i==1); return(i==1);
} }
int int
getstring(void){ getstring(void){
int i; int i;