1 # This file is part of NIT ( http://www.nitlanguage.org ).
3 # This file is free software, which comes along with NIT. This software is
4 # distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
5 # without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
6 # PARTICULAR PURPOSE. You can modify it is you want, provided this header
7 # is kept unaltered, and a notification of the changes is added.
8 # You are allowed to redistribute it and sell it, alone or is a part of
11 # Runtime library to loop around the main program for each line in file-name arguments
13 # Used by the interpreter when `-n` is used
18 if not args
.is_empty
then
27 # Read the next useful line from file-name arguments
28 private fun read_next_line
33 var line
= stdin
.read_line
35 if not stdin
.eof
then break
37 if not line
.is_empty
then break
38 line
= stdin
.read_line
43 # Open the next file until there is no more arguments
44 private fun open_next_stream
46 if args
.is_empty
then exit
(0)
48 stdin
= new IFStream.open
(args
.shift
)
51 # The next line to process by the main program