koffi 2.12.1 → 2.12.3

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 (186) hide show
  1. package/CHANGELOG.md +21 -0
  2. package/LICENSE.txt +2 -2
  3. package/README.md +8 -8
  4. package/build/koffi/darwin_arm64/koffi.node +0 -0
  5. package/build/koffi/darwin_x64/koffi.node +0 -0
  6. package/build/koffi/freebsd_arm64/koffi.node +0 -0
  7. package/build/koffi/freebsd_ia32/koffi.node +0 -0
  8. package/build/koffi/freebsd_x64/koffi.node +0 -0
  9. package/build/koffi/linux_arm64/koffi.node +0 -0
  10. package/build/koffi/linux_armhf/koffi.node +0 -0
  11. package/build/koffi/linux_ia32/koffi.node +0 -0
  12. package/build/koffi/linux_loong64/koffi.node +0 -0
  13. package/build/koffi/linux_riscv64d/koffi.node +0 -0
  14. package/build/koffi/linux_x64/koffi.node +0 -0
  15. package/build/koffi/musl_arm64/koffi.node +0 -0
  16. package/build/koffi/musl_x64/koffi.node +0 -0
  17. package/build/koffi/openbsd_ia32/koffi.node +0 -0
  18. package/build/koffi/openbsd_x64/koffi.node +0 -0
  19. package/build/koffi/win32_arm64/koffi.exp +0 -0
  20. package/build/koffi/win32_arm64/koffi.node +0 -0
  21. package/build/koffi/win32_ia32/koffi.exp +0 -0
  22. package/build/koffi/win32_ia32/koffi.node +0 -0
  23. package/build/koffi/win32_x64/koffi.exp +0 -0
  24. package/build/koffi/win32_x64/koffi.node +0 -0
  25. package/doc/assets.ini +3 -3
  26. package/doc/develop.sh +4 -3
  27. package/doc/pages/platforms.md +1 -1
  28. package/doc/static/highlight.js +1 -1
  29. package/doc/static/koffi.css +3 -2
  30. package/doc/static/print.css +1 -1
  31. package/doc/templates/code.html +5 -5
  32. package/doc/templates/page.html +4 -4
  33. package/index.d.ts +228 -145
  34. package/index.js +25 -25
  35. package/indirect.js +25 -5
  36. package/package.json +2 -2
  37. package/src/cnoke/LICENSE.txt +2 -2
  38. package/src/cnoke/README.md +2 -0
  39. package/src/cnoke/assets/FindCNoke.cmake +12 -2
  40. package/src/cnoke/assets/win_delay_hook.c +4 -4
  41. package/src/cnoke/cnoke.js +4 -2
  42. package/src/cnoke/package.json +1 -1
  43. package/src/cnoke/src/builder.js +11 -14
  44. package/src/cnoke/src/index.js +2 -2
  45. package/src/cnoke/src/tools.js +34 -2
  46. package/src/core/{libcc/libcc.cc → base/base.cc} +3174 -1640
  47. package/src/core/{libcc/libcc.hh → base/base.hh} +3066 -2427
  48. package/src/core/{libcc → base}/mimetypes.inc +42 -4
  49. package/src/core/{libcc → base}/mimetypes_gen.py +3 -3
  50. package/src/core/base/unicode.inc +426 -0
  51. package/src/core/base/unicode_gen.py +189 -0
  52. package/src/koffi/CMakeLists.txt +7 -5
  53. package/src/koffi/cmake/raylib.cmake +6 -2
  54. package/src/koffi/cmake/{sqlite.cmake → sqlite3.cmake} +3 -3
  55. package/src/koffi/examples/electron-forge/forge.config.js +23 -3
  56. package/src/koffi/examples/electron-forge/package.json +18 -16
  57. package/src/koffi/src/abi_arm32.cc +7 -7
  58. package/src/koffi/src/abi_arm32_asm.S +2 -2
  59. package/src/koffi/src/abi_arm64.cc +45 -45
  60. package/src/koffi/src/abi_arm64_asm.S +4 -4
  61. package/src/koffi/src/abi_arm64_asm.asm +2 -2
  62. package/src/koffi/src/abi_loong64_asm.S +2 -2
  63. package/src/koffi/src/abi_riscv64.cc +5 -5
  64. package/src/koffi/src/abi_riscv64_asm.S +2 -2
  65. package/src/koffi/src/abi_x64_sysv.cc +3 -3
  66. package/src/koffi/src/abi_x64_sysv_asm.S +5 -5
  67. package/src/koffi/src/abi_x64_win.cc +3 -3
  68. package/src/koffi/src/abi_x64_win_asm.asm +2 -2
  69. package/src/koffi/src/abi_x86.cc +8 -8
  70. package/src/koffi/src/abi_x86_asm.S +2 -2
  71. package/src/koffi/src/abi_x86_asm.asm +2 -2
  72. package/src/koffi/src/call.cc +12 -12
  73. package/src/koffi/src/call.hh +8 -8
  74. package/src/koffi/src/errno.inc +152 -152
  75. package/src/koffi/src/ffi.cc +44 -39
  76. package/src/koffi/src/ffi.hh +6 -6
  77. package/src/koffi/src/init.js +1 -1
  78. package/src/koffi/src/parser.cc +5 -5
  79. package/src/koffi/src/parser.hh +3 -3
  80. package/src/koffi/src/trampolines/armasm.inc +2 -2
  81. package/src/koffi/src/trampolines/gnu.inc +2 -2
  82. package/src/koffi/src/trampolines/masm32.inc +2 -2
  83. package/src/koffi/src/trampolines/masm64.inc +2 -2
  84. package/src/koffi/src/trampolines/prototypes.inc +2 -2
  85. package/src/koffi/src/util.cc +9 -9
  86. package/src/koffi/src/util.hh +3 -3
  87. package/src/koffi/src/win32.cc +5 -5
  88. package/src/koffi/src/win32.hh +9 -9
  89. package/vendor/node-addon-api/CHANGELOG.md +97 -2
  90. package/vendor/node-addon-api/CONTRIBUTING.md +117 -7
  91. package/vendor/node-addon-api/README.md +25 -249
  92. package/vendor/node-addon-api/common.gypi +1 -0
  93. package/vendor/node-addon-api/doc/README.md +145 -0
  94. package/vendor/node-addon-api/doc/array_buffer.md +15 -15
  95. package/vendor/node-addon-api/doc/basic_env.md +200 -0
  96. package/vendor/node-addon-api/doc/buffer.md +24 -26
  97. package/vendor/node-addon-api/doc/cmake-js.md +19 -0
  98. package/vendor/node-addon-api/doc/{creating_a_release.md → contributing/creating_a_release.md} +16 -4
  99. package/vendor/node-addon-api/doc/env.md +11 -131
  100. package/vendor/node-addon-api/doc/error_handling.md +12 -0
  101. package/vendor/node-addon-api/doc/external.md +13 -4
  102. package/vendor/node-addon-api/doc/finalization.md +153 -0
  103. package/vendor/node-addon-api/doc/memory_management.md +1 -1
  104. package/vendor/node-addon-api/doc/object_wrap.md +19 -3
  105. package/vendor/node-addon-api/doc/promises.md +51 -0
  106. package/vendor/node-addon-api/doc/setup.md +29 -6
  107. package/vendor/node-addon-api/doc/value.md +13 -0
  108. package/vendor/node-addon-api/doc/version_management.md +2 -2
  109. package/vendor/node-addon-api/eslint.config.js +5 -0
  110. package/vendor/node-addon-api/index.js +2 -0
  111. package/vendor/node-addon-api/napi-inl.h +592 -166
  112. package/vendor/node-addon-api/napi.h +167 -59
  113. package/vendor/node-addon-api/node_addon_api.gyp +10 -0
  114. package/vendor/node-addon-api/noexcept.gypi +1 -1
  115. package/vendor/node-addon-api/package.json +10 -13
  116. package/vendor/node-addon-api/release-please-config.json +15 -0
  117. package/vendor/node-addon-api/test/addon_build/tpl/binding.gyp +2 -1
  118. package/vendor/node-addon-api/test/array_buffer.js +1 -1
  119. package/vendor/node-addon-api/test/async_context.js +2 -2
  120. package/vendor/node-addon-api/test/async_progress_queue_worker.js +3 -3
  121. package/vendor/node-addon-api/test/async_progress_worker.js +3 -3
  122. package/vendor/node-addon-api/test/async_worker.cc +15 -13
  123. package/vendor/node-addon-api/test/async_worker.js +5 -5
  124. package/vendor/node-addon-api/test/basic_types/value.cc +6 -0
  125. package/vendor/node-addon-api/test/basic_types/value.js +17 -0
  126. package/vendor/node-addon-api/test/binding.cc +8 -0
  127. package/vendor/node-addon-api/test/binding.gyp +23 -1
  128. package/vendor/node-addon-api/test/buffer.js +1 -2
  129. package/vendor/node-addon-api/test/common/index.js +1 -1
  130. package/vendor/node-addon-api/test/except_all.cc +22 -0
  131. package/vendor/node-addon-api/test/except_all.js +14 -0
  132. package/vendor/node-addon-api/test/exports.js +19 -0
  133. package/vendor/node-addon-api/test/finalizer_order.cc +152 -0
  134. package/vendor/node-addon-api/test/finalizer_order.js +98 -0
  135. package/vendor/node-addon-api/test/function.js +2 -2
  136. package/vendor/node-addon-api/test/function_reference.js +2 -2
  137. package/vendor/node-addon-api/test/globalObject/global_object_delete_property.cc +4 -4
  138. package/vendor/node-addon-api/test/globalObject/global_object_get_property.cc +4 -4
  139. package/vendor/node-addon-api/test/globalObject/global_object_has_own_property.cc +3 -3
  140. package/vendor/node-addon-api/test/globalObject/global_object_set_property.cc +5 -5
  141. package/vendor/node-addon-api/test/name.cc +10 -8
  142. package/vendor/node-addon-api/test/object/delete_property.cc +5 -5
  143. package/vendor/node-addon-api/test/object/get_property.cc +5 -5
  144. package/vendor/node-addon-api/test/object/has_own_property.cc +4 -4
  145. package/vendor/node-addon-api/test/object/has_property.cc +5 -5
  146. package/vendor/node-addon-api/test/object/object.cc +1 -1
  147. package/vendor/node-addon-api/test/object/set_property.cc +5 -5
  148. package/vendor/node-addon-api/test/object/subscript_operator.cc +3 -3
  149. package/vendor/node-addon-api/test/object_reference.cc +18 -18
  150. package/vendor/node-addon-api/test/promise.cc +75 -0
  151. package/vendor/node-addon-api/test/promise.js +23 -0
  152. package/vendor/node-addon-api/test/require_basic_finalizers/index.js +38 -0
  153. package/vendor/node-addon-api/test/require_basic_finalizers/tpl/addon.cc +12 -0
  154. package/vendor/node-addon-api/test/require_basic_finalizers/tpl/binding.gyp +48 -0
  155. package/vendor/node-addon-api/test/require_basic_finalizers/tpl/index.js +3 -0
  156. package/vendor/node-addon-api/test/require_basic_finalizers/tpl/package.json +11 -0
  157. package/vendor/node-addon-api/test/run_script.cc +1 -1
  158. package/vendor/node-addon-api/test/type_taggable.cc +1 -1
  159. package/vendor/node-addon-api/test/type_taggable.js +3 -4
  160. package/vendor/node-addon-api/test/typedarray.cc +28 -24
  161. package/vendor/node-addon-api/tools/conversion.js +1 -1
  162. package/vendor/node-api-headers/CHANGELOG.md +29 -0
  163. package/vendor/node-api-headers/CREATING_A_RELEASE.md +12 -2
  164. package/vendor/node-api-headers/def/js_native_api.def +6 -1
  165. package/vendor/node-api-headers/def/node_api.def +7 -1
  166. package/vendor/node-api-headers/include/js_native_api.h +56 -24
  167. package/vendor/node-api-headers/include/js_native_api_types.h +27 -0
  168. package/vendor/node-api-headers/include/node_api.h +38 -29
  169. package/vendor/node-api-headers/lib/parse-utils.js +92 -0
  170. package/vendor/node-api-headers/package.json +7 -7
  171. package/vendor/node-api-headers/release-please-config.json +12 -0
  172. package/vendor/node-api-headers/scripts/update-headers.js +63 -12
  173. package/vendor/node-api-headers/scripts/write-symbols.js +1 -1
  174. package/vendor/node-api-headers/symbols.js +17 -1
  175. package/vendor/node-api-headers/test/parse-utils.js +21 -0
  176. package/doc/flat/flat.css +0 -27
  177. package/doc/flat/normal.css +0 -429
  178. package/doc/flat/print.css +0 -29
  179. package/doc/flat/reset.css +0 -41
  180. package/doc/flat/small.css +0 -104
  181. package/doc/flat/static.js +0 -161
  182. package/src/core/libcc/brotli.cc +0 -186
  183. package/src/core/libcc/lz4.cc +0 -197
  184. package/src/core/libcc/miniz.cc +0 -353
  185. package/vendor/node-addon-api/tools/eslint-format.js +0 -79
  186. /package/vendor/node-api-headers/{scripts → lib}/clang-utils.js +0 -0
