arduino_ci 0.1.3 → 0.1.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (295) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +77 -1
  3. data/cpp/arduino/Arduino.cpp +17 -7
  4. data/cpp/arduino/Arduino.h +151 -5
  5. data/cpp/arduino/ArduinoDefines.h +90 -0
  6. data/cpp/arduino/AvrMath.h +18 -28
  7. data/cpp/arduino/Godmode.cpp +62 -0
  8. data/cpp/arduino/Godmode.h +74 -0
  9. data/cpp/arduino/HardwareSerial.h +81 -0
  10. data/cpp/arduino/Print.h +67 -0
  11. data/cpp/arduino/Stream.h +210 -0
  12. data/cpp/arduino/WCharacter.h +96 -0
  13. data/cpp/arduino/WString.h +164 -0
  14. data/cpp/arduino/binary.h +518 -0
  15. data/cpp/arduino/include/README.md +3 -0
  16. data/cpp/arduino/include/common.h +333 -0
  17. data/cpp/arduino/include/fuse.h +274 -0
  18. data/cpp/arduino/include/io.h +643 -0
  19. data/cpp/arduino/include/io1200.h +274 -0
  20. data/cpp/arduino/include/io2313.h +385 -0
  21. data/cpp/arduino/include/io2323.h +210 -0
  22. data/cpp/arduino/include/io2333.h +461 -0
  23. data/cpp/arduino/include/io2343.h +214 -0
  24. data/cpp/arduino/include/io43u32x.h +440 -0
  25. data/cpp/arduino/include/io43u35x.h +432 -0
  26. data/cpp/arduino/include/io4414.h +500 -0
  27. data/cpp/arduino/include/io4433.h +489 -0
  28. data/cpp/arduino/include/io4434.h +588 -0
  29. data/cpp/arduino/include/io76c711.h +499 -0
  30. data/cpp/arduino/include/io8515.h +501 -0
  31. data/cpp/arduino/include/io8534.h +217 -0
  32. data/cpp/arduino/include/io8535.h +589 -0
  33. data/cpp/arduino/include/io86r401.h +309 -0
  34. data/cpp/arduino/include/io90pwm1.h +1157 -0
  35. data/cpp/arduino/include/io90pwm161.h +918 -0
  36. data/cpp/arduino/include/io90pwm216.h +1225 -0
  37. data/cpp/arduino/include/io90pwm2b.h +1466 -0
  38. data/cpp/arduino/include/io90pwm316.h +1272 -0
  39. data/cpp/arduino/include/io90pwm3b.h +1466 -0
  40. data/cpp/arduino/include/io90pwm81.h +1036 -0
  41. data/cpp/arduino/include/io90pwmx.h +1415 -0
  42. data/cpp/arduino/include/io90scr100.h +1719 -0
  43. data/cpp/arduino/include/ioa5272.h +803 -0
  44. data/cpp/arduino/include/ioa5505.h +803 -0
  45. data/cpp/arduino/include/ioa5702m322.h +2591 -0
  46. data/cpp/arduino/include/ioa5782.h +1843 -0
  47. data/cpp/arduino/include/ioa5790.h +907 -0
  48. data/cpp/arduino/include/ioa5790n.h +922 -0
  49. data/cpp/arduino/include/ioa5791.h +923 -0
  50. data/cpp/arduino/include/ioa5795.h +756 -0
  51. data/cpp/arduino/include/ioa5831.h +1949 -0
  52. data/cpp/arduino/include/ioa6285.h +740 -0
  53. data/cpp/arduino/include/ioa6286.h +740 -0
  54. data/cpp/arduino/include/ioa6289.h +847 -0
  55. data/cpp/arduino/include/ioa6612c.h +795 -0
  56. data/cpp/arduino/include/ioa6613c.h +795 -0
  57. data/cpp/arduino/include/ioa6614q.h +798 -0
  58. data/cpp/arduino/include/ioa6616c.h +865 -0
  59. data/cpp/arduino/include/ioa6617c.h +865 -0
  60. data/cpp/arduino/include/ioa664251.h +857 -0
  61. data/cpp/arduino/include/ioa8210.h +1843 -0
  62. data/cpp/arduino/include/ioa8510.h +1949 -0
  63. data/cpp/arduino/include/ioat94k.h +565 -0
  64. data/cpp/arduino/include/iocan128.h +100 -0
  65. data/cpp/arduino/include/iocan32.h +100 -0
  66. data/cpp/arduino/include/iocan64.h +100 -0
  67. data/cpp/arduino/include/iocanxx.h +2020 -0
  68. data/cpp/arduino/include/iom103.h +735 -0
  69. data/cpp/arduino/include/iom128.h +1299 -0
  70. data/cpp/arduino/include/iom1280.h +101 -0
  71. data/cpp/arduino/include/iom1281.h +101 -0
  72. data/cpp/arduino/include/iom1284.h +1099 -0
  73. data/cpp/arduino/include/iom1284p.h +1219 -0
  74. data/cpp/arduino/include/iom1284rfr2.h +2690 -0
  75. data/cpp/arduino/include/iom128a.h +1070 -0
  76. data/cpp/arduino/include/iom128rfa1.h +5385 -0
  77. data/cpp/arduino/include/iom128rfr2.h +2706 -0
  78. data/cpp/arduino/include/iom16.h +676 -0
  79. data/cpp/arduino/include/iom161.h +726 -0
  80. data/cpp/arduino/include/iom162.h +1022 -0
  81. data/cpp/arduino/include/iom163.h +686 -0
  82. data/cpp/arduino/include/iom164.h +101 -0
  83. data/cpp/arduino/include/iom164a.h +34 -0
  84. data/cpp/arduino/include/iom164p.h +34 -0
  85. data/cpp/arduino/include/iom164pa.h +1016 -0
  86. data/cpp/arduino/include/iom165.h +887 -0
  87. data/cpp/arduino/include/iom165a.h +832 -0
  88. data/cpp/arduino/include/iom165p.h +889 -0
  89. data/cpp/arduino/include/iom165pa.h +948 -0
  90. data/cpp/arduino/include/iom168.h +97 -0
  91. data/cpp/arduino/include/iom168a.h +35 -0
  92. data/cpp/arduino/include/iom168p.h +942 -0
  93. data/cpp/arduino/include/iom168pa.h +843 -0
  94. data/cpp/arduino/include/iom168pb.h +899 -0
  95. data/cpp/arduino/include/iom169.h +1174 -0
  96. data/cpp/arduino/include/iom169a.h +44 -0
  97. data/cpp/arduino/include/iom169p.h +1097 -0
  98. data/cpp/arduino/include/iom169pa.h +1485 -0
  99. data/cpp/arduino/include/iom16a.h +923 -0
  100. data/cpp/arduino/include/iom16hva.h +80 -0
  101. data/cpp/arduino/include/iom16hva2.h +883 -0
  102. data/cpp/arduino/include/iom16hvb.h +1052 -0
  103. data/cpp/arduino/include/iom16hvbrevb.h +1052 -0
  104. data/cpp/arduino/include/iom16m1.h +1571 -0
  105. data/cpp/arduino/include/iom16u2.h +1000 -0
  106. data/cpp/arduino/include/iom16u4.h +1423 -0
  107. data/cpp/arduino/include/iom2560.h +101 -0
  108. data/cpp/arduino/include/iom2561.h +101 -0
  109. data/cpp/arduino/include/iom2564rfr2.h +2691 -0
  110. data/cpp/arduino/include/iom256rfr2.h +2707 -0
  111. data/cpp/arduino/include/iom3000.h +237 -0
  112. data/cpp/arduino/include/iom32.h +755 -0
  113. data/cpp/arduino/include/iom323.h +744 -0
  114. data/cpp/arduino/include/iom324a.h +1014 -0
  115. data/cpp/arduino/include/iom324p.h +1016 -0
  116. data/cpp/arduino/include/iom324pa.h +1372 -0
  117. data/cpp/arduino/include/iom325.h +886 -0
  118. data/cpp/arduino/include/iom3250.h +982 -0
  119. data/cpp/arduino/include/iom3250a.h +34 -0
  120. data/cpp/arduino/include/iom3250p.h +34 -0
  121. data/cpp/arduino/include/iom3250pa.h +1042 -0
  122. data/cpp/arduino/include/iom325a.h +34 -0
  123. data/cpp/arduino/include/iom325p.h +34 -0
  124. data/cpp/arduino/include/iom325pa.h +937 -0
  125. data/cpp/arduino/include/iom328.h +34 -0
  126. data/cpp/arduino/include/iom328p.h +948 -0
  127. data/cpp/arduino/include/iom329.h +1069 -0
  128. data/cpp/arduino/include/iom3290.h +1227 -0
  129. data/cpp/arduino/include/iom3290a.h +34 -0
  130. data/cpp/arduino/include/iom3290pa.h +1123 -0
  131. data/cpp/arduino/include/iom329a.h +34 -0
  132. data/cpp/arduino/include/iom329p.h +1164 -0
  133. data/cpp/arduino/include/iom329pa.h +34 -0
  134. data/cpp/arduino/include/iom32a.h +686 -0
  135. data/cpp/arduino/include/iom32c1.h +1320 -0
  136. data/cpp/arduino/include/iom32hvb.h +1052 -0
  137. data/cpp/arduino/include/iom32hvbrevb.h +953 -0
  138. data/cpp/arduino/include/iom32m1.h +1625 -0
  139. data/cpp/arduino/include/iom32u2.h +1000 -0
  140. data/cpp/arduino/include/iom32u4.h +1512 -0
  141. data/cpp/arduino/include/iom32u6.h +1431 -0
  142. data/cpp/arduino/include/iom406.h +783 -0
  143. data/cpp/arduino/include/iom48.h +93 -0
  144. data/cpp/arduino/include/iom48a.h +35 -0
  145. data/cpp/arduino/include/iom48p.h +936 -0
  146. data/cpp/arduino/include/iom48pa.h +839 -0
  147. data/cpp/arduino/include/iom48pb.h +890 -0
  148. data/cpp/arduino/include/iom64.h +1311 -0
  149. data/cpp/arduino/include/iom640.h +101 -0
  150. data/cpp/arduino/include/iom644.h +101 -0
  151. data/cpp/arduino/include/iom644a.h +34 -0
  152. data/cpp/arduino/include/iom644p.h +101 -0
  153. data/cpp/arduino/include/iom644pa.h +1387 -0
  154. data/cpp/arduino/include/iom644rfr2.h +2685 -0
  155. data/cpp/arduino/include/iom645.h +881 -0
  156. data/cpp/arduino/include/iom6450.h +978 -0
  157. data/cpp/arduino/include/iom6450a.h +34 -0
  158. data/cpp/arduino/include/iom6450p.h +34 -0
  159. data/cpp/arduino/include/iom645a.h +34 -0
  160. data/cpp/arduino/include/iom645p.h +34 -0
  161. data/cpp/arduino/include/iom649.h +1061 -0
  162. data/cpp/arduino/include/iom6490.h +1182 -0
  163. data/cpp/arduino/include/iom6490a.h +34 -0
  164. data/cpp/arduino/include/iom6490p.h +34 -0
  165. data/cpp/arduino/include/iom649a.h +34 -0
  166. data/cpp/arduino/include/iom649p.h +1490 -0
  167. data/cpp/arduino/include/iom64a.h +1084 -0
  168. data/cpp/arduino/include/iom64c1.h +1321 -0
  169. data/cpp/arduino/include/iom64hve.h +1034 -0
  170. data/cpp/arduino/include/iom64hve2.h +767 -0
  171. data/cpp/arduino/include/iom64m1.h +1572 -0
  172. data/cpp/arduino/include/iom64rfr2.h +2701 -0
  173. data/cpp/arduino/include/iom8.h +665 -0
  174. data/cpp/arduino/include/iom8515.h +687 -0
  175. data/cpp/arduino/include/iom8535.h +772 -0
  176. data/cpp/arduino/include/iom88.h +97 -0
  177. data/cpp/arduino/include/iom88a.h +35 -0
  178. data/cpp/arduino/include/iom88p.h +941 -0
  179. data/cpp/arduino/include/iom88pa.h +1185 -0
  180. data/cpp/arduino/include/iom88pb.h +899 -0
  181. data/cpp/arduino/include/iom8a.h +621 -0
  182. data/cpp/arduino/include/iom8hva.h +76 -0
  183. data/cpp/arduino/include/iom8u2.h +997 -0
  184. data/cpp/arduino/include/iomx8.h +808 -0
  185. data/cpp/arduino/include/iomxx0_1.h +1692 -0
  186. data/cpp/arduino/include/iomxx4.h +954 -0
  187. data/cpp/arduino/include/iomxxhva.h +550 -0
  188. data/cpp/arduino/include/iotn10.h +512 -0
  189. data/cpp/arduino/include/iotn11.h +255 -0
  190. data/cpp/arduino/include/iotn12.h +288 -0
  191. data/cpp/arduino/include/iotn13.h +395 -0
  192. data/cpp/arduino/include/iotn13a.h +394 -0
  193. data/cpp/arduino/include/iotn15.h +363 -0
  194. data/cpp/arduino/include/iotn1634.h +914 -0
  195. data/cpp/arduino/include/iotn167.h +883 -0
  196. data/cpp/arduino/include/iotn20.h +776 -0
  197. data/cpp/arduino/include/iotn22.h +221 -0
  198. data/cpp/arduino/include/iotn2313.h +702 -0
  199. data/cpp/arduino/include/iotn2313a.h +812 -0
  200. data/cpp/arduino/include/iotn24.h +94 -0
  201. data/cpp/arduino/include/iotn24a.h +846 -0
  202. data/cpp/arduino/include/iotn25.h +93 -0
  203. data/cpp/arduino/include/iotn26.h +422 -0
  204. data/cpp/arduino/include/iotn261.h +93 -0
  205. data/cpp/arduino/include/iotn261a.h +987 -0
  206. data/cpp/arduino/include/iotn28.h +297 -0
  207. data/cpp/arduino/include/iotn4.h +477 -0
  208. data/cpp/arduino/include/iotn40.h +767 -0
  209. data/cpp/arduino/include/iotn4313.h +813 -0
  210. data/cpp/arduino/include/iotn43u.h +604 -0
  211. data/cpp/arduino/include/iotn44.h +94 -0
  212. data/cpp/arduino/include/iotn441.h +903 -0
  213. data/cpp/arduino/include/iotn44a.h +844 -0
  214. data/cpp/arduino/include/iotn45.h +93 -0
  215. data/cpp/arduino/include/iotn461.h +94 -0
  216. data/cpp/arduino/include/iotn461a.h +987 -0
  217. data/cpp/arduino/include/iotn48.h +806 -0
  218. data/cpp/arduino/include/iotn5.h +512 -0
  219. data/cpp/arduino/include/iotn828.h +911 -0
  220. data/cpp/arduino/include/iotn84.h +94 -0
  221. data/cpp/arduino/include/iotn841.h +903 -0
  222. data/cpp/arduino/include/iotn84a.h +844 -0
  223. data/cpp/arduino/include/iotn85.h +93 -0
  224. data/cpp/arduino/include/iotn861.h +94 -0
  225. data/cpp/arduino/include/iotn861a.h +988 -0
  226. data/cpp/arduino/include/iotn87.h +859 -0
  227. data/cpp/arduino/include/iotn88.h +806 -0
  228. data/cpp/arduino/include/iotn9.h +477 -0
  229. data/cpp/arduino/include/iotnx4.h +482 -0
  230. data/cpp/arduino/include/iotnx5.h +442 -0
  231. data/cpp/arduino/include/iotnx61.h +541 -0
  232. data/cpp/arduino/include/iousb1286.h +101 -0
  233. data/cpp/arduino/include/iousb1287.h +101 -0
  234. data/cpp/arduino/include/iousb162.h +101 -0
  235. data/cpp/arduino/include/iousb646.h +102 -0
  236. data/cpp/arduino/include/iousb647.h +102 -0
  237. data/cpp/arduino/include/iousb82.h +95 -0
  238. data/cpp/arduino/include/iousbxx2.h +807 -0
  239. data/cpp/arduino/include/iousbxx6_7.h +1336 -0
  240. data/cpp/arduino/include/iox128a1.h +7236 -0
  241. data/cpp/arduino/include/iox128a1u.h +8305 -0
  242. data/cpp/arduino/include/iox128a3.h +6987 -0
  243. data/cpp/arduino/include/iox128a3u.h +7697 -0
  244. data/cpp/arduino/include/iox128a4u.h +7309 -0
  245. data/cpp/arduino/include/iox128b1.h +6872 -0
  246. data/cpp/arduino/include/iox128b3.h +6288 -0
  247. data/cpp/arduino/include/iox128c3.h +6264 -0
  248. data/cpp/arduino/include/iox128d3.h +5749 -0
  249. data/cpp/arduino/include/iox128d4.h +5562 -0
  250. data/cpp/arduino/include/iox16a4.h +6748 -0
  251. data/cpp/arduino/include/iox16a4u.h +7309 -0
  252. data/cpp/arduino/include/iox16c4.h +6078 -0
  253. data/cpp/arduino/include/iox16d4.h +5717 -0
  254. data/cpp/arduino/include/iox16e5.h +7699 -0
  255. data/cpp/arduino/include/iox192a3.h +6987 -0
  256. data/cpp/arduino/include/iox192a3u.h +7697 -0
  257. data/cpp/arduino/include/iox192c3.h +6264 -0
  258. data/cpp/arduino/include/iox192d3.h +5749 -0
  259. data/cpp/arduino/include/iox256a3.h +6987 -0
  260. data/cpp/arduino/include/iox256a3b.h +6983 -0
  261. data/cpp/arduino/include/iox256a3bu.h +7706 -0
  262. data/cpp/arduino/include/iox256a3u.h +7697 -0
  263. data/cpp/arduino/include/iox256c3.h +6264 -0
  264. data/cpp/arduino/include/iox256d3.h +5709 -0
  265. data/cpp/arduino/include/iox32a4.h +6747 -0
  266. data/cpp/arduino/include/iox32a4u.h +7309 -0
  267. data/cpp/arduino/include/iox32c3.h +6264 -0
  268. data/cpp/arduino/include/iox32c4.h +6078 -0
  269. data/cpp/arduino/include/iox32d3.h +5105 -0
  270. data/cpp/arduino/include/iox32d4.h +5685 -0
  271. data/cpp/arduino/include/iox32e5.h +7699 -0
  272. data/cpp/arduino/include/iox384c3.h +6849 -0
  273. data/cpp/arduino/include/iox384d3.h +5833 -0
  274. data/cpp/arduino/include/iox64a1.h +7236 -0
  275. data/cpp/arduino/include/iox64a1u.h +8305 -0
  276. data/cpp/arduino/include/iox64a3.h +6987 -0
  277. data/cpp/arduino/include/iox64a3u.h +7697 -0
  278. data/cpp/arduino/include/iox64a4u.h +7309 -0
  279. data/cpp/arduino/include/iox64b1.h +6454 -0
  280. data/cpp/arduino/include/iox64b3.h +6288 -0
  281. data/cpp/arduino/include/iox64c3.h +6264 -0
  282. data/cpp/arduino/include/iox64d3.h +5764 -0
  283. data/cpp/arduino/include/iox64d4.h +5555 -0
  284. data/cpp/arduino/include/iox8e5.h +7699 -0
  285. data/cpp/arduino/include/lock.h +239 -0
  286. data/cpp/arduino/include/portpins.h +549 -0
  287. data/cpp/arduino/include/version.h +90 -0
  288. data/cpp/arduino/include/xmega.h +71 -0
  289. data/cpp/unittest/Assertion.h +9 -4
  290. data/cpp/unittest/Compare.h +93 -0
  291. data/lib/arduino_ci/arduino_installation.rb +1 -1
  292. data/lib/arduino_ci/cpp_library.rb +4 -1
  293. data/lib/arduino_ci/version.rb +1 -1
  294. data/misc/default.yaml +7 -0
  295. metadata +285 -2
