Closed leoleoasd closed 4 years ago
Why the memfs binary is smaller than original :thinking:
Also, can you remove memfs changes here from the PR?
Should I make a git revert
commit or git reset --soft
and commit again to avoid the modified memfs file left in the git history?
I just realized you will need to update memfs anyway;
host_read
isn't defined there, so you'll need to call out from memfs to the host in the same wayhost_write
is implemented.
Also created a PR for your fork of llvm contains the changes of memfs.c.
Another question is that the js file (shared.js) requires the binary mapping of the iovs, such as the first 4 bytes is the buf
. So, this can only be used with a specified wasi-sdk version, (10.0 wont work on my side), should we migrate it to use some helper functions from memfs.c
such as getBufOfIovs
to get the pointer of buf?
So, this can only be used with a specified wasi-sdk version, (10.0 wont work on my side), should we migrate it to use some helper functions from memfs.c such as getBufOfIovs to get the pointer of buf?
I'd guess that there would be a lot more changes required for a different WASI version, so I'm not sure it's worth abstracting it for just this one case.
Ready for final review and merge.
How can I make this work in the current version without the use of any server? Because the example C code below inside the editor component doesn't prompt xterm for some stdin:
#include <stdio.h>
int main() {
int num;
printf("Enter a number: ");
scanf("%d", &num);
printf("The number you entered is %d\n", num);
return 0;
}
Added support for reading from stdin.
As described in this issue.
I only added functionality to read, didn't add an interface in HTML to specify the input. You can change the default
MemFS.stdinStr
to test this patch.