MCPcopy Create free account
hub / github.com/WasmVM/WasmVM / proc_argv_len

Function proc_argv_len

host/sysenv/sys_proc.cpp:37–44  ·  view source on GitHub ↗

argv_len(idx:i32) -> i32 Returns the byte length of argument[idx] (not including null terminator), or -EINVAL if idx is out of range.

Source from the content-addressed store, hash-verified

35// Returns the byte length of argument[idx] (not including null terminator),
36// or -EINVAL if idx is out of range.
37static std::vector<Value> proc_argv_len(Stack& stack) {
38 Frame& frame = stack.frames.top();
39 i32_t idx = std::get<i32_t>(frame.locals[0]);
40 if(idx < 0 || (size_t)idx >= wasmvm_args.size()) {
41 return {Value(i32_t(-EINVAL))};
42 }
43 return {Value(i32_t(wasmvm_args[(size_t)idx].size()))};
44}
45
46// argv(idx:i32, buf_ptr, buf_len) -> i32
47static std::vector<Value> proc_argv(Stack& stack) {

Callers

nothing calls this directly

Calls 1

ValueClass · 0.85

Tested by

no test coverage detected