Add type cast in construction of direct arg functor value.

Add a type cast to the code generated by ml_gen_direct_arg_deconstruct
to construct a value with a direct argument functor.  The cast exists in
the same code generated by ml_gen_direct_arg_construct.

compiler/ml_unify_gen.m:
	As above.
Add a NEWS section for 14.01.2.

NEWS:
	As above.
extras/ Update the net library

This library had been neglected for a while and came to my attention when it
used deprecated (or at least old) C interfaces rather than newer reentrant
ones.  I've started to improve this library by giving a more typesafe and
Mercury-esque API, using only reentrant C functions, and eventually adding
support for more protocols, (eg: IPv6 and UDP) better integration with
Mercury's io module and generally making it easier to use.

What's working now:

    + creating sockets,
    + binding and listening,
    + connecting (untested),
    + accepting,
    + closing.
    + The interface is generally more type-safe, using new types suck as
      "socket" and "address" rather than "int" and "c_pointer".

What's not working/incomplete:

    + I havn't yet touched the tcp.m module, but I intend to remove it and
      create a new high-level interface for various protocols.
    + Any kind of reading / writing over sockets at all.
    + Name lookups.
    + A lot of the interface is incomplete / missing useful functions and
      predicates.

This is a work in progress.

Makefile:
    New Makefile.

README.md:
    New Readme file.

net.m:
    net is now a module containing the other modules as submodules.

sockets.m:
    Many changes as described above.

netdb.m:
    This new module contains host and other name lookups.  Only service
    lookups are currently implemented.

types.m:
    Types shared by sockets.m and netdb.m.

echo.m:
    An example echo server.

errno.m:
    strerror functionality.

tcp.m:
    Conform to changes in net.m.
Drop support for lcc as a C compiler.

Drop support for lcc as a C compiler.  lcc itself does not seem to have been
updated since around 2010 and Mercury's support for it has not been updated for
quite a while before that.

Derivatives of lcc, for example lcc-win32, would almost certainly need to be
treated separately anyway, so this change doesn't affect them (i.e. they are
already not supported).

configure.ac:
m4/mercury.m4:
	Do not recognise lcc as a C compiler.

	Unrelated change: remove residual support for a.out executables on Linux.

scripts/mgnuc_file_opts.sh-subr:
	Do not define the macros __EXTENSIONS__ and _GNU_SOURCE if the mgnuc script
	is invoked with --no-ansi.  This was originally done to support lcc on Linux.
	Doing so on *all* systems as this code actually does is not a good idea.
	(If it becomes necessary to reinstate this behaviour on some system, it
	should be controlled from the configure script not here.)

runtime/mercury_wrapper.c:
	Delete a workaround for lcc.

scripts/mgnuc.in:
scripts/ml.in:
compiler/compile_target_code.m:
compiler/handle_options.m:
compiler/globals.m:
compiler/ml_code_gen.m:
	Delete support for lcc.

README.lcc:
	Delete this file.
Use new-style C compiler type for MSVC.

It was intended that the C compiler type string for MSVC would eventually have
the form "msvc_<n>" (where <n> is the version number).  The configure script is
still generating the older form of  string, "cl_<n>"; we want to avoid this
because it's too easy to confuse with clang.  Make configure generate the new
kind of C compiler type string.

configure.ac:
	Generate the new sort of compiler type strings for MSVC.

scripts/mgnuc.in:
compiler/globals.m:
	Do not recognise the old sort any longer.
Revert a fix for constrained polymorphic modes.

Commit 338b5cb98e8abd320aac6d3619f8ab98f773c846 changed a call in
handle_inst_var_subs_2, essentially from
	Recurse(InstA, SubInstB)
to
	Recurse(InstA, abstractly_unify_inst(InstA, SubInstB))

Unfortunately, it results in infinite recursion on some cases.

compiler/inst_match.m:
	Revert the change to handle_inst_var_subs_2.

tests/EXPECT_FAIL_TESTS.all_grades:
	Expect constrained_poly_insts2 to fail now.

tests/invalid/constrained_poly_insts3.err_exp:
tests/invalid/constrained_poly_insts3.m:
tests/invalid/constrained_poly_insts4.err_exp:
tests/invalid/constrained_poly_insts4.m:
	Add test cases.
Fix bug #364: Add a specific cost analysis for nondet disjunctions.

This bug was caused because we assumed that all disjunctions that the cost
analysis examined were semidet disjunctions.  This patch adds a separate
predicate to calculate the cost of nondet disjunctions, it simply sums up
the costs of the disjuncts.

deep_profiler/autopar_costs.m:
    As above.

deep_profiler/autopar_search_goals.m
    Conform to above changes.

deep_profiler/autopar_search_callgraph.m:
    When the auto-parallelisation analysis of a procedure throws an
    exception print out the identity of the procedure.

NEWS:
    Add news item.
Merge branch 'version-14_01-branch'

Mergeing:
    Fix bug #364: Add a specific cost analysis for nondet disjunctions.
Add spawn and spawn_native parallelisations to the mandelbrot benchmark

The mandelbrot benchmark can now be used to benchmark concurrency support
using either spawn or spawn_native.  As before it can also use no
parallelism or the parallel conjunction operator.

benchmarks/progs/mandelbrot/mandelbrot.m:
    As above.

benchmarks/progs/mandelbrot/bench.sh:
    Update mandelbrot benchmarking script
