Changeset 11938 for third-party
- Timestamp:
- 08/06/06 08:04:18 (2 years ago)
- Location:
- third-party/HsSyck
- Files:
-
- 2 modified
-
Data/Yaml/Syck.hsc (modified) (6 diffs)
-
HsSyck.cabal (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
third-party/HsSyck/Data/Yaml/Syck.hsc
r11614 r11938 22 22 import GHC.Ptr (Ptr(..)) 23 23 import qualified Data.HashTable as Hash 24 import qualified Data.ByteString as Buf 25 import qualified Data.ByteString.Char8 as Char8 24 import qualified Data.ByteString.Char8 as Buf 26 25 27 26 type Buf = Buf.ByteString … … 74 73 {-# INLINE unpackBuf #-} 75 74 unpackBuf :: Buf -> String 76 unpackBuf = Char8.unpack75 unpackBuf = Buf.unpack 77 76 78 77 {-# INLINE packBuf #-} 79 78 packBuf :: String -> Buf 80 packBuf = Char8.pack79 packBuf = Buf.pack 81 80 82 81 tagNode :: YamlTag -> YamlNode -> YamlNode … … 172 171 syck_emit_scalar e tag scalarNone 0 0 0 (Ptr "~"##) 1 173 172 174 emitNode _ e n | EStr s <- n_elem n, Buf.length s == 1, Buf.head s == 0x7E= do173 emitNode _ e n | EStr s <- n_elem n, Buf.length s == 1, Buf.head s == '~' = do 175 174 withTag n (Ptr "string"##) $ \tag -> 176 175 syck_emit_scalar e tag scalar1quote 0 0 0 (Ptr "~"##) 1 … … 178 177 emitNode _ e n | EStr s <- n_elem n = do 179 178 withTag n (Ptr "string"##) $ \tag -> 180 Buf.u nsafeUseAsCStringLen s $ \(cs, l) ->179 Buf.useAsCStringLen s $ \(cs, l) -> 181 180 syck_emit_scalar e tag scalarNone 0 0 0 cs (toEnum l) 182 181 … … 287 286 if (tag == nullPtr) then (return Nothing) else do 288 287 p <- Buf.copyCString tag 289 return $! case Buf.elemIndex 0x2F p of -- '/'288 return $! case Buf.elemIndex '/' p of 290 289 Just n -> let { pre = Buf.take n p; post = Buf.drop (n+1) p } in 291 290 Just $ Buf.concat [_tagLiteral, pre, _colonLiteral, post] … … 325 324 buf <- Buf.copyCStringLen (cstr, fromEnum len) 326 325 let node = nilNode{ n_elem = EStr buf, n_tag = tag } 327 if tag == Nothing && Buf.length buf == 1 && Buf.index buf 0 == 0x7E326 if tag == Nothing && Buf.length buf == 1 && Buf.index buf 0 == '~' 328 327 then do 329 328 style <- syck_str_style syckNode -
third-party/HsSyck/HsSyck.cabal
r11614 r11938 1 1 Name: pugs-HsSyck 2 Version: 0. 22 Version: 0.3 3 3 Description: Fast, lightweight YAML loader and dumper 4 4 -- License is really "MIT", but Cabal allows no such field … … 7 7 Author: Audrey Tang 8 8 Maintainer: audreyt@audreyt.org 9 Build-Depends: base, pugs-fps 9 Build-Depends: base, pugs-fps >= 0.7 10 10 Exposed-modules: Data.Yaml.Syck 11 11 extensions: ForeignFunctionInterface 12 ghc-options: -fglasgow-exts -O -optc-O2 -optc-w -funbox-strict-fields -fno-warn-orphans12 ghc-options: -fglasgow-exts -O2 -optc-w -funbox-strict-fields -fno-warn-orphans 13 13 c-sources: syck/bytecode.c syck/emitter.c syck/gram.c syck/handler.c 14 14 syck/implicit.c syck/node.c syck/syck.c syck/syck_st.c syck/token.c
