functionalscript 0.2.0 → 0.2.2

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 (248) hide show
  1. package/dev/module.mjs +1 -1
  2. package/jsr.json +59 -59
  3. package/out/com/cpp/module.f.mjs +123 -0
  4. package/out/com/cpp/test.f.mjs +40 -0
  5. package/out/com/cpp/testlib.f.mjs +7 -0
  6. package/out/com/cs/module.f.mjs +95 -0
  7. package/out/com/cs/test.f.mjs +43 -0
  8. package/out/com/cs/testlib.f.mjs +7 -0
  9. package/out/com/rust/module.f.mjs +213 -0
  10. package/out/com/rust/test.f.mjs +123 -0
  11. package/out/com/rust/testlib.f.mjs +7 -0
  12. package/out/com/test/build.f.mjs +98 -0
  13. package/out/com/test/build.mjs +40 -0
  14. package/out/com/types/module.f.mjs +51 -0
  15. package/out/com/types/testlib.f.mjs +30 -0
  16. package/out/commonjs/build/module.f.mjs +107 -0
  17. package/out/commonjs/build/test.f.mjs +102 -0
  18. package/out/commonjs/module/function/module.f.mjs +15 -0
  19. package/out/commonjs/module/module.f.mjs +48 -0
  20. package/out/commonjs/module.f.mjs +10 -0
  21. package/out/commonjs/module.mjs +26 -0
  22. package/out/commonjs/package/dependencies/module.f.mjs +21 -0
  23. package/out/commonjs/package/dependencies/test.f.mjs +15 -0
  24. package/out/commonjs/package/module.f.mjs +40 -0
  25. package/out/commonjs/package/test.f.mjs +27 -0
  26. package/out/commonjs/path/module.f.mjs +171 -0
  27. package/out/commonjs/path/test.f.mjs +231 -0
  28. package/out/commonjs/test.mjs +87 -0
  29. package/out/dev/index.mjs +2 -0
  30. package/out/dev/module.f.mjs +2 -0
  31. package/out/dev/module.mjs +167 -0
  32. package/out/dev/test/module.f.mjs +134 -0
  33. package/out/dev/test.f.mjs +58 -0
  34. package/out/dev/test.mjs +52 -0
  35. package/out/djs/module.f.mjs +75 -0
  36. package/out/djs/parser/module.f.mjs +432 -0
  37. package/out/djs/parser/test.f.mjs +535 -0
  38. package/out/djs/test.f.mjs +84 -0
  39. package/out/djs/tokenizer/module.f.mjs +87 -0
  40. package/out/djs/tokenizer/test.f.mjs +480 -0
  41. package/out/fsc/module.f.mjs +105 -0
  42. package/out/fsc/test.f.mjs +19 -0
  43. package/out/fsm/module.f.mjs +80 -0
  44. package/out/fsm/test.f.mjs +138 -0
  45. package/out/html/module.f.mjs +94 -0
  46. package/out/html/test.f.mjs +45 -0
  47. package/out/issues/test.f.mjs +66 -0
  48. package/out/js/tokenizer/module.f.mjs +686 -0
  49. package/out/js/tokenizer/test.f.mjs +844 -0
  50. package/out/json/module.f.mjs +89 -0
  51. package/out/json/parser/module.f.mjs +224 -0
  52. package/out/json/parser/test.f.mjs +321 -0
  53. package/out/json/serializer/module.f.mjs +67 -0
  54. package/out/json/serializer/test.f.mjs +87 -0
  55. package/out/json/test.f.mjs +61 -0
  56. package/out/json/tokenizer/module.f.mjs +78 -0
  57. package/out/json/tokenizer/test.f.mjs +420 -0
  58. package/out/nanvm-lib/tests/test.f.mjs +87 -0
  59. package/out/nodejs/version/main.mjs +3 -0
  60. package/out/nodejs/version/module.f.mjs +34 -0
  61. package/out/nodejs/version/test.f.mjs +97 -0
  62. package/out/prime_field/module.f.mjs +87 -0
  63. package/out/prime_field/test.f.mjs +145 -0
  64. package/out/secp/module.f.mjs +113 -0
  65. package/out/secp/test.f.mjs +63 -0
  66. package/out/sha2/module.f.mjs +172 -0
  67. package/out/sha2/test.f.mjs +86 -0
  68. package/out/text/ascii/module.f.mjs +154 -0
  69. package/out/text/ascii/test.f.mjs +14 -0
  70. package/out/text/module.f.mjs +19 -0
  71. package/out/text/sgr/module.f.mjs +17 -0
  72. package/out/text/test.f.mjs +19 -0
  73. package/out/text/utf16/module.f.mjs +86 -0
  74. package/out/text/utf16/test.f.mjs +145 -0
  75. package/out/text/utf8/module.f.mjs +126 -0
  76. package/out/text/utf8/test.f.mjs +175 -0
  77. package/out/types/array/module.f.mjs +95 -0
  78. package/out/types/array/test.f.mjs +116 -0
  79. package/out/types/bigfloat/module.f.mjs +77 -0
  80. package/out/types/bigfloat/test.f.mjs +349 -0
  81. package/out/types/bigint/module.f.mjs +114 -0
  82. package/out/types/bigint/test.f.mjs +192 -0
  83. package/out/types/btree/find/module.f.mjs +137 -0
  84. package/out/types/btree/find/test.f.mjs +156 -0
  85. package/out/types/btree/module.f.mjs +34 -0
  86. package/out/types/btree/remove/module.f.mjs +209 -0
  87. package/out/types/btree/remove/test.f.mjs +638 -0
  88. package/out/types/btree/set/module.f.mjs +114 -0
  89. package/out/types/btree/set/test.f.mjs +390 -0
  90. package/out/types/btree/test.f.mjs +83 -0
  91. package/out/types/btree/types/module.f.mjs +50 -0
  92. package/out/types/byte_set/module.f.mjs +42 -0
  93. package/out/types/byte_set/test.f.mjs +123 -0
  94. package/out/types/function/compare/module.f.mjs +22 -0
  95. package/out/types/function/compare/test.f.mjs +8 -0
  96. package/out/types/function/module.f.mjs +44 -0
  97. package/out/types/function/operator/module.f.mjs +60 -0
  98. package/out/types/function/test.f.mjs +15 -0
  99. package/out/types/list/module.f.mjs +269 -0
  100. package/out/types/list/test.f.mjs +401 -0
  101. package/out/types/map/module.f.mjs +54 -0
  102. package/out/types/map/test.f.mjs +115 -0
  103. package/out/types/nibble_set/module.f.mjs +19 -0
  104. package/out/types/nibble_set/test.f.mjs +90 -0
  105. package/out/types/nullable/module.f.mjs +9 -0
  106. package/out/types/nullable/test.f.mjs +12 -0
  107. package/out/types/number/module.f.mjs +12 -0
  108. package/out/types/number/test.f.mjs +126 -0
  109. package/out/types/object/module.f.mjs +27 -0
  110. package/out/types/object/test.f.mjs +17 -0
  111. package/out/types/range/module.f.mjs +6 -0
  112. package/out/types/range/test.f.mjs +18 -0
  113. package/out/types/range_map/module.f.mjs +84 -0
  114. package/out/types/range_map/test.f.mjs +201 -0
  115. package/out/types/result/module.f.mjs +25 -0
  116. package/out/types/result/module.mjs +16 -0
  117. package/out/types/sorted_list/module.f.mjs +102 -0
  118. package/out/types/sorted_list/test.f.mjs +66 -0
  119. package/out/types/sorted_set/module.f.mjs +29 -0
  120. package/out/types/sorted_set/test.f.mjs +80 -0
  121. package/out/types/string/module.f.mjs +17 -0
  122. package/out/types/string/test.f.mjs +58 -0
  123. package/out/types/string_set/module.f.mjs +29 -0
  124. package/out/types/string_set/test.f.mjs +65 -0
  125. package/package.json +5 -4
  126. package/tsconfig.json +2 -2
  127. /package/{com → out/com}/cpp/module.f.d.mts +0 -0
  128. /package/{com → out/com}/cpp/test.f.d.mts +0 -0
  129. /package/{com → out/com}/cpp/testlib.f.d.mts +0 -0
  130. /package/{com → out/com}/cs/module.f.d.mts +0 -0
  131. /package/{com → out/com}/cs/test.f.d.mts +0 -0
  132. /package/{com → out/com}/cs/testlib.f.d.mts +0 -0
  133. /package/{com → out/com}/rust/module.f.d.mts +0 -0
  134. /package/{com → out/com}/rust/test.f.d.mts +0 -0
  135. /package/{com → out/com}/rust/testlib.f.d.mts +0 -0
  136. /package/{com → out/com}/test/build.d.mts +0 -0
  137. /package/{com → out/com}/test/build.f.d.mts +0 -0
  138. /package/{com → out/com}/types/module.f.d.mts +0 -0
  139. /package/{com → out/com}/types/testlib.f.d.mts +0 -0
  140. /package/{commonjs → out/commonjs}/build/module.f.d.mts +0 -0
  141. /package/{commonjs → out/commonjs}/build/test.f.d.mts +0 -0
  142. /package/{commonjs → out/commonjs}/module/function/module.f.d.mts +0 -0
  143. /package/{commonjs → out/commonjs}/module/module.f.d.mts +0 -0
  144. /package/{commonjs → out/commonjs}/module.d.mts +0 -0
  145. /package/{commonjs → out/commonjs}/module.f.d.mts +0 -0
  146. /package/{commonjs → out/commonjs}/package/dependencies/module.f.d.mts +0 -0
  147. /package/{commonjs → out/commonjs}/package/dependencies/test.f.d.mts +0 -0
  148. /package/{commonjs → out/commonjs}/package/module.f.d.mts +0 -0
  149. /package/{commonjs → out/commonjs}/package/test.f.d.mts +0 -0
  150. /package/{commonjs → out/commonjs}/path/module.f.d.mts +0 -0
  151. /package/{commonjs → out/commonjs}/path/test.f.d.mts +0 -0
  152. /package/{commonjs → out/commonjs}/test.d.mts +0 -0
  153. /package/{dev → out/dev}/index.d.mts +0 -0
  154. /package/{dev → out/dev}/module.d.mts +0 -0
  155. /package/{dev → out/dev}/module.f.d.mts +0 -0
  156. /package/{dev → out/dev}/test/module.f.d.mts +0 -0
  157. /package/{dev → out/dev}/test.d.mts +0 -0
  158. /package/{dev → out/dev}/test.f.d.mts +0 -0
  159. /package/{djs → out/djs}/module.f.d.mts +0 -0
  160. /package/{djs → out/djs}/parser/module.f.d.mts +0 -0
  161. /package/{djs → out/djs}/parser/test.f.d.mts +0 -0
  162. /package/{djs → out/djs}/test.f.d.mts +0 -0
  163. /package/{djs → out/djs}/tokenizer/module.f.d.mts +0 -0
  164. /package/{djs → out/djs}/tokenizer/test.f.d.mts +0 -0
  165. /package/{fsc → out/fsc}/module.f.d.mts +0 -0
  166. /package/{fsc → out/fsc}/test.f.d.mts +0 -0
  167. /package/{fsm → out/fsm}/module.f.d.mts +0 -0
  168. /package/{fsm → out/fsm}/test.f.d.mts +0 -0
  169. /package/{html → out/html}/module.f.d.mts +0 -0
  170. /package/{html → out/html}/test.f.d.mts +0 -0
  171. /package/{issues → out/issues}/test.f.d.mts +0 -0
  172. /package/{js → out/js}/tokenizer/module.f.d.mts +0 -0
  173. /package/{js → out/js}/tokenizer/test.f.d.mts +0 -0
  174. /package/{json → out/json}/module.f.d.mts +0 -0
  175. /package/{json → out/json}/parser/module.f.d.mts +0 -0
  176. /package/{json → out/json}/parser/test.f.d.mts +0 -0
  177. /package/{json → out/json}/serializer/module.f.d.mts +0 -0
  178. /package/{json → out/json}/serializer/test.f.d.mts +0 -0
  179. /package/{json → out/json}/test.f.d.mts +0 -0
  180. /package/{json → out/json}/tokenizer/module.f.d.mts +0 -0
  181. /package/{json → out/json}/tokenizer/test.f.d.mts +0 -0
  182. /package/{nanvm-lib → out/nanvm-lib}/tests/test.f.d.mts +0 -0
  183. /package/{nodejs → out/nodejs}/version/main.d.mts +0 -0
  184. /package/{nodejs → out/nodejs}/version/module.f.d.mts +0 -0
  185. /package/{nodejs → out/nodejs}/version/test.f.d.mts +0 -0
  186. /package/{prime_field → out/prime_field}/module.f.d.mts +0 -0
  187. /package/{prime_field → out/prime_field}/test.f.d.mts +0 -0
  188. /package/{secp → out/secp}/module.f.d.mts +0 -0
  189. /package/{secp → out/secp}/test.f.d.mts +0 -0
  190. /package/{sha2 → out/sha2}/module.f.d.mts +0 -0
  191. /package/{sha2 → out/sha2}/test.f.d.mts +0 -0
  192. /package/{text → out/text}/ascii/module.f.d.mts +0 -0
  193. /package/{text → out/text}/ascii/test.f.d.mts +0 -0
  194. /package/{text → out/text}/module.f.d.mts +0 -0
  195. /package/{text → out/text}/sgr/module.f.d.mts +0 -0
  196. /package/{text → out/text}/test.f.d.mts +0 -0
  197. /package/{text → out/text}/utf16/module.f.d.mts +0 -0
  198. /package/{text → out/text}/utf16/test.f.d.mts +0 -0
  199. /package/{text → out/text}/utf8/module.f.d.mts +0 -0
  200. /package/{text → out/text}/utf8/test.f.d.mts +0 -0
  201. /package/{types → out/types}/array/module.f.d.mts +0 -0
  202. /package/{types → out/types}/array/test.f.d.mts +0 -0
  203. /package/{types → out/types}/bigfloat/module.f.d.mts +0 -0
  204. /package/{types → out/types}/bigfloat/test.f.d.mts +0 -0
  205. /package/{types → out/types}/bigint/module.f.d.mts +0 -0
  206. /package/{types → out/types}/bigint/test.f.d.mts +0 -0
  207. /package/{types → out/types}/btree/find/module.f.d.mts +0 -0
  208. /package/{types → out/types}/btree/find/test.f.d.mts +0 -0
  209. /package/{types → out/types}/btree/module.f.d.mts +0 -0
  210. /package/{types → out/types}/btree/remove/module.f.d.mts +0 -0
  211. /package/{types → out/types}/btree/remove/test.f.d.mts +0 -0
  212. /package/{types → out/types}/btree/set/module.f.d.mts +0 -0
  213. /package/{types → out/types}/btree/set/test.f.d.mts +0 -0
  214. /package/{types → out/types}/btree/test.f.d.mts +0 -0
  215. /package/{types → out/types}/btree/types/module.f.d.mts +0 -0
  216. /package/{types → out/types}/byte_set/module.f.d.mts +0 -0
  217. /package/{types → out/types}/byte_set/test.f.d.mts +0 -0
  218. /package/{types → out/types}/function/compare/module.f.d.mts +0 -0
  219. /package/{types → out/types}/function/compare/test.f.d.mts +0 -0
  220. /package/{types → out/types}/function/module.f.d.mts +0 -0
  221. /package/{types → out/types}/function/operator/module.f.d.mts +0 -0
  222. /package/{types → out/types}/function/test.f.d.mts +0 -0
  223. /package/{types → out/types}/list/module.f.d.mts +0 -0
  224. /package/{types → out/types}/list/test.f.d.mts +0 -0
  225. /package/{types → out/types}/map/module.f.d.mts +0 -0
  226. /package/{types → out/types}/map/test.f.d.mts +0 -0
  227. /package/{types → out/types}/nibble_set/module.f.d.mts +0 -0
  228. /package/{types → out/types}/nibble_set/test.f.d.mts +0 -0
  229. /package/{types → out/types}/nullable/module.f.d.mts +0 -0
  230. /package/{types → out/types}/nullable/test.f.d.mts +0 -0
  231. /package/{types → out/types}/number/module.f.d.mts +0 -0
  232. /package/{types → out/types}/number/test.f.d.mts +0 -0
  233. /package/{types → out/types}/object/module.f.d.mts +0 -0
  234. /package/{types → out/types}/object/test.f.d.mts +0 -0
  235. /package/{types → out/types}/range/module.f.d.mts +0 -0
  236. /package/{types → out/types}/range/test.f.d.mts +0 -0
  237. /package/{types → out/types}/range_map/module.f.d.mts +0 -0
  238. /package/{types → out/types}/range_map/test.f.d.mts +0 -0
  239. /package/{types → out/types}/result/module.d.mts +0 -0
  240. /package/{types → out/types}/result/module.f.d.mts +0 -0
  241. /package/{types → out/types}/sorted_list/module.f.d.mts +0 -0
  242. /package/{types → out/types}/sorted_list/test.f.d.mts +0 -0
  243. /package/{types → out/types}/sorted_set/module.f.d.mts +0 -0
  244. /package/{types → out/types}/sorted_set/test.f.d.mts +0 -0
  245. /package/{types → out/types}/string/module.f.d.mts +0 -0
  246. /package/{types → out/types}/string/test.f.d.mts +0 -0
  247. /package/{types → out/types}/string_set/module.f.d.mts +0 -0
  248. /package/{types → out/types}/string_set/test.f.d.mts +0 -0
