]> code.delx.au - gnu-emacs-elpa/blob - packages/f90-interface-browser/README.org
Merge commit '0cda39255827f283e7578cd469ae42daad9556a2' from js2-mode
[gnu-emacs-elpa] / packages / f90-interface-browser / README.org
1 * Fortran editing helpers for Emacs
2
3 ** Overview
4
5 You write (or work on) large, modern fortran code bases. These make
6 heavy use of function overloading and generic interfaces. Your brain
7 is too small to remember what all the specialisers are called.
8 Therefore, your editor should help you. This is an attempt to do
9 this for Emacs.
10
11 f90-interface-browser.el is a (simple-minded) parser of fortran that
12 understands a little about generic interfaces and derived types.
13
14 ** External functions
15
16 - =f90-parse-interfaces-in-dir= :: Parse all the fortran files in a
17 directory
18 - =f90-parse-all-interfaces= :: Parse all the fortran files in a
19 directory and recursively in its subdirectories
20 - =f90-browse-interface-specialisers= :: Pop up a buffer showing all
21 the specialisers for a particular generic interface (prompted
22 for with completion)
23 - =f90-find-tag-interface= :: On a procedure call, show a list of the
24 interfaces that match the (possibly typed) argument list. If no
25 interface is found, this falls back to =find-tag=.
26 - =f90-list-in-scope-vars= :: List all variables in local scope. This
27 just goes to the top of the current procedure and collects named
28 variables, so it doesn't work with module or global scope
29 variables or local procedures.
30 - =f90-show-type-definition= :: Pop up a buffer showing a derived type
31 definition.
32
33 ** Customisable variables
34
35 - =f90-file-extensions= :: A list of extensions that the parser will
36 use to decide if a file is a fortran file.
37
38 ** Details and caveats
39
40 The parser assumes you write fortran in the style espoused in Metcalf,
41 Reid and Cohen. Particularly, variable declarations use a double
42 colon to separate the type from the name list.
43
44 Here's an example of a derived type definition:
45 #+BEGIN_SRC f90
46 type foo
47 real, allocatable, dimension(:) :: a
48 integer, pointer :: b, c(:)
49 type(bar) :: d
50 end type foo
51 #+END_SRC
52
53 Here's a subroutine declaration:
54 #+BEGIN_SRC f90
55 subroutine foo(a, b)
56 integer, intent(in) :: a
57 real, intent(inout), dimension(:,:) :: b
58 ...
59 end subroutine foo
60 #+END_SRC
61
62 Local procedures whose names conflict with global ones will likely
63 confuse the parser. For example:
64 #+BEGIN_SRC f90
65 subroutine foo(a, b)
66 ...
67 end subroutine foo
68
69 subroutine bar(a, b)
70 ...
71 call subroutine foo
72 ...
73 contains
74 subroutine foo
75 ...
76 end subroutine foo
77 end subroutine bar
78 #+END_SRC
79
80 Also not handled are overloaded operators, scalar precision modifiers,
81 like =integer(kind=c_int)=, for which the precision is just ignored, and
82 many other of the hairier aspects of the fortran language.