help="make xml output pretty")
(options, args) = parser.parse_args()

setupDeferredLogging('preprocessor.log', logging.DEBUG if options.debug else logging.INFO)

if (not options.source):
    logging.error("sourceXML option is mandatory. Use '--help' for informations on how to use this module")
    sys.exit(1)

appliesTo = ""
if options.appliesTo and options.appliesTo.upper() != "CPU":
	appliesTo = options.appliesTo

#read in working xml
sys.stderr.write("Reading codebase meta information\n")
srcFile = openFile(str(options.source),'r')
data = srcFile.read()
srcFile.close()
doc = parseString(data)

try:
	analyseParallelRegions(doc, appliesTo)
except UsageError as e:
    logging.error('Error: %s' %(str(e)))
    sys.exit(1)
except Exception as e:
	logging.critical('Error when analysing callgraph file %s: %s'
		%(str(options.source), str(e))
	)
	logging.info(traceback.format_exc())
	sys.exit(1)
##################### MAIN ##############################
#get all program arguments
parser = OptionParser()
parser.add_option("-c", "--callgraph", dest="callgraph",
                  help="analyzed callgraph XML file to read", metavar="XML")
parser.add_option("-d", "--debug", action="store_true", dest="debug",
                  help="show debug print in standard error output")
(options, args) = parser.parse_args()

setupDeferredLogging('preprocessor.log', logging.DEBUG if options.debug else logging.INFO)

if (not options.callgraph):
    logging.error("callgraph option is mandatory. Use '--help' for informations on how to use this module")
    sys.exit(1)

#read in callgraph xml
cgFile = openFile(str(options.callgraph),'rw')
data = cgFile.read()
cgDoc = parseString(data)
cgFile.close()

try:
  templateNames = set([templateNode.getAttribute("name") for templateNode in cgDoc.getElementsByTagName("implementationTemplate")])
  print " ".join(templateNames)

except Exception, e:
  logging.critical('Error when trying to extract template names: %s%s\n' \
    %(str(e), traceback.format_exc()))
  sys.exit(1)
##################### MAIN ##############################
#get all program arguments
parser = OptionParser()
parser.add_option("-c", "--callgraph", dest="callgraph",
                  help="analyzed callgraph XML file to read", metavar="XML")
parser.add_option("-d", "--debug", action="store_true", dest="debug",
                  help="show debug print in standard error output")
(options, args) = parser.parse_args()

setupDeferredLogging('preprocessor.log', logging.DEBUG if options.debug else logging.INFO)

if (not options.callgraph):
    logging.error("callgraph option is mandatory. Use '--help' for informations on how to use this module")
    sys.exit(1)

#read in callgraph xml
cgFile = openFile(str(options.callgraph),'rw')
data = cgFile.read()
cgDoc = parseString(data)
cgFile.close()

try:
  templateNames = [templateNode.getAttribute("name") for templateNode in cgDoc.getElementsByTagName("implementationTemplate")]
  print " ".join(templateNames)

except Exception, e:
  logging.critical('Error when trying to extract template names: %s%s\n' \
    %(str(e), traceback.format_exc()))
  sys.exit(1)
        "</TR><TR>".join(
            [  #routine name header
                "<TD COLSPAN='3' BGCOLOR='%s'>%s</TD>" %
                (fillColor, routineName)
            ] +
            # [ #labels
            # 	"<TD>%s</TD>" %("</TD><TD>".join([
            # 		"<FONT POINT-SIZE='%s'>%s</FONT>" %(smallFontSize, entry) for entry in ["local", "s.name", "s.module"] #
            # 	]))
            # ] +
            symbolRows  #symbols
        ))


#read in working xml
srcFile = openFile(str(options.source), 'r')
data = srcFile.read()
srcFile.close()
doc = parseString(data)

analyzer = SymbolDependencyAnalyzer(doc)
if options.debug:
    print "=== calls by calleename ==="
    prettyprint(analyzer.callsByCalleeName)
    print "=== calls by callsByCallerName ==="
    prettyprint(analyzer.callsByCallerName)
    print "=== callGraphEdgesByCallerName ==="
    prettyprint(analyzer.callGraphEdgesByCallerName)
    print "=== routines by name ==="
    prettyprint(analyzer.routinesByName)