Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
29253 Discussions

Code management in visual studio

eos_pengwern
Beginner
1,520 Views
Hello,

As my main IVF application grows into dozens of modules andmany thousands of lines, it becomes harder and harder to manage the source code in Visual Studio. Other modern programming environments that I have used, such as the MATLAB code editor or Visual Basic, provide useful navigation functions such as:
- the ability to jump straight to a subroutine definition within a large module
- the ability to jump from a subroutine definition to the place(s) from which that subroutine is called
- the ability to break a large subroutine into 'cells' which can be navigated between or hidden when not being worked on.

I cannot find any features comparable to these in the Visual Studio/IVF environment; the nearest workaround is the use of 'Bookmarks', but these are very cumbersome by comparison. I vaguely remember reading somewhere on this forum that Microsoft had refused to license to Intel the IP which would have allowed some of these features to be implemented in the Fortran environment. Is that true? Or is the functionality all there, and I have simply been unable to figure it out?

If this cannot be done in Visual Studio, does anyone have experience of managing IVF code in an alternative environment (e.g. some flavor of Emacs) that provides this capability. What do the Linux guys do, for example?

Many thanks,
Stephen.
0 Kudos
13 Replies
IanH
Honored Contributor III
1,520 Views
I have no suggestions for the problem as you describe. Source browsing is something that I use for C++ projects within VS and it would be nice to have for IVF (less so the need for source cells - difficult to navigate, monolithic subroutines suggest to me a rework into a collection of smaller worker routines might be useful from a code comprehension point of view anyway, but that's just a personal preference).

Something that is a partial work-around (and it is not an in-IDE solution) is to use the in-source documentation tools to give yourself a source code "map" that you can browse in a web browser alongside Visual Studio. I use doxygen - the generated web-site let's me quickly navigate to a particular procedure in a particular module, read the documentation, check the parameter list and (on the proviso that the procedure/type/module has documentation and it is accurate...) often that's all that I was chasing anyway. With appropriate flags you can include the subroutine bodies/file contents in the documentation as well, but by that stage you are probably better off locating the relevant file/line number manually in VS.

There's definitely some work required to put in the necessary in-source comments, but if it replaces an existing documentation system (or perhaps starts it...) then you could argue that's zero cost.

Doxygen support for code written to the more modern fortran standards is by no means perfect, but good enough for me, especially considering the price. !> @todo Help them remove some of the more annoying wrinkles.

IanH

0 Kudos
eos_pengwern
Beginner
1,520 Views
Thank you Ian; I checked out the documentation for it and it may well be some help.

I've also been looking at the documentation for VisEmacs as a replacement text editor to use within Visual Studio. I wonder if there's anyone in this forum who has experience of using that...

Stephen.
0 Kudos
Paul_Curtis
Valued Contributor I
1,520 Views
Quoting - eos pengwern
Hello,

As my main IVF application grows into dozens of modules andmany thousands of lines, it becomes harder and harder to manage the source code in Visual Studio. Other modern programming environments that I have used, such as the MATLAB code editor or Visual Basic, provide useful navigation functions such as:
- the ability to jump straight to a subroutine definition within a large module
- the ability to jump from a subroutine definition to the place(s) from which that subroutine is called


Put the cursor on the routine name, then start a project-wide search, for which the (routine, variable, function, etc.) name under the cursor shows up as the default search argument; searching instantly delivers a list of all instances of the search argument, in all files linked to your project. Clicking on the routine itself in the search list (opens the source file and) brings up the code. Couldn't be simpler.
0 Kudos
DavidWhite
Valued Contributor II
1,520 Views
The other source documentation tool you may like to look at is Robodoc. Like doxygen, it started as a C / Java documentation tool, but it is readily adaptable and has the appropriate options for Fortan. You can get it from
http://sourceforge.net/projects/robodoc/

I have been using it for more than 5 years.
0 Kudos
eos_pengwern
Beginner
1,520 Views
Quoting - Paul Curtis

Put the cursor on the routine name, then start a project-wide search, for which the (routine, variable, function, etc.) name under the cursor shows up as the default search argument; searching instantly delivers a list of all instances of the search argument, in all files linked to your project. Clicking on the routine itself in the search list (opens the source file and) brings up the code. Couldn't be simpler.

Yes, that works! I found it a bit counter-intuitive to start off with (having to go to the toolbar, then select Edit/Find& Replace/Find in Files, rather that just right-clicking), but it does the job. Doing the same thing on the word 'Subroutine' and searching within the file gives a decent approximation to the 'jump straight to subroutine' capability that I'd been looking for.

Better still, by poking around myself I've found something that approximates to the 'cell view' function that I'm used to in MATLAB. If you highlight a block of text, then right-click, select the 'Outlining' item and then 'Hide selection', it will collapse the block of text down to an ellipsis ('...'), with a little 'plus' sign to the left hand side which can be used to re-expand it. This can be nested as well, i.e. you can have one collapsed block of text within another collapsed block of text. Still nowhere near as intuitive as the MATLAB editor, but it does the job.

Thank you Paul.

Stephen.

0 Kudos
eos_pengwern
Beginner
1,520 Views
Quoting - David White
The other source documentation tool you may like to look at is Robodoc. Like doxygen, it started as a C / Java documentation tool, but it is readily adaptable and has the appropriate options for Fortan. You can get it from
http://sourceforge.net/projects/robodoc/

I have been using it for more than 5 years.

Thank you, I'll have a look at this as well.

Stephen.
0 Kudos
Jugoslav_Dujic
Valued Contributor II
1,520 Views
Quoting - eos pengwern

Yes, that works! I found it a bit counter-intuitive to start off with (having to go to the toolbar, then select Edit/Find& Replace/Find in Files, rather that just right-clicking), but it does the job. Doing the same thing on the word 'Subroutine' and searching within the file gives a decent approximation to the 'jump straight to subroutine' capability that I'd been looking for.

Ctrl+Shift+F is what you looking for (unless perhaps you have some fancy "VB" key mapping). It's not as elegant as (Ctrl+)F12 of the source browser, but does the job in many cases... at least if you don't have 1,000 instances of the searched symbol.
0 Kudos
Izaak_Beekman
New Contributor II
1,520 Views
Quoting - eos pengwern
- the ability to jump straight to a subroutine definition within a large module
- the ability to jump from a subroutine definition to the place(s) from which that subroutine is called

Emacs has various utilities which come with the default package for performing these two tasks. Not sure whether or not there are other features of visual studio which you are maried to, but emacs integrates nicely with source management tools such as cvs, suports fortran syntax highlighting and, in the 'f90 imenu' will give you a list of routines in your program allowing you to navigate between them. It also supports regular expression searches and search and replaces, extensive user customization, interfacing with the environment/compiler/build tools to compile and link codes and take you to syntax errors etc. in the source with one lick. It is extensible, open source and free.
0 Kudos
eos_pengwern
Beginner
1,520 Views
Quoting - zbeekman

Emacs has various utilities which come with the default package for performing these two tasks. Not sure whether or not there are other features of visual studio which you are maried to, but emacs integrates nicely with source management tools such as cvs, suports fortran syntax highlighting and, in the 'f90 imenu' will give you a list of routines in your program allowing you to navigate between them. It also supports regular expression searches and search and replaces, extensive user customization, interfacing with the environment/compiler/build tools to compile and link codes and take you to syntax errors etc. in the source with one lick. It is extensible, open source and free.

Thank you. For the time being I'm working in Visual Studio and using the new features that I've learned about from this thread, but I quite like the idea of trying out Emacs at some point espcially if I can use VisEmacs to get the best of both worlds. This is something I'll come back to, however, perhaps in a couple of months; for the time being I need to finish the part of my application that I'm currently writing...

Stephen.
0 Kudos
martin_upsdellagrese
1,520 Views
Quoting - eos pengwern
Hello,

As my main IVF application grows into dozens of modules andmany thousands of lines, it becomes harder and harder to manage the source code in Visual Studio. Other modern programming environments that I have used, such as the MATLAB code editor or Visual Basic, provide useful navigation functions such as:
- the ability to jump straight to a subroutine definition within a large module
- the ability to jump from a subroutine definition to the place(s) from which that subroutine is called
- the ability to break a large subroutine into 'cells' which can be navigated between or hidden when not being worked on.

I cannot find any features comparable to these in the Visual Studio/IVF environment; the nearest workaround is the use of 'Bookmarks', but these are very cumbersome by comparison. I vaguely remember reading somewhere on this forum that Microsoft had refused to license to Intel the IP which would have allowed some of these features to be implemented in the Fortran environment. Is that true? Or is the functionality all there, and I have simply been unable to figure it out?

If this cannot be done in Visual Studio, does anyone have experience of managing IVF code in an alternative environment (e.g. some flavor of Emacs) that provides this capability. What do the Linux guys do, for example?

Many thanks,
Stephen.

0 Kudos
martin_upsdellagrese
1,520 Views
Quoting - eos pengwern
Hello,

As my main IVF application grows into dozens of modules andmany thousands of lines, it becomes harder and harder to manage the source code in Visual Studio. Other modern programming environments that I have used, such as the MATLAB code editor or Visual Basic, provide useful navigation functions such as:
- the ability to jump straight to a subroutine definition within a large module
- the ability to jump from a subroutine definition to the place(s) from which that subroutine is called
- the ability to break a large subroutine into 'cells' which can be navigated between or hidden when not being worked on.

I cannot find any features comparable to these in the Visual Studio/IVF environment; the nearest workaround is the use of 'Bookmarks', but these are very cumbersome by comparison. I vaguely remember reading somewhere on this forum that Microsoft had refused to license to Intel the IP which would have allowed some of these features to be implemented in the Fortran environment. Is that true? Or is the functionality all there, and I have simply been unable to figure it out?

If this cannot be done in Visual Studio, does anyone have experience of managing IVF code in an alternative environment (e.g. some flavor of Emacs) that provides this capability. What do the Linux guys do, for example?

Many thanks,
Stephen.

I use Ed4 Windows obtainable from http://www.getsoft.com/index.html which is Fortran Savy and maintains a list of your subourtines as you type.Right clicking on a subroutine will go to its definition,and cnrtl / while on the name of the subrotuine will give a list of its arguments. Cnlt pageup will take you to the start of the subroutine where you can check definitions.
0 Kudos
ZlamalJakub
New Contributor III
1,520 Views
When I am seraching for definition of

subrouine ParseC(A,B,C)

I use Ctrl+Shift+F (Find in files) and search for string "ne ParseC" (last two characters of suroutine and its name)

This search finds only definition of subroutine and not "call" to subroutine

To search function I am using "ion funname" and to search module "le modname"


Jakub
0 Kudos
John4
Valued Contributor I
1,520 Views
Quoting - eos pengwern

Thank you. For the time being I'm working in Visual Studio and using the new features that I've learned about from this thread, but I quite like the idea of trying out Emacs at some point espcially if I can use VisEmacs to get the best of both worlds. This is something I'll come back to, however, perhaps in a couple of months; for the time being I need to finish the part of my application that I'm currently writing...

Stephen.

I read somewhere that there's a Windows version of Geany. I tried the Linux version a couple of times and it handles tags pretty well.

Or if you feel like tweaking a little bit, you can try Eclipse CDT with the Photran plugin (installing it on Windows is not very straightforward, but it can be done).

0 Kudos
Reply