Rewritten Pack.c, to share with a stand-alone library

The new packing routines avoid global data structures and instead
use buffers passed as arguments, and queue/hashtable freshly
allocated for each packing operation.

Pack.c has been revised while at it, modifying the PAP packing code
and checking and simplifying a few more places.

So far the code has not been extensively tested.
Merge branch 'master' into wip/Pack-c-rewrite
fix an overflow bug in the MPI implementation
Merge remote-tracking branch 'origin/master'
adopt blackhole-passing code from packman lib
use packBufferSize flag in seq. serialisation
corrected comments about packing error codes