]> gitweb.factorcode.org Git - factor.git/blobdiff - extra/curses/ffi/ffi.factor
use radix literals
[factor.git] / extra / curses / ffi / ffi.factor
index 591c8c820a49adcffdf537c9831c0446f5e19c7c..c3b0d42cd260b97529c67708352d053b01d794dd 100644 (file)
@@ -5,12 +5,11 @@ alien.syntax classes.struct combinators kernel math system unix.types ;
 IN: curses.ffi
 
 << "curses" {
-    { [ os winnt? ]  [ "libcurses.dll" ] }
+    { [ os windows? ]  [ "libcurses.dll" ] }
     { [ os macosx? ] [ "libcurses.dylib" ] }
-    { [ os unix?  ]  [ "libncurses.so.5.7" ] }
+    { [ os unix?  ]  [ "libncursesw.so" ] }
 } cond cdecl add-library >>
 
-C-TYPE: WINDOW
 C-TYPE: SCREEN
 TYPEDEF: void* va_list
 
@@ -18,6 +17,7 @@ TYPEDEF: uint chtype
 TYPEDEF: chtype attr_t
 TYPEDEF: short NCURSES_SIZE_T
 TYPEDEF: ushort wchar_t
+TYPEDEF: ulong mmask_t
 
 CONSTANT: CCHARW_MAX  5
 
@@ -37,7 +37,7 @@ STRUCT: pdat
 { _pad_bottom NCURSES_SIZE_T }
 { _pad_right NCURSES_SIZE_T } ;
 
-STRUCT: c-window
+STRUCT: WINDOW
 { _cury NCURSES_SIZE_T }
 { _curx NCURSES_SIZE_T }
 
@@ -76,6 +76,11 @@ STRUCT: c-window
 
 { _bkgrnd cchar_t } ;
 
+STRUCT: MEVENT
+    { id short }
+    { x int } { y int } { z int }
+    { bstate mmask_t } ;
+
 LIBRARY: curses
 
 C-GLOBAL: void* stdscr
@@ -180,7 +185,6 @@ FUNCTION: int vw_printw ( WINDOW* win, c-string fmt, va_list varglist ) ;
 FUNCTION: int move ( int y, int x ) ;
 FUNCTION: int wmove ( WINDOW* win, int y, int x ) ;
 
-
 FUNCTION: int scroll ( WINDOW* win ) ;
 FUNCTION: int scrl ( int n ) ;
 FUNCTION: int wscrl ( WINDOW* win, int n ) ;
@@ -249,6 +253,30 @@ C-GLOBAL: int COLOR_PAIRS
 
 : COLOR_PAIR ( n -- n' ) 8 shift ; inline foldable
 
+FUNCTION: int wcolor_set ( WINDOW* win, short color_pair_number, void* opts ) ;
+
 FUNCTION: int wattron ( WINDOW* win, int attrs ) ;
 FUNCTION: int wattroff ( WINDOW* win, int attrs ) ;
 FUNCTION: int wattrset ( WINDOW* win, int attrs ) ;
+
+: NCURSES_MOUSE_MASK ( b m -- mask ) swap 1 - 6 * shift ; inline
+
+CONSTANT: NCURSES_BUTTON_RELEASED 0o01
+CONSTANT: NCURSES_BUTTON_PRESSED  0o02
+CONSTANT: NCURSES_BUTTON_CLICKED  0o04
+CONSTANT: NCURSES_DOUBLE_CLICKED  0o10
+CONSTANT: NCURSES_TRIPLE_CLICKED  0o20
+CONSTANT: NCURSES_RESERVED_EVENT  0o40
+
+FUNCTION: int getmouse ( MEVENT* event ) ;
+FUNCTION: int ungetmouse ( MEVENT* event ) ;
+FUNCTION: mmask_t mousemask ( mmask_t newmask, mmask_t* oldmask ) ;
+FUNCTION: bool wenclose ( WINDOW* win, int y, int x ) ;
+FUNCTION: bool mouse_trafo ( int* pY, int* pX, bool to_screen ) ;
+FUNCTION: bool wmouse_trafo ( WINDOW* win, int* pY, int* pX, bool to_screen ) ;
+FUNCTION: int mouseinterval ( int erval ) ;
+
+FUNCTION: int wborder ( WINDOW* win, chtype ls, chtype rs, chtype ts, chtype bs, chtype tl, chtype tr, chtype bl, chtype br ) ;
+FUNCTION: int box ( WINDOW* win, chtype verch, chtype horch ) ;
+FUNCTION: int whline ( WINDOW* win, chtype ch, int n ) ;
+FUNCTION: int wvline ( WINDOW* win, chtype ch, int n ) ;