Commit Graph

41 Commits

Author SHA1 Message Date
Zoltan Somogyi
dadf30718d Add io.write_line_cc/4.
library/io.m:
    Add a version of io.write_line_cc that takes an explicit stream argument.

NEWS:
    Announce the addition.

browser/interactive_query.m:
    Use the new predicate.
2021-03-06 22:09:49 +11:00
Zoltan Somogyi
eeb69f14ba Use explicit streams in browser/*.m.
browser/browse.m:
browser/browser_info.m:
browser/collect_lib.m:
browser/declarative_debugger.m:
browser/declarative_oracle.m:
browser/declarative_user.m:
browser/diff.m:
browser/help.m:
browser/interactive_query.m:
browser/parse.m:
browser/util.m:
    Replace implicit streams with explicit streams.

    Shorten lines longer than 79 chars.

    In some places, simplify some code, often using constructs such as
    string.format that either did not exist or were too expensive to use
    when the original code was written.

    In some places, change predicate names that were not meaningful
    without module qualification by *including* the module qualification
    in the name (e.g. init -> browser_info_init).

    In some places, add XXXs.

    In browser_info.m, make the output stream *part* of the debugger type,
    because without this, having the debugger type belong to the stream
    typeclass does NOT make sense. (The typeclass instance for debugger
    used to always write to the current output stream, which this diff
    is replacing with the use of explicitly specified streams.)

    In browse.m, consistently put stream arguments before other arguments.

    In browse.m, when exporting Mercury predicates to C, export them
    under names with the standard ML_BROWSE_ prefix, NOT under the name
    of a *different* predicate with that prefix.

    In diff.m, eliminate an unnecessary difference between what we print
    when the difference between two terms is at the root, vs what we print
    when the difference between two terms is lower down.

    In interactive_query.m, when trying to write a program out to a file,
    do NOT write the program to the current output stream if we cannot open
    the file, since that would accomplish nothing useful.

    Also in interactive_query.m, cleanup .dylib instead of .so on MacOS.

    In util.m, delete some unused predicates.

    In collect_lib.m, document why some code is not worth updating.

    In declarative_oracle.m, rename predicates with previously-ambiguous
    names.

browser/MDBFLAGS.in:
    Specify --warn-implicit-stream-calls for all Mercury modules
    in the browser directory from now.

trace/mercury_trace_browse.c:
trace/mercury_trace_cmd_browsing.c:
ssdb/ssdb.m:
    Conform to the changes in browser/*.m.

tests/debugger/queens.{exp,exp2}:
    Expect the extra output from browser/diff.m.
2021-03-05 22:54:28 +11:00
Mark Brown
d465fa53cb Update the COPYING.LIB file and references to it.
Discussion of these changes can be found on the Mercury developers
mailing list archives from June 2018.

COPYING.LIB:
    Add a special linking exception to the LGPL.

*:
    Update references to COPYING.LIB.

    Clean up some minor errors that have accumulated in copyright
    messages.
2018-06-09 17:43:12 +10:00
Zoltan Somogyi
6ea8406ac8 Fix more warnings from --warn-inconsistent-pred-order-clauses.
browser/browse.m:
browser/browser_info.m:
browser/collect_lib.m:
browser/debugger_interface.m:
browser/declarative_analyser.m:
browser/declarative_debugger.m:
browser/declarative_edt.m:
browser/declarative_execution.m:
browser/declarative_oracle.m:
browser/declarative_test.m:
browser/declarative_tree.m:
browser/declarative_user.m:
browser/diff.m:
browser/dl.m:
browser/frame.m:
browser/help.m:
browser/interactive_query.m:
browser/io_action.m:
browser/listing.m:
browser/mdb.m:
browser/mer_browser.m:
browser/name_mangle.m:
browser/term_rep.m:
browser/tree234_cc.m:
    Fix inconsistencies between (a) the order in which functions and predicates
    are declared, and (b) the order in which they are defined.

    In most modules, either the order of the declarations or the order
    of the definitions made sense, and I changed the other to match.
    In some modules, neither made sense, so I changed *both* to an order
    that *does* make sense (i.e. it has related predicates together).

    In some places, put dividers between groups of related
    functions/predicates, to make the groups themselves more visible.

    In some places, fix comments or programming style.

browser/MDB_FLAGS.in:
    Since all the modules in this directory are now free from any warnings
    generated by --warn-inconsistent-pred-order-clauses, specify that option
    by default in this directory to keep it that way.
2017-04-29 14:08:50 +10:00
Zoltan Somogyi
056d2213af Avoid using some Mercury keywords.
browser/browser_info.m:
    Avoid using "output" (and "input", for the sake of symmetry)
    as function symbols.

browser/debugger_interface.m:
    Avoid using "pred" and "func" as function symbols by putting a prefix
    before each function symbol in the affected type.

browser/dl.m:
    Avoid using "local" (and "global", again for symbols) as function symbols.

profiler/output_prof_info.m:
    Avoid using "output" as a type name and as a function symbol.

browser/browse.m:
browser/collect_lib.m:
browser/declarative_user.m:
browser/interactive_query.m:
profiler/generate_output.m:
profiler/output.m:
    Conform to the changes above.

extras/morphine/source/browse.op:
extras/morphine/source/collect.op:
extras/morphine/source/current_arg.op:
extras/morphine/source/current_slots.op:
extras/morphine/source/exec_control.op:
extras/morphine/source/forward_move.op:
extras/morphine/source/interactive_queries.op:
    Conform to the renames of the function symbols in debugger_interface.m.

    Since this code is in Prolog, I cannot be sure that I changed all the
    places that should be changed, but that does not matter much.

    Since Morphine was designed to work with the Prolog dialects of 1999,
    had its last update in 2002, and we never test it, it is very likely
    that it hasn't worked in a long time. We keep it around because
    (a) it may interest someone, and (b) it doesn't require significant
    maintenance. The fact that it does not run may be regrettable, but
    it is not actually regretted by many would-be users, or (even) any at all.

    (I actually noticed and fixed a bug while doing the above change:
    it was a typo in a function symbol name.)
2016-05-13 09:07:58 +10:00
Julien Fischer
e7010327d9 Delete references to picreg.
browser/interactive_query.m:
extras/dynamic_linking/Mmakefile:
extras/graphics/mercury_glut/Mmakefile:
extras/graphics/mercury_glut/Mmakefile.MacOSX:
extras/graphics/samples/calc/Makefile:
extras/graphics/samples/gears/Mmakefile:
extras/graphics/samples/maze/Mmakefile:
extras/graphics/samples/pent/Mmakefile:
extras/morphine/non-regression-tests/Mmakefile:
extras/morphine/source/collect.op:
    As above.
2016-04-26 14:03:04 +10:00
Mark Brown
8e0eb72c15 Various improvements to mdb's interactive query mechanism.
Estimated hours taken: 26

Implement the following improvements:
  - Pass mdb variable bindings to the interactive query processor,
    allowing queries to make use of live values.
  - Catch exceptions thrown by queries, rather than crashing mdb.
  - Write outputs using io.write_cc/3.
  - Don't output underscore variables, avoiding spurious warnings.
  - More protection of the user's namespace.
  - Updated the cleanup code.

browser/interactive_query.m:
    The interface now accepts corresponding lists of names and values,
    which are matched up with variables occurring in the queries.

    Replace the code generator with one that supports passing data
    to and from the query, and catching exceptions from the query.
    Pass the appropriate data at the time the query predicate is called.
    Distinguish between failure of the query and failure of the dynamic
    casts used to instantiate the query inputs.

    Use module qualifiers to avoid clashing with user imports. (Should the
    generated code use use_module, just in case?)

    Perform I/O, failure handling and exception handling in the caller
    instead of in the generated code. This is faster, more maintainable,
    and means that errors are caught earlier.

    Place source_file and line directives more carefully so as to ensure
    more consistent error messages, and to help distinguish errors in the
    template from errors in the query.

    Factor out the query command parser to avoid double maintenance.

browser/debugger_interface.m:
    Conform to above changes.

trace/mercury_trace_vars.[ch]:
    Export MR_trace_return_bindings, which constructs Mercury lists
    of the variable names and values in the current environment.

trace/mercury_trace_browse.c:
    Pass bindings from trace/mercury_trace_vars through to the interactive
    query processor.

tests/debugger/interactive.{m,inp,exp}:
    Update for changes to existing functionality. Additionally test the
    new functionality.

doc/user_guide.texi:
    Document the new behaviour.

NEWS:
    Announce the new behaviour.
2016-02-07 04:09:04 +11:00
Julien Fischer
4bbc1e48eb Make mdb interactive queries work on OS X.
browser/interactive_query.m:
    Use '.dylib' as the extension for the shared library we generate for
    interactive queries when on OS X.  (While '.so' would work in principle,
    its use is unusual on OS X and the Mercury compiler will always use
    '.dylib' anyway.)

    Replace some sequences of I/O operations with single calls to io.format
    so that message components are not spread over multiple lines.

    Add an XXX comment about object file extensions.

    Update comments that refer to 'libquery' rather than 'libmdb_query'.

README.MacOS:
    Delete interactive queries from the list of unsupported features.

tests/debugger/interactive.exp:
    Update this expected output.  The changes are due to earlier
    changes to the formatting and presentation of error messages.
2015-08-21 22:15:30 +10:00
Zoltan Somogyi
ef6761f508 Bring the programming style of browser/*.m up-to-date. 2015-08-19 01:27:55 +10:00
Julien Fischer
9ae7fe6b70 Change the argument ordering of predicates in the set module.
Branches: main

Change the argument ordering of predicates in the set module.

library/set.m:
	Change predicate argument orders to match the versions
	in the svset module.

	Group function definitions with the corresponding predicates
	rather than at the end of the file.

	Delete Ralph's comments regarding the argument order in the
	module interface: readers of the library reference guide are
	unlikely to be interested in his opinion of the argument ordering
	ten or so years ago.

	Add extra modes for set.map/3 and set.map_fold/5.

library/svset.m:
library/eqvclass.m:
library/tree234.m:
library/varset.m:
browser/*.m:
compiler/*.m:
deep_profiler/*.m:
mdbcomp/trace_counts.m:
extras/moose/grammar.m:
extras/moose/lalr.m:
extras/moose/moose.m:
tests/hard_coded/bitset_tester.m:
	Conform to the above change.

NEWS:
	Announce the above changes.
2011-05-06 05:03:29 +00:00
Zoltan Somogyi
de0ff762d8 Convert some if-then-elses to switches.
Estimated hours taken: 2
Branches: main

analysis/analysis.file.m:
analysis/analysis.m:
browser/declarative_execution.m:
browser/declarative_tree.m:
browser/declarative_user.m:
browser/interactive_query.m:
browser/parse.m:
browser/sized_pretty.m:
	Convert some if-then-elses to switches.
2007-12-30 11:11:06 +00:00
Julien Fischer
553fb3f7d9 Use pragma foreign_export' in preference to pragma export' throughout
Estimated hours taken: 1
Branches: main

Use `pragma foreign_export' in preference to `pragma export' throughout
the Mercury distribution.

Convert more of the extras distribution to four-space indentation and
other minor cleanups.

browser/*.m:
library/*.m:
samples/*:
extras/*:
	As above.
2006-08-31 11:09:54 +00:00
Zoltan Somogyi
00741b0162 This diff contains no algorithmic changes.
Estimated hours taken: 6
Branches: main

This diff contains no algorithmic changes. It merely renames apart a bunch more
function symbols to reduce ambiguity.

After this diff, the summary line from the mdb command "ambiguity -f" is

	Total: 351 names used 975 times, maximum 31, average: 2.78

browser/*.m:
compiler/*.m:
	Rename function symbols to eliminate ambiguities.

tests/debugger/declarative/dependency.exp:
tests/debugger/declarative/dependency2.exp:
	Update the expected out where some internal function symbol names
	appear in the output of the debugger. (This output is meant for
	implementors only.)
2006-08-22 05:04:29 +00:00
Julien Fischer
d77a8ff8a3 Fix the interactive query mechanism in the debugger.
Estimated hours taken: 0.2
Branches: main

Fix the interactive query mechanism in the debugger.  It wasn't
working because the generated query programs did not import the
solutions module.

browser/interactive_query.m:
	Import the solutions module in the generated query program.

	Minor formatting fixes.
2006-05-08 07:28:52 +00:00
Julien Fischer
459847a064 Move the univ, maybe, pair and unit types from std_util into their own
Estimated hours taken: 18
Branches: main

Move the univ, maybe, pair and unit types from std_util into their own
modules.  std_util still contains the general purpose higher-order programming
constructs.

library/std_util.m:
	Move univ, maybe, pair and unit (plus any other related types
	and procedures) into their own modules.

library/maybe.m:
	New module.  This contains the maybe and maybe_error types and
	the associated procedures.

library/pair.m:
	New module.  This contains the pair type and associated procedures.

library/unit.m:
	New module. This contains the types unit/0 and unit/1.

library/univ.m:
	New module. This contains the univ type and associated procedures.

library/library.m:
	Add the new modules.

library/private_builtin.m:
	Update the declaration of the type_ctor_info struct for univ.

runtime/mercury.h:
	Update the declaration for the type_ctor_info struct for univ.

runtime/mercury_mcpp.h:
runtime/mercury_hlc_types.h:
	Update the definition of MR_Univ.

runtime/mercury_init.h:
	Fix a comment: ML_type_name is now exported from type_desc.m.

compiler/mlds_to_il.m:
	Update the the name of the module that defines univs (which are
	handled specially by the il code generator.)

library/*.m:
compiler/*.m:
browser/*.m:
mdbcomp/*.m:
profiler/*.m:
deep_profiler/*.m:
	Conform to the above changes.  Import the new modules where they
	are needed; don't import std_util where it isn't needed.

	Fix formatting in lots of modules.  Delete duplicate module
	imports.

tests/*:
	Update the test suite to confrom to the above changes.
2006-03-29 08:09:58 +00:00
Zoltan Somogyi
7822554732 Replace __ with . as the module qualifier everywhere in all the modules
Estimated hours taken: 2
Branches: main

browser/*.m:
	Replace __ with . as the module qualifier everywhere in all the modules
	of the browser directory. Convert the currently tab-indented modules
	to four-space indentation. Delete some unnecessary module
	qualifications. Change some type names and function symbols to avoid
	ambiguities. Replace a bunch of uses of DCGs with state variable
	notation.
2006-03-10 06:31:06 +00:00
Zoltan Somogyi
a77588f6d2 Add two new capabilities to the debugger.
Estimated hours taken: 8
Branches: main

Add two new capabilities to the debugger.

The first capability is the idea of "held variables", variables that the
debugger holds onto even when execution has left the event they came from.
You can hold onto a variable via the mdb command "hold varname heldvarname".
You can suffix the name of the existing variable with a term path, in which
case the new held variable will refer only to the specified part of the term.
Later mdb commands can refer to the held variable by prefixing its name with
a dollar sign. For example, after "hold HeadVar__1^2 x", "$x" will refer to
the term that was the second argument of HeadVar__1 at the program point
at which the "hold" command was executed.

The second capability is the ability to compute the diff of two terms and
express those diffs as the term paths of the function symbols at which the two
terms differ, instead of the line numbers you get by using save_to_file and the
usual Unix diff command. The mdb command is "diff var1 var2". We limit the
number of term paths of difference sites that we display at any one time;
the mdb diff command has options to control this.

NEWS:
	Mention the new capabilities.

doc/user_guide.texi:
	Document the new mdb commands "hold" and "diff", the new mdb command
	"held_vars" which simply lists the names of all the held variables
	(just as "vars" lists the names of all the nonheld variables currently
	accessible), and the concept of held variables.

doc/mdb_categories:
	Update this file for the new mdb commands and concepts.

browser/browse_diff.m:
	This new module implements the diff operation on terms.

browser/mdb.m:
	Add the new module to the list of submodules of the mdb package.

browser/*.m:
	Minor cleanups, such as importing only one module per line; there
	are no algorithmic changes.

trace/mercury_trace_hold_vars.[ch]:
	This new module implements the database of held variables.

trace/Mmakefile:
	Mention the new module.

trace/mercury_trace_internal.c:
	Implement the three new mdb commands.

trace/mercury_trace_vars.[ch]:
	Modify the functions that recognize variable specifications or
	process them to work with held variables as well as variables from
	the current environment. This required some reorganization of the
	internals of this module.

	Provide some a utility function, MR_trace_parse_lookup_var_path,
	for converting a string representing the specification of a term
	(a variable and possibly some path within it) to the type and value
	of that term. Make the utility function this is based upon,
	MR_lookup_unambiguous_var_spec, replace the previous but less capable
	MR_convert_var_spec_to_type_value.

trace/mercury_trace_spy.c:
	Conform to the change in mercury_trace_vars.c.

trace/mercury_trace_util.c:
	Make a utility function more robust.

trace/mercury_trace_alias.c:
	Minor cleanups.

tests/debugger/queens.{inp,exp*}:
	Update this test case to test the debugger's new capabilities.

tests/debugger/completion.{inp,exp*}:
	Update this test case to expect the new mdb commands, and avoid the
	ambiguity between "help" and "held_vars".
2005-07-11 07:30:31 +00:00
Zoltan Somogyi
67895b0b65 Fix the current mixture of __ and . to module qualify module names
Estimated hours taken: 0.2
Branches: main

browser/*.m:
	Fix the current mixture of __ and . to module qualify module names
	by standardizing on the latter.
2005-01-24 07:41:05 +00:00
Fergus Henderson
245d0b3bb8 Back out a bug which appears to have been accidentally introduced
Estimated hours taken: 0.5
Branches: main

browser/interactive_query.m:
	Back out a bug which appears to have been accidentally introduced
	in revision 1.21 of this file ("Bring this module up to date
	with our current coding style guidelines.").  The mmc command needs
	to be executed, not just echoed into a "./.xx" file.
2004-10-13 09:24:59 +00:00
Julien Fischer
3295904008 Remove the use of the old C interface in the debugger.
Estimated hours taken: 0.1
Branches: main

Remove the use of the old C interface in the debugger.

browser/dl.m:
browser/interactive_query.m:
browser/util.m:
	Use the new foreign language interface rather than
	the old one.
2004-07-16 08:08:29 +00:00
Zoltan Somogyi
fe01b6f58f Bring this module up to date with our current coding style guidelines.
Estimated hours taken: 0.2
Branches: main

browser/interactive_query.m:
	Bring this module up to date with our current coding style guidelines.
2004-06-04 06:50:40 +00:00
Zoltan Somogyi
e7c86a2342 Conform to the convention of importing only one browser module per
Estimated hours taken: 0.2
Branches: main

browser/debugger_interface.m:
browser/declarative_oracle.m:
browser/interactive_query.m:
browser/parse.m:
	Conform to the convention of importing only one browser module per
	line, and of importing browser modules before standard library modules.
2003-10-27 06:24:43 +00:00
Simon Taylor
9d88a8668a s/--link-flags --allow-undefined/--allow-undefined/
Estimated hours taken: 0.1
Branches: main

browser/interactive_query.m:
	s/--link-flags --allow-undefined/--allow-undefined/
	in the mmc command line. This is needed after my change
	to implement ml in the compiler.
2003-02-10 08:52:20 +00:00
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
Zoltan Somogyi
0f2726ee1a Fix some test case failures.
Estimated hours taken: 0.5
Branches: main

Fix some test case failures.

browser/interactive_query.m:
	Flush the output stream before invoking the compiler, to ensure that
	the output appears in the desired order.

tests/debugger/interactive.{inp,exp}:
	Test only the interactive commands of mdb. The other commands are well
	exercised by the other test cases; duplicating them only leads to
	double maintenance of the expected outputs.
2002-09-27 03:11:10 +00:00
Simon Taylor
255f6aba27 Always take the grade from the executable, not the options
Estimated hours taken: 0.1
Branches: main

browser/interactive_query.m:
	Always take the grade from the executable, not the options
	supplied by the user. This prevents the setting of `--pic-reg'
	being overridden if the tests/debugger/Mmakefile puts `--grade'
	in the `mmc_options' command in tests/debugger/interactive.inp.
2002-07-01 09:27:10 +00:00
Simon Taylor
dd9e60e554 Recently I changed the interactive query facility in the debugger
Estimated hours taken: 2.5
Branches: main

Recently I changed the interactive query facility in the debugger
to use `mmc --make' to build the shared library containing the query.
There were two problems with this. The entire program was included in
the shared library, not just the query module. Also, invoking
`mmc --make query.realclean' cleaned up the user's files.

compiler/options.m:
compiler/compile_target_code.m:
	Add an option `--compile-to-shared-lib', which causes
	mmc to package the modules on the command line into
	a shared library, not an executable. This option is
	intended only for use by browser/interactive_query.m,
	so it isn't documented.

browser/interactive_query.m:
	Use `mmc --compile-to-shared-lib', not `mmc --make'
	to build the query shared library.

	Name the query source file mdb_query.m rather than query.m
	to reduce the chance of overwriting a user's file.

tests/debugger/Mmakefile:
	Use `lmc' to compile the query if `WORKSPACE' is set,
	rather than using a Mercury.options file to set up
	for the workspace.

tests/debugger/interactive.exp:
	Update expected output.
2002-06-12 14:27:03 +00:00
Simon Taylor
5d693f5a1c Factor out the common Mmake code to set up the mmc, mgnuc
Estimated hours taken: 8
Branches: main

Factor out the common Mmake code to set up the mmc, mgnuc
and ml flags when building the Mercury compiler and libraries.
Use options, not environment variables. This will make it simpler
to use `mmc --make' to compile the compiler.

Mmake.workspace:
	Similar to tools/lmc. Sets up Mmake variables to
	use the library files in a workspace rather than
	an installed library.

configure.in:
	Check for the `--no-mercury-stdlib-dir' mmc option.
	Bootstrap CVS tag: bootstrap_20020429_stdlib_dir

Mmake.common.in:
*/Mmakefile:
	Move common code into Mmake.workspace.

