1 | |
---|
2 | class Basis_bits(): |
---|
3 | bit_0 = 0 |
---|
4 | bit_1 = 0 |
---|
5 | bit_2 = 0 |
---|
6 | bit_3 = 0 |
---|
7 | bit_4 = 0 |
---|
8 | bit_5 = 0 |
---|
9 | bit_6 = 0 |
---|
10 | bit_7 = 0 |
---|
11 | |
---|
12 | class Output(): |
---|
13 | matches = 0 |
---|
14 | lf = 0 |
---|
15 | |
---|
16 | def DoGrep(basis_bits, output): |
---|
17 | basis0 = basis_bits.bit_0 |
---|
18 | basis1 = basis_bits.bit_1 |
---|
19 | basis2 = basis_bits.bit_2 |
---|
20 | basis3 = basis_bits.bit_3 |
---|
21 | basis4 = basis_bits.bit_4 |
---|
22 | basis5 = basis_bits.bit_5 |
---|
23 | basis6 = basis_bits.bit_6 |
---|
24 | basis7 = basis_bits.bit_7 |
---|
25 | # |
---|
26 | # Paste icgrep -print-pablo output below |
---|
27 | # The output shown here is from icgrep '^.$' -print-pablo |
---|
28 | # |
---|
29 | not_ = (~basis7) |
---|
30 | not_1 = (~basis5) |
---|
31 | and_ = (basis6 & not_) |
---|
32 | and_1 = (basis4 & not_1) |
---|
33 | or_ = (basis2 | basis3) |
---|
34 | or_1 = (basis0 | basis1) |
---|
35 | and_2 = (and_1 & and_) |
---|
36 | or_2 = (or_1 | or_) |
---|
37 | not_8 = (~or_2) |
---|
38 | CC_a = (and_2 & not_8) |
---|
39 | not_9 = (~basis6) |
---|
40 | and_4 = (basis7 & not_9) |
---|
41 | and_5 = (basis4 & basis5) |
---|
42 | and_6 = (and_5 & and_4) |
---|
43 | CC_d = (and_6 & not_8) |
---|
44 | and_8 = (basis4 & not_8) |
---|
45 | xor_ = (basis5 ^ basis6) |
---|
46 | CC_a_d = (and_8 & xor_) |
---|
47 | if CC_d: |
---|
48 | cr1 = pablo.Advance(CC_d, 1) |
---|
49 | and_10 = (cr1 & CC_a) |
---|
50 | crlf = and_10 |
---|
51 | else: |
---|
52 | crlf = 0 |
---|
53 | |
---|
54 | BC_c0_ff = (basis0 & basis1) |
---|
55 | not_31 = (~basis1) |
---|
56 | BC_80_bf = (basis0 & not_31) |
---|
57 | if BC_c0_ff: |
---|
58 | not_25 = (~basis2) |
---|
59 | and_13 = (BC_c0_ff & not_25) |
---|
60 | or_11 = (basis4 | basis5) |
---|
61 | or_12 = (or_11 | basis6) |
---|
62 | or_13 = (basis3 | or_12) |
---|
63 | BC_c2_df = (and_13 & or_13) |
---|
64 | not_26 = (~basis3) |
---|
65 | and_15 = (basis2 & not_26) |
---|
66 | BC_e0_ef = (BC_c0_ff & and_15) |
---|
67 | not_27 = (~basis4) |
---|
68 | and_18 = (basis2 & basis3) |
---|
69 | and_20 = (BC_c0_ff & and_18) |
---|
70 | and_21 = (and_20 & not_27) |
---|
71 | or_16 = (basis6 | basis7) |
---|
72 | and_22 = (basis5 & or_16) |
---|
73 | not_30 = (~and_22) |
---|
74 | BC_f0_f4 = (and_21 & not_30) |
---|
75 | if BC_c2_df: |
---|
76 | advance = pablo.Advance(BC_c2_df, 1) |
---|
77 | u8scope22 = advance |
---|
78 | not_37 = (~or_11) |
---|
79 | not_38 = (~or_) |
---|
80 | and_27 = (and_ & not_37) |
---|
81 | and_28 = (BC_c0_ff & not_38) |
---|
82 | BC_c2 = (and_28 & and_27) |
---|
83 | advance1 = pablo.Advance(BC_c2, 1) |
---|
84 | and_31 = (basis5 & not_27) |
---|
85 | and_33 = (and_31 & and_4) |
---|
86 | and_34 = (BC_80_bf & not_38) |
---|
87 | BC_85 = (and_34 & and_33) |
---|
88 | and_36 = (advance1 & BC_85) |
---|
89 | NEL = and_36 |
---|
90 | else: |
---|
91 | u8scope22 = 0 |
---|
92 | NEL = 0 |
---|
93 | |
---|
94 | if BC_e0_ef: |
---|
95 | advance2 = pablo.Advance(BC_e0_ef, 1) |
---|
96 | u8scope32 = advance2 |
---|
97 | advance3 = pablo.Advance(BC_e0_ef, 2) |
---|
98 | or_22 = (u8scope32 | advance3) |
---|
99 | u8scope3X = or_22 |
---|
100 | not_49 = (~or_11) |
---|
101 | and_40 = (and_ & not_49) |
---|
102 | BC_e2 = (BC_e0_ef & and_40) |
---|
103 | advance4 = pablo.Advance(BC_e2, 1) |
---|
104 | not_59 = (~or_) |
---|
105 | or_27 = (or_11 | or_16) |
---|
106 | not_60 = (~or_27) |
---|
107 | and_44 = (BC_80_bf & not_59) |
---|
108 | BC_80 = (and_44 & not_60) |
---|
109 | and_46 = (advance4 & BC_80) |
---|
110 | advance5 = pablo.Advance(and_46, 1) |
---|
111 | and_50 = (and_1 & not_9) |
---|
112 | and_51 = (BC_80_bf & and_15) |
---|
113 | BC_a8_a9 = (and_51 & and_50) |
---|
114 | and_53 = (advance5 & BC_a8_a9) |
---|
115 | LS_PS = and_53 |
---|
116 | BC_e0 = (BC_e0_ef & not_60) |
---|
117 | advance6 = pablo.Advance(BC_e0, 1) |
---|
118 | BC_80_9f = (BC_80_bf & not_25) |
---|
119 | and_60 = (advance6 & BC_80_9f) |
---|
120 | BC_ed = (BC_e0_ef & and_6) |
---|
121 | advance7 = pablo.Advance(BC_ed, 1) |
---|
122 | BC_a0_bf = (BC_80_bf & basis2) |
---|
123 | and_70 = (advance7 & BC_a0_bf) |
---|
124 | or_35 = (and_60 | and_70) |
---|
125 | EX_invalid = or_35 |
---|
126 | else: |
---|
127 | u8scope32 = 0 |
---|
128 | u8scope3X = 0 |
---|
129 | LS_PS = 0 |
---|
130 | EX_invalid = 0 |
---|
131 | |
---|
132 | if BC_f0_f4: |
---|
133 | u8scope42 = pablo.Advance(BC_f0_f4, 1) |
---|
134 | u8scope43 = pablo.Advance(u8scope42, 1) |
---|
135 | u8scope44 = pablo.Advance(u8scope43, 1) |
---|
136 | or_36 = (u8scope42 | u8scope43) |
---|
137 | u8scope4nonfinal = or_36 |
---|
138 | or_37 = (u8scope4nonfinal | u8scope44) |
---|
139 | u8scope4X = or_37 |
---|
140 | or_40 = (or_11 | or_16) |
---|
141 | not_84 = (~or_40) |
---|
142 | BC_f0 = (and_20 & not_84) |
---|
143 | advance8 = pablo.Advance(BC_f0, 1) |
---|
144 | not_88 = (~or_) |
---|
145 | BC_80_8f = (BC_80_bf & not_88) |
---|
146 | and_77 = (advance8 & BC_80_8f) |
---|
147 | not_92 = (~or_16) |
---|
148 | and_78 = (basis5 & not_27) |
---|
149 | and_81 = (and_78 & not_92) |
---|
150 | BC_f4 = (and_20 & and_81) |
---|
151 | advance9 = pablo.Advance(BC_f4, 1) |
---|
152 | BC_90_bf = (BC_80_bf & or_) |
---|
153 | and_86 = (advance9 & BC_90_bf) |
---|
154 | or_47 = (and_77 | and_86) |
---|
155 | FX_invalid = or_47 |
---|
156 | else: |
---|
157 | u8scope4nonfinal = 0 |
---|
158 | u8scope4X = 0 |
---|
159 | FX_invalid = 0 |
---|
160 | |
---|
161 | or_48 = (u8scope3X | u8scope4X) |
---|
162 | or_49 = (u8scope22 | or_48) |
---|
163 | or_50 = (BC_c2_df | BC_e0_ef) |
---|
164 | or_51 = (or_50 | BC_f0_f4) |
---|
165 | xor_1 = (or_49 ^ BC_80_bf) |
---|
166 | or_52 = (EX_invalid | FX_invalid) |
---|
167 | xor_2 = (BC_c0_ff ^ or_51) |
---|
168 | or_53 = (xor_1 | or_52) |
---|
169 | or_54 = (xor_2 | or_53) |
---|
170 | u8invalid = or_54 |
---|
171 | not_94 = (~u8invalid) |
---|
172 | u8valid = not_94 |
---|
173 | and_87 = (BC_c0_ff & u8valid) |
---|
174 | valid_pfx = and_87 |
---|
175 | or_55 = (BC_c0_ff | u8scope32) |
---|
176 | or_56 = (or_55 | u8scope4nonfinal) |
---|
177 | and_88 = (or_56 & u8valid) |
---|
178 | nonfinal = and_88 |
---|
179 | or_57 = (NEL | LS_PS) |
---|
180 | NEL_LS_PS = or_57 |
---|
181 | else: |
---|
182 | u8valid = 0 |
---|
183 | u8invalid = 0 |
---|
184 | valid_pfx = 0 |
---|
185 | nonfinal = 0 |
---|
186 | NEL_LS_PS = 0 |
---|
187 | |
---|
188 | or_58 = (CC_a_d | NEL_LS_PS) |
---|
189 | CC_0_7f = (~basis0) |
---|
190 | not_96 = (~u8invalid) |
---|
191 | and_89 = (CC_0_7f & not_96) |
---|
192 | initial = (and_89 | valid_pfx) |
---|
193 | not_98 = (~crlf) |
---|
194 | and_90 = (or_58 & not_98) |
---|
195 | or_62 = (and_90 | crlf) |
---|
196 | not_99 = (~or_62) |
---|
197 | advance10 = pablo.Advance(not_99, 1) |
---|
198 | or_63 = (advance10 | crlf) |
---|
199 | sol = (~or_63) |
---|
200 | and_91 = (initial & sol) |
---|
201 | scanthru = pablo.ScanThru(and_91, nonfinal) |
---|
202 | dot = (scanthru & not_99) |
---|
203 | adv = pablo.Advance(dot, 1) |
---|
204 | and_92 = (initial & adv) |
---|
205 | scanToFinal = pablo.ScanThru(and_92, nonfinal) |
---|
206 | end = (scanToFinal & and_90) |
---|
207 | not_102 = (~and_90) |
---|
208 | matchstar = pablo.MatchStar(end, not_102) |
---|
209 | and_93 = (matchstar & and_90) |
---|
210 | output.matches = and_93 |
---|
211 | and_94 = (and_90 & not_98) |
---|
212 | output.lf = and_94 |
---|
213 | # |
---|
214 | # End of pasted output |
---|
215 | # |
---|
216 | |
---|
217 | def Main(basis_bits, output): |
---|
218 | DoGrep(basis_bits, output) |
---|
219 | |
---|