Plan 9 from Bell Labs’s /usr/web/sources/contrib/fernan/nhc98/src/prelude/Binary/CopyBin_.hs

Copyright © 2021 Plan 9 Foundation.
Distributed under the MIT License.
Download the Plan 9 distribution.


module NHC.Binary
  ( copyBin
  ) where

import NHC.GreenCard
import BinHandle   ({-type-}BinHandle(..))
import BinLocation ({-type-}BinLocation)
import OpenBin     (openBin)
import SizeBin     (sizeBin)

    -- %-#include <stdio.h>

copyBin :: BinHandle -> BinLocation -> IO BinHandle
copyBin sbh loc =
  openBin loc >>= \dbh->
  sizeBin sbh >>= \nbytes->
  copyBinAux sbh dbh nbytes >>
  return dbh

foreign import ccall hs_copyBinAux :: ForeignObj -> ForeignObj -> Int -> IO ()

copyBinAux :: BinHandle -> BinHandle -> Int -> IO ()
copyBinAux (BH sbh) (BH dbh) bytes =
  do res1 <- hs_copyBinAux sbh dbh bytes
     return res1



Bell Labs OSI certified Powered by Plan 9

(Return to Plan 9 Home Page)

Copyright © 2021 Plan 9 Foundation. All Rights Reserved.
Comments to [email protected].