Commit Graph

22 Commits

Author SHA1 Message Date
Peter Ross
6f1f7f0083 Add Mercury versions of code which has been defined only as
Estimated hours taken: 1
Branches: main

browser/collect_lib.m:
browser/declarative_debugger.m:
browser/declarative_execution.m:
browser/dl.m:
browser/interactive_query.m:
browser/io_action.m:
browser/mdb.m:
browser/name_mangle.m:
browser/util.m:
	Add Mercury versions of code which has been defined only as
	foreign procs so as to allow this directory to compile for
	the non-C backends.
	The Mercury versions just call private_builtin__sorry.
2003-02-06 13:37:08 +00:00
Mark Brown
2fe0dfa705 Change the declarative debugger so it always prints syntactically
Estimated hours taken: 1.5
Branches: main

Change the declarative debugger so it always prints syntactically
correct goals.

browser/declarative_user.m:
	Print atoms using browse__print_synthetic. This means that goals
	will always be syntactically correct, even if they are printed
	in the multi-line form.

	Make the predicates write_decl{_init,_final,}_atom take an argument
	of type browse_caller_type.  When printing a single goal use the
	caller type "print", and when printing a sequence of goals use
	"print_all".

browser/browse.m:
	When writing out a synthetic term using io__write_univ, check for
	arguments with type util__unbound.  Print such values as a single
	unquoted underscore (io__write_univ would print an underscore in
	single quotes, which means something different).

browser/util.m:
	Export functions is_predicate and is_function to convert values of
	type pred_or_func to values of type bool.

tests/debugger/print_goal.exp:
tests/debugger/queens_rep.exp:
	Update the output of these tests after the change to browse.m.

tests/debugger/declarative/app.exp:
tests/debugger/declarative/app.exp2:
tests/debugger/declarative/filter.exp:
tests/debugger/declarative/filter.exp2:
tests/debugger/declarative/input_term_dep.exp:
tests/debugger/declarative/input_term_dep.exp2:
tests/debugger/declarative/output_term_dep.exp:
tests/debugger/declarative/output_term_dep.exp2:
tests/debugger/declarative/queens.exp:
tests/debugger/declarative/tabled_read_decl.exp:
tests/debugger/declarative/tabled_read_decl.exp2:
	Update the output of these test cases.
2002-10-16 03:15:33 +00:00
Zoltan Somogyi
5691b9b58e Avoid a warning by adding IO = IO0 in a foreign_proc.
Estimated hours taken: 0.1
Branches: main

browser/util.m:
	Avoid a warning by adding IO = IO0 in a foreign_proc.
2002-09-16 02:26:15 +00:00
Fergus Henderson
5b6a084535 Fix a bug which broke tests/debugger/interactive_query in non-GC grades,
Branches: main
Estimated hours taken: 2

Fix a bug which broke tests/debugger/interactive_query in non-GC grades,
e.g. asm_fast on murlibobo (dec-alpha-osf*).

browser/util.m:
	Fix a bug: call_trace_getline needs to be annotated with
	`will_not_call_mercury' instead of `may_call_mercury'.
	This is required because the code for it accesses MR_hp,
	which is only valid if `will_not_call_mercury' is specified.

	The fix also required changing the return type from bool to int,
	so that it can return the right value without calling Mercury code.
2002-08-13 15:32:35 +00:00
Zoltan Somogyi
2002c3aac0 Fix a bug: call_trace_getline now may call Mercury.
Estimated hours taken: 2
Branches: main

browser/util.m:
	Fix a bug: call_trace_getline now may call Mercury. Asserting
	will_not_call_mercury was causing succip to be clobbered,
	which lead to test case failures whose symtom was that the
	declarative debugger did not report the bug it found.
2002-07-30 10:24:36 +00:00
Simon Taylor
82ba3eede2 Fix a bug in Zoltan's last change which broke hlc grades.
Estimated hours taken: 0.1
Branches: main

browser/util.m:
	Fix a bug in Zoltan's last change which broke hlc grades.
	Use `:- pragma foreign_import_module(c, bool)' rather
	than `#include "bool.h"'.
2002-07-23 02:30:55 +00:00
Zoltan Somogyi
048f8357cf Until now, programmers could add `tabled_for_io' annotations to foreign_procs
Estimated hours taken: 12
Branches: main

