{-# LINE 1 "Debian/Dpkg/Types.hsc" #-}
{-
{-# LINE 2 "Debian/Dpkg/Types.hsc" #-}
 Types.hsc: Haskell bindings to libdpkg
   Copyright (C) 2011 Clint Adams

 This program is free software; you can redistribute it and/or modify
 it under the terms of the GNU General Public License as published by
 the Free Software Foundation; either version 3 of the License, or
 (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 General Public License for more details.

 You should have received a copy of the GNU General Public License
 along with this program; if not, write to the Free Software
 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA
-}

{-# LANGUAGE CPP, ForeignFunctionInterface #-}


{-# LINE 23 "Debian/Dpkg/Types.hsc" #-}

module Debian.Dpkg.Types 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 26 "Debian/Dpkg/Types.hsc" #-}

import Data.ByteString as BS


{-# LINE 30 "Debian/Dpkg/Types.hsc" #-}

{-# LINE 31 "Debian/Dpkg/Types.hsc" #-}


{-# LINE 33 "Debian/Dpkg/Types.hsc" #-}

{-# LINE 34 "Debian/Dpkg/Types.hsc" #-}

{-# LINE 35 "Debian/Dpkg/Types.hsc" #-}

{-# LINE 36 "Debian/Dpkg/Types.hsc" #-}
data C'versionrevision = C'versionrevision{
  c'versionrevision'epoch :: CInt,
  c'versionrevision'version :: CString,
  c'versionrevision'revision :: CString
} deriving (Eq,Show)
p'versionrevision'epoch p = plusPtr p 0
p'versionrevision'epoch :: Ptr (C'versionrevision) -> Ptr (CInt)
p'versionrevision'version p = plusPtr p 4
p'versionrevision'version :: Ptr (C'versionrevision) -> Ptr (CString)
p'versionrevision'revision p = plusPtr p 8
p'versionrevision'revision :: Ptr (C'versionrevision) -> Ptr (CString)
instance Storable C'versionrevision where
  sizeOf _ = 12
  alignment = sizeOf
  peek p = do
    v0 <- peekByteOff p 0
    v1 <- peekByteOff p 4
    v2 <- peekByteOff p 8
    return $ C'versionrevision v0 v1 v2
  poke p (C'versionrevision v0 v1 v2) = do
    pokeByteOff p 0 v0
    pokeByteOff p 4 v1
    pokeByteOff p 8 v2
    return ()

{-# LINE 37 "Debian/Dpkg/Types.hsc" #-}


{-# LINE 39 "Debian/Dpkg/Types.hsc" #-}

{-# LINE 40 "Debian/Dpkg/Types.hsc" #-}

{-# LINE 41 "Debian/Dpkg/Types.hsc" #-}

{-# LINE 42 "Debian/Dpkg/Types.hsc" #-}

{-# LINE 43 "Debian/Dpkg/Types.hsc" #-}

{-# LINE 44 "Debian/Dpkg/Types.hsc" #-}
data C'filedetails = C'filedetails{
  c'filedetails'next :: Ptr C'filedetails,
  c'filedetails'name :: CString,
  c'filedetails'msdosname :: CString,
  c'filedetails'size :: CString,
  c'filedetails'md5sum :: CString
} deriving (Eq,Show)
p'filedetails'next p = plusPtr p 0
p'filedetails'next :: Ptr (C'filedetails) -> Ptr (Ptr C'filedetails)
p'filedetails'name p = plusPtr p 4
p'filedetails'name :: Ptr (C'filedetails) -> Ptr (CString)
p'filedetails'msdosname p = plusPtr p 8
p'filedetails'msdosname :: Ptr (C'filedetails) -> Ptr (CString)
p'filedetails'size p = plusPtr p 12
p'filedetails'size :: Ptr (C'filedetails) -> Ptr (CString)
p'filedetails'md5sum p = plusPtr p 16
p'filedetails'md5sum :: Ptr (C'filedetails) -> Ptr (CString)
instance Storable C'filedetails where
  sizeOf _ = 20
  alignment = sizeOf
  peek p = do
    v0 <- peekByteOff p 0
    v1 <- peekByteOff p 4
    v2 <- peekByteOff p 8
    v3 <- peekByteOff p 12
    v4 <- peekByteOff p 16
    return $ C'filedetails v0 v1 v2 v3 v4
  poke p (C'filedetails v0 v1 v2 v3 v4) = do
    pokeByteOff p 0 v0
    pokeByteOff p 4 v1
    pokeByteOff p 8 v2
    pokeByteOff p 12 v3
    pokeByteOff p 16 v4
    return ()

{-# LINE 45 "Debian/Dpkg/Types.hsc" #-}


{-# LINE 47 "Debian/Dpkg/Types.hsc" #-}
data C'pkgbin = C'pkgbin{
} deriving (Eq,Show)
instance Storable C'pkgbin where
  sizeOf _ = 60
  alignment = sizeOf
  peek p = do
    return $ C'pkgbin
  poke p (C'pkgbin) = do
    return ()

{-# LINE 48 "Debian/Dpkg/Types.hsc" #-}

data C'perpackagestate = C'perpackagestate

{-# LINE 50 "Debian/Dpkg/Types.hsc" #-}

type C'pkgwant = CUInt

{-# LINE 52 "Debian/Dpkg/Types.hsc" #-}
type C'pkgeflag = CUInt

{-# LINE 53 "Debian/Dpkg/Types.hsc" #-}
type C'pkgstatus = CUInt

{-# LINE 54 "Debian/Dpkg/Types.hsc" #-}
type C'pkgpriority = CInt

{-# LINE 55 "Debian/Dpkg/Types.hsc" #-}

data C'pkgiterator = C'pkgiterator

{-# LINE 57 "Debian/Dpkg/Types.hsc" #-}


{-# LINE 59 "Debian/Dpkg/Types.hsc" #-}

{-# LINE 60 "Debian/Dpkg/Types.hsc" #-}

{-# LINE 61 "Debian/Dpkg/Types.hsc" #-}

{-# LINE 62 "Debian/Dpkg/Types.hsc" #-}

{-# LINE 63 "Debian/Dpkg/Types.hsc" #-}

{-# LINE 64 "Debian/Dpkg/Types.hsc" #-}

{-# LINE 65 "Debian/Dpkg/Types.hsc" #-}

{-# LINE 66 "Debian/Dpkg/Types.hsc" #-}

{-# LINE 67 "Debian/Dpkg/Types.hsc" #-}

{-# LINE 68 "Debian/Dpkg/Types.hsc" #-}

{-# LINE 69 "Debian/Dpkg/Types.hsc" #-}

{-# LINE 70 "Debian/Dpkg/Types.hsc" #-}

{-# LINE 71 "Debian/Dpkg/Types.hsc" #-}

{-# LINE 72 "Debian/Dpkg/Types.hsc" #-}
data C'pkginfo = C'pkginfo{
  c'pkginfo'next :: Ptr C'pkginfo,
  c'pkginfo'name :: CString,
  c'pkginfo'want :: C'pkgwant,
  c'pkginfo'eflag :: C'pkgeflag,
  c'pkginfo'status :: C'pkgstatus,
  c'pkginfo'priority :: C'pkgpriority,
  c'pkginfo'otherpriority :: CString,
  c'pkginfo'section :: CString,
  c'pkginfo'configversion :: C'versionrevision,
  c'pkginfo'files :: Ptr C'filedetails,
  c'pkginfo'installed :: C'pkgbin,
  c'pkginfo'available :: C'pkgbin,
  c'pkginfo'clientdata :: Ptr C'perpackagestate
} deriving (Eq,Show)
p'pkginfo'next p = plusPtr p 0
p'pkginfo'next :: Ptr (C'pkginfo) -> Ptr (Ptr C'pkginfo)
p'pkginfo'name p = plusPtr p 4
p'pkginfo'name :: Ptr (C'pkginfo) -> Ptr (CString)
p'pkginfo'want p = plusPtr p 8
p'pkginfo'want :: Ptr (C'pkginfo) -> Ptr (C'pkgwant)
p'pkginfo'eflag p = plusPtr p 12
p'pkginfo'eflag :: Ptr (C'pkginfo) -> Ptr (C'pkgeflag)
p'pkginfo'status p = plusPtr p 16
p'pkginfo'status :: Ptr (C'pkginfo) -> Ptr (C'pkgstatus)
p'pkginfo'priority p = plusPtr p 20
p'pkginfo'priority :: Ptr (C'pkginfo) -> Ptr (C'pkgpriority)
p'pkginfo'otherpriority p = plusPtr p 24
p'pkginfo'otherpriority :: Ptr (C'pkginfo) -> Ptr (CString)
p'pkginfo'section p = plusPtr p 28
p'pkginfo'section :: Ptr (C'pkginfo) -> Ptr (CString)
p'pkginfo'configversion p = plusPtr p 32
p'pkginfo'configversion :: Ptr (C'pkginfo) -> Ptr (C'versionrevision)
p'pkginfo'files p = plusPtr p 44
p'pkginfo'files :: Ptr (C'pkginfo) -> Ptr (Ptr C'filedetails)
p'pkginfo'installed p = plusPtr p 48
p'pkginfo'installed :: Ptr (C'pkginfo) -> Ptr (C'pkgbin)
p'pkginfo'available p = plusPtr p 108
p'pkginfo'available :: Ptr (C'pkginfo) -> Ptr (C'pkgbin)
p'pkginfo'clientdata p = plusPtr p 168
p'pkginfo'clientdata :: Ptr (C'pkginfo) -> Ptr (Ptr C'perpackagestate)
instance Storable C'pkginfo where
  sizeOf _ = 188
  alignment = sizeOf
  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 44
    v10 <- peekByteOff p 48
    v11 <- peekByteOff p 108
    v12 <- peekByteOff p 168
    return $ C'pkginfo v0 v1 v2 v3 v4 v5 v6 v7 v8 v9 v10 v11 v12
  poke p (C'pkginfo v0 v1 v2 v3 v4 v5 v6 v7 v8 v9 v10 v11 v12) = 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 44 v9
    pokeByteOff p 48 v10
    pokeByteOff p 108 v11
    pokeByteOff p 168 v12
    return ()

{-# LINE 73 "Debian/Dpkg/Types.hsc" #-}

type C'dpkg_msg_type = CUInt

{-# LINE 75 "Debian/Dpkg/Types.hsc" #-}


{-# LINE 77 "Debian/Dpkg/Types.hsc" #-}

{-# LINE 78 "Debian/Dpkg/Types.hsc" #-}

{-# LINE 79 "Debian/Dpkg/Types.hsc" #-}
data C'dpkg_error = C'dpkg_error{
  c'dpkg_error'type :: C'dpkg_msg_type,
  c'dpkg_error'str :: CString
} deriving (Eq,Show)
p'dpkg_error'type p = plusPtr p 0
p'dpkg_error'type :: Ptr (C'dpkg_error) -> Ptr (C'dpkg_msg_type)
p'dpkg_error'str p = plusPtr p 4
p'dpkg_error'str :: Ptr (C'dpkg_error) -> Ptr (CString)
instance Storable C'dpkg_error where
  sizeOf _ = 8
  alignment = sizeOf
  peek p = do
    v0 <- peekByteOff p 0
    v1 <- peekByteOff p 4
    return $ C'dpkg_error v0 v1
  poke p (C'dpkg_error v0 v1) = do
    pokeByteOff p 0 v0
    pokeByteOff p 4 v1
    return ()

{-# LINE 80 "Debian/Dpkg/Types.hsc" #-}