@@ -0,0 +1,96 @@
1
+ #pragma once
2
+
3
+ inline bool isAlpha(int c) {
4
+ unsigned int data[16] = {
5
+ 0x0000, 0x0000, 0x0000, 0x0000,
6
+ 0xfffe, 0x07ff, 0xfffe, 0x07ff,
7
+ 0x0000, 0x0000, 0x0000, 0x0000,
8
+ 0xffff, 0xff7f, 0xffff, 0xff7f };
9
+ return data[c / 16] & (1 << (c % 16));
10
+ }
11
+
12
+ inline bool isDigit(int c) {
13
+ return '0' <= c && c <= '9';
14
+ }
15
+
16
+ inline bool isAlphaNumeric(unsigned char c) {
17
+ return isAlpha(c) || isDigit(c);
18
+ }
19
+
20
+ inline bool isAscii(int c) {
21
+ return ((unsigned char)(c)) <= 0x7f;
22
+ }
23
+
24
+ inline bool isControl(int c) {
25
+ unsigned int data[16] = {
26
+ 0xffff, 0xffff, 0x0000, 0x0000,
27
+ 0x0000, 0x0000, 0x0000, 0x8000,
28
+ 0x0000, 0x0000, 0x0000, 0x0000,
29
+ 0x0000, 0x0000, 0x0000, 0x0000 };
30
+ return data[c / 16] & (1 << (c % 16));
31
+ }
32
+
33
+ inline bool isGraph(int c) {
34
+ unsigned int data[16] = {
35
+ 0x0000, 0x0000, 0xfffe, 0xffff,
36
+ 0xffff, 0xffff, 0xffff, 0x7fff,
37
+ 0x0000, 0x0000, 0xfffe, 0xffff,
38
+ 0xffff, 0xffff, 0xffff, 0xffff };
39
+ return data[c / 16] & (1 << (c % 16));
40
+ }
41
+
42
+ inline bool isHexadecimalDigit(int c) {
43
+ unsigned int data[16] = {
44
+ 0x0000, 0x0000, 0x0000, 0x03ff,
45
+ 0x007e, 0x0000, 0x007e, 0x0000,
46
+ 0x0000, 0x0000, 0x0000, 0x0000,
47
+ 0x0000, 0x0000, 0x0000, 0x0000 };
48
+ return data[c / 16] & (1 << (c % 16));
49
+ }
50
+
51
+ inline bool isLowerCase(int c) {
52
+ unsigned int data[16] = {
53
+ 0x0000, 0x0000, 0x0000, 0x0000,
54
+ 0x0000, 0x0000, 0xfffe, 0x07ff,
55
+ 0x0000, 0x0000, 0x0000, 0x0000,
56
+ 0x0000, 0x8000, 0xffff, 0xff7f };
57
+ return data[c / 16] & (1 << (c % 16));
58
+ }
59
+
60
+ inline bool isPrintable(int c) {
61
+ unsigned int data[16] = {
62
+ 0x0000, 0x0000, 0xffff, 0xffff,
63
+ 0xffff, 0xffff, 0xffff, 0x7fff,
64
+ 0x0000, 0x0000, 0xffff, 0xffff,
65
+ 0xffff, 0xffff, 0xffff, 0xffff };
66
+ return data[c / 16] & (1 << (c % 16));
67
+ }
68
+
69
+ inline bool isPunct(int c) {
70
+ unsigned int data[16] = {
71
+ 0x0000, 0x0000, 0xfffe, 0xfc00,
72
+ 0x0001, 0xf800, 0x0001, 0x7800,
73
+ 0x0000, 0x0000, 0xfffe, 0xffff,
74
+ 0x0000, 0x0080, 0x0000, 0x0080 };
75
+ return data[c / 16] & (1 << (c % 16));
76
+ }
77
+
78
+ inline bool isSpace(int c) {
79
+ unsigned int data[16] = {
80
+ 0x3e00, 0x0000, 0x0001, 0x0000,
81
+ 0x0000, 0x0000, 0x0000, 0x0000,
82
+ 0x0000, 0x0000, 0x0001, 0x0000,
83
+ 0x0000, 0x0000, 0x0000, 0x0000 };
84
+ return data[c / 16] & (1 << (c % 16));
85
+ }
86
+
87
+ inline bool isUpperCase(int c) {
88
+ unsigned int data[16] = {
89
+ 0x0000, 0x0000, 0x0000, 0x0000,
90
+ 0xfffe, 0x07ff, 0x0000, 0x0000,
91
+ 0x0000, 0x0000, 0x0000, 0x0000,
92
+ 0xffff, 0x7f7f, 0x0000, 0x0000 };
93
+ return data[c / 16] & (1 << (c % 16));
94
+ }
95
+
96
+ inline bool isWhitespace(int c) { return c == ' ' || c == '\t' || isSpace(c); }
@@ -0,0 +1,164 @@
1
+ #pragma once
2
+
3
+ #include <stdlib.h>
4
+ #include <string>
5
+ #include <algorithm>
6
+ #include <iostream>
7
+ #include "AvrMath.h"
8
+ #include "WCharacter.h"
9
+
10
+ typedef std::string string;
11
+
12
+
13
+ // Compatibility with string class
14
+ class String: public string
15
+ {
16
+ public:
17
+
18
+ // allow "string s; if (s) {}"
19
+ // http://www.artima.com/cppsource/safebool.html
20
+ typedef void (String::*TTDNSCstring)() const;
21
+ void ttdnsc() const {}
22
+ operator TTDNSCstring() const { return &String::ttdnsc; }
23
+
24
+ private:
25
+ static const char* digit(int val) {
26
+ const char* bank = "0123456789ABCDEF";
27
+ return bank + val;
28
+ }
29
+
30
+ static string mytoa(unsigned long val, int base) {
31
+ int n = val % base;
32
+ string place = string(digit(n), 1);
33
+ if (val < base) return place;
34
+ return mytoa(val / base, base) + place;
35
+ }
36
+
37
+ static string mytoas(long val, int base) {
38
+ string ret = mytoa(abs(val), base);
39
+ return 0 <= val ? ret : string("-") + ret;
40
+ }
41
+
42
+ static string dtoas(double val, int decimalPlaces) {
43
+ double r = 0.5 * pow(0.1, decimalPlaces); // make sure that integer truncation will properly round
44
+ if (::isnan(val)) return "nan";
45
+ if (::isinf(val)) return "inf";
46
+ val += val > 0 ? r : -r;
47
+ if (val > 4294967040.0) return "ovf";
48
+ if (val <-4294967040.0) return "ovf";
49
+ return mytoas(val, 10) + "." + mytoa(abs(val - (long)val) * pow(10, decimalPlaces), 10);
50
+ }
51
+
52
+ public:
53
+ ~String(void) {}
54
+ String(const char *cstr = ""): string(cstr) {}
55
+ String(const string &str): string(str.c_str()) {}
56
+ String(const String &str): string(str.c_str()) {}
57
+ explicit String(char c): string(&c, 1) {}
58
+
59
+ explicit String(unsigned char val, unsigned char base=10): string(mytoa(val, base)) {}
60
+ explicit String(int val, unsigned char base=10): string(mytoas(val, base)) {}
61
+ explicit String(unsigned int val , unsigned char base=10): string(mytoa(val, base)) {}
62
+ explicit String(long val, unsigned char base=10): string(mytoas(val, base)) {}
63
+ explicit String(unsigned long val, unsigned char base=10): string(mytoa(val, base)) {}
64
+
65
+ explicit String(float val, unsigned char decimalPlaces=2): string(dtoas(val, decimalPlaces)) {}
66
+ explicit String(double val, unsigned char decimalPlaces=2): string(dtoas(val, decimalPlaces)) {}
67
+
68
+ String & operator = (const String &rhs) { assign(rhs); return *this; }
69
+ String & operator = (const char *cstr) { assign(cstr); return *this; }
70
+
71
+ unsigned char reserve(unsigned int size) { return true; } // calling reserve(size) segfaults, no idea why
72
+
73
+ unsigned char concat(const String &str) { append(str); return 1; }
74
+ unsigned char concat(const char *cstr) { append(cstr); return 1; }
75
+ unsigned char concat(char c) { append((const char*)&c, 1); return 1; }
76
+ unsigned char concat(unsigned char c) { append((const char*)&c, 1); return 1; }
77
+ unsigned char concat(int num) { append(String(num)); return 1; }
78
+ unsigned char concat(unsigned int num) { append(String(num)); return 1; }
79
+ unsigned char concat(long num) { append(String(num)); return 1; }
80
+ unsigned char concat(unsigned long num) { append(String(num)); return 1; }
81
+ unsigned char concat(float num) { append(String(num)); return 1; }
82
+ unsigned char concat(double num) { append(String(num)); return 1; }
83
+
84
+ String & operator += (const String &rhs) { concat(rhs); return *this; }
85
+ String & operator += (const char *cstr) { concat(cstr); return *this; }
86
+ String & operator += (char c) { concat(c); return *this; }
87
+ String & operator += (unsigned char num) { concat(num); return *this; }
88
+ String & operator += (int num) { concat(num); return *this; }
89
+ String & operator += (unsigned int num) { concat(num); return *this; }
90
+ String & operator += (long num) { concat(num); return *this; }
91
+ String & operator += (unsigned long num) { concat(num); return *this; }
92
+ String & operator += (float num) { concat(num); return *this; }
93
+ String & operator += (double num) { concat(num); return *this; }
94
+
95
+
96
+ int compareTo(const String &s) const { return compare(s); }
97
+ unsigned char equals(const String &s) const { return compareTo(s) == 0; }
98
+ unsigned char equals(const char *cstr) const { return compareTo(String(cstr)) == 0; }
99
+ unsigned char equal(const String &s) const { return equals(s); }
100
+ unsigned char equal(const char *cstr) const { return equals(cstr); }
101
+ unsigned char equalsIgnoreCase(const String &s) const {
102
+ String a = String(*this);
103
+ String b = String(s);
104
+ a.toUpperCase();
105
+ b.toUpperCase();
106
+ return a.compare(b) == 0;
107
+ }
108
+
109
+ unsigned char startsWith(const String &prefix) const { return find(prefix) == 0; }
110
+ unsigned char startsWith(const String &prefix, unsigned int offset) const { return find(prefix, offset) == offset; }
111
+ unsigned char endsWith(const String &suffix) const { return rfind(suffix) == length() - suffix.length(); }
112
+
113
+ char charAt(unsigned int index) const { return operator[](index); }
114
+ void setCharAt(unsigned int index, char c) { (*this)[index] = c; }
115
+
116
+ void getBytes(unsigned char *buf, unsigned int bufsize, unsigned int index=0) const { copy((char*)buf, bufsize, index); }
117
+ void toCharArray(char *buf, unsigned int bufsize, unsigned int index=0) const
118
+ { getBytes((unsigned char *)buf, bufsize, index); }
119
+
120
+ int indexOf( char ch ) const { return find(ch); }
121
+ int indexOf( char ch, unsigned int fromIndex ) const { return find(ch, fromIndex); }
122
+ int indexOf( const String &str ) const { return find(str); }
123
+ int indexOf( const String &str, unsigned int fromIndex ) const { return find(str, fromIndex); }
124
+ int lastIndexOf( char ch ) const { return rfind(ch); }
125
+ int lastIndexOf( char ch, unsigned int fromIndex ) const { return rfind(ch, fromIndex); }
126
+ int lastIndexOf( const String &str ) const { return rfind(str); }
127
+ int lastIndexOf( const String &str, unsigned int fromIndex ) const { return rfind(str, fromIndex); }
128
+ String substring( unsigned int beginIndex ) const { return String(substr(beginIndex)); }
129
+ String substring( unsigned int beginIndex, unsigned int endIndex ) const { return String(substr(beginIndex, endIndex)); }
130
+
131
+ void replace(const String& target, const String& repl) {
132
+ int i = 0;
133
+ while ((i = find(target, i)) != npos) {
134
+ assign(substr(0, i) + repl + substr(i + target.length()));
135
+ i += repl.length();
136
+ }
137
+ }
138
+ void replace(char target, char repl) {
139
+ replace(String(target), String(repl));
140
+ }
141
+ void remove(unsigned int index) { assign(substr(0, index)); }
142
+ void remove(unsigned int index, unsigned int count) { assign(substr(0, index) + substr(min(length(), index + count), count)); }
143
+ void toLowerCase(void) { std::transform(begin(), end(), begin(), ::tolower); }
144
+ void toUpperCase(void) { std::transform(begin(), end(), begin(), ::toupper); }
145
+
146
+ void trim(void) {
147
+ int b;
148
+ int e;
149
+ for (b = 0; b < length() && isSpace(charAt(b)); ++b);
150
+ for (e = length() - 1; e > b && isSpace(charAt(e)); --e);
151
+ assign(substr(b, e - b + 1));
152
+ }
153
+
154
+ long toInt(void) const { return std::stol(*this); }
155
+ float toFloat(void) const { return std::stof(*this); }
156
+ double toDouble(void) const { return std::stod(*this); }
157
+
158
+ };
159
+
160
+ inline std::ostream& operator << ( std::ostream& out, const String& bs ) {
161
+ out << bs.c_str();
162
+ return out;
163
+ }
164
+
@@ -0,0 +1,518 @@
1
+ /* ruby
2
+ (1..8).each do |b|
3
+ (0..(2**b - 1)).each do |v|
4
+ puts "#define B#{v.to_s(2).rjust(b, '0').ljust(8, ' ')} #{v}"
5
+ end
6
+ end
7
+ */
8
+
9
+ #define B0 0
10
+ #define B1 1
11
+ #define B00 0
12
+ #define B01 1
13
+ #define B10 2
14
+ #define B11 3
15
+ #define B000 0
16
+ #define B001 1
17
+ #define B010 2
18
+ #define B011 3
19
+ #define B100 4
20
+ #define B101 5
21
+ #define B110 6
22
+ #define B111 7
23
+ #define B0000 0
24
+ #define B0001 1
25
+ #define B0010 2
26
+ #define B0011 3
27
+ #define B0100 4
28
+ #define B0101 5
29
+ #define B0110 6
30
+ #define B0111 7
31
+ #define B1000 8
32
+ #define B1001 9
33
+ #define B1010 10
34
+ #define B1011 11
35
+ #define B1100 12
36
+ #define B1101 13
37
+ #define B1110 14
38
+ #define B1111 15
39
+ #define B00000 0
40
+ #define B00001 1
41
+ #define B00010 2
42
+ #define B00011 3
43
+ #define B00100 4
44
+ #define B00101 5
45
+ #define B00110 6
46
+ #define B00111 7
47
+ #define B01000 8
48
+ #define B01001 9
49
+ #define B01010 10
50
+ #define B01011 11
51
+ #define B01100 12
52
+ #define B01101 13
53
+ #define B01110 14
54
+ #define B01111 15
55
+ #define B10000 16
56
+ #define B10001 17
57
+ #define B10010 18
58
+ #define B10011 19
59
+ #define B10100 20
60
+ #define B10101 21
61
+ #define B10110 22
62
+ #define B10111 23
63
+ #define B11000 24
64
+ #define B11001 25
65
+ #define B11010 26
66
+ #define B11011 27
67
+ #define B11100 28
68
+ #define B11101 29
69
+ #define B11110 30
70
+ #define B11111 31
71
+ #define B000000 0
72
+ #define B000001 1
73
+ #define B000010 2
74
+ #define B000011 3
75
+ #define B000100 4
76
+ #define B000101 5
77
+ #define B000110 6
78
+ #define B000111 7
79
+ #define B001000 8
80
+ #define B001001 9
81
+ #define B001010 10
82
+ #define B001011 11
83
+ #define B001100 12
84
+ #define B001101 13
85
+ #define B001110 14
86
+ #define B001111 15
87
+ #define B010000 16
88
+ #define B010001 17
89
+ #define B010010 18
90
+ #define B010011 19
91
+ #define B010100 20
92
+ #define B010101 21
93
+ #define B010110 22
94
+ #define B010111 23
95
+ #define B011000 24
96
+ #define B011001 25
97
+ #define B011010 26
98
+ #define B011011 27
99
+ #define B011100 28
100
+ #define B011101 29
101
+ #define B011110 30
102
+ #define B011111 31
103
+ #define B100000 32
104
+ #define B100001 33
105
+ #define B100010 34
106
+ #define B100011 35
107
+ #define B100100 36
108
+ #define B100101 37
109
+ #define B100110 38
110
+ #define B100111 39
111
+ #define B101000 40
112
+ #define B101001 41
113
+ #define B101010 42
114
+ #define B101011 43
115
+ #define B101100 44
116
+ #define B101101 45
117
+ #define B101110 46
118
+ #define B101111 47
119
+ #define B110000 48
120
+ #define B110001 49
121
+ #define B110010 50
122
+ #define B110011 51
123
+ #define B110100 52
124
+ #define B110101 53
125
+ #define B110110 54
126
+ #define B110111 55
127
+ #define B111000 56
128
+ #define B111001 57
129
+ #define B111010 58
130
+ #define B111011 59
131
+ #define B111100 60
132
+ #define B111101 61
133
+ #define B111110 62
134
+ #define B111111 63
135
+ #define B0000000 0
136
+ #define B0000001 1
137
+ #define B0000010 2
138
+ #define B0000011 3
139
+ #define B0000100 4
140
+ #define B0000101 5
141
+ #define B0000110 6
142
+ #define B0000111 7
143
+ #define B0001000 8
144
+ #define B0001001 9
145
+ #define B0001010 10
146
+ #define B0001011 11
147
+ #define B0001100 12
148
+ #define B0001101 13
149
+ #define B0001110 14
150
+ #define B0001111 15
151
+ #define B0010000 16
152
+ #define B0010001 17
153
+ #define B0010010 18
154
+ #define B0010011 19
155
+ #define B0010100 20
156
+ #define B0010101 21
157
+ #define B0010110 22
158
+ #define B0010111 23
159
+ #define B0011000 24
160
+ #define B0011001 25
161
+ #define B0011010 26
162
+ #define B0011011 27
163
+ #define B0011100 28
164
+ #define B0011101 29
165
+ #define B0011110 30
166
+ #define B0011111 31
167
+ #define B0100000 32
168
+ #define B0100001 33
169
+ #define B0100010 34
170
+ #define B0100011 35
171
+ #define B0100100 36
172
+ #define B0100101 37
173
+ #define B0100110 38
174
+ #define B0100111 39
175
+ #define B0101000 40
176
+ #define B0101001 41
177
+ #define B0101010 42
178
+ #define B0101011 43
179
+ #define B0101100 44
180
+ #define B0101101 45
181
+ #define B0101110 46
182
+ #define B0101111 47
183
+ #define B0110000 48
184
+ #define B0110001 49
185
+ #define B0110010 50
186
+ #define B0110011 51
187
+ #define B0110100 52
188
+ #define B0110101 53
189
+ #define B0110110 54
190
+ #define B0110111 55
191
+ #define B0111000 56
192
+ #define B0111001 57
193
+ #define B0111010 58
194
+ #define B0111011 59
195
+ #define B0111100 60
196
+ #define B0111101 61
197
+ #define B0111110 62
198
+ #define B0111111 63
199
+ #define B1000000 64
200
+ #define B1000001 65
201
+ #define B1000010 66
202
+ #define B1000011 67
203
+ #define B1000100 68
204
+ #define B1000101 69
205
+ #define B1000110 70
206
+ #define B1000111 71
207
+ #define B1001000 72
208
+ #define B1001001 73
209
+ #define B1001010 74
210
+ #define B1001011 75
211
+ #define B1001100 76
212
+ #define B1001101 77
213
+ #define B1001110 78
214
+ #define B1001111 79
215
+ #define B1010000 80
216
+ #define B1010001 81
217
+ #define B1010010 82
218
+ #define B1010011 83
219
+ #define B1010100 84
220
+ #define B1010101 85
221
+ #define B1010110 86
222
+ #define B1010111 87
223
+ #define B1011000 88
224
+ #define B1011001 89
225
+ #define B1011010 90
226
+ #define B1011011 91
227
+ #define B1011100 92
228
+ #define B1011101 93
229
+ #define B1011110 94
230
+ #define B1011111 95
231
+ #define B1100000 96
232
+ #define B1100001 97
233
+ #define B1100010 98
234
+ #define B1100011 99
235
+ #define B1100100 100
236
+ #define B1100101 101
237
+ #define B1100110 102
238
+ #define B1100111 103
239
+ #define B1101000 104
240
+ #define B1101001 105
241
+ #define B1101010 106
242
+ #define B1101011 107
243
+ #define B1101100 108
244
+ #define B1101101 109
245
+ #define B1101110 110
246
+ #define B1101111 111
247
+ #define B1110000 112
248
+ #define B1110001 113
249
+ #define B1110010 114
250
+ #define B1110011 115
251
+ #define B1110100 116
252
+ #define B1110101 117
253
+ #define B1110110 118
254
+ #define B1110111 119
255
+ #define B1111000 120
256
+ #define B1111001 121
257
+ #define B1111010 122
258
+ #define B1111011 123
259
+ #define B1111100 124
260
+ #define B1111101 125
261
+ #define B1111110 126
262
+ #define B1111111 127
263
+ #define B00000000 0
264
+ #define B00000001 1
265
+ #define B00000010 2
266
+ #define B00000011 3
267
+ #define B00000100 4
268
+ #define B00000101 5
269
+ #define B00000110 6
270
+ #define B00000111 7
271
+ #define B00001000 8
272
+ #define B00001001 9
273
+ #define B00001010 10
274
+ #define B00001011 11
275
+ #define B00001100 12
276
+ #define B00001101 13
277
+ #define B00001110 14
278
+ #define B00001111 15
279
+ #define B00010000 16
280
+ #define B00010001 17
281
+ #define B00010010 18
282
+ #define B00010011 19
283
+ #define B00010100 20
284
+ #define B00010101 21
285
+ #define B00010110 22
286
+ #define B00010111 23
287
+ #define B00011000 24
288
+ #define B00011001 25
289
+ #define B00011010 26
290
+ #define B00011011 27
291
+ #define B00011100 28
292
+ #define B00011101 29
293
+ #define B00011110 30
294
+ #define B00011111 31
295
+ #define B00100000 32
296
+ #define B00100001 33
297
+ #define B00100010 34
298
+ #define B00100011 35
299
+ #define B00100100 36
300
+ #define B00100101 37
301
+ #define B00100110 38
302
+ #define B00100111 39
303
+ #define B00101000 40
304
+ #define B00101001 41
305
+ #define B00101010 42
306
+ #define B00101011 43
307
+ #define B00101100 44
308
+ #define B00101101 45
309
+ #define B00101110 46
310
+ #define B00101111 47
311
+ #define B00110000 48
312
+ #define B00110001 49
313
+ #define B00110010 50
314
+ #define B00110011 51
315
+ #define B00110100 52
316
+ #define B00110101 53
317
+ #define B00110110 54
318
+ #define B00110111 55
319
+ #define B00111000 56
320
+ #define B00111001 57
321
+ #define B00111010 58
322
+ #define B00111011 59
323
+ #define B00111100 60
324
+ #define B00111101 61
325
+ #define B00111110 62
326
+ #define B00111111 63
327
+ #define B01000000 64
328
+ #define B01000001 65
329
+ #define B01000010 66
330
+ #define B01000011 67
331
+ #define B01000100 68
332
+ #define B01000101 69
333
+ #define B01000110 70
334
+ #define B01000111 71
335
+ #define B01001000 72
336
+ #define B01001001 73
337
+ #define B01001010 74
338
+ #define B01001011 75
339
+ #define B01001100 76
340
+ #define B01001101 77
341
+ #define B01001110 78
342
+ #define B01001111 79
343
+ #define B01010000 80
344
+ #define B01010001 81
345
+ #define B01010010 82
346
+ #define B01010011 83
347
+ #define B01010100 84
348
+ #define B01010101 85
349
+ #define B01010110 86
350
+ #define B01010111 87
351
+ #define B01011000 88
352
+ #define B01011001 89
353
+ #define B01011010 90
354
+ #define B01011011 91
355
+ #define B01011100 92
356
+ #define B01011101 93
357
+ #define B01011110 94
358
+ #define B01011111 95
359
+ #define B01100000 96
360
+ #define B01100001 97
361
+ #define B01100010 98
362
+ #define B01100011 99
363
+ #define B01100100 100
364
+ #define B01100101 101
365
+ #define B01100110 102
366
+ #define B01100111 103
367
+ #define B01101000 104
368
+ #define B01101001 105
369
+ #define B01101010 106
370
+ #define B01101011 107
371
+ #define B01101100 108
372
+ #define B01101101 109
373
+ #define B01101110 110
374
+ #define B01101111 111
375
+ #define B01110000 112
376
+ #define B01110001 113
377
+ #define B01110010 114
378
+ #define B01110011 115
379
+ #define B01110100 116
380
+ #define B01110101 117
381
+ #define B01110110 118
382
+ #define B01110111 119
383
+ #define B01111000 120
384
+ #define B01111001 121
385
+ #define B01111010 122
386
+ #define B01111011 123
387
+ #define B01111100 124
388
+ #define B01111101 125
389
+ #define B01111110 126
390
+ #define B01111111 127
391
+ #define B10000000 128
392
+ #define B10000001 129
393
+ #define B10000010 130
394
+ #define B10000011 131
395
+ #define B10000100 132
396
+ #define B10000101 133
397
+ #define B10000110 134
398
+ #define B10000111 135
399
+ #define B10001000 136
400
+ #define B10001001 137
401
+ #define B10001010 138
402
+ #define B10001011 139
403
+ #define B10001100 140
404
+ #define B10001101 141
405
+ #define B10001110 142
406
+ #define B10001111 143
407
+ #define B10010000 144
408
+ #define B10010001 145
409
+ #define B10010010 146
410
+ #define B10010011 147
411
+ #define B10010100 148
412
+ #define B10010101 149
413
+ #define B10010110 150
414
+ #define B10010111 151
415
+ #define B10011000 152
416
+ #define B10011001 153
417
+ #define B10011010 154
418
+ #define B10011011 155
419
+ #define B10011100 156
420
+ #define B10011101 157
421
+ #define B10011110 158
422
+ #define B10011111 159
423
+ #define B10100000 160
424
+ #define B10100001 161
425
+ #define B10100010 162
426
+ #define B10100011 163
427
+ #define B10100100 164
428
+ #define B10100101 165
429
+ #define B10100110 166
430
+ #define B10100111 167
431
+ #define B10101000 168
432
+ #define B10101001 169
433
+ #define B10101010 170
434
+ #define B10101011 171
435
+ #define B10101100 172
436
+ #define B10101101 173
437
+ #define B10101110 174
438
+ #define B10101111 175
439
+ #define B10110000 176
440
+ #define B10110001 177
441
+ #define B10110010 178
442
+ #define B10110011 179
443
+ #define B10110100 180
444
+ #define B10110101 181
445
+ #define B10110110 182
446
+ #define B10110111 183
447
+ #define B10111000 184
448
+ #define B10111001 185
449
+ #define B10111010 186
450
+ #define B10111011 187
451
+ #define B10111100 188
452
+ #define B10111101 189
453
+ #define B10111110 190
454
+ #define B10111111 191
455
+ #define B11000000 192
456
+ #define B11000001 193
457
+ #define B11000010 194
458
+ #define B11000011 195
459
+ #define B11000100 196
460
+ #define B11000101 197
461
+ #define B11000110 198
462
+ #define B11000111 199
463
+ #define B11001000 200
464
+ #define B11001001 201
465
+ #define B11001010 202
466
+ #define B11001011 203
467
+ #define B11001100 204
468
+ #define B11001101 205
469
+ #define B11001110 206
470
+ #define B11001111 207
471
+ #define B11010000 208
472
+ #define B11010001 209
473
+ #define B11010010 210
474
+ #define B11010011 211
475
+ #define B11010100 212
476
+ #define B11010101 213
477
+ #define B11010110 214
478
+ #define B11010111 215
479
+ #define B11011000 216
480
+ #define B11011001 217
481
+ #define B11011010 218
482
+ #define B11011011 219
483
+ #define B11011100 220
484
+ #define B11011101 221
485
+ #define B11011110 222
486
+ #define B11011111 223
487
+ #define B11100000 224
488
+ #define B11100001 225
489
+ #define B11100010 226
490
+ #define B11100011 227
491
+ #define B11100100 228
492
+ #define B11100101 229
493
+ #define B11100110 230
494
+ #define B11100111 231
495
+ #define B11101000 232
496
+ #define B11101001 233
497
+ #define B11101010 234
498
+ #define B11101011 235
499
+ #define B11101100 236
500
+ #define B11101101 237
501
+ #define B11101110 238
502
+ #define B11101111 239
503
+ #define B11110000 240
504
+ #define B11110001 241
505
+ #define B11110010 242
506
+ #define B11110011 243
507
+ #define B11110100 244
508
+ #define B11110101 245
509
+ #define B11110110 246
510
+ #define B11110111 247
511
+ #define B11111000 248
512
+ #define B11111001 249
513
+ #define B11111010 250
514
+ #define B11111011 251
515
+ #define B11111100 252
516
+ #define B11111101 253
517
+ #define B11111110 254
518
+ #define B11111111 255