zemu 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (285) hide show
  1. checksums.yaml +7 -0
  2. data/lib/zemu/config.rb +312 -0
  3. data/lib/zemu/instance.rb +179 -0
  4. data/lib/zemu.rb +172 -0
  5. data/src/debug.c +118 -0
  6. data/src/debug.h +30 -0
  7. data/src/external/Z/API/Z/ABIs/generic/allocator.h +36 -0
  8. data/src/external/Z/API/Z/ABIs/generic/cipher.h +47 -0
  9. data/src/external/Z/API/Z/ABIs/generic/data codec.h +33 -0
  10. data/src/external/Z/API/Z/ABIs/generic/emulation.h +103 -0
  11. data/src/external/Z/API/Z/ABIs/generic/hash function.h +33 -0
  12. data/src/external/Z/API/Z/ABIs/generic/module.h +33 -0
  13. data/src/external/Z/API/Z/ABIs/generic/wave codec.h +40 -0
  14. data/src/external/Z/API/Z/classes/base/InitializerList.hpp +34 -0
  15. data/src/external/Z/API/Z/classes/base/OpaqueFunctionPointer.hpp +26 -0
  16. data/src/external/Z/API/Z/classes/base/OpaqueMemberFunctionPointer.hpp +26 -0
  17. data/src/external/Z/API/Z/classes/base/Pair.hpp +46 -0
  18. data/src/external/Z/API/Z/classes/base/Range.hpp +111 -0
  19. data/src/external/Z/API/Z/classes/base/SizedString.hpp +66 -0
  20. data/src/external/Z/API/Z/classes/base/Status.hpp +89 -0
  21. data/src/external/Z/API/Z/classes/base/Symbol.hpp +39 -0
  22. data/src/external/Z/API/Z/classes/base/Tuple.hpp +111 -0
  23. data/src/external/Z/API/Z/classes/base/Value2D.hpp +389 -0
  24. data/src/external/Z/API/Z/classes/base/Value3D.hpp +368 -0
  25. data/src/external/Z/API/Z/classes/buffering/RingBuffer.hpp +93 -0
  26. data/src/external/Z/API/Z/classes/buffering/TripleBuffer.hpp +68 -0
  27. data/src/external/Z/API/Z/classes/functional/Functor.hpp +265 -0
  28. data/src/external/Z/API/Z/classes/functional/MemberFunction.hpp +98 -0
  29. data/src/external/Z/API/Z/classes/functional/ObjectMemberFunction.hpp +172 -0
  30. data/src/external/Z/API/Z/classes/functional/ObjectSelector.hpp +219 -0
  31. data/src/external/Z/API/Z/classes/functional/Selector.hpp +146 -0
  32. data/src/external/Z/API/Z/classes/mathematics/geometry/euclidean/AABB.hpp +81 -0
  33. data/src/external/Z/API/Z/classes/mathematics/geometry/euclidean/AABR.hpp +685 -0
  34. data/src/external/Z/API/Z/classes/mathematics/geometry/euclidean/Box.hpp +219 -0
  35. data/src/external/Z/API/Z/classes/mathematics/geometry/euclidean/Circle.hpp +80 -0
  36. data/src/external/Z/API/Z/classes/mathematics/geometry/euclidean/Line2D.hpp +93 -0
  37. data/src/external/Z/API/Z/classes/mathematics/geometry/euclidean/Line3D.hpp +80 -0
  38. data/src/external/Z/API/Z/classes/mathematics/geometry/euclidean/Rectangle.hpp +675 -0
  39. data/src/external/Z/API/Z/classes/mathematics/geometry/euclidean/Sphere.hpp +0 -0
  40. data/src/external/Z/API/Z/classes/memory/Shared.hpp +90 -0
  41. data/src/external/Z/API/Z/constants/base.h +35 -0
  42. data/src/external/Z/API/Z/constants/chemical elements.h +6385 -0
  43. data/src/external/Z/API/Z/constants/numbers.h +963 -0
  44. data/src/external/Z/API/Z/constants/version.h +15 -0
  45. data/src/external/Z/API/Z/formats/character set/ASCII.h +158 -0
  46. data/src/external/Z/API/Z/formats/character set/DOS CP437.h +159 -0
  47. data/src/external/Z/API/Z/formats/character set/DOS CP737.h +159 -0
  48. data/src/external/Z/API/Z/formats/character set/DOS CP775.h +159 -0
  49. data/src/external/Z/API/Z/formats/character set/DOS CP850.h +159 -0
  50. data/src/external/Z/API/Z/formats/character set/DOS CP852.h +159 -0
  51. data/src/external/Z/API/Z/formats/character set/DOS CP855.h +159 -0
  52. data/src/external/Z/API/Z/formats/character set/DOS CP857.h +159 -0
  53. data/src/external/Z/API/Z/formats/character set/DOS CP858.h +159 -0
  54. data/src/external/Z/API/Z/formats/character set/DOS CP860.h +159 -0
  55. data/src/external/Z/API/Z/formats/character set/DOS CP861.h +159 -0
  56. data/src/external/Z/API/Z/formats/character set/DOS CP862.h +159 -0
  57. data/src/external/Z/API/Z/formats/character set/DOS CP863.h +159 -0
  58. data/src/external/Z/API/Z/formats/character set/DOS CP864.h +159 -0
  59. data/src/external/Z/API/Z/formats/character set/DOS CP865.h +159 -0
  60. data/src/external/Z/API/Z/formats/character set/DOS CP866.h +159 -0
  61. data/src/external/Z/API/Z/formats/character set/DOS CP869.h +159 -0
  62. data/src/external/Z/API/Z/formats/character set/DOS CP872.h +159 -0
  63. data/src/external/Z/API/Z/formats/character set/DOS CP874.h +159 -0
  64. data/src/external/Z/API/Z/formats/character set/Unicode.h +30119 -0
  65. data/src/external/Z/API/Z/formats/data model/I16LP32.h +19 -0
  66. data/src/external/Z/API/Z/formats/data model/ILP32.h +19 -0
  67. data/src/external/Z/API/Z/formats/data model/ILP64.h +19 -0
  68. data/src/external/Z/API/Z/formats/data model/IP16L32.h +19 -0
  69. data/src/external/Z/API/Z/formats/data model/LLP64.h +19 -0
  70. data/src/external/Z/API/Z/formats/data model/LP32.h +19 -0
  71. data/src/external/Z/API/Z/formats/data model/LP64.h +19 -0
  72. data/src/external/Z/API/Z/formats/data model/SILP64.h +19 -0
  73. data/src/external/Z/API/Z/formats/file system/FAT12.h +61 -0
  74. data/src/external/Z/API/Z/formats/floating-point/IEEE 754.h +141 -0
  75. data/src/external/Z/API/Z/formats/floating-point/x87.h +74 -0
  76. data/src/external/Z/API/Z/formats/image/ICNS.h +39 -0
  77. data/src/external/Z/API/Z/formats/keymap/Mac OS.h +284 -0
  78. data/src/external/Z/API/Z/formats/keymap/Z.h +141 -0
  79. data/src/external/Z/API/Z/formats/multimedia/Creative Voice.h +106 -0
  80. data/src/external/Z/API/Z/formats/multimedia/Microsoft Wave.h +49 -0
  81. data/src/external/Z/API/Z/formats/snapshot/machine/computer/ZX Spectrum/ACH.h +44 -0
  82. data/src/external/Z/API/Z/formats/snapshot/machine/computer/ZX Spectrum/FRZ.h +54 -0
  83. data/src/external/Z/API/Z/formats/snapshot/machine/computer/ZX Spectrum/PRG.h +33 -0
  84. data/src/external/Z/API/Z/formats/snapshot/machine/computer/ZX Spectrum/SEM.h +46 -0
  85. data/src/external/Z/API/Z/formats/snapshot/machine/computer/ZX Spectrum/SIT.h +34 -0
  86. data/src/external/Z/API/Z/formats/snapshot/machine/computer/ZX Spectrum/SNA.h +117 -0
  87. data/src/external/Z/API/Z/formats/snapshot/machine/computer/ZX Spectrum/SNP.h +37 -0
  88. data/src/external/Z/API/Z/formats/snapshot/machine/computer/ZX Spectrum/SP.h +62 -0
  89. data/src/external/Z/API/Z/formats/snapshot/machine/computer/ZX Spectrum/Z80.h +117 -0
  90. data/src/external/Z/API/Z/formats/snapshot/machine/computer/ZX Spectrum/ZX.h +56 -0
  91. data/src/external/Z/API/Z/formats/snapshot/machine/computer/ZX Spectrum/ZX82.h +70 -0
  92. data/src/external/Z/API/Z/formats/storage medium image/NES Game Pak/UNIF.h +26 -0
  93. data/src/external/Z/API/Z/formats/storage medium image/NES Game Pak/iNES.h +76 -0
  94. data/src/external/Z/API/Z/formats/storage medium image/audio/TAP.h +25 -0
  95. data/src/external/Z/API/Z/formats/storage medium image/audio/TZX.h +1185 -0
  96. data/src/external/Z/API/Z/formats/storage medium image/audio/Warajevo TAP.h +32 -0
  97. data/src/external/Z/API/Z/formats/storage medium image/floppy disk/FDI.h +45 -0
  98. data/src/external/Z/API/Z/functions/base/Z2D.h +583 -0
  99. data/src/external/Z/API/Z/functions/base/Z3D.h +712 -0
  100. data/src/external/Z/API/Z/functions/base/ZRange.h +137 -0
  101. data/src/external/Z/API/Z/functions/base/all.h +16 -0
  102. data/src/external/Z/API/Z/functions/base/casting.hpp +37 -0
  103. data/src/external/Z/API/Z/functions/base/character.h +38 -0
  104. data/src/external/Z/API/Z/functions/base/constructors.h +326 -0
  105. data/src/external/Z/API/Z/functions/base/structure.hpp +26 -0
  106. data/src/external/Z/API/Z/functions/base/type.hpp +60 -0
  107. data/src/external/Z/API/Z/functions/base/value.h +1901 -0
  108. data/src/external/Z/API/Z/functions/base/value.hpp +112 -0
  109. data/src/external/Z/API/Z/functions/buffering/ZRingBuffer.h +85 -0
  110. data/src/external/Z/API/Z/functions/buffering/ZTripleBuffer.h +65 -0
  111. data/src/external/Z/API/Z/functions/mathematics/geometry/euclidean/Z2DLine.h +179 -0
  112. data/src/external/Z/API/Z/functions/mathematics/geometry/euclidean/Z3DLine.h +168 -0
  113. data/src/external/Z/API/Z/functions/mathematics/geometry/euclidean/ZAABB.h +361 -0
  114. data/src/external/Z/API/Z/functions/mathematics/geometry/euclidean/ZAABR.h +1081 -0
  115. data/src/external/Z/API/Z/functions/mathematics/geometry/euclidean/ZBox.h +340 -0
  116. data/src/external/Z/API/Z/functions/mathematics/geometry/euclidean/ZCircle.h +142 -0
  117. data/src/external/Z/API/Z/functions/mathematics/geometry/euclidean/ZRectangle.h +1267 -0
  118. data/src/external/Z/API/Z/functions/mathematics/geometry/euclidean/ZSphere.h +156 -0
  119. data/src/external/Z/API/Z/functions/mathematics/geometry/euclidean/all.h +18 -0
  120. data/src/external/Z/API/Z/functions/mathematics/geometry/euclidean/constructors.h +620 -0
  121. data/src/external/Z/API/Z/functions/time/date.h +29 -0
  122. data/src/external/Z/API/Z/hardware/CPU/architecture/6502.h +90 -0
  123. data/src/external/Z/API/Z/hardware/CPU/architecture/Z80.h +245 -0
  124. data/src/external/Z/API/Z/hardware/CPU/architecture/i4004.h +37 -0
  125. data/src/external/Z/API/Z/hardware/PSG/General Instrument/AY-3-891x.h +180 -0
  126. data/src/external/Z/API/Z/hardware/VDC/Ricoh/RP2C0x.h +625 -0
  127. data/src/external/Z/API/Z/hardware/bus/AGP.h +24 -0
  128. data/src/external/Z/API/Z/hardware/bus/USB.h +510 -0
  129. data/src/external/Z/API/Z/hardware/machine/model/computer/ZX Spectrum/Inves Spectrum +.h +47 -0
  130. data/src/external/Z/API/Z/hardware/machine/model/computer/ZX Spectrum/Pentagon.h +13 -0
  131. data/src/external/Z/API/Z/hardware/machine/model/computer/ZX Spectrum/Scorpion.h +13 -0
  132. data/src/external/Z/API/Z/hardware/machine/model/computer/ZX Spectrum/ZX Spectrum + 128K.h +158 -0
  133. data/src/external/Z/API/Z/hardware/machine/model/computer/ZX Spectrum/ZX Spectrum +.h +82 -0
  134. data/src/external/Z/API/Z/hardware/machine/model/computer/ZX Spectrum/ZX Spectrum +2.h +13 -0
  135. data/src/external/Z/API/Z/hardware/machine/model/computer/ZX Spectrum/ZX Spectrum +2A.h +13 -0
  136. data/src/external/Z/API/Z/hardware/machine/model/computer/ZX Spectrum/ZX Spectrum +3.h +13 -0
  137. data/src/external/Z/API/Z/hardware/machine/model/computer/ZX Spectrum/ZX Spectrum.h +109 -0
  138. data/src/external/Z/API/Z/hardware/machine/model/console/Nintendo Entertainment System/NES-001 (NTSC).h +29 -0
  139. data/src/external/Z/API/Z/hardware/machine/model/console/Nintendo Entertainment System/NES-001 (PAL).h +29 -0
  140. data/src/external/Z/API/Z/hardware/machine/platform/computer/ZX Spectrum.h +405 -0
  141. data/src/external/Z/API/Z/hardware/machine/platform/console/Game Boy.h +49 -0
  142. data/src/external/Z/API/Z/hardware/machine/platform/console/Nintendo Entertainment System.h +350 -0
  143. data/src/external/Z/API/Z/hardware/storage medium/ROM cartridge/SNES Game Pak.h +238 -0
  144. data/src/external/Z/API/Z/inspection/C/completion.h +178 -0
  145. data/src/external/Z/API/Z/inspection/C/modules/C11.h +41 -0
  146. data/src/external/Z/API/Z/inspection/C/modules/C18.h +13 -0
  147. data/src/external/Z/API/Z/inspection/C/modules/C89.h +19 -0
  148. data/src/external/Z/API/Z/inspection/C/modules/C90.h +13 -0
  149. data/src/external/Z/API/Z/inspection/C/modules/C94.h +15 -0
  150. data/src/external/Z/API/Z/inspection/C/modules/C99.h +29 -0
  151. data/src/external/Z/API/Z/inspection/C/modules/KR C.h +19 -0
  152. data/src/external/Z/API/Z/inspection/C++/completion.h +512 -0
  153. data/src/external/Z/API/Z/inspection/C++/modules/C++03.h +15 -0
  154. data/src/external/Z/API/Z/inspection/C++/modules/C++11.h +80 -0
  155. data/src/external/Z/API/Z/inspection/C++/modules/C++14.h +26 -0
  156. data/src/external/Z/API/Z/inspection/C++/modules/C++17.h +55 -0
  157. data/src/external/Z/API/Z/inspection/C++/modules/C++85.h +11 -0
  158. data/src/external/Z/API/Z/inspection/C++/modules/C++89.h +13 -0
  159. data/src/external/Z/API/Z/inspection/C++/modules/C++98.h +17 -0
  160. data/src/external/Z/API/Z/inspection/C++.h +78 -0
  161. data/src/external/Z/API/Z/inspection/C.h +79 -0
  162. data/src/external/Z/API/Z/inspection/CPU/completion.h +56 -0
  163. data/src/external/Z/API/Z/inspection/CPU/detection.h +714 -0
  164. data/src/external/Z/API/Z/inspection/CPU/modules/6502.h +25 -0
  165. data/src/external/Z/API/Z/inspection/CPU/modules/AArch32.h +32 -0
  166. data/src/external/Z/API/Z/inspection/CPU/modules/AArch64.h +32 -0
  167. data/src/external/Z/API/Z/inspection/CPU/modules/Z80.h +26 -0
  168. data/src/external/Z/API/Z/inspection/CPU/modules/x86-32.h +31 -0
  169. data/src/external/Z/API/Z/inspection/CPU/modules/x86-64.h +312 -0
  170. data/src/external/Z/API/Z/inspection/CPU.h +209 -0
  171. data/src/external/Z/API/Z/inspection/OS/completion.h +36 -0
  172. data/src/external/Z/API/Z/inspection/OS/detection.h +768 -0
  173. data/src/external/Z/API/Z/inspection/OS/modules/Linux.h +22 -0
  174. data/src/external/Z/API/Z/inspection/OS/modules/MS-DOS.h +16 -0
  175. data/src/external/Z/API/Z/inspection/OS/modules/Mac OS X.h +23 -0
  176. data/src/external/Z/API/Z/inspection/OS/modules/Windows.h +19 -0
  177. data/src/external/Z/API/Z/inspection/OS/modules/iPhone OS.h +23 -0
  178. data/src/external/Z/API/Z/inspection/OS.h +236 -0
  179. data/src/external/Z/API/Z/inspection/Objective-C/completion.h +8 -0
  180. data/src/external/Z/API/Z/inspection/Objective-C/modules/Objective-C v1.0.h +11 -0
  181. data/src/external/Z/API/Z/inspection/Objective-C/modules/Objective-C v2.0.h +15 -0
  182. data/src/external/Z/API/Z/inspection/Objective-C.h +51 -0
  183. data/src/external/Z/API/Z/inspection/Z.h +19 -0
  184. data/src/external/Z/API/Z/inspection/build.h +22 -0
  185. data/src/external/Z/API/Z/inspection/character set.h +66 -0
  186. data/src/external/Z/API/Z/inspection/compiler/completion.h +2885 -0
  187. data/src/external/Z/API/Z/inspection/compiler/modules/Apple LLVM.h +26 -0
  188. data/src/external/Z/API/Z/inspection/compiler/modules/Clang.h +1664 -0
  189. data/src/external/Z/API/Z/inspection/compiler/modules/GCC.h +1366 -0
  190. data/src/external/Z/API/Z/inspection/compiler/modules/SCCZ80.h +473 -0
  191. data/src/external/Z/API/Z/inspection/compiler/modules/Visual C++.h +606 -0
  192. data/src/external/Z/API/Z/inspection/compiler/modules/cc65.h +529 -0
  193. data/src/external/Z/API/Z/inspection/compiler/modules/generic.h +13 -0
  194. data/src/external/Z/API/Z/inspection/compiler/modules/template.h +650 -0
  195. data/src/external/Z/API/Z/inspection/compiler.h +299 -0
  196. data/src/external/Z/API/Z/inspection/data model/completion.h +128 -0
  197. data/src/external/Z/API/Z/inspection/data model/deduction.h +9 -0
  198. data/src/external/Z/API/Z/inspection/data model/detection.h +45 -0
  199. data/src/external/Z/API/Z/inspection/data model.h +362 -0
  200. data/src/external/Z/API/Z/inspection/floating-point/completion.h +50 -0
  201. data/src/external/Z/API/Z/inspection/floating-point.h +324 -0
  202. data/src/external/Z/API/Z/inspection/language.h +163 -0
  203. data/src/external/Z/API/Z/inspection/platform/detection.h +9 -0
  204. data/src/external/Z/API/Z/inspection/platform.h +29 -0
  205. data/src/external/Z/API/Z/keys/C++.h +27 -0
  206. data/src/external/Z/API/Z/keys/C.h +29 -0
  207. data/src/external/Z/API/Z/keys/CPU.h +80 -0
  208. data/src/external/Z/API/Z/keys/OS.h +182 -0
  209. data/src/external/Z/API/Z/keys/Objective-C.h +17 -0
  210. data/src/external/Z/API/Z/keys/chemistry.h +26 -0
  211. data/src/external/Z/API/Z/keys/compiler.h +178 -0
  212. data/src/external/Z/API/Z/keys/data model.h +32 -0
  213. data/src/external/Z/API/Z/keys/endianness.h +24 -0
  214. data/src/external/Z/API/Z/keys/language.h +21 -0
  215. data/src/external/Z/API/Z/keys/layout.h +20 -0
  216. data/src/external/Z/API/Z/keys/mathematics/geometry.h +29 -0
  217. data/src/external/Z/API/Z/keys/mathematics/number.h +21 -0
  218. data/src/external/Z/API/Z/keys/order.h +18 -0
  219. data/src/external/Z/API/Z/keys/platform.h +87 -0
  220. data/src/external/Z/API/Z/keys/program.h +39 -0
  221. data/src/external/Z/API/Z/keys/science/chemical elements.h +200 -0
  222. data/src/external/Z/API/Z/keys/science/electricity.h +18 -0
  223. data/src/external/Z/API/Z/keys/science/magnetism.h +19 -0
  224. data/src/external/Z/API/Z/keys/status.h +69 -0
  225. data/src/external/Z/API/Z/keys/text.h +27 -0
  226. data/src/external/Z/API/Z/keys/value.h +88 -0
  227. data/src/external/Z/API/Z/macros/arguments.h +25 -0
  228. data/src/external/Z/API/Z/macros/casting.h +22 -0
  229. data/src/external/Z/API/Z/macros/character.h +159 -0
  230. data/src/external/Z/API/Z/macros/date.h +14 -0
  231. data/src/external/Z/API/Z/macros/key.h +20 -0
  232. data/src/external/Z/API/Z/macros/language.h +126 -0
  233. data/src/external/Z/API/Z/macros/language.hpp +81 -0
  234. data/src/external/Z/API/Z/macros/members.h +86 -0
  235. data/src/external/Z/API/Z/macros/pasting.h +308 -0
  236. data/src/external/Z/API/Z/macros/pointer.h +33 -0
  237. data/src/external/Z/API/Z/macros/repetition.h +283 -0
  238. data/src/external/Z/API/Z/macros/structure.h +104 -0
  239. data/src/external/Z/API/Z/macros/templating.h +407 -0
  240. data/src/external/Z/API/Z/macros/tokens.h +14 -0
  241. data/src/external/Z/API/Z/macros/type enumeration.h +43 -0
  242. data/src/external/Z/API/Z/macros/type selection.hpp +76 -0
  243. data/src/external/Z/API/Z/macros/value.h +489 -0
  244. data/src/external/Z/API/Z/macros/variadic pasting.h +21 -0
  245. data/src/external/Z/API/Z/macros/variadic selection.h +56 -0
  246. data/src/external/Z/API/Z/macros/variadic.h +46 -0
  247. data/src/external/Z/API/Z/macros/version.h +17 -0
  248. data/src/external/Z/API/Z/network/3/IP.h +36 -0
  249. data/src/external/Z/API/Z/network/4/TCP.h +24 -0
  250. data/src/external/Z/API/Z/network/4/UDP.h +26 -0
  251. data/src/external/Z/API/Z/network/7/ED2K.h +104 -0
  252. data/src/external/Z/API/Z/network/7/HTTP.h +100 -0
  253. data/src/external/Z/API/Z/traits/SelectType.hpp +71 -0
  254. data/src/external/Z/API/Z/traits/TernaryType.hpp +20 -0
  255. data/src/external/Z/API/Z/traits/Type.hpp +4516 -0
  256. data/src/external/Z/API/Z/traits/TypeCount.hpp +52 -0
  257. data/src/external/Z/API/Z/traits/TypeList.hpp +376 -0
  258. data/src/external/Z/API/Z/traits/base.hpp +19 -0
  259. data/src/external/Z/API/Z/traits/filtering.hpp +30 -0
  260. data/src/external/Z/API/Z/traits/mathematics.hpp +48 -0
  261. data/src/external/Z/API/Z/types/arguments.h +19 -0
  262. data/src/external/Z/API/Z/types/base.h +1655 -0
  263. data/src/external/Z/API/Z/types/base.hpp +169 -0
  264. data/src/external/Z/API/Z/types/buffering.h +27 -0
  265. data/src/external/Z/API/Z/types/mathematics.h +135 -0
  266. data/src/external/Z/API/Z/types/time.h +23 -0
  267. data/src/external/Z/COPYING.LESSER +165 -0
  268. data/src/external/Z/development/Qt Creator/Z.pro +253 -0
  269. data/src/external/Z/distribution/CocoaPods/Zeta.podspec +18 -0
  270. data/src/external/Z/distribution/Gentoo Linux/Zeta-0.1.ebuild +22 -0
  271. data/src/external/Z/distribution/Gentoo Linux/metadata.xml +8 -0
  272. data/src/external/Z/distribution/Homebrew/Zeta.rb +11 -0
  273. data/src/external/z80/API/emulation/CPU/Z80.h +201 -0
  274. data/src/external/z80/README.md +229 -0
  275. data/src/external/z80/building/premake4.lua +33 -0
  276. data/src/external/z80/development/Xcode/Z80.xcodeproj/project.pbxproj +520 -0
  277. data/src/external/z80/sources/Z80.c +1660 -0
  278. data/src/interrupt.c +6 -0
  279. data/src/interrupt.h +3 -0
  280. data/src/io.c.erb +115 -0
  281. data/src/io.h.erb +18 -0
  282. data/src/main.c +69 -0
  283. data/src/memory.c.erb +43 -0
  284. data/src/memory.h.erb +9 -0
  285. metadata +329 -0
