mirror of
https://github.com/Mercury-Language/mercury.git
synced 2025-12-16 22:35:41 +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.
50 lines
1.5 KiB
C
50 lines
1.5 KiB
C
/*
|
|
** Copyright (C) 1998,2002 The University of Melbourne.
|
|
** This file may only be copied under the terms of the GNU Library General
|
|
** Public License - see the file COPYING.LIB in the Mercury distribution.
|
|
*/
|
|
|
|
/*
|
|
** mercury_trace_help.h
|
|
**
|
|
** Defines the interface of the help system for the internal debugger.
|
|
*/
|
|
|
|
#ifndef MERCURY_TRACE_HELP_H
|
|
#define MERCURY_TRACE_HELP_H
|
|
|
|
#include "mercury_trace_completion.h"
|
|
|
|
/*
|
|
** These function add a help node, which must a category or an item
|
|
** within a category. It returns NULL if the addition was successful,
|
|
** and a pointer to an error message otherwise.
|
|
*/
|
|
|
|
extern const char *MR_trace_add_cat(const char *category, int slot,
|
|
const char *text);
|
|
|
|
extern const char *MR_trace_add_item(const char *category,
|
|
const char *item, int slot, const char *text);
|
|
|
|
/*
|
|
** These functions print help to standard output.
|
|
**
|
|
** MR_trace_help prints a list of the top-level help nodes.
|
|
** MR_trace_help_word prints the text of all the help nodes with the given
|
|
** name. If there are none, it prints a list of the top-level help nodes.
|
|
** MR_trace_help_cat_item prints the text of the node at path cat/item.
|
|
*/
|
|
|
|
extern void MR_trace_help(void);
|
|
extern void MR_trace_help_word(const char *word);
|
|
|
|
extern void MR_trace_help_cat_item(const char *cat,
|
|
const char *item);
|
|
|
|
/* A Readline completer for help topics. */
|
|
extern MR_Completer_List *MR_trace_help_completer(const char *word,
|
|
size_t word_len);
|
|
|
|
#endif /* MERCURY_TRACE_HELP_H */
|