@shd101wyy/yo 0.1.25 → 0.1.27

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 (194) hide show
  1. package/.github/skills/yo-async-effects/SKILL.md +4 -4
  2. package/.github/skills/yo-async-effects/async-effects-recipes.md +40 -40
  3. package/.github/skills/yo-core-patterns/SKILL.md +1 -1
  4. package/.github/skills/yo-core-patterns/core-patterns-cheatsheet.md +30 -26
  5. package/.github/skills/yo-project-workflow/SKILL.md +6 -3
  6. package/.github/skills/yo-project-workflow/workflow-cheatsheet.md +34 -11
  7. package/.github/skills/yo-syntax/SKILL.md +7 -6
  8. package/.github/skills/yo-syntax/syntax-cheatsheet.md +78 -60
  9. package/.github/skills/yo-wasm-integration/wasm-integration-cheatsheet.md +3 -3
  10. package/README.md +10 -8
  11. package/out/cjs/index.cjs +583 -567
  12. package/out/cjs/yo-cli.cjs +664 -632
  13. package/out/cjs/yo-lsp.cjs +510 -485
  14. package/out/esm/index.mjs +538 -522
  15. package/out/types/src/codegen/codegen-c.d.ts +2 -2
  16. package/out/types/src/codegen/functions/collection.d.ts +2 -2
  17. package/out/types/src/codegen/functions/context.d.ts +3 -2
  18. package/out/types/src/codegen/types/collection.d.ts +2 -2
  19. package/out/types/src/codegen/utils/index.d.ts +3 -1
  20. package/out/types/src/doc/builder.d.ts +2 -2
  21. package/out/types/src/evaluator/calls/closure-type.d.ts +2 -2
  22. package/out/types/src/evaluator/calls/record-type.d.ts +11 -0
  23. package/out/types/src/evaluator/context.d.ts +8 -9
  24. package/out/types/src/evaluator/index.d.ts +3 -3
  25. package/out/types/src/evaluator/types/record.d.ts +14 -0
  26. package/out/types/src/evaluator/types/validation.d.ts +2 -2
  27. package/out/types/src/evaluator/values/anonymous-module.d.ts +5 -5
  28. package/out/types/src/evaluator/values/impl.d.ts +1 -1
  29. package/out/types/src/expr.d.ts +1 -4
  30. package/out/types/src/formatter.d.ts +11 -0
  31. package/out/types/src/function-value.d.ts +1 -1
  32. package/out/types/src/lsp/document-manager.d.ts +1 -1
  33. package/out/types/src/lsp/formatting.d.ts +2 -0
  34. package/out/types/src/module-manager.d.ts +3 -3
  35. package/out/types/src/tests/formatter.test.d.ts +1 -0
  36. package/out/types/src/types/creators.d.ts +3 -4
  37. package/out/types/src/types/definitions.d.ts +8 -19
  38. package/out/types/src/types/guards.d.ts +3 -3
  39. package/out/types/src/types/tags.d.ts +0 -1
  40. package/out/types/src/types/utils.d.ts +1 -1
  41. package/out/types/src/value-tag.d.ts +0 -1
  42. package/out/types/src/value.d.ts +6 -13
  43. package/out/types/tsconfig.tsbuildinfo +1 -1
  44. package/package.json +1 -1
  45. package/std/alg/hash.yo +13 -21
  46. package/std/allocator.yo +25 -40
  47. package/std/async.yo +3 -7
  48. package/std/build.yo +105 -151
  49. package/std/cli/arg_parser.yo +184 -169
  50. package/std/collections/array_list.yo +350 -314
  51. package/std/collections/btree_map.yo +142 -131
  52. package/std/collections/deque.yo +132 -128
  53. package/std/collections/hash_map.yo +542 -566
  54. package/std/collections/hash_set.yo +623 -687
  55. package/std/collections/linked_list.yo +275 -293
  56. package/std/collections/ordered_map.yo +113 -85
  57. package/std/collections/priority_queue.yo +73 -73
  58. package/std/crypto/md5.yo +191 -95
  59. package/std/crypto/random.yo +56 -64
  60. package/std/crypto/sha256.yo +151 -107
  61. package/std/encoding/base64.yo +87 -81
  62. package/std/encoding/hex.yo +43 -50
  63. package/std/encoding/html.yo +56 -81
  64. package/std/encoding/html_char_utils.yo +7 -13
  65. package/std/encoding/html_entities.yo +2248 -2253
  66. package/std/encoding/json.yo +316 -224
  67. package/std/encoding/punycode.yo +86 -116
  68. package/std/encoding/toml.yo +67 -66
  69. package/std/encoding/utf16.yo +37 -44
  70. package/std/env.yo +62 -91
  71. package/std/error.yo +12 -20
  72. package/std/fmt/display.yo +5 -9
  73. package/std/fmt/index.yo +8 -14
  74. package/std/fmt/to_string.yo +330 -315
  75. package/std/fmt/writer.yo +58 -87
  76. package/std/fs/dir.yo +83 -102
  77. package/std/fs/file.yo +147 -180
  78. package/std/fs/metadata.yo +45 -78
  79. package/std/fs/temp.yo +55 -65
  80. package/std/fs/types.yo +27 -40
  81. package/std/fs/walker.yo +53 -68
  82. package/std/gc.yo +5 -8
  83. package/std/glob.yo +30 -43
  84. package/std/http/client.yo +107 -120
  85. package/std/http/http.yo +106 -96
  86. package/std/http/index.yo +4 -6
  87. package/std/imm/list.yo +88 -93
  88. package/std/imm/map.yo +528 -464
  89. package/std/imm/set.yo +52 -57
  90. package/std/imm/sorted_map.yo +340 -286
  91. package/std/imm/sorted_set.yo +57 -63
  92. package/std/imm/string.yo +404 -345
  93. package/std/imm/vec.yo +173 -181
  94. package/std/io/reader.yo +3 -6
  95. package/std/io/writer.yo +4 -8
  96. package/std/libc/assert.yo +5 -9
  97. package/std/libc/ctype.yo +32 -22
  98. package/std/libc/dirent.yo +26 -25
  99. package/std/libc/errno.yo +164 -90
  100. package/std/libc/fcntl.yo +52 -45
  101. package/std/libc/float.yo +66 -44
  102. package/std/libc/limits.yo +42 -33
  103. package/std/libc/math.yo +53 -82
  104. package/std/libc/signal.yo +72 -47
  105. package/std/libc/stdatomic.yo +217 -188
  106. package/std/libc/stdint.yo +5 -29
  107. package/std/libc/stdio.yo +5 -29
  108. package/std/libc/stdlib.yo +32 -39
  109. package/std/libc/string.yo +5 -23
  110. package/std/libc/sys/stat.yo +58 -56
  111. package/std/libc/time.yo +5 -19
  112. package/std/libc/unistd.yo +5 -20
  113. package/std/libc/wctype.yo +6 -9
  114. package/std/libc/windows.yo +26 -30
  115. package/std/log.yo +41 -55
  116. package/std/net/addr.yo +102 -97
  117. package/std/net/dns.yo +27 -28
  118. package/std/net/errors.yo +50 -49
  119. package/std/net/tcp.yo +113 -124
  120. package/std/net/udp.yo +55 -66
  121. package/std/os/env.yo +35 -33
  122. package/std/os/signal.yo +15 -25
  123. package/std/path.yo +276 -311
  124. package/std/prelude.yo +6316 -4333
  125. package/std/process/command.yo +87 -103
  126. package/std/process/index.yo +12 -31
  127. package/std/regex/compiler.yo +196 -95
  128. package/std/regex/flags.yo +58 -39
  129. package/std/regex/index.yo +157 -173
  130. package/std/regex/match.yo +20 -31
  131. package/std/regex/node.yo +134 -152
  132. package/std/regex/parser.yo +283 -259
  133. package/std/regex/unicode.yo +172 -202
  134. package/std/regex/vm.yo +155 -171
  135. package/std/string/index.yo +5 -7
  136. package/std/string/rune.yo +45 -55
  137. package/std/string/string.yo +937 -964
  138. package/std/string/string_builder.yo +94 -104
  139. package/std/string/unicode.yo +46 -64
  140. package/std/sync/channel.yo +72 -73
  141. package/std/sync/cond.yo +31 -36
  142. package/std/sync/mutex.yo +30 -32
  143. package/std/sync/once.yo +13 -16
  144. package/std/sync/rwlock.yo +26 -31
  145. package/std/sync/waitgroup.yo +20 -25
  146. package/std/sys/advise.yo +16 -24
  147. package/std/sys/bufio/buf_reader.yo +77 -93
  148. package/std/sys/bufio/buf_writer.yo +52 -65
  149. package/std/sys/clock.yo +4 -9
  150. package/std/sys/constants.yo +77 -61
  151. package/std/sys/copy.yo +4 -10
  152. package/std/sys/dir.yo +26 -43
  153. package/std/sys/dns.yo +41 -61
  154. package/std/sys/errors.yo +95 -103
  155. package/std/sys/events.yo +45 -57
  156. package/std/sys/externs.yo +319 -267
  157. package/std/sys/fallocate.yo +7 -11
  158. package/std/sys/fcntl.yo +14 -22
  159. package/std/sys/file.yo +26 -40
  160. package/std/sys/future.yo +5 -8
  161. package/std/sys/iov.yo +12 -25
  162. package/std/sys/lock.yo +12 -13
  163. package/std/sys/mmap.yo +38 -43
  164. package/std/sys/path.yo +3 -8
  165. package/std/sys/perm.yo +7 -21
  166. package/std/sys/pipe.yo +5 -12
  167. package/std/sys/process.yo +23 -29
  168. package/std/sys/seek.yo +10 -12
  169. package/std/sys/signal.yo +7 -13
  170. package/std/sys/signals.yo +52 -35
  171. package/std/sys/socket.yo +63 -58
  172. package/std/sys/socketpair.yo +3 -6
  173. package/std/sys/sockinfo.yo +11 -20
  174. package/std/sys/statfs.yo +11 -34
  175. package/std/sys/statx.yo +25 -52
  176. package/std/sys/sysinfo.yo +15 -20
  177. package/std/sys/tcp.yo +62 -92
  178. package/std/sys/temp.yo +5 -9
  179. package/std/sys/time.yo +5 -15
  180. package/std/sys/timer.yo +6 -11
  181. package/std/sys/tty.yo +10 -18
  182. package/std/sys/udp.yo +22 -39
  183. package/std/sys/umask.yo +3 -6
  184. package/std/sys/unix.yo +33 -52
  185. package/std/testing/bench.yo +49 -52
  186. package/std/thread.yo +10 -15
  187. package/std/time/datetime.yo +105 -89
  188. package/std/time/duration.yo +43 -56
  189. package/std/time/instant.yo +13 -18
  190. package/std/time/sleep.yo +5 -9
  191. package/std/url/index.yo +184 -209
  192. package/std/worker.yo +6 -10
  193. package/out/types/src/evaluator/calls/module-type.d.ts +0 -11
  194. package/out/types/src/evaluator/types/module.d.ts +0 -19
