@shd101wyy/yo 0.1.26 → 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 (167) hide show
  1. package/.github/skills/yo-async-effects/SKILL.md +4 -4
  2. package/.github/skills/yo-async-effects/async-effects-recipes.md +34 -34
  3. package/.github/skills/yo-core-patterns/SKILL.md +1 -1
  4. package/.github/skills/yo-core-patterns/core-patterns-cheatsheet.md +26 -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 +73 -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 +456 -438
  12. package/out/cjs/yo-cli.cjs +576 -543
  13. package/out/cjs/yo-lsp.cjs +559 -532
  14. package/out/esm/index.mjs +281 -263
  15. package/out/types/src/formatter.d.ts +11 -0
  16. package/out/types/src/lsp/formatting.d.ts +2 -0
  17. package/out/types/src/tests/formatter.test.d.ts +1 -0
  18. package/out/types/tsconfig.tsbuildinfo +1 -1
  19. package/package.json +1 -1
  20. package/std/alg/hash.yo +13 -21
  21. package/std/allocator.yo +25 -40
  22. package/std/async.yo +3 -7
  23. package/std/build.yo +105 -151
  24. package/std/cli/arg_parser.yo +184 -169
  25. package/std/collections/array_list.yo +350 -314
  26. package/std/collections/btree_map.yo +142 -131
  27. package/std/collections/deque.yo +132 -128
  28. package/std/collections/hash_map.yo +542 -566
  29. package/std/collections/hash_set.yo +623 -687
  30. package/std/collections/linked_list.yo +275 -293
  31. package/std/collections/ordered_map.yo +113 -85
  32. package/std/collections/priority_queue.yo +73 -73
  33. package/std/crypto/md5.yo +191 -95
  34. package/std/crypto/random.yo +56 -64
  35. package/std/crypto/sha256.yo +151 -107
  36. package/std/encoding/base64.yo +87 -81
  37. package/std/encoding/hex.yo +43 -50
  38. package/std/encoding/html.yo +56 -81
  39. package/std/encoding/html_char_utils.yo +7 -13
  40. package/std/encoding/html_entities.yo +2248 -2253
  41. package/std/encoding/json.yo +316 -224
  42. package/std/encoding/punycode.yo +86 -116
  43. package/std/encoding/toml.yo +67 -66
  44. package/std/encoding/utf16.yo +37 -44
  45. package/std/env.yo +62 -91
  46. package/std/error.yo +7 -15
  47. package/std/fmt/display.yo +5 -9
  48. package/std/fmt/index.yo +8 -14
  49. package/std/fmt/to_string.yo +330 -315
  50. package/std/fmt/writer.yo +58 -87
  51. package/std/fs/dir.yo +83 -102
  52. package/std/fs/file.yo +147 -180
  53. package/std/fs/metadata.yo +45 -78
  54. package/std/fs/temp.yo +55 -65
  55. package/std/fs/types.yo +27 -40
  56. package/std/fs/walker.yo +53 -68
  57. package/std/gc.yo +5 -8
  58. package/std/glob.yo +30 -43
  59. package/std/http/client.yo +107 -120
  60. package/std/http/http.yo +106 -96
  61. package/std/http/index.yo +4 -6
  62. package/std/imm/list.yo +88 -93
  63. package/std/imm/map.yo +528 -464
  64. package/std/imm/set.yo +52 -57
  65. package/std/imm/sorted_map.yo +340 -286
  66. package/std/imm/sorted_set.yo +57 -63
  67. package/std/imm/string.yo +404 -345
  68. package/std/imm/vec.yo +173 -181
  69. package/std/io/reader.yo +3 -6
  70. package/std/io/writer.yo +4 -8
  71. package/std/libc/assert.yo +5 -9
  72. package/std/libc/ctype.yo +32 -22
  73. package/std/libc/dirent.yo +26 -25
  74. package/std/libc/errno.yo +164 -90
  75. package/std/libc/fcntl.yo +52 -45
  76. package/std/libc/float.yo +66 -44
  77. package/std/libc/limits.yo +42 -33
  78. package/std/libc/math.yo +53 -82
  79. package/std/libc/signal.yo +72 -47
  80. package/std/libc/stdatomic.yo +217 -188
  81. package/std/libc/stdint.yo +5 -29
  82. package/std/libc/stdio.yo +5 -29
  83. package/std/libc/stdlib.yo +32 -39
  84. package/std/libc/string.yo +5 -23
  85. package/std/libc/sys/stat.yo +58 -56
  86. package/std/libc/time.yo +5 -19
  87. package/std/libc/unistd.yo +5 -20
  88. package/std/libc/wctype.yo +6 -9
  89. package/std/libc/windows.yo +26 -30
  90. package/std/log.yo +41 -55
  91. package/std/net/addr.yo +102 -97
  92. package/std/net/dns.yo +27 -28
  93. package/std/net/errors.yo +50 -49
  94. package/std/net/tcp.yo +113 -124
  95. package/std/net/udp.yo +55 -66
  96. package/std/os/env.yo +35 -33
  97. package/std/os/signal.yo +15 -25
  98. package/std/path.yo +276 -311
  99. package/std/prelude.yo +6304 -4315
  100. package/std/process/command.yo +87 -103
  101. package/std/process/index.yo +12 -31
  102. package/std/regex/compiler.yo +196 -95
  103. package/std/regex/flags.yo +58 -39
  104. package/std/regex/index.yo +157 -173
  105. package/std/regex/match.yo +20 -31
  106. package/std/regex/node.yo +134 -152
  107. package/std/regex/parser.yo +283 -259
  108. package/std/regex/unicode.yo +172 -202
  109. package/std/regex/vm.yo +155 -171
  110. package/std/string/index.yo +5 -7
  111. package/std/string/rune.yo +45 -55
  112. package/std/string/string.yo +937 -964
  113. package/std/string/string_builder.yo +94 -104
  114. package/std/string/unicode.yo +46 -64
  115. package/std/sync/channel.yo +72 -73
  116. package/std/sync/cond.yo +31 -36
  117. package/std/sync/mutex.yo +30 -32
  118. package/std/sync/once.yo +13 -16
  119. package/std/sync/rwlock.yo +26 -31
  120. package/std/sync/waitgroup.yo +20 -25
  121. package/std/sys/advise.yo +16 -24
  122. package/std/sys/bufio/buf_reader.yo +77 -93
  123. package/std/sys/bufio/buf_writer.yo +52 -65
  124. package/std/sys/clock.yo +4 -9
  125. package/std/sys/constants.yo +77 -61
  126. package/std/sys/copy.yo +4 -10
  127. package/std/sys/dir.yo +26 -43
  128. package/std/sys/dns.yo +41 -61
  129. package/std/sys/errors.yo +95 -103
  130. package/std/sys/events.yo +45 -57
  131. package/std/sys/externs.yo +319 -267
  132. package/std/sys/fallocate.yo +7 -11
  133. package/std/sys/fcntl.yo +14 -22
  134. package/std/sys/file.yo +26 -40
  135. package/std/sys/future.yo +5 -8
  136. package/std/sys/iov.yo +12 -25
  137. package/std/sys/lock.yo +12 -13
  138. package/std/sys/mmap.yo +38 -43
  139. package/std/sys/path.yo +3 -8
  140. package/std/sys/perm.yo +7 -21
  141. package/std/sys/pipe.yo +5 -12
  142. package/std/sys/process.yo +23 -29
  143. package/std/sys/seek.yo +10 -12
  144. package/std/sys/signal.yo +7 -13
  145. package/std/sys/signals.yo +52 -35
  146. package/std/sys/socket.yo +63 -58
  147. package/std/sys/socketpair.yo +3 -6
  148. package/std/sys/sockinfo.yo +11 -20
  149. package/std/sys/statfs.yo +11 -34
  150. package/std/sys/statx.yo +25 -52
  151. package/std/sys/sysinfo.yo +15 -20
  152. package/std/sys/tcp.yo +62 -92
  153. package/std/sys/temp.yo +5 -9
  154. package/std/sys/time.yo +5 -15
  155. package/std/sys/timer.yo +6 -11
  156. package/std/sys/tty.yo +10 -18
  157. package/std/sys/udp.yo +22 -39
  158. package/std/sys/umask.yo +3 -6
  159. package/std/sys/unix.yo +33 -52
  160. package/std/testing/bench.yo +49 -52
  161. package/std/thread.yo +10 -15
  162. package/std/time/datetime.yo +105 -89
  163. package/std/time/duration.yo +43 -56
  164. package/std/time/instant.yo +13 -18
  165. package/std/time/sleep.yo +5 -9
  166. package/std/url/index.yo +184 -209
  167. package/std/worker.yo +6 -10
