!
! These routines should no longer be required
!
! Copyright (c) 1987 Edinburgh Portable Compilers Ltd. All Rights Reserved.
%ownstring(90) copyright = " Copyright (c) 1987 Edinburgh Portable Compilers Ltd. All Rights Reserved."
%externalSTRING(15) %FN Itos(%INTEGER K)
  %INTEGER REM,NUM,NF
  %STRING(15) STR

  STR=""
  NF=0
  %IF K<0 %START
    NF=1
    K = K *(-1)
  %FINISH
  %CYCLE
    NUM=K
    K = K//10
    REM = NUM-(K*10)
    STR = TOSTRING(REM+'0').STR
    %IF K=0 %THEN %EXIT
  %REPEAT
  %IF NF=1 %THEN STR = "-".STR
  %RESULT = STR
%END;! Itos
!
%conststring(1) %array Hex(0:15) =
"0","1","2","3","4","5","6","7","8","9","A","B","C","D","E","F"
%externalroutine Phex(%integer Val)
%integer I
      %cycle I=28,-4,0
         printstring(Hex((Val>>I)&15))
      %repeat
%end;! Phex
!
%externalstring(*) %fn Htos(%integer i,size)
   %integer j
   %string(8) s

   s=""
   %cycle j=(size*4)-4,-4,0
     s=s.hex((i>>j)&15)
   %repeat
   %result=s
%end;! Htos
%systemroutine Cstring %alias "s_cstring" (%string(*) %name S, %integer ad)
  %integer i, sbad, len

  sbad = addr(s)
  len  = length(S)
  byteinteger(ad+(i-1)) = byteinteger(Sbad + i) %for i=1,1,len
  byteinteger(ad+len)=0
%end;! Cstring
!
!%externalroutine ByteFill %alias "s_bfill" (%integer at, length, filler)
!    !
!   %externalroutinespec memset (%integer at, filler, length) {from libc}
!
!   memset(at, filler, length)
!%end;! of ByteFill
!
%endoffile
