[m-rev.] for review: do_actually_read_file

Julien Fischer jfischer at opturion.com
Sat Feb 10 16:04:58 AEDT 2024


On Sat, 10 Feb 2024, Zoltan Somogyi wrote:

> Separate reading in a file from parsing it.
> 
> compiler/parse_module.m:
>     Replace do_actually_read_module, which read in a file from a stream
>     and immediately parsed the resulting string with a supplied parser,
>     with do_actually_read_file, which just reads in the file and returns
>     the resulting string, leaving the parsing to its callers. We will
>     need this separation to allow the string we read in from the current
>     version of a .intN or .*opt file to be compared against the string form
>     of the intended *next* version.
>
>     Move the responsibility of closing the stream from do_actually_read_file
>     to its ancestor which actually opened the stream.
>
>     Add a comment about a possible improvement on UTF-16 platforms.
> 
> compiler/read_modules.m:
>     Add the code to close streams in the predicates that open them.
>
>     Merge two switches on the same variable into one.
> 
> compiler/find_module.m:
>     Replace two types that could contain *either* a full path filename
>     *or* a directory name, but *without* saying which it contains, with
>     three types that each say explicitly which they contain. Replace
>     all uses of the old types with the appropriate new type.
>     The new code in parse_module.m now gets the file name from a slot
>     that is now certain to contain the file name we want, and not just
>     its directory part.
> 
> compiler/make.get_module_dep_info.m:
>     Conform to the change in find_module.m.

That looks fine.

Julien.


More information about the reviews mailing list