Add frame_add and frame_alloc

Both frame add and alloc should work but are currently untested.  TODO: fix the
massive memory leak caused by never freeing frames at the moment.
Fix the massive memory leaks in frame allocation

Change most ptw_frame functions so that they take an additional output frame
pointer as an argument rather than allocating a new one each time.  Makes it
easier to keep track and free frames which need freeing, so we don't leak 160KB
of memory every time we call a function.
Add itof and ftoi functions for frames

Added in-place casting from one type to another.  Internally the special scale
is not used for faster operations, so the representations are very similar, but
float allows for greater accuracy at lower values, and also higher ints, but at
a significant loss of speed.
Make cur_pos unsigned long in append()

Suppress a warning caused by comparing signed cur_pos to unsigned
main_header_size (warning only present on gcc 4.5 for some reason, not 4.9.1).
Change func and type names for consistency

Changed several function names to form ptw_[type]_[action] so that they are
consistent.  Changed type ptw_file to ptw_hdr to more accurately describe what
it contains, rather than the misleading original.
Make hdr_alloc, hdr_swap_endian, use memcpy in hdr_write

Separated out the ptw_hdr allocation into a separate function so that it can be
called from outside of ptw_file_open, and move the endianness swap of a ptw_hdr
into a function so that the write operation can call it as well.

In ptw_hdr_write, if we're on a bigendian system, swapping the endianness of
the input ptw_hdr would mean that any subsequent access to that header would
have its endianness backwards, so we use memcpy to create a separate ptw_hdr
which we can safely swap for the write operation.
Fix num_frames in file_append on bigendian systems

num_frames was being incremented and then written directly to the file, which
resulted in the wrong value being written on bigendian system.  This fix created
a new variable in ptw_file_append which could safely have its endianness
swapped, then written to the output ptw file.
Merge working version of copy_ptw test

Merge the full version of copy_ptw into master, and all the commits which made
it possible.