h01420
s 00001/00001/00067
d D 1.6 83/03/08 13:26:24 mjb 6 5
c 
e
s 00003/00003/00065
d D 1.5 83/03/06 20:37:15 mjb 5 4
c 
e
s 00001/00001/00067
d D 1.4 83/03/04 14:15:59 mjb 4 3
c 
e
s 00001/00001/00067
d D 1.3 83/03/02 18:44:20 mjb 3 2
c put in switch ttyin calls
e
s 00002/00002/00066
d D 1.2 83/01/29 16:38:38 tes 2 1
c added isalfa to check for non-alphabetic characters on input
e
s 00068/00000/00000
d D 1.1 83/01/22 20:46:13 tes 1 0
c date and time created 83/01/22 20:46:13 by tes
e
u
tes
mjb
U
t
T
I 1
subroutine gettxt (row, col, length, string)
########################################################################
#                                                                      #
#          THIS MATERIAL IS CONFIDENTIAL AND IS FURNISHED UNDER        #
#          A WRITTEN LICENSE AGREEMENT.  IT MAY NOT BE USED,           #
#          COPIED OR DISCLOSED TO OTHERS EXCEPT IN ACCORDANCE          #
#          WITH THE TERMS OF THAT AGREEMENT.                           #
#                                                                      #
#          COPYRIGHT (C) 1982 GRAPHIC SOFTWARE SYSTEMS INC.            #
#          ALL RIGHTS RESERVED.                                        #
#                                                                      #
#     Function: Read and display a text string on the current CRT      #
#                                                                      #
#     Input Parameters:                                                #
#            row - ascii row to display string                         #
#            col - ascii column to display string                      #
#            length - maximum string length to be read (the string must#
#                     be at least "length" plus one for NUL terminator)#
#                                                                      #
#     Output Parameters:                                               #
#            string - SHORTINT array of input characters               #
#                                                                      #
#     Routines Called:                                                 #
#            None                                                      #
#                                                                      #
########################################################################
integer row, col, length
SHORTINT string(1)

SHORTINT locbuf(2), key
D 2
integer i, ccol, xtemp, ytemp
E 2
I 2
integer isalfa, i, ccol, xtemp, ytemp
E 2

equivalence (locbuf(1), key)

data locbuf /NUL, NUL/

call qsthsz (2, xtemp, ytemp)

call movcur (row, col)
ccol = col
i = 0
repeat {
D 3
   call getkey (key)
E 3
I 3
D 4
   ifdef(`UNIX',`call gdevin (key)',`call ttyin (key)')
E 4
I 4
D 5
   call gtty (key)
E 4
E 3
   if (key != NEWLINE) {
E 5
I 5
   call ttyin (key)
D 6
   if (key != NEWLINE & != CR) {
E 6
I 6
   if (key != NEWLINE & key != CR) {
E 6
E 5
      if (key == BS) {
	 if (i > 0) {
	    key = string(i)
	    ccol = ccol - 1
	    i = i - 1
	    call erase
	    call qtext (row, ccol, locbuf)
	    call appear
	    }
	 }
D 2
      else {
E 2
I 2
      else if (isalfa (key) != 0) {
E 2
         i = i + 1
         string(i) = key
         call qtext (row, ccol, locbuf)
	 ccol = ccol + 1
	 }
      }
D 5
   } until (key == NEWLINE | i > length)
E 5
I 5
   } until (key == NEWLINE | key == CR | i > length)
E 5

if (i+1 > length) i = length
string(i+1) = NUL

return
end
E 1
