mirror of
https://github.com/Mercury-Language/mercury.git
synced 2026-04-15 17:33:38 +00:00
Estimated hours taken: 40
Branches: main
Add support for command line completion to mdb.
NEWS:
Document the change.
trace/mercury_trace_completion.{c,h}:
Define the framework for completion.
Examine command lines to determine which completers to use.
trace/mercury_trace_alias.{c,h}:
trace/mercury_trace_help.{c,h}:
trace/mercury_trace_internal.{c,h}:
trace/mercury_trace_tables.{c,h}:
trace/mercury_trace_vars.{c,h}:
Define context-specific completers.
trace/mercury_trace_help.c:
Record all help topics in an array for use by the completer.
trace/mercury_trace_internal.c:
Add completion information to the list of commands.
Add a function MR_trace_command_completion_info to access
that information.
runtime/mercury_wrapper.{c,h}
Add a runtime option `--force-readline', which tells mdb to
use readline even if MR_mdb_in is not a tty. This is needed
for tests/debugger/completion. `--force-readline' is not
documented because I'm not sure that it will work properly
in all situations (it's fine for the test).
Fix capitalisation in references to the Mercury User's Guide
in error messages.
trace/mercury_trace_readline.c:
Tell Readline to use our completer.
Handle `--force-readline'. Disable some Readline terminal
initialisation code which reports spurious warnings if the
input stream is not a tty.
trace/Mmakefile:
Add mercury_trace_completion.{c,h}.
runtime/mercury_array_macros.h:
Define a macro MR_find_first_match, which is like MR_bsearch
except that it finds the first match, not an arbitrary match.
runtime/mercury_memory.c:
Handle NULL pointers in MR_copy_string();
runtime/mercury_memory.h:
Add a macro MR_free_func which returns the address of free().
Used where it is necessary to pass the address of MR_free().
tests/debugger/Mmakefile:
tests/debugger/completion.m:
tests/debugger/completion.exp:
tests/debugger/completion.inp:
tests/debugger/completion.inputrc:
tests/debugger/completion.sub1.m:
tests/debugger/completion.sub2.m:
tests/debugger/completion.sub2.sub3.m:
Test case.
The Mercury test suite is (dis)organized into a directory hierarchy. Each subdirectory has a script named "runtests" that runs the tests in that subdirectory; these indicate the presence of any errors by returning a nonzero exit status. The runtests script in each directory invokes the runtests scripts in all subdirectories, and propagates any nonzero exit status upwards. Both the bootcheck script and the nightly script use the main runtests script to run all the tests. benchmarks This directory contains Mercury versions of the benchmarks. These tests work by comparing the output of the Mercury and the NU-Prolog versions. debugger This directory is for testing mdb, the Mercury debugger. Programs are compiled with deep tracing turned on. The tests in this directory are not performed if the base grade is `jump' or `fast'. debugger/declarative This directory is for testing the declarative debugging features of mdb. general This directory is for general test cases. (It might be a good idea to split this into tests of particular features and regression tests that check for old bugs. But for the moment, just about everything goes in here.) These tests work by comparing the output of the Mercury and the NU-Prolog versions. hard_coded This directory is for tests of features that don't work in NU-Prolog. The expected output of the program has to be hard-coded in a hand-written `.exp' file, rather having the `.exp' file be generated automatically using NU-Prolog. recompilation This directory contains tests of the smart recompilation system. valid This directory is for test cases that are not complete programs. We just check that the files compile. invalid This directory is for test cases that are invalid programs. We check that the files do *not* compile. warnings This directory is for tests of compiler warnings. These work by comparing the warnings emitted by the compiler with those given in the hand-written `.exp' file. To regenerate the expected output files for the benchmark and general directories, execute the "generate_exp" script in this directory.