[darcs-devel] darcs patch: use C library version of isprint in ColourPrinter

David Roundy droundy at abridgegame.org
Sat Nov 12 06:27:20 PST 2005


On Fri, Nov 11, 2005 at 06:36:24PM +0100, Tommy Pettersson wrote:
> I don't understand fully what I'm doing, I just copied and changed from
> other examples untill it compiled.  Especially I'm unsure about the type
> casting.  The declaration should probably be CInt -> CInt and the
> invocation should convert this into Char -> Bool.

Indeed, we definitely should declase it as CInt -> CInt.  Otherwise we
could get all sort of exciting cross-platform troubles.

> I don't know if it works.  I don't have GHC 2.4 (yet).

I think you mean ghc 6.4?

> I know darcs is becoming 1.0.4 about just now, and I'm sorry I don't have
> more time for this right now, but if this change looks undangerous and
> someone can confirm that it works, it would be really good if it makes it
> into 1.0.4 (for those with GHC 2.4 and 8-bit locales).

I think this definitely requires significant testing (or confirmation from
someone who really knows what they're talking about), and won't make it
into 1.0.4.  But with care, perhaps 1.0.5 needn't take so long to
release...

> Fri Nov 11 17:43:04 CET 2005  Tommy Pettersson <ptp at lysator.liu.se>
>   * use C library version of isprint in ColourPrinter

> +foreign import ccall "ctype.h isprint" c_isprint :: Char -> Bool

import Data.Char ( ord )
foreign import ccall "ctype.h isprint" c_isprint :: CInt -> CInt
myisprint :: Char -> Bool
myisprint = (/=0) . c_isprint . ord
-- 
David Roundy
http://www.darcs.net




More information about the darcs-devel mailing list