488 | | def test() : |
489 | | """Test function.""" |
490 | | if (len(sys.argv) < 2) or ((not sys.stdin.isatty()) and ("-" not in sys.argv[1:])) : |
491 | | sys.argv.append("-") |
492 | | totalsize = 0 |
493 | | for arg in sys.argv[1:] : |
494 | | if arg == "-" : |
495 | | infile = sys.stdin |
496 | | mustclose = 0 |
497 | | else : |
498 | | infile = open(arg, "rb") |
499 | | mustclose = 1 |
500 | | try : |
501 | | parser = Parser(infile, debug=1) |
502 | | totalsize += parser.getJobSize() |
503 | | except pdlparser.PDLParserError, msg : |
504 | | sys.stderr.write("ERROR: %s\n" % msg) |
505 | | sys.stderr.flush() |
506 | | if mustclose : |
507 | | infile.close() |
508 | | print "%s" % totalsize |
509 | | |