File: LibZip.hsc

package info (click to toggle)
haskell-bindings-libzip 0.10-2
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 76 kB
  • sloc: haskell: 3; makefile: 2
file content (222 lines) | stat: -rw-r--r-- 7,401 bytes parent folder | download
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
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
#include <bindings.dsl.h>
#include <zip.h>

-- | This module provides automatic low-level bindings to @libzip@
-- library, version 0.10. See also:
--
--   * @libzip@ documention: <http://nih.at/libzip/libzip.html> and @zip.h@
--
--   * @bindings-DSL@ documentation:
--     <http://bitbucket.org/mauricio/bindings-dsl/wiki/Home>
--
-- Higher-level interface is provided by a separate LibZip package:
--
--   * <http://hackage.haskell.org/package/LibZip>
--


module Bindings.LibZip where
#strict_import

#opaque_t zip
#opaque_t zip_file
#opaque_t zip_source

-- flags for zip_open

#num ZIP_CREATE
#num ZIP_EXCL
#num ZIP_CHECKCONS

-- flags for zip_name_locate, zip_fopen, zip_stat, ...

#num ZIP_FL_NOCASE
#num ZIP_FL_NODIR
#num ZIP_FL_COMPRESSED
#num ZIP_FL_UNCHANGED
#num ZIP_FL_RECOMPRESS
#num ZIP_FL_ENCRYPTED

-- archive global flags flags

#num ZIP_AFL_TORRENT
#num ZIP_AFL_RDONLY

-- flags for compression and encryption sources

#num ZIP_CODEC_ENCODE

-- libzip error codes

#num ZIP_ER_OK
#num ZIP_ER_MULTIDISK
#num ZIP_ER_RENAME
#num ZIP_ER_CLOSE
#num ZIP_ER_SEEK
#num ZIP_ER_READ
#num ZIP_ER_WRITE
#num ZIP_ER_CRC
#num ZIP_ER_ZIPCLOSED
#num ZIP_ER_NOENT
#num ZIP_ER_EXISTS
#num ZIP_ER_OPEN
#num ZIP_ER_TMPOPEN
#num ZIP_ER_ZLIB
#num ZIP_ER_MEMORY
#num ZIP_ER_CHANGED
#num ZIP_ER_COMPNOTSUPP
#num ZIP_ER_EOF
#num ZIP_ER_INVAL
#num ZIP_ER_NOZIP
#num ZIP_ER_INTERNAL
#num ZIP_ER_INCONS
#num ZIP_ER_REMOVE
#num ZIP_ER_DELETED
#num ZIP_ER_ENCRNOTSUPP
#num ZIP_ER_RDONLY
#num ZIP_ER_NOPASSWD
#num ZIP_ER_WRONGPASSWD

-- type of system error value

#num ZIP_ET_NONE
#num ZIP_ET_SYS
#num ZIP_ET_ZLIB

-- compression methods

#num ZIP_CM_DEFAULT
#num ZIP_CM_STORE
#num ZIP_CM_SHRINK
#num ZIP_CM_REDUCE_1
#num ZIP_CM_REDUCE_2
#num ZIP_CM_REDUCE_3
#num ZIP_CM_REDUCE_4
#num ZIP_CM_IMPLODE
#num ZIP_CM_DEFLATE
#num ZIP_CM_DEFLATE64
#num ZIP_CM_PKWARE_IMPLODE
#num ZIP_CM_BZIP2
#num ZIP_CM_LZMA
#num ZIP_CM_TERSE
#num ZIP_CM_LZ77
#num ZIP_CM_WAVPACK
#num ZIP_CM_PPMD

-- encryption methods

#num ZIP_EM_NONE
#num ZIP_EM_TRAD_PKWARE
#num ZIP_EM_UNKNOWN

#integral_t enum zip_source_cmd
#num ZIP_SOURCE_OPEN
#num ZIP_SOURCE_READ
#num ZIP_SOURCE_CLOSE
#num ZIP_SOURCE_STAT
#num ZIP_SOURCE_ERROR
#num ZIP_SOURCE_FREE

-- typedef zip_int64_t (*zip_source_callback)(void *, void *, zip_uint64_t, enum zip_source_cmd);
#callback zip_source_callback , Ptr () -> Ptr () -> CULLong -> <zip_source_cmd> -> IO CULLong

#num ZIP_SOURCE_ERR_LOWER

#num ZIP_STAT_NAME
#num ZIP_STAT_INDEX
#num ZIP_STAT_SIZE
#num ZIP_STAT_COMP_SIZE
#num ZIP_STAT_MTIME
#num ZIP_STAT_CRC
#num ZIP_STAT_COMP_METHOD
#num ZIP_STAT_ENCRYPTION_METHOD
#num ZIP_STAT_FLAGS

#opaque_t time_t

-- struct zip_stat {
--     zip_uint64_t valid;                 /* which fields have valid values */
--     const char *name;                   /* name of the file */
--     zip_uint64_t index;                 /* index within archive */
--     zip_uint64_t size;                  /* size of file (uncompressed) */
--     zip_uint64_t comp_size;             /* size of file (compressed) */
--     time_t mtime;                       /* modification time */
--     zip_uint32_t crc;                   /* crc of file data */
--     zip_uint16_t comp_method;           /* compression method used */
--     zip_uint16_t encryption_method;     /* encryption method used */
--     zip_uint32_t flags;                 /* reserved for future use */
-- };
#starttype struct zip_stat
#field valid, CULLong
#field name, Ptr CChar
#field index, CULLong
#field size, CULLong
#field comp_size, CULLong
#field mtime, CTime
#field crc, CUInt
#field comp_method, CUShort
#field encryption_method, CUShort
#field flags, CUInt
#stoptype

