void outTsS(Hmesg type, int s1, String *s) { outstart(type); outshort(s1); outS(s); outsend(); }
void outTs(Hmesg type, int s) { outstart(type); journaln(1, s); outshort(s); outsend(); }
void outTsv(Hmesg type, int s, vlong v) { outstart(type); outshort(s); outvlong(v); journaln(1, v); outsend(); }
void outTsl(Hmesg type, int s, Posn l) { outstart(type); outshort(s); outlong(l); journaln(1, l); outsend(); }
void outTsv(Hmesg type, int s, Posn l) { outstart(type); outshort(s); outvlong((void*)l); journaln(1, l); outsend(); }
void outTsll(Hmesg type, int s, Posn l1, Posn l2) { outstart(type); outshort(s); outlong(l1); outlong(l2); journaln(1, l1); journaln(1, l2); outsend(); }
void outTslS(Hmesg type, int s1, Posn l1, String *s) { outstart(type); outshort(s1); journaln(1, s1); outlong(l1); journaln(1, l1); outS(s); outsend(); }
int main(int argc, char **argv) { int c; struct uplot *up; int i; while (argc > 1) { if (BU_STR_EQUAL(argv[1], "-v")) { verbose++; } else break; argc--; argv++; } if (argc == 2) { if ((fp = fopen(argv[1], "r")) == NULL) { perror("plot3stat"); bu_exit (1, NULL); } } else { fp = stdin; if (argc > 1 || isatty(fileno(stdin))) { bu_exit(1, "%s", usage); } } while ((c = getc(fp)) != EOF) { /* look it up */ if (c < 'A' || c > 'z') { up = &uerror; } else { up = &letters[ c - 'A' ]; } if (up->targ == TBAD) { fprintf(stderr, "Bad command '%c' (0x%02x)\n", c, c); continue; } counts[ c - 'A' ]++; if (up->narg > 0) { switch (up->targ) { case TNONE: break; case TSHORT: outshort(up->narg); break; case TIEEE: outfloat(up->narg); break; case TSTRING: outstring(up->narg); break; case TCHAR: outchar(up->narg); break; } } if (verbose) printf(" %s", up->desc); } /* write command usage summary */ for (i = 0; i < 'z'-'A'+1; i++) { if (counts[i] != 0) { fprintf(stderr, "%s %ld\n", letters[i].desc, counts[i]); } } return 0; }