Closed catfact closed 7 years ago
optionally, leave the matron
REPL very dumb, and put all the smartness in the client.
seems it might be nice to have matron be the smart bit, as we may replicate some maiden functionality in a web thing??
but of course the ncurses and web versions of maiden could share a library as well
On Sat, Mar 4, 2017 at 8:26 PM, ezra buchla notifications@github.com wrote:
optionally, leave the matron REPL very dumb, and put all the smartness in the client.
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/catfact/norns/issues/7#issuecomment-284197835, or mute the thread https://github.com/notifications/unsubscribe-auth/AAPEcLtTi9tSNlfQ7hCn2Rd4tJ2S6cjXks5rig82gaJpZM4MTRWN .
<note to self, basically>
would be nice to just run interpreter module from lua source unmodified. (lua.c
)
but, it uses blocking input liberally within the continuation logic.
it's unclear how to reconcile this with matron
threading model (which assumes event loop runs on lua's main thread)
so, i tried selectively ripping from lua.c
, adding new continutation logic that operates on external buffer instead of using gnu readline
(see lua-repl
branch). i think this will work, but it's still buggy right now
gnu readline
can manage this for us; it's what lua source uses anyway. but i'd save the history at the top of the IO thread, not in the REPL logic itself.
added lua continuation in commit 67348adea, so closing this.
as an experiment, also added readline
to matron input. works great when running matron
directly from the shell, but as i had feared, it doesn't seem to work in a child process with input redirection.
@tehn: readline
is the library that gnu programs use to provide the behavior i think you want (e.g. arrows for line history navigation, but that's just the tip of the iceberg - check out man readline
.) it is really a complex piece of software in its own right. i'm considering using it in maiden
, but need to confirm that it works properly with a remote shell (i kinda doubt it actually, but we'll see)
when
matron
receives a lua code string, it simply tries to evaluate it as a complete chunk. it should be smarter, to accomodate continuation lines.see lua source code: https://github.com/lua/lua/blob/master/lua.c#L350-L382
indeed, i am thinking of just adading our own version of
lua.c
to replace ourrepl.c
, with code inweaver.c
using a pointer to that LVM state.