#!/usr/local/bin/python #-- # nuvu: Testbed for faster version of planview.cgi #-- import sys import time # - - - t i m e S t a m p - - - def timeStamp(text): """Report the current execution time labeled with the given text """ print "%8.3f %s" % ( time.clock(), text ) # - - - More imports - - - timeStamp("Standard modules imported") import plan timeStamp("Plan module imported") import pathmap timeStamp("PathMap module imported") from scan import * timeStamp("Scan module imported") # - - - p r o c e s s L i n e - - - def processLine(line): """Handle one line of a plan file """ global topicCount if ( ( len(line) == 0 ) or ( line[0] != plan.OUTLINE_CHAR ) ): return # Ignore empty and control lines m = plan.Plan.topicPat.match(line) if m is None: sys.stderr.write("Bad format: <%s>" % line) return topicCount = topicCount + 1 depth = len ( m.group ( "stars" ) ) - 1 title = string.rstrip ( m.group ( "title" ) ) short = string.rstrip ( m.group ( "short" ) ) #### print "%d (%s|%s)" % ( depth, title, short ) # - - - - - m a i n - - - - - timeStamp("Start execution of main") pathMap = pathmap.PathMap("PathMap") timeStamp("PathMap() instantiated") topicCount = 0 rawLine = sys.stdin.readline() while rawLine != "": line = string.rstrip(rawLine) processLine(line) rawLine = sys.stdin.readline() timeStamp("Stdin consumed") print "Total topic count:", topicCount