TIP: Click on subject to list as thread! ANSI
echo: os2prog
to: Mark Shumway
from: Geert Bosch
date: 1995-01-10 02:45:00
subject: UU algorithm

Mark Shumway wrote in a message to Stephen Lindholm:

 MS> So, how does one go about translating the shift-bit
 MS> operations into REXX?    
Convert characters to bitstrings and use string-ops.
I've gotten some Rexx-source that performed poorly (130 lines per minute)
and changed it a lot, so it does over 3000 lines per minute. Still very
slow compared to compiler programs, but I'd like to see someone that can
get it significant faster without use of external libraries.

Here's the source:

/* REXX Decoder for UUEncoded files. Takes encoded filename as a parameter */
   signal on NOVALUE
/* Based on original by Stefan Haubenthal 1992/94 */
/* Hacked for OS/2 by Graham Bingham (grahamb{at}iacces.za), Dec 1994 */
/* Optimized for speed (130 lpm -> 3000 lpm)
      by Geert Bosch (g.r.bosch{at}student.utwente.nl), Dec 1994 */

   in_range  = xrange("20"x,"7f"x)
   out_range = xrange("00"x,"5f"x)

   parse arg input
   say 'input: 'input
   do forever
      do until datatype(mode)='NUM'
         line=linein(input)
         if stream( input,'S')'READY' then 
            exit(1)
         parse value line with "begin" mode dest .
      end
      say "uudecoding "dest"..."
      if stream(dest,'C','QUERY EXISTS')'' then
         '{at}ERASE' dest
      /*call stream dest, 'C', 'OPEN WRITE'*/

      call time('e')
      do lines=1
         line=linein( input)
         if line="end" then 
            leave
         len = (c2d(left(line, 1)) - 32) // 64 * 4 % 3
         if len>0 then 
            call charout dest,decode( substr( line,2,trunc(len)))
      end
      say trunc( lines/time('e')*60)" lines per minute"
      call stream dest,'C','CLOSE'
   end
exit

/* xx765432 xx107654 xx321076 xx543210 -> 76543210 76543210 76543210 */
DECODE:
   a = x2b(c2x(translate(arg(1),out_range,in_range)))
   bin = ''
   do n=3 to length(a) by 32
      bin = bin || b2x(substr(a, n, 6) || substr(a, n + 8, 6) || substr(a,
n + 16, 6) || substr(a, n + 24, 6))
   end
return x2c(bin)

Groetjes, Geert 
--- timEd/2 1.01+
* Origin: OS/2: Hot, Cool and Clickable... (2:283/307.40)
SEEN-BY: 12/2442 620/243 624/50 632/348 640/820 690/660 711/409 410 413 430
SEEN-BY: 711/807 808 809 934 942 949 712/353 515 713/888 800/1 7877/2809
@PATH: 283/307 7 35 512 280/801 24/24 396/1 3615/50 229/2 12/2442 711/409 808
@PATH: 711/809 934

SOURCE: echomail via fidonet.ozzmosis.com

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.