browser/Mmakefile:
library/Mmakefile:
	Avoid invoking the linker explicitly when creating
	libraries of Mercury code. That won't work well
	with `mmc --make'.

tools/bootcheck:
tests/Mmake.common:
	Use Mmake.workspace instead of setting up environment
	variables in bootcheck.

scripts/Mmake.vars.in:
	mmc compiles split C files to object code itself,
	so pass `--cflags "$(ALL_CFLAGS)"' to mmc when
	compiling with `--split-c-files'.

browser/interactive_query.m:
	Use `mmc --make' when compiling the query. This is needed
	to make tests/debugger/interactive_query.m work when linking
	against a workspace using options rather than environment
	variables.  This also fixes a bug -- mmc options were being
	passed to ml.

	Clean up after the query.

tests/debugger/Mmakefile:
tests/debugger/interactive.inp:
tests/debugger/interactive.inp.subdirs:
tests/debugger/interactive.inp.nosubdirs:
tests/debugger/interactive.exp:
tests/debugger/interactive.exp2:
	Generate the input file to this test so that MCFLAGS
	and MC_MAKE_FLAGS (from Mmake.workspace) are used when
	compiling queries.

	tests/debugger/Mmakefile now sets SHELL to /usr/local/bash
	to allow the use of $(...) style command substitution
	(`...` style command substitution can't be nested).

tests/warnings/Mmakefile:
tests/dppd/Mmakefile:
	Include tests/Mmake.common.

tools/*:
scripts/c2init.in:
scripts/ml.in:
	Update the lists of files containing the library names.
2002-04-29 08:22:08 +00:00
Fergus Henderson
20c59a9f11 Get the debugger's interactive query mechanism to print out details of
Estimated hours taken: 2
Branches: main

Get the debugger's interactive query mechanism to print out details of
non-canonical types (e.g. higher-order types).

browser/interactive_query.m:
	Use `io__write_cc' rather than `io__write', and hence declare the
	argument passed to `builtin_aggregate' as `cc_multi' rather than `det'.

library/std_util.m:
	Add modes to `builtin_aggregate' and `do_while' in which the
	collector predicate has determinism `cc_multi'.

library/builtin.m:
	Add impure variants of `promise_only_solution' and
	`promise_only_solution_io', for use by std_util.m.
2002-03-13 12:25:35 +00:00
Fergus Henderson
f43ee71545 Use the correct object file name when --use-subdirs is specified.
Estimated hours taken: 1
Branches: main

browser/interactive_query.m:
	Use the correct object file name when --use-subdirs is specified.

tests/debugger/Mmakefile:
tests/debugger/interactive.inp:
tests/debugger/interactive.inp.subdirs:
tests/debugger/interactive.inp.nosubdirs:
tests/debugger/interactive.exp:
tests/debugger/interactive.exp2:
	Use a different input file for the `interactive' test case
	depending on whether `--use-subdirs' is enabled.
	The .inp.subdirs file contains the line `mmc_options --use-subdirs'.
	We strip this line out of the output before comparing with
	the .exp* files.
2002-02-27 09:38:36 +00:00
Simon Taylor
5544aed7ff Change the list constructor from ./2' to [|]/2'. `./2' will
Estimated hours taken: 3
Branches: main

Change the list constructor from `./2' to `[|]/2'. `./2' will
eventually become the module qualification operator.

library/parser.m:
library/io.m:
library/sparse_bitset.m:
library/std_util.m:
library/term_io.m:
compiler/mercury_to_mercury.m:
compiler/prog_io_dcg.m:
compiler/prog_io_goal.m:
compiler/prog_io_pragma.m:
compiler/prog_io_typeclass.m:
compiler/prog_io_util.m:
browser/interactive_query.m:
extras/moose/grammar.m:
extras/moose/moose.m:
extras/morphine/source/generate_call_site_cov.m:
extras/xml/xml.encoding.m:
samples/muz/higher_order.m:
tests/debugger/declarative/app.m:
tests/dppd/transpose_impl.m:
tests/hard_coded/ground_dd.m:
tests/hard_coded/split_c_files.m:
	Change all references to `./2' to use `[|]/2' instead.

compiler/typecheck.m:
	Handle `./2' as a special case in `report_error_undef_cons'.

	Warn about module list not being imported if `[|]/2' is undefined.

compiler/llds_out.m:
util/mdemangle.c:
profiler/demangle.m:
	Add name conversions for `[|]' (f_cons) and `[]' (f_nil).

NEWS:
doc/reference_manual.texi:
w3/tutorial/lists-n-things.m4:
	Document the changes.

tests/debugger/{,declarative}/*.exp*:
	Update test case results. For some tests the output changed
	because they output lists in the non-pretty format. For others,
	the output changed because the alphabetical ordering of the
	constructors of type `list/1' changed, so the numbering of
	the switch branches in the goal paths changed.
2001-09-25 09:37:12 +00:00
Fergus Henderson
4b371bad00 Pass `--allow-undefined' to ml when building libquery.so;
Estimated hours taken: 0.25

browser/interactive_query.m:
	Pass `--allow-undefined' to ml when building libquery.so;
	this is needed now that `--no-allow-undefined' is the default,
	since the query will refer to symbols in the executable that
	it gets loaded into.
2001-02-13 12:27:40 +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
Zoltan Somogyi
1c8cb6faf2 Get the compiler to bootstrap with -DMR_NO_BACKWARDS_COMPAT.
Estimated hours taken: 2

Get the compiler to bootstrap with -DMR_NO_BACKWARDS_COMPAT.

compiler/c_util.m:
compiler/rtti_out.m:
	Add MR_ prefixes to various type names in generated code.

compiler/*.m:
browser/*.m:
library/*.m:
	Add MR_prefixes to various type and function names in pragma C code.

runtime/*.[ch]:
trace/*.[ch]:
	Add MR_prefixes to various type and function names in
	hand-written code.
2000-10-16 01:34:14 +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
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
426a82a193 Reorder some arguments to ml so that the ml options are
Estimated hours taken: 0.1

browser/interactive_query.m:
	Reorder some arguments to ml so that the ml options are
	before the '-o'.
1999-05-28 02:22:51 +00:00
Erwan Jahier
7e746328d1 This change allows interactive queries to be typed from the external debugger.
Estimated hours taken: 11

This change allows interactive queries to be typed from the external debugger.

browser/debugger_interface.m:
	Define new debugger requests: query/1, cc_query/1, io_query/1 and
	mmc_options/1.

	Define 2 new procedures that are used in trace/mercury_trace_external.c:
	get_list_modules_to_import/3 retrieves from a *query/1 request a list
	of modules to be imported; and get_mmc_options/2 retrieves from a
	mmc_options/1 request the option to pass to mmc to compile the query.

browser/interactive_query.m:
	Define a new procedure query_external/7 that does the same job as
	query/7 but for the external debugger.

	Unset the environment variable `MERCURY_OPTIONS' before compiling a
	query; `MERCURY_OPTIONS' is exported before executing a program under
	the control of Opium-M (and mdb) and is not supposed to be set before
	compiling a program.

trace/mercury_trace_browse.ch:
	Add a new function MR_trace_query_external() to interface the
	ML_query_external() function defined by browser/interfactive_query.m.

trace/mercury_trace_external.c:
	Add code to implement new commands `query', `cc_query', `io_query',
	and `mmc_options', using the MR_trace_query_external() function defined
	by trace/mercury_trace_browse.h.

trace/mercury_trace_external.h:
	Export MR_debugger_socket_in and MR_debugger_socket_out since there
	are needed in interactive_query.m.

doc/user_guide.texi:
	Add a comment to tell that there exists duplicated documentation betwenn
	Opium-M/source/interactive_queries.op and doc/user_guide.texi and to
	tell me to update it if someone update the documentation here.
1999-04-22 06:58:52 +00:00
Fergus Henderson
af082736c0 Add some test cases to test interactive queries.
Estimated hours taken: 3

Add some test cases to test interactive queries.

tests/debugger/queens.inp:
	Add tests of interactive queries.

tests/debugger/Mmakefile:
	Add dependency of queens.out on queens.ints.
	This is needed in order for us to use interactive queries.

tests/debugger/queens.m:
	Export qperm/2, for use in interactive queries.

browser/interactive_query.m:
	Flush MDB_stdout after printing the prompt, so things work
	properly with I/O redirections.

trace/mercury_trace_internal.c:
	Fix an off-by-one error detected by the above test cases.
1999-03-25 22:25:03 +00:00
Fergus Henderson
f1d1041d08 Add support for invoking interactive queries to mdb.
Estimated hours taken: 17

Add support for invoking interactive queries to mdb.

browser/interactive_query.m:
	New module, to implement interactive queries.

browser/dl.m:
browser/name_mangle.m:
	Copy these files from extras/dynamic_linking, since
	they are needed by browser/interactive_query.m.

configure.in:
runtime/mercury_conf.h.in:
	Autodetect the presence of support for dlopen() etc.

browser/dl.m:
	Add #ifdefs so that the code will compile (but report
	an error at runtime) if dlopen() etc. are not supported.

browser/browser_library.m:
	Add interface_query, dl, and name_mangle to the list of
	modules in this library.

trace/mercury_trace_browse.h:
trace/mercury_trace_browse.c:
	Add a new function MR_trace_query() to interface to the ML_query()
	function defined by browser/interfactive_query.m.

trace/mercury_trace_internal.c:
	Add code to implement new commands `query', `cc_query', `io_query',
	and `mmc_options', using the MR_trace_query() function defined by
	trace/mercury_trace_browse.h.

runtime/mercury_grade.h:
	Add code to define MR_GRADE_OPT, so that browser/interactive_query.m
	can use this to invoke mmc with the same grade that the executable
	being debugged was built with.

doc/mdb_categories:
doc/user_guide.texi:
	Document the new commands `query', `cc_query', `io_query',
	and `mmc_options'.
1999-03-05 12:52:34 +00:00