rbdc 0.8.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (266) hide show
  1. data/bindings/ruby/rbdc/extconf.rb +57 -0
  2. data/bindings/ruby/rbdc/rbdc.c +304 -0
  3. data/dyncall/AUTHORS +4 -0
  4. data/dyncall/BUGS +3 -0
  5. data/dyncall/CMakeLists.txt +79 -0
  6. data/dyncall/ChangeLog +165 -0
  7. data/dyncall/LICENSE +15 -0
  8. data/dyncall/Makefile.M +15 -0
  9. data/dyncall/Makefile.embedded +71 -0
  10. data/dyncall/Makefile.generic +36 -0
  11. data/dyncall/Nmakefile +45 -0
  12. data/dyncall/README +92 -0
  13. data/dyncall/ToDo +114 -0
  14. data/dyncall/autovar/LICENSE.txt +15 -0
  15. data/dyncall/autovar/README.txt +69 -0
  16. data/dyncall/autovar/autovar_ABI.h +44 -0
  17. data/dyncall/autovar/autovar_ARCH.h +56 -0
  18. data/dyncall/autovar/autovar_CC.h +46 -0
  19. data/dyncall/autovar/autovar_OS.h +78 -0
  20. data/dyncall/autovar/autovar_OSFAMILY.h +39 -0
  21. data/dyncall/buildsys/cmake/Modules/FindDynCall.cmake +43 -0
  22. data/dyncall/buildsys/cmake/Modules/FindDynCallback.cmake +43 -0
  23. data/dyncall/buildsys/cmake/Modules/FindDynLoad.cmake +45 -0
  24. data/dyncall/buildsys/cmake/Modules/UseLATEX.cmake +811 -0
  25. data/dyncall/buildsys/dynmake/Makefile.base.M +82 -0
  26. data/dyncall/buildsys/dynmake/dynmake.bat +2 -0
  27. data/dyncall/buildsys/dynmake/dynmake.sh +4 -0
  28. data/dyncall/buildsys/lua/Makefile +10 -0
  29. data/dyncall/buildsys/lua/README.txt +4 -0
  30. data/dyncall/buildsys/lua/bootstrap.sh +34 -0
  31. data/dyncall/buildsys/lua/cleanup.sh +6 -0
  32. data/dyncall/buildsys/lua/mkfile +34 -0
  33. data/dyncall/buildsys/lua/setenv.sh +4 -0
  34. data/dyncall/buildsys/mk/app.mk +30 -0
  35. data/dyncall/buildsys/mk/dirs.mk +27 -0
  36. data/dyncall/buildsys/mk/epilog.mk +30 -0
  37. data/dyncall/buildsys/mk/lib.mk +23 -0
  38. data/dyncall/buildsys/mk/pcc.mk +60 -0
  39. data/dyncall/buildsys/mk/prolog.mk +35 -0
  40. data/dyncall/buildsys/nmake/common.nmake +61 -0
  41. data/dyncall/buildsys/nmake/epilog.nmake +28 -0
  42. data/dyncall/buildsys/nmake/prolog.nmake +76 -0
  43. data/dyncall/buildsys/nmake/tool_gcc.nmake +82 -0
  44. data/dyncall/buildsys/nmake/tool_msvc.nmake +67 -0
  45. data/dyncall/buildsys/scripts/batch-build-linux.sh +11 -0
  46. data/dyncall/buildsys/scripts/batch-build-minix.sh +11 -0
  47. data/dyncall/buildsys/scripts/batch-build-psp.sh +11 -0
  48. data/dyncall/buildsys/scripts/conf-nds.bat +41 -0
  49. data/dyncall/buildsys/scripts/setenv-cross-ios.sh +8 -0
  50. data/dyncall/buildsys/scripts/setenv-sdk-ios.sh +22 -0
  51. data/dyncall/buildsys/vs2005/dyncall/dyncall.vcproj +245 -0
  52. data/dyncall/buildsys/vs2005/test_plain/test_plain.vcproj +202 -0
  53. data/dyncall/buildsys/vs2005/vs2005.sln +29 -0
  54. data/dyncall/configure +152 -0
  55. data/dyncall/configure.bat +157 -0
  56. data/dyncall/configure.rc +234 -0
  57. data/dyncall/dynMakefile +4 -0
  58. data/dyncall/dyncall/CMakeLists.txt +53 -0
  59. data/dyncall/dyncall/DynCallConfig.cmake +3 -0
  60. data/dyncall/dyncall/Makefile.M +10 -0
  61. data/dyncall/dyncall/Makefile.embedded +20 -0
  62. data/dyncall/dyncall/Makefile.generic +16 -0
  63. data/dyncall/dyncall/Nmakefile +62 -0
  64. data/dyncall/dyncall/README-Developer.txt +45 -0
  65. data/dyncall/dyncall/README.txt +65 -0
  66. data/dyncall/dyncall/TODO +9 -0
  67. data/dyncall/dyncall/dynMakefile +4 -0
  68. data/dyncall/dyncall/dyncall.3 +189 -0
  69. data/dyncall/dyncall/dyncall.h +135 -0
  70. data/dyncall/dyncall/dyncall_alloc.h +40 -0
  71. data/dyncall/dyncall/dyncall_api.c +167 -0
  72. data/dyncall/dyncall/dyncall_call.S +72 -0
  73. data/dyncall/dyncall/dyncall_call_arm32_arm.S +80 -0
  74. data/dyncall/dyncall/dyncall_call_arm32_arm.h +61 -0
  75. data/dyncall/dyncall/dyncall_call_arm32_arm_armhf.S +96 -0
  76. data/dyncall/dyncall/dyncall_call_arm32_arm_armhf.h +44 -0
  77. data/dyncall/dyncall/dyncall_call_arm32_thumb.h +65 -0
  78. data/dyncall/dyncall/dyncall_call_arm32_thumb_apple.s +80 -0
  79. data/dyncall/dyncall/dyncall_call_arm32_thumb_armhf.S +121 -0
  80. data/dyncall/dyncall/dyncall_call_arm32_thumb_gas.s +101 -0
  81. data/dyncall/dyncall/dyncall_call_mips.h +50 -0
  82. data/dyncall/dyncall/dyncall_call_mips_eabi.h +61 -0
  83. data/dyncall/dyncall/dyncall_call_mips_eabi_gas.s +115 -0
  84. data/dyncall/dyncall/dyncall_call_mips_gas.S +36 -0
  85. data/dyncall/dyncall/dyncall_call_mips_n32.h +67 -0
  86. data/dyncall/dyncall/dyncall_call_mips_n32_gas.s +192 -0
  87. data/dyncall/dyncall/dyncall_call_mips_n64.h +67 -0
  88. data/dyncall/dyncall/dyncall_call_mips_n64_gas.s +192 -0
  89. data/dyncall/dyncall/dyncall_call_mips_o32.h +70 -0
  90. data/dyncall/dyncall/dyncall_call_mips_o32_gas.s +109 -0
  91. data/dyncall/dyncall/dyncall_call_ppc32.S +266 -0
  92. data/dyncall/dyncall/dyncall_call_ppc32.h +62 -0
  93. data/dyncall/dyncall/dyncall_call_sparc.S +192 -0
  94. data/dyncall/dyncall/dyncall_call_sparc.h +42 -0
  95. data/dyncall/dyncall/dyncall_call_sparc64.S +361 -0
  96. data/dyncall/dyncall/dyncall_call_sparc64.h +42 -0
  97. data/dyncall/dyncall/dyncall_call_sparc_v9.S +220 -0
  98. data/dyncall/dyncall/dyncall_call_sparc_v9.h +42 -0
  99. data/dyncall/dyncall/dyncall_call_x64-att.S +146 -0
  100. data/dyncall/dyncall/dyncall_call_x64.S +149 -0
  101. data/dyncall/dyncall/dyncall_call_x64.h +63 -0
  102. data/dyncall/dyncall/dyncall_call_x64_generic_masm.asm +70 -0
  103. data/dyncall/dyncall/dyncall_call_x86.S +238 -0
  104. data/dyncall/dyncall/dyncall_call_x86.h +70 -0
  105. data/dyncall/dyncall/dyncall_call_x86_8a.s +127 -0
  106. data/dyncall/dyncall/dyncall_call_x86_generic_masm.asm +136 -0
  107. data/dyncall/dyncall/dyncall_call_x86_nasm.asm +234 -0
  108. data/dyncall/dyncall/dyncall_callf.c +112 -0
  109. data/dyncall/dyncall/dyncall_callf.h +52 -0
  110. data/dyncall/dyncall/dyncall_callvm.c +68 -0
  111. data/dyncall/dyncall/dyncall_callvm.h +88 -0
  112. data/dyncall/dyncall/dyncall_callvm_arm32_arm.c +250 -0
  113. data/dyncall/dyncall/dyncall_callvm_arm32_arm.h +59 -0
  114. data/dyncall/dyncall/dyncall_callvm_arm32_arm_armhf.c +204 -0
  115. data/dyncall/dyncall/dyncall_callvm_arm32_arm_armhf.h +63 -0
  116. data/dyncall/dyncall/dyncall_callvm_arm32_thumb.c +271 -0
  117. data/dyncall/dyncall/dyncall_callvm_arm32_thumb.h +59 -0
  118. data/dyncall/dyncall/dyncall_callvm_base.c +33 -0
  119. data/dyncall/dyncall/dyncall_callvm_mips.c +40 -0
  120. data/dyncall/dyncall/dyncall_callvm_mips.h +37 -0
  121. data/dyncall/dyncall/dyncall_callvm_mips_eabi.c +181 -0
  122. data/dyncall/dyncall/dyncall_callvm_mips_eabi.h +61 -0
  123. data/dyncall/dyncall/dyncall_callvm_mips_n32.c +268 -0
  124. data/dyncall/dyncall/dyncall_callvm_mips_n64.c +268 -0
  125. data/dyncall/dyncall/dyncall_callvm_mips_n64.h +53 -0
  126. data/dyncall/dyncall/dyncall_callvm_mips_o32.c +235 -0
  127. data/dyncall/dyncall/dyncall_callvm_mips_o32.h +45 -0
  128. data/dyncall/dyncall/dyncall_callvm_ppc32.c +372 -0
  129. data/dyncall/dyncall/dyncall_callvm_ppc32.h +61 -0
  130. data/dyncall/dyncall/dyncall_callvm_sparc.c +155 -0
  131. data/dyncall/dyncall/dyncall_callvm_sparc.h +44 -0
  132. data/dyncall/dyncall/dyncall_callvm_sparc64.c +239 -0
  133. data/dyncall/dyncall/dyncall_callvm_sparc64.h +47 -0
  134. data/dyncall/dyncall/dyncall_callvm_sparc_v9.c +182 -0
  135. data/dyncall/dyncall/dyncall_callvm_sparc_v9.h +45 -0
  136. data/dyncall/dyncall/dyncall_callvm_x64.c +228 -0
  137. data/dyncall/dyncall/dyncall_callvm_x64.h +111 -0
  138. data/dyncall/dyncall/dyncall_callvm_x86.c +667 -0
  139. data/dyncall/dyncall/dyncall_callvm_x86.h +75 -0
  140. data/dyncall/dyncall/dyncall_config.h +46 -0
  141. data/dyncall/dyncall/dyncall_macros.h +248 -0
  142. data/dyncall/dyncall/dyncall_signature.h +71 -0
  143. data/dyncall/dyncall/dyncall_struct.c +255 -0
  144. data/dyncall/dyncall/dyncall_struct.h +69 -0
  145. data/dyncall/dyncall/dyncall_types.h +74 -0
  146. data/dyncall/dyncall/dyncall_utils.h +38 -0
  147. data/dyncall/dyncall/dyncall_value.h +73 -0
  148. data/dyncall/dyncall/dyncall_vector.c +52 -0
  149. data/dyncall/dyncall/dyncall_vector.h +56 -0
  150. data/dyncall/dyncall/gen-masm.sh +7 -0
  151. data/dyncall/dyncall/mkfile +29 -0
  152. data/dyncall/dyncallback/CMakeLists.txt +55 -0
  153. data/dyncall/dyncallback/DynCallbackConfig.cmake +2 -0
  154. data/dyncall/dyncallback/Makefile.M +10 -0
  155. data/dyncall/dyncallback/Makefile.embedded +15 -0
  156. data/dyncall/dyncallback/Makefile.generic +20 -0
  157. data/dyncall/dyncallback/Nmakefile +71 -0
  158. data/dyncall/dyncallback/README.txt +9 -0
  159. data/dyncall/dyncallback/TODO +4 -0
  160. data/dyncall/dyncallback/dynMakefile +4 -0
  161. data/dyncall/dyncallback/dyncall_alloc_wx.c +35 -0
  162. data/dyncall/dyncallback/dyncall_alloc_wx.h +46 -0
  163. data/dyncall/dyncallback/dyncall_alloc_wx_malloc.c +40 -0
  164. data/dyncall/dyncallback/dyncall_alloc_wx_mmap.c +42 -0
  165. data/dyncall/dyncallback/dyncall_alloc_wx_win32.c +42 -0
  166. data/dyncall/dyncallback/dyncall_args.c +45 -0
  167. data/dyncall/dyncallback/dyncall_args.h +65 -0
  168. data/dyncall/dyncallback/dyncall_args_arm32_arm.c +112 -0
  169. data/dyncall/dyncallback/dyncall_args_arm32_arm.h +40 -0
  170. data/dyncall/dyncallback/dyncall_args_arm32_thumb.c +29 -0
  171. data/dyncall/dyncallback/dyncall_args_arm32_thumb.h +32 -0
  172. data/dyncall/dyncallback/dyncall_args_mips.c +81 -0
  173. data/dyncall/dyncallback/dyncall_args_mips.h +41 -0
  174. data/dyncall/dyncallback/dyncall_args_ppc32.c +88 -0
  175. data/dyncall/dyncallback/dyncall_args_ppc32.h +41 -0
  176. data/dyncall/dyncallback/dyncall_args_sparc32.c +41 -0
  177. data/dyncall/dyncallback/dyncall_args_sparc32.h +37 -0
  178. data/dyncall/dyncallback/dyncall_args_sparc64.c +41 -0
  179. data/dyncall/dyncallback/dyncall_args_sparc64.h +37 -0
  180. data/dyncall/dyncallback/dyncall_args_x64.c +73 -0
  181. data/dyncall/dyncallback/dyncall_args_x64.h +44 -0
  182. data/dyncall/dyncallback/dyncall_args_x86.c +121 -0
  183. data/dyncall/dyncallback/dyncall_args_x86.h +58 -0
  184. data/dyncall/dyncallback/dyncall_callback.c +45 -0
  185. data/dyncall/dyncallback/dyncall_callback.h +51 -0
  186. data/dyncall/dyncallback/dyncall_callback_arch.S +71 -0
  187. data/dyncall/dyncallback/dyncall_callback_arm32_arm.c +63 -0
  188. data/dyncall/dyncallback/dyncall_callback_arm32_arm.h +45 -0
  189. data/dyncall/dyncallback/dyncall_callback_arm32_arm_apple.s +73 -0
  190. data/dyncall/dyncallback/dyncall_callback_arm32_arm_gas.s +73 -0
  191. data/dyncall/dyncallback/dyncall_callback_arm32_thumb.c +29 -0
  192. data/dyncall/dyncallback/dyncall_callback_arm32_thumb.h +33 -0
  193. data/dyncall/dyncallback/dyncall_callback_arm32_thumb_apple.s +32 -0
  194. data/dyncall/dyncallback/dyncall_callback_arm32_thumb_gas.s +32 -0
  195. data/dyncall/dyncallback/dyncall_callback_mips.c +61 -0
  196. data/dyncall/dyncallback/dyncall_callback_mips.h +42 -0
  197. data/dyncall/dyncallback/dyncall_callback_ppc32.S +33 -0
  198. data/dyncall/dyncallback/dyncall_callback_ppc32.c +60 -0
  199. data/dyncall/dyncallback/dyncall_callback_ppc32.h +43 -0
  200. data/dyncall/dyncallback/dyncall_callback_ppc32_apple.s +180 -0
  201. data/dyncall/dyncallback/dyncall_callback_sparc32.c +57 -0
  202. data/dyncall/dyncallback/dyncall_callback_sparc32.h +43 -0
  203. data/dyncall/dyncallback/dyncall_callback_sparc32.s +30 -0
  204. data/dyncall/dyncallback/dyncall_callback_sparc64.c +57 -0
  205. data/dyncall/dyncallback/dyncall_callback_sparc64.s +30 -0
  206. data/dyncall/dyncallback/dyncall_callback_x64.S +187 -0
  207. data/dyncall/dyncallback/dyncall_callback_x64.c +69 -0
  208. data/dyncall/dyncallback/dyncall_callback_x64.h +44 -0
  209. data/dyncall/dyncallback/dyncall_callback_x64_apple.s +122 -0
  210. data/dyncall/dyncallback/dyncall_callback_x64_gas.s +119 -0
  211. data/dyncall/dyncallback/dyncall_callback_x64_gas_w64.s +102 -0
  212. data/dyncall/dyncallback/dyncall_callback_x64_masm.asm +89 -0
  213. data/dyncall/dyncallback/dyncall_callback_x86.S +115 -0
  214. data/dyncall/dyncallback/dyncall_callback_x86.c +281 -0
  215. data/dyncall/dyncallback/dyncall_callback_x86.h +49 -0
  216. data/dyncall/dyncallback/dyncall_callback_x86_8a.s +100 -0
  217. data/dyncall/dyncallback/dyncall_callback_x86_masm.asm +74 -0
  218. data/dyncall/dyncallback/dyncall_thunk.c +47 -0
  219. data/dyncall/dyncallback/dyncall_thunk.h +84 -0
  220. data/dyncall/dyncallback/dyncall_thunk_arm32_arm.c +45 -0
  221. data/dyncall/dyncallback/dyncall_thunk_arm32_arm.h +40 -0
  222. data/dyncall/dyncallback/dyncall_thunk_arm32_thumb.c +29 -0
  223. data/dyncall/dyncallback/dyncall_thunk_arm32_thumb.h +35 -0
  224. data/dyncall/dyncallback/dyncall_thunk_mips.c +52 -0
  225. data/dyncall/dyncallback/dyncall_thunk_mips.h +37 -0
  226. data/dyncall/dyncallback/dyncall_thunk_ppc32.c +51 -0
  227. data/dyncall/dyncallback/dyncall_thunk_ppc32.h +40 -0
  228. data/dyncall/dyncallback/dyncall_thunk_sparc32.c +32 -0
  229. data/dyncall/dyncallback/dyncall_thunk_sparc32.h +36 -0
  230. data/dyncall/dyncallback/dyncall_thunk_sparc64.c +32 -0
  231. data/dyncall/dyncallback/dyncall_thunk_sparc64.h +36 -0
  232. data/dyncall/dyncallback/dyncall_thunk_x64.c +48 -0
  233. data/dyncall/dyncallback/dyncall_thunk_x64.h +39 -0
  234. data/dyncall/dyncallback/dyncall_thunk_x86.c +44 -0
  235. data/dyncall/dyncallback/dyncall_thunk_x86.h +39 -0
  236. data/dyncall/dyncallback/dyncallback.3 +134 -0
  237. data/dyncall/dyncallback/gen-masm.sh +8 -0
  238. data/dyncall/dyncallback/mkfile +29 -0
  239. data/dyncall/dynload/CMakeLists.txt +25 -0
  240. data/dyncall/dynload/DynLoadConfig.cmake +3 -0
  241. data/dyncall/dynload/Makefile.M +10 -0
  242. data/dyncall/dynload/Makefile.embedded +22 -0
  243. data/dyncall/dynload/Makefile.generic +18 -0
  244. data/dyncall/dynload/Nmakefile +57 -0
  245. data/dyncall/dynload/README.txt +113 -0
  246. data/dyncall/dynload/TODO +20 -0
  247. data/dyncall/dynload/dynMakefile +4 -0
  248. data/dyncall/dynload/dynload.3 +64 -0
  249. data/dyncall/dynload/dynload.c +38 -0
  250. data/dyncall/dynload/dynload.h +65 -0
  251. data/dyncall/dynload/dynload_alloc.h +40 -0
  252. data/dyncall/dynload/dynload_darwin.c +89 -0
  253. data/dyncall/dynload/dynload_syms.c +38 -0
  254. data/dyncall/dynload/dynload_syms_elf.c +214 -0
  255. data/dyncall/dynload/dynload_syms_mach-o.c +167 -0
  256. data/dyncall/dynload/dynload_syms_pe.c +109 -0
  257. data/dyncall/dynload/dynload_unix.c +57 -0
  258. data/dyncall/dynload/dynload_windows.c +59 -0
  259. data/dyncall/mkfile +36 -0
  260. data/dyncall/portasm/README.txt +42 -0
  261. data/dyncall/portasm/gen-masm.sh +3 -0
  262. data/dyncall/portasm/portasm-arm.S +36 -0
  263. data/dyncall/portasm/portasm-ppc.S +98 -0
  264. data/dyncall/portasm/portasm-x64-att.S +155 -0
  265. data/dyncall/portasm/portasm-x86.S +127 -0
  266. metadata +311 -0
