~ubuntu-branches/ubuntu/hardy/ruby1.8/hardy-updates

« back to all changes in this revision

Viewing changes to sample/rcs.awk

  • Committer: Bazaar Package Importer
  • Author(s): akira yamada
  • Date: 2007-03-13 22:11:58 UTC
  • mfrom: (1.1.5 upstream)
  • Revision ID: james.westby@ubuntu.com-20070313221158-h3oql37brlaf2go2
Tags: 1.8.6-1
* new upstream version, 1.8.6.
* libruby1.8 conflicts with libopenssl-ruby1.8 (< 1.8.6) (closes: #410018)
* changed packaging style to cdbs from dbs.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
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
}