@@ -1,22 +1,19 @@
1
1
  //! C11 `<assert.h>` — assertion debugging facility.
2
2
  //! Provides runtime assertion checking for debugging.
3
-
4
- c_include "<assert.h>",
3
+ c_include(
4
+ "<assert.h>",
5
5
  // The actual assertion function called by the assert macro
6
6
  // This is typically called __assert_fail or similar in libc implementations
7
7
  __assert_fail :
8
8
  fn(assertion : *(char), file : *(char), line : uint, function : *(char)) -> unit,
9
-
10
9
  // Alternative assertion function (some implementations)
11
10
  __assert :
12
11
  fn(assertion : *(char), file : *(char), line : int) -> unit,
13
-
14
12
  // C11 static_assert is handled by the compiler, not runtime
15
13
  // But some implementations provide a function version for diagnostics
16
14
  _Static_assert_fail :
17
15
  fn(message : *(char)) -> unit
18
- ;
19
-
16
+ );
20
17
  // Note: In C, assert is typically implemented as a macro:
21
18
  // #ifdef NDEBUG
22
19
  // #define assert(expr) ((void)0)
@@ -29,11 +26,10 @@ c_include "<assert.h>",
29
26
  // 1. Call __assert_fail directly when assertions fail
30
27
  // 2. Use conditional compilation at the language level
