Changeset 7166
- Timestamp:
- 09/27/05 13:52:26 (3 years ago)
- Files:
-
- 3 modified
-
README (modified) (1 diff)
-
src/Data/FastPackedString.hs (modified) (8 diffs)
-
src/cbits/fpstring.c (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
README
r7117 r7166 34 34 The "UTF8" subsystem is derived from Sven Moritz Hallberg's work, 35 35 under a BSD-style license. See src/UTF8.lhs. 36 37 The "FastPackedString" subsystem is derived from Don Stewart et all's work, 38 under a BSD-style license. See src/Data/FastPackedString.hs. 36 39 37 40 The "Unicode" subsystem is derived from Dimitry Golubovsky's work, -
src/Data/FastPackedString.hs
r7164 r7166 34 34 -- * Introducing and eliminating 'FastString's 35 35 empty, -- :: FastString 36 nil, -- :: FastString -- DEPRECATED 37 36 38 pack, -- :: String -> FastString 37 39 unpack, -- :: FastString -> String … … 78 80 drop, -- :: Int -> FastString -> FastString 79 81 splitAt, -- :: Int -> FastString -> (FastString, FastString) 82 substr, -- :: FastString -> Int -> Int -> FastString -- DEPRECATED 80 83 81 84 takeWhile, -- :: (Char -> Bool) -> FastString -> FastString … … 122 125 spanEnd, -- :: (Char -> Bool) -> FastString -> (FastString, FastString) 123 126 split, -- :: Char -> FastString -> [FastString] 127 124 128 tokens, -- :: (Char -> Bool) -> FastString -> [FastString] 129 splitWith, -- :: (Char -> Bool) -> FastString -> [FastString] -- DEPRECATED 130 125 131 hash, -- :: FastString -> Int32 126 132 elemIndexLast,-- :: Char -> FastString -> Maybe Int … … 169 175 #endif 170 176 177 fromForeignPtr, -- :: ForeignPtr Word8 -> Int -> FastString 178 toForeignPtr, -- :: FastString -> (ForeignPtr Word8, Int, Int) 171 179 ) where 172 180 … … 270 278 empty = unsafePerformIO $ mallocForeignPtr 1 >>= \fp -> return $ PS fp 0 0 271 279 {-# NOINLINE empty #-} 280 281 -- | /O(1)/ Alias for 'empty' to agree with old PackedString interface 282 {-# DEPRECATED nil "Use empty instead" #-} 283 nil :: FastString 284 nil = empty 272 285 273 286 -- | /O(n)/ Convert a 'String' into a 'FastString' … … 536 549 {-# INLINE drop #-} 537 550 551 -- | /O(1)/ 'substr' @begin end xs@ returns the substring of @xs@ between 552 -- (and including) the two indices. 553 {-# DEPRECATED substr "Use take/drop instead" #-} 554 substr :: FastString -> Int -> Int -> FastString 555 substr str begin end = take (end - begin + 1) (drop begin str) 556 538 557 -- | /O(1)/ 'splitAt' @n xs@ is equivalent to @('take' n xs, 'drop' n xs)@. 539 558 splitAt :: Int -> FastString -> (FastString, FastString) … … 782 801 tokens :: (Char -> Bool) -> FastString -> [FastString] 783 802 tokens p = Prelude.filter (not.null) . breakAll p 803 804 {-# DEPRECATED splitWith "Use tokens instead" #-} 805 splitWith :: (Char -> Bool) -> FastString -> [FastString] 806 splitWith = tokens 784 807 785 808 -- | Splits a 'FastString' into components delimited by separators, … … 1074 1097 return $ PS fp 0 l 1075 1098 #endif 1099 1100 fromForeignPtr :: ForeignPtr Word8 -> Int -> FastString 1101 fromForeignPtr fp l = PS fp 0 l 1102 1103 toForeignPtr :: FastString -> (ForeignPtr Word8, Int, Int) 1104 toForeignPtr (PS ps s l) = (ps, s, l) 1076 1105 1077 1106 -- | /O(n)/ Build a @FastString@ from a malloced @CString@. This value will -
src/cbits/fpstring.c
r7164 r7166 21 21 #include <sys/types.h> 22 22 23 #ifdef USE_MMAP 23 24 #ifdef _WIN32 24 25 #include <windows.h> … … 26 27 #include <sys/mman.h> 27 28 #endif 29 #endif 28 30 29 31 #include "fpstring.h" … … 68 70 // mmapping... 69 71 72 #ifdef USE_MMAP 70 73 #ifdef _WIN32 71 74 … … 97 100 } 98 101 102 #endif 99 103 #endif 100 104
