compiler/mlds_to_c_stmt.m:
compiler/mlds_to_c_class.m:
compiler/mlds_to_c_func.m:
Write out more things in calls to io.format.
Require an enum class to contain at one enum.
compiler/mlds_to_target_util.m:
Delete the output_n_indent and write_indented_line predicates,
since this series of changes has replaced all calls to them.
compiler/indent.m:
compiler/mlds_to_target_util.m:
Move the indent type (a synonym for int) from mlds_to_target_util.m
to indent.m, to prepare for the expansion of its use to other parts
of the compiler.
compiler/mlds_to_c_export.m:
compiler/mlds_to_c_file.m:
compiler/mlds_to_c_global.m:
compiler/mlds_to_cs_class.m:
compiler/mlds_to_cs_data.m:
compiler/mlds_to_cs_export.m:
compiler/mlds_to_cs_func.m:
compiler/mlds_to_cs_global.m:
compiler/mlds_to_cs_stmt.m:
compiler/mlds_to_java_class.m:
compiler/mlds_to_java_data.m:
compiler/mlds_to_java_export.m:
compiler/mlds_to_java_func.m:
compiler/mlds_to_java_global.m:
compiler/mlds_to_java_stmt.m:
compiler/mlds_to_java_util.m:
Import indent.m instead of mlds_to_target_util.m to get access
to the indent type.
Do so mostly by including the return value of indent2_string
as an item to be printed by io.format. By including as many things
to be printed as possible in a single call to io.format, people
reading the code can see how those items fit together.
compiler/mlds_to_java_name.m:
To allow more use of io.format still, replace the predicates here,
which each printed an entity of some kind, with functions that return
the string form of that entity.
In one case, tweak the job of the function a bit. The old predicate
output_qual_name_prefix_java used to print a period after the qualifier,
but its replacement function qualifier_to_string_for_java does not.
This is because having the format string in a call to io.format
contain no period between the qualifier and the name being qualified
would violate the law of least astonishment.
compiler/mlds_to_target_util.m:
Add a function version of the existing predicate output_generic_tvars,
named generic_tvars_to_string.
Make generic_tvar_to_string, which converts just one tvar, into a function,
because this fits in better with the rest of the ecosystem.
Add the utility function write_indentstr_line, which is a version of
the existing write_indented_line that takes the indent string, not the
indent level, as an argument. When called from callers which have
already converted the indent level to the its string form, calling
the old predicate would require redundant conversions.
compiler/mlds_to_java_class.m:
compiler/mlds_to_java_data.m:
compiler/mlds_to_java_export.m:
compiler/mlds_to_java_file.m:
compiler/mlds_to_java_func.m:
compiler/mlds_to_java_global.m:
compiler/mlds_to_java_stmt.m:
compiler/mlds_to_java_type.m:
compiler/mlds_to_java_util.m:
compiler/mlds_to_java_wrap.m:
Make the changes described at the top, using the updates above.
In one place in mlds_to_java_func.m, generate missing indentation.
compiler/mlds_to_cs_file.m:
compiler/mlds_to_java_file.m:
Delete the Indent argument from the top level predicates
which always get passed Indent=0. We are not likely to ever pass
any other indent value.
Inline a function that has only one call site.
In mlds_to_java_file.m, write out the comment with the module name
regardless of whether auto-comments are enabled.
In mlds_to_java_file.m, put a blank line after the comment block
listing all the imported modules.
compiler/ml_type_gen.m:
Use // comments in sample C code.
compiler/mlds.m:
Avoid some repeated deconstructs.
compiler/mlds_to_cs_util.m:
compiler/mlds_to_java_util.m:
Always put a space after an inline comment.
Make the name of the predicate writing out inline comments
more descriptive.
compiler/mlds_to_cs_data.m:
compiler/mlds_to_java_data.m:
Conform to the change above.
library/term.m:
library/term_context.m:
As above.
Rename the term.context type as term_context.term_context, with
term.context now being defined as an equivalence type.
Replace the context_init function and predicate and the dummy_context_init
function with just one function: dummy_context. This name includes
the important part (the fact that it return a *dummy* context) and deletes
the nonimportant part (dummy contexts are just about never updated,
so the function does not really "initialize" them).
Reduce function/predicate pairs that do the same thing to just a function.
library/MODULES_DOC:
library/library.m:
Add the new module to the list of standard library modules.
NEWS:
Mention the new module, and the obsoleting of the moved predicates
and functions in term.m.
compiler/*.m:
library/*.m:
Conform to the changes above.
compiler/mlds_to_c_class.m:
compiler/mlds_to_c_data.m:
compiler/mlds_to_c_export.m:
compiler/mlds_to_c_file.m:
compiler/mlds_to_c_func.m:
compiler/mlds_to_c_global.m:
compiler/mlds_to_c_name.m:
compiler/mlds_to_c_stmt.m:
compiler/mlds_to_c_type.m:
compiler/mlds_to_c_util.m:
compiler/mlds_to_cs_class.m:
compiler/mlds_to_cs_data.m:
compiler/mlds_to_cs_export.m:
compiler/mlds_to_cs_file.m:
compiler/mlds_to_cs_func.m:
compiler/mlds_to_cs_global.m:
compiler/mlds_to_cs_name.m:
compiler/mlds_to_cs_stmt.m:
compiler/mlds_to_cs_type.m:
compiler/mlds_to_cs_util.m:
compiler/mlds_to_java_class.m:
compiler/mlds_to_java_data.m:
compiler/mlds_to_java_export.m:
compiler/mlds_to_java_file.m:
compiler/mlds_to_java_func.m:
compiler/mlds_to_java_global.m:
compiler/mlds_to_java_name.m:
compiler/mlds_to_java_stmt.m:
compiler/mlds_to_java_type.m:
compiler/mlds_to_java_util.m:
compiler/mlds_to_target_util.m:
As above.
compiler/Mercury.options:
Specify --warn-impliciy-stream-calls for all the modules above.
compiler/file_util.m:
Delete a utility predicate that expects its clients to operate on
implicit streams, since the changes above replaced the last calls to it
with the variant that expects its client to operate on explicit streams.
At the moment, we emit static initializers into generated Java code that print
a trace of class initialization to the standard output at startup. This diff
add as a new developer only option, --debug-class-init, that controls whether
we emit such debugging code. The default is now *not* to emit it.
Avoid print a commenting containing the Mercury end_module declaration at the
end of a generated Java class unless --auto-comments is given.
compiler/options.m:
Add the new option.
Fix spelling.
compiler/mlds_to_java_util.m:
Add a function for retrieving the value of --debug-class-init.
compiler/mlds_to_java_file.m:
Only emit code to trace class initialization if the new option is set.
Only emit the end_module comment if --auto-comments is set.
compiler/mlds_to_java.m:
Delete this module. Move its contents to the following eleven modules.
compiler/mlds_to_java_class.m:
Code to output class definitions.
compiler/mlds_to_java_data.m:
Code to output lvals, rvals and initializers.
compiler/mlds_to_java_export.m:
Code to output entities (e.g. enums) exported to Java.
compiler/mlds_to_java_file.m:
The top level code, generating whole Java files.
compiler/mlds_to_java_func.m:
Code to output function definitions.
compiler/mlds_to_java_global.m:
Code to output the definitions of global variables.
compiler/mlds_to_java_name.m:
Code to output various kinds of names.
compiler/mlds_to_java_stmt.m:
Code to output statements.
compiler/mlds_to_java_type.m:
Code to output types.
compiler/mlds_to_java_util.m:
Utilities used by the other mlds_to_java_*.m modules.
compiler/mlds_to_java_wrap.m:
Code to create wrapper classes, to help implement function pointers.
compiler/ml_backend.m:
Delete the old module, add the new modules.
compiler/Mercury.options:
Require the new modules to have the declarations and definitions
of their predicates in a consistent order.
compiler/mercury_compile_mlds_back_end.m:
Import mlds_to_java_file.m instead of mlds_to_java.m.
compiler/mlds.m:
compiler/mlds_to_cs.m:
Update some references to the deleted file.
compiler/mlds_to_c_class.m:
Delete some stray ZZZs.