h59422
s 00054/00000/00000
d D 1.1 83/01/20 11:11:59 tes 1 0
c date and time created 83/01/20 11:11:59 by tes
e
u
tes
mjb
U
t
T
I 1
subroutine ktoi (buffer, start, value, end)
########################################################################
#                                                                      #
#          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: Convert the input string from ade to integer           #
#                                                                      #
#     Input Parameters:                                                #
#            buffer - (byte) null terminated byte string to convert    #
#            start  - (integer) index of byte in string to start       #
#                                                                      #
#     Output Parameters:                                               #
#            value  - (integer) converted integer value                #
#            end    - (integer) index of terminating byte              #
#                                                                      #
#     Routines Called:                                                 #
#            None                                                      #
#                                                                      #
########################################################################
SHORTINT buffer(1)
integer start, value, end
integer i, c, ksign, mult

   i = start - 1
   value = 0
   c = 0
   ksign = 1

   repeat {
      if (c == MINUS) ksign = -1
      i = i + 1
      c = buffer(i)
      if (c == NUL) {
	 end = i
	 return
	 }
      } until (c >= DIG0 & c <= DIG9)

   while (c >= DIG0 & c <= DIG9) {
      value = value*10 + (c - DIG0)
      i = i + 1
      c = buffer(i)
      }
   value = mult (ksign,value)
   end = i

return
end
E 1
