ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/kgsueme/doc/doc2haskell.xsl
(Generate patch)

Comparing kgsueme/doc/doc2haskell.xsl (file contents):
Revision 1.11 by pcg, Sun Jul 27 00:20:48 2003 UTC vs.
Revision 1.12 by elmex, Sun Jul 27 16:23:08 2003 UTC

1<!DOCTYPE xsl:stylesheet> 1r!DOCTYPE xsl:stylesheet>
2<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> 2<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
3 3
4<xsl:output method="text" media-type="text/plain" encoding="utf-8"/> 4<xsl:output method="text" media-type="text/plain" encoding="utf-8"/>
5 5
6<xsl:template match="/"><![CDATA[ 6<xsl:template match="/"><![CDATA[
84dec_DATA = 84dec_DATA =
85 do da <- get 85 do da <- get
86 put [] 86 put []
87 return da 87 return da
88 88
89dec_STRING :: DecS String 89dec_STRING :: DecS [Word16]
90dec_STRING = 90dec_STRING =
91 do c <- getU16
92 if c == 0 then do return []
93 else return (c:dec_STRING)
94
91 do da <- get 95{- do da <- get
92 let (str,rest) = mkstr da 96 let (str,rest) = mkstr da
93 where 97 where
94 mkstr str [] = 98 mkstr str [] =
95 (reverse str,[]) 99 (reverse str,[])
96 mkstr str (0:rest) = 100 mkstr str (0:rest) =
97 (reverse str, rest) 101 (reverse str, rest)
98 mkstr str (c:rest) = 102 mkstr str (c:rest) =
99 mkstr ((toEnum (fromIntegral c :: Int)):str) rest 103 mkstr ((toEnum (fromIntegral c :: Int)):str) rest -}
100 104
101{- 105{-
102sub dec_STRING { 106sub dec_STRING {
103 $data =~ s/^((?:..)*?)(?:\x00\x00|\Z)//s; 107 $data =~ s/^((?:..)*?)(?:\x00\x00|\Z)//s;
104 # use Encode... 108 # use Encode...
186enc_DATA :: [Word8] -> DecS () 190enc_DATA :: [Word8] -> DecS ()
187enc_DATA d = 191enc_DATA d =
188 do x <- get 192 do x <- get
189 put $ (reverse d) ++ x 193 put $ (reverse d) ++ x
190 194
191enc_STRING :: String -> DecS () 195enc_STRING :: [Word16] -> DecS ()
192enc_STRING s = 196enc_STRING (s:ss) =
197 do putU16 s
198 enc_STRING ss
199
193 do let mstr = reverse s 200{- do let mstr = reverse s
194 putall (u:ls) = 201 putall (u:ls) =
195 do putU8 u 202 do putU8 u
196 putall ls 203 putall ls
197 putall [] = return () 204 putall [] = return ()
198 putall mstr 205 putall mstr
199 putU8 0 206 putU8 0 -}
200 207
201enc_CONSTANT :: a -> DecS () 208enc_CONSTANT :: a -> DecS ()
202enc_CONSTANT _ = return () 209enc_CONSTANT _ = return ()
203 210
204enc_password :: Password -> DecS () 211enc_password :: Password -> DecS ()
205enc_password p = 212enc_password (p:ps) =
206 enc_U64 p 213 (1055 * (enc_password ps)) + (fromEnum p)
207 214
208{- marc??? 215{- marc???
209sub enc_password { 216sub enc_password {
210 require Math::BigInt; # I insist on 32-bit-perl.. should use C 217 require Math::BigInt; # I insist on 32-bit-perl.. should use C
211 # $hash must be 64 bit 218 # $hash must be 64 bit

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines