tcc 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (283) hide show
  1. checksums.yaml +7 -0
  2. data/LICENSE +35 -0
  3. data/README.md +196 -0
  4. data/ext/tcc/extconf.rb +25 -0
  5. data/ext/tcc/tcc-0.9.26.patch +30 -0
  6. data/ext/tcc/tcc-0.9.26/COPYING +504 -0
  7. data/ext/tcc/tcc-0.9.26/Changelog +396 -0
  8. data/ext/tcc/tcc-0.9.26/Makefile +349 -0
  9. data/ext/tcc/tcc-0.9.26/README +101 -0
  10. data/ext/tcc/tcc-0.9.26/TODO +93 -0
  11. data/ext/tcc/tcc-0.9.26/VERSION +1 -0
  12. data/ext/tcc/tcc-0.9.26/arm-gen.c +2005 -0
  13. data/ext/tcc/tcc-0.9.26/c67-gen.c +2560 -0
  14. data/ext/tcc/tcc-0.9.26/coff.h +446 -0
  15. data/ext/tcc/tcc-0.9.26/config.h +8 -0
  16. data/ext/tcc/tcc-0.9.26/config.mak +28 -0
  17. data/ext/tcc/tcc-0.9.26/config.texi +1 -0
  18. data/ext/tcc/tcc-0.9.26/configure +540 -0
  19. data/ext/tcc/tcc-0.9.26/conftest.c +71 -0
  20. data/ext/tcc/tcc-0.9.26/elf.h +1731 -0
  21. data/ext/tcc/tcc-0.9.26/examples/ex1.c +8 -0
  22. data/ext/tcc/tcc-0.9.26/examples/ex2.c +98 -0
  23. data/ext/tcc/tcc-0.9.26/examples/ex3.c +24 -0
  24. data/ext/tcc/tcc-0.9.26/examples/ex4.c +26 -0
  25. data/ext/tcc/tcc-0.9.26/examples/ex5.c +8 -0
  26. data/ext/tcc/tcc-0.9.26/i386-asm.c +1498 -0
  27. data/ext/tcc/tcc-0.9.26/i386-asm.h +473 -0
  28. data/ext/tcc/tcc-0.9.26/i386-gen.c +1096 -0
  29. data/ext/tcc/tcc-0.9.26/i386-tok.h +243 -0
  30. data/ext/tcc/tcc-0.9.26/il-gen.c +667 -0
  31. data/ext/tcc/tcc-0.9.26/il-opcodes.h +251 -0
  32. data/ext/tcc/tcc-0.9.26/include/float.h +57 -0
  33. data/ext/tcc/tcc-0.9.26/include/stdarg.h +41 -0
  34. data/ext/tcc/tcc-0.9.26/include/stdbool.h +10 -0
  35. data/ext/tcc/tcc-0.9.26/include/stddef.h +28 -0
  36. data/ext/tcc/tcc-0.9.26/include/tcclib.h +78 -0
  37. data/ext/tcc/tcc-0.9.26/include/varargs.h +12 -0
  38. data/ext/tcc/tcc-0.9.26/lib/Makefile +102 -0
  39. data/ext/tcc/tcc-0.9.26/lib/alloca86-bt.S +47 -0
  40. data/ext/tcc/tcc-0.9.26/lib/alloca86.S +35 -0
  41. data/ext/tcc/tcc-0.9.26/lib/alloca86_64.S +42 -0
  42. data/ext/tcc/tcc-0.9.26/lib/bcheck.c +875 -0
  43. data/ext/tcc/tcc-0.9.26/lib/libtcc1.c +691 -0
  44. data/ext/tcc/tcc-0.9.26/libtcc.c +1941 -0
  45. data/ext/tcc/tcc-0.9.26/libtcc.h +103 -0
  46. data/ext/tcc/tcc-0.9.26/stab.def +234 -0
  47. data/ext/tcc/tcc-0.9.26/stab.h +17 -0
  48. data/ext/tcc/tcc-0.9.26/tcc-doc.html +2332 -0
  49. data/ext/tcc/tcc-0.9.26/tcc-doc.info +1151 -0
  50. data/ext/tcc/tcc-0.9.26/tcc-doc.texi +1268 -0
  51. data/ext/tcc/tcc-0.9.26/tcc.1 +415 -0
  52. data/ext/tcc/tcc-0.9.26/tcc.c +352 -0
  53. data/ext/tcc/tcc-0.9.26/tcc.h +1379 -0
  54. data/ext/tcc/tcc-0.9.26/tccasm.c +1118 -0
  55. data/ext/tcc/tcc-0.9.26/tcccoff.c +948 -0
  56. data/ext/tcc/tcc-0.9.26/tccelf.c +3129 -0
  57. data/ext/tcc/tcc-0.9.26/tccgen.c +5841 -0
  58. data/ext/tcc/tcc-0.9.26/tccpe.c +1887 -0
  59. data/ext/tcc/tcc-0.9.26/tccpp.c +3128 -0
  60. data/ext/tcc/tcc-0.9.26/tccrun.c +737 -0
  61. data/ext/tcc/tcc-0.9.26/tcctok.h +278 -0
  62. data/ext/tcc/tcc-0.9.26/tests/Makefile +199 -0
  63. data/ext/tcc/tcc-0.9.26/tests/asmtest.S +609 -0
  64. data/ext/tcc/tcc-0.9.26/tests/boundtest.c +233 -0
  65. data/ext/tcc/tcc-0.9.26/tests/gcctestsuite.sh +33 -0
  66. data/ext/tcc/tcc-0.9.26/tests/libtcc_test.c +76 -0
  67. data/ext/tcc/tcc-0.9.26/tests/tcctest.c +2713 -0
  68. data/ext/tcc/tcc-0.9.26/tests/tests2/00_assignment.c +18 -0
  69. data/ext/tcc/tcc-0.9.26/tests/tests2/00_assignment.expect +3 -0
  70. data/ext/tcc/tcc-0.9.26/tests/tests2/01_comment.c +14 -0
  71. data/ext/tcc/tcc-0.9.26/tests/tests2/01_comment.expect +5 -0
  72. data/ext/tcc/tcc-0.9.26/tests/tests2/02_printf.c +18 -0
  73. data/ext/tcc/tcc-0.9.26/tests/tests2/02_printf.expect +15 -0
  74. data/ext/tcc/tcc-0.9.26/tests/tests2/03_struct.c +31 -0
  75. data/ext/tcc/tcc-0.9.26/tests/tests2/03_struct.expect +6 -0
  76. data/ext/tcc/tcc-0.9.26/tests/tests2/04_for.c +15 -0
  77. data/ext/tcc/tcc-0.9.26/tests/tests2/04_for.expect +10 -0
  78. data/ext/tcc/tcc-0.9.26/tests/tests2/05_array.c +21 -0
  79. data/ext/tcc/tcc-0.9.26/tests/tests2/05_array.expect +10 -0
  80. data/ext/tcc/tcc-0.9.26/tests/tests2/06_case.c +29 -0
  81. data/ext/tcc/tcc-0.9.26/tests/tests2/06_case.expect +8 -0
  82. data/ext/tcc/tcc-0.9.26/tests/tests2/07_function.c +30 -0
  83. data/ext/tcc/tcc-0.9.26/tests/tests2/07_function.expect +4 -0
  84. data/ext/tcc/tcc-0.9.26/tests/tests2/08_while.c +24 -0
  85. data/ext/tcc/tcc-0.9.26/tests/tests2/08_while.expect +11 -0
  86. data/ext/tcc/tcc-0.9.26/tests/tests2/09_do_while.c +24 -0
  87. data/ext/tcc/tcc-0.9.26/tests/tests2/09_do_while.expect +11 -0
  88. data/ext/tcc/tcc-0.9.26/tests/tests2/10_pointer.c +40 -0
  89. data/ext/tcc/tcc-0.9.26/tests/tests2/10_pointer.expect +8 -0
  90. data/ext/tcc/tcc-0.9.26/tests/tests2/11_precedence.c +40 -0
  91. data/ext/tcc/tcc-0.9.26/tests/tests2/11_precedence.expect +15 -0
  92. data/ext/tcc/tcc-0.9.26/tests/tests2/12_hashdefine.c +14 -0
  93. data/ext/tcc/tcc-0.9.26/tests/tests2/12_hashdefine.expect +2 -0
  94. data/ext/tcc/tcc-0.9.26/tests/tests2/13_integer_literals.c +20 -0
  95. data/ext/tcc/tcc-0.9.26/tests/tests2/13_integer_literals.expect +5 -0
  96. data/ext/tcc/tcc-0.9.26/tests/tests2/14_if.c +21 -0
  97. data/ext/tcc/tcc-0.9.26/tests/tests2/14_if.expect +2 -0
  98. data/ext/tcc/tcc-0.9.26/tests/tests2/15_recursion.c +21 -0
  99. data/ext/tcc/tcc-0.9.26/tests/tests2/15_recursion.expect +10 -0
  100. data/ext/tcc/tcc-0.9.26/tests/tests2/16_nesting.c +21 -0
  101. data/ext/tcc/tcc-0.9.26/tests/tests2/16_nesting.expect +18 -0
  102. data/ext/tcc/tcc-0.9.26/tests/tests2/17_enum.c +29 -0
  103. data/ext/tcc/tcc-0.9.26/tests/tests2/17_enum.expect +3 -0
  104. data/ext/tcc/tcc-0.9.26/tests/tests2/18_include.c +12 -0
  105. data/ext/tcc/tcc-0.9.26/tests/tests2/18_include.expect +3 -0
  106. data/ext/tcc/tcc-0.9.26/tests/tests2/18_include.h +1 -0
  107. data/ext/tcc/tcc-0.9.26/tests/tests2/19_pointer_arithmetic.c +28 -0
  108. data/ext/tcc/tcc-0.9.26/tests/tests2/19_pointer_arithmetic.expect +3 -0
  109. data/ext/tcc/tcc-0.9.26/tests/tests2/20_pointer_comparison.c +24 -0
  110. data/ext/tcc/tcc-0.9.26/tests/tests2/20_pointer_comparison.expect +6 -0
  111. data/ext/tcc/tcc-0.9.26/tests/tests2/21_char_array.c +33 -0
  112. data/ext/tcc/tcc-0.9.26/tests/tests2/21_char_array.expect +7 -0
  113. data/ext/tcc/tcc-0.9.26/tests/tests2/22_floating_point.c +50 -0
  114. data/ext/tcc/tcc-0.9.26/tests/tests2/22_floating_point.expect +16 -0
  115. data/ext/tcc/tcc-0.9.26/tests/tests2/23_type_coercion.c +54 -0
  116. data/ext/tcc/tcc-0.9.26/tests/tests2/23_type_coercion.expect +12 -0
  117. data/ext/tcc/tcc-0.9.26/tests/tests2/24_math_library.c +28 -0
  118. data/ext/tcc/tcc-0.9.26/tests/tests2/24_math_library.expect +18 -0
  119. data/ext/tcc/tcc-0.9.26/tests/tests2/25_quicksort.c +83 -0
  120. data/ext/tcc/tcc-0.9.26/tests/tests2/25_quicksort.expect +2 -0
  121. data/ext/tcc/tcc-0.9.26/tests/tests2/26_character_constants.c +17 -0
  122. data/ext/tcc/tcc-0.9.26/tests/tests2/26_character_constants.expect +8 -0
  123. data/ext/tcc/tcc-0.9.26/tests/tests2/27_sizeof.c +16 -0
  124. data/ext/tcc/tcc-0.9.26/tests/tests2/27_sizeof.expect +3 -0
  125. data/ext/tcc/tcc-0.9.26/tests/tests2/28_strings.c +46 -0
  126. data/ext/tcc/tcc-0.9.26/tests/tests2/28_strings.expect +19 -0
  127. data/ext/tcc/tcc-0.9.26/tests/tests2/29_array_address.c +13 -0
  128. data/ext/tcc/tcc-0.9.26/tests/tests2/29_array_address.expect +1 -0
  129. data/ext/tcc/tcc-0.9.26/tests/tests2/30_hanoi.c +122 -0
  130. data/ext/tcc/tcc-0.9.26/tests/tests2/30_hanoi.expect +71 -0
  131. data/ext/tcc/tcc-0.9.26/tests/tests2/31_args.c +14 -0
  132. data/ext/tcc/tcc-0.9.26/tests/tests2/31_args.expect +7 -0
  133. data/ext/tcc/tcc-0.9.26/tests/tests2/32_led.c +266 -0
  134. data/ext/tcc/tcc-0.9.26/tests/tests2/32_led.expect +4 -0
  135. data/ext/tcc/tcc-0.9.26/tests/tests2/33_ternary_op.c +15 -0
  136. data/ext/tcc/tcc-0.9.26/tests/tests2/33_ternary_op.expect +10 -0
  137. data/ext/tcc/tcc-0.9.26/tests/tests2/34_array_assignment.c +23 -0
  138. data/ext/tcc/tcc-0.9.26/tests/tests2/34_array_assignment.expect +2 -0
  139. data/ext/tcc/tcc-0.9.26/tests/tests2/35_sizeof.c +14 -0
  140. data/ext/tcc/tcc-0.9.26/tests/tests2/35_sizeof.expect +2 -0
  141. data/ext/tcc/tcc-0.9.26/tests/tests2/36_array_initialisers.c +21 -0
  142. data/ext/tcc/tcc-0.9.26/tests/tests2/36_array_initialisers.expect +20 -0
  143. data/ext/tcc/tcc-0.9.26/tests/tests2/37_sprintf.c +17 -0
  144. data/ext/tcc/tcc-0.9.26/tests/tests2/37_sprintf.expect +20 -0
  145. data/ext/tcc/tcc-0.9.26/tests/tests2/38_multiple_array_index.c +32 -0
  146. data/ext/tcc/tcc-0.9.26/tests/tests2/38_multiple_array_index.expect +4 -0
  147. data/ext/tcc/tcc-0.9.26/tests/tests2/39_typedef.c +31 -0
  148. data/ext/tcc/tcc-0.9.26/tests/tests2/39_typedef.expect +3 -0
  149. data/ext/tcc/tcc-0.9.26/tests/tests2/40_stdio.c +52 -0
  150. data/ext/tcc/tcc-0.9.26/tests/tests2/40_stdio.expect +27 -0
  151. data/ext/tcc/tcc-0.9.26/tests/tests2/41_hashif.c +85 -0
  152. data/ext/tcc/tcc-0.9.26/tests/tests2/41_hashif.expect +6 -0
  153. data/ext/tcc/tcc-0.9.26/tests/tests2/42_function_pointer.c +18 -0
  154. data/ext/tcc/tcc-0.9.26/tests/tests2/42_function_pointer.expect +2 -0
  155. data/ext/tcc/tcc-0.9.26/tests/tests2/43_void_param.c +15 -0
  156. data/ext/tcc/tcc-0.9.26/tests/tests2/43_void_param.expect +1 -0
  157. data/ext/tcc/tcc-0.9.26/tests/tests2/44_scoped_declarations.c +17 -0
  158. data/ext/tcc/tcc-0.9.26/tests/tests2/44_scoped_declarations.expect +1 -0
  159. data/ext/tcc/tcc-0.9.26/tests/tests2/45_empty_for.c +18 -0
  160. data/ext/tcc/tcc-0.9.26/tests/tests2/45_empty_for.expect +10 -0
  161. data/ext/tcc/tcc-0.9.26/tests/tests2/46_grep.c +564 -0
  162. data/ext/tcc/tcc-0.9.26/tests/tests2/47_switch_return.c +24 -0
  163. data/ext/tcc/tcc-0.9.26/tests/tests2/47_switch_return.expect +4 -0
  164. data/ext/tcc/tcc-0.9.26/tests/tests2/48_nested_break.c +26 -0
  165. data/ext/tcc/tcc-0.9.26/tests/tests2/48_nested_break.expect +1 -0
  166. data/ext/tcc/tcc-0.9.26/tests/tests2/49_bracket_evaluation.c +23 -0
  167. data/ext/tcc/tcc-0.9.26/tests/tests2/49_bracket_evaluation.expect +1 -0
  168. data/ext/tcc/tcc-0.9.26/tests/tests2/50_logical_second_arg.c +29 -0
  169. data/ext/tcc/tcc-0.9.26/tests/tests2/50_logical_second_arg.expect +20 -0
  170. data/ext/tcc/tcc-0.9.26/tests/tests2/51_static.c +30 -0
  171. data/ext/tcc/tcc-0.9.26/tests/tests2/51_static.expect +8 -0
  172. data/ext/tcc/tcc-0.9.26/tests/tests2/52_unnamed_enum.c +27 -0
  173. data/ext/tcc/tcc-0.9.26/tests/tests2/52_unnamed_enum.expect +9 -0
  174. data/ext/tcc/tcc-0.9.26/tests/tests2/54_goto.c +56 -0
  175. data/ext/tcc/tcc-0.9.26/tests/tests2/54_goto.expect +8 -0
  176. data/ext/tcc/tcc-0.9.26/tests/tests2/55_lshift_type.c +52 -0
  177. data/ext/tcc/tcc-0.9.26/tests/tests2/55_lshift_type.expect +1 -0
  178. data/ext/tcc/tcc-0.9.26/tests/tests2/LICENSE +37 -0
  179. data/ext/tcc/tcc-0.9.26/tests/tests2/Makefile +98 -0
  180. data/ext/tcc/tcc-0.9.26/texi2pod.pl +427 -0
  181. data/ext/tcc/tcc-0.9.26/win32/build-tcc.bat +60 -0
  182. data/ext/tcc/tcc-0.9.26/win32/examples/dll.c +12 -0
  183. data/ext/tcc/tcc-0.9.26/win32/examples/fib.c +23 -0
  184. data/ext/tcc/tcc-0.9.26/win32/examples/hello_dll.c +19 -0
  185. data/ext/tcc/tcc-0.9.26/win32/examples/hello_win.c +163 -0
  186. data/ext/tcc/tcc-0.9.26/win32/include/_mingw.h +139 -0
  187. data/ext/tcc/tcc-0.9.26/win32/include/assert.h +54 -0
  188. data/ext/tcc/tcc-0.9.26/win32/include/conio.h +409 -0
  189. data/ext/tcc/tcc-0.9.26/win32/include/ctype.h +281 -0
  190. data/ext/tcc/tcc-0.9.26/win32/include/dir.h +31 -0
  191. data/ext/tcc/tcc-0.9.26/win32/include/direct.h +68 -0
  192. data/ext/tcc/tcc-0.9.26/win32/include/dirent.h +135 -0
  193. data/ext/tcc/tcc-0.9.26/win32/include/dos.h +55 -0
  194. data/ext/tcc/tcc-0.9.26/win32/include/errno.h +75 -0
  195. data/ext/tcc/tcc-0.9.26/win32/include/excpt.h +123 -0
  196. data/ext/tcc/tcc-0.9.26/win32/include/fcntl.h +52 -0
  197. data/ext/tcc/tcc-0.9.26/win32/include/fenv.h +108 -0
  198. data/ext/tcc/tcc-0.9.26/win32/include/inttypes.h +297 -0
  199. data/ext/tcc/tcc-0.9.26/win32/include/io.h +418 -0
  200. data/ext/tcc/tcc-0.9.26/win32/include/limits.h +111 -0
  201. data/ext/tcc/tcc-0.9.26/win32/include/locale.h +91 -0
  202. data/ext/tcc/tcc-0.9.26/win32/include/malloc.h +175 -0
  203. data/ext/tcc/tcc-0.9.26/win32/include/math.h +777 -0
  204. data/ext/tcc/tcc-0.9.26/win32/include/mem.h +13 -0
  205. data/ext/tcc/tcc-0.9.26/win32/include/memory.h +40 -0
  206. data/ext/tcc/tcc-0.9.26/win32/include/process.h +176 -0
  207. data/ext/tcc/tcc-0.9.26/win32/include/sec_api/conio_s.h +42 -0
  208. data/ext/tcc/tcc-0.9.26/win32/include/sec_api/crtdbg_s.h +19 -0
  209. data/ext/tcc/tcc-0.9.26/win32/include/sec_api/io_s.h +33 -0
  210. data/ext/tcc/tcc-0.9.26/win32/include/sec_api/mbstring_s.h +52 -0
  211. data/ext/tcc/tcc-0.9.26/win32/include/sec_api/search_s.h +25 -0
  212. data/ext/tcc/tcc-0.9.26/win32/include/sec_api/stdio_s.h +145 -0
  213. data/ext/tcc/tcc-0.9.26/win32/include/sec_api/stdlib_s.h +67 -0
  214. data/ext/tcc/tcc-0.9.26/win32/include/sec_api/stralign_s.h +30 -0
  215. data/ext/tcc/tcc-0.9.26/win32/include/sec_api/string_s.h +41 -0
  216. data/ext/tcc/tcc-0.9.26/win32/include/sec_api/sys/timeb_s.h +34 -0
  217. data/ext/tcc/tcc-0.9.26/win32/include/sec_api/tchar_s.h +266 -0
  218. data/ext/tcc/tcc-0.9.26/win32/include/sec_api/time_s.h +61 -0
  219. data/ext/tcc/tcc-0.9.26/win32/include/sec_api/wchar_s.h +128 -0
  220. data/ext/tcc/tcc-0.9.26/win32/include/setjmp.h +160 -0
  221. data/ext/tcc/tcc-0.9.26/win32/include/share.h +28 -0
  222. data/ext/tcc/tcc-0.9.26/win32/include/signal.h +63 -0
  223. data/ext/tcc/tcc-0.9.26/win32/include/stdint.h +209 -0
  224. data/ext/tcc/tcc-0.9.26/win32/include/stdio.h +429 -0
  225. data/ext/tcc/tcc-0.9.26/win32/include/stdlib.h +580 -0
  226. data/ext/tcc/tcc-0.9.26/win32/include/string.h +164 -0
  227. data/ext/tcc/tcc-0.9.26/win32/include/sys/fcntl.h +13 -0
  228. data/ext/tcc/tcc-0.9.26/win32/include/sys/file.h +14 -0
  229. data/ext/tcc/tcc-0.9.26/win32/include/sys/locking.h +30 -0
  230. data/ext/tcc/tcc-0.9.26/win32/include/sys/stat.h +290 -0
  231. data/ext/tcc/tcc-0.9.26/win32/include/sys/time.h +69 -0
  232. data/ext/tcc/tcc-0.9.26/win32/include/sys/timeb.h +133 -0
  233. data/ext/tcc/tcc-0.9.26/win32/include/sys/types.h +118 -0
  234. data/ext/tcc/tcc-0.9.26/win32/include/sys/unistd.h +14 -0
  235. data/ext/tcc/tcc-0.9.26/win32/include/sys/utime.h +146 -0
  236. data/ext/tcc/tcc-0.9.26/win32/include/tchar.h +1102 -0
  237. data/ext/tcc/tcc-0.9.26/win32/include/time.h +287 -0
  238. data/ext/tcc/tcc-0.9.26/win32/include/vadefs.h +11 -0
  239. data/ext/tcc/tcc-0.9.26/win32/include/values.h +4 -0
  240. data/ext/tcc/tcc-0.9.26/win32/include/wchar.h +871 -0
  241. data/ext/tcc/tcc-0.9.26/win32/include/wctype.h +172 -0
  242. data/ext/tcc/tcc-0.9.26/win32/include/winapi/basetsd.h +149 -0
  243. data/ext/tcc/tcc-0.9.26/win32/include/winapi/basetyps.h +85 -0
  244. data/ext/tcc/tcc-0.9.26/win32/include/winapi/guiddef.h +151 -0
  245. data/ext/tcc/tcc-0.9.26/win32/include/winapi/intrin.h +11 -0
  246. data/ext/tcc/tcc-0.9.26/win32/include/winapi/poppack.h +8 -0
  247. data/ext/tcc/tcc-0.9.26/win32/include/winapi/pshpack1.h +8 -0
  248. data/ext/tcc/tcc-0.9.26/win32/include/winapi/pshpack2.h +8 -0
  249. data/ext/tcc/tcc-0.9.26/win32/include/winapi/pshpack4.h +8 -0
  250. data/ext/tcc/tcc-0.9.26/win32/include/winapi/pshpack8.h +8 -0
  251. data/ext/tcc/tcc-0.9.26/win32/include/winapi/reason.h +80 -0
  252. data/ext/tcc/tcc-0.9.26/win32/include/winapi/specstrings.h +7 -0
  253. data/ext/tcc/tcc-0.9.26/win32/include/winapi/stralign.h +154 -0
  254. data/ext/tcc/tcc-0.9.26/win32/include/winapi/tvout.h +79 -0
  255. data/ext/tcc/tcc-0.9.26/win32/include/winapi/winbase.h +2951 -0
  256. data/ext/tcc/tcc-0.9.26/win32/include/winapi/wincon.h +301 -0
  257. data/ext/tcc/tcc-0.9.26/win32/include/winapi/windef.h +293 -0
  258. data/ext/tcc/tcc-0.9.26/win32/include/winapi/windows.h +123 -0
  259. data/ext/tcc/tcc-0.9.26/win32/include/winapi/winerror.h +3166 -0
  260. data/ext/tcc/tcc-0.9.26/win32/include/winapi/wingdi.h +4080 -0
  261. data/ext/tcc/tcc-0.9.26/win32/include/winapi/winnetwk.h +476 -0
  262. data/ext/tcc/tcc-0.9.26/win32/include/winapi/winnls.h +765 -0
  263. data/ext/tcc/tcc-0.9.26/win32/include/winapi/winnt.h +5770 -0
  264. data/ext/tcc/tcc-0.9.26/win32/include/winapi/winreg.h +272 -0
  265. data/ext/tcc/tcc-0.9.26/win32/include/winapi/winuser.h +5651 -0
  266. data/ext/tcc/tcc-0.9.26/win32/include/winapi/winver.h +160 -0
  267. data/ext/tcc/tcc-0.9.26/win32/lib/chkstk.S +191 -0
  268. data/ext/tcc/tcc-0.9.26/win32/lib/crt1.c +34 -0
  269. data/ext/tcc/tcc-0.9.26/win32/lib/dllcrt1.c +13 -0
  270. data/ext/tcc/tcc-0.9.26/win32/lib/dllmain.c +9 -0
  271. data/ext/tcc/tcc-0.9.26/win32/lib/gdi32.def +337 -0
  272. data/ext/tcc/tcc-0.9.26/win32/lib/kernel32.def +765 -0
  273. data/ext/tcc/tcc-0.9.26/win32/lib/msvcrt.def +1399 -0
  274. data/ext/tcc/tcc-0.9.26/win32/lib/user32.def +654 -0
  275. data/ext/tcc/tcc-0.9.26/win32/lib/wincrt1.c +64 -0
  276. data/ext/tcc/tcc-0.9.26/win32/tcc-win32.txt +156 -0
  277. data/ext/tcc/tcc-0.9.26/win32/tools/tiny_impdef.c +243 -0
  278. data/ext/tcc/tcc-0.9.26/win32/tools/tiny_libmaker.c +258 -0
  279. data/ext/tcc/tcc-0.9.26/x86_64-asm.h +448 -0
  280. data/ext/tcc/tcc-0.9.26/x86_64-gen.c +1701 -0
  281. data/lib/tcc.rb +291 -0
  282. data/tcc.gemspec +15 -0
  283. metadata +343 -0