package/dev/module.mjs CHANGED
@@ -183,7 +183,7 @@ export const index = async () => {
183
183
  const n = '/module.f.mjs'
184
184
  const jsr_json = JSON.parse(await readFile(jj, { encoding: 'utf8' }))
185
185
  const list = Object.keys(await loadModuleMap()).filter(v => v.endsWith(n))
186
- const exportsA = list.map(v => [v.replace(n, ''), v])
186
+ const exportsA = list.filter(v => !v.startsWith('./out')).map(v => [v.replace(n, ''), `./out/${v.substring(2)}`])
187
187
  const exports = Object.fromEntries(exportsA)
188
188
  await writeFile(
189
189
  jj,
package/jsr.json CHANGED
@@ -1,64 +1,64 @@
1
1
  {
2
2
  "name": "@functionalscript/functionalscript",
3
- "version": "0.2.0",
3
+ "version": "0.2.2",
4
4
  "exports": {
5
- "./com/cpp": "./com/cpp/module.f.mjs",
6
- "./com/cs": "./com/cs/module.f.mjs",
7
- "./com/rust": "./com/rust/module.f.mjs",
8
- "./com/types": "./com/types/module.f.mjs",
9
- "./commonjs/build": "./commonjs/build/module.f.mjs",
10
- "./commonjs": "./commonjs/module.f.mjs",
11
- "./commonjs/module/function": "./commonjs/module/function/module.f.mjs",
12
- "./commonjs/module": "./commonjs/module/module.f.mjs",
13
- "./commonjs/package/dependencies": "./commonjs/package/dependencies/module.f.mjs",
14
- "./commonjs/package": "./commonjs/package/module.f.mjs",
15
- "./commonjs/path": "./commonjs/path/module.f.mjs",
16
- "./dev": "./dev/module.f.mjs",
17
- "./dev/test": "./dev/test/module.f.mjs",
18
- "./djs": "./djs/module.f.mjs",
19
- "./djs/parser": "./djs/parser/module.f.mjs",
20
- "./djs/tokenizer": "./djs/tokenizer/module.f.mjs",
21
- "./fsc": "./fsc/module.f.mjs",
22
- "./fsm": "./fsm/module.f.mjs",
23
- "./html": "./html/module.f.mjs",
24
- "./js/tokenizer": "./js/tokenizer/module.f.mjs",
25
- "./json": "./json/module.f.mjs",
26
- "./json/parser": "./json/parser/module.f.mjs",
27
- "./json/serializer": "./json/serializer/module.f.mjs",
28
- "./json/tokenizer": "./json/tokenizer/module.f.mjs",
29
- "./nodejs/version": "./nodejs/version/module.f.mjs",
30
- "./prime_field": "./prime_field/module.f.mjs",
31
- "./secp": "./secp/module.f.mjs",
32
- "./sha2": "./sha2/module.f.mjs",
33
- "./text/ascii": "./text/ascii/module.f.mjs",
34
- "./text": "./text/module.f.mjs",
35
- "./text/sgr": "./text/sgr/module.f.mjs",
36
- "./text/utf16": "./text/utf16/module.f.mjs",
37
- "./text/utf8": "./text/utf8/module.f.mjs",
38
- "./types/array": "./types/array/module.f.mjs",
39
- "./types/bigfloat": "./types/bigfloat/module.f.mjs",
40
- "./types/bigint": "./types/bigint/module.f.mjs",
41
- "./types/btree/find": "./types/btree/find/module.f.mjs",
42
- "./types/btree": "./types/btree/module.f.mjs",
43
- "./types/btree/remove": "./types/btree/remove/module.f.mjs",
44
- "./types/btree/set": "./types/btree/set/module.f.mjs",
45
- "./types/btree/types": "./types/btree/types/module.f.mjs",
46
- "./types/byte_set": "./types/byte_set/module.f.mjs",
47
- "./types/function/compare": "./types/function/compare/module.f.mjs",
48
- "./types/function": "./types/function/module.f.mjs",
49
- "./types/function/operator": "./types/function/operator/module.f.mjs",
50
- "./types/list": "./types/list/module.f.mjs",
51
- "./types/map": "./types/map/module.f.mjs",
52
- "./types/nibble_set": "./types/nibble_set/module.f.mjs",
53
- "./types/nullable": "./types/nullable/module.f.mjs",
54
- "./types/number": "./types/number/module.f.mjs",
55
- "./types/object": "./types/object/module.f.mjs",
56
- "./types/range": "./types/range/module.f.mjs",
57
- "./types/range_map": "./types/range_map/module.f.mjs",
58
- "./types/result": "./types/result/module.f.mjs",
59
- "./types/sorted_list": "./types/sorted_list/module.f.mjs",
60
- "./types/sorted_set": "./types/sorted_set/module.f.mjs",
61
- "./types/string": "./types/string/module.f.mjs",
62
- "./types/string_set": "./types/string_set/module.f.mjs"
5
+ "./com/cpp": "./out/com/cpp/module.f.mjs",
6
+ "./com/cs": "./out/com/cs/module.f.mjs",
7
+ "./com/rust": "./out/com/rust/module.f.mjs",
8
+ "./com/types": "./out/com/types/module.f.mjs",
9
+ "./commonjs/build": "./out/commonjs/build/module.f.mjs",
10
+ "./commonjs": "./out/commonjs/module.f.mjs",
11
+ "./commonjs/module/function": "./out/commonjs/module/function/module.f.mjs",
12
+ "./commonjs/module": "./out/commonjs/module/module.f.mjs",
13
+ "./commonjs/package/dependencies": "./out/commonjs/package/dependencies/module.f.mjs",
14
+ "./commonjs/package": "./out/commonjs/package/module.f.mjs",
15
+ "./commonjs/path": "./out/commonjs/path/module.f.mjs",
16
+ "./dev": "./out/dev/module.f.mjs",
17
+ "./dev/test": "./out/dev/test/module.f.mjs",
18
+ "./djs": "./out/djs/module.f.mjs",
19
+ "./djs/parser": "./out/djs/parser/module.f.mjs",
20
+ "./djs/tokenizer": "./out/djs/tokenizer/module.f.mjs",
21
+ "./fsc": "./out/fsc/module.f.mjs",
22
+ "./fsm": "./out/fsm/module.f.mjs",
23
+ "./html": "./out/html/module.f.mjs",
24
+ "./js/tokenizer": "./out/js/tokenizer/module.f.mjs",
25
+ "./json": "./out/json/module.f.mjs",
26
+ "./json/parser": "./out/json/parser/module.f.mjs",
27
+ "./json/serializer": "./out/json/serializer/module.f.mjs",
28
+ "./json/tokenizer": "./out/json/tokenizer/module.f.mjs",
29
+ "./nodejs/version": "./out/nodejs/version/module.f.mjs",
30
+ "./prime_field": "./out/prime_field/module.f.mjs",
31
+ "./secp": "./out/secp/module.f.mjs",
32
+ "./sha2": "./out/sha2/module.f.mjs",
33
+ "./text/ascii": "./out/text/ascii/module.f.mjs",
34
+ "./text": "./out/text/module.f.mjs",
35
+ "./text/sgr": "./out/text/sgr/module.f.mjs",
36
+ "./text/utf16": "./out/text/utf16/module.f.mjs",
37
+ "./text/utf8": "./out/text/utf8/module.f.mjs",
38
+ "./types/array": "./out/types/array/module.f.mjs",
39
+ "./types/bigfloat": "./out/types/bigfloat/module.f.mjs",
40
+ "./types/bigint": "./out/types/bigint/module.f.mjs",
41
+ "./types/btree/find": "./out/types/btree/find/module.f.mjs",
42
+ "./types/btree": "./out/types/btree/module.f.mjs",
43
+ "./types/btree/remove": "./out/types/btree/remove/module.f.mjs",
44
+ "./types/btree/set": "./out/types/btree/set/module.f.mjs",
45
+ "./types/btree/types": "./out/types/btree/types/module.f.mjs",
46
+ "./types/byte_set": "./out/types/byte_set/module.f.mjs",
47
+ "./types/function/compare": "./out/types/function/compare/module.f.mjs",
48
+ "./types/function": "./out/types/function/module.f.mjs",
49
+ "./types/function/operator": "./out/types/function/operator/module.f.mjs",
50
+ "./types/list": "./out/types/list/module.f.mjs",
51
+ "./types/map": "./out/types/map/module.f.mjs",
52
+ "./types/nibble_set": "./out/types/nibble_set/module.f.mjs",
53
+ "./types/nullable": "./out/types/nullable/module.f.mjs",
54
+ "./types/number": "./out/types/number/module.f.mjs",
55
+ "./types/object": "./out/types/object/module.f.mjs",
56
+ "./types/range": "./out/types/range/module.f.mjs",
57
+ "./types/range_map": "./out/types/range_map/module.f.mjs",
58
+ "./types/result": "./out/types/result/module.f.mjs",
59
+ "./types/sorted_list": "./out/types/sorted_list/module.f.mjs",
60
+ "./types/sorted_set": "./out/types/sorted_set/module.f.mjs",
61
+ "./types/string": "./out/types/string/module.f.mjs",
62
+ "./types/string_set": "./out/types/string_set/module.f.mjs"
63
63
  }
64
64
  }
@@ -0,0 +1,123 @@
1
+ // @ts-self-types="./module.f.d.mts"
2
+ import * as types from '../types/module.f.mjs';
3
+ import * as text from '../../text/module.f.mjs';
4
+ import * as O from '../../types/object/module.f.mjs';
5
+ import * as list from '../../types/list/module.f.mjs';
6
+ import * as string from '../../types/string/module.f.mjs';
7
+ const { join } = string;
8
+ const { paramList } = types;
9
+ const { map, flatMap, flat } = list;
10
+ const { entries } = Object;
11
+ /** @type {(name: string) => (body: text.Block) => text.Block} */
12
+ const struct = name => body => [`struct ${name}`, '{', body, '};'];
13
+ const baseTypeMap = {
14
+ u8: 'uint8_t',
15
+ i8: 'int8_t',
16
+ u16: 'uint16_t',
17
+ i16: 'int16_t',
18
+ u32: 'uint32_t',
19
+ i32: 'int32_t',
20
+ u64: 'uint64_t',
21
+ i64: 'int64_t',
22
+ usize: 'size_t',
23
+ isize: 'ptrdiff_t',
24
+ f32: 'float',
25
+ f64: 'double',
26
+ bool: 'bool',
27
+ };
28
+ /** @type {(t: types.BaseType) => string} */
29
+ const baseType = t => baseTypeMap[t];
30
+ const resultVoid = types.result('void');
31
+ const namespace = text.curly('namespace');
32
+ /** @type {(id: string) => string} */
33
+ const comRef = id => `::nanocom::ref<${id}>`;
34
+ /** @type {(id: string) => string} */
35
+ const ptr = id => `${id} const*`;
36
+ /** @type {(id: string) => string} */
37
+ const ref = id => `${id} const&`;
38
+ /** @type {(p: types.Field) => string} */
39
+ const paramName = ([name]) => name;
40
+ const mapParamName = map(paramName);
41
+ const joinComma = join(', ');
42
+ /** @type {(name: string) => (lib: types.Library) => text.Block} */
43
+ export const cpp = name => lib => {
44
+ /** @type {(t: types.Type) => string|null} */
45
+ const interface_ = t => {
46
+ if (!(t instanceof Array) || t.length !== 1) {
47
+ return null;
48
+ }
49
+ const [name] = t;
50
+ return 'interface' in lib[name] ? name : null;
51
+ };
52
+ /** @type {(i: (t: string) => string) => (t: types.Type) => string} */
53
+ const objectType = i => t => {
54
+ if (typeof (t) === 'string') {
55
+ return baseType(t);
56
+ }
57
+ if (t.length === 2) {
58
+ return `${type(t[1])} const*`;
59
+ }
60
+ const [id] = t;
61
+ return 'interface' in lib[id] ? i(id) : id;
62
+ };
63
+ const type = objectType(comRef);
64
+ const resultType = objectType(ptr);
65
+ /** @type {(s: types.Field) => text.Item} */
66
+ const field = ([name, t]) => `${type(t)} ${name};`;
67
+ const mapField = map(field);
68
+ /** @type {(s: types.Struct) => text.Block} */
69
+ const defStruct = s => mapField(entries(s.struct));
70
+ /** @type {(fa: types.FieldArray) => string} */
71
+ const cppResult = resultVoid(resultType);
72
+ /** @type {(p: types.Field) => string} */
73
+ const param = ([name, t]) => `${objectType(ref)(t)} ${name}`;
74
+ const mapParam = map(param);
75
+ /** @type {(result: string) => (paramArrayStr: string) => (name: string) => text.Item} */
76
+ const methodHeader = result => paramArrayStr => name => `virtual ${result} ${name}${paramArrayStr} const noexcept = 0;`;
77
+ /** @type {(m: types.Method) => readonly text.Item[]} */
78
+ const method = ([name, paramArray]) => {
79
+ const result = cppResult(paramArray);
80
+ const paramL = paramList(paramArray);
81
+ const paramArrayStr = `(${joinComma(mapParam(paramL))})`;
82
+ const m = methodHeader(result)(paramArrayStr);
83
+ const resultName = interface_(paramArray._);
84
+ if (resultName === null) {
85
+ return [m(name)];
86
+ }
87
+ return [
88
+ m(`${name}_`),
89
+ `${comRef(resultName)} ${name}${paramArrayStr} const noexcept`,
90
+ '{',
91
+ [`return ::nanocom::move_to_ref(${name}_(${joinComma(mapParamName(paramL))}));`],
92
+ '}',
93
+ ];
94
+ };
95
+ const mapMethod = flatMap(method);
96
+ /** @type {(i: types.Interface) => text.Block} */
97
+ const defInterface = ({ guid, interface: i }) => {
98
+ const g = guid.replaceAll('-', '');
99
+ const lo = g.substring(0, 16);
100
+ const hi = g.substring(16);
101
+ return flat([
102
+ [`constexpr static ::nanocom::GUID const guid = ::nanocom::GUID(0x${lo}, 0x${hi});`],
103
+ mapMethod(entries(i))
104
+ ]);
105
+ };
106
+ /** @type {(kv: O.Entry<types.Definition>) => text.Block} */
107
+ const def = ([name, d]) => 'interface' in d
108
+ ? [
109
+ `class ${name} : public ::nanocom::IUnknown`,
110
+ '{',
111
+ 'public:',
112
+ defInterface(d),
113
+ '};'
114
+ ]
115
+ : struct(name)(defStruct(d));
116
+ /** @type {(kv: O.Entry<types.Definition>) => text.Block} */
117
+ const forward = ([name]) => [`struct ${name};`];
118
+ const e = entries(lib);
119
+ return flat([
120
+ ['#pragma once', ''],
121
+ namespace(name)(flat([flatMap(forward)(e), flatMap(def)(e)]))
122
+ ]);
123
+ };
@@ -0,0 +1,40 @@
1
+ import cpp from './testlib.f.mjs';
2
+ const f = () => {
3
+ const e = '#pragma once\n' +
4
+ '\n' +
5
+ 'namespace My\n' +
6
+ '{\n' +
7
+ ' struct Slice;\n' +
8
+ ' struct ManagedStruct;\n' +
9
+ ' struct IMy;\n' +
10
+ ' struct Slice\n' +
11
+ ' {\n' +
12
+ ' uint8_t const* Start;\n' +
13
+ ' size_t Size;\n' +
14
+ ' };\n' +
15
+ ' struct ManagedStruct\n' +
16
+ ' {\n' +
17
+ ' ::nanocom::ref<IMy> M;\n' +
18
+ ' };\n' +
19
+ ' class IMy : public ::nanocom::IUnknown\n' +
20
+ ' {\n' +
21
+ ' public:\n' +
22
+ ' constexpr static ::nanocom::GUID const guid = ::nanocom::GUID(0xC66FB2702D8049AD, 0xBB6E88C1F90B805D);\n' +
23
+ ' virtual Slice GetSlice() const noexcept = 0;\n' +
24
+ ' virtual void SetSlice(Slice slice) const noexcept = 0;\n' +
25
+ ' virtual bool const* GetUnsafe() const noexcept = 0;\n' +
26
+ ' virtual void SetUnsafe(Slice const* p, uint32_t size) const noexcept = 0;\n' +
27
+ ' virtual bool Some(IMy const& p) const noexcept = 0;\n' +
28
+ ' virtual IMy const* GetIMy_(uint16_t a, int16_t b) const noexcept = 0;\n' +
29
+ ' ::nanocom::ref<IMy> GetIMy(uint16_t a, int16_t b) const noexcept\n' +
30
+ ' {\n' +
31
+ ' return ::nanocom::move_to_ref(GetIMy_(a, b));\n' +
32
+ ' }\n' +
33
+ ' virtual void SetManagedStruct(ManagedStruct a) const noexcept = 0;\n' +
34
+ ' };\n' +
35
+ '}';
36
+ if (cpp() !== e) {
37
+ throw cpp;
38
+ }
39
+ };
40
+ export default f;
@@ -0,0 +1,7 @@
1
+ import * as string from '../../types/string/module.f.mjs';
2
+ const { join } = string;
3
+ import * as text from '../../text/module.f.mjs';
4
+ const { flat } = text;
5
+ import library from '../types/testlib.f.mjs';
6
+ import { cpp } from './module.f.mjs';
7
+ export default () => join('\n')(flat(' ')(cpp('My')(library)));
@@ -0,0 +1,95 @@
1
+ // @ts-self-types="./module.f.d.mts"
2
+ import * as types from '../types/module.f.mjs';
3
+ const { result, paramList } = types;
4
+ import * as text from '../../text/module.f.mjs';
5
+ const { curly } = text;
6
+ import * as list from '../../types/list/module.f.mjs';
7
+ const { flat, map, some, flatMap } = list;
8
+ import * as string from '../../types/string/module.f.mjs';
9
+ const { join } = string;
10
+ import * as O from '../../types/object/module.f.mjs';
11
+ const { entries } = Object;
12
+ /** @type {(v: string) => string} */
13
+ const using = v => `using ${v};`;
14
+ /**
15
+ * @type {(attributes: list.List<string>) =>
16
+ * (type: string) =>
17
+ * (name: string) =>
18
+ * (body: text.Block) =>
19
+ * list.List<text.Item>}
20
+ */
21
+ const typeDef = attributes => type => name => body => flat([
22
+ map(v => `[${v}]`)(attributes),
23
+ curly(`public ${type}`)(name)(body)
24
+ ]);
25
+ const baseTypeMap = {
26
+ bool: 'byte',
27
+ f32: 'float',
28
+ f64: 'double',
29
+ i16: 'short',
30
+ i32: 'int',
31
+ i64: 'long',
32
+ i8: 'sbyte',
33
+ isize: 'IntPtr',
34
+ u16: 'ushort',
35
+ u32: 'uint',
36
+ u64: 'ulong',
37
+ u8: 'byte',
38
+ usize: 'UIntPtr',
39
+ };
40
+ /** @type {(t: types.BaseType) => string} */
41
+ const baseType = t => baseTypeMap[t];
42
+ /** @type {(isUnsafe: boolean) => string} */
43
+ const unsafe = isUnsafe => isUnsafe ? 'unsafe ' : '';
44
+ /** @type {(t: types.Type) => readonly[boolean, string]} */
45
+ const fullType = t => typeof (t) === 'string' ? [false, baseType(t)] :
46
+ t.length === 1 ? [false, t[0]] :
47
+ [true, `${type(t[1])}*`];
48
+ /** @type {(m: types.Type) => string} */
49
+ const type = t => fullType(t)[1];
50
+ /** @type {(f: types.Field) => string} */
51
+ const param = ([name, t]) => `${type(t)} ${name}`;
52
+ const mapParam = map(param);
53
+ /** @type {(f: types.Field) => string} */
54
+ const field = ([name, comType]) => {
55
+ const [isUnsafe, t] = fullType(comType);
56
+ return `public ${unsafe(isUnsafe)}${t} ${name};`;
57
+ };
58
+ /** @type {(field: types.Field) => boolean} */
59
+ const isUnsafeField = field => fullType(field[1])[0];
60
+ const mapIsUnsafeField = map(isUnsafeField);
61
+ const resultVoid = result('void');
62
+ const joinComma = join(', ');
63
+ /** @type {(e: O.Entry<types.FieldArray>) => readonly string[]} */
64
+ const method = ([name, m]) => {
65
+ const paramAndResultList = entries(m);
66
+ const pl = paramList(m);
67
+ const isUnsafe = some(mapIsUnsafeField(paramAndResultList));
68
+ return [
69
+ '[PreserveSig]',
70
+ `${unsafe(isUnsafe)}${resultVoid(type)(m)} ${name}(${joinComma(mapParam(pl))});`
71
+ ];
72
+ };
73
+ const struct = typeDef(['StructLayout(LayoutKind.Sequential)'])('struct');
74
+ const mapField = map(field);
75
+ const flatMapMethod = flatMap(method);
76
+ /** @type {(e: O.Entry<types.Definition>) => list.List<text.Item>} */
77
+ const def = ([n, d]) => {
78
+ return !('interface' in d) ?
79
+ struct(n)(mapField(entries(d.struct))) :
80
+ typeDef([`Guid("${d.guid}")`, 'InterfaceType(ComInterfaceType.InterfaceIsIUnknown)'])('interface')(n)(flatMapMethod(entries(d.interface)));
81
+ };
82
+ const flatMapDef = flatMap(def);
83
+ const namespace = curly('namespace');
84
+ /** @type {text.Block} */
85
+ const header = [
86
+ using('System'),
87
+ using('System.Runtime.InteropServices'),
88
+ ''
89
+ ];
90
+ /** @type {(name: string) => (library: types.Library) => text.Block} */
91
+ export const cs = name => library => {
92
+ const v = flatMapDef(entries(library));
93
+ const ns = namespace(name)(v);
94
+ return flat([header, ns]);
95
+ };
@@ -0,0 +1,43 @@
1
+ import cs from './testlib.f.mjs';
2
+ const f = () => {
3
+ const e = 'using System;\n' +
4
+ 'using System.Runtime.InteropServices;\n' +
5
+ '\n' +
6
+ 'namespace My\n' +
7
+ '{\n' +
8
+ ' [StructLayout(LayoutKind.Sequential)]\n' +
9
+ ' public struct Slice\n' +
10
+ ' {\n' +
11
+ ' public unsafe byte* Start;\n' +
12
+ ' public UIntPtr Size;\n' +
13
+ ' }\n' +
14
+ ' [StructLayout(LayoutKind.Sequential)]\n' +
15
+ ' public struct ManagedStruct\n' +
16
+ ' {\n' +
17
+ ' public IMy M;\n' +
18
+ ' }\n' +
19
+ ' [Guid("C66FB270-2D80-49AD-BB6E-88C1F90B805D")]\n' +
20
+ ' [InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]\n' +
21
+ ' public interface IMy\n' +
22
+ ' {\n' +
23
+ ' [PreserveSig]\n' +
24
+ ' Slice GetSlice();\n' +
25
+ ' [PreserveSig]\n' +
26
+ ' void SetSlice(Slice slice);\n' +
27
+ ' [PreserveSig]\n' +
28
+ ' unsafe byte* GetUnsafe();\n' +
29
+ ' [PreserveSig]\n' +
30
+ ' unsafe void SetUnsafe(Slice* p, uint size);\n' +
31
+ ' [PreserveSig]\n' +
32
+ ' byte Some(IMy p);\n' +
33
+ ' [PreserveSig]\n' +
34
+ ' IMy GetIMy(ushort a, short b);\n' +
35
+ ' [PreserveSig]\n' +
36
+ ' void SetManagedStruct(ManagedStruct a);\n' +
37
+ ' }\n' +
38
+ '}';
39
+ if (cs !== e) {
40
+ throw cs;
41
+ }
42
+ };
43
+ export default f;
@@ -0,0 +1,7 @@
1
+ import * as text from '../../text/module.f.mjs';
2
+ const { flat } = text;
3
+ import * as string from '../../types/string/module.f.mjs';
4
+ const { join } = string;
5
+ import { cs } from './module.f.mjs';
6
+ import library from '../types/testlib.f.mjs';
7
+ export default join('\n')(flat(' ')(cs('My')(library)));