SCHOMAKE@HNYKUN53.BITNET.UUCP (05/26/87)
The following example is meant to close this discussion. It is
simple, does no copying, and needs no equivalence, common or structure.
Furthermore it is tested.
Subroutine Work(data,n,dtype)
c
c Jacket routine. Just get the array reference:
c
byte data(*)
integer n,dtype
c
c And pass it to the correct subroutine:
c
if(dtype.eq.1)then
call B1work(data,n)
else if(dtype.eq.2)then
call I2work(data,n)
else if(dtype.eq.4)then
call I4work(data,n)
else if(dtype.eq.5)then
call R4work(data,n)
else if(dtype.eq.6)then
call R8work(data,n)
else
write(*,*) '%WORK, illegal data type code: ',dtype
call exit
endif
return
end
Subroutine B1work(data,n)
byte data(*)
integer n
c
do i=1,n
c (byte work)
enddo
return
end
Subroutine I2work(data,n)
integer*2 data(*)
integer n
c
do i=1,n
c (i*2 work)
enddo
return
end
etc. for I4work, R4work and R8work.
*
^^^^^
KKKKKUUUUNNNNN
KKK UUUU NNNN Lambert Schomaker
K UUUU NNN SCHOMAKE@HNYKUN53.BITNET
KKK UUUU NN Nijmegen, The Netherlands.
KKKKK UU N