Until now, programmers could add `tabled_for_io' annotations to foreign_procs
that do I/O, which asks the compiler to make those foreign_procs idempotent,
i.e. ensures that they are performed at most once even in the presence of a
retry operation in the debugger. This change adds a compiler option,
--trace-table-io-require, which generates an error if a foreign_proc that does
I/O does not have this annotation. Specifying this option thus ensures
that all I/O done by the program is idempotent.

In the future, we may want to have this option turned on in all debugging
grades. Until we decide about, the new option is not yet documented.

compiler/options.m:
	Add the new option --trace-table-io-require.

compiler/handle_options.m:
	Make --trace-table-io-require imply --trace-table-io.

compiler/table_gen.m:
	If --trace-table-io-require is enabled, require all I/O primitives
	to have the tabled_for_io annotation.

compiler/mercury_compile.m:
	Pass I/O states to table_gen.m, since it can now generate error
	messages.

trace/mercury_trace_util.h:
trace/mercury_trace_vars.c:
	When calling Mercury code from the trace directory, disable I/O
	tabling, since any I/O actions executed by Mercury code in the browser
	directory (or by library code called from there) should not be tabled,
	not being part of the user program.

	Due to the depth of nesting, make mercury_trace_vars.c use four-space
	indentation.

browser/collect_lib.m:
browser/declarative_debugger.m:
browser/declarative_execution.m:
browser/dl.m:
browser/io_action.m:
browser/mdb.m:
browser/name_mangle.m:
browser/util.m:
compiler/gcc.m:
compiler/mercury_compile.m:
compiler/passes_aux.m:
compiler/process_util.m:
compiler/stack_layout.m:
library/io.m:
library/time.m:
tests/debugger/declarative/tabled_read_decl.m:
	Add a whole lot of tabled_for_io annotations, to enable the compiler to
	bootstrap with --trace-table-io-require enabled.

	In many cases, this required turning old-style pragma c_code into
	pragma foreign_proc. While doing that, I standardized the layouts
	of pragma foreign_procs.

browser/util.m:
	Turn an impure semidet predicate into a pure det predicate with I/O
	states, to allow it to be tabled. Make it return a Mercury bool
	to indicate success or failure.

library/bool.m:
	Add functions that allow C code to get their hands on the constants
	`yes' and `no', for communication with Mercury code.

library/table_builtin.m:
	Add debugging code to the main primitive of I/O tabling. This is
	controlled both by the macro for retry debugging and a boolean global.

library/mercury_trace_base.[ch]:
	Add the boolean global variable to switch the new debugging code in
	table_builtin.m on and off.

library/mercury_trace_internal.c:
	When starting I/O tabling with retry debug enabled, turn on the switch.

tests/debugger/queens.exp3:
	New expected output file that applies when the library is compiled with
	--trace-table-io-require.
2002-07-22 07:13:14 +00:00
Simon Taylor
b7c4a317e9 Add MR_ prefixes to the remaining non-prefixed symbols.
Estimated hours taken: 4
Branches: main

Add MR_ prefixes to the remaining non-prefixed symbols.

This change will require all workspaces to be updated
The compiler will start generating references to MR_TRUE,
MR_bool, etc., which are not defined in the old runtime
header files.

