@@ -166,8 +166,8 @@ processNetCmd orig i h fn cmd
166 Left err -> do hPutStrLn h (show err)
166 Left err -> do hPutStrLn h (show err)
167 return (i, fn)
167 return (i, fn)
169− processNet fn Reload = processNet fn (Load fn)
169+ processNet fn Reload = processNet fn (Load fn Nothing)
170− processNet fn (Load f) =
170+ processNet fn (Load f toline) =
171 do let ist = orig { idris_options = idris_options i
171 do let ist = orig { idris_options = idris_options i
172 , idris_colourTheme = idris_colourTheme i
172 , idris_colourTheme = idris_colourTheme i
173 , idris_colourRepl = False
173 , idris_colourRepl = False
@@ -177,7 +177,7 @@ processNetCmd orig i h fn cmd
177 setOutH h
177 setOutH h
178 setQuiet True
178 setQuiet True
179 setVerbose False
179 setVerbose False
180− mods <- loadInputs h [f]
180+ mods <- loadInputs h [f] toline
181 ist <- getIState
181 ist <- getIState
182 return (ist, f)
182 return (ist, f)
183 processNet fn c = do process h fn c
183 processNet fn c = do process h fn c
@@ -258,7 +258,7 @@ runIdeSlaveCommand id orig fn mods (IdeSlave.LoadFile filename) =
259 putIState (orig { idris_options = idris_options i,
259 putIState (orig { idris_options = idris_options i,
260 idris_outputmode = (IdeSlave id) })
260 idris_outputmode = (IdeSlave id) })
261− loadInputs stdout [filename]
261+ loadInputs stdout [filename] Nothing
262 isetPrompt (mkPrompt [filename])
262 isetPrompt (mkPrompt [filename])
263 -- Report either success or failure
263 -- Report either success or failure
264 i <- getIState
264 i <- getIState
@@ -474,14 +474,14 @@ processInput cmd orig inputs
474 , idris_colourTheme = idris_colourTheme i
474 , idris_colourTheme = idris_colourTheme i
477− mods <- loadInputs stdout inputs
477+ mods <- loadInputs stdout inputs Nothing
478 return (Just inputs)
478 return (Just inputs)
479− Success (Load f) ->
479+ Success (Load f toline) ->
480 do putIState orig { idris_options = idris_options i
480 do putIState orig { idris_options = idris_options i
481 , idris_colourTheme = idris_colourTheme i
481 , idris_colourTheme = idris_colourTheme i
484− mod <- loadInputs stdout [f]
484+ mod <- loadInputs stdout [f] toline
485 return (Just [f])
485 return (Just [f])
486 Success (ModImport f) ->
486 Success (ModImport f) ->
487 do clearErr
487 do clearErr
@@ -530,7 +530,7 @@ edit f orig
530 putIState $ orig { idris_options = idris_options i
530 putIState $ orig { idris_options = idris_options i
531 , idris_colourTheme = idris_colourTheme i
531 , idris_colourTheme = idris_colourTheme i
533− loadInputs stdout [f]
533+ loadInputs stdout [f] Nothing
534-- clearOrigPats
534-- clearOrigPats
536 return ()
536 return ()
@@ -994,8 +994,8 @@ idris opts = do res <- runErrorT $ execStateT totalMain idrisInit
994 [] -> return ()
994 [] -> return ()
997−loadInputs :: Handle -> [FilePath] -> Idris ()
997+loadInputs :: Handle -> [FilePath] -> Maybe Int -> Idris ()
998−loadInputs h inputs
998+loadInputs h inputs toline -- furthest line to read in input source files
999 = idrisCatch
999 = idrisCatch
1000 (do ist <- getIState
1000 (do ist <- getIState
1001 -- if we're in --check and not outputting anything, don't bother
1001 -- if we're in --check and not outputting anything, don't bother
@@ -1056,7 +1056,18 @@ loadInputs h inputs
1056 tryLoad keepstate [] = warnTotality >> return ()
1056 tryLoad keepstate [] = warnTotality >> return ()
1057 tryLoad keepstate (f : fs)
1057 tryLoad keepstate (f : fs)
1058 = do ist <- getIState
1058 = do ist <- getIState
1062+ Just l -> case f of
1063+ IDR fn -> if any (fmatch fn) inputs
1066+ LIDR fn -> if any (fmatch fn) inputs
1059− loadFromIFile h f
1070+ loadFromIFile h f maxline
1060 inew <- getIState
1071 inew <- getIState
1061 -- FIXME: Save these in IBC to avoid this hack! Need to
1072 -- FIXME: Save these in IBC to avoid this hack! Need to
1062 -- preserve it all from source inputs
1073 -- preserve it all from source inputs
@@ -1072,6 +1083,10 @@ loadInputs h inputs
1072 ibc (IBC _ _) = True
1083 ibc (IBC _ _) = True
1073 ibc _ = False
1084 ibc _ = False
1086+ fmatch ('.':'/':xs) ys = fmatch xs ys
1087+ fmatch xs ('.':'/':ys) = fmatch xs ys
1088+ fmatch xs ys = xs == ys
1075 findNewIBC :: IFileType -> Idris (Maybe IFileType)
1090 findNewIBC :: IFileType -> Idris (Maybe IFileType)
1076 findNewIBC i@(IBC _ _) = return (Just i)
1091 findNewIBC i@(IBC _ _) = return (Just i)
1077 findNewIBC s@(IDR f) = do ist <- get
1092 findNewIBC s@(IDR f) = do ist <- get
@@ -1181,7 +1196,7 @@ idrisMain opts =
1181 iputStrLn banner
1196 iputStrLn banner
1183 orig <- getIState
1198 orig <- getIState
1184− loadInputs stdout inputs
1199+ loadInputs stdout inputs Nothing
1186 runIO $ hSetBuffering stdout LineBuffering
1201 runIO $ hSetBuffering stdout LineBuffering
@@ -1278,7 +1293,7 @@ initScript = do script <- getInitScript
1278 case parseCmd i input cmd of
1293 case parseCmd i input cmd of
1279 Failure err -> runIO $ print (fixColour clr err)
1294 Failure err -> runIO $ print (fixColour clr err)
1280 Success Reload -> iPrintError "Init scripts cannot reload the file"
1295 Success Reload -> iPrintError "Init scripts cannot reload the file"
1281− Success (Load f) -> iPrintError "Init scripts cannot load files"
1296+ Success (Load f _) -> iPrintError "Init scripts cannot load files"
1282 Success (ModImport f) -> iPrintError "Init scripts cannot import modules"
1297 Success (ModImport f) -> iPrintError "Init scripts cannot import modules"
1283 Success Edit -> iPrintError "Init scripts cannot invoke the editor"
1298 Success Edit -> iPrintError "Init scripts cannot invoke the editor"
1284 Success Proofs -> proofs i
1299 Success Proofs -> proofs i