193 | | def test() : |
194 | | """Test function.""" |
195 | | if (len(sys.argv) < 2) or ((not sys.stdin.isatty()) and ("-" not in sys.argv[1:])) : |
196 | | sys.argv.append("-") |
197 | | totalsize = 0 |
198 | | for arg in sys.argv[1:] : |
199 | | if arg == "-" : |
200 | | infile = sys.stdin |
201 | | mustclose = 0 |
202 | | else : |
203 | | infile = open(arg, "rb") |
204 | | mustclose = 1 |
205 | | try : |
206 | | parser = Parser(infile, debug=1) |
207 | | totalsize += parser.getJobSize() |
208 | | except pdlparser.PDLParserError, msg : |
209 | | sys.stderr.write("ERROR: %s\n" % msg) |
210 | | sys.stderr.flush() |
211 | | if mustclose : |
212 | | infile.close() |
213 | | print "%s" % totalsize |
214 | | |