argv_len(idx:i32) -> i32 Returns the byte length of argument[idx] (not including null terminator), or -EINVAL if idx is out of range.
| 35 | // Returns the byte length of argument[idx] (not including null terminator), |
| 36 | // or -EINVAL if idx is out of range. |
| 37 | static 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 |
| 47 | static std::vector<Value> proc_argv(Stack& stack) { |