diff --git a/src/NCurses/Core.idr b/src/NCurses/Core.idr index e0318a9..356a82a 100644 --- a/src/NCurses/Core.idr +++ b/src/NCurses/Core.idr @@ -63,10 +63,10 @@ prim__erase : PrimIO () %foreign libncurses "werase" prim__eraseWindow : AnyPtr -> PrimIO () -%foreign libncurses "printw" +%foreign libhelper "print" prim__print : String -> String -> PrimIO () -%foreign libncurses "wprintw" +%foreign libhelper "printWindow" prim__printWindow : AnyPtr -> String -> String -> PrimIO () %foreign libncurses "addch" @@ -83,10 +83,10 @@ prim__addCharWindow : AnyPtr -> Char -> PrimIO () ||| ||| The second to last argument is a format string but ||| its best to just always pass strings ("%s"). -%foreign libncurses "mvprintw" +%foreign libhelper "mvPrint" prim__mvPrint : Int -> Int -> String -> String -> PrimIO () -%foreign libncurses "mvwprintw" +%foreign libhelper "mvPrintWindow" prim__mvPrintWindow : AnyPtr -> Int -> Int -> String -> String -> PrimIO () %foreign libncurses "vline" diff --git a/support/curses-helpers.c b/support/curses-helpers.c index 809717e..87929d2 100644 --- a/support/curses-helpers.c +++ b/support/curses-helpers.c @@ -154,3 +154,18 @@ int keyBackspace() { return KEY_BACKSPACE; } +int print(const char* fmt, const char* arg) { + return printw(fmt, arg); +} + +int printWindow(WINDOW* win, const char* fmt, const char* arg) { + return wprintw(win, fmt, arg); +} + +int mvPrint(int y, int x, const char* fmt, char* arg) { + return mvprintw(y, x, fmt, arg); +} + +int mvPrintWindow(WINDOW* win, int y, int x, const char* fmt, char* arg) { + return mvwprintw(win, y, x, fmt, arg); +}