]> gitweb.factorcode.org Git - factor.git/commitdiff
curses: simplifications, prepare for menu support
authorPhilipp Brüschweiler <blei42@gmail.com>
Thu, 25 Feb 2010 23:38:17 +0000 (00:38 +0100)
committerPhilipp Brüschweiler <blei42@gmail.com>
Sun, 3 Oct 2010 11:18:31 +0000 (13:18 +0200)
extra/curses/curses.factor
extra/curses/ffi/ffi.factor

index b269d34697f82fb1ac7a470be56ca05d169ba57a..0db3e8f64988bf4714ce62b9f191994e29a8cdf7 100644 (file)
@@ -133,6 +133,7 @@ CONSTANT: KEY_UNDO      OCT: 630  /* undo key */
 CONSTANT: KEY_MOUSE     OCT: 631  /* Mouse event has occurred */
 CONSTANT: KEY_RESIZE    OCT: 632  /* Terminal resize event */
 CONSTANT: KEY_EVENT     OCT: 633  /* We were interrupted by an event */
+CONSTANT: KEY_MAX       OCT: 777  /* Maximum key value is 0633 */
 CONSTANT: KEY_F0        OCT: 410  /* Function keys.  Space for 64 */
 : KEY_F ( n -- code ) KEY_F0 + ; inline /* Value of function key n */
 
@@ -451,30 +452,29 @@ PRIVATE>
     0 <ulong> [ ffi:mousemask ] keep *ulong ;
 
 : wget-yx ( window -- y x )
-    ptr>> ffi:c-window memory>struct [ _cury>> ] [ _curx>> ] bi ;
+    ptr>> [ _cury>> ] [ _curx>> ] bi ;
 : get-yx ( -- y x )
     current-window get wget-yx ;
 
 : wget-y ( window -- y )
-    ptr>> ffi:c-window memory>struct _cury>> ;
+    ptr>> _cury>> ;
 : get-y ( -- y )
     current-window get wget-y ;
 : wget-x ( window -- x )
-    ptr>> ffi:c-window memory>struct _curx>> ;
+    ptr>> _curx>> ;
 : get-x ( -- x )
     current-window get wget-x ;
 
 : wget-max-yx ( window -- y x )
-    ptr>> ffi:c-window memory>struct
-    [ _maxy>> 1 + ] [ _maxx>> 1 + ] bi ;
+    ptr>> [ _maxy>> 1 + ] [ _maxx>> 1 + ] bi ;
 : get-max-yx ( -- y x )
     current-window get wget-max-yx ;
 
 : wget-max-y ( window -- y )
-    ptr>> ffi:c-window memory>struct _maxy>> 1 + ;
+    ptr>> _maxy>> 1 + ;
 : get-max-y ( -- y )
     current-window get wget-max-y ;
 : wget-max-x ( window -- x )
-    ptr>> ffi:c-window memory>struct _maxx>> 1 + ;
+    ptr>> _maxx>> 1 + ;
 : get-max-x ( -- x )
     current-window get wget-max-x ;
index 66fa511619aa19164dbd86effc3a137ab36a3617..85bc15d34b56be5216d443ce93c55808b501425a 100644 (file)
@@ -7,10 +7,9 @@ IN: curses.ffi
 << "curses" {
     { [ os winnt? ]  [ "libcurses.dll" ] }
     { [ os macosx? ] [ "libcurses.dylib" ] }
-    { [ os unix?  ]  [ "libncursesw.so.5.7" ] }
+    { [ os unix?  ]  [ "libncursesw.so" ] }
 } cond cdecl add-library >>
 
-C-TYPE: WINDOW
 C-TYPE: SCREEN
 TYPEDEF: void* va_list
 
@@ -38,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 }