@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.
- package/.github/skills/yo-async-effects/SKILL.md +4 -4
- package/.github/skills/yo-async-effects/async-effects-recipes.md +34 -34
- package/.github/skills/yo-core-patterns/SKILL.md +1 -1
- package/.github/skills/yo-core-patterns/core-patterns-cheatsheet.md +26 -26
- package/.github/skills/yo-project-workflow/SKILL.md +6 -3
- package/.github/skills/yo-project-workflow/workflow-cheatsheet.md +34 -11
- package/.github/skills/yo-syntax/SKILL.md +7 -6
- package/.github/skills/yo-syntax/syntax-cheatsheet.md +73 -60
- package/.github/skills/yo-wasm-integration/wasm-integration-cheatsheet.md +3 -3
- package/README.md +10 -8
- package/out/cjs/index.cjs +456 -438
- package/out/cjs/yo-cli.cjs +576 -543
- package/out/cjs/yo-lsp.cjs +559 -532
- package/out/esm/index.mjs +281 -263
- package/out/types/src/formatter.d.ts +11 -0
- package/out/types/src/lsp/formatting.d.ts +2 -0
- package/out/types/src/tests/formatter.test.d.ts +1 -0
- package/out/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/std/alg/hash.yo +13 -21
- package/std/allocator.yo +25 -40
- package/std/async.yo +3 -7
- package/std/build.yo +105 -151
- package/std/cli/arg_parser.yo +184 -169
- package/std/collections/array_list.yo +350 -314
- package/std/collections/btree_map.yo +142 -131
- package/std/collections/deque.yo +132 -128
- package/std/collections/hash_map.yo +542 -566
- package/std/collections/hash_set.yo +623 -687
- package/std/collections/linked_list.yo +275 -293
- package/std/collections/ordered_map.yo +113 -85
- package/std/collections/priority_queue.yo +73 -73
- package/std/crypto/md5.yo +191 -95
- package/std/crypto/random.yo +56 -64
- package/std/crypto/sha256.yo +151 -107
- package/std/encoding/base64.yo +87 -81
- package/std/encoding/hex.yo +43 -50
- package/std/encoding/html.yo +56 -81
- package/std/encoding/html_char_utils.yo +7 -13
- package/std/encoding/html_entities.yo +2248 -2253
- package/std/encoding/json.yo +316 -224
- package/std/encoding/punycode.yo +86 -116
- package/std/encoding/toml.yo +67 -66
- package/std/encoding/utf16.yo +37 -44
- package/std/env.yo +62 -91
- package/std/error.yo +7 -15
- package/std/fmt/display.yo +5 -9
- package/std/fmt/index.yo +8 -14
- package/std/fmt/to_string.yo +330 -315
- package/std/fmt/writer.yo +58 -87
- package/std/fs/dir.yo +83 -102
- package/std/fs/file.yo +147 -180
- package/std/fs/metadata.yo +45 -78
- package/std/fs/temp.yo +55 -65
- package/std/fs/types.yo +27 -40
- package/std/fs/walker.yo +53 -68
- package/std/gc.yo +5 -8
- package/std/glob.yo +30 -43
- package/std/http/client.yo +107 -120
- package/std/http/http.yo +106 -96
- package/std/http/index.yo +4 -6
- package/std/imm/list.yo +88 -93
- package/std/imm/map.yo +528 -464
- package/std/imm/set.yo +52 -57
- package/std/imm/sorted_map.yo +340 -286
- package/std/imm/sorted_set.yo +57 -63
- package/std/imm/string.yo +404 -345
- package/std/imm/vec.yo +173 -181
- package/std/io/reader.yo +3 -6
- package/std/io/writer.yo +4 -8
- package/std/libc/assert.yo +5 -9
- package/std/libc/ctype.yo +32 -22
- package/std/libc/dirent.yo +26 -25
- package/std/libc/errno.yo +164 -90
- package/std/libc/fcntl.yo +52 -45
- package/std/libc/float.yo +66 -44
- package/std/libc/limits.yo +42 -33
- package/std/libc/math.yo +53 -82
- package/std/libc/signal.yo +72 -47
- package/std/libc/stdatomic.yo +217 -188
- package/std/libc/stdint.yo +5 -29
- package/std/libc/stdio.yo +5 -29
- package/std/libc/stdlib.yo +32 -39
- package/std/libc/string.yo +5 -23
- package/std/libc/sys/stat.yo +58 -56
- package/std/libc/time.yo +5 -19
- package/std/libc/unistd.yo +5 -20
- package/std/libc/wctype.yo +6 -9
- package/std/libc/windows.yo +26 -30
- package/std/log.yo +41 -55
- package/std/net/addr.yo +102 -97
- package/std/net/dns.yo +27 -28
- package/std/net/errors.yo +50 -49
- package/std/net/tcp.yo +113 -124
- package/std/net/udp.yo +55 -66
- package/std/os/env.yo +35 -33
- package/std/os/signal.yo +15 -25
- package/std/path.yo +276 -311
- package/std/prelude.yo +6304 -4315
- package/std/process/command.yo +87 -103
- package/std/process/index.yo +12 -31
- package/std/regex/compiler.yo +196 -95
- package/std/regex/flags.yo +58 -39
- package/std/regex/index.yo +157 -173
- package/std/regex/match.yo +20 -31
- package/std/regex/node.yo +134 -152
- package/std/regex/parser.yo +283 -259
- package/std/regex/unicode.yo +172 -202
- package/std/regex/vm.yo +155 -171
- package/std/string/index.yo +5 -7
- package/std/string/rune.yo +45 -55
- package/std/string/string.yo +937 -964
- package/std/string/string_builder.yo +94 -104
- package/std/string/unicode.yo +46 -64
- package/std/sync/channel.yo +72 -73
- package/std/sync/cond.yo +31 -36
- package/std/sync/mutex.yo +30 -32
- package/std/sync/once.yo +13 -16
- package/std/sync/rwlock.yo +26 -31
- package/std/sync/waitgroup.yo +20 -25
- package/std/sys/advise.yo +16 -24
- package/std/sys/bufio/buf_reader.yo +77 -93
- package/std/sys/bufio/buf_writer.yo +52 -65
- package/std/sys/clock.yo +4 -9
- package/std/sys/constants.yo +77 -61
- package/std/sys/copy.yo +4 -10
- package/std/sys/dir.yo +26 -43
- package/std/sys/dns.yo +41 -61
- package/std/sys/errors.yo +95 -103
- package/std/sys/events.yo +45 -57
- package/std/sys/externs.yo +319 -267
- package/std/sys/fallocate.yo +7 -11
- package/std/sys/fcntl.yo +14 -22
- package/std/sys/file.yo +26 -40
- package/std/sys/future.yo +5 -8
- package/std/sys/iov.yo +12 -25
- package/std/sys/lock.yo +12 -13
- package/std/sys/mmap.yo +38 -43
- package/std/sys/path.yo +3 -8
- package/std/sys/perm.yo +7 -21
- package/std/sys/pipe.yo +5 -12
- package/std/sys/process.yo +23 -29
- package/std/sys/seek.yo +10 -12
- package/std/sys/signal.yo +7 -13
- package/std/sys/signals.yo +52 -35
- package/std/sys/socket.yo +63 -58
- package/std/sys/socketpair.yo +3 -6
- package/std/sys/sockinfo.yo +11 -20
- package/std/sys/statfs.yo +11 -34
- package/std/sys/statx.yo +25 -52
- package/std/sys/sysinfo.yo +15 -20
- package/std/sys/tcp.yo +62 -92
- package/std/sys/temp.yo +5 -9
- package/std/sys/time.yo +5 -15
- package/std/sys/timer.yo +6 -11
- package/std/sys/tty.yo +10 -18
- package/std/sys/udp.yo +22 -39
- package/std/sys/umask.yo +3 -6
- package/std/sys/unix.yo +33 -52
- package/std/testing/bench.yo +49 -52
- package/std/thread.yo +10 -15
- package/std/time/datetime.yo +105 -89
- package/std/time/duration.yo +43 -56
- package/std/time/instant.yo +13 -18
- package/std/time/sleep.yo +5 -9
- package/std/url/index.yo +184 -209
- package/std/worker.yo +6 -10
package/std/libc/assert.yo
CHANGED
|
@@ -1,22 +1,19 @@
|
|
|
1
1
|
//! C11 `<assert.h>` — assertion debugging facility.
|
|
2
2
|
//! Provides runtime assertion checking for debugging.
|
|
3
|
-
|
|
4
|
-
|
|
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
|
-
|
|
2
|
+
c_include(
|
|
3
|
+
"<ctype.h>",
|
|
4
4
|
// Character classification functions
|
|
5
5
|
isalnum :
|
|
6
|
-
fn(c : int) -> int,
|
|
6
|
+
fn(c : int) -> int,
|
|
7
|
+
// alphanumeric character
|
|
7
8
|
isalpha :
|
|
8
|
-
fn(c : int) -> int,
|
|
9
|
+
fn(c : int) -> int,
|
|
10
|
+
// alphabetic character
|
|
9
11
|
isblank :
|
|
10
|
-
fn(c : int) -> int,
|
|
12
|
+
fn(c : int) -> int,
|
|
13
|
+
// blank character (C99/C11)
|
|
11
14
|
iscntrl :
|
|
12
|
-
fn(c : int) -> int,
|
|
15
|
+
fn(c : int) -> int,
|
|
16
|
+
// control character
|
|
13
17
|
isdigit :
|
|
14
|
-
fn(c : int) -> int,
|
|
18
|
+
fn(c : int) -> int,
|
|
19
|
+
// decimal digit
|
|
15
20
|
isgraph :
|
|
16
|
-
fn(c : int) -> int,
|
|
21
|
+
fn(c : int) -> int,
|
|
22
|
+
// graphical character
|
|
17
23
|
islower :
|
|
18
|
-
fn(c : int) -> int,
|
|
24
|
+
fn(c : int) -> int,
|
|
25
|
+
// lowercase letter
|
|
19
26
|
isprint :
|
|
20
|
-
fn(c : int) -> int,
|
|
27
|
+
fn(c : int) -> int,
|
|
28
|
+
// printable character
|
|
21
29
|
ispunct :
|
|
22
|
-
fn(c : int) -> int,
|
|
30
|
+
fn(c : int) -> int,
|
|
31
|
+
// punctuation character
|
|
23
32
|
isspace :
|
|
24
|
-
fn(c : int) -> int,
|
|
33
|
+
fn(c : int) -> int,
|
|
34
|
+
// whitespace character
|
|
25
35
|
isupper :
|
|
26
|
-
fn(c : int) -> int,
|
|
36
|
+
fn(c : int) -> int,
|
|
37
|
+
// uppercase letter
|
|
27
38
|
isxdigit :
|
|
28
|
-
fn(c : int) -> int,
|
|
29
|
-
|
|
39
|
+
fn(c : int) -> int,
|
|
40
|
+
// hexadecimal digit
|
|
30
41
|
// Character conversion functions
|
|
31
42
|
tolower :
|
|
32
|
-
fn(c : int) -> int,
|
|
43
|
+
fn(c : int) -> int,
|
|
44
|
+
// convert to lowercase
|
|
33
45
|
toupper :
|
|
34
|
-
fn(c : int) -> int
|
|
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
|
+
);
|
package/std/libc/dirent.yo
CHANGED
|
@@ -1,56 +1,57 @@
|
|
|
1
1
|
//! C11 `<dirent.h>` — directory entry operations.
|
|
2
|
-
|
|
3
|
-
|
|
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,
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
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
|
-
|
|
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,
|
|
10
|
-
|
|
11
|
-
|
|
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,
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
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
|
-
|
|
3
|
+
c_include(
|
|
4
|
+
"<fcntl.h>",
|
|
5
5
|
// File access modes (for open)
|
|
6
|
-
O_RDONLY : i32,
|
|
7
|
-
|
|
8
|
-
|
|
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,
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
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,
|
|
18
|
-
|
|
19
|
-
|
|
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,
|
|
23
|
-
|
|
24
|
-
|
|
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,
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
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,
|
|
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
|
+
);
|