31
28
  // 3. Or implement assertion logic in their application code
32
-
33
29
  // Export assert functionality
34
- export
30
+ export(
35
31
  // Low-level assertion functions from C runtime
36
32
  __assert_fail,
37
33
  __assert,
38
34
  _Static_assert_fail
39
- ;
35
+ );
package/std/libc/ctype.yo CHANGED
@@ -1,41 +1,52 @@
1
1
  //! C11 `<ctype.h>` — character classification and conversion functions.
2
-
3
- c_include "<ctype.h>",
2
+ c_include(
3
+ "<ctype.h>",
4
4
  // Character classification functions
5
5
  isalnum :
6
- fn(c : int) -> int, // alphanumeric character
6
+ fn(c : int) -> int,
7
+ // alphanumeric character
7
8
  isalpha :
8
- fn(c : int) -> int, // alphabetic character
9
+ fn(c : int) -> int,
10
+ // alphabetic character
9
11
  isblank :
10
- fn(c : int) -> int, // blank character (C99/C11)
12
+ fn(c : int) -> int,
13
+ // blank character (C99/C11)
11
14
  iscntrl :
12
- fn(c : int) -> int, // control character
15
+ fn(c : int) -> int,
16
+ // control character
13
17
  isdigit :
14
- fn(c : int) -> int, // decimal digit
18
+ fn(c : int) -> int,
19
+ // decimal digit
15
20
  isgraph :
16
- fn(c : int) -> int, // graphical character
21
+ fn(c : int) -> int,
22
+ // graphical character
17
23
  islower :
18
- fn(c : int) -> int, // lowercase letter
24
+ fn(c : int) -> int,
25
+ // lowercase letter
19
26
  isprint :
20
- fn(c : int) -> int, // printable character
27
+ fn(c : int) -> int,
28
+ // printable character
21
29
  ispunct :
22
- fn(c : int) -> int, // punctuation character
30
+ fn(c : int) -> int,
31
+ // punctuation character
23
32
  isspace :
24
- fn(c : int) -> int, // whitespace character
33
+ fn(c : int) -> int,
34
+ // whitespace character
25
35
  isupper :
26
- fn(c : int) -> int, // uppercase letter
36
+ fn(c : int) -> int,
37
+ // uppercase letter
27
38
  isxdigit :
28
- fn(c : int) -> int, // hexadecimal digit
29
-
39
+ fn(c : int) -> int,
40
+ // hexadecimal digit
30
41
  // Character conversion functions
31
42
  tolower :
32
- fn(c : int) -> int, // convert to lowercase
43
+ fn(c : int) -> int,
44
+ // convert to lowercase
33
45
  toupper :
34
- fn(c : int) -> int // convert to uppercase
35
- ;
36
-
46
+ fn(c : int) -> int // convert to uppercase
47
+ );
37
48
  // Export all ctype functionality
