Fortran

Fortran, (previously FORTRAN), or The IBM Mathematics FORMula TRANslating system, is a general-purpose programming language first developed in the 1950's.

See Also

Combining Fortran and Tcl in one program
calling Fortran routines in a DLL
Tutorials for the Tcl/Tk newbie on interacting with Fortran applications that expect input/output from the user
Extending Tcl with Fortran
Plasma Surface Interaction Codes

Documentation

FAQ
Last but not least, FORTRAN/TK is actually a real and quite comfortable cross-platform (OS/2 Warp and Windows 9x/NT) Tk-wrapper for Open Watcom FORTRAN 77: http://svn.netlabs.org/fortrantk .

The Tclsh spot , Clif Flynt, USENIX ;login:, Magazine 2004-06: How to expand the user interface for a FORTRAN program without touching the FORTRAN code much.

The Tclsh spot , Clif Flynt, USENIX ;login:, Magazine 2004-08: On embedding a Tcl interpreter into a FORTRAN program.

Resources

Ftcl
a Tcl bridge.
FORTRAN/TK
Tcl/Tk 8.6 for Fortran 2018 , Philipp (aka interkosmos)
A work-in-progress Fortran 2018 ISO_C_BINDING interface library for interoperability with Tcl/Tk 8.6.

Description

Fortran was originally card-punched and had peculiar characteristics due to that (with regard to continuing lines, etc.). These days, Fortran 95 (*) and newer editions work on all sorts of computers (Fortran 2003 is the new standard, with object oriented features).

Fortran tends to be used for number crunching, modeling, etc. and has many libraries to provide support for such things.

(*) (Slightly pedantic note by AM) Up to and including the FORTRAN 77 standard the name was written in capitals. Since the Fortran 90 standard the name is written with a capitalised initial.

Fortran programmers tend to be Real Programmers .

Sample code

 ! -----------------------------------
 ! trianglearea.f90
 ! Compute area of a triangle
 
 program TriangleArea
  implicit none
  real :: a, b, c, Area
  print *, 'Enter the lengths of the 3 sides :'
  read *, a, b, c
  print *, 'Triangle''s area:  ', Area(a,b,c)
 end program TriangleArea

 function Area(x,y,z)
  implicit none
  real :: Area
  real, intent(in) :: x, y, z
  real :: theta, height

  theta = acos((x**2+y**2-z**2)/(2.0*x*y))
  height = x*sin(theta)
  Area = 0.5*y*height

 end function Area

 ! -----------------------------------
 ! pascaltriangle.f90
 ! Display Pascal triangle

 program PascalTriangle
 
  call PTriangle(10)
 
 end program PascalTriangle
 
 subroutine PTriangle(n)
  implicit none
  integer, intent(in) :: n
  integer :: c, i, j, k, space
 
  do i = 0, n-1
     c = 1
     space = 3*(n - 1 - i)
     do j = 1, spaces
        write(*,"(A)", ADVANCE="NO") " "
     end do
     do k = 0, i
        write(*,"(I6)", ADVANCE="NO") c
        c = c*(i - k)/(k + 1)
     end do
     write(*,*)
  end do
 
 end subroutine PTriangle

How does a FORTRAN application gain a GUI? The best-known commercial solution is Winteracter [L1 ]. Many of us, though, find managing Fortran programs with Tk more satisfying.

AM See also: Combining Fortran and Tcl in one program for another solution


AMG: Here's a FORTRAN resource reference I found at work:

FortranRef6.txt
Common Fortran Resources:
Last Updated: 06/30/08 14:52:13 Mon 182
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
Send Feedback to [email protected]
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
Fortran Verions: 
   Older:    66 / _77_   (well established versions)
   Newer:    90 / _95_   (recommended versions)
   Newest: 2003 / 2008   (works in progress; see below for details)
See below on how to compile these various versions with gfortran.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
IRC Fortran Channels:
Real-time chat with other Fortran programmers in a self-help volunteer fashion:
Server: Freenode  Channel: #Fortran
Official Wiki of #Fortran: http://www.matmech.com/fortran/    <-- Start here

(Please let us know about other IRC Fortran Channels)
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
http://fortran.pastebin.com/                 <-- Use this to Share Code & Errors
Please remember to include the Error Messages,
                  and also the line(s) used to compile, link your code.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
Fortran Language Specification and References:

http://www.nag.co.uk/sc22wg5/ 
ftp://ftp.nag.co.uk/sc22wg5/N1701-N1750/N1723.pdf      (latest known spec)

There is a description of the Fortran 2003 features available:
http://www.kcl.ac.uk/kis/support/cit/fortran/john_reid_new_2003.pdf 