@@ -0,0 +1,12 @@
1
+ //+---------------------------------------------------------------------------
2
+ //
3
+ // dll.c - Windows DLL example - dynamically linked part
4
+ //
5
+
6
+ #include <windows.h>
7
+ #define DLL_EXPORT __declspec(dllexport)
8
+
9
+ DLL_EXPORT void HelloWorld (void)
10
+ {
11
+ MessageBox (0, "Hello World!", "From DLL", MB_ICONINFORMATION);
12
+ }
@@ -0,0 +1,23 @@
1
+ #include <stdio.h>
2
+
3
+ int fib(n)
4
+ {
5
+ if (n <= 2)
6
+ return 1;
7
+ else
8
+ return fib(n-1) + fib(n-2);
9
+ }
10
+
11
+ int main(int argc, char **argv)
12
+ {
13
+ int n;
14
+ if (argc < 2) {
15
+ printf("usage: fib n\n"
16
+ "Compute nth Fibonacci number\n");
17
+ return 1;
18
+ }
19
+
20
+ n = atoi(argv[1]);
21
+ printf("fib(%d) = %d\n", n, fib(n));
22
+ return 0;
23
+ }
@@ -0,0 +1,19 @@
1
+ //+---------------------------------------------------------------------------
2
+ //
3
+ // HELLO_DLL.C - Windows DLL example - main application part
4
+ //
5
+
6
+ #include <windows.h>
7
+
8
+ void HelloWorld (void);
9
+
10
+ int WINAPI WinMain(
11
+ HINSTANCE hInstance,
12
+ HINSTANCE hPrevInstance,
13
+ LPSTR lpCmdLine,
14
+ int nCmdShow)
15
+ {
16
+ HelloWorld();
17
+ return 0;
18
+ }
19
+
@@ -0,0 +1,163 @@
1
+ //+---------------------------------------------------------------------------
2
+ //
3
+ // HELLO_WIN.C - Windows GUI 'Hello World!' Example
4
+ //
5
+ //+---------------------------------------------------------------------------
6
+
7
+ #include <windows.h>
8
+
9
+ #define APPNAME "HELLO_WIN"
10
+
11
+ char szAppName[] = APPNAME; // The name of this application
12
+ char szTitle[] = APPNAME; // The title bar text
13
+ const char *pWindowText;
14
+
15
+ void CenterWindow(HWND hWnd);
16
+
17
+ //+---------------------------------------------------------------------------
18
+ //
19
+ // Function: WndProc
20
+ //
21
+ // Synopsis: very unusual type of function - gets called by system to
22
+ // process windows messages.
23
+ //
24
+ // Arguments: same as always.
25
+ //----------------------------------------------------------------------------
26
+
27
+ LRESULT CALLBACK WndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
28
+ {
29
+ switch (message) {
30
+
31
+ // ----------------------- first and last
32
+ case WM_CREATE:
33
+ CenterWindow(hwnd);
34
+ break;
35
+
36
+ case WM_DESTROY:
37
+ PostQuitMessage(0);
38
+ break;
39
+
40
+ // ----------------------- get out of it...
41
+ case WM_RBUTTONUP:
42
+ DestroyWindow(hwnd);
43
+ break;
44
+
45
+ case WM_KEYDOWN:
46
+ if (VK_ESCAPE == wParam)
47
+ DestroyWindow(hwnd);
48
+ break;
49
+
50
+ // ----------------------- display our minimal info
51
+ case WM_PAINT:
52
+ {
53
+ PAINTSTRUCT ps;
54
+ HDC hdc;
55
+ RECT rc;
56
+ hdc = BeginPaint(hwnd, &ps);
57
+
58
+ GetClientRect(hwnd, &rc);
59
+ SetTextColor(hdc, RGB(240,240,96));
60
+ SetBkMode(hdc, TRANSPARENT);
61
+ DrawText(hdc, pWindowText, -1, &rc, DT_CENTER|DT_SINGLELINE|DT_VCENTER);
62
+
63
+ EndPaint(hwnd, &ps);
64
+ break;
65
+ }
66
+
67
+ // ----------------------- let windows do all other stuff
68
+ default:
69
+ return DefWindowProc(hwnd, message, wParam, lParam);
70
+ }
71
+ return 0;
72
+ }
73
+
74
+ //+---------------------------------------------------------------------------
75
+ //
76
+ // Function: WinMain
77
+ //
78
+ // Synopsis: standard entrypoint for GUI Win32 apps
79
+ //
80
+ //----------------------------------------------------------------------------
81
+ int APIENTRY WinMain(
82
+ HINSTANCE hInstance,
83
+ HINSTANCE hPrevInstance,
84
+ LPSTR lpCmdLine,
85
+ int nCmdShow
86
+ )
87
+ {
88
+ MSG msg;
89
+ WNDCLASS wc;
90
+ HWND hwnd;
91
+
92
+ pWindowText = lpCmdLine[0] ? lpCmdLine : "Hello Windows!";
93
+
94
+ // Fill in window class structure with parameters that describe
95
+ // the main window.
96
+
97
+ ZeroMemory(&wc, sizeof wc);
98
+ wc.hInstance = hInstance;
99
+ wc.lpszClassName = szAppName;
100
+ wc.lpfnWndProc = (WNDPROC)WndProc;
101
+ wc.style = CS_DBLCLKS|CS_VREDRAW|CS_HREDRAW;
102
+ wc.hbrBackground = (HBRUSH)GetStockObject(BLACK_BRUSH);
103
+ wc.hIcon = LoadIcon(NULL, IDI_APPLICATION);
104
+ wc.hCursor = LoadCursor(NULL, IDC_ARROW);
105
+
106
+ if (FALSE == RegisterClass(&wc))
107
+ return 0;
108
+
109
+ // create the browser
110
+ hwnd = CreateWindow(
111
+ szAppName,
112
+ szTitle,
113
+ WS_OVERLAPPEDWINDOW|WS_VISIBLE,
114
+ CW_USEDEFAULT,
115
+ CW_USEDEFAULT,
116
+ 360,//CW_USEDEFAULT,
117
+ 240,//CW_USEDEFAULT,
118
+ 0,
119
+ 0,
120
+ hInstance,
121
+ 0);
122
+
123
+ if (NULL == hwnd)
124
+ return 0;
125
+
126
+ // Main message loop:
127
+ while (GetMessage(&msg, NULL, 0, 0) > 0) {
128
+ TranslateMessage(&msg);
129
+ DispatchMessage(&msg);
130
+ }
131
+
132
+ return msg.wParam;
133
+ }
134
+
135
+ //+---------------------------------------------------------------------------
136
+
137
+ //+---------------------------------------------------------------------------
138
+
139
+ void CenterWindow(HWND hwnd_self)
140
+ {
141
+ HWND hwnd_parent;
142
+ RECT rw_self, rc_parent, rw_parent;
143
+ int xpos, ypos;
144
+
145
+ hwnd_parent = GetParent(hwnd_self);
146
+ if (NULL == hwnd_parent)
147
+ hwnd_parent = GetDesktopWindow();
148
+
149
+ GetWindowRect(hwnd_parent, &rw_parent);
150
+ GetClientRect(hwnd_parent, &rc_parent);
151
+ GetWindowRect(hwnd_self, &rw_self);
152
+
153
+ xpos = rw_parent.left + (rc_parent.right + rw_self.left - rw_self.right) / 2;
154
+ ypos = rw_parent.top + (rc_parent.bottom + rw_self.top - rw_self.bottom) / 2;
155
+
156
+ SetWindowPos(
157
+ hwnd_self, NULL,
158
+ xpos, ypos, 0, 0,
159
+ SWP_NOSIZE|SWP_NOZORDER|SWP_NOACTIVATE
160
+ );
161
+ }
162
+
163
+ //+---------------------------------------------------------------------------
@@ -0,0 +1,139 @@
1
+ /*
2
+ * _mingw.h
3
+ *
4
+ * This file is for TinyCC and not part of the Mingw32 package.
5
+ *
6
+ * THIS SOFTWARE IS NOT COPYRIGHTED
7
+ *
8
+ * This source code is offered for use in the public domain. You may
9
+ * use, modify or distribute it freely.
10
+ *
11
+ * This code is distributed in the hope that it will be useful but
12
+ * WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY
13
+ * DISCLAIMED. This includes but is not limited to warranties of
14
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
15
+ *
16
+ */
17
+
18
+ #ifndef __MINGW_H
19
+ #define __MINGW_H
20
+
21
+ /* some winapi files define these before including _mingw.h --> */
22
+ #undef __cdecl
23
+ #undef _X86_
24
+ #undef WIN32
25
+ /* <-- */
26
+
27
+ #include <stddef.h>
28
+ #include <stdarg.h>
29
+
30
+ #define __int8 char
31
+ #define __int16 short
32
+ #define __int32 int
33
+ #define __int64 long long
34
+
35
+ #define __cdecl __attribute__((__cdecl__))
36
+ #define __declspec(x) __attribute__((x))
37
+ #define __unaligned __attribute__((packed))
38
+ #define __fastcall __attribute__((fastcall))
39
+
40
+ #define __MSVCRT__ 1
41
+ #undef _MSVCRT_
42
+ #define __MINGW_IMPORT extern __declspec(dllimport)
43
+ #define __MINGW_ATTRIB_NORETURN
44
+ #define __MINGW_ATTRIB_CONST
45
+ #define __MINGW_ATTRIB_DEPRECATED
46
+ #define __MINGW_ATTRIB_MALLOC
47
+ #define __MINGW_ATTRIB_PURE
48
+ #define __MINGW_ATTRIB_NONNULL(arg)
49
+ #define __MINGW_NOTHROW
50
+ #define __GNUC_VA_LIST
51
+
52
+ #define _CRTIMP extern
53
+ #define __CRT_INLINE extern __inline__
54
+
55
+ #define _CRT_ALIGN(x) __attribute__((aligned(x)))
56
+ #define DECLSPEC_ALIGN(x) __attribute__((aligned(x)))
57
+ #define _CRT_PACKING 8
58
+ #define __CRT_UNALIGNED
59
+ #define _CONST_RETURN
60
+
61
+ #define __CRT_STRINGIZE(_Value) #_Value
62
+ #define _CRT_STRINGIZE(_Value) __CRT_STRINGIZE(_Value)
63
+ #define __CRT_WIDE(_String) L ## _String
64
+ #define _CRT_WIDE(_String) __CRT_WIDE(_String)
65
+
66
+ #ifdef _WIN64
67
+ #define __stdcall
68
+ #define _AMD64_ 1
69
+ #define __x86_64 1
70
+ #define USE_MINGW_SETJMP_TWO_ARGS
71
+ #define mingw_getsp tinyc_getbp
72
+ #define __TRY__
73
+ #else
74
+ #define __stdcall __attribute__((__stdcall__))
75
+ #define _X86_ 1
76
+ #define WIN32 1
77
+ #define _USE_32BIT_TIME_T
78
+ #define __TRY__ void __try__(void**), *_sehrec[6]; __try__(_sehrec);
79
+ #endif
80
+
81
+ /* in stddef.h */
82
+ #define _SIZE_T_DEFINED
83
+ #define _SSIZE_T_DEFINED
84
+ #define _PTRDIFF_T_DEFINED
85
+ #define _WCHAR_T_DEFINED
86
+ #define _UINTPTR_T_DEFINED
87
+ #define _INTPTR_T_DEFINED
88
+
89
+ #define _INTEGRAL_MAX_BITS 64
90
+
91
+ typedef long __time32_t;
92
+ #define _TIME32_T_DEFINED
93
+ typedef __int64 __time64_t;
94
+ #define _TIME64_T_DEFINED
95
+ #ifdef _USE_32BIT_TIME_T
96
+ typedef __time32_t time_t;
97
+ #define _TIME_T_DEFINED
98
+ #else
99
+ typedef __time64_t time_t;
100
+ #define _TIME_T_DEFINED
101
+ #endif
102
+
103
+ typedef unsigned long size_t;
104
+ #define _SIZE_T_DEFINED
105
+ typedef long ssize_t;
106
+ #define _SSIZE_T_DEFINED
107
+
108
+ typedef unsigned int wint_t;
109
+ typedef unsigned short wctype_t;
110
+ #define _WCTYPE_T_DEFINED
111
+ typedef unsigned short wchar_t;
112
+ #define _WCHAR_T_DEFINED
113
+
114
+ typedef int errno_t;
115
+ #define _ERRCODE_DEFINED
116
+
117
+ typedef struct threadlocaleinfostruct *pthreadlocinfo;
118
+ typedef struct threadmbcinfostruct *pthreadmbcinfo;
119
+ typedef struct localeinfo_struct _locale_tstruct,*_locale_t;
120
+
121
+ /* for winapi */
122
+ #define _ANONYMOUS_UNION
123
+ #define _ANONYMOUS_STRUCT
124
+ #define DECLSPEC_NORETURN
125
+ #define DECLARE_STDCALL_P(type) __stdcall type
126
+ #define NOSERVICE 1
127
+ #define NOMCX 1
128
+ #define NOIME 1
129
+ #ifndef WIN32_LEAN_AND_MEAN
130
+ # define WIN32_LEAN_AND_MEAN 1
131
+ #endif
132
+ #ifndef WINVER
133
+ # define WINVER 0x0502
134
+ #endif
135
+ #ifndef _WIN32_WINNT
136
+ # define _WIN32_WINNT 0x502
137
+ #endif
138
+
139
+ #endif /* __MINGW_H */
@@ -0,0 +1,54 @@
1
+ /**
2
+ * This file has no copyright assigned and is placed in the Public Domain.
3
+ * This file is part of the w64 mingw-runtime package.
4
+ * No warranty is given; refer to the file DISCLAIMER within this package.
5
+ */
6
+ #ifndef __ASSERT_H_
7
+ #define __ASSERT_H_
8
+
9
+ #include <_mingw.h>
10
+ #ifdef __cplusplus
11
+ #include <stdlib.h>
12
+ #endif
13
+
14
+ #ifdef NDEBUG
15
+ #ifndef assert
16
+ #define assert(_Expression) ((void)0)
17
+ #endif
18
+ #else
19
+
20
+ #ifndef _CRT_TERMINATE_DEFINED
21
+ #define _CRT_TERMINATE_DEFINED
22
+ void __cdecl __MINGW_NOTHROW exit(int _Code) __MINGW_ATTRIB_NORETURN;
23
+ _CRTIMP void __cdecl __MINGW_NOTHROW _exit(int _Code) __MINGW_ATTRIB_NORETURN;
24
+ #if !defined __NO_ISOCEXT /* extern stub in static libmingwex.a */
25
+ /* C99 function name */
26
+ void __cdecl _Exit(int) __MINGW_ATTRIB_NORETURN;
27
+ __CRT_INLINE __MINGW_ATTRIB_NORETURN void __cdecl _Exit(int status)
28
+ { _exit(status); }
29
+ #endif
30
+
31
+ #pragma push_macro("abort")
32
+ #undef abort
33
+ void __cdecl __declspec(noreturn) abort(void);
34
+ #pragma pop_macro("abort")
35
+
36
+ #endif
37
+
38
+ #ifdef __cplusplus
39
+ extern "C" {
40
+ #endif
41
+
42
+ extern void __cdecl _wassert(const wchar_t *_Message,const wchar_t *_File,unsigned _Line);
43
+
44
+ #ifdef __cplusplus
45
+ }
46
+ #endif
47
+
48
+ #ifndef assert
49
+ #define assert(_Expression) (void)((!!(_Expression)) || (_wassert(_CRT_WIDE(#_Expression),_CRT_WIDE(__FILE__),__LINE__),0))
50
+ #endif
51
+
52
+ #endif
53
+
54
+ #endif
@@ -0,0 +1,409 @@
1
+ /**
2
+ * This file has no copyright assigned and is placed in the Public Domain.
3
+ * This file is part of the w64 mingw-runtime package.
4
+ * No warranty is given; refer to the file DISCLAIMER within this package.
5
+ */
6
+ #ifndef _INC_CONIO
7
+ #define _INC_CONIO
8
+
9
+ #include <_mingw.h>
10
+
11
+ #ifdef __cplusplus
12
+ extern "C" {
13
+ #endif
14
+
15
+ _CRTIMP char *_cgets(char *_Buffer);
16
+ _CRTIMP int __cdecl _cprintf(const char *_Format,...);
17
+ _CRTIMP int __cdecl _cputs(const char *_Str);
18
+ _CRTIMP int __cdecl _cscanf(const char *_Format,...);
19
+ _CRTIMP int __cdecl _cscanf_l(const char *_Format,_locale_t _Locale,...);
20
+ _CRTIMP int __cdecl _getch(void);
21
+ _CRTIMP int __cdecl _getche(void);
22
+ _CRTIMP int __cdecl _vcprintf(const char *_Format,va_list _ArgList);
23
+ _CRTIMP int __cdecl _cprintf_p(const char *_Format,...);
24
+ _CRTIMP int __cdecl _vcprintf_p(const char *_Format,va_list _ArgList);
25
+ _CRTIMP int __cdecl _cprintf_l(const char *_Format,_locale_t _Locale,...);
26
+ _CRTIMP int __cdecl _vcprintf_l(const char *_Format,_locale_t _Locale,va_list _ArgList);
27
+ _CRTIMP int __cdecl _cprintf_p_l(const char *_Format,_locale_t _Locale,...);
28
+ _CRTIMP int __cdecl _vcprintf_p_l(const char *_Format,_locale_t _Locale,va_list _ArgList);
29
+ _CRTIMP int __cdecl _kbhit(void);
30
+
31
+ #if defined(_X86_) && !defined(__x86_64)
32
+ int __cdecl _inp(unsigned short);
33
+ unsigned short __cdecl _inpw(unsigned short);
34
+ unsigned long __cdecl _inpd(unsigned short);
35
+ int __cdecl _outp(unsigned short,int);
36
+ unsigned short __cdecl _outpw(unsigned short,unsigned short);
37
+ unsigned long __cdecl _outpd(unsigned short,unsigned long);
38
+ #endif
39
+
40
+ _CRTIMP int __cdecl _putch(int _Ch);
41
+ _CRTIMP int __cdecl _ungetch(int _Ch);
42
+ _CRTIMP int __cdecl _getch_nolock(void);
43
+ _CRTIMP int __cdecl _getche_nolock(void);
44
+ _CRTIMP int __cdecl _putch_nolock(int _Ch);
45
+ _CRTIMP int __cdecl _ungetch_nolock(int _Ch);
46
+
47
+ #ifndef _WCONIO_DEFINED
48
+ #define _WCONIO_DEFINED
49
+
50
+ #ifndef WEOF
51
+ #define WEOF (wint_t)(0xFFFF)
52
+ #endif
53
+
54
+ _CRTIMP wchar_t *_cgetws(wchar_t *_Buffer);
55
+ _CRTIMP wint_t __cdecl _getwch(void);
56
+ _CRTIMP wint_t __cdecl _getwche(void);
57
+ _CRTIMP wint_t __cdecl _putwch(wchar_t _WCh);
58
+ _CRTIMP wint_t __cdecl _ungetwch(wint_t _WCh);
59
+ _CRTIMP int __cdecl _cputws(const wchar_t *_String);
60
+ _CRTIMP int __cdecl _cwprintf(const wchar_t *_Format,...);
61
+ _CRTIMP int __cdecl _cwscanf(const wchar_t *_Format,...);
62
+ _CRTIMP int __cdecl _cwscanf_l(const wchar_t *_Format,_locale_t _Locale,...);
63
+ _CRTIMP int __cdecl _vcwprintf(const wchar_t *_Format,va_list _ArgList);
64
+ _CRTIMP int __cdecl _cwprintf_p(const wchar_t *_Format,...);
65
+ _CRTIMP int __cdecl _vcwprintf_p(const wchar_t *_Format,va_list _ArgList);
66
+ _CRTIMP int __cdecl _cwprintf_l(const wchar_t *_Format,_locale_t _Locale,...);
67
+ _CRTIMP int __cdecl _vcwprintf_l(const wchar_t *_Format,_locale_t _Locale,va_list _ArgList);
68
+ _CRTIMP int __cdecl _cwprintf_p_l(const wchar_t *_Format,_locale_t _Locale,...);
69
+ _CRTIMP int __cdecl _vcwprintf_p_l(const wchar_t *_Format,_locale_t _Locale,va_list _ArgList);
70
+ _CRTIMP wint_t __cdecl _putwch_nolock(wchar_t _WCh);
71
+ _CRTIMP wint_t __cdecl _getwch_nolock(void);
72
+ _CRTIMP wint_t __cdecl _getwche_nolock(void);
73
+ _CRTIMP wint_t __cdecl _ungetwch_nolock(wint_t _WCh);
74
+ #endif
75
+
76
+ #ifndef NO_OLDNAMES
77
+ char *__cdecl cgets(char *_Buffer);
78
+ int __cdecl cprintf(const char *_Format,...);
79
+ int __cdecl cputs(const char *_Str);
80
+ int __cdecl cscanf(const char *_Format,...);
81
+ int __cdecl getch(void);
82
+ int __cdecl getche(void);
83
+ int __cdecl kbhit(void);
84
+ int __cdecl putch(int _Ch);
85
+ int __cdecl ungetch(int _Ch);
86
+
87
+ #if (defined(_X86_) && !defined(__x86_64))
88
+ int __cdecl inp(unsigned short);
89
+ unsigned short __cdecl inpw(unsigned short);
90
+ int __cdecl outp(unsigned short,int);
91
+ unsigned short __cdecl outpw(unsigned short,unsigned short);
92
+ #endif
93
+
94
+ /* I/O intrin functions. */
95
+ __CRT_INLINE unsigned char __inbyte(unsigned short Port)
96
+ {
97
+ unsigned char value;
98
+ __asm__ __volatile__ ("inb %w1,%b0"
99
+ : "=a" (value)
100
+ : "Nd" (Port));
101
+ return value;
102
+ }
103
+ __CRT_INLINE unsigned short __inword(unsigned short Port)
104
+ {
105
+ unsigned short value;
106
+ __asm__ __volatile__ ("inw %w1,%w0"
107
+ : "=a" (value)
108
+ : "Nd" (Port));
109
+ return value;
110
+ }
111
+ __CRT_INLINE unsigned long __indword(unsigned short Port)
112
+ {
113
+ unsigned long value;
114
+ __asm__ __volatile__ ("inl %w1,%0"
115
+ : "=a" (value)
116
+ : "Nd" (Port));
117
+ return value;
118
+ }
119
+ __CRT_INLINE void __outbyte(unsigned short Port,unsigned char Data)
120
+ {
121
+ __asm__ __volatile__ ("outb %b0,%w1"
122
+ :
123
+ : "a" (Data), "Nd" (Port));
124
+ }
125
+ __CRT_INLINE void __outword(unsigned short Port,unsigned short Data)
126
+ {
127
+ __asm__ __volatile__ ("outw %w0,%w1"
128
+ :
129
+ : "a" (Data), "Nd" (Port));
130
+ }
131
+ __CRT_INLINE void __outdword(unsigned short Port,unsigned long Data)
132
+ {
133
+ __asm__ __volatile__ ("outl %0,%w1"
134
+ :
135
+ : "a" (Data), "Nd" (Port));
136
+ }
137
+ __CRT_INLINE void __inbytestring(unsigned short Port,unsigned char *Buffer,unsigned long Count)
138
+ {
139
+ __asm__ __volatile__ (
140
+ "cld ; rep ; insb "
141
+ : "=D" (Buffer), "=c" (Count)
142
+ : "d"(Port), "0"(Buffer), "1" (Count)
143
+ );
144
+ }
145
+ __CRT_INLINE void __inwordstring(unsigned short Port,unsigned short *Buffer,unsigned long Count)
146
+ {
147
+ __asm__ __volatile__ (
148
+ "cld ; rep ; insw "
149
+ : "=D" (Buffer), "=c" (Count)
150
+ : "d"(Port), "0"(Buffer), "1" (Count)
151
+ );
152
+ }
153
+ __CRT_INLINE void __indwordstring(unsigned short Port,unsigned long *Buffer,unsigned long Count)
154
+ {
155
+ __asm__ __volatile__ (
156
+ "cld ; rep ; insl "
157
+ : "=D" (Buffer), "=c" (Count)
158
+ : "d"(Port), "0"(Buffer), "1" (Count)
159
+ );
160
+ }
161
+
162
+ __CRT_INLINE void __outbytestring(unsigned short Port,unsigned char *Buffer,unsigned long Count)
163
+ {
164
+ __asm__ __volatile__ (
165
+ "cld ; rep ; outsb "
166
+ : "=S" (Buffer), "=c" (Count)
167
+ : "d"(Port), "0"(Buffer), "1" (Count)
168
+ );
169
+ }
170
+ __CRT_INLINE void __outwordstring(unsigned short Port,unsigned short *Buffer,unsigned long Count)
171
+ {
172
+ __asm__ __volatile__ (
173
+ "cld ; rep ; outsw "
174
+ : "=S" (Buffer), "=c" (Count)
175
+ : "d"(Port), "0"(Buffer), "1" (Count)
176
+ );
177
+ }
178
+ __CRT_INLINE void __outdwordstring(unsigned short Port,unsigned long *Buffer,unsigned long Count)
179
+ {
180
+ __asm__ __volatile__ (
181
+ "cld ; rep ; outsl "
182
+ : "=S" (Buffer), "=c" (Count)
183
+ : "d"(Port), "0"(Buffer), "1" (Count)
184
+ );
185
+ }
186
+
187
+ __CRT_INLINE unsigned __int64 __readcr0(void)
188
+ {
189
+ unsigned __int64 value;
190
+ __asm__ __volatile__ (
191
+ "mov %%cr0, %[value]"
192
+ : [value] "=q" (value));
193
+ return value;
194
+ }
195
+
196
+ /* Register sizes are different between 32/64 bit mode. So we have to do this for _WIN64 and _WIN32
197
+ seperatly. */
198
+
199
+ #ifdef _WIN64
200
+ __CRT_INLINE void __writecr0(unsigned __int64 Data)
201
+ {
202
+ __asm__ __volatile__ (
203
+ "mov %[Data], %%cr0"
204
+ :
205
+ : [Data] "q" (Data)
206
+ : "memory");
207
+ }
208
+
209
+ __CRT_INLINE unsigned __int64 __readcr2(void)
210
+ {
211
+ unsigned __int64 value;
212
+ __asm__ __volatile__ (
213
+ "mov %%cr2, %[value]"
214
+ : [value] "=q" (value));
215
+ return value;
216
+ }
217
+
218
+ __CRT_INLINE void __writecr2(unsigned __int64 Data)
219
+ {
220
+ __asm__ __volatile__ (
221
+ "mov %[Data], %%cr2"
222
+ :
223
+ : [Data] "q" (Data)
224
+ : "memory");
225
+ }
226
+
227
+ __CRT_INLINE unsigned __int64 __readcr3(void)
228
+ {
229
+ unsigned __int64 value;
230
+ __asm__ __volatile__ (
231
+ "mov %%cr3, %[value]"
232
+ : [value] "=q" (value));
233
+ return value;
234
+ }
235
+
236
+ __CRT_INLINE void __writecr3(unsigned __int64 Data)
237
+ {
238
+ __asm__ __volatile__ (
239
+ "mov %[Data], %%cr3"
240
+ :
241
+ : [Data] "q" (Data)
242
+ : "memory");
243
+ }
244
+
245
+ __CRT_INLINE unsigned __int64 __readcr4(void)
246
+ {
247
+ unsigned __int64 value;
248
+ __asm__ __volatile__ (
249
+ "mov %%cr4, %[value]"
250
+ : [value] "=q" (value));
251
+ return value;
252
+ }
253
+
254
+ __CRT_INLINE void __writecr4(unsigned __int64 Data)
255
+ {
256
+ __asm__ __volatile__ (
257
+ "mov %[Data], %%cr4"
258
+ :
259
+ : [Data] "q" (Data)
260
+ : "memory");
261
+ }
262
+
263
+ __CRT_INLINE unsigned __int64 __readcr8(void)
264
+ {
265
+ unsigned __int64 value;
266
+ __asm__ __volatile__ (
267
+ "mov %%cr8, %[value]"
268
+ : [value] "=q" (value));
269
+ return value;
270
+ }
271
+
272
+ __CRT_INLINE void __writecr8(unsigned __int64 Data)
273
+ {
274
+ __asm__ __volatile__ (
275
+ "mov %[Data], %%cr8"
276
+ :
277
+ : [Data] "q" (Data)
278
+ : "memory");
279
+ }
280
+
281
+ #elif defined(_WIN32)
282
+
283
+ __CRT_INLINE void __writecr0(unsigned Data)
284
+ {
285
+ __asm__ __volatile__ (
286
+ "mov %[Data], %%cr0"
287
+ :
288
+ : [Data] "q" (Data)
289
+ : "memory");
290
+ }
291
+
292
+ __CRT_INLINE unsigned long __readcr2(void)
293
+ {
294
+ unsigned long value;
295
+ __asm__ __volatile__ (
296
+ "mov %%cr2, %[value]"
297
+ : [value] "=q" (value));
298
+ return value;
299
+ }
300
+
301
+ __CRT_INLINE void __writecr2(unsigned Data)
302
+ {
303
+ __asm__ __volatile__ (
304
+ "mov %[Data], %%cr2"
305
+ :
306
+ : [Data] "q" (Data)
307
+ : "memory");
308
+ }
309
+
310
+ __CRT_INLINE unsigned long __readcr3(void)
311
+ {
312
+ unsigned long value;
313
+ __asm__ __volatile__ (
314
+ "mov %%cr3, %[value]"
315
+ : [value] "=q" (value));
316
+ return value;
317
+ }
318
+
319
+ __CRT_INLINE void __writecr3(unsigned Data)
320
+ {
321
+ __asm__ __volatile__ (
322
+ "mov %[Data], %%cr3"
323
+ :
324
+ : [Data] "q" (Data)
325
+ : "memory");
326
+ }
327
+
328
+ __CRT_INLINE unsigned long __readcr4(void)
329
+ {
330
+ unsigned long value;
331
+ __asm__ __volatile__ (
332
+ "mov %%cr4, %[value]"
333
+ : [value] "=q" (value));
334
+ return value;
335
+ }
336
+
337
+ __CRT_INLINE void __writecr4(unsigned Data)
338
+ {
339
+ __asm__ __volatile__ (
340
+ "mov %[Data], %%cr4"
341
+ :
342
+ : [Data] "q" (Data)
343
+ : "memory");
344
+ }
345
+
346
+ __CRT_INLINE unsigned long __readcr8(void)
347
+ {
348
+ unsigned long value; __asm__ __volatile__ (
349
+ "mov %%cr8, %[value]"
350
+ : [value] "=q" (value));
351
+ return value;
352
+ }
353
+
354
+ __CRT_INLINE void __writecr8(unsigned Data)
355
+ {
356
+ __asm__ __volatile__ (
357
+ "mov %[Data], %%cr8"
358
+ :
359
+ : [Data] "q" (Data)
360
+ : "memory");
361
+ }
362
+
363
+ #endif
364
+
365
+ __CRT_INLINE unsigned __int64 __readmsr(unsigned long msr)
366
+ {
367
+ unsigned __int64 val1, val2;
368
+ __asm__ __volatile__(
369
+ "rdmsr"
370
+ : "=a" (val1), "=d" (val2)
371
+ : "c" (msr));
372
+ return val1 | (val2 << 32);
373
+ }
374
+
375
+ __CRT_INLINE void __writemsr (unsigned long msr, unsigned __int64 Value)
376
+ {
377
+ unsigned long val1 = Value, val2 = Value >> 32;
378
+ __asm__ __volatile__ (
379
+ "wrmsr"
380
+ :
381
+ : "c" (msr), "a" (val1), "d" (val2));
382
+ }
383
+
384
+ __CRT_INLINE unsigned __int64 __rdtsc(void)
385
+ {
386
+ unsigned __int64 val1, val2;
387
+ __asm__ __volatile__ (
388
+ "rdtsc"
389
+ : "=a" (val1), "=d" (val2));
390
+ return val1 | (val2 << 32);
391
+ }
392
+
393
+ __CRT_INLINE void __cpuid(int CPUInfo[4], int InfoType)
394
+ {
395
+ __asm__ __volatile__ (
396
+ "cpuid"
397
+ : "=a" (CPUInfo [0]), "=b" (CPUInfo [1]), "=c" (CPUInfo [2]), "=d" (CPUInfo [3])
398
+ : "a" (InfoType));
399
+ }
400
+
401
+ #endif
402
+
403
+ #ifdef __cplusplus
404
+ }
405
+ #endif
406
+
407
+ #include <sec_api/conio_s.h>
408
+
409
+ #endif