~singpolyma/tokyocabinet-haskell

ref: 092c4e9f28ad06b2bf8bea2b55229493f6aef3a8 tokyocabinet-haskell/Database/TokyoCabinet/List/C.hs -rw-r--r-- 2.8 KiB View raw
092c4e9fStephen Paul Weber Merge branch 'master' of https://github.com/athanclark/tokyocabinet-haskell 3 months ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
{-# INCLUDE <tcutil.h> #-}
{-# LANGUAGE ForeignFunctionInterface, EmptyDataDecls #-}
module Database.TokyoCabinet.List.C where

import Data.Word

import Foreign.Ptr
import Foreign.C.Types
import Foreign.C.String
import Foreign.ForeignPtr

data List a = List { unTCList :: !(ForeignPtr LIST) }

data LIST

foreign import ccall safe "tclistnew"
  c_tclistnew :: IO (Ptr LIST)

foreign import ccall safe "tclistnew2"
  c_tclistnew2 :: CInt -> IO (Ptr LIST)

foreign import ccall safe "tclistdup"
  c_tclistdup :: Ptr LIST -> IO (Ptr LIST)

foreign import ccall safe "tclistdel"
  c_tclistdel :: Ptr LIST -> IO ()

foreign import ccall "&tclistdel"
  tclistFinalizer :: FunPtr (Ptr LIST -> IO ())

foreign import ccall safe "tclistnum"
  c_tclistnum :: Ptr LIST -> IO CInt

foreign import ccall safe "tclistval"
  c_tclistval :: Ptr LIST -> CInt -> Ptr CInt -> IO (Ptr Word8)

foreign import ccall safe "tclistval2"
  c_tclistval2 :: Ptr LIST -> CInt -> IO CString

foreign import ccall safe "tclistpush"
  c_tclistpush :: Ptr LIST -> Ptr Word8 -> CInt -> IO ()

foreign import ccall safe "tclistpush2"
  c_tclistpush2 :: Ptr LIST -> CString -> IO ()

foreign import ccall safe "tclistpop"
  c_tclistpop :: Ptr LIST -> Ptr CInt -> IO (Ptr Word8)

foreign import ccall safe "tclistpop2"
  c_tclistpop2 :: Ptr LIST -> IO CString

foreign import ccall safe "tclistunshift"
  c_tclistunshift :: Ptr LIST -> Ptr Word8 -> CInt -> IO ()

foreign import ccall safe "tclistunshift2"
  c_tclistunshift2 :: Ptr LIST -> Ptr Word8 -> IO ()

foreign import ccall safe "tclistshift"
  c_tclistshift :: Ptr LIST -> Ptr CInt -> IO (Ptr Word8)

foreign import ccall safe "tclistshift2"
  c_tclistshift2 :: Ptr LIST -> IO CString

foreign import ccall safe "tclistinsert"
  c_tclistinsert :: Ptr LIST -> CInt -> Ptr Word8 -> CInt -> IO ()

foreign import ccall safe "tclistinsert2"
  c_tclistinsert2 :: Ptr LIST -> CInt -> Ptr Word8 -> IO ()

foreign import ccall safe "tclistremove"
  c_tclistremove :: Ptr LIST -> CInt -> Ptr CInt -> IO (Ptr Word8)

foreign import ccall safe "tclistremove2"
  c_tclistremove2 :: Ptr LIST -> CInt -> IO CString

foreign import ccall safe "tclistover"
  c_tclistover :: Ptr LIST -> CInt -> Ptr Word8 -> CInt -> IO ()

foreign import ccall safe "tclistover2"
  c_tclistover2 :: Ptr LIST -> CInt -> CString -> IO ()

foreign import ccall safe "tclistsort"
  c_tclistsort :: Ptr LIST -> IO ()

foreign import ccall safe "tclistlsearch"
  c_tclistlsearch :: Ptr LIST -> Ptr Word8 -> CInt -> IO CInt

foreign import ccall safe "tclistbsearch"
  c_tclistbsearch :: Ptr LIST -> Ptr Word8 -> CInt -> IO CInt

foreign import ccall safe "tclistclear"
  c_tclistclear :: Ptr LIST -> IO ()

foreign import ccall safe "tclistdump"
  c_tclistdump :: Ptr LIST -> Ptr CInt -> IO (Ptr Word8)

foreign import ccall safe "tclistload"
  c_tclistload :: Ptr Word8 -> CInt -> IO (Ptr LIST)