Add routines for copying to from Fortran dims
Sync up code with HDS upstream

Function now always copies to fortran dims as this simplifies
the calling code a lot and the additional overhead is small (especially
when we intend to switch to 64-bit dims).
Include Fortran interface

This is substantially identical to the HDS upstream version by
design.