@shd101wyy/yo 0.1.12 → 0.1.13

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 (164) hide show
  1. package/README.md +10 -1
  2. package/out/cjs/index.cjs +578 -572
  3. package/out/cjs/yo-cli.cjs +1413 -592
  4. package/out/esm/index.mjs +434 -428
  5. package/out/types/src/build-runner.d.ts +1 -1
  6. package/out/types/src/doc/builder.d.ts +21 -0
  7. package/out/types/src/doc/builder.test.d.ts +1 -0
  8. package/out/types/src/doc/extractor.d.ts +27 -0
  9. package/out/types/src/doc/extractor.test.d.ts +1 -0
  10. package/out/types/src/doc/model.d.ts +87 -0
  11. package/out/types/src/doc/render-html.d.ts +23 -0
  12. package/out/types/src/doc/render-html.test.d.ts +1 -0
  13. package/out/types/src/doc/render-json.d.ts +7 -0
  14. package/out/types/src/doc/render-json.test.d.ts +1 -0
  15. package/out/types/src/doc/render-markdown.d.ts +13 -0
  16. package/out/types/src/doc/render-markdown.test.d.ts +1 -0
  17. package/out/types/src/doc/sections.d.ts +7 -0
  18. package/out/types/src/doc/sections.test.d.ts +1 -0
  19. package/out/types/src/doc-command.d.ts +10 -0
  20. package/out/types/src/env.d.ts +1 -0
  21. package/out/types/src/evaluator/builtins/build.d.ts +17 -0
  22. package/out/types/src/evaluator/context.d.ts +1 -0
  23. package/out/types/src/expr.d.ts +2 -1
  24. package/out/types/src/token.d.ts +4 -0
  25. package/out/types/tsconfig.tsbuildinfo +1 -1
  26. package/package.json +2 -1
  27. package/scripts/build-site.ts +461 -0
  28. package/std/alg/hash.yo +12 -24
  29. package/std/allocator.yo +21 -29
  30. package/std/async.yo +4 -2
  31. package/std/build.yo +188 -42
  32. package/std/cli/arg_parser.yo +37 -1
  33. package/std/collections/array_list.yo +8 -20
  34. package/std/collections/btree_map.yo +15 -20
  35. package/std/collections/deque.yo +13 -15
  36. package/std/collections/hash_map.yo +15 -54
  37. package/std/collections/hash_set.yo +14 -50
  38. package/std/collections/linked_list.yo +6 -23
  39. package/std/collections/priority_queue.yo +15 -17
  40. package/std/crypto/md5.yo +10 -9
  41. package/std/crypto/random.yo +14 -12
  42. package/std/crypto/sha256.yo +9 -8
  43. package/std/encoding/base64.yo +13 -15
  44. package/std/encoding/hex.yo +14 -10
  45. package/std/encoding/html.yo +14 -11
  46. package/std/encoding/html_char_utils.yo +14 -11
  47. package/std/encoding/html_entities.yo +7 -8
  48. package/std/encoding/json.yo +36 -19
  49. package/std/encoding/punycode.yo +21 -18
  50. package/std/encoding/toml.yo +23 -9
  51. package/std/encoding/utf16.yo +16 -9
  52. package/std/error.yo +10 -23
  53. package/std/fmt/display.yo +15 -17
  54. package/std/fmt/index.yo +6 -27
  55. package/std/fmt/to_string.yo +4 -10
  56. package/std/fmt/writer.yo +33 -34
  57. package/std/fs/dir.yo +37 -30
  58. package/std/fs/file.yo +77 -75
  59. package/std/fs/metadata.yo +25 -25
  60. package/std/fs/temp.yo +21 -27
  61. package/std/fs/types.yo +20 -23
  62. package/std/fs/walker.yo +26 -31
  63. package/std/gc.yo +5 -0
  64. package/std/glob/index.yo +3 -0
  65. package/std/http/client.yo +25 -11
  66. package/std/http/http.yo +20 -0
  67. package/std/http/index.yo +1 -0
  68. package/std/io/reader.yo +4 -8
  69. package/std/io/writer.yo +4 -7
  70. package/std/libc/assert.yo +2 -2
  71. package/std/libc/ctype.yo +1 -2
  72. package/std/libc/dirent.yo +1 -2
  73. package/std/libc/errno.yo +1 -2
  74. package/std/libc/fcntl.yo +2 -2
  75. package/std/libc/float.yo +1 -2
  76. package/std/libc/limits.yo +1 -2
  77. package/std/libc/math.yo +2 -0
  78. package/std/libc/signal.yo +1 -2
  79. package/std/libc/stdatomic.yo +1 -2
  80. package/std/libc/stdint.yo +4 -3
  81. package/std/libc/stdio.yo +2 -0
  82. package/std/libc/stdlib.yo +2 -0
  83. package/std/libc/string.yo +2 -0
  84. package/std/libc/sys/stat.yo +1 -2
  85. package/std/libc/time.yo +2 -2
  86. package/std/libc/unistd.yo +2 -0
  87. package/std/libc/wctype.yo +1 -2
  88. package/std/libc/windows.yo +2 -2
  89. package/std/log/index.yo +11 -26
  90. package/std/net/addr.yo +18 -11
  91. package/std/net/dns.yo +3 -2
  92. package/std/net/errors.yo +16 -2
  93. package/std/net/tcp.yo +25 -22
  94. package/std/net/udp.yo +14 -12
  95. package/std/os/env.yo +23 -18
  96. package/std/os/signal.yo +31 -19
  97. package/std/path.yo +23 -74
  98. package/std/prelude.yo +284 -113
  99. package/std/process.yo +23 -37
  100. package/std/regex/compiler.yo +3 -5
  101. package/std/regex/flags.yo +11 -11
  102. package/std/regex/index.yo +2 -13
  103. package/std/regex/match.yo +3 -5
  104. package/std/regex/node.yo +6 -6
  105. package/std/regex/parser.yo +2 -4
  106. package/std/regex/unicode.yo +5 -5
  107. package/std/regex/vm.yo +5 -5
  108. package/std/string/index.yo +2 -1
  109. package/std/string/rune.yo +25 -1
  110. package/std/string/string.yo +31 -19
  111. package/std/string/unicode.yo +14 -15
  112. package/std/sync/channel.yo +18 -28
  113. package/std/sync/cond.yo +4 -0
  114. package/std/sync/mutex.yo +4 -1
  115. package/std/sync/once.yo +17 -19
  116. package/std/sync/rwlock.yo +19 -22
  117. package/std/sync/waitgroup.yo +21 -23
  118. package/std/sys/advise.yo +4 -4
  119. package/std/sys/bufio/buf_reader.yo +19 -16
  120. package/std/sys/bufio/buf_writer.yo +14 -11
  121. package/std/sys/clock.yo +4 -4
  122. package/std/sys/constants.yo +5 -5
  123. package/std/sys/copy.yo +9 -8
  124. package/std/sys/dir.yo +9 -8
  125. package/std/sys/dns.yo +8 -8
  126. package/std/sys/errors.yo +35 -6
  127. package/std/sys/events.yo +3 -3
  128. package/std/sys/externs.yo +3 -3
  129. package/std/sys/fallocate.yo +4 -4
  130. package/std/sys/fcntl.yo +8 -6
  131. package/std/sys/file.yo +7 -8
  132. package/std/sys/future.yo +1 -3
  133. package/std/sys/iov.yo +4 -4
  134. package/std/sys/lock.yo +7 -7
  135. package/std/sys/mmap.yo +7 -8
  136. package/std/sys/path.yo +4 -7
  137. package/std/sys/perm.yo +8 -8
  138. package/std/sys/pipe.yo +9 -8
  139. package/std/sys/process.yo +8 -8
  140. package/std/sys/seek.yo +4 -4
  141. package/std/sys/signal.yo +4 -4
  142. package/std/sys/signals.yo +4 -4
  143. package/std/sys/socket.yo +4 -4
  144. package/std/sys/socketpair.yo +4 -4
  145. package/std/sys/sockinfo.yo +4 -4
  146. package/std/sys/statfs.yo +8 -8
  147. package/std/sys/statx.yo +4 -4
  148. package/std/sys/sysinfo.yo +4 -4
  149. package/std/sys/tcp.yo +8 -8
  150. package/std/sys/temp.yo +9 -8
  151. package/std/sys/time.yo +8 -8
  152. package/std/sys/timer.yo +7 -8
  153. package/std/sys/tty.yo +13 -10
  154. package/std/sys/udp.yo +8 -8
  155. package/std/sys/umask.yo +4 -4
  156. package/std/sys/unix.yo +5 -5
  157. package/std/testing/bench.yo +21 -10
  158. package/std/thread.yo +18 -9
  159. package/std/time/datetime.yo +12 -14
  160. package/std/time/duration.yo +12 -14
  161. package/std/time/instant.yo +13 -16
  162. package/std/time/sleep.yo +9 -8
  163. package/std/url/index.yo +3 -19
  164. package/std/worker.yo +10 -18