http://www.fortran.bcs.org/2007/bcs07.pdf    <-- 2008 additions to Fortran

http://www.lahey.com/docs/lang_revg.pdf        <--- general purpose F95 Manual
http://www.lahey.com/lookat90.htm              <--- *** F90 intro
http://www.che.lsu.edu/links/computing/tutorials/prof77.pdf                 <-- F77 Manual
http://www.sgr.nada.kth.se/unix/software/Workshop/fortran/f77rm/index.html  <-- F77 Manual
http://h71000.www7.hp.com/doc/82final/6324/6324pro_020.html      <-- Language Info
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
GNU GCC gfortran package: 

http://gfortran.info/ 
http://gcc.gnu.org/onlinedocs/               <----(PDF Manuals)

http://gcc.gnu.org/onlinedocs/gfortran.pdf   <-- always the very latest gfortran docs

Official download: http://gcc.gnu.org/wiki/GFortranBinaries 
Windows 32-bit:    http://quatramaran.ens.fr/~coudert/gfortran/gfortran-windows.exe   
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
How to compile various previous versions of Fortran under GNU GCC gfortran:
Compile F77 programs using gfortran thus: gfortran prog77.f   -o prog77[.exe if Win32]
Compile F90 programs using gfortran thus: gfortran prog90.f90 -o prog90[.exe if Win32] 
Compile F95 programs using gfortran thus: gfortran prog95.f95 -o prog95[.exe if Win32] 
Win32 gfortran important options:
C:\Gfortran3>gfortran -S source.f95 -o Assembly.txt
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
G95 Compiler:
Debian g95 mirror: http://www.gfd-dennou.org/library/cc-env/g95/index.htm.en 
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
Intel® Fortran Compiler: http://www.intel.com/cd/software/products/asmo-na/eng/219771.htm 
Available for Linux 2.6.x, Mac OS 10.4.9 and Windows XP/2003. Free for non commercial use.
Supports Fortran 66/77/90/95 and a subset of Fortran 2003.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
Video History of Fortran:
http://www.fortranlib.com/FORTRAN-1982.wmv 
The video contains interviews with the original developers of FORTRAN back in the 1950s.
For example, project leader John Backus (1924-2007) comments on how it was decided to name
it FORTRAN.
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Popular Fortran websites:
BCS Fortran Specialist Group Website: http://www.fortran.bcs.org/  
Netlib Repository: http://www.netlib.org/ 
                   Netlib is a collection of mathematical software, papers, and databases.
Fortran Library:   http://www.fortranlib.com/ 
                   A Free Technical Programming Resources 
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
Amazon.com Books (Prices are subject to change):
 $59.36 http://www.amazon.com/Explained-Numerical-Mathematics-Scientific-Computation/dp/0198526938/ref=sr_1_1?ie=UTF8&s=books&qid=1214259570&sr=1-1 
 $60.90 http://www.amazon.com/Introduction-Programming-Fortran-coverage-2003/dp/1846280532/ref=pd_bbs_sr_2?ie=UTF8&s=books&qid=1214850332&sr=1-2 
 $74.00 http://www.amazon.com/Numerical-Recipes-FORTRAN-Scientific-Computing/dp/052143064X/ref=sr_1_7?ie=UTF8&s=books&qid=1214850332&sr=1-7 
 $79.95 http://www.amazon.com/Fortran-2003-Handbook-Complete-Procedures/dp/1846283787/ref=pd_bbs_sr_2?ie=UTF8&s=books&qid=1209035514&sr=1-2 
 $98.10 http://www.amazon.com/FORTRAN-Engineers-Scientists-Introduction-4th/dp/013363003X/ref=sr_1_8?ie=UTF8&s=books&qid=1214850332&sr=1-8 
