parameters: ( argv )
docstring: Main program loop.
docstring_summary: Main program loop.
docstring_tokens: Main program loop .
function: def  main( argv ):
      """Main program loop."""
  
      global output_dir
  
      try:
          opts, args = getopt.getopt( sys.argv[1:],
                                      "ht:o:p:",
                                      ["help", "title=", "output=", "prefix="] )
      except getopt.GetoptError:
          usage()
          sys.exit( 2 )
  
      if args == []:
          usage()
          sys.exit( 1 )
  
      # process options
      project_title  = "Project"
      project_prefix = None
      output_dir     = None
  
      for opt in opts:
          if opt[0] in ( "-h", "--help" ):
              usage()
              sys.exit( 0 )
  
          if opt[0] in ( "-t", "--title" ):
              project_title = opt[1]
  
          if opt[0] in ( "-o", "--output" ):
              utils.output_dir = opt[1]
  
          if opt[0] in ( "-p", "--prefix" ):
              project_prefix = opt[1]
  
      check_output()
  
      # create context and processor
      source_processor  = SourceProcessor()
      content_processor = ContentProcessor()
  
      # retrieve the list of files to process
      file_list = make_file_list( args )
      for filename in file_list:
          source_processor.parse_file( filename )
          content_processor.parse_sources( source_processor )
  
      # process sections
      content_processor.finish()
  
      formatter = HtmlFormatter( content_processor,
                                 project_title,
                                 project_prefix )
  
      formatter.toc_dump()
      formatter.index_dump()
      formatter.section_dump_all()
function_tokens: def main ( argv ) : global output_dir try : opts , args = getopt . getopt ( sys . argv [ 1 : ] , "ht:o:p:" , [ "help" , "title=" , "output=" , "prefix=" ] ) except getopt . GetoptError : usage ( ) sys . exit ( 2 ) if args == [ ] : usage ( ) sys . exit ( 1 ) # process options project_title = "Project" project_prefix = None output_dir = None for opt in opts : if opt [ 0 ] in ( "-h" , "--help" ) : usage ( ) sys . exit ( 0 ) if opt [ 0 ] in ( "-t" , "--title" ) : project_title = opt [ 1 ] if opt [ 0 ] in ( "-o" , "--output" ) : utils . output_dir = opt [ 1 ] if opt [ 0 ] in ( "-p" , "--prefix" ) : project_prefix = opt [ 1 ] check_output ( ) # create context and processor source_processor = SourceProcessor ( ) content_processor = ContentProcessor ( ) # retrieve the list of files to process file_list = make_file_list ( args ) for filename in file_list : source_processor . parse_file ( filename ) content_processor . parse_sources ( source_processor ) # process sections content_processor . finish ( ) formatter = HtmlFormatter ( content_processor , project_title , project_prefix ) formatter . toc_dump ( ) formatter . index_dump ( ) formatter . section_dump_all ( )