package/std/sync/cond.yo CHANGED
@@ -1,3 +1,5 @@
1
+ //! Condition variable for thread synchronization.
2
+
1
3
  { __YO_THREAD_SYNC_TYPE, mutex_t, Mutex } :: import "./mutex";
2
4
 
3
5
  extern "Yo",
@@ -9,6 +11,7 @@ extern "Yo",
9
11
  __yo_cond_destroy : (fn(cv : *(__YO_COND_TYPE)) -> unit)
10
12
  ;
11
13
 
14
+ /// Low-level condition variable (manual lifetime via `destroy`).
12
15
  cond_t :: newtype(
13
16
  cv : __YO_COND_TYPE
14
17
  );
@@ -34,6 +37,7 @@ impl(cond_t,
34
37
  })
35
38
  );
36
39
 
40
+ /// Reference-counted condition variable with automatic cleanup via `Dispose`.
37
41
  Cond :: object(
38
42
  cv : __YO_COND_TYPE
39
43
  );
package/std/sync/mutex.yo CHANGED
@@ -1,3 +1,5 @@
1
+ //! Mutual exclusion lock primitives.
2
+
1
3
  extern "Yo",
2
4
  __YO_THREAD_SYNC_TYPE : Type,
3
5
  __yo_mutex_create : (fn() -> __YO_THREAD_SYNC_TYPE),
