alternate simple view Fortran pre-processor for astronomical data processing Samples:
A SIMPLE EXAMPLE
# include "macros.h"
@@ LOGUNIT - manage Fortran Logical unit numbers
# define MaxUnits 30 # define LowUnit 60
module logunit
logical un(MaxUnits) @ Is unit number in use?
blockdata inilogun data un = MaxUnits * f end
@+ gtlun - get a free logical unit number
subroutine gtlun( num ) integer num @* free logical unit number returned
@- general, system @! 2/91, GAC: Written
integer i @ do loop index external inilogun @ invoke blockdata for linker
do i = 1, MaxUnits if (un(i)) cycle num = i + LowUnit - 1 un(i) = t return end do FatalCheck(t, 'Too many logical unit numbers') end
@+ frlun - free a Fortran logical unit number
subroutine frlun( num) integer num @ unit number to be freed
@- general, system @! 2/91, GAC: Written
integer i @ temporary index
i = num - LowUnit + 1 FatalCheck(i < 1 || i > MaxUnits, 'Illegal logical unit number') FatalCheck(^ un(i), 'Logical unit number never given out') un(i) = f end
end module
NOTES: 1. The comment symbol arrangement in position 1 with the following special symbols may give an indication of an embryonic documentation standard. 2. Fatalcheck is, of course, a macro, and allows you to postpone the decision of how to react to errors.