Build with Moddable and use screen
to connect to REPL:
mcconfig -m -p esp
screen /dev/ttyUSB0 921600
//replcore.js
REPL.write(newline);
if (this.incoming) {
this.history.push(this.incoming);
while (this.history.length > 20)
this.history.shift();
try {
let result = REPL.eval(this.incoming);
if (undefined === result)
REPL.write("undefined", newline);
else if (null === result)
REPL.write("null", newline);
else
REPL.write(result.toString(), newline);
}
catch (e) {
REPL.write(e.toString(), newline);
}
}
this.prompt();
void xs_repl_eval(txMachine* the)
{
txStringStream aStream;
aStream.slot = mxArgv(0);
aStream.offset = 0;
aStream.size = c_strlen(fxToString(the, mxArgv(0)));
fxRunScript(the, fxParseScript(the, &aStream, fxStringGetter, mxProgramFlag), &mxGlobal, C_NULL, mxClosures.value.reference, C_NULL, C_NULL);
mxPullSlot(mxResult);
}
Moddable-OpenSource/moddable#307
- rename
$MODDABLE-SDK/xs/sources
to$MODDABLE-SDK/xs/sources_new
- move
sources_old
in this folder to$MODDABLE-SDK/xs/sources
https://github.com/eco747/foton/search?q=mxClosures&unscoped_q=mxClosures
https://github.com/eco747/foton/blob/2f9b68ca0ccc2f087f769e52f8caa30806c9484c/xs/tools/xst.c#L1229
https://www.moddable.com/XS7-TC-39
[https://github.com/Moddable-OpenSource/moddable/blob/public/documentation/xs/XS%20Conformance.md](https://github.com/Moddable-OpenSource/moddable/blob/public/documentation/xs/XS Conformance.md)
[https://github.com/Moddable-OpenSource/moddable/blob/public/documentation/xs/XS%20in%20C.md](https://github.com/Moddable-OpenSource/moddable/blob/public/documentation/xs/XS in C.md)
[https://github.com/Moddable-OpenSource/moddable/blob/public/documentation/Moddable%20SDK%20-%20Getting%20Started.md#host-linux](https://github.com/Moddable-OpenSource/moddable/blob/public/documentation/Moddable SDK - Getting Started.md#host-linux)
https://www.espressif.com/sites/default/files/documentation/0a-esp8266ex_datasheet_en.pdf