runtime/mercury_std.h:
	Add MR_ prefixes to bool, TRUE, FALSE, max, min,
	streq, strdiff, strtest, strntest, strneq, strndiff,
	strntest, NO_RETURN.

	Delete a commented out definition of `reg'.

runtime/mercury_tags.h:
	Add an MR_ prefix to TAGBITS.

configure.in:
runtime/mercury_goto.h:
runtime/machdeps/i386_regs.h/mercury_goto.h:
	Add an MR_ prefix to PIC.

runtime/mercury_conf_param.h:
	Allow non-prefixed PIC and HIGHTAGS to be defined on
	the command line.

runtime/mercury_bootstrap.h:
	Add backwards compatibility definitions.

RESERVED_MACRO_NAMES:
	Remove the renamed macros.

compiler/export.m:
compiler/ml_code_gen.m:
	Use MR_bool rather than MR_Bool (MR_Bool is
	meant to be for references to the Mercury type
	bool__bool).

runtime/mercury_types.h:
	Add a comment the MR_Bool is for references to
	bool__bool.

*/*.c:
*/*.h:
*/*.m:
	Add MR_ prefixes.
2002-02-18 07:01:33 +00:00
Zoltan Somogyi
e1778fbc75 Give the debugger the ability to print goals.
Estimated hours taken: 20
Branches: main

Give the debugger the ability to print goals.

NEWS:
	Mention the new ability.

browser/browser_info.m:
	Define a new type, browser_term, which represents either a plain term,
	or a "synthetic term", which is a string (predicate or function name),
	a list of argument values, and an indication of whether the synthetic
	term is a predicate goal (i.e. of the form p(a1, ..., an)) or a
	function goal (i.e. of the form f(a1, ..., an-1) = an).

	Add utility predicates for processing browser_terms.

browser/browse.m:
	Add predicates for printing and browsing synthetic terms, and export
	them to C code.

browser/browse.m:
browser/size_pretty.m:
	Generalize lots of predicates to handle browser_terms, not just plain
	terms.

browser/util.m:
	Add a new type, "unbound", for use by mercury_trace_vars.c.

library/pprint.m:
	Add functions for converting synthetic terms to docs.

	Fix a potential efficiency problem: an unnecessary deconstruct.

runtime/mercury_type_info.h:
	Add macros for defining static type_infos in C code.

	Add macros for computing the names of type_ctor_infos even in non-hlc
	grades.

	Give C code access to the representation of bools and of values of
	the new type "unbound".

trace/mercury_trace_browse.[ch]:
	Add functions for printing goals.

trace/mercury_trace_internal.c:
	Add code to recognize and handle the commands "print goal" and
	"browse goal".

doc/user_guide.texi:
	Document the new commands.

trace/mercury_trace_vars.[ch]:
	Add a function to compute the components of synthetic terms.

tests/debugger/browse_pretty.{inp,exp*}:
	Add new commands to the input to test the printing and browsing of
	predicate goals, and update the expected outputs accordingly.

tests/debugger/polymorphic_output.{inp,exp*}:
	Add new commands to the input to test the printing and browsing of
	function goals, and update the expected outputs accordingly.
2002-01-12 09:08:15 +00:00
Erwan Jahier
860dd288aa Add line numbers in Morphine.
Estimated hours taken: 3
Branch: main


Add line numbers in Morphine.

trace/mercury_trace_external.c
	Modify MR_output_current_slots() so that it takes a MR_Event_Info *
	rather than a MR_Label_Layout *. The reason is that I need it to
	get the parent of the current event. I need the parent of the current
	goal because I want the line number where the call is made,
	not the one where the procedure is defined.

	Add the line number as an output of ML_DI_output_current_slots_*.


browser/util.m
	Define the line_number type.

browser/debugger_interface.m
	Add the line number as argument of output_current_slots/13.


extras/morphine/source/current_slots.op
	Add the line number as argument of current_attributes/12.

extras/morphine/source/display.op
	Add the line number as argument of attribute_display/12 and
	of the attribute_display parameter.

extras/morphine/source/event_attributes.op
	Define the new event attribute alias.

extras/morphine/non-regression-tests/test_vars.exp:
extras/morphine/non-regression-tests/queens.exp:
	Update the expected output of the non-regression test.

extras/morphine/non-regression-tests/queens.in:
	Disable the testing of the browser as it is currently broken.
2001-06-22 15:20:28 +00:00
Fergus Henderson
8b0dcbb231 Various fixes to get the GCC back-end interface to bootstrap.
Estimated hours taken: 20

Various fixes to get the GCC back-end interface to bootstrap.

library/exception.m:
	Define function versions of mercury__exception__builtin_catch_3_p_*.
	This is needed (a) in case we take their address, and (b) for the
	GCC back-end interface, where we can't use C macros, since we're
	compiling to assembler.

browser/dl.m:
browser/util.m:
browser/interactive_query.m:
compiler/stack_layout.m:
	Add #includes for header files needed by these modules.

browser/dl.m:
	Delete an unnecessary nested extern declaration, to avoid
	a warning from `gcc -Wshadow'.

