c=========================================================== c Test program for subroutine 'dvto'. c c Program expects two arguments, the name of a file c for output ('-' for stdout) and the length of the c test vector to be written. c=========================================================== program tdvto implicit none c----------------------------------------------------------- c The integer function 'i4arg' is defined in the c 'p410f' library. It takes two arguments, the first c is an integer specifying which program argument is c to be parsed as an integer, and the second is a c default value which will be returned if the argument c was not supplied or could not be converted to an c integer. c----------------------------------------------------------- integer iargc, i4arg integer maxn parameter ( maxn = 100 000 ) real*8 v(maxn) integer n integer i character*256 fname c----------------------------------------------------------- c Unless exactly two arguments are supplied, print usage c message and exit. c c Note the use of the "logical-if" statement (no then) c----------------------------------------------------------- if( iargc() .ne. 2 ) go to 900 call getarg(1,fname) n = i4arg(2,-1) if( n .eq. -1 ) go to 900 c----------------------------------------------------------- c Limit the value of n c----------------------------------------------------------- n = min(n,maxn) c----------------------------------------------------------- c Define test vector c----------------------------------------------------------- do i = 1 , n v(i) = i end do c----------------------------------------------------------- c Call the routine .. c----------------------------------------------------------- call dvto(fname,v,n) c----------------------------------------------------------- c Normal exit c----------------------------------------------------------- stop c----------------------------------------------------------- c Usage exit c----------------------------------------------------------- 900 continue write(0,*) 'usage: tdvto ' write(0,*) write(0,*) ' Use ''tdvto -'' to write ', & 'to standard output' stop end