Add support for weak pointers to the C RTS

A weak pointer (aka weak reference) is a pointer to some garbage collector
(GC) allocated object or memory that is not considered by the GC when
deciding if the object is garbage or not.  Additionally, if the object is
reclaimed by the GC the GC will zero-out this pointer so that other code can
test if this object is still available.  Weak pointer can be useful when
implementing caches or cyclic data structures (my motivation for this
change).

This change introduces a weak pointer type (a typedef) in Mercury's runtime
system for the C backends.  Two macros are provided to create and deference
these weak pointers.  Extra documentation, and constraints on how these can
be used are described in mercury_memory.h.

runtime/mercury_memory.c:
runtime/mercury_memory.h:
    As above.

tests/general/weak_ptr.m:
tests/general/Mmakefile:
    Add a test for the C RTS's weak pointer support

tests/general/weak_ptr.exp:
    Expected output for the test.  This isn't the real program's output.
    weak_ptr's output is too volatile to use reliably (see weak_ptr.m).
Use C's 'const' keyword correctly in version_array.m

library/version_array.m:
    Use pointers to constant structures rather than constant pointers to
    structures.
Make version_array's rewind code use constant stack space.

Although rewinding version arrays should be rare it is better if this code
uses constant stack space to avoid crashes.  Currently the list of updates
made in a version array is kept in a singly linked list.  This list needs to
be walked backwards to unwind updates, such as when updating an old version
of an array (to fork into two separate arrays).  The stack is used to
perform this backwards work and can overflow for long histories.

This patch makes these lists doubly-linked so that they can be traversed in
either direction.  The back pointers are implemented using weak pointers in
all backends.  This avoids unnecessary memory retention when a programmer
only maintains a reference to the lastest version of the array, which is the
common case.

library/version_array.m:
    As above; I developed this algorithm in the C implementation first and
    then replicated the changes in the Java and C# implementations.

tests/hard_coded/version_array_test.m:
tests/hard_coded/version_array_test.exp:
    Extend the test case to exercise implicitly unwinding a version array by
    updating an old version of an array.  Note that the implicit and
    explicit unwind codepaths are different as they are out-of-place and
    in-place respectively.
Merge branch 'version-14_01-branch'
Add missing MR_GC_malloc_atomic procedure

In the runtime system we create wrappers for a number of procedures from the
Boehm GC, this helps provide portability incase we change garbage
collectors or compile without garbage collection support.

This patch adds the useful MR_GC_malloc_atomic procedure to this set of
procedures.

runtime/mercury_memory.c:
runtime/mercury_memory.h:
    As above.
Escape backslashes in foreign code.

library/version_array.m:
    Escape backslashes in foreign code so that gcc and gdb give us
    meaningful line numbers.