on master help sign in
Merge pull request #651 from hannesm/ideslave-logging

Ideslave logging support -- apart from the Debug.Trace uses in src/Core/

commitb6f54eec523b3ba72210168140c7183291abaa77 authorEdwin Brady <edwin.brady@gmail.com> dateThu 21 Nov 2013, 00:42 (13 years ago) parent873e8249c9b38b
3 files changed+8−6
src/Idris/AbsSyntax.hs+6−3 src/Idris/AbsSyntaxTree.hs+1−2 src/Idris/REPL.hs+1−1
src/Idris/AbsSyntax.hs+6−3
@@ -577,9 +577,12 @@ setColour ct c = do i <- getIState
577577logLvl :: Int -> String -> Idris ()
578578logLvl l str = do i <- getIState
579579 let lvl = opt_logLevel (idris_options i)
580− when (lvl >= l)
581− $ do runIO (putStrLn str)
582− putIState $ i { idris_log = idris_log i ++ str ++ "\n" }
580+ when (lvl >= l) $
581+ case idris_outputmode i of
582+ RawOutput -> do runIO $ putStrLn str
583+ IdeSlave n ->
584+ do let good = SexpList [IntegerAtom (toInteger l), toSExp str]
585+ runIO $ putStrLn $ convSExp "log" good n
583586
584587cmdOptType :: Opt -> Idris Bool
585588cmdOptType x = do i <- getIState
src/Idris/AbsSyntaxTree.hs+1−2
@@ -97,7 +97,6 @@ data IState = IState {
9797 idris_calledgraph :: Ctxt [Name],
9898 idris_docstrings :: Ctxt String,
9999 idris_totcheck :: [(FC, Name)],
100− idris_log :: String,
101100 idris_options :: IOption,
102101 idris_name :: Int,
103102 idris_lineapps :: [((FilePath, Int), PTerm)],
@@ -185,7 +184,7 @@ data IBCWrite = IBCFix FixDecl
185184idrisInit = IState initContext [] [] emptyContext emptyContext emptyContext
186185 emptyContext emptyContext emptyContext emptyContext
187186 emptyContext emptyContext emptyContext emptyContext
188− [] "" defaultOpts 6 [] [] [] [] [] [] [] [] [] [] [] []
187+ [] defaultOpts 6 [] [] [] [] [] [] [] [] [] [] [] []
189188 [] Nothing Nothing [] [] [] Hidden False [] Nothing [] [] RawOutput
190189 True defaultTheme stdout
191190
src/Idris/REPL.hs+1−1
@@ -1156,7 +1156,7 @@ idrisMain opts =
11561156
11571157 when runrepl $ initScript
11581158 stvar <- runIO $ newMVar ist
1159− when runrepl $ startServer ist stvar inputs
1159+ when (runrepl && not idesl) $ startServer ist stvar inputs
11601160 when (runrepl && not idesl) $ runInputT (replSettings (Just historyFile)) $ repl ist stvar inputs
11611161 when (idesl) $ ideslaveStart ist inputs
11621162 ok <- noErrors