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;