h58861
s 00060/00000/00000
d D 1.1 83/01/20 11:11:54 tes 1 0
c date and time created 83/01/20 11:11:54 by tes
e
u
tes
mjb
U
t
T
I 1
subroutine ktod (string, value)
########################################################################
#                                                                      #
#          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 character string to decimal                    #
#                                                                      #
#     Input Parameters:                                                #
#            string - (byte) array for ade string of characters        #
#                                                                      #
#     Output Parameters:                                               #
#            value  - real binary number to be converted               #
#                                                                      #
#     Routines Called:                                                 #
#            none                                                      #
#                                                                      #
########################################################################
SHORTINT string(1)
real value
 
SHORTINT c, icount
integer ksign
real tens, mult

   value = 0.0
   tens = 10.0
   mult = 1.0
   ksign = 1
   icount = 0
   c = 0

   repeat {
      if (c == MINUS) ksign = -1
      icount = icount + 1
      c = string(icount)
      if (c == NUL) return
      } until (c >= DIG0 & c <= DIG9 | c == PERIOD)

   while (c != NUL) {
      if (c == PERIOD) {
	 tens = 1.0
	 mult = 0.1
	 }
      else {
         value = value * tens + (c - DIG0) * mult
         mult = mult * mult
         }
      icount = icount + 1
      c = string(icount)
      }
   value = ksign*value

   return
end
E 1