$103.50 http://www.amazon.com/FORTRAN-Engineers-Scientists-Larry-Nyhoff/dp/0135197295/ref=sr_1_6?ie=UTF8&s=books&qid=1214850332&sr=1-6 
$124.95 http://www.amazon.com/Fortran-90-95-Scientists-Engineers/dp/0072825758/ref=pd_sim_b_title_1/002-3505825-9112064 
 $12.21 http://www.amazon.com/Schaums-Outline-Programming-Fortran-Outlines/dp/0070411557/ref=sr_1_5?ie=UTF8&s=books&qid=1214850332&sr=1-5 
 $27.29 http://www.amazon.com/Introduction-Fortran-90-95-B-E-S-T/dp/0070119694/ref=sr_1_10?ie=UTF8&s=books&qid=1214850332&sr=1-10 
 $38.85 http://www.amazon.com/Fortran-90-Explained-Michael-Metcalf/dp/0198505582/ref=sr_1_13?ie=UTF8&s=books&qid=1214850625&sr=1-13 
 $45.26 http://www.amazon.com/Object-Oriented-Programming-via-Fortran-90/dp/0521524083/ref=sr_1_23?ie=UTF8&s=books&qid=1214850625&sr=1-23 
 $52.40 http://www.amazon.com/Developing-Statistical-Software-Statistics-Computing/dp/0387238174/ref=sr_1_22?ie=UTF8&s=books&qid=1214850625&sr=1-22 
 $69.95 http://www.amazon.com/Fortran-95-M-Counihan/dp/1857283678/ref=sr_1_21?ie=UTF8&s=books&qid=1214850625&sr=1-21 
 $69.96 http://www.amazon.com/Computational-Physics-Steven-E-Koonin/dp/0201386232/ref=sr_1_36?ie=UTF8&s=books&qid=1214850866&sr=1-36 
 $70.90 http://www.amazon.com/Structured-Fortran-77-Engineers-Scientists/dp/0471364061/ref=sr_1_18?ie=UTF8&s=books&qid=1214850625&sr=1-18 
 $72.00 http://www.amazon.com/Advanced-Scientific-Fortran-David-Will%C3%A9/dp/0471953830/ref=sr_1_27?ie=UTF8&s=books&qid=1214850866&sr=1-27 
 $85.95 http://www.amazon.com/Digital-Visual-FORTRAN-Programmers-Technologies/dp/1555582184/ref=sr_1_49?ie=UTF8&s=books&qid=1214851553&sr=1-49 
 $99.50 http://www.amazon.com/Engineering-Analysis-Interactive-QuickBASIC-Mathematica/dp/084932016X/ref=sr_1_67?ie=UTF8&s=books&qid=1214851628&sr=1-67 
$157.75 http://www.amazon.com/Numerical-Algorithms-Fortran-Gisela-Engeln-Mullges/dp/3540605290/ref=sr_1_57?ie=UTF8&s=books&qid=1214851553&sr=1-57 
$177.50 http://www.amazon.com/Numerical-Recipes-Fortran-90-Vol/dp/0521574390/ref=sr_1_24?ie=UTF8&s=books&qid=1214850625&sr=1-24 
$205.00 http://www.amazon.com/Fortran-Programs-Chemical-Analysis-Simulation/dp/0884152804/ref=sr_1_41?ie=UTF8&s=books&qid=1214850979&sr=1-41 
 $35.00 http://www.amazon.com/Expert-Programming-Peter-van-Linden/dp/0131774298 

A favorite book not listed here? Send Feedback to [email protected]
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
Common Fortran Wiki's:
http://en.wikipedia.org/wiki/Fortran 
http://en.wikipedia.org/wiki/Hollerith_constant 
http://www.helsinki.fi/atk/unix/dec_manuals/df90au52/dfum031.htm   {File I/O}
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
Usenet/Newsgroups: 
  [NOTE: some ISP's are totally dropping usenet services;
         independent pay-services may prove more reliable]
http://groups.google.com/group/comp.lang.fortran          <-- Popular
http://groups.google.com/group/microsoft.public.fortran 
http://groups.google.com/group/comp.lang.pl1 
http://groups.google.com/group/comp.lang.ada 
http://groups.google.com/group/comp.programming 
http://groups.google.com/group/comp.lang.misc 
http://groups.google.com/group/comp.lang.c++ 
http://groups.google.com/group/sci.math*  (and related math-orientated groups)
http://groups.google.com/group/comp.parallel.mpi 
http://groups.google.com/group/sci.military.naval  (they use Fortran!)
http://groups.google.com/group/comp.ai.philosophy 
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
Have a reliable Fortran Web Forum to share? Feedback to [email protected]
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
"yahoo tech groups"     (if you feel these are not reliable, please let me know)
These forums allow you post questions and share discussion which can be
either read on the web, or sent to your email:
http://tech.groups.yahoo.com/group/f90/               [http://groups.yahoo.com/group/f90] 
http://tech.groups.yahoo.com/group/Fortran/           [http://groups.yahoo.com/group/fortran] 
http://tech.groups.yahoo.com/group/fortrandevgroup/   [http://groups.yahoo.com/group/fortrandevgroup] 
You may be expected to be a registered yahoo member to join these groups.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
Development list for the Fortran language front end of GCC:
http://blog.gmane.org/gmane.comp.gcc.fortran 
(this group only accepts messages about issues/bugs with the gcc gfortran compiler)
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
For people who enjoy Chess in a whole new way:
http://www.chessvariants.com/ithemed.html 
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
Feel free to offer additional information to this Fortran Resource List,
Feedback: [email protected]
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -