Fix bug #342.

The Mercury implementation of string formatting (used by the non-C grades) was
incorrectly formatting some numbers when using the 'g' conversion specifier,
for example:

    string.format("%6.3g\n", [f(16.0)]) = "10"

The cause was an off-by-one error introduced when calls to string.substring
were changed to calls string.between (in commit
b1af59cb29ac31db9fc5b3422fced505facabad1).

library/string.m:
	Fix the off-by-one error above.

NEWS:
	Announce the fix.
Define sinh, cosh and tanh as foreign_procs in Java grade.

Use foreign_procs to define the hyperbolic operations in the Java grade.
Java has provided these since version 1.5 and since that is the minimum
version required by Mercury we can rely on them being present.

library/math.m:
	As above.
Separate processor counting from thread pinning.

In low-level C parallel grades we need the number MR_num_processors to
prime MR_num_threads when it is not explicitly set by the user, even if
thread pinning support is not available.

This fixes bug #338: programs in low-level C parallel grades crashed at
startup on platforms where thread pinning is unimplemented because
MR_num_threads is set to zero.

runtime/mercury_context.c:
	Refactor code to this effect.

	Add assertions that MR_num_processors > 0 and MR_num_threads > 0.

NEWS:
	Announce fix.
Get processor count with GetSystemInfo on Windows.

runtime/mercury_context.c:
	As above.
Thread-safe alternative to strerror.

Add MR_strerror as a thread-safe alternative to strerror.
The current implementation wraps strerror_r(), strerror_s()
or sys_errlist as appropriate for the platform.  Bug #340.

configure.ac:
runtime/mercury_conf.h.in:
	Check for strerror_r, strerror_s.

	Delete irrelevant code in the sockets test for the external debugger.

runtime/mercury_runtime_util.c:
runtime/mercury_runtime_util.h:
	Add MR_strerror and use it.

library/io.m:
	Use MR_strerror.  In particular, mercury_output_error was not
	thread-safe.

	Pass errno to mercury_output_error explicitly for clarity.

	Delete req_lock parameter in ML_maybe_make_err_msg macro which is not
	needed any more.

compiler/prog_event.m:
runtime/mercury_deep_profiling.c:
runtime/mercury_misc.c:
runtime/mercury_term_size.c:
runtime/mercury_trace_base.c:
trace/mercury_trace_cmd_developer.c:
trace/mercury_trace_cmd_exp.c:
trace/mercury_trace_cmd_misc.c:
trace/mercury_trace_declarative.c:
trace/mercury_trace_external.c:
trace/mercury_trace_internal.c:
	Use MR_strerror.

compiler/notes/coding_standards.html:
	Update coding standard.

extras/net/sockets.m:
extras/net/tcp.m:
	Use MR_strerror.

NEWS:
	Announce change.
Adjust news entries for 14.01.1.

NEWS:
	Add bug numbers where available.
Fix a segmentation fault in the runtime on Mac OS X.

runtime/mercury_runtime_util.c:
	On Mac OS X, strerror_r also does not populate its buffer
	if it fails.
Merge branch 'version-14_01-branch'
Merge remote-tracking branch 'upstream/master' into feature-char-lead-trail-surrogate