...
 
Commits (2)
......@@ -283,8 +283,10 @@ avl_rebalance(plotter * pl, command * c)
h = 1 + avl_max_height(c->avl_left, c->avl_right);
x_max = avl_max_x_coord(pl, c);
#ifdef notdef /* lacking equality-op for coord, re-eval full height of tree */
if (h == c->avl_height)
return;
#endif
c->avl_height = h;
c->avl_x_max = x_max;
TRACE errprintf(" %s %s\th %u sxm %s",
......@@ -365,8 +367,9 @@ avl_insert(plotter * pl, command * c)
c->avl_parent = node;
x_max = avl_max_x_coord(pl, node);
if (node->avl_height == 1 || memcmp(&x_max, &node->avl_x_max, sizeof(coord)) != 0)
#ifdef notdef /* lacking equality-op for coord, re-eval full height of tree */
if (node->avl_height == 1) || x_max != node->avl_x_max)
#endif
{
node->avl_height = 2;
node->avl_x_max = x_max;
......
......@@ -3358,26 +3358,49 @@ get_input(FILE *fp, Display *dpy, struct plotter *pl)
tok_0 = tokens[0];
switch (*tok_0++) {
case 'a':
if (strcmp(tok_0,"spect_ratio") == 0) {
if (ntokens != 2)
parseerror("input format error", tokens, ntokens);
if (pl->x_type != pl->y_type)
parseerror("aspect_ratio requires identical coordinate types", tokens, ntokens);
pl->aspect_ratio = atof(tokens[1]);
switch (*tok_0++) {
case 's':
if (strcmp(tok_0,"pect_ratio") == 0) {
if (ntokens != 2)
parseerror("input format error", tokens, ntokens);
if (pl->x_type != pl->y_type)
parseerror("aspect_ratio requires identical coordinate types", tokens, ntokens);
pl->aspect_ratio = atof(tokens[1]);
} else goto bad;
break;
case 't':
if (strcmp(tok_0, "ext") == 0) newcmd_text(pl, tokens, ntokens, fp);
else goto bad;
break;
case 'l':
case 'r':
if (strcmp(tok_0, "text") == 0) newcmd_text(pl, tokens, ntokens, fp);
else goto bad;
break;
default:
goto bad;
}
else if (strcmp(tok_0, "text") == 0) newcmd_text(pl, tokens, ntokens, fp);
else if (strcmp(tok_0, "ltext") == 0) newcmd_text(pl, tokens, ntokens, fp);
else if (strcmp(tok_0, "rtext") == 0) newcmd_text(pl, tokens, ntokens, fp);
else goto bad;
break;
case 'b':
if (strcmp(tok_0,"ox") == 0) newcmd_34(pl, tokens, ntokens, BOX);
else if (strcmp(tok_0, "ox2") == 0) newcmd_56(pl, tokens, ntokens, BOX2);
else if (strcmp(tok_0, "text") == 0) newcmd_text(pl, tokens, ntokens, fp);
else if (strcmp(tok_0, "ltext") == 0) newcmd_text(pl, tokens, ntokens, fp);
else if (strcmp(tok_0, "rtext") == 0) newcmd_text(pl, tokens, ntokens, fp);
else goto bad;
switch (*tok_0++) {
case 'o':
if (strcmp(tok_0,"x") == 0) newcmd_34(pl, tokens, ntokens, BOX);
else if (strcmp(tok_0, "x2") == 0) newcmd_56(pl, tokens, ntokens, BOX2);
else goto bad;
break;
case 't':
if (strcmp(tok_0, "ext") == 0) newcmd_text(pl, tokens, ntokens, fp);
else goto bad;
break;
case 'l':
case 'r':
if (strcmp(tok_0, "text") == 0) newcmd_text(pl, tokens, ntokens, fp);
else goto bad;
break;
default:
goto bad;
}
break;
case 'c':
......@@ -3387,12 +3410,30 @@ get_input(FILE *fp, Display *dpy, struct plotter *pl)
break;
case 'd':
if (strcmp(tok_0,"ot") == 0) newcmd_34(pl, tokens, ntokens, DOT);
else if (strcmp(tok_0, "iamond") == 0) newcmd_34(pl, tokens, ntokens, DIAMOND);
else if (strcmp(tok_0, "tick") == 0) newcmd_34(pl, tokens, ntokens, DTICK);
else if (strcmp(tok_0, "arrow") == 0) newcmd_34(pl, tokens, ntokens, DARROW);
else if (strcmp(tok_0, "line") == 0) newcmd_56(pl, tokens, ntokens, DLINE);
else goto bad;
switch (*tok_0++) {
case 'o':
if (strcmp(tok_0,"t") == 0) newcmd_34(pl, tokens, ntokens, DOT);
else goto bad;
break;
case 'i':
if (strcmp(tok_0, "amond") == 0) newcmd_34(pl, tokens, ntokens, DIAMOND);
else goto bad;
break;
case 't':
if (strcmp(tok_0, "ick") == 0) newcmd_34(pl, tokens, ntokens, DTICK);
else goto bad;
break;
case 'a':
if (strcmp(tok_0, "rrow") == 0) newcmd_34(pl, tokens, ntokens, DARROW);
else goto bad;
break;
case 'l':
if (strcmp(tok_0, "ine") == 0) newcmd_56(pl, tokens, ntokens, DLINE);
else goto bad;
break;
default:
goto bad;
}
break;
case 'g':
......@@ -3417,11 +3458,23 @@ get_input(FILE *fp, Display *dpy, struct plotter *pl)
break;
case 'l':
if (strcmp(tok_0,"tick") == 0) newcmd_34(pl, tokens, ntokens, LTICK);
else if (strcmp(tok_0,"arrow") == 0) newcmd_34(pl, tokens, ntokens, LARROW);
else if (strcmp(tok_0,"ine") == 0) newcmd_56(pl, tokens, ntokens, LINE);
else if (strcmp(tok_0, "text") == 0) newcmd_text(pl, tokens, ntokens, fp);
else goto bad;
switch (*tok_0++) {
case 't':
if (strcmp(tok_0,"ick") == 0) newcmd_34(pl, tokens, ntokens, LTICK);
else if (strcmp(tok_0, "ext") == 0) newcmd_text(pl, tokens, ntokens, fp);
else goto bad;
break;
case 'a':
if (strcmp(tok_0,"arrow") == 0) newcmd_34(pl, tokens, ntokens, LARROW);
else goto bad;
break;
case 'i':
if (strcmp(tok_0,"ne") == 0) newcmd_56(pl, tokens, ntokens, LINE);
else goto bad;
break;
default:
goto bad;
}
break;
case 'n':
......