Skip to content

Commit

Permalink
Merge pull request #30 from dunhamsteve/macos-fixes
Browse files Browse the repository at this point in the history
[ fix ] Fix issues with varargs FFI on M1 mac
  • Loading branch information
mattpolzin authored Jan 4, 2023
2 parents 228dac8 + c4a77f7 commit c3a9a8c
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/NCurses/Core.idr
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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"
Expand Down
15 changes: 15 additions & 0 deletions support/curses-helpers.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

0 comments on commit c3a9a8c

Please sign in to comment.