Skip to content

Commit

Permalink
confirmd libncurses works better than befor on windows11 msys2 enviro…
Browse files Browse the repository at this point in the history
…nment.
  • Loading branch information
snmsts authored and stylewarning committed Dec 30, 2024
1 parent 2dd2934 commit 9a8dd87
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 23 deletions.
43 changes: 22 additions & 21 deletions src/low-level/curses-bindings.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,10 @@
"libncursesw.so.5"
"libncursesw.so.14.0"
"libncursesw.so"))
(:windows (:or "libpdcurses"
"pdcurses"
"libcurses"))
(:windows (:or #-pdcurses "libncursesw6.dll"
#+pdcurses "libpdcurses"
#+pdcurses "pdcurses"
#+pdcurses "libcurses"))
(t (:default "libcurses")))

#-unicode
Expand All @@ -58,9 +59,10 @@
"libncursesw.so.14.0"
"libncurses.so"
"libcurses"))
(:windows (:or "libpdcurses" ;MSYS installed pdcurses
"pdcurses"
"libcurses"))
(:windows (:or #-pdcurses "libncursesw6.dll"
#+pdcurses "libpdcurses" ;MSYS installed pdcurses
#+pdcurses "pdcurses"
#+pdcurses "libcurses"))
(t (:default "libcurses")))

(cffi:use-foreign-library libcurses)
Expand Down Expand Up @@ -522,14 +524,14 @@
(define-exported-cfuns ("start_color")
:int)

#-(or win32 mswindows)
#-pdcurses
(define-exported-cfuns ("COLOR_PAIR")
:int
(pair :int))

;; Win32 TODO: implement defun based on macro in pdcurses' curses.h

#+(or win32 mswindows)
#+pdcurses
(progn
(export 'color-pair)
(defun color-pair (n) (logand (ash n 24) #xff000000)))
Expand Down Expand Up @@ -794,7 +796,7 @@
(define-exported-cfuns ("curses_version")
:string)

#-(or win32 mswindows) ;; doesn't exist in pdcurses
#-pdcurses ;; doesn't exist in pdcurses
(define-exported-cfuns ("use_extended_names")
:int
(enable bool))
Expand Down Expand Up @@ -922,11 +924,11 @@ value. Replaces primary value (which would be garbage) with :ERROR if C-function
:int
(win window-ptr))

#-(or win32 mswindows) ; macro in pdcurses
#-pdcurses ; macro in pdcurses
(define-exported-cfuns ("getch")
:int)

#+(or win32 mswindows)
#+pdcurses
(progn
(export 'getch)
(defun getch ()
Expand All @@ -943,13 +945,13 @@ value. Replaces primary value (which would be garbage) with :ERROR if C-function
(y :int)
(x :int))

(define-exported-cfuns (#-(or win32 mswindows) "ungetch"
#+(or win32 mswindows) "PDC_ungetch"
(define-exported-cfuns (#-pdcurses "ungetch"
#+pdcurses "PDC_ungetch"
"has_key")
:int
(ch :int))

#+(or win32 mswindows)
#+pdcurses
(defun ungetch (ch)
(PDC-ungetch ch))

Expand Down Expand Up @@ -1352,15 +1354,15 @@ value. Replaces primary value (which would be garbage) with :ERROR if C-function


;; keybound
#-(or win32 mswindows)
#-pdcurses
(define-exported-cfuns ("keybound")
:string
(keycode :int)
(count :int))


;; keyok
#-(or win32 mswindows)
#-pdcurses
(define-exported-cfuns ("keyok")
:int
(keycode :int)
Expand Down Expand Up @@ -1493,7 +1495,7 @@ value. Replaces primary value (which would be garbage) with :ERROR if C-function


;; print
#-(or win32 mswindows)
#-pdcurses
(define-exported-cfuns ("mcprint")
:int
(data :string)
Expand Down Expand Up @@ -1577,19 +1579,19 @@ see printw for examples."


;; resizeterm
#-(or win32 mswindows)
#-pdcurses
(define-exported-cfuns ("is_term_resized")
bool
(lines :int)
(columns :int))

(define-exported-cfuns ("resize_term"
#-(or win32 mswindows) "resizeterm")
#-pdcurses "resizeterm")
:int
(lines :int)
(columns :int))

#+(or win32 mswindows)
#+pdcurses
(progn
(export 'resizeterm)
(setf (fdefinition 'resizeterm) #'resize-term))
Expand Down Expand Up @@ -1695,7 +1697,6 @@ see printw for examples."
;; C-prototype: extern char PC; extern char * UP; extern char * BC; extern short ospeed;
;; C-prototype: int tgetent(char *bp, const char *name);

#-(or win32 mswindows)
(define-exported-cfuns ("tgetflag" "tgetnum")
:int
(id char-ptr))
Expand Down
5 changes: 3 additions & 2 deletions src/low-level/curses-grovel.lisp
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
;; (include "/usr/include/ncurses.h")
#-(or windows win32) (include "ncurses.h")
#+(or windows win32) (include "pdcurses.h")
#-pdcurses (include #-(or windows win32) "ncurses.h"
#+(or windows win32) "ncursesw/ncurses.h")
#+pdcurses(include "pdcurses.h")

(in-package #:cl-charms/low-level)

Expand Down

0 comments on commit 9a8dd87

Please sign in to comment.