@@ -1,7 +1,7 @@
1
- # Copyright 2023 Niels Martignène <niels.martignene@protonmail.com>
1
+ # Copyright (C) 2025 Niels Martignène <niels.martignene@protonmail.com>
2
2
  #
3
3
  # Permission is hereby granted, free of charge, to any person obtaining a copy of
4
- # this software and associated documentation files (the “Software”), to deal in
4
+ # this software and associated documentation files (the “Software”), to deal in
5
5
  # the Software without restriction, including without limitation the rights to use,
6
6
  # copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the
7
7
  # Software, and to permit persons to whom the Software is furnished to do so,
@@ -41,7 +41,7 @@ if(MSVC)
41
41
  enable_language(ASM_MASM)
42
42
  endif()
43
43
  else()
44
- set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -Wno-missing-field-initializers -Wno-unused-parameter -Wswitch -Werror=switch")
44
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -Wno-missing-field-initializers -Wno-unused-parameter -Wno-class-memaccess -Wswitch -Werror=switch")
45
45
 
46
46
  if(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
47
47
  set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-unknown-warning-option")
@@ -76,7 +76,7 @@ set(KOFFI_SRC
76
76
  src/parser.cc
77
77
  src/util.cc
78
78
  src/win32.cc
79
- ../../src/core/libcc/libcc.cc
79
+ ../../src/core/base/base.cc
80
80
  )
81
81
  if(CMAKE_SIZEOF_VOID_P EQUAL 8)
82
82
  # CMAKE_SYSTEM_PROCESSOR is wrong on Windows ARM64
@@ -134,11 +134,12 @@ endif()
134
134
  add_node_addon(NAME koffi SOURCES ${KOFFI_SRC})
135
135
  target_include_directories(koffi PRIVATE . ../.. ../../vendor/node-addon-api)
136
136
 
137
- target_compile_definitions(koffi PRIVATE FELIX_TARGET=koffi NAPI_DISABLE_CPP_EXCEPTIONS NAPI_VERSION=8 LIBCC_NO_STATX)
137
+ target_compile_definitions(koffi PRIVATE FELIX_TARGET=koffi NAPI_DISABLE_CPP_EXCEPTIONS NAPI_VERSION=8 CORE_NO_STATX)
138
138
  if(WIN32)
139
139
  target_compile_definitions(koffi PRIVATE _CRT_SECURE_NO_WARNINGS _CRT_NONSTDC_NO_DEPRECATE)
140
140
  target_link_libraries(koffi PRIVATE ws2_32)
141
141
  endif()
142
+
142
143
  if(NOT MSVC OR CMAKE_C_COMPILER_ID MATCHES "[Cc]lang")
143
144
  # Restore C/C++ compiler sanity
144
145
 
@@ -155,4 +156,5 @@ if(NOT MSVC OR CMAKE_C_COMPILER_ID MATCHES "[Cc]lang")
155
156
  target_compile_options(koffi PRIVATE $<$<COMPILE_LANGUAGE:CXX>:-fno-finite-loops>)
156
157
  endif()
157
158
  endif()
159
+
158
160
  enable_unity_build(koffi)
@@ -1,7 +1,7 @@
1
- # Copyright 2023 Niels Martignène <niels.martignene@protonmail.com>
1
+ # Copyright (C) 2025 Niels Martignène <niels.martignene@protonmail.com>
2
2
  #
3
3
  # Permission is hereby granted, free of charge, to any person obtaining a copy of
4
- # this software and associated documentation files (the “Software”), to deal in
4
+ # this software and associated documentation files (the “Software”), to deal in
5
5
  # the Software without restriction, including without limitation the rights to use,
6
6
  # copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the
7
7
  # Software, and to permit persons to whom the Software is furnished to do so,
@@ -50,6 +50,10 @@ if(WIN32)
50
50
  target_link_libraries(raylib PRIVATE winmm)
51
51
  endif()
52
52
 
53
+ if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
54
+ target_compile_definitions(raylib PRIVATE _GNU_SOURCE)
55
+ endif()
56
+
53
57
  if(CMAKE_SYSTEM_NAME MATCHES "BSD")
54
58
  target_include_directories(raylib PRIVATE /usr/local/include)
55
59
  endif()
@@ -1,7 +1,7 @@
1
- # Copyright 2023 Niels Martignène <niels.martignene@protonmail.com>
1
+ # Copyright (C) 2025 Niels Martignène <niels.martignene@protonmail.com>
2
2
  #
3
3
  # Permission is hereby granted, free of charge, to any person obtaining a copy of
4
- # this software and associated documentation files (the “Software”), to deal in
4
+ # this software and associated documentation files (the “Software”), to deal in
5
5
  # the Software without restriction, including without limitation the rights to use,
6
6
  # copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the
7
7
  # Software, and to permit persons to whom the Software is furnished to do so,
@@ -19,7 +19,7 @@
19
19
  # FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
20
20
  # OTHER DEALINGS IN THE SOFTWARE.
21
21
 
22
- add_library(sqlite3 SHARED ../../../vendor/sqlite3/sqlite3.c)
22
+ add_library(sqlite3 SHARED ../../../vendor/sqlite3mc/sqlite3.c)
23
23
  set_target_properties(sqlite3 PROPERTIES PREFIX "")
24
24
 
25
25
  if(WIN32)
@@ -1,3 +1,6 @@
1
+ const { FusesPlugin } = require('@electron-forge/plugin-fuses');
2
+ const { FuseV1Options, FuseVersion } = require('@electron/fuses');
3
+
1
4
  module.exports = {
2
5
  packagerConfig: {
3
6
  asar: true,
@@ -10,8 +13,16 @@ module.exports = {
10
13
  },
11
14
  {
12
15
  name: '@electron-forge/maker-zip',
16
+ platforms: ['darwin'],
17
+ },
18
+ {
19
+ name: '@electron-forge/maker-deb',
20
+ config: {},
21
+ },
22
+ {
23
+ name: '@electron-forge/maker-rpm',
13
24
  config: {},
14
- }
25
+ },
15
26
  ],
16
27
  plugins: [
17
28
  {
@@ -35,9 +46,18 @@ module.exports = {
35
46
  },
36
47
  ],
37
48
  },
38
- "port": 3001,
39
- "loggerPort": 9001
40
49
  },
