Пример #1
0
                  "--referenceXML",
                  dest="referenceXML",
                  help="XML file to compare to",
                  metavar="XML")
parser.add_option(
    "--ignoreAttributes",
    dest="ignoreAttributes",
    help="Attribute names to ignore for comparison, comma separated")
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.inputXML):
    logging.error(
        "inputXML option is mandatory. Use '--help' for informations on how to use this module"
    )
    sys.exit(1)

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

ignoreAttributes = []
if (options.ignoreAttributes):
import fileinput
import pdb
import logging, atexit

##################### MAIN ##############################
#get all program arguments
parser = OptionParser()
parser.add_option("-i", "--sourceDirectory", dest="sourceDir",
                  help="read files recursively from DIR", metavar="DIR")
parser.add_option("-d", "--debug", action="store_true", dest="debug",
                  help="show debug print in standard error output")
parser.add_option("-p", "--pretty", action="store_true", dest="pretty",
                  help="make xml output pretty")
(options, args) = parser.parse_args()

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

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

#prepare xml output
doc = Document()
callGraphRoot = doc.createElement("callGraph")
doc.appendChild(callGraphRoot)

filesInDir = dirEntries(str(options.sourceDir), True, 'h90')

#first pass: loop through all h90 files (hybrid fortran 90) in the current directory
#   and build the basic callgraph based on subprocedures and calls. Also parse @-directives for annotations.
progressIndicatorReset(sys.stderr)
Пример #3
0
		if commentIndex < 0:
			noComments += line
			continue
		noComments += line[:commentIndex] + "\n"

	#second pass: strip out empty lines (otherwise we could get in trouble when removing line continuations, if there are empty lines in between)
	stripped = ""
	remainder = noComments
	while True:
		emptyLineMatch = emptyLinePattern.match(remainder)
		if not emptyLineMatch:
			stripped += remainder
			break
		stripped += emptyLineMatch.group(1) + "\n"
		remainder = emptyLineMatch.group(2)

	#third pass: remove line continuations
	remainder = stripped
	output = ""
	while True:
		lineContinuationMatch = multiLineContinuationPattern.match(remainder)
		if not lineContinuationMatch:
			output += remainder
			break
		output += lineContinuationMatch.group(1) + " "
		remainder = lineContinuationMatch.group(2)

	print output

setupDeferredLogging('preprocessor.log', logging.INFO)
pre_sanitize_fortran()
            continue
        noComments += line[:commentIndex] + "\n"

        # second pass: strip out empty lines (otherwise we could get in trouble when removing line continuations, if there are empty lines in between)
    stripped = ""
    remainder = noComments
    while True:
        emptyLineMatch = emptyLinePattern.match(remainder)
        if not emptyLineMatch:
            stripped += remainder
            break
        stripped += emptyLineMatch.group(1) + "\n"
        remainder = emptyLineMatch.group(2)

        # third pass: remove line continuations
    remainder = stripped
    output = ""
    while True:
        lineContinuationMatch = multiLineContinuationPattern.match(remainder)
        if not lineContinuationMatch:
            output += remainder
            break
        output += lineContinuationMatch.group(1) + " "
        remainder = lineContinuationMatch.group(2)

    print output


setupDeferredLogging("preprocessor.log", logging.INFO)
pre_sanitize_fortran()