[comp.lang.fortran] Screen Management

msd@enh.nist.gov (M. Scott Dewey) (08/29/90)

Dear Experts,

I am converting some of our fortran data acquisition software from the RSX
environment to the VMS environment and one thing that I would like to take
advantage of in VMS is its screen management facility (presumably that
means SMG).  The best example I'm aware of that features the sort of thing
I'd like to implement is found in the program PROFILE.FOR.  In addition to
spending some time with the SMG manuals and PROFILE.FOR, I would love to be
able to look at some simple examples.  If anyone out there has some, would
you be willing to share them with me?  I will be happy to pass along
whatever I'm sent to others interested in the same sort of thing.

Thanks!
-- 
NAME:   Dr. M. Scott Dewey             TELE: (301) 975-4843
DIVISION: Quantum Metrology            INTERNET: msd@enh.nist.gov
USMAIL: NIST (formerly NBS)            BITNET: msd@nbsenh
        Rm. A-141, Bldg. 221
        Gaithersburg, MD  20899

jmi@dac.mdcbbs.com (JM Ivler) (08/31/90)

In article <0093BEA0.E82D63C0@QMD.PHY.NIST.GOV>, msd@enh.nist.gov (M. Scott Dewey) writes:
> Dear Experts,
> 
> I am converting some of our fortran data acquisition software from the RSX
> environment to the VMS environment and one thing that I would like to take
> advantage of in VMS is its screen management facility (presumably that
> means SMG).  The best example I'm aware of that features the sort of thing
> I'd like to implement is found in the program PROFILE.FOR.  In addition to
> spending some time with the SMG manuals and PROFILE.FOR, I would love to be
> able to look at some simple examples.  

Here goes a screen display routine (also includes a random number generator) 
that I built for one user to show SMGs capabilities at constant display...

jmi     jmi@dac.mdcbbs.com
--------------------------------------------------------------------------------

	program test
c****************************************************************************
c                                                                           
c PROGRAM NAME : test
c                                                                           
c DESCRIPTION: test to output text strings randomly to a screen
c                                                                           
c
c*****************************************************************************
c  MODIFICATION HISTORY:
c
c  DATE       WHO        VERSION              DESCRIPTION
c-----------+-------+--------------+------------------------------------------
c 27-Jul-90 | jmi   |  1.0         | Baseline
c
c
c
	implicit none
c
c  The include files
c
	include '($SMGDEF)'
c
c  the functions
c
	integer smg$create_virtual_display
	integer smg$create_pasteboard
	integer smg$create_virtual_keyboard
	integer smg$paste_virtual_display
	integer smg$pop_virtual_display
	integer smg$label_border
	integer smg$put_chars
	integer smg$set_cursor_abs
	integer smg$read_keystroke
	integer	smg$set_cursor_mode
c
c  local to procedure
c
	double precision rand1,rand2	! random numbers (real < 0 )
	integer s_did		! display id
	integer istat		! internal status for function calls
	integer t_code		! terminal code (from read keystroke)
	integer kb		! keyboard ident
	integer pb		! pasteboard ident
	integer*4 buf(2)	! seade for time - random numbers
	integer*4 rnum1,rnum2	! random numbers 1-10

c
c  character strings (local)
c
	character*15 titl/' Test Screen '/	! The title
	character*10 txt(10)			! ouput text 
c
c  create the pasteboard
c
	istat = smg$create_pasteboard(pb)
c
c zero out the cursor (make it invisible)
c
	istat = smg$set_cursor_mode(pb,1)
c
c set up the keyboard and display - paste the display - put on the label
c
	istat = smg$create_virtual_keyboard(kb)
	ISTAT = SMG$CREATE_VIRTUAL_DISPLAY (12,48,s_did,smg$m_border)
	ISTAT = SMG$PASTE_VIRTUAL_DISPLAY (s_did,pb,10,15)
	ISTAT = SMG$label_border(s_did,titl(1:15),smg$k_top,,smg$m_bold)
c
c set up the text and random number generator seade
c
	call sys$gettim(buf)
	if (.not. buf(1)) buf(1) = buf(1) + 1
	txt(1) = 'True'
	txt(2) = 'False'
	txt(3) = 'Maybe'
	txt(4) = 'Today'
	txt(5) = 'Fortran'
	txt(6) = 'Until'
	txt(7) = 'Better'
	txt(8) = 'Done'
	txt(9) = 'Timeout'
	txt(10) = 'Playhard'
c
c start the display loop - continue until a PF4 is entered
c
	do while (t_code .ne. smg$k_trm_pf4)
c
c after each placement move the cursor to the top left corner of the display
c init the input value, get new random numbers
c
	istat = SMG$set_cursor_abs(s_did,1,1)
	t_code = 0
	rand1 =  ran(buf(1)) 
	rand2 =  ran(buf(1)) 
	rnum1 = (rand1*10)+1
	rnum2 = (rand2*10)+1
c
c put the characters to the screen
c
	istat = smg$put_chars(s_did,txt(rnum2),rnum1+1,13)
c
c check the type-ahead buffer to see if a character was entered if it was
c  grab it - else continue to loop
c
	istat = smg$read_keystroke(kb,t_code,,0,s_did)
c
c end loop
c
	enddo
c
c exit pop the display
c
	istat =	smg$pop_virtual_display(s_did,pb)
	call exit
	end