compiler/mlds_to_gcc.m:
	When calling mlds_to_c to process foreign_code, make all
	definitions public, so that the can be used from the assembler
	code that we generate in mlds_to_gcc.

	Don't call mlds_to_c to generate `.c' and `.h' files if the
	module contains only `pragma foreign_decls', not `pragma
	foreign_code', `pragma foreign_proc', or `pragma export'.
	This change is needed to avoid calling mlds_to_c when
	intermodule optimization is enabled and `pragma c_header_code'
	declarations have been read in from the `.opt' file and have
	propagated through to the MLDS.  Calling mlds_to_c when the
	module itself doesn't contain C code breaks things, since
	Mmake won't compile and link in the generated `.c' files, but
	those files contain the definition of the `*__init_type_tables()'
	functions that are referenced by `*_init.c'.

	XXX This is not quite right, since if the module itself contains
	`pragma foreign_decls', the `.h' file might be needed.
	But the Mercury standard library needs intermodule optimization
	enabled for `make install' to work.
	A better fix would be to ignore foreign_decls that were defined
	in other modules, but to call mlds_to_c for foreign_decls
	that were defined in the module that we're compiling.

compiler/modules.m:
	Change the code which decides when to link in extra object files
	for foreign code to reflect the above change to when mlds_to_gcc.m
	invokes mlds_to_c.m.

compiler/mlds_to_c.m:
	When target=asm, i.e. we're compiling to asm, but mlds_to_c.m
	has been invoked to generate C code for a `foreign_code',
	`foreign_proc', or `pragma export' declaration, don't generate
	#include directives for the imported modules, since we may not
	have generated any header file for them.

	XXX This is a bit of a hack; it might sometimes lead to
	problems, since the header files might sometimes be needed.
	But including them unconditionally is definitely wrong,
	since they may not exist, and so this change is needed to get
	the compiler to bootstrap.

compiler/Mmakefile:
	Add a dependency of mercury_compile on $(GCC_BACK_END_LIBS),
	so that we know to relink it if the GCC back-end has changed.
	(That variable is set to empty if we're not linking in the GCC
	back-end, so it won't cause problems when not using the GCC
	back-end.)

library/Mmakefile:
browser/Mmakefile:
compiler/Mmakefile:
	Add an `ss' target, for use by tools/bootcheck.

tools/bootcheck:
	Add `--target asm' option.  If that is set, pass `--target asm'
	to mmake, and build and compare the stage 3 `.s' files rather
	than the `.c' files.

	Also add `--make-opts' option, for passing options to `make'.
	Put `-k' in `--make-opts', not `--mmake-opts', since `-k' is
	an option to `make', not to `mmake'.  This makes a difference
	since although `make' options can be passed to `mmake', any
	options after the first `make' option are assumed to be
	options to `make', not to `mmake'.
2001-01-29 06:47:32 +00:00
Mark Brown
954aad1dce Distinguish between predicates and functions in the declarative debugger.
Estimated hours taken: 2.5

Distinguish between predicates and functions in the declarative debugger.

browser/declarative_execution.m:
	Add a pred_or_func field to trace_atom.

trace/mercury_trace_declarative.c:
	Construct trace atoms with the extra field.

browser/declarative_user.m:
	Print function call results using function syntax.

browser/debugger_interface.m:
browser/util.m:
	Move the definition of type pred_or_func to util.m, so it can
	be used by the declarative debugger as well as the external debugger.

runtime/mercury_stack_layout.h:
	Update a reference to the location of type pred_or_func.

tests/debugger/declarative/Mmakefile:
tests/debugger/declarative/func_call.{m,inp,exp}:
	Test case for the new feature.

