bytestring-builder 0.10.4.0.1 → 0.10.4.0.2
raw patch · 9 files changed
+33/−78 lines, 9 filesdep ~basedep ~bytestringsetup-changed
Dependency ranges changed: base, bytestring
Files
- Setup.hs +1/−39
- bytestring-builder.cabal +9/−16
- cbits/fpstring.c +1/−1
- cbits/itoa.c +8/−8
- src/Data/ByteString/Builder/ASCII.hs +2/−2
- src/Data/ByteString/Builder/Internal.hs +1/−1
- src/Data/ByteString/Builder/Prim/ASCII.hs +6/−6
- src/Data/ByteString/Builder/Prim/Internal.hs +1/−1
- src/Data/ByteString/Short/Internal.hs +4/−4
Setup.hs view
@@ -1,40 +1,2 @@ import Distribution.Simple-import Distribution.Simple.Setup-import Distribution.Simple.LocalBuildInfo-import Distribution.PackageDescription-import Distribution.Version---- This checks the direct dependency of the bytestring package being--- compiled against to set the bytestring_has_itoa_c and--- bytestring_has_builder flags accordingly.--main = defaultMainWithHooks simpleUserHooks {- confHook = \pkg flags ->- if null (configConstraints flags)- then do- confHook simpleUserHooks pkg flags- else do- let bytestring_version =- case [ versionBranch v- | (Dependency pkg ver) <- configConstraints flags- , pkg == PackageName "bytestring"- , (Just v) <- [isSpecificVersion ver] ]- of- [v] -> v- vs -> error ("error detecting bytestring version " ++ show vs)-- let has_itoa_c = ( FlagName "bytestring_has_itoa_c"- , bytestring_version >= [0,10] )-- let has_builder = ( FlagName "bytestring_has_builder"- , bytestring_version >= [0,10,4] )-- let update fs gs =- fs ++ [ g | g <- gs, not $ any (\f -> fst f == fst g) fs]-- let flags' = flags { configConfigurationsFlags =- update [has_itoa_c, has_builder]- (configConfigurationsFlags flags) }- - confHook simpleUserHooks pkg flags'- }+main = defaultMain
bytestring-builder.cabal view
@@ -1,5 +1,5 @@ name: bytestring-builder-version: 0.10.4.0.1+version: 0.10.4.0.2 synopsis: The new bytestring builder, packaged outside of GHC description: This is the bytestring builder that is debuting in bytestring-0.10.4.0, which@@ -32,7 +32,7 @@ copyright: (c) 2010 Jasper Van der Jeugt (c) 2010-2013 Simon Meier category: Data-build-type: Custom+build-type: Simple extra-source-files: cbits/*.c @@ -50,30 +50,23 @@ source-repository this type: git location: http://github.com/lpsmith/bytestring-builder- tag: v0.10.4.0.1---- Note that these flags are set by Setup.hs--Flag bytestring_has_itoa_c- default: True- manual: True+ tag: v0.10.4.0.2 Flag bytestring_has_builder default: True- manual: True library build-depends: base >= 4.2 && < 5, bytestring >= 0.9 && < 0.10.1 || == 0.10.4.*, deepseq - if !flag(bytestring_has_itoa_c)- c-sources: cbits/itoa.c--- if !flag(bytestring_has_builder)+ if flag(bytestring_has_builder)+ build-depends: bytestring >= 0.10.4+ else+ build-depends: bytestring < 0.10.4 hs-source-dirs: src- c-sources: cbits/fpstring.c+ c-sources: cbits/itoa.c+ cbits/fpstring.c exposed-modules: Data.ByteString.Builder Data.ByteString.Builder.Extra
cbits/fpstring.c view
@@ -3,7 +3,7 @@ /* This wrapper is here so that we can copy a sub-range of a ByteArray#. We cannot construct a pointer to the interior of an unpinned ByteArray#, except by doing an unsafe ffi call, and adjusting the pointer C-side. */-void * fps_memcpy_offsets(void *dst, unsigned long dst_off,+void * bytestring_builder_memcpy_offsets(void *dst, unsigned long dst_off, const void *src, unsigned long src_off, size_t n) { return memcpy(dst + dst_off, src + src_off, n); }
cbits/itoa.c view
@@ -12,7 +12,7 @@ static const char* digits = "0123456789abcdef"; // signed integers-char* _hs_bytestring_int_dec (int x, char* buf)+char* bytestring_builder_int_dec (int x, char* buf) { char c, *ptr = buf, *next_free; int x_tmp;@@ -48,7 +48,7 @@ } // signed long long ints (64 bit integers)-char* _hs_bytestring_long_long_int_dec (long long int x, char* buf)+char* bytestring_builder_long_long_int_dec (long long int x, char* buf) { char c, *ptr = buf, *next_free; long long int x_tmp;@@ -84,7 +84,7 @@ } // unsigned integers-char* _hs_bytestring_uint_dec (unsigned int x, char* buf)+char* bytestring_builder_uint_dec (unsigned int x, char* buf) { char c, *ptr = buf, *next_free; unsigned int x_tmp;@@ -107,7 +107,7 @@ } // unsigned long ints-char* _hs_bytestring_long_long_uint_dec (long long unsigned int x, char* buf)+char* bytestring_builder_long_long_uint_dec (long long unsigned int x, char* buf) { char c, *ptr = buf, *next_free; long long unsigned int x_tmp;@@ -136,7 +136,7 @@ // Padded (9 digits), decimal, positive int: // We will use it with numbers that fit in 31 bits; i.e., numbers smaller than // 10^9, as "31 * log 2 / log 10 = 9.33"-void _hs_bytestring_int_dec_padded9 (int x, char* buf)+void bytestring_builder_int_dec_padded9 (int x, char* buf) { const int max_width_int32_dec = 9; char* ptr = buf + max_width_int32_dec;@@ -156,7 +156,7 @@ // Padded (19 digits), decimal, positive long long int: // We will use it with numbers that fit in 63 bits; i.e., numbers smaller than // 10^18, as "63 * log 2 / log 10 = 18.96"-void _hs_bytestring_long_long_int_dec_padded18 (long long int x, char* buf)+void bytestring_builder_long_long_int_dec_padded18 (long long int x, char* buf) { const int max_width_int64_dec = 18; char* ptr = buf + max_width_int64_dec;@@ -179,7 +179,7 @@ /////////////////////// // unsigned ints (32 bit words)-char* _hs_bytestring_uint_hex (unsigned int x, char* buf) {+char* bytestring_bytestring_uint_hex (unsigned int x, char* buf) { // write hex representation in reverse order char c, *ptr = buf, *next_free; do {@@ -197,7 +197,7 @@ }; // unsigned long ints (64 bit words)-char* _hs_bytestring_long_long_uint_hex (long long unsigned int x, char* buf) {+char* bytestring_bytestring_long_long_uint_hex (long long unsigned int x, char* buf) { // write hex representation in reverse order char c, *ptr = buf, *next_free; do {
src/Data/ByteString/Builder/ASCII.hs view
@@ -357,10 +357,10 @@ PAIR(q,r) -> fromInteger q : fromInteger r : putB ns -foreign import ccall unsafe "static _hs_bytestring_int_dec_padded9"+foreign import ccall unsafe "static bytestring_builder_int_dec_padded9" c_int_dec_padded9 :: CInt -> Ptr Word8 -> IO () -foreign import ccall unsafe "static _hs_bytestring_long_long_int_dec_padded18"+foreign import ccall unsafe "static bytestring_builder_long_long_int_dec_padded18" c_long_long_int_dec_padded18 :: CLLong -> Ptr Word8 -> IO () {-# INLINE intDecPadded #-}
src/Data/ByteString/Builder/Internal.hs view
@@ -1,5 +1,5 @@ {-# LANGUAGE ScopedTypeVariables, CPP, BangPatterns, RankNTypes #-}-#if __GLASGOW_HASKELL__ >= 703+#if __GLASGOW_HASKELL__ >= 701 {-# LANGUAGE Unsafe #-} #endif {-# OPTIONS_HADDOCK hide #-}
src/Data/ByteString/Builder/Prim/ASCII.hs view
@@ -100,10 +100,10 @@ -- Signed integers ------------------ -foreign import ccall unsafe "static _hs_bytestring_int_dec" c_int_dec+foreign import ccall unsafe "static bytestring_builder_int_dec" c_int_dec :: CInt -> Ptr Word8 -> IO (Ptr Word8) -foreign import ccall unsafe "static _hs_bytestring_long_long_int_dec" c_long_long_int_dec+foreign import ccall unsafe "static bytestring_builder_long_long_int_dec" c_long_long_int_dec :: CLLong -> Ptr Word8 -> IO (Ptr Word8) {-# INLINE encodeIntDecimal #-}@@ -142,10 +142,10 @@ -- Unsigned integers -------------------- -foreign import ccall unsafe "static _hs_bytestring_uint_dec" c_uint_dec+foreign import ccall unsafe "static bytestring_builder_uint_dec" c_uint_dec :: CUInt -> Ptr Word8 -> IO (Ptr Word8) -foreign import ccall unsafe "static _hs_bytestring_long_long_uint_dec" c_long_long_uint_dec+foreign import ccall unsafe "static bytestring_builder_long_long_uint_dec" c_long_long_uint_dec :: CULLong -> Ptr Word8 -> IO (Ptr Word8) {-# INLINE encodeWordDecimal #-}@@ -186,10 +186,10 @@ -- without lead --------------- -foreign import ccall unsafe "static _hs_bytestring_uint_hex" c_uint_hex+foreign import ccall unsafe "static bytestring_bytestring_uint_hex" c_uint_hex :: CUInt -> Ptr Word8 -> IO (Ptr Word8) -foreign import ccall unsafe "static _hs_bytestring_long_long_uint_hex" c_long_long_uint_hex+foreign import ccall unsafe "static bytestring_bytestring_long_long_uint_hex" c_long_long_uint_hex :: CULLong -> Ptr Word8 -> IO (Ptr Word8) {-# INLINE encodeWordHex #-}
src/Data/ByteString/Builder/Prim/Internal.hs view
@@ -1,5 +1,5 @@ {-# LANGUAGE ScopedTypeVariables, CPP, BangPatterns #-}-#if __GLASGOW_HASKELL__ >= 703+#if __GLASGOW_HASKELL__ >= 701 {-# LANGUAGE Unsafe #-} #endif {-# OPTIONS_HADDOCK hide #-}
src/Data/ByteString/Short/Internal.hs view
@@ -2,7 +2,7 @@ ForeignFunctionInterface, MagicHash, UnboxedTuples, UnliftedFFITypes #-} {-# OPTIONS_GHC -fno-warn-name-shadowing #-}-#if __GLASGOW_HASKELL__ >= 703+#if __GLASGOW_HASKELL__ >= 701 {-# LANGUAGE Unsafe #-} #endif {-# OPTIONS_HADDOCK hide #-}@@ -535,7 +535,7 @@ copyAddrToByteArray# src dst 0# len s = copyAddrToByteArray0 src dst len s #-} -foreign import ccall unsafe "fpstring.h fps_memcpy_offsets"+foreign import ccall unsafe "fpstring.h bytestring_builder_memcpy_offsets" memcpy_AddrToByteArray :: MutableByteArray# s -> CLong -> Addr# -> CLong -> CSize -> IO () foreign import ccall unsafe "string.h memcpy"@@ -556,7 +556,7 @@ copyByteArrayToAddr# src 0# dst len s = copyByteArrayToAddr0 src dst len s #-} -foreign import ccall unsafe "fpstring.h fps_memcpy_offsets"+foreign import ccall unsafe "fpstring.h bytestring_builder_memcpy_offsets" memcpy_ByteArrayToAddr :: Addr# -> CLong -> ByteArray# -> CLong -> CSize -> IO () foreign import ccall unsafe "string.h memcpy"@@ -583,7 +583,7 @@ unST (ST st) = st unST_ st s = case unST st s of (# s, _ #) -> s -foreign import ccall unsafe "fpstring.h fps_memcpy_offsets"+foreign import ccall unsafe "fpstring.h bytestring_builder_memcpy_offsets" memcpy_ByteArray :: MutableByteArray# s -> CLong -> ByteArray# -> CLong -> CSize -> IO () #endif