Safe Haskell | None |
---|---|
Language | Haskell2010 |
Synopsis
- newStablePtr :: a -> IO (StablePtr a)
- data Int
- data Int8
- data Int16
- data Int32
- data Int64
- data StablePtr a
- data Word
- data Word8
- data Word16
- data Word32
- data Word64
- data Ptr a
- data FunPtr a
- data ForeignPtr a
- pooledNewArray0 :: Storable a => Pool -> a -> [a] -> IO (Ptr a)
- pooledNewArray :: Storable a => Pool -> [a] -> IO (Ptr a)
- pooledNew :: Storable a => Pool -> a -> IO (Ptr a)
- pooledReallocArray0 :: Storable a => Pool -> Ptr a -> Int -> IO (Ptr a)
- pooledReallocArray :: Storable a => Pool -> Ptr a -> Int -> IO (Ptr a)
- pooledMallocArray0 :: Storable a => Pool -> Int -> IO (Ptr a)
- pooledMallocArray :: Storable a => Pool -> Int -> IO (Ptr a)
- pooledReallocBytes :: Pool -> Ptr a -> Int -> IO (Ptr a)
- pooledRealloc :: Storable a => Pool -> Ptr a -> IO (Ptr a)
- pooledMallocBytes :: Pool -> Int -> IO (Ptr a)
- pooledMalloc :: Storable a => Pool -> IO (Ptr a)
- withPool :: (Pool -> IO b) -> IO b
- freePool :: Pool -> IO ()
- newPool :: IO Pool
- data Pool
- withCWStringLen :: String -> (CWStringLen -> IO a) -> IO a
- withCWString :: String -> (CWString -> IO a) -> IO a
- newCWStringLen :: String -> IO CWStringLen
- newCWString :: String -> IO CWString
- peekCWStringLen :: CWStringLen -> IO String
- peekCWString :: CWString -> IO String
- withCAStringLen :: String -> (CStringLen -> IO a) -> IO a
- withCAString :: String -> (CString -> IO a) -> IO a
- newCAStringLen :: String -> IO CStringLen
- newCAString :: String -> IO CString
- peekCAStringLen :: CStringLen -> IO String
- peekCAString :: CString -> IO String
- castCharToCSChar :: Char -> CSChar
- castCSCharToChar :: CSChar -> Char
- castCharToCUChar :: Char -> CUChar
- castCUCharToChar :: CUChar -> Char
- castCharToCChar :: Char -> CChar
- castCCharToChar :: CChar -> Char
- charIsRepresentable :: Char -> IO Bool
- withCStringLen :: String -> (CStringLen -> IO a) -> IO a
- withCString :: String -> (CString -> IO a) -> IO a
- newCStringLen :: String -> IO CStringLen
- newCString :: String -> IO CString
- peekCStringLen :: CStringLen -> IO String
- peekCString :: CString -> IO String
- type CString = Ptr CChar
- type CStringLen = (Ptr CChar, Int)
- type CWString = Ptr CWchar
- type CWStringLen = (Ptr CWchar, Int)
- advancePtr :: Storable a => Ptr a -> Int -> Ptr a
- lengthArray0 :: (Storable a, Eq a) => a -> Ptr a -> IO Int
- moveArray :: Storable a => Ptr a -> Ptr a -> Int -> IO ()
- copyArray :: Storable a => Ptr a -> Ptr a -> Int -> IO ()
- withArrayLen0 :: Storable a => a -> [a] -> (Int -> Ptr a -> IO b) -> IO b
- withArray0 :: Storable a => a -> [a] -> (Ptr a -> IO b) -> IO b
- withArrayLen :: Storable a => [a] -> (Int -> Ptr a -> IO b) -> IO b
- withArray :: Storable a => [a] -> (Ptr a -> IO b) -> IO b
- newArray0 :: Storable a => a -> [a] -> IO (Ptr a)
- newArray :: Storable a => [a] -> IO (Ptr a)
- pokeArray0 :: Storable a => a -> Ptr a -> [a] -> IO ()
- pokeArray :: Storable a => Ptr a -> [a] -> IO ()
- peekArray0 :: (Storable a, Eq a) => a -> Ptr a -> IO [a]
- peekArray :: Storable a => Int -> Ptr a -> IO [a]
- reallocArray0 :: Storable a => Ptr a -> Int -> IO (Ptr a)
- reallocArray :: Storable a => Ptr a -> Int -> IO (Ptr a)
- allocaArray0 :: Storable a => Int -> (Ptr a -> IO b) -> IO b
- allocaArray :: Storable a => Int -> (Ptr a -> IO b) -> IO b
- callocArray0 :: Storable a => Int -> IO (Ptr a)
- callocArray :: Storable a => Int -> IO (Ptr a)
- mallocArray0 :: Storable a => Int -> IO (Ptr a)
- mallocArray :: Storable a => Int -> IO (Ptr a)
- fillBytes :: Ptr a -> Word8 -> Int -> IO ()
- moveBytes :: Ptr a -> Ptr a -> Int -> IO ()
- copyBytes :: Ptr a -> Ptr a -> Int -> IO ()
- withMany :: (a -> (b -> res) -> res) -> [a] -> ([b] -> res) -> res
- maybePeek :: (Ptr a -> IO b) -> Ptr a -> IO (Maybe b)
- maybeWith :: (a -> (Ptr b -> IO c) -> IO c) -> Maybe a -> (Ptr b -> IO c) -> IO c
- maybeNew :: (a -> IO (Ptr b)) -> Maybe a -> IO (Ptr b)
- toBool :: (Eq a, Num a) => a -> Bool
- fromBool :: Num a => Bool -> a
- with :: Storable a => a -> (Ptr a -> IO b) -> IO b
- new :: Storable a => a -> IO (Ptr a)
- free :: Ptr a -> IO ()
- reallocBytes :: Ptr a -> Int -> IO (Ptr a)
- realloc :: Storable b => Ptr a -> IO (Ptr b)
- allocaBytesAligned :: Int -> Int -> (Ptr a -> IO b) -> IO b
- allocaBytes :: Int -> (Ptr a -> IO b) -> IO b
- alloca :: Storable a => (Ptr a -> IO b) -> IO b
- callocBytes :: Int -> IO (Ptr a)
- mallocBytes :: Int -> IO (Ptr a)
- calloc :: Storable a => IO (Ptr a)
- malloc :: Storable a => IO (Ptr a)
- finalizerFree :: FinalizerPtr a
- void :: IO a -> IO ()
- throwIfNull :: String -> IO (Ptr a) -> IO (Ptr a)
- throwIfNeg_ :: (Ord a, Num a) => (a -> String) -> IO a -> IO ()
- throwIfNeg :: (Ord a, Num a) => (a -> String) -> IO a -> IO a
- throwIf_ :: (a -> Bool) -> (a -> String) -> IO a -> IO ()
- throwIf :: (a -> Bool) -> (a -> String) -> IO a -> IO a
- mallocForeignPtrArray0 :: Storable a => Int -> IO (ForeignPtr a)
- mallocForeignPtrArray :: Storable a => Int -> IO (ForeignPtr a)
- newForeignPtrEnv :: FinalizerEnvPtr env a -> Ptr env -> Ptr a -> IO (ForeignPtr a)
- withForeignPtr :: ForeignPtr a -> (Ptr a -> IO b) -> IO b
- newForeignPtr :: FinalizerPtr a -> Ptr a -> IO (ForeignPtr a)
- finalizeForeignPtr :: ForeignPtr a -> IO ()
- plusForeignPtr :: ForeignPtr a -> Int -> ForeignPtr b
- castForeignPtr :: ForeignPtr a -> ForeignPtr b
- touchForeignPtr :: ForeignPtr a -> IO ()
- newForeignPtr_ :: Ptr a -> IO (ForeignPtr a)
- addForeignPtrFinalizerEnv :: FinalizerEnvPtr env a -> Ptr env -> ForeignPtr a -> IO ()
- addForeignPtrFinalizer :: FinalizerPtr a -> ForeignPtr a -> IO ()
- mallocForeignPtrBytes :: Int -> IO (ForeignPtr a)
- mallocForeignPtr :: Storable a => IO (ForeignPtr a)
- type FinalizerPtr a = FunPtr (Ptr a -> IO ())
- type FinalizerEnvPtr env a = FunPtr (Ptr env -> Ptr a -> IO ())
- intPtrToPtr :: IntPtr -> Ptr a
- ptrToIntPtr :: Ptr a -> IntPtr
- wordPtrToPtr :: WordPtr -> Ptr a
- ptrToWordPtr :: Ptr a -> WordPtr
- freeHaskellFunPtr :: FunPtr a -> IO ()
- newtype WordPtr = WordPtr Word
- newtype IntPtr = IntPtr Int
- class Storable a where
- castPtrToStablePtr :: Ptr () -> StablePtr a
- castStablePtrToPtr :: StablePtr a -> Ptr ()
- deRefStablePtr :: StablePtr a -> IO a
- freeStablePtr :: StablePtr a -> IO ()
- castPtrToFunPtr :: Ptr a -> FunPtr b
- castFunPtrToPtr :: FunPtr a -> Ptr b
- castFunPtr :: FunPtr a -> FunPtr b
- nullFunPtr :: FunPtr a
- minusPtr :: Ptr a -> Ptr b -> Int
- alignPtr :: Ptr a -> Int -> Ptr a
- plusPtr :: Ptr a -> Int -> Ptr b
- castPtr :: Ptr a -> Ptr b
- nullPtr :: Ptr a
- byteSwap64 :: Word64 -> Word64
- byteSwap32 :: Word32 -> Word32
- byteSwap16 :: Word16 -> Word16
- toIntegralSized :: (Integral a, Integral b, Bits a, Bits b) => a -> Maybe b
- popCountDefault :: (Bits a, Num a) => a -> Int
- testBitDefault :: (Bits a, Num a) => a -> Int -> Bool
- bitDefault :: (Bits a, Num a) => Int -> a
- class Eq a => Bits a where
- (.&.) :: a -> a -> a
- (.|.) :: a -> a -> a
- xor :: a -> a -> a
- complement :: a -> a
- shift :: a -> Int -> a
- rotate :: a -> Int -> a
- zeroBits :: a
- bit :: Int -> a
- setBit :: a -> Int -> a
- clearBit :: a -> Int -> a
- complementBit :: a -> Int -> a
- testBit :: a -> Int -> Bool
- bitSizeMaybe :: a -> Maybe Int
- bitSize :: a -> Int
- isSigned :: a -> Bool
- shiftL :: a -> Int -> a
- unsafeShiftL :: a -> Int -> a
- shiftR :: a -> Int -> a
- unsafeShiftR :: a -> Int -> a
- rotateL :: a -> Int -> a
- rotateR :: a -> Int -> a
- popCount :: a -> Int
- class Bits b => FiniteBits b where
- finiteBitSize :: b -> Int
- countLeadingZeros :: b -> Int
- countTrailingZeros :: b -> Int
- ft_Init_FreeType :: Ptr FT_Library -> IO FT_Error
- ft_New_Face :: FT_Library -> CString -> FT_Long -> Ptr FT_Face -> IO FT_Error
- ft_Set_Char_Size :: FT_Face -> FT_F26Dot6 -> FT_F26Dot6 -> FT_UInt -> FT_UInt -> IO FT_Error
- ft_Set_Pixel_Sizes :: FT_Face -> FT_UInt -> FT_UInt -> IO FT_Error
- ft_Get_Char_Index :: FT_Face -> FT_ULong -> IO FT_UInt
- ft_Set_Transform :: FT_Face -> Ptr FT_Matrix -> Ptr FT_Vector -> IO ()
- ft_Load_Char :: FT_Face -> FT_ULong -> FT_Int32 -> IO FT_Error
- ft_Done_Face :: FT_Face -> IO FT_Error
- ft_Done_FreeType :: FT_Library -> IO FT_Error
- ft_Load_Glyph :: FT_Face -> FT_UInt -> FT_Int32 -> IO FT_Error
- ft_Get_Glyph :: FT_GlyphSlot -> Ptr FT_Glyph -> IO FT_Error
- ft_Done_Glyph :: FT_Glyph -> IO ()
- ft_Glyph_To_Bitmap :: Ptr FT_Glyph -> FT_Render_Mode -> Ptr FT_Vector -> FT_Bool -> IO FT_Error
- ft_Library_Version :: FT_Library -> Ptr FT_Int -> Ptr FT_Int -> Ptr FT_Int -> IO ()
- ft_Face_CheckTrueTypePatents :: FT_Face -> IO FT_Bool
- ft_Face_SetUnpatentedHinting :: FT_Face -> FT_Bool -> IO FT_Bool
- ft_New_Memory_Face :: FT_Library -> FT_Bytes -> FT_Long -> FT_Long -> Ptr FT_Face -> IO FT_Error
- ft_Open_Face :: FT_Library -> Ptr FT_Open_Args -> FT_Long -> Ptr FT_Face -> IO FT_Error
- ft_Attach_File :: FT_Face -> CString -> IO FT_Error
- ft_Attach_Stream :: FT_Face -> Ptr FT_Open_Args -> IO FT_Error
- ft_Reference_Face :: FT_Face -> IO FT_Error
- ft_Select_Size :: FT_Face -> FT_Int -> IO FT_Error
- ft_Request_Size :: FT_Face -> FT_Size_Request -> IO FT_Error
- ft_Render_Glyph :: FT_GlyphSlot -> FT_Render_Mode -> IO FT_Error
- ft_Get_Kerning :: FT_Face -> FT_UInt -> FT_UInt -> FT_UInt -> Ptr FT_Vector -> IO FT_Error
- ft_Get_Track_Kerning :: FT_Face -> FT_Fixed -> FT_Int -> Ptr FT_Fixed -> IO FT_Error
- ft_Get_Glyph_Name :: FT_Face -> FT_UInt -> FT_Pointer -> FT_UInt -> IO FT_Error
- ft_Get_Postscript_Name :: FT_Face -> IO CString
- ft_Select_Charmap :: FT_Face -> FT_Encoding -> IO FT_Error
- ft_Set_Charmap :: FT_Face -> FT_CharMap -> IO FT_Error
- ft_Get_Charmap_Index :: FT_CharMap -> IO FT_Int
- ft_Get_First_Char :: FT_Face -> Ptr FT_UInt -> IO FT_ULong
- ft_Get_Next_Char :: FT_Face -> FT_ULong -> Ptr FT_UInt -> IO FT_ULong
- ft_Get_Name_Index :: FT_Face -> CString -> IO FT_UInt
- ft_Get_SubGlyph_Info :: FT_GlyphSlot -> FT_UInt -> Ptr FT_Int -> Ptr FT_UInt -> Ptr FT_Int -> Ptr FT_Int -> Ptr FT_Matrix -> IO FT_Error
- ft_Get_FSType_Flags :: FT_Face -> IO FT_UShort
- ft_Face_GetCharVariantIndex :: FT_Face -> FT_ULong -> FT_ULong -> IO FT_UInt
- ft_Face_GetCharVariantIsDefault :: FT_Face -> FT_ULong -> FT_ULong -> IO FT_Int
- ft_Face_GetVariantSelectors :: FT_Face -> IO (Ptr FT_UInt32)
- ft_Face_GetVariantsOfChar :: FT_Face -> FT_ULong -> IO (Ptr FT_UInt32)
- ft_Face_GetCharsOfVariant :: FT_Face -> FT_ULong -> IO (Ptr FT_UInt32)
- ft_Outline_New :: FT_Library -> FT_UInt -> FT_Int -> Ptr FT_Outline -> IO FT_Error
- ft_Outline_New_Internal :: FT_Memory -> FT_UInt -> FT_Int -> Ptr FT_Outline -> IO FT_Error
- ft_Outline_Done :: FT_Library -> Ptr FT_Outline -> IO FT_Error
- ft_Outline_Done_Internal :: FT_Memory -> Ptr FT_Outline -> IO FT_Error
- ft_Outline_Copy :: Ptr FT_Outline -> Ptr FT_Outline -> IO FT_Error
- ft_Outline_Translate :: Ptr FT_Outline -> FT_Pos -> FT_Pos -> IO ()
- ft_Outline_Transform :: Ptr FT_Outline -> Ptr FT_Matrix -> IO ()
- ft_Outline_Embolden :: Ptr FT_Outline -> FT_Pos -> IO FT_Error
- ft_Outline_Reverse :: Ptr FT_Outline -> IO ()
- ft_Outline_Check :: Ptr FT_Outline -> IO FT_Error
- ft_Outline_Get_BBox :: Ptr FT_Outline -> Ptr FT_BBox -> IO FT_Error
- ft_Outline_Decompose :: Ptr FT_Outline -> Ptr FT_Outline_Funcs -> Ptr a -> IO FT_Error
- ft_Outline_Get_CBox :: Ptr FT_Outline -> Ptr FT_BBox -> IO ()
- ft_Outline_Get_Bitmap :: FT_Library -> Ptr FT_Outline -> Ptr FT_Bitmap -> IO FT_Error
- ft_Outline_Render :: FT_Library -> Ptr FT_Outline -> Ptr FT_Raster_Params -> IO FT_Error
- ft_Outline_Get_Orientation :: Ptr FT_Outline -> IO FT_Orientation
- ft_New_Size :: FT_Face -> Ptr FT_Size -> IO FT_Error
- ft_Done_Size :: FT_Size -> IO FT_Error
- ft_Activate_Size :: FT_Size -> IO FT_Error
- ft_STYLE_FLAG_BOLD :: FT_Long
- ft_STYLE_FLAG_ITALIC :: FT_Long
- ft_IS_TRICKY :: FT_Face -> IO Bool
- ft_IS_CID_KEYED :: FT_Face -> IO Bool
- ft_HAS_MULTIPLE_MASTERS :: FT_Face -> IO Bool
- ft_HAS_GLYPH_NAMES :: FT_Face -> IO Bool
- ft_HAS_FAST_GLYPHS :: FT_Face -> IO Bool
- ft_HAS_FIXED_SIZES :: FT_Face -> IO Bool
- ft_IS_FIXED_WIDTH :: FT_Face -> IO Bool
- ft_IS_SFNT :: FT_Face -> IO Bool
- ft_IS_SCALABLE :: FT_Face -> IO Bool
- ft_HAS_KERNING :: FT_Face -> IO Bool
- ft_HAS_VERTICAL :: FT_Face -> IO Bool
- ft_HAS_HORIZONTAL :: FT_Face -> IO Bool
- charmap :: FT_Face -> Ptr FT_CharMap
- size :: FT_Face -> Ptr FT_Size
- glyph :: FT_Face -> Ptr FT_GlyphSlot
- underline_thickness :: FT_Face -> Ptr FT_Short
- underline_position :: FT_Face -> Ptr FT_Short
- max_advance_height :: FT_Face -> Ptr FT_Short
- max_advance_width :: FT_Face -> Ptr FT_Short
- height :: FT_Face -> Ptr FT_Short
- descender :: FT_Face -> Ptr FT_Short
- ascender :: FT_Face -> Ptr FT_Short
- units_per_EM :: FT_Face -> Ptr FT_UShort
- bbox :: FT_Face -> Ptr FT_BBox
- charmaps :: FT_Face -> Ptr (Ptr FT_CharMap)
- num_charmaps :: FT_Face -> Ptr FT_Int
- available_sizes :: FT_Face -> Ptr (Ptr FT_Bitmap_Size)
- num_fixed_sizes :: FT_Face -> Ptr FT_Int
- style_name :: FT_Face -> Ptr CString
- family_name :: FT_Face -> Ptr CString
- num_glyphs :: FT_Face -> Ptr FT_Long
- style_flags :: FT_Face -> Ptr FT_Long
- face_flags :: FT_Face -> Ptr FT_Long
- face_index :: FT_Face -> Ptr FT_Long
- num_faces :: FT_Face -> Ptr FT_Long
- rsb_delta :: FT_GlyphSlot -> Ptr FT_Pos
- lsb_delta :: FT_GlyphSlot -> Ptr FT_Pos
- control_len :: FT_GlyphSlot -> Ptr CLong
- control_data :: FT_GlyphSlot -> Ptr a
- subglyphs :: FT_GlyphSlot -> Ptr FT_SubGlyph
- num_subglyphs :: FT_GlyphSlot -> Ptr FT_UInt
- outline :: FT_GlyphSlot -> Ptr FT_Outline
- bitmap_top :: FT_GlyphSlot -> Ptr FT_Int
- bitmap_left :: FT_GlyphSlot -> Ptr FT_Int
- bitmap :: FT_GlyphSlot -> Ptr FT_Bitmap
- format :: FT_GlyphSlot -> Ptr FT_Glyph_Format
- advance :: FT_GlyphSlot -> Ptr FT_Vector
- linearVertAdvance :: FT_GlyphSlot -> Ptr FT_Fixed
- linearHoriAdvance :: FT_GlyphSlot -> Ptr FT_Fixed
- metrics :: FT_GlyphSlot -> Ptr FT_Glyph_Metrics
- generic :: FT_GlyphSlot -> Ptr FT_Generic
- next :: FT_GlyphSlot -> Ptr FT_GlyphSlot
- face :: FT_GlyphSlot -> Ptr FT_Face
- library :: FT_GlyphSlot -> Ptr FT_Library
- data FT_GlyphSlotRec_
- type FT_GlyphSlot = Ptr FT_GlyphSlotRec_
- data FT_Vector = FT_Vector {}
- ft_ORIENTATION_NONE :: FT_Orientation
- ft_ORIENTATION_FILL_LEFT :: FT_Orientation
- ft_ORIENTATION_FILL_RIGHT :: FT_Orientation
- ft_ORIENTATION_POSTSCRIPT :: FT_Orientation
- ft_ORIENTATION_TRUETYPE :: FT_Orientation
- ft_OUTLINE_SINGLE_PASS :: FT_OUTLINE_FLAGS
- ft_OUTLINE_HIGH_PRECISION :: FT_OUTLINE_FLAGS
- ft_OUTLINE_INCLUDE_STUBS :: FT_OUTLINE_FLAGS
- ft_OUTLINE_SMART_DROPOUTS :: FT_OUTLINE_FLAGS
- ft_OUTLINE_IGNORE_DROPOUTS :: FT_OUTLINE_FLAGS
- ft_OUTLINE_REVERSE_FILL :: FT_OUTLINE_FLAGS
- ft_OUTLINE_EVEN_ODD_FILL :: FT_OUTLINE_FLAGS
- ft_OUTLINE_OWNER :: FT_OUTLINE_FLAGS
- ft_OUTLINE_NONE :: FT_OUTLINE_FLAGS
- ft_GLYPH_FORMAT_PLOTTER :: FT_Glyph_Format
- ft_GLYPH_FORMAT_OUTLINE :: FT_Glyph_Format
- ft_GLYPH_FORMAT_BITMAP :: FT_Glyph_Format
- ft_GLYPH_FORMAT_COMPOSITE :: FT_Glyph_Format
- ft_GLYPH_FORMAT_NONE :: FT_Glyph_Format
- ft_FSTYPE_BITMAP_EMBEDDING_ONLY :: FT_UShort
- ft_FSTYPE_NO_SUBSETTING :: FT_UShort
- ft_FSTYPE_EDITABLE_EMBEDDING :: FT_UShort
- ft_FSTYPE_PREVIEW_AND_PRINT_EMBEDDING :: FT_UShort
- ft_FSTYPE_RESTRICTED_LICENSE_EMBEDDING :: FT_UShort
- ft_FSTYPE_INSTALLABLE_EMBEDDING :: FT_UShort
- ft_SUBGLYPH_FLAG_USE_MY_METRICS :: FT_SUBGLYPH_FLAG
- ft_SUBGLYPH_FLAG_2X2 :: FT_SUBGLYPH_FLAG
- ft_SUBGLYPH_FLAG_XY_SCALE :: FT_SUBGLYPH_FLAG
- ft_SUBGLYPH_FLAG_SCALE :: FT_SUBGLYPH_FLAG
- ft_SUBGLYPH_FLAG_ROUND_XY_TO_GRID :: FT_SUBGLYPH_FLAG
- ft_SUBGLYPH_FLAG_ARGS_ARE_XY_VALUES :: FT_SUBGLYPH_FLAG
- ft_SUBGLYPH_FLAG_ARGS_ARE_WORDS :: FT_SUBGLYPH_FLAG
- ft_KERNING_UNSCALED :: FT_Kerning_Mode
- ft_KERNING_UNFITTED :: FT_Kerning_Mode
- ft_KERNING_DEFAULT :: FT_Kerning_Mode
- ft_LOAD_TARGET_LCD_V :: FT_UInt32
- ft_LOAD_TARGET_LCD :: FT_UInt32
- ft_LOAD_TARGET_MONO :: FT_UInt32
- ft_LOAD_TARGET_LIGHT :: FT_UInt32
- ft_LOAD_TARGET_NORMAL :: FT_UInt32
- ft_SIZE_REQUEST_TYPE_SCALES :: FT_Size_Request_Type
- ft_SIZE_REQUEST_TYPE_CELL :: FT_Size_Request_Type
- ft_SIZE_REQUEST_TYPE_BBOX :: FT_Size_Request_Type
- ft_SIZE_REQUEST_TYPE_REAL_DIM :: FT_Size_Request_Type
- ft_SIZE_REQUEST_TYPE_NOMINAL :: FT_Size_Request_Type
- ft_OPEN_PARAMS :: FT_OPEN
- ft_OPEN_DRIVER :: FT_OPEN
- ft_OPEN_PATHNAME :: FT_OPEN
- ft_OPEN_STREAM :: FT_OPEN
- ft_OPEN_MEMORY :: FT_OPEN
- ft_FACE_FLAG_TRICKY :: FT_FACE_FLAG
- ft_FACE_FLAG_CID_KEYED :: FT_FACE_FLAG
- ft_FACE_FLAG_HINTER :: FT_FACE_FLAG
- ft_FACE_FLAG_EXTERNAL_STREAM :: FT_FACE_FLAG
- ft_FACE_FLAG_GLYPH_NAMES :: FT_FACE_FLAG
- ft_FACE_FLAG_MULTIPLE_MASTERS :: FT_FACE_FLAG
- ft_FACE_FLAG_FAST_GLYPHS :: FT_FACE_FLAG
- ft_FACE_FLAG_KERNING :: FT_FACE_FLAG
- ft_FACE_FLAG_VERTICAL :: FT_FACE_FLAG
- ft_FACE_FLAG_HORIZONTAL :: FT_FACE_FLAG
- ft_FACE_FLAG_SFNT :: FT_FACE_FLAG
- ft_FACE_FLAG_FIXED_WIDTH :: FT_FACE_FLAG
- ft_FACE_FLAG_FIXED_SIZES :: FT_FACE_FLAG
- ft_FACE_FLAG_SCALABLE :: FT_FACE_FLAG
- ft_ENCODING_APPLE_ROMAN :: FT_Encoding
- ft_ENCODING_OLD_LATIN_2 :: FT_Encoding
- ft_ENCODING_ADOBE_LATIN_1 :: FT_Encoding
- ft_ENCODING_ADOBE_CUSTOM :: FT_Encoding
- ft_ENCODING_ADOBE_EXPERT :: FT_Encoding
- ft_ENCODING_ADOBE_STANDARD :: FT_Encoding
- ft_ENCODING_MS_JOHAB :: FT_Encoding
- ft_ENCODING_MS_WANSUNG :: FT_Encoding
- ft_ENCODING_MS_BIG5 :: FT_Encoding
- ft_ENCODING_MS_GB2312 :: FT_Encoding
- ft_ENCODING_MS_SJIS :: FT_Encoding
- ft_ENCODING_JOHAB :: FT_Encoding
- ft_ENCODING_WANSUNG :: FT_Encoding
- ft_ENCODING_BIG5 :: FT_Encoding
- ft_ENCODING_GB2312 :: FT_Encoding
- ft_ENCODING_SJIS :: FT_Encoding
- ft_ENCODING_UNICODE :: FT_Encoding
- ft_ENCODING_MS_SYMBOL :: FT_Encoding
- ft_ENCODING_NONE :: FT_Encoding
- fREETYPE_PATCH :: FT_Int
- fREETYPE_MINOR :: FT_Int
- fREETYPE_MAJOR :: FT_Int
- ft_RENDER_MODE_LCD_V :: FT_Render_Mode
- ft_RENDER_MODE_LCD :: FT_Render_Mode
- ft_RENDER_MODE_MONO :: FT_Render_Mode
- ft_RENDER_MODE_LIGHT :: FT_Render_Mode
- ft_RENDER_MODE_NORMAL :: FT_Render_Mode
- ft_LOAD_NO_AUTOHINT :: FT_Int32
- ft_LOAD_LINEAR_DESIGN :: FT_Int32
- ft_LOAD_MONOCHROME :: FT_Int32
- ft_LOAD_IGNORE_TRANSFORM :: FT_Int32
- ft_LOAD_NO_RECURSE :: FT_Int32
- ft_LOAD_IGNORE_GLOBAL_ADVANCE_WIDTH :: FT_Int32
- ft_LOAD_PEDANTIC :: FT_Int32
- ft_LOAD_CROP_BITMAP :: FT_Int32
- ft_LOAD_FORCE_AUTOHINT :: FT_Int32
- ft_LOAD_VERTICAL_LAYOUT :: FT_Int32
- ft_LOAD_NO_BITMAP :: FT_Int32
- ft_LOAD_RENDER :: FT_Int32
- ft_LOAD_NO_HINTING :: FT_Int32
- ft_LOAD_NO_SCALE :: FT_Int32
- ft_LOAD_DEFAULT :: FT_Int32
- type FT_Byte = CUChar
- type FT_Bytes = Ptr FT_Byte
- type FT_Char = CChar
- type FT_Int = CInt
- type FT_UInt = CUInt
- type FT_Int16 = CShort
- type FT_UInt16 = CUShort
- type FT_Int32 = Int32
- type FT_UInt32 = Word32
- type FT_Short = CShort
- type FT_UShort = CUShort
- type FT_Long = CLong
- type FT_ULong = CULong
- type FT_Bool = CUChar
- type FT_Offset = Word64
- type FT_Error = CInt
- type FT_F26Dot6 = CLong
- type FT_Fixed = CLong
- type FT_Pos = CLong
- type FT_Pointer = Ptr ()
- newtype FT_Render_Mode = FT_Render_Mode CUInt
- newtype FT_Encoding = FT_Encoding FT_UInt32
- newtype FT_FACE_FLAG = FT_FACE_FLAG FT_Int
- newtype FT_OPEN = FT_OPEN FT_UInt
- newtype FT_Size_Request_Type = FT_Size_Request_Type FT_UInt
- newtype FT_Kerning_Mode = FT_Kerning_Mode FT_UInt32
- newtype FT_SUBGLYPH_FLAG = FT_SUBGLYPH_FLAG FT_UInt
- newtype FT_Glyph_Format = FT_Glyph_Format FT_UInt32
- newtype FT_OUTLINE_FLAGS = FT_OUTLINE_FLAGS FT_UInt32
- newtype FT_Orientation = FT_Orientation FT_UInt
- data FT_LibraryRec_
- type FT_Library = Ptr FT_LibraryRec_
- data FT_FaceRec_
- type FT_Face = Ptr FT_FaceRec_
- data FT_Bitmap = FT_Bitmap {}
- type FreeTypeT m = ExceptT String (StateT FT_Library m)
- type FreeTypeIO = FreeTypeT IO
- getAdvance :: MonadIO m => FT_GlyphSlot -> FreeTypeT m (Int, Int)
- getCharIndex :: (MonadIO m, Integral i) => FT_Face -> i -> FreeTypeT m FT_UInt
- getLibrary :: MonadIO m => FreeTypeT m FT_Library
- getKerning :: MonadIO m => FT_Face -> FT_UInt -> FT_UInt -> FT_Kerning_Mode -> FreeTypeT m (Int, Int)
- glyphFormatString :: FT_Glyph_Format -> String
- hasKerning :: MonadIO m => FT_Face -> FreeTypeT m Bool
- loadChar :: MonadIO m => FT_Face -> FT_ULong -> FT_Int32 -> FreeTypeT m ()
- loadGlyph :: MonadIO m => FT_Face -> FT_UInt -> FT_Int32 -> FreeTypeT m ()
- newFace :: MonadIO m => FilePath -> FreeTypeT m FT_Face
- setCharSize :: (MonadIO m, Integral i) => FT_Face -> i -> i -> i -> i -> FreeTypeT m ()
- setPixelSizes :: (MonadIO m, Integral i) => FT_Face -> i -> i -> FreeTypeT m ()
- withFreeType :: MonadIO m => Maybe FT_Library -> FreeTypeT m a -> m (Either String a)
- runFreeType :: MonadIO m => FreeTypeT m a -> m (Either String (a, FT_Library))
Documentation
newStablePtr :: a -> IO (StablePtr a) #
Create a stable pointer referring to the given Haskell value.
A fixed-precision integer type with at least the range [-2^29 .. 2^29-1]
.
The exact range for a given implementation can be determined by using
minBound
and maxBound
from the Bounded
class.
Instances
8-bit signed integer type
Instances
16-bit signed integer type
Instances
32-bit signed integer type
Instances
64-bit signed integer type
Instances
A stable pointer is a reference to a Haskell expression that is guaranteed not to be affected by garbage collection, i.e., it will neither be deallocated nor will the value of the stable pointer itself change during garbage collection (ordinary references may be relocated during garbage collection). Consequently, stable pointers can be passed to foreign code, which can treat it as an opaque reference to a Haskell value.
A value of type StablePtr a
is a stable pointer to a Haskell
expression of type a
.
Instances
Eq (StablePtr a) | Since: base-2.1 |
Storable (StablePtr a) | Since: base-2.1 |
Defined in Foreign.Storable sizeOf :: StablePtr a -> Int # alignment :: StablePtr a -> Int # peekElemOff :: Ptr (StablePtr a) -> Int -> IO (StablePtr a) # pokeElemOff :: Ptr (StablePtr a) -> Int -> StablePtr a -> IO () # peekByteOff :: Ptr b -> Int -> IO (StablePtr a) # pokeByteOff :: Ptr b -> Int -> StablePtr a -> IO () # | |
PrimUnlifted (StablePtr a) | Since: primitive-0.6.4.0 |
Defined in Data.Primitive.UnliftedArray toArrayArray# :: StablePtr a -> ArrayArray# # fromArrayArray# :: ArrayArray# -> StablePtr a # |
Instances
8-bit unsigned integer type
Instances
16-bit unsigned integer type
Instances
32-bit unsigned integer type
Instances
64-bit unsigned integer type
Instances
A value of type
represents a pointer to an object, or an
array of objects, which may be marshalled to or from Haskell values
of type Ptr
aa
.
The type a
will often be an instance of class
Storable
which provides the marshalling operations.
However this is not essential, and you can provide your own operations
to access the pointer. For example you might write small foreign
functions to get or set the fields of a C struct
.
Instances
Generic1 (URec (Ptr ()) :: k -> Type) | |
Eq (Ptr a) | Since: base-2.1 |
Ord (Ptr a) | Since: base-2.1 |
Show (Ptr a) | Since: base-2.1 |
Storable (Ptr a) | Since: base-2.1 |
Prim (Ptr a) | |
Defined in Data.Primitive.Types alignment# :: Ptr a -> Int# # indexByteArray# :: ByteArray# -> Int# -> Ptr a # readByteArray# :: MutableByteArray# s -> Int# -> State# s -> (#State# s, Ptr a#) # writeByteArray# :: MutableByteArray# s -> Int# -> Ptr a -> State# s -> State# s # setByteArray# :: MutableByteArray# s -> Int# -> Int# -> Ptr a -> State# s -> State# s # indexOffAddr# :: Addr# -> Int# -> Ptr a # readOffAddr# :: Addr# -> Int# -> State# s -> (#State# s, Ptr a#) # writeOffAddr# :: Addr# -> Int# -> Ptr a -> State# s -> State# s # setOffAddr# :: Addr# -> Int# -> Int# -> Ptr a -> State# s -> State# s # | |
Functor (URec (Ptr ()) :: Type -> Type) | Since: base-4.9.0.0 |
Foldable (URec (Ptr ()) :: Type -> Type) | Since: base-4.9.0.0 |
Defined in Data.Foldable fold :: Monoid m => URec (Ptr ()) m -> m # foldMap :: Monoid m => (a -> m) -> URec (Ptr ()) a -> m # foldr :: (a -> b -> b) -> b -> URec (Ptr ()) a -> b # foldr' :: (a -> b -> b) -> b -> URec (Ptr ()) a -> b # foldl :: (b -> a -> b) -> b -> URec (Ptr ()) a -> b # foldl' :: (b -> a -> b) -> b -> URec (Ptr ()) a -> b # foldr1 :: (a -> a -> a) -> URec (Ptr ()) a -> a # foldl1 :: (a -> a -> a) -> URec (Ptr ()) a -> a # toList :: URec (Ptr ()) a -> [a] # null :: URec (Ptr ()) a -> Bool # length :: URec (Ptr ()) a -> Int # elem :: Eq a => a -> URec (Ptr ()) a -> Bool # maximum :: Ord a => URec (Ptr ()) a -> a # minimum :: Ord a => URec (Ptr ()) a -> a # | |
Traversable (URec (Ptr ()) :: Type -> Type) | Since: base-4.9.0.0 |
Defined in Data.Traversable | |
Eq (URec (Ptr ()) p) | Since: base-4.9.0.0 |
Ord (URec (Ptr ()) p) | Since: base-4.9.0.0 |
Defined in GHC.Generics compare :: URec (Ptr ()) p -> URec (Ptr ()) p -> Ordering # (<) :: URec (Ptr ()) p -> URec (Ptr ()) p -> Bool # (<=) :: URec (Ptr ()) p -> URec (Ptr ()) p -> Bool # (>) :: URec (Ptr ()) p -> URec (Ptr ()) p -> Bool # (>=) :: URec (Ptr ()) p -> URec (Ptr ()) p -> Bool # max :: URec (Ptr ()) p -> URec (Ptr ()) p -> URec (Ptr ()) p # min :: URec (Ptr ()) p -> URec (Ptr ()) p -> URec (Ptr ()) p # | |
Generic (URec (Ptr ()) p) | |
data URec (Ptr ()) (p :: k) | Used for marking occurrences of Since: base-4.9.0.0 |
type Rep1 (URec (Ptr ()) :: k -> Type) | Since: base-4.9.0.0 |
Defined in GHC.Generics | |
type Rep (URec (Ptr ()) p) | Since: base-4.9.0.0 |
Defined in GHC.Generics |
A value of type
is a pointer to a function callable
from foreign code. The type FunPtr
aa
will normally be a foreign type,
a function type with zero or more arguments where
- the argument types are marshallable foreign types,
i.e.
Char
,Int
,Double
,Float
,Bool
,Int8
,Int16
,Int32
,Int64
,Word8
,Word16
,Word32
,Word64
,
,Ptr
a
,FunPtr
a
or a renaming of any of these usingStablePtr
anewtype
. - the return type is either a marshallable foreign type or has the form
whereIO
tt
is a marshallable foreign type or()
.
A value of type
may be a pointer to a foreign function,
either returned by another foreign function or imported with a
a static address import likeFunPtr
a
foreign import ccall "stdlib.h &free" p_free :: FunPtr (Ptr a -> IO ())
or a pointer to a Haskell function created using a wrapper stub
declared to produce a FunPtr
of the correct type. For example:
type Compare = Int -> Int -> Bool foreign import ccall "wrapper" mkCompare :: Compare -> IO (FunPtr Compare)
Calls to wrapper stubs like mkCompare
allocate storage, which
should be released with freeHaskellFunPtr
when no
longer required.
To convert FunPtr
values to corresponding Haskell functions, one
can define a dynamic stub for the specific foreign type, e.g.
type IntFunction = CInt -> IO () foreign import ccall "dynamic" mkFun :: FunPtr IntFunction -> IntFunction
Instances
Eq (FunPtr a) | |
Ord (FunPtr a) | |
Show (FunPtr a) | Since: base-2.1 |
Storable (FunPtr a) | Since: base-2.1 |
Defined in Foreign.Storable | |
Prim (FunPtr a) | |
Defined in Data.Primitive.Types alignment# :: FunPtr a -> Int# # indexByteArray# :: ByteArray# -> Int# -> FunPtr a # readByteArray# :: MutableByteArray# s -> Int# -> State# s -> (#State# s, FunPtr a#) # writeByteArray# :: MutableByteArray# s -> Int# -> FunPtr a -> State# s -> State# s # setByteArray# :: MutableByteArray# s -> Int# -> Int# -> FunPtr a -> State# s -> State# s # indexOffAddr# :: Addr# -> Int# -> FunPtr a # readOffAddr# :: Addr# -> Int# -> State# s -> (#State# s, FunPtr a#) # writeOffAddr# :: Addr# -> Int# -> FunPtr a -> State# s -> State# s # setOffAddr# :: Addr# -> Int# -> Int# -> FunPtr a -> State# s -> State# s # |
data ForeignPtr a #
The type ForeignPtr
represents references to objects that are
maintained in a foreign language, i.e., that are not part of the
data structures usually managed by the Haskell storage manager.
The essential difference between ForeignPtr
s and vanilla memory
references of type Ptr a
is that the former may be associated
with finalizers. A finalizer is a routine that is invoked when
the Haskell storage manager detects that - within the Haskell heap
and stack - there are no more references left that are pointing to
the ForeignPtr
. Typically, the finalizer will, then, invoke
routines in the foreign language that free the resources bound by
the foreign object.
The ForeignPtr
is parameterised in the same way as Ptr
. The
type argument of ForeignPtr
should normally be an instance of
class Storable
.
Instances
Eq (ForeignPtr a) | Since: base-2.1 |
Defined in GHC.ForeignPtr (==) :: ForeignPtr a -> ForeignPtr a -> Bool # (/=) :: ForeignPtr a -> ForeignPtr a -> Bool # | |
Ord (ForeignPtr a) | Since: base-2.1 |
Defined in GHC.ForeignPtr compare :: ForeignPtr a -> ForeignPtr a -> Ordering # (<) :: ForeignPtr a -> ForeignPtr a -> Bool # (<=) :: ForeignPtr a -> ForeignPtr a -> Bool # (>) :: ForeignPtr a -> ForeignPtr a -> Bool # (>=) :: ForeignPtr a -> ForeignPtr a -> Bool # max :: ForeignPtr a -> ForeignPtr a -> ForeignPtr a # min :: ForeignPtr a -> ForeignPtr a -> ForeignPtr a # | |
Show (ForeignPtr a) | Since: base-2.1 |
Defined in GHC.ForeignPtr showsPrec :: Int -> ForeignPtr a -> ShowS # show :: ForeignPtr a -> String # showList :: [ForeignPtr a] -> ShowS # |
pooledNewArray0 :: Storable a => Pool -> a -> [a] -> IO (Ptr a) #
Allocate consecutive storage for a list of values in the given pool and marshal these values into it, terminating the end with the given marker.
pooledNewArray :: Storable a => Pool -> [a] -> IO (Ptr a) #
Allocate consecutive storage for a list of values in the given pool and marshal these values into it.
pooledNew :: Storable a => Pool -> a -> IO (Ptr a) #
Allocate storage for a value in the given pool and marshal the value into this storage.
pooledReallocArray0 :: Storable a => Pool -> Ptr a -> Int -> IO (Ptr a) #
Adjust the size of an array with an end marker in the given pool.
pooledReallocArray :: Storable a => Pool -> Ptr a -> Int -> IO (Ptr a) #
Adjust the size of an array in the given pool.
pooledMallocArray0 :: Storable a => Pool -> Int -> IO (Ptr a) #
Allocate storage for the given number of elements of a storable type in the pool, but leave room for an extra element to signal the end of the array.
pooledMallocArray :: Storable a => Pool -> Int -> IO (Ptr a) #
Allocate storage for the given number of elements of a storable type in the pool.
pooledReallocBytes :: Pool -> Ptr a -> Int -> IO (Ptr a) #
Adjust the storage area for an element in the pool to the given size.
pooledRealloc :: Storable a => Pool -> Ptr a -> IO (Ptr a) #
Adjust the storage area for an element in the pool to the given size of the required type.
pooledMallocBytes :: Pool -> Int -> IO (Ptr a) #
Allocate the given number of bytes of storage in the pool.
withPool :: (Pool -> IO b) -> IO b #
Execute an action with a fresh memory pool, which gets automatically deallocated (including its contents) after the action has finished.
Deallocate a memory pool and everything which has been allocated in the pool itself.
withCWStringLen :: String -> (CWStringLen -> IO a) -> IO a #
Marshal a Haskell string into a C wide string (i.e. wide character array) in temporary storage, with explicit length information.
- the memory is freed when the subcomputation terminates (either normally or via an exception), so the pointer to the temporary storage must not be used after this.
withCWString :: String -> (CWString -> IO a) -> IO a #
Marshal a Haskell string into a NUL terminated C wide string using temporary storage.
- the Haskell string may not contain any NUL characters
- the memory is freed when the subcomputation terminates (either normally or via an exception), so the pointer to the temporary storage must not be used after this.
newCWStringLen :: String -> IO CWStringLen #
Marshal a Haskell string into a C wide string (ie, wide character array) with explicit length information.
- new storage is allocated for the C wide string and must
be explicitly freed using
free
orfinalizerFree
.
newCWString :: String -> IO CWString #
Marshal a Haskell string into a NUL terminated C wide string.
- the Haskell string may not contain any NUL characters
- new storage is allocated for the C wide string and must
be explicitly freed using
free
orfinalizerFree
.
peekCWStringLen :: CWStringLen -> IO String #
Marshal a C wide string with explicit length into a Haskell string.
peekCWString :: CWString -> IO String #
Marshal a NUL terminated C wide string into a Haskell string.
withCAStringLen :: String -> (CStringLen -> IO a) -> IO a #
Marshal a Haskell string into a C string (ie, character array) in temporary storage, with explicit length information.
- the memory is freed when the subcomputation terminates (either normally or via an exception), so the pointer to the temporary storage must not be used after this.
withCAString :: String -> (CString -> IO a) -> IO a #
Marshal a Haskell string into a NUL terminated C string using temporary storage.
- the Haskell string may not contain any NUL characters
- the memory is freed when the subcomputation terminates (either normally or via an exception), so the pointer to the temporary storage must not be used after this.
newCAStringLen :: String -> IO CStringLen #
Marshal a Haskell string into a C string (ie, character array) with explicit length information.
- new storage is allocated for the C string and must be
explicitly freed using
free
orfinalizerFree
.
newCAString :: String -> IO CString #
Marshal a Haskell string into a NUL terminated C string.
- the Haskell string may not contain any NUL characters
- new storage is allocated for the C string and must be
explicitly freed using
free
orfinalizerFree
.
peekCAStringLen :: CStringLen -> IO String #
Marshal a C string with explicit length into a Haskell string.
peekCAString :: CString -> IO String #
Marshal a NUL terminated C string into a Haskell string.
castCharToCSChar :: Char -> CSChar #
Convert a Haskell character to a C signed char
.
This function is only safe on the first 256 characters.
castCSCharToChar :: CSChar -> Char #
Convert a C signed char
, representing a Latin-1 character, to the
corresponding Haskell character.
castCharToCUChar :: Char -> CUChar #
Convert a Haskell character to a C unsigned char
.
This function is only safe on the first 256 characters.
castCUCharToChar :: CUChar -> Char #
Convert a C unsigned char
, representing a Latin-1 character, to
the corresponding Haskell character.
castCharToCChar :: Char -> CChar #
Convert a Haskell character to a C character. This function is only safe on the first 256 characters.
castCCharToChar :: CChar -> Char #
Convert a C byte, representing a Latin-1 character, to the corresponding Haskell character.
charIsRepresentable :: Char -> IO Bool #
withCStringLen :: String -> (CStringLen -> IO a) -> IO a #
Marshal a Haskell string into a C string (ie, character array) in temporary storage, with explicit length information.
- the memory is freed when the subcomputation terminates (either normally or via an exception), so the pointer to the temporary storage must not be used after this.
withCString :: String -> (CString -> IO a) -> IO a #
Marshal a Haskell string into a NUL terminated C string using temporary storage.
- the Haskell string may not contain any NUL characters
- the memory is freed when the subcomputation terminates (either normally or via an exception), so the pointer to the temporary storage must not be used after this.
newCStringLen :: String -> IO CStringLen #
Marshal a Haskell string into a C string (ie, character array) with explicit length information.
- new storage is allocated for the C string and must be
explicitly freed using
free
orfinalizerFree
.
newCString :: String -> IO CString #
Marshal a Haskell string into a NUL terminated C string.
- the Haskell string may not contain any NUL characters
- new storage is allocated for the C string and must be
explicitly freed using
free
orfinalizerFree
.
peekCStringLen :: CStringLen -> IO String #
Marshal a C string with explicit length into a Haskell string.
peekCString :: CString -> IO String #
Marshal a NUL terminated C string into a Haskell string.
type CStringLen = (Ptr CChar, Int) #
A string with explicit length information in bytes instead of a terminating NUL (allowing NUL characters in the middle of the string).
A C wide string is a reference to an array of C wide characters terminated by NUL.
type CWStringLen = (Ptr CWchar, Int) #
A wide character string with explicit length information in CWchar
s
instead of a terminating NUL (allowing NUL characters in the middle
of the string).
advancePtr :: Storable a => Ptr a -> Int -> Ptr a #
Advance a pointer into an array by the given number of elements
lengthArray0 :: (Storable a, Eq a) => a -> Ptr a -> IO Int #
Return the number of elements in an array, excluding the terminator
moveArray :: Storable a => Ptr a -> Ptr a -> Int -> IO () #
Copy the given number of elements from the second array (source) into the first array (destination); the copied areas may overlap
copyArray :: Storable a => Ptr a -> Ptr a -> Int -> IO () #
Copy the given number of elements from the second array (source) into the first array (destination); the copied areas may not overlap
withArrayLen0 :: Storable a => a -> [a] -> (Int -> Ptr a -> IO b) -> IO b #
Like withArrayLen
, but a terminator indicates where the array ends
withArray0 :: Storable a => a -> [a] -> (Ptr a -> IO b) -> IO b #
Like withArray
, but a terminator indicates where the array ends
withArrayLen :: Storable a => [a] -> (Int -> Ptr a -> IO b) -> IO b #
Like withArray
, but the action gets the number of values
as an additional parameter
withArray :: Storable a => [a] -> (Ptr a -> IO b) -> IO b #
Temporarily store a list of storable values in memory
(like with
, but for multiple elements).
newArray0 :: Storable a => a -> [a] -> IO (Ptr a) #
Write a list of storable elements into a newly allocated, consecutive sequence of storable values, where the end is fixed by the given end marker
newArray :: Storable a => [a] -> IO (Ptr a) #
Write a list of storable elements into a newly allocated, consecutive
sequence of storable values
(like new
, but for multiple elements).
pokeArray0 :: Storable a => a -> Ptr a -> [a] -> IO () #
Write the list elements consecutive into memory and terminate them with the given marker element
peekArray0 :: (Storable a, Eq a) => a -> Ptr a -> IO [a] #
Convert an array terminated by the given end marker into a Haskell list
peekArray :: Storable a => Int -> Ptr a -> IO [a] #
Convert an array of given length into a Haskell list. The implementation is tail-recursive and so uses constant stack space.
reallocArray0 :: Storable a => Ptr a -> Int -> IO (Ptr a) #
Adjust the size of an array including an extra position for the end marker.
allocaArray0 :: Storable a => Int -> (Ptr a -> IO b) -> IO b #
Like allocaArray
, but add an extra position to hold a special
termination element.
allocaArray :: Storable a => Int -> (Ptr a -> IO b) -> IO b #
Temporarily allocate space for the given number of elements
(like alloca
, but for multiple elements).
callocArray0 :: Storable a => Int -> IO (Ptr a) #
Like callocArray0
, but allocated memory is filled with bytes of value
zero.
callocArray :: Storable a => Int -> IO (Ptr a) #
Like mallocArray
, but allocated memory is filled with bytes of value zero.
mallocArray0 :: Storable a => Int -> IO (Ptr a) #
Like mallocArray
, but add an extra position to hold a special
termination element.
mallocArray :: Storable a => Int -> IO (Ptr a) #
Allocate storage for the given number of elements of a storable type
(like malloc
, but for multiple elements).
fillBytes :: Ptr a -> Word8 -> Int -> IO () #
Fill a given number of bytes in memory area with a byte value.
Since: base-4.8.0.0
moveBytes :: Ptr a -> Ptr a -> Int -> IO () #
Copies the given number of bytes from the second area (source) into the first (destination); the copied areas may overlap
copyBytes :: Ptr a -> Ptr a -> Int -> IO () #
Copies the given number of bytes from the second area (source) into the first (destination); the copied areas may not overlap
withMany :: (a -> (b -> res) -> res) -> [a] -> ([b] -> res) -> res #
Replicates a withXXX
combinator over a list of objects, yielding a list of
marshalled objects
toBool :: (Eq a, Num a) => a -> Bool #
Convert a Boolean in numeric representation to a Haskell value
with :: Storable a => a -> (Ptr a -> IO b) -> IO b #
executes the computation with
val ff
, passing as argument
a pointer to a temporarily allocated block of memory into which
val
has been marshalled (the combination of alloca
and poke
).
The memory is freed when f
terminates (either normally or via an
exception), so the pointer passed to f
must not be used after this.
Free a block of memory that was allocated with malloc
,
mallocBytes
, realloc
, reallocBytes
, new
or any of the new
X functions in Foreign.Marshal.Array or
Foreign.C.String.
reallocBytes :: Ptr a -> Int -> IO (Ptr a) #
Resize a memory area that was allocated with malloc
or mallocBytes
to the given size. The returned pointer may refer to an entirely
different memory area, but will be sufficiently aligned for any of the
basic foreign types that fits into a memory block of the given size.
The contents of the referenced memory area will be the same as of
the original pointer up to the minimum of the original size and the
given size.
If the pointer argument to reallocBytes
is nullPtr
, reallocBytes
behaves like malloc
. If the requested size is 0, reallocBytes
behaves like free
.
realloc :: Storable b => Ptr a -> IO (Ptr b) #
Resize a memory area that was allocated with malloc
or mallocBytes
to the size needed to store values of type b
. The returned pointer
may refer to an entirely different memory area, but will be suitably
aligned to hold values of type b
. The contents of the referenced
memory area will be the same as of the original pointer up to the
minimum of the original size and the size of values of type b
.
If the argument to realloc
is nullPtr
, realloc
behaves like
malloc
.
allocaBytes :: Int -> (Ptr a -> IO b) -> IO b #
executes the computation allocaBytes
n ff
, passing as argument
a pointer to a temporarily allocated block of memory of n
bytes.
The block of memory is sufficiently aligned for any of the basic
foreign types that fits into a memory block of the allocated size.
The memory is freed when f
terminates (either normally or via an
exception), so the pointer passed to f
must not be used after this.
alloca :: Storable a => (Ptr a -> IO b) -> IO b #
executes the computation alloca
ff
, passing as argument
a pointer to a temporarily allocated block of memory sufficient to
hold values of type a
.
The memory is freed when f
terminates (either normally or via an
exception), so the pointer passed to f
must not be used after this.
callocBytes :: Int -> IO (Ptr a) #
Llike mallocBytes
but memory is filled with bytes of value zero.
mallocBytes :: Int -> IO (Ptr a) #
Allocate a block of memory of the given number of bytes. The block of memory is sufficiently aligned for any of the basic foreign types that fits into a memory block of the allocated size.
The memory may be deallocated using free
or finalizerFree
when
no longer required.
malloc :: Storable a => IO (Ptr a) #
Allocate a block of memory that is sufficient to hold values of type
a
. The size of the area allocated is determined by the sizeOf
method from the instance of Storable
for the appropriate type.
The memory may be deallocated using free
or finalizerFree
when
no longer required.
finalizerFree :: FinalizerPtr a #
A pointer to a foreign function equivalent to free
, which may be
used as a finalizer (cf ForeignPtr
) for storage
allocated with malloc
, mallocBytes
, realloc
or reallocBytes
.
throwIfNeg_ :: (Ord a, Num a) => (a -> String) -> IO a -> IO () #
Like throwIfNeg
, but discarding the result
throwIfNeg :: (Ord a, Num a) => (a -> String) -> IO a -> IO a #
Guards against negative result values
mallocForeignPtrArray0 :: Storable a => Int -> IO (ForeignPtr a) #
This function is similar to mallocArray0
,
but yields a memory area that has a finalizer attached that releases
the memory area. As with mallocForeignPtr
, it is not guaranteed that
the block of memory was allocated by malloc
.
mallocForeignPtrArray :: Storable a => Int -> IO (ForeignPtr a) #
This function is similar to mallocArray
,
but yields a memory area that has a finalizer attached that releases
the memory area. As with mallocForeignPtr
, it is not guaranteed that
the block of memory was allocated by malloc
.
newForeignPtrEnv :: FinalizerEnvPtr env a -> Ptr env -> Ptr a -> IO (ForeignPtr a) #
This variant of newForeignPtr
adds a finalizer that expects an
environment in addition to the finalized pointer. The environment
that will be passed to the finalizer is fixed by the second argument to
newForeignPtrEnv
.
withForeignPtr :: ForeignPtr a -> (Ptr a -> IO b) -> IO b #
This is a way to look at the pointer living inside a
foreign object. This function takes a function which is
applied to that pointer. The resulting IO
action is then
executed. The foreign object is kept alive at least during
the whole action, even if it is not used directly
inside. Note that it is not safe to return the pointer from
the action and use it after the action completes. All uses
of the pointer should be inside the
withForeignPtr
bracket. The reason for
this unsafeness is the same as for
unsafeForeignPtrToPtr
below: the finalizer
may run earlier than expected, because the compiler can only
track usage of the ForeignPtr
object, not
a Ptr
object made from it.
This function is normally used for marshalling data to
or from the object pointed to by the
ForeignPtr
, using the operations from the
Storable
class.
newForeignPtr :: FinalizerPtr a -> Ptr a -> IO (ForeignPtr a) #
Turns a plain memory reference into a foreign pointer, and associates a finalizer with the reference. The finalizer will be executed after the last reference to the foreign object is dropped. There is no guarantee of promptness, however the finalizer will be executed before the program exits.
finalizeForeignPtr :: ForeignPtr a -> IO () #
Causes the finalizers associated with a foreign pointer to be run immediately.
plusForeignPtr :: ForeignPtr a -> Int -> ForeignPtr b #
Advances the given address by the given offset in bytes.
The new ForeignPtr
shares the finalizer of the original,
equivalent from a finalization standpoint to just creating another
reference to the original. That is, the finalizer will not be
called before the new ForeignPtr
is unreachable, nor will it be
called an additional time due to this call, and the finalizer will
be called with the same address that it would have had this call
not happened, *not* the new address.
Since: base-4.10.0.0
castForeignPtr :: ForeignPtr a -> ForeignPtr b #
This function casts a ForeignPtr
parameterised by one type into another type.
touchForeignPtr :: ForeignPtr a -> IO () #
This function ensures that the foreign object in
question is alive at the given place in the sequence of IO
actions. In particular withForeignPtr
does a touchForeignPtr
after it
executes the user action.
Note that this function should not be used to express dependencies
between finalizers on ForeignPtr
s. For example, if the finalizer
for a ForeignPtr
F1
calls touchForeignPtr
on a second
ForeignPtr
F2
, then the only guarantee is that the finalizer
for F2
is never started before the finalizer for F1
. They
might be started together if for example both F1
and F2
are
otherwise unreachable, and in that case the scheduler might end up
running the finalizer for F2
first.
In general, it is not recommended to use finalizers on separate
objects with ordering constraints between them. To express the
ordering robustly requires explicit synchronisation using MVar
s
between the finalizers, but even then the runtime sometimes runs
multiple finalizers sequentially in a single thread (for
performance reasons), so synchronisation between finalizers could
result in artificial deadlock. Another alternative is to use
explicit reference counting.
newForeignPtr_ :: Ptr a -> IO (ForeignPtr a) #
Turns a plain memory reference into a foreign pointer that may be
associated with finalizers by using addForeignPtrFinalizer
.
addForeignPtrFinalizerEnv :: FinalizerEnvPtr env a -> Ptr env -> ForeignPtr a -> IO () #
Like addForeignPtrFinalizerEnv
but allows the finalizer to be
passed an additional environment parameter to be passed to the
finalizer. The environment passed to the finalizer is fixed by the
second argument to addForeignPtrFinalizerEnv
addForeignPtrFinalizer :: FinalizerPtr a -> ForeignPtr a -> IO () #
This function adds a finalizer to the given foreign object. The finalizer will run before all other finalizers for the same object which have already been registered.
mallocForeignPtrBytes :: Int -> IO (ForeignPtr a) #
This function is similar to mallocForeignPtr
, except that the
size of the memory required is given explicitly as a number of bytes.
mallocForeignPtr :: Storable a => IO (ForeignPtr a) #
Allocate some memory and return a ForeignPtr
to it. The memory
will be released automatically when the ForeignPtr
is discarded.
mallocForeignPtr
is equivalent to
do { p <- malloc; newForeignPtr finalizerFree p }
although it may be implemented differently internally: you may not
assume that the memory returned by mallocForeignPtr
has been
allocated with malloc
.
GHC notes: mallocForeignPtr
has a heavily optimised
implementation in GHC. It uses pinned memory in the garbage
collected heap, so the ForeignPtr
does not require a finalizer to
free the memory. Use of mallocForeignPtr
and associated
functions is strongly recommended in preference to newForeignPtr
with a finalizer.
type FinalizerPtr a = FunPtr (Ptr a -> IO ()) #
A finalizer is represented as a pointer to a foreign function that, at finalisation time, gets as an argument a plain pointer variant of the foreign pointer that the finalizer is associated with.
Note that the foreign function must use the ccall
calling convention.
intPtrToPtr :: IntPtr -> Ptr a #
casts an IntPtr
to a Ptr
ptrToIntPtr :: Ptr a -> IntPtr #
casts a Ptr
to an IntPtr
wordPtrToPtr :: WordPtr -> Ptr a #
casts a WordPtr
to a Ptr
ptrToWordPtr :: Ptr a -> WordPtr #
casts a Ptr
to a WordPtr
freeHaskellFunPtr :: FunPtr a -> IO () #
Release the storage associated with the given FunPtr
, which
must have been obtained from a wrapper stub. This should be called
whenever the return value from a foreign import wrapper function is
no longer required; otherwise, the storage it uses will leak.
An unsigned integral type that can be losslessly converted to and from
Ptr
. This type is also compatible with the C99 type uintptr_t
, and
can be marshalled to and from that type safely.
Instances
A signed integral type that can be losslessly converted to and from
Ptr
. This type is also compatible with the C99 type intptr_t
, and
can be marshalled to and from that type safely.
Instances
Bounded IntPtr | |
Enum IntPtr | |
Defined in Foreign.Ptr | |
Eq IntPtr | |
Integral IntPtr | |
Num IntPtr | |
Ord IntPtr | |
Read IntPtr | |
Real IntPtr | |
Defined in Foreign.Ptr toRational :: IntPtr -> Rational # | |
Show IntPtr | |
Storable IntPtr | |
Bits IntPtr | |
Defined in Foreign.Ptr (.&.) :: IntPtr -> IntPtr -> IntPtr # (.|.) :: IntPtr -> IntPtr -> IntPtr # xor :: IntPtr -> IntPtr -> IntPtr # complement :: IntPtr -> IntPtr # shift :: IntPtr -> Int -> IntPtr # rotate :: IntPtr -> Int -> IntPtr # setBit :: IntPtr -> Int -> IntPtr # clearBit :: IntPtr -> Int -> IntPtr # complementBit :: IntPtr -> Int -> IntPtr # testBit :: IntPtr -> Int -> Bool # bitSizeMaybe :: IntPtr -> Maybe Int # shiftL :: IntPtr -> Int -> IntPtr # unsafeShiftL :: IntPtr -> Int -> IntPtr # shiftR :: IntPtr -> Int -> IntPtr # unsafeShiftR :: IntPtr -> Int -> IntPtr # rotateL :: IntPtr -> Int -> IntPtr # | |
FiniteBits IntPtr | |
Defined in Foreign.Ptr finiteBitSize :: IntPtr -> Int # countLeadingZeros :: IntPtr -> Int # countTrailingZeros :: IntPtr -> Int # |
The member functions of this class facilitate writing values of primitive types to raw memory (which may have been allocated with the above mentioned routines) and reading values from blocks of raw memory. The class, furthermore, includes support for computing the storage requirements and alignment restrictions of storable types.
Memory addresses are represented as values of type
, for some
Ptr
aa
which is an instance of class Storable
. The type argument to
Ptr
helps provide some valuable type safety in FFI code (you can't
mix pointers of different types without an explicit cast), while
helping the Haskell type system figure out which marshalling method is
needed for a given pointer.
All marshalling between Haskell and a foreign language ultimately
boils down to translating Haskell data structures into the binary
representation of a corresponding data structure of the foreign
language and vice versa. To code this marshalling in Haskell, it is
necessary to manipulate primitive data types stored in unstructured
memory blocks. The class Storable
facilitates this manipulation on
all types for which it is instantiated, which are the standard basic
types of Haskell, the fixed size Int
types (Int8
, Int16
,
Int32
, Int64
), the fixed size Word
types (Word8
, Word16
,
Word32
, Word64
), StablePtr
, all types from Foreign.C.Types,
as well as Ptr
.
sizeOf, alignment, (peek | peekElemOff | peekByteOff), (poke | pokeElemOff | pokeByteOff)
Computes the storage requirements (in bytes) of the argument. The value of the argument is not used.
Computes the alignment constraint of the argument. An
alignment constraint x
is fulfilled by any address divisible
by x
. The value of the argument is not used.
peekElemOff :: Ptr a -> Int -> IO a #
Read a value from a memory area regarded as an array
of values of the same kind. The first argument specifies
the start address of the array and the second the index into
the array (the first element of the array has index
0
). The following equality holds,
peekElemOff addr idx = IOExts.fixIO $ \result -> peek (addr `plusPtr` (idx * sizeOf result))
Note that this is only a specification, not necessarily the concrete implementation of the function.
pokeElemOff :: Ptr a -> Int -> a -> IO () #
Write a value to a memory area regarded as an array of values of the same kind. The following equality holds:
pokeElemOff addr idx x = poke (addr `plusPtr` (idx * sizeOf x)) x
peekByteOff :: Ptr b -> Int -> IO a #
Read a value from a memory location given by a base address and offset. The following equality holds:
peekByteOff addr off = peek (addr `plusPtr` off)
pokeByteOff :: Ptr b -> Int -> a -> IO () #
Write a value to a memory location given by a base address and offset. The following equality holds:
pokeByteOff addr off x = poke (addr `plusPtr` off) x
Read a value from the given memory location.
Note that the peek and poke functions might require properly
aligned addresses to function correctly. This is architecture
dependent; thus, portable code should ensure that when peeking or
poking values of some type a
, the alignment
constraint for a
, as given by the function
alignment
is fulfilled.
Write the given value to the given memory location. Alignment
restrictions might apply; see peek
.
Instances
castPtrToStablePtr :: Ptr () -> StablePtr a #
The inverse of castStablePtrToPtr
, i.e., we have the identity
sp == castPtrToStablePtr (castStablePtrToPtr sp)
for any stable pointer sp
on which freeStablePtr
has
not been executed yet. Moreover, castPtrToStablePtr
may
only be applied to pointers that have been produced by
castStablePtrToPtr
.
castStablePtrToPtr :: StablePtr a -> Ptr () #
Coerce a stable pointer to an address. No guarantees are made about
the resulting value, except that the original stable pointer can be
recovered by castPtrToStablePtr
. In particular, the address may not
refer to an accessible memory location and any attempt to pass it to
the member functions of the class Storable
leads to
undefined behaviour.
deRefStablePtr :: StablePtr a -> IO a #
Obtain the Haskell value referenced by a stable pointer, i.e., the
same value that was passed to the corresponding call to
makeStablePtr
. If the argument to deRefStablePtr
has
already been freed using freeStablePtr
, the behaviour of
deRefStablePtr
is undefined.
freeStablePtr :: StablePtr a -> IO () #
Dissolve the association between the stable pointer and the Haskell
value. Afterwards, if the stable pointer is passed to
deRefStablePtr
or freeStablePtr
, the behaviour is
undefined. However, the stable pointer may still be passed to
castStablePtrToPtr
, but the
value returned
by Ptr
()castStablePtrToPtr
, in this case, is undefined (in particular,
it may be nullPtr
). Nevertheless, the call
to castStablePtrToPtr
is guaranteed not to diverge.
castPtrToFunPtr :: Ptr a -> FunPtr b #
castFunPtrToPtr :: FunPtr a -> Ptr b #
nullFunPtr :: FunPtr a #
The constant nullFunPtr
contains a
distinguished value of FunPtr
that is not
associated with a valid memory location.
minusPtr :: Ptr a -> Ptr b -> Int #
Computes the offset required to get from the second to the first argument. We have
p2 == p1 `plusPtr` (p2 `minusPtr` p1)
alignPtr :: Ptr a -> Int -> Ptr a #
Given an arbitrary address and an alignment constraint,
alignPtr
yields the next higher address that fulfills the
alignment constraint. An alignment constraint x
is fulfilled by
any address divisible by x
. This operation is idempotent.
byteSwap64 :: Word64 -> Word64 #
Reverse order of bytes in Word64
.
Since: base-4.7.0.0
byteSwap32 :: Word32 -> Word32 #
Reverse order of bytes in Word32
.
Since: base-4.7.0.0
byteSwap16 :: Word16 -> Word16 #
Swap bytes in Word16
.
Since: base-4.7.0.0
toIntegralSized :: (Integral a, Integral b, Bits a, Bits b) => a -> Maybe b #
Attempt to convert an Integral
type a
to an Integral
type b
using
the size of the types as measured by Bits
methods.
A simpler version of this function is:
toIntegral :: (Integral a, Integral b) => a -> Maybe b toIntegral x | toInteger x == y = Just (fromInteger y) | otherwise = Nothing where y = toInteger x
This version requires going through Integer
, which can be inefficient.
However, toIntegralSized
is optimized to allow GHC to statically determine
the relative type sizes (as measured by bitSizeMaybe
and isSigned
) and
avoid going through Integer
for many types. (The implementation uses
fromIntegral
, which is itself optimized with rules for base
types but may
go through Integer
for some type pairs.)
Since: base-4.8.0.0
popCountDefault :: (Bits a, Num a) => a -> Int #
Default implementation for popCount
.
This implementation is intentionally naive. Instances are expected to provide an optimized implementation for their size.
Since: base-4.6.0.0
testBitDefault :: (Bits a, Num a) => a -> Int -> Bool #
Default implementation for testBit
.
Note that: testBitDefault x i = (x .&. bit i) /= 0
Since: base-4.6.0.0
bitDefault :: (Bits a, Num a) => Int -> a #
The Bits
class defines bitwise operations over integral types.
- Bits are numbered from 0 with bit 0 being the least significant bit.
(.&.), (.|.), xor, complement, (shift | shiftL, shiftR), (rotate | rotateL, rotateR), bitSize, bitSizeMaybe, isSigned, testBit, bit, popCount
(.&.) :: a -> a -> a infixl 7 #
Bitwise "and"
(.|.) :: a -> a -> a infixl 5 #
Bitwise "or"
Bitwise "xor"
complement :: a -> a #
Reverse all the bits in the argument
shift :: a -> Int -> a infixl 8 #
shifts shift
x ix
left by i
bits if i
is positive,
or right by -i
bits otherwise.
Right shifts perform sign extension on signed number types;
i.e. they fill the top bits with 1 if the x
is negative
and with 0 otherwise.
An instance can define either this unified shift
or shiftL
and
shiftR
, depending on which is more convenient for the type in
question.
rotate :: a -> Int -> a infixl 8 #
rotates rotate
x ix
left by i
bits if i
is positive,
or right by -i
bits otherwise.
For unbounded types like Integer
, rotate
is equivalent to shift
.
An instance can define either this unified rotate
or rotateL
and
rotateR
, depending on which is more convenient for the type in
question.
zeroBits
is the value with all bits unset.
The following laws ought to hold (for all valid bit indices n
):
clearBit
zeroBits
n ==zeroBits
setBit
zeroBits
n ==bit
ntestBit
zeroBits
n == FalsepopCount
zeroBits
== 0
This method uses
as its default
implementation (which ought to be equivalent to clearBit
(bit
0) 0zeroBits
for
types which possess a 0th bit).
Since: base-4.7.0.0
bit i
is a value with the i
th bit set and all other bits clear.
Can be implemented using bitDefault
if a
is also an
instance of Num
.
See also zeroBits
.
x `setBit` i
is the same as x .|. bit i
x `clearBit` i
is the same as x .&. complement (bit i)
complementBit :: a -> Int -> a #
x `complementBit` i
is the same as x `xor` bit i
Return True
if the n
th bit of the argument is 1
Can be implemented using testBitDefault
if a
is also an
instance of Num
.
bitSizeMaybe :: a -> Maybe Int #
Return the number of bits in the type of the argument. The actual
value of the argument is ignored. Returns Nothing
for types that do not have a fixed bitsize, like Integer
.
Since: base-4.7.0.0
Return the number of bits in the type of the argument. The actual
value of the argument is ignored. The function bitSize
is
undefined for types that do not have a fixed bitsize, like Integer
.
Default implementation based upon bitSizeMaybe
provided since
4.12.0.0.
Return True
if the argument is a signed type. The actual
value of the argument is ignored
shiftL :: a -> Int -> a infixl 8 #
Shift the argument left by the specified number of bits (which must be non-negative).
An instance can define either this and shiftR
or the unified
shift
, depending on which is more convenient for the type in
question.
unsafeShiftL :: a -> Int -> a #
Shift the argument left by the specified number of bits. The
result is undefined for negative shift amounts and shift amounts
greater or equal to the bitSize
.
Defaults to shiftL
unless defined explicitly by an instance.
Since: base-4.5.0.0
shiftR :: a -> Int -> a infixl 8 #
Shift the first argument right by the specified number of bits. The
result is undefined for negative shift amounts and shift amounts
greater or equal to the bitSize
.
Right shifts perform sign extension on signed number types;
i.e. they fill the top bits with 1 if the x
is negative
and with 0 otherwise.
An instance can define either this and shiftL
or the unified
shift
, depending on which is more convenient for the type in
question.
unsafeShiftR :: a -> Int -> a #
Shift the first argument right by the specified number of bits, which must be non-negative and smaller than the number of bits in the type.
Right shifts perform sign extension on signed number types;
i.e. they fill the top bits with 1 if the x
is negative
and with 0 otherwise.
Defaults to shiftR
unless defined explicitly by an instance.
Since: base-4.5.0.0
rotateL :: a -> Int -> a infixl 8 #
Rotate the argument left by the specified number of bits (which must be non-negative).
An instance can define either this and rotateR
or the unified
rotate
, depending on which is more convenient for the type in
question.
rotateR :: a -> Int -> a infixl 8 #
Rotate the argument right by the specified number of bits (which must be non-negative).
An instance can define either this and rotateL
or the unified
rotate
, depending on which is more convenient for the type in
question.
Return the number of set bits in the argument. This number is known as the population count or the Hamming weight.
Can be implemented using popCountDefault
if a
is also an
instance of Num
.
Since: base-4.5.0.0
Instances
class Bits b => FiniteBits b where #
The FiniteBits
class denotes types with a finite, fixed number of bits.
Since: base-4.7.0.0
finiteBitSize :: b -> Int #
Return the number of bits in the type of the argument.
The actual value of the argument is ignored. Moreover, finiteBitSize
is total, in contrast to the deprecated bitSize
function it replaces.
finiteBitSize
=bitSize
bitSizeMaybe
=Just
.finiteBitSize
Since: base-4.7.0.0
countLeadingZeros :: b -> Int #
Count number of zero bits preceding the most significant set bit.
countLeadingZeros
(zeroBits
:: a) = finiteBitSize (zeroBits
:: a)
countLeadingZeros
can be used to compute log base 2 via
logBase2 x =finiteBitSize
x - 1 -countLeadingZeros
x
Note: The default implementation for this method is intentionally naive. However, the instances provided for the primitive integral types are implemented using CPU specific machine instructions.
Since: base-4.8.0.0
countTrailingZeros :: b -> Int #
Count number of zero bits following the least significant set bit.
countTrailingZeros
(zeroBits
:: a) = finiteBitSize (zeroBits
:: a)countTrailingZeros
.negate
=countTrailingZeros
The related
find-first-set operation
can be expressed in terms of countTrailingZeros
as follows
findFirstSet x = 1 + countTrailingZeros
x
Note: The default implementation for this method is intentionally naive. However, the instances provided for the primitive integral types are implemented using CPU specific machine instructions.
Since: base-4.8.0.0
Instances
ft_Init_FreeType :: Ptr FT_Library -> IO FT_Error #
ft_New_Face :: FT_Library -> CString -> FT_Long -> Ptr FT_Face -> IO FT_Error #
ft_Set_Char_Size :: FT_Face -> FT_F26Dot6 -> FT_F26Dot6 -> FT_UInt -> FT_UInt -> IO FT_Error #
ft_Done_Face :: FT_Face -> IO FT_Error #
ft_Done_FreeType :: FT_Library -> IO FT_Error #
ft_Get_Glyph :: FT_GlyphSlot -> Ptr FT_Glyph -> IO FT_Error #
ft_Done_Glyph :: FT_Glyph -> IO () #
ft_Glyph_To_Bitmap :: Ptr FT_Glyph -> FT_Render_Mode -> Ptr FT_Vector -> FT_Bool -> IO FT_Error #
ft_Library_Version :: FT_Library -> Ptr FT_Int -> Ptr FT_Int -> Ptr FT_Int -> IO () #
ft_Face_CheckTrueTypePatents :: FT_Face -> IO FT_Bool #
This is just here for completeness, TrueType hinting is no longer patented
ft_Face_SetUnpatentedHinting :: FT_Face -> FT_Bool -> IO FT_Bool #
This is just here for completeness, TrueType hinting is no longer patented.
ft_New_Memory_Face :: FT_Library -> FT_Bytes -> FT_Long -> FT_Long -> Ptr FT_Face -> IO FT_Error #
ft_Open_Face :: FT_Library -> Ptr FT_Open_Args -> FT_Long -> Ptr FT_Face -> IO FT_Error #
ft_Attach_Stream :: FT_Face -> Ptr FT_Open_Args -> IO FT_Error #
ft_Reference_Face :: FT_Face -> IO FT_Error #
ft_Request_Size :: FT_Face -> FT_Size_Request -> IO FT_Error #
ft_Render_Glyph :: FT_GlyphSlot -> FT_Render_Mode -> IO FT_Error #
ft_Get_Glyph_Name :: FT_Face -> FT_UInt -> FT_Pointer -> FT_UInt -> IO FT_Error #
ft_Get_Postscript_Name :: FT_Face -> IO CString #
ft_Select_Charmap :: FT_Face -> FT_Encoding -> IO FT_Error #
ft_Set_Charmap :: FT_Face -> FT_CharMap -> IO FT_Error #
ft_Get_Charmap_Index :: FT_CharMap -> IO FT_Int #
ft_Get_SubGlyph_Info :: FT_GlyphSlot -> FT_UInt -> Ptr FT_Int -> Ptr FT_UInt -> Ptr FT_Int -> Ptr FT_Int -> Ptr FT_Matrix -> IO FT_Error #
ft_Get_FSType_Flags :: FT_Face -> IO FT_UShort #
ft_Outline_New :: FT_Library -> FT_UInt -> FT_Int -> Ptr FT_Outline -> IO FT_Error #
ft_Outline_New_Internal :: FT_Memory -> FT_UInt -> FT_Int -> Ptr FT_Outline -> IO FT_Error #
ft_Outline_Done :: FT_Library -> Ptr FT_Outline -> IO FT_Error #
ft_Outline_Done_Internal :: FT_Memory -> Ptr FT_Outline -> IO FT_Error #
ft_Outline_Copy :: Ptr FT_Outline -> Ptr FT_Outline -> IO FT_Error #
ft_Outline_Translate :: Ptr FT_Outline -> FT_Pos -> FT_Pos -> IO () #
ft_Outline_Transform :: Ptr FT_Outline -> Ptr FT_Matrix -> IO () #
ft_Outline_Embolden :: Ptr FT_Outline -> FT_Pos -> IO FT_Error #
ft_Outline_Reverse :: Ptr FT_Outline -> IO () #
ft_Outline_Check :: Ptr FT_Outline -> IO FT_Error #
ft_Outline_Get_BBox :: Ptr FT_Outline -> Ptr FT_BBox -> IO FT_Error #
ft_Outline_Decompose :: Ptr FT_Outline -> Ptr FT_Outline_Funcs -> Ptr a -> IO FT_Error #
ft_Outline_Get_CBox :: Ptr FT_Outline -> Ptr FT_BBox -> IO () #
ft_Outline_Get_Bitmap :: FT_Library -> Ptr FT_Outline -> Ptr FT_Bitmap -> IO FT_Error #
ft_Outline_Render :: FT_Library -> Ptr FT_Outline -> Ptr FT_Raster_Params -> IO FT_Error #
ft_Done_Size :: FT_Size -> IO FT_Error #
ft_Activate_Size :: FT_Size -> IO FT_Error #
ft_IS_TRICKY :: FT_Face -> IO Bool #
ft_IS_CID_KEYED :: FT_Face -> IO Bool #
ft_HAS_MULTIPLE_MASTERS :: FT_Face -> IO Bool #
ft_HAS_GLYPH_NAMES :: FT_Face -> IO Bool #
ft_HAS_FAST_GLYPHS :: FT_Face -> IO Bool #
ft_HAS_FIXED_SIZES :: FT_Face -> IO Bool #
ft_IS_FIXED_WIDTH :: FT_Face -> IO Bool #
ft_IS_SFNT :: FT_Face -> IO Bool #
ft_IS_SCALABLE :: FT_Face -> IO Bool #
ft_HAS_KERNING :: FT_Face -> IO Bool #
ft_HAS_VERTICAL :: FT_Face -> IO Bool #
ft_HAS_HORIZONTAL :: FT_Face -> IO Bool #
charmap :: FT_Face -> Ptr FT_CharMap #
glyph :: FT_Face -> Ptr FT_GlyphSlot #
underline_thickness :: FT_Face -> Ptr FT_Short #
underline_position :: FT_Face -> Ptr FT_Short #
max_advance_height :: FT_Face -> Ptr FT_Short #
max_advance_width :: FT_Face -> Ptr FT_Short #
units_per_EM :: FT_Face -> Ptr FT_UShort #
num_charmaps :: FT_Face -> Ptr FT_Int #
available_sizes :: FT_Face -> Ptr (Ptr FT_Bitmap_Size) #
num_fixed_sizes :: FT_Face -> Ptr FT_Int #
style_name :: FT_Face -> Ptr CString #
family_name :: FT_Face -> Ptr CString #
num_glyphs :: FT_Face -> Ptr FT_Long #
style_flags :: FT_Face -> Ptr FT_Long #
face_flags :: FT_Face -> Ptr FT_Long #
face_index :: FT_Face -> Ptr FT_Long #
rsb_delta :: FT_GlyphSlot -> Ptr FT_Pos #
lsb_delta :: FT_GlyphSlot -> Ptr FT_Pos #
control_len :: FT_GlyphSlot -> Ptr CLong #
control_data :: FT_GlyphSlot -> Ptr a #
subglyphs :: FT_GlyphSlot -> Ptr FT_SubGlyph #
num_subglyphs :: FT_GlyphSlot -> Ptr FT_UInt #
outline :: FT_GlyphSlot -> Ptr FT_Outline #
bitmap_top :: FT_GlyphSlot -> Ptr FT_Int #
bitmap_left :: FT_GlyphSlot -> Ptr FT_Int #
bitmap :: FT_GlyphSlot -> Ptr FT_Bitmap #
format :: FT_GlyphSlot -> Ptr FT_Glyph_Format #
advance :: FT_GlyphSlot -> Ptr FT_Vector #
metrics :: FT_GlyphSlot -> Ptr FT_Glyph_Metrics #
generic :: FT_GlyphSlot -> Ptr FT_Generic #
next :: FT_GlyphSlot -> Ptr FT_GlyphSlot #
face :: FT_GlyphSlot -> Ptr FT_Face #
library :: FT_GlyphSlot -> Ptr FT_Library #
data FT_GlyphSlotRec_ #
type FT_GlyphSlot = Ptr FT_GlyphSlotRec_ #
Instances
Eq FT_Vector | |
Read FT_Vector | |
Show FT_Vector | |
Storable FT_Vector | |
Defined in Graphics.Rendering.FreeType.Internal.Vector |
type FT_F26Dot6 = CLong #
type FT_Pointer = Ptr () #
newtype FT_Render_Mode #
Instances
newtype FT_Encoding #
Instances
newtype FT_FACE_FLAG #
Instances
Instances
newtype FT_Size_Request_Type #
Instances
newtype FT_Kerning_Mode #
Instances
newtype FT_SUBGLYPH_FLAG #
Instances
newtype FT_Glyph_Format #
Instances
newtype FT_OUTLINE_FLAGS #
Instances
newtype FT_Orientation #
Instances
data FT_LibraryRec_ #
type FT_Library = Ptr FT_LibraryRec_ #
data FT_FaceRec_ #
type FT_Face = Ptr FT_FaceRec_ #
Instances
Storable FT_Bitmap | |
Defined in Graphics.Rendering.FreeType.Internal.Bitmap |
type FreeTypeIO = FreeTypeT IO Source #
getAdvance :: MonadIO m => FT_GlyphSlot -> FreeTypeT m (Int, Int) Source #
getLibrary :: MonadIO m => FreeTypeT m FT_Library Source #
getKerning :: MonadIO m => FT_Face -> FT_UInt -> FT_UInt -> FT_Kerning_Mode -> FreeTypeT m (Int, Int) Source #
withFreeType :: MonadIO m => Maybe FT_Library -> FreeTypeT m a -> m (Either String a) Source #
runFreeType :: MonadIO m => FreeTypeT m a -> m (Either String (a, FT_Library)) Source #