@@ -6,6 +8,7 @@ extern "Yo",
6
8
  __yo_mutex_destroy : (fn(mutex : *(__YO_THREAD_SYNC_TYPE)) -> unit)
7
9
  ;
8
10
 
11
+ /// Low-level mutex (manual lifetime via `destroy`).
9
12
  mutex_t :: newtype(
10
13
  mutex : __YO_THREAD_SYNC_TYPE
11
14
  );
@@ -27,7 +30,7 @@ impl(mutex_t,
27
30
  })
28
31
  );
29
32
 
30
- // GC managed
33
+ /// Reference-counted mutex with automatic cleanup via `Dispose`.
31
34
  Mutex :: object(
32
35
  mutex : __YO_THREAD_SYNC_TYPE
33
36
  );
package/std/sync/once.yo CHANGED
@@ -1,25 +1,23 @@
1
- // std/sync/once.yo - One-time initialization
2
- //
3
- // Execute a function exactly once, thread-safely.
4
- //
5
- // Example:
6
- // { Once } :: import "std/sync/once";
7
- //
8
- // init := Once.new();
9
- // // Only the first call executes the function
10
- // init.call(() => {
11
- // println("initialized!");
12
- // });
13
- // init.call(() => {
14
- // println("this will NOT run");
15
- // });
1
+ //! One-time initialization primitive.
2
+ //!
3
+ //! # Example
4
+ //!
5
+ //! ```rust
6
+ //! { Once } :: import "std/sync/once";
7
+ //!
8
+ //! init := Once.new();
9
+ //! // Only the first call executes the function
10
+ //! init.call(() => {
11
+ //! println("initialized!");
12
+ //! });
13
+ //! init.call(() => {
14
+ //! println("this will NOT run");
15
+ //! });
16
+ //! ```
16
17
 
17
18
  { Mutex } :: import "./mutex";
18
19
 
