aboutsummaryrefslogtreecommitdiff
path: root/curses.jai
diff options
context:
space:
mode:
authordam <dam@gudinoff>2023-01-27 17:41:08 +0000
committerdam <dam@gudinoff>2023-01-27 17:41:08 +0000
commite952ef4d14589d8dbaf2f6e8cf0399030b725bff (patch)
treeb43b37da87f226b766cd619d684e004de3a1d4ba /curses.jai
parent43d2bf3d44ebdd50c535649f609b458d1b487abc (diff)
downloadtask-time-tracker-e952ef4d14589d8dbaf2f6e8cf0399030b725bff.tar.zst
task-time-tracker-e952ef4d14589d8dbaf2f6e8cf0399030b725bff.zip
Initial attempt to process input arguments. Added fossil settings.
Diffstat (limited to 'curses.jai')
-rw-r--r--curses.jai89
1 files changed, 89 insertions, 0 deletions
diff --git a/curses.jai b/curses.jai
new file mode 100644
index 0000000..bec9db5
--- /dev/null
+++ b/curses.jai
@@ -0,0 +1,89 @@
+
+ldat :: struct {
+ text :*void; /* text of the line */
+ firstchar :s16; /* first changed character in the line */
+ lastchar :s16; /* last changed character in the line */
+ oldindex :s16; /* index of the line at last update */
+};
+
+// TODO This also works...
+WINDOW :: struct {
+ data : [88] u8;
+}
+
+WINDOWx :: struct {
+ _cury, _curx : s16; /* current cursor position */
+
+ /* window location and size */
+ _maxy, _maxx : s16; /* maximums of x and y, NOT window size */
+ _begy, _begx : s16; /* screen coords of upper-left-hand corner */
+
+ _flags :s16; /* window state flags */
+
+ /* attribute tracking */
+ _attrs :u8; /* current attribute for non-space character */
+ _bkgd :u8; /* current background char/attribute pair */
+
+ /* option values set by user */
+ _notimeout :bool; /* no time out on function-key entry? */
+ _clear :bool; /* consider all data in the window invalid? */
+ _leaveok :bool; /* OK to not reset cursor on exit? */
+ _scroll :bool; /* OK to scroll this window? */
+ _idlok :bool; /* OK to use insert/delete line? */
+ _idcok :bool; /* OK to use insert/delete char? */
+ _immed :bool; /* window in immed mode? (not yet used) */
+ _sync :bool; /* window in sync mode? */
+ _use_keypad :bool; /* process function keys into KEY_ symbols? */
+ _delay :s32; /* 0 = nodelay, <0 = blocking, >0 = delay */
+
+ _line :*ldat; /* the actual line data */
+
+ /* global screen state */
+ _regtop :s16; /* top line of scrolling region */
+ _regbottom :s16; /* bottom line of scrolling region */
+
+ /* these are used only if this is a sub-window */
+ _parx :s32; /* x coordinate of this window in parent */
+ _pary :s32; /* y coordinate of this window in parent */
+ _parent :*WINDOW; /* pointer to parent if a sub-window */
+
+ /* these are used only if this is a pad */
+ pdat :: struct
+ {
+ _pad_y, _pad_x :s16 ;
+ _pad_top, _pad_left :s16;
+ _pad_bottom, _pad_right :s16;
+ };
+ _pad :pdat;
+
+ _yoffset :s16; /* real begy is _begy + _yoffset */
+
+/*
+#if NCURSES_WIDECHAR
+ cchar_t _bkgrnd;
+#if 1
+ int _color;
+#endif
+#endif
+*/
+};
+
+
+tinfo :: #system_library "libtinfo"; // Required by some of ncurses functions.
+// NOTE
+// Must use local lib while having package libncurses-dev installed because it introduces
+// an override file:
+// > cat /lib/x86_64-linux-gnu/libncurses.so
+// INPUT(libncursesw.so.6 -ltinfo)
+// I suspect this is an attempt to help the compilers to include libtinfo automatically.
+// ncurses :: #system_library "libncurses";
+ncurses :: #library "libncurses";
+initscr :: () -> *WINDOW #foreign ncurses;
+getch :: () -> s8 #foreign ncurses;
+endwin :: () -> void #foreign ncurses;
+
+curs_set :: (visibility: s32) -> s32 #foreign ncurses;
+mvaddstr :: (y: s32, x: s32, str: *u8) -> s32 #foreign ncurses;
+noecho :: () -> s32 #foreign ncurses;
+box :: (win :*WINDOW, verch :u8, horch :u8) -> s32 #foreign ncurses;
+