package/std/sys/errors.yo CHANGED
@@ -1,20 +1,11 @@
1
1
  //! `IOError` type — comprehensive I/O error type with errno-to-error mapping.
2
-
3
- { String } :: import "../string";
4
- { ToString } :: import "../fmt";
5
- { Error, Exception } :: import "../error";
6
- {
7
- ENOENT, EPERM, EACCES, EEXIST, ENOTDIR, EISDIR, ENOTEMPTY, EPIPE,
8
- EAGAIN, EWOULDBLOCK, EINVAL, EINTR, EMFILE, ENFILE, EFBIG, ENOSPC,
9
- EROFS, EXDEV, EMLINK, ENAMETOOLONG, ENOTSUP, EOPNOTSUPP, ETIMEDOUT, EBUSY,
10
- ECONNREFUSED, ECONNRESET, ECONNABORTED, ENOTCONN, EADDRINUSE, EADDRNOTAVAIL,
11
- ENETUNREACH, EHOSTUNREACH, ENETDOWN, EISCONN, EBADF, EIO
12
- } :: import "../libc/errno";
13
-
2
+ { String } :: import("../string");
3
+ { ToString } :: import("../fmt");
4
+ { Error, Exception } :: import("../error");
5
+ { ENOENT, EPERM, EACCES, EEXIST, ENOTDIR, EISDIR, ENOTEMPTY, EPIPE, EAGAIN, EWOULDBLOCK, EINVAL, EINTR, EMFILE, ENFILE, EFBIG, ENOSPC, EROFS, EXDEV, EMLINK, ENAMETOOLONG, ENOTSUP, EOPNOTSUPP, ETIMEDOUT, EBUSY, ECONNREFUSED, ECONNRESET, ECONNABORTED, ENOTCONN, EADDRINUSE, EADDRNOTAVAIL, ENETUNREACH, EHOSTUNREACH, ENETDOWN, EISCONN, EBADF, EIO } :: import("../libc/errno");
14
6
  // ============================================================================
