Skip to content
Snippets Groups Projects
Commit f053d010 authored by Thomas Jahns's avatar Thomas Jahns :cartwheel:
Browse files

Change Fortran 2003 interface generator to not create tabs.

parent 62ba59e9
No related branches found
No related tags found
No related merge requests found
...@@ -709,12 +709,15 @@ end ...@@ -709,12 +709,15 @@ end
#Prints the line if it does not consist only of indentation, adding continuation lines as necessary. #Prints the line if it does not consist only of indentation, adding continuation lines as necessary.
def fortranLine(file, line) def fortranLine(file, line)
unless /^\t+$/.match(line) #Intentionally empty lines don't contain indentation, so we preserve totally empty lines while throwing away the ones with leading tabs. unless /^\t+$/.match(line) #Intentionally empty lines don't contain indentation, so we preserve totally empty lines while throwing away the ones with leading tabs.
indentation = /^\t*/.match(line)[0] # replace tabs with spaces first
while line.length > 131 spacesPerTab = 2
file.puts(line[0...131] + "&") mline = line.gsub("\t", ' '*spacesPerTab)
line = indentation + "&" + line[131...line.length] indentation = /^ */.match(mline)[0]
while mline.length > 131
file.puts(mline[0...131] + "&")
mline = indentation + "&" + mline[131...mline.length]
end end
file.puts(line) file.puts(mline)
end end
end end
...@@ -731,7 +734,9 @@ def writeFortranModule(scriptPath, headerPath, modulePath, moduleName) ...@@ -731,7 +734,9 @@ def writeFortranModule(scriptPath, headerPath, modulePath, moduleName)
fortranLine(file, "\timplicit none") fortranLine(file, "\timplicit none")
fortranLine(file, "\tprivate") fortranLine(file, "\tprivate")
file.puts($verbatimDeclarations) $verbatimDeclarations.each_line do |line|
fortranLine(file, line)
end
fortranLine(file, "") fortranLine(file, "")
$declarationLines.each do |line| $declarationLines.each do |line|
fortranLine(file, line) fortranLine(file, line)
...@@ -739,7 +744,9 @@ def writeFortranModule(scriptPath, headerPath, modulePath, moduleName) ...@@ -739,7 +744,9 @@ def writeFortranModule(scriptPath, headerPath, modulePath, moduleName)
fortranLine(file, "") fortranLine(file, "")
fortranLine(file, "contains") fortranLine(file, "contains")
file.puts($verbatimDefinitions) $verbatimDefinitions.each_line do |line|
fortranLine(file, line)
end
fortranLine(file, "") fortranLine(file, "")
$definitionLines.each do |line| $definitionLines.each do |line|
fortranLine(file, line) fortranLine(file, line)
...@@ -789,7 +796,16 @@ def main ...@@ -789,7 +796,16 @@ def main
end end
if rubyVersionOk() if rubyVersionOk()
main() main()
else else
puts("Error: Ruby version #{RUBY_VERSION} is too old (version 1.9 is required). Skipping fortran interface generation.") puts("Error: Ruby version #{RUBY_VERSION} is too old (version 1.9 is required). Skipping fortran interface generation.")
end end
#
# Local Variables:
# mode: ruby
# tab-always-indent: nil
# tab-width: 2
# ruby-indent-tabs-mode: t
# indent-tabs-mode: t
# End:
#
This diff is collapsed.
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment