From 433c0657294df1fbfa97cca6f2d5e56d0060f40f Mon Sep 17 00:00:00 2001 From: Joe Groff Date: Sat, 19 Sep 2009 20:47:11 -0500 Subject: [PATCH] update structs in curses --- extra/curses/curses.factor | 8 ++-- extra/curses/ffi/ffi.factor | 80 ++++++++++++++++++------------------- 2 files changed, 44 insertions(+), 44 deletions(-) diff --git a/extra/curses/curses.factor b/extra/curses/curses.factor index 3e466b4781..4d6c77fd23 100644 --- a/extra/curses/curses.factor +++ b/extra/curses/curses.factor @@ -3,7 +3,7 @@ USING: accessors alien.c-types alien.strings assocs byte-arrays combinators continuations destructors fry io.encodings.8-bit io io.encodings.string io.encodings.utf8 kernel math -namespaces prettyprint sequences +namespaces prettyprint sequences classes.struct strings threads curses.ffi ; IN: curses @@ -133,12 +133,12 @@ PRIVATE> : move-cursor ( window-name y x -- ) [ - window-ptr + window-ptr c-window memory>struct { [ ] [ (curses-window-refresh) ] - [ c-window-_curx ] - [ c-window-_cury ] + [ _curx>> ] + [ _cury>> ] } cleave ] 2dip mvcur curses-error (curses-window-refresh) ; diff --git a/extra/curses/ffi/ffi.factor b/extra/curses/ffi/ffi.factor index 3ff9404bff..4eb01e913c 100644 --- a/extra/curses/ffi/ffi.factor +++ b/extra/curses/ffi/ffi.factor @@ -1,7 +1,7 @@ ! Copyright (C) 2008 Doug Coleman. ! See http://factorcode.org/license.txt for BSD license. USING: accessors alien alien.syntax combinators kernel system -alien.libraries ; +alien.libraries classes.struct ; IN: curses.ffi << "curses" { @@ -21,56 +21,56 @@ TYPEDEF: ushort wchar_t CONSTANT: CCHARW_MAX 5 -C-STRUCT: cchar_t - { "attr_t" "attr" } - { { "wchar_t" CCHARW_MAX } "chars" } ; +STRUCT: cchar_t + { attr attr_t } + { chars { wchar_t CCHARW_MAX } } ; -C-STRUCT: pdat - { "NCURSES_SIZE_T" "_pad_y" } - { "NCURSES_SIZE_T" "_pad_x" } - { "NCURSES_SIZE_T" "_pad_top" } - { "NCURSES_SIZE_T" "_pad_left" } - { "NCURSES_SIZE_T" "_pad_bottom" } - { "NCURSES_SIZE_T" "_pad_right" } ; +STRUCT: pdat + { _pad_y NCURSES_SIZE_T } + { _pad_x NCURSES_SIZE_T } + { _pad_top NCURSES_SIZE_T } + { _pad_left NCURSES_SIZE_T } + { _pad_bottom NCURSES_SIZE_T } + { _pad_right NCURSES_SIZE_T } ; -C-STRUCT: c-window - { "NCURSES_SIZE_T" "_cury" } - { "NCURSES_SIZE_T" "_curx" } +STRUCT: c-window + { _cury NCURSES_SIZE_T } + { _curx NCURSES_SIZE_T } - { "NCURSES_SIZE_T" "_maxy" } - { "NCURSES_SIZE_T" "_maxx" } - { "NCURSES_SIZE_T" "_begy" } - { "NCURSES_SIZE_T" "_begx" } + { _maxy NCURSES_SIZE_T } + { _maxx NCURSES_SIZE_T } + { _begy NCURSES_SIZE_T } + { _begx NCURSES_SIZE_T } - { "short" " _flags" } + { _flags short } - { "attr_t" "_attrs" } - { "chtype" "_bkgd" } + { _attrs attr_t } + { _bkgd chtype } - { "bool" "_notimeout" } - { "bool" "_clear" } - { "bool" "_leaveok" } - { "bool" "_scroll" } - { "bool" "_idlok" } - { "bool" "_idcok" } - { "bool" "_immed" } - { "bool" "_sync" } - { "bool" "_use_keypad" } - { "int" "_delay" } + { _notimeout bool } + { _clear bool } + { _leaveok bool } + { _scroll bool } + { _idlok bool } + { _idcok bool } + { _immed bool } + { _sync bool } + { _use_keypad bool } + { _delay int } - { "char*" "_line" } - { "NCURSES_SIZE_T" "_regtop" } - { "NCURSES_SIZE_T" "_regbottom" } + { _line char* } + { _regtop NCURSES_SIZE_T } + { _regbottom NCURSES_SIZE_T } - { "int" "_parx" } - { "int" "_pary" } - { "WINDOW*" "_parent" } + { _parx int } + { _pary int } + { _parent WINDOW* } - { "pdat" "_pad" } + { _pad pdat } - { "NCURSES_SIZE_T" "_yoffset" } + { _yoffset NCURSES_SIZE_T } - { "cchar_t" "_bkgrnd" } ; + { _bkgrnd cchar_t } ; LIBRARY: curses