tests/debugger/declarative/*.exp:
tests/debugger/declarative/*.exp2:
	Update expected output from tests.
2000-10-01 03:13:43 +00:00
Mark Brown
a3f7964491 Minor fixups to my last change.
Estimated hours taken: 0.1

Minor fixups to my last change.

browser/util.m:
	- Avoid unnecessary casts.
	- Use 'MR_free' rather than 'free'.

trace/mercury_trace_internal.c:
	Better comments for MR_trace_get_command.
2000-08-26 17:47:02 +00:00
Mark Brown
7d66a930c7 Allow multiple browser commands on one line, separated by semicolons.
Estimated hours taken: 3

Allow multiple browser commands on one line, separated by semicolons.

trace/mercury_trace_internal.c:
trace/mercury_trace_internal.h:
	Separate the code for splitting lines and checking for EOF into
	a new function, MR_trace_get_command.

browser/parse.m:
	Call util__trace_get_command to read each command.

browser/util.m:
	Implement util__trace_get_command, which calls the function
	in the trace directory via an indirect pointer.

runtime/mercury_init.h:
runtime/mercury_wrapper.c:
runtime/mercury_wrapper.h:
util/mkinit.c:
	Set up the indirect pointer to the new function.

tests/debugger/browser_test.inp:
tests/debugger/browser_test.exp:
tests/debugger/browser_test.exp2:
	Test the new feature.
2000-08-26 04:34:36 +00:00
Peter Ross
ae43e3ec1d Change the MercuryFile structure so that it now contains pointers to
Estimated hours taken: 20

Change the MercuryFile structure so that it now contains pointers to
functions which operate on the MercuryFile.  This allows us, for
example, to create a MercuryFile structure which operates on sockets and
use the predicates in io.m to operate on the socket stream.


runtime/mercury_library_types.h:
    Define the new implementation of MercuryFile structure.
    The MercuryFile structure now contains pointers to functions to do
    all the basic I/O operations.
    Define macros to access all the different parts of the MercuryFile
    structure.

runtime/mercury_file.h:
runtime/mercury_file.c:
    Implement a MercuryFile structure which operates on C FILE *'s.

library/io.m:
    Call the basic I/O operations from the MercuryFile structure.
    Explicitly check that we are using a file stream when required.
    As we cannot supply a variable number of arguments to a macro,
    define a new function ML_fprintf() to provide fprintf functionality.
    Hide all direct access to the MercuryFile data structure behind
    macros.

browser/util.m:
trace/mercury_trace_browse.c:
trace/mercury_trace_declarative.c:
trace/mercury_trace_external.c:
    Hide all direct access to the MercuryFile data structure behind
    macros.

extras/logged_output/Mmakefile:
extras/logged_output/README:
extras/logged_output/logged_output.m:
extras/logged_output/main.m:
    Add an example of defining a new MercuryFile structure.  This new
    structure defines an output stream which writes to stdout and logs
    to a file at the same time.

runtime/Mmakefile:
    Add the new files mercury_file.{c,h}.

runtime/mercury_imp.h:
    Include `mercury_file.h'.
2000-08-11 16:50:24 +00:00
Simon Taylor
9ba3b14098 Make all the modules in the browser library sub-modules of
Estimated hours taken: 1

Make all the modules in the browser library sub-modules of
module `mdb', to avoid link errors when users use module names
such as `parse'.

browser/Mmakefile:
browser/browser_library.m:
browser/mdb.m:
	Rename browser_library.m to mdb.m.
	Change `:- import_module' declarations to
	`:- include_module' declarations.

browser/Mmakefile:
	Remove the special case rule for `mer_browser.init' --
	it doesn't work when the file names are not the same
	as the module name. Instead, the default rule for `mdb.init'
	is used and the output is copied to `mer_browser.init'.

browser/.cvsignore:
	Rename header files, etc.

browser/*.m:
	Add a `mdb__' prefix to the names of modules in the browser library
	in `:- module' and `:- import_module' declarations.

trace/*.c:
	Rename the header files for the browser library in
	`#include' statements.

tests/hard_coded/Mmakefile:
tests/hard_coded/parse.m:
tests/hard_coded/parse.exp:
	Test case.
2000-02-04 03:45:53 +00:00
Fergus Henderson
8e6273cd46 Fix a bug reported by Erwan Jahier:
Estimated hours taken: 0.25

browser/util.m:
	Fix a bug reported by Erwan Jahier:
	the order of the enum here should match that
	in runtime/mercury_trace_base.h.

runtime/mercury_trace_base.h:
	Update the documentation to point to browser/util.m
	rather than browser/debugger_interface.m.
1999-12-15 19:11:01 +00:00
Mark Brown
9179be5e15 Implement a new data structure for declarative debugging.
Estimated hours taken: 160

Implement a new data structure for declarative debugging.  The
major differences between this and the old implementation are:
	- The data structure is implemented in Mercury.  The definition
	  of the type, and procedures for constructing values of that
	  type, have been moved from trace/mercury_trace_declarative.{c,h}
	  to browser/declarative_execution.m (which is a new module).
	- The front end no longer needs to call the back end via an
	  indirect pointer---the front end does not call the back end at
	  all.
	- The data structure is not specifically for wrong answer
	  analysis, it is intended to be used for any sort of analysis.
	- The data structure represents execution at a lower level---the
	  new front end defines a more abstract view in terms of this
	  data structure.

Implement a test harness for debugging the front end code.  This allows
the front end to run as a stand-alone program, which can then be
debugged using `mdb'.

The code in the front end does not currently handle the new structure
very nicely.  This is because that code is about to undergo some major
structural changes, so there is little point cleaning it up now.
Consequently:
	- Some of the code in the front end is incorrect (eg. the
	  user interface does not print missing answer nodes
	  properly).
	- The tests have not been reinstated.
These things will be fixed in subsequent changes.

Likewise the compiler still reserves two stack slots, even though
only one is required.  After this change the algorithm should be able
to get away with using no stack slots, so modifications to the compiler
will be postponed until then.

browser/declarative_execution.m:
	New module.  Implement the execution_tree typeclass, which
	represents the execution of a Mercury program.  Implement
	two instances of this typeclass, one for normal use and one for
	testing purposes.

browser/declarative_test.m:
	New module.  A test harness that can be compiled as a
	stand-alone program, enabling the front end to be debugged.

trace/mercury_trace_declarative.c:
trace/mercury_trace_declarative.h:
	- Remove the definition of the old data structure.
	- Add some macros which enable the new Mercury data structure
	  to be destructively updated by C code.
	- Change the interface to this module so that it reflects more
	  general diagnosis, not just wrong answer analysis.
	- Implement the new algorithm.
	- Call an alternative front end if in test mode.
	- Update comments.

trace/mercury_trace_internal.h:
	Add a new mode for debugging the declarative debugger.

trace/mercury_trace_internal.c:
	Change the command from `dd_wrong' to `dd', since it is not
	specifically for wrong answer analysis.  Add a new command
	`dd_dd' which calls the alternative front end used for testing.

runtime/mercury_init.h:
runtime/mercury_wrapper.c:
runtime/mercury_wrapper.h:
util/mkinit.c:
	Remove any reference to `MR_edt_root_node', since it is no
	longer used.

browser/declarative_debugger.m:
	- Add a case for missing answer nodes to `edt_node'.
	- Change the `evaluation_tree' typeclass into `mercury_edt'
	  typeclass.  This is to make it more distinct from the new
	  `execution_tree' typeclass, which is a lower level concept.
	- New interface to the diagnoser: types `diagnoser_response'
	  and `diagnoser_state', and procedure `diagnosis'.
	- Define an instance of `mercury_edt' from an instance of
	  `execution_tree'.
	- Updates to the analyser to get it to compile---further changes
	  will be forthcoming.

browser/declarative_user.m:
	- Updates to the user interface to get it to compile---further
	  changes will be forthcoming.

browser/browser_library.m:
	Import the new module (declarative_execution.m).

browser/debugger_interface.m:
browser/util.m:
	Move the definitions of trace_port_type and goal_path_string
	to browser/util.m, since they are now used by more than just
	the external debugger.

browser/Mmakefile:
	Add the test harness as a `depend' target.

browser/browse_test.m:
	Use the correct interface to the browser.
1999-11-30 00:05:08 +00:00
Zoltan Somogyi
acb3438bfd Put MR_ prefixes on uses of make_aligned_string() in order to allow
Estimated hours taken: 0.2

library/*.m:
	Put MR_ prefixes on uses of make_aligned_string() in order to allow
	bootstrap with -DMR_NO_BACKWARDS_COMPAT.
1999-11-15 10:13:08 +00:00
Mark Brown
07cad7c169 If calling from the internal debugger, use readline input for the
Estimated hours taken: 6

If calling from the internal debugger, use readline input for the
interactive term browser and interactive queries.

browser/browse.m:
	Change some if-then-elses to switches, which will help
	catch errors if a new functor is added to the debugger type.

browser/parse.m:
browser/util.m:
	Return a string from util__trace_getline/4 rather than a
	list of chars, which saves converting from a string to a list
	of chars and then back again.

browser/util.m:
	Add a version of util__trace_getline that also takes I/O
	stream arguments.  Pass these arguments to MR_trace_getline.

browser/declarative_oracle.m:
	Call util__trace_getline/4 to do input via readline (if
	available).  Improve error handling.

browser/interactive_query.m:
	Call util__trace_getline to get user input, instead of
	standard library predicates.

runtime/mercury_init.h:
runtime/mercury_wrapper.c:
runtime/mercury_wrapper.h:
trace/mercury_trace_internal.c:
trace/mercury_trace_internal.h:
	Add two I/O stream arguments to MR_trace_getline.
1999-05-30 03:55:13 +00:00
Mark Brown
2bbf02daaf Use the same method of input for the browser as for the internal
Estimated hours taken: 5

Use the same method of input for the browser as for the internal
tracer.  Previously, the browser did input via the Mercury library
and the internal tracer did input via readline (if available).  This
did not work properly if files were redirected into stdin, which meant
that test cases could not be written for the browser.  This change
also adds a test case.

browser/util.m:
	Add a predicate, util__trace_getline/4, which does input via
	the same method used by the internal debugger.

browser/parse.m:
	Call util__trace_getline/4 instead of io__read_line/3.

browser/browse.m:
	Pass the prompt to browser/parse.m as a string, rather than
	printing it before calling.

trace/mercury_trace_internal.c:
trace/mercury_trace_internal.h:
	Declare MR_trace_getline extern.

runtime/mercury_init.h:
runtime/mercury_wrapper.c:
runtime/mercury_wrapper.h:
util/mkinit.c:
	Make MR_trace_getline available to the browser via a function
	pointer.

tests/debugger/Mmakefile:
	Add the new test case.

tests/debugger/browser_test.m:
tests/debugger/browser_test.inp:
tests/debugger/browser_test.exp:
	The new test case.

runtime/mercury_trace_base.c:
runtime/mercury_trace_base.h:
	Export MR_tracing_not_enabled() for use by browser/util.m.
1999-05-14 02:25:53 +00:00
Bert Thompson
eee1996975 Add a simple term browser for use by the trace-based debugger.
Estimated hours taken: 40

Add a simple term browser for use by the trace-based debugger.

This is minimal but useful browser. Not included in this version
are a scripting language, Windows Explorer-style tree expansion,
and other features not yet thought of.

N.B. This still needs to be hooked into the debugger.

browser/Mmakefile:
	Added target browse_test.

browser/browser_library.m:
	Added modules required for the browser.

browser/browse_test.m:
	A simple driver for the browser with an example
	data structure to browse. (new file)

browser/browse.m:
	The browser proper. (new file)

browser/parse.m:
	Parser for browser's command language. (new file)

browser/util.m:
	Miscellaneous utilities used in the browser code. (new file)

browser/frame.m:
	Bare minimal ASCII graphics frames. (new file)
1998-10-25 07:16:41 +00:00