From 6cf176ef39ef6e9616c74cbfc7c728c18d066526 Mon Sep 17 00:00:00 2001 From: joe Date: Fri, 12 Jul 2013 15:43:47 -0400 Subject: Removed HaXML based parsing & deleted obsolete modules. --- Presence/AdaptServer.hs | 40 ---------------------------------------- 1 file changed, 40 deletions(-) delete mode 100644 Presence/AdaptServer.hs (limited to 'Presence/AdaptServer.hs') diff --git a/Presence/AdaptServer.hs b/Presence/AdaptServer.hs deleted file mode 100644 index e4940331..00000000 --- a/Presence/AdaptServer.hs +++ /dev/null @@ -1,40 +0,0 @@ -{-# LANGUAGE FlexibleContexts #-} -{-# LANGUAGE OverloadedStrings #-} -module AdaptServer where - -import Data.IORef -import Data.HList --- import Network.Socket (Socket) -import qualified Data.ByteString.Lazy.Char8 as L -import ByteStringOperators - -adaptStartCon start sock st = do - rsRef <- newIORef "" - st' <- start sock st - return (HCons rsRef st') - -adaptDoCon showlex (dropTill,lex,parse) g st bs cont = do - putStrLn $ "packet: " ++ show bs - let (HCons rsRef st') = st - rs <- readIORef rsRef - - let contR rem v = do - writeIORef rsRef rem - cont v - let loop rem lexemes@(_:_) = do - let (e,rs') = parse lexemes - case e of - Left err -> if null rs' - then contR "" () - else -- trace ("parse error "++show (err,bs,showlex lexemes,showlex rs')) $ do - contR rem () - Right e -> do - -- writeIORef rsRef rs' - g st' e (\() -> do { {- putStrLn ("LOOP "++showlex rs'); -} loop (dropTill rem rs') rs' }) - loop rem [] = contR "" () - let buf = rs <++> bs - when (L.length buf < 8192) - (loop buf (lex buf)) - - -adaptServer showlex (dropTill,lex,parse) (startCon,doCon) = (adaptStartCon startCon, adaptDoCon showlex (dropTill,lex,parse) doCon) -- cgit v1.2.3