#ifdef __GLASGOW_HASKELL__ #endif module Foreign.C.Types ( CChar(..), CSChar(..), CUChar(..) , CShort(..), CUShort(..), CInt(..), CUInt(..) , CLong(..), CULong(..) , CPtrdiff(..), CSize(..), CWchar(..), CSigAtomic(..) , CLLong(..), CULLong(..) , CIntPtr(..), CUIntPtr(..), CIntMax(..), CUIntMax(..) , CClock(..), CTime(..), CUSeconds(..), CSUSeconds(..) , CFloat(..), CDouble(..) #ifndef __GLASGOW_HASKELL__ , CLDouble(..) #endif , CFile, CFpos, CJmpBuf ) where #ifndef __NHC__ import Foreign.Storable import Data.Bits ( Bits(..) ) import Data.Int ( Int8, Int16, Int32, Int64 ) import Data.Word ( Word8, Word16, Word32, Word64 ) import Data.Typeable #ifdef __GLASGOW_HASKELL__ import GHC.Base import GHC.Float import GHC.Enum import GHC.Real import GHC.Show import GHC.Read import GHC.Num #else import Control.Monad ( liftM ) #endif #ifdef __HUGS__ import Hugs.Ptr ( castPtr ) #endif #include "HsBaseConfig.h" #include "CTypes.h" INTEGRAL_TYPE(CChar,tyConCChar,"CChar",HTYPE_CHAR) INTEGRAL_TYPE(CSChar,tyConCSChar,"CSChar",HTYPE_SIGNED_CHAR) INTEGRAL_TYPE(CUChar,tyConCUChar,"CUChar",HTYPE_UNSIGNED_CHAR) INTEGRAL_TYPE(CShort,tyConCShort,"CShort",HTYPE_SHORT) INTEGRAL_TYPE(CUShort,tyConCUShort,"CUShort",HTYPE_UNSIGNED_SHORT) INTEGRAL_TYPE(CInt,tyConCInt,"CInt",HTYPE_INT) INTEGRAL_TYPE(CUInt,tyConCUInt,"CUInt",HTYPE_UNSIGNED_INT) INTEGRAL_TYPE(CLong,tyConCLong,"CLong",HTYPE_LONG) INTEGRAL_TYPE(CULong,tyConCULong,"CULong",HTYPE_UNSIGNED_LONG) INTEGRAL_TYPE(CLLong,tyConCLLong,"CLLong",HTYPE_LONG_LONG) INTEGRAL_TYPE(CULLong,tyConCULLong,"CULLong",HTYPE_UNSIGNED_LONG_LONG) FLOATING_TYPE(CFloat,tyConCFloat,"CFloat",HTYPE_FLOAT) FLOATING_TYPE(CDouble,tyConCDouble,"CDouble",HTYPE_DOUBLE) #ifndef __GLASGOW_HASKELL__ FLOATING_TYPE(CLDouble,tyConCLDouble,"CLDouble",HTYPE_DOUBLE) #endif INTEGRAL_TYPE(CPtrdiff,tyConCPtrdiff,"CPtrdiff",HTYPE_PTRDIFF_T) INTEGRAL_TYPE(CSize,tyConCSize,"CSize",HTYPE_SIZE_T) INTEGRAL_TYPE(CWchar,tyConCWchar,"CWchar",HTYPE_WCHAR_T) INTEGRAL_TYPE(CSigAtomic,tyConCSigAtomic,"CSigAtomic",HTYPE_SIG_ATOMIC_T) ARITHMETIC_TYPE(CClock,tyConCClock,"CClock",HTYPE_CLOCK_T) ARITHMETIC_TYPE(CTime,tyConCTime,"CTime",HTYPE_TIME_T) ARITHMETIC_TYPE(CUSeconds,tyConCUSeconds,"CUSeconds",HTYPE_USECONDS_T) ARITHMETIC_TYPE(CSUSeconds,tyConCSUSeconds,"CSUSeconds",HTYPE_SUSECONDS_T) data CFile = CFile data CFpos = CFpos data CJmpBuf = CJmpBuf INTEGRAL_TYPE(CIntPtr,tyConCIntPtr,"CIntPtr",HTYPE_INTPTR_T) INTEGRAL_TYPE(CUIntPtr,tyConCUIntPtr,"CUIntPtr",HTYPE_UINTPTR_T) INTEGRAL_TYPE(CIntMax,tyConCIntMax,"CIntMax",HTYPE_INTMAX_T) INTEGRAL_TYPE(CUIntMax,tyConCUIntMax,"CUIntMax",HTYPE_UINTMAX_T) #else /* __NHC__ */ import NHC.FFI ( CChar(..), CSChar(..), CUChar(..) , CShort(..), CUShort(..), CInt(..), CUInt(..) , CLong(..), CULong(..), CLLong(..), CULLong(..) , CPtrdiff(..), CSize(..), CWchar(..), CSigAtomic(..) , CClock(..), CTime(..), CUSeconds(..), CSUSeconds(..) , CFloat(..), CDouble(..), CLDouble(..) , CIntPtr(..), CUIntPtr(..), CIntMax(..), CUIntMax(..) , CFile, CFpos, CJmpBuf , Storable(..) ) import Data.Bits import NHC.SizedTypes #define INSTANCE_BITS(T) \ instance Bits T where { \ (T x) .&. (T y) = T (x .&. y) ; \ (T x) .|. (T y) = T (x .|. y) ; \ (T x) `xor` (T y) = T (x `xor` y) ; \ complement (T x) = T (complement x) ; \ shift (T x) n = T (shift x n) ; \ rotate (T x) n = T (rotate x n) ; \ bit n = T (bit n) ; \ setBit (T x) n = T (setBit x n) ; \ clearBit (T x) n = T (clearBit x n) ; \ complementBit (T x) n = T (complementBit x n) ; \ testBit (T x) n = testBit x n ; \ bitSize (T x) = bitSize x ; \ isSigned (T x) = isSigned x ; \ popCount (T x) = popCount x } INSTANCE_BITS(CChar) INSTANCE_BITS(CSChar) INSTANCE_BITS(CUChar) INSTANCE_BITS(CShort) INSTANCE_BITS(CUShort) INSTANCE_BITS(CInt) INSTANCE_BITS(CUInt) INSTANCE_BITS(CLong) INSTANCE_BITS(CULong) INSTANCE_BITS(CLLong) INSTANCE_BITS(CULLong) INSTANCE_BITS(CPtrdiff) INSTANCE_BITS(CWchar) INSTANCE_BITS(CSigAtomic) INSTANCE_BITS(CSize) INSTANCE_BITS(CIntPtr) INSTANCE_BITS(CUIntPtr) INSTANCE_BITS(CIntMax) INSTANCE_BITS(CUIntMax) #endif
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4