1 | # demo |
---|
2 | import bitutil as pablo |
---|
3 | |
---|
4 | class Groups(): |
---|
5 | starts = 0 |
---|
6 | follows = 0 |
---|
7 | follows_1 = 0 |
---|
8 | follows_2 = 0 |
---|
9 | follows_3 = 0 |
---|
10 | follows_4 = 0 |
---|
11 | follows_5 = 0 |
---|
12 | follows_6 = 0 |
---|
13 | follows_7 = 0 |
---|
14 | follows_8 = 0 |
---|
15 | follows_9 = 0 |
---|
16 | follows_10 = 0 |
---|
17 | follows_11 = 0 |
---|
18 | follows_12 = 0 |
---|
19 | follows_13 = 0 |
---|
20 | follows_14 = 0 |
---|
21 | follows_15 = 0 |
---|
22 | follows_16 = 0 |
---|
23 | follows_gte_17 = 0 |
---|
24 | |
---|
25 | def Gen_lgth_groups(groups): |
---|
26 | |
---|
27 | cursor = groups.starts |
---|
28 | temp = groups.follows |
---|
29 | |
---|
30 | # Group symbols of length 1 |
---|
31 | cursor = pablo.Advance(cursor) |
---|
32 | groups.follows_1 = cursor & temp |
---|
33 | temp = temp & ~groups.follows_1 |
---|
34 | |
---|
35 | # Group symbols of length 2 |
---|
36 | cursor = pablo.Advance(cursor) |
---|
37 | groups.follows_2 = cursor & temp |
---|
38 | temp = temp & ~groups.follows_2 |
---|
39 | |
---|
40 | # Group symbols of length 3 |
---|
41 | cursor = pablo.Advance(cursor) |
---|
42 | groups.follows_3 = cursor & temp |
---|
43 | temp = temp & ~groups.follows_3 |
---|
44 | |
---|
45 | # Group symbols of length 4 |
---|
46 | cursor = pablo.Advance(cursor) |
---|
47 | groups.follows_4 = cursor & temp |
---|
48 | temp = temp & ~groups.follows_4 |
---|
49 | |
---|
50 | # Group symbols of length 5 |
---|
51 | cursor = pablo.Advance(cursor) |
---|
52 | groups.follows_5 = cursor & temp |
---|
53 | temp = temp & ~groups.follows_5 |
---|
54 | |
---|
55 | # Group symbols of length 6 |
---|
56 | cursor = pablo.Advance(cursor) |
---|
57 | groups.follows_6 = cursor & temp |
---|
58 | temp = temp & ~groups.follows_6 |
---|
59 | |
---|
60 | # Group symbols of length 7 |
---|
61 | cursor = pablo.Advance(cursor) |
---|
62 | groups.follows_7 = cursor & temp |
---|
63 | temp = temp & ~groups.follows_7 |
---|
64 | |
---|
65 | # Group symbols of length 8 |
---|
66 | cursor = pablo.Advance(cursor) |
---|
67 | groups.follows_8 = cursor & temp |
---|
68 | temp = temp & ~groups.follows_8 |
---|
69 | |
---|
70 | # Group symbols of length 9 |
---|
71 | cursor = pablo.Advance(cursor) |
---|
72 | groups.follows_9 = cursor & temp |
---|
73 | temp = temp & ~groups.follows_9 |
---|
74 | |
---|
75 | # Group symbols of length 10 |
---|
76 | cursor = pablo.Advance(cursor) |
---|
77 | groups.follows_10 = cursor & temp |
---|
78 | temp = temp & ~groups.follows_10 |
---|
79 | |
---|
80 | # Group symbols of length 11 |
---|
81 | cursor = pablo.Advance(cursor) |
---|
82 | groups.follows_11 = cursor & temp |
---|
83 | temp = temp & ~groups.follows_11 |
---|
84 | |
---|
85 | # Group symbols of length 12 |
---|
86 | cursor = pablo.Advance(cursor) |
---|
87 | groups.follows_12 = cursor & temp |
---|
88 | temp = temp & ~groups.follows_12 |
---|
89 | |
---|
90 | # Group symbols of length 13 |
---|
91 | cursor = pablo.Advance(cursor) |
---|
92 | groups.follows_13 = cursor & temp |
---|
93 | temp = temp & ~groups.follows_13 |
---|
94 | |
---|
95 | # Group symbols of length 14 |
---|
96 | cursor = pablo.Advance(cursor) |
---|
97 | groups.follows_14 = cursor & temp |
---|
98 | temp = temp & ~groups.follows_14 |
---|
99 | |
---|
100 | # Group symbols of length 15 |
---|
101 | cursor = pablo.Advance(cursor) |
---|
102 | groups.follows_15 = cursor & temp |
---|
103 | temp = temp & ~groups.follows_15 |
---|
104 | |
---|
105 | # Group symbols of length 16 |
---|
106 | cursor = pablo.Advance(cursor) |
---|
107 | groups.follows_16 = cursor & temp |
---|
108 | temp = temp & ~groups.follows_16 |
---|
109 | |
---|
110 | # Group symbols of length greater than 16 |
---|
111 | groups.follows_gte_17 = temp |
---|
112 | |
---|
113 | def Main(groups): |
---|
114 | Gen_lgth_groups(groups) |
---|
115 | |
---|