fcasplit(1) tool to split source code into separate per-routine files


fcasplit [ -f nmft ] [ -c nmcc ] [ -a nmas ] [-noh] [-log]
[ +fo incf ] [ +co incc ] [ +ao incs ]
[ -fo optf ] [ -co optc ] [ -ao opts ] file.ext

fcasplit file.ext [ fca_n ] [ optf [ optc [ opts
[ nmft [ nmcc [ nmas ]]]]]]


fcasplit, used with a command line of either form shown above, splits file file.ext having a mixture of FORTRAN / C / assembler routines into separate files n.f or n.c or n.s, "n" being the name of each routine, creating at the same time a shell script file.shfca and a Make file file.mkfca either of which can be used to compile all routines individually. All new files are generated in the current directory, even if the original file.ext is in a different location.

NOTE that the program does not work on source code written without having it in mind, since fcasplit looks for special identifying lines in comments of the source code in the original file, as noted below. It is able to operate, for instance, on source code output by nypatchy.

Defaults are defined in fcasplit for the names by which the compilers are called in the generated shell script and Makefile; with the -f, -c, -a options they could be changed. In Debian GNU/Linux, these defaults are gcc for the C compiler, gfortran for the FORTRAN compiler, and as for the assembler.

Defaults are also defined for the options with which they are called; with the -fo, -co, -ao options they can be re-defined; with the +fo, +co, +ao options they can be incremented. In Debian GNU/Linux, these defaults are "-c -g -O2" for the C compiler, "-c -g -O2 -fno-automatic" for the FORTRAN compiler, and "" (i.e., no flags) for the assembler.

To be backward compatible these options can also be specified by the positional parameters after the file-name (as in the second form of the command shown above).

If the -noh option is given (or if the first parameter after the file-name is "fca_n") the identifying header line of each routine is not written out. If the -log option is given the name of each routine is printed on standard output.


Each routine in the original file file.ext must start with an identifying line:

  "CDECK  ID>, "      in cols.  1-12  for FORTRAN

  "/*DECK ID>, "      in cols.  1-12  for C

  ";DECK  ID>, "      in cols.  1-12  for assembler

   "DECK  ID>, "      in cols.  2-12  or

    "DECK ID>, "      in cols.  3-12  for anything else

              "name"  in cols. 13-40  gives the name

In the last two cases, or if "name" contains an extension, the file created will be "name" without extension .f, .c or .s added to it and without an entry into the script.

A trailing blank terminates the name, symbol . followed by blank also terminates, symbols ; < # ! all terminate, symbol */ also terminates.


This manual page was written by Kevin McCarty <[email protected]> for the Debian GNU/Linux system (but may be used by others), based on the help information printed by the fcasplit program when called with no arguments. Both fcasplit and this man page are licensed under the GNU General Public License, version 2 or later (at your choice).


Copyright (C) CERN, 1996, 1999 and Kevin B. McCarty, 2008.