From 425ef692da7e74112f88f0b368f3286dba84f846 Mon Sep 17 00:00:00 2001 From: Nicholas Noll Date: Thu, 18 Jun 2020 19:45:40 -0700 Subject: feat: working parser for rc shell language --- sys/libterm/input.c | 108 ---------------------------------------------------- 1 file changed, 108 deletions(-) delete mode 100644 sys/libterm/input.c (limited to 'sys/libterm/input.c') diff --git a/sys/libterm/input.c b/sys/libterm/input.c deleted file mode 100644 index 038e8df..0000000 --- a/sys/libterm/input.c +++ /dev/null @@ -1,108 +0,0 @@ -#include -#include -#include - -#define iota(x) 1 << (x) - -// ----------------------------------------------------------------------- -// enums - -enum -{ - KeyRune, KeyFunc, KeySym, - KeyMouse, KeyPosition, KeyModeReport, - KeyDCS, KeyOSC, /* add other recognised types here */ - KeyUnknownCSI = -1 -}; - -enum KeyEvent -{ - EvNil, EvKey, EvEOF, EvAgain, EvErr, -}; - -enum -{ - SymUnknown = -1, - SymNone = 0, - - /* special names in c0 */ - SymBackspace, SymTab, SymEnter, SymEscape, - - /* special names in g0 */ - SymSpace, SymDel, - - /* special keys */ - SymUp, SymDown, SymLeft, SymRight, SymBegin, SymFind, SymInsert, - SymDelete, SymSelect, SymPageUp, SymPageDown, SymHome, SymEnd, - - /* special keys from terminfo */ - SymCancel, SymClear, SymClose, SymCommand, SymCopy, SymExit, - SymHelp, SymMark, SymMessage, SymMove, SymOpen, SymOptions, - SymPrint, SymRedo, SymReference, SymRefresh, SymReplace, - SymRestart, SymResume, SymSave, SymSuspend, SymUndo, - - /* numeric keypad special keys */ - SymKp0, SymKp1, SymKp2, SymKp3, SymKp4, SymKp5, SymKp6, SymKp7, SymKp8, - SymKp9, SymKpEnter, SymKpPlus, SymKpMinus, SymKpMul, SymKpDiv, SymKpComma, - SymKpDot, SymKpEq, - - /* et cetera ad nauseum */ - NumSyms -}; - -enum MouseEvent -{ - MouseNil, MousePress, MouseDrag, MouseRelease, -}; - -enum -{ - ModShift = iota(0), - ModAlt = iota(1), - ModCtrl = iota(2), -}; - -// ----------------------------------------------------------------------- -// types - -typedef struct Input Input; - -struct Input -{ - int fd; - int wait; /* in msec */ - struct { - char *b, *c, bytes[1024]; - } rbuf; /* read buffer */ - struct { - char *b, *c, bytes[1024]; - } ebuf; /* escape buffer */ -}; - -// ----------------------------------------------------------------------- -// globals - -// ----------------------------------------------------------------------- -// utility functions - -// ----------------------------------------------------------------------- -// implementation - -Input * -makeinput(int fd, int flags, unibi_term *info) -{ - int i; - Input *in; - char *e; - - if (!(in = calloc(1, sizeof(in)))) - panicf("out of memory"); - - in->fd = fd; - in->wait = 50; /* in msec */ - - /* initialize buffers */ - in->rbuf.c = in->rbuf.b = in->rbuf.bytes; - - return in; -} -- cgit v1.2.1