38
- export
49
+ export(
39
50
  // Character classification
40
51
  isalnum,
41
52
  isalpha,
@@ -49,8 +60,7 @@ export
49
60
  isspace,
50
61
  isupper,
51
62
  isxdigit,
52
-
53
63
  // Character conversion
54
64
  tolower,
55
65
  toupper
56
- ;
66
+ );
@@ -1,56 +1,57 @@
1
1
  //! C11 `<dirent.h>` — directory entry operations.
2
-
3
- c_include "<dirent.h>",
2
+ c_include(
3
+ "<dirent.h>",
4
4
  // Types
5
5
  DIR : Type,
6
-
7
6
  // The dirent structure contains at minimum:
8
7
  // - d_name: char[] - null-terminated filename
9
8
  // - d_ino: ino_t - inode number (POSIX)
10
9
  // On most systems also:
11
10
  // - d_type: unsigned char - file type (DT_* constants)
12
11
  dirent : Type,
13
-
14
12
  // Directory operations
15
13
  opendir :
16
- (fn(name: *(char)) -> ?*(DIR)),
14
+ (fn(name : *(char)) -> ?*(DIR)),
17
15
  closedir :
18
- (fn(dirp: *(DIR)) -> int),
16
+ (fn(dirp : *(DIR)) -> int),
19
17
  readdir :
20
- (fn(dirp: *(DIR)) -> ?*(dirent)),
18
+ (fn(dirp : *(DIR)) -> ?*(dirent)),
21
19
  rewinddir :
22
- (fn(dirp: *(DIR)) -> unit),
23
-
20
+ (fn(dirp : *(DIR)) -> unit),
24
21
  // Thread-safe readdir (POSIX)
25
22
  // Note: readdir_r is deprecated in POSIX.1-2008, prefer readdir with mutex
26
23
  // readdir_r :
27
24
  // (fn(dirp: *(DIR), entry: *(dirent), result: *(*(dirent))) -> int),
28
-
29
25
  // Directory entry type constants (d_type field)
30
26
  // Note: These may not be available on all systems
31
- DT_UNKNOWN : u8, // Unknown type
32
- DT_FIFO : u8, // Named pipe (FIFO)
33
- DT_CHR : u8, // Character device
34
- DT_DIR : u8, // Directory
35
- DT_BLK : u8, // Block device
36
- DT_REG : u8, // Regular file
37
- DT_LNK : u8, // Symbolic link
38
- DT_SOCK : u8, // UNIX domain socket
39
- DT_WHT : u8 // Whiteout (BSD)
40
- ;
41
-
27
+ DT_UNKNOWN : u8,
28
+ // Unknown type
29
+ DT_FIFO : u8,
30
+ // Named pipe (FIFO)
31
+ DT_CHR : u8,
32
+ // Character device
33
+ DT_DIR : u8,
34
+ // Directory
35
+ DT_BLK : u8,
36
+ // Block device
37
+ DT_REG : u8,
38
+ // Regular file
39
+ DT_LNK : u8,
40
+ // Symbolic link
41
+ DT_SOCK : u8,
42
+ // UNIX domain socket
43
+ DT_WHT : u8 // Whiteout (BSD)
44
+ );
42
45
  // Export all dirent functionality
