home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / seedump.zip / SAMPLES / CA.BAG next >
Text File  |  1995-07-27  |  716b  |  37 lines

  1. /*
  2.  * Author : a priori computer solutions GmbH
  3.  * Title  : Rexx-Utility
  4.  * Notice : Written 1995, the 27th of July
  5.  */
  6.  
  7. /*
  8. * mini calculator for bagger
  9. */
  10.  
  11. parse upper arg p
  12. if p == '?' | p == '' then do
  13.   say "   help for minicalculator ca"
  14.   say "       any arithmetic expression, the rexx style  "
  15.   say "       X'...' for hexadecimal terms               "
  16.   return 0
  17. end
  18. numeric digits 12
  19. return doit(p)
  20.  
  21. doit: procedure
  22.   parse upper arg p
  23.  
  24.   s = pos("X'", p)
  25.   if s <> 0 then do
  26.     s = s + 2
  27.     e = pos("'", p, s)
  28.     d = x2d(substr(p,s, e-s))
  29.     s = s - 2
  30.     return doit( overlay(d,p,s,e-s+1) )
  31.   end
  32.  
  33.   res='r'
  34.   interpret res '=' p
  35.   say r'     X'd2x(r)
  36.   return r
  37.