catalog


catalog, a C++ code which reads a C, C++, FORTRAN77, FORTRAN90, MATLAB, Python, or R code and prints every line that begins with a special index tag. If the code has been marked up expecting this convention, a handy table of contents will be created.

catalog() only works if each routine has been marked in the appropriate way.

For a C code, the necessary marker is ' Purpose:'. CATALOG will print the line that comes two lines later, and assumes that the first 4 characters of that line are blank.

        void doodah ( int a, int b, int *c )
        
        /**********************************************************
        
          Purpose:
        
            DOODAH computes the mangletude of A hepcatted to B.
        
        ...(further text of the routine follows)
      

For a C++ code, the necessary marker is '// Purpose:'. CATALOG will print the line that comes two lines later, and assumes that the first 6 characters of that line are to be ignored.

        void doodah ( int a, int b, int *c )
        
        //*********************************************************
        //
        //  Purpose:
        //
        //    DOODAH computes the mangletude of A hepcatted to B.
        //
        ...(further text of the routine follows)
      

For a FORTRAN77 code, the necessary marker is 'cc'. CATALOG will print the remainder of any such line. This marker must begin in column 1, and INDEX assumes that the third character is a blank, and ignores it. I use the marker as follows:

              subroutine doodah ( a, b, c )
        
        c**********************************************************
        c
        cc DOODAH computes the mangletude of A hepcatted to B.
        c
        ...(further text of the routine follows)
      

For a FORTRAN90 code, the necessary marker is '!!'. CATALOG will print the remainder of any such line. This marker must begin in column 1, and INDEX assumes that the third character is a blank, and ignores it. I use the marker as follows:

        subroutine doodah ( a, b, c )
        
        !**********************************************************
        !
        !! DOODAH computes the mangletude of A hepcatted to B.
        !
        ...(further text of the routine follows)
      

For a MATLAB code, the necessary marker is '%%'. CATALOG will print the remainder of any such line. This marker must begin in column 1, and INDEX assumes that the third character is a blank, and ignores it. I use the marker as follows:

        function [ x, y ] = doodah ( a, b, c )
        
        %**********************************************************
        %
        %% DOODAH computes the mangletude of A hepcatted to B.
        %
        ...(further text of the routine follows)
      

For a Python code, the necessary marker is '##'. CATALOG will print the remainder of any such line. This marker must begin in column 1, and INDEX assumes that the third character is a blank, and ignores it. I use the marker as follows:

        fdef = doodah ( a, b, c ):
        
        #**********************************************************
        #
        ## DOODAH computes the mangletude of A hepcatted to B.
        #
        ...(further text of the routine follows)
      

For an R code, the necessary marker is '##'. CATALOG will print the remainder of any such line. This marker must begin in column 1, and INDEX assumes that the third character is a blank, and ignores it. I use the marker as follows:

        doodah <- function ( a, b, c )
        
        #**********************************************************
        #
        ## DOODAH computes the mangletude of A hepcatted to B.
        #
        ...(further text of the routine follows)
      

In each of the above cases, catalog() will extract and print the line

DOODAH computes the mangletude of A hepcatted to B.

Sample output of the program looks like this:


        The file is of FORTRAN type.

        Index of column.f90:

        COLUMN extracts a given column from a file.
        CHRCTI reads an integer from a string.
        CHRDB1 removes blanks from a string, left justifying the remainder.
        DIGTEN returns the integer value of a base 10 digit.
        WRDFND finds the word of a given index in a string.
        WRDNEXRD "reads" words from a string, one at a time.
      

Licensing:

The computer code and data files described and made available on this web page are distributed under the GNU LGPL license.

Languages:

catalog is available in a C++ version.

Related Data and Programs:

catalog_test

f77split, a C code which reads a FORTRAN77 file and creates individual files for every blockdata, function, module, program, or subroutine in the file.

f90split, a C code which reads a FORTRAN file and creates individual files for every blockdata, function, module, program, or subroutine in the file.

f90split, a FORTRAN90 code which reads a FORTRAN file and creates individual files for every blockdata, function, module, program, subroutine in the file.

fsplit, reads a FORTRAN file and creates individual files for every function, program, or subroutine in the file, by Van Snyder.

Source Code:


Last revised on 27 March 2021.