43
- export
46
+ export(
44
47
  // Types
45
48
  DIR,
46
49
  dirent,
47
-
48
50
  // Directory operations
49
51
  opendir,
50
52
  closedir,
51
53
  readdir,
52
54
  rewinddir,
53
-
54
55
  // Directory entry type constants
55
56
  DT_UNKNOWN,
56
57
  DT_FIFO,
@@ -61,4 +62,4 @@ export
61
62
  DT_LNK,
62
63
  DT_SOCK,
63
64
  DT_WHT
64
- ;
65
+ );
package/std/libc/errno.yo CHANGED
@@ -1,105 +1,179 @@
1
1
  //! C11 `<errno.h>` — error handling constants and `errno` variable.
2
-
3
- c_include "<errno.h>",
2
+ c_include(
3
+ "<errno.h>",
4
4
  // The errno variable - global error indicator
5
5
  errno : *(int),
6
-
7
6
  // Standard C11 error constants
8
7
  // These are the minimum required by C11
9
- EDOM : int, // Domain error (math functions)
10
- EILSEQ : int, // Illegal byte sequence
11
- ERANGE : int, // Result too large
12
-
8
+ EDOM : int,
9
+ // Domain error (math functions)
10
+ EILSEQ : int,
11
+ // Illegal byte sequence
12
+ ERANGE : int,
13
+ // Result too large
13
14
  // POSIX.1 error constants (widely supported)
14
- E2BIG : int, // Argument list too long
15
- EACCES : int, // Permission denied
16
- EADDRINUSE : int, // Address in use
17
- EADDRNOTAVAIL : int, // Address not available
18
- EAFNOSUPPORT : int, // Address family not supported
19
- EAGAIN : int, // Resource unavailable, try again
20
- EALREADY : int, // Connection already in progress
21
- EBADF : int, // Bad file descriptor
22
- EBADMSG : int, // Bad message
23
- EBUSY : int, // Device or resource busy
24
- ECANCELED : int, // Operation canceled
25
- ECHILD : int, // No child processes
26
- ECONNABORTED : int, // Connection aborted
27
- ECONNREFUSED : int, // Connection refused
28
- ECONNRESET : int, // Connection reset
29
- EDEADLK : int, // Resource deadlock would occur
30
- EDESTADDRREQ : int, // Destination address required
31
- EEXIST : int, // File exists
32
- EFAULT : int, // Bad address
33
- EFBIG : int, // File too large
34
- EHOSTUNREACH : int, // Host is unreachable
35
- EIDRM : int, // Identifier removed
36
- EINPROGRESS : int, // Operation in progress
37
- EINTR : int, // Interrupted function
38
- EINVAL : int, // Invalid argument
39
- EIO : int, // I/O error
40
- EISCONN : int, // Socket is connected
41
- EISDIR : int, // Is a directory
42
- ELOOP : int, // Too many levels of symbolic links
43
- EMFILE : int, // File descriptor value too large
44
- EMLINK : int, // Too many links
45
- EMSGSIZE : int, // Message too large
46
- EMULTIHOP : int, // Multihop attempted
47
- ENAMETOOLONG : int, // Filename too long
48
- ENETDOWN : int, // Network is down
49
- ENETRESET : int, // Connection aborted by network
50
- ENETUNREACH : int, // Network unreachable
51
- ENFILE : int, // Too many files open in system
52
- ENOBUFS : int, // No buffer space available
53
- ENODATA : int, // No message is available
54
- ENODEV : int, // No such device
55
- ENOENT : int, // No such file or directory
56
- ENOEXEC : int, // Executable file format error
57
- ENOLCK : int, // No locks available
58
- ENOLINK : int, // Link has been severed
59
- ENOMEM : int, // Not enough space
60
- ENOMSG : int, // No message of the desired type
61
- ENOPROTOOPT : int, // Protocol not available
62
- ENOSPC : int, // No space left on device
63
- ENOSR : int, // No STREAM resources
64
- ENOSTR : int, // Not a STREAM
65
- ENOSYS : int, // Function not supported
66
- ENOTCONN : int, // The socket is not connected
67
- ENOTDIR : int, // Not a directory
68
- ENOTEMPTY : int, // Directory not empty
69
- ENOTRECOVERABLE : int, // State not recoverable
70
- ENOTSOCK : int, // Not a socket
71
- ENOTSUP : int, // Not supported
72
- ENOTTY : int, // Inappropriate I/O control operation
73
- ENXIO : int, // No such device or address
74
- EOPNOTSUPP : int, // Operation not supported on socket
75
- EOVERFLOW : int, // Value too large to be stored
76
- EOWNERDEAD : int, // Previous owner died
77
- EPERM : int, // Operation not permitted
78
- EPIPE : int, // Broken pipe
79
- EPROTO : int, // Protocol error
80
- EPROTONOSUPPORT : int, // Protocol not supported
81
- EPROTOTYPE : int, // Protocol wrong type for socket
82
- EROFS : int, // Read-only file system
83
- ESPIPE : int, // Invalid seek
84
- ESRCH : int, // No such process
85
- ESTALE : int, // Stale file handle
86
- ETIME : int, // Timer expired
87
- ETIMEDOUT : int, // Connection timed out
88
- ETXTBSY : int, // Text file busy
89
- EWOULDBLOCK : int, // Operation would block
90
- EXDEV : int // Cross-device link
91
- ;
92
-
15
+ E2BIG : int,
16
+ // Argument list too long
17
+ EACCES : int,
18
+ // Permission denied
19
+ EADDRINUSE : int,
20
+ // Address in use
21
+ EADDRNOTAVAIL : int,
22
+ // Address not available
23
+ EAFNOSUPPORT : int,
24
+ // Address family not supported
25
+ EAGAIN : int,
26
+ // Resource unavailable, try again
27
+ EALREADY : int,
28
+ // Connection already in progress
29
+ EBADF : int,
30
+ // Bad file descriptor
31
+ EBADMSG : int,
32
+ // Bad message
33
+ EBUSY : int,
34
+ // Device or resource busy
35
+ ECANCELED : int,
36
+ // Operation canceled
37
+ ECHILD : int,
38
+ // No child processes
39
+ ECONNABORTED : int,
40
+ // Connection aborted
41
+ ECONNREFUSED : int,
42
+ // Connection refused
43
+ ECONNRESET : int,
44
+ // Connection reset
45
+ EDEADLK : int,
46
+ // Resource deadlock would occur
47
+ EDESTADDRREQ : int,
48
+ // Destination address required
49
+ EEXIST : int,
50
+ // File exists
51
+ EFAULT : int,
52
+ // Bad address
53
+ EFBIG : int,
54
+ // File too large
55
+ EHOSTUNREACH : int,
56
+ // Host is unreachable
57
+ EIDRM : int,
58
+ // Identifier removed
59
+ EINPROGRESS : int,
60
+ // Operation in progress
61
+ EINTR : int,
62
+ // Interrupted function
63
+ EINVAL : int,
64
+ // Invalid argument
65
+ EIO : int,
66
+ // I/O error
67
+ EISCONN : int,
68
+ // Socket is connected
69
+ EISDIR : int,
70
+ // Is a directory
71
+ ELOOP : int,
72
+ // Too many levels of symbolic links
73
+ EMFILE : int,
74
+ // File descriptor value too large
75
+ EMLINK : int,
76
+ // Too many links
77
+ EMSGSIZE : int,
78
+ // Message too large
79
+ EMULTIHOP : int,
80
+ // Multihop attempted
81
+ ENAMETOOLONG : int,
82
+ // Filename too long
83
+ ENETDOWN : int,
84
+ // Network is down
85
+ ENETRESET : int,
86
+ // Connection aborted by network
87
+ ENETUNREACH : int,
88
+ // Network unreachable
89
+ ENFILE : int,
90
+ // Too many files open in system
91
+ ENOBUFS : int,
92
+ // No buffer space available
93
+ ENODATA : int,
94
+ // No message is available
95
+ ENODEV : int,
96
+ // No such device
97
+ ENOENT : int,
98
+ // No such file or directory
99
+ ENOEXEC : int,
100
+ // Executable file format error
101
+ ENOLCK : int,
102
+ // No locks available
103
+ ENOLINK : int,
104
+ // Link has been severed
105
+ ENOMEM : int,
106
+ // Not enough space
107
+ ENOMSG : int,
108
+ // No message of the desired type
109
+ ENOPROTOOPT : int,
110
+ // Protocol not available
111
+ ENOSPC : int,
112
+ // No space left on device
113
+ ENOSR : int,
114
+ // No STREAM resources
115
+ ENOSTR : int,
116
+ // Not a STREAM
117
+ ENOSYS : int,
118
+ // Function not supported
119
+ ENOTCONN : int,
120
+ // The socket is not connected
121
+ ENOTDIR : int,
122
+ // Not a directory
123
+ ENOTEMPTY : int,
124
+ // Directory not empty
125
+ ENOTRECOVERABLE : int,
126
+ // State not recoverable
127
+ ENOTSOCK : int,
128
+ // Not a socket
129
+ ENOTSUP : int,
130
+ // Not supported
131
+ ENOTTY : int,
132
+ // Inappropriate I/O control operation
133
+ ENXIO : int,
134
+ // No such device or address
135
+ EOPNOTSUPP : int,
136
+ // Operation not supported on socket
137
+ EOVERFLOW : int,
138
+ // Value too large to be stored
139
+ EOWNERDEAD : int,
140
+ // Previous owner died
141
+ EPERM : int,
142
+ // Operation not permitted
143
+ EPIPE : int,
144
+ // Broken pipe
145
+ EPROTO : int,
146
+ // Protocol error
147
+ EPROTONOSUPPORT : int,
148
+ // Protocol not supported
149
+ EPROTOTYPE : int,
150
+ // Protocol wrong type for socket
151
+ EROFS : int,
152
+ // Read-only file system
153
+ ESPIPE : int,
154
+ // Invalid seek
155
+ ESRCH : int,
156
+ // No such process
157
+ ESTALE : int,
158
+ // Stale file handle
159
+ ETIME : int,
160
+ // Timer expired
161
+ ETIMEDOUT : int,
162
+ // Connection timed out
163
+ ETXTBSY : int,
164
+ // Text file busy
165
+ EWOULDBLOCK : int,
166
+ // Operation would block
167
+ EXDEV : int // Cross-device link
168
+ );
93
169
  // Export all errno functionality
