Closed dannyk96 closed 9 years ago
I think I've found the source of the problem. I'll be pushing it to GitHub (along with some other bugfixes/improvements) sometime in the next day or two. In the meantime, here's a patch. Note that this will cause some problems if you have abstract interfaces (FORD will run, but they won't show up in the documentation) as I am part way through changing how I handle them. If you want to try applying the patch to the latest working state of the repository then go ahead. If not, would it be possible for you to send a copy of one of the codes which FORD crashes on, so that I can see if this change has worked?
diff --git a/.gitignore b/.gitignore
index 0ab917d..17f45be 100644
--- a/.gitignore
+++ b/.gitignore
@@ -3,7 +3,9 @@ structure.ods
*~
doc/
src/
-README.rst
+#README.rst
FORD.egg-info/
dist/
wiki/
+*.mod
+*.o
\ No newline at end of file
diff --git a/ford/fortran_project.py b/ford/fortran_project.py
index bfe1878..5ce9f6f 100644
--- a/ford/fortran_project.py
+++ b/ford/fortran_project.py
@@ -23,7 +23,6 @@
#
#FIXME: Need to add .lower() to all equality tests between strings
-#TODO: Set up a list of the packages that this depends on--in particular, toposort
from __future__ import print_function
@@ -62,12 +61,13 @@ class Project(object):
if item.split('.')[-1] in self.extensions and not item in exclude:
# Get contents of the file
print("Reading file {}".format(os.path.join(curdir,item)))
- try:
- self.files.append(ford.sourceform.FortranSourceFile(os.path.join(curdir,item)))
- except Exception as e:
- print("Warning: Error parsing {}.\n\t{}".format(os.path.join(curdir,item),e.args[0]))
- continue
-
+ self.files.append(ford.sourceform.FortranSourceFile(os.path.join(curdir,item)))
+ #~ try:
+ #~ self.files.append(ford.sourceform.FortranSourceFile(os.path.join(curdir,item)))
+ #~ except Exception as e:
+ #~ print("Warning: Error parsing {}.\n\t{}".format(os.path.join(curdir,item),e.args[0]))
+ #~ continue
+
for module in self.files[-1].modules:
self.modules.append(module)
for function in module.functions:
@@ -119,10 +119,15 @@ class Project(object):
# Get the order to process other correlations with
deplist = {}
for mod in self.modules:
- deplist[mod] = set(mod.uses)
+ uselist = mod.uses
+ for proc in mod.subroutines:
+ uselist.extend(proc.uses)
+ for proc in mod.functions:
+ uselist.extend(proc.uses)
+ deplist[mod] = set(uselist)
ranklist = toposort.toposort_flatten(deplist)
for proc in self.procedures:
- if proc.parobj == 'sourcefile': ranklist.append(proc[1])
+ if proc.parobj == 'sourcefile': ranklist.append(proc)
ranklist.extend(self.programs)
# Perform remaining correlations for the project
diff --git a/ford/sourceform.py b/ford/sourceform.py
index 08f706f..fcc3ec9 100644
--- a/ford/sourceform.py
+++ b/ford/sourceform.py
@@ -194,7 +194,8 @@ class FortranContainer(FortranBase):
SUBROUTINE_RE = re.compile("^\s*(?:(.+?)\s+)?subroutine\s+(\w+)\s*(\([^()]*\))?(\s*bind\s*\(\s*c.*\))?$",re.IGNORECASE)
FUNCTION_RE = re.compile("^(?:(.+?)\s+)?function\s+(\w+)\s*(\([^()]*\))?(?:\s*result\s*\(\s*(\w+)\s*\))?(\s*bind\s*\(\s*c.*\))?$",re.IGNORECASE)
TYPE_RE = re.compile("^type(?:\s+|\s*(,.*)?::\s*)((?!(?:is))\w+)\s*(\([^()]*\))?\s*$",re.IGNORECASE)
- INTERFACE_RE = re.compile("^(abstract\s+)?interface(?:\s+(\S.+))?$",re.IGNORECASE)
+ INTERFACE_RE = re.compile("^interface(?:\s+(\S.+))?$",re.IGNORECASE)
+ ABS_INTERFACE_RE = re.compile("^abstract\s+interface(?:\s+(\S.+))?$",re.IGNORECASE)
BOUNDPROC_RE = re.compile("^(generic|procedure)\s*(\([^()]*\))?\s*(.*)\s*::\s*(\w.*)",re.IGNORECASE)
FINAL_RE = re.compile("^final\s*::\s*(\w.*)",re.IGNORECASE)
VARIABLE_RE = re.compile("^(integer|real|double\s*precision|character|complex|logical|type(?!\s+is)|class(?!\s+is)|procedure)\s*((?:\(|\s\w|[:,*]).*)$",re.IGNORECASE)
@@ -321,6 +322,13 @@ class FortranContainer(FortranBase):
permission))
else:
raise Exception("Found INTERFACE in {}".format(type(self).__name__[7:].upper()))
+ elif self.ABS_INTERFACE_RE.match(line):
+ if hasattr(self,'absinterfaces'):
+ self.absinterfaces.extend(FortranAbstractBlock(source,
+ self.INTERFACE_RE.match(line),self,
+ permission).absinterfaces)
+ else:
+ raise Exception("Found INTERFACE in {}".format(type(self).__name__[7:].upper()))
elif self.BOUNDPROC_RE.match(line) and incontains:
if hasattr(self,'boundprocs'):
self.boundprocs.append(FortranBoundProcedure(source,
@@ -368,12 +376,12 @@ class FortranCodeUnit(FortranContainer):
def correlate(self,project):
# Add procedures, interfaces and types from parent to our lists
if hasattr(self.parent,'pub_procs'): self.pub_procs.extend(self.parent.pub_procs)
- if hasattr(self.parent,'procs'): self.procs.extend(self.parent.procs)
+ if hasattr(self.parent,'all_procs'): self.all_procs.extend(self.parent.all_procs)
#FIXME: It would be better to make the all_interfaces list contain only abstract interfaces, and to start building it during cleanup, as was done for procs
if hasattr(self.parent,'interfaces'):
- self.all_interfaces = self.interfaces + self.parent.interfaces
+ self.all_absinterfaces = self.absinterfaces + self.parent.absinterfaces
else:
- self.all_interfaces = self.interfaces + []
+ self.all_absinterfaces = self.absinterfaces + []
if hasattr(self.parent,'all_types'):
self.all_types = self.types + self.parent.all_types
else:
@@ -383,14 +391,14 @@ class FortranCodeUnit(FortranContainer):
for mod in self.uses:
if type(mod) == str: continue
self.pub_procs.extend(mod.pub_procs)
- self.procs.extend(mod.pub_procs)
- self.all_interfaces.extend(mod.all_interfaces)
+ self.all_procs.extend(mod.pub_procs)
+ self.all_absinterfaces.extend(mod.all_absinterfaces)
self.all_types.extend(mod.all_types)
# Match up called procedures
if hasattr(self,'calls'):
for i in range(len(self.calls)):
- for proc in self.procs:
+ for proc in self.all_procs:
if self.calls[i] == proc.name:
self.calls[i] = proc
break
@@ -471,27 +479,28 @@ class FortranModule(FortranCodeUnit):
self.functions = []
self.interfaces = []
self.types = []
+ self.absinterfaces = []
def _cleanup(self):
# Create list of all local procedures. Ones coming from other modules
# will be added later, during correlation.
- self.procs = self.functions + self.subroutines
+ self.all_procs = self.functions + self.subroutines
self.pub_procs = []
for interface in self.interfaces:
if interface.name:
- self.procs.append(interface)
- elif not interface.abstract:
- self.procs.extend(interface.functions)
- self.procs.extend(interface.subroutines)
+ self.all_procs.append(interface)
+ else:
+ self.all_procs.extend(interface.functions)
+ self.all_procs.extend(interface.subroutines)
for name in self.public_list:
- for var in self.variables + self.procs + self.types + self.interfaces:
+ for var in self.variables + self.all_procs + self.types + self.interfaces + self.absinterfaces:
if (var.name != None): #JW
if name.lower() == var.name.lower():
var.permission = "public"
for name in self.private_list:
- for var in self.variables + self.procs + self.types + self.interfaces:
+ for var in self.variables + self.all_procs + self.types + self.interfaces + self.absinterfaces:
if name.lower() == var.name.lower():
var.permission = "private"
for varname in self.protected_list:
@@ -499,7 +508,7 @@ class FortranModule(FortranCodeUnit):
if varname.lower() == var.name.lower():
var.permission = "protected"
- for proc in self.procs:
+ for proc in self.all_procs:
if proc.permission == "public": self.pub_procs.append(proc)
del self.public_list
@@ -544,17 +553,18 @@ class FortranSubroutine(FortranCodeUnit):
self.subroutines = []
self.functions = []
self.interfaces = []
+ self.absinterfaces = []
self.types = []
def _cleanup(self):
- self.procs = self.functions + self.subroutines
+ self.all_procs = self.functions + self.subroutines
self.pub_procs = []
for interface in self.interfaces:
if interface.name:
- self.procs.append(interface)
- elif not interface.abstract:
- self.procs.extend(interface.functions)
- self.procs.extend(interface.subroutines)
+ self.all_procs.append(interface)
+ else:
+ self.all_procs.extend(interface.functions)
+ self.all_procs.extend(interface.subroutines)
for varname in self.optional_list:
for var in self.variables:
@@ -626,15 +636,16 @@ class FortranFunction(FortranCodeUnit):
self.subroutines = []
self.functions = []
self.interfaces = []
+ self.absinterfaces = []
self.types = []
def _cleanup(self):
- self.procs = self.functions + self.subroutines
+ self.all_procs = self.functions + self.subroutines
self.pub_procs = []
for interface in self.interfaces:
if interface.name:
procs.append(interface)
- elif not interface.abstract:
+ else:
procs.extend(interface.functions)
procs.extend(interface.subroutines)
@@ -685,14 +696,15 @@ class FortranProgram(FortranCodeUnit):
self.types = []
self.uses = []
self.calls = []
+ self.absinterfaces = []
def _cleanup(self):
- self.procs = self.functions + self.subroutines
+ self.all_procs = self.functions + self.subroutines
self.pub_procs = []
for interface in self.interfaces:
if interface.name:
procs.append(interface)
- elif not interface.abstract:
+ else:
procs.extend(interface.functions)
procs.extend(interface.subroutines)
@@ -743,9 +755,9 @@ class FortranType(FortranContainer):
def correlate(self,project):
- self.all_interfaces = self.parent.all_interfaces
+ self.all_absinterfaces = self.parent.all_absinterfaces
self.all_types = self.parent.all_types
- self.procs = self.parent.procs
+ self.all_procs = self.parent.all_procs
# Get type of extension
if self.extends:
for dtype in self.all_types:
@@ -766,12 +778,12 @@ class FortranType(FortranContainer):
self.boundprocs.remove(proc)
# Match finalprocs
for i in range(len(self.finalprocs)):
- for proc in self.procs:
+ for proc in self.all_procs:
if proc.name.lower() == self.finalprocs[i].lower():
self.finalprocs[i] = proc
break
# Find a constructor, if one exists
- for proc in self.procs:
+ for proc in self.all_procs:
if proc.name.lower() == self.name.lower():
self.constructor = proc
break
@@ -788,43 +800,71 @@ class FortranInterface(FortranContainer):
"""
def _initialize(self,line):
self.proctype = 'Interface'
- self.abstract = bool(line.group(1))
- self.name = line.group(2)
+ self.name = line.group(1)
self.hasname = bool(self.name)
self.subroutines = []
self.functions = []
self.modprocs = []
def _cleanup(self):
- if not self.hasname:
+ if not self.hasname: # FIXME: Not sure if I need this
contents = self.subroutines + self.functions
self.name = contents[0].name
def correlate(self,project):
- if self.abstract: return
- self.all_interfaces = self.parent.all_interfaces
+ self.all_absinterfaces = self.parent.all_absinterfaces
self.all_types = self.parent.all_types
- self.procs = self.parent.procs
+ self.all_procs = self.parent.all_procs
for modproc in self.modprocs:
- for proc in self.procs:
+ for proc in self.all_procs:
if modproc.name.lower() == proc.name.lower():
modproc.procedure = proc
break
for subrtn in self.subroutines:
subrtn.correlate(project)
- #~ for proc in self.parent.procs:
+ #~ for proc in self.parent.all_procs:
#~ if subrtn.name.lower() == proc.name.lower():
#~ subrtn.procedure = proc
#~ break
for func in self.functions:
func.correlate(project)
- #~ for proc in self.parent.procs:
+ #~ for proc in self.parent.all_procs:
#~ if func.name.lower() == proc.name.lower():
#~ func.procedure = proc
#~ break
-
+
+class FortranAbstractBlock(FortranContainer):
+ def _initialize(self,line):
+ self.subroutines = []
+ self.functions = []
+
+ def _cleanup(self):
+ self.absinterfaces = []
+ for proc in (self.subroutines + self.functions):
+ self.absinterfaces.append(FortranAbsInterface(proc,self))
+class FortranAbsInterface(FortranBase):
+ """
+ An object representing a Fortran abstract interface.
+ """
+ def __init__(self,proc,parent):
+ self.name = proc.name
+ self.permission = proc.permission
+ self.parent = parent
+ if self.parent:
+ self.parobj = self.parent.obj
+ self.obj = 'absinterface'
+ self.doc = parent.doc
+
+ self.hierarchy = []
+ cur = self.parent
+ while cur:
+ self.hierarchy.append(cur)
+ cur = cur.parent
+ self.hierarchy.reverse()
+
+
class FortranVariable(FortranBase):
"""
An object representing a variable within Fortran.
@@ -865,19 +905,19 @@ class FortranVariable(FortranBase):
def correlate(self,project):
- if self.proto and self.proto[0] == '*': self.proto[0] = '*'
+ if self.proto and self.proto[0] == '*': self.proto[0] = '*' #FIXME: Is this line necessary?
if (self.vartype == "type" or self.vartype == "class") and self.proto and self.proto[0] != '*':
for dtype in self.parent.all_types:
if dtype.name.lower() == self.proto[0].lower():
self.proto[0] = dtype
break
elif self.vartype == "procedure" and self.proto:
- for proc in self.parent.procs:
+ for proc in self.parent.all_procs + self.parent.all_absinterfaces:
if proc.name.lower() == str(self.proto).lower(): #JW
self.proto = proc
break
if type(self.proto) == str:
- for interface in self.parent.all_interfaces:
+ for interface in self.parent.all_absinterfaces:
if interface.abstract:
for proc in interface.subroutines + interface.functions:
if proc.name.lower() == self.proto.lower():
@@ -917,9 +957,9 @@ class FortranBoundProcedure(FortranBase):
self.prototype = None
def correlate(self,project):
- self.procs = self.parent.procs
+ self.all_procs = self.parent.all_procs
for i in range(len(self.bindings)):
- for proc in self.procs:
+ for proc in self.all_procs:
if proc.name.lower() == self.bindings[i].lower():
self.bindings[i] = proc
break
diff --git a/ford/tipuesearch/img/search.png b/ford/tipuesearch/img/search.png
old mode 100755
new mode 100644
diff --git a/ford/tipuesearch/tipuesearch.css b/ford/tipuesearch/tipuesearch.css
old mode 100755
new mode 100644
Hi. Thanks for the speedy reply. I am getting errors when trying to apply this patch (which I cuct'n'pasted from the above message:
$ git apply --check --ignore-space-change --ignore-whitespace ../ford.patch
error: patch failed: ford/fortran_project.py:119
error: ford/fortran_project.py: patch does not apply
error: patch failed: ford/sourceform.py:383
error: ford/sourceform.py: patch does not apply
Any ideas? I started from a fresh git clone
of ford.
Patch has:
- self.procs.extend(mod.pub_procs)
- self.all_interfaces.extend(mod.all_interfaces)
+ self.all_procs.extend(mod.pub_procs)
+ self.all_absinterfaces.extend(mod.all_absinterfaces)
file has:
self.procs.extend(mod.pub_procs)
self.all_interfaces.extend(mod.all_interfaces)
Seems like a match to me?
Manual patch gives these warnings:
$ patch -p1 <../ford.patch
patching file .gitignore
patching file ford/fortran_project.py
Hunk #3 succeeded at 119 with fuzz 2.
patching file ford/sourceform.py
Hunk #4 FAILED at 391.
Hunk #5 FAILED at 479.
Hunk #9 FAILED at 695.
Hunk #10 succeeded at 753 with fuzz 2.
Hunk #12 FAILED at 798.
4 out of 14 hunks FAILED -- saving rejects to file ford/sourceform.py.rej
patching file ford/tipuesearch/img/search.png
patching file ford/tipuesearch/tipuesearch.css
You asked for examples which fail. Try this: https://github.com/dannyk96/sandbox/blob/master/examples_in_F90/ruritania.f90
dan@stanley:/tmp/git$ ford testbed.md
Reading file ./testbed/ruritania.f90
Correlating information from different parts of your project...
Traceback (most recent call last):
File "/usr/local/bin/ford", line 9, in <module>
load_entry_point('FORD==1.1.0', 'console_scripts', 'ford')()
File "/usr/local/lib/python2.7/dist-packages/ford/__init__.py", line 152, in main
project.correlate()
File "/usr/local/lib/python2.7/dist-packages/ford/fortran_project.py", line 129, in correlate
container.correlate(self)
File "/usr/local/lib/python2.7/dist-packages/ford/sourceform.py", line 396, in correlate
func.correlate(project)
File "/usr/local/lib/python2.7/dist-packages/ford/sourceform.py", line 407, in correlate
arg.correlate(project)
AttributeError: 'str' object has no attribute 'correlate'
This also fails: https://github.com/dannyk96/danfe/blob/master/src/danfront.f90
This case is simpler with no 'contains' subroutines
Hmm... I don't know what the problem is with the patch. I prepared it from my current working state and the latest commit on GitHub. I haven't used patches much, so perhaps I made a mistake somewhere.
As for the other problem, I can tell you why that's occurring. You a function and a subroutine with an argument n, but n is not declared. I was not aware that this was legal syntax and thus had not written Ford to be able to deal with it. I'll look at how to fix this.
On 23/04/15 04:51 AM, Daniel Kidger wrote:
You asked for examples which fail. Try this: https://github.com/dannyk96/sandbox/blob/master/examples_in_F90/ruritania.f90
|dan@stanley:/tmp/git$ ford testbed.md Reading file ./testbed/ruritania.f90
Correlating information from different parts of your project...
Traceback (most recent call last): File "/usr/local/bin/ford", line 9, in
load_entry_point('FORD==1.1.0', 'console_scripts', 'ford')() File "/usr/local/lib/python2.7/dist-packages/ford/init.py", line 152, in main project.correlate() File "/usr/local/lib/python2.7/dist-packages/ford/fortran_project.py", line 129, in correlate container.correlate(self) File "/usr/local/lib/python2.7/dist-packages/ford/sourceform.py", line 396, in correlate func.correlate(project) File "/usr/local/lib/python2.7/dist-packages/ford/sourceform.py", line 407, in correlate arg.correlate(project) AttributeError: 'str' object has no attribute 'correlate' | This also fails: https://github.com/dannyk96/danfe/blob/master/src/danfront.f90
This case is simpler with no 'contains' subroutines
— Reply to this email directly or view it on GitHub https://github.com/cmacmackin/ford/issues/32#issuecomment-95479896.
Chris MacMackin Saint Mary's University Curriculum Vitae http://ap.smu.ca/%7Ecmacmack/CV.pdf
Ah, I see you don't have IMPLICIT NONE in this program. I guess that would explain why you can get away without declaring your arguments.
On 23/04/15 10:27 AM, Chris MacMackin wrote:
Hmm... I don't know what the problem is with the patch. I prepared it from my current working state and the latest commit on GitHub. I haven't used patches much, so perhaps I made a mistake somewhere.
As for the other problem, I can tell you why that's occurring. You a function and a subroutine with an argument n, but n is not declared. I was not aware that this was legal syntax and thus had not written Ford to be able to deal with it. I'll look at how to fix this.
On 23/04/15 04:51 AM, Daniel Kidger wrote:
You asked for examples which fail. Try this: https://github.com/dannyk96/sandbox/blob/master/examples_in_F90/ruritania.f90
|dan@stanley:/tmp/git$ ford testbed.md Reading file ./testbed/ruritania.f90
Correlating information from different parts of your project...
Traceback (most recent call last): File "/usr/local/bin/ford", line 9, in
load_entry_point('FORD==1.1.0', 'console_scripts', 'ford')() File "/usr/local/lib/python2.7/dist-packages/ford/init.py", line 152, in main project.correlate() File "/usr/local/lib/python2.7/dist-packages/ford/fortran_project.py", line 129, in correlate container.correlate(self) File "/usr/local/lib/python2.7/dist-packages/ford/sourceform.py", line 396, in correlate func.correlate(project) File "/usr/local/lib/python2.7/dist-packages/ford/sourceform.py", line 407, in correlate arg.correlate(project) AttributeError: 'str' object has no attribute 'correlate' | This also fails: https://github.com/dannyk96/danfe/blob/master/src/danfront.f90
This case is simpler with no 'contains' subroutines
— Reply to this email directly or view it on GitHub https://github.com/cmacmackin/ford/issues/32#issuecomment-95479896.
Chris MacMackin Saint Mary's University Curriculum Vitae http://ap.smu.ca/%7Ecmacmack/CV.pdf
Chris MacMackin Saint Mary's University Curriculum Vitae http://ap.smu.ca/%7Ecmacmack/CV.pdf
Yes Chris, implicit definition is allowed (even if it is a bad practice).
I do not know how FORD parses the procedure dummy arguments, but I think that the best way is to assign to each parsed argument a default type (accordingly to the implicit definition rules) and later assign them the actual type if they are explicitly defined in the code.
I do not remember the rules for implicit definition (variable starting with x-z should by real, starting with i-k should be integer and so on), but into the standard they are clearly indicated.
My 2 cents.
See you soon.
I did after some googling get the patch to apply. I used:
git apply --reject --whitespace=fix /tmp/git/ford.patch
I wonder if one of the problems was me screen scraping from above for the patch - and so some tab/space changing. The problem though in the ticket still remains (implicit none?)
The exact same problem, with the same traceback etc.? I haven't fixed the implicit none stuff yet (I will, I just have some other stuff I want to finish first), but that should give a different traceback/error message than in your original bug report.
On 23/04/15 12:55 PM, Daniel Kidger wrote:
I did after some googling get the patch to apply. I used:
git apply --reject --whitespace=fix /tmp/git/ford.patch I wonder if one of the problems was me screen scraping from above for the patch - and so some tab/space changing. The problem though in the ticket still remains (implicit none?)
— Reply to this email directly or view it on GitHub https://github.com/cmacmackin/ford/issues/32#issuecomment-95632287.
Chris MacMackin Saint Mary's University Curriculum Vitae http://ap.smu.ca/%7Ecmacmack/CV.pdf
No not necessarily teh same backtrace - but it still failed.
Fortran has always allowed implicit types: (i,j,k,l,m,n)*
Are you sure that n
is the culprit?
n is still in scope - as it is defined in the main program that CONTAINS the subroutine Setup()
i however has no explicit type so defaults to integer.
For teh record backtrace is now
t$ /tmp/git2/ford/ford.py testbed.md
Reading file ./testbed/ruritania.f90
Correlating information from different parts of your project...
Traceback (most recent call last):
File "/tmp/git2/ford/ford.py", line 7, in <module>
main()
File "/tmp/git2/ford/ford/__init__.py", line 158, in main
project.correlate()
File "/tmp/git2/ford/ford/fortran_project.py", line 136, in correlate
container.correlate(self)
File "/tmp/git2/ford/ford/sourceform.py", line 408, in correlate
func.correlate(project)
File "/tmp/git2/ford/ford/sourceform.py", line 419, in correlate
arg.correlate(project)
AttributeError: 'str' object has no attribute 'correlate'
I'm very confident that the problem is with n. I know that Fortran permits implicit typing, but since I've never used it I forgot to allow for it when dealing with arguments. The fact that n is still in scope from the main program won't make a difference because I know FORD won't be looking there when it is matching arguments with variable declarations. I should have this fixed by the end of the day at the latest and will push the updates to GitHub then.
Ok. If you want lots more test Fortran - you are welcome to whatever I have on github. It was mostly written around 1991-1996 when F90 was still quite new.
I've just pushed a version to GitHub which can handle both of the files you've demonstrated problems with. If you encounter any other bugs, please let me know. Note that while implicit typing is now supported for arguments, only the defualts are used--FORD won't know if someone manually sets how implicit typing should be applied. I'm not going to spend much time thinking about how to introduce this feature, as there are other, more important things to implement.
Thanks. I can confirm that it all works now.
I have opened a couple more tickets. One quick question here:
How does -e work?
I have some Fotran90 source that is fixed format and ends in .f not .f90
writing -ef -ef90
does not appear to work.
What is the correct syntax ?
Note that I also have `.F90' : where I use the preprocessor in gfortran - these source files are not being picked up by default by default.
The correct syntax would be -e f f90
. However, fixed-form source files
are not currently supported (sorry). Problems will arise from comments
which begin with c rather than ! and from line continuation. If you're
one of those people who includes text after the 72nd column as a way of
commenting then that would also be problematic. At some point I probably
will added the ability to handle fixed-form files, but there are various
other improvements which take priority.
I've added the preprocessor extensiosn to the default extensions. I'll be pushing the changes to GitHub once I've dealt with your other tickets.
On 24/04/15 04:23 AM, Daniel Kidger wrote:
Note that I also have `.F90' : where I use the preprocessor in gfortran - these source files are not being picked up by default by default.
— Reply to this email directly or view it on GitHub https://github.com/cmacmackin/ford/issues/32#issuecomment-95832594.
Chris MacMackin Saint Mary's University Curriculum Vitae http://ap.smu.ca/%7Ecmacmack/CV.pdf
Can you confirm that that syntax works for you? For example I try here for .f03 and .f90 source
$ ford -e F90 f90 ford_master.md
usage: ford [-h] [-d [PROJECT_DIR [PROJECT_DIR ...]]] [-o OUTPUT_DIR] [-s CSS]
[--exclude EXCLUDE] [-e [EXTENSIONS [EXTENSIONS ...]]] [-w]
[--no-warn] [-V]
project_file
ford: error: too few arguments
You need to put the project file before the -e. Unfortunately, the output generated by python's CLI library is rather misleading in that regard. But if you run
|$ ford|||ford_master.md| -e F90 f90|
then it should work.
On 24/04/15 12:35 PM, Daniel Kidger wrote:
Can you confirm that that syntax works for you? For example I try here for .f03 and .f90 source
$ ford -e F90 f90 ford_master.md usage: ford [-h] [-d [PROJECT_DIR [PROJECT_DIR ...]]] [-o OUTPUT_DIR] [-s CSS] [--exclude EXCLUDE] [-e [EXTENSIONS [EXTENSIONS ...]]] [-w] [--no-warn] [-V] project_file ford: error: too few arguments — Reply to this email directly or view it on GitHub https://github.com/cmacmackin/ford/issues/32#issuecomment-95969311.
Chris MacMackin Saint Mary's University Curriculum Vitae http://ap.smu.ca/%7Ecmacmack/CV.pdf
Ok yes that works - the usage information is wrong then.
And indeed expectation is that argument(s) that are not preceded my a -[x]
flag are always to teh right of those which are.
On the other point of fixed format source files. No nothing I have has junk after column 72 : indeed I have up to 132 columns of code - same as the free form standard. All comments start with ! (and if any do not then I will quickly fix that) But yes there are continuation lines - I use '&' in column 6 For free-format source I do the same but put a '&' also at the end of the previous line
It would be good if such continuation lines could be parsed.
I've fixed the CLI/CLI documentation. It should now meet with your satisfaction. Those changes are on GitHub. You can also get them (along with all of the other improvements and bugfixes I've made over the last week) from PyPI.
I am testing FORD on some of my small and large Fortran projects.
I can get it to work on a few test cases. But in most cases I am getting errors like below.
Can this be fixed or at least a workaround advised?