home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / rbemx144.zip / ruby-1.4.4 / sample / rcs.awk < prev    next >
Text File  |  1998-01-16  |  638b  |  34 lines

  1. BEGIN {
  2.     sw = 40.0;
  3.     dw = 78.0;
  4.     hdw = dw / 2.0;
  5.     w = 20.0;
  6.     h =1.0;
  7.     d = 0.2;
  8.     ss="abcdefghijklmnopqrstuvwxyz0123456789!#$%^&*()-=\\[];'`,./";
  9.     rnd = srand();
  10. }
  11.  
  12. {
  13.     xr = -hdw; y = h * 1.0; maxxl = -999;
  14.     s = "";
  15.     while (xr < hdw) {
  16.     x = xr * (1 + y) - y * w / 2;
  17.     i = (x / (1 + h) + sw /2);
  18.     c = (0 < i && i < length($0)) ? substr($0, i, 1) : "0";
  19.     y = h - d * c;
  20.     xl = xr - w * y / (1 + y);
  21.     if (xl < -hdw || xl >= hdw || xl <= maxxl) {
  22.         t = rand() * length(ss);
  23.         c = substr(ss, t, 1);
  24.     }
  25.     else {
  26.         c = substr(s, xl + hdw, 1);
  27.         maxxl = xl;
  28.     }
  29.     s = s c;
  30.     xr = xr + 1;
  31.     }
  32.     print s;
  33. }
  34.