41
50
  },
51
+ // Fuses are used to enable/disable various Electron functionality
52
+ // at package time, before code signing the application
53
+ new FusesPlugin({
54
+ version: FuseVersion.V1,
55
+ [FuseV1Options.RunAsNode]: false,
56
+ [FuseV1Options.EnableCookieEncryption]: true,
57
+ [FuseV1Options.EnableNodeOptionsEnvironmentVariable]: false,
58
+ [FuseV1Options.EnableNodeCliInspectArguments]: false,
59
+ [FuseV1Options.EnableEmbeddedAsarIntegrityValidation]: true,
60
+ [FuseV1Options.OnlyLoadAppFromAsar]: true,
61
+ }),
42
62
  ],
43
63
  };
@@ -10,28 +10,30 @@
10
10
  "publish": "electron-forge publish",
11
11
  "lint": "echo \"No linting configured\""
12
12
  },
13
+ "devDependencies": {
14
+ "@electron-forge/cli": "^7.6.1",
15
+ "@electron-forge/maker-deb": "^7.6.1",
16
+ "@electron-forge/maker-rpm": "^7.6.1",
17
+ "@electron-forge/maker-squirrel": "^7.6.1",
18
+ "@electron-forge/maker-zip": "^7.6.1",
19
+ "@electron-forge/plugin-auto-unpack-natives": "^7.6.1",
20
+ "@electron-forge/plugin-fuses": "^7.6.1",
21
+ "@electron-forge/plugin-webpack": "^7.6.1",
22
+ "@electron/fuses": "^1.8.0",
23
+ "@vercel/webpack-asset-relocator-loader": "^1.7.3",
24
+ "css-loader": "^6.11.0",
25
+ "electron": "34.2.0",
26
+ "node-loader": "^2.1.0",
27
+ "style-loader": "^3.3.4"
28
+ },
13
29
  "keywords": [],
