AtomVM
AtomVM copied to clipboard
Additions to `port.c`
Add the following function to port.c in order to simplify port development:
bar_t port_send_reply(const GenMessage *gen_message, term reply, GlobalContext *global);
The following function might be added too, so we completely hide underlying protocol:
size_t port_reply_size(); // returns the size of `{Ref, _}` tuple.
As an alternative following function might be added, assuming that we can prepare a fragment that is ready to be sent just later.
foo_t port_prepare_reply(size_t reply_size, GlobalContext *global);
Also a very convenient API might be added to port.c:
bar_t port_send_ok_reply(const GenMessage *gen_message)