mirror of
https://github.com/Mercury-Language/mercury.git
synced 2025-12-20 08:19:28 +00:00
Estimated hours taken: 6
Branches: main
Document I/O tabling, after cleaning it up for public use.
We have previously implemented two forms of I/O tabling. One tables
only the output arguments of each primitive; this allows transparent
retries across I/O. The other tables all the arguments and the name
of the predicate; this allows transparent retries across I/O, the
declarative debugging of code that does I/O, and the printing of tabled
I/O actions. Since we now support declarative debugging in the standard
debugging grades, standardize on the second form of I/O tabling, and
make the first form accessible to implementors only, via a deliberately
undocumented option. This option, --trace-table-io-only-retry, is sort of
the inverse of the old option --trace-table-io-decl, which this change
deletes. (Only "sort of" because --trace-table-io-decl used to turn on
I/O tabling, whereas --trace-table-io-only-retry is consulted only if
I/O tabling is turned on by some other mechanism.)
NEWS:
Mention I/O tabling.
compiler/options.m:
Delete --trace-table-io-decl, and add --trace-table-io-only-retry.
Update documentation.
compiler/table_gen.m:
Base decisions on --trace-table-io-only-retry, not
--trace-table-io-decl.
compiler/handle_options.m:
Delete an implication involving --trace-table-io-decl that is now
unnecessary.
doc/user_guide.texi:
Document the idea of I/O tabling, and move the table_io command
out of the list of developer only commands into a category of its own
(since it doesn't naturally fit anywhere else).
Change the old mismatched "table_io start" "table_io end" pair to
the matched "table_io start" "table_io stop" pair.
Document the variants of the print and browse commands that print and
browse I/O actions.
Be consistent about formatting of categories of mdb commands.
Comment out some obsolete material in the documentation of retry.
doc/generate_mdb_doc:
Include the new table_io category in the list of mdb command
categories.
Squeeze out repeated blank lines in the automatically generated
documentation, to make maximum use of screen real estate.
doc/squeeze:
A new script to do the squeezing.
doc/mdb_categories:
Include the new table_io category in the list of mdb command
categories.
runtime/mercury_trace_base.[ch]:
Add a new global variable MR_io_tabling_allowed. It is initialized
to TRUE in debugging grades and FALSE in other grades.
trace/mercury_trace_internal.c:
Accept "table_io begin" and "table_io end" as well as "table_io start"
and "table_io stop". Consistently use "start" and "stop" in output.
Make "table_io" print a message saying the executable is not set up
for I/O tabling unless MR_io_tabling_allowed is set.
Add a new command, "table allow", that sets MR_io_tabling_allowed to
TRUE. In debugging grades, this has no effect. In other grades, it
allows I/O tabling, even though some parts of the program may have
been compiled with --trace-table-io and some without. This
inconsistency can yield weird results, which is why this command is
deliberately undocumented. However, we can use it in a disciplined
fashion to test I/O tabling even in nondebugging grades, thus spotting
any regression in this area more quickly than if we tested I/O tabling
only in debugging grades.
tests/debugger/Mercury.options:
tests/debugger/declarative/Mercury.options:
Delete all occurrences of --trace-table-io-decl, since its effect is
now the default.
tests/debugger/mdb_command_test.inp:
Move the location of the table_io command test in this autogenerated
file to reflect its move to a new category.
tests/debugger/tabled_read*.{inp,exp}:
tests/debugger/declarative/tabled_read*.{inp,exp}:
Execute "table_io allow" before trying to turn on I/O tabling, since
this is now required in non-debugging grades.
Reflect the change in terminology: expect "stopped", not "ended",
24 lines
708 B
Bash
Executable File
24 lines
708 B
Bash
Executable File
#!/bin/sh
|
|
#---------------------------------------------------------------------------#
|
|
# Copyright (C) 2002 The University of Melbourne.
|
|
# This file may only be copied under the terms of the GNU General
|
|
# Public License - see the file COPYING in the Mercury distribution.
|
|
#---------------------------------------------------------------------------#
|
|
|
|
# Replace any sequence of blank lines in the input with a single blank line.
|
|
# If invoked with arguments, the input is the concatenation of the named files;
|
|
# if invoked without arguments, the input is standard input.
|
|
|
|
awk '
|
|
$0 ~ /^[ \t]*$/ {
|
|
if (empties == 0)
|
|
print;
|
|
|
|
empties++;
|
|
}
|
|
$0 !~ /^[ \t]*$/ {
|
|
empties = 0;
|
|
print;
|
|
}
|
|
' $@
|