-- make every declaration one-line, and replace
--    ZIP_EXTERN ->
--    const char * -> CString
--    char * -> Ptr CChar
--    struct foo * -> Ptr <foo>  -- with regexps
--    FILE -> CFile
--    int -> CInt
--    zip_int64_t -> CLLong
--    zip_uint64_t -> CULLong
--    void -> ()
--    zip_source_callback -> <zip_source_callback>
--    foo * -> Ptr foo   -- with regexps
--    regexp-replace "\(.*\)\(zip_[a-z0-9_]+\)(\(.*\));" "#ccall \2 , \3 -> IO (\1)"

#ccall zip_add , Ptr <zip> -> CString -> Ptr <zip_source> -> IO (CLLong)
#ccall zip_add_dir , Ptr <zip> -> CString -> IO (CLLong)
#ccall zip_close , Ptr <zip> -> IO (CInt)
#ccall zip_delete , Ptr <zip> -> CULLong -> IO (CInt)
#ccall zip_error_clear , Ptr <zip> -> IO ()
#ccall zip_error_get , Ptr <zip> -> Ptr CInt -> Ptr CInt -> IO ()
#ccall zip_error_get_sys_type , CInt -> IO (CInt)
#ccall zip_error_to_str , Ptr CChar -> CULLong -> CInt -> CInt -> IO (CInt)
#ccall zip_fclose , Ptr <zip_file> -> IO (CInt)
#ccall zip_fdopen , CInt -> CInt -> Ptr CInt -> IO (Ptr <zip>)
#ccall zip_file_error_clear , Ptr <zip_file> -> IO ()
#ccall zip_file_error_get , Ptr <zip_file> -> Ptr CInt -> Ptr CInt -> IO ()
#ccall zip_file_strerror , Ptr <zip_file> -> IO (CString)
#ccall zip_fopen , Ptr <zip> -> CString -> CInt -> IO (Ptr <zip_file>)
#ccall zip_fopen_encrypted , Ptr <zip> -> CString -> CInt -> CString -> IO (Ptr <zip_file>)
#ccall zip_fopen_index , Ptr <zip> -> CULLong -> CInt -> IO (Ptr <zip_file>)
#ccall zip_fopen_index_encrypted , Ptr <zip> -> CULLong -> CInt -> CString -> IO (Ptr <zip_file>)
#ccall zip_fread , Ptr <zip_file> -> Ptr () -> CULLong -> IO (CLLong)
#ccall zip_get_archive_comment , Ptr <zip> -> Ptr CInt -> CInt -> IO (CString)
#ccall zip_get_archive_flag , Ptr <zip> -> CInt -> CInt -> IO (CInt)
#ccall zip_get_file_comment , Ptr <zip> -> CULLong -> Ptr CInt -> CInt -> IO (CString)
#ccall zip_get_file_extra , Ptr <zip> -> CULLong -> Ptr CInt -> CInt -> IO (CString)
#ccall zip_get_name , Ptr <zip> -> CULLong -> CInt -> IO (CString)
#ccall zip_get_num_entries , Ptr <zip> -> CInt -> IO (CULLong)
#ccall zip_get_num_files , Ptr <zip> -> IO (CInt)
#ccall zip_name_locate , Ptr <zip> -> CString -> CInt -> IO (CInt)
#ccall zip_open , CString -> CInt -> Ptr CInt -> IO (Ptr <zip>)
#ccall zip_rename , Ptr <zip> -> CULLong -> CString -> IO (CInt)
#ccall zip_replace , Ptr <zip> -> CULLong -> Ptr <zip_source> -> IO (CInt)
#ccall zip_set_archive_comment , Ptr <zip> -> CString -> CInt -> IO (CInt)
#ccall zip_set_archive_flag , Ptr <zip> -> CInt -> CInt -> IO (CInt)
#ccall zip_set_default_password , Ptr <zip> -> CString -> IO (CInt)
#ccall zip_set_file_comment , Ptr <zip> -> CULLong -> CString -> CInt -> IO (CInt)
#ccall zip_set_file_extra , Ptr <zip> -> CULLong -> CString -> CInt -> IO (CInt)
#ccall zip_source_buffer , Ptr <zip> -> Ptr () -> CULLong -> CInt -> IO (Ptr <zip_source>)
#ccall zip_source_file , Ptr <zip> -> CString -> CULLong -> CLLong -> IO (Ptr <zip_source>)
#ccall zip_source_filep , Ptr <zip> -> Ptr CFile -> CULLong -> CLLong -> IO (Ptr <zip_source>)
#ccall zip_source_free , Ptr <zip_source> -> IO ()
#ccall zip_source_function , Ptr <zip> -> <zip_source_callback> -> Ptr () -> IO (Ptr <zip_source>)
#ccall zip_source_zip , Ptr <zip> -> Ptr <zip> -> CULLong -> CInt -> CULLong -> CLLong -> IO (Ptr <zip_source>)
#ccall zip_stat , Ptr <zip> -> CString -> CInt -> Ptr <zip_stat> -> IO (CInt)
#ccall zip_stat_index , Ptr <zip> -> CULLong -> CInt -> Ptr <zip_stat> -> IO (CInt)
#ccall zip_stat_init , Ptr <zip_stat> -> IO ()
#ccall zip_strerror , Ptr <zip> -> IO (CString)
#ccall zip_unchange , Ptr <zip> -> CULLong -> IO (CInt)
#ccall zip_unchange_all , Ptr <zip> -> IO (CInt)
#ccall zip_unchange_archive , Ptr <zip> -> IO (CInt)