h20743
s 00018/00003/00090
d D 1.2 83/02/18 00:36:04 mjb 2 1
c fixed numerous bugs with insertion and pie data in general
e
s 00093/00000/00000
d D 1.1 83/02/09 21:23:02 mjb 1 0
c date and time created 83/02/09 21:23:02 by mjb
e
u
mjb
tes
U
t
T
I 1
subroutine insdta (item, id)
########################################################################
#                                                                      #
#          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: Insert a field in current data buffer                  #
#                                                                      #
#     Input Parameters:                                                #
#            item - menu item to begin insertion at                    #
#            id   - current menu identifier                            #
#                                                                      #
#     Output Parameters:                                               #
#            None                                                      #
#                                                                      #
#     Routines Called:                                                 #
#            None                                                      #
#                                                                      #
########################################################################
integer item , id, inum

SHORTINT stemp, locbuf(20), string(20)
integer i, j, k, m, icrm, cmdlen, fdlen, sptr, sitem

include(`mnucom')

   call insert (item, id)

   if (id == GRAPHxDATAxFRAME) {
      inum = (((item-1) / 15) + 1) * 15
      icrm = 1
      sitem = inum
      }
   else {
      inum = 10
      icrm = 5
      sitem = 8
      }

   do m = 1, icrm {

      sptr = 1
      cmdlen = 0
      k = 1

      repeat {                          # Determine pointer to first data item
         sptr = sptr + cmdlen
         cmdlen = dtabfr(sptr)          # Get the right command length
         k = k + 1
         } until (k > item)

      fdlen = dtabfr(sptr+3)            # Get field length
      sptr = sptr + 5                   # Set start pointer to first data field
   
      do i = 1, fdlen {                 # Initialize local buffer to nuls
         locbuf(i) = UNDERLINE
         }
I 2
      if (m == 3) {
	 locbuf(1) = BIGN
	 locbuf(2) = NUL
	 }
      if (m == 4) {
	 locbuf(1) = DIG1  
	 locbuf(2) = UNDERLINE
	 }
      if (m == 5) {
	 locbuf(1) = DIG0
	 locbuf(2) = UNDERLINE
	 }
E 2
   
      do i = item, inum {           # Loop for number of items to push
         k = sptr

D 2
	 if (id == GRAPHxDATAxFRAME | m == 2) 
E 2
I 2
	 if (id == GRAPHxDATAxFRAME | m == 2) {
E 2
	    call qgetd (i, string)
D 2
	 else if (m >= 4)
E 2
I 2
	    }
	 else if (m >= 4) {
E 2
	    call qgeti (i, string(1))
D 2
         else 
E 2
I 2
	    }
         else {
E 2
	    call qgeta (i, string)
I 2
	    }
E 2

         do j = 1, fdlen {
	    stemp = dtabfr(k)
            dtabfr(k) = locbuf(j)
	    locbuf(j) = stemp
	    k = k + 1
	    }
         sptr = sptr + cmdlen
         }
      
   call popnxt (sitem, id, string, m) # Make sure common up to date, pop
				      # last value to next page of common
   call apdata (item, inum)
   item = item + 8
   inum = inum + 8
   }

call revers (ON)

return
end
E 1
