Commit Graph

8 Commits

Author SHA1 Message Date
gingerBill
7642e0a0e0 Require @(init) and @(fini) to be proc "contextless" () 2025-08-08 12:10:01 +01:00
Jeroen van Rijn
1a2f83f123 Add bring-your-own-buffer versions of os.lookup_env and os.get_env
And make `core:terminal` use it so that `core:log` can be imported with `-default-to-nil-allocator`,
in which the actual allocator is set up in `main()`.

Windows was tricky because of the utf-8 <> utf-16 conversion, so we use some temporary stack buffers for that purpose,
limiting the non-allocating version there to 512 utf-16 characters each for the key and environment value.

In general the value is (obviously) limited to the size of the supplied buffer, and a `.Buffer_Full` error is returned
if that buffer is insufficient. If the key is not found, the procedure returns `.Env_Var_Not_Found`.

TODO:
- Factor out buffer-backed utf8 + utf16 conversion to `core:sys/util` to more easily apply this pattern.
- Add similar `lookup_env` and `get_env` procedures to `core:os/os2`.

Fixes #5336
2025-06-16 20:12:26 +02:00
Jeroen van Rijn
d4a1670b93 Fix core:log on -target:js_wasm32 2025-06-02 14:44:26 +02:00
Feoramund
899cfe9c37 Also use ENABLE_PROCESSED_OUTPUT on Windows terminals
This is specified to be necessary when using
`ENABLE_VIRTUAL_TERMINAL_PROCESSING`.
2025-05-21 08:40:19 -04:00
Feoramund
e659df1a3f Restructure core:terminal for better Windows support 2025-05-21 07:49:08 -04:00
Feoramund
b6f1821bba Fix terminal detection on Windows 2025-05-21 05:20:58 -04:00
Feoramund
a9df1b1cde Rename core:encoding/ansi to core:terminal/ansi 2025-05-20 19:28:06 -04:00
Feoramund
30c1b88741 Add core:terminal 2025-05-20 19:27:58 -04:00