14
30
  "author": {
15
31
  "name": "Niels Martignène",
16
32
  "email": "niels.martignene@protonmail.com"
17
33
  },
18
34
  "license": "MIT",
19
- "devDependencies": {
20
- "@electron-forge/cli": "^6.2.1",
21
- "@electron-forge/maker-deb": "^6.2.1",
22
- "@electron-forge/maker-rpm": "^6.2.1",
23
- "@electron-forge/maker-squirrel": "^6.2.1",
24
- "@electron-forge/maker-zip": "^6.2.1",
25
- "@electron-forge/plugin-auto-unpack-natives": "^6.2.1",
26
- "@electron-forge/plugin-webpack": "^6.2.1",
27
- "@vercel/webpack-asset-relocator-loader": "^1.7.3",
28
- "css-loader": "^6.8.1",
29
- "electron": "25.3.2",
30
- "node-loader": "^2.0.0",
31
- "style-loader": "^3.3.3"
32
- },
33
35
  "dependencies": {
34
- "electron-squirrel-startup": "^1.0.0",
35
- "koffi": "^2.5.18"
36
+ "electron-squirrel-startup": "^1.0.1",
37
+ "koffi": "^2.10.1"
36
38
  }
37
39
  }
@@ -1,7 +1,7 @@
1
- // Copyright 2023 Niels Martignène <niels.martignene@protonmail.com>
1
+ // Copyright (C) 2025 Niels Martignène <niels.martignene@protonmail.com>
2
2
  //
3
3
  // Permission is hereby granted, free of charge, to any person obtaining a copy of
4
- // this software and associated documentation files (the “Software”), to deal in
4
+ // this software and associated documentation files (the “Software”), to deal in
5
5
  // the Software without restriction, including without limitation the rights to use,
6
6
  // copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the
7
7
  // Software, and to permit persons to whom the Software is furnished to do so,
@@ -21,7 +21,7 @@
21
21
 
22
22
  #if defined(__arm__) || (defined(__M_ARM) && !defined(_M_ARM64))
23
23
 
24
- #include "src/core/libcc/libcc.hh"
24
+ #include "src/core/base/base.hh"
25
25
  #include "ffi.hh"
26
26
  #include "call.hh"
27
27
  #include "util.hh"
