packages feed

ncurses 0.2.10 → 0.2.11

raw patch · 4 files changed

+94/−6 lines, 4 filesdep ~containersdep ~textdep ~transformers

Dependency ranges changed: containers, text, transformers

Files

lib/UI/NCurses.chs view
@@ -141,11 +141,11 @@ import           Data.Maybe (catMaybes) import qualified Data.Map as M import qualified Data.Text as T-import           Foreign hiding (shift)+import           Foreign hiding (shift, void) import           Foreign.C - import qualified UI.NCurses.Enums as E+import           UI.NCurses.Compat import           UI.NCurses.Types  #include "cbits/mavericks-c2hs-workaround.h"@@ -166,6 +166,23 @@  #include "cbits/hsncurses-shim.h" +-- Starting with version 0.18.1, c2hs changed the handling of get/set hooks+-- when using newtype'd pointers: <https://github.com/haskell/c2hs/issues/96>.+--+-- Version 0.18.2 introduced the C2HS_MIN_VERSION macro to perform+-- version detection: <https://github.com/haskell/c2hs/issues/107>.+--+-- Detecting version 0.18.1 is impractical, so we depend on a Cabal flag for+-- users who need that particular version.+#if !defined(HSNCURSES_NEWTYPE_POINTER_HOOKS)+#if !defined(C2HS_MIN_VERSION)+#define C2HS_MIN_VERSION(mj,mn,rv) (mj<=0&&mn<=18&&rv<=0)+#endif+#if C2HS_MIN_VERSION(0,18,1)+#define HSNCURSES_NEWTYPE_POINTER_HOOKS+#endif+#endif+ {# pointer *WINDOW as Window nocode #} {# pointer *cchar_t as CCharT newtype #} {# pointer *wchar_t as CWString nocode #}@@ -383,6 +400,12 @@ 	| ColorMagenta 	| ColorCyan 	| ColorWhite++	-- | An unspecified default terminal color, for terminals that support+	-- ISO/IEC 6429 escape sequences (or equivalent).+	--+	-- This is most useful for terminals with translucent backgrounds.+	| ColorDefault 	deriving (Show, Eq)  -- | A wrapper around 'Integer' to ensure clients don&#x2019;t use an@@ -403,6 +426,7 @@ 	ColorMagenta -> colorEnum E.COLOR_MAGENTA 	ColorCyan    -> colorEnum E.COLOR_CYAN 	ColorWhite   -> colorEnum E.COLOR_WHITE+	ColorDefault -> colorEnum E.COLOR_DEFAULT  -- | Check if the terminal supports color. If it doesn&#x2019;t, -- alternative indicators (such as underlines or bold) should be used.@@ -498,8 +522,13 @@ 	 	allocaBytes {# sizeof cchar_t #} $ \pBuf -> do 	void $ {# call memset #} (castPtr pBuf) 0 {# sizeof cchar_t #}+#ifdef HSNCURSES_NEWTYPE_POINTER_HOOKS+	{# set cchar_t->attr #} (CCharT pBuf) cAttrs+	{# set cchar_t->chars #} (CCharT pBuf) (wordPtrToPtr (fromIntegral (ord char)))+#else 	{# set cchar_t->attr #} pBuf cAttrs 	{# set cchar_t->chars #} pBuf (wordPtrToPtr (fromIntegral (ord char)))+#endif 	io (CCharT pBuf)  -- | Upper left corner
+ lib/UI/NCurses/Compat.hs view
@@ -0,0 +1,29 @@+{-# LANGUAGE CPP #-}++-- Copyright (C) 2014 John Millikin <jmillikin@gmail.com>+--+-- This program is free software: you can redistribute it and/or modify+-- it under the terms of the GNU General Public License as published by+-- the Free Software Foundation, either version 3 of the License, or+-- any later version.+--+-- This program is distributed in the hope that it will be useful,+-- but WITHOUT ANY WARRANTY; without even the implied warranty of+-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the+-- GNU General Public License for more details.+--+-- You should have received a copy of the GNU General Public License+-- along with this program.  If not, see <http://www.gnu.org/licenses/>.++-- This is a separate file because c2hs doesn't define MIN_VERSION_*+-- macros when it's preprocessing a .chs file.+module UI.NCurses.Compat+	( void+	) where++#if MIN_VERSION_base(4,3,0)+import           Control.Monad (void)+#else+void :: Functor f => f a -> f ()+void = fmap (const ())+#endif
lib/UI/NCurses/Enums.chs view
@@ -18,7 +18,7 @@ -- of 'Int', so integral defines of any size can be retrieved. module UI.NCurses.Enums where -import           Prelude (Integer, error, show, (++))+import           Prelude (Integer, error, show, (++), compare, Ordering(..))  #include "cbits/mavericks-c2hs-workaround.h" @@ -36,6 +36,23 @@ 	toEnum :: Integer -> a 	fromEnum :: a -> Integer +	-- c2hs 0.18.1 additionally defines these in its Enum instances,+	-- but we don't use them.+	pred, succ :: a -> a+	pred = error "ncurses Enum: pred"+	succ = error "ncurses Enum: succ"+	+	enumFrom :: a -> [a]+	enumFrom = error "ncurses Enum: enumFrom"+	enumFromThen :: a -> a -> [a]+	enumFromThen = error "ncurses Enum: enumFromThen"+	enumFromTo :: a -> a -> [a]+	enumFromTo = error "ncurses Enum: enumFromTo"+	enumFromThenTo :: a -> a -> a -> [a]+	enumFromThenTo = error "ncurses Enum: enumFromThenTo"+++ -- misc enums #c enum hsncurses_EnumWrapper@@ -74,6 +91,7 @@ , hsncurses_COLOR_MAGENTA = COLOR_MAGENTA , hsncurses_COLOR_CYAN = COLOR_CYAN , hsncurses_COLOR_WHITE = COLOR_WHITE+, hsncurses_COLOR_DEFAULT = -1 }; #endc 
ncurses.cabal view
@@ -1,5 +1,5 @@ name: ncurses-version: 0.2.10+version: 0.2.11 license: GPL-3 license-file: license.txt author: John Millikin <jmillikin@gmail.com>@@ -17,7 +17,7 @@   pseudo-graphical interfaces. This package is a nice, modern binding   to GNU ncurses.   .-  The following example is a program that display the message+  The following example is a program that displays the message   \"Hello world!\" until the user hits Q:   .   @@@ -57,7 +57,7 @@ source-repository this   type: git   location: https://john-millikin.com/code/haskell-ncurses/-  tag: haskell-ncurses_0.2.10+  tag: haskell-ncurses_0.2.11  -- Do not use default to using pkg-config to find ncurses libraries, because -- the .pc files are missing or broken in many installations.@@ -75,6 +75,14 @@     only useful on systems that have the ncursesw package installed     incorrectly. On most systems this will cause compile- or run-time errors. +flag force-c2hs-newtype-pointer-hooks+  default: False+  manual: True+  description:+    Force using the newtype'd pointer hooks introduced in c2hs 0.18.1. This+    is only necessary when building with c2hs==0.18.1, as 0.18.2 and later+    can be auto-detected.+ library   hs-source-dirs: lib   ghc-options: -Wall -O2@@ -108,6 +116,9 @@     else       extra-libraries: panelw ncursesw pthread +  if flag(force-c2hs-newtype-pointer-hooks)+    cc-options: -DHSNCURSES_NEWTYPE_POINTER_HOOKS+   c-sources: cbits/hsncurses-shim.c    exposed-modules:@@ -116,4 +127,5 @@    other-modules:     UI.NCurses.Enums+    UI.NCurses.Compat     UI.NCurses.Types