15
7
  // IOError - I/O error type
16
8
  // ============================================================================
17
-
18
9
  /// Comprehensive I/O error type with errno-to-error mapping.
19
10
  IOError :: enum(
20
11
  /// File or directory not found (ENOENT).
@@ -61,7 +52,6 @@ IOError :: enum(
61
52
  BadFileDescriptor,
62
53
  /// Generic I/O error (EIO).
63
54
  IOError,
64
-
65
55
  /// Connection refused (ECONNREFUSED).
66
56
  ConnectionRefused,
67
57
  /// Connection reset by peer (ECONNRESET).
@@ -82,108 +72,110 @@ IOError :: enum(
82
72
  NetworkDown,
83
73
  /// Already connected (EISCONN).
84
74
  AlreadyConnected,
85
-
86
75
  /// Other error with raw errno code.
87
- Other(code: i32)
76
+ Other(code : i32)
88
77
  );
89
-
90
- impl(IOError,
91
- from_errno : (fn(errno: i32) -> Self)(
78
+ impl(
79
+ IOError,
80
+ from_errno : (fn(errno : i32) -> Self)(
92
81
  cond(
93
- (errno == i32(ENOENT)) => .NotFound,
94
- ((errno == i32(EPERM)) || (errno == i32(EACCES))) => .PermissionDenied,
95
- (errno == i32(EEXIST)) => .AlreadyExists,
96
- (errno == i32(ENOTDIR)) => .NotADirectory,
97
- (errno == i32(EISDIR)) => .IsADirectory,
98
- (errno == i32(ENOTEMPTY)) => .DirectoryNotEmpty,
99
- (errno == i32(EPIPE)) => .BrokenPipe,
100
- ((errno == i32(EAGAIN)) || (errno == i32(EWOULDBLOCK))) => .WouldBlock,
101
- (errno == i32(EINVAL)) => .InvalidInput,
102
- (errno == i32(EINTR)) => .Interrupted,
103
- ((errno == i32(EMFILE)) || (errno == i32(ENFILE))) => .TooManyOpenFiles,
104
- (errno == i32(EFBIG)) => .FileTooLarge,
105
- (errno == i32(ENOSPC)) => .NoSpace,
106
- (errno == i32(EROFS)) => .ReadOnlyFilesystem,
107
- (errno == i32(EXDEV)) => .CrossDeviceLink,
108
- (errno == i32(EMLINK)) => .TooManyLinks,
109
- (errno == i32(ENAMETOOLONG)) => .NameTooLong,
110
- ((errno == i32(ENOTSUP)) || (errno == i32(EOPNOTSUPP))) => .NotSupported,
111
- (errno == i32(ETIMEDOUT)) => .TimedOut,
112
- (errno == i32(EBUSY)) => .Busy,
113
- (errno == i32(EBADF)) => .BadFileDescriptor,
114
- (errno == i32(EIO)) => .IOError,
115
- (errno == i32(ECONNREFUSED)) => .ConnectionRefused,
116
- (errno == i32(ECONNRESET)) => .ConnectionReset,
117
- (errno == i32(ECONNABORTED)) => .ConnectionAborted,
118
- (errno == i32(ENOTCONN)) => .NotConnected,
119
- (errno == i32(EADDRINUSE)) => .AddressInUse,
120
- (errno == i32(EADDRNOTAVAIL)) => .AddressNotAvailable,
121
- (errno == i32(ENETUNREACH)) => .NetworkUnreachable,
122
- (errno == i32(EHOSTUNREACH)) => .HostUnreachable,
123
- (errno == i32(ENETDOWN)) => .NetworkDown,
124
- (errno == i32(EISCONN)) => .AlreadyConnected,
125
- true => .Other(errno)
82
+ (errno == i32(ENOENT)) =>.NotFound,
83
+ ((errno == i32(EPERM)) || (errno == i32(EACCES))) =>.PermissionDenied,
84
+ (errno == i32(EEXIST)) =>.AlreadyExists,
85
+ (errno == i32(ENOTDIR)) =>.NotADirectory,
86
+ (errno == i32(EISDIR)) =>.IsADirectory,
87
+ (errno == i32(ENOTEMPTY)) =>.DirectoryNotEmpty,
88
+ (errno == i32(EPIPE)) =>.BrokenPipe,
89
+ ((errno == i32(EAGAIN)) || (errno == i32(EWOULDBLOCK))) =>.WouldBlock,
90
+ (errno == i32(EINVAL)) =>.InvalidInput,
91
+ (errno == i32(EINTR)) =>.Interrupted,
92
+ ((errno == i32(EMFILE)) || (errno == i32(ENFILE))) =>.TooManyOpenFiles,
93
+ (errno == i32(EFBIG)) =>.FileTooLarge,
94
+ (errno == i32(ENOSPC)) =>.NoSpace,
95
+ (errno == i32(EROFS)) =>.ReadOnlyFilesystem,
96
+ (errno == i32(EXDEV)) =>.CrossDeviceLink,
97
+ (errno == i32(EMLINK)) =>.TooManyLinks,
98
+ (errno == i32(ENAMETOOLONG)) =>.NameTooLong,
99
+ ((errno == i32(ENOTSUP)) || (errno == i32(EOPNOTSUPP))) =>.NotSupported,
100
+ (errno == i32(ETIMEDOUT)) =>.TimedOut,
101
+ (errno == i32(EBUSY)) =>.Busy,
102
+ (errno == i32(EBADF)) =>.BadFileDescriptor,
103
+ (errno == i32(EIO)) =>.IOError,
104
+ (errno == i32(ECONNREFUSED)) =>.ConnectionRefused,
105
+ (errno == i32(ECONNRESET)) =>.ConnectionReset,
106
+ (errno == i32(ECONNABORTED)) =>.ConnectionAborted,
107
+ (errno == i32(ENOTCONN)) =>.NotConnected,
108
+ (errno == i32(EADDRINUSE)) =>.AddressInUse,
109
+ (errno == i32(EADDRNOTAVAIL)) =>.AddressNotAvailable,
110
+ (errno == i32(ENETUNREACH)) =>.NetworkUnreachable,
111
+ (errno == i32(EHOSTUNREACH)) =>.HostUnreachable,
112
+ (errno == i32(ENETDOWN)) =>.NetworkDown,
113
+ (errno == i32(EISCONN)) =>.AlreadyConnected,
114
+ true =>.Other(errno)
126
115
  )
127
116
  ),
128
-
129
- from_result : (fn(result: i32) -> Result(i32, Self))(
117
+ from_result : (fn(result : i32) -> Result(i32, Self))(
130
118
  cond(
131
- (result >= i32(0)) => .Ok(result),
132
- true => .Err(Self.from_errno((i32(0) - result)))
119
+ (result >= i32(0)) =>.Ok(result),
120
+ true =>.Err(Self.from_errno(i32(0) - result))
121
+ )
122
+ )
123
+ );
124
+ impl(
125
+ IOError,
126
+ ToString(
127
+ to_string : (
128
+ self -> {
129
+ s := match(
130
+ self,
131
+ .NotFound => String.from("file or directory not found"),
132
+ .PermissionDenied => String.from("permission denied"),
133
+ .AlreadyExists => String.from("file or directory already exists"),
134
+ .NotADirectory => String.from("not a directory"),
135
+ .IsADirectory => String.from("is a directory"),
136
+ .DirectoryNotEmpty => String.from("directory not empty"),
137
+ .BrokenPipe => String.from("broken pipe"),
138
+ .WouldBlock => String.from("operation would block"),
139
+ .InvalidInput => String.from("invalid input"),
140
+ .Interrupted => String.from("operation interrupted"),
141
+ .TooManyOpenFiles => String.from("too many open files"),
142
+ .FileTooLarge => String.from("file too large"),
143
+ .NoSpace => String.from("no space left on device"),
144
+ .ReadOnlyFilesystem => String.from("read-only filesystem"),
145
+ .CrossDeviceLink => String.from("cross-device link"),
146
+ .TooManyLinks => String.from("too many links"),
147
+ .NameTooLong => String.from("name too long"),
148
+ .NotSupported => String.from("operation not supported"),
149
+ .TimedOut => String.from("operation timed out"),
150
+ .Busy => String.from("resource busy"),
151
+ .BadFileDescriptor => String.from("bad file descriptor"),
152
+ .IOError => String.from("I/O error"),
153
+ .ConnectionRefused => String.from("connection refused"),
154
+ .ConnectionReset => String.from("connection reset by peer"),
155
+ .ConnectionAborted => String.from("connection aborted"),
156
+ .NotConnected => String.from("socket not connected"),
157
+ .AddressInUse => String.from("address already in use"),
158
+ .AddressNotAvailable => String.from("address not available"),
159
+ .NetworkUnreachable => String.from("network unreachable"),
160
+ .HostUnreachable => String.from("host unreachable"),
161
+ .NetworkDown => String.from("network is down"),
162
+ .AlreadyConnected => String.from("socket already connected"),
163
+ .Other(errno) => String.from("unknown I/O error")
164
+ );
165
+ return(s);
166
+ }
133
167
  )
134
168
  )
135
169
  );
136
-
137
- impl(IOError, ToString(
138
- to_string : (self -> {
139
- s := match(self,
140
- .NotFound => String.from("file or directory not found"),
141
- .PermissionDenied => String.from("permission denied"),
142
- .AlreadyExists => String.from("file or directory already exists"),
143
- .NotADirectory => String.from("not a directory"),
144
- .IsADirectory => String.from("is a directory"),
145
- .DirectoryNotEmpty => String.from("directory not empty"),
146
- .BrokenPipe => String.from("broken pipe"),
147
- .WouldBlock => String.from("operation would block"),
148
- .InvalidInput => String.from("invalid input"),
149
- .Interrupted => String.from("operation interrupted"),
150
- .TooManyOpenFiles => String.from("too many open files"),
151
- .FileTooLarge => String.from("file too large"),
152
- .NoSpace => String.from("no space left on device"),
153
- .ReadOnlyFilesystem => String.from("read-only filesystem"),
154
- .CrossDeviceLink => String.from("cross-device link"),
155
- .TooManyLinks => String.from("too many links"),
156
- .NameTooLong => String.from("name too long"),
157
- .NotSupported => String.from("operation not supported"),
158
- .TimedOut => String.from("operation timed out"),
159
- .Busy => String.from("resource busy"),
160
- .BadFileDescriptor => String.from("bad file descriptor"),
161
- .IOError => String.from("I/O error"),
162
- .ConnectionRefused => String.from("connection refused"),
163
- .ConnectionReset => String.from("connection reset by peer"),
164
- .ConnectionAborted => String.from("connection aborted"),
165
- .NotConnected => String.from("socket not connected"),
166
- .AddressInUse => String.from("address already in use"),
167
- .AddressNotAvailable => String.from("address not available"),
168
- .NetworkUnreachable => String.from("network unreachable"),
169
- .HostUnreachable => String.from("host unreachable"),
170
- .NetworkDown => String.from("network is down"),
171
- .AlreadyConnected => String.from("socket already connected"),
172
- .Other(errno) => String.from("unknown I/O error")
173
- );
174
- return s;
175
- })
176
- ));
177
170
  impl(IOError, Error());
178
-
179
- impl(IOError,
171
+ impl(
172
+ IOError,
180
173
  // Check a raw result code, throwing on error via Exception effect.
181
- check : (fn(result: i32, using(exn : Exception)) -> i32)(
174
+ check : (fn(result : i32, using(exn : Exception)) -> i32)(
182
175
  cond(
183
176
  (result >= i32(0)) => result,
184
- true => exn.throw(dyn Self.from_errno(i32(0) - result))
177
+ true => exn.throw(dyn(Self.from_errno(i32(0) - result)))
185
178
  )
186
179
  )
187
180
  );
188
-
189
- export IOError;
181
+ export(IOError);
package/std/sys/events.yo CHANGED
@@ -1,112 +1,100 @@
1
1
  //! TTY, Poll, and FS Event constants.
2
-
3
- {
4
- __yo_fs_event_init, __yo_fs_event_start,
5
- __yo_fs_event_stop, __yo_fs_event_close,
6
- __yo_poll_init, __yo_poll_start,
7
- __yo_poll_stop, __yo_poll_close
8
- } :: import "./externs.yo";
9
-
2
+ { __yo_fs_event_init, __yo_fs_event_start, __yo_fs_event_stop, __yo_fs_event_close, __yo_poll_init, __yo_poll_start, __yo_poll_stop, __yo_poll_close } :: import("./externs.yo");
10
3
  // ============================================================================
11
4
  // TTY Mode Constants (libuv uv_tty_mode_t equivalent)
12
5
  // ============================================================================
13
-
14
6
  TTY_MODE_NORMAL :: i32(0);
15
- TTY_MODE_RAW :: i32(1);
16
- TTY_MODE_IO :: i32(2);
17
-
7
+ TTY_MODE_RAW :: i32(1);
8
+ TTY_MODE_IO :: i32(2);
18
9
  // ============================================================================
19
10
  // Poll Event Constants (libuv uv_poll_event equivalent)
20
11
  // ============================================================================
21
-
22
- POLL_READABLE :: i32(1);
23
- POLL_WRITABLE :: i32(2);
24
- POLL_DISCONNECT :: i32(4);
12
+ POLL_READABLE :: i32(1);
13
+ POLL_WRITABLE :: i32(2);
14
+ POLL_DISCONNECT :: i32(4);
25
15
  POLL_PRIORITIZED :: i32(8);
26
-
27
16
  // ============================================================================
28
17
  // FS Event Flags (libuv uv_fs_event_flags equivalent)
29
18
  // ============================================================================
30
-
31
19
  FS_EVENT_WATCH_ENTRY :: u32(1);
32
- FS_EVENT_STAT :: u32(2);
33
- FS_EVENT_RECURSIVE :: u32(4);
34
-
20
+ FS_EVENT_STAT :: u32(2);
21
+ FS_EVENT_RECURSIVE :: u32(4);
35
22
  // FS Event Types (callback event types)
36
23
  FS_EVENT_RENAME :: i32(1);
37
24
  FS_EVENT_CHANGE :: i32(2);
38
-
39
25
  // ============================================================================
40
26
  // Poll Operations (sync wrappers around runtime callbacks)
41
27
  // ============================================================================
42
-
43
- PollCallback :: (fn(events: i32, status: i32, user_data: *(u8)) -> unit);
44
-
28
+ PollCallback :: (fn(events : i32, status : i32, user_data : *(u8)) -> unit);
45
29
  PollHandle :: struct(
46
- handle: *(u8)
30
+ handle : *(u8)
47
31
  );
48
-
49
32
  // Allocate a new poll handle bound to a fd.
50
- poll_init :: (fn(fd: i32) -> PollHandle)(
33
+ poll_init :: (fn(fd : i32) -> PollHandle)(
51
34
  PollHandle(__yo_poll_init(fd))
52
35
  );
53
-
54
36
  // Start polling for events.
55
37
  // Returns 0 on success, -errno on failure.
56
- poll_start :: (fn(handle: PollHandle, events: i32, callback: PollCallback, user_data: *(u8)) -> i32)(
38
+ poll_start :: (fn(handle : PollHandle, events : i32, callback : PollCallback, user_data : *(u8)) -> i32)(
57
39
  __yo_poll_start(handle.handle, events, unsafe.cast(callback, *(u8)), user_data)
58
40
  );
59
-
60
41
  // Stop polling.
61
42
  // Returns 0 on success, -errno on failure.
62
- poll_stop :: (fn(handle: PollHandle) -> i32)(
43
+ poll_stop :: (fn(handle : PollHandle) -> i32)(
63
44
  __yo_poll_stop(handle.handle)
64
45
  );
65
-
66
46
  // Close and free the handle.
67
- poll_close :: (fn(handle: PollHandle) -> unit)({
47
+ poll_close :: (fn(handle : PollHandle) -> unit)({
68
48
  __yo_poll_close(handle.handle);
69
49
  });
70
-
71
50
  // ============================================================================
72
51
  // FS Event Operations (sync wrappers around runtime callbacks)
73
52
  // ============================================================================
74
-
75
- FsEventCallback :: (fn(path: *(u8), events: i32, user_data: *(u8)) -> unit);
76
-
53
+ FsEventCallback :: (fn(path : *(u8), events : i32, user_data : *(u8)) -> unit);
77
54
  FsEventHandle :: struct(
78
- handle: *(u8)
55
+ handle : *(u8)
79
56
  );
80
-
81
57
  // Allocate a new fs event handle.
82
58
  fs_event_init :: (fn() -> FsEventHandle)(
83
59
  FsEventHandle(__yo_fs_event_init())
84
60
  );
85
-
86
61
  // Start watching a path.
87
62
  // Returns 0 on success, -errno on failure.
88
- fs_event_start :: (fn(handle: FsEventHandle, path: *(u8), flags: u32, callback: FsEventCallback, user_data: *(u8)) -> i32)(
63
+ fs_event_start :: (fn(handle : FsEventHandle, path : *(u8), flags : u32, callback : FsEventCallback, user_data : *(u8)) -> i32)(
89
64
  __yo_fs_event_start(handle.handle, path, flags, unsafe.cast(callback, *(u8)), user_data)
90
65
  );
91
-
92
66
  // Stop watching.
93
67
  // Returns 0 on success, -errno on failure.
94
- fs_event_stop :: (fn(handle: FsEventHandle) -> i32)(
68
+ fs_event_stop :: (fn(handle : FsEventHandle) -> i32)(
95
69
  __yo_fs_event_stop(handle.handle)
96
70
  );
97
-
98
71
  // Close and free the handle.
99
- fs_event_close :: (fn(handle: FsEventHandle) -> unit)({
72
+ fs_event_close :: (fn(handle : FsEventHandle) -> unit)({
100
73
  __yo_fs_event_close(handle.handle);
101
74
  });
102
-
103
- export
104
- TTY_MODE_NORMAL, TTY_MODE_RAW, TTY_MODE_IO,
105
- POLL_READABLE, POLL_WRITABLE, POLL_DISCONNECT, POLL_PRIORITIZED,
106
- FS_EVENT_WATCH_ENTRY, FS_EVENT_STAT, FS_EVENT_RECURSIVE,
107
- FS_EVENT_RENAME, FS_EVENT_CHANGE,
108
- PollCallback, PollHandle,
109
- poll_init, poll_start, poll_stop, poll_close,
110
- FsEventCallback, FsEventHandle,
111
- fs_event_init, fs_event_start, fs_event_stop, fs_event_close
112
- ;
75
+ export(
76
+ TTY_MODE_NORMAL,
77
+ TTY_MODE_RAW,
78
+ TTY_MODE_IO,
79
+ POLL_READABLE,
80
+ POLL_WRITABLE,
81
+ POLL_DISCONNECT,
82
+ POLL_PRIORITIZED,
83
+ FS_EVENT_WATCH_ENTRY,
84
+ FS_EVENT_STAT,
85
+ FS_EVENT_RECURSIVE,
86
+ FS_EVENT_RENAME,
87
+ FS_EVENT_CHANGE,
88
+ PollCallback,
89
+ PollHandle,
90
+ poll_init,
91
+ poll_start,
92
+ poll_stop,
93
+ poll_close,
94
+ FsEventCallback,
95
+ FsEventHandle,
96
+ fs_event_init,
97
+ fs_event_start,
98
+ fs_event_stop,
99
+ fs_event_close
100
+ );