feat: supply process arguments through native startup
This commit is contained in:
@@ -9,8 +9,9 @@ odin build . -out:build/brolang
|
||||
./build/prototype
|
||||
```
|
||||
|
||||
Programs may receive the system I/O capability explicitly. Standard-stream
|
||||
helpers bind the provider, handle, and callback; `main func() ...` remains valid.
|
||||
Programs may receive system I/O and process arguments explicitly through
|
||||
`process.Init`; `main func() ...` remains valid. Standard-stream helpers bind the
|
||||
provider, handle, and callback.
|
||||
|
||||
```bro
|
||||
io :: import "@std/io"
|
||||
@@ -23,6 +24,15 @@ main func(init process.Init) void {
|
||||
}
|
||||
```
|
||||
|
||||
`Init` contains `io io.Io` and `args process.Args`. `Args.values` is a borrowed
|
||||
`[][*;0]u8` view of native `argv`, with its length taken from `argc`: it includes
|
||||
the executable name at index 0 when present, without copying strings or the
|
||||
pointer array. `process.argument_count(init.args)` returns that count, and
|
||||
`process.argument(init.args, index)` returns a borrowed `?[;0]u8` (null when out
|
||||
of range). The helper scans only the requested zero-terminated argument; empty
|
||||
arguments remain empty slices. The slices are valid while their supplied
|
||||
argument storage lives.
|
||||
|
||||
Bodyless `c_func` declarations bind exact external symbols and require concrete
|
||||
types. C primitives use atomic target-dependent names and remain semantically
|
||||
distinct from exact-width Brolang primitives:
|
||||
|
||||
Reference in New Issue
Block a user