mt-lang 0.2.0 → 0.2.1

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 (189) hide show
  1. checksums.yaml +4 -4
  2. data/docs/index.html +4 -3
  3. data/lib/milk_tea/base.rb +1 -1
  4. data/std/asset_pack.mt +267 -0
  5. data/std/async/libuv_runtime.mt +539 -0
  6. data/std/async/mailbox.mt +191 -0
  7. data/std/async/runtime.mt +87 -0
  8. data/std/async.mt +87 -0
  9. data/std/base64.mt +185 -0
  10. data/std/behavior_tree.mt +396 -0
  11. data/std/binary.mt +314 -0
  12. data/std/binary_heap.mt +157 -0
  13. data/std/bitset.mt +239 -0
  14. data/std/box2d.mt +535 -0
  15. data/std/bytes.mt +46 -0
  16. data/std/c/box2d.mt +1254 -0
  17. data/std/c/cgltf.mt +647 -0
  18. data/std/c/cjson.mt +106 -0
  19. data/std/c/crypto.mt +11 -0
  20. data/std/c/crypto_support.h +51 -0
  21. data/std/c/ctype.mt +19 -0
  22. data/std/c/ctype_bindgen.h +29 -0
  23. data/std/c/curl.mt +1223 -0
  24. data/std/c/enet.mt +473 -0
  25. data/std/c/errno.mt +41 -0
  26. data/std/c/errno_bindgen.h +53 -0
  27. data/std/c/flecs.mt +2945 -0
  28. data/std/c/fs.linux.mt +43 -0
  29. data/std/c/fs.windows.mt +43 -0
  30. data/std/c/fs_support.h +954 -0
  31. data/std/c/gl.mt +2065 -0
  32. data/std/c/gl_registry_helpers.h +10748 -0
  33. data/std/c/glfw.mt +499 -0
  34. data/std/c/libc.mt +167 -0
  35. data/std/c/libuv.mt +1491 -0
  36. data/std/c/math.mt +22 -0
  37. data/std/c/math_bindgen.h +31 -0
  38. data/std/c/miniaudio.mt +3420 -0
  39. data/std/c/pcre2.mt +735 -0
  40. data/std/c/process.mt +58 -0
  41. data/std/c/process_support.h +1147 -0
  42. data/std/c/raygui.mt +1602 -0
  43. data/std/c/raylib.mt +1245 -0
  44. data/std/c/raymath.mt +163 -0
  45. data/std/c/rlgl.mt +434 -0
  46. data/std/c/rpng.mt +60 -0
  47. data/std/c/rres.mt +187 -0
  48. data/std/c/sdl3.mt +4132 -0
  49. data/std/c/sqlite3.mt +951 -0
  50. data/std/c/stb_image.mt +52 -0
  51. data/std/c/stb_image_resize2.mt +128 -0
  52. data/std/c/stb_image_write.mt +19 -0
  53. data/std/c/stb_rect_pack.mt +38 -0
  54. data/std/c/stb_truetype.mt +175 -0
  55. data/std/c/stb_vorbis.mt +31 -0
  56. data/std/c/stdio.mt +90 -0
  57. data/std/c/steamworks.h +5769 -0
  58. data/std/c/steamworks.mt +4771 -0
  59. data/std/c/string.mt +16 -0
  60. data/std/c/string_bindgen.h +36 -0
  61. data/std/c/sync.mt +33 -0
  62. data/std/c/sync_support.h +219 -0
  63. data/std/c/terminal.mt +24 -0
  64. data/std/c/terminal_support.h +408 -0
  65. data/std/c/time.mt +26 -0
  66. data/std/c/tls.mt +24 -0
  67. data/std/c/tls_support.h +626 -0
  68. data/std/c/tracy.mt +53 -0
  69. data/std/c/zlib.mt +20 -0
  70. data/std/c/zlib_support.h +239 -0
  71. data/std/c/zstd.mt +231 -0
  72. data/std/cell.mt +60 -0
  73. data/std/cgltf.mt +115 -0
  74. data/std/cjson.mt +90 -0
  75. data/std/cli.mt +768 -0
  76. data/std/cookie.mt +198 -0
  77. data/std/counter.mt +160 -0
  78. data/std/crypto.mt +74 -0
  79. data/std/cstring.mt +13 -0
  80. data/std/ctype.mt +52 -0
  81. data/std/curl/runtime.mt +261 -0
  82. data/std/curl.mt +38 -0
  83. data/std/deque.mt +348 -0
  84. data/std/encoding.mt +93 -0
  85. data/std/enet.mt +133 -0
  86. data/std/env.mt +41 -0
  87. data/std/errno.mt +47 -0
  88. data/std/flecs.mt +978 -0
  89. data/std/fmt.mt +271 -0
  90. data/std/fs.linux.mt +696 -0
  91. data/std/fs.windows.mt +711 -0
  92. data/std/fsm.mt +267 -0
  93. data/std/gl.mt +2062 -0
  94. data/std/glfw.mt +471 -0
  95. data/std/goap.mt +342 -0
  96. data/std/graph.mt +521 -0
  97. data/std/gzip.mt +77 -0
  98. data/std/hash.mt +429 -0
  99. data/std/http/server.mt +810 -0
  100. data/std/http.mt +1227 -0
  101. data/std/intern.mt +53 -0
  102. data/std/jobs.mt +288 -0
  103. data/std/json.mt +627 -0
  104. data/std/libc.mt +34 -0
  105. data/std/libuv.mt +554 -0
  106. data/std/linear_algebra.mt +243 -0
  107. data/std/linked_map.mt +372 -0
  108. data/std/linked_map_view.mt +49 -0
  109. data/std/linked_set.mt +117 -0
  110. data/std/log.mt +69 -0
  111. data/std/map.mt +418 -0
  112. data/std/math.mt +24 -0
  113. data/std/mem/arena.mt +137 -0
  114. data/std/mem/endian.mt +51 -0
  115. data/std/mem/heap.mt +298 -0
  116. data/std/mem/pool.mt +164 -0
  117. data/std/mem/stack.mt +47 -0
  118. data/std/mem/tracking.mt +119 -0
  119. data/std/miniaudio.mt +1299 -0
  120. data/std/multiset.mt +191 -0
  121. data/std/net/channel.mt +727 -0
  122. data/std/net/clock.mt +237 -0
  123. data/std/net/discovery.mt +277 -0
  124. data/std/net/lobby.mt +813 -0
  125. data/std/net/manager.mt +539 -0
  126. data/std/net/mux.mt +839 -0
  127. data/std/net/nat.mt +122 -0
  128. data/std/net/packet.mt +219 -0
  129. data/std/net/punch.mt +162 -0
  130. data/std/net/rpc.mt +119 -0
  131. data/std/net/session.mt +1157 -0
  132. data/std/net/stun.mt +252 -0
  133. data/std/net/sync.mt +183 -0
  134. data/std/net/turn.mt +459 -0
  135. data/std/net.mt +2944 -0
  136. data/std/oauth2.mt +408 -0
  137. data/std/option.mt +51 -0
  138. data/std/ordered_map.mt +497 -0
  139. data/std/ordered_set.mt +348 -0
  140. data/std/path.mt +368 -0
  141. data/std/pcre2/runtime.mt +35 -0
  142. data/std/pcre2.mt +78 -0
  143. data/std/priority_queue.mt +55 -0
  144. data/std/process.mt +837 -0
  145. data/std/queue.mt +55 -0
  146. data/std/random.mt +146 -0
  147. data/std/raygui.mt +99 -0
  148. data/std/raylib/debug_console.mt +71 -0
  149. data/std/raylib/easing.mt +388 -0
  150. data/std/raylib/packed_assets.mt +255 -0
  151. data/std/raylib/runtime.mt +30 -0
  152. data/std/raylib/tracy_gpu.mt +37 -0
  153. data/std/raylib.mt +1510 -0
  154. data/std/raymath.mt +153 -0
  155. data/std/result.mt +89 -0
  156. data/std/rlgl.mt +268 -0
  157. data/std/rpng.mt +46 -0
  158. data/std/rres.mt +36 -0
  159. data/std/sdl3/runtime.mt +54 -0
  160. data/std/sdl3.mt +1731 -0
  161. data/std/serialize.mt +68 -0
  162. data/std/set.mt +124 -0
  163. data/std/spatial.mt +176 -0
  164. data/std/sqlite3.mt +151 -0
  165. data/std/stack.mt +55 -0
  166. data/std/stb_image.mt +47 -0
  167. data/std/stb_image_resize2.mt +41 -0
  168. data/std/stb_image_write.mt +17 -0
  169. data/std/stb_rect_pack.mt +15 -0
  170. data/std/stb_truetype.mt +77 -0
  171. data/std/stb_vorbis.mt +16 -0
  172. data/std/stdio.mt +88 -0
  173. data/std/steamworks.mt +1542 -0
  174. data/std/str.mt +293 -0
  175. data/std/string.mt +234 -0
  176. data/std/sync.mt +194 -0
  177. data/std/tar.mt +704 -0
  178. data/std/terminal.mt +1002 -0
  179. data/std/testing.mt +266 -0
  180. data/std/thread.mt +120 -0
  181. data/std/time.mt +105 -0
  182. data/std/tls.mt +616 -0
  183. data/std/toml.mt +1310 -0
  184. data/std/tracy.mt +42 -0
  185. data/std/uri.mt +118 -0
  186. data/std/url.mt +372 -0
  187. data/std/vec.mt +433 -0
  188. data/std/zstd.mt +94 -0
  189. metadata +187 -2
