module Data.ABC.Internal.GiaAig (
Gia_AigMap_t
, withGiaAigMap
, aigDupGiaLit
, giaManToAig
) where
import Control.Exception (bracket)
import Foreign
import Foreign.C
import Data.ABC.Internal.GIA
import Data.ABC.Internal.AIG
giaManToAig :: (Gia_Man_t) -> (CInt) -> IO ((Aig_Man_t))
giaManToAig a1 a2 =
let {a1' = id a1} in
let {a2' = id a2} in
giaManToAig'_ a1' a2' >>= \res ->
let {res' = id res} in
return (res')
type Gia_AigMap_t = Ptr Aig_Obj_t
newGiaAigMap :: Gia_Man_t -> IO Gia_AigMap_t
newGiaAigMap m = do
n <- giaManObjNum m
newArray (replicate (fromIntegral n) nullPtr)
withGiaAigMap :: Gia_Man_t -> (Gia_AigMap_t -> IO a) -> IO a
withGiaAigMap m = bracket (newGiaAigMap m) free
aigDupGiaLit :: Aig_Man_t -> Gia_AigMap_t -> Gia_Man_t -> GiaLit -> IO Aig_Obj_t
aigDupGiaLit aig m gia l = aigDupGiaLit' aig m gia (unGiaLit l)
foreign import ccall unsafe "AbcBridge_Aig_DupGiaLit"
aigDupGiaLit' :: Ptr Aig_Man_t_ -> Gia_AigMap_t -> Gia_Man_t -> CInt -> IO Aig_Obj_t
foreign import ccall safe "Data/ABC/Internal/GiaAig.chs.h Gia_ManToAig"
giaManToAig'_ :: ((Gia_Man_t) -> (CInt -> (IO (Aig_Man_t))))