@@ -0,0 +1,65 @@
1
+ Library Design
2
+
3
+ Overview:
4
+ 1. Call Kernel
5
+ 2. Utilities (memory and static sized vectors)
6
+ 3. Call State Machine
7
+ 4. Application Programming Interface
8
+ 5. extension: high-level formatted C API (ellipsis style)
9
+
10
+
11
+ 1. Call Kernel
12
+
13
+ Assembly Implementation:
14
+
15
+ gcc front-end: dyncall_call.S
16
+ uses the C preprocessor
17
+ will include the apropriate assembly source
18
+
19
+ architecture/tool specific sources:
20
+ dyncall_call_<ARCH>_<ASMTOOL>.[s|asm]
21
+
22
+
23
+ 2. Utilities (memory and static sized vectors)
24
+
25
+ 2.1 Memory Management
26
+
27
+ C Interface: dyncall_alloc.h
28
+
29
+
30
+ 2.2 Static-sized Vector
31
+
32
+ C Interface: dyncall_vector.h
33
+
34
+ C Implementation: dyncall_vector.c
35
+
36
+
37
+ 3. Call State Machine
38
+
39
+ C Implementation:
40
+ Top-level: dynall_callvm.c
41
+ Sub-levels:
42
+ dyncall_callvm_<ARCH>.c
43
+
44
+
45
+ 4. Application Programming Interface
46
+
47
+ C Header:
48
+ Top-level: dyncall.h
49
+ Sub-level headers:
50
+ dyncall_macros.h
51
+ dyncall_config.h
52
+ dyncall_types.h
53
+ C Implementation: dyncall_api.c
54
+
55
+
56
+ 5. Extension: High-level C API (ellipsis style)
57
+
58
+ C Header:
59
+ Top-level: dyncall_callf.h
60
+ Sub-level headers:
61
+ dyncall_value.h
62
+ dyncall_signature.h
63
+ C Implementation: dyncall_callf.c
64
+
65
+
@@ -0,0 +1,9 @@
1
+ - implement structure passing for all calling conventinos and platforms
2
+ - make sure that struct support for ellipsis calls are not forgotten (copy everything by value)
3
+
4
+ - merge arm32_thumb_{gas/apple} and include thumb support for portasm
5
+ - check dyncall_call_x64_traditional_cpp.S / try-sync with win64 masm
6
+ - remove dyncall_call_x86_apple.s
7
+ - x64 port cleanup: all x64 calling conventions on all platforms
8
+ - remove dyncall_call_x86_masm.asm dyncall_call_x64_masm.asm
9
+ - x64 verification: return values are passed via RAX and RDX, and XMM0 and XMM1.
@@ -0,0 +1,4 @@
1
+ all: ./../buildsys/dynmake/dynmake.bat
2
+ $(?:/=\\) all $(MAKE) && exit || sh $(?:bat=sh) all $(MAKE)
3
+ clean: ./../buildsys/dynmake/dynmake.bat
4
+ $(?:/=\\) clean $(MAKE) && exit || sh $(?:bat=sh) clean $(MAKE)
@@ -0,0 +1,189 @@
1
+ .\" Copyright (c) 2007-2013 Daniel Adler <dadler AT uni-goettingen DOT de>,
2
+ .\" Tassilo Philipp <tphilipp AT potion-studios DOT com>
3
+ .\"
4
+ .\" Permission to use, copy, modify, and distribute this software for any
5
+ .\" purpose with or without fee is hereby granted, provided that the above
6
+ .\" copyright notice and this permission notice appear in all copies.
7
+ .\"
8
+ .\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
9
+ .\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
10
+ .\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
11
+ .\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
12
+ .\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
13
+ .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
14
+ .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
15
+ .\"
16
+ .Dd $Mdocdate$
17
+ .Dt dyncall 3
18
+ .Os
19
+
20
+ .Sh NAME
21
+ .Nm dyncall
22
+ .Nd encapsulation of architecture-, OS- and compiler-specific function call
23
+ semantics
24
+ .Sh SYNOPSIS
25
+ .In dyncall.h
26
+ .Ft DCCallVM *
27
+ .Fn dcNewCallVM "DCsize size"
28
+ .Ft void
29
+ .Fn dcFree "DCCallVM * vm"
30
+ .Ft void
31
+ .Fn dcMode "DCCallVM * vm" "DCint mode"
32
+ .Ft void
33
+ .Fn dcReset "DCCallVM * vm"
34
+ .Ft void
35
+ .Fn dcArgBool "DCCallVM * vm" "DCbool arg"
36
+ .Ft void
37
+ .Fn dcArgChar "DCCallVM * vm" "DCchar arg"
38
+ .Ft void
39
+ .Fn dcArgShort "DCCallVM * vm" "DCshort arg"
40
+ .Ft void
41
+ .Fn dcArgInt "DCCallVM * vm" "DCint arg"
42
+ .Ft void
43
+ .Fn dcArgLong "DCCallVM * vm" "DClong arg"
44
+ .Ft void
45
+ .Fn dcArgLongLong "DCCallVM * vm" "DClonglong arg"
46
+ .Ft void
47
+ .Fn dcArgFloat "DCCallVM * vm" "DCfloat arg"
48
+ .Ft void
49
+ .Fn dcArgDouble "DCCallVM * vm" "DCdouble arg"
50
+ .Ft void
51
+ .Fn dcArgPointer "DCCallVM * vm" "DCpointer arg"
52
+ .Ft DCvoid
53
+ .Fn dcCallVoid "DCCallVM * vm" "DCpointer funcptr"
54
+ .Ft DCbool
55
+ .Fn dcCallBool "DCCallVM * vm" "DCpointer funcptr"
56
+ .Ft DCchar
57
+ .Fn dcCallChar "DCCallVM * vm" "DCpointer funcptr"
58
+ .Ft DCshort
59
+ .Fn dcCallShort "DCCallVM * vm" "DCpointer funcptr"
60
+ .Ft DCint
61
+ .Fn dcCallInt "DCCallVM * vm" "DCpointer funcptr"
62
+ .Ft DClong
63
+ .Fn dcCallLong "DCCallVM * vm" "DCpointer funcptr"
64
+ .Ft DClonglong
65
+ .Fn dcCallLongLong "DCCallVM * vm" "DCpointer funcptr"
66
+ .Ft DCfloat
67
+ .Fn dcCallFloat "DCCallVM * vm" "DCpointer funcptr"
68
+ .Ft DCdouble
69
+ .Fn dcCallDouble "DCCallVM * vm" "DCpointer funcptr"
70
+ .Ft DCpointer
71
+ .Fn dcCallPointer "DCCallVM * vm" "DCpointer funcptr"
72
+ .Ft void
73
+ .Fn dcCallF "DCCallVM * vm" "DCValue * result" "DCpointer funcptr" "const DCsigchar * signature" "..."
74
+ .Ft void
75
+ .Fn dcVCallF "DCCallVM * vm" "DCValue * result" "DCpointer funcptr" "const DCsigchar * signature" "va_list args"
76
+ .Sh DESCRIPTION
77
+ The
78
+ .Nm
79
+ library encapsulates architecture-, OS- and compiler-specific function call
80
+ semantics in a virtual "bind argument parameters from left to right and then
81
+ call" interface allowing programmers to call C functions in a completely
82
+ dynamic manner.
83
+ .Pp
84
+ In other words, instead of calling a function directly, the
85
+ .Nm
86
+ library provides a mechanism to push the function parameters manually and to
87
+ issue the call afterwards.
88
+ .Pp
89
+ Since the idea behind this concept is similar to call dispatching mechanisms
90
+ of virtual machines, the object that can be dynamically loaded with arguments,
91
+ and then used to actually invoke the call, is called CallVM. It is possible to
92
+ change the calling convention used by the CallVM at run-time. Due to the fact
93
+ that nearly every platform comes with one or more distinct calling conventions, the
94
+ .Nm
95
+ library project intends to be a portable and open-source approach to the variety of
96
+ compiler-specific binary interfaces, platform specific subtleties, and so on...
97
+ .Pp
98
+ .Fn dcNewCallVM
99
+ creates a new CallVM object, where
100
+ .Ar size
101
+ specifies the max size of the internal stack that will be allocated and used to
102
+ bind the arguments to. Use
103
+ .Fn dcFree
104
+ to destroy the CallVM object.
105
+ .Pp
106
+ .Fn dcMode
107
+ sets the calling convention to use. See dyncall.h for a list of
108
+ available modes. Note that some mode/platform combinations don't make any
109
+ sense (e.g. using a PowerPC calling convention on a MIPS platform) and are
110
+ silently ignored.
111
+ .Pp
112
+ .Fn dcReset
113
+ resets the internal stack of arguments and prepares it for the selected mode.
114
+ This function should be called after setting the call mode (using dcMode), but
115
+ prior to binding arguments to the CallVM. Use it also when reusing a CallVM, as
116
+ arguments don't get flushed automatically after a function call invocation.
117
+ .Pp
118
+ .Fn dcArgBool ,
119
+ .Fn dcArgChar ,
120
+ .Fn dcArgShort ,
121
+ .Fn dcArgInt ,
122
+ .Fn dcArgLong ,
123
+ .Fn dcArgLongLong ,
124
+ .Fn dcArgFloat ,
125
+ .Fn dcArgDouble
126
+ and
127
+ .Fn dcArgPointer
128
+ are used to bind arguments of the named types to the CallVM object. Arguments should
129
+ be bound in
130
+ .Em "left to right"
131
+ order regarding the C function prototype.
132
+ .Pp
133
+ .Fn dcCallVoid ,
134
+ .Fn dcCallBool ,
135
+ .Fn dcCallChar ,
136
+ .Fn dcCallShort ,
137
+ .Fn dcCallInt ,
138
+ .Fn dcCallLong ,
139
+ .Fn dcCallLongLong ,
140
+ .Fn dcCallFloat ,
141
+ .Fn dcCallDouble
142
+ and
143
+ .Fn dcCallPointer
144
+ call the function with the bound arguments and returning the named type, where
145
+ .Ar funcptr
146
+ is a pointer to the function to call. After the invocation of the function
147
+ call, the argument values are still bound to the CallVM and a second call
148
+ using the same arguments can be issued. Call
149
+ .Fn reset
150
+ to clear the internal argument stack.
151
+ .Pp
152
+ .Fn dcCallF
153
+ and
154
+ .Fn dcVCallF
155
+ can be used to issue a printf-style function call, using a signature
156
+ string encoding the argument types and return type. The return value will be
157
+ stored in
158
+ .Ar result .
159
+ For information about the signature format, refer to the
160
+ .Nm
161
+ manual in PDF format.
162
+ .Sh EXAMPLE
163
+ Let's say, we want to make a call to the function:
164
+ .Bd -literal -offset indent
165
+ double sqrt(double x);
166
+ .Ed
167
+ .Pp
168
+ Using the
169
+ .Nm
170
+ library, this function would be called as follows:
171
+ .Bd -literal -offset indent
172
+ double r;
173
+ DCCallVM* vm = dcNewCallVM(4096);
174
+ dcMode(vm, DC_CALL_C_DEFAULT);
175
+ dcReset(vm);
176
+ dcArgDouble(vm, 4.2373);
177
+ r = dcCallDouble(vm, (DCpointer)&sqrt);
178
+ dcFree(vm);
179
+ .Ed
180
+ .Sh SEE ALSO
181
+ .Xr dyncallback 3 ,
182
+ .Xr dynload 3
183
+ and the
184
+ .Nm
185
+ manual (available in PDF format) for a way more detailed documentation of this
186
+ library.
187
+ .Sh AUTHORS
188
+ .An "Daniel Adler" Aq dadler@uni-goettingen.de
189
+ .An "Tassilo Philipp" Aq tphilipp@potion-studios.com
@@ -0,0 +1,135 @@
1
+ /*
2
+
3
+ Package: dyncall
4
+ Library: dyncall
5
+ File: dyncall/dyncall.h
6
+ Description: public header for library dyncall
7
+ License:
8
+
9
+ Copyright (c) 2007-2011 Daniel Adler <dadler@uni-goettingen.de>,
10
+ Tassilo Philipp <tphilipp@potion-studios.com>
11
+
12
+ Permission to use, copy, modify, and distribute this software for any
13
+ purpose with or without fee is hereby granted, provided that the above
14
+ copyright notice and this permission notice appear in all copies.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
17
+ WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
18
+ MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
19
+ ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
20
+ WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
21
+ ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
22
+ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
23
+
24
+ */
25
+
26
+
27
+ /*
28
+
29
+ dyncall C API
30
+
31
+ REVISION
32
+ 2007/12/11 initial
33
+
34
+ */
35
+
36
+ #ifndef DYNCALL_H
37
+ #define DYNCALL_H
38
+
39
+ #include "dyncall_types.h"
40
+
41
+ #ifdef __cplusplus
42
+ extern "C" {
43
+ #endif
44
+
45
+ typedef struct DCCallVM_ DCCallVM;
46
+ typedef struct DCstruct_ DCstruct;
47
+
48
+ /* Supported Calling Convention Modes */
49
+
50
+ #define DC_CALL_C_DEFAULT 0
51
+ #define DC_CALL_C_ELLIPSIS 100
52
+ #define DC_CALL_C_ELLIPSIS_VARARGS 101
53
+ #define DC_CALL_C_X86_CDECL 1
54
+ #define DC_CALL_C_X86_WIN32_STD 2
55
+ #define DC_CALL_C_X86_WIN32_FAST_MS 3
56
+ #define DC_CALL_C_X86_WIN32_FAST_GNU 4
57
+ #define DC_CALL_C_X86_WIN32_THIS_MS 5
58
+ #define DC_CALL_C_X86_WIN32_THIS_GNU 6
59
+ #define DC_CALL_C_X64_WIN64 7
60
+ #define DC_CALL_C_X64_SYSV 8
61
+ #define DC_CALL_C_PPC32_DARWIN 9
62
+ #define DC_CALL_C_PPC32_OSX DC_CALL_C_PPC32_DARWIN /* alias */
63
+ #define DC_CALL_C_ARM_ARM_EABI 10
64
+ #define DC_CALL_C_ARM_THUMB_EABI 11
65
+ #define DC_CALL_C_ARM_ARMHF 30
66
+ #define DC_CALL_C_MIPS32_EABI 12
67
+ #define DC_CALL_C_MIPS32_PSPSDK DC_CALL_C_MIPS32_EABI /* alias - deprecated. */
68
+ #define DC_CALL_C_PPC32_SYSV 13
69
+ #define DC_CALL_C_PPC32_LINUX DC_CALL_C_PPC32_SYSV /* alias */
70
+ #define DC_CALL_C_ARM_ARM 14
71
+ #define DC_CALL_C_ARM_THUMB 15
72
+ #define DC_CALL_C_MIPS32_O32 16
73
+ #define DC_CALL_C_MIPS64_N32 17
74
+ #define DC_CALL_C_MIPS64_N64 18
75
+ #define DC_CALL_C_X86_PLAN9 19
76
+ #define DC_CALL_C_SPARC32 20
77
+ #define DC_CALL_C_SPARC64 21
78
+ #define DC_CALL_SYS_DEFAULT 200
79
+ #define DC_CALL_SYS_X86_INT80H_LINUX 201
80
+ #define DC_CALL_SYS_X86_INT80H_BSD 202
81
+ /* Error codes. */
82
+
83
+ #define DC_ERROR_NONE 0
84
+ #define DC_ERROR_UNSUPPORTED_MODE -1
85
+
86
+ DC_API DCCallVM* dcNewCallVM (DCsize size);
87
+ DC_API void dcFree (DCCallVM* vm);
88
+ DC_API void dcReset (DCCallVM* vm);
89
+
90
+ DC_API void dcMode (DCCallVM* vm, DCint mode);
91
+
92
+ DC_API void dcArgBool (DCCallVM* vm, DCbool value);
93
+ DC_API void dcArgChar (DCCallVM* vm, DCchar value);
94
+ DC_API void dcArgShort (DCCallVM* vm, DCshort value);
95
+ DC_API void dcArgInt (DCCallVM* vm, DCint value);
96
+ DC_API void dcArgLong (DCCallVM* vm, DClong value);
97
+ DC_API void dcArgLongLong (DCCallVM* vm, DClonglong value);
98
+ DC_API void dcArgFloat (DCCallVM* vm, DCfloat value);
99
+ DC_API void dcArgDouble (DCCallVM* vm, DCdouble value);
100
+ DC_API void dcArgPointer (DCCallVM* vm, DCpointer value);
101
+ DC_API void dcArgStruct (DCCallVM* vm, DCstruct* s, DCpointer value);
102
+
103
+ DC_API void dcCallVoid (DCCallVM* vm, DCpointer funcptr);
104
+ DC_API DCbool dcCallBool (DCCallVM* vm, DCpointer funcptr);
105
+ DC_API DCchar dcCallChar (DCCallVM* vm, DCpointer funcptr);
106
+ DC_API DCshort dcCallShort (DCCallVM* vm, DCpointer funcptr);
107
+ DC_API DCint dcCallInt (DCCallVM* vm, DCpointer funcptr);
108
+ DC_API DClong dcCallLong (DCCallVM* vm, DCpointer funcptr);
109
+ DC_API DClonglong dcCallLongLong (DCCallVM* vm, DCpointer funcptr);
110
+ DC_API DCfloat dcCallFloat (DCCallVM* vm, DCpointer funcptr);
111
+ DC_API DCdouble dcCallDouble (DCCallVM* vm, DCpointer funcptr);
112
+ DC_API DCpointer dcCallPointer (DCCallVM* vm, DCpointer funcptr);
113
+ DC_API void dcCallStruct (DCCallVM* vm, DCpointer funcptr, DCstruct* s, DCpointer returnValue);
114
+
115
+ DC_API DCint dcGetError (DCCallVM* vm);
116
+
117
+ #define DEFAULT_ALIGNMENT 0
118
+ DC_API DCstruct* dcNewStruct (DCsize fieldCount, DCint alignment);
119
+ DC_API void dcStructField (DCstruct* s, DCint type, DCint alignment, DCsize arrayLength);
120
+ DC_API void dcSubStruct (DCstruct* s, DCsize fieldCount, DCint alignment, DCsize arrayLength);
121
+ /* Each dcNewStruct or dcSubStruct call must be paired with a dcCloseStruct. */
122
+ DC_API void dcCloseStruct (DCstruct* s);
123
+ DC_API DCsize dcStructSize (DCstruct* s);
124
+ DC_API DCsize dcStructAlignment(DCstruct* s);
125
+ DC_API void dcFreeStruct (DCstruct* s);
126
+
127
+ DC_API DCstruct* dcDefineStruct (const char* signature);
128
+
129
+
130
+ #ifdef __cplusplus
131
+ }
132
+ #endif
133
+
134
+ #endif /* DYNCALL_H */
135
+
@@ -0,0 +1,40 @@
1
+ /*
2
+
3
+ Package: dyncall
4
+ Library: dyncall
5
+ File: dyncall/dyncall_alloc.h
6
+ Description: heap memory management interface (header only)
7
+ License:
8
+
9
+ Copyright (c) 2007-2011 Daniel Adler <dadler@uni-goettingen.de>,
10
+ Tassilo Philipp <tphilipp@potion-studios.com>
11
+
12
+ Permission to use, copy, modify, and distribute this software for any
13
+ purpose with or without fee is hereby granted, provided that the above
14
+ copyright notice and this permission notice appear in all copies.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
17
+ WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
18
+ MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
19
+ ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
20
+ WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
21
+ ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
22
+ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
23
+
24
+ */
25
+
26
+
27
+ #ifndef DYNCALL_ALLOC_H
28
+ #define DYNCALL_ALLOC_H
29
+
30
+ #ifndef dcAllocMem
31
+ #include <stdlib.h>
32
+ #define dcAllocMem malloc
33
+ #endif
34
+
35
+ #ifndef dcFreeMem
36
+ #define dcFreeMem free
37
+ #endif
38
+
39
+ #endif /* DYNCALL_ALLOC_H */
40
+