@@ -0,0 +1,35 @@
1
+ import std.pcre2 as re
2
+ import std.str as text
3
+
4
+ public struct CompileResult:
5
+ code: ptr[re.Code]?
6
+ error_code: int
7
+ error_offset: ptr_uint
8
+
9
+
10
+ public function compile_str(pattern: str, options: uint, compile_context: ptr[re.CompileContext]) -> CompileResult:
11
+ var error_code = 0
12
+ var error_offset: ptr_uint = 0
13
+ let code = re.compile_bytes(text.as_byte_span(pattern), options, error_code, error_offset, compile_context)
14
+ return CompileResult(code = code, error_code = error_code, error_offset = error_offset)
15
+
16
+
17
+ public function match_str(
18
+ code: const_ptr[re.Code],
19
+ subject: str,
20
+ start_offset: ptr_uint,
21
+ options: uint,
22
+ match_data: ptr[re.MatchData],
23
+ match_context: ptr[re.MatchContext]
24
+ ) -> int:
25
+ return re.match_bytes(code, text.as_byte_span(subject), start_offset, options, match_data, match_context)
26
+
27
+
28
+ public function error_message_as_str(error_code: int, buffer: span[ubyte]) -> Option[str]:
29
+ let result = re.get_error_message(error_code, buffer)
30
+ if result <= 0:
31
+ return Option[str].none
32
+
33
+ let message_len = ptr_uint<-result
34
+ let message = span[ubyte](data = buffer.data, len = message_len)
35
+ return text.utf8_byte_span_as_str(message)
data/std/pcre2.mt ADDED
@@ -0,0 +1,78 @@
1
+ # generated by mtc imported-bindings from std.c.pcre2 using bindings/imported/pcre2.binding.json
2
+
3
+ import std.c.pcre2 as c
4
+
5
+ public type UChar = c.PCRE2_UCHAR8
6
+ public type SPTR = c.PCRE2_SPTR8
7
+ public type GeneralContext = c.pcre2_general_context_8
8
+ public type CompileContext = c.pcre2_compile_context_8
9
+ public type MatchContext = c.pcre2_match_context_8
10
+ public type ConvertContext = c.pcre2_convert_context_8
11
+ public type Code = c.pcre2_code_8
12
+ public type MatchData = c.pcre2_match_data_8
13
+ public type JitStack = c.pcre2_jit_stack_8
14
+ public type JitCallback = c.pcre2_jit_callback_8
15
+ public type CalloutBlock = c.pcre2_callout_block_8
16
+ public type SubstituteCalloutBlock = c.pcre2_substitute_callout_block_8
17
+
18
+ public const MAJOR: int = c.PCRE2_MAJOR
19
+ public const MINOR: int = c.PCRE2_MINOR
20
+ public const ANCHORED: uint = c.PCRE2_ANCHORED
21
+ public const NO_UTF_CHECK: uint = c.PCRE2_NO_UTF_CHECK
22
+ public const CASELESS: uint = c.PCRE2_CASELESS
23
+ public const DOTALL: uint = c.PCRE2_DOTALL
24
+ public const EXTENDED: uint = c.PCRE2_EXTENDED
25
+ public const MULTILINE: uint = c.PCRE2_MULTILINE
26
+ public const UCP: uint = c.PCRE2_UCP
27
+ public const UTF: uint = c.PCRE2_UTF
28
+ public const JIT_COMPLETE: uint = c.PCRE2_JIT_COMPLETE
29
+ public const JIT_PARTIAL_SOFT: uint = c.PCRE2_JIT_PARTIAL_SOFT
30
+ public const JIT_PARTIAL_HARD: uint = c.PCRE2_JIT_PARTIAL_HARD
31
+ public const NOTBOL: uint = c.PCRE2_NOTBOL
32
+ public const NOTEOL: uint = c.PCRE2_NOTEOL
33
+ public const NOTEMPTY: uint = c.PCRE2_NOTEMPTY
34
+ public const NOTEMPTY_ATSTART: uint = c.PCRE2_NOTEMPTY_ATSTART
35
+ public const PARTIAL_SOFT: uint = c.PCRE2_PARTIAL_SOFT
36
+ public const PARTIAL_HARD: uint = c.PCRE2_PARTIAL_HARD
37
+ public const NEWLINE_CR: int = c.PCRE2_NEWLINE_CR
38
+ public const NEWLINE_LF: int = c.PCRE2_NEWLINE_LF
39
+ public const NEWLINE_CRLF: int = c.PCRE2_NEWLINE_CRLF
40
+ public const NEWLINE_ANY: int = c.PCRE2_NEWLINE_ANY
41
+ public const NEWLINE_ANYCRLF: int = c.PCRE2_NEWLINE_ANYCRLF
42
+ public const NEWLINE_NUL: int = c.PCRE2_NEWLINE_NUL
43
+ public const BSR_UNICODE: int = c.PCRE2_BSR_UNICODE
44
+ public const BSR_ANYCRLF: int = c.PCRE2_BSR_ANYCRLF
45
+ public const ERROR_NOMATCH: int = c.PCRE2_ERROR_NOMATCH
46
+ public const ERROR_PARTIAL: int = c.PCRE2_ERROR_PARTIAL
47
+ public const ERROR_BADMAGIC: int = c.PCRE2_ERROR_BADMAGIC
48
+ public const ERROR_BADOPTION: int = c.PCRE2_ERROR_BADOPTION
49
+
50
+ public foreign function config_8(arg0: uint, arg1: ptr[void]) -> int = c.pcre2_config_8
51
+ public foreign function general_context_copy_8(arg0: ptr[GeneralContext]) -> ptr[GeneralContext] = c.pcre2_general_context_copy_8
52
+ public foreign function general_context_create_8(arg0: fn(arg0: ptr_uint, arg1: ptr[void]) -> ptr[void], arg1: fn(arg0: ptr[void], arg1: ptr[void]) -> void, arg2: ptr[void]) -> ptr[GeneralContext] = c.pcre2_general_context_create_8
53
+ public foreign function general_context_free_8(arg0: ptr[GeneralContext]) -> void = c.pcre2_general_context_free_8
54
+ public foreign function compile_context_copy_8(arg0: ptr[CompileContext]) -> ptr[CompileContext] = c.pcre2_compile_context_copy_8
55
+ public foreign function compile_context_create_8(arg0: ptr[GeneralContext]) -> ptr[CompileContext] = c.pcre2_compile_context_create_8
56
+ public foreign function compile_context_free_8(arg0: ptr[CompileContext]) -> void = c.pcre2_compile_context_free_8
57
+ public foreign function match_context_copy_8(arg0: ptr[MatchContext]) -> ptr[MatchContext] = c.pcre2_match_context_copy_8
58
+ public foreign function match_context_create_8(arg0: ptr[GeneralContext]) -> ptr[MatchContext] = c.pcre2_match_context_create_8
59
+ public foreign function match_context_free_8(arg0: ptr[MatchContext]) -> void = c.pcre2_match_context_free_8
60
+ public foreign function set_depth_limit_8(arg0: ptr[MatchContext], arg1: uint) -> int = c.pcre2_set_depth_limit_8
61
+ public foreign function set_heap_limit_8(arg0: ptr[MatchContext], arg1: uint) -> int = c.pcre2_set_heap_limit_8
62
+ public foreign function set_match_limit_8(arg0: ptr[MatchContext], arg1: uint) -> int = c.pcre2_set_match_limit_8
63
+ public foreign function compile_bytes(pattern: span[ubyte], options: uint, out error_code: int, out error_offset: ptr_uint, compile_context: ptr[CompileContext]) -> ptr[Code]? = c.pcre2_compile_8(pattern.data, ptr_uint<-pattern.len, options, error_code, error_offset, compile_context)
64
+ public foreign function code_free_8(arg0: ptr[Code]) -> void = c.pcre2_code_free_8
65
+ public foreign function code_copy_8(arg0: const_ptr[Code]) -> ptr[Code] = c.pcre2_code_copy_8
66
+ public foreign function match_data_create_8(arg0: uint, arg1: ptr[GeneralContext]) -> ptr[MatchData] = c.pcre2_match_data_create_8
67
+ public foreign function match_data_create_from_pattern_8(arg0: const_ptr[Code], arg1: ptr[GeneralContext]) -> ptr[MatchData] = c.pcre2_match_data_create_from_pattern_8
68
+ public foreign function match_data_free_8(arg0: ptr[MatchData]) -> void = c.pcre2_match_data_free_8
69
+ public foreign function match_bytes(code: const_ptr[Code], subject: span[ubyte], start_offset: ptr_uint, options: uint, match_data: ptr[MatchData], match_context: ptr[MatchContext]) -> int = c.pcre2_match_8(code, subject.data, ptr_uint<-subject.len, start_offset, options, match_data, match_context)
70
+ public foreign function get_ovector_count_8(arg0: ptr[MatchData]) -> uint = c.pcre2_get_ovector_count_8
71
+ public foreign function get_ovector_pointer_8(arg0: ptr[MatchData]) -> ptr[ptr_uint] = c.pcre2_get_ovector_pointer_8
72
+ public foreign function substring_free_8(arg0: ptr[UChar]) -> void = c.pcre2_substring_free_8
73
+ public foreign function substring_get_bynumber_8(arg0: ptr[MatchData], arg1: uint, arg2: ptr[ptr[UChar]], arg3: ptr[ptr_uint]) -> int = c.pcre2_substring_get_bynumber_8
74
+ public foreign function substring_number_from_name_8(arg0: const_ptr[Code], arg1: const_ptr[UChar]) -> int = c.pcre2_substring_number_from_name_8
75
+ public foreign function substitute_8(arg0: const_ptr[Code], arg1: const_ptr[UChar], arg2: ptr_uint, arg3: ptr_uint, arg4: uint, arg5: ptr[MatchData], arg6: ptr[MatchContext], arg7: const_ptr[UChar], arg8: ptr_uint, arg9: ptr[UChar], arg10: ptr[ptr_uint]) -> int = c.pcre2_substitute_8
76
+ public foreign function jit_compile_8(arg0: ptr[Code], arg1: uint) -> int = c.pcre2_jit_compile_8
77
+ public foreign function jit_match_8(arg0: const_ptr[Code], arg1: const_ptr[UChar], arg2: ptr_uint, arg3: ptr_uint, arg4: uint, arg5: ptr[MatchData], arg6: ptr[MatchContext]) -> int = c.pcre2_jit_match_8
78
+ public foreign function get_error_message(error_code: int, buffer: span[ubyte]) -> int = c.pcre2_get_error_message_8(error_code, buffer.data, ptr_uint<-buffer.len)
@@ -0,0 +1,55 @@
1
+ import std.binary_heap as binary_heap
2
+
3
+ public struct PriorityQueue[T]:
4
+ values: binary_heap.BinaryHeap[T]
5
+
6
+
7
+ extending PriorityQueue[T]:
8
+ public static function create() -> PriorityQueue[T]:
9
+ return PriorityQueue[T](values = binary_heap.BinaryHeap[T].create())
10
+
11
+
12
+ public static function with_capacity(capacity: ptr_uint) -> PriorityQueue[T]:
13
+ var result = PriorityQueue[T].create()
14
+ result.reserve(capacity)
15
+ return result
16
+
17
+
18
+ public function len() -> ptr_uint:
19
+ return this.values.len()
20
+
21
+
22
+ public function capacity() -> ptr_uint:
23
+ return this.values.capacity()
24
+
25
+
26
+ public function is_empty() -> bool:
27
+ return this.values.is_empty()
28
+
29
+
30
+ public function iter() -> binary_heap.Iter[T]:
31
+ return this.values.iter()
32
+
33
+
34
+ public function peek() -> const_ptr[T]?:
35
+ return this.values.peek()
36
+
37
+
38
+ public editable function clear() -> void:
39
+ this.values.clear()
40
+
41
+
42
+ public editable function release() -> void:
43
+ this.values.release()
44
+
45
+
46
+ public editable function reserve(min_capacity: ptr_uint) -> void:
47
+ this.values.reserve(min_capacity)
48
+
49
+
50
+ public editable function enqueue(value: T) -> void:
51
+ this.values.push(value)
52
+
53
+
54
+ public editable function dequeue() -> Option[T]:
55
+ return this.values.pop()