h40559
s 00002/00001/00070
d D 1.2 83/01/28 14:39:56 mjb 2 1
c fixed error checking for no stops
e
s 00071/00000/00000
d D 1.1 83/01/20 11:14:20 tes 1 0
c date and time created 83/01/20 11:14:20 by tes
e
u
tes
mjb
U
t
T
I 1
subroutine qgtdta (item, 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: Get data from memory associated with a data item       #
#                                                                      #
#     Input Parameters:                                                #
#            item - (integer) data item to fetch from memory           #
#                                                                      #
#     Output Parameters:                                               #
#            string - (byte) null terminated data string               #
#                                                                      #
#     Routines Called:                                                 #
#            none                                                      #
#                                                                      #
########################################################################
integer item
SHORTINT string(1)

SHORTINT c
integer iptr, kount, i, k

include(`mnucom')

iptr = 1                             # initialize pointers
kount = 1

while (kount < item) {
   iptr = iptr + dtabfr(iptr)        # pointer to next data field equals
   kount = kount + 1                 # iptr plus cmdlen (dtabfr(iptr)
   }                               

kount = dtabfr(iptr + 3) + 1         # determine lenght of data field, add
				     # 1 for terminator

iptr = iptr + 5                      # initialize to point at beginning of 
                                     # of data field
i = iptr+kount
D 2
if (i >= FIELDxDATAxSIZE) stop 400 # Beyond data buffer size
E 2
I 2
# Beyond data buffer size
ifdef(`UNIX',`if (i >= FIELDxDATAxSIZE) stop 400') 
E 2

k = kount
do i = 1,kount {                     # field
   c = dtabfr(iptr)
   if (c == UNDERLINE) {
      string(i) = NUL
      k = i - 1
      break
      }
   string(i) = c                     # get the data string
   iptr = iptr + 1
   }

while (k >= 1) {   # get rid of trailing Blanks
   if (string(k) == BLANK | string(k) == NUL) {
      string(k) = NUL
      k = k - 1
      }
   else {
      break
      }
   }

return
end
E 1
