streaming-commons 0.1.0.0 → 0.1.0.1
raw patch · 5 files changed
+44/−47 lines, 5 files
Files
- Data/Streaming/Text.hs +1/−1
- Data/Streaming/Zlib/Lowlevel.hs +16/−16
- cbits/text-helper.c +10/−10
- cbits/zlib-helper.c +16/−16
- streaming-commons.cabal +1/−4
Data/Streaming/Text.hs view
@@ -97,7 +97,7 @@ #include "text_cbits.h" -foreign import ccall unsafe "_hs_text_stream_decode_decode_utf8_state" c_decode_utf8_with_state+foreign import ccall unsafe "_hs_streaming_commons_decode_utf8_state" c_decode_utf8_with_state :: MutableByteArray# s -> Ptr CSize -> Ptr (Ptr Word8) -> Ptr Word8 -> Ptr CodePoint -> Ptr DecoderState -> IO (Ptr Word8)
Data/Streaming/Zlib/Lowlevel.hs view
@@ -37,10 +37,10 @@ | StrategyFixed deriving (Show,Eq,Ord,Enum) -foreign import ccall unsafe "create_z_stream"+foreign import ccall unsafe "streaming_commons_create_z_stream" zstreamNew :: IO ZStream' -foreign import ccall unsafe "deflate_init2"+foreign import ccall unsafe "streaming_commons_deflate_init2" c_deflateInit2 :: ZStream' -> CInt -> CInt -> CInt -> CInt -> IO () @@ -50,49 +50,49 @@ (fromIntegral memlevel) (fromIntegral $ fromEnum strategy) -foreign import ccall unsafe "inflate_init2"+foreign import ccall unsafe "streaming_commons_inflate_init2" c_inflateInit2 :: ZStream' -> CInt -> IO () inflateInit2 :: ZStream' -> WindowBits -> IO () inflateInit2 zstream wb = c_inflateInit2 zstream (wbToInt wb) -foreign import ccall unsafe "&free_z_stream_inflate"+foreign import ccall unsafe "&streaming_commons_free_z_stream_inflate" c_free_z_stream_inflate :: FunPtr (ZStream' -> IO ()) -foreign import ccall unsafe "&free_z_stream_deflate"+foreign import ccall unsafe "&streaming_commons_free_z_stream_deflate" c_free_z_stream_deflate :: FunPtr (ZStream' -> IO ()) -foreign import ccall unsafe "set_avail_in"+foreign import ccall unsafe "streaming_commons_set_avail_in" c_set_avail_in :: ZStream' -> Ptr CChar -> CUInt -> IO () -foreign import ccall unsafe "set_avail_out"+foreign import ccall unsafe "streaming_commons_set_avail_out" c_set_avail_out :: ZStream' -> Ptr CChar -> CUInt -> IO () -foreign import ccall unsafe "get_avail_out"+foreign import ccall unsafe "streaming_commons_get_avail_out" c_get_avail_out :: ZStream' -> IO CUInt -foreign import ccall unsafe "get_avail_in"+foreign import ccall unsafe "streaming_commons_get_avail_in" c_get_avail_in :: ZStream' -> IO CUInt -foreign import ccall unsafe "get_next_in"+foreign import ccall unsafe "streaming_commons_get_next_in" c_get_next_in :: ZStream' -> IO (Ptr CChar) -foreign import ccall unsafe "call_inflate_noflush"+foreign import ccall unsafe "streaming_commons_call_inflate_noflush" c_call_inflate_noflush :: ZStream' -> IO CInt -foreign import ccall unsafe "call_deflate_noflush"+foreign import ccall unsafe "streaming_commons_call_deflate_noflush" c_call_deflate_noflush :: ZStream' -> IO CInt -foreign import ccall unsafe "call_deflate_finish"+foreign import ccall unsafe "streaming_commons_call_deflate_finish" c_call_deflate_finish :: ZStream' -> IO CInt -foreign import ccall unsafe "call_deflate_flush"+foreign import ccall unsafe "streaming_commons_call_deflate_flush" c_call_deflate_flush :: ZStream' -> IO CInt -foreign import ccall unsafe "deflate_set_dictionary"+foreign import ccall unsafe "streaming_commons_deflate_set_dictionary" c_call_deflate_set_dictionary :: ZStream' -> Ptr CChar -> CUInt -> IO () -foreign import ccall unsafe "inflate_set_dictionary"+foreign import ccall unsafe "streaming_commons_inflate_set_dictionary" c_call_inflate_set_dictionary :: ZStream' -> Ptr CChar -> CUInt -> IO () wbToInt :: WindowBits -> CInt
cbits/text-helper.c view
@@ -11,13 +11,13 @@ #include <stdio.h> #include "text_cbits.h" -void _hs_text_stream_decode_memcpy(void *dest, size_t doff, const void *src, size_t soff,+void _hs_streaming_commons_memcpy(void *dest, size_t doff, const void *src, size_t soff, size_t n) { memcpy(dest + (doff<<1), src + (soff<<1), n<<1); } -int _hs_text_stream_decode_memcmp(const void *a, size_t aoff, const void *b, size_t boff,+int _hs_streaming_commons_memcmp(const void *a, size_t aoff, const void *b, size_t boff, size_t n) { return memcmp(a + (aoff<<1), b + (boff<<1), n<<1);@@ -68,7 +68,7 @@ * an UTF16 array */ void-_hs_text_stream_decode_decode_latin1(uint16_t *dest, const uint8_t const *src,+_hs_streaming_commons_decode_latin1(uint16_t *dest, const uint8_t const *src, const uint8_t const *srcend) { const uint8_t *p = src;@@ -129,14 +129,14 @@ */ #if defined(__GNUC__) || defined(__clang__) static inline uint8_t const *-_hs_text_stream_decode_decode_utf8_int(uint16_t *const dest, size_t *destoff,+_hs_streaming_commons_decode_utf8_int(uint16_t *const dest, size_t *destoff, const uint8_t const **src, const uint8_t const *srcend, uint32_t *codepoint0, uint32_t *state0) __attribute((always_inline)); #endif static inline uint8_t const *-_hs_text_stream_decode_decode_utf8_int(uint16_t *const dest, size_t *destoff,+_hs_streaming_commons_decode_utf8_int(uint16_t *const dest, size_t *destoff, const uint8_t const **src, const uint8_t const *srcend, uint32_t *codepoint0, uint32_t *state0) {@@ -201,12 +201,12 @@ } uint8_t const *-_hs_text_stream_decode_decode_utf8_state(uint16_t *const dest, size_t *destoff,+_hs_streaming_commons_decode_utf8_state(uint16_t *const dest, size_t *destoff, const uint8_t const **src, const uint8_t const *srcend, uint32_t *codepoint0, uint32_t *state0) {- uint8_t const *ret = _hs_text_stream_decode_decode_utf8_int(dest, destoff, src, srcend,+ uint8_t const *ret = _hs_streaming_commons_decode_utf8_int(dest, destoff, src, srcend, codepoint0, state0); if (*state0 == UTF8_REJECT) ret -=1;@@ -217,12 +217,12 @@ * Helper to decode buffer and discard final decoder state */ const uint8_t *-_hs_text_stream_decode_decode_utf8(uint16_t *const dest, size_t *destoff,+_hs_streaming_commons_decode_utf8(uint16_t *const dest, size_t *destoff, const uint8_t *src, const uint8_t *const srcend) { uint32_t codepoint; uint32_t state = UTF8_ACCEPT;- uint8_t const *ret = _hs_text_stream_decode_decode_utf8_int(dest, destoff, &src, srcend,+ uint8_t const *ret = _hs_streaming_commons_decode_utf8_int(dest, destoff, &src, srcend, &codepoint, &state); /* Back up if we have an incomplete or invalid encoding */ if (state != UTF8_ACCEPT)@@ -231,7 +231,7 @@ } void-_hs_text_stream_decode_encode_utf8(uint8_t **destp, const uint16_t *src, size_t srcoff,+_hs_streaming_commons_encode_utf8(uint8_t **destp, const uint16_t *src, size_t srcoff, size_t srclen) { const uint16_t *srcend;
cbits/zlib-helper.c view
@@ -1,7 +1,7 @@ #include <zlib.h> #include <stdlib.h> -z_stream * create_z_stream(void)+z_stream * streaming_commons_create_z_stream(void) { z_stream *ret = malloc(sizeof(z_stream)); if (ret) {@@ -16,82 +16,82 @@ return ret; } -int inflate_init2(z_stream *stream, int window_bits)+int streaming_commons_inflate_init2(z_stream *stream, int window_bits) { return inflateInit2(stream, window_bits); } -int deflate_init2(z_stream *stream, int level, int methodBits,+int streaming_commons_deflate_init2(z_stream *stream, int level, int methodBits, int memlevel, int strategy) { return deflateInit2(stream, level, Z_DEFLATED, methodBits, memlevel, strategy); } -int inflate_set_dictionary(z_stream *stream, const char* dictionary, +int streaming_commons_inflate_set_dictionary(z_stream *stream, const char* dictionary, unsigned int dictLength) { return inflateSetDictionary(stream, dictionary, dictLength); } -int deflate_set_dictionary(z_stream *stream, const char* dictionary, +int streaming_commons_deflate_set_dictionary(z_stream *stream, const char* dictionary, unsigned int dictLength) { return deflateSetDictionary(stream, dictionary, dictLength); } -void free_z_stream_inflate (z_stream *stream)+void streaming_commons_free_z_stream_inflate (z_stream *stream) { inflateEnd(stream); free(stream); } -void set_avail_in (z_stream *stream, char *buff, unsigned int avail)+void streaming_commons_set_avail_in (z_stream *stream, char *buff, unsigned int avail) { stream->next_in = buff; stream->avail_in = avail; } -void set_avail_out (z_stream *stream, char *buff, unsigned int avail)+void streaming_commons_set_avail_out (z_stream *stream, char *buff, unsigned int avail) { stream->next_out = buff; stream->avail_out = avail; } -int call_inflate_noflush (z_stream *stream)+int streaming_commons_call_inflate_noflush (z_stream *stream) { return inflate(stream, Z_NO_FLUSH); } -unsigned int get_avail_in (z_stream *stream)+unsigned int streaming_commons_get_avail_in (z_stream *stream) { return stream->avail_in; } -unsigned int get_avail_out (z_stream *stream)+unsigned int streaming_commons_get_avail_out (z_stream *stream) { return stream->avail_out; } -char* get_next_in (z_stream *stream)+char* streaming_commons_get_next_in (z_stream *stream) { return stream->next_in; } -void free_z_stream_deflate (z_stream *stream)+void streaming_commons_free_z_stream_deflate (z_stream *stream) { deflateEnd(stream); free(stream); } -int call_deflate_noflush (z_stream *stream)+int streaming_commons_call_deflate_noflush (z_stream *stream) { return deflate(stream, Z_NO_FLUSH); } -int call_deflate_flush (z_stream *stream)+int streaming_commons_call_deflate_flush (z_stream *stream) { return deflate(stream, Z_SYNC_FLUSH); } -int call_deflate_finish (z_stream *stream)+int streaming_commons_call_deflate_finish (z_stream *stream) { return deflate(stream, Z_FINISH); }
streaming-commons.cabal view
@@ -1,8 +1,5 @@--- Initial streaming-commons.cabal generated by cabal init. For further --- documentation, see http://haskell.org/cabal/users-guide/- name: streaming-commons-version: 0.1.0.0+version: 0.1.0.1 synopsis: Common lower-level functions needed by various streaming data libraries description: Provides low-dependency functionality commonly needed by various streaming data libraries, such as conduit and pipes. homepage: https://github.com/fpco/streaming-commons