A Subroutine Example

By way of illustration, below is the in-code documentation for Miriad subroutine axistype, which uses the ``directives'' noted previously.

c* Axistype - Find the axis label and plane value in user friendly units
c& mchw
c: plotting
c+
        subroutine AxisType(lIn,axis,plane,ctype,label,value,units)
c
        implicit none
        integer lIn,axis,plane
        character ctype*9,label*13,units*13
        double precision value
c
c Find the axis label and plane value in user friendly units.
c
c  Inputs:
c    lIn        The handle of the image.
c    axis       The image axis.
c    plane      The image plane along this axis.
c  Output:
c    ctype      The official ctype for the input axis.
c    label      A nice label for this axis.
c    value      The value at the plane along this axis.
c    units      User friendly units for this axis.
c--
Note that the programmer has woven executable code into the documentation (the lines that are not commented out): anything between the c+ and the c- is considered to be part of the documentation, even though the lines are actually part of the subroutine code itself.

A subroutine source code file (or a program source code file) may contain multiple subroutines, each documented as above.



Miriad manager
2011-08-19