parameters: ()
docstring: Main program.
docstring_summary: Main program.
docstring_tokens: Main program .
function: def main():
      """
      Main program.
      """
      global VERBOSE
      global BUILD_ROOT
      global DEPLOYMENT
  
      # Enable printing model error output to STDOUT
      Logger.connectOutputLogger(None)
  
      Parser = pinit()
      (opt, args) = Parser.parse_args()
      VERBOSE = opt.verbose_flag
      ConfigManager.ConfigManager.getInstance()
  
      #
      # Handle command line arguments
      #
  
      #
      #  Parse the input Topology XML filename
      #
      if len(args) == 0:
          print("ERROR: Usage: %s [options] xml_filename" % sys.argv[0])
          return
      elif len(args) == 1:
          xml_filename = args[0]
      else:
          print("ERROR: Too many filenames, should only have one")
          return
  
      #
      # Check for BUILD_ROOT variable for XML port searches
      #
      if not opt.build_root_overwrite is None:
          set_build_roots(opt.build_root_overwrite)
          if VERBOSE:
              print("BUILD_ROOT set to %s" % ",".join(get_build_roots()))
      else:
          if ("BUILD_ROOT" in os.environ.keys()) == False:
              print("ERROR: Build root not set to root build path...")
              sys.exit(-1)
          set_build_roots(os.environ["BUILD_ROOT"])
          if VERBOSE:
              print("BUILD_ROOT set to %s" % ",".join(get_build_roots()))
  
      #
      # Write test component
      #
      if not "Ai" in xml_filename:
          print("ERROR: Missing Ai at end of file name...")
          raise OSError
      #
      # Create python dictionaries
      #
      print(xml_filename)
      xml_type = XmlParser.XmlParser(xml_filename)()
  
      # Only Components can be inputted
      if xml_type == "component":
          if VERBOSE:
              print("Detected Component XML so GeneratingComponent C++ Files...")
          the_parsed_component_xml = XmlComponentParser.XmlComponentParser(xml_filename)
          component_model = parse_component(the_parsed_component_xml, xml_filename, opt)
          if VERBOSE:
              print("\nGenerating tests...")
          generate_impl_files(opt, component_model)
      else:
          print(
              "ERROR: {} is used for component XML files, not {} XML files".format(
                  sys.argv[0], xml_type
              )
          )
          sys.exit(-1)
  
      sys.exit(0)
function_tokens: def main ( ) : global VERBOSE global BUILD_ROOT global DEPLOYMENT # Enable printing model error output to STDOUT Logger . connectOutputLogger ( None ) Parser = pinit ( ) ( opt , args ) = Parser . parse_args ( ) VERBOSE = opt . verbose_flag ConfigManager . ConfigManager . getInstance ( ) # # Handle command line arguments # # #  Parse the input Topology XML filename # if len ( args ) == 0 : print ( "ERROR: Usage: %s [options] xml_filename" % sys . argv [ 0 ] ) return elif len ( args ) == 1 : xml_filename = args [ 0 ] else : print ( "ERROR: Too many filenames, should only have one" ) return # # Check for BUILD_ROOT variable for XML port searches # if not opt . build_root_overwrite is None : set_build_roots ( opt . build_root_overwrite ) if VERBOSE : print ( "BUILD_ROOT set to %s" % "," . join ( get_build_roots ( ) ) ) else : if ( "BUILD_ROOT" in os . environ . keys ( ) ) == False : print ( "ERROR: Build root not set to root build path..." ) sys . exit ( - 1 ) set_build_roots ( os . environ [ "BUILD_ROOT" ] ) if VERBOSE : print ( "BUILD_ROOT set to %s" % "," . join ( get_build_roots ( ) ) ) # # Write test component # if not "Ai" in xml_filename : print ( "ERROR: Missing Ai at end of file name..." ) raise OSError # # Create python dictionaries # print ( xml_filename ) xml_type = XmlParser . XmlParser ( xml_filename ) ( ) # Only Components can be inputted if xml_type == "component" : if VERBOSE : print ( "Detected Component XML so GeneratingComponent C++ Files..." ) the_parsed_component_xml = XmlComponentParser . XmlComponentParser ( xml_filename ) component_model = parse_component ( the_parsed_component_xml , xml_filename , opt ) if VERBOSE : print ( "\nGenerating tests..." ) generate_impl_files ( opt , component_model ) else : print ( "ERROR: {} is used for component XML files, not {} XML files" . format ( sys . argv [ 0 ] , xml_type ) ) sys . exit ( - 1 ) sys . exit ( 0 )