#include "smat.h" #include #include #include #include #include #include #include #include #ifdef linux #include #endif static void usage(char *progname, int status) { if (status != 0) std::cerr << "Try `" << progname << " -h' for more information.\n"; else { std::cout << "Usage: " << progname << " [OPTION]... < TRACEFILE\n\ Convert a trace file into a human-readable format.\n\ \n\ -v output SMAT_NOP and SMAT_CTOR as well\n\ -h display this help and exit\n"; } exit(status); } int main(int argc, char *argv[]) { int c, verbose = 0; std::ios::sync_with_stdio(false); std::cin.tie(0); while ((c = getopt(argc, argv, "hv")) != -1) { switch (c) { case 'h': usage(argv[0], EXIT_SUCCESS); break; case 'v': ++verbose; break; default: usage(argv[0], EXIT_FAILURE); break; } } if (optind != argc) usage(argv[0], EXIT_FAILURE); for (std::istream_iterator i(std::cin), e; i != e; ++i) { if (verbose || (i->code != SMAT_NOP && i->code != SMAT_CTOR)) (*i).write_readable(); } return 0; }