Skip to main content

Notice: this Wiki will be going read only early in 2024 and edits will no longer be possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.

Jump to: navigation, search

Difference between revisions of "PTP/photran/documentation/photran5"

Line 1: Line 1:
You are here: [[PTP]] > [[PTP/photran/ | Photran]] > [[PTP/photran/documentation | Documentation]] > [[PTP/photran/documentation/photran5 | Photran 5.0 User's Guide]]
+
You are here: [[PTP]] > [[PTP/photran/|Photran]] > [[PTP/photran/documentation|Documentation]] > [[PTP/photran/documentation/photran5|Photran 5.0 User's Guide]]
 +
<br>
 +
<br>
 +
<br>
 +
<br>
 +
<big><big><big><big>Photran 5.0 User's Guide</big></big></big></big>
 
<br>
 
<br>
 +
<br>
 +
<br>
 
<br>
 
<br>
 +
'''IMPORTANT:''' For the time being, this is just an outline of the
 +
documentation we intend to write before the release of Photran 5.0
 +
in September, 2009. It is not useful yet. Of course, you are
 +
welcome to fill in any sections you wish... this is a wiki!
 +
= Installing Photran  =
 +
== System Requirements  ==
 +
To install Photran 5.0...
 +
<br>
 +
<br>
 +
#You must have '''Eclipse 3.5 (Galileo)''' installed.
 +
#You should have the '''C/C++ Development Tools (CDT) 6.0''' installed. If you do not, they will be installed automatically when you install Photran.
 +
#Eclipse must be running on a '''Java 1.5 or later Java Virtual Machine (JVM).''' To get reasonable performance, we recommend Sun's JVM [http://java.com/en/download/manual.jsp] or IBM's [http://wiki.eclipse.org/index.php/J9]. GNU Classpath (the default JVM on Fedora Linux) is generally too slow to be useful.
 +
#If you want to compile and build Fortran applications, you must have a '''make utility and a Fortran compiler''' in your system path. Many Linux/Unix systems include these; details on installing them in Windows and Mac are below.
  
<big><big><big><big>Photran 5.0 User's Guide</big></big></big></big>
+
== Installation Procedure  ==
 +
 
 +
To install Photran, start Eclipse, then...
 +
<br>
 
<br>
 
<br>
 +
#Download the latest Photran zip file from [http://wiki.eclipse.org/PTP/builds/photran/4.0]
 +
#Click on Help &gt; Software Updates...
 +
#Click on the "Available Software" tab
 +
#Click on "Add Site..."
 +
#Click Archive...
 +
#Choose the zip file you downloaded from [http://wiki.eclipse.org/PTP/builds/photran/4.0]
 +
#Click OK to close the Add Site dialog
 +
#The zip file should appear in the list as jar:file:/path/to/photran-master-4.0.5-something. Expand it.
 +
#Expand "Photran (Eclipse Fortran Development Tools)" and check the box next to "Photran (Eclipse Fortran Development Tools)"
 +
#If you are running Linux and have the Intel Fortran Compiler installed, or if you are on a Macintosh and have the IBM XL Fortran compiler installed, expand "Photran Compiler Support" and select the appropriate compiler.
 +
#Click on the "Install..." button in the ''upper-right corner'' of the dialog box.
 +
 +
== Additional Instructions for Windows Users  ==
 +
To compile and run Fortran programs in Photran, you will need to have a Fortran compiler and make utility installed. Most Linux/Unix distributions include these; [http://gcc.gnu.org/fortran/ gfortran] is commonly used (and free). Under Windows, you will need to install Cygwin [http://www.cygwin.com/] or MinGW [http://www.mingw.org/] and put them on your Windows PATH.
 +
<br>
 +
'''Instructions for Cygwin:'''
 
<br>
 
<br>
'''IMPORTANT:''' For the time being, this is just an outline of the
+
<br>
documentation we intend to write before the release of Photran 5.0
+
<br>
in September, 2009. It is not useful yet. Of course, you are
+
#Install [Cygwin http://www.cygwin.com/]; the defaults are mostly OK, but you will need to explicitly tell it to include the "Devel" packages (at least gcc4-fortran, gdb, and make) when the installer asks you to select what packages to install. (If gcc4-fortran is not listed under the "Devel" packages, you may have chosen a bad mirror; restart the Cygwin installation, and choose a different mirror instead. Georgia Tech's mirror at gtlib.gatech.edu is generally quite fast and reliable, for example.)
welcome to fill in any sections you wish... this is a wiki!
+
#Add the Cygwin directories to your Windows PATH. Under Windows XP, the process is as follows:
 +
##Make sure you are logged in under an administrator account.
 +
##Open the Control Panel.
 +
##Double-click the System icon.
 +
##Switch to the Advanced tab.
 +
##Click the Environment Variables button.
 +
##Under System Variables, find the variable "Path" in the list, and click on it.
 +
##Click Edit.
 +
##At the end of the "Variable Value" text, add <pre>;C:\Cygwin\bin;C:\Cygwin\usr\bin;C:\Cygwin\usr\local\bin;C:\Cygwin\lib;C:\Cygwin\usr\lib</pre>
 +
##Click OK, click OK, click OK, and close the Control Panel.
 +
##Close and re-open Photran. Windows should now search C:\Cygwin\bin, C:\Cygwin\usr\bin, etc. when it's looking for executables (including make.exe, gcc.exe, and gfortran.exe).
  
=Installing Photran=
+
== Additional Instructions for Mac OS X Users  ==
 +
If you install gfortran on Mac OS X, it may be installed in /usr/local/bin, which is not (by default) on the PATH. If you are launching Eclipse from a Terminal, the PATH can be set by modifying /etc/paths. However, if you are launching Eclipse from the Finder (by double clicking on it) or the Dock, then the PATH is not obtained from the shell or /etc/paths. Instead, it's obtained from ~/.MacOSX/environment.plist. The format of the environment.plist file is as follows (change the path appropriately). ''If you create or edit this file, you will need to log out (or reboot) before the changes will take effect.''
 +
<pre>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
 +
&lt;!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"&gt;
 +
&lt;plist version="1.0"&gt;
 +
&lt;dict&gt;
 +
    &lt;key&gt;PATH&lt;/key&gt;
 +
    &lt;string&gt;/usr/local/mpi/bin:/usr/local/bin:/bin:/sbin:/usr/bin:/usr/sbin:/sbin:/usr/sbin:/Developer/Tools:/usr/texbin:/Users/greg/bin&lt;/string&gt;
 +
&lt;/dict&gt;
 +
&lt;/plist&gt;
 +
</pre>
 +
= Starting a New Project  =
 +
TODO
 +
<br>
 +
'''For more information,''' click on Help &gt; Help Contents in Eclipse, and navigate to
 +
'''C/C++ Development User Guide &gt; Concepts &gt; CDT Projects.'''
 +
== Starting a Project with an Auto-Generated Makefile  ==
 +
TODO
 +
<br>
 +
<br>
 +
<br>
 +
<br>
 +
<br>
 +
<br>
 +
If your system has the GNU gfortran compiler installed, try this.
 +
#Click File | New | Fortran Project
 +
#Call it whatever
 +
#Choose the Executable (Gnu Fortran) from the project type list
 +
#Choose GCC Toolchain from the toolchain list (you may need to uncheck
 +
the "Show project types..." check box at the bottom of the window)
 +
#Click Next
 +
#Click on Advanced Settings
 +
#Expand C/C++ Build in the list on the left, and click on Settings
 +
#Click on the Binary Parsers tab.&nbsp; Check the appropriate
 +
parsers for your platform. If you are using Windows, check
 +
PE Windows Parser and/or Cygwin PE Parser; if you are using Linux,
 +
check Elf Parser; if you are using Mac, check Mach-O parser.
 +
#Click on the Error Parsers tab. Check the error parser(s) for the
 +
Fortran compiler(s) you will use.
 +
#Click OK
 +
#Click Finish
 +
#Click File | New | Source File
 +
#Call it hello.f90; click Finish
 +
#Type the standard "Hello, World" program, and click
 +
File | Save.
 +
<pre>program hello
 +
    print *, "Hello World"
 +
end program</pre>
 +
 +
#Open the Console view, and make sure "make" ran OK
  
== System Requirements ==
+
and compiled your program
 +
  
To install Photran 5.0...
+
#In the Fortran Projects view, expand the Binaries
# You must have '''Eclipse 3.5 (Galileo)''' installed.
+
# You should have the '''C/C++ Development Tools (CDT) 6.0''' installed.  If you do not, they will be installed automatically when you install Photran.
+
# Eclipse must be running on a '''Java 1.5 or later Java Virtual Machine (JVM).'''  To get reasonable performance, we recommend Sun's JVM [http://java.com/en/download/manual.jsp] or IBM's [http://wiki.eclipse.org/index.php/J9].  GNU Classpath (the default JVM on Fedora Linux) is generally too slow to be useful.
+
# If you want to compile and build Fortran applications, you must have a '''make utility and a Fortran compiler''' in your system path.  Many Linux/Unix systems include these; details on installing them in Windows and Mac are below.
+
  
== Installation Procedure ==
+
entry, and click on your
 +
executable (e.g., "whatever - [x86le]")
 +
  
To install Photran, start Eclipse, then...
+
#Run | Run As | Run Local C/C++ Application (yeah, I
  
# Download the latest Photran zip file from [http://wiki.eclipse.org/PTP/builds/photran/4.0]
+
know, it should say "Fortran Application", but it doesn't)  
# Click on Help > Software Updates...
+
# Click on the "Available Software" tab
+
# Click on "Add Site..."
+
# Click Archive...
+
# Choose the zip file you downloaded from [http://wiki.eclipse.org/PTP/builds/photran/4.0]
+
# Click OK to close the Add Site dialog
+
# The zip file should appear in the list as jar:file:/path/to/photran-master-4.0.5-something. Expand it.
+
# Expand "Photran (Eclipse Fortran Development Tools)" and check the box next to "Photran (Eclipse Fortran Development Tools)"
+
# If you are running Linux and have the Intel Fortran Compiler installed, or if you are on a Macintosh and have the IBM XL Fortran compiler installed, expand "Photran Compiler Support" and select the appropriate compiler.
+
# Click on the "Install..." button in the ''upper-right corner'' of the dialog box.
+
  
== Additional Instructions for Windows Users  ==
+
#Choose GDB Debugger (Cygwin GDB Debugger if you're
  
To compile and run Fortran programs in Photran, you will need to have a Fortran compiler and make utility installed. Most Linux/Unix distributions include these; [http://gcc.gnu.org/fortran/ gfortran] is commonly used (and free). Under Windows, you will need to install Cygwin [http://www.cygwin.com/] or MinGW [http://www.mingw.org/] and put them on your Windows PATH.
+
under Windows)  
 
   
 
   
  
'''Instructions for Cygwin:'''
+
#Check the Console view, and make sure Hello World appeared.
 +
 
 +
<br>
 
   
 
   
  
#Install [Cygwin http://www.cygwin.com/]; the defaults are mostly OK, but you will need to explicitly tell it to include the "Devel" packages (at least gcc4-fortran, gdb, and make) when the installer asks you to select what packages to install. (If gcc4-fortran is not listed under the "Devel" packages, you may have chosen a bad mirror; restart the Cygwin installation, and choose a different mirror instead. Georgia Tech's mirror at gtlib.gatech.edu is generally quite fast and reliable, for example.)
+
<br>
 +
<br>
 
   
 
   
#Add the Cygwin directories to your Windows PATH. Under Windows XP, the process is as follows:
+
 
 +
<br>
 
   
 
   
##Make sure you are logged in under an administrator account.
+
 
 +
== Starting a Project with a Hand-Written Makefile  ==
 +
 
 +
TODO
 
   
 
   
##Open the Control Panel.
+
 
 +
<br>
 +
<br>
 
   
 
   
##Double-click the System icon.
+
 
 
   
 
   
##Switch to the Advanced tab.
 
 
   
 
   
##Click the Environment Variables button.
 
 
   
 
   
##Under System Variables, find the variable "Path" in the list, and click on it.
+
 
 +
If you're under Windows, make sure you have installed Cygwin (or MinGW)
 
   
 
   
##Click Edit.
+
 
 +
according to the installation instructions above.
 +
 
 +
#File | New | Fortran Project
 +
 
 +
#Call it whatever
 +
 
 +
#Expand "Makefile project" in the project type list (it has a folder icon),
 +
 
 +
and choose Empty Project
 
   
 
   
##At the end of the "Variable Value" text, add <pre>;C:\Cygwin\bin;C:\Cygwin\usr\bin;C:\Cygwin\usr\local\bin;C:\Cygwin\lib;C:\Cygwin\usr\lib</pre>
+
 
##Click OK, click OK, click OK, and close the Control Panel.
+
#Make sure "-- Other Toolchain --" is selected in the
 +
 
 +
toolchain list in the right-hand column, and
 +
click Next
 
   
 
   
##Close and re-open Photran. Windows should now search C:\Cygwin\bin, C:\Cygwin\usr\bin, etc. when it's looking for executables (including make.exe, gcc.exe, and gfortran.exe).
 
  
== Additional Instructions for Mac OS X Users ==
+
#Click on Advanced Settings
  
If you install gfortran on Mac OS X, it may be installed in /usr/local/bin, which is not (by default) on the PATH.  If you are launching Eclipse from a Terminal, the PATH can be set by modifying /etc/paths.  However, if you are launching Eclipse from the Finder (by double clicking on it) or the Dock, then the PATH is not obtained from the shell or /etc/paths. Instead, it's obtained from ~/.MacOSX/environment.plist. The format of the environment.plist file is as follows (change the path appropriately). ''If you create or edit this file, you will need to log out (or reboot) before the changes will take effect.''
+
#Expand C/C++ Build in the list on the left, and click on Settings
  
<pre>
+
#Click on the Binary Parsers tab.&nbsp; Check the appropriate
<?xml version="1.0" encoding="UTF-8"?>
+
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+
<plist version="1.0">
+
<dict>
+
    <key>PATH</key>
+
    <string>/usr/local/mpi/bin:/usr/local/bin:/bin:/sbin:/usr/bin:/usr/sbin:/sbin:/usr/sbin:/Developer/Tools:/usr/texbin:/Users/greg/bin</string>
+
</dict>
+
</plist>
+
</pre>
+
  
=Starting a New Project=
+
parsers for your platform. If you are using Windows, check
 +
PE Windows Parser and/or Cygwin PE Parser; if you are using Linux,
 +
check Elf Parser; if you are using Mac, check Mach-O parser.
 +
  
TODO
+
#Click on the Error Parsers tab. Check the error parser(s) for the
  
'''For more information,''' click on Help > Help Contents in Eclipse, and navigate to
+
Fortran compiler(s) you will use.
'''C/C++ Development User Guide > Concepts > CDT Projects.'''
+
  
==Starting a Project with an Auto-Generated Makefile==
+
#Click OK
TODO
+
  
 +
#Click Finish
  
      <p>If your system has the GNU gfortran compiler installed, try this.</p>
+
#File | New | File
      <ol>
+
        <li>Click File | New | Fortran Project </li>
+
        <li>Call it whatever</li>
+
        <li>Choose the Executable (Gnu Fortran) from the project type list</li>
+
        <li>Choose GCC Toolchain from the toolchain list (you may need to uncheck
+
            the &quot;Show project types...&quot; check box at the bottom of the
+
            window)
+
        <li>Click Next</li>
+
        <li>Click on Advanced Settings</li>
+
        <li>Expand C/C++ Build in the list on the left, and click on Settings</li>
+
        <li>Click on the Binary Parsers tab.&nbsp; Check the appropriate
+
        parsers for your platform.  If you are using Windows, check
+
        PE Windows Parser and/or Cygwin PE Parser; if you are using Linux,
+
        check Elf Parser; if you are using Mac, check Mach-O parser.</li>
+
        <li>Click on the Error Parsers tab.  Check the error parser(s) for the
+
        Fortran compiler(s) you will use.</li>
+
        <li>Click OK</li>
+
        <li>Click Finish</li>
+
        <li>Click File | New | Source File </li>
+
        <li>Call it hello.f90; click Finish</li>
+
        <li>Type the standard "Hello, World" program, and click
+
        File | Save.
+
<pre>program hello
+
    print *, "Hello World"
+
end program</pre>
+
        </li>
+
        <li>Open the Console view, and make sure "make" ran OK
+
        and compiled your program </li>
+
        <li>In the Fortran Projects view, expand the Binaries
+
        entry, and click on your
+
        executable (e.g., "whatever - [x86le]") </li>
+
        <li>Run | Run As | Run Local C/C++ Application (yeah, I
+
        know, it should say "Fortran Application", but it doesn't) </li>
+
        <li>Choose GDB Debugger (Cygwin GDB Debugger if you're
+
        under Windows) </li>
+
        <li>Check the Console view, and make sure Hello World appeared.</li>
+
      </ol>
+
  
==Starting a Project with a Hand-Written Makefile==
+
#Call it Makefile
  
TODO
+
#Click Finish
 +
 
 +
#We assume you're familiar with how to format a
  
      <p>If you're under Windows, make sure you have installed Cygwin (or MinGW)
+
  Makefile.&nbsp; Something like this will work for now.&nbsp;
        according to the installation instructions above.</p>
+
Remember
      <ol>
+
to start the g95 line with a tab, not spaces. &nbsp;The -g switch
        <li>File | New | Fortran Project </li>
+
instructs g95 to include debugging symbols in the generated executable
        <li>Call it whatever</li>
+
so that it can be debugged later.
        <li>Expand &quot;Makefile project&quot; in the project type list (it has a folder icon),
+
            and choose Empty Project</li>
+
        <li>Make sure &quot;-- Other Toolchain --&quot; is selected in the
+
        toolchain list in the right-hand column, and
+
        click Next</li>
+
        <li>Click on Advanced Settings</li>
+
        <li>Expand C/C++ Build in the list on the left, and click on Settings</li>
+
        <li>Click on the Binary Parsers tab.&nbsp; Check the appropriate
+
        parsers for your platform. If you are using Windows, check
+
        PE Windows Parser and/or Cygwin PE Parser; if you are using Linux,
+
        check Elf Parser; if you are using Mac, check Mach-O parser.</li>
+
        <li>Click on the Error Parsers tab.  Check the error parser(s) for the
+
        Fortran compiler(s) you will use.</li>
+
        <li>Click OK</li-->
+
        <li>Click Finish</li>
+
        <li>File | New | File </li>
+
        <li>Call it Makefile </li>
+
        <li>Click Finish </li>
+
        <li>We assume you're familiar with how to format a
+
        Makefile.&nbsp; Something like this will work for now.&nbsp;
+
        Remember
+
        to start the g95 line with a tab, not spaces. &nbsp;The -g switch
+
        instructs g95 to include debugging symbols in the generated executable
+
        so that it can be debugged later.
+
 
<pre>all:
 
<pre>all:
 
         g95 -g hello.f90
 
         g95 -g hello.f90
Line 171: Line 213:
 
clean:
 
clean:
  
</pre>
+
</pre>  
        </li>
+
        <li>File | New | Source File </li>
+
#File | New | Source File
        <li>Call it hello.f90 </li>
+
 
        <li>Click Finish </li>
+
#Call it hello.f90
        <li>Type the standard "Hello, World" program.
+
 
 +
#Click Finish
 +
 
 +
#Type the standard "Hello, World" program.
 
<pre>program hello
 
<pre>program hello
 
     print *, "Hello World"
 
     print *, "Hello World"
end program</pre>
+
end program</pre>  
        </li>
+
        <li>Project | Clean; then click OK </li>
+
#Project | Clean; then click OK
        <li>Open the Console view, and make sure "make" ran OK
+
 
        and compiled your program </li>
+
#Open the Console view, and make sure "make" ran OK
        <li>In the Fortran Projects view, expand the Binaries
+
 
        entry, and click on your
+
and compiled your program  
        executable (e.g., "whatever - [x86le]") </li>
+
        <li>Run | Run As | Run Local C/C++ Application (yeah, I
+
 
        know, it should say "Fortran Application", but it doesn't) </li>
+
#In the Fortran Projects view, expand the Binaries
        <li>Choose GDB Debugger (Cygwin GDB Debugger if you're
+
 
        under Windows) </li>
+
entry, and click on your
        <li>Check the Console view, and make sure Hello World appeared.</li>
+
executable (e.g., "whatever - [x86le]")  
      </ol>
+
 +
 
 +
#Run | Run As | Run Local C/C++ Application (yeah, I
 +
 
 +
know, it should say "Fortran Application", but it doesn't)  
 +
 +
 
 +
#Choose GDB Debugger (Cygwin GDB Debugger if you're
 +
 
 +
under Windows)  
 +
 +
 
 +
#Check the Console view, and make sure Hello World appeared.
 +
 
 +
<br>
 +
 +
 
 +
<br>
 +
<br>
 +
 +
 
 +
<br>
 +
 +
 
 +
= Writing Code  =
  
=Writing Code=
 
 
TODO
 
TODO
* The Fortran Perspective
+
* The Fortran Projects View
+
 
* Using the Fortran editor and Fortran perspective
+
<br>
** Selecting free vs. fixed form; watermark indicating content type mismatch
+
<br>
** Outline view - note Source Form marker in top, skull & crossbones
+
** Overview of the Fortran editors (incl. rulers, folding, smart highlighting)
+
 
** Comment/uncomment
+
** Setting bookmarks
+
** Go to line (Ctrl+L)
+
** Configuring the editor
+
 
*** Selecting horizontal ruler vs. folding
+
<br>
*** Setting colors for syntax highlighting
+
*** Showing print margin
+
 
*** Spaces instead of tabs
+
<br>
*** Show whitespace
+
*** Set font
+
 
*** Show line numbers
+
*The Fortran Perspective
 +
 
 +
*The Fortran Projects View
 +
 
 +
*Using the Fortran editor and Fortran perspective
 +
 
 +
**Selecting free vs. fixed form; watermark indicating content type mismatch
 +
 
 +
**Outline view - note Source Form marker in top, skull &amp; crossbones
 +
 
 +
**Overview of the Fortran editors (incl. rulers, folding, smart highlighting)
 +
 
 +
**Comment/uncomment
 +
 
 +
**Setting bookmarks
 +
 
 +
**Go to line (Ctrl+L)
 +
 
 +
**Configuring the editor
 +
 
 +
***Selecting horizontal ruler vs. folding
 +
 
 +
***Setting colors for syntax highlighting
 +
 
 +
***Showing print margin
 +
 
 +
***Spaces instead of tabs
 +
 
 +
***Show whitespace
 +
 
 +
***Set font
 +
 
 +
***Show line numbers
 +
 
 +
= Compiling Fortran Programs  =
  
=Compiling Fortran Programs=
 
 
TODO
 
TODO
* refer to CDT
+
* Setting make targets - refer to CDT
+
 
* Error parsers
+
<br>
* Binary parsers - need to change if no "Run as Local Fortran App" menu item
+
<br>
 +
 +
 
 +
 +
 +
 +
 
 +
<br>
 +
 +
 
 +
<br>
 +
 +
 
 +
*refer to CDT
 +
 
 +
*Setting make targets - refer to CDT
 +
 
 +
*Error parsers
 +
 
 +
*Binary parsers - need to change if no "Run as Local Fortran App" menu item
 +
 
 +
= Running and Debugging Fortran Programs  =
  
=Running and Debugging Fortran Programs=
 
 
TODO
 
TODO
* refer to CDT
+
* Setting breakpoints
+
 
* Note compiler-specific problems
+
<br>
 +
<br>
 +
 +
 
 +
 +
 +
 +
 
 +
<br>
 +
 +
 
 +
<br>
 +
 +
 
 +
*refer to CDT
 +
 
 +
*Setting breakpoints
 +
 
 +
*Note compiler-specific problems
 +
 
 +
= Advanced Features  =
  
=Advanced Features=
 
 
Photran 5.0 includes a number of sophisticated features that are designed to make it easier to write, modify, search, and maintain Fortran code. These include content assist, which can "auto-complete" variable and function names as you type; a declaration view, which can show the leading comments for the selected variable or procedure; Fortran Search, which allows you to find declarations and references to modules, variables, procedures, etc.; and refactorings, which change your source code to improve its design while preserving its behavior.
 
Photran 5.0 includes a number of sophisticated features that are designed to make it easier to write, modify, search, and maintain Fortran code. These include content assist, which can "auto-complete" variable and function names as you type; a declaration view, which can show the leading comments for the selected variable or procedure; Fortran Search, which allows you to find declarations and references to modules, variables, procedures, etc.; and refactorings, which change your source code to improve its design while preserving its behavior.
 +
  
Documentation for Photran's advanced features is available [[PTP/photran/documentation/photran5advanced|here]].
+
<br>
 +
<br>
 +
 +
 
 +
 +
 +
 +
 
 +
Documentation for Photran's advanced features is available [[PTP/photran/documentation/photran5advanced|here]].
 +
 +
 
 +
<br>
 +
 +
 
 +
<br>
 +
<br>
 +
 +
 
 +
<br>
 +
 +
 
 +
= Troubleshooting  =
  
=Troubleshooting=
 
 
If you are experiencing troubles with installing or working with Photran, you might want to check out our FAQ[http://wiki.eclipse.org/PTP/photran/faq]<br>
 
If you are experiencing troubles with installing or working with Photran, you might want to check out our FAQ[http://wiki.eclipse.org/PTP/photran/faq]<br>
And if you don't find your answer there, feel free to e-mail them to our Mailing List[http://eclipse.org/photran/mailinglists.php]
+
 +
 
 +
<br>
 +
<br>
 +
 +
 
 +
<br>
 +
 +
 
 +
And if you don't find your answer there, feel free to e-mail them to our Mailing List[http://eclipse.org/photran/mailinglists.php]
 +
 +
 
 +
= Beyond Photran  =
  
=Beyond Photran=
 
 
TODO
 
TODO
* Using Photran with other Eclipse plug-ins
+
** Subversion support
+
 
** PTP/RDT
+
<br>
** RSE
+
<br>
 +
 +
 
 +
 +
 +
 +
 
 +
<br>
 +
 +
 
 +
<br>
 +
 +
 
 +
*Using Photran with other Eclipse plug-ins
 +
 
 +
**Subversion support
 +
 
 +
**PTP/RDT
 +
 
 +
**RSE

Revision as of 17:23, 16 July 2009

You are here: PTP > Photran > Documentation > Photran 5.0 User's Guide





Photran 5.0 User's Guide





IMPORTANT: For the time being, this is just an outline of the
documentation we intend to write before the release of Photran 5.0
in September, 2009. It is not useful yet. Of course, you are
welcome to fill in any sections you wish... this is a wiki!

Installing Photran

System Requirements

To install Photran 5.0...



  1. You must have Eclipse 3.5 (Galileo) installed.
  2. You should have the C/C++ Development Tools (CDT) 6.0 installed. If you do not, they will be installed automatically when you install Photran.
  3. Eclipse must be running on a Java 1.5 or later Java Virtual Machine (JVM). To get reasonable performance, we recommend Sun's JVM [1] or IBM's [2]. GNU Classpath (the default JVM on Fedora Linux) is generally too slow to be useful.
  4. If you want to compile and build Fortran applications, you must have a make utility and a Fortran compiler in your system path. Many Linux/Unix systems include these; details on installing them in Windows and Mac are below.

Installation Procedure

To install Photran, start Eclipse, then...



  1. Download the latest Photran zip file from [3]
  2. Click on Help > Software Updates...
  3. Click on the "Available Software" tab
  4. Click on "Add Site..."
  5. Click Archive...
  6. Choose the zip file you downloaded from [4]
  7. Click OK to close the Add Site dialog
  8. The zip file should appear in the list as jar:file:/path/to/photran-master-4.0.5-something. Expand it.
  9. Expand "Photran (Eclipse Fortran Development Tools)" and check the box next to "Photran (Eclipse Fortran Development Tools)"
  10. If you are running Linux and have the Intel Fortran Compiler installed, or if you are on a Macintosh and have the IBM XL Fortran compiler installed, expand "Photran Compiler Support" and select the appropriate compiler.
  11. Click on the "Install..." button in the upper-right corner of the dialog box.

Additional Instructions for Windows Users

To compile and run Fortran programs in Photran, you will need to have a Fortran compiler and make utility installed. Most Linux/Unix distributions include these; gfortran is commonly used (and free). Under Windows, you will need to install Cygwin [5] or MinGW [6] and put them on your Windows PATH.


Instructions for Cygwin:




  1. Install [Cygwin http://www.cygwin.com/]; the defaults are mostly OK, but you will need to explicitly tell it to include the "Devel" packages (at least gcc4-fortran, gdb, and make) when the installer asks you to select what packages to install. (If gcc4-fortran is not listed under the "Devel" packages, you may have chosen a bad mirror; restart the Cygwin installation, and choose a different mirror instead. Georgia Tech's mirror at gtlib.gatech.edu is generally quite fast and reliable, for example.)
  2. Add the Cygwin directories to your Windows PATH. Under Windows XP, the process is as follows:
    1. Make sure you are logged in under an administrator account.
    2. Open the Control Panel.
    3. Double-click the System icon.
    4. Switch to the Advanced tab.
    5. Click the Environment Variables button.
    6. Under System Variables, find the variable "Path" in the list, and click on it.
    7. Click Edit.
    8. At the end of the "Variable Value" text, add
      ;C:\Cygwin\bin;C:\Cygwin\usr\bin;C:\Cygwin\usr\local\bin;C:\Cygwin\lib;C:\Cygwin\usr\lib
    9. Click OK, click OK, click OK, and close the Control Panel.
    10. Close and re-open Photran. Windows should now search C:\Cygwin\bin, C:\Cygwin\usr\bin, etc. when it's looking for executables (including make.exe, gcc.exe, and gfortran.exe).

Additional Instructions for Mac OS X Users

If you install gfortran on Mac OS X, it may be installed in /usr/local/bin, which is not (by default) on the PATH. If you are launching Eclipse from a Terminal, the PATH can be set by modifying /etc/paths. However, if you are launching Eclipse from the Finder (by double clicking on it) or the Dock, then the PATH is not obtained from the shell or /etc/paths. Instead, it's obtained from ~/.MacOSX/environment.plist. The format of the environment.plist file is as follows (change the path appropriately). If you create or edit this file, you will need to log out (or reboot) before the changes will take effect.

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
    <key>PATH</key>
    <string>/usr/local/mpi/bin:/usr/local/bin:/bin:/sbin:/usr/bin:/usr/sbin:/sbin:/usr/sbin:/Developer/Tools:/usr/texbin:/Users/greg/bin</string>
</dict>
</plist>

Starting a New Project

TODO


For more information, click on Help > Help Contents in Eclipse, and navigate to C/C++ Development User Guide > Concepts > CDT Projects.

Starting a Project with an Auto-Generated Makefile

TODO






If your system has the GNU gfortran compiler installed, try this.

  1. Click File | New | Fortran Project
  2. Call it whatever
  3. Choose the Executable (Gnu Fortran) from the project type list
  4. Choose GCC Toolchain from the toolchain list (you may need to uncheck

the "Show project types..." check box at the bottom of the window)

  1. Click Next
  2. Click on Advanced Settings
  3. Expand C/C++ Build in the list on the left, and click on Settings
  4. Click on the Binary Parsers tab.  Check the appropriate

parsers for your platform. If you are using Windows, check PE Windows Parser and/or Cygwin PE Parser; if you are using Linux, check Elf Parser; if you are using Mac, check Mach-O parser.

  1. Click on the Error Parsers tab. Check the error parser(s) for the

Fortran compiler(s) you will use.

  1. Click OK
  2. Click Finish
  3. Click File | New | Source File
  4. Call it hello.f90; click Finish
  5. Type the standard "Hello, World" program, and click
File | Save.
program hello
    print *, "Hello World"
end program
  1. Open the Console view, and make sure "make" ran OK
and compiled your program 

  1. In the Fortran Projects view, expand the Binaries
entry, and click on your
executable (e.g., "whatever - [x86le]") 

  1. Run | Run As | Run Local C/C++ Application (yeah, I
know, it should say "Fortran Application", but it doesn't) 

  1. Choose GDB Debugger (Cygwin GDB Debugger if you're
under Windows) 

  1. Check the Console view, and make sure Hello World appeared.







Starting a Project with a Hand-Written Makefile

TODO






If you're under Windows, make sure you have installed Cygwin (or MinGW)

according to the installation instructions above.
  1. File | New | Fortran Project
  1. Call it whatever
  1. Expand "Makefile project" in the project type list (it has a folder icon),
and choose Empty Project

  1. Make sure "-- Other Toolchain --" is selected in the
toolchain list in the right-hand column, and
click Next

  1. Click on Advanced Settings
  1. Expand C/C++ Build in the list on the left, and click on Settings
  1. Click on the Binary Parsers tab.  Check the appropriate
parsers for your platform. If you are using Windows, check
PE Windows Parser and/or Cygwin PE Parser; if you are using Linux,
check Elf Parser; if you are using Mac, check Mach-O parser.

  1. Click on the Error Parsers tab. Check the error parser(s) for the
Fortran compiler(s) you will use.

  1. Click OK
  1. Click Finish
  1. File | New | File
  1. Call it Makefile
  1. Click Finish
  1. We assume you're familiar with how to format a
Makefile.  Something like this will work for now. 
Remember
to start the g95 line with a tab, not spaces.  The -g switch
instructs g95 to include debugging symbols in the generated executable
so that it can be debugged later.
all:
        g95 -g hello.f90

clean:

  1. File | New | Source File
  1. Call it hello.f90
  1. Click Finish
  1. Type the standard "Hello, World" program.
program hello
    print *, "Hello World"
end program
  1. Project | Clean; then click OK
  1. Open the Console view, and make sure "make" ran OK
and compiled your program 

  1. In the Fortran Projects view, expand the Binaries
entry, and click on your
executable (e.g., "whatever - [x86le]") 

  1. Run | Run As | Run Local C/C++ Application (yeah, I
know, it should say "Fortran Application", but it doesn't) 

  1. Choose GDB Debugger (Cygwin GDB Debugger if you're
under Windows) 

  1. Check the Console view, and make sure Hello World appeared.







Writing Code

TODO










  • The Fortran Perspective
  • The Fortran Projects View
  • Using the Fortran editor and Fortran perspective
    • Selecting free vs. fixed form; watermark indicating content type mismatch
    • Outline view - note Source Form marker in top, skull & crossbones
    • Overview of the Fortran editors (incl. rulers, folding, smart highlighting)
    • Comment/uncomment
    • Setting bookmarks
    • Go to line (Ctrl+L)
    • Configuring the editor
      • Selecting horizontal ruler vs. folding
      • Setting colors for syntax highlighting
      • Showing print margin
      • Spaces instead of tabs
      • Show whitespace
      • Set font
      • Show line numbers

Compiling Fortran Programs

TODO










  • refer to CDT
  • Setting make targets - refer to CDT
  • Error parsers
  • Binary parsers - need to change if no "Run as Local Fortran App" menu item

Running and Debugging Fortran Programs

TODO










  • refer to CDT
  • Setting breakpoints
  • Note compiler-specific problems

Advanced Features

Photran 5.0 includes a number of sophisticated features that are designed to make it easier to write, modify, search, and maintain Fortran code. These include content assist, which can "auto-complete" variable and function names as you type; a declaration view, which can show the leading comments for the selected variable or procedure; Fortran Search, which allows you to find declarations and references to modules, variables, procedures, etc.; and refactorings, which change your source code to improve its design while preserving its behavior.






Documentation for Photran's advanced features is available here.







Troubleshooting

If you are experiencing troubles with installing or working with Photran, you might want to check out our FAQ[7]






And if you don't find your answer there, feel free to e-mail them to our Mailing List[8]

Beyond Photran

TODO










  • Using Photran with other Eclipse plug-ins
    • Subversion support
    • PTP/RDT
    • RSE

Back to the top