h13210
s 00060/00000/00000
d D 1.1 83/01/20 11:11:49 tes 1 0
c date and time created 83/01/20 11:11:49 by tes
e
u
tes
mjb
U
t
T
I 1
subroutine itok (int, start, string, iend)
########################################################################
#                                                                      #
#          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 an integer to a character string               #
#                                                                      #
#     Input Parameters:                                                #
#            int    -  integer to be converted                         #
#            start  -  integer index to string to begin conversion     #
#                                                                      #
#     Output Parameters:                                               #
#            string -  converted integer string                        #
#            iend   -  index pointer to terminator in string           #
#                                                                      #
#     Routines Called:                                                 #
#            divid - obtain the quotient and remainder of two integers #
#                                                                      #
########################################################################
integer int, start, iend
SHORTINT string(1)
 
integer d, i, intval, j, k
integer divid
 
   intval = iabs (int)
   i = start - 1
   repeat {                          # generate digits

      i = i + 1     
      # obtain the remainder module 10 and the value divided by 10
      intval = divid (intval, 10, d)
      string (i) = d + DIG0

      } until (intval == 0)
 
   if (int < 0) {         # then sign
      i = i + 1
      string (i) = MINUS
      }
 
   iend = i + 1            # allow for null terminator

   for (j = start; j < i; j = j + 1) {   # then reverse
      k = string (i)
      string (i) = string (j)
      string (j) = k
      i = i - 1
      }

   string(iend) = NUL
 
   return
end
E 1
