Fortran Wiki
Code

Source Code on the Fortran Wiki

When contributing code, please specify a license so that others know the extent to which they may use and modify your code. All code on the Fortran Wiki shall be in the public domain unless otherwise noted. Other common licenses are the BSD, MIT, and GPL licenses.

To contribute Fortran source code, add a link here to the filename, program, or module name, and create the new page by pasting the code, wrapping it in a fenced code block with a language keyword. See the HowTo and existing pages such as hello for examples.

  • allocate_coin_toss - dynamic memory allocation example.
  • ansi_colors - simple module illustrating how to produce ANSI color escape codes for terminal output.
  • asa2pdf - convert files using ASA carriage control to an Adobe PDF
  • c_interface_module - supplemental types and functions for ISO-C-Binding
  • d2u(1f) - example of stream I/O; this program converts clear ASCII text files between Unix and DOS line terminator conventions.
  • differentiation - functions for numerical differentiation of arrays.
  • expand - expand C-like escape sequences in a string.
  • extend_dble example of extending a function (in this case, the intrinsic DBLE())
  • fdate - example use of date_and_time(3f)
  • File_Name_Generator - to whom bothering building a file name string with integer or using internal write
  • gen_list - a generic linked list example.
  • getopt_long_module - Fortran equivalent of C getopt_long
  • getvals - read an arbitrary number of numeric values from a line
  • hash table example - an example implementation of hash tables.
  • hash value example - an example implementation generating a hash value (a CRC-32 value is calculated for a list of files).
  • hello - hello, world in Fortran 90.
  • init_seed - random number generator seeding example.
  • integration - functions for numerical integration of arrays.
  • interface_mod - an example of defining interfaces in a module.
  • internalproc - internal procedure example.
  • interpolation - functions for numerical interpolation of arrays.
  • inv - matrix inversion via LAPACK.
  • jucolor - A small collection of color model conversion routines.
  • kiss64 - a 64-bit random number generator by George Marsaglia.
  • kracken - a module for cracking command line arguments
  • get_namelist - read command line arguments using NAMELIST
  • namelist_prompter - read values by name interactively using NAMELIST
  • M_color - simple conversions between common color models
  • m_process - a module for calling popen(3c) using the intrinsic ISO_C_BINDING module
  • m_strings - a module for manipulating and formatting strings
  • m_system - a module that allows calling many of the C POSIX procedures via the ISO_C_BINDING intrinsic module
  • match_wild - wild-card string matching
  • mm_ioutils - a library for easier I/O in Fortran.
  • notab(3f) - expand tab characters in input lines
  • notopen(3f) - find unused file unit number
  • newunit - Joe’s find unused file unit number
  • opover - simple example of operator overload
  • pointer_example - an example of pointer usage.
  • iso_readline(3f) - calling the GNU C routine readline(3c) using the Fortran 2003 iso_c_binding module.
  • proc_component_example - procedure component example.
  • qsort_inline - a fast inline quick+insertion sort
  • read_gif - reads GIF file into array
  • readline - example that reads a line of arbitrary length
  • regex_module - Interface to POSIX regex routines
  • roach(3f) - write large block letters
  • scramble(3f) - example of permuting a list
  • spoiler - encode and decode messages trivially encrypted with the ROT13 algorithm
  • stderr(3f) - example of writing to “stderr”
  • strnum - example illustrating conversion of numeric values to strings and vice-versa.
  • strtok(3f) - read tokens from a line in a manner similar to the C routine strtok
  • swap - example of using unlimited polymorphic variables to make a generic swap routine
  • tostring(3f) - example of polymorphic class converts values to a string
  • ttee - a “timed tee” – write stdout to stdin and another file with an optional date/time prefix.
  • transfer_ex - example of the transfer intrinsic.
  • use_test - an example of nested use statements
  • f_uname - call uname(3c) using ISO_C_BINDING and a C procedure
  • ufpp - a Fortran pre-processor written in Fortran
  • writegif - writes an image into a GIF file.
  • what - The what(1) command re-implemented in Fortran
  • happy_new_year - Write happy new year and example of transfer
  • Quartiles - Calculating Quartiles in Fortran in 3 different method.
  • SVD - Program computes the matrix singular value decomposition
  • Time In Words - Program displays time in words
  • Validate Credit-Debit card number program - Fortran code to Validate Credit/Debit card number program
  • Reading Ansys Sub Structure analysis file Reading Stiffness/Mass matrices from Ansys Sub Structure Analysis output file.
  • wc - a word count utility.
  • xxenv - example of accessing Environment Table
  • String_Functions - a module of string processing routines.

Code Available Elsewhere

This section lists individual modules, programs, and procedures, typically single files or perhaps zip files. See the Libraries page for more comprehensive collections of routines.

category: code