130 | | def test() : |
131 | | """Test function.""" |
132 | | if (len(sys.argv) < 2) or ((not sys.stdin.isatty()) and ("-" not in sys.argv[1:])) : |
133 | | sys.argv.append("-") |
134 | | totalsize = 0 |
135 | | for arg in sys.argv[1:] : |
136 | | if arg == "-" : |
137 | | infile = sys.stdin |
138 | | mustclose = 0 |
139 | | else : |
140 | | infile = open(arg, "rb") |
141 | | mustclose = 1 |
142 | | try : |
143 | | parser = Parser(infile, debug=1) |
144 | | totalsize += parser.getJobSize() |
145 | | except pdlparser.PDLParserError, msg : |
146 | | sys.stderr.write("ERROR: %s\n" % msg) |
147 | | sys.stderr.flush() |
148 | | if mustclose : |
149 | | infile.close() |
150 | | print "%s" % totalsize |
151 | | |