19
- // ============================================================================
20
- // Once
21
- // ============================================================================
22
-
20
+ /// Execute a function exactly once, thread-safely.
23
21
  Once :: object(
24
22
  _done : bool,
25
23
  _mutex : Mutex
@@ -1,29 +1,26 @@
1
- // std/sync/rwlock.yo - Reader-Writer Lock
2
- //
3
- // Allows multiple concurrent readers or one exclusive writer.
4
- // Uses Mutex + Cond internally.
5
- //
6
- // Example:
7
- // { RwLock } :: import "std/sync/rwlock";
8
- //
9
- // lock := RwLock.new();
10
- // // Multiple readers can hold the lock simultaneously
11
- // lock.read_lock();
12
- // // ... read shared data ...
13
- // lock.read_unlock();
14
- //
15
- // // Only one writer at a time, blocks all readers
16
- // lock.write_lock();
17
- // // ... write shared data ...
18
- // lock.write_unlock();
1
+ //! Reader-writer lock allowing multiple concurrent readers or one exclusive writer.
2
+ //!
3
+ //! # Example
4
+ //!
5
+ //! ```rust
6
+ //! { RwLock } :: import "std/sync/rwlock";
7
+ //!
8
+ //! lock := RwLock.new();
9
+ //! // Multiple readers can hold the lock simultaneously
10
+ //! lock.read_lock();
11
+ //! // ... read shared data ...
12
+ //! lock.read_unlock();
13
+ //!
14
+ //! // Only one writer at a time, blocks all readers
15
+ //! lock.write_lock();
16
+ //! // ... write shared data ...
17
+ //! lock.write_unlock();
18
+ //! ```
19
19
 
20
20
  { Mutex } :: import "./mutex";
21
21
  { Cond } :: import "./cond";
22
22
 
23
- // ============================================================================
24
- // RwLock
25
- // ============================================================================
26
-
23
+ /// Reader-writer lock built on `Mutex` and `Cond`.
27
24
  RwLock :: object(
28
25
  _readers : i32,
29
26
  _writer : bool,
@@ -1,30 +1,28 @@
1
- // std/sync/waitgroup.yo - WaitGroup
2
- //
3
- // Wait for a group of tasks to complete. Similar to Go's sync.WaitGroup.
4
- //
5
- // Example:
6
- // { WaitGroup } :: import "std/sync/waitgroup";
7
- // { Thread } :: import "std/thread";
8
- //
9
- // wg := WaitGroup.new();
10
- // wg.add(i32(3));
11
- // i := i32(0);
12
- // while runtime((i < i32(3))), {
13
- // t := Thread.spawn(() => {
14
- // // ... do work ...
15
- // wg.done();
16
- // });
17
- // i = (i + i32(1));
18
- // };
19
- // wg.wait(); // blocks until all 3 tasks call done()
1
+ //! Wait for a group of tasks to complete, similar to Go's `sync.WaitGroup`.
2
+ //!
3
+ //! # Example
4
+ //!
5
+ //! ```rust
6
+ //! { WaitGroup } :: import "std/sync/waitgroup";
7
+ //! { Thread } :: import "std/thread";
8
+ //!
9
+ //! wg := WaitGroup.new();
10
+ //! wg.add(i32(3));
11
+ //! i := i32(0);
12
+ //! while runtime((i < i32(3))), {
13
+ //! t := Thread.spawn(() => {
14
+ //! // ... do work ...
15
+ //! wg.done();
16
+ //! });
17
+ //! i = (i + i32(1));
18
+ //! };
19
+ //! wg.wait(); // blocks until all 3 tasks call done()
20
+ //! ```
20
21
 
21
22
  { Mutex } :: import "./mutex";
22
23
  { Cond } :: import "./cond";
23
24
 
24
- // ============================================================================
25
- // WaitGroup
26
- // ============================================================================
27
-
25
+ /// Synchronization primitive that blocks until a counter reaches zero.
28
26
  WaitGroup :: object(
29
27
  _count : i32,
30
28
  _mutex : Mutex,
package/std/sys/advise.yo CHANGED
@@ -1,7 +1,7 @@
1
- // std/sys/advise.yo - Kernel advisory hints
2
- //
3
- // Advisory wrappers for file and memory access pattern hints.
4
- // Returns 0 on success, -errno / negative platform error on failure.
1
+ //! Kernel advisory hints.
2
+ //!
3
+ //! Advisory wrappers for file and memory access pattern hints.
4
+ //! Returns 0 on success, -errno / negative platform error on failure.
5
5
 
6
6
  {
7
7
  __yo_sync_fadvise,
@@ -1,19 +1,22 @@
1
- // std/sys/bufio/buf_reader.yo - Buffered reader for file descriptors
2
- //
3
- // Wraps a file descriptor with an internal buffer for efficient reads.
4
- // Reduces the number of system calls by reading data in larger chunks.
5
- //
6
- // Example:
7
- // { BufReader } :: import "std/sys/bufio/buf_reader";
8
- // IO_file :: import "std/sys/file";
9
- //
10
- // reader := BufReader.new(fd);
11
- // line := io.await(reader.read_line(using(io)));
12
- // match(line,
13
- // .Ok(.Some(s)) => println(s),
14
- // .Ok(.None) => println("EOF"),
15
- // .Err(e) => println(e.to_string())
16
- // );
1
+ //! Buffered reader for file descriptors.
2
+ //!
3
+ //! Wraps a file descriptor with an internal buffer for efficient reads.
4
+ //! Reduces the number of system calls by reading data in larger chunks.
5
+ //!
6
+ //! # Example
7
+ //!
8
+ //! ```rust
9
+ //! { BufReader } :: import "std/sys/bufio/buf_reader";
10
+ //! IO_file :: import "std/sys/file";
11
+ //!
12
+ //! reader := BufReader.new(fd);
13
+ //! line := io.await(reader.read_line(using(io)));
14
+ //! match(line,
15
+ //! .Ok(.Some(s)) => println(s),
16
+ //! .Ok(.None) => println("EOF"),
17
+ //! .Err(e) => println(e.to_string())
18
+ //! );
19
+ //! ```
17
20
 
18
21
  { ArrayList } :: import "../../collections/array_list";
19
22
  open import "../../string";
@@ -1,14 +1,17 @@
1
- // std/sys/bufio/buf_writer.yo - Buffered writer for file descriptors
2
- //
3
- // Wraps a file descriptor with an internal buffer for efficient writes.
4
- // Reduces the number of system calls by batching small writes together.
5
- //
6
- // Example:
7
- // { BufWriter } :: import "std/sys/bufio/buf_writer";
8
- //
9
- // writer := BufWriter.new(fd);
10
- // io.await(writer.write_string(String.from("hello\n"), using(io)));
11
- // io.await(writer.flush(using(io)));
1
+ //! Buffered writer for file descriptors.
2
+ //!
3
+ //! Wraps a file descriptor with an internal buffer for efficient writes.
4
+ //! Reduces the number of system calls by batching small writes together.
5
+ //!
6
+ //! # Example
7
+ //!
8
+ //! ```rust
9
+ //! { BufWriter } :: import "std/sys/bufio/buf_writer";
10
+ //!
11
+ //! writer := BufWriter.new(fd);
12
+ //! io.await(writer.write_string(`hello\n`, using(io)));
13
+ //! io.await(writer.flush(using(io)));
14
+ //! ```
12
15
 
13
16
  { ArrayList } :: import "../../collections/array_list";
14
17
  open import "../../string";
package/std/sys/clock.yo CHANGED
@@ -1,7 +1,7 @@
1
- // std/sys/clock.yo - High-resolution clock queries
2
- //
3
- // Provides a synchronous wrapper for reading wall-clock and monotonic time.
4
- // Returns 0 on success, -errno / negative platform error on failure.
1
+ //! High-resolution clock queries.
2
+ //!
3
+ //! Provides a synchronous wrapper for reading wall-clock and monotonic time.
4
+ //! Returns 0 on success, -errno / negative platform error on failure.
5
5
 
6
6
  { platform, Platform } :: import "../process";
7
7
  { __yo_sync_clock_gettime } :: import "./externs.yo";
@@ -1,8 +1,8 @@
1
- // std/sys/constants.yo - File system constants
2
- //
3
- // File mode bits, permission bits, AT_* flags, open flags,
4
- // access mode constants, copyfile flags, directory entry types,
5
- // and default permission modes.
1
+ //! File system constants.
2
+ //!
3
+ //! File mode bits, permission bits, `AT_*` flags, open flags,
4
+ //! access mode constants, copyfile flags, directory entry types,
5
+ //! and default permission modes.
6
6
 
7
7
  { platform, Platform } :: import "../process";
8
8
 
package/std/sys/copy.yo CHANGED
@@ -1,11 +1,12 @@
1
- // std/sys/copy.yo - File copy operations
2
- //
3
- // Synchronous wrappers for copyfile/sendfile.
4
- // These are inherently synchronous on all platforms.
5
- //
6
- // Return values:
7
- // - copyfile: 0 on success, -errno on failure
8
- // - sendfile: bytes transferred on success, -errno on failure
1
+ //! File copy operations.
2
+ //!
3
+ //! Synchronous wrappers for `copyfile`/`sendfile`.
4
+ //! These are inherently synchronous on all platforms.
5
+ //!
6
+ //! ## Return values
7
+ //!
8
+ //! - `copyfile`: 0 on success, -errno on failure
9
+ //! - `sendfile`: bytes transferred on success, -errno on failure
9
10
 
10
11
  { __yo_sync_copyfile, __yo_sync_sendfile } :: import "./externs.yo";
11
12
 
package/std/sys/dir.yo CHANGED
@@ -1,11 +1,12 @@
1
- // std/sys/dir.yo - Directory operations
2
- //
3
- // Provides low-level directory manipulation wrappers around C runtime externs.
4
- //
5
- // Async operations (mkdir, unlink, rename, symlink, link, getdents) return IOFuture which resolves to:
6
- // - 0 on success (for mkdir, unlink, rename, symlink, link)
7
- // - Bytes read for getdents
8
- // - Negative value: -errno on failure
1
+ //! Directory operations.
2
+ //!
3
+ //! Provides low-level directory manipulation wrappers around C runtime externs.
4
+ //!
5
+ //! Async operations (`mkdir`, `unlink`, `rename`, `symlink`, `link`, `getdents`)
6
+ //! return `IOFuture` which resolves to:
7
+ //! - 0 on success (for mkdir, unlink, rename, symlink, link)
8
+ //! - Bytes read for getdents
9
+ //! - Negative value: -errno on failure
9
10
  //
10
11
  // Sync operations (readlink) return i32 directly:
11
12
  // - Bytes read on success
package/std/sys/dns.yo CHANGED
@@ -1,11 +1,11 @@
1
- // std/sys/dns.yo - DNS resolution operations
2
- //
3
- // Provides async DNS resolution wrapping getaddrinfo/getnameinfo, plus
4
- // accessors for iterating the linked list of addrinfo results.
5
- //
6
- // All async operations return IOFuture which resolves to:
7
- // - 0: success
8
- // - Non-zero: raw gai_error code (EAI_NONAME, EAI_AGAIN, etc.)
1
+ //! DNS resolution operations.
2
+ //!
3
+ //! Provides async DNS resolution wrapping `getaddrinfo`/`getnameinfo`, plus
4
+ //! accessors for iterating the linked list of `addrinfo` results.
5
+ //!
6
+ //! All async operations return `IOFuture` which resolves to:
7
+ //! - 0: success
8
+ //! - Non-zero: raw `gai_error` code (`EAI_NONAME`, `EAI_AGAIN`, etc.)
9
9
  //
10
10
  // Example:
11
11
  // { GlobalAllocator } :: import "../allocator";
package/std/sys/errors.yo CHANGED
@@ -1,6 +1,4 @@
1
- // std/sys/errors.yo - IOError type
2
- //
3
- // Comprehensive I/O error type with errno-to-error mapping.
1
+ //! `IOError` type — comprehensive I/O error type with errno-to-error mapping.
4
2
 
5
3
  { String } :: import "../string";
6
4
  { ToString } :: import "../fmt";
@@ -17,44 +15,75 @@
17
15
  // IOError - I/O error type
18
16
  // ============================================================================
19
17
 
18
+ /// Comprehensive I/O error type with errno-to-error mapping.
20
19
  IOError :: enum(
21
- // File system errors
20
+ /// File or directory not found (ENOENT).
22
21
  NotFound,
22
+ /// Permission denied (EACCES, EPERM).
23
23
  PermissionDenied,
24
+ /// File or directory already exists (EEXIST).
24
25
  AlreadyExists,
26
+ /// Not a directory (ENOTDIR).
25
27
  NotADirectory,
28
+ /// Is a directory (EISDIR).
26
29
  IsADirectory,
30
+ /// Directory not empty (ENOTEMPTY).
27
31
  DirectoryNotEmpty,
32
+ /// Broken pipe (EPIPE).
28
33
  BrokenPipe,
34
+ /// Operation would block (EAGAIN, EWOULDBLOCK).
29
35
  WouldBlock,
36
+ /// Invalid argument (EINVAL).
30
37
  InvalidInput,
38
+ /// Interrupted system call (EINTR).
31
39
  Interrupted,
40
+ /// Too many open files (EMFILE, ENFILE).
32
41
  TooManyOpenFiles,
42
+ /// File too large (EFBIG).
33
43
  FileTooLarge,
44
+ /// No space left on device (ENOSPC).
34
45
  NoSpace,
46
+ /// Read-only filesystem (EROFS).
35
47
  ReadOnlyFilesystem,
48
+ /// Cross-device link (EXDEV).
36
49
  CrossDeviceLink,
50
+ /// Too many links (EMLINK).
37
51
  TooManyLinks,
52
+ /// File name too long (ENAMETOOLONG).
38
53
  NameTooLong,
54
+ /// Operation not supported (ENOTSUP, EOPNOTSUPP).
39
55
  NotSupported,
56
+ /// Operation timed out (ETIMEDOUT).
40
57
  TimedOut,
58
+ /// Resource busy (EBUSY).
41
59
  Busy,
60
+ /// Bad file descriptor (EBADF).
42
61
  BadFileDescriptor,
62
+ /// Generic I/O error (EIO).
43
63
  IOError,
44
64
 
45
- // Network errors
65
+ /// Connection refused (ECONNREFUSED).
46
66
  ConnectionRefused,
67
+ /// Connection reset by peer (ECONNRESET).
47
68
  ConnectionReset,
69
+ /// Connection aborted (ECONNABORTED).
48
70
  ConnectionAborted,
71
+ /// Not connected (ENOTCONN).
49
72
  NotConnected,
73
+ /// Address already in use (EADDRINUSE).
50
74
  AddressInUse,
75
+ /// Address not available (EADDRNOTAVAIL).
51
76
  AddressNotAvailable,
77
+ /// Network unreachable (ENETUNREACH).
52
78
  NetworkUnreachable,
79
+ /// Host unreachable (EHOSTUNREACH).
53
80
  HostUnreachable,
81
+ /// Network is down (ENETDOWN).
54
82
  NetworkDown,
83
+ /// Already connected (EISCONN).
55
84
  AlreadyConnected,
56
85
 
57
- // Generic
86
+ /// Other error with raw errno code.
58
87
  Other(code: i32)
59
88
  );
60
89
 
package/std/sys/events.yo CHANGED
@@ -1,4 +1,4 @@
1
- // std/sys/events.yo - TTY, Poll, and FS Event constants
1
+ //! TTY, Poll, and FS Event constants.
2
2
 
3
3
  {
4
4
  __yo_fs_event_init, __yo_fs_event_start,
@@ -54,7 +54,7 @@ poll_init :: (fn(fd: i32) -> PollHandle)(
54
54
  // Start polling for events.
55
55
  // Returns 0 on success, -errno on failure.
56
56
  poll_start :: (fn(handle: PollHandle, events: i32, callback: PollCallback, user_data: *(u8)) -> i32)(
57
- __yo_poll_start(handle.handle, events, __yo_as(callback, *(u8)), user_data)
57
+ __yo_poll_start(handle.handle, events, unsafe.cast(callback, *(u8)), user_data)
58
58
  );
59
59
 
60
60
  // Stop polling.
@@ -86,7 +86,7 @@ fs_event_init :: (fn() -> FsEventHandle)(
86
86
  // Start watching a path.
87
87
  // Returns 0 on success, -errno on failure.
88
88
  fs_event_start :: (fn(handle: FsEventHandle, path: *(u8), flags: u32, callback: FsEventCallback, user_data: *(u8)) -> i32)(
89
- __yo_fs_event_start(handle.handle, path, flags, __yo_as(callback, *(u8)), user_data)
89
+ __yo_fs_event_start(handle.handle, path, flags, unsafe.cast(callback, *(u8)), user_data)
90
90
  );
91
91
 
92
92
  // Stop watching.
@@ -1,6 +1,6 @@
1
- // std/sys/externs.yo - Extern C runtime function declarations
2
- //
3
- // All low-level extern functions for async I/O operations.
1
+ //! Extern C runtime function declarations.
2
+ //!
3
+ //! All low-level extern functions for async I/O operations.
4
4
 
5
5
  { IOFuture } :: import "./future.yo";
6
6
 
@@ -1,7 +1,7 @@
1
- // std/sys/fallocate.yo - File space pre-allocation
2
- //
3
- // Synchronous wrapper for fallocate-style allocation.
4
- // Returns 0 on success, -errno on failure.
1
+ //! File space pre-allocation.
2
+ //!
3
+ //! Synchronous wrapper for `fallocate`-style allocation.
4
+ //! Returns 0 on success, -errno on failure.
5
5
 
6
6
  { __yo_sync_fallocate } :: import "./externs.yo";
7
7
 
package/std/sys/fcntl.yo CHANGED
@@ -1,9 +1,11 @@
1
- // std/sys/fcntl.yo - File descriptor control operations
2
- //
3
- // Synchronous wrappers for file descriptor flags and close-on-exec flags.
4
- // Returns:
5
- // - getfl/getfd: flags on success, -errno on failure
6
- // - setfl/setfd: 0 on success, -errno on failure
1
+ //! File descriptor control operations.
2
+ //!
3
+ //! Synchronous wrappers for file descriptor flags and close-on-exec flags.
4
+ //!
5
+ //! ## Returns
6
+ //!
7
+ //! - `getfl`/`getfd`: flags on success, -errno on failure
8
+ //! - `setfl`/`setfd`: 0 on success, -errno on failure
7
9
 
8
10
  {
9
11
  __yo_sync_fcntl_getfl,
package/std/sys/file.yo CHANGED
@@ -1,11 +1,10 @@
1
- // std/sys/file.yo - Async and sync file operations
2
- //
3
- // Provides low-level file I/O wrappers around the C runtime externs.
4
- //
5
- // Async operations return IOFuture which resolves to:
6
- // - Positive value: success (fd for open, bytes for read/write, 0 for others)
7
- // - Negative value: -errno on failure
8
- //
1
+ //! Async and sync file operations.
2
+ //!
3
+ //! Provides low-level file I/O wrappers around the C runtime externs.
4
+ //!
5
+ //! Async operations return `IOFuture` which resolves to:
6
+ //! - Positive value: success (fd for open, bytes for read/write, 0 for others)
7
+ //! - Negative value: -errno on failure
9
8
  // Use IOError.from_result() to convert results to Result(i32, IOError).
10
9
  //
11
10
  // Example:
package/std/sys/future.yo CHANGED
@@ -1,6 +1,4 @@
1
- // std/sys/future.yo - IOFuture type
2
- //
3
- // Opaque handle to C async I/O future struct.
1
+ //! `IOFuture` type — opaque handle to a C async I/O future struct.
4
2
 
5
3
  // ============================================================================
6
4
  // Extern type for I/O Future
package/std/sys/iov.yo CHANGED
@@ -1,7 +1,7 @@
1
- // std/sys/iov.yo - Scatter/gather I/O
2
- //
3
- // Synchronous wrappers for vectored file descriptor I/O.
4
- // Returns byte count on success, -errno / negative platform error on failure.
1
+ //! Scatter/gather I/O.
2
+ //!
3
+ //! Synchronous wrappers for vectored file descriptor I/O.
4
+ //! Returns byte count on success, -errno / negative platform error on failure.
5
5
 
6
6
  {
7
7
  __yo_sync_readv,
package/std/sys/lock.yo CHANGED
@@ -1,10 +1,10 @@
1
- // std/sys/lock.yo - Advisory file locking
2
- //
3
- // Synchronous wrapper for POSIX flock().
4
- // Returns 0 on success, -errno on failure.
5
- //
6
- // Operations can be OR'd with LOCK_NB for non-blocking.
7
- // LOCK_NB returns -EWOULDBLOCK (-11) if the lock cannot be acquired immediately.
1
+ //! Advisory file locking.
2
+ //!
3
+ //! Synchronous wrapper for POSIX `flock()`.
4
+ //! Returns 0 on success, -errno on failure.
5
+ //!
6
+ //! Operations can be OR'd with `LOCK_NB` for non-blocking.
7
+ //! `LOCK_NB` returns -EWOULDBLOCK (-11) if the lock cannot be acquired immediately.
8
8
 
9
9
  { __yo_sync_flock } :: import "./externs.yo";
10
10
 
package/std/sys/mmap.yo CHANGED
@@ -1,11 +1,10 @@
1
- // std/sys/mmap.yo - Memory-mapped I/O operations
2
- //
3
- // Synchronous wrappers for mmap/munmap/mprotect/msync.
4
- //
5
- // mmap returns:
6
- // - mapped pointer on success
7
- // - encoded error pointer on failure (negative errno cast to pointer)
8
- //
1
+ //! Memory-mapped I/O operations.
2
+ //!
3
+ //! Synchronous wrappers for `mmap`/`munmap`/`mprotect`/`msync`.
4
+ //!
5
+ //! `mmap` returns:
6
+ //! - Mapped pointer on success
7
+ //! - Encoded error pointer on failure (negative errno cast to pointer)
9
8
  // Use is_error(ptr) and error_code(ptr) to detect/decode mmap failures.
10
9
 
11
10
  { platform, Platform } :: import "../process";
package/std/sys/path.yo CHANGED
@@ -1,10 +1,7 @@
1
- // std/sys/path.yo - Path resolution
2
- //
3
- // Synchronous wrapper for realpath.
4
- // This is inherently synchronous on all platforms.
5
- //
6
- // Return values:
7
- // - realpath: 0 on success, -errno on failure
1
+ //! Path resolution.
2
+ //!
3
+ //! Synchronous wrapper for `realpath`.
4
+ //! Returns 0 on success, -errno on failure.
8
5
 
9
6
  { __yo_sync_realpath } :: import "./externs.yo";
10
7
 
package/std/sys/perm.yo CHANGED
@@ -1,11 +1,11 @@
1
- // std/sys/perm.yo - File permission and access operations
2
- //
3
- // Provides synchronous wrappers for chmod, chown, and access operations.
4
- // All operations return i32 directly (no IOFuture overhead).
5
- //
6
- // Returns:
7
- // - 0: success
8
- // - Negative value: -errno on failure
1
+ //! File permission and access operations.
2
+ //!
3
+ //! Provides synchronous wrappers for `chmod`, `chown`, and `access` operations.
4
+ //! All operations return `i32` directly (no `IOFuture` overhead).
5
+ //!
6
+ //! Returns:
7
+ //! - 0: success
8
+ //! - Negative value: -errno on failure
9
9
  //
10
10
  // Example:
11
11
  // perm :: import "std/sys/perm";