94
- export
170
+ export(
95
171
  // The errno variable
96
172
  errno,
97
-
98
173
  // Standard C11 errors
99
174
  EDOM,
100
175
  EILSEQ,
101
176
  ERANGE,
102
-
103
177
  // POSIX.1 error constants
104
178
  E2BIG,
105
179
  EACCES,
@@ -178,4 +252,4 @@ export
178
252
  ETXTBSY,
179
253
  EWOULDBLOCK,
180
254
  EXDEV
181
- ;
255
+ );
package/std/libc/fcntl.yo CHANGED
@@ -1,79 +1,88 @@
1
1
  //! POSIX `<fcntl.h>` — file control options.
2
2
  //! Provides open flags and file control operations.
3
-
4
- c_include "<fcntl.h>",
3
+ c_include(
4
+ "<fcntl.h>",
5
5
  // File access modes (for open)
6
- O_RDONLY : i32, // Open for reading only
7
- O_WRONLY : i32, // Open for writing only
8
- O_RDWR : i32, // Open for reading and writing
9
-
6
+ O_RDONLY : i32,
7
+ // Open for reading only
8
+ O_WRONLY : i32,
9
+ // Open for writing only
10
+ O_RDWR : i32,
11
+ // Open for reading and writing
10
12
  // File creation flags
11
- O_CREAT : i32, // Create file if it doesn't exist
12
- O_EXCL : i32, // Fail if file exists (with O_CREAT)
13
- O_TRUNC : i32, // Truncate file to zero length
14
- O_APPEND : i32, // Append mode
15
-
13
+ O_CREAT : i32,
14
+ // Create file if it doesn't exist
15
+ O_EXCL : i32,
16
+ // Fail if file exists (with O_CREAT)
17
+ O_TRUNC : i32,
18
+ // Truncate file to zero length
19
+ O_APPEND : i32,
20
+ // Append mode
16
21
  // File status flags
17
- O_NONBLOCK : i32, // Non-blocking mode
18
- O_SYNC : i32, // Synchronous writes
19
- O_DSYNC : i32, // Synchronous data writes
20
-
22
+ O_NONBLOCK : i32,
23
+ // Non-blocking mode
24
+ O_SYNC : i32,
25
+ // Synchronous writes
26
+ O_DSYNC : i32,
27
+ // Synchronous data writes
21
28
  // Additional flags (may not be available on all systems)
22
- O_CLOEXEC : i32, // Close on exec
23
- O_DIRECTORY : i32, // Fail if not a directory
24
- O_NOFOLLOW : i32, // Don't follow symlinks
25
-
29
+ O_CLOEXEC : i32,
30
+ // Close on exec
31
+ O_DIRECTORY : i32,
32
+ // Fail if not a directory
33
+ O_NOFOLLOW : i32,
34
+ // Don't follow symlinks
26
35
  // File control function
27
36
  fcntl :
28
- (fn(fd: int, cmd: int, ...) -> int),
29
-
37
+ (fn(fd : int, cmd : int, ...) -> int),
30
38
  // fcntl commands
31
- F_DUPFD : int, // Duplicate file descriptor
32
- F_GETFD : int, // Get file descriptor flags
33
- F_SETFD : int, // Set file descriptor flags
34
- F_GETFL : int, // Get file status flags
35
- F_SETFL : int, // Set file status flags
36
- F_GETLK : int, // Get record locking info
37
- F_SETLK : int, // Set record locking info
38
- F_SETLKW : int, // Set record locking info (blocking)
39
-
39
+ F_DUPFD : int,
40
+ // Duplicate file descriptor
41
+ F_GETFD : int,
42
+ // Get file descriptor flags
43
+ F_SETFD : int,
44
+ // Set file descriptor flags
45
+ F_GETFL : int,
46
+ // Get file status flags
47
+ F_SETFL : int,
48
+ // Set file status flags
49
+ F_GETLK : int,
50
+ // Get record locking info
51
+ F_SETLK : int,
52
+ // Set record locking info
53
+ F_SETLKW : int,
54
+ // Set record locking info (blocking)
40
55
  // File descriptor flags
41
- FD_CLOEXEC : int, // Close on exec flag
42
-
56
+ FD_CLOEXEC : int,
57
+ // Close on exec flag
43
58
  // Open function
44
59
  // Note: open is also in unistd.h on some systems
45
60
  open :
46
- (fn(pathname: *(char), flags: int, ...) -> int),
61
+ (fn(pathname : *(char), flags : int, ...) -> int),
47
62
  creat :
48
- (fn(pathname: *(char), mode: u32) -> int)
49
- ;
50
-
63
+ (fn(pathname : *(char), mode : u32) -> int)
64
+ );
51
65
  // Export all fcntl functionality
52
- export
66
+ export(
53
67
  // File access modes
54
68
  O_RDONLY,
55
69
  O_WRONLY,
56
70
  O_RDWR,
57
-
58
71
  // File creation flags
59
72
  O_CREAT,
60
73
  O_EXCL,
61
74
  O_TRUNC,
62
75
  O_APPEND,
63
-
64
76
  // File status flags
65
77
  O_NONBLOCK,
66
78
  O_SYNC,
67
79
  O_DSYNC,
68
-
69
80
  // Additional flags
70
81
  O_CLOEXEC,
71
82
  O_DIRECTORY,
72
83
  O_NOFOLLOW,
73
-
74
84
  // File control function
75
85
  fcntl,
76
-
77
86
  // fcntl commands
78
87
  F_DUPFD,
79
88
  F_GETFD,
@@ -83,11 +92,9 @@ export
83
92
  F_GETLK,
84
93
  F_SETLK,
85
94
  F_SETLKW,
86
-
87
95
  // File descriptor flags
88
96
  FD_CLOEXEC,
89
-
90
97
  // Open functions
91
98
  open,
92
99
  creat
93
- ;
100
+ );