c %W% %G%
c
c  program  test_ask_array
c
c  Test ASK subroutines aski4a, askf4a, askf8a.
c
c  M Webring, USGS, 4/96


	dimension f4(3), i4(3)
	double precision  f8(3)

	character   p1*800,  lf*1, cr*1
	character   prompt*80

	call askin

        do 2 i = 1, 3
          i4(i) = 0
          f4(i) = 0.0
          f8(i) = 0.0d0
2       continue


c  Journaling

        ians = 0
10	continue
        call aski4l( 'journaling ?', ians, kboard )
	if ( kboard .eq. -2 ) go to 999

        if ( ians .eq. 1 ) then
          jnlunt = 11
          jnlact = 1
          call askjnl( 'w', jnlunt, jnlact, ierror )
          if ( ierror .ne. 0 ) then
            print *, ' Main: askjnl returned an error '
            print *, ' jnlunt, jnlact =', jnlunt, jnlact
          endif
          open( unit=jnlunt, file='test_ask_array.jnl',
     1    form='formatted', status='unknown' )
        endif

	if ( ians .eq. 0 ) then
	  call askjnl( 'w', 0, ians, ierror )
	endif


c  Test of ASKPR.

	cr = char( 13 )
	lf = char( 10 )

	p1 = lf //
     1  '  Test ASK subroutines aski4a, askf4a, askf8a.' //
     1  lf // lf //
     1  '   Each of these tests for i4,f4 and f8 arrays should'  //
     1  ' behave the same.  Floating point numbers maximums are' //
     1  ' 3.4e38 (both single and double precision) and the few' //
     1  ' numbers larger, like 3.40001e38 are ignored.' //
     1  '  The integer maximum of 2147483647 is similar.'  //
c     1  lf // lf // '  The elements may be typed' //
c     1  ' in separated by spaces or commas and blank.' //
c     1  '  Blank or invalid entries are ignored for their position.' //
c     1  lf // lf //
c     1  '  The mu' //
c     1  ' response is triggered by being the only entry.  CTL-EOT' //
c     1  ' may or may not cause an immediate mu response depending' //
     1  ' on the particular host hardware.' // lf // lf

	call askpr( p1 )



30	print *
	prompt = 'Enter i4 array'
	call aski4a( prompt, i4, 3, kboard )
	if ( kboard .eq. -2 ) go to 10

	print 31, i4
31	format( 3i12 )

40	print *
	prompt = 'Enter f4 array'
	call askf4a( prompt, f4, 3, kboard )
	if ( kboard .eq. -2 ) go to 30

	print 41, f4
41	format( 3e16.8 )

50	print *
	prompt = 'Enter f8 array'
	call askf8a( prompt, f8, 3, kboard )
	if ( kboard .eq. -2 ) go to 40

	print 51, f8
51	format( 3d24.15 )

	go to 30

999	stop
	end