Make MercuryThreadPool (java) notice when a thread blocks on a semaphore.

If threads are blocked while there is work in the queue extra threads may be
spawned to keep the processors busy.

Beginning now, tasks created with thread.spawn are use the thread pool.
(thread.spawn_native does not use the thread pool.)

java/runtime/Semaphore.java:
    Wrap Java's Semaphore class which call the current thread's blocked()
    and running() methods when a thread blocks and then runs after being
    blocked.

library/thread.semaphore.m:
    Use our own Semaphore class.

java/runtime/MercuryThread.java:
java/runtime/MercuryWorkerThread.java:
    Define blocked() and running() on our threads.

java/runtime/NativeThread.java:
    This class is used by spawn_native/4 and is required to define blocked()
    and running(), however it implements them as no-ops as it isn't included
    in the thread pool.

java/runtime/ThreadStatus.java:
    Define the BLOCKED status.

java/runtime/MercuryThreadPool.java:
    Count blocked threads seperatly and allow the creation of new threads
    when existing threads become blocked.

    Add some tracing code to help debug the thread management code.  This is
    disabled by default.

library/thread.m:
    Implement spawn for Java using the thread pool.  This was not enabled
    earlier because without using java/runtime/Semaphore.java it was
    possible to deadlock the system.

java/runtime/Task.java:
    Add some tracing code to debug thread state changes, this is disabled by
    default.
Merge branch 'master' into merge-java-on-windows
Restore a fix to handle_inst_var_subs_2.

A previous change improved the precision of inst matching by making
handle_inst_var_subs_2 recurse on the abstract unification of InstA and
SubInstB,

	Recurse(InstA, abstractly_unify_inst(InstA, SubInstB))

The change was temporarily reverted because it is susceptible to
infinite recursion when abstractly_unify_inst returns an inst containing
larger and larger "unify_insts" in each successive call.

compiler/inst_match.m:
	Restore the fix but avoid infinite recursion.

tests/EXPECT_FAIL_TESTS.all_grades:
	Enable invalid/constrained_poly_insts2 again.
Merge remote-tracking branch 'upstream/master' into merge-java-on-windows
Add a future data type for concurrent and parallel programming

library/library.m:
library/thread.future.m:
library/thread.m:
    Add new future standard library module.

NEWS:
    Announce the new addition.

library/thread.semaphore.m:
    Add an impure interface to thread.semaphore.m.  Semaphores are used to
    implement our other concurrency primitives and an impure interface can
    often be useful to implement things such as futures, which don't require
    IO state threading.  The impure interface predicate names are prefixed
    with "impure_".

library/thread.semaphore.m:
NEWS:
    Deprecate the impure init/1 function.

library/thread.mvar.m:
    Conform to changes in semaphore.m.

benchmarks/progs/mandelbrot/mandelbrot.m:
    Add future example to mandelbrot benchmark.
Add an impure_init/0 function to thread.mvar.m

This change renames the init/0 function in thread.mvar.m to impure_init/0;
deprecating the old function.  This makss this module more consistent with
thread.semaphore.m.

Remove the "mvar." prefix where it is unnecessary.

Add %----% separators between some definitions in the implementation
section.

library/thread.mvar.m:
    As above.
Coding standard change: module qualification in library interfaces.

compiler/notes/coding_standards.html:
	Specify that library module interfaces should avoid module
	qualification where possible.

	Minor formatting improvements and (a few) rewordings.
Avoid module qualification in library interfaces where possible.

NOTE: this change does not affect the io module -- I've left that for a
separate change.

library/*.m:
	As per the recent change to the coding standard, avoid module
	qualification in library interfaces where possible.

	Reformat declarations and descriptive comments to better utilise
	any space freed up by the above.
Modify code for stricter mode checking.

The following changes are necessary to compile the code following an
upcoming change to the mode checker.  Some of them are mode errors.

browser/declarative_oracle.m:
	The result of `query_oracle_kb' should be specific
	to avoid mode errors in callers.

compiler/accumulator.m:
	Help the compiler infer the declared inst.

compiler/mode_robdd.tfeirn.m:
	`zero' must be declared to return a normalised tfeirn value to
	avoid mode errors.  Change `one' for symmetry.

	`var_restrict_true' and `var_restrict_false' may return
	unnormalised tfeirn values (judging by the code).

	Modify `normalise' to help the compiler infer
	the declared inst.

compiler/tupling.m:
deep_profiler/autopar_find_best_par.m:
	Delete final insts that the compiler cannot verify.

library/tree234.m:
	Help the mode checker out using an explicit switch.

tests/hard_coded/bitmap_test.m:
tests/hard_coded/bitmap_tester.m:
	Add missing modes.
Modify exception module for stricter mode checking.

library/exception.m:
	Fix errors that prevent the module from compiling following an
	upcoming change to the mode checker.

	Simplify code by creating higher-order terms from multi-moded
	predicates.  There is no need to switch on the determinism now.

tests/debugger/declarative/catch_retry.exp:
tests/debugger/declarative/catch_retry.inp:
	Update test case.
Modify solutions module for stricter mode checking.

library/solutions.m:
	Fix mode error in `solutions' predicate in the `multi' mode.
	Convince the compiler with a run-time check that the solution
	list will be non-empty.

	Similarly for `builtin_solutions'.

tests/debugger/declarative/solns.exp3:
tests/debugger/loopcheck.exp3:
	Update expected outputs.