@@ -64,7 +64,7 @@ extern "C" napi_value CallSwitchStack(Napi::Function *func, size_t argc, napi_va
64
64
 
65
65
  static int IsHFA(const TypeInfo *type)
66
66
  {
67
- #ifdef __ARM_PCS_VFP
67
+ #if defined(__ARM_PCS_VFP)
68
68
  bool float32 = false;
69
69
  bool float64 = false;
70
70
  int count = 0;
@@ -179,7 +179,7 @@ bool AnalyseFunction(Napi::Env, InstanceData *, FunctionInfo *func)
179
179
  case PrimitiveKind::Array: { RG_UNREACHABLE(); } break;
180
180
  case PrimitiveKind::Float32:
181
181
  case PrimitiveKind::Float64: {
182
- #ifdef __ARM_PCS_VFP
182
+ #if defined(__ARM_PCS_VFP)
183
183
  bool vfp = !param.variadic;
184
184
  #else
185
185
  bool vfp = false;
@@ -982,7 +982,7 @@ void CallData::Relay(Size idx, uint8_t *own_sp, uint8_t *caller_sp, bool switch_
982
982
  }
983
983
 
984
984
  float f = GetNumber<float>(value);
985
- #ifdef __ARM_PCS_VFP
985
+ #if defined(__ARM_PCS_VFP)
986
986
  memcpy(&out_reg->d0, &f, 4);
987
987
  #else
988
988
  memcpy(&out_reg->r0, &f, 4);
@@ -995,7 +995,7 @@ void CallData::Relay(Size idx, uint8_t *own_sp, uint8_t *caller_sp, bool switch_
995
995
  }
996
996
 
997
997
  double d = GetNumber<double>(value);
998
- #ifdef __ARM_PCS_VFP
998
+ #if defined(__ARM_PCS_VFP)
999
999
  out_reg->d0 = d;
1000
1000
  #else
1001
1001
  memcpy(&out_reg->r0, &d, 8);
@@ -1,7 +1,7 @@
1
- # Copyright 2023 Niels Martignène <niels.martignene@protonmail.com>
1
+ # Copyright (C) 2025 Niels Martignène <niels.martignene@protonmail.com>
2
2
  #
3
3
  # Permission is hereby granted, free of charge, to any person obtaining a copy of
4
- # this software and associated documentation files (the “Software”), to deal in
4
+ # this software and associated documentation files (the “Software”), to deal in
5
5
  # the Software without restriction, including without limitation the rights to use,
6
6
  # copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the
7
7
  # Software, and to permit persons to whom the Software is furnished to do so,
@@ -1,7 +1,7 @@
1
- // Copyright 2023 Niels Martignène <niels.martignene@protonmail.com>
1
+ // Copyright (C) 2025 Niels Martignène <niels.martignene@protonmail.com>
2
2
  //
3
3
  // Permission is hereby granted, free of charge, to any person obtaining a copy of
4
- // this software and associated documentation files (the “Software”), to deal in
4
+ // this software and associated documentation files (the “Software”), to deal in
5
5
  // the Software without restriction, including without limitation the rights to use,
6
6
  // copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the
7
7
  // Software, and to permit persons to whom the Software is furnished to do so,
@@ -21,11 +21,11 @@
21
21
 
22
22
  #if defined(__aarch64__) || defined(_M_ARM64)
23
23
 
24
- #include "src/core/libcc/libcc.hh"
24
+ #include "src/core/base/base.hh"
25
25
  #include "ffi.hh"
26
26
  #include "call.hh"
27
27
  #include "util.hh"
28
- #ifdef _WIN32
28
+ #if defined(_WIN32)
29
29
  #include "win32.hh"
30
30
  #endif
31
31
 
@@ -135,7 +135,7 @@ bool AnalyseFunction(Napi::Env, InstanceData *, FunctionInfo *func)
135
135
 
136
136
  int gpr_avail = 8;
137
137
  int vec_avail = 8;
138
- #ifdef _M_ARM64EC
138
+ #if defined(_M_ARM64EC)
139
139
  if (func->variadic) {
140
140
  gpr_avail = 4;
141
141
  }
@@ -165,7 +165,7 @@ bool AnalyseFunction(Napi::Env, InstanceData *, FunctionInfo *func)
165
165
  case PrimitiveKind::String32:
166
166
  case PrimitiveKind::Pointer:
167
167
  case PrimitiveKind::Callback: {
168
- #ifdef __APPLE__
168
+ #if defined(__APPLE__)
169
169
  if (param.variadic)
170
170
  break;
171
171
  #endif
@@ -179,7 +179,7 @@ bool AnalyseFunction(Napi::Env, InstanceData *, FunctionInfo *func)
179
179
  case PrimitiveKind::Union: {
180
180
  HfaInfo hfa = IsHFA(param.type);
181
181
 
182
- #ifdef _M_ARM64EC
182
+ #if defined(_M_ARM64EC)
183
183
  if (func->variadic) {
184
184
  if (IsRegularSize(param.type->size, 8) && gpr_avail) {
185
185
  param.gpr_count = 1;
@@ -283,7 +283,7 @@ bool CallData::Prepare(const FunctionInfo *func, const Napi::CallbackInfo &info)
283
283
  gpr_ptr[8] = (uint64_t)return_ptr;
284
284
  }
285
285
 
286
- #ifdef _M_ARM64EC
286
+ #if defined(_M_ARM64EC)
287
287
  if (func->variadic) {
288
288
  gpr_ptr[4] = (uint64_t)args_ptr;
289
289
  gpr_ptr[5] = 0;
@@ -295,7 +295,7 @@ bool CallData::Prepare(const FunctionInfo *func, const Napi::CallbackInfo &info)
295
295
  }
296
296
  #endif
297
297
 
298
- #ifdef __APPLE__
298
+ #if defined(__APPLE__)
299
299
  #define PUSH_INTEGER(CType) \
300
300
  do { \
301
301
  if (!value.IsNumber() && !value.IsBigInt()) [[unlikely]] { \
@@ -371,7 +371,7 @@ bool CallData::Prepare(const FunctionInfo *func, const Napi::CallbackInfo &info)
371
371
 
372
372
  bool b = value.As<Napi::Boolean>();
373
373
 
374
- #ifdef __APPLE__
374
+ #if defined(__APPLE__)
375
375
  if (param.gpr_count) [[likely]] {
376
376
  *(gpr_ptr++) = (uint64_t)b;
377
377
  } else {
@@ -401,7 +401,7 @@ bool CallData::Prepare(const FunctionInfo *func, const Napi::CallbackInfo &info)
401
401
  if (!PushString(value, param.directions, &str)) [[unlikely]]
402
402
  return false;
403
403
 
404
- #ifdef __APPLE__
404
+ #if defined(__APPLE__)
405
405
  args_ptr = param.gpr_count ? args_ptr : AlignUp(args_ptr, 8);
406
406
  #endif
407
407
  *(const char **)((param.gpr_count ? gpr_ptr : args_ptr)++) = str;
@@ -411,7 +411,7 @@ bool CallData::Prepare(const FunctionInfo *func, const Napi::CallbackInfo &info)
411
411
  if (!PushString16(value, param.directions, &str16)) [[unlikely]]
412
412
  return false;
413
413
 
414
- #ifdef __APPLE__
414
+ #if defined(__APPLE__)
415
415
  args_ptr = param.gpr_count ? args_ptr : AlignUp(args_ptr, 8);
416
416
  #endif
417
417
  *(const char16_t **)((param.gpr_count ? gpr_ptr : args_ptr)++) = str16;
@@ -431,7 +431,7 @@ bool CallData::Prepare(const FunctionInfo *func, const Napi::CallbackInfo &info)
431
431
  if (!PushPointer(value, param.type, param.directions, &ptr)) [[unlikely]]
432
432
  return false;
433
433
 
434
- #ifdef __APPLE__
434
+ #if defined(__APPLE__)
435
435
  args_ptr = param.gpr_count ? args_ptr : AlignUp(args_ptr, 8);
436
436
  #endif
437
437
  *(void **)((param.gpr_count ? gpr_ptr : args_ptr)++) = ptr;
@@ -461,7 +461,7 @@ bool CallData::Prepare(const FunctionInfo *func, const Napi::CallbackInfo &info)
461
461
  return false;
462
462
  gpr_ptr += param.gpr_count;
463
463
  } else if (param.type->size) {
464
- #ifdef __APPLE__
464
+ #if defined(__APPLE__)
465
465
  args_ptr = AlignUp(args_ptr, 8);
466
466
  #endif
467
467
  if (!PushObject(obj, param.type, (uint8_t *)args_ptr))
@@ -477,7 +477,7 @@ bool CallData::Prepare(const FunctionInfo *func, const Napi::CallbackInfo &info)
477
477
 
478
478
  *(uint8_t **)(gpr_ptr++) = ptr;
479
479
  } else {
480
- #ifdef __APPLE__
480
+ #if defined(__APPLE__)
481
481
  args_ptr = AlignUp(args_ptr, 8);
482
482
  #endif
483
483
  *(uint8_t **)(args_ptr++) = ptr;
@@ -499,13 +499,13 @@ bool CallData::Prepare(const FunctionInfo *func, const Napi::CallbackInfo &info)
499
499
  if (param.vec_count) [[likely]] {
500
500
  memset((uint8_t *)vec_ptr + 4, 0, 4);
501
501
  *(float *)(vec_ptr++) = f;
502
- #ifdef _WIN32
502
+ #if defined(_WIN32)
503
503
  } else if (param.gpr_count) {
504
504
  memset((uint8_t *)gpr_ptr + 4, 0, 4);
505
505
  *(float *)(gpr_ptr++) = f;
506
506
  #endif
507
507
  } else {
508
- #ifdef __APPLE__
508
+ #if defined(__APPLE__)
509
509
  args_ptr = AlignUp(args_ptr, 4);
510
510
  *(float *)args_ptr = f;
511
511
  args_ptr = (uint64_t *)((uint8_t *)args_ptr + 4);
@@ -525,12 +525,12 @@ bool CallData::Prepare(const FunctionInfo *func, const Napi::CallbackInfo &info)
525
525
 
526
526
  if (param.vec_count) [[likely]] {
527
527
  *(double *)(vec_ptr++) = d;
528
- #ifdef _WIN32
528
+ #if defined(_WIN32)
529
529
  } else if (param.gpr_count) {
530
530
  *(double *)(gpr_ptr++) = d;
531
531
  #endif
532
532
  } else {
533
- #ifdef __APPLE__
533
+ #if defined(__APPLE__)
534
534
  args_ptr = AlignUp(args_ptr, 8);
535
535
  #endif
536
536
  *(double *)(args_ptr++) = d;
@@ -541,7 +541,7 @@ bool CallData::Prepare(const FunctionInfo *func, const Napi::CallbackInfo &info)
541
541
  if (!PushCallback(value, param.type, &ptr)) [[unlikely]]
542
542
  return false;
543
543
 
544
- #ifdef __APPLE__
544
+ #if defined(__APPLE__)
545
545
  args_ptr = param.gpr_count ? args_ptr : AlignUp(args_ptr, 8);
546
546
  #endif
547
547
  *(void **)((param.gpr_count ? gpr_ptr : args_ptr)++) = ptr;
@@ -561,7 +561,7 @@ bool CallData::Prepare(const FunctionInfo *func, const Napi::CallbackInfo &info)
561
561
 
562
562
  void CallData::Execute(const FunctionInfo *func, void *native)
563
563
  {
564
- #ifdef _WIN32
564
+ #if defined(_WIN32)
565
565
  TEB *teb = GetTEB();
566
566
 
567
567
  // Restore previous stack limits at the end
@@ -714,7 +714,7 @@ void CallData::Relay(Size idx, uint8_t *own_sp, uint8_t *caller_sp, bool switch_
714
714
  if (env.IsExceptionPending()) [[unlikely]]
715
715
  return;
716
716
 
717
- #ifdef _WIN32
717
+ #if defined(_WIN32)
718
718
  TEB *teb = GetTEB();
719
719
 
720
720
  // Restore previous stack limits at the end
@@ -763,7 +763,7 @@ void CallData::Relay(Size idx, uint8_t *own_sp, uint8_t *caller_sp, bool switch_
763
763
  case PrimitiveKind::Void: { RG_UNREACHABLE(); } break;
764
764
 
765
765
  case PrimitiveKind::Bool: {
766
- #ifdef __APPLE__
766
+ #if defined(__APPLE__)
767
767
  bool b;
768
768
  if (param.gpr_count) {
769
769
  b = *(bool *)(gpr_ptr++);
@@ -779,7 +779,7 @@ void CallData::Relay(Size idx, uint8_t *own_sp, uint8_t *caller_sp, bool switch_
779
779
  arguments.Append(arg);
780
780
  } break;
781
781
  case PrimitiveKind::Int8: {
782
- #ifdef __APPLE__
782
+ #if defined(__APPLE__)
783
783
  double d;
784
784
  if (param.gpr_count) {
785
785
  d = (double)*(int8_t *)(gpr_ptr++);
@@ -795,7 +795,7 @@ void CallData::Relay(Size idx, uint8_t *own_sp, uint8_t *caller_sp, bool switch_
795
795
  arguments.Append(arg);
796
796
  } break;
797
797
  case PrimitiveKind::UInt8: {
798
- #ifdef __APPLE__
798
+ #if defined(__APPLE__)
799
799
  double d;
800
800
  if (param.gpr_count) {
801
801
  d = (double)*(uint8_t *)(gpr_ptr++);
@@ -811,7 +811,7 @@ void CallData::Relay(Size idx, uint8_t *own_sp, uint8_t *caller_sp, bool switch_
811
811
  arguments.Append(arg);
812
812
  } break;
813
813
  case PrimitiveKind::Int16: {
814
- #ifdef __APPLE__
814
+ #if defined(__APPLE__)
815
815
  double d;
816
816
  if (param.gpr_count) {
817
817
  d = (double)*(int16_t *)(gpr_ptr++);
@@ -828,7 +828,7 @@ void CallData::Relay(Size idx, uint8_t *own_sp, uint8_t *caller_sp, bool switch_
828
828
  arguments.Append(arg);
829
829
  } break;
830
830
  case PrimitiveKind::Int16S: {
831
- #ifdef __APPLE__
831
+ #if defined(__APPLE__)
832
832
  double d;
833
833
  if (param.gpr_count) {
834
834
  int16_t v = *(int16_t *)(gpr_ptr++);
@@ -850,7 +850,7 @@ void CallData::Relay(Size idx, uint8_t *own_sp, uint8_t *caller_sp, bool switch_
850
850
  arguments.Append(arg);
851
851
  } break;
852
852
  case PrimitiveKind::UInt16: {
853
- #ifdef __APPLE__
853
+ #if defined(__APPLE__)
854
854
  double d;
855
855
  if (param.gpr_count) {
856
856
  d = (double)*(uint16_t *)(gpr_ptr++);
@@ -867,7 +867,7 @@ void CallData::Relay(Size idx, uint8_t *own_sp, uint8_t *caller_sp, bool switch_
867
867
  arguments.Append(arg);
868
868
  } break;
869
869
  case PrimitiveKind::UInt16S: {
870
- #ifdef __APPLE__
870
+ #if defined(__APPLE__)
871
871
  double d;
872
872
  if (param.gpr_count) {
873
873
  uint16_t v = *(uint16_t *)(gpr_ptr++);
@@ -889,7 +889,7 @@ void CallData::Relay(Size idx, uint8_t *own_sp, uint8_t *caller_sp, bool switch_
889
889
  arguments.Append(arg);
890
890
  } break;
891
891
  case PrimitiveKind::Int32: {
892
- #ifdef __APPLE__
892
+ #if defined(__APPLE__)
893
893
  double d;
894
894
  if (param.gpr_count) {
895
895
  d = (double)*(int32_t *)(gpr_ptr++);
@@ -906,7 +906,7 @@ void CallData::Relay(Size idx, uint8_t *own_sp, uint8_t *caller_sp, bool switch_
906
906
  arguments.Append(arg);
907
907
  } break;
908
908
  case PrimitiveKind::Int32S: {
909
- #ifdef __APPLE__
909
+ #if defined(__APPLE__)
910
910
  double d;
911
911
  if (param.gpr_count) {
912
912
  int32_t v = *(int32_t *)(gpr_ptr++);
@@ -928,7 +928,7 @@ void CallData::Relay(Size idx, uint8_t *own_sp, uint8_t *caller_sp, bool switch_
928
928
  arguments.Append(arg);
929
929
  } break;
930
930
  case PrimitiveKind::UInt32: {
931
- #ifdef __APPLE__
931
+ #if defined(__APPLE__)
932
932
  double d;
933
933
  if (param.gpr_count) {
934
934
  d = (double)*(uint32_t *)(gpr_ptr++);
@@ -945,7 +945,7 @@ void CallData::Relay(Size idx, uint8_t *own_sp, uint8_t *caller_sp, bool switch_
945
945
  arguments.Append(arg);
946
946
  } break;
947
947
  case PrimitiveKind::UInt32S: {
948
- #ifdef __APPLE__
948
+ #if defined(__APPLE__)
949
949
  double d;
950
950
  if (param.gpr_count) {
951
951
  uint32_t v = *(uint32_t *)(gpr_ptr++);
@@ -967,7 +967,7 @@ void CallData::Relay(Size idx, uint8_t *own_sp, uint8_t *caller_sp, bool switch_
967
967
  arguments.Append(arg);
968
968
  } break;
969
969
  case PrimitiveKind::Int64: {
970
- #ifdef __APPLE__
970
+ #if defined(__APPLE__)
971
971
  args_ptr = AlignUp(args_ptr, 8);
972
972
  #endif
973
973
 
@@ -977,7 +977,7 @@ void CallData::Relay(Size idx, uint8_t *own_sp, uint8_t *caller_sp, bool switch_
977
977
  arguments.Append(arg);
978
978
  } break;
979
979
  case PrimitiveKind::Int64S: {
980
- #ifdef __APPLE__
980
+ #if defined(__APPLE__)
981
981
  args_ptr = AlignUp(args_ptr, 8);
982
982
  #endif
983
983
 
@@ -987,7 +987,7 @@ void CallData::Relay(Size idx, uint8_t *own_sp, uint8_t *caller_sp, bool switch_
987
987
  arguments.Append(arg);
988
988
  } break;
989
989
  case PrimitiveKind::UInt64: {
990
- #ifdef __APPLE__
990
+ #if defined(__APPLE__)
991
991
  args_ptr = AlignUp(args_ptr, 8);
992
992
  #endif
993
993
 
@@ -997,7 +997,7 @@ void CallData::Relay(Size idx, uint8_t *own_sp, uint8_t *caller_sp, bool switch_
997
997
  arguments.Append(arg);
998
998
  } break;
999
999
  case PrimitiveKind::UInt64S: {
1000
- #ifdef __APPLE__
1000
+ #if defined(__APPLE__)
1001
1001
  args_ptr = AlignUp(args_ptr, 8);
1002
1002
  #endif
1003
1003
 
@@ -1007,7 +1007,7 @@ void CallData::Relay(Size idx, uint8_t *own_sp, uint8_t *caller_sp, bool switch_
1007
1007
  arguments.Append(arg);
1008
1008
  } break;
1009
1009
  case PrimitiveKind::String: {
1010
- #ifdef __APPLE__
1010
+ #if defined(__APPLE__)
1011
1011
  args_ptr = AlignUp(args_ptr, 8);
1012
1012
  #endif
1013
1013
 
@@ -1021,7 +1021,7 @@ void CallData::Relay(Size idx, uint8_t *own_sp, uint8_t *caller_sp, bool switch_
1021
1021
  }
1022
1022
  } break;
1023
1023
  case PrimitiveKind::String16: {
1024
- #ifdef __APPLE__
1024
+ #if defined(__APPLE__)
1025
1025
  args_ptr = AlignUp(args_ptr, 8);
1026
1026
  #endif
1027
1027
 
@@ -1046,7 +1046,7 @@ void CallData::Relay(Size idx, uint8_t *own_sp, uint8_t *caller_sp, bool switch_
1046
1046
  } break;
1047
1047
  case PrimitiveKind::Pointer:
1048
1048
  case PrimitiveKind::Callback: {
1049
- #ifdef __APPLE__
1049
+ #if defined(__APPLE__)
1050
1050
  args_ptr = AlignUp(args_ptr, 8);
1051
1051
  #endif
1052
1052
 
@@ -1093,7 +1093,7 @@ void CallData::Relay(Size idx, uint8_t *own_sp, uint8_t *caller_sp, bool switch_
1093
1093
  args_ptr += (param.type->size + 7) / 8;
1094
1094
  }
1095
1095
  } else {
1096
- #ifdef __APPLE__
1096
+ #if defined(__APPLE__)
1097
1097
  args_ptr = AlignUp(args_ptr, 8);
1098
1098
  #endif
1099
1099
 
@@ -1108,12 +1108,12 @@ void CallData::Relay(Size idx, uint8_t *own_sp, uint8_t *caller_sp, bool switch_
1108
1108
  float f;
1109
1109
  if (param.vec_count) [[likely]] {
1110
1110
  f = *(float *)(vec_ptr++);
1111
- #ifdef _WIN32
1111
+ #if defined(_WIN32)
1112
1112
  } else if (param.gpr_count) {
1113
1113
  f = *(float *)(gpr_ptr++);
1114
1114
  #endif
1115
1115
  } else {
1116
- #ifdef __APPLE__
1116
+ #if defined(__APPLE__)
1117
1117
  args_ptr = AlignUp(args_ptr, 4);
1118
1118
  f = *(float *)args_ptr;
1119
1119
  args_ptr = (uint64_t *)((uint8_t *)args_ptr + 4);
@@ -1129,12 +1129,12 @@ void CallData::Relay(Size idx, uint8_t *own_sp, uint8_t *caller_sp, bool switch_
1129
1129
  double d;
1130
1130
  if (param.vec_count) [[likely]] {
1131
1131
  d = *(double *)(vec_ptr++);
1132
- #ifdef _WIN32
1132
+ #if defined(_WIN32)
1133
1133
  } else if (param.gpr_count) {
1134
1134
  d = *(double *)(gpr_ptr++);
1135
1135
  #endif
1136
1136
  } else {
1137
- #ifdef __APPLE__
1137
+ #if defined(__APPLE__)
1138
1138
  args_ptr = AlignUp(args_ptr, 8);
1139
1139
  #endif
1140
1140
 
@@ -1,7 +1,7 @@
1
- # Copyright 2023 Niels Martignène <niels.martignene@protonmail.com>
1
+ # Copyright (C) 2025 Niels Martignène <niels.martignene@protonmail.com>
2
2
  #
3
3
  # Permission is hereby granted, free of charge, to any person obtaining a copy of
4
- # this software and associated documentation files (the “Software”), to deal in
4
+ # this software and associated documentation files (the “Software”), to deal in
5
5
  # the Software without restriction, including without limitation the rights to use,
6
6
  # copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the
7
7
  # Software, and to permit persons to whom the Software is furnished to do so,
@@ -19,7 +19,7 @@
19
19
  # FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
20
20
  # OTHER DEALINGS IN THE SOFTWARE.
21
21
 
22
- #ifdef __APPLE__
22
+ #if defined(__APPLE__)
23
23
  #define SYMBOL(Symbol) _ ## Symbol
24
24
  #else
25
25
  #define SYMBOL(Symbol) Symbol
@@ -28,7 +28,7 @@
28
28
  # Forward
29
29
  # ----------------------------
30
30
 
31
- #ifdef __APPLE__
31
+ #if defined(__APPLE__)
32
32
  # Fix "arm64 function not 4-byte aligned" linker warnings
33
33
  .p2align 2
34
34
  #endif
@@ -1,7 +1,7 @@
1
- ; Copyright 2023 Niels Martignène <niels.martignene@protonmail.com>
1
+ ; Copyright (C) 2025 Niels Martignène <niels.martignene@protonmail.com>
2
2
  ;
3
3
  ; Permission is hereby granted, free of charge, to any person obtaining a copy of
4
- ; this software and associated documentation files (the “Software”), to deal in
4
+ ; this software and associated documentation files (the “Software”), to deal in
5
5
  ; the Software without restriction, including without limitation the rights to use,
6
6
  ; copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the
7
7
  ; Software, and to permit persons to whom the Software is furnished to do so,
@@ -1,7 +1,7 @@
1
- # Copyright 2023 Niels Martignène <niels.martignene@protonmail.com>
1
+ # Copyright (C) 2025 Niels Martignène <niels.martignene@protonmail.com>
2
2
  #
3
3
  # Permission is hereby granted, free of charge, to any person obtaining a copy of
4
- # this software and associated documentation files (the “Software”), to deal in
4
+ # this software and associated documentation files (the “Software”), to deal in
5
5
  # the Software without restriction, including without limitation the rights to use,
6
6
  # copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the
7
7
  # Software, and to permit persons to whom the Software is furnished to do so,