@@ -0,0 +1,1267 @@
1
+ /* Z Kit - functions/mathematics/geometry/euclidean/ZRectangle.h
2
+ _____ _______________
3
+ /_ /_/ -_/_ _/ _ |
4
+ /____/\___/ /__//___/_| Kit
5
+ Copyright (C) 2006-2018 Manuel Sainz de Baranda y Goñi.
6
+ Released under the terms of the GNU Lesser General Public License v3. */
7
+
8
+ #ifndef _Z_functions_mathematics_geometry_euclidean_ZRectangle_H_
9
+ #define _Z_functions_mathematics_geometry_euclidean_ZRectangle_H_
10
+
11
+ #include <Z/functions/mathematics/geometry/euclidean/constructors.h>
12
+ #include <Z/functions/base/Z2D.h>
13
+
14
+
15
+ /* MARK: - Common implementation */
16
+
17
+
18
+ #define Z_IMPLEMENTATION_COMMON(Type, type) \
19
+ \
20
+ static Z_INLINE \
21
+ ZAABR##Type z_rectangle_##type##_aabr(ZRectangle##Type object) \
22
+ { \
23
+ return z_aabr_##type \
24
+ (object.point.x, object.point.y, \
25
+ object.point.x + object.size.x, object.point.y + object.size.y); \
26
+ } \
27
+ \
28
+ \
29
+ static Z_INLINE \
30
+ ZRectangle##Type z_rectangle_##type##_align_in_bottom_center( \
31
+ ZRectangle##Type object, \
32
+ Z2D##Type size \
33
+ ) \
34
+ { \
35
+ object.point.x += (object.size.x - size.x) / (z##type)2; \
36
+ object.size = size; \
37
+ return object; \
38
+ } \
39
+ \
40
+ \
41
+ static Z_INLINE \
42
+ ZRectangle##Type z_rectangle_##type##_align_in_bottom_left( \
43
+ ZRectangle##Type object, \
44
+ Z2D##Type size \
45
+ ) \
46
+ { \
47
+ object.size = size; \
48
+ return object; \
49
+ } \
50
+ \
51
+ \
52
+ static Z_INLINE \
53
+ ZRectangle##Type z_rectangle_##type##_align_in_bottom_right( \
54
+ ZRectangle##Type object, \
55
+ Z2D##Type size \
56
+ ) \
57
+ { \
58
+ object.point.x += object.size.x - size.x; \
59
+ object.size = size; \
60
+ return object; \
61
+ } \
62
+ \
63
+ \
64
+ static Z_INLINE \
65
+ ZRectangle##Type z_rectangle_##type##_align_in_center(ZRectangle##Type object, Z2D##Type size) \
66
+ { \
67
+ object.point.x += (object.size.x - size.x) / (z##type)2; \
68
+ object.point.y += (object.size.y - size.y) / (z##type)2; \
69
+ object.size = size; \
70
+ return object; \
71
+ } \
72
+ \
73
+ \
74
+ static Z_INLINE \
75
+ ZRectangle##Type z_rectangle_##type##_align_in_center_left( \
76
+ ZRectangle##Type object, \
77
+ Z2D##Type size \
78
+ ) \
79
+ { \
80
+ object.point.y += (object.size.y - size.y) / (z##type)2; \
81
+ object.size = size; \
82
+ return object; \
83
+ } \
84
+ \
85
+ \
86
+ static Z_INLINE \
87
+ ZRectangle##Type z_rectangle_##type##_align_in_center_right( \
88
+ ZRectangle##Type object, \
89
+ Z2D##Type size \
90
+ ) \
91
+ { \
92
+ object.point.x += object.size.x - size.x; \
93
+ object.point.y += (object.size.y - size.y) / (z##type)2; \
94
+ object.size = size; \
95
+ return object; \
96
+ } \
97
+ \
98
+ \
99
+ static Z_INLINE \
100
+ ZRectangle##Type z_rectangle_##type##_align_in_top_center( \
101
+ ZRectangle##Type object, \
102
+ Z2D##Type size \
103
+ ) \
104
+ { \
105
+ object.point.x += (object.size.x - size.x) / (z##type)2; \
106
+ object.point.y += object.size.y - size.y; \
107
+ object.size = size; \
108
+ return object; \
109
+ } \
110
+ \
111
+ \
112
+ static Z_INLINE \
113
+ ZRectangle##Type z_rectangle_##type##_align_in_top_left( \
114
+ ZRectangle##Type object, \
115
+ Z2D##Type size \
116
+ ) \
117
+ { \
118
+ object.point.y += object.size.y - size.y; \
119
+ object.size = size; \
120
+ return object; \
121
+ } \
122
+ \
123
+ \
124
+ static Z_INLINE \
125
+ ZRectangle##Type z_rectangle_##type##_align_in_top_right( \
126
+ ZRectangle##Type object, \
127
+ Z2D##Type size \
128
+ ) \
129
+ { \
130
+ object.point.x += object.size.x - size.x; \
131
+ object.point.y += object.size.y - size.y; \
132
+ object.size = size; \
133
+ return object; \
134
+ } \
135
+ \
136
+ \
137
+ static Z_INLINE \
138
+ zboolean z_rectangle_##type##_are_equal(ZRectangle##Type a, ZRectangle##Type b) \
139
+ { \
140
+ return z_2d_##type##_are_equal(a.point, b.point) && \
141
+ z_2d_##type##_are_equal(a.size, b.size ); \
142
+ } \
143
+ \
144
+ \
145
+ static Z_INLINE \
146
+ Z2D##Type z_rectangle_##type##_bottom_center(ZRectangle##Type object) \
147
+ {return z_2d_##type(object.point.x + object.size.x / (z##type)2, object.point.y);} \
148
+ \
149
+ \
150
+ static Z_INLINE \
151
+ ZRectangle##Type z_rectangle_##type##_bottom_half(ZRectangle##Type object) \
152
+ { \
153
+ object.size.y /= (z##type)2; \
154
+ return object; \
155
+ } \
156
+ \
157
+ \
158
+ static Z_INLINE \
159
+ Z2D##Type z_rectangle_##type##_bottom_left(ZRectangle##Type object) \
160
+ {return object.point;} \
161
+ \
162
+ \
163
+ static Z_INLINE \
164
+ ZRectangle##Type z_rectangle_##type##_bottom_left_quarter(ZRectangle##Type object) \
165
+ { \
166
+ object.size.x /= (z##type)2; \
167
+ object.size.y /= (z##type)2; \
168
+ return object; \
169
+ } \
170
+ \
171
+ \
172
+ static Z_INLINE \
173
+ Z2D##Type z_rectangle_##type##_bottom_right(ZRectangle##Type object) \
174
+ {return z_2d_##type(object.point.x + object.size.x, object.point.y);} \
175
+ \
176
+ \
177
+ static Z_INLINE \
178
+ Z2D##Type z_rectangle_##type##_center(ZRectangle##Type object) \
179
+ { \
180
+ return z_2d_##type \
181
+ (object.point.x + object.size.x / (z##type)2, \
182
+ object.point.y + object.size.y / (z##type)2); \
183
+ } \
184
+ \
185
+ \
186
+ static Z_INLINE \
187
+ Z2D##Type z_rectangle_##type##_center_left(ZRectangle##Type object) \
188
+ {return z_2d_##type(object.point.x, object.point.y + object.size.y / (z##type)2);} \
189
+ \
190
+ \
191
+ static Z_INLINE \
192
+ Z2D##Type z_rectangle_##type##_center_right(ZRectangle##Type object) \
193
+ { \
194
+ return z_2d_##type \
195
+ (object.point.x + object.size.x, object.point.y + object.size.y / (z##type)2); \
196
+ } \
197
+ \
198
+ \
199
+ static Z_INLINE \
200
+ zboolean z_rectangle_##type##_contains(ZRectangle##Type object, ZRectangle##Type other) \
201
+ { \
202
+ return other.size.x != (z##type)0 && \
203
+ other.size.y != (z##type)0 && \
204
+ other.point.x >= object.point.x && \
205
+ other.point.y >= object.point.y && \
206
+ other.point.x + other.size.x <= object.point.x + object.size.x && \
207
+ other.point.y + other.size.y <= object.point.y + object.size.y; \
208
+ } \
209
+ \
210
+ \
211
+ static Z_INLINE \
212
+ zboolean z_rectangle_##type##_contains_aabr(ZRectangle##Type object, ZAABR##Type aabr) \
213
+ { \
214
+ return aabr.a.x != aabr.b.x && \
215
+ aabr.a.y != aabr.b.y && \
216
+ aabr.a.x >= object.point.x && \
217
+ aabr.a.y >= object.point.y && \
218
+ aabr.b.x <= object.point.x + object.size.x && \
219
+ aabr.b.y <= object.point.y + object.size.y; \
220
+ } \
221
+ \
222
+ \
223
+ static Z_INLINE \
224
+ zboolean z_rectangle_##type##_contains_point(ZRectangle##Type object, Z2D##Type point) \
225
+ { \
226
+ return point.x >= object.point.x && \
227
+ point.y >= object.point.y && \
228
+ point.x < object.point.x + object.size.x && \
229
+ point.y < object.point.y + object.size.y; \
230
+ } \
231
+ \
232
+ \
233
+ static Z_INLINE \
234
+ ZRectangle##Type z_rectangle_##type##_correct(ZRectangle##Type object) \
235
+ { \
236
+ if (object.size.x < (z##type)0) object.point.x -= (object.size.x = -object.size.x); \
237
+ if (object.size.y < (z##type)0) object.point.y -= (object.size.y = -object.size.y); \
238
+ return object; \
239
+ } \
240
+ \
241
+ \
242
+ static Z_INLINE \
243
+ ZRectangle##Type z_rectangle_##type##_fit_in_bottom_center( \
244
+ ZRectangle##Type object, \
245
+ Z2D##Type size \
246
+ ) \
247
+ { \
248
+ ZRectangle##Type result; \
249
+ \
250
+ result.size = z_2d_##type##_fit(size, object.size); \
251
+ result.point.x = object.point.x + (object.size.x - result.size.x) / (z##type)2; \
252
+ result.point.y = object.point.y; \
253
+ return result; \
254
+ } \
255
+ \
256
+ \
257
+ static Z_INLINE \
258
+ ZRectangle##Type z_rectangle_##type##_fit_in_bottom_left( \
259
+ ZRectangle##Type object, \
260
+ Z2D##Type size \
261
+ ) \
262
+ { \
263
+ object.size = z_2d_##type##_fit(size, object.size); \
264
+ return object; \
265
+ } \
266
+ \
267
+ \
268
+ static Z_INLINE \
269
+ ZRectangle##Type z_rectangle_##type##_fit_in_bottom_right( \
270
+ ZRectangle##Type object, \
271
+ Z2D##Type size \
272
+ ) \
273
+ { \
274
+ ZRectangle##Type result; \
275
+ \
276
+ result.size = z_2d_##type##_fit(size, object.size); \
277
+ result.point.x = object.point.x + object.size.x - result.size.x; \
278
+ result.point.y = object.point.y; \
279
+ return result; \
280
+ } \
281
+ \
282
+ \
283
+ static Z_INLINE \
284
+ ZRectangle##Type z_rectangle_##type##_fit_in_center(ZRectangle##Type object, Z2D##Type size) \
285
+ { \
286
+ ZRectangle##Type result; \
287
+ \
288
+ result.size = z_2d_##type##_fit(size, object.size); \
289
+ result.point.x = object.point.x + (object.size.x - result.size.x) / (z##type)2; \
290
+ result.point.y = object.point.y + (object.size.y - result.size.y) / (z##type)2; \
291
+ return result; \
292
+ } \
293
+ \
294
+ \
295
+ static Z_INLINE \
296
+ ZRectangle##Type z_rectangle_##type##_fit_in_center_left( \
297
+ ZRectangle##Type object, \
298
+ Z2D##Type size \
299
+ ) \
300
+ { \
301
+ ZRectangle##Type result; \
302
+ \
303
+ result.size = z_2d_##type##_fit(size, object.size); \
304
+ result.point.x = object.point.x; \
305
+ result.point.y = object.point.y + (object.size.y - result.size.y) / (z##type)2; \
306
+ return result; \
307
+ } \
308
+ \
309
+ \
310
+ static Z_INLINE \
311
+ ZRectangle##Type z_rectangle_##type##_fit_in_center_right( \
312
+ ZRectangle##Type object, \
313
+ Z2D##Type size \
314
+ ) \
315
+ { \
316
+ ZRectangle##Type result; \
317
+ \
318
+ result.size = z_2d_##type##_fit(size, object.size); \
319
+ result.point.x = object.point.x + object.size.x - result.size.x; \
320
+ result.point.y = object.point.y + (object.size.y - result.size.y) / (z##type)2; \
321
+ return result; \
322
+ } \
323
+ \
324
+ \
325
+ static Z_INLINE \
326
+ ZRectangle##Type z_rectangle_##type##_fit_in_top_center( \
327
+ ZRectangle##Type object, \
328
+ Z2D##Type size \
329
+ ) \
330
+ { \
331
+ ZRectangle##Type result; \
332
+ \
333
+ result.size = z_2d_##type##_fit(size, object.size); \
334
+ result.point.x = object.point.x + (object.size.x - result.size.x) / (z##type)2; \
335
+ result.point.y = object.point.y + object.size.y - result.size.y; \
336
+ return result; \
337
+ } \
338
+ \
339
+ \
340
+ static Z_INLINE \
341
+ ZRectangle##Type z_rectangle_##type##_fit_in_top_left(ZRectangle##Type object, Z2D##Type size) \
342
+ { \
343
+ ZRectangle##Type result; \
344
+ \
345
+ result.size = z_2d_##type##_fit(size, object.size); \
346
+ result.point.x = object.point.x; \
347
+ result.point.y = object.point.y + object.size.y - result.size.y; \
348
+ return result; \
349
+ } \
350
+ \
351
+ \
352
+ static Z_INLINE \
353
+ ZRectangle##Type z_rectangle_##type##_fit_in_top_right(ZRectangle##Type object, Z2D##Type size) \
354
+ { \
355
+ ZRectangle##Type result; \
356
+ \
357
+ result.size = z_2d_##type##_fit(size, object.size); \
358
+ result.point.x = object.point.x + object.size.x - result.size.x; \
359
+ result.point.y = object.point.y + object.size.y - result.size.y; \
360
+ return result; \
361
+ } \
362
+ \
363
+ \
364
+ static Z_INLINE \
365
+ ZRectangle##Type z_rectangle_##type##_from_vertices(Z2D##Type a, Z2D##Type b) \
366
+ { \
367
+ Z2D##Type minimum = z_2d_##type##_minimum(a, b); \
368
+ \
369
+ return z_rectangle_##type \
370
+ (minimum.x, minimum.y, \
371
+ z_##type##_maximum(a.x, b.x) - minimum.x, \
372
+ z_##type##_maximum(a.y, b.y) - minimum.y); \
373
+ } \
374
+ \
375
+ \
376
+ static Z_INLINE \
377
+ ZRectangle##Type z_rectangle_##type##_grow_from_bottom_center( \
378
+ ZRectangle##Type object, \
379
+ Z2D##Type delta \
380
+ ) \
381
+ { \
382
+ object.point.x -= delta.x / (z##type)2; \
383
+ object.size.x += delta.x; \
384
+ object.size.y += delta.y; \
385
+ return object; \
386
+ } \
387
+ \
388
+ \
389
+ static Z_INLINE \
390
+ ZRectangle##Type z_rectangle_##type##_grow_from_bottom_left( \
391
+ ZRectangle##Type object, \
392
+ Z2D##Type delta \
393
+ ) \
394
+ { \
395
+ object.size.x += delta.x; \
396
+ object.size.y += delta.y; \
397
+ return object; \
398
+ } \
399
+ \
400
+ \
401
+ static Z_INLINE \
402
+ ZRectangle##Type z_rectangle_##type##_grow_from_bottom_right( \
403
+ ZRectangle##Type object, \
404
+ Z2D##Type delta \
405
+ ) \
406
+ { \
407
+ object.point.x -= delta.x; \
408
+ object.size.x += delta.x; \
409
+ object.size.y += delta.y; \
410
+ return object; \
411
+ } \
412
+ \
413
+ \
414
+ static Z_INLINE \
415
+ ZRectangle##Type z_rectangle_##type##_grow_from_center( \
416
+ ZRectangle##Type object, \
417
+ Z2D##Type delta \
418
+ ) \
419
+ { \
420
+ object.point.x -= delta.x / (z##type)2; \
421
+ object.point.y -= delta.y / (z##type)2; \
422
+ object.size.x += delta.x; \
423
+ object.size.y += delta.y; \
424
+ return object; \
425
+ } \
426
+ \
427
+ \
428
+ static Z_INLINE \
429
+ ZRectangle##Type z_rectangle_##type##_grow_from_center_left( \
430
+ ZRectangle##Type object, \
431
+ Z2D##Type delta \
432
+ ) \
433
+ { \
434
+ object.point.y -= delta.y / (z##type)2; \
435
+ object.size.x += delta.x; \
436
+ object.size.y += delta.y; \
437
+ return object; \
438
+ } \
439
+ \
440
+ \
441
+ static Z_INLINE \
442
+ ZRectangle##Type z_rectangle_##type##_grow_from_center_right( \
443
+ ZRectangle##Type object, \
444
+ Z2D##Type delta \
445
+ ) \
446
+ { \
447
+ object.point.x -= delta.x; \
448
+ object.point.y -= delta.y / (z##type)2; \
449
+ object.size.x += delta.x; \
450
+ object.size.y += delta.y; \
451
+ return object; \
452
+ } \
453
+ \
454
+ \
455
+ static Z_INLINE \
456
+ ZRectangle##Type z_rectangle_##type##_grow_from_top_center( \
457
+ ZRectangle##Type object, \
458
+ Z2D##Type delta \
459
+ ) \
460
+ { \
461
+ object.point.x -= delta.x / (z##type)2; \
462
+ object.point.y -= delta.y; \
463
+ object.size.x += delta.x; \
464
+ object.size.y += delta.y; \
465
+ return object; \
466
+ } \
467
+ \
468
+ \
469
+ static Z_INLINE \
470
+ ZRectangle##Type z_rectangle_##type##_grow_from_top_left( \
471
+ ZRectangle##Type object, \
472
+ Z2D##Type delta \
473
+ ) \
474
+ { \
475
+ object.point.y -= delta.y; \
476
+ object.size.x += delta.x; \
477
+ object.size.y += delta.y; \
478
+ return object; \
479
+ } \
480
+ \
481
+ \
482
+ static Z_INLINE \
483
+ ZRectangle##Type z_rectangle_##type##_grow_from_top_right( \
484
+ ZRectangle##Type object, \
485
+ Z2D##Type delta \
486
+ ) \
487
+ { \
488
+ object.point.x -= delta.x; \
489
+ object.point.y -= delta.y; \
490
+ object.size.x += delta.x; \
491
+ object.size.y += delta.y; \
492
+ return object; \
493
+ } \
494
+ \
495
+ \
496
+ static Z_INLINE \
497
+ ZRectangle##Type z_rectangle_##type##_grow_in_x_from_center( \
498
+ ZRectangle##Type object, \
499
+ z##type delta \
500
+ ) \
501
+ { \
502
+ object.point.x -= delta / (z##type)2; \
503
+ object.size.x += delta; \
504
+ return object; \
505
+ } \
506
+ \
507
+ \
508
+ static Z_INLINE \
509
+ ZRectangle##Type z_rectangle_##type##_grow_in_x_from_left( \
510
+ ZRectangle##Type object, \
511
+ z##type delta \
512
+ ) \
513
+ { \
514
+ object.size.x += delta; \
515
+ return object; \
516
+ } \
517
+ \
518
+ \
519
+ static Z_INLINE \
520
+ ZRectangle##Type z_rectangle_##type##_grow_in_x_from_right( \
521
+ ZRectangle##Type object, \
522
+ z##type delta \
523
+ ) \
524
+ { \
525
+ object.point.x -= delta; \
526
+ object.size.x += delta; \
527
+ return object; \
528
+ } \
529
+ \
530
+ \
531
+ static Z_INLINE \
532
+ ZRectangle##Type z_rectangle_##type##_grow_in_y_from_bottom( \
533
+ ZRectangle##Type object, \
534
+ z##type delta \
535
+ ) \
536
+ { \
537
+ object.size.y += delta; \
538
+ return object; \
539
+ } \
540
+ \
541
+ \
542
+ static Z_INLINE \
543
+ ZRectangle##Type z_rectangle_##type##_grow_in_y_from_center( \
544
+ ZRectangle##Type object, \
545
+ z##type delta \
546
+ ) \
547
+ { \
548
+ object.point.y -= delta / (z##type)2; \
549
+ object.size.y += delta; \
550
+ return object; \
551
+ } \
552
+ \
553
+ \
554
+ static Z_INLINE \
555
+ ZRectangle##Type z_rectangle_##type##_grow_in_y_from_top( \
556
+ ZRectangle##Type object, \
557
+ z##type delta \
558
+ ) \
559
+ { \
560
+ object.point.y -= delta; \
561
+ object.size.y += delta; \
562
+ return object; \
563
+ } \
564
+ \
565
+ \
566
+ static Z_INLINE \
567
+ zboolean z_rectangle_##type##_intersect(ZRectangle##Type a, ZRectangle##Type b) \
568
+ { \
569
+ return a.size.x != (z##type)0 && \
570
+ a.size.y != (z##type)0 && \
571
+ b.size.x != (z##type)0 && \
572
+ b.size.y != (z##type)0 && \
573
+ b.point.x + b.size.x > a.point.x && \
574
+ b.point.y + b.size.y > a.point.y && \
575
+ b.point.x < a.point.x + a.size.x && \
576
+ b.point.y < a.point.y + a.size.y; \
577
+ } \
578
+ \
579
+ \
580
+ static Z_INLINE ZRectangle##Type z_rectangle_##type##_intersection( \
581
+ ZRectangle##Type a, \
582
+ ZRectangle##Type b \
583
+ ) \
584
+ { \
585
+ z##type x1, x2, y1, y2; \
586
+ \
587
+ return (x1 = z_##type##_maximum(a.point.x, b.point.x)) < \
588
+ (x2 = z_##type##_minimum(a.point.x + a.size.x, b.point.x + b.size.x)) && \
589
+ (y1 = z_##type##_maximum(a.point.y, b.point.y)) < \
590
+ (y2 = z_##type##_minimum(a.point.y + a.size.y, b.point.y + b.size.y)) \
591
+ \
592
+ ? z_rectangle_##type(x1, y1, x2 - x1, y2 - y1) \
593
+ : z_rectangle_##type##_zero; \
594
+ } \
595
+ \
596
+ \
597
+ static Z_INLINE \
598
+ zboolean z_rectangle_##type##_is_zero(ZRectangle##Type object) \
599
+ {return z_2d_##type##_is_zero(object.point) && z_2d_##type##_is_zero(object.size);} \
600
+ \
601
+ \
602
+ static Z_INLINE \
603
+ ZRectangle##Type z_rectangle_##type##_left_half(ZRectangle##Type object) \
604
+ { \
605
+ object.size.x /= (z##type)2; \
606
+ return object; \
607
+ } \
608
+ \
609
+ \
610
+ static Z_INLINE \
611
+ z##type z_rectangle_##type##_maximum_x(ZRectangle##Type object) \
612
+ {return object.point.x + object.size.x;} \
613
+ \
614
+ \
615
+ static Z_INLINE \
616
+ z##type z_rectangle_##type##_maximum_y(ZRectangle##Type object) \
617
+ {return object.point.y + object.size.y;} \
618
+ \
619
+ \
620
+ static Z_INLINE \
621
+ z##type z_rectangle_##type##_middle_x(ZRectangle##Type object) \
622
+ {return object.point.x + object.size.x / (z##type)2;} \
623
+ \
624
+ \
625
+ static Z_INLINE \
626
+ z##type z_rectangle_##type##_middle_y(ZRectangle##Type object) \
627
+ {return object.point.y + object.size.y / (z##type)2;} \
628
+ \
629
+ \
630
+ static Z_INLINE \
631
+ z##type z_rectangle_##type##_minimum_x(ZRectangle##Type object) \
632
+ {return object.point.x;} \
633
+ \
634
+ \
635
+ static Z_INLINE \
636
+ z##type z_rectangle_##type##_minimum_y(ZRectangle##Type object) \
637
+ {return object.point.y;} \
638
+ \
639
+ \
640
+ static Z_INLINE \
641
+ ZRectangle##Type z_rectangle_##type##_shrink_from_bottom_center( \
642
+ ZRectangle##Type object, \
643
+ Z2D##Type delta \
644
+ ) \
645
+ { \
646
+ object.point.x += delta.x / (z##type)2; \
647
+ object.size.x -= delta.x; \
648
+ object.size.y -= delta.y; \
649
+ return object; \
650
+ } \
651
+ \
652
+ \
653
+ static Z_INLINE \
654
+ ZRectangle##Type z_rectangle_##type##_shrink_from_bottom_left( \
655
+ ZRectangle##Type object, \
656
+ Z2D##Type delta \
657
+ ) \
658
+ { \
659
+ object.size.x -= delta.x; \
660
+ object.size.y -= delta.y; \
661
+ return object; \
662
+ } \
663
+ \
664
+ \
665
+ static Z_INLINE \
666
+ ZRectangle##Type z_rectangle_##type##_shrink_from_bottom_right( \
667
+ ZRectangle##Type object, \
668
+ Z2D##Type delta \
669
+ ) \
670
+ { \
671
+ object.point.x += delta.x; \
672
+ object.size.x -= delta.x; \
673
+ object.size.y -= delta.y; \
674
+ return object; \
675
+ } \
676
+ \
677
+ \
678
+ static Z_INLINE \
679
+ ZRectangle##Type z_rectangle_##type##_shrink_from_center( \
680
+ ZRectangle##Type object, \
681
+ Z2D##Type delta \
682
+ ) \
683
+ { \
684
+ object.point.x += delta.x / (z##type)2; \
685
+ object.point.y += delta.y / (z##type)2; \
686
+ object.size.x -= delta.x; \
687
+ object.size.y -= delta.y; \
688
+ return object; \
689
+ } \
690
+ \
691
+ \
692
+ static Z_INLINE \
693
+ ZRectangle##Type z_rectangle_##type##_shrink_from_center_left( \
694
+ ZRectangle##Type object, \
695
+ Z2D##Type delta \
696
+ ) \
697
+ { \
698
+ object.point.y += delta.y / (z##type)2; \
699
+ object.size.x -= delta.x; \
700
+ object.size.y -= delta.y; \
701
+ return object; \
702
+ } \
703
+ \
704
+ \
705
+ static Z_INLINE \
706
+ ZRectangle##Type z_rectangle_##type##_shrink_from_center_right( \
707
+ ZRectangle##Type object, \
708
+ Z2D##Type delta \
709
+ ) \
710
+ { \
711
+ object.point.x += delta.x; \
712
+ object.point.y += delta.y / (z##type)2; \
713
+ object.size.x -= delta.x; \
714
+ object.size.y -= delta.y; \
715
+ return object; \
716
+ } \
717
+ \
718
+ \
719
+ static Z_INLINE \
720
+ ZRectangle##Type z_rectangle_##type##_shrink_from_top_center( \
721
+ ZRectangle##Type object, \
722
+ Z2D##Type delta \
723
+ ) \
724
+ { \
725
+ object.point.x += delta.x / (z##type)2; \
726
+ object.point.y += delta.y; \
727
+ object.size.x -= delta.x; \
728
+ object.size.y -= delta.y; \
729
+ return object; \
730
+ } \
731
+ \
732
+ \
733
+ static Z_INLINE \
734
+ ZRectangle##Type z_rectangle_##type##_shrink_from_top_left( \
735
+ ZRectangle##Type object, \
736
+ Z2D##Type delta \
737
+ ) \
738
+ { \
739
+ object.point.y += delta.y; \
740
+ object.size.x -= delta.x; \
741
+ object.size.y -= delta.y; \
742
+ return object; \
743
+ } \
744
+ \
745
+ \
746
+ static Z_INLINE \
747
+ ZRectangle##Type z_rectangle_##type##_shrink_from_top_right( \
748
+ ZRectangle##Type object, \
749
+ Z2D##Type delta \
750
+ ) \
751
+ { \
752
+ object.point.x += delta.x; \
753
+ object.point.y += delta.y; \
754
+ object.size.x -= delta.x; \
755
+ object.size.y -= delta.y; \
756
+ return object; \
757
+ } \
758
+ \
759
+ \
760
+ static Z_INLINE \
761
+ ZRectangle##Type z_rectangle_##type##_shrink_in_x_from_center( \
762
+ ZRectangle##Type object, \
763
+ z##type delta \
764
+ ) \
765
+ { \
766
+ object.point.x += delta / (z##type)2; \
767
+ object.size.x -= delta; \
768
+ return object; \
769
+ } \
770
+ \
771
+ \
772
+ static Z_INLINE \
773
+ ZRectangle##Type z_rectangle_##type##_shrink_in_x_from_left( \
774
+ ZRectangle##Type object, \
775
+ z##type delta \
776
+ ) \
777
+ { \
778
+ object.size.x -= delta; \
779
+ return object; \
780
+ } \
781
+ \
782
+ \
783
+ static Z_INLINE \
784
+ ZRectangle##Type z_rectangle_##type##_shrink_in_x_from_right( \
785
+ ZRectangle##Type object, \
786
+ z##type delta \
787
+ ) \
788
+ { \
789
+ object.point.x += delta; \
790
+ object.size.x -= delta; \
791
+ return object; \
792
+ } \
793
+ \
794
+ \
795
+ static Z_INLINE \
796
+ ZRectangle##Type z_rectangle_##type##_shrink_in_y_from_bottom( \
797
+ ZRectangle##Type object, \
798
+ z##type delta \
799
+ ) \
800
+ { \
801
+ object.size.y -= delta; \
802
+ return object; \
803
+ } \
804
+ \
805
+ \
806
+ static Z_INLINE \
807
+ ZRectangle##Type z_rectangle_##type##_shrink_in_y_from_center( \
808
+ ZRectangle##Type object, \
809
+ z##type delta \
810
+ ) \
811
+ { \
812
+ object.point.y += delta / (z##type)2; \
813
+ object.size.y -= delta; \
814
+ return object; \
815
+ } \
816
+ \
817
+ \
818
+ static Z_INLINE \
819
+ ZRectangle##Type z_rectangle_##type##_shrink_in_y_from_top( \
820
+ ZRectangle##Type object, \
821
+ z##type delta \
822
+ ) \
823
+ { \
824
+ object.point.y += delta; \
825
+ object.size.y -= delta; \
826
+ return object; \
827
+ } \
828
+ \
829
+ \
830
+ static Z_INLINE \
831
+ void z_rectangle_##type##_swap(ZRectangle##Type *a, ZRectangle##Type *b) \
832
+ { \
833
+ ZRectangle##Type t = *a; \
834
+ \
835
+ *a = *b; *b = t; \
836
+ } \
837
+ \
838
+ \
839
+ static Z_INLINE \
840
+ Z2D##Type z_rectangle_##type##_top_center(ZRectangle##Type object) \
841
+ { \
842
+ return z_2d_##type \
843
+ (object.point.x + object.size.x / (z##type)2, object.point.y + object.size.y); \
844
+ } \
845
+ \
846
+ \
847
+ static Z_INLINE \
848
+ Z2D##Type z_rectangle_##type##_top_left(ZRectangle##Type object) \
849
+ {return z_2d_##type(object.point.x, object.point.y + object.size.y);} \
850
+ \
851
+ \
852
+ static Z_INLINE \
853
+ Z2D##Type z_rectangle_##type##_top_right(ZRectangle##Type object) \
854
+ {return z_2d_##type(object.point.x + object.size.x, object.point.y + object.size.y);} \
855
+ \
856
+ \
857
+ static Z_INLINE \
858
+ ZRectangle##Type z_rectangle_##type##_union(ZRectangle##Type a, ZRectangle##Type b) \
859
+ { \
860
+ ZRectangle##Type result; \
861
+ \
862
+ result.point = z_2d_##type##_minimum(a.point, b.point); \
863
+ \
864
+ result.size.x = \
865
+ z_##type##_maximum(a.point.x + a.size.x, b.point.x + b.size.x) - result.point.x; \
866
+ \
867
+ result.size.y = \
868
+ z_##type##_maximum(a.point.y + a.size.y, b.point.y + b.size.y) - result.point.y; \
869
+ \
870
+ return result; \
871
+ }
872
+
873
+
874
+ #define z_rectangle_type_aabr( TYPE) Z_INSERT_##TYPE##_fixed_type(z_rectangle_, _aabr )
875
+ #define z_rectangle_type_align_in_bottom_center( TYPE) Z_INSERT_##TYPE##_fixed_type(z_rectangle_, _align_in_bottom_center )
876
+ #define z_rectangle_type_align_in_bottom_left( TYPE) Z_INSERT_##TYPE##_fixed_type(z_rectangle_, _align_in_bottom_left )
877
+ #define z_rectangle_type_align_in_bottom_right( TYPE) Z_INSERT_##TYPE##_fixed_type(z_rectangle_, _align_in_bottom_right )
878
+ #define z_rectangle_type_align_in_center( TYPE) Z_INSERT_##TYPE##_fixed_type(z_rectangle_, _align_in_center )
879
+ #define z_rectangle_type_align_in_center_left( TYPE) Z_INSERT_##TYPE##_fixed_type(z_rectangle_, _align_in_center_left )
880
+ #define z_rectangle_type_align_in_center_right( TYPE) Z_INSERT_##TYPE##_fixed_type(z_rectangle_, _align_in_center_right )
881
+ #define z_rectangle_type_align_in_top_center( TYPE) Z_INSERT_##TYPE##_fixed_type(z_rectangle_, _align_in_top_center )
882
+ #define z_rectangle_type_align_in_top_left( TYPE) Z_INSERT_##TYPE##_fixed_type(z_rectangle_, _align_in_top_left )
883
+ #define z_rectangle_type_align_in_top_right( TYPE) Z_INSERT_##TYPE##_fixed_type(z_rectangle_, _align_in_top_right )
884
+ #define z_rectangle_type_are_equal( TYPE) Z_INSERT_##TYPE##_fixed_type(z_rectangle_, _are_equal )
885
+ #define z_rectangle_type_bottom_center( TYPE) Z_INSERT_##TYPE##_fixed_type(z_rectangle_, _bottom_center )
886
+ #define z_rectangle_type_bottom_half( TYPE) Z_INSERT_##TYPE##_fixed_type(z_rectangle_, _bottom_half )
887
+ #define z_rectangle_type_bottom_left( TYPE) Z_INSERT_##TYPE##_fixed_type(z_rectangle_, _bottom_left )
888
+ #define z_rectangle_type_bottom_left_quarter( TYPE) Z_INSERT_##TYPE##_fixed_type(z_rectangle_, _bottom_left_quarter )
889
+ #define z_rectangle_type_bottom_right( TYPE) Z_INSERT_##TYPE##_fixed_type(z_rectangle_, _bottom_right )
890
+ #define z_rectangle_type_center( TYPE) Z_INSERT_##TYPE##_fixed_type(z_rectangle_, _center )
891
+ #define z_rectangle_type_center_left( TYPE) Z_INSERT_##TYPE##_fixed_type(z_rectangle_, _center_left )
892
+ #define z_rectangle_type_center_right( TYPE) Z_INSERT_##TYPE##_fixed_type(z_rectangle_, _center_right )
893
+ #define z_rectangle_type_contains( TYPE) Z_INSERT_##TYPE##_fixed_type(z_rectangle_, _contains )
894
+ #define z_rectangle_type_contains_aabr( TYPE) Z_INSERT_##TYPE##_fixed_type(z_rectangle_, _contains_aabr )
895
+ #define z_rectangle_type_contains_point( TYPE) Z_INSERT_##TYPE##_fixed_type(z_rectangle_, _contains_point )
896
+ #define z_rectangle_type_correct( TYPE) Z_INSERT_##TYPE##_fixed_type(z_rectangle_, _correct )
897
+ #define z_rectangle_type_fit_in_bottom_center( TYPE) Z_INSERT_##TYPE##_fixed_type(z_rectangle_, _fit_in_bottom_center )
898
+ #define z_rectangle_type_fit_in_bottom_left( TYPE) Z_INSERT_##TYPE##_fixed_type(z_rectangle_, _fit_in_bottom_left )
899
+ #define z_rectangle_type_fit_in_bottom_right( TYPE) Z_INSERT_##TYPE##_fixed_type(z_rectangle_, _fit_in_bottom_right )
900
+ #define z_rectangle_type_fit_in_center( TYPE) Z_INSERT_##TYPE##_fixed_type(z_rectangle_, _fit_in_center )
901
+ #define z_rectangle_type_fit_in_center_left( TYPE) Z_INSERT_##TYPE##_fixed_type(z_rectangle_, _fit_in_center_left )
902
+ #define z_rectangle_type_fit_in_center_right( TYPE) Z_INSERT_##TYPE##_fixed_type(z_rectangle_, _fit_in_center_right )
903
+ #define z_rectangle_type_fit_in_top_center( TYPE) Z_INSERT_##TYPE##_fixed_type(z_rectangle_, _fit_in_top_center )
904
+ #define z_rectangle_type_fit_in_top_left( TYPE) Z_INSERT_##TYPE##_fixed_type(z_rectangle_, _fit_in_top_left )
905
+ #define z_rectangle_type_fit_in_top_right( TYPE) Z_INSERT_##TYPE##_fixed_type(z_rectangle_, _fit_in_top_right )
906
+ #define z_rectangle_type_from_vertices( TYPE) Z_INSERT_##TYPE##_fixed_type(z_rectangle_, _from_vertices )
907
+ #define z_rectangle_type_grow_from_bottom_center( TYPE) Z_INSERT_##TYPE##_fixed_type(z_rectangle_, _grow_from_bottom_center )
908
+ #define z_rectangle_type_grow_from_bottom_left( TYPE) Z_INSERT_##TYPE##_fixed_type(z_rectangle_, _grow_from_bottom_left )
909
+ #define z_rectangle_type_grow_from_bottom_right( TYPE) Z_INSERT_##TYPE##_fixed_type(z_rectangle_, _grow_from_bottom_right )
910
+ #define z_rectangle_type_grow_from_center( TYPE) Z_INSERT_##TYPE##_fixed_type(z_rectangle_, _grow_from_center )
911
+ #define z_rectangle_type_grow_from_center_left( TYPE) Z_INSERT_##TYPE##_fixed_type(z_rectangle_, _grow_from_center_left )
912
+ #define z_rectangle_type_grow_from_center_right( TYPE) Z_INSERT_##TYPE##_fixed_type(z_rectangle_, _grow_from_center_right )
913
+ #define z_rectangle_type_grow_from_top_center( TYPE) Z_INSERT_##TYPE##_fixed_type(z_rectangle_, _grow_from_top_center )
914
+ #define z_rectangle_type_grow_from_top_left( TYPE) Z_INSERT_##TYPE##_fixed_type(z_rectangle_, _grow_from_top_left )
915
+ #define z_rectangle_type_grow_from_top_right( TYPE) Z_INSERT_##TYPE##_fixed_type(z_rectangle_, _grow_from_top_right )
916
+ #define z_rectangle_type_grow_in_x_from_center( TYPE) Z_INSERT_##TYPE##_fixed_type(z_rectangle_, _grow_in_x_from_center )
917
+ #define z_rectangle_type_grow_in_x_from_left( TYPE) Z_INSERT_##TYPE##_fixed_type(z_rectangle_, _grow_in_x_from_left )
918
+ #define z_rectangle_type_grow_in_x_from_right( TYPE) Z_INSERT_##TYPE##_fixed_type(z_rectangle_, _grow_in_x_from_right )
919
+ #define z_rectangle_type_grow_in_y_from_bottom( TYPE) Z_INSERT_##TYPE##_fixed_type(z_rectangle_, _grow_in_y_from_bottom )
920
+ #define z_rectangle_type_grow_in_y_from_center( TYPE) Z_INSERT_##TYPE##_fixed_type(z_rectangle_, _grow_in_y_from_center )
921
+ #define z_rectangle_type_grow_in_y_from_top( TYPE) Z_INSERT_##TYPE##_fixed_type(z_rectangle_, _grow_in_y_from_top )
922
+ #define z_rectangle_type_intersect( TYPE) Z_INSERT_##TYPE##_fixed_type(z_rectangle_, _intersect )
923
+ #define z_rectangle_type_intersection( TYPE) Z_INSERT_##TYPE##_fixed_type(z_rectangle_, _intersection )
924
+ #define z_rectangle_type_is_zero( TYPE) Z_INSERT_##TYPE##_fixed_type(z_rectangle_, _is_zero )
925
+ #define z_rectangle_type_left_half( TYPE) Z_INSERT_##TYPE##_fixed_type(z_rectangle_, _left_half )
926
+ #define z_rectangle_type_maximum_x( TYPE) Z_INSERT_##TYPE##_fixed_type(z_rectangle_, _maximum_x )
927
+ #define z_rectangle_type_maximum_y( TYPE) Z_INSERT_##TYPE##_fixed_type(z_rectangle_, _maximum_y )
928
+ #define z_rectangle_type_middle_x( TYPE) Z_INSERT_##TYPE##_fixed_type(z_rectangle_, _middle_x )
929
+ #define z_rectangle_type_middle_y( TYPE) Z_INSERT_##TYPE##_fixed_type(z_rectangle_, _middle_y )
930
+ #define z_rectangle_type_minimum_x( TYPE) Z_INSERT_##TYPE##_fixed_type(z_rectangle_, _minimum_x )
931
+ #define z_rectangle_type_minimum_y( TYPE) Z_INSERT_##TYPE##_fixed_type(z_rectangle_, _minimum_y )
932
+ #define z_rectangle_type_shrink_from_bottom_center(TYPE) Z_INSERT_##TYPE##_fixed_type(z_rectangle_, _shrink_from_bottom_center)
933
+ #define z_rectangle_type_shrink_from_bottom_left( TYPE) Z_INSERT_##TYPE##_fixed_type(z_rectangle_, _shrink_from_bottom_left )
934
+ #define z_rectangle_type_shrink_from_bottom_right( TYPE) Z_INSERT_##TYPE##_fixed_type(z_rectangle_, _shrink_from_bottom_right )
935
+ #define z_rectangle_type_shrink_from_center( TYPE) Z_INSERT_##TYPE##_fixed_type(z_rectangle_, _shrink_from_center )
936
+ #define z_rectangle_type_shrink_from_center_left( TYPE) Z_INSERT_##TYPE##_fixed_type(z_rectangle_, _shrink_from_center_left )
937
+ #define z_rectangle_type_shrink_from_center_right( TYPE) Z_INSERT_##TYPE##_fixed_type(z_rectangle_, _shrink_from_center_right )
938
+ #define z_rectangle_type_shrink_from_top_center( TYPE) Z_INSERT_##TYPE##_fixed_type(z_rectangle_, _shrink_from_top_center )
939
+ #define z_rectangle_type_shrink_from_top_left( TYPE) Z_INSERT_##TYPE##_fixed_type(z_rectangle_, _shrink_from_top_left )
940
+ #define z_rectangle_type_shrink_from_top_right( TYPE) Z_INSERT_##TYPE##_fixed_type(z_rectangle_, _shrink_from_top_right )
941
+ #define z_rectangle_type_shrink_in_x_from_center( TYPE) Z_INSERT_##TYPE##_fixed_type(z_rectangle_, _shrink_in_x_from_center )
942
+ #define z_rectangle_type_shrink_in_x_from_left( TYPE) Z_INSERT_##TYPE##_fixed_type(z_rectangle_, _shrink_in_x_from_left )
943
+ #define z_rectangle_type_shrink_in_x_from_right( TYPE) Z_INSERT_##TYPE##_fixed_type(z_rectangle_, _shrink_in_x_from_right )
944
+ #define z_rectangle_type_shrink_in_y_from_bottom( TYPE) Z_INSERT_##TYPE##_fixed_type(z_rectangle_, _shrink_in_y_from_bottom )
945
+ #define z_rectangle_type_shrink_in_y_from_center( TYPE) Z_INSERT_##TYPE##_fixed_type(z_rectangle_, _shrink_in_y_from_center )
946
+ #define z_rectangle_type_shrink_in_y_from_top( TYPE) Z_INSERT_##TYPE##_fixed_type(z_rectangle_, _shrink_in_y_from_top )
947
+ #define z_rectangle_type_swap( TYPE) Z_INSERT_##TYPE##_fixed_type(z_rectangle_, _swap )
948
+ #define z_rectangle_type_top_center( TYPE) Z_INSERT_##TYPE##_fixed_type(z_rectangle_, _top_center )
949
+ #define z_rectangle_type_top_left( TYPE) Z_INSERT_##TYPE##_fixed_type(z_rectangle_, _top_left )
950
+ #define z_rectangle_type_top_right( TYPE) Z_INSERT_##TYPE##_fixed_type(z_rectangle_, _top_right )
951
+ #define z_rectangle_type_union( TYPE) Z_INSERT_##TYPE##_fixed_type(z_rectangle_, _union )
952
+
953
+
954
+ /* MARK: - Partial implementation for integer types */
955
+
956
+
957
+ #define Z_IMPLEMENTATION_INTEGER(Type, type) \
958
+ \
959
+ static Z_INLINE \
960
+ ZRectangle##Type z_rectangle_##type##_bottom_right_quarter(ZRectangle##Type object) \
961
+ { \
962
+ object.point.x += object.size.x / (z##type)2; \
963
+ object.size.x = object.size.x - object.size.x / (z##type)2; \
964
+ object.size.y /= (z##type)2; \
965
+ return object; \
966
+ } \
967
+ \
968
+ \
969
+ static Z_INLINE \
970
+ ZRectangle##Type z_rectangle_##type##_right_half(ZRectangle##Type object) \
971
+ { \
972
+ object.point.x += object.size.x / (z##type)2; \
973
+ object.size.x = object.size.x - object.size.x / (z##type)2; \
974
+ return object; \
975
+ } \
976
+ \
977
+ \
978
+ static Z_INLINE \
979
+ ZRectangle##Type z_rectangle_##type##_top_half(ZRectangle##Type object) \
980
+ { \
981
+ object.point.y += object.size.y / (z##type)2; \
982
+ object.size.y = object.size.y - object.size.y / (z##type)2; \
983
+ return object; \
984
+ } \
985
+ \
986
+ \
987
+ static Z_INLINE \
988
+ ZRectangle##Type z_rectangle_##type##_top_left_quarter(ZRectangle##Type object) \
989
+ { \
990
+ object.point.y += object.size.y / (z##type)2; \
991
+ object.size.x /= (z##type)2; \
992
+ object.size.y = object.size.y - object.size.y / (z##type)2; \
993
+ return object; \
994
+ } \
995
+ \
996
+ \
997
+ static Z_INLINE \
998
+ ZRectangle##Type z_rectangle_##type##_top_right_quarter(ZRectangle##Type object) \
999
+ { \
1000
+ object.point.x += object.size.x / (z##type)2; \
1001
+ object.point.y += object.size.y / (z##type)2; \
1002
+ object.size.x = object.size.x - object.size.x / (z##type)2; \
1003
+ object.size.y = object.size.y - object.size.y / (z##type)2; \
1004
+ return object; \
1005
+ }
1006
+
1007
+
1008
+ /* MARK: - Partial implementation for real types */
1009
+
1010
+
1011
+ #define Z_IMPLEMENTATION_REAL(Type, type) \
1012
+ \
1013
+ static Z_INLINE \
1014
+ Z2D##Type z_rectangle_##type##_absolute_point_to_unit(ZRectangle##Type object, Z2D##Type point) \
1015
+ { \
1016
+ return z_2d_##type \
1017
+ ((point.x - object.point.x) / object.size.x, \
1018
+ (point.y - object.point.y) / object.size.y); \
1019
+ } \
1020
+ \
1021
+ \
1022
+ static Z_INLINE \
1023
+ ZRectangle##Type z_rectangle_##type##_bottom_right_quarter(ZRectangle##Type object) \
1024
+ { \
1025
+ object.point.x += (object.size.x /= (z##type)2); \
1026
+ object.size.y /= (z##type)2; \
1027
+ return object; \
1028
+ } \
1029
+ \
1030
+ \
1031
+ static Z_INLINE \
1032
+ zboolean z_rectangle_##type##_contains_circle(ZRectangle##Type object,ZCircle##Type circle) \
1033
+ { \
1034
+ return circle.radius != (z##type)0 && \
1035
+ circle.point.x - circle.radius >= object.point.x && \
1036
+ circle.point.y - circle.radius >= object.point.y && \
1037
+ circle.point.x + circle.radius <= object.point.x + object.size.x && \
1038
+ circle.point.y + circle.radius <= object.point.y + object.size.y; \
1039
+ } \
1040
+ \
1041
+ \
1042
+ static Z_INLINE \
1043
+ ZCircle##Type z_rectangle_##type##_inner_circle(ZRectangle##Type object) \
1044
+ { \
1045
+ ZCircle##Type result; \
1046
+ \
1047
+ result.point = z_rectangle_##type##_center(object); \
1048
+ result.radius = z_##type##_minimum(object.size.x, object.size.y) / (z##type)2; \
1049
+ return result; \
1050
+ } \
1051
+ \
1052
+ \
1053
+ static Z_INLINE \
1054
+ ZRectangle##Type z_rectangle_##type##_right_half(ZRectangle##Type object) \
1055
+ { \
1056
+ object.point.x += (object.size.x /= (z##type)2); \
1057
+ return object; \
1058
+ } \
1059
+ \
1060
+ \
1061
+ static Z_INLINE \
1062
+ ZRectangle##Type z_rectangle_##type##_top_half(ZRectangle##Type object) \
1063
+ { \
1064
+ object.point.y += (object.size.y /= (z##type)2); \
1065
+ return object; \
1066
+ } \
1067
+ \
1068
+ \
1069
+ static Z_INLINE \
1070
+ ZRectangle##Type z_rectangle_##type##_top_left_quarter(ZRectangle##Type object) \
1071
+ { \
1072
+ object.size.x /= (z##type)2; \
1073
+ object.point.y += (object.size.y /= (z##type)2); \
1074
+ return object; \
1075
+ } \
1076
+ \
1077
+ \
1078
+ static Z_INLINE \
1079
+ ZRectangle##Type z_rectangle_##type##_top_right_quarter(ZRectangle##Type object) \
1080
+ { \
1081
+ object.point.x += (object.size.x /= (z##type)2); \
1082
+ object.point.y += (object.size.y /= (z##type)2); \
1083
+ return object; \
1084
+ } \
1085
+ \
1086
+ \
1087
+ static Z_INLINE \
1088
+ Z2D##Type z_rectangle_##type##_unit_point_to_absolute(ZRectangle##Type object, Z2D##Type point) \
1089
+ { \
1090
+ return z_2d_##type \
1091
+ (point.x * object.size.x + object.point.x, \
1092
+ point.y * object.size.y + object.point.y); \
1093
+ }
1094
+
1095
+
1096
+ #define z_rectangle_type_absolute_point_to_unit(TYPE) Z_INSERT_##TYPE##_fixed_type(z_rectangle_, _absolute_point_to_unit)
1097
+ #define z_rectangle_type_bottom_right_quarter( TYPE) Z_INSERT_##TYPE##_fixed_type(z_rectangle_, _bottom_right_quarter )
1098
+ #define z_rectangle_type_contains_circle( TYPE) Z_INSERT_##TYPE##_fixed_type(z_rectangle_, _contains_circle )
1099
+ #define z_rectangle_type_inner_circle( TYPE) Z_INSERT_##TYPE##_fixed_type(z_rectangle_, _inner_circle )
1100
+ #define z_rectangle_type_right_half( TYPE) Z_INSERT_##TYPE##_fixed_type(z_rectangle_, _right_half )
1101
+ #define z_rectangle_type_top_half( TYPE) Z_INSERT_##TYPE##_fixed_type(z_rectangle_, _top_half )
1102
+ #define z_rectangle_type_top_left_quarter( TYPE) Z_INSERT_##TYPE##_fixed_type(z_rectangle_, _top_left_quarter )
1103
+ #define z_rectangle_type_top_right_quarter( TYPE) Z_INSERT_##TYPE##_fixed_type(z_rectangle_, _top_right_quarter )
1104
+ #define z_rectangle_type_unit_point_to_absolute(TYPE) Z_INSERT_##TYPE##_fixed_type(z_rectangle_, _unit_point_to_absolute)
1105
+
1106
+
1107
+ /* MARK: - Implementation expansions */
1108
+
1109
+
1110
+ Z_IMPLEMENTATION_COMMON (SInt8, sint8)
1111
+ Z_IMPLEMENTATION_INTEGER(SInt8, sint8)
1112
+
1113
+ Z_IMPLEMENTATION_COMMON (SInt16, sint16)
1114
+ Z_IMPLEMENTATION_INTEGER(SInt16, sint16)
1115
+
1116
+ Z_IMPLEMENTATION_COMMON (SInt32, sint32)
1117
+ Z_IMPLEMENTATION_INTEGER(SInt32, sint32)
1118
+
1119
+ #ifdef Z_SINT64
1120
+ Z_IMPLEMENTATION_COMMON (SInt64, sint64)
1121
+ Z_IMPLEMENTATION_INTEGER(SInt64, sint64)
1122
+ #endif
1123
+
1124
+ #ifdef Z_SINT128
1125
+ Z_IMPLEMENTATION_COMMON (SInt128, sint128)
1126
+ Z_IMPLEMENTATION_INTEGER(SInt128, sint128)
1127
+ #endif
1128
+
1129
+ #ifdef Z_FLOAT16
1130
+ Z_IMPLEMENTATION_COMMON(Float16, float16)
1131
+ Z_IMPLEMENTATION_REAL (Float16, float16)
1132
+ #endif
1133
+
1134
+ #ifdef Z_FLOAT32
1135
+ Z_IMPLEMENTATION_COMMON(Float32, float32)
1136
+ Z_IMPLEMENTATION_REAL (Float32, float32)
1137
+ #endif
1138
+
1139
+ #ifdef Z_FLOAT64
1140
+ Z_IMPLEMENTATION_COMMON(Float64, float64)
1141
+ Z_IMPLEMENTATION_REAL (Float64, float64)
1142
+ #endif
1143
+
1144
+ #ifdef Z_FLOAT128
1145
+ Z_IMPLEMENTATION_COMMON(Float128, float128)
1146
+ Z_IMPLEMENTATION_REAL (Float128, float128)
1147
+ #endif
1148
+
1149
+ #ifdef Z_FLOAT80_X87
1150
+ Z_IMPLEMENTATION_COMMON(Float80_x87, float80_x87)
1151
+ Z_IMPLEMENTATION_REAL (Float80_x87, float80_x87)
1152
+ #endif
1153
+
1154
+ #ifdef Z_FLOAT96_X87
1155
+ Z_IMPLEMENTATION_COMMON(Float96_x87, float96_x87)
1156
+ Z_IMPLEMENTATION_REAL (Float96_x87, float96_x87)
1157
+ #endif
1158
+
1159
+ #ifdef Z_FLOAT128_X87
1160
+ Z_IMPLEMENTATION_COMMON(Float128_x87, float128_x87)
1161
+ Z_IMPLEMENTATION_REAL (Float128_x87, float128_x87)
1162
+ #endif
1163
+
1164
+
1165
+ /* MARK: - Cleanup */
1166
+
1167
+
1168
+ #undef Z_IMPLEMENTATION_COMMON
1169
+ #undef Z_IMPLEMENTATION_INTEGER
1170
+ #undef Z_IMPLEMENTATION_REAL
1171
+
1172
+
1173
+ /* MARK: - Default real type definitions */
1174
+
1175
+
1176
+ #ifdef Z_REAL
1177
+ # define z_rectangle_aabr z_rectangle_type_aabr (REAL)
1178
+ # define z_rectangle_absolute_point_to_unit z_rectangle_type_absolute_point_to_unit (REAL)
1179
+ # define z_rectangle_align_in_bottom_center z_rectangle_type_align_in_bottom_center (REAL)
1180
+ # define z_rectangle_align_in_bottom_left z_rectangle_type_align_in_bottom_left (REAL)
1181
+ # define z_rectangle_align_in_bottom_right z_rectangle_type_align_in_bottom_right (REAL)
1182
+ # define z_rectangle_align_in_center z_rectangle_type_align_in_center (REAL)
1183
+ # define z_rectangle_align_in_center_left z_rectangle_type_align_in_center_left (REAL)
1184
+ # define z_rectangle_align_in_center_right z_rectangle_type_align_in_center_right (REAL)
1185
+ # define z_rectangle_align_in_top_center z_rectangle_type_align_in_top_center (REAL)
1186
+ # define z_rectangle_align_in_top_left z_rectangle_type_align_in_top_left (REAL)
1187
+ # define z_rectangle_align_in_top_right z_rectangle_type_align_in_top_right (REAL)
1188
+ # define z_rectangle_are_equal z_rectangle_type_are_equal (REAL)
1189
+ # define z_rectangle_bottom_center z_rectangle_type_bottom_center (REAL)
1190
+ # define z_rectangle_bottom_half z_rectangle_type_bottom_half (REAL)
1191
+ # define z_rectangle_bottom_left z_rectangle_type_bottom_left (REAL)
1192
+ # define z_rectangle_bottom_left_quarter z_rectangle_type_bottom_left_quarter (REAL)
1193
+ # define z_rectangle_bottom_right z_rectangle_type_bottom_right (REAL)
1194
+ # define z_rectangle_bottom_right_quarter z_rectangle_type_bottom_right_quarter (REAL)
1195
+ # define z_rectangle_center z_rectangle_type_center (REAL)
1196
+ # define z_rectangle_center_left z_rectangle_type_center_left (REAL)
1197
+ # define z_rectangle_center_right z_rectangle_type_center_right (REAL)
1198
+ # define z_rectangle_contains z_rectangle_type_contains (REAL)
1199
+ # define z_rectangle_contains_aabr z_rectangle_type_contains_aabr (REAL)
1200
+ # define z_rectangle_contains_circle z_rectangle_type_contains_circle (REAL)
1201
+ # define z_rectangle_contains_point z_rectangle_type_contains_point (REAL)
1202
+ # define z_rectangle_correct z_rectangle_type_correct (REAL)
1203
+ # define z_rectangle_fit_in_bottom_center z_rectangle_type_fit_in_bottom_center (REAL)
1204
+ # define z_rectangle_fit_in_bottom_left z_rectangle_type_fit_in_bottom_left (REAL)
1205
+ # define z_rectangle_fit_in_bottom_right z_rectangle_type_fit_in_bottom_right (REAL)
1206
+ # define z_rectangle_fit_in_center z_rectangle_type_fit_in_center (REAL)
1207
+ # define z_rectangle_fit_in_center_left z_rectangle_type_fit_in_center_left (REAL)
1208
+ # define z_rectangle_fit_in_center_right z_rectangle_type_fit_in_center_right (REAL)
1209
+ # define z_rectangle_fit_in_top_center z_rectangle_type_fit_in_top_center (REAL)
1210
+ # define z_rectangle_fit_in_top_left z_rectangle_type_fit_in_top_left (REAL)
1211
+ # define z_rectangle_fit_in_top_right z_rectangle_type_fit_in_top_right (REAL)
1212
+ # define z_rectangle_from_vertices z_rectangle_type_from_vertices (REAL)
1213
+ # define z_rectangle_grow_from_bottom_center z_rectangle_type_grow_from_bottom_center (REAL)
1214
+ # define z_rectangle_grow_from_bottom_left z_rectangle_type_grow_from_bottom_left (REAL)
1215
+ # define z_rectangle_grow_from_bottom_right z_rectangle_type_grow_from_bottom_right (REAL)
1216
+ # define z_rectangle_grow_from_center z_rectangle_type_grow_from_center (REAL)
1217
+ # define z_rectangle_grow_from_center_left z_rectangle_type_grow_from_center_left (REAL)
1218
+ # define z_rectangle_grow_from_center_right z_rectangle_type_grow_from_center_right (REAL)
1219
+ # define z_rectangle_grow_from_top_center z_rectangle_type_grow_from_top_center (REAL)
1220
+ # define z_rectangle_grow_from_top_left z_rectangle_type_grow_from_top_left (REAL)
1221
+ # define z_rectangle_grow_from_top_right z_rectangle_type_grow_from_top_right (REAL)
1222
+ # define z_rectangle_grow_in_x_from_center z_rectangle_type_grow_in_x_from_center (REAL)
1223
+ # define z_rectangle_grow_in_x_from_left z_rectangle_type_grow_in_x_from_left (REAL)
1224
+ # define z_rectangle_grow_in_x_from_right z_rectangle_type_grow_in_x_from_right (REAL)
1225
+ # define z_rectangle_grow_in_y_from_bottom z_rectangle_type_grow_in_y_from_bottom (REAL)
1226
+ # define z_rectangle_grow_in_y_from_center z_rectangle_type_grow_in_y_from_center (REAL)
1227
+ # define z_rectangle_grow_in_y_from_top z_rectangle_type_grow_in_y_from_top (REAL)
1228
+ # define z_rectangle_inner_circle z_rectangle_type_inner_circle (REAL)
1229
+ # define z_rectangle_intersect z_rectangle_type_intersect (REAL)
1230
+ # define z_rectangle_intersection z_rectangle_type_intersection (REAL)
1231
+ # define z_rectangle_is_zero z_rectangle_type_is_zero (REAL)
1232
+ # define z_rectangle_left_half z_rectangle_type_left_half (REAL)
1233
+ # define z_rectangle_maximum_x z_rectangle_type_maximum_x (REAL)
1234
+ # define z_rectangle_maximum_y z_rectangle_type_maximum_y (REAL)
1235
+ # define z_rectangle_middle_x z_rectangle_type_middle_x (REAL)
1236
+ # define z_rectangle_middle_y z_rectangle_type_middle_y (REAL)
1237
+ # define z_rectangle_minimum_x z_rectangle_type_minimum_x (REAL)
1238
+ # define z_rectangle_minimum_y z_rectangle_type_minimum_y (REAL)
1239
+ # define z_rectangle_right_half z_rectangle_type_right_half (REAL)
1240
+ # define z_rectangle_shrink_from_bottom_center z_rectangle_type_shrink_from_bottom_center(REAL)
1241
+ # define z_rectangle_shrink_from_bottom_left z_rectangle_type_shrink_from_bottom_left (REAL)
1242
+ # define z_rectangle_shrink_from_bottom_right z_rectangle_type_shrink_from_bottom_right (REAL)
1243
+ # define z_rectangle_shrink_from_center z_rectangle_type_shrink_from_center (REAL)
1244
+ # define z_rectangle_shrink_from_center_left z_rectangle_type_shrink_from_center_left (REAL)
1245
+ # define z_rectangle_shrink_from_center_right z_rectangle_type_shrink_from_center_right (REAL)
1246
+ # define z_rectangle_shrink_from_top_center z_rectangle_type_shrink_from_top_center (REAL)
1247
+ # define z_rectangle_shrink_from_top_left z_rectangle_type_shrink_from_top_left (REAL)
1248
+ # define z_rectangle_shrink_from_top_right z_rectangle_type_shrink_from_top_right (REAL)
1249
+ # define z_rectangle_shrink_in_x_from_center z_rectangle_type_shrink_in_x_from_center (REAL)
1250
+ # define z_rectangle_shrink_in_x_from_left z_rectangle_type_shrink_in_x_from_left (REAL)
1251
+ # define z_rectangle_shrink_in_x_from_right z_rectangle_type_shrink_in_x_from_right (REAL)
1252
+ # define z_rectangle_shrink_in_y_from_bottom z_rectangle_type_shrink_in_y_from_bottom (REAL)
1253
+ # define z_rectangle_shrink_in_y_from_center z_rectangle_type_shrink_in_y_from_center (REAL)
1254
+ # define z_rectangle_shrink_in_y_from_top z_rectangle_type_shrink_in_y_from_top (REAL)
1255
+ # define z_rectangle_swap z_rectangle_type_swap (REAL)
1256
+ # define z_rectangle_top_center z_rectangle_type_top_center (REAL)
1257
+ # define z_rectangle_top_half z_rectangle_type_top_half (REAL)
1258
+ # define z_rectangle_top_left z_rectangle_type_top_left (REAL)
1259
+ # define z_rectangle_top_left_quarter z_rectangle_type_top_left_quarter (REAL)
1260
+ # define z_rectangle_top_right z_rectangle_type_top_right (REAL)
1261
+ # define z_rectangle_top_right_quarter z_rectangle_type_top_right_quarter (REAL)
1262
+ # define z_rectangle_union z_rectangle_type_union (REAL)
1263
+ # define z_rectangle_unit_point_to_absolute z_rectangle_type_unit_point_to_absolute (REAL)
1264
+ #endif
1265
+
1266
+
1267
+ #endif /* _Z_functions_mathematics_geometry_euclidean_ZRectangle_H_ */