content stringlengths 4 1.04M | lang stringclasses 358 values | score int64 0 5 | repo_name stringlengths 5 114 | repo_path stringlengths 4 229 | repo_licenses listlengths 1 8 |
|---|---|---|---|---|---|
0 reg32_t "dword"
1 code_t "proc*"
2 num32_t "int"
3 uint32_t "size_t"
4 ptr(struct(0:num32_t,4:ptr(num8_t),8:ptr(num8_t),12:ptr(num8_t),16:ptr(num8_t),20:ptr(num8_t),24:ptr(num8_t),28:ptr(num8_t),32:ptr(num8_t),36:ptr(num8_t),40:ptr(num8_t),44:ptr(num8_t),48:ptr(struct(0:ptr(TOP),4:ptr(struct(0:num32_t,4:ptr(reg8_t),8:ptr(reg8_t),12:ptr(reg8_t),16:ptr(reg8_t),20:ptr(reg8_t),24:ptr(reg8_t),28:ptr(reg8_t),32:ptr(reg8_t),36:ptr(reg8_t),40:ptr(reg8_t),44:ptr(reg8_t),48:ptr(TOP),52:ptr(TOP),56:num32_t,60:num32_t,64:num32_t,68:uint16_t,70:int8_t,71:array(num8_t,1),72:ptr(TOP),76:num64_t,84:ptr(TOP),88:ptr(TOP),92:ptr(TOP),96:ptr(TOP),100:uint32_t,104:num32_t,108:array(num8_t,40))),8:num32_t)),52:ptr(struct(0:num32_t,4:ptr(num8_t),8:ptr(num8_t),12:ptr(num8_t),16:ptr(num8_t),20:ptr(num8_t),24:ptr(num8_t),28:ptr(num8_t),32:ptr(num8_t),36:ptr(num8_t),40:ptr(num8_t),44:ptr(num8_t),48:ptr(struct(0:ptr(TOP),4:ptr(TOP),8:num32_t)),52:ptr(TOP),56:num32_t,60:num32_t,64:num32_t,68:uint16_t,70:int8_t,71:array(num8_t,1),72:ptr(TOP),76:num64_t,84:ptr(TOP),88:ptr(TOP),92:ptr(TOP),96:ptr(TOP),100:uint32_t,104:num32_t,108:array(num8_t,40))),56:num32_t,60:num32_t,64:num32_t,68:uint16_t,70:int8_t,71:array(num8_t,1),72:ptr(TOP),76:num64_t,84:ptr(TOP),88:ptr(TOP),92:ptr(TOP),96:ptr(TOP),100:uint32_t,104:num32_t,108:array(num8_t,40))) "FILE*"
5 ptr(num8_t) "char*"
6 ptr(TOP) "void*"
1 code_t "(_In_ void*,_In_ void* -?-> int)*"
7 ptr(ptr(num8_t)) "char**"
8 num8_t "char"
9 ptr(reg64_t) "qword*"
10 ptr(array(reg8_t,16)) "unknown_128*"
11 ptr(array(reg8_t,56)) "unknown_448*"
12 ptr(array(reg8_t,104)) "unknown_832*"
13 ptr(struct(0:reg64_t,8:reg32_t)) "StructFrag_15*"
14 ptr(struct(0:num32_t,4:ptr(num8_t),8:ptr(num8_t),12:ptr(num8_t),16:ptr(num8_t),20:ptr(num8_t),24:ptr(num8_t),28:ptr(num8_t),32:ptr(num8_t),36:ptr(num8_t),40:ptr(num8_t),44:ptr(num8_t),48:ptr(struct(0:ptr(TOP),4:ptr(TOP),8:num32_t)),52:ptr(TOP),56:num32_t,60:num32_t,64:num32_t,68:uint16_t,70:int8_t,71:array(num8_t,1),72:ptr(TOP),76:num64_t,84:ptr(TOP),88:ptr(TOP),92:ptr(TOP),96:ptr(TOP),100:uint32_t,104:num32_t,108:array(num8_t,40))) "_IO_FILE*"
15 ptr(array(reg8_t,42)) "unknown_336*"
16 ptr(reg32_t) "dword*"
17 union(ptr(struct(0:num32_t,4:ptr(num8_t),8:ptr(num8_t),12:ptr(num8_t),16:ptr(num8_t),20:ptr(num8_t),24:ptr(num8_t),28:ptr(num8_t),32:ptr(num8_t),36:ptr(num8_t),40:ptr(num8_t),44:ptr(num8_t),48:ptr(struct(0:ptr(TOP),4:ptr(struct(0:num32_t,4:ptr(reg8_t),8:ptr(reg8_t),12:ptr(reg8_t),16:ptr(reg8_t),20:ptr(reg8_t),24:ptr(reg8_t),28:ptr(reg8_t),32:ptr(reg8_t),36:ptr(reg8_t),40:ptr(reg8_t),44:ptr(reg8_t),48:ptr(TOP),52:ptr(TOP),56:num32_t,60:num32_t,64:num32_t,68:uint16_t,70:int8_t,71:array(reg8_t,1),72:ptr(TOP),76:num64_t,84:ptr(TOP),88:ptr(TOP),92:ptr(TOP),96:ptr(TOP),100:uint32_t,104:num32_t,108:array(reg8_t,40))),8:num32_t)),52:ptr(struct(0:num32_t,4:ptr(num8_t),8:ptr(num8_t),12:ptr(num8_t),16:ptr(num8_t),20:ptr(num8_t),24:ptr(num8_t),28:ptr(num8_t),32:ptr(num8_t),36:ptr(num8_t),40:ptr(num8_t),44:ptr(num8_t),48:ptr(struct(0:ptr(TOP),4:ptr(TOP),8:num32_t)),52:ptr(TOP),56:num32_t,60:num32_t,64:num32_t,68:uint16_t,70:int8_t,71:array(num8_t,1),72:ptr(TOP),76:num64_t,84:ptr(TOP),88:ptr(TOP),92:ptr(TOP),96:ptr(TOP),100:uint32_t,104:num32_t,108:array(num8_t,40))),56:num32_t,60:num32_t,64:num32_t,68:uint16_t,70:int8_t,71:array(num8_t,1),72:ptr(TOP),76:num64_t,84:ptr(TOP),88:ptr(TOP),92:ptr(TOP),96:ptr(TOP),100:uint32_t,104:num32_t,108:array(num8_t,40))),ptr(struct(0:num32_t,4:ptr(num8_t),8:ptr(num8_t),12:ptr(num8_t),16:ptr(num8_t),20:ptr(num8_t),24:ptr(num8_t),28:ptr(num8_t),32:ptr(num8_t),36:ptr(num8_t),40:ptr(num8_t),44:ptr(num8_t),48:ptr(struct(0:ptr(TOP),4:ptr(TOP),8:num32_t)),52:ptr(TOP),56:num32_t,60:num32_t,64:num32_t,68:uint16_t,70:int8_t,71:array(num8_t,1),72:ptr(TOP),76:num64_t,84:ptr(TOP),88:ptr(TOP),92:ptr(TOP),96:ptr(TOP),100:uint32_t,104:num32_t,108:array(num8_t,40)))) "Union_0"
18 ptr(num32_t) "int*"
19 ptr(struct(0:ptr(num8_t),4:reg16_t)) "Struct_6*"
20 reg16_t "word"
5 ptr(num8_t) "char[]"
21 union(ptr(num8_t),ptr(struct(0:ptr(TOP),4294967295:num8_t))) "Union_4"
22 ptr(uint16_t) "unsigned short*"
23 ptr(array(reg8_t,80)) "unknown_640*"
24 ptr(uint32_t) "size_t*"
25 ptr(struct(0:array(reg8_t,536870904),4294967288:reg32_t)) "StructFrag_3*"
7 ptr(ptr(num8_t)) "char[]*"
26 union(ptr(num8_t),ptr(struct(0:reg16_t,2:num8_t))) "Union_1"
16 ptr(reg32_t) "dword[]"
27 ptr(ptr(struct(0:num8_t,4294967280:ptr(TOP),4294967284:uint32_t,4294967288:num8_t,4294967292:reg32_t))) "Struct_30**"
28 ptr(struct(40:ptr(TOP),44:uint32_t,48:num8_t)) "Struct_31*"
29 ptr(struct(0:reg32_t,4:reg32_t)) "StructFrag_10*"
30 ptr(struct(0:num32_t,4:ptr(ptr(num8_t)),4294967292:reg32_t)) "Struct_10*"
31 ptr(struct(0:ptr(num8_t),4:num32_t,8:ptr(num32_t),12:num32_t)) "option*"
3 uint32_t "unsigned int"
32 ptr(struct(0:ptr(num8_t),4:ptr(num8_t))) "Struct_12*"
33 ptr(struct(0:uint32_t,4:ptr(num32_t),8:ptr(num32_t))) "re_registers*"
34 ptr(struct(0:ptr(uint8_t),4:uint32_t,8:uint32_t,12:uint32_t,16:ptr(num8_t),20:ptr(uint8_t),24:uint32_t,28:uint32_t)) "re_pattern_buffer*"
35 ptr(struct(0:ptr(num8_t),4:ptr(num8_t),8:reg16_t,10:reg16_t,12:ptr(num8_t),16:num32_t)) "Struct_13*"
36 ptr(struct(0:ptr(struct(0:ptr(TOP),4294967295:num8_t)),4:reg16_t,8:reg16_t,10:reg16_t,12:reg16_t,16:ptr(struct(0:ptr(TOP),4294967295:num8_t)))) "Struct_14*"
37 ptr(array(reg8_t,27)) "unknown_216*"
38 ptr(struct(0:union(ptr(num8_t),ptr(struct(0:ptr(TOP),4294967295:num8_t))),4:reg16_t,8:reg16_t,10:reg16_t,12:reg16_t,16:union(ptr(num8_t),ptr(struct(0:ptr(TOP),4294967295:num8_t))))) "Struct_18*"
39 union(ptr(num8_t),num32_t) "Union_3"
40 union(ptr(struct(0:num32_t,4:ptr(num8_t),8:ptr(num8_t),12:ptr(num8_t),16:ptr(num8_t),20:ptr(num8_t),24:ptr(num8_t),28:ptr(num8_t),32:ptr(num8_t),36:ptr(num8_t),40:ptr(num8_t),44:ptr(num8_t),48:ptr(struct(0:ptr(TOP),4:ptr(struct(0:num32_t,4:ptr(reg8_t),8:ptr(reg8_t),12:ptr(reg8_t),16:ptr(reg8_t),20:ptr(reg8_t),24:ptr(reg8_t),28:ptr(reg8_t),32:ptr(reg8_t),36:ptr(reg8_t),40:ptr(reg8_t),44:ptr(reg8_t),48:ptr(TOP),52:ptr(TOP),56:num32_t,60:num32_t,64:num32_t,68:uint16_t,70:int8_t,71:array(reg8_t,1),72:ptr(TOP),76:num64_t,84:ptr(TOP),88:ptr(TOP),92:ptr(TOP),96:ptr(TOP),100:uint32_t,104:num32_t,108:array(reg8_t,40))),8:num32_t)),52:ptr(struct(0:num32_t,4:ptr(num8_t),8:ptr(num8_t),12:ptr(num8_t),16:ptr(num8_t),20:ptr(num8_t),24:ptr(num8_t),28:ptr(num8_t),32:ptr(num8_t),36:ptr(num8_t),40:ptr(num8_t),44:ptr(num8_t),48:ptr(struct(0:ptr(TOP),4:ptr(TOP),8:num32_t)),52:ptr(TOP),56:num32_t,60:num32_t,64:num32_t,68:uint16_t,70:int8_t,71:array(num8_t,1),72:ptr(TOP),76:num64_t,84:ptr(TOP),88:ptr(TOP),92:ptr(TOP),96:ptr(TOP),100:uint32_t,104:num32_t,108:array(num8_t,40))),56:num32_t,60:num32_t,64:num32_t,68:uint16_t,70:int8_t,71:array(num8_t,1),72:ptr(TOP),76:num64_t,84:ptr(TOP),88:ptr(TOP),92:ptr(TOP),96:ptr(TOP),100:uint32_t,104:num32_t,108:array(num8_t,40))),ptr(struct(0:num32_t,4:ptr(num8_t),8:ptr(num8_t),12:ptr(num8_t),16:ptr(num8_t),20:ptr(num8_t),24:ptr(num8_t),28:ptr(num8_t),32:ptr(num8_t),36:ptr(num8_t),40:ptr(num8_t),44:ptr(num8_t),48:ptr(struct(0:ptr(TOP),4:ptr(TOP),8:num32_t)),52:ptr(TOP),56:num32_t,60:num32_t,64:num32_t,68:uint16_t,70:int8_t,71:array(num8_t,1),72:ptr(TOP),76:num64_t,84:ptr(TOP),88:ptr(TOP),92:ptr(TOP),96:ptr(TOP),100:uint32_t,104:num32_t,108:array(num8_t,40))),num32_t) "Union_2"
41 ptr(struct(0:ptr(TOP),4:uint32_t,8:num8_t,12:reg32_t)) "Struct_9*"
42 array(reg8_t,41) "unknown_328"
43 array(reg8_t,52) "unknown_416"
44 union(code_t,ptr(num8_t)) "Union_6"
45 array(reg8_t,55) "unknown_440"
46 array(reg8_t,11) "unknown_88"
47 array(reg8_t,58) "unknown_464"
48 array(reg8_t,14) "unknown_112"
49 array(reg8_t,17) "unknown_136"
50 ptr(ptr(TOP)) "void**"
51 union(ptr(struct(0:num32_t,4:ptr(num8_t),8:ptr(num8_t),12:ptr(num8_t),16:ptr(num8_t),20:ptr(num8_t),24:ptr(num8_t),28:ptr(num8_t),32:ptr(num8_t),36:ptr(num8_t),40:ptr(num8_t),44:ptr(num8_t),48:ptr(struct(0:ptr(TOP),4:ptr(struct(0:num32_t,4:ptr(reg8_t),8:ptr(reg8_t),12:ptr(reg8_t),16:ptr(reg8_t),20:ptr(reg8_t),24:ptr(reg8_t),28:ptr(reg8_t),32:ptr(reg8_t),36:ptr(reg8_t),40:ptr(reg8_t),44:ptr(reg8_t),48:ptr(TOP),52:ptr(TOP),56:num32_t,60:num32_t,64:num32_t,68:uint16_t,70:int8_t,71:array(reg8_t,1),72:ptr(TOP),76:num64_t,84:ptr(TOP),88:ptr(TOP),92:ptr(TOP),96:ptr(TOP),100:uint32_t,104:num32_t,108:array(reg8_t,40))),8:num32_t)),52:ptr(struct(0:num32_t,4:ptr(num8_t),8:ptr(num8_t),12:ptr(num8_t),16:ptr(num8_t),20:ptr(num8_t),24:ptr(num8_t),28:ptr(num8_t),32:ptr(num8_t),36:ptr(num8_t),40:ptr(num8_t),44:ptr(num8_t),48:ptr(struct(0:ptr(TOP),4:ptr(TOP),8:num32_t)),52:ptr(TOP),56:num32_t,60:num32_t,64:num32_t,68:uint16_t,70:int8_t,71:array(num8_t,1),72:ptr(TOP),76:num64_t,84:ptr(TOP),88:ptr(TOP),92:ptr(TOP),96:ptr(TOP),100:uint32_t,104:num32_t,108:array(num8_t,40))),56:num32_t,60:num32_t,64:num32_t,68:uint16_t,70:int8_t,71:array(num8_t,1),72:ptr(TOP),76:num64_t,84:ptr(TOP),88:ptr(TOP),92:ptr(TOP),96:ptr(TOP),100:uint32_t,104:num32_t,108:array(num8_t,40))),num32_t) "Union_5"
52 ptr(struct(0:reg32_t,40:ptr(num8_t),44:ptr(num8_t))) "Struct_2*"
53 ptr(struct(0:reg32_t,4:ptr(TOP))) "Struct_0*"
54 ptr(struct(0:num32_t,4:reg32_t,40:ptr(num8_t),44:ptr(num8_t))) "Struct_39*"
55 reg64_t "qword"
56 int32_t "signed int"
57 union(ptr(num8_t),ptr(struct(0:reg16_t,2:num8_t)),ptr(struct(0:ptr(TOP),4294967295:num8_t))) "Union_8"
58 ptr(struct(0:array(reg8_t,18),18:num8_t)) "StructFrag_1*"
59 ptr(struct(0:array(reg8_t,3),3:num8_t)) "StructFrag_17*"
24 ptr(uint32_t) "unsigned int*"
60 union(ptr(struct(0:union(ptr(num8_t),ptr(struct(0:ptr(TOP),4294967295:num8_t))),4:reg16_t,8:reg16_t,10:reg16_t,12:reg16_t,16:union(ptr(num8_t),ptr(struct(0:ptr(TOP),4294967295:num8_t))))),ptr(struct(0:reg32_t,4:ptr(TOP)))) "Union_10"
61 ptr(ptr(int32_t)) "__int32_t**"
6 ptr(TOP) "iconv_t"
62 ptr(ptr(uint16_t)) "unsigned short**"
63 ptr(struct(0:reg32_t,4:union(ptr(num8_t),ptr(struct(0:ptr(TOP),4294967295:num8_t))))) "Struct_20*"
64 ptr(reg16_t) "word[]"
65 ptr(struct(0:reg64_t,8:num8_t)) "StructFrag_4*"
66 ptr(struct(0:num32_t,4:uint32_t,40:ptr(num8_t),44:ptr(num8_t))) "Struct_42*"
67 ptr(struct(0:num32_t,40:ptr(num8_t),44:ptr(num8_t))) "Struct_41*"
68 ptr(struct(0:ptr(TOP),12:reg32_t)) "Struct_32*"
69 ptr(struct(0:ptr(TOP),4:uint32_t)) "Struct_35*"
70 ptr(struct(48:ptr(TOP),52:uint32_t,56:num8_t)) "Struct_36*"
71 union(ptr(reg32_t),ptr(struct(40:ptr(TOP),44:uint32_t,48:num8_t))) "Union_11"
72 ptr(struct(0:ptr(num8_t),4:reg32_t,8:reg32_t,20:reg32_t,24:reg32_t)) "Struct_34*"
73 ptr(struct(0:array(reg8_t,123170),123170:reg32_t)) "StructFrag_7*"
74 ptr(struct(0:array(reg8_t,536870908),4294967292:reg32_t)) "StructFrag_8*"
75 ptr(struct(0:array(reg8_t,45660),45660:reg32_t)) "StructFrag_13*"
76 ptr(struct(0:array(reg8_t,712),712:reg32_t)) "StructFrag_14*"
77 ptr(int32_t) "__int32_t*"
78 ptr(array(reg8_t,3)) "unknown_24*"
79 ptr(struct(0:array(reg8_t,536870904),4294967288:ptr(TOP))) "StructFrag_21*"
80 ptr(array(reg8_t,9)) "unknown_72*"
81 ptr(struct(0:uint32_t,4:ptr(num8_t))) "Struct_40*"
82 ptr(struct(0:num8_t,4294967288:ptr(TOP),4294967292:uint32_t)) "Struct_37*"
83 ptr(struct(0:ptr(TOP),4:ptr(TOP))) "Struct_4*"
84 ptr(struct(0:ptr(num8_t),4:uint32_t,8:uint32_t)) "Struct_19*"
85 ptr(struct(0:ptr(TOP),4:uint32_t,8:uint32_t)) "Struct_26*"
86 ptr(struct(0:reg64_t,8:uint32_t)) "StructFrag_16*"
87 array(reg8_t,4096) "unknown_32768"
88 array(reg8_t,135168) "unknown_1081344"
89 array(reg8_t,30) "unknown_240"
90 array(reg8_t,5) "unknown_40"
91 array(reg8_t,25) "unknown_200"
92 array(reg8_t,16) "unknown_128"
93 array(reg8_t,104) "unknown_832"
94 array(reg8_t,45) "unknown_360"
95 array(reg8_t,63) "unknown_504"
96 array(reg8_t,13) "unknown_104"
97 array(reg8_t,15) "unknown_120"
98 array(reg8_t,56) "unknown_448"
99 array(reg8_t,24) "unknown_192"
100 array(reg8_t,21) "unknown_168"
101 array(reg8_t,70) "unknown_560"
102 array(reg8_t,10) "unknown_80"
103 array(reg8_t,12) "unknown_96"
104 array(reg8_t,37) "unknown_296"
105 array(reg8_t,39) "unknown_312"
106 array(reg8_t,20) "unknown_160"
107 array(reg8_t,112) "unknown_896"
108 array(reg8_t,6) "unknown_48"
109 array(reg8_t,7) "unknown_56"
110 array(reg8_t,73) "unknown_584"
111 array(reg8_t,28) "unknown_224"
112 array(reg8_t,22) "unknown_176"
113 array(reg8_t,32) "unknown_256"
114 array(reg8_t,38) "unknown_304"
115 array(reg8_t,47) "unknown_376"
116 array(reg8_t,85) "unknown_680"
117 array(reg8_t,9) "unknown_72"
118 array(reg8_t,3) "unknown_24"
119 array(reg8_t,76) "unknown_608"
120 array(reg8_t,68) "unknown_544"
121 array(reg8_t,40) "unknown_320"
122 array(reg8_t,48) "unknown_384"
123 array(reg8_t,50) "unknown_400"
124 array(reg8_t,49) "unknown_392"
125 array(reg8_t,18) "unknown_144"
126 array(reg8_t,62) "unknown_496"
127 array(reg8_t,78) "unknown_624"
128 array(reg8_t,36) "unknown_288"
129 array(reg8_t,108) "unknown_864"
130 array(reg8_t,51) "unknown_408"
131 array(reg8_t,72) "unknown_576"
132 array(reg8_t,33) "unknown_264"
133 array(reg8_t,35) "unknown_280"
134 array(reg8_t,34) "unknown_272"
135 array(reg8_t,54) "unknown_432"
136 array(reg8_t,27) "unknown_216"
137 array(reg8_t,26) "unknown_208"
138 array(reg8_t,81) "unknown_648"
139 array(reg8_t,43) "unknown_344"
140 array(reg8_t,61) "unknown_488"
141 array(reg8_t,75) "unknown_600"
142 array(reg8_t,105) "unknown_840"
143 array(reg8_t,42) "unknown_336"
144 array(reg8_t,88) "unknown_704"
145 array(reg8_t,31) "unknown_248"
146 array(reg8_t,23) "unknown_184"
147 array(reg8_t,46) "unknown_368"
148 array(reg8_t,82) "unknown_656"
149 array(reg8_t,44) "unknown_352"
150 array(reg8_t,19) "unknown_152"
151 array(reg8_t,67) "unknown_536"
152 array(reg8_t,53) "unknown_424"
153 array(reg8_t,77) "unknown_616"
154 array(reg8_t,150) "unknown_1200"
155 array(reg8_t,103) "unknown_824"
156 array(reg8_t,64) "unknown_512"
157 array(reg8_t,65) "unknown_520"
158 array(reg8_t,93) "unknown_744"
159 array(reg8_t,79) "unknown_632"
160 array(reg8_t,80) "unknown_640"
161 array(reg8_t,125) "unknown_1000"
162 array(reg8_t,57) "unknown_456"
163 array(reg8_t,394) "unknown_3152"
164 array(reg8_t,66) "unknown_528"
165 array(reg8_t,69) "unknown_552"
166 array(reg8_t,109) "unknown_872"
167 array(reg8_t,166) "unknown_1328"
168 array(reg8_t,29) "unknown_232"
169 array(reg8_t,96) "unknown_768"
170 array(reg8_t,74) "unknown_592"
171 array(reg8_t,90) "unknown_720"
172 array(reg8_t,87) "unknown_696"
173 array(reg8_t,162) "unknown_1296"
174 array(reg8_t,176) "unknown_1408"
175 array(reg8_t,160) "unknown_1280"
176 array(reg8_t,84) "unknown_672"
177 array(reg8_t,60) "unknown_480"
178 array(reg8_t,83) "unknown_664"
179 array(reg8_t,71) "unknown_568"
180 array(reg8_t,147) "unknown_1176"
181 array(reg8_t,59) "unknown_472"
182 array(reg8_t,89) "unknown_712"
183 array(reg8_t,95) "unknown_760"
184 array(reg8_t,94) "unknown_752"
185 array(reg8_t,106) "unknown_848"
186 array(reg8_t,122) "unknown_976"
187 array(reg8_t,115) "unknown_920"
188 array(reg8_t,320) "unknown_2560"
189 array(reg8_t,123) "unknown_984"
190 array(reg8_t,139) "unknown_1112"
191 array(reg8_t,99) "unknown_792"
192 array(reg8_t,136) "unknown_1088"
193 array(num8_t,36) "char[36]"
194 array(num8_t,39) "char[39]"
195 array(num8_t,91) "char[91]"
196 array(num8_t,78) "char[78]"
197 array(num8_t,75) "char[75]"
198 array(num8_t,215) "char[215]"
199 array(num8_t,349) "char[349]"
200 array(num8_t,418) "char[418]"
201 array(num8_t,206) "char[206]"
202 array(num8_t,45) "char[45]"
203 array(num8_t,54) "char[54]"
204 array(num8_t,76) "char[76]"
205 array(num8_t,69) "char[69]"
206 array(num8_t,65) "char[65]"
207 array(num8_t,87) "char[87]"
208 array(num8_t,32) "char[32]"
209 array(num8_t,19) "char[19]"
210 array(num8_t,6) "char[6]"
211 array(num8_t,7) "char[7]"
212 array(num8_t,5) "char[5]"
213 array(num8_t,13) "char[13]"
214 array(num8_t,23) "char[23]"
215 array(num8_t,10) "char[10]"
216 array(num8_t,4) "char[4]"
217 array(num8_t,9) "char[9]"
218 array(num8_t,22) "char[22]"
219 array(num8_t,17) "char[17]"
220 array(num8_t,27) "char[27]"
221 array(num8_t,2) "char[2]"
222 array(num8_t,3) "char[3]"
223 array(ptr(TOP),10) "void*[10]"
224 struct(0:num32_t,4:ptr(num8_t),8:ptr(num8_t),12:ptr(num8_t),16:ptr(num8_t),20:ptr(num8_t),24:ptr(num8_t),28:ptr(num8_t),32:ptr(num8_t),36:ptr(num8_t),40:ptr(num8_t),44:ptr(num8_t),48:ptr(struct(0:ptr(TOP),4:ptr(array(reg8_t,148)),8:num32_t)),52:ptr(array(reg8_t,148)),56:num32_t,60:num32_t,64:num32_t,68:uint16_t,70:int8_t,71:array(num8_t,1),72:ptr(TOP),76:num64_t,84:ptr(TOP),88:ptr(TOP),92:ptr(TOP),96:ptr(TOP),100:uint32_t,104:num32_t,108:array(num8_t,40)) "_IO_FILE"
225 struct(0:ptr(num8_t),4:num32_t,8:ptr(num32_t),12:num32_t) "option"
226 ptr(struct(0:ptr(TOP),4:ptr(struct(0:num32_t,4:ptr(num8_t),8:ptr(num8_t),12:ptr(num8_t),16:ptr(num8_t),20:ptr(num8_t),24:ptr(num8_t),28:ptr(num8_t),32:ptr(num8_t),36:ptr(num8_t),40:ptr(num8_t),44:ptr(num8_t),48:ptr(TOP),52:ptr(TOP),56:num32_t,60:num32_t,64:num32_t,68:uint16_t,70:int8_t,71:array(num8_t,1),72:ptr(TOP),76:num64_t,84:ptr(TOP),88:ptr(TOP),92:ptr(TOP),96:ptr(TOP),100:uint32_t,104:num32_t,108:array(num8_t,40))),8:num32_t)) "_IO_marker*"
2 num32_t "__off_t"
227 uint16_t "unsigned short"
228 int8_t "signed char"
229 num64_t "__quad_t"
230 array(reg8_t,172) "unknown_1376"
231 array(num8_t,29) "char[29]"
232 array(num8_t,21) "char[21]"
233 array(num8_t,8) "char[8]"
234 array(num8_t,12) "char[12]"
235 array(reg8_t,256) "unknown_2048"
236 array(num8_t,56) "char[56]"
237 array(num8_t,14) "char[14]"
238 array(num8_t,18) "char[18]"
239 array(reg32_t,9) "dword[9]"
240 array(reg32_t,127) "dword[127]"
241 array(reg32_t,34) "dword[34]"
242 array(num8_t,16) "char[16]"
243 array(num8_t,28) "char[28]"
244 array(num8_t,20) "char[20]"
245 array(num8_t,203) "char[203]"
246 array(num8_t,40) "char[40]"
247 array(num8_t,44) "char[44]"
248 array(num8_t,48) "char[48]"
249 array(num8_t,52) "char[52]"
250 array(num8_t,60) "char[60]"
251 array(num8_t,64) "char[64]"
252 array(num8_t,47) "char[47]"
253 array(num8_t,38) "char[38]"
254 array(ptr(TOP),54) "void*[54]"
255 array(reg8_t,926) "unknown_7408"
256 array(reg8_t,10556) "unknown_84448"
257 array(reg8_t,4644) "unknown_37152"
1 code_t "(void -?-> dword)*"
258 array(reg8_t,232) "unknown_1856"
259 ptr(struct(0:reg16_t,2:num8_t)) "StructFrag_0*"
260 array(reg8_t,221) "unknown_1768"
261 array(reg8_t,223) "unknown_1784"
262 struct(0:uint32_t,4:ptr(num32_t),8:ptr(num32_t)) "re_registers"
18 ptr(num32_t) "regoff_t*"
263 struct(0:ptr(uint8_t),4:uint32_t,8:uint32_t,12:uint32_t,16:ptr(num8_t),20:ptr(uint8_t),24:uint32_t,28:uint32_t) "re_pattern_buffer"
3 uint32_t "reg_syntax_t"
264 ptr(uint8_t) "unsigned char*"
265 array(reg8_t,284) "unknown_2272"
266 array(reg8_t,1028) "unknown_8224"
| BlitzBasic | 1 | matt-noonan/retypd-data | data/ptx.decls | [
"MIT"
] |
fn part(_: u16) -> u32 {
1
}
fn main() {
for n in 100_000.. {
//~^ ERROR: literal out of range for `u16`
let _ = part(n);
}
}
| Rust | 1 | Eric-Arellano/rust | src/test/ui/issues/issue-63364.rs | [
"ECL-2.0",
"Apache-2.0",
"MIT-0",
"MIT"
] |
{layout '@layout.latte'}
{block title}Function {$function->getName()}{/block}
{block breadcrumbs}
{include "partial/breadcrumbs.latte",
"type" => "Function",
"namespace" => $function->getNamespaceName(),
"name" => $function->getShortName()
}
{/block}
{block content}
<h1 n:class="$function->isDeprecated() ? deprecated">{$function->getShortName()}</h1>
{if $function->getDescription()}
<div class="panel panel-default">
<div class="panel-body">
{$function|description}
</div>
</div>
{/if}
<div class="info">
{var $filteredAnnotations = ($function->getAnnotations()|annotationFilter: ['param', 'return', 'throws'])}
{foreach $filteredAnnotations as $annotation}
{$annotation|annotation:$function|noescape}<br>
{/foreach}
<a href="{$function|linkSource}" class="open-source-code">Open source code</a>
<br>
</div>
{var $annotations = $function->getAnnotations()}
{if count($function->getParameters())}
<table class="summary table table-responsive table-bordered table-striped" id="parameters">
<tr><th colspan="3">Parameters Summary</th></tr>
<tr n:foreach="$function->getParameters() as $parameter" id="${$parameter->getName()}">
<td class="name">
<code>
{$parameter->getTypeHint()|buildLinkIfReflectionFound}
</code>
</td>
<td class="value"><code>{block|strip}
<span class="property-name">{if $parameter->isPassedByReference()}& {/if}${$parameter->getName()}</span>
{if $parameter->isDefaultValueAvailable()} = {$parameter->getDefaultValue()|dumpDefaultValue|phpHighlight|noescape}{elseif $parameter->isVariadic()},…{/if}
{/block}</code></td>
<td>{if $parameter instanceof \ApiGen\Reflection\Contract\Reflection\Partial\AnnotationsInterface}{$parameter|description}{/if}</td>
</tr>
</table>
{/if}
{if isset($annotations['return']) && $annotations['return'][0] !== 'void'}
<table class="summary table table-responsive table-bordered table-striped" id="returns">
<tr><th>Return value Summary</th></tr>
<tr>
<td class="name">
{$annotations['return'][0]|annotation:$function|noescape}
</td>
</tr>
</table>
{/if}
{/block}
| Latte | 4 | pujak17/tets | packages/ThemeDefault/src/function.latte | [
"MIT"
] |
#\2d- {} | CSS | 0 | vjpr/swc | css/parser/tests/fixture/esbuild/misc/s6SbuS-mSQuuf1eQzngAFw/input.css | [
"Apache-2.0",
"MIT"
] |
#!/bin/bash
../../../../dist/bin/run_konan defFileDependencies -target tvos_arm64 -target tvos_x64 *.def
| Shell | 1 | Mu-L/kotlin | kotlin-native/platformLibs/src/platform/tvos/set_depends.sh | [
"ECL-2.0",
"Apache-2.0"
] |
%option reentrant
%option 8bit
%option prefix="Aql"
%option bison-locations
%option bison-bridge
%option yylineno
%option noyywrap nounput batch
%x BACKTICK
%x FORWARDTICK
%x SINGLE_QUOTE
%x DOUBLE_QUOTE
%x COMMENT_SINGLE
%x COMMENT_MULTI
%top{
#include <stdint.h>
#if (_MSC_VER >= 1)
// fix ret_val = EOB_ACT_LAST_MATCH later on, its generated, we can't control this.
#pragma warning( disable : 4267)
#endif
}
%{
#include "Basics/Common.h"
#include "Basics/NumberUtils.h"
#include "Basics/conversions.h"
#include "Basics/operating-system.h"
#if _WIN32
#include "Basics/win-utils.h"
#endif
// introduce the namespace here, otherwise following references to
// the namespace in auto-generated headers might fail
namespace arangodb {
namespace aql {
class QueryContext;
class Parser;
}
}
#include "Aql/AstNode.h"
#include "Aql/grammar.h"
#include "Aql/Functions.h"
#include "Aql/Parser.h"
#include "Aql/QueryContext.h"
#include <algorithm>
#define YY_EXTRA_TYPE arangodb::aql::Parser*
#define YY_USER_ACTION \
yylloc->first_line = static_cast<int>(yylineno); \
yylloc->first_column = static_cast<int>(yycolumn); \
yylloc->last_column = static_cast<int>(yycolumn + yyleng - 1); \
yycolumn += static_cast<int>(yyleng); \
yyextra->increaseOffset(yyleng);
#define YY_NO_INPUT 1
#define YY_INPUT(resultBuffer, resultState, maxBytesToRead) { \
size_t length = std::min(yyextra->remainingLength(), static_cast<size_t>(maxBytesToRead)); \
if (length > 0) { \
yyextra->fillBuffer(resultBuffer, length); \
resultState = length; \
} else { \
resultState = YY_NULL; \
} \
}
%}
%%
/* ---------------------------------------------------------------------------
* language keywords
* --------------------------------------------------------------------------- */
(?i:FOR) {
return T_FOR;
}
(?i:LET) {
return T_LET;
}
(?i:FILTER) {
return T_FILTER;
}
(?i:RETURN) {
return T_RETURN;
}
(?i:COLLECT) {
return T_COLLECT;
}
(?i:SORT) {
return T_SORT;
}
(?i:LIMIT) {
return T_LIMIT;
}
(?i:WINDOW) {
return T_WINDOW;
}
(?i:DISTINCT) {
return T_DISTINCT;
}
(?i:AGGREGATE) {
return T_AGGREGATE;
}
(?i:ASC) {
return T_ASC;
}
(?i:DESC) {
return T_DESC;
}
(?i:NOT) {
return T_NOT;
}
(?i:AND) {
return T_AND;
}
(?i:OR) {
return T_OR;
}
(?i:IN) {
return T_IN;
}
(?i:INTO) {
return T_INTO;
}
(?i:WITH) {
return T_WITH;
}
(?i:REMOVE) {
return T_REMOVE;
}
(?i:INSERT) {
return T_INSERT;
}
(?i:UPDATE) {
return T_UPDATE;
}
(?i:REPLACE) {
return T_REPLACE;
}
(?i:UPSERT) {
return T_UPSERT;
}
(?i:GRAPH) {
return T_GRAPH;
}
(?i:SHORTEST_PATH) {
return T_SHORTEST_PATH;
}
(?i:K_SHORTEST_PATHS) {
return T_K_SHORTEST_PATHS;
}
(?i:K_PATHS) {
return T_K_PATHS;
}
(?i:OUTBOUND) {
return T_OUTBOUND;
}
(?i:INBOUND) {
return T_INBOUND;
}
(?i:ANY) {
return T_ANY;
}
(?i:ALL) {
return T_ALL;
}
(?i:NONE) {
return T_NONE;
}
(?i:LIKE) {
return T_LIKE;
}
/* ---------------------------------------------------------------------------
* predefined type literals
* --------------------------------------------------------------------------- */
(?i:NULL) {
return T_NULL;
}
(?i:TRUE) {
return T_TRUE;
}
(?i:FALSE) {
return T_FALSE;
}
/* ---------------------------------------------------------------------------
* operators
* --------------------------------------------------------------------------- */
"=~" {
return T_REGEX_MATCH;
}
"!~" {
return T_REGEX_NON_MATCH;
}
"==" {
return T_EQ;
}
"!=" {
return T_NE;
}
">=" {
return T_GE;
}
">" {
return T_GT;
}
"<=" {
return T_LE;
}
"<" {
return T_LT;
}
"=" {
return T_ASSIGN;
}
"!" {
return T_NOT;
}
"&&" {
return T_AND;
}
"||" {
return T_OR;
}
"+" {
return T_PLUS;
}
"-" {
return T_MINUS;
}
"*" {
return T_TIMES;
}
"/" {
return T_DIV;
}
"%" {
return T_MOD;
}
"?" {
return T_QUESTION;
}
"::" {
return T_SCOPE;
}
":" {
return T_COLON;
}
".." {
return T_RANGE;
}
/* ---------------------------------------------------------------------------
* punctuation
* --------------------------------------------------------------------------- */
"," {
return T_COMMA;
}
"(" {
return T_OPEN;
}
")" {
return T_CLOSE;
}
"{" {
return T_OBJECT_OPEN;
}
"}" {
return T_OBJECT_CLOSE;
}
"[" {
return T_ARRAY_OPEN;
}
"]" {
return T_ARRAY_CLOSE;
}
/* ---------------------------------------------------------------------------
* identifiers
* --------------------------------------------------------------------------- */
(($?|_+)[a-zA-Z]+[_a-zA-Z0-9]*) {
/* unquoted string */
yylval->strval.value = yyextra->ast()->resources().registerString(yytext, yyleng);
yylval->strval.length = yyleng;
return T_STRING;
}
<INITIAL>` {
/* string enclosed in backticks */
yyextra->marker(yyextra->queryStringStart() + yyextra->offset());
BEGIN(BACKTICK);
}
<BACKTICK>` {
/* end of backtick-enclosed string */
BEGIN(INITIAL);
size_t outLength;
yylval->strval.value = yyextra->ast()->resources().registerEscapedString(yyextra->marker(), yyextra->offset() - (yyextra->marker() - yyextra->queryStringStart()) - 1, outLength);
yylval->strval.length = outLength;
return T_STRING;
}
<BACKTICK>\\. {
/* character escaped by backslash */
}
<BACKTICK>\n {
/* newline character inside backtick */
}
<BACKTICK><<EOF>> {
auto parser = yyextra;
parser->registerParseError(TRI_ERROR_QUERY_PARSE, "unexpected unterminated identifier", yylloc->first_line, yylloc->first_column);
}
<BACKTICK>. {
/* any character (except newline) inside backtick */
}
<INITIAL>´ {
/* string enclosed in forwardticks */
yyextra->marker(yyextra->queryStringStart() + yyextra->offset());
BEGIN(FORWARDTICK);
}
<FORWARDTICK>´ {
/* end of forwardtick-enclosed string */
BEGIN(INITIAL);
size_t outLength;
yylval->strval.value = yyextra->ast()->resources().registerEscapedString(yyextra->marker(), yyextra->offset() - (yyextra->marker() - yyextra->queryStringStart()) - 2, outLength);
yylval->strval.length = outLength;
return T_STRING;
}
<FORWARDTICK>\\. {
/* character escaped by backslash */
}
<FORWARDTICK>\n {
/* newline character inside forwardtick */
}
<FORWARDTICK><<EOF>> {
auto parser = yyextra;
parser->registerParseError(TRI_ERROR_QUERY_PARSE, "unexpected unterminated identifier", yylloc->first_line, yylloc->first_column);
}
<FORWARDTICK>. {
/* any character (except newline) inside forwardtick */
}
/* ---------------------------------------------------------------------------
* strings
* --------------------------------------------------------------------------- */
<INITIAL>\" {
yyextra->marker(yyextra->queryStringStart() + yyextra->offset());
BEGIN(DOUBLE_QUOTE);
}
<DOUBLE_QUOTE>\" {
/* end of quote-enclosed string */
BEGIN(INITIAL);
size_t outLength;
yylval->strval.value = yyextra->ast()->resources().registerEscapedString(yyextra->marker(), yyextra->offset() - (yyextra->marker() - yyextra->queryStringStart()) - 1, outLength);
yylval->strval.length = outLength;
return T_QUOTED_STRING;
}
<DOUBLE_QUOTE>\\. {
/* character escaped by backslash */
}
<DOUBLE_QUOTE>\n {
/* newline character inside quote */
}
<DOUBLE_QUOTE><<EOF>> {
auto parser = yyextra;
parser->registerParseError(TRI_ERROR_QUERY_PARSE, "unexpected unterminated string literal", yylloc->first_line, yylloc->first_column);
}
<DOUBLE_QUOTE>. {
/* any character (except newline) inside quote */
}
<INITIAL>' {
yyextra->marker(yyextra->queryStringStart() + yyextra->offset());
BEGIN(SINGLE_QUOTE);
}
<SINGLE_QUOTE>' {
/* end of quote-enclosed string */
BEGIN(INITIAL);
size_t outLength;
yylval->strval.value = yyextra->ast()->resources().registerEscapedString(yyextra->marker(), yyextra->offset() - (yyextra->marker() - yyextra->queryStringStart()) - 1, outLength);
yylval->strval.length = outLength;
return T_QUOTED_STRING;
}
<SINGLE_QUOTE>\\. {
/* character escaped by backslash */
}
<SINGLE_QUOTE>\n {
/* newline character inside quote */
}
<SINGLE_QUOTE><<EOF>> {
auto parser = yyextra;
parser->registerParseError(TRI_ERROR_QUERY_PARSE, "unexpected unterminated string literal", yylloc->first_line, yylloc->first_column);
}
<SINGLE_QUOTE>. {
/* any character (except newline) inside quote */
}
/* ---------------------------------------------------------------------------
* number literals
* --------------------------------------------------------------------------- */
(0|[1-9][0-9]*) {
/* a numeric integer value, base 10 (decimal) */
arangodb::aql::AstNode* node = nullptr;
auto parser = yyextra;
bool valid;
int64_t value1 = arangodb::NumberUtils::atoi<int64_t>(yytext, yytext + yyleng, valid);
if (valid) {
node = parser->ast()->createNodeValueInt(value1);
} else {
// TODO: use std::from_chars
double value2 = TRI_DoubleString(yytext);
if (TRI_errno() != TRI_ERROR_NO_ERROR) {
parser->registerWarning(TRI_ERROR_QUERY_NUMBER_OUT_OF_RANGE, TRI_errno_string(TRI_ERROR_QUERY_NUMBER_OUT_OF_RANGE), yylloc->first_line, yylloc->first_column);
node = parser->ast()->createNodeValueNull();
} else {
node = parser->ast()->createNodeValueDouble(value2);
}
}
yylval->node = node;
return T_INTEGER;
}
(0[bB][01]+) {
/* a numeric integer value, base 2 (binary) */
/* note that we support an arbitrary run of leading zeroes for the actual number */
/* cut off first 2 characters */
char const* p = yytext + 2;
char const* e = yytext + yyleng;
auto parser = yyextra;
if (static_cast<uint64_t>(e - p) > arangodb::aql::Functions::bitFunctionsMaxSupportedBits) {
/* we only support up to 32 bits for now */
parser->registerParseError(TRI_ERROR_QUERY_PARSE, "binary number literal value exceeds the supported range", yylloc->first_line, yylloc->first_column);
}
uint64_t result = 0;
while (p != e) {
char c = *p;
if (c == '1') {
/* only the 1s are interesting for us */
result += (static_cast<uint64_t>(1) << (e - p - 1));
}
++p;
}
TRI_ASSERT(result <= UINT32_MAX);
arangodb::aql::AstNode* node = parser->ast()->createNodeValueInt(static_cast<int64_t>(result));
yylval->node = node;
return T_INTEGER;
}
(0[xX][0-9a-fA-F]+) {
/* a numeric integer value, base 16 (hexadecimal) */
/* note that we support an arbitrary run of leading zeroes for the actual number */
/* cut off first 2 characters */
char const* p = yytext + 2;
char const* e = yytext + yyleng;
auto parser = yyextra;
/* each digit 0-9a-f carries 4 bits of information */
if (static_cast<uint64_t>(e - p) > arangodb::aql::Functions::bitFunctionsMaxSupportedBits / 4) {
/* we only support up to 32 bits for now */
parser->registerParseError(TRI_ERROR_QUERY_PARSE, "hex number literal value exceeds the supported range", yylloc->first_line, yylloc->first_column);
}
uint64_t result = 0;
while (p != e) {
uint8_t v;
char c = *p;
if (c >= 'A' && c <= 'F') {
v = c - 'A' + 10;
} else if (c >= 'a' && c <= 'f') {
v = c - 'a' + 10;
} else {
v = c - '0';
}
result += (static_cast<uint64_t>(v) << (4 * (e - p - 1)));
++p;
}
TRI_ASSERT(result <= UINT32_MAX);
arangodb::aql::AstNode* node = parser->ast()->createNodeValueInt(static_cast<int64_t>(result));
yylval->node = node;
return T_INTEGER;
}
((0|[1-9][0-9]*)(\.[0-9]+)?|\.[0-9]+)([eE][\-\+]?[0-9]+)? {
/* a numeric double value, base 10 (decimal) */
arangodb::aql::AstNode* node = nullptr;
auto parser = yyextra;
// TODO: use std::from_chars
double value = TRI_DoubleString(yytext);
if (TRI_errno() != TRI_ERROR_NO_ERROR) {
parser->registerWarning(TRI_ERROR_QUERY_NUMBER_OUT_OF_RANGE, TRI_errno_string(TRI_ERROR_QUERY_NUMBER_OUT_OF_RANGE), yylloc->first_line, yylloc->first_column);
node = parser->ast()->createNodeValueNull();
} else {
node = parser->ast()->createNodeValueDouble(value);
}
yylval->node = node;
return T_DOUBLE;
}
/* ---------------------------------------------------------------------------
* bind parameters
* --------------------------------------------------------------------------- */
@(_+[a-zA-Z0-9]+[a-zA-Z0-9_]*|[a-zA-Z0-9][a-zA-Z0-9_]*) {
/* bind parameters must start with a @
if followed by another @, this is a collection name or a view name parameter */
yylval->strval.value = yyextra->ast()->resources().registerString(yytext + 1, yyleng - 1);
yylval->strval.length = yyleng - 1;
return T_PARAMETER;
}
/* ---------------------------------------------------------------------------
* bind data source parameters
* --------------------------------------------------------------------------- */
@@(_+[a-zA-Z0-9]+[a-zA-Z0-9_]*|[a-zA-Z0-9][a-zA-Z0-9_]*) {
/* bind parameters must start with a @
if followed by another @, this is a collection name or a view name parameter */
yylval->strval.value = yyextra->ast()->resources().registerString(yytext + 1, yyleng - 1);
yylval->strval.length = yyleng - 1;
return T_DATA_SOURCE_PARAMETER;
}
/* ---------------------------------------------------------------------------
* whitespace etc.
* --------------------------------------------------------------------------- */
[ \t\r]+ {
/* whitespace is ignored */
}
[\n] {
yycolumn = 0;
}
/* ---------------------------------------------------------------------------
* comments
* --------------------------------------------------------------------------- */
<INITIAL>"//" {
BEGIN(COMMENT_SINGLE);
}
<COMMENT_SINGLE>\n {
/* line numbers are counted elsewhere already */
yycolumn = 0;
BEGIN(INITIAL);
}
<COMMENT_SINGLE>[^\n]+ {
/* everything else */
}
<INITIAL>"/*" {
BEGIN(COMMENT_MULTI);
}
<COMMENT_MULTI>"*/" {
BEGIN(INITIAL);
}
<COMMENT_MULTI>[^*\n]+ {
// eat comment in chunks
}
<COMMENT_MULTI>"*" {
// eat the lone star
}
<COMMENT_MULTI><<EOF>> {
auto parser = yyextra;
parser->registerParseError(TRI_ERROR_QUERY_PARSE, "unexpected unterminated multi-line comment", yylloc->first_line, yylloc->first_column);
}
<COMMENT_MULTI>\n {
/* line numbers are counted elsewhere already */
yycolumn = 0;
}
. {
/* anything else is returned as it is */
return (int) yytext[0];
}
%%
| LLVM | 5 | elfringham/arangodb | arangod/Aql/tokens.ll | [
"BSL-1.0",
"Apache-2.0"
] |
" Vim syntax file
" Language: DNS/BIND Zone File
" This has been replaced by the bindzone syntax
:runtime! syntax/bindzone.vim
| VimL | 2 | uga-rosa/neovim | runtime/syntax/dns.vim | [
"Vim"
] |
/* IP Group Telephony system based around prior art in Her Yeri Parlak
Named after a minor artifact in Soyutlanma, and before that from Turkish
"burdayım" = "I am here", this allows a moderate number of people to
communicate on a global channel, while a small number of people (or several
such groups) communicate on private channels.
Timing: All packets get usec time incorporated. On receipt, calculate offset:
your_time() - packet time
This value is the sum of two unknown quantities: the transmission latency
and the clock difference between the two computers. We assume that the clock
difference is an approximately stable quantity, and we can be confident that
the latency is a nonnegative value. Therefore we take the lowest total ever
seen and take that to be the clock offset. (Closest to negative infinity,
not closest to zero; the clock offset could be either direction.)
Having established a "best ever seen" offset, we assume that the current
packet's offset exceeds that best by a value representing only the latency.
As such, we can now discard any packets with latency in excess of some
predetermined value (eg 1500ms). In the face of clock errors or other time
discrepancies, this will either cope smoothly (if the clock offset is
lowered permanently and stably), or cause the audio to be muted (if the
offset increases permanently) or intermittent (if it fluctuates). Anyone who
hears silence can bounce the receiver to reset all time offsets and force a
recalculation; the fluctuating time issue is fundamentally unresolvable, and
the only solution is to have a latency window that exceeds the fluctuation.
The upshot of this is that the clock used does not actually need to have any
correlation to wall time. It doesn't even have to be consistent across nodes
in the group! Implementations are encouraged to use a monotonic clock if one
is available.
CJA 20170506: It appears that latency, even on a cheap pocket wifi device,
averages 1-2ms. So it would not be all that unreasonable to drop packets
aggressively - even at 10ms, and definitely at 25ms. Forget 1500ms! :)
TODO: Listen for "Squelch" messages. If the recipient detects latency in
excess of its limit in TCP mode, send a squelch back to the sender, asking
for no further transmissions for that many usec. Upon receipt of such a
message, the sender records its current clock plus the squelch time, and
flags that one recipient as "squelched until X". Any squelched clients
simply don't receive traffic.
*/
constant ADDR = "224.0.0.1"; //Multicast address: All hosts on current network.
constant PORT = 5170;
constant audio_format = ({"-t", "raw", "-f", "s16_le", "-r", "12000", "-B", "20000"});
Stdio.UDP|array(Stdio.UDP) udp = Stdio.UDP()->bind(PORT, "0.0.0.0", 1); //NOTE: *Not* enabling IPv6; this app is v4-only.
array(string) ips;
string sendchannel = "global";
array(string) recvchannels;
string transmitmode = "udp"; //or "tcp"
Stdio.Port mainsock; //Only if transmitmode=="tcp"
array(Stdio.File) tcpsocks = ({ });
constant TCP_PACKET_SIZE = 512;
void ignore() { } //Ignore anything they send us.
void accepttcp()
{
object sock = mainsock->accept();
sock->set_nonblocking(ignore, 0, lambda() {tcpsocks -= ({sock});});
tcpsocks += ({sock});
}
class Sender(string ip)
{
int expectseq;
float active;
int offset = UNDEFINED;
Stdio.File pipe;
Stdio.File sock;
string tcpbuf = "";
void create()
{
write("New voice on comms: %s\n", ip);
Process.create_process(({"aplay"}) + audio_format, ([
"stdin": (pipe = Stdio.File())->pipe(),
]));
}
void sockread(mixed id, string data)
{
tcpbuf += data;
if (sizeof(tcpbuf) < TCP_PACKET_SIZE) return; //Can't possibly have a full packet
int pktlen = search(tcpbuf, '\n') + TCP_PACKET_SIZE;
if (sizeof(tcpbuf) < TCP_PACKET_SIZE) return; //Don't have the headers and a packet's worth of data
data = tcpbuf[..pktlen]; tcpbuf = tcpbuf[pktlen+1..];
handle_packet(data, this); //TODO: Bring handle_packet in as a method
}
void sockgone() {sock = 0;}
void establish_tcp()
{
//Establish a TCP connection, since this sender doesn't broadcast
//its content via UDP.
if (sock) return;
write("Connecting to %s via TCP...\n", ip);
sock = Stdio.File(); sock->open_socket();
sock->set_nonblocking(sockread, 0, sockgone);
sock->connect(ip, PORT);
}
}
mapping(string:object) senders = ([]);
int basetime = time();
mapping(string:int) packetcount = ([]);
void showcounts() {write("%O\n", packetcount); packetcount = ([]); call_out(showcounts, 30);}
string lastsend;
string sendbuf = "";
int sequence;
void send(mixed id, string data)
{
sendbuf += data;
if (transmitmode == "tcp")
{
//In TCP mode, we always chunk to exactly TCP_PACKET_SIZE bytes.
if (sizeof(sendbuf) < TCP_PACKET_SIZE) return;
data = sendbuf[..TCP_PACKET_SIZE-1]; sendbuf = sendbuf[TCP_PACKET_SIZE..];
}
else
{
//In UDP mode, we send whatever we have, because a packet is a packet.
//if (sizeof(sendbuf) < 512) return; //Always send good-sized packets, to reduce packet collisions (doesn't seem to help)
//PROTECTION: Always send an even number of bytes. This is probably never
//going to trigger, but if we ever do get an odd number of bytes, it'd be
//possible for a lost UDP packet to leave us mismatched.
//TODO: Measure this based on the audio_format above.
if (sizeof(sendbuf) & 1) {data = sendbuf[..<1]; sendbuf = sendbuf[<0..];}
else {data = sendbuf; sendbuf = "";}
}
if (sendchannel != lastsend) write("Now sending on %O\n", lastsend = sendchannel);
packetcount["sent"]++;
packetcount["sentbytes"] += sizeof(data);
if (sendchannel != "")
{
string packet = sprintf("T%d C%s Q%d\n%s", gethrtime(), sendchannel, ++sequence, data);
if (transmitmode == "tcp")
tcpsocks->write(packet);
else
udp->send(ADDR, PORT, packet, 2);
}
string line = "";
float cutoff = time(basetime) - 0.5;
foreach (sort(indices(senders)), string ip)
if (senders[ip]->active > cutoff) line += " " + ip;
write(line + "\e[K\r");
}
void beacon()
{
//When transmitting on TCP, we send out a UDP beacon periodically.
//TCP mode uses significantly more packets per second than UDP
//(with the possible exception that UDP might send smaller packets;
//certainly more than UDP with an equivalent minimum packet payload),
//but by maintaining a retry loop in low level kernel facilities
//rather than using an application-level retry, we hopefully gain
//enough to make it worthwhile.
call_out(beacon, 1);
udp->send(ADDR, PORT, "Beacon", 2);
}
void recv(mapping(string:int|string) info)
{
string ip = info->ip;
packetcount[""]++;
if (info->port != PORT) return; //Not from one of us.
object sender = senders[ip];
if (!sender) senders[ip] = sender = Sender(ip);
packetcount[ip]++;
if (sscanf(info->data, "RESEND %d", int wantseq) && wantseq)
{
//Resend request.
write("RESEND REQUEST - want %d, we last sent %d\n", wantseq, sequence);
packetcount["resend ofs " + (sequence - wantseq)/10]++;
return;
}
if (info->data == "Beacon")
{
//The other end is asking us to connect via TCP. Let's oblige.
sender->establish_tcp();
return;
}
handle_packet(info->data, sender);
}
void handle_packet(string packet, Sender sender)
{
string ip = sender->ip;
//NOTE: Currently the packet format is strict, but it's designed to be able to be
//more intelligently parsed in the future, with space-delimited tokens and marker
//letters, ending with a newline before the payload. (The payload is binary data,
//which normally will be an audio blob; the header is ASCII text. Maybe UTF-8.)
sscanf(packet, "T%d C%s Q%d\n%s", int packettime, string chan, int seq, string(0..255) data);
if (!data) return; //Packet not in correct format.
if (has_value(ips, ip)) chan = "_" + chan; //Normally ignore our loopback
int expect = sender->expectseq || seq;
if (seq < expect) werror("WARNING: %s seq non-monotonic! %d expected %d\n", ip, seq, expect);
else if (seq == expect + 1)
{
packetcount[ip + " dropped"]++;
//Not currently sending resend requests (they always arrive too late)
//udp->send(ip, PORT, "RESEND " + sender->expectseq, 2);
}
else if (seq > expect) packetcount[ip + " gap " + (seq - expect)]++;
sender->expectseq = seq + 1;
packetcount[ip + " bytes"] += sizeof(data);
if (!has_value(recvchannels, chan)) return; //Was sent to a channel we don't follow.
int offset = gethrtime() - packettime;
int lastofs = sender->offset;
if (undefinedp(lastofs) || offset < lastofs) sender->offset = lastofs = offset;
int lag = offset - lastofs;
if (lag > 50000) {werror("%s: lag %d usec\n", ip, lag); return;} //Too old? Drop it.
packetcount[ip + " lag " + (lag/10000) + "0ms"]++;
sender->active = time(basetime);
sender->pipe->write(data);
packetcount["written"]++;
}
mapping(string:GTK2.Widget) win = ([]);
//Persistent configs
mapping(string:string|array|mapping) config = ([
"normchan": "", "pttchan": "global",
"recvchan": "global",
]);
void saveconfig() {Stdio.write_file(".burdayimrc", Standards.JSON.encode(config));}
void loadconfig() {catch {config = Standards.JSON.decode(Stdio.read_file(".burdayimrc")) || config;};}
void sig_mainwindow_delete_event() {exit(0);}
void sig_norm_global_clicked() {win->norm_channel->set_text("global");}
void sig_norm_mute_clicked() {win->norm_channel->set_text("");}
void sig_ptt_global_clicked() {win->ptt_channel->set_text("global");}
void sig_ptt_mute_clicked() {win->ptt_channel->set_text("");}
void sig_norm_channel_changed() {checkchan("norm");}
void sig_ptt_channel_changed() {checkchan("ptt");}
void checkchan(string mode)
{
string chan = config[mode + "chan"] = win[mode + "_channel"]->get_text();
object glob = chan == "global" ? win->highlight : UNDEFINED;
object mute = chan == "" ? win->highlight : UNDEFINED;
foreach (({GTK2.STATE_NORMAL, GTK2.STATE_ACTIVE, GTK2.STATE_SELECTED, GTK2.STATE_PRELIGHT}), int state)
{
win[mode + "_global"]->modify_bg(GTK2.STATE_NORMAL, glob);
win[mode + "_mute"]->modify_bg(GTK2.STATE_NORMAL, mute);
}
saveconfig();
}
void sig_recv_channels_changed()
{
//TODO: Also populate some sort of list of destination channels.
//This would allow the SM to receive a large number of low-traffic
//channels (eg FOH, Techs, etc), and use them for occasional calls
//only (and the other people on the channel wouldn't have global).
config->recvchan = win->recv_channels->get_text();
recvchannels = (config->recvchan - " ") / ",";
saveconfig();
}
int sig_b4_mainwindow_key_press_event(object self, object ev)
{
if (ev->keyval != 32) return 0;
sendchannel = config->pttchan;
return 1;
}
int sig_b4_mainwindow_key_release_event(object self, object ev)
{
if (ev->keyval != 32) return 0;
sendchannel = config->normchan;
return 1;
}
int main(int argc, array(string) argv)
{
call_out(showcounts, 30);
loadconfig();
udp->set_read_callback(recv);
ips = sort(values(Stdio.gethostip())->ips * ({ }));
if (argc > 1 && has_value(ips, argv[1])) ips = ({argv[1]});
write("My IP: %s\n", ips * " + ");
//We pick the first one (after sorting textually) to be our identity.
//Since we listen on every available IP, this won't majorly hurt,
//and the sort ensures that it's stable, if a little arbitrary.
//Most computers will have just one IP anyway, so none of this matters.
udp->enable_multicast(ips[0]);
udp->add_membership(ADDR);
if (has_value(argv, "--send-all"))
{
//To avoid craziness in a multi-network situation, send via
//every available IP address, not just the default. Note that
//this can cause split-brain situations if there are actually
//multiple networks using the cans, but otherwise, it means
//you don't have to explicitly pick an IP or interface.
udp = ({udp});
foreach (ips[1..], string ip)
{
udp += ({Stdio.UDP()->bind(PORT)});
udp[-1]->enable_multicast(ip);
}
}
if (has_value(argv, "--tcp"))
{
//Switch to TCP transmission with UDP handshake.
//Probably not compatible with --send-all (untested).
transmitmode = "tcp";
call_out(beacon, 0.01);
mainsock = Stdio.Port(PORT, accepttcp); //Note, again, IPv4 only.
}
GTK2.setup_gtk();
win->highlight = GTK2.GdkColor(0, 255, 255);
win->mainwindow = GTK2.Window((["title": "Burdayim"]))->add(GTK2.Vbox(0, 10)
->add(GTK2.Frame("Receive channels (commas to separate)")
->add(win->recv_channels = GTK2.Entry()->set_text(config->recvchan))
)
->add(GTK2.Hbox(0, 10)
->add(GTK2.Frame("Normal channel")->add(GTK2.Vbox(0, 10)
->add(win->norm_channel = GTK2.Entry()->set_text(config->normchan))
->add(GTK2.HbuttonBox()
->add(win->norm_global = GTK2.Button("Global"))
->add(win->norm_mute = GTK2.Button("Mute"))
)
))
->add(GTK2.Frame("Push-to-talk channel")->add(GTK2.Vbox(0, 10)
->add(win->ptt_channel = GTK2.Entry()->set_text(config->pttchan))
->add(GTK2.HbuttonBox()
->add(win->ptt_global = GTK2.Button("Global"))
->add(win->ptt_mute = GTK2.Button("Mute"))
)
))
)
)->show_all();
checkchan("norm"); checkchan("ptt"); sig_recv_channels_changed();
sendchannel = config->normchan;
//Lifted and simplified from Gypsum's collect_signals
foreach (indices(this), string key) if (has_prefix(key, "sig_") && callablep(this[key]))
{
//Function names of format sig_x_y become a signal handler for win->x signal y.
//(Note that classes are callable, so they can be used as signal handlers too.)
//This may pose problems, as it's possible for x and y to have underscores in
//them, so we scan along and find the shortest such name that exists in win[].
//If there's none, ignore the callable (currently without any error or warning,
//despite the explicit prefix). This can create ambiguities, but only in really
//contrived situations, so I'm deciding not to care. :)
array parts=(key/"_")[1..];
int b4=(parts[0]=="b4"); if (b4) parts=parts[1..]; //sig_b4_some_object_some_signal will connect _before_ the normal action
for (int i=0;i<sizeof(parts)-1;++i) if (mixed obj = win[parts[..i]*"_"])
{
if (objectp(obj) && callablep(obj->signal_connect))
{
obj->signal_connect(parts[i+1..]*"_", this[key], UNDEFINED, UNDEFINED, b4);
break;
}
}
}
Stdio.File recorder = Stdio.File();
Process.create_process(({"arecord"}) + audio_format, ([
"stdin": Stdio.File("/dev/null"), "stdout": recorder->pipe(),
"callback": lambda() {exit(0);},
]));
recorder->set_read_callback(send);
return -1;
}
| Pike | 5 | stephenangelico/shed | burdayim.pike | [
"MIT"
] |
/**
Copyright 2015 Acacia Team
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package org.acacia.rdf.sparql;
import x10.util.HashMap;
import x10.util.ArrayList;
import x10.util.Map;
import x10.util.HashSet;
public class InferenceHandler {
private var ifInferenceHandled:Boolean=false;
public def getInferenceHnadledTriples(var inferenceData:HashMap[String, ArrayList[String]], var triples:ArrayList[Rail[String]], var nodeStore:HashMap[Long, HashSet[String]] ):ArrayList[Rail[String]]{
var tokens:Rail[String] = null;
var inferenceHandledTriples:ArrayList[Rail[String]] = new ArrayList[Rail[String]]();
var newTokens:ArrayList[String];
var key:String = null;
var newToken:String = null;
var flag:Int = 0n;
var index:Int = 0n;
for(var i:Int = 0n; i < triples.size(); i++){
tokens = new Rail[String](3);
tokens = triples.get(i);
//type inference
if(tokens(1).indexOf("type") > 0){
key = tokens(2).substring(tokens(2).indexOf(":")+1n);
var itr1:Iterator[Map.Entry[Long, HashSet[String]]] = nodeStore.entries().iterator();
while(itr1.hasNext()){
var entry:Map.Entry[Long, HashSet[String]] = itr1.next();
if(entry.getValue().toString().indexOf(tokens(2)) > 0){
flag = 1n;
break;
}
}
if(flag == 0n){
if(inferenceData.containsKey(key.substring(key.indexOf("#")+1n))){
var itr:Iterator[Map.Entry[String, ArrayList[String]]] = inferenceData.entries().iterator();
newTokens = new ArrayList[String]();
while(itr.hasNext()){
var entry:Map.Entry[String, ArrayList[String]] = itr.next();
if(entry.getKey().equals(key.substring(key.indexOf("#")+1n))){
newTokens = entry.getValue();
break;
}
}
if(newTokens.size() > 0){
ifInferenceHandled = true;
for(var j:Int = 0n; j < newTokens.size(); j++){
newToken = tokens(2).substring(0n, tokens(2).indexOf("#")+1n)+newTokens.get(j);
tokens(2) = newToken;
inferenceHandledTriples.addBefore(index, tokens);
index = index + 1n;
}
}
}else{
inferenceHandledTriples.addBefore(index,tokens);
index = index + 1n;
}
} else {
inferenceHandledTriples.addBefore(index, tokens);
index = index + 1n;
}
}else{
inferenceHandledTriples.addBefore(index, tokens);
index = index + 1n;
}
}
return inferenceHandledTriples;
}
public def getIfInferenceHandled():Boolean{
return ifInferenceHandled;
}
} | X10 | 3 | mdherath/Acacia | src/org/acacia/rdf/sparql/InferenceHandler.x10 | [
"Apache-2.0"
] |
resource "aws_instance" "webserver_backend" {
count = length(var.availability_zones)
ami = "${data.aws_ami.ubuntu.id}"
instance_type = "t2.micro"
subnet_id = "${aws_subnet.test_elb[count.index].id}"
user_data = "${data.local_file.install_webserver.content}"
associate_public_ip_address = true
vpc_security_group_ids = [
"${aws_security_group.allow_http.id}",
]
}
data "aws_ami" "ubuntu" {
most_recent = true
filter {
name = "name"
values = ["ubuntu/images/hvm-ssd/ubuntu-bionic-18.04-amd64-server-*"]
}
filter {
name = "virtualization-type"
values = ["hvm"]
}
owners = ["099720109477"] # Canonical
}
provider "local" {
version = "~> 1.4"
}
data "local_file" "install_webserver" {
filename = "./install_webserver.sh"
}
| HCL | 4 | tetianakravchenko/beats | x-pack/filebeat/module/aws/elb/_meta/terraform/instance.tf | [
"ECL-2.0",
"Apache-2.0"
] |
double precision function dqwgts(x,a,b,alfa,beta,integr)
c***begin prologue dqwgts
c***refer to dqk15w
c***routines called (none)
c***revision date 810101 (yymmdd)
c***keywords weight function, algebraico-logarithmic
c end-point singularities
c***author piessens,robert,appl. math. & progr. div. - k.u.leuven
c de doncker,elise,appl. math. & progr. div. - k.u.leuven
c***purpose this function subprogram is used together with the
c routine dqaws and defines the weight function.
c***end prologue dqwgts
c
double precision a,alfa,b,beta,bmx,dlog,x,xma
integer integr
c***first executable statement dqwgts
xma = x-a
bmx = b-x
dqwgts = xma**alfa*bmx**beta
go to (40,10,20,30),integr
10 dqwgts = dqwgts*dlog(xma)
go to 40
20 dqwgts = dqwgts*dlog(bmx)
go to 40
30 dqwgts = dqwgts*dlog(xma)*dlog(bmx)
40 return
end
| FORTRAN | 4 | Ennosigaeon/scipy | scipy/integrate/quadpack/dqwgts.f | [
"BSD-3-Clause"
] |
module Main where
import Prelude
import Effect.Console (log)
import Test.Assert (assert)
import Foo as Foo.Bar
main = do
assert $ 4 Foo.Bar.-#- 10 == 33
assert $ Foo.Bar.(-#-) 4 10 == 33
log "Done"
| PureScript | 3 | andys8/purescript | tests/purs/passing/QualifiedOperators.purs | [
"BSD-3-Clause"
] |
"""Diagnostics support for Nanoleaf."""
from __future__ import annotations
from aionanoleaf import Nanoleaf
from homeassistant.components.diagnostics import async_redact_data
from homeassistant.config_entries import ConfigEntry
from homeassistant.const import CONF_TOKEN
from homeassistant.core import HomeAssistant
from .const import DOMAIN
async def async_get_config_entry_diagnostics(
hass: HomeAssistant,
config_entry: ConfigEntry,
) -> dict:
"""Return diagnostics for a config entry."""
device: Nanoleaf = hass.data[DOMAIN][config_entry.entry_id].device
return {
"info": async_redact_data(config_entry.as_dict(), (CONF_TOKEN, "title")),
"data": {
"brightness_max": device.brightness_max,
"brightness_min": device.brightness_min,
"brightness": device.brightness,
"color_mode": device.color_mode,
"color_temperature_max": device.color_temperature_max,
"color_temperature_min": device.color_temperature_min,
"color_temperature": device.color_temperature,
"effect": device.effect,
"effects_list": device.effects_list,
"firmware_version": device.firmware_version,
"hue_max": device.hue_max,
"hue_min": device.hue_min,
"hue": device.hue,
"is_on": device.is_on,
"manufacturer": device.manufacturer,
"port": device.port,
"saturation_max": device.saturation_max,
"saturation_min": device.saturation_min,
"saturation": device.saturation,
"serial_no": device.serial_no,
},
}
| Python | 4 | MrDelik/core | homeassistant/components/nanoleaf/diagnostics.py | [
"Apache-2.0"
] |
scriptname PN_NeedsManager extends Quest
; PRIVATE VARIABLES -------------------------------------------------------------------------------
; Time in game hours
float _curTime = 0.0
float _lastIncreaseTime = 0.0
; Timers in real seconds
float _hungerSoundTimer = 0.0
float _thirstSoundTimer = 0.0
float _fatigueSoundTimer = 0.0
float _soundCooldownTimer = 0.0
; Current HTF states
int _hunger = 0
int _thirst = 0
int _fatigue = 0
int _lastHunger = -1
int _lastThirst = -1
int _lastFatigue = -1
; Penalty levels (0=none)
int _hungerLevel = 0
int _thirstLevel = 0
int _fatigueLevel = 0
; Sleep tracking
float _sleepStartTime
float _sleepEndTime
int _sleepDuration
; PROPERTIES --------------------------------------------------------------------------------------
int property HungerPercent
int function get()
return Lerp(0, 100, HungerWarnThreshold, HungerPenaltyThreshold1, _hunger, true) as int
endFunction
endProperty
int property ThirstPercent
int function get()
return Lerp(0, 100, ThirstWarnThreshold, ThirstPenaltyThreshold1, _thirst, true) as int
endFunction
endProperty
int property FatiguePercent
int function get()
return Lerp(0, 100, FatigueWarnThreshold, FatiguePenaltyThreshold1, _fatigue, true) as int
endFunction
endProperty
int property HungerLevel
int function get()
return _hungerLevel
endFunction
endProperty
int property ThirstLevel
int function get()
return _thirstLevel
endFunction
endProperty
int property FatigueLevel
int function get()
return _fatigueLevel
endFunction
endProperty
ObjectReference property PlayerRef auto
bool property HungerEnabled = true auto
bool property ThirstEnabled = true auto
bool property FatigueEnabled = true auto
; Real seconds between update checks
float property UpdateInterval = 3.0 auto
; Increase per game (sleep) hour
int property HungerPerHour = 10 auto
int property HungerPerSleepHour = 5 auto
int property ThirstPerHour = 10 auto
int property ThirstPerSleepHour = 10 auto
int property FatiguePerHour = 10 auto
int property FatiguePerSleepHour = -20 auto
; Warn threshold starts sound feedback, no penalties
; Level 1 applies penalties
; Level 2 applies severe penalties
; Values are capped at max
int property HungerWarnThreshold = 60 auto
int property HungerPenaltyThreshold1 = 120 auto
int property HungerPenaltyThreshold2 = 350 auto
int property HungerMax = 420 auto
int property ThirstWarnThreshold = 50 auto
int property ThirstPenaltyThreshold1 = 100 auto
int property ThirstPenaltyThreshold2 = 200 auto
int property ThirstMax = 250 auto
int property FatigueWarnThreshold = 160 auto
int property FatiguePenaltyThreshold1 = 200 auto
int property FatiguePenaltyThreshold2 = 400 auto
int property FatigueMax = 480 auto
; Sound feedback interval in real seconds, lerped between min and max
float property SoundMinInterval = 40.0 auto
float property SoundMaxInterval = 150.0 auto
; Cooldown after any sound feedback in real seconds
float property SoundCooldownInterval = 10.0 auto
; Male sounds at index 0, female at 1
Sound[] property HungerSounds auto
Sound[] property ThirstSounds auto
Sound[] property FatigueSounds auto
; Level 1 penalty at index 0, level 2 at 1
Spell[] property HungerPenalties auto
Spell[] property ThirstPenalties auto
Spell[] property FatiguePenalties auto
GlobalVariable property PlayerIsVampire auto
GLobalVariable property PlayerIsWerewolf auto
; INITIALIZATION ----------------------------------------------------------------------------------
event OnInit()
_lastIncreaseTime = 24 * Utility.GetCurrentGameTime()
RegisterForSingleUpdate(UpdateInterval)
RegisterForSleep()
endEvent
; EVENTS ------------------------------------------------------------------------------------------
function OnUpdate()
_curTime = 24 * Utility.GetCurrentGameTime()
CheckValueIncrease()
UpdatePenalties()
UpdateSounds()
; Causes widget to pull most recent data
if (_hunger != _lastHunger || _thirst != _lastThirst || _fatigue != _lastFatigue)
_lastHunger = _hunger
_lastThirst = _thirst
_lastFatigue = _fatigue
SendModEvent("PNX_statusUpdated")
endIf
RegisterForSingleUpdate(UpdateInterval)
endFunction
event OnSleepStart(float a_sleepStartTime, float a_desiredSleepEndTime)
_sleepStartTime = 24 * a_sleepStartTime
_sleepEndTime = 24 * a_desiredSleepEndTime ; change later if interrupted
endEvent
event OnSleepStop(bool a_interrupted)
if (a_interrupted)
_sleepEndTime = 24 * Utility.GetCurrentGameTime()
endIf
; We add up the sleep duration in case player sleeps several times until the main loop is processed again
_sleepDuration += (_sleepEndTime - _sleepStartTime) as int
; Play sound again if still sleepy
_fatigueSoundTimer = 0.0
endEvent
; PUBLIC FUNCTIONS --------------------------------------------------------------------------------
function ReduceHunger(int a_hours)
_hunger -= a_hours * HungerPerHour
if (_hunger < 0)
_hunger = 0
endIf
_hungerSoundTimer = 0.0
endFunction
function ReduceThirst(int a_hours)
_thirst -= a_hours * ThirstPerHour
if (_thirst < 0)
_thirst = 0
endIf
_thirstSoundTimer = 0.0
endFunction
function ReduceFatigue(int a_hours)
_fatigue -= a_hours * FatiguePerHour
if (_fatigue < 0)
_fatigue = 0
endIf
_fatigueSoundTimer = 0.0
endFunction
; PRIVATE FUNCTIONS -------------------------------------------------------------------------------
function CheckValueIncrease()
bool isVampire = PlayerIsVampire.GetValueInt() > 0
if (!HungerEnabled || isVampire)
_hunger = 0
endIf
if (!ThirstEnabled || isVampire)
_thirst = 0
endIf
if (!FatigueEnabled || isVampire)
_fatigue = 0
endIf
int d = (_curTime - _lastIncreaseTime) as int
; Wait at least one hour between increases
if (d < 1)
return
endIf
; We reset the timers after longer waiting durations to remind the player to be careful
if (d > 3)
_hungerSoundTimer = 0.0
_thirstSoundTimer = 0.0
_fatigueSoundTimer = 0.0
endIf
; Sleep duration is 0 if not slept at all
int awakeDuration = d - _sleepDuration
if (HungerEnabled && _hunger < HungerMax && !isVampire)
_hunger += awakeDuration * HungerPerHour
_hunger += _sleepDuration * HungerPerSleepHour
if (_hunger > HungerMax)
_hunger = HungerMax
elseIf (_hunger < 0)
_hunger = 0
endIf
endIf
if (ThirstEnabled && _thirst < ThirstMax && !isVampire)
_thirst += awakeDuration * ThirstPerHour
_thirst += _sleepDuration * ThirstPerSleepHour
if (_thirst > ThirstMax)
_thirst = ThirstMax
elseIf (_thirst < 0)
_thirst = 0
endIf
endIf
if (FatigueEnabled && _fatigue < FatigueMax && !isVampire)
_fatigue += awakeDuration * FatiguePerHour
_fatigue += _sleepDuration * FatiguePerSleepHour
if (_fatigue > FatigueMax)
_fatigue = FatigueMax
elseIf (_fatigue < 0)
_fatigue = 0
endIf
endIf
_lastIncreaseTime = _curTime
; Reset
_sleepDuration = 0
endFunction
function UpdatePenalties()
bool applyHunger = false
bool applyThirst = false
bool applyFatigue = false
Actor player = Game.GetPlayer()
if (_hunger > HungerPenaltyThreshold2)
applyHunger = (_hungerLevel != 2)
_hungerLevel = 2
elseIf (_hunger > HungerPenaltyThreshold1)
applyHunger = (_hungerLevel != 1)
_hungerLevel = 1
else
applyHunger = (_hungerLevel != 0)
_hungerLevel = 0
endIf
if (_thirst > ThirstPenaltyThreshold2)
applyThirst = (_thirstLevel != 2)
_thirstLevel = 2
elseIf (_thirst > ThirstPenaltyThreshold1)
applyThirst = (_thirstLevel != 1)
_thirstLevel = 1
else
applyThirst = (_thirstLevel != 0)
_thirstLevel = 0
endIf
if (_fatigue > FatiguePenaltyThreshold2)
applyFatigue = (_fatigueLevel != 2)
_fatigueLevel = 2
elseIf (_fatigue > FatiguePenaltyThreshold1)
applyFatigue = (_fatigueLevel != 1)
_fatigueLevel = 1
else
applyFatigue = (_fatigueLevel != 0)
_fatigueLevel = 0
endIf
if (applyHunger)
; Immediate feedback
_hungerSoundTimer = 0.0
if (_hungerLevel == 2)
player.RemoveSpell(HungerPenalties[0])
player.AddSpell(HungerPenalties[1], false)
elseIf (_hungerLevel == 1)
player.AddSpell(HungerPenalties[0], false)
player.RemoveSpell(HungerPenalties[1])
else
player.RemoveSpell(HungerPenalties[0])
player.RemoveSpell(HungerPenalties[1])
endIf
endIf
if (applyThirst)
_thirstSoundTimer = 0.0
if (_thirstLevel == 2)
player.RemoveSpell(ThirstPenalties[0])
player.AddSpell(ThirstPenalties[1], false)
elseIf (_thirstLevel == 1)
player.AddSpell(ThirstPenalties[0], false)
player.RemoveSpell(ThirstPenalties[1])
else
player.RemoveSpell(ThirstPenalties[0])
player.RemoveSpell(ThirstPenalties[1])
endIf
endIf
if (applyFatigue)
_fatigueSoundTimer = 0.0
if (_fatigueLevel == 2)
player.RemoveSpell(FatiguePenalties[0])
player.AddSpell(FatiguePenalties[1], false)
elseIf (_fatigueLevel == 1)
player.AddSpell(FatiguePenalties[0], false)
player.RemoveSpell(FatiguePenalties[1])
else
player.RemoveSpell(FatiguePenalties[0])
player.RemoveSpell(FatiguePenalties[1])
endIf
endIf
endFunction
function UpdateSounds()
; General cooldown so we don't play sounds immediately after each other
if (_soundCooldownTimer > 0)
_soundCooldownTimer -= UpdateInterval
return
endIf
if (_hungerSoundTimer > 0)
_hungerSoundTimer -= UpdateInterval
elseIf (_hunger > HungerWarnThreshold)
PlaySound(HungerSounds)
_hungerSoundTimer = Lerp(SoundMaxInterval, SoundMinInterval, HungerWarnThreshold, HungerMax, _hunger)
return
endIf
if (_thirstSoundTimer > 0)
_thirstSoundTimer -= UpdateInterval
elseIf (_thirst > ThirstWarnThreshold)
PlaySound(ThirstSounds)
_thirstSoundTimer = Lerp(SoundMaxInterval, SoundMinInterval, ThirstWarnThreshold, ThirstMax, _thirst)
return
endIf
if (_fatigueSoundTimer > 0)
_fatigueSoundTimer -= UpdateInterval
elseIf (_fatigue > FatigueWarnThreshold)
PlaySound(FatigueSounds)
_fatigueSoundTimer = Lerp(SoundMaxInterval, SoundMinInterval, FatigueWarnThreshold, FatigueMax, _fatigue)
return
endIf
endFunction
function PlaySound(Sound[] a_sounds)
ActorBase playerBase = PlayerRef.GetBaseObject() as ActorBase
int idx = playerBase.GetSex()
a_sounds[idx].Play(PlayerRef)
_soundCooldownTimer = SoundCooldownInterval
endFunction
float function Lerp(float a_targetMin, float a_targetMax, float a_sourceMin, float a_sourceMax, float a_sourceVal, bool a_bClamp = false)
float v = a_targetMin + (a_targetMax - a_targetMin) * ((a_sourceVal - a_sourceMin) / (a_sourceMax - a_sourceMin))
if (a_bClamp)
if (v < a_targetMin)
v = a_targetMin
elseIf (v > a_targetMax)
v = a_targetMax
endIf
endIf
return v
endFunction | Papyrus | 4 | pragasette/skyui | misc/PrimaryNeeds/Scripts/Source/PN_NeedsManager.psc | [
"Unlicense",
"MIT"
] |
-- Copyright 2018 Stanford University
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
import "regent"
local c = regentlib.c
task summer(lim : int64)
var sum : int64 = 0
for i = 1, lim do
sum += i
end
c.printf("Summer is done!\n")
return sum
end
-- Just making the point that subtasks can also launch subtasks ...
task subtracter(input : int64)
c.printf("Subtracter is done!\n")
return input - 3
end
task tester(sum : int64)
if sum >= 40 then
sum = subtracter(sum)
elseif sum <= 30 then
sum = 0
else
sum += 3
end
c.printf("Tester is done!\n")
return sum
end
-- A main task with two subtasks
task main()
var sum = summer(10)
sum = tester(sum)
c.printf("Main is done!\n")
end
regentlib.start(main)
| Rouge | 5 | elliottslaughter/regent-tutorial | Tasks/2a.rg | [
"Apache-2.0"
] |
# https://github.com/graphql/graphql-js/pull/2733/files
type Query {
someField(
nonDeprecated: String
deprecated: String @deprecated(reason: "Removed in 1.0")
deprecatedWithEmptyReason: String @deprecated(reason: "")
): String
}
type Query {
someField(
nonDeprecated: String
deprecated: String @deprecated(reason: "Removed in 1.0")
): String
}
input SomeInputObject {
nonDeprecated: String
deprecated: String @deprecated(reason: "Removed in 1.0")
deprecatedWithEmptyReason: String @deprecated(reason: "")
}
type Query {
someField(someArg: SomeInputObject): String
}
input SomeInputObject {
nonDeprecated: String
deprecated: String @deprecated(reason: "Removed in 1.0")
}
type Query {
someField(someArg: SomeInputObject): String
}
type Query {
field(arg: SomeInputObject): String
}
input SomeInputObject {
badField: String! @deprecated
optionalField: String @deprecated
anotherOptionalField: String! = "" @deprecated
}
directive @BadDirective(
badArg: String! @deprecated
optionalArg: String @deprecated
anotherOptionalArg: String! = "" @deprecated
) on FIELD
type Query {
test(
badArg: String! @deprecated
optionalArg: String @deprecated
anotherOptionalArg: String! = "" @deprecated
): String
}
input MyInput {
oldInput: String @deprecated
otherInput: String @deprecated(reason: "Use newInput")
newInput: String
}
type Query {
field1: String @deprecated
field2: Int @deprecated(reason: "Because I said so")
enum: MyEnum
field3(oldArg: String @deprecated, arg: String): String
field4(oldArg: String @deprecated(reason: "Why not?"), arg: String): String
field5(arg: MyInput): String
}
| GraphQL | 3 | tumido/prettier | tests/format/graphql/deprecation/directives.graphql | [
"MIT"
] |
import createSvgIcon from './utils/createSvgIcon';
import { jsx as _jsx } from "react/jsx-runtime";
export default createSvgIcon([/*#__PURE__*/_jsx("path", {
d: "M19 5H5v14h14V5zm-5 12h-2V9h-2V7h4v10z",
opacity: ".3"
}, "0"), /*#__PURE__*/_jsx("path", {
d: "M5 21h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2zM5 5h14v14H5V5zm5 4h2v8h2V7h-4z"
}, "1")], 'LooksOneTwoTone'); | JavaScript | 4 | good-gym/material-ui | packages/material-ui-icons/lib/esm/LooksOneTwoTone.js | [
"MIT"
] |
<!DOCTYPE html>
<html>
<head>
<title>Baeldung HTTP/2 Client in Jetty</title>
</head>
<body>
<h2>HTTP/2 Demo</h2>
<div>
<img src="images/homepage-latest_articles.jpg" alt="latest articles" />
<img src="images/homepage-rest_with_spring.jpg" alt="rest with spring" />
<img src="images/homepage-weekly_reviews.jpg" alt="weekly reviews" />
</div>
</body>
</html> | HTML | 1 | DBatOWL/tutorials | libraries-server-2/src/main/webapp/http2.html | [
"MIT"
] |
=begin
%%{
machine simple_tokenizer;
action MyTs {
my_ts = p
}
action MyTe {
my_te = p
}
action Emit {
emit data[my_ts...my_te].pack('c*')
my_ts = nil
my_te = nil
}
foo = 'STARTFOO' any+ >MyTs :>> 'ENDFOO' >MyTe %Emit;
main := ( foo | any+ )*;
}%%
=end
# Scans a file for "STARTFOO[...]ENDFOO" blocks and outputs their contents.
#
# ENV['CHUNK_SIZE'] determines how much of the file to read in at a time, allowing you to control memory usage.
#
# Does not use ragel's scanner functionality because no backtracking is needed.
class SimpleTokenizer
attr_reader :path
def initialize(path)
@path = path
%% write data;
# % (this fixes syntax highlighting)
end
def emit(foo)
$stdout.puts foo
end
def perform
# So that ragel doesn't try to get it from data.length
pe = :ignored
eof = :ignored
%% write init;
# % (this fixes syntax highlighting)
leftover = []
my_ts = nil
my_te = nil
File.open(path) do |f|
while chunk = f.read(ENV['CHUNK_SIZE'].to_i)
data = leftover + chunk.unpack('c*')
p = 0
pe = data.length
%% write exec;
# % (this fixes syntax highlighting)
if my_ts
leftover = data[my_ts..-1]
my_te = my_te - my_ts if my_te
my_ts = 0
else
leftover = []
end
end
end
end
end
s = SimpleTokenizer.new ARGV[0]
s.perform
| Ragel in Ruby Host | 4 | JavascriptID/sourcerer-app | src/test/resources/samples/langs/Ragel/simple_tokenizer.rl | [
"MIT"
] |
#!/bin/jconsole
x=.>0".&.>;:}:stdin''
x=.(I.x~:0){x
x=.2}.x+(_1|.!.0 x)+(_2|.!.0 x)
echo+/(1|.!.0 x)>x
| J | 0 | abeaumont/competitive-programming | advent-of-code/2021/day1/part2.ijs | [
"WTFPL"
] |
pub extern "C" fn f() -> i32 { 1 }
pub extern "C" fn g() -> i32 { 2 }
pub fn get_f() -> extern "C" fn() -> i32 { f }
pub fn get_g() -> extern "C" fn() -> i32 { g }
| Rust | 3 | mbc-git/rust | src/test/ui/extern/auxiliary/extern-take-value.rs | [
"ECL-2.0",
"Apache-2.0",
"MIT-0",
"MIT"
] |
FORMAT: 1A
# Machines API
# Group Machines
# Machines collection [/machines]
## Get Machines [GET]
- Response 200 (application/json; charset=utf-8)
+ Schema
{
"$schema": "http://json-schema.org/draft-07/schema#",
"type": "array",
"items": {
"type": "object",
"properties": {
"type": {
"type": "string",
"const": "bulldozer"
},
"name": {
"not": {
"type": "number"
}
}
}
}
}
| API Blueprint | 3 | tomoyamachi/dredd | packages/dredd/test/fixtures/json-schema-draft-7.apib | [
"MIT"
] |
# System calls
extern sys_trap;
extern sys_blkwrite;
extern sys_blkread;
extern sys_random;
extern sys_serflags;
extern sys_cmdargs;
extern sys_osbase;
extern sys_copyfd;
extern sys_unlink;
extern sys_stat;
extern sys_readdir;
extern sys_opendir;
extern sys_mkdir;
extern sys_chdir;
extern sys_rename;
extern sys_sync;
extern sys_close;
extern sys_open;
extern sys_read;
extern sys_setbuf;
extern sys_write;
extern sys_getcwd;
extern sys_system;
extern sys_exec;
extern sys_exit;
var trap = sys_trap;
var blkwrite = sys_blkwrite;
var blkread = sys_blkread;
var random = sys_random;
var serflags = sys_serflags;
var cmdargs = sys_cmdargs;
var osbase = sys_osbase;
var copyfd = sys_copyfd;
var unlink = sys_unlink;
var stat = sys_stat;
var readdir = sys_readdir;
var opendir = sys_opendir;
var mkdir = sys_mkdir;
var chdir = sys_chdir;
var rename = sys_rename;
var sync = sys_sync;
var close = sys_close;
var open = sys_open;
var read = sys_read;
var setbuf = sys_setbuf;
var write = sys_write;
var getcwd = sys_getcwd;
var exec = sys_exec;
var exit = sys_exit;
# example: system(["/bin/ls", "-l"])
extern TOP;
var system = func(args) sys_system(TOP, args);
# file modes
var O_READ = 0x01;
var O_WRITE = 0x02;
var O_CREAT = 0x04;
var O_NOTRUNC = 0x08;
var O_APPEND = 0x10;
# error codes
var EOF = -1;
var NOTFOUND = -2;
var NOTFILE = -3;
var NOTDIR = -4;
var BADFD = -5;
var TOOLONG = -6;
var EXISTS = -7;
# serial flags
var SER_COOKED = 1;
var SER_DISABLE = 2;
var SER_LONGREAD = 4;
var strerror = func(err) {
if (err == 0) return "success";
if (err == EOF) return "end-of-file";
if (err == NOTFOUND) return "not found";
if (err == NOTFILE) return "not a file";
if (err == NOTDIR) return "not a directory";
if (err == BADFD) return "bad file descriptor";
if (err == TOOLONG) return "path component too long";
if (err == EXISTS) return "path exists";
return "<unknown error>";
};
| Slash | 4 | jes/scamp-cpu | sys/lib/sys.sl | [
"Unlicense"
] |
<!doctype html>
<html>
<head>
<!-- Prevent the browser from requesting any favicon. -->
<link rel="icon" href="data:,">
</head>
<body>
<h2>Params</h2>
<form>
Cols:
<input type="number" name="cols" placeholder="cols" value="40">
<br>
Rows:
<input type="number" name="rows" placeholder="rows" value="200">
<br>
<button>Apply</button>
</form>
<h2>Ng2 with NgSwitch Largetable Benchmark</h2>
<p>
<button id="destroyDom">destroyDom</button>
<button id="createDom">createDom</button>
<button id="updateDomProfile">profile updateDom</button>
<button id="createDomProfile">profile createDom</button>
</p>
<div>
<largetable id="root">Loading...</largetable>
</div>
<!--load location for ts_devserver-->
<script src="/app_bundle.js"></script>
</body>
</html>
| HTML | 3 | duluca/angular | modules/benchmarks/src/largetable/ng2_switch/index.html | [
"MIT"
] |
<%@ WebHandler Language="C#" CodeBehind="EchoWebSocket.ashx.cs" Class="WebServer.EchoWebSocket" %>
| ASP | 1 | pyracanda/runtime | src/libraries/Common/tests/System/Net/Prerequisites/Servers/CoreFxNetCloudService/WebServer/WebSocket/EchoWebSocket.ashx | [
"MIT"
] |
import 'package:jaguar_serializer/jaguar_serializer.dart';
{{#models}}
{{#model}}
{{#imports}}import 'package:{{pubName}}/model/{{.}}.dart';
{{/imports}}
{{#isEnum}}{{>enum}}{{/isEnum}}{{^isEnum}}{{>class}}{{/isEnum}}
{{/model}}
{{/models}}
| HTML+Django | 3 | derBiggi/swagger-codegen | modules/swagger-codegen/src/main/resources/dart-jaguar/model.mustache | [
"Apache-2.0"
] |
%~dp0\..\..\..\bin\x64\Debug\OpenConsole.exe cmd.exe /K te.exe %~dp0\..\..\..\bin\x64\Debug\Conhost.API.Tests.dll %*
| Batchfile | 0 | Ghosty141/Terminal | src/host/ft_host/runtest.bat | [
"MIT"
] |
# This file is a script for GAP and tests a list of polynomials in hexadecimal
# for irreducibility over F_2
# create x over F_2 = GF(2)
x := Indeterminate(GF(2), "x");
# test if polynomial is irreducible, i.e. the number of factors is one
IrredPoly := function (poly)
return (Length(Factors(poly)) = 1);
end;;
# create a polynomial in x from the hexadecimal representation of the
# coefficients
Hex2Poly := function (s)
return ValuePol(CoefficientsQadic(IntHexString(s), 2), x);
end;;
# list of candidates, in hex
candidates := [ "3DA3358B4DC173" ];
# create real polynomials
L := List(candidates, Hex2Poly);
# filter and display the list of irreducible polynomials contained in L
Display(Filtered(L, x -> (IrredPoly(x))));
| GAP | 5 | swaitw/restic | doc/test_irreducibility.gap | [
"BSD-2-Clause"
] |
package com.serverless;
import com.amazonaws.services.lambda.runtime.Context;
import com.amazonaws.services.lambda.runtime.RequestHandler;
import com.amazonaws.services.lambda.runtime.events.CodeCommitEvent;
public class RequestHandlerCodeCommitEvent implements RequestHandler<CodeCommitEvent, Object> {
public static CodeCommitEvent input;
@Override
public Object handleRequest(CodeCommitEvent event, Context context) {
input = event;
System.out.println("Input received:" + event.toString());
return "RequesHandlerCodeCommitEvent invoke Complete.";
}
}
| Java | 3 | Arun-kc/serverless | lib/plugins/aws/invokeLocal/runtimeWrappers/java/src/test/java/com/serverless/RequestHandlerCodeCommitEvent.java | [
"MIT"
] |
from .module_loader import import_module
from .cwrap_common import set_declaration_defaults, sort_by_number_of_args
| Python | 1 | Hacky-DH/pytorch | tools/shared/__init__.py | [
"Intel"
] |
using Uno.Collections;
namespace Fuse.Text
{
class SinglyLinkedList<T> : IEnumerable<T>
{
public T Value { get; private set; }
public SinglyLinkedList<T> Next;
public SinglyLinkedList(T value, SinglyLinkedList<T> next = null)
{
Value = value;
Next = next;
}
public IEnumerator<T> GetEnumerator()
{
return new Enumerator(this);
}
public static SinglyLinkedList<T> FromEnumerable(IEnumerable<T> xs)
{
var before = new SinglyLinkedList<T>(default(T), null);
var head = before;
foreach (var x in xs)
{
head.Next = new SinglyLinkedList<T>(x, null);
head = head.Next;
}
return before.Next;
}
class Enumerator : IEnumerator<T>
{
SinglyLinkedList<T> _beforeHead;
SinglyLinkedList<T> _current;
public Enumerator(SinglyLinkedList<T> list)
{
_beforeHead = new SinglyLinkedList<T>(default(T), list);
Reset();
}
public T Current
{
get
{
return _current.Value;
}
}
public void Reset()
{
_current = _beforeHead;
}
public bool MoveNext()
{
if (_current != null)
{
_current = _current.Next;
return _current != null;
}
return false;
}
public void Dispose()
{
// Nothing to do
}
}
}
}
| Uno | 5 | helilabs/fuselibs | Source/Fuse.Text/Implementation/SinglyLinkedList.uno | [
"MIT"
] |
--TEST--
Multi-line match
--FILE--
<?php
var_dump(preg_match_all('/^.{2,3}$/', "aei\nou", $dummy));
var_dump(preg_match_all('/^.{2,3}$/', "aei\nou\n", $dummy));
var_dump(preg_match_all('/^.{2,3}$/m', "aei\nou", $dummy));
var_dump(preg_match_all('/^.{2,3}$/m', "aei\nou\n", $dummy));
echo "done\n";
?>
--EXPECT--
int(0)
int(0)
int(2)
int(2)
done
| PHP | 4 | guomoumou123/php5.5.10 | ext/pcre/tests/multiline.phpt | [
"PHP-3.01"
] |
// @target: ES6
async function fAsync() {
// Without explicit type annotation, this is just an array.
return [1, true];
}
async function fAsyncExplicit(): Promise<[number, boolean]> {
// This is contextually typed as a tuple.
return [1, true];
}
// https://github.com/Microsoft/TypeScript/issues/13128
interface Obj {
stringProp: string;
anyProp: any;
}
async function fIndexedTypeForStringProp(obj: Obj): Promise<Obj["stringProp"]> {
return obj.stringProp;
}
async function fIndexedTypeForPromiseOfStringProp(obj: Obj): Promise<Obj["stringProp"]> {
return Promise.resolve(obj.stringProp);
}
async function fIndexedTypeForExplicitPromiseOfStringProp(obj: Obj): Promise<Obj["stringProp"]> {
return Promise.resolve<Obj["stringProp"]>(obj.stringProp);
}
async function fIndexedTypeForAnyProp(obj: Obj): Promise<Obj["anyProp"]> {
return obj.anyProp;
}
async function fIndexedTypeForPromiseOfAnyProp(obj: Obj): Promise<Obj["anyProp"]> {
return Promise.resolve(obj.anyProp);
}
async function fIndexedTypeForExplicitPromiseOfAnyProp(obj: Obj): Promise<Obj["anyProp"]> {
return Promise.resolve<Obj["anyProp"]>(obj.anyProp);
}
async function fGenericIndexedTypeForStringProp<TObj extends Obj>(obj: TObj): Promise<TObj["stringProp"]> {
return obj.stringProp;
}
async function fGenericIndexedTypeForPromiseOfStringProp<TObj extends Obj>(obj: TObj): Promise<TObj["stringProp"]> {
return Promise.resolve(obj.stringProp);
}
async function fGenericIndexedTypeForExplicitPromiseOfStringProp<TObj extends Obj>(obj: TObj): Promise<TObj["stringProp"]> {
return Promise.resolve<TObj["stringProp"]>(obj.stringProp);
}
async function fGenericIndexedTypeForAnyProp<TObj extends Obj>(obj: TObj): Promise<TObj["anyProp"]> {
return obj.anyProp;
}
async function fGenericIndexedTypeForPromiseOfAnyProp<TObj extends Obj>(obj: TObj): Promise<TObj["anyProp"]> {
return Promise.resolve(obj.anyProp);
}
async function fGenericIndexedTypeForExplicitPromiseOfAnyProp<TObj extends Obj>(obj: TObj): Promise<TObj["anyProp"]> {
return Promise.resolve<TObj["anyProp"]>(obj.anyProp);
}
async function fGenericIndexedTypeForKProp<TObj extends Obj, K extends keyof TObj>(obj: TObj, key: K): Promise<TObj[K]> {
return obj[key];
}
async function fGenericIndexedTypeForPromiseOfKProp<TObj extends Obj, K extends keyof TObj>(obj: TObj, key: K): Promise<TObj[K]> {
return Promise.resolve(obj[key]);
}
async function fGenericIndexedTypeForExplicitPromiseOfKProp<TObj extends Obj, K extends keyof TObj>(obj: TObj, key: K): Promise<TObj[K]> {
return Promise.resolve<TObj[K]>(obj[key]);
} | TypeScript | 5 | nilamjadhav/TypeScript | tests/cases/compiler/asyncFunctionReturnType.ts | [
"Apache-2.0"
] |
#include "caffe2/opt/custom/concat_elim.h"
#include "caffe2/core/logging.h"
#include "caffe2/opt/nql/graphmatcher.h"
#include "caffe2/opt/passes.h"
#include "nomnigraph/Representations/NeuralNet.h"
#include "nomnigraph/Support/Common.h"
#include "nomnigraph/Transformations/SubgraphMatcher.h"
namespace caffe2 {
namespace opt {
void concatElim(NNModule* nn) {
using namespace nom::matcher;
using namespace nom::repr::nn;
using namespace nom::repr;
auto mg = NNMatchGraph();
auto matchConcatInputs =
mg.createNode(std::move(matchExternalTensorNode().starCount()));
auto matchConcat = mg.createNode([](NNGraph::NodeRef nodeRef) {
NOM_REQUIRE_OR_RET_FALSE(nn::is<Concat>(nodeRef));
NOM_REQUIRE_OR_RET_FALSE(nn::hasUniqueConsumer(nodeRef));
auto node = nn::get<Concat>(nodeRef);
return node->getAxis() == 1 && node->getAddAxis();
});
mg.createEdge(matchConcatInputs, matchConcat);
auto matchConcatOutput = mg.createNode(nn::is<nom::repr::Tensor>);
mg.createEdge(matchConcat, matchConcatOutput);
auto matchBatchMatmul = mg.createNode([](NNGraph::NodeRef nodeRef) {
NOM_REQUIRE_OR_RET_FALSE(nn::is<BatchMatMul>(nodeRef));
NOM_REQUIRE_OR_RET_FALSE(nn::hasSingleOutputAndConsumer(nodeRef));
auto node = nn::get<BatchMatMul>(nodeRef);
return node->getTransA() == 0 && node->getTransB() == 1 &&
node->getBroadcast() == 0;
});
mg.createEdge(matchConcatOutput, matchBatchMatmul);
mg.createEdge(matchConcatOutput, matchBatchMatmul);
auto matchBmmOutput = mg.createNode(nn::is<nom::repr::Tensor>);
mg.createEdge(matchBatchMatmul, matchBmmOutput);
auto matchFlatten = mg.createNode([](NNGraph::NodeRef nodeRef) {
NOM_REQUIRE_OR_RET_FALSE(nn::is<Flatten>(nodeRef));
return nn::hasSingleOutputAndConsumer(nodeRef);
});
mg.createEdge(matchBmmOutput, matchFlatten);
auto matchFlattenOutput = mg.createNode(nn::is<nom::repr::Tensor>);
mg.createEdge(matchFlatten, matchFlattenOutput);
auto matchIndices = mg.createNode(matchExternalTensorNode());
auto matchBatchGather = mg.createNode(nn::is<BatchGather>);
mg.createEdge(matchFlattenOutput, matchBatchGather);
mg.createEdge(matchIndices, matchBatchGather);
mg.replaceSubgraph(
nn->dataFlow,
matchBatchGather,
[matchConcatOutput](
NNGraph& g,
NNGraph::NodeRef batchGatherNode,
const NNMatchGraph::SubgraphMatchResultType& matchResult) {
auto fusedNode =
g.createNode(make_unique<ConcatBatchMatMulBatchGatherOp>());
auto batchGatherNodeOutputs = nn::getOutputs(batchGatherNode);
for (const auto& output : batchGatherNodeOutputs) {
auto tensor = nn::get<nom::repr::Tensor>(output);
// Handle cases where blob names are reused - D9113128.
auto newOutput = g.createNode(
make_unique<nom::repr::Tensor>(tensor->getName() + "_cc_bmm_bg"));
g.createEdge(fusedNode, newOutput);
g.replaceOutEdges(output, newOutput);
}
auto concatNode =
getProducer(matchResult.getMatchNodeMap()->at(matchConcatOutput));
g.replaceInEdges(batchGatherNode, fusedNode);
g.replaceInEdges(concatNode, fusedNode);
g.deleteNodes(matchResult.getMatchedSubgraph()->getNodes());
return true;
});
}
REGISTER_OPT_PASS_FROM_FUNC(ConcatElim, concatElim);
void concatAddMulNaNClipElim(NNModule* nn) {
using namespace nom::repr;
nom::nql::GraphMatcher gm;
gm.initFromString(R"NQL(def query {
%concat_out, %split_info = Concat(*)
%add = Add(%concat_out, %add_in)
%mul = Mul(%add, %mul_in)
%replace = ReplaceNaN(%mul)
%out = Clip(%replace)
})NQL");
CAFFE_ENFORCE(gm.getMatcher(), "Unable to parse NQL query.");
// Iterate through each match and replace them
for (const auto& match : gm.getMatches(nn->dataFlow)) {
// Various attributes we care about for this fusion
NOM_REQUIRE_OR_CONT(nn::get<Concat>(match["Concat"])->getAxis() == 1);
NOM_REQUIRE_OR_CONT(nn::get<Add>(match["Add"])->getBroadcast() == 1);
NOM_REQUIRE_OR_CONT(nn::get<Mul>(match["Mul"])->getBroadcast() == 1);
NOM_REQUIRE_OR_CONT(
std::abs(nn::get<ReplaceNaN>(match["ReplaceNaN"])->getValue()) < 0.01);
// Figure out the input/output order (creating new nodes if needed)
std::vector<NNGraph::NodeRef> inputs, outputs;
// First set up the inputs
inputs.emplace_back(match["\%add_in"]);
inputs.emplace_back(match["\%mul_in"]);
for (const auto& concat_input : nn::getInputs(match["Concat"])) {
inputs.emplace_back(concat_input);
}
// Set up the outputs
outputs.emplace_back(match["\%out"]);
// TODO(duc): The subgraph matcher doesn't yet handle patterns
// that are not trees, meaning the %split_info node is not yet
// matched.
outputs.emplace_back(nn::getOutputs(match["Concat"]).at(1));
auto min = nn::get<Clip>(match["Clip"])->getMin();
auto max = nn::get<Clip>(match["Clip"])->getMax();
// This will do all the work
nn->replaceSubgraphWithOperator<ConcatAddMulReplaceNaNClip>(
match.subgraph, inputs, outputs, min, max);
}
}
REGISTER_OPT_PASS_FROM_FUNC(ConcatAddMulNaNClipElim, concatAddMulNaNClipElim);
void gatherFuse8BitRowwiseQuantFloatMulLengthsSumElim(NNModule* nn) {
using namespace nom::repr;
nom::nql::GraphMatcher gm;
gm.initFromString(R"NQL(def query {
%gather = Gather(%a, %b)
%ff = Fused8BitRowwiseQuantizedToFloat(%gather)
%mu = Mul(%ff, %mul_in)
%out = LengthsSum(%mu, %len_in)
})NQL");
CAFFE_ENFORCE(gm.getMatcher(), "Unable to parse NQL query.");
// Iterate through each match and replace them
for (const auto& match : gm.getMatches(nn->dataFlow)) {
NOM_REQUIRE_OR_CONT(nn::get<Mul>(match["Mul"])->getBroadcast() == 1);
NOM_REQUIRE_OR_CONT(nn::get<Mul>(match["Mul"])->getAxis() == 0);
// Figure out the input/output order (creating new nodes if needed)
std::vector<NNGraph::NodeRef> inputs, outputs;
// First set up the inputs
const auto& gather_inputs = nn::getInputs(match["Gather"]);
inputs.emplace_back(gather_inputs.at(0));
inputs.emplace_back(match["\%mul_in"]);
inputs.emplace_back(gather_inputs.at(1));
inputs.emplace_back(match["\%len_in"]);
// Set up the outputs
outputs.emplace_back(match["\%out"]);
// Check if outputs of the subgraph contain intermediate tensors
// If so, abort fusion.
std::unordered_set<NNGraph::NodeRef> internal;
for (const auto& output : nn::getOutputs(match["Gather"])) {
internal.emplace(output);
}
for (const auto& output :
nn::getOutputs(match["Fused8BitRowwiseQuantizedToFloat"])) {
internal.emplace(output);
}
for (const auto& output : nn::getOutputs(match["Mul"])) {
internal.emplace(output);
}
for (const auto& output : nn::getOutputs(match.subgraph)) {
if (internal.count(output)) {
LOG(INFO) << "Skip fusing Gather-Fused8BitRowwiseQuantizedToFloat"
<< "-Mul-LengthsSum as internal tensor "
<< nn::getName(output)
<< " is used as external output of the subgraph.";
return;
}
}
// This will do all the work
nn->replaceSubgraphWithOperator<SparseLengthsWeightedSumFused8BitRowwise>(
match.subgraph, inputs, outputs);
}
}
REGISTER_OPT_PASS_FROM_FUNC(
GatherFuse8BitRowwiseQuantFloatMulLengthsSumElim,
gatherFuse8BitRowwiseQuantFloatMulLengthsSumElim);
} // namespace opt
} // namespace caffe2
| C++ | 3 | Hacky-DH/pytorch | caffe2/opt/custom/concat_elim.cc | [
"Intel"
] |
//@module: commonjs
// @sourcemap: true
export module m {
export class c {
}
}
import a = m.c;
export import b = m.c;
var x = new a();
var y = new b(); | TypeScript | 3 | nilamjadhav/TypeScript | tests/cases/compiler/sourceMapValidationImport.ts | [
"Apache-2.0"
] |
Boutput_2J | PureBasic | 1 | pchandrasekaran1595/onnx | onnx/backend/test/data/node/test_split_zero_size_splits/test_data_set_0/output_1.pb | [
"Apache-2.0"
] |
"""Support for Modbus Coil and Discrete Input sensors."""
from __future__ import annotations
from datetime import datetime
import logging
from typing import Any
from homeassistant.components.binary_sensor import BinarySensorEntity
from homeassistant.const import (
CONF_BINARY_SENSORS,
CONF_DEVICE_CLASS,
CONF_NAME,
STATE_ON,
)
from homeassistant.core import HomeAssistant, callback
from homeassistant.helpers.entity_platform import AddEntitiesCallback
from homeassistant.helpers.restore_state import RestoreEntity
from homeassistant.helpers.typing import ConfigType, DiscoveryInfoType
from homeassistant.helpers.update_coordinator import (
CoordinatorEntity,
DataUpdateCoordinator,
)
from . import get_hub
from .base_platform import BasePlatform
from .const import CONF_SLAVE_COUNT
from .modbus import ModbusHub
_LOGGER = logging.getLogger(__name__)
PARALLEL_UPDATES = 1
async def async_setup_platform(
hass: HomeAssistant,
config: ConfigType,
async_add_entities: AddEntitiesCallback,
discovery_info: DiscoveryInfoType | None = None,
) -> None:
"""Set up the Modbus binary sensors."""
if discovery_info is None:
return
sensors: list[ModbusBinarySensor | SlaveSensor] = []
hub = get_hub(hass, discovery_info[CONF_NAME])
for entry in discovery_info[CONF_BINARY_SENSORS]:
slave_count = entry.get(CONF_SLAVE_COUNT, 0)
sensor = ModbusBinarySensor(hub, entry, slave_count)
if slave_count > 0:
sensors.extend(await sensor.async_setup_slaves(hass, slave_count, entry))
sensors.append(sensor)
async_add_entities(sensors)
class ModbusBinarySensor(BasePlatform, RestoreEntity, BinarySensorEntity):
"""Modbus binary sensor."""
def __init__(self, hub: ModbusHub, entry: dict[str, Any], slave_count: int) -> None:
"""Initialize the Modbus binary sensor."""
self._count = slave_count + 1
self._coordinator: DataUpdateCoordinator[Any] | None = None
self._result = None
super().__init__(hub, entry)
async def async_setup_slaves(
self, hass: HomeAssistant, slave_count: int, entry: dict[str, Any]
) -> list[SlaveSensor]:
"""Add slaves as needed (1 read for multiple sensors)."""
# Add a dataCoordinator for each sensor that have slaves
# this ensures that idx = bit position of value in result
# polling is done with the base class
name = self._attr_name if self._attr_name else "modbus_sensor"
self._coordinator = DataUpdateCoordinator(
hass,
_LOGGER,
name=name,
)
slaves: list[SlaveSensor] = []
for idx in range(0, slave_count):
slaves.append(SlaveSensor(self._coordinator, idx, entry))
return slaves
async def async_added_to_hass(self) -> None:
"""Handle entity which will be added."""
await self.async_base_added_to_hass()
if state := await self.async_get_last_state():
self._attr_is_on = state.state == STATE_ON
async def async_update(self, now: datetime | None = None) -> None:
"""Update the state of the sensor."""
# do not allow multiple active calls to the same platform
if self._call_active:
return
self._call_active = True
result = await self._hub.async_pymodbus_call(
self._slave, self._address, self._count, self._input_type
)
self._call_active = False
if result is None:
if self._lazy_errors:
self._lazy_errors -= 1
return
self._lazy_errors = self._lazy_error_count
self._attr_available = False
self._result = None
else:
self._lazy_errors = self._lazy_error_count
self._attr_is_on = result.bits[0] & 1
self._attr_available = True
self._result = result
self.async_write_ha_state()
if self._coordinator:
self._coordinator.async_set_updated_data(self._result)
class SlaveSensor(CoordinatorEntity, RestoreEntity, BinarySensorEntity):
"""Modbus slave binary sensor."""
def __init__(
self, coordinator: DataUpdateCoordinator[Any], idx: int, entry: dict[str, Any]
) -> None:
"""Initialize the Modbus binary sensor."""
idx += 1
self._attr_name = f"{entry[CONF_NAME]} {idx}"
self._attr_device_class = entry.get(CONF_DEVICE_CLASS)
self._attr_available = False
self._result_inx = int(idx / 8)
self._result_bit = 2 ** (idx % 8)
super().__init__(coordinator)
async def async_added_to_hass(self) -> None:
"""Handle entity which will be added."""
if state := await self.async_get_last_state():
self._attr_is_on = state.state == STATE_ON
self.async_write_ha_state()
await super().async_added_to_hass()
@callback
def _handle_coordinator_update(self) -> None:
"""Handle updated data from the coordinator."""
result = self.coordinator.data
if result:
self._attr_is_on = result.bits[self._result_inx] & self._result_bit
super()._handle_coordinator_update()
| Python | 4 | MrDelik/core | homeassistant/components/modbus/binary_sensor.py | [
"Apache-2.0"
] |
#summary What is a LifecycleCallback and how to use it.
= Introduction =
Since release 1.4.3 it is possible to register !LifecycleCallback (aka callback). A callback is an interface exposing methods which are invoked during different wro4j processing phases. This might be useful if you want to perform some kind of benchmarking or want to add a custom logic at some particular point.
= Details =
The !LifecycleCallback interface expose the following methods:
{{{
public interface LifecycleCallback {
/**
* Invoked before starting model creation.
*/
void onBeforeModelCreated();
/**
* Invoked after the model is created.
*/
void onAfterModelCreated();
/**
* Called before each resource is processed.
*/
void onBeforePreProcess();
/**
* Called after a resource is pre processed.
*/
void onAfterPreProcess();
/**
* Called before a resource is post processed.
*/
void onBeforePostProcess();
/**
* Called after a resource is post processed.
*/
void onAfterPostProcess();
/**
* Called before resources are merged and before any processing is applied.
*/
void onBeforeMerge();
/**
* Called after all resources are merged and the preProcessing is completed.
*/
void onAfterMerge();
/**
* Called after all postProcessors are applied and overall processing is complete.
*/
void onProcessingComplete();
}
}}}
== Creating Custom !LifecycleCallback ==
When creating a custom !LifecycleCallback, it is very unlikely that you will want to override all of the methods. That is why, you can extend !LifecycleCallbackSupport class which overrides all the methods for you. This simplifies the development. For instance, if you want to override hte {{{onProcessingComplete()}}} method only, your implementation would look like this:
{{{
public CustomCallback extends LifecycleCallbackSupport {
public void onProcessingComplete() {
//do something
}
}
}}}
The wro4j-core module provides a sample implementation of a callback called {{{PerformanceLoggerCallback}}} which logs the amount of time spent during model creation, pre processing and post processing.
== Registering Custom !LifecycleCallback ==
In order to register a callback, you have to call:
{{{
LifecycleCallback callback = //create custom callback
WroManager manager = //..
manager.getCallbackRegistry().registerCallback(callback);
}}}
Alternatively, register the callback in your custom managerFactory:
{{{
public class CustomExtensionsWroManagerFactory
extends ConfigurableWroManagerFactory {
@Override
protected void onAfterInitializeManager(final WroManager manager) {
manager.registerCallback(new PerformanceLoggerCallback());
}
}
}}} | MediaWiki | 4 | supakiad/wro4j | docs/RegisteringCallbacks.wiki | [
"Apache-2.0"
] |
-- this script tests that it is possible to get the url property of the current article
-- it uses system event accessibility scripting to set up the main window
-- one needs to authorize scripting accessibility control in the System Preferences'
-- Privacy and security pane
try
tell application "NetNewsWire"
set shouldBeMissingValue to current article
end tell
--verify that the current article is in fact 'missing vcalue'
if shouldBeMissingValue is missing value then
set the_message to "passed tests"
set the_result to true
else
set the_message to "expected current article to be 'missing value'"
set the_result to false
end if
on error message
return {test_result:false, script_result:message}
end try
return {test_result:the_result, script_result:the_message}
| AppleScript | 4 | bubudrc/NetNewsWire | Tests/NetNewsWireTests/ScriptingTests/scripts/testCurrentArticleIsNil.applescript | [
"MIT"
] |
// Copyright (c) 2017 Massachusetts Institute of Technology
//
// Permission is hereby granted, free of charge, to any person
// obtaining a copy of this software and associated documentation
// files (the "Software"), to deal in the Software without
// restriction, including without limitation the rights to use, copy,
// modify, merge, publish, distribute, sublicense, and/or sell copies
// of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
// BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.
// This is the connectal interface for a mem loader backed by connectal
// When the mem loader receives the request from RISC-V processor to initialize
// memory, it will send indication to host. And then host will keep writing
// data to the mem loader, and mem loader should send these writes to the LLC
// of RISC-V processor.
// The interface for host to write is similar to AXI. Write addr should be
// aligned w.r.t 8B.
interface MemLoaderRequest;
// addr channel for host writes. A valid addr is the starting addr for a
// series of sequentail writes. An invalid addr means all writes are done.
method Action wrAddr(Bool valid, Bit#(64) addr);
// data channel for host writes
method Action wrData(Bit#(64) data, Bit#(8) byteEn, Bool last);
endinterface
interface MemLoaderIndication;
// ask host to start write data; memStartAddr is the begin addr to
// initialize memory (for sanity check at host side)
method Action start(Bit#(64) memStartAddr);
// signal that the requested series of writes is done
method Action wrDone;
endinterface
| Bluespec | 4 | faddat/Flute | src_Core/Near_Mem_VM_WB_L1_L2/src_LLCache/procs/lib/MemLoaderIF.bsv | [
"Apache-2.0"
] |
' requestfont.bmx
Import MaxGui.Drivers
Strict
AppTitle = "RequestFont() Example"
Const teststring:String = "The quick brown fox jumps over the lazy dog."
Local window:TGadget = CreateWindow(AppTitle,50,50,300,200,Null,WINDOW_TITLEBAR|WINDOW_STATUS|WINDOW_RESIZABLE)
SetMinWindowSize window, GadgetWidth(window), GadgetHeight(window)
Local label:TGadget = CreateLabel(teststring,0,0,ClientWidth(window),ClientHeight(window)-26,window)
SetGadgetLayout label, EDGE_ALIGNED, EDGE_ALIGNED, EDGE_ALIGNED, EDGE_CENTERED
Local button:TGadget = CreateButton("Select Font",0,ClientHeight(window)-26,ClientWidth(window),26,window)
SetGadgetLayout button, EDGE_ALIGNED, EDGE_ALIGNED, EDGE_CENTERED, EDGE_ALIGNED
Local font:TGUIFont
Repeat
Select WaitEvent()
Case EVENT_WINDOWCLOSE, EVENT_APPTERMINATE
End
Case EVENT_GADGETACTION
font = RequestFont(font)
If font Then
SetGadgetFont label, font
SetStatusText window,FontName(font) + ": " + Int(FontSize(font)+0.5) + "pt"
EndIf
End Select
Forever
| BlitzMax | 4 | jabdoa2/blitzmax | mod/maxgui.mod/maxgui.mod/doc/requestfont.bmx | [
"Zlib"
] |
# EDGELIB project file (edit at your own risk)
# Copyright (c) 2004-2017 Elements Interactive B.V.
# -----------------------------------------
# General project properties
projectname = "animate3d"
caption = "Animate 3D"
vendor = "Elements Interactive B.V."
vendorshort = "EI"
domain = "nl.edgelib.sample.animate3d"
target type = "bin"
appuid = "0x10205da3"
version = "1.00.0"
capabilities = "None"
fwdependencies = "None"
selplatform = "None"
noresemu = "1"
# Project source, header and resource tree
sourcefile = "..\code\animate3d.cpp"
resourcepath = "Icons"
resourcefile = "..\res\icons\ico48_64.bmp"
resourcefile = "..\res\icons\ico48.bmp"
resourcefile = "..\res\icons\ico32.bmp"
resourcefile = "..\res\icons\ico24.bmp"
resourcefile = "..\res\icons\ico20.bmp"
resourcefile = "..\res\icons\ico16.bmp"
endpath = 1
resourcepath = "Install"
resourcefile = "..\res\turtle.png"
resourcefile = "..\res\background.jpg"
resourcefile = "..\res\block.png"
resourcefile = "..\res\turtle.ms3d"
endpath = 0
# Project environment
incpath = "."
| Ecere Projects | 2 | elementsinteractive/edgelib | samples/Animate3D/workspace_eide_edge3d/animate3d.epj | [
"BSD-3-Clause"
] |
drop table users if exists;
create table users (last_name varchar(50) not null);
| SQL | 2 | spreoW/spring-framework | spring-r2dbc/src/test/resources/org/springframework/r2dbc/connection/init/db-schema.sql | [
"Apache-2.0"
] |
fun implicitRef() {
A.x?.length
} | Groff | 1 | AndrewReitz/kotlin | jps-plugin/testData/incremental/classHierarchyAffected/companionObjectMemberChanged/companionReferenceImplicit.kt.new.2 | [
"ECL-2.0",
"Apache-2.0"
] |
// Tencent is pleased to support the open source community by making Mars available.
// Copyright (C) 2016 THL A29 Limited, a Tencent company. All rights reserved.
// Licensed under the MIT License (the "License"); you may not use this file except in
// compliance with the License. You may obtain a copy of the License at
// http://opensource.org/licenses/MIT
// Unless required by applicable law or agreed to in writing, software distributed under the License is
// distributed on an "AS IS" basis, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
// either express or implied. See the License for the specific language governing permissions and
// limitations under the License.
//
// benchmark_afnetworking_mars.m
// iOSDemo
//
// Created by zhouzhijie on 17/1/10.
// Copyright © 2017年 zhouzhijie. All rights reserved.
//
#import <Foundation/Foundation.h>
#import "benchmark_afnetworking_mars.h"
#import "Main.pb.h"
#import "CgiTask.h"
#import "NetworkService.h"
#import "CommandId.h"
#import "LogUtil.h"
#import "AFNetworking/AFNetworking.h"
@interface AFProtobufRequestSerializer : AFHTTPRequestSerializer
@end
@implementation AFProtobufRequestSerializer
- (NSURLRequest*)requestBySerializingRequest:(NSURLRequest *)request withParameters:(id)parameters error:(NSError *__autoreleasing _Nullable *)error {
NSParameterAssert(request);
if(!parameters) {
return [super requestBySerializingRequest:request withParameters:parameters error:error];
}
else {
NSMutableURLRequest* mutableReq = [request mutableCopy];
[self.HTTPRequestHeaders enumerateKeysAndObjectsUsingBlock:^(NSString * _Nonnull key, NSString * _Nonnull obj, BOOL * _Nonnull stop) {
if(![request valueForHTTPHeaderField:key]) {
[mutableReq setValue:obj forHTTPHeaderField:key];
}
}];
[mutableReq setHTTPBody:parameters];
return mutableReq;
}
}
@end
@interface BenchMark()
@property (nonatomic) UInt64 start_time;
@property (nonatomic) UInt64 task_time;
@property (nonatomic) UInt64 task_cnt;
@property (nonatomic) UInt64 task_suc;
@property (nonatomic) UInt64 suc_time;
@property (nonatomic) uint32_t scene;
@property (nonatomic) int32_t trycnt;
@end
@implementation BenchMark
@synthesize start_time;
@synthesize task_time;
@synthesize task_cnt;
@synthesize task_suc;
@synthesize suc_time;
@synthesize scene;
@synthesize trycnt;
typedef NS_ENUM(NSInteger, BenchMarkScene) {
SceneMars = 0,
SceneAF,
SceneSensitivity,
};
-(NSData*) makeDumpData:(uint32_t)_size {
char* buff = new char[_size];
NSData* dump = [[NSData alloc] initWithBytes:buff length:_size];
delete []buff;
return dump;
}
-(void) StartAfnetworkingTest {
scene = SceneAF;
NSLog(@"benchmark afnetworking start");
start_time = [[NSDate date] timeIntervalSince1970] * 1000;
task_cnt = task_suc = suc_time = 0;
trycnt = -1;
[self doAFNetworking];
}
-(void) doAFNetworking {
task_time = [[NSDate date] timeIntervalSince1970] * 1000;
AFHTTPSessionManager* manager = [AFHTTPSessionManager manager];
manager.requestSerializer = [AFProtobufRequestSerializer serializer];
manager.responseSerializer = [AFHTTPResponseSerializer serializer];
[manager.requestSerializer setValue:@"application/octet-stream" forHTTPHeaderField:@"Content-Type"];
manager.responseSerializer.acceptableContentTypes = [NSSet setWithObjects:@"application/octet-stream", nil];
//Benchmark scene: 64KB,128KB request test
//HelloRequest* helloRequest = [[[[[HelloRequest builder] setUser:@"afnetworking"] setText:@"hello afnetworking"] setDumpContent:[self makeDumpData:128*1024]] build];
HelloRequest* helloRequest = [[[[HelloRequest builder] setUser:@"afnetworking"] setText:@"hello afnetworking"] build];
[manager POST:@"http://118.89.24.72:8080/mars/hello2" parameters:[helloRequest data] progress:nil success:^(NSURLSessionDataTask * _Nonnull task, id _Nullable responseObject) {
NSData* data = (NSData*)responseObject;
[self onTaskEnd:true data:data];
} failure:^(NSURLSessionDataTask * _Nullable task, NSError * _Nonnull error) {
[self onTaskEnd:false data:nil];
}];
}
-(void) onTaskEnd:(bool)bOK data:(NSData*)data {
UInt64 curr = [[NSDate date] timeIntervalSince1970] * 1000;
UInt64 cost = curr - task_time;
++task_cnt;
if(bOK) {
task_suc++;
suc_time += cost;
//HelloResponse* resp = [HelloResponse parseFromData:data];
//NSLog(@"benchmark afnetworking type:%d suc cost:%llu, cnt:%llu,suc cnt:%llu, ctn:%@, total: %llu", type, (curr - task_time), task_cnt, task_suc, [resp errmsg], (curr - start_time));
}
else
NSLog(@"benchmark afnetworking fail cnt:%llu, cost:%llu", task_cnt, cost);
if((task_suc%50) == 0) {
UInt64 curr = [[NSDate date] timeIntervalSince1970] * 1000;
NSLog(@"benchmark afnetworking total:%llu, avg:%llu, suc_rate:%f, suc_cnt:%llu, count:%llu", (curr - start_time), (suc_time)/task_suc, task_suc/(double)task_cnt, task_suc, task_cnt);
}
if(task_suc >= 500) {
UInt64 curr = [[NSDate date] timeIntervalSince1970] * 1000;
NSLog(@"benchmark afnetworking total:%llu, avg:%llu, suc_rate:%f, suc:%llu", (curr - start_time), (suc_time)/task_suc, task_suc/(double)task_cnt, task_suc);
return;
}
[self doAFNetworking];
}
-(void) StartMarsTest {
scene = SceneMars;
NSLog(@"benchmark mars start");
start_time = [[NSDate date] timeIntervalSince1970] * 1000;
task_time = [[NSDate date] timeIntervalSince1970] * 1000;
task_cnt = task_suc = suc_time = 0;
CGITask *helloCGI = [[CGITask alloc] initAll:ChannelType_ShortConn AndCmdId:kSayHello2 AndCGIUri:@"/mars/hello2" AndHost:@"118.89.24.72"];
[[NetworkService sharedInstance] startTask:helloCGI ForUI:self];
}
- (int)onTaskEnd:(uint32_t)tid errType:(uint32_t)errtype errCode:(uint32_t)errcode {
UInt64 curr = [[NSDate date] timeIntervalSince1970] * 1000;
if(scene == SceneSensitivity) {
NSLog(@"benchmark mars errtype:%d, errcode:%d, cost:%f", errtype, errcode, ([[NSDate date] timeIntervalSince1970] * 1000 - task_time));
return 0;
}
task_cnt++;
if(errtype == 0 && errcode == 0) {
task_suc++;
suc_time += curr - task_time;
//NSLog(@"benchmark mars suc cost:%llu, cnt:%llu, suc cnt:%llu, total:%llu", (curr - task_time), task_cnt, task_suc, (curr - start_time));
} else {
NSLog(@"benchmark mars fail cnt:%llu, cost:%llu, errtype:%d, errcode:%d", task_cnt, (curr-task_time), errtype, errcode);
}
if((task_suc%50) == 0) {
NSLog(@"benchmark mars total:%llu, avg:%llu, suc_rate:%f, suc:%llu, cnt:%llu", (curr - start_time), (suc_time)/task_suc, task_suc/(double)task_cnt, task_suc, task_cnt);
}
if(task_suc >= 500) {
NSLog(@"benchmark mars final total:%llu, avg:%llu, suc_rate:%f, suc:%llu", (curr - start_time), (suc_time)/task_suc, task_suc/(double)task_cnt, task_suc);
return 0;
}
task_time = [[NSDate date] timeIntervalSince1970] * 1000;
CGITask *helloCGI = [[CGITask alloc] initAll:ChannelType_ShortConn AndCmdId:kSayHello2 AndCGIUri:@"/mars/hello2" AndHost:@"118.89.24.72"];
[[NetworkService sharedInstance] startTask:helloCGI ForUI:self];
return 0;
}
-(NSData*)requestSendData {
HelloRequest* helloRequest = [[[[HelloRequest builder] setUser:@"anonymous"] setText:@"Hello world!"] build];
//Benchmark scene: 64KB,128KB request test
//HelloRequest* helloRequest = [[[[[HelloRequest builder] setUser:@"mars"] setText:@"Hello mars!"] setDumpContent:[self makeDumpData:128*1024]] build];
NSData* data = [helloRequest data];
return data;
}
-(int)onPostDecode:(NSData*)responseData {
//HelloResponse* helloResponse = [HelloResponse parseFromData:responseData];
return 0;
}
/*
* benchmark scene: sensitivity test
* step 1: set network 100% Loss
* step 2: after 5s, 10s, 15s....40s, set network available
* step 3: compare the cgi result
*/
-(void) StartSensitivityTest {
NSLog(@"start sensitivity test");
scene = SceneSensitivity;
UInt64 time = [[NSDate date] timeIntervalSince1970] * 1000;
AFHTTPSessionManager* manager = [AFHTTPSessionManager manager];
manager.requestSerializer = [AFHTTPRequestSerializer serializer];
manager.responseSerializer = [AFHTTPResponseSerializer serializer];
[manager.requestSerializer setValue:@"application/octet-stream" forHTTPHeaderField:@"Content-Type"];
manager.responseSerializer.acceptableContentTypes = [NSSet setWithObjects:@"application/octet-stream", nil];
[manager POST:@"http://118.89.24.72:8080/mars/hello2" parameters:nil progress:nil success:^(NSURLSessionDataTask * _Nonnull task, id _Nullable responseObject) {
NSLog(@"benchmark afnetworking suc:%f", ([[NSDate date] timeIntervalSince1970] * 1000 - time));
} failure:^(NSURLSessionDataTask * _Nullable task, NSError * _Nonnull error) {
NSLog(@"benchmark afnetworking fail:%f", ([[NSDate date] timeIntervalSince1970] * 1000 - time));
}];
task_time = [[NSDate date] timeIntervalSince1970] * 1000;
CGITask *helloCGI = [[CGITask alloc] initAll:ChannelType_ShortConn AndCmdId:kSayHello2 AndCGIUri:@"/mars/hello2" AndHost:@"118.89.24.72"];
[[NetworkService sharedInstance] startTask:helloCGI ForUI:self];
}
@end
| Objective-C++ | 4 | jonetomtom/mars | samples/benchmark/benchmark_afnetworking_mars.mm | [
"BSD-2-Clause",
"Apache-2.0"
] |
#tag Class
Protected Class AVAudioRecorder
Inherits NSObject
#tag Method, Flags = &h0
Function AveragePowerForChannel(channelNumber as UInteger) As Double
declare function averagePowerForChannel_ lib AVFoundationLib selector "averagePowerForChannel:" (obj_id as ptr, channelNumber as UInteger) as Double
Return (averagePowerForChannel_(self, channelNumber))
End Function
#tag EndMethod
#tag Method, Flags = &h21
Private Shared Function ClassRef() As Ptr
static ref as ptr = NSClassFromString("AVAudioRecorder")
return ref
End Function
#tag EndMethod
#tag Method, Flags = &h0
Sub Constructor(url as NSURL, settings as NSDictionary, byref outError as NSError)
declare function initWithURL_ lib AVFoundationLib selector "initWithURL:settings:error:" (obj_id as ptr, url as ptr, settings as ptr, byref outError as ptr) as ptr
dim err as ptr
Super.Constructor( initWithURL_(Allocate(ClassRef), url, settings, err) )
if err <> nil then
outError = new Foundation.NSError(err)
end if
dim target as ptr = Initialize(Allocate(TargetClass))
if dispatch = nil then dispatch = new xojo.Core.Dictionary
dispatch.Value(target) = xojo.core.WeakRef.Create(self)
mdelegate = target
needsExtraRelease = True
End Sub
#tag EndMethod
#tag Method, Flags = &h0
Function DeleteRecording() As Boolean
declare function deleteRecording_ lib AVFoundationLib selector "deleteRecording" (obj_id as ptr) as Boolean
Return deleteRecording_(self)
End Function
#tag EndMethod
#tag Method, Flags = &h21
Private Sub HandleEncodeError(err as Foundation.NSError)
RaiseEvent EncodeError(err)
End Sub
#tag EndMethod
#tag Method, Flags = &h21
Private Sub HandleFinishedRecording(successfully as Boolean)
RaiseEvent FinishedRecording(successfully)
End Sub
#tag EndMethod
#tag Method, Flags = &h21
Private Shared Sub impl_didFinishRecording(pid as ptr, sel as ptr, player as ptr, success as Boolean)
dim w as xojo.Core.WeakRef = xojo.core.WeakRef(dispatch.Value(pid))
if w.Value <> nil Then
AVAudioRecorder(w.Value).HandleFinishedRecording(success)
end if
#Pragma unused sel
#Pragma unused player
End Sub
#tag EndMethod
#tag Method, Flags = &h21
Private Shared Sub impl_encodeError(pid as ptr, sel as ptr, player as ptr, err as ptr)
dim error as Foundation.NSError
if err<> nil then
error = new Foundation.NSError(err)
end if
dim w as xojo.Core.WeakRef = xojo.core.WeakRef(dispatch.Value(pid))
if w.Value <> nil Then
AVAudioRecorder(w.Value).HandleEncodeError(error)
end if
#Pragma unused sel
#Pragma unused player
End Sub
#tag EndMethod
#tag Method, Flags = &h0
Sub Pause()
declare sub pause_ lib AVFoundationLib selector "pause" (obj_id as ptr)
pause_(self)
End Sub
#tag EndMethod
#tag Method, Flags = &h0
Function PeakPowerForChannel(channelNumber as UInteger) As Double
declare function peakPowerForChannel_ lib AVFoundationLib selector "peakPowerForChannel:" (obj_id as ptr, channelNumber as UInteger) as Double
Return (peakPowerForChannel_(self, channelNumber))
End Function
#tag EndMethod
#tag Method, Flags = &h0
Function PrepareToRecord() As Boolean
declare function prepareToRecord_ lib AVFoundationLib selector "prepareToRecord" (obj_id as ptr) as Boolean
Return prepareToRecord_(self)
End Function
#tag EndMethod
#tag Method, Flags = &h0
Function Record() As Boolean
declare function record_ lib AVFoundationLib selector "record" (obj_id as ptr) as Boolean
Return record_(self)
End Function
#tag EndMethod
#tag Method, Flags = &h0
Function RecordAtTime(time as double) As Boolean
declare function recordAtTime_ lib AVFoundationLib selector "recordAtTime:" (obj_id as ptr, time as Double) as Boolean
Return recordAtTime_(self, time)
End Function
#tag EndMethod
#tag Method, Flags = &h0
Function RecordAtTimeForDuration(time as double, duration as double) As Boolean
declare function recordAtTime_ lib AVFoundationLib selector "recordAtTime:forDuration:" (obj_id as ptr, time as double, duration as Double) as Boolean
Return recordAtTime_(self, time, duration)
End Function
#tag EndMethod
#tag Method, Flags = &h0
Function RecordForDuration(duration as double) As Boolean
declare function recordForDuration_ lib AVFoundationLib selector "recordForDuration:" (obj_id as ptr, duration as Double) as Boolean
Return recordForDuration_(self, duration)
End Function
#tag EndMethod
#tag Method, Flags = &h0
Sub Stop()
declare sub stop_ lib AVFoundationLib selector "stop" (obj_id as ptr)
stop_(self)
End Sub
#tag EndMethod
#tag Method, Flags = &h21
Private Shared Function TargetClass() As Ptr
static targetID as ptr
if targetID = Nil then
using UIKit
dim methods() as TargetClassMethodHelper
//delegate methods
methods.Append new TargetClassMethodHelper("audioRecorderEncodeErrorDidOccur:error:", AddressOf impl_encodeError, "v@:@@")
methods.Append new TargetClassMethodHelper("audioRecorderDidFinishRecording:successfully:", AddressOf impl_didFinishRecording, "v@:@B")
targetID = BuildTargetClass("NSObject","MyAVAudioRecorderDel",methods)
end if
Return targetID
End Function
#tag EndMethod
#tag Method, Flags = &h0
Sub UpdateMeters()
declare sub updateMeters_ lib AVFoundationLib selector "updateMeters" (obj_id as ptr)
updateMeters_(self)
End Sub
#tag EndMethod
#tag Hook, Flags = &h0
Event EncodeError(err as Foundation.NSError)
#tag EndHook
#tag Hook, Flags = &h0
Event FinishedRecording(successfully as Boolean)
#tag EndHook
#tag ComputedProperty, Flags = &h0
#tag Getter
Get
declare function channelAssignments_ lib AVFoundationLib selector "channelAssignments" (obj_id as ptr) as ptr
Return new NSArray(channelAssignments_(self))
End Get
#tag EndGetter
#tag Setter
Set
declare sub channelAssignments_ lib AVFoundationLib selector "setChannelAssignments:" (obj_id as ptr, channelAssignments as ptr)
channelAssignments_(self, value)
End Set
#tag EndSetter
channelAssignments As NSArray
#tag EndComputedProperty
#tag ComputedProperty, Flags = &h0
#tag Getter
Get
declare function currentTime_ lib AVFoundationLib selector "currentTime" (obj_id as ptr) as Double
Return (currentTime_(self))
End Get
#tag EndGetter
currentTime As double
#tag EndComputedProperty
#tag ComputedProperty, Flags = &h0
#tag Getter
Get
declare function deviceCurrentTime_ lib AVFoundationLib selector "deviceCurrentTime" (obj_id as ptr) as Double
Return (deviceCurrentTime_(self))
End Get
#tag EndGetter
deviceCurrentTime As double
#tag EndComputedProperty
#tag Property, Flags = &h21
Private Shared dispatch As xojo.Core.Dictionary
#tag EndProperty
#tag ComputedProperty, Flags = &h0
#tag Getter
Get
declare function delegate_ lib AVFoundationLib selector "delegate" (obj_id as ptr) as ptr
Return (delegate_(self))
End Get
#tag EndGetter
#tag Setter
Set
declare sub delegate_ lib AVFoundationLib selector "setDelegate:" (obj_id as ptr, del as ptr)
delegate_(self, value)
End Set
#tag EndSetter
mdelegate As ptr
#tag EndComputedProperty
#tag ComputedProperty, Flags = &h0
#tag Getter
Get
declare function meteringEnabled_ lib AVFoundationLib selector "isMeteringEnabled" (obj_id as ptr) as Boolean
Return meteringEnabled_(self)
End Get
#tag EndGetter
#tag Setter
Set
declare sub meteringEnabled_ lib AVFoundationLib selector "setMeteringEnabled:" (obj_id as ptr, meteringEnabled as Boolean)
meteringEnabled_(self, value)
End Set
#tag EndSetter
meteringEnabled As Boolean
#tag EndComputedProperty
#tag ComputedProperty, Flags = &h0
#tag Getter
Get
declare function recording_ lib AVFoundationLib selector "isRecording" (obj_id as ptr) as Boolean
Return recording_(self)
End Get
#tag EndGetter
recording As Boolean
#tag EndComputedProperty
#tag ComputedProperty, Flags = &h0
#tag Getter
Get
declare function settings_ lib AVFoundationLib selector "settings" (obj_id as ptr) as ptr
Return new NSDictionary(settings_(self))
End Get
#tag EndGetter
settings As NSDictionary
#tag EndComputedProperty
#tag ComputedProperty, Flags = &h0
#tag Getter
Get
declare function url_ lib AVFoundationLib selector "url" (obj_id as ptr) as ptr
Return new NSURL(url_(self))
End Get
#tag EndGetter
url As NSURL
#tag EndComputedProperty
#tag ViewBehavior
#tag ViewProperty
Name="currentTime"
Visible=false
Group="Behavior"
InitialValue=""
Type="double"
EditorType=""
#tag EndViewProperty
#tag ViewProperty
Name="deviceCurrentTime"
Visible=false
Group="Behavior"
InitialValue=""
Type="double"
EditorType=""
#tag EndViewProperty
#tag ViewProperty
Name="Index"
Visible=true
Group="ID"
InitialValue="-2147483648"
Type="Integer"
EditorType=""
#tag EndViewProperty
#tag ViewProperty
Name="Left"
Visible=true
Group="Position"
InitialValue="0"
Type="Integer"
EditorType=""
#tag EndViewProperty
#tag ViewProperty
Name="meteringEnabled"
Visible=false
Group="Behavior"
InitialValue=""
Type="Boolean"
EditorType=""
#tag EndViewProperty
#tag ViewProperty
Name="Name"
Visible=true
Group="ID"
InitialValue=""
Type="String"
EditorType=""
#tag EndViewProperty
#tag ViewProperty
Name="recording"
Visible=false
Group="Behavior"
InitialValue=""
Type="Boolean"
EditorType=""
#tag EndViewProperty
#tag ViewProperty
Name="Super"
Visible=true
Group="ID"
InitialValue=""
Type="String"
EditorType=""
#tag EndViewProperty
#tag ViewProperty
Name="Top"
Visible=true
Group="Position"
InitialValue="0"
Type="Integer"
EditorType=""
#tag EndViewProperty
#tag EndViewBehavior
End Class
#tag EndClass
| Xojo | 3 | kingj5/iOSKit | Modules/AVFoundation/AVAudioRecorder.xojo_code | [
"MIT"
] |
<!doctype html>
<html>
<body>
<h6 class="border-bottom border-gray pb-2 mb-0">Something went wrong</h6>
<div class="media text-muted pt-3">
<i class="fas fa-door-closed fa-2x fa-fw mr-2 spring-green" data-fa-transform="shrink-4"></i>
<p class="media-body pb-3 mb-0 small lh-125 border-bottom border-gray">
An error occurred
</p>
</div>
<body>
</html> | HTML | 2 | DBatOWL/tutorials | spring-security-modules/spring-security-saml/src/main/resources/templates/error.html | [
"MIT"
] |
//
// This file is part of the Simutrans project under the Artistic License.
// (see LICENSE.txt)
//
//
// Tests for bridge building / removal
//
function test_way_bridge_build_ground()
{
local pl = player_x(0)
local bridge_desc = bridge_desc_x.get_available_bridges(wt_road)[0]
local remover = command_x(tool_remove_way)
ASSERT_TRUE(bridge_desc != null)
// build bridge on flat ground
ASSERT_EQUAL(command_x.build_bridge(pl, coord3d(3, 5, 0), coord3d(3, 2, 0), bridge_desc), null)
ASSERT_WAY_PATTERN(wt_road, coord3d(0, 0, 0),
[
"........",
"...4....",
"...5....",
"...0....",
"...0....",
"...5....",
"...1....",
"........"
])
ASSERT_WAY_PATTERN(wt_road, coord3d(0, 0, 1),
[
"........",
"...4....",
"...5....",
"...5....",
"...5....",
"...5....",
"...1....",
"........"
])
// build bridge over bridgehead (should fail)
ASSERT_EQUAL(command_x.build_bridge(pl, coord3d(2, 2, 0), coord3d(4, 2, 0), bridge_desc), "")
ASSERT_WAY_PATTERN(wt_road, coord3d(0, 0, 1),
[
"........",
"...4....",
"...5....",
"...5....",
"...5....",
"...5....",
"...1....",
"........"
])
// build bridgehead slope under bridge (should fail)
ASSERT_EQUAL(command_x.build_bridge(pl, coord3d(3, 3, 0), coord3d(5, 3, 0), bridge_desc), "")
ASSERT_WAY_PATTERN(wt_road, coord3d(0, 0, 1),
[
"........",
"...4....",
"...5....",
"...5....",
"...5....",
"...5....",
"...1....",
"........"
])
// build bridge crossing (should fail)
ASSERT_EQUAL(command_x.build_bridge(pl, coord3d(3, 4, 0), coord3d(5, 4, 0), bridge_desc), "")
ASSERT_WAY_PATTERN(wt_road, coord3d(0, 0, 1),
[
"........",
"...4....",
"...5....",
"...5....",
"...5....",
"...5....",
"...1....",
"........"
])
ASSERT_EQUAL(remover.work(pl, tile_x(3, 1, 0), tile_x(3, 6, 0), "" + wt_road), null)
ASSERT_WAY_PATTERN(wt_road, coord3d(0, 0, 0),
[
"........",
"........",
"........",
"........",
"........",
"........",
"........",
"........"
])
}
function test_way_bridge_build_at_slope()
{
local start_pos = coord3d(2, 1, 0)
local end_pos = coord3d(2, 6, 0)
local remover = command_x(tool_remove_way)
local setslope = command_x(tool_setslope)
local pl = player_x(0)
local bridge_desc = bridge_desc_x.get_available_bridges(wt_road)[0]
ASSERT_EQUAL(setslope.work(pl, coord3d(2, 1, 0), "" + slope.south), null)
{
// down slope
local err = command_x.build_bridge_at(pl, start_pos, bridge_desc)
ASSERT_EQUAL(err, "Bridge is too long for this type!\n")
ASSERT_WAY_PATTERN(wt_road, coord3d(0, 0, 1),
[
"........",
"........",
"........",
"........",
"........",
"........",
"........",
"........"
])
}
{
// wrong single-height slope
ASSERT_EQUAL(setslope.work(pl, end_pos, "" + slope.west), null)
local err = command_x.build_bridge_at(pl, start_pos, bridge_desc)
ASSERT_EQUAL(err, "A bridge must start on a way!")
ASSERT_WAY_PATTERN(wt_road, coord3d(0, 0, 1),
[
"........",
"........",
"........",
"........",
"........",
"........",
"........",
"........"
])
}
{
// double height slope
ASSERT_EQUAL(setslope.work(pl, end_pos, "" + 2*slope.north), null)
local err = command_x.build_bridge_at(pl, start_pos, bridge_desc)
ASSERT_EQUAL(err, "Cannot connect to the\ncenter of a double slope!")
ASSERT_WAY_PATTERN(wt_road, coord3d(0, 0, 1),
[
"........",
"........",
"........",
"........",
"........",
"........",
"........",
"........"
])
}
{
// wrong double height slope
ASSERT_EQUAL(setslope.work(pl, end_pos, "" + 2*slope.west), null)
local err = command_x.build_bridge_at(pl, start_pos, bridge_desc)
ASSERT_EQUAL(err, "Cannot connect to the\ncenter of a double slope!")
ASSERT_WAY_PATTERN(wt_road, coord3d(0, 0, 1),
[
"........",
"........",
"........",
"........",
"........",
"........",
"........",
"........"
])
}
{
// flat double height slope (i.e. 2 stacked flat slopes)
ASSERT_EQUAL(setslope.work(pl, end_pos, "" + slope.all_up_slope), null)
ASSERT_EQUAL(setslope.work(pl, end_pos + coord3d(0, 0, 1), "" + slope.all_up_slope), null)
local err = command_x.build_bridge_at(pl, start_pos, bridge_desc)
ASSERT_EQUAL(err, "Cannot connect to the\ncenter of a double slope!")
ASSERT_WAY_PATTERN(wt_road, coord3d(0, 0, 1),
[
"........",
"........",
"........",
"........",
"........",
"........",
"........",
"........"
])
ASSERT_EQUAL(setslope.work(pl, end_pos + coord3d(0, 0, 2), "" + slope.all_down_slope), null)
ASSERT_EQUAL(setslope.work(pl, end_pos + coord3d(0, 0, 1), "" + slope.all_down_slope), null)
}
{
// flat single height slope
ASSERT_EQUAL(setslope.work(pl, end_pos, "" + slope.all_up_slope), null)
local err = command_x.build_bridge_at(pl, start_pos, bridge_desc)
ASSERT_EQUAL(err, null)
ASSERT_WAY_PATTERN(wt_road, coord3d(0, 0, 1),
[
"........",
"..4.....",
"..5.....",
"..5.....",
"..5.....",
"..5.....",
"..1.....",
"........"
])
// remove way
ASSERT_EQUAL(remover.work(pl, start_pos, end_pos + coord3d(0, 0, 1), "" + wt_road), null)
// remove slope
ASSERT_EQUAL(setslope.work(pl, end_pos + coord3d(0, 0, 1), "" + slope.all_down_slope), null)
}
{
// correct slope
setslope.work(pl, end_pos, "" + slope.north)
local err = command_x.build_bridge_at(pl, start_pos, bridge_desc)
ASSERT_EQUAL(err, null)
ASSERT_WAY_PATTERN(wt_road, coord3d(0, 0, 1),
[
"........",
"..4.....",
"..5.....",
"..5.....",
"..5.....",
"..5.....",
"..1.....",
"........"
])
// remove way
ASSERT_EQUAL(remover.work(pl, start_pos, end_pos, "" + wt_road), null)
// remove slope
ASSERT_EQUAL(setslope.work(pl, end_pos, "" + slope.flat), null)
}
// clean up
ASSERT_EQUAL(setslope.work(pl, start_pos, "" + slope.flat), null)
RESET_ALL_PLAYER_FUNDS()
}
function test_way_bridge_build_at_slope_stacked()
{
local remover = command_x(tool_remove_way)
local setslope = command_x(tool_setslope)
local pl = player_x(0)
local bridge_desc = bridge_desc_x.get_available_bridges(wt_road)[0]
{
ASSERT_EQUAL(setslope.work(pl, coord3d(3, 2, 0), "" + slope.south), null)
ASSERT_EQUAL(setslope.work(pl, coord3d(3, 5, 0), "" + slope.north), null)
ASSERT_EQUAL(command_x.build_bridge_at(pl, coord3d(3, 2, 0), bridge_desc), null)
ASSERT_WAY_PATTERN(wt_road, coord3d(0, 0, 1),
[
"........",
"........",
"...4....",
"...5....",
"...5....",
"...1....",
"........",
"........"
])
// second bridge layer
ASSERT_EQUAL(setslope.work(pl, coord3d(3, 1, 0), "" + slope.all_up_slope), null)
ASSERT_EQUAL(setslope.work(pl, coord3d(3, 1, 1), "" + slope.south), null)
ASSERT_EQUAL(setslope.work(pl, coord3d(3, 6, 0), "" + slope.all_up_slope), null)
ASSERT_EQUAL(setslope.work(pl, coord3d(3, 6, 1), "" + slope.north), null)
ASSERT_EQUAL(command_x.build_bridge_at(pl, coord3d(3, 1, 1), bridge_desc), null)
ASSERT_WAY_PATTERN(wt_road, coord3d(0, 0, 1),
[
"........",
"...4....",
"...4....",
"...5....",
"...5....",
"...1....",
"...1....",
"........"
])
ASSERT_WAY_PATTERN(wt_road, coord3d(0, 0, 2),
[
"........",
"...4....",
"...5....",
"...5....",
"...5....",
"...5....",
"...1....",
"........"
])
}
{
// remove lower bridge and rebuild it
ASSERT_EQUAL(remover.work(pl, coord3d(3, 2, 0), coord3d(3, 5, 0), "" + wt_road), null)
ASSERT_EQUAL(command_x.build_bridge_at(pl, coord3d(3, 2, 0), bridge_desc), null)
ASSERT_WAY_PATTERN(wt_road, coord3d(0, 0, 1),
[
"........",
"...4....",
"...4....",
"...5....",
"...5....",
"...1....",
"...1....",
"........"
])
ASSERT_WAY_PATTERN(wt_road, coord3d(0, 0, 2),
[
"........",
"...4....",
"...5....",
"...5....",
"...5....",
"...5....",
"...1....",
"........"
])
ASSERT_EQUAL(remover.work(pl, coord3d(3, 1, 1), coord3d(3, 6, 1), "" + wt_road), null)
ASSERT_EQUAL(setslope.work(pl, coord3d(3, 1, 1), "" + slope.flat), null)
ASSERT_EQUAL(setslope.work(pl, coord3d(3, 6, 1), "" + slope.flat), null)
ASSERT_EQUAL(setslope.work(pl, coord3d(3, 1, 1), "" + slope.all_down_slope), null)
ASSERT_EQUAL(setslope.work(pl, coord3d(3, 6, 1), "" + slope.all_down_slope), null)
}
{
// second bridge layer
ASSERT_EQUAL(setslope.work(pl, coord3d(1, 3, 0), "" + slope.all_up_slope), null)
ASSERT_EQUAL(setslope.work(pl, coord3d(1, 3, 1), "" + slope.east), null)
ASSERT_EQUAL(setslope.work(pl, coord3d(6, 3, 0), "" + slope.all_up_slope), null)
ASSERT_EQUAL(setslope.work(pl, coord3d(6, 3, 1), "" + slope.west), null)
ASSERT_EQUAL(command_x.build_bridge_at(pl, coord3d(1, 3, 1), bridge_desc), null)
ASSERT_WAY_PATTERN(wt_road, coord3d(0, 0, 1),
[
"........",
"........",
"...4....",
".2.5..8.",
"...5....",
"...1....",
"........",
"........"
])
ASSERT_WAY_PATTERN(wt_road, coord3d(0, 0, 2),
[
"........",
"........",
"...4....",
".2AAAA8.",
"........",
"...1....",
"........",
"........"
])
}
{
// remove lower bridge and rebuild it
ASSERT_EQUAL(remover.work(pl, coord3d(3, 5, 0), coord3d(3, 2, 0), "" + wt_road), null)
ASSERT_EQUAL(command_x.build_bridge_at(pl, coord3d(3, 5, 0), bridge_desc), null)
ASSERT_WAY_PATTERN(wt_road, coord3d(0, 0, 1),
[
"........",
"........",
"...4....",
".2.5..8.",
"...5....",
"...1....",
"........",
"........"
])
ASSERT_WAY_PATTERN(wt_road, coord3d(0, 0, 2),
[
"........",
"........",
"...4....",
".2AAAA8.",
"........",
"...1....",
"........",
"........"
])
}
// clean up
ASSERT_EQUAL(remover.work(pl, coord3d(3, 2, 0), coord3d(3, 5, 0), "" + wt_road), null)
ASSERT_EQUAL(remover.work(pl, coord3d(1, 3, 1), coord3d(6, 3, 1), "" + wt_road), null)
ASSERT_EQUAL(setslope.work(pl, coord3d(1, 3, 1), "" + slope.all_down_slope), null)
ASSERT_EQUAL(setslope.work(pl, coord3d(1, 3, 1), "" + slope.all_down_slope), null)
ASSERT_EQUAL(setslope.work(pl, coord3d(6, 3, 1), "" + slope.all_down_slope), null)
ASSERT_EQUAL(setslope.work(pl, coord3d(6, 3, 1), "" + slope.all_down_slope), null)
ASSERT_EQUAL(setslope.work(pl, coord3d(3, 2, 0), "" + slope.all_down_slope), null)
ASSERT_EQUAL(setslope.work(pl, coord3d(3, 5, 0), "" + slope.all_down_slope), null)
RESET_ALL_PLAYER_FUNDS()
}
// TODO Try to build bridge when way_height_clearance == 2
function test_way_bridge_build_above_way()
{
local remover = command_x(tool_remove_way)
local setslope = command_x(tool_setslope)
local pl = player_x(0)
local bridge_desc = bridge_desc_x.get_available_bridges(wt_road)[0]
local way_desc = way_desc_x.get_available_ways(wt_road, st_flat)[0]
ASSERT_TRUE(bridge_desc != null)
ASSERT_TRUE(way_desc != null)
{
ASSERT_EQUAL(setslope.work(pl, coord3d(3, 2, 0), "" + slope.south), null)
ASSERT_EQUAL(setslope.work(pl, coord3d(3, 5, 0), "" + slope.north), null)
ASSERT_EQUAL(command_x.build_way(pl, coord3d(2, 3, 0), coord3d(4, 3, 0), way_desc, true), null)
ASSERT_EQUAL(command_x.build_bridge_at(pl, coord3d(3, 2, 0), bridge_desc), null)
ASSERT_WAY_PATTERN(wt_road, coord3d(0, 0, 0),
[
"........",
"........",
"...4....",
"..2A8...",
"........",
"...1....",
"........",
"........"
])
ASSERT_WAY_PATTERN(wt_road, coord3d(0, 0, 1),
[
"........",
"........",
"...4....",
"...5....",
"...5....",
"...1....",
"........",
"........"
])
}
{
// remove way, rebuild it under bridge
ASSERT_EQUAL(remover.work(pl, coord3d(2, 3, 0), coord3d(4, 3, 0), "" + wt_road), null)
ASSERT_EQUAL(command_x.build_way(pl, coord3d(2, 3, 0), coord3d(4, 3, 0), way_desc, true), null)
}
ASSERT_EQUAL(remover.work(pl, coord3d(2, 3, 0), coord3d(4, 3, 0), "" + wt_road), null)
ASSERT_EQUAL(remover.work(pl, coord3d(3, 2, 0), coord3d(3, 5, 0), "" + wt_road), null)
ASSERT_EQUAL(setslope.work(pl, coord3d(3, 2, 0), "" + slope.all_down_slope), null)
ASSERT_EQUAL(setslope.work(pl, coord3d(3, 5, 0), "" + slope.all_down_slope), null)
RESET_ALL_PLAYER_FUNDS()
}
function test_way_bridge_build_above_runway()
{
local pl = player_x(0)
local wayremover = command_x(tool_remove_way)
local taxiway = way_desc_x.get_available_ways(wt_air, st_flat)[0]
local runway = way_desc_x.get_available_ways(wt_air, st_elevated)[0]
local bridge = bridge_desc_x.get_available_bridges(wt_road)[0]
local setslope = command_x(tool_setslope)
// preconditions
// build bridge across taxiway
{
ASSERT_EQUAL(command_x.build_way(pl, coord3d(7, 7, 0), coord3d(7, 9, 0), taxiway, true), null)
ASSERT_EQUAL(command_x.build_bridge(pl, coord3d(6, 8, 0), coord3d(8, 8, 0), bridge), null)
ASSERT_WAY_PATTERN(wt_air, coord3d(5, 5, 0),
[
"........",
"........",
"..4.....",
"..5.....",
"..1.....",
"........",
"........",
"........"
])
ASSERT_WAY_PATTERN(wt_road, coord3d(5, 5, 0),
[
"........",
"........",
"........",
"2A.A8...",
"........",
"........",
"........",
"........"
])
ASSERT_EQUAL(wayremover.work(pl, coord3d(7, 7, 0), coord3d(7, 9, 0), "" + wt_air), null)
ASSERT_EQUAL(wayremover.work(pl, coord3d(5, 8, 0), coord3d(9, 8, 0), "" + wt_road), null)
}
// build bridge across runway, should fail
{
ASSERT_EQUAL(command_x.build_way(pl, coord3d(7, 7, 0), coord3d(7, 9, 0), runway, true), null)
ASSERT_EQUAL(command_x.build_bridge(pl, coord3d(6, 8, 0), coord3d(8, 8, 0), bridge), "")
ASSERT_WAY_PATTERN(wt_air, coord3d(5, 5, 0),
[
"........",
"........",
"..4.....",
"..5.....",
"..1.....",
"........",
"........",
"........"
])
ASSERT_EQUAL(wayremover.work(pl, coord3d(7, 7, 0), coord3d(7, 9, 0), "" + wt_air), null)
}
// clean up
ASSERT_EQUAL(pl.get_current_maintenance(), 0)
RESET_ALL_PLAYER_FUNDS()
}
function test_way_bridge_planner()
{
local pl = player_x(0)
local start_pos = coord3d(2, 3, 0)
local end_pos = coord3d(2, 6, 0)
local bridge_desc = bridge_desc_x.get_available_bridges(wt_road)[0]
local working_slopes = [ slope.north ] // maybe also slope.south in the future
ASSERT_EQUAL(command_x.set_slope(pl, start_pos, slope.south), null)
{
for (local sl = slope.flat; sl < slope.raised; ++sl) {
command_x.set_slope(pl, end_pos, sl)
local end = bridge_planner_x.find_end(pl, start_pos, dir.south, bridge_desc, 0)
local expected_end = (working_slopes.find(sl) != null) ? end_pos : coord3d(-1, -1, -1)
ASSERT_EQUAL(end.tostring(), expected_end.tostring())
}
ASSERT_EQUAL(command_x.set_slope(pl, end_pos, slope.all_up_slope), null)
local end = bridge_planner_x.find_end(pl, start_pos, dir.south, bridge_desc, 0)
ASSERT_EQUAL(end.tostring(), (end_pos + coord3d(0, 0, 1)).tostring())
// clean up
ASSERT_EQUAL(command_x.set_slope(pl, start_pos, slope.flat), null)
ASSERT_EQUAL(command_x.set_slope(pl, end_pos + coord3d(0, 0, 1), slope.all_down_slope), null)
}
// min length
{
ASSERT_EQUAL(command_x.set_slope(pl, coord3d(2, 1, 0), slope.south), null)
ASSERT_EQUAL(command_x.set_slope(pl, coord3d(3, 1, 0), slope.south), null)
ASSERT_EQUAL(command_x.set_slope(pl, coord3d(2, 2, 0), slope.north), null)
ASSERT_EQUAL(command_x.set_slope(pl, coord3d(3, 3, 0), slope.north), null)
ASSERT_EQUAL(bridge_planner_x.find_end(pl, coord3d(2, 1, 0), dir.south, bridge_desc, 0).tostring(), coord3d(2, 2, 0).tostring())
ASSERT_EQUAL(bridge_planner_x.find_end(pl, coord3d(2, 1, 0), dir.south, bridge_desc, 1).tostring(), coord3d(2, 2, 0).tostring())
ASSERT_EQUAL(bridge_planner_x.find_end(pl, coord3d(3, 1, 0), dir.south, bridge_desc, 0).tostring(), coord3d(3, 3, 0).tostring())
ASSERT_EQUAL(bridge_planner_x.find_end(pl, coord3d(3, 1, 0), dir.south, bridge_desc, 1).tostring(), coord3d(-1, -1, -1).tostring())
ASSERT_EQUAL(bridge_planner_x.find_end(pl, coord3d(3, 1, 0), dir.south, bridge_desc, 2).tostring(), coord3d(3, 3, 0).tostring())
ASSERT_EQUAL(bridge_planner_x.find_end(pl, coord3d(3, 1, 0), dir.south, bridge_desc, 3).tostring(), coord3d(-1, -1, -1).tostring())
ASSERT_EQUAL(command_x.set_slope(pl, coord3d(2, 1, 0), slope.flat), null)
ASSERT_EQUAL(command_x.set_slope(pl, coord3d(3, 1, 0), slope.flat), null)
ASSERT_EQUAL(command_x.set_slope(pl, coord3d(2, 2, 0), slope.flat), null)
ASSERT_EQUAL(command_x.set_slope(pl, coord3d(3, 3, 0), slope.flat), null)
}
ASSERT_EQUAL(pl.get_current_maintenance(), 0)
RESET_ALL_PLAYER_FUNDS()
}
| Squirrel | 5 | Andarix/simutrans_nightly | tests/tests/test_way_bridge.nut | [
"Artistic-1.0"
] |
-- Copyright 2021 Stanford University
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
-- runs-with:
-- [["-fseparate", "1", "-fjobs", "2", "-fincr-comp", "1"]]
-- FIXME: Separate compilation in JIT mode requires either incremental
-- or parallel compilation, due to a bad interaction when using the
-- LLVM JIT linker mode.
import "regent"
assert(regentlib.config["separate"], "test requires separate compilation")
-- Make sure this all happens in a temporary directory in case we're
-- running concurrently.
local tmp_dir
do
-- use os.tmpname to get a hopefully-unique directory to work in
local tmpfile = os.tmpname()
tmp_dir = tmpfile .. ".d/"
assert(os.execute("mkdir " .. tmp_dir) == 0)
os.remove(tmpfile) -- remove this now that we have our directory
end
-- Compile separate tasks.
local root_dir = arg[0]:match(".*/") or "./"
local loaders = terralib.newlist()
for part = 1, 2 do
local regent_exe = os.getenv('REGENT') or 'regent'
local tasks_rg = "separate_compilation_tasks_part" .. part .. ".rg"
assert(os.execute("cp " .. root_dir .. tasks_rg .. " " .. tmp_dir .. tasks_rg) == 0)
local tasks_h = "separate_compilation_tasks_part" .. part .. ".h"
local tasks_so = tmp_dir .. "libseparate_compilation_tasks_part" .. part .. ".so"
if os.execute(regent_exe .. " " .. tmp_dir .. tasks_rg .. " -fseparate 1") ~= 0 then
print("Error: failed to compile " .. tmp_dir .. tasks_rg)
assert(false)
end
local tasks_c = terralib.includec(tasks_h, {"-I", tmp_dir})
loaders:insert(tasks_c["separate_compilation_tasks_part" .. part .. "_h_register"])
terralib.linklibrary(tasks_so)
end
terra loader()
[loaders:map(function(thunk) return `thunk() end)]
end
struct fs {
x : int
y : int
z : int
}
extern task my_regent_task(r : region(ispace(int1d), fs), x : int, y : double, z : bool)
where reads writes(r.{x, y}), reads(r.z) end
extern task other_regent_task(r : region(ispace(int1d), fs), s : region(ispace(int1d), fs))
where reads writes(r.{x, y}, s.z), reads(r.z, s.x), reduces+(s.y) end
task main()
var r = region(ispace(int1d, 5), fs)
var s = region(ispace(int1d, 10), fs)
var pr = partition(equal, r, ispace(int1d, 4))
var ps = partition(equal, s, ispace(int1d, 4))
fill(r.{x, y, z}, 0)
fill(s.{x, y, z}, 0)
for i = 0, 4 do
my_regent_task(pr[i], 1, 2, true)
end
for i = 0, 4 do
other_regent_task(pr[i], ps[i])
end
end
regentlib.start(main, loader)
-- os.execute("rm -r " .. tmp_dir)
| Rouge | 5 | mmccarty/legion | language/examples/separate_compilation.rg | [
"Apache-2.0"
] |
(***********************************************************
BSS SOUNDWEB LONDON PROTOCOL
TESTS
Website: https://github.com/amclain/amx-lib-bss
These functions test the library's functionality.
************************************************************)
PROGRAM_NAME='bss-tests'
(***********************************************************)
(***********************************************************)
(* System Type : NetLinx *)
(***********************************************************)
(* REV HISTORY: *)
(***********************************************************)
(*
History:
*)
(***********************************************************)
(* INCLUDES GO BELOW *)
(***********************************************************)
#include 'amx-lib-bss';
(***********************************************************)
(* DEVICE NUMBER DEFINITIONS GO BELOW *)
(***********************************************************)
DEFINE_DEVICE
(***********************************************************)
(* CONSTANT DEFINITIONS GO BELOW *)
(***********************************************************)
DEFINE_CONSTANT
(***********************************************************)
(* DATA TYPE DEFINITIONS GO BELOW *)
(***********************************************************)
DEFINE_TYPE
(***********************************************************)
(* VARIABLE DEFINITIONS GO BELOW *)
(***********************************************************)
DEFINE_VARIABLE
(***********************************************************)
(* LATCHING DEFINITIONS GO BELOW *)
(***********************************************************)
DEFINE_LATCHING
(***********************************************************)
(* MUTUALLY EXCLUSIVE DEFINITIONS GO BELOW *)
(***********************************************************)
DEFINE_MUTUALLY_EXCLUSIVE
(***********************************************************)
(* SUBROUTINE/FUNCTION DEFINITIONS GO BELOW *)
(***********************************************************)
(* EXAMPLE: DEFINE_FUNCTION <RETURN_TYPE> <NAME> (<PARAMETERS>) *)
(* EXAMPLE: DEFINE_CALL '<NAME>' (<PARAMETERS>) *)
(***********************************************************)
(* STARTUP CODE GOES BELOW *)
(***********************************************************)
DEFINE_START
(***********************************************************)
(* THE EVENTS GO BELOW *)
(***********************************************************)
DEFINE_EVENT
(***********************************************************)
(* THE MAINLINE GOES BELOW *)
(***********************************************************)
DEFINE_PROGRAM
(***********************************************************)
(* END OF PROGRAM *)
(* DO NOT PUT ANY CODE BELOW THIS COMMENT *)
(***********************************************************)
| NetLinx | 2 | marselle001/amx-lib-bss | tests/bss-tests2.axs | [
"Apache-2.0"
] |
Note 0
Copyright (C) 2017 Jonathan Hough. All rights reserved.
)
NB. Capsule Layer
coclass 'CapsLayer'
coinsert 'NNLayer'v
create=: 3 : 0
'shape ks activation alpha'=: y
assert. 4 = # shape NB. wxhxdinxdout
assert. 2 3 -: $ ks
assert. alpha > 0
filter=: 1 %~ +: 0.5-~ ? shape $ 0 NB. TODO create random
a=. setActivationFunctions activation
act=: ({.a)`:6
dact=: ({:a)`:6
bias=: ''
) | J | 2 | jonghough/jlearn | adv/capslayer.ijs | [
"MIT"
] |
// Copyright (c) 2014 GitHub, Inc.
// Use of this source code is governed by the MIT license that can be
// found in the LICENSE file.
#include "shell/browser/ui/win/notify_icon.h"
#include "shell/browser/ui/win/notify_icon_host.h"
namespace electron {
// static
TrayIcon* TrayIcon::Create(absl::optional<UUID> guid) {
static NotifyIconHost host;
return host.CreateNotifyIcon(guid);
}
} // namespace electron
| C++ | 3 | TarunavBA/electron | shell/browser/ui/tray_icon_win.cc | [
"MIT"
] |
// Copyright 2010-2015 RethinkDB, all rights reserved.
#include "rdb_protocol/terms/terms.hpp"
#include "rdb_protocol/error.hpp"
#include "rdb_protocol/op.hpp"
#include "math.hpp"
namespace ql {
class var_term_t : public term_t {
public:
var_term_t(compile_env_t *env, const raw_term_t &term)
: term_t(term) {
rcheck(term.num_args() == 1, base_exc_t::LOGIC,
"A variable term has the wrong number of arguments.");
raw_term_t arg0 = term.arg(0);
rcheck(arg0.type() == Term::DATUM, base_exc_t::LOGIC,
"A variable term has a non-datum argument.");
datum_t d = arg0.datum();
rcheck(d.get_type() == datum_t::type_t::R_NUM, base_exc_t::LOGIC,
"A variable term has a non-numeric name datum.");
varname = sym_t(d.as_int());
rcheck(env->visibility.contains_var(varname), base_exc_t::LOGIC,
"Variable name not found.");
}
bool is_simple_selector() const {
return true;
}
private:
virtual void accumulate_captures(var_captures_t *captures) const {
captures->vars_captured.insert(varname);
}
virtual deterministic_t is_deterministic() const {
return deterministic_t::always();
}
sym_t varname;
virtual scoped_ptr_t<val_t> term_eval(scope_env_t *env, eval_flags_t) const {
return new_val(env->scope.lookup_var(varname));
}
virtual const char *name() const { return "var"; }
};
class implicit_var_term_t : public term_t {
public:
implicit_var_term_t(compile_env_t *env, const raw_term_t &term)
: term_t(term) {
rcheck(term.num_args() == 0 && term.num_optargs() == 0, base_exc_t::LOGIC,
"Expected no arguments or optional arguments on implicit variable term.");
rcheck(env->visibility.implicit_is_accessible(), base_exc_t::LOGIC,
env->visibility.get_implicit_depth() == 0
? "r.row is not defined in this context."
: "Cannot use r.row in nested queries. Use functions instead.");
}
bool is_simple_selector() const {
return true;
}
private:
virtual void accumulate_captures(var_captures_t *captures) const {
captures->implicit_is_captured = true;
}
virtual deterministic_t is_deterministic() const {
return deterministic_t::always();
}
virtual scoped_ptr_t<val_t> term_eval(scope_env_t *env, UNUSED eval_flags_t flags) const {
return new_val(env->scope.lookup_implicit());
}
virtual const char *name() const { return "implicit_var"; }
};
counted_t<term_t> make_var_term(
compile_env_t *env, const raw_term_t &term) {
return make_counted<var_term_t>(env, term);
}
counted_t<term_t> make_implicit_var_term(
compile_env_t *env, const raw_term_t &term) {
return make_counted<implicit_var_term_t>(env, term);
}
} // namespace ql
| C++ | 4 | zadcha/rethinkdb | src/rdb_protocol/terms/var.cc | [
"Apache-2.0"
] |
pub main
coginit(0, @entry, 0)
dat
org 0
entry
_set
add objptr, #9
rdbyte _var01, objptr
sub objptr, #5
wrlong _var01, objptr
sub objptr, #4
_set_ret
ret
objptr
long @@@objmem
COG_BSS_START
fit 496
objmem
long 0[3]
org COG_BSS_START
_var01
res 1
fit 496
| Parrot Assembly | 2 | archivest/spin2cpp | Test/Expect/stest065.pasm | [
"MIT"
] |
.Container {
width: 100%;
flex: 1;
padding: 0.5rem;
}
.PatternPath {
stroke: var(--color-commit-did-not-render-pattern);
stroke-width: 1;
}
| CSS | 4 | vegYY/react | packages/react-devtools-shared/src/devtools/views/Profiler/CommitFlamegraph.css | [
"MIT"
] |
require './assertions'
require './parserAssertions'
terms = require '../lib/parser/codeGenerator'.code generator ()
loc = {
first line 1
last line 1
first column 3
last column 8
}
describe 'macros'
describe 'if'
it 'if'
(macro expression 'if (true) @{a}') should contain fields {
is if expression
cases [{
condition = {variable ['true']}
body = {statements [{variable ['a']}]}
}]
}
it 'if else'
(macro expression 'if (true) @{a} else @{b}') should contain fields {
is if expression
else body {statements [{variable ['b']}]}
cases [{
condition = {variable ['true']}
body = {statements [{variable ['a']}]}
}]
}
it 'if else if'
(macro expression 'if (true) @{a} else if (false) @{b}') should contain fields {
is if expression
else body = undefined
cases [
{
condition = {variable ['true']}
body = {statements [{variable ['a']}]}
}
{
condition = {variable ['false']}
body = {statements [{variable ['b']}]}
}
]
}
it 'if else if else'
(macro expression 'if (true) @{a} else if (false) @{b} else @{c}') should contain fields {
is if expression
else body {statements [{variable ['c']}]}
cases [
{
condition = {variable ['true']}
body = {statements [{variable ['a']}]}
}
{
condition = {variable ['false']}
body = {statements [{variable ['b']}]}
}
]
}
it 'for'
(macro expression 'for (n = 0, n < 10, n = n + 1) @{a}') should contain fields {
is for
initialization {
is definition
source {integer 0}
target {variable ['n']}
}
test {
is operator
operator '<'
operator arguments [
{variable ['n']}
{integer 10}
]
}
increment {
is definition
target {variable ['n']}
source {
is operator
operator '+'
operator arguments [
{variable ['n']}
{integer 1}
]
}
}
statements {
is statements
statements [
{variable ['a']}
]
}
}
it 'for with return in body'
(macro expression 'for (n = 0, n < 10, n = n + 1) @{return (a)}') should contain fields {
is for
initialization {
is definition
source {integer 0}
target {variable ['n']}
}
test {
is operator
operator '<'
operator arguments [
{variable ['n']}
{integer 10}
]
}
increment {
is definition
target {variable ['n']}
source {
is operator
operator '+'
operator arguments [
{variable ['n']}
{integer 1}
]
}
}
statements {
is statements
statements [
{
is definition
source {}
target {is variable, name ['for', 'result']}
}
{
is if expression
cases [
{
condition = {
is sub expression
expression {
is function call
function {
is closure
parameters [{variable ['n']}]
body {
is statements
statements [
{
is definition
target {is variable, name ['for', 'result']}
source {variable ['a']}
}
{is return, expression {boolean = true}}
]
}
}
function arguments [{variable ['n']}]
}
}
body = {
is statements
statements [
{is return, expression {is variable, name ['for', 'result']}}
]
}
}
]
}
]
}
}
describe 'for each'
it 'generates for'
(macro statements 'for each @(item) in (items) @{item}') should contain fields {
statements [
terms.definition (terms.generated variable ['items'], terms.variable ['items'])
terms.for expression (
terms.definition (terms.generated variable ['i'], terms.integer 0)
terms.operator (
'<'
[
terms.generated variable ['i']
terms.field reference (terms.generated variable ['items'], ['length'])
]
)
terms.increment (terms.generated variable ['i'])
terms.statements [
terms.definition (
terms.variable ['item']
terms.indexer (
terms.generated variable ['items']
terms.generated variable ['i']
)
)
terms.variable ['item']
]
)
]
}
describe 'for @(item) in (items) @{}'
it 'generates for (var item in items) {}'
(macro expression 'for @(item) in (items) @{item}') should contain fields {
is for in
iterator {
is definition
target {variable ['item']}
}
collection {variable ['items']}
statements {
is sub expression
expression {
is function call
function {
is closure
parameters [{variable ['item']}]
body {
is statements
statements [
{variable ['item']}
]
}
}
function arguments [{variable ['item']}]
}
}
}
it 'while'
(macro expression 'while (n < 10) @{n}') should contain fields {
is while
condition {
is operator
operator '<'
operator arguments [
{variable ['n']}
{integer 10}
]
}
statements {
statements [
{variable ['n']}
]
}
}
describe 'try'
it 'try catch'
(macro expression 'try @{a} catch (ex) @{b}') should contain fields {
is try expression
body {
statements [
{variable ['a']}
]
}
catch body {
statements [
{variable ['b']}
]
}
catch parameter {variable ['ex']}
finally body = nil
}
it 'try finally'
(macro expression 'try @{a} finally @{b}') should contain fields {
is try expression
body {
statements [
{variable ['a']}
]
}
catch body = undefined
finally body {
statements [
{variable ['b']}
]
}
}
it 'try catch finally'
(macro expression 'try @{a} catch (ex) @{b} finally @{c}') should contain fields {
is try expression
body {
statements [
{variable ['a']}
]
}
catch body {
statements [
{variable ['b']}
]
}
catch parameter {variable ['ex']}
finally body {
statements [
{variable ['c']}
]
}
}
describe '=='
it 'generates ==='
(macro expression 'a == b') should contain fields {
is operator
operator '==='
operator arguments [
{variable ['a']}
{variable ['b']}
]
}
describe '!='
it 'generates !=='
(macro expression 'a != b') should contain fields {
is operator
operator '!=='
operator arguments [
{variable ['a']}
{variable ['b']}
]
}
describe '::'
it 'generates instanceof'
(macro expression 'a :: b') should contain fields {
is operator
operator 'instanceof'
operator arguments [
{variable ['a']}
{variable ['b']}
]
}
describe 'in'
it 'generates in'
(macro expression '(a) in (b)') should contain fields {
is operator
operator 'in'
operator arguments [
{variable ['a']}
{variable ['b']}
]
}
describe 'break'
it 'generates break statement'
(macro expression 'break') should contain fields {
is break
}
describe 'return'
it 'generates void return statement'
(macro expression 'return') should contain fields {
is return
expression = undefined
}
describe 'nil'
it 'generates void 0'
(macro expression 'nil') should contain fields {
is nil
}
describe 'JavaScript operators'
it generates unary (op) =
it "generates unary #(op)"
(macro expression "#(op) a") should contain fields {
is operator
operator (op)
operator arguments [
{variable ['a']}
]
}
it generates binary (op) =
it generates binary (op) into (op)
it generates binary (op) into (generated) =
it "generates binary #(op)"
(macro expression "a #(op) b") should contain fields {
is operator
operator (generated)
operator arguments [
{variable ['a']}
{variable ['b']}
]
}
it generates unary '!'
it generates unary '~'
it generates unary '+'
it generates unary '-'
it generates unary '--'
it generates unary '++'
it generates binary '+'
it generates binary '*'
it generates binary '/'
it generates binary '-'
it generates binary '%'
it generates binary '<<'
it generates binary '>>'
it generates binary '>>>'
it generates binary '>'
it generates binary '>='
it generates binary '<'
it generates binary '<='
it generates binary '&'
it generates binary '^^' into '^'
it generates binary '|'
it generates binary '&&'
it generates binary '||'
| PogoScript | 4 | featurist/pogoscript | test/macrosSpec.pogo | [
"BSD-2-Clause"
] |
CLASS ltcl_test DEFINITION FOR TESTING DURATION SHORT RISK LEVEL HARMLESS FINAL.
PRIVATE SECTION.
DATA mv_json TYPE string.
DATA ms_config TYPE zif_abapgit_data_config=>ty_config.
METHODS setup.
METHODS to_json FOR TESTING RAISING cx_static_check.
METHODS from_json
IMPORTING it_files TYPE zif_abapgit_definitions=>ty_files_tt
RAISING cx_static_check.
ENDCLASS.
CLASS ltcl_test IMPLEMENTATION.
METHOD setup.
mv_json = |\{\n| &&
| "name": "DUMMY",\n| &&
| "type": "TABU",\n| &&
| "where": [\n| &&
| "DUMMY"\n| &&
| ]\n| &&
|\}|.
ms_config-type = zif_abapgit_data_config=>c_data_type-tabu.
ms_config-name = 'DUMMY'.
APPEND 'DUMMY' TO ms_config-where.
ENDMETHOD.
METHOD to_json.
DATA li_config TYPE REF TO zif_abapgit_data_config.
DATA lt_files TYPE zif_abapgit_definitions=>ty_files_tt.
DATA ls_file LIKE LINE OF lt_files.
DATA lv_json TYPE string.
CREATE OBJECT li_config TYPE zcl_abapgit_data_config.
li_config->add_config( ms_config ).
lt_files = li_config->to_json( ).
cl_abap_unit_assert=>assert_equals(
act = lines( lt_files )
exp = 1 ).
READ TABLE lt_files INDEX 1 INTO ls_file.
cl_abap_unit_assert=>assert_subrc( ).
cl_abap_unit_assert=>assert_not_initial( ls_file-data ).
lv_json = zcl_abapgit_convert=>xstring_to_string_utf8( ls_file-data ).
cl_abap_unit_assert=>assert_equals(
act = lv_json
exp = mv_json ).
from_json( lt_files ).
ENDMETHOD.
METHOD from_json.
DATA li_config TYPE REF TO zif_abapgit_data_config.
CREATE OBJECT li_config TYPE zcl_abapgit_data_config.
li_config->from_json( it_files ).
cl_abap_unit_assert=>assert_equals(
act = lines( li_config->get_configs( ) )
exp = 1 ).
ENDMETHOD.
ENDCLASS.
| ABAP | 5 | amit3kumar/ABAP_ALL | src/data/zcl_abapgit_data_config.clas.testclasses.abap | [
"MIT"
] |
FORMAT: 1A
# Binary API
## Resource [/binary]
### Send Binary Data [POST]
+ Request (application/octet-stream)
+ Response 200 (application/json; charset=utf-8)
+ Body
{"test": "OK"}
| API Blueprint | 2 | tomoyamachi/dredd | packages/dredd/test/fixtures/request/application-octet-stream.apib | [
"MIT"
] |
// Copyright 2016 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
#include "textflag.h"
// func block(dig *digest, p []byte)
TEXT ·block(SB), NOSPLIT|NOFRAME, $0-32
MOVBZ ·useAsm(SB), R4
LMG dig+0(FP), R1, R3 // R2 = &p[0], R3 = len(p)
MOVBZ $1, R0 // SHA-1 function code
CMPBEQ R4, $0, generic
loop:
WORD $0xB93E0002 // KIMD R2
BVS loop // continue if interrupted
RET
generic:
BR ·blockGeneric(SB)
| GAS | 2 | Havoc-OS/androidprebuilts_go_linux-x86 | src/crypto/sha1/sha1block_s390x.s | [
"BSD-3-Clause"
] |
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Hello World!</title>
<meta http-equiv="Content-Security-Policy" content="script-src 'self' 'unsafe-inline';" />
</head>
<body>
<h1>Hello World!</h1>
<p>Keep an eye on the dock (Mac) or taskbar (Windows, Unity) for this application!</p>
<p>It should indicate a progress that advances from 0 to 100%.</p>
<p>It should then show indeterminate (Windows) or pin at 100% (other operating systems)
briefly and then loop.</p>
</body>
</html>
| HTML | 2 | TarunavBA/electron | docs/fiddles/features/progress-bar/index.html | [
"MIT"
] |
create table td (
id int not null primary key clustered,
name varchar(20) not null,
size bigint not null,
unique key uni_name(name)
);
| SQL | 3 | suryatmodulus/tidb | br/tests/lightning_duplicate_detection/data/dup_detect.td-schema.sql | [
"Apache-2.0",
"BSD-3-Clause"
] |
--TEST--
Operations on uninitialized tidy object
--EXTENSIONS--
tidy
--FILE--
<?php
$tidy = new tidy;
try {
var_dump($tidy->getHtmlVer());
} catch (Error $e) {
echo $e->getMessage(), "\n";
}
try {
var_dump($tidy->isXhtml());
} catch (Error $e) {
echo $e->getMessage(), "\n";
}
try {
var_dump($tidy->isXml());
} catch (Error $e) {
echo $e->getMessage(), "\n";
}
?>
--EXPECT--
tidy object is not initialized
tidy object is not initialized
tidy object is not initialized
| PHP | 4 | NathanFreeman/php-src | ext/tidy/tests/uninitialized.phpt | [
"PHP-3.01"
] |
/* Copyright 2021 The TensorFlow Authors. All Rights Reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
==============================================================================*/
#ifndef TENSORFLOW_CORE_GRAPPLER_OPTIMIZERS_DATA_MAKE_DETERMINISTIC_H_
#define TENSORFLOW_CORE_GRAPPLER_OPTIMIZERS_DATA_MAKE_DETERMINISTIC_H_
#include "tensorflow/core/grappler/optimizers/data/optimizer_base.h"
namespace tensorflow {
namespace grappler {
// Removes sources on nondeterminism from dataset ops. Nondeterminism can occur
// in the follow ways, each which this pass addresses:
//
// 1. The datasets ParallelInterleave, ParallelMap, and MapAndBatch can
// introduce nondeterminism by running a function multiple times in parallel.
// Specifically, if the function can mutate state, it is potentially
// nondeterministic. In such cases, this pass converts such dataset ops to a
// non-parallel version.
//
// 2. Certain datasets, such as Prefetch, can introduce asynchrony by running a
// dataset iterator in a background thread while ops outside the dataset are
// also running. This can introduce nondeterminism if the input pipeline has
// certain stateful ops. Other than Prefetch, datasets with a
// `num_parallel_calls` argument also introduce asynchrony, which includes
// the parallel datasets mentioned in (1) above.
//
// This pass modifies nodes to remove asynchrony when there are any datasets
// in the graph with problematic stateful ops. Unlike (1), legacy random ops
// such as RandomUniform are not problematic despite being stateful, as if
// the op is within a dataset's function, ops outside the dataset cannot
// access the state.
//
// 3. Nondeterminism occurs if an op has a "deterministic" attribute that is
// false or a "sloppy" attribute that is true. This pass changes such
// attributes to be deterministic.
//
// NOTE: To address (1) above, parallel datasets are often rewritten to the
// non-parallel version as the user-defined functions they apply often use
// stateful ops (such as RNG). Unfortunately, this rewrite usually causes a
// large performance penalty in such cases by serializing invocations of the
// user-defined function.
//
// TODO(reedwm): Avoid serial execution of stateful functions that contain
// stateful ops.
class MakeDeterministic : public TFDataOptimizerBase {
public:
MakeDeterministic() = default;
~MakeDeterministic() override = default;
string name() const override { return "make_deterministic"; };
bool UsesFunctionLibrary() const override { return false; }
Status Init(
const tensorflow::RewriterConfig_CustomGraphOptimizer* config) override {
return Status::OK();
}
Status OptimizeAndCollectStats(Cluster* cluster, const GrapplerItem& item,
GraphDef* output,
OptimizationStats* stats) override;
};
} // namespace grappler
} // namespace tensorflow
#endif // TENSORFLOW_CORE_GRAPPLER_OPTIMIZERS_DATA_MAKE_DETERMINISTIC_H_
| C | 5 | computationalartist/tensorflow | tensorflow/core/grappler/optimizers/data/make_deterministic.h | [
"Apache-2.0"
] |
<mt:Ignore>
# =======================
#
# コンフィグ-検索結果
#
# =======================
</mt:Ignore>
<mt:Ignore>
# -----------------------
# Search Result
# -----------------------
</mt:Ignore>
<mt:CurrentPage setvar="ec_search_current_page" note="検索結果の現在のページ数" />
<mt:IfStraightSearch>
<mt:SetVarBlock name="ec_archive_title" note="アーカイブタイトル">検索結果: <mt:SearchString /></mt:SetVarBlock>
</mt:IfStraightSearch>
<mt:IfTagSearch>
<mt:SetVarBlock name="ec_archive_title" note="アーカイブタイトル">タグ: <mt:SearchString /></mt:SetVarBlock>
</mt:IfTagSearch>
<mt:SetVarBlock name="ec_search_count" value="1ページの件数: 検索結果では増やす"><mt:Var name="ec_search_count" op="*" value="2" /></mt:SetVarBlock>
<mt:TemplateNote value="検索結果URLの生成: MT本体と公開サイトのドメインが異なっている場合、PreviousLink・NextLinkが正しくURLを生成しない仕様に対応するため、CGIパスを変数で組み上げることで回避している" />
<mt:SetVarBlock name="__include_blogs__"><mt:BlogParentWebsite><mt:WebsiteID /><mt:Blogs glue="," include_blogs="children">,<mt:BlogID /></mt:Blogs></mt:BlogParentWebsite></mt:SetVarBlock>
<mt:IfPreviousResults>
<mt:SetVarBlock name="ec_search_previous_page" note="検索結果のひとつ前のページ数"><mt:Var name="ec_search_current_page" op="--" /></mt:SetVarBlock>
<mt:IfStraightSearch>
<mt:SetVarBlock name="ec_search_previous_link" note="検索結果のひとつ前のURL"><mt:Var name="ec_search_path" />?search=<mt:SearchString encode_url="1" />&IncludeBlogs=<mt:Var name="__include_blogs__" />&limit=<mt:Var name="ec_search_count" />&page=<mt:Var name="ec_search_previous_page" /></mt:SetVarBlock>
</mt:IfStraightSearch>
<mt:IfTagSearch>
<mt:SetVarBlock name="ec_search_previous_link" note="検索結果のひとつ前のURL"><mt:Var name="ec_search_path" />?tag=<mt:SearchString />&limit=<mt:Var name="ec_search_count" />&page=<mt:Var name="ec_search_previous_page" /></mt:SetVarBlock>
</mt:IfTagSearch>
</mt:IfPreviousResults>
<mt:IfMoreResults>
<mt:SetVarBlock name="ec_search_next_page" note="検索結果のひとつ後のページ数"><mt:Var name="ec_search_current_page" op="++" /></mt:SetVarBlock>
<mt:IfStraightSearch>
<mt:SetVarBlock name="ec_search_next_link" note="検索結果のひとつ後のURL"><mt:Var name="ec_search_path" />?search=<mt:SearchString encode_url="1" />&IncludeBlogs=<mt:Var name="__include_blogs__" />&limit=<mt:Var name="ec_search_count" />&page=<mt:Var name="ec_search_next_page" /></mt:SetVarBlock>
</mt:IfStraightSearch>
<mt:IfTagSearch>
<mt:SetVarBlock name="ec_search_next_link" note="検索結果のひとつ後のURL"><mt:Var name="ec_search_path" />?tag=<mt:SearchString />&limit=<mt:Var name="ec_search_count" />&page=<mt:Var name="ec_search_next_page" /></mt:SetVarBlock>
</mt:IfTagSearch>
</mt:IfMoreResults>
<mt:Ignore>
# -----------------------
# META
# -----------------------
</mt:Ignore>
<mt:SetVarBlock name="ec_meta_title" note="接尾辞を除くtitle要素">検索結果<mt:Var name="ec_website_suffix" /></mt:SetVarBlock>
<mt:Ignore>
# -----------------------
# Others
# -----------------------
</mt:Ignore>
<mt:SetVar name="ec_body_class" value="blog search" note="body要素のクラス名" />
| MTML | 4 | webbingstudio/mt_theme_echo_bootstrap | dist/themes/echo_bootstrap/templates/config_search_results.mtml | [
"MIT"
] |
=pod
=head1 NAME
EVP_KDF-X942-ASN1 - The X9.42-2003 asn1 EVP_KDF implementation
=head1 DESCRIPTION
The EVP_KDF-X942-ASN1 algorithm implements the key derivation function
X942KDF-ASN1. It is used by DH KeyAgreement, to derive a key using input such as
a shared secret key and other info. The other info is DER encoded data that
contains a 32 bit counter as well as optional fields for "partyu-info",
"partyv-info", "supp-pubinfo" and "supp-privinfo".
This kdf is used by Cryptographic Message Syntax (CMS).
=head2 Identity
"X942KDF-ASN1" or "X942KDF" is the name for this implementation; it
can be used with the EVP_KDF_fetch() function.
=head2 Supported parameters
The supported parameters are:
=over 4
=item "properties" (B<OSSL_KDF_PARAM_PROPERTIES>) <UTF8 string>
=item "digest" (B<OSSL_KDF_PARAM_DIGEST>) <UTF8 string>
These parameters work as described in L<EVP_KDF(3)/PARAMETERS>.
=item "key" (B<OSSL_KDF_PARAM_KEY>) <octet string>
The shared secret used for key derivation. This parameter sets the secret.
=item "acvp-info" (B<OSSL_KDF_PARAM_X942_ACVPINFO>) <octet string>
This value should not be used in production and should only be used for ACVP
testing. It is an optional octet string containing a combined DER encoded blob
of any of the optional fields related to "partyu-info", "partyv-info",
"supp-pubinfo" and "supp-privinfo". If it is specified then none of these other
fields should be used.
=item "partyu-info" (B<OSSL_KDF_PARAM_X942_PARTYUINFO>) <octet string>
An optional octet string containing public info contributed by the initiator.
=item "ukm" (B<OSSL_KDF_PARAM_UKM>) <octet string>
An alias for "partyu-info".
In CMS this is the user keying material.
=item "partyv-info" (B<OSSL_KDF_PARAM_X942_PARTYVINFO>) <octet string>
An optional octet string containing public info contributed by the responder.
=item "supp-pubinfo" (B<OSSL_KDF_PARAM_X942_SUPP_PUBINFO>) <octet string>
An optional octet string containing some additional, mutually-known public
information. Setting this value also sets "use-keybits" to 0.
=item "use-keybits" (B<OSSL_KDF_PARAM_X942_SUPP_PRIVINFO>) <integer>
The default value of 1 will use the KEK key length (in bits) as the
"supp-pubinfo". A value of 0 disables setting the "supp-pubinfo".
=item "supp-privinfo" (B<OSSL_KDF_PARAM_X942_SUPP_PRIVINFO>) <octet string>
An optional octet string containing some additional, mutually-known private
information.
=item "cekalg" (B<OSSL_KDF_PARAM_CEK_ALG>) <UTF8 string>
This parameter sets the CEK wrapping algorithm name.
Valid values are "AES-128-WRAP", "AES-192-WRAP", "AES-256-WRAP" and "DES3-WRAP".
=back
=head1 NOTES
A context for X942KDF can be obtained by calling:
EVP_KDF *kdf = EVP_KDF_fetch(NULL, "X942KDF", NULL);
EVP_KDF_CTX *kctx = EVP_KDF_CTX_new(kdf);
The output length of an X942KDF is specified via the I<keylen>
parameter to the L<EVP_KDF_derive(3)> function.
=head1 EXAMPLES
This example derives 24 bytes, with the secret key "secret" and random user
keying material:
EVP_KDF_CTX *kctx;
EVP_KDF_CTX *kctx;
unsigned char out[192/8];
unsignred char ukm[64];
OSSL_PARAM params[5], *p = params;
if (RAND_bytes(ukm, sizeof(ukm)) <= 0)
error("RAND_bytes");
kdf = EVP_KDF_fetch(NULL, "X942KDF", NULL);
if (kctx == NULL)
error("EVP_KDF_fetch");
kctx = EVP_KDF_CTX_new(kdf);
EVP_KDF_free(kdf);
if (kctx == NULL)
error("EVP_KDF_CTX_new");
*p++ = OSSL_PARAM_construct_utf8_string(OSSL_KDF_PARAM_DIGEST, "SHA256", 0);
*p++ = OSSL_PARAM_construct_octet_string(OSSL_KDF_PARAM_SECRET,
"secret", (size_t)6);
*p++ = OSSL_PARAM_construct_octet_string(OSSL_KDF_PARAM_UKM, ukm, sizeof(ukm));
*p++ = OSSL_PARAM_construct_utf8_string(OSSL_KDF_PARAM_CEK_ALG, "AES-256-WRAP, 0);
*p = OSSL_PARAM_construct_end();
if (EVP_KDF_derive(kctx, out, sizeof(out), params) <= 0)
error("EVP_KDF_derive");
EVP_KDF_CTX_free(kctx);
=head1 CONFORMING TO
ANS1 X9.42-2003
RFC 2631
=head1 SEE ALSO
L<EVP_KDF(3)>,
L<EVP_KDF_CTX_new(3)>,
L<EVP_KDF_CTX_free(3)>,
L<EVP_KDF_CTX_set_params(3)>,
L<EVP_KDF_CTX_get_kdf_size(3)>,
L<EVP_KDF_derive(3)>,
L<EVP_KDF(3)/PARAMETERS>
=head1 HISTORY
This functionality was added to OpenSSL 3.0.
=head1 COPYRIGHT
Copyright 2019-2021 The OpenSSL Project Authors. All Rights Reserved.
Licensed under the Apache License 2.0 (the "License"). You may not use
this file except in compliance with the License. You can obtain a copy
in the file LICENSE in the source distribution or at
L<https://www.openssl.org/source/license.html>.
=cut
| Pod | 5 | pmesnier/openssl | doc/man7/EVP_KDF-X942-ASN1.pod | [
"Apache-2.0"
] |
insert into tf values (6, '26634405', 2766688356459756352);
insert into tf values (4, 'c1eee960', 360295164351965585);
insert into tf values (1, 'bc20d613', 3326413653961467336);
insert into tf values (14, '3d5a7823', 7595043549211606767);
insert into tf values (7, '53d487c7', 4221264734661766949);
insert into tf values (16, 'c20180f8', 9094289846096776650);
insert into tf values (15, '0341fc74', 786384312461771449);
insert into tf values (12, 'd9795c83', 7030928942007467889);
insert into tf values (17, '8639a254', 1788924442548430429);
insert into tf values (5, '4dc2ac2a', 6277676276487532914);
insert into tf values (8, '929df140', 1114358947270357181);
insert into tf values (9, 'be99532b', 6629920580545209024);
insert into tf values (20, 'e9342546', 6581968775078414258);
insert into tf values (11, '501399f7', 1504660570319726719);
insert into tf values (19, '2d44a5d3', 8933264399747927597);
insert into tf values (10, 'af2c5bc5', 6342858980218218282);
insert into tf values (18, 'c3b50582', 4871115036555803489);
insert into tf values (3, '7f9432b4', 8064385010060502354);
insert into tf values (13, '7dd3833a', 4003124749440663369);
insert into tf values (2, '6c96a48d', 5632353786017870566);
| SQL | 3 | cuishuang/tidb | br/tests/lightning_duplicate_detection/data/dup_detect.tf.0.sql | [
"Apache-2.0"
] |
; -- CodeDll.iss --
;
; This script shows how to call functions in external DLLs (like Windows API functions)
; at runtime and how to perform direct callbacks from these functions to functions
; in the script.
[Setup]
AppName=My Program
AppVersion=1.5
WizardStyle=modern
DefaultDirName={autopf}\My Program
DisableProgramGroupPage=yes
DisableWelcomePage=no
UninstallDisplayIcon={app}\MyProg.exe
OutputDir=userdocs:Inno Setup Examples Output
[Files]
Source: "MyProg.exe"; DestDir: "{app}"
Source: "MyProg.chm"; DestDir: "{app}"
Source: "Readme.txt"; DestDir: "{app}"; Flags: isreadme
; Install our DLL to {app} so we can access it at uninstall time.
; Use "Flags: dontcopy" if you don't need uninstall time access.
Source: "MyDll.dll"; DestDir: "{app}"
[Code]
const
MB_ICONINFORMATION = $40;
// Importing a Unicode Windows API function.
function MessageBox(hWnd: Integer; lpText, lpCaption: String; uType: Cardinal): Integer;
external 'MessageBoxW@user32.dll stdcall';
// Importing an ANSI custom DLL function, first for Setup, then for uninstall.
procedure MyDllFuncSetup(hWnd: Integer; lpText, lpCaption: AnsiString; uType: Cardinal);
external 'MyDllFunc@files:MyDll.dll stdcall setuponly';
procedure MyDllFuncUninstall(hWnd: Integer; lpText, lpCaption: AnsiString; uType: Cardinal);
external 'MyDllFunc@{app}\MyDll.dll stdcall uninstallonly';
// Importing an ANSI function for a DLL which might not exist at runtime.
procedure DelayLoadedFunc(hWnd: Integer; lpText, lpCaption: AnsiString; uType: Cardinal);
external 'DllFunc@DllWhichMightNotExist.dll stdcall delayload';
function NextButtonClick(CurPage: Integer): Boolean;
var
hWnd: Integer;
begin
if CurPage = wpWelcome then begin
hWnd := StrToInt(ExpandConstant('{wizardhwnd}'));
MessageBox(hWnd, 'Hello from Windows API function', 'MessageBoxA', MB_OK or MB_ICONINFORMATION);
MyDllFuncSetup(hWnd, 'Hello from custom DLL function', 'MyDllFunc', MB_OK or MB_ICONINFORMATION);
try
// If this DLL does not exist (it shouldn't), an exception will be raised. Press F9 to continue.
DelayLoadedFunc(hWnd, 'Hello from delay loaded function', 'DllFunc', MB_OK or MB_ICONINFORMATION);
except
// <Handle missing dll here>
end;
end;
Result := True;
end;
procedure CurUninstallStepChanged(CurUninstallStep: TUninstallStep);
begin
// Call our function just before the actual uninstall process begins.
if CurUninstallStep = usUninstall then begin
MyDllFuncUninstall(0, 'Hello from custom DLL function', 'MyDllFunc', MB_OK or MB_ICONINFORMATION);
// Now that we're finished with it, unload MyDll.dll from memory.
// We have to do this so that the uninstaller will be able to remove the DLL and the {app} directory.
UnloadDLL(ExpandConstant('{app}\MyDll.dll'));
end;
end;
// The following shows how to use callbacks.
function SetTimer(hWnd, nIDEvent, uElapse, lpTimerFunc: Longword): Longword;
external 'SetTimer@user32.dll stdcall';
var
TimerCount: Integer;
procedure MyTimerProc(Arg1, Arg2, Arg3, Arg4: Longword);
begin
Inc(TimerCount);
WizardForm.BeveledLabel.Caption := ' Timer! ' + IntToStr(TimerCount) + ' ';
WizardForm.BeveledLabel.Visible := True;
end;
procedure InitializeWizard;
begin
SetTimer(0, 0, 1000, CreateCallback(@MyTimerProc));
end;
| Inno Setup | 5 | Patriccollu/issrc | Examples/CodeDll.iss | [
"FSFAP"
] |
use std::alloc::System;
use std::collections::VecDeque;
#[global_allocator]
static ALLOCATOR: System = System;
fn main() {
let mut deque = VecDeque::with_capacity(32);
deque.push_front(0);
deque.reserve(31);
deque.push_back(0);
}
| Rust | 4 | Eric-Arellano/rust | src/test/run-pass-valgrind/issue-44800.rs | [
"ECL-2.0",
"Apache-2.0",
"MIT-0",
"MIT"
] |
module Feature.Query.DeleteSpec where
import Network.Wai (Application)
import Network.HTTP.Types
import Test.Hspec hiding (pendingWith)
import Test.Hspec.Wai
import Test.Hspec.Wai.JSON
import Protolude hiding (get)
import SpecHelper
spec :: SpecWith ((), Application)
spec =
describe "Deleting" $ do
context "existing record" $ do
it "succeeds with 204 and deletion count" $
request methodDelete "/items?id=eq.1"
[]
""
`shouldRespondWith`
""
{ matchStatus = 204
, matchHeaders = [ matchHeaderAbsent hContentType
, "Content-Range" <:> "*/*" ]
}
it "returns the deleted item and count if requested" $
request methodDelete "/items?id=eq.2" [("Prefer", "return=representation"), ("Prefer", "count=exact")] ""
`shouldRespondWith` [json|[{"id":2}]|]
{ matchStatus = 200
, matchHeaders = ["Content-Range" <:> "*/1"]
}
it "ignores ?select= when return not set or return=minimal" $ do
request methodDelete "/items?id=eq.3&select=id"
[]
""
`shouldRespondWith`
""
{ matchStatus = 204
, matchHeaders = [ matchHeaderAbsent hContentType
, "Content-Range" <:> "*/*" ]
}
request methodDelete "/items?id=eq.3&select=id"
[("Prefer", "return=minimal")]
""
`shouldRespondWith`
""
{ matchStatus = 204
, matchHeaders = [ matchHeaderAbsent hContentType
, "Content-Range" <:> "*/*" ]
}
it "returns the deleted item and shapes the response" $
request methodDelete "/complex_items?id=eq.2&select=id,name" [("Prefer", "return=representation")] ""
`shouldRespondWith` [json|[{"id":2,"name":"Two"}]|]
{ matchStatus = 200
, matchHeaders = ["Content-Range" <:> "*/*"]
}
it "can rename and cast the selected columns" $
request methodDelete "/complex_items?id=eq.3&select=ciId:id::text,ciName:name" [("Prefer", "return=representation")] ""
`shouldRespondWith` [json|[{"ciId":"3","ciName":"Three"}]|]
it "can embed (parent) entities" $
request methodDelete "/tasks?id=eq.8&select=id,name,project:projects(id)" [("Prefer", "return=representation")] ""
`shouldRespondWith` [json|[{"id":8,"name":"Code OSX","project":{"id":4}}]|]
{ matchStatus = 200
, matchHeaders = ["Content-Range" <:> "*/*"]
}
context "known route, no records matched" $
it "includes [] body if return=rep" $
request methodDelete "/items?id=eq.101"
[("Prefer", "return=representation")] ""
`shouldRespondWith` "[]"
{ matchStatus = 200
, matchHeaders = ["Content-Range" <:> "*/*"]
}
context "totally unknown route" $
it "fails with 404" $
request methodDelete "/foozle?id=eq.101" [] "" `shouldRespondWith` 404
context "table with limited privileges" $ do
it "fails deleting the row when return=representation and selecting all the columns" $
request methodDelete "/app_users?id=eq.1" [("Prefer", "return=representation")] mempty
`shouldRespondWith` 401
it "succeeds deleting the row when return=representation and selecting only the privileged columns" $
request methodDelete "/app_users?id=eq.1&select=id,email" [("Prefer", "return=representation")]
[json| { "password": "passxyz" } |]
`shouldRespondWith` [json|[ { "id": 1, "email": "test@123.com" } ]|]
{ matchStatus = 200
, matchHeaders = ["Content-Range" <:> "*/*"]
}
it "suceeds deleting the row with no explicit select when using return=minimal" $
request methodDelete "/app_users?id=eq.2"
[("Prefer", "return=minimal")]
mempty
`shouldRespondWith`
""
{ matchStatus = 204
, matchHeaders = [matchHeaderAbsent hContentType]
}
it "suceeds deleting the row with no explicit select by default" $
request methodDelete "/app_users?id=eq.3"
[]
mempty
`shouldRespondWith`
""
{ matchStatus = 204
, matchHeaders = [matchHeaderAbsent hContentType]
}
context "limited delete" $ do
it "works with the limit and offset query params" $ do
get "/limited_delete_items"
`shouldRespondWith`
[json|[
{ "id": 1, "name": "item-1" }
, { "id": 2, "name": "item-2" }
, { "id": 3, "name": "item-3" }
]|]
request methodDelete "/limited_delete_items?order=id&limit=1&offset=1"
[("Prefer", "tx=commit")]
mempty
`shouldRespondWith`
""
{ matchStatus = 204
, matchHeaders = [ matchHeaderAbsent hContentType
, "Preference-Applied" <:> "tx=commit" ]
}
get "/limited_delete_items?order=id"
`shouldRespondWith`
[json|[
{ "id": 1, "name": "item-1" }
, { "id": 3, "name": "item-3" }
]|]
request methodPost "/rpc/reset_limited_items"
[("Prefer", "tx=commit")]
[json| {"tbl_name": "limited_delete_items"} |]
`shouldRespondWith` ""
{ matchStatus = 204 }
it "works with the limit query param plus a filter" $ do
get "/limited_delete_items"
`shouldRespondWith`
[json|[
{ "id": 1, "name": "item-1" }
, { "id": 2, "name": "item-2" }
, { "id": 3, "name": "item-3" }
]|]
request methodDelete "/limited_delete_items?order=id&limit=1&id=gt.1"
[("Prefer", "tx=commit")]
mempty
`shouldRespondWith`
""
{ matchStatus = 204
, matchHeaders = [ matchHeaderAbsent hContentType
, "Preference-Applied" <:> "tx=commit" ]
}
get "/limited_delete_items?order=id"
`shouldRespondWith`
[json|[
{ "id": 1, "name": "item-1" }
, { "id": 3, "name": "item-3" }
]|]
request methodPost "/rpc/reset_limited_items"
[("Prefer", "tx=commit")]
[json| {"tbl_name": "limited_delete_items"} |]
`shouldRespondWith` ""
{ matchStatus = 204 }
it "fails without an explicit order by" $
request methodDelete "/limited_delete_items?limit=1&offset=1"
[("Prefer", "tx=commit")]
mempty
`shouldRespondWith`
[json| {
"code":"PGRST109",
"hint": "Apply an 'order' using unique column(s)",
"details": null,
"message": "A 'limit' was applied without an explicit 'order'"
}|]
{ matchStatus = 400 }
it "fails when not ordering by a unique column" $
request methodDelete "/limited_delete_items_wnonuniq_view?order=static&limit=1"
[("Prefer", "tx=commit")]
mempty
`shouldRespondWith`
[json| {
"code":"PGRST110",
"hint": null,
"details":"Results contain 3 rows changed but the maximum number allowed is 1",
"message":"The maximum number of rows allowed to change was surpassed"
}|]
{ matchStatus = 400 }
it "works with views with an explicit order by unique col" $ do
get "/limited_delete_items_view"
`shouldRespondWith`
[json|[
{ "id": 1, "name": "item-1" }
, { "id": 2, "name": "item-2" }
, { "id": 3, "name": "item-3" }
]|]
request methodDelete "/limited_delete_items_view?order=id&limit=1&offset=1"
[("Prefer", "tx=commit")]
mempty
`shouldRespondWith`
""
{ matchStatus = 204
, matchHeaders = [ matchHeaderAbsent hContentType
, "Preference-Applied" <:> "tx=commit" ]
}
get "/limited_delete_items_view"
`shouldRespondWith`
[json|[
{ "id": 1, "name": "item-1" }
, { "id": 3, "name": "item-3" }
]|]
request methodPost "/rpc/reset_limited_items"
[("Prefer", "tx=commit")]
[json| {"tbl_name": "limited_delete_items_view"} |]
`shouldRespondWith` ""
{ matchStatus = 204 }
it "works with views with an explicit order by composite pk" $ do
get "/limited_delete_items_cpk_view"
`shouldRespondWith`
[json|[
{ "id": 1, "name": "item-1" }
, { "id": 2, "name": "item-2" }
, { "id": 3, "name": "item-3" }
]|]
request methodDelete "/limited_delete_items_cpk_view?order=id,name&limit=1&offset=1"
[("Prefer", "tx=commit")]
mempty
`shouldRespondWith`
""
{ matchStatus = 204
, matchHeaders = [ matchHeaderAbsent hContentType
, "Preference-Applied" <:> "tx=commit" ]
}
get "/limited_delete_items_cpk_view"
`shouldRespondWith`
[json|[
{ "id": 1, "name": "item-1" }
, { "id": 3, "name": "item-3" }
]|]
request methodPost "/rpc/reset_limited_items"
[("Prefer", "tx=commit")]
[json| {"tbl_name": "limited_delete_items_cpk_view"} |]
`shouldRespondWith` ""
{ matchStatus = 204 }
it "works on a table without a pk by ordering by 'ctid'" $ do
get "/limited_delete_items_no_pk"
`shouldRespondWith`
[json|[
{ "id": 1, "name": "item-1" }
, { "id": 2, "name": "item-2" }
, { "id": 3, "name": "item-3" }
]|]
request methodDelete "/limited_delete_items_no_pk?order=ctid&limit=1&offset=1"
[("Prefer", "tx=commit")]
mempty
`shouldRespondWith`
""
{ matchStatus = 204
, matchHeaders = [ matchHeaderAbsent hContentType
, "Preference-Applied" <:> "tx=commit" ]
}
get "/limited_delete_items_no_pk"
`shouldRespondWith`
[json|[
{ "id": 1, "name": "item-1" }
, { "id": 3, "name": "item-3" }
]|]
request methodPost "/rpc/reset_limited_items"
[("Prefer", "tx=commit")]
[json| {"tbl_name": "limited_delete_items_no_pk"} |]
`shouldRespondWith` ""
{ matchStatus = 204 }
| Haskell | 5 | fjf2002/postgrest | test/spec/Feature/Query/DeleteSpec.hs | [
"MIT"
] |
# while using circle we'll use circle's base image.
FROM alpine:3.14.2@sha256:e1c082e3d3c45cccac829840a25941e679c25d438cc8412c2fa221cf1a824e6a AS setup_ci_alpine
WORKDIR /diem
COPY rust-toolchain /diem/rust-toolchain
COPY scripts/dev_setup.sh /diem/scripts/dev_setup.sh
ENV HOME "/github/home"
#Needed for sccache to function, and to work around home dir being blatted.
ENV CARGO_HOME "/opt/cargo"
ENV RUSTUP_HOME "/opt/rustup"
RUN apk add bash=5.1.4-r0 --no-cache && \
mkdir -p /github/home && \
mkdir -p /opt/cargo/ && \
mkdir -p /opt/git/ && \
/diem/scripts/dev_setup.sh -t -o -b -p -y -s -n
ENV DOTNET_ROOT "/opt/dotnet"
ENV Z3_EXE "/opt/bin/z3"
ENV CVC5_EXE "/opt/bin/cvc5"
ENV BOOGIE_EXE "/opt/dotnet/tools/boogie"
ENV PATH "/opt/cargo/bin:/usr/lib/golang/bin:/opt/bin:${DOTNET_ROOT}:${DOTNET_ROOT}/tools:$PATH"
FROM setup_ci_alpine as tested_ci_alpine
# Compile a small rust tool? But we already have in dev_setup (sccache/grcov)...?
# Test that all commands we need are installed and on the PATH
RUN [ -x "$(set -x; command -v shellcheck)" ] \
&& [ -x "$(set -x; command -v hadolint)" ] \
&& [ -x "$(set -x; command -v vault)" ] \
&& [ -x "$(set -x; command -v terraform)" ] \
&& [ -x "$(set -x; command -v kubectl)" ] \
&& [ -x "$(set -x; command -v rustup)" ] \
&& [ -x "$(set -x; command -v cargo)" ] \
&& [ -x "$(set -x; command -v cargo-guppy)" ] \
&& [ -x "$(set -x; command -v sccache)" ] \
&& [ -x "$(set -x; command -v grcov)" ] \
&& [ -x "$(set -x; command -v helm)" ] \
&& [ -x "$(set -x; command -v aws)" ] \
&& [ -x "$(set -x; command -v z3)" ] \
&& [ -x "$(set -x; command -v "$BOOGIE_EXE")" ] \
&& [ -x "$(set -x; xargs rustup which cargo --toolchain < /diem/rust-toolchain )" ] \
&& [ -x "$(set -x; command -v tidy)" ] \
&& [ -x "$(set -x; command -v xsltproc)" ] \
&& [ -x "$(set -x; command -v javac)" ] \
&& [ -x "$(set -x; command -v clang)" ] \
&& [ -x "$(set -x; command -v python3)" ] \
&& [ -x "$(set -x; command -v go)" ] \
&& [ -x "$(set -x; command -v npm)" ]
# should be a no-op, but since sccache failes to execute, sccache is rebuilt.
RUN scripts/dev_setup.sh -t -o -y -b -p -s
FROM setup_ci_alpine as build_environment_alpine
| Dockerfile | 4 | PragmaTwice/diem | docker/ci/alpine/Dockerfile | [
"Apache-2.0"
] |
---
layout: default
---
<!-- head -->
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Inconsolata">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/docsearch.js/2/docsearch.min.css">
<!-- head -->
{% if page.permalink contains '/docs' %}
{% assign items = site.data.docs %}
{% assign category = "Documentation" %}
{% else %}
{% assign category = "Guides" %}
{% assign items = site.data.guides %}
{% endif %}
{% assign flattenedItems = "" | split: "" %}
{% assign parts = "" | split: "" %}
{% for item in items %}
{% assign flattenedItems = flattenedItems | push: item %}
{% if item.children != null %}
{% for child in item.children %}
{% unless child.url contains '#' %}
{% assign flattenedItems = flattenedItems | push: child %}
{% if child.url == page.permalink %}
{% assign parts = parts | push: item.title | push: child.title %}
{% endif %}
{% endunless %}
{% endfor %}
{% endif %}
{% if item.url == page.permalink %}
{% assign parts = parts | push: item.title %}
{% endif %}
{% endfor %}
<div id="docs-wrapper" class="container">
<div class="row">
<div id="sidebar-container" class="three columns">
<button class="sidebar-button">Document Navigation</button>
<ul class="sidebar-list">
<li class="search-item"><input type="text"></li>
{% include sidebar.html items=items %}
</ul>
</div>
<div id="docs-container" class="nine columns">
<div class="row">
<span class="breadcrumb">
<span>{{ category }}:</span>
<span>{{ parts | join: ' / ' }}</span>
</span>
<a class="edit-link" href="{{site.github}}/{{page.path}}" target="_blank" title="Edit on Github">
{% include svg/octocat.svg %}
<span>Edit on Github</span>
</a>
</div>
<hr>
<div id="content-container">
{% if page.stability == "review" %}
<div class="alert alert-warning">This page needs to be reviewed.</div>
{% elsif page.stability == "incomplete" %}
<div class="alert alert-warning">This page is incomplete.</div>
{% endif %}
<h1 id="{{ page.title | slugify }}">{{ page.title }}</h1>
{{ content }}
</div>
<div class="row" id="pagination-container">
{% for item in flattenedItems %}
{% if page.permalink == item.url %}
{% assign next = flattenedItems[forloop.index] %}
{% unless forloop.first %}
<a class="prev" href="{{ prev.url }}">
<span class="label">{{ prev.title }}</span>
<span class="arrow">
<span class="tip"></span>
<span class="shaft"></span>
</span>
</a>
{% endunless %}
{% unless forloop.last %}
<a class="next" href="{{ next.url }}">
<span class="label">{{ next.title }}</span>
<span class="arrow">
<span class="tip"></span>
<span class="shaft"></span>
</span>
</a>
{% endunless %}
{% endif %}
{% assign prev = item %}
{% endfor %}
</div>
</div>
</div>
<div class="row">
<hr>
</div>
{% include open-source.html %}
</div>
<!-- script -->
<script src="https://cdn.jsdelivr.net/docsearch.js/2/docsearch.min.js"></script>
<script>
$(document).ready(function() {
$('h1, h2, h3, h4', $('#docs-container')).each(function(i, h) {
if (!h.id) return;
$('<a class="anchor" href="#' + h.id + '"></a>').prependTo($(h));
});
$('#sidebar-container .sidebar-button').click(function() {
$('#sidebar-container').toggleClass('active');
});
docsearch({
apiKey: '281facf513620e95600126795a00ab6c',
indexName: 'quilljs',
inputSelector: '.search-item input',
debug: false
});
});
</script>
<!-- script -->
| HTML | 4 | ionurboz/quill | docs/_layouts/docs.html | [
"BSD-3-Clause"
] |
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE xsl:stylesheet SYSTEM "xslt-second-level-import.xsl.dtd">
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:include href="xslt-second-level-import2.xsl" />
<xsl:template match="/">
<script>
if (window.testRunner)
testRunner.dumpAsText();
</script>
<p>&success;</p>
</xsl:template>
</xsl:stylesheet>
| XSLT | 3 | zealoussnow/chromium | third_party/blink/web_tests/fast/xsl/resources/xslt-second-level-import.xsl | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] |
" Polish letters under VIM >= 6
" Maintainer: HS6_06 <hs6_06@o2.pl>
" Last changed: 2005 Jan 12
" Current version: 1.0.2
" History:
" 2005.01.12 1.0.2 keymap_name shortened, added Current version, History
" 2005.01.10 1.0.1 un*x line ends for all files
" 2005.01.09 1.0.0 Initial release
let encoding = &enc
if encoding == 'latin1'
if has("unix")
let encoding = 'iso-8859-2'
else
let encoding = 'cp1250'
endif
endif
if encoding == 'utf-8'
source <sfile>:p:h/polish-slash_utf-8.vim
elseif encoding == 'cp1250'
source <sfile>:p:h/polish-slash_cp1250.vim
elseif encoding == 'iso-8859-2'
source <sfile>:p:h/polish-slash_iso-8859-2.vim
else
source <sfile>:p:h/polish-slash_cp852.vim
endif
| VimL | 3 | uga-rosa/neovim | runtime/keymap/polish-slash.vim | [
"Vim"
] |
(ns hacker-scripts.hangover
(:import
(com.twilio Twilio)
(com.twilio.rest.api.v2010.account Message)
(com.twilio.type PhoneNumber)))
(def acc-sid "my twilio account SID")
(def acc-tkn "my twilio secret token")
(def my-num (PhoneNumber. "+10001112222"))
(def boss-num (PhoneNumber. "+19998887777"))
(def reasons ["Receiving delivery"
"Waiting for repairman"
"Nasty cold"])
(defn twilio-init []
(Twilio/init acc-sid acc-tkn))
(defn send-sms [to-num from-num message]
(.. Message (creator to-num from-num message) create))
(def send-sms-boss (partial send-sms boss-num my-num))
(defn hangover []
(twilio-init)
(let [message (rand-nth reasons)]
(send-sms-boss message)))
| Clojure | 4 | johndemlon/hacker-scripts | clojure/hangover.clj | [
"WTFPL"
] |
;;;; The LFE API for the "Bevin" backend (send/receive MIDI via the CLI tools
;;;; by Geert Bevin.
;;;;
;;;; Note that this backend is 100% MIDI, so you won't see 'midi' in any of the
;;;; function names ;-)
(defmodule bv
;; Deviceless/channelless API
(export
(devices 0)
(version 0))
;; MIDI "stream"-based API (note we're borrowing that term from Extempore
(export
(cc 3)
(cc-ramp 5)
(cc-sine 6)
(create-stream 2)
;;(note 4)
(send 2)))
(include-lib "logjam/include/logjam.hrl")
;;;;;::=-------------------------------=::;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;::=- deviceless/channelless API -=::;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;::=-------------------------------=::;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(defun devices ()
(undertone.bevin:write-midi (list "list\n")))
(defun version ()
(undertone.bevin:version))
;;;;;::=-------------------------------=::;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;::=- MIDI "stream"-based API API -=::;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;::=-------------------------------=::;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(defun cc (stream cc-code value)
(send stream `(cc ,cc-code value)))
(defun cc-ramp (stream cc-code start-val end-val duration)
(let* ((sq (seq start-val end-val))
(steps (length sq))
(incr (/ (* 1000 duration) steps))
(time 0))
(lists:foldl
(lambda (val acc)
(let* ((sum (++ acc (io_lib:format " ~s cc ~s ~s" time start-val end-val)))
(sched (timer:apply_after (round sum)
'bv
'cc
;; placeholder args
`(,stream cc-code start-val end-val duration))))
(log-debug "Scheduled: ~p" `(,sched))
sum))
""
sq))
'ok)
(defun cc-sine (stream cc-code start-value max-value period duration)
"Max-points:
* pi/2, 5pi/2, 9pi/2, etc.
* (floor (+ (* (/ 127 2) (math:sin (/ (* 5 (math:pi)) 2))) 64))
Mid-points:
* 0pi, pi, 2pi, etc.
* (floor (+ (* (/ 127 2) (math:sin (/ (* 2 (math:pi)) 1))) 64))
Min-points:
* 3pi/2, 7pi/2, 11pi/2, etc.
* (floor (+ (* (/ 127 2) (math:sin (/ (* 3 (math:pi)) 2))) 64))
"
'not-implemented)
(defun create-stream (device-name midi-channel)
`#m(dev ,device-name
ch ,midi-channel))
;;(defun note (stream note-value veloc duration)
;; (send stream `(on ,note-value ,veloc))
;; (timer:apply_after duration
;; 'bv
;; 'send
;; `( ... )))
(defun note (stream bpm note-value veloc note-timing)
'tbd)
(defun send
((stream args) (when (is_atom args))
(send stream (list args)))
((`#m(dev ,dev ch ,ch) args)
(undertone.bevin:write-midi
(join-args (lists:append (list
(list "dev" dev "ch" ch)
args
'("\n")))))))
;;;;;::=-------------------------------=::;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;::=- utility / support functions -=::;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;::=-------------------------------=::;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(defun join-args (args)
;; Semi-jokingly: can the coers Erlang lib we're maintaining essentially be
;; rewritten to basically do this?
(clj:->> args
(lists:map
(match-lambda
((x) (when (is_list x)) x)
((x) (when (is_binary x)) (binary_to_list x))
((x) (when (is_atom x)) (atom_to_list x))
((x) (when (is_integer x)) (integer_to_list x))))
(lists:join " ")))
;; XXX move into common/util module
(defun seq (start end)
(if (> end start)
(lists:seq start end)
(lists:reverse (lists:seq end start))))
| LFE | 4 | ut-proj/undertone | src/bv.lfe | [
"Apache-2.0"
] |
REBOL [
System: "REBOL [R3] Language Interpreter and Run-time Environment"
Title: "REBOL 3 Boot Base: Series Functions"
Rights: {
Copyright 2012 REBOL Technologies
REBOL is a trademark of REBOL Technologies
}
License: {
Licensed under the Apache License, Version 2.0
See: http://www.apache.org/licenses/LICENSE-2.0
}
Note: {
This code is evaluated just after actions, natives, sysobj, and other lower
levels definitions. This file intializes a minimal working environment
that is used for the rest of the boot.
}
]
repend: func [
"Appends a reduced value to a series and returns the series head."
series [series! port! map! gob! object! bitset!] {Series at point to insert (modified)}
value {The value to insert}
/part {Limits to a given length or position}
length [number! series! pair!]
/only {Appends a block value as a block}
/dup {Duplicates the insert a specified number of times}
count [number! pair!]
][
apply :append [series reduce :value part length only dup count]
]
join: func [
"Concatenates values."
value "Base value"
rest "Value or block of values"
][
append either series? :value [copy value] [form :value] reduce :rest
]
reform: func [
"Forms a reduced block and returns a string."
value "Value to reduce and form"
;/with "separator"
][
form reduce :value
]
ellipsize: func [
"Truncate and add ellipsis if str is longer than len"
str [string!] "(modified)"
len [integer!] "Max length"
/one-line "Escape line breaks"
/local chars
][
if one-line [
chars: #[bitset! [not bits #{0024}]]
parse str [
any [
some chars
| change #"^/" "^^/"
| change #"^M" "^^M"
]
]
]
if len < length? str [
append clear skip str (len - 3) "..."
]
str
]
| Rebol | 5 | semarie/rebol3-oldes | src/mezz/base-series.reb | [
"Apache-2.0"
] |
#!/usr/bin/env pike
/* Multi-purpose git hook
Run this script from your top-level git directory and it'll install itself. Then,
it provides two services:
1) One-file commits can be tagged to show what file/module they're working on.
The first time you do such a commit, identify the file with a tag, followed by
a colon - for example, "githook: New script" - and then all subsequent commits
for that file will have the "githook:" part prefilled. (Note that this doesn't
work with 'git gui', which appears to skip the prepare-commit-msg hook.) Having
multiple files with the same tag allows them all to be part of a conceptual
module, although the hook won't recognize any multi-file commits, even if the
files would all have used the same tag separately.
NOTE: This search can take a long time; it scans backward through potentially
the entire history of this branch of the repository. To bound the search to N
commits back from the current HEAD:
$ git config rosuav.log-search.limit N
This can be set globally or per-repository. If the bound is set too low, files
which have not been edited in a long time may not be detected as having tags
set, and will be treated as brand new again.
2) Short-hand fixup: edit a single file and create a commit with a message of
"f" (eg "git commit -amf") and the message will be expanded to "fixup!" and the
most recent unpushed commit message that affects this file. Good with git's
interactive rebase, especially with git config rebase.autosquash enabled.
*/
int main(int argc,array(string) argv)
{
string cmd=explode_path(argv[0])[-1];
if (cmd == "githook.pike")
{
foreach (indices(this), string fn)
if (sscanf(fn, "hook_%s", string hook))
System.symlink(argv[0], ".git/hooks/" + replace(hook, "_", "-"));
write("Installed.\n");
}
else if (function f = this["hook_" + replace(cmd, "-", "_")])
return f(argv);
else exit(1,"This script does not handle a %s hook.\n",cmd);
}
int hook_prepare_commit_msg(array(string) argv)
{
//For single-file commits, provide a prefix.
//If the commit message doesn't start with a comment, don't touch it - it's probably a rebase.
string msg=Stdio.File(argv[1])->read();
if (sizeof(argv)<4 && has_prefix(String.trim_all_whites(msg),"#"))
{
//NOTE: The diff shows paths relative to the repository root, but 'git log' below works with
//paths relative to the current directory. When this is run as a git hook, the cwd always
//appears to be the repo root, but I don't know that this is guaranteed. I can't find it in
//the docs anywhere, for instance; but it does seem likely and logical.
array(string) stat=Process.run("git diff --cached --stat")->stdout/"\n";
if (sizeof(stat)>1 && has_prefix(stat[1]-"s"," 1 file changed") && sscanf(stat[0]," %s |",string fn) && fn && fn!="") //One-file commits have a summary on line 2.
{
//Hack for CJAPrivate repo
if (int use_hacks=(int)Process.run(({"git","config","--get","rosuav.log-search.use-hacks"}))->stdout)
{
//Thinkful invoices usually get simple additions of single lines.
if (has_prefix(fn,"Thinkful/Inv"))
{
string comment;
foreach (Process.run(({"git","diff","-U0","--cached"}))->stdout/"\n",string line)
{
if (sscanf(line,"+| %*d\t| %s%*[\t]| %f\t| %f", string c, float hours, float dollars) == 5)
{
if (hours * use_hacks != dollars)
exit(1,"%O hours doesn't match %O dollars - maybe tweak the hook for flexibility?\n", hours, dollars);
comment=c;
}
}
if (comment) {Stdio.write_file(argv[1],comment+"\n"+msg); return 0;}
}
}
//To speed up the search on large repositories:
//$ git config rosuav.log-search.limit N
//where N is some number of commits. This will cause failure if this branch of
//this repo has not had that many commits yet (or to be more precise, if HEAD
//doesn't have that many {grand,}parents).
array(string) args=({"git","log","--shortstat","--full-diff","-10","--oneline"});
array(string) log;
if (int limit=(int)Process.run(({"git","config","--get","rosuav.log-search.limit"}))->stdout)
{
mapping rc=Process.run(args+({"HEAD~"+limit+"..",fn}));
if (!rc->exitcode) log=rc->stdout/"\n";
//If this fails, try again without the limit.
}
if (!log) log=Process.run(args+({fn}))->stdout/"\n"; //If this one fails, though, just work with no lines (ie no tags).
mapping(string:int) tagcnt=([]);
for (int i=0;i<sizeof(log)-1;i+=2) //log should be pairs of lines: ({commit + summary, shortstat}) repeated.
if (has_prefix(log[i+1]-"s"," 1 file changed")) //Ignore commits that changed any other file
if (sscanf(log[i],"%*s %s: %s",string tag,string msg) && msg) tagcnt[String.trim_all_whites(tag-"squash!"-"fixup!"-"Revert \"")]++;
switch (sizeof(tagcnt))
{
case 0: break; //No tags found, nothing to do.
case 1: Stdio.write_file(argv[1],indices(tagcnt)[0]+": \n"+msg); break;
default:
{
array(string) tags=indices(tagcnt); sort(values(tagcnt),tags); //Sort by count (ascending)
foreach (tags,string tag) msg="# "+tag+": \n"+msg; //Prepend each one, thus having them in the message in descending order
Stdio.write_file(argv[1],msg);
}
}
}
}
}
int hook_commit_msg(array(string) argv)
{
//Short-hand fixup: apply the fixup to the most recent commit that touched this file.
//Instead of "git commit filename --fixup=12ab34", use "git commit filename -mf" and the fixup will be applied to the
//most recent unpushed commit that affected the file you're committing. Done only if a single-file commit, for safety.
//Designed for "git rebase -i" with option rebase.autosquash=true; effectively allows casual amending of commits
//other than the current branch head. In the common case where nothing else is changed: "git commit -amf"
string msg=Stdio.File(argv[1])->read();
if (String.trim_all_whites(msg)=="f")
{
array(string) stat=Process.run("git diff --cached --stat")->stdout/"\n";
if (sizeof(stat)>1 && has_prefix(stat[1]-"s"," 1 file changed") && sscanf(stat[0]," %s |",string fn) && fn && fn!="") //As above
{
//Bound the search to unpushed changes only.
string branch=String.trim_all_whites(Process.run(({"git","symbolic-ref","--short","-q","HEAD"}))->stdout);
if (branch=="") exit(1,"Shortcut fixup commits work only on a branch.\n");
array(string) log=Process.run(({"git","log","origin/"+branch+"..","--shortstat","--full-diff","-1","--oneline",fn}))->stdout/"\n";
if (sizeof(log)>1)
{
sscanf(log[0],"%*s %s",string msg);
sscanf(msg,"fixup! %s",msg); //Don't double-head the markers
Stdio.write_file(argv[1],"fixup! "+msg);
}
}
}
}
| Pike | 5 | stephenangelico/shed | githook.pike | [
"MIT"
] |
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Why don't we use the classification error as a metric to grow a decision tree?"
]
},
{
"cell_type": "code",
"execution_count": 1,
"metadata": {
"collapsed": false
},
"outputs": [
{
"data": {
"application/javascript": [
"/* Put everything inside the global mpl namespace */\n",
"window.mpl = {};\n",
"\n",
"mpl.get_websocket_type = function() {\n",
" if (typeof(WebSocket) !== 'undefined') {\n",
" return WebSocket;\n",
" } else if (typeof(MozWebSocket) !== 'undefined') {\n",
" return MozWebSocket;\n",
" } else {\n",
" alert('Your browser does not have WebSocket support.' +\n",
" 'Please try Chrome, Safari or Firefox ≥ 6. ' +\n",
" 'Firefox 4 and 5 are also supported but you ' +\n",
" 'have to enable WebSockets in about:config.');\n",
" };\n",
"}\n",
"\n",
"mpl.figure = function(figure_id, websocket, ondownload, parent_element) {\n",
" this.id = figure_id;\n",
"\n",
" this.ws = websocket;\n",
"\n",
" this.supports_binary = (this.ws.binaryType != undefined);\n",
"\n",
" if (!this.supports_binary) {\n",
" var warnings = document.getElementById(\"mpl-warnings\");\n",
" if (warnings) {\n",
" warnings.style.display = 'block';\n",
" warnings.textContent = (\n",
" \"This browser does not support binary websocket messages. \" +\n",
" \"Performance may be slow.\");\n",
" }\n",
" }\n",
"\n",
" this.imageObj = new Image();\n",
"\n",
" this.context = undefined;\n",
" this.message = undefined;\n",
" this.canvas = undefined;\n",
" this.rubberband_canvas = undefined;\n",
" this.rubberband_context = undefined;\n",
" this.format_dropdown = undefined;\n",
"\n",
" this.image_mode = 'full';\n",
"\n",
" this.root = $('<div/>');\n",
" this._root_extra_style(this.root)\n",
" this.root.attr('style', 'display: inline-block');\n",
"\n",
" $(parent_element).append(this.root);\n",
"\n",
" this._init_header(this);\n",
" this._init_canvas(this);\n",
" this._init_toolbar(this);\n",
"\n",
" var fig = this;\n",
"\n",
" this.waiting = false;\n",
"\n",
" this.ws.onopen = function () {\n",
" fig.send_message(\"supports_binary\", {value: fig.supports_binary});\n",
" fig.send_message(\"send_image_mode\", {});\n",
" fig.send_message(\"refresh\", {});\n",
" }\n",
"\n",
" this.imageObj.onload = function() {\n",
" if (fig.image_mode == 'full') {\n",
" // Full images could contain transparency (where diff images\n",
" // almost always do), so we need to clear the canvas so that\n",
" // there is no ghosting.\n",
" fig.context.clearRect(0, 0, fig.canvas.width, fig.canvas.height);\n",
" }\n",
" fig.context.drawImage(fig.imageObj, 0, 0);\n",
" };\n",
"\n",
" this.imageObj.onunload = function() {\n",
" this.ws.close();\n",
" }\n",
"\n",
" this.ws.onmessage = this._make_on_message_function(this);\n",
"\n",
" this.ondownload = ondownload;\n",
"}\n",
"\n",
"mpl.figure.prototype._init_header = function() {\n",
" var titlebar = $(\n",
" '<div class=\"ui-dialog-titlebar ui-widget-header ui-corner-all ' +\n",
" 'ui-helper-clearfix\"/>');\n",
" var titletext = $(\n",
" '<div class=\"ui-dialog-title\" style=\"width: 100%; ' +\n",
" 'text-align: center; padding: 3px;\"/>');\n",
" titlebar.append(titletext)\n",
" this.root.append(titlebar);\n",
" this.header = titletext[0];\n",
"}\n",
"\n",
"\n",
"\n",
"mpl.figure.prototype._canvas_extra_style = function(canvas_div) {\n",
"\n",
"}\n",
"\n",
"\n",
"mpl.figure.prototype._root_extra_style = function(canvas_div) {\n",
"\n",
"}\n",
"\n",
"mpl.figure.prototype._init_canvas = function() {\n",
" var fig = this;\n",
"\n",
" var canvas_div = $('<div/>');\n",
"\n",
" canvas_div.attr('style', 'position: relative; clear: both; outline: 0');\n",
"\n",
" function canvas_keyboard_event(event) {\n",
" return fig.key_event(event, event['data']);\n",
" }\n",
"\n",
" canvas_div.keydown('key_press', canvas_keyboard_event);\n",
" canvas_div.keyup('key_release', canvas_keyboard_event);\n",
" this.canvas_div = canvas_div\n",
" this._canvas_extra_style(canvas_div)\n",
" this.root.append(canvas_div);\n",
"\n",
" var canvas = $('<canvas/>');\n",
" canvas.addClass('mpl-canvas');\n",
" canvas.attr('style', \"left: 0; top: 0; z-index: 0; outline: 0\")\n",
"\n",
" this.canvas = canvas[0];\n",
" this.context = canvas[0].getContext(\"2d\");\n",
"\n",
" var rubberband = $('<canvas/>');\n",
" rubberband.attr('style', \"position: absolute; left: 0; top: 0; z-index: 1;\")\n",
"\n",
" var pass_mouse_events = true;\n",
"\n",
" canvas_div.resizable({\n",
" start: function(event, ui) {\n",
" pass_mouse_events = false;\n",
" },\n",
" resize: function(event, ui) {\n",
" fig.request_resize(ui.size.width, ui.size.height);\n",
" },\n",
" stop: function(event, ui) {\n",
" pass_mouse_events = true;\n",
" fig.request_resize(ui.size.width, ui.size.height);\n",
" },\n",
" });\n",
"\n",
" function mouse_event_fn(event) {\n",
" if (pass_mouse_events)\n",
" return fig.mouse_event(event, event['data']);\n",
" }\n",
"\n",
" rubberband.mousedown('button_press', mouse_event_fn);\n",
" rubberband.mouseup('button_release', mouse_event_fn);\n",
" // Throttle sequential mouse events to 1 every 20ms.\n",
" rubberband.mousemove('motion_notify', mouse_event_fn);\n",
"\n",
" rubberband.mouseenter('figure_enter', mouse_event_fn);\n",
" rubberband.mouseleave('figure_leave', mouse_event_fn);\n",
"\n",
" canvas_div.on(\"wheel\", function (event) {\n",
" event = event.originalEvent;\n",
" event['data'] = 'scroll'\n",
" if (event.deltaY < 0) {\n",
" event.step = 1;\n",
" } else {\n",
" event.step = -1;\n",
" }\n",
" mouse_event_fn(event);\n",
" });\n",
"\n",
" canvas_div.append(canvas);\n",
" canvas_div.append(rubberband);\n",
"\n",
" this.rubberband = rubberband;\n",
" this.rubberband_canvas = rubberband[0];\n",
" this.rubberband_context = rubberband[0].getContext(\"2d\");\n",
" this.rubberband_context.strokeStyle = \"#000000\";\n",
"\n",
" this._resize_canvas = function(width, height) {\n",
" // Keep the size of the canvas, canvas container, and rubber band\n",
" // canvas in synch.\n",
" canvas_div.css('width', width)\n",
" canvas_div.css('height', height)\n",
"\n",
" canvas.attr('width', width);\n",
" canvas.attr('height', height);\n",
"\n",
" rubberband.attr('width', width);\n",
" rubberband.attr('height', height);\n",
" }\n",
"\n",
" // Set the figure to an initial 600x600px, this will subsequently be updated\n",
" // upon first draw.\n",
" this._resize_canvas(600, 600);\n",
"\n",
" // Disable right mouse context menu.\n",
" $(this.rubberband_canvas).bind(\"contextmenu\",function(e){\n",
" return false;\n",
" });\n",
"\n",
" function set_focus () {\n",
" canvas.focus();\n",
" canvas_div.focus();\n",
" }\n",
"\n",
" window.setTimeout(set_focus, 100);\n",
"}\n",
"\n",
"mpl.figure.prototype._init_toolbar = function() {\n",
" var fig = this;\n",
"\n",
" var nav_element = $('<div/>')\n",
" nav_element.attr('style', 'width: 100%');\n",
" this.root.append(nav_element);\n",
"\n",
" // Define a callback function for later on.\n",
" function toolbar_event(event) {\n",
" return fig.toolbar_button_onclick(event['data']);\n",
" }\n",
" function toolbar_mouse_event(event) {\n",
" return fig.toolbar_button_onmouseover(event['data']);\n",
" }\n",
"\n",
" for(var toolbar_ind in mpl.toolbar_items) {\n",
" var name = mpl.toolbar_items[toolbar_ind][0];\n",
" var tooltip = mpl.toolbar_items[toolbar_ind][1];\n",
" var image = mpl.toolbar_items[toolbar_ind][2];\n",
" var method_name = mpl.toolbar_items[toolbar_ind][3];\n",
"\n",
" if (!name) {\n",
" // put a spacer in here.\n",
" continue;\n",
" }\n",
" var button = $('<button/>');\n",
" button.addClass('ui-button ui-widget ui-state-default ui-corner-all ' +\n",
" 'ui-button-icon-only');\n",
" button.attr('role', 'button');\n",
" button.attr('aria-disabled', 'false');\n",
" button.click(method_name, toolbar_event);\n",
" button.mouseover(tooltip, toolbar_mouse_event);\n",
"\n",
" var icon_img = $('<span/>');\n",
" icon_img.addClass('ui-button-icon-primary ui-icon');\n",
" icon_img.addClass(image);\n",
" icon_img.addClass('ui-corner-all');\n",
"\n",
" var tooltip_span = $('<span/>');\n",
" tooltip_span.addClass('ui-button-text');\n",
" tooltip_span.html(tooltip);\n",
"\n",
" button.append(icon_img);\n",
" button.append(tooltip_span);\n",
"\n",
" nav_element.append(button);\n",
" }\n",
"\n",
" var fmt_picker_span = $('<span/>');\n",
"\n",
" var fmt_picker = $('<select/>');\n",
" fmt_picker.addClass('mpl-toolbar-option ui-widget ui-widget-content');\n",
" fmt_picker_span.append(fmt_picker);\n",
" nav_element.append(fmt_picker_span);\n",
" this.format_dropdown = fmt_picker[0];\n",
"\n",
" for (var ind in mpl.extensions) {\n",
" var fmt = mpl.extensions[ind];\n",
" var option = $(\n",
" '<option/>', {selected: fmt === mpl.default_extension}).html(fmt);\n",
" fmt_picker.append(option)\n",
" }\n",
"\n",
" // Add hover states to the ui-buttons\n",
" $( \".ui-button\" ).hover(\n",
" function() { $(this).addClass(\"ui-state-hover\");},\n",
" function() { $(this).removeClass(\"ui-state-hover\");}\n",
" );\n",
"\n",
" var status_bar = $('<span class=\"mpl-message\"/>');\n",
" nav_element.append(status_bar);\n",
" this.message = status_bar[0];\n",
"}\n",
"\n",
"mpl.figure.prototype.request_resize = function(x_pixels, y_pixels) {\n",
" // Request matplotlib to resize the figure. Matplotlib will then trigger a resize in the client,\n",
" // which will in turn request a refresh of the image.\n",
" this.send_message('resize', {'width': x_pixels, 'height': y_pixels});\n",
"}\n",
"\n",
"mpl.figure.prototype.send_message = function(type, properties) {\n",
" properties['type'] = type;\n",
" properties['figure_id'] = this.id;\n",
" this.ws.send(JSON.stringify(properties));\n",
"}\n",
"\n",
"mpl.figure.prototype.send_draw_message = function() {\n",
" if (!this.waiting) {\n",
" this.waiting = true;\n",
" this.ws.send(JSON.stringify({type: \"draw\", figure_id: this.id}));\n",
" }\n",
"}\n",
"\n",
"\n",
"mpl.figure.prototype.handle_save = function(fig, msg) {\n",
" var format_dropdown = fig.format_dropdown;\n",
" var format = format_dropdown.options[format_dropdown.selectedIndex].value;\n",
" fig.ondownload(fig, format);\n",
"}\n",
"\n",
"\n",
"mpl.figure.prototype.handle_resize = function(fig, msg) {\n",
" var size = msg['size'];\n",
" if (size[0] != fig.canvas.width || size[1] != fig.canvas.height) {\n",
" fig._resize_canvas(size[0], size[1]);\n",
" fig.send_message(\"refresh\", {});\n",
" };\n",
"}\n",
"\n",
"mpl.figure.prototype.handle_rubberband = function(fig, msg) {\n",
" var x0 = msg['x0'];\n",
" var y0 = fig.canvas.height - msg['y0'];\n",
" var x1 = msg['x1'];\n",
" var y1 = fig.canvas.height - msg['y1'];\n",
" x0 = Math.floor(x0) + 0.5;\n",
" y0 = Math.floor(y0) + 0.5;\n",
" x1 = Math.floor(x1) + 0.5;\n",
" y1 = Math.floor(y1) + 0.5;\n",
" var min_x = Math.min(x0, x1);\n",
" var min_y = Math.min(y0, y1);\n",
" var width = Math.abs(x1 - x0);\n",
" var height = Math.abs(y1 - y0);\n",
"\n",
" fig.rubberband_context.clearRect(\n",
" 0, 0, fig.canvas.width, fig.canvas.height);\n",
"\n",
" fig.rubberband_context.strokeRect(min_x, min_y, width, height);\n",
"}\n",
"\n",
"mpl.figure.prototype.handle_figure_label = function(fig, msg) {\n",
" // Updates the figure title.\n",
" fig.header.textContent = msg['label'];\n",
"}\n",
"\n",
"mpl.figure.prototype.handle_cursor = function(fig, msg) {\n",
" var cursor = msg['cursor'];\n",
" switch(cursor)\n",
" {\n",
" case 0:\n",
" cursor = 'pointer';\n",
" break;\n",
" case 1:\n",
" cursor = 'default';\n",
" break;\n",
" case 2:\n",
" cursor = 'crosshair';\n",
" break;\n",
" case 3:\n",
" cursor = 'move';\n",
" break;\n",
" }\n",
" fig.rubberband_canvas.style.cursor = cursor;\n",
"}\n",
"\n",
"mpl.figure.prototype.handle_message = function(fig, msg) {\n",
" fig.message.textContent = msg['message'];\n",
"}\n",
"\n",
"mpl.figure.prototype.handle_draw = function(fig, msg) {\n",
" // Request the server to send over a new figure.\n",
" fig.send_draw_message();\n",
"}\n",
"\n",
"mpl.figure.prototype.handle_image_mode = function(fig, msg) {\n",
" fig.image_mode = msg['mode'];\n",
"}\n",
"\n",
"mpl.figure.prototype.updated_canvas_event = function() {\n",
" // Called whenever the canvas gets updated.\n",
" this.send_message(\"ack\", {});\n",
"}\n",
"\n",
"// A function to construct a web socket function for onmessage handling.\n",
"// Called in the figure constructor.\n",
"mpl.figure.prototype._make_on_message_function = function(fig) {\n",
" return function socket_on_message(evt) {\n",
" if (evt.data instanceof Blob) {\n",
" /* FIXME: We get \"Resource interpreted as Image but\n",
" * transferred with MIME type text/plain:\" errors on\n",
" * Chrome. But how to set the MIME type? It doesn't seem\n",
" * to be part of the websocket stream */\n",
" evt.data.type = \"image/png\";\n",
"\n",
" /* Free the memory for the previous frames */\n",
" if (fig.imageObj.src) {\n",
" (window.URL || window.webkitURL).revokeObjectURL(\n",
" fig.imageObj.src);\n",
" }\n",
"\n",
" fig.imageObj.src = (window.URL || window.webkitURL).createObjectURL(\n",
" evt.data);\n",
" fig.updated_canvas_event();\n",
" fig.waiting = false;\n",
" return;\n",
" }\n",
" else if (typeof evt.data === 'string' && evt.data.slice(0, 21) == \"data:image/png;base64\") {\n",
" fig.imageObj.src = evt.data;\n",
" fig.updated_canvas_event();\n",
" fig.waiting = false;\n",
" return;\n",
" }\n",
"\n",
" var msg = JSON.parse(evt.data);\n",
" var msg_type = msg['type'];\n",
"\n",
" // Call the \"handle_{type}\" callback, which takes\n",
" // the figure and JSON message as its only arguments.\n",
" try {\n",
" var callback = fig[\"handle_\" + msg_type];\n",
" } catch (e) {\n",
" console.log(\"No handler for the '\" + msg_type + \"' message type: \", msg);\n",
" return;\n",
" }\n",
"\n",
" if (callback) {\n",
" try {\n",
" // console.log(\"Handling '\" + msg_type + \"' message: \", msg);\n",
" callback(fig, msg);\n",
" } catch (e) {\n",
" console.log(\"Exception inside the 'handler_\" + msg_type + \"' callback:\", e, e.stack, msg);\n",
" }\n",
" }\n",
" };\n",
"}\n",
"\n",
"// from http://stackoverflow.com/questions/1114465/getting-mouse-location-in-canvas\n",
"mpl.findpos = function(e) {\n",
" //this section is from http://www.quirksmode.org/js/events_properties.html\n",
" var targ;\n",
" if (!e)\n",
" e = window.event;\n",
" if (e.target)\n",
" targ = e.target;\n",
" else if (e.srcElement)\n",
" targ = e.srcElement;\n",
" if (targ.nodeType == 3) // defeat Safari bug\n",
" targ = targ.parentNode;\n",
"\n",
" // jQuery normalizes the pageX and pageY\n",
" // pageX,Y are the mouse positions relative to the document\n",
" // offset() returns the position of the element relative to the document\n",
" var x = e.pageX - $(targ).offset().left;\n",
" var y = e.pageY - $(targ).offset().top;\n",
"\n",
" return {\"x\": x, \"y\": y};\n",
"};\n",
"\n",
"/*\n",
" * return a copy of an object with only non-object keys\n",
" * we need this to avoid circular references\n",
" * http://stackoverflow.com/a/24161582/3208463\n",
" */\n",
"function simpleKeys (original) {\n",
" return Object.keys(original).reduce(function (obj, key) {\n",
" if (typeof original[key] !== 'object')\n",
" obj[key] = original[key]\n",
" return obj;\n",
" }, {});\n",
"}\n",
"\n",
"mpl.figure.prototype.mouse_event = function(event, name) {\n",
" var canvas_pos = mpl.findpos(event)\n",
"\n",
" if (name === 'button_press')\n",
" {\n",
" this.canvas.focus();\n",
" this.canvas_div.focus();\n",
" }\n",
"\n",
" var x = canvas_pos.x;\n",
" var y = canvas_pos.y;\n",
"\n",
" this.send_message(name, {x: x, y: y, button: event.button,\n",
" step: event.step,\n",
" guiEvent: simpleKeys(event)});\n",
"\n",
" /* This prevents the web browser from automatically changing to\n",
" * the text insertion cursor when the button is pressed. We want\n",
" * to control all of the cursor setting manually through the\n",
" * 'cursor' event from matplotlib */\n",
" event.preventDefault();\n",
" return false;\n",
"}\n",
"\n",
"mpl.figure.prototype._key_event_extra = function(event, name) {\n",
" // Handle any extra behaviour associated with a key event\n",
"}\n",
"\n",
"mpl.figure.prototype.key_event = function(event, name) {\n",
"\n",
" // Prevent repeat events\n",
" if (name == 'key_press')\n",
" {\n",
" if (event.which === this._key)\n",
" return;\n",
" else\n",
" this._key = event.which;\n",
" }\n",
" if (name == 'key_release')\n",
" this._key = null;\n",
"\n",
" var value = '';\n",
" if (event.ctrlKey && event.which != 17)\n",
" value += \"ctrl+\";\n",
" if (event.altKey && event.which != 18)\n",
" value += \"alt+\";\n",
" if (event.shiftKey && event.which != 16)\n",
" value += \"shift+\";\n",
"\n",
" value += 'k';\n",
" value += event.which.toString();\n",
"\n",
" this._key_event_extra(event, name);\n",
"\n",
" this.send_message(name, {key: value,\n",
" guiEvent: simpleKeys(event)});\n",
" return false;\n",
"}\n",
"\n",
"mpl.figure.prototype.toolbar_button_onclick = function(name) {\n",
" if (name == 'download') {\n",
" this.handle_save(this, null);\n",
" } else {\n",
" this.send_message(\"toolbar_button\", {name: name});\n",
" }\n",
"};\n",
"\n",
"mpl.figure.prototype.toolbar_button_onmouseover = function(tooltip) {\n",
" this.message.textContent = tooltip;\n",
"};\n",
"mpl.toolbar_items = [[\"Home\", \"Reset original view\", \"fa fa-home icon-home\", \"home\"], [\"Back\", \"Back to previous view\", \"fa fa-arrow-left icon-arrow-left\", \"back\"], [\"Forward\", \"Forward to next view\", \"fa fa-arrow-right icon-arrow-right\", \"forward\"], [\"\", \"\", \"\", \"\"], [\"Pan\", \"Pan axes with left mouse, zoom with right\", \"fa fa-arrows icon-move\", \"pan\"], [\"Zoom\", \"Zoom to rectangle\", \"fa fa-square-o icon-check-empty\", \"zoom\"], [\"\", \"\", \"\", \"\"], [\"Download\", \"Download plot\", \"fa fa-floppy-o icon-save\", \"download\"]];\n",
"\n",
"mpl.extensions = [\"eps\", \"pdf\", \"png\", \"ps\", \"raw\", \"svg\"];\n",
"\n",
"mpl.default_extension = \"png\";var comm_websocket_adapter = function(comm) {\n",
" // Create a \"websocket\"-like object which calls the given IPython comm\n",
" // object with the appropriate methods. Currently this is a non binary\n",
" // socket, so there is still some room for performance tuning.\n",
" var ws = {};\n",
"\n",
" ws.close = function() {\n",
" comm.close()\n",
" };\n",
" ws.send = function(m) {\n",
" //console.log('sending', m);\n",
" comm.send(m);\n",
" };\n",
" // Register the callback with on_msg.\n",
" comm.on_msg(function(msg) {\n",
" //console.log('receiving', msg['content']['data'], msg);\n",
" // Pass the mpl event to the overriden (by mpl) onmessage function.\n",
" ws.onmessage(msg['content']['data'])\n",
" });\n",
" return ws;\n",
"}\n",
"\n",
"mpl.mpl_figure_comm = function(comm, msg) {\n",
" // This is the function which gets called when the mpl process\n",
" // starts-up an IPython Comm through the \"matplotlib\" channel.\n",
"\n",
" var id = msg.content.data.id;\n",
" // Get hold of the div created by the display call when the Comm\n",
" // socket was opened in Python.\n",
" var element = $(\"#\" + id);\n",
" var ws_proxy = comm_websocket_adapter(comm)\n",
"\n",
" function ondownload(figure, format) {\n",
" window.open(figure.imageObj.src);\n",
" }\n",
"\n",
" var fig = new mpl.figure(id, ws_proxy,\n",
" ondownload,\n",
" element.get(0));\n",
"\n",
" // Call onopen now - mpl needs it, as it is assuming we've passed it a real\n",
" // web socket which is closed, not our websocket->open comm proxy.\n",
" ws_proxy.onopen();\n",
"\n",
" fig.parent_element = element.get(0);\n",
" fig.cell_info = mpl.find_output_cell(\"<div id='\" + id + \"'></div>\");\n",
" if (!fig.cell_info) {\n",
" console.error(\"Failed to find cell for figure\", id, fig);\n",
" return;\n",
" }\n",
"\n",
" var output_index = fig.cell_info[2]\n",
" var cell = fig.cell_info[0];\n",
"\n",
"};\n",
"\n",
"mpl.figure.prototype.handle_close = function(fig, msg) {\n",
" fig.root.unbind('remove')\n",
"\n",
" // Update the output cell to use the data from the current canvas.\n",
" fig.push_to_output();\n",
" var dataURL = fig.canvas.toDataURL();\n",
" // Re-enable the keyboard manager in IPython - without this line, in FF,\n",
" // the notebook keyboard shortcuts fail.\n",
" IPython.keyboard_manager.enable()\n",
" $(fig.parent_element).html('<img src=\"' + dataURL + '\">');\n",
" fig.close_ws(fig, msg);\n",
"}\n",
"\n",
"mpl.figure.prototype.close_ws = function(fig, msg){\n",
" fig.send_message('closing', msg);\n",
" // fig.ws.close()\n",
"}\n",
"\n",
"mpl.figure.prototype.push_to_output = function(remove_interactive) {\n",
" // Turn the data on the canvas into data in the output cell.\n",
" var dataURL = this.canvas.toDataURL();\n",
" this.cell_info[1]['text/html'] = '<img src=\"' + dataURL + '\">';\n",
"}\n",
"\n",
"mpl.figure.prototype.updated_canvas_event = function() {\n",
" // Tell IPython that the notebook contents must change.\n",
" IPython.notebook.set_dirty(true);\n",
" this.send_message(\"ack\", {});\n",
" var fig = this;\n",
" // Wait a second, then push the new image to the DOM so\n",
" // that it is saved nicely (might be nice to debounce this).\n",
" setTimeout(function () { fig.push_to_output() }, 1000);\n",
"}\n",
"\n",
"mpl.figure.prototype._init_toolbar = function() {\n",
" var fig = this;\n",
"\n",
" var nav_element = $('<div/>')\n",
" nav_element.attr('style', 'width: 100%');\n",
" this.root.append(nav_element);\n",
"\n",
" // Define a callback function for later on.\n",
" function toolbar_event(event) {\n",
" return fig.toolbar_button_onclick(event['data']);\n",
" }\n",
" function toolbar_mouse_event(event) {\n",
" return fig.toolbar_button_onmouseover(event['data']);\n",
" }\n",
"\n",
" for(var toolbar_ind in mpl.toolbar_items){\n",
" var name = mpl.toolbar_items[toolbar_ind][0];\n",
" var tooltip = mpl.toolbar_items[toolbar_ind][1];\n",
" var image = mpl.toolbar_items[toolbar_ind][2];\n",
" var method_name = mpl.toolbar_items[toolbar_ind][3];\n",
"\n",
" if (!name) { continue; };\n",
"\n",
" var button = $('<button class=\"btn btn-default\" href=\"#\" title=\"' + name + '\"><i class=\"fa ' + image + ' fa-lg\"></i></button>');\n",
" button.click(method_name, toolbar_event);\n",
" button.mouseover(tooltip, toolbar_mouse_event);\n",
" nav_element.append(button);\n",
" }\n",
"\n",
" // Add the status bar.\n",
" var status_bar = $('<span class=\"mpl-message\" style=\"text-align:right; float: right;\"/>');\n",
" nav_element.append(status_bar);\n",
" this.message = status_bar[0];\n",
"\n",
" // Add the close button to the window.\n",
" var buttongrp = $('<div class=\"btn-group inline pull-right\"></div>');\n",
" var button = $('<button class=\"btn btn-mini btn-primary\" href=\"#\" title=\"Stop Interaction\"><i class=\"fa fa-power-off icon-remove icon-large\"></i></button>');\n",
" button.click(function (evt) { fig.handle_close(fig, {}); } );\n",
" button.mouseover('Stop Interaction', toolbar_mouse_event);\n",
" buttongrp.append(button);\n",
" var titlebar = this.root.find($('.ui-dialog-titlebar'));\n",
" titlebar.prepend(buttongrp);\n",
"}\n",
"\n",
"mpl.figure.prototype._root_extra_style = function(el){\n",
" var fig = this\n",
" el.on(\"remove\", function(){\n",
"\tfig.close_ws(fig, {});\n",
" });\n",
"}\n",
"\n",
"mpl.figure.prototype._canvas_extra_style = function(el){\n",
" // this is important to make the div 'focusable\n",
" el.attr('tabindex', 0)\n",
" // reach out to IPython and tell the keyboard manager to turn it's self\n",
" // off when our div gets focus\n",
"\n",
" // location in version 3\n",
" if (IPython.notebook.keyboard_manager) {\n",
" IPython.notebook.keyboard_manager.register_events(el);\n",
" }\n",
" else {\n",
" // location in version 2\n",
" IPython.keyboard_manager.register_events(el);\n",
" }\n",
"\n",
"}\n",
"\n",
"mpl.figure.prototype._key_event_extra = function(event, name) {\n",
" var manager = IPython.notebook.keyboard_manager;\n",
" if (!manager)\n",
" manager = IPython.keyboard_manager;\n",
"\n",
" // Check for shift+enter\n",
" if (event.shiftKey && event.which == 13) {\n",
" this.canvas_div.blur();\n",
" event.shiftKey = false;\n",
" // Send a \"J\" for go to next cell\n",
" event.which = 74;\n",
" event.keyCode = 74;\n",
" manager.command_mode();\n",
" manager.handle_keydown(event);\n",
" }\n",
"}\n",
"\n",
"mpl.figure.prototype.handle_save = function(fig, msg) {\n",
" fig.ondownload(fig, null);\n",
"}\n",
"\n",
"\n",
"mpl.find_output_cell = function(html_output) {\n",
" // Return the cell and output element which can be found *uniquely* in the notebook.\n",
" // Note - this is a bit hacky, but it is done because the \"notebook_saving.Notebook\"\n",
" // IPython event is triggered only after the cells have been serialised, which for\n",
" // our purposes (turning an active figure into a static one), is too late.\n",
" var cells = IPython.notebook.get_cells();\n",
" var ncells = cells.length;\n",
" for (var i=0; i<ncells; i++) {\n",
" var cell = cells[i];\n",
" if (cell.cell_type === 'code'){\n",
" for (var j=0; j<cell.output_area.outputs.length; j++) {\n",
" var data = cell.output_area.outputs[j];\n",
" if (data.data) {\n",
" // IPython >= 3 moved mimebundle to data attribute of output\n",
" data = data.data;\n",
" }\n",
" if (data['text/html'] == html_output) {\n",
" return [cell, data, j];\n",
" }\n",
" }\n",
" }\n",
" }\n",
"}\n",
"\n",
"// Register the function which deals with the matplotlib target/channel.\n",
"// The kernel may be null if the page has been refreshed.\n",
"if (IPython.notebook.kernel != null) {\n",
" IPython.notebook.kernel.comm_manager.register_target('matplotlib', mpl.mpl_figure_comm);\n",
"}\n"
],
"text/plain": [
"<IPython.core.display.Javascript object>"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"text/html": [
"<img src=\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAoAAAAHgCAYAAAA10dzkAAAAAXNSR0IArs4c6QAAQABJREFUeAHt3Qe8FNXZx/E/RRBFioodRUSjCKixYsOCYsHeY40lscYSNAmJijF2X6NRjInd2HuJUazYNXaKXSQqKiIqKBZQ7vs8d1jvcrlld2d2dsrvfD7PvbuzM2fOfM/cnXOnnCOREEAAAQQQQAABBBBAAAEEEEAAAQQQQAABBBBAAAEEEEAAAQQQQAABBBBAAAEEEEAAAQQQQAABBBBAAAEEEEAAAQQQQAABBBBAAAEEEEAAAQQQQAABBBBAAAEEEEAAAQQQQAABBBBAAA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urcwT1ccXWEYnRZUZ+SCAAAJRCXAJOCpJ8kEAgbQI+CXZuNLRca2I9SCAAALlCPAQSDlazIsAAkkX8PvvSAgggAACCCCAAAIIIIAAAggggAACCCCAAAIIIIAAAggggAACCCCAAAIIIIAAAggggAACCCCAAAIIIIAAAggggAACCCCAAAIIIIAAAggggAACCCCAAAIIIIAAAggggAACCCCAAAIIIIAAAggggAACCCCAAAIIIIAAAggggAACCCCAAAIIIIAAAggggAACCCCAAAIIIIAAAggggEAogf8H+KuMLkJDZAYAAAAASUVORK5CYII=\">"
],
"text/plain": [
"<IPython.core.display.HTML object>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"import numpy as np\n",
"import matplotlib.pyplot as plt\n",
"%matplotlib notebook\n",
"\n",
"\n",
"def entropy(p):\n",
" return - p*np.log2(p) - (1 - p)*np.log2((1 - p))\n",
"x = np.arange(0.0, 1.0, 0.01)\n",
"ent = [entropy(p) if p != 0 else None for p in x]\n",
"plt.plot(x, ent)\n",
"plt.ylim([0,1.1])\n",
"plt.xlabel('p(i=1)')\n",
"plt.axhline(y=1.0, linewidth=1, color='k', linestyle='--')\n",
"plt.ylabel('Entropy')\n",
"plt.show()"
]
},
{
"cell_type": "code",
"execution_count": 14,
"metadata": {
"collapsed": false
},
"outputs": [
{
"data": {
"application/javascript": [
"/* Put everything inside the global mpl namespace */\n",
"window.mpl = {};\n",
"\n",
"mpl.get_websocket_type = function() {\n",
" if (typeof(WebSocket) !== 'undefined') {\n",
" return WebSocket;\n",
" } else if (typeof(MozWebSocket) !== 'undefined') {\n",
" return MozWebSocket;\n",
" } else {\n",
" alert('Your browser does not have WebSocket support.' +\n",
" 'Please try Chrome, Safari or Firefox ≥ 6. ' +\n",
" 'Firefox 4 and 5 are also supported but you ' +\n",
" 'have to enable WebSockets in about:config.');\n",
" };\n",
"}\n",
"\n",
"mpl.figure = function(figure_id, websocket, ondownload, parent_element) {\n",
" this.id = figure_id;\n",
"\n",
" this.ws = websocket;\n",
"\n",
" this.supports_binary = (this.ws.binaryType != undefined);\n",
"\n",
" if (!this.supports_binary) {\n",
" var warnings = document.getElementById(\"mpl-warnings\");\n",
" if (warnings) {\n",
" warnings.style.display = 'block';\n",
" warnings.textContent = (\n",
" \"This browser does not support binary websocket messages. \" +\n",
" \"Performance may be slow.\");\n",
" }\n",
" }\n",
"\n",
" this.imageObj = new Image();\n",
"\n",
" this.context = undefined;\n",
" this.message = undefined;\n",
" this.canvas = undefined;\n",
" this.rubberband_canvas = undefined;\n",
" this.rubberband_context = undefined;\n",
" this.format_dropdown = undefined;\n",
"\n",
" this.image_mode = 'full';\n",
"\n",
" this.root = $('<div/>');\n",
" this._root_extra_style(this.root)\n",
" this.root.attr('style', 'display: inline-block');\n",
"\n",
" $(parent_element).append(this.root);\n",
"\n",
" this._init_header(this);\n",
" this._init_canvas(this);\n",
" this._init_toolbar(this);\n",
"\n",
" var fig = this;\n",
"\n",
" this.waiting = false;\n",
"\n",
" this.ws.onopen = function () {\n",
" fig.send_message(\"supports_binary\", {value: fig.supports_binary});\n",
" fig.send_message(\"send_image_mode\", {});\n",
" fig.send_message(\"refresh\", {});\n",
" }\n",
"\n",
" this.imageObj.onload = function() {\n",
" if (fig.image_mode == 'full') {\n",
" // Full images could contain transparency (where diff images\n",
" // almost always do), so we need to clear the canvas so that\n",
" // there is no ghosting.\n",
" fig.context.clearRect(0, 0, fig.canvas.width, fig.canvas.height);\n",
" }\n",
" fig.context.drawImage(fig.imageObj, 0, 0);\n",
" };\n",
"\n",
" this.imageObj.onunload = function() {\n",
" this.ws.close();\n",
" }\n",
"\n",
" this.ws.onmessage = this._make_on_message_function(this);\n",
"\n",
" this.ondownload = ondownload;\n",
"}\n",
"\n",
"mpl.figure.prototype._init_header = function() {\n",
" var titlebar = $(\n",
" '<div class=\"ui-dialog-titlebar ui-widget-header ui-corner-all ' +\n",
" 'ui-helper-clearfix\"/>');\n",
" var titletext = $(\n",
" '<div class=\"ui-dialog-title\" style=\"width: 100%; ' +\n",
" 'text-align: center; padding: 3px;\"/>');\n",
" titlebar.append(titletext)\n",
" this.root.append(titlebar);\n",
" this.header = titletext[0];\n",
"}\n",
"\n",
"\n",
"\n",
"mpl.figure.prototype._canvas_extra_style = function(canvas_div) {\n",
"\n",
"}\n",
"\n",
"\n",
"mpl.figure.prototype._root_extra_style = function(canvas_div) {\n",
"\n",
"}\n",
"\n",
"mpl.figure.prototype._init_canvas = function() {\n",
" var fig = this;\n",
"\n",
" var canvas_div = $('<div/>');\n",
"\n",
" canvas_div.attr('style', 'position: relative; clear: both; outline: 0');\n",
"\n",
" function canvas_keyboard_event(event) {\n",
" return fig.key_event(event, event['data']);\n",
" }\n",
"\n",
" canvas_div.keydown('key_press', canvas_keyboard_event);\n",
" canvas_div.keyup('key_release', canvas_keyboard_event);\n",
" this.canvas_div = canvas_div\n",
" this._canvas_extra_style(canvas_div)\n",
" this.root.append(canvas_div);\n",
"\n",
" var canvas = $('<canvas/>');\n",
" canvas.addClass('mpl-canvas');\n",
" canvas.attr('style', \"left: 0; top: 0; z-index: 0; outline: 0\")\n",
"\n",
" this.canvas = canvas[0];\n",
" this.context = canvas[0].getContext(\"2d\");\n",
"\n",
" var rubberband = $('<canvas/>');\n",
" rubberband.attr('style', \"position: absolute; left: 0; top: 0; z-index: 1;\")\n",
"\n",
" var pass_mouse_events = true;\n",
"\n",
" canvas_div.resizable({\n",
" start: function(event, ui) {\n",
" pass_mouse_events = false;\n",
" },\n",
" resize: function(event, ui) {\n",
" fig.request_resize(ui.size.width, ui.size.height);\n",
" },\n",
" stop: function(event, ui) {\n",
" pass_mouse_events = true;\n",
" fig.request_resize(ui.size.width, ui.size.height);\n",
" },\n",
" });\n",
"\n",
" function mouse_event_fn(event) {\n",
" if (pass_mouse_events)\n",
" return fig.mouse_event(event, event['data']);\n",
" }\n",
"\n",
" rubberband.mousedown('button_press', mouse_event_fn);\n",
" rubberband.mouseup('button_release', mouse_event_fn);\n",
" // Throttle sequential mouse events to 1 every 20ms.\n",
" rubberband.mousemove('motion_notify', mouse_event_fn);\n",
"\n",
" rubberband.mouseenter('figure_enter', mouse_event_fn);\n",
" rubberband.mouseleave('figure_leave', mouse_event_fn);\n",
"\n",
" canvas_div.on(\"wheel\", function (event) {\n",
" event = event.originalEvent;\n",
" event['data'] = 'scroll'\n",
" if (event.deltaY < 0) {\n",
" event.step = 1;\n",
" } else {\n",
" event.step = -1;\n",
" }\n",
" mouse_event_fn(event);\n",
" });\n",
"\n",
" canvas_div.append(canvas);\n",
" canvas_div.append(rubberband);\n",
"\n",
" this.rubberband = rubberband;\n",
" this.rubberband_canvas = rubberband[0];\n",
" this.rubberband_context = rubberband[0].getContext(\"2d\");\n",
" this.rubberband_context.strokeStyle = \"#000000\";\n",
"\n",
" this._resize_canvas = function(width, height) {\n",
" // Keep the size of the canvas, canvas container, and rubber band\n",
" // canvas in synch.\n",
" canvas_div.css('width', width)\n",
" canvas_div.css('height', height)\n",
"\n",
" canvas.attr('width', width);\n",
" canvas.attr('height', height);\n",
"\n",
" rubberband.attr('width', width);\n",
" rubberband.attr('height', height);\n",
" }\n",
"\n",
" // Set the figure to an initial 600x600px, this will subsequently be updated\n",
" // upon first draw.\n",
" this._resize_canvas(600, 600);\n",
"\n",
" // Disable right mouse context menu.\n",
" $(this.rubberband_canvas).bind(\"contextmenu\",function(e){\n",
" return false;\n",
" });\n",
"\n",
" function set_focus () {\n",
" canvas.focus();\n",
" canvas_div.focus();\n",
" }\n",
"\n",
" window.setTimeout(set_focus, 100);\n",
"}\n",
"\n",
"mpl.figure.prototype._init_toolbar = function() {\n",
" var fig = this;\n",
"\n",
" var nav_element = $('<div/>')\n",
" nav_element.attr('style', 'width: 100%');\n",
" this.root.append(nav_element);\n",
"\n",
" // Define a callback function for later on.\n",
" function toolbar_event(event) {\n",
" return fig.toolbar_button_onclick(event['data']);\n",
" }\n",
" function toolbar_mouse_event(event) {\n",
" return fig.toolbar_button_onmouseover(event['data']);\n",
" }\n",
"\n",
" for(var toolbar_ind in mpl.toolbar_items) {\n",
" var name = mpl.toolbar_items[toolbar_ind][0];\n",
" var tooltip = mpl.toolbar_items[toolbar_ind][1];\n",
" var image = mpl.toolbar_items[toolbar_ind][2];\n",
" var method_name = mpl.toolbar_items[toolbar_ind][3];\n",
"\n",
" if (!name) {\n",
" // put a spacer in here.\n",
" continue;\n",
" }\n",
" var button = $('<button/>');\n",
" button.addClass('ui-button ui-widget ui-state-default ui-corner-all ' +\n",
" 'ui-button-icon-only');\n",
" button.attr('role', 'button');\n",
" button.attr('aria-disabled', 'false');\n",
" button.click(method_name, toolbar_event);\n",
" button.mouseover(tooltip, toolbar_mouse_event);\n",
"\n",
" var icon_img = $('<span/>');\n",
" icon_img.addClass('ui-button-icon-primary ui-icon');\n",
" icon_img.addClass(image);\n",
" icon_img.addClass('ui-corner-all');\n",
"\n",
" var tooltip_span = $('<span/>');\n",
" tooltip_span.addClass('ui-button-text');\n",
" tooltip_span.html(tooltip);\n",
"\n",
" button.append(icon_img);\n",
" button.append(tooltip_span);\n",
"\n",
" nav_element.append(button);\n",
" }\n",
"\n",
" var fmt_picker_span = $('<span/>');\n",
"\n",
" var fmt_picker = $('<select/>');\n",
" fmt_picker.addClass('mpl-toolbar-option ui-widget ui-widget-content');\n",
" fmt_picker_span.append(fmt_picker);\n",
" nav_element.append(fmt_picker_span);\n",
" this.format_dropdown = fmt_picker[0];\n",
"\n",
" for (var ind in mpl.extensions) {\n",
" var fmt = mpl.extensions[ind];\n",
" var option = $(\n",
" '<option/>', {selected: fmt === mpl.default_extension}).html(fmt);\n",
" fmt_picker.append(option)\n",
" }\n",
"\n",
" // Add hover states to the ui-buttons\n",
" $( \".ui-button\" ).hover(\n",
" function() { $(this).addClass(\"ui-state-hover\");},\n",
" function() { $(this).removeClass(\"ui-state-hover\");}\n",
" );\n",
"\n",
" var status_bar = $('<span class=\"mpl-message\"/>');\n",
" nav_element.append(status_bar);\n",
" this.message = status_bar[0];\n",
"}\n",
"\n",
"mpl.figure.prototype.request_resize = function(x_pixels, y_pixels) {\n",
" // Request matplotlib to resize the figure. Matplotlib will then trigger a resize in the client,\n",
" // which will in turn request a refresh of the image.\n",
" this.send_message('resize', {'width': x_pixels, 'height': y_pixels});\n",
"}\n",
"\n",
"mpl.figure.prototype.send_message = function(type, properties) {\n",
" properties['type'] = type;\n",
" properties['figure_id'] = this.id;\n",
" this.ws.send(JSON.stringify(properties));\n",
"}\n",
"\n",
"mpl.figure.prototype.send_draw_message = function() {\n",
" if (!this.waiting) {\n",
" this.waiting = true;\n",
" this.ws.send(JSON.stringify({type: \"draw\", figure_id: this.id}));\n",
" }\n",
"}\n",
"\n",
"\n",
"mpl.figure.prototype.handle_save = function(fig, msg) {\n",
" var format_dropdown = fig.format_dropdown;\n",
" var format = format_dropdown.options[format_dropdown.selectedIndex].value;\n",
" fig.ondownload(fig, format);\n",
"}\n",
"\n",
"\n",
"mpl.figure.prototype.handle_resize = function(fig, msg) {\n",
" var size = msg['size'];\n",
" if (size[0] != fig.canvas.width || size[1] != fig.canvas.height) {\n",
" fig._resize_canvas(size[0], size[1]);\n",
" fig.send_message(\"refresh\", {});\n",
" };\n",
"}\n",
"\n",
"mpl.figure.prototype.handle_rubberband = function(fig, msg) {\n",
" var x0 = msg['x0'];\n",
" var y0 = fig.canvas.height - msg['y0'];\n",
" var x1 = msg['x1'];\n",
" var y1 = fig.canvas.height - msg['y1'];\n",
" x0 = Math.floor(x0) + 0.5;\n",
" y0 = Math.floor(y0) + 0.5;\n",
" x1 = Math.floor(x1) + 0.5;\n",
" y1 = Math.floor(y1) + 0.5;\n",
" var min_x = Math.min(x0, x1);\n",
" var min_y = Math.min(y0, y1);\n",
" var width = Math.abs(x1 - x0);\n",
" var height = Math.abs(y1 - y0);\n",
"\n",
" fig.rubberband_context.clearRect(\n",
" 0, 0, fig.canvas.width, fig.canvas.height);\n",
"\n",
" fig.rubberband_context.strokeRect(min_x, min_y, width, height);\n",
"}\n",
"\n",
"mpl.figure.prototype.handle_figure_label = function(fig, msg) {\n",
" // Updates the figure title.\n",
" fig.header.textContent = msg['label'];\n",
"}\n",
"\n",
"mpl.figure.prototype.handle_cursor = function(fig, msg) {\n",
" var cursor = msg['cursor'];\n",
" switch(cursor)\n",
" {\n",
" case 0:\n",
" cursor = 'pointer';\n",
" break;\n",
" case 1:\n",
" cursor = 'default';\n",
" break;\n",
" case 2:\n",
" cursor = 'crosshair';\n",
" break;\n",
" case 3:\n",
" cursor = 'move';\n",
" break;\n",
" }\n",
" fig.rubberband_canvas.style.cursor = cursor;\n",
"}\n",
"\n",
"mpl.figure.prototype.handle_message = function(fig, msg) {\n",
" fig.message.textContent = msg['message'];\n",
"}\n",
"\n",
"mpl.figure.prototype.handle_draw = function(fig, msg) {\n",
" // Request the server to send over a new figure.\n",
" fig.send_draw_message();\n",
"}\n",
"\n",
"mpl.figure.prototype.handle_image_mode = function(fig, msg) {\n",
" fig.image_mode = msg['mode'];\n",
"}\n",
"\n",
"mpl.figure.prototype.updated_canvas_event = function() {\n",
" // Called whenever the canvas gets updated.\n",
" this.send_message(\"ack\", {});\n",
"}\n",
"\n",
"// A function to construct a web socket function for onmessage handling.\n",
"// Called in the figure constructor.\n",
"mpl.figure.prototype._make_on_message_function = function(fig) {\n",
" return function socket_on_message(evt) {\n",
" if (evt.data instanceof Blob) {\n",
" /* FIXME: We get \"Resource interpreted as Image but\n",
" * transferred with MIME type text/plain:\" errors on\n",
" * Chrome. But how to set the MIME type? It doesn't seem\n",
" * to be part of the websocket stream */\n",
" evt.data.type = \"image/png\";\n",
"\n",
" /* Free the memory for the previous frames */\n",
" if (fig.imageObj.src) {\n",
" (window.URL || window.webkitURL).revokeObjectURL(\n",
" fig.imageObj.src);\n",
" }\n",
"\n",
" fig.imageObj.src = (window.URL || window.webkitURL).createObjectURL(\n",
" evt.data);\n",
" fig.updated_canvas_event();\n",
" fig.waiting = false;\n",
" return;\n",
" }\n",
" else if (typeof evt.data === 'string' && evt.data.slice(0, 21) == \"data:image/png;base64\") {\n",
" fig.imageObj.src = evt.data;\n",
" fig.updated_canvas_event();\n",
" fig.waiting = false;\n",
" return;\n",
" }\n",
"\n",
" var msg = JSON.parse(evt.data);\n",
" var msg_type = msg['type'];\n",
"\n",
" // Call the \"handle_{type}\" callback, which takes\n",
" // the figure and JSON message as its only arguments.\n",
" try {\n",
" var callback = fig[\"handle_\" + msg_type];\n",
" } catch (e) {\n",
" console.log(\"No handler for the '\" + msg_type + \"' message type: \", msg);\n",
" return;\n",
" }\n",
"\n",
" if (callback) {\n",
" try {\n",
" // console.log(\"Handling '\" + msg_type + \"' message: \", msg);\n",
" callback(fig, msg);\n",
" } catch (e) {\n",
" console.log(\"Exception inside the 'handler_\" + msg_type + \"' callback:\", e, e.stack, msg);\n",
" }\n",
" }\n",
" };\n",
"}\n",
"\n",
"// from http://stackoverflow.com/questions/1114465/getting-mouse-location-in-canvas\n",
"mpl.findpos = function(e) {\n",
" //this section is from http://www.quirksmode.org/js/events_properties.html\n",
" var targ;\n",
" if (!e)\n",
" e = window.event;\n",
" if (e.target)\n",
" targ = e.target;\n",
" else if (e.srcElement)\n",
" targ = e.srcElement;\n",
" if (targ.nodeType == 3) // defeat Safari bug\n",
" targ = targ.parentNode;\n",
"\n",
" // jQuery normalizes the pageX and pageY\n",
" // pageX,Y are the mouse positions relative to the document\n",
" // offset() returns the position of the element relative to the document\n",
" var x = e.pageX - $(targ).offset().left;\n",
" var y = e.pageY - $(targ).offset().top;\n",
"\n",
" return {\"x\": x, \"y\": y};\n",
"};\n",
"\n",
"/*\n",
" * return a copy of an object with only non-object keys\n",
" * we need this to avoid circular references\n",
" * http://stackoverflow.com/a/24161582/3208463\n",
" */\n",
"function simpleKeys (original) {\n",
" return Object.keys(original).reduce(function (obj, key) {\n",
" if (typeof original[key] !== 'object')\n",
" obj[key] = original[key]\n",
" return obj;\n",
" }, {});\n",
"}\n",
"\n",
"mpl.figure.prototype.mouse_event = function(event, name) {\n",
" var canvas_pos = mpl.findpos(event)\n",
"\n",
" if (name === 'button_press')\n",
" {\n",
" this.canvas.focus();\n",
" this.canvas_div.focus();\n",
" }\n",
"\n",
" var x = canvas_pos.x;\n",
" var y = canvas_pos.y;\n",
"\n",
" this.send_message(name, {x: x, y: y, button: event.button,\n",
" step: event.step,\n",
" guiEvent: simpleKeys(event)});\n",
"\n",
" /* This prevents the web browser from automatically changing to\n",
" * the text insertion cursor when the button is pressed. We want\n",
" * to control all of the cursor setting manually through the\n",
" * 'cursor' event from matplotlib */\n",
" event.preventDefault();\n",
" return false;\n",
"}\n",
"\n",
"mpl.figure.prototype._key_event_extra = function(event, name) {\n",
" // Handle any extra behaviour associated with a key event\n",
"}\n",
"\n",
"mpl.figure.prototype.key_event = function(event, name) {\n",
"\n",
" // Prevent repeat events\n",
" if (name == 'key_press')\n",
" {\n",
" if (event.which === this._key)\n",
" return;\n",
" else\n",
" this._key = event.which;\n",
" }\n",
" if (name == 'key_release')\n",
" this._key = null;\n",
"\n",
" var value = '';\n",
" if (event.ctrlKey && event.which != 17)\n",
" value += \"ctrl+\";\n",
" if (event.altKey && event.which != 18)\n",
" value += \"alt+\";\n",
" if (event.shiftKey && event.which != 16)\n",
" value += \"shift+\";\n",
"\n",
" value += 'k';\n",
" value += event.which.toString();\n",
"\n",
" this._key_event_extra(event, name);\n",
"\n",
" this.send_message(name, {key: value,\n",
" guiEvent: simpleKeys(event)});\n",
" return false;\n",
"}\n",
"\n",
"mpl.figure.prototype.toolbar_button_onclick = function(name) {\n",
" if (name == 'download') {\n",
" this.handle_save(this, null);\n",
" } else {\n",
" this.send_message(\"toolbar_button\", {name: name});\n",
" }\n",
"};\n",
"\n",
"mpl.figure.prototype.toolbar_button_onmouseover = function(tooltip) {\n",
" this.message.textContent = tooltip;\n",
"};\n",
"mpl.toolbar_items = [[\"Home\", \"Reset original view\", \"fa fa-home icon-home\", \"home\"], [\"Back\", \"Back to previous view\", \"fa fa-arrow-left icon-arrow-left\", \"back\"], [\"Forward\", \"Forward to next view\", \"fa fa-arrow-right icon-arrow-right\", \"forward\"], [\"\", \"\", \"\", \"\"], [\"Pan\", \"Pan axes with left mouse, zoom with right\", \"fa fa-arrows icon-move\", \"pan\"], [\"Zoom\", \"Zoom to rectangle\", \"fa fa-square-o icon-check-empty\", \"zoom\"], [\"\", \"\", \"\", \"\"], [\"Download\", \"Download plot\", \"fa fa-floppy-o icon-save\", \"download\"]];\n",
"\n",
"mpl.extensions = [\"eps\", \"pdf\", \"png\", \"ps\", \"raw\", \"svg\"];\n",
"\n",
"mpl.default_extension = \"png\";var comm_websocket_adapter = function(comm) {\n",
" // Create a \"websocket\"-like object which calls the given IPython comm\n",
" // object with the appropriate methods. Currently this is a non binary\n",
" // socket, so there is still some room for performance tuning.\n",
" var ws = {};\n",
"\n",
" ws.close = function() {\n",
" comm.close()\n",
" };\n",
" ws.send = function(m) {\n",
" //console.log('sending', m);\n",
" comm.send(m);\n",
" };\n",
" // Register the callback with on_msg.\n",
" comm.on_msg(function(msg) {\n",
" //console.log('receiving', msg['content']['data'], msg);\n",
" // Pass the mpl event to the overriden (by mpl) onmessage function.\n",
" ws.onmessage(msg['content']['data'])\n",
" });\n",
" return ws;\n",
"}\n",
"\n",
"mpl.mpl_figure_comm = function(comm, msg) {\n",
" // This is the function which gets called when the mpl process\n",
" // starts-up an IPython Comm through the \"matplotlib\" channel.\n",
"\n",
" var id = msg.content.data.id;\n",
" // Get hold of the div created by the display call when the Comm\n",
" // socket was opened in Python.\n",
" var element = $(\"#\" + id);\n",
" var ws_proxy = comm_websocket_adapter(comm)\n",
"\n",
" function ondownload(figure, format) {\n",
" window.open(figure.imageObj.src);\n",
" }\n",
"\n",
" var fig = new mpl.figure(id, ws_proxy,\n",
" ondownload,\n",
" element.get(0));\n",
"\n",
" // Call onopen now - mpl needs it, as it is assuming we've passed it a real\n",
" // web socket which is closed, not our websocket->open comm proxy.\n",
" ws_proxy.onopen();\n",
"\n",
" fig.parent_element = element.get(0);\n",
" fig.cell_info = mpl.find_output_cell(\"<div id='\" + id + \"'></div>\");\n",
" if (!fig.cell_info) {\n",
" console.error(\"Failed to find cell for figure\", id, fig);\n",
" return;\n",
" }\n",
"\n",
" var output_index = fig.cell_info[2]\n",
" var cell = fig.cell_info[0];\n",
"\n",
"};\n",
"\n",
"mpl.figure.prototype.handle_close = function(fig, msg) {\n",
" fig.root.unbind('remove')\n",
"\n",
" // Update the output cell to use the data from the current canvas.\n",
" fig.push_to_output();\n",
" var dataURL = fig.canvas.toDataURL();\n",
" // Re-enable the keyboard manager in IPython - without this line, in FF,\n",
" // the notebook keyboard shortcuts fail.\n",
" IPython.keyboard_manager.enable()\n",
" $(fig.parent_element).html('<img src=\"' + dataURL + '\">');\n",
" fig.close_ws(fig, msg);\n",
"}\n",
"\n",
"mpl.figure.prototype.close_ws = function(fig, msg){\n",
" fig.send_message('closing', msg);\n",
" // fig.ws.close()\n",
"}\n",
"\n",
"mpl.figure.prototype.push_to_output = function(remove_interactive) {\n",
" // Turn the data on the canvas into data in the output cell.\n",
" var dataURL = this.canvas.toDataURL();\n",
" this.cell_info[1]['text/html'] = '<img src=\"' + dataURL + '\">';\n",
"}\n",
"\n",
"mpl.figure.prototype.updated_canvas_event = function() {\n",
" // Tell IPython that the notebook contents must change.\n",
" IPython.notebook.set_dirty(true);\n",
" this.send_message(\"ack\", {});\n",
" var fig = this;\n",
" // Wait a second, then push the new image to the DOM so\n",
" // that it is saved nicely (might be nice to debounce this).\n",
" setTimeout(function () { fig.push_to_output() }, 1000);\n",
"}\n",
"\n",
"mpl.figure.prototype._init_toolbar = function() {\n",
" var fig = this;\n",
"\n",
" var nav_element = $('<div/>')\n",
" nav_element.attr('style', 'width: 100%');\n",
" this.root.append(nav_element);\n",
"\n",
" // Define a callback function for later on.\n",
" function toolbar_event(event) {\n",
" return fig.toolbar_button_onclick(event['data']);\n",
" }\n",
" function toolbar_mouse_event(event) {\n",
" return fig.toolbar_button_onmouseover(event['data']);\n",
" }\n",
"\n",
" for(var toolbar_ind in mpl.toolbar_items){\n",
" var name = mpl.toolbar_items[toolbar_ind][0];\n",
" var tooltip = mpl.toolbar_items[toolbar_ind][1];\n",
" var image = mpl.toolbar_items[toolbar_ind][2];\n",
" var method_name = mpl.toolbar_items[toolbar_ind][3];\n",
"\n",
" if (!name) { continue; };\n",
"\n",
" var button = $('<button class=\"btn btn-default\" href=\"#\" title=\"' + name + '\"><i class=\"fa ' + image + ' fa-lg\"></i></button>');\n",
" button.click(method_name, toolbar_event);\n",
" button.mouseover(tooltip, toolbar_mouse_event);\n",
" nav_element.append(button);\n",
" }\n",
"\n",
" // Add the status bar.\n",
" var status_bar = $('<span class=\"mpl-message\" style=\"text-align:right; float: right;\"/>');\n",
" nav_element.append(status_bar);\n",
" this.message = status_bar[0];\n",
"\n",
" // Add the close button to the window.\n",
" var buttongrp = $('<div class=\"btn-group inline pull-right\"></div>');\n",
" var button = $('<button class=\"btn btn-mini btn-primary\" href=\"#\" title=\"Stop Interaction\"><i class=\"fa fa-power-off icon-remove icon-large\"></i></button>');\n",
" button.click(function (evt) { fig.handle_close(fig, {}); } );\n",
" button.mouseover('Stop Interaction', toolbar_mouse_event);\n",
" buttongrp.append(button);\n",
" var titlebar = this.root.find($('.ui-dialog-titlebar'));\n",
" titlebar.prepend(buttongrp);\n",
"}\n",
"\n",
"mpl.figure.prototype._root_extra_style = function(el){\n",
" var fig = this\n",
" el.on(\"remove\", function(){\n",
"\tfig.close_ws(fig, {});\n",
" });\n",
"}\n",
"\n",
"mpl.figure.prototype._canvas_extra_style = function(el){\n",
" // this is important to make the div 'focusable\n",
" el.attr('tabindex', 0)\n",
" // reach out to IPython and tell the keyboard manager to turn it's self\n",
" // off when our div gets focus\n",
"\n",
" // location in version 3\n",
" if (IPython.notebook.keyboard_manager) {\n",
" IPython.notebook.keyboard_manager.register_events(el);\n",
" }\n",
" else {\n",
" // location in version 2\n",
" IPython.keyboard_manager.register_events(el);\n",
" }\n",
"\n",
"}\n",
"\n",
"mpl.figure.prototype._key_event_extra = function(event, name) {\n",
" var manager = IPython.notebook.keyboard_manager;\n",
" if (!manager)\n",
" manager = IPython.keyboard_manager;\n",
"\n",
" // Check for shift+enter\n",
" if (event.shiftKey && event.which == 13) {\n",
" this.canvas_div.blur();\n",
" event.shiftKey = false;\n",
" // Send a \"J\" for go to next cell\n",
" event.which = 74;\n",
" event.keyCode = 74;\n",
" manager.command_mode();\n",
" manager.handle_keydown(event);\n",
" }\n",
"}\n",
"\n",
"mpl.figure.prototype.handle_save = function(fig, msg) {\n",
" fig.ondownload(fig, null);\n",
"}\n",
"\n",
"\n",
"mpl.find_output_cell = function(html_output) {\n",
" // Return the cell and output element which can be found *uniquely* in the notebook.\n",
" // Note - this is a bit hacky, but it is done because the \"notebook_saving.Notebook\"\n",
" // IPython event is triggered only after the cells have been serialised, which for\n",
" // our purposes (turning an active figure into a static one), is too late.\n",
" var cells = IPython.notebook.get_cells();\n",
" var ncells = cells.length;\n",
" for (var i=0; i<ncells; i++) {\n",
" var cell = cells[i];\n",
" if (cell.cell_type === 'code'){\n",
" for (var j=0; j<cell.output_area.outputs.length; j++) {\n",
" var data = cell.output_area.outputs[j];\n",
" if (data.data) {\n",
" // IPython >= 3 moved mimebundle to data attribute of output\n",
" data = data.data;\n",
" }\n",
" if (data['text/html'] == html_output) {\n",
" return [cell, data, j];\n",
" }\n",
" }\n",
" }\n",
" }\n",
"}\n",
"\n",
"// Register the function which deals with the matplotlib target/channel.\n",
"// The kernel may be null if the page has been refreshed.\n",
"if (IPython.notebook.kernel != null) {\n",
" IPython.notebook.kernel.comm_manager.register_target('matplotlib', mpl.mpl_figure_comm);\n",
"}\n"
],
"text/plain": [
"<IPython.core.display.Javascript object>"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"text/html": [
"<img src=\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAoAAAAHgCAYAAAA10dzkAAAAAXNSR0IArs4c6QAAQABJREFUeAHsnQm8jdX6x38IRyTKLU1S3eZB3FJdldyb4TY4TRquBtGfpIkmROOtiJRuk1sZSuXcUuFWjgZUOOiKi2ggJTkpIdNBx/4/z9n2sc+29z5773d+1299Po/9jutdv+/zvO9Z1rvWegEmEiABEiABEiABEiABEiABEiABEiABEiABEiABEiABEiABEiABEiABEiABEiABEiABEiABEiABEiABEiABEiABEiABEiABEiABEiABEiABEiABEiABEiABEiABEiABEiABEiABEiABEiABEiABEiABEiABEiABEiABEiABEiABEiABEiABEiABEiABEiABEiABEiABEiABEiABEiABEiABEiABEiABEiABEiABEiABEiABEiABEiABEiABEiABEiABEiABEiABEiABEiABEiABEiABEiABEiABEiABEiABEiABEiABEiABEiABEiABEiABEiABEiABEiABEiABEiABEiABEiABEiABEiABEiABEiABEiABEiABEiABEiABEiABEiABEiABEiABEiABEiABEiABEiABEiABEiABEiABEiABEiABEiABEiABEiABEiABEiABEiABEiABEiABEiABEiABEiABEiABEiABEiABEiABEiABEiABEiABEiABEiABEiABEiABEiABEiABEiABEiABEiABEiABEiABEiABEiABEiABEiABEiABEiABEiABEiABEiABEiABEiABEiABEiABEiABEiABEiABEiABEiABEiABEiABEiABEiABEiABEiABEiABEiABEiABEiABEiABEiABEiABEiABEiABEiABEiABEiABEiABEiABEiABEiABEiABEiABEiABEiABEiABEiABEiABEiABEiABEiABEiABEiABEiABEiABEiABEiABEiABEiABEiABEiABEiABEiABEiABEiABEiABEiABEiABEiABEiABEiABEiABEiABEiABEiABEiABEiABEiABEiABEiABEiABEiABEiABEiABEiABEiABEiABEiABEiABEiABEiABEiABEiABEiABEiABEiABEvANgSq+KUkwC6L89hdbH8zis9QkQAIkQAIkYCyBPUT5j2IREwnsZqJoGzVr5e8HG/NjViRAAiRAAiRAAu4ROFAutcK9y/nnSqwAWvNFWcvf8uXLUbduXWs5+fDstm3borCw0Iclc75IJmtXutTP2Hf+LvPnFRj7ZsT+b7/9hoMOOkiD0Ng3eKwA2vAM0spfGCuARx55ZCh1ZeJyk7UrH+pn7Gdyn4TxGMa+ubEfxnhOp6lqup3cZzaBvfbay1gAJmtXp1M/Y9/Um5+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mi6D/YysLhNDDp9hu25XAFPdneTLjFgUUECBcRFYMC4H4nEooIACNQncRT23tDLJcDP5npxM/iY/kl5lGQs+IwfI0ZWVynSG15P3KssONZr6VpBFJFcELQoooMDIBTwBHHkXeAAKKFCzwMvUl6S8QnJbNieFb5A/yExlOwtPnWmFIZaVfZ7Gtp4ADgHoJgooUL/AMfVXaY0KKKDASAU6r/BlOlf2dpElIziyss/s36KAAgqMhYAngGPRDR6EAgrUKDDRUVemfyafkBPIBOlVcqKYfwuT9w92psxf1WvjHvMvYf43xKt/PYCcrYACcy/gLeC5N3ePCigwuwLXUf21JP/v72qyllxFdpJ3SN4XmE8Ddyu5BZxP9PZbjmPF/DeFJC+oF5K8T/AfUso1jHR+Orgsc6iAAgoooIACCihwmAJb2H4TKZ8C/o7xOyp1rmE8VwKrJZ8MXl2dMcB49pdPEaeOJOM/kFLyfwBz6/fsMsOhAgoooIACCiigQL0COSF78BBVvsrydYdYp67Fj1LRA3VVZj0KKKBAXQLeAq5L0noUUKApArklO1flnrnakftRQAEFBhHwQyCDaLmuAgqMu0Def2dRQAEFFFBAAQUUUEABBRRQQAEFFFBAAQUUUEABBRRQQAEFFFBAAQUUUEABBRRQQAEFFFBAAQUUUEABBRRQQAEFFFBAAQUUUEABBRRQQAEFFFBAAQUUUEABBRRQQAEFFFBAAQUUUEABBRRQQAEFFFBAAQUUUEABBRRQQAEFFFBAAQUUUEABBRRQQAEFFFBAAQUUUEABBRRQQAEFDkvgP99bXbLoAMdqAAAAAElFTkSuQmCC\">"
],
"text/plain": [
"<IPython.core.display.HTML object>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"\n",
"import numpy as np\n",
"import matplotlib.pyplot as plt\n",
"\n",
"\n",
"def entropy(p):\n",
" return - p*np.log2(p) - (1 - p)*np.log2((1 - p))\n",
"x = np.arange(0.0, 1.0, 0.01)\n",
"ent = [entropy(p) if p != 0 else None for p in x]\n",
"plt.plot(x, ent)\n",
"plt.ylim([0,1.1])\n",
"plt.xlabel('p(i=1)')\n",
"e0 = entropy(40/120)\n",
"e1 = entropy(28/70)\n",
"e2 = entropy(12/50)\n",
"plt.plot([28/70, 12/50], [e1, e2], marker='s', linestyle='--', markersize=10)\n",
"plt.plot([(40/120)], [e0 ], marker='^', markersize=7)\n",
"plt.plot([(70/120 * 28/70 + 50/120 * 12/50)], [(70/120 * e1 + 50/120 * e2) ], marker='o', markersize=7) \n",
"plt.axhline(y=1.0, linewidth=1, color='k', linestyle='--')\n",
"plt.ylabel('Entropy')\n",
"plt.grid()\n",
"plt.show()"
]
},
{
"cell_type": "code",
"execution_count": 4,
"metadata": {
"collapsed": false
},
"outputs": [
{
"data": {
"application/javascript": [
"/* Put everything inside the global mpl namespace */\n",
"window.mpl = {};\n",
"\n",
"mpl.get_websocket_type = function() {\n",
" if (typeof(WebSocket) !== 'undefined') {\n",
" return WebSocket;\n",
" } else if (typeof(MozWebSocket) !== 'undefined') {\n",
" return MozWebSocket;\n",
" } else {\n",
" alert('Your browser does not have WebSocket support.' +\n",
" 'Please try Chrome, Safari or Firefox ≥ 6. ' +\n",
" 'Firefox 4 and 5 are also supported but you ' +\n",
" 'have to enable WebSockets in about:config.');\n",
" };\n",
"}\n",
"\n",
"mpl.figure = function(figure_id, websocket, ondownload, parent_element) {\n",
" this.id = figure_id;\n",
"\n",
" this.ws = websocket;\n",
"\n",
" this.supports_binary = (this.ws.binaryType != undefined);\n",
"\n",
" if (!this.supports_binary) {\n",
" var warnings = document.getElementById(\"mpl-warnings\");\n",
" if (warnings) {\n",
" warnings.style.display = 'block';\n",
" warnings.textContent = (\n",
" \"This browser does not support binary websocket messages. \" +\n",
" \"Performance may be slow.\");\n",
" }\n",
" }\n",
"\n",
" this.imageObj = new Image();\n",
"\n",
" this.context = undefined;\n",
" this.message = undefined;\n",
" this.canvas = undefined;\n",
" this.rubberband_canvas = undefined;\n",
" this.rubberband_context = undefined;\n",
" this.format_dropdown = undefined;\n",
"\n",
" this.image_mode = 'full';\n",
"\n",
" this.root = $('<div/>');\n",
" this._root_extra_style(this.root)\n",
" this.root.attr('style', 'display: inline-block');\n",
"\n",
" $(parent_element).append(this.root);\n",
"\n",
" this._init_header(this);\n",
" this._init_canvas(this);\n",
" this._init_toolbar(this);\n",
"\n",
" var fig = this;\n",
"\n",
" this.waiting = false;\n",
"\n",
" this.ws.onopen = function () {\n",
" fig.send_message(\"supports_binary\", {value: fig.supports_binary});\n",
" fig.send_message(\"send_image_mode\", {});\n",
" fig.send_message(\"refresh\", {});\n",
" }\n",
"\n",
" this.imageObj.onload = function() {\n",
" if (fig.image_mode == 'full') {\n",
" // Full images could contain transparency (where diff images\n",
" // almost always do), so we need to clear the canvas so that\n",
" // there is no ghosting.\n",
" fig.context.clearRect(0, 0, fig.canvas.width, fig.canvas.height);\n",
" }\n",
" fig.context.drawImage(fig.imageObj, 0, 0);\n",
" };\n",
"\n",
" this.imageObj.onunload = function() {\n",
" this.ws.close();\n",
" }\n",
"\n",
" this.ws.onmessage = this._make_on_message_function(this);\n",
"\n",
" this.ondownload = ondownload;\n",
"}\n",
"\n",
"mpl.figure.prototype._init_header = function() {\n",
" var titlebar = $(\n",
" '<div class=\"ui-dialog-titlebar ui-widget-header ui-corner-all ' +\n",
" 'ui-helper-clearfix\"/>');\n",
" var titletext = $(\n",
" '<div class=\"ui-dialog-title\" style=\"width: 100%; ' +\n",
" 'text-align: center; padding: 3px;\"/>');\n",
" titlebar.append(titletext)\n",
" this.root.append(titlebar);\n",
" this.header = titletext[0];\n",
"}\n",
"\n",
"\n",
"\n",
"mpl.figure.prototype._canvas_extra_style = function(canvas_div) {\n",
"\n",
"}\n",
"\n",
"\n",
"mpl.figure.prototype._root_extra_style = function(canvas_div) {\n",
"\n",
"}\n",
"\n",
"mpl.figure.prototype._init_canvas = function() {\n",
" var fig = this;\n",
"\n",
" var canvas_div = $('<div/>');\n",
"\n",
" canvas_div.attr('style', 'position: relative; clear: both; outline: 0');\n",
"\n",
" function canvas_keyboard_event(event) {\n",
" return fig.key_event(event, event['data']);\n",
" }\n",
"\n",
" canvas_div.keydown('key_press', canvas_keyboard_event);\n",
" canvas_div.keyup('key_release', canvas_keyboard_event);\n",
" this.canvas_div = canvas_div\n",
" this._canvas_extra_style(canvas_div)\n",
" this.root.append(canvas_div);\n",
"\n",
" var canvas = $('<canvas/>');\n",
" canvas.addClass('mpl-canvas');\n",
" canvas.attr('style', \"left: 0; top: 0; z-index: 0; outline: 0\")\n",
"\n",
" this.canvas = canvas[0];\n",
" this.context = canvas[0].getContext(\"2d\");\n",
"\n",
" var rubberband = $('<canvas/>');\n",
" rubberband.attr('style', \"position: absolute; left: 0; top: 0; z-index: 1;\")\n",
"\n",
" var pass_mouse_events = true;\n",
"\n",
" canvas_div.resizable({\n",
" start: function(event, ui) {\n",
" pass_mouse_events = false;\n",
" },\n",
" resize: function(event, ui) {\n",
" fig.request_resize(ui.size.width, ui.size.height);\n",
" },\n",
" stop: function(event, ui) {\n",
" pass_mouse_events = true;\n",
" fig.request_resize(ui.size.width, ui.size.height);\n",
" },\n",
" });\n",
"\n",
" function mouse_event_fn(event) {\n",
" if (pass_mouse_events)\n",
" return fig.mouse_event(event, event['data']);\n",
" }\n",
"\n",
" rubberband.mousedown('button_press', mouse_event_fn);\n",
" rubberband.mouseup('button_release', mouse_event_fn);\n",
" // Throttle sequential mouse events to 1 every 20ms.\n",
" rubberband.mousemove('motion_notify', mouse_event_fn);\n",
"\n",
" rubberband.mouseenter('figure_enter', mouse_event_fn);\n",
" rubberband.mouseleave('figure_leave', mouse_event_fn);\n",
"\n",
" canvas_div.on(\"wheel\", function (event) {\n",
" event = event.originalEvent;\n",
" event['data'] = 'scroll'\n",
" if (event.deltaY < 0) {\n",
" event.step = 1;\n",
" } else {\n",
" event.step = -1;\n",
" }\n",
" mouse_event_fn(event);\n",
" });\n",
"\n",
" canvas_div.append(canvas);\n",
" canvas_div.append(rubberband);\n",
"\n",
" this.rubberband = rubberband;\n",
" this.rubberband_canvas = rubberband[0];\n",
" this.rubberband_context = rubberband[0].getContext(\"2d\");\n",
" this.rubberband_context.strokeStyle = \"#000000\";\n",
"\n",
" this._resize_canvas = function(width, height) {\n",
" // Keep the size of the canvas, canvas container, and rubber band\n",
" // canvas in synch.\n",
" canvas_div.css('width', width)\n",
" canvas_div.css('height', height)\n",
"\n",
" canvas.attr('width', width);\n",
" canvas.attr('height', height);\n",
"\n",
" rubberband.attr('width', width);\n",
" rubberband.attr('height', height);\n",
" }\n",
"\n",
" // Set the figure to an initial 600x600px, this will subsequently be updated\n",
" // upon first draw.\n",
" this._resize_canvas(600, 600);\n",
"\n",
" // Disable right mouse context menu.\n",
" $(this.rubberband_canvas).bind(\"contextmenu\",function(e){\n",
" return false;\n",
" });\n",
"\n",
" function set_focus () {\n",
" canvas.focus();\n",
" canvas_div.focus();\n",
" }\n",
"\n",
" window.setTimeout(set_focus, 100);\n",
"}\n",
"\n",
"mpl.figure.prototype._init_toolbar = function() {\n",
" var fig = this;\n",
"\n",
" var nav_element = $('<div/>')\n",
" nav_element.attr('style', 'width: 100%');\n",
" this.root.append(nav_element);\n",
"\n",
" // Define a callback function for later on.\n",
" function toolbar_event(event) {\n",
" return fig.toolbar_button_onclick(event['data']);\n",
" }\n",
" function toolbar_mouse_event(event) {\n",
" return fig.toolbar_button_onmouseover(event['data']);\n",
" }\n",
"\n",
" for(var toolbar_ind in mpl.toolbar_items) {\n",
" var name = mpl.toolbar_items[toolbar_ind][0];\n",
" var tooltip = mpl.toolbar_items[toolbar_ind][1];\n",
" var image = mpl.toolbar_items[toolbar_ind][2];\n",
" var method_name = mpl.toolbar_items[toolbar_ind][3];\n",
"\n",
" if (!name) {\n",
" // put a spacer in here.\n",
" continue;\n",
" }\n",
" var button = $('<button/>');\n",
" button.addClass('ui-button ui-widget ui-state-default ui-corner-all ' +\n",
" 'ui-button-icon-only');\n",
" button.attr('role', 'button');\n",
" button.attr('aria-disabled', 'false');\n",
" button.click(method_name, toolbar_event);\n",
" button.mouseover(tooltip, toolbar_mouse_event);\n",
"\n",
" var icon_img = $('<span/>');\n",
" icon_img.addClass('ui-button-icon-primary ui-icon');\n",
" icon_img.addClass(image);\n",
" icon_img.addClass('ui-corner-all');\n",
"\n",
" var tooltip_span = $('<span/>');\n",
" tooltip_span.addClass('ui-button-text');\n",
" tooltip_span.html(tooltip);\n",
"\n",
" button.append(icon_img);\n",
" button.append(tooltip_span);\n",
"\n",
" nav_element.append(button);\n",
" }\n",
"\n",
" var fmt_picker_span = $('<span/>');\n",
"\n",
" var fmt_picker = $('<select/>');\n",
" fmt_picker.addClass('mpl-toolbar-option ui-widget ui-widget-content');\n",
" fmt_picker_span.append(fmt_picker);\n",
" nav_element.append(fmt_picker_span);\n",
" this.format_dropdown = fmt_picker[0];\n",
"\n",
" for (var ind in mpl.extensions) {\n",
" var fmt = mpl.extensions[ind];\n",
" var option = $(\n",
" '<option/>', {selected: fmt === mpl.default_extension}).html(fmt);\n",
" fmt_picker.append(option)\n",
" }\n",
"\n",
" // Add hover states to the ui-buttons\n",
" $( \".ui-button\" ).hover(\n",
" function() { $(this).addClass(\"ui-state-hover\");},\n",
" function() { $(this).removeClass(\"ui-state-hover\");}\n",
" );\n",
"\n",
" var status_bar = $('<span class=\"mpl-message\"/>');\n",
" nav_element.append(status_bar);\n",
" this.message = status_bar[0];\n",
"}\n",
"\n",
"mpl.figure.prototype.request_resize = function(x_pixels, y_pixels) {\n",
" // Request matplotlib to resize the figure. Matplotlib will then trigger a resize in the client,\n",
" // which will in turn request a refresh of the image.\n",
" this.send_message('resize', {'width': x_pixels, 'height': y_pixels});\n",
"}\n",
"\n",
"mpl.figure.prototype.send_message = function(type, properties) {\n",
" properties['type'] = type;\n",
" properties['figure_id'] = this.id;\n",
" this.ws.send(JSON.stringify(properties));\n",
"}\n",
"\n",
"mpl.figure.prototype.send_draw_message = function() {\n",
" if (!this.waiting) {\n",
" this.waiting = true;\n",
" this.ws.send(JSON.stringify({type: \"draw\", figure_id: this.id}));\n",
" }\n",
"}\n",
"\n",
"\n",
"mpl.figure.prototype.handle_save = function(fig, msg) {\n",
" var format_dropdown = fig.format_dropdown;\n",
" var format = format_dropdown.options[format_dropdown.selectedIndex].value;\n",
" fig.ondownload(fig, format);\n",
"}\n",
"\n",
"\n",
"mpl.figure.prototype.handle_resize = function(fig, msg) {\n",
" var size = msg['size'];\n",
" if (size[0] != fig.canvas.width || size[1] != fig.canvas.height) {\n",
" fig._resize_canvas(size[0], size[1]);\n",
" fig.send_message(\"refresh\", {});\n",
" };\n",
"}\n",
"\n",
"mpl.figure.prototype.handle_rubberband = function(fig, msg) {\n",
" var x0 = msg['x0'];\n",
" var y0 = fig.canvas.height - msg['y0'];\n",
" var x1 = msg['x1'];\n",
" var y1 = fig.canvas.height - msg['y1'];\n",
" x0 = Math.floor(x0) + 0.5;\n",
" y0 = Math.floor(y0) + 0.5;\n",
" x1 = Math.floor(x1) + 0.5;\n",
" y1 = Math.floor(y1) + 0.5;\n",
" var min_x = Math.min(x0, x1);\n",
" var min_y = Math.min(y0, y1);\n",
" var width = Math.abs(x1 - x0);\n",
" var height = Math.abs(y1 - y0);\n",
"\n",
" fig.rubberband_context.clearRect(\n",
" 0, 0, fig.canvas.width, fig.canvas.height);\n",
"\n",
" fig.rubberband_context.strokeRect(min_x, min_y, width, height);\n",
"}\n",
"\n",
"mpl.figure.prototype.handle_figure_label = function(fig, msg) {\n",
" // Updates the figure title.\n",
" fig.header.textContent = msg['label'];\n",
"}\n",
"\n",
"mpl.figure.prototype.handle_cursor = function(fig, msg) {\n",
" var cursor = msg['cursor'];\n",
" switch(cursor)\n",
" {\n",
" case 0:\n",
" cursor = 'pointer';\n",
" break;\n",
" case 1:\n",
" cursor = 'default';\n",
" break;\n",
" case 2:\n",
" cursor = 'crosshair';\n",
" break;\n",
" case 3:\n",
" cursor = 'move';\n",
" break;\n",
" }\n",
" fig.rubberband_canvas.style.cursor = cursor;\n",
"}\n",
"\n",
"mpl.figure.prototype.handle_message = function(fig, msg) {\n",
" fig.message.textContent = msg['message'];\n",
"}\n",
"\n",
"mpl.figure.prototype.handle_draw = function(fig, msg) {\n",
" // Request the server to send over a new figure.\n",
" fig.send_draw_message();\n",
"}\n",
"\n",
"mpl.figure.prototype.handle_image_mode = function(fig, msg) {\n",
" fig.image_mode = msg['mode'];\n",
"}\n",
"\n",
"mpl.figure.prototype.updated_canvas_event = function() {\n",
" // Called whenever the canvas gets updated.\n",
" this.send_message(\"ack\", {});\n",
"}\n",
"\n",
"// A function to construct a web socket function for onmessage handling.\n",
"// Called in the figure constructor.\n",
"mpl.figure.prototype._make_on_message_function = function(fig) {\n",
" return function socket_on_message(evt) {\n",
" if (evt.data instanceof Blob) {\n",
" /* FIXME: We get \"Resource interpreted as Image but\n",
" * transferred with MIME type text/plain:\" errors on\n",
" * Chrome. But how to set the MIME type? It doesn't seem\n",
" * to be part of the websocket stream */\n",
" evt.data.type = \"image/png\";\n",
"\n",
" /* Free the memory for the previous frames */\n",
" if (fig.imageObj.src) {\n",
" (window.URL || window.webkitURL).revokeObjectURL(\n",
" fig.imageObj.src);\n",
" }\n",
"\n",
" fig.imageObj.src = (window.URL || window.webkitURL).createObjectURL(\n",
" evt.data);\n",
" fig.updated_canvas_event();\n",
" fig.waiting = false;\n",
" return;\n",
" }\n",
" else if (typeof evt.data === 'string' && evt.data.slice(0, 21) == \"data:image/png;base64\") {\n",
" fig.imageObj.src = evt.data;\n",
" fig.updated_canvas_event();\n",
" fig.waiting = false;\n",
" return;\n",
" }\n",
"\n",
" var msg = JSON.parse(evt.data);\n",
" var msg_type = msg['type'];\n",
"\n",
" // Call the \"handle_{type}\" callback, which takes\n",
" // the figure and JSON message as its only arguments.\n",
" try {\n",
" var callback = fig[\"handle_\" + msg_type];\n",
" } catch (e) {\n",
" console.log(\"No handler for the '\" + msg_type + \"' message type: \", msg);\n",
" return;\n",
" }\n",
"\n",
" if (callback) {\n",
" try {\n",
" // console.log(\"Handling '\" + msg_type + \"' message: \", msg);\n",
" callback(fig, msg);\n",
" } catch (e) {\n",
" console.log(\"Exception inside the 'handler_\" + msg_type + \"' callback:\", e, e.stack, msg);\n",
" }\n",
" }\n",
" };\n",
"}\n",
"\n",
"// from http://stackoverflow.com/questions/1114465/getting-mouse-location-in-canvas\n",
"mpl.findpos = function(e) {\n",
" //this section is from http://www.quirksmode.org/js/events_properties.html\n",
" var targ;\n",
" if (!e)\n",
" e = window.event;\n",
" if (e.target)\n",
" targ = e.target;\n",
" else if (e.srcElement)\n",
" targ = e.srcElement;\n",
" if (targ.nodeType == 3) // defeat Safari bug\n",
" targ = targ.parentNode;\n",
"\n",
" // jQuery normalizes the pageX and pageY\n",
" // pageX,Y are the mouse positions relative to the document\n",
" // offset() returns the position of the element relative to the document\n",
" var x = e.pageX - $(targ).offset().left;\n",
" var y = e.pageY - $(targ).offset().top;\n",
"\n",
" return {\"x\": x, \"y\": y};\n",
"};\n",
"\n",
"/*\n",
" * return a copy of an object with only non-object keys\n",
" * we need this to avoid circular references\n",
" * http://stackoverflow.com/a/24161582/3208463\n",
" */\n",
"function simpleKeys (original) {\n",
" return Object.keys(original).reduce(function (obj, key) {\n",
" if (typeof original[key] !== 'object')\n",
" obj[key] = original[key]\n",
" return obj;\n",
" }, {});\n",
"}\n",
"\n",
"mpl.figure.prototype.mouse_event = function(event, name) {\n",
" var canvas_pos = mpl.findpos(event)\n",
"\n",
" if (name === 'button_press')\n",
" {\n",
" this.canvas.focus();\n",
" this.canvas_div.focus();\n",
" }\n",
"\n",
" var x = canvas_pos.x;\n",
" var y = canvas_pos.y;\n",
"\n",
" this.send_message(name, {x: x, y: y, button: event.button,\n",
" step: event.step,\n",
" guiEvent: simpleKeys(event)});\n",
"\n",
" /* This prevents the web browser from automatically changing to\n",
" * the text insertion cursor when the button is pressed. We want\n",
" * to control all of the cursor setting manually through the\n",
" * 'cursor' event from matplotlib */\n",
" event.preventDefault();\n",
" return false;\n",
"}\n",
"\n",
"mpl.figure.prototype._key_event_extra = function(event, name) {\n",
" // Handle any extra behaviour associated with a key event\n",
"}\n",
"\n",
"mpl.figure.prototype.key_event = function(event, name) {\n",
"\n",
" // Prevent repeat events\n",
" if (name == 'key_press')\n",
" {\n",
" if (event.which === this._key)\n",
" return;\n",
" else\n",
" this._key = event.which;\n",
" }\n",
" if (name == 'key_release')\n",
" this._key = null;\n",
"\n",
" var value = '';\n",
" if (event.ctrlKey && event.which != 17)\n",
" value += \"ctrl+\";\n",
" if (event.altKey && event.which != 18)\n",
" value += \"alt+\";\n",
" if (event.shiftKey && event.which != 16)\n",
" value += \"shift+\";\n",
"\n",
" value += 'k';\n",
" value += event.which.toString();\n",
"\n",
" this._key_event_extra(event, name);\n",
"\n",
" this.send_message(name, {key: value,\n",
" guiEvent: simpleKeys(event)});\n",
" return false;\n",
"}\n",
"\n",
"mpl.figure.prototype.toolbar_button_onclick = function(name) {\n",
" if (name == 'download') {\n",
" this.handle_save(this, null);\n",
" } else {\n",
" this.send_message(\"toolbar_button\", {name: name});\n",
" }\n",
"};\n",
"\n",
"mpl.figure.prototype.toolbar_button_onmouseover = function(tooltip) {\n",
" this.message.textContent = tooltip;\n",
"};\n",
"mpl.toolbar_items = [[\"Home\", \"Reset original view\", \"fa fa-home icon-home\", \"home\"], [\"Back\", \"Back to previous view\", \"fa fa-arrow-left icon-arrow-left\", \"back\"], [\"Forward\", \"Forward to next view\", \"fa fa-arrow-right icon-arrow-right\", \"forward\"], [\"\", \"\", \"\", \"\"], [\"Pan\", \"Pan axes with left mouse, zoom with right\", \"fa fa-arrows icon-move\", \"pan\"], [\"Zoom\", \"Zoom to rectangle\", \"fa fa-square-o icon-check-empty\", \"zoom\"], [\"\", \"\", \"\", \"\"], [\"Download\", \"Download plot\", \"fa fa-floppy-o icon-save\", \"download\"]];\n",
"\n",
"mpl.extensions = [\"eps\", \"pdf\", \"png\", \"ps\", \"raw\", \"svg\"];\n",
"\n",
"mpl.default_extension = \"png\";var comm_websocket_adapter = function(comm) {\n",
" // Create a \"websocket\"-like object which calls the given IPython comm\n",
" // object with the appropriate methods. Currently this is a non binary\n",
" // socket, so there is still some room for performance tuning.\n",
" var ws = {};\n",
"\n",
" ws.close = function() {\n",
" comm.close()\n",
" };\n",
" ws.send = function(m) {\n",
" //console.log('sending', m);\n",
" comm.send(m);\n",
" };\n",
" // Register the callback with on_msg.\n",
" comm.on_msg(function(msg) {\n",
" //console.log('receiving', msg['content']['data'], msg);\n",
" // Pass the mpl event to the overriden (by mpl) onmessage function.\n",
" ws.onmessage(msg['content']['data'])\n",
" });\n",
" return ws;\n",
"}\n",
"\n",
"mpl.mpl_figure_comm = function(comm, msg) {\n",
" // This is the function which gets called when the mpl process\n",
" // starts-up an IPython Comm through the \"matplotlib\" channel.\n",
"\n",
" var id = msg.content.data.id;\n",
" // Get hold of the div created by the display call when the Comm\n",
" // socket was opened in Python.\n",
" var element = $(\"#\" + id);\n",
" var ws_proxy = comm_websocket_adapter(comm)\n",
"\n",
" function ondownload(figure, format) {\n",
" window.open(figure.imageObj.src);\n",
" }\n",
"\n",
" var fig = new mpl.figure(id, ws_proxy,\n",
" ondownload,\n",
" element.get(0));\n",
"\n",
" // Call onopen now - mpl needs it, as it is assuming we've passed it a real\n",
" // web socket which is closed, not our websocket->open comm proxy.\n",
" ws_proxy.onopen();\n",
"\n",
" fig.parent_element = element.get(0);\n",
" fig.cell_info = mpl.find_output_cell(\"<div id='\" + id + \"'></div>\");\n",
" if (!fig.cell_info) {\n",
" console.error(\"Failed to find cell for figure\", id, fig);\n",
" return;\n",
" }\n",
"\n",
" var output_index = fig.cell_info[2]\n",
" var cell = fig.cell_info[0];\n",
"\n",
"};\n",
"\n",
"mpl.figure.prototype.handle_close = function(fig, msg) {\n",
" fig.root.unbind('remove')\n",
"\n",
" // Update the output cell to use the data from the current canvas.\n",
" fig.push_to_output();\n",
" var dataURL = fig.canvas.toDataURL();\n",
" // Re-enable the keyboard manager in IPython - without this line, in FF,\n",
" // the notebook keyboard shortcuts fail.\n",
" IPython.keyboard_manager.enable()\n",
" $(fig.parent_element).html('<img src=\"' + dataURL + '\">');\n",
" fig.close_ws(fig, msg);\n",
"}\n",
"\n",
"mpl.figure.prototype.close_ws = function(fig, msg){\n",
" fig.send_message('closing', msg);\n",
" // fig.ws.close()\n",
"}\n",
"\n",
"mpl.figure.prototype.push_to_output = function(remove_interactive) {\n",
" // Turn the data on the canvas into data in the output cell.\n",
" var dataURL = this.canvas.toDataURL();\n",
" this.cell_info[1]['text/html'] = '<img src=\"' + dataURL + '\">';\n",
"}\n",
"\n",
"mpl.figure.prototype.updated_canvas_event = function() {\n",
" // Tell IPython that the notebook contents must change.\n",
" IPython.notebook.set_dirty(true);\n",
" this.send_message(\"ack\", {});\n",
" var fig = this;\n",
" // Wait a second, then push the new image to the DOM so\n",
" // that it is saved nicely (might be nice to debounce this).\n",
" setTimeout(function () { fig.push_to_output() }, 1000);\n",
"}\n",
"\n",
"mpl.figure.prototype._init_toolbar = function() {\n",
" var fig = this;\n",
"\n",
" var nav_element = $('<div/>')\n",
" nav_element.attr('style', 'width: 100%');\n",
" this.root.append(nav_element);\n",
"\n",
" // Define a callback function for later on.\n",
" function toolbar_event(event) {\n",
" return fig.toolbar_button_onclick(event['data']);\n",
" }\n",
" function toolbar_mouse_event(event) {\n",
" return fig.toolbar_button_onmouseover(event['data']);\n",
" }\n",
"\n",
" for(var toolbar_ind in mpl.toolbar_items){\n",
" var name = mpl.toolbar_items[toolbar_ind][0];\n",
" var tooltip = mpl.toolbar_items[toolbar_ind][1];\n",
" var image = mpl.toolbar_items[toolbar_ind][2];\n",
" var method_name = mpl.toolbar_items[toolbar_ind][3];\n",
"\n",
" if (!name) { continue; };\n",
"\n",
" var button = $('<button class=\"btn btn-default\" href=\"#\" title=\"' + name + '\"><i class=\"fa ' + image + ' fa-lg\"></i></button>');\n",
" button.click(method_name, toolbar_event);\n",
" button.mouseover(tooltip, toolbar_mouse_event);\n",
" nav_element.append(button);\n",
" }\n",
"\n",
" // Add the status bar.\n",
" var status_bar = $('<span class=\"mpl-message\" style=\"text-align:right; float: right;\"/>');\n",
" nav_element.append(status_bar);\n",
" this.message = status_bar[0];\n",
"\n",
" // Add the close button to the window.\n",
" var buttongrp = $('<div class=\"btn-group inline pull-right\"></div>');\n",
" var button = $('<button class=\"btn btn-mini btn-primary\" href=\"#\" title=\"Stop Interaction\"><i class=\"fa fa-power-off icon-remove icon-large\"></i></button>');\n",
" button.click(function (evt) { fig.handle_close(fig, {}); } );\n",
" button.mouseover('Stop Interaction', toolbar_mouse_event);\n",
" buttongrp.append(button);\n",
" var titlebar = this.root.find($('.ui-dialog-titlebar'));\n",
" titlebar.prepend(buttongrp);\n",
"}\n",
"\n",
"mpl.figure.prototype._root_extra_style = function(el){\n",
" var fig = this\n",
" el.on(\"remove\", function(){\n",
"\tfig.close_ws(fig, {});\n",
" });\n",
"}\n",
"\n",
"mpl.figure.prototype._canvas_extra_style = function(el){\n",
" // this is important to make the div 'focusable\n",
" el.attr('tabindex', 0)\n",
" // reach out to IPython and tell the keyboard manager to turn it's self\n",
" // off when our div gets focus\n",
"\n",
" // location in version 3\n",
" if (IPython.notebook.keyboard_manager) {\n",
" IPython.notebook.keyboard_manager.register_events(el);\n",
" }\n",
" else {\n",
" // location in version 2\n",
" IPython.keyboard_manager.register_events(el);\n",
" }\n",
"\n",
"}\n",
"\n",
"mpl.figure.prototype._key_event_extra = function(event, name) {\n",
" var manager = IPython.notebook.keyboard_manager;\n",
" if (!manager)\n",
" manager = IPython.keyboard_manager;\n",
"\n",
" // Check for shift+enter\n",
" if (event.shiftKey && event.which == 13) {\n",
" this.canvas_div.blur();\n",
" event.shiftKey = false;\n",
" // Send a \"J\" for go to next cell\n",
" event.which = 74;\n",
" event.keyCode = 74;\n",
" manager.command_mode();\n",
" manager.handle_keydown(event);\n",
" }\n",
"}\n",
"\n",
"mpl.figure.prototype.handle_save = function(fig, msg) {\n",
" fig.ondownload(fig, null);\n",
"}\n",
"\n",
"\n",
"mpl.find_output_cell = function(html_output) {\n",
" // Return the cell and output element which can be found *uniquely* in the notebook.\n",
" // Note - this is a bit hacky, but it is done because the \"notebook_saving.Notebook\"\n",
" // IPython event is triggered only after the cells have been serialised, which for\n",
" // our purposes (turning an active figure into a static one), is too late.\n",
" var cells = IPython.notebook.get_cells();\n",
" var ncells = cells.length;\n",
" for (var i=0; i<ncells; i++) {\n",
" var cell = cells[i];\n",
" if (cell.cell_type === 'code'){\n",
" for (var j=0; j<cell.output_area.outputs.length; j++) {\n",
" var data = cell.output_area.outputs[j];\n",
" if (data.data) {\n",
" // IPython >= 3 moved mimebundle to data attribute of output\n",
" data = data.data;\n",
" }\n",
" if (data['text/html'] == html_output) {\n",
" return [cell, data, j];\n",
" }\n",
" }\n",
" }\n",
" }\n",
"}\n",
"\n",
"// Register the function which deals with the matplotlib target/channel.\n",
"// The kernel may be null if the page has been refreshed.\n",
"if (IPython.notebook.kernel != null) {\n",
" IPython.notebook.kernel.comm_manager.register_target('matplotlib', mpl.mpl_figure_comm);\n",
"}\n"
],
"text/plain": [
"<IPython.core.display.Javascript object>"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"text/html": [
"<img src=\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAoAAAAHgCAYAAAA10dzkAAAAAXNSR0IArs4c6QAAQABJREFUeAHt3Qe8FNXZx/G/QUEBwYKFKGrUvJoYUSxExU7HHjUxSNNYYondqNiwYS/YC0rHHjUaFDUGTey9RGM3YokdUVBQ4H0e5l5YLruX3Ttbzsz8zufz3N2dnTlzzvfszp475YxEQgABBBBAAAEEEEAAAQQQQAABBBBAAAEEEEAAAQQQQAABBBBAAAEEEEAAAQQQQAABBBBAAAEEEEAAAQQQQAABBBBAAAEEEEAAAQQQQAABBBBAAAEEEEAAAQQQQAABBBBAAAEEEEAAAQQQQAABBBBAAAEEEEAAAQQQQAABBBBAAAEEEEAAAQQQQAABBBBAAAEEEEAAAQQQQAABBBBAAAEEEEAAAQQQQAABBBBAAAEEEEAAAQQQQAABBBBAAAEEEEAAAQQQQAABBBBAAAEEEEAAAQ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Kx3Ch+y+NqisTTZ3ly2sRma8F79OpezZekANgGQRRBAoPwCPyl/luSIAAII1FSg4R4+f+179r60aFuDktWv09dPQgABBIIQoAMYRDNQCAQQKKPAGg3y8tcfWDxnsaTFGhaFkncUfVgYP3+wYdRP71Jo4QLT17fpr1uw968AEJMRQKD6AhwCrr45a0QAgcoK9LHse1v4eH89LHa16GrxmcW/LPy8QL8aOF/yQ8B+RW+xaQmb0UdT8PB/qFtY+HmCMy3qUy970vDq4Pr3eEQAAQQQQAABBBCIKfAPW/5Si/qrgN+05wNy8tzFnvuewNzkVwZvnzuhhOe+Pr+K2PPw8OfvWNQnHwfQD/3+tH4CjwgggAACCCCAAALlFfAO2emLyPI+e3/3RcxTrreHWUanlCsz8kEAAQTKJcAh4HJJkg8CCCRFwA/JVisdXq0VsR4EEECgFAEuAilFi3kRQCB0AT//joQAAggggAACCCCAAAIIIIAAAggggAACCCCAAAIIIIAAAggggAACCCCAAAIIIIAAAggggAACCCCAAAIIIIAAAggggAACCCCAAAIIIIAAAggggAACCCCAAAIIIIAAAggggAACCCCAAAIIIIAAAggggAACCCCAAAIIIIAAAggggAACCCCAAAIIIIAAAggggAACCCCAAAIIIIAAAgjEEvh/yOEUxkjnq94AAAAASUVORK5CYII=\">"
],
"text/plain": [
"<IPython.core.display.HTML object>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"def error(p):\n",
" return 1 - np.max([p, 1-p])\n",
"\n",
"x = np.arange(0.0, 1.0, 0.01)\n",
"err = [error(i) for i in x]\n",
"plt.plot(x, err)\n",
"plt.ylim([0,0.55])\n",
"plt.xlabel('p(i=1)')\n",
"plt.axhline(y=0.5, linewidth=1, color='k', linestyle='--')\n",
"plt.ylabel('Classification Error')\n",
"plt.show()"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"$$IG(D_{p}, x_i) = I(D_{p}) - \\frac{N_{left}}{N_p} I(D_{left}) - \\frac{N_{right}}{N_p} I(D_{right})$$"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"- $IG$: Information Gain\n",
"- $x_i$: feature to perform the split\n",
"- $N_p$: number of samples in the parent node\n",
"- $N_{left}$: number of samples in the left child node\n",
"- $N_{right}$: number of samples in the right child node\n",
"- $I$: impurity\n",
"- $D_p$: training subset of the parent node\n",
"- $D_{left}$: training subset of the left child node\n",
"- $D_right$: training subset of the right child node"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"$$I_H(t) = - \\sum_{i =1}^{C} p(i \\mid t) \\;log_2 \\,p(i \\mid t)$$\n",
"\n",
"for all non-empty classed $p(i \\mid t) \\neq 0$, where $p(i \\mid t)$ is the proportion (or frequency or probability) of the samples that belong to class *i* for a particular node *t*; *C* is the number of unique class labels."
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"$$I_E(t) = 1 - max\\{{p_i}\\}$$"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.5.0"
}
},
"nbformat": 4,
"nbformat_minor": 0
}
| Jupyter Notebook | 5 | Gopalbansal8106/python-machine-learning-book | faq/decisiontree-error-vs-entropy/decisiontree-error-vs-entropy.ipynb | [
"MIT"
] |
' Licensed to the .NET Foundation under one or more agreements.
' The .NET Foundation licenses this file to you under the MIT license.
' See the LICENSE file in the project root for more information.
Imports Microsoft.CodeAnalysis.VisualBasic.Completion.Providers
Namespace Microsoft.CodeAnalysis.Editor.VisualBasic.UnitTests.Completion.CompletionProviders
Public Class ObjectCreationCompletionProviderTests
Inherits AbstractVisualBasicCompletionProviderTests
Friend Overrides Function GetCompletionProviderType() As Type
Return GetType(ObjectCreationCompletionProvider)
End Function
<Fact, Trait(Traits.Feature, Traits.Features.Completion)>
<WorkItem(827897, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/827897")>
Public Async Function TestInYieldReturn() As Task
Dim markup = <Text><![CDATA[
Imports System
Imports System.Collections.Generic
Class C
Iterator Function M() As IEnumerable(Of EntryPointNotFoundException())
Yield New $$
End Function
End Class
]]></Text>.Value
Await VerifyItemExistsAsync(markup, "EntryPointNotFoundException")
End Function
<Fact, Trait(Traits.Feature, Traits.Features.Completion)>
<WorkItem(827897, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/827897")>
Public Async Function TestInAsyncMethodReturnStatement() As Task
Dim markup = <Text><![CDATA[
Imports System
Imports System.Threading.Tasks
Class C
Async Function M() As Task(Of EntryPointNotFoundException)
Await Task.Delay(1)
Return New $$
End Function
End Class
]]></Text>.Value
Await VerifyItemExistsAsync(markup, "EntryPointNotFoundException")
End Function
<Fact, Trait(Traits.Feature, Traits.Features.Completion)>
<WorkItem(892209, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/892209")>
Public Async Function TestUnwrapNullable() As Task
Dim markup = <Text><![CDATA[
Public Class C
Sub M1(arg As N.S?)
End Sub
Sub M2()
M1(New $$)
End Sub
End Class
Namespace N
Public Structure S
Public Sub New(arg As Integer)
End Sub
End Structure
End Namespace
]]></Text>.Value
Await VerifyItemExistsAsync(markup, "N.S")
End Function
<Fact, Trait(Traits.Feature, Traits.Features.Completion)>
Public Async Function TestNotInTrivia() As Task
Dim markup = <Text><![CDATA[
Public Class C
Sub M1(arg As N.S?)
End Sub
Sub M2()
M1(New $$)
End Sub
End Class
Namespace N
Public Structure S
Public Sub New(arg As Integer)
End Sub
End Structure
End Namespace
]]></Text>.Value
Await VerifyItemExistsAsync(markup, "N.S")
End Function
<Fact, Trait(Traits.Feature, Traits.Features.Completion)>
<WorkItem(2644, "https://github.com/dotnet/roslyn/issues/2644")>
Public Async Function InPropertyWithSameNameAsGenericTypeArgument1() As Task
Dim markup = <Text><![CDATA[
Imports System.Collections.Generic
Namespace Namespace1
Module Program
Public Bar As List(Of Bar)
Sub Main()
Bar = New $$
End Sub
End Module
Class Bar
End Class
End Namespace
]]></Text>.Value
Await VerifyItemExistsAsync(markup, "List(Of Bar)")
End Function
<Fact, Trait(Traits.Feature, Traits.Features.Completion)>
<WorkItem(2644, "https://github.com/dotnet/roslyn/issues/2644")>
Public Async Function InPropertyWithSameNameAsGenericTypeArgument2() As Task
Dim markup = <Text><![CDATA[
Imports System.Collections.Generic
Namespace Namespace1
Module Program
Public Bar As List(Of Bar) = New $$
End Module
Class Bar
End Class
End Namespace
]]></Text>.Value
Await VerifyItemExistsAsync(markup, "List(Of Bar)")
End Function
<Fact, Trait(Traits.Feature, Traits.Features.Completion)>
<WorkItem(2644, "https://github.com/dotnet/roslyn/issues/2644")>
Public Async Function InPropertyWithSameNameAsGenericTypeArgument3() As Task
Dim markup = <Text><![CDATA[
Namespace Namespace1
Module Program
Public A As C(Of B)
Public B As C(Of A)
Sub M()
A = New $$
End Sub
End Module
Class A
End Class
Class B
End Class
Class C(Of T)
End Class
End Namespace
]]></Text>.Value
Await VerifyItemExistsAsync(markup, "C(Of B)")
End Function
<Fact, Trait(Traits.Feature, Traits.Features.Completion)>
<WorkItem(21674, "https://github.com/dotnet/roslyn/issues/21674")>
Public Async Function PropertyWithSameNameAsOtherType() As Task
Dim markup = <Text><![CDATA[
Namespace Namespace1
Module Program
Public Property A() As B
Public Property B() As A
Sub M()
B = New $$
End Sub
End Module
Class A
End Class
Class B
End Class
End Namespace
]]></Text>.Value
Await VerifyItemExistsAsync(markup, "A")
End Function
End Class
End Namespace
| Visual Basic | 4 | ffMathy/roslyn | src/EditorFeatures/VisualBasicTest/Completion/CompletionProviders/ObjectCreationCompletionProviderTests.vb | [
"MIT"
] |
#include <ATen/ATen.h>
#include <ATen/Config.h>
#include <ATen/CPUFunctions.h>
#include <ATen/NamedTensorUtils.h>
#include <ATen/native/sparse/ParamUtils.h>
#include <ATen/NativeFunctions.h>
#include <ATen/Parallel.h>
#include <ATen/SparseTensorUtils.h>
#include <c10/util/accumulate.h>
#include <map>
namespace at {
namespace native {
namespace {
int64_t get_nvalues(const IntArrayRef& sizes, int64_t sparse_dim) {
/* Return the number of entries in the dense part of a sparse tensor.
`sizes` is a vector of sparse tensor dimensions.
`sparse_dim` is the dimension of the sparse part of a sparse tensor.
*/
return c10::multiply_integers(sizes.begin() + sparse_dim, sizes.end());
}
std::vector<int64_t> get_offsets(const Tensor& indices, const IntArrayRef& sizes, const int64_t dim) {
/*
Given the indices of a sparse tensor, return a vector of offsets
for the entries in the equivalent dense tensor:
If
offsets = get_offsets(A._indices(), A.sizes(), -1)
data = A.to_dense().resize((nnz,))
then
data[offsets[n]] == A._values()[n]
`indices` must be a contiguous 2-d tensor with int64_t entries.
`sizes` must be a vector with at least ndim entries.
`dim` is an integer. When >= 0 and < ndim, the indices of all
entries in the given dimension will be mapped to the index of the
first entry before computing the offset. Otherwise, the value is
ignored.
For example, consider a sparse tensor
11 ** ** 14 15
** 22 ** 24 **
with
indices = [[0, 0, 0, 1, 1],
[0, 3, 4, 1, 3]]
then
get_offsets(indices, (2, 5), -1) -> [0, 3, 4, 6, 8]
get_offsets(indices, (2, 5), 0) -> [0, 3, 4, 1, 3]
get_offsets(indices, (2, 5), 1) -> [0, 0, 0, 5, 5]
*/
auto ndim = indices.size(0);
auto nnz = indices.size(1);
std::vector<int64_t> offsets(nnz);
std::vector<int64_t> strides(ndim, 1);
auto indices_accessor = indices.accessor<int64_t, 2>();
if (ndim > 1) {
for (int64_t i=ndim - 2; i >= 0; i--) {
strides[i] = strides[i + 1] * sizes[i + 1];
}
}
for (int64_t i=0; i < nnz; i++) {
int64_t acc = 0;
for (int64_t j=0; j < ndim; j++) {
auto indices_row = indices_accessor[j];
auto stride = strides[j];
if (j != dim) {
acc += stride * indices_row[i];
}
}
offsets[i] = acc;
}
return offsets;
}
std::vector<std::vector<int64_t>> get_pools(const Tensor& indices, const IntArrayRef& sizes, const int64_t dim) {
/*
Return pools of indices that align with the given dimension.
Parameters:
`indices` - sparse tensor indices
`sizes` - sparse tensor dimensions
`dim` - given dimension
Returns:
`pools` - a ragged array of indices
A pool is defined as a list of indices (of sparse tensor values)
that participate in the same softmax computation:
- pools[i] intersection with pools[j] is empty iff i != j
- union of all pools is set(range(nnz))
- X.values[k], k in pools[i], does not affect the result of softmax(X)[n], n in pools[j], iff i != j
*/
std::vector<std::vector<int64_t>> pools;
auto ndim = indices.size(0);
auto nnz = indices.size(1);
std::vector<int64_t> strides(ndim, 1);
auto indices_accessor = indices.accessor<int64_t, 2>();
if (ndim > 1) {
for (int64_t i=ndim - 2; i >= 0; i--) {
strides[i] = strides[i + 1] * (i + 1 == dim? 1 : sizes[i + 1]);
}
}
for (int64_t i=0; i < nnz; i++) {
int64_t pool_index = 0;
for (int64_t j=0; j < ndim; j++) {
if (j != dim) {
const auto indices_row = indices_accessor[j];
const auto stride = strides[j];
pool_index += stride * indices_row[i];
}
}
if(static_cast<int64_t>(pools.size()) <= pool_index){
pools.resize(pool_index + 1);
}
pools.at(pool_index).push_back(i);
}
return pools;
}
template <typename scalar_t, bool LogSoftMax>
void cpu_sparse_coo_softmax(Tensor output, const Tensor& input, const int64_t dim) {
/*
See test/test_sparse.py:test_softmax:sparse_softmax for the Python
prototype of the sparse softmax algorithm that this implementation
is based on.
Derivation of the sparse softmax algorithm with an example
----------------------------------------------------------
Consider the following 2-D sparse tensor with 0-D dense part as an
example, denote it by X:
11 ** ** 14 15
** 22 ** 24 **
where `**` represent unspecified entries. The COO sparse tensor
representation of X is:
indices = [[0, 1, 0, 1, 0],
[0, 1, 3, 3, 4]]
values = [11, 22, 14, 24, 15]
that after coalescing becomes
indices = [[0, 0, 0, 1, 1],
[0, 3, 4, 1, 3]]
values = [11, 14, 15, 22, 24]
The softmax of X along the given dimension d is defined as
S_d[i, j] = exp(X[i, j]) / sum(exp(X[I_d[k]]), k=0..X.shape[d]-1)
where the index tuple I_d[k] is defined as
I_0[k] = k, j
I_1[k] = i, k
For sparse tensors, the unspecified entries are skipped in the
softmax sum of exponents so that the result will be sparse tensor
with the same indices as the input. Mathematically, this
corresponds to the case where the unspecified entries are
interpreted as negative infinities rather than zeros.
To minimize the defects from numerical evaluation of exponents
with very large or small arguments, the softmax implementation
uses the following a numerically stable definition:
S_d[i, j] = exp(X[i, j] - maxX_d) / sum(exp(X[I_d[k]] - maxX_d), k=0...X.shape[d]-1)
where
maxX_d = max(X[I_d[k]], k=0...X.shape[d]-1)
is the maximum tensor along the direction d (it has dimensionality
`maxX_d.ndim = X.ndim - 1`).
For the example sparse tensor X, we have:
S_0._indices() == S_1._indices() == X._indices()
maxX_0 = [11, 22, -inf, 24, 15]
maxX_1 = [15, 24]
S_0._values() = [exp(11 - maxX_0[0]) / exp(11 - maxX_0[0]),
exp(14 - maxX_0[3]) / (exp(14 - maxX_0[3]) + exp(24 - maxX_0[3])),
exp(15 - maxX_0[4]) / exp(15 - maxX_0[4]),
exp(22 - maxX_0[1]) / exp(22 - maxX_0[1]),
exp(24 - maxX_0[3]) / (exp(14 - maxX_0[3]) + exp(24 - maxX_0[3]))]
= [1, exp(-10)/(exp(-10) + 1), 1, 1, 1/(exp(-10) + 1)]
(note that `maxX_0[2] == -inf` not used to obtain S_0)
S_1._values() = [exp(11 - maxX_1[0]) / (exp(11 - maxX_1[0]) + exp(14 - maxX_1[0]) + exp(15 - maxX_1[0])),
exp(14 - maxX_1[0]) / (exp(11 - maxX_1[0]) + exp(14 - maxX_1[0]) + exp(15 - maxX_1[0])),
exp(15 - maxX_1[0]) / (exp(11 - maxX_1[0]) + exp(14 - maxX_1[0]) + exp(15 - maxX_1[0])),
exp(22 - maxX_1[1]) / (exp(22 - maxX_1[1]) + exp(24 - maxX_1[1])),
exp(24 - maxX_1[1]) / (exp(22 - maxX_1[1]) + exp(24 - maxX_1[1]))]
= [exp(-4) / (exp(-4) + exp(-1) + 1),
exp(-1) / (exp(-4) + exp(-1) + 1),
1 / (exp(-4) + exp(-1) + 1),
exp(-2) / (exp(-2) + 1),
1 / (exp(-2) + 1)]
To obtain the above via the for-loop over
`nnz(=len(X._values()))`, we introduce the indices mapping `pool`
as follows:
indices = X._indices()
for i in range(nnz):
for j in range(nnz):
if indices[d, i] == indices[d, j]:
assert pool_d[i] == pool_d[j]
else:
assert pool_d[i] != pool_d[j]
that is, the entries with values indices i and j are in the same
pool iff their locations in the grid of tensor indices align with
the direction along which the softmax is calculated. The `pool`
mapping maps the X._values() indices to the corresponding pool
index.
To save memory and processor resources, we pre-compute the entries
of maxX tensor and the sums of exponents as follows:
mx_d = [max(values[i] for i in range(nnz) if pool_0[i] == k) for k in pool_d]
exp_sum_d = [sum(exp(values[i] - mx_d[k]) for i in range(nnz) if pool_d[i] == k) for k in pool_d]
For example, if
pool_0 = [0, 1, 2, 3, 1]
pool_1 = [0, 0, 0, 1, 1]
then
mx_0 = [11, 24, 15, 22]
mx_1 = [15, 24]
exp_sum_0 = [1, (exp(-10) + 1), 1, 1]
exp_sum_1 = [(exp(-4) + exp(-1) + 1), (exp(-2) + 1)]
and
S_0._values() = [exp(11 - mx_0[pool_0[0]]) / exp_sum_0[pool_0[0]]
exp(14 - mx_0[pool_0[1]]) / exp_sum_0[pool_0[1]]
exp(15 - mx_0[pool_0[2]]) / exp_sum_0[pool_0[2]]
exp(22 - mx_0[pool_0[3]]) / exp_sum_0[pool_0[3]]
exp(24 - mx_0[pool_0[4]]) / exp_sum_0[pool_0[4]]
or in general,
S_d._values() = [exp(values[i] - mx_d[pool_d[i]]) / exp_sum_d[pool_d[i] for i in range(nnz)]
The above algorithm can be easily extended for cases with
non-scalar dense part of the sparse tensor where all scalar
operations become element-wise tensor operations.
The implementation below has more optimizations such as that
collect pool indices for enabling concurrency, minimize the calls
to exp functions as well as reuse of softmax implementation for
log_softmax.
*/
auto sparse_dim = input.sparse_dim();
auto indices = input._indices().contiguous();
auto values = input._values().contiguous();
auto out_values = output._values();
auto out_indices = output._indices();
out_values.resize_as_(values);
out_indices.resize_as_(indices);
out_indices.copy_(indices);
if (dim >= sparse_dim) {
if (LogSoftMax) {
auto new_values =
at::cpu::_log_softmax(values, dim - sparse_dim + 1, false);
out_values.set_(new_values);
} else {
auto new_values = at::cpu::_softmax(values, dim - sparse_dim + 1, false);
out_values.set_(new_values);
}
return;
}
auto nnz = values.size(0);
auto sizes = input.sizes();
auto nvalues = get_nvalues(sizes, sparse_dim);
/* Prepare accessors */
auto values_2 = values.view({nnz, nvalues});
auto values_accessor = values_2.accessor<scalar_t, 2>();
auto out_values_2 = out_values.view({nnz, nvalues});
auto out_values_accessor = out_values_2.accessor<scalar_t, 2>();
/* Compute independent pools of indices */
auto pools = get_pools(indices, sizes, dim);
int64_t grain_size = 1;
parallel_for(0, pools.size(), grain_size, [&](int64_t begin, int64_t end) {
for (auto p = begin; p < end; p++) {
auto pool_indices = pools[p];
// Skip empty pools
if (pool_indices.size() == 0)
continue;
/* Prepare scratch space */
std::vector<scalar_t> mx_row(nvalues, -std::numeric_limits<scalar_t>::infinity());
std::vector<scalar_t> exp_sums_row(nvalues, 0);
/* Compute mx */
for (int64_t i : pool_indices) {
auto values_row = values_accessor[i];
for (int64_t j=0; j < nvalues; j++) {
mx_row[j] = std::max(mx_row[j], values_row[j]);
}
}
/* Apply exp to (v - mx) and sum the results */
for (int64_t i : pool_indices) {
auto values_row = values_accessor[i];
auto out_values_row = out_values_accessor[i];
for (int64_t j=0; j < nvalues; j++) {
auto v = std::exp(values_row[j] - mx_row[j]);
if (!LogSoftMax) {
out_values_row[j] = v;
}
exp_sums_row[j] += v;
}
}
for (int64_t j=0; j < nvalues; j++) {
if (LogSoftMax) {
mx_row[j] += std::log(exp_sums_row[j]);
} else {
exp_sums_row[j] = 1.0 / exp_sums_row[j];
}
}
/* Normalize with the sum of exponents */
for (int64_t i : pool_indices) {
auto values_row = values_accessor[i];
auto out_values_row = out_values_accessor[i];
for (int64_t j=0; j < nvalues; j++) {
if (LogSoftMax) {
out_values_row[j] = values_row[j] - mx_row[j];
} else {
out_values_row[j] *= exp_sums_row[j];
}
}
}
}
});
}
template <typename scalar_t, bool LogSoftMax>
void cpu_sparse_coo_softmax_backward(const Tensor& grad_input, const Tensor& grad, const Tensor& output, const int64_t dim, ScalarType input_dtype) {
/*
If LogSoftMax == false, then
gI_i = sum_j d<output_j>/d<input_i> * grad_j = sum_j output_i * (1[i==j] - output_j) * grad_j
= output_i * (grad_i - sum_j output_j * grad_j)
else
gI_i = (1-exp(output_i)) * grad_i - sum_{j} 1[i!=j] * exp(output_i) * grad_j
= grad_i - exp(output_i) * sum_j grad_j.
where
i, j in range(shape[dim])
x_i = x[..., i_dim, ...]
output.sparse_dim() == grad.sparse_dim()
*/
auto sparse_dim = output.sparse_dim();
auto sizes = output.sizes().vec();
auto grad_indices = grad._indices().contiguous();
auto grad_values = grad._values().contiguous();
auto out_indices = output._indices().contiguous();
auto out_values = output._values().contiguous();
auto values = grad_input._values();
auto indices = grad_input._indices();
auto out_nnz = out_values.size(0);
auto grad_nnz = grad_values.size(0);
values.resize_as_(out_values);
values.zero_();
indices.resize_as_(out_indices);
indices.copy_(out_indices);
auto out_offsets = get_offsets(out_indices, sizes, -1);
auto grad_offsets = get_offsets(grad_indices, sizes, -1);
if (dim >= sparse_dim) {
if (out_offsets == grad_offsets) {
if (LogSoftMax) {
auto r = at::cpu::_log_softmax_backward_data(
grad_values, out_values, dim - sparse_dim + 1, input_dtype);
values.set_(r);
} else {
auto r = at::cpu::_softmax_backward_data(grad_values, out_values, dim - sparse_dim + 1, input_dtype);
values.set_(r);
}
} else {
for(int64_t i=0; i<out_nnz; i++) {
auto low = std::lower_bound(grad_offsets.begin(), grad_offsets.end(), out_offsets[i]);
auto j = low - grad_offsets.begin();
if (j < grad_nnz && out_offsets[i] == grad_offsets[j]) {
if (LogSoftMax) {
auto r = at::cpu::_log_softmax_backward_data(
grad_values[j], out_values[i], dim - sparse_dim, input_dtype);
values[i].copy_(r);
} else {
auto r = at::cpu::_softmax_backward_data(grad_values[j], out_values[i], dim - sparse_dim, input_dtype);
values[i].copy_(r);
}
}
}
}
return;
}
auto nnz = values.size(0);
auto nvalues = get_nvalues(sizes, sparse_dim);
auto values_2 = values.view({nnz, nvalues});
auto values_accessor = values_2.accessor<scalar_t, 2>();
auto out_values_2 = out_values.view({out_nnz, nvalues});
auto out_values_accessor = out_values_2.accessor<scalar_t, 2>();
auto grad_values_2 = grad_values.view({grad_nnz, nvalues});
auto grad_values_accessor = grad_values_2.accessor<scalar_t, 2>();
/* Compute independent pools of indices */
auto pools = get_pools(out_indices, sizes, dim);
int64_t grain_size = 1;
parallel_for(0, pools.size(), grain_size, [&](int64_t begin, int64_t end) {
for (auto p = begin; p < end; p++) {
auto pool_indices = pools[p];
// Skip empty pools
if (pool_indices.size() == 0)
continue;
std::vector<scalar_t> tmp_row(nvalues, 0);
/* Compute tmp = - sum_j output_j * grad_j */
for (int64_t i : pool_indices) {
auto out_values_row = out_values_accessor[i];
auto low = std::lower_bound(grad_offsets.begin(), grad_offsets.end(), out_offsets[i]);
auto j = low - grad_offsets.begin();
if (j < grad_nnz && (out_offsets[i] == grad_offsets[j])) {
auto grad_values_row = grad_values_accessor[j];
for (int64_t k=0; k<nvalues; k++) {
if (LogSoftMax) {
tmp_row[k] -= grad_values_row[k];
} else {
tmp_row[k] -= out_values_row[k] * grad_values_row[k];
}
}
}
}
/* Compute grad_input = output * (grad + tmp)*/
for (int64_t i : pool_indices) {
auto out_values_row = out_values_accessor[i];
auto values_row = values_accessor[i];
auto low = std::lower_bound(grad_offsets.begin(), grad_offsets.end(), out_offsets[i]);
auto j = low - grad_offsets.begin();
if (j < grad_nnz && (out_offsets[i] == grad_offsets[j])) {
auto grad_values_row = grad_values_accessor[j];
for (int64_t k=0; k<nvalues; k++) {
if (LogSoftMax) {
values_row[k] = grad_values_row[k] + std::exp(out_values_row[k]) * tmp_row[k];
} else {
values_row[k] = out_values_row[k] * (grad_values_row[k] + tmp_row[k]);
}
}
} else {
for (int64_t k=0; k<nvalues; k++) {
if (LogSoftMax) {
values_row[k] = std::exp(out_values_row[k]) * tmp_row[k];
} else {
values_row[k] = out_values_row[k] * (tmp_row[k]);
}
}
}
}
}
});
}
} // anonymous namespace
Tensor softmax_sparse_cpu(
const Tensor& input_,
const int64_t dim,
const bool half_to_float) {
Tensor input, output;
std::tie(input, output) = softmax_sparse_input_preprocessing(
input_, dim, half_to_float, "softmax");
if (input.numel() == 0) {
return output;
}
AT_DISPATCH_FLOATING_TYPES(input.scalar_type(), "softmax", [&] {
cpu_sparse_coo_softmax<scalar_t, false>(output, input, dim);
});
return output;
}
Tensor log_softmax_sparse_cpu(
const Tensor& input_,
const int64_t dim,
const bool half_to_float) {
Tensor input, output;
std::tie(input, output) = softmax_sparse_input_preprocessing(
input_, dim, half_to_float, "log_softmax");
if (input.numel() == 0) {
return output;
}
AT_DISPATCH_FLOATING_TYPES(input.scalar_type(), "log_softmax", [&] {
cpu_sparse_coo_softmax<scalar_t, true>(output, input, dim);
});
return output;
}
Tensor softmax_backward_sparse_cpu(
const Tensor& grad_,
const Tensor& output_,
int64_t dim_,
const Tensor& input_) {
Tensor grad_input, grad, output;
std::tie(grad_input, grad, output) =
softmax_backward_sparse_input_preprocessing(
grad_, output_, dim_, input_, "softmax_backward");
if (output.numel() == 0) {
return grad_input;
}
AT_DISPATCH_FLOATING_TYPES(grad.scalar_type(), "softmax_backward", [&] {
cpu_sparse_coo_softmax_backward<scalar_t, false>(
grad_input, grad, output, dim_, input_.scalar_type());
});
return grad_input;
}
Tensor log_softmax_backward_sparse_cpu(
const Tensor& grad_,
const Tensor& output_,
int64_t dim_,
const Tensor& input_) {
Tensor grad_input, grad, output;
std::tie(grad_input, grad, output) =
softmax_backward_sparse_input_preprocessing(
grad_, output_, dim_, input_, "log_softmax_backward");
if (output.numel() == 0) {
return grad_input;
}
AT_DISPATCH_FLOATING_TYPES(grad.scalar_type(), "log_softmax_backward", [&] {
cpu_sparse_coo_softmax_backward<scalar_t, true>(
grad_input, grad, output, dim_, input_.scalar_type());
});
return grad_input;
}
Tensor _sparse_softmax(const Tensor& input_, const int64_t dim_) {
auto result = [&]() {
NoNamesGuard guard;
return at::_sparse_softmax(input_, dim_, false);
}();
namedinference::propagate_names(result, input_);
return result;
}
Tensor _sparse_softmax(const Tensor& input_, const int64_t dim_, c10::optional<ScalarType> dtype) {
auto result = [&]() {
NoNamesGuard guard;
if (input_.is_cuda() && input_.scalar_type() == ScalarType::Half && dtype == ScalarType::Float){
return at::_sparse_softmax(input_, dim_, true);
} else {
Tensor converted = dtype.has_value() ? input_.toType(dtype.value()) : input_;
return at::_sparse_softmax(converted, dim_, false);
}
}();
namedinference::propagate_names(result, input_);
return result;
}
Tensor _sparse_softmax(const Tensor& self, Dimname dim, optional<ScalarType> dtype) {
return at::_sparse_softmax(self, dimname_to_position(self, dim), dtype);
}
Tensor _sparse_log_softmax(const Tensor& input_, const int64_t dim_) {
auto result = [&]() {
NoNamesGuard guard;
return at::_sparse_log_softmax(input_, dim_, false);
}();
namedinference::propagate_names(result, input_);
return result;
}
Tensor _sparse_log_softmax(const Tensor& input_, const int64_t dim_, c10::optional<ScalarType> dtype) {
auto result = [&]() {
NoNamesGuard guard;
if (input_.is_cuda() && input_.scalar_type() == ScalarType::Half && dtype == ScalarType::Float){
return at::_sparse_log_softmax(input_, dim_, true);
} else {
Tensor converted = dtype.has_value() ? input_.toType(dtype.value()) : input_;
return at::_sparse_log_softmax(converted, dim_, false);
}
}();
namedinference::propagate_names(result, input_);
return result;
}
Tensor _sparse_log_softmax(const Tensor& self, Dimname dim, optional<ScalarType> dtype) {
return at::_sparse_log_softmax(self, dimname_to_position(self, dim), dtype);
}
}
}
| C++ | 5 | xiaohanhuang/pytorch | aten/src/ATen/native/sparse/SoftMax.cpp | [
"Intel"
] |
>+ Set c1 = 1
>++ Set c2 = 2
>+++ Set c3 = 3
>++++ Set c4 = 4
[->>>>>>>>+<<<<<<<<] Move the value of c4 to c12
<
[->>>>>>>>>+<<<<<<<<<] Add the value of c3 to c12
Print the value of c12 as a single ASCII digit
>>>>>>>>>
++++++++ ++++++++ ++++++++ ++++++++ ++++++++ ++++++++.
<
[->+<] Add the value of c11 (which is 0) to c12
Print the value of c12 as a single ASCII digit
>.
<<<<<<<<<<<
[->+<] Add the value of c1 to c2 and print c2
>
++++++++ ++++++++ ++++++++ ++++++++ ++++++++ ++++++++.
>
[-<+>] Add the value of c3 (which is 0) to c2 nd print c2
<.
>+++ Set c3 to 3 and add its value to c2 again and print c2
[-<+>]
<.
Now in a loop set c3 to 2 and add it with a move loop to c6
[-] c2 is the loop counter initialized to 4
++++
[
>++ set c3 to 2
[->>>+<<<] add c3 to c6
<- decrement loop counter
]
>>>> Print c6
++++++++ ++++++++ ++++++++ ++++++++ ++++++++ ++++++++.
Similarly in a loop do the same but now move data left from c6 to c4
<<<<
[-] c2 is the loop counter initialized to 4
++++
[
>>>>[-]++
[-<<+>>]
<<<<-
]
>> Print c4
++++++++ ++++++++ ++++++++ ++++++++ ++++++++ ++++++++.
| Brainfuck | 4 | mikiec84/code-for-blog | 2017/bfjit/tests/testcases/movedataloops.bf | [
"Unlicense"
] |
$ write sys$output "*** TEST SYMBOL ASSIGN ***"
$ s1 := test1
$ s2 :== test2
$ s3 = -1
$ s4 = 1
$ s5 = s1
$ s6 == s1
$ sho symbol /global
$ sho symbol /local
$ sho symbol s1
$ delete /symbol s1 /log
$ delete /symbol /local /log /all
$ show symbol s*
| Clean | 2 | MichelValentin/PC-DCL | examples/symbol.dcl | [
"BSD-3-Clause"
] |
/*
* Copyright 2012-2021 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.boot.docs.features.testing.springbootapplications.withmockenvironment;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.web.reactive.server.WebTestClient;
import org.springframework.test.web.servlet.MockMvc;
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.content;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;
@SpringBootTest
@AutoConfigureMockMvc
class MyMockMvcTests {
@Test
void testWithMockMvc(@Autowired MockMvc mvc) throws Exception {
mvc.perform(get("/")).andExpect(status().isOk()).andExpect(content().string("Hello World"));
}
// If Spring WebFlux is on the classpath, you can drive MVC tests with a WebTestClient
@Test
void testWithWebTestClient(@Autowired WebTestClient webClient) {
// @formatter:off
webClient
.get().uri("/")
.exchange()
.expectStatus().isOk()
.expectBody(String.class).isEqualTo("Hello World");
// @formatter:on
}
}
| Java | 4 | techAi007/spring-boot | spring-boot-project/spring-boot-docs/src/main/java/org/springframework/boot/docs/features/testing/springbootapplications/withmockenvironment/MyMockMvcTests.java | [
"Apache-2.0"
] |
#include <metal_stdlib>
#include <simd/simd.h>
using namespace metal;
struct Inputs {
float2 vLocalCoord_Stage0 [[user(locn0)]];
};
struct Outputs {
half4 sk_FragColor [[color(0)]];
};
struct uniformBuffer {
float4 sk_RTAdjust;
half2 uIncrement_Stage1_c0;
char pad0[12];
array<half4, 7> uKernel_Stage1_c0;
char pad1[56];
float3x3 umatrix_Stage1_c0_c0;
half4 uborder_Stage1_c0_c0_c0;
char pad2[8];
float4 usubset_Stage1_c0_c0_c0;
float4 unorm_Stage1_c0_c0_c0;
};
struct Globals {
constant uniformBuffer* _anonInterface0;
texture2d<half> uTextureSampler_0_Stage1;
sampler uTextureSampler_0_Stage1Smplr;
};
half4 MatrixEffect_Stage1_c0_c0_h4h4f2(thread Globals& _globals, half4 _input, float2 _coords) {
float2 _1_inCoord = (_globals._anonInterface0->umatrix_Stage1_c0_c0 * float3(_coords, 1.0)).xy;
_1_inCoord *= _globals._anonInterface0->unorm_Stage1_c0_c0_c0.xy;
float2 _2_subsetCoord;
_2_subsetCoord.x = _1_inCoord.x;
_2_subsetCoord.y = _1_inCoord.y;
float2 _3_clampedCoord;
_3_clampedCoord = _2_subsetCoord;
half4 _4_textureColor = _globals.uTextureSampler_0_Stage1.sample(_globals.uTextureSampler_0_Stage1Smplr, _3_clampedCoord * _globals._anonInterface0->unorm_Stage1_c0_c0_c0.zw);
float _5_snappedX = floor(_1_inCoord.x + 0.0010000000474974513) + 0.5;
if (_5_snappedX < _globals._anonInterface0->usubset_Stage1_c0_c0_c0.x || _5_snappedX > _globals._anonInterface0->usubset_Stage1_c0_c0_c0.z) {
_4_textureColor = _globals._anonInterface0->uborder_Stage1_c0_c0_c0;
}
return _4_textureColor;
}
fragment Outputs fragmentMain(Inputs _in [[stage_in]], texture2d<half> uTextureSampler_0_Stage1[[texture(0)]], sampler uTextureSampler_0_Stage1Smplr[[sampler(0)]], constant uniformBuffer& _anonInterface0 [[buffer(0)]], bool _frontFacing [[front_facing]], float4 _fragCoord [[position]]) {
Globals _globals{&_anonInterface0, uTextureSampler_0_Stage1, uTextureSampler_0_Stage1Smplr};
(void)_globals;
Outputs _out;
(void)_out;
half4 outputColor_Stage0;
half4 outputCoverage_Stage0;
{
outputColor_Stage0 = half4(1.0h);
outputCoverage_Stage0 = half4(1.0h);
}
half4 output_Stage1;
half4 _6_output;
_6_output = half4(0.0h, 0.0h, 0.0h, 0.0h);
float2 _7_coord = _in.vLocalCoord_Stage0 - float2(12.0h * _globals._anonInterface0->uIncrement_Stage1_c0);
float2 _8_coordSampled = float2(0.0, 0.0);
_8_coordSampled = _7_coord;
_6_output += MatrixEffect_Stage1_c0_c0_h4h4f2(_globals, outputColor_Stage0, _8_coordSampled) * _globals._anonInterface0->uKernel_Stage1_c0[0].x;
_7_coord += float2(_globals._anonInterface0->uIncrement_Stage1_c0);
_8_coordSampled = _7_coord;
_6_output += MatrixEffect_Stage1_c0_c0_h4h4f2(_globals, outputColor_Stage0, _8_coordSampled) * _globals._anonInterface0->uKernel_Stage1_c0[0].y;
_7_coord += float2(_globals._anonInterface0->uIncrement_Stage1_c0);
_8_coordSampled = _7_coord;
_6_output += MatrixEffect_Stage1_c0_c0_h4h4f2(_globals, outputColor_Stage0, _8_coordSampled) * _globals._anonInterface0->uKernel_Stage1_c0[0].z;
_7_coord += float2(_globals._anonInterface0->uIncrement_Stage1_c0);
_8_coordSampled = _7_coord;
_6_output += MatrixEffect_Stage1_c0_c0_h4h4f2(_globals, outputColor_Stage0, _8_coordSampled) * _globals._anonInterface0->uKernel_Stage1_c0[0].w;
_7_coord += float2(_globals._anonInterface0->uIncrement_Stage1_c0);
_8_coordSampled = _7_coord;
_6_output += MatrixEffect_Stage1_c0_c0_h4h4f2(_globals, outputColor_Stage0, _8_coordSampled) * _globals._anonInterface0->uKernel_Stage1_c0[1].x;
_7_coord += float2(_globals._anonInterface0->uIncrement_Stage1_c0);
_8_coordSampled = _7_coord;
_6_output += MatrixEffect_Stage1_c0_c0_h4h4f2(_globals, outputColor_Stage0, _8_coordSampled) * _globals._anonInterface0->uKernel_Stage1_c0[1].y;
_7_coord += float2(_globals._anonInterface0->uIncrement_Stage1_c0);
_8_coordSampled = _7_coord;
_6_output += MatrixEffect_Stage1_c0_c0_h4h4f2(_globals, outputColor_Stage0, _8_coordSampled) * _globals._anonInterface0->uKernel_Stage1_c0[1].z;
_7_coord += float2(_globals._anonInterface0->uIncrement_Stage1_c0);
_8_coordSampled = _7_coord;
_6_output += MatrixEffect_Stage1_c0_c0_h4h4f2(_globals, outputColor_Stage0, _8_coordSampled) * _globals._anonInterface0->uKernel_Stage1_c0[1].w;
_7_coord += float2(_globals._anonInterface0->uIncrement_Stage1_c0);
_8_coordSampled = _7_coord;
_6_output += MatrixEffect_Stage1_c0_c0_h4h4f2(_globals, outputColor_Stage0, _8_coordSampled) * _globals._anonInterface0->uKernel_Stage1_c0[2].x;
_7_coord += float2(_globals._anonInterface0->uIncrement_Stage1_c0);
_8_coordSampled = _7_coord;
_6_output += MatrixEffect_Stage1_c0_c0_h4h4f2(_globals, outputColor_Stage0, _8_coordSampled) * _globals._anonInterface0->uKernel_Stage1_c0[2].y;
_7_coord += float2(_globals._anonInterface0->uIncrement_Stage1_c0);
_8_coordSampled = _7_coord;
_6_output += MatrixEffect_Stage1_c0_c0_h4h4f2(_globals, outputColor_Stage0, _8_coordSampled) * _globals._anonInterface0->uKernel_Stage1_c0[2].z;
_7_coord += float2(_globals._anonInterface0->uIncrement_Stage1_c0);
_8_coordSampled = _7_coord;
_6_output += MatrixEffect_Stage1_c0_c0_h4h4f2(_globals, outputColor_Stage0, _8_coordSampled) * _globals._anonInterface0->uKernel_Stage1_c0[2].w;
_7_coord += float2(_globals._anonInterface0->uIncrement_Stage1_c0);
_8_coordSampled = _7_coord;
_6_output += MatrixEffect_Stage1_c0_c0_h4h4f2(_globals, outputColor_Stage0, _8_coordSampled) * _globals._anonInterface0->uKernel_Stage1_c0[3].x;
_7_coord += float2(_globals._anonInterface0->uIncrement_Stage1_c0);
_8_coordSampled = _7_coord;
_6_output += MatrixEffect_Stage1_c0_c0_h4h4f2(_globals, outputColor_Stage0, _8_coordSampled) * _globals._anonInterface0->uKernel_Stage1_c0[3].y;
_7_coord += float2(_globals._anonInterface0->uIncrement_Stage1_c0);
_8_coordSampled = _7_coord;
_6_output += MatrixEffect_Stage1_c0_c0_h4h4f2(_globals, outputColor_Stage0, _8_coordSampled) * _globals._anonInterface0->uKernel_Stage1_c0[3].z;
_7_coord += float2(_globals._anonInterface0->uIncrement_Stage1_c0);
_8_coordSampled = _7_coord;
_6_output += MatrixEffect_Stage1_c0_c0_h4h4f2(_globals, outputColor_Stage0, _8_coordSampled) * _globals._anonInterface0->uKernel_Stage1_c0[3].w;
_7_coord += float2(_globals._anonInterface0->uIncrement_Stage1_c0);
_8_coordSampled = _7_coord;
_6_output += MatrixEffect_Stage1_c0_c0_h4h4f2(_globals, outputColor_Stage0, _8_coordSampled) * _globals._anonInterface0->uKernel_Stage1_c0[4].x;
_7_coord += float2(_globals._anonInterface0->uIncrement_Stage1_c0);
_8_coordSampled = _7_coord;
_6_output += MatrixEffect_Stage1_c0_c0_h4h4f2(_globals, outputColor_Stage0, _8_coordSampled) * _globals._anonInterface0->uKernel_Stage1_c0[4].y;
_7_coord += float2(_globals._anonInterface0->uIncrement_Stage1_c0);
_8_coordSampled = _7_coord;
_6_output += MatrixEffect_Stage1_c0_c0_h4h4f2(_globals, outputColor_Stage0, _8_coordSampled) * _globals._anonInterface0->uKernel_Stage1_c0[4].z;
_7_coord += float2(_globals._anonInterface0->uIncrement_Stage1_c0);
_8_coordSampled = _7_coord;
_6_output += MatrixEffect_Stage1_c0_c0_h4h4f2(_globals, outputColor_Stage0, _8_coordSampled) * _globals._anonInterface0->uKernel_Stage1_c0[4].w;
_7_coord += float2(_globals._anonInterface0->uIncrement_Stage1_c0);
_8_coordSampled = _7_coord;
_6_output += MatrixEffect_Stage1_c0_c0_h4h4f2(_globals, outputColor_Stage0, _8_coordSampled) * _globals._anonInterface0->uKernel_Stage1_c0[5].x;
_7_coord += float2(_globals._anonInterface0->uIncrement_Stage1_c0);
_8_coordSampled = _7_coord;
_6_output += MatrixEffect_Stage1_c0_c0_h4h4f2(_globals, outputColor_Stage0, _8_coordSampled) * _globals._anonInterface0->uKernel_Stage1_c0[5].y;
_7_coord += float2(_globals._anonInterface0->uIncrement_Stage1_c0);
_8_coordSampled = _7_coord;
_6_output += MatrixEffect_Stage1_c0_c0_h4h4f2(_globals, outputColor_Stage0, _8_coordSampled) * _globals._anonInterface0->uKernel_Stage1_c0[5].z;
_7_coord += float2(_globals._anonInterface0->uIncrement_Stage1_c0);
_8_coordSampled = _7_coord;
_6_output += MatrixEffect_Stage1_c0_c0_h4h4f2(_globals, outputColor_Stage0, _8_coordSampled) * _globals._anonInterface0->uKernel_Stage1_c0[5].w;
_7_coord += float2(_globals._anonInterface0->uIncrement_Stage1_c0);
_8_coordSampled = _7_coord;
_6_output += MatrixEffect_Stage1_c0_c0_h4h4f2(_globals, outputColor_Stage0, _8_coordSampled) * _globals._anonInterface0->uKernel_Stage1_c0[6].x;
_7_coord += float2(_globals._anonInterface0->uIncrement_Stage1_c0);
_6_output *= outputColor_Stage0;
output_Stage1 = _6_output;
{
_out.sk_FragColor = output_Stage1 * outputCoverage_Stage0;
}
return _out;
}
| Metal | 3 | fourgrad/skia | tests/sksl/shared/GaussianBlur.metal | [
"BSD-3-Clause"
] |
/*
* Copyright 2012-2019 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.boot.context.properties.source;
import org.springframework.util.Assert;
/**
* A {@link ConfigurationPropertySource} supporting name aliases.
*
* @author Phillip Webb
* @author Madhura Bhave
*/
class AliasedConfigurationPropertySource implements ConfigurationPropertySource {
private final ConfigurationPropertySource source;
private final ConfigurationPropertyNameAliases aliases;
AliasedConfigurationPropertySource(ConfigurationPropertySource source, ConfigurationPropertyNameAliases aliases) {
Assert.notNull(source, "Source must not be null");
Assert.notNull(aliases, "Aliases must not be null");
this.source = source;
this.aliases = aliases;
}
@Override
public ConfigurationProperty getConfigurationProperty(ConfigurationPropertyName name) {
Assert.notNull(name, "Name must not be null");
ConfigurationProperty result = getSource().getConfigurationProperty(name);
if (result == null) {
ConfigurationPropertyName aliasedName = getAliases().getNameForAlias(name);
result = getSource().getConfigurationProperty(aliasedName);
}
return result;
}
@Override
public ConfigurationPropertyState containsDescendantOf(ConfigurationPropertyName name) {
Assert.notNull(name, "Name must not be null");
ConfigurationPropertyState result = this.source.containsDescendantOf(name);
if (result != ConfigurationPropertyState.ABSENT) {
return result;
}
for (ConfigurationPropertyName alias : getAliases().getAliases(name)) {
ConfigurationPropertyState aliasResult = this.source.containsDescendantOf(alias);
if (aliasResult != ConfigurationPropertyState.ABSENT) {
return aliasResult;
}
}
for (ConfigurationPropertyName from : getAliases()) {
for (ConfigurationPropertyName alias : getAliases().getAliases(from)) {
if (name.isAncestorOf(alias)) {
if (this.source.getConfigurationProperty(from) != null) {
return ConfigurationPropertyState.PRESENT;
}
}
}
}
return ConfigurationPropertyState.ABSENT;
}
@Override
public Object getUnderlyingSource() {
return this.source.getUnderlyingSource();
}
protected ConfigurationPropertySource getSource() {
return this.source;
}
protected ConfigurationPropertyNameAliases getAliases() {
return this.aliases;
}
}
| Java | 5 | yiou362/spring-boot-2.2.9.RELEASE | spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/properties/source/AliasedConfigurationPropertySource.java | [
"Apache-2.0"
] |
{-# LANGUAGE CPP, DisambiguateRecordFields, OverloadedStrings, TypeApplications, ImplicitParams #-}
{-# OPTIONS_GHC -Wno-unused-imports #-}
module Main (main) where
import qualified System.Path as Path
import Test.Tasty
import TreeSitter.Python
import qualified Language.Python.AST as Py
import AST.TestHelpers
import AST.Unmarshal
import qualified System.Path.Fixture as Fixture
main :: IO ()
main = do
#if BAZEL_BUILD
rf <- Fixture.create
let ?project = Path.relDir "external/tree-sitter-python"
?runfiles = rf
let dirs = Fixture.absRelDir "test/corpus"
#else
dirs <- Path.absRel <$> Py.getTestCorpusDir
#endif
let parse = parseByteString @Py.Module @() tree_sitter_python
readCorpusFiles' dirs
>>= traverse (testCorpus parse)
>>= defaultMain . tests
tests :: [TestTree] -> TestTree
tests = testGroup "tree-sitter-python corpus tests"
| Haskell | 4 | quentinLeDilavrec/semantic | semantic-python/test/PreciseTest.hs | [
"MIT"
] |
#*****************************************************************************
# *
# Make file for VMS *
# Author : J.Jansen (joukj@hrem.nano.tudelft.nl) *
# Date : 22 August 2013 *
# *
#*****************************************************************************
.first
define wx [--.include.wx]
.ifdef __WXMOTIF__
CXX_DEFINE = /define=(__WXMOTIF__=1)/name=(as_is,short)\
/assume=(nostdnew,noglobal_array_new)
.else
.ifdef __WXGTK__
CXX_DEFINE = /define=(__WXGTK__=1)/float=ieee/name=(as_is,short)/ieee=denorm\
/assume=(nostdnew,noglobal_array_new)
.else
.ifdef __WXGTK2__
CXX_DEFINE = /define=(__WXGTK__=1,VMS_GTK2=1)/float=ieee/name=(as_is,short)/ieee=denorm\
/assume=(nostdnew,noglobal_array_new)
.else
.ifdef __WXX11__
CXX_DEFINE = /define=(__WXX11__=1,__WXUNIVERSAL__==1)/float=ieee\
/name=(as_is,short)/assume=(nostdnew,noglobal_array_new)
.else
CXX_DEFINE =
.endif
.endif
.endif
.endif
.suffixes : .cpp
.cpp.obj :
cxx $(CXXFLAGS)$(CXX_DEFINE) $(MMS$TARGET_NAME).cpp
all :
.ifdef __WXMOTIF__
$(MMS)$(MMSQUALIFIERS) notebook.exe
.else
.ifdef __WXGTK__
$(MMS)$(MMSQUALIFIERS) notebook_gtk.exe
.else
.ifdef __WXGTK2__
$(MMS)$(MMSQUALIFIERS) notebook_gtk2.exe
.else
.ifdef __WXX11__
$(MMS)$(MMSQUALIFIERS) notebook_x11.exe
.endif
.endif
.endif
.endif
.ifdef __WXMOTIF__
notebook.exe : notebook.obj
cxxlink notebook,[--.lib]vms/opt
.else
.ifdef __WXGTK__
notebook_gtk.exe : notebook.obj
cxxlink/exec=notebook_gtk.exe notebook,[--.lib]vms_gtk/opt
.else
.ifdef __WXGTK2__
notebook_gtk2.exe : notebook.obj
cxxlink/exec=notebook_gtk2.exe notebook,[--.lib]vms_gtk2/opt
.else
.ifdef __WXX11__
notebook_x11.exe : notebook.obj
cxxlink/exec=notebook_x11.exe notebook,[--.lib]vms_x11_univ/opt
.endif
.endif
.endif
.endif
notebook.obj : notebook.cpp
| Module Management System | 4 | madanagopaltcomcast/pxCore | examples/pxScene2d/external/WinSparkle/3rdparty/wxWidgets/samples/notebook/descrip.mms | [
"Apache-2.0"
] |
# Copyright 1999-2018 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# @ECLASS: distutils-r1.eclass
# @MAINTAINER:
# Python team <python@gentoo.org>
# @AUTHOR:
# Author: Michał Górny <mgorny@gentoo.org>
# Based on the work of: Krzysztof Pawlik <nelchael@gentoo.org>
# @SUPPORTED_EAPIS: 5 6 7
# @BLURB: A simple eclass to build Python packages using distutils.
# @DESCRIPTION:
# A simple eclass providing functions to build Python packages using
# the distutils build system. It exports phase functions for all
# the src_* phases. Each of the phases runs two pseudo-phases:
# python_..._all() (e.g. python_prepare_all()) once in ${S}, then
# python_...() (e.g. python_prepare()) for each implementation
# (see: python_foreach_impl() in python-r1).
#
# In distutils-r1_src_prepare(), the 'all' function is run before
# per-implementation ones (because it creates the implementations),
# per-implementation functions are run in a random order.
#
# In remaining phase functions, the per-implementation functions are run
# before the 'all' one, and they are ordered from the least to the most
# preferred implementation (so that 'better' files overwrite 'worse'
# ones).
#
# If the ebuild doesn't specify a particular pseudo-phase function,
# the default one will be used (distutils-r1_...). Defaults are provided
# for all per-implementation pseudo-phases, python_prepare_all()
# and python_install_all(); whenever writing your own pseudo-phase
# functions, you should consider calling the defaults (and especially
# distutils-r1_python_prepare_all).
#
# Please note that distutils-r1 sets RDEPEND and DEPEND unconditionally
# for you.
#
# Also, please note that distutils-r1 will always inherit python-r1
# as well. Thus, all the variables defined and documented there are
# relevant to the packages using distutils-r1.
#
# For more information, please see the wiki:
# https://wiki.gentoo.org/wiki/Project:Python/distutils-r1
case "${EAPI:-0}" in
0|1|2|3|4)
die "Unsupported EAPI=${EAPI:-0} (too old) for ${ECLASS}"
;;
5|6|7)
;;
*)
die "Unsupported EAPI=${EAPI} (unknown) for ${ECLASS}"
;;
esac
# @ECLASS-VARIABLE: DISTUTILS_OPTIONAL
# @DEFAULT_UNSET
# @DESCRIPTION:
# If set to a non-null value, distutils part in the ebuild will
# be considered optional. No dependencies will be added and no phase
# functions will be exported.
#
# If you enable DISTUTILS_OPTIONAL, you have to set proper dependencies
# for your package (using ${PYTHON_DEPS}) and to either call
# distutils-r1 default phase functions or call the build system
# manually.
# @ECLASS-VARIABLE: DISTUTILS_SINGLE_IMPL
# @DEFAULT_UNSET
# @DESCRIPTION:
# If set to a non-null value, the ebuild will support setting a single
# Python implementation only. It will effectively replace the python-r1
# eclass inherit with python-single-r1.
#
# Note that inheriting python-single-r1 will cause pkg_setup()
# to be exported. It must be run in order for the eclass functions
# to function properly.
if [[ ! ${_DISTUTILS_R1} ]]; then
[[ ${EAPI} == [45] ]] && inherit eutils
[[ ${EAPI} == [56] ]] && inherit xdg-utils
inherit multiprocessing toolchain-funcs
if [[ ! ${DISTUTILS_SINGLE_IMPL} ]]; then
inherit python-r1
else
inherit python-single-r1
fi
fi
if [[ ! ${DISTUTILS_OPTIONAL} ]]; then
EXPORT_FUNCTIONS src_prepare src_configure src_compile src_test src_install
fi
if [[ ! ${_DISTUTILS_R1} ]]; then
if [[ ! ${DISTUTILS_OPTIONAL} ]]; then
RDEPEND=${PYTHON_DEPS}
if [[ ${EAPI} != [56] ]]; then
BDEPEND=${PYTHON_DEPS}
else
DEPEND=${PYTHON_DEPS}
fi
REQUIRED_USE=${PYTHON_REQUIRED_USE}
fi
# @ECLASS-VARIABLE: PATCHES
# @DEFAULT_UNSET
# @DESCRIPTION:
# An array containing patches to be applied to the sources before
# copying them.
#
# If unset, no custom patches will be applied.
#
# Please note, however, that at some point the eclass may apply
# additional distutils patches/quirks independently of this variable.
#
# Example:
# @CODE
# PATCHES=( "${FILESDIR}"/${P}-make-gentoo-happy.patch )
# @CODE
# @ECLASS-VARIABLE: DOCS
# @DEFAULT_UNSET
# @DESCRIPTION:
# An array containing documents installed using dodoc. The files listed
# there must exist in the directory from which
# distutils-r1_python_install_all() is run (${S} by default).
#
# If unset, the function will instead look up files matching default
# filename pattern list (from the Package Manager Specification),
# and install those found.
#
# Example:
# @CODE
# DOCS=( NEWS README )
# @CODE
# @ECLASS-VARIABLE: HTML_DOCS
# @DEFAULT_UNSET
# @DESCRIPTION:
# An array containing documents installed using dohtml. The files
# and directories listed there must exist in the directory from which
# distutils-r1_python_install_all() is run (${S} by default).
#
# If unset, no HTML docs will be installed.
#
# Example:
# @CODE
# HTML_DOCS=( doc/html/. )
# @CODE
# @ECLASS-VARIABLE: EXAMPLES
# @DEFAULT_UNSET
# @DESCRIPTION:
# OBSOLETE: this variable is deprecated and banned in EAPI 6
#
# An array containing examples installed into 'examples' doc
# subdirectory. The files and directories listed there must exist
# in the directory from which distutils-r1_python_install_all() is run
# (${S} by default).
#
# The 'examples' subdirectory will be marked not to be compressed
# automatically.
#
# If unset, no examples will be installed.
#
# Example:
# @CODE
# EXAMPLES=( examples/. demos/. )
# @CODE
# @ECLASS-VARIABLE: DISTUTILS_IN_SOURCE_BUILD
# @DEFAULT_UNSET
# @DESCRIPTION:
# If set to a non-null value, in-source builds will be enabled.
# If unset, the default is to use in-source builds when python_prepare()
# is declared, and out-of-source builds otherwise.
#
# If in-source builds are used, the eclass will create a copy of package
# sources for each Python implementation in python_prepare_all(),
# and work on that copy afterwards.
#
# If out-of-source builds are used, the eclass will instead work
# on the sources directly, prepending setup.py arguments with
# 'build --build-base ${BUILD_DIR}' to enforce keeping & using built
# files in the specific root.
# @ECLASS-VARIABLE: DISTUTILS_ALL_SUBPHASE_IMPLS
# @DEFAULT_UNSET
# @DESCRIPTION:
# An array of patterns specifying which implementations can be used
# for *_all() sub-phase functions. If undefined, defaults to '*'
# (allowing any implementation). If multiple values are specified,
# implementations matching any of the patterns will be accepted.
#
# The patterns can be either fnmatch-style patterns (matched via bash
# == operator against PYTHON_COMPAT values) or '-2' / '-3' to indicate
# appropriately all enabled Python 2/3 implementations (alike
# python_is_python3). Remember to escape or quote the fnmatch patterns
# to prevent accidental shell filename expansion.
#
# If the restriction needs to apply conditionally to a USE flag,
# the variable should be set conditionally as well (e.g. in an early
# phase function or other convenient location).
#
# Please remember to add a matching || block to REQUIRED_USE,
# to ensure that at least one implementation matching the patterns will
# be enabled.
#
# Example:
# @CODE
# REQUIRED_USE="doc? ( || ( $(python_gen_useflags 'python2*') ) )"
#
# pkg_setup() {
# use doc && DISTUTILS_ALL_SUBPHASE_IMPLS=( 'python2*' )
# }
# @CODE
# @ECLASS-VARIABLE: mydistutilsargs
# @DEFAULT_UNSET
# @DESCRIPTION:
# An array containing options to be passed to setup.py.
#
# Example:
# @CODE
# python_configure_all() {
# mydistutilsargs=( --enable-my-hidden-option )
# }
# @CODE
# @FUNCTION: esetup.py
# @USAGE: [<args>...]
# @DESCRIPTION:
# Run setup.py using currently selected Python interpreter
# (if ${EPYTHON} is set; fallback 'python' otherwise).
#
# setup.py will be passed the following, in order:
# 1. ${mydistutilsargs[@]}
# 2. additional arguments passed to the esetup.py function.
#
# Please note that setup.py will respect defaults (unless overridden
# via command-line options) from setup.cfg that is created
# in distutils-r1_python_compile and in distutils-r1_python_install.
#
# This command dies on failure.
esetup.py() {
debug-print-function ${FUNCNAME} "${@}"
local die_args=()
[[ ${EAPI} != [45] ]] && die_args+=( -n )
[[ ${BUILD_DIR} ]] && _distutils-r1_create_setup_cfg
set -- "${EPYTHON:-python}" setup.py "${mydistutilsargs[@]}" "${@}"
echo "${@}" >&2
"${@}" || die "${die_args[@]}"
local ret=${?}
if [[ ${BUILD_DIR} ]]; then
rm "${HOME}"/.pydistutils.cfg || die "${die_args[@]}"
fi
return ${ret}
}
# @FUNCTION: distutils_install_for_testing
# @USAGE: [<args>...]
# @DESCRIPTION:
# Install the package into a temporary location for running tests.
# Update PYTHONPATH appropriately and set TEST_DIR to the test
# installation root. The Python packages will be installed in 'lib'
# subdir, and scripts in 'scripts' subdir (like in BUILD_DIR).
#
# Please note that this function should be only used if package uses
# namespaces (and therefore proper install needs to be done to enforce
# PYTHONPATH) or tests rely on the results of install command.
# For most of the packages, tests built in BUILD_DIR are good enough.
distutils_install_for_testing() {
debug-print-function ${FUNCNAME} "${@}"
# A few notes:
# 1) because of namespaces, we can't use 'install --root',
# 2) 'install --home' is terribly broken on pypy, so we need
# to override --install-lib and --install-scripts,
# 3) non-root 'install' complains about PYTHONPATH and missing dirs,
# so we need to set it properly and mkdir them,
# 4) it runs a bunch of commands which write random files to cwd,
# in order to avoid that, we add the necessary path overrides
# in _distutils-r1_create_setup_cfg.
TEST_DIR=${BUILD_DIR}/test
local bindir=${TEST_DIR}/scripts
local libdir=${TEST_DIR}/lib
PYTHONPATH=${libdir}:${PYTHONPATH}
local add_args=(
install
--home="${TEST_DIR}"
--install-lib="${libdir}"
--install-scripts="${bindir}"
)
mkdir -p "${libdir}" || die
esetup.py "${add_args[@]}" "${@}"
}
# @FUNCTION: _distutils-r1_disable_ez_setup
# @INTERNAL
# @DESCRIPTION:
# Stub out ez_setup.py and distribute_setup.py to prevent packages
# from trying to download a local copy of setuptools.
_distutils-r1_disable_ez_setup() {
local stub="def use_setuptools(*args, **kwargs): pass"
if [[ -f ez_setup.py ]]; then
echo "${stub}" > ez_setup.py || die
fi
if [[ -f distribute_setup.py ]]; then
echo "${stub}" > distribute_setup.py || die
fi
}
# @FUNCTION: distutils-r1_python_prepare_all
# @DESCRIPTION:
# The default python_prepare_all(). It applies the patches from PATCHES
# array, then user patches and finally calls python_copy_sources to
# create copies of resulting sources for each Python implementation.
#
# At some point in the future, it may also apply eclass-specific
# distutils patches and/or quirks.
distutils-r1_python_prepare_all() {
debug-print-function ${FUNCNAME} "${@}"
if [[ ! ${DISTUTILS_OPTIONAL} ]]; then
if [[ ${EAPI} != [45] ]]; then
default
else
[[ ${PATCHES} ]] && epatch "${PATCHES[@]}"
epatch_user
fi
fi
# by default, use in-source build if python_prepare() is used
if [[ ! ${DISTUTILS_IN_SOURCE_BUILD+1} ]]; then
if declare -f python_prepare >/dev/null; then
DISTUTILS_IN_SOURCE_BUILD=1
fi
fi
_distutils-r1_disable_ez_setup
if [[ ${DISTUTILS_IN_SOURCE_BUILD} && ! ${DISTUTILS_SINGLE_IMPL} ]]
then
# create source copies for each implementation
python_copy_sources
fi
_DISTUTILS_DEFAULT_CALLED=1
}
# @FUNCTION: distutils-r1_python_prepare
# @DESCRIPTION:
# The default python_prepare(). A no-op.
distutils-r1_python_prepare() {
debug-print-function ${FUNCNAME} "${@}"
[[ ${EAPI} == [45] ]] || die "${FUNCNAME} is banned in EAPI 6 (it was a no-op)"
}
# @FUNCTION: distutils-r1_python_configure
# @DESCRIPTION:
# The default python_configure(). A no-op.
distutils-r1_python_configure() {
debug-print-function ${FUNCNAME} "${@}"
[[ ${EAPI} == [45] ]] || die "${FUNCNAME} is banned in EAPI 6 (it was a no-op)"
}
# @FUNCTION: _distutils-r1_create_setup_cfg
# @INTERNAL
# @DESCRIPTION:
# Create implementation-specific configuration file for distutils,
# setting proper build-dir (and install-dir) paths.
_distutils-r1_create_setup_cfg() {
cat > "${HOME}"/.pydistutils.cfg <<-_EOF_ || die
[build]
build-base = ${BUILD_DIR}
# using a single directory for them helps us export
# ${PYTHONPATH} and ebuilds find the sources independently
# of whether the package installs extensions or not
#
# note: due to some packages (wxpython) relying on separate
# platlib & purelib dirs, we do not set --build-lib (which
# can not be overridden with --build-*lib)
build-platlib = %(build-base)s/lib
build-purelib = %(build-base)s/lib
# make the ebuild writer lives easier
build-scripts = %(build-base)s/scripts
# this is needed by distutils_install_for_testing since
# setuptools like to create .egg files for install --home.
[bdist_egg]
dist-dir = ${BUILD_DIR}/dist
_EOF_
# we can't refer to ${D} before src_install()
if [[ ${EBUILD_PHASE} == install ]]; then
cat >> "${HOME}"/.pydistutils.cfg <<-_EOF_ || die
# installation paths -- allow calling extra install targets
# without the default 'install'
[install]
compile = True
optimize = 2
root = ${D%/}
_EOF_
if [[ ! ${DISTUTILS_SINGLE_IMPL} ]]; then
cat >> "${HOME}"/.pydistutils.cfg <<-_EOF_ || die
install-scripts = $(python_get_scriptdir)
_EOF_
fi
fi
}
# @FUNCTION: _distutils-r1_copy_egg_info
# @INTERNAL
# @DESCRIPTION:
# Copy egg-info files to the ${BUILD_DIR} (that's going to become
# egg-base in esetup.py). This way, we respect whatever's in upstream
# egg-info.
_distutils-r1_copy_egg_info() {
mkdir -p "${BUILD_DIR}" || die
# stupid freebsd can't do 'cp -t ${BUILD_DIR} {} +'
find -name '*.egg-info' -type d -exec cp -R -p {} "${BUILD_DIR}"/ ';' || die
}
# @FUNCTION: distutils-r1_python_compile
# @USAGE: [additional-args...]
# @DESCRIPTION:
# The default python_compile(). Runs 'esetup.py build'. Any parameters
# passed to this function will be appended to setup.py invocation,
# i.e. passed as options to the 'build' command.
#
# This phase also sets up initial setup.cfg with build directories
# and copies upstream egg-info files if supplied.
distutils-r1_python_compile() {
debug-print-function ${FUNCNAME} "${@}"
_distutils-r1_copy_egg_info
local build_args=()
# distutils is parallel-capable since py3.5
# to avoid breaking stable ebuilds, enable it only if either:
# a. we're dealing with EAPI 7
# b. we're dealing with Python 3.7 or PyPy3
if python_is_python3 && [[ ${EPYTHON} != python3.4 ]]; then
if [[ ${EAPI} != [56] || ${EPYTHON} != python3.[56] ]]; then
local jobs=$(makeopts_jobs "${MAKEOPTS}" INF)
if [[ ${jobs} == INF ]]; then
local nproc=$(get_nproc)
jobs=$(( nproc + 1 ))
fi
build_args+=( -j "${jobs}" )
fi
fi
esetup.py build "${build_args[@]}" "${@}"
}
# @FUNCTION: _distutils-r1_wrap_scripts
# @USAGE: <path> <bindir>
# @INTERNAL
# @DESCRIPTION:
# Moves and wraps all installed scripts/executables as necessary.
_distutils-r1_wrap_scripts() {
debug-print-function ${FUNCNAME} "${@}"
[[ ${#} -eq 2 ]] || die "usage: ${FUNCNAME} <path> <bindir>"
local path=${1}
local bindir=${2}
local PYTHON_SCRIPTDIR
python_export PYTHON_SCRIPTDIR
local f python_files=() non_python_files=()
if [[ -d ${path}${PYTHON_SCRIPTDIR} ]]; then
for f in "${path}${PYTHON_SCRIPTDIR}"/*; do
[[ -d ${f} ]] && die "Unexpected directory: ${f}"
debug-print "${FUNCNAME}: found executable at ${f#${path}/}"
local shebang
read -r shebang < "${f}"
if [[ ${shebang} == '#!'*${EPYTHON}* ]]; then
debug-print "${FUNCNAME}: matching shebang: ${shebang}"
python_files+=( "${f}" )
else
debug-print "${FUNCNAME}: non-matching shebang: ${shebang}"
non_python_files+=( "${f}" )
fi
mkdir -p "${path}${bindir}" || die
done
for f in "${python_files[@]}"; do
local basename=${f##*/}
debug-print "${FUNCNAME}: installing wrapper at ${bindir}/${basename}"
_python_ln_rel "${path}${EPREFIX}"/usr/lib/python-exec/python-exec2 \
"${path}${bindir}/${basename}" || die
done
for f in "${non_python_files[@]}"; do
local basename=${f##*/}
debug-print "${FUNCNAME}: moving ${f#${path}/} to ${bindir}/${basename}"
mv "${f}" "${path}${bindir}/${basename}" || die
done
fi
}
# @FUNCTION: distutils-r1_python_install
# @USAGE: [additional-args...]
# @DESCRIPTION:
# The default python_install(). Runs 'esetup.py install', doing
# intermediate root install and handling script wrapping afterwards.
# Any parameters passed to this function will be appended
# to the setup.py invocation (i.e. as options to the 'install' command).
#
# This phase updates the setup.cfg file with install directories.
distutils-r1_python_install() {
debug-print-function ${FUNCNAME} "${@}"
local args=( "${@}" )
# enable compilation for the install phase.
local -x PYTHONDONTWRITEBYTECODE=
# python likes to compile any module it sees, which triggers sandbox
# failures if some packages haven't compiled their modules yet.
addpredict "${EPREFIX}/usr/$(get_libdir)/${EPYTHON}"
addpredict /usr/lib/portage/pym
addpredict /usr/local # bug 498232
if [[ ! ${DISTUTILS_SINGLE_IMPL} ]]; then
# user may override --install-scripts
# note: this is poor but distutils argv parsing is dumb
local mydistutilsargs=( "${mydistutilsargs[@]}" )
local scriptdir=${EPREFIX}/usr/bin
# construct a list of mydistutilsargs[0] args[0] args[1]...
local arg arg_vars
[[ ${mydistutilsargs[@]} ]] && eval arg_vars+=(
'mydistutilsargs['{0..$(( ${#mydistutilsargs[@]} - 1 ))}']'
)
[[ ${args[@]} ]] && eval arg_vars+=(
'args['{0..$(( ${#args[@]} - 1 ))}']'
)
set -- "${arg_vars[@]}"
while [[ ${@} ]]; do
local arg_var=${1}
shift
local a=${!arg_var}
case "${a}" in
--install-scripts=*)
scriptdir=${a#--install-scripts=}
unset "${arg_var}"
;;
--install-scripts)
scriptdir=${!1}
unset "${arg_var}" "${1}"
shift
;;
esac
done
fi
local root=${D%/}/_${EPYTHON}
[[ ${DISTUTILS_SINGLE_IMPL} ]] && root=${D%/}
esetup.py install --root="${root}" "${args[@]}"
local forbidden_package_names=( examples test tests )
local p
for p in "${forbidden_package_names[@]}"; do
if [[ -d ${root}$(python_get_sitedir)/${p} ]]; then
die "Package installs '${p}' package which is forbidden and likely a bug in the build system."
fi
done
if [[ -d ${root}/usr/$(get_libdir)/pypy/share ]]; then
local cmd=die
[[ ${EAPI} == [45] ]] && cmd=eqawarn
"${cmd}" "Package installs 'share' in PyPy prefix, see bug #465546."
fi
if [[ ! ${DISTUTILS_SINGLE_IMPL} ]]; then
_distutils-r1_wrap_scripts "${root}" "${scriptdir}"
multibuild_merge_root "${root}" "${D%/}"
fi
}
# @FUNCTION: distutils-r1_python_install_all
# @DESCRIPTION:
# The default python_install_all(). It installs the documentation.
distutils-r1_python_install_all() {
debug-print-function ${FUNCNAME} "${@}"
einstalldocs
if declare -p EXAMPLES &>/dev/null; then
[[ ${EAPI} != [45] ]] && die "EXAMPLES are banned in EAPI ${EAPI}"
(
docinto examples
dodoc -r "${EXAMPLES[@]}"
)
docompress -x "/usr/share/doc/${PF}/examples"
fi
_DISTUTILS_DEFAULT_CALLED=1
}
# @FUNCTION: distutils-r1_run_phase
# @USAGE: [<argv>...]
# @INTERNAL
# @DESCRIPTION:
# Run the given command.
#
# If out-of-source builds are used, the phase function is run in source
# directory, with BUILD_DIR pointing at the build directory
# and PYTHONPATH having an entry for the module build directory.
#
# If in-source builds are used, the command is executed in the directory
# holding the per-implementation copy of sources. BUILD_DIR points
# to the 'build' subdirectory.
distutils-r1_run_phase() {
debug-print-function ${FUNCNAME} "${@}"
if [[ ${DISTUTILS_IN_SOURCE_BUILD} ]]; then
if [[ ! ${DISTUTILS_SINGLE_IMPL} ]]; then
cd "${BUILD_DIR}" || die
fi
local BUILD_DIR=${BUILD_DIR}/build
fi
local -x PYTHONPATH="${BUILD_DIR}/lib:${PYTHONPATH}"
# Bug 559644
# using PYTHONPATH when the ${BUILD_DIR}/lib is not created yet might lead to
# problems in setup.py scripts that try to import modules/packages from that path
# during the build process (Python at startup evaluates PYTHONPATH, if the dir is
# not valid then associates a NullImporter object to ${BUILD_DIR}/lib storing it
# in the sys.path_importer_cache)
mkdir -p "${BUILD_DIR}/lib" || die
# Set up build environment, bug #513664.
local -x AR=${AR} CC=${CC} CPP=${CPP} CXX=${CXX}
tc-export AR CC CPP CXX
# How to build Python modules in different worlds...
local ldopts
case "${CHOST}" in
# provided by haubi, 2014-07-08
*-aix*) ldopts='-shared -Wl,-berok';; # good enough
# provided by grobian, 2014-06-22, bug #513664 c7
*-darwin*) ldopts='-bundle -undefined dynamic_lookup';;
*) ldopts='-shared';;
esac
local -x LDSHARED="${CC} ${ldopts}" LDCXXSHARED="${CXX} ${ldopts}"
"${@}"
cd "${_DISTUTILS_INITIAL_CWD}" || die
}
# @FUNCTION: _distutils-r1_run_common_phase
# @USAGE: [<argv>...]
# @INTERNAL
# @DESCRIPTION:
# Run the given command, restoring the state for a most preferred Python
# implementation matching DISTUTILS_ALL_SUBPHASE_IMPLS.
#
# If in-source build is used, the command will be run in the copy
# of sources made for the selected Python interpreter.
_distutils-r1_run_common_phase() {
local DISTUTILS_ORIG_BUILD_DIR=${BUILD_DIR}
if [[ ${DISTUTILS_SINGLE_IMPL} ]]; then
# reuse the dedicated code branch
_distutils-r1_run_foreach_impl "${@}"
else
local -x EPYTHON PYTHON
local -x PATH=${PATH} PKG_CONFIG_PATH=${PKG_CONFIG_PATH}
python_setup "${DISTUTILS_ALL_SUBPHASE_IMPLS[@]}"
local MULTIBUILD_VARIANTS=( "${EPYTHON/./_}" )
# store for restoring after distutils-r1_run_phase.
local _DISTUTILS_INITIAL_CWD=${PWD}
multibuild_foreach_variant \
distutils-r1_run_phase "${@}"
fi
}
# @FUNCTION: _distutils-r1_run_foreach_impl
# @INTERNAL
# @DESCRIPTION:
# Run the given phase for each implementation if multiple implementations
# are enabled, once otherwise.
_distutils-r1_run_foreach_impl() {
debug-print-function ${FUNCNAME} "${@}"
# store for restoring after distutils-r1_run_phase.
local _DISTUTILS_INITIAL_CWD=${PWD}
set -- distutils-r1_run_phase "${@}"
if [[ ! ${DISTUTILS_SINGLE_IMPL} ]]; then
python_foreach_impl "${@}"
else
if [[ ! ${EPYTHON} ]]; then
die "EPYTHON unset, python-single-r1_pkg_setup not called?!"
fi
local BUILD_DIR=${BUILD_DIR:-${S}}
BUILD_DIR=${BUILD_DIR%%/}_${EPYTHON}
"${@}"
fi
}
distutils-r1_src_prepare() {
debug-print-function ${FUNCNAME} "${@}"
local _DISTUTILS_DEFAULT_CALLED
# common preparations
if declare -f python_prepare_all >/dev/null; then
python_prepare_all
else
distutils-r1_python_prepare_all
fi
if [[ ! ${_DISTUTILS_DEFAULT_CALLED} ]]; then
local cmd=die
[[ ${EAPI} == [45] ]] && cmd=eqawarn
"${cmd}" "QA: python_prepare_all() didn't call distutils-r1_python_prepare_all"
fi
if declare -f python_prepare >/dev/null; then
_distutils-r1_run_foreach_impl python_prepare
fi
}
distutils-r1_src_configure() {
python_export_utf8_locale
[[ ${EAPI} == [56] ]] && xdg_environment_reset # Bug 577704
if declare -f python_configure >/dev/null; then
_distutils-r1_run_foreach_impl python_configure
fi
if declare -f python_configure_all >/dev/null; then
_distutils-r1_run_common_phase python_configure_all
fi
}
distutils-r1_src_compile() {
debug-print-function ${FUNCNAME} "${@}"
if declare -f python_compile >/dev/null; then
_distutils-r1_run_foreach_impl python_compile
else
_distutils-r1_run_foreach_impl distutils-r1_python_compile
fi
if declare -f python_compile_all >/dev/null; then
_distutils-r1_run_common_phase python_compile_all
fi
}
# @FUNCTION: _distutils-r1_clean_egg_info
# @INTERNAL
# @DESCRIPTION:
# Clean up potential stray egg-info files left by setuptools test phase.
# Those files ended up being unversioned, and caused issues:
# https://bugs.gentoo.org/534058
_distutils-r1_clean_egg_info() {
rm -rf "${BUILD_DIR}"/lib/*.egg-info || die
}
distutils-r1_src_test() {
debug-print-function ${FUNCNAME} "${@}"
if declare -f python_test >/dev/null; then
_distutils-r1_run_foreach_impl python_test
_distutils-r1_run_foreach_impl _distutils-r1_clean_egg_info
fi
if declare -f python_test_all >/dev/null; then
_distutils-r1_run_common_phase python_test_all
fi
}
# @FUNCTION: _distutils-r1_check_namespace_pth
# @INTERNAL
# @DESCRIPTION:
# Check if any *-nspkg.pth files were installed (by setuptools)
# and warn about the policy non-conformance if they were.
_distutils-r1_check_namespace_pth() {
local f pth=()
while IFS= read -r -d '' f; do
pth+=( "${f}" )
done < <(find "${ED%/}" -name '*-nspkg.pth' -print0)
if [[ ${pth[@]} ]]; then
ewarn "The following *-nspkg.pth files were found installed:"
ewarn
for f in "${pth[@]}"; do
ewarn " ${f#${ED%/}}"
done
ewarn
ewarn "The presence of those files may break namespaces in Python 3.5+. Please"
ewarn "read our documentation on reliable handling of namespaces and update"
ewarn "the ebuild accordingly:"
ewarn
ewarn " https://wiki.gentoo.org/wiki/Project:Python/Namespace_packages"
fi
}
distutils-r1_src_install() {
debug-print-function ${FUNCNAME} "${@}"
if declare -f python_install >/dev/null; then
_distutils-r1_run_foreach_impl python_install
else
_distutils-r1_run_foreach_impl distutils-r1_python_install
fi
local _DISTUTILS_DEFAULT_CALLED
if declare -f python_install_all >/dev/null; then
_distutils-r1_run_common_phase python_install_all
else
_distutils-r1_run_common_phase distutils-r1_python_install_all
fi
if [[ ! ${_DISTUTILS_DEFAULT_CALLED} ]]; then
local cmd=die
[[ ${EAPI} == [45] ]] && cmd=eqawarn
"${cmd}" "QA: python_install_all() didn't call distutils-r1_python_install_all"
fi
_distutils-r1_check_namespace_pth
}
# -- distutils.eclass functions --
distutils_get_intermediate_installation_image() {
die "${FUNCNAME}() is invalid for distutils-r1"
}
distutils_src_unpack() {
die "${FUNCNAME}() is invalid for distutils-r1, and you don't want it in EAPI ${EAPI} anyway"
}
distutils_src_prepare() {
die "${FUNCNAME}() is invalid for distutils-r1, you probably want: ${FUNCNAME/_/-r1_}"
}
distutils_src_compile() {
die "${FUNCNAME}() is invalid for distutils-r1, you probably want: ${FUNCNAME/_/-r1_}"
}
distutils_src_test() {
die "${FUNCNAME}() is invalid for distutils-r1, you probably want: ${FUNCNAME/_/-r1_}"
}
distutils_src_install() {
die "${FUNCNAME}() is invalid for distutils-r1, you probably want: ${FUNCNAME/_/-r1_}"
}
distutils_pkg_postinst() {
die "${FUNCNAME}() is invalid for distutils-r1, and pkg_postinst is unnecessary"
}
distutils_pkg_postrm() {
die "${FUNCNAME}() is invalid for distutils-r1, and pkg_postrm is unnecessary"
}
_DISTUTILS_R1=1
fi
| Gentoo Eclass | 5 | NighttimeDriver50000/Sabayon-Packages | local_overlay/eclass/distutils-r1.eclass | [
"MIT"
] |
#include "script_component.hpp"
/*
Name: TFAR_fnc_canUseSWRadio
Author: NKey
Checks whether the radio would be able to be used at passed depth.
Arguments:
0: Unit <OBJECT>
1: Isolated and inside <BOOL>
2: Can Speak <BOOL>
3: Eye height ASL <NUMBER>
Return Value:
radio can be used <BOOL>
Example:
_canUseSW = [player, false, false, 10] call TFAR_fnc_canUseSWRadio;
Public: Yes
*/
params ["_player", "_isolated_and_inside", "_can_speak", "_depth"];
private _result = false;
if (_depth > 0) exitWith {true};
(_isolated_and_inside or {isAbleToBreathe _player})
| SQF | 4 | MrDj200/task-force-arma-3-radio | addons/core/functions/fnc_canUseSWRadio.sqf | [
"RSA-MD"
] |
a { value: url(\,) } | CSS | 0 | mengxy/swc | crates/swc_css_parser/tests/fixture/esbuild/misc/dCIAD8Ab98J4V9rGaJvZlw/input.css | [
"Apache-2.0"
] |
#![deny(clippy::index_refutable_slice)]
enum SomeEnum<T> {
One(T),
Two(T),
Three(T),
Four(T),
}
fn lintable_examples() {
// Try with reference
let slice: Option<&[u32]> = Some(&[1, 2, 3]);
if let Some(slice) = slice {
println!("{}", slice[0]);
}
// Try with copy
let slice: Option<[u32; 3]> = Some([1, 2, 3]);
if let Some(slice) = slice {
println!("{}", slice[0]);
}
// Try with long slice and small indices
let slice: Option<[u32; 9]> = Some([1, 2, 3, 4, 5, 6, 7, 8, 9]);
if let Some(slice) = slice {
println!("{}", slice[2]);
println!("{}", slice[0]);
}
// Multiple bindings
let slice_wrapped: SomeEnum<[u32; 3]> = SomeEnum::One([5, 6, 7]);
if let SomeEnum::One(slice) | SomeEnum::Three(slice) = slice_wrapped {
println!("{}", slice[0]);
}
// Two lintable slices in one if let
let a_wrapped: SomeEnum<[u32; 3]> = SomeEnum::One([9, 5, 1]);
let b_wrapped: Option<[u32; 2]> = Some([4, 6]);
if let (SomeEnum::Three(a), Some(b)) = (a_wrapped, b_wrapped) {
println!("{} -> {}", a[2], b[1]);
}
// This requires the slice values to be borrowed as the slice values can only be
// borrowed and `String` doesn't implement copy
let slice: Option<[String; 2]> = Some([String::from("1"), String::from("2")]);
if let Some(ref slice) = slice {
println!("{:?}", slice[1]);
}
println!("{:?}", slice);
// This should not suggest using the `ref` keyword as the scrutinee is already
// a reference
let slice: Option<[String; 2]> = Some([String::from("1"), String::from("2")]);
if let Some(slice) = &slice {
println!("{:?}", slice[0]);
}
println!("{:?}", slice);
}
fn slice_index_above_limit() {
let slice: Option<&[u32]> = Some(&[1, 2, 3]);
if let Some(slice) = slice {
// Would cause a panic, IDK
println!("{}", slice[7]);
}
}
fn slice_is_used() {
let slice: Option<&[u32]> = Some(&[1, 2, 3]);
if let Some(slice) = slice {
println!("{:?}", slice.len());
}
let slice: Option<&[u32]> = Some(&[1, 2, 3]);
if let Some(slice) = slice {
println!("{:?}", slice.to_vec());
}
let opt: Option<[String; 2]> = Some([String::from("Hello"), String::from("world")]);
if let Some(slice) = opt {
if !slice.is_empty() {
println!("first: {}", slice[0]);
}
}
}
/// The slice is used by an external function and should therefore not be linted
fn check_slice_as_arg() {
fn is_interesting<T>(slice: &[T; 2]) -> bool {
!slice.is_empty()
}
let slice_wrapped: Option<[String; 2]> = Some([String::from("Hello"), String::from("world")]);
if let Some(slice) = &slice_wrapped {
if is_interesting(slice) {
println!("This is interesting {}", slice[0]);
}
}
println!("{:?}", slice_wrapped);
}
fn check_slice_in_struct() {
#[derive(Debug)]
struct Wrapper<'a> {
inner: Option<&'a [String]>,
is_awesome: bool,
}
impl<'a> Wrapper<'a> {
fn is_super_awesome(&self) -> bool {
self.is_awesome
}
}
let inner = &[String::from("New"), String::from("World")];
let wrap = Wrapper {
inner: Some(inner),
is_awesome: true,
};
// Test 1: Field access
if let Some(slice) = wrap.inner {
if wrap.is_awesome {
println!("This is awesome! {}", slice[0]);
}
}
// Test 2: function access
if let Some(slice) = wrap.inner {
if wrap.is_super_awesome() {
println!("This is super awesome! {}", slice[0]);
}
}
println!("Complete wrap: {:?}", wrap);
}
/// This would be a nice additional feature to have in the future, but adding it
/// now would make the PR too large. This is therefore only a test that we don't
/// lint cases we can't make a reasonable suggestion for
fn mutable_slice_index() {
// Mut access
let mut slice: Option<[String; 1]> = Some([String::from("Penguin")]);
if let Some(ref mut slice) = slice {
slice[0] = String::from("Mr. Penguin");
}
println!("Use after modification: {:?}", slice);
// Mut access on reference
let mut slice: Option<[String; 1]> = Some([String::from("Cat")]);
if let Some(slice) = &mut slice {
slice[0] = String::from("Lord Meow Meow");
}
println!("Use after modification: {:?}", slice);
}
/// The lint will ignore bindings with sub patterns as it would be hard
/// to build correct suggestions for these instances :)
fn binding_with_sub_pattern() {
let slice: Option<&[u32]> = Some(&[1, 2, 3]);
if let Some(slice @ [_, _, _]) = slice {
println!("{:?}", slice[2]);
}
}
fn main() {}
| Rust | 4 | ohno418/rust | src/tools/clippy/tests/ui/index_refutable_slice/if_let_slice_binding.rs | [
"ECL-2.0",
"Apache-2.0",
"MIT-0",
"MIT"
] |
/*
* Author: Jiří Janoušek <janousek.jiri@gmail.com>
*
* To the extent possible under law, author has waived all
* copyright and related or neighboring rights to this file.
* http://creativecommons.org/publicdomain/zero/1.0/
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE FOR
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* Tests are under public domain because they might contain useful sample code.
*/
namespace Nuvola {
public class GraphicsTest: Drt.TestCase
{
public void test_dri2_get_driver_name()
{
try
{
var name = Graphics.dri2_get_driver_name();
expect_false(Drt.String.is_empty(name), "driver name not empty");
}
catch (Graphics.DriError e)
{
if (!(e is Graphics.DriError.NO_X_DISPLAY))
unexpected_error(e, "Only Graphics.DriError.NO_X_DISPLAY allowed.");
}
}
public void test_have_vdpau_driver()
{
var name = "i965";
var result = Graphics.have_vdpau_driver(name);
var expected = FileUtils.test("/usr/lib/vdpau/libvdpau_i965.so", FileTest.EXISTS)
|| FileUtils.test("/app/lib/vdpau/libvdpau_i965.so", FileTest.EXISTS);
expect_true(expected == result, "have vdpau driver");
}
public void test_have_vaapi_driver()
{
var name = "i965";
var result = Graphics.have_vaapi_driver(name);
var expected = FileUtils.test("/usr/lib/drv/i965_drv_video.so", FileTest.EXISTS)
|| FileUtils.test("/app/lib/dri/i965_drv_video.so", FileTest.EXISTS);
expect_true(expected == result, "have vaapi driver");
}
#if FLATPAK
public void test_have_vdpau_drivers()
{
string[] names = {"i965", "i915", "r300", "r600", "radeon", "radeonsi", "nouveau"};
foreach (var name in names)
expect_true(Graphics.have_vdpau_driver(name), @"VDPAU: $name");
}
public void test_have_vaapi_drivers()
{
string[] names = {"i965", "i915", "r300", "r600", "radeon", "radeonsi", "nouveau"};
foreach (var name in names)
expect_true(Graphics.have_vaapi_driver(name), @"VA-API: $name");
}
#endif
}
} // namespace Nuvola
| Vala | 4 | xcffl/nuvolaruntime | src/tests/GraphicsTest.vala | [
"BSD-2-Clause"
] |
using AMQPClient
const VIRTUALHOST = "/"
const HOST = "127.0.0.1"
function receive()
# 1. Create a connection to the localhost or 127.0.0.1 of virtualhost '/'
connection(; virtualhost=VIRTUALHOST, host=HOST) do conn
# 2. Create a channel to send messages
channel(conn, AMQPClient.UNUSED_CHANNEL, true) do chan
# 3. Declare a exchange
exchange = "logs"
exchange_declare(chan, exchange, EXCHANGE_TYPE_FANOUT)
result, queue, _, _ = queue_declare(chan, "", durable=true)
# 4. Bind the queue
queue_bind(chan, queue, exchange, EXCHANGE_TYPE_FANOUT)
println(" [*] Waiting for messages. To exit press CTRL+C")
on_receive = (msg) -> begin
data = String(msg.data)
println("Received the message: $data")
basic_ack(chan, msg.delivery_tag)
end
success, consumer_tag = basic_consume(chan, queue, on_receive)
while true
sleep(1)
end
end
end
end
# Don't exit on Ctrl-C
Base.exit_on_sigint(false)
try
receive()
catch ex
if ex isa InterruptException
println("Interrupted")
else
println("Exception: $ex")
end
end
| Julia | 5 | muhammadali8767/rabbit_php | julia/receive_logs.jl | [
"Apache-2.0"
] |
<template>
<app-ad
class="v-app-ad--sponsored"
compact
max-width="512"
v-bind="$attrs"
>
<v-hover>
<template #default="{ hover }">
<a v-bind="adAttrs">
<v-sheet
class="overflow-none position-relative d-flex px-4 py-2 align-center"
color="transparent"
rounded
width="512"
>
<v-overlay
:color="color"
:opacity="hover ? .15 : .1"
absolute
/>
<v-icon
:color="color"
class="mr-3"
x-large
v-text="icon"
/>
<div
:class="dcolor"
class="text-subtitle-2 text-sm-subtitle-1 font-weight-medium"
v-text="current.metadata.description"
/>
</v-sheet>
</a>
</template>
</v-hover>
</app-ad>
</template>
<script>
// Mixins
import Ad from '@/mixins/ad'
export default {
name: 'SponsoredAd',
mixins: [Ad],
data: () => ({
color: 'light-blue darken-4',
dcolor: 'light-blue--text text--darken-4',
}),
computed: {
icon () {
return this.current.metadata.type === 'Video'
? '$mdiPlayCircle'
: '$mdiVuetify'
},
},
}
</script>
| Vue | 4 | mark-gene/vuetify | packages/docs/src/components/ad/Sponsored.vue | [
"MIT"
] |
label.string.required.col-xs-8.control-label for="two_factor_otp"
abbr == "* "
span = t('two_factors.auth.google_app')
.col-xs-14
.input-group style="width:100%;"
input.two_factor_auth_type type="hidden" name="two_factor[type]" value="app"
input.string.required.form-control id="two_factor_otp" name="two_factor[otp]" placeholder=t('two_factors.auth.otp_placeholder')
span.hint.app = t('two_factors.auth.hints.app')
.captcha-wrap
| Slim | 3 | gsmlg/peatio | app/views/shared/_two_factor_app.html.slim | [
"MIT"
] |
"""Component to interface with locks that can be controlled remotely."""
from __future__ import annotations
from dataclasses import dataclass
from datetime import timedelta
from enum import IntEnum
import functools as ft
import logging
from typing import Any, final
import voluptuous as vol
from homeassistant.config_entries import ConfigEntry
from homeassistant.const import (
ATTR_CODE,
ATTR_CODE_FORMAT,
SERVICE_LOCK,
SERVICE_OPEN,
SERVICE_UNLOCK,
STATE_JAMMED,
STATE_LOCKED,
STATE_LOCKING,
STATE_UNLOCKED,
STATE_UNLOCKING,
)
from homeassistant.core import HomeAssistant
import homeassistant.helpers.config_validation as cv
from homeassistant.helpers.config_validation import ( # noqa: F401
PLATFORM_SCHEMA,
PLATFORM_SCHEMA_BASE,
make_entity_service_schema,
)
from homeassistant.helpers.entity import Entity, EntityDescription
from homeassistant.helpers.entity_component import EntityComponent
from homeassistant.helpers.typing import ConfigType, StateType
_LOGGER = logging.getLogger(__name__)
ATTR_CHANGED_BY = "changed_by"
DOMAIN = "lock"
SCAN_INTERVAL = timedelta(seconds=30)
ENTITY_ID_FORMAT = DOMAIN + ".{}"
MIN_TIME_BETWEEN_SCANS = timedelta(seconds=10)
LOCK_SERVICE_SCHEMA = make_entity_service_schema({vol.Optional(ATTR_CODE): cv.string})
class LockEntityFeature(IntEnum):
"""Supported features of the lock entity."""
OPEN = 1
# The SUPPORT_OPEN constant is deprecated as of Home Assistant 2022.5.
# Please use the LockEntityFeature enum instead.
SUPPORT_OPEN = 1
PROP_TO_ATTR = {"changed_by": ATTR_CHANGED_BY, "code_format": ATTR_CODE_FORMAT}
async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool:
"""Track states and offer events for locks."""
component = hass.data[DOMAIN] = EntityComponent(
_LOGGER, DOMAIN, hass, SCAN_INTERVAL
)
await component.async_setup(config)
component.async_register_entity_service(
SERVICE_UNLOCK, LOCK_SERVICE_SCHEMA, "async_unlock"
)
component.async_register_entity_service(
SERVICE_LOCK, LOCK_SERVICE_SCHEMA, "async_lock"
)
component.async_register_entity_service(
SERVICE_OPEN, LOCK_SERVICE_SCHEMA, "async_open"
)
return True
async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
"""Set up a config entry."""
component: EntityComponent = hass.data[DOMAIN]
return await component.async_setup_entry(entry)
async def async_unload_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
"""Unload a config entry."""
component: EntityComponent = hass.data[DOMAIN]
return await component.async_unload_entry(entry)
@dataclass
class LockEntityDescription(EntityDescription):
"""A class that describes lock entities."""
class LockEntity(Entity):
"""Base class for lock entities."""
entity_description: LockEntityDescription
_attr_changed_by: str | None = None
_attr_code_format: str | None = None
_attr_is_locked: bool | None = None
_attr_is_locking: bool | None = None
_attr_is_unlocking: bool | None = None
_attr_is_jammed: bool | None = None
_attr_state: None = None
@property
def changed_by(self) -> str | None:
"""Last change triggered by."""
return self._attr_changed_by
@property
def code_format(self) -> str | None:
"""Regex for code format or None if no code is required."""
return self._attr_code_format
@property
def is_locked(self) -> bool | None:
"""Return true if the lock is locked."""
return self._attr_is_locked
@property
def is_locking(self) -> bool | None:
"""Return true if the lock is locking."""
return self._attr_is_locking
@property
def is_unlocking(self) -> bool | None:
"""Return true if the lock is unlocking."""
return self._attr_is_unlocking
@property
def is_jammed(self) -> bool | None:
"""Return true if the lock is jammed (incomplete locking)."""
return self._attr_is_jammed
def lock(self, **kwargs: Any) -> None:
"""Lock the lock."""
raise NotImplementedError()
async def async_lock(self, **kwargs: Any) -> None:
"""Lock the lock."""
await self.hass.async_add_executor_job(ft.partial(self.lock, **kwargs))
def unlock(self, **kwargs: Any) -> None:
"""Unlock the lock."""
raise NotImplementedError()
async def async_unlock(self, **kwargs: Any) -> None:
"""Unlock the lock."""
await self.hass.async_add_executor_job(ft.partial(self.unlock, **kwargs))
def open(self, **kwargs: Any) -> None:
"""Open the door latch."""
raise NotImplementedError()
async def async_open(self, **kwargs: Any) -> None:
"""Open the door latch."""
await self.hass.async_add_executor_job(ft.partial(self.open, **kwargs))
@final
@property
def state_attributes(self) -> dict[str, StateType]:
"""Return the state attributes."""
state_attr = {}
for prop, attr in PROP_TO_ATTR.items():
if (value := getattr(self, prop)) is not None:
state_attr[attr] = value
return state_attr
@final
@property
def state(self) -> str | None:
"""Return the state."""
if self.is_jammed:
return STATE_JAMMED
if self.is_locking:
return STATE_LOCKING
if self.is_unlocking:
return STATE_UNLOCKING
if (locked := self.is_locked) is None:
return None
return STATE_LOCKED if locked else STATE_UNLOCKED
| Python | 5 | mtarjoianu/core | homeassistant/components/lock/__init__.py | [
"Apache-2.0"
] |
.syntax--comment {
color: @syntax-comment-color;
font-style: italic;
.syntax--markup.syntax--link {
color: @syntax-comment-color;
}
}
.syntax--string {
color: @cyan;
&.syntax--regexp {
color: @red;
}
}
.syntax--constant {
&.syntax--numeric {
color: @magenta;
}
&.syntax--language {
color: @yellow;
}
&.syntax--character,
&.syntax--other,
&.syntax--support {
color: @orange;
}
}
.syntax--variable {
color: @blue;
}
.syntax--keyword {
color: @green;
}
.syntax--storage {
color: @green;
}
.syntax--meta.syntax--class {
color: @blue;
}
.syntax--entity {
&.syntax--name {
&.syntax--class,
&.syntax--function,
&.syntax--section,
&.syntax--type {
color: @blue;
}
}
&.syntax--other.syntax--attribute-name {
color: @syntax-subtle-color;
}
}
.syntax--support {
&.syntax--function {
color: @blue;
&.syntax--builtin {
color: @green;
}
}
&.syntax--type,
&.syntax--class {
color: @green;
}
}
.syntax--tag {
&.syntax--entity.syntax--name {
color: @blue;
}
&.syntax--punctuation.syntax--definition {
&.syntax--html,
&.syntax--begin,
&.syntax--end {
color: @syntax-comment-color;
}
}
}
.syntax--invalid {
&.syntax--deprecated {
color: @yellow;
text-decoration: underline;
}
&.syntax--illegal {
color: @red;
text-decoration: underline;
}
}
.syntax--none {
color: @syntax-text-color;
}
| Less | 2 | davidbertsch/atom | packages/solarized-light-syntax/styles/syntax/_base.less | [
"MIT"
] |
(*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*)
(* Define SSA form and the concept of variable liveness, and then show how SSA
* simplifies it *)
open HolKernel boolLib bossLib Parse;
open pred_setTheory listTheory rich_listTheory pairTheory arithmeticTheory;
open alistTheory set_relationTheory;
open settingsTheory miscTheory llvmTheory llvm_propTheory;
new_theory "llvm_ssa";
numLib.prefer_num ();
(* ----- The syntactic things we need to know about a program, just for this file ---- *)
Definition loc_prog_ok_def:
loc_prog_ok p ⇔
(∀fname dec bname block.
alookup p fname = Some dec ∧
alookup dec.blocks bname = Some block ⇒
block.body ≠ [] ∧ terminator (last block.body) ∧
every (λi. ~terminator i) (front block.body)) ∧
(∀fname dec.
alookup p fname = Some dec ⇒
every (λb. fst b = None ⇔ (snd b).h = Entry) dec.blocks) ∧
(every (\(fname, dec). all_distinct (map fst dec.blocks)) p)
End
(* ----- Static paths through a program ----- *)
Definition inc_pc_def:
inc_pc ip = ip with i := inc_bip ip.i
End
(* The set of program counters the given instruction and starting point can
* immediately reach, within a function *)
Definition instr_next_ips_def:
(instr_next_ips (Ret _) ip = {}) ∧
(instr_next_ips (Br _ l1 l2) ip =
{ <| f := ip.f; b := Some l; i := Phi_ip ip.b |> | l | l ∈ {l1; l2} }) ∧
(instr_next_ips (Invoke _ _ _ _ l1 l2) ip =
{ <| f := ip.f; b := Some l; i := Phi_ip ip.b |> | l | l ∈ {l1; l2} }) ∧
(instr_next_ips Unreachable ip = {}) ∧
(instr_next_ips (Exit _) ip = {}) ∧
(instr_next_ips (Sub _ _ _ _ _ _) ip = { inc_pc ip }) ∧
(instr_next_ips (Extractvalue _ _ _) ip = { inc_pc ip }) ∧
(instr_next_ips (Insertvalue _ _ _ _) ip = { inc_pc ip }) ∧
(instr_next_ips (Alloca _ _ _) ip = { inc_pc ip }) ∧
(instr_next_ips (Load _ _ _) ip = { inc_pc ip }) ∧
(instr_next_ips (Store _ _) ip = { inc_pc ip }) ∧
(instr_next_ips (Gep _ _ _ _) ip = { inc_pc ip }) ∧
(instr_next_ips (Cast _ _ _ _) ip = { inc_pc ip }) ∧
(instr_next_ips (Icmp _ _ _ _ _) ip = { inc_pc ip }) ∧
(instr_next_ips (Call _ _ _ _) ip = { inc_pc ip }) ∧
(instr_next_ips (Cxa_allocate_exn _ _) ip = { inc_pc ip }) ∧
(* TODO: revisit throw when dealing with exceptions *)
(instr_next_ips (Cxa_throw _ _ _) ip = { }) ∧
(instr_next_ips (Cxa_begin_catch _ _) ip = { inc_pc ip }) ∧
(instr_next_ips (Cxa_end_catch) ip = { inc_pc ip }) ∧
(instr_next_ips (Cxa_get_exception_ptr _ _) ip = { inc_pc ip })
End
Inductive next_ips:
(∀prog ip i l i2.
get_instr prog ip (Inl i) ∧
l ∈ instr_next_ips i ip ∧
get_instr prog l i2
⇒
next_ips prog ip l) ∧
(∀prog ip from_l phis i2.
get_instr prog ip (Inr (from_l, phis)) ∧
get_instr prog (inc_pc ip) i2
⇒
next_ips prog ip (inc_pc ip))
End
(* The path is a list of program counters that represent a statically feasible
* path through a function *)
Inductive good_path:
(∀prog. good_path prog []) ∧
(∀prog ip i.
get_instr prog ip i
⇒
good_path prog [ip]) ∧
(∀prog path ip1 ip2.
ip2 ∈ next_ips prog ip1 ∧
good_path prog (ip2::path)
⇒
good_path prog (ip1::ip2::path))
End
Theorem next_ips_same_func:
∀prog ip1 ip2. ip2 ∈ next_ips prog ip1 ⇒ ip1.f = ip2.f
Proof
rw [next_ips_cases, IN_DEF, get_instr_cases, inc_pc_def, inc_bip_def] >> rw [] >>
Cases_on `el idx b.body` >> fs [instr_next_ips_def, inc_pc_def, inc_bip_def]
QED
Theorem good_path_same_func:
∀prog path. good_path prog path ⇒ ∀ip1 ip2. mem ip1 path ∧ mem ip2 path ⇒ ip1.f = ip2.f
Proof
ho_match_mp_tac good_path_ind >> rw [] >>
metis_tac [next_ips_same_func]
QED
Theorem good_path_prefix:
∀prog path path'. good_path prog path ∧ path' ≼ path ⇒ good_path prog path'
Proof
Induct_on `path'` >> rw []
>- simp [Once good_path_cases] >>
pop_assum mp_tac >> CASE_TAC >> rw [] >>
qpat_x_assum `good_path _ _` mp_tac >>
simp [Once good_path_cases] >> rw [] >> fs []
>- (simp [Once good_path_cases] >> metis_tac []) >>
first_x_assum drule >> rw [] >>
simp [Once good_path_cases] >>
Cases_on `path'` >> fs [next_ips_cases, IN_DEF] >>
metis_tac []
QED
Theorem good_path_append:
!prog p1 p2.
good_path prog (p1++p2) ⇔
good_path prog p1 ∧ good_path prog p2 ∧
(p1 ≠ [] ∧ p2 ≠ [] ⇒ HD p2 ∈ next_ips prog (last p1))
Proof
Induct_on `p1` >> rw []
>- metis_tac [good_path_rules] >>
Cases_on `p1` >> Cases_on `p2` >> rw []
>- metis_tac [good_path_rules]
>- (
simp [Once good_path_cases] >>
metis_tac [good_path_rules, next_ips_cases, IN_DEF])
>- metis_tac [good_path_rules] >>
rename1 `ip1::ip2::(ips1++ip3::ips2)` >>
first_x_assum (qspecl_then [`prog`, `[ip3]++ips2`] mp_tac) >>
rw [] >> simp [Once good_path_cases, LAST_DEF] >> rw [] >>
eq_tac >> rw []
>- metis_tac [good_path_rules]
>- (qpat_x_assum `good_path _ [_;_]` mp_tac >> simp [Once good_path_cases])
>- metis_tac [good_path_rules, next_ips_cases, IN_DEF]
>- metis_tac [good_path_rules]
>- (qpat_x_assum `good_path _ (ip1::ip2::ips1)` mp_tac >> simp [Once good_path_cases])
>- (qpat_x_assum `good_path _ (ip1::ip2::ips1)` mp_tac >> simp [Once good_path_cases])
QED
(* ----- Helper functions to get registers out of instructions ----- *)
Definition arg_to_regs_def:
(arg_to_regs (Constant _) = {}) ∧
(arg_to_regs (Variable r) = {r})
End
(* The registers that an instruction uses *)
Definition instr_uses_def:
(instr_uses (Ret (_, a)) = arg_to_regs a) ∧
(instr_uses (Br a _ _) = arg_to_regs a) ∧
(instr_uses (Invoke _ _ a targs _ _) =
arg_to_regs a ∪ BIGUNION (set (map (arg_to_regs o snd) targs))) ∧
(instr_uses Unreachable = {}) ∧
(instr_uses (Exit a) = arg_to_regs a) ∧
(instr_uses (Sub _ _ _ _ a1 a2) =
arg_to_regs a1 ∪ arg_to_regs a2) ∧
(instr_uses (Extractvalue _ (_, a) _) = arg_to_regs a) ∧
(instr_uses (Insertvalue _ (_, a1) (_, a2) _) =
arg_to_regs a1 ∪ arg_to_regs a2) ∧
(instr_uses (Alloca _ _ (_, a)) = arg_to_regs a) ∧
(instr_uses (Load _ _ (_, a)) = arg_to_regs a) ∧
(instr_uses (Store (_, a1) (_, a2)) =
arg_to_regs a1 ∪ arg_to_regs a2) ∧
(instr_uses (Gep _ _ (_, a) targs) =
arg_to_regs a ∪ BIGUNION (set (map (arg_to_regs o snd) targs))) ∧
(instr_uses (Cast _ _ (_, a) _) = arg_to_regs a) ∧
(instr_uses (Icmp _ _ _ a1 a2) =
arg_to_regs a1 ∪ arg_to_regs a2) ∧
(instr_uses (Call _ _ _ targs) =
BIGUNION (set (map (arg_to_regs o snd) targs))) ∧
(instr_uses (Cxa_allocate_exn _ a) = arg_to_regs a) ∧
(instr_uses (Cxa_throw a1 a2 a3) =
arg_to_regs a1 ∪ arg_to_regs a2 ∪ arg_to_regs a3) ∧
(instr_uses (Cxa_begin_catch _ a) = arg_to_regs a) ∧
(instr_uses (Cxa_end_catch) = { }) ∧
(instr_uses (Cxa_get_exception_ptr _ a) = arg_to_regs a)
End
Definition phi_uses_def:
phi_uses from_l (Phi _ _ entries) =
case alookup entries from_l of
| None => {}
| Some a => arg_to_regs a
End
Inductive uses:
(∀prog ip i r.
get_instr prog ip (Inl i) ∧
r ∈ instr_uses i
⇒
uses prog ip r) ∧
(∀prog ip from_l phis r.
get_instr prog ip (Inr (from_l, phis)) ∧
r ∈ BIGUNION (set (map (phi_uses from_l) phis))
⇒
uses prog ip r)
End
Definition cidx_to_num_def:
(cidx_to_num (IntC _ n) = Num (ABS n)) ∧
(cidx_to_num _ = 0)
End
(* Convert index lists as for GEP into number lists, for the purpose of
* calculating types. Everything goes to 0 but for positive integer constants,
* because those things can't be used to index anything but arrays, and the type
* for the array contents doesn't depend on the index's value. *)
Definition idx_to_num_def:
(idx_to_num (_, (Constant (IntC _ n))) = Num (ABS n)) ∧
(idx_to_num (_, _) = 0)
End
(* The registers that an instruction assigns *)
Definition instr_assigns_def:
(instr_assigns (Invoke r t _ _ _ _) = {(r,t)}) ∧
(instr_assigns (Sub r _ _ t _ _) = {(r,t)}) ∧
(instr_assigns (Extractvalue r (t,_) idx) = {(r,THE (extract_type t (map cidx_to_num idx)))}) ∧
(instr_assigns (Insertvalue r (t,_) _ _) = {(r, t)}) ∧
(instr_assigns (Alloca r t _) = {(r,PtrT t)}) ∧
(instr_assigns (Load r t _) = {(r,t)}) ∧
(instr_assigns (Gep r t _ idx) = {(r,PtrT (THE (extract_type t (map idx_to_num idx))))}) ∧
(instr_assigns (Cast r _ _ t) = {(r,t)}) ∧
(instr_assigns (Icmp r _ _ _ _) = {(r, IntT W1)}) ∧
(instr_assigns (Call r t _ _) = {(r,t)}) ∧
(instr_assigns (Cxa_allocate_exn r _) = {(r,ARB)}) ∧
(instr_assigns (Cxa_begin_catch r _) = {(r,ARB)}) ∧
(instr_assigns (Cxa_get_exception_ptr r _) = {(r,ARB)}) ∧
(instr_assigns _ = {})
End
Definition phi_assigns_def:
phi_assigns (Phi r t _) = (r,t)
End
Inductive assigns:
(∀prog ip i r.
get_instr prog ip (Inl i) ∧
r ∈ instr_assigns i
⇒
assigns prog ip r) ∧
(∀prog ip from_l phis r.
get_instr prog ip (Inr (from_l, phis)) ∧
r ∈ set (map phi_assigns phis)
⇒
assigns prog ip r)
End
(* ----- SSA form ----- *)
Definition entry_ip_def:
entry_ip fname = <| f := fname; b := None; i := Offset 0 |>
End
(* Equivalent instruction pointers, since we don't want to distinguish pointers
* to headers that have different from labels *)
Definition ip_equiv_def:
ip_equiv ip1 ip2 ⇔
ip1.f = ip2.f ∧ ip1.b = ip2.b ∧
(ip1.i ≠ ip2.i ⇒ ∃l1 l2. ip1.i = Phi_ip l1 ∧ ip2.i = Phi_ip l2)
End
Definition reachable_def:
reachable prog ip ⇔
∃path. good_path prog (entry_ip ip.f :: path) ∧ ip_equiv (last (entry_ip ip.f :: path)) ip
End
(* To get to ip2 from the entry, you must go through ip1 *)
Definition dominates_def:
dominates prog ip1 ip2 ⇔
∀path.
good_path prog (entry_ip ip2.f :: path) ∧
ip_equiv (last (entry_ip ip2.f :: path)) ip2 ⇒
∃ip1'. ip_equiv ip1 ip1' ∧ mem ip1' (front (entry_ip ip2.f :: path))
End
Definition is_ssa_def:
is_ssa prog ⇔
(* Operate function by function *)
(∀fname.
(* No register is assigned in two different instructions *)
(∀r ip1 ip2.
r ∈ image fst (assigns prog ip1) ∧ r ∈ image fst (assigns prog ip2) ∧
ip1.f = fname ∧ ip2.f = fname
⇒
ip_equiv ip1 ip2)) ∧
(* Each use is dominated by its assignment *)
(∀ip1 r. r ∈ uses prog ip1 ⇒
∃ip2. ip2.f = ip1.f ∧ r ∈ image fst (assigns prog ip2) ∧ dominates prog ip2 ip1) ∧
(* All of the blocks are reachable. Otherwise, we could have dead code that
* violates SSA, and this will wreck our treatment of a function body as a
* list of blocks in dominator tree order *)
(∀ip i. get_instr prog ip i ⇒ reachable prog ip)
End
Theorem ip_equiv_sym:
∀ip1 ip2. ip_equiv ip1 ip2 ⇔ ip_equiv ip2 ip1
Proof
rw [ip_equiv_def] >> metis_tac []
QED
Theorem ip_equiv_refl:
∀ip. ip_equiv ip ip
Proof
rw [ip_equiv_def]
QED
Theorem ip_equiv_trans:
∀ip1 ip2 ip3. ip_equiv ip1 ip2 ∧ ip_equiv ip2 ip3 ⇒ ip_equiv ip1 ip3
Proof
rw [ip_equiv_def] >> metis_tac []
QED
Theorem ip_equiv_assigns:
∀prog ip1 ip2 rt.
ip_equiv ip1 ip2 ∧ rt ∈ assigns prog ip1 ⇒ rt ∈ assigns prog ip2
Proof
rw [ip_equiv_def, assigns_cases, IN_DEF] >>
Cases_on `ip1 = ip2` >> rw []
>- metis_tac []
>- (fs [pc_component_equality] >> fs [get_instr_cases] >> fs [])
>- metis_tac []
>- (
fs [pc_component_equality] >>
fs [get_instr_cases, inc_pc_def, inc_bip_def, PULL_EXISTS] >>
rw [] >> rfs [inc_bip_def] >>
metis_tac [optionTheory.SOME_11])
QED
Theorem ip_equiv_next:
∀prog ip1 ip2 ip3.
ip_equiv ip1 ip2 ∧ ip3 ∈ next_ips prog ip1 ⇒
ip3 ∈ next_ips prog ip2
Proof
rw [ip_equiv_def, next_ips_cases, IN_DEF] >>
Cases_on `ip1 = ip2` >> rw []
>- metis_tac []
>- (fs [pc_component_equality] >> fs [get_instr_cases] >> fs [])
>- metis_tac []
>- (
fs [pc_component_equality] >>
fs [get_instr_cases, inc_pc_def, inc_bip_def, PULL_EXISTS] >>
rw [] >> rfs [inc_bip_def] >>
metis_tac [optionTheory.SOME_11])
QED
Theorem ip_equiv_dominates:
∀prog ip1 ip2 ip3.
dominates prog ip1 ip2 ∧ ip_equiv ip2 ip3 ⇒ dominates prog ip1 ip3
Proof
rw [dominates_def] >> metis_tac [ip_equiv_def]
QED
Theorem ip_equiv_dominates2:
∀prog ip1 ip2 ip3.
dominates prog ip1 ip2 ∧ ip_equiv ip1 ip3 ⇒ dominates prog ip3 ip2
Proof
rw [dominates_def] >> metis_tac [ip_equiv_def]
QED
Theorem ip_equiv_next_ips:
∀p i ip1 ip2. ip_equiv ip1 ip2 ∧ i ∈ next_ips p ip1 ⇒ i ∈ next_ips p ip2
Proof
rw [ip_equiv_def] >>
Cases_on `ip1.i = ip2.i`
>- metis_tac [pc_component_equality] >>
fs [] >> rw [] >> rfs [] >>
fs [next_ips_cases, IN_DEF, inc_pc_def, inc_bip_def] >>
fs [get_instr_cases] >> rw [] >> fs [] >>
rw [pc_component_equality, PULL_EXISTS] >>
rfs [] >> rw [] >> fs [inc_bip_def]
QED
Theorem dominates_trans:
∀prog ip1 ip2 ip3.
dominates prog ip1 ip2 ∧ dominates prog ip2 ip3 ⇒ dominates prog ip1 ip3
Proof
rw [dominates_def] >> simp [FRONT_DEF] >> rw []
>- (first_x_assum (qspec_then `[]` mp_tac) >> rw []) >>
first_x_assum drule >> rw [] >>
qpat_x_assum `mem _ (front _)` mp_tac >>
simp [Once MEM_EL] >> rw [] >> fs [EL_FRONT] >>
first_x_assum (qspec_then `take n path` mp_tac) >> simp [LAST_DEF] >>
simp [Once ip_equiv_sym] >>
rw [] >> fs [entry_ip_def]
>- (
fs [Once good_path_cases, ip_equiv_def] >> rw [] >>
fs [next_ips_cases, IN_DEF] >> metis_tac [])
>- (
fs [Once good_path_cases, ip_equiv_def] >> rw [] >>
fs [next_ips_cases, IN_DEF] >> metis_tac []) >>
rfs [EL_CONS] >>
`?m. n = Suc m` by (Cases_on `n` >> rw []) >>
rw [] >> rfs [] >>
`(el m path).f = (last (<|f := ip3.f; b := None; i := Offset 0|> ::path)).f`
by (
irule good_path_same_func >>
qexists_tac `<| f:= ip3.f; b := NONE; i := Offset 0|> :: path` >>
qexists_tac `prog` >>
conj_tac >- rw [EL_MEM] >>
metis_tac [MEM_LAST]) >>
`(el m path).f = ip3.f` by metis_tac [ip_equiv_def] >>
fs [] >> qpat_x_assum `_ ⇒ _` mp_tac >> impl_tac
>- (
irule good_path_prefix >> HINT_EXISTS_TAC >> rw [] >>
metis_tac [take_is_prefix, ip_equiv_def]) >>
rw [] >> drule MEM_FRONT >> rw []
>- (qexists_tac `<|f := ip3.f; b := None; i := Offset 0|>` >> fs [ip_equiv_def]) >>
fs [MEM_EL, LENGTH_FRONT] >> rfs [EL_TAKE] >> rw [] >>
HINT_EXISTS_TAC >> rw [] >>
disj2_tac >> qexists_tac `n'` >> rw [] >>
irule (GSYM EL_FRONT) >>
rw [NULL_EQ, LENGTH_FRONT]
QED
Theorem dominates_unreachable:
∀prog ip1 ip2. ¬reachable prog ip2 ⇒ dominates prog ip1 ip2
Proof
rw [dominates_def, reachable_def] >>
metis_tac []
QED
Theorem dominates_antisym_lem:
∀prog ip1 ip2. dominates prog ip1 ip2 ∧ dominates prog ip2 ip1 ⇒ ¬reachable prog ip1
Proof
rw [dominates_def, reachable_def] >> CCONTR_TAC >> fs [] >>
Cases_on `ip_equiv ip1 (entry_ip ip1.f)` >> fs []
>- (
first_x_assum (qspec_then `[]` mp_tac) >> rw [] >>
fs [Once good_path_cases, IN_DEF, next_ips_cases] >>
metis_tac [ip_equiv_sym]) >>
`path ≠ []` by (Cases_on `path` >> fs [] >> metis_tac [ip_equiv_sym]) >>
`(OLEAST n. n < length path ∧ ip_equiv (el n path) ip1) ≠ None`
by (
rw [whileTheory.OLEAST_EQ_NONE] >>
qexists_tac `PRE (length path)` >> rw [] >>
fs [LAST_DEF, LAST_EL] >>
Cases_on `path` >> fs []) >>
qabbrev_tac `path1 = splitAtPki (\n ip. ip_equiv ip ip1) (\x y. x++[HD y]) path` >>
first_x_assum (qspec_then `path1` mp_tac) >>
simp [] >>
`IS_PREFIX path path1`
by (
unabbrev_all_tac >> rw [splitAtPki_EQN] >>
CASE_TAC >> rw [] >>
fs [whileTheory.OLEAST_EQ_SOME] >>
rw [GSYM SNOC_APPEND, SNOC_EL_TAKE, HD_DROP] >>
metis_tac [take_is_prefix]) >>
conj_asm1_tac >> rw []
>- (irule good_path_prefix >> HINT_EXISTS_TAC >> rw [])
>- (
unabbrev_all_tac >> rw [splitAtPki_EQN] >>
CASE_TAC >> rw [] >>
fs [whileTheory.OLEAST_EQ_SOME] >>
rw [LAST_DEF, HD_DROP]) >>
`path1 ≠ []`
by (fs [Abbr `path1`, splitAtPki_EQN] >> CASE_TAC >> rw []) >>
simp [GSYM SNOC_APPEND, FRONT_SNOC, FRONT_DEF] >>
CCONTR_TAC >> fs [MEM_EL]
>- (
first_x_assum (qspec_then `[]` mp_tac) >>
fs [entry_ip_def, Once good_path_cases, IN_DEF, next_ips_cases] >>
fs [ip_equiv_def] >>
metis_tac []) >>
rw [] >> rfs [] >>
rename [`n1 < length (front _)`, `ip_equiv (el n _) _`,
`ip_equiv _ (el n1 (front _))`] >>
first_x_assum (qspec_then `take (Suc n1) path1` mp_tac) >> rw []
>- (
irule good_path_prefix >> HINT_EXISTS_TAC >> rw [entry_ip_def]
>- (
`(el n1 (front path1)).f = (entry_ip ip1.f).f` suffices_by fs [ip_equiv_def, entry_ip_def] >>
irule good_path_same_func >>
qexists_tac `entry_ip ip1.f::path1` >>
qexists_tac `prog` >> rw [EL_MEM, entry_ip_def] >>
rw [MEM_EL] >> disj2_tac >>
qexists_tac `n1` >> rw [] >> rfs [LENGTH_FRONT] >>
irule EL_FRONT >> rw [NULL_EQ, LENGTH_FRONT]) >>
metis_tac [IS_PREFIX_APPEND3, take_is_prefix, IS_PREFIX_TRANS])
>- (
rfs [LENGTH_FRONT] >> rw [LAST_DEF] >>
metis_tac [EL_FRONT, NULL_EQ, ip_equiv_sym, LENGTH_FRONT]) >>
rw [METIS_PROVE [] ``~x ∨ y ⇔ (x ⇒ y)``] >>
simp [EL_FRONT] >>
rfs [LENGTH_TAKE, LENGTH_FRONT] >>
rename [`n2 < Suc _`] >>
Cases_on `¬(0 < n2)` >> rw [EL_CONS]
>- (fs [entry_ip_def] >> CCONTR_TAC >> fs [] >> fs [ip_equiv_def]) >>
fs [EL_TAKE, Abbr `path1`, splitAtPki_EQN] >>
CASE_TAC >> rw [] >> fs []
>- metis_tac [] >>
fs [whileTheory.OLEAST_EQ_SOME] >>
rfs [LENGTH_TAKE] >>
`PRE n2 < x` by decide_tac >>
first_x_assum drule >>
rfs [HD_DROP, LAST_DEF] >>
rw [EL_TAKE, EL_APPEND_EQN] >>
metis_tac [ip_equiv_sym]
QED
Theorem dominates_antisym:
∀prog ip1 ip2. reachable prog ip1 ∧ dominates prog ip1 ip2 ⇒ ¬dominates prog ip2 ip1
Proof
metis_tac [dominates_antisym_lem]
QED
Theorem dominates_irrefl:
∀prog ip. reachable prog ip ⇒ ¬dominates prog ip ip
Proof
metis_tac [dominates_antisym]
QED
Definition bip_less_def:
(bip_less (Phi_ip _) (Offset _) ⇔ T) ∧
(bip_less (Offset m) (Offset n) ⇔ m < n) ∧
(bip_less _ _ ⇔ F)
End
Theorem bip_less_tri:
∀ip1 ip2. ip1.f = ip2.f ∧ ip1.b = ip2.b ⇒ bip_less ip1.i ip2.i ∨ bip_less ip2.i ip1.i ∨ ip_equiv ip1 ip2
Proof
rw [] >> Cases_on `ip1.i` >> Cases_on `ip2.i`>> rw [bip_less_def, ip_equiv_def]
QED
Theorem ip_equiv_less:
∀ip1 ip2 ip3.
ip_equiv ip2 ip3 ∧
bip_less ip1.i ip2.i
⇒
bip_less ip1.i ip3.i
Proof
rw [ip_equiv_def] >>
Cases_on `ip1.i` >> Cases_on `ip2.i` >> Cases_on `ip3.i` >> fs [bip_less_def]
QED
Theorem ip_equiv_less2:
∀ip1 ip2 ip3.
ip_equiv ip2 ip3 ∧
bip_less ip2.i ip1.i
⇒
bip_less ip3.i ip1.i
Proof
rw [ip_equiv_def] >>
Cases_on `ip1.i` >> Cases_on `ip2.i` >> Cases_on `ip3.i` >> fs [bip_less_def]
QED
Triviality front_cons_snoc:
∀x y z. front (x::SNOC y z) = x::z
Proof
Induct_on `z` >> fs [SNOC_APPEND]
QED
Triviality last_cons_snoc:
∀x y z. last (x::SNOC y z) = y
Proof
Induct_on `z` >> fs []
QED
Triviality prefix_snoc:
∀x y. x ≼ SNOC y x
Proof
Induct_on `x` >> fs []
QED
Triviality bip_lem:
bip_less i1 i2 ⇒ ?n. i2 = Offset n
Proof
Cases_on `i1` >> Cases_on `i2` >> fs [bip_less_def]
QED
Theorem next_ips_prev_entry:
∀prog ip1 ip2 ip3 f.
(∀fname dec.
alookup prog fname = Some dec ⇒
every (λb. fst b = None ⇔ (snd b).h = Entry) dec.blocks) ⇒
ip3 ∈ next_ips prog (entry_ip f) ∧
(∃i. get_instr prog ip1 i) ∧
ip1.f = ip2.f ∧
ip1.b = ip2.b ∧
bip_less ip1.i ip2.i ∧
ip_equiv ip3 ip2
⇒
ip1 = entry_ip f
Proof
rw [IN_DEF, next_ips_cases, get_instr_cases, entry_ip_def, ip_equiv_def] >>
rw [] >>
Cases_on `HD b.body` >> fs [instr_next_ips_def] >>
rw [] >> fs [inc_pc_def, inc_bip_def] >> rw [] >>
fs [] >> rw [pc_component_equality] >>
rfs [bip_less_def] >> rw [] >>
res_tac >>
fs [EVERY_MEM] >>
metis_tac [blockHeader_distinct, FST, ALOOKUP_MEM, SND, EVERY_MEM, bip_lem, bip_distinct]
QED
Theorem next_ips_prev_less:
ip2 ∈ next_ips prog ip3 ∧
(∃i. get_instr prog ip1 i) ∧
ip1.f = ip2.f ∧
ip1.b = ip2.b ∧
~ip_equiv ip1 ip3 ∧
bip_less ip1.i ip2.i
⇒
ip3.b = ip2.b ∧ bip_less ip1.i ip3.i
Proof
rw [IN_DEF, next_ips_cases, get_instr_cases, ip_equiv_def] >>
rw [] >>
Cases_on `el idx b.body` >> fs [instr_next_ips_def] >>
rw [] >> fs [inc_pc_def, inc_bip_def] >> rw [bip_less_def] >>
imp_res_tac bip_lem >>
fs [] >>
rfs [bip_less_def, inc_bip_def] >> rw [] >>
fs [pc_component_equality] >> rfs []
QED
Theorem good_path_end_step:
good_path prog (entry_ip f::SNOC ip2 (p1 ++ [ip3]))
⇒
ip2 ∈ next_ips prog ip3
Proof
rw [Once good_path_cases] >>
qpat_x_assum `_ = _` (mp_tac o GSYM) >>
rw [] >> fs [good_path_append] >>
Cases_on `p1` >> fs [Once good_path_cases]
QED
Theorem same_block_dominates:
∀prog.
(∀fname dec.
alookup prog fname = Some dec ⇒
every (λb. fst b = None ⇔ (snd b).h = Entry) dec.blocks) ⇒
∀ip1 ip2.
ip1.f = ip2.f ∧ ip1.b = ip2.b ∧ (∃i. get_instr prog ip1 i) ⇒ bip_less ip1.i ip2.i ⇒ dominates prog ip1 ip2
Proof
ntac 2 strip_tac >>
simp [dominates_def, PULL_FORALL] >>
ntac 3 gen_tac >>
Q.ID_SPEC_TAC `ip2` >>
Q.ID_SPEC_TAC `path` >>
ho_match_mp_tac SNOC_INDUCT >> rw []
>- (
simp [Once good_path_cases, ip_equiv_def] >>
Cases_on `ip1.i` >> Cases_on `ip2.i` >> fs [bip_less_def] >>
rw [entry_ip_def, pc_component_equality] >>
CCONTR_TAC >> fs [] >> rw [] >> fs [get_instr_cases] >> rw [] >>
first_x_assum drule >> simp [EXISTS_MEM] >>
qexists_tac `(ip1.b, b)` >> rw [] >>
metis_tac [optionTheory.SOME_11, ALOOKUP_MEM]) >>
simp [front_cons_snoc] >> fs [last_cons_snoc] >> rw [] >>
`good_path prog (entry_ip ip2.f::path)`
by (irule good_path_prefix >> HINT_EXISTS_TAC >> rw [prefix_snoc]) >>
Cases_on `path = []` >> rw []
>- (
fs [Once good_path_cases] >>
fs [Once good_path_cases] >>
metis_tac [next_ips_prev_entry, ip_equiv_refl]) >>
`?p1 ip3. path = p1 ++ [ip3]` by metis_tac [SNOC_CASES, SNOC_APPEND] >>
fs [] >> rw [] >>
rename1 `ip_equiv ip2' _` >>
`ip3.f = ip2'.f`
by (
irule good_path_same_func >>
qexists_tac `entry_ip ip2.f::SNOC ip2' (p1 ++ [ip3])` >>
rw [] >> metis_tac []) >>
Cases_on `ip_equiv ip1 ip3` >> rw []
>- metis_tac [] >>
`ip3.b = ip2'.b ∧ bip_less ip1.i ip3.i`
by (
drule good_path_end_step >> strip_tac >>
irule next_ips_prev_less >>
fs [] >> rw []
>- fs [ip_equiv_def]
>- fs [ip_equiv_def]
>- metis_tac []
>- metis_tac [ip_equiv_less, ip_equiv_sym]) >>
first_x_assum (qspec_then `ip3` mp_tac) >> simp [] >>
impl_tac
>- metis_tac [ip_equiv_def] >>
impl_tac >> rw []
>- fs [ip_equiv_def]
>- rw [LAST_DEF, ip_equiv_def] >>
qexists_tac `ip1'` >> rw [] >>
drule MEM_FRONT >> fs [ip_equiv_def]
QED
Theorem next_ips_still_leq:
ip2 ∈ next_ips prog ip1 ∧
ip2.f = ip1.f ∧
ip2.f = ip3.f ∧
ip1.b = ip3.b ∧
(∀inst. get_instr prog ip1 (Inl inst) ⇒ ~terminator inst) ∧
bip_less ip1.i ip3.i
⇒
bip_less ip2.i ip3.i ∧ ip2.b = ip1.b ∨ ip2 = ip3
Proof
rw [IN_DEF, next_ips_cases] >> rfs []
>- (
fs [get_instr_cases] >> rw [] >> rfs [] >> rw [] >> fs [] >>
Cases_on `el idx b.body` >> fs [instr_next_ips_def] >> rw [] >> fs [inc_pc_def] >>
rw [] >> rfs [inc_bip_def] >>
Cases_on `ip3.i` >> fs [bip_less_def, pc_component_equality] >>
rw [] >> fs [terminator_def])
>- (
fs [get_instr_cases, inc_pc_def] >> rw [] >> rfs [inc_bip_def] >> rw [pc_component_equality] >>
Cases_on `ip3.i` >> fs [bip_less_def])
QED
Theorem good_path_find_ip:
∀prog path.
good_path prog path ⇒
∀ip.
loc_prog_ok prog ∧
path ≠ [] ∧
(last path).b ≠ ip.b ∧
ip.f = (HD path).f ∧ ip.b = (HD path).b ∧ bip_less (HD path).i ip.i ∧
(∃inst. get_instr prog ip inst)
⇒
mem ip (front path)
Proof
ho_match_mp_tac good_path_ind >> rw []
>- metis_tac [] >>
drule next_ips_same_func >> rw [] >>
drule next_ips_still_leq >> simp [] >>
disch_then (qspec_then `ip` mp_tac) >> simp [] >>
impl_tac
>- (
rw [get_instr_cases] >>
`every (λi. ~terminator i) (front b.body) ∧ b.body ≠ []` by metis_tac [loc_prog_ok_def] >>
fs [EVERY_MEM, MEM_EL] >>
first_x_assum (qspec_then `el idx b.body` mp_tac) >>
impl_tac
>- (
qexists_tac `idx` >> conj_asm1_tac
>- (
Cases_on `ip.i` >> fs [bip_less_def, LENGTH_FRONT] >>
fs [get_instr_cases] >>
rw [] >> rfs [] >> rw [] >> fs []) >>
metis_tac [EL_FRONT, NULL_EQ]) >>
metis_tac []) >>
rw []
>- metis_tac [next_ips_same_func] >>
Cases_on `path` >> fs []
QED
Theorem dominates_same_block:
∀ip1 ip2 ip3.
loc_prog_ok prog ∧ dominates prog ip1 ip3 ∧ ip1.f = ip2.f ∧ ip1.b = ip2.b ∧
ip3.b ≠ ip1.b ∧ bip_less ip1.i ip2.i ∧ (∃inst. get_instr prog ip2 instr)
⇒
dominates prog ip2 ip3
Proof
rw [dominates_def] >>
first_x_assum drule >> rw [] >>
drule MEM_FRONT >>
REWRITE_TAC [Once MEM_SPLIT] >> strip_tac >>
`good_path prog (ip1'::l2)`
by (
full_simp_tac std_ss [GSYM APPEND_ASSOC] >>
full_simp_tac std_ss [Once good_path_append]) >>
full_simp_tac std_ss [LAST_APPEND] >>
drule good_path_find_ip >>
disch_then (qspec_then `ip2` mp_tac) >>
impl_tac >> rw []
>- (fs [ip_equiv_def] >> metis_tac [])
>- (
`ip1'.f = (entry_ip ip3.f).f` suffices_by (fs [ip_equiv_def]) >>
irule good_path_same_func >>
qexists_tac `entry_ip ip3.f::path` >>
qexists_tac `prog` >> rw_tac std_ss []
>- rw []
>- metis_tac [MEM])
>- fs [ip_equiv_def]
>- metis_tac [ip_equiv_less2]
>- metis_tac []
>- (
qexists_tac `ip2` >> rw [ip_equiv_refl] >>
rw [FRONT_APPEND])
QED
(* ----- Liveness ----- *)
Definition live_def:
live prog ip =
{ r | ∃path.
good_path prog (ip::path) ∧
r ∈ uses prog (last (ip::path)) ∧
∀ip2. ip2 ∈ set (front (ip::path)) ⇒ r ∉ image fst (assigns prog ip2) }
End
Theorem get_instr_live:
∀prog ip instr.
get_instr prog ip instr
⇒
uses prog ip ⊆ live prog ip
Proof
rw [live_def, SUBSET_DEF] >>
qexists_tac `[]` >> rw [Once good_path_cases] >>
qexists_tac `instr` >> simp [] >> metis_tac [IN_DEF]
QED
Triviality set_rw:
∀s P. (∀x. x ∈ s ⇔ P x) ⇔ s = P
Proof
rw [] >> eq_tac >> rw [IN_DEF] >> metis_tac []
QED
Theorem live_gen_kill:
∀prog ip ip'.
live prog ip =
BIGUNION {live prog ip' | ip' | ip' ∈ next_ips prog ip} DIFF image fst (assigns prog ip) ∪ uses prog ip
Proof
rw [live_def, EXTENSION] >> eq_tac >> rw []
>- (
Cases_on `path` >> fs [] >>
rename1 `ip::ip2::path` >>
qpat_x_assum `good_path _ _` mp_tac >> simp [Once good_path_cases] >> rw [] >>
Cases_on `x ∈ uses prog ip` >> fs [] >> simp [set_rw, PULL_EXISTS] >>
qexists_tac `ip2` >> qexists_tac `path` >> rw [])
>- (
fs [] >>
qexists_tac `ip'::path` >> rw [] >>
simp [Once good_path_cases])
>- (
qexists_tac `[]` >> rw [] >>
fs [Once good_path_cases, uses_cases, IN_DEF] >>
metis_tac [])
QED
Theorem ssa_dominates_live_range_lem:
∀prog r ip1 ip2.
is_ssa prog ∧ ip1.f = ip2.f ∧ r ∈ image fst (assigns prog ip1) ∧ r ∈ live prog ip2 ⇒
dominates prog ip1 ip2
Proof
rw [dominates_def, is_ssa_def, live_def] >>
`path ≠ [] ⇒ (last path).f = ip2.f`
by (
rw [] >>
irule good_path_same_func >>
qexists_tac `ip2::path` >> rw [] >>
Cases_on `path` >> fs [MEM_LAST] >> metis_tac []) >>
first_x_assum drule >> rw [] >>
first_x_assum (qspec_then `path'++path` mp_tac) >>
impl_tac
>- (
fs [LAST_DEF] >> rw [] >> fs []
>- (
simp_tac std_ss [GSYM APPEND, good_path_append] >> rw []
>- (
qpat_x_assum `good_path _ (_::_)` mp_tac >>
qpat_x_assum `good_path _ (_::_)` mp_tac >>
simp [Once good_path_cases] >>
metis_tac [])
>- (
simp [LAST_DEF] >>
qpat_x_assum `good_path _ (_::_)` mp_tac >>
qpat_x_assum `good_path _ (_::_)` mp_tac >>
simp [Once good_path_cases] >>
rw [] >> rw [] >>
metis_tac [ip_equiv_next, ip_equiv_sym]))
>- (Cases_on `path` >> fs [] >> metis_tac [ip_equiv_refl])) >>
rw [] >>
`ip1'.f = (last (entry_ip ip2.f::path')).f`
by (
irule good_path_same_func >>
qexists_tac `entry_ip ip2.f::path'` >>
qexists_tac `prog` >>
conj_tac
>- (
Cases_on `path` >>
full_simp_tac std_ss [GSYM APPEND, FRONT_APPEND, APPEND_NIL, LAST_CONS]
>- metis_tac [MEM_FRONT] >>
full_simp_tac std_ss [GSYM APPEND, FRONT_APPEND] >> fs [] >> rw [FRONT_DEF] >> fs [] >>
metis_tac [ip_equiv_assigns])
>- metis_tac [MEM_LAST]) >>
`ip2'.f = ip1.f` by fs [ip_equiv_def] >>
`ip_equiv ip2' ip1` by metis_tac [] >>
rw [] >>
Cases_on `path` >> fs [] >>
full_simp_tac std_ss [GSYM APPEND, FRONT_APPEND] >> fs [] >> rw [FRONT_DEF] >> fs []
>- (fs [FRONT_DEF] >> metis_tac [ip_equiv_sym, ip_equiv_trans])
>- (fs [ip_equiv_def, entry_ip_def] >> metis_tac [pc_component_equality])
>- (fs [FRONT_DEF] >> metis_tac [ip_equiv_sym, ip_equiv_trans])
>- (
`mem ip1' path' = mem ip1' (front path' ++ [last path'])` by metis_tac [APPEND_FRONT_LAST] >>
fs [LAST_DEF] >>
metis_tac [ip_equiv_trans, ip_equiv_assigns])
>- metis_tac [ip_equiv_assigns]
>- metis_tac [ip_equiv_assigns]
QED
Theorem ssa_dominates_live_range:
∀prog r ip.
is_ssa prog ∧ r ∈ uses prog ip
⇒
∃ip1. ip1.f = ip.f ∧ r ∈ image fst (assigns prog ip1) ∧
∀ip2. ip2.f = ip.f ∧ r ∈ live prog ip2 ⇒
dominates prog ip1 ip2
Proof
rw [] >> drule ssa_dominates_live_range_lem >> rw [] >>
fs [is_ssa_def] >>
first_assum drule >> rw [] >> metis_tac []
QED
Theorem reachable_dominates_same_func:
∀prog ip1 ip2. reachable prog ip2 ∧ dominates prog ip1 ip2 ⇒ ip1.f = ip2.f
Proof
rw [reachable_def, dominates_def] >> res_tac >>
`ip1'.f = (last (entry_ip ip2.f::path)).f` suffices_by fs [ip_equiv_def] >>
irule good_path_same_func >>
metis_tac [MEM_LAST, MEM_FRONT]
QED
Theorem next_ips_reachable:
∀prog ip1 ip2. reachable prog ip1 ∧ ip2 ∈ next_ips prog ip1 ⇒ reachable prog ip2
Proof
rw [] >> imp_res_tac next_ips_same_func >>
fs [reachable_def] >>
qexists_tac `path ++ [ip2]` >>
simp_tac std_ss [GSYM APPEND, LAST_APPEND_CONS, LAST_CONS] >>
simp [good_path_append] >>
simp [Once good_path_cases, ip_equiv_refl] >>
rw []
>- (fs [next_ips_cases, IN_DEF] >> metis_tac [])
>- metis_tac [ip_equiv_next, ip_equiv_sym]
QED
(* ----- A theory of *dominator ordered* programs ------ *)
(* A list of basic blocks is dominator ordered if each variable use occurs after
* the assignment to that variable. We can also define a notion of variable
* liveness that follows the list structure, rather than the CFG structure, and
* show that for dominator ordered lists, the live set is empty at the entry
* point *)
Definition instrs_live_def:
(instrs_live [] = ({}, {})) ∧
(instrs_live (i::is) =
let (gen, kill) = instrs_live is in
(instr_uses i ∪ (gen DIFF image fst (instr_assigns i)),
(image fst (instr_assigns i) ∪ (kill DIFF instr_uses i))))
End
Definition header_uses_def:
(header_uses (Head phis land) =
bigunion { phi_uses from_l p | from_l,p | mem p phis }) ∧
(header_uses Entry = {})
End
Definition header_assigns_def:
(header_assigns (Head phis land) = set (map (fst o phi_assigns) phis)) ∧
(header_assigns Entry = {})
End
Definition linear_live_def:
(linear_live [] = {}) ∧
(linear_live (b::bs) =
let (gen,kill) = instrs_live b.body in
header_uses b.h ∪ (gen ∪ (linear_live bs DIFF kill) DIFF header_assigns b.h))
End
Definition linear_pc_less_def:
linear_pc_less = $< LEX bip_less
End
Inductive lpc_get_instr:
(∀i idx bs.
i < length bs ∧
idx < length (el i bs).body
⇒
lpc_get_instr bs (i, Offset idx) (Inl (el idx (el i bs).body))) ∧
(∀i from_l phis bs landing.
i < length bs ∧
(el i bs).h = Head phis landing
⇒
lpc_get_instr bs (i, Phi_ip from_l) (Inr (from_l, phis)))
End
Inductive lpc_assigns:
(∀bs ip i r.
lpc_get_instr bs ip (Inl i) ∧
r ∈ instr_assigns i
⇒
lpc_assigns bs ip r) ∧
(∀bs ip from_l phis r.
lpc_get_instr bs ip (Inr (from_l, phis)) ∧
r ∈ set (map phi_assigns phis)
⇒
lpc_assigns bs ip r)
End
Inductive lpc_uses:
(∀bs ip i r.
lpc_get_instr bs ip (Inl i) ∧
r ∈ instr_uses i
⇒
lpc_uses bs ip r) ∧
(∀bs ip from_l phis r.
lpc_get_instr bs ip (Inr (from_l, phis)) ∧
r ∈ BIGUNION (set (map (phi_uses from_l) phis))
⇒
lpc_uses bs ip r)
End
Definition dominator_ordered_def:
dominator_ordered p ⇔
∀f d lip1 r.
alookup p (Fn f) = Some d ∧
r ∈ lpc_uses (map snd d.blocks) lip1
⇒
∃lip2. linear_pc_less lip2 lip1 ∧ r ∈ image fst (lpc_assigns (map snd d.blocks) lip2)
End
Theorem instrs_kill_subset_assigns:
snd (instrs_live is) ⊆ bigunion (image (λi. image fst (instr_assigns i)) (set is))
Proof
Induct_on `is` >> rw [instrs_live_def] >>
pairarg_tac >> rw [] >>
fs [SUBSET_DEF]
QED
Theorem instrs_gen_subset_uses:
fst (instrs_live is) ⊆ bigunion (image instr_uses (set is))
Proof
Induct_on `is` >> rw [instrs_live_def] >>
pairarg_tac >> rw [] >>
fs [SUBSET_DEF]
QED
Theorem instrs_subset_assigns_subset_kill_gen:
bigunion (image (λi. image fst (instr_assigns i)) (set is)) ⊆
snd (instrs_live is) ∪ fst (instrs_live is)
Proof
Induct_on `is` >> rw [instrs_live_def] >>
pairarg_tac >> rw [] >> fs [SUBSET_DEF] >> rw [] >>
metis_tac []
QED
Theorem use_assign_in_gen_kill:
∀n is r.
n < length is ∧ (r ∈ image fst (instr_assigns (el n is)) ∨ r ∈ instr_uses (el n is))
⇒
r ∈ fst (instrs_live is) ∨ r ∈ snd (instrs_live is)
Proof
Induct_on `n` >> rw [] >> Cases_on `is` >> rw [] >> fs [] >>
rw [instrs_live_def] >>
pairarg_tac >> rw [] >>
metis_tac [FST, SND, pair_CASES]
QED
Theorem instrs_live_uses:
∀is r.
r ∈ fst (instrs_live is)
⇒
∃i. i < length is ∧ r ∈ instr_uses (el i is) ∧
∀j. j < i ⇒ r ∉ instr_uses (el j is) ∧ r ∉ image fst (instr_assigns (el j is))
Proof
Induct >> rw [instrs_live_def] >> pairarg_tac >> fs []
>- (qexists_tac `0` >> rw []) >>
rename1 `(i1::is)` >>
Cases_on `r ∈ instr_uses i1`
>- (qexists_tac `0` >> rw []) >>
first_x_assum drule >> rw [] >>
qexists_tac `Suc i` >> rw [] >>
Cases_on `j` >> fs []
QED
Theorem lpc_get_instr_cons:
∀b bs i bip.
lpc_get_instr (b::bs) (i + 1, bip) = lpc_get_instr bs (i, bip)
Proof
rw [lpc_get_instr_cases, EXTENSION, IN_DEF, EL_CONS] >>
`PRE (i + 1) = i` by decide_tac >>
rw [ADD1]
QED
Theorem lpc_uses_cons:
∀b bs i bip.
lpc_uses (b::bs) (i + 1, bip) = lpc_uses bs (i, bip)
Proof
rw [lpc_uses_cases, EXTENSION, IN_DEF, lpc_get_instr_cons]
QED
Theorem lpc_uses_0_head:
∀b bs. header_uses b.h = bigunion { lpc_uses (b::bs) (0, Phi_ip from_l) | from_l | T}
Proof
rw [EXTENSION, IN_DEF] >>
rw [lpc_uses_cases, lpc_get_instr_cases, PULL_EXISTS] >>
Cases_on `b.h` >> rw [header_uses_def, MEM_MAP, PULL_EXISTS]
>- metis_tac [] >>
eq_tac >> rw []
>- (
qexists_tac `(\x'. ∃y. x' ∈ phi_uses from_l y ∧ mem y l)` >>
qexists_tac `from_l` >>
rw [] >>
metis_tac []) >>
metis_tac []
QED
Theorem lpc_uses_0_body:
∀b bs. lpc_uses (b::bs) (0, Offset n) ⊆ fst (instrs_live b.body) ∪ snd (instrs_live b.body)
Proof
rw [SUBSET_DEF, IN_DEF] >>
fs [lpc_uses_cases, lpc_get_instr_cases, PULL_EXISTS] >>
metis_tac [use_assign_in_gen_kill, IN_DEF]
QED
Theorem lpc_assigns_cons:
∀b bs i bip.
lpc_assigns (b::bs) (i + 1, bip) = lpc_assigns bs (i, bip)
Proof
rw [lpc_assigns_cases, EXTENSION, IN_DEF, lpc_get_instr_cons]
QED
Theorem lpc_assigns_0_head:
∀b bs from_l.
image fst (lpc_assigns (b::bs) (0, Phi_ip from_l)) = header_assigns b.h
Proof
rw [EXTENSION, Once IN_DEF] >>
rw [lpc_assigns_cases, lpc_get_instr_cases, PULL_EXISTS] >>
Cases_on `b.h` >> rw [header_assigns_def, MEM_MAP] >>
metis_tac []
QED
Theorem lpc_assigns_0_body:
∀b bs. image fst (lpc_assigns (b::bs) (0, Offset n)) ⊆ fst (instrs_live b.body) ∪ snd (instrs_live b.body)
Proof
rw [SUBSET_DEF, IN_DEF] >>
fs [lpc_assigns_cases, lpc_get_instr_cases, PULL_EXISTS] >>
drule use_assign_in_gen_kill >>
rw [] >>
metis_tac [IN_DEF]
QED
Theorem linear_live_uses:
∀bs r. r ∈ linear_live bs ⇒
∃lip. r ∈ lpc_uses bs lip ∧
∀lip2. linear_pc_less lip2 lip ⇒ r ∉ lpc_uses bs lip2 ∧ r ∉ image fst (lpc_assigns bs lip2)
Proof
Induct >> rw [linear_live_def] >>
rename1 `header_uses b.h` >>
Cases_on `r ∈ header_uses b.h`
>- (
fs [header_uses_def] >> pairarg_tac >> fs [] >>
Cases_on `b.h` >> fs [header_uses_def] >>
qexists_tac `(0, Phi_ip from_l)` >> fs [header_uses_def] >>
conj_tac
>- (
simp [IN_DEF] >>
rw [lpc_uses_cases, lpc_get_instr_cases, PULL_EXISTS] >>
rw [MEM_MAP] >> metis_tac [])
>- (
gen_tac >> simp [linear_pc_less_def, LEX_DEF] >>
pairarg_tac >> simp [bip_less_def])) >>
pairarg_tac >> Cases_on `r ∈ gen` >> fs []
>- (
`r ∈ fst (instrs_live b.body)` by metis_tac [FST] >>
drule instrs_live_uses >> rw [] >>
qexists_tac `(0, Offset i)` >>
conj_tac
>- (
simp [IN_DEF] >>
rw [lpc_uses_cases, lpc_get_instr_cases, PULL_EXISTS] >>
rw [MEM_MAP] >> metis_tac [])
>- (
gen_tac >> strip_tac >>
PairCases_on `lip2` >> fs [linear_pc_less_def, LEX_DEF_THM] >>
Cases_on `lip21` >> fs [bip_less_def]
>- (
Cases_on `b.h` >> fs [header_assigns_def, header_uses_def] >>
simp [IN_DEF] >>
rw [lpc_uses_cases, lpc_assigns_cases, lpc_get_instr_cases, PULL_EXISTS] >>
fs [MEM_MAP] >>
metis_tac [FST])
>- (
first_x_assum drule >>
simp [IN_DEF] >>
rw [lpc_uses_cases, lpc_assigns_cases, lpc_get_instr_cases, PULL_EXISTS] >>
rw [IN_DEF])))
>- (
first_x_assum drule >> rw [] >>
PairCases_on `lip` >>
qexists_tac `lip0+1,lip1` >> simp [IN_DEF] >>
conj_tac
>- fs [lpc_uses_cons, IN_DEF] >>
gen_tac >> disch_tac >>
PairCases_on `lip2` >>
Cases_on `lip20` >> fs [ADD1]
>- (
Cases_on `lip21`
>- (
rename1 `Phi_ip from_l` >>
`r ∉ bigunion {lpc_uses (b::bs) (0,Phi_ip from_l) | from_l | T} ∧
r ∉ image fst (lpc_assigns (b::bs) (0,Phi_ip from_l))`
by metis_tac [lpc_assigns_0_head, lpc_uses_0_head] >>
fs [IN_DEF] >> metis_tac [])
>- (
`r ∉ image fst (lpc_assigns (b::bs) (0,Offset n)) ∧
r ∉ lpc_uses (b::bs) (0,Offset n)`
by metis_tac [IN_UNION, lpc_assigns_0_body, lpc_uses_0_body, FST, SND, SUBSET_DEF] >>
fs [IN_DEF]))
>- (
`linear_pc_less (n, lip21) (lip0, lip1)` by fs [linear_pc_less_def, LEX_DEF] >>
first_x_assum drule >>
rw [lpc_uses_cons, lpc_assigns_cons] >> fs [IN_DEF]))
QED
Theorem dominator_ordered_linear_live:
∀p f d.
dominator_ordered p ∧
alookup p (Fn f) = Some d
⇒
linear_live (map snd d.blocks) = {}
Proof
rw [dominator_ordered_def] >> first_x_assum drule >> rw [EXTENSION] >>
CCONTR_TAC >> fs [] >> drule linear_live_uses >> rw [] >>
metis_tac []
QED
Definition block_assigns_def:
block_assigns (l, b) =
header_assigns b.h ∪ image fst (bigunion (image instr_assigns (set b.body)))
End
Definition block_uses_def:
block_uses (l, b) =
header_uses b.h ∪ bigunion (image instr_uses (set b.body))
End
Definition block_order_def:
block_order bs =
tc { (b1, b2) |
fst b1 ≠ fst b2 ∧ mem b1 bs ∧ mem b2 bs ∧ (∃r. r ∈ block_assigns b1 ∧ r ∈ block_uses b2) }
End
Theorem prog_ok_distinct_lem:
loc_prog_ok p ∧ alookup p f = Some d ⇒ all_distinct (map fst d.blocks)
Proof
rw [loc_prog_ok_def, EVERY_MEM] >>
drule ALOOKUP_MEM >> rw [] >>
res_tac >> fs []
QED
Theorem block_order_dominates:
∀b1 b2.
(b1,b2) ∈ block_order d.blocks ⇒
loc_prog_ok prog ∧
is_ssa prog ∧
alookup prog f = Some d ⇒
∃ip1 ip2.
dominates prog ip1 ip2 ∧
ip1.f = f ∧
ip2.f = f ∧
ip1.b = fst b1 ∧
ip2.b = fst b2 ∧
fst b1 ≠ fst b2 ∧
(∃i2. get_instr prog ip2 i2)
Proof
simp [block_order_def] >>
ho_match_mp_tac tc_ind >> rw []
>- (
fs [is_ssa_def] >>
`∃ip1. r ∈ uses prog ip1 ∧ ip1.f = f ∧ ip1.b = fst b2`
by (
simp [Once IN_DEF, uses_cases] >> Cases_on `b2` >> fs [block_uses_def] >>
fs [get_instr_cases, PULL_EXISTS]
>- (
rename1 `_ ∈ header_uses b.h` >>
Cases_on `b.h` >> fs [header_uses_def] >> rw [] >>
rename1 `mem (l1, _) _` >>
qexists_tac `<| f := f; b := l1; i := Phi_ip from_l |>` >> rw [] >>
qexists_tac `l` >> qexists_tac `phi_uses from_l p` >> qexists_tac `b` >>
rw [MEM_MAP] >>
metis_tac [ALOOKUP_ALL_DISTINCT_MEM, loc_prog_ok_def, prog_ok_distinct_lem])
>- (
fs [MEM_EL] >> rw [] >>
rename [`n1 < length b.body`, `(l1, _) = el _ _`] >>
qexists_tac `<| f := f; b := l1; i := Offset n1 |>` >> rw [] >>
metis_tac [ALOOKUP_ALL_DISTINCT_MEM, loc_prog_ok_def, EL_MEM, prog_ok_distinct_lem])) >>
first_x_assum drule >> rw [] >>
qexists_tac `ip2` >> qexists_tac `ip1` >> rw []
>- (
rename1 `rt ∈ assigns _ _` >>
`∃ip3 t. (fst rt, t) ∈ assigns prog ip3 ∧ ip3.f = ip1.f ∧ ip3.b = fst b1`
by (
simp [Once IN_DEF, assigns_cases] >> Cases_on `b1` >> fs [block_assigns_def] >>
fs [get_instr_cases, PULL_EXISTS]
>- (
rename1 `_ ∈ header_assigns b.h` >>
Cases_on `b.h` >> fs [header_assigns_def] >> rw [] >>
rename1 `mem (l1, _) _` >>
fs [MEM_MAP] >>
qexists_tac `<| f := ip1.f; b := l1; i := Phi_ip from_l |>` >> rw [] >>
qexists_tac `SND (phi_assigns y)` >> qexists_tac `l` >> qexists_tac `b` >>
qexists_tac `o'` >> rw [] >>
metis_tac [FST, ALOOKUP_ALL_DISTINCT_MEM, loc_prog_ok_def, SND, prog_ok_distinct_lem])
>- (
fs [MEM_EL] >> rw [] >>
rename [`n1 < length b.body`, `(l1, _) = el _ _`] >>
qexists_tac `<| f := ip1.f; b := l1; i := Offset n1 |>` >> rw [] >>
qexists_tac `snd x` >>
rw [] >>
metis_tac [ALOOKUP_ALL_DISTINCT_MEM, loc_prog_ok_def, EL_MEM, FST, SND, prog_ok_distinct_lem])) >>
metis_tac [ip_equiv_def, FST])
>- (fs [uses_cases, IN_DEF] >> metis_tac []))
>- (
first_x_assum drule >> first_x_assum drule >> rw [] >>
Cases_on `ip1.b = ip2.b ∨ ip1'.b = ip2'.b`
>- metis_tac [] >>
qexists_tac `ip1` >> qexists_tac `ip2'` >>
Cases_on `bip_less ip2.i ip1'.i`
>- (
`dominates prog ip2 ip1'` by metis_tac [same_block_dominates, loc_prog_ok_def] >>
rw []
>- metis_tac [dominates_trans]
>- (
CCONTR_TAC >> fs [] >>
Cases_on `bip_less ip2'.i ip1.i`
>- (
`dominates prog ip2' ip1` by metis_tac [same_block_dominates, loc_prog_ok_def] >>
metis_tac [dominates_trans, dominates_antisym, is_ssa_def]) >>
Cases_on `bip_less ip1.i ip2'.i`
>- (
`dominates prog ip2' ip2` by metis_tac [dominates_same_block] >>
metis_tac [dominates_antisym, dominates_trans, is_ssa_def])
>- (
`dominates prog ip1' ip1` by metis_tac [ip_equiv_dominates, bip_less_tri] >>
metis_tac [dominates_antisym, dominates_trans, is_ssa_def]))
>- metis_tac []) >>
Cases_on `bip_less ip1'.i ip2.i`
>- (
`dominates prog ip2 ip2'` by metis_tac [dominates_same_block] >>
rw []
>- metis_tac [dominates_trans]
>- (
CCONTR_TAC >> fs [] >>
Cases_on `bip_less ip2'.i ip1.i`
>- (
`dominates prog ip2' ip1` by metis_tac [same_block_dominates, loc_prog_ok_def] >>
metis_tac [dominates_trans, dominates_antisym, is_ssa_def]) >>
Cases_on `bip_less ip1.i ip2'.i`
>- (
`dominates prog ip2' ip2` by metis_tac [dominates_same_block] >>
metis_tac [dominates_antisym, dominates_trans, is_ssa_def])
>- (
`dominates prog ip2 ip1` by metis_tac [ip_equiv_dominates, bip_less_tri] >>
metis_tac [dominates_antisym, dominates_trans, is_ssa_def]))
>- metis_tac [])
>- (
`ip_equiv ip1' ip2` by metis_tac [bip_less_tri] >>
`dominates prog ip1 ip2'` by metis_tac [dominates_trans, ip_equiv_sym, ip_equiv_dominates] >>
rw []
>- (
CCONTR_TAC >> fs [] >>
Cases_on `bip_less ip2'.i ip1.i`
>- (
`dominates prog ip2' ip1` by metis_tac [same_block_dominates, loc_prog_ok_def] >>
metis_tac [dominates_trans, dominates_antisym, is_ssa_def]) >>
Cases_on `bip_less ip1.i ip2'.i`
>- (
`dominates prog ip2' ip2` by metis_tac [dominates_same_block] >>
`dominates prog ip2 ip2'` by metis_tac [ip_equiv_dominates2, ip_equiv_sym] >>
metis_tac [dominates_antisym, is_ssa_def])
>- (
`dominates prog ip2' ip2` by metis_tac [ip_equiv_dominates2, bip_less_tri] >>
`dominates prog ip2 ip2'` by metis_tac [ip_equiv_dominates2, bip_less_tri] >>
metis_tac [dominates_antisym, is_ssa_def]))
>- metis_tac []))
QED
Theorem block_order_po:
∀prog f d.
loc_prog_ok prog ∧ is_ssa prog ∧
alookup prog f = Some d
⇒
partial_order (rc (block_order d.blocks) (set d.blocks)) (set d.blocks)
Proof
rw [partial_order_def]
>- (rw [block_order_def, domain_def, SUBSET_DEF, rc_def] >> drule tc_domain_range >> rw [domain_def])
>- (rw [block_order_def, range_def, SUBSET_DEF, rc_def] >> rw [] >> drule tc_domain_range >> rw [range_def])
>- metis_tac [block_order_def, transitive_rc, tc_transitive]
>- metis_tac [rc_is_reflexive]
>- (
simp [antisym_rc] >> rw [antisym_def] >>
pop_assum mp_tac >>
drule block_order_dominates >>
disch_then drule >> simp [] >> disch_then drule >> rw [] >>
drule block_order_dominates >>
disch_then drule >> simp [] >> disch_then drule >> rw [] >>
CCONTR_TAC >>
Cases_on `bip_less ip2.i ip1'.i`
>- (
`dominates prog ip2 ip1'` by metis_tac [same_block_dominates, loc_prog_ok_def] >>
Cases_on `bip_less ip2'.i ip1.i`
>- (
`dominates prog ip2' ip1` by metis_tac [same_block_dominates, loc_prog_ok_def] >>
metis_tac [dominates_trans, dominates_antisym, is_ssa_def]) >>
Cases_on `bip_less ip1.i ip2'.i`
>- (
`dominates prog ip2' ip2` by metis_tac [dominates_same_block] >>
metis_tac [dominates_antisym, dominates_trans, is_ssa_def])
>- (
`dominates prog ip1' ip1` by metis_tac [ip_equiv_dominates, bip_less_tri] >>
metis_tac [dominates_antisym, dominates_trans, is_ssa_def])) >>
Cases_on `bip_less ip1'.i ip2.i`
>- (
`dominates prog ip2 ip2'` by metis_tac [dominates_same_block] >>
Cases_on `bip_less ip2'.i ip1.i`
>- (
`dominates prog ip2' ip1` by metis_tac [same_block_dominates, loc_prog_ok_def] >>
metis_tac [dominates_trans, dominates_antisym, is_ssa_def]) >>
Cases_on `bip_less ip1.i ip2'.i`
>- (
`dominates prog ip2' ip2` by metis_tac [dominates_same_block] >>
metis_tac [dominates_antisym, dominates_trans, is_ssa_def])
>- (
`dominates prog ip2 ip1` by metis_tac [ip_equiv_dominates, bip_less_tri] >>
metis_tac [dominates_antisym, dominates_trans, is_ssa_def]))
>- (
`ip_equiv ip1' ip2` by metis_tac [bip_less_tri] >>
`dominates prog ip1 ip2'` by metis_tac [dominates_trans, ip_equiv_sym, ip_equiv_dominates] >>
Cases_on `bip_less ip2'.i ip1.i`
>- (
`dominates prog ip2' ip1` by metis_tac [same_block_dominates, loc_prog_ok_def] >>
metis_tac [dominates_trans, dominates_antisym, is_ssa_def]) >>
Cases_on `bip_less ip1.i ip2'.i`
>- (
`dominates prog ip2' ip2` by metis_tac [dominates_same_block] >>
`dominates prog ip2 ip2'` by metis_tac [ip_equiv_dominates2, ip_equiv_sym] >>
metis_tac [dominates_antisym, is_ssa_def])
>- (
`dominates prog ip2' ip2` by metis_tac [ip_equiv_dominates2, bip_less_tri] >>
`dominates prog ip2 ip2'` by metis_tac [ip_equiv_dominates2, bip_less_tri] >>
metis_tac [dominates_antisym, is_ssa_def])))
QED
Theorem assigns_weak:
∀l d p ip r. ~mem l (map fst p) ∧ r ∈ assigns p ip ⇒ r ∈ assigns ((l,d)::p) ip
Proof
rw [assigns_cases, IN_DEF, get_instr_cases, PULL_EXISTS] >>
imp_res_tac ALOOKUP_MEM >>
fs [LIST_TO_SET_MAP] >> metis_tac [FST]
QED
Theorem uses_weak:
∀l d p ip r. ip.f ≠ l ⇒ uses ((l,d)::p) ip = uses p ip
Proof
rw [uses_cases, EXTENSION, IN_DEF, get_instr_cases, PULL_EXISTS]
QED
Theorem assigns_weak2:
∀l d p ip r. ip.f ≠ l ⇒ assigns ((l,d)::p) ip = assigns p ip
Proof
rw [assigns_cases, EXTENSION, IN_DEF, get_instr_cases, PULL_EXISTS]
QED
Theorem good_path_weak:
∀l d p ip path. ip.f ≠ l ⇒ good_path ((l,d)::p) (ip::path) = good_path p (ip::path)
Proof
Induct_on `path` >> rw [] >>
ONCE_REWRITE_TAC [good_path_cases] >> rw []
>- rw [EXTENSION, IN_DEF, get_instr_cases, PULL_EXISTS] >>
rename1 `good_path _ (p1::_)` >>
Cases_on `p1.f ≠ l`
>- (
first_x_assum drule >> rw [] >>
eq_tac >> rw [] >>
fs [next_ips_cases, EXTENSION, IN_DEF, get_instr_cases, PULL_EXISTS] >> rw [] >>
metis_tac [])
>- metis_tac [next_ips_same_func]
QED
Theorem dominates_weak:
∀l d p ip1 ip2. ip1.f ≠ l ⇒ dominates ((l,d)::p) ip2 ip1 = dominates p ip2 ip1
Proof
rw [dominates_def, EXTENSION, IN_DEF] >>
`(entry_ip ip1.f).f = ip1.f` by rw [entry_ip_def] >>
metis_tac [good_path_weak]
QED
Theorem uses_good_ip:
∀r prog ip. r ∈ uses prog ip ⇒ mem ip.f (map fst prog)
Proof
rw [uses_cases, IN_DEF, get_instr_cases] >>
imp_res_tac ALOOKUP_MEM >>
fs [LIST_TO_SET_MAP] >>
metis_tac [FST]
QED
Theorem is_ssa_weak:
∀l d p. ~mem l (map fst p) ∧ is_ssa ((l,d)::p) ⇒ is_ssa p
Proof
rw [is_ssa_def]
>- (first_x_assum irule >> rw [PULL_EXISTS] >> metis_tac [assigns_weak])
>- (
drule uses_good_ip >> rw [] >>
last_x_assum (qspec_then `ip1` mp_tac) >> rw [] >>
`ip1.f ≠ l` by metis_tac [MEM_MAP] >>
fs [uses_weak, assigns_weak2] >>
first_x_assum drule >> rw [] >>
qexists_tac `ip2` >> rw [] >> rfs [] >>
metis_tac [assigns_weak2, dominates_weak])
>- (
`get_instr ((l,d)::p) ip i`
by (fs [get_instr_cases, MEM_MAP] >> rw [] >> metis_tac [ALOOKUP_MEM, FST]) >>
first_x_assum drule >> rw [reachable_def] >>
qexists_tac `path` >> rw [] >>
`(entry_ip ip.f).f ≠ l` suffices_by metis_tac [good_path_weak] >>
rw [entry_ip_def] >> fs [get_instr_cases, MEM_MAP] >>
CCONTR_TAC >> fs [] >> rw [] >>
metis_tac [FST, ALOOKUP_MEM])
QED
Theorem loc_prog_ok_weak:
∀l d p. ~mem l (map fst p) ∧ loc_prog_ok ((l,d)::p) ⇒ loc_prog_ok p
Proof
rw [loc_prog_ok_def, MEM_MAP] >>
metis_tac [ALOOKUP_MEM, FST]
QED
Triviality in_uncurry:
(x,y) ∈ UNCURRY R ⇔ R x y
Proof
rw [IN_DEF, UNCURRY_DEF]
QED
Theorem sorted_all_distinct_idx:
∀R l. all_distinct l ∧ transitive R ∧ reflexive R ∧ antisym (rrestrict (UNCURRY R) (set l)) ⇒
(SORTED R l ⇔ (∀i j. i < length l ∧ j < length l ⇒ (R (el i l) (el j l) ⇔ i ≤ j)))
Proof
Induct_on `l` >> rw [sortingTheory.SORTED_EQ] >>
`antisym (rrestrict (UNCURRY R) (set l))`
by (fs [antisym_def] >> rw [in_rrestrict]) >>
eq_tac >> rw []
>- (
Cases_on `i` >> Cases_on `j` >> rw [] >> fs []
>- fs [relationTheory.reflexive_def]
>- (first_x_assum irule >> rw [MEM_EL] >> metis_tac [])
>- (
fs [antisym_def] >>
last_x_assum (qspecl_then [`h`, `el n l`] mp_tac) >>
simp [in_rrestrict, in_uncurry] >> metis_tac [MEM_EL]))
>- (first_x_assum (qspecl_then [`Suc i`, `Suc j`] mp_tac) >> rw [])
>- (
fs [MEM_EL] >> rw [] >>
first_x_assum (qspecl_then [`0`, `Suc n`] mp_tac) >> rw [])
QED
Theorem lpc_uses_to_uses:
∀r bs lip prog f d.
r ∈ lpc_uses (map snd bs) lip ∧
alookup prog (Fn f) = Some d ∧
PERM d.blocks bs ∧
all_distinct (map fst (d.blocks))
⇒
r ∈ uses prog <| f := Fn f; b := fst (el (fst lip) bs); i := snd lip |> ∧
fst lip < length bs
Proof
rw [IN_DEF, uses_cases, lpc_uses_cases, get_instr_cases, PULL_EXISTS,
lpc_get_instr_cases] >>
rw []
>- (
qexists_tac `el i' (map snd bs)` >> rw [] >>
irule ALOOKUP_ALL_DISTINCT_MEM >> rw [] >>
drule sortingTheory.MEM_PERM >> rw [MEM_EL, EL_MAP] >>
metis_tac [pair_CASES, FST, SND])
>- (
qexists_tac `phis` >>
qexists_tac `el i (map snd bs)` >> rw [] >>
qexists_tac `s` >> rw [] >>
irule ALOOKUP_ALL_DISTINCT_MEM >> rw [] >>
drule sortingTheory.MEM_PERM >> rw [MEM_EL, EL_MAP] >>
metis_tac [pair_CASES, FST, SND])
QED
Theorem assigns_to_block_assigns:
∀prog ip d b r l.
r ∈ assigns prog ip ∧
alookup prog ip.f = Some d ∧
alookup d.blocks ip.b = Some b
⇒
fst r ∈ block_assigns (l:label option, b)
Proof
rw [] >>
qpat_x_assum `_ ∈ assigns _ _` mp_tac >>
simp [Once IN_DEF] >>
rw [assigns_cases, get_instr_cases, PULL_EXISTS, block_assigns_def]
>- (
disj2_tac >>
qexists_tac `r` >> HINT_EXISTS_TAC >>
metis_tac [MEM_EL])
>- (
rw [header_assigns_def, MEM_MAP] >>
disj1_tac >>
fs [MEM_MAP] >> rw [] >>
metis_tac [])
QED
Theorem assigns_to_lpc_assigns:
∀prog ip d r idx (bs : (label option # block) list).
r ∈ assigns prog ip ∧
alookup prog ip.f = Some d ∧
alookup d.blocks ip.b = Some (snd (el idx bs)) ∧
idx < length bs
⇒
r ∈ lpc_assigns (map snd bs) (idx, ip.i)
Proof
rw [assigns_cases, get_instr_cases, PULL_EXISTS, block_assigns_def,
lpc_assigns_cases, IN_DEF, lpc_get_instr_cases] >>
fs [] >> rw [] >> fs [] >> rw [EL_MAP]
QED
Theorem uses_to_block_uses:
∀prog ip d b r l.
r ∈ uses prog ip ∧
alookup prog ip.f = Some d ∧
alookup d.blocks ip.b = Some b
⇒
r ∈ block_uses (l:label option, b)
Proof
rw [] >>
qpat_x_assum `_ ∈ uses _ _` mp_tac >>
simp [Once IN_DEF] >>
rw [uses_cases, get_instr_cases, PULL_EXISTS, block_uses_def]
>- (
disj2_tac >>
metis_tac [MEM_EL])
>- (
rw [header_uses_def, MEM_MAP] >>
disj1_tac >>
fs [MEM_MAP] >> rw [] >>
metis_tac [])
QED
Theorem same_block_assigns_less_uses:
reachable prog ip1 ∧
dominates prog ip2 ip1 ∧
ip1.b = ip2.b ∧
(?i. get_instr prog ip1 i) ∧
(∀fname dec.
alookup prog fname = Some dec ⇒
every (λb. fst b = None ⇔ (snd b).h = Entry) dec.blocks)
⇒
bip_less ip2.i ip1.i
Proof
rw [] >> CCONTR_TAC >> fs [] >>
`ip1.f = ip2.f` by metis_tac [reachable_dominates_same_func] >>
`ip_equiv ip1 ip2 ∨ bip_less ip1.i ip2.i` by metis_tac [bip_less_tri]
>- metis_tac [ip_equiv_dominates2, dominates_irrefl, ip_equiv_sym] >>
metis_tac [dominates_antisym, same_block_dominates]
QED
Theorem ssa_to_dominator_ordered_lem:
∀p1. loc_prog_ok p1 ∧ is_ssa p1 ∧ all_distinct (map fst p1) ∧ every (λ(l,d). all_distinct (map fst d.blocks)) p1 ⇒
∃p2. list_rel (\(l1,d1) (l2,d2). l1 = l2 ∧ PERM d1.blocks d2.blocks) p1 p2 ∧
dominator_ordered p2
Proof
Induct_on `p1` >> rw []
>- rw [dominator_ordered_def] >>
`is_ssa p1` by metis_tac [is_ssa_weak, pair_CASES, FST] >>
`loc_prog_ok p1` by metis_tac [loc_prog_ok_weak, pair_CASES, FST] >>
fs [PULL_EXISTS] >>
rename1 `is_ssa (x::_)` >>
`?l d. x = (l,d)` by metis_tac [pair_CASES] >>
`partial_order (rc (block_order d.blocks) (set d.blocks)) (set d.blocks)`
by metis_tac [block_order_po, ALOOKUP_def] >>
rw [] >>
`finite (set d.blocks)` by rw [] >>
drule finite_linear_order_of_finite_po >>
disch_then drule >> rw [] >>
drule finite_linear_order_to_list >>
disch_then drule >> rw [] >>
rename1 `set _ = set bs` >>
qexists_tac `(l, d with blocks := bs)` >>
qexists_tac `p2` >>
conj_asm1_tac >> rw [] >>
fs []
>- (irule sortingTheory.PERM_ALL_DISTINCT >> rw [] >> metis_tac [ALL_DISTINCT_MAP]) >>
qmatch_assum_abbrev_tac `SORTED R _` >>
`transitive R ∧ reflexive R ∧ antisym (rrestrict (UNCURRY R) (set bs))`
by (
fs [linear_order_def, transitive_def, reflexive_def, SUBSET_DEF,
antisym_def, domain_def, range_def, in_rrestrict] >>
rw [Abbr `R`, relationTheory.transitive_def, relationTheory.reflexive_def] >>
fs [IN_DEF] >> metis_tac []) >>
drule sorted_all_distinct_idx >>
disch_then drule >> rw [] >>
fs [dominator_ordered_def] >> rw [PULL_EXISTS] >> fs []
>- (
drule lpc_uses_to_uses >>
disch_then (qspecl_then [`(Fn f,d)::p1`, `f`, `d`] mp_tac) >>
rw [] >>
qmatch_assum_abbrev_tac `_ ∈ uses prog ip1` >>
`?ip2. ip2.f = Fn f ∧ r ∈ image fst (assigns prog ip2) ∧ dominates prog ip2 ip1`
by (fs [is_ssa_def] >> last_x_assum drule >> rw [Abbr `ip1`]) >>
`?idx. idx < length bs ∧ alookup d.blocks ip2.b = Some (snd (el idx bs)) ∧
fst (el idx bs) = ip2.b`
by (
fs [assigns_cases, IN_DEF, get_instr_cases, Abbr `prog`] >>
rfs [] >>
drule ALOOKUP_MEM >>
drule sortingTheory.MEM_PERM >>
rw [MEM_EL] >>
metis_tac [FST, SND]) >>
`?t. (r, t) ∈ assigns prog ip2` by metis_tac [IN_IMAGE, pair_CASES, FST] >>
drule assigns_to_block_assigns >> rw [Abbr `prog`] >>
qexists_tac `(idx, ip2.i)` >>
qexists_tac `(r, t)` >>
rw []
>- (
`(el idx bs, el (fst lip1) bs) ∈ rc (block_order d.blocks) (set d.blocks)`
by (
simp [rc_def, block_order_def, EL_MEM] >>
drule uses_to_block_uses >> simp [Abbr `ip1`] >>
`alookup d.blocks (fst (el (fst lip1) bs)) = Some (snd (el (fst lip1) bs))`
by (
qmatch_goalsub_abbrev_tac `(fst b)` >>
`mem b bs` by (rw [Abbr `b`, MEM_EL] >> metis_tac []) >>
metis_tac [ALOOKUP_ALL_DISTINCT_MEM, PAIR]) >>
rw [METIS_PROVE [] ``a ∨ b ⇔ ~b ⇒ a``] >>
simp [Once tc_cases] >>
disj1_tac >> rw [MEM_EL]
>- (
`all_distinct (map fst bs)`
by (
irule ALL_DISTINCT_MAP_INJ >> rw [] >>
`mem x d.blocks ∧ mem y d.blocks` by metis_tac [sortingTheory.MEM_PERM] >>
metis_tac [PAIR, ALOOKUP_ALL_DISTINCT_MEM, optionTheory.SOME_11]) >>
metis_tac [PAIR, optionTheory.SOME_11]) >>
metis_tac [PAIR, FST]) >>
rw [] >>
`idx ≤ fst lip1`
by (
`R (el idx bs) (el (fst lip1) bs)` suffices_by metis_tac [] >>
fs [Abbr `R`, SUBSET_DEF, rc_def] >> metis_tac []) >>
PairCases_on `lip1` >>
rw [linear_pc_less_def, LEX_DEF_THM] >> fs [LESS_OR_EQ] >>
rw [] >>
`reachable ((Fn f,d)::p1) ip1`
by (
fs [is_ssa_def] >> first_x_assum irule >>
fs [uses_cases, IN_DEF] >> metis_tac []) >>
drule same_block_assigns_less_uses >>
disch_then drule >> simp [Abbr `ip1`] >>
disch_then irule >> rw [] >>
fs [uses_cases, IN_DEF, loc_prog_ok_def] >>
metis_tac [])
>- (drule assigns_to_lpc_assigns >> simp []))
>- metis_tac []
QED
Theorem prog_ok_to_loc_prog_ok:
∀p. prog_ok p ⇒ loc_prog_ok p
Proof
rw [prog_ok_def, loc_prog_ok_def] >> metis_tac []
QED
Theorem alookup_perm_blocks:
∀p1 p2.
list_rel (λ(l1,d1) (l2,d2). l1 = l2 ∧ PERM d1.blocks d2.blocks) p1 p2
⇒
(∀l d. alookup p2 l = Some d ⇒ ?d'. alookup p1 l = Some d' ∧ PERM d'.blocks d.blocks) ∧
(∀l d. alookup p1 l = Some d ⇒ ?d'. alookup p2 l = Some d' ∧ PERM d.blocks d'.blocks) ∧
(map fst p1 = map fst p2)
Proof
Induct_on `p1` >> rw [] >>
pairarg_tac >> fs [] >> pairarg_tac >> fs [] >> rw [] >> rw [] >> fs [] >>
metis_tac []
QED
Theorem alookup_perm:
∀b1 b2. PERM b1 b2 ∧ all_distinct (map fst b1) ⇒ alookup b1 = alookup b2
Proof
rw [] >>
irule ALOOKUP_ALL_DISTINCT_PERM_same >>
rw [sortingTheory.PERM_MAP, sortingTheory.PERM_LIST_TO_SET]
QED
Theorem get_instr_perm_blocks:
every (\(l,d). all_distinct (map fst d.blocks)) p1 ∧
list_rel (λ(l1,d1) (l2,d2). l1 = l2 ∧ PERM d1.blocks d2.blocks) p1 p2
⇒
get_instr p1 = get_instr p2
Proof
rw [get_instr_cases, FUN_EQ_THM] >>
eq_tac >> rw [] >>
drule alookup_perm_blocks >> rw [] >>
first_x_assum drule >> rw [] >> rw [] >>
`all_distinct (map fst d.blocks)`
by (
fs [EVERY_MEM] >>
imp_res_tac ALOOKUP_MEM >>
res_tac >> fs [] >>
metis_tac [sortingTheory.ALL_DISTINCT_PERM, sortingTheory.PERM_MAP]) >>
metis_tac [alookup_perm, sortingTheory.PERM_SYM]
QED
Theorem next_ips_perm_blocks:
every (\(l,d). all_distinct (map fst d.blocks)) p1 ∧
list_rel (λ(l1,d1) (l2,d2). l1 = l2 ∧ PERM d1.blocks d2.blocks) p1 p2
⇒
next_ips p1 = next_ips p2
Proof
rw [FUN_EQ_THM, next_ips_cases] >> metis_tac [get_instr_perm_blocks]
QED
Theorem good_path_perm_blocks:
∀p1 p2.
every (\(l,d). all_distinct (map fst d.blocks)) p1 ∧
list_rel (λ(l1,d1) (l2,d2). l1 = l2 ∧ PERM d1.blocks d2.blocks) p1 p2
⇒
good_path p1 = good_path p2
Proof
rw [] >> simp [FUN_EQ_THM] >>
Induct >> rw [] >>
ONCE_REWRITE_TAC [good_path_cases] >> rw [] >>
metis_tac [next_ips_perm_blocks, get_instr_perm_blocks]
QED
Theorem ssa_to_dominator_ordered:
∀p1.
prog_ok p1 ∧ is_ssa p1
⇒
∃p2. list_rel (\(l1,d1) (l2,d2). l1 = l2 ∧ PERM d1.blocks d2.blocks) p1 p2 ∧
dominator_ordered p2 ∧ prog_ok p2 ∧ is_ssa p2
Proof
rw [] >>
drule prog_ok_to_loc_prog_ok >> rw [] >>
drule ssa_to_dominator_ordered_lem >> simp [] >>
impl_tac
>- (
fs [prog_ok_def] >> rw [EVERY_MEM] >>
pairarg_tac >> fs [] >> rw [] >> metis_tac [ALOOKUP_ALL_DISTINCT_MEM]) >>
rw [] >>
qexists_tac `p2` >> rw [] >>
`every (λ(l,d). all_distinct (map fst d.blocks)) p1`
by fs [prog_ok_def] >>
drule get_instr_perm_blocks >> disch_then drule >> rw [] >>
drule good_path_perm_blocks >> disch_then drule >> rw []
>- (
drule alookup_perm_blocks >> rw [] >>
fs [prog_ok_def] >>
conj_tac
>- (
rw [] >> rpt (last_x_assum (qspec_then `fname` mp_tac)) >> rw [] >>
metis_tac [alookup_perm, sortingTheory.MEM_PERM, prog_ok_distinct_lem]) >>
conj_tac >- metis_tac [alookup_perm, sortingTheory.MEM_PERM, prog_ok_distinct_lem] >>
conj_tac >- (fs [EVERY_MEM] >> metis_tac [alookup_perm, sortingTheory.MEM_PERM]) >>
conj_tac
>- (
rfs [LIST_REL_EL_EQN, EVERY_EL] >> rw [] >>
pairarg_tac >> fs [] >>
rpt (first_x_assum (qspec_then `n` mp_tac)) >> rw [] >>
pairarg_tac >> fs [] >>
metis_tac [sortingTheory.ALL_DISTINCT_PERM, sortingTheory.PERM_MAP]) >>
conj_tac >- metis_tac [alookup_perm, sortingTheory.MEM_PERM]
>- metis_tac [alookup_perm, sortingTheory.MEM_PERM])
>- (
fs [is_ssa_def, IN_DEF, uses_cases, assigns_cases, reachable_def, dominates_def] >>
rw [] >>
first_x_assum irule >> metis_tac [])
QED
export_theory ();
| Standard ML | 5 | JacobBarthelmeh/infer | sledge/semantics/llvm_ssaScript.sml | [
"MIT"
] |
exec("swigtest.start", -1);
f = new_Foo();
b = new_Bar();
v = malloc_void(32);
// Functions
checkequal(foo(int32(3)), "foo:int", "foo(int)");
checkequal(foo(3), "foo:double", "foo(double)");
checkequal(foo("hello"), "foo:char *", "foo(char* )");
checkequal(foo(f), "foo:Foo *", "foo(Foo *)");
checkequal(foo(b), "foo:Bar *", "foo(Bar *)");
checkequal(foo(v), "foo:void *", "foo(void *)");
// Class methods
s = new_Spam();
checkequal(Spam_foo(s, int32(3)), "foo:int", "Spam::foo(int)");
checkequal(Spam_foo(s, 3), "foo:double", "Spam::foo(double)");
checkequal(Spam_foo(s, "hello"), "foo:char *", "Spam::foo(char *)");
checkequal(Spam_foo(s, f), "foo:Foo *", "Spam::foo(Foo *)");
checkequal(Spam_foo(s, b), "foo:Bar *", "Spam::foo(Bar *)");
checkequal(Spam_foo(s, v), "foo:void *", "Spam::foo(void *)");
delete_Spam(s);
// Static class methods
checkequal(Spam_bar(int32(3)), "bar:int", "Spam::bar(int)");
checkequal(Spam_bar(3.1), "bar:double", "Spam::bar(double)");
checkequal(Spam_bar("hello"), "bar:char *", "Spam::bar(char *)");
checkequal(Spam_bar(f), "bar:Foo *", "Spam::bar(Foo *)");
checkequal(Spam_bar(b), "bar:Bar *", "Spam::bar(Bar *)");
checkequal(Spam_bar(v), "bar:void *", "Spam::bar(void *)");
// Constructors
s = new_Spam();
checkequal(Spam_type_get(s), "none", "Spam::Spam()");
delete_Spam(s);
s = new_Spam(int32(3));
checkequal(Spam_type_get(s), "int", "Spam::Spam(int)");
delete_Spam(s);
s = new_Spam(3.1);
checkequal(Spam_type_get(s), "double", "Spam::Spam(double)");
delete_Spam(s);
s = new_Spam("hello");
checkequal(Spam_type_get(s), "char *", "Spam::Spam(char *)");
delete_Spam(s);
s = new_Spam(f);
checkequal(Spam_type_get(s), "Foo *", "Spam::Spam(Foo *)");
delete_Spam(s);
s = new_Spam(b);
checkequal(Spam_type_get(s), "Bar *", "Spam::Spam(Bar *)");
delete_Spam(s);
s = new_Spam(v);
checkequal(Spam_type_get(s), "void *", "Spam::Spam(void *)");
delete_Spam(s);
delete_Foo(f);
delete_Bar(b);
free_void(v);
a = new_ClassA();
b = ClassA_method1(a, 1);
delete_ClassA(a);
exec("swigtest.quit", -1);
| Scilab | 4 | kyletanyag/LL-Smartcard | cacreader/swig-4.0.2/Examples/test-suite/scilab/overload_simple_runme.sci | [
"BSD-3-Clause"
] |
--TEST--
SplFixedArray::toArray with empty array
--CREDITS--
Gabriel Caruso (carusogabriel34@gmail.com)
--FILE--
<?php var_dump((new SplFixedArray())->toArray()); ?>
--EXPECT--
array(0) {
}
| PHP | 3 | thiagooak/php-src | ext/spl/tests/SplFixedArray_toArray_empty.phpt | [
"PHP-3.01"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.