Changeset 8604
- Timestamp:
- 01/07/06 11:59:25 (3 years ago)
- Location:
- src
- Files:
-
- 2 modified
-
Data/Yaml/Syck.hsc (modified) (2 diffs)
-
Pugs/Prim/Yaml.hs (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
src/Data/Yaml/Syck.hsc
r8603 r8604 94 94 emitNode :: (?e :: SyckEmitter) -> YamlNode -> IO () 95 95 emitNode YamlNil = do 96 withCString "string" $ \string _literal ->96 withCString "string" $ \stringLiteral -> 97 97 withCString "~" $ \cs -> 98 syck_emit_scalar ?e string _literal scalarNone 0 0 0 cs 198 syck_emit_scalar ?e stringLiteral scalarNone 0 0 0 cs 1 99 99 100 100 emitNode (YamlStr str) = do 101 withCString "string" $ \string _literal ->101 withCString "string" $ \stringLiteral -> 102 102 withCString str $ \cs -> 103 syck_emit_scalar ?e string _literal scalarNone 0 0 0 cs (toEnum $ length str)103 syck_emit_scalar ?e stringLiteral scalarNone 0 0 0 cs (toEnum $ length str) 104 104 105 105 emitNode (YamlSeq seq) = do 106 withCString "array" $ \array _literal ->107 syck_emit_seq ?e array _literal seqNone106 withCString "array" $ \arrayLiteral -> 107 syck_emit_seq ?e arrayLiteral seqNone 108 108 -- TODO: fix pesky warning about "integer from pointer without a cast" here 109 109 mapM_ (syck_emit_item ?e) =<< (mapM freezeNode seq) … … 111 111 112 112 emitNode (YamlMap tag m) = do 113 -- trace ("hash<" ++ maybe "" id tag ++">: " ++ (show m)) $ return () 114 withCString (maybe "hash" id tag) $ \hash_literal -> do 115 syck_emit_map ?e hash_literal mapNone 116 when (isJust tag) (do {syck_emit_tag ?e hash_literal nullPtr ; return ()}) 113 --trace ("hash<" ++ maybe "" id tag ++">: " ++ (show m)) $ return () 114 withCString (maybe "hash" id tag) $ \hashLiteral -> do 115 syck_emit_map ?e hashLiteral mapNone 117 116 flip mapM_ m (\(k,v) -> do 118 117 syck_emit_item ?e =<< freezeNode k -
src/Pugs/Prim/Yaml.hs
r8603 r8604 67 67 hash <- fromVal v :: Eval VHash 68 68 attrs <- toYaml $ VRef (hashRef hash) 69 return $ addTag (Just $ " !pugs:object/" ++ showType (objType obj)) attrs69 return $ addTag (Just $ "tag:pugs:object:" ++ showType (objType obj)) attrs 70 70 where 71 71 addTag _ (YamlMap (Just x) _) = error ("can't add tag: already tagged with" ++ x)
