    {-# LINE 1 "Bindings/SANE.hsc" #-}
    {-# LANGUAGE ForeignFunctionInterface #-}
    {-# LINE 2 "Bindings/SANE.hsc" #-}

    -- Copyright © 2012  Clint Adams

    -- This program is free software: you can redistribute it and/or
    -- modify it under the terms of the GNU Lesser General Public
    -- License as published by the Free Software Foundation, either
    -- version 3 of the License, or (at your option) 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
    -- Lesser General Public License for more details.
    --
    -- You should have received a copy of the GNU Lesser General Public
    -- License along with this program.  If not, see
    -- <http://www.gnu.org/licenses/>.

    {-# LINE 20 "Bindings/SANE.hsc" #-}

    {-# LINE 21 "Bindings/SANE.hsc" #-}

    module Bindings.SANE where
    import Foreign.Ptr (Ptr,FunPtr,plusPtr)
    import Foreign.Ptr (wordPtrToPtr,castPtrToFunPtr)
    import Foreign.Storable
    import Foreign.C.Types
    import Foreign.C.String (CString,CStringLen,CWString,CWStringLen)
    import Foreign.Marshal.Alloc (alloca)
    import Foreign.Marshal.Array (peekArray,pokeArray)
    import Data.Int
    import Data.Word

    {-# LINE 24 "Bindings/SANE.hsc" #-}

    c'SANE_CURRENT_MAJOR = 1
    c'SANE_CURRENT_MAJOR :: (Num a) => a

    {-# LINE 26 "Bindings/SANE.hsc" #-}
    c'SANE_CURRENT_MINOR = 0
    c'SANE_CURRENT_MINOR :: (Num a) => a

    {-# LINE 27 "Bindings/SANE.hsc" #-}

    foreign import ccall "inline_SANE_VERSION_CODE" c'SANE_VERSION_CODE
      :: C'SANE_Int -> C'SANE_Int -> C'SANE_Int -> C'SANE_Int

    {-# LINE 29 "Bindings/SANE.hsc" #-}

    foreign import ccall "inline_SANE_VERSION_MAJOR" c'SANE_VERSION_MAJOR
      :: C'SANE_Int -> C'SANE_Int

    {-# LINE 31 "Bindings/SANE.hsc" #-}
    foreign import ccall "inline_SANE_VERSION_MINOR" c'SANE_VERSION_MINOR
      :: C'SANE_Int -> C'SANE_Int

    {-# LINE 32 "Bindings/SANE.hsc" #-}
    foreign import ccall "inline_SANE_VERSION_BUILD" c'SANE_VERSION_BUILD
      :: C'SANE_Int -> C'SANE_Int

    {-# LINE 33 "Bindings/SANE.hsc" #-}

    c'SANE_FALSE = 0
    c'SANE_FALSE :: (Num a) => a

    {-# LINE 35 "Bindings/SANE.hsc" #-}
    c'SANE_TRUE = 1
    c'SANE_TRUE :: (Num a) => a

    {-# LINE 36 "Bindings/SANE.hsc" #-}

    type C'SANE_Byte = CUChar

    {-# LINE 38 "Bindings/SANE.hsc" #-}
    type C'SANE_Word = CInt

    {-# LINE 39 "Bindings/SANE.hsc" #-}
    type C'SANE_Bool = CInt

    {-# LINE 40 "Bindings/SANE.hsc" #-}
    type C'SANE_Int = CInt

    {-# LINE 41 "Bindings/SANE.hsc" #-}
    type C'SANE_Char = CChar

    {-# LINE 42 "Bindings/SANE.hsc" #-}
    type C'SANE_String = CString

    {-# LINE 43 "Bindings/SANE.hsc" #-}
    type C'SANE_String_Const = CString

    {-# LINE 44 "Bindings/SANE.hsc" #-}
    type C'SANE_Handle = Ptr ()

    {-# LINE 45 "Bindings/SANE.hsc" #-}
    type C'SANE_Fixed = CInt

    {-# LINE 46 "Bindings/SANE.hsc" #-}

    c'SANE_FIXED_SCALE_SHIFT = 16
    c'SANE_FIXED_SCALE_SHIFT :: (Num a) => a

    {-# LINE 48 "Bindings/SANE.hsc" #-}
    foreign import ccall "inline_SANE_FIX" c'SANE_FIX
      :: CDouble -> C'SANE_Fixed

    {-# LINE 49 "Bindings/SANE.hsc" #-}
    foreign import ccall "inline_SANE_UNFIX" c'SANE_UNFIX
      :: C'SANE_Fixed -> CDouble

    {-# LINE 50 "Bindings/SANE.hsc" #-}

    type C'SANE_Status = CUInt

    {-# LINE 52 "Bindings/SANE.hsc" #-}
    c'SANE_STATUS_GOOD = 0
    c'SANE_STATUS_GOOD :: (Num a) => a

    {-# LINE 53 "Bindings/SANE.hsc" #-}
    c'SANE_STATUS_UNSUPPORTED = 1
    c'SANE_STATUS_UNSUPPORTED :: (Num a) => a

    {-# LINE 54 "Bindings/SANE.hsc" #-}
    c'SANE_STATUS_CANCELLED = 2
    c'SANE_STATUS_CANCELLED :: (Num a) => a

    {-# LINE 55 "Bindings/SANE.hsc" #-}
    c'SANE_STATUS_DEVICE_BUSY = 3
    c'SANE_STATUS_DEVICE_BUSY :: (Num a) => a

    {-# LINE 56 "Bindings/SANE.hsc" #-}
    c'SANE_STATUS_INVAL = 4
    c'SANE_STATUS_INVAL :: (Num a) => a

    {-# LINE 57 "Bindings/SANE.hsc" #-}
    c'SANE_STATUS_EOF = 5
    c'SANE_STATUS_EOF :: (Num a) => a

    {-# LINE 58 "Bindings/SANE.hsc" #-}
    c'SANE_STATUS_JAMMED = 6
    c'SANE_STATUS_JAMMED :: (Num a) => a

    {-# LINE 59 "Bindings/SANE.hsc" #-}
    c'SANE_STATUS_NO_DOCS = 7
    c'SANE_STATUS_NO_DOCS :: (Num a) => a

    {-# LINE 60 "Bindings/SANE.hsc" #-}
    c'SANE_STATUS_COVER_OPEN = 8
    c'SANE_STATUS_COVER_OPEN :: (Num a) => a

    {-# LINE 61 "Bindings/SANE.hsc" #-}
    c'SANE_STATUS_IO_ERROR = 9
    c'SANE_STATUS_IO_ERROR :: (Num a) => a

    {-# LINE 62 "Bindings/SANE.hsc" #-}
    c'SANE_STATUS_NO_MEM = 10
    c'SANE_STATUS_NO_MEM :: (Num a) => a

    {-# LINE 63 "Bindings/SANE.hsc" #-}
    c'SANE_STATUS_ACCESS_DENIED = 11
    c'SANE_STATUS_ACCESS_DENIED :: (Num a) => a

    {-# LINE 64 "Bindings/SANE.hsc" #-}

    type C'SANE_Value_Type = CUInt

    {-# LINE 66 "Bindings/SANE.hsc" #-}
    c'SANE_TYPE_BOOL = 0
    c'SANE_TYPE_BOOL :: (Num a) => a

    {-# LINE 67 "Bindings/SANE.hsc" #-}
    c'SANE_TYPE_INT = 1
    c'SANE_TYPE_INT :: (Num a) => a

    {-# LINE 68 "Bindings/SANE.hsc" #-}
    c'SANE_TYPE_FIXED = 2
    c'SANE_TYPE_FIXED :: (Num a) => a

    {-# LINE 69 "Bindings/SANE.hsc" #-}
    c'SANE_TYPE_STRING = 3
    c'SANE_TYPE_STRING :: (Num a) => a

    {-# LINE 70 "Bindings/SANE.hsc" #-}
    c'SANE_TYPE_BUTTON = 4
    c'SANE_TYPE_BUTTON :: (Num a) => a

    {-# LINE 71 "Bindings/SANE.hsc" #-}
    c'SANE_TYPE_GROUP = 5
    c'SANE_TYPE_GROUP :: (Num a) => a

    {-# LINE 72 "Bindings/SANE.hsc" #-}

    type C'SANE_Unit = CUInt

    {-# LINE 74 "Bindings/SANE.hsc" #-}
    c'SANE_UNIT_NONE = 0
    c'SANE_UNIT_NONE :: (Num a) => a

    {-# LINE 75 "Bindings/SANE.hsc" #-}
    c'SANE_UNIT_PIXEL = 1
    c'SANE_UNIT_PIXEL :: (Num a) => a

    {-# LINE 76 "Bindings/SANE.hsc" #-}
    c'SANE_UNIT_BIT = 2
    c'SANE_UNIT_BIT :: (Num a) => a

    {-# LINE 77 "Bindings/SANE.hsc" #-}
    c'SANE_UNIT_MM = 3
    c'SANE_UNIT_MM :: (Num a) => a

    {-# LINE 78 "Bindings/SANE.hsc" #-}
    c'SANE_UNIT_DPI = 4
    c'SANE_UNIT_DPI :: (Num a) => a

    {-# LINE 79 "Bindings/SANE.hsc" #-}
    c'SANE_UNIT_PERCENT = 5
    c'SANE_UNIT_PERCENT :: (Num a) => a

    {-# LINE 80 "Bindings/SANE.hsc" #-}
    c'SANE_UNIT_MICROSECOND = 6
    c'SANE_UNIT_MICROSECOND :: (Num a) => a

    {-# LINE 81 "Bindings/SANE.hsc" #-}

    {-# LINE 83 "Bindings/SANE.hsc" #-}

    {-# LINE 84 "Bindings/SANE.hsc" #-}

    {-# LINE 85 "Bindings/SANE.hsc" #-}

    {-# LINE 86 "Bindings/SANE.hsc" #-}

    {-# LINE 87 "Bindings/SANE.hsc" #-}
    data C'SANE_Device = C'SANE_Device{
      c'SANE_Device'name :: C'SANE_String_Const,
      c'SANE_Device'vendor :: C'SANE_String_Const,
      c'SANE_Device'model :: C'SANE_String_Const,
      c'SANE_Device'type :: C'SANE_String_Const
    } deriving (Eq,Show)
    p'SANE_Device'name p = plusPtr p 0
    p'SANE_Device'name :: Ptr (C'SANE_Device) -> Ptr (C'SANE_String_Const)
    p'SANE_Device'vendor p = plusPtr p 4
    p'SANE_Device'vendor :: Ptr (C'SANE_Device) -> Ptr (C'SANE_String_Const)
    p'SANE_Device'model p = plusPtr p 8
    p'SANE_Device'model :: Ptr (C'SANE_Device) -> Ptr (C'SANE_String_Const)
    p'SANE_Device'type p = plusPtr p 12
    p'SANE_Device'type :: Ptr (C'SANE_Device) -> Ptr (C'SANE_String_Const)
    instance Storable C'SANE_Device where
      sizeOf _ = 16
      alignment _ = 4
      peek p = do
        v0 <- peekByteOff p 0
        v1 <- peekByteOff p 4
        v2 <- peekByteOff p 8
        v3 <- peekByteOff p 12
        return $ C'SANE_Device v0 v1 v2 v3
      poke p (C'SANE_Device v0 v1 v2 v3) = do
        pokeByteOff p 0 v0
        pokeByteOff p 4 v1
        pokeByteOff p 8 v2
        pokeByteOff p 12 v3
        return ()

    {-# LINE 88 "Bindings/SANE.hsc" #-}

    c'SANE_CAP_SOFT_SELECT = 1
    c'SANE_CAP_SOFT_SELECT :: (Num a) => a

    {-# LINE 90 "Bindings/SANE.hsc" #-}
    c'SANE_CAP_HARD_SELECT = 2
    c'SANE_CAP_HARD_SELECT :: (Num a) => a

    {-# LINE 91 "Bindings/SANE.hsc" #-}
    c'SANE_CAP_SOFT_DETECT = 4
    c'SANE_CAP_SOFT_DETECT :: (Num a) => a

    {-# LINE 92 "Bindings/SANE.hsc" #-}
    c'SANE_CAP_EMULATED = 8
    c'SANE_CAP_EMULATED :: (Num a) => a

    {-# LINE 93 "Bindings/SANE.hsc" #-}
    c'SANE_CAP_AUTOMATIC = 16
    c'SANE_CAP_AUTOMATIC :: (Num a) => a

    {-# LINE 94 "Bindings/SANE.hsc" #-}
    c'SANE_CAP_INACTIVE = 32
    c'SANE_CAP_INACTIVE :: (Num a) => a

    {-# LINE 95 "Bindings/SANE.hsc" #-}
    c'SANE_CAP_ADVANCED = 64
    c'SANE_CAP_ADVANCED :: (Num a) => a

    {-# LINE 96 "Bindings/SANE.hsc" #-}

    foreign import ccall "inline_SANE_OPTION_IS_ACTIVE" c'SANE_OPTION_IS_ACTIVE
      :: CInt -> CInt

    {-# LINE 98 "Bindings/SANE.hsc" #-}
    foreign import ccall "inline_SANE_OPTION_IS_SETTABLE" c'SANE_OPTION_IS_SETTABLE
      :: CInt -> CInt

    {-# LINE 99 "Bindings/SANE.hsc" #-}

    c'SANE_INFO_INEXACT = 1
    c'SANE_INFO_INEXACT :: (Num a) => a

    {-# LINE 101 "Bindings/SANE.hsc" #-}
    c'SANE_INFO_RELOAD_OPTIONS = 2
    c'SANE_INFO_RELOAD_OPTIONS :: (Num a) => a

    {-# LINE 102 "Bindings/SANE.hsc" #-}
    c'SANE_INFO_RELOAD_PARAMS = 4
    c'SANE_INFO_RELOAD_PARAMS :: (Num a) => a

    {-# LINE 103 "Bindings/SANE.hsc" #-}

    type C'SANE_Constraint_Type = CUInt

    {-# LINE 105 "Bindings/SANE.hsc" #-}
    c'SANE_CONSTRAINT_NONE = 0
    c'SANE_CONSTRAINT_NONE :: (Num a) => a

    {-# LINE 106 "Bindings/SANE.hsc" #-}
    c'SANE_CONSTRAINT_RANGE = 1
    c'SANE_CONSTRAINT_RANGE :: (Num a) => a

    {-# LINE 107 "Bindings/SANE.hsc" #-}
    c'SANE_CONSTRAINT_WORD_LIST = 2
    c'SANE_CONSTRAINT_WORD_LIST :: (Num a) => a

    {-# LINE 108 "Bindings/SANE.hsc" #-}
    c'SANE_CONSTRAINT_STRING_LIST = 3
    c'SANE_CONSTRAINT_STRING_LIST :: (Num a) => a

    {-# LINE 109 "Bindings/SANE.hsc" #-}

    {-# LINE 111 "Bindings/SANE.hsc" #-}

    {-# LINE 112 "Bindings/SANE.hsc" #-}

    {-# LINE 113 "Bindings/SANE.hsc" #-}

    {-# LINE 114 "Bindings/SANE.hsc" #-}
    data C'SANE_Range = C'SANE_Range{
      c'SANE_Range'min :: C'SANE_Word,
      c'SANE_Range'max :: C'SANE_Word,
      c'SANE_Range'quant :: C'SANE_Word
    } deriving (Eq,Show)
    p'SANE_Range'min p = plusPtr p 0
    p'SANE_Range'min :: Ptr (C'SANE_Range) -> Ptr (C'SANE_Word)
    p'SANE_Range'max p = plusPtr p 4
    p'SANE_Range'max :: Ptr (C'SANE_Range) -> Ptr (C'SANE_Word)
    p'SANE_Range'quant p = plusPtr p 8
    p'SANE_Range'quant :: Ptr (C'SANE_Range) -> Ptr (C'SANE_Word)
    instance Storable C'SANE_Range where
      sizeOf _ = 12
      alignment _ = 4
      peek p = do
        v0 <- peekByteOff p 0
        v1 <- peekByteOff p 4
        v2 <- peekByteOff p 8
        return $ C'SANE_Range v0 v1 v2
      poke p (C'SANE_Range v0 v1 v2) = do
        pokeByteOff p 0 v0
        pokeByteOff p 4 v1
        pokeByteOff p 8 v2
        return ()

    {-# LINE 115 "Bindings/SANE.hsc" #-}

    {-# LINE 117 "Bindings/SANE.hsc" #-}

    {-# LINE 118 "Bindings/SANE.hsc" #-}

    {-# LINE 119 "Bindings/SANE.hsc" #-}

    {-# LINE 120 "Bindings/SANE.hsc" #-}

    {-# LINE 121 "Bindings/SANE.hsc" #-}

    {-# LINE 122 "Bindings/SANE.hsc" #-}

    {-# LINE 123 "Bindings/SANE.hsc" #-}

    {-# LINE 124 "Bindings/SANE.hsc" #-}

    {-# LINE 125 "Bindings/SANE.hsc" #-}

    {-# LINE 126 "Bindings/SANE.hsc" #-}

    {-# LINE 127 "Bindings/SANE.hsc" #-}

    {-# LINE 128 "Bindings/SANE.hsc" #-}
    data C'SANE_Option_Descriptor = C'SANE_Option_Descriptor{
      c'SANE_Option_Descriptor'name :: C'SANE_String_Const,
      c'SANE_Option_Descriptor'title :: C'SANE_String_Const,
      c'SANE_Option_Descriptor'desc :: C'SANE_String_Const,
      c'SANE_Option_Descriptor'type :: C'SANE_Value_Type,
      c'SANE_Option_Descriptor'unit :: C'SANE_Unit,
      c'SANE_Option_Descriptor'size :: C'SANE_Int,
      c'SANE_Option_Descriptor'cap :: C'SANE_Int,
      c'SANE_Option_Descriptor'constraint_type :: C'SANE_Constraint_Type,
      c'SANE_Option_Descriptor'constraint'string_list :: Ptr C'SANE_String_Const,
      c'SANE_Option_Descriptor'constraint'word_list :: Ptr C'SANE_Word,
      c'SANE_Option_Descriptor'constraint'range :: Ptr C'SANE_Range
    } deriving (Eq,Show)
    p'SANE_Option_Descriptor'name p = plusPtr p 0
    p'SANE_Option_Descriptor'name :: Ptr (C'SANE_Option_Descriptor) -> Ptr (C'SANE_String_Const)
    p'SANE_Option_Descriptor'title p = plusPtr p 4
    p'SANE_Option_Descriptor'title :: Ptr (C'SANE_Option_Descriptor) -> Ptr (C'SANE_String_Const)
    p'SANE_Option_Descriptor'desc p = plusPtr p 8
    p'SANE_Option_Descriptor'desc :: Ptr (C'SANE_Option_Descriptor) -> Ptr (C'SANE_String_Const)
    p'SANE_Option_Descriptor'type p = plusPtr p 12
    p'SANE_Option_Descriptor'type :: Ptr (C'SANE_Option_Descriptor) -> Ptr (C'SANE_Value_Type)
    p'SANE_Option_Descriptor'unit p = plusPtr p 16
    p'SANE_Option_Descriptor'unit :: Ptr (C'SANE_Option_Descriptor) -> Ptr (C'SANE_Unit)
    p'SANE_Option_Descriptor'size p = plusPtr p 20
    p'SANE_Option_Descriptor'size :: Ptr (C'SANE_Option_Descriptor) -> Ptr (C'SANE_Int)
    p'SANE_Option_Descriptor'cap p = plusPtr p 24
    p'SANE_Option_Descriptor'cap :: Ptr (C'SANE_Option_Descriptor) -> Ptr (C'SANE_Int)
    p'SANE_Option_Descriptor'constraint_type p = plusPtr p 28
    p'SANE_Option_Descriptor'constraint_type :: Ptr (C'SANE_Option_Descriptor) -> Ptr (C'SANE_Constraint_Type)
    p'SANE_Option_Descriptor'constraint'string_list p = plusPtr p 32
    p'SANE_Option_Descriptor'constraint'string_list :: Ptr (C'SANE_Option_Descriptor) -> Ptr (Ptr C'SANE_String_Const)
    p'SANE_Option_Descriptor'constraint'word_list p = plusPtr p 32
    p'SANE_Option_Descriptor'constraint'word_list :: Ptr (C'SANE_Option_Descriptor) -> Ptr (Ptr C'SANE_Word)
    p'SANE_Option_Descriptor'constraint'range p = plusPtr p 32
    p'SANE_Option_Descriptor'constraint'range :: Ptr (C'SANE_Option_Descriptor) -> Ptr (Ptr C'SANE_Range)
    u'SANE_Option_Descriptor'constraint'string_list :: C'SANE_Option_Descriptor -> Ptr C'SANE_String_Const -> IO C'SANE_Option_Descriptor
    u'SANE_Option_Descriptor'constraint'string_list v vf = alloca $ \p -> do
      poke p v
      pokeByteOff p 32 vf
      vu <- peek p
      return $ v
        {c'SANE_Option_Descriptor'constraint'string_list = c'SANE_Option_Descriptor'constraint'string_list vu}
        {c'SANE_Option_Descriptor'constraint'word_list = c'SANE_Option_Descriptor'constraint'word_list vu}
        {c'SANE_Option_Descriptor'constraint'range = c'SANE_Option_Descriptor'constraint'range vu}
    u'SANE_Option_Descriptor'constraint'word_list :: C'SANE_Option_Descriptor -> Ptr C'SANE_Word -> IO C'SANE_Option_Descriptor
    u'SANE_Option_Descriptor'constraint'word_list v vf = alloca $ \p -> do
      poke p v
      pokeByteOff p 32 vf
      vu <- peek p
      return $ v
        {c'SANE_Option_Descriptor'constraint'string_list = c'SANE_Option_Descriptor'constraint'string_list vu}
        {c'SANE_Option_Descriptor'constraint'word_list = c'SANE_Option_Descriptor'constraint'word_list vu}
        {c'SANE_Option_Descriptor'constraint'range = c'SANE_Option_Descriptor'constraint'range vu}
    u'SANE_Option_Descriptor'constraint'range :: C'SANE_Option_Descriptor -> Ptr C'SANE_Range -> IO C'SANE_Option_Descriptor
    u'SANE_Option_Descriptor'constraint'range v vf = alloca $ \p -> do
      poke p v
      pokeByteOff p 32 vf
      vu <- peek p
      return $ v
        {c'SANE_Option_Descriptor'constraint'string_list = c'SANE_Option_Descriptor'constraint'string_list vu}
        {c'SANE_Option_Descriptor'constraint'word_list = c'SANE_Option_Descriptor'constraint'word_list vu}
        {c'SANE_Option_Descriptor'constraint'range = c'SANE_Option_Descriptor'constraint'range vu}
    instance Storable C'SANE_Option_Descriptor where
      sizeOf _ = 36
      alignment _ = 4
      peek p = do
        v0 <- peekByteOff p 0
        v1 <- peekByteOff p 4
        v2 <- peekByteOff p 8
        v3 <- peekByteOff p 12
        v4 <- peekByteOff p 16
        v5 <- peekByteOff p 20
        v6 <- peekByteOff p 24
        v7 <- peekByteOff p 28
        v8 <- peekByteOff p 32
        v9 <- peekByteOff p 32
        v10 <- peekByteOff p 32
        return $ C'SANE_Option_Descriptor v0 v1 v2 v3 v4 v5 v6 v7 v8 v9 v10
      poke p (C'SANE_Option_Descriptor v0 v1 v2 v3 v4 v5 v6 v7 v8 v9 v10) = do
        pokeByteOff p 0 v0
        pokeByteOff p 4 v1
        pokeByteOff p 8 v2
        pokeByteOff p 12 v3
        pokeByteOff p 16 v4
        pokeByteOff p 20 v5
        pokeByteOff p 24 v6
        pokeByteOff p 28 v7
        pokeByteOff p 32 v8
        pokeByteOff p 32 v9
        pokeByteOff p 32 v10
        return ()

    {-# LINE 129 "Bindings/SANE.hsc" #-}

    type C'SANE_Action = CUInt

    {-# LINE 131 "Bindings/SANE.hsc" #-}
    c'SANE_ACTION_GET_VALUE = 0
    c'SANE_ACTION_GET_VALUE :: (Num a) => a

    {-# LINE 132 "Bindings/SANE.hsc" #-}
    c'SANE_ACTION_SET_VALUE = 1
    c'SANE_ACTION_SET_VALUE :: (Num a) => a

    {-# LINE 133 "Bindings/SANE.hsc" #-}
    c'SANE_ACTION_SET_AUTO = 2
    c'SANE_ACTION_SET_AUTO :: (Num a) => a

    {-# LINE 134 "Bindings/SANE.hsc" #-}

    type C'SANE_Frame = CUInt

    {-# LINE 136 "Bindings/SANE.hsc" #-}
    c'SANE_FRAME_GRAY = 0
    c'SANE_FRAME_GRAY :: (Num a) => a

    {-# LINE 137 "Bindings/SANE.hsc" #-}
    c'SANE_FRAME_RGB = 1
    c'SANE_FRAME_RGB :: (Num a) => a

    {-# LINE 138 "Bindings/SANE.hsc" #-}
    c'SANE_FRAME_RED = 2
    c'SANE_FRAME_RED :: (Num a) => a

    {-# LINE 139 "Bindings/SANE.hsc" #-}
    c'SANE_FRAME_GREEN = 3
    c'SANE_FRAME_GREEN :: (Num a) => a

    {-# LINE 140 "Bindings/SANE.hsc" #-}
    c'SANE_FRAME_BLUE = 4
    c'SANE_FRAME_BLUE :: (Num a) => a

    {-# LINE 141 "Bindings/SANE.hsc" #-}

    {-# LINE 143 "Bindings/SANE.hsc" #-}

    {-# LINE 144 "Bindings/SANE.hsc" #-}

    {-# LINE 145 "Bindings/SANE.hsc" #-}

    {-# LINE 146 "Bindings/SANE.hsc" #-}

    {-# LINE 147 "Bindings/SANE.hsc" #-}

    {-# LINE 148 "Bindings/SANE.hsc" #-}

    {-# LINE 149 "Bindings/SANE.hsc" #-}
    data C'SANE_Parameters = C'SANE_Parameters{
      c'SANE_Parameters'format :: C'SANE_Frame,
      c'SANE_Parameters'last_frame :: C'SANE_Bool,
      c'SANE_Parameters'bytes_per_line :: C'SANE_Int,
      c'SANE_Parameters'pixels_per_line :: C'SANE_Int,
      c'SANE_Parameters'lines :: C'SANE_Int,
      c'SANE_Parameters'depth :: C'SANE_Int
    } deriving (Eq,Show)
    p'SANE_Parameters'format p = plusPtr p 0
    p'SANE_Parameters'format :: Ptr (C'SANE_Parameters) -> Ptr (C'SANE_Frame)
    p'SANE_Parameters'last_frame p = plusPtr p 4
    p'SANE_Parameters'last_frame :: Ptr (C'SANE_Parameters) -> Ptr (C'SANE_Bool)
    p'SANE_Parameters'bytes_per_line p = plusPtr p 8
    p'SANE_Parameters'bytes_per_line :: Ptr (C'SANE_Parameters) -> Ptr (C'SANE_Int)
    p'SANE_Parameters'pixels_per_line p = plusPtr p 12
    p'SANE_Parameters'pixels_per_line :: Ptr (C'SANE_Parameters) -> Ptr (C'SANE_Int)
    p'SANE_Parameters'lines p = plusPtr p 16
    p'SANE_Parameters'lines :: Ptr (C'SANE_Parameters) -> Ptr (C'SANE_Int)
    p'SANE_Parameters'depth p = plusPtr p 20
    p'SANE_Parameters'depth :: Ptr (C'SANE_Parameters) -> Ptr (C'SANE_Int)
    instance Storable C'SANE_Parameters where
      sizeOf _ = 24
      alignment _ = 4
      peek p = do
        v0 <- peekByteOff p 0
        v1 <- peekByteOff p 4
        v2 <- peekByteOff p 8
        v3 <- peekByteOff p 12
        v4 <- peekByteOff p 16
        v5 <- peekByteOff p 20
        return $ C'SANE_Parameters v0 v1 v2 v3 v4 v5
      poke p (C'SANE_Parameters v0 v1 v2 v3 v4 v5) = do
        pokeByteOff p 0 v0
        pokeByteOff p 4 v1
        pokeByteOff p 8 v2
        pokeByteOff p 12 v3
        pokeByteOff p 16 v4
        pokeByteOff p 20 v5
        return ()

    {-# LINE 150 "Bindings/SANE.hsc" #-}

    data C'SANE_Auth_Data = C'SANE_Auth_Data

    {-# LINE 152 "Bindings/SANE.hsc" #-}

    c'SANE_MAX_USERNAME_LEN = 128
    c'SANE_MAX_USERNAME_LEN :: (Num a) => a

    {-# LINE 154 "Bindings/SANE.hsc" #-}
    c'SANE_MAX_PASSWORD_LEN = 128
    c'SANE_MAX_PASSWORD_LEN :: (Num a) => a

    {-# LINE 155 "Bindings/SANE.hsc" #-}

    type C'SANE_Auth_Callback = FunPtr (C'SANE_String_Const -> Ptr C'SANE_Char -> Ptr C'SANE_Char -> IO ())
    foreign import ccall "wrapper" mk'SANE_Auth_Callback
      :: (C'SANE_String_Const -> Ptr C'SANE_Char -> Ptr C'SANE_Char -> IO ()) -> IO C'SANE_Auth_Callback
    foreign import ccall "dynamic" mK'SANE_Auth_Callback
      :: C'SANE_Auth_Callback -> (C'SANE_String_Const -> Ptr C'SANE_Char -> Ptr C'SANE_Char -> IO ())

    {-# LINE 157 "Bindings/SANE.hsc" #-}

    foreign import ccall "sane_init" c'sane_init
      :: Ptr C'SANE_Int -> C'SANE_Auth_Callback -> IO C'SANE_Status
    foreign import ccall "&sane_init" p'sane_init
      :: FunPtr (Ptr C'SANE_Int -> C'SANE_Auth_Callback -> IO C'SANE_Status)

    {-# LINE 159 "Bindings/SANE.hsc" #-}
    foreign import ccall "sane_exit" c'sane_exit
      :: IO ()
    foreign import ccall "&sane_exit" p'sane_exit
      :: FunPtr (IO ())

    {-# LINE 160 "Bindings/SANE.hsc" #-}
    foreign import ccall "sane_get_devices" c'sane_get_devices
      :: Ptr (Ptr (Ptr C'SANE_Device)) -> C'SANE_Bool -> IO C'SANE_Status
    foreign import ccall "&sane_get_devices" p'sane_get_devices
      :: FunPtr (Ptr (Ptr (Ptr C'SANE_Device)) -> C'SANE_Bool -> IO C'SANE_Status)

    {-# LINE 161 "Bindings/SANE.hsc" #-}
    foreign import ccall "sane_open" c'sane_open
      :: C'SANE_String_Const -> Ptr C'SANE_Handle -> IO C'SANE_Status
    foreign import ccall "&sane_open" p'sane_open
      :: FunPtr (C'SANE_String_Const -> Ptr C'SANE_Handle -> IO C'SANE_Status)

    {-# LINE 162 "Bindings/SANE.hsc" #-}
    foreign import ccall "sane_close" c'sane_close
      :: C'SANE_Handle -> IO ()
    foreign import ccall "&sane_close" p'sane_close
      :: FunPtr (C'SANE_Handle -> IO ())

    {-# LINE 163 "Bindings/SANE.hsc" #-}
    foreign import ccall "sane_get_option_descriptor" c'sane_get_option_descriptor
      :: C'SANE_Handle -> C'SANE_Int -> IO (Ptr C'SANE_Option_Descriptor)
    foreign import ccall "&sane_get_option_descriptor" p'sane_get_option_descriptor
      :: FunPtr (C'SANE_Handle -> C'SANE_Int -> IO (Ptr C'SANE_Option_Descriptor))

    {-# LINE 164 "Bindings/SANE.hsc" #-}
    foreign import ccall "sane_control_option" c'sane_control_option
      :: C'SANE_Handle -> C'SANE_Int -> C'SANE_Action -> Ptr () -> Ptr C'SANE_Int -> IO C'SANE_Status
    foreign import ccall "&sane_control_option" p'sane_control_option
      :: FunPtr (C'SANE_Handle -> C'SANE_Int -> C'SANE_Action -> Ptr () -> Ptr C'SANE_Int -> IO C'SANE_Status)

    {-# LINE 165 "Bindings/SANE.hsc" #-}
    foreign import ccall "sane_get_parameters" c'sane_get_parameters
      :: C'SANE_Handle -> Ptr C'SANE_Parameters -> IO C'SANE_Status
    foreign import ccall "&sane_get_parameters" p'sane_get_parameters
      :: FunPtr (C'SANE_Handle -> Ptr C'SANE_Parameters -> IO C'SANE_Status)

    {-# LINE 166 "Bindings/SANE.hsc" #-}
    foreign import ccall "sane_start" c'sane_start
      :: C'SANE_Handle -> IO C'SANE_Status
    foreign import ccall "&sane_start" p'sane_start
      :: FunPtr (C'SANE_Handle -> IO C'SANE_Status)

    {-# LINE 167 "Bindings/SANE.hsc" #-}
    foreign import ccall "sane_read" c'sane_read
      :: C'SANE_Handle -> Ptr C'SANE_Byte -> C'SANE_Int -> Ptr C'SANE_Int -> IO C'SANE_Status
    foreign import ccall "&sane_read" p'sane_read
      :: FunPtr (C'SANE_Handle -> Ptr C'SANE_Byte -> C'SANE_Int -> Ptr C'SANE_Int -> IO C'SANE_Status)

    {-# LINE 168 "Bindings/SANE.hsc" #-}
    foreign import ccall "sane_cancel" c'sane_cancel
      :: C'SANE_Handle -> IO ()
    foreign import ccall "&sane_cancel" p'sane_cancel
      :: FunPtr (C'SANE_Handle -> IO ())

    {-# LINE 169 "Bindings/SANE.hsc" #-}
    foreign import ccall "sane_set_io_mode" c'sane_set_io_mode
      :: C'SANE_Handle -> C'SANE_Bool -> IO C'SANE_Status
    foreign import ccall "&sane_set_io_mode" p'sane_set_io_mode
      :: FunPtr (C'SANE_Handle -> C'SANE_Bool -> IO C'SANE_Status)

    {-# LINE 170 "Bindings/SANE.hsc" #-}
    foreign import ccall "sane_get_select_fd" c'sane_get_select_fd
      :: C'SANE_Handle -> Ptr C'SANE_Int -> IO C'SANE_Status
    foreign import ccall "&sane_get_select_fd" p'sane_get_select_fd
      :: FunPtr (C'SANE_Handle -> Ptr C'SANE_Int -> IO C'SANE_Status)

    {-# LINE 171 "Bindings/SANE.hsc" #-}
    foreign import ccall "sane_strstatus" c'sane_strstatus
      :: C'SANE_Status -> IO C'SANE_String_Const
    foreign import ccall "&sane_strstatus" p'sane_strstatus
      :: FunPtr (C'SANE_Status -> IO C'SANE_String_Const)

    {-# LINE 172 "Bindings/SANE.hsc" #-}