[libgetdata] 01/02: Upstream 0.8.5

Michael Milligan mmilligan-guest at moszumanska.debian.org
Mon Aug 17 22:56:56 UTC 2015


This is an automated email from the git hooks/post-receive script.

mmilligan-guest pushed a commit to branch debian/master
in repository libgetdata.

commit 018430ac9049ead36460a9ad0cf8dec225cc433c
Author: Michael Milligan <milligan at umn.edu>
Date:   Mon Aug 17 17:48:01 2015 -0500

    Upstream 0.8.5
---
 AUTHORS                                         |   12 +-
 ChangeLog                                       | 1807 ++++++-
 Makefile.am                                     |   48 +-
 Makefile.in                                     |  202 +-
 NEWS                                            |  727 ++-
 README                                          |   63 +-
 TODO                                            |    4 +-
 aclocal.m4                                      |  127 +-
 bindings/Makefile.am                            |   19 +-
 bindings/Makefile.in                            |  114 +-
 bindings/cxx/Makefile.am                        |   16 +-
 bindings/cxx/Makefile.in                        |  144 +-
 bindings/cxx/bitentry.cpp                       |   19 +-
 bindings/cxx/carrayentry.cpp                    |   12 +-
 bindings/cxx/constentry.cpp                     |   10 +-
 bindings/cxx/dirfile.cpp                        |  197 +-
 bindings/cxx/divideentry.cpp                    |   11 +-
 bindings/cxx/entry.cpp                          |   29 +-
 bindings/cxx/fragment.cpp                       |   47 +-
 bindings/cxx/getdata/bitentry.h                 |   12 +-
 bindings/cxx/getdata/dirfile.h                  |   89 +-
 bindings/cxx/getdata/entry.h                    |   64 +-
 bindings/cxx/getdata/fragment.h                 |   35 +-
 bindings/cxx/getdata/mplexentry.h               |   74 +
 bindings/cxx/getdata/rawentry.h                 |   17 +-
 bindings/cxx/getdata/sbitentry.h                |   12 +-
 bindings/cxx/getdata/windowentry.h              |   66 +
 bindings/cxx/indexentry.cpp                     |   10 +-
 bindings/cxx/internal.h                         |   61 +
 bindings/cxx/lincomentry.cpp                    |   11 +-
 bindings/cxx/linterpentry.cpp                   |   11 +-
 bindings/cxx/mplexentry.cpp                     |  126 +
 bindings/cxx/multiplyentry.cpp                  |   11 +-
 bindings/cxx/phaseentry.cpp                     |   11 +-
 bindings/cxx/polynomentry.cpp                   |   11 +-
 bindings/cxx/rawentry.cpp                       |   25 +-
 bindings/cxx/recipentry.cpp                     |   11 +-
 bindings/cxx/sbitentry.cpp                      |   17 +-
 bindings/cxx/stringentry.cpp                    |   10 +-
 bindings/cxx/test/Makefile.am                   |    4 +-
 bindings/cxx/test/Makefile.in                   |  106 +-
 bindings/cxx/test/big_test.cpp                  |  643 ++-
 bindings/cxx/windowentry.cpp                    |  126 +
 bindings/f77/Makefile.am                        |   17 +-
 bindings/f77/Makefile.in                        |  153 +-
 bindings/f77/fgetdata.c                         | 3016 ++++++++----
 bindings/f77/fgetdata.h                         |  979 ++--
 bindings/f77/getdata.f.in                       |   87 +-
 bindings/f77/getdata.f90.in                     |  767 ++-
 bindings/f77/test/Makefile.am                   |   12 +-
 bindings/f77/test/Makefile.in                   |  122 +-
 bindings/f77/test/big_test.f                    | 4223 +++++-----------
 bindings/f77/test/big_test95.f90                | 5907 +++++++----------------
 bindings/f77/test/gdcopn.f                      |   78 +-
 bindings/f77/test/test_getdata.f.in             |    2 +
 bindings/idl/Makefile.am                        |    8 +-
 bindings/idl/Makefile.in                        |  139 +-
 bindings/idl/getdata.c                          | 1382 +++++-
 bindings/idl/makedlm.sh.in                      |   14 +-
 bindings/idl/test/Makefile.in                   |  100 +-
 bindings/idl/test/big_test.pro                  |  315 +-
 bindings/idl/test/getdata_idl_test_routines.pro |   16 +-
 bindings/make_parameters.c                      |  255 +-
 bindings/matlab/Contents.m.head                 |   95 +
 bindings/matlab/Makefile.am                     |  120 +
 bindings/matlab/Makefile.in                     | 1007 ++++
 bindings/matlab/doc.tail                        |   20 +
 bindings/matlab/gd_add.c                        |   56 +
 bindings/matlab/gd_add_alias.c                  |   58 +
 bindings/matlab/gd_add_bit.m                    |   41 +
 bindings/matlab/gd_add_carray.c                 |   63 +
 bindings/matlab/gd_add_const.c                  |   63 +
 bindings/matlab/gd_add_divide.m                 |   39 +
 bindings/matlab/gd_add_lincom.m                 |   41 +
 bindings/matlab/gd_add_linterp.m                |   40 +
 bindings/matlab/gd_add_mplex.m                  |   43 +
 bindings/matlab/gd_add_multiply.m               |   39 +
 bindings/matlab/gd_add_phase.m                  |   39 +
 bindings/matlab/gd_add_polynom.m                |   40 +
 bindings/matlab/gd_add_raw.m                    |   41 +
 bindings/matlab/gd_add_recip.m                  |   40 +
 bindings/matlab/gd_add_sbit.m                   |   41 +
 bindings/matlab/gd_add_spec.c                   |   56 +
 bindings/matlab/gd_add_string.c                 |   58 +
 bindings/matlab/gd_add_window.m                 |   44 +
 bindings/matlab/gd_alias_target.c               |   54 +
 bindings/matlab/gd_aliases.c                    |   55 +
 bindings/matlab/gd_alter_affixes.c              |   61 +
 bindings/matlab/gd_alter_bit.m                  |   39 +
 bindings/matlab/gd_alter_carray.m               |   40 +
 bindings/matlab/gd_alter_const.m                |   40 +
 bindings/matlab/gd_alter_divide.m               |   39 +
 bindings/matlab/gd_alter_encoding.c             |   60 +
 bindings/matlab/gd_alter_endianness.c           |   63 +
 bindings/matlab/gd_alter_entry.c                |   66 +
 bindings/matlab/gd_alter_frameoffset.c          |   57 +
 bindings/matlab/gd_alter_lincom.m               |   41 +
 bindings/matlab/gd_alter_linterp.m              |   41 +
 bindings/matlab/gd_alter_mplex.m                |   41 +
 bindings/matlab/gd_alter_multiply.m             |   39 +
 bindings/matlab/gd_alter_phase.m                |   39 +
 bindings/matlab/gd_alter_polynom.m              |   39 +
 bindings/matlab/gd_alter_protection.c           |   55 +
 bindings/matlab/gd_alter_raw.m                  |   42 +
 bindings/matlab/gd_alter_recip.m                |   39 +
 bindings/matlab/gd_alter_sbit.m                 |   39 +
 bindings/matlab/gd_alter_spec.c                 |   58 +
 bindings/matlab/gd_alter_window.m               |   40 +
 bindings/matlab/gd_bof.c                        |   56 +
 bindings/matlab/gd_carray_len.c                 |   56 +
 bindings/matlab/gd_carrays.c                    |   61 +
 bindings/matlab/gd_close.c                      |   52 +
 bindings/matlab/gd_constants.c                  |   66 +
 bindings/matlab/gd_delete.c                     |   57 +
 bindings/matlab/gd_delete_alias.c               |   57 +
 bindings/matlab/gd_desync.c                     |   59 +
 bindings/matlab/gd_dirfile_standards.c          |   56 +
 bindings/matlab/gd_dirfilename.c                |   51 +
 bindings/matlab/gd_discard.c                    |   52 +
 bindings/matlab/gd_encoding.c                   |   55 +
 bindings/matlab/gd_endianness.c                 |   56 +
 bindings/matlab/gd_entry.c                      |   59 +
 bindings/matlab/gd_entry_list.c                 |   69 +
 bindings/matlab/gd_entry_type.c                 |   57 +
 bindings/matlab/gd_eof.c                        |   56 +
 bindings/matlab/gd_error.c                      |   54 +
 bindings/matlab/gd_error_string.c               |   55 +
 bindings/matlab/gd_field_list.m                 |   30 +
 bindings/matlab/gd_field_list_by_type.m         |   30 +
 bindings/matlab/gd_flags.c                      |   57 +
 bindings/matlab/gd_flush.c                      |   57 +
 bindings/matlab/gd_fragment_affixes.c           |   60 +
 bindings/matlab/gd_fragment_index.c             |   56 +
 bindings/matlab/gd_fragmentname.c               |   54 +
 bindings/matlab/gd_framenum.c                   |   64 +
 bindings/matlab/gd_frameoffset.c                |   54 +
 bindings/matlab/gd_get_carray.c                 |   70 +
 bindings/matlab/gd_get_carray_slice.c           |   71 +
 bindings/matlab/gd_get_constant.m               |   37 +
 bindings/matlab/gd_get_string.c                 |   64 +
 bindings/matlab/gd_getdata.c                    |   75 +
 bindings/matlab/gd_hidden.c                     |   55 +
 bindings/matlab/gd_hide.c                       |   52 +
 bindings/matlab/gd_include.c                    |   69 +
 bindings/matlab/gd_invalid_dirfile.c            |   45 +
 bindings/matlab/gd_linterp_tablename.c          |   55 +
 bindings/matlab/gd_madd.c                       |   59 +
 bindings/matlab/gd_madd_alias.c                 |   58 +
 bindings/matlab/gd_madd_bit.m                   |   39 +
 bindings/matlab/gd_madd_carray.c                |   62 +
 bindings/matlab/gd_madd_const.c                 |   62 +
 bindings/matlab/gd_madd_divide.m                |   38 +
 bindings/matlab/gd_madd_lincom.m                |   40 +
 bindings/matlab/gd_madd_linterp.m               |   39 +
 bindings/matlab/gd_madd_mplex.m                 |   42 +
 bindings/matlab/gd_madd_multiply.m              |   38 +
 bindings/matlab/gd_madd_phase.m                 |   39 +
 bindings/matlab/gd_madd_polynom.m               |   39 +
 bindings/matlab/gd_madd_recip.m                 |   39 +
 bindings/matlab/gd_madd_sbit.m                  |   39 +
 bindings/matlab/gd_madd_spec.c                  |   55 +
 bindings/matlab/gd_madd_string.c                |   58 +
 bindings/matlab/gd_madd_window.m                |   43 +
 bindings/matlab/gd_malter_spec.c                |   60 +
 bindings/matlab/gd_matlab.h                     |  113 +
 bindings/matlab/gd_mcarrays.c                   |   65 +
 bindings/matlab/gd_mconstants.c                 |   69 +
 bindings/matlab/gd_metaflush.c                  |   50 +
 bindings/matlab/gd_mfield_list.m                |   30 +
 bindings/matlab/gd_mfield_list_by_type.m        |   30 +
 bindings/matlab/gd_move.c                       |   59 +
 bindings/matlab/gd_move_alias.c                 |   55 +
 bindings/matlab/gd_mplex_lookback.c             |   54 +
 bindings/matlab/gd_mstrings.c                   |   57 +
 bindings/matlab/gd_mvector_list.m               |   34 +
 bindings/matlab/gd_naliases.c                   |   55 +
 bindings/matlab/gd_native_type.c                |   57 +
 bindings/matlab/gd_nentries.c                   |   67 +
 bindings/matlab/gd_nfields.m                    |   30 +
 bindings/matlab/gd_nfields_by_type.m            |   30 +
 bindings/matlab/gd_nfragments.c                 |   51 +
 bindings/matlab/gd_nframes.c                    |   51 +
 bindings/matlab/gd_nmfields.m                   |   30 +
 bindings/matlab/gd_nmfields_by_type.m           |   30 +
 bindings/matlab/gd_nmvectors.m                  |   34 +
 bindings/matlab/gd_nvectors.m                   |   34 +
 bindings/matlab/gd_open.c                       |   62 +
 bindings/matlab/gd_parent_fragment.c            |   54 +
 bindings/matlab/gd_protection.c                 |   55 +
 bindings/matlab/gd_put_carray.m                 |   31 +
 bindings/matlab/gd_put_carray_slice.c           |   60 +
 bindings/matlab/gd_put_constant.m               |   31 +
 bindings/matlab/gd_put_string.c                 |   54 +
 bindings/matlab/gd_putdata.c                    |   64 +
 bindings/matlab/gd_raw_close.c                  |   55 +
 bindings/matlab/gd_raw_filename.c               |   55 +
 bindings/matlab/gd_reference.c                  |   57 +
 bindings/matlab/gd_rename.c                     |   58 +
 bindings/matlab/gd_rewrite_fragment.c           |   54 +
 bindings/matlab/gd_seek.c                       |   66 +
 bindings/matlab/gd_spf.c                        |   54 +
 bindings/matlab/gd_strings.c                    |   53 +
 bindings/matlab/gd_strtok.c                     |   69 +
 bindings/matlab/gd_sync.c                       |   56 +
 bindings/matlab/gd_tell.c                       |   56 +
 bindings/matlab/gd_unhide.c                     |   52 +
 bindings/matlab/gd_uninclude.c                  |   56 +
 bindings/matlab/gd_validate.c                   |   55 +
 bindings/matlab/gd_vector_list.m                |   34 +
 bindings/matlab/gd_verbose_prefix.c             |   53 +
 bindings/matlab/getdata_constants.m             |  221 +
 bindings/matlab/make_contents.sh.in             |   55 +
 bindings/matlab/matlab.c                        | 1541 ++++++
 bindings/matlab/test/Makefile.am                |   41 +
 bindings/matlab/test/Makefile.in                |  608 +++
 bindings/matlab/test/big_test.m                 | 2227 +++++++++
 bindings/matlab/test/test.sh                    |   10 +
 bindings/perl/Build.PL.in                       |   57 +
 bindings/perl/GetData.pm.in                     | 1239 +++++
 bindings/perl/GetData.xs                        | 2098 ++++++++
 bindings/perl/MANIFEST.in                       |    2 +
 bindings/perl/Makefile.am                       |  103 +
 bindings/perl/Makefile.in                       |  742 +++
 bindings/perl/funclist.pl                       |   19 +
 bindings/perl/simple_funcs.pl                   |  160 +
 bindings/perl/simple_funcs.xsin                 |  157 +
 bindings/perl/t/big_test.t                      | 1728 +++++++
 bindings/perl/t/callback.t                      |   37 +
 bindings/perl/typemap                           |  148 +
 bindings/python/Makefile.am                     |    1 +
 bindings/python/Makefile.in                     |  111 +-
 bindings/python/pydirfile.c                     | 2045 +++++---
 bindings/python/pyentry.c                       | 1035 ++--
 bindings/python/pyfragment.c                    |  271 +-
 bindings/python/pygetdata.c                     |  109 +-
 bindings/python/pygetdata.h                     |   38 +-
 bindings/python/test/Makefile.am                |    2 +-
 bindings/python/test/Makefile.in                |  102 +-
 bindings/python/test/big_test.py                |  588 ++-
 bindings/python/test/callback.py                |    3 +-
 config.guess                                    |  259 +-
 config.sub                                      |  204 +-
 configure                                       | 5200 ++++++++++++++------
 configure.ac                                    |  577 ++-
 depcomp                                         |  190 +-
 doc/Makefile.am                                 |   13 +-
 doc/Makefile.in                                 |  112 +-
 doc/README.cxx                                  |  280 +-
 doc/README.f77                                  |  744 ++-
 doc/README.f95                                  |  295 +-
 doc/README.idl                                  |  391 +-
 doc/README.matlab                               |   19 +
 doc/README.perl                                 |   16 +
 doc/README.python                               |    2 +-
 install-sh                                      |   29 +-
 ltmain.sh                                       |   95 +-
 m4/compiler.m4                                  |   85 +-
 m4/encoding.m4                                  |   25 +-
 m4/floatordering.m4                             |   69 +
 m4/idl.m4                                       |    6 +-
 m4/libtool.m4                                   |  265 +-
 m4/ltoptions.m4                                 |   19 +-
 m4/ltversion.m4                                 |   10 +-
 m4/matlab.m4                                    |  161 +
 m4/perl.m4                                      |  196 +
 m4/python.m4                                    |    6 +-
 m4/version.m4                                   |   19 +-
 man/GD_SIZE.3                                   |   59 +
 man/Makefile.am                                 |  127 +-
 man/Makefile.in                                 |  284 +-
 man/checkdirfile.1                              |   23 +-
 man/dirfile-encoding.5                          |  165 +-
 man/dirfile-format.5                            |  847 +++-
 man/dirfile.5                                   |    9 +-
 man/dirfile2ascii.1                             |   27 +-
 man/gd_add.3                                    |   37 +-
 man/gd_add_alias.3                              |  101 +
 man/gd_add_bit.3                                |   88 +-
 man/gd_alias_target.3                           |   81 +
 man/gd_aliases.3                                |   84 +
 man/gd_alter_affixes.3                          |  112 +
 man/gd_alter_bit.3                              |   91 +-
 man/gd_alter_encoding.3.in                      |    6 +-
 man/gd_alter_endianness.3.in                    |   15 +-
 man/gd_alter_entry.3                            |    9 +-
 man/gd_alter_frameoffset.3.in                   |    2 +-
 man/gd_alter_protection.3                       |    9 +-
 man/gd_alter_spec.3                             |   12 +-
 man/gd_bof.3                                    |   12 +-
 man/gd_bof64.3                                  |   54 +
 man/gd_carray_len.3                             |   24 +-
 man/gd_carrays.3                                |   13 +-
 man/gd_cbopen.3                                 |  157 +-
 man/gd_close.3                                  |   13 +-
 man/gd_constants.3                              |    7 +-
 man/gd_delete.3                                 |   33 +-
 man/gd_desync.3                                 |  129 +
 man/gd_dirfile_standards.3                      |   14 +-
 man/gd_dirfilename.3                            |   16 +-
 man/gd_encoding.3                               |   25 +-
 man/gd_entry.3                                  |  321 +-
 man/gd_entry_list.3                             |  210 +
 man/gd_entry_type.3                             |   27 +-
 man/gd_eof.3                                    |   12 +-
 man/gd_eof64.3                                  |   54 +
 man/gd_error.3                                  |   11 +-
 man/gd_error_count.3                            |   58 +
 man/gd_error_string.3                           |   14 +-
 man/gd_flags.3                                  |   93 +
 man/gd_flush.3                                  |   63 +-
 man/gd_fragment_affixes.3                       |   88 +
 man/gd_fragment_index.3                         |   35 +-
 man/gd_framenum_subset.3                        |   14 +-
 man/gd_framenum_subset64.3                      |   34 +-
 man/gd_frameoffset64.3                          |   36 +-
 man/gd_get_carray_slice.3                       |   72 +-
 man/gd_getdata.3                                |  240 +-
 man/gd_getdata64.3                              |   37 +-
 man/gd_hidden.3                                 |   77 +
 man/gd_hide.3                                   |   89 +
 man/gd_include_affix.3                          |  354 ++
 man/gd_invalid_dirfile.3                        |    5 +-
 man/gd_linterp_tablename.3                      |   91 +
 man/gd_madd_bit.3                               |   71 +-
 man/gd_mcarrays.3                               |    9 +-
 man/gd_mconstants.3                             |    9 +-
 man/gd_metaflush.3                              |   20 +-
 man/gd_move.3                                   |   26 +-
 man/gd_mplex_lookback.3                         |  124 +
 man/gd_mstrings.3                               |   11 +-
 man/gd_naliases.3                               |   62 +
 man/gd_native_type.3                            |   43 +-
 man/gd_nentries.3                               |  194 +
 man/gd_nframes.3                                |   12 +-
 man/gd_nframes64.3                              |   32 +-
 man/gd_parent_fragment.3                        |    6 +-
 man/gd_put_carray_slice.3                       |   75 +-
 man/gd_put_string.3                             |   10 +-
 man/gd_putdata.3                                |   83 +-
 man/gd_putdata64.3                              |   37 +-
 man/gd_rename.3                                 |   44 +-
 man/gd_rewrite_fragment.3                       |   12 +-
 man/gd_seek.3                                   |  212 +
 man/gd_seek64.3                                 |   55 +
 man/gd_spf.3                                    |   13 +-
 man/gd_strings.3                                |   11 +-
 man/gd_strtok.3                                 |   97 +
 man/gd_tell.3                                   |  110 +
 man/gd_tell64.3                                 |   54 +
 man/gd_validate.3                               |   10 +-
 man/gd_verbose_prefix.3                         |   82 +
 missing                                         |   53 +-
 src/Makefile.am                                 |   72 +-
 src/Makefile.in                                 |  365 +-
 src/add.c                                       | 1168 +++--
 src/ascii.c                                     |  198 +-
 src/bzip.c                                      |   75 +-
 src/close.c                                     |   53 +-
 src/common.c                                    |  781 ++-
 src/compat.c                                    |  327 +-
 src/constant.c                                  |  197 +-
 src/debug.c                                     |   19 +-
 src/del.c                                       |  244 +-
 src/encoding.c                                  |  883 +++-
 src/endian.c                                    |   76 +-
 src/entry.c                                     |  478 +-
 src/errors.c                                    |  114 +-
 src/field_list.c                                |  546 ++-
 src/flimits.c                                   |  110 +-
 src/flush.c                                     |  837 ++--
 src/fpos.c                                      |  402 ++
 src/fragment.c                                  |  336 +-
 src/gd_config.h.in                              |  698 +++
 src/getdata.c                                   |  773 ++-
 src/getdata.h.in                                |  364 +-
 src/getdata_legacy.h                            |    2 +-
 src/globals.c                                   |   83 +-
 src/gzip.c                                      |  164 +-
 src/include.c                                   |  412 +-
 src/index.c                                     |   24 +-
 src/internal.h                                  | 1132 +++--
 src/legacy.c                                    |   79 +-
 src/lzma.c                                      |  102 +-
 src/mod.c                                       |  651 ++-
 src/move.c                                      |  402 +-
 src/name.c                                      |  669 ++-
 src/nan.h                                       |    4 +-
 src/native.c                                    |   27 +-
 src/nfields.c                                   |  144 +-
 src/nframes.c                                   |   20 +-
 src/open.c                                      |  519 +-
 src/parse.c                                     | 1629 ++++---
 src/protect.c                                   |   10 +-
 src/putdata.c                                   |  375 +-
 src/raw.c                                       |  162 +-
 src/sie.c                                       |  519 ++
 src/slim.c                                      |   78 +-
 src/spf.c                                       |   34 +-
 src/string.c                                    |   53 +-
 src/types.c                                     |   18 +-
 src/zzip.c                                      |  222 +
 src/zzslim.c                                    |  181 +
 test/Makefile.am                                |  357 +-
 test/Makefile.in                                | 4813 +++++++++++++-----
 test/add.c                                      |   37 +-
 test/add_affix.c                                |  105 +
 test/add_alias.c                                |   57 +
 test/add_alias_affix.c                          |   66 +
 test/add_alias_meta.c                           |   57 +
 test/add_bit.c                                  |   29 +-
 test/add_bit_bitnum.c                           |   29 +-
 test/add_bit_bitsize.c                          |   29 +-
 test/add_bit_invalid.c                          |   27 +-
 test/add_bit_numbits.c                          |   29 +-
 test/add_carray.c                               |   29 +-
 test/add_clincom.c                              |   32 +-
 test/add_code.c                                 |   33 +-
 test/add_const.c                                |   28 +-
 test/add_cpolynom.c                             |   30 +-
 test/add_crecip.c                               |   29 +-
 test/add_crecip89.c                             |   28 +-
 test/add_divide.c                               |   29 +-
 test/add_divide_invalid.c                       |   26 +-
 test/add_duplicate.c                            |   27 +-
 test/add_format.c                               |   33 +-
 test/add_invalid.c                              |   30 +-
 test/add_lincom.c                               |   32 +-
 test/add_lincom_affix.c                         |   86 +
 test/add_lincom_invalid.c                       |   30 +-
 test/add_lincom_nfields.c                       |   32 +-
 test/add_linterp.c                              |   28 +-
 test/add_linterp_invalid.c                      |   26 +-
 test/add_meta.c                                 |   76 +
 test/add_meta_alias.c                           |   79 +
 test/add_mplex.c                                |   58 +
 test/add_mplex_val.c                            |   43 +
 test/add_multiply.c                             |   28 +-
 test/add_multiply_invalid.c                     |   26 +-
 test/add_phase.c                                |   28 +-
 test/add_phase_invalid.c                        |   26 +-
 test/add_polynom.c                              |   30 +-
 test/add_protect.c                              |   27 +-
 test/add_raw.c                                  |   34 +-
 test/add_raw_include.c                          |   36 +-
 test/add_raw_invalid.c                          |   26 +-
 test/add_raw_spf.c                              |   28 +-
 test/add_raw_type.c                             |   28 +-
 test/add_rdonly.c                               |   27 +-
 test/add_recip.c                                |   28 +-
 test/add_resolv.c                               |   57 +
 test/add_sbit.c                                 |   28 +-
 test/add_scalar.c                               |   36 +-
 test/add_scalar_carray.c                        |   73 +
 test/add_scalar_carray_bad.c                    |   73 +
 test/add_sort.c                                 |   53 +-
 test/add_spec.c                                 |   30 +-
 test/add_spec_directive.c                       |   30 +-
 test/add_spec_invalid.c                         |   26 +-
 test/add_spec_meta.c                            |   28 +-
 test/add_spec_resolv.c                          |   57 +
 test/add_string.c                               |   28 +-
 test/add_string_affix.c                         |   62 +
 test/add_type.c                                 |   33 +-
 test/add_window.c                               |   60 +
 test/add_window_op.c                            |   54 +
 test/alias_list.c                               |   71 +
 test/alias_list_alias.c                         |   71 +
 test/alias_list_missing.c                       |   57 +
 test/alias_num.c                                |   57 +
 test/alias_num_alias.c                          |   57 +
 test/alias_num_missing.c                        |   56 +
 test/alias_target.c                             |   52 +
 test/alias_target_alias.c                       |   52 +
 test/alias_target_missing.c                     |   52 +
 test/alter_bit_bitnum.c                         |   29 +-
 test/alter_bit_numbits.c                        |   29 +-
 test/alter_carray_len.c                         |   27 +-
 test/alter_carray_type.c                        |   27 +-
 test/alter_const.c                              |   27 +-
 test/alter_const_c2r.c                          |   65 +
 test/alter_cpolynom.c                           |   29 +-
 test/alter_crecip.c                             |   29 +-
 test/alter_crecip89.c                           |   29 +-
 test/alter_crecip_zero.c                        |   34 +-
 test/alter_divide.c                             |   29 +-
 test/alter_entry.c                              |   29 +-
 test/alter_entry_affix.c                        |   75 +
 test/alter_entry_hidden.c                       |   69 +
 test/alter_entry_recode.c                       |   31 +-
 test/alter_entry_scalar2a.c                     |   27 +-
 test/alter_entry_scalar2n.c                     |   29 +-
 test/alter_entry_scalar3.c                      |   27 +-
 test/alter_entry_scalar4.c                      |   27 +-
 test/alter_lincom_23.c                          |   31 +-
 test/alter_lincom_32.c                          |   31 +-
 test/alter_lincom_affix.c                       |   89 +
 test/alter_lincom_input.c                       |   31 +-
 test/alter_lincom_offset.c                      |   31 +-
 test/alter_lincom_slope.c                       |   31 +-
 test/alter_linterp.c                            |   37 +-
 test/alter_linterp_move.c                       |   37 +-
 test/alter_mplex.c                              |   79 +
 test/alter_mspec.c                              |   29 +-
 test/alter_mspec_affix.c                        |   73 +
 test/alter_multiply.c                           |   29 +-
 test/alter_phase.c                              |   29 +-
 test/alter_polynom_coeff.c                      |   29 +-
 test/alter_polynom_input.c                      |   29 +-
 test/alter_polynom_ord.c                        |   29 +-
 test/alter_raw_spf.c                            |   29 +-
 test/alter_raw_type.c                           |   29 +-
 test/alter_recip.c                              |   29 +-
 test/alter_recip_zero.c                         |   29 +-
 test/alter_scalar_affix.c                       |   91 +
 test/alter_spec.c                               |   29 +-
 test/alter_spec_affix.c                         |   70 +
 test/alter_spec_meta.c                          |   29 +-
 test/alter_window.c                             |   79 +
 test/ascii_add.c                                |   69 +
 test/ascii_get.c                                |   31 +-
 test/ascii_get_get.c                            |   31 +-
 test/ascii_nframes.c                            |   31 +-
 test/ascii_put.c                                |   31 +-
 test/bof.c                                      |   29 +-
 test/bof_lincom.c                               |   31 +-
 test/bof_phase.c                                |   31 +-
 test/bzip_get.c                                 |   32 +-
 test/bzip_get_get.c                             |   46 +-
 test/bzip_move_from.c                           |   38 +-
 test/bzip_nframes.c                             |   32 +-
 test/close.c                                    |   25 +-
 test/close_bad.c                                |   22 +-
 test/close_discard.c                            |   27 +-
 test/close_null.c                               |   20 +
 test/convert_complex128_complex64.c             |   29 +-
 test/convert_complex128_float64.c               |   27 +-
 test/convert_complex128_int64.c                 |   27 +-
 test/convert_complex128_uint64.c                |   27 +-
 test/convert_complex64_complex128.c             |   29 +-
 test/convert_complex64_float64.c                |   27 +-
 test/convert_complex64_int64.c                  |   27 +-
 test/convert_complex64_uint64.c                 |   27 +-
 test/convert_float32_complex128.c               |   29 +-
 test/convert_float32_complex64.c                |   29 +-
 test/convert_float32_float64.c                  |   29 +-
 test/convert_float32_int16.c                    |   29 +-
 test/convert_float32_int32.c                    |   29 +-
 test/convert_float32_int64.c                    |   29 +-
 test/convert_float32_int8.c                     |   29 +-
 test/convert_float32_uint16.c                   |   29 +-
 test/convert_float32_uint32.c                   |   29 +-
 test/convert_float32_uint64.c                   |   29 +-
 test/convert_float32_uint8.c                    |   29 +-
 test/convert_float64_complex128.c               |   29 +-
 test/convert_float64_complex64.c                |   29 +-
 test/convert_float64_float32.c                  |   29 +-
 test/convert_float64_int16.c                    |   29 +-
 test/convert_float64_int32.c                    |   29 +-
 test/convert_float64_int64.c                    |   29 +-
 test/convert_float64_int8.c                     |   29 +-
 test/convert_float64_uint16.c                   |   29 +-
 test/convert_float64_uint32.c                   |   29 +-
 test/convert_float64_uint64.c                   |   29 +-
 test/convert_float64_uint8.c                    |   29 +-
 test/convert_int16_complex128.c                 |   29 +-
 test/convert_int16_complex64.c                  |   29 +-
 test/convert_int16_float32.c                    |   29 +-
 test/convert_int16_float64.c                    |   29 +-
 test/convert_int16_int32.c                      |   29 +-
 test/convert_int16_int64.c                      |   29 +-
 test/convert_int16_int8.c                       |   29 +-
 test/convert_int16_uint16.c                     |   29 +-
 test/convert_int16_uint32.c                     |   29 +-
 test/convert_int16_uint64.c                     |   29 +-
 test/convert_int16_uint8.c                      |   29 +-
 test/convert_int32_complex128.c                 |   29 +-
 test/convert_int32_complex64.c                  |   29 +-
 test/convert_int32_float32.c                    |   29 +-
 test/convert_int32_float64.c                    |   29 +-
 test/convert_int32_int16.c                      |   29 +-
 test/convert_int32_int64.c                      |   29 +-
 test/convert_int32_int8.c                       |   29 +-
 test/convert_int32_uint16.c                     |   29 +-
 test/convert_int32_uint32.c                     |   29 +-
 test/convert_int32_uint64.c                     |   29 +-
 test/convert_int32_uint8.c                      |   29 +-
 test/convert_int64_complex128.c                 |   29 +-
 test/convert_int64_complex64.c                  |   29 +-
 test/convert_int64_float32.c                    |   29 +-
 test/convert_int64_float64.c                    |   29 +-
 test/convert_int64_int16.c                      |   29 +-
 test/convert_int64_int32.c                      |   29 +-
 test/convert_int64_int8.c                       |   29 +-
 test/convert_int64_uint16.c                     |   29 +-
 test/convert_int64_uint32.c                     |   29 +-
 test/convert_int64_uint64.c                     |   29 +-
 test/convert_int64_uint8.c                      |   29 +-
 test/convert_int8_complex128.c                  |   29 +-
 test/convert_int8_complex64.c                   |   29 +-
 test/convert_int8_float32.c                     |   29 +-
 test/convert_int8_float64.c                     |   29 +-
 test/convert_int8_int16.c                       |   29 +-
 test/convert_int8_int32.c                       |   29 +-
 test/convert_int8_int64.c                       |   29 +-
 test/convert_int8_uint16.c                      |   29 +-
 test/convert_int8_uint32.c                      |   29 +-
 test/convert_int8_uint64.c                      |   29 +-
 test/convert_int8_uint8.c                       |   29 +-
 test/convert_uint16_complex128.c                |   29 +-
 test/convert_uint16_complex64.c                 |   29 +-
 test/convert_uint16_float32.c                   |   29 +-
 test/convert_uint16_float64.c                   |   29 +-
 test/convert_uint16_int16.c                     |   29 +-
 test/convert_uint16_int32.c                     |   29 +-
 test/convert_uint16_int64.c                     |   29 +-
 test/convert_uint16_int8.c                      |   29 +-
 test/convert_uint16_uint32.c                    |   29 +-
 test/convert_uint16_uint64.c                    |   29 +-
 test/convert_uint16_uint8.c                     |   29 +-
 test/convert_uint32_complex128.c                |   29 +-
 test/convert_uint32_complex64.c                 |   29 +-
 test/convert_uint32_float32.c                   |   29 +-
 test/convert_uint32_float64.c                   |   29 +-
 test/convert_uint32_int16.c                     |   29 +-
 test/convert_uint32_int32.c                     |   29 +-
 test/convert_uint32_int64.c                     |   29 +-
 test/convert_uint32_int8.c                      |   29 +-
 test/convert_uint32_uint16.c                    |   29 +-
 test/convert_uint32_uint64.c                    |   29 +-
 test/convert_uint32_uint8.c                     |   29 +-
 test/convert_uint64_complex128.c                |   29 +-
 test/convert_uint64_complex64.c                 |   29 +-
 test/convert_uint64_float32.c                   |   29 +-
 test/convert_uint64_float64.c                   |   29 +-
 test/convert_uint64_int16.c                     |   29 +-
 test/convert_uint64_int32.c                     |   29 +-
 test/convert_uint64_int64.c                     |   29 +-
 test/convert_uint64_int8.c                      |   29 +-
 test/convert_uint64_uint16.c                    |   29 +-
 test/convert_uint64_uint32.c                    |   29 +-
 test/convert_uint64_uint8.c                     |   29 +-
 test/convert_uint8_complex128.c                 |   29 +-
 test/convert_uint8_complex64.c                  |   29 +-
 test/convert_uint8_float32.c                    |   29 +-
 test/convert_uint8_float64.c                    |   29 +-
 test/convert_uint8_int16.c                      |   29 +-
 test/convert_uint8_int32.c                      |   29 +-
 test/convert_uint8_int64.c                      |   29 +-
 test/convert_uint8_int8.c                       |   29 +-
 test/convert_uint8_uint16.c                     |   29 +-
 test/convert_uint8_uint32.c                     |   29 +-
 test/convert_uint8_uint64.c                     |   29 +-
 test/creat.c                                    |   32 +-
 test/creat_excl.c                               |   27 +-
 test/creat_rdonly.c                             |   32 +-
 test/cvlist.c                                   |   27 +-
 test/cvlist_array.c                             |   27 +-
 test/cvlist_array_hidden.c                      |   67 +
 test/cvlist_array_meta.c                        |   27 +-
 test/cvlist_array_meta_hidden.c                 |   68 +
 test/cvlist_hidden.c                            |   60 +
 test/cvlist_invalid.c                           |   33 +-
 test/cvlist_meta.c                              |   27 +-
 test/cvlist_meta_hidden.c                       |   60 +
 test/cvlist_meta_invalid.c                      |   33 +-
 test/del.c                                      |   29 +-
 test/del_carray.c                               |   27 +-
 test/del_carray_deref.c                         |   29 +-
 test/del_const.c                                |   27 +-
 test/del_const_deref.c                          |   29 +-
 test/del_const_force.c                          |   29 +-
 test/del_data.c                                 |   29 +-
 test/del_derived.c                              |   27 +-
 test/del_derived_after.c                        |   59 +
 test/del_derived_force.c                        |   27 +-
 test/del_meta.c                                 |   27 +-
 test/del_meta_force.c                           |   27 +-
 test/desync.c                                   |   67 +
 test/desync_flush.c                             |   60 +
 test/desync_reopen.c                            |   68 +
 test/desync_reopen_inv.c                        |   68 +
 test/dfes_bit.c                                 |   27 +-
 test/dfes_divide.c                              |   27 +-
 test/dfes_lincom.c                              |   27 +-
 test/dfes_linterp.c                             |   27 +-
 test/dfes_multiply.c                            |   27 +-
 test/dfes_null.c                                |   20 +
 test/dfes_phase.c                               |   27 +-
 test/dfes_raw.c                                 |   27 +-
 test/dfes_recip.c                               |   27 +-
 test/dfes_zero.c                                |   20 +
 test/elist_alias.c                              |   78 +
 test/elist_hidden.c                             |   75 +
 test/elist_noalias.c                            |   75 +
 test/elist_scalar.c                             |   70 +
 test/encode_alter.c                             |   33 +-
 test/encode_get.c                               |   29 +-
 test/encode_move.c                              |   31 +-
 test/endian_alter.c                             |   30 +-
 test/endian_alter_sie.c                         |   97 +
 test/endian_get.c                               |   40 +-
 test/endian_move.c                              |   30 +-
 test/entry_bad_code.c                           |   27 +-
 test/entry_bit.c                                |   27 +-
 test/entry_bit_scalar.c                         |   27 +-
 test/entry_divide.c                             |   65 +
 test/entry_invalid.c                            |   26 +-
 test/entry_lincom.c                             |   27 +-
 test/entry_lincom_scalar.c                      |   27 +-
 test/entry_linterp.c                            |   27 +-
 test/entry_mplex.c                              |   59 +
 test/entry_mplex_scalar.c                       |   66 +
 test/entry_multiply.c                           |   27 +-
 test/entry_phase.c                              |   27 +-
 test/entry_phase_scalar.c                       |   27 +-
 test/entry_polynom.c                            |   27 +-
 test/entry_polynom_scalar.c                     |   27 +-
 test/entry_raw.c                                |   27 +-
 test/entry_raw_scalar.c                         |   27 +-
 test/entry_raw_scalar_code.c                    |   27 +-
 test/entry_raw_scalar_type.c                    |   27 +-
 test/entry_recip.c                              |   67 +
 test/entry_scalar_repr.c                        |   27 +-
 test/entry_type.c                               |   27 +-
 test/entry_type_alias.c                         |   54 +
 test/entry_window.c                             |   67 +
 test/entry_window_scalar.c                      |   69 +
 test/eof.c                                      |   29 +-
 test/eof_index.c                                |   29 +-
 test/eof_lincom.c                               |   31 +-
 test/eof_phase.c                                |   29 +-
 test/error.c                                    |   25 +-
 test/error_error.c                              |   25 +-
 test/error_num.c                                |   54 +
 test/error_short.c                              |   25 +-
 test/error_verbose.c                            |   79 +
 test/error_verbose_prefix.c                     |   90 +
 test/file.c                                     |   40 +-
 test/file_code.c                                |   29 +-
 test/file_type.c                                |   29 +-
 test/flist.c                                    |   27 +-
 test/flist_hidden.c                             |   73 +
 test/flist_invalid.c                            |   33 +-
 test/flist_meta.c                               |   27 +-
 test/flist_meta_hidden.c                        |   71 +
 test/flist_meta_invalid.c                       |   33 +-
 test/flist_type.c                               |   27 +-
 test/flist_type_hidden.c                        |   75 +
 test/flist_type_invalid.c                       |   33 +-
 test/flist_type_meta.c                          |   27 +-
 test/flist_type_meta_hidden.c                   |   74 +
 test/flist_type_meta_invalid.c                  |   33 +-
 test/flush.c                                    |   29 +-
 test/flush_all.c                                |   29 +-
 test/flush_bad_code.c                           |   27 +-
 test/flush_invalid.c                            |   26 +-
 test/flush_meta.c                               |   30 +-
 test/flush_ref.c                                |   74 +
 test/flush_spec.c                               |   50 +-
 test/foffs_alter.c                              |   29 +-
 test/foffs_get.c                                |   29 +-
 test/foffs_move.c                               |   29 +-
 test/fragment_affix.c                           |   63 +
 test/fragment_affix_alter.c                     |   69 +
 test/fragment_affix_alter2.c                    |   67 +
 test/fragment_affix_dup.c                       |   66 +
 test/fragment_index.c                           |   31 +-
 test/fragment_index_alias.c                     |   58 +
 test/fragment_name.c                            |   49 +-
 test/fragment_name_oor.c                        |   35 +-
 test/fragment_num.c                             |   55 +
 test/fragment_parent.c                          |   64 +
 test/get64.c                                    |   29 +-
 test/get_affix.c                                |   78 +
 test/get_bad_code.c                             |   27 +-
 test/get_bit.c                                  |   29 +-
 test/get_carray.c                               |   27 +-
 test/get_carray_len.c                           |   27 +-
 test/get_carray_slice.c                         |   27 +-
 test/get_char.c                                 |   29 +-
 test/get_clincom.c                              |   29 +-
 test/get_complex128.c                           |   29 +-
 test/get_complex64.c                            |   29 +-
 test/get_const.c                                |   27 +-
 test/get_const_complex.c                        |   27 +-
 test/get_const_repr.c                           |   27 +-
 test/get_cpolynom.c                             |   29 +-
 test/get_divide.c                               |   29 +-
 test/get_endian16.c                             |   27 +-
 test/get_endian32.c                             |   27 +-
 test/get_endian64.c                             |   31 +-
 test/get_endian8.c                              |   27 +-
 test/get_endian_complex128_arm.c                |   29 +-
 test/get_endian_complex128_big.c                |   29 +-
 test/get_endian_complex128_little.c             |   29 +-
 test/get_endian_complex64_arm.c                 |   29 +-
 test/get_endian_complex64_big.c                 |   29 +-
 test/get_endian_complex64_little.c              |   29 +-
 test/get_endian_float32_arm.c                   |   29 +-
 test/get_endian_float32_big.c                   |   29 +-
 test/get_endian_float32_little.c                |   29 +-
 test/get_endian_float64_arm.c                   |   29 +-
 test/get_endian_float64_big.c                   |   29 +-
 test/get_endian_float64_little.c                |   29 +-
 test/get_ff.c                                   |   29 +-
 test/get_float32.c                              |   29 +-
 test/get_float64.c                              |   29 +-
 test/get_foffs.c                                |   29 +-
 test/get_fs.c                                   |   29 +-
 test/get_here.c                                 |   76 +
 test/get_here_foffs.c                           |   85 +
 test/get_heres.c                                |   76 +
 test/get_int16.c                                |   29 +-
 test/get_int32.c                                |   29 +-
 test/get_int64.c                                |   33 +-
 test/get_int8.c                                 |   29 +-
 test/get_invalid.c                              |   33 +-
 test/get_lincom1.c                              |   29 +-
 test/get_lincom2.c                              |   29 +-
 test/get_lincom3.c                              |   29 +-
 test/get_lincom_noin.c                          |   27 +-
 test/get_lincom_non.c                           |   29 +-
 test/get_lincom_null.c                          |   68 +
 test/get_lincom_spf.c                           |   82 +
 test/get_linterp.c                              |   31 +-
 test/get_linterp_noin.c                         |   29 +-
 test/get_linterp_notab.c                        |   29 +-
 test/get_linterp_sort.c                         |   31 +-
 test/get_mplex.c                                |   76 +
 test/get_mplex_bof.c                            |   76 +
 test/get_mplex_lb.c                             |   76 +
 test/get_mplex_lball.c                          |   81 +
 test/get_mplex_nolb.c                           |   79 +
 test/get_multiply.c                             |   29 +-
 test/get_multiply_noin.c                        |   29 +-
 test/get_nonexistent.c                          |   27 +-
 test/get_null.c                                 |   29 +-
 test/get_off64.c                                |   29 +-
 test/get_phase.c                                |   41 +-
 test/get_phase_affix.c                          |   73 +
 test/get_polynom.c                              |   29 +-
 test/get_polynom_noin.c                         |   27 +-
 test/get_recip.c                                |   29 +-
 test/get_recip_const.c                          |   29 +-
 test/get_recurse.c                              |   27 +-
 test/get_rofs.c                                 |   83 +
 test/get_sbit.c                                 |   29 +-
 test/get_sf.c                                   |   29 +-
 test/get_ss.c                                   |   29 +-
 test/get_type.c                                 |   29 +-
 test/get_uint16.c                               |   29 +-
 test/get_uint32.c                               |   29 +-
 test/get_uint64.c                               |   33 +-
 test/get_window.c                               |   73 +
 test/get_window_clr.c                           |   73 +
 test/get_window_ge.c                            |   73 +
 test/get_window_gt.c                            |   73 +
 test/get_window_le.c                            |   73 +
 test/get_window_lt.c                            |   73 +
 test/get_window_ne.c                            |   73 +
 test/get_window_set.c                           |   73 +
 test/get_zero.c                                 |   29 +-
 test/global_flags.c                             |   88 +
 test/global_name.c                              |   29 +-
 test/global_ref.c                               |   27 +-
 test/global_ref_empty.c                         |   27 +-
 test/global_ref_set.c                           |   27 +-
 test/gzip_add.c                                 |   84 +
 test/gzip_get.c                                 |   34 +-
 test/gzip_get_get.c                             |   32 +-
 test/gzip_get_get2.c                            |   92 +
 test/gzip_get_put.c                             |  160 +
 test/gzip_move_from.c                           |   38 +-
 test/gzip_move_to.c                             |  116 +
 test/gzip_nframes.c                             |   33 +-
 test/gzip_put.c                                 |  121 +
 test/gzip_put_get.c                             |   92 +
 test/header_complex.c                           |   27 +-
 test/hide.c                                     |   54 +
 test/hide_hidden.c                              |   57 +
 test/hide_unhide.c                              |   54 +
 test/include.c                                  |   33 +-
 test/include_accmode.c                          |   25 +-
 test/include_affix.c                            |   59 +
 test/include_auto.c                             |   33 +-
 test/include_cb.c                               |   34 +-
 test/include_creat.c                            |   27 +-
 test/include_ignore.c                           |   33 +-
 test/include_index.c                            |   27 +-
 test/include_invalid.c                          |   27 +-
 test/include_nonexistent.c                      |   27 +-
 test/include_pc.c                               |   34 +-
 test/include_ref.c                              |   33 +-
 test/include_sub.c                              |   77 +
 test/include_syntax.c                           |   31 +-
 test/index.c                                    |   29 +-
 test/index_domain.c                             |   29 +-
 test/index_range.c                              |   29 +-
 test/legacy_get.c                               |   29 +-
 test/legacy_get_put.c                           |   29 +-
 test/legacy_get_rofs.c                          |   29 +-
 test/legacy_nframes.c                           |   29 +-
 test/legacy_nonexistent.c                       |   20 +
 test/legacy_put.c                               |   48 +-
 test/legacy_spf.c                               |   27 +-
 test/lzma_get.c                                 |   48 +-
 test/lzma_nframes.c                             |   32 +-
 test/madd.c                                     |   36 +-
 test/madd_affix.c                               |   84 +
 test/madd_alias.c                               |   57 +
 test/madd_alias_affix.c                         |   75 +
 test/madd_bit.c                                 |   28 +-
 test/madd_bit_invalid.c                         |   26 +-
 test/madd_carray.c                              |   28 +-
 test/madd_clincom.c                             |   30 +-
 test/madd_const.c                               |   28 +-
 test/madd_cpolynom.c                            |   28 +-
 test/madd_crecip.c                              |   28 +-
 test/madd_crecip89.c                            |   28 +-
 test/madd_divide.c                              |   28 +-
 test/madd_index.c                               |   72 +
 test/madd_lincom.c                              |   30 +-
 test/madd_lincom_invalid.c                      |   30 +-
 test/madd_linterp.c                             |   28 +-
 test/madd_linterp_invalid.c                     |   26 +-
 test/madd_mplex.c                               |   59 +
 test/madd_multiply.c                            |   28 +-
 test/madd_multiply_invalid.c                    |   26 +-
 test/madd_phase.c                               |   30 +-
 test/madd_phase_invalid.c                       |   26 +-
 test/madd_polynom.c                             |   30 +-
 test/madd_recip.c                               |   28 +-
 test/madd_sbit.c                                |   28 +-
 test/madd_spec.c                                |   28 +-
 test/madd_spec_directive.c                      |   28 +-
 test/madd_spec_invalid.c                        |   26 +-
 test/madd_spec_resolv.c                         |   58 +
 test/madd_string.c                              |   28 +-
 test/madd_window.c                              |   70 +
 test/move.c                                     |   31 +-
 test/move_affix.c                               |   71 +
 test/move_affix_dup.c                           |   59 +
 test/move_alias.c                               |   64 +
 test/move_data_enc_ar.c                         |   35 +-
 test/move_data_enc_ra.c                         |   35 +-
 test/move_data_endian.c                         |   36 +-
 test/move_data_foffs.c                          |   33 +-
 test/move_data_nop.c                            |   33 +-
 test/move_index.c                               |   31 +-
 test/move_meta.c                                |   31 +-
 test/move_protect.c                             |   31 +-
 test/move_subdir.c                              |   39 +-
 test/name.c                                     |   87 +-
 test/name_affix.c                               |   63 +
 test/name_affix_bad.c                           |   58 +
 test/name_alias.c                               |  173 +
 test/name_dup.c                                 |   51 +
 test/name_move.c                                |   42 +-
 test/name_move_alias.c                          |   82 +
 test/name_updb.c                                |   86 +
 test/name_updb_alias.c                          |  119 +
 test/name_updb_const.c                          |   86 +
 test/name_updb_const_alias.c                    |   87 +
 test/nentries_alias.c                           |   61 +
 test/nentries_hidden.c                          |   66 +
 test/nentries_noalias.c                         |   66 +
 test/nentries_scalar.c                          |   66 +
 test/nfields.c                                  |   27 +-
 test/nfields_hidden.c                           |   66 +
 test/nfields_invalid.c                          |   36 +-
 test/nfields_type.c                             |   27 +-
 test/nfields_type_hidden.c                      |   65 +
 test/nfields_type_invalid.c                     |   33 +-
 test/nfields_vector.c                           |   65 +
 test/nfields_vector_hidden.c                    |   66 +
 test/nfields_vector_invalid.c                   |   40 +
 test/nframes.c                                  |   29 +-
 test/nframes64.c                                |   29 +-
 test/nframes_empty.c                            |   25 +-
 test/nframes_invalid.c                          |   34 +-
 test/nframes_off64.c                            |   29 +-
 test/nframes_spf.c                              |   31 +-
 test/nmeta.c                                    |   27 +-
 test/nmeta_hidden.c                             |   65 +
 test/nmeta_invalid.c                            |   34 +-
 test/nmeta_parent.c                             |   27 +-
 test/nmeta_type.c                               |   27 +-
 test/nmeta_type_hidden.c                        |   65 +
 test/nmeta_type_invalid.c                       |   34 +-
 test/nmeta_type_parent.c                        |   27 +-
 test/nmeta_vectors.c                            |   27 +-
 test/nmeta_vectors_del.c                        |   27 +-
 test/nmeta_vectors_hidden.c                     |   65 +
 test/nmeta_vectors_invalid.c                    |   34 +-
 test/nmeta_vectors_parent.c                     |   27 +-
 test/open.c                                     |   25 +-
 test/open_abs.c                                 |   53 +
 test/open_cb_abort.c                            |   30 +-
 test/open_cb_cont.c                             |   30 +-
 test/open_cb_ignore.c                           |   30 +-
 test/open_cb_invalid.c                          |   30 +-
 test/open_cb_rescan.c                           |   29 +-
 test/open_eaccess.c                             |   25 +-
 test/open_nonexistent.c                         |   26 +-
 test/open_notdirfile.c                          |   23 +-
 test/open_sym_a.c                               |   65 +
 test/open_sym_al.c                              |   65 +
 test/open_sym_at.c                              |   65 +
 test/open_sym_c.c                               |   57 +
 test/open_sym_cl.c                              |   57 +
 test/open_sym_ct.c                              |   57 +
 test/open_sym_p.c                               |   57 +
 test/open_sym_pl.c                              |   57 +
 test/open_sym_pt.c                              |   57 +
 test/parse_alias.c                              |   48 +
 test/parse_alias_code.c                         |   48 +
 test/parse_alias_dup.c                          |   51 +
 test/parse_alias_meta.c                         |   51 +
 test/parse_alias_missing.c                      |   48 +
 test/parse_badline.c                            |   27 +-
 test/parse_bit.c                                |   27 +-
 test/parse_bit4.c                               |   27 +-
 test/parse_bit_bitnum.c                         |   27 +-
 test/parse_bit_bitsize.c                        |   27 +-
 test/parse_bit_ncols.c                          |   27 +-
 test/parse_bit_numbits.c                        |   27 +-
 test/parse_bit_scalar.c                         |   27 +-
 test/parse_carray.c                             |   27 +-
 test/parse_carray_long.c                        |   27 +-
 test/parse_const.c                              |   27 +-
 test/parse_const_complex.c                      |   74 +
 test/parse_const_ncols.c                        |   27 +-
 test/parse_divide.c                             |   27 +-
 test/parse_double.c                             |   86 +
 test/parse_duplicate.c                          |   27 +-
 test/parse_duplicate_ignore.c                   |   27 +-
 test/parse_endian_bad.c                         |   27 +-
 test/parse_endian_big.c                         |   27 +-
 test/parse_endian_force.c                       |   27 +-
 test/parse_endian_little.c                      |   27 +-
 test/parse_endian_slash.c                       |   27 +-
 test/parse_eol.c                                |   27 +-
 test/parse_foffs.c                              |   27 +-
 test/parse_foffs_include.c                      |   39 +-
 test/parse_foffs_slash.c                        |   27 +-
 test/parse_hidden.c                             |   48 +
 test/parse_hidden_field.c                       |   48 +
 test/parse_hidden_meta.c                        |   51 +
 test/parse_include.c                            |   33 +-
 test/parse_include_absolute.c                   |   48 +-
 test/parse_include_absrel.c                     |   50 +-
 test/parse_include_affix_ref.c                  |   65 +
 test/parse_include_dir.c                        |   58 +
 test/parse_include_loop.c                       |   55 +
 test/parse_include_nonexistent.c                |   27 +-
 test/parse_include_prefix.c                     |   57 +
 test/parse_include_prefix_dup.c                 |   54 +
 test/parse_include_preprefix.c                  |   66 +
 test/parse_include_ref.c                        |   66 +
 test/parse_include_relabs.c                     |   54 +-
 test/parse_include_relrel.c                     |   35 +-
 test/parse_include_slash.c                      |   33 +-
 test/parse_include_suffix.c                     |   57 +
 test/parse_include_sufsuffix.c                  |   66 +
 test/parse_index.c                              |   27 +-
 test/parse_lincom.c                             |   27 +-
 test/parse_lincom_ncols1.c                      |   27 +-
 test/parse_lincom_ncols2.c                      |   27 +-
 test/parse_lincom_nfields.c                     |   27 +-
 test/parse_lincom_nofields.c                    |   27 +-
 test/parse_lincom_non.c                         |   27 +-
 test/parse_lincom_non_ncols.c                   |   27 +-
 test/parse_lincom_scalar.c                      |   27 +-
 test/parse_linterp.c                            |   27 +-
 test/parse_linterp_ncols.c                      |   27 +-
 test/parse_malias.c                             |   51 +
 test/parse_malias_dup.c                         |   52 +
 test/parse_malias_meta.c                        |   53 +
 test/parse_meta.c                               |   27 +-
 test/parse_meta_affix.c                         |   56 +
 test/parse_meta_alias.c                         |   58 +
 test/parse_meta_implicit.c                      |   27 +-
 test/parse_meta_implicit2.c                     |   27 +-
 test/parse_meta_implicit_affix.c                |   56 +
 test/parse_meta_index.c                         |   27 +-
 test/parse_meta_index2.c                        |   27 +-
 test/parse_meta_jump.c                          |   52 +
 test/parse_meta_malias.c                        |   52 +
 test/parse_meta_meta.c                          |   51 +
 test/parse_meta_parent.c                        |   27 +-
 test/parse_meta_raw.c                           |   27 +-
 test/parse_mplex.c                              |   47 +
 test/parse_mplex_ncols.c                        |   47 +
 test/parse_mplex_nomax.c                        |   53 +
 test/parse_mplex_scalar.c                       |   47 +
 test/parse_multiply.c                           |   27 +-
 test/parse_multiply_ncols.c                     |   27 +-
 test/parse_name.c                               |   27 +-
 test/parse_name_dot.c                           |   27 +-
 test/parse_name_ext.c                           |   27 +-
 test/parse_name_pedantic.c                      |   27 +-
 test/parse_ncols.c                              |   27 +-
 test/parse_phase.c                              |   27 +-
 test/parse_phase_ncols.c                        |   27 +-
 test/parse_phase_scalar.c                       |   27 +-
 test/parse_polynom.c                            |   27 +-
 test/parse_polynom_ncols1.c                     |   27 +-
 test/parse_polynom_ncols2.c                     |   27 +-
 test/parse_polynom_scalar.c                     |   27 +-
 test/parse_protect_all.c                        |   27 +-
 test/parse_protect_bad.c                        |   27 +-
 test/parse_protect_data.c                       |   27 +-
 test/parse_protect_format.c                     |   27 +-
 test/parse_protect_none.c                       |   27 +-
 test/parse_quote.c                              |   27 +-
 test/parse_quote_mismatch.c                     |   27 +-
 test/parse_raw.c                                |   27 +-
 test/parse_raw_char.c                           |   27 +-
 test/parse_raw_ncols.c                          |   27 +-
 test/parse_raw_scalar.c                         |   27 +-
 test/parse_raw_spf.c                            |   27 +-
 test/parse_raw_type.c                           |   27 +-
 test/parse_recip.c                              |   27 +-
 test/parse_ref.c                                |   27 +-
 test/parse_ref_nonexistent.c                    |   27 +-
 test/parse_sbit.c                               |   27 +-
 test/parse_sort.c                               |   27 +-
 test/parse_string.c                             |   27 +-
 test/parse_string_ncols.c                       |   27 +-
 test/parse_string_null.c                        |   27 +-
 test/parse_version.c                            |   27 +-
 test/parse_version_89.c                         |   62 +
 test/parse_version_98.c                         |   62 +
 test/parse_version_include.c                    |   31 +-
 test/parse_version_p8.c                         |   61 +
 test/parse_version_p9.c                         |   61 +
 test/parse_version_permissive.c                 |   27 +-
 test/parse_version_slash.c                      |   27 +-
 test/parse_whitespace.c                         |   27 +-
 test/parse_window.c                             |   55 +
 test/parse_window_ncols.c                       |   55 +
 test/parse_window_op.c                          |   55 +
 test/parse_window_scalar.c                      |   55 +
 test/protect_alter.c                            |   29 +-
 test/protect_get.c                              |   29 +-
 test/put64.c                                    |   29 +-
 test/put_bad_code.c                             |   27 +-
 test/put_bit.c                                  |   29 +-
 test/put_bof.c                                  |   27 +-
 test/put_carray.c                               |   35 +-
 test/put_carray_slice.c                         |   28 +-
 test/put_char.c                                 |   27 +-
 test/put_complex128.c                           |   60 +-
 test/put_complex64.c                            |   62 +-
 test/put_const.c                                |   28 +-
 test/put_const_protect.c                        |   27 +-
 test/put_divide.c                               |   29 +-
 test/put_endian16.c                             |   27 +-
 test/put_endian32.c                             |   27 +-
 test/put_endian64.c                             |   31 +-
 test/put_endian8.c                              |   27 +-
 test/put_endian_complex128_arm.c                |   29 +-
 test/put_endian_complex128_big.c                |   29 +-
 test/put_endian_complex128_little.c             |   29 +-
 test/put_endian_complex64_arm.c                 |   29 +-
 test/put_endian_complex64_big.c                 |   29 +-
 test/put_endian_complex64_little.c              |   29 +-
 test/put_endian_float32_arm.c                   |   29 +-
 test/put_endian_float32_big.c                   |   29 +-
 test/put_endian_float32_little.c                |   29 +-
 test/put_endian_float64_arm.c                   |   29 +-
 test/put_endian_float64_big.c                   |   29 +-
 test/put_endian_float64_little.c                |   29 +-
 test/put_ff.c                                   |   50 +-
 test/put_float32.c                              |   52 +-
 test/put_float64.c                              |   52 +-
 test/put_foffs.c                                |   52 +-
 test/put_fs.c                                   |   52 +-
 test/put_here.c                                 |   88 +
 test/put_heres.c                                |   88 +
 test/put_int16.c                                |   52 +-
 test/put_int32.c                                |   52 +-
 test/put_int64.c                                |   52 +-
 test/put_int8.c                                 |   52 +-
 test/put_invalid.c                              |   33 +-
 test/put_lincom1.c                              |   52 +-
 test/put_lincom2.c                              |   29 +-
 test/put_lincom_noin.c                          |   27 +-
 test/put_linterp.c                              |   54 +-
 test/put_linterp_noin.c                         |   29 +-
 test/put_linterp_nomono.c                       |   31 +-
 test/put_linterp_notab.c                        |   29 +-
 test/put_linterp_reverse.c                      |   54 +-
 test/put_mplex.c                                |   81 +
 test/put_multiply.c                             |   29 +-
 test/put_null.c                                 |   27 +-
 test/put_off64.c                                |   52 +-
 test/put_phase.c                                |   52 +-
 test/put_phase_noin.c                           |   27 +-
 test/put_polynom1.c                             |   52 +-
 test/put_polynom2.c                             |   29 +-
 test/put_polynom_noin.c                         |   27 +-
 test/put_protect.c                              |   27 +-
 test/put_rdonly.c                               |   29 +-
 test/put_recip.c                                |   52 +-
 test/put_recurse.c                              |   27 +-
 test/put_repr.c                                 |   29 +-
 test/put_rofs.c                                 |   43 +-
 test/put_sbit.c                                 |   29 +-
 test/put_sf.c                                   |   52 +-
 test/put_ss.c                                   |   52 +-
 test/put_string.c                               |   28 +-
 test/put_string_protect.c                       |   27 +-
 test/put_type.c                                 |   27 +-
 test/put_uint16.c                               |   52 +-
 test/put_uint32.c                               |   52 +-
 test/put_uint64.c                               |   52 +-
 test/put_window.c                               |   71 +
 test/put_zero.c                                 |   60 +
 test/ref.c                                      |   31 +-
 test/ref_none.c                                 |   31 +-
 test/ref_two.c                                  |   31 +-
 test/repr_a.c                                   |   29 +-
 test/repr_float32.c                             |   29 +-
 test/repr_float64.c                             |   29 +-
 test/repr_i.c                                   |   29 +-
 test/repr_int16.c                               |   29 +-
 test/repr_int32.c                               |   29 +-
 test/repr_int64.c                               |   29 +-
 test/repr_int8.c                                |   29 +-
 test/repr_m.c                                   |   29 +-
 test/repr_r.c                                   |   29 +-
 test/repr_real_a.c                              |   29 +-
 test/repr_real_i.c                              |   29 +-
 test/repr_real_m.c                              |   29 +-
 test/repr_real_r.c                              |   29 +-
 test/repr_uint16.c                              |   29 +-
 test/repr_uint32.c                              |   29 +-
 test/repr_uint64.c                              |   29 +-
 test/repr_uint8.c                               |   29 +-
 test/seek64.c                                   |   76 +
 test/seek_cur.c                                 |   75 +
 test/seek_end.c                                 |   74 +
 test/seek_foffs.c                               |   74 +
 test/seek_neg.c                                 |   70 +
 test/seek_set.c                                 |   74 +
 test/sie_get_big.c                              |   68 +
 test/sie_get_little.c                           |   68 +
 test/sie_move_from.c                            |   84 +
 test/sie_move_to.c                              |   84 +
 test/sie_nframes_big.c                          |   62 +
 test/sie_nframes_little.c                       |   62 +
 test/sie_put_big.c                              |   83 +
 test/sie_put_little.c                           |   83 +
 test/slim_get.c                                 |   32 +-
 test/slim_nframes.c                             |   34 +-
 test/spf.c                                      |   29 +-
 test/spf_alias.c                                |   50 +
 test/spf_alias_meta.c                           |   53 +
 test/spf_alias_missing.c                        |   50 +
 test/spf_divide.c                               |   29 +-
 test/spf_lincom.c                               |   29 +-
 test/spf_multiply.c                             |   29 +-
 test/spf_polynom.c                              |   29 +-
 test/spf_recip.c                                |   29 +-
 test/spf_recurse.c                              |   29 +-
 test/svlist.c                                   |   27 +-
 test/svlist_hidden.c                            |   73 +
 test/svlist_invalid.c                           |   33 +-
 test/svlist_meta.c                              |   27 +-
 test/svlist_meta_hidden.c                       |   77 +
 test/svlist_meta_invalid.c                      |   33 +-
 test/table.c                                    |   67 +
 test/table_code.c                               |   59 +
 test/table_type.c                               |   59 +
 test/tell.c                                     |   73 +
 test/tell64.c                                   |   75 +
 test/tell_multidiv.c                            |   70 +
 test/test.h                                     |   96 +-
 test/tok_arg.c                                  |   56 +
 test/tok_escape.c                               |   69 +
 test/tok_quote.c                                |   69 +
 test/trunc.c                                    |   27 +-
 test/trunc_dir.c                                |   70 +
 test/trunc_rdonly.c                             |   27 +-
 test/trunc_rofs.c                               |   31 +-
 test/trunc_truncsub.c                           |   70 +
 test/unclude.c                                  |   35 +-
 test/unclude_del.c                              |   35 +-
 test/unclude_move.c                             |   35 +-
 test/version_0.c                                |   29 +-
 test/version_0_write.c                          |   27 +-
 test/version_1.c                                |   29 +-
 test/version_1_write.c                          |   27 +-
 test/version_2.c                                |   29 +-
 test/version_2_write.c                          |   27 +-
 test/version_3.c                                |   33 +-
 test/version_3_write.c                          |   31 +-
 test/version_4.c                                |   33 +-
 test/version_4_write.c                          |   31 +-
 test/version_5.c                                |   29 +-
 test/version_5_strict.c                         |   31 +-
 test/version_5_write.c                          |   27 +-
 test/version_6.c                                |   31 +-
 test/version_6_strict.c                         |   31 +-
 test/version_6_write.c                          |   42 +-
 test/version_7.c                                |   31 +-
 test/version_7_strict.c                         |   31 +-
 test/version_7_write.c                          |   27 +-
 test/version_8.c                                |   31 +-
 test/version_8_strict.c                         |   42 +-
 test/version_8_write.c                          |   27 +-
 test/version_9.c                                |   89 +
 test/version_9_strict.c                         |  121 +
 test/version_9_write.c                          |  104 +
 test/vlist.c                                    |   27 +-
 test/vlist_alias.c                              |   83 +
 test/vlist_hidden.c                             |   69 +
 test/vlist_invalid.c                            |   33 +-
 test/vlist_meta.c                               |   27 +-
 test/vlist_meta_hidden.c                        |   74 +
 test/vlist_meta_invalid.c                       |   33 +-
 test/xz_get.c                                   |   47 +-
 test/xz_nframes.c                               |   32 +-
 test/zzip_data.c                                |   90 +
 test/zzip_get.c                                 |   88 +
 test/zzip_get_get.c                             |   88 +
 test/zzip_nframes.c                             |   93 +
 test/zzslim_get.c                               |   95 +
 test/zzslim_nframes.c                           |   98 +
 util/Makefile.in                                |   96 +-
 util/checkdirfile.c                             |   76 +-
 util/dirfile2ascii.c                            |   15 +-
 1333 files changed, 98404 insertions(+), 23214 deletions(-)

diff --git a/AUTHORS b/AUTHORS
index 8a39286..6787106 100644
--- a/AUTHORS
+++ b/AUTHORS
@@ -8,8 +8,8 @@ standards.
 Ted Kisner <tskisner.public at gmail.com> wrote the PutData library
 (libdirfile).
 
-Matthew Truch <matt at truch.net> wrote the dirfile2ascii conversion utility.
-He also provides alpha-testing, bug fixes, and maintains the Fedora packages.
+Sean Bryan <sean.bryan at case.edu> provided code which was adapted to create
+the MATLAB bindings.
 
 Eli Fidler <eli at staikos.net> ported PutData to this version of the GetData
 library.
@@ -17,13 +17,19 @@ library.
 Joseph Fowler <jfowler at princeton.edu> provided code which was adapted to
 create the slimlib encoding support.
 
-Peter Kümmel <syntheticpp at gmx.net> ported GetData to MSVC.
+Adam D Hincks <adam.hincks at utoronto.ca> provided code whic was adapted to
+create the zzip encoding support.  The original zzip encoding (ZIRFILE) was
+developed by Mike Nolta <nolta at cita.utoronto.ca>.
+
+Peter Kümmel <syntheticpp at gmx.net> ported GetData to MSVC (Windows).
 
 George Staikos <staikos at kde.org> maintained the GetData library as part of
 kst.
 
 Adam Treat <treat at kde.org> wrote the code for the PHASE field type.
 
+Matthew Truch <matt at truch.net> wrote the dirfile2ascii conversion utility.
+
 Andrew Walker <arwalker at sumusltd.com> maintained the GetData library as
 part of kst.
 
diff --git a/ChangeLog b/ChangeLog
index 90f23bb..d092569 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,47 +1,1751 @@
-2011-04-04   D. V. Wiebe <getdata at ketiltrout.net> svn:567
-	Merge from trunk, r561:
+2013-09-05   D. V. Wiebe <getdata at ketiltrout.net> svn:845
+	GetData-0.8.5 released.
 
-	* util/checkdirfile.c: Zero-terminate option list.  Patch from Matthew
-	Truch.
+	* src/zzslim.c: 
+
+2013-07-17   D. V. Wiebe <getdata at ketiltrout.net> svn:835
+	
+	* bindings/python/pydirfile.c: Remove spurious debug printf.
+
+	* bindings/doc/Makefile.am: Fix make clean
+
+	* bindings/bindings/perl/Makefile.am: Fix make clean
+
+2013-05-14   D. V. Wiebe <getdata at ketiltrout.net> svn:832
+	GetData-0.8.4 released.
+
+2013-04-11   D. V. Wiebe <getdata at ketiltrout.net> svn:830
+	GetData-0.8.4rc2:
+
+	* bindings/perl/Build.PL.in: make include_dirs an array.  Reported by Seth.
+
+	* bindings/idl/package/configure.ac bindings/matlab/package/configure.ac:
+	Require GetData >= 0.8.4.
+
+2013-04-10   D. V. Wiebe <getdata at ketiltrout.net> svn:829
+	GetData-0.8.4rc1.
+
+2013-04-06   D. V. Wiebe <getdata at ketiltrout.net> svn:827
+	* bindings/cxx/getdata/entry.h (Entry::CountMax)
+	bindings/cxx/getdata/mplexentry.h (MplexEntry::CountMax
+	MplexEntry::SetCountMax): Added (but marked deprecated) for backwards
+	compatibility.
+
+2013-04-05   D. V. Wiebe <getdata at ketiltrout.net> svn:826
+	* bindings/f77/test/big_test.f bindings/f77/test/big_test95.f90
+	bindings/perl/t/big_test.t: Fix test 231.
+
+2013-04-05   D. V. Wiebe <getdata at ketiltrout.net> svn:825
+	* src/getdata.h.in: Renamed gd_entry_t.count_max to gd_entry_t.period.
+
+	* bindings/cxx/getdata/entry.h (Entry::Period)
+	bindings/cxx/getdata/mplexentry.h (NplexEntry::Period): Renamed from CountMax.
+	* bindings/cxx/mplexentry.cpp (MplexEntry::SetPeriod): Renamed from
+	SetCountMax.
+	* bindings/cxx/mplexentry.cpp (MplexEntry::MplexEntry)
+	bindings/f77/fgetdata.c (GDGEMX) bindings/f77/getdata.f90.in (fgd_entry
+	fgd_add fgd_madd fgd_alter_entry fgd_add_mplex fgd_madd_mplex
+	fgd_alter_mplex) bindings/idl/getdata.c (gdidl_make_idl_entry
+	gdidl_alter_mplex) bindings/matlab/gd_add_mplex.m
+	bindings/matlab/gd_alter_mplex.m bindings/matlab/gd_madd_mplex.m
+	bindings/matlab/matlab.c (gdmx_from_entry gdmx_to_entry)
+	bindings/perl/GetData.xs (gdp_to_entry entry) bindings/python/pyentry.c
+	(gdpy_set_entry_from_tuple gdpy_entry_getperiod gdpy_entry_setperiod
+	gdpy_entry_getparms): Rename count_max to period.
+
+	* src/add.c (_GD_Add): Fix range checks on MPLEX parameters.
+
+	* src/getdata.c (_GD_DoMplex): The default period is 2n+1, not 2n.
+
+	* src/internal.h: Rename GD_E_ENTRY_CNTMAX to GD_E_ENTRY_PERIOD.
+	* src/errors.c: Update GD_E_ENTRY_PERIOD and GD_E_FORMAT_MPLEXVAL messages.
+
+	* src/mod.c (_GD_Change): mplex.count_val = -1 is not a magic value.
+
+	* src/parse.c (_GD_ParseMplex): Remove incorrect restrictions count_val <=
+	period and count_val >= 0.
+
+	* bindings/idl/getdata.c (gdidl_read_idl_entry): Properly convert an IDL
+	MPLEX entry object.
+
+	* bindings/idl/getdata.c (gdidl_alter_mplex): Handle missing COUNT_VAL.
+
+	* man/dirfile-format.5: Fix and clarify MPLEX specification.
+
+2013-03-13   D. V. Wiebe <getdata at ketiltrout.net> svn:819
+	* src/flush.c (_GD_FlushFragment): Strip affixes from field codes in
+	/REFERENCE directives.
+	* test/flush_ref.c test/parse_include_affix_ref.c: Added.
+
+2013-03-12   D. V. Wiebe <getdata at ketiltrout.net> svn:818
+	* bindings/python/pydirfile.c (gdpy_dirfile_getdata): Resize the ndarray
+	before returning it, if necessary.  Also, don't try to read past the EOF in
+	read-to-end mode.
+
+	* src/fpos.c (_GD_GetFilePos): Fix computation of two input field derived
+	types to properly return MULTIPOS when necessary.
+	* test/tell_multidiv.c: Added.
+
+	* src/fpos.c (_GD_Seek): Return error if trying to place the I/O pointer
+	before sample zero.
+	* test/seek_neg.c: Added.
+
+	* src/gzip.c (_GD_GzipSeek): Allow seeking to sample zero.
+	* test/gzip_get_get2.c: Added.
+
+2013-03-12   D. V. Wiebe <getdata at ketiltrout.net> svn:815
+	GetData-0.8.3 released.
+
+2013-03-09   D. V. Wiebe <getdata at ketiltrout.net> svn:807
+	* src/flush.c: C89-ify the GD_VERS_... constants.
+
+2013-03-08   D. V. Wiebe <getdata at ketiltrout.net> svn:806
+	GetData-0.8.3rc1.
+
+2013-03-08   D. V. Wiebe <getdata at ketiltrout.net> svn:803
+	* src/internal.h (gd_put_unalinged64): Fix spelling.
+
+	* src/encoding.c (_GD_FiniRawIO): Don't pass NULL to gd_UnlinkAt.
+
+	* man/GD_SIZE.3: Added.
+
+	* configure.ac: Turn on fast unaligned access for armv[6789] per Dinar
+	Valeev.  Also add add --enable-fast-unaligned to allow users to override the
+	check.
+
+2013-02-15   D. V. Wiebe <getdata at ketiltrout.net> svn:795
+	* bindings/matlab/package: Added.
+	* Makefile.am: Add matlabdist and matlabdistcheck
+
+	* doc/README.matlab bindings/matlab/make_contents.sh.in
+	bindings/matlab/Contents.m.head bindings/matlab/doc.tail: Added.
+
+	* bindinag/matlab/matlab.c (gdmx_from_carrays): Added.
+	* bindings/matlab/gd_mcarrays.c: Added.
+	* bindings/matlab/test/big_test.m: Add test 243.
+
+	* bindings/matlab/gd_include.c: Renamed from gd_include_affix.c
+	* bindings/matlab/gd_include.m: Deleted.
+
+2013-02-13   D. V. Wiebe <getdata at ketiltrout.net> svn:794
+	* bindings/cxx/test/big_test.cpp bindings/perl/t/big_test.t
+	bindings/python/test/big_test.py: Add test 243.
+
+2013-02-06   D. V. Wiebe <getdata at ketiltrout.net> svn:793
+	* src/parse.c (_GD_Tokenise): Don't falsely report an unterminated token when
+	stopping a partial tokenisation on top of a " or \.
+	* test/tok_arg.c test/tok_escape.c test/tok_quote.c: Added.
+
+2013-02-02   D. V. Wiebe <getdata at ketiltrout.net> svn:792
+	* src/string.c (gd_get_string): Handle string retrieval directly instead of
+	calling _GD_DoField.
+	* src/string.c (_GD_DoStringOut): Moved from putdata.c.
+	* src/string.c (gd_put_string) src/add.c (gd_add_string gd_madd_string): Call
+	_GD_DoStringOut directly instead of _GD_DoFieldOut.
+	* src/getdata.c (_GD_DoString): Deleted.
+	* src/getdata.c (_GD_DoField) src/putdata.c (_GD_DoFieldOut): Remove string
+	processing.
+
+2013-02-02   D. V. Wiebe <getdata at ketiltrout.net> svn:790
+	* bindings/matlab/matlab.c: ANSI C.
+
+2013-02-02   D. V. Wiebe <getdata at ketiltrout.net> svn:789
+	* bindings/python/pyentry.c (gdpy_set_scalar_from_pyobj): Add missing data
+	types.
+	* bindings/python/pyentry.c (gdpy_set_entry_from_tuple gdpy_entry_setspf
+	gdpy_entry_setbitnum gdpy_entry_setnumbits gdpy_entry_setcountval
+	gdpy_entry_setcountmax): Fix data type in gdpy_set_scalar_from_pyobj calls.
+
+	* src/entry.c (_GD_GetScalar): Handle bogus CARRAY indices.
+
+	* src/mod.c (_GD_Change): Fix floating point CONST conversions.
+
+	* test/add_scalar_carray_bad.c test/alter_const_c2r.c: Added.
+
+	* bindings/python/test/big_test.py: Fix the part of test 35 that the
+	previous fix broke.
+
+2013-02-02   D. V. Wiebe <getdata at ketiltrout.net> svn:788
+	* src/debug.c (gd_colclear): Added.
+
+	* src/protect.c (gd_protection gd_alter_protection): Fix error reporting for
+	GD_E_BAD_INDEX.
+
+	* m4/matlab.m4 bindings/matlab: Added.
+	* configure.ac bindings/Makefile.am: Added MATLAB config.
+	* bindings/make_parameters.c (MatLab): Added.
+
+	* bindings/python/test/big_test.py: Fixed tests 35 and 67.
+
+2013-01-26   D. V. Wiebe <getdata at ketiltrout.net> svn:787
+	* src/del.c (_GD_DeReference) src/entry.c (_GD_CalculateEntry) src/flush.c
+	(_GD_FieldSpec)	 src/mod.c (_GD_Change): Fix data type (size) of
+	EN(raw,spf) in function calls.
+
+2013-01-15   D. V. Wiebe <getdata at ketiltrout.net> svn:785
+	* m4/floatordering.m4: Split from m4/compiler.m4
+
+	* src/parse.c (_GD_ParseRaw _GD_ParseMplex): Fix types in _GD_SetScalar
+	calls.
+
+2013-01-04   D. V. Wiebe <getdata at ketiltrout.net> svn:783
+	* configure.ac: powerpc64 also supports fast unaligned access.  Reported by
+	Dinar Valeev.
+
+2012-12-13   D. V. Wiebe <getdata at ketiltrout.net> svn:775
+	GetData-0.8.2 released.
+
+2012-12-12   D. V. Wiebe <getdata at ketiltrout.net> svn:773
+	* src/common.c (_GD_CanonicalPath): Don't bail early when encountering a
+	trailing absolute symlink.
+
+	* src/common.c (_GD_CanonicalPath): Strip DIRSEP along with a symlink name
+	from res when necessary.
+
+	* test/test.h test/parse_include_absolute.c test/parse_include_absrel.c
+	test/parse_include_relabs.c: Abstract getcwd in the header.
+	* test/open_sym_a.c test/open_sym_al.c test/open_sym_at.c test/open_sym_c.c
+	test/open_sym_cl.c test/open_sym_ct.c test/open_sym_p.c test/open_sym_pl.c
+	test/open_sym_pt.c: Added.
+
+2012-11-22   D. V. Wiebe <getdata at ketiltrout.net> svn:772
+	* src/encoding.c (_GD_WriteOut): Remove unnecessary DIRFILE parameter.
+
+2012-10-10   D. V. Wiebe <getdata at ketiltrout.net> svn:771
+	* src/getdata.c (_GD_DoMplex): Check we're at the BOF before trying to do a
+	lookback.
+
+	* src/internal.h: Only export gd_MakeFullPathOnly when using modules.
+
+2012-08-20   D. V. Wiebe <getdata at ketiltrout.net> svn:767
+	GetData-0.8.1 released.
+
+2012-08-15   D. V. Wiebe <getdata at ketiltrout.net> svn:760
+	* src/internal (_GD_IsDirSep): Added.
+	* src/common.c (_GD_CanonicalPath): Call _GD_IsDirSep
+
+2012-08-15   D. V. Wiebe <getdata at ketiltrout.net> svn:759
+	GetData-0.8.1rc1:
+
+	* src/parse.c (_GD_ParseDirective _GD_ParseFragment): Remove inappropriate
+	restrict keywords.  Reported by Daniel Flanigan.
+
+2012-08-14   D. V. Wiebe <getdata at ketiltrout.net> svn:757
+	* src/include.c (_GD_Include): Return the correct fragment index, not just
+	D->n_fragment - 1.
+	* test/include_sub.c: Added.
+
+2012-08-04   D. V. Wiebe <getdata at ketiltrout.net> svn:755
+	* src/parse.c (_GD_ParseFragment): Don't resize instring unnecessarily.
+
+2012-08-04   D. V. Wiebe <getdata at ketiltrout.net> svn:754
+	* src/parse.c (_GD_ParseDirective): Delete free reference on encountered
+	one in a subfragment.
+
+2012-08-02   D. V. Wiebe <getdata at ketiltrout.net> svn:753
+	* src/include.c (_GD_Include): Reject non-regular files as fragments.
+
+2012-08-02   D. V. Wiebe <getdata at ketiltrout.net> svn:752
+	* src/globals.c (gd_dirfilename): Return the full path.
+	* test/global_name.c: Update.
+
+	* src/add.c (_GD_Add): Properly compute filebase.
+
+	* src/entry.c (gd_linterp_tablename): Added.
+	* test/table.c test/table_code. test/table_type.c: Added.
+	* bindings/cxx/dirfile.cpp (Dirfile::LinterpTableName)
+	bindings/perl/simple_funcs.xsin (linterp_tablename)
+	bindings/f77/getdata.f90.in (fgd_linterp_tablename) bindings/f77/fgetdata.c
+	(GDLTTN) bindings/idl/getdata.c (gdidl_get_linterp_tablename)
+	bindings/python/pydirfile.c (gdpy_dirfile_linterptablename): Added.
+	* bindings/perl/simple_funcs.pl: Handle returning malloc'd string.
+
+	* bindings/cxx/test/big_test.cpp bindings/perl/test/big_test.t
+	bindings/f77/test/big_test.f bindings/f77/test/big_test95.f90
+	bindings/idl/test/big_test.pro bindings/python/test/big_test.py: Add test
+	241.  Update tests 21 and 80.
+
+2012-07-26   D. V. Wiebe <getdata at ketiltrout.net> svn:751
+	* src/flush.c (_GD_FieldSpec): Write /HIDDEN directives for /ALIASes.
+
+2012-07-26   D. V. Wiebe <getdata at ketiltrout.net> svn:749
+	* src/parse.c (_GD_SetScalar _GD_ParseLincom _GD_ParseLinterp
+	_GD_ParseMultiply _GD_ParseRecip _GD_ParseWindow _GD_ParseMplex
+	_GD_ParseDivide _GD_ParseBit _GD_ParsePhase _GD_ParsePolynom
+	_GD_ParseAlias): Store munged input fields.
+	* src/entry.c (_GD_GetScalar) src/common.c (_GD_BadInput) src/parse.c
+	(_GD_ResolveAlias): Don't (re-)munge field codes.
+
+	* src/name.c (_GD_MungeCode): Take an additional parameter, err_ok,
+	indicating whether missing affixes indicate an internal error or not.
+
+	* src/mod.c (_GD_AlterInField) src/name.c (_GD_CheckCodeAffixes): Added.
+	* src/mod.c (_GD_AlterScalar) src/add.c (_GD_FixName _GD_Add _GD_AddAlias):
+	Call _GD_CheckCodeAffixes.
+	* src/mod.c (_GD_Change): Call _GD_AlterInField to modify in_fields.
+
+	* src/flush.c (_GD_WriteFieldCode): Added.
+	* src/flush.c (_GD_PadField _GD_WriteConst _GD_FieldSpec): Call
+	_GD_WriteFieldCode.
+
+	* test/get_affix.c test/add_alias_affix.c test/add_alias_affix.c
+	test/add_spec_affix.c test/madd_alias_affix.c test/alter_lincom_affix.c
+	test/add_lincom_affix.c test/alter_scalar_affix.c: Added.
+
+	* test/add_string_affix.c test/madd_affix.c test/add_affix.c: Update for new
+	affix semantics.
+
+	* src/mod.c (gd_alter_entry) src/add.c (gd_madd_alias): Clear error when
+	starting.
+
+2012-07-12   D. V. Wiebe <getdata at ketiltrout.net> svn:743
+	* bindings/f77/fgetdata.c (GDALLC): Delete unnecessary malloc.
+	* src/fragment.c (_GD_CheckAffixes): Free subaffixes on error.
+	* src/fragment.c (gd_desync): Free old name after reopen.
+	* src/include.c (_GD_Include): Free sname on error.
+	* src/add.c (_GD_Add): Free temp_buffer on error.
+	* src/close.c (_GD_FreeD): Free tok_base and error_prefix.
+	* src/move.c (_GD_Move): Free new_code on error.
+	* src/parse.c (gd_strtok): Cache the string per documentation.
+
+	* test/valgrind.suppressions: Added.
+	* bindings/cxx/test/big_test.cpp test/add_affix.c test/add_meta_alias.c
+	test/add_scalar_carray.c test/name_updb_alias.c test/name_updb_const.c
+	test/name_updb_const_alias.c test/name_alias.c test/name_updb.c
+	test/madd_affix.c test/add_meta.c test/add_scalar.c test/name.c test/add.c
+	test/parse_mplex_nomax.c: Deal with memory.
+
+2012-07-10   D. V. Wiebe <getdata at ketiltrout.net> svn:740
+	* src/common.c (_GD_CanonicalPath): Fix pointer arithmetic
+
+	* src/compat.c (gd_strtod): Drop octal (not in POSIX); handle hex floating
+	point; don't zero errno.
+
+2012-07-04   D. V. Wiebe <getdata at ketiltrout.net> svn:737
+	GetData-0.8.0 released.
+
+2012-07-04   D. V. Wiebe <getdata at ketiltrout.net> svn:736
+	* src/constant.c (gd_get_carray_slice gd_get_carray gd_carray_len
+	gd_put_carray_slice gd_put_carray): Handle both CONST and CARRAY.
+	* src/constant.c (gd_get_constant gd_put_constant): Just call the
+	corresponding carray_slice function.
+
+2012-06-30   D. V. Wiebe <getdata at ketiltrout.net> svn:732
+	* src/getdata.h.in configure.ac cmake/CMakeLists.txt: Fix definition of
+	gd_off64_t.
+
+	* bindings/perl/Build.PL.in: make getdata.h a dependency of lib/GetData.xs.
+
+2012-06-29   D. V. Wiebe <getdata at ketiltrout.net> svn:728
+	* src/getdata.h.in src/internal.h src/errors.c: Merge GD_E_BAD_VERSION into
+	GD_E_ARGUMENT.
+
+2012-06-28   D. V. Wiebe <getdata at ketiltrout.net> svn:725,726
+	* util/checkdirfile.c: Find and report dangling aliases.
+
+	* bindings/python/pydirfile.c (gdpy_dirfile_nentries gdpy_dirfile_entrylist)
+	bindings/cxx/dirfile.cpp (Dirfile::NEntries Dirfile::EntryList)
+	bindings/perl/GetData.xs (entry_list) : Fix signedness of "type".
+	* bindings/idl/getdata.c (gdidl_get_field_list gdidl_get_nfields): Deal with
+	/ALIASES.
+	* bindings/make_parameters.c: Add GD_ALIAS_ENTRIES.
+
+	* test/nentries_noalias.c test/elist_noalias.c: Renamed from ..._alias.c.
+	* test/nentries_alias.c test/elist_alias.c: Added.
+
+	* src/internal.h getdata.h.in: Move GD_ALIAS_ENTRY to public header.
+	* src/getdata.h.in: Define GD_ALIAS_ENTRIES.
+	* src/field_list.c (_GD_EntryIndex _GD_ListEntry) src/nfields.c
+	(_GD_NEntries): Handle GD_ALIAS_ENTRIES.
+
+	* src/common.c (_GD_CanonicalPath): Sidestep GCC warning.
+
+2012-06-27   D. V. Wiebe <getdata at ketiltrout.net> svn:724
+	* src/name.c (_GD_UpdateScalar _GD_InvalidateConst _GD_UpdateInField
+	_GD_InvalidateVect): Handle aliases.
+	* src/name.c (gd_rename): Don't dereference aliases.
+	* src/name.c (gd_rename_alias): Deleted.
+	* test/name.c test/name_updb_const.c test/name_updb.c: Updated.
+	* test/name_updb_const_alias.c test/name_move_alias.c test/name_alias.c
+	test/name_updb_alias.c: Added.
+	* test/name_after_const.c test/name_after.c: Deleted.
+
+	* src/parse.c (_GD_ResolveAlias): Reset aliases if requested.
+
+	* man/make_html.pl: Don't eat "**" in synopses.
+
+2012-06-25   D. V. Wiebe <getdata at ketiltrout.net> svn:723
+	* src/flush.c (_GD_FindVersion): ALIAS means >= 9.
+
+	* util/checkdirfile.c: Grammar.
+
+2012-06-13   D. V. Wiebe <getdata at ketiltrout.net> svn:721
+	GetData-0.8.0rc2.
+
+2012-06-04   D. V. Wiebe <getdata at ketiltrout.net> svn:720
+	* bindings/cxx/dirfile.cpp bindings/cxx/fragment.cpp
+	bindings/cxx/getdata/dirfile.h bindings/cxx/getdata/fragment.h: off_t
+	-> gd_off64_t.
+
+2012-06-02   D. V. Wiebe <getdata at ketiltrout.net> svn:717
+	* src/internal.h (_GD_AbsPath): Allow s == NULL.
+
+2012-05-25   D. V. Wiebe <getdata at ketiltrout.net> svn:712
+	* bindings/cxx/fragment.cpp (Fragment::Fragment Fragment::SetEndianness)
+	bindings/cxx/dirfile.cpp (Dirfile::NFrames Dirfile::EoF Dirfile::BoF
+	Dirfile::GetData Dirfile::PutData Dirfile::FrameNum Dirfile::Seek
+	Dirfile::Tell): Call the 64-bit API.
+
+	* src/getdata.h.in: Support GD_64BIT_API and use configure to define
+	gd_off64_t.
+	* src/internal.h bindings/cxx/getdata/dirfile.h: Define GD_64BIT_API before
+	including getdata.h.
+
+	* test/Makefile.am man/Makefile.am: Remove LFS_TRANSITIONAL_API (always
+	enabled).
+
+	* confihure.ac: Figure out a suitable type for gd_off64_t.  Remove
+	LFS_TRANSITIONAL_API conditional.
+
+2012-05-23   D. V. Wiebe <getdata at ketiltrout.net> svn:710
+	* test/test.h: Don't redefine isnan if it's okay as-is.
+
+	* src/open.c (_GD_CreateDirfile): Don't unnecessarily disable mtime
+	acquisition.
+	* cmake/test/CMakeLists.txt: enable desync checks.
+
+	* src/compat.c (gd_strtod): Fix sign check.
+
+2012-05-22   D. V. Wiebe <getdata at ketiltrout.net> svn:709
+	* cmake/CMakeLists.txt: Update definitons.  Support GD_UTIL.
+	* cmake/test/CMakeLists.txt: Update the list of excluded tests.
+	* cmake/src/CMakeLists.txt: Support GD_DEBUG and conditionally build debug.c.
+	* cmake/bindings/cxx/CMakeLists.txt: Support GD_TEST.
+	* cmake/util/CMakeLists.txt cmake/bindings/cxx/test/CMakeLists.txt: Added.
+
+	* src/internal.h: Define PRNsize_t and PRNssize_t to get around printf()s
+	which don't recognise the "z" length modifier.  Changed everywhere.  Handle
+	basename, offsetof, strtod.
+
+	* src/compat.c (basename gd_strtod): Added.
+	* src/parse.c (_GD_SetScalar) src/nan.h: Call gd_strtod.
+
+	* README.win: Update.
+
+	* bindings/cxx/test/big_test.cpp: Tweak includes to allow compilation with
+	MSVC.
+
+	* bindings/cxx/getdata/entry.h bindings/cxx/getdata/fragment.h: Include
+	dirfile.h.
+
+	* test/include_cb.c test/madd_window.c test/open_cb_cont.c
+	test/open_cb_invalid.c test/include_pc.c test/test.h test/open_cb_rescan.c
+	test/open_cb_abort.c test/open_cb_ignore.c: Tweak for compilation with MSVC.
+
+	* test/add_meta_alias.c test/madd_affix.c test/parse_mplex_nomax.c
+	test/add_meta.c: Fix gd_entry_t access.
+
+	* util/checkdirfile.c: Preprocessor fixes for compilation with MSVC.
+
+2012-04-21   D. V. Wiebe <getdata at ketiltrout.net> svn:706
+	GetData-0.8.0rc1:
+
+	* bindings/cxx/test/big_test.cpp bindings/perl/test/big_test.t: Fix
+	mplex_lookback checks.
+
+2012-04-21   D. V. Wiebe <getdata at ketiltrout.net> svn:705
+	* man/make_html.pl: Improvements. 
+
+	* src/globals.c (gd_mplex_lookback): Always succeed; return void.
+
+	* bindings/perl/simple_funcs.pl: Handle returning void.
+
+2012-04-19   D. V. Wiebe <getdata at ketiltrout.net> svn:701
+	* src/add.c (_GD_Add): Don't check protection level before figuring out the
+	fragment index.
+
+	* bindings/perl/GetData.xs bindings/perl/typemap
+	bindings/perl/simple_funcs.pl: gdpu_spf_t -> gdpu_uint_t.
+
+	* bindings/perl/GetData.xs (gdp_to_entry entry): Use "in_fields" everywhere
+	to be consistent with the C API.
+
+	* bindings/perl/GetData.xs (mcarrays): Remove unpacked.  Use GIMME_V
+	instead.
+
+	* bindings/perl/simple_funcs.xsin (reference alter_phase add_window
+	alter_window alter_affixes add_mplex alter_mplex desync flags
+	verbose_prefix): Fix parameter defaults and types.
+
+	* bindings/perl/Build.PL.in: Install GetData.pm
+
+	* bindings/perl/simple_funcs.xsin (include include_affex): Deleted.
+	* bindings/perl/GetData.xs (include): Added.
+
+	* doc/README.perl: Added.
+	* bindings/perl/GetData.pm.in: POD.
+
+	* bindings/cxx/test/Makefile.am bindings/f77/Makefile.am test/Makefile.am
+	test/error_verbose.c test/error_verbose_prefix.c: Remove GNUisms.
+
+2012-04-13   D. V. Wiebe <getdata at ketiltrout.net> svn:699
+	* src/common.c (_GD_CanonicalPath): Terminate and don't clobber string
+	from realpath().
+
+	* bindings/make_parameters.c: Add GD_SIE_ENCODED.
+
+	* bindings/cxx/getdata/fragment.h: Update encodings.
+
+	* bindings/f77/fgetdata.c (GDTOKE) bindings/f77/getdata.f90.in (fgd_strtok):
+	Drop the 'n' parameter: just do what the C API does.
+
+	* bindings/idl/getdata.c (gdidl_getdata gdidl_putdata): Drop /HERE: just use
+	the absense of FIRST_FRAME and FIRST_SAMPLE.
+
+	* bindings/idl/getdata.c (gdidl_add_mplex): Make the MAX parameter optional.
+
+2012-04-01   D. V. Wiebe <getdata at ketiltrout.net> svn:696
+	* src/compat.c (_GD_ReadDir): Renamed from gd_readdir().
+
+2012-04-01   D. V. Wiebe <getdata at ketiltrout.net> svn:694
+	* src/getdata.h.in: Deprecate gd_bit_t and gd_spf_t.  Remove gd_count_t.
+	* src/getdata.h.in bindings/make_parameters.c: Remove GD_COUNT_MAX.
+	* cmake/CMakeLists.txt: Remove DEFINE_gd_int16_t and DEFINE_gd_uint16_t.
+	* src/internal.h: Calculate GD_INT_TYPE and GD_UINT_TYPE.
+
+	* src/entry.c (_GD_CalculateEntry) src/flush.c (_GD_FieldSpec) src/getdata.c
+	(_GD_DoMplex) src/putdata.c (_GD_DoMplexOut gd_putdata64) src/del.c
+	(_GD_DeReference) src/parse.c (_GD_ParseMplex _GD_ParseBit) src/mod.c
+	(_GD_Change): Use GD_INT_TYPE when dealing with bitnum, numbits, count_max,
+	and count_val.
+	* src/add.c (gd_add_bit gd_add_sbit gd_add_mplex gd_madd_bit gd_madd_sbit
+	gd_madd_mplex) src/mod.c (gd_alter_bit gd_alter_sbit gd_alter_mplex)
+	bindings/python/pyentry.c (gdpy_entry_setnumbits gdpy_entry_setbitnum
+	gdpy_entry_setcountval gdpy_entry_setcountmax) bindings/cxx/mplexentry.cpp
+	(MplexEntry::MplexEntry MplexEntry::SetCountVal MplexEntry::SetCountMax)
+	bindings/cxx/sbitentry.cpp (SBitEntry::SBitEntry SBitEntry::SetFirstBit
+	SBitEntry::SetNumBits) bindings/cxx/test/big_test.cpp
+	bindings/cxx/bitentry.cpp (BitEntry::BitEntry BitEntry::SetFirstBit
+	BitEntry::SetNumBits) bindings/cxx/getdata/bitentry.h (FirstBit NumBits)
+	bindings/cxx/getdata/entry.h (FirstBit NumBits CountVal CountMax)
+	bindings/cxx/getdata/mplexentry.h (CountVal CountMax)
+	bindings/cxx/getdata/sbitentry.h (FirstBit NumBits) bindings/perl/GetData.xs
+	bindings/perl/typemap bindings/perl/simple_funcs.pl bindings/f77/fgetdata.c
+	(GDADBT GDADSB GDMDBT GDMDSB GDALBT GDALSB) bindings/idl/getdata.c
+	(gdidl_make_idl_entry gdidl_read_idl_entry gdidl_add_mplex gdidl_alter_mplex):
+	gd_bit_t, gd_count_t -> int.
+	* src/fpos.c (_GD_Seek) src/getdata.c (_GD_MultiplyData _GD_CMultiplyData
+	_GD_DivideData _GD_CDivideData _GD_WindowData _GD_CDivideData _GD_MplexData
+	_GD_DoLincom _GD_DoMultiply _GD_DoDivide _GD_DoWindow _GD_DoMplex
+	gd_getdata64) src/putdata.c (_GD_MplexOutData gd_putdata64) src/flimits.c
+	(_GD_GetEOF _GD_GetBOF gd_bof64) src/common.c (_GD_LinterpData
+	_GD_LincomData) src/add.c (gd_add_raw) src/spf.c (_GD_GetSPF gd_spf)
+	src/mod.c (_GD_SPFConvert) src/mod.c (gd_alter_entry) src/index.c
+	(gd_framenum_subset64) bindings/python/pyentry.c (gdpy_entry_setspf)
+	bindings/python/pydirfile.c (gdpy_dirfile_getdata) bindings/cxx/rawentry.cpp
+	(RawEntry::RawEntry RawEntry::SetSamplesPerFrame)
+	bindings/cxx/getdata/rawentry.h (SamplesPerFrame) bindings/perl/GetData.xs
+	bindings/perl/typemap bindings/perl/simple_funcs.pl bindings/f77/fgetdata.c
+	(GDADRW GDALRW) util/dirfile2ascii.c: gd_spf_t -> unsigned int.
+	* src/flush.c (_GD_WriteConst) src/mod.c (_GD_AlterScalar): Add missing
+	integer types.
+
+	* src/parse.c (_GD_ParseMplex): Make count_max optional.
+	* src/getdata.c (_GD_DoMplex) src/add.c (_GD_Add): Handle count_max == 0.
+
+	* src/getdata.h.in: Mark GD_FLOAT and GD_DOUBLE as deprecated.
+
+	* src/encoding.c (_GD_FiniRawIO): Handle short writes and IO errors.
+
+	* src/getdata.c (_GD_DoMplex): use D->lookback to determine how far to
+	search backwards.  Also, read data in chunks of size GD_BUFFER_SIZE.
+	* src/open.c (_GD_Open): Initialise D->lookback.
+	* src/globals.c (gd_mplex_lookback): Added.
+	* bindings/cxx/dirfile.cpp (Dirfile::MplexLookback)
+	bindings/perl/simple_funcs.xsin (mplex_lookback) bindings/f77/getdata.f90.in
+	(fgd_mplex_lookback) bindings/f77/fgetdata.c (GDMXLB) bindings/idl/getdata.c
+	(gdidl_mplex_lookback): Added.
+
+	* src/parse.c (gd_strtok): Renamed from gd_tokenise to avoid regional
+	spelling variations.  Bindings renamed accordingly (except for the F77
+	bindings).
+
+	* bindings/python/pygetdata.c: Add GD_E_EXISTS exception.
+
+	* bindings/python/pydirfile.h: Add mplex_lookback and verbose_prefix to
+	gdpy_constant_t.
+	* bindings/python/pydirfile.c (gdpy_dirfile_delete): Delete verbose_prefix.
+	* bindings/python/pydirfile.c (gdpy_dirfile_create): Initialise
+	mplex_lookback and verbose_prefix.
+	* bindings/python/pydirfile.c (gdpy_dirfile_verbose_prefix): Deleted.
+	* bindings/python/pydirfile.c (gdpy_dirfile_getverboseprefix
+	gdpy_dirfile_setverboseprefix gdpy_dirfile_getmplexlookback
+	gdpy_dirfile_setmplexlookback): Added.
+
+	* bindings/Makefile.am: add src/gd_config.h to the prerequisites of
+	make_parameters.
+
+	* src/flush.c (_GD_FlushFragment): Write /ENCODING for zzip and zzslim.
+
+	* src/meta_list.c: Merged into src/field_list.c
+	* src/nmeta.c: Merged into src/nfields.c
+
+	* src/add.c (_GD_InvalidEntype): Added.
+	* src/internal.h: Add entry_list and entry_list_flags to DIRFILE and
+	private_entry.
+	* src/internal.h (_GD_EntryIndex): Deleted.
+	* src/field_list.c (_GD_EntryIndex _GD_EntryList gd_entry_list): Added.
+	* src/field_list.c (_GD_ListEntry): Handle GD_ENTRIES_... flags.
+	* src/field_list.c (gd_field_list_by_type gd_vector_list gd_field_list
+	gd_mfield_list_by_type gd_mfield_list): Reimplement via gd_entry_list().
+
+	* src/nfields.c (_GD_NEntries gd_nentries): Added.
+	* src/nfields.c (gd_nfields gd_nvectors gd_nfields_by_type gd_nmfields
+	gd_nmvectors gd_nmfields_by_type): Reimplement via gd_nentries().
+
+	* src/field_list.c (gd_constants gd_carrays gd_strings gd_mconstants
+	gd_mcarrays gd_mstrings): Call _GD_NEntries for counts.
+
+	* src/entry.c (gd_hide gd_unhide) src/del.c (_GD_Delete) src/include.c
+	(gd_uninclude) src/add.c (_GD_Add): Delete count updates.
+
+	* src/name.c (_GD_Rename) src/del.c (_GD_Delete) src/include.c
+	(gd_uninclude) src/add.c (_GD_Add _GD_AddAlias): Invalidate metafield lists
+	too.
+	
+	* src/entry.c (_GD_FreeE) src/close.c (_GD_FreeD): Delete entry_lists.
+
+	* src/globals.c (gd_flags): Don't check GD_INVALID.
+
+	* bindings/python/pydirfile.c (gdpy_dirfile_nentries
+	gdpy_dirfile_entrylist) bindings/perl/GetData.xs (entry_list)
+	bindings/cxx/dirfile.cpp (Dirfile::NEntries Dirfile::EntryList)
+	bindings/f77/getdata.f90.in (fgd_nentries fgd_entry_name_max fgd_entry_list)
+	bindings/f77/fgetdata.c (GDNENT GDENTX GDENTN): Added.
+	* bindings/idl/getdata.c (gdidl_get_field_list gdidl_get_nfields)): Convert to
+	bindings for gd_entry_list and gd_nentries.
+
+	* bindings/python/test/big_test.py bindings/cxx/test/big_test.cpp
+	bindings/perl/test/big_test.t bindings/f77/test/big_test.f
+	bindings/f77/test/big_test95.f90 bindings/idl/test/big_test.pro: Add tests
+	237 through 240.
+
+	* test/elist_alias.c test/elist_hidden.c test/elist_scalar.c
+	test/get_lincom_null.c test/get_mplex_lball.c test/get_mplex_nolb.c
+	test/nentries_alias.c test/nentries_hidden.c test/nentries_scalar.c
+	test/parse_malias_meta.c test/parse_mplex_nomax.c: Added.
+
+	* man/: Updated.
+
+2012-03-28   D. V. Wiebe <getdata at ketiltrout.net> svn:691
+	* src/flush.c (_GD_FieldSpec) src/parse.c (_GD_ParseMplex): Swap order of
+	fields in MPLEX specification.
+
+	* bindings/python/test/big_test.py bindings/cxx/test/big_test.cpp
+	bindings/perl/test/big_test.t bindings/f77/test/big_test.f
+	bindings/f77/test/big_test95.f90 bindings/idl/test/big_test.pro
+	test/entry_mplex_scalar.c test/get_mplex.c test/alter_mplex.c
+	test/put_mplex.c  test/get_mplex_lb.ctest/entry_mplex.c: Update for
+	Standards change.
+
+2012-03-28   D. V. Wiebe <getdata at ketiltrout.net> svn:690
+	* m4/compiler.m4 (GD_C_RESTRICT_ARRAY): Fix test program.
+	* bindings/idl/getdata.c (gdidl_alter_mplex): Fix uninitialised variable.
+
+2012-03-28   D. V. Wiebe <getdata at ketiltrout.net> svn:689
+	* m4/compiler.m4 (GD_C_RESTRICT_ARRAY): Added.
+	* src/parse.c src/internal.h: Work around deficiencies in the GCC-3.4 C99
+	compliance.
+
+2012-03-22   D. V. Wiebe <getdata at ketiltrout.net> svn:683
+	* src/sie.c (_GD_SampIndWrite): Fix file size calculation during truncation.
+
+	* bindings/python/pydirfile.c (gdpy_dirfile_getdata): Make return_type and
+	num_<foo> optional.
+
+2012-03-16   D. V. Wiebe <getdata at ketiltrout.net> svn:680
+	* src/globals.c (gd_flags gd_verbose_prefix): Added.
+	* src/errors.c (_GD_SetError): Print verbose prefix, if present.
+
+	* make_parameters.c: Promote GD_VERBOSE and GD_PRETTY_PRINT.
+	* bindings/cxx/dirfile.cpp (Dirfile::Flags Dirfile::VerbosePrefix)
+	bindings/python/pydirfile.c (gdpy_dirfile_getflags gdpy_dirfile_setflags
+	gdpy_dirfile_verbose_prefix) bindings/perl/simple_funcs.xsin (flags
+	verbose_prefix) bindings/f77/fgetdata.c (GDFLAG GDVBPX)
+	bindings/f77/getdata.f90.in (fgd_flags fgd_verbose_prefix)
+	bindings/idl/getdata.c (gdidl_flags gdidl_verbose_prefix): Added.
+	* bindings/python/test/big_test.py bindings/cxx/test/big_test.cpp
+	bindings/perl/test/big_test.t bindings/f77/test/big_test.f
+	bindings/f77/test/big_test95.f90 bindings/idl/test/big_test.pro: Add tests
+	235, 236.
+
+	* src/open.c (_GD_Open): Reset errno to prevent spurious error messages.
+
+	* src/flush.c (_GD_FlushFragment): Avoid FPE.
+
+	* test/global_flags.c test/error_verbose.c test/error_verbose_prefix.c:
+	Added. 
+
+	* bindings/idl/getdata.c (gdidl_open): Add missing IGNORE_REFS,
+	PRETTY_PRINT, TRUNCSUB.
+
+	* bindings/f77/fgetdata.c (_GDF_CString): Take care of the malloc'ing rather
+	than forcing the caller to do it.
+
+2012-03-16   D. V. Wiebe <getdata at ketiltrout.net> svn:678
+	* src/errors.c src/getdata.h.in: Add GD_E_EXISTS
+	* src/open.c (_GD_CreateDirfile): Replace GD_E_CREAT:GD_E_CREAT_EXCL with
+	GD_E_EXISTS.
+
+2012-03-16   D. V. Wiebe <getdata at ketiltrout.net> svn:676
+	* configure.ac bindings/idl/package/configure.ac src/include.h
+	bindings/make_parameters.c bindings/cxx/internal.h bindings/idl/getdata.c
+	test/test.h util/dirfile2ascii.c util/checkdirfile.c: Renamed config.h to
+	gd_config.h to get around lossage in the Perl CORE public headers.
+	
+	* bindings/perl/test: Renamed from t.
+	* bindings/perl/MANIFEST.in: Renamed from MANIFEST.
+	* bindings/perl Makefile.am bindings/f77/test/Makefile.am: VPATH fixes.
+
+	* src/fragment.c (gd_desync): dup the dirfile fd before closing.
+	* test/desync_reopen.c test/desync_reopen_inv.c: Added.
+
+	* bindings/idl/package/configure.ac bindings/idl/package/README: Bump
+	GetData min version.
+
+2012-03-15   D. V. Wiebe <getdata at ketiltrout.net> svn:675
+	* src/internal.h: Add fragment->mtime, dirfile->open_flags.  Deconst
+	fragment->sname.
+	* src/close.c (_GD_FreeD _GD_ShutdownDirfile): Add new parameter
+	(keep_dirfile) to prohibit deallocating the dirfile struct itself.
+	De-staticked _GD_ShutdownDirfile.
+	* src/include.c (_GD_Include): Compute the path relative to the parent of
+	fragment and store it in fragment->sname.  Store mtime.
+	* src/close.c (_GD_FreeD): Free fragment->sname.
+	* src/flush.c (_GD_FlushFragment): Remove unnecessary strdup: we already
+	cache the basename.  Update mtime.
+	* src/open.c (_GD_CreateDirfile): Return mtime.
+	* src/open.c (_GD_Open): Renamed from gd_cbopen; optionally take an existing
+	dirfd and DIRFILE pointer.  Fix the dirfd/dirfile race condition by
+	canonicalising dirfile first.
+	* src/fragment.c (gd_desync) src/open.c (gd_cbopen): Added.
+	* src/getdata.h.in: Added GD_DESYNC_PATHCHECK GD_DESYNC_REOPEN.
+	* test/desync.c test/desync_flush.c: Added.
+
+	* src/internal.h (offsetof): Added.
+	* src/compat.c (gd_readdir): Added.
+	* src/open.c (_GD_TruncDir): Use a thread-safe readdir where possible.
+
+	* src/include.c (gd_include_affix): Don't call do stuff before validating
+	the dirfile.
+
+	* bindings/make_parameters.c: Add desync flags.
+	* bindings/python/pydirfile.c (gdpy_dirfile_desync) bindings/cxx/dirfile.cpp
+	(Dirfile::DeSync) bindings/perl/simple_funcs.xsin (desync)
+	bindings/f77/getdata.f90.in (fgd_desync) bindings/f77/fgetdata.c (GDDSYN)
+	bindings/idl/getdata.c (gdidl_desync): Added.
+	* bindings/python/test/big_test.py bindings/cxx/test/big_test.cpp
+	bindings/perl/t/big_test.t bindings/f77/test/big_test.f
+	bindings/f77/test/big_test95.f90 bindings/idl/test/big_test.pro: Added test
+	234.
+
+	* bindings/cxx/test/big_test.cpp: Functionise to reduce compilation work.
+
+	* bindings/perl/Makefile.am: Tweak yet some more.
+
+2012-03-14   D. V. Wiebe <getdata at ketiltrout.net> svn:674
+	* src/open.c (gd_cbopen): Handle failure of _GD_CanonicalPath better.
+
+2012-03-14   D. V. Wiebe <getdata at ketiltrout.net> svn:671
+	* src/flush.c (_GD_FlushFragment): Write SIE encoding directives.
+
+	* src/sie.c (_GD_SampIndOpen): Initialise file->pos to 0 to avoid issues
+	with _GD_GetFilePos.
+	* src/sie.c (_GD_SampIndSeek): Don't short circuit if no record is loaded.
+
+	* src/flush.c (_GD_Flush _GD_SyncOrClose): Make syncing optional with a new
+	parameter (syn).
+	* src/flush.c (gd_raw_close): Added.
+	* src/clsoe.c (_GD_ShutdownDirfile) src/include.c (gd_uninclude): Don't
+	sync, just close raw files.
+
+	* bindings/python/pydirfile.c (gdpy_dirfile_raw_close)
+	bindings/cxx/dirfile.cpp (Dirfile::RawClose) bindings/perl/simple_funcs.xsin
+	(raw_close) bindings/f77/fgetdata.c (GDRCLO) bindings/f77/getdata.f90.in
+	(fgd_raw_close): Added.
+	* bindings/idl/getdata.c (gdidl_flush): Add /NOSYNC.
+	* bindings/python/test/big_test.py bindings/cxx/test/big_test.cpp
+	bindings/perl/t/big_test.t bindings/f77/test/big_test.f
+	bindings/f77/test/big_test95.f90: Added test 233.
+
+	* bindings/perl/Build.PL.in: subclass Module::Build to properly handle
+	simple_funcs.xs dependency tracking.
+
+2012-03-06   D. V. Wiebe <getdata at ketiltrout.net> svn:667
+	* src/errors.c: Change prefix on verbose output to "libgetdata".
+
+	* src/add.c (_GD_FixName): Added.
+	* src/add.c (_GD_Add _GD_AddAlias): Call _GD_FixName.
+	* test/add_alias_meta.c: Added.
+
+	* src/open.c (_GD_TruncDir): Fix subdirectory truncation.
+	* src/internal.h: Remove conditional defition of AT_SYMLINK_NOFOLLOW.
+	* src/compat.c (gd_StatAt): Check for definition of AT_SYMLINK_NOFOLLOW
+	before use.
+
+2012-03-03   D. V. Wiebe <getdata at ketiltrout.net> svn:665
+	* src/getdata.h.in bindings/make_parameters.c: Added GD_TRUNCSUB open flag.
+	* src/open.c (_GD_TruncDir): Added.
+	* src/open.c (_GD_CreateDirfile): Call _GD_TruncDir.
+	* test/trunc_dir.c test/trunc_truncsub.c: Added.
+
+	* src/fragment.c (gd_alter_affixes): Handle GD_E_ACCMODE and GD_E_PROTECTED
+	errors.
+
+	* bindings/f77/fgetdata.c (GDDELA): Correct call to gd_delete_alias.
+
+2012-03-02   D. V. Wiebe <getdata at ketiltrout.net> svn:664
+	* src/errors.c: Added GD_E_ARGUMENT:GD_E_ARG_NODATA.
+	* src/parse.c (_GD_Tokenise): Take number of columns to return.
+	* src/parse.c (gd_tokenise): Added.
+	* src/internal.h: Added _GD_DIRFILE->tok_pos.
+
+	* src/parse.c (_GD_CheckParent): Destatickify, and modify for use by
+	_GD_Add.
+	* src/add.c (_GD_Add): Call _GD_CheckParent to automatically allow
+	parent/meta style metafield addition via gd_add[_<whatever>]().
+
+	* bindings/python/pydirfile.c (gdpy_dirfile_tokenise)
+	bindings/cxx/dirfile.cpp (Dirfile::Tokenise) bindings/perl/GetData.xs
+	(tokenise) bindings/f77/getdata.f90.in (fgd_tokenise)
+	bindings/f77/fgetdata.c (GDTOKE) bindings/idl/getdata.c (gdidl_tokenise):
+	Added.
+
+	* bindings/python/test/big_test.py bindings/cxx/test/big_test.cpp
+	bindings/perl/t/big_test.t bindings/f77/test/big_test.f
+	bindings/f77/test/big_test95.f90 bindings/idl/test/big_test.pro: Add test
+	#232.
+
+	* bindings/f77/getdata.f90.in (fgd_fragment_affixes): Fix GDFRAF call.
+
+	* bindings/f77/fgetdata.c (_GDF_SetDirfile _GDF_Callback GDCOPN GDCLBK):
+	Don't cast between data and code pointers.  Encapsulate the F77 callback
+	function in a container.
+	* bindings/f77/fgetdata.c (GDNOCB): Added.
+	* bindings/f77/test/gdcopn.f: Add GDCLBK and GDNOCB tests.
+
+	* test/ascii_get.c test/ascii_put.c test/ascii_get_get.c
+	test/ascii_nframes.c: Delete FOPEN_TEXT.
+
+	* test/add_meta.c test/add_meta_alias.c: Added.
+
+2012-02-16   D. V. Wiebe <getdata at ketiltrout.net> svn:658
+	* src/getdata.c (_GD_DoLincom): Get the correct SPFs.
+	* test/get_lincom_spf.c: Added.
+
+	* src/open.c (_GD_CreateDirfile): When truncating, don't delete and then
+	recreate the format file; just truncate it.  (This helps kst not get
+	confused when monitoring a dirfile which gets truncated.)
+
+2012-02-14   D. V. Wiebe <getdata at ketiltrout.net> svn:656 svn:657
+	* src/putdata.c (gd_putdata): Return early if num_samp == 0.
+	* test/put_zero.c: Added.
+
+2012-02-01   D. V. Wiebe <getdata at ketiltrout.net> svn:652
+	* configure.ac: Figure out the directory separator (ie. '/' on POSIX).
+	
+	* src/open.c (_GD_CreateDirfile): Handle DIRSEP.
+	* src/internal.h (_GD_Root): Added.
+	* src/common.c (_GD_CanonicalPath): Handle WIN32/DOS paths.
+
+	* src/open.c (gd_cbopen): Temporarily store the full path in D->name so that
+	_GD_CreateDirfile can use it when needed.
+
+	* src/spf.c (_GD_GetSPF): De const-ify E.
+
+	* src/common.c (_GD_FindField): Fix buffer length calculation.
+
+	* test/file.c test/fragment_name.c bindings/cxx/test/big_test.cpp
+	bindings/f77/test/big_test.f bindings/f77/test/big_test95.f90: Handle DIRSEP.
+	* bindings/f77/test/test_getdata.f.in: Added.
+
+2012-01-18   D. V. Wiebe <getdata at ketiltrout.net> svn:650
+	* src/getdata.h.in src/internal.h: Define GD_ENC_ZZSLIM GD_ZZSLIM_ENCODED.
+	* src/zzslim.c: Added.
+	* src/encoding.c: In the initialisation of _gd_ef, differentiate things
+	that are willing to use the Generic functions from those that aren't.  Added
+	zzslim.
+
+	* src/common.c (_GD_CanonicalPath): Don't truncate on ENOENT.
+
+	* src/slim.c (_GD_SlimOpen): The slimdopen in slimlib-2.6.5 doesn't interact
+	well with slim's own zzip support, so let's ignore it for now.
+
+	* bindings/make_parameters.c: Convert F77 encoding parameters to the form
+	GDE_xx.
+
+	* configure.ac: zzslim tests.  Always look for a C++ compiler.
+	* m4/encoding.m4: Separate LIBS from LDFLAGS; fix some underquoting.
+
+2012-01-11   D. V. Wiebe <getdata at ketiltrout.net> svn:644
+	* src/getdata.h.in: Added GD_MPLEX_ENTRY.  Updated gd_entry_t.  Defined
+	GD_COUNT_MAX.
+
+	* src/legacy.c (CopyMplexEntry) src/getdata.c (_GD_MplexData _GD_DoMplex)
+	src/putdata.c (_GD_MplexOutData _GD_DoMplexOut) src/parse.c (_GD_ParseMplex)
+	src/add.c (gd_add_mplex gd_madd_mplex) src/mod.c (gd_alter_mplex): Added.
+	* src/internal.h: Define GD_MPLEX_LOOKBACK
+
+	* src/entry.c (_GD_FreeE _GD_CalculateEntry gd_entry gd_validate)
+	src/flush.c (_GD_Flush _GD_FieldSpec _GD_FindVersion) src/fpos.c
+	(_GD_GetFilePos _GD_WriteSeek) src/legacy.c (GetFormat) src/getdata.c
+	(_GD_DoField) src/name.c (_GD_InvalidateConst _GD_InvalidateVect)
+	src/native.c (_GD_NativeType) src/putdata.c (_GD_DoFieldOut) src/del.c
+	(_GD_ClearDerived _GD_DeReference) src/flimits.c (_GD_GetEOF _GD_GetBOF)
+	src/parse.c (_GD_ParseFieldSpec) src/add.c (_GD_Add) src/spf.c (_GD_GetSPF)
+	src/mod.c (_GD_Change): Handle MPLEX.
+
+	* src/fpos.c (_GD_Seek): De-statickify.
+	* src/legacy.c (CopyWindowEntry): Report as MPLEX.
+	* src/getdata_legacy.h: Fix mplex list in FormatType.
+
+	* src/errors.c: Rename GD_E_BAD_ENTRY_* suberrors to GD_E_ENTRY_* for
+	brevity.  Added GD_E_FORMAT_MPLEXVAL, GD_E_ENTRY_CNTVAL, GD_E_ENTRY_CNTMAX.
+
+	* src/field_list.c (_GD_ListEntry): Move the alias check down so that hidden
+	and meta alias are handled properly.
+
+	* internal.h src/common.c (_GD_Malloc _GD_Realloc _GD_Strdup): Moved from
+	internal.h.
+
+	* bindings/make_parameters.c: Define MPLEX_ENTRY, E_FORMAT_MPLEXVAL,
+	COUNT_MAX.
+	* bindings/cxx/mplexentry.cpp bindings/cxx/getdata/mplexentry.h: Added.
+	* bindings/python/pyentry.c (gdpy_entry_getcountval gdpy_entry_setcountval
+	gdpy_entry_getcountmax gdpy_entry_setcountmax) bindings/cxx/getdata/entry.h
+	(Entry::CountVal Entry::CountMax) bindings/f77/getdata.f90.in (fgd_add_mplex
+	fgd_madd_mplex fgd_alter_mplex) bindings/f77/fgetdata.c (GDGEMX GDADMX
+	GDMDMX GDALMX) bindings/idl/getdata.c (gdidl_add_mplex gdidl_alter_mplex):
+	Added.
+
+	* bindings/python/pyentry.c (gdpy_set_entry_from_tuple
+	gdpy_set_entry_from_dict gdpy_entry_getinfields gdpy_entry_setinfields
+	gdpy_entry_getparms) bindings/cxx/entry.cpp (CheckIndex scalar_ok)
+	bindings/cxx/dirfile.cpp (Dirfile::Entry) bindings/cxx/getdata/dirfile.h
+	bindings/perl/GetData.xs (gdp_to_entry entry) bindings/f77/getdata.f90.in
+	(fgd_entry fgd_add fgd_madd) bindings/f77/fgetdata.c (GDASCA GDMDWD)
+	bindings/idl/getdata.c (gdidl_make_idl_entry gdidl_read_idl_entry): MPLEX
+	bindings.
+
+	* bindings/perl/simple_funcs.xsin: Add add_mplex, alter_mplex, madd_mplex.
+	* bindings/perl/simple_funcs.pl: Handle gd_count_t.
+
+	* bindings/python/test/big_test.py bindings/cxx/test/big_test.cpp
+	bindings/perl/t/big_test.t bindings/f77/test/big_test.f
+	bindings/f77/test/big_test95.f90 bindings/idl/test/big_test.pro: Add tests
+	228-231.
+
+	* bindings/cxx/windowentry.cpp bindings/cxx/getdata/windowentry.h
+	bindings/idl/getdata.c (gdidl_alter_window): Get rid of
+	Check stuff: just use Input, for consistency.
+
+	* test/add_mplex.c test/add_mplex_val.c test/alter_mplex.c
+	test/entry_mplex.c test/entry_mplex_scalar.c test/get_mplex.c
+	test/get_mplex_lb.c test/madd_mplex.c test/parse_mplex.c
+	test/parse_mplex_ncols.c test/parse_mplex_scalar.c test/put_mplex.c: Added.
+
+2011-12-31   D. V. Wiebe <getdata at ketiltrout.net> svn:643
+	* bindings/python/pyentry.c (gdpy_set_entry_from_dict): Add missing INCREF.
+
+2011-12-29   D. V. Wiebe <getdata at ketiltrout.net> svn:641
+	* src/internal.h src/encoding.c (_GD_GenericName): Added fragment->enc_data.
+	Pass enc_data to gd_ef->name.  Flag encodings that use enc_data with
+	GD_EF_EDAT.
+	* src/parse.c (_GD_ParseDirective): Allow an optional second parameter to
+	/ENCODING of encoding-specific data.
+	* src/entry.c (_GD_ResolveEncoding): Pass in enc_data.
+	* src/zzip.c (_GD_ZzipName): Use enc_data to specify archive name.
+
+2011-12-29   D. V. Wiebe <getdata at ketiltrout.net> svn:640
+	* configure.ac: zzip encoding check.
+	* src/getdata.h.in src/internal.h: GD_ZZIP_ENCODED / GD_ENC_ZZIP; Added name
+	to encoding_t.
+	* src/zzip.c: Added.
+	* src/encoding.c: Add Zzip encoding; gd_ef_name_t.
+	* src/encoding.c (_GD_GenericName): Renamed from _GD_SetEncodedName and
+	pushed down into the encoding framework.
+	* src/encoding.c (_GD_MissingFramework): Handle GD_EF_NAME.
+	* src/encoding.c (_GD_ResolveEncoding): Handle external name functions.
+	* src/entry.c (gd_raw_filename) src/encoding.c (_GD_InitRawIO
+	_GD_RecodeFragment) src/move.c (_GD_MogrifyFile) src/name.c (_GD_Rename)
+	src/del.c (_GD_Delete) src/flimits.c (_GD_GetEOF): Call _gd_ef->name.
+	* test/zzip_get.c test/zzip_get_get.c test/zzip_nframes.c: Added.
+
+2011-12-27   D. V. Wiebe <getdata at ketiltrout.net> svn:639
+	* src/add.c (gd_madd_lincom gd_madd_clincom gd_madd_linterp gd_madd_bit
+	gd_madd_sbit gd_madd_multiply gd_madd_phase gd_madd_polynom gd_madd_cpolynom
+	gd_madd_string gd_madd_const gd_madd_carray): Zero entry before
+	initialisation.
+
+	* src/fragment.c (gd_alter_affixes): Allow {pre,suf}fix == NULL to indicate
+	no change.
+
+	* src/entry.c (_GD_FreeE): Handle aliases.
+
+	* src/close.c (_GD_FreeD): Free fragment affixes.
+
+	* src/debug.c (gd_colnil gd_coladd gd_colsub): Export debugging symbols.
+
+	* src/field_list.c (_GD_ListEntry): Added.
+	* src/field_list.c (gd_constants gd_carrays gd_strings gd_field_list_by_type
+	gd_vector_list gd_field_list) src/meta_list.c (gd_mconstants gd_mcarrays
+	gd_mstrings gd_mfield_list_by_type gd_mvector_list gd_mfield_list): Call
+	_GD_ListEntry.
+
+	* bindings/python/pyentry.c bindings/python/pyfragment.c
+	bindings/python/pydirfile.c: Update for DSV9.
+	* bindings/cxx/fragment.cpp bindings/cxx/entry.cpp bindings/cxx/dirfile.cpp
+	bindings/cxx/getdata/entry.h bindings/cxx/getdata/dirfile.h: Update for
+	DSV9.
+	* bindings/cxx/windowentry.cpp bindings/cxx/getdata/windowentry.h: Added.
+	* bindings/perl/GetData.xs bindings/perl/simple_funcs.xsin: Update for DSV9.
+	* bindings/f77/fgetdata.c bindings/f77/getdata.f90.in: Update for DSV9.
+	* bindings/idl/getdata.c: Update for DSV9.  Removed most of the function
+	aliases.
+
+	* bindings/make_parameters.c: Update for DSV9.  Add missing
+	GD_E_UNKNWON_ENCODING.
+
+	* bindings/python/pygetdata.c (initpygetdata): Handle gaps in
+	gdpy_exception_list.  Fix exception list.
+
+	* bindings/python/pyentry.c (gdpy_entry_settable): Set correct parameter.
+
+	* test/vlist_alias.c: Added.
+
+2011-12-20   D. V. Wiebe <getdata at ketiltrout.net> svn:638
+	* src/entry.c (_GD_GetScalar _GD_CalculateEntry) src/common.c (_GD_GetRepr
+	_GD_BadInput _GD_FindFieldAndRepr: Optionally prohibit setting errors (for
+	use by the post-rename update stuff).
+	* src/errors.c: Added GD_E_FORMAT_ALIAS, GD_E_DEL_ALIAS.
+	* src/flush.c (_GD_FieldSpec): Write aliases.  Also tweaked to allow slashed
+	metafield specification with DSV7.
+	* src/del.c (_GD_ClearDerived): Handle aliases.
+	* src/parse.c (_GD_CheckParent _GD_ParseAlias _GD_ResolveAlias
+	_GD_UpdateAliases) src/add.c (_GD_AddAlias gd_add_alias gd_madd_alias): Added.
+	* src/parse.c (_GD_ParseFieldSpec): Call _GD_CheckParent.
+	* src/parse.c (_GD_ParseDirective): Use a switch to reduce the number of
+	strcmps done.  Handle /ALIAS.
+	* src/parse.c (_GD_ParseFragment): Optionally call _GD_UpdateAliases to
+	resolve aliases.
+	* src/add.c (_GD_Add gd_madd_spec gd_add_spec): Update aliases after addition.
+
+	* src/common.c (_GD_FindField): Optionally dealias names.
+
+	* src/del.c (_GD_Delete): Renamed from gd_delete().
+	* src/del.c (gd_delete gd_delete_alias): Added.
+
+	* src/name.c (_GD_UpdateScalar _GD_InvalidateConst _GD_UpdateInField
+	_GD_InvalidateVect): Added.
+	* src/name.c (_GD_Rename): Renamed from gd_rename().  Handle cleaning up
+	after the rename.
+
+	* src/move.c (_GD_Move): Renamed from gd_move().
+
+	* src/name.c (_GD_ValidateField): Permit is_dot = NULL.
+
+	* src/entry.c (gd_alias_target gd_aliases gd_naliases gd_hidden) src/move.c
+	(gd_move gd_move_alias) src/name.c (gd_rename gd_rename_alias): Added.
+
+	* src/alias.c (gd_fragment_index gd_hide gd_unhide): Call _GD_FindField
+	instead of _GD_FindFieldAndRepr to avoid resolving aliases.  As a side effect,
+	these function will no long ignore representation suffices.
+
+	* src/flush.c (_GD_StringEscapeise): Handle writing slashed meta-fields.
+
+	* src/spf.c (_GD_GetSPF): Ensure return is zero on error.
+
+	* test/alias_num_missing.c alias_target_missing.c spf_alias_missing.c
+	alias_list.c del_derived_after.c madd_spec_resolv.c parse_alias_meta.c
+	entry_type_alias.c spf_alias.c name_after_const.c parse_malias_dup.c
+	add_alias.c alias_target.c alias_list_alias.c add_resolv.c spf_alias_meta.c
+	move_alias.c name_after.c parse_meta_jump.c parse_alias_missing.c
+	name_update_const.c madd_alias.c parse_alias_dup.c fragment_index_alias.c
+	add_spec_resolv.c alias_target_alias.c name_update.c hide_hidden.c
+	alias_num_alias.c parse_malias.c parse_alias_code.c parse_alias.c
+	alias_num.c parse_meta_malias.c parse_meta_alias.c alias_list_missing.c:
+	Added.
+
+	* test/fragment_parent.c: Renamed from test/parent.c.
+	* test/fragment_num.c: Renamed from test/nfragments.c.
+
+	* test/version_9_write.c: Update.
+
+2011-12-13   D. V. Wiebe <getdata at ketiltrout.net> svn:637
+	* test/fragment_affix_alter2.c test/fragment_affix_alter.c
+	test/fragment_affix_dup.c test/fragment_affix.c test/include_affix.c: Added.
+
+	* src/move.c (_GD_StrCmpNull): Renamed from strcmpnull and de-statickified.
+
+	* src/name.c (_GD_MungeFromFrag): Added.
+	* src/name.c (_GD_MungeCode): Converted into a swiss army munger handling
+	both enmunging and demunging.  Most old, simple, uses of this function now
+	call _GD_MungeFromFrag (which calls this) instead.
+	* src/flush.c (_GD_DeMungeCode): Deleted in favour of the new _GD_MungeCode.
+
+	* src/fragment.c (gd_fragment_affixes _GD_CheckAffixes _GD_ChangeAffixes
+	gd_alter_affixes): Added.
+
+	* src/include.c (gd_include_affix): Renamed from gd_include.
+	* src/include.c (gd_include): Added.
+
+2011-12-11   D. V. Wiebe <getdata at ketiltrout.net> svn:635
+	* test/add_string_affix.c test/name_affix_bad.c test/move_affix.c
+	test/alter_entry_affix.c test/alter_entry_affix.c test/madd_affix.c
+	test/parse_meta_affix.c test/madd_index.c test/name_affix.c
+	test/alter_mspec_affix.c test/name_dup.c test/parse_meta_implicit_affix.c
+	test/add_affix.c test/alter_spec_affix.c: Added.
+
+	* test/version_9_strict.c test/version_9_write.c: Expanded.
+
+	* src/open.c (gd_cbopen): Set errors for _GD_CanonicalPath.
+
+	* src/errors.c: Distingish missing codes from invalid codes for
+	GD_E_BAD_CODE.
+
+	* src/name.c (gd_rename): Validate the new name first and then DeMunge it
+	if it's not a meta field.
+
+	* src/move.c (gd_move): Compose the new field name by remunging it for the
+	new fragment.  Also compose the new names of all its metafield early, if
+	necessary.
+	
+	* src/parse.c (_GD_ParseFieldSpec _GD_ParseDirective): Munge field codes
+	before lookup.  Also munge the reference field.
+
+	* src/mod.c (gd_alter_spec gd_malter_spec): The parser will end up
+	reapplying affixes to the field name, so undo that.
+
+	* src/add.c (_GD_Add gd_add_string gd_add_const gd_add_const gd_madd_string
+	gd_madd_const gd_madd_carray): _GD_Add() returns the added entry on success.
+	This saves a field lookup in the others.
+
+	* src/add.c (_GD_Add): Munge field name earlier.
+
+	* src/name.c (gd_rename): Flag fragment as modified.
+
+	* src/flush.c (_GD_FieldSpec): Properly write /HIDDEN directives.
+
+2011-12-09   D. V. Wiebe <getdata at ketiltrout.net> svn:634
+	* test/parse_include_preprefix.c test/version_9_strict.c test/version_9.c
+	test/parse_include_suffix.c test/parse_include_loop.c test/version_9_write.c
+	test/parse_include_sufsuffix.c test/parse_include_prefix.c
+	test/parse_include_prefix_dup.c test/get_phase_affix.c: Added.
+
+	* test/add_sort.c test/add_scalar_carray.c test/add_code.c test/add_type.c
+	test/add_invalid.c test/put_carray.c test/add_scalar.c test/madd.c
+	test/add_format.c: Remove dirfile before starting.
+
+	* test/version_8_strict.c: Fix initialisation.
+
+	* test/version_6_write.c: Test whitespace in field names.
+
+	* test/test.h: Armour plate macros.
+
+	* src/internal.h: Add prefix and suffix to gd_fragment_t.
+	* src/name.c (_GD_MungeCode) src/flush.c (_GD_DeMungeCode) src/include.c
+	(_GD_SetFieldAffixes): Added.
+	* src/flush.c (_GD_StringEscapeise): Handle null tokens.  Escape spaces
+	rather than assuming the caller will quote the token (which it wasn't
+	doing).
+	* src/entry.c (_GD_GetScalar) src/name.c (gd_rename) src/add.c (_GD_Add)
+	src/commonc. (_GD_BadInput): Munge field code before use.
+	* src/flush.c (_GD_PadField): Demunge field code before writing.
+	* src/flush.c (_GD_WriteConst): Properly demunge and escapeise scalar names.
+	* src/name.c (_GD_ValidateField): This function no longer takes care of
+	malloc'ing.  Modified to return integer true on error.
+	* src/name.c (_GD_FlushFragment): Add prefix and suffix to INCLUDE when
+	present.
+	* src/parse.c (_GD_ParseRaw _GD_ParseLincom _GD_ParseLinterp
+	_GD_ParseMultiply _GD_ParseRecip _GD_ParseLincom _GD_ParseWindow
+	_GD_ParseDivide _GD_ParseBit _GD_ParsePhase _GD_ParsePolynom _GD_ParseConst
+	_GD_ParseCarray _GD_ParseString): Munge field code on parsing.
+	* include.c (_GD_Include): Handle affixes.
+
+	* src/common.c (_GD_EntryCmp): Moved from src/internal.h and deinlined,
+	destatickified.  Given that the only use of this function is to pass it to
+	qsort, making it static inline only ensured that it got replaced once per
+	translation unit that referred to it.
+
+	* include.c (_GD_Include): Replaced the old filename comparison stage with a
+	simple recursion counter.
+
+	* src/parse.c (_GD_Tokenise): Handle token-initial escaped character.
+	Handle "\[ux#]##\...".
+
+	* src/flush.c (_GD_FindVersion): Prefix or suffix implies DSV >= 9.
+
+	* src/parse.c (_GD_SetScalar): Handle bad malloc.
+
+	* src/name.c (_GD_FieldSpec): Properly escapeise input field codes.
+
+	* src/errors.c: Distinguish GD_E_RECURSE_CODE from GD_E_RECURSE_INCLUDE.
+
+	* src/internal.h (_GD_Malloc _GD_Realloc _GD_Strdup): Added.
+	* src/commonc. (_GD_MakeFullPath): Set error if requested.
+	* src/common.c (_GD_MakeFullPathOnly): Added.  This is a wrapper around
+	_GD_MakeFullPath which ensures the DIRFILE is not modified.  Used by the
+	compatibility functions and the slim encoding framework (ie. things that have
+	at best a tenuous connection to the DIRFILE object).
+
+	* src/internal.h: Define GD_MULTISTANDARD.
+	* src/include.c (_GD_Include): Set GD_MULTISTANDARD if moving into/out of 
+	DSV >= 9.
+	* src/open.c (gd_cbopen): If the metadata contain multiple standards, figure
+	out a single one for the whole dirfile.
+
+2011-12-08   D. V. Wiebe <getdata at ketiltrout.net> svn:633
+	* test/svlist_hidden.c test/svlist_meta_hidden.c test/hide.c
+	test/flist_hidden.c test/nfields_hidden.c test/parse_version_89.c
+	test/nmeta_type_hidden.c test/parse_version_98.c test/nmeta_vectors_hidden.c
+	test/nmeta_hidden.c test/alter_entry_hidden.c test/parse_version_p8.c
+	test/parse_version_p9.c test/hide_unhide.c test/cvlist_meta_hidden.c
+	test/nfields_type_hidden.c test/vlist_hidden.c test/flist_meta_hidden.c
+	test/vlist_meta_hidden.c test/flist_type_meta_hidden.c
+	test/parse_hidden_meta.c test/cvlist_array_hidden.c test/parse_meta_meta.c
+	test/nfields_vector_hidden.c test/parse_hidden.c test/parse_hidden_field.c
+	test/cvlist_hidden.c test/cvlist_array_meta_hidden.c
+	test/flist_type_hidden.c: Added.
+
+	* test/nfields_vector.c test/nfields_vector_invalid.c: Renamed from nvectors*
+
+	* src/parse.c (_GD_ParseDirective): Parse /HIDDEN directives.
+	* src/entry.c (gd_hide gd_unhide): Added.
+	* src/nmeta.c (gd_nmfields gd_nmvectors gd_nmfields_by_type) src/nfields.c
+	(gd_nfields gd_nvectors gd_nfields_by_type) src/field_list.c (gd_constants
+	gd_carrays gd_strings gd_field_list_by_type gd_vector_list gd_field_list)
+	src/meta_list (gd_mconstants gd_mcarrays gd_mstrings gd_mfield_list_by_type
+	gd_mvector_list gd_mfield_list): Compensate for hidden fields.
+	* src/flush.c (_GD_FieldSpec): Write /HIDDEN directives.
+	* src/flush.c (_GD_FindVersion): Consider hidden entries.
+	* src/mod.c (_GD_Change): Prohibit changing hiddenness via gd_alter_entry().
+
+	* src/parse.c (_GD_ParseDirective): Forbid a metafield code from appearing
+	as a parent in /META directives.
+
+	* src/internal.h: Record the number of each type of field, rather than just
+	for the scalar field types.
+	* src/internal.h (_GD_EntryIndex): Added.
+	* src/open.c (gd_cbopen): Initialise D->n[INDEX_ENTRY].
+	* src/nmeta.c (gd_nmvectors gd_nmfields_by_type) src/nfields.c (gd_nvectors
+	gd_nfields_by_type) src/field_list.c (gd_constants gd_carrays gd_strings
+	gd_field_list_by_type gd_vector_list) src/meta_list.c (gd_mconstants
+	gd_mcarrays gd_mstrings gd_mfield_list_by_type gd_mvector_list): Use type
+	counts.
+	* src/del.c (gd_delete) src/parse.c (_GD_ParseFieldSpec) src/include.c
+	(gd_uninclude) src/add.c (_GD_Add): Update type counts.
+	* src/field_list.c (_gd_entype_index): Deleted.
+
+	* src/include.c (_GD_Include): Remember incoming Standards Version and
+	parser mode, and restore them on exit if the new DSV >=9 or the old mode is
+	pedantic and the old DSV >= 9.  This is an attempt to stave the "version
+	leak" problem experienced in earlier DSVs.
+
+	* src/internal.h: Renamed GD_E_FORMAT_NO_PARENT to GD_E_FORMAT_NO_FIELD.
+
+2011-12-06   D. V. Wiebe <getdata at ketiltrout.net> svn:632
+	* test/get_window_ne.c test/get_window.c test/parse_window_scalar.c
+	test/alter_window.c test/parse_window.c test/madd_window.c
+	test/parse_window_ncols.c test/add_window.c test/put_window.c
+	test/get_window_set.c test/get_window_gt.c test/get_window_ge.c
+	test/parse_window_op.c test/entry_window.c test/entry_window_scalar.c
+	test/add_window_op.c test/get_window_lt.c test/get_window_clr.c
+	test/get_window_le.c: Added.
+
+	* test/madd_phase.c: Fix check.
+
+	* test/version_6.c test/version_7.c test/version_8.c: Update for Version 9.
+
+	* cmake/CMakeLists.txt configure.ac: Define gd_int64_t.
+
+	* src/getdata.h.in: Add GD_WINDOW_ENTRY, gd_windop_t, gd_triplet_t.
+	* src/entry.c (_GD_FreeE _GD_CalculateEntry gd_entry) legacy.c (GetFormat)
+	src/getdata.c (_GD_DoField) src/errors.c src/flush.c (_GD_Flush
+	_GD_FieldSpec) src/native.c (_GD_NativeType) src/spf.c (_GD_GetSPF)
+	src/putdata.c (_GD_DoFieldOut) src/del.c (_GD_ClearDerived _GD_DeReference)
+	src/flimits.c (_GD_GetEOF _GD_GetBOF) src/fpos.c (_GD_GetFilePos _GD_Seek)
+	src/parse.c (_GD_ParseFieldSpec) src/field_list.c src/mod.c (_GD_Change)
+	src/add.c (_GD_Add): Update for WINDOW.
+	* src/legacy.c (CopyWindowEntry) src/getdata.c (_GD_WindowData _GD_DoWindow)
+	src/flush.c (_GD_WindopName) src/parse.c (_GD_WindOp _GD_ParseWindow)
+	src/mod.c (gd_alter_window) src/internal.h (_GD_BadWindop) src/add.c
+	(gd_add_window gd_madd_window): Added.
+	* src/flush.c (_GD_WriteConst): Write GD_UINT64.
+
+	* src/flush.c (_GD_WriteConst): Fix writing of RECIP fields.
+
+	* src/parse.c (_GD_ParseRecip _GD_ParsePhase): Fail if SetScalar fails.
+
+	* src/parse.c (_GD_SetScalar): Don't bother trying to decode an imaginary
+	part before failing if we're not interested in complex numbers.
+
+	* src/parse.c (_GD_SetScalar): Call strto[u]ll with base=0 for Version >= 9 to
+	allow automatic parsing of 0x[hex] and 0[octal] numbers in format files.
+
+	* src/getdata.h.in: Increment GD_DIRFILE_STANDARDS_VERSION.
+	* src/flush.c (_GD_FindVersion): Update for Version 9.
+
+2011-12-05   D. V. Wiebe <getdata at ketiltrout.net> svn:630
+	* python/test/callback.pl python/test/big_test.py cxx/test/big_test.cpp
+	f77/test/big_test.f f77/test/big_test95.f90: Fix path checks.
+
+	* f77/test/big_test.f f77/test/big_test95.f90: Use check functions.
+
+	* src/flush.c (_GD_Flush): Don't call sync on a file opened read-only.
+
+	* configure.ac: Look for Availability.h
+	* src/internal.h: Fix lstat64 on OS X 10.6+
+
+	* src/common.c (_GD_CanonicalPath): Don't run past the end of the work
+	buffer.
+
+2011-12-03   D. V. Wiebe <getdata at ketiltrout.net> svn:629
+	* test/test.h (CHECKEOS): Added.
+	* test/file.c test/fragment_name.c: Only check the end of the returned
+	string since we don't know what the full path is.
+
+	* src/internal.h: Define PATH_MAX, if necessary.
+	* src/common.c (_GD_CanonicalPath): Added.
+	* src/open.c (gd_cbopen): Canonicalise filedir.
+	* src/common.c (_GD_MakeFullPath): Canonicalise path.  Handle dirfd < 0.
+	* src/common.c (_GD_GrabDir): Let _GD_MakeFullPath hande canonicalising
+	absolute paths.
+
+	* configure.ac: Check for lstat(3).
+	* src/compat.c (gd_StatAt): Don't use lstat if the platform doesn't have it.
+
+	* src/internal.h: Move library includes into header.
+
+2011-12-01   D. V. Wiebe <getdata at ketiltrout.net> svn:628
+	* src/flush.c (_GD_FlushFragment): Write "/PROTECT data" when appropriate.
+	Bug report from Alexandra Rahlin.
+
+2011-11-13   D. V. Wiebe <getdata at ketiltrout.net> svn:626
+	* src/entry.c (gd_raw_filename): Revert r613 changes.
+	* src/gzip.c: Move OOP code out of gzip layer.
+	* src/encoding.c (_GD_FiniRawIO _GD_InitRawIO) src/fpos.c (_GD_WriteSeek):
+	Handle OOP writes.
+	* src/encoding.c (_GD_WriteOut): Added.
+	* src/mod.c (_GD_Change) src/putdata.c (_GD_DoRawOut): Call _GD_WriteSeek and
+	_GD_WriteOut
+
+	* src/putdata.c (_GD_DoRawOut): Correctly handle write errors.
+
+	* configure.ac: Fix x86_64 host check.
+
+2011-11-10   D. V. Wiebe <getdata at ketiltrout.net> svn:622
+	* configure.ac: Figure out whether unaligned memory access will work.
+	* src/internal.h: Deal with UNALIGNED_ACCESS_OK
+	* src/sie.c (_GD_SampIndWrite): Handle unaligned memory access.
+
+2011-11-08   D. V. Wiebe <getdata at ketiltrout.net> svn:615
+	* test/add_scalar_carray.c: Added.
+
+	* src/add.c (_GD_Add): Copy scalar_ind when copying scalars.  Patch from
+	S. J. Benton.
+
+2011-11-08   D. V. Wiebe <getdata at ketiltrout.net> svn:614
+	* test/gzip_put_get.c test/gzip_move_to.c test/gzip_add.c
+	test/gzip_get_put.c test/gzip_put.c: Handle TEST_GZIP && !USE_GZIP.
+
+	* src/encoding.c (_GD_FiniRawIO): Don't change error code if already set.
+
+	* src/sie.c (_GD_SampIndSize): Fix descriptor leak.
+
+2011-11-05   D. V. Wiebe <getdata at ketiltrout.net> svn:610
+	* test/gzip_put_get.c test/ascii_add.c test/get_rofs.c test/gzip_move_to.c
+	test/gzip_add.c test/endian_alter_sie.c test/gzip_get_put.c: Added.
+	* test/gzip_put.c: Update.
+
+	* m4/encoding.m4: Add a AC_CHECK_FUNCS call.
+
+	* src/slim.c (_GD_SlimOpen): Update for the (non-existant) slimdopen().
+
+	* src/getdata.h.in: Renamed GD_SEEK_PAD to GD_SEEK_WRITE to better reflect
+	its purpose.
+	* bindings/idl/getdata.c (gdidl_seek): Update keywords for same.
+
+	* src/flush.c (_GD_Flush): Add a third parameter, clo, to distinguish
+	sync from sync-and-close.
+	* src/flush.c (_GD_SyncOrClose): Renamed from gd_flush.
+	* src/flush.c (gd_sync gd_flush): Added.
+
+	* src/internal.h: Added _gd_raw_file.mode.  Replaced encoding_t.ecor with
+	encoding_t.flags;
+	* src/encoding.c: Deleted touch, topen, tmove, tunlink from the encoding
+	framework.  Changed signature of open and seek.
+	* src/encoding.c (_GD_MoveOver): Renamed from _GD_GenericTMove.
+	* src/encoding.c (_GD_FiniRawIO) src/fpos.c (_GD_WriteSeek): Added.
+	* src/gzip.c (_GD_GzipOpen _GD_GzipSeek _GD_GzipClose) src/encoding.c
+	(_GD_InitRawIO): Update for out-of-place writes.
+	* src/endian.c (_GD_ByteSwapFragment) src/name.c (gd_rename) src/flush.c
+	(_GD_Flush) src/encoding.c (_GD_RecodeFragment) src/del.c (gd_delete)
+	src/flimits.c (_GD_ShiftFragment): Use _GD_FiniRawIO to clean up.
+	* src/encoding.c (_GD_GenericTouch) src/ascii.c (_GD_AsciiTOpen
+	_GD_AsciiTUnlink) src/sie.c (_GD_SampIndTOpen _GD_SampIndTUnlink) src/raw.c
+	(_GD_RawTOpen _GD_RawTUnlink): Deleted.
+	* src/move.c (_GD_MogrifyFile) src/mod.c (_GD_Change): Use _GD_FiniRawIO and
+	_GD_InitRawIO.
+	* src/parse.c (_GD_ParseFieldSpec) add.c (_GD_Add): Use _GD_InitRawIO for
+	touch.
+	* src/gzip.c (_GD_GzipOpen) src/ascii.c (_GD_AsciiOpen) src/sie.c
+	(_GD_SampIndDoOpen _GD_SampIndOpen) src/raw.c (_GD_RawOpen): Handle temp file
+	opens.
+	* src/putdata.c (_GD_DoRawOut) src/fpos.c (_GD_Seek): Use _GD_WriteSeek.
+
+	* src/fpos.c (_GD_GetFilePos): Only try to open the file if necessary.
+
+	* src/gzip.c (_GD_GzipWrite _GD_GzipSync): Added.
+
+2011-10-20   D. V. Wiebe <getdata at ketiltrout.net> svn:609
+	* test/get_here_foffs.c test/seek_foffs.c: Added.
+
+	* src/getdata.c (_GD_DoRaw): Update file->pos after calling FillZero.
+	* src/fpos.c (_GD_GetFilePos): Adjust for SPF.
+	* src/fpos.c (_GD_Seek): If seeking before FRAMEOFFSET, set file->pos < 0.
+
+	* bindings/python/pydirfile.c (gdpy_dirfile_seek): Fix type of frame_num,
+	sample_num.
+
+	* bindings/perl/typemap: off64_t is signed.
+
+	* bindings/f77/fgetdata.c (GDCONS GDMCOS GDSTRS GDMSTS GDSTRX GDMSTX):
+	Added.
+	* bindings/f77/getdata.f90.in (fgd_constants_i1 fgd_constants_i2
+	fgd_constants_i4 fgd_constants_i8 fgd_constants_r4 fgd_constants_r8
+	fgd_constants_c8 fgd_constants_c16 fgd_mconstants_i1 fgd_mconstants_i2
+	fgd_mconstants_i4 fgd_mconstants_i8 fgd_mconstants_r4 fgd_mconstants_r8
+	fgd_mconstants_c8 fgd_mconstants_c16 fgd_string_value_max fgd_strings
+	fgd_mstring_value_max fgd_mstrings): Added.
+
+	* bindings/idl/getdata.c (gdidl_getdata gdidl_putdata): Add /HERE.
+
+	* bindings/python/test/big_test.py bindings/cxx/test/big_test.cpp
+	bindings/perl/t/big_test.t bindings/f77/test/big_test.f
+	bindings/f77/test/big_test95.f90 bindings/idl/test/big_test.pro: Added tests
+	183-204.
+
+2011-10-18   D. V. Wiebe <getdata at ketiltrout.net> svn:607
+	* man/gd_seek.3 man/gd_tell.3: Added.
+
+	* src/spf.c (gd_spf): Throw GD_E_DIMENSION on scalar field specified per
+	documentation.
+	* src/fpos.c (gd_tell64 gd_seek64): Ditto.
+
+	* src/putdata.c (_GD_DoFieldOut): Don't return on error from _GD_GetFilePos;
+	a better error will be generated later.
+
+	* bindings/make_parameters.c: Add GD_E_ARGUMENT, GD_SEEK_*, GD_HERE.
+	* bindings/python/pydirfile.c (gdpy_dirfile_seek gdpy_dirfile_tell)
+	bindings/cxx/dirfile.cpp (Dirfile::Seek Dirfile::Tell)
+	bindings/perl/simple_funcs.xsin (seek tell) bindings/f77/fgetdata.c (GDSEEK
+	GDTELL) bindings/f77/getdata.f90.in (fgd_seek fgd_tell)
+	bindings/idl/getdata.c (gdidl_seek gdidl_tell): Added.
+
+2011-10-13   D. V. Wiebe <getdata at ketiltrout.net> svn:606
+	* test/entry_divide.c test/entry_recip.c test/get_here.c test/get_heres.c
+	test/put_here.c test/put_heres.c test/seek64.c test/seek_cur.c test/seek_end.c
+	test/seek_set.c test/tell.c test/tell64.c: Added.
+
+	* test/legacy_put.c test/put_complex128.c test/put_complex64.c
+	test/put_float32.c test/put_float64.c test/put_ff.c test/put_foffs.c
+	test/put_fs.c test/put_int16.c test/put_int32.c test/put_int64.c
+	test/put_int8.c test/put_lincom1.c test/put_linterp.c
+	test/put_linterp_reverse.c test/put_off64.c test/put_phase.c
+	test/put_polynom1.c test/put_recip.c test/put_sf.c test/put_ss.c
+	test/put_uint16.c test/put_uint32.c test/put_uint64.c: Don't perform
+	unnecessary tests in the event the data file wasn't created.
+
+	* src/getdata.h.in: Combine GD_E_BAD_ENDIANNESS and GD_E_BAD_PROTECTION into
+	GD_ARGUMENT.  The former are kept as aliases of the new symbol.
+	* src/endian.c (gd_alter_endianness) src/errors.c src/protect.c
+	(gd_alter_protection): Update for GD_E_ARGUMENT.
+
+	* src/internal.h: Add .pos to _gd_raw_file.  Add .u.index_pos to
+	_gd_private_entry.
+	* src/ascii.c (_GD_AsciiOpen _GD_AsciiSeek _GD_AsciiRead _GD_AsciiTOpen
+	_GD_AsciiTUnlink) src/gzip.c (_GD_GzipOpen _GD_GzipSeek _GD_GzipRead)
+	src/lzma.c (_GD_LzmaOpen _GD_LzmaSeek _GD_LzmaRead) src/sie.c
+	(_GD_SampIndOpen _GD_SampIndSeek _GD_SampIndRead _GD_SampIndWrite
+	_GD_SampIndTOpen) src/raw.c (_GD_RawOpen _GD_RawSeek _GD_RawRead
+	_GD_RawWrite _GD_RawTOpen): Track file position.
+
+	* src/encoding.c (_GD_InitRawIO): Added.
+	* src/getdata.c (_GD_DoRaw) src/putdata.c (_GD_DoRawOut): Call _GD_InitRawIO.
+
+	* src/fpos.c: Added.
+	* src/flimits.c (_GD_GetEOF): Publicise.
+	* src/getdata.c (gd_getdata64) src/putdata.c (gd_putdata64): Regularise use of
+	GD_HERE.  Also, only call _GD_GetSPF when necessary.
+	* src/getdata.c (_GD_DoField) src/putdata.c (_GD_DoFieldOut): Resolve
+	instances of GD_HERE.
+
+	* bindings/python/Makefile.am bindings/cxx/Makefile.am
+	bindings/f77/Makefile.am: Remove some unnecessary linking.
+
+	* bindings/idl/package/Makefile.am: Add $(DEFS) to the make_parameters rule
+	to ensure it builds properly.
+
+2011-08-23   D. V. Wiebe <getdata at ketiltrout.net> svn:600
+	* test/error_error.c: Simplify test.
+	* test/test.h (CHECKSp): Added.
+
+	* src/errors.c src/internal.h: Added GD_E_CREAT_OPEN.
+	* src/open.c (_GD_CreateDirfile): Distinguish GD_E_CREAT_DIR from
+	GD_E_CREAT_OPEN.
+
+	* src/internal.h: When linking to the MSVCRT, define GD_NO_DIR_OPEN to
+	indicate that the MSVCRT's open() prohibits openind directories.  (This is
+	referred to as "the non-POSIX case".
+	* src/open.c (_GD_CreateDirfile): Take dirfile, a malloc'd copy instead of
+	filedir itself.  In the non-POSIX case, this has the full pathname.  Also,
+	handle non-POSIX computation of dirfd.
+	* src/open.c (gd_cbopen): In the non-POSIX case, prepend the CWD to filedir
+	if it's not absolute, and pass that string to _GD_CreateDirfile.  Also need
+	to stat the directory in this case, in lieu of trying to open it.
+	* src/close.c (_GD_ShutdownDirfile): Don't try to close the dirfds in the
+	non-POSIX case.
+	* src/common.c (_GD_DirName): In the non-POSIX case, the dirfd parameter
+	simply contains the index into the dir array, so no need to search.
+	* src/common.c (_GD_GrabDir _GD_ReleaseDir): In the non-POSIX case, don't
+	try to open or close the directory: it just contains the index into dir, so
+	no need to search for it either.
+
+	* src/compat.c (gd_OpenAt): Or flags with O_BINARY for operation on Win32.
+
+	* src/open.c (gd_cbopen): Close dirfd on error.
+
+	* src/bzip.c (_GD_Bzip2Seek): Return -1 on error.
+
+	* src/internal.h (_GD_AbsPath): Added.
+
+	* src/internal.h (gd_swap64): Fix doubled backslashes.
+
+	* configure.ac: Fix perl check to properly exclude the bindings when
+	necessary.
+
+2011-08-20   D. V. Wiebe <getdata at ketiltrout.net> svn:599
+	* src/open.c (gd_cbopen): Properly initialise bname; also check for malloc
+	errors.
+	* sie/sie.c (_GD_SampIndWrite): Update the current record to reflect the
+	updated position of the file pointer.
+
+2011-08-20   D. V. Wiebe <getdata at ketiltrout.net> svn:597
+	* src/internal.h: Added bname to fragment struct holding the basename of the
+	file.
+	* src/open.c (gd_cbopen) src/include.c (_GD_Include): Initialise
+	fragment->bname.
+	* src/close.c (_GD_FreeD) src/include.c (gd_uninclude): Deallocate
+	fragment->bname.
+
+2011-08-19   D. V. Wiebe <getdata at ketiltrout.net> svn:596
+	* src/open.c (gd_invalid_dirfile gd_cbopen): If allocating the DIRFILE
+	itself fails, return NULL instead of segfaulting.
+
+	* src/nmeta.c (gd_nmfields_by_type): Throw GD_E_BAD_ENTRY on encountering
+	GD_NO_ENTRY.
+
+	* src/index.c (gd_framenum_subset64): Throw GD_E_DIMENSION if the caller
+	supplies the field code for a scalar.
+
+	* src/errors.c: Added GD_E_BOUNDS and GD_E_LINE_TOO_LONG.
+
+	* src/encoding.c (_GD_ResolveEncoding): Don't segfault on malloc error.
+
+	* src/flimits.c (_GD_GetBOF): Throw GD_INTERNAL_ERROR instead of
+	GD_E_BAD_FIELD_TYPE when encountering GD_NO_ENTRY.
+
+	* src/parse.c (_GD_UTF8Encode): Renamed from utf8encode for consistency.
+
+	* src/sie.c (_GD_SampIndTUnlink) src/include.c (gd_uninclude): Use
+	gd_UnlinkAt instead of bare unlink().
+
+	* man/make_html.pl: Handle multiparagraph .TPs.
+
+2011-08-11   D. V. Wiebe <getdata at ketiltrout.net> svn:595
+	* src/internal.h: In cases where no explicitly 64-bit stat struct can be
+	found, don't bother trying to use explicitly 64-bit stat functions.
+
+2011-08-11   D. V. Wiebe <getdata at ketiltrout.net> svn:594
+	* test/sie_nframes_big.c test/sie_get_big.c test/sie_get_little.c
+	test/sie_nframes_little.c test/sie_move_to.c test/sie_put_little.c
+	test/sie_move_from.c test/sie_put_big.c: Added.
+
+	* configure.ac src/internal.h: Handle missing fstat64, ftruncate64, and byte
+	swapping routines.
+
+	* src/internal.h src/errors.c: Differentiate GD_E_UNKNOWN_ENCODING errors
+	arising from existing, unknown encodings on disk from errors arising from
+	attempts to convert to an unknown encoding.
+
+	* src/endian.c (_GD_FixEndianness): Use standard system byte-swapping
+	routines, where possible, with the assumption that they're not slower than
+	our old implementation.
+
+	* src/encoding.c: Redo the way _gd_ef is initialised to try and make it
+	a little easier to maintain.
+
+	* src/internal.h: In struct _gd_raw_file, rename .fp to .idata and .encoding
+	to .subenc to reduce code obfuscation.
+
+	* src/encoding.c: Added SIE encoding hooks.
+	* src/sie.c: Added.
+
+	* src/internal.h (_GD_FileSwapBytes): Added.
+	* src/internal.h: _gd_ef->open(), ->size(), ->touch(), and ->topen() now take
+	a "swap" parameter, indicating whether bytes are opposite-endian.
+
+	* src/internal.h: Split _gd_ef->temp() into ->topen, ->tmove, and ->tunlink.
+	Also typedef all the framework method prototypes.
+	* src/ascii.c (_GD_AsciiTOpen _GD_AsciiTUnlink) src/raw.c (_GD_RawTOpen
+	_GD_RawTUnlink): Added.
+	* src/ascii.c (_GD_AsciiTemp) src/raw.c (_GD_RawTemp): Deleted.
+	* src/encoding.c (_GD_GenericTMove): Added.
+	* src/endian.c (_GD_ByteSwapFragment) src/encoding.c (_GD_MissingFramework
+	_GD_RecodeFragment) src/move.c (_GD_MogrifyFile) src/flimits.c
+	(_GD_ShiftFragment) src/mod.c (_GD_Change): Replace _gd_ef->temp() calls with
+	t{open|move|unlink} calls.
+
+	* src/move.c (_GD_MogrifyFile) src/mod.c (_GD_Change): Call _GD_MakeTempFile
+	before calling _gd_ef->topen.
+
+2011-08-10   D. V. Wiebe <getdata at ketiltrout.net> svn:593
+	* bindings/perl/t/big_test.t: Convert to TAP.
+
+2011-06-13   D. V. Wiebe <getdata at ketiltrout.net> svn:588
+	* src/errors.c: Don't append strerror to the GD_E_CREAT_EXCL message.
+
+	* m4/perl.m4: Fix perl CFLAGS.
+
+2011-05-05   D. V. Wiebe <getdata at ketiltrout.net> svn:587
+	* src/open.c (_GD_CreateDirfile): Handle missing fdopendir.
+
+2011-05-05   D. V. Wiebe <getdata at ketiltrout.net> svn:586
+	* src/internal.h: The encoding framework has changed: open, touch, size,
+	move, unlink, and temp now all take the dirfd.  Furthermore, to allow
+	operation on non-POSIX.1-2008 systems, we hide the DIRFILE pointer in
+	_gd_raw_file, so callback can be made to the compatibility layer.  All
+	framework callers have been updated to pass dirfds.  fragment->sname is no
+	longer malloc'd and is now marked const; also, fragments now carry their
+	dirfd.  D->dir and D->ndir added.
+	* src/encoding.c (gd_MakeTempFile) src/compat.c (gd_OpenAt gd_RenameAt
+	gd_StatAt gd_StatAt64 gd_UnlinkAt) src/common.c (_GD_DirName
+	_GD_MakeFullPath _GD_GrabDir _GD_ReleaseDir): Added.
+	* src/open.c (gd_cbopen): Open the dirfile directory as soon as possible,
+	then work as much as possible with the descriptor instead of the path
+	itself.
+	* src/open.c (_GD_CreateDirfile): Use the dirfd produced by cb_open()
+	instead of relying on the pathname except with GD_CREAT.  As a side effect,
+	no longer need to compute fullname when truncating.
+	* src/entry.c (_GD_FreeE): Release LUT directory.  This requires passing the
+	DIRFILE to this function.
+	* src/close.c (_GD_FreeD): Don't free fragment->sname (it's no longer
+	malloc'd).  Free D->dir.
+	* src/close.c (_GD_ShutdownDirfile): Close all open directories.
+	* src/flush.c (_GD_FlushFragment): Call gd_MakeTempFile instead of mkstemp.
+	* src/encoding.c (_GD_SetEncodedName): set file->D to the DIRFILE pointer,
+	so the encoding framework has access to it.
+	* src/encoding.c (_GD_ResolveEncoding): Take dirfd for I/O purposes.
+	* src/move.c (_GD_MogrifyFile): Consider changes in dirfd.
+	* src/parse.c (_GD_ParseRaw): E->e->u.raw.filebase is a copy of E->field
+	now, (and could be removed, except we'll need it shortly).  The fragment
+	index (me) is no longer needed in this function.
+	* src/mod.c (_GD_Change): Release the LUT directory if it changes.
+	* src/include.c (_GD_Include): Open the grab the included fragment's
+	directory and store it in fragment->dirfd.  fragment->sname is now just the
+	value returned by _GD_DirName, and not malloc'd.
+	* src/include.c (gd_uninclude): Release the directory.
+	* src/compat.c (mkstemp _GD_Rename): Removed.
+	* src/common.c (_GD_SetTablePath): Open the directory.  table_path is
+	replaced with table_file.
+
+	* src/encoding.c (_GD_GenericTouch _GD_GenericUnlink _GD_GenericMove)
+	src/slim.c (_GD_SlimOpen _GD_SlimSize) src/gzip.c (_GD_GzipOpen _GD_GzipSize)
+	src/ascii.c (_GD_AsciiOpen _GD_AsciiSize _GD_AsciiTemp) src/lzma.c
+	(_GD_LzmaOpen _GD_LzmaSize) src/bzip.c (_GD_Bzip2Open _GD_Bzip2Size): Update
+	for changes in the encoding framework.
+
+	* src/slim.c (_GD_SlimOpen _GD_SlimSize): Slimlib doesn't accept file
+	descriptors, so compute the full path before calling it.  This has the
+	potential for breakage.
+	* src/gzip.c (_GD_GzipOpen _GD_GzipSize): Use gzdopen instead of gzopen.
+	* src/lzma.c (_GD_LzmaDoOpen) src/bzip.c (_GD_Bzip2DoOpen): Use dirfd to
+	create stream.
+
+	* src/legacy.c (_GD_GetDirfile) src/name.c (gd_rename) src/encoding.c
+	(_GD_MissingFramework _GD_ResolveEncoding) src/move.c (gd_move)
+	src/include.c (_GD_Include) src/add.c (_GD_Add): Remove the FILENAME_MAX
+	crutch.
+
+	* src/add.c (_GD_Add): Fix memory leak of new_ref.
+
+	* src/entry.c (gd_raw_filename): Return a malloc'd string.
+
+	* configure.ac: Fix am__fastdepCXX_* for --disable-cplusplus.  This is
+	presumably a autotools bug.  Look for ...at() functions.
+
+2011-04-21   D. V. Wiebe <getdata at ketiltrout.net> svn:581
+	* bindings/python/pydirfile.c (gdpy_dirfile_geterrorcount): Added.
+	* bindings/cxx/dirfile.cpp (Dirfile::ErrorCount): Added.
+	* bindings/f77/fgetdata.c (GDECNT): Added.
+	* bindings/f77/fgetdata.f90.in (fgd_error_count): Added.
+	* bindings/idl/getdata.c (gdidl_error_count): Added.
+
+	* bindings/perl/GetData.xs (gdp_to_entry): Fix initialisation of n for
+	LINCOM and POLYNOM.
+
+	* bindings/perl/GetData.pm.in: add constants and functions export tags.
+
+	* bindings/make_parameters.c (Perl): Don't insert unnecessary newlines.
+	* bindings/perl/Makefile.am: Use perl to generate funclist.sed.
+
+2011-04-20   D. V. Wiebe <getdata at ketiltrout.net> svn:580
+	* test/error_num.c: Added.
+	* src/errors.c (gd_error_count): Added.
+	* man/gd_error_count.3: Added.
+
+2011-04-06   D. V. Wiebe <getdata at ketiltrout.net> svn:574
+	* test/: Remove the unnecessarily baroque (rococo?) __TEST__ macro.
+	Add rmdirfile() to the top of each test before creating the test
+	dirfile.  Shift definitions to the top of the files for C89 compliance.
+	A few other minor fixes.
+	* cmake/test/CMakeLists.txt: Remove __TEST__ (and __TEST_SLASH__?);
+	no longer needed.
+
+	* src/mod.c (gd_alter_crecip89): Accept cdividend=NULL for cdividend=(0,0)
+
+2011-04-05   D. V. Wiebe <getdata at ketiltrout.net> svn:573
+	Merge in updates from 0.7 branch, r512 and subsequent:
 
-2011-04-03   D. V. Wiebe <getdata at ketiltrout.net>  svn:564
 	* test/alter_crecip_zero.c test/alter_recip_zero.c: Added.
 	* src/mod.c (_GD_Change): If [c]dividend is zero, don't change it, per
 	documentation.
 
-2011-03-30   D. V. Wiebe <getdata at ketiltrout.net>  svn:563
 	* src/encoding.c (_GD_MissingFramework): Properly compute the module path.
 
-2011-03-29   D. V. Wiebe <getdata at ketiltrout.net>  svn:562
 	* src/flush.c (_GD_FieldSpec): For Standards Version >= 8, use new-style
 	metafield syntax.
 
 	* src/entry.c (gd_raw_filename): Clear dirfile error on entry.
 
-2011-03-24   D. V. Wiebe <getdata at ketiltrout.net>  svn:558
-	GetData-0.7.2 released.
-
-2011-03-24   D. V. Wiebe <getdata at ketiltrout.net>  svn:555
-	
 	* test/move_data_enc_ar.c test/entry_phase.c test/get_ss.c
 	test/alter_raw_type.c: Actually fail on error.
 
-2011-03-23   D. V. Wiebe <getdata at ketiltrout.net>  svn:551
-	GetData-0.7.2rc3:
-
 	* m4/version.m4 configure.ac: Fix library soversion defines.
 
-2011-03-23   D. V. Wiebe <getdata at ketiltrout.net>   svn:550
-	* test/test.h: Write paths properly under WIN32/WIN64.
-
-2011-03-23   D. V. Wiebe <getdata at ketiltrout.net>   svn:549
 	* m4/python.m4: Use the BSD `jot' if the Linux/Plan 9 `seq' is not found.
-		Also, look for python2.7.
-
-2011-03-23   D. V. Wiebe <getdata at ketiltrout.net>  svn:546
-	* src/include.c (_GD_Include): Handle WIN32 paths.
+		Also, look for python2.7.  Added --with-python-module-dir.
 
-2011-03-23   D. V. Wiebe <getdata at ketiltrout.net>  svn:545
 	* src/add.c (_GD_Add): strdup ref_name when propagating upwards to prevent
 	double-free when _GD_FreeD() is called.
 	* test/add_raw_include.c: Added.
@@ -49,20 +1753,8 @@
 	* src/include.c (gd_include): If GD_CREAT is specified, but no encoding,
 	inherit encoding from parent.
 
-2011-03-22   Peter Kümmel <syntheticpp at gmx.net> svn:535-541
-	* backport MSVC support
-	* finish strtoll/strtoull replacement with gd_* functions
-	* update CMake instructions
-	* add CMake module which could be used by other CMake based projects
-
-2011-03-22   D. V. Wiebe <getdata at ketiltrout.net>   svn:532
-	GetData-0.7.2rc2.
-
-2011-03-18   D. V. Wiebe <getdata at ketiltrout.net>   svn:529
-	* m4/python.m4: Added --with-python-module-dir
-
-2011-03-18   D. V. Wiebe <getdata at ketiltrout.net>   svn:527
-	* test/test.h: Explicitly use long long format types in the checks.
+	* test/test.h: Explicitly use long long format types in the checks.  Write
+	paths properly under WIN32/WIN64.
 
 	* src/legacy.c (GetFormat): Fix memset call.
 
@@ -78,16 +1770,6 @@
 
 	* bindings/idl/Makefile.am: Don't needlessly rebuild sublist.c.
 
-	* m4/encoding.m4: $1 is going to get overwritten, so save it early.  Also,
-	don't define $5 and $6 to the same name.
-
-2011-03-17   Peter Kümmel <syntheticpp at gmx.net> 
-	* use _stat64 and struct _stat64 with msvc
-	* fix tests by removing the content of dirfile
-	* guard definitions of macros in C++ binding
-	* build tests with C89 API 
-
-2011-03-17   D. V. Wiebe <getdata at ketiltrout.net>   svn:517
 	* src/getdata.h.in: Replace #undefs with @DEFINE_...@ tokens.   Define
 	gd_off64_t instead of polluting the namespace.  Remove MSCRT specal casing
 	for the gd_*int*_t types.
@@ -104,22 +1786,15 @@
 	* test/parse_include_absrel.c test/parse_include_relabs.c
 	test/parse_include_absolute.c: Free cwd.
 
-2011-03-16   D. V. Wiebe <getdata at ketiltrout.net>   svn:516
 	* configure.ac: check for "slimdata" in addition to "slim", which is what
 	the binary is called under Fedora.
 	* m4/encoding.m4 (GD_CHECK_ENCODING): Handle multiple binary names in $5 and
 	$6.
 
-2011-03-16   D. V. Wiebe <getdata at ketiltrout.net>   svn:515
-	GetData-0.7.2rc1:
-
 	* src/parse.c (_GD_ParseFieldSpec): Fix GD_E_FORMAT_DUPLICATE error data.
 
-	Merged in changes from trunk, revision 514:
-
 	* src/internal.h: Define S_ISREG and S_ISDIR if missing.
 
-2011-03-14   D. V. Wiebe <getdata at ketiltrout.net>   svn:513
 	* test/parse_include_absolute.c test/parse_include_absrel.c
 	test/parse_include_relabs.c test/parse_include_relrel.c: Added.
 
@@ -128,6 +1803,24 @@
 	* src/add.c (_GD_Add) src/parse.c (_GD_ParseRaw) src/move.c (gd_move): Fix
 		computation of filebase for new sname.
 
+2011-03-25   D. V. Wiebe <getdata at ketiltrout.net> svn:566
+	* src/perl.m4: Added.
+	* configure.ac: Perl tests.
+	* bindings/make_parameters.c (Perl): Added.
+	* Bindings/perl: Added.
+
+2011-03-25   D. V. Wiebe <getdata at ketiltrout.net> svn:561
+	* util/checkdirfile.c: Zero-terminate option list.  Patch from Matthew
+	Truch.
+
+2011-03-22   Peter Kümmel <syntheticpp at gmx.net> svn:538
+	* merge from 0.7 branch strtoll/strtoull replacement with gd_* functions 
+
+2011-03-17   Peter Kümmel <syntheticpp at gmx.net>
+	* use _stat64 and struct _stat64 with msvc
+	* fix tests by removing the content of dirfile
+	* guard definitions of macros in C++ binding
+	* build tests with C89 API
 
 2011-03-03   D. V. Wiebe <getdata at ketiltrout.net>   svn:510
 	* m4/idl.m4: Munge IDL_LIBS to convert "-m <arg>" into "-m<arg>" since
@@ -3321,7 +5014,7 @@
 	* src/common.c (_GD_GetEntry): Removed FILEFRAM as an alias for INDEX per
 	discussion with Barth.
 
-2008-10-10   D. V. Wiebe <getdata at ketiltrout.net>  svn:129
+2008-10-10   D. V. Wiebe <getdata at ketiltrout.net>  svn:128 svn:129
 	* src/entry.c (_GD_FreeE): Renamed from dirfile_free_entry_strings (for
 	which a new boilerplate function has been created).  Separated cleaning up
 	internal and externally created entries.  Internally, the library now
@@ -3346,7 +5039,7 @@
 	encoding specific *touch() function.
 	* src/raw.c (_GD_RawTouch): Added.  (Also used for the ASCII encoding).
 
-	* src/meta_list.c: Fixed all functions to get them working.
+	* src/meta_list.c: Added (META version of field_list.c)
 	* src/field_list.c: Call _GD_ClearError in all public functions.
 	* src/nmeta.c: Added (META version of nfields.c)
 
diff --git a/Makefile.am b/Makefile.am
index 7dcdf38..6e1f97c 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -32,15 +32,51 @@ clean-local:
 	rm -rf *~  m4/*~ README.txt
 
 %.sig: %
-	gpg -abo $@ $<
+	gpg --use-agent -abo $@ $<
 
 DISTCHECK_CONFIGURE_FLAGS = --with-idl-dlm-dir="$$dc_install_base/idl" \
+														--with-perl-dir="$$dc_install_base/perl" \
 														--with-python-module-dir="$$dc_install_base/python"
 
+# matlab-only package
+matlabdist: $(DISTFILES)
+	rm -rf svn_export
+	svn export $(top_srcdir) svn_export
+	( cd svn_export && \
+		mkdir matlab_getdata && \
+		mkdir matlab_getdata/m4 && \
+		mkdir matlab_getdata/src && \
+		cp bindings/matlab/package/* matlab_getdata && \
+		cp -r bindings/matlab/Makefile.am bindings/matlab/gd_*.[cm] \
+		bindings/matlab/matlab.c bindings/matlab/gd_matlab.h bindings/matlab/test \
+		bindings/matlab/doc.tail bindings/matlab/Contents.m.head \
+		bindings/matlab/make_contents.sh.in \
+		matlab_getdata/src && \
+		cp -r bindings/make_parameters.c matlab_getdata && \
+		cp -r m4/matlab.m4 m4/compiler.m4 m4/version.m4 matlab_getdata/m4 && \
+		cp -r doc/README.matlab COPYING AUTHORS ChangeLog INSTALL NEWS \
+		matlab_getdata && \
+		( cd matlab_getdata && \
+		aclocal -I m4 && \
+		libtoolize && \
+		autoconf && \
+		autoheader && \
+		automake --add-missing --force-missing && \
+		./configure && \
+		make dist && \
+		cp matlab_${distdir}* ../.. \
+		) )
+	rm -rf svn_export
+
+matlabdistcheck: matlab_$(distdir).tar.gz
+	tar -zxvf $<
+	cd matlab_$(distdir) && ./configure && make dist && make distcheck
+	rm -rf matlab_$(distdir)
+
 # idl-only package
 idldist: $(DISTFILES)
 	rm -rf svn_export
-	svn export . svn_export
+	svn export $(top_srcdir) svn_export
 	( cd svn_export && \
 		mkdir idl_getdata && \
 		mkdir idl_getdata/m4 && \
@@ -73,7 +109,7 @@ idldistcheck: idl_$(distdir).tar.gz
 windist: $(DISTFILES)
 	rm -rf crlf_export
 	cd man && $(MAKE) htmlman
-	svn --native-eol CRLF export . crlf_export
+	svn --native-eol CRLF export $(top_srcdir) crlf_export
 	( cd crlf_export && \
 		mkdir $(distdir) && \
 		mkdir $(distdir)/bindings && \
@@ -81,7 +117,7 @@ windist: $(DISTFILES)
 		mkdir $(distdir)/man && \
 		cp ../man/*[35].html $(distdir)/man && \
 		cp -r bindings/cxx $(distdir)/bindings && \
-		cp -r cmake src test $(distdir) && \
+		cp -r cmake util src test $(distdir) && \
 		$(SED) cmake/CMakeLists.txt \
 		-e 's/-DPACKAGE_VERSION=\\".*\\"/-DPACKAGE_VERSION=\\"$(PACKAGE_VERSION)\\"/' \
 		> $(distdir)/cmake/CMakeLists.txt && \
@@ -96,7 +132,8 @@ windist: $(DISTFILES)
 
 # package lists
 PACKAGES=$(distdir).tar.gz $(distdir).tar.bz2 idl_$(distdir).tar.gz \
-				 idl_$(distdir).tar.bz2 getdata_win-$(PACKAGE_VERSION).zip
+				 idl_$(distdir).tar.bz2 getdata_win-$(PACKAGE_VERSION).zip \
+				 matlab_$(distdir).tar.gz matlab_$(distdir).tar.bz2
 SIGS=$(addsuffix .sig,$(PACKAGES))
 
 # release stuff
@@ -107,4 +144,5 @@ README.txt: NEWS RELEASE_NOTES.in
 dist-post: $(SIGS)
 
 dist-push: $(PACKAGES) $(SIGS) README.txt
+	@if [ -z "${SFUSER}" ]; then echo "ERROR: SFUSER unset"; false; fi
 	rsync -avP -e ssh $^ $(SFUSER),getdata at frs.sourceforge.net:/home/frs/project/g/ge/getdata/getdata/$(PACKAGE_VERSION)/
diff --git a/Makefile.in b/Makefile.in
index ade5e4f..e880c3f 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -1,9 +1,9 @@
-# Makefile.in generated by automake 1.11.1 from Makefile.am.
+# Makefile.in generated by automake 1.11.5 from Makefile.am.
 # @configure_input@
 
 # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005, 2006, 2007, 2008, 2009  Free Software Foundation,
-# Inc.
+# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software
+# Foundation, Inc.
 # This Makefile.in is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
@@ -16,6 +16,23 @@
 @SET_MAKE@
 
 VPATH = @srcdir@
+am__make_dryrun = \
+  { \
+    am__dry=no; \
+    case $$MAKEFLAGS in \
+      *\\[\ \	]*) \
+        echo 'am--echo: ; @echo "AM"  OK' | $(MAKE) -f - 2>/dev/null \
+          | grep '^AM OK$$' >/dev/null || am__dry=yes;; \
+      *) \
+        for am__flg in $$MAKEFLAGS; do \
+          case $$am__flg in \
+            *=*|--*) ;; \
+            *n*) am__dry=yes; break;; \
+          esac; \
+        done;; \
+    esac; \
+    test $$am__dry = yes; \
+  }
 pkgdatadir = $(datadir)/@PACKAGE@
 pkgincludedir = $(includedir)/@PACKAGE@
 pkglibdir = $(libdir)/@PACKAGE@
@@ -43,17 +60,19 @@ DIST_COMMON = README $(am__configure_deps) $(dist_doc_DATA) \
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
 am__aclocal_m4_deps = $(top_srcdir)/m4/ax_compare_version.m4 \
 	$(top_srcdir)/m4/compiler.m4 $(top_srcdir)/m4/encoding.m4 \
-	$(top_srcdir)/m4/idl.m4 $(top_srcdir)/m4/libtool.m4 \
-	$(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \
-	$(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \
-	$(top_srcdir)/m4/python.m4 $(top_srcdir)/m4/win32.m4 \
-	$(top_srcdir)/m4/version.m4 $(top_srcdir)/configure.ac
+	$(top_srcdir)/m4/floatordering.m4 $(top_srcdir)/m4/idl.m4 \
+	$(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \
+	$(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \
+	$(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/m4/matlab.m4 \
+	$(top_srcdir)/m4/perl.m4 $(top_srcdir)/m4/python.m4 \
+	$(top_srcdir)/m4/win32.m4 $(top_srcdir)/m4/version.m4 \
+	$(top_srcdir)/configure.ac
 am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
 	$(ACLOCAL_M4)
 am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \
  configure.lineno config.status.lineno
 mkinstalldirs = $(install_sh) -d
-CONFIG_HEADER = $(top_builddir)/src/config.h \
+CONFIG_HEADER = $(top_builddir)/src/gd_config.h \
 	$(top_builddir)/src/getdata.h
 CONFIG_CLEAN_FILES =
 CONFIG_CLEAN_VPATH_FILES =
@@ -66,6 +85,11 @@ RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \
 	install-pdf-recursive install-ps-recursive install-recursive \
 	installcheck-recursive installdirs-recursive pdf-recursive \
 	ps-recursive uninstall-recursive
+am__can_run_installinfo = \
+  case $$AM_UPDATE_INFO_DIR in \
+    n|no|NO) false;; \
+    *) (install-info --version) >/dev/null 2>&1;; \
+  esac
 am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
 am__vpath_adj = case $$p in \
     $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
@@ -87,6 +111,12 @@ am__nobase_list = $(am__nobase_strip_setup); \
 am__base_list = \
   sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \
   sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
+am__uninstall_files_from_dir = { \
+  test -z "$$files" \
+    || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \
+    || { echo " ( cd '$$dir' && rm -f" $$files ")"; \
+         $(am__cd) "$$dir" && rm -f $$files; }; \
+  }
 am__installdirs = "$(DESTDIR)$(docdir)"
 DATA = $(dist_doc_DATA)
 RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive	\
@@ -101,9 +131,11 @@ DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
 distdir = $(PACKAGE)-$(VERSION)
 top_distdir = $(distdir)
 am__remove_distdir = \
-  { test ! -d "$(distdir)" \
-    || { find "$(distdir)" -type d ! -perm -200 -exec chmod u+w {} ';' \
-         && rm -fr "$(distdir)"; }; }
+  if test -d "$(distdir)"; then \
+    find "$(distdir)" -type d ! -perm -200 -exec chmod u+w {} ';' \
+      && rm -rf "$(distdir)" \
+      || { sleep 5 && rm -rf "$(distdir)"; }; \
+  else :; fi
 am__relativize = \
   dir0=`pwd`; \
   sed_first='s,^\([^/]*\)/.*$$,\1,'; \
@@ -132,6 +164,8 @@ am__relativize = \
 DIST_ARCHIVES = $(distdir).tar.gz $(distdir).tar.bz2
 GZIP_ENV = --best
 distuninstallcheck_listfiles = find . -type f -print
+am__distuninstallcheck_listfiles = $(distuninstallcheck_listfiles) \
+  | sed 's|^\./|$(prefix)/|' | grep -v '$(infodir)/dir$$'
 distcleancheck_listfiles = find . -type f -print
 ACLOCAL = @ACLOCAL@
 AMTAR = @AMTAR@
@@ -141,10 +175,13 @@ AUTOHEADER = @AUTOHEADER@
 AUTOMAKE = @AUTOMAKE@
 AWK = @AWK@
 BUILDCC = @BUILDCC@
-BUILD_DATE = @BUILD_DATE@
 BZIP2_CPPFLAGS = @BZIP2_CPPFLAGS@
 BZIP2_LDFLAGS = @BZIP2_LDFLAGS@
+BZIP2_LIBS = @BZIP2_LIBS@
 CC = @CC@
+CCAS = @CCAS@
+CCASDEPMODE = @CCASDEPMODE@
+CCASFLAGS = @CCASFLAGS@
 CCDEPMODE = @CCDEPMODE@
 CFLAGS = @CFLAGS@
 CPP = @CPP@
@@ -160,6 +197,7 @@ DEFINE_GD_NO_C99_API = @DEFINE_GD_NO_C99_API@
 DEFINE_gd_int16_t = @DEFINE_gd_int16_t@
 DEFINE_gd_int64_t = @DEFINE_gd_int64_t@
 DEFINE_gd_uint16_t = @DEFINE_gd_uint16_t@
+DEFINE_gd_uint64_t = @DEFINE_gd_uint64_t@
 DEFS = @DEFS@
 DEPDIR = @DEPDIR@
 DIFF = @DIFF@
@@ -180,13 +218,21 @@ FFLAGS = @FFLAGS@
 FGETDATA_VERSION = @FGETDATA_VERSION@
 FGREP = @FGREP@
 FLIBS = @FLIBS@
+GD_DIRSEP = @GD_DIRSEP@
+GD_FDIRSEP = @GD_FDIRSEP@
 GETDATAXX_VERSION = @GETDATAXX_VERSION@
+GETDATA_DEBUG = @GETDATA_DEBUG@
 GETDATA_IFACE_AGE = @GETDATA_IFACE_AGE@
 GETDATA_IFACE_VERSION = @GETDATA_IFACE_VERSION@
 GETDATA_IMPL_REVISION = @GETDATA_IMPL_REVISION@
+GETDATA_MAJOR = @GETDATA_MAJOR@
+GETDATA_MINOR = @GETDATA_MINOR@
+GETDATA_REVISION = @GETDATA_REVISION@
+GETDATA_VERSION_SUFFIX = @GETDATA_VERSION_SUFFIX@
 GREP = @GREP@
 GZIP_CPPFLAGS = @GZIP_CPPFLAGS@
 GZIP_LDFLAGS = @GZIP_LDFLAGS@
+GZIP_LIBS = @GZIP_LIBS@
 IDL = @IDL@
 IDL_CFLAGS = @IDL_CFLAGS@
 IDL_LIBS = @IDL_LIBS@
@@ -209,8 +255,13 @@ LTDLINCL = @LTDLINCL@
 LTLIBOBJS = @LTLIBOBJS@
 LZMA_CPPFLAGS = @LZMA_CPPFLAGS@
 LZMA_LDFLAGS = @LZMA_LDFLAGS@
+LZMA_LIBS = @LZMA_LIBS@
 MAKEINFO = @MAKEINFO@
 MANIFEST_TOOL = @MANIFEST_TOOL@
+MATLAB = @MATLAB@
+MATLABGETDATA_VERSION = @MATLABGETDATA_VERSION@
+MATLAB_CPPFLAGS = @MATLAB_CPPFLAGS@
+MEX = @MEX@
 MKDIR_P = @MKDIR_P@
 NM = @NM@
 NMEDIT = @NMEDIT@
@@ -227,6 +278,9 @@ PACKAGE_TARNAME = @PACKAGE_TARNAME@
 PACKAGE_URL = @PACKAGE_URL@
 PACKAGE_VERSION = @PACKAGE_VERSION@
 PATH_SEPARATOR = @PATH_SEPARATOR@
+PERL = @PERL@
+PERL_MAN3EXT = @PERL_MAN3EXT@
+PRINTF = @PRINTF@
 PRIVATE_LIBS = @PRIVATE_LIBS@
 PYTHON = @PYTHON@
 PYTHON_CPPFLAGS = @PYTHON_CPPFLAGS@
@@ -238,8 +292,12 @@ SET_MAKE = @SET_MAKE@
 SHELL = @SHELL@
 SLIM_CPPFLAGS = @SLIM_CPPFLAGS@
 SLIM_LDFLAGS = @SLIM_LDFLAGS@
+SLIM_LIBS = @SLIM_LIBS@
 STRIP = @STRIP@
 VERSION = @VERSION@
+ZZIP_CPPFLAGS = @ZZIP_CPPFLAGS@
+ZZIP_LDFLAGS = @ZZIP_LDFLAGS@
+ZZIP_LIBS = @ZZIP_LIBS@
 abs_builddir = @abs_builddir@
 abs_srcdir = @abs_srcdir@
 abs_top_builddir = @abs_top_builddir@
@@ -283,6 +341,8 @@ libexecdir = @libexecdir@
 localedir = @localedir@
 localstatedir = @localstatedir@
 mandir = @mandir@
+matlabbasedir = @matlabbasedir@
+mexext = @mexext@
 mkdir_p = @mkdir_p@
 moduledir = @moduledir@
 oldincludedir = @oldincludedir@
@@ -292,8 +352,12 @@ path_gunzip = @path_gunzip@
 path_gzip = @path_gzip@
 path_slim = @path_slim@
 path_unslim = @path_unslim@
+path_unzip = @path_unzip@
 path_xz = @path_xz@
+path_zip = @path_zip@
 pdfdir = @pdfdir@
+perldir = @perldir@
+perlmandir = @perlmandir@
 prefix = @prefix@
 program_transform_name = @program_transform_name@
 psdir = @psdir@
@@ -333,18 +397,20 @@ ACLOCAL_AMFLAGS = -I m4
 SUBDIRS = src . test bindings util man doc
 dist_doc_DATA = COPYING.DOC
 DISTCHECK_CONFIGURE_FLAGS = --with-idl-dlm-dir="$$dc_install_base/idl" \
+														--with-perl-dir="$$dc_install_base/perl" \
 														--with-python-module-dir="$$dc_install_base/python"
 
 
 # package lists
 PACKAGES = $(distdir).tar.gz $(distdir).tar.bz2 idl_$(distdir).tar.gz \
-				 idl_$(distdir).tar.bz2 getdata_win-$(PACKAGE_VERSION).zip
+				 idl_$(distdir).tar.bz2 getdata_win-$(PACKAGE_VERSION).zip \
+				 matlab_$(distdir).tar.gz matlab_$(distdir).tar.bz2
 
 SIGS = $(addsuffix .sig,$(PACKAGES))
 all: all-recursive
 
 .SUFFIXES:
-am--refresh:
+am--refresh: Makefile
 	@:
 $(srcdir)/Makefile.in:  $(srcdir)/Makefile.am  $(am__configure_deps)
 	@for dep in $?; do \
@@ -389,8 +455,11 @@ distclean-libtool:
 	-rm -f libtool config.lt
 install-dist_docDATA: $(dist_doc_DATA)
 	@$(NORMAL_INSTALL)
-	test -z "$(docdir)" || $(MKDIR_P) "$(DESTDIR)$(docdir)"
 	@list='$(dist_doc_DATA)'; test -n "$(docdir)" || list=; \
+	if test -n "$$list"; then \
+	  echo " $(MKDIR_P) '$(DESTDIR)$(docdir)'"; \
+	  $(MKDIR_P) "$(DESTDIR)$(docdir)" || exit 1; \
+	fi; \
 	for p in $$list; do \
 	  if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
 	  echo "$$d$$p"; \
@@ -404,9 +473,7 @@ uninstall-dist_docDATA:
 	@$(NORMAL_UNINSTALL)
 	@list='$(dist_doc_DATA)'; test -n "$(docdir)" || list=; \
 	files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \
-	test -n "$$files" || exit 0; \
-	echo " ( cd '$(DESTDIR)$(docdir)' && rm -f" $$files ")"; \
-	cd "$(DESTDIR)$(docdir)" && rm -f $$files
+	dir='$(DESTDIR)$(docdir)'; $(am__uninstall_files_from_dir)
 
 # This directory's subdirectories are mostly independent; you can cd
 # into them and run `make' without going through this Makefile.
@@ -583,13 +650,10 @@ distdir: $(DISTFILES)
 	done
 	@list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
 	  if test "$$subdir" = .; then :; else \
-	    test -d "$(distdir)/$$subdir" \
-	    || $(MKDIR_P) "$(distdir)/$$subdir" \
-	    || exit 1; \
-	  fi; \
-	done
-	@list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
-	  if test "$$subdir" = .; then :; else \
+	    $(am__make_dryrun) \
+	      || test -d "$(distdir)/$$subdir" \
+	      || $(MKDIR_P) "$(distdir)/$$subdir" \
+	      || exit 1; \
 	    dir1=$$subdir; dir2="$(distdir)/$$subdir"; \
 	    $(am__relativize); \
 	    new_distdir=$$reldir; \
@@ -620,7 +684,11 @@ dist-gzip: distdir
 	tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz
 	$(am__remove_distdir)
 dist-bzip2: distdir
-	tardir=$(distdir) && $(am__tar) | bzip2 -9 -c >$(distdir).tar.bz2
+	tardir=$(distdir) && $(am__tar) | BZIP2=$${BZIP2--9} bzip2 -c >$(distdir).tar.bz2
+	$(am__remove_distdir)
+
+dist-lzip: distdir
+	tardir=$(distdir) && $(am__tar) | lzip -c $${LZIP_OPT--9} >$(distdir).tar.lz
 	$(am__remove_distdir)
 
 dist-lzma: distdir
@@ -628,7 +696,7 @@ dist-lzma: distdir
 	$(am__remove_distdir)
 
 dist-xz: distdir
-	tardir=$(distdir) && $(am__tar) | xz -c >$(distdir).tar.xz
+	tardir=$(distdir) && $(am__tar) | XZ_OPT=$${XZ_OPT--e} xz -c >$(distdir).tar.xz
 	$(am__remove_distdir)
 
 dist-tarZ: distdir
@@ -646,7 +714,7 @@ dist-zip: distdir
 
 dist dist-all: distdir
 	tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz
-	tardir=$(distdir) && $(am__tar) | bzip2 -9 -c >$(distdir).tar.bz2
+	tardir=$(distdir) && $(am__tar) | BZIP2=$${BZIP2--9} bzip2 -c >$(distdir).tar.bz2
 	$(am__remove_distdir)
 
 # This target untars the dist file and tries a VPATH configuration.  Then
@@ -660,6 +728,8 @@ distcheck: dist
 	  bzip2 -dc $(distdir).tar.bz2 | $(am__untar) ;;\
 	*.tar.lzma*) \
 	  lzma -dc $(distdir).tar.lzma | $(am__untar) ;;\
+	*.tar.lz*) \
+	  lzip -dc $(distdir).tar.lz | $(am__untar) ;;\
 	*.tar.xz*) \
 	  xz -dc $(distdir).tar.xz | $(am__untar) ;;\
 	*.tar.Z*) \
@@ -679,6 +749,7 @@ distcheck: dist
 	  && am__cwd=`pwd` \
 	  && $(am__cd) $(distdir)/_build \
 	  && ../configure --srcdir=.. --prefix="$$dc_install_base" \
+	    $(AM_DISTCHECK_CONFIGURE_FLAGS) \
 	    $(DISTCHECK_CONFIGURE_FLAGS) \
 	  && $(MAKE) $(AM_MAKEFLAGS) \
 	  && $(MAKE) $(AM_MAKEFLAGS) dvi \
@@ -707,8 +778,16 @@ distcheck: dist
 	  list='$(DIST_ARCHIVES)'; for i in $$list; do echo $$i; done) | \
 	  sed -e 1h -e 1s/./=/g -e 1p -e 1x -e '$$p' -e '$$x'
 distuninstallcheck:
-	@$(am__cd) '$(distuninstallcheck_dir)' \
-	&& test `$(distuninstallcheck_listfiles) | wc -l` -le 1 \
+	@test -n '$(distuninstallcheck_dir)' || { \
+	  echo 'ERROR: trying to run $@ with an empty' \
+	       '$$(distuninstallcheck_dir)' >&2; \
+	  exit 1; \
+	}; \
+	$(am__cd) '$(distuninstallcheck_dir)' || { \
+	  echo 'ERROR: cannot chdir into $(distuninstallcheck_dir)' >&2; \
+	  exit 1; \
+	}; \
+	test `$(am__distuninstallcheck_listfiles) | wc -l` -eq 0 \
 	   || { echo "ERROR: files left after uninstall:" ; \
 	        if test -n "$(DESTDIR)"; then \
 	          echo "  (check DESTDIR support)"; \
@@ -742,10 +821,15 @@ install-am: all-am
 
 installcheck: installcheck-recursive
 install-strip:
-	$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
-	  install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
-	  `test -z '$(STRIP)' || \
-	    echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+	if test -z '$(STRIP)'; then \
+	  $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+	    install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+	      install; \
+	else \
+	  $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+	    install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+	    "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
+	fi
 mostlyclean-generic:
 
 clean-generic:
@@ -833,8 +917,8 @@ uninstall-am: uninstall-dist_docDATA
 .PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \
 	all all-am am--refresh check check-am clean clean-generic \
 	clean-libtool clean-local ctags ctags-recursive dist dist-all \
-	dist-bzip2 dist-gzip dist-lzma dist-shar dist-tarZ dist-xz \
-	dist-zip distcheck distclean distclean-generic \
+	dist-bzip2 dist-gzip dist-lzip dist-lzma dist-shar dist-tarZ \
+	dist-xz dist-zip distcheck distclean distclean-generic \
 	distclean-libtool distclean-tags distcleancheck distdir \
 	distuninstallcheck dvi dvi-am html html-am info info-am \
 	install install-am install-data install-data-am \
@@ -852,12 +936,47 @@ clean-local:
 	rm -rf *~  m4/*~ README.txt
 
 %.sig: %
-	gpg -abo $@ $<
+	gpg --use-agent -abo $@ $<
+
+# matlab-only package
+matlabdist: $(DISTFILES)
+	rm -rf svn_export
+	svn export $(top_srcdir) svn_export
+	( cd svn_export && \
+		mkdir matlab_getdata && \
+		mkdir matlab_getdata/m4 && \
+		mkdir matlab_getdata/src && \
+		cp bindings/matlab/package/* matlab_getdata && \
+		cp -r bindings/matlab/Makefile.am bindings/matlab/gd_*.[cm] \
+		bindings/matlab/matlab.c bindings/matlab/gd_matlab.h bindings/matlab/test \
+		bindings/matlab/doc.tail bindings/matlab/Contents.m.head \
+		bindings/matlab/make_contents.sh.in \
+		matlab_getdata/src && \
+		cp -r bindings/make_parameters.c matlab_getdata && \
+		cp -r m4/matlab.m4 m4/compiler.m4 m4/version.m4 matlab_getdata/m4 && \
+		cp -r doc/README.matlab COPYING AUTHORS ChangeLog INSTALL NEWS \
+		matlab_getdata && \
+		( cd matlab_getdata && \
+		aclocal -I m4 && \
+		libtoolize && \
+		autoconf && \
+		autoheader && \
+		automake --add-missing --force-missing && \
+		./configure && \
+		make dist && \
+		cp matlab_${distdir}* ../.. \
+		) )
+	rm -rf svn_export
+
+matlabdistcheck: matlab_$(distdir).tar.gz
+	tar -zxvf $<
+	cd matlab_$(distdir) && ./configure && make dist && make distcheck
+	rm -rf matlab_$(distdir)
 
 # idl-only package
 idldist: $(DISTFILES)
 	rm -rf svn_export
-	svn export . svn_export
+	svn export $(top_srcdir) svn_export
 	( cd svn_export && \
 		mkdir idl_getdata && \
 		mkdir idl_getdata/m4 && \
@@ -890,7 +1009,7 @@ idldistcheck: idl_$(distdir).tar.gz
 windist: $(DISTFILES)
 	rm -rf crlf_export
 	cd man && $(MAKE) htmlman
-	svn --native-eol CRLF export . crlf_export
+	svn --native-eol CRLF export $(top_srcdir) crlf_export
 	( cd crlf_export && \
 		mkdir $(distdir) && \
 		mkdir $(distdir)/bindings && \
@@ -898,7 +1017,7 @@ windist: $(DISTFILES)
 		mkdir $(distdir)/man && \
 		cp ../man/*[35].html $(distdir)/man && \
 		cp -r bindings/cxx $(distdir)/bindings && \
-		cp -r cmake src test $(distdir) && \
+		cp -r cmake util src test $(distdir) && \
 		$(SED) cmake/CMakeLists.txt \
 		-e 's/-DPACKAGE_VERSION=\\".*\\"/-DPACKAGE_VERSION=\\"$(PACKAGE_VERSION)\\"/' \
 		> $(distdir)/cmake/CMakeLists.txt && \
@@ -919,6 +1038,7 @@ README.txt: NEWS RELEASE_NOTES.in
 dist-post: $(SIGS)
 
 dist-push: $(PACKAGES) $(SIGS) README.txt
+	@if [ -z "${SFUSER}" ]; then echo "ERROR: SFUSER unset"; false; fi
 	rsync -avP -e ssh $^ $(SFUSER),getdata at frs.sourceforge.net:/home/frs/project/g/ge/getdata/getdata/$(PACKAGE_VERSION)/
 
 # Tell versions [3.59,3.63) of GNU make to not export all variables.
diff --git a/NEWS b/NEWS
index dd1c903..d9a6858 100644
--- a/NEWS
+++ b/NEWS
@@ -1,13 +1,550 @@
+New in verison 0.8.5:
+
+  Library Changes:
+
+  * The zzslim encoding framework, which was inadvertantly rendered
+    non-compilable in 0.8.4, should once again work.  Reported by Matthew
+    Hasselfield.
+
+  Bindings Changes:
+
+  * PYTHON BUG FIX: A spurious debugging message accidentally left in the
+    0.8.4 release has been expunged.
+
+|==============================================================================|
+
+New in version 0.8.4:
+
+  Dirfile Changes:
+
+  * CLARIFICATION: Inconsistant behaviour in the library, coupled with
+    contradictory statements in the Dirfile Standards, has resulted in confusion
+    over the meaning of the final, optional, parameter in a MPLEX definition.
+    To be clear: this parameter is simply the expected period between successive
+    occurances of the "count" value in the index vector.  (It is used by GetData
+    only to figure out a resonable length for the MPLEX lookback.)  The 
+    following clarifications and corrections have been made to the definition
+    of the MPLEX field type in dirfile-format(5):
+
+    - The final, optional parameter has been renamed from "max" to "period".
+
+    - This parameter indicates not the maximal range of the index vector, as 
+      previously stated, but the expected number of samples between successive
+      occurances of the specified "count" value in the index vector; as before,
+      it should be regarded as a hint, and does not place any actual restriction
+      on the contents of the index vector.
+
+    - The incorrect requirement that the "count" parameter be non-negative has
+      been deleted.
+
+    - The incorrect requirement that "count" be less than or equal to "max", if
+      "max" is present and non-zero, has been deleted.
+
+    - The meaning of an omitted or zero "period", indicating that the spacing of
+      "count" in the index vector is unknown or non-uniform, is now explicitly
+      stated.
+
+    - Different MPLEX fields using the same index vector may specify different
+      periods.
+    
+    See also the related library bug fixes below.
+
+  Library Changes:
+
+  * The count_max member of the gd_entry_t object has been renamed period.  The
+    corresponding dummy argument in various function prototypes has been
+    similarly renamed.
+
+  * BUG FIX: The library no longer incorrectly rejects negative count_val MPLEX
+    parameters.  Furthermore, a count_val of -1 in gd_alter_entry or
+    gd_[m]alter_mplex calls is not a special value: it just sets count_val to
+    -1.
+
+  * BUG FIX: The library no longer incorrectly rejects MPLEX fields where
+    count_val is greater than the period (formerly called count_max).
+
+  * BUG FIX: The default MPLEX period, if none is specified, is 2*count_val + 1,
+    not simply 2 * count_val, when count_val is greater than 5.
+
+  * BUG FIX: Trying to position an I/O pointer to before sample zero with
+    gd_seek() now properly fails.  Previously it would allow it, causing bizarre
+    things to happen later.
+
+  * BUG FIX: Using gd_tell to get the I/O pointer position of a derived field
+    with exactly two input fields (MULTIPLY, DIVIDE, MPLEX, WINDOW) now properly
+    reports an error in the "multiposition" case (ie. when the two inputs are
+    ultimately reading from different locations in the same RAW field).
+
+  * BUG FIX: Trying to read sample zero of a gzipped RAW field the second time
+    now works as expected.  Previously, the request to reposition the I/O
+    pointer back to zero would be ignored by the gzip framework.  Reported by
+    Alexandra Rahlin.
+
+  * BUG FIX: The field code of a reference field declared in a subfragment
+    included with affixes is no longer corrupted by spurious application of the
+    affixes when the subfragment's metadata are (re-)written.  Reported by Seth.
+
+  Bindings Changes:
+
+  * C++: The Entry and MplexEntry member functions CountMax and SetCountMax have
+    been renamed to Period and SetPeriod for consistency with the changes listed
+    above.  CountMax and SetCountMax are still avaialbe as aliases, but are
+    marked deprecated.
+
+  * IDL BUG FIX: GD_ENTRY structures representing MPLEX fields are now properly
+    interpreted.  Previously, the underlying gd_entry_t object was being
+    incorrectly initialised.
+
+  * PYTHON BUG FIX: Numpy arrays returned by dirfile.getdata() are now the
+    correct length.  Previously they would always be the length requested (or
+    the length of the dirfile, if no length was explicitly given) even if fewer
+    samples were returned.  Extra elements would contain uninitialised memory.
+
+|==============================================================================|
+
+New in version 0.8.3:
+
+  Library Changes:
+  
+  * BUG FIX: Several bugs on big-ended systems have been fixed.  Reported by
+    Dinar Valeev.
+
+  * BUG FIX: Adding an entry via gd_[m]add() with a negative CARRAY scalar index
+    no longer results in an internal error or worse when the added field is
+    later read.
+
+  * BUG FIX: Changing a CONST field to a real floating point type using
+    gd_alter_const() (or similar) no longer results in the value of the field
+    being corrupted.
+
+  * BUG FIX: A bug in the parser's tokeniser has been fixed to prevent spurious
+    "unterminated token" syntax errors.  Typically this would only be seen when
+    using gd_strtok() to tokenise an (apparently innocuous) user-supplied
+    string, but a carefully crafted format file could also be made to get
+    gd_open() to produce it.
+
+  Bindings Changes:
+
+  * Bindings for MATLAB have been added.
+
+  * The IDL, Perl, and Python bindings no longer require a C99 compiler to be
+    built.
+
+|==============================================================================|
+
+New in version 0.8.2:
+
+  Library Changes:
+  
+  * BUG FIX: A trailing symlink (i.e. situations where a symlink is the last
+    element of a path) no longer confuses GetData when the target of the
+    symlink: (1) is absolute, or (2) starts with "../".  Reported by S. J.
+    Benton.
+
+  * BUG FIX: Trying to read data from the first sample of an MPLEX no longer
+    results in an internal error if the first sample of the index doesn't match
+    the target value.
+
+|==============================================================================|
+
+New in version 0.8.1:
+
+  Library Changes:
+
+  * BUG FIX: A segfault when negotiating symbolic links in file paths, typically
+    manifesting in gd_open calls, has been fixed.
+
+  * BUG FIX: gd_strtok now saves a copy of the string passed to it, as the
+    documentation suggests it should.  Previously it cached the pointer itself.
+
+  * BUG FIX: A number of minor memory leaks, mostly occurring when the library
+    encounters an error, have been fixed.
+
+  * BUG FIX: /HIDDEN directives weren't being written for aliases.
+
+  * BUG FIX: The parser now fails properly on /INCLUDEs which specify paths
+    which don't point to regular files.
+
+  * BUG FIX: Fixed a bug which would result in the parser getting confused over
+    the current Standards Version, potentially leading to rejected valid
+    dirfiles.  Reported by Daniel Flanigan.
+
+  * WIN32 BUG FIX: On Windows, the parser can now properly handle hexadecimal
+    floating point.
+
+  API Changes:
+
+  * How the API deals with field code affixes has changed.  Input vector and
+    scalar fields are reported by gd_entry(), &c. now include their prefix and
+    suffix, if any, which should remove the need to do manual affix bookkeeping
+    when reading metadata.  The other side to this change is that when modifying
+    metdata (gd_add(), gd_alter_entry(), &c.), supplied field codes must also
+    contain the appropriate suffixes.
+
+  * gd_dirfilename() now returns a fully canonicalised version of the dirfile
+    path.
+
+  * A new function, gd_linterp_tablename() has been added which returns a fully
+    canonicalised version of the look-up table pathname for a LINTERP.
+
+  * BUG FIX: gd_alter_entry() and gd_madd_alias() weren't clearing the Dirfile
+    error before operation, resulting in them failing erroneously in certain
+    situations.
+
+  * BUG FIX: When including an existing fragment which itself has subfragments,
+    gd_include() no longer returns the wrong fragment index.
+
+  Bindings Changes:
+
+  * F77 BUG FIX: A memory leak has been fixed in GDALLC.
+
+|==============================================================================|
+
+New in version 0.8.0:
+
+  Dirfile Changes:
+
+  * Dirfile Standards Version 9 has been released.  It adds two new field
+    types: MPLEX, which allows multiplexing multiple low-rate channels in
+    one high-rate one, and WINDOW, which extracts a portion of a field
+    based on the value of a second field.  More changes are listed below.
+
+  * Alternate field names may be defined using the /ALIAS directive.
+    Aliases can't be used as a parent when defining metafields, but are
+    otherwise indistinguishable from a field's original ("canonical") name.
+
+  * The /VERSION directive now has fragment scope, which should alleviate
+    some of the problems associated with "version leakage" found in
+    previous versions.  Previous versions are unchanged, but a "/VERSION 9"
+    directive will not propagate back up into a parent fragment, nor will
+    any /VERSION directive be propagated back up into a Version 9 fragment.
+
+  * Fields may be "hidden" using the /HIDDEN directive.  The Standards
+    don't say what a "hidden" field does, but GetData will, by default,
+    exclude them from the count and list functions.
+
+  * Literal integers in the format may now be specified in octal (using
+    0####) or hexidecimal (using 0x##### or 0X#####) in addition to
+    decimal.  C99-standard hexidecimal floating point literals (0x##.##p##,
+    &c.) are also accepted.
+
+  * The /INCLUDE directive can take two additional, optional parameters
+    which specify a prefix and/or suffix used to modify the entry names of
+    the fields defined in the included fragment.  (The intent of this is to
+    permit the inclusion of multiple subdirfiles which define the same set
+    of fields, by modifying their field names.)
+
+  * Three new encoding schemes are available.  The first is the Sample-
+    Index Encoding (SIE), similar to run-length encoding, useful for
+    compressing data which changes very rarely varying data.  Like the
+    ASCII encoding, GetData implements it internally, so it's always
+    available.  The other two schemes (zzip and zzslim) are based around
+    the ZZip library, an access library for PKWARE ZIP files.  These are
+    unusual in that they store all raw data in the same ZIP archive.
+
+  * The /ENCODING directive takes an optional second token.  The zzip and
+    zzslim encoding schemes optionally use this token to specify the name
+    of the combined ZIP archive.
+
+  * The data type names FLOAT (an alias for FLOAT32) and DOUBLE (an alias
+    for FLOAT64) have been deprecated.
+
+  Library Changes:
+
+  * On POSIX systems, GetData now caches the dirfile directory (and any
+    other necessary subdirectories).  This guards against third-parties
+    renaming the directory while GetData is interested in it.
+
+  * GetData is, in general, more careful about pathname management.  At
+    least on POSIX systems, it will now try to canonicalise all paths it
+    comes across, including resolving symlinks.  As a result, GetData no
+    longer becomes befuddled by a caller who opens a Dirfile with a
+    relative pathname and then calls chdir(2).  Functions like
+    gd_fragmentname() and gd_raw_filename() now return canonicalised paths.
+
+  * The library no longer forces a sync of all raw data on close.  The sync
+    causes a flush of filesystem buffers, which is usually unnecessary
+    overhead, and degredatious to efficient disk I/O.  Use an explicit
+    gd_sync() or gd_flush() before closing to recover the old behaviour, if
+    desired.
+
+  * The error messages output by GetData with GD_VERBOSE turned on now has
+    "libgetdata: " prefixed to it.  A further prefix may be specified by
+    the caller.
+
+  * When truncating a dirfile, the primary format file is no longer deleted
+    and then recreated.  Instead, it is simply truncated in-place.  This
+    change means that a Dirfile which is undergoing truncation always
+    appears (to GetData, at least) to be a valid Dirfile, which can be
+    useful if it is being concurrently read.
+
+  * Write support for gzip-encoded data has been added.  Writes occur out
+    of place, which means sufficient space on the filesystem is needed for
+    a second copy of every field being written.  Writing to a gzip
+    compressed field requires uncompressing the portion of the field before
+    the write of the existing file, recompressing it to the temporary file,
+    then writing the new data to the temporary file.  A subsequent write at
+    a later position, will continue to write to the compressed file, but a
+    subsequent write to an earlier position requires coping all remaining
+    data from the old file to the temporary file, finalising it, moving it
+    over top of the old file, and then starting afresh with a new temporary
+    file.  As a result, it's not very fast, and likely should be avoided
+    for non-sequential writes.
+
+  * Raw data files are now only opened for writing if writing is going to
+    occur.  In particular, this means that opening a dirfile with GD_RDWR
+    will still work even if you don't have write access to it, so long as
+    you don't try writing to it.
+
+  * GetData now tracks a "current location" for all RAW files, and allows
+    reads and writes to occur at the "current location" (via the special
+    symbol GD_HERE).  For some derived fields the idea of a "current
+    location" doesn't make sense, and this won't work.
+
+  * BUG FIX: In previous versions, renaming a field with gd_rename()
+    wouldn't update or invalidate the cache of fields which depended on the
+    old name, leading to surprising results.  It will now either invalidate
+    these fields' metadata caches or else change the name in those
+    definitions as well.
+
+  * BUG FIX: The invalid syntax "/META parent/child granchild ..." is now
+    properly rejected by the parser.  Previously it half-worked, resulting
+    in a segfault in gd_close().
+
+  * BUG FIX: Several syntax errors encountered in PHASE and RECIP field
+    specifications weren't being reported by the parser, leading to
+    corrupted metadata on open.
+
+  * BUG FIX: GetData no longer omits the input field to a RECIP when
+    writing metadata to disk.  Nor does it forget to put newlines after
+    RECIP or DIVIDE field specifications.
+
+  * BUG FIX: GetData no longer assumes all LINCOM input fields have the
+    same number of samples per frame.
+
+  * BUG FIX: Writing an empty fragment with GD_PRETTY_PRINT turned on no
+    longer results in a floating-point exception.
+
+  * BUG FIX: Renaming a field now properly flags the fragment which
+    contains it as dirty, which will ensure the rename is writen to disk
+    when the metadata are next flushed.
+
+  * BUG FIX: Whitespace within tokens is now properly escaped when metadata
+    is flushed to disk.
+
+  * BUG FIX: The parser no longer gets tripped up by two character escape
+    sequences in a row, nor by an escape sequence at the start of a token.
+
+  * BUG FIX: "/PROTECT data" directives are now being written when they
+    should be.  Previously, they were dropped completely.  Reported by
+    Alexandra Rahlin.
+
+  * BUG FIX: CARRAY indices provided to gd_add() in the entry.scalar_ind
+    member are no longer ignored.  Reported by S. J. Benton.
+
+  * BUG FIX: When adding a metafield with gd_(m)add(), GetData no longer
+    checks the protection of the fragment indexed by entry->fragment_index.
+    Instead it ignores entry->fragment_index completely (as the
+    documentation indicates it should) and checks the protection of the
+    fragment containing the parent field.
+
+  API Changes:
+
+  * Functions which add fields (gd_add(), gd_add_<type>(), &c.) can now be
+    used to add metafields by using their full "parent/name" field code.
+    The old, explicit metafield adding routines (gd_madd(), &c.) are still
+    available.
+
+  * As with their corresponding names in the Standards, the gd_type_t
+    symbols GD_FLOAT and GD_DOUBLE are now deprecated.  Use GD_FLOAT32 and
+    GD_FLOAT64 as appropriate.
+
+  * A new open flag, GD_TRUNCSUB, will cause GD_TRUNC to descend into
+    subdirectories of a directory it is truncating.  If not specified along
+    with GD_TRUNC, it does nothing.
+
+  * New public functions gd_nentries() and gd_entry_list() provide a
+    generic interface to the field counting and list functionality.  The
+    other functions (gd_nfields(), gd_nfields_by_type(), &c. and
+    gd_field_list(), gd_field_list_by_type(), &c.) are now simply special
+    cases of these two functions.
+
+  * The "hiddenness" of a field name may be queried with gd_hidden(), set
+    with gd_hide() and cleared with gd_unhide().
+
+  * /INCLUDE affixes may be queried with gd_fragment_affixes() and added,
+    modified or deleted with gd_alter_affixes().  A new fragment can be
+    added to the dirfile with affixes using gd_include_affix().
+
+  * New aliases may be added with gd_add_alias() or gd_madd_alais.  The
+    target of an alias is retrned by gd_alias_target(); a list of aliases
+    of a field, or their number, is returned by gd_aliases() and
+    gd_naliases().
+
+  * Because GetData considers aliases and canonical names to be
+    indistinguishable, passing an alias name to most functions will result
+    in the function operating on target field.  To manipulate aliases
+    themselves, the API has the new interfaces gd_move_alias() and
+    gd_delete_alias().
+
+  * In addition to the special symbol GD_HERE which may be passed to
+    gd_getdata() and gd_putdata(), the "current location" of fields may be
+    queried with gd_tell() and moved with gd_seek().
+
+  * The typedefs gd_bit_t and gd_spf_t have been deprecated.  They are
+    replaced with 'int' and 'unsigned int' respectively.  For backwards
+    compatibility, the typedefs (with their new types) are still declared
+    in getdata.h, but the API no longer makes use of them.
+
+  * GetData's tokeniser has been exposed to the public API via the
+    gd_strtok() function, which works similar to strtok(3), and returns
+    successive tokens of a string given it.
+
+  * A new function gd_error_count() returns the number of GetData errors
+    encountered on a Dirfile since it was last called (or since the Dirfile
+    was opened).  This is useful for programs that care whether *something*
+    failed, but don't really care what it was.
+
+  * Reading MPLEX fields can result in inefficiencies due to GetData having
+    to look backwards for the first value of the part of the derived field
+    requested.  A new function, gd_mplex_lookback(), can be used to alter
+    how much lookback is done, if any.
+
+  * The "move_data" flag in gd_rename() has been replaced with a generic
+    "flags" parameter.  Two rename flags are defined: GD_REN_DATA, which
+    recovers the old behaviour of move_data, and GD_REN_UBDB which will
+    cause references to the renamed field to be renamed also in derived
+    fields which refer to it.  Without GD_REN_UBDB, these definitions are
+    left unchagned.
+
+  * Flags which affect the long-term operation of GetData may be modified
+    after open using gd_flags().  Currently these flags are just GD_VERBOSE
+    and GD_PRETTY_PRTNT.
+
+  * The gd_flush() function, which both syncs and closes RAW files, has
+    been broken up into its two parts with two new functions: gd_sync(),
+    which just syncs and gd_raw_close(), which just closes.  gd_flush()
+    still does both.
+
+  * Using the new gd_desync() function will cause GetData to determine
+    whether the Dirfile metadata on disk has changed since the Dirfile was
+    opened.
+
+  * A prefix to the automatic error messages printed by GetData when using
+    the GD_VERBOSE flag may be specified with gd_verbose_prefix().
+
+  * When requesting the exclusive creation of a new dirfile with (GD_CREAT
+    | GD_EXCL) GetData will now return the new error GD_E_EXISTS if the
+    dirfile already exists.  Previously it would return GD_E_CREAT in this
+    situation.
+
+  * The error codes GD_E_BAD_ENDIANNESS, GD_E_BAD_PROTECTION, and
+    GD_E_BAD_VERSION have been combined into a more generic error code:
+    GD_E_ARGUMENT.  The old symbols are retained for backwards
+    compatibility but have been marked deprecated.
+
+  * CONST and CARRAY handling has been combined somewhat.  When passed to
+    {get,put}_carray[_slice]() or gd_carray_len(), CONSTs behave like
+    length-one CARRAYs.  Similarly, {get,put}_constant() will operate on
+    the first element of a CARRAY, as if it were a CONST field.
+
+  * C89 API: Passing NULL to gd_alter_crecip() for cdividend is now treated
+    as if it were passed zero (ie. it indicates no change for cdividend).
+
+  * BUG FIX: calling gd_putdata() with num_frames and num_samples both zero
+    no longer confuses GetData: instead it simply does nothing.
+
+  * BUG FIX: gd_spf() now returns GD_E_DIMENSION when passed a scalar field
+    code, as the documentation says it should.  Previously it returned
+    GD_E_BAD_FIELD_TYPE.
+
+  Legacy API Changes:
+
+  * The never-used n_mplex/mplexEntries part of the FormatType now has a
+    use: both MPLEX and WINDOW entries are reported there.
+
+  Bindings Changes:
+
+  * Bindings for Perl5 have been added.  Perl is not well suited to
+    numerical analysis, and the bindings may be inefficient.
+
+  * F77: Due to small namespace issues, the encoding parameters
+    (corresponding to the GD_...ENCODED symbols in the C API) have all been
+    renamed.  They are now of the form GDE_xx.
+
+  * C++: The bindings now make use of the explicitly-64-bit offset type
+    gd_off64_t defined in getdata.h.  Previously, the bindings tried to
+    force off_t to be 64-bit through preprocessor shenanigans, which led,
+    in certain cases, to linking problems down the road when used by third
+    parties.
+
+  * Python: The return_type, num_fields, and num_samples parameters to
+    dirfile.getdata() are now optional.  The return_type defautls to
+    pygetdata.FLOAT, and if neither num_fields nor num_samples are given,
+    all frames (ie. the value of dirfile.nframes) are returned.
+
+  * IDL: A number of undocumented, unnecessary function aliases have been
+    removed. They should be replaced with their canonical names, without
+    change in use:
+
+        Alias                   Replacement
+        ----------------------  ----------------
+        GD_ADD_CLINCOM          GD_ADD_LINCOM
+        GD_ADD_CPOLYNOM         GD_ADD_POLYNOM
+        GD_ADD_CRECIP           GD_ADD_RECIP
+        GD_ALTER_CLINCOM        GD_ALTER_LINCOM
+        GD_ALTER_CPOLYNOM       GD_ALTER_POLYNOM
+        GD_ALTER_CRECIP         GD_ALTER_RECIP
+        GD_FIELD_LIST_BY_TYPE   GD_ENTRY_LIST
+        GD_FRAMENUM_SUBSET      GD_FRAMENUM
+        GD_MADD                 GD_ADD
+        GD_MADD_BIT             GD_ADD_BIT
+        GD_MADD_CARRAY          GD_ADD_CARRAY
+        GD_MADD_CLINCOM         GD_ADD_LINCOM
+        GD_MADD_CPOLYNOM        GD_ADD_POLYNOM
+        GD_MADD_CRECIP          GD_ADD_RECIP
+        GD_MADD_DIVIDE          GD_ADD_DIVIDE
+        GD_MADD_LINCOM          GD_ADD_LINCOM
+        GD_MADD_LINTERP         GD_ADD_LINTERP
+        GD_MADD_MULTIPLY        GD_ADD_MULTIPLY
+        GD_MADD_PHASE           GD_ADD_PHASE
+        GD_MADD_POLYNOM         GD_ADD_POLYNOM
+        GD_MADD_RECIP           GD_ADD_RECIP
+        GD_MADD_SBIT            GD_ADD_SBIT
+        GD_MADD_STRING          GD_ADD_STRING
+        GD_MALTER_SPEC          GD_ALTER_SPEC
+        GD_MCONSTANTS           GD_CONSTANTS
+        GD_MFIELD_LIST          GD_ENTRY_LIST
+        GD_MFIELD_LIST_BY_TYPE  GD_ENTRY_LIST
+        GD_MSTRINGS             GD_STRINGS
+        GD_MVECTOR_LIST         GD_VECTOR_LIST
+        GD_NFIELDS_BY_TYPE      GD_NENTRIES
+        GD_NMFIELDS             GD_NENTRIES
+        GD_NMFIELDS_BY_TYPE     GD_NENTRIES
+        GD_NMVECTORS            GD_NVECTORS
+
+  * BUG FIX: All bindings now provide a named constant corresponding to the
+    C API error GD_E_UNKNOWN_ENCODING, which was overlooked in previous
+    releases.
+
+  * IDL BUG FIX: The missing /IGNORE_REFS and /PRETTY_PRINT are now
+    available in gd_open.
+
+|==============================================================================|
+
 New in version 0.7.3:
 
   Library Changes
 
   * BUG FIX: Passing a zero dividend to alter_crecip() and alter_recip() now
     results in the dividend not changing, per documentation.
+
   * BUG FIX: GetData wasn't properly computing the module directory, causing
     encodings using external modules to fail with GD_E_UNSUPPORTED.
+
   * BUG FIX: Metafield records are now properly stored in the format file for
     Standards Version 8.
+
   * BUG FIX: gd_raw_filename() wasn't clearing the Dirfile error before
     operation, resulting in it failing erroneously in certain situations.
 
@@ -24,10 +561,13 @@ New in version 0.7.2:
   * If built with modules, the plugin shared objects will now be installed in
     a separate directory (by default "${libdir}/getdata", but see the
     --with-module-dir option in ./configure).
+
   * BUG FIX: When using modules, a missing plugin no longer results in a lock up
     the second time an attempt is made to find it.
+
   * BUG FIX: GetData now properly processes /INCLUDE directives with absolute
     paths, as the documentation insists it should.
+
   * BUG FIX: gd_add()ing the first raw field in a dirfile to a subfragment no
     longer results in memory corruption when calling gd_close().
 
@@ -49,8 +589,10 @@ New in version 0.7.1:
 
   * BUG FIX: When the parser fails in a gd_include() call, the internal list of
     conformant Standards Versions for the loaded dirfile is no longer corrupted.
+
   * BUG FIX Performing two consecutive reads of the same field in an ASCII
     encoded datasources no longer confuses GetData.
+
   * BUG FIX: Numerous memory leaks have been patched (mostly pin-holes, although
     there are a few, rare but egregious ones).
 
@@ -58,9 +600,11 @@ New in version 0.7.1:
 
   * The value(s) of a CONST or CARRAY field added with gd_[m]add() is now
     guaranteed to be zero; previously, it was unspecified.
+
   * BUG FIX: Specifying both GD_VERBOSE and GD_IGNORE_DUPS no longer results in
     spurious "Field code already defined" messages when duplicate fields are
     encountered.
+
   * BUG FIX: Calling gd_delete on a metafield no longer results in a segfault.
 
   Bindings Changes:
@@ -74,9 +618,11 @@ New in version 0.7.1:
   * dirfile2ascii now pads reads past the end-of-field.  The value used to
     pad may be specified with '-z', and defaults to 0/NaN.  Previously, the
     value of uninitialized memory was output.
+
   * BUG FIX: dirfile2ascii now does what the user intends when presented with
     cart-before-horse arguments, ie. "dirfile2ascii -e field DIRFILE".
     Previously this resulted in confusion.
+
   * BUG FIX: dirfile2ascii now accepts field conversion '-u', which was
     documented but overlooked in the argument parser.
 
@@ -90,16 +636,20 @@ New in version 0.7.0:
     types: DIVIDE, which computes X/Y for vectors X and Y, RECIP, which computes
     A/X for vector X and scalar A, and CARRAY, which is an array of CONST
     scalars.  A few other changes are listed below.
+
   * Like CONST fields, CARRAY elements can be used as parametersin the
     definition of other fields.  Syntax is 'field<n>', where 'field' is the
     field name and 'n' the element index in the CARRAY (and the angle brackets
     are literal angle brackets).  If the '<n>' is omitted, the first element
     (numbered 0) is assumed.
+
   * Slashes on reserved words are now mandatory, allowing fields with reserved
     words as names.
+
   * The long-deprecated single character data type codes have been removed from
     Standards Version 8.  (They are still accepted by GetData, which handles
     all previous Standards Versions as well.)
+
   * The /ENDIAN directive now takes an optional second parameter.  The only
     allowed value for this second token is "arm", which indicates that double
     precision floating point data (including double precision complex data) are
@@ -112,9 +662,11 @@ New in version 0.7.0:
     Win32 using MinGW.  In the case of MinGW, this includes linking against the
     Microsoft C Runtime, which isn't POSIX compliant.  Users should excercise
     caution when writing to dirfiles in this case.
+
   * GetData can now be used on ARM processors.  As a side-effect, GetData can
     now read and write the middle-ended floating point format used by older ARM
     processors (on any processor, via endianness conversion).
+
   * Some changes have been made to the parser.  It now operates in one of two
     modes: pedantic mode, which adheres strictly to one particular Dirfile
     Standards Version, and permissive mode (the default) which is more
@@ -122,51 +674,64 @@ New in version 0.7.0:
     switch the parser from permissive to pedantic mode unless told not to (see
     GD_PERMISSIVE below), and will change the particular Standards Version to
     which pedantic mode is adhering.
+
   * As a result of the previous change, the Standards compliance of the parser
     in strict mode has been greatly increased.  This affects allowed characters
     in field names, and field name lengths.  The existance or lack thereof of
     the implicit FILEFRAM field (an alias for INDEX) is also affected.
+
   * Since Standards Versions 4 and earlier were never codified, we've made some
     assumptions as to their behaviour in certain undocumented situtations.  Most
     noticably, they still prohibit ASCII control codes (bytes < 0x20) and '/'
     in field names.  We also assume these dirfiles have native byte sex, even
     though some early GetData behaviour implied only little-ended data was
     acceptable.
+
   * Every Dirfile object now records its current Standards Version, which
     affects functions such as gd_add_spec().  The Version will start out as the
     value of the last /VERSION directive encountered by the parser, or else the
     latest compliant Standards Version.  It can be changed (see below).
+
   * When writing metadata to disk, fragments will be written according to the
     current Standards Version of the dirfile object, rather than always using
     the latest version, as before.
+
   * The C library now sports an "ANSI C" mode, which allows compilation of
     GetData without a C99-compliant compiler.  Some functionality may be lost,
     most prominently, but unsurprisingly, the default (C99) API.
+
   * The artificial maximum line length of 4096 bytes for format metadata has
     been removed.  The maximum line length is now 2**31 bytes on 32-bit systems,
     and more on 64-bit systems.  This also has the side-effect of removing the
     same length limit which had been applied to field names.
+
   * LINTERP tables are no longer required to be sorted.  The library will
     sort them, if needed.  As a side-effect of this, tables are no longer read
     twice when loading, leading to potential speed-up.
 
+
   * BUG FIX: The library wasn't properly checking that the second and higher
     input fields in LINCOM and MULTIPLY fields were, in fact, vectors, leading
     to possible segfaults.
+
   * BUG FIX: A memory leak associated with modifying LINCOM metadata has been
     fixed.
+
   * BUG FIX: Using a complex valued vector as the second input field in a
     MULTIPLY wouldn't result in the field being internally flagged as complex,
     leading to loss of the imaginary part in certain situtaitons.
+
   * BUG FIX: Trying to write to a LINTERP via a table which isn't monotonic now
     results in error.  Previously, this was allowed, with arbitrary data stored
     to disk.
+
   * BUG FIX: On encountering a line longer than it was prepared to deal with,
     the parser used to get very confused, potentially resulting in bizarre
     behaviour.  On the off chance such a line is encountered, GetData will now
     raise GD_E_LINE_TOO_LONG in these cases. (And, since the maxmium line
-    length has been increased to at least 2**31 bytes, this should only occur
-    in pathological situations.)
+    length has been increased to at least 2**31 characters, this should only
+    occur in pathological situations.)
+
   * BUG FIX: Deleting a metafield was not being communicated to its parent,
     resulting in differing opinions within the library as to the deleted field's
     exsitence.
@@ -178,6 +743,7 @@ New in version 0.7.0:
     performed.  All public functions, and data types now begin with 'gd_'.  All
     public preprocessor macros now begin with 'GD_'.  Symbol renaming has
     occurred in the following manner:
+
     - functions which started with 'put' simply prefix 'gd_' to their name.  So
       put_constant() becomes gd_put_constant().
     - functions which started with 'get' replace 'get' with 'gd', except those
@@ -190,54 +756,71 @@ New in version 0.7.0:
     - macros which started with 'GETDATA_' now start with 'GD_'.  Those that
       started with 'NO_GETDATA_' now start with 'GD_NO_'.  So GETDATA_LEGACY_API
       becomes GD_LEGACY_API and NO_GETDATA_LEGACY_API becomes GD_NO_LEGACY_API.
+
   * The above renaming rules result in one gd_ namespace clash.  As a result,
     get_reference() has been removed completely.  Calls will have to be
     changed to use gd_reference(), formerly dirfile_reference().
+
   * Furthermore, the function dirfile_protect() is now gd_alter_protection() to
     match the naming of other fragment metadata altering functions.
+
   * To ease transition to the new namespace, defining GD_FUNCTION_ALIASES before
     including getdata.h will create a bunch of preprocessor macros which map the
     old names to the new.
+
   * The meaning of the GD_PEDANTIC flag to gd_[cb]open() has changed.  It now
     forces the parser to start off in pedantic mode (see above), following the
     latest Standards Version, rather than the default permissive mode.  This is
     a subtle change, and in most cases the effects of GD_PEDANTIC will be the
     same as they were before.
+
   * A new dirfile flag, GD_PERMISSIVE, has been added.  Passing this to
     gd_[cb]open() will prohibit the parser from switching into pedantic mode
     when it encounters a /VERSION directive.  This flag is needed to read
     dirfiles which claim to adhere to the Standards via a /VERSION directive,
     but contain invalid syntax nonetheless.
+
   * The current Standards Version of an open dirfile can be set or queried by
     calling the new function gd_dirfile_standards().  NB: this only affects the
     open dirfile, not the metadata stored on disk.
+
   * A new function, gd_rewrite_fragment() will force GetData to write the
     specified fragment to disk, even if no metadata in the fragment has changed.
+
   * Two new functions, gd_bof() and gd_eof() can be used to find the sample
     number of the beginning- or end-of-field for a given field.  Notably, these
     can be used to calculate the amount of raw data on disk for a given field.
+
   * The new gd_invalid_dirfile() function will return a newly created, invalid
     dirfile.  Primarily useful to callers as a "null dirfile" placeholder.
+
   * GD_E_OPEN_INCLUDE has been renamed to GD_E_OPEN_FRAGMENT, but the former
     symbol remains as an alias.
+
   * Two new bitflags to gd_cbopen and gd_open: GD_ARM_ENDIAN and
     GD_NOT_ARM_ENDIAN allow specifying the default ordering of double precision
     data.  These flags may also be used with gd_alter_endianness() and will be
     returned by gd_endianness().  On all platforms except for middle-endian
     ARMs, GD_NOT_ARM_ENDIAN equals zero and may be omitted.
+
   * Where gd_flush() and gd_metaflush() in the past raised GD_E_OPEN_INCLUDE
     on I/O error, they now raise the new GD_FLUSH.
+
   * All functions now raise GD_E_DIMENSION when encountering a scalar field
     when expecting a vector.  In the past, the error value returned was
     different for different functions.
+
   * getdata.h now wraps itself in an extern "C" block if included by a C++
     compiler.
+
   * If passed a NULL pointer, gd_error_string() will return a newly malloc'd
     buffer long enough to hold the entire string.  It should be free'd by the
     caller.
+
   * The parser data passed to the callback function now includes the length of
     the buffer.  The parser also permits the callback to assign a new pointer to
     the 'line' element of the parser data if the buffer passed in is too small.
+
   * gd_metaflush() now fails and raises GD_E_ACCMODE if called on a read-only
     dirfile.  (Previously it would successfully do nothing.)
 
@@ -249,39 +832,56 @@ New in version 0.7.0:
   * BUG FIX: In previous versions, attempting to access an invalid dirfile
     (anything that would cause gd_open to fail) resulted in leaked memory.  This
     leak has been plugged.
+
   * BUG FIX: A segfault involving the reporting of POLYNOM fields has been fixed
     in GetFormat().
 
   Bindings
 
   * Bindings for the functionality introduced into 0.7.0 have been added.
+
   * F77: GDPROT has been renamed GDAPRT to mirror the renaming of
     gd_alter_protection().
+
   * F77: GDGTCO and GDPTCO no longer return an indicator of success.
+
   * F77: The signatues of GDGSCA and GDASCA have changed to return/take the
     scalar index as well.
+
   * F95: For consistency sake, the Fortran 95 bindings have undergone the same
     renaming so they have the same name as their C counterparts.  All functions
     are now preceded by 'fgd_'.
+
   * F95: The fgd_get_constant_* and fgd_put_constant_* procedures are now
     subroutines, not functions.
+
   * C++: Const member functions are now flagged as such.
+
   * C++: The len parameter to Dirfile::ErrorString is now ignored.
+
   * C++: dirfiles are now opened read-only by default.
+
   * IDL: The IDL bindings have also followed suit in the great renaming.  The
     exception to this is GETDATA_CONSTANTS(), which is not renamed.
+
   * IDL: Various constants defined in getdata.h but not used by the IDL bindings
     have been removed from the structure returned by GETDATA_CONSTANTS().
-  * Pyhon: dirfile.getdata() now raises ValueError if neither num_frames nor
+
+  * Python: dirfile.getdata() now raises ValueError if neither num_frames nor
     num_samples are specified.  In the past, it would happily return nothing
     in this case.
+
   * Python: dirfiles are now opened read-only by default.
 
-  * C++ BUG FIX: Entry::Scalar() no longer rejects valid values of index. 
+
+  * C++ BUG FIX: Entry::Scalar() no longer rejects valid values of index.
+
   * IDL BUG FIX: A memory impropriety involving keyword arguments.  This bug
     manifested by rejecting valid keyword arguments on 64-bit systems, but may
     have had other, subtle effects on 32-bit systems as well.
+
   * Python BUG FIX: A non-literal phase shift is now properly reported.
+
   * Python BUG FIX: Calling Dirfile.discard() or Dirfile.close() no longer
     results in a segfault.
 
@@ -289,9 +889,11 @@ New in version 0.7.0:
 
   * The --disable-checkdirfile option has been removed from ./configure.  It
     is now always installed.
+
   * A utility, dirfile2ascii, is now installed alongside checkdirfile.  This
     utility converts all or part of a dirfile into ASCII text.  dirfile2ascii
     was written by Matthew Truch.
+
   * The thoroughness of the checks done by checkdirfile have increased.  It now
     reports format syntax errors, Dirfile Standards compliance, problems with
     field definitions (such as missing input fields), and the size of the
@@ -301,7 +903,7 @@ New in version 0.7.0:
 
 New in version 0.6.3:
 
-  Bindings 
+  Bindings
 
   * A memory leak has been plugged in the Python bindings manifesting in calls
     to dirfile.getdata() returning a NumPy array.  In previous versions, the
@@ -328,11 +930,12 @@ New in version 0.6.1:
 
   * A potential segfault relating to error reporting in the legacy API has
     been fixed.
-  
+
   Bindings
 
   * C++ BUG FIX: Several bugs preventing compilation of the C++ test-suite under
     Fedora 13 have been fixed.
+
   * IDL BUG FIX: Several segfaults in the IDL bindings have been eradicated.
 
   Miscellaneous
@@ -355,14 +958,19 @@ New in version 0.6.0:
   * GetData now support Dirfile Standards Version 7.  Standards Version 7 adds
     complex data types, a signed bitfield (SBIT), a polynomial derived field
     (POLYNOM), and other features detailed below.
+
   * Metafields can now be specified using a normal format specification line and
     their full (slashed) field code.
+
   * Field codes can now contain a "representation suffix", which allows
     specifying a complex norm used to convert complex valued data into purely
     real data.
+
   * The n_fields parameter in a LINCOM specification is now optional.
+
   * A new encoding scheme which supports LZMA compressed data using the .xz
     container format has been added.
+
   * Look-up tables may contain a complex y-value.  This prohibits writing to
     the associated LINTERP field.
 
@@ -371,37 +979,51 @@ New in version 0.6.0:
   * The field parameters spf (RAW), bitnum and numbits (BIT and SBIT) are now
     restricted to 16-bit numbers, which should be more than enough.  The public
     API uses gd_spf_t and gd_bit_t for these quantities.
+
   * The shift field parameter is now a 64-bit integer type, called gd_shift_t.
+
   * The dirfile flags, including encoding and endianness symbols are now
     explicitly long ints.  Previously these quantities mixed long int with int
     arbitrarily.  This affects the public API.
+
   * The parser callback has received a new, API breaking signature, which should
     hopefully reduce the amount of API breakage in the future.  It is also now
     possible for the caller to pass data through GetData to the callback, if
     desired.
+
   * Computation of derived fields can now handle complex valued inputs, and
     computation will occur in the complex plane when required.
+
   * The computation of LINCOM fields has been re-written and is now ~20% faster
     for LINCOMs with 2 or 3 input fields.  (No change for LINCOMs of 1 field.)
+
   * A new open flag, GD_PRETTY_PRINT, tells the library to attempt to write a
     nicer looking format file.  What this specifically means, isn't part of the
     public API and shouldn't be relied on in portable code.
+
   * BUG FIX: dirfile_madd_spec() and dirfile_add_spec() didn't properly flag
     the fragments they modified as dirty, leading to possible loss of metadata.
+
   * BUG FIX: calling get_nframes on a bzip2 encoded dirfile would report the
     wrong dirfile length.
+
   * BUG FIX: LINTERP tables are now closed after loading, resolving a file
     descriptor leak of great age (ie. pre-0.3.0).
+
   * BUG FIX: When re-writing a format file fragment containing fields with
     CONST scalar field parameters, GetData no longer replaces the CONST field
     codes in the field specification lines with the value of the CONST field.
+
   * BUG FIX: when moving a field with dirfile_move(), the fragment index in
     the entry objects of metafields defined for the field were not updated.
     (The metafields were placed in the correct fragment when the metadata was
     flushed to disk, despite this.)
+
   * BUG FIX: Calling getdata() or putdata() on 64-bit architectures in certain
     situations involving a non-zero frameoffset no longer results in bizarrity.
+
   * BUG FIX: A memory leak associated with RAW field metadata has been fixed.
+
   * BUG FIX: 64-bit integer literals in the format file are no longer truncated
     to double precision when read.
 
@@ -410,39 +1032,52 @@ New in version 0.6.0:
   * This release breaks ABI compatibility and, to a lesser extent, API
     compatibility.  The SOVERSION of the library has been incremented
     accordingly.
+
   * A C-89 API will be declared by getdata.h if GETDATA_C89_API is defined
     before inclusion.  If this symbol is not defined, the C API defined will
     include C-99 conforming complex types, and getdata.h will include complex.h
     if `complex' has not been defined before inclusion.
+
   * Due to the new, simple way of specifying META fields in Standards Version 7,
     dirfile_add_spec() and dirfile_alter_spec() can be used to modify
     metafields. dirfile_madd_spec() and dirfile_malter_spec() remain as well.
+
   * An array containing the CONST scalar field codes used when non-literal
     parameters are used in the specification of various different fields has
     been added to the gd_entry_t object.  As a side-effect of this,
     dirfile_add(), dirfile_alter_entry(), and dirfile_madd() can be used to
     manipulate non-literal field parameters.
+
   * A function, get_native_type(), now exists which returns the underlying data
     type of a specified field code.
+
   * A function, get_framenum(), is now available to perform a "reverse look-up"
     on a field: given a data value, it reports the frame number where the field
     has that value.  The field must be monotonic.
+
   * A function, dirfile_validate(), now exists which can be used to check the
     validity of a field code before use.
+
   * Two new error codes have been added: GD_E_DOMAIN, potentially returned by
     get_framenum(), and GD_E_BAD_REPR, indicating an unrecognised representation
     suffix, or an attempt to write to a representation.
+
   * A new syntax error suberror code has been added: GD_E_FORMAT_LITERAL, which
     indicates a syntax error in a complex literal number.
+
   * BUG FIX: On success, dirfilename(), dirfile_reference(), and get_reference()
     didn't change the error code to GD_E_OK, resulting in spurious error codes
     from these functions.
+
   * BUG FIX: dirfile_madd_string() and dirfile_madd_const() now don't fail
     erroneously by reporting GD_E_BAD_CODE.
+
   * BUG FIX: error strings relating to GD_E_DELETE error codes now report the
     proper error information.
+
   * BUG FIX: the list returned by get_mstrings() is now properly NULL
     terminated.
+
   * BUG FIX: the entry->table member now reports the proper path to the LUT.
     (That is, the path stored in the format file.)  Previously it incorrectly
     reported a path relative to the base dirfile directory.
@@ -457,45 +1092,67 @@ New in version 0.6.0:
 
   * Bindings for Python and the Interactive Data Language (IDL) have been
     added.
+
   * Bindings for the functionality introduced into 0.6.0 have been added.
+
   * C++: The missing bindings for dirfilename(), get_nvectors(), and
     get_fragment_index() have been added.
+
   * C++: Empty entry class constructors have been added which allow delayed
     specification of field metadata.
+
   * C++: The dirfile.h header now includes all other C++ headers, and is now
     the only header required to be included in applications.  (The other headers
     can still be included, with no ill effects.)
+
   * All bindings have a much expanded test suite, which has resulted in the
     discovery of many bugs (subsequently fixed).
+
   * F77: The callback function is now dirfile-specific, as it is in the C API.
+
   * C++ BUG FIX: Entry class constructors now properly set the field name for
     metafields.
+
   * C++ BUG FIX: Fragment::SetEncoding() now actually does what it advertises,
     instead of doing nothing.
+
   * C++ BUG FIX: The recode argument to various functions is now optional and
     defaults to zero, as the documentation already indicated.
+
   * C++ BUG FIX: dirfile_close() was not being called by the Dirifle destructor.
+
   * F77 BUG FIX: a NULL C string returned from the C API now returns an empty
     string, rather than causing a segfault.
+
   * F77 BUG FIX: attempting to call another F77 function before calling GDCOPN
     or GDOPEN no longer results in a segfault.
+
   * F77 BUG FIX: passing an out-of-range dirfile unit no longer results in
     undefined behaviour.
+
   * F77 BUG FIX: the last character of a string returned by the bindings is no
     longer deleted.
+
   * F77 BUG FIX: string lengths now report the correct length.
+
   * F77 BUG FIX: passing dirfile unit 0 to GDCLOS or GDDSCD no longer corrupts
     the bindings.
+
   * F77 BUG FIX: GDFLDN no longer accepts indices less than one.
+
   * F77 BUG FIX: GDESTR now space pads its output string, rather than filling
     the remainder of the string with garbage.
+
   * F77 BUG FIX: The get_entry() bindings, GDGExx no longer segfault on dirfile
     error.
+
   * F77 BUG FIX: GDGTST and GDPTST now report the FORTRAN string length, which
     is one less than the C API would report, due to the lack of a terminating
     null.
+
   * F95 BUG FIX: Attempting to retrieve a PHASE entry with fget_entry() now
     works.
+
   * F95 BUG FIX: Several routines which were named fdrifile_<foo> are now
     properly spelled.
 
@@ -522,12 +1179,16 @@ New in version 0.5.0:
     be built into stand-alone library modules which will be loaded, as needed,
     at runtime.  GetData will fail gracefully if modules are missing.  See the
     README for full details.
+
   * BUG FIX: Writing metadata to disc now preserves the permissions of the
     format file fragments which are changed.
+
   * BUG FIX: Format files without a line feed character at the end of the file
     no longer cause the parser to segfault.
+
   * BUG FIX: putdata() now reports the correct number of samples written for
     ASCII encoded files.
+
   * BUG FIX: GetData no longer inserts unnecessary "/./" elements into the paths
     it reports.
 
@@ -540,10 +1201,14 @@ New in version 0.5.0:
     to either correct the syntax error, or else tell GetData whether to ignore
     the line or not.  The callback function may be later modified by calling
     dirfile_parser_callback.
+
   * A fragment may be removed from a dirfile by calling dirfile_uninclude.
+
   * The pathname of the dirfile may be retrieved by calling dirfilename.
+
   * The reference field for the dirfile may be set or retrieved by calling
     dirfile_reference.
+
   * Fragment metadata may be queried or modified by calling:
 
       - get_encoding, dirfile_alter_encoding
@@ -556,27 +1221,35 @@ New in version 0.5.0:
 
       - dirfile_alter_entry, dirfile_alter_<field-type>, dirfile_alter_spec,
         dirfile_malter_spec
-  
+
   * A field may be moved to a different format file fragment using dirfile_move.
+
   * A field may be renamed by using dirfile_rename.
+
   * A field may be removed from the dirfile by calling dirfile_delete.
+
   * The type or fragment index of a field may be retrieved by calling
     get_entry_type or get_fragment_index, respectively.
+
   * The pathname of a raw field may be obtained from a call to get_raw_filename.
+
   * A DIRFILE may be deallocated without saving modified metadata by calling
     dirfile_discard.
+
   * A new flag, GD_IGNORE_DUPS, may be passed to dirfile_open to tell the
     parser to ignore duplicate field specifications in the format files.  This
     is really only useful identically duplicate specifications, since there is
     no indication of which of the duplicates is honoured.  Explicit control can
     be obtained by handling this inside a caller supplied callback function.
-  
+
   Bindings:
 
   * All functions in the Fortran 77 bindings have been completely renamed from
     GDFxxx to GDxxxx to provide a larger namespace for our use.
+
   * Fortran 77, Fortran 95, and C++ bindings have been updated for the latest
     API changes.
+
   * BUG FIX: Fortran 77 functions which return character strings no longer
     corrupt memory as a side-effect of operation.  This also affected the
     Fortran 95 bindings.
@@ -595,8 +1268,10 @@ New in version 0.4.2:
 
   * BUG FIX: The default protection level of format file fragments is now
     properly set to "none".  Reported by Brendan Crill.
+
   * BUG FIX: getdata() now reports the correct number of samples read for slim
     and ASCII encoded files.  Reported by Adam Hincks.
+
   * BUG FIX: A segmentation fault only encountered when reading slim encoded
     data has been fixed in dirfile_flush().
 
@@ -615,40 +1290,47 @@ New in version 0.4.2:
 |==============================================================================|
 
 New in version 0.4.1:
-  
+
   Library Changes
 
   * BUG FIX: Adding an ASCII encoded RAW field no longer creates an empty,
     unencoded binary file.
+
   * BUG FIX: A few minor memory leaks have been patched.  Most of these
     were the result of insufficient clean up in dirfile_close().
+
   * As an exception to the Standards, the full stop character '.' is once
     again permitted in field names.  This is required by BLAST.  Instead,
     field names are prohibited from ending with the known encoding extensions.
     The Standards still prohibit the full stop character in field names, and the
     GD_PEDANTIC flag will disable this exception.  Furthermore, fields may not
     be added via GetData which contain a full stop character.
+
   * Some minor speed improvements have been made to the format file parser
     resulting in a ~30% decrease in parsing time.
 
 |==============================================================================|
 
 New in version 0.4.0:
-  
+
   Dirfile Changes
 
   * GetData now supports Dirfile Standards Version 6.  Standards Version 6 adds
     numerical (CONST) and string (STRING) scalar fields to the dirfile, as well
     as other features outlined below.
+
   * CONST names can now appear as parameters in field specifications in certain
     places in lieu of a literal number.
+
   * The tokeniser has been re-written.  Any sequence of non-NUL bytes can now
     form a valid token.  Field codes may not have ASCII control characters
     or the "reserved characters" &, /, ;, <, >, |, . but may contain any other
     characters (including whitespace).
+
   * Subordinate fields may now be attached to fields.  These subfields are
     defined with the META directive, and referenced in most cases as
     "<parent-field>/<subfield>".
+
   * Binary files in dirfiles may now be "encoded".  In addition to raw
     (unencoded) files, two encodings are currently supported:
 
@@ -657,16 +1339,20 @@ New in version 0.4.0:
 
     Encoding schemes are fragment-local, although they are inherited from parent
     fragments.
+
   * Endianness is now also fragment-local, meaning different endiannesses can
     co-exist in the same dirfile (so long as the fields are defined in different
     format file fragments), and GetData will do the Right Thing.
+
   * "FILEFRAM" is no-longer supported as an alias for "INDEX".  This affects
     GetData's implementation of all Standards Versions.  Code that made use of
     FILEFRAM will have to be updated to use INDEX instead.
+
   * The reference field, previously the first RAW field in the format file,
     may now be specified using the REFERENCE directive.  The reference field
     is the field that is looked at when get_nframes() is called.  This is
     important to programs like kst which support streaming dirfiles.
+
   * Portions (or all) of a dirfile's data and metadata can be protected from
     change by specifying the PROTECT directive.  This protection is "advisory",
     ie. while GetData will respect it in all cases, don't count on the PROTECT
@@ -676,12 +1362,15 @@ New in version 0.4.0:
 
   * INDEX is now a normal field.  It appears in the count/list functions.
     Attempts to write to INDEX will fail.
+
   * The GD_E_EMPTY error code has been removed: it is no longer an error to
     query a dirfile containing no RAW fields.
+
   * The presence of two fields in the dirfile with the same name is now
     detected, and will cause a syntax error when parsing the format file.
     Previously, such things were allowed, but only one of the synonym fields
     could ever be queried. (Which field was returned was arbitrary.)
+
   * Field code look-ups for input fields are now cached, which should result
     in slightly better performance from the library.
 
@@ -695,28 +1384,36 @@ New in version 0.4.0:
 
   * Whole other format file fragments may also be added to the dirfile by
     calling dirfile_include().
+
   * A function is now present (dirfile_metaflush()) to flush metadata changes to
     disk (by re-writing format file fragments).  dirfile_flush() and
     dirfile_close() will also flush metadata, if needed.
+
   * STRING and CONST values can be retrieved/set by calling (get,put)_string()
     and (get,put)_constant().  (get,put)data() are only for vector type fields.
+
   * META fields can be queried/set like normal fields using the get/put
     functions and their full (slashed) field code.
+
   * In addition to get_nfields() and get_field_list(), there are now
     corresponding functions that provide lists/counts of vectors
     (get_vector_list()/get_nvectors()), particular field types
     (get_field_list_by_type()/get_nfields_by_type()), as well as functions
     that provide lists of string values (get_string_values()) and constant
     values (get_const_values()).
+
   * Analogous functions for the add, list, and counting functions exist for
     META fields, as well.
+
   * Extra flags have been added to dirfile_open() to permit indicating the
     encoding type, if not specified in the dirfile itself.
+
   * DIRFILE struct members and gd_entry_t private members are now completely
     hidden from the public interface.  Where previously callers could query
     dirfile->error to check for an error, they must now call get_error(dirfile).
     This change was made to reduce unintentional ABI breakage when modifying
     internal library properties.
+
   * GD_VERBOSE has been added to the list of available dirfile_open() flags.
     If this flag is specified, GetData will write errors to stderr as
     encountered.
@@ -726,6 +1423,7 @@ New in version 0.4.0:
   * Error codes which cannot be returned by the legacy API might not have a
     corresponding string in GD_ERROR_CODES[].  Instead, these entries will
     simply be the NULL pointer.
+
   * No facilities exist in the legacy API to set or query CONST or STRING
     fields.  However, META fields of vector type can be queried/set using
     GetData() and PutData(), as in the new API.
@@ -758,10 +1456,12 @@ New in version 0.3.0:
 
   * GetData now supports Dirfile Standards Version 5 which includes support
     for signed 8-bit, and signed and unsigned 64-bit integer types.
+
   * As part of Standards Version 5, the restriction on field name length has
     been removed.  (The filesystem will impose an effective limit on RAW fields
     of a few hundred characters, and format file lines are limited to several
     thousand, limiting derived field names.)
+
   * The library can now convert between big and little endiannesses.  An
     optional directive, ENDIAN, added in Standards Version 5, is available to
     specify the byte-sex of a dirfile.
@@ -772,8 +1472,11 @@ New in version 0.3.0:
     support in the old interface.  The old interface (referred to as the "legacy
     API") is still supported, but doesn't fully implement Dirfile Standards
     Version 5.  See the README for full details.
+
   * putdata now respects FRAMEOFFSET.
+
   * putdata can now write to PHASE fields, and multi-bit BIT fields.
+
   * Some error codes have been renamed, and others removed or added, in order to
     regularise error codes between getdata and putdata in the sundry versions.
     Furthermore, the underlying values of some of these codes have changed
@@ -795,11 +1498,13 @@ New in version 0.3.0:
         are new
 
     This affects the legacy API.
-  
+
   Legacy API Changes
 
   * The legacy API has been marked deprecated.
+
   * Error codes have changed per the description above.
+
   * Only the public members of FormatType are now initialised by GetFormat.
 
   Bindings
diff --git a/README b/README
index d0fd75f..66b5c72 100644
--- a/README
+++ b/README
@@ -55,8 +55,10 @@ This package provides:
     - C++ (libgetdata++)
     - Fortran 77 (libfgetdata)
     - Fortran 95 (libf95getdata)
-    - Python (pygetdata)
     - the Interactive Data Language (IDL; idl_getdata)
+    - MATLAB (libgetdata-matlab and associated MEX files)
+    - Perl (GetData.pm)
+    - Python (pygetdata)
 
 Documentation for the various bindings, if present, can be found in files
 named `README.<language>' in the doc/ directory.  The C interface is described
@@ -66,25 +68,22 @@ A full list of features new to this release of GetData may be found in the
 file called `NEWS'.
 
 
-DIRFILE STANDARDS VERSION 8
+DIRFILE STANDARDS VERSION 9
 ===========================
 
-The 0.7.0 release of the GetData Library (October 2010), was released in
-conjunction with a new version of the Dirfile Standards, known as Standards
-Version 8.
-
-Standards Version 8 introduces the following:
-  * Two new field types: DIVIDE, the quotient of two input vector fields,
-    and RECIP, the reciprocal of a vector field.
-  * Support for middle-endian ARM double-precision floating point data.
-  * Furthermore, several deprecated features have been removed.  The old single
-    character type names are no longer accepted, and directives now require an
-    initial forward slash.  (NB: these features are only removed from Standards
-    Version 8; GetData, which understands all Standards Versions, still can work
-    with these features.)
-
-This is the first update to the Dirfile Standards since Standards Version 7
-(October 2009).  A full history of the Dirfile Standards can be found in the
+The 0.8.0 release of the GetData Library (July 2012) is the first release to
+provide suuport the latest version of the Dirfile Standards, known as Standards
+Version 9.
+
+Standards Version 9 introduces the following:
+  * Two new field types: MPLEX and WINDOW, both meant to deal with extracting a
+    subset of their input.
+  * Field name munging via /INCLUDEs, aliases, and "hidden" names.
+  * Support for zzip-compressed dirfiles, as well as simple compression via an
+    in-built scheme called Sample Index Encoding.
+
+This is the first update to the Dirfile Standards since Standards Version 8
+(November 2010).  A full history of the Dirfile Standards can be found in the
 dirfile-format(5) man page.
 
 
@@ -131,23 +130,39 @@ various data encodings (typically compression schemes).  These are:
 
 - the slim compression library by Joseph Fowler;
 - the zlib library by Jean-loup Gailly and Mark Adler;
-- the bzip2 compression library by Julian Seward; and,
+- the bzip2 compression library by Julian Seward;
 - the lzma library, part of the XZ Utils suite by Lasse Collin, Ville Koskinen,
-  and Igor Pavlov.
+  and Igor Pavlov; and,
+- the zzip library by Tomi Ollila and Guido Draheim.
 
 If these libraries are not found by configure, GetData will lack support for
 the associated encoding scheme and fail gracefully if encountering dirfiles so
 encoded.
 
+Building bindings requires appropriate compilers/interpreters and libraries for
+the various languages.  In particular:
+
+- the C++ bindings require a C++90 compliant compiler
+- the Fortran-77 bindings require a Fortran-77 compliant compiler
+- the Fortran-95 bindings require both a Fortran-95 compliant compiler and a
+  Fortran-77 compiler (because the Fortran-95 bindings are built on top of
+  the Fortran-77 bindings)
+- the IDL bindings require a licenced IDL interpreter, version 5.5 or later;
+  they will not work on an unlicenced interpreter in timed demo mode
+- the MATLAB bindings require both a MATLAB interpreter and a MEX compiler
+- the Perl bindings require a Perl5 interpreter version 5.6 or later, as well
+  as the Math::Complex and Module::Build modules.
+- the Python bindings require Python 2.3 or later.  NumPy is also highly
+  recommended for efficient use.
 
 USING THE LIBRARY
 =================
 
 To use the library in C programs, the header file getdata.h should be included.
-This file declares both the new and legacy APIs.  Programs linking to static
-versions of the GetData library need to be linked against the C Standard Math
-Library, in addition to GetData itself, plus any other libraries required for
-encodings supported by the library, e.g. using `-lgetdata -lm
+This file declares all the various APIs provided by th library.  Programs
+linking to static versions of the GetData library need to be linked against the
+C Standard Math Library, in addition to GetData itself, plus any other libraries
+required for encodings supported by the library, e.g. using `-lgetdata -lm
 <other-libraries>'.
 
 The various small programs in the `util' subdirectory of the package provide
diff --git a/TODO b/TODO
index 88d8b87..43c20fb 100644
--- a/TODO
+++ b/TODO
@@ -1,7 +1,5 @@
-* Perl bindings
 * Locking
 * Hashed compressed files
-* streaming
 * linterp table path munging [MH]
 * Make webpage suck less
-* Handle RW dirfile on RO data better [JPF]
+* Fused multiply-add [CBN]
diff --git a/aclocal.m4 b/aclocal.m4
index a1802c3..a6889c8 100644
--- a/aclocal.m4
+++ b/aclocal.m4
@@ -1,7 +1,8 @@
-# generated automatically by aclocal 1.11.1 -*- Autoconf -*-
+# generated automatically by aclocal 1.11.5 -*- Autoconf -*-
 
 # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
-# 2005, 2006, 2007, 2008, 2009  Free Software Foundation, Inc.
+# 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software Foundation,
+# Inc.
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
@@ -13,18 +14,21 @@
 
 m4_ifndef([AC_AUTOCONF_VERSION],
   [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
-m4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.68],,
-[m4_warning([this file was generated for autoconf 2.68.
+m4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.69],,
+[m4_warning([this file was generated for autoconf 2.69.
 You have another version of autoconf.  It may work, but is not guaranteed to.
 If you have problems, you may need to regenerate the build system entirely.
 To do so, use the procedure documented by the package, typically `autoreconf'.])])
 
-# Copyright (C) 2002, 2003, 2005, 2006, 2007, 2008  Free Software Foundation, Inc.
+# Copyright (C) 2002, 2003, 2005, 2006, 2007, 2008, 2011 Free Software
+# Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
 
+# serial 1
+
 # AM_AUTOMAKE_VERSION(VERSION)
 # ----------------------------
 # Automake X.Y traces this macro to ensure aclocal.m4 has been
@@ -34,7 +38,7 @@ AC_DEFUN([AM_AUTOMAKE_VERSION],
 [am__api_version='1.11'
 dnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to
 dnl require some minimum version.  Point them to the right macro.
-m4_if([$1], [1.11.1], [],
+m4_if([$1], [1.11.5], [],
       [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl
 ])
 
@@ -50,19 +54,43 @@ m4_define([_AM_AUTOCONF_VERSION], [])
 # Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced.
 # This function is AC_REQUIREd by AM_INIT_AUTOMAKE.
 AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
-[AM_AUTOMAKE_VERSION([1.11.1])dnl
+[AM_AUTOMAKE_VERSION([1.11.5])dnl
 m4_ifndef([AC_AUTOCONF_VERSION],
   [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
 _AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))])
 
+# Figure out how to run the assembler.                      -*- Autoconf -*-
+
+# Copyright (C) 2001, 2003, 2004, 2005, 2006  Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# serial 5
+
+# AM_PROG_AS
+# ----------
+AC_DEFUN([AM_PROG_AS],
+[# By default we simply use the C compiler to build assembly code.
+AC_REQUIRE([AC_PROG_CC])
+test "${CCAS+set}" = set || CCAS=$CC
+test "${CCASFLAGS+set}" = set || CCASFLAGS=$CFLAGS
+AC_ARG_VAR([CCAS],      [assembler compiler command (defaults to CC)])
+AC_ARG_VAR([CCASFLAGS], [assembler compiler flags (defaults to CFLAGS)])
+_AM_IF_OPTION([no-dependencies],, [_AM_DEPENDENCIES([CCAS])])dnl
+])
+
 # AM_AUX_DIR_EXPAND                                         -*- Autoconf -*-
 
-# Copyright (C) 2001, 2003, 2005  Free Software Foundation, Inc.
+# Copyright (C) 2001, 2003, 2005, 2011 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
 
+# serial 1
+
 # For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets
 # $ac_aux_dir to `$srcdir/foo'.  In other projects, it is set to
 # `$srcdir', `$srcdir/..', or `$srcdir/../..'.
@@ -144,14 +172,14 @@ AC_CONFIG_COMMANDS_PRE(
 Usually this means the macro was only invoked conditionally.]])
 fi])])
 
-# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2009
-# Free Software Foundation, Inc.
+# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2009,
+# 2010, 2011 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
 
-# serial 10
+# serial 12
 
 # There are a few dirty hacks below to avoid letting `AC_PROG_CC' be
 # written in clear, in which case automake, when reading aclocal.m4,
@@ -191,6 +219,7 @@ AC_CACHE_CHECK([dependency style of $depcc],
   # instance it was reported that on HP-UX the gcc test will end up
   # making a dummy file named `D' -- because `-MD' means `put the output
   # in D'.
+  rm -rf conftest.dir
   mkdir conftest.dir
   # Copy depcomp to subdir because otherwise we won't find it if we're
   # using a relative directory.
@@ -255,7 +284,7 @@ AC_CACHE_CHECK([dependency style of $depcc],
 	break
       fi
       ;;
-    msvisualcpp | msvcmsys)
+    msvc7 | msvc7msys | msvisualcpp | msvcmsys)
       # This compiler won't grok `-c -o', but also, the minuso test has
       # not run yet.  These depmodes are late enough in the game, and
       # so weak that their functioning should not be impacted.
@@ -320,10 +349,13 @@ AC_DEFUN([AM_DEP_TRACK],
 if test "x$enable_dependency_tracking" != xno; then
   am_depcomp="$ac_aux_dir/depcomp"
   AMDEPBACKSLASH='\'
+  am__nodep='_no'
 fi
 AM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno])
 AC_SUBST([AMDEPBACKSLASH])dnl
 _AM_SUBST_NOTMAKE([AMDEPBACKSLASH])dnl
+AC_SUBST([am__nodep])dnl
+_AM_SUBST_NOTMAKE([am__nodep])dnl
 ])
 
 # Generate code to set up dependency tracking.              -*- Autoconf -*-
@@ -545,12 +577,15 @@ for _am_header in $config_headers :; do
 done
 echo "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count])
 
-# Copyright (C) 2001, 2003, 2005, 2008  Free Software Foundation, Inc.
+# Copyright (C) 2001, 2003, 2005, 2008, 2011 Free Software Foundation,
+# Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
 
+# serial 1
+
 # AM_PROG_INSTALL_SH
 # ------------------
 # Define $install_sh.
@@ -682,12 +717,15 @@ else
 fi
 ])
 
-# Copyright (C) 2003, 2004, 2005, 2006  Free Software Foundation, Inc.
+# Copyright (C) 2003, 2004, 2005, 2006, 2011 Free Software Foundation,
+# Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
 
+# serial 1
+
 # AM_PROG_MKDIR_P
 # ---------------
 # Check for `mkdir -p'.
@@ -710,13 +748,14 @@ esac
 
 # Helper functions for option handling.                     -*- Autoconf -*-
 
-# Copyright (C) 2001, 2002, 2003, 2005, 2008  Free Software Foundation, Inc.
+# Copyright (C) 2001, 2002, 2003, 2005, 2008, 2010 Free Software
+# Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
 
-# serial 4
+# serial 5
 
 # _AM_MANGLE_OPTION(NAME)
 # -----------------------
@@ -724,13 +763,13 @@ AC_DEFUN([_AM_MANGLE_OPTION],
 [[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])])
 
 # _AM_SET_OPTION(NAME)
-# ------------------------------
+# --------------------
 # Set option NAME.  Presently that only means defining a flag for this option.
 AC_DEFUN([_AM_SET_OPTION],
 [m4_define(_AM_MANGLE_OPTION([$1]), 1)])
 
 # _AM_SET_OPTIONS(OPTIONS)
-# ----------------------------------
+# ------------------------
 # OPTIONS is a space-separated list of Automake options.
 AC_DEFUN([_AM_SET_OPTIONS],
 [m4_foreach_w([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])])
@@ -741,13 +780,15 @@ AC_DEFUN([_AM_SET_OPTIONS],
 AC_DEFUN([_AM_IF_OPTION],
 [m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])])
 
-# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2008, 2009
-# Free Software Foundation, Inc.
+# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2008, 2009,
+# 2011 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
 
+# serial 2
+
 # AM_PATH_PYTHON([MINIMUM-VERSION], [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
 # ---------------------------------------------------------------------------
 # Adds support for distributing Python modules and packages.  To
@@ -775,8 +816,10 @@ AC_DEFUN([AM_PATH_PYTHON],
   dnl Find a Python interpreter.  Python versions prior to 2.0 are not
   dnl supported. (2.0 was released on October 16, 2000).
   m4_define_default([_AM_PYTHON_INTERPRETER_LIST],
-                    [python python2 python3 python3.0 python2.5 python2.4 python2.3 python2.2 dnl
-python2.1 python2.0])
+[python python2 python3 python3.2 python3.1 python3.0 python2.7 dnl
+ python2.6 python2.5 python2.4 python2.3 python2.2 python2.1 python2.0])
+
+  AC_ARG_VAR([PYTHON], [the Python interpreter])
 
   m4_if([$1],[],[
     dnl No version check is needed.
@@ -848,9 +891,7 @@ python2.1 python2.0])
   dnl   site-packages directory, not the python standard library
   dnl   directory like in previous automake betas.  This behavior
   dnl   is more consistent with lispdir.m4 for example.
-  dnl Query distutils for this directory.  distutils does not exist in
-  dnl Python 1.5, so we fall back to the hardcoded directory if it
-  dnl doesn't work.
+  dnl Query distutils for this directory.
   AC_CACHE_CHECK([for $am_display_PYTHON script directory],
     [am_cv_python_pythondir],
     [if test "x$prefix" = xNONE
@@ -859,8 +900,7 @@ python2.1 python2.0])
      else
        am_py_prefix=$prefix
      fi
-     am_cv_python_pythondir=`$PYTHON -c "import sys; from distutils import sysconfig; sys.stdout.write(sysconfig.get_python_lib(0,0,prefix='$am_py_prefix'))" 2>/dev/null ||
-     echo "$PYTHON_PREFIX/lib/python$PYTHON_VERSION/site-packages"`
+     am_cv_python_pythondir=`$PYTHON -c "import sys; from distutils import sysconfig; sys.stdout.write(sysconfig.get_python_lib(0,0,prefix='$am_py_prefix'))" 2>/dev/null`
      case $am_cv_python_pythondir in
      $am_py_prefix*)
        am__strip_prefix=`echo "$am_py_prefix" | sed 's|.|.|g'`
@@ -886,9 +926,7 @@ python2.1 python2.0])
 
   dnl pyexecdir -- directory for installing python extension modules
   dnl   (shared libraries)
-  dnl Query distutils for this directory.  distutils does not exist in
-  dnl Python 1.5, so we fall back to the hardcoded directory if it
-  dnl doesn't work.
+  dnl Query distutils for this directory.
   AC_CACHE_CHECK([for $am_display_PYTHON extension module directory],
     [am_cv_python_pyexecdir],
     [if test "x$exec_prefix" = xNONE
@@ -897,8 +935,7 @@ python2.1 python2.0])
      else
        am_py_exec_prefix=$exec_prefix
      fi
-     am_cv_python_pyexecdir=`$PYTHON -c "import sys; from distutils import sysconfig; sys.stdout.write(sysconfig.get_python_lib(1,0,prefix='$am_py_exec_prefix'))" 2>/dev/null ||
-     echo "$PYTHON_EXEC_PREFIX/lib/python$PYTHON_VERSION/site-packages"`
+     am_cv_python_pyexecdir=`$PYTHON -c "import sys; from distutils import sysconfig; sys.stdout.write(sysconfig.get_python_lib(1,0,prefix='$am_py_exec_prefix'))" 2>/dev/null`
      case $am_cv_python_pyexecdir in
      $am_py_exec_prefix*)
        am__strip_prefix=`echo "$am_py_exec_prefix" | sed 's|.|.|g'`
@@ -946,12 +983,14 @@ for i in list(range(0, 4)): minverhex = (minverhex << 8) + minver[[i]]
 sys.exit(sys.hexversion < minverhex)"
   AS_IF([AM_RUN_LOG([$1 -c "$prog"])], [$3], [$4])])
 
-# Copyright (C) 2001, 2003, 2005  Free Software Foundation, Inc.
+# Copyright (C) 2001, 2003, 2005, 2011 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
 
+# serial 1
+
 # AM_RUN_LOG(COMMAND)
 # -------------------
 # Run COMMAND, save the exit status in ac_status, and log it.
@@ -1028,12 +1067,14 @@ Check your system clock])
 fi
 AC_MSG_RESULT(yes)])
 
-# Copyright (C) 2001, 2003, 2005  Free Software Foundation, Inc.
+# Copyright (C) 2001, 2003, 2005, 2011 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
 
+# serial 1
+
 # AM_PROG_INSTALL_STRIP
 # ---------------------
 # One issue with vendor `install' (even GNU) is that you can't
@@ -1056,13 +1097,13 @@ fi
 INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s"
 AC_SUBST([INSTALL_STRIP_PROGRAM])])
 
-# Copyright (C) 2006, 2008  Free Software Foundation, Inc.
+# Copyright (C) 2006, 2008, 2010 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
 
-# serial 2
+# serial 3
 
 # _AM_SUBST_NOTMAKE(VARIABLE)
 # ---------------------------
@@ -1071,13 +1112,13 @@ AC_SUBST([INSTALL_STRIP_PROGRAM])])
 AC_DEFUN([_AM_SUBST_NOTMAKE])
 
 # AM_SUBST_NOTMAKE(VARIABLE)
-# ---------------------------
+# --------------------------
 # Public sister of _AM_SUBST_NOTMAKE.
 AC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)])
 
 # Check how to create a tarball.                            -*- Autoconf -*-
 
-# Copyright (C) 2004, 2005  Free Software Foundation, Inc.
+# Copyright (C) 2004, 2005, 2012 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -1099,10 +1140,11 @@ AC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)])
 # a tarball read from stdin.
 #     $(am__untar) < result.tar
 AC_DEFUN([_AM_PROG_TAR],
-[# Always define AMTAR for backward compatibility.
-AM_MISSING_PROG([AMTAR], [tar])
+[# Always define AMTAR for backward compatibility.  Yes, it's still used
+# in the wild :-(  We should find a proper way to deprecate it ...
+AC_SUBST([AMTAR], ['$${TAR-tar}'])
 m4_if([$1], [v7],
-     [am__tar='${AMTAR} chof - "$$tardir"'; am__untar='${AMTAR} xf -'],
+     [am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -'],
      [m4_case([$1], [ustar],, [pax],,
               [m4_fatal([Unknown tar format])])
 AC_MSG_CHECKING([how to create a $1 tar archive])
@@ -1174,11 +1216,14 @@ AC_SUBST([am__untar])
 m4_include([m4/ax_compare_version.m4])
 m4_include([m4/compiler.m4])
 m4_include([m4/encoding.m4])
+m4_include([m4/floatordering.m4])
 m4_include([m4/idl.m4])
 m4_include([m4/libtool.m4])
 m4_include([m4/ltoptions.m4])
 m4_include([m4/ltsugar.m4])
 m4_include([m4/ltversion.m4])
 m4_include([m4/lt~obsolete.m4])
+m4_include([m4/matlab.m4])
+m4_include([m4/perl.m4])
 m4_include([m4/python.m4])
 m4_include([m4/win32.m4])
diff --git a/bindings/Makefile.am b/bindings/Makefile.am
index d562f99..df53b0f 100644
--- a/bindings/Makefile.am
+++ b/bindings/Makefile.am
@@ -34,19 +34,30 @@ if MAKE_IDLBINDINGS
 IDL_SUBDIR=idl
 endif
 
+if MAKE_MATLABBINDINGS
+MATLAB_SUBDIR=matlab
+endif
+
 if MAKE_PYBINDINGS
 PY_SUBDIR=python
 endif
 
+if MAKE_PERLBINDINGS
+PERL_SUBDIR=perl
+endif
+
 noinst_PROGRAMS=make_parameters
 
 make_parameters_SOURCES = make_parameters.c
-nodist_make_parameters_SOURCES = ../src/getdata.h
+nodist_make_parameters_SOURCES = ../src/getdata.h ../src/gd_config.h
 
-SUBDIRS = . ${F77_SUBDIR} ${CXX_SUBDIR} ${PY_SUBDIR} ${IDL_SUBDIR}
+SUBDIRS = . ${F77_SUBDIR} ${CXX_SUBDIR} ${IDL_SUBDIR} ${MATLAB_SUBDIR} \
+					${PY_SUBDIR} ${PERL_SUBDIR}
 
-make_parameters$(EXEEXT): $(make_parameters_SOURCES) $(nodist_make_parameters_SOURCES)
-	${BUILDCC} -I../src -o make_parameters$(EXEEXT) $(srcdir)/$(make_parameters_SOURCES)
+make_parameters$(EXEEXT): $(make_parameters_SOURCES) \
+				    $(nodist_make_parameters_SOURCES)
+	${BUILDCC} $(DEFS) -I../src -o make_parameters$(EXEEXT) \
+		$(srcdir)/$(make_parameters_SOURCES)
 
 clean-local:
 	rm -rf *~ 
diff --git a/bindings/Makefile.in b/bindings/Makefile.in
index 0b7064a..afb188f 100644
--- a/bindings/Makefile.in
+++ b/bindings/Makefile.in
@@ -1,9 +1,9 @@
-# Makefile.in generated by automake 1.11.1 from Makefile.am.
+# Makefile.in generated by automake 1.11.5 from Makefile.am.
 # @configure_input@
 
 # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005, 2006, 2007, 2008, 2009  Free Software Foundation,
-# Inc.
+# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software
+# Foundation, Inc.
 # This Makefile.in is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
@@ -16,6 +16,23 @@
 @SET_MAKE@
 
 VPATH = @srcdir@
+am__make_dryrun = \
+  { \
+    am__dry=no; \
+    case $$MAKEFLAGS in \
+      *\\[\ \	]*) \
+        echo 'am--echo: ; @echo "AM"  OK' | $(MAKE) -f - 2>/dev/null \
+          | grep '^AM OK$$' >/dev/null || am__dry=yes;; \
+      *) \
+        for am__flg in $$MAKEFLAGS; do \
+          case $$am__flg in \
+            *=*|--*) ;; \
+            *n*) am__dry=yes; break;; \
+          esac; \
+        done;; \
+    esac; \
+    test $$am__dry = yes; \
+  }
 pkgdatadir = $(datadir)/@PACKAGE@
 pkgincludedir = $(includedir)/@PACKAGE@
 pkglibdir = $(libdir)/@PACKAGE@
@@ -40,15 +57,17 @@ DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
 am__aclocal_m4_deps = $(top_srcdir)/m4/ax_compare_version.m4 \
 	$(top_srcdir)/m4/compiler.m4 $(top_srcdir)/m4/encoding.m4 \
-	$(top_srcdir)/m4/idl.m4 $(top_srcdir)/m4/libtool.m4 \
-	$(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \
-	$(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \
-	$(top_srcdir)/m4/python.m4 $(top_srcdir)/m4/win32.m4 \
-	$(top_srcdir)/m4/version.m4 $(top_srcdir)/configure.ac
+	$(top_srcdir)/m4/floatordering.m4 $(top_srcdir)/m4/idl.m4 \
+	$(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \
+	$(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \
+	$(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/m4/matlab.m4 \
+	$(top_srcdir)/m4/perl.m4 $(top_srcdir)/m4/python.m4 \
+	$(top_srcdir)/m4/win32.m4 $(top_srcdir)/m4/version.m4 \
+	$(top_srcdir)/configure.ac
 am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
 	$(ACLOCAL_M4)
 mkinstalldirs = $(install_sh) -d
-CONFIG_HEADER = $(top_builddir)/src/config.h \
+CONFIG_HEADER = $(top_builddir)/src/gd_config.h \
 	$(top_builddir)/src/getdata.h
 CONFIG_CLEAN_FILES =
 CONFIG_CLEAN_VPATH_FILES =
@@ -80,6 +99,11 @@ RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \
 	install-pdf-recursive install-ps-recursive install-recursive \
 	installcheck-recursive installdirs-recursive pdf-recursive \
 	ps-recursive uninstall-recursive
+am__can_run_installinfo = \
+  case $$AM_UPDATE_INFO_DIR in \
+    n|no|NO) false;; \
+    *) (install-info --version) >/dev/null 2>&1;; \
+  esac
 RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive	\
   distclean-recursive maintainer-clean-recursive
 AM_RECURSIVE_TARGETS = $(RECURSIVE_TARGETS:-recursive=) \
@@ -87,7 +111,7 @@ AM_RECURSIVE_TARGETS = $(RECURSIVE_TARGETS:-recursive=) \
 	distdir
 ETAGS = etags
 CTAGS = ctags
-DIST_SUBDIRS = . f77 cxx python idl
+DIST_SUBDIRS = . f77 cxx idl matlab python perl
 DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
 am__relativize = \
   dir0=`pwd`; \
@@ -122,10 +146,13 @@ AUTOHEADER = @AUTOHEADER@
 AUTOMAKE = @AUTOMAKE@
 AWK = @AWK@
 BUILDCC = @BUILDCC@
-BUILD_DATE = @BUILD_DATE@
 BZIP2_CPPFLAGS = @BZIP2_CPPFLAGS@
 BZIP2_LDFLAGS = @BZIP2_LDFLAGS@
+BZIP2_LIBS = @BZIP2_LIBS@
 CC = @CC@
+CCAS = @CCAS@
+CCASDEPMODE = @CCASDEPMODE@
+CCASFLAGS = @CCASFLAGS@
 CCDEPMODE = @CCDEPMODE@
 CFLAGS = @CFLAGS@
 CPP = @CPP@
@@ -141,6 +168,7 @@ DEFINE_GD_NO_C99_API = @DEFINE_GD_NO_C99_API@
 DEFINE_gd_int16_t = @DEFINE_gd_int16_t@
 DEFINE_gd_int64_t = @DEFINE_gd_int64_t@
 DEFINE_gd_uint16_t = @DEFINE_gd_uint16_t@
+DEFINE_gd_uint64_t = @DEFINE_gd_uint64_t@
 DEFS = @DEFS@
 DEPDIR = @DEPDIR@
 DIFF = @DIFF@
@@ -161,13 +189,21 @@ FFLAGS = @FFLAGS@
 FGETDATA_VERSION = @FGETDATA_VERSION@
 FGREP = @FGREP@
 FLIBS = @FLIBS@
+GD_DIRSEP = @GD_DIRSEP@
+GD_FDIRSEP = @GD_FDIRSEP@
 GETDATAXX_VERSION = @GETDATAXX_VERSION@
+GETDATA_DEBUG = @GETDATA_DEBUG@
 GETDATA_IFACE_AGE = @GETDATA_IFACE_AGE@
 GETDATA_IFACE_VERSION = @GETDATA_IFACE_VERSION@
 GETDATA_IMPL_REVISION = @GETDATA_IMPL_REVISION@
+GETDATA_MAJOR = @GETDATA_MAJOR@
+GETDATA_MINOR = @GETDATA_MINOR@
+GETDATA_REVISION = @GETDATA_REVISION@
+GETDATA_VERSION_SUFFIX = @GETDATA_VERSION_SUFFIX@
 GREP = @GREP@
 GZIP_CPPFLAGS = @GZIP_CPPFLAGS@
 GZIP_LDFLAGS = @GZIP_LDFLAGS@
+GZIP_LIBS = @GZIP_LIBS@
 IDL = @IDL@
 IDL_CFLAGS = @IDL_CFLAGS@
 IDL_LIBS = @IDL_LIBS@
@@ -190,8 +226,13 @@ LTDLINCL = @LTDLINCL@
 LTLIBOBJS = @LTLIBOBJS@
 LZMA_CPPFLAGS = @LZMA_CPPFLAGS@
 LZMA_LDFLAGS = @LZMA_LDFLAGS@
+LZMA_LIBS = @LZMA_LIBS@
 MAKEINFO = @MAKEINFO@
 MANIFEST_TOOL = @MANIFEST_TOOL@
+MATLAB = @MATLAB@
+MATLABGETDATA_VERSION = @MATLABGETDATA_VERSION@
+MATLAB_CPPFLAGS = @MATLAB_CPPFLAGS@
+MEX = @MEX@
 MKDIR_P = @MKDIR_P@
 NM = @NM@
 NMEDIT = @NMEDIT@
@@ -208,6 +249,9 @@ PACKAGE_TARNAME = @PACKAGE_TARNAME@
 PACKAGE_URL = @PACKAGE_URL@
 PACKAGE_VERSION = @PACKAGE_VERSION@
 PATH_SEPARATOR = @PATH_SEPARATOR@
+PERL = @PERL@
+PERL_MAN3EXT = @PERL_MAN3EXT@
+PRINTF = @PRINTF@
 PRIVATE_LIBS = @PRIVATE_LIBS@
 PYTHON = @PYTHON@
 PYTHON_CPPFLAGS = @PYTHON_CPPFLAGS@
@@ -219,8 +263,12 @@ SET_MAKE = @SET_MAKE@
 SHELL = @SHELL@
 SLIM_CPPFLAGS = @SLIM_CPPFLAGS@
 SLIM_LDFLAGS = @SLIM_LDFLAGS@
+SLIM_LIBS = @SLIM_LIBS@
 STRIP = @STRIP@
 VERSION = @VERSION@
+ZZIP_CPPFLAGS = @ZZIP_CPPFLAGS@
+ZZIP_LDFLAGS = @ZZIP_LDFLAGS@
+ZZIP_LIBS = @ZZIP_LIBS@
 abs_builddir = @abs_builddir@
 abs_srcdir = @abs_srcdir@
 abs_top_builddir = @abs_top_builddir@
@@ -264,6 +312,8 @@ libexecdir = @libexecdir@
 localedir = @localedir@
 localstatedir = @localstatedir@
 mandir = @mandir@
+matlabbasedir = @matlabbasedir@
+mexext = @mexext@
 mkdir_p = @mkdir_p@
 moduledir = @moduledir@
 oldincludedir = @oldincludedir@
@@ -273,8 +323,12 @@ path_gunzip = @path_gunzip@
 path_gzip = @path_gzip@
 path_slim = @path_slim@
 path_unslim = @path_unslim@
+path_unzip = @path_unzip@
 path_xz = @path_xz@
+path_zip = @path_zip@
 pdfdir = @pdfdir@
+perldir = @perldir@
+perlmandir = @perlmandir@
 prefix = @prefix@
 program_transform_name = @program_transform_name@
 psdir = @psdir@
@@ -312,10 +366,14 @@ AUTOMAKE_OPTIONS = foreign
 @MAKE_CXXBINDINGS_TRUE at CXX_SUBDIR = cxx
 @MAKE_F77BINDINGS_TRUE at F77_SUBDIR = f77
 @MAKE_IDLBINDINGS_TRUE at IDL_SUBDIR = idl
+ at MAKE_MATLABBINDINGS_TRUE@MATLAB_SUBDIR = matlab
 @MAKE_PYBINDINGS_TRUE at PY_SUBDIR = python
+ at MAKE_PERLBINDINGS_TRUE@PERL_SUBDIR = perl
 make_parameters_SOURCES = make_parameters.c
-nodist_make_parameters_SOURCES = ../src/getdata.h
-SUBDIRS = . ${F77_SUBDIR} ${CXX_SUBDIR} ${PY_SUBDIR} ${IDL_SUBDIR}
+nodist_make_parameters_SOURCES = ../src/getdata.h ../src/gd_config.h
+SUBDIRS = . ${F77_SUBDIR} ${CXX_SUBDIR} ${IDL_SUBDIR} ${MATLAB_SUBDIR} \
+					${PY_SUBDIR} ${PERL_SUBDIR}
+
 all: all-recursive
 
 .SUFFIXES:
@@ -562,13 +620,10 @@ distdir: $(DISTFILES)
 	done
 	@list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
 	  if test "$$subdir" = .; then :; else \
-	    test -d "$(distdir)/$$subdir" \
-	    || $(MKDIR_P) "$(distdir)/$$subdir" \
-	    || exit 1; \
-	  fi; \
-	done
-	@list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
-	  if test "$$subdir" = .; then :; else \
+	    $(am__make_dryrun) \
+	      || test -d "$(distdir)/$$subdir" \
+	      || $(MKDIR_P) "$(distdir)/$$subdir" \
+	      || exit 1; \
 	    dir1=$$subdir; dir2="$(distdir)/$$subdir"; \
 	    $(am__relativize); \
 	    new_distdir=$$reldir; \
@@ -603,10 +658,15 @@ install-am: all-am
 
 installcheck: installcheck-recursive
 install-strip:
-	$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
-	  install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
-	  `test -z '$(STRIP)' || \
-	    echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+	if test -z '$(STRIP)'; then \
+	  $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+	    install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+	      install; \
+	else \
+	  $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+	    install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+	    "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
+	fi
 mostlyclean-generic:
 
 clean-generic:
@@ -708,8 +768,10 @@ uninstall-am:
 	tags tags-recursive uninstall uninstall-am
 
 
-make_parameters$(EXEEXT): $(make_parameters_SOURCES) $(nodist_make_parameters_SOURCES)
-	${BUILDCC} -I../src -o make_parameters$(EXEEXT) $(srcdir)/$(make_parameters_SOURCES)
+make_parameters$(EXEEXT): $(make_parameters_SOURCES) \
+				    $(nodist_make_parameters_SOURCES)
+	${BUILDCC} $(DEFS) -I../src -o make_parameters$(EXEEXT) \
+		$(srcdir)/$(make_parameters_SOURCES)
 
 clean-local:
 	rm -rf *~ 
diff --git a/bindings/cxx/Makefile.am b/bindings/cxx/Makefile.am
index 98a6710..0128e0b 100644
--- a/bindings/cxx/Makefile.am
+++ b/bindings/cxx/Makefile.am
@@ -1,4 +1,4 @@
-# Copyright (C) 2008-2010 D. V. Wiebe
+# Copyright (C) 2008-2012 D. V. Wiebe
 #
 ##########################################################################
 #
@@ -30,6 +30,7 @@ WEXTRA=-Wextra
 endif
 
 INCLUDES = ${WALL} $(WEXTRA) -I$(top_srcdir)/src
+LIBS=
 
 SUBDIRS=test
 
@@ -40,18 +41,19 @@ getdata_include_HEADERS = getdata/dirfile.h getdata/entry.h getdata/rawentry.h \
 													getdata/stringentry.h getdata/indexentry.h \
 													getdata/sbitentry.h getdata/polynomentry.h \
 													getdata/fragment.h getdata/divideentry.h \
-													getdata/recipentry.h getdata/carrayentry.h
+													getdata/recipentry.h getdata/carrayentry.h \
+													getdata/windowentry.h getdata/mplexentry.h
 
 lib_LTLIBRARIES=libgetdata++.la
 libgetdata___la_SOURCES = dirfile.cpp bitentry.cpp carrayentry.cpp \
 													constentry.cpp divideentry.cpp entry.cpp \
 													fragment.cpp indexentry.cpp lincomentry.cpp \
-													linterpentry.cpp multiplyentry.cpp phaseentry.cpp \
-													polynomentry.cpp rawentry.cpp recipentry.cpp \
-													sbitentry.cpp stringentry.cpp \
-													${getdata_include_HEADERS}
+													linterpentry.cpp mplexentry.cpp multiplyentry.cpp \
+													phaseentry.cpp polynomentry.cpp rawentry.cpp \
+													recipentry.cpp sbitentry.cpp stringentry.cpp \
+													windowentry.cpp ${getdata_include_HEADERS} internal.h
 libgetdata___la_LIBADD=../../src/libgetdata.la
 libgetdata___la_LDFLAGS = -version-info @GETDATAXX_VERSION@
 
 clean-local:
-	rm -rvf *~ getdata/*~
+	rm -rf *~ getdata/*~
diff --git a/bindings/cxx/Makefile.in b/bindings/cxx/Makefile.in
index 27f6d41..248fb69 100644
--- a/bindings/cxx/Makefile.in
+++ b/bindings/cxx/Makefile.in
@@ -1,9 +1,9 @@
-# Makefile.in generated by automake 1.11.1 from Makefile.am.
+# Makefile.in generated by automake 1.11.5 from Makefile.am.
 # @configure_input@
 
 # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005, 2006, 2007, 2008, 2009  Free Software Foundation,
-# Inc.
+# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software
+# Foundation, Inc.
 # This Makefile.in is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
@@ -17,6 +17,23 @@
 
 
 VPATH = @srcdir@
+am__make_dryrun = \
+  { \
+    am__dry=no; \
+    case $$MAKEFLAGS in \
+      *\\[\ \	]*) \
+        echo 'am--echo: ; @echo "AM"  OK' | $(MAKE) -f - 2>/dev/null \
+          | grep '^AM OK$$' >/dev/null || am__dry=yes;; \
+      *) \
+        for am__flg in $$MAKEFLAGS; do \
+          case $$am__flg in \
+            *=*|--*) ;; \
+            *n*) am__dry=yes; break;; \
+          esac; \
+        done;; \
+    esac; \
+    test $$am__dry = yes; \
+  }
 pkgdatadir = $(datadir)/@PACKAGE@
 pkgincludedir = $(includedir)/@PACKAGE@
 pkglibdir = $(libdir)/@PACKAGE@
@@ -41,15 +58,17 @@ DIST_COMMON = $(getdata_include_HEADERS) $(srcdir)/Makefile.am \
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
 am__aclocal_m4_deps = $(top_srcdir)/m4/ax_compare_version.m4 \
 	$(top_srcdir)/m4/compiler.m4 $(top_srcdir)/m4/encoding.m4 \
-	$(top_srcdir)/m4/idl.m4 $(top_srcdir)/m4/libtool.m4 \
-	$(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \
-	$(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \
-	$(top_srcdir)/m4/python.m4 $(top_srcdir)/m4/win32.m4 \
-	$(top_srcdir)/m4/version.m4 $(top_srcdir)/configure.ac
+	$(top_srcdir)/m4/floatordering.m4 $(top_srcdir)/m4/idl.m4 \
+	$(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \
+	$(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \
+	$(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/m4/matlab.m4 \
+	$(top_srcdir)/m4/perl.m4 $(top_srcdir)/m4/python.m4 \
+	$(top_srcdir)/m4/win32.m4 $(top_srcdir)/m4/version.m4 \
+	$(top_srcdir)/configure.ac
 am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
 	$(ACLOCAL_M4)
 mkinstalldirs = $(install_sh) -d
-CONFIG_HEADER = $(top_builddir)/src/config.h \
+CONFIG_HEADER = $(top_builddir)/src/gd_config.h \
 	$(top_builddir)/src/getdata.h
 CONFIG_CLEAN_FILES =
 CONFIG_CLEAN_VPATH_FILES =
@@ -74,6 +93,12 @@ am__nobase_list = $(am__nobase_strip_setup); \
 am__base_list = \
   sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \
   sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
+am__uninstall_files_from_dir = { \
+  test -z "$$files" \
+    || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \
+    || { echo " ( cd '$$dir' && rm -f" $$files ")"; \
+         $(am__cd) "$$dir" && rm -f $$files; }; \
+  }
 am__installdirs = "$(DESTDIR)$(libdir)" \
 	"$(DESTDIR)$(getdata_includedir)"
 LTLIBRARIES = $(lib_LTLIBRARIES)
@@ -81,9 +106,10 @@ libgetdata___la_DEPENDENCIES = ../../src/libgetdata.la
 am__objects_1 =
 am_libgetdata___la_OBJECTS = dirfile.lo bitentry.lo carrayentry.lo \
 	constentry.lo divideentry.lo entry.lo fragment.lo \
-	indexentry.lo lincomentry.lo linterpentry.lo multiplyentry.lo \
-	phaseentry.lo polynomentry.lo rawentry.lo recipentry.lo \
-	sbitentry.lo stringentry.lo $(am__objects_1)
+	indexentry.lo lincomentry.lo linterpentry.lo mplexentry.lo \
+	multiplyentry.lo phaseentry.lo polynomentry.lo rawentry.lo \
+	recipentry.lo sbitentry.lo stringentry.lo windowentry.lo \
+	$(am__objects_1)
 libgetdata___la_OBJECTS = $(am_libgetdata___la_OBJECTS)
 libgetdata___la_LINK = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) \
 	$(LIBTOOLFLAGS) --mode=link $(CXXLD) $(AM_CXXFLAGS) \
@@ -119,6 +145,11 @@ RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \
 	install-pdf-recursive install-ps-recursive install-recursive \
 	installcheck-recursive installdirs-recursive pdf-recursive \
 	ps-recursive uninstall-recursive
+am__can_run_installinfo = \
+  case $$AM_UPDATE_INFO_DIR in \
+    n|no|NO) false;; \
+    *) (install-info --version) >/dev/null 2>&1;; \
+  esac
 HEADERS = $(getdata_include_HEADERS)
 RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive	\
   distclean-recursive maintainer-clean-recursive
@@ -162,10 +193,13 @@ AUTOHEADER = @AUTOHEADER@
 AUTOMAKE = @AUTOMAKE@
 AWK = @AWK@
 BUILDCC = @BUILDCC@
-BUILD_DATE = @BUILD_DATE@
 BZIP2_CPPFLAGS = @BZIP2_CPPFLAGS@
 BZIP2_LDFLAGS = @BZIP2_LDFLAGS@
+BZIP2_LIBS = @BZIP2_LIBS@
 CC = @CC@
+CCAS = @CCAS@
+CCASDEPMODE = @CCASDEPMODE@
+CCASFLAGS = @CCASFLAGS@
 CCDEPMODE = @CCDEPMODE@
 CFLAGS = @CFLAGS@
 CPP = @CPP@
@@ -181,6 +215,7 @@ DEFINE_GD_NO_C99_API = @DEFINE_GD_NO_C99_API@
 DEFINE_gd_int16_t = @DEFINE_gd_int16_t@
 DEFINE_gd_int64_t = @DEFINE_gd_int64_t@
 DEFINE_gd_uint16_t = @DEFINE_gd_uint16_t@
+DEFINE_gd_uint64_t = @DEFINE_gd_uint64_t@
 DEFS = @DEFS@
 DEPDIR = @DEPDIR@
 DIFF = @DIFF@
@@ -201,13 +236,21 @@ FFLAGS = @FFLAGS@
 FGETDATA_VERSION = @FGETDATA_VERSION@
 FGREP = @FGREP@
 FLIBS = @FLIBS@
+GD_DIRSEP = @GD_DIRSEP@
+GD_FDIRSEP = @GD_FDIRSEP@
 GETDATAXX_VERSION = @GETDATAXX_VERSION@
+GETDATA_DEBUG = @GETDATA_DEBUG@
 GETDATA_IFACE_AGE = @GETDATA_IFACE_AGE@
 GETDATA_IFACE_VERSION = @GETDATA_IFACE_VERSION@
 GETDATA_IMPL_REVISION = @GETDATA_IMPL_REVISION@
+GETDATA_MAJOR = @GETDATA_MAJOR@
+GETDATA_MINOR = @GETDATA_MINOR@
+GETDATA_REVISION = @GETDATA_REVISION@
+GETDATA_VERSION_SUFFIX = @GETDATA_VERSION_SUFFIX@
 GREP = @GREP@
 GZIP_CPPFLAGS = @GZIP_CPPFLAGS@
 GZIP_LDFLAGS = @GZIP_LDFLAGS@
+GZIP_LIBS = @GZIP_LIBS@
 IDL = @IDL@
 IDL_CFLAGS = @IDL_CFLAGS@
 IDL_LIBS = @IDL_LIBS@
@@ -221,7 +264,7 @@ LD = @LD@
 LDFLAGS = @LDFLAGS@
 LIBLTDL = @LIBLTDL@
 LIBOBJS = @LIBOBJS@
-LIBS = @LIBS@
+LIBS = 
 LIBTOOL = @LIBTOOL@
 LIBTOOL_DEPS = @LIBTOOL_DEPS@
 LIPO = @LIPO@
@@ -230,8 +273,13 @@ LTDLINCL = @LTDLINCL@
 LTLIBOBJS = @LTLIBOBJS@
 LZMA_CPPFLAGS = @LZMA_CPPFLAGS@
 LZMA_LDFLAGS = @LZMA_LDFLAGS@
+LZMA_LIBS = @LZMA_LIBS@
 MAKEINFO = @MAKEINFO@
 MANIFEST_TOOL = @MANIFEST_TOOL@
+MATLAB = @MATLAB@
+MATLABGETDATA_VERSION = @MATLABGETDATA_VERSION@
+MATLAB_CPPFLAGS = @MATLAB_CPPFLAGS@
+MEX = @MEX@
 MKDIR_P = @MKDIR_P@
 NM = @NM@
 NMEDIT = @NMEDIT@
@@ -248,6 +296,9 @@ PACKAGE_TARNAME = @PACKAGE_TARNAME@
 PACKAGE_URL = @PACKAGE_URL@
 PACKAGE_VERSION = @PACKAGE_VERSION@
 PATH_SEPARATOR = @PATH_SEPARATOR@
+PERL = @PERL@
+PERL_MAN3EXT = @PERL_MAN3EXT@
+PRINTF = @PRINTF@
 PRIVATE_LIBS = @PRIVATE_LIBS@
 PYTHON = @PYTHON@
 PYTHON_CPPFLAGS = @PYTHON_CPPFLAGS@
@@ -259,8 +310,12 @@ SET_MAKE = @SET_MAKE@
 SHELL = @SHELL@
 SLIM_CPPFLAGS = @SLIM_CPPFLAGS@
 SLIM_LDFLAGS = @SLIM_LDFLAGS@
+SLIM_LIBS = @SLIM_LIBS@
 STRIP = @STRIP@
 VERSION = @VERSION@
+ZZIP_CPPFLAGS = @ZZIP_CPPFLAGS@
+ZZIP_LDFLAGS = @ZZIP_LDFLAGS@
+ZZIP_LIBS = @ZZIP_LIBS@
 abs_builddir = @abs_builddir@
 abs_srcdir = @abs_srcdir@
 abs_top_builddir = @abs_top_builddir@
@@ -304,6 +359,8 @@ libexecdir = @libexecdir@
 localedir = @localedir@
 localstatedir = @localstatedir@
 mandir = @mandir@
+matlabbasedir = @matlabbasedir@
+mexext = @mexext@
 mkdir_p = @mkdir_p@
 moduledir = @moduledir@
 oldincludedir = @oldincludedir@
@@ -313,8 +370,12 @@ path_gunzip = @path_gunzip@
 path_gzip = @path_gzip@
 path_slim = @path_slim@
 path_unslim = @path_unslim@
+path_unzip = @path_unzip@
 path_xz = @path_xz@
+path_zip = @path_zip@
 pdfdir = @pdfdir@
+perldir = @perldir@
+perlmandir = @perlmandir@
 prefix = @prefix@
 program_transform_name = @program_transform_name@
 psdir = @psdir@
@@ -328,7 +389,7 @@ top_build_prefix = @top_build_prefix@
 top_builddir = @top_builddir@
 top_srcdir = @top_srcdir@
 
-# Copyright (C) 2008-2010 D. V. Wiebe
+# Copyright (C) 2008-2012 D. V. Wiebe
 #
 ##########################################################################
 #
@@ -361,16 +422,17 @@ getdata_include_HEADERS = getdata/dirfile.h getdata/entry.h getdata/rawentry.h \
 													getdata/stringentry.h getdata/indexentry.h \
 													getdata/sbitentry.h getdata/polynomentry.h \
 													getdata/fragment.h getdata/divideentry.h \
-													getdata/recipentry.h getdata/carrayentry.h
+													getdata/recipentry.h getdata/carrayentry.h \
+													getdata/windowentry.h getdata/mplexentry.h
 
 lib_LTLIBRARIES = libgetdata++.la
 libgetdata___la_SOURCES = dirfile.cpp bitentry.cpp carrayentry.cpp \
 													constentry.cpp divideentry.cpp entry.cpp \
 													fragment.cpp indexentry.cpp lincomentry.cpp \
-													linterpentry.cpp multiplyentry.cpp phaseentry.cpp \
-													polynomentry.cpp rawentry.cpp recipentry.cpp \
-													sbitentry.cpp stringentry.cpp \
-													${getdata_include_HEADERS}
+													linterpentry.cpp mplexentry.cpp multiplyentry.cpp \
+													phaseentry.cpp polynomentry.cpp rawentry.cpp \
+													recipentry.cpp sbitentry.cpp stringentry.cpp \
+													windowentry.cpp ${getdata_include_HEADERS} internal.h
 
 libgetdata___la_LIBADD = ../../src/libgetdata.la
 libgetdata___la_LDFLAGS = -version-info @GETDATAXX_VERSION@
@@ -410,7 +472,6 @@ $(ACLOCAL_M4):  $(am__aclocal_m4_deps)
 $(am__aclocal_m4_deps):
 install-libLTLIBRARIES: $(lib_LTLIBRARIES)
 	@$(NORMAL_INSTALL)
-	test -z "$(libdir)" || $(MKDIR_P) "$(DESTDIR)$(libdir)"
 	@list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \
 	list2=; for p in $$list; do \
 	  if test -f $$p; then \
@@ -418,6 +479,8 @@ install-libLTLIBRARIES: $(lib_LTLIBRARIES)
 	  else :; fi; \
 	done; \
 	test -z "$$list2" || { \
+	  echo " $(MKDIR_P) '$(DESTDIR)$(libdir)'"; \
+	  $(MKDIR_P) "$(DESTDIR)$(libdir)" || exit 1; \
 	  echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(libdir)'"; \
 	  $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(libdir)"; \
 	}
@@ -439,7 +502,7 @@ clean-libLTLIBRARIES:
 	  echo "rm -f \"$${dir}/so_locations\""; \
 	  rm -f "$${dir}/so_locations"; \
 	done
-libgetdata++.la: $(libgetdata___la_OBJECTS) $(libgetdata___la_DEPENDENCIES) 
+libgetdata++.la: $(libgetdata___la_OBJECTS) $(libgetdata___la_DEPENDENCIES) $(EXTRA_libgetdata___la_DEPENDENCIES) 
 	$(libgetdata___la_LINK) -rpath $(libdir) $(libgetdata___la_OBJECTS) $(libgetdata___la_LIBADD) $(LIBS)
 
 mostlyclean-compile:
@@ -458,6 +521,7 @@ distclean-compile:
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/indexentry.Plo at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/lincomentry.Plo at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/linterpentry.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/mplexentry.Plo at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/multiplyentry.Plo at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/phaseentry.Plo at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/polynomentry.Plo at am__quote@
@@ -465,6 +529,7 @@ distclean-compile:
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/recipentry.Plo at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/sbitentry.Plo at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/stringentry.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/windowentry.Plo at am__quote@
 
 .cpp.o:
 @am__fastdepCXX_TRUE@	$(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
@@ -494,8 +559,11 @@ clean-libtool:
 	-rm -rf .libs _libs
 install-getdata_includeHEADERS: $(getdata_include_HEADERS)
 	@$(NORMAL_INSTALL)
-	test -z "$(getdata_includedir)" || $(MKDIR_P) "$(DESTDIR)$(getdata_includedir)"
 	@list='$(getdata_include_HEADERS)'; test -n "$(getdata_includedir)" || list=; \
+	if test -n "$$list"; then \
+	  echo " $(MKDIR_P) '$(DESTDIR)$(getdata_includedir)'"; \
+	  $(MKDIR_P) "$(DESTDIR)$(getdata_includedir)" || exit 1; \
+	fi; \
 	for p in $$list; do \
 	  if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
 	  echo "$$d$$p"; \
@@ -509,9 +577,7 @@ uninstall-getdata_includeHEADERS:
 	@$(NORMAL_UNINSTALL)
 	@list='$(getdata_include_HEADERS)'; test -n "$(getdata_includedir)" || list=; \
 	files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \
-	test -n "$$files" || exit 0; \
-	echo " ( cd '$(DESTDIR)$(getdata_includedir)' && rm -f" $$files ")"; \
-	cd "$(DESTDIR)$(getdata_includedir)" && rm -f $$files
+	dir='$(DESTDIR)$(getdata_includedir)'; $(am__uninstall_files_from_dir)
 
 # This directory's subdirectories are mostly independent; you can cd
 # into them and run `make' without going through this Makefile.
@@ -680,13 +746,10 @@ distdir: $(DISTFILES)
 	done
 	@list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
 	  if test "$$subdir" = .; then :; else \
-	    test -d "$(distdir)/$$subdir" \
-	    || $(MKDIR_P) "$(distdir)/$$subdir" \
-	    || exit 1; \
-	  fi; \
-	done
-	@list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
-	  if test "$$subdir" = .; then :; else \
+	    $(am__make_dryrun) \
+	      || test -d "$(distdir)/$$subdir" \
+	      || $(MKDIR_P) "$(distdir)/$$subdir" \
+	      || exit 1; \
 	    dir1=$$subdir; dir2="$(distdir)/$$subdir"; \
 	    $(am__relativize); \
 	    new_distdir=$$reldir; \
@@ -724,10 +787,15 @@ install-am: all-am
 
 installcheck: installcheck-recursive
 install-strip:
-	$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
-	  install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
-	  `test -z '$(STRIP)' || \
-	    echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+	if test -z '$(STRIP)'; then \
+	  $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+	    install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+	      install; \
+	else \
+	  $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+	    install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+	    "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
+	fi
 mostlyclean-generic:
 
 clean-generic:
@@ -833,7 +901,7 @@ uninstall-am: uninstall-getdata_includeHEADERS \
 
 
 clean-local:
-	rm -rvf *~ getdata/*~
+	rm -rf *~ getdata/*~
 
 # Tell versions [3.59,3.63) of GNU make to not export all variables.
 # Otherwise a system limit (for SysV at least) may be exceeded.
diff --git a/bindings/cxx/bitentry.cpp b/bindings/cxx/bitentry.cpp
index a7439be..a3cdd05 100644
--- a/bindings/cxx/bitentry.cpp
+++ b/bindings/cxx/bitentry.cpp
@@ -1,4 +1,4 @@
-// Copyright (C) 2008-2010 D. V. Wiebe
+// Copyright (C) 2008-2011 D. V. Wiebe
 //
 ///////////////////////////////////////////////////////////////////////////
 //
@@ -18,19 +18,10 @@
 // along with GetData; if not, write to the Free Software Foundation, Inc.,
 // 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 //
-#ifdef HAVE_CONFIG_H
-#include "../../src/config.h"
-#endif
-#undef GETDATA_LEGACY_API
-#include "getdata/dirfile.h"
-
-#include <cstring>
-#include <stdlib.h>
-
-using namespace GetData;
+#include "internal.h"
 
 BitEntry::BitEntry(const char* field_code, const char* in_field,
-    gd_bit_t bitnum, gd_bit_t numbits, int fragment_index) : Entry()
+    int bitnum, int numbits, int fragment_index) : Entry()
 {
   E.field = strdup(field_code);
   E.field_type = GD_BIT_ENTRY;
@@ -56,7 +47,7 @@ int BitEntry::SetInput(const char* field)
   return 0;
 }
 
-int BitEntry::SetFirstBit(gd_bit_t first_bit)
+int BitEntry::SetFirstBit(int first_bit)
 {
   E.u.bit.bitnum = first_bit;
 
@@ -66,7 +57,7 @@ int BitEntry::SetFirstBit(gd_bit_t first_bit)
   return 0;
 }
 
-int BitEntry::SetNumBits(gd_bit_t num_bits)
+int BitEntry::SetNumBits(int num_bits)
 {
   E.u.bit.numbits = num_bits;
 
diff --git a/bindings/cxx/carrayentry.cpp b/bindings/cxx/carrayentry.cpp
index 990c05e..cef6675 100644
--- a/bindings/cxx/carrayentry.cpp
+++ b/bindings/cxx/carrayentry.cpp
@@ -1,4 +1,4 @@
-// Copyright (C) 2010 D. V. Wiebe
+// Copyright (C) 2010-2011 D. V. Wiebe
 //
 ///////////////////////////////////////////////////////////////////////////
 //
@@ -18,15 +18,7 @@
 // along with GetData; if not, write to the Free Software Foundation, Inc.,
 // 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 //
-#ifdef HAVE_CONFIG_H
-#include "../../src/config.h"
-#endif
-#undef GETDATA_LEGACY_API
-#include "getdata/dirfile.h"
-
-#include <cstring>
-
-using namespace GetData;
+#include "internal.h"
 
 CarrayEntry::CarrayEntry(const char* field_code, DataType data_type,
     size_t array_len, int fragment_index)
diff --git a/bindings/cxx/constentry.cpp b/bindings/cxx/constentry.cpp
index 9c77de0..7d72667 100644
--- a/bindings/cxx/constentry.cpp
+++ b/bindings/cxx/constentry.cpp
@@ -1,4 +1,4 @@
-// Copyright (C) 2008, 2010 D. V. Wiebe
+// Copyright (C) 2008, 2010, 2011 D. V. Wiebe
 //
 ///////////////////////////////////////////////////////////////////////////
 //
@@ -18,13 +18,7 @@
 // along with GetData; if not, write to the Free Software Foundation, Inc.,
 // 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 //
-#ifdef HAVE_CONFIG_H
-#include "../../src/config.h"
-#endif
-#undef GETDATA_LEGACY_API
-#include "getdata/dirfile.h"
-
-#include <cstring>
+#include "internal.h"
 
 using namespace GetData;
 
diff --git a/bindings/cxx/dirfile.cpp b/bindings/cxx/dirfile.cpp
index c9d52a1..b25c13b 100644
--- a/bindings/cxx/dirfile.cpp
+++ b/bindings/cxx/dirfile.cpp
@@ -1,4 +1,4 @@
-// Copyright (C) 2008-2010 D. V. Wiebe
+// Copyright (C) 2008-2012 D. V. Wiebe
 //
 ///////////////////////////////////////////////////////////////////////////
 //
@@ -18,25 +18,13 @@
 // along with GetData; if not, write to the Free Software Foundation, Inc.,
 // 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 //
-#ifdef HAVE_CONFIG_H
-#include "../../src/config.h"
-#endif
-#undef GETDATA_LEGACY_API
-#include "getdata/dirfile.h"
-
-#include <stdlib.h>
-
-#ifdef _MSC_VER
-#define __gd_unused 
-#else
-#define __gd_unused __attribute__ (( unused ))
-#endif
-using namespace GetData;
+#include "internal.h"
 
 Dirfile::Dirfile()
 {
   D = gd_invalid_dirfile();
   error_string = NULL;
+  reference_name = NULL;
 }
 
 Dirfile::Dirfile(const char* filedir, unsigned long flags,
@@ -44,18 +32,20 @@ Dirfile::Dirfile(const char* filedir, unsigned long flags,
 {
   D = gd_cbopen(filedir, flags, sehandler, extra);
   error_string = NULL;
+  reference_name = NULL;
 }
 
 Dirfile::Dirfile(DIRFILE* dirfile)
 {
   D = dirfile;
   error_string = NULL;
+  reference_name = NULL;
 }
 
 Dirfile::~Dirfile()
 {
-  if (error_string != NULL)
-    free(error_string);
+  free(error_string);
+  free(reference_name);
 
   gd_close(D);
 }
@@ -117,6 +107,10 @@ Entry *Dirfile::Entry(const char* field_code) const
       return new GetData::StringEntry(this, field_code);
     case IndexEntryType:
       return new GetData::IndexEntry(this, field_code);
+    case WindowEntryType:
+      return new GetData::WindowEntry(this, field_code);
+    case MplexEntryType:
+      return new GetData::MplexEntry(this, field_code);
     case NoEntryType:
       break;
   }
@@ -139,6 +133,11 @@ int Dirfile::Error() const
   return gd_error(D);
 }
 
+int Dirfile::ErrorCount() const
+{
+  return gd_error_count(D);
+}
+
 const char *Dirfile::ErrorString(size_t __gd_unused n)
 {
   return ErrorString();
@@ -258,19 +257,19 @@ const char** Dirfile::MVectorList(const char *parent) const
   return gd_mvector_list(D, parent);
 }
 
-off_t Dirfile::NFrames() const
+gd_off64_t Dirfile::NFrames() const
 {
-  return gd_nframes(D);
+  return gd_nframes64(D);
 }
 
-off_t Dirfile::EoF(const char *field_code) const
+gd_off64_t Dirfile::EoF(const char *field_code) const
 {
-  return gd_eof(D, field_code);
+  return gd_eof64(D, field_code);
 }
 
-off_t Dirfile::BoF(const char *field_code) const
+gd_off64_t Dirfile::BoF(const char *field_code) const
 {
-  return gd_bof(D, field_code);
+  return gd_bof64(D, field_code);
 }
 
 int Dirfile::GetCarray(const char *field_code, DataType type, void *data_out,
@@ -289,11 +288,11 @@ int Dirfile::GetConstant(const char *field_code, DataType type, void *data_out)
   return gd_get_constant(D, field_code, (gd_type_t)type, data_out);
 }
 
-size_t Dirfile::GetData(const char* field_code, off_t first_frame,
-    off_t first_sample, size_t num_frames, size_t num_samples,
+size_t Dirfile::GetData(const char* field_code, gd_off64_t first_frame,
+    gd_off64_t first_sample, size_t num_frames, size_t num_samples,
     DataType type, void* data_out) const
 {
-  return gd_getdata(D, field_code, first_frame, first_sample, num_frames,
+  return gd_getdata64(D, field_code, first_frame, first_sample, num_frames,
       num_samples, (gd_type_t)type, data_out);
 }
 
@@ -319,11 +318,11 @@ int Dirfile::PutConstant(const char *field_code, DataType type,
   return gd_put_constant(D, field_code, (gd_type_t)type, data_in);
 }
 
-size_t Dirfile::PutData(const char* field_code, off_t first_frame,
-    off_t first_sample, size_t num_frames, size_t num_samples,
+size_t Dirfile::PutData(const char* field_code, gd_off64_t first_frame,
+    gd_off64_t first_sample, size_t num_frames, size_t num_samples,
     DataType type, const void* data_in) const
 {
-  return gd_putdata(D, field_code, first_frame, first_sample, num_frames,
+  return gd_putdata64(D, field_code, first_frame, first_sample, num_frames,
       num_samples, (gd_type_t)type, data_in);
 }
 
@@ -345,14 +344,16 @@ int Dirfile::NFragments() const
   return gd_nfragments(D);
 }
 
-const char* Dirfile::ReferenceFilename() const
+const char* Dirfile::ReferenceFilename()
 {
   const char* ref = gd_reference(D, NULL);
 
   if (ref == NULL)
     return NULL;
 
-  return gd_raw_filename(D, ref);
+  free(reference_name);
+  reference_name = gd_raw_filename(D, ref);
+  return reference_name;
 }
 
 int Dirfile::Discard()
@@ -421,9 +422,9 @@ int Dirfile::Validate(const char* field_code) const
 }
 
 double Dirfile::FrameNum(const char* field_code, double value,
-    off_t frame_start, off_t frame_end) const
+    gd_off64_t frame_start, gd_off64_t frame_end) const
 {
-  return gd_framenum_subset(D, field_code, value, frame_start, frame_end);
+  return gd_framenum_subset64(D, field_code, value, frame_start, frame_end);
 }
 
 int Dirfile::FragmentIndex(const char* field_code) const
@@ -440,3 +441,133 @@ int Dirfile::Standards(int version) const
 {
   return gd_dirfile_standards(D, version);
 }
+
+gd_off64_t Dirfile::Seek(const char* field_code, gd_off64_t frame_num,
+    gd_off64_t sample_num, int flags) const
+{
+  return gd_seek64(D, field_code, frame_num, sample_num, flags);
+}
+
+gd_off64_t Dirfile::Tell(const char* field_code) const
+{
+  return gd_tell64(D, field_code);
+}
+
+int Dirfile::AddAlias(const char* field_code, const char* target,
+    int fragment_index) const
+{
+  return gd_add_alias(D, field_code, target, fragment_index);
+}
+
+const char** Dirfile::Aliases(const char* field_code) const
+{
+  return gd_aliases(D, field_code);
+}
+
+const char* Dirfile::AliasTarget(const char* field_code) const
+{
+  return gd_alias_target(D, field_code);
+}
+
+int Dirfile::DeleteAlias(const char* field_code, int flags) const
+{
+  return gd_delete_alias(D, field_code, flags);
+}
+
+int Dirfile::Hide(const char* field_code) const
+{
+  return gd_hide(D, field_code);
+}
+
+int Dirfile::Hidden(const char* field_code) const
+{
+  return gd_hidden(D, field_code);
+}
+
+int Dirfile::IncludeAffix(const char *file, int fragment_index,
+    const char* prefix, const char* suffix, unsigned long flags) const
+{
+  return gd_include_affix(D, file, fragment_index, prefix, suffix, flags);
+}
+
+int Dirfile::MAddAlias(const char* parent, const char* name, const char* target)
+  const
+{
+  return gd_madd_alias(D, parent, name, target);
+}
+
+int Dirfile::MoveAlias(const char* field_code, int new_fragment) const
+{
+  return gd_move_alias(D, field_code, new_fragment);
+}
+
+int Dirfile::NAliases(const char* field_code) const
+{
+  return gd_naliases(D, field_code);
+}
+
+int Dirfile::Sync(const char* field_code) const
+{
+  return gd_sync(D, field_code);
+}
+
+int Dirfile::RawClose(const char* field_code) const
+{
+  return gd_raw_close(D, field_code);
+}
+
+int Dirfile::UnHide(const char* field_code) const
+{
+  return gd_unhide(D, field_code);
+}
+
+char *Dirfile::StrTok(const char *string)
+{
+  return gd_strtok(D, string);
+}
+
+int Dirfile::DeSync(unsigned int flags)
+{
+  int desync = gd_desync(D, flags);
+  if (desync && flags & GD_DESYNC_REOPEN) {
+    free(error_string);
+    free(reference_name);
+
+    error_string = NULL;
+    reference_name = NULL;
+  }
+
+  return desync;
+}
+
+unsigned long Dirfile::Flags(unsigned long set, unsigned long reset)
+{
+  return gd_flags(D, set, reset);
+}
+
+int Dirfile::VerbosePrefix(const char *prefix) const
+{
+  return gd_verbose_prefix(D, prefix);
+}
+
+void Dirfile::MplexLookback(int lookback) const
+{
+  gd_mplex_lookback(D, lookback);
+}
+
+unsigned int Dirfile::NEntries(const char *parent, int type, unsigned int flags)
+  const
+{
+  return gd_nentries(D, parent, type, flags);
+}
+
+const char** Dirfile::EntryList(const char *parent, int type,
+    unsigned int flags) const
+{
+  return gd_entry_list(D, parent, type, flags);
+}
+
+char* Dirfile::LinterpTableName(const char *field_code)
+{
+  return gd_linterp_tablename(D, field_code);
+}
diff --git a/bindings/cxx/divideentry.cpp b/bindings/cxx/divideentry.cpp
index d2a594e..d66f0c4 100644
--- a/bindings/cxx/divideentry.cpp
+++ b/bindings/cxx/divideentry.cpp
@@ -1,4 +1,4 @@
-// Copyright (C) 2010 D. V. Wiebe
+// Copyright (C) 2010-2011 D. V. Wiebe
 //
 ///////////////////////////////////////////////////////////////////////////
 //
@@ -18,14 +18,7 @@
 // along with GetData; if not, write to the Free Software Foundation, Inc.,
 // 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 //
-#ifdef HAVE_CONFIG_H
-#include "../../src/config.h"
-#endif
-#undef GETDATA_LEGACY_API
-#include "getdata/dirfile.h"
-
-#include <stdlib.h>
-#include <cstring>
+#include "internal.h"
 
 using namespace GetData;
 
diff --git a/bindings/cxx/entry.cpp b/bindings/cxx/entry.cpp
index 786d25d..ca98296 100644
--- a/bindings/cxx/entry.cpp
+++ b/bindings/cxx/entry.cpp
@@ -1,4 +1,4 @@
-// Copyright (C) 2008-2010 D. V. Wiebe
+// Copyright (C) 2008-2012 D. V. Wiebe
 //
 ///////////////////////////////////////////////////////////////////////////
 //
@@ -18,14 +18,7 @@
 // along with GetData; if not, write to the Free Software Foundation, Inc.,
 // 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 //
-#ifdef HAVE_CONFIG_H
-#include "../../src/config.h"
-#endif
-#undef GETDATA_LEGACY_API
-#include "getdata/dirfile.h"
-
-#include <stdlib.h>
-#include <cstring>
+#include "internal.h"
 
 using namespace GetData;
 
@@ -53,6 +46,12 @@ int Entry::CheckIndex(gd_entype_t field_type, int n_fields, int index)
 
   switch (field_type) {
     case GD_RAW_ENTRY:
+    case GD_INDEX_ENTRY:
+    case GD_CONST_ENTRY:
+    case GD_CARRAY_ENTRY:
+    case GD_STRING_ENTRY:
+    case GD_NO_ENTRY:
+    case GD_ALIAS_ENTRY:
       return 0;
     case GD_LINCOM_ENTRY:
       if (index > n_fields)
@@ -60,9 +59,16 @@ int Entry::CheckIndex(gd_entype_t field_type, int n_fields, int index)
       break;
     case GD_MULTIPLY_ENTRY:
     case GD_DIVIDE_ENTRY:
+    case GD_WINDOW_ENTRY:
+    case GD_MPLEX_ENTRY:
       if (index > 2)
         return 0;
-    default:
+    case GD_LINTERP_ENTRY:
+    case GD_BIT_ENTRY:
+    case GD_PHASE_ENTRY:
+    case GD_POLYNOM_ENTRY:
+    case GD_SBIT_ENTRY:
+    case GD_RECIP_ENTRY:
       if (index > 1)
         return 0;
   }
@@ -148,12 +154,14 @@ static inline int scalar_ok(const gd_entry_t &E, int index)
       break;
     case GD_BIT_ENTRY:
     case GD_SBIT_ENTRY:
+    case GD_MPLEX_ENTRY:
       if (index >= 2)
         return 0;
       break;
     case GD_RAW_ENTRY:
     case GD_PHASE_ENTRY:
     case GD_RECIP_ENTRY:
+    case GD_WINDOW_ENTRY:
       if (index >= 1)
         return 0;
       break;
@@ -165,6 +173,7 @@ static inline int scalar_ok(const gd_entry_t &E, int index)
     case GD_CARRAY_ENTRY:
     case GD_STRING_ENTRY:
     case GD_NO_ENTRY:
+    case GD_ALIAS_ENTRY:
       return 0;
   }
 
diff --git a/bindings/cxx/fragment.cpp b/bindings/cxx/fragment.cpp
index 0ba4784..dfa5b5a 100644
--- a/bindings/cxx/fragment.cpp
+++ b/bindings/cxx/fragment.cpp
@@ -1,4 +1,4 @@
-// Copyright (C) 2008, 2010 D. V. Wiebe
+// Copyright (C) 2008, 2010, 2011 D. V. Wiebe
 //
 ///////////////////////////////////////////////////////////////////////////
 //
@@ -18,33 +18,32 @@
 // along with GetData; if not, write to the Free Software Foundation, Inc.,
 // 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 //
-#ifdef HAVE_CONFIG_H
-#include "../../src/config.h"
-#endif
-#undef GETDATA_LEGACY_API
-#include "getdata/dirfile.h"
-
-#include <stdlib.h>
-#include <cstring>
+#include "internal.h"
 
 using namespace GetData;
 
 Fragment::Fragment(const GetData::Dirfile *dirfile, int index)
 {
+  dtrace("%p, %i", dirfile, index);
+
   D = dirfile;
 
   ind = index;
   enc = (GetData::EncodingScheme)gd_encoding(D->D, index);
   end = gd_endianness(D->D, index);
-  off = gd_frameoffset(D->D, index);
+  off = gd_frameoffset64(D->D, index);
   prot = gd_protection(D->D, index);
   name = gd_fragmentname(D->D, index);
   parent = (index == 0) ? -1 : gd_parent_fragment(D->D, index);
+  gd_fragment_affixes(D->D, index, &prefix, &suffix);
+
+  dreturnvoid();
 }
 
 Fragment::~Fragment()
 {
-  ;
+  free(prefix);
+  free(suffix);
 }
 
 int Fragment::ReWrite() const
@@ -72,9 +71,9 @@ int Fragment::SetEndianness(unsigned long byte_sex, int recode)
   return ret;
 }
 
-int Fragment::SetFrameOffset(off_t offset, int recode)
+int Fragment::SetFrameOffset(gd_off64_t offset, int recode)
 {
-  int ret = gd_alter_frameoffset(D->D, offset, ind, recode);
+  int ret = gd_alter_frameoffset64(D->D, offset, ind, recode);
 
   if (!ret)
     off = offset;
@@ -91,3 +90,25 @@ int Fragment::SetProtection(int protection_level)
 
   return ret;
 }
+
+int Fragment::SetPrefix(const char* new_prefix)
+{
+  int ret = gd_alter_affixes(D->D, ind, new_prefix, suffix);
+
+  free(prefix);
+  free(suffix);
+  if (!ret)
+    ret = gd_fragment_affixes(D->D, ind, &prefix, &suffix);
+  return ret;
+}
+
+int Fragment::SetSuffix(const char* new_suffix)
+{
+  int ret = gd_alter_affixes(D->D, ind, prefix, new_suffix);
+
+  free(prefix);
+  free(suffix);
+  if (!ret)
+    ret = gd_fragment_affixes(D->D, ind, &prefix, &suffix);
+  return ret;
+}
diff --git a/bindings/cxx/getdata/bitentry.h b/bindings/cxx/getdata/bitentry.h
index 46dd2b5..845633b 100644
--- a/bindings/cxx/getdata/bitentry.h
+++ b/bindings/cxx/getdata/bitentry.h
@@ -34,19 +34,19 @@ namespace GetData {
     public:
       BitEntry() : Entry() { E.field_type = GD_BIT_ENTRY; };
 
-      BitEntry(const char* field_code, const char* in_field, gd_bit_t bitnum,
-          gd_bit_t numbits = 1, int fragment_index = 0);
+      BitEntry(const char* field_code, const char* in_field, int bitnum,
+          int numbits = 1, int fragment_index = 0);
 
       virtual const char *Input() const { return E.in_fields[0]; };
 
-      virtual gd_bit_t FirstBit() const { return E.u.bit.bitnum; };
+      virtual int FirstBit() const { return E.u.bit.bitnum; };
 
-      virtual gd_bit_t NumBits() const { return E.u.bit.numbits; };
+      virtual int NumBits() const { return E.u.bit.numbits; };
 
       int SetInput(const char* field);
-      int SetFirstBit(gd_bit_t first_bit);
+      int SetFirstBit(int first_bit);
       int SetFirstBit(const char* first_bit);
-      int SetNumBits(gd_bit_t num_bits);
+      int SetNumBits(int num_bits);
       int SetNumBits(const char* num_bits);
 
       virtual const char *Scalar(int index = 0) const;
diff --git a/bindings/cxx/getdata/dirfile.h b/bindings/cxx/getdata/dirfile.h
index aa2de27..babe414 100644
--- a/bindings/cxx/getdata/dirfile.h
+++ b/bindings/cxx/getdata/dirfile.h
@@ -1,4 +1,4 @@
-// Copyright (C) 2008-2010 D. V. Wiebe
+// Copyright (C) 2008-2012 D. V. Wiebe
 //
 ///////////////////////////////////////////////////////////////////////////
 //
@@ -22,12 +22,17 @@
 #ifndef GETDATA_DIRFILE_H
 #define GETDATA_DIRFILE_H
 
-// We don't want the legacy API since its symbols clash with us.
+// Enable the explicit 64-bit API (gd_getdata64() &c.)
+#ifndef GD_64BIT_API
+# define GD_64BIT_API
+#endif
+
+// Disable the legacy API since its symbols clash with us.
 #ifndef GD_NO_LEGACY_API
 # define GD_NO_LEGACY_API
 #endif
 
-// We use the C89 API since C++ compilers aren't required to support the
+// Use the C89 API since C++ compilers aren't required to support the
 // C99 _Complex keyword
 #ifndef GD_C89_API
 # define GD_C89_API
@@ -48,9 +53,11 @@
 #include <getdata/constentry.h>
 #include <getdata/carrayentry.h>
 #include <getdata/stringentry.h>
+#include <getdata/mplexentry.h>
 #include <getdata/multiplyentry.h>
 #include <getdata/divideentry.h>
 #include <getdata/recipentry.h>
+#include <getdata/windowentry.h>
 
 namespace GetData {
   
@@ -69,6 +76,8 @@ namespace GetData {
     friend class RecipEntry;
     friend class PhaseEntry;
     friend class PolynomEntry;
+    friend class WindowEntry;
+    friend class MplexEntry;
     friend class ConstEntry;
     friend class CarrayEntry;
     friend class StringEntry;
@@ -87,11 +96,18 @@ namespace GetData {
 
       int Add(GetData::Entry &entry) const;
 
+      int AddAlias(const char *field_code, const char *target,
+          int fragment_index = 0) const;
+
       int AddSpec(const char *spec, int fragment_index = 0) const;
 
+      const char** Aliases(const char* field_code) const;
+
+      const char* AliasTarget(const char* field_code) const;
+
       int AlterSpec(const char* spec, int recode = 0) const;
 
-      off_t BoF(const char *field_code) const;
+      gd_off64_t BoF(const char *field_code) const;
 
       size_t CarrayLen(const char *field_code) const;
 
@@ -103,17 +119,28 @@ namespace GetData {
 
       int Delete(const char* field_code, int flags = 0) const;
 
+      int DeleteAlias(const char* field_code, int flags = 0) const;
+
+      int DeSync(unsigned int flags = 0);
+
       int Discard();
 
       GetData::Entry* Entry(const char *field_code) const;
 
-      off_t EoF(const char *field_code) const;
+      const char **EntryList(const char *parent = NULL, int type = 0,
+          unsigned int flags = 0) const;
+
+      gd_off64_t EoF(const char *field_code) const;
 
       int Error() const;
 
+      int ErrorCount() const;
+
       const char *ErrorString();
       const char *ErrorString(size_t n) gd_deprecated;
 
+      unsigned long Flags(unsigned long set = 0, unsigned long reset = 0);
+
       const char **FieldList() const;
 
       const char **FieldListByType(EntryType type) const;
@@ -125,7 +152,7 @@ namespace GetData {
       int FragmentIndex(const char* field_code) const;
 
       double FrameNum(const char* field_code, double value,
-          off_t frame_start = 0, off_t frame_end = 0) const;
+          gd_off64_t frame_start = 0, gd_off64_t frame_end = 0) const;
 
       int GetCarray(const char *field_code, DataType type, void *data_out,
           unsigned int start = 0, size_t len = 0) const;
@@ -133,18 +160,31 @@ namespace GetData {
       int GetConstant(const char *field_code, DataType type, void *data_out)
         const;
 
-      size_t GetData(const char *field_code, off_t first_frame,
-          off_t first_sample, size_t num_frames, size_t num_samples,
+      size_t GetData(const char *field_code, gd_off64_t first_frame,
+          gd_off64_t first_sample, size_t num_frames, size_t num_samples,
           DataType type, void* data_out) const;
 
       size_t GetString(const char *field_code, size_t len, char *data_out)
         const;
 
+      int Hide(const char* field_code) const;
+
+      int Hidden(const char* field_code) const;
+
       int Include(const char *file, int fragment_index = 0,
           unsigned long flags = 0) const;
 
+      int IncludeAffix(const char *file, int fragment_index = 0,
+          const char* prefix = NULL, const char* suffix = NULL,
+          unsigned long flags = 0) const;
+
+      char *LinterpTableName(const char *field_code);
+
       int MAdd(GetData::Entry &entry, const char *parent) const;
 
+      int MAddAlias(const char* parent, const char* name, const char* target)
+        const;
+
       int MAddSpec(const char *spec, const char *parent) const;
 
       int MAlterSpec(const char *line, const char *parent, int recode = 0)
@@ -161,10 +201,19 @@ namespace GetData {
 
       const char **MFieldListByType(const char *parent, EntryType type) const;
 
+      void MplexLookback(int lookback) const;
+
       const char **MStrings(const char *parent) const;
 
+      int MoveAlias(const char* field_code, int new_fragment) const;
+
       const char **MVectorList(const char *parent) const;
 
+      int NAliases(const char* field_code) const;
+
+      unsigned int NEntries(const char *parent = NULL, int type = 0,
+          unsigned int flags = 0) const;
+
       unsigned int NFields() const;
 
       unsigned int NFieldsByType(EntryType type) const;
@@ -181,7 +230,7 @@ namespace GetData {
 
       int NFragments() const;
 
-      off_t NFrames() const;
+      gd_off64_t NFrames() const;
 
       unsigned int NVectors() const;
 
@@ -191,18 +240,23 @@ namespace GetData {
       int PutConstant(const char *field_code, DataType type,
           const void *data_in) const;
 
-      size_t PutData(const char *field_code, off_t first_frame,
-          off_t first_sample, size_t num_frames, size_t num_samples,
+      size_t PutData(const char *field_code, gd_off64_t first_frame,
+          gd_off64_t first_sample, size_t num_frames, size_t num_samples,
           DataType type, const void* data_in) const;
 
       size_t PutString(const char *field_code, const char *data_in) const;
 
+      int RawClose(const char *field_code = NULL) const;
+
       GetData::RawEntry *Reference(const char* field_code = NULL) const;
 
-      const char *ReferenceFilename() const;
+      const char *ReferenceFilename();
 
       unsigned int SamplesPerFrame(const char *field_code) const;
 
+      gd_off64_t Seek(const char* field_code, gd_off64_t frame_num,
+          gd_off64_t sample_num, int flags) const;
+
       void SetCallback(gd_parser_callback_t sehandler, void* extra = NULL)
         const;
 
@@ -210,16 +264,27 @@ namespace GetData {
 
       const char **Strings() const;
 
+      int Sync(const char *field_code = NULL) const;
+
+      gd_off64_t Tell(const char* field_code) const;
+
+      char *StrTok(const char *string = NULL);
+
+      int UnHide(const char* field_code) const;
+
       int UnInclude(int fragment_index, int del = 0) const;
 
       int Validate(const char* field_code) const;
 
+      int VerbosePrefix(const char *prefix = NULL) const;
+
       const char **VectorList() const;
 
     private:
       DIRFILE* D; 
 
       char *error_string;
+      char *reference_name;
   };
 }
 
diff --git a/bindings/cxx/getdata/entry.h b/bindings/cxx/getdata/entry.h
index 33f7d90..f10d350 100644
--- a/bindings/cxx/getdata/entry.h
+++ b/bindings/cxx/getdata/entry.h
@@ -1,4 +1,4 @@
-// Copyright (C) 2008-2010 D. V. Wiebe
+// Copyright (C) 2008-2012 D. V. Wiebe
 //
 ///////////////////////////////////////////////////////////////////////////
 //
@@ -22,21 +22,7 @@
 #ifndef GETDATA_ENTRY_H
 #define GETDATA_ENTRY_H
 
-#ifndef _FILE_OFFSET_BITS
-# define _FILE_OFFSET_BITS 64
-#endif
-
-#ifndef GD_NO_LEGACY_API
-# define GD_NO_LEGACY_API
-#endif
-#ifndef GD_C89_API
-# define GD_C89_API
-#endif
-
-extern "C" {
-#include <getdata.h>
-}
-
+#include <getdata/dirfile.h>
 #include <complex>
 
 namespace GetData {
@@ -68,7 +54,20 @@ namespace GetData {
     StringEntryType   = GD_STRING_ENTRY,
     IndexEntryType    = GD_INDEX_ENTRY,
     DivideEntryType   = GD_DIVIDE_ENTRY,
-    RecipEntryType    = GD_RECIP_ENTRY
+    RecipEntryType    = GD_RECIP_ENTRY,
+    WindowEntryType   = GD_WINDOW_ENTRY,
+    MplexEntryType    = GD_MPLEX_ENTRY
+  };
+
+  enum WindOpType {
+    WindOpEq = GD_WINDOP_EQ,
+    WindOpNe = GD_WINDOP_NE,
+    WindOpGe = GD_WINDOP_GE,
+    WindOpGt = GD_WINDOP_GT,
+    WindOpLe = GD_WINDOP_LE,
+    WindOpLt = GD_WINDOP_LT,
+    WindOpSet = GD_WINDOP_SET,
+    WindOpClr = GD_WINDOP_CLR
   };
 
   class Entry {
@@ -110,7 +109,7 @@ namespace GetData {
       virtual int ScalarIndex(int index = 0) const;
 
       /* RAW methods */
-      virtual gd_spf_t SamplesPerFrame() const {
+      virtual unsigned int SamplesPerFrame() const {
         return (E.field_type == GD_RAW_ENTRY) ? E.u.raw.spf : 0;
       };
 
@@ -156,11 +155,11 @@ namespace GetData {
       };
 
       /* (S)BIT methods */
-      virtual gd_bit_t FirstBit() const {
+      virtual int FirstBit() const {
         return (E.field_type == GD_BIT_ENTRY) ? E.u.bit.bitnum : -1;
       };
 
-      virtual gd_bit_t NumBits() const {
+      virtual int NumBits() const {
         return (E.field_type == GD_BIT_ENTRY) ? E.u.bit.numbits : -1;
       };
 
@@ -208,6 +207,31 @@ namespace GetData {
           0;
       };
 
+      /* WINDOW methods */
+      virtual WindOpType WindOp() const {
+        return (E.field_type == GD_WINDOW_ENTRY) ? (WindOpType)E.u.window.windop
+          : (WindOpType)0;
+      }
+
+      virtual gd_triplet_t Threshold() const {
+        gd_triplet_t zero;
+        zero.r = 0;
+        return (E.field_type == GD_WINDOW_ENTRY) ? E.u.window.threshold : zero;
+      }
+
+      /* MPLEX methods */
+      virtual int CountVal() const {
+        return (E.field_type == GD_MPLEX_ENTRY) ? E.u.mplex.count_val : 0;
+      }
+
+      virtual int Period() const {
+        return (E.field_type == GD_MPLEX_ENTRY) ? E.u.mplex.period : 0;
+      }
+
+      /* deprecated member alias */
+      virtual int gd_deprecated CountMax() const { return Period(); }
+
+      /* Set methods */
       void SetName(const char* name);
 
       void SetFragmentIndex(int fragment_index);
diff --git a/bindings/cxx/getdata/fragment.h b/bindings/cxx/getdata/fragment.h
index dc0bee7..be06adc 100644
--- a/bindings/cxx/getdata/fragment.h
+++ b/bindings/cxx/getdata/fragment.h
@@ -22,30 +22,17 @@
 #ifndef GETDATA_FRAGMENT_H
 #define GETDATA_FRAGMENT_H
 
-#ifndef _FILE_OFFSET_BITS
-# define _FILE_OFFSET_BITS 64
-#endif
-
-#ifndef GD_NO_LEGACY_API
-# define GD_NO_LEGACY_API
-#endif
-#ifndef GD_C89_API
-# define GD_C89_API
-#endif
-
-extern "C" {
-#include <getdata.h>
-}
+#include <getdata/dirfile.h>
 #include <sys/types.h>
 
-
 namespace GetData {
 
   enum EncodingScheme {
     AutoEncoding  = GD_AUTO_ENCODED, RawEncoding   = GD_UNENCODED,
     TextEncoding  = GD_TEXT_ENCODED, SlimEncoding  = GD_SLIM_ENCODED,
     GzipEncoding  = GD_GZIP_ENCODED, Bzip2Encoding = GD_BZIP2_ENCODED,
-    UnsupportedEncoding = GD_ENC_UNSUPPORTED
+    SieEncoding   = GD_SIE_ENCODED,  ZzipEncoding  = GD_ZZIP_ENCODED,
+    ZzslimEncoding = GD_ZZSLIM_ENCODED, UnsupportedEncoding = GD_ENC_UNSUPPORTED
   };
 
   class Dirfile;
@@ -60,7 +47,7 @@ namespace GetData {
 
       unsigned long Endianness() const { return end; };
 
-      off_t FrameOffset() const { return (off_t)off; };
+      gd_off64_t FrameOffset() const { return off; };
 
       int Index() const { return ind; }
 
@@ -68,18 +55,26 @@ namespace GetData {
 
       int Parent() const { return parent; }
 
+      const char *Prefix() { return prefix; };
+
       int Protection() const { return prot; }
 
       int ReWrite() const;
 
+      const char *Suffix() { return suffix; };
+
       int SetEncoding(EncodingScheme encoding, int recode = 0);
 
       int SetEndianness(unsigned long byte_sex, int recode = 0);
 
-      int SetFrameOffset(off_t offset, int recode = 0);
+      int SetFrameOffset(gd_off64_t offset, int recode = 0);
+
+      int SetPrefix(const char *preix);
 
       int SetProtection(int protection_level);
 
+      int SetSuffix(const char *suffix);
+
     protected:
       Fragment(const Dirfile *dirfile, int index);
 
@@ -88,8 +83,10 @@ namespace GetData {
       unsigned long end;
       int ind;
       int prot;
-      off_t off;
+      gd_off64_t off;
       const char* name;
+      char* prefix;
+      char* suffix;
       int parent;
   };
 }
diff --git a/bindings/cxx/getdata/mplexentry.h b/bindings/cxx/getdata/mplexentry.h
new file mode 100644
index 0000000..f1e7029
--- /dev/null
+++ b/bindings/cxx/getdata/mplexentry.h
@@ -0,0 +1,74 @@
+// Copyright (C) 2012 D. V. Wiebe
+//
+///////////////////////////////////////////////////////////////////////////
+//
+// This file is part of the GetData project.
+//
+// GetData is free software; you can redistribute it and/or modify it under
+// the terms of the GNU Lesser General Public License as published by the
+// Free Software Foundation; either version 2.1 of the License, or (at your
+// option) any later version.
+//
+// GetData is distributed in the hope that it will be useful, but WITHOUT
+// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+// FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+// License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public License
+// along with GetData; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+//
+
+#ifndef GETDATA_MPLEXENTRY_H
+#define GETDATA_MPLEXENTRY_H
+
+#include <getdata/entry.h>
+
+namespace GetData {
+
+  class Dirfile;
+
+  class MplexEntry : public Entry {
+    friend class Dirfile;
+
+    public:
+      MplexEntry() : Entry() { E.field_type = GD_MPLEX_ENTRY; };
+
+      MplexEntry(const char* field_code, const char* in_field,
+          const char *check_field, int count_val, int period,
+          int fragment_index = 0);
+
+      virtual const char *Input(int index = 0) const {
+        return E.in_fields[(index == 0) ? 0 : 1];
+      };
+
+      virtual const char *Scalar() const { return E.scalar[0]; }
+
+      virtual int ScalarIndex() const { return E.scalar_ind[0]; };
+
+      virtual int CountVal() const { return E.u.mplex.count_val; };
+
+      virtual int Period() const { return E.u.mplex.period; };
+
+      int SetInput(const char* field, int index);
+      virtual int SetCountVal(int count_val);
+      virtual int SetCountVal(const char* count_val);
+      virtual int SetPeriod(int period);
+      virtual int SetPeriod(const char* period);
+
+      /* deprecated member aliases */
+      virtual int gd_deprecated CountMax() const { return Period(); };
+      virtual int gd_deprecated SetCountMax(int period) {
+        return SetPeriod(period);
+      }
+      virtual int gd_deprecated SetCountMax(const char* period) {
+        return SetPeriod(period);
+      };
+
+    private:
+      MplexEntry(const GetData::Dirfile *dirfile, const char* field_code) :
+        Entry(dirfile, field_code) { };
+  };
+}
+
+#endif
diff --git a/bindings/cxx/getdata/rawentry.h b/bindings/cxx/getdata/rawentry.h
index 4ba3705..758fcd0 100644
--- a/bindings/cxx/getdata/rawentry.h
+++ b/bindings/cxx/getdata/rawentry.h
@@ -32,17 +32,22 @@ namespace GetData {
     friend class Dirfile;
 
     public:
-      RawEntry() : Entry() { E.field_type = GD_RAW_ENTRY; };
+      RawEntry() : Entry() {
+        E.field_type = GD_RAW_ENTRY;
+        filename = NULL;
+      };
 
-      RawEntry(const char* field_code, DataType data_type, gd_spf_t spf,
+      RawEntry(const char* field_code, DataType data_type, unsigned int spf,
           int fragment_index = 0);
 
-      virtual gd_spf_t SamplesPerFrame() const { return E.u.raw.spf; };
+      virtual ~RawEntry();
+
+      virtual unsigned int SamplesPerFrame() const { return E.u.raw.spf; };
 
       virtual DataType RawType() const { return (DataType)E.u.raw.data_type; };
 
       const char* FileName();
-      int SetSamplesPerFrame(gd_spf_t spf, int recode = 0);
+      int SetSamplesPerFrame(unsigned int spf, int recode = 0);
       int SetSamplesPerFrame(const char *spf, int recode = 0);
       int SetType(DataType type, int recode = 0);
 
@@ -52,7 +57,9 @@ namespace GetData {
 
     private:
       RawEntry(const GetData::Dirfile *dirfile, const char* field_code) :
-        Entry(dirfile, field_code) { };
+        Entry(dirfile, field_code) { filename = NULL; };
+
+      char *filename;
   };
 }
 
diff --git a/bindings/cxx/getdata/sbitentry.h b/bindings/cxx/getdata/sbitentry.h
index 8f3e1c8..ae8a75b 100644
--- a/bindings/cxx/getdata/sbitentry.h
+++ b/bindings/cxx/getdata/sbitentry.h
@@ -34,19 +34,19 @@ namespace GetData {
     public:
       SBitEntry() : Entry() { E.field_type = GD_SBIT_ENTRY; };
 
-      SBitEntry(const char* field_code, const char* in_field, gd_bit_t bitnum,
-          gd_bit_t numbits = 1, int fragment_index = 0);
+      SBitEntry(const char* field_code, const char* in_field, int bitnum,
+          int numbits = 1, int fragment_index = 0);
 
       virtual const char *Input() const { return E.in_fields[0]; };
 
-      virtual gd_bit_t FirstBit() const { return E.u.bit.bitnum; };
+      virtual int FirstBit() const { return E.u.bit.bitnum; };
 
-      virtual gd_bit_t NumBits() const { return E.u.bit.numbits; };
+      virtual int NumBits() const { return E.u.bit.numbits; };
 
       int SetInput(const char* field);
-      int SetFirstBit(gd_bit_t first_bit);
+      int SetFirstBit(int first_bit);
       int SetFirstBit(const char* first_bit);
-      int SetNumBits(gd_bit_t num_bits);
+      int SetNumBits(int num_bits);
       int SetNumBits(const char* num_bits);
 
       virtual const char *Scalar(int index = 0) const;
diff --git a/bindings/cxx/getdata/windowentry.h b/bindings/cxx/getdata/windowentry.h
new file mode 100644
index 0000000..61b67c7
--- /dev/null
+++ b/bindings/cxx/getdata/windowentry.h
@@ -0,0 +1,66 @@
+// Copyright (C) 2011-2012 D. V. Wiebe
+//
+///////////////////////////////////////////////////////////////////////////
+//
+// This file is part of the GetData project.
+//
+// GetData is free software; you can redistribute it and/or modify it under
+// the terms of the GNU Lesser General Public License as published by the
+// Free Software Foundation; either version 2.1 of the License, or (at your
+// option) any later version.
+//
+// GetData is distributed in the hope that it will be useful, but WITHOUT
+// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+// FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+// License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public License
+// along with GetData; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+//
+
+#ifndef GETDATA_WINDOWENTRY_H
+#define GETDATA_WINDOWENTRY_H
+
+#include <getdata/entry.h>
+
+namespace GetData {
+
+  class Dirfile;
+
+  class WindowEntry : public Entry {
+    friend class Dirfile;
+
+    public:
+      WindowEntry() : Entry() { E.field_type = GD_WINDOW_ENTRY; };
+
+      WindowEntry(const char* field_code, const char* in_field,
+          const char *check_Field, WindOpType windop, gd_triplet_t threshold,
+          int fragment_index = 0);
+
+      virtual const char *Input(int index = 0) const {
+        return E.in_fields[(index == 0) ? 0 : 1];
+      };
+
+      virtual const char *Scalar() const { return E.scalar[0]; }
+
+      virtual int ScalarIndex() const { return E.scalar_ind[0]; };
+
+      virtual WindOpType WindOp() const {
+        return (WindOpType)E.u.window.windop;
+      };
+
+      virtual gd_triplet_t Threshold() const { return E.u.window.threshold; };
+
+      int SetInput(const char* field, int index);
+      virtual int SetWindOp(WindOpType windop);
+      virtual int SetThreshold(gd_triplet_t threshold);
+      virtual int SetThreshold(const char* threshold);
+
+    private:
+      WindowEntry(const GetData::Dirfile *dirfile, const char* field_code) :
+        Entry(dirfile, field_code) { };
+  };
+}
+
+#endif
diff --git a/bindings/cxx/indexentry.cpp b/bindings/cxx/indexentry.cpp
index ef6b5ca..c20dec1 100644
--- a/bindings/cxx/indexentry.cpp
+++ b/bindings/cxx/indexentry.cpp
@@ -1,4 +1,4 @@
-// Copyright (C) 2008, 2010 D. V. Wiebe
+// Copyright (C) 2011 D. V. Wiebe
 //
 ///////////////////////////////////////////////////////////////////////////
 //
@@ -18,10 +18,4 @@
 // along with GetData; if not, write to the Free Software Foundation, Inc.,
 // 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 //
-#ifdef HAVE_CONFIG_H
-#include "../../src/config.h"
-#endif
-#undef GETDATA_LEGACY_API
-#include "getdata/dirfile.h"
-
-using namespace GetData;
+#include "internal.h"
diff --git a/bindings/cxx/internal.h b/bindings/cxx/internal.h
new file mode 100644
index 0000000..06a913d
--- /dev/null
+++ b/bindings/cxx/internal.h
@@ -0,0 +1,61 @@
+// Copyright (C) 2011 D. V. Wiebe
+//
+///////////////////////////////////////////////////////////////////////////
+//
+// This file is part of the GetData project.
+//
+// GetData is free software; you can redistribute it and/or modify it under
+// the terms of the GNU Lesser General Public License as published by the
+// Free Software Foundation; either version 2.1 of the License, or (at your
+// option) any later version.
+//
+// GetData is distributed in the hope that it will be useful, but WITHOUT
+// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+// FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+// License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public License
+// along with GetData; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+//
+#ifdef HAVE_CONFIG_H
+#include "gd_config.h"
+#endif
+#undef GETDATA_LEGACY_API
+#include "getdata/dirfile.h"
+
+#include <cstring>
+#include <stdlib.h>
+#include <stdio.h>
+#include <stdint.h>
+
+/* debugging macros */
+#ifdef GETDATA_DEBUG
+extern "C" const char* gd_colnil(void);
+extern "C" const char* gd_coladd(void);
+extern "C" const char* gd_colsub(void);
+#define dtracevoid() printf("%s %s()\n", gd_coladd(), __FUNCTION__)
+#define dtrace(fmt, ...) printf("%s %s(" fmt ")\n", gd_coladd(), \
+    __FUNCTION__, ##__VA_ARGS__)
+#define dprintf(fmt, ...) printf("%s %s:%i " fmt "\n", gd_colnil(), \
+    __FUNCTION__, __LINE__, ##__VA_ARGS__)
+#define dreturnvoid() printf("%s %s = (nil)\n", gd_colsub(), __FUNCTION__)
+#define dreturn(fmt, ...) printf("%s %s = " fmt "\n", gd_colsub(), \
+    __FUNCTION__, ##__VA_ARGS__)
+#define dwatch(fmt, v) printf("%s %s = " fmt "\n", gd_colnil(), #v, v)
+#else
+#define dtracevoid()
+#define dtrace(...)
+#define dprintf(...)
+#define dreturnvoid()
+#define dreturn(...)
+#define dwatch(...)
+#endif
+
+#ifdef _MSC_VER
+#define __gd_unused 
+#else
+#define __gd_unused __attribute__ (( unused ))
+#endif
+
+using namespace GetData;
diff --git a/bindings/cxx/lincomentry.cpp b/bindings/cxx/lincomentry.cpp
index 52826a7..00b04bf 100644
--- a/bindings/cxx/lincomentry.cpp
+++ b/bindings/cxx/lincomentry.cpp
@@ -1,4 +1,4 @@
-// Copyright (C) 2008-2010 D. V. Wiebe
+// Copyright (C) 2008-2011 D. V. Wiebe
 //
 ///////////////////////////////////////////////////////////////////////////
 //
@@ -18,14 +18,7 @@
 // along with GetData; if not, write to the Free Software Foundation, Inc.,
 // 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 //
-#ifdef HAVE_CONFIG_H
-#include "../../src/config.h"
-#endif
-#undef GETDATA_LEGACY_API
-#include "getdata/dirfile.h"
-
-#include <stdlib.h>
-#include <cstring>
+#include "internal.h"
 
 using namespace GetData;
 
diff --git a/bindings/cxx/linterpentry.cpp b/bindings/cxx/linterpentry.cpp
index 9ab297c..541437a 100644
--- a/bindings/cxx/linterpentry.cpp
+++ b/bindings/cxx/linterpentry.cpp
@@ -1,4 +1,4 @@
-// Copyright (C) 2008, 2010 D. V. Wiebe
+// Copyright (C) 2008, 2010, 2011 D. V. Wiebe
 //
 ///////////////////////////////////////////////////////////////////////////
 //
@@ -18,14 +18,7 @@
 // along with GetData; if not, write to the Free Software Foundation, Inc.,
 // 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 //
-#ifdef HAVE_CONFIG_H
-#include "../../src/config.h"
-#endif
-#undef GETDATA_LEGACY_API
-#include "getdata/dirfile.h"
-
-#include <stdlib.h>
-#include <cstring>
+#include "internal.h"
 
 using namespace GetData;
 
diff --git a/bindings/cxx/mplexentry.cpp b/bindings/cxx/mplexentry.cpp
new file mode 100644
index 0000000..341d9ff
--- /dev/null
+++ b/bindings/cxx/mplexentry.cpp
@@ -0,0 +1,126 @@
+// Copyright (C) 2012 D. V. Wiebe
+//
+///////////////////////////////////////////////////////////////////////////
+//
+// This file is part of the GetData project.
+//
+// GetData is free software; you can redistribute it and/or modify it under
+// the terms of the GNU Lesser General Public License as published by the
+// Free Software Foundation; either version 2.1 of the License, or (at your
+// option) any later version.
+//
+// GetData is distributed in the hope that it will be useful, but WITHOUT
+// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+// FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+// License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public License
+// along with GetData; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+//
+#include "internal.h"
+
+MplexEntry::MplexEntry(const char* field_code, const char* in_field,
+    const char* count, int count_val, int period, int fragment_index) : Entry()
+{
+  dtrace("\"%s\", \"%s\", \"%s\", %i, %i, %i", field_code,
+      in_field, count, count_val, period, fragment_index);
+
+  E.field = strdup(field_code);
+  E.field_type = GD_MPLEX_ENTRY;
+  E.in_fields[0] = strdup(in_field);
+  E.in_fields[1] = strdup(count);
+  E.scalar[0] = E.scalar[1] = 0;
+  E.u.mplex.count_val = count_val;
+  E.u.mplex.period = period;
+  E.fragment_index = fragment_index;
+
+  dreturnvoid();
+}
+
+int MplexEntry::SetInput(const char* field, int index)
+{
+  if (index < 0 || index > 1)
+    return -1;
+
+  char* ptr = strdup(field);
+
+  if (ptr == NULL)
+    return -1;
+
+  free(E.in_fields[index]);
+  E.in_fields[index] = ptr;
+
+  if (D != NULL)
+    return gd_alter_entry(D->D, E.field, &E, 0);
+  
+  return 0;
+}
+
+int MplexEntry::SetCountVal(int count_val)
+{
+  int ret = 0;
+
+  dtrace("%u", count_val);
+
+  E.u.mplex.count_val = count_val;
+
+  if (D != NULL)
+    ret = gd_alter_entry(D->D, E.field, &E, 0);
+  
+  dreturn("%i", ret);
+  return ret;
+}
+
+int MplexEntry::SetPeriod(int period)
+{
+  int ret = 0;
+
+  dtrace("%u", period);
+
+  E.u.mplex.period = period;
+
+  if (D != NULL)
+    ret = gd_alter_entry(D->D, E.field, &E, 0);
+  
+  dreturn("%i", ret);
+  return ret;
+}
+
+int MplexEntry::SetCountVal(const char *count_val)
+{
+  int r = 0;
+
+  dtrace("\"%s\"", count_val);
+
+  SetScalar(0, count_val);
+
+  if (D != NULL) {
+    r = gd_alter_entry(D->D, E.field, &E, 0);
+
+    if (!r)
+      r = gd_get_constant(D->D, count_val, GD_UINT16, &E.u.mplex.count_val);
+  }
+  
+  dreturn("%i", r);
+  return r;
+}
+
+int MplexEntry::SetPeriod(const char *period)
+{
+  int r = 0;
+
+  dtrace("\"%s\"", period);
+
+  SetScalar(1, period);
+
+  if (D != NULL) {
+    r = gd_alter_entry(D->D, E.field, &E, 0);
+
+    if (!r)
+      r = gd_get_constant(D->D, period, GD_UINT16, &E.u.mplex.period);
+  }
+  
+  dreturn("%i", r);
+  return r;
+}
diff --git a/bindings/cxx/multiplyentry.cpp b/bindings/cxx/multiplyentry.cpp
index 74c5759..fe6884a 100644
--- a/bindings/cxx/multiplyentry.cpp
+++ b/bindings/cxx/multiplyentry.cpp
@@ -1,4 +1,4 @@
-// Copyright (C) 2008, 2010 D. V. Wiebe
+// Copyright (C) 2008, 2010, 2011 D. V. Wiebe
 //
 ///////////////////////////////////////////////////////////////////////////
 //
@@ -18,14 +18,7 @@
 // along with GetData; if not, write to the Free Software Foundation, Inc.,
 // 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 //
-#ifdef HAVE_CONFIG_H
-#include "../../src/config.h"
-#endif
-#undef GETDATA_LEGACY_API
-#include "getdata/dirfile.h"
-
-#include <stdlib.h>
-#include <cstring>
+#include "internal.h"
 
 using namespace GetData;
 
diff --git a/bindings/cxx/phaseentry.cpp b/bindings/cxx/phaseentry.cpp
index 193cd00..71006bf 100644
--- a/bindings/cxx/phaseentry.cpp
+++ b/bindings/cxx/phaseentry.cpp
@@ -1,4 +1,4 @@
-// Copyright (C) 2008-2010 D. V. Wiebe
+// Copyright (C) 2008-2011 D. V. Wiebe
 //
 ///////////////////////////////////////////////////////////////////////////
 //
@@ -18,14 +18,7 @@
 // along with GetData; if not, write to the Free Software Foundation, Inc.,
 // 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 //
-#ifdef HAVE_CONFIG_H
-#include "../../src/config.h"
-#endif
-#undef GETDATA_LEGACY_API
-#include "getdata/dirfile.h"
-
-#include <stdlib.h>
-#include <cstring>
+#include "internal.h"
 
 using namespace GetData;
 
diff --git a/bindings/cxx/polynomentry.cpp b/bindings/cxx/polynomentry.cpp
index beaa8ca..3ce0c4c 100644
--- a/bindings/cxx/polynomentry.cpp
+++ b/bindings/cxx/polynomentry.cpp
@@ -1,4 +1,4 @@
-// Copyright (C) 2009, 2010 D. V. Wiebe
+// Copyright (C) 2009, 2010, 2011 D. V. Wiebe
 //
 ///////////////////////////////////////////////////////////////////////////
 //
@@ -18,14 +18,7 @@
 // along with GetData; if not, write to the Free Software Foundation, Inc.,
 // 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 //
-#ifdef HAVE_CONFIG_H
-#include "../../src/config.h"
-#endif
-#undef GETDATA_LEGACY_API
-#include "getdata/dirfile.h"
-
-#include <stdlib.h>
-#include <cstring>
+#include "internal.h"
 
 using namespace GetData;
 
diff --git a/bindings/cxx/rawentry.cpp b/bindings/cxx/rawentry.cpp
index 0398be9..1127403 100644
--- a/bindings/cxx/rawentry.cpp
+++ b/bindings/cxx/rawentry.cpp
@@ -1,4 +1,4 @@
-// Copyright (C) 2008-2010 D. V. Wiebe
+// Copyright (C) 2008-2011 D. V. Wiebe
 //
 ///////////////////////////////////////////////////////////////////////////
 //
@@ -18,19 +18,11 @@
 // along with GetData; if not, write to the Free Software Foundation, Inc.,
 // 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 //
-#ifdef HAVE_CONFIG_H
-#include "../../src/config.h"
-#endif
-#undef GETDATA_LEGACY_API
-#include "getdata/dirfile.h"
-
-#include <cstring>
-#include <stdlib.h>
-#include <stdint.h>
+#include "internal.h"
 
 using namespace GetData;
 
-RawEntry::RawEntry(const char* field_code, DataType data_type, gd_spf_t spf,
+RawEntry::RawEntry(const char* field_code, DataType data_type, unsigned int spf,
       int fragment_index) : Entry()
 {
   E.field = strdup(field_code);
@@ -40,7 +32,12 @@ RawEntry::RawEntry(const char* field_code, DataType data_type, gd_spf_t spf,
   E.fragment_index = fragment_index;
 }
 
-int RawEntry::SetSamplesPerFrame(gd_spf_t spf, int recode)
+RawEntry::~RawEntry()
+{
+  free(filename);
+}
+
+int RawEntry::SetSamplesPerFrame(unsigned int spf, int recode)
 {
   E.u.raw.spf = spf;
 
@@ -78,5 +75,7 @@ int RawEntry::SetType(DataType type, int recode)
 
 const char* RawEntry::FileName()
 {
-  return gd_raw_filename(D->D, E.field);
+  free(filename);
+  filename = gd_raw_filename(D->D, E.field);
+  return filename;
 }
diff --git a/bindings/cxx/recipentry.cpp b/bindings/cxx/recipentry.cpp
index f5fa271..58a6ccc 100644
--- a/bindings/cxx/recipentry.cpp
+++ b/bindings/cxx/recipentry.cpp
@@ -1,4 +1,4 @@
-// Copyright (C) 2010 D. V. Wiebe
+// Copyright (C) 2010-2011 D. V. Wiebe
 //
 ///////////////////////////////////////////////////////////////////////////
 //
@@ -18,14 +18,7 @@
 // along with GetData; if not, write to the Free Software Foundation, Inc.,
 // 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 //
-#ifdef HAVE_CONFIG_H
-#include "../../src/config.h"
-#endif
-#undef GETDATA_LEGACY_API
-#include "getdata/dirfile.h"
-
-#include <stdlib.h>
-#include <cstring>
+#include "internal.h"
 
 using namespace GetData;
 
diff --git a/bindings/cxx/sbitentry.cpp b/bindings/cxx/sbitentry.cpp
index 41a2d0f..6246614 100644
--- a/bindings/cxx/sbitentry.cpp
+++ b/bindings/cxx/sbitentry.cpp
@@ -1,4 +1,4 @@
-// Copyright (C) 2008-2010 D. V. Wiebe
+// Copyright (C) 2008-2011 D. V. Wiebe
 //
 ///////////////////////////////////////////////////////////////////////////
 //
@@ -18,19 +18,12 @@
 // along with GetData; if not, write to the Free Software Foundation, Inc.,
 // 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 //
-#ifdef HAVE_CONFIG_H
-#include "../../src/config.h"
-#endif
-#undef GETDATA_LEGACY_API
-#include "getdata/dirfile.h"
-
-#include <cstring>
-#include <stdlib.h>
+#include "internal.h"
 
 using namespace GetData;
 
 SBitEntry::SBitEntry(const char* field_code, const char* in_field,
-    gd_bit_t bitnum, gd_bit_t numbits, int fragment_index) : Entry()
+    int bitnum, int numbits, int fragment_index) : Entry()
 {
   E.field = strdup(field_code);
   E.field_type = GD_BIT_ENTRY;
@@ -56,7 +49,7 @@ int SBitEntry::SetInput(const char* field)
   return 0;
 }
 
-int SBitEntry::SetFirstBit(gd_bit_t first_bit)
+int SBitEntry::SetFirstBit(int first_bit)
 {
   E.u.bit.bitnum = first_bit;
 
@@ -66,7 +59,7 @@ int SBitEntry::SetFirstBit(gd_bit_t first_bit)
   return 0;
 }
 
-int SBitEntry::SetNumBits(gd_bit_t num_bits)
+int SBitEntry::SetNumBits(int num_bits)
 {
   E.u.bit.numbits = num_bits;
 
diff --git a/bindings/cxx/stringentry.cpp b/bindings/cxx/stringentry.cpp
index 9d8308a..15898bd 100644
--- a/bindings/cxx/stringentry.cpp
+++ b/bindings/cxx/stringentry.cpp
@@ -1,4 +1,4 @@
-// Copyright (C) 2008, 2010 D. V. Wiebe
+// Copyright (C) 2008, 2010, 2011 D. V. Wiebe
 //
 ///////////////////////////////////////////////////////////////////////////
 //
@@ -18,13 +18,7 @@
 // along with GetData; if not, write to the Free Software Foundation, Inc.,
 // 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 //
-#ifdef HAVE_CONFIG_H
-#include "../../src/config.h"
-#endif
-#undef GETDATA_LEGACY_API
-#include "getdata/dirfile.h"
-
-#include <cstring>
+#include "internal.h"
 
 using namespace GetData;
 
diff --git a/bindings/cxx/test/Makefile.am b/bindings/cxx/test/Makefile.am
index 54f8f35..e571c18 100644
--- a/bindings/cxx/test/Makefile.am
+++ b/bindings/cxx/test/Makefile.am
@@ -28,7 +28,7 @@ if CXX_WEXTRA
 WEXTRA=-Wextra
 endif
 
-INCLUDES = ${WALL} $(WEXTRA) -I$(srcdir)/.. -I$(top_srcdir)/src -D__TEST__=\"$@\"
+INCLUDES = ${WALL} $(WEXTRA) -I$(srcdir)/.. -I$(top_srcdir)/src
 LDADD=../libgetdata++.la
 TESTS=big_test
 
@@ -41,7 +41,7 @@ check-local: check-TESTS
 	$(MAKE) getdata-clean-dirs
 
 getdata-clean-dirs:
-	rm -rvf *odirfile
+	rm -rf *odirfile
 
 clean-local:
 	$(MAKE) getdata-clean-dirs
diff --git a/bindings/cxx/test/Makefile.in b/bindings/cxx/test/Makefile.in
index 5fda571..1c499b4 100644
--- a/bindings/cxx/test/Makefile.in
+++ b/bindings/cxx/test/Makefile.in
@@ -1,9 +1,9 @@
-# Makefile.in generated by automake 1.11.1 from Makefile.am.
+# Makefile.in generated by automake 1.11.5 from Makefile.am.
 # @configure_input@
 
 # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005, 2006, 2007, 2008, 2009  Free Software Foundation,
-# Inc.
+# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software
+# Foundation, Inc.
 # This Makefile.in is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
@@ -15,6 +15,23 @@
 
 @SET_MAKE@
 VPATH = @srcdir@
+am__make_dryrun = \
+  { \
+    am__dry=no; \
+    case $$MAKEFLAGS in \
+      *\\[\ \	]*) \
+        echo 'am--echo: ; @echo "AM"  OK' | $(MAKE) -f - 2>/dev/null \
+          | grep '^AM OK$$' >/dev/null || am__dry=yes;; \
+      *) \
+        for am__flg in $$MAKEFLAGS; do \
+          case $$am__flg in \
+            *=*|--*) ;; \
+            *n*) am__dry=yes; break;; \
+          esac; \
+        done;; \
+    esac; \
+    test $$am__dry = yes; \
+  }
 pkgdatadir = $(datadir)/@PACKAGE@
 pkgincludedir = $(includedir)/@PACKAGE@
 pkglibdir = $(libdir)/@PACKAGE@
@@ -40,15 +57,17 @@ DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
 am__aclocal_m4_deps = $(top_srcdir)/m4/ax_compare_version.m4 \
 	$(top_srcdir)/m4/compiler.m4 $(top_srcdir)/m4/encoding.m4 \
-	$(top_srcdir)/m4/idl.m4 $(top_srcdir)/m4/libtool.m4 \
-	$(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \
-	$(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \
-	$(top_srcdir)/m4/python.m4 $(top_srcdir)/m4/win32.m4 \
-	$(top_srcdir)/m4/version.m4 $(top_srcdir)/configure.ac
+	$(top_srcdir)/m4/floatordering.m4 $(top_srcdir)/m4/idl.m4 \
+	$(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \
+	$(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \
+	$(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/m4/matlab.m4 \
+	$(top_srcdir)/m4/perl.m4 $(top_srcdir)/m4/python.m4 \
+	$(top_srcdir)/m4/win32.m4 $(top_srcdir)/m4/version.m4 \
+	$(top_srcdir)/configure.ac
 am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
 	$(ACLOCAL_M4)
 mkinstalldirs = $(install_sh) -d
-CONFIG_HEADER = $(top_builddir)/src/config.h \
+CONFIG_HEADER = $(top_builddir)/src/gd_config.h \
 	$(top_builddir)/src/getdata.h
 CONFIG_CLEAN_FILES =
 CONFIG_CLEAN_VPATH_FILES =
@@ -72,6 +91,11 @@ CXXLINK = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
 	$(LDFLAGS) -o $@
 SOURCES = $(big_test_SOURCES)
 DIST_SOURCES = $(big_test_SOURCES)
+am__can_run_installinfo = \
+  case $$AM_UPDATE_INFO_DIR in \
+    n|no|NO) false;; \
+    *) (install-info --version) >/dev/null 2>&1;; \
+  esac
 ETAGS = etags
 CTAGS = ctags
 am__tty_colors = \
@@ -85,10 +109,13 @@ AUTOHEADER = @AUTOHEADER@
 AUTOMAKE = @AUTOMAKE@
 AWK = @AWK@
 BUILDCC = @BUILDCC@
-BUILD_DATE = @BUILD_DATE@
 BZIP2_CPPFLAGS = @BZIP2_CPPFLAGS@
 BZIP2_LDFLAGS = @BZIP2_LDFLAGS@
+BZIP2_LIBS = @BZIP2_LIBS@
 CC = @CC@
+CCAS = @CCAS@
+CCASDEPMODE = @CCASDEPMODE@
+CCASFLAGS = @CCASFLAGS@
 CCDEPMODE = @CCDEPMODE@
 CFLAGS = @CFLAGS@
 CPP = @CPP@
@@ -104,6 +131,7 @@ DEFINE_GD_NO_C99_API = @DEFINE_GD_NO_C99_API@
 DEFINE_gd_int16_t = @DEFINE_gd_int16_t@
 DEFINE_gd_int64_t = @DEFINE_gd_int64_t@
 DEFINE_gd_uint16_t = @DEFINE_gd_uint16_t@
+DEFINE_gd_uint64_t = @DEFINE_gd_uint64_t@
 DEFS = @DEFS@
 DEPDIR = @DEPDIR@
 DIFF = @DIFF@
@@ -124,13 +152,21 @@ FFLAGS = @FFLAGS@
 FGETDATA_VERSION = @FGETDATA_VERSION@
 FGREP = @FGREP@
 FLIBS = @FLIBS@
+GD_DIRSEP = @GD_DIRSEP@
+GD_FDIRSEP = @GD_FDIRSEP@
 GETDATAXX_VERSION = @GETDATAXX_VERSION@
+GETDATA_DEBUG = @GETDATA_DEBUG@
 GETDATA_IFACE_AGE = @GETDATA_IFACE_AGE@
 GETDATA_IFACE_VERSION = @GETDATA_IFACE_VERSION@
 GETDATA_IMPL_REVISION = @GETDATA_IMPL_REVISION@
+GETDATA_MAJOR = @GETDATA_MAJOR@
+GETDATA_MINOR = @GETDATA_MINOR@
+GETDATA_REVISION = @GETDATA_REVISION@
+GETDATA_VERSION_SUFFIX = @GETDATA_VERSION_SUFFIX@
 GREP = @GREP@
 GZIP_CPPFLAGS = @GZIP_CPPFLAGS@
 GZIP_LDFLAGS = @GZIP_LDFLAGS@
+GZIP_LIBS = @GZIP_LIBS@
 IDL = @IDL@
 IDL_CFLAGS = @IDL_CFLAGS@
 IDL_LIBS = @IDL_LIBS@
@@ -153,8 +189,13 @@ LTDLINCL = @LTDLINCL@
 LTLIBOBJS = @LTLIBOBJS@
 LZMA_CPPFLAGS = @LZMA_CPPFLAGS@
 LZMA_LDFLAGS = @LZMA_LDFLAGS@
+LZMA_LIBS = @LZMA_LIBS@
 MAKEINFO = @MAKEINFO@
 MANIFEST_TOOL = @MANIFEST_TOOL@
+MATLAB = @MATLAB@
+MATLABGETDATA_VERSION = @MATLABGETDATA_VERSION@
+MATLAB_CPPFLAGS = @MATLAB_CPPFLAGS@
+MEX = @MEX@
 MKDIR_P = @MKDIR_P@
 NM = @NM@
 NMEDIT = @NMEDIT@
@@ -171,6 +212,9 @@ PACKAGE_TARNAME = @PACKAGE_TARNAME@
 PACKAGE_URL = @PACKAGE_URL@
 PACKAGE_VERSION = @PACKAGE_VERSION@
 PATH_SEPARATOR = @PATH_SEPARATOR@
+PERL = @PERL@
+PERL_MAN3EXT = @PERL_MAN3EXT@
+PRINTF = @PRINTF@
 PRIVATE_LIBS = @PRIVATE_LIBS@
 PYTHON = @PYTHON@
 PYTHON_CPPFLAGS = @PYTHON_CPPFLAGS@
@@ -182,8 +226,12 @@ SET_MAKE = @SET_MAKE@
 SHELL = @SHELL@
 SLIM_CPPFLAGS = @SLIM_CPPFLAGS@
 SLIM_LDFLAGS = @SLIM_LDFLAGS@
+SLIM_LIBS = @SLIM_LIBS@
 STRIP = @STRIP@
 VERSION = @VERSION@
+ZZIP_CPPFLAGS = @ZZIP_CPPFLAGS@
+ZZIP_LDFLAGS = @ZZIP_LDFLAGS@
+ZZIP_LIBS = @ZZIP_LIBS@
 abs_builddir = @abs_builddir@
 abs_srcdir = @abs_srcdir@
 abs_top_builddir = @abs_top_builddir@
@@ -227,6 +275,8 @@ libexecdir = @libexecdir@
 localedir = @localedir@
 localstatedir = @localstatedir@
 mandir = @mandir@
+matlabbasedir = @matlabbasedir@
+mexext = @mexext@
 mkdir_p = @mkdir_p@
 moduledir = @moduledir@
 oldincludedir = @oldincludedir@
@@ -236,8 +286,12 @@ path_gunzip = @path_gunzip@
 path_gzip = @path_gzip@
 path_slim = @path_slim@
 path_unslim = @path_unslim@
+path_unzip = @path_unzip@
 path_xz = @path_xz@
+path_zip = @path_zip@
 pdfdir = @pdfdir@
+perldir = @perldir@
+perlmandir = @perlmandir@
 prefix = @prefix@
 program_transform_name = @program_transform_name@
 psdir = @psdir@
@@ -274,7 +328,7 @@ top_srcdir = @top_srcdir@
 AUTOMAKE_OPTIONS = foreign
 @CXX_WALL_TRUE at WALL = -Wall
 @CXX_WEXTRA_TRUE at WEXTRA = -Wextra
-INCLUDES = ${WALL} $(WEXTRA) -I$(srcdir)/.. -I$(top_srcdir)/src -D__TEST__=\"$@\"
+INCLUDES = ${WALL} $(WEXTRA) -I$(srcdir)/.. -I$(top_srcdir)/src
 LDADD = ../libgetdata++.la
 big_test_SOURCES = big_test.cpp
 all: all-am
@@ -320,7 +374,7 @@ clean-checkPROGRAMS:
 	list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \
 	echo " rm -f" $$list; \
 	rm -f $$list
-big_test$(EXEEXT): $(big_test_OBJECTS) $(big_test_DEPENDENCIES) 
+big_test$(EXEEXT): $(big_test_OBJECTS) $(big_test_DEPENDENCIES) $(EXTRA_big_test_DEPENDENCIES) 
 	@rm -f big_test$(EXEEXT)
 	$(CXXLINK) $(big_test_OBJECTS) $(big_test_LDADD) $(LIBS)
 
@@ -492,14 +546,15 @@ check-TESTS: $(TESTS)
 	  fi; \
 	  dashes=`echo "$$dashes" | sed s/./=/g`; \
 	  if test "$$failed" -eq 0; then \
-	    echo "$$grn$$dashes"; \
+	    col="$$grn"; \
 	  else \
-	    echo "$$red$$dashes"; \
+	    col="$$red"; \
 	  fi; \
-	  echo "$$banner"; \
-	  test -z "$$skipped" || echo "$$skipped"; \
-	  test -z "$$report" || echo "$$report"; \
-	  echo "$$dashes$$std"; \
+	  echo "$${col}$$dashes$${std}"; \
+	  echo "$${col}$$banner$${std}"; \
+	  test -z "$$skipped" || echo "$${col}$$skipped$${std}"; \
+	  test -z "$$report" || echo "$${col}$$report$${std}"; \
+	  echo "$${col}$$dashes$${std}"; \
 	  test "$$failed" -eq 0; \
 	else :; fi
 
@@ -549,10 +604,15 @@ install-am: all-am
 
 installcheck: installcheck-am
 install-strip:
-	$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
-	  install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
-	  `test -z '$(STRIP)' || \
-	    echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+	if test -z '$(STRIP)'; then \
+	  $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+	    install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+	      install; \
+	else \
+	  $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+	    install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+	    "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
+	fi
 mostlyclean-generic:
 
 clean-generic:
@@ -657,7 +717,7 @@ check-local: check-TESTS
 	$(MAKE) getdata-clean-dirs
 
 getdata-clean-dirs:
-	rm -rvf *odirfile
+	rm -rf *odirfile
 
 clean-local:
 	$(MAKE) getdata-clean-dirs
diff --git a/bindings/cxx/test/big_test.cpp b/bindings/cxx/test/big_test.cpp
index 2bd4d7a..48391e4 100644
--- a/bindings/cxx/test/big_test.cpp
+++ b/bindings/cxx/test/big_test.cpp
@@ -1,4 +1,4 @@
-// Copyright (C) 2009-2010 D. V. Wiebe
+// Copyright (C) 2009-2012 D. V. Wiebe
 //
 ///////////////////////////////////////////////////////////////////////////
 //
@@ -19,19 +19,30 @@
 // 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 //
 #ifdef HAVE_CONFIG_H
-#include "config.h"
-#undef GETDATA_LEGACY_API
+#include "gd_config.h"
 #endif
+#undef GETDATA_LEGACY_API
 
 #include "getdata/dirfile.h"
+#include "internal.h"
+
 #include <sys/stat.h>
 #include <sys/types.h>
 #include <fcntl.h>
 #include <string.h>
 #include <errno.h>
-#include <unistd.h>
 #include <iostream>
 #include <math.h>
+#include <stdlib.h>
+#include <stdio.h>
+
+#ifdef HAVE_DIRECT_H
+#include <direct.h>
+#endif
+
+#ifdef HAVE_UNISTD_H
+#include <unistd.h>
+#endif
 
 #if MKDIR_NO_MODE
 #ifdef HAVE__MKDIR
@@ -47,92 +58,121 @@
 using namespace std;
 using namespace GetData;
 
-#define CHECK_ERRORb(d,t,g) \
-  e = d->Error(); if (e != (g)) { ne++; cerr << "e[" << t << "] = " << e << endl; }
-#define CHECK_ERROR2b(d,t,n,g) \
-  e = d->Error(); if (e != (g)) { \
-    ne++; cerr << "e[" << t << ", " << n << "] = " << e << endl; }
-#define CHECK_ERROR(t,g) CHECK_ERRORb(d,t,g)
-#define CHECK_ERROR2(t,n,g) CHECK_ERROR2b(d,t,n,g)
+static int ne = 0;
+
+template <class T> static void CheckT(char c, int i, int t, int n, T v, T g,
+    int r)
+{
+  if (r) {
+    ne++;
+    cerr << c;
+    if (i != -1)
+      cerr << "(" << i << ")";
+    cerr << "[" << t;
+    if (n != -1)
+      cerr << ", " << n;
+    cerr << "] = " << v << " (expected " << g << ")" << endl;
+  }
+}
+
+static void CheckError(const Dirfile *d, int t, int n, int g)
+{
+  int e = d->Error();
+  CheckT<int>('e', -1, t, n, e, g, e != g);
+}
+
+static void CheckInt(int i, int t, int n, int v, int g)
+{
+  CheckT<int>('n', i, t, n, v, g, v != g);
+}
+
+template <class T> static void CheckFloat(char c, int i, int t, int n, T v, T g)
+{
+  CheckT<T>(c, i, t, n, v, g, (abs((v) - (g)) > 1e-10));
+}
+#define CHECK_ERROR(t,g) CheckError(d,t,-1,g)
+#define CHECK_ERROR2(t,n,g) CheckError(d,t,n,g)
 #define CHECK_OK(t) CHECK_ERROR(t,GD_E_OK)
 #define CHECK_OK2(t,n) CHECK_ERROR2(t,n,GD_E_OK)
 
-#define CHECK_NONNULL(t,v) \
-  if ((v) == NULL) { ne++; cerr << "p[" << t << "] = " << (v) << endl; }
+#define CHECK_NONNULL(t,v) CheckT<const void*>('p', -1, t, -1, v, NULL, !(v))
+
+#define CHECK_NULL(t,v) CheckT<const void*>('p', -1, t, -1, v, NULL, v)
+#define CHECK_NULL2(t,n,v) CheckT<const void*>('p', -1, t, n, v, NULL, v)
+
+#define CHECK_INT(t,v,g) CheckInt(-1, t, -1, v, g)
+#define CHECK_INT2(t,n,v,g) CheckInt(-1, t, n, v, g)
 
-#define CHECK_INT(t,v,g) \
-  if ((v) != (g)) { ne++; cerr << "n[" << t << "] = " << (v) << endl; }
-#define CHECK_INT2(t,n,v,g) \
-  if ((v) != (g)) { \
-    ne++; cerr << "n[" << t << ", " << n << "] = " << (v) << endl; }
 #define CHECK_INT_ARRAY(t,m,v,g) \
-  for (i = 0; i < m; ++i) if ((v) != (g)) { \
-    ne++; cerr << "n(" << i << ")[" << t << "] = " << (int)v << endl; }
-
-#define CHECK_DOUBLE(t,v,g) \
-  if (fabs((v) - (g)) > 1e-10) { \
-    ne++; cerr << "d[" << t << "] = " << (v) << endl; }
-#define CHECK_DOUBLE2(t,m,v,g) \
-  if (fabs((v) - (g)) > 1e-10) { \
-    ne++; cerr << "d[" << t << ", " << m << "] = " << (v) << endl; }
-#define CHECK_DOUBLE_ARRAY(t,m,n,v,g) \
-  for (i = 0; i < n; ++i) if (fabs((v) - (g)) > 1e-10) { \
-    ne++; cerr << "d(" << i << ")[" << t << ", " << m << "] = " << (v) << endl; }
+  for (i = 0; i < m; ++i) CheckInt(i, t, -1, v, g)
+
+#define CHECK_DOUBLE(t,v,g) CheckFloat<double>('d', -1, t, -1, v, g)
+#define CHECK_DOUBLE2(t,n,v,g) CheckFloat<double>('d', -1, t, n, v, g)
+
+#define CHECK_DOUBLE_ARRAY(t,n,m,v,g) \
+  for (i = 0; i < m; ++i) CheckFloat<double>('d', i, t, n, v, g)
 
 #define CHECK_STRING(t,v,g) \
-  if (strcmp((v), (g))) { ne++; cerr << "s[" << t << "] = " << (v) << endl; }
-#define CHECK_STRING2(t,m,v,g) \
-  if (strcmp((v), (g))) { \
-    ne++; cerr << "s[" << t << ", " << m << "] = " << (v) << endl; }
+  CheckT<const char*>('s', -1, t, -1, v, g, (strcmp((v), (g))))
+#define CHECK_STRING2(t,n,v,g) \
+  CheckT<const char*>('s', -1, t, n, v, g, (strcmp((v), (g))))
+
 #define CHECK_STRING_ARRAY(t,m,v,g) \
-  for (i = 0; i < m; ++i) if (strcmp((v), (g))) { \
-    ne++; cerr << "s(" << i << ")[" << t << "] = " << (v) << endl; }
+  for (i = 0; i < m; ++i) \
+CheckT<const char*>('s', i, t, -1, v, g, (strcmp((v), (g))))
 
-#define CHECK_COMPLEX2(t,m,v,g) \
-  if (abs((v) - (g)) > 1e-10) { \
-    ne++; cerr << "c[" << t << ", " << m << "] = " << (v).real() << ";" \
-    << (v).imag() << endl; }
+#define CHECK_EOSTRING(t,v,g) \
+  CheckT<const char*>('S', -1, t, -1, v, g, \
+      (strcmp((v) + strlen(v) - strlen(g), (g))))
+
+#define CHECK_COMPLEX2(t,n,v,g) \
+  CheckFloat<complex<double> >('c', -1, t, n, v, g)
 #define CHECK_COMPLEX_ARRAY(t,m,v,g) \
-  for (i = 0; i < m; ++i) if (abs((v) - (g)) > 1e-10) { \
-    ne++; cerr << "c(" << i << ")[" << t << "] = " << v.real() \
-    << ";" << v.imag() << endl; }
+  for (i = 0; i < m; ++i) CheckFloat<complex<double> >('c', i, t, -1, v, g)
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* form2 = __TEST__ "dirfile/form2";
-  const char* new1 = __TEST__ "dirfile/new1";
-  const char* data = __TEST__ "dirfile/data";
+  const char* filedir = "dirfile";
+  const char* format = "dirfile/format";
+  const char* format1 = "dirfile/format1";
+  const char* form2 = "dirfile/form2";
+  const char* new1 = "dirfile/new1";
+  const char* data = "dirfile/data";
   const char* format_data =
     "/ENDIAN little\n"
     "data RAW INT8 8\n"
     "lincom LINCOM data 1.1 2.2 INDEX 2.2 3.3;4.4 linterp const const\n"
     "/META data mstr STRING \"This is a string constant.\"\n"
     "/META data mconst CONST COMPLEX128 3.3;4.4\n"
+    "/META data mcarray CARRAY FLOAT64 1.9 2.8 3.7 4.6 5.5\n"
     "/META data mlut LINTERP DATA ./lut\n"
     "const CONST FLOAT64 5.5\n"
     "carray CARRAY FLOAT64 1.1 2.2 3.3 4.4 5.5 6.6\n"
-    "linterp LINTERP data /look/up/file\n"
+    "linterp LINTERP data ./lut\n"
     "polynom POLYNOM data 1.1 2.2 2.2 3.3;4.4 const const\n"
     "bit BIT data 3 4\n"
     "sbit SBIT data 5 6\n"
+    "mplex MPLEX data sbit 1 10\n"
     "mult MULTIPLY data sbit\n"
     "div DIVIDE mult bit\n"
     "recip RECIP div 6.5;4.3\n"
     "phase PHASE data 11\n"
+    "window WINDOW linterp mult LT 4.1\n"
+    "/ALIAS alias data\n"
     "string STRING \"Zaphod Beeblebrox\"\n";
   const char* form2_data = "const2 CONST INT8 -19\n";
-  const int nfields = 14;
+  const int nfields = 17;
   unsigned char c[8];
   unsigned char data_data[80];
   signed char sc;
-  int n, i, e, ne = 0;
+  int m, n, i;
   float fl;
   double dp, p[6], q[6];
+  const double *qp;
   complex<double> cq[6];
   const char **list;
   const char* str;
+  char* tok;
   char buf[GD_MAX_LINE_LENGTH];
   Dirfile *d;
   Entry *ent;
@@ -149,13 +189,26 @@ int main(void)
   ConstEntry cent, *cep;
   CarrayEntry aent, *aep;
   StringEntry gent;
+  WindowEntry went, *wep;
+  MplexEntry xent, *xep;
   Fragment *frag;
+  gd_triplet_t thresh;
+  const gd_carray_t *carrays;
 
-  char* fields[nfields + 7] = {(char*)"INDEX", (char*)"bit", (char*)"carray",
-    (char*)"const", (char*)"data", (char*)"div", (char*)"lincom",
-    (char*)"linterp", (char*)"mult", (char*)"phase", (char*)"polynom",
-    (char*)"recip", (char*)"sbit", (char*)"string", NULL, NULL, NULL, NULL,
-    NULL, NULL, NULL};
+  char* fields[nfields + 9] = {(char*)"INDEX", (char*)"alias", (char*)"bit",
+    (char*)"carray", (char*)"const", (char*)"data", (char*)"div",
+    (char*)"lincom", (char*)"linterp", (char*)"mplex", (char*)"mult",
+    (char*)"phase", (char*)"polynom", (char*)"recip", (char*)"sbit",
+    (char*)"string", (char*)"window", NULL, NULL, NULL, NULL, NULL, NULL, NULL,
+    NULL, NULL};
+  char *strings[3];
+
+  unlink(data);
+  unlink(new1);
+  unlink(format);
+  unlink(format1);
+  unlink(form2);
+  rmdir(filedir);
 
   // Write the test dirfile
   mkdir(filedir, 0777);
@@ -209,12 +262,13 @@ int main(void)
   // 9: Dirfile::NFields check
   n = d->NMFields("data");
   CHECK_OK(9);
-  CHECK_INT(9,n,3);
+  CHECK_INT(9,n,4);
 
   // 10: Dirfile::MFieldList check
   fields[0] = (char*)"mstr";
   fields[1] = (char*)"mconst";
-  fields[2] = (char*)"mlut";
+  fields[2] = (char*)"mcarray";
+  fields[3] = (char*)"mlut";
   list = d->MFieldList("data");
   CHECK_OK(10);
   CHECK_STRING_ARRAY(10,n,list[i],fields[i]);
@@ -294,7 +348,7 @@ int main(void)
   CHECK_INT2(21,1,ent->Type(),LinterpEntryType);
   CHECK_INT2(21,2,ent->FragmentIndex(),0);
   CHECK_STRING2(21,3,ent->Input(),"data");
-  CHECK_STRING2(21,4,ent->Table(),"/look/up/file");
+  CHECK_STRING2(21,4,ent->Table(),"./lut");
   delete ent;
 
   // 22: Dirfile::Entry / BitEntry check
@@ -584,7 +638,8 @@ int main(void)
   // 39: Fragment check
   frag = d->Fragment(0);
   CHECK_OK(39);
-  CHECK_STRING(39,frag->Name(),__TEST__ "dirfile/format");
+  sprintf(buf, "dirfile%cformat", GD_DIRSEP);
+  CHECK_EOSTRING(39,frag->Name(), buf);
   delete frag;
 
   // 40: Dirfile::NFragments check
@@ -616,30 +671,33 @@ int main(void)
   // 44: Dirfile::NVectors check
   n = d->NVectors();
   CHECK_OK(44);
-  CHECK_INT(44,n,21);
+  CHECK_INT(44,n,24);
 
   // 45: Dirfile::VectorList check
   fields[0] = (char*)"INDEX";
-  fields[1] = (char*)"bit";
-  fields[2] = (char*)"data";
-  fields[3] = (char*)"div";
-  fields[4] = (char*)"lincom";
-  fields[5] = (char*)"linterp";
-  fields[6] = (char*)"mult";
-  fields[7] = (char*)"new1";
-  fields[8] = (char*)"new10";
-  fields[9] = (char*)"new2";
-  fields[10] = (char*)"new3";
-  fields[11] = (char*)"new4";
-  fields[12] = (char*)"new5";
-  fields[13] = (char*)"new6";
-  fields[14] = (char*)"new7";
-  fields[15] = (char*)"new8";
-  fields[16] = (char*)"new9";
-  fields[17] = (char*)"phase";
-  fields[18] = (char*)"polynom";
-  fields[19] = (char*)"recip";
-  fields[20] = (char*)"sbit";
+  fields[1] = (char*)"alias";
+  fields[2] = (char*)"bit";
+  fields[3] = (char*)"data";
+  fields[4] = (char*)"div";
+  fields[5] = (char*)"lincom";
+  fields[6] = (char*)"linterp";
+  fields[7] = (char*)"mplex";
+  fields[8] = (char*)"mult";
+  fields[9] = (char*)"new1";
+  fields[10] = (char*)"new10";
+  fields[11] = (char*)"new2";
+  fields[12] = (char*)"new3";
+  fields[13] = (char*)"new4";
+  fields[14] = (char*)"new5";
+  fields[15] = (char*)"new6";
+  fields[16] = (char*)"new7";
+  fields[17] = (char*)"new8";
+  fields[18] = (char*)"new9";
+  fields[19] = (char*)"phase";
+  fields[20] = (char*)"polynom";
+  fields[21] = (char*)"recip";
+  fields[22] = (char*)"sbit";
+  fields[23] = (char*)"window";
   list = d->VectorList();
   CHECK_OK(45);
   CHECK_STRING_ARRAY(45,n,list[i],fields[i]);
@@ -949,7 +1007,7 @@ int main(void)
   // 80: Dirfile::Name check
   str = d->Name();
   CHECK_OK(80);
-  CHECK_STRING(80,str,__TEST__ "dirfile");
+  CHECK_EOSTRING(80,str,"dirfile");
 
   // 81: Fragment::Parent check
   frag = d->Fragment(1);
@@ -969,7 +1027,8 @@ int main(void)
   // 84: RawEntry::FileName check
   str = rep->FileName();
   CHECK_OK(84);
-  CHECK_STRING(84,str,__TEST__ "dirfile/new1");
+  sprintf(buf, "dirfile%cnew1", GD_DIRSEP);
+  CHECK_EOSTRING(84,str, buf);
   delete rep;
 
   // 85: Dirfile::Reference check
@@ -981,7 +1040,7 @@ int main(void)
   // 135: Dirfile::ReferenceFilename check
   str = d->ReferenceFilename();
   CHECK_OK(135);
-  CHECK_STRING(135,str,__TEST__ "dirfile/new1");
+  CHECK_EOSTRING(135,str, buf);
   
   // 87: Fragment::SetEncoding check
   frag->SetEncoding(SlimEncoding,0);
@@ -1207,17 +1266,17 @@ int main(void)
   
   // 156: Invalid Dirfile check
   Dirfile *id = new Dirfile();
-  CHECK_ERROR2b(id,156,1,GD_E_OK);
+  CheckError(id,156,1,GD_E_OK);
   id->NFragments();
-  CHECK_ERROR2b(id,156,2,GD_E_BAD_DIRFILE);
+  CheckError(id,156,2,GD_E_BAD_DIRFILE);
   delete id;
 
   // 157: Dirfile::Standards check
   n = d->Standards();
   CHECK_OK2(157,1);
-  CHECK_INT(157,n,8);
+  CHECK_INT(157,n,9);
   d->Standards(0);
-  CHECK_ERROR2(157,2,GD_E_BAD_VERSION);
+  CHECK_ERROR2(157,2,GD_E_ARGUMENT);
 
   // 158 gd_get_carray
   n = d->GetCarray("carray", Float64, p);
@@ -1232,7 +1291,7 @@ int main(void)
   CHECK_DOUBLE_ARRAY(159,1,2,p[i],1.1 * (i + 3));
 
   // 167 gd_carrays
-  const gd_carray_t *carrays = d->Carrays(Float64);
+  carrays = d->Carrays(Float64);
   CHECK_OK(167);
   CHECK_NONNULL(167,carrays);
   CHECK_INT2(167,1,carrays[0].n,6);
@@ -1294,6 +1353,23 @@ int main(void)
   CHECK_INT2(179,4,ent->ArrayLen(),4);
   delete ent;
 
+  // 180: gd_madd_carray
+  aent.Dissociate();
+  aent.SetName("mnew17");
+  aent.SetFragmentIndex(0);
+  aent.SetType(Float64);
+  aent.SetArrayLen(2);
+  d->MAdd(aent, "data");
+  CHECK_OK2(180,1);
+
+  ent = d->Entry("data/mnew17");
+  CHECK_OK2(180,2);
+  CHECK_INT2(180,1,ent->Type(),CarrayEntryType);
+  CHECK_INT2(180,2,ent->FragmentIndex(),0);
+  CHECK_INT2(180,3,ent->ConstType(),Float64);
+  CHECK_INT2(180,4,ent->ArrayLen(),2);
+  delete ent;
+
   // 181 gd_alter_carray
   aep = reinterpret_cast<CarrayEntry*>(d->Entry("new17"));
   CHECK_OK2(181,1);
@@ -1311,6 +1387,394 @@ int main(void)
   CHECK_INT2(181,4,ent->ArrayLen(),12);
   delete ent;
 
+  // 183: gd_constants
+  p[0] = 61.;
+  p[1] = 0.;
+  n = d->NFieldsByType(ConstEntryType);
+  qp = reinterpret_cast<const double *>(d->Constants());
+  CHECK_OK(183);
+  CHECK_DOUBLE_ARRAY(183,0,n,qp[i],p[i]);
+
+  // 184: gd_mconstants
+  p[0] = 3.3;
+  p[1] = 0.;
+  n = d->NMFieldsByType("data", ConstEntryType);
+  qp = reinterpret_cast<const double *>(d->MConstants("data"));
+  CHECK_OK(184);
+  CHECK_DOUBLE_ARRAY(184,0,n,qp[i],p[i]);
+
+  // 199: gd_strings
+  strings[0] = (char *)"Lorem ipsum";
+  strings[1] = (char *)"";
+  strings[2] = (char *)"Arthur Dent";
+  n = d->NFieldsByType(StringEntryType);
+  list = d->Strings();
+  CHECK_OK(199);
+  CHECK_STRING_ARRAY(199,n,list[i],strings[i]);
+
+  // 200: gd_strings
+  strings[0] = (char *)"This is a string constant.";
+  n = d->NMFieldsByType("data", StringEntryType);
+  list = d->MStrings("data");
+  CHECK_OK(200);
+  CHECK_STRING_ARRAY(200,n,list[i],strings[i]);
+
+  // 203: gd_seek
+  n = d->Seek("data", 35, 0, GD_SEEK_SET);
+  CHECK_OK2(203,0);
+  m = d->GetData("data", GD_HERE, 0, 1, 0, UInt8, c);
+  CHECK_OK2(203,1);
+  CHECK_INT2(203,0,n,280);
+  CHECK_INT2(203,1,m,8);
+  CHECK_INT_ARRAY(203,8,c[i],17 + i);
+
+  // 204: gd_tell
+  n = d->Tell("data");
+  CHECK_OK(204);
+  CHECK_INT(204,n,288);
+
+  // 205: gd_hide check
+  n = d->Hide("data");
+  CHECK_OK(205);
+
+  // 206: gd_hidden check
+  n = d->Hidden("data");
+  CHECK_OK2(206, 1);
+  CHECK_INT2(206, 1, n, 1);
+
+  n = d->Hidden("lincom");
+  CHECK_OK2(206, 2);
+  CHECK_INT2(206, 2, n, 0);
+
+  // 207: gd_unhide check
+  n = d->UnHide("data");
+  CHECK_OK2(206, 1);
+  n = d->Hidden("data");
+  CHECK_OK2(206, 2);
+  CHECK_INT2(206, 2, n, 0);
+
+  // 208: gd_sync check
+  d->Sync("data");
+  CHECK_OK(208);
+
+  // 209: gd_flush check
+  d->Flush("data");
+  CHECK_OK(209);
+
+  // 210: gd_metaflush check
+  d->MetaFlush();
+  CHECK_OK(210);
+
+  // 211: gd_entry (WINDOW) check
+  ent = d->Entry("window");
+  CHECK_OK(211);
+  CHECK_INT2(211, 1, ent->Type(), WindowEntryType);
+  CHECK_INT2(211, 2, ent->FragmentIndex(), 0);
+  CHECK_INT2(211, 3, ent->WindOp(), WindOpLt);
+  CHECK_STRING2(211, 4, ent->Input(0), "linterp");
+  CHECK_STRING2(211, 5, ent->Input(1), "mult");
+  CHECK_DOUBLE2(211, 6, ent->Threshold().r, 4.1);
+  delete ent;
+
+  // 212: Dirfile::Add / WindowEntry check
+  went.SetName("new18");
+  went.SetFragmentIndex(0);
+  went.SetInput("in1", 0);
+  went.SetInput("in2", 1);
+  went.SetWindOp(WindOpNe);
+  thresh.i = 32;
+  went.SetThreshold(thresh);
+  d->Add(went);
+  CHECK_OK2(212, 1);
+
+  ent = d->Entry("new18");
+  CHECK_OK2(212, 2);
+  CHECK_INT2(212, 1, ent->Type(), WindowEntryType);
+  CHECK_INT2(212, 2, ent->FragmentIndex(), 0);
+  CHECK_INT2(212, 3, ent->WindOp(), WindOpNe);
+  CHECK_STRING2(212, 4, ent->Input(0), "in1");
+  CHECK_STRING2(212, 5, ent->Input(1), "in2");
+  CHECK_INT2(212, 6, ent->Threshold().i, 32);
+  delete ent;
+
+  // 214: gd_madd_window_i check
+  went.Dissociate();
+  went.SetName("mnew18");
+  went.SetInput("in2", 0);
+  went.SetInput("in3", 1);
+  went.SetWindOp(WindOpSet);
+  thresh.u = 128;
+  went.SetThreshold(thresh);
+  d->MAdd(went, "data");
+  CHECK_OK2(214, 1);
+
+  ent = d->Entry("data/mnew18");
+  CHECK_OK2(214, 2);
+  CHECK_INT2(214, 1, ent->Type(), WindowEntryType);
+  CHECK_INT2(214, 2, ent->FragmentIndex(), 0);
+  CHECK_INT2(214, 3, ent->WindOp(), WindOpSet);
+  CHECK_STRING2(214, 4, ent->Input(0), "in2");
+  CHECK_STRING2(214, 5, ent->Input(1), "in3");
+  CHECK_INT2(214, 6, ent->Threshold().u, 128);
+  delete ent;
+
+  // 217: gd_alter_window_r check
+  wep = reinterpret_cast<WindowEntry*>(d->Entry("new18"));
+  wep->SetInput("in3", 0);
+  wep->SetInput("in4", 1);
+  wep->SetWindOp(WindOpGe);
+  thresh.r = 32e3;
+  wep->SetThreshold(thresh);
+  CHECK_OK2(217, 1);
+  delete wep;
+
+  ent = d->Entry("new18");
+  CHECK_OK2(217, 2);
+  CHECK_INT2(217, 1, ent->Type(), WindowEntryType);
+  CHECK_INT2(217, 2, ent->FragmentIndex(), 0);
+  CHECK_INT2(217, 3, ent->WindOp(), WindOpGe);
+  CHECK_STRING2(217, 4, ent->Input(0), "in3");
+  CHECK_STRING2(217, 5, ent->Input(1), "in4");
+  CHECK_DOUBLE2(217, 6, ent->Threshold().r, 32e3);
+  delete ent;
+
+  // 218: gd_alias_target check
+  str = d->AliasTarget("alias");
+  CHECK_OK(218);
+  CHECK_STRING(218, str, "data");
+
+  // 219: gd_add_alias check
+  d->AddAlias("new20", "data", 0);
+  CHECK_OK2(219, 1);
+
+  str = d->AliasTarget("new20");
+  CHECK_OK2(219, 2);
+  CHECK_STRING(219, str, "data");
+
+  // 220: gd_madd_alias check
+  d->MAddAlias("data", "mnew20", "data");
+  CHECK_OK2(220, 1);
+
+  str = d->AliasTarget("data/mnew20");
+  CHECK_OK2(220, 2);
+  CHECK_STRING(220, str, "data");
+
+  // 221: gd_naliases check
+  n = d->NAliases("data");
+  CHECK_OK(221);
+  CHECK_INT(221, n, 4);
+
+  // 222: gd_aliases check
+  fields[1] = (char*)"data";
+  fields[2] = (char*)"alias";
+  fields[3] = (char*)"data/mnew20";
+  fields[4] = (char*)"new20";
+  list = d->Aliases("data");
+  CHECK_OK(222);
+  CHECK_STRING_ARRAY(222,i,list[i],fields[i]);
+
+  // 223: gd_include_affix check
+  d->IncludeAffix("format1", 0, "A", "Z", GD_CREAT | GD_EXCL);
+  CHECK_OK(223);
+
+  // 224: gd_move_alias check
+  d->MoveAlias("new20", 1);
+  CHECK_OK2(224, 1);
+
+  n = d->FragmentIndex("Anew20Z");
+  CHECK_OK2(224, 2);
+  CHECK_INT(224, n, 1);
+
+  // 225: gd_delete_alias check
+  d->DeleteAlias("Anew20Z", 0);
+  CHECK_OK2(225, 1);
+
+  n = d->FragmentIndex("Anew20Z");
+  CHECK_ERROR2(225, 2, GD_E_BAD_CODE);
+  CHECK_INT(225, n, -1);
+
+  // 226: gd_fragment_affixes check
+  frag = d->Fragment(1);
+
+  CHECK_STRING2(226, 1, frag->Prefix(), "A");
+  CHECK_STRING2(226, 2, frag->Suffix(), "Z");
+
+  // 227: gd_alter_affixes check
+  frag->SetPrefix("B");
+  CHECK_OK2(227, 1);
+  frag->SetSuffix("C");
+  CHECK_OK2(227, 2);
+
+  CHECK_STRING2(227, 3, frag->Prefix(), "B");
+  CHECK_STRING2(227, 3, frag->Suffix(), "C");
+  delete frag;
+
+  // 228: gd_entry (MPLEX) check
+  ent = d->Entry("mplex");
+  CHECK_OK(228);
+  CHECK_INT2(228, 1, ent->Type(), MplexEntryType);
+  CHECK_INT2(228, 2, ent->FragmentIndex(), 0);
+  CHECK_INT2(228, 3, ent->CountVal(), 1);
+  CHECK_STRING2(228, 4, ent->Input(0), "data");
+  CHECK_STRING2(228, 5, ent->Input(1), "sbit");
+  CHECK_INT2(228, 6, ent->Period(), 10);
+  delete ent;
+
+  // 229: Dirfile::Add / MplexEntry check
+  xent.SetName("new21");
+  xent.SetFragmentIndex(0);
+  xent.SetInput("in1", 0);
+  xent.SetInput("in2", 1);
+  xent.SetCountVal(5);
+  xent.SetPeriod(6);
+  d->Add(xent);
+  CHECK_OK2(229, 1);
+
+  ent = d->Entry("new21");
+  CHECK_OK2(229, 2);
+  CHECK_INT2(229, 1, ent->Type(), MplexEntryType);
+  CHECK_INT2(229, 2, ent->FragmentIndex(), 0);
+  CHECK_INT2(229, 3, ent->CountVal(), 5);
+  CHECK_STRING2(229, 4, ent->Input(0), "in1");
+  CHECK_STRING2(229, 5, ent->Input(1), "in2");
+  CHECK_INT2(229, 6, ent->Period(), 6);
+  delete ent;
+
+  // 230: gd_madd_mplex check
+  xent.Dissociate();
+  xent.SetName("mnew21");
+  xent.SetInput("in2", 0);
+  xent.SetInput("in3", 1);
+  xent.SetCountVal(0);
+  xent.SetPeriod(12);
+  d->MAdd(xent, "data");
+  CHECK_OK2(230, 1);
+
+  ent = d->Entry("data/mnew21");
+  CHECK_OK2(230, 2);
+  CHECK_INT2(230, 1, ent->Type(), MplexEntryType);
+  CHECK_INT2(230, 2, ent->FragmentIndex(), 0);
+  CHECK_INT2(230, 3, ent->CountVal(), 0);
+  CHECK_STRING2(230, 4, ent->Input(0), "in2");
+  CHECK_STRING2(230, 5, ent->Input(1), "in3");
+  CHECK_INT2(230, 6, ent->Period(), 12);
+  delete ent;
+
+  // 231: gd_alter_mplex check
+  xep = reinterpret_cast<MplexEntry*>(d->Entry("new21"));
+  xep->SetInput("in3", 0);
+  xep->SetInput("in4", 1);
+  xep->SetCountVal(3);
+  xep->SetPeriod(7);
+  CHECK_OK2(231, 1);
+  delete xep;
+
+  ent = d->Entry("new21");
+  CHECK_OK2(231, 2);
+  CHECK_INT2(231, 1, ent->Type(), MplexEntryType);
+  CHECK_INT2(231, 2, ent->FragmentIndex(), 0);
+  CHECK_INT2(231, 3, ent->CountVal(), 3);
+  CHECK_STRING2(231, 4, ent->Input(0), "in3");
+  CHECK_STRING2(231, 5, ent->Input(1), "in4");
+  CHECK_INT2(231, 6, ent->Period(), 7);
+  delete ent;
+
+  // 232: gd_tokenise
+  tok = d->StrTok("\"test1 test2\" test3\\ test4");
+  CHECK_OK2(232, 1);
+  CHECK_STRING2(232, 2, tok, "test1 test2");
+  free(tok);
+
+  tok = d->StrTok();
+  CHECK_OK2(232, 3);
+  CHECK_STRING2(232, 4, tok, "test3 test4");
+  free(tok);
+
+  // 233: gd_raw_close check
+  d->RawClose("data");
+  CHECK_OK(233);
+
+  // 234: gd_desync check
+  n = d->DeSync();
+  CHECK_OK(234);
+  CHECK_INT(234, n, 0);
+
+  // 235: gd_flags check
+  n = d->Flags(GD_PRETTY_PRINT, 0);
+  CHECK_OK(235);
+  CHECK_INT(235, n, GD_PRETTY_PRINT);
+
+  // 236: gd_verbose_prefix
+  d->VerbosePrefix("big_test: ");
+  CHECK_OK(236);
+
+  // 237: gd_nentries
+  n = d->NEntries("data", GD_SCALAR_ENTRIES,
+      GD_ENTRIES_HIDDEN | GD_ENTRIES_NOALIAS);
+  CHECK_OK2(237, 1);
+  CHECK_INT2(237, 1, n, 4);
+  n = d->NEntries(NULL, GD_VECTOR_ENTRIES,
+      GD_ENTRIES_HIDDEN | GD_ENTRIES_NOALIAS);
+  CHECK_OK2(237, 2);
+  CHECK_INT2(237, 2, n, 26);
+
+  // 239: gd_entry_list
+  fields[0] = (char*)"INDEX";
+  fields[1] = (char*)"bit";
+  fields[2] = (char*)"data";
+  fields[3] = (char*)"div";
+  fields[4] = (char*)"lincom";
+  fields[5] = (char*)"linterp";
+  fields[6] = (char*)"mplex";
+  fields[7] = (char*)"mult";
+  fields[8] = (char*)"new1";
+  fields[9] = (char*)"new14";
+  fields[10] = (char*)"new15";
+  fields[11] = (char*)"new16";
+  fields[12] = (char*)"new18";
+  fields[13] = (char*)"new2";
+  fields[14] = (char*)"new21";
+  fields[15] = (char*)"new3";
+  fields[16] = (char*)"new4";
+  fields[17] = (char*)"new5";
+  fields[18] = (char*)"new6";
+  fields[19] = (char*)"new7";
+  fields[20] = (char*)"new8";
+  fields[21] = (char*)"phase";
+  fields[22] = (char*)"polynom";
+  fields[23] = (char*)"recip";
+  fields[24] = (char*)"sbit";
+  fields[25] = (char*)"window";
+  list = d->EntryList(NULL, GD_VECTOR_ENTRIES,
+      GD_ENTRIES_HIDDEN | GD_ENTRIES_NOALIAS);
+  CHECK_OK(239);
+  CHECK_STRING_ARRAY(239,n,list[i],fields[i]);
+
+  // 240: gd_mplex_lookback
+  d->MplexLookback(GD_LOOKBACK_ALL);
+  CHECK_OK(240);
+
+  // 241: gd_linterp_tablename check
+  tok = d->LinterpTableName("linterp");
+  CHECK_OK(241);
+  sprintf(buf, "dirfile%clut", GD_DIRSEP);
+  CHECK_EOSTRING(241,tok,buf);
+  free(tok);
+
+  // 242: gd_carrays
+  carrays = d->MCarrays("data", Float64);
+  CHECK_OK(242);
+  CHECK_NONNULL(242,carrays);
+  CHECK_INT2(242,1,carrays[0].n,5);
+  CHECK_DOUBLE_ARRAY(242,2,5,((double*)carrays[0].d)[i],(1.9 + i * 0.9));
+  CHECK_INT2(242,3,carrays[1].n,2);
+  CHECK_DOUBLE_ARRAY(242,4,2,((double*)carrays[1].d)[i],0);
+  CHECK_INT2(242,5,carrays[2].n,0);
+
+
+
+
+
 
 
   // ===================================================================
@@ -1319,6 +1783,7 @@ int main(void)
   unlink(data);
   unlink(new1);
   unlink(format);
+  unlink(format1);
   unlink(form2);
   rmdir(filedir);
 
diff --git a/bindings/cxx/windowentry.cpp b/bindings/cxx/windowentry.cpp
new file mode 100644
index 0000000..3c0a020
--- /dev/null
+++ b/bindings/cxx/windowentry.cpp
@@ -0,0 +1,126 @@
+// Copyright (C) 2011-2012 D. V. Wiebe
+//
+///////////////////////////////////////////////////////////////////////////
+//
+// This file is part of the GetData project.
+//
+// GetData is free software; you can redistribute it and/or modify it under
+// the terms of the GNU Lesser General Public License as published by the
+// Free Software Foundation; either version 2.1 of the License, or (at your
+// option) any later version.
+//
+// GetData is distributed in the hope that it will be useful, but WITHOUT
+// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+// FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+// License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public License
+// along with GetData; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+//
+#include "internal.h"
+
+WindowEntry::WindowEntry(const char* field_code, const char* in_field,
+    const char* check, WindOpType windop, gd_triplet_t threshold,
+    int fragment_index) : Entry()
+{
+  dtrace("\"%s\", \"%s\", \"%s\", %i, {%g,%llx,%lli}, %i", field_code,
+      in_field, check, (unsigned)windop, threshold.r,
+      (unsigned long long)threshold.u, (long long)threshold.i, fragment_index);
+
+  E.field = strdup(field_code);
+  E.field_type = GD_WINDOW_ENTRY;
+  E.in_fields[0] = strdup(in_field);
+  E.in_fields[1] = strdup(check);
+  E.scalar[0] = 0;
+  E.u.window.windop = (gd_windop_t)windop;
+  E.u.window.threshold = threshold;
+  E.fragment_index = fragment_index;
+
+  dreturnvoid();
+}
+
+int WindowEntry::SetInput(const char* field, int index)
+{
+  if (index < 0 || index > 1)
+    return -1;
+
+  char* ptr = strdup(field);
+
+  if (ptr == NULL)
+    return -1;
+
+  free(E.in_fields[index]);
+  E.in_fields[index] = ptr;
+
+  if (D != NULL)
+    return gd_alter_entry(D->D, E.field, &E, 0);
+  
+  return 0;
+}
+
+int WindowEntry::SetWindOp(WindOpType windop)
+{
+  int ret = 0;
+
+  dtrace("0x%X", (unsigned)windop);
+
+  E.u.window.windop = (gd_windop_t)windop;
+
+  if (D != NULL)
+    ret = gd_alter_entry(D->D, E.field, &E, 0);
+  
+  dreturn("%i", ret);
+  return ret;
+}
+
+int WindowEntry::SetThreshold(gd_triplet_t threshold)
+{
+  int ret = 0;
+
+  dtrace("{%g,%llX,%lli}", threshold.r, (unsigned long long)threshold.u,
+      (long long)threshold.i);
+
+  E.u.window.threshold = threshold;
+
+  if (D != NULL)
+    ret = gd_alter_entry(D->D, E.field, &E, 0);
+  
+  dreturn("%i", ret);
+  return ret;
+}
+
+int WindowEntry::SetThreshold(const char *threshold)
+{
+  int r = 0;
+
+  dtrace("\"%s\"", threshold);
+
+  SetScalar(0, threshold);
+
+  if (D != NULL) {
+    r = gd_alter_entry(D->D, E.field, &E, 0);
+
+    if (!r) {
+      switch(E.u.window.windop) {
+        case GD_WINDOP_EQ:
+        case GD_WINDOP_NE:
+          r = gd_get_constant(D->D, threshold, GD_INT64,
+              &E.u.window.threshold.i);
+          break;
+        case GD_WINDOP_SET:
+        case GD_WINDOP_CLR:
+          r = gd_get_constant(D->D, threshold, GD_UINT64,
+              &E.u.window.threshold.u);
+          break;
+        default:
+          r = gd_get_constant(D->D, threshold, GD_FLOAT64,
+              &E.u.window.threshold.r);
+          break;
+      }
+    }
+  }
+  
+  dreturn("%i", r);
+  return r;
+}
diff --git a/bindings/f77/Makefile.am b/bindings/f77/Makefile.am
index 3d0e934..0029a3c 100644
--- a/bindings/f77/Makefile.am
+++ b/bindings/f77/Makefile.am
@@ -44,10 +44,6 @@ F95_INC=getdata.mod
 F95_LIB=libf95getdata.la
 endif
 
-if GETDATA_DEBUG
-DEBUG_C = ../../src/debug.c
-endif
-
 FCFLAGS += $(FC_WALL) $(FC_WEXTRA)
 INCLUDES = -I$(top_srcdir)/src
 EXTRA_DIST=getdata.f.in getdata.f90.in
@@ -55,17 +51,18 @@ EXTRA_DIST=getdata.f.in getdata.f90.in
 SUBDIRS = test
 
 BUILT_SOURCES=getdata.f $(F95_INC)
+LIBS=
 
 nodist_include_HEADERS=getdata.f $(F95_INC)
 
 lib_LTLIBRARIES=libfgetdata.la $(F95_LIB)
 libfgetdata_la_CPPFLAGS = ${CC_WALL} $(CC_WEXTRA)
-libfgetdata_la_SOURCES = fgetdata.c fgetdata.h $(DEBUG_C)
+libfgetdata_la_SOURCES = fgetdata.c fgetdata.h
 libfgetdata_la_LIBADD=../../src/libgetdata.la
 libfgetdata_la_LDFLAGS = -version-info @FGETDATA_VERSION@
 
 nodist_libf95getdata_la_SOURCES=getdata.f90
-libf95getdata_la_LIBADD=libfgetdata.la ../../src/libgetdata.la
+libf95getdata_la_LIBADD=libfgetdata.la
 libf95getdata_la_LDFLAGS = -version-info @F95GETDATA_VERSION@
 
 getdata.mod: getdata.o
@@ -83,8 +80,8 @@ make_parameters.sed.in: ../make_parameters ../../src/getdata.h
 
 make_parameters.sed: make_parameters.stamp
 	@if test ! -f $@; then \
-		rm -f $<; \
-		$(MAKE) $<; \
+		rm -f make_parameters.stamp; \
+		$(MAKE) make_parameters.stamp; \
 		fi
 
 if HAVE_DIFF
@@ -109,10 +106,10 @@ endif
 
 getdata.f: $(srcdir)/getdata.f.in make_parameters.sed
 	rm -f $@
-	$(SED) -f make_parameters.sed $< > $@
+	$(SED) -f make_parameters.sed $(srcdir)/getdata.f.in > $@
 	chmod a-w $@
 
 getdata.f90: $(srcdir)/getdata.f90.in make_parameters.sed
 	rm -f $@
-	$(SED) -f make_parameters.sed $< > $@
+	$(SED) -f make_parameters.sed $(srcdir)/getdata.f90.in > $@
 	chmod a-w $@
diff --git a/bindings/f77/Makefile.in b/bindings/f77/Makefile.in
index aaf9d39..0db5483 100644
--- a/bindings/f77/Makefile.in
+++ b/bindings/f77/Makefile.in
@@ -1,9 +1,9 @@
-# Makefile.in generated by automake 1.11.1 from Makefile.am.
+# Makefile.in generated by automake 1.11.5 from Makefile.am.
 # @configure_input@
 
 # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005, 2006, 2007, 2008, 2009  Free Software Foundation,
-# Inc.
+# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software
+# Foundation, Inc.
 # This Makefile.in is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
@@ -17,6 +17,23 @@
 
 
 VPATH = @srcdir@
+am__make_dryrun = \
+  { \
+    am__dry=no; \
+    case $$MAKEFLAGS in \
+      *\\[\ \	]*) \
+        echo 'am--echo: ; @echo "AM"  OK' | $(MAKE) -f - 2>/dev/null \
+          | grep '^AM OK$$' >/dev/null || am__dry=yes;; \
+      *) \
+        for am__flg in $$MAKEFLAGS; do \
+          case $$am__flg in \
+            *=*|--*) ;; \
+            *n*) am__dry=yes; break;; \
+          esac; \
+        done;; \
+    esac; \
+    test $$am__dry = yes; \
+  }
 pkgdatadir = $(datadir)/@PACKAGE@
 pkgincludedir = $(includedir)/@PACKAGE@
 pkglibdir = $(libdir)/@PACKAGE@
@@ -40,15 +57,17 @@ DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
 am__aclocal_m4_deps = $(top_srcdir)/m4/ax_compare_version.m4 \
 	$(top_srcdir)/m4/compiler.m4 $(top_srcdir)/m4/encoding.m4 \
-	$(top_srcdir)/m4/idl.m4 $(top_srcdir)/m4/libtool.m4 \
-	$(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \
-	$(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \
-	$(top_srcdir)/m4/python.m4 $(top_srcdir)/m4/win32.m4 \
-	$(top_srcdir)/m4/version.m4 $(top_srcdir)/configure.ac
+	$(top_srcdir)/m4/floatordering.m4 $(top_srcdir)/m4/idl.m4 \
+	$(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \
+	$(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \
+	$(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/m4/matlab.m4 \
+	$(top_srcdir)/m4/perl.m4 $(top_srcdir)/m4/python.m4 \
+	$(top_srcdir)/m4/win32.m4 $(top_srcdir)/m4/version.m4 \
+	$(top_srcdir)/configure.ac
 am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
 	$(ACLOCAL_M4)
 mkinstalldirs = $(install_sh) -d
-CONFIG_HEADER = $(top_builddir)/src/config.h \
+CONFIG_HEADER = $(top_builddir)/src/gd_config.h \
 	$(top_builddir)/src/getdata.h
 CONFIG_CLEAN_FILES =
 CONFIG_CLEAN_VPATH_FILES =
@@ -73,9 +92,15 @@ am__nobase_list = $(am__nobase_strip_setup); \
 am__base_list = \
   sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \
   sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
+am__uninstall_files_from_dir = { \
+  test -z "$$files" \
+    || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \
+    || { echo " ( cd '$$dir' && rm -f" $$files ")"; \
+         $(am__cd) "$$dir" && rm -f $$files; }; \
+  }
 am__installdirs = "$(DESTDIR)$(libdir)" "$(DESTDIR)$(includedir)"
 LTLIBRARIES = $(lib_LTLIBRARIES)
-libf95getdata_la_DEPENDENCIES = libfgetdata.la ../../src/libgetdata.la
+libf95getdata_la_DEPENDENCIES = libfgetdata.la
 nodist_libf95getdata_la_OBJECTS = getdata.lo
 libf95getdata_la_OBJECTS = $(nodist_libf95getdata_la_OBJECTS)
 libf95getdata_la_LINK = $(LIBTOOL) --tag=FC $(AM_LIBTOOLFLAGS) \
@@ -83,11 +108,7 @@ libf95getdata_la_LINK = $(LIBTOOL) --tag=FC $(AM_LIBTOOLFLAGS) \
 	$(libf95getdata_la_LDFLAGS) $(LDFLAGS) -o $@
 @MAKE_F95BINDINGS_TRUE at am_libf95getdata_la_rpath = -rpath $(libdir)
 libfgetdata_la_DEPENDENCIES = ../../src/libgetdata.la
-am__libfgetdata_la_SOURCES_DIST = fgetdata.c fgetdata.h \
-	../../src/debug.c
- at GETDATA_DEBUG_TRUE@am__objects_1 = libfgetdata_la-debug.lo
-am_libfgetdata_la_OBJECTS = libfgetdata_la-fgetdata.lo \
-	$(am__objects_1)
+am_libfgetdata_la_OBJECTS = libfgetdata_la-fgetdata.lo
 libfgetdata_la_OBJECTS = $(am_libfgetdata_la_OBJECTS)
 libfgetdata_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
 	$(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
@@ -113,7 +134,7 @@ FCLINK = $(LIBTOOL) --tag=FC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
 	--mode=link $(FCLD) $(AM_FCFLAGS) $(FCFLAGS) $(AM_LDFLAGS) \
 	$(LDFLAGS) -o $@
 SOURCES = $(nodist_libf95getdata_la_SOURCES) $(libfgetdata_la_SOURCES)
-DIST_SOURCES = $(am__libfgetdata_la_SOURCES_DIST)
+DIST_SOURCES = $(libfgetdata_la_SOURCES)
 RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \
 	html-recursive info-recursive install-data-recursive \
 	install-dvi-recursive install-exec-recursive \
@@ -121,6 +142,11 @@ RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \
 	install-pdf-recursive install-ps-recursive install-recursive \
 	installcheck-recursive installdirs-recursive pdf-recursive \
 	ps-recursive uninstall-recursive
+am__can_run_installinfo = \
+  case $$AM_UPDATE_INFO_DIR in \
+    n|no|NO) false;; \
+    *) (install-info --version) >/dev/null 2>&1;; \
+  esac
 HEADERS = $(nodist_include_HEADERS)
 RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive	\
   distclean-recursive maintainer-clean-recursive
@@ -164,10 +190,13 @@ AUTOHEADER = @AUTOHEADER@
 AUTOMAKE = @AUTOMAKE@
 AWK = @AWK@
 BUILDCC = @BUILDCC@
-BUILD_DATE = @BUILD_DATE@
 BZIP2_CPPFLAGS = @BZIP2_CPPFLAGS@
 BZIP2_LDFLAGS = @BZIP2_LDFLAGS@
+BZIP2_LIBS = @BZIP2_LIBS@
 CC = @CC@
+CCAS = @CCAS@
+CCASDEPMODE = @CCASDEPMODE@
+CCASFLAGS = @CCASFLAGS@
 CCDEPMODE = @CCDEPMODE@
 CFLAGS = @CFLAGS@
 CPP = @CPP@
@@ -183,6 +212,7 @@ DEFINE_GD_NO_C99_API = @DEFINE_GD_NO_C99_API@
 DEFINE_gd_int16_t = @DEFINE_gd_int16_t@
 DEFINE_gd_int64_t = @DEFINE_gd_int64_t@
 DEFINE_gd_uint16_t = @DEFINE_gd_uint16_t@
+DEFINE_gd_uint64_t = @DEFINE_gd_uint64_t@
 DEFS = @DEFS@
 DEPDIR = @DEPDIR@
 DIFF = @DIFF@
@@ -203,13 +233,21 @@ FFLAGS = @FFLAGS@
 FGETDATA_VERSION = @FGETDATA_VERSION@
 FGREP = @FGREP@
 FLIBS = @FLIBS@
+GD_DIRSEP = @GD_DIRSEP@
+GD_FDIRSEP = @GD_FDIRSEP@
 GETDATAXX_VERSION = @GETDATAXX_VERSION@
+GETDATA_DEBUG = @GETDATA_DEBUG@
 GETDATA_IFACE_AGE = @GETDATA_IFACE_AGE@
 GETDATA_IFACE_VERSION = @GETDATA_IFACE_VERSION@
 GETDATA_IMPL_REVISION = @GETDATA_IMPL_REVISION@
+GETDATA_MAJOR = @GETDATA_MAJOR@
+GETDATA_MINOR = @GETDATA_MINOR@
+GETDATA_REVISION = @GETDATA_REVISION@
+GETDATA_VERSION_SUFFIX = @GETDATA_VERSION_SUFFIX@
 GREP = @GREP@
 GZIP_CPPFLAGS = @GZIP_CPPFLAGS@
 GZIP_LDFLAGS = @GZIP_LDFLAGS@
+GZIP_LIBS = @GZIP_LIBS@
 IDL = @IDL@
 IDL_CFLAGS = @IDL_CFLAGS@
 IDL_LIBS = @IDL_LIBS@
@@ -223,7 +261,7 @@ LD = @LD@
 LDFLAGS = @LDFLAGS@
 LIBLTDL = @LIBLTDL@
 LIBOBJS = @LIBOBJS@
-LIBS = @LIBS@
+LIBS = 
 LIBTOOL = @LIBTOOL@
 LIBTOOL_DEPS = @LIBTOOL_DEPS@
 LIPO = @LIPO@
@@ -232,8 +270,13 @@ LTDLINCL = @LTDLINCL@
 LTLIBOBJS = @LTLIBOBJS@
 LZMA_CPPFLAGS = @LZMA_CPPFLAGS@
 LZMA_LDFLAGS = @LZMA_LDFLAGS@
+LZMA_LIBS = @LZMA_LIBS@
 MAKEINFO = @MAKEINFO@
 MANIFEST_TOOL = @MANIFEST_TOOL@
+MATLAB = @MATLAB@
+MATLABGETDATA_VERSION = @MATLABGETDATA_VERSION@
+MATLAB_CPPFLAGS = @MATLAB_CPPFLAGS@
+MEX = @MEX@
 MKDIR_P = @MKDIR_P@
 NM = @NM@
 NMEDIT = @NMEDIT@
@@ -250,6 +293,9 @@ PACKAGE_TARNAME = @PACKAGE_TARNAME@
 PACKAGE_URL = @PACKAGE_URL@
 PACKAGE_VERSION = @PACKAGE_VERSION@
 PATH_SEPARATOR = @PATH_SEPARATOR@
+PERL = @PERL@
+PERL_MAN3EXT = @PERL_MAN3EXT@
+PRINTF = @PRINTF@
 PRIVATE_LIBS = @PRIVATE_LIBS@
 PYTHON = @PYTHON@
 PYTHON_CPPFLAGS = @PYTHON_CPPFLAGS@
@@ -261,8 +307,12 @@ SET_MAKE = @SET_MAKE@
 SHELL = @SHELL@
 SLIM_CPPFLAGS = @SLIM_CPPFLAGS@
 SLIM_LDFLAGS = @SLIM_LDFLAGS@
+SLIM_LIBS = @SLIM_LIBS@
 STRIP = @STRIP@
 VERSION = @VERSION@
+ZZIP_CPPFLAGS = @ZZIP_CPPFLAGS@
+ZZIP_LDFLAGS = @ZZIP_LDFLAGS@
+ZZIP_LIBS = @ZZIP_LIBS@
 abs_builddir = @abs_builddir@
 abs_srcdir = @abs_srcdir@
 abs_top_builddir = @abs_top_builddir@
@@ -306,6 +356,8 @@ libexecdir = @libexecdir@
 localedir = @localedir@
 localstatedir = @localstatedir@
 mandir = @mandir@
+matlabbasedir = @matlabbasedir@
+mexext = @mexext@
 mkdir_p = @mkdir_p@
 moduledir = @moduledir@
 oldincludedir = @oldincludedir@
@@ -315,8 +367,12 @@ path_gunzip = @path_gunzip@
 path_gzip = @path_gzip@
 path_slim = @path_slim@
 path_unslim = @path_unslim@
+path_unzip = @path_unzip@
 path_xz = @path_xz@
+path_zip = @path_zip@
 pdfdir = @pdfdir@
+perldir = @perldir@
+perlmandir = @perlmandir@
 prefix = @prefix@
 program_transform_name = @program_transform_name@
 psdir = @psdir@
@@ -357,7 +413,6 @@ AUTOMAKE_OPTIONS = foreign
 @CC_WALL_TRUE at CC_WALL = -Wall
 @MAKE_F95BINDINGS_TRUE at F95_INC = getdata.mod
 @MAKE_F95BINDINGS_TRUE at F95_LIB = libf95getdata.la
- at GETDATA_DEBUG_TRUE@DEBUG_C = ../../src/debug.c
 INCLUDES = -I$(top_srcdir)/src
 EXTRA_DIST = getdata.f.in getdata.f90.in
 SUBDIRS = test
@@ -365,11 +420,11 @@ BUILT_SOURCES = getdata.f $(F95_INC)
 nodist_include_HEADERS = getdata.f $(F95_INC)
 lib_LTLIBRARIES = libfgetdata.la $(F95_LIB)
 libfgetdata_la_CPPFLAGS = ${CC_WALL} $(CC_WEXTRA)
-libfgetdata_la_SOURCES = fgetdata.c fgetdata.h $(DEBUG_C)
+libfgetdata_la_SOURCES = fgetdata.c fgetdata.h
 libfgetdata_la_LIBADD = ../../src/libgetdata.la
 libfgetdata_la_LDFLAGS = -version-info @FGETDATA_VERSION@
 nodist_libf95getdata_la_SOURCES = getdata.f90
-libf95getdata_la_LIBADD = libfgetdata.la ../../src/libgetdata.la
+libf95getdata_la_LIBADD = libfgetdata.la
 libf95getdata_la_LDFLAGS = -version-info @F95GETDATA_VERSION@
 all: $(BUILT_SOURCES)
 	$(MAKE) $(AM_MAKEFLAGS) all-recursive
@@ -408,7 +463,6 @@ $(ACLOCAL_M4):  $(am__aclocal_m4_deps)
 $(am__aclocal_m4_deps):
 install-libLTLIBRARIES: $(lib_LTLIBRARIES)
 	@$(NORMAL_INSTALL)
-	test -z "$(libdir)" || $(MKDIR_P) "$(DESTDIR)$(libdir)"
 	@list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \
 	list2=; for p in $$list; do \
 	  if test -f $$p; then \
@@ -416,6 +470,8 @@ install-libLTLIBRARIES: $(lib_LTLIBRARIES)
 	  else :; fi; \
 	done; \
 	test -z "$$list2" || { \
+	  echo " $(MKDIR_P) '$(DESTDIR)$(libdir)'"; \
+	  $(MKDIR_P) "$(DESTDIR)$(libdir)" || exit 1; \
 	  echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(libdir)'"; \
 	  $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(libdir)"; \
 	}
@@ -437,9 +493,9 @@ clean-libLTLIBRARIES:
 	  echo "rm -f \"$${dir}/so_locations\""; \
 	  rm -f "$${dir}/so_locations"; \
 	done
-libf95getdata.la: $(libf95getdata_la_OBJECTS) $(libf95getdata_la_DEPENDENCIES) 
+libf95getdata.la: $(libf95getdata_la_OBJECTS) $(libf95getdata_la_DEPENDENCIES) $(EXTRA_libf95getdata_la_DEPENDENCIES) 
 	$(libf95getdata_la_LINK) $(am_libf95getdata_la_rpath) $(libf95getdata_la_OBJECTS) $(libf95getdata_la_LIBADD) $(LIBS)
-libfgetdata.la: $(libfgetdata_la_OBJECTS) $(libfgetdata_la_DEPENDENCIES) 
+libfgetdata.la: $(libfgetdata_la_OBJECTS) $(libfgetdata_la_DEPENDENCIES) $(EXTRA_libfgetdata_la_DEPENDENCIES) 
 	$(libfgetdata_la_LINK) -rpath $(libdir) $(libfgetdata_la_OBJECTS) $(libfgetdata_la_LIBADD) $(LIBS)
 
 mostlyclean-compile:
@@ -448,7 +504,6 @@ mostlyclean-compile:
 distclean-compile:
 	-rm -f *.tab.c
 
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libfgetdata_la-debug.Plo at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libfgetdata_la-fgetdata.Plo at am__quote@
 
 .c.o:
@@ -479,13 +534,6 @@ libfgetdata_la-fgetdata.lo: fgetdata.c
 @AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCC_FALSE@	$(LIBTOOL)  --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libfgetdata_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libfgetdata_la-fgetdata.lo `test -f 'fgetdata.c' || echo '$(srcdir)/'`fgetdata.c
 
-libfgetdata_la-debug.lo: ../../src/debug.c
- at am__fastdepCC_TRUE@	$(LIBTOOL)  --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libfgetdata_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libfgetdata_la-debug.lo -MD -MP -MF $(DEPDIR)/libfgetdata_la-debug.Tpo -c -o libfgetdata_la-debug.lo `test -f '../../src/debug.c' || echo '$(srcdir)/'`../../src/debug.c
- at am__fastdepCC_TRUE@	$(am__mv) $(DEPDIR)/libfgetdata_la-debug.Tpo $(DEPDIR)/libfgetdata_la-debug.Plo
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	source='../../src/debug.c' object='libfgetdata_la-debug.lo' libtool=yes @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCC_FALSE@	$(LIBTOOL)  --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libfgetdata_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libfgetdata_la-debug.lo `test -f '../../src/debug.c' || echo '$(srcdir)/'`../../src/debug.c
-
 .f90.o:
 	$(FCCOMPILE) -c -o $@ $<
 
@@ -502,8 +550,11 @@ clean-libtool:
 	-rm -rf .libs _libs
 install-nodist_includeHEADERS: $(nodist_include_HEADERS)
 	@$(NORMAL_INSTALL)
-	test -z "$(includedir)" || $(MKDIR_P) "$(DESTDIR)$(includedir)"
 	@list='$(nodist_include_HEADERS)'; test -n "$(includedir)" || list=; \
+	if test -n "$$list"; then \
+	  echo " $(MKDIR_P) '$(DESTDIR)$(includedir)'"; \
+	  $(MKDIR_P) "$(DESTDIR)$(includedir)" || exit 1; \
+	fi; \
 	for p in $$list; do \
 	  if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
 	  echo "$$d$$p"; \
@@ -517,9 +568,7 @@ uninstall-nodist_includeHEADERS:
 	@$(NORMAL_UNINSTALL)
 	@list='$(nodist_include_HEADERS)'; test -n "$(includedir)" || list=; \
 	files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \
-	test -n "$$files" || exit 0; \
-	echo " ( cd '$(DESTDIR)$(includedir)' && rm -f" $$files ")"; \
-	cd "$(DESTDIR)$(includedir)" && rm -f $$files
+	dir='$(DESTDIR)$(includedir)'; $(am__uninstall_files_from_dir)
 
 # This directory's subdirectories are mostly independent; you can cd
 # into them and run `make' without going through this Makefile.
@@ -688,13 +737,10 @@ distdir: $(DISTFILES)
 	done
 	@list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
 	  if test "$$subdir" = .; then :; else \
-	    test -d "$(distdir)/$$subdir" \
-	    || $(MKDIR_P) "$(distdir)/$$subdir" \
-	    || exit 1; \
-	  fi; \
-	done
-	@list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
-	  if test "$$subdir" = .; then :; else \
+	    $(am__make_dryrun) \
+	      || test -d "$(distdir)/$$subdir" \
+	      || $(MKDIR_P) "$(distdir)/$$subdir" \
+	      || exit 1; \
 	    dir1=$$subdir; dir2="$(distdir)/$$subdir"; \
 	    $(am__relativize); \
 	    new_distdir=$$reldir; \
@@ -734,10 +780,15 @@ install-am: all-am
 
 installcheck: installcheck-recursive
 install-strip:
-	$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
-	  install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
-	  `test -z '$(STRIP)' || \
-	    echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+	if test -z '$(STRIP)'; then \
+	  $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+	    install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+	      install; \
+	else \
+	  $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+	    install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+	    "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
+	fi
 mostlyclean-generic:
 
 clean-generic:
@@ -858,8 +909,8 @@ make_parameters.sed.in: ../make_parameters ../../src/getdata.h
 
 make_parameters.sed: make_parameters.stamp
 	@if test ! -f $@; then \
-		rm -f $<; \
-		$(MAKE) $<; \
+		rm -f make_parameters.stamp; \
+		$(MAKE) make_parameters.stamp; \
 		fi
 
 @HAVE_DIFF_TRUE at make_parameters.stamp: make_parameters.sed.in
@@ -878,12 +929,12 @@ make_parameters.sed: make_parameters.stamp
 
 getdata.f: $(srcdir)/getdata.f.in make_parameters.sed
 	rm -f $@
-	$(SED) -f make_parameters.sed $< > $@
+	$(SED) -f make_parameters.sed $(srcdir)/getdata.f.in > $@
 	chmod a-w $@
 
 getdata.f90: $(srcdir)/getdata.f90.in make_parameters.sed
 	rm -f $@
-	$(SED) -f make_parameters.sed $< > $@
+	$(SED) -f make_parameters.sed $(srcdir)/getdata.f90.in > $@
 	chmod a-w $@
 
 # Tell versions [3.59,3.63) of GNU make to not export all variables.
diff --git a/bindings/f77/fgetdata.c b/bindings/f77/fgetdata.c
index e4c8f30..f3b8cf0 100644
--- a/bindings/f77/fgetdata.c
+++ b/bindings/f77/fgetdata.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2010 D. V. Wiebe
+/* Copyright (C) 2008-2012 D. V. Wiebe
  *
  *************************************************************************
  *
@@ -21,14 +21,6 @@
 
 #include "fgetdata.h"
 
-#ifdef GD_NO_C99_API
-# define crealp creal
-# define cimagp creal
-#else
-# define crealp(x) creal(*x)
-# define cimagp(x) cimag(*x)
-#endif
-
 #include <stdlib.h>
 #include <stdio.h>
 #include <string.h>
@@ -39,6 +31,12 @@
 static DIRFILE* f77dirfiles[GDF_N_DIRFILES];
 static int f77dirfiles_initialised = 0;
 
+/* casting data pointers to function pointers is prohibited in C.  This
+ * container is used to get around that */
+static struct _GDF_callback_container {
+  _GDF_callback_t func;
+} f77callbacks[GDF_N_DIRFILES];
+
 /* initialise the f77dirfiles array */
 static void _GDF_InitDirfiles(void)
 {
@@ -58,18 +56,25 @@ static void _GDF_InitDirfiles(void)
 }
 
 /* make a C string */
-static char* _GDF_CString(char* out, const char* in, int l)
+static char *_GDF_CString(char **out, const char *in, int l)
 {
   int i;
 
   dtrace("%p, %p, %i", out, in, l);
 
+  if (l < 0) {
+    *out = NULL;
+    dreturn("%p", NULL);
+    return *out;
+  }
+
+  *out = (char*)malloc(l + 1);
   for (i = 0; i < l; ++i)
-    out[i] = in[i];
-  out[l] = '\0';
+    (*out)[i] = in[i];
+  (*out)[l] = '\0';
 
-  dreturn("\"%s\"", out);
-  return out;
+  dreturn("\"%s\"", *out);
+  return *out;
 }
 
 /* convert an int to a DIRFILE* */
@@ -102,6 +107,7 @@ static int _GDF_SetDirfile(DIRFILE* D)
   for (i = 1; i < GDF_N_DIRFILES; ++i)
     if (f77dirfiles[i] == NULL) {
       f77dirfiles[i] = D;
+      f77callbacks[i].func = NULL;
       dreturn("%i", i);
       return i;
     }
@@ -122,21 +128,48 @@ static void _GDF_ClearDirfile(int d)
   dreturnvoid();
 }
 
+/* create a gd_triple_t value */
+static gd_triplet_t _GDF_SetTriplet(gd_windop_t op, const void *data)
+{
+  dtrace("%i, %p", op, data);
+
+  gd_triplet_t t;
+
+  switch(op) {
+    case GD_WINDOP_EQ:
+    case GD_WINDOP_NE:
+      t.i = *(int32_t*)data;
+      dreturn("%lli", (long long)t.i);
+      break;
+    case GD_WINDOP_SET:
+    case GD_WINDOP_CLR:
+      t.u = *(int32_t*)data;
+      dreturn("%llu", (unsigned long long)t.u);
+      break;
+    default:
+      t.r = *(double*)data;
+      dreturn("%g", t.r);
+      break;
+  }
+
+  return t;
+}
+
 /* create a Fortran space padded string */
-static int _GDF_FString(char* dest, int *dlen, const char* src)
+static int _GDF_FString(char *dest, int32_t *dlen, const char *src)
 {
   int i, slen;
 
   dtrace("%p, %i, \"%s\"", dest, *dlen, src);
 
-  slen = strlen(src);
-
   if (src == NULL) {
     *dlen = 0;
     dreturn("%i", -1);
     return -1;
   }
 
+  slen = strlen(src);
+
   if (slen <= *dlen) {
     for (i = 0; i < slen; ++i)
       dest[i] = src[i];
@@ -153,19 +186,21 @@ static int _GDF_FString(char* dest, int *dlen, const char* src)
 }
 
 /* callback wrapper */
-static int _GDF_Callback(gd_parser_data_t* pdata, void* f77_callback)
+static int _GDF_Callback(gd_parser_data_t* pdata, void *f77_callback)
 {
+  struct _GDF_callback_container *c =
+    (struct _GDF_callback_container*)f77_callback;
+
   int unit;
   int r = GD_SYNTAX_ABORT;
 
   dtrace("%p, %p", pdata, f77_callback);
 
-  if (f77_callback != NULL) {
+  if (c != NULL && c->func != NULL) {
     unit = _GDF_SetDirfile((DIRFILE*)pdata->dirfile);
 
-    (*(void(*)(int*, const int*, const int*, char*, const int*,
-               const char*))f77_callback)(&r, &unit, &pdata->suberror,
-             pdata->line, &pdata->linenum, pdata->filename);
+    (c->func)(&r, &unit, &pdata->suberror, pdata->line, &pdata->linenum,
+        pdata->filename);
 
     pdata->line[GD_MAX_LINE_LENGTH - 1] = '\0';
 
@@ -177,206 +212,252 @@ static int _GDF_Callback(gd_parser_data_t* pdata, void* f77_callback)
 }
 
 /* gd_open wrapper */
-void F77_FUNC(gdopen, GDOPEN) (int* dirfile, const char* dirfilename,
-    const int* dirfilename_l, const int* flags)
+void F77_FUNC(gdopen, GDOPEN) (int32_t *dirfile, const char *dirfilename,
+    const int32_t *dirfilename_l, const int32_t *flags)
 {
-  char* out = (char *)malloc(*dirfilename_l + 1);
+  char *out;
+
+  dtrace("%p, %p, %i, %i", dirfile, dirfilename, *dirfilename_l, *flags);
 
-  *dirfile = _GDF_SetDirfile(gd_open(_GDF_CString(out, dirfilename,
+  *dirfile = _GDF_SetDirfile(gd_open(_GDF_CString(&out, dirfilename,
           *dirfilename_l), *flags));
 
   free(out);
+
+  dreturn("%i", *dirfile);
 }
 
 /* gd_close wrapper */
-void F77_FUNC(gdclos, GDCLOS) (const int* dirfile)
+void F77_FUNC(gdclos, GDCLOS) (const int32_t *dirfile)
 {
+  dtrace("%i", *dirfile);
+
   if (*dirfile != 0) {
     gd_close(_GDF_GetDirfile(*dirfile));
 
     _GDF_ClearDirfile(*dirfile);
   }
+
+  dreturnvoid();
 }
 
 /* gd_flush wrapper */
-void F77_FUNC(gdflsh, GDFLSH) (const int* dirfile, const char* field_code,
-    const int* field_code_l)
+void F77_FUNC(gdflsh, GDFLSH) (const int32_t *dirfile, const char *field_code,
+    const int32_t *field_code_l)
 {
+  dtrace("%i, %p, %i", *dirfile, field_code, *field_code_l);
+
   if (field_code_l == 0)
     gd_flush(_GDF_GetDirfile(*dirfile), NULL);
   else {
-    char *out = (char *)malloc(*field_code_l + 1);
-    gd_flush(_GDF_GetDirfile(*dirfile), _GDF_CString(out, field_code,
+    char *out;
+    gd_flush(_GDF_GetDirfile(*dirfile), _GDF_CString(&out, field_code,
           *field_code_l));
     free(out);
   }
+
+  dreturnvoid();
 }
 
 /* gd_getdata wrapper */
-void F77_FUNC(gdgetd, GDGETD) (int* n_read, const int* dirfile,
-    const char* field_code, const int* field_code_l,
-    const int* first_frame, const int* first_sample,
-    const int* num_frames, const int* num_samples, const int* return_type,
-    void* data_out)
+void F77_FUNC(gdgetd, GDGETD) (int32_t *n_read, const int32_t *dirfile,
+    const char *field_code, const int32_t *field_code_l,
+    const int32_t *first_frame, const int32_t *first_sample,
+    const int32_t *num_frames, const int32_t *num_samples,
+    const int32_t *return_type, void *data_out)
 {
-  char* out = (char *)malloc(*field_code_l + 1);
+  char *out;
 
-  *n_read = gd_getdata(_GDF_GetDirfile(*dirfile), _GDF_CString(out, field_code,
+  dtrace("%p, %i, %p, %i, %i, %i, %i, %i, 0x%x, %p", n_read, *dirfile,
+      field_code, *field_code_l, *first_frame, *first_sample, *num_frames,
+      *num_samples, *return_type, data_out);
+
+  *n_read = gd_getdata(_GDF_GetDirfile(*dirfile), _GDF_CString(&out, field_code,
         *field_code_l), *first_frame, *first_sample, *num_frames,
       *num_samples, (gd_type_t)*return_type, data_out);
   free(out);
+
+  dreturn("%i", *n_read);
 }
 
 /* Return the maximum field name length */
-void F77_FUNC(gdfdnx, GDFDNX) (int* max, const int* dirfile)
+void F77_FUNC(gdfdnx, GDFDNX) (int32_t *max, const int32_t *dirfile)
 {
   const char **fl;
   size_t len = 0;
-  DIRFILE* D = _GDF_GetDirfile(*dirfile);
-  unsigned int i, nfields = gd_nfields(D);
+  DIRFILE* D;
+  unsigned int i, nfields;
 
-  if (D->error)
-    return;
+  dtrace("%p, %i", max, *dirfile);
+
+  D = _GDF_GetDirfile(*dirfile);
+  nfields = gd_nfields(D);
 
-  fl = gd_field_list(D);
+  if (!gd_error(D)) {
+    fl = gd_field_list(D);
 
-  for (i = 0; i < nfields; ++i)
-    if (strlen(fl[i]) > len)
-      len = strlen(fl[i]);
+    for (i = 0; i < nfields; ++i)
+      if (strlen(fl[i]) > len)
+        len = strlen(fl[i]);
+  }
 
   *max = len;
+  dreturn("%i", *max);
 }
 
 /* Return the maximum field name length for a meta list */
-void F77_FUNC(gdmfnx, GDMFNX) (int* max, const int* dirfile, const char* parent,
-    const int* parent_l)
+void F77_FUNC(gdmfnx, GDMFNX) (int32_t *max, const int32_t *dirfile,
+    const char *parent, const int32_t *parent_l)
 {
   const char **fl;
   unsigned int i, nfields;
   size_t len = 0;
   DIRFILE* D = _GDF_GetDirfile(*dirfile);
-  char* pa = (char *)malloc(*parent_l + 1);
+  char *pa;
 
-  _GDF_CString(pa, parent, *parent_l);
+  dtrace("%p, %i, %p, %i", max, *dirfile, parent, *parent_l);
 
+  _GDF_CString(&pa, parent, *parent_l);
   nfields = gd_nmfields(D, pa);
 
-  if (D->error) {
-    free(pa);
-    return;
-  }
-
-  fl = gd_mfield_list(D, pa);
+  if (!gd_error(D)) {
+    fl = gd_mfield_list(D, pa);
 
-  for (i = 0; i < nfields; ++i)
-    if (strlen(fl[i]) > len)
-      len = strlen(fl[i]);
+    for (i = 0; i < nfields; ++i)
+      if (strlen(fl[i]) > len)
+        len = strlen(fl[i]);
+  }
 
   *max = len;
 
   free(pa);
+  dreturn("%i", *max);
 }
 
 /* gd_field_list wrapper -- this only returns one field name */
-void F77_FUNC(gdfldn, GDFLDN) (char* name, int* name_l, const int* dirfile,
-    const int* field_num)
+void F77_FUNC(gdfldn, GDFLDN) (char *name, int32_t *name_l,
+    const int32_t *dirfile, const int32_t *field_num)
 {
   const char** fl;
-  DIRFILE* D = _GDF_GetDirfile(*dirfile);
-  unsigned int nfields = gd_nfields(D);
-  if (D->error)
-    return;
+  DIRFILE* D;
+  unsigned int nfields;
+
+  dtrace("%p, %p, %i, %i", name, name_l, *dirfile, *field_num);
+  
+  D = _GDF_GetDirfile(*dirfile);
+  nfields = gd_nfields(D);
 
-  if (*field_num > 0 && *field_num <= (int)nfields) {
+  if (!gd_error(D) && *field_num > 0 && *field_num <= (int)nfields) {
     fl = gd_field_list(D);
     _GDF_FString(name, name_l, fl[*field_num - 1]);
   } else
     *name_l = 0;
+
+  dreturn("%i", *name_l);
 }
 
 /* gd_mfield_list wrapper -- this only returns one field name */
-void F77_FUNC(gdmfdn, GDMFDN) (char* name, int* name_l, const int* dirfile,
-    const char* parent, const int* parent_l, const int* field_num)
+void F77_FUNC(gdmfdn, GDMFDN) (char *name, int32_t *name_l,
+    const int32_t *dirfile, const char *parent, const int32_t *parent_l,
+    const int32_t *field_num)
 {
   const char** fl;
   unsigned int nfields;
   DIRFILE* D = _GDF_GetDirfile(*dirfile);
-  char* pa = (char *)malloc(*parent_l + 1);
+  char *pa;
 
-  _GDF_CString(pa, parent, *parent_l);
+  dtrace("%p, %p, %i, %p, %i, %i", name, name_l, *dirfile, parent, *parent_l,
+      *field_num);
 
+  _GDF_CString(&pa, parent, *parent_l);
   nfields = gd_nmfields(D, pa);
-  if (D->error) {
-    free(pa);
-    return;
-  }
 
-  if (*field_num > 0 && *field_num <= (int)nfields) {
+  if (!gd_error(D) && *field_num > 0 && *field_num <= (int)nfields) {
     fl = gd_mfield_list(D, pa);
     _GDF_FString(name, name_l, fl[*field_num - 1]);
   } else
     *name_l = 0;
 
   free(pa);
+
+  dreturn("%i", *name_l);
 }
 
 /* gd_nfields wrapper */
-void F77_FUNC(gdnfld, GDNFLD) (int* nfields, const int* dirfile)
+void F77_FUNC(gdnfld, GDNFLD) (int32_t *nfields, const int32_t *dirfile)
 {
   *nfields = gd_nfields(_GDF_GetDirfile(*dirfile));
 }
 
 /* gd_bof wrapper */
-void F77_FUNC(gdgbof, GDGBOF) (int* bof, const int* dirfile,
-    const char* field_code, const int* field_code_l)
+void F77_FUNC(gdgbof, GDGBOF) (int32_t *bof, const int32_t *dirfile,
+    const char *field_code, const int32_t *field_code_l)
 {
-  char *fc = (char *)malloc(*field_code_l + 1);
-  *bof = gd_bof(_GDF_GetDirfile(*dirfile), _GDF_CString(fc, field_code,
+  char *fc;
+  dtrace("%p, %i, %p, %i", bof, *dirfile, field_code, *field_code_l);
+
+  *bof = gd_bof(_GDF_GetDirfile(*dirfile), _GDF_CString(&fc, field_code,
         *field_code_l));
+
   free(fc);
+  dreturn("%i", *bof);
 }
 
 /* gd_eof wrapper */
-void F77_FUNC(gdgeof, GDGEOF) (int* eof, const int* dirfile,
-    const char* field_code, const int* field_code_l)
+void F77_FUNC(gdgeof, GDGEOF) (int32_t *eof, const int32_t *dirfile,
+    const char *field_code, const int32_t *field_code_l)
 {
-  char *fc = (char *)malloc(*field_code_l + 1);
-  *eof = gd_eof(_GDF_GetDirfile(*dirfile), _GDF_CString(fc, field_code,
+  char *fc;
+  dtrace("%p, %i, %p, %i", eof, *dirfile, field_code, *field_code_l);
+
+  *eof = gd_eof(_GDF_GetDirfile(*dirfile), _GDF_CString(&fc, field_code,
         *field_code_l));
   free(fc);
+
+  dreturn("%i", *eof);
 }
 
 /* gd_nframes wrapper */
-void F77_FUNC(gdnfrm, GDNFRM) (int* nframes, const int* dirfile)
+void F77_FUNC(gdnfrm, GDNFRM) (int32_t *nframes, const int32_t *dirfile)
 {
   *nframes = gd_nframes(_GDF_GetDirfile(*dirfile));
 }
 
 /* gd_spf wrapper */
-void F77_FUNC(gdgspf, GDGSPF) (int* spf, const int* dirfile,
-    const char* field_code, const int* field_code_l)
+void F77_FUNC(gdgspf, GDGSPF) (int32_t *spf, const int32_t *dirfile,
+    const char *field_code, const int32_t *field_code_l)
 {
-  char* out = (char *)malloc(*field_code_l + 1);
+  char *out;
+  dtrace("%p, %i, %p, %i", spf, *dirfile, field_code, *field_code_l);
+
   *spf = gd_spf(_GDF_GetDirfile(*dirfile),
-      _GDF_CString(out, field_code, *field_code_l));
+      _GDF_CString(&out, field_code, *field_code_l));
   free(out);
+  dreturn("%i", *spf);
 }
 
 /* gd_putdata wrapper */
-void F77_FUNC(gdputd, GDPUTD) (int* n_wrote, const int* dirfile,
-    const char* field_code, const int* field_code_l, const int* first_frame,
-    const int* first_sample, const int* num_frames, const int* num_samples,
-    const int* data_type, const void* data_in)
+void F77_FUNC(gdputd, GDPUTD) (int32_t *n_wrote, const int32_t *dirfile,
+    const char *field_code, const int32_t *field_code_l,
+    const int32_t *first_frame, const int32_t *first_sample,
+    const int32_t *num_frames, const int32_t *num_samples,
+    const int32_t *data_type, const void *data_in)
 {
-  char* out = (char *)malloc(*field_code_l + 1);
-  *n_wrote = gd_putdata(_GDF_GetDirfile(*dirfile), _GDF_CString(out, field_code,
-        *field_code_l), *first_frame, *first_sample, *num_frames,
+  char *out;
+  dtrace("%p, %i, %p, %i, %i, %i, %i, %i, 0x%x, %p", n_wrote, *dirfile,
+      field_code, *field_code_l, *first_frame, *first_sample, *num_frames,
+      *num_samples, *data_type, data_in);
+
+  *n_wrote = gd_putdata(_GDF_GetDirfile(*dirfile), _GDF_CString(&out,
+        field_code, *field_code_l), *first_frame, *first_sample, *num_frames,
       *num_samples, (gd_type_t)*data_type, data_in);
   free(out);
+
+  dreturn("%i", *n_wrote);
 }
 
 /* return the error number */
-void F77_FUNC(gderor, GDEROR) (int* error, const int* dirfile)
+void F77_FUNC(gderor, GDEROR) (int32_t *error, const int32_t *dirfile)
 {
   dtrace("%p, %i", error, *dirfile);
 
@@ -385,8 +466,19 @@ void F77_FUNC(gderor, GDEROR) (int* error, const int* dirfile)
   dreturn("%i", *error);
 }
 
+/* gd_error_count wrapper */
+void F77_FUNC(gdecnt, GDECNT) (int32_t *error_count, const int32_t *dirfile)
+{
+  dtrace("%p, %i", error_count, *dirfile);
+
+  *error_count = gd_error_count(_GDF_GetDirfile(*dirfile));
+
+  dreturn("%i", *error_count);
+}
+
 /* gd_error_string wrapper */
-void F77_FUNC(gdestr, GDESTR) (const int* dirfile, char* buffer, const int* len)
+void F77_FUNC(gdestr, GDESTR) (const int32_t *dirfile, char *buffer,
+    const int32_t *len)
 {
   int i;
   gd_error_string(_GDF_GetDirfile(*dirfile), buffer, *len);
@@ -400,16 +492,14 @@ void F77_FUNC(gdestr, GDESTR) (const int* dirfile, char* buffer, const int* len)
 }
 
 /* gd_entry_type wrapper */
-void F77_FUNC(gdenty, GDENTY) (int* type, const int* dirfile,
-    const char* field_code, const int* field_code_l)
+void F77_FUNC(gdenty, GDENTY) (int32_t *type, const int32_t *dirfile,
+    const char *field_code, const int32_t *field_code_l)
 {
   char *fc;
 
   dtrace("%p, %i, %p, %i", type, *dirfile, field_code, *field_code_l);
 
-  fc = (char *)malloc(*field_code_l + 1);
-
-  *type = (int)gd_entry_type(_GDF_GetDirfile(*dirfile), _GDF_CString(fc,
+  *type = (int)gd_entry_type(_GDF_GetDirfile(*dirfile), _GDF_CString(&fc,
         field_code, *field_code_l));
 
   free(fc);
@@ -418,8 +508,9 @@ void F77_FUNC(gdenty, GDENTY) (int* type, const int* dirfile,
 }
 
 /* gd_entry wrapper for RAW */
-void F77_FUNC(gdgerw, GDGERW) (int* spf, int* dtype, int* fragment_index,
-    const int* dirfile, const char* field_code, const int* field_code_l)
+void F77_FUNC(gdgerw, GDGERW) (int32_t *spf, int32_t *dtype,
+    int32_t *fragment_index, const int32_t *dirfile, const char *field_code,
+    const int32_t *field_code_l)
 {
   char *out;
   gd_entry_t E;
@@ -427,9 +518,7 @@ void F77_FUNC(gdgerw, GDGERW) (int* spf, int* dtype, int* fragment_index,
   dtrace("%p, %p, %p, %i, %p, %i", spf, dtype, fragment_index, *dirfile,
       field_code, *field_code_l);
 
-  out = (char *)malloc(*field_code_l + 1);
-
-  if (gd_entry(_GDF_GetDirfile(*dirfile), _GDF_CString(out, field_code,
+  if (gd_entry(_GDF_GetDirfile(*dirfile), _GDF_CString(&out, field_code,
           *field_code_l), &E) || E.field_type != GD_RAW_ENTRY)
     *spf = 0;
   else {
@@ -445,12 +534,12 @@ void F77_FUNC(gdgerw, GDGERW) (int* spf, int* dtype, int* fragment_index,
 }
 
 /* gd_entry wrapper for LINCOM */
-void F77_FUNC(gdgelc, GDGELC) (int* nfields,
-    char* infield1, int* infield1_l, double* m1, double* b1,
-    char* infield2, int* infield2_l, double* m2, double* b2,
-    char* infield3, int* infield3_l, double* m3, double* b3,
-    int* fragment_index, const int* dirfile, const char* field_code,
-    const int* field_code_l)
+void F77_FUNC(gdgelc, GDGELC) (int32_t *nfields,
+    char *infield1, int32_t *infield1_l, double *m1, double *b1,
+    char *infield2, int32_t *infield2_l, double *m2, double *b2,
+    char *infield3, int32_t *infield3_l, double *m3, double *b3,
+    int32_t *fragment_index, const int32_t *dirfile, const char *field_code,
+    const int32_t *field_code_l)
 {
   char *out;
   gd_entry_t E;
@@ -460,9 +549,7 @@ void F77_FUNC(gdgelc, GDGELC) (int* nfields,
       infield3, infield3_l, m3, b3, fragment_index, *dirfile, field_code,
       *field_code_l);
 
-  out = (char *)malloc(*field_code_l + 1);
-
-  if (gd_entry(_GDF_GetDirfile(*dirfile), _GDF_CString(out, field_code,
+  if (gd_entry(_GDF_GetDirfile(*dirfile), _GDF_CString(&out, field_code,
           *field_code_l), &E) || E.field_type != GD_LINCOM_ENTRY)
     *nfields = 0;
   else {
@@ -492,12 +579,12 @@ void F77_FUNC(gdgelc, GDGELC) (int* nfields,
   dreturnvoid();
 }
 
-void F77_FUNC(gdgecl, GDGECL) (int* nfields,
-    char* infield1, int* infield1_l, GD_DCOMPLEXP(m1), GD_DCOMPLEXP(b1),
-    char* infield2, int* infield2_l, GD_DCOMPLEXP(m2), GD_DCOMPLEXP(b2),
-    char* infield3, int* infield3_l, GD_DCOMPLEXP(m3), GD_DCOMPLEXP(b3),
-    int* fragment_index, const int* dirfile, const char* field_code,
-    const int* field_code_l)
+void F77_FUNC(gdgecl, GDGECL) (int32_t *nfields,
+    char *infield1, int32_t *infield1_l, GD_DCOMPLEXP(m1), GD_DCOMPLEXP(b1),
+    char *infield2, int32_t *infield2_l, GD_DCOMPLEXP(m2), GD_DCOMPLEXP(b2),
+    char *infield3, int32_t *infield3_l, GD_DCOMPLEXP(m3), GD_DCOMPLEXP(b3),
+    int32_t *fragment_index, const int32_t *dirfile, const char *field_code,
+    const int32_t *field_code_l)
 {
   char *fc;
   gd_entry_t E;
@@ -507,9 +594,7 @@ void F77_FUNC(gdgecl, GDGECL) (int* nfields,
       infield3, infield3_l, m3, b3, fragment_index, *dirfile, field_code,
       *field_code_l);
 
-  fc = (char *)malloc(*field_code_l + 1);
-
-  if (gd_entry(_GDF_GetDirfile(*dirfile), _GDF_CString(fc, field_code,
+  if (gd_entry(_GDF_GetDirfile(*dirfile), _GDF_CString(&fc, field_code,
           *field_code_l), &E))
     *nfields = 0;
   else if (E.field_type != GD_LINCOM_ENTRY) {
@@ -520,19 +605,19 @@ void F77_FUNC(gdgecl, GDGECL) (int* nfields,
     *fragment_index = E.fragment_index;
 
     _GDF_FString(infield1, infield1_l, E.in_fields[0]);
-    _gd_c2cp(m1, E.EN(lincom,cm)[0]);
-    _gd_c2cp(b1, E.EN(lincom,cb)[0]);
+    gd_cs2cp_(m1, E.EN(lincom,cm)[0]);
+    gd_cs2cp_(b1, E.EN(lincom,cb)[0]);
 
     if (E.EN(lincom,n_fields) > 1) {
       _GDF_FString(infield2, infield2_l, E.in_fields[1]);
-      _gd_c2cp(m2, E.EN(lincom,cm)[1]);
-      _gd_c2cp(b2, E.EN(lincom,cb)[1]);
+      gd_cs2cp_(m2, E.EN(lincom,cm)[1]);
+      gd_cs2cp_(b2, E.EN(lincom,cb)[1]);
     }
 
     if (E.EN(lincom,n_fields) > 2) {
       _GDF_FString(infield3, infield3_l, E.in_fields[2]);
-      _gd_c2cp(m3, E.EN(lincom,cm)[2]);
-      _gd_c2cp(b3, E.EN(lincom,cb)[2]);
+      gd_cs2cp_(m3, E.EN(lincom,cm)[2]);
+      gd_cs2cp_(b3, E.EN(lincom,cb)[2]);
     }
     gd_free_entry_strings(&E);
   }
@@ -543,10 +628,10 @@ void F77_FUNC(gdgecl, GDGECL) (int* nfields,
 }
 
 /* gd_entry wrapper for POLYNOM */
-void F77_FUNC(gdgepn, GDGEPN) (int* poly_ord, char* infield, int* infield_l,
-    double* a0, double* a1, double* a2, double* a3, double* a4, double* a5,
-    int* fragment_index, const int* dirfile, const char* field_code,
-    const int* field_code_l)
+void F77_FUNC(gdgepn, GDGEPN) (int32_t *poly_ord, char *infield,
+    int32_t *infield_l, double *a0, double *a1, double *a2, double *a3,
+    double *a4, double *a5, int32_t *fragment_index, const int32_t *dirfile,
+    const char *field_code, const int32_t *field_code_l)
 {
   char *out;
   gd_entry_t E;
@@ -555,9 +640,7 @@ void F77_FUNC(gdgepn, GDGEPN) (int* poly_ord, char* infield, int* infield_l,
       infield, *infield_l, a0, a1, a2, a3, a4, a5, fragment_index, *dirfile,
       field_code, *field_code_l);
 
-  out = (char *)malloc(*field_code_l + 1);
-
-  if (gd_entry(_GDF_GetDirfile(*dirfile), _GDF_CString(out, field_code,
+  if (gd_entry(_GDF_GetDirfile(*dirfile), _GDF_CString(&out, field_code,
           *field_code_l), &E) || E.field_type != GD_POLYNOM_ENTRY)
     *poly_ord = 0;
   else {
@@ -586,11 +669,11 @@ void F77_FUNC(gdgepn, GDGEPN) (int* poly_ord, char* infield, int* infield_l,
   dreturnvoid();
 }
 
-void F77_FUNC(gdgecp, GDGECP) (int* poly_ord, char* infield, int* infield_l,
-    GD_DCOMPLEXP(a0), GD_DCOMPLEXP(a1), GD_DCOMPLEXP(a2),
+void F77_FUNC(gdgecp, GDGECP) (int32_t *poly_ord, char *infield,
+    int32_t *infield_l, GD_DCOMPLEXP(a0), GD_DCOMPLEXP(a1), GD_DCOMPLEXP(a2),
     GD_DCOMPLEXP(a3), GD_DCOMPLEXP(a4), GD_DCOMPLEXP(a5),
-    int* fragment_index, const int* dirfile, const char* field_code,
-    const int* field_code_l)
+    int32_t *fragment_index, const int32_t *dirfile, const char *field_code,
+    const int32_t *field_code_l)
 {
   char *out;
   gd_entry_t E;
@@ -599,9 +682,7 @@ void F77_FUNC(gdgecp, GDGECP) (int* poly_ord, char* infield, int* infield_l,
       infield, *infield_l, a0, a1, a2, a3, a4, a5, fragment_index, *dirfile,
       field_code, *field_code_l);
 
-  out = (char *)malloc(*field_code_l + 1);
-
-  if (gd_entry(_GDF_GetDirfile(*dirfile), _GDF_CString(out, field_code,
+  if (gd_entry(_GDF_GetDirfile(*dirfile), _GDF_CString(&out, field_code,
           *field_code_l), &E) || E.field_type != GD_POLYNOM_ENTRY)
     *poly_ord = 0;
   else {
@@ -612,16 +693,16 @@ void F77_FUNC(gdgecp, GDGECP) (int* poly_ord, char* infield, int* infield_l,
 
     switch (E.EN(polynom,poly_ord)) {
       case 5:
-        _gd_c2cp(a5, E.EN(polynom,ca)[5]);
+        gd_cs2cp_(a5, E.EN(polynom,ca)[5]);
       case 4:
-        _gd_c2cp(a4, E.EN(polynom,ca)[4]);
+        gd_cs2cp_(a4, E.EN(polynom,ca)[4]);
       case 3:
-        _gd_c2cp(a3, E.EN(polynom,ca)[3]);
+        gd_cs2cp_(a3, E.EN(polynom,ca)[3]);
       case 2:
-        _gd_c2cp(a2, E.EN(polynom,ca)[2]);
+        gd_cs2cp_(a2, E.EN(polynom,ca)[2]);
       case 1:
-        _gd_c2cp(a1, E.EN(polynom,ca)[1]);
-        _gd_c2cp(a0, E.EN(polynom,ca)[0]);
+        gd_cs2cp_(a1, E.EN(polynom,ca)[1]);
+        gd_cs2cp_(a0, E.EN(polynom,ca)[0]);
     }
     gd_free_entry_strings(&E);
   }
@@ -632,9 +713,9 @@ void F77_FUNC(gdgecp, GDGECP) (int* poly_ord, char* infield, int* infield_l,
 }
 
 /* gd_entry wrapper for LINTERP */
-void F77_FUNC(gdgelt, GDGELT) (char* in_field, int* in_field_l, char* table,
-    int* table_l, int* fragment_index, const int* dirfile,
-    const char* field_code, const int* field_code_l)
+void F77_FUNC(gdgelt, GDGELT) (char *in_field, int32_t *in_field_l, char *table,
+    int32_t *table_l, int32_t *fragment_index, const int32_t *dirfile,
+    const char *field_code, const int32_t *field_code_l)
 {
   char *out;
   gd_entry_t E;
@@ -642,9 +723,7 @@ void F77_FUNC(gdgelt, GDGELT) (char* in_field, int* in_field_l, char* table,
   dtrace("%p, %i, %p, %i, %p, %i, %p, %i", in_field, *in_field_l, table,
       *table_l, fragment_index, *dirfile, field_code, *field_code_l);
 
-  out = (char *)malloc(*field_code_l + 1);
-
-  if (gd_entry(_GDF_GetDirfile(*dirfile), _GDF_CString(out, field_code,
+  if (gd_entry(_GDF_GetDirfile(*dirfile), _GDF_CString(&out, field_code,
           *field_code_l), &E) || E.field_type != GD_LINTERP_ENTRY)
     *in_field_l = 0;
   else {
@@ -659,9 +738,9 @@ void F77_FUNC(gdgelt, GDGELT) (char* in_field, int* in_field_l, char* table,
 }
 
 /* gd_entry wrapper for BIT */
-void F77_FUNC(gdgebt, GDGEBT) (char* in_field, int* in_field_l, int* bitnum,
-    int* numbits, int* fragment_index, const int* dirfile,
-    const char* field_code, const int* field_code_l)
+void F77_FUNC(gdgebt, GDGEBT) (char *in_field, int32_t *in_field_l,
+    int32_t *bitnum, int32_t *numbits, int32_t *fragment_index,
+    const int32_t *dirfile, const char *field_code, const int32_t *field_code_l)
 {
   char *out;
   gd_entry_t E;
@@ -669,9 +748,7 @@ void F77_FUNC(gdgebt, GDGEBT) (char* in_field, int* in_field_l, int* bitnum,
   dtrace("%p, %i, %p, %p, %p, %i, %p, %i", in_field, *in_field_l, bitnum,
       numbits, fragment_index, *dirfile, field_code, *field_code_l);
 
-  out = (char *)malloc(*field_code_l + 1);
-
-  if (gd_entry(_GDF_GetDirfile(*dirfile), _GDF_CString(out, field_code,
+  if (gd_entry(_GDF_GetDirfile(*dirfile), _GDF_CString(&out, field_code,
           *field_code_l), &E) || E.field_type != GD_BIT_ENTRY)
     *in_field_l = 0;
   else {
@@ -687,9 +764,9 @@ void F77_FUNC(gdgebt, GDGEBT) (char* in_field, int* in_field_l, int* bitnum,
 }
 
 /* gd_entry wrapper for SBIT */
-void F77_FUNC(gdgesb, GDGESB) (char* in_field, int* in_field_l, int* bitnum,
-    int* numbits, int* fragment_index, const int* dirfile,
-    const char* field_code, const int* field_code_l)
+void F77_FUNC(gdgesb, GDGESB) (char *in_field, int32_t *in_field_l,
+    int32_t *bitnum, int32_t *numbits, int32_t *fragment_index,
+    const int32_t *dirfile, const char *field_code, const int32_t *field_code_l)
 {
   char *out;
   gd_entry_t E;
@@ -697,9 +774,7 @@ void F77_FUNC(gdgesb, GDGESB) (char* in_field, int* in_field_l, int* bitnum,
   dtrace("%p, %i, %p, %p, %p, %i, %p, %i", in_field, *in_field_l, bitnum,
       numbits, fragment_index, *dirfile, field_code, *field_code_l);
 
-  out = (char *)malloc(*field_code_l + 1);
-
-  if (gd_entry(_GDF_GetDirfile(*dirfile), _GDF_CString(out, field_code,
+  if (gd_entry(_GDF_GetDirfile(*dirfile), _GDF_CString(&out, field_code,
           *field_code_l), &E) || E.field_type != GD_SBIT_ENTRY)
     *in_field_l = 0;
   else {
@@ -715,9 +790,9 @@ void F77_FUNC(gdgesb, GDGESB) (char* in_field, int* in_field_l, int* bitnum,
 }
 
 /* gd_entry wrapper for MULTIPLY */
-void F77_FUNC(gdgemt, GDGEMT) (char* in_field1, int* in_field1_l,
-    char* in_field2, int* in_field2_l, int* fragment_index, const int* dirfile,
-    const char* field_code, const int* field_code_l)
+void F77_FUNC(gdgemt, GDGEMT) (char *in_field1, int32_t *in_field1_l,
+    char *in_field2, int32_t *in_field2_l, int32_t *fragment_index,
+    const int32_t *dirfile, const char *field_code, const int32_t *field_code_l)
 {
   char *out;
   gd_entry_t E;
@@ -726,9 +801,7 @@ void F77_FUNC(gdgemt, GDGEMT) (char* in_field1, int* in_field1_l,
       in_field2, *in_field2_l, fragment_index, *dirfile, field_code,
       *field_code_l);
 
-  out = (char *)malloc(*field_code_l + 1);
-
-  if (gd_entry(_GDF_GetDirfile(*dirfile), _GDF_CString(out, field_code,
+  if (gd_entry(_GDF_GetDirfile(*dirfile), _GDF_CString(&out, field_code,
           *field_code_l), &E) || E.field_type != GD_MULTIPLY_ENTRY)
     *in_field1_l = 0;
   else {
@@ -743,9 +816,9 @@ void F77_FUNC(gdgemt, GDGEMT) (char* in_field1, int* in_field1_l,
 }
 
 /* gd_entry wrapper for DIVIDE */
-void F77_FUNC(gdgedv, GDGEDV) (char* in_field1, int* in_field1_l,
-    char* in_field2, int* in_field2_l, int* fragment_index, const int* dirfile,
-    const char* field_code, const int* field_code_l)
+void F77_FUNC(gdgedv, GDGEDV) (char *in_field1, int32_t *in_field1_l,
+    char *in_field2, int32_t *in_field2_l, int32_t *fragment_index,
+    const int32_t *dirfile, const char *field_code, const int32_t *field_code_l)
 {
   char *out;
   gd_entry_t E;
@@ -754,9 +827,7 @@ void F77_FUNC(gdgedv, GDGEDV) (char* in_field1, int* in_field1_l,
       in_field2, *in_field2_l, fragment_index, *dirfile, field_code,
       *field_code_l);
 
-  out = (char *)malloc(*field_code_l + 1);
-
-  if (gd_entry(_GDF_GetDirfile(*dirfile), _GDF_CString(out, field_code,
+  if (gd_entry(_GDF_GetDirfile(*dirfile), _GDF_CString(&out, field_code,
           *field_code_l), &E) || E.field_type != GD_DIVIDE_ENTRY)
     *in_field1_l = 0;
   else {
@@ -771,10 +842,82 @@ void F77_FUNC(gdgedv, GDGEDV) (char* in_field1, int* in_field1_l,
   dreturnvoid();
 }
 
+/* gd_entry wrapper for WINDOW */
+void F77_FUNC(gdgewd, GDGEWD) (char *in_field, int32_t *in_field_l,
+    char *check_field, int32_t *check_field_l, int32_t *windop,
+    int32_t *ithreshold, double *rthreshold, int32_t *fragment_index,
+    const int32_t *dirfile, const char *field_code, const int32_t *field_code_l)
+{
+  char *fc;
+  gd_entry_t E;
+
+  dtrace("%p, %i, %p, %i, %p, %p, %p, %p, %i, %p, %i", in_field, *in_field_l,
+      check_field, *check_field_l, windop, ithreshold, rthreshold,
+      fragment_index, *dirfile, field_code, *field_code_l);
+
+  if (gd_entry(_GDF_GetDirfile(*dirfile), _GDF_CString(&fc, field_code,
+          *field_code_l), &E) || E.field_type != GD_WINDOW_ENTRY)
+    *in_field_l = 0;
+  else {
+    _GDF_FString(in_field, in_field_l, E.in_fields[0]);
+    _GDF_FString(check_field, check_field_l, E.in_fields[1]);
+    *windop = E.EN(window,windop);
+    switch (E.EN(window,windop)) {
+      case GD_WINDOP_EQ:
+      case GD_WINDOP_NE:
+        *ithreshold = E.EN(window,threshold.i);
+        break;
+      case GD_WINDOP_SET:
+      case GD_WINDOP_CLR:
+        *ithreshold = E.EN(window,threshold.u);
+        break;
+      default:
+        *rthreshold = E.EN(window,threshold.r);
+        break;
+    }
+    *fragment_index = E.fragment_index;
+    gd_free_entry_strings(&E);
+  }
+
+  free(fc);
+
+  dreturnvoid();
+}
+
+/* gd_entry wrapper for MPLEX */
+void F77_FUNC(gdgemx, GDGEMX) (char *in_field, int32_t *in_field_l,
+    char *count_field, int32_t *count_field_l, int32_t *val, int32_t *period,
+    int32_t *fragment_index, const int32_t *dirfile, const char *field_code,
+    const int32_t *field_code_l)
+{
+  char *fc;
+  gd_entry_t E;
+
+  dtrace("%p, %i, %p, %i, %p, %p, %p, %i, %p, %i", in_field, *in_field_l,
+      count_field, *count_field_l, val, period, fragment_index, *dirfile,
+      field_code, *field_code_l);
+
+  if (gd_entry(_GDF_GetDirfile(*dirfile), _GDF_CString(&fc, field_code,
+          *field_code_l), &E) || E.field_type != GD_MPLEX_ENTRY)
+    *in_field_l = 0;
+  else {
+    _GDF_FString(in_field, in_field_l, E.in_fields[0]);
+    _GDF_FString(count_field, count_field_l, E.in_fields[1]);
+    *val = E.EN(mplex,count_val);
+    *period = E.EN(mplex,period);
+    *fragment_index = E.fragment_index;
+    gd_free_entry_strings(&E);
+  }
+
+  free(fc);
+
+  dreturnvoid();
+}
+
 /* gd_entry wrapper for RECIP */
-void F77_FUNC(gdgerc, GDGERC) (char* in_field, int* in_field_l,
-    double* dividend, int* fragment_index, const int* dirfile,
-    const char* field_code, const int* field_code_l)
+void F77_FUNC(gdgerc, GDGERC) (char *in_field, int32_t *in_field_l,
+    double *dividend, int32_t *fragment_index, const int32_t *dirfile,
+    const char *field_code, const int32_t *field_code_l)
 {
   char *out;
   gd_entry_t E;
@@ -782,9 +925,7 @@ void F77_FUNC(gdgerc, GDGERC) (char* in_field, int* in_field_l,
   dtrace("%p, %i, %p, %p, %i, %p, %i", in_field, *in_field_l, dividend,
       fragment_index, *dirfile, field_code, *field_code_l);
 
-  out = (char *)malloc(*field_code_l + 1);
-
-  if (gd_entry(_GDF_GetDirfile(*dirfile), _GDF_CString(out, field_code,
+  if (gd_entry(_GDF_GetDirfile(*dirfile), _GDF_CString(&out, field_code,
           *field_code_l), &E) || E.field_type != GD_RECIP_ENTRY)
     *in_field_l = 0;
   else {
@@ -799,9 +940,9 @@ void F77_FUNC(gdgerc, GDGERC) (char* in_field, int* in_field_l,
   dreturnvoid();
 }
 
-void F77_FUNC(gdgecr, GDGECR) (char* in_field, int* in_field_l,
-    GD_DCOMPLEXP(cdividend), int* fragment_index, const int* dirfile,
-    const char* field_code, const int* field_code_l)
+void F77_FUNC(gdgecr, GDGECR) (char *in_field, int32_t *in_field_l,
+    GD_DCOMPLEXP(cdividend), int32_t *fragment_index, const int32_t *dirfile,
+    const char *field_code, const int32_t *field_code_l)
 {
   char *out;
   gd_entry_t E;
@@ -809,14 +950,12 @@ void F77_FUNC(gdgecr, GDGECR) (char* in_field, int* in_field_l,
   dtrace("%p, %i, %p, %p, %i, %p, %i", in_field, *in_field_l, cdividend,
       fragment_index, *dirfile, field_code, *field_code_l);
 
-  out = (char *)malloc(*field_code_l + 1);
-
-  if (gd_entry(_GDF_GetDirfile(*dirfile), _GDF_CString(out, field_code,
+  if (gd_entry(_GDF_GetDirfile(*dirfile), _GDF_CString(&out, field_code,
           *field_code_l), &E) || E.field_type != GD_RECIP_ENTRY)
     *in_field_l = 0;
   else {
     _GDF_FString(in_field, in_field_l, E.in_fields[0]);
-    _gd_c2cp(cdividend, E.EN(recip,cdividend));
+    gd_cs2cp_(cdividend, E.EN(recip,cdividend));
     *fragment_index = E.fragment_index;
     gd_free_entry_strings(&E);
   }
@@ -827,9 +966,9 @@ void F77_FUNC(gdgecr, GDGECR) (char* in_field, int* in_field_l,
 }
 
 /* gd_entry wrapper for PHASE */
-void F77_FUNC(gdgeph, GDGEPH) (char* in_field, int* in_field_l, int* shift,
-    int* fragment_index, const int* dirfile, const char* field_code,
-    const int* field_code_l)
+void F77_FUNC(gdgeph, GDGEPH) (char *in_field, int32_t *in_field_l,
+    int32_t *shift, int32_t *fragment_index, const int32_t *dirfile,
+    const char *field_code, const int32_t *field_code_l)
 {
   char *out;
   gd_entry_t E;
@@ -837,9 +976,7 @@ void F77_FUNC(gdgeph, GDGEPH) (char* in_field, int* in_field_l, int* shift,
   dtrace("%p, %i, %p, %p, %i, %p, %i", in_field, *in_field_l, shift,
       fragment_index, *dirfile, field_code, *field_code_l);
 
-  out = (char *)malloc(*field_code_l + 1);
-
-  if (gd_entry(_GDF_GetDirfile(*dirfile), _GDF_CString(out, field_code,
+  if (gd_entry(_GDF_GetDirfile(*dirfile), _GDF_CString(&out, field_code,
           *field_code_l), &E) || E.field_type != GD_PHASE_ENTRY)
     *in_field_l = 0;
   else {
@@ -854,8 +991,8 @@ void F77_FUNC(gdgeph, GDGEPH) (char* in_field, int* in_field_l, int* shift,
 }
 
 /* gd_entry wrapper for CONST */
-void F77_FUNC(gdgeco, GDGECO) (int* data_type, int* fragment_index,
-    const int* dirfile, const char* field_code, const int* field_code_l)
+void F77_FUNC(gdgeco, GDGECO) (int32_t *data_type, int32_t *fragment_index,
+    const int32_t *dirfile, const char *field_code, const int32_t *field_code_l)
 {
   char *out;
   gd_entry_t E;
@@ -863,9 +1000,7 @@ void F77_FUNC(gdgeco, GDGECO) (int* data_type, int* fragment_index,
   dtrace("%p, %p, %i, %p, %i", data_type, fragment_index, *dirfile, field_code,
       *field_code_l);
 
-  out = (char *)malloc(*field_code_l + 1);
-
-  if (gd_entry(_GDF_GetDirfile(*dirfile), _GDF_CString(out, field_code,
+  if (gd_entry(_GDF_GetDirfile(*dirfile), _GDF_CString(&out, field_code,
           *field_code_l), &E) || E.field_type != GD_CONST_ENTRY)
     *data_type = 0;
   else {
@@ -879,9 +1014,9 @@ void F77_FUNC(gdgeco, GDGECO) (int* data_type, int* fragment_index,
 }
 
 /* gd_entry wrapper for CARRAY */
-void F77_FUNC(gdgeca, GDGECA) (int* data_type, int *array_len,
-    int* fragment_index, const int* dirfile, const char* field_code,
-    const int* field_code_l)
+void F77_FUNC(gdgeca, GDGECA) (int32_t *data_type, int32_t *array_len,
+    int32_t *fragment_index, const int32_t *dirfile, const char *field_code,
+    const int32_t *field_code_l)
 {
   char *out;
   gd_entry_t E;
@@ -889,9 +1024,7 @@ void F77_FUNC(gdgeca, GDGECA) (int* data_type, int *array_len,
   dtrace("%p, %p, %p, %i, %p, %i", data_type, array_len, fragment_index,
       *dirfile, field_code, *field_code_l);
 
-  out = (char *)malloc(*field_code_l + 1);
-
-  if (gd_entry(_GDF_GetDirfile(*dirfile), _GDF_CString(out, field_code,
+  if (gd_entry(_GDF_GetDirfile(*dirfile), _GDF_CString(&out, field_code,
           *field_code_l), &E) || E.field_type != GD_CARRAY_ENTRY)
     *data_type = 0;
   else {
@@ -906,82 +1039,94 @@ void F77_FUNC(gdgeca, GDGECA) (int* data_type, int *array_len,
 }
 
 /* gd_fragment_index wrapper */
-void F77_FUNC(gdfrgi, GDFRGI) (int* fragment_index, const int* dirfile,
-    const char* field_code, const int* field_code_l)
+void F77_FUNC(gdfrgi, GDFRGI) (int32_t *fragment_index, const int32_t *dirfile,
+    const char *field_code, const int32_t *field_code_l)
 {
-  char* fc = (char *)malloc(*field_code_l + 1);
+  char *fc;
+  dtrace("%p, %i, %p, %i", fragment_index, *dirfile, field_code,
+      *field_code_l);
 
   *fragment_index = gd_fragment_index(_GDF_GetDirfile(*dirfile),
-      _GDF_CString(fc, field_code, *field_code_l));
+      _GDF_CString(&fc, field_code, *field_code_l));
 
   free(fc);
+
+  dreturn("%i", *fragment_index);
 }
 
 /* gd_add_raw wrapper */
-void F77_FUNC(gdadrw, GDADRW) (const int* dirfile, const char* field_code,
-    const int* field_code_l, const int* data_type, const int* spf,
-    const int* fragment_index)
+void F77_FUNC(gdadrw, GDADRW) (const int32_t *dirfile, const char *field_code,
+    const int32_t *field_code_l, const int32_t *data_type, const int32_t *spf,
+    const int32_t *fragment_index)
 {
-  char* out = (char *)malloc(*field_code_l + 1);
-  gd_add_raw(_GDF_GetDirfile(*dirfile), _GDF_CString(out, field_code,
-        *field_code_l), (gd_type_t)(*data_type), (gd_spf_t)*spf,
+  char *out;
+
+  dtrace("%i, %p, %i, %i, %i, %i", *dirfile, field_code, *field_code_l,
+      *data_type, *spf, *fragment_index);
+
+  gd_add_raw(_GDF_GetDirfile(*dirfile), _GDF_CString(&out, field_code,
+        *field_code_l), (gd_type_t)(*data_type), (unsigned int)*spf,
       *fragment_index);
   free(out);
+  dreturnvoid();
 }
 
 /* gd_add_lincom wrapper */
-void F77_FUNC(gdadlc, GDADLC) (const int* dirfile, const char* field_code,
-    const int* field_code_l, const int* n_fields, const char* in_field1,
-    const int* in_field1_l, const double* m1, const double* b1,
-    const char* in_field2, const int* in_field2_l, const double* m2,
-    const double* b2, const char* in_field3, const int* in_field3_l,
-    const double* m3, const double* b3, const int* fragment_index)
-{
-  char* fc = (char *)malloc(*field_code_l + 1);
-  char* in_fields[3] = {NULL, NULL, NULL};
+void F77_FUNC(gdadlc, GDADLC) (const int32_t *dirfile, const char *field_code,
+    const int32_t *field_code_l, const int32_t *n_fields, const char *in_field1,
+    const int32_t *in_field1_l, const double *m1, const double *b1,
+    const char *in_field2, const int32_t *in_field2_l, const double *m2,
+    const double *b2, const char *in_field3, const int32_t *in_field3_l,
+    const double *m3, const double *b3, const int32_t *fragment_index)
+{
+  char *fc;
+  char *in_fields[3] = {NULL, NULL, NULL};
   double m[3] = {0, 0, 0};
   double b[3] = {0, 0, 0};
-  int nf = *n_fields;
+  const int nf = *n_fields;
+
+  dtrace("%i, %p, %i, %i, %p, %i, %p, %p, %p, %i, %p, %p, %p, %i, %p, %p, %i",
+      *dirfile, field_code, *field_code_l, *n_fields, in_field1, *in_field1_l,
+      m1, b1, in_field2, *in_field2_l, m2, b2, in_field3, *in_field3_l, m3, b3,
+      *fragment_index);
 
   if (nf > 0) {
-    in_fields[0] = (char *)malloc(*in_field1_l + 1);
-    _GDF_CString(in_fields[0], in_field1, *in_field1_l);
+    _GDF_CString(in_fields, in_field1, *in_field1_l);
     m[0] = *m1;
     b[0] = *b1;
   }
 
   if (nf > 1) {
-    in_fields[1] = (char *)malloc(*in_field2_l + 1);
-    _GDF_CString(in_fields[1], in_field2, *in_field2_l);
+    _GDF_CString(in_fields + 1, in_field2, *in_field2_l);
     m[1] = *m2;
     b[1] = *b2;
   }
 
   if (nf > 2) {
-    in_fields[2] = (char *)malloc(*in_field3_l + 1);
-    _GDF_CString(in_fields[2], in_field3, *in_field3_l);
+    _GDF_CString(in_fields + 2, in_field3, *in_field3_l);
     m[2] = *m3;
     b[2] = *b3;
   }
 
-  gd_add_lincom(_GDF_GetDirfile(*dirfile), _GDF_CString(fc, field_code,
+  gd_add_lincom(_GDF_GetDirfile(*dirfile), _GDF_CString(&fc, field_code,
         *field_code_l), nf, (const char**)in_fields, m, b, *fragment_index);
   free(fc);
   free(in_fields[0]);
   free(in_fields[1]);
   free(in_fields[2]);
+  dreturnvoid();
 }
 
-void F77_FUNC(gdadcl, GDADCL) (const int* dirfile, const char* field_code,
-    const int* field_code_l, const int* n_fields, const char* in_field1,
-    const int* in_field1_l, const GD_DCOMPLEXP(m1), const GD_DCOMPLEXP(b1),
-    const char* in_field2, const int* in_field2_l, const GD_DCOMPLEXP(m2),
-    const GD_DCOMPLEXP(b2), const char* in_field3, const int* in_field3_l,
+void F77_FUNC(gdadcl, GDADCL) (const int32_t *dirfile, const char *field_code,
+    const int32_t *field_code_l, const int32_t *n_fields, const char *in_field1,
+    const int32_t *in_field1_l, const GD_DCOMPLEXP(m1), const GD_DCOMPLEXP(b1),
+    const char *in_field2, const int32_t *in_field2_l, const GD_DCOMPLEXP(m2),
+    const GD_DCOMPLEXP(b2), const char *in_field3, const int32_t *in_field3_l,
     const GD_DCOMPLEXP(m3), const GD_DCOMPLEXP(b3),
-    const int* fragment_index)
+    const int32_t *fragment_index)
 {
-  char* fc = (char *)malloc(*field_code_l + 1);
-  char* in_fields[3] = {NULL, NULL, NULL};
+  char *fc;
+  char *in_fields[3] = {NULL, NULL, NULL};
 #ifdef GD_NO_C99_API
   double cm[6] = {0, 0, 0, 0, 0, 0};
   double cb[6] = {0, 0, 0, 0, 0, 0};
@@ -989,53 +1134,55 @@ void F77_FUNC(gdadcl, GDADCL) (const int* dirfile, const char* field_code,
   double complex cm[3] = {0, 0, 0};
   double complex cb[3] = {0, 0, 0};
 #endif
-  int nf = *n_fields;
+  const int nf = *n_fields;
+
+  dtrace("%i, %p, %i, %i, %p, %i, %p, %p, %p, %i, %p, %p, %p, %i, %p, %p, %i",
+      *dirfile, field_code, *field_code_l, *n_fields, in_field1, *in_field1_l,
+      m1, b1, in_field2, *in_field2_l, m2, b2, in_field3, *in_field3_l, m3, b3,
+      *fragment_index);
 
   if (nf > 0) {
-    in_fields[0] = (char *)malloc(*in_field1_l + 1);
-    _GDF_CString(in_fields[0], in_field1, *in_field1_l);
-    _gd_cp2ca(cm, 0, m1);
-    _gd_cp2ca(cb, 0, b1);
+    _GDF_CString(in_fields, in_field1, *in_field1_l);
+    gd_cp2ca_(cm, 0, m1);
+    gd_cp2ca_(cb, 0, b1);
   }
 
   if (nf > 1) {
-    in_fields[1] = (char *)malloc(*in_field2_l + 1);
-    _GDF_CString(in_fields[1], in_field2, *in_field2_l);
-    _gd_cp2ca(cm, 1, m2);
-    _gd_cp2ca(cb, 1, b2);
+    _GDF_CString(in_fields + 1, in_field2, *in_field2_l);
+    gd_cp2ca_(cm, 1, m2);
+    gd_cp2ca_(cb, 1, b2);
   }
 
   if (nf > 2) {
-    in_fields[2] = (char *)malloc(*in_field3_l + 1);
-    _GDF_CString(in_fields[2], in_field3, *in_field3_l);
-    _gd_cp2ca(cm, 2, m3);
-    _gd_cp2ca(cb, 2, b3);
+    _GDF_CString(in_fields + 2, in_field3, *in_field3_l);
+    gd_cp2ca_(cm, 2, m3);
+    gd_cp2ca_(cb, 2, b3);
   }
 
-  gd_add_clincom(_GDF_GetDirfile(*dirfile), _GDF_CString(fc, field_code,
+  gd_add_clincom(_GDF_GetDirfile(*dirfile), _GDF_CString(&fc, field_code,
         *field_code_l), nf, (const char**)in_fields, cm, cb, *fragment_index);
   free(fc);
   free(in_fields[0]);
   free(in_fields[1]);
   free(in_fields[2]);
+  dreturnvoid();
 }
 
 /* gd_add_polynom wrapper */
-void F77_FUNC(gdadpn, GDADPN) (const int* dirfile, const char* field_code,
-    const int* field_code_l, const int* poly_ord, const char* in_field,
-    const int* in_field_l, const double* a0, const double* a1, const double* a2,
-    const double* a3, const double* a4, const double* a5,
-    const int* fragment_index)
-{
-  char* fc = (char *)malloc(*field_code_l + 1);
-  char* inf = NULL;
+void F77_FUNC(gdadpn, GDADPN) (const int32_t *dirfile, const char *field_code,
+    const int32_t *field_code_l, const int32_t *poly_ord, const char *in_field,
+    const int32_t *in_field_l, const double *a0, const double *a1,
+    const double *a2, const double *a3, const double *a4, const double *a5,
+    const int32_t *fragment_index)
+{
+  char *fc, *inf;
   double a[6] = {0, 0, 0, 0, 0, 0};
-  int po = *poly_ord;
-  if (po > 5)
-    po = 5;
+  const int po = (*poly_ord > 5) ? 5 : *poly_ord;
+
+  dtrace("%i, %p, %i, %i, %p, %i, %p, %p, %p, %p, %p, %p", *dirfile, field_code,
+      *field_code_l, *poly_ord, in_field, *in_field_l, a0, a1, a2, a3, a4, a5);
 
-  inf = (char *)malloc(*in_field_l + 1);
-  _GDF_CString(inf, in_field, *in_field_l);
+  _GDF_CString(&inf, in_field, *in_field_l);
 
   switch (po) {
     case 5:
@@ -1051,135 +1198,147 @@ void F77_FUNC(gdadpn, GDADPN) (const int* dirfile, const char* field_code,
       a[0] = *a0;
   }
 
-  gd_add_polynom(_GDF_GetDirfile(*dirfile), _GDF_CString(fc, field_code,
+  gd_add_polynom(_GDF_GetDirfile(*dirfile), _GDF_CString(&fc, field_code,
         *field_code_l), po, inf, a, *fragment_index);
   free(fc);
   free(inf);
+  dreturnvoid();
 }
 
-void F77_FUNC(gdadcp, GDADCP) (const int* dirfile, const char* field_code,
-    const int* field_code_l, const int* poly_ord, const char* in_field,
-    const int* in_field_l, const GD_DCOMPLEXP(a0), const GD_DCOMPLEXP(a1),
+void F77_FUNC(gdadcp, GDADCP) (const int32_t *dirfile, const char *field_code,
+    const int32_t *field_code_l, const int32_t *poly_ord, const char *in_field,
+    const int32_t *in_field_l, const GD_DCOMPLEXP(a0), const GD_DCOMPLEXP(a1),
     const GD_DCOMPLEXP(a2), const GD_DCOMPLEXP(a3),
     const GD_DCOMPLEXP(a4), const GD_DCOMPLEXP(a5),
-    const int* fragment_index)
+    const int32_t *fragment_index)
 {
-  char* fc = (char *)malloc(*field_code_l + 1);
-  char* inf = NULL;
+  char *fc, *inf;
 #ifdef GD_NO_C99_API
   double ca[12] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
 #else
   double complex ca[6] = {0, 0, 0, 0, 0, 0};
 #endif
-  int po = *poly_ord;
-  if (po > 5)
-    po = 5;
+  const int po = (*poly_ord > 5) ? 5 : *poly_ord;
 
-  inf = (char *)malloc(*in_field_l + 1);
-  _GDF_CString(inf, in_field, *in_field_l);
+  dtrace("%i, %p, %i, %i, %p, %i, %p, %p, %p, %p, %p, %p", *dirfile, field_code,
+      *field_code_l, *poly_ord, in_field, *in_field_l, a0, a1, a2, a3, a4, a5);
+
+  _GDF_CString(&inf, in_field, *in_field_l);
 
   switch (po) {
     case 5:
-      _gd_cp2ca(ca, 5, a5);
+      gd_cp2ca_(ca, 5, a5);
     case 4:
-      _gd_cp2ca(ca, 4, a4);
+      gd_cp2ca_(ca, 4, a4);
     case 3:
-      _gd_cp2ca(ca, 3, a3);
+      gd_cp2ca_(ca, 3, a3);
     case 2:
-      _gd_cp2ca(ca, 2, a2);
+      gd_cp2ca_(ca, 2, a2);
     case 1:
-      _gd_cp2ca(ca, 1, a1);
-      _gd_cp2ca(ca, 0, a0);
+      gd_cp2ca_(ca, 1, a1);
+      gd_cp2ca_(ca, 0, a0);
   }
 
-  gd_add_cpolynom(_GDF_GetDirfile(*dirfile), _GDF_CString(fc, field_code,
+  gd_add_cpolynom(_GDF_GetDirfile(*dirfile), _GDF_CString(&fc, field_code,
         *field_code_l), po, inf, ca, *fragment_index);
   free(fc);
   free(inf);
+  dreturnvoid();
 }
 
 /* gd_add_linterp wrapper */
-void F77_FUNC(gdadlt, GDADLT) (const int* dirfile, const char* field_code,
-    const int* field_code_l, const char* in_field, const int* in_field_l,
-    const char* table, const int* table_l, const int* fragment_index)
+void F77_FUNC(gdadlt, GDADLT) (const int32_t *dirfile, const char *field_code,
+    const int32_t *field_code_l, const char *in_field,
+    const int32_t *in_field_l, const char *table, const int32_t *table_l,
+    const int32_t *fragment_index)
 {
-  char* fc = (char *)malloc(*field_code_l + 1);
-  char* in = (char *)malloc(*in_field_l + 1);
-  char* tab = (char *)malloc(*table_l + 1);
+  char *fc, *in, *tab;
+
+  dtrace("%i, %p, %i, %p, %i, %p, %i, %i", *dirfile, field_code, *field_code_l,
+      in_field, *in_field_l, table, *table_l, *fragment_index);
 
-  gd_add_linterp(_GDF_GetDirfile(*dirfile), _GDF_CString(fc, field_code,
-        *field_code_l), _GDF_CString(in, in_field, *in_field_l),
-      _GDF_CString(tab, table, *table_l), *fragment_index);
+  gd_add_linterp(_GDF_GetDirfile(*dirfile), _GDF_CString(&fc, field_code,
+        *field_code_l), _GDF_CString(&in, in_field, *in_field_l),
+      _GDF_CString(&tab, table, *table_l), *fragment_index);
   free(fc);
   free(in);
   free(tab);
+  dreturnvoid();
 }
 
 /* gd_add_bit wrapper */
-void F77_FUNC(gdadbt, GDADBT) (const int* dirfile, const char* field_code,
-    const int* field_code_l, const char* in_field, const int* in_field_l,
-    const int* bitnum, const int* numbits, const int* fragment_index)
+void F77_FUNC(gdadbt, GDADBT) (const int32_t *dirfile, const char *field_code,
+    const int32_t *field_code_l, const char *in_field,
+    const int32_t *in_field_l, const int32_t *bitnum, const int32_t *numbits,
+    const int32_t *fragment_index)
 {
-  char* fc = (char *)malloc(*field_code_l + 1);
-  char* in = (char *)malloc(*in_field_l + 1);
+  char *fc, *in;
 
-  gd_add_bit(_GDF_GetDirfile(*dirfile), _GDF_CString(fc, field_code,
-        *field_code_l), _GDF_CString(in, in_field, *in_field_l),
-      (gd_bit_t)*bitnum, (gd_bit_t)*numbits, *fragment_index);
+  dtrace("%i, %p, %i, %p, %i, %i, %i, %i", *dirfile, field_code, *field_code_l,
+      in_field, *in_field_l, *bitnum, *numbits, *fragment_index);
+
+  gd_add_bit(_GDF_GetDirfile(*dirfile), _GDF_CString(&fc, field_code,
+        *field_code_l), _GDF_CString(&in, in_field, *in_field_l),
+      *bitnum, *numbits, *fragment_index);
   free(fc);
   free(in);
+  dreturnvoid();
 }
 
 /* gd_add_sbit wrapper */
-void F77_FUNC(gdadsb, GDADSB) (const int* dirfile, const char* field_code,
-    const int* field_code_l, const char* in_field, const int* in_field_l,
-    const int* bitnum, const int* numbits, const int* fragment_index)
+void F77_FUNC(gdadsb, GDADSB) (const int32_t *dirfile, const char *field_code,
+    const int32_t *field_code_l, const char *in_field,
+    const int32_t *in_field_l, const int32_t *bitnum, const int32_t *numbits,
+    const int32_t *fragment_index)
 {
-  char* fc = (char *)malloc(*field_code_l + 1);
-  char* in = (char *)malloc(*in_field_l + 1);
+  char *fc, *in;
+
+  dtrace("%i, %p, %i, %p, %i, %i, %i, %i", *dirfile, field_code, *field_code_l,
+      in_field, *in_field_l, *bitnum, *numbits, *fragment_index);
 
-  gd_add_sbit(_GDF_GetDirfile(*dirfile), _GDF_CString(fc, field_code,
-        *field_code_l), _GDF_CString(in, in_field, *in_field_l),
-      (gd_bit_t)*bitnum, (gd_bit_t)*numbits, *fragment_index);
+  gd_add_sbit(_GDF_GetDirfile(*dirfile), _GDF_CString(&fc, field_code,
+        *field_code_l), _GDF_CString(&in, in_field, *in_field_l),
+      *bitnum, *numbits, *fragment_index);
   free(fc);
   free(in);
+  dreturnvoid();
 }
 
 /* gd_add_multiply wrapper */
-void F77_FUNC(gdadmt, GDADMT) (const int* dirfile, const char* field_code,
-    const int* field_code_l, const char* in_field1, const int* in_field1_l,
-    const char* in_field2, const int* in_field2_l, const int* fragment_index)
+void F77_FUNC(gdadmt, GDADMT) (const int32_t *dirfile, const char *field_code,
+    const int32_t *field_code_l, const char *in_field1,
+    const int32_t *in_field1_l, const char *in_field2,
+    const int32_t *in_field2_l, const int32_t *fragment_index)
 {
-  char* fc = (char *)malloc(*field_code_l + 1);
-  char* in1 = (char *)malloc(*in_field1_l + 1);
-  char* in2 = (char *)malloc(*in_field2_l + 1);
+  char *fc, *in1, *in2;
 
-  gd_add_multiply(_GDF_GetDirfile(*dirfile), _GDF_CString(fc, field_code,
-        *field_code_l), _GDF_CString(in1, in_field1, *in_field1_l),
-      _GDF_CString(in2, in_field2, *in_field2_l), *fragment_index);
+  dtrace("%i, %p, %i, %p, %i, %p, %i, %i", *dirfile, field_code, *field_code_l,
+      in_field1, *in_field1_l, in_field2, *in_field2_l, *fragment_index);
+
+  gd_add_multiply(_GDF_GetDirfile(*dirfile), _GDF_CString(&fc, field_code,
+        *field_code_l), _GDF_CString(&in1, in_field1, *in_field1_l),
+      _GDF_CString(&in2, in_field2, *in_field2_l), *fragment_index);
 
   free(fc);
   free(in1);
   free(in2);
+  dreturnvoid();
 }
 
 /* gd_add_divide wrapper */
-void F77_FUNC(gdaddv, GDADDV) (const int* dirfile, const char* field_code,
-    const int* field_code_l, const char* in_field1, const int* in_field1_l,
-    const char* in_field2, const int* in_field2_l, const int* fragment_index)
+void F77_FUNC(gdaddv, GDADDV) (const int32_t *dirfile, const char *field_code,
+    const int32_t *field_code_l, const char *in_field1,
+    const int32_t *in_field1_l, const char *in_field2,
+    const int32_t *in_field2_l, const int32_t *fragment_index)
 {
   char *fc, *in1, *in2;
 
   dtrace("%i, %p, %i, %p, %i, %p, %i, %i", *dirfile, field_code, *field_code_l,
       in_field1, *in_field1_l, in_field2, *in_field2_l, *fragment_index);
 
-  fc = (char *)malloc(*field_code_l + 1);
-  in1 = (char *)malloc(*in_field1_l + 1);
-  in2 = (char *)malloc(*in_field2_l + 1);
-
-  gd_add_divide(_GDF_GetDirfile(*dirfile), _GDF_CString(fc, field_code,
-        *field_code_l), _GDF_CString(in1, in_field1, *in_field1_l),
-      _GDF_CString(in2, in_field2, *in_field2_l), *fragment_index);
+  gd_add_divide(_GDF_GetDirfile(*dirfile), _GDF_CString(&fc, field_code,
+        *field_code_l), _GDF_CString(&in1, in_field1, *in_field1_l),
+      _GDF_CString(&in2, in_field2, *in_field2_l), *fragment_index);
 
   free(fc);
   free(in1);
@@ -1189,20 +1348,18 @@ void F77_FUNC(gdaddv, GDADDV) (const int* dirfile, const char* field_code,
 }
 
 /* gd_add_recip wrapper */
-void F77_FUNC(gdadrc, GDADRC) (const int* dirfile, const char* field_code,
-    const int* field_code_l, const char* in_field, const int* in_field_l,
-    const double* dividend, const int* fragment_index)
+void F77_FUNC(gdadrc, GDADRC) (const int32_t *dirfile, const char *field_code,
+    const int32_t *field_code_l, const char *in_field,
+    const int32_t *in_field_l, const double *dividend,
+    const int32_t *fragment_index)
 {
   char *fc, *in;
 
   dtrace("%i, %p, %i, %p, %i, %g, %i", *dirfile, field_code, *field_code_l,
       in_field, *in_field_l, *dividend, *fragment_index);
 
-  fc = (char *)malloc(*field_code_l + 1);
-  in = (char *)malloc(*in_field_l + 1);
-
-  gd_add_recip(_GDF_GetDirfile(*dirfile), _GDF_CString(fc, field_code,
-        *field_code_l), _GDF_CString(in, in_field, *in_field_l), *dividend,
+  gd_add_recip(_GDF_GetDirfile(*dirfile), _GDF_CString(&fc, field_code,
+        *field_code_l), _GDF_CString(&in, in_field, *in_field_l), *dividend,
       *fragment_index);
 
   free(fc);
@@ -1211,9 +1368,10 @@ void F77_FUNC(gdadrc, GDADRC) (const int* dirfile, const char* field_code,
   dreturnvoid();
 }
 
-void F77_FUNC(gdadcr, GDADCR) (const int* dirfile, const char* field_code,
-    const int* field_code_l, const char* in_field, const int* in_field_l,
-    const GD_DCOMPLEXP(cdividend), const int* fragment_index)
+void F77_FUNC(gdadcr, GDADCR) (const int32_t *dirfile, const char *field_code,
+    const int32_t *field_code_l, const char *in_field,
+    const int32_t *in_field_l, const GD_DCOMPLEXP(cdividend),
+    const int32_t *fragment_index)
 {
   char *fc, *in;
 
@@ -1221,16 +1379,13 @@ void F77_FUNC(gdadcr, GDADCR) (const int* dirfile, const char* field_code,
       in_field, *in_field_l, crealp(cdividend), cimagp(cdividend),
       *fragment_index);
 
-  fc = (char *)malloc(*field_code_l + 1);
-  in = (char *)malloc(*in_field_l + 1);
-
 #ifdef GD_NO_C99_API
-  gd_add_crecip89(_GDF_GetDirfile(*dirfile), _GDF_CString(fc, field_code,
-        *field_code_l), _GDF_CString(in, in_field, *in_field_l), cdividend,
+  gd_add_crecip89(_GDF_GetDirfile(*dirfile), _GDF_CString(&fc, field_code,
+        *field_code_l), _GDF_CString(&in, in_field, *in_field_l), cdividend,
       *fragment_index);
 #else
-  gd_add_crecip(_GDF_GetDirfile(*dirfile), _GDF_CString(fc, field_code,
-        *field_code_l), _GDF_CString(in, in_field, *in_field_l), *cdividend,
+  gd_add_crecip(_GDF_GetDirfile(*dirfile), _GDF_CString(&fc, field_code,
+        *field_code_l), _GDF_CString(&in, in_field, *in_field_l), *cdividend,
       *fragment_index);
 #endif
 
@@ -1241,43 +1396,53 @@ void F77_FUNC(gdadcr, GDADCR) (const int* dirfile, const char* field_code,
 }
 
 /* gd_add_phase wrapper */
-void F77_FUNC(gdadph, GDADPH) (const int* dirfile, const char* field_code,
-    const int* field_code_l, const char* in_field, const int* in_field_l,
-    const int* shift, const int* fragment_index)
+void F77_FUNC(gdadph, GDADPH) (const int32_t *dirfile, const char *field_code,
+    const int32_t *field_code_l, const char *in_field,
+    const int32_t *in_field_l, const int32_t *shift,
+    const int32_t *fragment_index)
 {
-  char* fc = (char *)malloc(*field_code_l + 1);
-  char* in = (char *)malloc(*in_field_l + 1);
+  char *fc, *in;
 
-  gd_add_phase(_GDF_GetDirfile(*dirfile), _GDF_CString(fc, field_code,
-        *field_code_l), _GDF_CString(in, in_field, *in_field_l), *shift,
+  dtrace("%i, %p, %i, %p, %i, %i, %i", *dirfile, field_code, *field_code_l,
+      in_field, *in_field_l, *shift, *fragment_index);
+
+  gd_add_phase(_GDF_GetDirfile(*dirfile), _GDF_CString(&fc, field_code,
+        *field_code_l), _GDF_CString(&in, in_field, *in_field_l), *shift,
       *fragment_index);
 
   free(fc);
   free(in);
+  dreturnvoid();
 }
 
 /* gd_fragmentname wrapper */
-void F77_FUNC(gdfrgn, GDFRGN) (char* filename, int* filename_l,
-    const int* dirfile, const int* index)
+void F77_FUNC(gdfrgn, GDFRGN) (char *filename, int32_t *filename_l,
+    const int32_t *dirfile, const int32_t *index)
 {
+  dtrace("%p, %i, %i, %i", filename, *filename_l, *dirfile, *index);
   _GDF_FString(filename, filename_l, gd_fragmentname(_GDF_GetDirfile(*dirfile),
         *index));
+  dreturnvoid();
 }
 
 /* gd_nfragments wrapper */
-void F77_FUNC(gdnfrg, GDNFRG) (int* nformats, const int* dirfile)
+void F77_FUNC(gdnfrg, GDNFRG) (int32_t *nformats, const int32_t *dirfile)
 {
   *nformats = gd_nfragments(_GDF_GetDirfile(*dirfile));
 }
 
 /* gd_metaflush wrapper */
-void F77_FUNC(gdmfls, GDMFLS) (const int* dirfile)
+void F77_FUNC(gdmfls, GDMFLS) (const int32_t *dirfile)
 {
+  dtrace("%i", *dirfile);
+
   gd_metaflush(_GDF_GetDirfile(*dirfile));
+
+  dreturnvoid();
 }
 
 /* gd_rewrite_fragment wrapper */
-void F77_FUNC(gdrfrg, GDRFRG) (const int* dirfile, const int* fragment)
+void F77_FUNC(gdrfrg, GDRFRG) (const int32_t *dirfile, const int32_t *fragment)
 {
   dtrace("%i, %i", *dirfile, *fragment);
 
@@ -1287,50 +1452,63 @@ void F77_FUNC(gdrfrg, GDRFRG) (const int* dirfile, const int* fragment)
 }
 
 /* gd_include wrapper */
-void F77_FUNC(gdincl, GDINCL) (const int* dirfile, const char* file,
-    const int* file_l, const int* fragment_index, const int* flags)
+void F77_FUNC(gdincl, GDINCL) (const int32_t *dirfile, const char *file,
+    const int32_t *file_l, const int32_t *fragment_index, const int32_t *flags)
 {
-  char* fi = (char *)malloc(*file_l + 1);
+  char *fi;
+
+  dtrace("%i, %p, %i, %i, 0x%X", *dirfile, file, *file_l, *fragment_index,
+      *flags);
 
-  gd_include(_GDF_GetDirfile(*dirfile), _GDF_CString(fi, file, *file_l),
+  gd_include(_GDF_GetDirfile(*dirfile), _GDF_CString(&fi, file, *file_l),
       *fragment_index, *flags);
 
   free(fi);
+  dreturnvoid();
 }
 
 /* gd_nfield_by_type wrapper */
-void F77_FUNC(gdnfdt, GDNFDT) (int* nfields, const int* dirfile,
-    const int* type)
+void F77_FUNC(gdnfdt, GDNFDT) (int32_t *nfields, const int32_t *dirfile,
+    const int32_t *type)
 {
+  dtrace("%p, %i, 0x%x", nfields, *dirfile, *type);
+
   *nfields = gd_nfields_by_type(_GDF_GetDirfile(*dirfile), (gd_entype_t)*type);
+
+  dreturn("%i", *nfields);
 }
 
 /* gd_nvectors wrapper */
-void F77_FUNC(gdnvec, GDNVEC) (int* nvectors, const int* dirfile)
+void F77_FUNC(gdnvec, GDNVEC) (int32_t *nvectors, const int32_t *dirfile)
 {
   *nvectors = gd_nvectors(_GDF_GetDirfile(*dirfile));
 }
 
 /* gd_field_list_by_type wrapper -- this only returns one field name */
-void F77_FUNC(gdfdnt, GDFDNT) (char* name, int* name_l, const int* dirfile,
-    const int* type, const int* field_num)
+void F77_FUNC(gdfdnt, GDFDNT) (char *name, int32_t *name_l,
+    const int32_t *dirfile, const int32_t *type, const int32_t *field_num)
 {
   const char** fl;
-  DIRFILE* D = _GDF_GetDirfile(*dirfile);
-  unsigned int nfields = gd_nfields_by_type(D, (gd_entype_t)*type);
-  if (D->error)
-    return;
+  DIRFILE* D;
+  unsigned int nfields;
+
+  dtrace("%p, %p, %i, 0x%X, %i", name, name_l, *dirfile, *type, *field_num);
+
+  D = _GDF_GetDirfile(*dirfile);
+  nfields = gd_nfields_by_type(D, (gd_entype_t)*type);
 
-  if (*field_num <= (int)nfields) {
+  if (!gd_error(D) && *field_num > 0 && *field_num <= (int)nfields) {
     fl = gd_field_list_by_type(D, (gd_entype_t)*type);
     _GDF_FString(name, name_l, fl[*field_num - 1]);
   } else
     *name_l = 0;
+
+  dreturn("%i", *name_l);
 }
 
 /* gd_vector_list wrapper -- this only returns one field name */
-void F77_FUNC(gdvecn, GDVECN) (char* name, int* name_l, const int* dirfile,
-    const int* field_num)
+void F77_FUNC(gdvecn, GDVECN) (char *name, int32_t *name_l,
+    const int32_t *dirfile, const int32_t *field_num)
 {
   const char** fl;
   DIRFILE *D;
@@ -1341,129 +1519,127 @@ void F77_FUNC(gdvecn, GDVECN) (char* name, int* name_l, const int* dirfile,
   D = _GDF_GetDirfile(*dirfile);
   nfields = gd_nvectors(D);
 
-  if (D->error)
-    return;
-
-  if (*field_num <= (int)nfields) {
+  if (!gd_error(D) && *field_num > 0 && *field_num <= (int)nfields) {
     fl = gd_vector_list(D);
     _GDF_FString(name, name_l, fl[*field_num - 1]);
   } else
     *name_l = 0;
 
-  dreturnvoid();
+  dreturn("%i", *name_l);
 }
 
 /* gd_mfield_list_by_type wrapper -- this only returns one field name */
-void F77_FUNC(gdmfdt, GDMFDT) (char* name, int* name_l, const int* dirfile,
-    const char* parent, const int* parent_l, const int* type,
-    const int* field_num)
+void F77_FUNC(gdmfdt, GDMFDT) (char *name, int32_t *name_l,
+    const int32_t *dirfile, const char *parent, const int32_t *parent_l,
+    const int32_t *type, const int32_t *field_num)
 {
-  const char** fl;
+  const char **fl;
   unsigned int nfields;
-  DIRFILE* D = _GDF_GetDirfile(*dirfile);
-  char* pa = (char *)malloc(*parent_l + 1);
+  DIRFILE *D;
+  char *pa;
 
-  _GDF_CString(pa, parent, *parent_l);
+  dtrace("%p, %i, %i, %p, %i, 0x%X, %i", name, *name_l, *dirfile, parent,
+      *parent_l, *type, *field_num);
 
-  nfields = gd_nmfields_by_type(D, pa, (gd_entype_t)*type);
-  if (D->error) {
-    free(pa);
-    return;
-  }
+  D = _GDF_GetDirfile(*dirfile);
+  _GDF_CString(&pa, parent, *parent_l);
 
-  if (*field_num <= (int)nfields) {
+  nfields = gd_nmfields_by_type(D, pa, (gd_entype_t)*type);
+  if (!gd_error(D) && *field_num > 0 && *field_num <= (int)nfields) {
     fl = gd_mfield_list_by_type(D, pa, (gd_entype_t)*type);
     _GDF_FString(name, name_l, fl[*field_num - 1]);
   } else
     *name_l = 0;
 
   free(pa);
+  dreturnvoid();
 }
 
 /* gd_mvector_list wrapper -- this only returns one field name */
-void F77_FUNC(gdmven, GDMVEN) (char* name, int* name_l, const int* dirfile,
-    const char* parent, const int* parent_l, const int* field_num)
+void F77_FUNC(gdmven, GDMVEN) (char *name, int32_t *name_l,
+    const int32_t *dirfile, const char *parent, const int32_t *parent_l,
+    const int32_t *field_num)
 {
   const char** fl;
   unsigned int nfields;
-  DIRFILE* D = _GDF_GetDirfile(*dirfile);
-  char* pa = (char *)malloc(*parent_l + 1);
+  DIRFILE* D;
+  char *pa;
 
-  _GDF_CString(pa, parent, *parent_l);
+  dtrace("%p, %p, %i, %i", name, name_l, *dirfile, *field_num);
 
-  nfields = gd_nmvectors(D, pa);
-  if (D->error) {
-    free(pa);
-    return;
-  }
+  D = _GDF_GetDirfile(*dirfile);
+  _GDF_CString(&pa, parent, *parent_l);
 
-  if (*field_num <= (int)nfields) {
+  nfields = gd_nmvectors(D, pa);
+  if (!gd_error(D) && *field_num > 0 && *field_num <= (int)nfields) {
     fl = gd_mvector_list(D, pa);
     _GDF_FString(name, name_l, fl[*field_num - 1]);
   } else
     *name_l = 0;
 
   free(pa);
+  dreturn("%i", *name_l);
 }
 
 /* gd_madd_lincom wrapper */
-void F77_FUNC(gdmdlc, GDMDLC) (const int* dirfile, const char* parent,
-    const int* parent_l, const char* field_code, const int* field_code_l,
-    const int* n_fields, const char* in_field1, const int* in_field1_l,
-    const double* m1, const double* b1, const char* in_field2,
-    const int* in_field2_l, const double* m2, const double* b2,
-    const char* in_field3, const int* in_field3_l, const double* m3,
-    const double* b3)
-{
-  char* pa = (char *)malloc(*parent_l + 1);
-  char* fc = (char *)malloc(*field_code_l + 1);
-  char* in_fields[3] = {NULL, NULL, NULL};
+void F77_FUNC(gdmdlc, GDMDLC) (const int32_t *dirfile, const char *parent,
+    const int32_t *parent_l, const char *field_code,
+    const int32_t *field_code_l, const int32_t *n_fields, const char *in_field1,
+    const int32_t *in_field1_l, const double *m1, const double *b1,
+    const char *in_field2, const int32_t *in_field2_l, const double *m2,
+    const double *b2, const char *in_field3, const int32_t *in_field3_l,
+    const double *m3, const double *b3)
+{
+  char *pa, *fc;
+  char *in_fields[3] = {NULL, NULL, NULL};
   double m[3] = {0, 0, 0};
   double b[3] = {0, 0, 0};
-  int nf = *n_fields;
+  const int nf = *n_fields;
+
+  dtrace("%i, %p, %i, %p, %i, %i, %p, %i, %p, %p, %p, %i, %p, %p, %p, %i, %p, "
+      "%p", *dirfile, parent, *parent_l, field_code, *field_code_l, *n_fields,
+      in_field1, *in_field1_l, m1, b1, in_field2, *in_field2_l, m2, b2,
+      in_field3, *in_field3_l, m3, b3);
 
   if (nf > 0) {
-    in_fields[0] = (char *)malloc(*in_field1_l + 1);
-    _GDF_CString(in_fields[0], in_field1, *in_field1_l);
+    _GDF_CString(in_fields, in_field1, *in_field1_l);
     m[0] = *m1;
     b[0] = *b1;
   }
 
   if (nf > 1) {
-    in_fields[1] = (char *)malloc(*in_field2_l + 1);
-    _GDF_CString(in_fields[1], in_field2, *in_field2_l);
+    _GDF_CString(in_fields + 1, in_field2, *in_field2_l);
     m[1] = *m2;
     b[1] = *b2;
   }
 
   if (nf > 2) {
-    in_fields[2] = (char *)malloc(*in_field3_l + 1);
-    _GDF_CString(in_fields[2], in_field3, *in_field3_l);
+    _GDF_CString(in_fields + 2, in_field3, *in_field3_l);
     m[2] = *m3;
     b[2] = *b3;
   }
 
-  gd_madd_lincom(_GDF_GetDirfile(*dirfile), _GDF_CString(pa, parent,
-        *parent_l), _GDF_CString(fc, field_code, *field_code_l), nf,
+  gd_madd_lincom(_GDF_GetDirfile(*dirfile), _GDF_CString(&pa, parent,
+        *parent_l), _GDF_CString(&fc, field_code, *field_code_l), nf,
       (const char**)in_fields, m, b);
   free(pa);
   free(fc);
   free(in_fields[0]);
   free(in_fields[1]);
   free(in_fields[2]);
+  dreturnvoid();
 }
 
-void F77_FUNC(gdmdcl, GDMDCL) (const int* dirfile, const char* parent,
-    const int* parent_l, const char* field_code, const int* field_code_l,
-    const int* n_fields, const char* in_field1, const int* in_field1_l,
-    const GD_DCOMPLEXP(m1), const GD_DCOMPLEXP(b1), const char* in_field2,
-    const int* in_field2_l, const GD_DCOMPLEXP(m2), const GD_DCOMPLEXP(b2),
-    const char* in_field3, const int* in_field3_l, const GD_DCOMPLEXP(m3),
-    const GD_DCOMPLEXP(b3))
+void F77_FUNC(gdmdcl, GDMDCL) (const int32_t *dirfile, const char *parent,
+    const int32_t *parent_l, const char *field_code,
+    const int32_t *field_code_l, const int32_t *n_fields, const char *in_field1,
+    const int32_t *in_field1_l, const GD_DCOMPLEXP(m1), const GD_DCOMPLEXP(b1),
+    const char *in_field2, const int32_t *in_field2_l, const GD_DCOMPLEXP(m2),
+    const GD_DCOMPLEXP(b2), const char *in_field3, const int32_t *in_field3_l,
+    const GD_DCOMPLEXP(m3), const GD_DCOMPLEXP(b3))
 {
-  char* pa = (char *)malloc(*parent_l + 1);
-  char* fc = (char *)malloc(*field_code_l + 1);
-  char* in_fields[3] = {NULL, NULL, NULL};
+  char *pa, *fc;
+  char *in_fields[3] = {NULL, NULL, NULL};
 #ifdef GD_NO_C99_API
   double cm[6] = {0, 0, 0, 0, 0, 0};
   double cb[6] = {0, 0, 0, 0, 0, 0};
@@ -1471,56 +1647,58 @@ void F77_FUNC(gdmdcl, GDMDCL) (const int* dirfile, const char* parent,
   double complex cm[3] = {0, 0, 0};
   double complex cb[3] = {0, 0, 0};
 #endif
-  int nf = *n_fields;
+  const int nf = *n_fields;
+
+  dtrace("%i, %p, %i, %p, %i, %i, %p, %i, %p, %p, %p, %i, %p, %p, %p, %i, %p, "
+      "%p", *dirfile, parent, *parent_l, field_code, *field_code_l, *n_fields,
+      in_field1, *in_field1_l, m1, b1, in_field2, *in_field2_l, m2, b2,
+      in_field3, *in_field3_l, m3, b3);
 
   if (nf > 0) {
-    in_fields[0] = (char *)malloc(*in_field1_l + 1);
-    _GDF_CString(in_fields[0], in_field1, *in_field1_l);
-    _gd_cp2ca(cm, 0, m1);
-    _gd_cp2ca(cb, 0, b1);
+    _GDF_CString(in_fields, in_field1, *in_field1_l);
+    gd_cp2ca_(cm, 0, m1);
+    gd_cp2ca_(cb, 0, b1);
   }
 
   if (nf > 1) {
-    in_fields[1] = (char *)malloc(*in_field2_l + 1);
-    _GDF_CString(in_fields[1], in_field2, *in_field2_l);
-    _gd_cp2ca(cm, 1, m2);
-    _gd_cp2ca(cb, 1, b2);
+    _GDF_CString(in_fields + 1, in_field2, *in_field2_l);
+    gd_cp2ca_(cm, 1, m2);
+    gd_cp2ca_(cb, 1, b2);
   }
 
   if (nf > 2) {
-    in_fields[2] = (char *)malloc(*in_field3_l + 1);
-    _GDF_CString(in_fields[2], in_field3, *in_field3_l);
-    _gd_cp2ca(cm, 2, m3);
-    _gd_cp2ca(cb, 2, b3);
+    _GDF_CString(in_fields + 2, in_field3, *in_field3_l);
+    gd_cp2ca_(cm, 2, m3);
+    gd_cp2ca_(cb, 2, b3);
   }
 
-  gd_madd_clincom(_GDF_GetDirfile(*dirfile), _GDF_CString(pa, parent,
-        *parent_l), _GDF_CString(fc, field_code, *field_code_l), nf,
+  gd_madd_clincom(_GDF_GetDirfile(*dirfile), _GDF_CString(&pa, parent,
+        *parent_l), _GDF_CString(&fc, field_code, *field_code_l), nf,
       (const char**)in_fields, cm, cb);
   free(pa);
   free(fc);
   free(in_fields[0]);
   free(in_fields[1]);
   free(in_fields[2]);
+  dreturnvoid();
 }
 
 /* gd_madd_polynom wrapper */
-void F77_FUNC(gdmdpn, GDMDPN) (const int* dirfile, const char* parent,
-    const int* parent_l, const char* field_code, const int* field_code_l,
-    const int* poly_ord, const char* in_field, const int* in_field_l,
-    const double* a0, const double* a1, const double* a2, const double* a3,
-    const double* a4, const double* a5)
-{
-  char* pa = (char *)malloc(*parent_l + 1);
-  char* fc = (char *)malloc(*field_code_l + 1);
-  char* inf = NULL;
+void F77_FUNC(gdmdpn, GDMDPN) (const int32_t *dirfile, const char *parent,
+    const int32_t *parent_l, const char *field_code,
+    const int32_t *field_code_l, const int32_t *poly_ord, const char *in_field,
+    const int32_t *in_field_l, const double *a0, const double *a1,
+    const double *a2, const double *a3, const double *a4, const double *a5)
+{
+  char *pa, *fc, *inf;
   double a[6] = {0, 0, 0, 0, 0, 0};
-  int po = *poly_ord;
-  if (po > 5)
-    po = 5;
+  const int po = (*poly_ord > 5) ? 5 : *poly_ord;
 
-  inf = (char *)malloc(*in_field_l + 1);
-  _GDF_CString(inf, in_field, *in_field_l);
+  dtrace("%i, %p, %i, %p, %i, %i, %p, %i, %p, %p, %p, %p, %p, %p", *dirfile,
+      parent, *parent_l, field_code, *field_code_l, *poly_ord, in_field,
+      *in_field_l, a0, a1, a2, a3, a4, a5);
+
+  _GDF_CString(&inf, in_field, *in_field_l);
 
   switch (po) {
     case 5:
@@ -1531,28 +1709,27 @@ void F77_FUNC(gdmdpn, GDMDPN) (const int* dirfile, const char* parent,
       a[3] = *a3;
     case 2:
       a[2] = *a2;
-    case 1:
+    default:
       a[1] = *a1;
       a[0] = *a0;
   }
 
-  gd_madd_polynom(_GDF_GetDirfile(*dirfile), _GDF_CString(pa, parent,
-        *parent_l), _GDF_CString(fc, field_code, *field_code_l), po, inf, a);
+  gd_madd_polynom(_GDF_GetDirfile(*dirfile), _GDF_CString(&pa, parent,
+        *parent_l), _GDF_CString(&fc, field_code, *field_code_l), po, inf, a);
   free(pa);
   free(fc);
   free(inf);
+  dreturnvoid();
 }
 
-void F77_FUNC(gdmdcp, GDMDCP) (const int* dirfile, const char* parent,
-    const int* parent_l, const char* field_code, const int* field_code_l,
-    const int* poly_ord, const char* in_field, const int* in_field_l,
-    const GD_DCOMPLEXP(a0), const GD_DCOMPLEXP(a1),
+void F77_FUNC(gdmdcp, GDMDCP) (const int32_t *dirfile, const char *parent,
+    const int32_t *parent_l, const char *field_code,
+    const int32_t *field_code_l, const int32_t *poly_ord, const char *in_field,
+    const int32_t *in_field_l, const GD_DCOMPLEXP(a0), const GD_DCOMPLEXP(a1),
     const GD_DCOMPLEXP(a2), const GD_DCOMPLEXP(a3),
     const GD_DCOMPLEXP(a4), const GD_DCOMPLEXP(a5))
 {
-  char* pa = (char *)malloc(*parent_l + 1);
-  char* fc = (char *)malloc(*field_code_l + 1);
-  char* inf = NULL;
+  char *pa, *fc, *inf;
 #ifdef GD_NO_C99_API
   double ca[12] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
 #else
@@ -1562,116 +1739,127 @@ void F77_FUNC(gdmdcp, GDMDCP) (const int* dirfile, const char* parent,
   if (po > 5)
     po = 5;
 
-  inf = (char *)malloc(*in_field_l + 1);
-  _GDF_CString(inf, in_field, *in_field_l);
+  dtrace("%i, %p, %i, %p, %i, %i, %p, %i, %p, %p, %p, %p, %p, %p", *dirfile,
+      parent, *parent_l, field_code, *field_code_l, *poly_ord, in_field,
+      *in_field_l, a0, a1, a2, a3, a4, a5);
+
+  _GDF_CString(&inf, in_field, *in_field_l);
 
   switch (po) {
     case 5:
-      _gd_cp2ca(ca, 5, a5);
+      gd_cp2ca_(ca, 5, a5);
     case 4:
-      _gd_cp2ca(ca, 4, a4);
+      gd_cp2ca_(ca, 4, a4);
     case 3:
-      _gd_cp2ca(ca, 3, a3);
+      gd_cp2ca_(ca, 3, a3);
     case 2:
-      _gd_cp2ca(ca, 2, a2);
+      gd_cp2ca_(ca, 2, a2);
     case 1:
-      _gd_cp2ca(ca, 1, a1);
-      _gd_cp2ca(ca, 0, a0);
+      gd_cp2ca_(ca, 1, a1);
+      gd_cp2ca_(ca, 0, a0);
   }
 
-  gd_madd_cpolynom(_GDF_GetDirfile(*dirfile), _GDF_CString(pa, parent,
-        *parent_l), _GDF_CString(fc, field_code, *field_code_l), po, inf, ca);
+  gd_madd_cpolynom(_GDF_GetDirfile(*dirfile), _GDF_CString(&pa, parent,
+        *parent_l), _GDF_CString(&fc, field_code, *field_code_l), po, inf, ca);
   free(pa);
   free(fc);
   free(inf);
+  dreturnvoid();
 }
 
 /* gd_madd_linterp wrapper */
-void F77_FUNC(gdmdlt, GDMDLT) (const int* dirfile, const char* parent,
-    const int* parent_l, const char* field_code, const int* field_code_l,
-    const char* in_field, const int* in_field_l, const char* table,
-    const int* table_l)
-{
-  char* pa = (char *)malloc(*parent_l + 1);
-  char* fc = (char *)malloc(*field_code_l + 1);
-  char* in = (char *)malloc(*in_field_l + 1);
-  char* tab = (char *)malloc(*table_l + 1);
-
-  gd_madd_linterp(_GDF_GetDirfile(*dirfile), _GDF_CString(pa, parent,
-        *parent_l), _GDF_CString(fc, field_code, *field_code_l),
-      _GDF_CString(in, in_field, *in_field_l), _GDF_CString(tab, table,
+void F77_FUNC(gdmdlt, GDMDLT) (const int32_t *dirfile, const char *parent,
+    const int32_t *parent_l, const char *field_code,
+    const int32_t *field_code_l, const char *in_field,
+    const int32_t *in_field_l, const char *table, const int32_t *table_l)
+{
+  char *pa, *fc, *in, *tab;
+
+  dtrace("%i, %p, %i, %p, %i, %p, %i, %p, %i", *dirfile, parent, *parent_l,
+      field_code, *field_code_l, in_field, *in_field_l, table, *table_l);
+
+  gd_madd_linterp(_GDF_GetDirfile(*dirfile), _GDF_CString(&pa, parent,
+        *parent_l), _GDF_CString(&fc, field_code, *field_code_l),
+      _GDF_CString(&in, in_field, *in_field_l), _GDF_CString(&tab, table,
         *table_l));
   free(pa);
   free(fc);
   free(in);
   free(tab);
+  dreturnvoid();
 }
 
 /* gd_madd_bit wrapper */
-void F77_FUNC(gdmdbt, GDMDBT) (const int* dirfile, const char* parent,
-    const int* parent_l, const char* field_code, const int* field_code_l,
-    const char* in_field, const int* in_field_l, const int* bitnum,
-    const int* numbits)
-{
-  char* pa = (char *)malloc(*parent_l + 1);
-  char* fc = (char *)malloc(*field_code_l + 1);
-  char* in = (char *)malloc(*in_field_l + 1);
-
-  gd_madd_bit(_GDF_GetDirfile(*dirfile), _GDF_CString(pa, parent,
-        *parent_l), _GDF_CString(fc, field_code, *field_code_l),
-      _GDF_CString(in, in_field, *in_field_l), (gd_bit_t)*bitnum,
-      (gd_bit_t)*numbits);
+void F77_FUNC(gdmdbt, GDMDBT) (const int32_t *dirfile, const char *parent,
+    const int32_t *parent_l, const char *field_code,
+    const int32_t *field_code_l, const char *in_field,
+    const int32_t *in_field_l, const int32_t *bitnum, const int32_t *numbits)
+{
+  char *pa, *fc, *in;
+
+  dtrace("%i, %p, %i, %p, %i, %p, %i, %i, %i", *dirfile, parent, *parent_l,
+      field_code, *field_code_l, in_field, *in_field_l, *bitnum, *numbits);
+
+  gd_madd_bit(_GDF_GetDirfile(*dirfile), _GDF_CString(&pa, parent,
+        *parent_l), _GDF_CString(&fc, field_code, *field_code_l),
+      _GDF_CString(&in, in_field, *in_field_l), *bitnum, *numbits);
   free(pa);
   free(fc);
   free(in);
+  dreturnvoid();
 }
 
 /* gd_madd_sbit wrapper */
-void F77_FUNC(gdmdsb, GDMDSB) (const int* dirfile, const char* parent,
-    const int* parent_l, const char* field_code, const int* field_code_l,
-    const char* in_field, const int* in_field_l, const int* bitnum,
-    const int* numbits)
-{
-  char* pa = (char *)malloc(*parent_l + 1);
-  char* fc = (char *)malloc(*field_code_l + 1);
-  char* in = (char *)malloc(*in_field_l + 1);
-
-  gd_madd_sbit(_GDF_GetDirfile(*dirfile), _GDF_CString(pa, parent,
-        *parent_l), _GDF_CString(fc, field_code, *field_code_l),
-      _GDF_CString(in, in_field, *in_field_l), (gd_bit_t)*bitnum,
-      (gd_bit_t)*numbits);
+void F77_FUNC(gdmdsb, GDMDSB) (const int32_t *dirfile, const char *parent,
+    const int32_t *parent_l, const char *field_code,
+    const int32_t *field_code_l, const char *in_field,
+    const int32_t *in_field_l, const int32_t *bitnum, const int32_t *numbits)
+{
+  char *pa, *fc, *in;
+
+  dtrace("%i, %p, %i, %p, %i, %p, %i, %i, %i", *dirfile, parent, *parent_l,
+      field_code, *field_code_l, in_field, *in_field_l, *bitnum, *numbits);
+
+  gd_madd_sbit(_GDF_GetDirfile(*dirfile), _GDF_CString(&pa, parent,
+        *parent_l), _GDF_CString(&fc, field_code, *field_code_l),
+      _GDF_CString(&in, in_field, *in_field_l), *bitnum, *numbits);
   free(pa);
   free(fc);
   free(in);
+  dreturnvoid();
 }
 
 /* gd_madd_multiply wrapper */
-void F77_FUNC(gdmdmt, GDMDMT) (const int* dirfile, const char* parent,
-    const int* parent_l, const char* field_code, const int* field_code_l,
-    const char* in_field1, const int* in_field1_l, const char* in_field2,
-    const int* in_field2_l)
-{
-  char* pa = (char *)malloc(*parent_l + 1);
-  char* fc = (char *)malloc(*field_code_l + 1);
-  char* in1 = (char *)malloc(*in_field1_l + 1);
-  char* in2 = (char *)malloc(*in_field2_l + 1);
-
-  gd_madd_multiply(_GDF_GetDirfile(*dirfile), _GDF_CString(pa, parent,
-        *parent_l), _GDF_CString(fc, field_code, *field_code_l),
-      _GDF_CString(in1, in_field1, *in_field1_l), _GDF_CString(in2, in_field2,
+void F77_FUNC(gdmdmt, GDMDMT) (const int32_t *dirfile, const char *parent,
+    const int32_t *parent_l, const char *field_code,
+    const int32_t *field_code_l, const char *in_field1,
+    const int32_t *in_field1_l, const char *in_field2,
+    const int32_t *in_field2_l)
+{
+  char *pa, *fc, *in1, *in2;
+
+  dtrace("%i, %p, %i, %p, %i, %p, %i, %p, %i", *dirfile, parent, *parent_l,
+      field_code, *field_code_l, in_field1, *in_field1_l, in_field2,
+      *in_field2_l);
+
+  gd_madd_multiply(_GDF_GetDirfile(*dirfile), _GDF_CString(&pa, parent,
+        *parent_l), _GDF_CString(&fc, field_code, *field_code_l),
+      _GDF_CString(&in1, in_field1, *in_field1_l), _GDF_CString(&in2, in_field2,
         *in_field2_l));
 
   free(pa);
   free(fc);
   free(in1);
   free(in2);
+  dreturnvoid();
 }
 
 /* gd_madd_divide wrapper */
-void F77_FUNC(gdmddv, GDMDDV) (const int* dirfile, const char* parent,
-    const int* parent_l, const char* field_code, const int* field_code_l,
-    const char* in_field1, const int* in_field1_l, const char* in_field2,
-    const int* in_field2_l)
+void F77_FUNC(gdmddv, GDMDDV) (const int32_t *dirfile, const char *parent,
+    const int32_t *parent_l, const char *field_code,
+    const int32_t *field_code_l, const char *in_field1,
+    const int32_t *in_field1_l, const char *in_field2,
+    const int32_t *in_field2_l)
 {
   char *pa, *fc, *in1, *in2;
 
@@ -1679,14 +1867,9 @@ void F77_FUNC(gdmddv, GDMDDV) (const int* dirfile, const char* parent,
       field_code, *field_code_l, in_field1, *in_field1_l, in_field2,
       *in_field2_l);
 
-  pa = (char *)malloc(*parent_l + 1);
-  fc = (char *)malloc(*field_code_l + 1);
-  in1 = (char *)malloc(*in_field1_l + 1);
-  in2 = (char *)malloc(*in_field2_l + 1);
-
-  gd_madd_divide(_GDF_GetDirfile(*dirfile), _GDF_CString(pa, parent,
-        *parent_l), _GDF_CString(fc, field_code, *field_code_l),
-      _GDF_CString(in1, in_field1, *in_field1_l), _GDF_CString(in2, in_field2,
+  gd_madd_divide(_GDF_GetDirfile(*dirfile), _GDF_CString(&pa, parent,
+        *parent_l), _GDF_CString(&fc, field_code, *field_code_l),
+      _GDF_CString(&in1, in_field1, *in_field1_l), _GDF_CString(&in2, in_field2,
         *in_field2_l));
 
   free(pa);
@@ -1698,22 +1881,19 @@ void F77_FUNC(gdmddv, GDMDDV) (const int* dirfile, const char* parent,
 }
 
 /* gd_madd_recip wrapper */
-void F77_FUNC(gdmdrc, GDMDRC) (const int* dirfile, const char* parent,
-    const int* parent_l, const char* field_code, const int* field_code_l,
-    const char* in_field, const int* in_field_l, const double* dividend)
+void F77_FUNC(gdmdrc, GDMDRC) (const int32_t *dirfile, const char *parent,
+    const int32_t *parent_l, const char *field_code,
+    const int32_t *field_code_l, const char *in_field,
+    const int32_t *in_field_l, const double *dividend)
 {
   char *pa, *fc, *in1;
 
   dtrace("%i, %p, %i, %p, %i, %p, %i, %g", *dirfile, parent, *parent_l,
       field_code, *field_code_l, in_field, *in_field_l, *dividend);
 
-  pa = (char *)malloc(*parent_l + 1);
-  fc = (char *)malloc(*field_code_l + 1);
-  in1 = (char *)malloc(*in_field_l + 1);
-
-  gd_madd_recip(_GDF_GetDirfile(*dirfile), _GDF_CString(pa, parent,
-        *parent_l), _GDF_CString(fc, field_code, *field_code_l),
-      _GDF_CString(in1, in_field, *in_field_l), *dividend);
+  gd_madd_recip(_GDF_GetDirfile(*dirfile), _GDF_CString(&pa, parent,
+        *parent_l), _GDF_CString(&fc, field_code, *field_code_l),
+      _GDF_CString(&in1, in_field, *in_field_l), *dividend);
 
   free(pa);
   free(fc);
@@ -1722,10 +1902,10 @@ void F77_FUNC(gdmdrc, GDMDRC) (const int* dirfile, const char* parent,
   dreturnvoid();
 }
 
-void F77_FUNC(gdmdcr, GDMDCR) (const int* dirfile, const char* parent,
-    const int* parent_l, const char* field_code, const int* field_code_l,
-    const char* in_field, const int* in_field_l,
-    const GD_DCOMPLEXP(cdividend))
+void F77_FUNC(gdmdcr, GDMDCR) (const int32_t *dirfile, const char *parent,
+    const int32_t *parent_l, const char *field_code,
+    const int32_t *field_code_l, const char *in_field,
+    const int32_t *in_field_l, const GD_DCOMPLEXP(cdividend))
 {
   char *pa, *fc, *in1;
 
@@ -1733,18 +1913,14 @@ void F77_FUNC(gdmdcr, GDMDCR) (const int* dirfile, const char* parent,
       field_code, *field_code_l, in_field, *in_field_l, crealp(cdividend),
       cimagp(cdividend));
 
-  pa = (char *)malloc(*parent_l + 1);
-  fc = (char *)malloc(*field_code_l + 1);
-  in1 = (char *)malloc(*in_field_l + 1);
-
 #ifdef GD_NO_C99_API
-  gd_madd_crecip89(_GDF_GetDirfile(*dirfile), _GDF_CString(pa, parent,
-        *parent_l), _GDF_CString(fc, field_code, *field_code_l),
-      _GDF_CString(in1, in_field, *in_field_l), cdividend);
+  gd_madd_crecip89(_GDF_GetDirfile(*dirfile), _GDF_CString(&pa, parent,
+        *parent_l), _GDF_CString(&fc, field_code, *field_code_l),
+      _GDF_CString(&in1, in_field, *in_field_l), cdividend);
 #else
-  gd_madd_crecip(_GDF_GetDirfile(*dirfile), _GDF_CString(pa, parent,
-        *parent_l), _GDF_CString(fc, field_code, *field_code_l),
-      _GDF_CString(in1, in_field, *in_field_l), *cdividend);
+  gd_madd_crecip(_GDF_GetDirfile(*dirfile), _GDF_CString(&pa, parent,
+        *parent_l), _GDF_CString(&fc, field_code, *field_code_l),
+      _GDF_CString(&in1, in_field, *in_field_l), *cdividend);
 #endif
 
   free(pa);
@@ -1755,57 +1931,68 @@ void F77_FUNC(gdmdcr, GDMDCR) (const int* dirfile, const char* parent,
 }
 
 /* gd_madd_phase wrapper */
-void F77_FUNC(gdmdph, GDMDPH) (const int* dirfile, const char* parent,
-    const int* parent_l, const char* field_code, const int* field_code_l,
-    const char* in_field, const int* in_field_l, const int* shift)
+void F77_FUNC(gdmdph, GDMDPH) (const int32_t *dirfile, const char *parent,
+    const int32_t *parent_l, const char *field_code,
+    const int32_t *field_code_l, const char *in_field,
+    const int32_t *in_field_l, const int32_t *shift)
 {
-  char* pa = (char *)malloc(*parent_l + 1);
-  char* fc = (char *)malloc(*field_code_l + 1);
-  char* in = (char *)malloc(*in_field_l + 1);
+  char *pa, *fc, *in;
+
+  dtrace("%i, %p, %i, %p, %i, %p, %i, %i", *dirfile, parent, *parent_l,
+      field_code, *field_code_l, in_field, *in_field_l, *shift);
 
-  gd_madd_phase(_GDF_GetDirfile(*dirfile), _GDF_CString(pa, parent,
-        *parent_l), _GDF_CString(fc, field_code, *field_code_l),
-      _GDF_CString(in, in_field, *in_field_l), *shift);
+  gd_madd_phase(_GDF_GetDirfile(*dirfile), _GDF_CString(&pa, parent,
+        *parent_l), _GDF_CString(&fc, field_code, *field_code_l),
+      _GDF_CString(&in, in_field, *in_field_l), *shift);
 
   free(pa);
   free(fc);
   free(in);
+  dreturnvoid();
 }
 
 /* gd_add_const wrapper */
-void F77_FUNC(gdadco, GDADCO) (const int* dirfile, const char* field_code,
-    const int* field_code_l, const int* const_type, const int* data_type,
-    const void* value, const int* fragment_index)
+void F77_FUNC(gdadco, GDADCO) (const int32_t *dirfile, const char *field_code,
+    const int32_t *field_code_l, const int32_t *const_type,
+    const int32_t *data_type, const void *value, const int32_t *fragment_index)
 {
-  char* fc = (char *)malloc(*field_code_l + 1);
+  char *fc;
 
-  gd_add_const(_GDF_GetDirfile(*dirfile), _GDF_CString(fc, field_code,
+  dtrace("%i, %p, %i, %i, %i, %p, %i", *dirfile, field_code, *field_code_l,
+      *const_type, *data_type, value, *fragment_index);
+
+  gd_add_const(_GDF_GetDirfile(*dirfile), _GDF_CString(&fc, field_code,
         *field_code_l), (gd_type_t)*const_type, (gd_type_t)*data_type, value,
       *fragment_index);
 
   free(fc);
+  dreturnvoid();
 }
 
 /* gd_madd_const wrapper */
-void F77_FUNC(gdmdco, GDMDCO) (const int* dirfile, const char* parent,
-    const int* parent_l, const char* field_code, const int* field_code_l,
-    const int* const_type, const int* data_type, const void* value)
+void F77_FUNC(gdmdco, GDMDCO) (const int32_t *dirfile, const char *parent,
+    const int32_t *parent_l, const char *field_code,
+    const int32_t *field_code_l, const int32_t *const_type,
+    const int32_t *data_type, const void *value)
 {
-  char* pa = (char *)malloc(*parent_l + 1);
-  char* fc = (char *)malloc(*field_code_l + 1);
+  char *pa, *fc;
+
+  dtrace("%i, %p, %i, %p, %i, %i, %i, %p", *dirfile, parent, *parent_l,
+      field_code, *field_code_l, *const_type, *data_type, value);
 
-  gd_madd_const(_GDF_GetDirfile(*dirfile), _GDF_CString(pa, parent,
-        *parent_l), _GDF_CString(fc, field_code, *field_code_l),
+  gd_madd_const(_GDF_GetDirfile(*dirfile), _GDF_CString(&pa, parent,
+        *parent_l), _GDF_CString(&fc, field_code, *field_code_l),
       (gd_type_t)*const_type, (gd_type_t)*data_type, value);
 
   free(pa);
   free(fc);
+  dreturnvoid();
 }
 
 /* gd_add_carray wrapper */
-void F77_FUNC(gdadca, GDADCA) (const int *dirfile, const char *field_code,
-    const int *field_code_l, const int *const_type, int *array_len,
-    const int *data_type, const void *value, const int *fragment_index)
+void F77_FUNC(gdadca, GDADCA) (const int32_t *dirfile, const char *field_code,
+    const int32_t *field_code_l, const int32_t *const_type, int32_t *array_len,
+    const int32_t *data_type, const void *value, const int32_t *fragment_index)
 {
   char *fc;
 
@@ -1813,9 +2000,7 @@ void F77_FUNC(gdadca, GDADCA) (const int *dirfile, const char *field_code,
       *field_code_l, *const_type, *array_len, *data_type, value,
       *fragment_index);
 
-  fc = (char *)malloc(*field_code_l + 1);
-
-  gd_add_carray(_GDF_GetDirfile(*dirfile), _GDF_CString(fc, field_code,
+  gd_add_carray(_GDF_GetDirfile(*dirfile), _GDF_CString(&fc, field_code,
         *field_code_l), (gd_type_t)*const_type, *array_len,
       (gd_type_t)*data_type, value, *fragment_index);
 
@@ -1824,21 +2009,18 @@ void F77_FUNC(gdadca, GDADCA) (const int *dirfile, const char *field_code,
 }
 
 /* gd_madd_carray wrapper */
-void F77_FUNC(gdmdca, GDMDCA) (const int *dirfile, const char *parent,
-    const int *parent_l, const char *field_code, const int *field_code_l,
-    const int *const_type, const int *array_len, const int *data_type,
-    const void *value)
+void F77_FUNC(gdmdca, GDMDCA) (const int32_t *dirfile, const char *parent,
+    const int32_t *parent_l, const char *field_code,
+    const int32_t *field_code_l, const int32_t *const_type,
+    const int32_t *array_len, const int32_t *data_type, const void *value)
 {
   char *pa, *fc;
 
   dtrace("%i, %p, %i, %p, %i, %x, %i, %x, %p", *dirfile, parent, *parent_l,
       field_code, *field_code_l, *const_type, *array_len, *data_type, value);
 
-  pa = (char *)malloc(*parent_l + 1);
-  fc = (char *)malloc(*field_code_l + 1);
-
-  gd_madd_carray(_GDF_GetDirfile(*dirfile), _GDF_CString(pa, parent,
-        *parent_l), _GDF_CString(fc, field_code, *field_code_l),
+  gd_madd_carray(_GDF_GetDirfile(*dirfile), _GDF_CString(&pa, parent,
+        *parent_l), _GDF_CString(&fc, field_code, *field_code_l),
       (gd_type_t)*const_type, *array_len, (gd_type_t)*data_type, value);
 
   free(pa);
@@ -1847,75 +2029,85 @@ void F77_FUNC(gdmdca, GDMDCA) (const int *dirfile, const char *parent,
 }
 
 /* gd_add_string wrapper */
-void F77_FUNC(gdadst, GDADST) (const int* dirfile, const char* field_code,
-    const int* field_code_l, const char* value, const int* value_l,
-    const int* fragment_index)
+void F77_FUNC(gdadst, GDADST) (const int32_t *dirfile, const char *field_code,
+    const int32_t *field_code_l, const char *value, const int32_t *value_l,
+    const int32_t *fragment_index)
 {
-  char* fc = (char *)malloc(*field_code_l + 1);
-  char* va = (char *)malloc(*value_l + 1);
+  char *fc, *va;
+
+  dtrace("%i, %p, %i, %p, %i, %i", *dirfile, field_code, *field_code_l, value,
+      *value_l, *fragment_index);
 
-  gd_add_string(_GDF_GetDirfile(*dirfile), _GDF_CString(fc, field_code,
-        *field_code_l), _GDF_CString(va, value, *value_l), *fragment_index);
+  gd_add_string(_GDF_GetDirfile(*dirfile), _GDF_CString(&fc, field_code,
+        *field_code_l), _GDF_CString(&va, value, *value_l), *fragment_index);
 
   free(fc);
   free(va);
+  dreturnvoid();
 }
 
 /* gd_madd_string wrapper */
-void F77_FUNC(gdmdst, GDMDST) (const int* dirfile, const char* parent,
-    const int* parent_l, const char* field_code, const int* field_code_l,
-    const char* value, const int* value_l)
+void F77_FUNC(gdmdst, GDMDST) (const int32_t *dirfile, const char *parent,
+    const int32_t *parent_l, const char *field_code,
+    const int32_t *field_code_l, const char *value, const int32_t *value_l)
 {
-  char* pa = (char *)malloc(*parent_l + 1);
-  char* fc = (char *)malloc(*field_code_l + 1);
-  char* va = (char *)malloc(*value_l + 1);
+  char *pa, *fc, *va;
+
+  dtrace("%i, %p, %i, %p, %i, %p, %i", *dirfile, parent, *parent_l, field_code,
+      *field_code_l, value, *value_l);
 
-  gd_madd_string(_GDF_GetDirfile(*dirfile), _GDF_CString(pa, parent,
-        *parent_l), _GDF_CString(fc, field_code, *field_code_l),
-      _GDF_CString(va, value, *value_l));
+  gd_madd_string(_GDF_GetDirfile(*dirfile), _GDF_CString(&pa, parent,
+        *parent_l), _GDF_CString(&fc, field_code, *field_code_l),
+      _GDF_CString(&va, value, *value_l));
 
   free(pa);
   free(fc);
   free(va);
+  dreturnvoid();
 }
 
 /* gd_add_spec wrapper */
-void F77_FUNC(gdadsp, GDADSP) (const int* dirfile, const char* spec,
-    const int* spec_l, const int* fragment_index)
+void F77_FUNC(gdadsp, GDADSP) (const int32_t *dirfile, const char *spec,
+    const int32_t *spec_l, const int32_t *fragment_index)
 {
-  char* sp = (char *)malloc(*spec_l + 1);
+  char *sp;
+
+  dtrace("%i, %p, %i, %i", *dirfile, spec, *spec_l, *fragment_index);
 
-  gd_add_spec(_GDF_GetDirfile(*dirfile), _GDF_CString(sp, spec, *spec_l),
+  gd_add_spec(_GDF_GetDirfile(*dirfile), _GDF_CString(&sp, spec, *spec_l),
       *fragment_index);
 
   free(sp);
+  dreturnvoid();
 }
 
 /* gd_madd_spec wrapper */
-void F77_FUNC(gdmdsp, GDMDSP) (const int* dirfile, const char* spec,
-    const int* spec_l, const char *parent, const int* parent_l)
+void F77_FUNC(gdmdsp, GDMDSP) (const int32_t *dirfile, const char *spec,
+    const int32_t *spec_l, const char *parent, const int32_t *parent_l)
 {
-  char* pa = (char *)malloc(*parent_l + 1);
-  char* sp = (char *)malloc(*spec_l + 1);
+  char *pa, *sp;
+
+  dtrace("%i, %p, %i, %p, %i", *dirfile, spec, *spec_l, parent, *parent_l);
 
-  gd_madd_spec(_GDF_GetDirfile(*dirfile), _GDF_CString(sp, spec,
-        *spec_l), _GDF_CString(pa, parent, *parent_l));
+  gd_madd_spec(_GDF_GetDirfile(*dirfile), _GDF_CString(&sp, spec,
+        *spec_l), _GDF_CString(&pa, parent, *parent_l));
 
   free(pa);
   free(sp);
+
+  dreturnvoid();
 }
 
 /* gd_get_constant wrapper */
-void F77_FUNC(gdgtco, GDGTCO) (const int *dirfile, const char *field_code,
-    const int *field_code_l, const int *return_type, void *data_out)
+void F77_FUNC(gdgtco, GDGTCO) (const int32_t *dirfile, const char *field_code,
+    const int32_t *field_code_l, const int32_t *return_type, void *data_out)
 {
   char *fc;
 
   dtrace("%i, %p, %i, %i, %p", *dirfile, field_code, *field_code_l,
       *return_type, data_out);
 
-  fc = (char *)malloc(*field_code_l + 1);
-  gd_get_constant(_GDF_GetDirfile(*dirfile), _GDF_CString(fc, field_code,
+  gd_get_constant(_GDF_GetDirfile(*dirfile), _GDF_CString(&fc, field_code,
         *field_code_l), (gd_type_t)*return_type, data_out);
   free(fc);
 
@@ -1923,16 +2115,15 @@ void F77_FUNC(gdgtco, GDGTCO) (const int *dirfile, const char *field_code,
 }
 
 /* gd_get_carray wrapper */
-void F77_FUNC(gdgtca, GDGTCA) (const int *dirfile, const char *field_code,
-    const int *field_code_l, const int *return_type, void *data_out)
+void F77_FUNC(gdgtca, GDGTCA) (const int32_t *dirfile, const char *field_code,
+    const int32_t *field_code_l, const int32_t *return_type, void *data_out)
 {
   char *fc;
 
   dtrace("%i, %p, %i, %x, %p", *dirfile, field_code, *field_code_l,
       *return_type, data_out);
 
-  fc = (char *)malloc(*field_code_l + 1);
-  gd_get_carray(_GDF_GetDirfile(*dirfile), _GDF_CString(fc, field_code,
+  gd_get_carray(_GDF_GetDirfile(*dirfile), _GDF_CString(&fc, field_code,
         *field_code_l), (gd_type_t)*return_type, data_out);
   free(fc);
 
@@ -1940,17 +2131,16 @@ void F77_FUNC(gdgtca, GDGTCA) (const int *dirfile, const char *field_code,
 }
 
 /* gd_get_carray_slice wrapper */
-void F77_FUNC(gdgcas, GDGCAS) (const int *dirfile, const char *field_code,
-    const int *field_code_l, const int *start, const int *n,
-    const int *return_type, void *data_out)
+void F77_FUNC(gdgcas, GDGCAS) (const int32_t *dirfile, const char *field_code,
+    const int32_t *field_code_l, const int32_t *start, const int32_t *n,
+    const int32_t *return_type, void *data_out)
 {
   char *fc;
 
   dtrace("%i, %p, %i, %i, %i, %x, %p", *dirfile, field_code, *field_code_l,
       *start, *n, *return_type, data_out);
 
-  fc = (char *)malloc(*field_code_l + 1);
-  gd_get_carray_slice(_GDF_GetDirfile(*dirfile), _GDF_CString(fc, field_code,
+  gd_get_carray_slice(_GDF_GetDirfile(*dirfile), _GDF_CString(&fc, field_code,
         *field_code_l), *start - 1, (size_t)*n, (gd_type_t)*return_type,
       data_out);
   free(fc);
@@ -1959,15 +2149,14 @@ void F77_FUNC(gdgcas, GDGCAS) (const int *dirfile, const char *field_code,
 }
 
 /* gd_carray_len wrapper */
-void F77_FUNC(gdcaln, GDCALN) (int *len, const int *dirfile,
-    const char *field_code, const int *field_code_l)
+void F77_FUNC(gdcaln, GDCALN) (int32_t *len, const int32_t *dirfile,
+    const char *field_code, const int32_t *field_code_l)
 {
   char *fc;
 
   dtrace("%p, %i, %p, %i", len, *dirfile, field_code, *field_code_l);
 
-  fc = (char *)malloc(*field_code_l + 1);
-  *len = gd_carray_len(_GDF_GetDirfile(*dirfile), _GDF_CString(fc, field_code,
+  *len = gd_carray_len(_GDF_GetDirfile(*dirfile), _GDF_CString(&fc, field_code,
         *field_code_l));
   free(fc);
 
@@ -1975,33 +2164,38 @@ void F77_FUNC(gdcaln, GDCALN) (int *len, const int *dirfile,
 }
 
 /* gd_get_string wrapper */
-void F77_FUNC(gdgtst, GDGTST) (int *size, const int *dirfile,
-    const char *field_code, const int *field_code_l, const int *len,
+void F77_FUNC(gdgtst, GDGTST) (int32_t *size, const int32_t *dirfile,
+    const char *field_code, const int32_t *field_code_l, const int32_t *len,
     char *data_out)
 {
-  char *fc = (char *)malloc(*field_code_l + 1);
-  char *out = (char *)malloc(*len + 1);
+  char *fc, *out;
   int l = *len;
 
-  *size = gd_get_string(_GDF_GetDirfile(*dirfile), _GDF_CString(fc, field_code,
-      *field_code_l), (size_t)*len, out) - 1;
+  dtrace("%p, %i, %p, %i, %i, %p", size, *dirfile, field_code, *field_code_l,
+      *len, data_out);
+
+  out = (char*)malloc(l + 1);
+
+  *size = gd_get_string(_GDF_GetDirfile(*dirfile), _GDF_CString(&fc, field_code,
+        *field_code_l), (size_t)*len, out) - 1;
 
   _GDF_FString(data_out, &l, out);
   free(fc);
   free(out);
+
+  dreturn("%i", *size);
 }
 
 /* gd_put_constant wrapper */
-void F77_FUNC(gdptco, GDPTCO) (const int *dirfile, const char *field_code,
-    const int *field_code_l, const int *data_type, const void *data_in)
+void F77_FUNC(gdptco, GDPTCO) (const int32_t *dirfile, const char *field_code,
+    const int32_t *field_code_l, const int32_t *data_type, const void *data_in)
 {
   char *fc;
 
   dtrace("%i, %p, %i, %x, %p", *dirfile, field_code, *field_code_l, *data_type,
       data_in);
 
-  fc = (char *)malloc(*field_code_l + 1);
-  gd_put_constant(_GDF_GetDirfile(*dirfile), _GDF_CString(fc, field_code,
+  gd_put_constant(_GDF_GetDirfile(*dirfile), _GDF_CString(&fc, field_code,
         *field_code_l), (gd_type_t)*data_type, data_in);
   free(fc);
 
@@ -2009,16 +2203,15 @@ void F77_FUNC(gdptco, GDPTCO) (const int *dirfile, const char *field_code,
 }
 
 /* gd_put_carray wrapper */
-void F77_FUNC(gdptca, GDPTCA) (const int *dirfile, const char *field_code,
-    const int *field_code_l, const int *data_type, const void *data_in)
+void F77_FUNC(gdptca, GDPTCA) (const int32_t *dirfile, const char *field_code,
+    const int32_t *field_code_l, const int32_t *data_type, const void *data_in)
 {
   char *fc;
 
   dtrace("%i, %p, %i, %x, %p", *dirfile, field_code, *field_code_l, *data_type,
       data_in);
 
-  fc = (char *)malloc(*field_code_l + 1);
-  gd_put_carray(_GDF_GetDirfile(*dirfile), _GDF_CString(fc, field_code,
+  gd_put_carray(_GDF_GetDirfile(*dirfile), _GDF_CString(&fc, field_code,
         *field_code_l), (gd_type_t)*data_type, data_in);
   free(fc);
 
@@ -2026,17 +2219,16 @@ void F77_FUNC(gdptca, GDPTCA) (const int *dirfile, const char *field_code,
 }
 
 /* gd_put_carray_slice wrapper */
-void F77_FUNC(gdpcas, GDPCAS) (const int *dirfile, const char *field_code,
-    const int *field_code_l, const int *start, const int *n,
-    const int *data_type, const void *data_in)
+void F77_FUNC(gdpcas, GDPCAS) (const int32_t *dirfile, const char *field_code,
+    const int32_t *field_code_l, const int32_t *start, const int32_t *n,
+    const int32_t *data_type, const void *data_in)
 {
   char *fc;
 
   dtrace("%i, %p, %i, %i, %i, %x, %p", *dirfile, field_code, *field_code_l,
       *start, *n, *data_type, data_in);
 
-  fc = (char *)malloc(*field_code_l + 1);
-  gd_put_carray_slice(_GDF_GetDirfile(*dirfile), _GDF_CString(fc, field_code,
+  gd_put_carray_slice(_GDF_GetDirfile(*dirfile), _GDF_CString(&fc, field_code,
         *field_code_l), *start - 1, (size_t)*n, (gd_type_t)*data_type, data_in);
   free(fc);
 
@@ -2044,50 +2236,65 @@ void F77_FUNC(gdpcas, GDPCAS) (const int *dirfile, const char *field_code,
 }
 
 /* gd_put_string wrapper */
-void F77_FUNC(gdptst, GDPTST) (int* n_wrote, const int* dirfile,
-    const char* field_code, const int* field_code_l, const int* len,
-    const char* data_in)
+void F77_FUNC(gdptst, GDPTST) (int32_t *n_wrote, const int32_t *dirfile,
+    const char *field_code, const int32_t *field_code_l, const int32_t *len,
+    const char *data_in)
 {
-  char* fc = (char *)malloc(*field_code_l + 1);
-  char* in = (char *)malloc(*len + 1);
-  *n_wrote = gd_put_string(_GDF_GetDirfile(*dirfile), _GDF_CString(fc,
-        field_code, *field_code_l), _GDF_CString(in, data_in, *len)) - 1;
+  char *fc, *in;
+  dtrace("%p, %i, %p, %i, %i, %p", n_wrote, *dirfile, field_code, *field_code_l,
+      *len, data_in);
+
+  *n_wrote = gd_put_string(_GDF_GetDirfile(*dirfile), _GDF_CString(&fc,
+        field_code, *field_code_l), _GDF_CString(&in, data_in, *len)) - 1;
   free(fc);
   free(in);
+  dreturn("%i", *n_wrote);
 }
 
 /* gd_nmfields wrapper */
-void F77_FUNC(gdnmfd, GDNMFD) (int* nfields, const int* dirfile,
-    const char* parent, const int* parent_l)
+void F77_FUNC(gdnmfd, GDNMFD) (int32_t *nfields, const int32_t *dirfile,
+    const char *parent, const int32_t *parent_l)
 {
-  char* pa = (char *)malloc(*parent_l + 1);
-  *nfields = gd_nmfields(_GDF_GetDirfile(*dirfile), _GDF_CString(pa, parent,
+  char *pa;
+  dtrace("%p, %i, %p, %i", nfields, *dirfile, parent, *parent_l);
+
+  *nfields = gd_nmfields(_GDF_GetDirfile(*dirfile), _GDF_CString(&pa, parent,
         *parent_l));
   free(pa);
+  dreturn("%i", *nfields);
 }
 
 /* gd_nmfields_by_type wrapper */
-void F77_FUNC(gdnmft, GDNMFT) (int* nfields, const int* dirfile,
-    const char* parent, const int* parent_l, const int* type)
+void F77_FUNC(gdnmft, GDNMFT) (int32_t *nfields, const int32_t *dirfile,
+    const char *parent, const int32_t *parent_l, const int32_t *type)
 {
-  char* pa = (char *)malloc(*parent_l + 1);
-  *nfields = gd_nmfields_by_type(_GDF_GetDirfile(*dirfile), _GDF_CString(pa,
+  char *pa;
+  dtrace("%p, %i, %p, %i, 0x%x", nfields, *dirfile, parent, *parent_l, *type);
+
+  *nfields = gd_nmfields_by_type(_GDF_GetDirfile(*dirfile), _GDF_CString(&pa,
         parent, *parent_l), (gd_entype_t)*type);
   free(pa);
+
+  dreturn("%i", *nfields);
 }
 
 /* gd_nmvectors wrapper */
-void F77_FUNC(gdnmve, GDNMVE) (int* nvectors, const int* dirfile,
-    const char* parent, const int* parent_l)
+void F77_FUNC(gdnmve, GDNMVE) (int32_t *nvectors, const int32_t *dirfile,
+    const char *parent, const int32_t *parent_l)
 {
-  char* pa = (char *)malloc(*parent_l + 1);
-  *nvectors = gd_nmvectors(_GDF_GetDirfile(*dirfile), _GDF_CString(pa, parent,
+  char *pa;
+
+  dtrace("%p, %i, %p, %i", nvectors, *dirfile, parent, *parent_l);
+
+  *nvectors = gd_nmvectors(_GDF_GetDirfile(*dirfile), _GDF_CString(&pa, parent,
         *parent_l));
   free(pa);
+
+  dreturn("%i", *nvectors);
 }
 
 /* gd_discard wrapper */
-void F77_FUNC(gddscd, GDDSCD) (const int* dirfile)
+void F77_FUNC(gddscd, GDDSCD) (const int32_t *dirfile)
 {
   dtrace("%i", *dirfile);
 
@@ -2101,91 +2308,134 @@ void F77_FUNC(gddscd, GDDSCD) (const int* dirfile)
 }
 
 /* gd_cbopen wrapper */
-void F77_FUNC(gdcopn, GDCOPN) (int* dirfile, const char* dirfilename,
-    const int* dirfilename_l, const int* flags, const void* callback)
+void F77_FUNC(gdcopn, GDCOPN) (int32_t *dirfile, const char *dirfilename,
+    const int32_t *dirfilename_l, const int32_t *flags,
+    const _GDF_callback_t callback)
 {
+  const struct _GDF_callback_container temp = { callback };
+  DIRFILE *D;
   char *out;
 
   dtrace("%p, %p, %i, %x, %p", dirfile, dirfilename, *dirfilename_l, *flags,
       callback);
 
-  out = (char *)malloc(*dirfilename_l + 1);
+  _GDF_CString(&out, dirfilename, *dirfilename_l);
 
-  *dirfile = _GDF_SetDirfile(gd_cbopen(_GDF_CString(out, dirfilename,
-          *dirfilename_l), *flags, (callback == 0) ? NULL : _GDF_Callback,
-        (callback == 0) ? NULL : (void*)callback));
+  D = gd_cbopen(out, *flags, _GDF_Callback, (void*)&temp);
+  *dirfile = _GDF_SetDirfile(D);
+
+  /* save the callback */
+  f77callbacks[*dirfile].func = callback;
+  /* and tell getdata its new location */
+  gd_parser_callback(D, _GDF_Callback, f77callbacks + *dirfile);
 
   free(out);
   dreturn("%i", *dirfile);
 }
 
 /* gd_parser_callback wrapper */
-void F77_FUNC(gdclbk, GDCLBK) (const int* dirfile, const void* callback)
+void F77_FUNC(gdclbk, GDCLBK) (const int32_t *dirfile,
+    const _GDF_callback_t callback)
 {
   dtrace("%i, %p", *dirfile, callback);
 
-  gd_parser_callback(_GDF_GetDirfile(*dirfile), (callback == 0) ? NULL
-      : _GDF_Callback, (callback == 0) ?  NULL : (void*)callback);
+  /* ensure *dirfile is sane */
+  if (*dirfile < 0 || *dirfile >= GDF_N_DIRFILES) {
+    dreturnvoid();
+    return;
+  }
+
+  /* we only have to modify GetData's callback pointer if f77callbacks is
+   * NULL for this dirfile (inidicating no previous callback); otherwise, just
+   * update the saved callback pointer */
+  if (f77callbacks[*dirfile].func == NULL) {
+    f77callbacks[*dirfile].func = callback;
+    gd_parser_callback(_GDF_GetDirfile(*dirfile), _GDF_Callback,
+        f77callbacks + *dirfile);
+  } else
+    f77callbacks[*dirfile].func = callback;
+
+  dreturnvoid();
+}
+
+/* deregister a callback function (ie. gd_parser_callback(..., NULL) */
+void F77_FUNC(gdnocb, GDNOCB) (const int32_t *dirfile)
+{
+  dtrace("%i", *dirfile);
+
+  /* ensure *dirfile is sane */
+  if (*dirfile >= 0 && *dirfile < GDF_N_DIRFILES) {
+    f77callbacks[*dirfile].func = NULL;
+    gd_parser_callback(_GDF_GetDirfile(*dirfile), NULL, NULL);
+  }
 
   dreturnvoid();
 }
 
 /* gd_alter_bit wrapper */
-void F77_FUNC(gdalbt, GDALBT) (const int* dirfile, const char* field_code,
-    const int* field_code_l, const char* in_field, const int* in_field_l,
-    int* bitnum, int* numbits)
+void F77_FUNC(gdalbt, GDALBT) (const int32_t *dirfile, const char *field_code,
+    const int32_t *field_code_l, const char *in_field,
+    const int32_t *in_field_l, const int32_t *bitnum, const int32_t *numbits)
 {
-  char* fc = (char *)malloc(*field_code_l + 1);
-  char* in = (char *)malloc(*in_field_l + 1);
+  char *fc, *in;
+
+  dtrace("%i, %p, %i, %p, %i, %i, %i", *dirfile, field_code, *field_code_l,
+      in_field, *in_field_l, *bitnum, *numbits);
 
-  gd_alter_bit(_GDF_GetDirfile(*dirfile), _GDF_CString(fc, field_code,
-        *field_code_l), _GDF_CString(in, in_field, *in_field_l),
-      (gd_bit_t)*bitnum, (gd_bit_t)*numbits);
+  gd_alter_bit(_GDF_GetDirfile(*dirfile), _GDF_CString(&fc, field_code,
+        *field_code_l), _GDF_CString(&in, in_field, *in_field_l), *bitnum,
+      *numbits);
 
   free(fc);
   free(in);
+  dreturnvoid();
 }
 
 /* gd_alter_sbit wrapper */
-void F77_FUNC(gdalsb, GDALSB) (const int* dirfile, const char* field_code,
-    const int* field_code_l, const char* in_field, const int* in_field_l,
-    int* bitnum, int* numbits)
+void F77_FUNC(gdalsb, GDALSB) (const int32_t *dirfile, const char *field_code,
+    const int32_t *field_code_l, const char *in_field,
+    const int32_t *in_field_l, const int32_t *bitnum, const int32_t *numbits)
 {
-  char* fc = (char *)malloc(*field_code_l + 1);
-  char* in = (char *)malloc(*in_field_l + 1);
+  char *fc, *in;
 
-  gd_alter_sbit(_GDF_GetDirfile(*dirfile), _GDF_CString(fc, field_code,
-        *field_code_l), _GDF_CString(in, in_field, *in_field_l),
-      (gd_bit_t)*bitnum, (gd_bit_t)*numbits);
+  dtrace("%i, %p, %i, %p, %i, %i, %i", *dirfile, field_code, *field_code_l,
+      in_field, *in_field_l, *bitnum, *numbits);
+
+  gd_alter_sbit(_GDF_GetDirfile(*dirfile), _GDF_CString(&fc, field_code,
+        *field_code_l), _GDF_CString(&in, in_field, *in_field_l), *bitnum,
+      *numbits);
 
   free(fc);
   free(in);
+  dreturnvoid();
 }
 
 /* gd_alter_const wrapper */
-void F77_FUNC(gdalco, GDALCO) (const int* dirfile, const char* field_code,
-    const int* field_code_l, const int* const_type)
+void F77_FUNC(gdalco, GDALCO) (const int32_t *dirfile, const char *field_code,
+    const int32_t *field_code_l, const int32_t *const_type)
 {
-  char* fc = (char *)malloc(*field_code_l + 1);
+  char *fc;
+
+  dtrace("%i, %p, %i, %i", *dirfile, field_code, *field_code_l, *const_type);
 
-  gd_alter_const(_GDF_GetDirfile(*dirfile), _GDF_CString(fc, field_code,
+  gd_alter_const(_GDF_GetDirfile(*dirfile), _GDF_CString(&fc, field_code,
         *field_code_l), (gd_type_t)*const_type);
 
   free(fc);
+  dreturnvoid();
 }
 
 /* gd_alter_carray wrapper */
-void F77_FUNC(gdalca, GDALCA) (const int* dirfile, const char* field_code,
-    const int* field_code_l, const int* const_type, const int *array_len)
+void F77_FUNC(gdalca, GDALCA) (const int32_t *dirfile, const char *field_code,
+    const int32_t *field_code_l, const int32_t *const_type,
+    const int32_t *array_len)
 {
   char *fc;
 
   dtrace("%i, %p, %i, %x, %i", *dirfile, field_code, *field_code_l, *const_type,
       *array_len);
 
-  fc = (char *)malloc(*field_code_l + 1);
-
-  gd_alter_carray(_GDF_GetDirfile(*dirfile), _GDF_CString(fc, field_code,
+  gd_alter_carray(_GDF_GetDirfile(*dirfile), _GDF_CString(&fc, field_code,
         *field_code_l), (gd_type_t)*const_type, (size_t)*array_len);
 
   free(fc);
@@ -2193,58 +2443,61 @@ void F77_FUNC(gdalca, GDALCA) (const int* dirfile, const char* field_code,
 }
 
 /* gd_alter_lincom wrapper */
-void F77_FUNC(gdallc, GDALLC) (const int* dirfile, const char* field_code,
-    const int* field_code_l, const int* n_fields, const char* in_field1,
-    const int* in_field1_l, const double* m1, const double* b1,
-    const char* in_field2, const int* in_field2_l, const double* m2,
-    const double* b2, const char* in_field3, const int* in_field3_l,
-    const double* m3, const double* b3)
-{
-  char* fc = (char *)malloc(*field_code_l + 1);
-  char* in_fields[3] = {NULL, NULL, NULL};
+void F77_FUNC(gdallc, GDALLC) (const int32_t *dirfile, const char *field_code,
+    const int32_t *field_code_l, const int32_t *n_fields, const char *in_field1,
+    const int32_t *in_field1_l, const double *m1, const double *b1,
+    const char *in_field2, const int32_t *in_field2_l, const double *m2,
+    const double *b2, const char *in_field3, const int32_t *in_field3_l,
+    const double *m3, const double *b3)
+{
+  char *fc = NULL;
+  char *in_fields[3] = {NULL, NULL, NULL};
   double m[3] = {0, 0, 0};
   double b[3] = {0, 0, 0};
-  int nf = *n_fields;
+  const int nf = *n_fields;
+
+  dtrace("%i, %p, %i, %i, %p, %i, %g, %g, %p, %i, %g, %g, %p, %i, %g, %g",
+      *dirfile, field_code, *field_code_l, *n_fields, in_field1, *in_field1_l,
+      *m1, *b1, in_field2, *in_field2_l, *m2, *b2, in_field3, *in_field3_l, *m3,
+      *b3);
 
   if (nf > 0) {
-    in_fields[0] = (char *)malloc(*in_field1_l + 1);
-    _GDF_CString(in_fields[0], in_field1, *in_field1_l);
+    _GDF_CString(in_fields, in_field1, *in_field1_l);
     m[0] = *m1;
     b[0] = *b1;
   }
 
   if (nf > 1) {
-    in_fields[1] = (char *)malloc(*in_field2_l + 1);
-    _GDF_CString(in_fields[1], in_field2, *in_field2_l);
+    _GDF_CString(in_fields + 1, in_field2, *in_field2_l);
     m[1] = *m2;
     b[1] = *b2;
   }
 
   if (nf > 2) {
-    in_fields[2] = (char *)malloc(*in_field3_l + 1);
-    _GDF_CString(in_fields[2], in_field3, *in_field3_l);
+    _GDF_CString(in_fields + 2, in_field3, *in_field3_l);
     m[2] = *m3;
     b[2] = *b3;
   }
 
-  gd_alter_lincom(_GDF_GetDirfile(*dirfile), _GDF_CString(fc, field_code,
+  gd_alter_lincom(_GDF_GetDirfile(*dirfile), _GDF_CString(&fc, field_code,
         *field_code_l), nf, (const char**)in_fields, m, b);
   free(fc);
   free(in_fields[0]);
   free(in_fields[1]);
   free(in_fields[2]);
+  dreturnvoid();
 }
 
 /* gd_alter_clincom wrapper */
-void F77_FUNC(gdalcl, GDALCL) (const int* dirfile, const char* field_code,
-    const int* field_code_l, const int* n_fields, const char* in_field1,
-    const int* in_field1_l, const GD_DCOMPLEXP(m1), const GD_DCOMPLEXP(b1),
-    const char* in_field2, const int* in_field2_l, const GD_DCOMPLEXP(m2),
-    const GD_DCOMPLEXP(b2), const char* in_field3, const int* in_field3_l,
+void F77_FUNC(gdalcl, GDALCL) (const int32_t *dirfile, const char *field_code,
+    const int32_t *field_code_l, const int32_t *n_fields, const char *in_field1,
+    const int32_t *in_field1_l, const GD_DCOMPLEXP(m1), const GD_DCOMPLEXP(b1),
+    const char *in_field2, const int32_t *in_field2_l, const GD_DCOMPLEXP(m2),
+    const GD_DCOMPLEXP(b2), const char *in_field3, const int32_t *in_field3_l,
     const GD_DCOMPLEXP(m3), const GD_DCOMPLEXP(b3))
 {
-  char* fc = (char *)malloc(*field_code_l + 1);
-  char* in_fields[3] = {NULL, NULL, NULL};
+  char *fc;
+  char *in_fields[3] = {NULL, NULL, NULL};
 #ifdef GD_NO_C99_API
   double cm[6] = {0, 0, 0, 0, 0, 0};
   double cb[6] = {0, 0, 0, 0, 0, 0};
@@ -2252,52 +2505,54 @@ void F77_FUNC(gdalcl, GDALCL) (const int* dirfile, const char* field_code,
   double complex cm[3] = {0, 0, 0};
   double complex cb[3] = {0, 0, 0};
 #endif
-  int nf = *n_fields;
+  const int nf = *n_fields;
+
+  dtrace("%i, %p, %i, %i, %p, %i, %p, %p, %p, %i, %p, %p, %p, %i, %p, %p",
+      *dirfile, field_code, *field_code_l, *n_fields, in_field1, *in_field1_l,
+      m1, b1, in_field2, *in_field2_l, m2, b2, in_field3, *in_field3_l, m3, b3);
 
   if (nf > 0) {
-    in_fields[0] = (char *)malloc(*in_field1_l + 1);
-    _GDF_CString(in_fields[0], in_field1, *in_field1_l);
-    _gd_cp2ca(cm, 0, m1);
-    _gd_cp2ca(cb, 0, b1);
+    _GDF_CString(in_fields, in_field1, *in_field1_l);
+    gd_cp2ca_(cm, 0, m1);
+    gd_cp2ca_(cb, 0, b1);
   }
 
   if (nf > 1) {
-    in_fields[1] = (char *)malloc(*in_field2_l + 1);
-    _GDF_CString(in_fields[1], in_field2, *in_field2_l);
-    _gd_cp2ca(cm, 1, m2);
-    _gd_cp2ca(cb, 1, b2);
+    _GDF_CString(in_fields + 1, in_field2, *in_field2_l);
+    gd_cp2ca_(cm, 1, m2);
+    gd_cp2ca_(cb, 1, b2);
   }
 
   if (nf > 2) {
-    in_fields[2] = (char *)malloc(*in_field3_l + 1);
-    _GDF_CString(in_fields[2], in_field3, *in_field3_l);
-    _gd_cp2ca(cm, 2, m3);
-    _gd_cp2ca(cb, 2, b3);
+    _GDF_CString(in_fields + 2, in_field3, *in_field3_l);
+    gd_cp2ca_(cm, 2, m3);
+    gd_cp2ca_(cb, 2, b3);
   }
 
-  gd_alter_clincom(_GDF_GetDirfile(*dirfile), _GDF_CString(fc, field_code,
+  gd_alter_clincom(_GDF_GetDirfile(*dirfile), _GDF_CString(&fc, field_code,
         *field_code_l), nf, (const char**)in_fields, cm, cb);
   free(fc);
   free(in_fields[0]);
   free(in_fields[1]);
   free(in_fields[2]);
+  dreturnvoid();
 }
 
 /* gd_alter_polynom wrapper */
-void F77_FUNC(gdalpn, GDALPN) (const int* dirfile, const char* field_code,
-    const int* field_code_l, const int* poly_ord, const char* in_field,
-    const int* in_field_l, const double* a0, const double* a1, const double* a2,
-    const double* a3, const double* a4, const double* a5)
+void F77_FUNC(gdalpn, GDALPN) (const int32_t *dirfile, const char *field_code,
+    const int32_t *field_code_l, const int32_t *poly_ord, const char *in_field,
+    const int32_t *in_field_l, const double *a0, const double *a1,
+    const double *a2, const double *a3, const double *a4, const double *a5)
 {
-  char* fc = (char *)malloc(*field_code_l + 1);
-  char* inf = NULL;
+  char *fc, *inf;
   double a[6] = {0, 0, 0, 0, 0, 0};
-  int po = *poly_ord;
-  if (po > 5)
-    po = 5;
+  const int po = (*poly_ord > 5) ? 5 : *poly_ord;
+
+  dtrace("%i, %p, %i, %i, %p, %i, %g, %g, %p, %p, %p, %p", *dirfile, field_code,
+      *field_code_l, *poly_ord, in_field, *in_field_l, *a0, *a1, a2, a3, a4,
+      a5);
 
-  inf = (char *)malloc(*in_field_l + 1);
-  _GDF_CString(inf, in_field, *in_field_l);
+  _GDF_CString(&inf, in_field, *in_field_l);
 
   switch (po) {
     case 5:
@@ -2308,93 +2563,94 @@ void F77_FUNC(gdalpn, GDALPN) (const int* dirfile, const char* field_code,
       a[3] = *a3;
     case 2:
       a[2] = *a2;
-    case 1:
+    default:
       a[1] = *a1;
       a[0] = *a0;
   }
 
-  gd_alter_polynom(_GDF_GetDirfile(*dirfile), _GDF_CString(fc, field_code,
+  gd_alter_polynom(_GDF_GetDirfile(*dirfile), _GDF_CString(&fc, field_code,
         *field_code_l), po, inf, a);
   free(fc);
   free(inf);
+  dreturnvoid();
 }
 
 /* gd_alter_cpolynom wrapper */
-void F77_FUNC(gdalcp, GDALCP) (const int* dirfile, const char* field_code,
-    const int* field_code_l, const int* poly_ord, const char* in_field,
-    const int* in_field_l, const GD_DCOMPLEXP(a0), const GD_DCOMPLEXP(a1),
+void F77_FUNC(gdalcp, GDALCP) (const int32_t *dirfile, const char *field_code,
+    const int32_t *field_code_l, const int32_t *poly_ord, const char *in_field,
+    const int32_t *in_field_l, const GD_DCOMPLEXP(a0), const GD_DCOMPLEXP(a1),
     const GD_DCOMPLEXP(a2), const GD_DCOMPLEXP(a3),
     const GD_DCOMPLEXP(a4), const GD_DCOMPLEXP(a5))
 {
-  char* fc = (char *)malloc(*field_code_l + 1);
-  char* inf = NULL;
+  char *fc, *inf;
 #ifdef GD_NO_C99_API
   double ca[12] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
 #else
   double complex ca[6] = {0, 0, 0, 0, 0, 0};
 #endif
-  int po = *poly_ord;
-  if (po > 5)
-    po = 5;
+  const int po = (*poly_ord > 5) ? 5 : *poly_ord;
+
+  dtrace("%i, %p, %i, %i, %p, %i, %p, %p, %p, %p, %p, %p", *dirfile, field_code,
+      *field_code_l, *poly_ord, in_field, *in_field_l, a0, a1, a2, a3, a4, a5);
 
-  inf = (char *)malloc(*in_field_l + 1);
-  _GDF_CString(inf, in_field, *in_field_l);
+  _GDF_CString(&inf, in_field, *in_field_l);
 
   switch (po) {
     case 5:
-      _gd_cp2ca(ca, 5, a5);
+      gd_cp2ca_(ca, 5, a5);
     case 4:
-      _gd_cp2ca(ca, 4, a4);
+      gd_cp2ca_(ca, 4, a4);
     case 3:
-      _gd_cp2ca(ca, 3, a3);
+      gd_cp2ca_(ca, 3, a3);
     case 2:
-      _gd_cp2ca(ca, 2, a2);
-    case 1:
-      _gd_cp2ca(ca, 1, a1);
-      _gd_cp2ca(ca, 0, a0);
+      gd_cp2ca_(ca, 2, a2);
+    default:
+      gd_cp2ca_(ca, 1, a1);
+      gd_cp2ca_(ca, 0, a0);
   }
 
-  gd_alter_cpolynom(_GDF_GetDirfile(*dirfile), _GDF_CString(fc, field_code,
+  gd_alter_cpolynom(_GDF_GetDirfile(*dirfile), _GDF_CString(&fc, field_code,
         *field_code_l), po, inf, ca);
   free(fc);
   free(inf);
+  dreturnvoid();
 }
 
 /* gd_alter_multiply wrapper */
-void F77_FUNC(gdalmt, GDALMT) (const int* dirfile, const char* field_code,
-    const int* field_code_l, const char* in_field1, const int* in_field1_l,
-    const char* in_field2, const int* in_field2_l)
+void F77_FUNC(gdalmt, GDALMT) (const int32_t *dirfile, const char *field_code,
+    const int32_t *field_code_l, const char *in_field1,
+    const int32_t *in_field1_l, const char *in_field2,
+    const int32_t *in_field2_l)
 {
-  char* fc = (char *)malloc(*field_code_l + 1);
-  char* in1 = (char *)malloc(*in_field1_l + 1);
-  char* in2 = (char *)malloc(*in_field2_l + 1);
+  char *fc, *in1, *in2;
+
+  dtrace("%i, %p, %i, %p, %i, %p, %i", *dirfile, field_code, *field_code_l,
+      in_field1, *in_field1_l, in_field2, *in_field2_l);
 
-  gd_alter_multiply(_GDF_GetDirfile(*dirfile), _GDF_CString(fc, field_code,
-        *field_code_l), _GDF_CString(in1, in_field1, *in_field1_l),
-      _GDF_CString(in2, in_field2, *in_field2_l));
+  gd_alter_multiply(_GDF_GetDirfile(*dirfile), _GDF_CString(&fc, field_code,
+        *field_code_l), _GDF_CString(&in1, in_field1, *in_field1_l),
+      _GDF_CString(&in2, in_field2, *in_field2_l));
 
   free(fc);
   free(in1);
   free(in2);
+  dreturnvoid();
 }
 
 /* gd_alter_divide wrapper */
-void F77_FUNC(gdaldv, GDALDV) (const int* dirfile, const char* field_code,
-    const int* field_code_l, const char* in_field1, const int* in_field1_l,
-    const char* in_field2, const int* in_field2_l)
+void F77_FUNC(gdaldv, GDALDV) (const int32_t *dirfile, const char *field_code,
+    const int32_t *field_code_l, const char *in_field1,
+    const int32_t *in_field1_l, const char *in_field2,
+    const int32_t *in_field2_l)
 {
   char *fc, *in1, *in2;
 
-  dtrace("%i %p %i %p %i %p %i", *dirfile, field_code, *field_code_l,
+  dtrace("%i, %p, %i, %p, %i, %p, %i", *dirfile, field_code, *field_code_l,
       in_field1, *in_field1_l, in_field2, *in_field2_l);
 
-  fc = (char *)malloc(*field_code_l + 1);
-  in1 = (char *)malloc(*in_field1_l + 1);
-  in2 = (char *)malloc(*in_field2_l + 1);
-
-  gd_alter_divide(_GDF_GetDirfile(*dirfile), _GDF_CString(fc, field_code,
-        *field_code_l), _GDF_CString(in1, in_field1, *in_field1_l),
-      _GDF_CString(in2, in_field2, *in_field2_l));
+  gd_alter_divide(_GDF_GetDirfile(*dirfile), _GDF_CString(&fc, field_code,
+        *field_code_l), _GDF_CString(&in1, in_field1, *in_field1_l),
+      _GDF_CString(&in2, in_field2, *in_field2_l));
 
   free(fc);
   free(in1);
@@ -2404,20 +2660,17 @@ void F77_FUNC(gdaldv, GDALDV) (const int* dirfile, const char* field_code,
 }
 
 /* gd_alter_recip wrapper */
-void F77_FUNC(gdalrc, GDALRC) (const int* dirfile, const char* field_code,
-    const int* field_code_l, const char* in_field1, const int* in_field1_l,
-    const double* dividend)
+void F77_FUNC(gdalrc, GDALRC) (const int32_t *dirfile, const char *field_code,
+    const int32_t *field_code_l, const char *in_field1,
+    const int32_t *in_field1_l, const double *dividend)
 {
   char *fc, *in1;
 
   dtrace("%i, %p, %i, %p, %i, %g", *dirfile, field_code, *field_code_l,
       in_field1, *in_field1_l, *dividend);
 
-  fc = (char *)malloc(*field_code_l + 1);
-  in1 = (char *)malloc(*in_field1_l + 1);
-
-  gd_alter_recip(_GDF_GetDirfile(*dirfile), _GDF_CString(fc, field_code,
-        *field_code_l), _GDF_CString(in1, in_field1, *in_field1_l),
+  gd_alter_recip(_GDF_GetDirfile(*dirfile), _GDF_CString(&fc, field_code,
+        *field_code_l), _GDF_CString(&in1, in_field1, *in_field1_l),
       *dividend);
 
   free(fc);
@@ -2426,25 +2679,22 @@ void F77_FUNC(gdalrc, GDALRC) (const int* dirfile, const char* field_code,
   dreturnvoid();
 }
 
-void F77_FUNC(gdalcr, GDALCR) (const int* dirfile, const char* field_code,
-    const int* field_code_l, const char* in_field1, const int* in_field1_l,
-    const GD_DCOMPLEXP(cdividend))
+void F77_FUNC(gdalcr, GDALCR) (const int32_t *dirfile, const char *field_code,
+    const int32_t *field_code_l, const char *in_field1,
+    const int32_t *in_field1_l, const GD_DCOMPLEXP(cdividend))
 {
   char *fc, *in1;
 
   dtrace("%i, %p, %i, %p, %i, %g;%g", *dirfile, field_code, *field_code_l,
       in_field1, *in_field1_l, crealp(cdividend), cimagp(cdividend));
 
-  fc = (char *)malloc(*field_code_l + 1);
-  in1 = (char *)malloc(*in_field1_l + 1);
-
 #ifdef GD_NO_C99_API
-  gd_alter_crecip89(_GDF_GetDirfile(*dirfile), _GDF_CString(fc, field_code,
-        *field_code_l), _GDF_CString(in1, in_field1, *in_field1_l),
+  gd_alter_crecip89(_GDF_GetDirfile(*dirfile), _GDF_CString(&fc, field_code,
+        *field_code_l), _GDF_CString(&in1, in_field1, *in_field1_l),
       cdividend);
 #else
-  gd_alter_crecip(_GDF_GetDirfile(*dirfile), _GDF_CString(fc, field_code,
-        *field_code_l), _GDF_CString(in1, in_field1, *in_field1_l),
+  gd_alter_crecip(_GDF_GetDirfile(*dirfile), _GDF_CString(&fc, field_code,
+        *field_code_l), _GDF_CString(&in1, in_field1, *in_field1_l),
       *cdividend);
 #endif
 
@@ -2455,237 +2705,280 @@ void F77_FUNC(gdalcr, GDALCR) (const int* dirfile, const char* field_code,
 }
 
 /* gd_alter_phase wrapper */
-void F77_FUNC(gdalph, GDALPH) (const int* dirfile, const char* field_code,
-    const int* field_code_l, const char* in_field, const int* in_field_l,
-    const int* shift)
+void F77_FUNC(gdalph, GDALPH) (const int32_t *dirfile, const char *field_code,
+    const int32_t *field_code_l, const char *in_field,
+    const int32_t *in_field_l, const int32_t *shift)
 {
-  char* fc = (char *)malloc(*field_code_l + 1);
-  char* in = (char *)malloc(*in_field_l + 1);
+  char *fc, *in;
 
-  gd_alter_phase(_GDF_GetDirfile(*dirfile), _GDF_CString(fc, field_code,
-        *field_code_l), _GDF_CString(in, in_field, *in_field_l), *shift);
+  dtrace("%i, %p, %i, %p, %i, %i", *dirfile, field_code, *field_code_l,
+      in_field, *in_field_l, *shift);
+
+  gd_alter_phase(_GDF_GetDirfile(*dirfile), _GDF_CString(&fc, field_code,
+        *field_code_l), _GDF_CString(&in, in_field, *in_field_l), *shift);
 
   free(fc);
   free(in);
+  dreturnvoid();
 }
 
 /* gd_encoding wrapper */
-void F77_FUNC(gdgenc, GDGENC) (int* encoding, const int* dirfile,
-    const int* fragment)
+void F77_FUNC(gdgenc, GDGENC) (int32_t *encoding, const int32_t *dirfile,
+    const int32_t *fragment)
 {
   *encoding = gd_encoding(_GDF_GetDirfile(*dirfile), *fragment);
 }
 
 /* gd_endianness wrapper */
-void F77_FUNC(gdgend, GDGEND) (int* endianness, const int* dirfile,
-    const int* fragment)
+void F77_FUNC(gdgend, GDGEND) (int32_t *endianness, const int32_t *dirfile,
+    const int32_t *fragment)
 {
   *endianness = gd_endianness(_GDF_GetDirfile(*dirfile), *fragment);
 }
 
 /* dirfilename wrapper */
-void F77_FUNC(gdname, GDNAME) (char* name, int* name_l, const int* dirfile)
+void F77_FUNC(gdname, GDNAME) (char *name, int32_t *name_l,
+    const int32_t *dirfile)
 {
-  const char* dn = gd_dirfilename(_GDF_GetDirfile(*dirfile));
+  const char *dn = gd_dirfilename(_GDF_GetDirfile(*dirfile));
   _GDF_FString(name, name_l, dn);
 }
 
 /* gd_parent_fragment wrapper */
-void F77_FUNC(gdpfrg, GDPFRG) (int* parent, const int* dirfile,
-    const int* fragment)
+void F77_FUNC(gdpfrg, GDPFRG) (int32_t *parent, const int32_t *dirfile,
+    const int32_t *fragment)
 {
   *parent = gd_parent_fragment(_GDF_GetDirfile(*dirfile), *fragment);
 }
 
 /* gd_alter_protection wrapper */
-void F77_FUNC(gdaprt, GDAPRT) (const int* dirfile, const int* protection_level,
-    const int* fragment)
+void F77_FUNC(gdaprt, GDAPRT) (const int32_t *dirfile,
+    const int32_t *protection_level, const int32_t *fragment)
 {
   gd_alter_protection(_GDF_GetDirfile(*dirfile), *protection_level, *fragment);
 }
 
 /* gd_protection wrapper */
-void F77_FUNC(gdgprt, GDGPRT) (int* protection_level, const int* dirfile,
-    const int* fragment)
+void F77_FUNC(gdgprt, GDGPRT) (int32_t *protection_level,
+    const int32_t *dirfile, const int32_t *fragment)
 {
   *protection_level = gd_protection(_GDF_GetDirfile(*dirfile), *fragment);
 }
 
 /* gd_raw_filename wrapper */
-void F77_FUNC(gdrwfn, GDRWFN) (char* name, int* name_l, const int* dirfile,
-    const char* field_code, const int* field_code_l)
+void F77_FUNC(gdrwfn, GDRWFN) (char *name, int32_t *name_l,
+    const int32_t *dirfile, const char *field_code, const int32_t *field_code_l)
 {
-  char* fc = (char *)malloc(*field_code_l + 1);
+  char *fc, *fn;
 
-  const char* fn = gd_raw_filename(_GDF_GetDirfile(*dirfile), _GDF_CString(fc,
-        field_code, *field_code_l));
+  dtrace("%p, %i, %i, %p, %i", name, *name_l, *dirfile, field_code,
+      *field_code_l);
+
+  fn = gd_raw_filename(_GDF_GetDirfile(*dirfile), _GDF_CString(&fc, field_code,
+        *field_code_l));
 
   _GDF_FString(name, name_l, fn);
 
   free(fc);
+  free(fn);
+
+  dreturn("%i", *name_l);
 }
 
 /* gd_reference wrapper */
-void F77_FUNC(gdrefe, GDREFE) (char* name, int* name_l, const int* dirfile,
-    const char* field_code, const int *field_code_l)
+void F77_FUNC(gdrefe, GDREFE) (char *name, int32_t *name_l,
+    const int32_t *dirfile, const char *field_code, const int32_t *field_code_l)
 {
-  char* fc = (char *)malloc(*field_code_l + 1);
+  char *fc;
+  const char *ref;
 
-  const char* ref = gd_reference(_GDF_GetDirfile(*dirfile),
-      _GDF_CString(fc, field_code, *field_code_l));
+  dtrace("%p, %p, %i, %p, %i", name, name_l, *dirfile, field_code,
+      *field_code_l);
+
+  ref = gd_reference(_GDF_GetDirfile(*dirfile), _GDF_CString(&fc, field_code,
+        *field_code_l));
 
   _GDF_FString(name, name_l, ref);
 
   free(fc);
+  dreturn("%i", *name_l);
 }
 
 /* gd_alter_encoding wrapper */
-void F77_FUNC(gdaenc, GDAENC) (const int* dirfile, const int* encoding,
-    const int* fragment, const int* recode)
+void F77_FUNC(gdaenc, GDAENC) (const int32_t *dirfile, const int32_t *encoding,
+    const int32_t *fragment, const int32_t *recode)
 {
   gd_alter_encoding(_GDF_GetDirfile(*dirfile), *encoding, *fragment,
       *recode);
 }
 
 /* gd_alter_endianness wrapper */
-void F77_FUNC(gdaend, GDAEND) (const int* dirfile, const int* endianness,
-    const int* fragment, const int* recode)
+void F77_FUNC(gdaend, GDAEND) (const int32_t *dirfile,
+    const int32_t *endianness, const int32_t *fragment, const int32_t *recode)
 {
   gd_alter_endianness(_GDF_GetDirfile(*dirfile), *endianness, *fragment,
       *recode);
 }
 
 /* gd_alter_linterp wrapper */
-void F77_FUNC(gdallt, GDALLT) (const int* dirfile, const char* field_code,
-    const int* field_code_l, const char* in_field, const int* in_field_l,
-    const char* table, const int* table_l, const int* recode)
+void F77_FUNC(gdallt, GDALLT) (const int32_t *dirfile, const char *field_code,
+    const int32_t *field_code_l, const char *in_field,
+    const int32_t *in_field_l, const char *table, const int32_t *table_l,
+    const int32_t *recode)
 {
-  char* fc = (char *)malloc(*field_code_l + 1);
-  char* in = (char *)malloc(*in_field_l + 1);
-  char* tab = (char *)malloc(*table_l + 1);
+  char *fc, *in, *tab;
+
+  dtrace("%i, %p, %i, %p, %i, %p %i, %i", *dirfile, field_code, *field_code_l,
+      in_field, *in_field_l, table, *table_l, *recode);
 
-  gd_alter_linterp(_GDF_GetDirfile(*dirfile), _GDF_CString(fc, field_code,
-        *field_code_l), _GDF_CString(in, in_field, *in_field_l),
-      _GDF_CString(tab, table, *table_l), *recode);
+  gd_alter_linterp(_GDF_GetDirfile(*dirfile), _GDF_CString(&fc, field_code,
+        *field_code_l), _GDF_CString(&in, in_field, *in_field_l),
+      _GDF_CString(&tab, table, *table_l), *recode);
   free(fc);
   free(in);
   free(tab);
+  dreturnvoid();
 }
 
 /* gd_alter_raw wrapper */
-void F77_FUNC(gdalrw, GDALRW) (const int* dirfile, const char* field_code,
-    const int* field_code_l, const int* data_type, const int* spf,
-    const int* recode)
+void F77_FUNC(gdalrw, GDALRW) (const int32_t *dirfile, const char *field_code,
+    const int32_t *field_code_l, const int32_t *data_type, const int32_t *spf,
+    const int32_t *recode)
 {
-  char* out = (char *)malloc(*field_code_l + 1);
-  gd_alter_raw(_GDF_GetDirfile(*dirfile), _GDF_CString(out, field_code,
-        *field_code_l), (gd_type_t)(*data_type), (gd_spf_t)*spf, *recode);
+  char *out;
+
+  dtrace("%i, %p, %i, %i, %i, %i", *dirfile, field_code, *field_code_l,
+      *data_type, *spf, *recode);
+
+  gd_alter_raw(_GDF_GetDirfile(*dirfile), _GDF_CString(&out, field_code,
+        *field_code_l), (gd_type_t)(*data_type), (unsigned int)*spf, *recode);
   free(out);
+  dreturnvoid();
 }
 
 /* gd_alter_spec wrapper */
-void F77_FUNC(gdalsp, GDALSP) (const int* dirfile, const char* spec,
-    const int* spec_l, const int* move)
+void F77_FUNC(gdalsp, GDALSP) (const int32_t *dirfile, const char *spec,
+    const int32_t *spec_l, const int32_t *move)
 {
-  char* sp = (char *)malloc(*spec_l + 1);
+  char *sp;
+
+  dtrace("%i, %p, %i, %i", *dirfile, spec, *spec_l, *move);
 
-  gd_alter_spec(_GDF_GetDirfile(*dirfile), _GDF_CString(sp, spec, *spec_l),
+  gd_alter_spec(_GDF_GetDirfile(*dirfile), _GDF_CString(&sp, spec, *spec_l),
       *move);
 
   free(sp);
+  dreturnvoid();
 }
 
 /* gd_delete wrapper */
-void F77_FUNC(gddele, GDDELE) (const int* dirfile, const char* field_code,
-    const int* field_code_l, const int* flags)
+void F77_FUNC(gddele, GDDELE) (const int32_t *dirfile, const char *field_code,
+    const int32_t *field_code_l, const int32_t *flags)
 {
-  char* fc = (char *)malloc(*field_code_l + 1);
+  char *fc;
 
-  gd_delete(_GDF_GetDirfile(*dirfile), _GDF_CString(fc, field_code,
+  dtrace("%i, %p, %i, %i", *dirfile, field_code, *field_code_l, *flags);
+
+  gd_delete(_GDF_GetDirfile(*dirfile), _GDF_CString(&fc, field_code,
         *field_code_l), *flags);
 
   free(fc);
+  dreturnvoid();
 }
 
 /* gd_malter_spec wrapper */
-void F77_FUNC(gdmlsp, GDMLSP) (const int* dirfile, const char* spec,
-    const int* spec_l, const char* parent, const int* parent_l,
-    const int* move)
+void F77_FUNC(gdmlsp, GDMLSP) (const int32_t *dirfile, const char *spec,
+    const int32_t *spec_l, const char *parent, const int32_t *parent_l,
+    const int32_t *move)
 {
-  char* sp = (char *)malloc(*spec_l + 1);
-  char* pa = (char *)malloc(*parent_l + 1);
+  char *sp, *pa;
+
+  dtrace("%i, %p, %i, %p, %i, %i", *dirfile, spec, *spec_l, parent, *parent_l,
+      *move);
 
-  gd_malter_spec(_GDF_GetDirfile(*dirfile), _GDF_CString(sp, spec,
-        *spec_l), _GDF_CString(pa, parent, *parent_l), *move);
+  gd_malter_spec(_GDF_GetDirfile(*dirfile), _GDF_CString(&sp, spec,
+        *spec_l), _GDF_CString(&pa, parent, *parent_l), *move);
 
   free(pa);
   free(sp);
+  dreturnvoid();
 }
 
 /* gd_move wrapper */
-void F77_FUNC(gdmove, GDMOVE) (const int* dirfile, const char* field_code,
-    const int* field_code_l, const int* new_fragment, const int* move_data)
+void F77_FUNC(gdmove, GDMOVE) (const int32_t *dirfile, const char *field_code,
+    const int32_t *field_code_l, const int32_t *new_fragment,
+    const int32_t *move_data)
 {
-  char* fc = (char *)malloc(*field_code_l + 1);
+  char *fc;
 
-  gd_move(_GDF_GetDirfile(*dirfile), _GDF_CString(fc, field_code,
+  dtrace("%i, %p, %i, %i, %i", *dirfile, field_code, *field_code_l,
+      *new_fragment, *move_data);
+
+  gd_move(_GDF_GetDirfile(*dirfile), _GDF_CString(&fc, field_code,
         *field_code_l), *new_fragment, *move_data);
 
   free(fc);
+  dreturnvoid();
 }
 
 /* gd_rename wrapper */
-void F77_FUNC(gdrenm, GDRENM) (const int* dirfile, const char* field_code,
-    const int* field_code_l, const char* new_name, const int* new_name_l,
-    const int* move_data)
+void F77_FUNC(gdrenm, GDRENM) (const int32_t *dirfile, const char *field_code,
+    const int32_t *field_code_l, const char *new_name,
+    const int32_t *new_name_l, const int32_t *move_data)
 {
-  char* fc = (char *)malloc(*field_code_l + 1);
-  char* nn = (char *)malloc(*new_name_l + 1);
+  char *fc, *nn;
 
-  gd_rename(_GDF_GetDirfile(*dirfile), _GDF_CString(fc, field_code,
-        *field_code_l), _GDF_CString(nn, new_name, *new_name_l), *move_data);
+  dtrace("%i, %p, %i, %p, %i, %i", *dirfile, field_code, *field_code_l,
+      new_name, *new_name_l, *move_data);
+
+  gd_rename(_GDF_GetDirfile(*dirfile), _GDF_CString(&fc, field_code,
+        *field_code_l), _GDF_CString(&nn, new_name, *new_name_l), *move_data);
 
   free(nn);
   free(fc);
+  dreturnvoid();
 }
 
 /* gd_uninclude wrapper */
-void F77_FUNC(gduinc, GDUINC) (const int* dirfile, const int* fragment,
-    const int* del)
+void F77_FUNC(gduinc, GDUINC) (const int32_t *dirfile, const int32_t *fragment,
+    const int32_t *del)
 {
   gd_uninclude(_GDF_GetDirfile(*dirfile), *fragment, *del);
 }
 
 /* gd_alter_frameoffset wrapper */
-void F77_FUNC(gdafof, GDAFOF) (const int* dirfile, const int* offset,
-    const int* fragment, const int* recode)
+void F77_FUNC(gdafof, GDAFOF) (const int32_t *dirfile, const int32_t *offset,
+    const int32_t *fragment, const int32_t *recode)
 {
   gd_alter_frameoffset(_GDF_GetDirfile(*dirfile), *offset, *fragment,
       *recode);
 }
 
 /* gd_frameoffset wrapper */
-void F77_FUNC(gdgfof, GDGFOF) (int* offset, const int* dirfile,
-    const int* fragment)
+void F77_FUNC(gdgfof, GDGFOF) (int32_t *offset, const int32_t *dirfile,
+    const int32_t *fragment)
 {
   *offset = gd_frameoffset(_GDF_GetDirfile(*dirfile), *fragment);
 }
 
 /* gd_native_type wrapper */
-void F77_FUNC(gdntyp, GDNTYP) (int* type, const int* dirfile,
-    const char* field_code, const int* field_code_l)
+void F77_FUNC(gdntyp, GDNTYP) (int32_t *type, const int32_t *dirfile,
+    const char *field_code, const int32_t *field_code_l)
 {
-  char* fc = (char *)malloc(*field_code_l + 1);
+  char *fc;
 
-  *type = gd_native_type(_GDF_GetDirfile(*dirfile), _GDF_CString(fc,
+  dtrace("%p, %i, %p, %i", type, *dirfile, field_code, *field_code_l);
+
+  *type = gd_native_type(_GDF_GetDirfile(*dirfile), _GDF_CString(&fc,
         field_code, *field_code_l));
 
   free(fc);
+  dreturn("%i", *type);
 }
 
 /* returns the value of the comp_scal member */
-void F77_FUNC(gdcscl, GDCSCL) (int *comp_scal, const int *dirfile,
-    const char *field_code, const int *field_code_l)
+void F77_FUNC(gdcscl, GDCSCL) (int32_t *comp_scal, const int32_t *dirfile,
+    const char *field_code, const int32_t *field_code_l)
 {
   char *fc;
   gd_entry_t E;
@@ -2693,12 +2986,11 @@ void F77_FUNC(gdcscl, GDCSCL) (int *comp_scal, const int *dirfile,
 
   dtrace("%p, %i, %p, %i", comp_scal, *dirfile, field_code, *field_code_l);
 
-  fc = (char *)malloc(*field_code_l + 1);
   D = _GDF_GetDirfile(*dirfile);
 
   *comp_scal = 0;
 
-  gd_entry(D, _GDF_CString(fc, field_code, *field_code_l), &E);
+  gd_entry(D, _GDF_CString(&fc, field_code, *field_code_l), &E);
 
   if (!gd_error(D) && (E.field_type == GD_LINCOM_ENTRY ||
         E.field_type == GD_POLYNOM_ENTRY || E.field_type == GD_RECIP_ENTRY))
@@ -2711,42 +3003,48 @@ void F77_FUNC(gdcscl, GDCSCL) (int *comp_scal, const int *dirfile,
 }
 
 /* gd_validate wrapper */
-void F77_FUNC(gdvldt, GDVLDT) (int *valid, const int *dirfile,
-    const char *field_code, const int *field_code_l)
+void F77_FUNC(gdvldt, GDVLDT) (int32_t *valid, const int32_t *dirfile,
+    const char *field_code, const int32_t *field_code_l)
 {
-  char *fc = (char *)malloc(*field_code_l + 1);
+  char *fc;
+
+  dtrace("%p, %i, %p, %i", valid, *dirfile, field_code, *field_code_l);
 
   *valid = gd_validate(_GDF_GetDirfile(*dirfile),
-      _GDF_CString(fc, field_code, *field_code_l));
+      _GDF_CString(&fc, field_code, *field_code_l));
 
   free(fc);
+  dreturn("%i", *valid);
 }
 
 /* gd_framenum wrapper */
-void F77_FUNC(gdfnum, GDFNUM) (double *framenum, const int *dirfile,
-    const char *field_code, const int *field_code_l, const double *value)
+void F77_FUNC(gdfnum, GDFNUM) (double *framenum, const int32_t *dirfile,
+    const char *field_code, const int32_t *field_code_l, const double *value)
 {
-  char *fc = (char *)malloc(*field_code_l + 1);
+  char *fc;
+
+  dtrace("%p, %i, %p. %i, %g", framenum, *dirfile, field_code, *field_code_l,
+      *value);
 
   *framenum = gd_framenum(_GDF_GetDirfile(*dirfile),
-      _GDF_CString(fc, field_code, *field_code_l), *value);
+      _GDF_CString(&fc, field_code, *field_code_l), *value);
 
   free(fc);
+  dreturn("%g", *value);
 }
 
 /* gd_framenum_subset wrapper */
-void F77_FUNC(gdfnss, GDFNSS) (double *framenum, const int *dirfile,
-    const char *field_code, const int *field_code_l, const double *value,
-    const int *start, const int *end)
+void F77_FUNC(gdfnss, GDFNSS) (double *framenum, const int32_t *dirfile,
+    const char *field_code, const int32_t *field_code_l, const double *value,
+    const int32_t *start, const int32_t *end)
 {
   char *fc;
 
   dtrace("%p, %i, %p, %i, %g, %i, %i", framenum, *dirfile, field_code,
       *field_code_l, *value, *start, *end);
-  fc = (char *)malloc(*field_code_l + 1);
 
   *framenum = gd_framenum_subset(_GDF_GetDirfile(*dirfile),
-      _GDF_CString(fc, field_code, *field_code_l), *value, *start, *end);
+      _GDF_CString(&fc, field_code, *field_code_l), *value, *start, *end);
 
   free(fc);
 
@@ -2754,9 +3052,9 @@ void F77_FUNC(gdfnss, GDFNSS) (double *framenum, const int *dirfile,
 }
 
 /* retrieve a scalar parameter */
-void F77_FUNC(gdgsca, GDGSCA) (char* scalar, int* scalar_l, int *scalar_index,
-    const int* dirfile, const char* field_code, const int *field_code_l,
-    const int* index)
+void F77_FUNC(gdgsca, GDGSCA) (char *scalar, int32_t *scalar_l,
+    int32_t *scalar_index, const int32_t *dirfile, const char *field_code,
+    const int32_t *field_code_l, const int32_t *index)
 {
   char *fc;
   int ok = 0;
@@ -2766,10 +3064,9 @@ void F77_FUNC(gdgsca, GDGSCA) (char* scalar, int* scalar_l, int *scalar_index,
   dtrace("%p, %p, %p, %i, %p, %i, %i", scalar, scalar_l, scalar_index,
       *dirfile, field_code, *field_code_l, *index);
 
-  fc = (char *)malloc(*field_code_l + 1);
   D = _GDF_GetDirfile(*dirfile);
 
-  gd_entry(D, _GDF_CString(fc, field_code, *field_code_l), &E);
+  gd_entry(D, _GDF_CString(&fc, field_code, *field_code_l), &E);
 
   free(fc);
 
@@ -2777,6 +3074,7 @@ void F77_FUNC(gdgsca, GDGSCA) (char* scalar, int* scalar_l, int *scalar_index,
     ok = 1;
     switch (E.field_type) {
       case GD_NO_ENTRY:
+      case GD_ALIAS_ENTRY:
       case GD_LINTERP_ENTRY:
       case GD_MULTIPLY_ENTRY:
       case GD_DIVIDE_ENTRY:
@@ -2799,12 +3097,14 @@ void F77_FUNC(gdgsca, GDGSCA) (char* scalar, int* scalar_l, int *scalar_index,
         break;
       case GD_BIT_ENTRY:
       case GD_SBIT_ENTRY:
+      case GD_MPLEX_ENTRY:
         if (*index > 2)
           ok = 0;
         break;
       case GD_RECIP_ENTRY:
       case GD_RAW_ENTRY:
       case GD_PHASE_ENTRY:
+      case GD_WINDOW_ENTRY:
         if (*index > 1)
           ok = 0;
         break;
@@ -2823,9 +3123,9 @@ void F77_FUNC(gdgsca, GDGSCA) (char* scalar, int* scalar_l, int *scalar_index,
 }
 
 /* set a scalar parameter */
-void F77_FUNC(gdasca, GDASCA) (const int *dirfile, const char *field_code,
-    const int *field_code_l, const int *index, const char *scalar,
-    const int *scalar_l, int *scalar_index, int *recode)
+void F77_FUNC(gdasca, GDASCA) (const int32_t *dirfile, const char *field_code,
+    const int32_t *field_code_l, const int32_t *index, const char *scalar,
+    const int32_t *scalar_l, int32_t *scalar_index, int32_t *recode)
 {
   int ok = 1;
   char *fc;
@@ -2835,7 +3135,6 @@ void F77_FUNC(gdasca, GDASCA) (const int *dirfile, const char *field_code,
   dtrace("%i, %p, %i, %i, %p, %i, %i, %i", *dirfile, field_code, *field_code_l,
       *index, scalar, *scalar_l, *scalar_index, *recode);
 
-  fc = (char *)malloc(*field_code_l + 1);
   D = _GDF_GetDirfile(*dirfile);
 
   if (*index < 1) {
@@ -2843,10 +3142,11 @@ void F77_FUNC(gdasca, GDASCA) (const int *dirfile, const char *field_code,
     return;
   }
 
-  gd_entry(D, _GDF_CString(fc, field_code, *field_code_l), &E);
+  gd_entry(D, _GDF_CString(&fc, field_code, *field_code_l), &E);
 
   switch (E.field_type) {
     case GD_NO_ENTRY:
+    case GD_ALIAS_ENTRY:
     case GD_LINTERP_ENTRY:
     case GD_MULTIPLY_ENTRY:
     case GD_DIVIDE_ENTRY:
@@ -2869,12 +3169,14 @@ void F77_FUNC(gdasca, GDASCA) (const int *dirfile, const char *field_code,
       break;
     case GD_BIT_ENTRY:
     case GD_SBIT_ENTRY:
+    case GD_MPLEX_ENTRY:
       if (*index > 2)
         ok = 0;
       break;
     case GD_RAW_ENTRY:
     case GD_PHASE_ENTRY:
     case GD_RECIP_ENTRY:
+    case GD_WINDOW_ENTRY:
       if (*index > 1)
         ok = 0;
       break;
@@ -2886,8 +3188,7 @@ void F77_FUNC(gdasca, GDASCA) (const int *dirfile, const char *field_code,
   }
 
   free(E.scalar[*index - 1]);
-  E.scalar[*index - 1] = (char *)malloc(*scalar_l + 1);
-  _GDF_CString(E.scalar[*index - 1], scalar, *scalar_l);
+  _GDF_CString(E.scalar + *index - 1, scalar, *scalar_l);
   E.scalar_ind[*index - 1] = *scalar_index;
 
   gd_alter_entry(D, fc, &E, *recode);
@@ -2898,7 +3199,7 @@ void F77_FUNC(gdasca, GDASCA) (const int *dirfile, const char *field_code,
 }
 
 /* gd_invalid_dirfile wrapper */
-void F77_FUNC(gdinvd, GDINVD) (int *dirfile)
+void F77_FUNC(gdinvd, GDINVD) (int32_t *dirfile)
 {
   dtrace("%p", dirfile);
 
@@ -2908,7 +3209,7 @@ void F77_FUNC(gdinvd, GDINVD) (int *dirfile)
 }
 
 /* gd_dirfile_standards wrapper */
-void F77_FUNC(gdstdv, GDSTDV) (int *vers, const int *dirfile)
+void F77_FUNC(gdstdv, GDSTDV) (int32_t *vers, const int32_t *dirfile)
 {
   dtrace("%p, %i", vers, *dirfile);
 
@@ -2916,3 +3217,810 @@ void F77_FUNC(gdstdv, GDSTDV) (int *vers, const int *dirfile)
 
   dreturn("%i", *vers);
 }
+
+/* gd_seek wrapper */
+void F77_FUNC(gdseek, GDSEEK) (int32_t *pos, const int32_t *dirfile,
+    const char *field_code, const int32_t *field_code_l,
+    const int32_t *frame_num, const int32_t *sample_num, const int32_t *flags)
+{
+  char *fc;
+  dtrace("%p, %i, %p, %i, %i, %i, 0x%x", pos, *dirfile, field_code,
+      *field_code_l, *frame_num, *sample_num, *flags);
+
+  *pos = (int)gd_seek(_GDF_GetDirfile(*dirfile), _GDF_CString(&fc, field_code,
+        *field_code_l), *frame_num, *sample_num, *flags);
+
+  free(fc);
+  dreturn("%i", *pos);
+}
+
+/* gd_tell wrapper */
+void F77_FUNC(gdtell, GDTELL) (int32_t *pos, const int32_t *dirfile,
+    const char *field_code, const int32_t *field_code_l)
+{
+  char *fc;
+  dtrace("%p, %i, %p, %i", pos, *dirfile, field_code, *field_code_l);
+
+  *pos = (int)gd_tell(_GDF_GetDirfile(*dirfile), _GDF_CString(&fc, field_code,
+        *field_code_l));
+
+  free(fc);
+  dreturn("%i", *pos);
+}
+
+/* gd_constants wrapper -- this only returns one value */
+void F77_FUNC(gdcons, GDCONS) (void *value, const int32_t *dirfile,
+    const int32_t *return_type, const int32_t *field_num)
+{
+  const void *v;
+
+  dtrace("%p, %i, 0x%x, %i", value, *dirfile, *return_type, *field_num);
+
+  DIRFILE *D = _GDF_GetDirfile(*dirfile);
+  unsigned int nfields = gd_nfields_by_type(D, GD_CONST_ENTRY);
+
+  if (!gd_error(D) && (*field_num > 0) && (*field_num <= (int)nfields)) {
+    v = gd_constants(D, (gd_type_t)*return_type);
+    if (!gd_error(D))
+      memcpy(value, (char*)v + (*field_num - 1) * GD_SIZE(*return_type),
+          GD_SIZE(*return_type));
+  }
+  dreturnvoid();
+}
+
+/* gd_mconstants wrapper -- this only returns one value */
+void F77_FUNC(gdmcos, GDMCOS) (void *value, const int32_t *dirfile,
+    const char *parent, const int32_t *parent_l, const int32_t *return_type,
+    const int32_t *field_num)
+{
+  const void *v;
+  DIRFILE *D;
+  char *pa;
+  unsigned int nfields;
+
+  dtrace("%p, %i, %p, %i, 0x%x, %i", value, *dirfile, parent, *parent_l,
+      *return_type, *field_num);
+
+  D = _GDF_GetDirfile(*dirfile);
+  _GDF_CString(&pa, parent, *parent_l);
+  nfields = gd_nmfields_by_type(D, pa, GD_CONST_ENTRY);
+
+  if (!gd_error(D) && (*field_num > 0) && (*field_num <= (int)nfields)) {
+    v = gd_mconstants(D, pa, (gd_type_t)*return_type);
+    if (!gd_error(D))
+      memcpy(value, (char*)v + (*field_num - 1) * GD_SIZE(*return_type),
+          GD_SIZE(*return_type));
+  }
+
+  free(pa);
+  dreturnvoid();
+}
+
+/* gd_strings wrapper -- this only returns one value */
+void F77_FUNC(gdstrs, GDSTRS) (char *value, int32_t *value_l,
+    const int32_t *dirfile, const int32_t *field_num)
+{
+  const char **v;
+
+  dtrace("%p, %i, %i, %i", value, *value_l, *dirfile, *field_num);
+
+  DIRFILE *D = _GDF_GetDirfile(*dirfile);
+  unsigned int nfields = gd_nfields_by_type(D, GD_STRING_ENTRY);
+
+  if (!gd_error(D) && (*field_num > 0) && (*field_num <= (int)nfields)) {
+    v = gd_strings(D);
+    _GDF_FString(value, value_l, gd_error(D) ? "" : v[*field_num - 1]);
+  } else
+    *value_l = 0;
+
+  dreturn("%i", *value_l);
+}
+
+/* gd_mstrings wrapper -- this only returns one value */
+void F77_FUNC(gdmsts, GDMSTS) (void *value, int32_t *value_l,
+    const int32_t *dirfile, const char *parent, const int32_t *parent_l,
+    const int32_t *field_num)
+{
+  const char **v;
+  char *pa;
+  DIRFILE *D;
+  unsigned int nfields;
+
+  dtrace("%p, %i, %i, %p, %i, %i", value, *value_l, *dirfile, parent,
+      *parent_l, *field_num);
+
+  D = _GDF_GetDirfile(*dirfile);
+  _GDF_CString(&pa, parent, *parent_l);
+  nfields = gd_nmfields_by_type(D, pa, GD_STRING_ENTRY);
+
+  if (!gd_error(D) && (*field_num > 0) && (*field_num <= (int)nfields)) {
+    v = gd_mstrings(D, pa);
+    _GDF_FString((char*)value, value_l,
+        gd_error(D) ? "" : ((char**)v)[*field_num - 1]);
+  } else
+    *value_l = 0;
+
+  free(pa);
+  dreturnvoid();
+}
+
+/* Return the maximum string value length */
+void F77_FUNC(gdstrx, GDSTRX) (int32_t *max, const int32_t *dirfile)
+{
+  dtrace("%p, %i", max, *dirfile);
+
+  const char **v;
+  size_t len = 0;
+  DIRFILE *D = _GDF_GetDirfile(*dirfile);
+  unsigned int i, nfields = gd_nfields_by_type(D, GD_STRING_ENTRY);
+
+  if (!gd_error(D)) {
+    v = gd_strings(D);
+
+    for (i = 0; i < nfields; ++i)
+      if (strlen(v[i]) > len)
+        len = strlen(v[i]);
+  }
+
+  *max = (int)len;
+
+  dreturn("%i", *max);
+}
+
+/* Return the maximum meta string value length */
+void F77_FUNC(gdmstx, GDMSTX) (int32_t *max, const int32_t *dirfile,
+    const char *parent, const int32_t *parent_l)
+{
+  const char **v;
+  size_t len = 0;
+  DIRFILE *D;
+  char *pa;
+  unsigned int i, nfields;
+
+  dtrace("%p, %i, %p, %i", max, *dirfile, parent, *parent_l);
+
+  D = _GDF_GetDirfile(*dirfile);
+  _GDF_CString(&pa, parent, *parent_l);
+  nfields = gd_nmfields_by_type(D, pa, GD_STRING_ENTRY);
+
+  if (!gd_error(D)) {
+    v = gd_mstrings(D, pa);
+
+    for (i = 0; i < nfields; ++i)
+      if (strlen(v[i]) > len)
+        len = strlen(v[i]);
+  }
+
+  *max = (int)len;
+
+  free(pa);
+
+  dreturn("%i", *max);
+}
+
+/* gd_add_alias wrapper */
+void F77_FUNC(gdadal, GDADAL) (const int32_t *dirfile, const char *field_code,
+    const int32_t *field_code_l, const char *target, const int32_t *target_l,
+    const int32_t *fragment_index)
+{
+  char *tg, *fc;
+
+  dtrace("%i, %p, %i, %p, %i, %i", *dirfile, field_code, *field_code_l,
+      target, *target_l, *fragment_index);
+
+  gd_add_alias(_GDF_GetDirfile(*dirfile), _GDF_CString(&fc, field_code,
+        *field_code_l), _GDF_CString(&tg, target, *target_l), *fragment_index);
+
+  free(fc);
+  free(tg);
+
+  dreturnvoid();
+}
+
+/* gd_add_window wrapper */
+void F77_FUNC(gdadwd, GDADWD) (const int32_t *dirfile, const char *field_code,
+    const int32_t *field_code_l, const char *in_field,
+    const int32_t *in_field_l, const char *check_field,
+    const int32_t *check_field_l, const int32_t *windop, const void *threshold,
+    const int32_t *fragment_index)
+{
+  char *in, *cf, *fc;
+  gd_triplet_t t;
+
+  dtrace("%i, %p, %i, %p, %i, %p, %i, %i, %p, %i", *dirfile, field_code,
+      *field_code_l, in_field, *in_field_l, check_field, *check_field_l,
+      *windop, threshold, *fragment_index);
+
+  t = _GDF_SetTriplet((gd_windop_t)*windop, threshold);
+
+  gd_add_window(_GDF_GetDirfile(*dirfile), _GDF_CString(&fc, field_code,
+        *field_code_l), _GDF_CString(&in, in_field, *in_field_l),
+      _GDF_CString(&cf, check_field, *check_field_l), (gd_windop_t)*windop, t,
+      *fragment_index);
+
+  free(fc);
+  free(cf);
+  free(in);
+
+  dreturnvoid();
+}
+
+/* gd_madd_window wrapper */
+void F77_FUNC(gdmdwd, GDMDWD) (const int32_t *dirfile, const char *parent,
+    const int32_t *parent_l, const char *field_code,
+    const int32_t *field_code_l, const char *in_field,
+    const int32_t *in_field_l, const char *check_field,
+    const int32_t *check_field_l, const int32_t *windop, const void *threshold)
+{
+  char *in, *cf, *fc, *pa;
+  gd_triplet_t t;
+
+  dtrace("%i, %p, %i, %p, %i, %p, %i, %p, %i, %i, %p", *dirfile, parent,
+      *parent_l, field_code, *field_code_l, in_field, *in_field_l, check_field,
+      *check_field_l, *windop, threshold);
+
+  t = _GDF_SetTriplet((gd_windop_t)*windop, threshold);
+
+  gd_madd_window(_GDF_GetDirfile(*dirfile), _GDF_CString(&pa, parent,
+        *parent_l), _GDF_CString(&fc, field_code, *field_code_l),
+      _GDF_CString(&in, in_field, *in_field_l), _GDF_CString(&cf, check_field,
+        *check_field_l), (gd_windop_t)*windop, t);
+
+  free(pa);
+  free(fc);
+  free(cf);
+  free(in);
+
+  dreturnvoid();
+}
+
+/* gd_add_mplex wrapper */
+void F77_FUNC(gdadmx, GDADMX) (const int32_t *dirfile, const char *field_code,
+    const int32_t *field_code_l, const char *in_field,
+    const int32_t *in_field_l, const char *count_field,
+    const int32_t *count_field_l, const int32_t *val, const int32_t *max,
+    const int32_t *fragment_index)
+{
+  char *in, *cf, *fc;
+
+  dtrace("%i, %p, %i, %p, %i, %p, %i, %i, %i, %i", *dirfile, field_code,
+      *field_code_l, in_field, *in_field_l, count_field, *count_field_l,
+      *val, *max, *fragment_index);
+
+  gd_add_mplex(_GDF_GetDirfile(*dirfile), _GDF_CString(&fc, field_code,
+        *field_code_l), _GDF_CString(&in, in_field, *in_field_l),
+      _GDF_CString(&cf, count_field, *count_field_l), *val, *max,
+      *fragment_index);
+
+  free(fc);
+  free(cf);
+  free(in);
+
+  dreturnvoid();
+}
+
+/* gd_madd_mplex wrapper */
+void F77_FUNC(gdmdmx, GDMDMX) (const int32_t *dirfile, const char *parent,
+    const int32_t *parent_l, const char *field_code,
+    const int32_t *field_code_l, const char *in_field,
+    const int32_t *in_field_l, const char *count_field,
+    const int32_t *count_field_l, const int32_t *val, const int32_t *max)
+{
+  char *in, *cf, *fc, *pa;
+
+  dtrace("%i, %p, %i, %p, %i, %p, %i, %p, %i, %i, %i", *dirfile, parent,
+      *parent_l, field_code, *field_code_l, in_field, *in_field_l, count_field,
+      *count_field_l, *val, *max);
+
+  gd_madd_mplex(_GDF_GetDirfile(*dirfile), _GDF_CString(&pa, parent, *parent_l),
+      _GDF_CString(&fc, field_code, *field_code_l), _GDF_CString(&in, in_field,
+        *in_field_l), _GDF_CString(&cf, count_field, *count_field_l), *val,
+      *max);
+
+  free(pa);
+  free(fc);
+  free(cf);
+  free(in);
+
+  dreturnvoid();
+}
+
+/* gd_alias_target */
+void F77_FUNC(gdatrg, GDATRG) (char *target, int32_t *target_l,
+    const int32_t *dirfile, const char *field_code, const int32_t *field_code_l)
+{
+  const char *targ;
+  char *fc;
+
+  dtrace("%p, %i, %i, %p, %i", target, *target_l, *dirfile, field_code,
+      *field_code_l);
+
+  targ = gd_alias_target(_GDF_GetDirfile(*dirfile), _GDF_CString(&fc,
+        field_code, *field_code_l));
+
+  _GDF_FString(target, target_l, targ);
+
+  free(fc);
+
+  dreturn("%i", *target_l);
+}
+
+/* Return the maximum alias length */
+void F77_FUNC(gdalsx, GDALSX) (int32_t *max, const int32_t *dirfile,
+    const char *field_code, const int32_t *field_code_l)
+{
+  const char **al;
+  size_t len = 0;
+  char *fc;
+  unsigned int i, nalias;
+
+  dtrace("%p, %i, %p, %i", max, *dirfile, field_code, *field_code_l);
+
+  DIRFILE* D = _GDF_GetDirfile(*dirfile);
+  _GDF_CString(&fc, field_code, *field_code_l);
+
+  nalias = gd_naliases(D, fc);
+
+  if (!gd_error(D)) {
+    al = gd_aliases(D, fc);
+
+    for (i = 0; i < nalias; ++i)
+      if (strlen(al[i]) > len)
+        len = strlen(al[i]);
+  }
+
+  *max = len;
+  free(fc);
+  dreturn("%zu", len);
+}
+
+/* gd_naliases */
+void F77_FUNC(gdnals, GDNALS) (int32_t *nalias, const int32_t *dirfile,
+    const char *field_code, const int32_t *field_code_l)
+{
+  char *fc;
+
+  dtrace("%p, %i, %p, %i", nalias, *dirfile, field_code, *field_code_l);
+
+  *nalias = gd_naliases(_GDF_GetDirfile(*dirfile), _GDF_CString(&fc, field_code,
+        *field_code_l));
+
+  free(fc);
+  dreturn("%i", *nalias);
+}
+
+
+/* gd_aliases -- this only returns one alias */
+void F77_FUNC(gdalss, GDALSS) (char *alias, int32_t *alias_l,
+    const int32_t *dirfile, const char *field_code, const int32_t *field_code_l,
+    const int32_t *num)
+{
+  const char **al;
+  char *fc;
+  unsigned int nalias;
+
+  dtrace("%p, %i, %i, %p, %i, %i", alias, *alias_l, *dirfile, field_code,
+      *field_code_l, *num);
+
+  DIRFILE* D = _GDF_GetDirfile(*dirfile);
+  _GDF_CString(&fc, field_code, *field_code_l);
+
+  nalias = gd_naliases(D, fc);
+
+  if (!gd_error(D) && *num > 0 && *num <= (int)nalias) {
+    al = gd_aliases(D, fc);
+    _GDF_FString(alias, alias_l, al[*num - 1]);
+  } else 
+    *alias_l = 0;
+
+  free(fc);
+  dreturn("%i", *alias_l);
+}
+
+/* gd_alter_affixes */
+void F77_FUNC(gdaafx, GDAAFX) (const int32_t *dirfile, const int32_t *index,
+    const char *prefix, const int32_t *prefix_l, const char *suffix,
+    const int32_t *suffix_l)
+{
+  char *px, *sx;
+
+  dtrace("%i, %i, %p, %i, %p, %i", *dirfile, *index, prefix, *prefix_l,
+      suffix, *suffix_l);
+
+  gd_alter_affixes(_GDF_GetDirfile(*dirfile), *index, _GDF_CString(&px, prefix,
+        *prefix_l), _GDF_CString(&sx, suffix, *suffix_l));
+
+  free(sx);
+  free(px);
+
+  dreturnvoid();
+}
+
+/* gd_alter_window */
+void F77_FUNC(gdalwd, GDALWD) (const int32_t *dirfile, const char *field_code,
+    const int32_t *field_code_l, const char *in_field,
+    const int32_t *in_field_l, const char *check_field,
+    const int32_t *check_field_l, const int32_t *windop, const void *threshold)
+{
+  char *fc, *in, *cf;
+  gd_triplet_t t;
+
+  dtrace("%i, %p, %i, %p, %i, %p, %i, %i, %p", *dirfile, field_code,
+      *field_code_l, in_field, *in_field_l, check_field, *check_field_l,
+      *windop, threshold);
+
+  t = _GDF_SetTriplet((gd_windop_t)*windop, threshold);
+
+  gd_alter_window(_GDF_GetDirfile(*dirfile), _GDF_CString(&fc, field_code,
+        *field_code_l), _GDF_CString(&in, in_field, *in_field_l),
+      _GDF_CString(&cf, check_field, *check_field_l), (gd_windop_t)*windop, t);
+
+  free(cf);
+  free(in);
+  free(fc);
+  dreturnvoid();
+}
+
+/* gd_alter_mplex */
+void F77_FUNC(gdalmx, GDALMX) (const int32_t *dirfile, const char *field_code,
+    const int32_t *field_code_l, const char *in_field,
+    const int32_t *in_field_l, const char *count_field,
+    const int32_t *count_field_l, const int32_t *val, const int32_t *max)
+{
+  char *fc, *in, *cf;
+
+  dtrace("%i, %p, %i, %p, %i, %p, %i, %i, %i", *dirfile, field_code,
+      *field_code_l, in_field, *in_field_l, count_field, *count_field_l,
+      *val, *max);
+
+  gd_alter_mplex(_GDF_GetDirfile(*dirfile), _GDF_CString(&fc, field_code,
+        *field_code_l), _GDF_CString(&in, in_field, *in_field_l),
+      _GDF_CString(&cf, count_field, *count_field_l), *val, *max);
+
+  free(cf);
+  free(in);
+  free(fc);
+  dreturnvoid();
+}
+
+/* gd_delete_alias */
+void F77_FUNC(gddela, GDDELA) (const int32_t *dirfile, const char *field_code,
+    const int32_t *field_code_l, const int32_t *flags)
+{
+  char *fc;
+
+  dtrace("%i, %p, %i, %i", *dirfile, field_code, *field_code_l, *flags);
+
+  gd_delete_alias(_GDF_GetDirfile(*dirfile), _GDF_CString(&fc, field_code,
+        *field_code_l), (unsigned int)*flags);
+
+  free(fc);
+  dreturnvoid();
+}
+
+/* gd_fragment_affixes */
+void F77_FUNC(gdfraf, GDFRAF) (char *prefix, int32_t *prefix_l, char *suffix,
+    int32_t *suffix_l, const int32_t *dirfile, const int32_t *index)
+{
+  char *px, *sx;
+
+  dtrace("%p, %i, %p, %i, %i, %i", prefix, *prefix_l, suffix, *suffix_l,
+      *dirfile, *index);
+
+  if (!gd_fragment_affixes(_GDF_GetDirfile(*dirfile), *index, &px, &sx)) {
+    _GDF_FString(prefix, prefix_l, px);
+    _GDF_FString(suffix, suffix_l, sx);
+    free(px);
+    free(sx);
+  } else
+    *prefix_l = *suffix_l = 0;
+
+  dreturnvoid();
+}
+
+/* gd_hidden */
+void F77_FUNC(gdhidn, GDHIDN) (int32_t *result, const int32_t *dirfile,
+    const char *field_code, const int32_t *field_code_l)
+{
+  char *fc;
+
+  dtrace("%p, %i, %p, %i", result, *dirfile, field_code, *field_code_l);
+
+  *result = gd_hidden(_GDF_GetDirfile(*dirfile), _GDF_CString(&fc, field_code,
+        *field_code_l));
+
+  free(fc);
+  dreturn("%i", *result);
+}
+
+/* gd_hide */
+void F77_FUNC(gdhide, GDHIDE) (const int32_t *dirfile, const char *field_code,
+    const int32_t *field_code_l)
+{
+  char *fc;
+
+  dtrace("%i, %p, %i", *dirfile, field_code, *field_code_l);
+
+  gd_hide(_GDF_GetDirfile(*dirfile), _GDF_CString(&fc, field_code,
+        *field_code_l));
+
+  free(fc);
+  dreturnvoid();
+}
+
+/* gd_unhide */
+void F77_FUNC(gduhid, GDUHID) (const int32_t *dirfile, const char *field_code,
+    const int32_t *field_code_l)
+{
+  char *fc;
+
+  dtrace("%i, %p, %i", *dirfile, field_code, *field_code_l);
+
+  gd_unhide(_GDF_GetDirfile(*dirfile), _GDF_CString(&fc, field_code,
+        *field_code_l));
+
+  free(fc);
+  dreturnvoid();
+}
+
+/* gd_madd_alias wrapper */
+void F77_FUNC(gdmdal, GDMDAL) (const int32_t *dirfile, const char *parent,
+    const int32_t *parent_l, const char *field_code,
+    const int32_t *field_code_l, const char *target, const int32_t *target_l)
+{
+  char *pa, *tg, *fc;
+
+  dtrace("%i, %p, %i, %p, %i, %p, %i", *dirfile, parent, *parent_l, field_code,
+      *field_code_l, target, *target_l);
+
+  gd_madd_alias(_GDF_GetDirfile(*dirfile), _GDF_CString(&pa, parent, *parent_l),
+      _GDF_CString(&fc, field_code, *field_code_l), _GDF_CString(&tg, target,
+        *target_l));
+
+  free(fc);
+  free(tg);
+  free(pa);
+
+  dreturnvoid();
+}
+
+/* gd_move_alias wrapper */
+void F77_FUNC(gdmova, GDMOVA) (const int32_t *dirfile, const char *field_code,
+    const int32_t *field_code_l, const int32_t *new_fragment)
+{
+  char *fc;
+
+  dtrace("%i, %p, %i, %i", *dirfile, field_code, *field_code_l, *new_fragment);
+
+  gd_move_alias(_GDF_GetDirfile(*dirfile), _GDF_CString(&fc, field_code,
+        *field_code_l), *new_fragment);
+
+  free(fc);
+  dreturnvoid();
+}
+
+/* gd_include_affix wrapper */
+void F77_FUNC(gdinca, GDINCA) (const int32_t *dirfile, const char *file,
+    const int32_t *file_l, const int32_t *fragment_index, const char *prefix,
+    const int32_t *prefix_l, const char *suffix, const int32_t *suffix_l,
+    const int32_t *flags)
+{
+  char *fi, *px, *sx;
+
+  dtrace("%i, %p, %i, %i, %p, %i, %p, %i, %i", *dirfile, file, *file_l,
+      *fragment_index, prefix, *prefix_l, suffix, *suffix_l, *flags);
+
+  gd_include_affix(_GDF_GetDirfile(*dirfile), _GDF_CString(&fi, file, *file_l),
+      *fragment_index, _GDF_CString(&px, prefix, *prefix_l), _GDF_CString(&sx,
+        suffix, *suffix_l), *flags);
+
+  free(sx);
+  free(px);
+  free(fi);
+  dreturnvoid();
+}
+
+/* gd_sync wrapper */
+void F77_FUNC(gdsync, GDSYNC) (const int32_t *dirfile, const char *field_code,
+    const int32_t *field_code_l)
+{
+  dtrace("%i, %p, %i", *dirfile, field_code, *field_code_l);
+
+  if (field_code_l == 0)
+    gd_sync(_GDF_GetDirfile(*dirfile), NULL);
+  else {
+    char *out;
+    gd_sync(_GDF_GetDirfile(*dirfile), _GDF_CString(&out, field_code,
+          *field_code_l));
+    free(out);
+  }
+
+  dreturnvoid();
+}
+
+/* gd_raw_close wrapper */
+void F77_FUNC(gdrclo, GDRCLO) (const int32_t *dirfile, const char *field_code,
+    const int32_t *field_code_l)
+{
+  dtrace("%i, %p, %i", *dirfile, field_code, *field_code_l);
+
+  if (field_code_l == 0)
+    gd_sync(_GDF_GetDirfile(*dirfile), NULL);
+  else {
+    char *out;
+    gd_raw_close(_GDF_GetDirfile(*dirfile), _GDF_CString(&out, field_code,
+          *field_code_l));
+    free(out);
+  }
+
+  dreturnvoid();
+}
+
+/* gd_strtok wrapper */
+void F77_FUNC(gdtoke, GDTOKE) (char *toke, int32_t *toke_l,
+    const int32_t *dirfile, const char *string, const int32_t *string_l)
+{
+  char *token, *st = NULL;
+  DIRFILE *D;
+
+  dtrace("%p, %p, %i, %p, %i", toke, toke_l, *dirfile, string, *string_l);
+
+  D = _GDF_GetDirfile(*dirfile);
+  if (*string_l > 0)
+    _GDF_CString(&st, string, *string_l);
+
+  token = gd_strtok(D, st);
+  free(st);
+
+  _GDF_FString(toke, toke_l, token);
+  free(token);
+
+  dreturn("%i", *toke_l);
+}
+
+/* gd_desync wrapper */
+void F77_FUNC(gddsyn, GDDSYN) (int32_t *desync, const int32_t *dirfile,
+    const int32_t *flags)
+{
+  dtrace("%p, %i, %i", desync, *dirfile, *flags);
+
+  *desync = gd_desync(_GDF_GetDirfile(*dirfile), *flags);
+
+  dreturn("%i", *desync);
+}
+
+/* gd_flags wrapper */
+void F77_FUNC(gdflag, GDFLAG) (int32_t *flags, const int32_t *dirfile,
+    const int32_t *set,
+    const int32_t *reset)
+{
+  dtrace("%p, %i, 0x%X, 0x%X", flags, *dirfile, *set, *reset);
+
+  *flags = gd_flags(_GDF_GetDirfile(*dirfile), *set, *reset);
+
+  dreturn("%i", *flags);
+}
+
+/* gd_verbose_prefix wrapper */
+void F77_FUNC(gdvbpx, GDVBPX) (const int32_t *dirfile, const char *prefix,
+    const int32_t *prefix_l)
+{
+  char *px;
+
+  dtrace("%i, %p, %i", *dirfile, prefix, *prefix_l);
+
+  gd_verbose_prefix(_GDF_GetDirfile(*dirfile), _GDF_CString(&px, prefix,
+        *prefix_l));
+  free(px);
+
+  dreturnvoid();
+}
+
+/* gd_mplex_lookback wrapper */
+void F77_FUNC(gdmxlb, GDMXLB) (const int32_t *dirfile, const int32_t *lookback)
+{
+  dtrace("%i, %i", *dirfile, *lookback);
+
+  gd_mplex_lookback(_GDF_GetDirfile(*dirfile), *lookback);
+
+  dreturnvoid();
+}
+
+/* gd_nentries wrapper */
+void F77_FUNC(gdnent, GDNENT) (int32_t *nentries, const int32_t *dirfile,
+    const char *parent, const int32_t *parent_l, const int32_t *type,
+    const int32_t *flags)
+{
+  char *pa;
+
+  dtrace("%p, %i, %p, %i, 0x%X, 0x%X", nentries, *dirfile, parent, *parent_l,
+      *type, *flags);
+
+  *nentries = gd_nentries(_GDF_GetDirfile(*dirfile), _GDF_CString(&pa, parent,
+        *parent_l), (unsigned int)*type, (unsigned int)*flags);
+
+  free(pa);
+  dreturn("%i", *nentries);
+}
+
+/* Return the maximum field name length */
+void F77_FUNC(gdentx, GDENTX) (int32_t *max, const int32_t *dirfile,
+    const char *parent, const int32_t *parent_l, const int32_t *type,
+    const int32_t *flags)
+{
+  const char **el;
+  char *pa;
+  size_t len = 0;
+  DIRFILE* D;
+  unsigned int i, nentries;
+  const unsigned int utype = (unsigned int)*type;
+  const unsigned int uflags = (unsigned int)*flags;
+
+  dtrace("%p, %i, %p, %i, 0x%X, 0x%X", max, *dirfile, parent, *parent_l, utype,
+      uflags);
+
+  D = _GDF_GetDirfile(*dirfile);
+  _GDF_CString(&pa, parent, *parent_l);
+  nentries = gd_nentries(D, pa, utype, uflags);
+
+  if (!gd_error(D)) {
+    el = gd_entry_list(D, pa, utype, uflags);
+
+    for (i = 0; i < nentries; ++i)
+      if (strlen(el[i]) > len)
+        len = strlen(el[i]);
+  }
+
+  *max = len;
+  free(pa);
+  dreturn("%i", *max);
+}
+
+/* gd_entry_list wrapper -- this only returns one entry name */
+void F77_FUNC(gdentn, GDENTN) (char *name, int32_t *name_l,
+    const int32_t *dirfile, const char *parent, const int32_t *parent_l,
+    const int32_t *type, const int32_t *flags, const int32_t *field_num)
+{
+  const char** el;
+  char *pa;
+  DIRFILE* D;
+  unsigned int nentries;
+  const unsigned int utype = (unsigned int)*type;
+  const unsigned int uflags = (unsigned int)*flags;
+
+  dtrace("%p, %p, %i, %p, %i, 0x%X, 0x%X, %i", name, name_l, *dirfile, parent,
+      *parent_l, utype, uflags, *field_num);
+
+  D = _GDF_GetDirfile(*dirfile);
+  _GDF_CString(&pa, parent, *parent_l);
+  nentries = gd_nentries(D, pa, utype, uflags);
+
+  if (!gd_error(D) && *field_num > 0 && *field_num <= (int)nentries) {
+    el = gd_entry_list(D, pa, utype, uflags);
+    _GDF_FString(name, name_l, el[*field_num - 1]);
+  } else
+    *name_l = 0;
+
+  free(pa);
+  dreturn("%i", *name_l);
+}
+
+/* gd_linterp_tablename wrapper */
+void F77_FUNC(gdlttn, GDLTTN) (char *name, int32_t *name_l,
+    const int32_t *dirfile, const char *field_code, const int32_t *field_code_l)
+{
+  char *fc, *fn;
+
+  dtrace("%p, %i, %i, %p, %i", name, *name_l, *dirfile, field_code,
+      *field_code_l);
+
+  fn = gd_linterp_tablename(_GDF_GetDirfile(*dirfile), _GDF_CString(&fc,
+        field_code, *field_code_l));
+
+  _GDF_FString(name, name_l, fn);
+
+  free(fc);
+  free(fn);
+
+  dreturn("%i", *name_l);
+}
diff --git a/bindings/f77/fgetdata.h b/bindings/f77/fgetdata.h
index 885a409..0b91d45 100644
--- a/bindings/f77/fgetdata.h
+++ b/bindings/f77/fgetdata.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008, 2009 D. V. Wiebe
+/* Copyright (C) 2008-2012 D. V. Wiebe
  *
  *************************************************************************
  *
@@ -21,11 +21,7 @@
 #ifndef FGETDATA_H
 #define FGETDATA_H
 
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "../../src/internal.h"
+#include "internal.h"
 
 /* If F77_FUNC isn't defined, we have no knowledge of the F77 mangling scheme */
 #ifndef F77_FUNC
@@ -44,519 +40,714 @@
 #ifdef __cplusplus
 extern "C" {
 #endif
+typedef void(*_GDF_callback_t)(int32_t*, const int32_t*, const int32_t*, char*,
+    const int32_t*, const char*);
+
 /* Forward declarations to keep icc happy */
-void F77_FUNC(gdopen, GDOPEN) (int* dirfile, const char* dirfilename,
-    const int* dirfilename_l, const int* flags);
+void F77_FUNC(gdopen, GDOPEN) (int32_t *dirfile, const char *dirfilename,
+    const int32_t *dirfilename_l, const int32_t *flags);
 
-void F77_FUNC(gdclos, GDCLOS) (const int* dirfile);
+void F77_FUNC(gdclos, GDCLOS) (const int32_t *dirfile);
 
-void F77_FUNC(gdflsh, GDFLSH) (const int* dirfile, const char* field_code,
-    const int* field_code_l);
+void F77_FUNC(gdflsh, GDFLSH) (const int32_t *dirfile, const char *field_code,
+    const int32_t *field_code_l);
 
-void F77_FUNC(gdgetd, GDGETD) (int* n_read, const int* dirfile,
-    const char* field_code, const int* field_code_l,
-    const int* first_frame, const int* first_sample,
-    const int* num_frames, const int* num_samples, const int* return_type,
-    void* data_out);
+void F77_FUNC(gdgetd, GDGETD) (int32_t *n_read, const int32_t *dirfile,
+    const char *field_code, const int32_t *field_code_l,
+    const int32_t *first_frame, const int32_t *first_sample,
+    const int32_t *num_frames, const int32_t *num_samples,
+    const int32_t *return_type, void *data_out);
 
-void F77_FUNC(gdfdnx, GDFDNX) (int* max, const int* dirfile);
+void F77_FUNC(gdfdnx, GDFDNX) (int32_t *max, const int32_t *dirfile);
 
-void F77_FUNC(gdfldn, GDFLDN) (char* name, int* name_l, const int* dirfile,
-    const int* field_num);
+void F77_FUNC(gdfldn, GDFLDN) (char *name, int32_t *name_l,
+    const int32_t *dirfile, const int32_t *field_num);
 
-void F77_FUNC(gdnfld, GDNFLD) (int* nfields, const int* dirfile);
+void F77_FUNC(gdnfld, GDNFLD) (int32_t *nfields, const int32_t *dirfile);
 
-void F77_FUNC(gdnfrm, GDNFRM) (int* nframes, const int* dirfile);
+void F77_FUNC(gdnfrm, GDNFRM) (int32_t *nframes, const int32_t *dirfile);
 
-void F77_FUNC(gdgspf, GDGSPF) (int* spf, const int* dirfile,
-    const char* field_code, const int* field_code_l);
+void F77_FUNC(gdgspf, GDGSPF) (int32_t *spf, const int32_t *dirfile,
+    const char *field_code, const int32_t *field_code_l);
 
-void F77_FUNC(gdputd, GDPUTD) (int* n_wrote, const int* dirfile,
-    const char* field_code, const int* field_code_l, const int* first_frame,
-    const int* first_sample, const int* num_frames, const int* num_samples,
-    const int* data_type, const void* data_in);
+void F77_FUNC(gdputd, GDPUTD) (int32_t *n_wrote, const int32_t *dirfile,
+    const char *field_code, const int32_t *field_code_l,
+    const int32_t *first_frame, const int32_t *first_sample,
+    const int32_t *num_frames, const int32_t *num_samples,
+    const int32_t *data_type, const void *data_in);
 
-void F77_FUNC(gderor, GDEROR) (int* error, const int* dirfile);
+void F77_FUNC(gderor, GDEROR) (int32_t *error, const int32_t *dirfile);
 
-void F77_FUNC(gdestr, GDESTR) (const int* dirfile, char* buffer,
-    const int* len);
+void F77_FUNC(gdestr, GDESTR) (const int32_t *dirfile, char *buffer,
+    const int32_t *len);
 
-void F77_FUNC(gdenty, GDENTY) (int* type, const int* dirfile,
-    const char* field_code, const int* field_code_l);
+void F77_FUNC(gdenty, GDENTY) (int32_t *type, const int32_t *dirfile,
+    const char *field_code, const int32_t *field_code_l);
 
-void F77_FUNC(gdgecl, GDGECL) (int* nfields,
-    char* infield1, int* infield1_l, GD_DCOMPLEXP(m1), GD_DCOMPLEXP(b1),
-    char* infield2, int* infield2_l, GD_DCOMPLEXP(m2), GD_DCOMPLEXP(b2),
-    char* infield3, int* infield3_l, GD_DCOMPLEXP(m3), GD_DCOMPLEXP(b3),
-    int* fragment_index, const int* dirfile, const char* field_code,
-    const int* field_code_l);
+void F77_FUNC(gdgecl, GDGECL) (int32_t *nfields,
+    char *infield1, int32_t *infield1_l, GD_DCOMPLEXP(m1), GD_DCOMPLEXP(b1),
+    char *infield2, int32_t *infield2_l, GD_DCOMPLEXP(m2), GD_DCOMPLEXP(b2),
+    char *infield3, int32_t *infield3_l, GD_DCOMPLEXP(m3), GD_DCOMPLEXP(b3),
+    int32_t *fragment_index, const int32_t *dirfile, const char *field_code,
+    const int32_t *field_code_l);
 
-void F77_FUNC(gdgecp, GDGECP) (int* poly_ord,
-    char* infield, int* infield_l, GD_DCOMPLEXP(a0), GD_DCOMPLEXP(a1),
+void F77_FUNC(gdgecp, GDGECP) (int32_t *poly_ord,
+    char *infield, int32_t *infield_l, GD_DCOMPLEXP(a0), GD_DCOMPLEXP(a1),
     GD_DCOMPLEXP(a2), GD_DCOMPLEXP(a3), GD_DCOMPLEXP(a4),
-    GD_DCOMPLEXP(a5), int* fragment_index, const int* dirfile,
-    const char* field_code, const int* field_code_l);
+    GD_DCOMPLEXP(a5), int32_t *fragment_index, const int32_t *dirfile,
+    const char *field_code, const int32_t *field_code_l);
+
+void F77_FUNC(gdgerw, GDGERW) (int32_t *spf, int32_t *dtype,
+    int32_t *fragment_index, const int32_t *dirfile, const char *field_code,
+    const int32_t *field_code_l);
+
+void F77_FUNC(gdgelc, GDGELC) (int32_t *nfields,
+    char *infield1, int32_t *infield1_l, double *m1, double *b1,
+    char *infield2, int32_t *infield2_l, double *m2, double *b2,
+    char *infield3, int32_t *infield3_l, double *m3, double *b3,
+    int32_t *fragment_index, const int32_t *dirfile, const char *field_code,
+    const int32_t *field_code_l);
+
+void F77_FUNC(gdgepn, GDGEPN) (int32_t *nfields, char *infield,
+    int32_t *infield_l, double *a0, double *a1, double *a2, double *a3,
+    double *a4, double *a5, int32_t *fragment_index, const int32_t *dirfile,
+    const char *field_code, const int32_t *field_code_l);
+
+void F77_FUNC(gdgelt, GDGELT) (char *in_field, int32_t *in_field_l, char *table,
+    int32_t *table_l, int32_t *fragment_index, const int32_t *dirfile,
+    const char *field_code, const int32_t *field_code_l);
+
+void F77_FUNC(gdgebt, GDGEBT) (char *in_field, int32_t *in_field_l,
+    int32_t *bitnum, int32_t *numbits, int32_t *fragment_index,
+    const int32_t *dirfile, const char *field_code,
+    const int32_t *field_code_l);
+
+void F77_FUNC(gdgesb, GDGESB) (char *in_field, int32_t *in_field_l,
+    int32_t *bitnum, int32_t *numbits, int32_t *fragment_index,
+    const int32_t *dirfile, const char *field_code,
+    const int32_t *field_code_l);
+
+void F77_FUNC(gdgemt, GDGEMT) (char *in_field1, int32_t *in_field1_l,
+    char *in_field2, int32_t *in_field2_l, int32_t *fragment_index,
+    const int32_t *dirfile, const char *field_code,
+    const int32_t *field_code_l);
+
+void F77_FUNC(gdgeph, GDGEPH) (char *in_field, int32_t *in_field_l,
+    int32_t *shift, int32_t *fragment_index, const int32_t *dirfile,
+    const char *field_code, const int32_t *field_code_l);
+
+void F77_FUNC(gdadrw, GDADRW) (const int32_t *dirfile, const char *field_code,
+    const int32_t *field_code_l, const int32_t *data_type, const int32_t *spf,
+    const int32_t *fragment_index);
+
+void F77_FUNC(gdadlc, GDADLC) (const int32_t *dirfile, const char *field_code,
+    const int32_t *field_code_l, const int32_t *n_fields, const char *in_field1,
+    const int32_t *in_field1_l, const double *m1, const double *b1,
+    const char *in_field2, const int32_t *in_field2_l, const double *m2,
+    const double *b2, const char *in_field3, const int32_t *in_field3_l,
+    const double *m3, const double *b3, const int32_t *fragment_index);
+
+void F77_FUNC(gdadpn, GDADPN) (const int32_t *dirfile, const char *field_code,
+    const int32_t *field_code_l, const int32_t *poly_ord, const char *in_field,
+    const int32_t *in_field_l, const double *a0, const double *a1,
+    const double *a2, const double *a3, const double *a4, const double *a5,
+    const int32_t *fragment_index);
+
+void F77_FUNC(gdadlt, GDADLT) (const int32_t *dirfile, const char *field_code,
+    const int32_t *field_code_l, const char *in_field,
+    const int32_t *in_field_l, const char *table, const int32_t *table_l,
+    const int32_t *fragment_index);
+
+void F77_FUNC(gdadbt, GDADBT) (const int32_t *dirfile, const char *field_code,
+    const int32_t *field_code_l, const char *in_field,
+    const int32_t *in_field_l, const int32_t *bitnum, const int32_t *numbits,
+    const int32_t *fragment_index);
+
+void F77_FUNC(gdadmt, GDADMT) (const int32_t *dirfile, const char *field_code,
+    const int32_t *field_code_l, const char *in_field1,
+    const int32_t *in_field1_l, const char *in_field2,
+    const int32_t *in_field2_l, const int32_t *fragment_index);
+
+void F77_FUNC(gdadph, GDADPH) (const int32_t *dirfile, const char *field_code,
+    const int32_t *field_code_l, const char *in_field,
+    const int32_t *in_field_l, const int32_t *shift,
+    const int32_t *fragment_index);
+
+void F77_FUNC(gdfrgn, GDFRGN) (char *filename, int32_t *filename_l,
+    const int32_t *dirfile, const int32_t *index);
+
+void F77_FUNC(gdnfrg, GDNFRG) (int32_t *nformats, const int32_t *dirfile);
+
+void F77_FUNC(gdmfls, GDMFLS) (const int32_t *dirfile);
+
+void F77_FUNC(gdincl, GDINCL) (const int32_t *dirfile, const char *file,
+    const int32_t *file_l, const int32_t *fragment_index, const int32_t *flags);
+
+void F77_FUNC(gdnfdt, GDNFDT) (int32_t *nfields, const int32_t *dirfile,
+    const int32_t *type);
+
+void F77_FUNC(gdnvec, GDNVEC) (int32_t *nvectors, const int32_t *dirfile);
+
+void F77_FUNC(gdfdnt, GDFDNT) (char *name, int32_t *name_l,
+    const int32_t *dirfile, const int32_t *type, const int32_t *field_num);
+
+void F77_FUNC(gdvecn, GDVECN) (char *name, int32_t *name_l,
+    const int32_t *dirfile, const int32_t *field_num);
+
+void F77_FUNC(gdmdlc, GDMDLC) (const int32_t *dirfile, const char *parent,
+    const int32_t *parent_l, const char *field_code,
+    const int32_t *field_code_l, const int32_t *n_fields, const char *in_field1,
+    const int32_t *in_field1_l, const double *m1, const double *b1,
+    const char *in_field2, const int32_t *in_field2_l, const double *m2,
+    const double *b2, const char *in_field3, const int32_t *in_field3_l,
+    const double *m3, const double *b3);
+
+void F77_FUNC(gdmdpn, GDMDPN) (const int32_t *dirfile, const char *parent,
+    const int32_t *parent_l, const char *field_code,
+    const int32_t *field_code_l, const int32_t *poly_ord, const char *in_field,
+    const int32_t *in_field_l, const double *a0, const double *a1,
+    const double *a2, const double *a3, const double *a4, const double *a5);
+
+void F77_FUNC(gdmdlt, GDMDLT) (const int32_t *dirfile, const char *parent,
+    const int32_t *parent_l, const char *field_code,
+    const int32_t *field_code_l, const char *in_field,
+    const int32_t *in_field_l, const char *table, const int32_t *table_l);
+
+void F77_FUNC(gdmdbt, GDMDBT) (const int32_t *dirfile, const char *parent,
+    const int32_t *parent_l, const char *field_code,
+    const int32_t *field_code_l, const char *in_field,
+    const int32_t *in_field_l, const int32_t *bitnum, const int32_t *numbits);
+
+void F77_FUNC(gdmdsb, GDMDSB) (const int32_t *dirfile, const char *parent,
+    const int32_t *parent_l, const char *field_code,
+    const int32_t *field_code_l, const char *in_field,
+    const int32_t *in_field_l, const int32_t *bitnum, const int32_t *numbits);
+
+void F77_FUNC(gdmdmt, GDMDMT) (const int32_t *dirfile, const char *parent,
+    const int32_t *parent_l, const char *field_code,
+    const int32_t *field_code_l, const char *in_field1,
+    const int32_t *in_field1_l, const char *in_field2,
+    const int32_t *in_field2_l);
+
+void F77_FUNC(gdmdph, GDMDPH) (const int32_t *dirfile, const char *parent,
+    const int32_t *parent_l, const char *field_code,
+    const int32_t *field_code_l, const char *in_field,
+    const int32_t *in_field_l, const int32_t *shift);
+
+void F77_FUNC(gdadco, GDADCO) (const int32_t *dirfile, const char *field_code,
+    const int32_t *field_code_l, const int32_t *const_type,
+    const int32_t *data_type, const void *value, const int32_t *fragment_index);
+
+void F77_FUNC(gdmdco, GDMDCO) (const int32_t *dirfile, const char *parent,
+    const int32_t *parent_l, const char *field_code,
+    const int32_t *field_code_l, const int32_t *const_type,
+    const int32_t *data_type, const void *value);
+
+void F77_FUNC(gdadst, GDADST) (const int32_t *dirfile, const char *field_code,
+    const int32_t *field_code_l, const char *value, const int32_t *value_l,
+    const int32_t *fragment_index);
 
-void F77_FUNC(gdgerw, GDGERW) (int* spf, int* dtype, int* fragment_index,
-    const int* dirfile, const char* field_code, const int* field_code_l);
+void F77_FUNC(gdmdst, GDMDST) (const int32_t *dirfile, const char *parent,
+    const int32_t *parent_l, const char *field_code,
+    const int32_t *field_code_l, const char *value, const int32_t *value_l);
 
-void F77_FUNC(gdgelc, GDGELC) (int* nfields,
-    char* infield1, int* infield1_l, double* m1, double* b1,
-    char* infield2, int* infield2_l, double* m2, double* b2,
-    char* infield3, int* infield3_l, double* m3, double* b3,
-    int* fragment_index, const int* dirfile, const char* field_code,
-    const int* field_code_l);
-
-void F77_FUNC(gdgepn, GDGEPN) (int* nfields, char* infield, int* infield_l,
-    double* a0, double* a1, double* a2, double* a3, double* a4, double* a5,
-    int* fragment_index, const int* dirfile, const char* field_code,
-    const int* field_code_l);
-
-void F77_FUNC(gdgelt, GDGELT) (char* in_field, int* in_field_l, char* table,
-    int* table_l, int* fragment_index, const int* dirfile,
-    const char* field_code, const int* field_code_l);
-
-void F77_FUNC(gdgebt, GDGEBT) (char* in_field, int* in_field_l, int* bitnum,
-    int* numbits, int* fragment_index, const int* dirfile,
-    const char* field_code, const int* field_code_l);
-
-void F77_FUNC(gdgesb, GDGESB) (char* in_field, int* in_field_l, int* bitnum,
-    int* numbits, int* fragment_index, const int* dirfile,
-    const char* field_code, const int* field_code_l);
-
-void F77_FUNC(gdgemt, GDGEMT) (char* in_field1, int* in_field1_l,
-    char* in_field2, int* in_field2_l, int* fragment_index, const int* dirfile,
-    const char* field_code, const int* field_code_l);
-
-void F77_FUNC(gdgeph, GDGEPH) (char* in_field, int* in_field_l, int* shift,
-    int* fragment_index, const int* dirfile, const char* field_code,
-    const int* field_code_l);
-
-void F77_FUNC(gdadrw, GDADRW) (const int* dirfile, const char* field_code,
-    const int* field_code_l, const int* data_type, const int* spf,
-    const int* fragment_index);
-
-void F77_FUNC(gdadlc, GDADLC) (const int* dirfile, const char* field_code,
-    const int* field_code_l, const int* n_fields, const char* in_field1,
-    const int* in_field1_l, const double* m1, const double* b1,
-    const char* in_field2, const int* in_field2_l, const double* m2,
-    const double* b2, const char* in_field3, const int* in_field3_l,
-    const double* m3, const double* b3, const int* fragment_index);
-
-void F77_FUNC(gdadpn, GDADPN) (const int* dirfile, const char* field_code,
-    const int* field_code_l, const int* poly_ord, const char* in_field,
-    const int* in_field_l, const double* a0, const double* a1, const double* a2,
-    const double* a3, const double* a4, const double* a5,
-    const int* fragment_index);
+void F77_FUNC(gdadsp, GDADSP) (const int32_t *dirfile, const char *spec,
+    const int32_t *spec_l, const int32_t *fragment_index);
 
-void F77_FUNC(gdadlt, GDADLT) (const int* dirfile, const char* field_code,
-    const int* field_code_l, const char* in_field, const int* in_field_l,
-    const char* table, const int* table_l, const int* fragment_index);
+void F77_FUNC(gdmdsp, GDMDSP) (const int32_t *dirfile, const char *spec,
+    const int32_t *spec_l, const char *parent, const int32_t *parent_l);
 
-void F77_FUNC(gdadbt, GDADBT) (const int* dirfile, const char* field_code,
-    const int* field_code_l, const char* in_field, const int* in_field_l,
-    const int* bitnum, const int* numbits, const int* fragment_index);
+void F77_FUNC(gdfrgi, GDFRGI) (int32_t *fragment_index, const int32_t *dirfile,
+    const char *field_code, const int32_t *field_code_l);
 
-void F77_FUNC(gdadmt, GDADMT) (const int* dirfile, const char* field_code,
-    const int* field_code_l, const char* in_field1, const int* in_field1_l,
-    const char* in_field2, const int* in_field2_l, const int* fragment_index);
+void F77_FUNC(gdgtco, GDGTCO) (const int32_t *dirfile, const char *field_code,
+    const int32_t *field_code_l, const int32_t *return_type, void *data_out);
 
-void F77_FUNC(gdadph, GDADPH) (const int* dirfile, const char* field_code,
-    const int* field_code_l, const char* in_field, const int* in_field_l,
-    const int* shift, const int* fragment_index);
+void F77_FUNC(gdgtca, GDGTCA) (const int32_t *dirfile, const char *field_code,
+    const int32_t *field_code_l, const int32_t *return_type, void *data_out);
 
-void F77_FUNC(gdfrgn, GDFRGN) (char* filename, int* filename_l,
-    const int* dirfile, const int* index);
+void F77_FUNC(gdcaln, GDCALN) (int32_t *len, const int32_t *dirfile,
+    const char *field_code, const int32_t *field_code_l);
 
-void F77_FUNC(gdnfrg, GDNFRG) (int* nformats, const int* dirfile);
+void F77_FUNC(gdgcas, GDGCAS) (const int32_t *dirfile, const char *field_code,
+    const int32_t *field_code_l, const int32_t *start, const int32_t *n,
+    const int32_t *return_type, void *data_out);
 
-void F77_FUNC(gdmfls, GDMFLS) (const int* dirfile);
+void F77_FUNC(gdgtst, GDGTST) (int32_t *size, const int32_t *dirfile,
+    const char *field_code, const int32_t *field_code_l, const int32_t *len,
+    char *data_out);
 
-void F77_FUNC(gdincl, GDINCL) (const int* dirfile, const char* file,
-    const int* file_l, const int* fragment_index, const int* flags);
+void F77_FUNC(gdptco, GDPTCO) (const int32_t *dirfile, const char *field_code,
+    const int32_t *field_code_l, const int32_t *data_type, const void *data_in);
 
-void F77_FUNC(gdnfdt, GDNFDT) (int* nfields, const int* dirfile,
-    const int* type);
+void F77_FUNC(gdptca, GDPTCA) (const int32_t *dirfile, const char *field_code,
+    const int32_t *field_code_l, const int32_t *data_type, const void *data_in);
 
-void F77_FUNC(gdnvec, GDNVEC) (int* nvectors, const int* dirfile);
+void F77_FUNC(gdptst, GDPTST) (int32_t *n_read, const int32_t *dirfile,
+    const char *field_code, const int32_t *field_code_l, const int32_t *len,
+    const char *data_out);
 
-void F77_FUNC(gdfdnt, GDFDNT) (char* name, int* name_l, const int* dirfile,
-    const int* type, const int* field_num);
+void F77_FUNC(gdnmfd, GDNMFD) (int32_t *nfields, const int32_t *dirfile,
+    const char *parent, const int32_t *parent_l);
 
-void F77_FUNC(gdvecn, GDVECN) (char* name, int* name_l, const int* dirfile,
-    const int* field_num);
+void F77_FUNC(gdnmft, GDNMFT) (int32_t *nfields, const int32_t *dirfile,
+    const char *parent, const int32_t *parent_l, const int32_t *type);
 
-void F77_FUNC(gdmdlc, GDMDLC) (const int* dirfile, const char* parent,
-    const int* parent_l, const char* field_code, const int* field_code_l,
-    const int* n_fields, const char* in_field1, const int* in_field1_l,
-    const double* m1, const double* b1, const char* in_field2,
-    const int* in_field2_l, const double* m2, const double* b2,
-    const char* in_field3, const int* in_field3_l, const double* m3,
-    const double* b3);
+void F77_FUNC(gdnmve, GDNMVE) (int32_t *nvectors, const int32_t *dirfile,
+    const char *parent, const int32_t *parent_l);
 
-void F77_FUNC(gdmdpn, GDMDPN) (const int* dirfile, const char* parent,
-    const int* parent_l, const char* field_code, const int* field_code_l,
-    const int* poly_ord, const char* in_field, const int* in_field_l,
-    const double* a0, const double* a1, const double* a2, const double* a3,
-    const double* a4, const double* a5);
+void F77_FUNC(gdgeco, GDGECO) (int32_t *data_type, int32_t *fragment_index,
+    const int32_t *dirfile, const char *field_code,
+    const int32_t *field_code_l);
 
-void F77_FUNC(gdmdlt, GDMDLT) (const int* dirfile, const char* parent,
-    const int* parent_l, const char* field_code, const int* field_code_l,
-    const char* in_field, const int* in_field_l, const char* table,
-    const int* table_l);
+void F77_FUNC(gdmfnx, GDMFNX) (int32_t *max, const int32_t *dirfile,
+    const char *parent, const int32_t *parent_l);
 
-void F77_FUNC(gdmdbt, GDMDBT) (const int* dirfile, const char* parent,
-    const int* parent_l, const char* field_code, const int* field_code_l,
-    const char* in_field, const int* in_field_l, const int* bitnum,
-    const int* numbits);
+void F77_FUNC(gdmfdn, GDMFDN) (char *name, int32_t *name_l,
+    const int32_t *dirfile, const char *parent, const int32_t *parent_l,
+    const int32_t *field_num);
 
-void F77_FUNC(gdmdsb, GDMDSB) (const int* dirfile, const char* parent,
-    const int* parent_l, const char* field_code, const int* field_code_l,
-    const char* in_field, const int* in_field_l, const int* bitnum,
-    const int* numbits);
+void F77_FUNC(gdmfdt, GDMFDT) (char *name, int32_t *name_l,
+    const int32_t *dirfile, const char *parent, const int32_t *parent_l,
+    const int32_t *type, const int32_t *field_num);
 
-void F77_FUNC(gdmdmt, GDMDMT) (const int* dirfile, const char* parent,
-    const int* parent_l, const char* field_code, const int* field_code_l,
-    const char* in_field1, const int* in_field1_l, const char* in_field2,
-    const int* in_field2_l);
+void F77_FUNC(gdmven, GDMVEN) (char *name, int32_t *name_l,
+    const int32_t *dirfile, const char *parent, const int32_t *parent_l,
+    const int32_t *field_num);
 
-void F77_FUNC(gdmdph, GDMDPH) (const int* dirfile, const char* parent,
-    const int* parent_l, const char* field_code, const int* field_code_l,
-    const char* in_field, const int* in_field_l, const int* shift);
+void F77_FUNC(gddscd, GDDSCD) (const int32_t *dirfile);
 
-void F77_FUNC(gdadco, GDADCO) (const int* dirfile, const char* field_code,
-    const int* field_code_l, const int* const_type, const int* data_type,
-    const void* value, const int* fragment_index);
+void F77_FUNC(gdcopn, GDCOPN) (int32_t *dirfile, const char *dirfilename,
+    const int32_t *dirfilename_l, const int32_t *flags,
+    const _GDF_callback_t callback);
 
-void F77_FUNC(gdmdco, GDMDCO) (const int* dirfile, const char* parent,
-    const int* parent_l, const char* field_code, const int* field_code_l,
-    const int* const_type, const int* data_type, const void* value);
+void F77_FUNC(gdclbk, GDCLBK) (const int32_t *dirfile,
+    const _GDF_callback_t callback);
 
-void F77_FUNC(gdadst, GDADST) (const int* dirfile, const char* field_code,
-    const int* field_code_l, const char* value, const int* value_l,
-    const int* fragment_index);
+void F77_FUNC(gdalbt, GDALBT) (const int32_t *dirfile, const char *field_code,
+    const int32_t *field_code_l, const char *in_field,
+    const int32_t *in_field_l, const int32_t *bitnum, const int32_t *numbits);
 
-void F77_FUNC(gdmdst, GDMDST) (const int* dirfile, const char* parent,
-    const int* parent_l, const char* field_code, const int* field_code_l,
-    const char* value, const int* value_l);
+void F77_FUNC(gdalco, GDALCO) (const int32_t *dirfile, const char *field_code,
+    const int32_t *field_code_l, const int32_t *const_type);
 
-void F77_FUNC(gdadsp, GDADSP) (const int* dirfile, const char* spec,
-    const int* spec_l, const int* fragment_index);
+void F77_FUNC(gdalca, GDALCA) (const int32_t *dirfile, const char *field_code,
+    const int32_t *field_code_l, const int32_t *const_type,
+    const int32_t *array_len);
 
-void F77_FUNC(gdmdsp, GDMDSP) (const int* dirfile, const char* spec,
-    const int* spec_l, const char *parent, const int* parent_l);
+void F77_FUNC(gdallc, GDALLC) (const int32_t *dirfile, const char *field_code,
+    const int32_t *field_code_l, const int32_t *n_fields, const char *in_field1,
+    const int32_t *in_field1_l, const double *m1, const double *b1,
+    const char *in_field2, const int32_t *in_field2_l, const double *m2,
+    const double *b2, const char *in_field3, const int32_t *in_field3_l,
+    const double *m3, const double *b3);
 
-void F77_FUNC(gdfrgi, GDFRGI) (int* fragment_index, const int* dirfile,
-    const char* field_code, const int* field_code_l);
+void F77_FUNC(gdalpn, GDALPN) (const int32_t *dirfile, const char *field_code,
+    const int32_t *field_code_l, const int32_t *poly_ord, const char *in_field,
+    const int32_t *in_field_l, const double *a0, const double *a1,
+    const double *a2, const double *a3, const double *a4, const double *a5);
 
-void F77_FUNC(gdgtco, GDGTCO) (const int *dirfile, const char *field_code,
-    const int *field_code_l, const int *return_type, void *data_out);
+void F77_FUNC(gdalmt, GDALMT) (const int32_t *dirfile, const char *field_code,
+    const int32_t *field_code_l, const char *in_field1,
+    const int32_t *in_field1_l, const char *in_field2,
+    const int32_t *in_field2_l);
 
-void F77_FUNC(gdgtca, GDGTCA) (const int *dirfile, const char *field_code,
-    const int *field_code_l, const int *return_type, void *data_out);
+void F77_FUNC(gdalph, GDALPH) (const int32_t *dirfile, const char *field_code,
+    const int32_t *field_code_l, const char *in_field,
+    const int32_t *in_field_l, const int32_t *shift);
 
-void F77_FUNC(gdcaln, GDCALN) (int *len, const int *dirfile,
-    const char *field_code, const int *field_code_l);
+void F77_FUNC(gdgenc, GDGENC) (int32_t *encoding, const int32_t *dirfile,
+    const int32_t *fragment);
 
-void F77_FUNC(gdgcas, GDGCAS) (const int *dirfile, const char *field_code,
-    const int *field_code_l, const int *start, const int *n,
-    const int *return_type, void *data_out);
+void F77_FUNC(gdgend, GDGEND) (int32_t *endianness, const int32_t *dirfile,
+    const int32_t *fragment);
 
-void F77_FUNC(gdgtst, GDGTST) (int *size, const int *dirfile,
-    const char *field_code, const int *field_code_l, const int *len,
-    char *data_out);
+void F77_FUNC(gdname, GDNAME) (char *name, int32_t *name_l,
+    const int32_t *dirfile);
 
-void F77_FUNC(gdptco, GDPTCO) (const int *dirfile, const char *field_code,
-    const int *field_code_l, const int *data_type, const void *data_in);
+void F77_FUNC(gdpfrg, GDPFRG) (int32_t *parent, const int32_t *dirfile,
+    const int32_t *fragment);
 
-void F77_FUNC(gdptca, GDPTCA) (const int *dirfile, const char *field_code,
-    const int *field_code_l, const int *data_type, const void *data_in);
+void F77_FUNC(gdprot, GDPROT) (const int32_t *dirfile, const int32_t *fragment, 
+    const int32_t *protection_level);
 
-void F77_FUNC(gdptst, GDPTST) (int* n_read, const int* dirfile,
-    const char* field_code, const int* field_code_l, const int* len,
-    const char* data_out);
+void F77_FUNC(gdgprt, GDGPRT) (int32_t *protection_level,
+    const int32_t *dirfile, const int32_t *fragment);
 
-void F77_FUNC(gdnmfd, GDNMFD) (int* nfields, const int* dirfile,
-    const char* parent, const int* parent_l);
+void F77_FUNC(gdrwfn, GDRWFN) (char *name, int32_t *name_l,
+    const int32_t *dirfile, const char *field_code,
+    const int32_t *field_code_l);
 
-void F77_FUNC(gdnmft, GDNMFT) (int* nfields, const int* dirfile,
-    const char* parent, const int* parent_l, const int* type);
+void F77_FUNC(gdrefe, GDREFE) (char *name, int32_t *name_l,
+    const int32_t *dirfile, const char *field_code,
+    const int32_t *field_code_l);
 
-void F77_FUNC(gdnmve, GDNMVE) (int* nvectors, const int* dirfile,
-    const char* parent, const int* parent_l);
+void F77_FUNC(gdaenc, GDAENC) (const int32_t *dirfile, const int32_t *encoding,
+    const int32_t *fragment, const int32_t *recode);
 
-void F77_FUNC(gdgeco, GDGECO) (int* data_type, int* fragment_index,
-    const int* dirfile, const char* field_code, const int* field_code_l);
+void F77_FUNC(gdaend, GDAEND) (const int32_t *dirfile,
+    const int32_t *endianness, const int32_t *fragment, const int32_t *recode);
 
-void F77_FUNC(gdmfnx, GDMFNX) (int* max, const int* dirfile, const char* parent,
-    const int* parent_l);
+void F77_FUNC(gdallt, GDALLT) (const int32_t *dirfile, const char *field_code,
+    const int32_t *field_code_l, const char *in_field,
+    const int32_t *in_field_l, const char *table, const int32_t *table_l,
+    const int32_t *recode);
 
-void F77_FUNC(gdmfdn, GDMFDN) (char* name, int* name_l, const int* dirfile,
-    const char* parent, const int* parent_l, const int* field_num);
+void F77_FUNC(gdalrw, GDALRW) (const int32_t *dirfile, const char *field_code,
+    const int32_t *field_code_l, const int32_t *data_type, const int32_t *spf,
+    const int32_t *recode);
 
-void F77_FUNC(gdmfdt, GDMFDT) (char* name, int* name_l, const int* dirfile,
-    const char* parent, const int* parent_l, const int* type,
-    const int* field_num);
+void F77_FUNC(gdalsp, GDALSP) (const int32_t *dirfile, const char *spec,
+    const int32_t *spec_l, const int32_t *fragment_index);
 
-void F77_FUNC(gdmven, GDMVEN) (char* name, int* name_l, const int* dirfile,
-    const char* parent, const int* parent_l, const int* field_num);
+void F77_FUNC(gddele, GDDELE) (const int32_t *dirfile, const char *field_code,
+    const int32_t *field_code_l, const int32_t *flags);
 
-void F77_FUNC(gddscd, GDDSCD) (const int* dirfile);
+void F77_FUNC(gdmlsp, GDMLSP) (const int32_t *dirfile, const char *spec,
+    const int32_t *spec_l, const char *parent, const int32_t *parent_l,
+    const int32_t *recode);
 
-void F77_FUNC(gdcopn, GDCOPN) (int* dirfile, const char* dirfilename,
-    const int* dirfilename_l, const int* flags, const void* callback);
+void F77_FUNC(gdmove, GDMOVE) (const int32_t *dirfile, const char *field_code,
+    const int32_t *field_code_l, const int32_t *new_fragment,
+    const int32_t *move_data);
 
-void F77_FUNC(gdclbk, GDCLBK) (const int* dirfile, const void* callback);
+void F77_FUNC(gdrenm, GDRENM) (const int32_t *dirfile, const char *field_code,
+    const int32_t *field_code_l, const char *new_name,
+    const int32_t *new_name_l, const int32_t *move_data);
 
-void F77_FUNC(gdalbt, GDALBT) (const int* dirfile, const char* field_code,
-    const int* field_code_l, const char* in_field, const int* in_field_l,
-    int* bitnum, int* numbits);
+void F77_FUNC(gduinc, GDUINC) (const int32_t *dirfile, const int32_t *fragment,
+    const int32_t *del);
 
-void F77_FUNC(gdalco, GDALCO) (const int* dirfile, const char* field_code,
-    const int* field_code_l, const int* const_type);
+void F77_FUNC(gdafof, GDAFOF) (const int32_t *dirfile, const int32_t *offset,
+    const int32_t *fragment, const int32_t *recode);
 
-void F77_FUNC(gdalca, GDALCA) (const int* dirfile, const char* field_code,
-    const int* field_code_l, const int* const_type, const int *array_len);
+void F77_FUNC(gdgfof, GDGFOF) (int32_t *offset, const int32_t *dirfile,
+    const int32_t *fragment);
 
-void F77_FUNC(gdallc, GDALLC) (const int* dirfile, const char* field_code,
-    const int* field_code_l, const int* n_fields, const char* in_field1,
-    const int* in_field1_l, const double* m1, const double* b1,
-    const char* in_field2, const int* in_field2_l, const double* m2,
-    const double* b2, const char* in_field3, const int* in_field3_l,
-    const double* m3, const double* b3);
+void F77_FUNC(gdadcl, GDADCL) (const int32_t *dirfile, const char *field_code,
+    const int32_t *field_code_l, const int32_t *n_fields, const char *in_field1,
+    const int32_t *in_field1_l, const GD_DCOMPLEXP(m1), const GD_DCOMPLEXP(b1),
+    const char *in_field2, const int32_t *in_field2_l, const GD_DCOMPLEXP(m2),
+    const GD_DCOMPLEXP(b2), const char *in_field3, const int32_t *in_field3_l,
+    const GD_DCOMPLEXP(m3), const GD_DCOMPLEXP(b3),
+    const int32_t *fragment_index);
 
-void F77_FUNC(gdalpn, GDALPN) (const int* dirfile, const char* field_code,
-    const int* field_code_l, const int* poly_ord, const char* in_field,
-    const int* in_field_l, const double* a0, const double* a1, const double* a2,
-    const double* a3, const double* a4, const double* a5);
+void F77_FUNC(gdadcp, GDADCP) (const int32_t *dirfile, const char *field_code,
+    const int32_t *field_code_l, const int32_t *poly_ord, const char *in_field,
+    const int32_t *in_field_l, const GD_DCOMPLEXP(a0), const GD_DCOMPLEXP(a1),
+    const GD_DCOMPLEXP(a2), const GD_DCOMPLEXP(a3),
+    const GD_DCOMPLEXP(a4), const GD_DCOMPLEXP(a5),
+    const int32_t *fragment_index);
+
+void F77_FUNC(gdmdcl, GDMDCL) (const int32_t *dirfile, const char *parent,
+    const int32_t *parent_l, const char *field_code,
+    const int32_t *field_code_l, const int32_t *n_fields, const char *in_field1,
+    const int32_t *in_field1_l, const GD_DCOMPLEXP(m1), const GD_DCOMPLEXP(b1),
+    const char *in_field2, const int32_t *in_field2_l, const GD_DCOMPLEXP(m2),
+    const GD_DCOMPLEXP(b2), const char *in_field3, const int32_t *in_field3_l,
+    const GD_DCOMPLEXP(m3), const GD_DCOMPLEXP(b3));
 
-void F77_FUNC(gdalmt, GDALMT) (const int* dirfile, const char* field_code,
-    const int* field_code_l, const char* in_field1, const int* in_field1_l,
-    const char* in_field2, const int* in_field2_l);
+void F77_FUNC(gdmdcp, GDMDCP) (const int32_t *dirfile, const char *parent,
+    const int32_t *parent_l, const char *field_code,
+    const int32_t *field_code_l, const int32_t *poly_ord, const char *in_field,
+    const int32_t *in_field_l, const GD_DCOMPLEXP(a0), const GD_DCOMPLEXP(a1),
+    const GD_DCOMPLEXP(a2), const GD_DCOMPLEXP(a3),
+    const GD_DCOMPLEXP(a4), const GD_DCOMPLEXP(a5));
 
-void F77_FUNC(gdalph, GDALPH) (const int* dirfile, const char* field_code,
-    const int* field_code_l, const char* in_field, const int* in_field_l,
-    const int* shift);
+void F77_FUNC(gdntyp, GDNTYP) (int32_t *type, const int32_t *dirfile,
+    const char *field_code, const int32_t *field_code_l);
 
-void F77_FUNC(gdgenc, GDGENC) (int* encoding, const int* dirfile,
-    const int* fragment);
+void F77_FUNC(gdalcl, GDALCL) (const int32_t *dirfile, const char *field_code,
+    const int32_t *field_code_l, const int32_t *n_fields, const char *in_field1,
+    const int32_t *in_field1_l, const GD_DCOMPLEXP(m1), const GD_DCOMPLEXP(b1),
+    const char *in_field2, const int32_t *in_field2_l, const GD_DCOMPLEXP(m2),
+    const GD_DCOMPLEXP(b2), const char *in_field3, const int32_t *in_field3_l,
+    const GD_DCOMPLEXP(m3), const GD_DCOMPLEXP(b3));
 
-void F77_FUNC(gdgend, GDGEND) (int* endianness, const int* dirfile,
-    const int* fragment);
+void F77_FUNC(gdalcp, GDALCP) (const int32_t *dirfile, const char *field_code,
+    const int32_t *field_code_l, const int32_t *poly_ord, const char *in_field,
+    const int32_t *in_field_l, const GD_DCOMPLEXP(a0), const GD_DCOMPLEXP(a1),
+    const GD_DCOMPLEXP(a2), const GD_DCOMPLEXP(a3),
+    const GD_DCOMPLEXP(a4), const GD_DCOMPLEXP(a5));
 
-void F77_FUNC(gdname, GDNAME) (char* name, int* name_l, const int* dirfile);
+void F77_FUNC(gdcscl, GDCSCL) (int32_t *comp_scal, const int32_t *dirfile,
+    const char *field_code, const int32_t *field_code_l);
 
-void F77_FUNC(gdpfrg, GDPFRG) (int* parent, const int* dirfile,
-    const int* fragment);
+void F77_FUNC(gdvldt, GDVLDT) (int32_t *valid, const int32_t *dirfile,
+    const char *field_code, const int32_t *field_code_l);
 
-void F77_FUNC(gdprot, GDPROT) (const int* dirfile, const int* fragment, 
-    const int* protection_level);
+void F77_FUNC(gdfnum, GDFNUM) (double *framenum, const int32_t *dirfile,
+    const char *field_code, const int32_t *field_code_l, const double *value);
 
-void F77_FUNC(gdgprt, GDGPRT) (int* protection_level, const int* dirfile,
-    const int* fragment);
+void F77_FUNC(gdfnss, GDFNSS) (double *framenum, const int32_t *dirfile,
+    const char *field_code, const int32_t *field_code_l, const double *value,
+    const int32_t *start, const int32_t *end);
 
-void F77_FUNC(gdrwfn, GDRWFN) (char* name, int* name_l, const int* dirfile,
-    const char* field_code, const int* field_code_l);
+void F77_FUNC(gdgsca, GDGSCA) (char *scalar, int32_t *scalar_l,
+    int32_t *scalar_index, const int32_t *dirfile, const char *field_code,
+    const int32_t *field_code_l, const int32_t *index);
 
-void F77_FUNC(gdrefe, GDREFE) (char* name, int* name_l, const int* dirfile,
-    const char* field_code, const int *field_code_l);
+void F77_FUNC(gdasca, GDASCA) (const int32_t *dirfile, const char *field_code,
+    const int32_t *field_code_l, const int32_t *index, const char *scalar,
+    const int32_t *scalar_l, int32_t *scalar_index, int32_t *recode);
 
-void F77_FUNC(gdaenc, GDAENC) (const int* dirfile, const int* encoding,
-    const int* fragment, const int* recode);
+void F77_FUNC(gdalsb, GDALSB) (const int32_t *dirfile, const char *field_code,
+    const int32_t *field_code_l, const char *in_field,
+    const int32_t *in_field_l, const int32_t *bitnum, const int32_t *numbits);
 
-void F77_FUNC(gdaend, GDAEND) (const int* dirfile, const int* endianness,
-    const int* fragment, const int* recode);
+void F77_FUNC(gdadsb, GDADSB) (const int32_t *dirfile, const char *field_code,
+    const int32_t *field_code_l, const char *in_field,
+    const int32_t *in_field_l, const int32_t *bitnum, const int32_t *numbits,
+    const int32_t *fragment_index);
 
-void F77_FUNC(gdallt, GDALLT) (const int* dirfile, const char* field_code,
-    const int* field_code_l, const char* in_field, const int* in_field_l,
-    const char* table, const int* table_l, const int* recode);
+void F77_FUNC(gdinvd, GDINVD) (int32_t *dirfile);
 
-void F77_FUNC(gdalrw, GDALRW) (const int* dirfile, const char* field_code,
-    const int* field_code_l, const int* data_type, const int* spf,
-    const int* recode);
+void F77_FUNC(gdstdv, GDSTDV) (int32_t *vers, const int32_t *dirfile);
 
-void F77_FUNC(gdalsp, GDALSP) (const int* dirfile, const char* spec,
-    const int* spec_l, const int* fragment_index);
+void F77_FUNC(gdgbof, GDGBOF) (int32_t *bof, const int32_t *dirfile,
+    const char *field_code, const int32_t *field_code_l);
 
-void F77_FUNC(gddele, GDDELE) (const int* dirfile, const char* field_code,
-    const int* field_code_l, const int* flags);
+void F77_FUNC(gdgeof, GDGEOF) (int32_t *eof, const int32_t *dirfile,
+    const char *field_code, const int32_t *field_code_l);
 
-void F77_FUNC(gdmlsp, GDMLSP) (const int* dirfile, const char* spec,
-    const int* spec_l, const char* parent, const int* parent_l,
-    const int* recode);
+void F77_FUNC(gdgedv, GDGEDV) (char *in_field1, int32_t *in_field1_l,
+    char *in_field2, int32_t *in_field2_l, int32_t *fragment_index,
+    const int32_t *dirfile, const char *field_code,
+    const int32_t *field_code_l);
 
-void F77_FUNC(gdmove, GDMOVE) (const int* dirfile, const char* field_code,
-    const int* field_code_l, const int* new_fragment, const int* move_data);
+void F77_FUNC(gdgerc, GDGERC) (char *in_field, int32_t *in_field_l,
+    double *dividend, int32_t *fragment_index, const int32_t *dirfile,
+    const char *field_code, const int32_t *field_code_l);
 
-void F77_FUNC(gdrenm, GDRENM) (const int* dirfile, const char* field_code,
-    const int* field_code_l, const char* new_name, const int* new_name_l,
-    const int* move_data);
+void F77_FUNC(gdgecr, GDGECR) (char *in_field, int32_t *in_field_l,
+    GD_DCOMPLEXP(cdividend), int32_t *fragment_index, const int32_t *dirfile,
+    const char *field_code, const int32_t *field_code_l);
 
-void F77_FUNC(gduinc, GDUINC) (const int* dirfile, const int* fragment,
-    const int* del);
+void F77_FUNC(gdaddv, GDADDV) (const int32_t *dirfile, const char *field_code,
+    const int32_t *field_code_l, const char *in_field1,
+    const int32_t *in_field1_l, const char *in_field2,
+    const int32_t *in_field2_l, const int32_t *fragment_index);
 
-void F77_FUNC(gdafof, GDAFOF) (const int* dirfile, const int* offset,
-    const int* fragment, const int* recode);
+void F77_FUNC(gdadrc, GDADRC) (const int32_t *dirfile, const char *field_code,
+    const int32_t *field_code_l, const char *in_field,
+    const int32_t *in_field_l, const double *dividend,
+    const int32_t *fragment_index);
 
-void F77_FUNC(gdgfof, GDGFOF) (int* offset, const int* dirfile,
-    const int* fragment);
+void F77_FUNC(gdadcr, GDADCR) (const int32_t *dirfile, const char *field_code,
+    const int32_t *field_code_l, const char *in_field,
+    const int32_t *in_field_l, const GD_DCOMPLEXP(cdividend),
+    const int32_t *fragment_index);
 
-void F77_FUNC(gdadcl, GDADCL) (const int* dirfile, const char* field_code,
-    const int* field_code_l, const int* n_fields, const char* in_field1,
-    const int* in_field1_l, const GD_DCOMPLEXP(m1), const GD_DCOMPLEXP(b1),
-    const char* in_field2, const int* in_field2_l, const GD_DCOMPLEXP(m2),
-    const GD_DCOMPLEXP(b2), const char* in_field3, const int* in_field3_l,
-    const GD_DCOMPLEXP(m3), const GD_DCOMPLEXP(b3),
-    const int* fragment_index);
+void F77_FUNC(gdmddv, GDMDDV) (const int32_t *dirfile, const char *parent,
+    const int32_t *parent_l, const char *field_code,
+    const int32_t *field_code_l, const char *in_field1,
+    const int32_t *in_field1_l, const char *in_field2,
+    const int32_t *in_field2_l);
 
-void F77_FUNC(gdadcp, GDADCP) (const int* dirfile, const char* field_code,
-    const int* field_code_l, const int* poly_ord, const char* in_field,
-    const int* in_field_l, const GD_DCOMPLEXP(a0), const GD_DCOMPLEXP(a1),
-    const GD_DCOMPLEXP(a2), const GD_DCOMPLEXP(a3),
-    const GD_DCOMPLEXP(a4), const GD_DCOMPLEXP(a5),
-    const int* fragment_index);
-
-void F77_FUNC(gdmdcl, GDMDCL) (const int* dirfile, const char* parent,
-    const int* parent_l, const char* field_code, const int* field_code_l,
-    const int* n_fields, const char* in_field1, const int* in_field1_l,
-    const GD_DCOMPLEXP(m1), const GD_DCOMPLEXP(b1), const char* in_field2,
-    const int* in_field2_l, const GD_DCOMPLEXP(m2), const GD_DCOMPLEXP(b2),
-    const char* in_field3, const int* in_field3_l, const GD_DCOMPLEXP(m3),
-    const GD_DCOMPLEXP(b3));
-
-void F77_FUNC(gdmdcp, GDMDCP) (const int* dirfile, const char* parent,
-    const int* parent_l, const char* field_code, const int* field_code_l,
-    const int* poly_ord, const char* in_field, const int* in_field_l,
-    const GD_DCOMPLEXP(a0), const GD_DCOMPLEXP(a1),
-    const GD_DCOMPLEXP(a2), const GD_DCOMPLEXP(a3),
-    const GD_DCOMPLEXP(a4), const GD_DCOMPLEXP(a5));
+void F77_FUNC(gdrfrg, GDRFRG) (const int32_t *dirfile, const int32_t *fragment);
 
-void F77_FUNC(gdntyp, GDNTYP) (int* type, const int* dirfile,
-    const char* field_code, const int* field_code_l);
+void F77_FUNC(gdmdrc, GDMDRC) (const int32_t *dirfile, const char *parent,
+    const int32_t *parent_l, const char *field_code,
+    const int32_t *field_code_l, const char *in_field,
+    const int32_t *in_field_l, const double *dividend);
 
-void F77_FUNC(gdalcl, GDALCL) (const int* dirfile, const char* field_code,
-    const int* field_code_l, const int* n_fields, const char* in_field1,
-    const int* in_field1_l, const GD_DCOMPLEXP(m1), const GD_DCOMPLEXP(b1),
-    const char* in_field2, const int* in_field2_l, const GD_DCOMPLEXP(m2),
-    const GD_DCOMPLEXP(b2), const char* in_field3, const int* in_field3_l,
-    const GD_DCOMPLEXP(m3), const GD_DCOMPLEXP(b3));
+void F77_FUNC(gdmdcr, GDMDCR) (const int32_t *dirfile, const char *parent,
+    const int32_t *parent_l, const char *field_code,
+    const int32_t *field_code_l, const char *in_field,
+    const int32_t *in_field_l, const GD_DCOMPLEXP(cdividend));
 
-void F77_FUNC(gdalcp, GDALCP) (const int* dirfile, const char* field_code,
-    const int* field_code_l, const int* poly_ord, const char* in_field,
-    const int* in_field_l, const GD_DCOMPLEXP(a0), const GD_DCOMPLEXP(a1),
-    const GD_DCOMPLEXP(a2), const GD_DCOMPLEXP(a3),
-    const GD_DCOMPLEXP(a4), const GD_DCOMPLEXP(a5));
+void F77_FUNC(gdaldv, GDALDV) (const int32_t *dirfile, const char *field_code,
+    const int32_t *field_code_l, const char *in_field1,
+    const int32_t *in_field1_l, const char *in_field2,
+    const int32_t *in_field2_l);
+
+void F77_FUNC(gdalrc, GDALRC) (const int32_t *dirfile, const char *field_code,
+    const int32_t *field_code_l, const char *in_field1,
+    const int32_t *in_field1_l, const double *dividend);
+
+void F77_FUNC(gdalcr, GDALCR) (const int32_t *dirfile, const char *field_code,
+    const int32_t *field_code_l, const char *in_field1,
+    const int32_t *in_field1_l, const GD_DCOMPLEXP(cdividend));
+
+void F77_FUNC(gdaprt, GDAPRT) (const int32_t *dirfile,
+    const int32_t *protection_level, const int32_t *fragment);
+
+void F77_FUNC(gdgeca, GDGECA) (int32_t *data_type, int32_t *array_len,
+    int32_t *fragment_index, const int32_t *dirfile, const char *field_code,
+    const int32_t *field_code_l);
+
+void F77_FUNC(gdadca, GDADCA) (const int32_t *dirfile, const char *field_code,
+    const int32_t *field_code_l, const int32_t *const_type, int32_t *array_len,
+    const int32_t *data_type, const void *value, const int32_t *fragment_index);
+
+void F77_FUNC(gdmdca, GDMDCA) (const int32_t *dirfile, const char *parent,
+    const int32_t *parent_l, const char *field_code,
+    const int32_t *field_code_l, const int32_t *const_type,
+    const int32_t *array_len, const int32_t *data_type, const void *value);
+
+void F77_FUNC(gdpcas, GDPCAS) (const int32_t *dirfile, const char *field_code,
+    const int32_t *field_code_l, const int32_t *start, const int32_t *n,
+    const int32_t *data_type, const void *data_in);
+
+void F77_FUNC(gdseek, GDSEEK) (int32_t *pos, const int32_t *dirfile,
+    const char *field_code, const int32_t *field_code_l,
+    const int32_t *frame_num, const int32_t *sample_num, const int32_t *flags);
+
+void F77_FUNC(gdtell, GDTELL) (int32_t *pos, const int32_t *dirfile,
+    const char *field_code, const int32_t *field_code_l);
+
+void F77_FUNC(gdcons, GDCONS) (void *value, const int32_t *dirfile,
+    const int32_t *return_type, const int32_t *field_num);
+
+void F77_FUNC(gdmcos, GDMCOS) (void *value, const int32_t *dirfile,
+    const char *parent, const int32_t *parent_l, const int32_t *return_type,
+    const int32_t *field_num);
+
+void F77_FUNC(gdstrs, GDSTRS) (char *value, int32_t *value_l,
+    const int32_t *dirfile, const int32_t *field_num);
+
+void F77_FUNC(gdmsts, GDMSTS) (void *value, int32_t *value_l,
+    const int32_t *dirfile, const char *parent, const int32_t *parent_l,
+    const int32_t *field_num);
+
+void F77_FUNC(gdstrx, GDSTRX) (int32_t *max, const int32_t *dirfile);
+
+void F77_FUNC(gdmstx, GDMSTX) (int32_t *max, const int32_t *dirfile,
+    const char *parent, const int32_t *parent_l);
+
+void F77_FUNC(gdadwd, GDADWD) (const int32_t *dirfile, const char *field_code,
+    const int32_t *field_code_l, const char *in_field,
+    const int32_t *in_field_l, const char *check_field,
+    const int32_t *check_field_l, const int32_t *windop,
+    const void *threshold, const int32_t *fragment_index);
+
+void F77_FUNC(gdmdwd, GDMDWD) (const int32_t *dirfile, const char *parent,
+    const int32_t *parent_l, const char *field_code,
+    const int32_t *field_code_l, const char *in_field,
+    const int32_t *in_field_l, const char *check_field,
+    const int32_t *check_field_l, const int32_t *windop, const void *threshold);
+
+void F77_FUNC(gdalwd, GDALWD) (const int32_t *dirfile, const char *field_code,
+    const int32_t *field_code_l, const char *in_field,
+    const int32_t *in_field_l, const char *check_field,
+    const int32_t *check_field_l, const int32_t *windop, const void *threshold);
+
+void F77_FUNC(gdadmx, GDADMX) (const int32_t *dirfile, const char *field_code,
+    const int32_t *field_code_l, const char *in_field,
+    const int32_t *in_field_l, const char *count_field,
+    const int32_t *count_field_l, const int32_t *val, const int32_t *max,
+    const int32_t *fragment_index);
+
+void F77_FUNC(gdmdmx, GDMDMX) (const int32_t *dirfile, const char *parent,
+    const int32_t *parent_l, const char *field_code,
+    const int32_t *field_code_l, const char *in_field,
+    const int32_t *in_field_l, const char *count_field,
+    const int32_t *count_field_l, const int32_t *val, const int32_t *max);
 
-void F77_FUNC(gdcscl, GDCSCL) (int *comp_scal, const int *dirfile,
-    const char *field_code, const int *field_code_l);
+void F77_FUNC(gdalmx, GDALMX) (const int32_t *dirfile, const char *field_code,
+    const int32_t *field_code_l, const char *in_field,
+    const int32_t *in_field_l, const char *count_field,
+    const int32_t *count_field_l, const int32_t *val, const int32_t *max);
 
-void F77_FUNC(gdvldt, GDVLDT) (int *valid, const int *dirfile,
-    const char *field_code, const int *field_code_l);
+void F77_FUNC(gdsync, GDSYNC) (const int32_t *dirfile, const char *field_code,
+    const int32_t *field_code_l);
 
-void F77_FUNC(gdfnum, GDFNUM) (double *framenum, const int *dirfile,
-    const char *field_code, const int *field_code_l, const double *value);
+void F77_FUNC(gdrclo, GDRCLO) (const int32_t *dirfile, const char *field_code,
+    const int32_t *field_code_l);
 
-void F77_FUNC(gdfnss, GDFNSS) (double *framenum, const int *dirfile,
-    const char *field_code, const int *field_code_l, const double *value,
-    const int *start, const int *end);
+void F77_FUNC(gdinca, GDINCA) (const int32_t *dirfile, const char *file,
+    const int32_t *file_l, const int32_t *fragment_index, const char *prefix,
+    const int32_t *prefix_l, const char *suffix, const int32_t *suffix_l,
+    const int32_t *flags);
 
-void F77_FUNC(gdgsca, GDGSCA) (char* scalar, int* scalar_l, int *scalar_index,
-    const int* dirfile, const char* field_code, const int *field_code_l,
-    const int* index);
+void F77_FUNC(gdmova, GDMOVA) (const int32_t *dirfile, const char *field_code,
+    const int32_t *field_code_l, const int32_t *new_fragment);
 
-void F77_FUNC(gdasca, GDASCA) (const int* dirfile, const char* field_code,
-    const int *field_code_l, const int *index, const char *scalar,
-    const int *scalar_l, int *scalar_index, int* recode);
+void F77_FUNC(gdmdal, GDMDAL) (const int32_t *dirfile, const char *parent,
+    const int32_t *parent_l, const char *field_code,
+    const int32_t *field_code_l, const char *target, const int32_t *target_l);
 
-void F77_FUNC(gdalsb, GDALSB) (const int* dirfile, const char* field_code,
-    const int* field_code_l, const char* in_field, const int* in_field_l,
-    int* bitnum, int* numbits);
+void F77_FUNC(gduhid, GDUHID) (const int32_t *dirfile, const char *field_code,
+    const int32_t *field_code_l);
 
-void F77_FUNC(gdadsb, GDADSB) (const int* dirfile, const char* field_code,
-    const int* field_code_l, const char* in_field, const int* in_field_l,
-    const int* bitnum, const int* numbits, const int* fragment_index);
+void F77_FUNC(gdhide, GDHIDE) (const int32_t *dirfile, const char *field_code,
+    const int32_t *field_code_l);
 
-void F77_FUNC(gdinvd, GDINVD) (int *dirfile);
+void F77_FUNC(gdhidn, GDHIDN) (int32_t *result, const int32_t *dirfile,
+    const char *field_code, const int32_t *field_code_l);
 
-void F77_FUNC(gdstdv, GDSTDV) (int *vers, const int *dirfile);
+void F77_FUNC(gdfraf, GDFRAF) (char *prefix, int32_t *prefix_l, char *suffix,
+    int32_t *suffix_l, const int32_t *dirfile, const int32_t *index);
 
-void F77_FUNC(gdgbof, GDGBOF) (int* bof, const int* dirfile,
-    const char* field_code, const int* field_code_l);
+void F77_FUNC(gddela, GDDELA) (const int32_t *dirfile, const char *field_code,
+    const int32_t *field_code_l, const int32_t *flags);
 
-void F77_FUNC(gdgeof, GDGEOF) (int* eof, const int* dirfile,
-    const char* field_code, const int* field_code_l);
+void F77_FUNC(gdaafx, GDAAFX) (const int32_t *dirfile, const int32_t *index,
+    const char *prefix, const int32_t *prefix_l, const char *suffix,
+    const int32_t *suffix_l);
 
-void F77_FUNC(gdgedv, GDGEDV) (char* in_field1, int* in_field1_l,
-    char* in_field2, int* in_field2_l, int* fragment_index, const int* dirfile,
-    const char* field_code, const int* field_code_l);
+void F77_FUNC(gdalss, GDALSS) (char *alias, int32_t *alias_l,
+    const int32_t *dirfile, const char *field_code,
+    const int32_t *field_code_l, const int32_t *num);
 
-void F77_FUNC(gdgerc, GDGERC) (char* in_field, int* in_field_l,
-    double* dividend, int* fragment_index, const int* dirfile,
-    const char* field_code, const int* field_code_l);
+void F77_FUNC(gdnals, GDNALS) (int32_t *nalias, const int32_t *dirfile,
+    const char *field_code, const int32_t *field_code_l);
 
-void F77_FUNC(gdgecr, GDGECR) (char* in_field, int* in_field_l,
-    GD_DCOMPLEXP(cdividend), int* fragment_index, const int* dirfile,
-    const char* field_code, const int* field_code_l);
+void F77_FUNC(gdalsx, GDALSX) (int32_t *max, const int32_t *dirfile,
+    const char *field_code, const int32_t *field_code_l);
 
-void F77_FUNC(gdaddv, GDADDV) (const int* dirfile, const char* field_code,
-    const int* field_code_l, const char* in_field1, const int* in_field1_l,
-    const char* in_field2, const int* in_field2_l, const int* fragment_index);
+void F77_FUNC(gdatrg, GDATRG) (char *target, int32_t *target_l,
+    const int32_t *dirfile, const char *field_code,
+    const int32_t *field_code_l);
 
-void F77_FUNC(gdadrc, GDADRC) (const int* dirfile, const char* field_code,
-    const int* field_code_l, const char* in_field, const int* in_field_l,
-    const double* dividend, const int* fragment_index);
+void F77_FUNC(gdadal, GDADAL) (const int32_t *dirfile, const char *field_code,
+    const int32_t *field_code_l, const char *target, const int32_t *target_l,
+    const int32_t *fragment_index);
 
-void F77_FUNC(gdadcr, GDADCR) (const int* dirfile, const char* field_code,
-    const int* field_code_l, const char* in_field, const int* in_field_l,
-    const GD_DCOMPLEXP(cdividend), const int* fragment_index);
+void F77_FUNC(gdnocb, GDNOCB) (const int32_t *dirfile);
 
-void F77_FUNC(gdmddv, GDMDDV) (const int* dirfile, const char* parent,
-    const int* parent_l, const char* field_code, const int* field_code_l,
-    const char* in_field1, const int* in_field1_l, const char* in_field2,
-    const int* in_field2_l);
+void F77_FUNC(gddsyn, GDDSYN) (int32_t *desync, const int32_t *dirfile,
+    const int32_t *flags);
 
-void F77_FUNC(gdrfrg, GDRFRG) (const int* dirfile, const int* fragment);
+void F77_FUNC(gdflag, GDFLAG) (int32_t *flags, const int32_t *dirfile,
+    const int32_t *set, const int32_t *reset);
 
-void F77_FUNC(gdmdrc, GDMDRC) (const int* dirfile, const char* parent,
-    const int* parent_l, const char* field_code, const int* field_code_l,
-    const char* in_field, const int* in_field_l, const double* dividend);
+void F77_FUNC(gdvbpx, GDVBPX) (const int32_t *dirfile, const char *prefix,
+    const int32_t *prefix_l);
 
-void F77_FUNC(gdmdcr, GDMDCR) (const int* dirfile, const char* parent,
-    const int* parent_l, const char* field_code, const int* field_code_l,
-    const char* in_field, const int* in_field_l,
-    const GD_DCOMPLEXP(cdividend));
+void F77_FUNC(gdmxlb, GDMXLB) (const int32_t *dirfile, const int32_t *lookback);
 
-void F77_FUNC(gdaldv, GDALDV) (const int* dirfile, const char* field_code,
-    const int* field_code_l, const char* in_field1, const int* in_field1_l,
-    const char* in_field2, const int* in_field2_l);
+void F77_FUNC(gdnent, GDNENT) (int32_t *nentries, const int32_t *dirfile,
+    const char *parent, const int32_t *parent_l, const int32_t *type,
+    const int32_t *flags);
 
-void F77_FUNC(gdalrc, GDALRC) (const int* dirfile, const char* field_code,
-    const int* field_code_l, const char* in_field1, const int* in_field1_l,
-    const double* dividend);
+void F77_FUNC(gdentx, GDENTX) (int32_t *max, const int32_t *dirfile,
+    const char *parent, const int32_t *parent_l, const int32_t *type,
+    const int32_t *flags);
 
-void F77_FUNC(gdalcr, GDALCR) (const int* dirfile, const char* field_code,
-    const int* field_code_l, const char* in_field1, const int* in_field1_l,
-    const GD_DCOMPLEXP(cdividend));
+void F77_FUNC(gdentn, GDENTN) (char *name, int32_t *name_l,
+    const int32_t *dirfile, const char *parent, const int32_t *parent_l,
+    const int32_t *type, const int32_t *flags, const int32_t *field_num);
 
-void F77_FUNC(gdaprt, GDAPRT) (const int* dirfile, const int* protection_level,
-    const int* fragment);
+void F77_FUNC(gdgewd, GDGEWD) (char *in_field, int32_t *in_field_l,
+    char *check_field, int32_t *check_field_l, int32_t *windop,
+    int32_t *ithreshold, double *rthreshold, int32_t *fragment_index,
+    const int32_t *dirfile, const char *field_code,
+    const int32_t *field_code_l);
 
-void F77_FUNC(gdgeca, GDGECA) (int* data_type, int *array_len,
-    int* fragment_index, const int* dirfile, const char* field_code,
-    const int* field_code_l);
+void F77_FUNC(gdecnt, GDECNT) (int32_t *error_count, const int32_t *dirfile);
 
-void F77_FUNC(gdadca, GDADCA) (const int *dirfile, const char *field_code,
-    const int *field_code_l, const int *const_type, int *array_len,
-    const int *data_type, const void *value, const int *fragment_index);
+void F77_FUNC(gdtoke, GDTOKE) (char *toke, int32_t *toke_l,
+    const int32_t *dirfile, const char *string, const int32_t *string_l);
 
-void F77_FUNC(gdmdca, GDMDCA) (const int *dirfile, const char *parent,
-    const int *parent_l, const char *field_code, const int *field_code_l,
-    const int *const_type, const int *array_len, const int *data_type,
-    const void *value);
+void F77_FUNC(gdgemx, GDGEMX) (char *in_field, int32_t *in_field_l,
+    char *count_field, int32_t *count_field_l, int32_t *val, int32_t *max,
+    int32_t *fragment_index, const int32_t *dirfile, const char *field_code,
+    const int32_t *field_code_l);
 
-void F77_FUNC(gdpcas, GDPCAS) (const int *dirfile, const char *field_code,
-    const int *field_code_l, const int *start, const int *n,
-    const int *data_type, const void *data_in);
+void F77_FUNC(gdlttn, GDLTTN) (char *name, int32_t *name_l,
+    const int32_t *dirfile, const char *field_code,
+    const int32_t *field_code_l);
 #ifdef __cplusplus
 }
 #endif
diff --git a/bindings/f77/getdata.f.in b/bindings/f77/getdata.f.in
index 4df9b20..f228e2e 100644
--- a/bindings/f77/getdata.f.in
+++ b/bindings/f77/getdata.f.in
@@ -1,4 +1,4 @@
-C     Copyright (C) 2008-2010 D. V. Wiebe
+C     Copyright (C) 2008-2012 D. V. Wiebe
 C
 C     CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC
 C
@@ -25,6 +25,10 @@ C     constants useful to Fortran programs.
       @PARAMETERS@
 
 C Externals
+C     Corresponding to gd_alter_affixes(3)
+      EXTERNAL GDAAFX
+C     Corresponding to gd_add_alias(3)
+      EXTERNAL GDADAL
 C     Corresponding to gd_add_bit(3)
       EXTERNAL GDADBT
 C     Corresponding to gd_add_carray(3)
@@ -45,6 +49,8 @@ C     Corresponding to gd_add_linterp(3)
       EXTERNAL GDADLT
 C     Corresponding to gd_add_multiply(3)
       EXTERNAL GDADMT
+C     Corresponding to gd_add_mplex(3)
+      EXTERNAL GDADMX
 C     Corresponding to gd_add_phase(3)
       EXTERNAL GDADPH
 C     Corresponding to gd_add_polynom(3)
@@ -59,6 +65,8 @@ C     Corresponding to gd_add_spec(3)
       EXTERNAL GDADSP
 C     Corresponding to gd_add_string(3)
       EXTERNAL GDADST
+C     Corresponding to gd_add_window(3)
+      EXTERNAL GDADWD
 C     Correpsonding to gd_alter_encoding(3)
       EXTERNAL GDAENC
 C     Correpsonding to gd_alter_endianness(3)
@@ -85,6 +93,8 @@ C     Correpsonding to gd_alter_linterp(3)
       EXTERNAL GDALLT
 C     Correpsonding to gd_alter_multiply(3)
       EXTERNAL GDALMT
+C     Corresponding to gd_alter_mplex(3)
+      EXTERNAL GDALMX
 C     Correpsonding to gd_alter_phase(3)
       EXTERNAL GDALPH
 C     Correpsonding to gd_alter_polynom(3)
@@ -97,24 +107,44 @@ C     Correpsonding to gd_alter_sbit(3)
       EXTERNAL GDALSB
 C     Correpsonding to gd_alter_spec(3)
       EXTERNAL GDALSP
+C     Correpsonding to gd_aliases(3)
+      EXTERNAL GDALSS
+C     Returns the maximum alias length
+      EXTERNAL GDALSX
+C     Corresponding to gd_alter_window(3)
+      EXTERNAL GDALWD
 C     Corresponding to gd_alter_protection(3)
       EXTERNAL GDAPRT
 C     Alter a scalar parameter
       EXTERNAL GDASCA
+C     Corresponding to gd_alias_target(3)
+      EXTERNAL GDATRG
 C     Corresponding to gd_carray_len(3)
       EXTERNAL GDCALN
 C     Corresponding to gd_parser_callback(3)
       EXTERNAL GDCLBK
 C     Corresponding to gd_close(3)
       EXTERNAL GDCLOS
+C     Corresponding to gd_constants(3) (sort of)
+      EXTERNAL GDCONS
 C     Corresponding to gd_copen(3)
       EXTERNAL GDCOPN
 C     Check whether an entry contains complex scalars
       EXTERNAL GDCSCL
+C     Correpsonding to gd_delete_alias(3)
+      EXTERNAL GDDELA
 C     Correpsonding to gd_delete(3)
       EXTERNAL GDDELE
 C     Corresponding to gd_discard(3)
       EXTERNAL GDDSCD
+C     Corresponding to gd_desync(3)
+      EXTERNAL GDDSYN
+C     Corresponding to gd_error_count(3)
+      EXTERNAL GDECNT
+C     Corresponding to gd_entry_list(3) (sort of)
+      EXTERNAL GDENTN
+C     Returns the maximum entry name length
+      EXTERNAL GDENTX
 C     Corresponding to gd_entry_type(3)
       EXTERNAL GDENTY
 C     Corresponding to gd_error(3)
@@ -125,6 +155,8 @@ C     Corresponding to gd_field_list_by_type(3) (sort of)
       EXTERNAL GDFDNT
 C     Returns the maximum field name length
       EXTERNAL GDFDNX
+C     Corresponding to gd_flags(3)
+      EXTERNAL GDFLAG
 C     Corresponding to gd_field_list(3) (sort of)
       EXTERNAL GDFLDN
 C     Corresponding to gd_flush(3)
@@ -133,6 +165,8 @@ C     Corresponding to gd_framenum_subset(3)
       EXTERNAL GDFNSS
 C     Corresponding to gd_framenum(3)
       EXTERNAL GDFNUM
+C     Corresponding to gd_fragment_affixes(3)
+      EXTERNAL GDFRAF
 C     Corresponding to gd_fragment_index(3)
       EXTERNAL GDFRGI
 C     Corresponding to gd_fragmentname(3)
@@ -177,6 +211,8 @@ C     Corresponding to gd_entry(3) for SBIT fields
       EXTERNAL GDGESB
 C     Corresponding to gd_getdata(3)
       EXTERNAL GDGETD
+C     Corresponding to gd_entry(3) for WINDOW fields
+      EXTERNAL GDGEWD
 C     Correpsonding to gd_frameoffset(3)
       EXTERNAL GDGFOF
 C     Corresponding to gd_protection(3)
@@ -191,10 +227,22 @@ C     Corresponding to gd_get_constant(3)
       EXTERNAL GDGTCO
 C     Corresponding to gd_get_string(3)
       EXTERNAL GDGTST
+C     Corresponding to gd_hide(3)
+      EXTERNAL GDHIDE
+C     Corresponding to gd_hidden(3)
+      EXTERNAL GDHIDN
+C     Corresponding to gd_include_affixes(3)
+      EXTERNAL GDINCA
 C     Corresponding to gd_include(3)
       EXTERNAL GDINCL
 C     Corresponding to gd_invalid_dirfile(3)
       EXTERNAL GDINVD
+C     Corresponding to gd_linterp_tablename(3)
+      EXTERNAL GDLTTN
+C     Corresponding to gd_mconstants(3) (sort of)
+      EXTERNAL GDMCOS
+C     Corresponding to gd_madd_alias(3)
+      EXTERNAL GDMDAL
 C     Corresponding to gd_madd_bit(3)
       EXTERNAL GDMDBT
 C     Corresponding to gd_madd_carray(3)
@@ -215,6 +263,8 @@ C     Corresponding to gd_madd_linterp(3)
       EXTERNAL GDMDLT
 C     Corresponding to gd_madd_multiply(3)
       EXTERNAL GDMDMT
+C     Corresponding to gd_madd_mplex(3)
+      EXTERNAL GDMDMX
 C     Corresponding to gd_madd_phase(3)
       EXTERNAL GDMDPH
 C     Corresponding to gd_madd_polynom(3)
@@ -227,6 +277,8 @@ C     Corresponding to gd_madd_spec(3)
       EXTERNAL GDMDSP
 C     Corresponding to gd_madd_string(3)
       EXTERNAL GDMDST
+C     Corresponding to gd_madd_window(3)
+      EXTERNAL GDMDWD
 C     Corresponding to gd_mfield_list(3) (sort of)
       EXTERNAL GDMFDN
 C     Corresponding to gd_mfield_list_by_type(3) (sort of)
@@ -237,12 +289,25 @@ C     Returns the maximum field name length for a meta field list
       EXTERNAL GDMFNX
 C     Correpsonding to gd_malter_spec(3)
       EXTERNAL GDMLSP
+C     Correpsonding to gd_move_alias(3)
+      EXTERNAL GDMOVA
 C     Correpsonding to gd_move(3)
       EXTERNAL GDMOVE
+C     Corresponding to gd_mstrings(3) (sort of)
+      EXTERNAL GDMSTS
+C     Returns the maximum length of the longest string metafield for a
+C     field
+      EXTERNAL GDMSTX
 C     Corresponding to gd_mvector_list(3) (sort of)
       EXTERNAL GDMVEN
+C     Corresponding to gd_mplex_lookback(3)
+      EXTERNAL GDMXLB
+C     Corresponding to gd_naliases(3)
+      EXTERNAL GDNALS
 C     Corresponding to gd_dirfilename(3)
       EXTERNAL GDNAME
+C     Corresponding to gd_nentries(3)
+      EXTERNAL GDNENT
 C     Corresponding to gd_nfields_by_type(3)
       EXTERNAL GDNFDT
 C     Corresponding to gd_nfields(3)
@@ -257,6 +322,8 @@ C     Corresponding to gd_nmfields_by_type(3)
       EXTERNAL GDNMFT
 C     Corresponding to gd_nmvectors(3)
       EXTERNAL GDNMVE
+C     Deregister a callback function (ie. gd_parser_callback(..., NULL))
+      EXTERNAL GDNOCB
 C     Corresponding to gd_native_type(3)
       EXTERNAL GDNTYP
 C     Corresponding to gd_nvectors(3)
@@ -275,6 +342,8 @@ C     Corresponding to gd_put_string(3)
       EXTERNAL GDPTST
 C     Corresponding to gd_putdata(3)
       EXTERNAL GDPUTD
+C     Corresponding to gd_raw_close(3)
+      EXTERNAL GDRCLO
 C     Corresponding to gd_reference(3)
       EXTERNAL GDREFE
 C     Correpsonding to gd_rename(3)
@@ -283,10 +352,26 @@ C     Corresponding to gd_rewrite_fragment(3)
       EXTERNAL GDRFRG
 C     Corresponding to gd_raw_filename(3)
       EXTERNAL GDRWFN
+C     Corresponding to gd_seek(3)
+      EXTERNAL GDSEEK
 C     Corresponding to gd_dirfile_standards(3)
       EXTERNAL GDSTDV
+C     Corresponding to gd_strings(3) (sort of)
+      EXTERNAL GDSTRS
+C     Returns the length of the longest string field
+      EXTERNAL GDSTRX
+C     Corresponding to gd_sync(3)
+      EXTERNAL GDSYNC
+C     Corresponding to gd_tell(3)
+      EXTERNAL GDTELL
+C     Corresponding to gd_strtok(3)
+      EXTERNAL GDTOKE
+C     Corresponding to gd_unhide(3)
+      EXTERNAL GDUHID
 C     Corresponding to gd_uninclude(3)
       EXTERNAL GDUINC
+C     Corresponding to gd_verbose_prefix(3)
+      EXTERNAL GDVBPX
 C     Corresponding to gd_vector_list(3) (sort of)
       EXTERNAL GDVECN
 C     Corresponding to gd_validate(3)
diff --git a/bindings/f77/getdata.f90.in b/bindings/f77/getdata.f90.in
index a8c0913..7b2ef59 100644
--- a/bindings/f77/getdata.f90.in
+++ b/bindings/f77/getdata.f90.in
@@ -1,4 +1,4 @@
-! Copyright (C) 2008-2010 D. V. Wiebe
+! Copyright (C) 2008-2012 D. V. Wiebe
 !
 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
 !
@@ -29,13 +29,14 @@ integer, parameter :: GD_FIELD_LEN=@GD_MAX_LINE_LENGTH@
 
 type gd_entry
   integer :: field_type, n_fields, spf, data_type, bitnum, numbits, shift
-  integer :: fragment_index, comp_scal, poly_ord, array_len
+  integer :: fragment_index, comp_scal, poly_ord, array_len, windop, ithreshold
+  integer :: count_val, period
   character (len=GD_FIELD_LEN), dimension(3) :: field
   character (len=GD_FIELD_LEN), dimension(6) :: scalar
   integer, dimension(6) :: scalar_ind
   double precision, dimension(3) :: m, b
   double precision, dimension(6) :: a
-  double precision :: dividend
+  double precision :: dividend, rthreshold
   double complex, dimension(3) :: cm, cb
   double complex, dimension(6) :: ca
   double complex :: cdividend
@@ -769,6 +770,14 @@ function fgd_error (dirfile)
   call gderor(fgd_error, dirfile)
 end function
 
+function fgd_error_count (dirfile)
+  integer :: fgd_error_count
+  integer, intent(in) :: dirfile
+
+  ! call f77 library
+  call gdecnt(fgd_error_count, dirfile)
+end function
+
 subroutine fgd_error_string (dirfile, buffer, len)
   integer, intent(in) :: dirfile, len
   character (len=*), intent(out) :: buffer
@@ -885,6 +894,28 @@ function fgd_entry (dirfile, field_code, ent)
     len1 = GD_FIELD_LEN
     call gdgsca(ent%scalar(1), len1, ent%scalar_ind(1), dirfile, &
     TRIM(field_code), LEN_TRIM(field_code), 1)
+  else if (fgd_entry .EQ. GD_WINDOW_ENTRY) then
+    ! window
+    call gdgewd(ent%field(1), len1, ent%field(2), len2, ent%windop, &
+    ent%ithreshold, ent%rthreshold, ent%fragment_index, dirfile, &
+    TRIM(field_code), LEN_TRIM(field_code))
+
+    len1 = GD_FIELD_LEN
+    call gdgsca(ent%scalar(1), len1, ent%scalar_ind(1), dirfile, &
+    TRIM(field_code), LEN_TRIM(field_code), 1)
+  else if (fgd_entry .EQ. GD_MPLEX_ENTRY) then
+    ! mplex
+    call gdgemx(ent%field(1), len1, ent%field(2), len2, ent%count_val, &
+    ent%period, ent%fragment_index, dirfile, TRIM(field_code), &
+    LEN_TRIM(field_code))
+
+    len1 = GD_FIELD_LEN
+    call gdgsca(ent%scalar(1), len1, ent%scalar_ind(1), dirfile, &
+    TRIM(field_code), LEN_TRIM(field_code), 1)
+
+    len1 = GD_FIELD_LEN
+    call gdgsca(ent%scalar(2), len1, ent%scalar_ind(2), dirfile, &
+    TRIM(field_code), LEN_TRIM(field_code), 2)
   else if (fgd_entry .EQ. GD_CONST_ENTRY) then
     !const
     call gdgeco(ent%data_type, ent%fragment_index, dirfile, TRIM(field_code), &
@@ -989,6 +1020,22 @@ subroutine fgd_add (dirfile, field_code, ent)
       TRIM(ent%field(1)), LEN_TRIM(ent%field(1)), ent%cdividend, &
       ent%fragment_index)
     end if
+  else if (ent%field_type .EQ. GD_WINDOW_ENTRY) then
+    if ((ent%windop .EQ. GD_WINDOP_EQ) .OR. (ent%windop .EQ. GD_WINDOP_NE) &
+    .OR. (ent%windop .EQ. GD_WINDOP_SET) .OR. (ent%windop .EQ. GD_WINDOP_CLR)) &
+    then
+      call gdadwd(dirfile, TRIM(field_code), LEN_TRIM(field_code), &
+      TRIM(ent%field(1)), LEN_TRIM(ent%field(1)), TRIM(ent%field(2)), &
+      LEN_TRIM(ent%field(2)), ent%windop, ent%ithreshold, ent%fragment_index)
+    else
+      call gdadwd(dirfile, TRIM(field_code), LEN_TRIM(field_code), &
+      TRIM(ent%field(1)), LEN_TRIM(ent%field(1)), TRIM(ent%field(2)), &
+      LEN_TRIM(ent%field(2)), ent%windop, ent%rthreshold, ent%fragment_index)
+    end if
+  else if (ent%field_type .EQ. GD_MPLEX_ENTRY) then
+    call gdadmx(dirfile, TRIM(field_code), LEN_TRIM(field_code), &
+    TRIM(ent%field(1)), LEN_TRIM(ent%field(1)), TRIM(ent%field(2)), &
+    LEN_TRIM(ent%field(2)), ent%count_val, ent%period, ent%fragment_index)
   else if (ent%field_type .EQ. GD_CONST_ENTRY) then
     call gdadco(dirfile, TRIM(field_code), LEN_TRIM(field_code), &
     ent%data_type, GD_INT32, zero, ent%fragment_index)
@@ -1215,6 +1262,24 @@ subroutine fgd_madd (dirfile, parent, field_code, ent)
   else if (ent%field_type .EQ. GD_PHASE_ENTRY) then
     call gdmdph(dirfile, TRIM(parent), LEN_TRIM(parent), TRIM(field_code), &
     LEN_TRIM(field_code), TRIM(ent%field(1)), LEN_TRIM(ent%field(1)), ent%shift)
+  else if (ent%field_type .EQ. GD_WINDOW_ENTRY) then
+    if ((ent%windop .EQ. GD_WINDOP_EQ) .OR. (ent%windop .EQ. GD_WINDOP_NE) &
+    .OR. (ent%windop .EQ. GD_WINDOP_SET) .OR. (ent%windop .EQ. GD_WINDOP_CLR)) &
+    then
+      call gdmdwd(dirfile, TRIM(parent), LEN_TRIM(parent), TRIM(field_code), &
+      LEN_TRIM(field_code), TRIM(ent%field(1)), LEN_TRIM(ent%field(1)), &
+      TRIM(ent%field(2)), LEN_TRIM(ent%field(2)), ent%windop, ent%ithreshold, &
+      ent%fragment_index)
+    else
+      call gdmdwd(dirfile, TRIM(parent), LEN_TRIM(parent), TRIM(field_code), &
+      LEN_TRIM(field_code), TRIM(ent%field(1)), LEN_TRIM(ent%field(1)), &
+      TRIM(ent%field(2)), LEN_TRIM(ent%field(2)), ent%windop, ent%rthreshold, &
+      ent%fragment_index)
+    end if
+  else if (ent%field_type .EQ. GD_MPLEX_ENTRY) then
+    call gdmdmx(dirfile, TRIM(parent), LEN_TRIM(parent), TRIM(field_code), &
+    LEN_TRIM(field_code), TRIM(ent%field(1)), LEN_TRIM(ent%field(1)), &
+    TRIM(ent%field(2)), LEN_TRIM(ent%field(2)), ent%count_val, ent%period)
   else if (ent%field_type .EQ. GD_CONST_ENTRY) then
     call gdmdco(dirfile, TRIM(parent), LEN_TRIM(parent), TRIM(field_code), &
     LEN_TRIM(field_code), ent%data_type, GD_INT32, zero)
@@ -1584,6 +1649,22 @@ subroutine fgd_alter_entry (dirfile, field_code, ent, recode)
       call gdalrc(dirfile, TRIM(field_code), LEN_TRIM(field_code), &
       TRIM(ent%field(1)), LEN_TRIM(ent%field(1)), ent%a(1), ent%dividend)
     end if
+  else if (ent%field_type .EQ. GD_WINDOW_ENTRY) then
+    if ((ent%windop .EQ. GD_WINDOP_EQ) .OR. (ent%windop .EQ. GD_WINDOP_NE) &
+    .OR. (ent%windop .EQ. GD_WINDOP_SET) .OR. (ent%windop .EQ. GD_WINDOP_CLR)) &
+    then
+      call gdalwd(dirfile, TRIM(field_code), LEN_TRIM(field_code), &
+      TRIM(ent%field(1)), LEN_TRIM(ent%field(1)), TRIM(ent%field(2)), &
+      LEN_TRIM(ent%field(2)), ent%windop, ent%ithreshold, ent%fragment_index)
+    else
+      call gdalwd(dirfile, TRIM(field_code), LEN_TRIM(field_code), &
+      TRIM(ent%field(1)), LEN_TRIM(ent%field(1)), TRIM(ent%field(2)), &
+      LEN_TRIM(ent%field(2)), ent%windop, ent%rthreshold, ent%fragment_index)
+    end if
+  else if (ent%field_type .EQ. GD_CONST_ENTRY) then
+    call gdalmx(dirfile, TRIM(field_code), LEN_TRIM(field_code), &
+    TRIM(ent%field(1)), LEN_TRIM(ent%field(1)), TRIM(ent%field(2)), &
+    LEN_TRIM(ent%field(2)), ent%count_val, ent%period, ent%fragment_index)
   else if (ent%field_type .EQ. GD_CONST_ENTRY) then
     call gdalco(dirfile, TRIM(field_code), LEN_TRIM(field_code), ent%data_type)
   else if (ent%field_type .EQ. GD_CARRAY_ENTRY) then
@@ -2118,4 +2199,684 @@ subroutine fgd_alter_carray (dirfile, field_name, const_type, array_len)
   array_len)
 end subroutine
 
+function fgd_seek (dirfile, field_name, frame_num, sample_num, flags)
+  integer :: fgd_seek
+  integer, intent(in) :: dirfile, frame_num, sample_num, flags
+  character (len=*), intent(in) :: field_name
+  
+  call gdseek(fgd_seek, dirfile, TRIM(field_name), LEN_TRIM(field_name), &
+  frame_num, sample_num, flags)
+end function
+
+function fgd_tell (dirfile, field_name)
+  integer :: fgd_tell
+  integer, intent(in) :: dirfile
+  character (len=*), intent(in) :: field_name
+  
+  call gdtell(fgd_tell, dirfile, TRIM(field_name), LEN_TRIM(field_name))
+end function
+
+! gd_constants with return_type=GD_INT8
+subroutine fgd_constants_i1 (constants, dirfile)
+  integer*1, dimension(:), intent(out) :: constants
+  integer, intent(in) :: dirfile
+  integer :: nfields, i
+
+  nfields = fgd_nfields_by_type(dirfile, GD_CONST_ENTRY)
+  do i=1,nfields
+    ! call f77 library
+    call gdcons(constants(i), dirfile, GD_INT8, i)
+  end do
+end subroutine
+
+! gd_constants with return_type=GD_INT16
+subroutine fgd_constants_i2 (constants, dirfile)
+  integer*2, dimension(:), intent(out) :: constants
+  integer, intent(in) :: dirfile
+  integer :: nfields, i
+
+  nfields = fgd_nfields_by_type(dirfile, GD_CONST_ENTRY)
+  do i=1,nfields
+    ! call f77 library
+    call gdcons(constants(i), dirfile, GD_INT16, i)
+  end do
+end subroutine
+
+! gd_constants with return_type=GD_INT32
+subroutine fgd_constants_i4 (constants, dirfile)
+  integer*4, dimension(:), intent(out) :: constants
+  integer, intent(in) :: dirfile
+  integer :: nfields, i
+
+  nfields = fgd_nfields_by_type(dirfile, GD_CONST_ENTRY)
+  do i=1,nfields
+    ! call f77 library
+    call gdcons(constants(i), dirfile, GD_INT32, i)
+  end do
+end subroutine
+
+! gd_constants with return_type=GD_INT64
+subroutine fgd_constants_i8 (constants, dirfile)
+  integer*8, dimension(:), intent(out) :: constants
+  integer, intent(in) :: dirfile
+  integer :: nfields, i
+
+  nfields = fgd_nfields_by_type(dirfile, GD_CONST_ENTRY)
+  do i=1,nfields
+    ! call f77 library
+    call gdcons(constants(i), dirfile, GD_INT64, i)
+  end do
+end subroutine
+
+! gd_constants with return_type=GD_FLOAT32
+subroutine fgd_constants_r4 (constants, dirfile)
+  real*4, dimension(:), intent(out) :: constants
+  integer, intent(in) :: dirfile
+  integer :: nfields, i
+
+  nfields = fgd_nfields_by_type(dirfile, GD_CONST_ENTRY)
+  do i=1,nfields
+    ! call f77 library
+    call gdcons(constants(i), dirfile, GD_FLOAT32, i)
+  end do
+end subroutine
+
+! gd_constants with return_type=GD_FLOAT64
+subroutine fgd_constants_r8 (constants, dirfile)
+  real*8, dimension(:), intent(out) :: constants
+  integer, intent(in) :: dirfile
+  integer :: nfields, i
+
+  nfields = fgd_nfields_by_type(dirfile, GD_STRING_ENTRY)
+  do i=1,nfields
+    ! call f77 library
+    call gdcons(constants(i), dirfile, GD_FLOAT64, i)
+  end do
+end subroutine
+
+! gd_constants with return_type=GD_COMPLEX64
+subroutine fgd_constants_c8 (constants, dirfile)
+  complex, dimension(:), intent(out) :: constants
+  integer, intent(in) :: dirfile
+  integer :: nfields, i
+
+  nfields = fgd_nfields_by_type(dirfile, GD_STRING_ENTRY)
+  do i=1,nfields
+    ! call f77 library
+    call gdcons(constants(i), dirfile, GD_COMPLEX64, i)
+  end do
+end subroutine
+
+! gd_constants with return_type=GD_COMPLEX128
+subroutine fgd_constants_c16 (constants, dirfile)
+  double complex, dimension(:), intent(out) :: constants
+  integer, intent(in) :: dirfile
+  integer :: nfields, i
+
+  nfields = fgd_nfields_by_type(dirfile, GD_STRING_ENTRY)
+  do i=1,nfields
+    ! call f77 library
+    call gdcons(constants(i), dirfile, GD_COMPLEX128, i)
+  end do
+end subroutine
+
+! gd_mconstants with return_type=GD_INT8
+subroutine fgd_mconstants_i1 (constants, dirfile, parent)
+  integer*1, dimension(:), intent(out) :: constants
+  integer, intent(in) :: dirfile
+  integer :: nfields, i
+  character (len=*), intent(in) :: parent
+
+  nfields = fgd_nmfields_by_type(dirfile, parent, GD_CONST_ENTRY)
+  do i=1,nfields
+    ! call f77 library
+    call gdmcos(constants(i), dirfile, TRIM(parent), LEN_TRIM(parent), &
+    GD_INT8, i)
+  end do
+end subroutine
+
+! gd_mconstants with return_type=GD_INT16
+subroutine fgd_mconstants_i2 (constants, dirfile, parent)
+  integer*2, dimension(:), intent(out) :: constants
+  integer, intent(in) :: dirfile
+  integer :: nfields, i
+  character (len=*), intent(in) :: parent
+
+  nfields = fgd_nmfields_by_type(dirfile, parent, GD_CONST_ENTRY)
+  do i=1,nfields
+    ! call f77 library
+    call gdmcos(constants(i), dirfile, TRIM(parent), LEN_TRIM(parent), &
+    GD_INT16, i)
+  end do
+end subroutine
+
+! gd_mconstants with return_type=GD_INT32
+subroutine fgd_mconstants_i4 (constants, dirfile, parent)
+  integer*4, dimension(:), intent(out) :: constants
+  integer, intent(in) :: dirfile
+  integer :: nfields, i
+  character (len=*), intent(in) :: parent
+
+  nfields = fgd_nmfields_by_type(dirfile, parent, GD_CONST_ENTRY)
+  do i=1,nfields
+    ! call f77 library
+    call gdmcos(constants(i), dirfile, TRIM(parent), LEN_TRIM(parent), &
+    GD_INT32, i)
+  end do
+end subroutine
+
+! gd_mconstants with return_type=GD_INT64
+subroutine fgd_mconstants_i8 (constants, dirfile, parent)
+  integer*8, dimension(:), intent(out) :: constants
+  integer, intent(in) :: dirfile
+  integer :: nfields, i
+  character (len=*), intent(in) :: parent
+
+  nfields = fgd_nmfields_by_type(dirfile, parent, GD_CONST_ENTRY)
+  do i=1,nfields
+    ! call f77 library
+    call gdmcos(constants(i), dirfile, TRIM(parent), LEN_TRIM(parent), &
+    GD_INT64, i)
+  end do
+end subroutine
+
+! gd_mconstants with return_type=GD_FLOAT32
+subroutine fgd_mconstants_r4 (constants, dirfile, parent)
+  real*4, dimension(:), intent(out) :: constants
+  integer, intent(in) :: dirfile
+  integer :: nfields, i
+  character (len=*), intent(in) :: parent
+
+  nfields = fgd_nmfields_by_type(dirfile, parent, GD_CONST_ENTRY)
+  do i=1,nfields
+    ! call f77 library
+    call gdmcos(constants(i), dirfile, TRIM(parent), LEN_TRIM(parent), &
+    GD_FLOAT32, i)
+  end do
+end subroutine
+
+! gd_mconstants with return_type=GD_FLOAT64
+subroutine fgd_mconstants_r8 (constants, dirfile, parent)
+  real*8, dimension(:), intent(out) :: constants
+  integer, intent(in) :: dirfile
+  integer :: nfields, i
+  character (len=*), intent(in) :: parent
+
+  nfields = fgd_nmfields_by_type(dirfile, parent, GD_CONST_ENTRY)
+  do i=1,nfields
+    ! call f77 library
+    call gdmcos(constants(i), dirfile, TRIM(parent), LEN_TRIM(parent), &
+    GD_FLOAT64, i)
+  end do
+end subroutine
+
+! gd_mconstants with return_type=GD_COMPLEX64
+subroutine fgd_mconstants_c8 (constants, dirfile, parent)
+  complex, dimension(:), intent(out) :: constants
+  integer, intent(in) :: dirfile
+  integer :: nfields, i
+  character (len=*), intent(in) :: parent
+
+  nfields = fgd_nmfields_by_type(dirfile, parent, GD_CONST_ENTRY)
+  do i=1,nfields
+    ! call f77 library
+    call gdmcos(constants(i), dirfile, TRIM(parent), LEN_TRIM(parent), &
+    GD_COMPLEX64, i)
+  end do
+end subroutine
+
+! gd_mconstants with return_type=GD_COMPLEX128
+subroutine fgd_mconstants_c16 (constants, dirfile, parent)
+  double complex, dimension(:), intent(out) :: constants
+  integer, intent(in) :: dirfile
+  integer :: nfields, i
+  character (len=*), intent(in) :: parent
+
+  nfields = fgd_nmfields_by_type(dirfile, parent, GD_CONST_ENTRY)
+  do i=1,nfields
+    ! call f77 library
+    call gdmcos(constants(i), dirfile, TRIM(parent), LEN_TRIM(parent), &
+    GD_COMPLEX128, i)
+  end do
+end subroutine
+
+function fgd_string_value_max (dirfile)
+  integer :: fgd_string_value_max
+  integer, intent(in) :: dirfile
+
+  ! call f77 library
+  call gdstrx(fgd_string_value_max, dirfile)
+end function
+
+subroutine fgd_strings (strings, dirfile, string_len)
+  character(len=*), dimension(:), intent(out) :: strings
+  integer, intent(in) :: dirfile
+  integer, intent(inout) :: string_len
+  integer :: max_len, nfields, i
+
+  ! make sure the string list is large enough
+  max_len = fgd_string_value_max(dirfile)
+
+  if (string_len .lt. max_len) then
+    string_len = max_len
+  else
+    nfields = fgd_nfields_by_type(dirfile, GD_STRING_ENTRY)
+    do i=1,nfields
+      ! call f77 library
+      call gdstrs(strings(i), string_len, dirfile, i)
+    end do
+  end if
+end subroutine
+
+function fgd_mstring_value_max (dirfile, parent)
+  integer :: fgd_mstring_value_max
+  integer, intent(in) :: dirfile
+  character (len=*), intent(in) :: parent
+
+  ! call f77 library
+  call gdmstx(fgd_mstring_value_max, dirfile, TRIM(parent), LEN_TRIM(parent))
+end function
+
+subroutine fgd_mstrings (strings, dirfile, parent, string_len)
+  character(len=*), dimension(:), intent(out) :: strings
+  integer, intent(in) :: dirfile
+  integer, intent(inout) :: string_len
+  integer :: max_len, nfields, i
+  character (len=*), intent(in) :: parent
+
+  ! make sure the field list is large enough
+  max_len = fgd_mstring_value_max(dirfile, parent)
+
+  if (string_len .lt. max_len) then
+    string_len = max_len
+  else
+    nfields = fgd_nmfields_by_type(dirfile, parent, GD_STRING_ENTRY)
+    do i=1,nfields
+      ! call f77 library
+      call gdmsts(strings(i), string_len, dirfile, TRIM(parent), &
+      LEN_TRIM(parent), i)
+    end do
+  end if
+end subroutine
+
+subroutine fgd_add_alias (dirfile, field_code, targ, fragment_index)
+  integer, intent(in) :: dirfile, fragment_index
+  character(len=*), intent(in) :: field_code, targ
+
+  call gdadal(dirfile, TRIM(field_code), LEN_TRIM(field_code), TRIM(targ), &
+  LEN_TRIM(targ), fragment_index)
+end subroutine
+
+subroutine fgd_add_window_i (dirfile, field_code, in_field, check_field, &
+  windop, threshold, fragment_index)
+  character(len=*), intent(in) :: field_code, in_field, check_field
+  integer, intent(in) :: dirfile, windop, threshold, fragment_index
+
+  ! convert to double precision, if necessary
+  if (windop .NE. GD_WINDOP_EQ .AND. windop .NE. GD_WINDOP_NE .AND. &
+  windop .NE. GD_WINDOP_SET .AND. windop .NE. GD_WINDOP_CLR) then
+    call gdadwd(dirfile, TRIM(field_code), LEN_TRIM(field_code), &
+    TRIM(in_field), LEN_TRIM(in_field), TRIM(check_field), &
+    LEN_TRIM(check_field), windop, 1d0 * threshold, fragment_index)
+  else
+    call gdadwd(dirfile, TRIM(field_code), LEN_TRIM(field_code), &
+    TRIM(in_field), LEN_TRIM(in_field), TRIM(check_field), &
+    LEN_TRIM(check_field), windop, threshold, fragment_index)
+  end if
+end subroutine
+
+subroutine fgd_add_window_r (dirfile, field_code, in_field, check_field, &
+  windop, threshold, fragment_index)
+  character(len=*), intent(in) :: field_code, in_field, check_field
+  integer, intent(in) :: dirfile, windop, fragment_index
+  double precision, intent(in) :: threshold
+
+  ! convert to integer, if necessary
+  if (windop .NE. GD_WINDOP_EQ .AND. windop .NE. GD_WINDOP_NE .AND. &
+  windop .NE. GD_WINDOP_SET .AND. windop .NE. GD_WINDOP_CLR) then
+    call gdadwd(dirfile, TRIM(field_code), LEN_TRIM(field_code), &
+    TRIM(in_field), LEN_TRIM(in_field), TRIM(check_field), &
+    LEN_TRIM(check_field), windop, threshold, fragment_index)
+  else
+    call gdadwd(dirfile, TRIM(field_code), LEN_TRIM(field_code), &
+    TRIM(in_field), LEN_TRIM(in_field), TRIM(check_field), &
+    LEN_TRIM(check_field), windop, threshold, INT(fragment_index))
+  end if
+end subroutine
+
+subroutine fgd_madd_window_i (dirfile, parent, field_code, in_field, &
+  check_field, windop, threshold)
+  character(len=*), intent(in) :: parent, field_code, in_field, check_field
+  integer, intent(in) :: dirfile, windop, threshold
+
+  ! convert to double precision, if necessary
+  if (windop .NE. GD_WINDOP_EQ .AND. windop .NE. GD_WINDOP_NE .AND. &
+  windop .NE. GD_WINDOP_SET .AND. windop .NE. GD_WINDOP_CLR) then
+    call gdmdwd(dirfile, TRIM(parent), LEN_TRIM(parent), TRIM(field_code), &
+    LEN_TRIM(field_code), TRIM(in_field), LEN_TRIM(in_field), &
+    TRIM(check_field), LEN_TRIM(check_field), windop, 1d0 * threshold)
+  else
+    call gdmdwd(dirfile, TRIM(parent), LEN_TRIM(parent), TRIM(field_code), &
+    LEN_TRIM(field_code), TRIM(in_field), LEN_TRIM(in_field), &
+    TRIM(check_field), LEN_TRIM(check_field), windop, threshold)
+  end if
+end subroutine
+
+subroutine fgd_madd_window_r (dirfile, parent, field_code, in_field, &
+  check_field, windop, threshold)
+  character(len=*), intent(in) :: parent, field_code, in_field, check_field
+  integer, intent(in) :: dirfile, windop
+  double precision, intent(in) :: threshold
+
+  ! convert to integer, if necessary
+  if (windop .NE. GD_WINDOP_EQ .AND. windop .NE. GD_WINDOP_NE .AND. &
+  windop .NE. GD_WINDOP_SET .AND. windop .NE. GD_WINDOP_CLR) then
+    call gdmdwd(dirfile, TRIM(parent), LEN_TRIM(parent), TRIM(field_code), &
+    LEN_TRIM(field_code), TRIM(in_field), LEN_TRIM(in_field), &
+    TRIM(check_field), LEN_TRIM(check_field), windop, threshold)
+  else
+    call gdmdwd(dirfile, TRIM(parent), LEN_TRIM(parent), TRIM(field_code), &
+    LEN_TRIM(field_code), TRIM(in_field), LEN_TRIM(in_field), &
+    TRIM(check_field), LEN_TRIM(check_field), windop, INT(threshold))
+  end if
+end subroutine
+
+function fgd_alias_target (dirfile, field_code)
+  character (len=GD_MAX_LINE_LENGTH) :: fgd_alias_target
+  integer, intent(in) :: dirfile
+  character(len=*), intent(in) :: field_code
+  integer :: l = GD_MAX_LINE_LENGTH
+
+  call gdatrg(fgd_alias_target, l, dirfile, TRIM(field_code), &
+  LEN_TRIM(field_code))
+end function
+
+function fgd_naliases (dirfile, field_code)
+  integer :: fgd_naliases
+  integer, intent(in) :: dirfile
+  character(len=*), intent(in) :: field_code
+
+  call gdnals(fgd_naliases, dirfile, TRIM(field_code), LEN_TRIM(field_code))
+end function
+
+function fgd_alias_max (dirfile, field_code)
+  integer :: fgd_alias_max
+  integer, intent(in) :: dirfile
+  character(len=*), intent(in) :: field_code
+
+  call gdalsx(fgd_alias_max, dirfile, TRIM(field_code), LEN_TRIM(field_code))
+end function
+
+subroutine fgd_aliases (aliases, dirfile, field_code, alias_len)
+  character(len=*), dimension(:), intent(out) :: aliases
+  integer, intent(in) :: dirfile
+  character(len=*), intent(in) :: field_code
+  integer, intent(inout) :: alias_len
+  integer :: max_len, nalias, i
+
+  ! make sure the field list is large enough
+  max_len = fgd_alias_max(dirfile, field_code)
+
+  if (alias_len .lt. max_len) then
+    alias_len = max_len
+  else
+    nalias = fgd_naliases(dirfile, field_code)
+    do i=1,nalias
+      call gdalss(aliases(i), alias_len, dirfile, TRIM(field_code), &
+      LEN_TRIM(field_code), i)
+    end do
+  end if
+end subroutine
+
+subroutine fgd_alter_affixes (dirfile, fragment_index, prefix, suffix)
+  integer, intent(in) :: dirfile, fragment_index
+  character(len=*), intent(in) :: prefix, suffix
+
+  call gdaafx(dirfile, fragment_index, TRIM(prefix), LEN_TRIM(prefix), &
+  TRIM(suffix), LEN_TRIM(suffix))
+end subroutine
+
+subroutine fgd_alter_window_i (dirfile, field_name, in_field, check_field, &
+  windop, threshold)
+  integer, intent(in) :: dirfile, windop, threshold
+  character (len=*), intent(in) :: field_name, in_field, check_field
+
+  ! convert to double precision, if necessary
+  if (windop .NE. GD_WINDOP_EQ .AND. windop .NE. GD_WINDOP_NE .AND. &
+  windop .NE. GD_WINDOP_SET .AND. windop .NE. GD_WINDOP_CLR) then
+    call gdalwd(dirfile, TRIM(field_name), LEN_TRIM(field_name), &
+    TRIM(in_field), LEN_TRIM(in_field), TRIM(check_field), &
+    LEN_TRIM(check_field), windop, 1d0 * threshold)
+  else
+    call gdalwd(dirfile, TRIM(field_name), LEN_TRIM(field_name), &
+    TRIM(in_field), LEN_TRIM(in_field), TRIM(check_field), &
+    LEN_TRIM(check_field), windop, threshold)
+  end if
+end subroutine
+
+subroutine fgd_alter_window_r (dirfile, field_name, in_field, check_field, &
+  windop, threshold)
+  integer, intent(in) :: dirfile, windop
+  character (len=*), intent(in) :: field_name, in_field, check_field
+  double precision, intent(in) :: threshold
+
+  ! convert to integer, if necessary
+  if (windop .NE. GD_WINDOP_EQ .AND. windop .NE. GD_WINDOP_NE .AND. &
+  windop .NE. GD_WINDOP_SET .AND. windop .NE. GD_WINDOP_CLR) then
+    call gdalwd(dirfile, TRIM(field_name), LEN_TRIM(field_name), &
+    TRIM(in_field), LEN_TRIM(in_field), TRIM(check_field), &
+    LEN_TRIM(check_field), windop, threshold)
+  else
+    call gdalwd(dirfile, TRIM(field_name), LEN_TRIM(field_name), &
+    TRIM(in_field), LEN_TRIM(in_field), TRIM(check_field), &
+    LEN_TRIM(check_field), windop, INT(threshold))
+  end if
+end subroutine
+
+subroutine fgd_delete_alias (dirfile, field_code, flags)
+  integer, intent(in) :: dirfile, flags
+  character (len=*), intent(in) :: field_code
+
+  call gddela(dirfile, TRIM(field_code), LEN_TRIM(field_code), flags)
+end subroutine
+
+function fgd_hidden (dirfile, field_code)
+  integer :: fgd_hidden
+  integer, intent(in) :: dirfile
+  character (len=*), intent(in) :: field_code
+
+  call gdhidn(fgd_hidden, dirfile, TRIM(field_code), LEN_TRIM(field_code))
+end function
+
+subroutine fgd_hide (dirfile, field_code)
+  integer, intent(in) :: dirfile
+  character (len=*), intent(in) :: field_code
+
+  call gdhide(dirfile, TRIM(field_code), LEN_TRIM(field_code))
+end subroutine
+
+subroutine fgd_unhide (dirfile, field_code)
+  integer, intent(in) :: dirfile
+  character (len=*), intent(in) :: field_code
+
+  call gduhid(dirfile, TRIM(field_code), LEN_TRIM(field_code))
+end subroutine
+
+subroutine fgd_madd_alias (dirfile, parent, field_code, targ)
+  integer, intent(in) :: dirfile
+  character(len=*), intent(in) :: parent, field_code, targ
+
+  call gdmdal(dirfile, TRIM(parent), LEN_TRIM(parent), TRIM(field_code), &
+  LEN_TRIM(field_code), TRIM(targ), LEN_TRIM(targ))
+end subroutine
+
+subroutine fgd_move_alias (dirfile, field_code, new_fragment)
+  integer, intent(in) :: dirfile, new_fragment
+  character (len=*), intent(in) :: field_code
+
+  call gdmova (dirfile, TRIM(field_code), LEN_TRIM(field_code), new_fragment)
+end subroutine
+
+subroutine fgd_include_affix (dirfile, fragmentname, fragment_index, prefix, &
+suffix, flags)
+  integer, intent(in) :: dirfile, fragment_index, flags
+  character (len=*), intent(in) :: fragmentname, prefix, suffix
+
+  call gdinca(dirfile, TRIM(fragmentname), LEN_TRIM(fragmentname), &
+  fragment_index, TRIM(prefix), LEN_TRIM(prefix), TRIM(suffix), &
+  LEN_TRIM(suffix), flags)
+end subroutine
+
+subroutine fgd_sync (dirfile, field_code)
+  integer, intent(in) :: dirfile
+  character (len=*), intent(in) :: field_code
+
+  call gdsync(dirfile, TRIM(field_code), LEN_TRIM(field_code))
+end subroutine
+
+subroutine fgd_raw_close (dirfile, field_code)
+  integer, intent(in) :: dirfile
+  character (len=*), intent(in) :: field_code
+
+  call gdrclo(dirfile, TRIM(field_code), LEN_TRIM(field_code))
+end subroutine
+
+subroutine fgd_fragment_affixes (prefix, pl, suffix, sl, dirfile, &
+fragment_index)
+  character(len=*), intent(out) :: prefix, suffix
+  integer, intent(in) :: dirfile, fragment_index
+  integer, intent(inout) :: pl, sl
+
+  call gdfraf(prefix, pl, suffix, sl, dirfile, fragment_index)
+end subroutine
+  
+subroutine fgd_add_mplex (dirfile, field_code, in_field, count_field, &
+  count_val, period, fragment_index)
+  character(len=*), intent(in) :: field_code, in_field, count_field
+  integer, intent(in) :: dirfile, count_val, period, fragment_index
+
+  call gdadmx(dirfile, TRIM(field_code), LEN_TRIM(field_code), TRIM(in_field), &
+  LEN_TRIM(in_field), TRIM(count_field), LEN_TRIM(count_field), count_val, &
+  period, fragment_index)
+end subroutine
+
+subroutine fgd_madd_mplex (dirfile, parent, field_code, in_field, count_field, &
+  count_val, period)
+  character(len=*), intent(in) :: parent, field_code, in_field, count_field
+  integer, intent(in) :: dirfile, count_val, period
+
+  call gdmdmx(dirfile, TRIM(parent), LEN_TRIM(parent), TRIM(field_code), &
+  LEN_TRIM(field_code), TRIM(in_field), LEN_TRIM(in_field), TRIM(count_field), &
+  LEN_TRIM(count_field), count_val, period)
+end subroutine
+
+subroutine fgd_alter_mplex (dirfile, field_name, in_field, count_field, &
+  count_val, period)
+  integer, intent(in) :: dirfile, count_val, period
+  character (len=*), intent(in) :: field_name, in_field, count_field
+
+  call gdalmx(dirfile, TRIM(field_name), LEN_TRIM(field_name), TRIM(in_field), &
+  LEN_TRIM(in_field), TRIM(count_field), LEN_TRIM(count_field), count_val, &
+  period)
+end subroutine
+
+subroutine fgd_strtok (token, l, dirfile, string)
+  character (len=*), intent(out) :: token
+  integer, intent(inout) :: l
+  integer, intent(in) :: dirfile
+  character (len=*), intent(in) :: string
+
+  call gdtoke(token, l, dirfile, TRIM(string), LEN_TRIM(string))
+end subroutine
+
+function fgd_desync (dirfile, flags)
+  integer :: fgd_desync
+  integer, intent(in) :: dirfile, flags
+
+  call gddsyn(fgd_desync, dirfile, flags)
+end function
+
+function fgd_flags (dirfile, set, reset)
+  integer :: fgd_flags
+  integer, intent(in) :: dirfile, set, reset
+
+  call gdflag(fgd_flags, dirfile, set, reset)
+end function
+
+subroutine fgd_verbose_prefix(dirfile, prefix)
+  integer, intent(in) :: dirfile
+  character (len=*), intent(in) :: prefix
+
+  call gdvbpx(dirfile, TRIM(prefix), LEN_TRIM(prefix))
+end subroutine
+
+subroutine fgd_mplex_lookback(dirfile, lookback)
+  integer, intent(in) :: dirfile, lookback
+
+  call gdmxlb(dirfile, lookback)
+end subroutine
+
+function fgd_nentries (dirfile, parent, entype, flags)
+  integer :: fgd_nentries
+  integer, intent(in) :: dirfile, entype, flags
+  character (len=*), intent(in) :: parent
+  integer :: parent_l
+
+  parent_l = LEN_TRIM(parent)
+  if (parent_l .EQ. 0) parent_l = -1
+
+  ! call f77 library
+  call gdnent(fgd_nentries, dirfile, TRIM(parent), parent_l, entype, flags)
+end function
+
+function fgd_entry_name_max (dirfile, parent, entype, flags)
+  integer :: fgd_entry_name_max
+  integer, intent(in) :: dirfile, entype, flags
+  character (len=*), intent(in) :: parent
+  integer :: parent_l
+
+  parent_l = LEN_TRIM(parent)
+  if (parent_l .EQ. 0) parent_l = -1
+
+  ! call f77 library
+  call gdentx(fgd_entry_name_max, dirfile, TRIM(parent), parent_l, entype, &
+  flags)
+end function
+
+subroutine fgd_entry_list (entry_list, dirfile, parent, entype, flags, &
+entry_len)
+  character(len=*), dimension(:), intent(out) :: entry_list
+  integer, intent(in) :: dirfile, entype, flags
+  integer, intent(inout) :: entry_len
+  character (len=*), intent(in) :: parent
+  integer :: max_len, nentries, i, parent_l
+
+  ! make sure the entry list is large enough
+  max_len = fgd_entry_name_max(dirfile, parent, entype, flags)
+  parent_l = LEN_TRIM(parent)
+  if (parent_l .EQ. 0) parent_l = -1
+
+  if (entry_len .lt. max_len) then
+    entry_len = max_len
+  else
+    nentries = fgd_nentries(dirfile, parent, entype, flags)
+    do i=1,nentries
+      ! call f77 library
+      call gdentn(entry_list(i), entry_len, dirfile, TRIM(parent), parent_l, &
+      entype, flags, i)
+    end do
+  end if
+end subroutine
+
+function fgd_linterp_tablename (dirfile, field_code)
+  character (len=GD_MAX_LINE_LENGTH) :: fgd_linterp_tablename
+  integer, intent(in) :: dirfile
+  character (len=*), intent(in) :: field_code
+
+  integer :: l = GD_MAX_LINE_LENGTH
+
+  call gdlttn (fgd_linterp_tablename, l, dirfile, TRIM(field_code), &
+  LEN_TRIM(field_code))
+end function
+
 end module
diff --git a/bindings/f77/test/Makefile.am b/bindings/f77/test/Makefile.am
index da94ebf..8406a20 100644
--- a/bindings/f77/test/Makefile.am
+++ b/bindings/f77/test/Makefile.am
@@ -1,4 +1,4 @@
-# Copyright (C) 2008-2010 D. V. Wiebe
+# Copyright (C) 2008-2010, 2012 D. V. Wiebe
 #
 ##########################################################################
 #
@@ -28,6 +28,10 @@ if F77_WALL
 F77_WALL=-Wall
 endif
 
+if F77_FNO_BACKSLASH
+F77_FNO_BACKSLASH=-fno-backslash
+endif
+
 if INTEL_F77_COMPILER
 F77_ASSUME=-assume byterecl
 endif
@@ -40,8 +44,10 @@ if MAKE_F95BINDINGS
 F95TESTS=big_test95
 endif
 
-FFLAGS += -I.. $(F77_WALL) $(F77_WEXTRA) $(F77_ASSUME)
-FCFLAGS += -I.. $(F77_WALL) $(FC_WEXTRA) $(FC_ASSUME)
+BUILT_SOUCES = test_getdata.f
+
+FFLAGS += -I. -I.. $(F77_WALL) $(F77_WEXTRA) $(F77_ASSUME) $(F77_FNO_BACKSLASH)
+FCFLAGS += -I. -I.. $(F77_WALL) $(FC_WEXTRA) $(FC_ASSUME)
 F95LDADD=../libf95getdata.la $(F77LDADD)
 F77LDADD=../libfgetdata.la
 AM_LDFLAGS = -L..
diff --git a/bindings/f77/test/Makefile.in b/bindings/f77/test/Makefile.in
index f87ecb7..e7327c3 100644
--- a/bindings/f77/test/Makefile.in
+++ b/bindings/f77/test/Makefile.in
@@ -1,9 +1,9 @@
-# Makefile.in generated by automake 1.11.1 from Makefile.am.
+# Makefile.in generated by automake 1.11.5 from Makefile.am.
 # @configure_input@
 
 # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005, 2006, 2007, 2008, 2009  Free Software Foundation,
-# Inc.
+# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software
+# Foundation, Inc.
 # This Makefile.in is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
@@ -15,6 +15,23 @@
 
 @SET_MAKE@
 VPATH = @srcdir@
+am__make_dryrun = \
+  { \
+    am__dry=no; \
+    case $$MAKEFLAGS in \
+      *\\[\ \	]*) \
+        echo 'am--echo: ; @echo "AM"  OK' | $(MAKE) -f - 2>/dev/null \
+          | grep '^AM OK$$' >/dev/null || am__dry=yes;; \
+      *) \
+        for am__flg in $$MAKEFLAGS; do \
+          case $$am__flg in \
+            *=*|--*) ;; \
+            *n*) am__dry=yes; break;; \
+          esac; \
+        done;; \
+    esac; \
+    test $$am__dry = yes; \
+  }
 pkgdatadir = $(datadir)/@PACKAGE@
 pkgincludedir = $(includedir)/@PACKAGE@
 pkglibdir = $(libdir)/@PACKAGE@
@@ -36,21 +53,24 @@ host_triplet = @host@
 TESTS = gdcopn$(EXEEXT) big_test$(EXEEXT) $(am__EXEEXT_1)
 check_PROGRAMS = $(am__EXEEXT_2)
 subdir = bindings/f77/test
-DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
+DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \
+	$(srcdir)/test_getdata.f.in
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
 am__aclocal_m4_deps = $(top_srcdir)/m4/ax_compare_version.m4 \
 	$(top_srcdir)/m4/compiler.m4 $(top_srcdir)/m4/encoding.m4 \
-	$(top_srcdir)/m4/idl.m4 $(top_srcdir)/m4/libtool.m4 \
-	$(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \
-	$(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \
-	$(top_srcdir)/m4/python.m4 $(top_srcdir)/m4/win32.m4 \
-	$(top_srcdir)/m4/version.m4 $(top_srcdir)/configure.ac
+	$(top_srcdir)/m4/floatordering.m4 $(top_srcdir)/m4/idl.m4 \
+	$(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \
+	$(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \
+	$(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/m4/matlab.m4 \
+	$(top_srcdir)/m4/perl.m4 $(top_srcdir)/m4/python.m4 \
+	$(top_srcdir)/m4/win32.m4 $(top_srcdir)/m4/version.m4 \
+	$(top_srcdir)/configure.ac
 am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
 	$(ACLOCAL_M4)
 mkinstalldirs = $(install_sh) -d
-CONFIG_HEADER = $(top_builddir)/src/config.h \
+CONFIG_HEADER = $(top_builddir)/src/gd_config.h \
 	$(top_builddir)/src/getdata.h
-CONFIG_CLEAN_FILES =
+CONFIG_CLEAN_FILES = test_getdata.f
 CONFIG_CLEAN_VPATH_FILES =
 @MAKE_F95BINDINGS_TRUE at am__EXEEXT_1 = big_test95$(EXEEXT)
 am__EXEEXT_2 = gdcopn$(EXEEXT) big_test$(EXEEXT) $(am__EXEEXT_1)
@@ -84,6 +104,11 @@ SOURCES = $(big_test_SOURCES) $(big_test95_SOURCES) \
 	$(nodist_big_test95_SOURCES) $(gdcopn_SOURCES)
 DIST_SOURCES = $(big_test_SOURCES) $(big_test95_SOURCES) \
 	$(gdcopn_SOURCES)
+am__can_run_installinfo = \
+  case $$AM_UPDATE_INFO_DIR in \
+    n|no|NO) false;; \
+    *) (install-info --version) >/dev/null 2>&1;; \
+  esac
 ETAGS = etags
 CTAGS = ctags
 am__tty_colors = \
@@ -97,10 +122,13 @@ AUTOHEADER = @AUTOHEADER@
 AUTOMAKE = @AUTOMAKE@
 AWK = @AWK@
 BUILDCC = @BUILDCC@
-BUILD_DATE = @BUILD_DATE@
 BZIP2_CPPFLAGS = @BZIP2_CPPFLAGS@
 BZIP2_LDFLAGS = @BZIP2_LDFLAGS@
+BZIP2_LIBS = @BZIP2_LIBS@
 CC = @CC@
+CCAS = @CCAS@
+CCASDEPMODE = @CCASDEPMODE@
+CCASFLAGS = @CCASFLAGS@
 CCDEPMODE = @CCDEPMODE@
 CFLAGS = @CFLAGS@
 CPP = @CPP@
@@ -116,6 +144,7 @@ DEFINE_GD_NO_C99_API = @DEFINE_GD_NO_C99_API@
 DEFINE_gd_int16_t = @DEFINE_gd_int16_t@
 DEFINE_gd_int64_t = @DEFINE_gd_int64_t@
 DEFINE_gd_uint16_t = @DEFINE_gd_uint16_t@
+DEFINE_gd_uint64_t = @DEFINE_gd_uint64_t@
 DEFS = @DEFS@
 DEPDIR = @DEPDIR@
 DIFF = @DIFF@
@@ -131,18 +160,27 @@ EXEEXT = @EXEEXT@
 F77 = @F77@
 F95GETDATA_VERSION = @F95GETDATA_VERSION@
 FC = @FC@
-FCFLAGS = @FCFLAGS@ -I.. $(F77_WALL) $(FC_WEXTRA) $(FC_ASSUME)
-FFLAGS = @FFLAGS@ -I.. $(F77_WALL) $(F77_WEXTRA) $(F77_ASSUME)
+FCFLAGS = @FCFLAGS@ -I. -I.. $(F77_WALL) $(FC_WEXTRA) $(FC_ASSUME)
+FFLAGS = @FFLAGS@ -I. -I.. $(F77_WALL) $(F77_WEXTRA) $(F77_ASSUME) \
+	$(F77_FNO_BACKSLASH)
 FGETDATA_VERSION = @FGETDATA_VERSION@
 FGREP = @FGREP@
 FLIBS = @FLIBS@
+GD_DIRSEP = @GD_DIRSEP@
+GD_FDIRSEP = @GD_FDIRSEP@
 GETDATAXX_VERSION = @GETDATAXX_VERSION@
+GETDATA_DEBUG = @GETDATA_DEBUG@
 GETDATA_IFACE_AGE = @GETDATA_IFACE_AGE@
 GETDATA_IFACE_VERSION = @GETDATA_IFACE_VERSION@
 GETDATA_IMPL_REVISION = @GETDATA_IMPL_REVISION@
+GETDATA_MAJOR = @GETDATA_MAJOR@
+GETDATA_MINOR = @GETDATA_MINOR@
+GETDATA_REVISION = @GETDATA_REVISION@
+GETDATA_VERSION_SUFFIX = @GETDATA_VERSION_SUFFIX@
 GREP = @GREP@
 GZIP_CPPFLAGS = @GZIP_CPPFLAGS@
 GZIP_LDFLAGS = @GZIP_LDFLAGS@
+GZIP_LIBS = @GZIP_LIBS@
 IDL = @IDL@
 IDL_CFLAGS = @IDL_CFLAGS@
 IDL_LIBS = @IDL_LIBS@
@@ -165,8 +203,13 @@ LTDLINCL = @LTDLINCL@
 LTLIBOBJS = @LTLIBOBJS@
 LZMA_CPPFLAGS = @LZMA_CPPFLAGS@
 LZMA_LDFLAGS = @LZMA_LDFLAGS@
+LZMA_LIBS = @LZMA_LIBS@
 MAKEINFO = @MAKEINFO@
 MANIFEST_TOOL = @MANIFEST_TOOL@
+MATLAB = @MATLAB@
+MATLABGETDATA_VERSION = @MATLABGETDATA_VERSION@
+MATLAB_CPPFLAGS = @MATLAB_CPPFLAGS@
+MEX = @MEX@
 MKDIR_P = @MKDIR_P@
 NM = @NM@
 NMEDIT = @NMEDIT@
@@ -183,6 +226,9 @@ PACKAGE_TARNAME = @PACKAGE_TARNAME@
 PACKAGE_URL = @PACKAGE_URL@
 PACKAGE_VERSION = @PACKAGE_VERSION@
 PATH_SEPARATOR = @PATH_SEPARATOR@
+PERL = @PERL@
+PERL_MAN3EXT = @PERL_MAN3EXT@
+PRINTF = @PRINTF@
 PRIVATE_LIBS = @PRIVATE_LIBS@
 PYTHON = @PYTHON@
 PYTHON_CPPFLAGS = @PYTHON_CPPFLAGS@
@@ -194,8 +240,12 @@ SET_MAKE = @SET_MAKE@
 SHELL = @SHELL@
 SLIM_CPPFLAGS = @SLIM_CPPFLAGS@
 SLIM_LDFLAGS = @SLIM_LDFLAGS@
+SLIM_LIBS = @SLIM_LIBS@
 STRIP = @STRIP@
 VERSION = @VERSION@
+ZZIP_CPPFLAGS = @ZZIP_CPPFLAGS@
+ZZIP_LDFLAGS = @ZZIP_LDFLAGS@
+ZZIP_LIBS = @ZZIP_LIBS@
 abs_builddir = @abs_builddir@
 abs_srcdir = @abs_srcdir@
 abs_top_builddir = @abs_top_builddir@
@@ -239,6 +289,8 @@ libexecdir = @libexecdir@
 localedir = @localedir@
 localstatedir = @localstatedir@
 mandir = @mandir@
+matlabbasedir = @matlabbasedir@
+mexext = @mexext@
 mkdir_p = @mkdir_p@
 moduledir = @moduledir@
 oldincludedir = @oldincludedir@
@@ -248,8 +300,12 @@ path_gunzip = @path_gunzip@
 path_gzip = @path_gzip@
 path_slim = @path_slim@
 path_unslim = @path_unslim@
+path_unzip = @path_unzip@
 path_xz = @path_xz@
+path_zip = @path_zip@
 pdfdir = @pdfdir@
+perldir = @perldir@
+perlmandir = @perlmandir@
 prefix = @prefix@
 program_transform_name = @program_transform_name@
 psdir = @psdir@
@@ -263,7 +319,7 @@ top_build_prefix = @top_build_prefix@
 top_builddir = @top_builddir@
 top_srcdir = @top_srcdir@
 
-# Copyright (C) 2008-2010 D. V. Wiebe
+# Copyright (C) 2008-2010, 2012 D. V. Wiebe
 #
 ##########################################################################
 #
@@ -286,9 +342,11 @@ top_srcdir = @top_srcdir@
 AUTOMAKE_OPTIONS = foreign
 @FC_WALL_TRUE at FC_WALL = -Wall
 @F77_WALL_TRUE at F77_WALL = -Wall
+ at F77_FNO_BACKSLASH_TRUE@F77_FNO_BACKSLASH = -fno-backslash
 @INTEL_F77_COMPILER_TRUE at F77_ASSUME = -assume byterecl
 @INTEL_FC_COMPILER_TRUE at FC_ASSUME = -assume byterecl
 @MAKE_F95BINDINGS_TRUE at F95TESTS = big_test95
+BUILT_SOUCES = test_getdata.f
 F95LDADD = ../libf95getdata.la $(F77LDADD)
 F77LDADD = ../libfgetdata.la
 AM_LDFLAGS = -L..
@@ -333,6 +391,8 @@ $(top_srcdir)/configure:  $(am__configure_deps)
 $(ACLOCAL_M4):  $(am__aclocal_m4_deps)
 	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
 $(am__aclocal_m4_deps):
+test_getdata.f: $(top_builddir)/config.status $(srcdir)/test_getdata.f.in
+	cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@
 
 clean-checkPROGRAMS:
 	@list='$(check_PROGRAMS)'; test -n "$$list" || exit 0; \
@@ -342,13 +402,13 @@ clean-checkPROGRAMS:
 	list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \
 	echo " rm -f" $$list; \
 	rm -f $$list
-big_test$(EXEEXT): $(big_test_OBJECTS) $(big_test_DEPENDENCIES) 
+big_test$(EXEEXT): $(big_test_OBJECTS) $(big_test_DEPENDENCIES) $(EXTRA_big_test_DEPENDENCIES) 
 	@rm -f big_test$(EXEEXT)
 	$(F77LINK) $(big_test_OBJECTS) $(big_test_LDADD) $(LIBS)
-big_test95$(EXEEXT): $(big_test95_OBJECTS) $(big_test95_DEPENDENCIES) 
+big_test95$(EXEEXT): $(big_test95_OBJECTS) $(big_test95_DEPENDENCIES) $(EXTRA_big_test95_DEPENDENCIES) 
 	@rm -f big_test95$(EXEEXT)
 	$(FCLINK) $(big_test95_OBJECTS) $(big_test95_LDADD) $(LIBS)
-gdcopn$(EXEEXT): $(gdcopn_OBJECTS) $(gdcopn_DEPENDENCIES) 
+gdcopn$(EXEEXT): $(gdcopn_OBJECTS) $(gdcopn_DEPENDENCIES) $(EXTRA_gdcopn_DEPENDENCIES) 
 	@rm -f gdcopn$(EXEEXT)
 	$(F77LINK) $(gdcopn_OBJECTS) $(gdcopn_LDADD) $(LIBS)
 
@@ -515,14 +575,15 @@ check-TESTS: $(TESTS)
 	  fi; \
 	  dashes=`echo "$$dashes" | sed s/./=/g`; \
 	  if test "$$failed" -eq 0; then \
-	    echo "$$grn$$dashes"; \
+	    col="$$grn"; \
 	  else \
-	    echo "$$red$$dashes"; \
+	    col="$$red"; \
 	  fi; \
-	  echo "$$banner"; \
-	  test -z "$$skipped" || echo "$$skipped"; \
-	  test -z "$$report" || echo "$$report"; \
-	  echo "$$dashes$$std"; \
+	  echo "$${col}$$dashes$${std}"; \
+	  echo "$${col}$$banner$${std}"; \
+	  test -z "$$skipped" || echo "$${col}$$skipped$${std}"; \
+	  test -z "$$report" || echo "$${col}$$report$${std}"; \
+	  echo "$${col}$$dashes$${std}"; \
 	  test "$$failed" -eq 0; \
 	else :; fi
 
@@ -572,10 +633,15 @@ install-am: all-am
 
 installcheck: installcheck-am
 install-strip:
-	$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
-	  install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
-	  `test -z '$(STRIP)' || \
-	    echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+	if test -z '$(STRIP)'; then \
+	  $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+	    install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+	      install; \
+	else \
+	  $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+	    install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+	    "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
+	fi
 mostlyclean-generic:
 
 clean-generic:
diff --git a/bindings/f77/test/big_test.f b/bindings/f77/test/big_test.f
index f26bbd5..8ca0e95 100644
--- a/bindings/f77/test/big_test.f
+++ b/bindings/f77/test/big_test.f
@@ -1,4 +1,4 @@
-C     Copyright (C) 2009-2010 D. V. Wiebe
+C     Copyright (C) 2009-2012 D. V. Wiebe
 C
 C     CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC
 C
@@ -8,12 +8,12 @@ C     GetData is free software; you can redistribute it and/or modify it under
 C     the terms of the GNU Lesser General Public License as published by the
 C     Free Software Foundation; either version 2.1 of the License, or (at your
 C     option) any later version.
-C    
+C
 C     GetData is distributed in the hope that it will be useful, but WITHOUT
 C     ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
 C     FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
 C     License for more details.
-C    
+C
 C     You should have received a copy of the GNU Lesser General Public License
 C     along with GetData; if not, write to the Free Software Foundation, Inc.,
 C     51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
@@ -22,11 +22,154 @@ C
 C     General test
 C
 C     This very large test checks almost every procedure defined by the
-C     F77 bindings.  Procedures not tested include: GDCOPN GDMFLS GDFLSH
-C     GDDSCD GDCLBK GDCLOS (although this last one is used)
+C     F77 bindings.  Procedures not tested include: GDCOPN GDMFLS GDCLOS
+C     GDCLBK GDDSCD (although this last one is used)
+
+C     Check functions
+      SUBROUTINE CHKERR(NE, T, D, V)
+      INCLUDE "getdata.f"
+      INTEGER NE, T, D, V, E
+      CALL GDEROR(E, D)
+
+      IF (E .NE. V) THEN
+        NE = NE + 1
+        WRITE(*, 9001) T, E, V
+      ENDIF
+ 9001 FORMAT('e[', i3, '] = ', i4, ', expected ', i4)
+      END SUBROUTINE
+
+      SUBROUTINE CHKINT(NE, T, N, V)
+      INTEGER NE, T, N, V
+
+      IF (N .NE. V) THEN
+        NE = NE + 1
+        WRITE(*, 9002) T, N, V
+      ENDIF
+ 9002 FORMAT('n[', i3, '] = ', i4, ', expected ', i4)
+      END SUBROUTINE
+
+      SUBROUTINE CHKER2(NE, T, I, D, V)
+      INCLUDE "getdata.f"
+      INTEGER NE, T, I, D, V, E
+      CALL GDEROR(E, D)
+
+      IF (E .NE. V) THEN
+        NE = NE + 1
+        WRITE(*, 9006) I, T, E, V
+      ENDIF
+ 9006 FORMAT('e(', i3, ')[', i3, '] = ', i4, ', expected ', i4)
+      END SUBROUTINE
+
+      SUBROUTINE CHKIN2(NE, T, I, N, V)
+      INTEGER NE, T, I, N, V
+
+      IF (N .NE. V) THEN
+        NE = NE + 1
+        WRITE(*, 9007) I, T, N, V
+      ENDIF
+ 9007 FORMAT('n(', i3, ')[', i3, '] = ', i4, ', expected ', i4)
+      END SUBROUTINE
+
+      SUBROUTINE CHKST2(NE, T, I, N, V)
+      INTEGER NE, T, I
+      CHARACTER*(*) N, V
+
+      IF (N .NE. V) THEN
+        NE = NE + 1
+        WRITE(*, 9008) I, T, N, V
+      ENDIF
+ 9008 FORMAT('s(', i3, ')[', i3, '] = "', a, '", expected "', a, '"')
+      END SUBROUTINE
+
+      SUBROUTINE CHKSTR(NE, T, N, V)
+      INTEGER NE, T
+      CHARACTER*(*) N, V
+
+      IF (N .NE. V) THEN
+        NE = NE + 1
+        WRITE(*, 9009) T, N, V
+      ENDIF
+ 9009 FORMAT('s[', i3, '] = "', a, '", expected "', a, '"')
+      END SUBROUTINE
+
+      SUBROUTINE CHKDB2(NE, T, I, N, V)
+      INTEGER NE, T, I
+      REAL*8 N, V
+
+      IF (ABS(N - V) .GT. 1E-5) THEN
+        NE = NE + 1
+        WRITE(*, 9010) I, T, N, V
+      ENDIF
+ 9010 FORMAT('d(', i3, ')[', i3, '] = ', d16.10, ', expected ', d16.10)
+      END SUBROUTINE
+
+      SUBROUTINE CHKCP2(NE, T, I, N, V)
+      INTEGER NE, T, I
+      COMPLEX*16 N, V
+
+      IF (ABS(N - V) .GT. 1E-5) THEN
+        NE = NE + 1
+        WRITE(*, 9011) I, T, REAL(REAL(N)), REAL(AIMAG(N)),
+     +REAL(REAL(V)), REAL(AIMAG(V))
+      ENDIF
+ 9011 FORMAT('x(', i3, ')[', i3, '] = ', d16.10, ';', d16.10,
+     +', expected ', d16.10, ';', d16.10)
+      END SUBROUTINE
+
+      SUBROUTINE CHKDBL(NE, T, N, V)
+      INTEGER NE, T
+      REAL*8 N, V
+
+      IF (ABS(N - V) .GT. 1E-5) THEN
+        NE = NE + 1
+        WRITE(*, 9012) T, N, V
+      ENDIF
+ 9012 FORMAT('d[', i3, '] = ', d16.10, ', expected ', d16.10)
+      END SUBROUTINE
+
+      SUBROUTINE CHKCPX(NE, T, N, V)
+      INTEGER NE, T
+      COMPLEX*16 N, V
+
+      IF (ABS(N - V) .GT. 1E-5) THEN
+        NE = NE + 1
+        WRITE(*, 9013) T, REAL(REAL(N)), REAL(AIMAG(N)),
+     +REAL(REAL(V)), REAL(AIMAG(V))
+      ENDIF
+ 9013 FORMAT('x[', i3, '] = ', d16.10, ';', d16.10,
+     +', expected ', d16.10, ';', d16.10)
+      END SUBROUTINE
+
+      SUBROUTINE CHKEOS(NE, T, N, V)
+      INTEGER NE, T, F
+      CHARACTER*(*) N, V
+
+      F = INDEX(N, V)
+      IF (F .EQ. 0) THEN
+        F = 1
+      ENDIF
+
+      CALL CHKSTR(NE, T, N(F:), V)
+      END SUBROUTINE
+
+      SUBROUTINE CHKEOK(NE, T, D)
+      INTEGER NE, T, D
+      INCLUDE "getdata.f"
+      CALL CHKERR(NE, T, D, GD_EOK)
+      END SUBROUTINE
+
+      SUBROUTINE CHKOK2(NE, T, I, D)
+      INTEGER NE, T, I, D
+      INCLUDE "getdata.f"
+      CALL CHKER2(NE, T, I, D, GD_EOK)
+      END SUBROUTINE
+
+
+
 
       PROGRAM BIGTST
       INCLUDE "getdata.f"
+      INCLUDE "test_getdata.f"
 
       CHARACTER*12 fildir
       PARAMETER (fildir = 'test_dirfile')
@@ -37,22 +180,28 @@ C     GDDSCD GDCLBK GDCLOS (although this last one is used)
       CHARACTER*17 dat
       PARAMETER (dat = 'test_dirfile/data')
       INTEGER flen
-      PARAMETER (flen = 7)
+      PARAMETER (flen = 11)
       INTEGER nfields
-      PARAMETER (nfields = 14)
-
-      CHARACTER*7 fields(nfields + 7)
-      CHARACTER*7 fn
-      CHARACTER*20 str
+      PARAMETER (nfields = 17)
+      INTEGER slen
+      PARAMETER (slen = 26)
+      INTEGER plen
+      PARAMETER (plen = 4096)
+
+      CHARACTER*26 strings(3)
+      CHARACTER*11 fields(nfields + 9)
+      CHARACTER*11 fn
+      CHARACTER*26 str
+      CHARACTER*4096 path
       INTEGER*1 c(8)
       INTEGER*1 datdat(80)
       INTEGER*1 k
       INTEGER i
       INTEGER d
-      INTEGER e
       INTEGER m
       INTEGER n
       INTEGER l
+      INTEGER j
       INTEGER ne
       REAL fl
       REAL*8 dp
@@ -68,19 +217,22 @@ C     GDDSCD GDCLBK GDCLOS (although this last one is used)
    10 CONTINUE
 
       fields(1) = 'INDEX  '
-      fields(2) = 'bit    '
-      fields(3) = 'carray '
-      fields(4) = 'const  '
-      fields(5) = 'data   '
-      fields(6) = 'div    '
-      fields(7) = 'lincom '
-      fields(8) = 'linterp'
-      fields(9) = 'mult   '
-      fields(10) = 'phase  '
-      fields(11) = 'polynom'
-      fields(12) = 'recip  '
-      fields(13) = 'sbit   '
-      fields(14) = 'string '
+      fields(2) = 'alias  '
+      fields(3) = 'bit    '
+      fields(4) = 'carray '
+      fields(5) = 'const  '
+      fields(6) = 'data   '
+      fields(7) = 'div    '
+      fields(8) = 'lincom '
+      fields(9) = 'linterp'
+      fields(10) = 'mplex  '
+      fields(11) = 'mult   '
+      fields(12) = 'phase  '
+      fields(13) = 'polynom'
+      fields(14) = 'recip  '
+      fields(15) = 'sbit   '
+      fields(16) = 'string '
+      fields(17) = 'window '
 
 C     Write the test dirfile
       OPEN(1, FILE=frmat, STATUS='NEW')
@@ -93,15 +245,18 @@ C     Write the test dirfile
       WRITE(1, *) '/META data mlut LINTERP DATA ./lut'
       WRITE(1, *) 'const CONST FLOAT64 5.5'
       WRITE(1, *) 'carray CARRAY FLOAT64 1.1 2.2 3.3 4.4 5.5 6.6'
-      WRITE(1, *) 'linterp LINTERP data /look/up/file'
+      WRITE(1, *) 'linterp LINTERP data ./lut'
       WRITE(1, *) 'polynom POLYNOM data 1.1 2.2 2.2 3.3;4.4
      + const const'
       WRITE(1, *) 'bit BIT data 3 4'
       WRITE(1, *) 'sbit SBIT data 5 6'
+      WRITE(1, *) 'mplex MPLEX data sbit 1 10'
       WRITE(1, *) 'mult MULTIPLY data sbit'
       WRITE(1, *) 'phase PHASE data 11'
       WRITE(1, *) 'div DIVIDE mult bit'
       WRITE(1, *) 'recip RECIP div 6.5;4.3'
+      WRITE(1, *) 'window WINDOW linterp mult LT 4.1'
+      WRITE(1, *) '/ALIAS alias data'
       WRITE(1, *) 'string STRING "Zaphod Beeblebrox"'
       CLOSE(1, STATUS='KEEP')
 
@@ -114,152 +269,63 @@ C     Write the test dirfile
       WRITE(1, REC=1) datdat
       CLOSE(1, STATUS='KEEP')
 
+      ne = 0
 C     0: GDEROR check
       CALL GDOPEN(d, "x", 1, GD_RO)
-      CALL GDEROR(e, d)
-
-      ne = 0
-      IF (e .NE. GD_EOP) THEN
-        ne = ne + 1
-        WRITE(*, 2001) 0, e
-      ENDIF
+      CALL CHKERR(ne, 0, d, GD_EOP)
 
 C     1: GDOPEN check
       CALL GDOPEN(d, fildir, 12, GD_RW)
-      CALL GDEROR(e, d)
-
-      IF (e .NE. GD_EOK) THEN
-        ne = ne + 1
-        WRITE(*, 2001) 1, e
-      ENDIF
+      CALL CHKEOK(ne, 1, d)
 
 C     2: GDGETD check
       CALL GDGETD(n, d, 'data', 4, 5, 0, 1, 0, GD_I8, c)
-      CALL GDEROR(e, d)
-
-      IF (e .NE. GD_EOK) THEN
-        ne = ne + 1
-        WRITE(*, 2001) 2, e
-      ENDIF
-
-      IF (n .NE. 8) THEN
-        ne = ne + 1
-        WRITE(*, 2002) 2, n
-      ENDIF
+      CALL CHKEOK(ne, 2, d)
+      CALL CHKINT(ne, 2, n, 8)
 
       DO 20 i = 1, 8
-      IF (c(i) .NE. 40 + i) THEN
-        ne = ne + 1
-        WRITE(*, 2004) i, 2, c(i)
-      ENDIF
+      CALL CHKIN2(ne, 2, i, INT(c(i)), 40 + i)
    20 CONTINUE
 
 C     3: GDGTCO check
       CALL GDGTCO(d, 'const', 5, GD_F32, fl)
-      CALL GDEROR(e, d)
-
-      IF (e .NE. GD_EOK) THEN
-        ne = ne + 1
-        WRITE(*, 2001) 3, e
-      ENDIF
-
-      IF (abs(fl - 5.5) .gt. 0.001) THEN
-        ne = ne + 1
-        WRITE(*, 2005) 3, fl
-      ENDIF
+      CALL CHKEOK(ne, 3, d)
+      CALL CHKDBL(ne, 3, 1d0 * fl, 5.5d0)
 
 C     4: GDFDNX check
       CALL GDFDNX(i, d)
-      CALL GDEROR(e, d)
-
-      IF (e .NE. GD_EOK) THEN
-        ne = ne + 1
-        WRITE(*, 2001) 4, e
-      ENDIF
-
-      IF (i .NE. flen) THEN
-        ne = ne + 1
-        WRITE(*, 2002) 4, i
-      ENDIF
+      CALL CHKEOK(ne, 4, d)
+      CALL CHKINT(ne, 4, i, 7)
 
 C     5: GDMFNX check
       CALL GDMFNX(i, d, 'data', 4)
-      CALL GDEROR(e, d)
-
-      IF (e .NE. GD_EOK) THEN
-        ne = ne + 1
-        WRITE(*, 2001) 5, e
-      ENDIF
-
-      IF (i .NE. 6) THEN
-        ne = ne + 1
-        WRITE(*, 2002) 5, i
-      ENDIF
+      CALL CHKEOK(ne, 5, d)
+      CALL CHKINT(ne, 5, i, 6)
 
 C     6: GDNFLD check
       CALL GDNFLD(n, d)
-      CALL GDEROR(e, d)
-
-      IF (e .NE. GD_EOK) THEN
-        ne = ne + 1
-        WRITE(*, 2001) 6, e
-      ENDIF
-
-      IF (n .NE. nfields) THEN
-        ne = ne + 1
-        WRITE(*, 2002) 6, n
-      ENDIF
+      CALL CHKEOK(ne, 6, d)
+      CALL CHKINT(ne, 6, n, nfields)
 
 C     7: This is a check of (one of many instances of) _GDF_FString
       l = 2
       CALL GDFLDN(fn, l, d, 1)
-      CALL GDEROR(e, d)
-
-      IF (e .NE. GD_EOK) THEN
-        ne = ne + 1
-        WRITE(*, 2001) 7, e
-      ENDIF
-
-      IF (l .NE. 5) THEN
-        ne = ne + 1
-        WRITE(*, 2002) 7, l
-      ENDIF
+      CALL CHKEOK(ne, 7, d)
+      CALL CHKINT(ne, 7, l, 5)
 
 C     8: GDFLDN check
       DO 80 i = 1, n
       l = flen
       CALL GDFLDN(fn, l, d, i)
-      CALL GDEROR(e, d)
-
-      IF (e .NE. GD_EOK) THEN
-        ne = ne + 1
-        WRITE(*, 2006) 8, i, e
-      ENDIF
-
-      IF (l .NE. flen) THEN
-        ne = ne + 1
-        WRITE(*, 2007) 8, i, l
-      ENDIF
-
-      IF (fn .NE. fields(i)) THEN
-        ne = ne + 1
-        WRITE(*, 2008) i, 8, fn
-      ENDIF
+      CALL CHKOK2(ne, 8, i, d)
+      CALL CHKIN2(ne, 8, i, l, flen)
+      CALL CHKST2(ne, 8, i, fn, fields(i))
    80 CONTINUE
 
 C     9: GDNMFD check
       CALL GDNMFD(n, d, 'data', 4)
-      CALL GDEROR(e, d)
-
-      IF (e .NE. GD_EOK) THEN
-        ne = ne + 1
-        WRITE(*, 2001) 9, e
-      ENDIF
-
-      IF (n .NE. 3) THEN
-        ne = ne + 1
-        WRITE(*, 2002) 9, n
-      ENDIF
+      CALL CHKEOK(ne, 9, d)
+      CALL CHKINT(ne, 9, n, 3)
 
 C     10: GDMFDN check
       fields(1) = 'mstr'
@@ -268,51 +334,20 @@ C     10: GDMFDN check
       DO 100 i = 1, n
       l = flen
       CALL GDMFDN(fn, l, d, 'data', 4, i)
-      CALL GDEROR(e, d)
-
-      IF (e .NE. GD_EOK) THEN
-        ne = ne + 1
-        WRITE(*, 2006) 10, i, e
-      ENDIF
-
-      IF (l .NE. flen) THEN
-        ne = ne + 1
-        WRITE(*, 2007) 10, i, l
-      ENDIF
-
-      IF (fn .NE. fields(i)) THEN
-        ne = ne + 1
-        WRITE(*, 2008) i, 10, fn
-      ENDIF
+      CALL CHKOK2(ne, 10, i, d)
+      CALL CHKIN2(ne, 10, i, l, flen)
+      CALL CHKST2(ne, 10, i, fn, fields(i))
   100 CONTINUE
 
 C     11: GDNFRM check
       CALL GDNFRM(n, d)
-      CALL GDEROR(e, d)
-
-      IF (e .NE. GD_EOK) THEN
-        ne = ne + 1
-        WRITE(*, 2001) 11, e
-      ENDIF
-
-      IF (n .NE. 10) THEN
-        ne = ne + 1
-        WRITE(*, 2002) 11, n
-      ENDIF
+      CALL CHKEOK(ne, 11, d)
+      CALL CHKINT(ne, 11, n, 10)
 
 C     12: GDGSPF check
       CALL GDGSPF(n, d, 'data', 4)
-      CALL GDEROR(e, d)
-
-      IF (e .NE. GD_EOK) THEN
-        ne = ne + 1
-        WRITE(*, 2001) 12, e
-      ENDIF
-
-      IF (n .NE. 8) THEN
-        ne = ne + 1
-        WRITE(*, 2002) 12, n
-      ENDIF
+      CALL CHKEOK(ne, 12, d)
+      CALL CHKINT(ne, 12, n, 8)
 
 C     13: GDPUTD check
       c(1) = 13
@@ -324,115 +359,48 @@ C     13: GDPUTD check
       c(7) = 19
       c(8) = 20
       CALL GDPUTD(n, d, 'data', 4, 5, 1, 0, 4, GD_I8, c)
-      CALL GDEROR(e, d)
-
-      IF (e .NE. GD_EOK) THEN
-        ne = ne + 1
-        WRITE(*, 2001) 13, e
-      ENDIF
-
-      IF (n .NE. 4) THEN
-        ne = ne + 1
-        WRITE(*, 2002) 13, n
-      ENDIF
+      CALL CHKEOK(ne, 13, d)
+      CALL CHKINT(ne, 13, n, 4)
 
       CALL GDGETD(n, d, 'data', 4, 5, 0, 1, 0, GD_I8, c)
 
       DO 130 i = 1, 8
-      IF (((i .EQ. 1 .OR. i .GT. 5) .AND. c(i) .NE. 40 + i) .OR.
-     +(i .GT. 1 .AND. i .LT. 6) .AND. c(i) .NE. 11 + i) THEN
-        ne = ne + 1
-        WRITE(*, 2004) i, 13, c(i)
+      IF (i .EQ. 1 .OR. i .GT. 5) THEN
+        n = 40 + i
+      ELSE
+        n = 11 + i
       ENDIF
+      CALL CHKIN2(ne, 13, i, INT(c(i)), n)
   130 CONTINUE
 
 C     14: GDESTR check
       CALL GDGETD(n, d, 'x', 1, 5, 0, 1, 0, GD_I8, c)
-      CALL GDESTR(d, str, 20)
-
-      IF (str .NE. 'Field not found: x  ') THEN
-        ne = ne + 1
-        WRITE(*, 2009) 14, str
-      ENDIF
+      CALL GDESTR(d, str, slen)
+      CALL CHKSTR(ne, 14, str, 'Field not found: x')
 
 C     15: GDENTY check
       CALL GDENTY(n, d, 'data', 4)
-      CALL GDEROR(e, d)
-
-      IF (e .NE. GD_EOK) THEN
-        ne = ne + 1
-        WRITE(*, 2001) 15, e
-      ENDIF
-
-      IF (n .NE. GD_RWE) THEN
-        ne = ne + 1
-        WRITE(*, 2002) 15, n
-      ENDIF
+      CALL CHKEOK(ne, 15, d)
+      CALL CHKINT(ne, 15, n, GD_RWE)
 
 C     16: GDGERW check
       CALL GDGERW(l, i, n, d, 'data', 4)
-      CALL GDEROR(e, d)
-
-      IF (e .NE. GD_EOK) THEN
-        ne = ne + 1
-        WRITE(*, 2001) 16, e
-      ENDIF
-
-      IF (n .NE. 0) THEN
-        ne = ne + 1
-        WRITE(*, 2007) 16, 1, n
-      ENDIF
-
-      IF (l .NE. 8) THEN
-        ne = ne + 1
-        WRITE(*, 2007) 16, 2, l
-      ENDIF
-
-      IF (i .NE. GD_I8) THEN
-        ne = ne + 1
-        WRITE(*, 2007) 16, 3, i
-      ENDIF
+      CALL CHKEOK(ne, 16, d)
+      CALL CHKIN2(ne, 16, 1, n, 0)
+      CALL CHKIN2(ne, 16, 2, l, 8)
+      CALL CHKIN2(ne, 16, 3, i, GD_I8)
 
 C     17: GDGELC check
       l = flen
       CALL GDGELC(i, fields(1), l, p(1), p(2), fields(2), l, p(3),
      +p(4), fields(3), l, p(5), p(6), n, d, 'lincom', 6)
-      CALL GDEROR(e, d)
-
-      IF (e .NE. GD_EOK) THEN
-        ne = ne + 1
-        WRITE(*, 2001) 17, e
-      ENDIF
-
-      IF (l .NE. flen) THEN
-        ne = ne + 1
-        WRITE(*, 2007) 17, 1, l
-      ENDIF
-
-      IF (i .NE. 3) THEN
-        ne = ne + 1
-        WRITE(*, 2007) 17, 2, i
-      ENDIF
-
-      IF (n .NE. 0) THEN
-        ne = ne + 1
-        WRITE(*, 2007) 17, 3, n
-      ENDIF
-
-      IF (fields(1) .NE. 'data') THEN
-        ne = ne + 1
-        WRITE(*, 2008) 17, 4, fields(1)
-      ENDIF
-
-      IF (fields(2) .NE. 'INDEX') THEN
-        ne = ne + 1
-        WRITE(*, 2008) 17, 5, fields(2)
-      ENDIF
-
-      IF (fields(3) .NE. 'linterp') THEN
-        ne = ne + 1
-        WRITE(*, 2008) 17, 6, fields(3)
-      ENDIF
+      CALL CHKEOK(ne, 17, d)
+      CALL CHKIN2(ne, 17, 1, l, flen)
+      CALL CHKIN2(ne, 17, 2, i, 3)
+      CALL CHKIN2(ne, 17, 3, n, 0)
+      CALL CHKST2(ne, 17, 4, fields(1), 'data')
+      CALL CHKST2(ne, 17, 5, fields(2), 'INDEX')
+      CALL CHKST2(ne, 17, 6, fields(3), 'linterp')
 
       q(1) = 1.1
       q(2) = 2.2
@@ -441,52 +409,20 @@ C     17: GDGELC check
       q(5) = 5.5
       q(6) = 5.5
       DO 170 i=1,6
-      IF (abs(p(i) - q(i)) .gt. 0.001) THEN
-        ne = ne + 1
-        WRITE(*, 2010) i, 17, p(i)
-      ENDIF
+      CALL CHKDB2(ne, 17, i, p(i), q(i))
   170 CONTINUE
 
 C     18: GDGECL check
       l = flen
       CALL GDGECL(i, fields(1), l, cp(1), cp(2), fields(2), l, cp(3),
      +cp(4), fields(3), l, cp(5), cp(6), n, d, 'lincom', 6)
-      CALL GDEROR(e, d)
-
-      IF (e .NE. GD_EOK) THEN
-        ne = ne + 1
-        WRITE(*, 2001) 18, e
-      ENDIF
-
-      IF (l .NE. flen) THEN
-        ne = ne + 1
-        WRITE(*, 2007) 18, 1, l
-      ENDIF
-
-      IF (i .NE. 3) THEN
-        ne = ne + 1
-        WRITE(*, 2007) 18, 2, i
-      ENDIF
-
-      IF (n .NE. 0) THEN
-        ne = ne + 1
-        WRITE(*, 2007) 18, 3, n
-      ENDIF
-
-      IF (fields(1) .NE. 'data') THEN
-        ne = ne + 1
-        WRITE(*, 2008) 18, 4, fields(1)
-      ENDIF
-
-      IF (fields(2) .NE. 'INDEX') THEN
-        ne = ne + 1
-        WRITE(*, 2008) 18, 5, fields(2)
-      ENDIF
-
-      IF (fields(3) .NE. 'linterp') THEN
-        ne = ne + 1
-        WRITE(*, 2008) 18, 6, fields(3)
-      ENDIF
+      CALL CHKEOK(ne, 18, d)
+      CALL CHKIN2(ne, 18, 1, l, flen)
+      CALL CHKIN2(ne, 18, 2, i, 3)
+      CALL CHKIN2(ne, 18, 3, n, 0)
+      CALL CHKST2(ne, 18, 4, fields(1), 'data')
+      CALL CHKST2(ne, 18, 5, fields(2), 'INDEX')
+      CALL CHKST2(ne, 18, 6, fields(3), 'linterp')
 
       cq(1) = cmplx(1.1, 0.0)
       cq(2) = cmplx(2.2, 0.0)
@@ -495,42 +431,18 @@ C     18: GDGECL check
       cq(5) = cmplx(5.5, 0.0)
       cq(6) = cmplx(5.5, 0.0)
       DO 180 i=1,6
-      IF (abs(cp(i) - cq(i)) .gt. 0.001) THEN
-        ne = ne + 1
-        WRITE(*, 2011) i, 18, REAL(REAL(cp(i))), REAL(AIMAG(cp(i)))
-      ENDIF
+      CALL CHKCP2(ne, 18, i, cp(i), cq(i))
   180 CONTINUE
 
 C     19: GDGEPN check
       l = flen
       CALL GDGEPN(i, fn, l, p(1), p(2), p(3), p(4), p(5), p(6),
      +n, d, 'polynom', 7)
-      CALL GDEROR(e, d)
-
-      IF (e .NE. GD_EOK) THEN
-        ne = ne + 1
-        WRITE(*, 2001) 19, e
-      ENDIF
-
-      IF (l .NE. flen) THEN
-        ne = ne + 1
-        WRITE(*, 2007) 19, 1, l
-      ENDIF
-
-      IF (i .NE. 5) THEN
-        ne = ne + 1
-        WRITE(*, 2007) 19, 2, i
-      ENDIF
-
-      IF (n .NE. 0) THEN
-        ne = ne + 1
-        WRITE(*, 2007) 19, 3, n
-      ENDIF
-
-      IF (fn .NE. 'data') THEN
-        ne = ne + 1
-        WRITE(*, 2008) 19, 4, fn
-      ENDIF
+      CALL CHKEOK(ne, 19, d)
+      CALL CHKIN2(ne, 19, 1, l, flen)
+      CALL CHKIN2(ne, 19, 2, i, 5)
+      CALL CHKIN2(ne, 19, 3, n, 0)
+      CALL CHKST2(ne, 19, 4, fn, 'data')
 
       q(1) = 1.1
       q(2) = 2.2
@@ -539,42 +451,18 @@ C     19: GDGEPN check
       q(5) = 5.5
       q(6) = 5.5
       DO 190 i=1,6
-      IF (abs(p(i) - q(i)) .gt. 0.001) THEN
-        ne = ne + 1
-        WRITE(*, 2010) i, 19, p(i)
-      ENDIF
+      CALL CHKDB2(ne, 19, i, p(i), q(i))
   190 CONTINUE
 
 C     20: GDGECP check
       l = flen
       CALL GDGECP(i, fn, l, cp(1), cp(2), cp(3), cp(4), cp(5), cp(6),
      +n, d, 'polynom', 7)
-      CALL GDEROR(e, d)
-
-      IF (e .NE. GD_EOK) THEN
-        ne = ne + 1
-        WRITE(*, 2001) 20, e
-      ENDIF
-
-      IF (l .NE. flen) THEN
-        ne = ne + 1
-        WRITE(*, 2007) 20, 1, l
-      ENDIF
-
-      IF (i .NE. 5) THEN
-        ne = ne + 1
-        WRITE(*, 2007) 20, 2, i
-      ENDIF
-
-      IF (n .NE. 0) THEN
-        ne = ne + 1
-        WRITE(*, 2007) 20, 3, n
-      ENDIF
-
-      IF (fn .NE. 'data') THEN
-        ne = ne + 1
-        WRITE(*, 2008) 20, 4, fn
-      ENDIF
+      CALL CHKEOK(ne, 20, d)
+      CALL CHKIN2(ne, 20, 1, l, flen)
+      CALL CHKIN2(ne, 20, 2, i, 5)
+      CALL CHKIN2(ne, 20, 3, n, 0)
+      CALL CHKST2(ne, 20, 4, fn, 'data')
 
       cq(1) = cmplx(1.1, 0.0)
       cq(2) = cmplx(2.2, 0.0)
@@ -583,281 +471,91 @@ C     20: GDGECP check
       cq(5) = cmplx(5.5, 0.0)
       cq(6) = cmplx(5.5, 0.0)
       DO 200 i=1,6
-      IF (abs(cp(i) - cq(i)) .gt. 0.001) THEN
-        ne = ne + 1
-        WRITE(*, 2011) i, 30, REAL(REAL(cp(i))), REAL(AIMAG(cp(i)))
-      ENDIF
+      CALL CHKCP2(ne, 20, i, cp(i), cq(i))
   200 CONTINUE
 
 C     21: GDGELT check
       l = flen
-      CALL GDGELT(fn, l, str, 20, n, d, 'linterp', 7)
-      CALL GDEROR(e, d)
-
-      IF (e .NE. GD_EOK) THEN
-        ne = ne + 1
-        WRITE(*, 2001) 21, e
-      ENDIF
-
-      IF (l .NE. flen) THEN
-        ne = ne + 1
-        WRITE(*, 2007) 21, 1, l
-      ENDIF
-
-      IF (n .NE. 0) THEN
-        ne = ne + 1
-        WRITE(*, 2007) 21, 2, n
-      ENDIF
-
-      IF (fn .NE. 'data') THEN
-        ne = ne + 1
-        WRITE(*, 2008) 21, 3, fn
-      ENDIF
-
-      IF (str .NE. '/look/up/file') THEN
-        ne = ne + 1
-        WRITE(*, 2008) 21, 4, str
-      ENDIF
+      CALL GDGELT(fn, l, str, slen, n, d, 'linterp', 7)
+      CALL CHKEOK(ne, 21, d)
+      CALL CHKIN2(ne, 21, 1, l, flen)
+      CALL CHKIN2(ne, 21, 2, n, 0)
+      CALL CHKST2(ne, 21, 3, fn, 'data')
+      CALL CHKST2(ne, 21, 4, str, './lut')
 
 C     22: GDGEBT check
       l = flen
       CALL GDGEBT(fn, l, m, i, n, d, 'bit', 3)
-      CALL GDEROR(e, d)
-
-      IF (e .NE. GD_EOK) THEN
-        ne = ne + 1
-        WRITE(*, 2001) 22, e
-      ENDIF
-
-      IF (l .NE. flen) THEN
-        ne = ne + 1
-        WRITE(*, 2007) 22, 1, l
-      ENDIF
-
-      IF (n .NE. 0) THEN
-        ne = ne + 1
-        WRITE(*, 2007) 22, 2, n
-      ENDIF
-
-      IF (i .NE. 4) THEN
-        ne = ne + 1
-        WRITE(*, 2007) 22, 3, i
-      ENDIF
-
-      IF (m .NE. 3) THEN
-        ne = ne + 1
-        WRITE(*, 2007) 22, 4, m
-      ENDIF
-
-      IF (fn .NE. 'data') THEN
-        ne = ne + 1
-        WRITE(*, 2008) 22, 5, fn
-      ENDIF
+      CALL CHKEOK(ne, 22, d)
+      CALL CHKIN2(ne, 22, 1, l, flen)
+      CALL CHKIN2(ne, 22, 2, n, 0)
+      CALL CHKIN2(ne, 22, 3, i, 4)
+      CALL CHKIN2(ne, 22, 4, m, 3)
+      CALL CHKST2(ne, 22, 5, fn, 'data')
 
 C     23: GDGESB check
       l = flen
       CALL GDGESB(fn, l, m, i, n, d, 'sbit', 4)
-      CALL GDEROR(e, d)
-
-      IF (e .NE. GD_EOK) THEN
-        ne = ne + 1
-        WRITE(*, 2001) 23, e
-      ENDIF
-
-      IF (l .NE. flen) THEN
-        ne = ne + 1
-        WRITE(*, 2007) 23, 1, l
-      ENDIF
-
-      IF (n .NE. 0) THEN
-        ne = ne + 1
-        WRITE(*, 2007) 23, 2, n
-      ENDIF
-
-      IF (i .NE. 6) THEN
-        ne = ne + 1
-        WRITE(*, 2007) 23, 3, i
-      ENDIF
-
-      IF (m .NE. 5) THEN
-        ne = ne + 1
-        WRITE(*, 2007) 23, 4, m
-      ENDIF
-
-      IF (fn .NE. 'data') THEN
-        ne = ne + 1
-        WRITE(*, 2008) 23, 5, fn
-      ENDIF
+      CALL CHKEOK(ne, 23, d)
+      CALL CHKIN2(ne, 23, 1, l, flen)
+      CALL CHKIN2(ne, 23, 2, n, 0)
+      CALL CHKIN2(ne, 23, 3, i, 6)
+      CALL CHKIN2(ne, 23, 4, m, 5)
+      CALL CHKST2(ne, 23, 5, fn, 'data')
 
 C     24: GDGEMT check
       l = flen
       CALL GDGEMT(fields(1), l, fields(2), l, n, d, 'mult', 4)
-      CALL GDEROR(e, d)
-
-      IF (e .NE. GD_EOK) THEN
-        ne = ne + 1
-        WRITE(*, 2001) 24, e
-      ENDIF
-
-      IF (l .NE. flen) THEN
-        ne = ne + 1
-        WRITE(*, 2007) 24, 1, l
-      ENDIF
-
-      IF (n .NE. 0) THEN
-        ne = ne + 1
-        WRITE(*, 2007) 24, 2, n
-      ENDIF
-
-      IF (fields(1) .NE. 'data') THEN
-        ne = ne + 1
-        WRITE(*, 2008) 24, 3, fields(1)
-      ENDIF
-
-      IF (fields(2) .NE. 'sbit') THEN
-        ne = ne + 1
-        WRITE(*, 2008) 24, 4, fields(2)
-      ENDIF
+      CALL CHKEOK(ne, 24, d)
+      CALL CHKIN2(ne, 24, 1, l, flen)
+      CALL CHKIN2(ne, 24, 2, n, 0)
+      CALL CHKST2(ne, 24, 3, fields(1), 'data')
+      CALL CHKST2(ne, 24, 4, fields(2), 'sbit')
 
 C     25: GDGEPH check
       l = flen
       CALL GDGEPH(fn, l, i, n, d, 'phase', 5)
-      CALL GDEROR(e, d)
-
-      IF (e .NE. GD_EOK) THEN
-        ne = ne + 1
-        WRITE(*, 2001) 25, e
-      ENDIF
-
-      IF (l .NE. flen) THEN
-        ne = ne + 1
-        WRITE(*, 2007) 25, 1, l
-      ENDIF
-
-      IF (n .NE. 0) THEN
-        ne = ne + 1
-        WRITE(*, 2007) 25, 2, n
-      ENDIF
-
-      IF (i .NE. 11) THEN
-        ne = ne + 1
-        WRITE(*, 2007) 25, 3, i
-      ENDIF
-
-      IF (fn .NE. 'data') THEN
-        ne = ne + 1
-        WRITE(*, 2008) 25, 4, fn
-      ENDIF
+      CALL CHKEOK(ne, 25, d)
+      CALL CHKIN2(ne, 25, 1, l, flen)
+      CALL CHKIN2(ne, 25, 2, n, 0)
+      CALL CHKIN2(ne, 25, 3, i, 11)
+      CALL CHKST2(ne, 25, 4, fn, 'data')
 
 C     26: GDGECO check
       CALL GDGECO(i, n, d, 'const', 5)
-      CALL GDEROR(e, d)
-
-      IF (e .NE. GD_EOK) THEN
-        ne = ne + 1
-        WRITE(*, 2001) 26, e
-      ENDIF
-
-      IF (n .NE. 0) THEN
-        ne = ne + 1
-        WRITE(*, 2007) 26, 1, n
-      ENDIF
-
-      IF (i .NE. GD_F64) THEN
-        ne = ne + 1
-        WRITE(*, 2007) 26, 2, i
-      ENDIF
+      CALL CHKEOK(ne, 26, d)
+      CALL CHKIN2(ne, 26, 1, n, 0)
+      CALL CHKIN2(ne, 26, 2, i, GD_F64)
 
 C     27: GDFRGI check
       CALL GDFRGI(n, d, 'const', 5)
-      CALL GDEROR(e, d)
-
-      IF (e .NE. GD_EOK) THEN
-        ne = ne + 1
-        WRITE(*, 2001) 27, e
-      ENDIF
-
-      IF (n .NE. 0) THEN
-        ne = ne + 1
-        WRITE(*, 2002) 27, n
-      ENDIF
+      CALL CHKEOK(ne, 27, d)
+      CALL CHKINT(ne, 27, n, 0)
 
 C     28: GDADRW check
       CALL GDADRW(d, 'new1', 4, GD_F64, 3, 0)
-      CALL GDEROR(e, d)
-
-      IF (e .NE. GD_EOK) THEN
-        ne = ne + 1
-        WRITE(*, 2006) 28, 1, e
-      ENDIF
+      CALL CHKOK2(ne, 28, 1, d)
 
       CALL GDGERW(l, i, n, d, 'new1', 4)
-      CALL GDEROR(e, d)
-
-      IF (e .NE. GD_EOK) THEN
-        ne = ne + 1
-        WRITE(*, 2006) 28, 2, e
-      ENDIF
-
-      IF (n .NE. 0) THEN
-        ne = ne + 1
-        WRITE(*, 2007) 28, 3, n
-      ENDIF
-
-      IF (l .NE. 3) THEN
-        ne = ne + 1
-        WRITE(*, 2007) 28, 4, l
-      ENDIF
-
-      IF (i .NE. GD_F64) THEN
-        ne = ne + 1
-        WRITE(*, 2007) 28, 5, i
-      ENDIF
+      CALL CHKOK2(ne, 28, 2, d)
+      CALL CHKIN2(ne, 28, 3, n, 0)
+      CALL CHKIN2(ne, 28, 4, l, 3)
+      CALL CHKIN2(ne, 28, 5, i, GD_F64)
 
 C     29: GDADLC check
       CALL GDADLC(d, 'new2', 4, 2, 'in1', 3, 9.9d0, 8.8d0, 'in2', 3,
      +7.7d0, 6.6d0, '', 0, 0d0, 0d0, 0)
-      CALL GDEROR(e, d)
-
-      IF (e .NE. GD_EOK) THEN
-        ne = ne + 1
-        WRITE(*, 2006) 29, 1, e
-      ENDIF
+      CALL CHKOK2(ne, 29, 1, d)
 
       l = flen
       CALL GDGELC(i, fields(1), l, p(1), p(2), fields(2), l, p(3),
      +p(4), fields(3), l, p(5), p(6), n, d, 'new2', 4)
-      CALL GDEROR(e, d)
-
-      IF (e .NE. GD_EOK) THEN
-        ne = ne + 1
-        WRITE(*, 2006) 29, 2, e
-      ENDIF
-
-      IF (l .NE. flen) THEN
-        ne = ne + 1
-        WRITE(*, 2007) 29, 3, l
-      ENDIF
-
-      IF (i .NE. 2) THEN
-        ne = ne + 1
-        WRITE(*, 2007) 29, 4, i
-      ENDIF
-
-      IF (n .NE. 0) THEN
-        ne = ne + 1
-        WRITE(*, 2007) 29, 5, n
-      ENDIF
-
-      IF (fields(1) .NE. 'in1') THEN
-        ne = ne + 1
-        WRITE(*, 2008) 29, 6, fields(1)
-      ENDIF
-
-      IF (fields(2) .NE. 'in2') THEN
-        ne = ne + 1
-        WRITE(*, 2008) 29, 7, fields(2)
-      ENDIF
+      CALL CHKOK2(ne, 29, 2, d)
+      CALL CHKIN2(ne, 29, 3, l, flen)
+      CALL CHKIN2(ne, 29, 4, i, 2)
+      CALL CHKIN2(ne, 29, 5, n, 0)
+      CALL CHKST2(ne, 29, 6, fields(1), 'in1')
+      CALL CHKST2(ne, 29, 7, fields(2), 'in2')
 
       q(1) = 9.9
       q(2) = 8.8
@@ -866,10 +564,7 @@ C     29: GDADLC check
       q(5) = 5.5
       q(6) = 5.5
       DO 290 i=1,4
-      IF (abs(p(i) - q(i)) .gt. 0.001) THEN
-        ne = ne + 1
-        WRITE(*, 2010) i, 29, p(i)
-      ENDIF
+      CALL CHKDB2(ne, 29, i, p(i), q(i))
   290 CONTINUE
 
 C     30: GDADCL check
@@ -879,98 +574,39 @@ C     30: GDADCL check
       cq(4) = cmplx(1.6, 1.7)
       CALL GDADCL(d, 'new3', 4, 2, 'in1', 3, cq(1), cq(2), 'in2', 3,
      +cq(3), cq(4), '', 0, cq(5), cq(6), 0)
-      CALL GDEROR(e, d)
-
-      IF (e .NE. GD_EOK) THEN
-        ne = ne + 1
-        WRITE(*, 2006) 30, 1, e
-      ENDIF
+      CALL CHKOK2(ne, 30, 1, d)
 
       l = flen
       CALL GDGECL(i, fields(1), l, cp(1), cp(2), fields(2), l, cp(3),
      +cp(4), fields(3), l, cp(5), cp(6), n, d, 'new3', 4)
-      CALL GDEROR(e, d)
-
-      IF (e .NE. GD_EOK) THEN
-        ne = ne + 1
-        WRITE(*, 2001) 30, e
-      ENDIF
-
-      IF (l .NE. flen) THEN
-        ne = ne + 1
-        WRITE(*, 2007) 30, 1, l
-      ENDIF
-
-      IF (i .NE. 2) THEN
-        ne = ne + 1
-        WRITE(*, 2007) 30, 2, i
-      ENDIF
-
-      IF (n .NE. 0) THEN
-        ne = ne + 1
-        WRITE(*, 2007) 30, 3, n
-      ENDIF
-
-      IF (fields(1) .NE. 'in1') THEN
-        ne = ne + 1
-        WRITE(*, 2008) 30, 4, fields(1)
-      ENDIF
-
-      IF (fields(2) .NE. 'in2') THEN
-        ne = ne + 1
-        WRITE(*, 2008) 30, 5, fields(2)
-      ENDIF
+      CALL CHKOK2(ne, 30, 2, d)
+      CALL CHKIN2(ne, 30, 1, l, flen)
+      CALL CHKIN2(ne, 30, 2, i, 2)
+      CALL CHKIN2(ne, 30, 3, n, 0)
+      CALL CHKST2(ne, 30, 4, fields(1), 'in1')
+      CALL CHKST2(ne, 30, 5, fields(2), 'in2')
 
       cq(1) = cmplx(1.1, 1.2)
       cq(2) = cmplx(1.3, 1.4)
       cq(3) = cmplx(1.4, 1.5)
       cq(4) = cmplx(1.6, 1.7)
       DO 300 i=1,4
-      IF (abs(cp(i) - cq(i)) .gt. 0.001) THEN
-        ne = ne + 1
-        WRITE(*, 2011) i, 30, REAL(REAL(cp(i))), REAL(AIMAG(cp(i)))
-      ENDIF
+      CALL CHKCP2(ne, 30, i, cp(i), cq(i))
   300 CONTINUE
 
 C     31: GDADPN check
       CALL GDADPN(d, 'new4', 4, 3, 'in1', 3, 3d3, 4d4, 5d5, 6d6, 0d0,
      +0d0, 0)
-      CALL GDEROR(e, d)
-
-      IF (e .NE. GD_EOK) THEN
-        ne = ne + 1
-        WRITE(*, 2006) 31, 1, e
-      ENDIF
+      CALL CHKOK2(ne, 31, 1, d)
 
       l = flen
       CALL GDGEPN(i, fn, l, p(1), p(2), p(3), p(4), p(5), p(6),
      +n, d, 'new4', 4)
-      CALL GDEROR(e, d)
-
-      IF (e .NE. GD_EOK) THEN
-        ne = ne + 1
-        WRITE(*, 2006) 31, 2, e
-      ENDIF
-
-      IF (l .NE. flen) THEN
-        ne = ne + 1
-        WRITE(*, 2007) 31, 1, l
-      ENDIF
-
-      IF (i .NE. 3) THEN
-        ne = ne + 1
-        WRITE(*, 2007) 31, 2, i
-      ENDIF
-
-      IF (n .NE. 0) THEN
-        ne = ne + 1
-        WRITE(*, 2007) 31, 3, n
-      ENDIF
-
-      IF (fn .NE. 'in1') THEN
-        ne = ne + 1
-        WRITE(*, 2008) 31, 4, fn
-      ENDIF
+      CALL CHKOK2(ne, 31, 2, d)
+      CALL CHKIN2(ne, 31, 1, l, flen)
+      CALL CHKIN2(ne, 31, 2, i, 3)
+      CALL CHKIN2(ne, 31, 3, n, 0)
+      CALL CHKST2(ne, 31, 4, fn, 'in1')
 
       q(1) = 3d3
       q(2) = 4d4
@@ -980,10 +616,7 @@ C     31: GDADPN check
       q(6) = 5.5d0
 
       DO 310 i=1,4
-      IF (abs(p(i) - q(i)) .gt. 0.001) THEN
-        ne = ne + 1
-        WRITE(*, 2010) i, 31, p(i)
-      ENDIF
+      CALL CHKDB2(ne, 31, i, p(i), q(i))
   310 CONTINUE
 
 C     32: GDADCP check
@@ -993,357 +626,125 @@ C     32: GDADCP check
       cq(4) = cmplx(6.3, 4.4)
       CALL GDADCP(d, 'new5', 4, 3, 'in1', 3, cq(1), cq(2), cq(3), cq(4),
      +cq(5), cq(6), 0)
-      CALL GDEROR(e, d)
-
-      IF (e .NE. GD_EOK) THEN
-        ne = ne + 1
-        WRITE(*, 2006) 32, 1, e
-      ENDIF
+      CALL CHKOK2(ne, 32, 1, d)
 
       l = flen
       CALL GDGECP(i, fn, l, cp(1), cp(2), cp(3), cp(4), cp(5), cp(6),
      +n, d, 'new5', 4)
-      CALL GDEROR(e, d)
-
-      IF (e .NE. GD_EOK) THEN
-        ne = ne + 1
-        WRITE(*, 2006) 32, 2, e
-      ENDIF
-
-      IF (l .NE. flen) THEN
-        ne = ne + 1
-        WRITE(*, 2007) 32, 1, l
-      ENDIF
-
-      IF (i .NE. 3) THEN
-        ne = ne + 1
-        WRITE(*, 2007) 32, 2, i
-      ENDIF
-
-      IF (n .NE. 0) THEN
-        ne = ne + 1
-        WRITE(*, 2007) 32, 3, n
-      ENDIF
-
-      IF (fn .NE. 'in1') THEN
-        ne = ne + 1
-        WRITE(*, 2008) 32, 4, fn
-      ENDIF
+      CALL CHKOK2(ne, 32, 2, d)
+      CALL CHKIN2(ne, 32, 1, l, flen)
+      CALL CHKIN2(ne, 32, 2, i, 3)
+      CALL CHKIN2(ne, 32, 3, n, 0)
+      CALL CHKST2(ne, 32, 4, fn, 'in1')
 
       cq(1) = cmplx(3.1, 7.0)
       cq(2) = cmplx(4.2, 8.0)
       cq(3) = cmplx(5.2, 9.0)
       cq(4) = cmplx(6.3, 4.4)
       DO 320 i=1,4
-      IF (abs(cp(i) - cq(i)) .gt. 0.001) THEN
-        ne = ne + 1
-        WRITE(*, 2011) i, 32, REAL(REAL(cp(i))), REAL(AIMAG(cp(i)))
-      ENDIF
+      CALL CHKCP2(ne, 32, i, cp(i), cq(i))
   320 CONTINUE
 
 C     33: GDADLT check
       CALL GDADLT(d, "new6", 4, "in", 2, "./some/table", 12, 0)
-      CALL GDEROR(e, d)
-
-      IF (e .NE. GD_EOK) THEN
-        ne = ne + 1
-        WRITE(*, 2006) 33, 1, e
-      ENDIF
+      CALL CHKOK2(ne, 33, 1, d)
 
       l = flen
-      CALL GDGELT(fn, l, str, 20, n, d, 'new6', 4)
-      CALL GDEROR(e, d)
-
-      IF (e .NE. GD_EOK) THEN
-        ne = ne + 1
-        WRITE(*, 2006) 33, 2, e
-      ENDIF
-
-      IF (l .NE. flen) THEN
-        ne = ne + 1
-        WRITE(*, 2007) 33, 1, l
-      ENDIF
-
-      IF (n .NE. 0) THEN
-        ne = ne + 1
-        WRITE(*, 2007) 33, 2, n
-      ENDIF
-
-      IF (fn .NE. 'in') THEN
-        ne = ne + 1
-        WRITE(*, 2008) 33, 3, fn
-      ENDIF
-
-      IF (str .NE. './some/table') THEN
-        ne = ne + 1
-        WRITE(*, 2008) 33, 4, str
-      ENDIF
+      CALL GDGELT(fn, l, str, slen, n, d, 'new6', 4)
+      CALL CHKOK2(ne, 33, 2, d)
+      CALL CHKIN2(ne, 33, 1, l, flen)
+      CALL CHKIN2(ne, 33, 2, n, 0)
+      CALL CHKST2(ne, 33, 3, fn, 'in')
+      CALL CHKST2(ne, 33, 4, str, './some/table')
 
 C     34: GDADBT check
       CALL GDADBT(d, "new7", 4, "in", 2, 13, 12, 0)
-      CALL GDEROR(e, d)
-
-      IF (e .NE. GD_EOK) THEN
-        ne = ne + 1
-        WRITE(*, 2006) 34, 1, e
-      ENDIF
+      CALL CHKOK2(ne, 34, 1, d)
 
       l = flen
       CALL GDGEBT(fn, l, m, i, n, d, 'new7', 4)
-      CALL GDEROR(e, d)
-
-      IF (e .NE. GD_EOK) THEN
-        ne = ne + 1
-        WRITE(*, 2006) 34, 2, e
-      ENDIF
-
-      IF (l .NE. flen) THEN
-        ne = ne + 1
-        WRITE(*, 2007) 34, 1, l
-      ENDIF
-
-      IF (n .NE. 0) THEN
-        ne = ne + 1
-        WRITE(*, 2007) 34, 2, n
-      ENDIF
-
-      IF (i .NE. 12) THEN
-        ne = ne + 1
-        WRITE(*, 2007) 34, 3, i
-      ENDIF
-
-      IF (m .NE. 13) THEN
-        ne = ne + 1
-        WRITE(*, 2007) 34, 4, m
-      ENDIF
-
-      IF (fn .NE. 'in') THEN
-        ne = ne + 1
-        WRITE(*, 2008) 34, 5, fn
-      ENDIF
+      CALL CHKOK2(ne, 34, 2, d)
+      CALL CHKIN2(ne, 34, 1, l, flen)
+      CALL CHKIN2(ne, 34, 2, n, 0)
+      CALL CHKIN2(ne, 34, 3, i, 12)
+      CALL CHKIN2(ne, 34, 4, m, 13)
+      CALL CHKST2(ne, 34, 5, fn, 'in')
 
 C     35: GDADSB check
       CALL GDADSB(d, "new8", 4, "in", 2, 13, 12, 0)
-      CALL GDEROR(e, d)
-
-      IF (e .NE. GD_EOK) THEN
-        ne = ne + 1
-        WRITE(*, 2006) 35, 1, e
-      ENDIF
+      CALL CHKOK2(ne, 35, 1, d)
 
       l = flen
       CALL GDGESB(fn, l, m, i, n, d, 'new8', 4)
-      CALL GDEROR(e, d)
-
-      IF (e .NE. GD_EOK) THEN
-        ne = ne + 1
-        WRITE(*, 2006) 35, 2, e
-      ENDIF
-
-      IF (l .NE. flen) THEN
-        ne = ne + 1
-        WRITE(*, 2007) 35, 1, l
-      ENDIF
-
-      IF (n .NE. 0) THEN
-        ne = ne + 1
-        WRITE(*, 2007) 35, 2, n
-      ENDIF
-
-      IF (i .NE. 12) THEN
-        ne = ne + 1
-        WRITE(*, 2007) 35, 3, i
-      ENDIF
-
-      IF (m .NE. 13) THEN
-        ne = ne + 1
-        WRITE(*, 2007) 35, 4, m
-      ENDIF
-
-      IF (fn .NE. 'in') THEN
-        ne = ne + 1
-        WRITE(*, 2008) 35, 5, fn
-      ENDIF
+      CALL CHKOK2(ne, 35, 2, d)
+      CALL CHKIN2(ne, 35, 1, l, flen)
+      CALL CHKIN2(ne, 35, 2, n, 0)
+      CALL CHKIN2(ne, 35, 3, i, 12)
+      CALL CHKIN2(ne, 35, 4, m, 13)
+      CALL CHKST2(ne, 35, 5, fn, 'in')
 
 C     36: GDADMT check
       CALL GDADMT(d, 'new9', 4, 'in1', 3, 'in2', 3, 0)
-      CALL GDEROR(e, d)
-
-      IF (e .NE. GD_EOK) THEN
-        ne = ne + 1
-        WRITE(*, 2006) 36, 1, e
-      ENDIF
+      CALL CHKOK2(ne, 36, 1, d)
 
       l = flen
       CALL GDGEMT(fields(1), l, fields(2), l, n, d, 'new9', 4)
-      CALL GDEROR(e, d)
-
-      IF (e .NE. GD_EOK) THEN
-        ne = ne + 1
-        WRITE(*, 2006) 36, 2, e
-      ENDIF
-
-      IF (l .NE. flen) THEN
-        ne = ne + 1
-        WRITE(*, 2007) 36, 1, l
-      ENDIF
-
-      IF (n .NE. 0) THEN
-        ne = ne + 1
-        WRITE(*, 2007) 36, 2, n
-      ENDIF
-
-      IF (fields(1) .NE. 'in1') THEN
-        ne = ne + 1
-        WRITE(*, 2008) 36, 3, fields(1)
-      ENDIF
-
-      IF (fields(2) .NE. 'in2') THEN
-        ne = ne + 1
-        WRITE(*, 2008) 36, 4, fields(2)
-      ENDIF
+      CALL CHKOK2(ne, 36, 2, d)
+      CALL CHKIN2(ne, 36, 1, l, flen)
+      CALL CHKIN2(ne, 36, 2, n, 0)
+      CALL CHKST2(ne, 36, 3, fields(1), 'in1')
+      CALL CHKST2(ne, 36, 4, fields(2), 'in2')
 
 C     37: GDADPH check
       CALL GDADPH(d, 'new10', 5, 'in1', 3, 22, 0)
-      CALL GDEROR(e, d)
-
-      IF (e .NE. GD_EOK) THEN
-        ne = ne + 1
-        WRITE(*, 2006) 37, 1, e
-      ENDIF
+      CALL CHKOK2(ne, 37, 1, d)
 
       l = flen
       CALL GDGEPH(fn, l, i, n, d, 'new10', 5)
-      CALL GDEROR(e, d)
-
-      IF (e .NE. GD_EOK) THEN
-        ne = ne + 1
-        WRITE(*, 2006) 37, 2, e
-      ENDIF
-
-      IF (l .NE. flen) THEN
-        ne = ne + 1
-        WRITE(*, 2007) 37, 1, l
-      ENDIF
-
-      IF (n .NE. 0) THEN
-        ne = ne + 1
-        WRITE(*, 2007) 37, 2, n
-      ENDIF
-
-      IF (i .NE. 22) THEN
-        ne = ne + 1
-        WRITE(*, 2007) 37, 3, i
-      ENDIF
-
-      IF (fn .NE. 'in1') THEN
-        ne = ne + 1
-        WRITE(*, 2008) 37, 4, fn
-      ENDIF
+      CALL CHKOK2(ne, 37, 2, d)
+      CALL CHKIN2(ne, 37, 1, l, flen)
+      CALL CHKIN2(ne, 37, 2, n, 0)
+      CALL CHKIN2(ne, 37, 3, i, 22)
+      CALL CHKST2(ne, 37, 4, fn, 'in1')
 
 C     38: GDADCO check
       CALL GDADCO(d, 'new11', 5, GD_F64, GD_F32, -8.1, 0)
-      CALL GDEROR(e, d)
-
-      IF (e .NE. GD_EOK) THEN
-        ne = ne + 1
-        WRITE(*, 2006) 38, 1, e
-      ENDIF
+      CALL CHKOK2(ne, 38, 1, d)
 
       CALL GDGECO(i, n, d, 'new11', 5)
-      CALL GDEROR(e, d)
-
-      IF (e .NE. GD_EOK) THEN
-        ne = ne + 1
-        WRITE(*, 2006) 38, 2, e
-      ENDIF
-
-      IF (n .NE. 0) THEN
-        ne = ne + 1
-        WRITE(*, 2007) 38, 1, n
-      ENDIF
-
-      IF (i .NE. GD_F64) THEN
-        ne = ne + 1
-        WRITE(*, 2007) 38, 2, i
-      ENDIF
+      CALL CHKOK2(ne, 38, 2, d)
+      CALL CHKIN2(ne, 38, 1, n, 0)
+      CALL CHKIN2(ne, 38, 2, i, GD_F64)
 
       CALL GDGTCO(d, 'new11', 5, GD_F32, fl)
-      CALL GDEROR(e, d)
-
-      IF (e .NE. GD_EOK) THEN
-        ne = ne + 1
-        WRITE(*, 2006) 38, 3, e
-      ENDIF
-
-      IF (abs(fl + 8.1) .gt. 0.001) THEN
-        ne = ne + 1
-        WRITE(*, 2005) 38, fl
-      ENDIF
+      CALL CHKOK2(ne, 38, 3, d)
+      CALL CHKDBL(ne, 38, 1d0 * fl, -8.1d0)
 
 C     39: GDFRGN check
-      CALL GDFRGN(str, 20, d, 0)
-      CALL GDEROR(e, d)
-
-      IF (e .NE. GD_EOK) THEN
-        ne = ne + 1
-        WRITE(*, 2001) 39, e
-      ENDIF
+      l = plen
+      CALL GDFRGN(path, l, d, 0)
 
-      IF (str .NE. 'test_dirfile/format') THEN
-        ne = ne + 1
-        WRITE(*, 2009), 39, str
-      ENDIF
+      CALL CHKEOK(ne, 39, d)
+      CALL CHKINT(ne, 39, l, plen)
+      CALL CHKEOS(ne, 39, path, 'test_dirfile'//DIRSEP//'format')
 
 C     40: GDNFRG check
       CALL GDNFRG(n, d)
-      CALL GDEROR(e, d)
-
-      IF (e .NE. GD_EOK) THEN
-        ne = ne + 1
-        WRITE(*, 2001) 40, e
-      ENDIF
-
-      IF (n .NE. 1) THEN
-        ne = ne + 1
-        WRITE(*, 2002), 40, n
-      ENDIF
+      CALL CHKEOK(ne, 40, d)
+      CALL CHKINT(ne, 40, n, 1)
 
 C     41: GDINCL check
       CALL GDINCL(d, 'form2', 5, 0, 0)
-      CALL GDEROR(e, d)
-
-      IF (e .NE. GD_EOK) THEN
-        ne = ne + 1
-        WRITE(*, 2006) 41, 3, e
-      ENDIF
+      CALL CHKOK2(ne, 41, 1, d)
 
       CALL GDGTCO(d, 'const2', 6, GD_I8, c(1))
-      CALL GDEROR(e, d)
-
-      IF (e .NE. GD_EOK) THEN
-        ne = ne + 1
-        WRITE(*, 2006) 41, 3, e
-      ENDIF
-
-      IF (c(1) .NE. -19) THEN
-        ne = ne + 1
-        WRITE(*, 2004) 1, 41, c(1)
-      ENDIF
+      CALL CHKOK2(ne, 41, 2, d)
+      CALL CHKINT(ne, 41, INT(c(1)), -19)
 
 C     42: GDNFDT check
       CALL GDNFDT(n, d, GD_LCE)
-      CALL GDEROR(e, d)
-
-      IF (e .NE. GD_EOK) THEN
-        ne = ne + 1
-        WRITE(*, 2001) 42, e
-      ENDIF
-
-      IF (n .NE. 3) THEN
-        ne = ne + 1
-        WRITE(*, 2002), 42, n
-      ENDIF
+      CALL CHKEOK(ne, 42, d)
+      CALL CHKINT(ne, 42, n, 3)
 
 C     43: GDFDNT check
       fields(1) = 'lincom'
@@ -1352,125 +753,63 @@ C     43: GDFDNT check
       DO 430 i = 1, n
       l = flen
       CALL GDFDNT(fn, l, d, GD_LCE, i)
-      CALL GDEROR(e, d)
-
-      IF (e .NE. GD_EOK) THEN
-        ne = ne + 1
-        WRITE(*, 2006) 43, i, e
-      ENDIF
-
-      IF (l .NE. flen) THEN
-        ne = ne + 1
-        WRITE(*, 2007) 43, i, l
-      ENDIF
-
-      IF (fn .NE. fields(i)) THEN
-        ne = ne + 1
-        WRITE(*, 2008) i, 43, fn
-      ENDIF
+      CALL CHKOK2(ne, 43, i, d)
+      CALL CHKIN2(ne, 43, i, l, flen)
+      CALL CHKST2(ne, 43, i, fn, fields(i))
   430 CONTINUE
 
 C     44: GDNVEC check
       CALL GDNVEC(n, d)
-      CALL GDEROR(e, d)
-
-      IF (e .NE. GD_EOK) THEN
-        ne = ne + 1
-        WRITE(*, 2001) 44, e
-      ENDIF
-
-      IF (n .NE. 21) THEN
-        ne = ne + 1
-        WRITE(*, 2002), 44, n
-      ENDIF
+      CALL CHKEOK(ne, 44, d)
+      CALL CHKINT(ne, 44, n, 24)
 
 C     45: GDVECN check
       fields(1) = 'INDEX  '
-      fields(2) = 'bit    '
-      fields(3) = 'data   '
-      fields(4) = 'div    '
-      fields(5) = 'lincom '
-      fields(6) = 'linterp'
-      fields(7) = 'mult   '
-      fields(8) = 'new1   '
-      fields(9) = 'new10  '
-      fields(10) = 'new2   '
-      fields(11) = 'new3   '
-      fields(12) = 'new4   '
-      fields(13) = 'new5   '
-      fields(14) = 'new6   '
-      fields(15) = 'new7   '
-      fields(16) = 'new8   '
-      fields(17) = 'new9   '
-      fields(18) = 'phase  '
-      fields(19) = 'polynom'
-      fields(20) = 'recip  '
-      fields(21) = 'sbit   '
+      fields(2) = 'alias  '
+      fields(3) = 'bit    '
+      fields(4) = 'data   '
+      fields(5) = 'div    '
+      fields(6) = 'lincom '
+      fields(7) = 'linterp'
+      fields(8) = 'mplex  '
+      fields(9) = 'mult   '
+      fields(10) = 'new1   '
+      fields(11) = 'new10  '
+      fields(12) = 'new2   '
+      fields(13) = 'new3   '
+      fields(14) = 'new4   '
+      fields(15) = 'new5   '
+      fields(16) = 'new6   '
+      fields(17) = 'new7   '
+      fields(18) = 'new8   '
+      fields(19) = 'new9   '
+      fields(20) = 'phase  '
+      fields(21) = 'polynom'
+      fields(22) = 'recip  '
+      fields(23) = 'sbit   '
+      fields(24) = 'window '
       DO 450 i = 1, n
       l = flen
       CALL GDVECN(fn, l, d, i)
-      CALL GDEROR(e, d)
-
-      IF (e .NE. GD_EOK) THEN
-        ne = ne + 1
-        WRITE(*, 2006) 45, i, e
-      ENDIF
-
-      IF (l .NE. flen) THEN
-        ne = ne + 1
-        WRITE(*, 2007) 45, i, l
-      ENDIF
-
-      IF (fn .NE. fields(i)) THEN
-        ne = ne + 1
-        WRITE(*, 2008) i, 45, fn
-      ENDIF
+      CALL CHKOK2(ne, 45, i, d)
+      CALL CHKIN2(ne, 45, i, l, flen)
+      CALL CHKST2(ne, 45, i, fn, fields(i))
   450 CONTINUE
 
 C     46: GDMDLC check
       CALL GDMDLC(d, 'data', 4, 'mnew1', 5, 2, 'in1', 3, 9.9d0, 8.8d0,
      +'in2', 3, 7.7d0, 6.6d0, '', 0, 0d0, 0d0)
-      CALL GDEROR(e, d)
-
-      IF (e .NE. GD_EOK) THEN
-        ne = ne + 1
-        WRITE(*, 2006) 46, 1, e
-      ENDIF
+      CALL CHKOK2(ne, 46, 1, d)
 
       l = flen
       CALL GDGELC(i, fields(1), l, p(1), p(2), fields(2), l, p(3),
      +p(4), fields(3), l, p(5), p(6), n, d, 'data/mnew1', 10)
-      CALL GDEROR(e, d)
-
-      IF (e .NE. GD_EOK) THEN
-        ne = ne + 1
-        WRITE(*, 2006) 46, 2, e
-      ENDIF
-
-      IF (l .NE. flen) THEN
-        ne = ne + 1
-        WRITE(*, 2007) 46, 3, l
-      ENDIF
-
-      IF (i .NE. 2) THEN
-        ne = ne + 1
-        WRITE(*, 2007) 46, 4, i
-      ENDIF
-
-      IF (n .NE. 0) THEN
-        ne = ne + 1
-        WRITE(*, 2007) 46, 5, n
-      ENDIF
-
-      IF (fields(1) .NE. 'in1') THEN
-        ne = ne + 1
-        WRITE(*, 2008) 46, 6, fields(1)
-      ENDIF
-
-      IF (fields(2) .NE. 'in2') THEN
-        ne = ne + 1
-        WRITE(*, 2008) 46, 7, fields(2)
-      ENDIF
+      CALL CHKOK2(ne, 46, 2, d)
+      CALL CHKIN2(ne, 46, 3, l, flen)
+      CALL CHKIN2(ne, 46, 4, i, 2)
+      CALL CHKIN2(ne, 46, 5, n, 0)
+      CALL CHKST2(ne, 46, 6, fields(1), 'in1')
+      CALL CHKST2(ne, 46, 7, fields(2), 'in2')
 
       q(1) = 9.9
       q(2) = 8.8
@@ -1479,10 +818,7 @@ C     46: GDMDLC check
       q(5) = 5.5
       q(6) = 5.5
       DO 460 i=1,4
-      IF (abs(p(i) - q(i)) .gt. 0.001) THEN
-        ne = ne + 1
-        WRITE(*, 2010) i, 46, p(i)
-      ENDIF
+      CALL CHKDB2(ne, 46, i, p(i), q(i))
   460 CONTINUE
 
 C     47: GDMDCL check
@@ -1492,98 +828,39 @@ C     47: GDMDCL check
       cq(4) = cmplx(1.6, 1.7)
       CALL GDMDCL(d, 'data', 4, 'mnew2', 5, 2, 'in1', 3, cq(1), cq(2),
      +'in2', 3, cq(3), cq(4), '', 0, cq(5), cq(6))
-      CALL GDEROR(e, d)
-
-      IF (e .NE. GD_EOK) THEN
-        ne = ne + 1
-        WRITE(*, 2006) 47, 1, e
-      ENDIF
+      CALL CHKOK2(ne, 47, 1, d)
 
       l = flen
       CALL GDGECL(i, fields(1), l, cp(1), cp(2), fields(2), l, cp(3),
      +cp(4), fields(3), l, cp(5), cp(6), n, d, 'data/mnew2', 10)
-      CALL GDEROR(e, d)
-
-      IF (e .NE. GD_EOK) THEN
-        ne = ne + 1
-        WRITE(*, 2001) 47, e
-      ENDIF
-
-      IF (l .NE. flen) THEN
-        ne = ne + 1
-        WRITE(*, 2007) 47, 1, l
-      ENDIF
-
-      IF (i .NE. 2) THEN
-        ne = ne + 1
-        WRITE(*, 2007) 47, 2, i
-      ENDIF
-
-      IF (n .NE. 0) THEN
-        ne = ne + 1
-        WRITE(*, 2007) 47, 3, n
-      ENDIF
-
-      IF (fields(1) .NE. 'in1') THEN
-        ne = ne + 1
-        WRITE(*, 2008) 47, 4, fields(1)
-      ENDIF
-
-      IF (fields(2) .NE. 'in2') THEN
-        ne = ne + 1
-        WRITE(*, 2008) 47, 5, fields(2)
-      ENDIF
+      CALL CHKOK2(ne, 47, 2, d)
+      CALL CHKIN2(ne, 47, 1, l, flen)
+      CALL CHKIN2(ne, 47, 2, i, 2)
+      CALL CHKIN2(ne, 47, 3, n, 0)
+      CALL CHKST2(ne, 47, 4, fields(1), 'in1')
+      CALL CHKST2(ne, 47, 5, fields(2), 'in2')
 
       cq(1) = cmplx(1.1, 1.2)
       cq(2) = cmplx(1.3, 1.4)
       cq(3) = cmplx(1.4, 1.5)
       cq(4) = cmplx(1.6, 1.7)
       DO 470 i=1,4
-      IF (abs(cp(i) - cq(i)) .gt. 0.001) THEN
-        ne = ne + 1
-        WRITE(*, 2011) i, 47, REAL(REAL(cp(i))), REAL(AIMAG(cp(i)))
-      ENDIF
+      CALL CHKCP2(ne, 47, i, cp(i), cq(i))
   470 CONTINUE
 
 C     48: GDMDPN check
       CALL GDMDPN(d, 'data', 4, 'mnew3', 5, 3, 'in1', 3, 3d3, 4d4, 5d5,
      +6d6, 0d0, 0d0)
-      CALL GDEROR(e, d)
-
-      IF (e .NE. GD_EOK) THEN
-        ne = ne + 1
-        WRITE(*, 2006) 48, 1, e
-      ENDIF
+      CALL CHKOK2(ne, 48, 1, d)
 
       l = flen
       CALL GDGEPN(i, fn, l, p(1), p(2), p(3), p(4), p(5), p(6),
      +n, d, 'data/mnew3', 10)
-      CALL GDEROR(e, d)
-
-      IF (e .NE. GD_EOK) THEN
-        ne = ne + 1
-        WRITE(*, 2006) 48, 2, e
-      ENDIF
-
-      IF (l .NE. flen) THEN
-        ne = ne + 1
-        WRITE(*, 2007) 48, 1, l
-      ENDIF
-
-      IF (i .NE. 3) THEN
-        ne = ne + 1
-        WRITE(*, 2007) 48, 2, i
-      ENDIF
-
-      IF (n .NE. 0) THEN
-        ne = ne + 1
-        WRITE(*, 2007) 48, 3, n
-      ENDIF
-
-      IF (fn .NE. 'in1') THEN
-        ne = ne + 1
-        WRITE(*, 2008) 48, 4, fn
-      ENDIF
+      CALL CHKOK2(ne, 48, 2, d)
+      CALL CHKIN2(ne, 48, 1, l, flen)
+      CALL CHKIN2(ne, 48, 2, i, 3)
+      CALL CHKIN2(ne, 48, 3, n, 0)
+      CALL CHKST2(ne, 48, 4, fn, 'in1')
 
       q(1) = 3d3
       q(2) = 4d4
@@ -1592,10 +869,7 @@ C     48: GDMDPN check
       q(5) = 5.5d0
       q(6) = 5.5d0
       DO 480 i=1,4
-      IF (abs(p(i) - q(i)) .gt. 0.001) THEN
-        ne = ne + 1
-        WRITE(*, 2010) i, 48, p(i)
-      ENDIF
+      CALL CHKDB2(ne, 48, i, p(i), q(i))
   480 CONTINUE
 
 C     49: GDMDCP check
@@ -1605,468 +879,160 @@ C     49: GDMDCP check
       cq(4) = cmplx(3.3, 4.4)
       CALL GDMDCP(d, 'data', 4, 'mnew5', 5, 3, 'in1', 3, cq(1), cq(2),
      +cq(3), cq(4), cq(5), cq(6))
-      CALL GDEROR(e, d)
-
-      IF (e .NE. GD_EOK) THEN
-        ne = ne + 1
-        WRITE(*, 2006) 49, 1, e
-      ENDIF
+      CALL CHKOK2(ne, 49, 1, d)
 
       l = flen
       CALL GDGECP(i, fn, l, cp(1), cp(2), cp(3), cp(4), cp(5), cp(6),
      +n, d, 'data/mnew5', 10)
-      CALL GDEROR(e, d)
-
-      IF (e .NE. GD_EOK) THEN
-        ne = ne + 1
-        WRITE(*, 2006) 49, 2, e
-      ENDIF
-
-      IF (l .NE. flen) THEN
-        ne = ne + 1
-        WRITE(*, 2007) 49, 1, l
-      ENDIF
-
-      IF (i .NE. 3) THEN
-        ne = ne + 1
-        WRITE(*, 2007) 49, 2, i
-      ENDIF
-
-      IF (n .NE. 0) THEN
-        ne = ne + 1
-        WRITE(*, 2007) 49, 3, n
-      ENDIF
-
-      IF (fn .NE. 'in1') THEN
-        ne = ne + 1
-        WRITE(*, 2008) 49, 4, fn
-      ENDIF
+      CALL CHKOK2(ne, 49, 2, d)
+      CALL CHKIN2(ne, 49, 1, l, flen)
+      CALL CHKIN2(ne, 49, 2, i, 3)
+      CALL CHKIN2(ne, 49, 3, n, 0)
+      CALL CHKST2(ne, 49, 4, fn, 'in1')
 
       cq(1) = cmplx(1.1, 0.0)
       cq(2) = cmplx(2.2, 0.0)
       cq(3) = cmplx(2.2, 0.0)
       cq(4) = cmplx(3.3, 4.4)
       DO 490 i=1,4
-      IF (abs(cp(i) - cq(i)) .gt. 0.001) THEN
-        ne = ne + 1
-        WRITE(*, 2011) i, 49, REAL(REAL(cp(i))), REAL(AIMAG(cp(i)))
-      ENDIF
+      CALL CHKCP2(ne, 49, i, cp(i), cq(i))
   490 CONTINUE
 
 C     50: GDMDLT check
       CALL GDMDLT(d, "data", 4, "mnew6", 5, "in", 2, "./more/table", 12)
-      CALL GDEROR(e, d)
-
-      IF (e .NE. GD_EOK) THEN
-        ne = ne + 1
-        WRITE(*, 2006) 50, 1, e
-      ENDIF
+      CALL CHKOK2(ne, 50, 1, d)
 
       l = flen
-      CALL GDGELT(fn, l, str, 20, n, d, 'data/mnew6', 10)
-      CALL GDEROR(e, d)
-
-      IF (e .NE. GD_EOK) THEN
-        ne = ne + 1
-        WRITE(*, 2006) 50, 2, e
-      ENDIF
-
-      IF (l .NE. flen) THEN
-        ne = ne + 1
-        WRITE(*, 2007) 50, 1, l
-      ENDIF
-
-      IF (n .NE. 0) THEN
-        ne = ne + 1
-        WRITE(*, 2007) 50, 2, n
-      ENDIF
-
-      IF (fn .NE. 'in') THEN
-        ne = ne + 1
-        WRITE(*, 2008) 50, 3, fn
-      ENDIF
-
-      IF (str .NE. './more/table') THEN
-        ne = ne + 1
-        WRITE(*, 2008) 50, 4, str
-      ENDIF
+      CALL GDGELT(fn, l, str, slen, n, d, 'data/mnew6', 10)
+      CALL CHKOK2(ne, 50, 2, d)
+      CALL CHKIN2(ne, 50, 1, l, flen)
+      CALL CHKIN2(ne, 50, 2, n, 0)
+      CALL CHKST2(ne, 50, 3, fn, 'in')
+      CALL CHKST2(ne, 50, 4, str, './more/table')
 
 C     51: GDMDBT check
       CALL GDMDBT(d, "data", 4, "mnew7", 5, "in", 2, 13, 12)
-      CALL GDEROR(e, d)
-
-      IF (e .NE. GD_EOK) THEN
-        ne = ne + 1
-        WRITE(*, 2006) 51, 1, e
-      ENDIF
+      CALL CHKOK2(ne, 51, 1, d)
 
       l = flen
       CALL GDGEBT(fn, l, m, i, n, d, 'data/mnew7', 10)
-      CALL GDEROR(e, d)
-
-      IF (e .NE. GD_EOK) THEN
-        ne = ne + 1
-        WRITE(*, 2006) 51, 2, e
-      ENDIF
-
-      IF (l .NE. flen) THEN
-        ne = ne + 1
-        WRITE(*, 2007) 51, 1, l
-      ENDIF
-
-      IF (n .NE. 0) THEN
-        ne = ne + 1
-        WRITE(*, 2007) 51, 2, n
-      ENDIF
-
-      IF (i .NE. 12) THEN
-        ne = ne + 1
-        WRITE(*, 2007) 51, 3, i
-      ENDIF
-
-      IF (m .NE. 13) THEN
-        ne = ne + 1
-        WRITE(*, 2007) 51, 4, m
-      ENDIF
-
-      IF (fn .NE. 'in') THEN
-        ne = ne + 1
-        WRITE(*, 2008) 51, 5, fn
-      ENDIF
+      CALL CHKOK2(ne, 51, 2, d)
+      CALL CHKIN2(ne, 51, 1, l, flen)
+      CALL CHKIN2(ne, 51, 2, n, 0)
+      CALL CHKIN2(ne, 51, 3, i, 12)
+      CALL CHKIN2(ne, 51, 4, m, 13)
+      CALL CHKST2(ne, 51, 5, fn, 'in')
 
 C     52: GDMDSB check
       CALL GDMDSB(d, "data", 4, "mnew8", 5, "in", 2, 13, 12)
-      CALL GDEROR(e, d)
-
-      IF (e .NE. GD_EOK) THEN
-        ne = ne + 1
-        WRITE(*, 2006) 52, 1, e
-      ENDIF
+      CALL CHKOK2(ne, 52, 1, d)
 
       l = flen
       CALL GDGESB(fn, l, m, i, n, d, 'data/mnew8', 10)
-      CALL GDEROR(e, d)
-
-      IF (e .NE. GD_EOK) THEN
-        ne = ne + 1
-        WRITE(*, 2006) 52, 2, e
-      ENDIF
-
-      IF (l .NE. flen) THEN
-        ne = ne + 1
-        WRITE(*, 2007) 52, 1, l
-      ENDIF
-
-      IF (n .NE. 0) THEN
-        ne = ne + 1
-        WRITE(*, 2007) 52, 2, n
-      ENDIF
-
-      IF (i .NE. 12) THEN
-        ne = ne + 1
-        WRITE(*, 2007) 52, 3, i
-      ENDIF
-
-      IF (m .NE. 13) THEN
-        ne = ne + 1
-        WRITE(*, 2007) 52, 4, m
-      ENDIF
-
-      IF (fn .NE. 'in') THEN
-        ne = ne + 1
-        WRITE(*, 2008) 52, 5, fn
-      ENDIF
+      CALL CHKOK2(ne, 52, 2, d)
+      CALL CHKIN2(ne, 52, 1, l, flen)
+      CALL CHKIN2(ne, 52, 2, n, 0)
+      CALL CHKIN2(ne, 52, 3, i, 12)
+      CALL CHKIN2(ne, 52, 4, m, 13)
+      CALL CHKST2(ne, 52, 5, fn, 'in')
 
 C     53: GDMDMT check
       CALL GDMDMT(d, 'data', 4, 'mnew9', 5, 'in1', 3, 'in2', 3)
-      CALL GDEROR(e, d)
-
-      IF (e .NE. GD_EOK) THEN
-        ne = ne + 1
-        WRITE(*, 2006) 53, 1, e
-      ENDIF
+      CALL CHKOK2(ne, 53, 1, d)
 
       l = flen
       CALL GDGEMT(fields(1), l, fields(2), l, n, d, 'data/mnew9', 10)
-      CALL GDEROR(e, d)
-
-      IF (e .NE. GD_EOK) THEN
-        ne = ne + 1
-        WRITE(*, 2006) 53, 2, e
-      ENDIF
-
-      IF (l .NE. flen) THEN
-        ne = ne + 1
-        WRITE(*, 2007) 53, 1, l
-      ENDIF
-
-      IF (n .NE. 0) THEN
-        ne = ne + 1
-        WRITE(*, 2007) 53, 2, n
-      ENDIF
-
-      IF (fields(1) .NE. 'in1') THEN
-        ne = ne + 1
-        WRITE(*, 2008) 53, 3, fields(1)
-      ENDIF
-
-      IF (fields(2) .NE. 'in2') THEN
-        ne = ne + 1
-        WRITE(*, 2008) 53, 4, fields(2)
-      ENDIF
+      CALL CHKOK2(ne, 53, 2, d)
+      CALL CHKIN2(ne, 53, 1, l, flen)
+      CALL CHKIN2(ne, 53, 2, n, 0)
+      CALL CHKST2(ne, 53, 3, fields(1), 'in1')
+      CALL CHKST2(ne, 53, 4, fields(2), 'in2')
 
 C     54: GDMDPH check
       CALL GDMDPH(d, 'data', 4, 'mnew10', 6, 'in1', 3, 22)
-      CALL GDEROR(e, d)
-
-      IF (e .NE. GD_EOK) THEN
-        ne = ne + 1
-        WRITE(*, 2006) 54, 1, e
-      ENDIF
+      CALL CHKOK2(ne, 54, 1, d)
 
       l = flen
       CALL GDGEPH(fn, l, i, n, d, 'data/mnew10', 11)
-      CALL GDEROR(e, d)
-
-      IF (e .NE. GD_EOK) THEN
-        ne = ne + 1
-        WRITE(*, 2006) 54, 2, e
-      ENDIF
-
-      IF (l .NE. flen) THEN
-        ne = ne + 1
-        WRITE(*, 2007) 54, 1, l
-      ENDIF
-
-      IF (n .NE. 0) THEN
-        ne = ne + 1
-        WRITE(*, 2007) 54, 2, n
-      ENDIF
-
-      IF (i .NE. 22) THEN
-        ne = ne + 1
-        WRITE(*, 2007) 54, 3, i
-      ENDIF
-
-      IF (fn .NE. 'in1') THEN
-        ne = ne + 1
-        WRITE(*, 2008) 54, 4, fn
-      ENDIF
+      CALL CHKOK2(ne, 54, 2, d)
+      CALL CHKIN2(ne, 54, 1, l, flen)
+      CALL CHKIN2(ne, 54, 2, n, 0)
+      CALL CHKIN2(ne, 54, 3, i, 22)
+      CALL CHKST2(ne, 54, 4, fn, 'in1')
 
 C     55: GDMDCO check
       CALL GDMDCO(d, 'data', 4, 'mnew11', 6, GD_F64, GD_F32, -8.1)
-      CALL GDEROR(e, d)
-
-      IF (e .NE. GD_EOK) THEN
-        ne = ne + 1
-        WRITE(*, 2006) 55, 1, e
-      ENDIF
+      CALL CHKOK2(ne, 55, 1, d)
 
       CALL GDGECO(i, n, d, 'data/mnew11', 11)
-      CALL GDEROR(e, d)
-
-      IF (e .NE. GD_EOK) THEN
-        ne = ne + 1
-        WRITE(*, 2006) 55, 2, e
-      ENDIF
-
-      IF (l .NE. flen) THEN
-        ne = ne + 1
-        WRITE(*, 2007) 55, 1, l
-      ENDIF
-
-      IF (n .NE. 0) THEN
-        ne = ne + 1
-        WRITE(*, 2007) 55, 2, n
-      ENDIF
-
-      IF (i .NE. GD_F64) THEN
-        ne = ne + 1
-        WRITE(*, 2007) 55, 3, i
-      ENDIF
+      CALL CHKOK2(ne, 55, 2, d)
+      CALL CHKIN2(ne, 55, 1, l, flen)
+      CALL CHKIN2(ne, 55, 2, n, 0)
+      CALL CHKIN2(ne, 55, 3, i, GD_F64)
 
       CALL GDGTCO(d, 'data/mnew11', 11, GD_F32, fl)
-      CALL GDEROR(e, d)
-
-      IF (e .NE. GD_EOK) THEN
-        ne = ne + 1
-        WRITE(*, 2006) 55, 3, e
-      ENDIF
-
-      IF (abs(fl + 8.1) .gt. 0.001) THEN
-        ne = ne + 1
-        WRITE(*, 2005) 55, fl
-      ENDIF
+      CALL CHKOK2(ne, 55, 3, d)
+      CALL CHKDBL(ne, 55, 1d0 * fl, -8.1d0)
 
 C     56: GDGTST check
-      CALL GDGTST(n, d, 'string', 6, 20, str)
-      CALL GDEROR(e, d)
-
-      IF (e .NE. GD_EOK) THEN
-        ne = ne + 1
-        WRITE(*, 2001) 56, e
-      ENDIF
-
-      IF (n .NE. 17) THEN
-        ne = ne + 1
-        WRITE(*, 2002) 56, n
-      ENDIF
-
-      IF (str .NE. "Zaphod Beeblebrox") THEN
-        ne = ne + 1
-        WRITE(*, 2009) 56, str
-      ENDIF
+      CALL GDGTST(n, d, 'string', 6, slen, str)
+      CALL CHKEOK(ne, 56, d)
+      CALL CHKINT(ne, 56, n, 17)
+      CALL CHKSTR(ne, 56, str, "Zaphod Beeblebrox")
 
 C     57: GDADST check
       CALL GDADST(d, 'new12', 5, "---string---", 12, 0)
-      CALL GDEROR(e, d)
-
-      IF (e .NE. GD_EOK) THEN
-        ne = ne + 1
-        WRITE(*, 2006) 57, 1, e
-      ENDIF
-
-      CALL GDGTST(n, d, 'new12', 5, 20, str)
-      CALL GDEROR(e, d)
+      CALL CHKOK2(ne, 57, 1, d)
 
-      IF (e .NE. GD_EOK) THEN
-        ne = ne + 1
-        WRITE(*, 2006) 57, 2, e
-      ENDIF
-
-      IF (str .NE. "---string---") THEN
-        ne = ne + 1
-        WRITE(*, 2009) 57, str
-      ENDIF
+      CALL GDGTST(n, d, 'new12', 5, slen, str)
+      CALL CHKOK2(ne, 57, 2, d)
+      CALL CHKSTR(ne, 57, str, "---string---")
 
 C     58: GDMDST check
       CALL GDMDST(d, "data", 4, 'mnew12', 6, "kai su, technon;", 16)
-      CALL GDEROR(e, d)
-
-      IF (e .NE. GD_EOK) THEN
-        ne = ne + 1
-        WRITE(*, 2006) 58, 1, e
-      ENDIF
-
-      CALL GDGTST(n, d, 'data/mnew12', 11, 20, str)
-      CALL GDEROR(e, d)
-
-      IF (e .NE. GD_EOK) THEN
-        ne = ne + 1
-        WRITE(*, 2006) 58, 2, e
-      ENDIF
+      CALL CHKOK2(ne, 58, 1, d)
 
-      IF (str .NE. "kai su, technon;") THEN
-        ne = ne + 1
-        WRITE(*, 2009) 58, str
-      ENDIF
+      CALL GDGTST(n, d, 'data/mnew12', 11, slen, str)
+      CALL CHKOK2(ne, 58, 2, d)
+      CALL CHKSTR(ne, 58, str, "kai su, technon;")
 
 C     59: GDADSP check
       CALL GDADSP(d, 'lorem STRING "Lorem ipsum"', 26, 0)
-      CALL GDEROR(e, d)
-
-      IF (e .NE. GD_EOK) THEN
-        ne = ne + 1
-        WRITE(*, 2006) 59, 1, e
-      ENDIF
-
-      CALL GDGTST(n, d, 'lorem', 5, 20, str)
-      CALL GDEROR(e, d)
+      CALL CHKOK2(ne, 59, 1, d)
 
-      IF (e .NE. GD_EOK) THEN
-        ne = ne + 1
-        WRITE(*, 2006) 59, 2, e
-      ENDIF
-
-      IF (str .NE. "Lorem ipsum") THEN
-        ne = ne + 1
-        WRITE(*, 2009) 59, str
-      ENDIF
+      CALL GDGTST(n, d, 'lorem', 5, slen, str)
+      CALL CHKOK2(ne, 59, 2, d)
+      CALL CHKSTR(ne, 59, str, "Lorem ipsum")
 
 C     60: GDMDSP check
       CALL GDMDSP(d, 'ipsum STRING "dolor sit amet."', 30, 'lorem', 5)
-      CALL GDEROR(e, d)
-
-      IF (e .NE. GD_EOK) THEN
-        ne = ne + 1
-        WRITE(*, 2006) 60, 1, e
-      ENDIF
-
-      CALL GDGTST(n, d, 'lorem/ipsum', 11, 20, str)
-      CALL GDEROR(e, d)
-
-      IF (e .NE. GD_EOK) THEN
-        ne = ne + 1
-        WRITE(*, 2006) 60, 2, e
-      ENDIF
+      CALL CHKOK2(ne, 60, 1, d)
 
-      IF (str .NE. "dolor sit amet.") THEN
-        ne = ne + 1
-        WRITE(*, 2009) 60, str
-      ENDIF
+      CALL GDGTST(n, d, 'lorem/ipsum', 11, slen, str)
+      CALL CHKOK2(ne, 60, 2, d)
+      CALL CHKSTR(ne, 60, str, "dolor sit amet.")
 
 C     61: GDPTCO check
       CALL GDPTCO(d, 'const', 5, GD_I32, 10)
-      CALL GDEROR(e, d)
-
-      IF (e .NE. GD_EOK) THEN
-        ne = ne + 1
-        WRITE(*, 2006) 61, 1, e
-      ENDIF
+      CALL CHKOK2(ne, 61, 1, d)
 
       CALL GDGTCO(d, 'const', 5, GD_F32, fl)
-      CALL GDEROR(e, d)
-
-      IF (e .NE. GD_EOK) THEN
-        ne = ne + 1
-        WRITE(*, 2006) 61, 2, e
-      ENDIF
-
-      IF (abs(fl - 10) .gt. 0.001) THEN
-        ne = ne + 1
-        WRITE(*, 2005) 61, fl
-      ENDIF
+      CALL CHKOK2(ne, 61, 2, d)
+      CALL CHKDBL(ne, 61, 1d0 * fl, 10.0d0)
 
 C     62: GDPTST check
       CALL GDPTST(n, d, 'string', 6, 11, "Arthur Dent")
-      CALL GDEROR(e, d)
-
-      IF (e .NE. GD_EOK) THEN
-        ne = ne + 1
-        WRITE(*, 2006) 62, 1, e
-      ENDIF
-
-      IF (n .NE. 11) THEN
-        ne = ne + 1
-        WRITE(*, 2002) 62, n
-      ENDIF
-
-      CALL GDGTST(n, d, 'string', 6, 20, str)
-      CALL GDEROR(e, d)
+      CALL CHKOK2(ne, 62, 1, d)
+      CALL CHKINT(ne, 62, n, 11)
 
-      IF (e .NE. GD_EOK) THEN
-        ne = ne + 1
-        WRITE(*, 2006) 62, 2, e
-      ENDIF
-
-      IF (str .NE. "Arthur Dent") THEN
-        ne = ne + 1
-        WRITE(*, 2009) 62, str
-      ENDIF
+      CALL GDGTST(n, d, 'string', 6, slen, str)
+      CALL CHKOK2(ne, 62, 2, d)
+      CALL CHKSTR(ne, 62, str, "Arthur Dent")
 
 C     63: GDNMFT check
       CALL GDNMFT(n, d, "data", 4, GD_LCE)
-      CALL GDEROR(e, d)
-
-      IF (e .NE. GD_EOK) THEN
-        ne = ne + 1
-        WRITE(*, 2001) 63, e
-      ENDIF
-
-      IF (n .NE. 2) THEN
-        ne = ne + 1
-        WRITE(*, 2002), 63, n
-      ENDIF
+      CALL CHKEOK(ne, 63, d)
+      CALL CHKINT(ne, 63, n, 2)
 
 C     64: GDMFDT check
       fields(1) = 'mnew1'
@@ -2074,37 +1040,15 @@ C     64: GDMFDT check
       DO 640 i = 1, n
       l = flen
       CALL GDMFDT(fn, l, d, "data", 4, GD_LCE, i)
-      CALL GDEROR(e, d)
-
-      IF (e .NE. GD_EOK) THEN
-        ne = ne + 1
-        WRITE(*, 2006) 64, i, e
-      ENDIF
-
-      IF (l .NE. flen) THEN
-        ne = ne + 1
-        WRITE(*, 2007) 64, i, l
-      ENDIF
-
-      IF (fn .NE. fields(i)) THEN
-        ne = ne + 1
-        WRITE(*, 2008) i, 64, fn
-      ENDIF
+      CALL CHKOK2(ne, 64, i, d)
+      CALL CHKIN2(ne, 64, i, l, flen)
+      CALL CHKST2(ne, 64, i, fn, fields(i))
   640 CONTINUE
 
 C     65: GDNMVE check
       CALL GDNMVE(n, d, "data", 4)
-      CALL GDEROR(e, d)
-
-      IF (e .NE. GD_EOK) THEN
-        ne = ne + 1
-        WRITE(*, 2001) 65, e
-      ENDIF
-
-      IF (n .NE. 10) THEN
-        ne = ne + 1
-        WRITE(*, 2002), 65, n
-      ENDIF
+      CALL CHKEOK(ne, 65, d)
+      CALL CHKINT(ne, 65, n, 10)
 
 C     66: GDMVEN check
       fields(1) = 'mlut  '
@@ -2120,105 +1064,36 @@ C     66: GDMVEN check
       DO 660 i = 1, n
       l = flen
       CALL GDMVEN(fn, l, d, "data", 4, i)
-      CALL GDEROR(e, d)
-
-      IF (e .NE. GD_EOK) THEN
-        ne = ne + 1
-        WRITE(*, 2006) 66, i, e
-      ENDIF
-
-      IF (l .NE. flen) THEN
-        ne = ne + 1
-        WRITE(*, 2007) 66, i, l
-      ENDIF
-
-      IF (fn .NE. fields(i)) THEN
-        ne = ne + 1
-        WRITE(*, 2008) i, 66, fn
-      ENDIF
+      CALL CHKOK2(ne, 66, i, d)
+      CALL CHKIN2(ne, 66, i, l, flen)
+      CALL CHKST2(ne, 66, i, fn, fields(i))
   660 CONTINUE
 
 C     67: GDALRW check
       CALL GDALRW(d, 'new1', 4, GD_I32, 4, 0)
-      CALL GDEROR(e, d)
-
-      IF (e .NE. GD_EOK) THEN
-        ne = ne + 1
-        WRITE(*, 2006) 67, 1, e
-      ENDIF
+      CALL CHKOK2(ne, 67, 1, d)
 
       CALL GDGERW(l, i, n, d, 'new1', 4)
-      CALL GDEROR(e, d)
-
-      IF (e .NE. GD_EOK) THEN
-        ne = ne + 1
-        WRITE(*, 2006) 67, 2, e
-      ENDIF
-
-      IF (n .NE. 0) THEN
-        ne = ne + 1
-        WRITE(*, 2007) 67, 3, n
-      ENDIF
-
-      IF (l .NE. 4) THEN
-        ne = ne + 1
-        WRITE(*, 2007) 67, 4, l
-      ENDIF
-
-      IF (i .NE. GD_I32) THEN
-        ne = ne + 1
-        WRITE(*, 2007) 67, 5, i
-      ENDIF
+      CALL CHKOK2(ne, 67, 2, d)
+      CALL CHKIN2(ne, 67, 3, n, 0)
+      CALL CHKIN2(ne, 67, 4, l, 4)
+      CALL CHKIN2(ne, 67, 5, i, GD_I32)
 
 C     68: GDALLC check
       CALL GDALLC(d, 'new2', 4, 3, 'in4', 3, 9.9d-1, 7.8d0, 'in5', 3,
      +1.1d1, 2.2d-2, 'in6', 3, 1.96d0, 0d0)
-      CALL GDEROR(e, d)
-
-      IF (e .NE. GD_EOK) THEN
-        ne = ne + 1
-        WRITE(*, 2006) 68, 1, e
-      ENDIF
+      CALL CHKOK2(ne, 68, 1, d)
 
       l = flen
       CALL GDGELC(i, fields(1), l, p(1), p(2), fields(2), l, p(3),
      +p(4), fields(3), l, p(5), p(6), n, d, 'new2', 4)
-      CALL GDEROR(e, d)
-
-      IF (e .NE. GD_EOK) THEN
-        ne = ne + 1
-        WRITE(*, 2006) 68, 2, e
-      ENDIF
-
-      IF (l .NE. flen) THEN
-        ne = ne + 1
-        WRITE(*, 2007) 68, 3, l
-      ENDIF
-
-      IF (i .NE. 3) THEN
-        ne = ne + 1
-        WRITE(*, 2007) 68, 4, i
-      ENDIF
-
-      IF (n .NE. 0) THEN
-        ne = ne + 1
-        WRITE(*, 2007) 68, 5, n
-      ENDIF
-
-      IF (fields(1) .NE. 'in4') THEN
-        ne = ne + 1
-        WRITE(*, 2008) 68, 6, fields(1)
-      ENDIF
-
-      IF (fields(2) .NE. 'in5') THEN
-        ne = ne + 1
-        WRITE(*, 2008) 68, 7, fields(2)
-      ENDIF
-
-      IF (fields(3) .NE. 'in6') THEN
-        ne = ne + 1
-        WRITE(*, 2008) 68, 8, fields(3)
-      ENDIF
+      CALL CHKOK2(ne, 68, 2, d)
+      CALL CHKIN2(ne, 68, 3, l, flen)
+      CALL CHKIN2(ne, 68, 4, i, 3)
+      CALL CHKIN2(ne, 68, 5, n, 0)
+      CALL CHKST2(ne, 68, 6, fields(1), 'in4')
+      CALL CHKST2(ne, 68, 7, fields(2), 'in5')
+      CALL CHKST2(ne, 68, 8, fields(3), 'in6')
 
       q(1) = 9.9d-1
       q(2) = 7.8d0
@@ -2227,10 +1102,7 @@ C     68: GDALLC check
       q(5) = 1.96d0
       q(6) = 0d0
       DO 680 i=1,6
-      IF (abs(p(i) - q(i)) .gt. 0.001) THEN
-        ne = ne + 1
-        WRITE(*, 2010) i, 68, p(i)
-      ENDIF
+      CALL CHKDB2(ne, 68, i, p(i), q(i))
   680 CONTINUE
 
 C     69: GDALCL check
@@ -2240,104 +1112,42 @@ C     69: GDALCL check
       cq(4) = cmplx(0.6, 0.7)
       CALL GDALCL(d, 'new3', 4, 2, 'in4', 3, cq(1), cq(2), 'in3', 3,
      +cq(3), cq(4), '', 0, cq(5), cq(6))
-      CALL GDEROR(e, d)
-
-      IF (e .NE. GD_EOK) THEN
-        ne = ne + 1
-        WRITE(*, 2006) 69, 1, e
-      ENDIF
+      CALL CHKOK2(ne, 69, 1, d)
 
       l = flen
       CALL GDGECL(i, fields(1), l, cp(1), cp(2), fields(2), l, cp(3),
      +cp(4), fields(3), l, cp(5), cp(6), n, d, 'new3', 4)
-      CALL GDEROR(e, d)
-
-      IF (e .NE. GD_EOK) THEN
-        ne = ne + 1
-        WRITE(*, 2001) 69, e
-      ENDIF
-
-      IF (l .NE. flen) THEN
-        ne = ne + 1
-        WRITE(*, 2007) 69, 1, l
-      ENDIF
-
-      IF (i .NE. 2) THEN
-        ne = ne + 1
-        WRITE(*, 2007) 69, 2, i
-      ENDIF
-
-      IF (n .NE. 0) THEN
-        ne = ne + 1
-        WRITE(*, 2007) 69, 3, n
-      ENDIF
-
-      IF (fields(1) .NE. 'in4') THEN
-        ne = ne + 1
-        WRITE(*, 2008) 69, 4, fields(1)
-      ENDIF
-
-      IF (fields(2) .NE. 'in3') THEN
-        ne = ne + 1
-        WRITE(*, 2008) 69, 5, fields(2)
-      ENDIF
+      CALL CHKOK2(ne, 69, 2, d)
+      CALL CHKIN2(ne, 69, 1, l, flen)
+      CALL CHKIN2(ne, 69, 2, i, 2)
+      CALL CHKIN2(ne, 69, 3, n, 0)
+      CALL CHKST2(ne, 69, 4, fields(1), 'in4')
+      CALL CHKST2(ne, 69, 5, fields(2), 'in3')
 
       cq(1) = cmplx(0.1, 0.2)
       cq(2) = cmplx(0.3, 0.4)
       cq(3) = cmplx(0.4, 0.5)
       cq(4) = cmplx(0.6, 0.7)
       DO 690 i=1,4
-      IF (abs(cp(i) - cq(i)) .gt. 0.001) THEN
-        ne = ne + 1
-        WRITE(*, 2011) i, 69, REAL(REAL(cp(i))), REAL(AIMAG(cp(i)))
-      ENDIF
+      CALL CHKCP2(ne, 69, i, cp(i), cq(i))
   690 CONTINUE
 
 C     70: GDALPN check
       CALL GDALPN(d, 'new4', 4, 4, 'in1', 3, 3d0, 4d0, 5d0, 6d0, 7d0,
      +0d0)
-      CALL GDEROR(e, d)
-
-      IF (e .NE. GD_EOK) THEN
-        ne = ne + 1
-        WRITE(*, 2006) 70, 1, e
-      ENDIF
+      CALL CHKOK2(ne, 70, 1, d)
 
       l = flen
       CALL GDGEPN(i, fn, l, p(1), p(2), p(3), p(4), p(5), p(6),
      +n, d, 'new4', 4)
-      CALL GDEROR(e, d)
-
-      IF (e .NE. GD_EOK) THEN
-        ne = ne + 1
-        WRITE(*, 2006) 70, 2, e
-      ENDIF
-
-      IF (l .NE. flen) THEN
-        ne = ne + 1
-        WRITE(*, 2007) 70, 1, l
-      ENDIF
-
-      IF (i .NE. 4) THEN
-        ne = ne + 1
-        WRITE(*, 2007) 70, 2, i
-      ENDIF
-
-      IF (n .NE. 0) THEN
-        ne = ne + 1
-        WRITE(*, 2007) 70, 3, n
-      ENDIF
-
-      IF (fn .NE. 'in1') THEN
-        ne = ne + 1
-        WRITE(*, 2008) 70, 4, fn
-      ENDIF
+      CALL CHKOK2(ne, 70, 2, d)
+      CALL CHKIN2(ne, 70, 1, l, flen)
+      CALL CHKIN2(ne, 70, 2, i, 4)
+      CALL CHKIN2(ne, 70, 3, n, 0)
+      CALL CHKST2(ne, 70, 4, fn, 'in1')
 
       DO 700 i=1,5
-      IF (abs(p(i) - 2d0 - i) .gt. 0.001) THEN
-        ne = ne + 1
-        WRITE(*, 2010) i, 70, p(i)
-      ENDIF
+      CALL CHKDB2(ne, 70, i, p(i), 2d0 + i)
   700 CONTINUE
 
 C     71: GDALCP check
@@ -2347,1367 +1157,473 @@ C     71: GDALCP check
       cq(4) = cmplx(1.3, 2.4)
       CALL GDALCP(d, 'new5', 4, 3, 'in1', 3, cq(1), cq(2), cq(3), cq(4),
      +cq(5), cq(6))
-      CALL GDEROR(e, d)
-
-      IF (e .NE. GD_EOK) THEN
-        ne = ne + 1
-        WRITE(*, 2006) 71, 1, e
-      ENDIF
+      CALL CHKOK2(ne, 71, 1, d)
 
       l = flen
       CALL GDGECP(i, fn, l, cp(1), cp(2), cp(3), cp(4), cp(5), cp(6),
      +n, d, 'new5', 4)
-      CALL GDEROR(e, d)
-
-      IF (e .NE. GD_EOK) THEN
-        ne = ne + 1
-        WRITE(*, 2006) 71, 2, e
-      ENDIF
-
-      IF (l .NE. flen) THEN
-        ne = ne + 1
-        WRITE(*, 2007) 71, 1, l
-      ENDIF
-
-      IF (i .NE. 3) THEN
-        ne = ne + 1
-        WRITE(*, 2007) 71, 2, i
-      ENDIF
-
-      IF (n .NE. 0) THEN
-        ne = ne + 1
-        WRITE(*, 2007) 71, 3, n
-      ENDIF
-
-      IF (fn .NE. 'in1') THEN
-        ne = ne + 1
-        WRITE(*, 2008) 71, 4, fn
-      ENDIF
+      CALL CHKOK2(ne, 71, 2, d)
+      CALL CHKIN2(ne, 71, 1, l, flen)
+      CALL CHKIN2(ne, 71, 2, i, 3)
+      CALL CHKIN2(ne, 71, 3, n, 0)
+      CALL CHKST2(ne, 71, 4, fn, 'in1')
 
       cq(1) = cmplx(1.1, 5.0)
       cq(2) = cmplx(1.2, 4.0)
       cq(3) = cmplx(1.2, 3.0)
       cq(4) = cmplx(1.3, 2.4)
       DO 710 i=1,4
-      IF (abs(cp(i) - cq(i)) .gt. 0.001) THEN
-        ne = ne + 1
-        WRITE(*, 2011) i, 71, REAL(REAL(cp(i))), REAL(AIMAG(cp(i)))
-      ENDIF
+      CALL CHKCP2(ne, 71, i, cp(i), cq(i))
   710 CONTINUE
 
 C     72: GDALLT check
       CALL GDALLT(d, "new6", 4, "in3", 3, "./other/table", 13, 0)
-      CALL GDEROR(e, d)
-
-      IF (e .NE. GD_EOK) THEN
-        ne = ne + 1
-        WRITE(*, 2006) 72, 1, e
-      ENDIF
+      CALL CHKOK2(ne, 72, 1, d)
 
       l = flen
-      CALL GDGELT(fn, l, str, 20, n, d, 'new6', 4)
-      CALL GDEROR(e, d)
-
-      IF (e .NE. GD_EOK) THEN
-        ne = ne + 1
-        WRITE(*, 2006) 72, 2, e
-      ENDIF
-
-      IF (l .NE. flen) THEN
-        ne = ne + 1
-        WRITE(*, 2007) 72, 1, l
-      ENDIF
-
-      IF (n .NE. 0) THEN
-        ne = ne + 1
-        WRITE(*, 2007) 72, 2, n
-      ENDIF
-
-      IF (fn .NE. 'in3') THEN
-        ne = ne + 1
-        WRITE(*, 2008) 72, 3, fn
-      ENDIF
-
-      IF (str .NE. './other/table') THEN
-        ne = ne + 1
-        WRITE(*, 2008) 72, 4, str
-      ENDIF
+      CALL GDGELT(fn, l, str, slen, n, d, 'new6', 4)
+      CALL CHKOK2(ne, 72, 2, d)
+      CALL CHKIN2(ne, 72, 1, l, flen)
+      CALL CHKIN2(ne, 72, 2, n, 0)
+      CALL CHKST2(ne, 72, 3, fn, 'in3')
+      CALL CHKST2(ne, 73, 4, str, './other/table')
 
 C     73: GDALBT check
       CALL GDALBT(d, "new7", 4, "in3", 3, 3, 2)
-      CALL GDEROR(e, d)
-
-      IF (e .NE. GD_EOK) THEN
-        ne = ne + 1
-        WRITE(*, 2006) 73, 1, e
-      ENDIF
+      CALL CHKOK2(ne, 73, 1, d)
 
       l = flen
       CALL GDGEBT(fn, l, m, i, n, d, 'new7', 4)
-      CALL GDEROR(e, d)
-
-      IF (e .NE. GD_EOK) THEN
-        ne = ne + 1
-        WRITE(*, 2006) 73, 2, e
-      ENDIF
-
-      IF (l .NE. flen) THEN
-        ne = ne + 1
-        WRITE(*, 2007) 73, 1, l
-      ENDIF
-
-      IF (n .NE. 0) THEN
-        ne = ne + 1
-        WRITE(*, 2007) 73, 2, n
-      ENDIF
-
-      IF (i .NE. 2) THEN
-        ne = ne + 1
-        WRITE(*, 2007) 73, 3, i
-      ENDIF
-
-      IF (m .NE. 3) THEN
-        ne = ne + 1
-        WRITE(*, 2007) 73, 4, m
-      ENDIF
-
-      IF (fn .NE. 'in3') THEN
-        ne = ne + 1
-        WRITE(*, 2008) 73, 5, fn
-      ENDIF
+      CALL CHKOK2(ne, 73, 2, d)
+      CALL CHKIN2(ne, 73, 1, l, flen)
+      CALL CHKIN2(ne, 73, 2, n, 0)
+      CALL CHKIN2(ne, 73, 3, i, 2)
+      CALL CHKIN2(ne, 73, 4, m, 3)
+      CALL CHKST2(ne, 73, 5, fn, 'in3')
 
 C     74: GDALSB check
       CALL GDALSB(d, "new8", 4, "out", 3, 1, 22)
-      CALL GDEROR(e, d)
-
-      IF (e .NE. GD_EOK) THEN
-        ne = ne + 1
-        WRITE(*, 2006) 74, 1, e
-      ENDIF
+      CALL CHKOK2(ne, 74, 1, d)
 
       l = flen
       CALL GDGESB(fn, l, m, i, n, d, 'new8', 4)
-      CALL GDEROR(e, d)
-
-      IF (e .NE. GD_EOK) THEN
-        ne = ne + 1
-        WRITE(*, 2006) 74, 2, e
-      ENDIF
-
-      IF (l .NE. flen) THEN
-        ne = ne + 1
-        WRITE(*, 2007) 74, 1, l
-      ENDIF
-
-      IF (n .NE. 0) THEN
-        ne = ne + 1
-        WRITE(*, 2007) 74, 2, n
-      ENDIF
-
-      IF (i .NE. 22) THEN
-        ne = ne + 1
-        WRITE(*, 2007) 74, 3, i
-      ENDIF
-
-      IF (m .NE. 1) THEN
-        ne = ne + 1
-        WRITE(*, 2007) 74, 4, m
-      ENDIF
-
-      IF (fn .NE. 'out') THEN
-        ne = ne + 1
-        WRITE(*, 2008) 74, 5, fn
-      ENDIF
+      CALL CHKOK2(ne, 74, 2, d)
+      CALL CHKIN2(ne, 74, 1, l, flen)
+      CALL CHKIN2(ne, 74, 2, n, 0)
+      CALL CHKIN2(ne, 74, 3, i, 22)
+      CALL CHKIN2(ne, 74, 4, m, 1)
+      CALL CHKST2(ne, 74, 5, fn, 'out')
 
 C     75: GDALMT check
       CALL GDALMT(d, 'new9', 4, 'in6', 3, 'in4', 3)
-      CALL GDEROR(e, d)
-
-      IF (e .NE. GD_EOK) THEN
-        ne = ne + 1
-        WRITE(*, 2006) 75, 1, e
-      ENDIF
+      CALL CHKOK2(ne, 75, 1, d)
 
       l = flen
       CALL GDGEMT(fields(1), l, fields(2), l, n, d, 'new9', 4)
-      CALL GDEROR(e, d)
-
-      IF (e .NE. GD_EOK) THEN
-        ne = ne + 1
-        WRITE(*, 2006) 75, 2, e
-      ENDIF
-
-      IF (l .NE. flen) THEN
-        ne = ne + 1
-        WRITE(*, 2007) 75, 1, l
-      ENDIF
-
-      IF (n .NE. 0) THEN
-        ne = ne + 1
-        WRITE(*, 2007) 75, 2, n
-      ENDIF
-
-      IF (fields(1) .NE. 'in6') THEN
-        ne = ne + 1
-        WRITE(*, 2008) 75, 3, fields(1)
-      ENDIF
-
-      IF (fields(2) .NE. 'in4') THEN
-        ne = ne + 1
-        WRITE(*, 2008) 75, 4, fields(2)
-      ENDIF
+      CALL CHKOK2(ne, 75, 2, d)
+      CALL CHKIN2(ne, 75, 1, l, flen)
+      CALL CHKIN2(ne, 75, 2, n, 0)
+      CALL CHKST2(ne, 75, 3, fields(1), 'in6')
+      CALL CHKST2(ne, 75, 4, fields(2), 'in4')
 
 C     76: GDALPH check
       CALL GDALPH(d, 'new10', 5, 'in2', 3, 8)
-      CALL GDEROR(e, d)
-
-      IF (e .NE. GD_EOK) THEN
-        ne = ne + 1
-        WRITE(*, 2006) 76, 1, e
-      ENDIF
+      CALL CHKOK2(ne, 76, 1, d)
 
       l = flen
       CALL GDGEPH(fn, l, i, n, d, 'new10', 5)
-      CALL GDEROR(e, d)
-
-      IF (e .NE. GD_EOK) THEN
-        ne = ne + 1
-        WRITE(*, 2006) 76, 2, e
-      ENDIF
-
-      IF (l .NE. flen) THEN
-        ne = ne + 1
-        WRITE(*, 2007) 76, 1, l
-      ENDIF
-
-      IF (n .NE. 0) THEN
-        ne = ne + 1
-        WRITE(*, 2007) 76, 2, n
-      ENDIF
-
-      IF (i .NE. 8) THEN
-        ne = ne + 1
-        WRITE(*, 2007) 76, 3, i
-      ENDIF
-
-      IF (fn .NE. 'in2') THEN
-        ne = ne + 1
-        WRITE(*, 2008) 76, 4, fn
-      ENDIF
+      CALL CHKOK2(ne, 76, 2, d)
+      CALL CHKIN2(ne, 76, 1, l, flen)
+      CALL CHKIN2(ne, 76, 2, n, 0)
+      CALL CHKIN2(ne, 76, 3, i, 8)
+      CALL CHKST2(ne, 76, 4, fn, 'in2')
 
 C     77: GDALCO check
       CALL GDALCO(d, 'new11', 5, GD_F32)
-      CALL GDEROR(e, d)
-
-      IF (e .NE. GD_EOK) THEN
-        ne = ne + 1
-        WRITE(*, 2006) 77, 1, e
-      ENDIF
+      CALL CHKOK2(ne, 77, 2, d)
 
       CALL GDGECO(i, n, d, 'new11', 5)
-      CALL GDEROR(e, d)
-
-      IF (e .NE. GD_EOK) THEN
-        ne = ne + 1
-        WRITE(*, 2006) 77, 2, e
-      ENDIF
-
-      IF (l .NE. flen) THEN
-        ne = ne + 1
-        WRITE(*, 2007) 77, 1, l
-      ENDIF
-
-      IF (n .NE. 0) THEN
-        ne = ne + 1
-        WRITE(*, 2007) 77, 2, n
-      ENDIF
-
-      IF (i .NE. GD_F32) THEN
-        ne = ne + 1
-        WRITE(*, 2007) 77, 3, i
-      ENDIF
+      CALL CHKOK2(ne, 77, 2, d)
+      CALL CHKIN2(ne, 77, 1, l, flen)
+      CALL CHKIN2(ne, 77, 2, n, 0)
+      CALL CHKIN2(ne, 77, 3, i, GD_F32)
 
       CALL GDGTCO(d, 'new11', 5, GD_F32, fl)
-      CALL GDEROR(e, d)
-
-      IF (e .NE. GD_EOK) THEN
-        ne = ne + 1
-        WRITE(*, 2006) 77, 3, e
-      ENDIF
-
-      IF (abs(fl + 8.1) .gt. 0.001) THEN
-        ne = ne + 1
-        WRITE(*, 2005) 77, fl
-      ENDIF
+      CALL CHKOK2(ne, 77, 3, d)
+      CALL CHKDBL(ne, 77, 1d0 * fl, -8.1d0)
 
 C     78: GDGENC check
       CALL GDGENC(n, d, 0)
-      CALL GDEROR(e, d)
-
-      IF (e .NE. GD_EOK) THEN
-        ne = ne + 1
-        WRITE(*, 2001) 78, e
-      ENDIF
-
-      IF (n .NE. GD_EN) THEN
-        ne = ne + 1
-        WRITE(*, 2002) 78, n
-      ENDIF
+      CALL CHKEOK(ne, 78, d)
+      CALL CHKINT(ne, 78, n, GDE_UN)
 
 C     79: GDGEND check
       CALL GDGEND(n, d, 0)
-      CALL GDEROR(e, d)
-
-      IF (e .NE. GD_EOK) THEN
-        ne = ne + 1
-        WRITE(*, 2001) 79, e
-      ENDIF
-
-      IF (n .NE. (GD_LE + GD_NA)) THEN
-        ne = ne + 1
-        WRITE(*, 2002) 79, n
-      ENDIF
+      CALL CHKEOK(ne, 79, d)
+      CALL CHKINT(ne, 79, n, GD_LE + GD_NA)
 
 C     80: GDNAME check
-      l = 20
-      CALL GDNAME(str, l, d, 0)
-      CALL GDEROR(e, d)
+      l = plen
+      CALL GDNAME(path, l, d, 0)
+      CALL CHKEOK(ne, 80, d)
+      CALL CHKINT(ne, 80, l, plen)
+      CALL CHKEOS(ne, 80, path, 'test_dirfile')
 
-      IF (e .NE. GD_EOK) THEN
-        ne = ne + 1
-        WRITE(*, 2001) 80, e
-      ENDIF
-
-      IF (l .NE. 20) THEN
-        ne = ne + 1
-        WRITE(*, 2002) 80, l
-      ENDIF
-
-      IF (str .NE. 'test_dirfile') THEN
-        ne = ne + 1
-        WRITE(*, 2009) 80, str
-      ENDIF
-
-C     81: GDPFRG check
-      CALL GDPFRG(n, d, 1)
-      CALL GDEROR(e, d)
-
-      IF (e .NE. GD_EOK) THEN
-        ne = ne + 1
-        WRITE(*, 2001) 81, e
-      ENDIF
-
-      IF (n .NE. 0) THEN
-        ne = ne + 1
-        WRITE(*, 2002) 81, n
-      ENDIF
+C     81: GDPFRG check
+      CALL GDPFRG(n, d, 1)
+      CALL CHKEOK(ne, 81, d)
+      CALL CHKINT(ne, 81, n, 0)
 
 C     82: GDAPRT check
       CALL GDAPRT(d, GDPR_D, 1)
-      CALL GDEROR(e, d)
-
-      IF (e .NE. GD_EOK) THEN
-        ne = ne + 1
-        WRITE(*, 2001) 82, e
-      ENDIF
+      CALL CHKEOK(ne, 82, d)
 
 C     83: GDGPRT check
       CALL GDGPRT(n, d, 1)
-      CALL GDEROR(e, d)
-
-      IF (e .NE. GD_EOK) THEN
-        ne = ne + 1
-        WRITE(*, 2001) 83, e
-      ENDIF
-
-      IF (n .NE. GDPR_D) THEN
-        ne = ne + 1
-        WRITE(*, 2002) 83, n
-      ENDIF
+      CALL CHKEOK(ne, 83, d)
+      CALL CHKINT(ne, 83, n, GDPR_D)
 
 C     84: GDRWFN check
-      l = 20
-      CALL GDRWFN(str, l, d, "data", 4)
-      CALL GDEROR(e, d)
-
-      IF (e .NE. GD_EOK) THEN
-        ne = ne + 1
-        WRITE(*, 2001) 84, e
-      ENDIF
-
-      IF (l .NE. 20) THEN
-        ne = ne + 1
-        WRITE(*, 2002) 84, l
-      ENDIF
-
-      IF (str .NE. 'test_dirfile/data') THEN
-        ne = ne + 1
-        WRITE(*, 2009) 84, str
-      ENDIF
+      l = plen
+      CALL GDRWFN(path, l, d, "data", 4)
+      CALL CHKEOK(ne, 84, d)
+      CALL CHKINT(ne, 84, l, plen)
+      CALL CHKEOS(ne, 84, path, 'test_dirfile'//DIRSEP//'data')
 
 C     85: GDREFE check
-      l = 20
+      l = slen
       CALL GDREFE(str, l, d, "new1", 4)
-      CALL GDEROR(e, d)
-
-      IF (e .NE. GD_EOK) THEN
-        ne = ne + 1
-        WRITE(*, 2001) 85, e
-      ENDIF
-
-      IF (l .NE. 20) THEN
-        ne = ne + 1
-        WRITE(*, 2002) 85, l
-      ENDIF
-
-      IF (str .NE. 'new1') THEN
-        ne = ne + 1
-        WRITE(*, 2009) 85, str
-      ENDIF
+      CALL CHKEOK(ne, 85, d)
+      CALL CHKINT(ne, 85, l, slen)
+      CALL CHKSTR(ne, 85, str, 'new1')
 
 C     87: GDAENC check
-      CALL GDAENC(d, GD_ES, 1, 0)
-      CALL GDEROR(e, d)
-
-      IF (e .NE. GD_EOK) THEN
-        ne = ne + 1
-        WRITE(*, 2006) 87, 1, e
-      ENDIF
+      CALL GDAENC(d, GDE_TX, 1, 0)
+      CALL CHKOK2(ne, 87, 1, d)
 
       CALL GDGENC(n, d, 1)
-      CALL GDEROR(e, d)
-
-      IF (e .NE. GD_EOK) THEN
-        ne = ne + 1
-        WRITE(*, 2006) 87, 2, e
-      ENDIF
-
-      IF (n .NE. GD_ES) THEN
-        ne = ne + 1
-        WRITE(*, 2002) 87, n
-      ENDIF
+      CALL CHKOK2(ne, 87, 2, d)
+      CALL CHKINT(ne, 87, n, GDE_TX)
 
 C     88: GDAEND check
       CALL GDAEND(d, GD_BE, 1, 0)
-      CALL GDEROR(e, d)
-
-      IF (e .NE. GD_EOK) THEN
-        ne = ne + 1
-        WRITE(*, 2006) 88, 1, e
-      ENDIF
+      CALL CHKOK2(ne, 88, 1, d)
 
       CALL GDGEND(n, d, 1)
-      CALL GDEROR(e, d)
-
-      IF (e .NE. GD_EOK) THEN
-        ne = ne + 1
-        WRITE(*, 2006) 88, 2, e
-      ENDIF
-
-      IF (n .NE. GD_BE) THEN
-        ne = ne + 1
-        WRITE(*, 2002) 88, n
-      ENDIF
+      CALL CHKOK2(ne, 88, 2, d)
+      CALL CHKINT(ne, 88, n, GD_BE)
 
 C     89: GDALSP check
       CALL GDALSP(d, 'new10 PHASE in1 3', 17, 0)
-      CALL GDEROR(e, d)
-
-      IF (e .NE. GD_EOK) THEN
-        ne = ne + 1
-        WRITE(*, 2006) 89, 1, e
-      ENDIF
+      CALL CHKOK2(ne, 89, 1, d)
 
       l = flen
       CALL GDGEPH(fn, l, i, n, d, 'new10', 5)
-      CALL GDEROR(e, d)
-
-      IF (e .NE. GD_EOK) THEN
-        ne = ne + 1
-        WRITE(*, 2006) 89, 2, e
-      ENDIF
-
-      IF (l .NE. flen) THEN
-        ne = ne + 1
-        WRITE(*, 2007) 89, 1, l
-      ENDIF
-
-      IF (n .NE. 0) THEN
-        ne = ne + 1
-        WRITE(*, 2007) 89, 2, n
-      ENDIF
-
-      IF (i .NE. 3) THEN
-        ne = ne + 1
-        WRITE(*, 2007) 89, 3, i
-      ENDIF
-
-      IF (fn .NE. 'in1') THEN
-        ne = ne + 1
-        WRITE(*, 2008) 89, 4, fn
-      ENDIF
+      CALL CHKOK2(ne, 89, 2, d)
+      CALL CHKIN2(ne, 89, 1, l, flen)
+      CALL CHKIN2(ne, 89, 2, n, 0)
+      CALL CHKIN2(ne, 89, 3, i, 3)
+      CALL CHKST2(ne, 89, 4, fn, 'in1')
 
 C     90: GDDELE check
       CALL GDDELE(d, 'new10', 5, 0)
-      CALL GDEROR(e, d)
-
-      IF (e .NE. GD_EOK) THEN
-        ne = ne + 1
-        WRITE(*, 2006) 90, 1, e
-      ENDIF
+      CALL CHKOK2(ne, 90, 1, d)
 
       l = flen
       CALL GDGEPH(fn, l, i, n, d, 'new10', 5)
-      CALL GDEROR(e, d)
-
-      IF (e .NE. GD_EBC) THEN
-        ne = ne + 1
-        WRITE(*, 2006) 90, 2, e
-      ENDIF
+      CALL CHKER2(ne, 90, 2, d, GD_EBC)
 
 C     91: GDMLSP check
       CALL GDMLSP(d, 'mnew10 PHASE in4 11', 19, 'data', 4, 0)
-      CALL GDEROR(e, d)
-
-      IF (e .NE. GD_EOK) THEN
-        ne = ne + 1
-        WRITE(*, 2006) 91, 1, e
-      ENDIF
+      CALL CHKOK2(ne, 91, 1, d)
 
       l = flen
       CALL GDGEPH(fn, l, i, n, d, 'data/mnew10', 11)
-      CALL GDEROR(e, d)
-
-      IF (e .NE. GD_EOK) THEN
-        ne = ne + 1
-        WRITE(*, 2006) 91, 2, e
-      ENDIF
-
-      IF (l .NE. flen) THEN
-        ne = ne + 1
-        WRITE(*, 2007) 91, 1, l
-      ENDIF
-
-      IF (n .NE. 0) THEN
-        ne = ne + 1
-        WRITE(*, 2007) 91, 2, n
-      ENDIF
-
-      IF (i .NE. 11) THEN
-        ne = ne + 1
-        WRITE(*, 2007) 91, 3, i
-      ENDIF
-
-      IF (fn .NE. 'in4') THEN
-        ne = ne + 1
-        WRITE(*, 2008) 91, 4, fn
-      ENDIF
+      CALL CHKOK2(ne, 91, 2, d)
+      CALL CHKIN2(ne, 91, 1, l, flen)
+      CALL CHKIN2(ne, 91, 2, n, 0)
+      CALL CHKIN2(ne, 91, 3, i, 11)
+      CALL CHKST2(ne, 91, 4, fn, 'in4')
 
 C     92: GDMOVE check
       CALL GDMOVE(d, 'new9', 4, 1, 0)
-      CALL GDEROR(e, d)
-
-      IF (e .NE. GD_EOK) THEN
-        ne = ne + 1
-        WRITE(*, 2006) 92, 1, e
-      ENDIF
+      CALL CHKOK2(ne, 92, 1, d)
 
       l = flen
       CALL GDGEMT(fields(1), l, fields(2), l, n, d, 'new9', 4)
-      CALL GDEROR(e, d)
-
-      IF (e .NE. GD_EOK) THEN
-        ne = ne + 1
-        WRITE(*, 2006) 92, 2, e
-      ENDIF
-
-      IF (l .NE. flen) THEN
-        ne = ne + 1
-        WRITE(*, 2007) 92, 1, l
-      ENDIF
-
-      IF (n .NE. 1) THEN
-        ne = ne + 1
-        WRITE(*, 2007) 92, 2, n
-      ENDIF
-
-      IF (fields(1) .NE. 'in6') THEN
-        ne = ne + 1
-        WRITE(*, 2008) 92, 3, fields(1)
-      ENDIF
-
-      IF (fields(2) .NE. 'in4') THEN
-        ne = ne + 1
-        WRITE(*, 2008) 92, 4, fields(2)
-      ENDIF
+      CALL CHKOK2(ne, 92, 2, d)
+      CALL CHKIN2(ne, 92, 1, l, flen)
+      CALL CHKIN2(ne, 92, 2, n, 1)
+      CALL CHKST2(ne, 92, 3, fields(1), 'in6')
+      CALL CHKST2(ne, 92, 4, fields(2), 'in4')
 
 C     93: GDRENM check
       CALL GDRENM(d, 'new9', 4, 'newer', 5, 0)
-      CALL GDEROR(e, d)
-
-      IF (e .NE. GD_EOK) THEN
-        ne = ne + 1
-        WRITE(*, 2006) 93, 1, e
-      ENDIF
+      CALL CHKOK2(ne, 93, 1, d)
 
       CALL GDGEMT(fields(1), l, fields(2), l, n, d, 'new9', 4)
-      CALL GDEROR(e, d)
-
-      IF (e .NE. GD_EBC) THEN
-        ne = ne + 1
-        WRITE(*, 2006) 93, 2, e
-      ENDIF
+      CALL CHKER2(ne, 93, 2, d, GD_EBC)
 
       l = flen
       CALL GDGEMT(fields(1), l, fields(2), l, n, d, 'newer', 5)
-      CALL GDEROR(e, d)
-
-      IF (e .NE. GD_EOK) THEN
-        ne = ne + 1
-        WRITE(*, 2006) 93, 3, e
-      ENDIF
-
-      IF (l .NE. flen) THEN
-        ne = ne + 1
-        WRITE(*, 2007) 93, 1, l
-      ENDIF
-
-      IF (n .NE. 1) THEN
-        ne = ne + 1
-        WRITE(*, 2007) 93, 2, n
-      ENDIF
-
-      IF (fields(1) .NE. 'in6') THEN
-        ne = ne + 1
-        WRITE(*, 2008) 93, 3, fields(1)
-      ENDIF
-
-      IF (fields(2) .NE. 'in4') THEN
-        ne = ne + 1
-        WRITE(*, 2008) 93, 4, fields(2)
-      ENDIF
+      CALL CHKOK2(ne, 93, 3, d)
+      CALL CHKIN2(ne, 93, 1, l, flen)
+      CALL CHKIN2(ne, 93, 2, n, 1)
+      CALL CHKST2(ne, 93, 3, fields(1), 'in6')
+      CALL CHKST2(ne, 93, 4, fields(2), 'in4')
 
 C     94: GDUINC check
       CALL GDUINC(d, 1, 0)
-      CALL GDEROR(e, d)
-
-      IF (e .NE. GD_EOK) THEN
-        ne = ne + 1
-        WRITE(*, 2006) 94, 1, e
-      ENDIF
+      CALL CHKOK2(ne, 94, 1, d)
 
       CALL GDGEMT(fields(1), l, fields(2), l, n, d, 'newer', 5)
-      CALL GDEROR(e, d)
-
-      IF (e .NE. GD_EBC) THEN
-        ne = ne + 1
-        WRITE(*, 2006) 94, 2, e
-      ENDIF
+      CALL CHKER2(ne, 94, 2, d, GD_EBC)
 
 C     95: GDGFOF check
       CALL GDGFOF(n, d, 0)
-      CALL GDEROR(e, d)
-
-      IF (e .NE. GD_EOK) THEN
-        ne = ne + 1
-        WRITE(*, 2001) 95, e
-      ENDIF
-
-      IF (n .NE. 0) THEN
-        ne = ne + 1
-        WRITE(*, 2002) 95, n
-      ENDIF
+      CALL CHKEOK(ne, 95, d)
+      CALL CHKINT(ne, 95, n, 0)
 
 C     96: GDAFOF check
       CALL GDAFOF(d, 33, 0, 0)
-      CALL GDEROR(e, d)
-
-      IF (e .NE. GD_EOK) THEN
-        ne = ne + 1
-        WRITE(*, 2001) 96, e
-      ENDIF
+      CALL CHKOK2(ne, 96, 1, d)
 
       CALL GDGFOF(n, d, 0)
-      CALL GDEROR(e, d)
-
-      IF (e .NE. GD_EOK) THEN
-        ne = ne + 1
-        WRITE(*, 2001) 96, e
-      ENDIF
-
-      IF (n .NE. 33) THEN
-        ne = ne + 1
-        WRITE(*, 2002) 96, n
-      ENDIF
+      CALL CHKOK2(ne, 96, 2, d)
+      CALL CHKINT(ne, 96, n, 33)
 
 C     97: GDNTYP check
       CALL GDNTYP(n, d, 'data', 4)
-      CALL GDEROR(e, d)
-
-      IF (e .NE. GD_EOK) THEN
-        ne = ne + 1
-        WRITE(*, 2001) 97, e
-      ENDIF
-
-      IF (n .NE. GD_I8) THEN
-        ne = ne + 1
-        WRITE(*, 2002) 97, n
-      ENDIF
+      CALL CHKEOK(ne, 97, d)
+      CALL CHKINT(ne, 97, n, GD_I8)
 
 C     98: GDCSCL check
       CALL GDCSCL(n, d, 'polynom', 7)
-      CALL GDEROR(e, d)
-
-      IF (e .NE. GD_EOK) THEN
-        ne = ne + 1
-        WRITE(*, 2001) 98, e
-      ENDIF
-
-      IF (n .NE. 1) THEN
-        ne = ne + 1
-        WRITE(*, 2002) 98, n
-      ENDIF
+      CALL CHKEOK(ne, 98, d)
+      CALL CHKINT(ne, 98, n, 1)
 
 C     99: GDVLDT check
       CALL GDVLDT(n, d, 'new7', 4)
-      CALL GDEROR(e, d)
-
-      IF (e .NE. GD_EBC) THEN
-        ne = ne + 1
-        WRITE(*, 2001) 99, e
-      ENDIF
-
-      IF (n .NE. -1) THEN
-        ne = ne + 1
-        WRITE(*, 2002) 99, n
-      ENDIF
+      CALL CHKERR(ne, 99, d, GD_EBC)
+      CALL CHKINT(ne, 99, n, -1)
 
 C     100: GDFNUM check
-      l = 20
+      l = slen
       CALL GDREFE(str, l, d, "data", 4)
       CALL GDFNUM(dp, d, 'INDEX', 5, 33.3d0)
-      CALL GDEROR(e, d)
-
-      IF (e .NE. GD_EOK) THEN
-        ne = ne + 1
-        WRITE(*, 2001) 100, e
-      ENDIF
-
-      IF (abs(dp - 33.3) .gt. 0.001) THEN
-        ne = ne + 1
-        WRITE(*, 2012) 100, dp
-      ENDIF
+      CALL CHKEOK(ne, 100, d)
+      CALL CHKDBL(ne, 100, dp, 33.3D0)
 
 C     101: GDFNSS check
       CALL GDFNSS(dp, d, 'data', 4, 33.3d0, 6, 0)
-      CALL GDEROR(e, d)
-
-      IF (e .NE. GD_EOK) THEN
-        ne = ne + 1
-        WRITE(*, 2001) 101, e
-      ENDIF
-
-      IF (abs(dp - 37.0375) .gt. 0.001) THEN
-        ne = ne + 1
-        WRITE(*, 2012) 101, dp
-      ENDIF
+      CALL CHKEOK(ne, 101, d)
+      CALL CHKDBL(ne, 101, dp, 37.0375D0)
 
 C     138: GDGSCA check
-      l = 20
+      l = slen
       CALL GDGSCA(str, l, n, d, 'lincom', 6, 6)
-      CALL GDEROR(e, d)
-
-      IF (e .NE. GD_EOK) THEN
-        ne = ne + 1
-        WRITE(*, 2001) 138, e
-      ENDIF
-
-      IF (n .NE. -1) THEN
-        ne = ne + 1
-        WRITE(*, 2002) 138, n
-      ENDIF
-
-      IF (str .NE. "const") THEN
-        ne = ne + 1
-        WRITE(*, 2009) 138, str
-      ENDIF
+      CALL CHKEOK(ne, 138, d)
+      CALL CHKINT(ne, 138, n, -1)
+      CALL CHKSTR(ne, 138, str, "const")
 
 C     139: GDASCA check
       CALL GDASCA(d, 'lincom', 6, 6, 'new11', 5, -1, 0)
-      CALL GDEROR(e, d)
-
-      IF (e .NE. GD_EOK) THEN
-        ne = ne + 1
-        WRITE(*, 2006) 139, 1, e
-      ENDIF
+      CALL CHKOK2(ne, 139, 1, d)
 
-      l = 20
+      l = slen
       CALL GDGSCA(str, l, n, d, 'lincom', 6, 6)
-      CALL GDEROR(e, d)
-
-      IF (e .NE. GD_EOK) THEN
-        ne = ne + 1
-        WRITE(*, 2006) 139, 2, e
-      ENDIF
-
-      IF (n .NE. -1) THEN
-        ne = ne + 1
-        WRITE(*, 2002) 139, n
-      ENDIF
-
-      IF (str .NE. "new11") THEN
-        ne = ne + 1
-        WRITE(*, 2009) 139, str
-      ENDIF
+      CALL CHKOK2(ne, 139, 2, d)
+      CALL CHKINT(ne, 139, n, -1)
+      CALL CHKSTR(ne, 139, str, "new11")
 
 C     86: GDGEOF check
       CALL GDGEOF(n, d, 'lincom', 6)
-      CALL GDEROR(e, d)
-
-      IF (e. NE. GD_EOK) THEN
-        ne = ne + 1
-        WRITE(*, 2001) 86, e
-      ENDIF
-
-      IF (n .NE. 344) THEN
-        ne = ne + 1
-        WRITE(*, 2002) 86, n
-      ENDIF
+      CALL CHKEOK(ne, 86, d)
+      CALL CHKINT(ne, 86, n, 344)
 
 C     142: GDGBOF check
       CALL GDGBOF(n, d, 'lincom', 6)
-      CALL GDEROR(e, d)
-
-      IF (e. NE. GD_EOK) THEN
-        ne = ne + 1
-        WRITE(*, 2001) 142, e
-      ENDIF
-
-      IF (n .NE. 264) THEN
-        ne = ne + 1
-        WRITE(*, 2002) 142, n
-      ENDIF
+      CALL CHKEOK(ne, 142, d)
+      CALL CHKINT(ne, 142, n, 264)
 
 C     143: GDGEDV check
       l = flen
       CALL GDGEDV(fields(1), l, fields(2), l, n, d, 'div', 3)
-      CALL GDEROR(e, d)
-
-      IF (e .NE. GD_EOK) THEN
-        ne = ne + 1
-        WRITE(*, 2001) 143, e
-      ENDIF
-
-      IF (l .NE. flen) THEN
-        ne = ne + 1
-        WRITE(*, 2007) 143, 1, l
-      ENDIF
-
-      IF (n .NE. 0) THEN
-        ne = ne + 1
-        WRITE(*, 2007) 143, 2, n
-      ENDIF
-
-      IF (fields(1) .NE. 'mult') THEN
-        ne = ne + 1
-        WRITE(*, 2008) 143, 3, fields(1)
-      ENDIF
-
-      IF (fields(2) .NE. 'bit') THEN
-        ne = ne + 1
-        WRITE(*, 2008) 143, 4, fields(2)
-      ENDIF
+      CALL CHKEOK(ne, 143, d)
+      CALL CHKIN2(ne, 143, 1, l, flen)
+      CALL CHKIN2(ne, 143, 2, n, 0)
+      CALL CHKST2(ne, 143, 3, fields(1), 'mult')
+      CALL CHKST2(ne, 143, 4, fields(2), 'bit')
 
 C     144: GDGERC check
       l = flen
       CALL GDGERC(fields(1), l, dp, n, d, 'recip', 5)
-      CALL GDEROR(e, d)
-
-      IF (e .NE. GD_EOK) THEN
-        ne = ne + 1
-        WRITE(*, 2001) 144, e
-      ENDIF
-
-      IF (l .NE. flen) THEN
-        ne = ne + 1
-        WRITE(*, 2007) 144, 1, l
-      ENDIF
-
-      IF (n .NE. 0) THEN
-        ne = ne + 1
-        WRITE(*, 2007) 144, 2, n
-      ENDIF
-
-      IF (fields(1) .NE. 'div') THEN
-        ne = ne + 1
-        WRITE(*, 2008) 144, 3, fields(1)
-      ENDIF
-
-      IF (abs(dp - 6.5) .gt. 0.001) THEN
-        ne = ne + 1
-        WRITE(*, 2012) 144, dp
-      ENDIF
+      CALL CHKEOK(ne, 144, d)
+      CALL CHKIN2(ne, 144, 1, l, flen)
+      CALL CHKIN2(ne, 144, 2, n, 0)
+      CALL CHKST2(ne, 144, 3, fields(1), 'div')
+      CALL CHKDB2(ne, 144, 4, dp, 6.5D0)
 
 C     145: GDGECR check
       l = flen
       CALL GDGECR(fields(1), l, dc, n, d, 'recip', 5)
-      CALL GDEROR(e, d)
-
-      IF (e .NE. GD_EOK) THEN
-        ne = ne + 1
-        WRITE(*, 2001) 145, e
-      ENDIF
-
-      IF (l .NE. flen) THEN
-        ne = ne + 1
-        WRITE(*, 2007) 145, 1, l
-      ENDIF
-
-      IF (n .NE. 0) THEN
-        ne = ne + 1
-        WRITE(*, 2007) 145, 2, n
-      ENDIF
-
-      IF (fields(1) .NE. 'div') THEN
-        ne = ne + 1
-        WRITE(*, 2008) 145, 3, fields(1)
-      ENDIF
-
-      IF (abs(dc - cmplx(6.5, 4.3)) .gt. 0.001) THEN
-        ne = ne + 1
-        WRITE(*, 2013) 145, REAL(REAL(dc)), REAL(AIMAG(dc))
-      ENDIF
+      CALL CHKEOK(ne, 145, d)
+      CALL CHKIN2(ne, 145, 1, l, flen)
+      CALL CHKIN2(ne, 145, 2, n, 0)
+      CALL CHKST2(ne, 145, 3, fields(1), 'div')
+      CALL CHKCP2(ne, 145, 4, dc, dcmplx(6.5, 4.3))
 
 C     146: GDADDV check
       CALL GDADDV(d, 'new14', 5, 'in1', 3, 'in2', 3, 0)
-      CALL GDEROR(e, d)
-
-      IF (e .NE. GD_EOK) THEN
-        ne = ne + 1
-        WRITE(*, 2006) 146, 1, e
-      ENDIF
+      CALL CHKOK2(ne, 146, 1, d)
 
       l = flen
       CALL GDGEDV(fields(1), l, fields(2), l, n, d, 'new14', 5)
-      CALL GDEROR(e, d)
-
-      IF (e .NE. GD_EOK) THEN
-        ne = ne + 1
-        WRITE(*, 2006) 146, 2, e
-      ENDIF
-
-      IF (l .NE. flen) THEN
-        ne = ne + 1
-        WRITE(*, 2007) 146, 1, l
-      ENDIF
-
-      IF (n .NE. 0) THEN
-        ne = ne + 1
-        WRITE(*, 2007) 146, 2, n
-      ENDIF
-
-      IF (fields(1) .NE. 'in1') THEN
-        ne = ne + 1
-        WRITE(*, 2008) 146, 3, fields(1)
-      ENDIF
-
-      IF (fields(2) .NE. 'in2') THEN
-        ne = ne + 1
-        WRITE(*, 2008) 146, 4, fields(2)
-      ENDIF
+      CALL CHKOK2(ne, 146, 2, d)
+      CALL CHKIN2(ne, 146, 1, l, flen)
+      CALL CHKIN2(ne, 146, 2, n, 0)
+      CALL CHKST2(ne, 146, 3, fields(1), 'in1')
+      CALL CHKST2(ne, 146, 4, fields(2), 'in2')
 
 C     147: GDADRC check
       p(1) = 31.9
       CALL GDADRC(d, 'new15', 5, 'in1', 3, p(1), 0)
-      CALL GDEROR(e, d)
-
-      IF (e .NE. GD_EOK) THEN
-        ne = ne + 1
-        WRITE(*, 2006) 147, 1, e
-      ENDIF
+      CALL CHKOK2(ne, 147, 1, d)
 
       l = flen
       CALL GDGERC(fields(1), l, dp, n, d, 'new15', 5)
-      CALL GDEROR(e, d)
-
-      IF (e .NE. GD_EOK) THEN
-        ne = ne + 1
-        WRITE(*, 2006) 147, 2, e
-      ENDIF
-
-      IF (l .NE. flen) THEN
-        ne = ne + 1
-        WRITE(*, 2007) 147, 1, l
-      ENDIF
-
-      IF (n .NE. 0) THEN
-        ne = ne + 1
-        WRITE(*, 2007) 147, 2, n
-      ENDIF
-
-      IF (fields(1) .NE. 'in1') THEN
-        ne = ne + 1
-        WRITE(*, 2008) 147, 3, fields(1)
-      ENDIF
-
-      IF (abs(dp - p(1)) .gt. 0.001) THEN
-        ne = ne + 1
-        WRITE(*, 2012) 147, dp
-      ENDIF
+      CALL CHKOK2(ne, 147, 2, d)
+      CALL CHKIN2(ne, 147, 1, l, flen)
+      CALL CHKIN2(ne, 147, 2, n, 0)
+      CALL CHKST2(ne, 147, 3, fields(1), 'in1')
+      CALL CHKDB2(ne, 147, 4, dp, p(1))
 
 C     148: GDADCR check
       cp(1) = cmplx(31.9, 38.2)
       CALL GDADCR(d, 'new16', 5, 'in1', 3, cp(1), 0)
-      CALL GDEROR(e, d)
-
-      IF (e .NE. GD_EOK) THEN
-        ne = ne + 1
-        WRITE(*, 2006) 148, 1, e
-      ENDIF
+      CALL CHKOK2(ne, 148, 1, d)
 
       l = flen
       CALL GDGECR(fields(1), l, dc, n, d, 'new16', 5)
-      CALL GDEROR(e, d)
-
-      IF (e .NE. GD_EOK) THEN
-        ne = ne + 1
-        WRITE(*, 2006) 148, 2, e
-      ENDIF
-
-      IF (l .NE. flen) THEN
-        ne = ne + 1
-        WRITE(*, 2007) 148, 1, l
-      ENDIF
-
-      IF (n .NE. 0) THEN
-        ne = ne + 1
-        WRITE(*, 2007) 148, 2, n
-      ENDIF
-
-      IF (fields(1) .NE. 'in1') THEN
-        ne = ne + 1
-        WRITE(*, 2008) 148, 3, fields(1)
-      ENDIF
-
-      IF (abs(dc - cp(1)) .gt. 0.001) THEN
-        ne = ne + 1
-        WRITE(*, 2013) 148, dc
-      ENDIF
+      CALL CHKOK2(ne, 148, 2, d)
+      CALL CHKIN2(ne, 148, 1, l, flen)
+      CALL CHKIN2(ne, 148, 2, n, 0)
+      CALL CHKST2(ne, 148, 3, fields(1), 'in1')
+      CALL CHKCP2(ne, 148, 4, dc, cp(1))
 
 C     149: GDMDDV check
       CALL GDMDDV(d, 'data', 4, 'new14', 5, 'in3', 3, 'in4', 3)
-      CALL GDEROR(e, d)
-
-      IF (e .NE. GD_EOK) THEN
-        ne = ne + 1
-        WRITE(*, 2006) 149, 1, e
-      ENDIF
+      CALL CHKOK2(ne, 149, 1, d)
 
       l = flen
       CALL GDGEDV(fields(1), l, fields(2), l, n, d, 'data/new14', 10)
-      CALL GDEROR(e, d)
-
-      IF (e .NE. GD_EOK) THEN
-        ne = ne + 1
-        WRITE(*, 2006) 149, 2, e
-      ENDIF
-
-      IF (l .NE. flen) THEN
-        ne = ne + 1
-        WRITE(*, 2007) 149, 1, l
-      ENDIF
-
-      IF (n .NE. 0) THEN
-        ne = ne + 1
-        WRITE(*, 2007) 149, 2, n
-      ENDIF
-
-      IF (fields(1) .NE. 'in3') THEN
-        ne = ne + 1
-        WRITE(*, 2008) 149, 3, fields(1)
-      ENDIF
-
-      IF (fields(2) .NE. 'in4') THEN
-        ne = ne + 1
-        WRITE(*, 2008) 149, 4, fields(2)
-      ENDIF
+      CALL CHKOK2(ne, 149, 2, d)
+      CALL CHKIN2(ne, 149, 1, l, flen)
+      CALL CHKIN2(ne, 149, 2, n, 0)
+      CALL CHKST2(ne, 149, 3, fields(1), 'in3')
+      CALL CHKST2(ne, 149, 4, fields(2), 'in4')
 
 C     150: GDMDRC check
       p(1) = 95.5
       CALL GDMDRC(d, 'data', 4, 'new15', 5, 'in0', 3, p(1))
-      CALL GDEROR(e, d)
-
-      IF (e .NE. GD_EOK) THEN
-        ne = ne + 1
-        WRITE(*, 2006) 150, 1, e
-      ENDIF
+      CALL CHKOK2(ne, 150, 1, d)
 
       l = flen
       CALL GDGERC(fields(1), l, dp, n, d, 'data/new15', 10)
-      CALL GDEROR(e, d)
-
-      IF (e .NE. GD_EOK) THEN
-        ne = ne + 1
-        WRITE(*, 2006) 150, 2, e
-      ENDIF
-
-      IF (l .NE. flen) THEN
-        ne = ne + 1
-        WRITE(*, 2007) 150, 1, l
-      ENDIF
-
-      IF (n .NE. 0) THEN
-        ne = ne + 1
-        WRITE(*, 2007) 150, 2, n
-      ENDIF
-
-      IF (fields(1) .NE. 'in0') THEN
-        ne = ne + 1
-        WRITE(*, 2008) 150, 3, fields(1)
-      ENDIF
-
-      IF (abs(dp - p(1)) .gt. 0.001) THEN
-        ne = ne + 1
-        WRITE(*, 2012) 150, dp
-      ENDIF
+      CALL CHKOK2(ne, 150, 2, d)
+      CALL CHKIN2(ne, 150, 1, l, flen)
+      CALL CHKIN2(ne, 150, 2, n, 0)
+      CALL CHKST2(ne, 150, 3, fields(1), 'in0')
+      CALL CHKDB2(ne, 150, 4, dp, p(1))
 
 C     151: GDADCR check
       cp(1) = cmplx(8.47, 6.22)
       CALL GDMDCR(d,'data', 4,  'new16', 5, 'in3', 3, cp(1))
-      CALL GDEROR(e, d)
-
-      IF (e .NE. GD_EOK) THEN
-        ne = ne + 1
-        WRITE(*, 2006) 151, 1, e
-      ENDIF
+      CALL CHKOK2(ne, 151, 1, d)
 
       l = flen
       CALL GDGECR(fields(1), l, dc, n, d, 'data/new16', 10)
-      CALL GDEROR(e, d)
-
-      IF (e .NE. GD_EOK) THEN
-        ne = ne + 1
-        WRITE(*, 2006) 151, 2, e
-      ENDIF
-
-      IF (l .NE. flen) THEN
-        ne = ne + 1
-        WRITE(*, 2007) 151, 1, l
-      ENDIF
-
-      IF (n .NE. 0) THEN
-        ne = ne + 1
-        WRITE(*, 2007) 151, 2, n
-      ENDIF
-
-      IF (fields(1) .NE. 'in3') THEN
-        ne = ne + 1
-        WRITE(*, 2008) 151, 3, fields(1)
-      ENDIF
-
-      IF (abs(dc - cp(1)) .gt. 0.001) THEN
-        ne = ne + 1
-        WRITE(*, 2013) 151, dc
-      ENDIF
+      CALL CHKOK2(ne, 151, 2, d)
+      CALL CHKIN2(ne, 151, 1, l, flen)
+      CALL CHKIN2(ne, 151, 2, n, 0)
+      CALL CHKST2(ne, 151, 3, fields(1), 'in3')
+      CALL CHKCP2(ne, 151, 4, dc, cp(1))
 
 C     152: GDALDV check
       CALL GDALDV(d, 'new14', 5, 'in6', 3, 'in4', 3)
-      CALL GDEROR(e, d)
-
-      IF (e .NE. GD_EOK) THEN
-        ne = ne + 1
-        WRITE(*, 2006) 152, 1, e
-      ENDIF
+      CALL CHKOK2(ne, 152, 1, d)
 
       l = flen
       CALL GDGEDV(fields(1), l, fields(2), l, n, d, 'new14', 5)
-      CALL GDEROR(e, d)
-
-      IF (e .NE. GD_EOK) THEN
-        ne = ne + 1
-        WRITE(*, 2006) 152, 2, e
-      ENDIF
-
-      IF (l .NE. flen) THEN
-        ne = ne + 1
-        WRITE(*, 2007) 152, 1, l
-      ENDIF
-
-      IF (n .NE. 0) THEN
-        ne = ne + 1
-        WRITE(*, 2007) 152, 2, n
-      ENDIF
-
-      IF (fields(1) .NE. 'in6') THEN
-        ne = ne + 1
-        WRITE(*, 2008) 152, 3, fields(1)
-      ENDIF
-
-      IF (fields(2) .NE. 'in4') THEN
-        ne = ne + 1
-        WRITE(*, 2008) 152, 4, fields(2)
-      ENDIF
+      CALL CHKOK2(ne, 152, 2, d)
+      CALL CHKIN2(ne, 152, 1, l, flen)
+      CALL CHKIN2(ne, 152, 2, n, 0)
+      CALL CHKST2(ne, 152, 3, fields(1), 'in6')
+      CALL CHKST2(ne, 152, 4, fields(2), 'in4')
 
 C     153: GDALRC check
       p(1) = 0.187
       CALL GDALRC(d, 'new15', 5, 'in5', 3, p(1))
-      CALL GDEROR(e, d)
-
-      IF (e .NE. GD_EOK) THEN
-        ne = ne + 1
-        WRITE(*, 2006) 153, 1, e
-      ENDIF
+      CALL CHKOK2(ne, 153, 1, d)
 
       l = flen
       CALL GDGERC(fields(1), l, dp, n, d, 'new15', 5)
-      CALL GDEROR(e, d)
-
-      IF (e .NE. GD_EOK) THEN
-        ne = ne + 1
-        WRITE(*, 2006) 153, 2, e
-      ENDIF
-
-      IF (l .NE. flen) THEN
-        ne = ne + 1
-        WRITE(*, 2007) 153, 1, l
-      ENDIF
-
-      IF (n .NE. 0) THEN
-        ne = ne + 1
-        WRITE(*, 2007) 153, 2, n
-      ENDIF
-
-      IF (fields(1) .NE. 'in5') THEN
-        ne = ne + 1
-        WRITE(*, 2008) 153, 3, fields(1)
-      ENDIF
-
-      IF (abs(dp - p(1)) .gt. 0.001) THEN
-        ne = ne + 1
-        WRITE(*, 2012) 153, dp
-      ENDIF
+      CALL CHKOK2(ne, 153, 2, d)
+      CALL CHKIN2(ne, 153, 1, l, flen)
+      CALL CHKIN2(ne, 153, 2, n, 0)
+      CALL CHKST2(ne, 153, 3, fields(1), 'in5')
+      CALL CHKDB2(ne, 153, 4, dp, p(1))
 
 C     154: GDALCR check
       cp(1) = cmplx(4.3, 81.81)
       CALL GDALCR(d, 'new16', 5, 'in6', 3, cp(1))
-      CALL GDEROR(e, d)
-
-      IF (e .NE. GD_EOK) THEN
-        ne = ne + 1
-        WRITE(*, 2006) 154, 1, e
-      ENDIF
+      CALL CHKOK2(ne, 154, 1, d)
 
       l = flen
       CALL GDGECR(fields(1), l, dc, n, d, 'new16', 5)
-      CALL GDEROR(e, d)
-
-      IF (e .NE. GD_EOK) THEN
-        ne = ne + 1
-        WRITE(*, 2006) 154, 2, e
-      ENDIF
-
-      IF (l .NE. flen) THEN
-        ne = ne + 1
-        WRITE(*, 2007) 154, 1, l
-      ENDIF
-
-      IF (n .NE. 0) THEN
-        ne = ne + 1
-        WRITE(*, 2007) 154, 2, n
-      ENDIF
-
-      IF (fields(1) .NE. 'in6') THEN
-        ne = ne + 1
-        WRITE(*, 2008) 154, 3, fields(1)
-      ENDIF
-
-      IF (abs(dc - cp(1)) .gt. 0.001) THEN
-        ne = ne + 1
-        WRITE(*, 2013) 154, dc
-      ENDIF
+      CALL CHKOK2(ne, 154, 2, d)
+      CALL CHKIN2(ne, 154, 1, l, flen)
+      CALL CHKIN2(ne, 154, 2, n, 0)
+      CALL CHKST2(ne, 154, 3, fields(1), 'in6')
+      CALL CHKCP2(ne, 154, 4, dc, cp(1))
 
 C     155: GDRFRG check
       CALL GDRFRG(d, 0)
-      CALL GDEROR(e, d)
-
-      IF (e .NE. GD_EOK) THEN
-        ne = ne + 1
-        WRITE(*, 2001), 155, e
-      ENDIF
+      CALL CHKEOK(ne, 155, d)
 
 C     156: GDINVD check
       CALL GDINVD(m)
-      CALL GDEROR(e, m)
-
-      IF (e .NE. GD_EOK) THEN
-        ne = ne + 1
-        WRITE(*, 2006), 156, 1, e
-      ENDIF
+      CALL CHKOK2(ne, 156, 1, m)
 
       CALL GDNFRG(n, m)
-      CALL GDEROR(e, m)
-
-      IF (e .NE. GD_EBD) THEN
-        ne = ne + 1
-        WRITE(*, 2006), 156, 2, e
-      ENDIF
+      CALL CHKER2(ne, 156, 2, m, GD_EBD)
 
       CALL GDCLOS(m)
 
 C     157: GDSTDV check
       n = GDSV_C
       CALL GDSTDV(n, d)
-      CALL GDEROR(e, d)
-
-      IF (e .NE. GD_EOK) THEN
-        ne = ne + 1
-        WRITE(*, 2006), 157, 1, e
-      ENDIF
-
-      IF (n .NE. 8) THEN
-        ne = ne + 1
-        WRITE(*, 2002), 157, n
-      ENDIF
+      CALL CHKOK2(ne, 157, 1, d)
+      CALL CHKINT(ne, 157, n, 9)
 
       n = 0
       CALL GDSTDV(n, d)
-      CALL GDEROR(e, d)
-
-      IF (e .NE. GD_EVR) THEN
-        ne = ne + 1
-        WRITE(*, 2006), 157, 2, e
-      ENDIF
+      CALL CHKER2(ne, 157, 2, d, GD_EAR)
 
 C     158: GDGTCA check
       CALL GDGTCA(d, 'carray', 6, GD_F64, p)
-      CALL GDEROR(e, d)
-
-      IF (e .NE. GD_EOK) THEN
-        ne = ne + 1
-        WRITE(*, 2001) 158, e
-      ENDIF
+      CALL CHKEOK(ne, 158, d)
 
       DO 1580 i=1,6
-      IF (abs(p(i) - 1.1 * i) .gt. 0.001) THEN
-        ne = ne + 1
-        WRITE(*, 2010) 158, i, p(i)
-      ENDIF
+      CALL CHKDB2(ne, 158, i, p(i), 1.1d0 * i)
  1580 CONTINUE
 
 C     159: GDGCAS check
       CALL GDGCAS(d, 'carray', 6, 3, 2, GD_F64, p)
-      CALL GDEROR(e, d)
-
-      IF (e .NE. GD_EOK) THEN
-        ne = ne + 1
-        WRITE(*, 2001) 159, e
-      ENDIF
+      CALL CHKEOK(ne, 159, d)
 
       DO 1590 i=1,2
-      IF (abs(p(i) - 2.2 - 1.1 * i) .gt. 0.001) THEN
-        ne = ne + 1
-        WRITE(*, 2010) 159, i, p(i)
-      ENDIF
+      CALL CHKDB2(ne, 159, i, p(i), 2.2d0 + 1.1 * i)
  1590 CONTINUE
 
 C     168: GDPTCA check
@@ -3718,26 +1634,13 @@ C     168: GDPTCA check
       p(5) = 5.2
       p(6) = 4.1
       CALL GDPTCA(d, 'carray', 6, GD_F64, p)
-      CALL GDEROR(e, d)
-
-      IF (e .NE. GD_EOK) THEN
-        ne = ne + 1
-        WRITE(*, 2006) 168, 1, e
-      ENDIF
+      CALL CHKOK2(ne, 168, 1, d)
 
       CALL GDGTCA(d, 'carray', 6, GD_F64, q)
-      CALL GDEROR(e, d)
-
-      IF (e .NE. GD_EOK) THEN
-        ne = ne + 1
-        WRITE(*, 2006) 168, 2, e
-      ENDIF
+      CALL CHKOK2(ne, 168, 2, d)
 
       DO 1680 i=1,6
-      IF (abs(q(i) - 10.7 + 1.1 * i) .gt. 0.001) THEN
-        ne = ne + 1
-        WRITE(*, 2010) 168, i, p(i)
-      ENDIF
+      CALL CHKDB2(ne, 168, i, q(i), 10.7d0 - 1.1d0 * i)
  1680 CONTINUE
 
 C     169: GDGCAS check
@@ -3748,72 +1651,31 @@ C     169: GDGCAS check
       p(5) = 5.9
       p(6) = 6.0
       CALL GDPCAS(d, 'carray', 6, 3, 2, GD_F64, p)
-      CALL GDEROR(e, d)
-
-      IF (e .NE. GD_EOK) THEN
-        ne = ne + 1
-        WRITE(*, 2001) 169, 1, e
-      ENDIF
+      CALL CHKOK2(ne, 169, 1, d)
 
       CALL GDGTCA(d, 'carray', 6, GD_F64, q)
-      CALL GDEROR(e, d)
-
-      IF (e .NE. GD_EOK) THEN
-        ne = ne + 1
-        WRITE(*, 2006) 169, 2, e
-      ENDIF
+      CALL CHKOK2(ne, 169, 2, d)
 
       DO 1690 i=1,6
       IF (i .eq. 3 .or. i .eq. 4) THEN
-        IF (abs(q(i) - 5.2 - 0.1 * i) .gt. 0.001) THEN
-          ne = ne + 1
-          WRITE(*, 2010) 169, i, p(i)
-        ENDIF
+        dp = 5.2 + 0.1 * i
       ELSE
-        IF (abs(q(i) - 10.7 + 1.1 * i) .gt. 0.001) THEN
-          ne = ne + 1
-          WRITE(*, 2010) 169, i, p(i)
-        ENDIF
+        dp = 10.7 - 1.1 * i
       ENDIF
+      CALL CHKDB2(ne, 169, i, q(i), dp)
  1690 CONTINUE
 
 C     177: GDCALN check
       CALL GDCALN(n, d, 'carray', 6)
-      CALL GDEROR(e, d)
-
-      IF (e .NE. GD_EOK) THEN
-        ne = ne + 1
-        WRITE(*, 2001) 177, e
-      ENDIF
-
-      IF (n .NE. 6) THEN
-        ne = ne + 1
-        WRITE(*, 2002) 177, n
-      ENDIF
+      CALL CHKEOK(ne, 177, d)
+      CALL CHKINT(ne, 177, n, 6)
 
 C     178: GDGECA check
       CALL GDGECA(i, l, n, d, 'carray', 6)
-      CALL GDEROR(e, d)
-
-      IF (e .NE. GD_EOK) THEN
-        ne = ne + 1
-        WRITE(*, 2001) 178, e
-      ENDIF
-
-      IF (l .NE. 6) THEN
-        ne = ne + 1
-        WRITE(*, 2007) 178, 1, l
-      ENDIF
-
-      IF (n .NE. 0) THEN
-        ne = ne + 1
-        WRITE(*, 2007) 178, 2, n
-      ENDIF
-
-      IF (i .NE. GD_F64) THEN
-        ne = ne + 1
-        WRITE(*, 2007) 178, 3, i
-      ENDIF
+      CALL CHKEOK(ne, 178, d)
+      CALL CHKIN2(ne, 178, 1, l, 6)
+      CALL CHKIN2(ne, 178, 2, n, 0)
+      CALL CHKIN2(ne, 178, 3, i, GD_F64)
 
 C     179: GDADCA check
       p(1) = 1.2
@@ -3821,49 +1683,19 @@ C     179: GDADCA check
       p(3) = 5.6
       p(4) = 7.8
       CALL GDADCA(d, 'new17', 5, GD_F64, 4, GD_F64, p, 0)
-      CALL GDEROR(e, d)
-
-      IF (e .NE. GD_EOK) THEN
-        ne = ne + 1
-        WRITE(*, 2006) 179, 1, e
-      ENDIF
+      CALL CHKOK2(ne, 179, 1, d)
 
       CALL GDGECA(i, l, n, d, 'new17', 5)
-      CALL GDEROR(e, d)
-
-      IF (e .NE. GD_EOK) THEN
-        ne = ne + 1
-        WRITE(*, 2006) 179, 2, e
-      ENDIF
-
-      IF (n .NE. 0) THEN
-        ne = ne + 1
-        WRITE(*, 2007) 179, 1, n
-      ENDIF
-
-      IF (i .NE. GD_F64) THEN
-        ne = ne + 1
-        WRITE(*, 2007) 179, 2, i
-      ENDIF
-
-      IF (l .NE. 4) THEN
-        ne = ne + 1
-        WRITE(*, 2007) 179, 3, l
-      ENDIF
+      CALL CHKOK2(ne, 179, 2, d)
+      CALL CHKIN2(ne, 179, 1, n, 0)
+      CALL CHKIN2(ne, 179, 2, i, GD_F64)
+      CALL CHKIN2(ne, 179, 3, l, 4)
 
       CALL GDGTCA(d, 'new17', 5, GD_F64, q)
-      CALL GDEROR(e, d)
-
-      IF (e .NE. GD_EOK) THEN
-        ne = ne + 1
-        WRITE(*, 2006) 179, 3, e
-      ENDIF
+      CALL CHKOK2(ne, 179, 3, d)
 
       DO 1790 i=1,4
-      IF (abs(q(i) + 1.0 - i * 2.2) .gt. 0.001) THEN
-        ne = ne + 1
-        WRITE(*, 2005) 179, fl
-      ENDIF
+      CALL CHKDB2(ne, 179, i, q(i), i * 2.2d0 - 1.0d0)
  1790 CONTINUE
 
 C     180: GDMDCA check
@@ -3872,83 +1704,448 @@ C     180: GDMDCA check
       p(3) = 7.6
       p(4) = 9.8
       CALL GDMDCA(d, 'data', 4, 'new17', 5, GD_F64, 4, GD_F64, p)
-      CALL GDEROR(e, d)
-
-      IF (e .NE. GD_EOK) THEN
-        ne = ne + 1
-        WRITE(*, 2006) 180, 1, e
-      ENDIF
+      CALL CHKOK2(ne, 180, 1, d)
 
       CALL GDGECA(i, l, n, d, 'data/new17', 10)
-      CALL GDEROR(e, d)
-
-      IF (e .NE. GD_EOK) THEN
-        ne = ne + 1
-        WRITE(*, 2006) 180, 2, e
-      ENDIF
-
-      IF (n .NE. 0) THEN
-        ne = ne + 1
-        WRITE(*, 2007) 180, 1, n
-      ENDIF
-
-      IF (i .NE. GD_F64) THEN
-        ne = ne + 1
-        WRITE(*, 2007) 180, 2, i
-      ENDIF
-
-      IF (l .NE. 4) THEN
-        ne = ne + 1
-        WRITE(*, 2007) 180, 3, l
-      ENDIF
+      CALL CHKOK2(ne, 180, 2, d)
+      CALL CHKIN2(ne, 180, 1, n, 0)
+      CALL CHKIN2(ne, 180, 2, i, GD_F64)
+      CALL CHKIN2(ne, 180, 3, l, 4)
 
       CALL GDGTCA(d, 'data/new17', 10, GD_F64, q)
-      CALL GDEROR(e, d)
-
-      IF (e .NE. GD_EOK) THEN
-        ne = ne + 1
-        WRITE(*, 2006) 180, 3, e
-      ENDIF
+      CALL CHKOK2(ne, 180, 3, d)
 
       DO 1800 i=1,4
-      IF (abs(q(i) - 1.0 - i * 2.2) .gt. 0.001) THEN
-        ne = ne + 1
-        WRITE(*, 2005) 180, fl
-      ENDIF
+      CALL CHKDB2(ne, 180, i, q(i), 1.0d0 + i * 2.2d0)
  1800 CONTINUE
 
 C     181: GDALCA check
       CALL GDALCA(d, 'new17', 5, GD_F32, 3)
-      CALL GDEROR(e, d)
-
-      IF (e .NE. GD_EOK) THEN
-        ne = ne + 1
-        WRITE(*, 2006) 181, 1, e
-      ENDIF
+      CALL CHKOK2(ne, 181, 1, d)
 
       CALL GDGECA(i, l, n, d, 'new17', 5)
-      CALL GDEROR(e, d)
+      CALL CHKOK2(ne, 181, 2, d)
+      CALL CHKIN2(ne, 181, 1, n, 0)
+      CALL CHKIN2(ne, 181, 2, i, GD_F32)
+      CALL CHKIN2(ne, 181, 3, l, 3)
 
-      IF (e .NE. GD_EOK) THEN
-        ne = ne + 1
-        WRITE(*, 2006) 181, 2, e
-      ENDIF
+C     183: GDCONS check
+      p(1) = 10.0
+      p(2) = -8.1
+      CALL GDNFDT(n, d, GD_COE)
 
-      IF (n .NE. 0) THEN
-        ne = ne + 1
-        WRITE(*, 2007) 181, 1, n
-      ENDIF
+      DO 1830 i = 1, n
+      l = flen
+      CALL GDCONS(fl, d, GD_F32, i)
+      CALL CHKOK2(ne, 183, i, d)
+      CALL CHKDB2(ne, 183, i, 1d0 * fl, p(i))
+ 1830 CONTINUE
 
-      IF (i .NE. GD_F32) THEN
-        ne = ne + 1
-        WRITE(*, 2007) 181, 2, i
-      ENDIF
+C     191: GDMCOS check
+      p(1) = 3.3
+      p(2) = -8.1
+      CALL GDNMFT(n, d, "data", 4, GD_COE)
 
-      IF (l .NE. 3) THEN
-        ne = ne + 1
-        WRITE(*, 2007) 181, 3, l
-      ENDIF
+      DO 1910 i = 1, n
+      l = flen
+      CALL GDMCOS(fl, d, "data", 4, GD_F32, i)
+      CALL CHKOK2(ne, 191, i, d)
+      CALL CHKDB2(ne, 191, i, 1d0 * fl, p(i))
+ 1910 CONTINUE
+
+C     199: GDSTRS check
+      strings(1) = "Lorem ipsum         "
+      strings(2) = "---string---        "
+      strings(3) = "Arthur Dent         "
+      CALL GDNFDT(n, d, GD_STE)
+
+      DO 1990 i = 1, n
+      l = slen
+
+      CALL GDSTRS(str, l, d, i)
+      CALL CHKOK2(ne, 199, i, d)
+      CALL CHKIN2(ne, 199, i, l, slen)
+      CALL CHKST2(ne, 199, i, str, strings(i))
+ 1990 CONTINUE
+
+C     200: GDMSTS check
+      strings(1) = 'This is a string constant.'
+      strings(2) = 'kai su, technon;          '
+      CALL GDNMFT(n, d, 'data', 4, GD_STE)
+
+      DO 2000 i = 1, n
+      l = slen
+      CALL GDMSTS(str, l, d, "data", 4, i)
+      CALL CHKOK2(ne, 200, i, d)
+      CALL CHKIN2(ne, 200, i, l, slen)
+      CALL CHKST2(ne, 200, i, str, strings(i))
+ 2000 CONTINUE
+
+C     201: GDSTRX check
+      CALL GDSTRX(i, d)
+      CALL CHKEOK(ne, 201, d)
+      CALL CHKINT(ne, 201, i, 12)
+
+C     202: GDMSTX check
+      CALL GDMSTX(i, d, 'data', 4)
+      CALL CHKEOK(ne, 202, d)
+      CALL CHKINT(ne, 202, i, slen)
+
+C     203: GDSEEK check
+      CALL GDSEEK(n, d, 'data', 4, 35, 0, GDSK_S)
+      CALL CHKOK2(ne, 203, 1, d)
+      CALL CHKIN2(ne, 203, 1, n, 280)
+
+      CALL GDGETD(m, d, 'data', 4, GD_HER, 0, 1, 0, GD_I8, c)
+      CALL CHKOK2(ne, 203, 2, d)
+      CALL CHKIN2(ne, 203, 2, m, 8)
+
+      DO 2030 i = 1, 8
+      CALL CHKIN2(ne, 203, i, INT(c(i)), 16 + i)
+ 2030 CONTINUE
+
+C     204: GDTELL check
+      CALL GDTELL(n, d, 'data', 4)
+      CALL CHKEOK(ne, 204, d)
+      CALL CHKINT(ne, 204, n, 288)
+
+C     205: GDHIDE check
+      CALL GDHIDE(d, 'data', 4)
+      CALL CHKEOK(ne, 205, d)
+
+C     206: GDHIDN check
+      CALL GDHIDN(n, d, 'data', 4)
+      CALL CHKOK2(ne, 206, 1, d)
+      CALL CHKIN2(ne, 206, 1, n, 1)
+
+      CALL GDHIDN(n,d, 'lincom', 6)
+      CALL CHKOK2(ne, 206, 2, d)
+      CALL CHKIN2(ne, 206, 2, n, 0)
+
+C     207: GDUHID check
+      CALL GDUHID(d, 'data', 4)
+      CALL CHKOK2(ne, 206, 1, d)
+      CALL GDHIDN(n, d, 'data', 4)
+      CALL CHKOK2(ne, 206, 2, d)
+      CALL CHKINT(ne, 206, n, 0)
+
+C     208: GDSYNC check
+      CALL GDSYNC(d, 'data', 4)
+      CALL CHKEOK(ne, 208, d)
+
+C     209: GDFLSH check
+      CALL GDFLSH(d, 'data', 4)
+      CALL CHKEOK(ne, 209, d)
+
+C     210: GDMFLS check
+      CALL GDMFLS(d)
+      CALL CHKEOK(ne, 210, d)
+
+C     211: GDGEWD check
+      l = flen
+      i = flen
+      CALL GDGEWD(fields(1), i, fields(2), l, m, j, dp, n, d, 'window',
+     +6)
+      CALL CHKEOK(ne, 211, d)
+      CALL CHKIN2(ne, 211, 1, i, flen)
+      CALL CHKIN2(ne, 211, 2, l, flen)
+      CALL CHKIN2(ne, 211, 3, n, 0)
+      CALL CHKIN2(ne, 211, 4, m, GDW_LT)
+      CALL CHKST2(ne, 211, 5, fields(1), 'linterp')
+      CALL CHKST2(ne, 211, 6, fields(2), 'mult')
+      CALL CHKDB2(ne, 211, 7, dp, 4.1D0)
+
+C     212: GDADWD check
+      CALL GDADWD(d, 'new18', 5, 'in1', 3, 'in2', 3, GDW_NE, 32, 0)
+      CALL CHKOK2(ne, 212, 1, d)
+
+      l = flen
+      i = flen
+      CALL GDGEWD(fields(1), i, fields(2), l, m, j, dp, n, d, 'new18',
+     +5)
+      CALL CHKOK2(ne, 212, 2, d)
+      CALL CHKIN2(ne, 212, 1, i, flen)
+      CALL CHKIN2(ne, 212, 2, l, flen)
+      CALL CHKIN2(ne, 212, 3, n, 0)
+      CALL CHKIN2(ne, 212, 4, m, GDW_NE)
+      CALL CHKST2(ne, 212, 5, fields(1), 'in1')
+      CALL CHKST2(ne, 212, 6, fields(2), 'in2')
+      CALL CHKIN2(ne, 212, 7, j, 32)
+
+C     214: GDMDWD check
+      CALL GDMDWD(d, 'data', 4, 'mnew18', 6, 'in2', 3, 'in3', 3, GDW_ST,
+     +128, 0)
+      CALL CHKOK2(ne, 214, 1, d)
+
+      l = flen
+      i = flen
+      CALL GDGEWD(fields(1), i, fields(2), l, m, j, dp, n, d,
+     +'data/mnew18', 11)
+      CALL CHKOK2(ne, 214, 2, d)
+      CALL CHKIN2(ne, 214, 1, i, flen)
+      CALL CHKIN2(ne, 214, 2, l, flen)
+      CALL CHKIN2(ne, 214, 3, n, 0)
+      CALL CHKIN2(ne, 214, 4, m, GDW_ST)
+      CALL CHKST2(ne, 214, 5, fields(1), 'in2')
+      CALL CHKST2(ne, 214, 6, fields(2), 'in3')
+      CALL CHKIN2(ne, 214, 7, j, 128)
+
+C     217: GDALWD check
+      CALL GDALWD(d, 'new18', 5, 'in3', 3, 'in4', 3, GDW_GE, 32d3)
+      CALL CHKOK2(ne, 217, 1, d)
+
+      l = flen
+      i = flen
+      CALL GDGEWD(fields(1), i, fields(2), l, m, j, dp, n, d, 'new18',
+     +5)
+      CALL CHKOK2(ne, 217, 2, d)
+      CALL CHKIN2(ne, 217, 1, i, flen)
+      CALL CHKIN2(ne, 217, 2, l, flen)
+      CALL CHKIN2(ne, 217, 3, n, 0)
+      CALL CHKIN2(ne, 217, 4, m, GDW_GE)
+      CALL CHKST2(ne, 217, 5, fields(1), 'in3')
+      CALL CHKST2(ne, 217, 6, fields(2), 'in4')
+      CALL CHKDB2(ne, 217, 7, dp, 32d3)
+
+C     218: GDATRG check
+      l = flen
+      CALL GDATRG(fields(1), l, d, 'alias', 5)
+      CALL CHKEOK(ne, 218, d)
+      CALL CHKIN2(ne, 218, 1, l, flen)
+      CALL CHKST2(ne, 218, 2, fields(1), 'data')
+
+C     219: GDADAL check
+      CALL GDADAL(d, 'new20', 5, 'data', 4, 0)
+      CALL CHKOK2(ne, 219, 1, d)
+
+      l = flen
+      CALL GDATRG(fields(1), l, d, 'new20', 5)
+      CALL CHKOK2(ne, 219, 2, d)
+      CALL CHKIN2(ne, 219, 1, l, flen)
+      CALL CHKST2(ne, 219, 2, fields(1), 'data')
+
+C     220: GDMDAL check
+      CALL GDMDAL(d, 'data', 4, 'mnew20', 6, 'data', 4)
+      CALL CHKOK2(ne, 220, 1, d)
+
+      l = flen
+      CALL GDATRG(fields(1), l, d, 'data/mnew20', 11)
+      CALL CHKOK2(ne, 220, 2, d)
+      CALL CHKIN2(ne, 220, 1, l, flen)
+      CALL CHKST2(ne, 220, 2, fields(1), 'data')
+
+C     221: GDNALS check
+      CALL GDNALS(n, d, 'data', 4)
+      CALL CHKEOK(ne, 221, d)
+      CALL CHKINT(ne, 221, n, 4)
+
+C     222: GDALSS check
+      fields(1) = 'data'
+      fields(2) = 'alias'
+      fields(3) = 'data/mnew20'
+      fields(4) = 'new20'
+      DO 2220 i = 1, n
+      l = flen
+      CALL GDALSS(fn, l, d, 'data', 4, i)
+      CALL CHKOK2(ne, 222, i, d)
+      CALL CHKIN2(ne, 222, i, l, flen)
+      CALL CHKST2(ne, 222, i, fn, fields(i))
+ 2220 CONTINUE
+
+C     223: GDINCA check
+      CALL GDINCA(d, 'format1', 7, 0, 'A', 1, 'Z', 1, GD_CR + GD_EX)
+      CALL CHKEOK(ne, 223, d)
+
+C     224: GDMOVA check
+      CALL GDMOVA(d, 'new20', 5, 1)
+      CALL CHKOK2(ne, 224, 1, d)
+
+      CALL GDFRGI(n, d, 'Anew20Z', 7)
+      CALL CHKOK2(ne, 224, 2, d)
+      CALL CHKINT(ne, 224, n, 1)
+
+C     225: GDDELA check
+      CALL GDDELA(d, 'Anew20Z', 7, 0)
+      CALL CHKOK2(ne, 225, 1, d)
+
+      CALL GDFRGI(n, d, 'Anew20Z', 7)
+      CALL CHKER2(ne, 225, 2, d, GD_EBC)
+      CALL CHKINT(ne, 225, n, -1)
+
+C     226: GDFRAF check
+      l = flen
+      n = flen
+      CALL GDFRAF(fields(1), l, fields(2), n, d, 1)
+      CALL CHKEOK(ne, 226, d)
+      CALL CHKIN2(ne, 226, 1, l, flen)
+      CALL CHKIN2(ne, 226, 2, n, flen)
+      CALL CHKST2(ne, 226, 3, fields(1), 'A')
+      CALL CHKST2(ne, 226, 4, fields(2), 'Z')
+
+C     227: GDAAFX check
+      CALL GDAAFX(d, 1, 'B', 1, '', 0)
+      CALL CHKOK2(ne, 227, 1, d)
+
+      l = flen
+      n = flen
+      CALL GDFRAF(fields(1), l, fields(2), n, d, 1)
+      CALL CHKOK2(ne, 227, 2, d)
+      CALL CHKIN2(ne, 227, 1, l, flen)
+      CALL CHKIN2(ne, 227, 2, n, flen)
+      CALL CHKST2(ne, 227, 3, fields(1), 'B')
+      CALL CHKST2(ne, 227, 3, fields(2), '')
+
+C     228: GDGEMX check
+      l = flen
+      i = flen
+      CALL GDGEMX(fields(1), i, fields(2), l, m, j, n, d, 'mplex', 5)
+      CALL CHKEOK(ne, 228, d)
+      CALL CHKIN2(ne, 228, 1, i, flen)
+      CALL CHKIN2(ne, 228, 2, l, flen)
+      CALL CHKIN2(ne, 228, 3, n, 0)
+      CALL CHKIN2(ne, 228, 4, m, 1)
+      CALL CHKST2(ne, 228, 5, fields(1), 'data')
+      CALL CHKST2(ne, 228, 6, fields(2), 'sbit')
+      CALL CHKIN2(ne, 228, 7, j, 10)
+
+C     229: GDADMX check
+      CALL GDADMX(d, 'new21', 5, 'in1', 3, 'in2', 3, 5, 6, 0)
+      CALL CHKOK2(ne, 229, 1, d)
+
+      l = flen
+      i = flen
+      CALL GDGEMX(fields(1), i, fields(2), l, m, j, n, d, 'new21', 5)
+      CALL CHKOK2(ne, 229, 2, d)
+      CALL CHKIN2(ne, 229, 1, i, flen)
+      CALL CHKIN2(ne, 229, 2, l, flen)
+      CALL CHKIN2(ne, 229, 3, n, 0)
+      CALL CHKIN2(ne, 229, 4, m, 5)
+      CALL CHKST2(ne, 229, 5, fields(1), 'in1')
+      CALL CHKST2(ne, 229, 6, fields(2), 'in2')
+      CALL CHKIN2(ne, 229, 7, j, 6)
+
+C     230: GDMDMX check
+      CALL GDMDMX(d, 'data', 4, 'mnew21', 6, 'in2', 3, 'in3', 3, 0, 12)
+      CALL CHKOK2(ne, 230, 1, d)
+
+      l = flen
+      i = flen
+      CALL GDGEMX(fields(1), i, fields(2), l, m, j, n, d, 'data/mnew21',
+     +11)
+      CALL CHKOK2(ne, 230, 2, d)
+      CALL CHKIN2(ne, 230, 1, i, flen)
+      CALL CHKIN2(ne, 230, 2, l, flen)
+      CALL CHKIN2(ne, 230, 3, n, 0)
+      CALL CHKIN2(ne, 230, 4, m, 0)
+      CALL CHKST2(ne, 230, 5, fields(1), 'in2')
+      CALL CHKST2(ne, 230, 6, fields(2), 'in3')
+      CALL CHKIN2(ne, 230, 7, j, 12)
+
+C     231: GDALMX check
+      CALL GDALMX(d, 'new21', 5, 'in3', 3, 'in4', 3, 7, -1)
+      CALL CHKOK2(ne, 231, 1, d)
+
+      l = flen
+      i = flen
+      CALL GDGEMX(fields(1), i, fields(2), l, m, j, n, d, 'new21', 5)
+      CALL CHKOK2(ne, 231, 2, d)
+      CALL CHKIN2(ne, 231, 1, i, flen)
+      CALL CHKIN2(ne, 231, 2, l, flen)
+      CALL CHKIN2(ne, 231, 3, n, 0)
+      CALL CHKIN2(ne, 231, 4, m, 7)
+      CALL CHKST2(ne, 231, 5, fields(1), 'in3')
+      CALL CHKST2(ne, 231, 6, fields(2), 'in4')
+      CALL CHKIN2(ne, 231, 7, j, 6)
+
+C     232: GDTOKE check
+      l = slen
+      CALL GDTOKE(str, l, d, '"test1 test2" test3\ test4 test5', 32)
+      CALL CHKOK2(ne, 232, 1, d)
+      CALL CHKIN2(ne, 232, 2, l, slen)
+      CALL CHKST2(ne, 232, 3, str, 'test1 test2')
+
+      l = slen
+      CALL GDTOKE(str, l, d, '', -1)
+      CALL CHKOK2(ne, 232, 4, d)
+      CALL CHKIN2(ne, 232, 5, l, slen)
+      CALL CHKST2(ne, 232, 6, str, 'test3 test4')
+
+C     233: GDRCLO check
+      CALL GDRCLO(d, 'data', 4)
+      CALL CHKEOK(ne, 233, d)
+
+C     234: GDDSYN check
+      CALL GDDSYN(n, d, 0)
+      CALL CHKEOK(ne, 234, d)
+      CALL CHKINT(ne, 234, n, 0)
+
+C     235: GDFLAG check
+      CALL GDFLAG(n, d, GD_PP, 0)
+      CALL CHKEOK(ne, 235, d)
+      CALL CHKINT(ne, 235, n, GD_PP)
+
+C     236: GDVBPX check
+      CALL GDVBPX(d, "big_test", 8)
+      CALL CHKEOK(ne, 236, d)
+
+C     237: GDNENT check
+      CALL GDNENT(n, d, "data", 4, GDEN_S, GDEN_H + GDEN_N)
+      CALL CHKOK2(ne, 237, 1, d)
+      CALL CHKIN2(ne, 237, 1, n, 5)
+      CALL GDNENT(n, d, "", -1, GDEN_V, GDEN_H + GDEN_N)
+      CALL CHKOK2(ne, 237, 2, d)
+      CALL CHKIN2(ne, 237, 2, n, 26)
+
+C     238: GDENTX check
+      CALL GDENTX(l, d, "", -1, GDEN_V, GDEN_H + GDEN_N)
+      CALL CHKEOK(ne, 238, d)
+      CALL CHKINT(ne, 238, l, 7)
+
+C     239: GDENTN check
+      fields(1)  = "INDEX"
+      fields(2)  = "bit"
+      fields(3)  = "data"
+      fields(4)  = "div"
+      fields(5)  = "lincom"
+      fields(6)  = "linterp"
+      fields(7)  = "mplex"
+      fields(8)  = "mult"
+      fields(9)  = "new1"
+      fields(10) = "new14"
+      fields(11) = "new15"
+      fields(12) = "new16"
+      fields(13) = "new18"
+      fields(14) = "new2"
+      fields(15) = "new21"
+      fields(16) = "new3"
+      fields(17) = "new4"
+      fields(18) = "new5"
+      fields(19) = "new6"
+      fields(20) = "new7"
+      fields(21) = "new8"
+      fields(22) = "phase"
+      fields(23) = "polynom"
+      fields(24) = "recip"
+      fields(25) = "sbit"
+      fields(26) = "window"
+      DO 2390 i = 1, n
+      l = flen
+      CALL GDENTN(fn, l, d, "", -1, GDEN_V, GDEN_H + GDEN_N, i)
+      CALL CHKOK2(ne, 239, i, d)
+      CALL CHKIN2(ne, 239, i, l, flen)
+      CALL CHKST2(ne, 239, i, fn, fields(i))
+ 2390 CONTINUE
+
+C     240: GDMXLB check
+      CALL GDMXLB(d, GDLB_A)
+      CALL CHKEOK(ne, 240, d)
 
+C     241: GDLTTN check
+      l = plen
+      CALL GDLTTN(path, l, d, "linterp", 7)
+      CALL CHKEOK(ne, 241, d)
+      CALL CHKINT(ne, 241, l, plen)
+      CALL CHKEOS(ne, 241, path, 'test_dirfile'//DIRSEP//'lut')
 
 
 
@@ -3965,23 +2162,11 @@ C     Cleanup
       CALL SYSTEM ( 'rm -rf ' // fildir )
 
       IF (ne .GT. 0) THEN
-        WRITE(*, 2003) ne
+        WRITE(*, 9000) ne
         CALL EXIT(1)
       ENDIF
 
- 2001 FORMAT('e[', i3, '] = ', i4)
- 2002 FORMAT('n[', i3, '] = ', i4)
- 2003 FORMAT('ne = ', i8)
- 2004 FORMAT('c(', i3, ')[', i3, '] = ', i2)
- 2005 FORMAT('fl[', i3, '] = ', f0.16)
- 2006 FORMAT('e[', i3, ', ', i3, '] = ', i4)
- 2007 FORMAT('n[', i3, ', ', i3, '] = ', i4)
- 2008 FORMAT('fn(', i3, ')[', i3, '] = "', a, '"')
- 2009 FORMAT('s[', i3, '] = "', a, '"')
- 2010 FORMAT('p(', i3, ')[', i3, '] = ', d16.10)
- 2011 FORMAT('p(', i3, ')[', i3, '] = ', d16.10, ';', d16.10)
- 2012 FORMAT('d[', i3, '] = ', d16.10)
- 2013 FORMAT('x[', i3, '] = ', d16.10, ';', d16.10)
+ 9000 FORMAT('ne = ', i8)
 
       STOP
-      END 
+      END
diff --git a/bindings/f77/test/big_test95.f90 b/bindings/f77/test/big_test95.f90
index af28bd2..f44c375 100644
--- a/bindings/f77/test/big_test95.f90
+++ b/bindings/f77/test/big_test95.f90
@@ -1,4 +1,4 @@
-! Copyright (C) 2009-2010 D. V. Wiebe
+! Copyright (C) 2009-2012 D. V. Wiebe
 !
 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
 !
@@ -23,26 +23,193 @@
 ! General test
 !
 ! This very large test checks almost every procedure defined by the F95
-! bindings.  Procedures not tested include: fgd_copen fgd_metaflush
-! fgd_flush fgd_discard fgd_callback fgd_close
+! bindings.  Procedures not tested include: fgd_cbopen fgd_metaflush
+! fgd_flush fgd_close fgd_callback fgd_discard
 ! (although this last one is used)
 
+! check functions
+subroutine check_err(ne, t, d, v)
+  use getdata
+  integer, intent(inout) :: ne
+  integer, intent(in) :: t, d, v
+  integer :: e
+
+  e = fgd_error(d)
+
+  if (e .ne. v) then
+    ne = ne + 1
+    write(*, 9001), t, e, v
+  end if
+9001 format('e[', i0, '] = ', i0, ', expected ', i0)
+end subroutine 
+
+subroutine check_int(ne, t, n, v)
+  integer, intent(inout) :: ne
+  integer, intent(in) :: t, n, v
+
+  if (n .ne. v) then
+    ne = ne + 1
+    write(*, 9002), t, n, v
+  end if
+9002 format('n[', i0, '] = ', i0, ', expected ', i0)
+end subroutine 
+
+subroutine check_err2(ne, t, i, d, v)
+  use getdata
+  integer, intent(inout) :: ne
+  integer, intent(in) :: t, i, d, v
+  integer :: e
+
+  e = fgd_error(d)
+
+  if (e .ne. v) then
+    ne = ne + 1
+    write(*, 9006), i, t, e, v
+  end if
+9006 format('e(', i0, ')[', i0, '] = ', i0, ', expected ', i0)
+end subroutine 
+
+subroutine check_int2(ne, t, i, n, v)
+  integer, intent(inout) :: ne
+  integer, intent(in) :: t, i, n, v
+
+  if (n .ne. v) then
+    ne = ne + 1
+    write(*, 9007), i, t, n, v
+  end if
+9007 format('n(', i0, ')[', i0, '] = ', i0, ', expected ', i0)
+end subroutine 
+
+subroutine check_str2(ne, t, i, n, v)
+  integer, intent(inout) :: ne
+  integer, intent(in) :: t, i
+  character (len=*), intent(in) :: n, v
+
+  if (n .ne. v) then
+    ne = ne + 1
+    write(*, 9008), i, t, n, v
+  end if
+9008 format('s(', i0, ')[', i0, '] = "', a, '", expected "', a, '"')
+end subroutine 
+
+subroutine check_str(ne, t, n, v)
+  integer, intent(inout) :: ne
+  integer, intent(in) :: t
+  character (len=*), intent(in) :: n, v
+
+  if (n .ne. v) then
+    ne = ne + 1
+    write(*, 9009), t, n, v
+  end if
+9009 format('s[', i0, '] = "', a, '", expected "', a, '"')
+end subroutine 
+
+subroutine check_dbl2(ne, t, i, n, v)
+  integer, intent(inout) :: ne
+  integer, intent(in) :: t, i
+  double precision, intent(in) :: n, v
+
+  if (abs(n - v) .gt. 1e-5) then
+    ne = ne + 1
+    write(*, 9010), i, t, n, v
+  end if
+9010 format('r(', i0, ')[', i0, '] = ', d16.10, ', expected ', d16.10)
+end subroutine 
+
+subroutine check_cpx2(ne, t, i, n, v)
+  integer, intent(inout) :: ne
+  integer, intent(in) :: t, i
+  double complex, intent(in) :: n, v
+
+  if (abs(n - v) .gt. 1e-5) then
+    ne = ne + 1
+    write(*, 9011), i, t, real(real(n)), real(aimag(n)), &
+    real(real(v)), real(aimag(v))
+  end if
+9011 format('x(', i0, ')[', i0, '] = ', d16.10, ';', d16.10, ', expected ', &
+d16.10, ';', d16.10)
+end subroutine 
+
+subroutine check_dbl(ne, t, n, v)
+  integer, intent(inout) :: ne
+  integer, intent(in) :: t
+  double precision, intent(in) :: n, v
+
+  if (abs(n - v) .gt. 1e-5) then
+    ne = ne + 1
+    write(*, 9012), t, n, d
+  end if
+9012 format('r[', i0, '] = ', d16.10, ', expected ', d16.10)
+end subroutine 
+
+subroutine check_cpx(ne, t, n, v)
+  integer, intent(inout) :: ne
+  integer, intent(in) :: t
+  double complex, intent(in) :: n, v
+
+  if (abs(n - v) .gt. 1e-5) then
+    ne = ne + 1
+    write(*, 9013), t, n, d
+  end if
+9013 format('x[', i0, '] = ', d16.10, ';', d16.10, ', expected ', d16.10, &
+';', d16.10)
+end subroutine 
+
+subroutine check_ok(ne, t, d)
+  use getdata
+  integer, intent(inout) :: ne
+  integer, intent(in) :: t, d
+  call check_err(ne, t, d, GD_E_OK)
+end subroutine
+
+subroutine check_ok2(ne, t, i, d)
+  use getdata
+  integer, intent(inout) :: ne
+  integer, intent(in) :: t, d
+  call check_err2(ne, t, i, d, GD_E_OK)
+end subroutine
+
+subroutine check_eos(ne, t, n, v)
+  integer, intent(inout) :: ne
+  integer, intent(in) :: t
+  character (len=*), intent(in) :: n, v
+  integer :: f
+
+  f = index(n, v)
+  if (f .eq. 0) then
+    f = 1
+  end if
+
+  call check_str(ne, t, n(f:), v)
+end subroutine
+  
+
+
+
 program big_test
   use getdata
+  implicit none
+  include "test_getdata.f"
   character (len=*), parameter :: fildir = 'test95_dirfile'
   character (len=*), parameter :: frmat = 'test95_dirfile/format'
   character (len=*), parameter :: frm2 = 'test95_dirfile/form2'
   character (len=*), parameter :: dat = 'test95_dirfile/data'
-  integer, parameter :: flen = 7
-  integer, parameter :: nfields = 14
-
-  character (len=flen), dimension(nfields + 8) :: fields
-  character (len=flen), dimension(nfields + 8) :: flist
+  integer, parameter :: flen = 11
+  integer, parameter :: nfields = 17
+  integer, parameter :: slen = 26
+
+  character (len=slen), dimension(3) :: strings
+  character (len=slen), dimension(3) :: st
+  character (len=flen), dimension(nfields + 11) :: fields
+  character (len=flen), dimension(nfields + 11) :: flist
   character (len=GD_FIELD_LEN) :: str
+  character (len=4096) :: path
   integer(1), dimension(80) :: datadata
-  integer :: i, d, e, n, l, ne
+  integer :: i, d, n, l, ne
   real :: fl
   double precision :: dp
+  double complex :: dc
+  integer(8), dimension(6) :: iq
   double precision, dimension(6) :: q
   double complex, dimension(6) :: cq
   type(gd_entry) :: ent
@@ -63,10 +230,12 @@ program big_test
   call system ( 'rm -rf ' // fildir )
   call system ( 'mkdir ' // fildir )
 
-  fields =(/ 'INDEX  ', 'bit    ', 'carray ', 'const  ', 'data   ', 'div    ', &
-  'lincom ', 'linterp', 'mult   ', 'phase  ', 'polynom', 'recip  ', 'sbit   ', &
-  'string ', '       ', '       ', '       ', '       ', '       ', '       ', &
-  '       ', '       ' /)
+  fields = (/    'INDEX      ', 'alias      ', 'bit        ', 'carray     ', &
+  'const      ', 'data       ', 'div        ', 'lincom     ', 'linterp    ', &
+  'mplex      ', 'mult       ', 'phase      ', 'polynom    ', 'recip      ', &
+  'sbit       ', 'string     ', 'window     ', '           ', '           ', &
+  '           ', '           ', '           ', '           ', '           ', &
+  '           ', '           ', '           ', '           ' /)
 
   open(1, file=frmat, status='new')
   write(1, *) '/ENDIAN little'
@@ -77,14 +246,17 @@ program big_test
   write(1, *) '/META data mlut LINTERP DATA ./lut'
   write(1, *) 'const CONST FLOAT64 5.5'
   write(1, *) 'carray CARRAY FLOAT64 1.1 2.2 3.3 4.4 5.5 6.6'
-  write(1, *) 'linterp LINTERP data /look/up/file'
+  write(1, *) 'linterp LINTERP data ./lut'
   write(1, *) 'polynom POLYNOM data 1.1 2.2 2.2 3.3;4.4 const const'
   write(1, *) 'bit BIT data 3 4'
   write(1, *) 'sbit SBIT data 5 6'
+  write(1, *) 'mplex MPLEX data sbit 1 10'
   write(1, *) 'mult MULTIPLY data sbit'
   write(1, *) 'phase PHASE data 11'
   write(1, *) 'div DIVIDE mult bit'
   write(1, *) 'recip RECIP div 6.5;4.3'
+  write(1, *) 'window WINDOW linterp mult LT 4.1'
+  write(1, *) '/ALIAS alias data'
   write(1, *) 'string STRING "Zaphod Beeblebrox"'
   close(1, status='keep')
 
@@ -97,405 +269,167 @@ program big_test
   write(1, rec=1) datadata
   close(1, status='keep')
 
+  ne = 0
+
 ! fgd_error check
   d = fgd_open('x', GD_RDONLY)
-  e = fgd_error(d)
-
-  ne = 0
-  if (e .ne. GD_E_OPEN) then
-    ne = ne + 1
-    write(*, 2001), 0, e
-  end if
+  call check_err(ne, 0, d, GD_E_OPEN)
+  call fgd_discard(d)
 
 ! 1: fgd_open check
   d = fgd_open(fildir, GD_RDWR)
-  e = fgd_error(d)
-
-  if (e .ne. GD_E_OK) then
-    ne = ne + 1
-    write(*, 2001) 1, e
-  end if
+  call check_ok(ne, 1, d)
 
 ! 2: fgd_getdata_i1 check
   n = fgd_getdata_i1(d, 'data', 5, 0, 1, 0, ci1)
-  e = fgd_error(d)
-
-  if (e .ne. GD_E_OK) then
-    ne = ne + 1
-    write(*, 2001) 2, e
-  end if
-
-  if (n .ne. 8) then
-    ne = ne + 1
-    write(*, 2002) 2, n
-  end if
+  call check_ok(ne, 2, d)
+  call check_int(ne, 2, n, 8)
 
   do i=1,8
-  if (ci1(i) .ne. 40 + i) then
-    ne = ne + 1
-    write(*, 2004) i, 2, ci1(i)
-  end if
+  call check_int2(ne, 2, i, int(ci1(i)), 40 + i)
   end do 
 
 ! 102: fgd_getdata_i2 check
   n = fgd_getdata_i2(d, 'data', 5, 0, 1, 0, ci2)
-  e = fgd_error(d)
-
-  if (e .ne. GD_E_OK) then
-    ne = ne + 1
-    write(*, 2001) 102, e
-  end if
-
-  if (n .ne. 8) then
-    ne = ne + 1
-    write(*, 2002) 102, n
-  end if
+  call check_ok(ne, 102, d)
+  call check_int(ne, 102, n, 8)
 
   do i=1,8
-  if (ci2(i) .ne. 40 + i) then
-    ne = ne + 1
-    write(*, 2004) i, 102, ci2(i)
-  end if
+  call check_int2(ne, 102, i, int(ci2(i)), 40 + i)
   end do 
 
 ! 103: fgd_getdata_i4 check
   n = fgd_getdata_i4(d, 'data', 5, 0, 1, 0, ci4)
-  e = fgd_error(d)
-
-  if (e .ne. GD_E_OK) then
-    ne = ne + 1
-    write(*, 2001) 103, e
-  end if
-
-  if (n .ne. 8) then
-    ne = ne + 1
-    write(*, 2002) 103, n
-  end if
+  call check_ok(ne, 103, d)
+  call check_int(ne, 103, n, 8)
 
   do i=1,8
-  if (ci4(i) .ne. 40 + i) then
-    ne = ne + 1
-    write(*, 2004) i, 103, ci4(i)
-  end if
+  call check_int2(ne, 103, i, int(ci4(i)), 40 + i)
   end do 
 
 ! 104: fgd_getdata_i8 check
   n = fgd_getdata_i8(d, 'data', 5, 0, 1, 0, ci8)
-  e = fgd_error(d)
-
-  if (e .ne. GD_E_OK) then
-    ne = ne + 1
-    write(*, 2001) 104, e
-  end if
-
-  if (n .ne. 8) then
-    ne = ne + 1
-    write(*, 2002) 104, n
-  end if
+  call check_ok(ne, 104, d)
+  call check_int(ne, 104, n, 8)
 
   do i=1,8
-  if (ci8(i) .ne. 40 + i) then
-    ne = ne + 1
-    write(*, 2004) i, 104, ci8(i)
-  end if
+  call check_int2(ne, 104, i, int(ci8(i)), 40 + i)
   end do 
 
 ! 105: fgd_getdata_r4 check
   n = fgd_getdata_r4(d, 'data', 5, 0, 1, 0, cr4)
-  e = fgd_error(d)
-
-  if (e .ne. GD_E_OK) then
-    ne = ne + 1
-    write(*, 2001) 105, e
-  end if
-
-  if (n .ne. 8) then
-    ne = ne + 1
-    write(*, 2002) 105, n
-  end if
+  call check_ok(ne, 105, d)
+  call check_int(ne, 105, n, 8)
 
   do i=1,8
-  if (abs(cr4(i) - 40 - i) .gt. 1e-5) then
-    ne = ne + 1
-    write(*, 2010) i, 105, cr4(i)
-  end if
+  call check_dbl2(ne, 105, i, 1d0 * cr4(i), 40d0 + i)
   end do 
 
 ! 106: fgd_getdata_r8 check
   n = fgd_getdata_r8(d, 'data', 5, 0, 1, 0, cr8)
-  e = fgd_error(d)
-
-  if (e .ne. GD_E_OK) then
-    ne = ne + 1
-    write(*, 2001) 106, e
-  end if
-
-  if (n .ne. 8) then
-    ne = ne + 1
-    write(*, 2002) 106, n
-  end if
+  call check_ok(ne, 106, d)
+  call check_int(ne, 106, n, 8)
 
   do i=1,8
-  if (abs(cr8(i) - 40 - i) .gt. 1e-5) then
-    ne = ne + 1
-    write(*, 2010) i, 106, cr8(i)
-  end if
+  call check_dbl2(ne, 106, i, cr8(i), 40d0 + i)
   end do 
 
 ! 107: fgd_getdata_c8 check
   n = fgd_getdata_c8(d, 'data', 5, 0, 1, 0, cc8)
-  e = fgd_error(d)
-
-  if (e .ne. GD_E_OK) then
-    ne = ne + 1
-    write(*, 2001) 107, e
-  end if
-
-  if (n .ne. 8) then
-    ne = ne + 1
-    write(*, 2002) 107, n
-  end if
+  call check_ok(ne, 107, d)
+  call check_int(ne, 107, n, 8)
 
   do i=1,8
-  if (abs(cc8(i) - 40 - i) .gt. 1e-5) then
-    ne = ne + 1
-    write(*, 2011) i, 107, real(real(cc8(i))), real(aimag(cc8(i)))
-  end if
+  call check_cpx2(ne, 107, i, 1d0 * cc8(i), dcmplx(40 + i, 0))
   end do 
 
 ! 108: fgd_getdata_c16 check
   n = fgd_getdata_c16(d, 'data', 5, 0, 1, 0, cc16)
-  e = fgd_error(d)
-
-  if (e .ne. GD_E_OK) then
-    ne = ne + 1
-    write(*, 2001) 108, e
-  end if
-
-  if (n .ne. 8) then
-    ne = ne + 1
-    write(*, 2002) 108, n
-  end if
+  call check_ok(ne, 108, d)
+  call check_int(ne, 108, n, 8)
 
   do i=1,8
-  if (abs(cc16(i) - 40 - i) .gt. 1e-5) then
-    ne = ne + 1
-    write(*, 2011) i, 107, real(real(cc16(i))), real(aimag(cc16(i)))
-  end if
+  call check_cpx2(ne, 108, i, cc16(i), dcmplx(40 + i, 0))
   end do 
 
 ! 109: fgd_getdata_n check
   n = fgd_getdata_n(d, 'data', 5, 0, 1, 0)
-  e = fgd_error(d)
-
-  if (e .ne. GD_E_OK) then
-    ne = ne + 1
-    write(*, 2001) 109, e
-  end if
-
-  if (n .ne. 8) then
-    ne = ne + 1
-    write(*, 2002) 109, n
-  end if
+  call check_ok(ne, 109, d)
+  call check_int(ne, 109, n, 8)
 
 ! 3: fgd_get_constant_i1 check
   call fgd_get_constant_i1(d, 'const', ci1(1))
-  e = fgd_error(d)
-
-  if (e .ne. GD_E_OK) then
-    ne = ne + 1
-    write(*, 2001) 3, e
-  end if
-
-  if (ci1(1) .ne. 5) then
-    ne = ne + 1
-    write(*, 2002) 3, ci1(1)
-  end if
+  call check_ok(ne, 3, d)
+  call check_int(ne, 3, int(ci1(1)), 5)
 
 ! 110: fgd_get_constant_i2 check
   call fgd_get_constant_i2(d, 'const', ci2(1))
-  e = fgd_error(d)
-
-  if (e .ne. GD_E_OK) then
-    ne = ne + 1
-    write(*, 2001) 110, e
-  end if
-
-  if (ci2(1) .ne. 5) then
-    ne = ne + 1
-    write(*, 2002) 110, ci2(1)
-  end if
+  call check_ok(ne, 110, d)
+  call check_int(ne, 110, int(ci2(1)), 5)
 
 ! 111: fgd_get_constant_i4 check
   call fgd_get_constant_i4(d, 'const', ci4(1))
-  e = fgd_error(d)
-
-  if (e .ne. GD_E_OK) then
-    ne = ne + 1
-    write(*, 2001) 111, e
-  end if
-
-  if (ci4(1) .ne. 5) then
-    ne = ne + 1
-    write(*, 2002) 111, ci4(1)
-  end if
+  call check_ok(ne, 111, d)
+  call check_int(ne, 111, ci4(1), 5)
 
 ! 112: fgd_get_constant_i8 check
   call fgd_get_constant_i8(d, 'const', ci8(1))
-  e = fgd_error(d)
-
-  if (e .ne. GD_E_OK) then
-    ne = ne + 1
-    write(*, 2001) 112, e
-  end if
-
-  if (ci8(1) .ne. 5) then
-    ne = ne + 1
-    write(*, 2002) 112, ci8(1)
-  end if
+  call check_ok(ne, 112, d)
+  call check_int(ne, 112, int(ci8(1)), 5)
 
 ! 113: fgd_get_constant_r4 check
   call fgd_get_constant_r4(d, 'const', cr4(1))
-  e = fgd_error(d)
-
-  if (e .ne. GD_E_OK) then
-    ne = ne + 1
-    write(*, 2001) 113, e
-  end if
-
-  if (abs(cr4(1) - 5.5) .gt. 1e-5) then
-    ne = ne + 1
-    write(*, 2005) 113, cr4(1)
-  end if
+  call check_ok(ne, 113, d)
+  call check_dbl(ne, 113, 1d0 * cr4(1), 5.5d0)
 
 ! 114: fgd_get_constant_r8 check
   call fgd_get_constant_r8(d, 'const', cr8(1))
-  e = fgd_error(d)
-
-  if (e .ne. GD_E_OK) then
-    ne = ne + 1
-    write(*, 2001) 114, e
-  end if
-
-  if (abs(cr8(1) - 5.5) .gt. 1e-5) then
-    ne = ne + 1
-    write(*, 2012) 114, cr8(1)
-  end if
+  call check_ok(ne, 114, d)
+  call check_dbl(ne, 114, cr8(1), 5.5d0)
 
 ! 115: fgd_get_constant_c8 check
   call fgd_get_constant_c8(d, 'const', cc8(1))
-  e = fgd_error(d)
-
-  if (e .ne. GD_E_OK) then
-    ne = ne + 1
-    write(*, 2001) 115, e
-  end if
-
-  if (abs(cc8(1) - 5.5) .gt. 1e-5) then
-    ne = ne + 1
-    write(*, 2013) 115, real(real(cc8(i))), real(aimag(cc8(i)))
-  end if
+  call check_ok(ne, 115, d)
+  call check_cpx(ne, 115, 1d0 * cc8(1), dcmplx(5.5, 0))
 
 ! 116: fgd_get_constant_c16 check
   call fgd_get_constant_c16(d, 'const', cc16(1))
-  e = fgd_error(d)
-
-  if (e .ne. GD_E_OK) then
-    ne = ne + 1
-    write(*, 2001) 116, e
-  end if
-
-  if (abs(cc16(1) - 5.5) .gt. 1e-5) then
-    ne = ne + 1
-    write(*, 2013) 116, real(real(cc16(i))), real(aimag(cc16(i)))
-  end if
+  call check_ok(ne, 116, d)
+  call check_cpx(ne, 116, cc16(1), dcmplx(5.5, 0))
 
 ! 117: fgd_get_constant_n check
   call fgd_get_constant_n(d, 'const')
-  e = fgd_error(d)
-
-  if (e .ne. GD_E_OK) then
-    ne = ne + 1
-    write(*, 2001) 117, e
-  end if
+  call check_ok(ne, 117, d)
 
 ! 4: fgd_field_name_max check
   i = fgd_field_name_max(d)
-  e = fgd_error(d)
-
-  if (e .ne. GD_E_OK) then
-    ne = ne + 1
-    write(*, 2001) 4, e
-  end if
-
-  if (i .ne. flen) then
-    ne = ne + 1
-    write(*, 2002) 4, i
-  end if
+  call check_ok(ne, 4, d)
+  call check_int(ne, 4, i, 7)
 
 ! 5: fgd_mfield_name_max check
   i = fgd_mfield_name_max(d, 'data')
-  e = fgd_error(d)
-
-  if (e .ne. GD_E_OK) then
-    ne = ne + 1
-    write(*, 2001) 5, e
-  end if
-
-  if (i .ne. 6) then
-    ne = ne + 1
-    write(*, 2002) 5, i
-  end if
+  call check_ok(ne, 5, d)
+  call check_int(ne, 5, i, 6)
 
 ! 6: fgd_nfields check
   n = fgd_nfields(d)
-  e = fgd_error(d)
-
-  if (e .ne. GD_E_OK) then
-    ne = ne + 1
-    write(*, 2001) 6, e
-  end if
-
-  if (n .ne. nfields) then
-    ne = ne + 1
-    write(*, 2002) 6, n
-  end if
+  call check_ok(ne, 6, d)
+  call check_int(ne, 6, n, nfields)
 
 ! 8: fgd_field_list check
   l = flen
   call fgd_field_list(flist, d, l)
-  e = fgd_error(d)
-
-  if (e .ne. GD_E_OK) then
-    ne = ne + 1
-    write(*, 2001) 8, e
-  end if
-
-  if (l .ne. flen) then
-    ne = ne + 1
-    write(*, 2002) 8, l
-  end if
+  call check_ok(ne, 8, d)
+  call check_int(ne, 8, l, flen)
 
   do i = 1, n
-  if (flist(i) .ne. fields(i)) then
-    ne = ne + 1
-    write(*, 2008) i, 8, flist(i)
-  end if
+  call check_str2(ne, 8, i, flist(i), fields(i))
   end do
 
 ! 9: fgd_nmfields check
   n = fgd_nmfields(d, 'data')
-  e = fgd_error(d)
-
-  if (e .ne. GD_E_OK) then
-    ne = ne + 1
-    write(*, 2001) 9, e
-  end if
-
-  if (n .ne. 3) then
-    ne = ne + 1
-    write(*, 2002) 9, n
-  end if
+  call check_ok(ne, 9, d)
+  call check_int(ne, 9, n, 3)
 
 ! 10: fgd_mfield_list check
   fields(1) = 'mstr'
@@ -504,358 +438,189 @@ program big_test
 
   l = flen
   call fgd_mfield_list(flist, d, 'data', l)
-  e = fgd_error(d)
-
-  if (e .ne. GD_E_OK) then
-    ne = ne + 1
-    write(*, 2006) 10, i, e
-  end if
-
-  if (l .ne. flen) then
-    ne = ne + 1
-    write(*, 2007) 10, i, l
-  end if
+  call check_ok2(ne, 10, i, d)
+  call check_int2(ne, 10, i, l, flen)
 
   DO i = 1, n
-  if (flist(i) .ne. fields(i)) then
-    ne = ne + 1
-    write(*, 2008) i, 10, flist(i)
-  end if
+  call check_str2(ne, 10, i, flist(i), fields(i))
   end do
 
 ! 11: fgd_nframes check
   n = fgd_nframes(d)
-  e = fgd_error(d)
-
-  if (e .ne. GD_E_OK) then
-    ne = ne + 1
-    write(*, 2001) 11, e
-  end if
-
-  if (n .ne. 10) then
-    ne = ne + 1
-    write(*, 2002) 11, n
-  end if
+  call check_ok(ne, 11, d)
+  call check_int(ne, 11, n, 10)
 
 ! 12: fgd_spf check
   n = fgd_spf(d, 'data')
-  e = fgd_error(d)
-
-  if (e .ne. GD_E_OK) then
-    ne = ne + 1
-    write(*, 2001) 12, e
-  end if
-
-  if (n .ne. 8) then
-    ne = ne + 1
-    write(*, 2002) 12, n
-  end if
+  call check_ok(ne, 12, d)
+  call check_int(ne, 12, n, 8)
 
 ! 13: fgd_putdata_i1 check
-  ci1 = (/ 13_1, 14_1, 15_1, 16_1, 17_1, 18_1, 19_1, 20_1 /)
+  ci1 = (/ 13_1, 14_1, 15_1, 16_1, 17_1, 18_1, 19_1, 90_1 /)
   n = fgd_putdata_i1(d, 'data', 5, 1, 0, 4, ci1)
-  e = fgd_error(d)
-
-  if (e .ne. GD_E_OK) then
-    ne = ne + 1
-    write(*, 2001) 13, e
-  end if
-
-  if (n .ne. 4) then
-    ne = ne + 1
-    write(*, 2002) 13, n
-  end if
+  call check_ok(ne, 13, d)
+  call check_int(ne, 13, n, 4)
 
   n = fgd_getdata_i1(d, 'data', 5, 0, 1, 0, ci1)
 
   DO i = 1, 8
-  if (((i .EQ. 1 .OR. i .GT. 5) .AND. ci1(i) .ne. 40 + i) .OR. &
-  (i .GT. 1 .AND. i .LT. 6) .AND. ci1(i) .ne. 11 + i) then
-    ne = ne + 1
-    write(*, 2004) i, 13, ci1(i)
-  end if
+  if (i .eq. 1 .or. i .gt. 5) then
+    n = 40 + i
+  else
+    n = 11 + i
+  endif
+  call check_int2(ne, 13, i, int(ci1(i)), n)
   end do
 
 ! 118: fgd_putdata_i2 check
   ci2 = (/ 23_2, 24_2, 25_2, 26_2, 27_2, 28_2, 29_2, 30_2 /)
   n = fgd_putdata_i2(d, 'data', 5, 1, 0, 4, ci2)
-  e = fgd_error(d)
-
-  if (e .ne. GD_E_OK) then
-    ne = ne + 1
-    write(*, 2001) 118, e
-  end if
-
-  if (n .ne. 4) then
-    ne = ne + 1
-    write(*, 2002) 118, n
-  end if
+  call check_ok(ne, 118, d)
+  call check_int(ne, 118, n, 4)
 
   n = fgd_getdata_i2(d, 'data', 5, 0, 1, 0, ci2)
 
   DO i = 1, 8
-  if (((i .EQ. 1 .OR. i .GT. 5) .AND. ci2(i) .ne. 40 + i) .OR. &
-  (i .GT. 1 .AND. i .LT. 6) .AND. ci2(i) .ne. 21 + i) then
-    ne = ne + 1
-    write(*, 2004) i, 118, ci2(i)
-  end if
+  if (i .eq. 1 .or. i .gt. 5) then
+    n = 40 + i
+  else
+    n = 21 + i
+  endif
+  call check_int2(ne, 118, i, int(ci2(i)), n)
   end do
 
 ! 119: fgd_putdata_i4 check
   ci4 = (/ 33, 34, 35, 36, 37, 38, 39, 40 /)
   n = fgd_putdata_i4(d, 'data', 5, 1, 0, 4, ci4)
-  e = fgd_error(d)
-
-  if (e .ne. GD_E_OK) then
-    ne = ne + 1
-    write(*, 2001) 119, e
-  end if
-
-  if (n .ne. 4) then
-    ne = ne + 1
-    write(*, 2002) 119, n
-  end if
+  call check_ok(ne, 119, d)
+  call check_int(ne, 119, n, 4)
 
   n = fgd_getdata_i4(d, 'data', 5, 0, 1, 0, ci4)
 
   DO i = 1, 8
-  if (((i .EQ. 1 .OR. i .GT. 5) .AND. ci4(i) .ne. 40 + i) .OR. &
-  (i .GT. 1 .AND. i .LT. 6) .AND. ci4(i) .ne. 31 + i) then
-    ne = ne + 1
-    write(*, 2004) i, 119, ci4(i)
-  end if
+  if (i .eq. 1 .or. i .gt. 5) then
+    n = 40 + i
+  else
+    n = 31 + i
+  endif
+  call check_int2(ne, 119, i, int(ci4(i)), n)
   end do
 
 ! 120: fgd_putdata_i8 check
   ci8 = (/ 43, 44, 45, 46, 47, 48, 49, 50 /)
   n = fgd_putdata_i8(d, 'data', 5, 1, 0, 4, ci8)
-  e = fgd_error(d)
-
-  if (e .ne. GD_E_OK) then
-    ne = ne + 1
-    write(*, 2001) 120, e
-  end if
-
-  if (n .ne. 4) then
-    ne = ne + 1
-    write(*, 2002) 120, n
-  end if
+  call check_ok(ne, 120, d)
+  call check_int(ne, 120, n, 4)
 
   n = fgd_getdata_i8(d, 'data', 5, 0, 1, 0, ci8)
 
   DO i = 1, 8
-  if (((i .EQ. 1 .OR. i .GT. 5) .AND. ci8(i) .ne. 40 + i) .OR. &
-  (i .GT. 1 .AND. i .LT. 6) .AND. ci8(i) .ne. 41 + i) then
-    ne = ne + 1
-    write(*, 2004) i, 120, ci8(i)
-  end if
+  if (i .eq. 1 .or. i .gt. 5) then
+    n = 40 + i
+  else
+    n = 41 + i
+  endif
+  call check_int2(ne, 120, i, int(ci8(i)), n)
   end do
 
 ! 121: fgd_putdata_r4 check
   cr4 = (/ 33, 34, 35, 36, 37, 38, 39, 40 /)
   n = fgd_putdata_r4(d, 'data', 5, 1, 0, 4, cr4)
-  e = fgd_error(d)
-
-  if (e .ne. GD_E_OK) then
-    ne = ne + 1
-    write(*, 2001) 121, e
-  end if
-
-  if (n .ne. 4) then
-    ne = ne + 1
-    write(*, 2002) 121, n
-  end if
+  call check_ok(ne, 121, d)
+  call check_int(ne, 121, n, 4)
 
   n = fgd_getdata_r4(d, 'data', 5, 0, 1, 0, cr4)
 
   DO i = 1, 8
-  if (((i .EQ. 1 .OR. i .GT. 5) .AND. abs(cr4(i) - 40 - i) .gt. 1e-5) .OR. &
-  (i .GT. 1 .AND. i .LT. 6) .AND. abs(cr4(i) - 31 - i) .gt. 1e-5) then
-    ne = ne + 1
-    write(*, 2010) i, 121, cr4(i)
+  if (i .eq. 1 .or. i .gt. 5) then
+    dp = 40. + i
+  else
+    dp = 31. + i
   end if
+  call check_dbl2(ne, 121, i, 1d0 * cr4(i), dp)
   end do
 
 ! 122: fgd_putdata_r8 check
   cr8 = (/ 43, 44, 45, 46, 47, 48, 49, 50 /)
   n = fgd_putdata_r8(d, 'data', 5, 1, 0, 4, cr8)
-  e = fgd_error(d)
-
-  if (e .ne. GD_E_OK) then
-    ne = ne + 1
-    write(*, 2001) 122, e
-  end if
-
-  if (n .ne. 4) then
-    ne = ne + 1
-    write(*, 2002) 122, n
-  end if
+  call check_ok(ne, 122, d)
+  call check_int(ne, 122, n, 4)
 
   n = fgd_getdata_r8(d, 'data', 5, 0, 1, 0, cr8)
 
   DO i = 1, 8
-  if (((i .EQ. 1 .OR. i .GT. 5) .AND. abs(cr8(i) - 40 - i) .gt. 1e-5) .OR. &
-  (i .GT. 1 .AND. i .LT. 6) .AND. abs(cr8(i) - 41 - i) .gt. 1e-5) then
-    ne = ne + 1
-    write(*, 2010) i, 122, cr8(i)
+  if (i .eq. 1 .or. i .gt. 5) then
+    dp = 40. + i
+  else
+    dp = 41. + i
   end if
+  call check_dbl2(ne, 122, i, cr8(i), dp)
   end do
 
 ! 123: fgd_putdata_c8 check
   cc8 = (/ 53, 54, 55, 56, 57, 58, 59, 60 /)
   n = fgd_putdata_c8(d, 'data', 5, 1, 0, 4, cc8)
-  e = fgd_error(d)
-
-  if (e .ne. GD_E_OK) then
-    ne = ne + 1
-    write(*, 2001) 123, e
-  end if
-
-  if (n .ne. 4) then
-    ne = ne + 1
-    write(*, 2002) 123, n
-  end if
+  call check_ok(ne, 123, d)
+  call check_int(ne, 123, n, 4)
 
   n = fgd_getdata_c8(d, 'data', 5, 0, 1, 0, cc8)
 
   DO i = 1, 8
-  if (((i .EQ. 1 .OR. i .GT. 5) .AND. abs(cc8(i) - 40 - i) .gt. 1e-5) .OR. &
-  (i .GT. 1 .AND. i .LT. 6) .AND. abs(cc8(i) - 51 - i) .gt. 1e-5) then
-    ne = ne + 1
-    write(*, 2011) i, 123, real(real(cc8(i))), real(aimag(cc8(i)))
+  if (i .eq. 1 .or. i .gt. 5) then
+    dc = dcmplx(40d0 + i, 0d0)
+  else
+    dc = dcmplx(51d0 + i, 0d0)
   end if
+  call check_cpx2(ne, 123, i, 1d0 * cc8(i), dc)
   end do
 
 ! 124: fgd_putdata_c16 check
   cc16 = (/ 63, 64, 65, 66, 67, 68, 69, 70 /)
   n = fgd_putdata_c16(d, 'data', 5, 1, 0, 4, cc16)
-  e = fgd_error(d)
-
-  if (e .ne. GD_E_OK) then
-    ne = ne + 1
-    write(*, 2001) 124, e
-  end if
-
-  if (n .ne. 4) then
-    ne = ne + 1
-    write(*, 2002) 124, n
-  end if
+  call check_ok(ne, 124, d)
+  call check_int(ne, 124, n, 4)
 
   n = fgd_getdata_c16(d, 'data', 5, 0, 1, 0, cc16)
 
   DO i = 1, 8
-  if (((i .EQ. 1 .OR. i .GT. 5) .AND. abs(cc16(i) - 40 - i) .gt. 1e-5) .OR. &
-  (i .GT. 1 .AND. i .LT. 6) .AND. abs(cc16(i) - 61 - i) .gt. 1e-5) then
-    ne = ne + 1
-    write(*, 2011) i, 124, real(real(cc16(i))), real(aimag(cc16(i)))
+  if (i .eq. 1 .or. i .gt. 5) then
+    dc = dcmplx(40d0 + i, 0d0)
+  else
+    dc = dcmplx(61d0 + i, 0d0)
   end if
+  call check_cpx2(ne, 124, i, cc16(i), dc)
   end do
 
 ! 14: fgd_error_string check
   n = fgd_getdata_n(d, 'x', 5, 0, 1, 0)
   call fgd_error_string(d, str, GD_FIELD_LEN)
-
-  if (str .ne. 'Field not found: x') then
-    ne = ne + 1
-    write(*, 2009) 14, str
-  end if
+  call check_str(ne, 14, str, 'Field not found: x')
 
 ! 15: fgd_entry_type check
   n = fgd_entry_type(d, 'data')
-  e = fgd_error(d)
-
-  if (e .ne. GD_E_OK) then
-    ne = ne + 1
-    write(*, 2001) 15, e
-  end if
-
-  if (n .ne. GD_RAW_ENTRY) then
-    ne = ne + 1
-    write(*, 2002) 15, n
-  end if
+  call check_ok(ne, 15, d)
+  call check_int(ne, 15, n, GD_RAW_ENTRY)
 
 ! 16: fgd_entry (raw) check
   n = fgd_entry(d, 'data', ent)
-  e = fgd_error(d)
-
-  if (e .ne. GD_E_OK) then
-    ne = ne + 1
-    write(*, 2001) 16, e
-  end if
-
-  if (n .ne. GD_RAW_ENTRY) then
-    ne = ne + 1
-    write(*, 2007) 16, 1, n
-  end if
-
-  if (ent%fragment_index .ne. 0) then
-    ne = ne + 1
-    write(*, 2007) 16, 2, ent%fragment_index
-  end if
-
-  if (ent%spf .ne. 8) then
-    ne = ne + 1
-    write(*, 2007) 16, 3, ent%spf
-  end if
-
-  if (ent%data_type .ne. GD_INT8) then
-    ne = ne + 1
-    write(*, 2007) 16, 4, ent%data_type
-  end if
+  call check_ok(ne, 16, d)
+  call check_int2(ne, 16, 1, n, GD_RAW_ENTRY)
+  call check_int2(ne, 16, 2, ent%fragment_index, 0)
+  call check_int2(ne, 16, 3, ent%spf, 8)
+  call check_int2(ne, 16, 4, ent%data_type, GD_INT8)
 
 ! 18: fgd_entry (lincom) check
   n = fgd_entry(d, 'lincom', ent)
-  e = fgd_error(d)
-
-  if (e .ne. GD_E_OK) then
-    ne = ne + 1
-    write(*, 2001) 18, e
-  end if
-
-  if (n .ne. GD_LINCOM_ENTRY) then
-    ne = ne + 1
-    write(*, 2007) 18, 1, n
-  end if
-
-  if (ent%n_fields .ne. 3) then
-    ne = ne + 1
-    write(*, 2007) 18, 2, ent%n_fields
-  end if
-
-  if (ent%fragment_index .ne. 0) then
-    ne = ne + 1
-    write(*, 2007) 18, 3, ent%fragment_index
-  end if
-
-  if (ent%field(1) .ne. 'data') then
-    ne = ne + 1
-    write(*, 2008) 18, 4, ent%field(1)
-  end if
-
-  if (ent%field(2) .ne. 'INDEX') then
-    ne = ne + 1
-    write(*, 2008) 18, 5, ent%field(2)
-  end if
-
-  if (ent%field(3) .ne. 'linterp') then
-    ne = ne + 1
-    write(*, 2008) 18, 6, ent%field(3)
-  end if
-
-  if (ent%comp_scal .ne. 1) then
-    ne = ne + 1
-    write(*, 2007) 18, 7, ent%comp_scal
-  end if
-
-  if (ent%scalar(3) .ne. 'const') then
-    ne = ne + 1
-    write(*, 2008) 18, 8, ent%scalar(3)
-  end if
-
-  if (ent%scalar(6) .ne. 'const') then
-    ne = ne + 1
-    write(*, 2008) 18, 9, ent%scalar(6)
-  end if
+  call check_ok(ne, 18, d)
+  call check_int2(ne, 18, 1, n, GD_LINCOM_ENTRY)
+  call check_int2(ne, 18, 2, ent%n_fields, 3)
+  call check_int2(ne, 18, 3, ent%fragment_index, 0)
+  call check_str2(ne, 18, 4, ent%field(1), 'data')
+  call check_str2(ne, 18, 5, ent%field(2), 'INDEX')
+  call check_str2(ne, 18, 6, ent%field(3), 'linterp')
+  call check_int2(ne, 18, 7, ent%comp_scal, 1)
+  call check_str2(ne, 18, 8, ent%scalar(3), 'const')
+  call check_str2(ne, 18, 9, ent%scalar(6), 'const')
 
   cq(1) = dcmplx(1.1, 0.0)
   cq(2) = dcmplx(2.2, 0.0)
@@ -864,44 +629,17 @@ program big_test
   cq(5) = dcmplx(5.5, 0.0)
   cq(6) = dcmplx(5.5, 0.0)
   DO i=1,3
-  if (abs(ent%cm(i) - cq(i * 2 - 1)) > 0.001) then
-    ne = ne + 1
-    write(*, 2010) i * 2 - 1, 18, ent%m(i)
-  end if
-  if (abs(ent%cb(i) - cq(i * 2)) > 0.001) then
-    ne = ne + 1
-    write(*, 2010) i * 2, 18, ent%b(i)
-  end if
+  call check_cpx2(ne, 18, i * 2 - 1, ent%cm(i), cq(i * 2 - 1))
+  call check_cpx2(ne, 18, i * 2, ent%cb(i), cq(i * 2))
   end do
 
 ! 20: fgd_entry (polynom) check
   n = fgd_entry(d, 'polynom', ent)
-  e = fgd_error(d)
-
-  if (e .ne. GD_E_OK) then
-    ne = ne + 1
-    write(*, 2001) 20, e
-  end if
-
-  if (n .ne. GD_POLYNOM_ENTRY) then
-    ne = ne + 1
-    write(*, 2007) 20, 1, n
-  end if
-
-  if (ent%poly_ord .ne. 5) then
-    ne = ne + 1
-    write(*, 2007) 20, 2, ent%n_fields
-  end if
-
-  if (ent%fragment_index .ne. 0) then
-    ne = ne + 1
-    write(*, 2007) 20, 3, ent%fragment_index
-  end if
-
-  if (ent%field(1) .ne. 'data') then
-    ne = ne + 1
-    write(*, 2008) 20, 4, ent%field(1)
-  end if
+  call check_ok(ne, 20, d)
+  call check_int2(ne, 20, 1, n, GD_POLYNOM_ENTRY)
+  call check_int2(ne, 20, 2, ent%poly_ord, 5)
+  call check_int2(ne, 20, 3, ent%fragment_index, 0)
+  call check_str2(ne, 20, 4, ent%field(1), 'data')
 
   cq(1) = dcmplx(1.1, 0.0)
   cq(2) = dcmplx(2.2, 0.0)
@@ -910,3862 +648,1925 @@ program big_test
   cq(5) = dcmplx(5.5, 0.0)
   cq(6) = dcmplx(5.5, 0.0)
   DO i=1,6
-  if (abs(ent%ca(i) - cq(i)) > 0.001) then
-    ne = ne + 1
-    write(*, 2011) i, 30, real(real(ent%ca(i))), real(aimag(ent%ca(i)))
-  end if
+  call check_cpx2(ne, 30, i, ent%ca(i), cq(i))
   end do
 
 ! 21: fgd_entry (linterp) check
   n = fgd_entry(d, 'linterp', ent)
-  e = fgd_error(d)
-
-  if (e .ne. GD_E_OK) then
-    ne = ne + 1
-    write(*, 2001) 21, e
-  end if
-
-  if (n .ne. GD_LINTERP_ENTRY) then
-    ne = ne + 1
-    write(*, 2007) 21, 1, n
-  end if
-
-  if (ent%fragment_index .ne. 0) then
-    ne = ne + 1
-    write(*, 2007) 21, 2, ent%fragment_index
-  end if
-
-  if (ent%field(1) .ne. 'data') then
-    ne = ne + 1
-    write(*, 2008) 21, 3, ent%field(1)
-  end if
-
-  if (ent%field(2) .ne. '/look/up/file') then
-    ne = ne + 1
-    write(*, 2008) 21, 4, ent%field(2)
-  end if
+  call check_ok(ne, 21, d)
+  call check_int2(ne, 21, 1, n, GD_LINTERP_ENTRY)
+  call check_int2(ne, 21, 2, ent%fragment_index, 0)
+  call check_str2(ne, 21, 3, ent%field(1), 'data')
+  call check_str2(ne, 21, 4, ent%field(2), './lut')
 
 ! 22: fgd_entry (bit) check
   n = fgd_entry(d, 'bit', ent)
-  e = fgd_error(d)
-
-  if (e .ne. GD_E_OK) then
-    ne = ne + 1
-    write(*, 2001) 22, e
-  end if
+  call check_ok(ne, 22, d)
+  call check_int2(ne, 22, 1, n, GD_BIT_ENTRY)
+  call check_int2(ne, 22, 2, ent%fragment_index, 0)
+  call check_int2(ne, 22, 3, ent%bitnum, 3)
+  call check_int2(ne, 22, 4, ent%numbits, 4)
+  call check_str2(ne, 22, 5, ent%field(1), 'data')
 
-  if (n .ne. GD_BIT_ENTRY) then
-    ne = ne + 1
-    write(*, 2007) 22, 1, n
-  end if
+! 23: fgd_entry (Sbit) check
+  n = fgd_entry(d, 'sbit', ent)
+  call check_ok(ne, 23, d)
+  call check_int2(ne, 23, 1, n, GD_SBIT_ENTRY)
+  call check_int2(ne, 23, 2, ent%fragment_index, 0)
+  call check_int2(ne, 23, 3, ent%numbits, 6)
+  call check_int2(ne, 23, 4, ent%bitnum, 5)
+  call check_str2(ne, 23, 5, ent%field(1), 'data')
 
-  if (ent%fragment_index .ne. 0) then
-    ne = ne + 1
-    write(*, 2007) 22, 2, ent%fragment_index
-  end if
+! 24: fgd_entry (multiply) check
+  n = fgd_entry(d, 'mult', ent)
+  call check_ok(ne, 24, d)
+  call check_int2(ne, 24, 1, n, GD_MULTIPLY_ENTRY)
+  call check_int2(ne, 24, 2, ent%fragment_index, 0)
+  call check_str2(ne, 24, 3, ent%field(1), 'data')
+  call check_str2(ne, 24, 4, ent%field(2), 'sbit')
 
-  if (ent%bitnum .ne. 3) then
-    ne = ne + 1
-    write(*, 2007) 22, 3, ent%bitnum
-  end if
+! 25: fgd_entry (phase) check
+  n = fgd_entry(d, 'phase', ent)
+  call check_ok(ne, 25, d)
+  call check_int2(ne, 25, 1, n, GD_PHASE_ENTRY)
+  call check_int2(ne, 25, 2, ent%fragment_index, 0)
+  call check_int2(ne, 25, 3, ent%shift, 11)
+  call check_str2(ne, 25, 4, ent%field(1), 'data')
 
-  if (ent%numbits .ne. 4) then
-    ne = ne + 1
-    write(*, 2007) 22, 4, ent%numbits
-  end if
+! 26: fgd_entry (const) check
+  n = fgd_entry(d, 'const', ent)
+  call check_ok(ne, 26, d)
+  call check_int2(ne, 26, 1, n, GD_CONST_ENTRY)
+  call check_int2(ne, 26, 2, ent%fragment_index, 0)
+  call check_int2(ne, 26, 3, ent%data_type, GD_FLOAT64)
 
-  if (ent%field(1) .ne. 'data') then
-    ne = ne + 1
-    write(*, 2008) 22, 5, ent%field(1)
-  end if
+! 27: fgd_fragment_index check
+  n = fgd_fragment_index(d, 'const')
+  call check_ok(ne, 27, d)
+  call check_int(ne, 27, n, 0)
 
-! 23: fgd_entry (Sbit) check
-  n = fgd_entry(d, 'sbit', ent)
-  e = fgd_error(d)
+! 28: fgd_add_raw check
+  call fgd_add_raw(d, 'new1', GD_FLOAT64, 3, 0)
+  call check_ok2(ne, 28, 1, d)
 
-  if (e .ne. GD_E_OK) then
-    ne = ne + 1
-    write(*, 2001) 23, e
-  end if
+  n = fgd_entry(d, 'new1', ent)
+  call check_ok2(ne, 28, 2, d)
+  call check_int2(ne, 28, 3, ent%fragment_index, 0)
+  call check_int2(ne, 28, 4, ent%spf, 3)
+  call check_int2(ne, 28, 5, ent%data_type, GD_FLOAT64)
+  call check_int2(ne, 28, 6, n, GD_RAW_ENTRY)
 
-  if (n .ne. GD_SBIT_ENTRY) then
-    ne = ne + 1
-    write(*, 2007) 23, 1, n
-  end if
+! 29: fgd_add_lincom check
+  call fgd_add_lincom(d, 'new2', 2, 'in1', 9.9d0, 8.8d0, &
+  'in2', 7.7d0, 6.6d0, '', 0d0, 0d0, 0)
+  call check_ok2(ne, 29, 1, d)
 
-  if (ent%fragment_index .ne. 0) then
-    ne = ne + 1
-    write(*, 2007) 23, 2, ent%fragment_index
-  end if
+  n = fgd_entry(d, 'new2', ent)
+  call check_ok2(ne, 29, 2, d)
+  call check_int2(ne, 29, 3, n, GD_LINCOM_ENTRY)
+  call check_int2(ne, 29, 4, ent%n_fields, 2)
+  call check_int2(ne, 29, 5, ent%fragment_index, 0)
+  call check_str2(ne, 29, 6, ent%field(1), 'in1')
+  call check_str2(ne, 29, 7, ent%field(2), 'in2')
+  call check_int2(ne, 29, 8, ent%comp_scal, 0)
 
-  if (ent%numbits .ne. 6) then
-    ne = ne + 1
-    write(*, 2007) 23, 3, ent%numbits
-  end if
+  q = (/ 9.9, 8.8, 7.7, 6.6, 5.5, 5.5 /)
+  do i=1,2
+  call check_dbl2(ne, 29, i * 2 - 1, ent%m(i), q(i * 2 - 1))
+  call check_dbl2(ne, 29, i * 2, ent%b(i), q(i * 2))
+  end do
 
-  if (ent%bitnum .ne. 5) then
-    ne = ne + 1
-    write(*, 2007) 23, 4, ent%bitnum
-  end if
+! 30: fgd_add_clincom check
+  cq(1) = dcmplx(1.1, 1.2)
+  cq(2) = dcmplx(1.3, 1.4)
+  cq(3) = dcmplx(1.4, 1.5)
+  cq(4) = dcmplx(1.6, 1.7)
+  call fgd_add_clincom(d, 'new3', 2, 'in1', cq(1), cq(2), &
+  'in2', cq(3), cq(4), '', cq(5), cq(6), 0)
+  call check_ok2(ne, 30, 1, d)
 
-  if (ent%field(1) .ne. 'data') then
-    ne = ne + 1
-    write(*, 2008) 23, 5, ent%field(1)
-  end if
+  n = fgd_entry(d, 'new3', ent)
+  call check_ok2(ne, 30, 2, d)
+  call check_int2(ne, 30, 1, ent%n_fields, 2)
+  call check_int2(ne, 30, 2, n, GD_LINCOM_ENTRY)
+  call check_int2(ne, 30, 3, ent%fragment_index, 0)
+  call check_str2(ne, 30, 4, ent%field(1), 'in1')
+  call check_str2(ne, 30, 5, ent%field(2), 'in2')
+  call check_int2(ne, 30, 6, ent%comp_scal, 1)
 
-! 24: fgd_entry (multiply) check
-  n = fgd_entry(d, 'mult', ent)
-  e = fgd_error(d)
+  cq(1) = dcmplx(1.1, 1.2)
+  cq(2) = dcmplx(1.3, 1.4)
+  cq(3) = dcmplx(1.4, 1.5)
+  cq(4) = dcmplx(1.6, 1.7)
+  do i=1,2
+  call check_cpx2(ne, 30, i * 2 - 1, ent%cm(i), cq(i * 2 - 1))
+  call check_cpx2(ne, 30, i * 2, ent%cb(i), cq(i * 2))
+  end do
 
-  if (e .ne. GD_E_OK) then
-    ne = ne + 1
-    write(*, 2001) 24, e
-  end if
+! 31: fgd_add_polynom check
+  call fgd_add_polynom(d, 'new4', 3, 'in1', 3d3, 4d4, 5d5, 6d6, 0d0, 0d0, &
+  0)
+  call check_ok2(ne, 31, 1, d)
 
-  if (n .ne. GD_MULTIPLY_ENTRY) then
-    ne = ne + 1
-    write(*, 2007) 24, 1, n
-  end if
+  n = fgd_entry(d, 'new4', ent)
+  call check_ok2(ne, 31, 2, d)
+  call check_int2(ne, 31, 1, n, GD_POLYNOM_ENTRY)
+  call check_int2(ne, 31, 2, ent%poly_ord, 3)
+  call check_int2(ne, 31, 3, ent%fragment_index, 0)
+  call check_str2(ne, 31, 4, ent%field(1), 'in1')
+  call check_int2(ne, 31, 5, ent%comp_scal, 0)
 
-  if (ent%fragment_index .ne. 0) then
-    ne = ne + 1
-    write(*, 2007) 24, 2, ent%fragment_index
-  end if
+  q = (/ 3d3, 4d4, 5d5, 6d6, 5.5d0, 5.5d0 /)
+  DO i=1,4
+  call check_dbl2(ne, 31, i, ent%a(i), q(i))
+  end do
 
-  if (ent%field(1) .ne. 'data') then
-    ne = ne + 1
-    write(*, 2008) 24, 3, ent%field(1)
-  end if
-
-  if (ent%field(2) .ne. 'sbit') then
-    ne = ne + 1
-    write(*, 2008) 24, 4, ent%field(2)
-  end if
-
-! 25: fgd_entry (phase) check
-  n = fgd_entry(d, 'phase', ent)
-  e = fgd_error(d)
-
-  if (e .ne. GD_E_OK) then
-    ne = ne + 1
-    write(*, 2001) 25, e
-  end if
-
-  if (n .ne. GD_PHASE_ENTRY) then
-    ne = ne + 1
-    write(*, 2007) 25, 1, n
-  end if
-
-  if (ent%fragment_index .ne. 0) then
-    ne = ne + 1
-    write(*, 2007) 25, 2, ent%fragment_index
-  end if
-
-  if (ent%shift .ne. 11) then
-    ne = ne + 1
-    write(*, 2007) 25, 3, ent%shift
-  end if
-
-  if (ent%field(1) .ne. 'data') then
-    ne = ne + 1
-    write(*, 2008) 25, 4, ent%field(1)
-  end if
-
-! 26: fgd_entry (const) check
-  n = fgd_entry(d, 'const', ent)
-  e = fgd_error(d)
-
-  if (e .ne. GD_E_OK) then
-    ne = ne + 1
-    write(*, 2001) 26, e
-  end if
-
-  if (n .ne. GD_CONST_ENTRY) then
-    ne = ne + 1
-    write(*, 2007) 26, 1, n
-  end if
-
-  if (ent%fragment_index .ne. 0) then
-    ne = ne + 1
-    write(*, 2007) 26, 2, ent%fragment_index
-  end if
-
-  if (ent%data_type .ne. GD_FLOAT64) then
-    ne = ne + 1
-    write(*, 2007) 26, 3, ent%data_type
-  end if
-
-! 27: fgd_fragment_index check
-  n = fgd_fragment_index(d, 'const')
-  e = fgd_error(d)
-
-  if (e .ne. GD_E_OK) then
-    ne = ne + 1
-    write(*, 2001) 27, e
-  end if
-
-  if (n .ne. 0) then
-    ne = ne + 1
-    write(*, 2002) 27, n
-  end if
-
-! 28: fgd_add_raw check
-  call fgd_add_raw(d, 'new1', GD_FLOAT64, 3, 0)
-  e = fgd_error(d)
-
-  if (e .ne. GD_E_OK) then
-    ne = ne + 1
-    write(*, 2006) 28, 1, e
-  end if
-
-  n = fgd_entry(d, 'new1', ent)
-  e = fgd_error(d)
-
-  if (e .ne. GD_E_OK) then
-    ne = ne + 1
-    write(*, 2006) 28, 2, e
-  end if
-
-  if (ent%fragment_index .ne. 0) then
-    ne = ne + 1
-    write(*, 2007) 28, 3, ent%fragment_index
-  end if
-
-  if (ent%spf .ne. 3) then
-    ne = ne + 1
-    write(*, 2007) 28, 4, ent%spf
-  end if
-
-  if (ent%data_type .ne. GD_FLOAT64) then
-    ne = ne + 1
-    write(*, 2007) 28, 5, i
-  end if
-
-  if (n .ne. GD_RAW_ENTRY) then
-    ne = ne + 1
-    write(*, 2007) 28, 6, n
-  end if
-
-! 29: fgd_add_lincom check
-  call fgd_add_lincom(d, 'new2', 2, 'in1', 9.9d0, 8.8d0, &
-  'in2', 7.7d0, 6.6d0, '', 0d0, 0d0, 0)
-  e = fgd_error(d)
-
-  if (e .ne. GD_E_OK) then
-    ne = ne + 1
-    write(*, 2006) 29, 1, e
-  end if
-
-  n = fgd_entry(d, 'new2', ent)
-  e = fgd_error(d)
-
-  if (e .ne. GD_E_OK) then
-    ne = ne + 1
-    write(*, 2006) 29, 2, e
-  end if
-
-  if (n .ne. GD_LINCOM_ENTRY) then
-    ne = ne + 1
-    write(*, 2007) 29, 3, n
-  end if
-
-  if (ent%n_fields .ne. 2) then
-    ne = ne + 1
-    write(*, 2007) 29, 4, ent%n_fields
-  end if
-
-  if (ent%fragment_index .ne. 0) then
-    ne = ne + 1
-    write(*, 2007) 29, 5, ent%fragment_index
-  end if
-
-  if (ent%field(1) .ne. 'in1') then
-    ne = ne + 1
-    write(*, 2008) 29, 6, ent%field(1)
-  end if
-
-  if (ent%field(2) .ne. 'in2') then
-    ne = ne + 1
-    write(*, 2008) 29, 7, ent%field(2)
-  end if
-
-  if (ent%comp_scal .ne. 0) then
-    ne = ne + 1
-    write(*, 2007) 29, 8, ent%comp_scal
-  end if
-
-  q = (/ 9.9, 8.8, 7.7, 6.6, 5.5, 5.5 /)
-  do i=1,2
-  if (abs(ent%m(i) - q(i * 2 - 1)) > 0.001) then
-    ne = ne + 1
-    write(*, 2010) i * 2 - 1, 29, ent%m(i)
-  end if
-  if (abs(ent%b(i) - q(i * 2)) > 0.001) then
-    ne = ne + 1
-    write(*, 2010) i * 2, 29, ent%b(i)
-  end if
-  end do
-
-! 30: fgd_add_clincom check
-  cq(1) = dcmplx(1.1, 1.2)
-  cq(2) = dcmplx(1.3, 1.4)
-  cq(3) = dcmplx(1.4, 1.5)
-  cq(4) = dcmplx(1.6, 1.7)
-  call fgd_add_clincom(d, 'new3', 2, 'in1', cq(1), cq(2), &
-  'in2', cq(3), cq(4), '', cq(5), cq(6), 0)
-  e = fgd_error(d)
-
-  if (e .ne. GD_E_OK) then
-    ne = ne + 1
-    write(*, 2006) 30, 1, e
-  end if
-
-  n = fgd_entry(d, 'new3', ent)
-  e = fgd_error(d)
-
-  if (e .ne. GD_E_OK) then
-    ne = ne + 1
-    write(*, 2006) 30, 2, e
-  end if
-
-  if (ent%n_fields .ne. 2) then
-    ne = ne + 1
-    write(*, 2007) 30, 1, ent%n_fields
-  end if
-
-  if (n .ne. GD_LINCOM_ENTRY) then
-    ne = ne + 1
-    write(*, 2007) 30, 2, n
-  end if
-
-  if (ent%fragment_index .ne. 0) then
-    ne = ne + 1
-    write(*, 2007) 30, 3, ent%fragment_index
-  end if
-
-  if (ent%field(1) .ne. 'in1') then
-    ne = ne + 1
-    write(*, 2008) 30, 4, ent%field(1)
-  end if
-
-  if (ent%field(2) .ne. 'in2') then
-    ne = ne + 1
-    write(*, 2008) 30, 5, ent%field(2)
-  end if
-
-  if (ent%comp_scal .ne. 1) then
-    ne = ne + 1
-    write(*, 2007) 30, 6, ent%comp_scal
-  end if
-
-  cq(1) = dcmplx(1.1, 1.2)
-  cq(2) = dcmplx(1.3, 1.4)
-  cq(3) = dcmplx(1.4, 1.5)
-  cq(4) = dcmplx(1.6, 1.7)
-  do i=1,2
-  if (abs(ent%cm(i) - cq(i * 2 - 1)) > 0.001) then
-    ne = ne + 1
-    write(*, 2011) i * 2 - 1, 30, real(real(ent%cm(i))), real(aimag(ent%cm(i)))
-  end if
-  if (abs(ent%cb(i) - cq(i * 2)) > 0.001) then
-    ne = ne + 1
-    write(*, 2011) i * 2, 30, real(real(ent%cb(i))), real(aimag(ent%cb(i)))
-  end if
-  end do
-
-! 31: fgd_add_polynom check
-  call fgd_add_polynom(d, 'new4', 3, 'in1', 3d3, 4d4, 5d5, 6d6, 0d0, 0d0, &
-  0)
-  e = fgd_error(d)
-
-  if (e .ne. GD_E_OK) then
-    ne = ne + 1
-    write(*, 2006) 31, 1, e
-  end if
-
-  n = fgd_entry(d, 'new4', ent)
-  e = fgd_error(d)
-
-  if (e .ne. GD_E_OK) then
-    ne = ne + 1
-    write(*, 2006) 31, 2, e
-  end if
-
-  if (n .ne. GD_POLYNOM_ENTRY) then
-    ne = ne + 1
-    write(*, 2007) 31, 1, n
-  end if
-
-  if (ent%poly_ord .ne. 3) then
-    ne = ne + 1
-    write(*, 2007) 31, 2, ent%poly_ord
-  end if
-
-  if (ent%fragment_index .ne. 0) then
-    ne = ne + 1
-    write(*, 2007) 31, 3, ent%fragment_index
-  end if
-
-  if (ent%field(1) .ne. 'in1') then
-    ne = ne + 1
-    write(*, 2008) 31, 4, ent%field(1)
-  end if
-
-  if (ent%comp_scal .ne. 0) then
-    ne = ne + 1
-    write(*, 2007) 31, 5, ent%comp_scal
-  end if
-
-  q = (/ 3d3, 4d4, 5d5, 6d6, 5.5d0, 5.5d0 /)
-  DO i=1,4
-  if (abs(ent%a(i) - q(i)) > 0.001) then
-    ne = ne + 1
-    write(*, 2010) i, 31, ent%a(i)
-  end if
-  end do
-
-! 32: fgd_add_cpolynom check
-  cq(1) = dcmplx(3.1, 7.0)
-  cq(2) = dcmplx(4.2, 8.0)
-  cq(3) = dcmplx(5.2, 9.0)
-  cq(4) = dcmplx(6.3, 4.4)
-  call fgd_add_cpolynom(d, 'new5', 3, 'in1', cq(1), cq(2), cq(3), cq(4), &
-  dcmplx(0d0,0d0), dcmplx(0d0,0d0), 0)
-  e = fgd_error(d)
-
-  if (e .ne. GD_E_OK) then
-    ne = ne + 1
-    write(*, 2006) 32, 1, e
-  end if
-
-  n = fgd_entry(d, 'new5', ent)
-  e = fgd_error(d)
-
-  if (e .ne. GD_E_OK) then
-    ne = ne + 1
-    write(*, 2006) 32, 2, e
-  end if
-
-  if (n .ne. GD_POLYNOM_ENTRY) then
-    ne = ne + 1
-    write(*, 2007) 32, 1, n
-  end if
-
-  if (ent%poly_ord .ne. 3) then
-    ne = ne + 1
-    write(*, 2007) 32, 2, ent%poly_ord
-  end if
-
-  if (ent%fragment_index .ne. 0) then
-    ne = ne + 1
-    write(*, 2007) 32, 3, ent%fragment_index
-  end if
-
-  if (ent%field(1) .ne. 'in1') then
-    ne = ne + 1
-    write(*, 2008) 32, 4, ent%field(1)
-  end if
-
-  if (ent%comp_scal .ne. 1) then
-    ne = ne + 1
-    write(*, 2007) 31, 5, ent%comp_scal
-  end if
-
-  cq(1) = dcmplx(3.1, 7.0)
-  cq(2) = dcmplx(4.2, 8.0)
-  cq(3) = dcmplx(5.2, 9.0)
-  cq(4) = dcmplx(6.3, 4.4)
-  DO i=1,4
-  if (abs(ent%ca(i) - cq(i)) > 0.001) then
-    ne = ne + 1
-    write(*, 2011) i, 32, real(real(ent%ca(i))), real(aimag(ent%ca(i)))
-  end if
-  end do
-
-! 33: fgd_add_linterp check
-  call fgd_add_linterp(d, "new6", "in", "./some/table", 0)
-  e = fgd_error(d)
-
-  if (e .ne. GD_E_OK) then
-    ne = ne + 1
-    write(*, 2006) 33, 1, e
-  end if
-
-  n = fgd_entry(d, 'new6', ent)
-  e = fgd_error(d)
-
-  if (e .ne. GD_E_OK) then
-    ne = ne + 1
-    write(*, 2006) 33, 2, e
-  end if
-
-  if (n .ne. GD_LINTERP_ENTRY) then
-    ne = ne + 1
-    write(*, 2007) 33, 1, n
-  end if
-
-  if (ent%fragment_index .ne. 0) then
-    ne = ne + 1
-    write(*, 2007) 33, 2, ent%fragment_index
-  end if
-
-  if (ent%field(1) .ne. 'in') then
-    ne = ne + 1
-    write(*, 2008) 33, 3, ent%field(1)
-  end if
-
-  if (ent%field(2) .ne. './some/table') then
-    ne = ne + 1
-    write(*, 2008) 33, 4, ent%field(2)
-  end if
-
-! 34: fgd_add_bit check
-  call fgd_add_bit(d, "new7", "in", 13, 12, 0)
-  e = fgd_error(d)
-
-  if (e .ne. GD_E_OK) then
-    ne = ne + 1
-    write(*, 2006) 34, 1, e
-  end if
-
-  n = fgd_entry(d, 'new7', ent)
-  e = fgd_error(d)
-
-  if (e .ne. GD_E_OK) then
-    ne = ne + 1
-    write(*, 2006) 34, 2, e
-  end if
-
-  if (n .ne. GD_BIT_ENTRY) then
-    ne = ne + 1
-    write(*, 2007) 34, 1, n
-  end if
-
-  if (ent%fragment_index .ne. 0) then
-    ne = ne + 1
-    write(*, 2007) 34, 2, ent%fragment_index
-  end if
-
-  if (ent%numbits .ne. 12) then
-    ne = ne + 1
-    write(*, 2007) 34, 3, ent%numbits
-  end if
-
-  if (ent%bitnum .ne. 13) then
-    ne = ne + 1
-    write(*, 2007) 34, 4, ent%bitnum
-  end if
-
-  if (ent%field(1) .ne. 'in') then
-    ne = ne + 1
-    write(*, 2008) 34, 5, ent%field(1)
-  end if
-
-! 35: fgd_add_sbit check
-  call fgd_add_sbit(d, "new8", "in", 13, 12, 0)
-  e = fgd_error(d)
-
-  if (e .ne. GD_E_OK) then
-    ne = ne + 1
-    write(*, 2006) 35, 1, e
-  end if
-
-  n = fgd_entry(d, "new8", ent)
-  e = fgd_error(d)
-
-  if (e .ne. GD_E_OK) then
-    ne = ne + 1
-    write(*, 2006) 35, 2, e
-  end if
-
-  if (n .ne. GD_SBIT_ENTRY) then
-    ne = ne + 1
-    write(*, 2007) 35, 1, n
-  end if
-
-  if (ent%fragment_index .ne. 0) then
-    ne = ne + 1
-    write(*, 2007) 35, 2, ent%fragment_index
-  end if
-
-  if (ent%numbits .ne. 12) then
-    ne = ne + 1
-    write(*, 2007) 35, 3, ent%numbits
-  end if
-
-  if (ent%bitnum .ne. 13) then
-    ne = ne + 1
-    write(*, 2007) 35, 4, ent%bitnum
-  end if
-
-  if (ent%field(1) .ne. 'in') then
-    ne = ne + 1
-    write(*, 2008) 35, 5, ent%field(1)
-  end if
-
-! 36: fgd_add_multiply check
-  call fgd_add_multiply(d, 'new9', 'in1', 'in2', 0)
-  e = fgd_error(d)
-
-  if (e .ne. GD_E_OK) then
-    ne = ne + 1
-    write(*, 2006) 36, 1, e
-  end if
-
-  n = fgd_entry(d, 'new9', ent)
-  e = fgd_error(d)
-
-  if (e .ne. GD_E_OK) then
-    ne = ne + 1
-    write(*, 2006) 36, 2, e
-  end if
-
-  if (n .ne. GD_MULTIPLY_ENTRY) then
-    ne = ne + 1
-    write(*, 2007) 36, 1, n
-  end if
-
-  if (ent%fragment_index .ne. 0) then
-    ne = ne + 1
-    write(*, 2007) 36, 2, ent%fragment_index
-  end if
-
-  if (ent%field(1) .ne. 'in1') then
-    ne = ne + 1
-    write(*, 2008) 36, 3, ent%field(1)
-  end if
-
-  if (ent%field(2) .ne. 'in2') then
-    ne = ne + 1
-    write(*, 2008) 36, 4, ent%field(2)
-  end if
-
-! 37: fgd_add_phase check
-  call fgd_add_phase(d, 'new10', 'in1', 22, 0)
-  e = fgd_error(d)
-
-  if (e .ne. GD_E_OK) then
-    ne = ne + 1
-    write(*, 2006) 37, 1, e
-  end if
-
-  n = fgd_entry(d, 'new10', ent)
-  e = fgd_error(d)
-
-  if (e .ne. GD_E_OK) then
-    ne = ne + 1
-    write(*, 2006) 37, 2, e
-  end if
-
-  if (n .ne. GD_PHASE_ENTRY) then
-    ne = ne + 1
-    write(*, 2007) 37, 1, n
-  end if
-
-  if (ent%fragment_index .ne. 0) then
-    ne = ne + 1
-    write(*, 2007) 37, 2, ent%fragment_index
-  end if
-
-  if (ent%shift .ne. 22) then
-    ne = ne + 1
-    write(*, 2007) 37, 3, ent%shift
-  end if
-
-  if (ent%field(1) .ne. 'in1') then
-    ne = ne + 1
-    write(*, 2008) 37, 4, ent%field(1)
-  end if
-
-! 38: fgd_add_const check
-  call fgd_add_const(d, 'new11', GD_FLOAT64, 0)
-  e = fgd_error(d)
-
-  if (e .ne. GD_E_OK) then
-    ne = ne + 1
-    write(*, 2006) 38, 1, e
-  end if
-
-  n = fgd_entry(d, 'new11', ent)
-  e = fgd_error(d)
-
-  if (e .ne. GD_E_OK) then
-    ne = ne + 1
-    write(*, 2006) 38, 2, e
-  end if
-
-  if (n .ne. GD_CONST_ENTRY) then
-    ne = ne + 1
-    write(*, 2007) 38, 1, n
-  end if
-
-  if (ent%fragment_index .ne. 0) then
-    ne = ne + 1
-    write(*, 2007) 38, 2, ent%fragment_index
-  end if
-
-  if (ent%data_type .ne. GD_FLOAT64) then
-    ne = ne + 1
-    write(*, 2007) 38, 3, ent%data_type
-  end if
-
-  call fgd_get_constant_r4(d, 'new11', fl)
-  e = fgd_error(d)
-
-  if (e .ne. GD_E_OK) then
-    ne = ne + 1
-    write(*, 2006) 38, 3, e
-  end if
-
-  if (abs(fl) > 1e-5) then
-    ne = ne + 1
-    write(*, 2005) 38, fl
-  end if
-
-! 125: fgd_add check
-  ent%shift = 33
-  ent%field(1) = 'new9'
-  ent%fragment_index = 0
-  ent%field_type = GD_PHASE_ENTRY
-  call fgd_add(d, 'new13', ent)
-  e = fgd_error(d)
-
-  if (e .ne. GD_E_OK) then
-    ne = ne + 1
-    write(*, 2006) 125, 1, e
-  end if
-
-  n = fgd_entry(d, 'new13', ent)
-  e = fgd_error(d)
-
-  if (e .ne. GD_E_OK) then
-    ne = ne + 1
-    write(*, 2006) 125, 2, e
-  end if
-
-  if (n .ne. GD_PHASE_ENTRY) then
-    ne = ne + 1
-    write(*, 2007) 125, 1, n
-  end if
-
-  if (ent%fragment_index .ne. 0) then
-    ne = ne + 1
-    write(*, 2007) 125, 2, ent%fragment_index
-  end if
-
-  if (ent%shift .ne. 33) then
-    ne = ne + 1
-    write(*, 2007) 125, 3, ent%shift
-  end if
-
-  if (ent%field(1) .ne. 'new9') then
-    ne = ne + 1
-    write(*, 2008) 125, 4, ent%field(1)
-  end if
-
-! 39: fgd_fragmentname check
-  str = fgd_fragmentname(d, 0)
-  e = fgd_error(d)
-
-  if (e .ne. GD_E_OK) then
-    ne = ne + 1
-    write(*, 2001) 39, e
-  end if
-
-  if (str .ne. 'test95_dirfile/format') then
-    ne = ne + 1
-    write(*, 2009), 39, str
-  end if
-
-! 40: fgd_nfragments check
-  n = fgd_nfragments(d)
-  e = fgd_error(d)
-
-  if (e .ne. GD_E_OK) then
-    ne = ne + 1
-    write(*, 2001) 40, e
-  end if
-
-  if (n .ne. 1) then
-    ne = ne + 1
-    write(*, 2002), 40, n
-  end if
-
-! 41: fgd_include check
-  call fgd_include(d, 'form2', 0, 0)
-  e = fgd_error(d)
-
-  if (e .ne. GD_E_OK) then
-    ne = ne + 1
-    write(*, 2006) 41, 3, e
-  end if
-
-  call fgd_get_constant_i1(d, 'const2', ci1(1))
-  e = fgd_error(d)
-
-  if (e .ne. GD_E_OK) then
-    ne = ne + 1
-    write(*, 2006) 41, 3, e
-  end if
-
-  if (ci1(1) .ne. -19) then
-    ne = ne + 1
-    write(*, 2004) 1, 41, ci1(1)
-  end if
-
-! 42: fgd_nfields_by_type check
-  n = fgd_nfields_by_type(d, GD_LINCOM_ENTRY)
-  e = fgd_error(d)
-
-  if (e .ne. GD_E_OK) then
-    ne = ne + 1
-    write(*, 2001) 42, e
-  end if
-
-  if (n .ne. 3) then
-    ne = ne + 1
-    write(*, 2002), 42, n
-  end if
-
-! 43: fgd_field_list_by_type check
-  fields(1) = 'lincom'
-  fields(2) = 'new2'
-  fields(3) = 'new3'
-  l = flen
-  call fgd_field_list_by_type(flist, d, GD_LINCOM_ENTRY, l)
-  e = fgd_error(d)
-
-  if (e .ne. GD_E_OK) then
-    ne = ne + 1
-    write(*, 2001) 43, e
-  end if
-
-  if (l .ne. flen) then
-    ne = ne + 1
-    write(*, 2002) 43, l
-  end if
-
-  do i = 1, n
-  if (flist(i) .ne. fields(i)) then
-    ne = ne + 1
-    write(*, 2008) i, 43, flist(i)
-  end if
-  end do
-
-! 44: fgd_nvectors check
-  n = fgd_nvectors(d)
-  e = fgd_error(d)
-
-  if (e .ne. GD_E_OK) then
-    ne = ne + 1
-    write(*, 2001) 44, e
-  end if
-
-  if (n .ne. 22) then
-    ne = ne + 1
-    write(*, 2002), 44, n
-  end if
-
-! 45: fgd_vector_list check
-  fields =(/ 'INDEX  ', 'bit    ', 'data   ', 'div    ', 'lincom ', 'linterp', &
-  'mult   ', 'new1   ', 'new10  ', 'new13  ', 'new2   ', 'new3   ', 'new4   ', &
-  'new5   ', 'new6   ', 'new7   ', 'new8   ', 'new9   ', 'phase  ', 'polynom', &
-  'recip  ', 'sbit   ' /)
-  l = flen
-  call fgd_vector_list(flist, d, l)
-  e = fgd_error(d)
-
-  if (e .ne. GD_E_OK) then
-    ne = ne + 1
-    write(*, 2001) 45, e
-  end if
-
-  if (l .ne. flen) then
-    ne = ne + 1
-    write(*, 2002) 45, l
-  end if
- 
-  do i=1,n
-  if (flist(i) .ne. fields(i)) then
-    ne = ne + 1
-    write(*, 2008) i, 45, flist(i)
-  end if
-  end do
-
-! 46: fgd_madd_lincom check
-  call fgd_madd_lincom(d, 'data', 'mnew1', 2, 'in1', 9.9d0, 8.8d0, &
-  'in2', 7.7d0, 6.6d0, '', 0d0, 0d0)
-  e = fgd_error(d)
-
-  if (e .ne. GD_E_OK) then
-    ne = ne + 1
-    write(*, 2006) 46, 1, e
-  end if
-
-  n = fgd_entry(d, 'data/mnew1', ent)
-  e = fgd_error(d)
-
-  if (e .ne. GD_E_OK) then
-    ne = ne + 1
-    write(*, 2006) 46, 2, e
-  end if
-
-  if (n .ne. GD_LINCOM_ENTRY) then
-    ne = ne + 1
-    write(*, 2007) 46, 3, n
-  end if
-
-  if (ent%n_fields .ne. 2) then
-    ne = ne + 1
-    write(*, 2007) 46, 4, ent%n_fields
-  end if
-
-  if (ent%fragment_index .ne. 0) then
-    ne = ne + 1
-    write(*, 2007) 46, 5, ent%fragment_index
-  end if
-
-  if (ent%field(1) .ne. 'in1') then
-    ne = ne + 1
-    write(*, 2008) 46, 6, ent%field(1)
-  end if
-
-  if (ent%field(2) .ne. 'in2') then
-    ne = ne + 1
-    write(*, 2008) 46, 7, ent%field(2)
-  end if
-
-  if (ent%comp_scal .ne. 0) then
-    ne = ne + 1
-    write(*, 2007) 46, 8, ent%comp_scal
-  end if
-
-  q = (/ 9.9, 8.8, 7.7, 6.6, 5.5, 5.5 /)
-  DO i=1,2
-  if (abs(ent%m(i) - q(i *  2 - 1)) > 0.001) then
-    ne = ne + 1
-    write(*, 2010) i * 2 - 1, 46, ent%m(i)
-  end if
-  if (abs(ent%b(i) - q(i * 2)) > 0.001) then
-    ne = ne + 1
-    write(*, 2010) i * 2, 46, ent%m(i)
-  end if
-  end do
-
-! 47: fgd_madd_clincom check
-  cq(1) = dcmplx(1.1, 1.2)
-  cq(2) = dcmplx(1.3, 1.4)
-  cq(3) = dcmplx(1.4, 1.5)
-  cq(4) = dcmplx(1.6, 1.7)
-  call fgd_madd_clincom(d, 'data', 'mnew2', 2, 'in1', cq(1), cq(2), &
-  'in2', cq(3), cq(4), '', cq(5), cq(6))
-  e = fgd_error(d)
-
-  if (e .ne. GD_E_OK) then
-    ne = ne + 1
-    write(*, 2006) 47, 1, e
-  end if
-
-  n = fgd_entry(d, 'data/mnew2', ent)
-  e = fgd_error(d)
-
-  if (e .ne. GD_E_OK) then
-    ne = ne + 1
-    write(*, 2001) 47, e
-  end if
-
-  if (n .ne. GD_LINCOM_ENTRY) then
-    ne = ne + 1
-    write(*, 2007) 47, 1, n
-  end if
-
-  if (ent%n_fields .ne. 2) then
-    ne = ne + 1
-    write(*, 2007) 47, 2, ent%n_fields
-  end if
-
-  if (ent%fragment_index .ne. 0) then
-    ne = ne + 1
-    write(*, 2007) 47, 3, ent%fragment_index
-  end if
-
-  if (ent%field(1) .ne. 'in1') then
-    ne = ne + 1
-    write(*, 2008) 47, 4, ent%field(1)
-  end if
-
-  if (ent%field(2) .ne. 'in2') then
-    ne = ne + 1
-    write(*, 2008) 47, 5, ent%field(2)
-  end if
-
-  if (ent%comp_scal .ne. 1) then
-    ne = ne + 1
-    write(*, 2007) 47, 6, ent%comp_scal
-  end if
-
-  cq(1) = dcmplx(1.1, 1.2)
-  cq(2) = dcmplx(1.3, 1.4)
-  cq(3) = dcmplx(1.4, 1.5)
-  cq(4) = dcmplx(1.6, 1.7)
-  DO i=1,2
-  if (abs(ent%cm(i) - cq(i * 2 - 1)) > 0.001) then
-    ne = ne + 1
-    write(*, 2011) i * 2 - 1, 47, real(real(ent%cm(i))), real(aimag(ent%cm(i)))
-  end if
-  if (abs(ent%cb(i) - cq(i * 2)) > 0.001) then
-    ne = ne + 1
-    write(*, 2011) i * 2, 47, real(real(ent%cb(i))), real(aimag(ent%cb(i)))
-  end if
-  end do
-
-! 48: fgd_madd_polynom check
-  call fgd_madd_polynom(d, 'data', 'mnew3', 3, 'in1', 3d3, 4d4, 5d5, &
-     6d6, 0d0, 0d0)
-  e = fgd_error(d)
-
-  if (e .ne. GD_E_OK) then
-    ne = ne + 1
-    write(*, 2006) 48, 1, e
-  end if
-
-  n = fgd_entry(d, 'data/mnew3', ent)
-  e = fgd_error(d)
-
-  if (e .ne. GD_E_OK) then
-    ne = ne + 1
-    write(*, 2006) 48, 2, e
-  end if
-
-  if (n .ne. GD_POLYNOM_ENTRY) then
-    ne = ne + 1
-    write(*, 2007) 48, 1, n
-  end if
-
-  if (ent%poly_ord .ne. 3) then
-    ne = ne + 1
-    write(*, 2007) 48, 2, ent%poly_ord
-  end if
-
-  if (ent%fragment_index .ne. 0) then
-    ne = ne + 1
-    write(*, 2007) 48, 3, ent%fragment_index
-  end if
-
-  if (ent%field(1) .ne. 'in1') then
-    ne = ne + 1
-    write(*, 2008) 48, 4, ent%field(1)
-  end if
-
-  q = (/ 3d3, 4d4, 5d5, 6d6, 5.5d0, 5.5d0 /)
-  DO i=1,4
-  if (abs(ent%a(i) - q(i)) > 0.001) then
-    ne = ne + 1
-    write(*, 2010) i, 48, ent%a(i)
-  end if
-  end do
-
-! 49: fgd_madd_cpolynom check
-  cq(1) = dcmplx(1.1, 0.0)
-  cq(2) = dcmplx(2.2, 0.0)
-  cq(3) = dcmplx(2.2, 0.0)
-  cq(4) = dcmplx(3.3, 4.4)
-  call fgd_madd_cpolynom(d, 'data', 'mnew5', 3, 'in1', cq(1), cq(2), &
-     cq(3), cq(4), dcmplx(0d0,0d0), dcmplx(0d0,0d0))
-  e = fgd_error(d)
-
-  if (e .ne. GD_E_OK) then
-    ne = ne + 1
-    write(*, 2006) 49, 1, e
-  end if
-
-  n = fgd_entry(d, 'data/mnew5', ent)
-  e = fgd_error(d)
-
-  if (e .ne. GD_E_OK) then
-    ne = ne + 1
-    write(*, 2006) 49, 2, e
-  end if
-
-  if (n .ne. GD_POLYNOM_ENTRY) then
-    ne = ne + 1
-    write(*, 2007) 49, 1, n
-  end if
-
-  if (ent%poly_ord .ne. 3) then
-    ne = ne + 1
-    write(*, 2007) 49, 2, ent%poly_ord
-  end if
-
-  if (ent%fragment_index .ne. 0) then
-    ne = ne + 1
-    write(*, 2007) 49, 3, ent%fragment_index
-  end if
-
-  if (ent%field(1) .ne. 'in1') then
-    ne = ne + 1
-    write(*, 2008) 49, 4, ent%field(1)
-  end if
-
-  cq(1) = dcmplx(1.1, 0.0)
-  cq(2) = dcmplx(2.2, 0.0)
-  cq(3) = dcmplx(2.2, 0.0)
-  cq(4) = dcmplx(3.3, 4.4)
-  DO i=1,4
-  if (abs(ent%ca(i) - cq(i)) > 0.001) then
-    ne = ne + 1
-    write(*, 2011) i, 49, real(real(ent%ca(i))), real(aimag(ent%ca(i)))
-  end if
-  end do
-
-! 50: fgd_madd_linterp check
-  call fgd_madd_linterp(d, "data", "mnew6", "in", "./more/table")
-  e = fgd_error(d)
-
-  if (e .ne. GD_E_OK) then
-    ne = ne + 1
-    write(*, 2006) 50, 1, e
-  end if
-
-  n = fgd_entry(d, 'data/mnew6', ent)
-  e = fgd_error(d)
-
-  if (e .ne. GD_E_OK) then
-    ne = ne + 1
-    write(*, 2006) 50, 2, e
-  end if
-
-  if (n .ne. GD_LINTERP_ENTRY) then
-    ne = ne + 1
-    write(*, 2007) 50, 1, n
-  end if
-
-  if (ent%fragment_index .ne. 0) then
-    ne = ne + 1
-    write(*, 2007) 50, 2, ent%fragment_index
-  end if
-
-  if (ent%field(1) .ne. 'in') then
-    ne = ne + 1
-    write(*, 2008) 50, 3, ent%field(1)
-  end if
-
-  if (ent%field(2) .ne. './more/table') then
-    ne = ne + 1
-    write(*, 2008) 50, 4, ent%field(2)
-  end if
-
-! 51: fgd_madd_bit check
-  call fgd_madd_bit(d, "data", "mnew7", "in", 13, 12)
-  e = fgd_error(d)
-
-  if (e .ne. GD_E_OK) then
-    ne = ne + 1
-    write(*, 2006) 51, 1, e
-  end if
-
-  n = fgd_entry(d, 'data/mnew7', ent)
-  e = fgd_error(d)
-
-  if (e .ne. GD_E_OK) then
-    ne = ne + 1
-    write(*, 2006) 51, 2, e
-  end if
-
-  if (n .ne. GD_BIT_ENTRY) then
-    ne = ne + 1
-    write(*, 2007) 51, 1, n
-  end if
-
-  if (ent%fragment_index .ne. 0) then
-    ne = ne + 1
-    write(*, 2007) 51, 2, ent%fragment_index
-  end if
-
-  if (ent%numbits .ne. 12) then
-    ne = ne + 1
-    write(*, 2007) 51, 3, ent%numbits
-  end if
-
-  if (ent%bitnum .ne. 13) then
-    ne = ne + 1
-    write(*, 2007) 51, 4, ent%bitnum
-  end if
-
-  if (ent%field(1) .ne. 'in') then
-    ne = ne + 1
-    write(*, 2008) 51, 5, ent%field(1)
-  end if
-
-! 52: fgd_madd_sbit check
-  call fgd_madd_sbit(d, "data", "mnew8", "in", 13, 12)
-  e = fgd_error(d)
-
-  if (e .ne. GD_E_OK) then
-    ne = ne + 1
-    write(*, 2006) 52, 1, e
-  end if
-
-  n = fgd_entry(d, 'data/mnew8', ent)
-  e = fgd_error(d)
-
-  if (e .ne. GD_E_OK) then
-    ne = ne + 1
-    write(*, 2006) 52, 2, e
-  end if
-
-  if (n .ne. GD_SBIT_ENTRY) then
-    ne = ne + 1
-    write(*, 2007) 52, 1, n
-  end if
-
-  if (ent%fragment_index .ne. 0) then
-    ne = ne + 1
-    write(*, 2007) 52, 2, ent%fragment_index
-  end if
-
-  if (ent%numbits .ne. 12) then
-    ne = ne + 1
-    write(*, 2007) 52, 3, ent%numbits
-  end if
-
-  if (ent%bitnum .ne. 13) then
-    ne = ne + 1
-    write(*, 2007) 52, 4, ent%bitnum
-  end if
-
-  if (ent%field(1) .ne. 'in') then
-    ne = ne + 1
-    write(*, 2008) 52, 5, ent%field(1)
-  end if
-
-! 53: fgd_madd_multiply check
-  call fgd_madd_multiply(d, 'data', 'mnew9', 'in1', 'in2')
-  e = fgd_error(d)
-
-  if (e .ne. GD_E_OK) then
-    ne = ne + 1
-    write(*, 2006) 53, 1, e
-  end if
-
-  n = fgd_entry(d, 'data/mnew9', ent)
-  e = fgd_error(d)
-
-  if (e .ne. GD_E_OK) then
-    ne = ne + 1
-    write(*, 2006) 53, 2, e
-  end if
-
-  if (n .ne. GD_MULTIPLY_ENTRY) then
-    ne = ne + 1
-    write(*, 2007) 53, 1, n
-  end if
-
-  if (ent%fragment_index .ne. 0) then
-    ne = ne + 1
-    write(*, 2007) 53, 2, ent%fragment_index
-  end if
-
-  if (ent%field(1) .ne. 'in1') then
-    ne = ne + 1
-    write(*, 2008) 53, 3, ent%field(1)
-  end if
-
-  if (ent%field(2) .ne. 'in2') then
-    ne = ne + 1
-    write(*, 2008) 53, 4, ent%field(2)
-  end if
-
-! 54: fgd_madd_phase check
-  call fgd_madd_phase(d, 'data', 'mnew10', 'in1', 22)
-  e = fgd_error(d)
-
-  if (e .ne. GD_E_OK) then
-    ne = ne + 1
-    write(*, 2006) 54, 1, e
-  end if
-
-  n = fgd_entry(d, 'data/mnew10', ent)
-  e = fgd_error(d)
-
-  if (e .ne. GD_E_OK) then
-    ne = ne + 1
-    write(*, 2006) 54, 2, e
-  end if
-
-  if (n .ne. GD_PHASE_ENTRY) then
-    ne = ne + 1
-    write(*, 2007) 54, 1, n
-  end if
-
-  if (ent%fragment_index .ne. 0) then
-    ne = ne + 1
-    write(*, 2007) 54, 2, ent%fragment_index
-  end if
-
-  if (ent%shift .ne. 22) then
-    ne = ne + 1
-    write(*, 2007) 54, 3, ent%shift
-  end if
-
-  if (ent%field(1) .ne. 'in1') then
-    ne = ne + 1
-    write(*, 2008) 54, 4, ent%field(1)
-  end if
-
-! 55: fgd_madd_const check
-  call fgd_madd_const(d, 'data', 'mnew11', GD_FLOAT64)
-  e = fgd_error(d)
-
-  if (e .ne. GD_E_OK) then
-    ne = ne + 1
-    write(*, 2006) 55, 1, e
-  end if
-
-  n = fgd_entry(d, 'data/mnew11', ent)
-  e = fgd_error(d)
-
-  if (e .ne. GD_E_OK) then
-    ne = ne + 1
-    write(*, 2006) 55, 2, e
-  end if
-
-  if (n .ne. GD_CONST_ENTRY) then
-    ne = ne + 1
-    write(*, 2007) 55, 1, n
-  end if
-
-  if (ent%fragment_index .ne. 0) then
-    ne = ne + 1
-    write(*, 2007) 55, 2, ent%fragment_index
-  end if
-
-  if (ent%data_type .ne. GD_FLOAT64) then
-    ne = ne + 1
-    write(*, 2007) 55, 3, ent%data_type
-  end if
-
-  call fgd_get_constant_r4(d, 'data/mnew11', fl)
-  e = fgd_error(d)
-
-  if (e .ne. GD_E_OK) then
-    ne = ne + 1
-    write(*, 2006) 55, 3, e
-  end if
-
-  if (abs(fl) > 0.001) then
-    ne = ne + 1
-    write(*, 2005) 55, fl
-  end if
-
-! 126: fgd_madd check
-  ent%shift = 33
-  ent%field(1) = 'data/mnew10'
-  ent%fragment_index = 0
-  ent%field_type = GD_PHASE_ENTRY
-  call fgd_madd(d, 'data', 'mnew4', ent)
-  e = fgd_error(d)
-
-  if (e .ne. GD_E_OK) then
-    ne = ne + 1
-    write(*, 2006) 126, 1, e
-  end if
-
-  n = fgd_entry(d, 'data/mnew4', ent)
-  e = fgd_error(d)
-
-  if (e .ne. GD_E_OK) then
-    ne = ne + 1
-    write(*, 2006) 126, 2, e
-  end if
-
-  if (n .ne. GD_PHASE_ENTRY) then
-    ne = ne + 1
-    write(*, 2007) 126, 1, n
-  end if
-
-  if (ent%fragment_index .ne. 0) then
-    ne = ne + 1
-    write(*, 2007) 126, 2, ent%fragment_index
-  end if
-
-  if (ent%shift .ne. 33) then
-    ne = ne + 1
-    write(*, 2007) 126, 3, ent%shift
-  end if
-
-  if (ent%field(1) .ne. 'data/mnew10') then
-    ne = ne + 1
-    write(*, 2008) 126, 4, ent%field(1)
-  end if
-
-! 56: fgd_get_string check
-  n = fgd_get_string(d, 'string', GD_FIELD_LEN, str)
-  e = fgd_error(d)
-
-  if (e .ne. GD_E_OK) then
-    ne = ne + 1
-    write(*, 2001) 56, e
-  end if
-
-  if (n .ne. 17) then
-    ne = ne + 1
-    write(*, 2002) 56, n
-  end if
-
-  if (str .ne. "Zaphod Beeblebrox") then
-    ne = ne + 1
-    write(*, 2009) 56, str
-  end if
-
-! 57: fgd_add_string check
-  call fgd_add_string(d, 'new12', 0)
-  e = fgd_error(d)
-
-  if (e .ne. GD_E_OK) then
-    ne = ne + 1
-    write(*, 2006) 57, 1, e
-  end if
-
-  n = fgd_get_string(d, 'new12', GD_FIELD_LEN, str)
-  e = fgd_error(d)
-
-  if (e .ne. GD_E_OK) then
-    ne = ne + 1
-    write(*, 2006) 57, 2, e
-  end if
-
-  if (str .ne. "") then
-    ne = ne + 1
-    write(*, 2009) 57, str
-  end if
-
-! 58: fgd_madd_string check
-  call fgd_madd_string(d, "data", 'mnew12')
-  e = fgd_error(d)
-
-  if (e .ne. GD_E_OK) then
-    ne = ne + 1
-    write(*, 2006) 58, 1, e
-  end if
-
-  n = fgd_get_string(d, 'data/mnew12', GD_FIELD_LEN, str)
-  e = fgd_error(d)
-
-  if (e .ne. GD_E_OK) then
-    ne = ne + 1
-    write(*, 2006) 58, 2, e
-  end if
-
-  if (str .ne. "") then
-    ne = ne + 1
-    write(*, 2009) 58, str
-  end if
-
-! 59: fgd_add_spec check
-  call fgd_add_spec(d, 'lorem STRING "Lorem ipsum"', 0)
-  e = fgd_error(d)
-
-  if (e .ne. GD_E_OK) then
-    ne = ne + 1
-    write(*, 2006) 59, 1, e
-  end if
-
-  n = fgd_get_string(d, 'lorem', GD_FIELD_LEN, str)
-  e = fgd_error(d)
-
-  if (e .ne. GD_E_OK) then
-    ne = ne + 1
-    write(*, 2006) 59, 2, e
-  end if
-
-  if (str .ne. "Lorem ipsum") then
-    ne = ne + 1
-    write(*, 2009) 59, str
-  end if
-
-! 60: fgd_madd_spec check
-  call fgd_madd_spec(d, 'ipsum STRING "dolor sit amet."', 'lorem')
-  e = fgd_error(d)
-
-  if (e .ne. GD_E_OK) then
-    ne = ne + 1
-    write(*, 2006) 60, 1, e
-  end if
-
-  n = fgd_get_string(d, 'lorem/ipsum', GD_FIELD_LEN, str)
-  e = fgd_error(d)
-
-  if (e .ne. GD_E_OK) then
-    ne = ne + 1
-    write(*, 2006) 60, 2, e
-  end if
-
-  if (str .ne. "dolor sit amet.") then
-    ne = ne + 1
-    write(*, 2009) 60, str
-  end if
-
-! 61: fgd_put_constant_i1 check
-  ci1(1) = 61
-  call fgd_put_constant_i1(d, 'const', ci1(1))
-  e = fgd_error(d)
-
-  if (e .ne. GD_E_OK) then
-    ne = ne + 1
-    write(*, 2006) 61, 1, e
-  end if
-
-  call fgd_get_constant_r4(d, 'const', fl)
-  e = fgd_error(d)
-
-  if (e .ne. GD_E_OK) then
-    ne = ne + 1
-    write(*, 2006) 61, 2, e
-  end if
-
-  if (abs(fl - 61) > 0.001) then
-    ne = ne + 1
-    write(*, 2005) 61, fl
-  end if
-
-! 127: fgd_put_constant_i2 check
-  ci2(1) = 127
-  call fgd_put_constant_i2(d, 'const', ci2(1))
-  e = fgd_error(d)
-
-  if (e .ne. GD_E_OK) then
-    ne = ne + 1
-    write(*, 2006) 127, 1, e
-  end if
-
-  call fgd_get_constant_r4(d, 'const', fl)
-  e = fgd_error(d)
-
-  if (e .ne. GD_E_OK) then
-    ne = ne + 1
-    write(*, 2006) 127, 2, e
-  end if
-
-  if (abs(fl - 127) > 0.001) then
-    ne = ne + 1
-    write(*, 2005) 127, fl
-  end if
-
-! 128: fgd_put_constant_i4 check
-  ci4(1) = 128
-  call fgd_put_constant_i4(d, 'const', ci4(1))
-  e = fgd_error(d)
-
-  if (e .ne. GD_E_OK) then
-    ne = ne + 1
-    write(*, 2006) 128, 1, e
-  end if
-
-  call fgd_get_constant_r4(d, 'const', fl)
-  e = fgd_error(d)
-
-  if (e .ne. GD_E_OK) then
-    ne = ne + 1
-    write(*, 2006) 128, 2, e
-  end if
-
-  if (abs(fl - 128) > 0.001) then
-    ne = ne + 1
-    write(*, 2005) 128, fl
-  end if
-
-! 129: fgd_put_constant_i8 check
-  ci8(1) = 129
-  call fgd_put_constant_i8(d, 'const', ci8(1))
-  e = fgd_error(d)
-
-  if (e .ne. GD_E_OK) then
-    ne = ne + 1
-    write(*, 2006) 129, 1, e
-  end if
-
-  call fgd_get_constant_r4(d, 'const', fl)
-  e = fgd_error(d)
-
-  if (e .ne. GD_E_OK) then
-    ne = ne + 1
-    write(*, 2006) 129, 2, e
-  end if
-
-  if (abs(fl - 129) > 0.001) then
-    ne = ne + 1
-    write(*, 2005) 129, fl
-  end if
-
-! 130: fgd_put_constant_r4 check
-  cr4(1) = 130
-  call fgd_put_constant_r4(d, 'const', cr4(1))
-  e = fgd_error(d)
-
-  if (e .ne. GD_E_OK) then
-    ne = ne + 1
-    write(*, 2006) 130, 1, e
-  end if
-
-  call fgd_get_constant_r4(d, 'const', fl)
-  e = fgd_error(d)
-
-  if (e .ne. GD_E_OK) then
-    ne = ne + 1
-    write(*, 2006) 130, 2, e
-  end if
-
-  if (abs(fl - 130) > 0.001) then
-    ne = ne + 1
-    write(*, 2005) 130, fl
-  end if
-
-! 131: fgd_put_constant_r8 check
-  cr8(1) = 131
-  call fgd_put_constant_r8(d, 'const', cr8(1))
-  e = fgd_error(d)
-
-  if (e .ne. GD_E_OK) then
-    ne = ne + 1
-    write(*, 2006) 131, 1, e
-  end if
-
-  call fgd_get_constant_r4(d, 'const', fl)
-  e = fgd_error(d)
-
-  if (e .ne. GD_E_OK) then
-    ne = ne + 1
-    write(*, 2006) 131, 2, e
-  end if
-
-  if (abs(fl - 131) > 0.001) then
-    ne = ne + 1
-    write(*, 2005) 131, fl
-  end if
-
-! 132: fgd_put_constant_c8 check
-  cc8(1) = 132
-  call fgd_put_constant_c8(d, 'const', cc8(1))
-  e = fgd_error(d)
-
-  if (e .ne. GD_E_OK) then
-    ne = ne + 1
-    write(*, 2006) 132, 1, e
-  end if
-
-  call fgd_get_constant_r4(d, 'const', fl)
-  e = fgd_error(d)
-
-  if (e .ne. GD_E_OK) then
-    ne = ne + 1
-    write(*, 2006) 132, 2, e
-  end if
-
-  if (abs(fl - 132) > 0.001) then
-    ne = ne + 1
-    write(*, 2005) 132, fl
-  end if
-
-! 133: fgd_put_constant_c16 check
-  cc16(1) = 133
-  call fgd_put_constant_c16(d, 'const', cc16(1))
-  e = fgd_error(d)
-
-  if (e .ne. GD_E_OK) then
-    ne = ne + 1
-    write(*, 2006) 133, 1, e
-  end if
-
-  call fgd_get_constant_r4(d, 'const', fl)
-  e = fgd_error(d)
-
-  if (e .ne. GD_E_OK) then
-    ne = ne + 1
-    write(*, 2006) 133, 2, e
-  end if
-
-  if (abs(fl - 133) > 0.001) then
-    ne = ne + 1
-    write(*, 2005) 133, fl
-  end if
-
-! 62: fgd_put_string check
-  n = fgd_put_string(d, 'string', "Arthur Dent")
-  e = fgd_error(d)
-
-  if (e .ne. GD_E_OK) then
-    ne = ne + 1
-    write(*, 2006) 62, 1, e
-  end if
-
-  if (n .ne. 11) then
-    ne = ne + 1
-    write(*, 2002) 62, n
-  end if
-
-  n = fgd_get_string(d, 'string', GD_FIELD_LEN, str)
-  e = fgd_error(d)
-
-  if (e .ne. GD_E_OK) then
-    ne = ne + 1
-    write(*, 2006) 62, 2, e
-  end if
-
-  if (str .ne. "Arthur Dent") then
-    ne = ne + 1
-    write(*, 2009) 62, str
-  end if
-
-! 63: fgd_nmfields_by_type check
-  n = fgd_nmfields_by_type(d, "data", GD_LINCOM_ENTRY)
-  e = fgd_error(d)
-
-  if (e .ne. GD_E_OK) then
-    ne = ne + 1
-    write(*, 2001) 63, e
-  end if
-
-  if (n .ne. 2) then
-    ne = ne + 1
-    write(*, 2002), 63, n
-  end if
-
-! 64: fgd_mfield_list_by_type check
-  fields(1) = 'mnew1'
-  fields(2) = 'mnew2'
-  l = flen
-  call fgd_mfield_list_by_type(flist, d, "data", GD_LINCOM_ENTRY, l)
-  e = fgd_error(d)
-
-  if (e .ne. GD_E_OK) then
-    ne = ne + 1
-    write(*, 2006) 64, i, e
-  end if
-
-  if (l .ne. flen) then
-    ne = ne + 1
-    write(*, 2007) 64, i, l
-  end if
-
-  do i = 1, n
-  if (flist(i) .ne. fields(i)) then
-    ne = ne + 1
-    write(*, 2008) i, 64, flist(i)
-  end if
-  end do
-
-! 65: fgd_nmvectors check
-  n = fgd_nmvectors(d, "data")
-  e = fgd_error(d)
-
-  if (e .ne. GD_E_OK) then
-    ne = ne + 1
-    write(*, 2001) 65, e
-  end if
-
-  if (n .ne. 11) then
-    ne = ne + 1
-    write(*, 2002), 65, n
-  end if
-
-! 66: fgd_mvector_list check
-  fields =(/ 'mlut  ', 'mnew1 ', 'mnew2 ', 'mnew3 ', 'mnew5 ', 'mnew6 ', &
-  'mnew7 ', 'mnew8 ', 'mnew9 ', 'mnew10', 'mnew4 ', '      ', '      ', &
-  '      ', '      ', '      ', '      ', '      ', '      ', '      ', &
-  '      ', '      ' /)
-  l = flen
-  call fgd_mvector_list(flist, d, "data", l)
-  e = fgd_error(d)
-
-  if (e .ne. GD_E_OK) then
-    ne = ne + 1
-    write(*, 2006) 66, i, e
-  end if
-
-  if (l .ne. flen) then
-    ne = ne + 1
-    write(*, 2007) 66, i, l
-  end if
-
-  do i=1,n
-  if (flist(i) .ne. fields(i)) then
-    ne = ne + 1
-    write(*, 2008) i, 66, flist(i)
-  end if
-  end do
-
-! 67: fgd_alter_raw check
-  call fgd_alter_raw(d, 'new1', GD_INT32, 4, 0)
-  e = fgd_error(d)
-
-  if (e .ne. GD_E_OK) then
-    ne = ne + 1
-    write(*, 2006) 67, 1, e
-  end if
-
-  n = fgd_entry(d, 'new1', ent)
-  e = fgd_error(d)
-
-  if (e .ne. GD_E_OK) then
-    ne = ne + 1
-    write(*, 2006) 67, 2, e
-  end if
-
-  if (ent%fragment_index .ne. 0) then
-    ne = ne + 1
-    write(*, 2007) 67, 3, ent%fragment_index
-  end if
-
-  if (ent%spf .ne. 4) then
-    ne = ne + 1
-    write(*, 2007) 67, 4, ent%spf
-  end if
-
-  if (ent%data_type .ne. GD_INT32) then
-    ne = ne + 1
-    write(*, 2007) 67, 5, ent%data_type
-  end if
-
-  if (n .ne. GD_RAW_ENTRY) then
-    ne = ne + 1
-    write(*, 2007), 67, 6, n
-  end if
-
-! 68: fgd_alter_lincom check
-  call fgd_alter_lincom(d, 'new2', 3, 'in4', 9.9d-1, 7.8d0, 'in5', &
-     1.1d1, 2.2d-2, 'in6', 1.96d0, 0d0)
-  e = fgd_error(d)
-
-  if (e .ne. GD_E_OK) then
-    ne = ne + 1
-    write(*, 2006) 68, 1, e
-  end if
-
-  n = fgd_entry(d, 'new2', ent)
-  e = fgd_error(d)
-
-  if (e .ne. GD_E_OK) then
-    ne = ne + 1
-    write(*, 2006) 68, 2, e
-  end if
-
-  if (n .ne. GD_LINCOM_ENTRY) then
-    ne = ne + 1
-    write(*, 2007) 68, 3, n
-  end if
-
-  if (ent%n_fields .ne. 3) then
-    ne = ne + 1
-    write(*, 2007) 68, 4, ent%n_fields
-  end if
-
-  if (ent%fragment_index .ne. 0) then
-    ne = ne + 1
-    write(*, 2007) 68, 5, ent%fragment_index
-  end if
-
-  if (ent%field(1) .ne. 'in4') then
-    ne = ne + 1
-    write(*, 2008) 68, 6, ent%field(1)
-  end if
-
-  if (ent%field(2) .ne. 'in5') then
-    ne = ne + 1
-    write(*, 2008) 68, 7, ent%field(2)
-  end if
-
-  if (ent%field(3) .ne. 'in6') then
-    ne = ne + 1
-    write(*, 2008) 68, 8, ent%field(3)
-  end if
-
-  if (ent%comp_scal .ne. 0) then
-    ne = ne + 1
-    write(*, 2007) 68, 5, ent%comp_scal
-  end if
-
-  q = (/ 9.9d-1, 7.8d0, 1.1d1, 2.2d-2, 1.96d0, 0d0 /)
-  DO i=1,3
-  if (abs(ent%m(i) - q(i * 2 - 1)) > 0.001) then
-    ne = ne + 1
-    write(*, 2010) i * 2 - 1, 68, ent%m(i)
-  end if
-  if (abs(ent%b(i) - q(i * 2)) > 0.001) then
-    ne = ne + 1
-    write(*, 2010) i * 2, 68, ent%b(i)
-  end if
-  end do
-
-! 69: fgd_alter_clincom check
-  cq(1) = dcmplx(0.1, 0.2)
-  cq(2) = dcmplx(0.3, 0.4)
-  cq(3) = dcmplx(0.4, 0.5)
-  cq(4) = dcmplx(0.6, 0.7)
-  call fgd_alter_clincom(d, 'new3', 2, 'in4', cq(1), cq(2), 'in3', &
-     cq(3), cq(4), '', cq(5), cq(6))
-  e = fgd_error(d)
-
-  if (e .ne. GD_E_OK) then
-    ne = ne + 1
-    write(*, 2006) 69, 1, e
-  end if
-
-  n = fgd_entry(d, 'new3', ent)
-  e = fgd_error(d)
-
-  if (e .ne. GD_E_OK) then
-    ne = ne + 1
-    write(*, 2001) 69, e
-  end if
-
-  if (n .ne. GD_LINCOM_ENTRY) then
-    ne = ne + 1
-    write(*, 2007) 69, 1, n
-  end if
-
-  if (ent%n_fields .ne. 2) then
-    ne = ne + 1
-    write(*, 2007) 69, 2, ent%n_fields
-  end if
-
-  if (ent%fragment_index .ne. 0) then
-    ne = ne + 1
-    write(*, 2007) 69, 3, ent%fragment_index
-  end if
-
-  if (ent%field(1) .ne. 'in4') then
-    ne = ne + 1
-    write(*, 2008) 69, 4, ent%field(1)
-  end if
-
-  if (ent%field(2) .ne. 'in3') then
-    ne = ne + 1
-    write(*, 2008) 69, 5, ent%field(2)
-  end if
-
-  if (ent%comp_scal .ne. 1) then
-    ne = ne + 1
-    write(*, 2007) 69, 6, ent%comp_scal
-  end if
-
-  cq(1) = dcmplx(0.1, 0.2)
-  cq(2) = dcmplx(0.3, 0.4)
-  cq(3) = dcmplx(0.4, 0.5)
-  cq(4) = dcmplx(0.6, 0.7)
-  DO i=1,2
-  if (abs(ent%cm(i) - cq(i * 2 - 1)) > 0.001) then
-    ne = ne + 1
-    write(*, 2011) i * 2 - 1, 69, real(real(ent%cm(i))), real(aimag(ent%cm(i)))
-  end if
-  if (abs(ent%cb(i) - cq(i * 2)) > 0.001) then
-    ne = ne + 1
-    write(*, 2011) i * 2, 69, real(real(ent%cb(i))), real(aimag(ent%cb(i)))
-  end if
-  end do
-
-! 70: fgd_alter_polynom check
-  call fgd_alter_polynom(d, 'new4', 4, 'in1', 3d0, 4d0, 5d0, 6d0, 7d0, 0d0)
-  e = fgd_error(d)
-
-  if (e .ne. GD_E_OK) then
-    ne = ne + 1
-    write(*, 2006) 70, 1, e
-  end if
-
-  n = fgd_entry(d, 'new4', ent)
-  e = fgd_error(d)
-
-  if (e .ne. GD_E_OK) then
-    ne = ne + 1
-    write(*, 2006) 70, 2, e
-  end if
-
-  if (n .ne. GD_POLYNOM_ENTRY) then
-    ne = ne + 1
-    write(*, 2007) 70, 1, n
-  end if
-
-  if (ent%poly_ord .ne. 4) then
-    ne = ne + 1
-    write(*, 2007) 70, 2, ent%poly_ord
-  end if
-
-  if (ent%fragment_index .ne. 0) then
-    ne = ne + 1
-    write(*, 2007) 70, 3, ent%fragment_index
-  end if
-
-  if (ent%field(1) .ne. 'in1') then
-    ne = ne + 1
-    write(*, 2008) 70, 4, ent%field(1)
-  end if
-
-  q = (/ 3d0, 4d0, 5d0, 6d0, 7d0, 0d0 /)
-  DO i=1,5
-  if (abs(ent%a(i) - q(i)) > 0.001) then
-    ne = ne + 1
-    write(*, 2010) i, 70, ent%a(i)
-  end if
-  end do
-
-! 71: fgd_alter_cpolynom check
-  cq(1) = dcmplx(1.1, 5.0)
-  cq(2) = dcmplx(1.2, 4.0)
-  cq(3) = dcmplx(1.2, 3.0)
-  cq(4) = dcmplx(1.3, 2.4)
-  call fgd_alter_cpolynom(d, 'new5', 3, 'in1', cq(1), cq(2), cq(3), &
-  cq(4), dcmplx(0d0,0d0), dcmplx(0d0,0d0))
-  e = fgd_error(d)
-
-  if (e .ne. GD_E_OK) then
-    ne = ne + 1
-    write(*, 2006) 71, 1, e
-  end if
-
-  n = fgd_entry(d, 'new5', ent)
-  e = fgd_error(d)
-
-  if (e .ne. GD_E_OK) then
-    ne = ne + 1
-    write(*, 2006) 71, 2, e
-  end if
-
-  if (n .ne. GD_POLYNOM_ENTRY) then
-    ne = ne + 1
-    write(*, 2007) 71, 1, n
-  end if
-
-  if (ent%poly_ord .ne. 3) then
-    ne = ne + 1
-    write(*, 2007) 71, 2, ent%poly_ord
-  end if
-
-  if (ent%fragment_index .ne. 0) then
-    ne = ne + 1
-    write(*, 2007) 71, 3, ent%fragment_index
-  end if
-
-  if (ent%field(1) .ne. 'in1') then
-    ne = ne + 1
-    write(*, 2008) 71, 4, ent%field(1)
-  end if
-
-  if (ent%comp_scal .ne. 1) then
-    ne = ne + 1
-    write(*, 2007) 71, 5, ent%comp_scal
-  end if
-
-  cq(1) = dcmplx(1.1, 5.0)
-  cq(2) = dcmplx(1.2, 4.0)
-  cq(3) = dcmplx(1.2, 3.0)
-  cq(4) = dcmplx(1.3, 2.4)
-  DO 710 i=1,4
-  if (abs(ent%ca(i) - cq(i)) > 0.001) then
-    ne = ne + 1
-    write(*, 2011) i, 71, real(real(ent%ca(i))), real(aimag(ent%ca(i)))
-  end if
-  710 CONTINUE
-
-! 72: fgd_alter_linterp check
-  call fgd_alter_linterp(d, "new6", "in3", "./other/table", 0)
-  e = fgd_error(d)
-
-  if (e .ne. GD_E_OK) then
-    ne = ne + 1
-    write(*, 2006) 72, 1, e
-  end if
-
-  n = fgd_entry(d, 'new6', ent)
-  e = fgd_error(d)
-
-  if (e .ne. GD_E_OK) then
-    ne = ne + 1
-    write(*, 2006) 72, 2, e
-  end if
-
-  if (n .ne. GD_LINTERP_ENTRY) then
-    ne = ne + 1
-    write(*, 2007) 72, 1, n
-  end if
-
-  if (ent%fragment_index .ne. 0) then
-    ne = ne + 1
-    write(*, 2007) 72, 2, ent%fragment_index
-  end if
-
-  if (ent%field(1) .ne. 'in3') then
-    ne = ne + 1
-    write(*, 2008) 72, 3, ent%field(1)
-  end if
-
-  if (ent%field(2) .ne. './other/table') then
-    ne = ne + 1
-    write(*, 2008) 72, 4, ent%field(2)
-  end if
-
-! 73: fgd_alter_bit check
-  call fgd_alter_bit(d, "new7", "in3", 3, 2)
-  e = fgd_error(d)
-
-  if (e .ne. GD_E_OK) then
-    ne = ne + 1
-    write(*, 2006) 73, 1, e
-  end if
-
-  n = fgd_entry(d, 'new7', ent)
-  e = fgd_error(d)
-
-  if (e .ne. GD_E_OK) then
-    ne = ne + 1
-    write(*, 2006) 73, 2, e
-  end if
-
-  if (n .ne. GD_BIT_ENTRY) then
-    ne = ne + 1
-    write(*, 2007) 73, 1, n
-  end if
-
-  if (ent%fragment_index .ne. 0) then
-    ne = ne + 1
-    write(*, 2007) 73, 2, ent%fragment_index
-  end if
-
-  if (ent%numbits .ne. 2) then
-    ne = ne + 1
-    write(*, 2007) 73, 3, ent%numbits
-  end if
-
-  if (ent%bitnum .ne. 3) then
-    ne = ne + 1
-    write(*, 2007) 73, 4, ent%bitnum
-  end if
-
-  if (ent%field(1) .ne. 'in3') then
-    ne = ne + 1
-    write(*, 2008) 73, 5, ent%field(1)
-  end if
-
-! 74: fgd_alter_sbit check
-  call fgd_alter_sbit(d, "new8", "out", 1, 22)
-  e = fgd_error(d)
-
-  if (e .ne. GD_E_OK) then
-    ne = ne + 1
-    write(*, 2006) 74, 1, e
-  end if
-
-  n = fgd_entry(d, 'new8', ent)
-  e = fgd_error(d)
-
-  if (e .ne. GD_E_OK) then
-    ne = ne + 1
-    write(*, 2006) 74, 2, e
-  end if
-
-  if (n .ne. GD_SBIT_ENTRY) then
-    ne = ne + 1
-    write(*, 2007) 74, 1, n
-  end if
-
-  if (ent%fragment_index .ne. 0) then
-    ne = ne + 1
-    write(*, 2007) 74, 2, ent%fragment_index
-  end if
-
-  if (ent%numbits .ne. 22) then
-    ne = ne + 1
-    write(*, 2007) 74, 3, ent%numbits
-  end if
-
-  if (ent%bitnum .ne. 1) then
-    ne = ne + 1
-    write(*, 2007) 74, 4, ent%bitnum
-  end if
-
-  if (ent%field(1) .ne. 'out') then
-    ne = ne + 1
-    write(*, 2008) 74, 5, ent%field(1)
-  end if
-
-! 75: fgd_alter_multiply check
-  call fgd_alter_multiply(d, 'new9', 'in6', 'in4')
-  e = fgd_error(d)
-
-  if (e .ne. GD_E_OK) then
-    ne = ne + 1
-    write(*, 2006) 75, 1, e
-  end if
-
-  n = fgd_entry(d, 'new9', ent)
-  e = fgd_error(d)
-
-  if (e .ne. GD_E_OK) then
-    ne = ne + 1
-    write(*, 2006) 75, 2, e
-  end if
-
-  if (n .ne. GD_MULTIPLY_ENTRY) then
-    ne = ne + 1
-    write(*, 2007) 75, 1, n
-  end if
-
-  if (ent%fragment_index .ne. 0) then
-    ne = ne + 1
-    write(*, 2007) 75, 2, ent%fragment_index
-  end if
-
-  if (ent%field(1) .ne. 'in6') then
-    ne = ne + 1
-    write(*, 2008) 75, 3, ent%field(1)
-  end if
-
-  if (ent%field(2) .ne. 'in4') then
-    ne = ne + 1
-    write(*, 2008) 75, 4, ent%field(2)
-  end if
-
-! 76: fgd_alter_phase check
-  call fgd_alter_phase(d, 'new10', 'in2', 8)
-  e = fgd_error(d)
-
-  if (e .ne. GD_E_OK) then
-    ne = ne + 1
-    write(*, 2006) 76, 1, e
-  end if
-
-  n = fgd_entry(d, 'new10', ent)
-  e = fgd_error(d)
-
-  if (e .ne. GD_E_OK) then
-    ne = ne + 1
-    write(*, 2006) 76, 2, e
-  end if
-
-  if (n .ne. GD_PHASE_ENTRY) then
-    ne = ne + 1
-    write(*, 2007) 76, 1, n
-  end if
-
-  if (ent%fragment_index .ne. 0) then
-    ne = ne + 1
-    write(*, 2007) 76, 2, ent%fragment_index
-  end if
-
-  if (ent%shift .ne. 8) then
-    ne = ne + 1
-    write(*, 2007) 76, 3, ent%shift
-  end if
-
-  if (ent%field(1) .ne. 'in2') then
-    ne = ne + 1
-    write(*, 2008) 76, 4, ent%field(1)
-  end if
-
-! 77: fgd_alter_const check
-  call fgd_alter_const(d, 'new11', GD_FLOAT32)
-  e = fgd_error(d)
-
-  if (e .ne. GD_E_OK) then
-    ne = ne + 1
-    write(*, 2006) 77, 1, e
-  end if
-
-  n = fgd_entry(d, 'new11', ent)
-  e = fgd_error(d)
-
-  if (e .ne. GD_E_OK) then
-    ne = ne + 1
-    write(*, 2006) 77, 2, e
-  end if
-
-  if (n .ne. GD_CONST_ENTRY) then
-    ne = ne + 1
-    write(*, 2007) 77, 1, n
-  end if
-
-  if (ent%fragment_index .ne. 0) then
-    ne = ne + 1
-    write(*, 2007) 77, 2, ent%fragment_index
-  end if
-
-  if (ent%data_type .ne. GD_FLOAT32) then
-    ne = ne + 1
-    write(*, 2007) 77, 3, ent%data_type
-  end if
-
-  call fgd_get_constant_r4(d, 'new11', fl)
-  e = fgd_error(d)
-
-  if (e .ne. GD_E_OK) then
-    ne = ne + 1
-    write(*, 2006) 77, 3, e
-  end if
-
-  if (abs(fl) > 0.001) then
-    ne = ne + 1
-    write(*, 2005) 77, fl
-  end if
-
-! 78: fgd_encoding check
-  n = fgd_encoding(d, 0)
-  e = fgd_error(d)
-
-  if (e .ne. GD_E_OK) then
-    ne = ne + 1
-    write(*, 2001) 78, e
-  end if
-
-  if (n .ne. GD_UNENCODED) then
-    ne = ne + 1
-    write(*, 2002) 78, n
-  end if
-
-! 79: fgd_endianness check
-  n = fgd_endianness(d, 0)
-  e = fgd_error(d)
-
-  if (e .ne. GD_E_OK) then
-    ne = ne + 1
-    write(*, 2001) 79, e
-  end if
-
-  if (n .ne. (GD_LITTLE_ENDIAN + GD_NOT_ARM_ENDIAN)) then
-    ne = ne + 1
-    write(*, 2002) 79, n
-  end if
-
-! 80: fgd_dirfilename check
-  l = GD_FIELD_LEN
-  call fgd_dirfilename(str, l, d, 0)
-  e = fgd_error(d)
-
-  if (e .ne. GD_E_OK) then
-    ne = ne + 1
-    write(*, 2001) 80, e
-  end if
-
-  if (l .ne. GD_FIELD_LEN) then
-    ne = ne + 1
-    write(*, 2002) 80, l
-  end if
-
-  if (str .ne. 'test95_dirfile') then
-    ne = ne + 1
-    write(*, 2009) 80, str
-  end if
-
-! 81: fgd_parent_fragment check
-  n = fgd_parent_fragment(d, 1)
-  e = fgd_error(d)
-
-  if (e .ne. GD_E_OK) then
-    ne = ne + 1
-    write(*, 2001) 81, e
-  end if
-
-  if (n .ne. 0) then
-    ne = ne + 1
-    write(*, 2002) 81, n
-  end if
-
-! 82: fgd_alter_protection check
-  call fgd_alter_protection(d, GD_PROTECT_DATA, 1)
-  e = fgd_error(d)
-
-  if (e .ne. GD_E_OK) then
-    ne = ne + 1
-    write(*, 2001) 82, e
-  end if
-
-! 83: fgd_protection check
-  n = fgd_protection(d, 1)
-  e = fgd_error(d)
-
-  if (e .ne. GD_E_OK) then
-    ne = ne + 1
-    write(*, 2001) 83, e
-  end if
-
-  if (n .ne. GD_PROTECT_DATA) then
-    ne = ne + 1
-    write(*, 2002) 83, n
-  end if
-
-! 84: fgd_raw_filename check
-  str = fgd_raw_filename(d, "data")
-  e = fgd_error(d)
-
-  if (e .ne. GD_E_OK) then
-    ne = ne + 1
-    write(*, 2001) 84, e
-  end if
-
-  if (str .ne. 'test95_dirfile/data') then
-    ne = ne + 1
-    write(*, 2009) 84, str
-  end if
-
-! 85: fgd_reference check
-  str = fgd_reference(d, "new1")
-  e = fgd_error(d)
-
-  if (e .ne. GD_E_OK) then
-    ne = ne + 1
-    write(*, 2001) 85, e
-  end if
-
-  if (str .ne. 'new1') then
-    ne = ne + 1
-    write(*, 2009) 85, str
-  end if
-
-! 87: fgd_alter_encoding check
-  call fgd_alter_encoding(d, GD_SLIM_ENCODED, 1, 0)
-  e = fgd_error(d)
+! 32: fgd_add_cpolynom check
+  cq(1) = dcmplx(3.1, 7.0)
+  cq(2) = dcmplx(4.2, 8.0)
+  cq(3) = dcmplx(5.2, 9.0)
+  cq(4) = dcmplx(6.3, 4.4)
+  call fgd_add_cpolynom(d, 'new5', 3, 'in1', cq(1), cq(2), cq(3), cq(4), &
+  dcmplx(0d0,0d0), dcmplx(0d0,0d0), 0)
+  call check_ok2(ne, 32, 1, d)
 
-  if (e .ne. GD_E_OK) then
-    ne = ne + 1
-    write(*, 2006) 87, 1, e
-  end if
+  n = fgd_entry(d, 'new5', ent)
+  call check_ok2(ne, 32, 2, d)
+  call check_int2(ne, 32, 1, n, GD_POLYNOM_ENTRY)
+  call check_int2(ne, 32, 2, ent%poly_ord, 3)
+  call check_int2(ne, 32, 3, ent%fragment_index, 0)
+  call check_str2(ne, 32, 4, ent%field(1), 'in1')
+  call check_int2(ne, 31, 5, ent%comp_scal, 1)
 
-  n = fgd_encoding(d, 1)
-  e = fgd_error(d)
+  cq(1) = dcmplx(3.1, 7.0)
+  cq(2) = dcmplx(4.2, 8.0)
+  cq(3) = dcmplx(5.2, 9.0)
+  cq(4) = dcmplx(6.3, 4.4)
+  DO i=1,4
+  call check_cpx2(ne, 32, i, ent%ca(i), cq(i))
+  end do
 
-  if (e .ne. GD_E_OK) then
-    ne = ne + 1
-    write(*, 2006) 87, 2, e
-  end if
+! 33: fgd_add_linterp check
+  call fgd_add_linterp(d, "new6", "in", "./some/table", 0)
+  call check_ok2(ne, 33, 1, d)
 
-  if (n .ne. GD_SLIM_ENCODED) then
-    ne = ne + 1
-    write(*, 2002) 87, n
-  end if
+  n = fgd_entry(d, 'new6', ent)
+  call check_ok2(ne, 33, 2, d)
+  call check_int2(ne, 33, 1, n, GD_LINTERP_ENTRY)
+  call check_int2(ne, 33, 2, ent%fragment_index, 0)
+  call check_str2(ne, 33, 3, ent%field(1), 'in')
+  call check_str2(ne, 33, 4, ent%field(2), './some/table')
 
-! 88: fgd_alter_endianness check
-  call fgd_alter_endianness(d, GD_BIG_ENDIAN, 1, 0)
-  e = fgd_error(d)
+! 34: fgd_add_bit check
+  call fgd_add_bit(d, "new7", "in", 13, 12, 0)
+  call check_ok2(ne, 34, 1, d)
 
-  if (e .ne. GD_E_OK) then
-    ne = ne + 1
-    write(*, 2006) 88, 1, e
-  end if
+  n = fgd_entry(d, 'new7', ent)
+  call check_ok2(ne, 34, 2, d)
+  call check_int2(ne, 34, 1, n, GD_BIT_ENTRY)
+  call check_int2(ne, 34, 2, ent%fragment_index, 0)
+  call check_int2(ne, 34, 3, ent%numbits, 12)
+  call check_int2(ne, 34, 4, ent%bitnum, 13)
+  call check_str2(ne, 34, 5, ent%field(1), 'in')
 
-  n = fgd_endianness(d, 1)
-  e = fgd_error(d)
+! 35: fgd_add_sbit check
+  call fgd_add_sbit(d, "new8", "in", 13, 12, 0)
+  call check_ok2(ne, 35, 1, d)
 
-  if (e .ne. GD_E_OK) then
-    ne = ne + 1
-    write(*, 2006) 88, 2, e
-  end if
+  n = fgd_entry(d, "new8", ent)
+  call check_ok2(ne, 35, 2, d)
+  call check_int2(ne, 35, 1, n, GD_SBIT_ENTRY)
+  call check_int2(ne, 35, 2, ent%fragment_index, 0)
+  call check_int2(ne, 35, 3, ent%numbits, 12)
+  call check_int2(ne, 35, 4, ent%bitnum, 13)
+  call check_str2(ne, 35, 5, ent%field(1), 'in')
 
-  if (n .ne. GD_BIG_ENDIAN) then
-    ne = ne + 1
-    write(*, 2002) 88, n
-  end if
+! 36: fgd_add_multiply check
+  call fgd_add_multiply(d, 'new9', 'in1', 'in2', 0)
+  call check_ok2(ne, 36, 1, d)
 
-! 89: fgd_alter_spec check
-  call fgd_alter_spec(d, 'new10 PHASE in1 3', 0)
-  e = fgd_error(d)
+  n = fgd_entry(d, 'new9', ent)
+  call check_ok2(ne, 36, 2, d)
+  call check_int2(ne, 36, 1, n, GD_MULTIPLY_ENTRY)
+  call check_int2(ne, 36, 2, ent%fragment_index, 0)
+  call check_str2(ne, 36, 3, ent%field(1), 'in1')
+  call check_str2(ne, 36, 4, ent%field(2), 'in2')
 
-  if (e .ne. GD_E_OK) then
-    ne = ne + 1
-    write(*, 2006) 89, 1, e
-  end if
+! 37: fgd_add_phase check
+  call fgd_add_phase(d, 'new10', 'in1', 22, 0)
+  call check_ok2(ne, 37, 1, d)
 
   n = fgd_entry(d, 'new10', ent)
-  e = fgd_error(d)
-
-  if (e .ne. GD_E_OK) then
-    ne = ne + 1
-    write(*, 2006) 89, 2, e
-  end if
+  call check_ok2(ne, 37, 2, d)
+  call check_int2(ne, 37, 1, n, GD_PHASE_ENTRY)
+  call check_int2(ne, 37, 2, ent%fragment_index, 0)
+  call check_int2(ne, 37, 3, ent%shift, 22)
+  call check_str2(ne, 37, 4, ent%field(1), 'in1')
 
-  if (n .ne. GD_PHASE_ENTRY) then
-    ne = ne + 1
-    write(*, 2007) 89, 1, l
-  end if
+! 38: fgd_add_const check
+  call fgd_add_const(d, 'new11', GD_FLOAT64, 0)
+  call check_ok2(ne, 38, 1, d)
 
-  if (ent%fragment_index .ne. 0) then
-    ne = ne + 1
-    write(*, 2007) 89, 2, ent%fragment_index
-  end if
+  n = fgd_entry(d, 'new11', ent)
+  call check_ok2(ne, 38, 2, d)
+  call check_int2(ne, 38, 1, n, GD_CONST_ENTRY)
+  call check_int2(ne, 38, 2, ent%fragment_index, 0)
+  call check_int2(ne, 38, 3, ent%data_type, GD_FLOAT64)
 
-  if (ent%shift .ne. 3) then
-    ne = ne + 1
-    write(*, 2007) 89, 3, ent%shift
-  end if
+  call fgd_get_constant_r4(d, 'new11', fl)
+  call check_ok2(ne, 38, 3, d)
+  call check_dbl(ne, 38, 1d0 * fl, 0d0)
 
-  if (ent%field(1) .ne. 'in1') then
-    ne = ne + 1
-    write(*, 2008) 89, 4, ent%field(1)
-  end if
+! 125: fgd_add check
+  ent%shift = 33
+  ent%field(1) = 'new9'
+  ent%fragment_index = 0
+  ent%field_type = GD_PHASE_ENTRY
+  call fgd_add(d, 'new13', ent)
+  call check_ok2(ne, 125, 1, d)
 
-! 90: fgd_delete check
-  call fgd_delete(d, 'new10', 0)
-  e = fgd_error(d)
+  n = fgd_entry(d, 'new13', ent)
+  call check_ok2(ne, 125, 2, d)
+  call check_int2(ne, 125, 1, n, GD_PHASE_ENTRY)
+  call check_int2(ne, 125, 2, ent%fragment_index, 0)
+  call check_int2(ne, 125, 3, ent%shift, 33)
+  call check_str2(ne, 125, 4, ent%field(1), 'new9')
 
-  if (e .ne. GD_E_OK) then
-    ne = ne + 1
-    write(*, 2006) 90, 1, e
-  end if
+! 39: fgd_fragmentname check
+  str = fgd_fragmentname(d, 0)
+  call check_ok(ne, 39, d)
+  call check_eos(ne, 39, str, 'test95_dirfile'//DIRSEP//'format')
 
-  n = fgd_entry(d, 'new10', ent)
-  e = fgd_error(d)
+! 40: fgd_nfragments check
+  n = fgd_nfragments(d)
+  call check_ok(ne, 40, d)
+  call check_int(ne, 40, n, 1)
 
-  if (e .ne. GD_E_BAD_CODE) then
-    ne = ne + 1
-    write(*, 2006) 90, 2, e
-  end if
+! 41: fgd_include check
+  call fgd_include(d, 'form2', 0, 0)
+  call check_ok2(ne, 41, 3, d)
 
-! 91: fgd_malter_spec check
-  call fgd_malter_spec(d, 'mnew10 PHASE in4 11', 'data', 0)
-  e = fgd_error(d)
+  call fgd_get_constant_i1(d, 'const2', ci1(1))
+  call check_ok2(ne, 41, 3, d)
+  call check_int2(ne, 1, 41, int(ci1(1)), -19)
 
-  if (e .ne. GD_E_OK) then
-    ne = ne + 1
-    write(*, 2006) 91, 1, e
-  end if
+! 42: fgd_nfields_by_type check
+  n = fgd_nfields_by_type(d, GD_LINCOM_ENTRY)
+  call check_ok(ne, 42, d)
+  call check_int(ne, 42, n, 3)
 
-  n = fgd_entry(d, 'data/mnew10', ent)
-  e = fgd_error(d)
+! 43: fgd_field_list_by_type check
+  fields(1) = 'lincom'
+  fields(2) = 'new2'
+  fields(3) = 'new3'
+  l = flen
+  call fgd_field_list_by_type(flist, d, GD_LINCOM_ENTRY, l)
+  call check_ok(ne, 43, d)
+  call check_int(ne, 43, l, flen)
 
-  if (e .ne. GD_E_OK) then
-    ne = ne + 1
-    write(*, 2006) 91, 2, e
-  end if
+  do i = 1, n
+  call check_str2(ne, 43, i, flist(i), fields(i))
+  end do
 
-  if (n .ne. GD_PHASE_ENTRY) then
-    ne = ne + 1
-    write(*, 2007) 91, 1, n
-  end if
+! 44: fgd_nvectors check
+  n = fgd_nvectors(d)
+  call check_ok(ne, 44, d)
+  call check_int(ne, 44, n, 25)
 
-  if (ent%fragment_index .ne. 0) then
-    ne = ne + 1
-    write(*, 2007) 91, 2, ent%fragment_index
-  end if
+! 45: fgd_vector_list check
+  fields = (/    'INDEX      ', 'alias      ', 'bit        ', 'data       ', &
+  'div        ', 'lincom     ', 'linterp    ', 'mplex      ', 'mult       ', &
+  'new1       ', 'new10      ', 'new13      ', 'new2       ', 'new3       ', &
+  'new4       ', 'new5       ', 'new6       ', 'new7       ', 'new8       ', &
+  'new9       ', 'phase      ', 'polynom    ', 'recip      ', 'sbit       ', &
+  'window     ', '           ', '           ', '           ' /)
+  l = flen
+  call fgd_vector_list(flist, d, l)
+  call check_ok(ne, 45, d)
+  call check_int(ne, 45, l, flen)
+ 
+  do i=1,n
+  call check_str2(ne, 45, i, flist(i), fields(i))
+  end do
 
-  if (ent%shift .ne. 11) then
-    ne = ne + 1
-    write(*, 2007) 91, 3, ent%shift
-  end if
+! 46: fgd_madd_lincom check
+  call fgd_madd_lincom(d, 'data', 'mnew1', 2, 'in1', 9.9d0, 8.8d0, &
+  'in2', 7.7d0, 6.6d0, '', 0d0, 0d0)
+  call check_ok2(ne, 46, 1, d)
 
-  if (ent%field(1) .ne. 'in4') then
-    ne = ne + 1
-    write(*, 2008) 91, 4, ent%field(1)
-  end if
+  n = fgd_entry(d, 'data/mnew1', ent)
+  call check_ok2(ne, 46, 2, d)
+  call check_int2(ne, 46, 3, n, GD_LINCOM_ENTRY)
+  call check_int2(ne, 46, 4, ent%n_fields, 2)
+  call check_int2(ne, 46, 5, ent%fragment_index, 0)
+  call check_str2(ne, 46, 6, ent%field(1), 'in1')
+  call check_str2(ne, 46, 7, ent%field(2), 'in2')
+  call check_int2(ne, 46, 8, ent%comp_scal, 0)
 
-! 92: fgd_move check
-  call fgd_move(d, 'new9', 1, 0)
-  e = fgd_error(d)
+  q = (/ 9.9, 8.8, 7.7, 6.6, 5.5, 5.5 /)
+  DO i=1,2
+  call check_dbl2(ne, 46, i * 2 - 1, ent%m(i), q(i *  2 - 1))
+  call check_dbl2(ne, 46, i * 2, ent%b(i), q(i * 2))
+  end do
 
-  if (e .ne. GD_E_OK) then
-    ne = ne + 1
-    write(*, 2006) 92, 1, e
-  end if
+! 47: fgd_madd_clincom check
+  cq(1) = dcmplx(1.1, 1.2)
+  cq(2) = dcmplx(1.3, 1.4)
+  cq(3) = dcmplx(1.4, 1.5)
+  cq(4) = dcmplx(1.6, 1.7)
+  call fgd_madd_clincom(d, 'data', 'mnew2', 2, 'in1', cq(1), cq(2), &
+  'in2', cq(3), cq(4), '', cq(5), cq(6))
+  call check_ok2(ne, 47, 1, d)
 
-  n = fgd_entry(d, 'new9', ent)
-  e = fgd_error(d)
+  n = fgd_entry(d, 'data/mnew2', ent)
+  call check_ok(ne, 47, d)
+  call check_int2(ne, 47, 1, n, GD_LINCOM_ENTRY)
+  call check_int2(ne, 47, 2, ent%n_fields, 2)
+  call check_int2(ne, 47, 3, ent%fragment_index, 0)
+  call check_str2(ne, 47, 4, ent%field(1), 'in1')
+  call check_str2(ne, 47, 5, ent%field(2), 'in2')
+  call check_int2(ne, 47, 6, ent%comp_scal, 1)
 
-  if (e .ne. GD_E_OK) then
-    ne = ne + 1
-    write(*, 2006) 92, 2, e
-  end if
+  cq(1) = dcmplx(1.1, 1.2)
+  cq(2) = dcmplx(1.3, 1.4)
+  cq(3) = dcmplx(1.4, 1.5)
+  cq(4) = dcmplx(1.6, 1.7)
+  DO i=1,2
+  call check_cpx2(ne, 47, i * 2 - 1, ent%cm(i), cq(i * 2 - 1))
+  call check_cpx2(ne, 47, i * 2, ent%cb(i), cq(i * 2))
+  end do
 
-  if (n .ne. GD_MULTIPLY_ENTRY) then
-    ne = ne + 1
-    write(*, 2007) 92, 1, n
-  end if
+! 48: fgd_madd_polynom check
+  call fgd_madd_polynom(d, 'data', 'mnew3', 3, 'in1', 3d3, 4d4, 5d5, &
+     6d6, 0d0, 0d0)
+  call check_ok2(ne, 48, 1, d)
 
-  if (ent%fragment_index .ne. 1) then
-    ne = ne + 1
-    write(*, 2007) 92, 2, ent%fragment_index
-  end if
+  n = fgd_entry(d, 'data/mnew3', ent)
+  call check_ok2(ne, 48, 2, d)
+  call check_int2(ne, 48, 1, n, GD_POLYNOM_ENTRY)
+  call check_int2(ne, 48, 2, ent%poly_ord, 3)
+  call check_int2(ne, 48, 3, ent%fragment_index, 0)
+  call check_str2(ne, 48, 4, ent%field(1), 'in1')
 
-  if (ent%field(1) .ne. 'in6') then
-    ne = ne + 1
-    write(*, 2008) 92, 3, ent%field(1)
-  end if
+  q = (/ 3d3, 4d4, 5d5, 6d6, 5.5d0, 5.5d0 /)
+  DO i=1,4
+  call check_dbl2(ne, 48, i, ent%a(i), q(i))
+  end do
 
-  if (ent%field(2) .ne. 'in4') then
-    ne = ne + 1
-    write(*, 2008) 92, 4, ent%field(2)
-  end if
+! 49: fgd_madd_cpolynom check
+  cq(1) = dcmplx(1.1, 0.0)
+  cq(2) = dcmplx(2.2, 0.0)
+  cq(3) = dcmplx(2.2, 0.0)
+  cq(4) = dcmplx(3.3, 4.4)
+  call fgd_madd_cpolynom(d, 'data', 'mnew5', 3, 'in1', cq(1), cq(2), &
+     cq(3), cq(4), dcmplx(0d0,0d0), dcmplx(0d0,0d0))
+  call check_ok2(ne, 49, 1, d)
 
-! 93: fgd_rename check
-  call fgd_rename(d, 'new9', 'newer', 0)
-  e = fgd_error(d)
+  n = fgd_entry(d, 'data/mnew5', ent)
+  call check_ok2(ne, 49, 2, d)
+  call check_int2(ne, 49, 1, n, GD_POLYNOM_ENTRY)
+  call check_int2(ne, 49, 2, ent%poly_ord, 3)
+  call check_int2(ne, 49, 3, ent%fragment_index, 0)
+  call check_str2(ne, 49, 4, ent%field(1), 'in1')
 
-  if (e .ne. GD_E_OK) then
-    ne = ne + 1
-    write(*, 2006) 93, 1, e
-  end if
+  cq(1) = dcmplx(1.1, 0.0)
+  cq(2) = dcmplx(2.2, 0.0)
+  cq(3) = dcmplx(2.2, 0.0)
+  cq(4) = dcmplx(3.3, 4.4)
+  DO i=1,4
+  call check_cpx2(ne, 49, i, ent%ca(i), cq(i))
+  end do
 
-  n = fgd_entry(d, 'new9', ent)
-  e = fgd_error(d)
+! 50: fgd_madd_linterp check
+  call fgd_madd_linterp(d, "data", "mnew6", "in", "./more/table")
+  call check_ok2(ne, 50, 1, d)
 
-  if (e .ne. GD_E_BAD_CODE) then
-    ne = ne + 1
-    write(*, 2006) 93, 2, e
-  end if
+  n = fgd_entry(d, 'data/mnew6', ent)
+  call check_ok2(ne, 50, 2, d)
+  call check_int2(ne, 50, 1, n, GD_LINTERP_ENTRY)
+  call check_int2(ne, 50, 2, ent%fragment_index, 0)
+  call check_str2(ne, 50, 3, ent%field(1), 'in')
+  call check_str2(ne, 50, 4, ent%field(2), './more/table')
 
-  n = fgd_entry(d, 'newer', ent)
-  e = fgd_error(d)
+! 51: fgd_madd_bit check
+  call fgd_madd_bit(d, "data", "mnew7", "in", 13, 12)
+  call check_ok2(ne, 51, 1, d)
 
-  if (e .ne. GD_E_OK) then
-    ne = ne + 1
-    write(*, 2006) 93, 3, e
-  end if
+  n = fgd_entry(d, 'data/mnew7', ent)
+  call check_ok2(ne, 51, 2, d)
+  call check_int2(ne, 51, 1, n, GD_BIT_ENTRY)
+  call check_int2(ne, 51, 2, ent%fragment_index, 0)
+  call check_int2(ne, 51, 3, ent%numbits, 12)
+  call check_int2(ne, 51, 4, ent%bitnum, 13)
+  call check_str2(ne, 51, 5, ent%field(1), 'in')
 
-  if (n .ne. GD_MULTIPLY_ENTRY) then
-    ne = ne + 1
-    write(*, 2007) 93, 1, l
-  end if
+! 52: fgd_madd_sbit check
+  call fgd_madd_sbit(d, "data", "mnew8", "in", 13, 12)
+  call check_ok2(ne, 52, 1, d)
 
-  if (ent%fragment_index .ne. 1) then
-    ne = ne + 1
-    write(*, 2007) 92, 2, ent%fragment_index
-  end if
+  n = fgd_entry(d, 'data/mnew8', ent)
+  call check_ok2(ne, 52, 2, d)
+  call check_int2(ne, 52, 1, n, GD_SBIT_ENTRY)
+  call check_int2(ne, 52, 2, ent%fragment_index, 0)
+  call check_int2(ne, 52, 3, ent%numbits, 12)
+  call check_int2(ne, 52, 4, ent%bitnum, 13)
+  call check_str2(ne, 52, 5, ent%field(1), 'in')
 
-  if (ent%field(1) .ne. 'in6') then
-    ne = ne + 1
-    write(*, 2008) 92, 3, ent%field(1)
-  end if
+! 53: fgd_madd_multiply check
+  call fgd_madd_multiply(d, 'data', 'mnew9', 'in1', 'in2')
+  call check_ok2(ne, 53, 1, d)
 
-  if (ent%field(2) .ne. 'in4') then
-    ne = ne + 1
-    write(*, 2008) 92, 4, ent%field(2)
-  end if
+  n = fgd_entry(d, 'data/mnew9', ent)
+  call check_ok2(ne, 53, 2, d)
+  call check_int2(ne, 53, 1, n, GD_MULTIPLY_ENTRY)
+  call check_int2(ne, 53, 2, ent%fragment_index, 0)
+  call check_str2(ne, 53, 3, ent%field(1), 'in1')
+  call check_str2(ne, 53, 4, ent%field(2), 'in2')
 
-! 94: fgd_uninclude check
-  call fgd_uninclude(d, 1, 0)
-  e = fgd_error(d)
+! 54: fgd_madd_phase check
+  call fgd_madd_phase(d, 'data', 'mnew10', 'in1', 22)
+  call check_ok2(ne, 54, 1, d)
 
-  if (e .ne. GD_E_OK) then
-    ne = ne + 1
-    write(*, 2006) 94, 1, e
-  end if
+  n = fgd_entry(d, 'data/mnew10', ent)
+  call check_ok2(ne, 54, 2, d)
+  call check_int2(ne, 54, 1, n, GD_PHASE_ENTRY)
+  call check_int2(ne, 54, 2, ent%fragment_index, 0)
+  call check_int2(ne, 54, 3, ent%shift, 22)
+  call check_str2(ne, 54, 4, ent%field(1), 'in1')
 
-  n = fgd_entry(d, 'newer', ent)
-  e = fgd_error(d)
+! 55: fgd_madd_const check
+  call fgd_madd_const(d, 'data', 'mnew11', GD_FLOAT64)
+  call check_ok2(ne, 55, 1, d)
 
-  if (e .ne. GD_E_BAD_CODE) then
-    ne = ne + 1
-    write(*, 2006) 94, 2, e
-  end if
+  n = fgd_entry(d, 'data/mnew11', ent)
+  call check_ok2(ne, 55, 2, d)
+  call check_int2(ne, 55, 1, n, GD_CONST_ENTRY)
+  call check_int2(ne, 55, 2, ent%fragment_index, 0)
+  call check_int2(ne, 55, 3, ent%data_type, GD_FLOAT64)
 
-! 95: fgd_frameoffset check
-  n = fgd_frameoffset(d, 0)
-  e = fgd_error(d)
+  call fgd_get_constant_r4(d, 'data/mnew11', fl)
+  call check_ok2(ne, 55, 3, d)
+  call check_dbl(ne, 55, 1d0 * fl, 0d0)
 
-  if (e .ne. GD_E_OK) then
-    ne = ne + 1
-    write(*, 2001) 95, e
-  end if
+! 126: fgd_madd check
+  ent%shift = 33
+  ent%field(1) = 'data/mnew10'
+  ent%fragment_index = 0
+  ent%field_type = GD_PHASE_ENTRY
+  call fgd_madd(d, 'data', 'mnew4', ent)
+  call check_ok2(ne, 126, 1, d)
 
-  if (n .ne. 0) then
-    ne = ne + 1
-    write(*, 2002) 95, n
-  end if
+  n = fgd_entry(d, 'data/mnew4', ent)
+  call check_ok2(ne, 126, 2, d)
+  call check_int2(ne, 126, 1, n, GD_PHASE_ENTRY)
+  call check_int2(ne, 126, 2, ent%fragment_index, 0)
+  call check_int2(ne, 126, 3, ent%shift, 33)
+  call check_str2(ne, 126, 4, ent%field(1), 'data/mnew10')
 
-! 96: fgd_alter_frameoffset check
-  call fgd_alter_frameoffset(d, 33, 0, 0)
-  e = fgd_error(d)
+! 56: fgd_get_string check
+  n = fgd_get_string(d, 'string', GD_FIELD_LEN, str)
+  call check_ok(ne, 56, d)
+  call check_int(ne, 56, n, 17)
+  call check_str(ne, 56, str, "Zaphod Beeblebrox")
 
-  if (e .ne. GD_E_OK) then
-    ne = ne + 1
-    write(*, 2006) 96, 1, e
-  end if
+! 57: fgd_add_string check
+  call fgd_add_string(d, 'new12', 0)
+  call check_ok2(ne, 57, 1, d)
 
-  n = fgd_frameoffset(d, 0)
-  e = fgd_error(d)
+  n = fgd_get_string(d, 'new12', GD_FIELD_LEN, str)
+  call check_ok2(ne, 57, 2, d)
+  call check_str(ne, 57, str, "")
 
-  if (e .ne. GD_E_OK) then
-    ne = ne + 1
-    write(*, 2006) 96, 2, e
-  end if
+! 58: fgd_madd_string check
+  call fgd_madd_string(d, "data", 'mnew12')
+  call check_ok2(ne, 58, 1, d)
 
-  if (n .ne. 33) then
-    ne = ne + 1
-    write(*, 2002) 96, n
-  end if
+  n = fgd_get_string(d, 'data/mnew12', GD_FIELD_LEN, str)
+  call check_ok2(ne, 58, 2, d)
+  call check_str(ne, 58, str, "")
 
-! 97: fgd_native_type check
-  n = fgd_native_type(d, 'data')
-  e = fgd_error(d)
+! 59: fgd_add_spec check
+  call fgd_add_spec(d, 'lorem STRING "Lorem ipsum"', 0)
+  call check_ok2(ne, 59, 1, d)
 
-  if (e .ne. GD_E_OK) then
-    ne = ne + 1
-    write(*, 2001) 97, e
-  end if
+  n = fgd_get_string(d, 'lorem', GD_FIELD_LEN, str)
+  call check_ok2(ne, 59, 2, d)
+  call check_str(ne, 59, str, "Lorem ipsum")
 
-  if (n .ne. GD_INT8) then
-    ne = ne + 1
-    write(*, 2002) 97, n
-  end if
+! 60: fgd_madd_spec check
+  call fgd_madd_spec(d, 'ipsum STRING "dolor sit amet."', 'lorem')
+  call check_ok2(ne, 60, 1, d)
 
-! 99: fgd_validate check
-  n = fgd_validate(d, 'new7')
-  e = fgd_error(d)
+  n = fgd_get_string(d, 'lorem/ipsum', GD_FIELD_LEN, str)
+  call check_ok2(ne, 60, 2, d)
+  call check_str(ne, 60, str, "dolor sit amet.")
 
-  if (e .ne. GD_E_BAD_CODE) then
-    ne = ne + 1
-    write(*, 2001) 99, e
-  end if
+! 61: fgd_put_constant_i1 check
+  ci1(1) = 61
+  call fgd_put_constant_i1(d, 'const', ci1(1))
+  call check_ok2(ne, 61, 1, d)
 
-  if (n .ne. -1) then
-    ne = ne + 1
-    write(*, 2002) 99, n
-  end if
+  call fgd_get_constant_r4(d, 'const', fl)
+  call check_ok2(ne, 61, 2, d)
+  call check_dbl(ne, 61, 1d0 * fl, 61d0)
 
-! 100: fgd_framenum check
-  str = fgd_reference(d, "data")
-  dp = fgd_framenum(d, 'INDEX', 33.3d0)
-  e = fgd_error(d)
+! 127: fgd_put_constant_i2 check
+  ci2(1) = 127
+  call fgd_put_constant_i2(d, 'const', ci2(1))
+  call check_ok2(ne, 127, 1, d)
 
-  if (e .ne. GD_E_OK) then
-    ne = ne + 1
-    write(*, 2001) 100, e
-  end if
+  call fgd_get_constant_r4(d, 'const', fl)
+  call check_ok2(ne, 127, 2, d)
+  call check_dbl(ne, 127, 1d0 * fl, 127d0)
 
-  if (abs(dp - 33.3) > 0.001) then
-    ne = ne + 1
-    write(*, 2012) 100, dp
-  end if
+! 128: fgd_put_constant_i4 check
+  ci4(1) = 128
+  call fgd_put_constant_i4(d, 'const', ci4(1))
+  call check_ok2(ne, 128, 1, d)
 
-! 101: fgd_framenum_subset check
-  dp = fgd_framenum_subset(d, 'data', 33.3d0, 6, 0)
-  e = fgd_error(d)
+  call fgd_get_constant_r4(d, 'const', fl)
+  call check_ok2(ne, 128, 2, d)
+  call check_dbl(ne, 128, 1d0 * fl, 128d0)
 
-  if (e .ne. GD_E_OK) then
-    ne = ne + 1
-    write(*, 2001) 101, e
-  end if
+! 129: fgd_put_constant_i8 check
+  ci8(1) = 129
+  call fgd_put_constant_i8(d, 'const', ci8(1))
+  call check_ok2(ne, 129, 1, d)
 
-  if (abs(dp - 37.0375) > 0.001) then
-    ne = ne + 1
-    write(*, 2012) 101, dp
-  end if
+  call fgd_get_constant_r4(d, 'const', fl)
+  call check_ok2(ne, 129, 2, d)
+  call check_dbl(ne, 129, 1d0 * fl, 129d0)
 
-! 86: fgd_eof check
-  n = fgd_eof(d, 'lincom')
-  e = fgd_error(d)
+! 130: fgd_put_constant_r4 check
+  cr4(1) = -8.1
+  call fgd_put_constant_r4(d, 'new11', cr4(1))
+  call check_ok2(ne, 130, 1, d)
 
-  if (e .ne. GD_E_OK) then
-    ne = ne + 1
-    write(*, 2001), 86, e
-  end if
+  call fgd_get_constant_r4(d, 'new11', fl)
+  call check_ok2(ne, 130, 2, d)
+  call check_dbl(ne, 130, 1d0 * fl, -8.1d0)
 
-  if (n .ne. 344) then
-    ne = ne + 1
-    write(*, 2002), 86, n
-  end if
+! 131: fgd_put_constant_r8 check
+  cr8(1) = 131
+  call fgd_put_constant_r8(d, 'const', cr8(1))
+  call check_ok2(ne, 131, 1, d)
 
-! 142: fgd_bof check
-  n = fgd_bof(d, 'lincom')
-  e = fgd_error(d)
+  call fgd_get_constant_r4(d, 'const', fl)
+  call check_ok2(ne, 131, 2, d)
+  call check_dbl(ne, 131, 1d0 * fl, 131d0)
 
-  if (e .ne. GD_E_OK) then
-    ne = ne + 1
-    write(*, 2001), 142, e
-  end if
+! 132: fgd_put_constant_c8 check
+  cc8(1) = 132
+  call fgd_put_constant_c8(d, 'const', cc8(1))
+  call check_ok2(ne, 132, 1, d)
 
-  if (n .ne. 264) then
-    ne = ne + 1
-    write(*, 2002), 142, n
-  end if
+  call fgd_get_constant_r4(d, 'const', fl)
+  call check_ok2(ne, 132, 2, d)
+  call check_dbl(ne, 132, 1d0 * fl, 132d0)
 
-! 143: fgd_entry (divide) check
-  n = fgd_entry(d, 'div', ent)
-  e = fgd_error(d)
+! 133: fgd_put_constant_c16 check
+  cc16(1) = 133
+  call fgd_put_constant_c16(d, 'const', cc16(1))
+  call check_ok2(ne, 133, 1, d)
 
-  if (e .ne. GD_E_OK) then
-    ne = ne + 1
-    write(*, 2001) 143, e
-  end if
+  call fgd_get_constant_r4(d, 'const', fl)
+  call check_ok2(ne, 133, 2, d)
+  call check_dbl(ne, 133, 1d0 * fl, 133d0)
 
-  if (n .ne. GD_DIVIDE_ENTRY) then
-    ne = ne + 1
-    write(*, 2007) 143, 1, n
-  end if
+! 62: fgd_put_string check
+  n = fgd_put_string(d, 'string', "Arthur Dent")
+  call check_ok2(ne, 62, 1, d)
+  call check_int(ne, 62, n, 11)
 
-  if (ent%fragment_index .ne. 0) then
-    ne = ne + 1
-    write(*, 2007) 143, 2, ent%fragment_index
-  end if
+  n = fgd_get_string(d, 'string', GD_FIELD_LEN, str)
+  call check_ok2(ne, 62, 2, d)
+  call check_str(ne, 62, str, "Arthur Dent")
 
-  if (ent%field(1) .ne. 'mult') then
-    ne = ne + 1
-    write(*, 2008) 143, 3, ent%field(1)
-  end if
+! 63: fgd_nmfields_by_type check
+  n = fgd_nmfields_by_type(d, "data", GD_LINCOM_ENTRY)
+  call check_ok(ne, 63, d)
+  call check_int(ne, 63, n, 2)
 
-  if (ent%field(2) .ne. 'bit') then
-    ne = ne + 1
-    write(*, 2008) 143, 4, ent%field(2)
-  end if
+! 64: fgd_mfield_list_by_type check
+  fields(1) = 'mnew1'
+  fields(2) = 'mnew2'
+  l = flen
+  call fgd_mfield_list_by_type(flist, d, "data", GD_LINCOM_ENTRY, l)
+  call check_ok2(ne, 64, i, d)
+  call check_int2(ne, 64, i, l, flen)
 
-! 145: fgd_entry (recip) check
-  n = fgd_entry(d, 'recip', ent)
-  e = fgd_error(d)
+  do i = 1, n
+  call check_str2(ne, 64, i, flist(i), fields(i))
+  end do
 
-  if (e .ne. GD_E_OK) then
-    ne = ne + 1
-    write(*, 2001) 145, e
-  end if
+! 65: fgd_nmvectors check
+  n = fgd_nmvectors(d, "data")
+  call check_ok(ne, 65, d)
+  call check_int(ne, 65, n, 11)
 
-  if (n .ne. GD_RECIP_ENTRY) then
-    ne = ne + 1
-    write(*, 2007) 145, 1, n
-  end if
+! 66: fgd_mvector_list check
+  fields = (/    'mlut       ', 'mnew1      ', 'mnew2      ', 'mnew3      ', &
+  'mnew5      ', 'mnew6      ', 'mnew7      ', 'mnew8      ', 'mnew9      ', &
+  'mnew10     ', 'mnew4      ', '           ', '           ', '           ', &
+  '           ', '           ', '           ', '           ', '           ', &
+  '           ', '           ', '           ', '           ', '           ', &
+  '           ', '           ', '           ', '           ' /)
+  l = flen
+  call fgd_mvector_list(flist, d, "data", l)
+  call check_ok2(ne, 66, i, d)
+  call check_int2(ne, 66, i, l, flen)
 
-  if (ent%fragment_index .ne. 0) then
-    ne = ne + 1
-    write(*, 2007) 145, 2, ent%fragment_index
-  end if
+  do i=1,n
+  call check_str2(ne, 66, i, flist(i), fields(i))
+  end do
 
-  if (ent%comp_scal .ne. 1) then
-    ne = ne + 1
-    write(*, 2007) 145, 3, ent%comp_scal
-  end if
+! 67: fgd_alter_raw check
+  call fgd_alter_raw(d, 'new1', GD_INT32, 4, 0)
+  call check_ok2(ne, 67, 1, d)
 
-  if (ent%field(1) .ne. 'div') then
-    ne = ne + 1
-    write(*, 2008) 145, 4, ent%field(1)
-  end if
+  n = fgd_entry(d, 'new1', ent)
+  call check_ok2(ne, 67, 2, d)
+  call check_int2(ne, 67, 3, ent%fragment_index, 0)
+  call check_int2(ne, 67, 4, ent%spf, 4)
+  call check_int2(ne, 67, 5, ent%data_type, GD_INT32)
+  call check_int2(ne, 67, 6, n, GD_RAW_ENTRY)
 
-  if (abs(ent%cdividend - dcmplx(6.5, 4.3)) .gt. 1e-5) then
-    ne = ne + 1
-    write(*, 2013) 145, real(real(ent%cdividend)), real(aimag(ent%cdividend))
-  end if
+! 68: fgd_alter_lincom check
+  call fgd_alter_lincom(d, 'new2', 3, 'in4', 9.9d-1, 7.8d0, 'in5', &
+     1.1d1, 2.2d-2, 'in6', 1.96d0, 0d0)
+  call check_ok2(ne, 68, 1, d)
 
-! 146: fgd_add_divide check
-  call fgd_add_divide(d, 'new14', 'in1', 'in2', 0)
-  e = fgd_error(d)
+  n = fgd_entry(d, 'new2', ent)
+  call check_ok2(ne, 68, 2, d)
+  call check_int2(ne, 68, 3, n, GD_LINCOM_ENTRY)
+  call check_int2(ne, 68, 4, ent%n_fields, 3)
+  call check_int2(ne, 68, 5, ent%fragment_index, 0)
+  call check_str2(ne, 68, 6, ent%field(1), 'in4')
+  call check_str2(ne, 68, 7, ent%field(2), 'in5')
+  call check_str2(ne, 68, 8, ent%field(3), 'in6')
+  call check_int2(ne, 68, 5, ent%comp_scal, 0)
 
-  if (e .ne. GD_E_OK) then
-    ne = ne + 1
-    write(*, 2006) 146, 1, e
-  end if
+  q = (/ 9.9d-1, 7.8d0, 1.1d1, 2.2d-2, 1.96d0, 0d0 /)
+  DO i=1,3
+  call check_dbl2(ne, 68, i * 2 - 1, ent%m(i), q(i * 2 - 1))
+  call check_dbl2(ne, 68, i * 2, ent%b(i), q(i * 2))
+  end do
 
-  n = fgd_entry(d, 'new14', ent)
-  e = fgd_error(d)
+! 69: fgd_alter_clincom check
+  cq(1) = dcmplx(0.1, 0.2)
+  cq(2) = dcmplx(0.3, 0.4)
+  cq(3) = dcmplx(0.4, 0.5)
+  cq(4) = dcmplx(0.6, 0.7)
+  call fgd_alter_clincom(d, 'new3', 2, 'in4', cq(1), cq(2), 'in3', &
+     cq(3), cq(4), '', cq(5), cq(6))
+  call check_ok2(ne, 69, 1, d)
 
-  if (e .ne. GD_E_OK) then
-    ne = ne + 1
-    write(*, 2006) 146, 2, e
-  end if
+  n = fgd_entry(d, 'new3', ent)
+  call check_ok(ne, 69, d)
+  call check_int2(ne, 69, 1, n, GD_LINCOM_ENTRY)
+  call check_int2(ne, 69, 2, ent%n_fields, 2)
+  call check_int2(ne, 69, 3, ent%fragment_index, 0)
+  call check_str2(ne, 69, 4, ent%field(1), 'in4')
+  call check_str2(ne, 69, 5, ent%field(2), 'in3')
+  call check_int2(ne, 69, 6, ent%comp_scal, 1)
 
-  if (n .ne. GD_DIVIDE_ENTRY) then
-    ne = ne + 1
-    write(*, 2007) 146, 1, n
-  end if
+  cq(1) = dcmplx(0.1, 0.2)
+  cq(2) = dcmplx(0.3, 0.4)
+  cq(3) = dcmplx(0.4, 0.5)
+  cq(4) = dcmplx(0.6, 0.7)
+  DO i=1,2
+  call check_cpx2(ne, 69, i * 2 - 1, ent%cm(i), cq(i * 2 - 1))
+  call check_cpx2(ne, 69, i * 2, ent%cb(i), cq(i * 2))
+  end do
 
-  if (ent%fragment_index .ne. 0) then
-    ne = ne + 1
-    write(*, 2007) 146, 2, ent%fragment_index
-  end if
+! 70: fgd_alter_polynom check
+  call fgd_alter_polynom(d, 'new4', 4, 'in1', 3d0, 4d0, 5d0, 6d0, 7d0, 0d0)
+  call check_ok2(ne, 70, 1, d)
 
-  if (ent%field(1) .ne. 'in1') then
-    ne = ne + 1
-    write(*, 2008) 146, 3, ent%field(1)
-  end if
+  n = fgd_entry(d, 'new4', ent)
+  call check_ok2(ne, 70, 2, d)
+  call check_int2(ne, 70, 1, n, GD_POLYNOM_ENTRY)
+  call check_int2(ne, 70, 2, ent%poly_ord, 4)
+  call check_int2(ne, 70, 3, ent%fragment_index, 0)
+  call check_str2(ne, 70, 4, ent%field(1), 'in1')
 
-  if (ent%field(2) .ne. 'in2') then
-    ne = ne + 1
-    write(*, 2008) 146, 4, ent%field(2)
-  end if
+  q = (/ 3d0, 4d0, 5d0, 6d0, 7d0, 0d0 /)
+  DO i=1,5
+  call check_dbl2(ne, 70, i, ent%a(i), q(i))
+  end do
 
-! 147: fgd_add_recip check
-  call fgd_add_recip(d, 'new15', 'in1', 31.9d0, 0)
-  e = fgd_error(d)
+! 71: fgd_alter_cpolynom check
+  cq(1) = dcmplx(1.1, 5.0)
+  cq(2) = dcmplx(1.2, 4.0)
+  cq(3) = dcmplx(1.2, 3.0)
+  cq(4) = dcmplx(1.3, 2.4)
+  call fgd_alter_cpolynom(d, 'new5', 3, 'in1', cq(1), cq(2), cq(3), &
+  cq(4), dcmplx(0d0,0d0), dcmplx(0d0,0d0))
+  call check_ok2(ne, 71, 1, d)
 
-  if (e .ne. GD_E_OK) then
-    ne = ne + 1
-    write(*, 2006) 147, 1, e
-  end if
+  n = fgd_entry(d, 'new5', ent)
+  call check_ok2(ne, 71, 2, d)
+  call check_int2(ne, 71, 1, n, GD_POLYNOM_ENTRY)
+  call check_int2(ne, 71, 2, ent%poly_ord, 3)
+  call check_int2(ne, 71, 3, ent%fragment_index, 0)
+  call check_str2(ne, 71, 4, ent%field(1), 'in1')
+  call check_int2(ne, 71, 5, ent%comp_scal, 1)
 
-  n = fgd_entry(d, 'new15', ent)
-  e = fgd_error(d)
+  cq(1) = dcmplx(1.1, 5.0)
+  cq(2) = dcmplx(1.2, 4.0)
+  cq(3) = dcmplx(1.2, 3.0)
+  cq(4) = dcmplx(1.3, 2.4)
+  DO 710 i=1,4
+  call check_cpx2(ne, 71, i, ent%ca(i), cq(i))
+  710 CONTINUE
 
-  if (e .ne. GD_E_OK) then
-    ne = ne + 1
-    write(*, 2006) 147, 2, e
-  end if
+! 72: fgd_alter_linterp check
+  call fgd_alter_linterp(d, "new6", "in3", "./other/table", 0)
+  call check_ok2(ne, 72, 1, d)
 
-  if (n .ne. GD_RECIP_ENTRY) then
-    ne = ne + 1
-    write(*, 2007) 147, 1, n
-  end if
+  n = fgd_entry(d, 'new6', ent)
+  call check_ok2(ne, 72, 2, d)
+  call check_int2(ne, 72, 1, n, GD_LINTERP_ENTRY)
+  call check_int2(ne, 72, 2, ent%fragment_index, 0)
+  call check_str2(ne, 72, 3, ent%field(1), 'in3')
+  call check_str2(ne, 72, 4, ent%field(2), './other/table')
 
-  if (ent%fragment_index .ne. 0) then
-    ne = ne + 1
-    write(*, 2007) 147, 2, ent%fragment_index
-  end if
+! 73: fgd_alter_bit check
+  call fgd_alter_bit(d, "new7", "in3", 3, 2)
+  call check_ok2(ne, 73, 1, d)
 
-  if (ent%field(1) .ne. 'in1') then
-    ne = ne + 1
-    write(*, 2008) 147, 3, ent%field(1)
-  end if
+  n = fgd_entry(d, 'new7', ent)
+  call check_ok2(ne, 73, 2, d)
+  call check_int2(ne, 73, 1, n, GD_BIT_ENTRY)
+  call check_int2(ne, 73, 2, ent%fragment_index, 0)
+  call check_int2(ne, 73, 3, ent%numbits, 2)
+  call check_int2(ne, 73, 4, ent%bitnum, 3)
+  call check_str2(ne, 73, 5, ent%field(1), 'in3')
 
-  if (ent%comp_scal .ne. 0) then
-    ne = ne + 1
-    write(*, 2007) 147, 4, ent%comp_scal
-  end if
+! 74: fgd_alter_sbit check
+  call fgd_alter_sbit(d, "new8", "out", 1, 22)
+  call check_ok2(ne, 74, 1, d)
 
-  if (abs(ent%dividend - 31.9) > 1e-5) then
-    ne = ne + 1
-    write(*, 2012) 147, ent%dividend
-  end if
+  n = fgd_entry(d, 'new8', ent)
+  call check_ok2(ne, 74, 2, d)
+  call check_int2(ne, 74, 1, n, GD_SBIT_ENTRY)
+  call check_int2(ne, 74, 2, ent%fragment_index, 0)
+  call check_int2(ne, 74, 3, ent%numbits, 22)
+  call check_int2(ne, 74, 4, ent%bitnum, 1)
+  call check_str2(ne, 74, 5, ent%field(1), 'out')
 
-! 148: fgd_add_recip check
-  call fgd_add_crecip(d, 'new16', 'in1', dcmplx(31.9d0, 38.2d0), 0)
-  e = fgd_error(d)
+! 75: fgd_alter_multiply check
+  call fgd_alter_multiply(d, 'new9', 'in6', 'in4')
+  call check_ok2(ne, 75, 1, d)
 
-  if (e .ne. GD_E_OK) then
-    ne = ne + 1
-    write(*, 2006) 148, 1, e
-  end if
+  n = fgd_entry(d, 'new9', ent)
+  call check_ok2(ne, 75, 2, d)
+  call check_int2(ne, 75, 1, n, GD_MULTIPLY_ENTRY)
+  call check_int2(ne, 75, 2, ent%fragment_index, 0)
+  call check_str2(ne, 75, 3, ent%field(1), 'in6')
+  call check_str2(ne, 75, 4, ent%field(2), 'in4')
 
-  n = fgd_entry(d, 'new16', ent)
-  e = fgd_error(d)
+! 76: fgd_alter_phase check
+  call fgd_alter_phase(d, 'new10', 'in2', 8)
+  call check_ok2(ne, 76, 1, d)
 
-  if (e .ne. GD_E_OK) then
-    ne = ne + 1
-    write(*, 2006) 148, 2, e
-  end if
+  n = fgd_entry(d, 'new10', ent)
+  call check_ok2(ne, 76, 2, d)
+  call check_int2(ne, 76, 1, n, GD_PHASE_ENTRY)
+  call check_int2(ne, 76, 2, ent%fragment_index, 0)
+  call check_int2(ne, 76, 3, ent%shift, 8)
+  call check_str2(ne, 76, 4, ent%field(1), 'in2')
 
-  if (n .ne. GD_RECIP_ENTRY) then
-    ne = ne + 1
-    write(*, 2007) 148, 1, n
-  end if
+! 77: fgd_alter_const check
+  call fgd_alter_const(d, 'new11', GD_FLOAT32)
+  call check_ok2(ne, 77, 1, d)
 
-  if (ent%fragment_index .ne. 0) then
-    ne = ne + 1
-    write(*, 2007) 148, 2, ent%fragment_index
-  end if
+  n = fgd_entry(d, 'new11', ent)
+  call check_ok2(ne, 77, 2, d)
+  call check_int2(ne, 77, 1, n, GD_CONST_ENTRY)
+  call check_int2(ne, 77, 2, ent%fragment_index, 0)
+  call check_int2(ne, 77, 3, ent%data_type, GD_FLOAT32)
 
-  if (ent%field(1) .ne. 'in1') then
-    ne = ne + 1
-    write(*, 2008) 148, 3, ent%field(1)
-  end if
+  call fgd_get_constant_r4(d, 'new11', fl)
+  call check_ok2(ne, 77, 3, d)
+  call check_dbl(ne, 77, 1d0 * fl, -8.1d0)
 
-  if (ent%comp_scal .ne. 1) then
-    ne = ne + 1
-    write(*, 2007) 148, 4, ent%comp_scal
-  end if
+! 78: fgd_encoding check
+  n = fgd_encoding(d, 0)
+  call check_ok(ne, 78, d)
+  call check_int(ne, 78, n, GD_UNENCODED)
 
-  if (abs(ent%cdividend - dcmplx(31.9, 38.2)) > 1e-5) then
-    ne = ne + 1
-    write(*, 2012) 148, ent%cdividend
-  end if
+! 79: fgd_endianness check
+  n = fgd_endianness(d, 0)
+  call check_ok(ne, 79, d)
+  call check_int(ne, 79, n, (GD_LITTLE_ENDIAN + GD_NOT_ARM_ENDIAN))
 
-! 149: fgd_madd_divide check
-  call fgd_madd_divide(d, 'data', 'new14', 'in3', 'in4')
-  e = fgd_error(d)
+! 80: fgd_dirfilename check
+  l = 4096
+  call fgd_dirfilename(path, l, d, 0)
+  call check_ok(ne, 80, d)
+  call check_int(ne, 80, l, 4096)
+  call check_eos(ne, 80, path, 'test95_dirfile')
 
-  if (e .ne. GD_E_OK) then
-    ne = ne + 1
-    write(*, 2006) 149, 1, e
-  end if
+! 81: fgd_parent_fragment check
+  n = fgd_parent_fragment(d, 1)
+  call check_ok(ne, 81, d)
+  call check_int(ne, 81, n, 0)
 
-  n = fgd_entry(d, 'data/new14', ent)
-  e = fgd_error(d)
+! 82: fgd_alter_protection check
+  call fgd_alter_protection(d, GD_PROTECT_DATA, 1)
+  call check_ok(ne, 82, d)
 
-  if (e .ne. GD_E_OK) then
-    ne = ne + 1
-    write(*, 2006) 149, 2, e
-  end if
+! 83: fgd_protection check
+  n = fgd_protection(d, 1)
+  call check_ok(ne, 83, d)
+  call check_int(ne, 83, n, GD_PROTECT_DATA)
 
-  if (n .ne. GD_DIVIDE_ENTRY) then
-    ne = ne + 1
-    write(*, 2007) 149, 1, n
-  end if
+! 84: fgd_raw_filename check
+  str = fgd_raw_filename(d, "data")
+  call check_ok(ne, 84, d)
+  call check_eos(ne, 84, str, 'test95_dirfile'//DIRSEP//'data')
 
-  if (ent%fragment_index .ne. 0) then
-    ne = ne + 1
-    write(*, 2007) 149, 2, ent%fragment_index
-  end if
+! 85: fgd_reference check
+  str = fgd_reference(d, "new1")
+  call check_ok(ne, 85, d)
+  call check_str(ne, 85, str, 'new1')
 
-  if (ent%field(1) .ne. 'in3') then
-    ne = ne + 1
-    write(*, 2008) 149, 3, ent%field(1)
-  end if
+! 87: fgd_alter_encoding check
+  call fgd_alter_encoding(d, GD_SLIM_ENCODED, 1, 0)
+  call check_ok2(ne, 87, 1, d)
 
-  if (ent%field(2) .ne. 'in4') then
-    ne = ne + 1
-    write(*, 2008) 149, 4, ent%field(2)
-  end if
+  n = fgd_encoding(d, 1)
+  call check_ok2(ne, 87, 2, d)
+  call check_int(ne, 87, n, GD_SLIM_ENCODED)
 
-! 150: fgd_madd_recip check
-  call fgd_madd_recip(d, 'data', 'new15', 'in0', 95.5d0)
-  e = fgd_error(d)
+! 88: fgd_alter_endianness check
+  call fgd_alter_endianness(d, GD_BIG_ENDIAN, 1, 0)
+  call check_ok2(ne, 88, 1, d)
 
-  if (e .ne. GD_E_OK) then
-    ne = ne + 1
-    write(*, 2006) 150, 1, e
-  end if
+  n = fgd_endianness(d, 1)
+  call check_ok2(ne, 88, 2, d)
+  call check_int(ne, 88, n, GD_BIG_ENDIAN)
 
-  n = fgd_entry(d, 'data/new15', ent)
-  e = fgd_error(d)
+! 89: fgd_alter_spec check
+  call fgd_alter_spec(d, 'new10 PHASE in1 3', 0)
+  call check_ok2(ne, 89, 1, d)
 
-  if (e .ne. GD_E_OK) then
-    ne = ne + 1
-    write(*, 2006) 150, 2, e
-  end if
+  n = fgd_entry(d, 'new10', ent)
+  call check_ok2(ne, 89, 2, d)
+  call check_int2(ne, 89, 1, n, GD_PHASE_ENTRY)
+  call check_int2(ne, 89, 2, ent%fragment_index, 0)
+  call check_int2(ne, 89, 3, ent%shift, 3)
+  call check_str2(ne, 89, 4, ent%field(1), 'in1')
 
-  if (n .ne. GD_RECIP_ENTRY) then
-    ne = ne + 1
-    write(*, 2007) 150, 1, n
-  end if
+! 90: fgd_delete check
+  call fgd_delete(d, 'new10', 0)
+  call check_ok2(ne, 90, 1, d)
 
-  if (ent%fragment_index .ne. 0) then
-    ne = ne + 1
-    write(*, 2007) 150, 2, ent%fragment_index
-  end if
+  n = fgd_entry(d, 'new10', ent)
+  call check_err2(ne, 90, 2, d, GD_E_BAD_CODE)
 
-  if (ent%field(1) .ne. 'in0') then
-    ne = ne + 1
-    write(*, 2008) 150, 3, ent%field(1)
-  end if
+! 91: fgd_malter_spec check
+  call fgd_malter_spec(d, 'mnew10 PHASE in4 11', 'data', 0)
+  call check_ok2(ne, 91, 1, d)
 
-  if (ent%comp_scal .ne. 0) then
-    ne = ne + 1
-    write(*, 2007) 150, 4, ent%comp_scal
-  end if
+  n = fgd_entry(d, 'data/mnew10', ent)
+  call check_ok2(ne, 91, 2, d)
+  call check_int2(ne, 91, 1, n, GD_PHASE_ENTRY)
+  call check_int2(ne, 91, 2, ent%fragment_index, 0)
+  call check_int2(ne, 91, 3, ent%shift, 11)
+  call check_str2(ne, 91, 4, ent%field(1), 'in4')
 
-  if (abs(ent%dividend - 95.5) > 1e-5) then
-    ne = ne + 1
-    write(*, 2012) 150, ent%dividend
-  end if
+! 92: fgd_move check
+  call fgd_move(d, 'new9', 1, 0)
+  call check_ok2(ne, 92, 1, d)
 
-! 151: fgd_madd_recip check
-  call fgd_madd_crecip(d, 'data', 'new16', 'in3', dcmplx(8.47d0, 6.22d0))
-  e = fgd_error(d)
+  n = fgd_entry(d, 'new9', ent)
+  call check_ok2(ne, 92, 2, d)
+  call check_int2(ne, 92, 1, n, GD_MULTIPLY_ENTRY)
+  call check_int2(ne, 92, 2, ent%fragment_index, 1)
+  call check_str2(ne, 92, 3, ent%field(1), 'in6')
+  call check_str2(ne, 92, 4, ent%field(2), 'in4')
 
-  if (e .ne. GD_E_OK) then
-    ne = ne + 1
-    write(*, 2006) 151, 1, e
-  end if
+! 93: fgd_rename check
+  call fgd_rename(d, 'new9', 'newer', 0)
+  call check_ok2(ne, 93, 1, d)
 
-  n = fgd_entry(d, 'data/new16', ent)
-  e = fgd_error(d)
+  n = fgd_entry(d, 'new9', ent)
+  call check_err2(ne, 93, 2, d, GD_E_BAD_CODE)
 
-  if (e .ne. GD_E_OK) then
-    ne = ne + 1
-    write(*, 2006) 151, 2, e
-  end if
+  n = fgd_entry(d, 'newer', ent)
+  call check_ok2(ne, 93, 3, d)
+  call check_int2(ne, 93, 1, n, GD_MULTIPLY_ENTRY)
+  call check_int2(ne, 92, 2, ent%fragment_index, 1)
+  call check_str2(ne, 92, 3, ent%field(1), 'in6')
+  call check_str2(ne, 92, 4, ent%field(2), 'in4')
 
-  if (n .ne. GD_RECIP_ENTRY) then
-    ne = ne + 1
-    write(*, 2007) 151, 1, n
-  end if
+! 94: fgd_uninclude check
+  call fgd_uninclude(d, 1, 0)
+  call check_ok2(ne, 94, 1, d)
 
-  if (ent%fragment_index .ne. 0) then
-    ne = ne + 1
-    write(*, 2007) 151, 2, ent%fragment_index
-  end if
+  n = fgd_entry(d, 'newer', ent)
+  call check_err2(ne, 94, 2, d, GD_E_BAD_CODE)
 
-  if (ent%field(1) .ne. 'in3') then
-    ne = ne + 1
-    write(*, 2008) 151, 3, ent%field(1)
-  end if
+! 95: fgd_frameoffset check
+  n = fgd_frameoffset(d, 0)
+  call check_ok(ne, 95, d)
+  call check_int(ne, 95, n, 0)
 
-  if (ent%comp_scal .ne. 1) then
-    ne = ne + 1
-    write(*, 2007) 151, 4, ent%comp_scal
-  end if
+! 96: fgd_alter_frameoffset check
+  call fgd_alter_frameoffset(d, 33, 0, 0)
+  call check_ok2(ne, 96, 1, d)
 
-  if (abs(ent%cdividend - dcmplx(8.47, 6.22)) > 1e-5) then
-    ne = ne + 1
-    write(*, 2012) 151, ent%cdividend
-  end if
+  n = fgd_frameoffset(d, 0)
+  call check_ok2(ne, 96, 2, d)
+  call check_int(ne, 96, n, 33)
 
-! 152: fgd_alter_divide check
-  call fgd_alter_divide(d, 'new14', 'in6', 'in4')
-  e = fgd_error(d)
+! 97: fgd_native_type check
+  n = fgd_native_type(d, 'data')
+  call check_ok(ne, 97, d)
+  call check_int(ne, 97, n, GD_INT8)
 
-  if (e .ne. GD_E_OK) then
-    ne = ne + 1
-    write(*, 2006) 152, 1, e
-  end if
+! 99: fgd_validate check
+  n = fgd_validate(d, 'new7')
+  call check_err(ne, 99, d, GD_E_BAD_CODE)
+  call check_int(ne, 99, n, -1)
 
-  n = fgd_entry(d, 'new14', ent)
-  e = fgd_error(d)
+! 100: fgd_framenum check
+  str = fgd_reference(d, "data")
+  dp = fgd_framenum(d, 'INDEX', 33.3d0)
+  call check_ok(ne, 100, d)
+  call check_dbl(ne, 100, dp, 33.3d0)
 
-  if (e .ne. GD_E_OK) then
-    ne = ne + 1
-    write(*, 2006) 152, 2, e
-  end if
+! 101: fgd_framenum_subset check
+  dp = fgd_framenum_subset(d, 'data', 33.3d0, 6, 0)
+  call check_ok(ne, 101, d)
+  call check_dbl(ne, 101, dp, 37.0375d0)
 
-  if (n .ne. GD_DIVIDE_ENTRY) then
-    ne = ne + 1
-    write(*, 2007) 152, 1, n
-  end if
+! 86: fgd_eof check
+  n = fgd_eof(d, 'lincom')
+  call check_ok(ne, 86, d)
+  call check_int(ne, 86, n, 344)
 
-  if (ent%fragment_index .ne. 0) then
-    ne = ne + 1
-    write(*, 2007) 152, 2, ent%fragment_index
-  end if
+! 142: fgd_bof check
+  n = fgd_bof(d, 'lincom')
+  call check_ok(ne, 142, d)
+  call check_int(ne, 142, n, 264)
 
-  if (ent%field(1) .ne. 'in6') then
-    ne = ne + 1
-    write(*, 2008) 152, 3, ent%field(1)
-  end if
+! 143: fgd_entry (divide) check
+  n = fgd_entry(d, 'div', ent)
+  call check_ok(ne, 143, d)
+  call check_int2(ne, 143, 1, n, GD_DIVIDE_ENTRY)
+  call check_int2(ne, 143, 2, ent%fragment_index, 0)
+  call check_str2(ne, 143, 3, ent%field(1), 'mult')
+  call check_str2(ne, 143, 4, ent%field(2), 'bit')
 
-  if (ent%field(2) .ne. 'in4') then
-    ne = ne + 1
-    write(*, 2008) 152, 4, ent%field(2)
-  end if
+! 145: fgd_entry (recip) check
+  n = fgd_entry(d, 'recip', ent)
+  call check_ok(ne, 145, d)
+  call check_int2(ne, 145, 1, n, GD_RECIP_ENTRY)
+  call check_int2(ne, 145, 2, ent%fragment_index, 0)
+  call check_int2(ne, 145, 3, ent%comp_scal, 1)
+  call check_str2(ne, 145, 4, ent%field(1), 'div')
+  call check_cpx2(ne, 145, 5, ent%cdividend, dcmplx(6.5, 4.3))
 
-! 153: fgd_alter_recip check
-  call fgd_alter_recip(d, 'new15', 'in5', 0.187d0)
-  e = fgd_error(d)
+! 146: fgd_add_divide check
+  call fgd_add_divide(d, 'new14', 'in1', 'in2', 0)
+  call check_ok2(ne, 146, 1, d)
 
-  if (e .ne. GD_E_OK) then
-    ne = ne + 1
-    write(*, 2006) 153, 1, e
-  end if
+  n = fgd_entry(d, 'new14', ent)
+  call check_ok2(ne, 146, 2, d)
+  call check_int2(ne, 146, 1, n, GD_DIVIDE_ENTRY)
+  call check_int2(ne, 146, 2, ent%fragment_index, 0)
+  call check_str2(ne, 146, 3, ent%field(1), 'in1')
+  call check_str2(ne, 146, 4, ent%field(2), 'in2')
+
+! 147: fgd_add_recip check
+  call fgd_add_recip(d, 'new15', 'in1', 31.9d0, 0)
+  call check_ok2(ne, 147, 1, d)
 
   n = fgd_entry(d, 'new15', ent)
-  e = fgd_error(d)
+  call check_ok2(ne, 147, 2, d)
+  call check_int2(ne, 147, 1, n, GD_RECIP_ENTRY)
+  call check_int2(ne, 147, 2, ent%fragment_index, 0)
+  call check_str2(ne, 147, 3, ent%field(1), 'in1')
+  call check_int2(ne, 147, 4, ent%comp_scal, 0)
+  call check_dbl2(ne, 147, 5, ent%dividend, 31.9d0)
 
-  if (e .ne. GD_E_OK) then
-    ne = ne + 1
-    write(*, 2006) 153, 2, e
-  end if
+! 148: fgd_add_recip check
+  call fgd_add_crecip(d, 'new16', 'in1', dcmplx(31.9d0, 38.2d0), 0)
+  call check_ok2(ne, 148, 1, d)
 
-  if (n .ne. GD_RECIP_ENTRY) then
-    ne = ne + 1
-    write(*, 2007) 153, 1, n
-  end if
+  n = fgd_entry(d, 'new16', ent)
+  call check_ok2(ne, 148, 2, d)
+  call check_int2(ne, 148, 1, n, GD_RECIP_ENTRY)
+  call check_int2(ne, 148, 2, ent%fragment_index, 0)
+  call check_str2(ne, 148, 3, ent%field(1), 'in1')
+  call check_int2(ne, 148, 4, ent%comp_scal, 1)
+  call check_cpx2(ne, 148, 5, ent%cdividend, dcmplx(31.9, 38.2))
 
-  if (ent%fragment_index .ne. 0) then
-    ne = ne + 1
-    write(*, 2007) 153, 2, ent%fragment_index
-  end if
+! 149: fgd_madd_divide check
+  call fgd_madd_divide(d, 'data', 'new14', 'in3', 'in4')
+  call check_ok2(ne, 149, 1, d)
 
-  if (ent%field(1) .ne. 'in5') then
-    ne = ne + 1
-    write(*, 2008) 153, 3, ent%field(1)
-  end if
+  n = fgd_entry(d, 'data/new14', ent)
+  call check_ok2(ne, 149, 2, d)
+  call check_int2(ne, 149, 1, n, GD_DIVIDE_ENTRY)
+  call check_int2(ne, 149, 2, ent%fragment_index, 0)
+  call check_str2(ne, 149, 3, ent%field(1), 'in3')
+  call check_str2(ne, 149, 4, ent%field(2), 'in4')
 
-  if (abs(ent%dividend - 0.187) > 1e-5) then
-    ne = ne + 1
-    write(*, 2012) 153, ent%dividend
-  end if
+! 150: fgd_madd_recip check
+  call fgd_madd_recip(d, 'data', 'new15', 'in0', 95.5d0)
+  call check_ok2(ne, 150, 1, d)
 
-! 154: fgd_alter_crecip check
-  call fgd_alter_crecip(d, 'new16', 'in2', dcmplx(4.3d0, 81.81d0))
-  e = fgd_error(d)
+  n = fgd_entry(d, 'data/new15', ent)
+  call check_ok2(ne, 150, 2, d)
+  call check_int2(ne, 150, 1, n, GD_RECIP_ENTRY)
+  call check_int2(ne, 150, 2, ent%fragment_index, 0)
+  call check_str2(ne, 150, 3, ent%field(1), 'in0')
+  call check_int2(ne, 150, 4, ent%comp_scal, 0)
+  call check_dbl2(ne, 150, 5, ent%dividend, 95.5d0)
 
-  if (e .ne. GD_E_OK) then
-    ne = ne + 1
-    write(*, 2006) 154, 1, e
-  end if
+! 151: fgd_madd_recip check
+  call fgd_madd_crecip(d, 'data', 'new16', 'in3', dcmplx(8.47d0, 6.22d0))
+  call check_ok2(ne, 151, 1, d)
 
-  n = fgd_entry(d, 'new16', ent)
-  e = fgd_error(d)
+  n = fgd_entry(d, 'data/new16', ent)
+  call check_ok2(ne, 151, 2, d)
+  call check_int2(ne, 151, 1, n, GD_RECIP_ENTRY)
+  call check_int2(ne, 151, 2, ent%fragment_index, 0)
+  call check_str2(ne, 151, 3, ent%field(1), 'in3')
+  call check_int2(ne, 151, 4, ent%comp_scal, 1)
+  call check_cpx2(ne, 151, 5, ent%cdividend, dcmplx(8.47, 6.22))
 
-  if (e .ne. GD_E_OK) then
-    ne = ne + 1
-    write(*, 2006) 154, 2, e
-  end if
+! 152: fgd_alter_divide check
+  call fgd_alter_divide(d, 'new14', 'in6', 'in4')
+  call check_ok2(ne, 152, 1, d)
 
-  if (n .ne. GD_RECIP_ENTRY) then
-    ne = ne + 1
-    write(*, 2007) 154, 1, n
-  end if
+  n = fgd_entry(d, 'new14', ent)
+  call check_ok2(ne, 152, 2, d)
+  call check_int2(ne, 152, 1, n, GD_DIVIDE_ENTRY)
+  call check_int2(ne, 152, 2, ent%fragment_index, 0)
+  call check_str2(ne, 152, 3, ent%field(1), 'in6')
+  call check_str2(ne, 152, 4, ent%field(2), 'in4')
 
-  if (ent%fragment_index .ne. 0) then
-    ne = ne + 1
-    write(*, 2007) 154, 2, ent%fragment_index
-  end if
+! 153: fgd_alter_recip check
+  call fgd_alter_recip(d, 'new15', 'in5', 0.187d0)
+  call check_ok2(ne, 153, 1, d)
 
-  if (ent%field(1) .ne. 'in2') then
-    ne = ne + 1
-    write(*, 2008) 154, 3, ent%field(1)
-  end if
+  n = fgd_entry(d, 'new15', ent)
+  call check_ok2(ne, 153, 2, d)
+  call check_int2(ne, 153, 1, n, GD_RECIP_ENTRY)
+  call check_int2(ne, 153, 2, ent%fragment_index, 0)
+  call check_str2(ne, 153, 3, ent%field(1), 'in5')
+  call check_dbl2(ne, 153, 4, ent%dividend, 0.187d0)
 
-  if (abs(ent%cdividend - dcmplx(4.3d0, 81.81d0)) > 1e-5) then
-    ne = ne + 1
-    write(*, 2013) 154, ent%cdividend
-  end if
+! 154: fgd_alter_crecip check
+  call fgd_alter_crecip(d, 'new16', 'in2', dcmplx(4.3d0, 81.81d0))
+  call check_ok2(ne, 154, 1, d)
+
+  n = fgd_entry(d, 'new16', ent)
+  call check_ok2(ne, 154, 2, d)
+  call check_int2(ne, 154, 1, n, GD_RECIP_ENTRY)
+  call check_int2(ne, 154, 2, ent%fragment_index, 0)
+  call check_str2(ne, 154, 3, ent%field(1), 'in2')
+  call check_cpx2(ne, 154, 4, ent%cdividend, dcmplx(4.3d0, 81.81d0))
 
 ! 155: fgd_rewrite_fragment check
   call fgd_rewrite_fragment(d, 0)
-  e = fgd_error(d)
-
-  if (e .ne. GD_E_OK) then
-    ne = ne + 1
-    write(*, 2001), 155, e
-  end if
+  call check_ok(ne, 155, d)
 
 ! 156: fgd_invalid_dirfile check
-  m = fgd_invalid_dirfile()
-  e = fgd_error(m)
-
-  if (e .ne. GD_E_OK) then
-    ne = ne + 1
-    write(*, 2006), 156, 1, e
-  end if
+  l = fgd_invalid_dirfile()
+  call check_ok2(ne, 98, 1, l)
 
-  n = fgd_nfragments(m)
-  e = fgd_error(m)
-
-  if (e .ne. GD_E_BAD_DIRFILE) then
-    ne = ne + 1
-    write(*, 2006), 156, 2, e
-  end if
+  n = fgd_nfragments(l)
+  call check_err2(ne, 98, 2, l, GD_E_BAD_DIRFILE)
 
-  call fgd_close(m)
+  call fgd_close(l)
 
 ! 157: fgd_dirfile_standards
   n = fgd_dirfile_standards(d, GD_VERSION_CURRENT)
-  e = fgd_error(d)
-
-  if (e .ne. GD_E_OK) then
-    ne = ne + 1
-    write(*, 2006), 157, 1, e
-  end if
-
-  if (n .ne. 8) then
-    ne = ne + 1
-    write(*, 2002), 157, n
-  end if
+  call check_ok2(ne, 157, 1, d)
+  call check_int(ne, 157, n, 9)
 
   n = fgd_dirfile_standards(d, 0)
-  e = fgd_error(d)
-
-  if (e .ne. GD_E_BAD_VERSION) then
-    ne = ne + 1
-    write(*, 2006), 156, 2, e
-  end if
+  call check_err2(ne, 157, 2, d, GD_E_ARGUMENT)
 
 ! 158: gd_get_carray_slice (INT8)
   call fgd_get_carray_i1(d, "carray", 0, 0, ci1)
-  e = fgd_error(d)
-
-  if (e .ne. GD_E_OK) then
-    ne = ne + 1
-    write(*, 2001), 158, e
-  end if
+  call check_ok(ne, 158, d)
 
   do i=1,6
-    if (ci1(i) .ne. i) then
-      ne = ne + 1
-      write(*, 2004), 158, i, ci1(i)
-    end if
+    call check_int2(ne, 158, i, int(ci1(i)), i)
   end do
 
 ! 159: gd_get_carray_slice (INT8)
   call fgd_get_carray_i1(d, "carray", 3, 2, ci1)
-  e = fgd_error(d)
-
-  if (e .ne. GD_E_OK) then
-    ne = ne + 1
-    write(*, 2001), 159, e
-  end if
+  call check_ok(ne, 159, d)
 
   do i=1,2
-    if (ci1(i) .ne. i + 2) then
-      ne = ne + 1
-      write(*, 2004), 159, i, ci1(i)
-    end if
+    call check_int2(ne, 159, i, int(ci1(i)), i + 2)
   end do
 
 ! 160: gd_get_carray_slice (INT16)
   call fgd_get_carray_i2(d, "carray", 3, 2, ci2)
-  e = fgd_error(d)
-
-  if (e .ne. GD_E_OK) then
-    ne = ne + 1
-    write(*, 2001), 160, e
-  end if
+  call check_ok(ne, 160, d)
 
   do i=1,2
-    if (ci2(i) .ne. i + 2) then
-      ne = ne + 1
-      write(*, 2004), 160, i, ci2(i)
-    end if
+    call check_int2(ne, 160, i, int(ci2(i)), i + 2)
   end do
 
 ! 161: gd_get_carray_slice (INT32)
   call fgd_get_carray_i4(d, "carray", 3, 2, ci4)
-  e = fgd_error(d)
-
-  if (e .ne. GD_E_OK) then
-    ne = ne + 1
-    write(*, 2001), 161, e
-  end if
+  call check_ok(ne, 161, d)
 
   do i=1,2
-    if (ci4(i) .ne. i + 2) then
-      ne = ne + 1
-      write(*, 2004), 161, i, ci4(i)
-    end if
+    call check_int2(ne, 161, i, ci4(i), i + 2)
   end do
 
 ! 162: gd_get_carray_slice (INT64)
   call fgd_get_carray_i8(d, "carray", 3, 2, ci8)
-  e = fgd_error(d)
-
-  if (e .ne. GD_E_OK) then
-    ne = ne + 1
-    write(*, 2001), 162, e
-  end if
+  call check_ok(ne, 162, d)
 
   do i=1,2
-    if (ci8(i) .ne. i + 2) then
-      ne = ne + 1
-      write(*, 2004), 162, i, ci8(i)
-    end if
+    call check_int2(ne, 162, i, int(ci8(i)), i + 2)
   end do
 
 ! 163: gd_get_carray_slice (FLOAT32)
   call fgd_get_carray_r4(d, "carray", 3, 2, cr4)
-  e = fgd_error(d)
-
-  if (e .ne. GD_E_OK) then
-    ne = ne + 1
-    write(*, 2001), 163, e
-  end if
+  call check_ok(ne, 163, d)
 
   do i=1,2
-    if (abs(cr4(i) - (2 + i) * 1.1) > 0.001) then
-      ne = ne + 1
-      write(*, 2010), 163, i, cr4(i)
-    end if
+  call check_dbl2(ne, 163, i, 1d0 * cr4(i), (2 + i) * 1.1d0)
   end do
 
 ! 164: gd_get_carray_slice (FLOAT64)
   call fgd_get_carray_r8(d, "carray", 3, 2, cr8)
-  e = fgd_error(d)
-
-  if (e .ne. GD_E_OK) then
-    ne = ne + 1
-    write(*, 2001), 164, e
-  end if
+  call check_ok(ne, 164, d)
 
   do i=1,2
-    if (abs(cr8(i) - (2 + i) * 1.1) > 0.001) then
-      ne = ne + 1
-      write(*, 2010), 164, i, cr8(i)
-    end if
+  call check_dbl2(ne, 164, i, cr8(i), (2 + i) * 1.1d0)
   end do
 
 ! 165: gd_get_carray_slice (COMPLEX64)
-  call fgd_get_carray_c8(d, "carray", 3, 2, cc8)
-  e = fgd_error(d)
-
-  if (e .ne. GD_E_OK) then
-    ne = ne + 1
-    write(*, 2001), 165, e
-  end if
+  call fgd_get_carray_c8(d, "carray", 3, 2, cc8)
+  call check_ok(ne, 165, d)
 
   do i=1,2
-    if (abs(cc8(i) - (2 + i) * 1.1) > 0.001) then
-      ne = ne + 1
-      write(*, 2011), 165, i, real(real(cc8(i))), real(aimag(cc8(i)))
-    end if
+  call check_cpx2(ne, 165, i, 1d0 * cc8(i), dcmplx((2 + i) * 1.1, 0))
   end do
 
 ! 166: gd_get_carray_slice (COMPLEX128)
   call fgd_get_carray_c16(d, "carray", 3, 2, cc16)
-  e = fgd_error(d)
-
-  if (e .ne. GD_E_OK) then
-    ne = ne + 1
-    write(*, 2001), 166, e
-  end if
+  call check_ok(ne, 166, d)
 
   do i=1,2
-    if (abs(cc16(i) - (2 + i) * 1.1) > 0.001) then
-      ne = ne + 1
-      write(*, 2011), 166, i, real(real(cc16(i))), real(aimag(cc16(i)))
-    end if
+  call check_cpx2(ne, 166, i, cc16(i), dcmplx((2 + i) * 1.1, 0))
   end do
 
 ! 168: gd_put_carray
   ci1 = (/ 11_1, 12_1, 13_1, 14_1, 15_1, 16_1, 0_1, 0_1 /)
   call fgd_put_carray_i1(d, "carray", 0, 0, ci1)
-  e = fgd_error(d)
-
-  if (e .ne. GD_E_OK) then
-    ne = ne + 1
-    write(*, 2006), 168, 1, e
-  end if
+  call check_ok2(ne, 168, 1, d)
 
   call fgd_get_carray_i1(d, "carray", 0, 0, ci1)
-  e = fgd_error(d)
-
-  if (e .ne. GD_E_OK) then
-    ne = ne + 1
-    write(*, 2006), 168, 2, e
-  end if
+  call check_ok2(ne, 168, 2, d)
 
   do i=1,6
-    if (ci1(i) .ne. i + 10) then
-      ne = ne + 1
-      write(*, 2004), 168, i, ci1(i)
-    end if
+    call check_int2(ne, 168, i, int(ci1(i)), i + 10)
   end do
 
 ! 169: gd_put_carray_slice (INT8)
   ci1 = (/ 72_1, 73_1, 0_1, 0_1, 0_1, 0_1, 0_1, 0_1 /)
   call fgd_put_carray_i1(d, "carray", 3, 2, ci1)
-  e = fgd_error(d)
-
-  if (e .ne. GD_E_OK) then
-    ne = ne + 1
-    write(*, 2006), 169, 1, e
-  end if
+  call check_ok2(ne, 169, 1, d)
 
   call fgd_get_carray_i1(d, "carray", 0, 0, ci1)
-  e = fgd_error(d)
-
-  if (e .ne. GD_E_OK) then
-    ne = ne + 1
-    write(*, 2006), 169, 2, e
-  end if
+  call check_ok2(ne, 169, 2, d)
 
   do i=1,6
     if (i .eq. 3 .or. i .eq. 4) then
-      if (ci1(i) .ne. 69 + i) then
-        ne = ne + 1
-        write(*, 2004), 169, i, ci1(i)
-      end if
+      n = 69 + i
     else
-      if (ci1(i) .ne. i + 10) then
-        ne = ne + 1
-        write(*, 2004), 169, i, ci1(i)
-      end if
+      n = 10 + i
     end if
+    call check_int2(ne, 169, i, int(ci1(i)), n)
   end do
 
 ! 170: gd_put_carray_slice (INT16)
   ci2 = (/ 173_2, 174_2, 0_2, 0_2, 0_2, 0_2, 0_2, 0_2 /)
   call fgd_put_carray_i2(d, "carray", 3, 2, ci2)
-  e = fgd_error(d)
-
-  if (e .ne. GD_E_OK) then
-    ne = ne + 1
-    write(*, 2006), 170, 1, e
-  end if
+  call check_ok2(ne, 170, 1, d)
 
   call fgd_get_carray_i2(d, "carray", 0, 0, ci2)
-  e = fgd_error(d)
-
-  if (e .ne. GD_E_OK) then
-    ne = ne + 1
-    write(*, 2006), 170, 2, e
-  end if
+  call check_ok2(ne, 170, 2, d)
 
   do i=1,6
     if (i .eq. 3 .or. i .eq. 4) then
-      if (ci2(i) .ne. 170 + i) then
-        ne = ne + 1
-        write(*, 2004), 170, i, ci2(i)
-      end if
+      n = 170 + i
     else
-      if (ci2(i) .ne. i + 10) then
-        ne = ne + 1
-        write(*, 2004), 170, i, ci2(i)
-      end if
+      n = 10 + i
     end if
+    call check_int2(ne, 170, i, int(ci2(i)), n)
   end do
 
 ! 171: gd_put_carray_slice (INT32)
   ci4 = (/ 174, 175, 0, 0, 0, 0, 0, 0 /)
   call fgd_put_carray_i4(d, "carray", 3, 2, ci4)
-  e = fgd_error(d)
-
-  if (e .ne. GD_E_OK) then
-    ne = ne + 1
-    write(*, 2006), 171, 1, e
-  end if
+  call check_ok2(ne, 171, 1, d)
 
   call fgd_get_carray_i4(d, "carray", 0, 0, ci4)
-  e = fgd_error(d)
-
-  if (e .ne. GD_E_OK) then
-    ne = ne + 1
-    write(*, 2006), 171, 2, e
-  end if
+  call check_ok2(ne, 171, 2, d)
 
   do i=1,6
     if (i .eq. 3 .or. i .eq. 4) then
-      if (ci4(i) .ne. 171 + i) then
-        ne = ne + 1
-        write(*, 2004), 171, i, ci4(i)
-      end if
+      n = 171 + i
     else
-      if (ci4(i) .ne. i + 10) then
-        ne = ne + 1
-        write(*, 2004), 171, i, ci4(i)
-      end if
+      n = 10 + i
     end if
+    call check_int2(ne, 171, i, ci4(i), n)
   end do
 
 ! 172: gd_put_carray_slice (INT64)
   ci8 = (/ 175, 176, 0, 0, 0, 0, 0, 0 /)
   call fgd_put_carray_i8(d, "carray", 3, 2, ci8)
-  e = fgd_error(d)
-
-  if (e .ne. GD_E_OK) then
-    ne = ne + 1
-    write(*, 2006), 172, 1, e
-  end if
+  call check_ok2(ne, 172, 1, d)
 
   call fgd_get_carray_i8(d, "carray", 0, 0, ci8)
-  e = fgd_error(d)
-
-  if (e .ne. GD_E_OK) then
-    ne = ne + 1
-    write(*, 2006), 172, 2, e
-  end if
+  call check_ok2(ne, 172, 2, d)
 
   do i=1,6
     if (i .eq. 3 .or. i .eq. 4) then
-      if (ci8(i) .ne. 172 + i) then
-        ne = ne + 1
-        write(*, 2004), 172, i, ci8(i)
-      end if
+      n = 172 + i
     else
-      if (ci8(i) .ne. i + 10) then
-        ne = ne + 1
-        write(*, 2004), 172, i, ci8(i)
-      end if
+      n = 10 + i
     end if
+    call check_int2(ne, 172, i, int(ci8(i)), n)
   end do
 
 ! 173: gd_put_carray_slice (FLOAT32)
   cr4 = (/ 176., 177., 0., 0., 0., 0., 0., 0. /)
   call fgd_put_carray_r4(d, "carray", 3, 2, cr4)
-  e = fgd_error(d)
-
-  if (e .ne. GD_E_OK) then
-    ne = ne + 1
-    write(*, 2006), 173, 1, e
-  end if
+  call check_ok2(ne, 173, 1, d)
 
   call fgd_get_carray_r4(d, "carray", 0, 0, cr4)
-  e = fgd_error(d)
-
-  if (e .ne. GD_E_OK) then
-    ne = ne + 1
-    write(*, 2006), 173, 2, e
-  end if
+  call check_ok2(ne, 173, 2, d)
 
   do i=1,6
     if (i .eq. 3 .or. i .eq. 4) then
-      if (abs(cr4(i) - 173. - i) > 0.001) then
-        ne = ne + 1
-        write(*, 2010), 173, i, cr4(i)
-      end if
+      dp = 173. + i
     else
-      if (cr4(i) .ne. i + 10) then
-        ne = ne + 1
-        write(*, 2010), 173, i, cr4(i)
-      end if
+      dp = 10 + i
     end if
+    call check_dbl2(ne, 173, i, 1d0 * cr4(i), dp)
   end do
 
 ! 174: gd_put_carray_slice (FLOAT64)
   cr8 = (/ 177., 178., 0., 0., 0., 0., 0., 0. /)
   call fgd_put_carray_r8(d, "carray", 3, 2, cr8)
-  e = fgd_error(d)
-
-  if (e .ne. GD_E_OK) then
-    ne = ne + 1
-    write(*, 2006), 174, 1, e
-  end if
+  call check_ok2(ne, 174, 1, d)
 
   call fgd_get_carray_r8(d, "carray", 0, 0, cr8)
-  e = fgd_error(d)
-
-  if (e .ne. GD_E_OK) then
-    ne = ne + 1
-    write(*, 2006), 174, 2, e
-  end if
+  call check_ok2(ne, 174, 2, d)
 
   do i=1,6
     if (i .eq. 3 .or. i .eq. 4) then
-      if (abs(cr8(i) - 174. - i) > 0.001) then
-        ne = ne + 1
-        write(*, 2010), 174, i, cr8(i)
-      end if
+      dp = 174. + i
     else
-      if (cr8(i) .ne. i + 10) then
-        ne = ne + 1
-        write(*, 2010), 174, i, cr8(i)
-      end if
+      dp = 10 + i
     end if
+    call check_dbl2(ne, 174, i, cr8(i), dp)
   end do
 
 ! 175: gd_put_carray_slice (COMPLEX64)
   cc8 = (/ 178., 179., 0., 0., 0., 0., 0., 0. /)
   call fgd_put_carray_c8(d, "carray", 3, 2, cc8)
-  e = fgd_error(d)
-
-  if (e .ne. GD_E_OK) then
-    ne = ne + 1
-    write(*, 2006), 175, 1, e
-  end if
+  call check_ok2(ne, 175, 1, d)
 
   call fgd_get_carray_c8(d, "carray", 0, 0, cc8)
-  e = fgd_error(d)
-
-  if (e .ne. GD_E_OK) then
-    ne = ne + 1
-    write(*, 2006), 175, 2, e
-  end if
+  call check_ok2(ne, 175, 2, d)
 
   do i=1,6
     if (i .eq. 3 .or. i .eq. 4) then
-      if (abs(cc8(i) - 175. - i) > 0.001) then
-        ne = ne + 1
-        write(*, 2011), 175, i, real(real(cc8(i))), real(aimag(cc8(i)))
-      end if
+      dc = dcmplx(175d0 + i, 0d0)
     else
-      if (cc8(i) .ne. i + 10) then
-        ne = ne + 1
-        write(*, 2011), 175, i, real(real(cc8(i))), real(aimag(cc8(i)))
-      end if
+      dc = dcmplx(10d0 + i, 0d0)
     end if
+    call check_cpx2(ne, 175, i, 1d0 * cc8(i), dc)
   end do
 
 ! 176: gd_put_carray_slice (COMPLEX128)
   cc16 = (/ 179., 180., 0., 0., 0., 0., 0., 0. /)
   call fgd_put_carray_c16(d, "carray", 3, 2, cc16)
-  e = fgd_error(d)
-
-  if (e .ne. GD_E_OK) then
-    ne = ne + 1
-    write(*, 2006), 176, 1, e
-  end if
+  call check_ok2(ne, 176, 1, d)
 
   call fgd_get_carray_c16(d, "carray", 0, 0, cc16)
-  e = fgd_error(d)
-
-  if (e .ne. GD_E_OK) then
-    ne = ne + 1
-    write(*, 2006), 176, 2, e
-  end if
+  call check_ok2(ne, 176, 2, d)
 
   do i=1,6
     if (i .eq. 3 .or. i .eq. 4) then
-      if (abs(cc16(i) - 176. - i) > 0.001) then
-        ne = ne + 1
-        write(*, 2011), 176, i, real(real(cc16(i))), real(aimag(cc16(i)))
-      end if
+      dc = dcmplx(176d0 + i, 0d0)
     else
-      if (cc16(i) .ne. i + 10) then
-        ne = ne + 1
-        write(*, 2011), 176, i, real(real(cc16(i))), real(aimag(cc16(i)))
-      end if
+      dc = dcmplx(10d0 + i, 0d0)
     end if
+    call check_cpx2(ne, 175, i, cc16(i), dc)
   end do
 
 ! 177: gd_carray_len
   n = fgd_carray_len(d, 'carray')
-  e = fgd_error(d)
-
-  if (e .ne. GD_E_OK) then
-    ne = ne + 1
-    write(*, 2001), 177, e
-  end if
-
-  if (n .ne. 6) then
-    ne = ne + 1
-    write(*, 2002), 177, n
-  end if
+  call check_ok(ne, 177, d)
+  call check_int(ne, 177, n, 6)
 
 ! 178: gd_entry (CARRAY)
   n = fgd_entry(d, 'carray', ent)
-  e = fgd_error(d)
+  call check_ok(ne, 178, d)
+  call check_int2(ne, 178, 1, n, GD_CARRAY_ENTRY)
+  call check_int2(ne, 178, 2, ent%fragment_index, 0)
+  call check_int2(ne, 178, 2, ent%array_len, 6)
+  call check_int2(ne, 178, 3, ent%data_type, GD_FLOAT64)
 
-  if (e .ne. GD_E_OK) then
-    ne = ne + 1
-    write(*, 2001) 178, e
-  end if
+! 179: gd_add_carray
+  call fgd_add_carray(d, 'new17', GD_FLOAT64, 4, 0)
+  call check_ok2(ne, 179, 1, d)
 
-  if (n .ne. GD_CARRAY_ENTRY) then
-    ne = ne + 1
-    write(*, 2007) 178, 1, n
-  end if
+  n = fgd_entry(d, 'new17', ent)
+  call check_ok2(ne, 179, 2, d)
+  call check_int2(ne, 179, 1, n, GD_CARRAY_ENTRY)
+  call check_int2(ne, 179, 2, ent%fragment_index, 0)
+  call check_int2(ne, 179, 3, ent%array_len, 4)
+  call check_int2(ne, 179, 4, ent%data_type, GD_FLOAT64)
 
-  if (ent%fragment_index .ne. 0) then
-    ne = ne + 1
-    write(*, 2007) 178, 2, ent%fragment_index
-  end if
+  call fgd_get_carray_r4(d, 'new17', 0, 0, cr4)
+  call check_ok2(ne, 179, 3, d)
 
-  if (ent%array_len .ne. 6) then
-    ne = ne + 1
-    write(*, 2007) 178, 2, ent%array_len
-  end if
+  do i=1,4
+  call check_dbl2(ne, 179, i, 1d0 * cr4(i), 0d0)
+  end do
 
-  if (ent%data_type .ne. GD_FLOAT64) then
-    ne = ne + 1
-    write(*, 2007) 178, 3, ent%data_type
-  end if
+! 180: gd_madd_carray
+  call fgd_madd_carray(d, 'data', 'new17', GD_FLOAT64, 4)
+  call check_ok2(ne, 180, 1, d)
 
-! 179: gd_add_carray
-  call fgd_add_carray(d, 'new17', GD_FLOAT64, 4, 0)
-  e = fgd_error(d)
+  n = fgd_entry(d, 'data/new17', ent)
+  call check_ok2(ne, 180, 2, d)
+  call check_int2(ne, 180, 1, n, GD_CARRAY_ENTRY)
+  call check_int2(ne, 180, 2, ent%fragment_index, 0)
+  call check_int2(ne, 180, 3, ent%array_len, 4)
+  call check_int2(ne, 180, 4, ent%data_type, GD_FLOAT64)
 
-  if (e .ne. GD_E_OK) then
-    ne = ne + 1
-    write(*, 2006) 179, 1, e
-  end if
+  call fgd_get_carray_r4(d, 'data/new17', 0, 0, cr4)
+  call check_ok2(ne, 180, 3, d)
+
+  do i=1,4
+  call check_dbl2(ne, 180, i, 1d0 * cr4(i), 0d0)
+  end do
+
+! 181: gd_alter_carray
+  call fgd_alter_carray(d, 'new17', GD_FLOAT32, 3)
+  call check_ok2(ne, 181, 1, d)
 
   n = fgd_entry(d, 'new17', ent)
-  e = fgd_error(d)
+  call check_ok2(ne, 181, 2, d)
+  call check_int2(ne, 181, 1, n, GD_CARRAY_ENTRY)
+  call check_int2(ne, 181, 2, ent%fragment_index, 0)
+  call check_int2(ne, 181, 3, ent%data_type, GD_FLOAT32)
+  call check_int2(ne, 181, 4, ent%array_len, 3)
 
-  if (e .ne. GD_E_OK) then
-    ne = ne + 1
-    write(*, 2006) 179, 2, e
-  end if
+  call fgd_get_carray_r4(d, 'new17', 0, 0, cr4)
+  call check_ok2(ne, 181, 3, d)
 
-  if (n .ne. GD_CARRAY_ENTRY) then
-    ne = ne + 1
-    write(*, 2007) 179, 1, n
-  end if
+  do i=1,4
+  call check_dbl2(ne, 181, i, 1d0 * cr4(i), 0d0)
+  end do
 
-  if (ent%fragment_index .ne. 0) then
-    ne = ne + 1
-    write(*, 2007) 179, 2, ent%fragment_index
-  end if
+! 183: fgd_constants_i1 check
+  iq(1) = -123
+  iq(2) = -8
+  n = fgd_nfields_by_type(d, GD_CONST_ENTRY)
+  call fgd_constants_i1(ci1, d)
+  call check_ok(ne, 183, d)
 
-  if (ent%array_len .ne. 4) then
-    ne = ne + 1
-    write(*, 2007) 179, 3, ent%array_len
-  end if
+  do i = 1, n
+  call check_int2(ne, 183, i, int(ci1(i)), int(iq(i)))
+  end do
 
-  if (ent%data_type .ne. GD_FLOAT64) then
-    ne = ne + 1
-    write(*, 2007) 179, 4, ent%data_type
-  end if
+! 184: fgd_constants_i2 check
+  iq(1) = 133
+  call fgd_constants_i2(ci2, d)
+  call check_ok(ne, 184, d)
 
-  call fgd_get_carray_r4(d, 'new17', 0, 0, cr4)
-  e = fgd_error(d)
+  do i = 1, n
+  call check_int2(ne, 184, i, int(ci2(i)), int(iq(i)))
+  end do
 
-  if (e .ne. GD_E_OK) then
-    ne = ne + 1
-    write(*, 2006) 179, 3, e
-  end if
+! 185: fgd_constants_i4 check
+  call fgd_constants_i4(ci4, d)
+  call check_ok(ne, 185, d)
 
-  do i=1,4
-    if (abs(cr4(i)) > 1e-5) then
-      ne = ne + 1
-      write(*, 2010) 179, i, cr4(i)
-    end if
+  do i = 1, n
+  call check_int2(ne, 185, i, ci4(i), int(iq(i)))
   end do
 
-! 180: gd_madd_carray
-  call fgd_madd_carray(d, 'data', 'new17', GD_FLOAT64, 4)
-  e = fgd_error(d)
+! 186: fgd_constants_i8 check
+  call fgd_constants_i8(ci8, d)
+  call check_ok(ne, 186, d)
 
-  if (e .ne. GD_E_OK) then
-    ne = ne + 1
-    write(*, 2006) 180, 1, e
-  end if
+  do i = 1, n
+  call check_int2(ne, 186, i, int(ci8(i)), int(iq(i)))
+  end do
 
-  n = fgd_entry(d, 'data/new17', ent)
-  e = fgd_error(d)
+! 187: fgd_constants_r4 check
+  q(1) = 133.
+  q(2) = -8.1
+  call fgd_constants_r4(cr4, d)
+  call check_ok(ne, 187, d)
 
-  if (e .ne. GD_E_OK) then
-    ne = ne + 1
-    write(*, 2006) 180, 2, e
-  end if
+  do i = 1, n
+  call check_dbl2(ne, 187, i, 1d0 * cr4(i), q(i))
+  end do
 
-  if (n .ne. GD_CARRAY_ENTRY) then
-    ne = ne + 1
-    write(*, 2007) 180, 1, n
-  end if
+! 188: fgd_constants_r8 check
+  call fgd_constants_r8(cr8, d)
+  call check_ok(ne, 188, d)
 
-  if (ent%fragment_index .ne. 0) then
-    ne = ne + 1
-    write(*, 2007) 180, 2, ent%fragment_index
-  end if
+  do i = 1, n
+  call check_dbl2(ne, 188, i, cr8(i), q(i))
+  end do
 
-  if (ent%array_len .ne. 4) then
-    ne = ne + 1
-    write(*, 2007) 180, 3, ent%array_len
-  end if
 
-  if (ent%data_type .ne. GD_FLOAT64) then
-    ne = ne + 1
-    write(*, 2007) 180, 4, ent%data_type
-  end if
+! 189: fgd_constants_c8 check
+  cq(1) = 133.
+  cq(2) = -8.1
+  call fgd_constants_c8(cc8, d)
+  call check_ok(ne, 189, d)
 
-  call fgd_get_carray_r4(d, 'data/new17', 0, 0, cr4)
-  e = fgd_error(d)
+  do i = 1, n
+  call check_cpx2(ne, 189, i, 1d0 * cc8(i), cq(i))
+  end do
 
-  if (e .ne. GD_E_OK) then
-    ne = ne + 1
-    write(*, 2006) 180, 3, e
-  end if
+! 190: fgd_constants_c16 check
+  call fgd_constants_c16(cc16, d)
+  call check_ok(ne, 190, d)
 
-  do i=1,4
-    if (abs(cr4(i)) > 1e-5) then
-      ne = ne + 1
-      write(*, 2010) 180, i, cr4(i)
-    end if
+  do i = 1, n
+  call check_cpx2(ne, 190, i, cc16(i), cq(i))
   end do
 
-! 181: gd_alter_carray
-  call fgd_alter_carray(d, 'new17', GD_FLOAT32, 3)
-  e = fgd_error(d)
+! 191: fgd_mconstants_i1 check
+  iq(1) = 3
+  iq(2) = 0
+  n = fgd_nmfields_by_type(d, 'data', GD_CONST_ENTRY)
+  call fgd_mconstants_i1(ci1, d, 'data')
+  call check_ok(ne, 191, d)
 
-  if (e .ne. GD_E_OK) then
-    ne = ne + 1
-    write(*, 2006) 181, 1, e
-  end if
+  do i = 1, n
+  call check_int2(ne, 191, i, int(ci1(i)), int(iq(i)))
+  end do
 
-  n = fgd_entry(d, 'new17', ent)
-  e = fgd_error(d)
+! 192: fgd_mconstants_i2 check
+  call fgd_mconstants_i2(ci2, d, 'data')
+  call check_ok(ne, 192, d)
 
-  if (e .ne. GD_E_OK) then
-    ne = ne + 1
-    write(*, 2006) 181, 2, e
-  end if
+  do i = 1, n
+  call check_int2(ne, 192, i, int(ci2(i)), int(iq(i)))
+  end do
 
-  if (n .ne. GD_CARRAY_ENTRY) then
-    ne = ne + 1
-    write(*, 2007) 181, 1, n
-  end if
+! 193: fgd_mconstants_i4 check
+  call fgd_mconstants_i4(ci4, d, 'data')
+  call check_ok(ne, 193, d)
 
-  if (ent%fragment_index .ne. 0) then
-    ne = ne + 1
-    write(*, 2007) 181, 2, ent%fragment_index
-  end if
+  do i = 1, n
+  call check_int2(ne, 193, i, ci4(i), int(iq(i)))
+  end do
 
-  if (ent%data_type .ne. GD_FLOAT32) then
-    ne = ne + 1
-    write(*, 2007) 181, 3, ent%data_type
-  end if
+! 194: fgd_mconstants_i8 check
+  call fgd_mconstants_i8(ci8, d, 'data')
+  call check_ok(ne, 194, d)
 
-  if (ent%array_len .ne. 3) then
-    ne = ne + 1
-    write(*, 2007) 181, 4, ent%data_type
-  end if
+  do i = 1, n
+  call check_int2(ne, 194, i, int(ci8(i)), int(iq(i)))
+  end do
 
-  call fgd_get_carray_r4(d, 'new17', 0, 0, cr4)
-  e = fgd_error(d)
+! 195: fgd_mconstants_r4 check
+  q(1) = 3.3
+  q(2) = 0.
+  call fgd_mconstants_r4(cr4, d, 'data')
+  call check_ok(ne, 195, d)
 
-  if (e .ne. GD_E_OK) then
-    ne = ne + 1
-    write(*, 2006) 181, 3, e
-  end if
+  do i = 1, n
+  call check_dbl2(ne, 195, i, 1d0 * cr4(i), q(i))
+  end do
 
-  do i=1,4
-    if (abs(cr4(i)) > 1e-5) then
-      ne = ne + 1
-      write(*, 2010) 181, i, cr4(i)
-    end if
+! 196: fgd_mconstants_r8 check
+  call fgd_mconstants_r8(cr8, d, 'data')
+  call check_ok(ne, 196, d)
+
+  do i = 1, n
+  call check_dbl2(ne, 196, i, cr8(i), q(i))
+  end do
+
+
+! 197: fgd_mconstants_c8 check
+  cq(1) = dcmplx(3.3, 4.4)
+  cq(2) = 0.
+  call fgd_mconstants_c8(cc8, d, 'data')
+  call check_ok(ne, 197, d)
+
+  do i = 1, n
+  call check_cpx2(ne, 197, i, 1d0 * cc8(i), cq(i))
+  end do
+
+! 198: fgd_mconstants_c16 check
+  call fgd_mconstants_c16(cc16, d, 'data')
+  call check_ok(ne, 198, d)
+
+  do i = 1, n
+  call check_cpx2(ne, 198, i, cc16(i), cq(i))
+  end do
+
+! 199: fgd_strings check
+  strings(1) = "Lorem ipsum"
+  strings(2) = ""
+  strings(3) = "Arthur Dent"
+  n = fgd_nfields_by_type(d, GD_STRING_ENTRY)
+  l = slen
+  call fgd_strings(st, d, l)
+  call check_ok(ne, 199, d)
+  call check_int(ne, 199, l, slen)
+
+  do i = 1, n
+  call check_str2(ne, 199, i, st(i), strings(i))
   end do
 
+! 200: fgd_strings check
+  strings(1) = "This is a string constant."
+  strings(2) = ""
+  n = fgd_nmfields_by_type(d, 'data', GD_STRING_ENTRY)
+  l = slen
+  call fgd_mstrings(st, d, 'data', l)
+  call check_ok(ne, 200, d)
+  call check_int(ne, 200, l, slen)
 
+  do i = 1, n
+  call check_str2(ne, 200, i, st(i), strings(i))
+  end do
+
+! 201: fgd_string_value_max
+  n = fgd_string_value_max(d)
+  call check_int(ne, 201, n, 11)
+
+! 202: fgd_mstring_value_max
+  n = fgd_mstring_value_max(d, 'data')
+  call check_int(ne, 202, n, 26)
+
+! 203: fgd_seek check
+  n = fgd_seek(d, 'data', 35, 0, GD_SEEK_SET)
+  call check_ok(ne, 203, d)
+  call check_int2(ne, 203, 1, n, 280)
+
+  n = fgd_getdata_r8(d, 'data', GD_HERE, 0, 1, 0, cr8)
+  call check_int2(ne, 203, 2, n, 8)
+
+  do i=1,8
+  call check_dbl2(ne, 203, i, cr8(i), 16d0 + i)
+  end do
+
+! 204: fgd_tell check
+  n = fgd_tell(d, 'data')
+  call check_ok(ne, 204, d)
+  call check_int(ne, 204, n, 288)
+
+! 205: fgd_hide check
+  call fgd_hide(d, 'data')
+  call check_ok(ne, 205, d)
+
+! 206: fgd_hidden check
+  n = fgd_hidden(d, 'data')
+  call check_ok2(ne, 206, 1, d)
+  call check_int2(ne, 206, 1, n, 1)
+
+  n = fgd_hidden(d, 'lincom')
+  call check_ok2(ne, 206, 2, d)
+  call check_int2(ne, 206, 2, n, 0)
+
+! 207: fgd_unhide check
+  call fgd_unhide(d, 'data')
+  call check_ok2(ne, 206, 1, d)
+  n = fgd_hidden(d, 'data')
+  call check_ok2(ne, 206, 2, d)
+  call check_int(ne, 206, n, 0)
+
+! 208: fgd_sync check
+  call fgd_sync(d, 'data')
+  call check_ok(ne, 208, d)
+
+! 209: fgd_flush check
+  call fgd_flush(d, 'data')
+  call check_ok(ne, 209, d)
+
+! 210: fgd_metaflush check
+  call fgd_metaflush(d)
+  call check_ok(ne, 210, d)
+
+! 211: fgd_entry (WINDOW) check
+  n = fgd_entry(d, 'window', ent)
+  call check_ok(ne, 211, d)
+  call check_int2(ne, 211, 1, n, GD_WINDOW_ENTRY)
+  call check_int2(ne, 211, 2, ent%fragment_index, 0)
+  call check_int2(ne, 211, 3, ent%windop, GD_WINDOP_LT)
+  call check_str2(ne, 211, 4, ent%field(1), 'linterp')
+  call check_str2(ne, 211, 5, ent%field(2), 'mult')
+  call check_dbl2(ne, 211, 6, ent%rthreshold, 4.1D0)
+
+! 212: fgd_add_window_i check
+  call fgd_add_window_i(d, 'new18', 'in1', 'in2', GD_WINDOP_NE, 32, 0)
+  call check_ok2(ne, 212, 1, d)
+
+  n = fgd_entry(d, 'new18', ent)
+  call check_ok2(ne, 212, 2, d)
+  call check_int2(ne, 212, 1, n, GD_WINDOW_ENTRY)
+  call check_int2(ne, 212, 2, ent%fragment_index, 0)
+  call check_int2(ne, 212, 3, ent%windop, GD_WINDOP_NE)
+  call check_str2(ne, 212, 4, ent%field(1), 'in1')
+  call check_str2(ne, 212, 5, ent%field(2), 'in2')
+  call check_int2(ne, 212, 6, ent%ithreshold, 32)
+
+! 213: fgd_add_window_r check
+  call fgd_add_window_r(d, 'new19', 'in5', 'in4', GD_WINDOP_LE, 1d-4, 0)
+  call check_ok2(ne, 213, 1, d)
+
+  n = fgd_entry(d, 'new19', ent)
+  call check_ok2(ne, 213, 2, d)
+  call check_int2(ne, 213, 1, n, GD_WINDOW_ENTRY)
+  call check_int2(ne, 213, 2, ent%fragment_index, 0)
+  call check_int2(ne, 213, 3, ent%windop, GD_WINDOP_LE)
+  call check_str2(ne, 213, 4, ent%field(1), 'in5')
+  call check_str2(ne, 213, 5, ent%field(2), 'in4')
+  call check_dbl2(ne, 213, 6, ent%rthreshold, 1d-4)
+
+! 214: fgd_madd_window_i check
+  call fgd_madd_window_i(d, 'data', 'mnew18', 'in2', 'in3', GD_WINDOP_SET, &
+  128)
+  call check_ok2(ne, 214, 1, d)
+
+  n = fgd_entry(d, 'data/mnew18', ent)
+  call check_ok2(ne, 214, 2, d)
+  call check_int2(ne, 214, 1, n, GD_WINDOW_ENTRY)
+  call check_int2(ne, 214, 2, ent%fragment_index, 0)
+  call check_int2(ne, 214, 3, ent%windop, GD_WINDOP_SET)
+  call check_str2(ne, 214, 4, ent%field(1), 'in2')
+  call check_str2(ne, 214, 5, ent%field(2), 'in3')
+  call check_int2(ne, 214, 6, ent%ithreshold, 128)
+
+! 215: fgd_madd_window_r check
+  call fgd_madd_window_r(d, 'data', 'mnew19', 'in4', 'in1', GD_WINDOP_GT, &
+  0d0)
+  call check_ok2(ne, 215, 1, d)
+
+  n = fgd_entry(d, 'data/mnew19', ent)
+  call check_ok2(ne, 215, 2, d)
+  call check_int2(ne, 215, 1, n, GD_WINDOW_ENTRY)
+  call check_int2(ne, 215, 2, ent%fragment_index, 0)
+  call check_int2(ne, 215, 3, ent%windop, GD_WINDOP_GT)
+  call check_str2(ne, 215, 4, ent%field(1), 'in4')
+  call check_str2(ne, 215, 5, ent%field(2), 'in1')
+  call check_dbl2(ne, 215, 6, ent%rthreshold, 0d0)
+
+! 216: fgd_alter_window_i check
+  call fgd_alter_window_i(d, 'new19', 'in3', 'in5', GD_WINDOP_CLR, 32)
+  call check_ok2(ne, 216, 1, d)
+
+  n = fgd_entry(d, 'new19', ent)
+  call check_ok2(ne, 216, 2, d)
+  call check_int2(ne, 216, 1, n, GD_WINDOW_ENTRY)
+  call check_int2(ne, 216, 2, ent%fragment_index, 0)
+  call check_int2(ne, 216, 3, ent%windop, GD_WINDOP_CLR)
+  call check_str2(ne, 216, 4, ent%field(1), 'in3')
+  call check_str2(ne, 216, 5, ent%field(2), 'in5')
+  call check_int2(ne, 216, 6, ent%ithreshold, 32)
+
+! 217: fgd_alter_window_r check
+  call fgd_alter_window_r(d, 'new18', 'in3', 'in4', GD_WINDOP_GE, 32d3)
+  call check_ok2(ne, 217, 1, d)
+
+  n = fgd_entry(d, 'new18', ent)
+  call check_ok2(ne, 217, 2, d)
+  call check_int2(ne, 217, 1, n, GD_WINDOW_ENTRY)
+  call check_int2(ne, 217, 2, ent%fragment_index, 0)
+  call check_int2(ne, 217, 3, ent%windop, GD_WINDOP_GE)
+  call check_str2(ne, 217, 4, ent%field(1), 'in3')
+  call check_str2(ne, 217, 5, ent%field(2), 'in4')
+  call check_dbl2(ne, 217, 6, ent%rthreshold, 32d3)
+
+! 218: fgd_alias_target check
+  str = fgd_alias_target(d, 'alias')
+  call check_ok(ne, 218, d)
+  call check_str(ne, 218, str, 'data')
+
+! 219: fgd_add_alias check
+  call fgd_add_alias(d, 'new20', 'data', 0)
+  call check_ok2(ne, 219, 1, d)
+
+  str = fgd_alias_target(d, 'new20')
+  call check_ok2(ne, 219, 2, d)
+  call check_str(ne, 219, str, 'data')
+
+! 220: fgd_madd_alias check
+  call fgd_madd_alias(d, 'data', 'mnew20', 'data')
+  call check_ok2(ne, 220, 1, d)
+
+  str = fgd_alias_target(d, 'data/mnew20')
+  call check_ok2(ne, 220, 2, d)
+  call check_str(ne, 220, str, 'data')
+
+! 221: fgd_naliases check
+  n = fgd_naliases(d, 'data')
+  call check_ok(ne, 221, d)
+  call check_int(ne, 221, n, 4)
+
+! 222: GDALSS check
+  fields(1) = 'data'
+  fields(2) = 'alias'
+  fields(3) = 'data/mnew20'
+  fields(4) = 'new20'
+  l = flen
+  call fgd_aliases(flist, d, 'data', l)
+  call check_ok(ne, 222, d)
+  call check_int(ne, 222, l, flen)
+
+  do i = 1, n
+  call check_str2(ne, 222, i, flist(i), fields(i))
+  end do
+
+! 223: fgd_include_affix check
+  call fgd_include_affix(d, 'format1', 0, 'A', 'Z', GD_CREAT + GD_EXCL)
+  call check_ok(ne, 223, d)
+
+! 224: GDMOVA check
+  call fgd_move_alias(d, 'new20', 1)
+  call check_ok2(ne, 224, 1, d)
+
+  n = fgd_fragment_index(d, 'Anew20Z')
+  call check_ok2(ne, 224, 2, d)
+  call check_int(ne, 224, n, 1)
+
+! 225: fgd_delete_alias check
+  call fgd_delete_alias(d, 'Anew20Z', 0)
+  call check_ok2(ne, 225, 1, d)
+
+  n = fgd_fragment_index(d, 'Anew20Z')
+  call check_err2(ne, 225, 2, d, GD_E_BAD_CODE)
+  call check_int(ne, 225, n, -1)
+
+! 226: fgd_fragment_affixes check
+  l = flen
+  n = flen
+  call fgd_fragment_affixes(fields(1), l, fields(2), n, d, 1)
+  call check_ok(ne, 226, d)
+  call check_int2(ne, 226, 1, l, flen)
+  call check_str2(ne, 226, 2, fields(1), 'A')
+  call check_int2(ne, 226, 3, n, flen)
+  call check_str2(ne, 226, 4, fields(2), 'Z')
+
+! 227: fgd_alter_affixes check
+  call fgd_alter_affixes(d, 1, 'B', '')
+  call check_ok2(ne, 227, 1, d)
+
+  l = flen
+  n = flen
+  call fgd_fragment_affixes(fields(1), l, fields(2), n, d, 1)
+  call check_ok2(ne, 227, 2, d)
+  call check_int2(ne, 226, 3, l, flen)
+  call check_str2(ne, 227, 4, fields(1), 'B')
+  call check_int2(ne, 226, 5, n, flen)
+  call check_str2(ne, 227, 6, fields(2), '')
+
+! 228: fgd_entry (MPLEX) check
+  n = fgd_entry(d, 'mplex', ent)
+  call check_ok(ne, 228, d)
+  call check_int2(ne, 228, 1, n, GD_MPLEX_ENTRY)
+  call check_int2(ne, 228, 2, ent%fragment_index, 0)
+  call check_int2(ne, 228, 3, ent%count_val, 1)
+  call check_str2(ne, 228, 4, ent%field(1), 'data')
+  call check_str2(ne, 228, 5, ent%field(2), 'sbit')
+  call check_int2(ne, 228, 6, ent%period, 10)
+
+! 229: fgd_add_mplex check
+  call fgd_add_mplex(d, 'new21', 'in1', 'in2', 5, 6, 0)
+  call check_ok2(ne, 229, 1, d)
+
+  n = fgd_entry(d, 'new21', ent)
+  call check_ok2(ne, 229, 2, d)
+  call check_int2(ne, 229, 1, n, GD_MPLEX_ENTRY)
+  call check_int2(ne, 229, 2, ent%fragment_index, 0)
+  call check_int2(ne, 229, 3, ent%count_val, 5)
+  call check_str2(ne, 229, 4, ent%field(1), 'in1')
+  call check_str2(ne, 229, 5, ent%field(2), 'in2')
+  call check_int2(ne, 229, 6, ent%period, 6)
+
+! 230: fgd_madd_mplex check
+  call fgd_madd_mplex(d, 'data', 'mnew21', 'in2', 'in3', 0, 12)
+  call check_ok2(ne, 230, 1, d)
+
+  n = fgd_entry(d, 'data/mnew21', ent)
+  call check_ok2(ne, 230, 2, d)
+  call check_int2(ne, 230, 1, n, GD_MPLEX_ENTRY)
+  call check_int2(ne, 230, 2, ent%fragment_index, 0)
+  call check_int2(ne, 230, 3, ent%count_val, 0)
+  call check_str2(ne, 230, 4, ent%field(1), 'in2')
+  call check_str2(ne, 230, 5, ent%field(2), 'in3')
+  call check_int2(ne, 230, 6, ent%period, 12)
+
+! 231: fgd_alter_mplex check
+  call fgd_alter_mplex(d, 'new21', 'in3', 'in4', 7, -1)
+  call check_ok2(ne, 231, 1, d)
+
+  n = fgd_entry(d, 'new21', ent)
+  call check_ok2(ne, 231, 2, d)
+  call check_int2(ne, 231, 1, n, GD_MPLEX_ENTRY)
+  call check_int2(ne, 231, 2, ent%fragment_index, 0)
+  call check_int2(ne, 231, 3, ent%count_val, 7)
+  call check_str2(ne, 231, 4, ent%field(1), 'in3')
+  call check_str2(ne, 231, 5, ent%field(2), 'in4')
+  call check_int2(ne, 231, 6, ent%period, 6)
+
+! 232: fgd_strtok check
+  l = slen
+  call fgd_strtok(str, l, d, '"test1 test2" test3\ test4 test5')
+  call check_ok2(ne, 232, 1, d)
+  call check_int2(ne, 232, 2, l, slen)
+  call check_str2(ne, 232, 3, str, 'test1 test2')
+
+  l = slen
+  call fgd_strtok(str, l, d, '')
+  call check_ok2(ne, 232, 4, d)
+  call check_int2(ne, 232, 5, l, slen)
+  call check_str2(ne, 232, 6, str, 'test3 test4')
+
+! 233: fgd_raw_close check
+  call fgd_raw_close(d, 'data')
+  call check_ok(ne, 233, d)
+
+! 234: fgd_desync check
+  n = fgd_desync(d, 0)
+  call check_ok(ne, 234, d)
+  call check_int(ne, 234, n, 0)
+
+! 235: fgd_flags check
+  n = fgd_flags(d, GD_PRETTY_PRINT, 0)
+  call check_ok(ne, 235, d)
+  call check_int(ne, 235, n, GD_PRETTY_PRINT)
+
+! 236: fgd_verbose_prefix check
+  call fgd_verbose_prefix(d, "big_test95")
+  call check_ok(ne, 236, d)
+
+! 237: fgd_nentries check
+  n = fgd_nentries(d, "data", GD_SCALAR_ENTRIES, IOR(GD_ENTRIES_HIDDEN, &
+  GD_ENTRIES_NOALIAS))
+  call check_ok2(ne, 237, 1, d)
+  call check_int2(ne, 237, 1, n, 5)
+  n = fgd_nentries(d, "", GD_VECTOR_ENTRIES, IOR(GD_ENTRIES_HIDDEN, &
+  GD_ENTRIES_NOALIAS))
+  call check_ok2(ne, 237, 2, d)
+  call check_int2(ne, 237, 2, n, 28)
+
+! 238: fgd_field_name_max check
+  i = fgd_entry_name_max(d, "", GD_VECTOR_ENTRIES, IOR(GD_ENTRIES_HIDDEN, &
+    GD_ENTRIES_NOALIAS))
+  call check_ok(ne, 238, d)
+  call check_int(ne, 238, i, 7)
+
+! 239: fgd_field_list check
+  fields = (/    'INDEX      ', 'bit        ', 'data       ', 'div        ', &
+  'lincom     ', 'linterp    ', 'mplex      ', 'mult       ', 'new1       ', &
+  'new13      ', 'new14      ', 'new15      ', 'new16      ', 'new18      ', &
+  'new19      ', 'new2       ', 'new21      ', 'new3       ', 'new4       ', &
+  'new5       ', 'new6       ', 'new7       ', 'new8       ', 'phase      ', &
+  'polynom    ', 'recip      ', 'sbit       ', 'window     ' /)
+  l = flen
+  call fgd_entry_list(flist, d, "", GD_VECTOR_ENTRIES, IOR(GD_ENTRIES_HIDDEN, &
+      GD_ENTRIES_NOALIAS), l)
+  call check_ok(ne, 239, d)
+  call check_int(ne, 239, l, flen)
+
+  do i = 1, n
+  call check_str2(ne, 239, i, flist(i), fields(i))
+  end do
+
+! 240: fgd_mplex_lookback check
+  call fgd_mplex_lookback(d, GD_LOOKBACK_ALL)
+  call check_ok(ne, 240, d)
+
+! 241: fgd_raw_filename check
+  str = fgd_linterp_tablename(d, "linterp")
+  call check_ok(ne, 241, d)
+  call check_eos(ne, 241, str, 'test95_dirfile'//DIRSEP//'lut')
+
+
+ 
 
 
   
@@ -4777,21 +2578,9 @@ program big_test
   call system ( 'rm -rf ' // fildir )
 
   if (ne .GT. 0) then
-    write(*, 2003) ne
+    write(*, 9000) ne
     call exit(1)
   end if
 
-2001 format('e[', i0, '] = ', i0)
-2002 format('n[', i0, '] = ', i0)
-2003 format('ne = ', i0)
-2004 format('c(', i0, ')[', i0, '] = ', i0)
-2005 format('fl[', i0, '] = ', f0.16)
-2006 format('e[', i0, ', ', i0, '] = ', i0)
-2007 format('n[', i0, ', ', i0, '] = ', i0)
-2008 format('fn(', i0, ')[', i0, '] = "', a, '"')
-2009 format('s[' i0, '] = "', a, '"')
-2010 format('p(', i0, ')[', i0, '] = ', d16.10)
-2011 format('p(', i0, ')[', i0, '] = ', d16.10, ';', d16.10)
-2012 format('d[', i0, '] = ', d16.10)
-2013 format('c[', i0, '] = ', d16.10, ';', d16.10)
+9000 format('ne = ', i0)
 end program
diff --git a/bindings/f77/test/gdcopn.f b/bindings/f77/test/gdcopn.f
index 89a9cf5..299a042 100644
--- a/bindings/f77/test/gdcopn.f
+++ b/bindings/f77/test/gdcopn.f
@@ -11,24 +11,37 @@ C     Tell the parser to ignore syntax errors
 
       END SUBROUTINE
 
+      SUBROUTINE CALBK2(R, DUNIT, SUBERROR, LINE)
+      INTEGER R
+
+C     An invalid response
+      R = 3333
+
+      END SUBROUTINE
+
       PROGRAM GETTST
+      IMPLICIT NONE
       EXTERNAL CALBCK
+      EXTERNAL CALBK2
       INCLUDE "getdata.f"
 
       CHARACTER*12 fildir
       PARAMETER (fildir = 'test_dirfile')
       CHARACTER*19 frmat
       PARAMETER (frmat = 'test_dirfile/format')
+      CHARACTER*20 frmat2
+      PARAMETER (frmat2 = 'test_dirfile/format2')
+      CHARACTER*20 frmat3
+      PARAMETER (frmat3 = 'test_dirfile/format3')
       CHARACTER*17 dat
       PARAMETER (dat = 'test_dirfile/data')
-      CHARACTER*15 frmdat1
-      PARAMETER (frmdat1 =  'data RAW INT8 8')
-      CHARACTER*9 frmdat2
-      PARAMETER (frmdat2 =  'bad line')
       INTEGER*1 datdat(80)
-      INTEGER*1 i;
-      INTEGER d;
-      INTEGER e;
+      INTEGER*1 i
+      INTEGER d
+      INTEGER e1, e2, e3, e4
+      INTEGER r
+
+      r = 0
 
       CALL SYSTEM ( 'rm -rf ' // fildir )
       CALL SYSTEM ( 'mkdir ' // fildir )
@@ -38,8 +51,16 @@ C     Tell the parser to ignore syntax errors
    20 CONTINUE
 
       OPEN(1, FILE=frmat, STATUS='NEW')
-      WRITE(1, *) frmdat1
-      WRITE(1, *) frmdat2
+      WRITE(1, *) "data RAW INT 8"
+      WRITE(1, *) "bad line"
+      CLOSE(1, STATUS='KEEP')
+
+      OPEN(1, FILE=frmat2, STATUS='NEW')
+      WRITE(1, *) "bad line2"
+      CLOSE(1, STATUS='KEEP')
+
+      OPEN(1, FILE=frmat3, STATUS='NEW')
+      WRITE(1, *) "bad line3"
       CLOSE(1, STATUS='KEEP')
 
       OPEN(1, FILE=dat, FORM='UNFORMATTED', ACCESS='DIRECT', RECL=80,
@@ -47,13 +68,44 @@ C     Tell the parser to ignore syntax errors
       WRITE (1,REC=1) datdat
       CLOSE(1, STATUS='KEEP')
 
-      CALL GDCOPN(d, fildir, 12, GD_RO, CALBCK)
-      CALL GDEROR(e, d)
-      CALL GDCLOS(d)
+      CALL GDCOPN(d, fildir, 12, GD_RW, CALBCK)
+      CALL GDEROR(e1, d)
+      CALL GDINCL(d, "format2", 7, 0, 0)
+      CALL GDEROR(e2, d)
+
+C     Change callback
+      CALL GDCLBK(d, CALBK2)
+      CALL GDINCL(d, "format3", 7, 0, 0)
+      CALL GDEROR(e3, d)
+
+C     Delete callback
+      CALL GDNOCB(d)
+      CALL GDINCL(d, "format3", 7, 0, 0)
+      CALL GDEROR(e4, d)
+      CALL GDDSCD(d)
 
       CALL SYSTEM ( 'rm -rf ' // fildir )
 
-      IF (e .NE. GD_EOK) CALL EXIT(1)
+      IF (e1 .NE. GD_EOK) THEN
+        r = 1
+        WRITE(*, 9001) 1, e1, GD_EOK
+      ENDIF
+      IF (e2 .NE. GD_EOK) THEN
+        r = 1
+        WRITE(*, 9001) 2, e2, GD_EOK
+      ENDIF
+      IF (e3 .NE. GD_ECB) THEN
+        r = 1
+        WRITE(*, 9001) 3, e3, GD_ECB
+      ENDIF
+      IF (e4 .NE. GD_EFO) THEN
+        r = 1
+        WRITE(*, 9001) 3, e4, GD_EFO
+      ENDIF
+
+      IF (r .GT. 0) CALL ExIT(1)
+
+ 9001 FORMAT('e[', i3, '] = ', i4, ', expected ', i4)
 
       STOP
       END
diff --git a/bindings/f77/test/test_getdata.f.in b/bindings/f77/test/test_getdata.f.in
new file mode 100644
index 0000000..d5a0e61
--- /dev/null
+++ b/bindings/f77/test/test_getdata.f.in
@@ -0,0 +1,2 @@
+      CHARACTER*1 DIRSEP
+      PARAMETER (DIRSEP="@GD_FDIRSEP@")
diff --git a/bindings/idl/Makefile.am b/bindings/idl/Makefile.am
index 3ac4638..240e3bd 100644
--- a/bindings/idl/Makefile.am
+++ b/bindings/idl/Makefile.am
@@ -24,13 +24,9 @@ if CC_WALL
 WALL=-Wall
 endif
 
-if GETDATA_DEBUG
-DEBUG_C = ../../src/debug.c
-endif
-
 SUBDIRS=test
 
-if GDIDL_EXTERNAL
+if GD_EXTERNAL
 GDIDL_GETDATA_LIBS=$(GETDATA_LIBS)
 else
 GDIDL_GETDATA_LIBS=../../src/libgetdata.la
@@ -46,7 +42,7 @@ idl_getdata_la_LDFLAGS = -module -avoid-version -export-symbols-regex IDL_Load \
 												 -precious-files-regex 'idl_getdata\.dlm' $(IDL_LIBS)
 idl_getdata_la_LIBADD = $(GDIDL_GETDATA_LIBS)
 idl_getdata_la_SOURCES = getdata.c
-nodist_idl_getdata_la_SOURCES = constants.c sublist.c ${DEBUG_C}
+nodist_idl_getdata_la_SOURCES = constants.c sublist.c
 
 sublist.c.in: getdata.c makedlm.sh
 	${SHELL} ./makedlm.sh -c $< > $@
diff --git a/bindings/idl/Makefile.in b/bindings/idl/Makefile.in
index 335b2f9..c96f46d 100644
--- a/bindings/idl/Makefile.in
+++ b/bindings/idl/Makefile.in
@@ -1,9 +1,9 @@
-# Makefile.in generated by automake 1.11.1 from Makefile.am.
+# Makefile.in generated by automake 1.11.5 from Makefile.am.
 # @configure_input@
 
 # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005, 2006, 2007, 2008, 2009  Free Software Foundation,
-# Inc.
+# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software
+# Foundation, Inc.
 # This Makefile.in is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
@@ -17,6 +17,23 @@
 
 
 VPATH = @srcdir@
+am__make_dryrun = \
+  { \
+    am__dry=no; \
+    case $$MAKEFLAGS in \
+      *\\[\ \	]*) \
+        echo 'am--echo: ; @echo "AM"  OK' | $(MAKE) -f - 2>/dev/null \
+          | grep '^AM OK$$' >/dev/null || am__dry=yes;; \
+      *) \
+        for am__flg in $$MAKEFLAGS; do \
+          case $$am__flg in \
+            *=*|--*) ;; \
+            *n*) am__dry=yes; break;; \
+          esac; \
+        done;; \
+    esac; \
+    test $$am__dry = yes; \
+  }
 pkgdatadir = $(datadir)/@PACKAGE@
 pkgincludedir = $(includedir)/@PACKAGE@
 pkglibdir = $(libdir)/@PACKAGE@
@@ -41,15 +58,17 @@ DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
 am__aclocal_m4_deps = $(top_srcdir)/m4/ax_compare_version.m4 \
 	$(top_srcdir)/m4/compiler.m4 $(top_srcdir)/m4/encoding.m4 \
-	$(top_srcdir)/m4/idl.m4 $(top_srcdir)/m4/libtool.m4 \
-	$(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \
-	$(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \
-	$(top_srcdir)/m4/python.m4 $(top_srcdir)/m4/win32.m4 \
-	$(top_srcdir)/m4/version.m4 $(top_srcdir)/configure.ac
+	$(top_srcdir)/m4/floatordering.m4 $(top_srcdir)/m4/idl.m4 \
+	$(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \
+	$(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \
+	$(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/m4/matlab.m4 \
+	$(top_srcdir)/m4/perl.m4 $(top_srcdir)/m4/python.m4 \
+	$(top_srcdir)/m4/win32.m4 $(top_srcdir)/m4/version.m4 \
+	$(top_srcdir)/configure.ac
 am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
 	$(ACLOCAL_M4)
 mkinstalldirs = $(install_sh) -d
-CONFIG_HEADER = $(top_builddir)/src/config.h \
+CONFIG_HEADER = $(top_builddir)/src/gd_config.h \
 	$(top_builddir)/src/getdata.h
 CONFIG_CLEAN_FILES = makedlm.sh
 CONFIG_CLEAN_VPATH_FILES =
@@ -74,14 +93,18 @@ am__nobase_list = $(am__nobase_strip_setup); \
 am__base_list = \
   sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \
   sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
+am__uninstall_files_from_dir = { \
+  test -z "$$files" \
+    || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \
+    || { echo " ( cd '$$dir' && rm -f" $$files ")"; \
+         $(am__cd) "$$dir" && rm -f $$files; }; \
+  }
 am__installdirs = "$(DESTDIR)$(idldir)" "$(DESTDIR)$(idldir)"
 LTLIBRARIES = $(idl_LTLIBRARIES)
- at GDIDL_EXTERNAL_FALSE@am__DEPENDENCIES_1 = ../../src/libgetdata.la
+ at GD_EXTERNAL_FALSE@am__DEPENDENCIES_1 = ../../src/libgetdata.la
 idl_getdata_la_DEPENDENCIES = $(am__DEPENDENCIES_1)
 am_idl_getdata_la_OBJECTS = getdata.lo
- at GETDATA_DEBUG_TRUE@am__objects_1 = debug.lo
-nodist_idl_getdata_la_OBJECTS = constants.lo sublist.lo \
-	$(am__objects_1)
+nodist_idl_getdata_la_OBJECTS = constants.lo sublist.lo
 idl_getdata_la_OBJECTS = $(am_idl_getdata_la_OBJECTS) \
 	$(nodist_idl_getdata_la_OBJECTS)
 idl_getdata_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
@@ -109,6 +132,11 @@ RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \
 	install-pdf-recursive install-ps-recursive install-recursive \
 	installcheck-recursive installdirs-recursive pdf-recursive \
 	ps-recursive uninstall-recursive
+am__can_run_installinfo = \
+  case $$AM_UPDATE_INFO_DIR in \
+    n|no|NO) false;; \
+    *) (install-info --version) >/dev/null 2>&1;; \
+  esac
 HEADERS = $(nodist_idl_HEADERS)
 RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive	\
   distclean-recursive maintainer-clean-recursive
@@ -152,10 +180,13 @@ AUTOHEADER = @AUTOHEADER@
 AUTOMAKE = @AUTOMAKE@
 AWK = @AWK@
 BUILDCC = @BUILDCC@
-BUILD_DATE = @BUILD_DATE@
 BZIP2_CPPFLAGS = @BZIP2_CPPFLAGS@
 BZIP2_LDFLAGS = @BZIP2_LDFLAGS@
+BZIP2_LIBS = @BZIP2_LIBS@
 CC = @CC@
+CCAS = @CCAS@
+CCASDEPMODE = @CCASDEPMODE@
+CCASFLAGS = @CCASFLAGS@
 CCDEPMODE = @CCDEPMODE@
 CFLAGS = @CFLAGS@
 CPP = @CPP@
@@ -171,6 +202,7 @@ DEFINE_GD_NO_C99_API = @DEFINE_GD_NO_C99_API@
 DEFINE_gd_int16_t = @DEFINE_gd_int16_t@
 DEFINE_gd_int64_t = @DEFINE_gd_int64_t@
 DEFINE_gd_uint16_t = @DEFINE_gd_uint16_t@
+DEFINE_gd_uint64_t = @DEFINE_gd_uint64_t@
 DEFS = @DEFS@
 DEPDIR = @DEPDIR@
 DIFF = @DIFF@
@@ -191,13 +223,21 @@ FFLAGS = @FFLAGS@
 FGETDATA_VERSION = @FGETDATA_VERSION@
 FGREP = @FGREP@
 FLIBS = @FLIBS@
+GD_DIRSEP = @GD_DIRSEP@
+GD_FDIRSEP = @GD_FDIRSEP@
 GETDATAXX_VERSION = @GETDATAXX_VERSION@
+GETDATA_DEBUG = @GETDATA_DEBUG@
 GETDATA_IFACE_AGE = @GETDATA_IFACE_AGE@
 GETDATA_IFACE_VERSION = @GETDATA_IFACE_VERSION@
 GETDATA_IMPL_REVISION = @GETDATA_IMPL_REVISION@
+GETDATA_MAJOR = @GETDATA_MAJOR@
+GETDATA_MINOR = @GETDATA_MINOR@
+GETDATA_REVISION = @GETDATA_REVISION@
+GETDATA_VERSION_SUFFIX = @GETDATA_VERSION_SUFFIX@
 GREP = @GREP@
 GZIP_CPPFLAGS = @GZIP_CPPFLAGS@
 GZIP_LDFLAGS = @GZIP_LDFLAGS@
+GZIP_LIBS = @GZIP_LIBS@
 IDL = @IDL@
 IDL_CFLAGS = @IDL_CFLAGS@
 IDL_LIBS = @IDL_LIBS@
@@ -220,8 +260,13 @@ LTDLINCL = @LTDLINCL@
 LTLIBOBJS = @LTLIBOBJS@
 LZMA_CPPFLAGS = @LZMA_CPPFLAGS@
 LZMA_LDFLAGS = @LZMA_LDFLAGS@
+LZMA_LIBS = @LZMA_LIBS@
 MAKEINFO = @MAKEINFO@
 MANIFEST_TOOL = @MANIFEST_TOOL@
+MATLAB = @MATLAB@
+MATLABGETDATA_VERSION = @MATLABGETDATA_VERSION@
+MATLAB_CPPFLAGS = @MATLAB_CPPFLAGS@
+MEX = @MEX@
 MKDIR_P = @MKDIR_P@
 NM = @NM@
 NMEDIT = @NMEDIT@
@@ -238,6 +283,9 @@ PACKAGE_TARNAME = @PACKAGE_TARNAME@
 PACKAGE_URL = @PACKAGE_URL@
 PACKAGE_VERSION = @PACKAGE_VERSION@
 PATH_SEPARATOR = @PATH_SEPARATOR@
+PERL = @PERL@
+PERL_MAN3EXT = @PERL_MAN3EXT@
+PRINTF = @PRINTF@
 PRIVATE_LIBS = @PRIVATE_LIBS@
 PYTHON = @PYTHON@
 PYTHON_CPPFLAGS = @PYTHON_CPPFLAGS@
@@ -249,8 +297,12 @@ SET_MAKE = @SET_MAKE@
 SHELL = @SHELL@
 SLIM_CPPFLAGS = @SLIM_CPPFLAGS@
 SLIM_LDFLAGS = @SLIM_LDFLAGS@
+SLIM_LIBS = @SLIM_LIBS@
 STRIP = @STRIP@
 VERSION = @VERSION@
+ZZIP_CPPFLAGS = @ZZIP_CPPFLAGS@
+ZZIP_LDFLAGS = @ZZIP_LDFLAGS@
+ZZIP_LIBS = @ZZIP_LIBS@
 abs_builddir = @abs_builddir@
 abs_srcdir = @abs_srcdir@
 abs_top_builddir = @abs_top_builddir@
@@ -294,6 +346,8 @@ libexecdir = @libexecdir@
 localedir = @localedir@
 localstatedir = @localstatedir@
 mandir = @mandir@
+matlabbasedir = @matlabbasedir@
+mexext = @mexext@
 mkdir_p = @mkdir_p@
 moduledir = @moduledir@
 oldincludedir = @oldincludedir@
@@ -303,8 +357,12 @@ path_gunzip = @path_gunzip@
 path_gzip = @path_gzip@
 path_slim = @path_slim@
 path_unslim = @path_unslim@
+path_unzip = @path_unzip@
 path_xz = @path_xz@
+path_zip = @path_zip@
 pdfdir = @pdfdir@
+perldir = @perldir@
+perlmandir = @perlmandir@
 prefix = @prefix@
 program_transform_name = @program_transform_name@
 psdir = @psdir@
@@ -340,10 +398,9 @@ top_srcdir = @top_srcdir@
 #
 AUTOMAKE_OPTIONS = foreign
 @CC_WALL_TRUE at WALL = -Wall
- at GETDATA_DEBUG_TRUE@DEBUG_C = ../../src/debug.c
 SUBDIRS = test
- at GDIDL_EXTERNAL_FALSE@GDIDL_GETDATA_LIBS = ../../src/libgetdata.la
- at GDIDL_EXTERNAL_TRUE@GDIDL_GETDATA_LIBS = $(GETDATA_LIBS)
+ at GD_EXTERNAL_FALSE@GDIDL_GETDATA_LIBS = ../../src/libgetdata.la
+ at GD_EXTERNAL_TRUE@GDIDL_GETDATA_LIBS = $(GETDATA_LIBS)
 idl_LTLIBRARIES = idl_getdata.la
 nodist_idl_HEADERS = idl_getdata.dlm
 
@@ -355,7 +412,7 @@ idl_getdata_la_LDFLAGS = -module -avoid-version -export-symbols-regex IDL_Load \
 
 idl_getdata_la_LIBADD = $(GDIDL_GETDATA_LIBS)
 idl_getdata_la_SOURCES = getdata.c
-nodist_idl_getdata_la_SOURCES = constants.c sublist.c ${DEBUG_C}
+nodist_idl_getdata_la_SOURCES = constants.c sublist.c
 all: $(BUILT_SOURCES)
 	$(MAKE) $(AM_MAKEFLAGS) all-recursive
 
@@ -395,7 +452,6 @@ makedlm.sh: $(top_builddir)/config.status $(srcdir)/makedlm.sh.in
 	cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@
 install-idlLTLIBRARIES: $(idl_LTLIBRARIES)
 	@$(NORMAL_INSTALL)
-	test -z "$(idldir)" || $(MKDIR_P) "$(DESTDIR)$(idldir)"
 	@list='$(idl_LTLIBRARIES)'; test -n "$(idldir)" || list=; \
 	list2=; for p in $$list; do \
 	  if test -f $$p; then \
@@ -403,6 +459,8 @@ install-idlLTLIBRARIES: $(idl_LTLIBRARIES)
 	  else :; fi; \
 	done; \
 	test -z "$$list2" || { \
+	  echo " $(MKDIR_P) '$(DESTDIR)$(idldir)'"; \
+	  $(MKDIR_P) "$(DESTDIR)$(idldir)" || exit 1; \
 	  echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(idldir)'"; \
 	  $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(idldir)"; \
 	}
@@ -424,7 +482,7 @@ clean-idlLTLIBRARIES:
 	  echo "rm -f \"$${dir}/so_locations\""; \
 	  rm -f "$${dir}/so_locations"; \
 	done
-idl_getdata.la: $(idl_getdata_la_OBJECTS) $(idl_getdata_la_DEPENDENCIES) 
+idl_getdata.la: $(idl_getdata_la_OBJECTS) $(idl_getdata_la_DEPENDENCIES) $(EXTRA_idl_getdata_la_DEPENDENCIES) 
 	$(idl_getdata_la_LINK) -rpath $(idldir) $(idl_getdata_la_OBJECTS) $(idl_getdata_la_LIBADD) $(LIBS)
 
 mostlyclean-compile:
@@ -434,7 +492,6 @@ distclean-compile:
 	-rm -f *.tab.c
 
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/constants.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/debug.Plo at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/getdata.Plo at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/sublist.Plo at am__quote@
 
@@ -459,13 +516,6 @@ distclean-compile:
 @AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCC_FALSE@	$(LTCOMPILE) -c -o $@ $<
 
-debug.lo: ../../src/debug.c
- at am__fastdepCC_TRUE@	$(LIBTOOL)  --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT debug.lo -MD -MP -MF $(DEPDIR)/debug.Tpo -c -o debug.lo `test -f '../../src/debug.c' || echo '$(srcdir)/'`../../src/debug.c
- at am__fastdepCC_TRUE@	$(am__mv) $(DEPDIR)/debug.Tpo $(DEPDIR)/debug.Plo
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	source='../../src/debug.c' object='debug.lo' libtool=yes @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCC_FALSE@	$(LIBTOOL)  --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o debug.lo `test -f '../../src/debug.c' || echo '$(srcdir)/'`../../src/debug.c
-
 mostlyclean-libtool:
 	-rm -f *.lo
 
@@ -473,8 +523,11 @@ clean-libtool:
 	-rm -rf .libs _libs
 install-nodist_idlHEADERS: $(nodist_idl_HEADERS)
 	@$(NORMAL_INSTALL)
-	test -z "$(idldir)" || $(MKDIR_P) "$(DESTDIR)$(idldir)"
 	@list='$(nodist_idl_HEADERS)'; test -n "$(idldir)" || list=; \
+	if test -n "$$list"; then \
+	  echo " $(MKDIR_P) '$(DESTDIR)$(idldir)'"; \
+	  $(MKDIR_P) "$(DESTDIR)$(idldir)" || exit 1; \
+	fi; \
 	for p in $$list; do \
 	  if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
 	  echo "$$d$$p"; \
@@ -488,9 +541,7 @@ uninstall-nodist_idlHEADERS:
 	@$(NORMAL_UNINSTALL)
 	@list='$(nodist_idl_HEADERS)'; test -n "$(idldir)" || list=; \
 	files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \
-	test -n "$$files" || exit 0; \
-	echo " ( cd '$(DESTDIR)$(idldir)' && rm -f" $$files ")"; \
-	cd "$(DESTDIR)$(idldir)" && rm -f $$files
+	dir='$(DESTDIR)$(idldir)'; $(am__uninstall_files_from_dir)
 
 # This directory's subdirectories are mostly independent; you can cd
 # into them and run `make' without going through this Makefile.
@@ -659,13 +710,10 @@ distdir: $(DISTFILES)
 	done
 	@list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
 	  if test "$$subdir" = .; then :; else \
-	    test -d "$(distdir)/$$subdir" \
-	    || $(MKDIR_P) "$(distdir)/$$subdir" \
-	    || exit 1; \
-	  fi; \
-	done
-	@list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
-	  if test "$$subdir" = .; then :; else \
+	    $(am__make_dryrun) \
+	      || test -d "$(distdir)/$$subdir" \
+	      || $(MKDIR_P) "$(distdir)/$$subdir" \
+	      || exit 1; \
 	    dir1=$$subdir; dir2="$(distdir)/$$subdir"; \
 	    $(am__relativize); \
 	    new_distdir=$$reldir; \
@@ -705,10 +753,15 @@ install-am: all-am
 
 installcheck: installcheck-recursive
 install-strip:
-	$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
-	  install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
-	  `test -z '$(STRIP)' || \
-	    echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+	if test -z '$(STRIP)'; then \
+	  $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+	    install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+	      install; \
+	else \
+	  $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+	    install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+	    "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
+	fi
 mostlyclean-generic:
 
 clean-generic:
diff --git a/bindings/idl/getdata.c b/bindings/idl/getdata.c
index 7bd2582..c5c4faa 100644
--- a/bindings/idl/getdata.c
+++ b/bindings/idl/getdata.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2009-2011 D. V. Wiebe
+/* Copyright (C) 2009-2012 D. V. Wiebe
  *
  ***************************************************************************
  *
@@ -29,10 +29,10 @@
 #undef _SVID_SOURCE
 
 #ifdef HAVE_CONFIG_H
-# include "config.h"
+# include "gd_config.h"
 #endif
 
-#ifdef GDIDL_EXTERNAL
+#ifdef GD_EXTERNAL
 # include <complex.h>
 # include <getdata.h>
 # define dtracevoid()
@@ -427,7 +427,8 @@ IDL_VPTR gdidl_make_idl_entry(const gd_entry_t* E)
   if (E->field_type == GD_BIT_ENTRY || E->field_type == GD_LINTERP_ENTRY
       || E->field_type == GD_MULTIPLY_ENTRY || E->field_type == GD_PHASE_ENTRY
       || E->field_type == GD_SBIT_ENTRY || E->field_type == GD_POLYNOM_ENTRY
-      || E->field_type == GD_DIVIDE_ENTRY || E->field_type == GD_RECIP_ENTRY)
+      || E->field_type == GD_DIVIDE_ENTRY || E->field_type == GD_RECIP_ENTRY
+      || E->field_type == GD_WINDOW_ENTRY || E->field_type == GD_MPLEX_ENTRY)
   {
     IDL_StrStore((IDL_STRING*)(data + IDL_StructTagInfoByName(gdidl_entry_def,
             "IN_FIELDS", IDL_MSG_LONGJMP, NULL)), E->in_fields[0]);
@@ -556,6 +557,53 @@ IDL_VPTR gdidl_make_idl_entry(const gd_entry_t* E)
               IDL_MSG_LONGJMP, NULL), E->a,
             (E->poly_ord + 1) * sizeof(double));
       break;
+    case GD_WINDOW_ENTRY:
+      *(IDL_INT*)(data + IDL_StructTagInfoByName(gdidl_entry_def,
+            "WINDOP", IDL_MSG_LONGJMP, NULL)) = E->windop;
+      IDL_StrStore((IDL_STRING*)(data + IDL_StructTagInfoByName(gdidl_entry_def,
+              "IN_FIELDS", IDL_MSG_LONGJMP, NULL)) + 1, E->in_fields[1]);
+
+      switch (E->windop) {
+        case GD_WINDOP_EQ:
+        case GD_WINDOP_NE:
+          *(IDL_LONG64*)(data + IDL_StructTagInfoByName(gdidl_entry_def,
+                "ITHRESHOLD", IDL_MSG_LONGJMP, NULL)) = E->threshold.i;
+          break;
+        case GD_WINDOP_SET:
+        case GD_WINDOP_CLR:
+          *(IDL_ULONG*)(data + IDL_StructTagInfoByName(gdidl_entry_def,
+                "UTHRESHOLD", IDL_MSG_LONGJMP, NULL)) = E->threshold.u;
+          break;
+        default:
+          *(double*)(data + IDL_StructTagInfoByName(gdidl_entry_def,
+                "RTHRESHOLD", IDL_MSG_LONGJMP, NULL)) = E->threshold.r;
+          break;
+      }
+
+      IDL_StrStore((IDL_STRING*)(data + IDL_StructTagInfoByName(gdidl_entry_def,
+              "SCALAR", IDL_MSG_LONGJMP, NULL)), E->scalar[0]);
+      ((int16_t*)(data + IDL_StructTagInfoByName(gdidl_entry_def,
+          "SCALAR_IND", IDL_MSG_LONGJMP, NULL)))[0] = (int16_t)E->scalar_ind[0];
+
+      break;
+    case GD_MPLEX_ENTRY:
+      IDL_StrStore((IDL_STRING*)(data + IDL_StructTagInfoByName(gdidl_entry_def,
+              "IN_FIELDS", IDL_MSG_LONGJMP, NULL)) + 1, E->in_fields[1]);
+
+      *(IDL_INT*)(data + IDL_StructTagInfoByName(gdidl_entry_def,
+            "COUNT_VAL", IDL_MSG_LONGJMP, NULL)) = E->count_val;
+      *(IDL_INT*)(data + IDL_StructTagInfoByName(gdidl_entry_def,
+            "PERIOD", IDL_MSG_LONGJMP, NULL)) = E->period;
+
+      IDL_StrStore((IDL_STRING*)(data + IDL_StructTagInfoByName(gdidl_entry_def,
+              "SCALAR", IDL_MSG_LONGJMP, NULL)), E->scalar[0]);
+      ((int16_t*)(data + IDL_StructTagInfoByName(gdidl_entry_def,
+          "SCALAR_IND", IDL_MSG_LONGJMP, NULL)))[0] = (int16_t)E->scalar_ind[0];
+      IDL_StrStore((IDL_STRING*)(data + IDL_StructTagInfoByName(gdidl_entry_def,
+              "SCALAR", IDL_MSG_LONGJMP, NULL)) + 1, E->scalar[1]);
+      ((int16_t*)(data + IDL_StructTagInfoByName(gdidl_entry_def,
+          "SCALAR_IND", IDL_MSG_LONGJMP, NULL)))[1] = (int16_t)E->scalar_ind[1];
+      break;
     case GD_CARRAY_ENTRY:
       *(IDL_INT*)(data + IDL_StructTagInfoByName(gdidl_entry_def, "ARRAY_LEN",
             IDL_MSG_LONGJMP, NULL)) = E->array_len;
@@ -565,6 +613,7 @@ IDL_VPTR gdidl_make_idl_entry(const gd_entry_t* E)
             IDL_MSG_LONGJMP, NULL)) = E->const_type;
       break;
     case GD_NO_ENTRY:
+    case GD_ALIAS_ENTRY:
     case GD_INDEX_ENTRY:
     case GD_STRING_ENTRY:
       break;
@@ -619,7 +668,8 @@ void gdidl_read_idl_entry(gd_entry_t *E, IDL_VPTR v, int alter)
   if (E->field_type == GD_BIT_ENTRY || E->field_type == GD_LINTERP_ENTRY
       || E->field_type == GD_MULTIPLY_ENTRY || E->field_type == GD_PHASE_ENTRY
       || E->field_type == GD_SBIT_ENTRY || E->field_type == GD_POLYNOM_ENTRY
-      || E->field_type == GD_DIVIDE_ENTRY || E->field_type == GD_RECIP_ENTRY)
+      || E->field_type == GD_DIVIDE_ENTRY || E->field_type == GD_RECIP_ENTRY
+      || E->field_type == GD_MPLEX_ENTRY || E->field_type == GD_WINDOW_ENTRY)
   {
     o = IDL_StructTagInfoByName(v->value.s.sdef, "IN_FIELDS", action, &d);
     if (o != -1) {
@@ -752,7 +802,7 @@ void gdidl_read_idl_entry(gd_entry_t *E, IDL_VPTR v, int alter)
       o = IDL_StructTagInfoByName(v->value.s.sdef, "TABLE", action, &d);
       if (o != -1) {
         IDL_ENSURE_STRING(d);
-        E->field = IDL_STRING_STR((IDL_STRING*)(data + o));
+        E->table = IDL_STRING_STR((IDL_STRING*)(data + o));
       }
       break;
     case GD_BIT_ENTRY:
@@ -867,6 +917,77 @@ void gdidl_read_idl_entry(gd_entry_t *E, IDL_VPTR v, int alter)
         }
       }
       break;
+    case GD_WINDOW_ENTRY:
+      o = IDL_StructTagInfoByName(v->value.s.sdef, "IN_FIELDS", action, &d);
+      if (o != -1) {
+        IDL_ENSURE_STRING(d);
+        E->in_fields[1] = IDL_STRING_STR((IDL_STRING*)(data + o) + 1);
+      }
+
+      o = IDL_StructTagInfoByName(v->value.s.sdef, "WINDOP", action, &d);
+      if (o != -1) {
+        if (d->type != IDL_TYP_INT)
+          idl_abort("GD_ENTRY element WINDOP must be of type INT");
+        E->windop = *(int16_t*)(data + o);
+      } else
+        E->windop = GD_WINDOP_UNK;
+
+      switch (E->windop) {
+        case GD_WINDOP_EQ:
+        case GD_WINDOP_NE:
+          o = IDL_StructTagInfoByName(v->value.s.sdef, "ITHRESHOLD", action,
+              &d);
+          if (o != -1) {
+            if (d->type != IDL_TYP_LONG)
+              idl_abort("GD_ENTRY element ITHRESHOLD must be of type LONG");
+            E->threshold.i = *(IDL_LONG*)(data + o);
+          }
+          break;
+        case GD_WINDOP_SET:
+        case GD_WINDOP_CLR:
+          o = IDL_StructTagInfoByName(v->value.s.sdef, "UTHRESHOLD", action,
+              &d);
+          if (o != -1) {
+            if (d->type != IDL_TYP_ULONG)
+              idl_abort("GD_ENTRY element UTHRESHOLD must be of type ULONG");
+            E->threshold.u = *(IDL_ULONG*)(data + o);
+          }
+          break;
+        default:
+          o = IDL_StructTagInfoByName(v->value.s.sdef, "RTHRESHOLD", action,
+              &d);
+          if (o != -1) {
+            if (d->type != IDL_TYP_DOUBLE)
+              idl_abort("GD_ENTRY element RTHRESHOLD must be of type DOUBLE");
+            E->threshold.u = *(double*)(data + o);
+          }
+          break;
+      }
+      break;
+    case GD_MPLEX_ENTRY:
+      o = IDL_StructTagInfoByName(v->value.s.sdef, "IN_FIELDS", action, &d);
+      if (o != -1) {
+        IDL_ENSURE_STRING(d);
+        E->in_fields[1] = IDL_STRING_STR((IDL_STRING*)(data + o) + 1);
+      }
+
+      o = IDL_StructTagInfoByName(v->value.s.sdef, "COUNT_VAL", action, &d);
+      if (o != -1) {
+        if (d->type != IDL_TYP_INT)
+          idl_abort("GD_ENTRY element COUNT_VAL must be of type INT");
+        E->count_val = *(int16_t*)(data + o);
+      }
+
+      o = IDL_StructTagInfoByName(v->value.s.sdef, "PERIOD", action, &d);
+      if (o != -1) {
+        if (d->type != IDL_TYP_INT)
+          idl_abort("GD_ENTRY element PERIOD must be of type INT");
+        E->period = *(int16_t*)(data + o);
+      } else
+        E->period = -1;
+
+      copy_scalar[0] = copy_scalar[1] = 1;
+      break;
     case GD_CARRAY_ENTRY:
       o = IDL_StructTagInfoByName(v->value.s.sdef, "ARRAY_LEN", action, &d);
       if (o != -1) {
@@ -886,6 +1007,7 @@ void gdidl_read_idl_entry(gd_entry_t *E, IDL_VPTR v, int alter)
         E->const_type = GD_NULL;
       break;
     case GD_NO_ENTRY:
+    case GD_ALIAS_ENTRY:
     case GD_INDEX_ENTRY:
     case GD_STRING_ENTRY:
       break;
@@ -932,8 +1054,14 @@ unsigned long gdidl_convert_encoding(IDL_VPTR idl_enc)
       encoding = GD_LZMA_ENCODED;
     else if (strcasecmp(enc, "SLIM"))
       encoding = GD_SLIM_ENCODED;
+    else if (strcasecmp(enc, "SIE"))
+      encoding = GD_SIE_ENCODED;
     else if (strcasecmp(enc, "TEXT"))
       encoding = GD_TEXT_ENCODED;
+    else if (strcasecmp(enc, "ZZIP"))
+      encoding = GD_ZZIP_ENCODED;
+    else if (strcasecmp(enc, "ZZSLIM"))
+      encoding = GD_ZZSLIM_ENCODED;
     else if (strcasecmp(enc, "NONE"))
       encoding = GD_UNENCODED;
     else if (strcasecmp(enc, "RAW"))
@@ -975,7 +1103,6 @@ IDL_VPTR gdidl_dirfilename(int argc, IDL_VPTR argv[], char *argk)
 }
 
 /* @@DLM: P gdidl_add GD_ADD 2 2 KEYWORDS */
-/* @@DLM: P gdidl_add GD_MADD 2 2 KEYWORDS */
 void gdidl_add(int argc, IDL_VPTR argv[], char *argk)
 {
   dtraceidl();
@@ -1021,7 +1148,6 @@ void gdidl_add(int argc, IDL_VPTR argv[], char *argk)
 }
 
 /* @@DLM: P gdidl_add_bit GD_ADD_BIT 3 3 KEYWORDS */
-/* @@DLM: P gdidl_add_bit GD_MADD_BIT 3 3 KEYWORDS */
 void gdidl_add_bit(int argc, IDL_VPTR argv[], char *argk)
 {
   dtraceidl();
@@ -1074,7 +1200,6 @@ void gdidl_add_bit(int argc, IDL_VPTR argv[], char *argk)
 }
 
 /* @@DLM: P gdidl_add_const GD_ADD_CONST 2 2 KEYWORDS */
-/* @@DLM: P gdidl_add_const GD_MADD_CONST 2 2 KEYWORDS */
 void gdidl_add_const(int argc, IDL_VPTR argv[], char *argk)
 {
   dtraceidl();
@@ -1135,7 +1260,6 @@ void gdidl_add_const(int argc, IDL_VPTR argv[], char *argk)
 }
 
 /* @@DLM: P gdidl_add_carray GD_ADD_CARRAY 2 2 KEYWORDS */
-/* @@DLM: P gdidl_add_carray GD_MADD_CARRAY 2 2 KEYWORDS */
 void gdidl_add_carray(int argc, IDL_VPTR argv[], char *argk)
 {
   dtraceidl();
@@ -1208,9 +1332,6 @@ void gdidl_add_carray(int argc, IDL_VPTR argv[], char *argk)
 }
 
 /* @@DLM: P gdidl_add_lincom GD_ADD_LINCOM 5 11 KEYWORDS */
-/* @@DLM: P gdidl_add_lincom GD_ADD_CLINCOM 5 11 KEYWORDS */
-/* @@DLM: P gdidl_add_lincom GD_MADD_CLINCOM 5 11 KEYWORDS */
-/* @@DLM: P gdidl_add_lincom GD_MADD_LINCOM 5 11 KEYWORDS */
 void gdidl_add_lincom(int argc, IDL_VPTR argv[], char *argk)
 {
   dtraceidl();
@@ -1291,7 +1412,6 @@ void gdidl_add_lincom(int argc, IDL_VPTR argv[], char *argk)
 }
 
 /* @@DLM: P gdidl_add_linterp GD_ADD_LINTERP 4 4 KEYWORDS */
-/* @@DLM: P gdidl_add_linterp GD_MADD_LINTERP 4 4 KEYWORDS */
 void gdidl_add_linterp(int argc, IDL_VPTR argv[], char *argk)
 {
   dtraceidl();
@@ -1339,7 +1459,6 @@ void gdidl_add_linterp(int argc, IDL_VPTR argv[], char *argk)
 }
 
 /* @@DLM: P gdidl_add_multiply GD_ADD_MULTIPLY 4 4 KEYWORDS */
-/* @@DLM: P gdidl_add_multiply GD_MADD_MULTIPLY 4 4 KEYWORDS */
 void gdidl_add_multiply(int argc, IDL_VPTR argv[], char *argk)
 {
   dtraceidl();
@@ -1387,7 +1506,6 @@ void gdidl_add_multiply(int argc, IDL_VPTR argv[], char *argk)
 }
 
 /* @@DLM: P gdidl_add_divide GD_ADD_DIVIDE 4 4 KEYWORDS */
-/* @@DLM: P gdidl_add_divide GD_MADD_DIVIDE 4 4 KEYWORDS */
 void gdidl_add_divide(int argc, IDL_VPTR argv[], char *argk)
 {
   dtraceidl();
@@ -1435,9 +1553,6 @@ void gdidl_add_divide(int argc, IDL_VPTR argv[], char *argk)
 }
 
 /* @@DLM: P gdidl_add_recip GD_ADD_RECIP 3 3 KEYWORDS */
-/* @@DLM: P gdidl_add_recip GD_ADD_CRECIP 3 3 KEYWORDS */
-/* @@DLM: P gdidl_add_recip GD_MADD_RECIP 3 3 KEYWORDS */
-/* @@DLM: P gdidl_add_recip GD_MADD_CRECIP 3 3 KEYWORDS */
 void gdidl_add_recip(int argc, IDL_VPTR argv[], char *argk)
 {
   dtraceidl();
@@ -1508,7 +1623,6 @@ void gdidl_add_recip(int argc, IDL_VPTR argv[], char *argk)
 }
 
 /* @@DLM: P gdidl_add_phase GD_ADD_PHASE 4 4 KEYWORDS */
-/* @@DLM: P gdidl_add_phase GD_MADD_PHASE 4 4 KEYWORDS */
 void gdidl_add_phase(int argc, IDL_VPTR argv[], char *argk)
 {
   dtraceidl();
@@ -1556,9 +1670,6 @@ void gdidl_add_phase(int argc, IDL_VPTR argv[], char *argk)
 }
 
 /* @@DLM: P gdidl_add_polynom GD_ADD_POLYNOM 4 9 KEYWORDS */
-/* @@DLM: P gdidl_add_polynom GD_ADD_CPOLYNOM 4 8 KEYWORDS */
-/* @@DLM: P gdidl_add_polynom GD_MADD_CPOLYNOM 4 9 KEYWORDS */
-/* @@DLM: P gdidl_add_polynom GD_MADD_POLYNOM 4 9 KEYWORDS */
 void gdidl_add_polynom(int argc, IDL_VPTR argv[], char *argk)
 {
   dtraceidl();
@@ -1727,7 +1838,6 @@ void gdidl_add_raw(int argc, IDL_VPTR argv[], char *argk)
   dreturnvoid();
 }
 /* @@DLM: P gdidl_add_sbit GD_ADD_SBIT 3 3 KEYWORDS */
-/* @@DLM: P gdidl_add_sbit GD_MADD_SBIT 3 3 KEYWORDS */
 void gdidl_add_sbit(int argc, IDL_VPTR argv[], char *argk)
 {
   dtraceidl();
@@ -1780,7 +1890,6 @@ void gdidl_add_sbit(int argc, IDL_VPTR argv[], char *argk)
 }
 
 /* @@DLM: P gdidl_add_spec GD_ADD_SPEC 2 2 KEYWORDS */
-/* @@DLM: P gdidl_add_spec GD_MADD_SPEC 2 2 KEYWORDS */
 void gdidl_add_spec(int argc, IDL_VPTR argv[], char *argk)
 {
   dtraceidl();
@@ -1826,7 +1935,6 @@ void gdidl_add_spec(int argc, IDL_VPTR argv[], char *argk)
 }
 
 /* @@DLM: P gdidl_add_string GD_ADD_STRING 2 2 KEYWORDS */
-/* @@DLM: P gdidl_add_string GD_MADD_STRING 2 2 KEYWORDS */
 void gdidl_add_string(int argc, IDL_VPTR argv[], char *argk)
 {
   dtraceidl();
@@ -2197,7 +2305,6 @@ void gdidl_alter_frameoffset(int argc, IDL_VPTR argv[], char *argk)
 }
 
 /* @@DLM: P gdidl_alter_lincom GD_ALTER_LINCOM 2 2 KEYWORDS */
-/* @@DLM: P gdidl_alter_lincom GD_ALTER_CLINCOM 2 2 KEYWORDS */
 void gdidl_alter_lincom(int argc, IDL_VPTR argv[], char *argk)
 {
   dtraceidl();
@@ -2489,7 +2596,6 @@ void gdidl_alter_divide(int argc, IDL_VPTR argv[], char *argk)
 }
 
 /* @@DLM: P gdidl_alter_recip GD_ALTER_RECIP 2 2 KEYWORDS */
-/* @@DLM: P gdidl_alter_recip GD_ALTER_CRECIP 2 2 KEYWORDS */
 void gdidl_alter_recip(int argc, IDL_VPTR argv[], char *argk)
 {
   dtraceidl();
@@ -2598,7 +2704,6 @@ void gdidl_alter_phase(int argc, IDL_VPTR argv[], char *argk)
 }
 
 /* @@DLM: P gdidl_alter_polynom GD_ALTER_POLYNOM 2 2 KEYWORDS */
-/* @@DLM: P gdidl_alter_polynom GD_ALTER_CPOLYNOM 2 2 KEYWORDS */
 void gdidl_alter_polynom(int argc, IDL_VPTR argv[], char *argk)
 {
   dtraceidl();
@@ -2780,7 +2885,6 @@ void gdidl_alter_sbit(int argc, IDL_VPTR argv[], char *argk)
 }
 
 /* @@DLM: P gdidl_alter_spec GD_ALTER_SPEC 2 2 KEYWORDS */
-/* @@DLM: P gdidl_alter_spec GD_MALTER_SPEC 2 2 KEYWORDS */
 void gdidl_alter_spec(int argc, IDL_VPTR argv[], char *argk)
 {
   dtraceidl();
@@ -2891,16 +2995,18 @@ void gdidl_delete(int argc, IDL_VPTR argv[], char *argk)
   typedef struct {
     IDL_KW_RESULT_FIRST_FIELD;
     GDIDL_KW_RESULT_ERROR;
+    int alias;
     int data;
     int deref;
     int force;
   } KW_RESULT;
   KW_RESULT kw;
 
-  kw.data = kw.deref = kw.force = 0;
+  kw.alias = kw.data = kw.deref = kw.force = 0;
   GDIDL_KW_INIT_ERROR;
 
   static IDL_KW_PAR kw_pars[] = {
+    { "ALIAS", IDL_TYP_INT, 1, 0, 0, IDL_KW_OFFSETOF(alias) },
     { "DEL_DATA", IDL_TYP_INT, 1, 0, 0, IDL_KW_OFFSETOF(data) },
     { "DEREF", IDL_TYP_INT, 1, 0, 0, IDL_KW_OFFSETOF(deref) },
     GDIDL_KW_PAR_ERROR,
@@ -2914,8 +3020,12 @@ void gdidl_delete(int argc, IDL_VPTR argv[], char *argk)
   DIRFILE* D = gdidl_get_dirfile(IDL_LongScalar(argv[0]));
   const char* field_code = IDL_VarGetString(argv[1]);
 
-  gd_delete(D, field_code, (kw.data ? GD_DEL_DATA : 0) |
-      (kw.deref ? GD_DEL_DEREF : 0) | (kw.force) ? GD_DEL_FORCE : 0);
+  if (kw.alias)
+    gd_delete_alias(D, field_code, (kw.deref ? GD_DEL_DEREF : 0) | 
+        (kw.force) ? GD_DEL_FORCE : 0);
+  else
+    gd_delete(D, field_code, (kw.data ? GD_DEL_DATA : 0) |
+        (kw.deref ? GD_DEL_DEREF : 0) | (kw.force) ? GD_DEL_FORCE : 0);
 
   GDIDL_SET_ERROR(D);
 
@@ -2934,6 +3044,8 @@ void gdidl_flush(int argc, IDL_VPTR argv[], char *argk)
     GDIDL_KW_RESULT_ERROR;
     IDL_STRING field_code;
     int field_code_x;
+    int noclose;
+    int nosync;
   } KW_RESULT;
   KW_RESULT kw;
 
@@ -2941,12 +3053,15 @@ void gdidl_flush(int argc, IDL_VPTR argv[], char *argk)
 
   GDIDL_KW_INIT_ERROR;
   kw.field_code_x = 0;
+  kw.noclose = kw.nosync = 0;
 
   static IDL_KW_PAR kw_pars[] = {
     GDIDL_KW_PAR_ERROR,
     GDIDL_KW_PAR_ESTRING,
     { "FIELD_CODE", IDL_TYP_STRING, 1, 0, IDL_KW_OFFSETOF(field_code_x),
       IDL_KW_OFFSETOF(field_code) },
+    { "NOCLOSE", IDL_TYP_INT, 1, 0, 0, IDL_KW_OFFSETOF(noclose) },
+    { "NOSYNC", IDL_TYP_INT, 1, 0, 0, IDL_KW_OFFSETOF(nosync) },
     { NULL }
   };
 
@@ -2957,7 +3072,14 @@ void gdidl_flush(int argc, IDL_VPTR argv[], char *argk)
   if (kw.field_code_x)
     field_code = IDL_STRING_STR(&kw.field_code);
 
-  gd_flush(D, field_code);
+  if (kw.noclose && kw.nosync)
+    idl_kw_abort("nothing to do");
+  else if (kw.noclose)
+    gd_sync(D, field_code);
+  else if (kw.nosync)
+    gd_raw_close(D, field_code);
+  else
+    gd_flush(D, field_code);
 
   GDIDL_SET_ERROR(D);
 
@@ -2971,6 +3093,8 @@ void gdidl_include(int argc, IDL_VPTR argv[], char *argk)
 {
   dtraceidl();
 
+  char *prefix = NULL;
+  char *suffix = NULL;
   typedef struct {
     IDL_KW_RESULT_FIRST_FIELD;
     GDIDL_KW_RESULT_ERROR;
@@ -2992,11 +3116,16 @@ void gdidl_include(int argc, IDL_VPTR argv[], char *argk)
     IDL_VPTR index;
     int fragment_index;
     int index_x;
+    IDL_STRING prefix;
+    int prefix_x;
+    IDL_STRING suffix;
+    int suffix_x;
   } KW_RESULT;
   KW_RESULT kw;
   kw.big_end = kw.creat = kw.excl = kw.force_enc = kw.force_end =
     kw.ignore_dups = kw.ignore_refs = kw.little_end = kw.pedantic = kw.trunc =
-    kw.enc_x = kw.index_x = kw.fragment_index = kw.arm_end = kw.not_arm_end = 0;
+    kw.enc_x = kw.index_x = kw.fragment_index = kw.arm_end = kw.not_arm_end =
+    kw.prefix_x = kw.suffix_x = 0;
   GDIDL_KW_INIT_ERROR;
 
   static IDL_KW_PAR kw_pars[] = {
@@ -3020,6 +3149,10 @@ void gdidl_include(int argc, IDL_VPTR argv[], char *argk)
     { "NOT_ARM_ENDIAN", IDL_TYP_INT, 1, 0, 0, IDL_KW_OFFSETOF(not_arm_end) },
     { "PEDANTIC", IDL_TYP_INT, 1, 0, 0, IDL_KW_OFFSETOF(pedantic) },
     { "PERMISSIVE", IDL_TYP_INT, 1, 0, 0, IDL_KW_OFFSETOF(permissive) },
+    { "PREFIX", IDL_TYP_STRING, 1, 0, IDL_KW_OFFSETOF(prefix_x),
+      IDL_KW_OFFSETOF(prefix) },
+    { "SUFFIX", IDL_TYP_STRING, 1, 0, IDL_KW_OFFSETOF(suffix_x),
+      IDL_KW_OFFSETOF(suffix) },
     { "TRUNC", IDL_TYP_INT, 1, 0, 0, IDL_KW_OFFSETOF(trunc) },
     { NULL }
   };
@@ -3047,7 +3180,14 @@ void gdidl_include(int argc, IDL_VPTR argv[], char *argk)
   if (kw.enc_x)
     flags |= gdidl_convert_encoding(kw.enc);
 
-  int index = (int16_t)gd_include(D, file, kw.fragment_index, flags);
+  if (kw.prefix_x)
+    prefix = IDL_STRING_STR(&kw.prefix);
+
+  if (kw.suffix_x)
+    suffix = IDL_STRING_STR(&kw.suffix);
+
+  int index = (int16_t)gd_include_affix(D, file, kw.fragment_index, prefix,
+      suffix, flags);
 
   if (kw.index_x) {
     IDL_ALLTYPES v;
@@ -3130,13 +3270,15 @@ void gdidl_move(int argc, IDL_VPTR argv[], char *argk)
     IDL_KW_RESULT_FIRST_FIELD;
     GDIDL_KW_RESULT_ERROR;
     int move_data;
+    int alias;
   } KW_RESULT;
   KW_RESULT kw;
 
-  kw.move_data = 0;
+  kw.move_data = kw.alias = 0;
   GDIDL_KW_INIT_ERROR;
 
   static IDL_KW_PAR kw_pars[] = {
+    { "ALIAS", IDL_TYP_INT, 1, 0, 0, IDL_KW_OFFSETOF(alias) },
     GDIDL_KW_PAR_ERROR,
     GDIDL_KW_PAR_ESTRING,
     { "MOVE_DATA", IDL_TYP_INT, 1, 0, 0, IDL_KW_OFFSETOF(move_data) },
@@ -3148,7 +3290,10 @@ void gdidl_move(int argc, IDL_VPTR argv[], char *argk)
   DIRFILE* D = gdidl_get_dirfile(IDL_LongScalar(argv[0]));
   const char* field_code = IDL_VarGetString(argv[1]);
 
-  gd_move(D, field_code, IDL_LongScalar(argv[2]), kw.move_data);
+  if (kw.alias)
+    gd_move_alias(D, field_code, IDL_LongScalar(argv[2]));
+  else
+    gd_move(D, field_code, IDL_LongScalar(argv[2]), kw.move_data);
 
   GDIDL_SET_ERROR(D);
 
@@ -3175,11 +3320,14 @@ IDL_VPTR gdidl_open(int argc, IDL_VPTR argv[], char *argk)
     int force_enc;
     int force_end;
     int ignore_dups;
+    int ignore_refs;
     int little_end;
     int not_arm_end;
     int pedantic;
     int permissive;
+    int pretty_print;
     int trunc;
+    int truncsub;
     int verbose;
     int enc_x;
     IDL_VPTR enc;
@@ -3187,7 +3335,8 @@ IDL_VPTR gdidl_open(int argc, IDL_VPTR argv[], char *argk)
   KW_RESULT kw;
   kw.rdwr = kw.big_end = kw.creat = kw.excl = kw.force_enc = kw.force_end =
     kw.ignore_dups = kw.little_end = kw.pedantic = kw.trunc = kw.verbose =
-    kw.enc_x = kw.arm_end = kw.not_arm_end = 0;
+    kw.enc_x = kw.arm_end = kw.not_arm_end = kw.pretty_print = kw.truncsub =
+    kw.ignore_refs = 0;
   GDIDL_KW_INIT_ERROR;
 
   static IDL_KW_PAR kw_pars[] = {
@@ -3203,12 +3352,15 @@ IDL_VPTR gdidl_open(int argc, IDL_VPTR argv[], char *argk)
     { "FORCE_ENCODING", IDL_TYP_INT, 1, 0, 0, IDL_KW_OFFSETOF(force_enc) },
     { "FORCE_ENDIANNESS", IDL_TYP_INT, 1, 0, 0, IDL_KW_OFFSETOF(force_end) },
     { "IGNORE_DUPS", IDL_TYP_INT, 1, 0, 0, IDL_KW_OFFSETOF(ignore_dups) },
+    { "IGNORE_REFS", IDL_TYP_INT, 1, 0, 0, IDL_KW_OFFSETOF(ignore_refs) },
     { "LITTLE_ENDIAN", IDL_TYP_INT, 1, 0, 0, IDL_KW_OFFSETOF(little_end) },
     { "NOT_ARM_ENDIAN", IDL_TYP_INT, 1, 0, 0, IDL_KW_OFFSETOF(not_arm_end) },
     { "PEDANTIC", IDL_TYP_INT, 1, 0, 0, IDL_KW_OFFSETOF(pedantic) },
     { "PERMISSIVE", IDL_TYP_INT, 1, 0, 0, IDL_KW_OFFSETOF(permissive) },
+    { "PRETTY_PRINT", IDL_TYP_INT, 1, 0, 0, IDL_KW_OFFSETOF(pretty_print) },
     { "RDWR", IDL_TYP_INT, 1, 0, 0, IDL_KW_OFFSETOF(rdwr) },
     { "TRUNC", IDL_TYP_INT, 1, 0, 0, IDL_KW_OFFSETOF(trunc) },
+    { "TRUNCSUB", IDL_TYP_INT, 1, 0, 0, IDL_KW_OFFSETOF(truncsub) },
     { "VERBOSE", IDL_TYP_INT, 1, 0, 0, IDL_KW_OFFSETOF(verbose) },
     { NULL }
   };
@@ -3223,10 +3375,12 @@ IDL_VPTR gdidl_open(int argc, IDL_VPTR argv[], char *argk)
     | (kw.force_enc ? GD_FORCE_ENCODING : 0)
     | (kw.force_end ? GD_FORCE_ENDIAN : 0)
     | (kw.ignore_dups ? GD_IGNORE_DUPS : 0)
+    | (kw.ignore_refs ? GD_IGNORE_REFS : 0)
     | (kw.little_end ? GD_LITTLE_ENDIAN : 0)
     | (kw.not_arm_end ? GD_NOT_ARM_ENDIAN : 0)
     | (kw.pedantic ? GD_PEDANTIC : 0) | (kw.permissive ? GD_PERMISSIVE : 0)
-    | (kw.trunc ? GD_TRUNC : 0) | (kw.verbose ? GD_VERBOSE : 0);
+    | (kw.pretty_print ? GD_PRETTY_PRINT : 0) | (kw.trunc ? GD_TRUNC : 0)
+    | (kw.truncsub ? GD_TRUNCSUB : 0) | (kw.verbose ? GD_VERBOSE : 0);
 
   if (kw.enc_x)
     flags |= gdidl_convert_encoding(kw.enc);
@@ -3310,17 +3464,19 @@ void gdidl_rename(int argc, IDL_VPTR argv[], char *argk)
   typedef struct {
     IDL_KW_RESULT_FIRST_FIELD;
     GDIDL_KW_RESULT_ERROR;
+    int updatedb;
     int move_data;
   } KW_RESULT;
   KW_RESULT kw;
 
-  kw.move_data = 0;
+  kw.move_data = kw.updatedb = 0;
   GDIDL_KW_INIT_ERROR;
 
   static IDL_KW_PAR kw_pars[] = {
     GDIDL_KW_PAR_ERROR,
     GDIDL_KW_PAR_ESTRING,
     { "MOVE_DATA", IDL_TYP_INT, 1, 0, 0, IDL_KW_OFFSETOF(move_data) },
+    { "UPDATEDB", IDL_TYP_INT, 1, 0, 0, IDL_KW_OFFSETOF(updatedb) },
     { NULL }
   };
 
@@ -3330,7 +3486,8 @@ void gdidl_rename(int argc, IDL_VPTR argv[], char *argk)
   const char* field_code = IDL_VarGetString(argv[1]);
   const char* new_code = IDL_VarGetString(argv[2]);
 
-  gd_rename(D, field_code, new_code, kw.move_data);
+  gd_rename(D, field_code, new_code, (kw.move_data ? GD_REN_DATA : 0) |
+      (kw.move_data ? GD_REN_UPDB : 0));
 
   GDIDL_SET_ERROR(D);
 
@@ -3407,6 +3564,7 @@ IDL_VPTR gdidl_getdata(int argc, IDL_VPTR argv[], char *argk)
     IDL_LONG64 first_sample;
     IDL_LONG n_frames;
     IDL_LONG n_samples;
+    int first_frame_x, first_sample_x;
     gd_type_t return_type;
   } KW_RESULT;
   KW_RESULT kw;
@@ -3414,14 +3572,17 @@ IDL_VPTR gdidl_getdata(int argc, IDL_VPTR argv[], char *argk)
   IDL_VPTR r;
 
   kw.first_frame = kw.first_sample = kw.n_frames = kw.n_samples = 0;
+  kw.first_frame_x = kw.first_sample_x = 0;
   kw.return_type = GD_FLOAT64;
   GDIDL_KW_INIT_ERROR;
 
   static IDL_KW_PAR kw_pars[] = {
     GDIDL_KW_PAR_ERROR,
     GDIDL_KW_PAR_ESTRING,
-    { "FIRST_FRAME", IDL_TYP_LONG64, 1, 0, 0, IDL_KW_OFFSETOF(first_frame) },
-    { "FIRST_SAMPLE", IDL_TYP_LONG64, 1, 0, 0, IDL_KW_OFFSETOF(first_sample) },
+    { "FIRST_FRAME", IDL_TYP_LONG64, 1, 0, IDL_KW_OFFSETOF(first_frame_x),
+      IDL_KW_OFFSETOF(first_frame) },
+    { "FIRST_SAMPLE", IDL_TYP_LONG64, 1, 0, IDL_KW_OFFSETOF(first_sample_x),
+      IDL_KW_OFFSETOF(first_sample) },
     { "NUM_FRAMES", IDL_TYP_LONG, 1, 0, 0, IDL_KW_OFFSETOF(n_frames) },
     { "NUM_SAMPLES", IDL_TYP_LONG, 1, 0, 0, IDL_KW_OFFSETOF(n_samples) },
     { "TYPE", IDL_TYP_INT, 1, 0, 0, IDL_KW_OFFSETOF(return_type) },
@@ -3437,9 +3598,14 @@ IDL_VPTR gdidl_getdata(int argc, IDL_VPTR argv[], char *argk)
   DIRFILE *D = gdidl_get_dirfile(IDL_LongScalar(argv[0]));
   const char* field_code = IDL_VarGetString(argv[1]);
 
+  if (kw.first_frame_x == 0 && kw.first_sample_x == 0) {
+    kw.first_frame = GD_HERE;
+    kw.first_sample = 0;
+  }
+
   unsigned int spf = gd_spf(D, field_code);
 
-  if (gd_error(D))
+  if (gd_error(D) || (kw.n_frames == 0 && kw.n_samples == 0))
     r = IDL_GettmpInt(0);
   else {
     void* data = malloc((kw.n_frames * spf + kw.n_samples) *
@@ -3476,7 +3642,7 @@ IDL_VPTR gdidl_get_bof(int argc, IDL_VPTR argv[], char *argk)
   DIRFILE* D = gdidl_get_dirfile(IDL_LongScalar(argv[0]));
   const char *field_code = IDL_VarGetString(argv[1]);
 
-  off64_t bof = gd_bof(D, field_code);
+  off64_t bof = gd_bof64(D, field_code);
 
   GDIDL_SET_ERROR(D);
 
@@ -3600,7 +3766,6 @@ IDL_VPTR gdidl_get_carray(int argc, IDL_VPTR argv[], char *argk)
 }
 
 /* @@DLM: F gdidl_get_constants GD_CONSTANTS 1 1 KEYWORDS */
-/* @@DLM: F gdidl_get_constants GD_MCONSTANTS 1 1 KEYWORDS */
 IDL_VPTR gdidl_get_constants(int argc, IDL_VPTR argv[], char *argk)
 {
   dtraceidl();
@@ -3655,8 +3820,6 @@ IDL_VPTR gdidl_get_constants(int argc, IDL_VPTR argv[], char *argk)
 
     r = IDL_ImportArray(1, dim, gdidl_idl_type(kw.const_type), data,
         (IDL_ARRAY_FREE_CB)free, NULL);
-    IDL_ALLTYPES v = gdidl_to_alltypes(kw.const_type, data);
-    IDL_StoreScalar(r, gdidl_idl_type(kw.const_type), &v);
   } else
     IDL_MakeTempVector(IDL_TYP_INT, 0, IDL_ARR_INI_ZERO, &r);
 
@@ -3803,6 +3966,18 @@ IDL_VPTR gdidl_error(int argc, IDL_VPTR argv[], char *argk)
   return r;
 }
 
+/* @@DLM: F gdidl_error_count GD_ERROR_COUNT 1 1 */
+IDL_VPTR gdidl_error_count(int argc, IDL_VPTR argv[], char *argk)
+{
+  dtraceidl();
+
+  int err = gd_error_count(gdidl_get_dirfile(IDL_LongScalar(argv[0])));
+
+  IDL_VPTR r = IDL_GettmpInt(err);
+  dreturn("%p", r);
+  return r;
+}
+
 /* @@DLM: F gdidl_error_string GD_ERROR_STRING 1 1 */
 IDL_VPTR gdidl_error_string(int argc, IDL_VPTR argv[], char *argk)
 {
@@ -3827,7 +4002,7 @@ IDL_VPTR gdidl_get_eof(int argc, IDL_VPTR argv[], char *argk)
   DIRFILE* D = gdidl_get_dirfile(IDL_LongScalar(argv[0]));
   const char *field_code = IDL_VarGetString(argv[1]);
 
-  off64_t eof = gd_eof(D, field_code);
+  off64_t eof = gd_eof64(D, field_code);
 
   GDIDL_SET_ERROR(D);
 
@@ -3840,39 +4015,43 @@ IDL_VPTR gdidl_get_eof(int argc, IDL_VPTR argv[], char *argk)
   return r;
 }
 
+/* @@DLM: F gdidl_get_field_list GD_ENTRY_LIST 1 1 KEYWORDS */
+/* the following alias is needed for backwards compatibility */
 /* @@DLM: F gdidl_get_field_list GD_FIELD_LIST 1 1 KEYWORDS */
-/* @@DLM: F gdidl_get_field_list GD_FIELD_LIST_BY_TYPE 1 1 KEYWORDS */
-/* @@DLM: F gdidl_get_field_list GD_MFIELD_LIST 1 1 KEYWORDS */
-/* @@DLM: F gdidl_get_field_list GD_MFIELD_LIST_BY_TYPE 1 1 KEYWORDS */
 IDL_VPTR gdidl_get_field_list(int argc, IDL_VPTR argv[], char *argk)
 {
   dtraceidl();
 
-  int i;
-  unsigned int nfields;
-  const char** list;
+  unsigned int i, nentries, flags = 0;
+  const char **list;
+  const char *parent = NULL;
 
   typedef struct {
     IDL_KW_RESULT_FIRST_FIELD;
     GDIDL_KW_RESULT_ERROR;
-    gd_type_t type;
-    int type_x;
+    int type;
     IDL_STRING parent;
     int parent_x;
+    int hidden, noalias, scalars, vectors, aliases;
   } KW_RESULT;
   KW_RESULT kw;
 
   GDIDL_KW_INIT_ERROR;
-  kw.type = kw.type_x = 0;
+  kw.type = 0;
+  kw.hidden = kw.noalias = kw.scalars = kw.vectors = kw.aliases = 0;
   kw.parent_x = 0;
 
   static IDL_KW_PAR kw_pars[] = {
+    { "ALIASES", IDL_TYP_INT, 1, 0, 0, IDL_KW_OFFSETOF(aliases) },
     GDIDL_KW_PAR_ERROR,
     GDIDL_KW_PAR_ESTRING,
+    { "HIDDEN", IDL_TYP_INT, 1, 0, 0, IDL_KW_OFFSETOF(hidden) },
+    { "NOALIAS", IDL_TYP_INT, 1, 0, 0, IDL_KW_OFFSETOF(noalias) },
     { "PARENT", IDL_TYP_STRING, 1, 0, IDL_KW_OFFSETOF(parent_x),
       IDL_KW_OFFSETOF(parent) },
-    { "TYPE", IDL_TYP_INT, 1, 0, IDL_KW_OFFSETOF(type_x),
-      IDL_KW_OFFSETOF(type) },
+    { "SCALARS", IDL_TYP_INT, 1, 0, 0, IDL_KW_OFFSETOF(scalars) },
+    { "TYPE", IDL_TYP_UINT, 1, 0, 0, IDL_KW_OFFSETOF(type) },
+    { "VECTORS", IDL_TYP_INT, 1, 0, 0, IDL_KW_OFFSETOF(vectors) },
     { NULL }
   };
 
@@ -3880,34 +4059,35 @@ IDL_VPTR gdidl_get_field_list(int argc, IDL_VPTR argv[], char *argk)
 
   DIRFILE* D = gdidl_get_dirfile(IDL_LongScalar(argv[0]));
 
-  if (kw.parent_x) {
-    const char* parent = IDL_STRING_STR(&kw.parent);
-    if (kw.type_x) {
-      nfields = gd_nmfields_by_type(D, parent, kw.type);
-      list = gd_mfield_list_by_type(D, parent, kw.type);
-    } else {
-      nfields = gd_nmfields(D, parent);
-      list = gd_mfield_list(D, parent);
-    }
-  } else {
-    if (kw.type_x) {
-      nfields = gd_nfields_by_type(D, kw.type);
-      list = gd_field_list_by_type(D, kw.type);
-    } else {
-      nfields = gd_nfields(D);
-      list = gd_field_list(D);
-    }
+  if (kw.parent_x)
+    parent = IDL_STRING_STR(&kw.parent);
+
+  if (kw.hidden)
+    flags |= GD_ENTRIES_HIDDEN;
+  if (kw.noalias)
+    flags |= GD_ENTRIES_NOALIAS;
+
+  if (kw.type == 0) {
+    if (kw.vectors)
+      kw.type = GD_VECTOR_ENTRIES;
+    else if (kw.scalars)
+      kw.type = GD_SCALAR_ENTRIES;
+    else if (kw.aliases)
+      kw.type = GD_ALIAS_ENTRIES;
   }
 
+  nentries = gd_nentries(D, parent, kw.type, flags);
+  list = gd_entry_list(D, parent, kw.type, flags);
+
   GDIDL_SET_ERROR(D);
 
   IDL_KW_FREE;
 
   IDL_VPTR r;
 
-  IDL_STRING *data = (IDL_STRING*)IDL_MakeTempVector(IDL_TYP_STRING, nfields,
+  IDL_STRING *data = (IDL_STRING*)IDL_MakeTempVector(IDL_TYP_STRING, nentries,
       IDL_ARR_INI_ZERO, &r);
-  for (i = 0; i < nfields; ++i)
+  for (i = 0; i < nentries; ++i)
     IDL_StrStore(data + i, (char*)list[i]);
 
   dreturn("%p", r);
@@ -3957,7 +4137,6 @@ IDL_VPTR gdidl_get_fragmentname(int argc, IDL_VPTR argv[], char *argk)
 }
 
 /* @@DLM: F gdidl_get_framenum GD_FRAMENUM 3 3 KEYWORDS */
-/* @@DLM: F gdidl_get_framenum GD_FRAMENUM_SUBSET 3 3 KEYWORDS */
 IDL_VPTR gdidl_get_framenum(int argc, IDL_VPTR argv[], char *argk)
 {
   dtraceidl();
@@ -4062,37 +4241,42 @@ IDL_VPTR gdidl_get_native_type(int argc, IDL_VPTR argv[], char *argk)
   return r;
 }
 
+/* @@DLM: F gdidl_get_nfields GD_NENTRIES 1 1 KEYWORDS */
+/* the following alias is needed for backwards compatibility */
 /* @@DLM: F gdidl_get_nfields GD_NFIELDS 1 1 KEYWORDS */
-/* @@DLM: F gdidl_get_nfields GD_NFIELDS_BY_TYPE 1 1 KEYWORDS */
-/* @@DLM: F gdidl_get_nfields GD_NMFIELDS 1 1 KEYWORDS */
-/* @@DLM: F gdidl_get_nfields GD_NMFIELDS_BY_TYPE 1 1 KEYWORDS */
 IDL_VPTR gdidl_get_nfields(int argc, IDL_VPTR argv[], char *argk)
 {
   dtraceidl();
 
-  unsigned int nfields;
+  unsigned int nentries, flags = 0;
+  const char *parent = NULL;
 
   typedef struct {
     IDL_KW_RESULT_FIRST_FIELD;
     GDIDL_KW_RESULT_ERROR;
-    gd_type_t type;
-    int type_x;
+    int type;
     IDL_STRING parent;
     int parent_x;
+    int aliases, hidden, noalias, scalars, vectors;
   } KW_RESULT;
   KW_RESULT kw;
 
   GDIDL_KW_INIT_ERROR;
-  kw.type = kw.type_x = 0;
+  kw.type = 0;
+  kw.hidden = kw.noalias = kw.scalars = kw.vectors = kw.aliases = 0;
   kw.parent_x = 0;
 
   static IDL_KW_PAR kw_pars[] = {
+    { "ALIASES", IDL_TYP_INT, 1, 0, 0, IDL_KW_OFFSETOF(aliases) },
     GDIDL_KW_PAR_ERROR,
     GDIDL_KW_PAR_ESTRING,
+    { "HIDDEN", IDL_TYP_INT, 1, 0, 0, IDL_KW_OFFSETOF(hidden) },
+    { "NOALIAS", IDL_TYP_INT, 1, 0, 0, IDL_KW_OFFSETOF(noalias) },
     { "PARENT", IDL_TYP_STRING, 1, 0, IDL_KW_OFFSETOF(parent_x),
       IDL_KW_OFFSETOF(parent) },
-    { "TYPE", IDL_TYP_INT, 1, 0, IDL_KW_OFFSETOF(type_x),
-      IDL_KW_OFFSETOF(type) },
+    { "SCALARS", IDL_TYP_INT, 1, 0, 0, IDL_KW_OFFSETOF(scalars) },
+    { "TYPE", IDL_TYP_UINT, 1, 0, 0, IDL_KW_OFFSETOF(type) },
+    { "VECTORS", IDL_TYP_INT, 1, 0, 0, IDL_KW_OFFSETOF(vectors) },
     { NULL }
   };
 
@@ -4100,24 +4284,30 @@ IDL_VPTR gdidl_get_nfields(int argc, IDL_VPTR argv[], char *argk)
 
   DIRFILE* D = gdidl_get_dirfile(IDL_LongScalar(argv[0]));
 
-  if (kw.parent_x) {
-    const char* parent = IDL_STRING_STR(&kw.parent);
-    if (kw.type_x) 
-      nfields = gd_nmfields_by_type(D, parent, kw.type);
-    else 
-      nfields = gd_nmfields(D, parent);
-  } else {
-    if (kw.type_x) 
-      nfields = gd_nfields_by_type(D, kw.type);
-    else 
-      nfields = gd_nfields(D);
+  if (kw.parent_x)
+    parent = IDL_STRING_STR(&kw.parent);
+
+  if (kw.hidden)
+    flags |= GD_ENTRIES_HIDDEN;
+  if (kw.noalias)
+    flags |= GD_ENTRIES_NOALIAS;
+
+  if (kw.type == 0) {
+    if (kw.vectors)
+      kw.type = GD_VECTOR_ENTRIES;
+    else if (kw.scalars)
+      kw.type = GD_SCALAR_ENTRIES;
+    else if (kw.aliases)
+      kw.type = GD_ALIAS_ENTRIES;
   }
 
+  nentries = gd_nentries(D, parent, kw.type, flags);
+
   GDIDL_SET_ERROR(D);
 
   IDL_KW_FREE;
 
-  IDL_VPTR r = IDL_GettmpLong(nfields);
+  IDL_VPTR r = IDL_GettmpLong(nentries);
   dreturn("%p", r);
   return r;
 }
@@ -4166,7 +4356,6 @@ IDL_VPTR gdidl_get_nframes(int argc, IDL_VPTR argv[], char *argk)
   return r;
 }
 
-/* @@DLM: F gdidl_get_nvectors GD_NMVECTORS 1 1 KEYWORDS */
 /* @@DLM: F gdidl_get_nvectors GD_NVECTORS 1 1 KEYWORDS */
 IDL_VPTR gdidl_get_nvectors(int argc, IDL_VPTR argv[], char *argk)
 {
@@ -4375,7 +4564,6 @@ IDL_VPTR gdidl_get_string(int argc, IDL_VPTR argv[], char *argk)
 }
 
 /* @@DLM: F gdidl_get_strings GD_STRINGS 1 1 KEYWORDS */
-/* @@DLM: F gdidl_get_strings GD_MSTRINGS 1 1 KEYWORDS */
 IDL_VPTR gdidl_get_strings(int argc, IDL_VPTR argv[], char *argk)
 {
   dtraceidl();
@@ -4434,7 +4622,6 @@ IDL_VPTR gdidl_get_strings(int argc, IDL_VPTR argv[], char *argk)
 }
 
 /* @@DLM: F gdidl_get_vector_list GD_VECTOR_LIST 1 1 KEYWORDS */
-/* @@DLM: F gdidl_get_vector_list GD_MVECTOR_LIST 1 1 KEYWORDS */
 IDL_VPTR gdidl_get_vector_list(int argc, IDL_VPTR argv[], char *argk)
 {
   dtraceidl();
@@ -4501,17 +4688,20 @@ void gdidl_putdata(int argc, IDL_VPTR argv[], char *argk)
     GDIDL_KW_RESULT_ERROR;
     IDL_LONG64 first_frame;
     IDL_LONG64 first_sample;
+    int first_frame_x, first_sample_x;
   } KW_RESULT;
   KW_RESULT kw;
 
-  kw.first_frame = kw.first_sample = 0;
+  kw.first_frame = kw.first_sample = kw.first_frame_x = kw.first_sample_x = 0;
   GDIDL_KW_INIT_ERROR;
 
   static IDL_KW_PAR kw_pars[] = {
     GDIDL_KW_PAR_ERROR,
     GDIDL_KW_PAR_ESTRING,
-    { "FIRST_FRAME", IDL_TYP_LONG64, 1, 0, 0, IDL_KW_OFFSETOF(first_frame) },
-    { "FIRST_SAMPLE", IDL_TYP_LONG64, 1, 0, 0, IDL_KW_OFFSETOF(first_sample) },
+    { "FIRST_FRAME", IDL_TYP_LONG64, 1, 0, IDL_KW_OFFSETOF(first_sample_x),
+      IDL_KW_OFFSETOF(first_frame) },
+    { "FIRST_SAMPLE", IDL_TYP_LONG64, 1, 0, IDL_KW_OFFSETOF(first_sample_x),
+      IDL_KW_OFFSETOF(first_sample) },
     { NULL }
   };
 
@@ -4520,6 +4710,11 @@ void gdidl_putdata(int argc, IDL_VPTR argv[], char *argk)
   DIRFILE *D = gdidl_get_dirfile(IDL_LongScalar(argv[0]));
   const char* field_code = IDL_VarGetString(argv[1]);
 
+  if (kw.first_frame_x == 0 && kw.first_sample_x == 0) {
+    kw.first_frame = GD_HERE;
+    kw.first_sample = 0;
+  }
+
   IDL_ENSURE_ARRAY(argv[2]);
   if (argv[2]->value.arr->n_dim != 1)
     idl_kw_abort("data must be a vector, not a multidimensional array");
@@ -4676,6 +4871,969 @@ IDL_VPTR gdidl_dirfile_standards(int argc, IDL_VPTR argv[], char *argk)
   return r;
 }
 
+/* @@DLM: F gdidl_seek GD_SEEK 2 2 KEYWORDS */
+IDL_VPTR gdidl_seek(int argc, IDL_VPTR argv[], char *argk)
+{
+  dtraceidl();
+
+  typedef struct {
+    IDL_KW_RESULT_FIRST_FIELD;
+    GDIDL_KW_RESULT_ERROR;
+    off64_t frame_num;
+    off64_t sample_num;
+    int whence;
+    int write;
+  } KW_RESULT;
+  KW_RESULT kw;
+
+  kw.whence = GD_SEEK_SET;
+  kw.frame_num = kw.sample_num = 0;
+  kw.write = 0;
+  GDIDL_KW_INIT_ERROR;
+
+  static IDL_KW_PAR kw_pars[] = {
+    GDIDL_KW_PAR_ERROR,
+    GDIDL_KW_PAR_ESTRING,
+    { "FRAME_NUM", IDL_TYP_LONG64, 1, 0, 0, IDL_KW_OFFSETOF(frame_num) },
+    { "SAMPLE_NUM", IDL_TYP_LONG64, 1, 0, 0, IDL_KW_OFFSETOF(sample_num) },
+    { "WHENCE", IDL_TYP_INT, 1, 0, 0, IDL_KW_OFFSETOF(whence) },
+    { "WRITE", IDL_TYP_INT, 1, 0, 0, IDL_KW_OFFSETOF(write) },
+    { NULL }
+  };
+
+  argc = IDL_KWProcessByOffset(argc, argv, argk, kw_pars, NULL, 1, &kw);
+
+  DIRFILE *D = gdidl_get_dirfile(IDL_LongScalar(argv[0]));
+  const char* field_code = IDL_VarGetString(argv[1]);
+
+  off64_t pos = gd_seek64(D, field_code, kw.frame_num, kw.sample_num,
+      (kw.whence & (GD_SEEK_SET | GD_SEEK_CUR | GD_SEEK_END)) |
+      (kw.write ? GD_SEEK_WRITE : 0));
+
+  GDIDL_SET_ERROR(D);
+
+  IDL_KW_FREE;
+
+  IDL_VPTR r = IDL_Gettmp();
+  r->type = IDL_TYP_LONG64;
+  r->value.l64 = (IDL_LONG64)pos;
+  dreturn("%p", r);
+  return r;
+}
+
+/* @@DLM: F gdidl_tell GD_TELL 2 2 KEYWORDS */
+IDL_VPTR gdidl_tell(int argc, IDL_VPTR argv[], char *argk)
+{
+  dtraceidl();
+
+  GDIDL_KW_ONLY_ERROR;
+
+  DIRFILE* D = gdidl_get_dirfile(IDL_LongScalar(argv[0]));
+  const char* field_code = IDL_VarGetString(argv[1]);
+
+  off64_t pos = gd_tell64(D, field_code);
+
+  GDIDL_SET_ERROR(D);
+
+  IDL_KW_FREE;
+
+  IDL_VPTR r = IDL_Gettmp();
+  r->type = IDL_TYP_LONG64;
+  r->value.l64 = (IDL_LONG64)pos;
+  dreturn("%p", r);
+  return r;
+}
+
+/* @@DLM: F gdidl_hidden GD_HIDDEN 2 2 KEYWORDS */
+IDL_VPTR gdidl_hidden(int argc, IDL_VPTR argv[], char *argk)
+{
+  dtraceidl();
+
+  GDIDL_KW_ONLY_ERROR;
+
+  DIRFILE* D = gdidl_get_dirfile(IDL_LongScalar(argv[0]));
+  const char* field_code = IDL_VarGetString(argv[1]);
+
+  int hidden = gd_hidden(D, field_code);
+
+  GDIDL_SET_ERROR(D);
+
+  IDL_KW_FREE;
+
+  IDL_VPTR r = IDL_GettmpInt(hidden);
+  dreturn("%p", r);
+  return r;
+}
+
+/* @@DLM: P gdidl_hide GD_HIDE 2 2 KEYWORDS */
+void gdidl_hide(int argc, IDL_VPTR argv[], char *argk)
+{
+  dtraceidl();
+
+  GDIDL_KW_ONLY_ERROR;
+
+  DIRFILE* D = gdidl_get_dirfile(IDL_LongScalar(argv[0]));
+  const char* field_code = IDL_VarGetString(argv[1]);
+
+  gd_hide(D, field_code);
+
+  GDIDL_SET_ERROR(D);
+
+  IDL_KW_FREE;
+
+  dreturnvoid();
+}
+
+/* @@DLM: P gdidl_unhide GD_UNHIDE 2 2 KEYWORDS */
+void gdidl_unhide(int argc, IDL_VPTR argv[], char *argk)
+{
+  dtraceidl();
+
+  GDIDL_KW_ONLY_ERROR;
+
+  DIRFILE* D = gdidl_get_dirfile(IDL_LongScalar(argv[0]));
+  const char* field_code = IDL_VarGetString(argv[1]);
+
+  gd_unhide(D, field_code);
+
+  GDIDL_SET_ERROR(D);
+
+  IDL_KW_FREE;
+
+  dreturnvoid();
+}
+
+/* @@DLM: P gdidl_add_window GD_ADD_WINDOW 5 5 KEYWORDS */
+void gdidl_add_window(int argc, IDL_VPTR argv[], char *argk)
+{
+  dtraceidl();
+
+  gd_windop_t windop;
+  gd_triplet_t threshold;
+  int nop = 0;
+  typedef struct {
+    IDL_KW_RESULT_FIRST_FIELD;
+    GDIDL_KW_RESULT_ERROR;
+    IDL_STRING parent;
+    int eq, ne, le, lt, gt, ge, set, clr;
+    int parent_x;
+    int fragment_index;
+  } KW_RESULT;
+  KW_RESULT kw;
+
+  GDIDL_KW_INIT_ERROR;
+  kw.eq = kw.ne = kw.le = kw.lt = kw.gt = kw.ge = kw.set = kw.clr = 0;
+  kw.fragment_index = kw.parent_x = 0;
+
+  static IDL_KW_PAR kw_pars[] = {
+    { "CLR", IDL_TYP_INT, 1, 0, 0, IDL_KW_OFFSETOF(clr) },
+    { "EQ", IDL_TYP_INT, 1, 0, 0, IDL_KW_OFFSETOF(eq) },
+    GDIDL_KW_PAR_ERROR,
+    GDIDL_KW_PAR_ESTRING,
+    { "FRAGMENT", IDL_TYP_INT, 1, 0, 0, IDL_KW_OFFSETOF(fragment_index) },
+    { "GE", IDL_TYP_INT, 1, 0, 0, IDL_KW_OFFSETOF(ge) },
+    { "GT", IDL_TYP_INT, 1, 0, 0, IDL_KW_OFFSETOF(gt) },
+    { "LE", IDL_TYP_INT, 1, 0, 0, IDL_KW_OFFSETOF(le) },
+    { "LT", IDL_TYP_INT, 1, 0, 0, IDL_KW_OFFSETOF(lt) },
+    { "NE", IDL_TYP_INT, 1, 0, 0, IDL_KW_OFFSETOF(ne) },
+    { "PARENT", IDL_TYP_STRING, 1, 0, IDL_KW_OFFSETOF(parent_x),
+      IDL_KW_OFFSETOF(parent) },
+    { "SET", IDL_TYP_INT, 1, 0, 0, IDL_KW_OFFSETOF(set) },
+    { NULL }
+  };
+
+  IDL_KWProcessByOffset(argc, argv, argk, kw_pars, NULL, 1, &kw);
+
+  DIRFILE* D = gdidl_get_dirfile(IDL_LongScalar(argv[0]));
+  const char* field_code = IDL_VarGetString(argv[1]);
+  const char* in_field = IDL_VarGetString(argv[2]);
+  const char* check = IDL_VarGetString(argv[3]);
+
+  /* check operator */
+  if (kw.eq) {
+    windop = GD_WINDOP_EQ;
+    nop++;
+  }
+  if (kw.ne) {
+    windop = GD_WINDOP_NE;
+    nop++;
+  }
+  if (kw.le) {
+    windop = GD_WINDOP_LE;
+    nop++;
+  }
+  if (kw.lt) {
+    windop = GD_WINDOP_LT;
+    nop++;
+  }
+  if (kw.ge) {
+    windop = GD_WINDOP_GE;
+    nop++;
+  }
+  if (kw.gt) {
+    windop = GD_WINDOP_GT;
+    nop++;
+  }
+  if (kw.set) {
+    windop = GD_WINDOP_SET;
+    nop++;
+  }
+  if (kw.clr) {
+    windop = GD_WINDOP_CLR;
+    nop++;
+  }
+
+  if (nop > 1)
+    idl_kw_abort("Multiple operations specified");
+  else if (nop == 0)
+    idl_kw_abort("No operation specified");
+
+  switch (windop) {
+    case GD_WINDOP_EQ:
+    case GD_WINDOP_NE:
+      threshold.i = IDL_Long64Scalar(argv[4]);
+      break;
+    case GD_WINDOP_SET:
+    case GD_WINDOP_CLR:
+      threshold.u = IDL_ULong64Scalar(argv[4]);
+      break;
+    default:
+      threshold.r = IDL_DoubleScalar(argv[4]);
+      break;
+  }
+
+  if (kw.parent_x) {
+    const char* parent = IDL_STRING_STR(&kw.parent);
+    gd_madd_window(D, parent, field_code, in_field, check, windop, threshold);
+  } else
+    gd_add_window(D, field_code, in_field, check, windop, threshold,
+        kw.fragment_index);
+
+  GDIDL_SET_ERROR(D);
+
+  IDL_KW_FREE;
+
+  dreturnvoid();
+}
+
+/* @@DLM: P gdidl_add_mplex GD_ADD_MPLEX 5 5 KEYWORDS */
+void gdidl_add_mplex(int argc, IDL_VPTR argv[], char *argk)
+{
+  dtraceidl();
+
+  typedef struct {
+    IDL_KW_RESULT_FIRST_FIELD;
+    GDIDL_KW_RESULT_ERROR;
+    IDL_STRING parent;
+    int parent_x;
+    int fragment_index;
+    int max;
+  } KW_RESULT;
+  KW_RESULT kw;
+
+  GDIDL_KW_INIT_ERROR;
+  kw.fragment_index = kw.parent_x = kw.max = 0;
+
+  static IDL_KW_PAR kw_pars[] = {
+    GDIDL_KW_PAR_ERROR,
+    GDIDL_KW_PAR_ESTRING,
+    { "FRAGMENT", IDL_TYP_INT, 1, 0, 0, IDL_KW_OFFSETOF(fragment_index) },
+    { "MAX", IDL_TYP_INT, 1, 0, 0, IDL_KW_OFFSETOF(max) },
+    { "PARENT", IDL_TYP_STRING, 1, 0, IDL_KW_OFFSETOF(parent_x),
+      IDL_KW_OFFSETOF(parent) },
+    { NULL }
+  };
+
+  IDL_KWProcessByOffset(argc, argv, argk, kw_pars, NULL, 1, &kw);
+
+  DIRFILE* D = gdidl_get_dirfile(IDL_LongScalar(argv[0]));
+  const char* field_code = IDL_VarGetString(argv[1]);
+  const char* in_field = IDL_VarGetString(argv[2]);
+  const char* count = IDL_VarGetString(argv[3]);
+  int val = IDL_LongScalar(argv[4]);
+
+  if (kw.parent_x) {
+    const char* parent = IDL_STRING_STR(&kw.parent);
+    gd_madd_mplex(D, parent, field_code, in_field, count, val, kw.max);
+  } else
+    gd_add_mplex(D, field_code, in_field, count, val, kw.max,
+        kw.fragment_index);
+
+  GDIDL_SET_ERROR(D);
+
+  IDL_KW_FREE;
+
+  dreturnvoid();
+}
+
+/* @@DLM: P gdidl_alter_window GD_ALTER_WINDOW 2 2 KEYWORDS */
+void gdidl_alter_window(int argc, IDL_VPTR argv[], char *argk)
+{
+  dtraceidl();
+
+  int nop = 0;
+  const char* in_field = NULL;
+  const char* check = NULL;
+  gd_triplet_t threshold;
+  gd_windop_t windop = GD_WINDOP_UNK;
+
+  typedef struct {
+    IDL_KW_RESULT_FIRST_FIELD;
+    GDIDL_KW_RESULT_ERROR;
+    IDL_VPTR threshold;
+    int eq, ne, le, lt, gt, ge, set, clr;
+    int threshold_x;
+    IDL_STRING in_field;
+    int in_field_x;
+    IDL_STRING check;
+    int check_x;
+  } KW_RESULT;
+  KW_RESULT kw;
+
+  threshold.r = 0;
+  kw.check_x = kw.in_field_x = kw.threshold_x = 0;
+  kw.eq = kw.ne = kw.le = kw.lt = kw.gt = kw.ge = kw.set = kw.clr = 0;
+  GDIDL_KW_INIT_ERROR;
+
+  static IDL_KW_PAR kw_pars[] = {
+    { "CHECK_FIELD", IDL_TYP_STRING, 1, 0, IDL_KW_OFFSETOF(check_x),
+      IDL_KW_OFFSETOF(check) },
+    { "CLR", IDL_TYP_INT, 1, 0, 0, IDL_KW_OFFSETOF(clr) },
+    { "EQ", IDL_TYP_INT, 1, 0, 0, IDL_KW_OFFSETOF(eq) },
+    GDIDL_KW_PAR_ERROR,
+    GDIDL_KW_PAR_ESTRING,
+    { "GE", IDL_TYP_INT, 1, 0, 0, IDL_KW_OFFSETOF(ge) },
+    { "GT", IDL_TYP_INT, 1, 0, 0, IDL_KW_OFFSETOF(gt) },
+    { "IN_FIELD", IDL_TYP_STRING, 1, 0, IDL_KW_OFFSETOF(in_field_x),
+      IDL_KW_OFFSETOF(in_field) },
+    { "LE", IDL_TYP_INT, 1, 0, 0, IDL_KW_OFFSETOF(le) },
+    { "LT", IDL_TYP_INT, 1, 0, 0, IDL_KW_OFFSETOF(lt) },
+    { "NE", IDL_TYP_INT, 1, 0, 0, IDL_KW_OFFSETOF(ne) },
+    { "SET", IDL_TYP_INT, 1, 0, 0, IDL_KW_OFFSETOF(set) },
+    { "THRESHOLD", 0, 1, IDL_KW_VIN, IDL_KW_OFFSETOF(threshold_x),
+      IDL_KW_OFFSETOF(threshold) },
+    { NULL }
+  };
+
+  IDL_KWProcessByOffset(argc, argv, argk, kw_pars, NULL, 1, &kw);
+
+  DIRFILE* D = gdidl_get_dirfile(IDL_LongScalar(argv[0]));
+  const char* field_code = IDL_VarGetString(argv[1]);
+
+  /* count operators */
+  if (kw.eq) {
+    windop = GD_WINDOP_EQ;
+    nop++;
+  }
+  if (kw.ne) {
+    windop = GD_WINDOP_NE;
+    nop++;
+  }
+  if (kw.le) {
+    windop = GD_WINDOP_LE;
+    nop++;
+  }
+  if (kw.lt) {
+    windop = GD_WINDOP_LT;
+    nop++;
+  }
+  if (kw.ge) {
+    windop = GD_WINDOP_GE;
+    nop++;
+  }
+  if (kw.gt) {
+    windop = GD_WINDOP_GT;
+    nop++;
+  }
+  if (kw.set) {
+    windop = GD_WINDOP_SET;
+    nop++;
+  }
+  if (kw.clr) {
+    windop = GD_WINDOP_CLR;
+    nop++;
+  }
+
+  if (nop > 1)
+    idl_kw_abort("Multiple operations specified");
+
+  /* Need the current windop and/or threshold */
+  if (nop == 0 || !kw.threshold_x) {
+    gd_entry_t E;
+    gd_entry(D, field_code, &E);
+    gd_free_entry_strings(&E);
+    if (gd_error(D)) {
+      GDIDL_SET_ERROR(D);
+
+      IDL_KW_FREE;
+
+      dreturnvoid();
+      return;
+    }
+    if (nop == 0)
+      windop = E.windop;
+    if (!kw.threshold_x)
+      threshold = E.threshold;
+  }
+
+  if (kw.in_field_x)
+    in_field = IDL_STRING_STR(&kw.in_field);
+
+  if (kw.check_x)
+    check = IDL_STRING_STR(&kw.check);
+
+  if (kw.threshold_x) {
+    switch (windop) {
+      case GD_WINDOP_EQ:
+      case GD_WINDOP_NE:
+        threshold.i = IDL_Long64Scalar(kw.threshold);
+        break;
+      case GD_WINDOP_SET:
+      case GD_WINDOP_CLR:
+        threshold.u = IDL_ULong64Scalar(kw.threshold);
+        break;
+      default:
+        threshold.r = IDL_DoubleScalar(kw.threshold);
+        break;
+    }
+  }
+
+  gd_alter_window(D, field_code, in_field, check, windop, threshold);
+
+  GDIDL_SET_ERROR(D);
+
+  IDL_KW_FREE;
+
+  dreturnvoid();
+}
+
+/* @@DLM: P gdidl_alter_mplex GD_ALTER_MPLEX 2 2 KEYWORDS */
+void gdidl_alter_mplex(int argc, IDL_VPTR argv[], char *argk)
+{
+  dtraceidl();
+
+  const char* in_field1 = NULL;
+  const char* in_field2 = NULL;
+
+  typedef struct {
+    IDL_KW_RESULT_FIRST_FIELD;
+    GDIDL_KW_RESULT_ERROR;
+    int val, val_x, period;
+    IDL_STRING in_field1;
+    int in_field1_x;
+    IDL_STRING in_field2;
+    int in_field2_x;
+  } KW_RESULT;
+  KW_RESULT kw;
+
+  kw.in_field1_x = kw.in_field2_x = kw.val_x = 0;
+  kw.period = -1;
+  GDIDL_KW_INIT_ERROR;
+
+  static IDL_KW_PAR kw_pars[] = {
+    { "COUNT_FIELD", IDL_TYP_STRING, 1, 0, IDL_KW_OFFSETOF(in_field2_x),
+      IDL_KW_OFFSETOF(in_field2) },
+    { "COUNT_VAL", IDL_TYP_INT, 1, 0, IDL_KW_OFFSETOF(val_x),
+      IDL_KW_OFFSETOF(val) },
+    GDIDL_KW_PAR_ERROR,
+    GDIDL_KW_PAR_ESTRING,
+    { "IN_FIELD", IDL_TYP_STRING, 1, 0, IDL_KW_OFFSETOF(in_field1_x),
+      IDL_KW_OFFSETOF(in_field1) },
+    { "PERIOD", IDL_TYP_INT, 1, 0, 0, IDL_KW_OFFSETOF(period) },
+    { NULL }
+  };
+
+  IDL_KWProcessByOffset(argc, argv, argk, kw_pars, NULL, 1, &kw);
+
+  DIRFILE* D = gdidl_get_dirfile(IDL_LongScalar(argv[0]));
+  const char* field_code = IDL_VarGetString(argv[1]);
+
+  /* no value specified, figure out the previous value */
+  if (!kw.val_x) {
+    gd_entry_t E;
+    gd_entry(D, field_code, &E);
+    kw.val = E.count_val;
+  }
+
+  if (!gd_error(D)) {
+    if (kw.in_field1_x)
+      in_field1 = IDL_STRING_STR(&kw.in_field1);
+
+    if (kw.in_field2_x)
+      in_field2 = IDL_STRING_STR(&kw.in_field2);
+
+    gd_alter_mplex(D, field_code, in_field1, in_field2, kw.val, kw.period);
+  }
+
+  GDIDL_SET_ERROR(D);
+
+  IDL_KW_FREE;
+
+  dreturnvoid();
+}
+
+/* @@DLM: F gdidl_naliases GD_NALIASES 2 2 KEYWORDS */
+IDL_VPTR gdidl_naliases(int argc, IDL_VPTR argv[], char *argk)
+{
+  dtraceidl();
+
+  int nalias;
+
+  GDIDL_KW_ONLY_ERROR;
+
+  DIRFILE* D = gdidl_get_dirfile(IDL_LongScalar(argv[0]));
+  const char* field_code = IDL_VarGetString(argv[1]);
+
+  nalias = gd_naliases(D, field_code);
+
+  GDIDL_SET_ERROR(D);
+
+  IDL_KW_FREE;
+
+  IDL_VPTR r = IDL_GettmpLong(nalias);
+  dreturn("%p", r);
+  return r;
+}
+
+/* @@DLM: F gdidl_alias_target GD_ALIAS_TARGET 2 2 KEYWORDS */
+IDL_VPTR gdidl_alias_target(int argc, IDL_VPTR argv[], char *argk)
+{
+  dtraceidl();
+
+  GDIDL_KW_ONLY_ERROR;
+
+  DIRFILE* D = gdidl_get_dirfile(IDL_LongScalar(argv[0]));
+  const char* field_code = IDL_VarGetString(argv[1]);
+
+  const char* name = gd_alias_target(D, field_code);
+
+  GDIDL_SET_ERROR(D);
+
+  IDL_KW_FREE;
+
+  IDL_VPTR r = IDL_StrToSTRING((char*)name);
+  dreturn("%p", r);
+  return r;
+}
+
+/* @@DLM: F gdidl_aliases GD_ALIASES 2 2 KEYWORDS */
+IDL_VPTR gdidl_aliases(int argc, IDL_VPTR argv[], char *argk)
+{
+  dtraceidl();
+
+  int i;
+  unsigned int nalias;
+  const char** list;
+
+  GDIDL_KW_ONLY_ERROR;
+
+  IDL_KWProcessByOffset(argc, argv, argk, kw_pars, NULL, 1, &kw);
+
+  DIRFILE* D = gdidl_get_dirfile(IDL_LongScalar(argv[0]));
+  const char* field_code = IDL_VarGetString(argv[1]);
+
+  nalias = gd_naliases(D, field_code);
+  list = gd_aliases(D, field_code);
+
+  GDIDL_SET_ERROR(D);
+
+  IDL_KW_FREE;
+
+  IDL_VPTR r;
+
+  IDL_STRING *data = (IDL_STRING*)IDL_MakeTempVector(IDL_TYP_STRING, nalias,
+      IDL_ARR_INI_ZERO, &r);
+  for (i = 0; i < nalias; ++i)
+    IDL_StrStore(data + i, (char*)list[i]);
+
+  dreturn("%p", r);
+  return r;
+}
+
+/* @@DLM: P gdidl_add_alias GD_ADD_ALIAS 3 3 KEYWORDS */
+void gdidl_add_alias(int argc, IDL_VPTR argv[], char *argk)
+{
+  dtraceidl();
+
+  typedef struct {
+    IDL_KW_RESULT_FIRST_FIELD;
+    GDIDL_KW_RESULT_ERROR;
+    int fragment_index;
+    IDL_STRING parent;
+    int parent_x;
+  } KW_RESULT;
+  KW_RESULT kw;
+
+  GDIDL_KW_INIT_ERROR;
+  kw.fragment_index = 0;
+  kw.parent_x = 0;
+
+  static IDL_KW_PAR kw_pars[] = {
+    GDIDL_KW_PAR_ERROR,
+    GDIDL_KW_PAR_ESTRING,
+    { "FRAGMENT", IDL_TYP_INT, 1, 0, 0, IDL_KW_OFFSETOF(fragment_index) },
+    { "PARENT", IDL_TYP_STRING, 1, 0, IDL_KW_OFFSETOF(parent_x),
+      IDL_KW_OFFSETOF(parent) },
+    { NULL }
+  };
+
+  IDL_KWProcessByOffset(argc, argv, argk, kw_pars, NULL, 1, &kw);
+
+  DIRFILE* D = gdidl_get_dirfile(IDL_LongScalar(argv[0]));
+  const char* field_code = IDL_VarGetString(argv[1]);
+  const char* target = IDL_VarGetString(argv[2]);
+
+  if (kw.parent_x) {
+    const char* parent = IDL_STRING_STR(&kw.parent);
+    gd_madd_alias(D, parent, field_code, target);
+  } else
+    gd_add_alias(D, field_code, target, kw.fragment_index);
+
+  GDIDL_SET_ERROR(D);
+
+  IDL_KW_FREE;
+
+  dreturnvoid();
+}
+
+/* @@DLM: P gdidl_alter_affixes GD_ALTER_AFFIXES 1 1 KEYWORDS */
+void gdidl_alter_affixes(int argc, IDL_VPTR argv[], char *argk)
+{
+  dtraceidl();
+
+  char *prefix = NULL;
+  char *suffix = NULL;
+  typedef struct {
+    IDL_KW_RESULT_FIRST_FIELD;
+    GDIDL_KW_RESULT_ERROR;
+    int fragment_index;
+    IDL_STRING prefix;
+    int prefix_x;
+    IDL_STRING suffix;
+    int suffix_x;
+  } KW_RESULT;
+  KW_RESULT kw;
+
+  GDIDL_KW_INIT_ERROR;
+  kw.fragment_index = kw.prefix_x = kw.suffix_x = 0;
+
+  static IDL_KW_PAR kw_pars[] = {
+    GDIDL_KW_PAR_ERROR,
+    GDIDL_KW_PAR_ESTRING,
+    { "FRAGMENT", IDL_TYP_INT, 1, 0, 0, IDL_KW_OFFSETOF(fragment_index) },
+    { "PREFIX", IDL_TYP_STRING, 1, 0, IDL_KW_OFFSETOF(prefix_x),
+      IDL_KW_OFFSETOF(prefix) },
+    { "SUFFIX", IDL_TYP_STRING, 1, 0, IDL_KW_OFFSETOF(suffix_x),
+      IDL_KW_OFFSETOF(suffix) },
+    { NULL }
+  };
+
+  IDL_KWProcessByOffset(argc, argv, argk, kw_pars, NULL, 1, &kw);
+
+  DIRFILE* D = gdidl_get_dirfile(IDL_LongScalar(argv[0]));
+
+  if (kw.prefix_x)
+    prefix = IDL_STRING_STR(&kw.prefix);
+
+  if (kw.suffix_x)
+    suffix = IDL_STRING_STR(&kw.suffix);
+
+  gd_alter_affixes(D, kw.fragment_index, prefix, suffix);
+
+  GDIDL_SET_ERROR(D);
+
+  IDL_KW_FREE;
+
+  dreturnvoid();
+}
+
+/* @@DLM: F gdidl_fragment_affixes GD_FRAGMENT_AFFIXES 1 1 KEYWORDS */
+IDL_VPTR gdidl_fragment_affixes(int argc, IDL_VPTR argv[], char *argk)
+{
+  dtraceidl();
+
+  char *prefix;
+  char *suffix;
+  typedef struct {
+    IDL_KW_RESULT_FIRST_FIELD;
+    GDIDL_KW_RESULT_ERROR;
+    int fragment_index;
+  } KW_RESULT;
+  KW_RESULT kw;
+
+  GDIDL_KW_INIT_ERROR;
+  kw.fragment_index = 0;
+
+  static IDL_KW_PAR kw_pars[] = {
+    GDIDL_KW_PAR_ERROR,
+    GDIDL_KW_PAR_ESTRING,
+    { "FRAGMENT", IDL_TYP_INT, 1, 0, 0, IDL_KW_OFFSETOF(fragment_index) },
+    { NULL }
+  };
+
+  IDL_KWProcessByOffset(argc, argv, argk, kw_pars, NULL, 1, &kw);
+
+  DIRFILE* D = gdidl_get_dirfile(IDL_LongScalar(argv[0]));
+
+  gd_fragment_affixes(D, kw.fragment_index, &prefix, &suffix);
+
+  GDIDL_SET_ERROR(D);
+
+  IDL_KW_FREE;
+
+  IDL_VPTR r;
+
+  IDL_STRING *data = (IDL_STRING*)IDL_MakeTempVector(IDL_TYP_STRING, 2,
+      IDL_ARR_INI_ZERO, &r);
+  IDL_StrStore(data, prefix);
+  IDL_StrStore(data + 1, suffix);
+
+  free(prefix);
+  free(suffix);
+
+  dreturn("%p", r);
+  return r;
+}
+
+/* @@DLM: F gdidl_strtok GD_STRTOK 1 1 KEYWORDS */
+IDL_VPTR gdidl_strtok(int argc, IDL_VPTR argv[], char *argk)
+{
+  dtraceidl();
+
+  const char *string = NULL;
+  char *token;
+  typedef struct {
+    IDL_KW_RESULT_FIRST_FIELD;
+    GDIDL_KW_RESULT_ERROR;
+    IDL_STRING string;
+    int string_x;
+  } KW_RESULT;
+  KW_RESULT kw;
+
+  GDIDL_KW_INIT_ERROR;
+  kw.string_x = 0;
+
+  static IDL_KW_PAR kw_pars[] = {
+    GDIDL_KW_PAR_ERROR,
+    GDIDL_KW_PAR_ESTRING,
+    { "STRING", IDL_TYP_STRING, 1, 0, IDL_KW_OFFSETOF(string_x),
+      IDL_KW_OFFSETOF(string) },
+    { NULL }
+  };
+
+  IDL_KWProcessByOffset(argc, argv, argk, kw_pars, NULL, 1, &kw);
+
+  DIRFILE* D = gdidl_get_dirfile(IDL_LongScalar(argv[0]));
+
+  if (kw.string_x)
+    string = IDL_STRING_STR(&kw.string);
+
+  token = gd_strtok(D, string);
+
+  GDIDL_SET_ERROR(D);
+
+  IDL_KW_FREE;
+
+  IDL_VPTR r = IDL_StrToSTRING(token);
+  free(token);
+  dreturn("%p", r);
+  return r;
+}
+
+/* @@DLM: F gdidl_desync GD_DESYNC 1 1 KEYWORDS */
+IDL_VPTR gdidl_desync(int argc, IDL_VPTR argv[], char *argk)
+{
+  dtraceidl();
+
+  int ret;
+  typedef struct {
+    IDL_KW_RESULT_FIRST_FIELD;
+    GDIDL_KW_RESULT_ERROR;
+    int pathcheck;
+    int reopen;
+  } KW_RESULT;
+  KW_RESULT kw;
+
+  GDIDL_KW_INIT_ERROR;
+  kw.pathcheck = kw.reopen = 0;
+
+  static IDL_KW_PAR kw_pars[] = {
+    GDIDL_KW_PAR_ERROR,
+    GDIDL_KW_PAR_ESTRING,
+    { "PATHCHECK", IDL_TYP_INT, 1, 0, 0, IDL_KW_OFFSETOF(pathcheck) },
+    { "REOPEN", IDL_TYP_INT, 1, 0, 0, IDL_KW_OFFSETOF(reopen) },
+    { NULL }
+  };
+
+  IDL_KWProcessByOffset(argc, argv, argk, kw_pars, NULL, 1, &kw);
+
+  DIRFILE *D = gdidl_get_dirfile(IDL_LongScalar(argv[0]));
+
+  ret = gd_desync(D, (kw.pathcheck ? GD_DESYNC_PATHCHECK : 0) |
+      (kw.reopen ? GD_DESYNC_REOPEN : 0));
+
+  GDIDL_SET_ERROR(D);
+
+  IDL_KW_FREE;
+
+  IDL_VPTR r = IDL_GettmpInt(ret);
+  dreturn("%p", r);
+  return r;
+}
+
+/* @@DLM: F gdidl_flags GD_FLAGS 1 1 KEYWORDS */
+IDL_VPTR gdidl_flags(int argc, IDL_VPTR argv[], char *argk)
+{
+  dtraceidl();
+
+  unsigned long flags, set = 0, reset = 0;
+  typedef struct {
+    IDL_KW_RESULT_FIRST_FIELD;
+    GDIDL_KW_RESULT_ERROR;
+    short int pretty, verbose;
+  } KW_RESULT;
+  KW_RESULT kw;
+
+  GDIDL_KW_INIT_ERROR;
+  kw.pretty = kw.verbose = -1;
+
+  static IDL_KW_PAR kw_pars[] = {
+    GDIDL_KW_PAR_ERROR,
+    GDIDL_KW_PAR_ESTRING,
+    { "PRETTY_PRINT", IDL_TYP_INT, 1, 0, 0, IDL_KW_OFFSETOF(pretty) },
+    { "VERBOSE", IDL_TYP_INT, 1, 0, 0, IDL_KW_OFFSETOF(verbose) },
+    { NULL }
+  };
+
+  IDL_KWProcessByOffset(argc, argv, argk, kw_pars, NULL, 1, &kw);
+
+  if (kw.pretty == 1)
+    set |= GD_PRETTY_PRINT;
+  else if (kw.pretty == 0)
+    reset |= GD_PRETTY_PRINT;
+
+  if (kw.verbose == 1)
+    set |= GD_VERBOSE;
+  else if (kw.verbose == 0)
+    reset |= GD_VERBOSE;
+
+  DIRFILE *D = gdidl_get_dirfile(IDL_LongScalar(argv[0]));
+
+  flags = gd_flags(D, set, reset);
+
+  GDIDL_SET_ERROR(D);
+
+  IDL_KW_FREE;
+
+  IDL_VPTR r = IDL_GettmpLong(flags);
+  dreturn("%p", r);
+  return r;
+}
+
+/* @@DLM: P gdidl_verbose_prefix GD_VERBOSE_PREFIX 1 1 KEYWORDS */
+void gdidl_verbose_prefix(int argc, IDL_VPTR argv[], char *argk)
+{
+  dtraceidl();
+
+  char *prefix = NULL;
+  typedef struct {
+    IDL_KW_RESULT_FIRST_FIELD;
+    GDIDL_KW_RESULT_ERROR;
+    IDL_STRING prefix;
+    int prefix_x;
+  } KW_RESULT;
+  KW_RESULT kw;
+
+  GDIDL_KW_INIT_ERROR;
+  kw.prefix_x = 0;
+
+  static IDL_KW_PAR kw_pars[] = {
+    GDIDL_KW_PAR_ERROR,
+    GDIDL_KW_PAR_ESTRING,
+    { "PREFIX", IDL_TYP_STRING, 1, 0, IDL_KW_OFFSETOF(prefix_x),
+      IDL_KW_OFFSETOF(prefix) },
+    { NULL }
+  };
+
+  IDL_KWProcessByOffset(argc, argv, argk, kw_pars, NULL, 1, &kw);
+
+  DIRFILE* D = gdidl_get_dirfile(IDL_LongScalar(argv[0]));
+
+  if (kw.prefix_x)
+    prefix = IDL_STRING_STR(&kw.prefix);
+
+  gd_verbose_prefix(D, prefix);
+
+  GDIDL_SET_ERROR(D);
+
+  IDL_KW_FREE;
+
+  dreturnvoid();
+}
+
+/* @@DLM: P gdidl_mplex_lookback GD_MPLEX_LOOKBACK 1 2 KEYWORDS */
+void gdidl_mplex_lookback(int argc, IDL_VPTR argv[], char *argk)
+{
+  dtraceidl();
+
+  int lookback = GD_DEFAULT_LOOKBACK;
+
+  typedef struct {
+    IDL_KW_RESULT_FIRST_FIELD;
+    GDIDL_KW_RESULT_ERROR;
+    int all;
+  } KW_RESULT;
+  KW_RESULT kw;
+
+  GDIDL_KW_INIT_ERROR;
+  kw.all = 0;
+
+  static IDL_KW_PAR kw_pars[] = {
+    { "ALL", IDL_TYP_INT, 1, 0, 0, IDL_KW_OFFSETOF(all) },
+    GDIDL_KW_PAR_ERROR,
+    GDIDL_KW_PAR_ESTRING,
+    { NULL }
+  };
+
+  IDL_KWProcessByOffset(argc, argv, argk, kw_pars, NULL, 1, &kw);
+
+  if (kw.all)
+    lookback = GD_LOOKBACK_ALL;
+  else if (argc > 1)
+    lookback = IDL_LongScalar(argv[1]);
+
+  DIRFILE* D = gdidl_get_dirfile(IDL_LongScalar(argv[0]));
+
+  gd_mplex_lookback(D, lookback);
+
+  GDIDL_SET_ERROR(D);
+
+  IDL_KW_FREE;
+
+  dreturnvoid();
+}
+
+/* @@DLM: F gdidl_get_linterp_tablename GD_LINTERP_TABLENAME 2 2 KEYWORDS */
+IDL_VPTR gdidl_get_linterp_tablename(int argc, IDL_VPTR argv[], char *argk)
+{
+  dtraceidl();
+
+  GDIDL_KW_ONLY_ERROR;
+
+  DIRFILE* D = gdidl_get_dirfile(IDL_LongScalar(argv[0]));
+  const char *field_code = IDL_VarGetString(argv[1]);
+
+  char *name = gd_linterp_tablename(D, field_code);
+
+  GDIDL_SET_ERROR(D);
+
+  IDL_KW_FREE;
+
+  IDL_VPTR r = IDL_StrToSTRING(name);
+  free(name);
+  dreturn("%p", r);
+  return r;
+}
 
 
 /**** Module initialisation ****/
@@ -4686,7 +5844,7 @@ extern int gdidl_n_procs;
 extern IDL_SYSFUN_DEF2 gdidl_funcs[];
 extern int gdidl_n_funcs;
 
-/* These are defined in the automatically gnerated constants.c */
+/* These are defined in the automatically generated constants.c */
 extern IDL_STRUCT_TAG_DEF gdidl_constants[];
 /* @@DLM: F gdidl_generate_constants GETDATA_CONSTANTS 0 0 */
 extern IDL_VPTR gdidl_generate_constants(int argc, IDL_VPTR argv[], char *argk);
@@ -4707,6 +5865,7 @@ static IDL_STRUCT_TAG_DEF gdidl_entry[] = {
   { "CB",         lincom_dims, (void*)IDL_TYP_DCOMPLEX }, /* LINCOM */
   { "BITNUM",     0, (void*)IDL_TYP_INT }, /* (S)BIT */
   { "COMP_SCAL",  0, (void*)IDL_TYP_INT }, /* LINCOM / POLYNOM */
+  { "COUNT_VAL",  0, (void*)IDL_TYP_INT }, /* MPLEX */
   { "DATA_TYPE",  0, (void*)IDL_TYP_INT }, /* RAW / CONST / CARRAY */
   { "DIVIDEND",   0, (void*)IDL_TYP_DOUBLE }, /* RECIP */
   { "CDIVIDEND",  0, (void*)IDL_TYP_DCOMPLEX }, /* RECIP */
@@ -4714,12 +5873,17 @@ static IDL_STRUCT_TAG_DEF gdidl_entry[] = {
   { "CM",         lincom_dims, (void*)IDL_TYP_DCOMPLEX }, /* LINCOM */
   { "N_FIELDS",   0, (void*)IDL_TYP_INT },  /* LINCOM */
   { "NUMBITS",    0, (void*)IDL_TYP_INT }, /* (S)BIT */
+  { "PERIOD",     0, (void*)IDL_TYP_INT }, /* MPLEX */
   { "POLY_ORD",   0, (void*)IDL_TYP_INT }, /* POLYNOM */
   { "SCALAR",     polynom_dims, (void*)IDL_TYP_STRING },
   { "SCALAR_IND", polynom_dims, (void*)IDL_TYP_INT },
   { "SHIFT",      0, (void*)IDL_TYP_LONG }, /* PHASE */
   { "SPF",        0, (void*)IDL_TYP_UINT }, /* RAW */
   { "TABLE",      0, (void*)IDL_TYP_STRING }, /* LINTERP */
+  { "UTHRESHOLD", 0, (void*)IDL_TYP_ULONG }, /* WINDOW */
+  { "ITHRESHOLD", 0, (void*)IDL_TYP_LONG }, /* WINDOW */
+  { "RTHRESHOLD", 0, (void*)IDL_TYP_DOUBLE }, /* WINDOW */
+  { "WINDOP",     0, (void*)IDL_TYP_INT }, /* WINDOW */
   { NULL }
 };
 
diff --git a/bindings/idl/makedlm.sh.in b/bindings/idl/makedlm.sh.in
index 02062fb..3e75fc1 100644
--- a/bindings/idl/makedlm.sh.in
+++ b/bindings/idl/makedlm.sh.in
@@ -21,11 +21,17 @@
 # 
 # @configure_input@
 
-sed=@SED@
-grep=@GREP@
+GREP=@GREP@
+DATE=@DATE@
 opt=$1
 in=$2
 
+if test "x$DATE" == "xnot found"; then
+  BUILD_DATE="unspecified"
+else
+  BUILD_DATE=`date`
+fi
+
 if test "$opt" = "-c"; then
 cat <<EOF
 /* This code is automatically generated.  Changes made here will be lost. */
@@ -38,13 +44,13 @@ cat <<EOF
 MODULE GETDATA
 DESCRIPTION IDL GetData bindings
 VERSION @VERSION@
-BUILD_DATE @BUILD_DATE@
+BUILD_DATE $BUILD_DATE
 SOURCE The GetData Project <@PACKAGE_BUGREPORT@>
 
 STRUCTURE GD_ENTRY
 EOF
 fi
-grep @@DLM $in | sort -k 5 | {
+$GREP @@DLM $in | sort -k 5 | {
 nfunc=0
 nproc=0
 while read sc magic type func idl min max key extra; do if test "$opt" = "-c"; then
diff --git a/bindings/idl/test/Makefile.in b/bindings/idl/test/Makefile.in
index 67906fe..927de5e 100644
--- a/bindings/idl/test/Makefile.in
+++ b/bindings/idl/test/Makefile.in
@@ -1,9 +1,9 @@
-# Makefile.in generated by automake 1.11.1 from Makefile.am.
+# Makefile.in generated by automake 1.11.5 from Makefile.am.
 # @configure_input@
 
 # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005, 2006, 2007, 2008, 2009  Free Software Foundation,
-# Inc.
+# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software
+# Foundation, Inc.
 # This Makefile.in is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
@@ -15,6 +15,23 @@
 
 @SET_MAKE@
 VPATH = @srcdir@
+am__make_dryrun = \
+  { \
+    am__dry=no; \
+    case $$MAKEFLAGS in \
+      *\\[\ \	]*) \
+        echo 'am--echo: ; @echo "AM"  OK' | $(MAKE) -f - 2>/dev/null \
+          | grep '^AM OK$$' >/dev/null || am__dry=yes;; \
+      *) \
+        for am__flg in $$MAKEFLAGS; do \
+          case $$am__flg in \
+            *=*|--*) ;; \
+            *n*) am__dry=yes; break;; \
+          esac; \
+        done;; \
+    esac; \
+    test $$am__dry = yes; \
+  }
 pkgdatadir = $(datadir)/@PACKAGE@
 pkgincludedir = $(includedir)/@PACKAGE@
 pkglibdir = $(libdir)/@PACKAGE@
@@ -38,20 +55,27 @@ DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
 am__aclocal_m4_deps = $(top_srcdir)/m4/ax_compare_version.m4 \
 	$(top_srcdir)/m4/compiler.m4 $(top_srcdir)/m4/encoding.m4 \
-	$(top_srcdir)/m4/idl.m4 $(top_srcdir)/m4/libtool.m4 \
-	$(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \
-	$(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \
-	$(top_srcdir)/m4/python.m4 $(top_srcdir)/m4/win32.m4 \
-	$(top_srcdir)/m4/version.m4 $(top_srcdir)/configure.ac
+	$(top_srcdir)/m4/floatordering.m4 $(top_srcdir)/m4/idl.m4 \
+	$(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \
+	$(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \
+	$(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/m4/matlab.m4 \
+	$(top_srcdir)/m4/perl.m4 $(top_srcdir)/m4/python.m4 \
+	$(top_srcdir)/m4/win32.m4 $(top_srcdir)/m4/version.m4 \
+	$(top_srcdir)/configure.ac
 am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
 	$(ACLOCAL_M4)
 mkinstalldirs = $(install_sh) -d
-CONFIG_HEADER = $(top_builddir)/src/config.h \
+CONFIG_HEADER = $(top_builddir)/src/gd_config.h \
 	$(top_builddir)/src/getdata.h
 CONFIG_CLEAN_FILES =
 CONFIG_CLEAN_VPATH_FILES =
 SOURCES =
 DIST_SOURCES =
+am__can_run_installinfo = \
+  case $$AM_UPDATE_INFO_DIR in \
+    n|no|NO) false;; \
+    *) (install-info --version) >/dev/null 2>&1;; \
+  esac
 am__tty_colors = \
 red=; grn=; lgn=; blu=; std=
 DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
@@ -63,10 +87,13 @@ AUTOHEADER = @AUTOHEADER@
 AUTOMAKE = @AUTOMAKE@
 AWK = @AWK@
 BUILDCC = @BUILDCC@
-BUILD_DATE = @BUILD_DATE@
 BZIP2_CPPFLAGS = @BZIP2_CPPFLAGS@
 BZIP2_LDFLAGS = @BZIP2_LDFLAGS@
+BZIP2_LIBS = @BZIP2_LIBS@
 CC = @CC@
+CCAS = @CCAS@
+CCASDEPMODE = @CCASDEPMODE@
+CCASFLAGS = @CCASFLAGS@
 CCDEPMODE = @CCDEPMODE@
 CFLAGS = @CFLAGS@
 CPP = @CPP@
@@ -82,6 +109,7 @@ DEFINE_GD_NO_C99_API = @DEFINE_GD_NO_C99_API@
 DEFINE_gd_int16_t = @DEFINE_gd_int16_t@
 DEFINE_gd_int64_t = @DEFINE_gd_int64_t@
 DEFINE_gd_uint16_t = @DEFINE_gd_uint16_t@
+DEFINE_gd_uint64_t = @DEFINE_gd_uint64_t@
 DEFS = @DEFS@
 DEPDIR = @DEPDIR@
 DIFF = @DIFF@
@@ -102,13 +130,21 @@ FFLAGS = @FFLAGS@
 FGETDATA_VERSION = @FGETDATA_VERSION@
 FGREP = @FGREP@
 FLIBS = @FLIBS@
+GD_DIRSEP = @GD_DIRSEP@
+GD_FDIRSEP = @GD_FDIRSEP@
 GETDATAXX_VERSION = @GETDATAXX_VERSION@
+GETDATA_DEBUG = @GETDATA_DEBUG@
 GETDATA_IFACE_AGE = @GETDATA_IFACE_AGE@
 GETDATA_IFACE_VERSION = @GETDATA_IFACE_VERSION@
 GETDATA_IMPL_REVISION = @GETDATA_IMPL_REVISION@
+GETDATA_MAJOR = @GETDATA_MAJOR@
+GETDATA_MINOR = @GETDATA_MINOR@
+GETDATA_REVISION = @GETDATA_REVISION@
+GETDATA_VERSION_SUFFIX = @GETDATA_VERSION_SUFFIX@
 GREP = @GREP@
 GZIP_CPPFLAGS = @GZIP_CPPFLAGS@
 GZIP_LDFLAGS = @GZIP_LDFLAGS@
+GZIP_LIBS = @GZIP_LIBS@
 IDL = @IDL@
 IDL_CFLAGS = @IDL_CFLAGS@
 IDL_LIBS = @IDL_LIBS@
@@ -131,8 +167,13 @@ LTDLINCL = @LTDLINCL@
 LTLIBOBJS = @LTLIBOBJS@
 LZMA_CPPFLAGS = @LZMA_CPPFLAGS@
 LZMA_LDFLAGS = @LZMA_LDFLAGS@
+LZMA_LIBS = @LZMA_LIBS@
 MAKEINFO = @MAKEINFO@
 MANIFEST_TOOL = @MANIFEST_TOOL@
+MATLAB = @MATLAB@
+MATLABGETDATA_VERSION = @MATLABGETDATA_VERSION@
+MATLAB_CPPFLAGS = @MATLAB_CPPFLAGS@
+MEX = @MEX@
 MKDIR_P = @MKDIR_P@
 NM = @NM@
 NMEDIT = @NMEDIT@
@@ -149,6 +190,9 @@ PACKAGE_TARNAME = @PACKAGE_TARNAME@
 PACKAGE_URL = @PACKAGE_URL@
 PACKAGE_VERSION = @PACKAGE_VERSION@
 PATH_SEPARATOR = @PATH_SEPARATOR@
+PERL = @PERL@
+PERL_MAN3EXT = @PERL_MAN3EXT@
+PRINTF = @PRINTF@
 PRIVATE_LIBS = @PRIVATE_LIBS@
 PYTHON = @PYTHON@
 PYTHON_CPPFLAGS = @PYTHON_CPPFLAGS@
@@ -160,8 +204,12 @@ SET_MAKE = @SET_MAKE@
 SHELL = @SHELL@
 SLIM_CPPFLAGS = @SLIM_CPPFLAGS@
 SLIM_LDFLAGS = @SLIM_LDFLAGS@
+SLIM_LIBS = @SLIM_LIBS@
 STRIP = @STRIP@
 VERSION = @VERSION@
+ZZIP_CPPFLAGS = @ZZIP_CPPFLAGS@
+ZZIP_LDFLAGS = @ZZIP_LDFLAGS@
+ZZIP_LIBS = @ZZIP_LIBS@
 abs_builddir = @abs_builddir@
 abs_srcdir = @abs_srcdir@
 abs_top_builddir = @abs_top_builddir@
@@ -205,6 +253,8 @@ libexecdir = @libexecdir@
 localedir = @localedir@
 localstatedir = @localstatedir@
 mandir = @mandir@
+matlabbasedir = @matlabbasedir@
+mexext = @mexext@
 mkdir_p = @mkdir_p@
 moduledir = @moduledir@
 oldincludedir = @oldincludedir@
@@ -214,8 +264,12 @@ path_gunzip = @path_gunzip@
 path_gzip = @path_gzip@
 path_slim = @path_slim@
 path_unslim = @path_unslim@
+path_unzip = @path_unzip@
 path_xz = @path_xz@
+path_zip = @path_zip@
 pdfdir = @pdfdir@
+perldir = @perldir@
+perlmandir = @perlmandir@
 prefix = @prefix@
 program_transform_name = @program_transform_name@
 psdir = @psdir@
@@ -381,14 +435,15 @@ check-TESTS: $(TESTS)
 	  fi; \
 	  dashes=`echo "$$dashes" | sed s/./=/g`; \
 	  if test "$$failed" -eq 0; then \
-	    echo "$$grn$$dashes"; \
+	    col="$$grn"; \
 	  else \
-	    echo "$$red$$dashes"; \
+	    col="$$red"; \
 	  fi; \
-	  echo "$$banner"; \
-	  test -z "$$skipped" || echo "$$skipped"; \
-	  test -z "$$report" || echo "$$report"; \
-	  echo "$$dashes$$std"; \
+	  echo "$${col}$$dashes$${std}"; \
+	  echo "$${col}$$banner$${std}"; \
+	  test -z "$$skipped" || echo "$${col}$$skipped$${std}"; \
+	  test -z "$$report" || echo "$${col}$$report$${std}"; \
+	  echo "$${col}$$dashes$${std}"; \
 	  test "$$failed" -eq 0; \
 	else :; fi
 
@@ -437,10 +492,15 @@ install-am: all-am
 
 installcheck: installcheck-am
 install-strip:
-	$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
-	  install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
-	  `test -z '$(STRIP)' || \
-	    echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+	if test -z '$(STRIP)'; then \
+	  $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+	    install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+	      install; \
+	else \
+	  $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+	    install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+	    "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
+	fi
 mostlyclean-generic:
 
 clean-generic:
diff --git a/bindings/idl/test/big_test.pro b/bindings/idl/test/big_test.pro
index de4484d..2937e29 100644
--- a/bindings/idl/test/big_test.pro
+++ b/bindings/idl/test/big_test.pro
@@ -1,4 +1,6 @@
-; Copyright (C) 2009-2010 D. V. Wiebe
+; vim: ft=idlang
+;
+; Copyright (C) 2009-2012 D. V. Wiebe
 ;
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;
@@ -32,8 +34,8 @@ format  = "test_dirfile/format"
 form2   = "test_dirfile/form2"
 data    = "test_dirfile/data"
 
-flen    = 7
-nfields = 14
+flen    = 11
+nfields = 17
 nume    = 0
 
 spawn, "rm -rf " + filedir
@@ -41,8 +43,9 @@ file_mkdir, filedir
 
 datadata = bindgen(80) + 1
 
-fields = [ 'INDEX', 'bit', 'carray', 'const', 'data', 'div', 'lincom', $
-  'linterp', 'mult', 'phase', 'polynom', 'recip', 'sbit', 'string' ]
+fields = [ 'INDEX', 'alias', 'bit', 'carray', 'const', 'data', 'div', 'lincom',$
+  'linterp', 'mplex', 'mult', 'phase', 'polynom', 'recip', 'sbit', 'string',$
+  'window' ]
 
 ; Write the test dirfile
 openw,1,format
@@ -54,14 +57,17 @@ printf,1,'/META data mconst CONST COMPLEX128 3.3;4.4'
 printf,1,'/META data mlut LINTERP DATA ./lut'
 printf,1,'const CONST FLOAT64 5.5'
 printf,1,'carray CARRAY FLOAT64 1.1 2.2 3.3 4.4 5.5 6.6'
-printf,1,'linterp LINTERP data /look/up/file'
+printf,1,'linterp LINTERP data ./lut'
 printf,1,'polynom POLYNOM data 1.1 2.2 2.2 3.3;4.4 const const'
 printf,1,'bit BIT data 3 4'
 printf,1,'sbit SBIT data 5 6'
+printf,1,'mplex MPLEX data sbit 1 10'
 printf,1,'mult MULTIPLY data sbit'
 printf,1,'div DIVIDE mult bit'
 printf,1,'recip RECIP div 6.5;4.3'
 printf,1,'phase PHASE data 11'
+printf,1,'window WINDOW linterp mult LT 4.1'
+printf,1,'/ALIAS alias data'
 printf,1,'string STRING "Zaphod Beeblebrox"'
 close,1
 
@@ -208,7 +214,7 @@ nume += check_simple2(21, 1, n.field_type, !GD.LINTERP_ENTRY)
 nume += check_simple2(21, 2, n.field, "linterp")
 nume += check_simple2(21, 3, n.fragment, 0)
 nume += check_simple2(21, 4, n.in_fields, [ "data" ])
-nume += check_simple2(21, 5, n.table, "/look/up/file")
+nume += check_simple2(21, 5, n.table, "./lut")
 
 ;  22: gd_entry (bit)
 n = gd_entry(d, "bit")
@@ -404,7 +410,7 @@ nume += check_simple2(125, 5, n.shift, -88)
 ;  39: gd_fragmentname
 n = gd_fragmentname(d, 0)
 nume += check_ok(39, d)
-nume += check_simple(39, n, "test_dirfile/format")
+nume += check_eostring(39, n, "test_dirfile/format")
 
 ;  40: gd_nfragments
 n = gd_nfragments(d)
@@ -432,14 +438,14 @@ nume += check_simple(43, n, [ "lincom", "new2"  ])
 ;  44: gd_nvectors check
 n = gd_nvectors(d)
 nume += check_ok(44, d)
-nume += check_simple(44, n, 20)
+nume += check_simple(44, n, 23)
 
 ;  45: gd_vector_list check
 n = gd_vector_list(d)
 nume += check_ok(45, d)
-nume += check_simple(45, n, [ 'INDEX', 'bit', 'data', 'div', 'lincom', $
-  'linterp', 'mult', 'new1', 'new10', 'new13', 'new2', 'new4', 'new6', 'new7', $
-  'new8', 'new9', 'phase', 'polynom', 'recip', 'sbit' ])
+nume += check_simple(45, n, [ 'INDEX', 'alias', 'bit', 'data', 'div', 'lincom',$
+  'linterp', 'mplex', 'mult', 'new1', 'new10', 'new13', 'new2', 'new4', 'new6',$
+  'new7', 'new8', 'new9', 'phase', 'polynom', 'recip', 'sbit', 'window' ])
 
 ;  46: gd_madd_lincom
 gd_add_lincom, d, "mnew2", "in1", 9.9D, 8.8D, "in2", 7.7D, 6.6D, $
@@ -798,7 +804,7 @@ nume += check_simple(79, n, (!GD.LITTLE_ENDIAN + !GD.NOT_ARM_ENDIAN))
 ;  80: dirfilename
 n = gd_dirfilename(d)
 nume += check_ok(80, d)
-nume += check_simple(80, n, "test_dirfile")
+nume += check_eostring(80, n, "test_dirfile")
 
 ;  81: gd_parent_fragment
 n = gd_parent_fragment(d, fragment=1)
@@ -817,7 +823,7 @@ nume += check_simple(83, n, !GD.PROTECT_DATA)
 ;  84: gd_raw_filename
 n = gd_raw_filename(d, 'data')
 nume += check_ok(84, d)
-nume += check_simple(84, n, "test_dirfile/data")
+nume += check_eostring(84, n, "test_dirfile/data")
 
 ;  85: gd_reference
 gd_reference, d, "new1"
@@ -980,7 +986,7 @@ nume += check_simple2(148, 4, n.in_fields, [ "in2" ])
 nume += check_simple2(148, 5, n.comp_scal, 1)
 nume += check_simple2(148, 6, n.cdividend, DCOMPLEX(33.3, 44.4))
 
-;  152: gd_alter_multiply
+;  152: gd_alter_divide
 gd_alter_divide, d, "new14", in_field1="in6"
 nume += check_ok2(152, 1, d)
 
@@ -991,7 +997,7 @@ nume += check_simple2(152, 2, n.field, "new14")
 nume += check_simple2(152, 3, n.fragment, 0)
 nume += check_simple2(152, 4, n.in_fields, [ "in6", "in3" ])
 
-;  153: gd_alter_multiply
+;  153: gd_alter_recip
 gd_alter_recip, d, "new16", dividend=1.01
 nume += check_ok2(153, 1, d)
 
@@ -1018,9 +1024,9 @@ gd_close, m
 ;  157: gd_dirfile_standards
 n = gd_dirfile_standards(d, /CURRENT)
 nume += check_ok2(157, 1, d)
-nume += check_simple(157, n, 8)
+nume += check_simple(157, n, 9)
 n = gd_dirfile_standards(d, 0)
-nume += check_error2(157, 2, d, !GD.E_BAD_VERSION)
+nume += check_error2(157, 2, d, !GD.E_ARGUMENT)
 
 ;  158: gd_get_carray
 n = gd_get_carray(d, "carray", type=!GD.FLOAT32)
@@ -1108,6 +1114,279 @@ nume += check_simple2(181, 3, n.fragment, 0)
 nume += check_simple2(181, 4, n.data_type, !GD.FLOAT32)
 nume += check_simple2(181, 5, n.array_len, 3)
 
+;  183: gd_constants
+n = gd_constants(d, type=!GD.FLOAT32)
+nume += check_ok(183, d)
+
+;  191: gd_mconstants
+n = gd_constants(d, parent="data", type=!GD.FLOAT32)
+nume += check_ok(191, d)
+nume += check_simple(191, n, [ 3.3, 0. ])
+
+; 199: gd_strings
+n = gd_strings(d)
+nume += check_ok(199, d)
+nume += check_simple(199, n, [ "Lorem ipsum", "a string", "Arthur Dent" ])
+
+; 200: gd_strings
+n = gd_strings(d, parent="data")
+nume += check_ok(200, d)
+nume += check_simple(200, n, [ "This is a string constant.", "another string" ])
+
+; 203: gd_seek
+n = gd_seek(d, "data", frame_num=35)
+nume += check_ok2(203, 0, d)
+m = gd_getdata(d, "data", type=!GD.INT16, num_frames=1)
+nume += check_ok2(203, 1, d)
+nume += check_simple2(203, 0, n, 280)
+nume += check_simple2(203, 1, m, INDGEN(8) + 17)
+
+; 204: gd_tell
+n = gd_tell(d, "data")
+nume += check_ok(204, d)
+nume += check_simple(204, n, 288)
+
+; 205: gd_hide check
+gd_hide, d, 'data'
+nume += check_ok(205, d)
+
+; 206: gd_hidden check
+n = gd_hidden(d, 'data')
+nume += check_ok2(206, 1, d)
+nume += check_simple2(206, 1, n, 1)
+
+n = gd_hidden(d, 'lincom')
+nume += check_ok2(206, 2, d)
+nume += check_simple2(206, 2, n, 0)
+
+; 207: gd_unhide check
+gd_unhide, d, 'data'
+nume += check_ok2(206, 1, d)
+n = gd_hidden(d, 'data')
+nume += check_ok2(206, 2, d)
+nume += check_simple(206, n, 0)
+
+; 208: gd_sync check
+gd_flush, d, field_code='data', /noclose
+nume += check_ok(208, d)
+
+; 209: gd_flush check
+gd_flush, d, field_code='data'
+nume += check_ok(209, d)
+
+; 210: gd_metaflush check
+gd_metaflush, d
+nume += check_ok(210, d)
+
+; 211: gd_entry (WINDOW) check
+n = gd_entry(d, 'window')
+nume += check_ok(211, d)
+nume += check_simple2(211, 1, n.field_type, !GD.WINDOW_ENTRY)
+nume += check_simple2(211, 2, n.fragment, 0)
+nume += check_simple2(211, 3, n.windop, !GD.WINDOP_LT)
+nume += check_simple2(211, 4, n.in_fields, [ 'linterp', 'mult' ])
+nume += check_simple2(211, 6, n.rthreshold, 4.1D0)
+
+; 212: gd_add_window check
+gd_add_window, d, 'new18', 'in1', 'in2', /NE, 32, fragment=0
+nume += check_ok2(212, 1, d)
+
+n = gd_entry(d, 'new18')
+nume += check_ok2(212, 2, d)
+nume += check_simple2(212, 1, n.field_type, !GD.WINDOW_ENTRY)
+nume += check_simple2(212, 2, n.fragment, 0)
+nume += check_simple2(212, 3, n.windop, !GD.WINDOP_NE)
+nume += check_simple2(212, 4, n.in_fields, [ 'in1', 'in2' ])
+nume += check_simple2(212, 6, n.ithreshold, 32)
+
+; 214: gd_madd_window check
+gd_add_window, d, parent='data', 'mnew18', 'in2', 'in3', /SET, 128
+nume += check_ok2(214, 1, d)
+
+n = gd_entry(d, 'data/mnew18')
+nume += check_ok2(214, 2, d)
+nume += check_simple2(214, 1, n.field_type, !GD.WINDOW_ENTRY)
+nume += check_simple2(214, 2, n.fragment, 0)
+nume += check_simple2(214, 3, n.windop, !GD.WINDOP_SET)
+nume += check_simple2(214, 4, n.in_fields, [ 'in2', 'in3' ])
+nume += check_simple2(214, 6, n.uthreshold, 128)
+
+; 217: gd_alter_window check
+gd_alter_window, d, 'new18', in_field='in3', check_field='in4', /GE, $
+  threshold=32e3
+nume += check_ok2(217, 1, d)
+
+n = gd_entry(d, 'new18')
+nume += check_ok2(217, 2, d)
+nume += check_simple2(217, 1, n.field_type, !GD.WINDOW_ENTRY)
+nume += check_simple2(217, 2, n.fragment, 0)
+nume += check_simple2(217, 3, n.windop, !GD.WINDOP_GE)
+nume += check_simple2(217, 4, n.in_fields, [ 'in3', 'in4' ])
+nume += check_simple2(217, 6, n.rthreshold, 32d3)
+
+; 218: gd_alias_target check
+str = gd_alias_target(d, 'alias')
+nume += check_ok(218, d)
+nume += check_simple(218, str, 'data')
+
+; 219: gd_add_alias check
+gd_add_alias, d, 'new20', 'data', fragment=0
+nume += check_ok2(219, 1, d)
+
+str = gd_alias_target(d, 'new20')
+nume += check_ok2(219, 2, d)
+nume += check_simple(219, str, 'data')
+
+; 220: gd_madd_alias check
+gd_add_alias, d, parent='data', 'mnew20', 'data'
+nume += check_ok2(220, 1, d)
+
+str = gd_alias_target(d, 'data/mnew20')
+nume += check_ok2(220, 2, d)
+nume += check_simple(220, str, 'data')
+
+; 221: gd_naliases check
+n = gd_naliases(d, 'data')
+nume += check_ok(221, d)
+nume += check_simple(221, n, 4)
+
+; 222: gd_alias check
+n = gd_aliases(d, 'data')
+nume += check_ok(222, d)
+nume += check_simple(222, n, [ 'data', 'alias', 'data/mnew20', 'new20' ])
+
+; 223: gd_include_affix check
+gd_include, d, 'format1', prefix='A', suffix='Z', /CREAT, /EXCL
+nume += check_ok(223, d)
+
+; 224: GDMOVA check
+gd_move, d, 'new20', 1, /ALIAS
+nume += check_ok2(224, 1, d)
+
+n = gd_fragment_index(d, 'Anew20Z')
+nume += check_ok2(224, 2, d)
+nume += check_simple(224, n, 1)
+
+; 225: gd_delete_alias check
+gd_delete, d, 'Anew20Z', /ALIAS
+nume += check_ok2(225, 1, d)
+
+n = gd_fragment_index(d, 'Anew20Z')
+nume += check_error2(225, 2, d, !GD.E_BAD_CODE)
+nume += check_simple(225, n, -1)
+
+; 226: gd_fragment_affixes check
+n = gd_fragment_affixes(d, fragment=1)
+nume += check_ok(226, d)
+nume += check_simple(226, n, [ "A", "Z" ])
+
+; 227: gd_alter_affixes check
+gd_alter_affixes, d, fragment=1, prefix='B', suffix=''
+nume += check_ok2(227, 1, d)
+
+n = gd_fragment_affixes(d, fragment=1)
+nume += check_ok2(227, 2, d)
+nume += check_simple(227, n, [ "B", "" ])
+
+; 228: gd_entry (MPLEX) check
+n = gd_entry(d, 'mplex')
+nume += check_ok(228, d)
+nume += check_simple2(228, 1, n.field_type, !GD.MPLEX_ENTRY)
+nume += check_simple2(228, 2, n.fragment, 0)
+nume += check_simple2(228, 3, n.count_val, 1)
+nume += check_simple2(228, 4, n.in_fields, [ 'data', 'sbit' ])
+nume += check_simple2(228, 5, n.period, 10)
+
+; 229: gd_add_mplex check
+gd_add_mplex, d, 'new21', 'in1', 'in2', 5, max=6
+nume += check_ok2(229, 1, d)
+
+n = gd_entry(d, 'new21')
+nume += check_ok2(229, 2, d)
+nume += check_simple2(229, 1, n.field_type, !GD.MPLEX_ENTRY)
+nume += check_simple2(229, 2, n.fragment, 0)
+nume += check_simple2(229, 3, n.count_val, 5)
+nume += check_simple2(229, 4, n.in_fields, [ 'in1', 'in2' ])
+nume += check_simple2(229, 5, n.period, 6)
+
+; 230: gd_madd_mplex check
+gd_add_mplex, d, parent='data', 'mnew21', 'in2', 'in3', 0, max=12
+nume += check_ok2(230, 1, d)
+
+n = gd_entry(d, 'data/mnew21')
+nume += check_ok2(230, 2, d)
+nume += check_simple2(230, 1, n.field_type, !GD.MPLEX_ENTRY)
+nume += check_simple2(230, 2, n.fragment, 0)
+nume += check_simple2(230, 3, n.count_val, 0)
+nume += check_simple2(230, 4, n.in_fields, [ 'in2', 'in3' ])
+nume += check_simple2(230, 5, n.period, 12)
+
+; 231: gd_alter_mplex check
+gd_alter_mplex, d, 'new21', in_field='in3', count_field='in4', count_val=2, $
+  period=7
+nume += check_ok2(231, 1, d)
+
+n = gd_entry(d, 'new21')
+nume += check_ok2(231, 2, d)
+nume += check_simple2(231, 1, n.field_type, !GD.MPLEX_ENTRY)
+nume += check_simple2(231, 2, n.fragment, 0)
+nume += check_simple2(231, 3, n.count_val, 2)
+nume += check_simple2(231, 4, n.in_fields, [ 'in3', 'in4' ])
+nume += check_simple2(231, 5, n.period, 7)
+
+; 232: gd_strtok check
+str = gd_strtok(d, STRING='"test1 test2" test3\ test4')
+nume += check_ok2(232, 1 ,d)
+nume += check_simple2(232, 2, str, "test1 test2")
+
+str = gd_strtok(d)
+nume += check_ok2(232, 3 ,d)
+nume += check_simple2(232, 4, str, "test3 test4")
+
+; 233: gd_raw_close check
+gd_flush, d, field_code='data', /nosync
+nume += check_ok(233, d)
+
+; 234: gd_desync check
+n = gd_desync(d)
+nume += check_ok(234, d)
+nume += check_simple(234, n, 0)
+
+; 235: gd_flags check
+n = gd_flags(d, /PRETTY_PRINT)
+nume += check_ok(235, d)
+nume += check_simple(235, n, !GD.PRETTY_PRINT)
+
+; 236: gd_verbose_prefix
+gd_verbose_prefix, d, prefix="big_test"
+nume += check_ok(236, d)
+
+; 237: gd_nentries check
+n = gd_nentries(d, parent="data", /SCALARS, /HIDDEN, /NOALIAS)
+nume += check_ok2(237, 1, d)
+nume += check_simple2(237, 1, n, 5)
+n = gd_nentries(d, /VECTORS, /HIDDEN, /NOALIAS)
+nume += check_ok2(237, 2, d)
+nume += check_simple2(237, 2, n, 24)
+ 
+; 239: gd_entry_list check
+n = gd_entry_list(d, /VECTORS, /HIDDEN, /NOALIAS)
+nume += check_ok(239, d)
+nume += check_simple(239, n, ["INDEX", "bit", "data", "div", "lincom", $
+  "linterp", "mplex", "mult", "new1", "new13", "new14", "new16", "new18", $
+  "new2", "new21", "new4", "new6", "new7", "new8", "phase", "polynom", $
+  "recip", "sbit", "window"])
+
+; 240: gd_mplex_lookback check
+gd_mplex_lookback, d, /ALL
+nume += check_ok(240, d)
+
+; 241: gd_linterp_tablename
+n = gd_linterp_tablename(d, 'linterp')
+nume += check_ok(241, d)
+nume += check_eostring(241, n, "test_dirfile/lut")
+
+
 
 
 
diff --git a/bindings/idl/test/getdata_idl_test_routines.pro b/bindings/idl/test/getdata_idl_test_routines.pro
index 34928d7..ba7a844 100644
--- a/bindings/idl/test/getdata_idl_test_routines.pro
+++ b/bindings/idl/test/getdata_idl_test_routines.pro
@@ -10,7 +10,7 @@ end
 
 function check_float, t, v, g
   if (abs(v - g) gt 1e-6) then begin
-    print,"n[", t, "]=", v
+    print,"n[", t, "]=", v, ", expected ", g
     return,1
   endif
 
@@ -19,7 +19,7 @@ end
 
 function check_simple2, t, m, v, g
   if (total(v ne g)) then begin
-    print,"n[", t, ",", m, "]=", v
+    print,"n[", t, ",", m, "]=", v, ", expected ", g
     return,1
   endif
 
@@ -28,7 +28,7 @@ end
 
 function check_simple, t, v, g
   if (total(v ne g)) then begin
-    print,"n[", t, "]=", v
+    print,"n[", t, "]=", v, ", expected ", g
     return,1
   endif
 
@@ -38,7 +38,7 @@ end
 function check_error, t, d, ce
   e = gd_error(d)
   if (e ne ce) then begin
-    print,"e[", t, "]=", e
+    print,"e[", t, "]=", e, ", expected ", ce
     return,1
   endif
 
@@ -52,7 +52,7 @@ end
 function check_error2, t, m, d, ce
   e = gd_error(d)
   if (e ne ce) then begin
-    print,"e[", t, ",", m, "]=", e
+    print,"e[", t, ",", m, "]=", e, ", expected ", ce
     return,1
   endif
 
@@ -62,3 +62,9 @@ end
 function check_ok2, t, m, d
   return, check_error2(t,m,d,!GD.E_OK)
 end
+
+function check_eostring, t, v, g
+  f = strpos(v, g, /reverse_search)
+  if (f EQ -1) THEN f = 0
+  return, check_simple(t, strmid(v, f), g)
+end
diff --git a/bindings/make_parameters.c b/bindings/make_parameters.c
index d0fa3f8..4ae2316 100644
--- a/bindings/make_parameters.c
+++ b/bindings/make_parameters.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2010 D. V. Wiebe
+/* Copyright (C) 2008-2013 D. V. Wiebe
  *
  ***************************************************************************
  *
@@ -19,16 +19,35 @@
  * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
 #ifdef HAVE_CONFIG_H
-#include <config.h>
+#include "gd_config.h"
 #endif
 
 #include <stdlib.h>
 #include <stdio.h>
 #include <unistd.h>
 
-#define NO_GETDATA_LEGACY_API
+#define GD_NO_LEGACY_API
 #include "getdata.h"
 
+/* The type parameter:
+ *   0: error codes
+ *   1: open flags not in IDL
+ *   2: open flags represented as LONG in IDL
+ *   3: entry types
+ *   4: data types
+ *   5: delete/rename flags (not in IDL)
+ *   6: protection levels
+ *   7: callback actions (not in IDL)
+ *   8: GD_E_FORMAT suberrors (not in IDL)
+ *   9: special version codes
+ *  10: gd_seek whence values
+ *  11: gd_seek flags (not in IDL)
+ *  12: window operations
+ *  13: desynced flags (not in IDL)
+ *  14: entry_list constants (not in IDL)
+ *  98: miscellaneous constants not in IDL
+ *  99: miscellaneous constants
+ */
 #define CONSTANT(s,f,t) { "GD_" #s, #s, f, GD_ ## s, t }
 static struct {
   const char* lname; /* Long name */
@@ -46,7 +65,6 @@ static struct {
   CONSTANT(E_BAD_TYPE,       "GD_EBT", 0),
   CONSTANT(E_RAW_IO,         "GD_ERW", 0),
   CONSTANT(E_OPEN_FRAGMENT,  "GD_EOF", 0),
-  CONSTANT(E_OPEN_INCLUDE,   "GD_EOI", 0),
   CONSTANT(E_INTERNAL_ERROR, "GD_EIE", 0),
   CONSTANT(E_ALLOC,          "GD_EAL", 0),
   CONSTANT(E_RANGE,          "GD_ERA", 0),
@@ -56,6 +74,7 @@ static struct {
   CONSTANT(E_BAD_FIELD_TYPE, "GD_EBF", 0),
   CONSTANT(E_ACCMODE,        "GD_EAC", 0),
   CONSTANT(E_UNSUPPORTED,    "GD_UNS", 0),
+  CONSTANT(E_UNKNOWN_ENCODING,"GD_EUE",0),
   CONSTANT(E_BAD_ENTRY,      "GD_EBE", 0),
   CONSTANT(E_DUPLICATE,      "GD_EDU", 0),
   CONSTANT(E_DIMENSION,      "GD_EDM", 0),
@@ -64,17 +83,21 @@ static struct {
   CONSTANT(E_BAD_REFERENCE,  "GD_EBR", 0),
   CONSTANT(E_PROTECTED,      "GD_EPT", 0),
   CONSTANT(E_DELETE,         "GD_EDL", 0),
-  CONSTANT(E_BAD_ENDIANNESS, "GD_EEN", 0),
+  CONSTANT(E_ARGUMENT,       "GD_EAR", 0),
   CONSTANT(E_CALLBACK,       "GD_ECB", 0),
-  CONSTANT(E_BAD_PROTECTION, "GD_EBP", 0),
+  CONSTANT(E_EXISTS,         "GD_EEX", 0),
   CONSTANT(E_UNCLEAN_DB,     "GD_UCL", 0),
   CONSTANT(E_DOMAIN,         "GD_EDO", 0),
   CONSTANT(E_BAD_REPR,       "GD_ERP", 0),
-  CONSTANT(E_BAD_VERSION,    "GD_EVR", 0),
   CONSTANT(E_FLUSH,          "GD_EFL", 0),
   CONSTANT(E_BOUNDS,         "GD_EBO", 0),
   CONSTANT(E_LINE_TOO_LONG,  "GD_ETL", 0),
 
+  CONSTANT(E_OPEN_INCLUDE,   "GD_EOI", 0), /* deprecated */
+  CONSTANT(E_BAD_ENDIANNESS, "GD_EEN", 0), /* deprecated */
+  CONSTANT(E_BAD_PROTECTION, "GD_EBP", 0), /* deprecated */
+  CONSTANT(E_BAD_VERSION,    "GD_EVR", 0), /* deprecated */
+
   CONSTANT(RDONLY,           "GD_RO",  1),
   CONSTANT(RDWR,             "GD_RW",  1),
   CONSTANT(FORCE_ENDIAN,     "GD_FE",  1),
@@ -85,21 +108,25 @@ static struct {
   CONSTANT(TRUNC,            "GD_TR",  1),
   CONSTANT(PEDANTIC,         "GD_PE",  1),
   CONSTANT(FORCE_ENCODING,   "GD_FC",  1),
-  CONSTANT(VERBOSE,          "GD_VB",  1),
+  CONSTANT(VERBOSE,          "GD_VB",  2),
   CONSTANT(IGNORE_DUPS,      "GD_ID",  1),
   CONSTANT(IGNORE_REFS,      "GD_IR",  1),
-  CONSTANT(PRETTY_PRINT,     "GD_PP",  1),
+  CONSTANT(PRETTY_PRINT,     "GD_PP",  2),
   CONSTANT(ARM_ENDIAN,       "GD_AE",  2),
   CONSTANT(NOT_ARM_ENDIAN,   "GD_NA",  2),
   CONSTANT(PERMISSIVE,       "GD_PM",  1),
-
-  CONSTANT(AUTO_ENCODED,     "GD_EA",  1),
-  CONSTANT(UNENCODED,        "GD_EN",  2),
-  CONSTANT(TEXT_ENCODED,     "GD_ET",  2),
-  CONSTANT(SLIM_ENCODED,     "GD_ES",  2),
-  CONSTANT(GZIP_ENCODED,     "GD_EG",  2),
-  CONSTANT(BZIP2_ENCODED,    "GD_EB",  2),
-  CONSTANT(LZMA_ENCODED,     "GD_EL",  2),
+  CONSTANT(TRUNCSUB,         "GD_TS",  1),
+
+  CONSTANT(AUTO_ENCODED,     "GDE_AU", 1),
+  CONSTANT(BZIP2_ENCODED,    "GDE_BZ", 2),
+  CONSTANT(GZIP_ENCODED,     "GDE_GZ", 2),
+  CONSTANT(LZMA_ENCODED,     "GDE_LZ", 2),
+  CONSTANT(SIE_ENCODED,      "GDE_SI", 2),
+  CONSTANT(SLIM_ENCODED,     "GDE_SL", 2),
+  CONSTANT(TEXT_ENCODED,     "GDE_TX", 2),
+  CONSTANT(UNENCODED,        "GDE_UN", 2),
+  CONSTANT(ZZSLIM_ENCODED,   "GDE_ZS", 2),
+  CONSTANT(ZZIP_ENCODED,     "GDE_ZZ", 2),
 
   CONSTANT(NO_ENTRY,         "GD_NOE", 3),
   CONSTANT(RAW_ENTRY,        "GD_RWE", 3),
@@ -113,6 +140,8 @@ static struct {
   CONSTANT(SBIT_ENTRY,       "GD_SBE", 3),
   CONSTANT(DIVIDE_ENTRY,     "GD_DVE", 3),
   CONSTANT(RECIP_ENTRY,      "GD_RCE", 3),
+  CONSTANT(WINDOW_ENTRY,     "GD_WDE", 3),
+  CONSTANT(MPLEX_ENTRY,      "GD_MXE", 3),
   CONSTANT(CONST_ENTRY,      "GD_COE", 3),
   CONSTANT(CARRAY_ENTRY,     "GD_CAE", 3),
   CONSTANT(STRING_ENTRY,     "GD_STE", 3),
@@ -135,6 +164,8 @@ static struct {
   CONSTANT(DEL_DATA,         "GDD_DT", 5),
   CONSTANT(DEL_DEREF,        "GDD_DR", 5),
   CONSTANT(DEL_FORCE,        "GDD_FO", 5),
+  CONSTANT(REN_DATA,         "GDR_DT", 5),
+  CONSTANT(REN_UPDB,         "GDR_UP", 5),
 
   CONSTANT(PROTECT_NONE,     "GDPR_N", 6),
   CONSTANT(PROTECT_FORMAT,   "GDPR_F", 6),
@@ -165,14 +196,46 @@ static struct {
   CONSTANT(E_FORMAT_LOCATION,"GDF_LO", 8),
   CONSTANT(E_FORMAT_PROTECT, "GDF_PR", 8),
   CONSTANT(E_FORMAT_LITERAL, "GDF_LT", 8),
+  CONSTANT(E_FORMAT_WINDOP,  "GDF_WO", 8),
+  CONSTANT(E_FORMAT_META_META,"GDF_MM", 8),
+  CONSTANT(E_FORMAT_ALIAS,   "GDF_AL", 8),
+  CONSTANT(E_FORMAT_MPLEXVAL,"GDF_MV", 8),
 
   CONSTANT(VERSION_CURRENT,  "GDSV_C", 9),
-  CONSTANT(VERSION_LATEST,   "GDSV_L", 10),
-  CONSTANT(VERSION_EARLIEST, "GDSV_E", 10),
-
-  CONSTANT(MAX_LINE_LENGTH,  "GD_MLL", 11),
-  CONSTANT(ALL_FRAGMENTS,    "GD_ALL", 11),
-  CONSTANT(DIRFILE_STANDARDS_VERSION, "GD_DSV", 11),
+  CONSTANT(VERSION_LATEST,   "GDSV_L", 9),
+  CONSTANT(VERSION_EARLIEST, "GDSV_E", 9),
+
+  CONSTANT(SEEK_SET,         "GDSK_S", 10),
+  CONSTANT(SEEK_CUR,         "GDSK_C", 10),
+  CONSTANT(SEEK_END,         "GDSK_E", 10),
+  CONSTANT(SEEK_WRITE,       "GDSK_W", 11),
+
+  CONSTANT(WINDOP_UNK,       "GDW_UN", 12),
+  CONSTANT(WINDOP_EQ,        "GDW_EQ", 12),
+  CONSTANT(WINDOP_GE,        "GDW_GE", 12),
+  CONSTANT(WINDOP_GT,        "GDW_GT", 12),
+  CONSTANT(WINDOP_LE,        "GDW_LE", 12),
+  CONSTANT(WINDOP_LT,        "GDW_LT", 12),
+  CONSTANT(WINDOP_NE,        "GDW_NE", 12),
+  CONSTANT(WINDOP_SET,       "GDW_ST", 12),
+  CONSTANT(WINDOP_CLR,       "GDW_CL", 12),
+
+  CONSTANT(DESYNC_PATHCHECK, "GDDS_P", 13),
+  CONSTANT(DESYNC_REOPEN,    "GDDS_O", 13),
+
+  CONSTANT(ALL_ENTRIES,      "GDEN_X", 14),
+  CONSTANT(VECTOR_ENTRIES,   "GDEN_V", 14),
+  CONSTANT(SCALAR_ENTRIES,   "GDEN_S", 14),
+  CONSTANT(ALIAS_ENTRIES,    "GDEN_A", 14),
+  CONSTANT(ENTRIES_HIDDEN,   "GDEN_H", 14),
+  CONSTANT(ENTRIES_NOALIAS,  "GDEN_N", 14),
+
+  CONSTANT(ALL_FRAGMENTS,    "GD_ALL", 99),
+  CONSTANT(DEFAULT_LOOKBACK, "GDLB_D", 99),
+  CONSTANT(DIRFILE_STANDARDS_VERSION, "GD_DSV", 99),
+  CONSTANT(HERE,             "GD_HER", 98),
+  CONSTANT(LOOKBACK_ALL,     "GDLB_A", 98),
+  CONSTANT(MAX_LINE_LENGTH,  "GD_MLL", 99),
   { NULL }
 };
 
@@ -261,14 +324,42 @@ void Fortran(void)
     printf("\\\n%c Special version codes\\\n", c);
 
     for (j = 0; constant_list[j].lname != NULL; ++j)
-      if (constant_list[j].type == 9 || constant_list[j].type == 10)
+      if (constant_list[j].type == 9)
+        parameter(constant_list[j].lname, constant_list[j].fname,
+            constant_list[j].value, i);
+
+    printf("\\\n%c Seek flags\\\n", c);
+
+    for (j = 0; constant_list[j].lname != NULL; ++j)
+      if (constant_list[j].type == 10 || constant_list[j].type == 11)
+        parameter(constant_list[j].lname, constant_list[j].fname,
+            constant_list[j].value, i);
+
+    printf("\\\n%c Window operations\\\n", c);
+
+    for (j = 0; constant_list[j].lname != NULL; ++j)
+      if (constant_list[j].type == 12)
+        parameter(constant_list[j].lname, constant_list[j].fname,
+            constant_list[j].value, i);
+
+    printf("\\\n%c Desync flags\\\n", c);
+
+    for (j = 0; constant_list[j].lname != NULL; ++j)
+      if (constant_list[j].type == 13)
+        parameter(constant_list[j].lname, constant_list[j].fname,
+            constant_list[j].value, i);
+
+    printf("\\\n%c Entry List codes and flags\\\n", c);
+
+    for (j = 0; constant_list[j].lname != NULL; ++j)
+      if (constant_list[j].type == 14)
         parameter(constant_list[j].lname, constant_list[j].fname,
             constant_list[j].value, i);
 
     printf("\\\n%c Miscellaneous parameters\\\n", c);
 
     for (j = 0; constant_list[j].lname != NULL; ++j)
-      if (constant_list[j].type == 11)
+      if (constant_list[j].type == 98 || constant_list[j].type == 99)
         parameter(constant_list[j].lname, constant_list[j].fname,
             constant_list[j].value, i);
 
@@ -288,8 +379,7 @@ void Python(void)
       "const struct gdpy_constant_t gdpy_constant_list[] = {\n");
   
   for (i = 0; constant_list[i].lname != NULL; ++i)
-    if (constant_list[i].type != 9)
-      printf("{\"%s\", %s}, ", constant_list[i].sname, constant_list[i].lname);
+    printf("{\"%s\", %s}, ", constant_list[i].sname, constant_list[i].lname);
 
   /* Python numerical type aliases */
   printf(
@@ -316,7 +406,9 @@ void IDL(void)
 
   for (i = 0; constant_list[i].lname != NULL; ++i)
     if ((constant_list[i].type != 1) && (constant_list[i].type != 5) &&
-        (constant_list[i].type != 7) && (constant_list[i].type != 8))
+        (constant_list[i].type != 7) && (constant_list[i].type != 8) &&
+        (constant_list[i].type != 11) && (constant_list[i].type != 13) &&
+        (constant_list[i].type != 14) && (constant_list[i].type != 98))
     {
       printf("{ \"%s\", 0, (void*)IDL_TYP_%s }, ", constant_list[i].sname,
           (constant_list[i].type == 2) ? "LONG" : "INT"); 
@@ -336,7 +428,9 @@ void IDL(void)
 
   for (n = i = 0; constant_list[i].lname != NULL; ++i)
     if ((constant_list[i].type != 1) && (constant_list[i].type != 5) &&
-        (constant_list[i].type != 7) && (constant_list[i].type != 8))
+        (constant_list[i].type != 7) && (constant_list[i].type != 8) &&
+        (constant_list[i].type != 11) && (constant_list[i].type != 13) &&
+        (constant_list[i].type != 14) && (constant_list[i].type != 98))
     {
       printf("*(IDL_%s*)(data + IDL_StructTagInfoByIndex(gdidl_const_def, %i, "
           "IDL_MSG_LONGJMP, NULL)) = %li;\n", (constant_list[i].type == 2) ?
@@ -346,6 +440,103 @@ void IDL(void)
   printf("return r; }\n");
 }
 
+void Perl(void)
+{
+  int i;
+
+  printf("s/@PARAMETERS@/");
+
+  printf("our $VERSION = %i.%04i;\\\n", GETDATA_MAJOR, GETDATA_MINOR * 100 +
+      GETDATA_REVISION);
+  for (i = 0; constant_list[i].lname != NULL; ++i)
+    printf("our $%s = %li;\\\n", constant_list[i].sname,
+        constant_list[i].value);
+
+  printf("/\n");
+  printf("s/@PARAMLIST@/");
+
+  for (i = 0; constant_list[i].lname != NULL; ++i)
+    printf("%s ", constant_list[i].sname, constant_list[i].value);
+  printf("/\n");
+}
+
+/* Since this file gets installed, we're a little more chatty here than usual */
+void MatLab(void)
+{
+  int i;
+
+  fputs("function GD = getdata_constants()\n", stdout);
+
+  fputs("% GETDATA_CONSTANTS  Define GetData symbolic constants\n"
+      "%\n"
+      "%   GETDATA_CONSTANTS  produces a structure containing the symbolic "
+      "constants\n"
+      "%   used by the GetData bindings.  Member names of the structure "
+      "correspond to\n"
+      "%   names of symbolic constants used in the GetData C API.\n"
+      "%\n"
+      "%   Although it can be used in immediate context by doing something "
+      "like\n"
+      "%\n"
+      "%     >> GETDATA_CONSTANTS.FLOAT64\n"
+      "%\n"
+      "%     ans =\n"
+      "%\n"
+      "%              136\n"
+      "%\n"
+      "%   it is usually assigned to a variable, which prevents having to "
+      "evaluate this\n"
+      "%   function more than once.  We recommend calling this variable GD:\n"
+      "%\n"
+      "%     >> GD = GETDATA_CONSTANTS;\n"
+      "%     >> GD.FLOAT64\n"
+      "%\n"
+      "%     ans =\n"
+      "%\n"
+      "%              136\n"
+      "%\n"
+      "%   providing more succinct symbol names which closely resemble the "
+      "cor-\n"
+      "%   respondng C API symbol names (e.g. GD_FLOAT64).  In the "
+      "documentation for\n"
+      "%   these bindings, we assume such a GD variable has been defined, and "
+      "refer to\n"
+      "%   symbolic constants as GD.<...> when necessary.\n"
+      "%\n"
+      "%   See also GETDATA\n\n", stdout);
+
+  fputs("  GD = struct(...\n"
+      "    'VERSION', '" VERSION "'", stdout);
+
+  for (i = 0; constant_list[i].lname != NULL; ++i)
+    printf(", ...\n    '%s', int32(%li)", constant_list[i].sname,
+        constant_list[i].value);
+
+  printf(" ...\n  );\nend\n");
+
+  fputs("\n% Copyright (C) 2013 D. V. Wiebe\n%\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%"
+      "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n%\n"
+      "% This file is part of the GetData project.\n%\n"
+      "% GetData is free software; you can redistribute it and/or modify it "
+      "under\n"
+      "% the terms of the GNU Lesser General Public License as published by "
+      "the\n"
+      "% Free Software Foundation; either version 2.1 of the License, or (at "
+      "your\n"
+      "% option) any later version.\n%\n"
+      "% GetData is distributed in the hope that it will be useful, but "
+      "WITHOUT\n"
+      "% ANY WARRANTY; without even the implied warranty of MERCHANTABILITY "
+      "or\n"
+      "% FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public\n"
+      "% License for more details.\n%\n"
+      "% You should have received a copy of the GNU Lesser General Public "
+      "License\n"
+      "% along with GetData; if not, write to the Free Software Foundation, "
+      "Inc.,\n"
+      "% 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA\n", stdout);
+}
+
 int main(int argc, char* argv[])
 {
   if (argv[1][0] == 'f')
@@ -354,6 +545,12 @@ int main(int argc, char* argv[])
     Python();
   else if (argv[1][0] == 'i')
     IDL();
+  else if (argv[1][0] == 'P')
+    Perl();
+  else if (argv[1][0] == 'm')
+    MatLab();
+  else
+    return 1;
 
   return 0;
 }
diff --git a/bindings/matlab/Contents.m.head b/bindings/matlab/Contents.m.head
new file mode 100644
index 0000000..7960b0a
--- /dev/null
+++ b/bindings/matlab/Contents.m.head
@@ -0,0 +1,95 @@
+% These bindings provide light-weight bindings to the GetData C library for
+% use withing MATLAB.  In general, there is a one-to-one mapping between C API
+% functions and matlab functions.  Differences in behaviour, where notable, are
+% provided in the corresponing function help.
+%
+% The Dirifle object:
+%   Dirfile objects returned from GD_OPEN and similar should be treated as
+%   opaque objects.  They should not be used other than when passing to a
+%   function in these bindings.
+%
+% GetData symbolic constants:
+%   Like the underlying C API, the GetData bindings make use of a large number
+%   of special numbers.  For convenience, a struct containing all these numbers
+%   is provided by the GETDATA_CONSTANTS function, which is typically used by
+%   doing something like:
+%
+%     >> GD = GETDATA_CONSTANTS;
+%
+%   This then allows the use of these constants as GD.UINT8, GD.RAW_ENTRY, &c.,
+%   which is both shorter than using the function directly, i.e.,
+%   GETDATA_CONSTANTS.UINT8, and also only requires evaluating the
+%   GETDATA_CONSTANTS function once.
+%
+%   In this documentation, when a reference is made to a GetData symbolic
+%   constant, it is done so as if the GD variable had been created as above.
+%   The reader should understand, e.g., GD.UINT8 as referring to the same
+%   special number as the similarly-named C API's symbolic constant, e.g.,
+%   GD_UINT8.
+%
+% Input and Output:
+%   Functions in these GetData bindings produce either one or zero scalar or
+%   vector outputs, as explained in the corresponding function documentation.
+%
+%   In general, where the C API would allow a NULL string pointer, these
+%   bindings accept a numeric zero (0) instead of a string input in place of a
+%   NULL.
+%
+%   Unlike the C Library, real and complex data may be used interchangeably in
+%   function calls.
+%
+% Error reporting:
+%   GetData C Library errors are represented in MATLAB as standard exceptions
+%   (see MEXCEPTION).  In general, GetData functions should be evaluated in a
+%   TRY ... CATCH ... END block.  GetData-specific exceptions can be identified
+%   through their MEXCEPTION.identifier.  The component part of a GetData
+%   MEXCPETION.identifier will always start with 'GetData:'.
+%
+%   Exceptions representing a GetData C Library error will have the component
+%   identifier 'GetData:Lib'.  Exceptions generated by the bindings themselves
+%   (almost all of which are failures in data conversion between MATLAB and C
+%   API data types) will have the component identifier 'GetData:GDMX'.  For C
+%   Library errors, the mnemonic part of the MEXCEPTION.identifier corresponds
+%   to the C library error code (e.g. 'GetData:Lib:BadCode').  For C Library
+%   errors, numeric error codes can be obtained using the GD_ERROR function, as
+%   in the C Library.  The return value of GD_ERROR is unspecified after an
+%   exception in the MATLAB bindings (i.e. a 'GetData:GDMX' exception).
+%
+% The Entry structure:
+%   Functions which deal with generic field metadata (GD_ADD, GD_ALTER_ENTRY,
+%   GD_ENTRY, &c.) use structures mirroring the C API's gd_entry_t object with
+%   the following exceptions:
+%
+%   * In entries with multiple input fields, .IN_FIELDS is a cell array of
+%     strings of the appropriate length.  For entries with a single input field,
+%     .IN_FIELDS may be either a simple string or else a cell array of length
+%     one.
+%
+%   * A distinction is not made between real and complex data.  As a result,
+%     the entry struct for, say, a POLYNOM, stores co-efficients in the .A
+%     member, regardless of whether they are complex or purely real.  As a side
+%     effect, the structure does not contain a .COMP_SCAL member.
+%
+%   * LINCOM entries don't provide a .N_FIELDS member, nor do POLYNOM entries
+%     provide a .POLY_ORD member; these values should be determined by
+%     determining the length of .IN_FIELDS, .M, or .B for LINCOMs or of .A for
+%     POLYNOMs.
+%
+%   * The .SCALAR and .SCALAR_IND members are provided for field types which
+%     allow non-literal parameters.  Where the C API would have NULL pointers
+%     in .SCALAR to indicate a literal, the bindings will have a numeric 0 in
+%     the corresponding .SCALAR cell array element.  As with .IN_FIELDS, a
+%     length-one .SCALAR cell array may be replaced by a scalar.
+%
+%   See gd_entry(3) in section 3 of the UNIX manual for details on the C API's
+%   gd_entry_t object.
+%
+% Function list:
+%   NOTE: accompanying documentation for the functions below in general only
+%         point out differences in behaviour between these MATLAB bindings and
+%         the underlying C API function which the MATLAB function wraps.  Users
+%         should also consult the C API documentation, which can be found in
+%         section 3 of the UNIX manual, e.g.
+%
+%           $ man 3 gd_open
+%
diff --git a/bindings/matlab/Makefile.am b/bindings/matlab/Makefile.am
new file mode 100644
index 0000000..b310b19
--- /dev/null
+++ b/bindings/matlab/Makefile.am
@@ -0,0 +1,120 @@
+# Copyright (C) 2013 D. V. Wiebe
+#
+##########################################################################
+#
+# This file is part of the GetData project.
+#
+# GetData is free software; you can redistribute it and/or modify it under
+# the terms of the GNU Lesser General Public License as published by the
+# Free Software Foundation; either version 2.1 of the License, or (at your
+# option) any later version.
+#
+# GetData is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+# License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public License
+# along with GetData; if not, write to the Free Software Foundation, Inc.,
+# 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+#
+AUTOMAKE_OPTIONS = foreign
+
+if GETDATA_DEBUG
+DEBUG_C = ../../src/debug.c
+endif
+
+SUBDIRS=test
+
+matlabdir=$(matlabbasedir)/getdata
+
+matlabfiles=gd_add_bit.m gd_add_divide.m gd_add_lincom.m gd_add_linterp.m \
+						gd_add_mplex.m gd_add_multiply.m gd_add_phase.m gd_add_polynom.m \
+						gd_add_raw.m gd_add_recip.m gd_add_sbit.m gd_add_window.m \
+						gd_alter_bit.m gd_alter_carray.m gd_alter_const.m \
+						gd_alter_divide.m gd_alter_lincom.m gd_alter_linterp.m \
+						gd_alter_mplex.m gd_alter_multiply.m gd_alter_phase.m \
+						gd_alter_polynom.m gd_alter_raw.m gd_alter_recip.m gd_alter_sbit.m \
+						gd_alter_window.m gd_field_list_by_type.m gd_field_list.m \
+						gd_get_constant.m gd_madd_bit.m gd_madd_divide.m \
+						gd_madd_lincom.m gd_madd_linterp.m gd_madd_mplex.m \
+						gd_madd_multiply.m gd_madd_phase.m gd_madd_polynom.m \
+						gd_madd_recip.m gd_madd_sbit.m gd_madd_window.m \
+						gd_mfield_list_by_type.m gd_mfield_list.m gd_mvector_list.m \
+						gd_nfields_by_type.m gd_nfields.m gd_nmfields_by_type.m \
+						gd_nmfields.m gd_nmvectors.m gd_nvectors.m gd_put_carray.m \
+						gd_put_constant.m gd_vector_list.m getdata_constants.m
+mexfiles=gd_add gd_add_alias \
+				 gd_add_carray gd_add_const gd_add_spec gd_add_string gd_aliases \
+				 gd_alias_target gd_alter_affixes \
+				 gd_alter_encoding gd_alter_endianness gd_alter_entry \
+				 gd_alter_frameoffset \
+				 gd_alter_protection gd_alter_spec gd_bof gd_carray_len gd_carrays \
+				 gd_close gd_constants gd_delete gd_delete_alias gd_desync \
+				 gd_dirfilename gd_dirfile_standards \
+				 gd_discard gd_encoding gd_endianness \
+				 gd_entry gd_entry_list gd_entry_type gd_eof \
+				 gd_error gd_error_string gd_flags gd_flush gd_fragment_affixes \
+				 gd_fragment_index gd_fragmentname \
+				 gd_framenum gd_frameoffset gd_get_carray gd_get_carray_slice \
+				 gd_getdata gd_get_string \
+				 gd_hidden gd_hide gd_include gd_invalid_dirfile \
+				 gd_linterp_tablename gd_madd gd_madd_alias \
+				 gd_madd_carray gd_madd_const gd_madd_spec gd_madd_string \
+				 gd_malter_spec gd_mcarrays \
+				 gd_mconstants gd_metaflush gd_move gd_move_alias gd_mplex_lookback \
+				 gd_mstrings gd_naliases gd_native_type gd_nentries gd_nfragments \
+				 gd_nframes gd_open gd_parent_fragment gd_protection \
+				 gd_put_carray_slice \
+				 gd_putdata gd_put_string gd_raw_close gd_raw_filename \
+				 gd_reference gd_rename gd_rewrite_fragment \
+				 gd_seek gd_spf gd_strings gd_strtok \
+				 gd_sync gd_tell gd_unhide gd_uninclude gd_validate gd_verbose_prefix
+
+matlabcfiles=$(addsuffix .c,${mexfiles})
+matlabmexfiles=$(addsuffix . at mexext@,${mexfiles})
+matlabdocfiles=$(addsuffix .m,${mexfiles})
+
+EXTRA_DIST=$(matlabcfiles) doc.tail Contents.m.head
+
+dist_matlab_SCRIPTS=$(matlabfiles)
+nodist_matlab_SCRIPTS=Contents.m getdata_constants.m $(matlabmexfiles) \
+											$(matlabdocfiles)
+
+lib_LTLIBRARIES=libgetdata-matlab.la
+
+libgetdata_matlab_la_SOURCES=matlab.c gd_matlab.h
+nodist_libgetdata_matlab_la_SOURCES=$(DEBUG_C)
+libgetdata_matlab_la_CPPFLAGS=${MATLAB_CPPFLAGS}
+libgetdata_matlab_la_LDFLAGS=-version-info @MATLABGETDATA_VERSION@
+
+if GD_EXTERNAL
+libgetdata_matlab_la_LIBADD=$(GETDATA_LIBS)
+INCLUDES=$(GETDATA_CFLAGS)
+GDMX_LIBS=$(GETDATA_LIBS)
+else
+libgetdata_matlab_la_LIBADD=../../src/libgetdata.la
+INCLUDES=-I${top_srcdir}/src -I../../src
+GDMX_LIBS=-L../../src/.libs -lgetdata
+endif
+
+%.m: %.c ${srcdir}/doc.tail
+	${GREP} '^ %' $< | ${SED} -e 's/^ //' > $@
+	cat ${srcdir}/doc.tail >> $@
+
+%. at mexext@: %.c libgetdata-matlab.la
+	${MEX} ${INCLUDES} -L.libs -lgetdata-matlab $(GDMX_LIBS) $<
+
+Contents.m: ${srcdir}/Contents.m.head make_contents.sh $(matlabfiles) \
+						$(matlabdocfiles) ${srcdir}/doc.tail
+	${SHELL} ./make_contents.sh ${srcdir} > $@
+	cat ${srcdir}/doc.tail >> $@
+
+getdata_constants.m: ../make_parameters
+	../make_parameters m > $@
+
+../make_parameters: ../make_parameters.c
+	cd .. && ${MAKE} make_parameters
+
+clean-local:
+	rm -rf $(nodist_matlab_SCRIPTS)
diff --git a/bindings/matlab/Makefile.in b/bindings/matlab/Makefile.in
new file mode 100644
index 0000000..c3847e1
--- /dev/null
+++ b/bindings/matlab/Makefile.in
@@ -0,0 +1,1007 @@
+# Makefile.in generated by automake 1.11.5 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software
+# Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+ at SET_MAKE@
+
+
+VPATH = @srcdir@
+am__make_dryrun = \
+  { \
+    am__dry=no; \
+    case $$MAKEFLAGS in \
+      *\\[\ \	]*) \
+        echo 'am--echo: ; @echo "AM"  OK' | $(MAKE) -f - 2>/dev/null \
+          | grep '^AM OK$$' >/dev/null || am__dry=yes;; \
+      *) \
+        for am__flg in $$MAKEFLAGS; do \
+          case $$am__flg in \
+            *=*|--*) ;; \
+            *n*) am__dry=yes; break;; \
+          esac; \
+        done;; \
+    esac; \
+    test $$am__dry = yes; \
+  }
+pkgdatadir = $(datadir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkglibexecdir = $(libexecdir)/@PACKAGE@
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+subdir = bindings/matlab
+DIST_COMMON = $(dist_matlab_SCRIPTS) $(srcdir)/Makefile.am \
+	$(srcdir)/Makefile.in $(srcdir)/make_contents.sh.in
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/m4/ax_compare_version.m4 \
+	$(top_srcdir)/m4/compiler.m4 $(top_srcdir)/m4/encoding.m4 \
+	$(top_srcdir)/m4/floatordering.m4 $(top_srcdir)/m4/idl.m4 \
+	$(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \
+	$(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \
+	$(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/m4/matlab.m4 \
+	$(top_srcdir)/m4/perl.m4 $(top_srcdir)/m4/python.m4 \
+	$(top_srcdir)/m4/win32.m4 $(top_srcdir)/m4/version.m4 \
+	$(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+	$(ACLOCAL_M4)
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = $(top_builddir)/src/gd_config.h \
+	$(top_builddir)/src/getdata.h
+CONFIG_CLEAN_FILES = make_contents.sh
+CONFIG_CLEAN_VPATH_FILES =
+am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
+am__vpath_adj = case $$p in \
+    $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
+    *) f=$$p;; \
+  esac;
+am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`;
+am__install_max = 40
+am__nobase_strip_setup = \
+  srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'`
+am__nobase_strip = \
+  for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||"
+am__nobase_list = $(am__nobase_strip_setup); \
+  for p in $$list; do echo "$$p $$p"; done | \
+  sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \
+  $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \
+    if (++n[$$2] == $(am__install_max)) \
+      { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \
+    END { for (dir in files) print dir, files[dir] }'
+am__base_list = \
+  sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \
+  sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
+am__uninstall_files_from_dir = { \
+  test -z "$$files" \
+    || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \
+    || { echo " ( cd '$$dir' && rm -f" $$files ")"; \
+         $(am__cd) "$$dir" && rm -f $$files; }; \
+  }
+am__installdirs = "$(DESTDIR)$(libdir)" "$(DESTDIR)$(matlabdir)" \
+	"$(DESTDIR)$(matlabdir)"
+LTLIBRARIES = $(lib_LTLIBRARIES)
+ at GD_EXTERNAL_FALSE@libgetdata_matlab_la_DEPENDENCIES =  \
+ at GD_EXTERNAL_FALSE@	../../src/libgetdata.la
+am_libgetdata_matlab_la_OBJECTS = libgetdata_matlab_la-matlab.lo
+ at GETDATA_DEBUG_TRUE@am__objects_1 = libgetdata_matlab_la-debug.lo
+nodist_libgetdata_matlab_la_OBJECTS = $(am__objects_1)
+libgetdata_matlab_la_OBJECTS = $(am_libgetdata_matlab_la_OBJECTS) \
+	$(nodist_libgetdata_matlab_la_OBJECTS)
+libgetdata_matlab_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
+	$(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
+	$(libgetdata_matlab_la_LDFLAGS) $(LDFLAGS) -o $@
+SCRIPTS = $(dist_matlab_SCRIPTS) $(nodist_matlab_SCRIPTS)
+DEFAULT_INCLUDES = -I. at am__isrc@ -I$(top_builddir)/src
+depcomp = $(SHELL) $(top_srcdir)/depcomp
+am__depfiles_maybe = depfiles
+am__mv = mv -f
+COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+	$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+	--mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
+	$(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+CCLD = $(CC)
+LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+	--mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \
+	$(LDFLAGS) -o $@
+SOURCES = $(libgetdata_matlab_la_SOURCES) \
+	$(nodist_libgetdata_matlab_la_SOURCES)
+DIST_SOURCES = $(libgetdata_matlab_la_SOURCES)
+RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \
+	html-recursive info-recursive install-data-recursive \
+	install-dvi-recursive install-exec-recursive \
+	install-html-recursive install-info-recursive \
+	install-pdf-recursive install-ps-recursive install-recursive \
+	installcheck-recursive installdirs-recursive pdf-recursive \
+	ps-recursive uninstall-recursive
+am__can_run_installinfo = \
+  case $$AM_UPDATE_INFO_DIR in \
+    n|no|NO) false;; \
+    *) (install-info --version) >/dev/null 2>&1;; \
+  esac
+RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive	\
+  distclean-recursive maintainer-clean-recursive
+AM_RECURSIVE_TARGETS = $(RECURSIVE_TARGETS:-recursive=) \
+	$(RECURSIVE_CLEAN_TARGETS:-recursive=) tags TAGS ctags CTAGS \
+	distdir
+ETAGS = etags
+CTAGS = ctags
+DIST_SUBDIRS = $(SUBDIRS)
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+am__relativize = \
+  dir0=`pwd`; \
+  sed_first='s,^\([^/]*\)/.*$$,\1,'; \
+  sed_rest='s,^[^/]*/*,,'; \
+  sed_last='s,^.*/\([^/]*\)$$,\1,'; \
+  sed_butlast='s,/*[^/]*$$,,'; \
+  while test -n "$$dir1"; do \
+    first=`echo "$$dir1" | sed -e "$$sed_first"`; \
+    if test "$$first" != "."; then \
+      if test "$$first" = ".."; then \
+        dir2=`echo "$$dir0" | sed -e "$$sed_last"`/"$$dir2"; \
+        dir0=`echo "$$dir0" | sed -e "$$sed_butlast"`; \
+      else \
+        first2=`echo "$$dir2" | sed -e "$$sed_first"`; \
+        if test "$$first2" = "$$first"; then \
+          dir2=`echo "$$dir2" | sed -e "$$sed_rest"`; \
+        else \
+          dir2="../$$dir2"; \
+        fi; \
+        dir0="$$dir0"/"$$first"; \
+      fi; \
+    fi; \
+    dir1=`echo "$$dir1" | sed -e "$$sed_rest"`; \
+  done; \
+  reldir="$$dir2"
+ACLOCAL = @ACLOCAL@
+AMTAR = @AMTAR@
+AR = @AR@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+BUILDCC = @BUILDCC@
+BZIP2_CPPFLAGS = @BZIP2_CPPFLAGS@
+BZIP2_LDFLAGS = @BZIP2_LDFLAGS@
+BZIP2_LIBS = @BZIP2_LIBS@
+CC = @CC@
+CCAS = @CCAS@
+CCASDEPMODE = @CCASDEPMODE@
+CCASFLAGS = @CCASFLAGS@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DATE = @DATE@
+DEFINE_GD_LEGACY_API = @DEFINE_GD_LEGACY_API@
+DEFINE_GD_NO_C99_API = @DEFINE_GD_NO_C99_API@
+DEFINE_gd_int16_t = @DEFINE_gd_int16_t@
+DEFINE_gd_int64_t = @DEFINE_gd_int64_t@
+DEFINE_gd_uint16_t = @DEFINE_gd_uint16_t@
+DEFINE_gd_uint64_t = @DEFINE_gd_uint64_t@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+DIFF = @DIFF@
+DLLTOOL = @DLLTOOL@
+DL_LIBRARY_PATH = @DL_LIBRARY_PATH@
+DSYMUTIL = @DSYMUTIL@
+DUMPBIN = @DUMPBIN@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+F77 = @F77@
+F95GETDATA_VERSION = @F95GETDATA_VERSION@
+FC = @FC@
+FCFLAGS = @FCFLAGS@
+FFLAGS = @FFLAGS@
+FGETDATA_VERSION = @FGETDATA_VERSION@
+FGREP = @FGREP@
+FLIBS = @FLIBS@
+GD_DIRSEP = @GD_DIRSEP@
+GD_FDIRSEP = @GD_FDIRSEP@
+GETDATAXX_VERSION = @GETDATAXX_VERSION@
+GETDATA_DEBUG = @GETDATA_DEBUG@
+GETDATA_IFACE_AGE = @GETDATA_IFACE_AGE@
+GETDATA_IFACE_VERSION = @GETDATA_IFACE_VERSION@
+GETDATA_IMPL_REVISION = @GETDATA_IMPL_REVISION@
+GETDATA_MAJOR = @GETDATA_MAJOR@
+GETDATA_MINOR = @GETDATA_MINOR@
+GETDATA_REVISION = @GETDATA_REVISION@
+GETDATA_VERSION_SUFFIX = @GETDATA_VERSION_SUFFIX@
+GREP = @GREP@
+GZIP_CPPFLAGS = @GZIP_CPPFLAGS@
+GZIP_LDFLAGS = @GZIP_LDFLAGS@
+GZIP_LIBS = @GZIP_LIBS@
+IDL = @IDL@
+IDL_CFLAGS = @IDL_CFLAGS@
+IDL_LIBS = @IDL_LIBS@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+JOT = @JOT@
+LD = @LD@
+LDFLAGS = @LDFLAGS@
+LIBLTDL = @LIBLTDL@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LIBTOOL_DEPS = @LIBTOOL_DEPS@
+LIPO = @LIPO@
+LN_S = @LN_S@
+LTDLINCL = @LTDLINCL@
+LTLIBOBJS = @LTLIBOBJS@
+LZMA_CPPFLAGS = @LZMA_CPPFLAGS@
+LZMA_LDFLAGS = @LZMA_LDFLAGS@
+LZMA_LIBS = @LZMA_LIBS@
+MAKEINFO = @MAKEINFO@
+MANIFEST_TOOL = @MANIFEST_TOOL@
+MATLAB = @MATLAB@
+MATLABGETDATA_VERSION = @MATLABGETDATA_VERSION@
+MATLAB_CPPFLAGS = @MATLAB_CPPFLAGS@
+MEX = @MEX@
+MKDIR_P = @MKDIR_P@
+NM = @NM@
+NMEDIT = @NMEDIT@
+NUMPY_CPPFLAGS = @NUMPY_CPPFLAGS@
+OBJDUMP = @OBJDUMP@
+OBJEXT = @OBJEXT@
+OTOOL = @OTOOL@
+OTOOL64 = @OTOOL64@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_URL = @PACKAGE_URL@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PERL = @PERL@
+PERL_MAN3EXT = @PERL_MAN3EXT@
+PRINTF = @PRINTF@
+PRIVATE_LIBS = @PRIVATE_LIBS@
+PYTHON = @PYTHON@
+PYTHON_CPPFLAGS = @PYTHON_CPPFLAGS@
+PYTHON_LIBS = @PYTHON_LIBS@
+RANLIB = @RANLIB@
+SED = @SED@
+SEQ = @SEQ@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+SLIM_CPPFLAGS = @SLIM_CPPFLAGS@
+SLIM_LDFLAGS = @SLIM_LDFLAGS@
+SLIM_LIBS = @SLIM_LIBS@
+STRIP = @STRIP@
+VERSION = @VERSION@
+ZZIP_CPPFLAGS = @ZZIP_CPPFLAGS@
+ZZIP_LDFLAGS = @ZZIP_LDFLAGS@
+ZZIP_LIBS = @ZZIP_LIBS@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+absolute_docdir = @absolute_docdir@
+ac_ct_AR = @ac_ct_AR@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
+ac_ct_F77 = @ac_ct_F77@
+ac_ct_FC = @ac_ct_FC@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+builddir = @builddir@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+idldir = @idldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+mandir = @mandir@
+matlabbasedir = @matlabbasedir@
+mexext = @mexext@
+mkdir_p = @mkdir_p@
+moduledir = @moduledir@
+oldincludedir = @oldincludedir@
+path_bunzip2 = @path_bunzip2@
+path_bzip2 = @path_bzip2@
+path_gunzip = @path_gunzip@
+path_gzip = @path_gzip@
+path_slim = @path_slim@
+path_unslim = @path_unslim@
+path_unzip = @path_unzip@
+path_xz = @path_xz@
+path_zip = @path_zip@
+pdfdir = @pdfdir@
+perldir = @perldir@
+perlmandir = @perlmandir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+pythondir = @pythondir@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+top_build_prefix = @top_build_prefix@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+
+# Copyright (C) 2013 D. V. Wiebe
+#
+##########################################################################
+#
+# This file is part of the GetData project.
+#
+# GetData is free software; you can redistribute it and/or modify it under
+# the terms of the GNU Lesser General Public License as published by the
+# Free Software Foundation; either version 2.1 of the License, or (at your
+# option) any later version.
+#
+# GetData is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+# License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public License
+# along with GetData; if not, write to the Free Software Foundation, Inc.,
+# 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+#
+AUTOMAKE_OPTIONS = foreign
+ at GETDATA_DEBUG_TRUE@DEBUG_C = ../../src/debug.c
+SUBDIRS = test
+matlabdir = $(matlabbasedir)/getdata
+matlabfiles = gd_add_bit.m gd_add_divide.m gd_add_lincom.m gd_add_linterp.m \
+						gd_add_mplex.m gd_add_multiply.m gd_add_phase.m gd_add_polynom.m \
+						gd_add_raw.m gd_add_recip.m gd_add_sbit.m gd_add_window.m \
+						gd_alter_bit.m gd_alter_carray.m gd_alter_const.m \
+						gd_alter_divide.m gd_alter_lincom.m gd_alter_linterp.m \
+						gd_alter_mplex.m gd_alter_multiply.m gd_alter_phase.m \
+						gd_alter_polynom.m gd_alter_raw.m gd_alter_recip.m gd_alter_sbit.m \
+						gd_alter_window.m gd_field_list_by_type.m gd_field_list.m \
+						gd_get_constant.m gd_madd_bit.m gd_madd_divide.m \
+						gd_madd_lincom.m gd_madd_linterp.m gd_madd_mplex.m \
+						gd_madd_multiply.m gd_madd_phase.m gd_madd_polynom.m \
+						gd_madd_recip.m gd_madd_sbit.m gd_madd_window.m \
+						gd_mfield_list_by_type.m gd_mfield_list.m gd_mvector_list.m \
+						gd_nfields_by_type.m gd_nfields.m gd_nmfields_by_type.m \
+						gd_nmfields.m gd_nmvectors.m gd_nvectors.m gd_put_carray.m \
+						gd_put_constant.m gd_vector_list.m getdata_constants.m
+
+mexfiles = gd_add gd_add_alias \
+				 gd_add_carray gd_add_const gd_add_spec gd_add_string gd_aliases \
+				 gd_alias_target gd_alter_affixes \
+				 gd_alter_encoding gd_alter_endianness gd_alter_entry \
+				 gd_alter_frameoffset \
+				 gd_alter_protection gd_alter_spec gd_bof gd_carray_len gd_carrays \
+				 gd_close gd_constants gd_delete gd_delete_alias gd_desync \
+				 gd_dirfilename gd_dirfile_standards \
+				 gd_discard gd_encoding gd_endianness \
+				 gd_entry gd_entry_list gd_entry_type gd_eof \
+				 gd_error gd_error_string gd_flags gd_flush gd_fragment_affixes \
+				 gd_fragment_index gd_fragmentname \
+				 gd_framenum gd_frameoffset gd_get_carray gd_get_carray_slice \
+				 gd_getdata gd_get_string \
+				 gd_hidden gd_hide gd_include gd_invalid_dirfile \
+				 gd_linterp_tablename gd_madd gd_madd_alias \
+				 gd_madd_carray gd_madd_const gd_madd_spec gd_madd_string \
+				 gd_malter_spec gd_mcarrays \
+				 gd_mconstants gd_metaflush gd_move gd_move_alias gd_mplex_lookback \
+				 gd_mstrings gd_naliases gd_native_type gd_nentries gd_nfragments \
+				 gd_nframes gd_open gd_parent_fragment gd_protection \
+				 gd_put_carray_slice \
+				 gd_putdata gd_put_string gd_raw_close gd_raw_filename \
+				 gd_reference gd_rename gd_rewrite_fragment \
+				 gd_seek gd_spf gd_strings gd_strtok \
+				 gd_sync gd_tell gd_unhide gd_uninclude gd_validate gd_verbose_prefix
+
+matlabcfiles = $(addsuffix .c,${mexfiles})
+matlabmexfiles = $(addsuffix . at mexext@,${mexfiles})
+matlabdocfiles = $(addsuffix .m,${mexfiles})
+EXTRA_DIST = $(matlabcfiles) doc.tail Contents.m.head
+dist_matlab_SCRIPTS = $(matlabfiles)
+nodist_matlab_SCRIPTS = Contents.m getdata_constants.m $(matlabmexfiles) \
+											$(matlabdocfiles)
+
+lib_LTLIBRARIES = libgetdata-matlab.la
+libgetdata_matlab_la_SOURCES = matlab.c gd_matlab.h
+nodist_libgetdata_matlab_la_SOURCES = $(DEBUG_C)
+libgetdata_matlab_la_CPPFLAGS = ${MATLAB_CPPFLAGS}
+libgetdata_matlab_la_LDFLAGS = -version-info @MATLABGETDATA_VERSION@
+ at GD_EXTERNAL_FALSE@libgetdata_matlab_la_LIBADD = ../../src/libgetdata.la
+ at GD_EXTERNAL_TRUE@libgetdata_matlab_la_LIBADD = $(GETDATA_LIBS)
+ at GD_EXTERNAL_FALSE@INCLUDES = -I${top_srcdir}/src -I../../src
+ at GD_EXTERNAL_TRUE@INCLUDES = $(GETDATA_CFLAGS)
+ at GD_EXTERNAL_FALSE@GDMX_LIBS = -L../../src/.libs -lgetdata
+ at GD_EXTERNAL_TRUE@GDMX_LIBS = $(GETDATA_LIBS)
+all: all-recursive
+
+.SUFFIXES:
+.SUFFIXES: .c .lo .o .obj
+$(srcdir)/Makefile.in:  $(srcdir)/Makefile.am  $(am__configure_deps)
+	@for dep in $?; do \
+	  case '$(am__configure_deps)' in \
+	    *$$dep*) \
+	      ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
+	        && { if test -f $@; then exit 0; else break; fi; }; \
+	      exit 1;; \
+	  esac; \
+	done; \
+	echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign bindings/matlab/Makefile'; \
+	$(am__cd) $(top_srcdir) && \
+	  $(AUTOMAKE) --foreign bindings/matlab/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+	@case '$?' in \
+	  *config.status*) \
+	    cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+	  *) \
+	    echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+	    cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+	esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure:  $(am__configure_deps)
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4):  $(am__aclocal_m4_deps)
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(am__aclocal_m4_deps):
+make_contents.sh: $(top_builddir)/config.status $(srcdir)/make_contents.sh.in
+	cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@
+install-libLTLIBRARIES: $(lib_LTLIBRARIES)
+	@$(NORMAL_INSTALL)
+	@list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \
+	list2=; for p in $$list; do \
+	  if test -f $$p; then \
+	    list2="$$list2 $$p"; \
+	  else :; fi; \
+	done; \
+	test -z "$$list2" || { \
+	  echo " $(MKDIR_P) '$(DESTDIR)$(libdir)'"; \
+	  $(MKDIR_P) "$(DESTDIR)$(libdir)" || exit 1; \
+	  echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(libdir)'"; \
+	  $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(libdir)"; \
+	}
+
+uninstall-libLTLIBRARIES:
+	@$(NORMAL_UNINSTALL)
+	@list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \
+	for p in $$list; do \
+	  $(am__strip_dir) \
+	  echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(libdir)/$$f'"; \
+	  $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(libdir)/$$f"; \
+	done
+
+clean-libLTLIBRARIES:
+	-test -z "$(lib_LTLIBRARIES)" || rm -f $(lib_LTLIBRARIES)
+	@list='$(lib_LTLIBRARIES)'; for p in $$list; do \
+	  dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \
+	  test "$$dir" != "$$p" || dir=.; \
+	  echo "rm -f \"$${dir}/so_locations\""; \
+	  rm -f "$${dir}/so_locations"; \
+	done
+libgetdata-matlab.la: $(libgetdata_matlab_la_OBJECTS) $(libgetdata_matlab_la_DEPENDENCIES) $(EXTRA_libgetdata_matlab_la_DEPENDENCIES) 
+	$(libgetdata_matlab_la_LINK) -rpath $(libdir) $(libgetdata_matlab_la_OBJECTS) $(libgetdata_matlab_la_LIBADD) $(LIBS)
+install-dist_matlabSCRIPTS: $(dist_matlab_SCRIPTS)
+	@$(NORMAL_INSTALL)
+	@list='$(dist_matlab_SCRIPTS)'; test -n "$(matlabdir)" || list=; \
+	if test -n "$$list"; then \
+	  echo " $(MKDIR_P) '$(DESTDIR)$(matlabdir)'"; \
+	  $(MKDIR_P) "$(DESTDIR)$(matlabdir)" || exit 1; \
+	fi; \
+	for p in $$list; do \
+	  if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+	  if test -f "$$d$$p"; then echo "$$d$$p"; echo "$$p"; else :; fi; \
+	done | \
+	sed -e 'p;s,.*/,,;n' \
+	    -e 'h;s|.*|.|' \
+	    -e 'p;x;s,.*/,,;$(transform)' | sed 'N;N;N;s,\n, ,g' | \
+	$(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1; } \
+	  { d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \
+	    if ($$2 == $$4) { files[d] = files[d] " " $$1; \
+	      if (++n[d] == $(am__install_max)) { \
+		print "f", d, files[d]; n[d] = 0; files[d] = "" } } \
+	    else { print "f", d "/" $$4, $$1 } } \
+	  END { for (d in files) print "f", d, files[d] }' | \
+	while read type dir files; do \
+	     if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \
+	     test -z "$$files" || { \
+	       echo " $(INSTALL_SCRIPT) $$files '$(DESTDIR)$(matlabdir)$$dir'"; \
+	       $(INSTALL_SCRIPT) $$files "$(DESTDIR)$(matlabdir)$$dir" || exit $$?; \
+	     } \
+	; done
+
+uninstall-dist_matlabSCRIPTS:
+	@$(NORMAL_UNINSTALL)
+	@list='$(dist_matlab_SCRIPTS)'; test -n "$(matlabdir)" || exit 0; \
+	files=`for p in $$list; do echo "$$p"; done | \
+	       sed -e 's,.*/,,;$(transform)'`; \
+	dir='$(DESTDIR)$(matlabdir)'; $(am__uninstall_files_from_dir)
+install-nodist_matlabSCRIPTS: $(nodist_matlab_SCRIPTS)
+	@$(NORMAL_INSTALL)
+	@list='$(nodist_matlab_SCRIPTS)'; test -n "$(matlabdir)" || list=; \
+	if test -n "$$list"; then \
+	  echo " $(MKDIR_P) '$(DESTDIR)$(matlabdir)'"; \
+	  $(MKDIR_P) "$(DESTDIR)$(matlabdir)" || exit 1; \
+	fi; \
+	for p in $$list; do \
+	  if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+	  if test -f "$$d$$p"; then echo "$$d$$p"; echo "$$p"; else :; fi; \
+	done | \
+	sed -e 'p;s,.*/,,;n' \
+	    -e 'h;s|.*|.|' \
+	    -e 'p;x;s,.*/,,;$(transform)' | sed 'N;N;N;s,\n, ,g' | \
+	$(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1; } \
+	  { d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \
+	    if ($$2 == $$4) { files[d] = files[d] " " $$1; \
+	      if (++n[d] == $(am__install_max)) { \
+		print "f", d, files[d]; n[d] = 0; files[d] = "" } } \
+	    else { print "f", d "/" $$4, $$1 } } \
+	  END { for (d in files) print "f", d, files[d] }' | \
+	while read type dir files; do \
+	     if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \
+	     test -z "$$files" || { \
+	       echo " $(INSTALL_SCRIPT) $$files '$(DESTDIR)$(matlabdir)$$dir'"; \
+	       $(INSTALL_SCRIPT) $$files "$(DESTDIR)$(matlabdir)$$dir" || exit $$?; \
+	     } \
+	; done
+
+uninstall-nodist_matlabSCRIPTS:
+	@$(NORMAL_UNINSTALL)
+	@list='$(nodist_matlab_SCRIPTS)'; test -n "$(matlabdir)" || exit 0; \
+	files=`for p in $$list; do echo "$$p"; done | \
+	       sed -e 's,.*/,,;$(transform)'`; \
+	dir='$(DESTDIR)$(matlabdir)'; $(am__uninstall_files_from_dir)
+
+mostlyclean-compile:
+	-rm -f *.$(OBJEXT)
+
+distclean-compile:
+	-rm -f *.tab.c
+
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libgetdata_matlab_la-debug.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libgetdata_matlab_la-matlab.Plo at am__quote@
+
+.c.o:
+ at am__fastdepCC_TRUE@	$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+ at am__fastdepCC_TRUE@	$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@	source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCC_FALSE@	$(COMPILE) -c $<
+
+.c.obj:
+ at am__fastdepCC_TRUE@	$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
+ at am__fastdepCC_TRUE@	$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@	source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCC_FALSE@	$(COMPILE) -c `$(CYGPATH_W) '$<'`
+
+.c.lo:
+ at am__fastdepCC_TRUE@	$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+ at am__fastdepCC_TRUE@	$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@	source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCC_FALSE@	$(LTCOMPILE) -c -o $@ $<
+
+libgetdata_matlab_la-matlab.lo: matlab.c
+ at am__fastdepCC_TRUE@	$(LIBTOOL)  --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgetdata_matlab_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libgetdata_matlab_la-matlab.lo -MD -MP -MF $(DEPDIR)/libgetdata_matlab_la-matlab.Tpo -c -o libgetdata_matlab_la-matlab.lo `test -f 'matlab.c' || echo '$(srcdir)/'`matlab.c
+ at am__fastdepCC_TRUE@	$(am__mv) $(DEPDIR)/libgetdata_matlab_la-matlab.Tpo $(DEPDIR)/libgetdata_matlab_la-matlab.Plo
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@	source='matlab.c' object='libgetdata_matlab_la-matlab.lo' libtool=yes @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCC_FALSE@	$(LIBTOOL)  --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgetdata_matlab_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libgetdata_matlab_la-matlab.lo `test -f 'matlab.c' || echo '$(srcdir)/'`matlab.c
+
+libgetdata_matlab_la-debug.lo: ../../src/debug.c
+ at am__fastdepCC_TRUE@	$(LIBTOOL)  --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgetdata_matlab_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libgetdata_matlab_la-debug.lo -MD -MP -MF $(DEPDIR)/libgetdata_matlab_la-debug.Tpo -c -o libgetdata_matlab_la-debug.lo `test -f '../../src/debug.c' || echo '$(srcdir)/'`../../src/debug.c
+ at am__fastdepCC_TRUE@	$(am__mv) $(DEPDIR)/libgetdata_matlab_la-debug.Tpo $(DEPDIR)/libgetdata_matlab_la-debug.Plo
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@	source='../../src/debug.c' object='libgetdata_matlab_la-debug.lo' libtool=yes @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCC_FALSE@	$(LIBTOOL)  --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgetdata_matlab_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libgetdata_matlab_la-debug.lo `test -f '../../src/debug.c' || echo '$(srcdir)/'`../../src/debug.c
+
+mostlyclean-libtool:
+	-rm -f *.lo
+
+clean-libtool:
+	-rm -rf .libs _libs
+
+# This directory's subdirectories are mostly independent; you can cd
+# into them and run `make' without going through this Makefile.
+# To change the values of `make' variables: instead of editing Makefiles,
+# (1) if the variable is set in `config.status', edit `config.status'
+#     (which will cause the Makefiles to be regenerated when you run `make');
+# (2) otherwise, pass the desired values on the `make' command line.
+$(RECURSIVE_TARGETS):
+	@fail= failcom='exit 1'; \
+	for f in x $$MAKEFLAGS; do \
+	  case $$f in \
+	    *=* | --[!k]*);; \
+	    *k*) failcom='fail=yes';; \
+	  esac; \
+	done; \
+	dot_seen=no; \
+	target=`echo $@ | sed s/-recursive//`; \
+	list='$(SUBDIRS)'; for subdir in $$list; do \
+	  echo "Making $$target in $$subdir"; \
+	  if test "$$subdir" = "."; then \
+	    dot_seen=yes; \
+	    local_target="$$target-am"; \
+	  else \
+	    local_target="$$target"; \
+	  fi; \
+	  ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
+	  || eval $$failcom; \
+	done; \
+	if test "$$dot_seen" = "no"; then \
+	  $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \
+	fi; test -z "$$fail"
+
+$(RECURSIVE_CLEAN_TARGETS):
+	@fail= failcom='exit 1'; \
+	for f in x $$MAKEFLAGS; do \
+	  case $$f in \
+	    *=* | --[!k]*);; \
+	    *k*) failcom='fail=yes';; \
+	  esac; \
+	done; \
+	dot_seen=no; \
+	case "$@" in \
+	  distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \
+	  *) list='$(SUBDIRS)' ;; \
+	esac; \
+	rev=''; for subdir in $$list; do \
+	  if test "$$subdir" = "."; then :; else \
+	    rev="$$subdir $$rev"; \
+	  fi; \
+	done; \
+	rev="$$rev ."; \
+	target=`echo $@ | sed s/-recursive//`; \
+	for subdir in $$rev; do \
+	  echo "Making $$target in $$subdir"; \
+	  if test "$$subdir" = "."; then \
+	    local_target="$$target-am"; \
+	  else \
+	    local_target="$$target"; \
+	  fi; \
+	  ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
+	  || eval $$failcom; \
+	done && test -z "$$fail"
+tags-recursive:
+	list='$(SUBDIRS)'; for subdir in $$list; do \
+	  test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \
+	done
+ctags-recursive:
+	list='$(SUBDIRS)'; for subdir in $$list; do \
+	  test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \
+	done
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+	list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+	unique=`for i in $$list; do \
+	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+	  done | \
+	  $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+	      END { if (nonempty) { for (i in files) print i; }; }'`; \
+	mkid -fID $$unique
+tags: TAGS
+
+TAGS: tags-recursive $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
+		$(TAGS_FILES) $(LISP)
+	set x; \
+	here=`pwd`; \
+	if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \
+	  include_option=--etags-include; \
+	  empty_fix=.; \
+	else \
+	  include_option=--include; \
+	  empty_fix=; \
+	fi; \
+	list='$(SUBDIRS)'; for subdir in $$list; do \
+	  if test "$$subdir" = .; then :; else \
+	    test ! -f $$subdir/TAGS || \
+	      set "$$@" "$$include_option=$$here/$$subdir/TAGS"; \
+	  fi; \
+	done; \
+	list='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \
+	unique=`for i in $$list; do \
+	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+	  done | \
+	  $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+	      END { if (nonempty) { for (i in files) print i; }; }'`; \
+	shift; \
+	if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
+	  test -n "$$unique" || unique=$$empty_fix; \
+	  if test $$# -gt 0; then \
+	    $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+	      "$$@" $$unique; \
+	  else \
+	    $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+	      $$unique; \
+	  fi; \
+	fi
+ctags: CTAGS
+CTAGS: ctags-recursive $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
+		$(TAGS_FILES) $(LISP)
+	list='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \
+	unique=`for i in $$list; do \
+	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+	  done | \
+	  $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+	      END { if (nonempty) { for (i in files) print i; }; }'`; \
+	test -z "$(CTAGS_ARGS)$$unique" \
+	  || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+	     $$unique
+
+GTAGS:
+	here=`$(am__cd) $(top_builddir) && pwd` \
+	  && $(am__cd) $(top_srcdir) \
+	  && gtags -i $(GTAGS_ARGS) "$$here"
+
+distclean-tags:
+	-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+distdir: $(DISTFILES)
+	@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+	topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+	list='$(DISTFILES)'; \
+	  dist_files=`for file in $$list; do echo $$file; done | \
+	  sed -e "s|^$$srcdirstrip/||;t" \
+	      -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+	case $$dist_files in \
+	  */*) $(MKDIR_P) `echo "$$dist_files" | \
+			   sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+			   sort -u` ;; \
+	esac; \
+	for file in $$dist_files; do \
+	  if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+	  if test -d $$d/$$file; then \
+	    dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+	    if test -d "$(distdir)/$$file"; then \
+	      find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+	    fi; \
+	    if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+	      cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
+	      find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+	    fi; \
+	    cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
+	  else \
+	    test -f "$(distdir)/$$file" \
+	    || cp -p $$d/$$file "$(distdir)/$$file" \
+	    || exit 1; \
+	  fi; \
+	done
+	@list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
+	  if test "$$subdir" = .; then :; else \
+	    $(am__make_dryrun) \
+	      || test -d "$(distdir)/$$subdir" \
+	      || $(MKDIR_P) "$(distdir)/$$subdir" \
+	      || exit 1; \
+	    dir1=$$subdir; dir2="$(distdir)/$$subdir"; \
+	    $(am__relativize); \
+	    new_distdir=$$reldir; \
+	    dir1=$$subdir; dir2="$(top_distdir)"; \
+	    $(am__relativize); \
+	    new_top_distdir=$$reldir; \
+	    echo " (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir="$$new_top_distdir" distdir="$$new_distdir" \\"; \
+	    echo "     am__remove_distdir=: am__skip_length_check=: am__skip_mode_fix=: distdir)"; \
+	    ($(am__cd) $$subdir && \
+	      $(MAKE) $(AM_MAKEFLAGS) \
+	        top_distdir="$$new_top_distdir" \
+	        distdir="$$new_distdir" \
+		am__remove_distdir=: \
+		am__skip_length_check=: \
+		am__skip_mode_fix=: \
+	        distdir) \
+	      || exit 1; \
+	  fi; \
+	done
+check-am: all-am
+check: check-recursive
+all-am: Makefile $(LTLIBRARIES) $(SCRIPTS)
+installdirs: installdirs-recursive
+installdirs-am:
+	for dir in "$(DESTDIR)$(libdir)" "$(DESTDIR)$(matlabdir)" "$(DESTDIR)$(matlabdir)"; do \
+	  test -z "$$dir" || $(MKDIR_P) "$$dir"; \
+	done
+install: install-recursive
+install-exec: install-exec-recursive
+install-data: install-data-recursive
+uninstall: uninstall-recursive
+
+install-am: all-am
+	@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-recursive
+install-strip:
+	if test -z '$(STRIP)'; then \
+	  $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+	    install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+	      install; \
+	else \
+	  $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+	    install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+	    "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
+	fi
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+	-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+	-test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
+
+maintainer-clean-generic:
+	@echo "This command is intended for maintainers to use"
+	@echo "it deletes files that may require special tools to rebuild."
+clean: clean-recursive
+
+clean-am: clean-generic clean-libLTLIBRARIES clean-libtool clean-local \
+	mostlyclean-am
+
+distclean: distclean-recursive
+	-rm -rf ./$(DEPDIR)
+	-rm -f Makefile
+distclean-am: clean-am distclean-compile distclean-generic \
+	distclean-tags
+
+dvi: dvi-recursive
+
+dvi-am:
+
+html: html-recursive
+
+html-am:
+
+info: info-recursive
+
+info-am:
+
+install-data-am: install-dist_matlabSCRIPTS \
+	install-nodist_matlabSCRIPTS
+
+install-dvi: install-dvi-recursive
+
+install-dvi-am:
+
+install-exec-am: install-libLTLIBRARIES
+
+install-html: install-html-recursive
+
+install-html-am:
+
+install-info: install-info-recursive
+
+install-info-am:
+
+install-man:
+
+install-pdf: install-pdf-recursive
+
+install-pdf-am:
+
+install-ps: install-ps-recursive
+
+install-ps-am:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-recursive
+	-rm -rf ./$(DEPDIR)
+	-rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-recursive
+
+mostlyclean-am: mostlyclean-compile mostlyclean-generic \
+	mostlyclean-libtool
+
+pdf: pdf-recursive
+
+pdf-am:
+
+ps: ps-recursive
+
+ps-am:
+
+uninstall-am: uninstall-dist_matlabSCRIPTS uninstall-libLTLIBRARIES \
+	uninstall-nodist_matlabSCRIPTS
+
+.MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) ctags-recursive \
+	install-am install-strip tags-recursive
+
+.PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \
+	all all-am check check-am clean clean-generic \
+	clean-libLTLIBRARIES clean-libtool clean-local ctags \
+	ctags-recursive distclean distclean-compile distclean-generic \
+	distclean-libtool distclean-tags distdir dvi dvi-am html \
+	html-am info info-am install install-am install-data \
+	install-data-am install-dist_matlabSCRIPTS install-dvi \
+	install-dvi-am install-exec install-exec-am install-html \
+	install-html-am install-info install-info-am \
+	install-libLTLIBRARIES install-man \
+	install-nodist_matlabSCRIPTS install-pdf install-pdf-am \
+	install-ps install-ps-am install-strip installcheck \
+	installcheck-am installdirs installdirs-am maintainer-clean \
+	maintainer-clean-generic mostlyclean mostlyclean-compile \
+	mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
+	tags tags-recursive uninstall uninstall-am \
+	uninstall-dist_matlabSCRIPTS uninstall-libLTLIBRARIES \
+	uninstall-nodist_matlabSCRIPTS
+
+
+%.m: %.c ${srcdir}/doc.tail
+	${GREP} '^ %' $< | ${SED} -e 's/^ //' > $@
+	cat ${srcdir}/doc.tail >> $@
+
+%. at mexext@: %.c libgetdata-matlab.la
+	${MEX} ${INCLUDES} -L.libs -lgetdata-matlab $(GDMX_LIBS) $<
+
+Contents.m: ${srcdir}/Contents.m.head make_contents.sh $(matlabfiles) \
+						$(matlabdocfiles) ${srcdir}/doc.tail
+	${SHELL} ./make_contents.sh ${srcdir} > $@
+	cat ${srcdir}/doc.tail >> $@
+
+getdata_constants.m: ../make_parameters
+	../make_parameters m > $@
+
+../make_parameters: ../make_parameters.c
+	cd .. && ${MAKE} make_parameters
+
+clean-local:
+	rm -rf $(nodist_matlab_SCRIPTS)
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/bindings/matlab/doc.tail b/bindings/matlab/doc.tail
new file mode 100644
index 0000000..d02ffa7
--- /dev/null
+++ b/bindings/matlab/doc.tail
@@ -0,0 +1,20 @@
+
+% Copyright (C) 2013 D. V. Wiebe
+% 
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+% 
+% This file is part of the GetData project.
+%
+% GetData is free software; you can redistribute it and/or modify it under
+% the terms of the GNU Lesser General Public License as published by the
+% Free Software Foundation; either version 2.1 of the License, or (at your
+% option) any later version.
+%
+% GetData is distributed in the hope that it will be useful, but WITHOUT
+% ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+% FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+% License for more details.
+%
+% You should have received a copy of the GNU Lesser General Public License
+% along with GetData; if not, write to the Free Software Foundation, Inc.,
+% 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
diff --git a/bindings/matlab/gd_add.c b/bindings/matlab/gd_add.c
new file mode 100644
index 0000000..d0f49b4
--- /dev/null
+++ b/bindings/matlab/gd_add.c
@@ -0,0 +1,56 @@
+/* Copyright (C) 2013 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+#include "gd_matlab.h"
+
+/*
+ % GD_ADD  Add a field
+ %
+ %   GD_ADD(DIRFILE,ENTRY)
+ %             adds a field described by ENTRY to the dirfile DIRFILE.
+ %
+ %   The DIRFILE object should have previously been created with GD_OPEN.
+ %
+ %   The ENTRY object should be an entry struct; see GETDATA and gd_entry(3) in
+ %   the UNIX manual for details.
+ %
+ %   See the documentation on the C API function gd_add(3) in section 3
+ %   of the UNIX manual for more details.
+ %
+ %   See also GD_MADD, GD_OPEN, GETDATA
+ */
+
+void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])
+{
+  DIRFILE *D;
+  void *data;
+  gd_entry_t *E;
+
+  GDMX_NO_LHS;
+  GDMX_CHECK_RHS(2);
+
+  D = gdmx_to_dirfile(prhs[0]);
+  E = gdmx_to_entry(prhs, 1, 0);
+
+  gd_add(D, E);
+
+  gdmx_free_entry(E);
+  gdmx_err(D, 0);
+}
diff --git a/bindings/matlab/gd_add_alias.c b/bindings/matlab/gd_add_alias.c
new file mode 100644
index 0000000..f25262f
--- /dev/null
+++ b/bindings/matlab/gd_add_alias.c
@@ -0,0 +1,58 @@
+/* Copyright (C) 2013 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+#include "gd_matlab.h"
+
+/*
+ % GD_ADD_ALIAS  Add a field alias
+ %
+ %   GD_ADD_ALIAS(DIRFILE,NAME,TARGET,FRAGMENT)
+ %             adds a field alias called NAME pointing to TARGET in the metadata
+ %             fragment indexed by FRAGMENT of the dirfile DIRFILE.
+ %
+ %   The DIRFILE object should have previously been created with GD_OPEN.
+ %
+ %   See the documentation on the C API function gd_add_alias(3) in section 3
+ %   of the UNIX manual for more details.
+ %
+ %   See also GD_MADD_ALIAS, GD_OPEN
+ */
+
+void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])
+{
+  DIRFILE *D;
+  void *data;
+  char *field_code, *target;
+  int fragment_index;
+
+  GDMX_NO_LHS;
+  GDMX_CHECK_RHS(4);
+
+  D = gdmx_to_dirfile(prhs[0]);
+  field_code = gdmx_to_string(prhs, 1, 0);
+  target = gdmx_to_string(prhs, 2, 0);
+  fragment_index = gdmx_to_int(prhs, 3);
+
+  gd_add_alias(D, field_code, target, fragment_index);
+
+  mxFree(target);
+  mxFree(field_code);
+  gdmx_err(D, 0);
+}
diff --git a/bindings/matlab/gd_add_bit.m b/bindings/matlab/gd_add_bit.m
new file mode 100644
index 0000000..79a568f
--- /dev/null
+++ b/bindings/matlab/gd_add_bit.m
@@ -0,0 +1,41 @@
+function gd_add_bit(D, field_code, in_fields, bitnum, numbits, fragment_index)
+% GD_ADD_BIT  Add a BIT field
+%
+%   GD_ADD_BIT(DIRFILE,NAME,INPUT,BITNUM,NUMBITS,FRAGMENT)
+%             adds a BIT field called NAME to the dirfile specified by DIRFILE.
+%             The input field is INPUT, the first bit is BITNUM and the length
+%             is NUMBITS.  The field is added to the fragment indexed by
+%             FRAGMENT.
+%
+%   The DIRFILE object should have previously been created with GD_OPEN.
+%
+%   See the documentation on the C API function gd_add_bit(3) in section 3
+%   of the UNIX manual for more details.
+%
+%   See also GD_ADD, GD_MADD_BIT, GD_OPEN
+
+  GD = getdata_constants();
+  gd_add(D, struct('field', field_code, 'field_type', GD.BIT_ENTRY, ...
+  'fragment_index', fragment_index, 'in_fields', {in_fields}, ...
+  'bitnum', bitnum, 'numbits', numbits));
+end
+
+% Copyright (C) 2013 D. V. Wiebe
+%
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%
+% This file is part of the GetData project.
+%
+% GetData is free software; you can redistribute it and/or modify it under
+% the terms of the GNU Lesser General Public License as published by the
+% Free Software Foundation; either version 2.1 of the License, or (at your
+% option) any later version.
+%
+% GetData is distributed in the hope that it will be useful, but WITHOUT
+% ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+% FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+% License for more details.
+%
+% You should have received a copy of the GNU Lesser General Public License
+% along with GetData; if not, write to the Free Software Foundation, Inc.,
+% 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
diff --git a/bindings/matlab/gd_add_carray.c b/bindings/matlab/gd_add_carray.c
new file mode 100644
index 0000000..8f4a4c4
--- /dev/null
+++ b/bindings/matlab/gd_add_carray.c
@@ -0,0 +1,63 @@
+/* Copyright (C) 2013 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+#include "gd_matlab.h"
+
+/*
+ % GD_ADD_CARRAY  Add a CARRAY field
+ %
+ %   GD_ADD_CARRAY(DIRFILE,NAME,TYPE,VALUES,FRAGMENT)
+ %             adds a CARRAY field called NAME to the dirfile specified by
+ %             DIRFILE.  The storage type is TYPE, and the values of the field
+ %             are in VALUES.  The field is added to the fragment indexed by
+ %             FRAGMENT.
+ %
+ %   The DIRFILE object should have previously been created with GD_OPEN.
+ %
+ %   See the documentation on the C API function gd_add_carray(3) in section 3
+ %   of the UNIX manual for more details.
+ %
+ %   See also GD_ADD, GD_MADD_CARRAY, GD_OPEN
+ */
+
+void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])
+{
+  DIRFILE *D;
+  void *data;
+  char *field_name;
+  size_t n;
+  int fragment_index;
+  gd_type_t const_type, data_type;
+
+  GDMX_NO_LHS;
+  GDMX_CHECK_RHS(5);
+
+  D = gdmx_to_dirfile(prhs[0]);
+  field_name = gdmx_to_string(prhs, 1, 0);
+  const_type = gdmx_to_gd_type(prhs, 2);
+  gdmx_to_data(&data, &data_type, &n, prhs, 3);
+  fragment_index = gdmx_to_int(prhs, 4);
+
+  gd_add_carray(D, field_name, const_type, n, data_type, data, fragment_index);
+
+  gdmx_free_data(data, data_type);
+  mxFree(field_name);
+  gdmx_err(D, 0);
+}
diff --git a/bindings/matlab/gd_add_const.c b/bindings/matlab/gd_add_const.c
new file mode 100644
index 0000000..60e7943
--- /dev/null
+++ b/bindings/matlab/gd_add_const.c
@@ -0,0 +1,63 @@
+/* Copyright (C) 2013 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+#include "gd_matlab.h"
+
+/*
+ % GD_ADD_CONST  Add a CONST field
+ %
+ %   GD_ADD_CONST(DIRFILE,NAME,TYPE,VALUE,FRAGMENT)
+ %             adds a CONST field called NAME to the dirfile specified by
+ %             DIRFILE.  The storage type is TYPE, and the value of the field
+ %             is VALUE.  The field is added to the fragment indexed by
+ %             FRAGMENT.
+ %
+ %   The DIRFILE object should have previously been created with GD_OPEN.
+ %
+ %   See the documentation on the C API function gd_add_const(3) in section 3
+ %   of the UNIX manual for more details.
+ %
+ %   See also GD_ADD, GD_MADD_CONST, GD_OPEN
+ */
+
+void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])
+{
+  DIRFILE *D;
+  void *data;
+  char *field_name;
+  size_t n;
+  int fragment_index;
+  gd_type_t const_type, data_type;
+
+  GDMX_NO_LHS;
+  GDMX_CHECK_RHS(5);
+
+  D = gdmx_to_dirfile(prhs[0]);
+  field_name = gdmx_to_string(prhs, 1, 0);
+  const_type = gdmx_to_gd_type(prhs, 2);
+  gdmx_to_data(&data, &data_type, &n, prhs, 3);
+  fragment_index = gdmx_to_int(prhs, 4);
+
+  gd_add_const(D, field_name, const_type, data_type, data, fragment_index);
+
+  gdmx_free_data(data, data_type);
+  mxFree(field_name);
+  gdmx_err(D, 0);
+}
diff --git a/bindings/matlab/gd_add_divide.m b/bindings/matlab/gd_add_divide.m
new file mode 100644
index 0000000..25278e9
--- /dev/null
+++ b/bindings/matlab/gd_add_divide.m
@@ -0,0 +1,39 @@
+function gd_add_divide(D, field_code, in1, in2, fragment_index)
+% GD_ADD_DIVIDE  Add a DIVIDE field
+%
+%   GD_ADD_DIVIDE(DIRFILE,NAME,INPUT1,INPUT2,FRAGMENT) 
+%             adds a DIVIDE field called NAME to the dirfile specified by
+%             DIRFILE.  The input fields are INPUT1 and INPUT2 and the field
+%             is added to the fragment indexed by FRAGMENT.
+%
+%   The DIRFILE object should have previously been created with GD_OPEN.
+%
+%   See the documentation on the C API function gd_add_divide(3) in section 3
+%   of the UNIX manual for more details.
+%
+%   See also GD_ADD, GD_MADD_DIVIDE, GD_OPEN
+
+  GD = getdata_constants();
+  gd_add(D, struct('field', field_code, 'field_type', GD.DIVIDE_ENTRY, ...
+  'fragment_index', fragment_index, 'in_fields', {{in1; in2}}));
+end
+
+% Copyright (C) 2013 D. V. Wiebe
+%
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%
+% This file is part of the GetData project.
+%
+% GetData is free software; you can redistribute it and/or modify it under
+% the terms of the GNU Lesser General Public License as published by the
+% Free Software Foundation; either version 2.1 of the License, or (at your
+% option) any later version.
+%
+% GetData is distributed in the hope that it will be useful, but WITHOUT
+% ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+% FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+% License for more details.
+%
+% You should have received a copy of the GNU Lesser General Public License
+% along with GetData; if not, write to the Free Software Foundation, Inc.,
+% 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
diff --git a/bindings/matlab/gd_add_lincom.m b/bindings/matlab/gd_add_lincom.m
new file mode 100644
index 0000000..99ce527
--- /dev/null
+++ b/bindings/matlab/gd_add_lincom.m
@@ -0,0 +1,41 @@
+function gd_add_lincom(D, field_code, in_fields, m, b, fragment_index);
+% GD_ADD_LINCOM  Add a LINCOM field
+%
+%   GD_ADD_LINCOM(DIRFILE,NAME,INPUTS,M,B,FRAGMENT)
+%             adds a LINCOM field called NAME to the dirfile specified by
+%             DIRFILE.  The input fields are provided in the cell array INPUTS
+%             and the slopes and offsets given by the numeric arrays M and B,
+%             which may be complex valued.  The field is added to the fragment
+%             indexed by FRAGMENT.
+%
+%   The DIRFILE object should have previously been created with GD_OPEN.
+%
+%   See the documentation on the C API function gd_add_lincom(3) in section 3
+%   of the UNIX manual for more details.
+%
+%   See also GD_ADD, GD_MADD_LINCOM, GD_OPEN
+
+  GD = getdata_constants();
+  gd_add(D, struct('field', field_code, 'field_type', GD.LINCOM_ENTRY, ...
+  'fragment_index', fragment_index, 'in_fields', {in_fields}, 'm', m, 'b', b));
+end
+
+% Copyright (C) 2013 D. V. Wiebe
+%
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%
+% This file is part of the GetData project.
+%
+% GetData is free software; you can redistribute it and/or modify it under
+% the terms of the GNU Lesser General Public License as published by the
+% Free Software Foundation; either version 2.1 of the License, or (at your
+% option) any later version.
+%
+% GetData is distributed in the hope that it will be useful, but WITHOUT
+% ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+% FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+% License for more details.
+%
+% You should have received a copy of the GNU Lesser General Public License
+% along with GetData; if not, write to the Free Software Foundation, Inc.,
+% 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
diff --git a/bindings/matlab/gd_add_linterp.m b/bindings/matlab/gd_add_linterp.m
new file mode 100644
index 0000000..7cd56d7
--- /dev/null
+++ b/bindings/matlab/gd_add_linterp.m
@@ -0,0 +1,40 @@
+function gd_add_linterp(D, field_code, in_field, table, fragment_index);
+% GD_ADD_LINTERP  Add a LINTERP field
+%
+%   GD_ADD_LINTERP(DIRFILE,NAME,INPUT,TABLE,FRAGMENT)
+%             adds a LINTERP field called NAME to the dirfile specified by
+%             DIRFILE.  The input field is INPUT and the associated look-up
+%             table is given by the path TABLE.  The field is added to the
+%             fragment indexed by FRAGMENT.
+%
+%   The DIRFILE object should have previously been created with GD_OPEN.
+%
+%   See the documentation on the C API function gd_add_linterp(3) in section 3
+%   of the UNIX manual for more details.
+%
+%   See also GD_ADD, GD_MADD_LINTERP, GD_OPEN
+
+  GD = getdata_constants();
+  gd_add(D, struct('field', field_code, 'field_type', GD.LINTERP_ENTRY, ...
+  'fragment_index', fragment_index, 'in_fields', in_field, 'table', table));
+end
+
+% Copyright (C) 2013 D. V. Wiebe
+%
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%
+% This file is part of the GetData project.
+%
+% GetData is free software; you can redistribute it and/or modify it under
+% the terms of the GNU Lesser General Public License as published by the
+% Free Software Foundation; either version 2.1 of the License, or (at your
+% option) any later version.
+%
+% GetData is distributed in the hope that it will be useful, but WITHOUT
+% ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+% FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+% License for more details.
+%
+% You should have received a copy of the GNU Lesser General Public License
+% along with GetData; if not, write to the Free Software Foundation, Inc.,
+% 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
diff --git a/bindings/matlab/gd_add_mplex.m b/bindings/matlab/gd_add_mplex.m
new file mode 100644
index 0000000..edc5f4c
--- /dev/null
+++ b/bindings/matlab/gd_add_mplex.m
@@ -0,0 +1,43 @@
+function gd_add_mplex(D, field_code, in_field1, in_field2, count_val, ...
+period, fragment_index)
+% GD_ADD_MPLEX  Add a MPLEX field
+%
+%   GD_ADD_MPLEX(DIRFILE,NAME,INPUT1,INPUT2,COUNT_VAL,COUNT_MAX,FRAGMENT)
+%             adds a MPLEX field called NAME to the dirfile specified by
+%             DIRFILE.  The input data field is INPUT1, the index field is
+%             INPUT2.  The target value is COUNT_VAL and the maximum value of
+%             INPUT2 is COUNT_MAX.  The field is added to the fragment
+%             indexed by FRAGMENT.
+%
+%   The DIRFILE object should have previously been created with GD_OPEN.
+%
+%   See the documentation on the C API function gd_add_mplex(3) in section 3
+%   of the UNIX manual for more details.
+%
+%   See also GD_ADD, GD_MADD_MPLEX, GD_OPEN
+
+  GD = getdata_constants();
+  gd_add(D, struct('field', field_code, 'field_type', GD.MPLEX_ENTRY, ...
+  'fragment_index', fragment_index, 'in_fields', {{in_field1; in_field2}}, ...
+  'count_val', count_val, 'period', period));
+end
+
+% Copyright (C) 2013 D. V. Wiebe
+%
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%
+% This file is part of the GetData project.
+%
+% GetData is free software; you can redistribute it and/or modify it under
+% the terms of the GNU Lesser General Public License as published by the
+% Free Software Foundation; either version 2.1 of the License, or (at your
+% option) any later version.
+%
+% GetData is distributed in the hope that it will be useful, but WITHOUT
+% ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+% FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+% License for more details.
+%
+% You should have received a copy of the GNU Lesser General Public License
+% along with GetData; if not, write to the Free Software Foundation, Inc.,
+% 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
diff --git a/bindings/matlab/gd_add_multiply.m b/bindings/matlab/gd_add_multiply.m
new file mode 100644
index 0000000..de0fe5a
--- /dev/null
+++ b/bindings/matlab/gd_add_multiply.m
@@ -0,0 +1,39 @@
+function gd_add_multiply(D, field_code, in1, in2, fragment_index)
+% GD_ADD_MULTIPLY  Add a MULTIPLY field
+%
+%   GD_ADD_MULTIPLY(DIRFILE,NAME,INPUT1,INPUT2,FRAGMENT) 
+%             adds a MULTIPLY field called NAME to the dirfile specified by
+%             DIRFILE.  The input fields are INPUT1 and INPUT2 and the field
+%             is added to the fragment indexed by FRAGMENT.
+%
+%   The DIRFILE object should have previously been created with GD_OPEN.
+%
+%   See the documentation on the C API function gd_add_multiply(3) in section 3
+%   of the UNIX manual for more details.
+%
+%   See also GD_ADD, GD_MADD_MULTIPLY, GD_OPEN
+
+  GD = getdata_constants();
+  gd_add(D, struct('field', field_code, 'field_type', GD.MULTIPLY_ENTRY, ...
+  'fragment_index', fragment_index, 'in_fields', {{in1; in2}}));
+end
+
+% Copyright (C) 2013 D. V. Wiebe
+%
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%
+% This file is part of the GetData project.
+%
+% GetData is free software; you can redistribute it and/or modify it under
+% the terms of the GNU Lesser General Public License as published by the
+% Free Software Foundation; either version 2.1 of the License, or (at your
+% option) any later version.
+%
+% GetData is distributed in the hope that it will be useful, but WITHOUT
+% ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+% FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+% License for more details.
+%
+% You should have received a copy of the GNU Lesser General Public License
+% along with GetData; if not, write to the Free Software Foundation, Inc.,
+% 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
diff --git a/bindings/matlab/gd_add_phase.m b/bindings/matlab/gd_add_phase.m
new file mode 100644
index 0000000..a560983
--- /dev/null
+++ b/bindings/matlab/gd_add_phase.m
@@ -0,0 +1,39 @@
+function gd_add_phase(D, field_code, in_fields, shift, fragment_index)
+% GD_ADD_PHASE  Add a PHASE field
+%
+%   GD_ADD_PHASE(DIRFILE,NAME,INPUT,SHIFT,FRAGMENT)
+%             adds a PHASE field called NAME to the dirfile specified by
+%             DIRFILE.  The input field is INPUT and the phase shift is SHIFT.
+%             The field is added to the fragment indexed by FRAGMENT.
+%
+%   The DIRFILE object should have previously been created with GD_OPEN.
+%
+%   See the documentation on the C API function gd_add_phase(3) in section 3
+%   of the UNIX manual for more details.
+%
+%   See also GD_ADD, GD_MADD_PHASE, GD_OPEN
+
+  GD = getdata_constants();
+  gd_add(D, struct('field', field_code, 'field_type', GD.PHASE_ENTRY, ...
+  'fragment_index', fragment_index, 'in_fields', {in_fields}, 'shift', shift));
+end
+
+% Copyright (C) 2013 D. V. Wiebe
+%
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%
+% This file is part of the GetData project.
+%
+% GetData is free software; you can redistribute it and/or modify it under
+% the terms of the GNU Lesser General Public License as published by the
+% Free Software Foundation; either version 2.1 of the License, or (at your
+% option) any later version.
+%
+% GetData is distributed in the hope that it will be useful, but WITHOUT
+% ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+% FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+% License for more details.
+%
+% You should have received a copy of the GNU Lesser General Public License
+% along with GetData; if not, write to the Free Software Foundation, Inc.,
+% 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
diff --git a/bindings/matlab/gd_add_polynom.m b/bindings/matlab/gd_add_polynom.m
new file mode 100644
index 0000000..9f9621d
--- /dev/null
+++ b/bindings/matlab/gd_add_polynom.m
@@ -0,0 +1,40 @@
+function gd_add_polynom(D, field_code, in_field, a, fragment_index);
+% GD_ADD_POLYNOM  Add a POLYNOM field
+%
+%   GD_ADD_POLYNOM(DIRFILE,NAME,INPUT,A,FRAGMENT)
+%             adds a POLYNOM field called NAME to the dirfile specified by
+%             DIRFILE.  The input field is INPUT and the co-efficients are
+%             given in the numerical array A, which may be complex valued.
+%             The field is added to the fragment indexed by FRAGMENT.
+%
+%   The DIRFILE object should have previously been created with GD_OPEN.
+%
+%   See the documentation on the C API function gd_add_polynom(3) in section 3
+%   of the UNIX manual for more details.
+%
+%   See also GD_ADD, GD_MADD_POLYNOM, GD_OPEN
+
+  GD = getdata_constants();
+  gd_add(D, struct('field', field_code, 'field_type', GD.POLYNOM_ENTRY, ...
+  'fragment_index', fragment_index, 'in_fields', {in_field}, 'a', a));
+end
+
+% Copyright (C) 2013 D. V. Wiebe
+%
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%
+% This file is part of the GetData project.
+%
+% GetData is free software; you can redistribute it and/or modify it under
+% the terms of the GNU Lesser General Public License as published by the
+% Free Software Foundation; either version 2.1 of the License, or (at your
+% option) any later version.
+%
+% GetData is distributed in the hope that it will be useful, but WITHOUT
+% ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+% FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+% License for more details.
+%
+% You should have received a copy of the GNU Lesser General Public License
+% along with GetData; if not, write to the Free Software Foundation, Inc.,
+% 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
diff --git a/bindings/matlab/gd_add_raw.m b/bindings/matlab/gd_add_raw.m
new file mode 100644
index 0000000..825edb5
--- /dev/null
+++ b/bindings/matlab/gd_add_raw.m
@@ -0,0 +1,41 @@
+function gd_add_raw(D, field_code, data_type, spf, fragment_index)
+% GD_ADD_RAW  Add a RAW field
+%
+%   GD_ADD_RAW(DIRFILE,NAME,TYPE,SPF,FRAGMENT)
+%             adds a RAW field called NAME to the dirfile specified by
+%             DIRFILE.  The type of the raw data is given by TYPE, which should
+%             be one of the data types provided by GETDATA_CONSTANTS().  The
+%             samples-per-frame of the field is given by SPF.  The field is
+%             added to the fragment indexed by FRAGMENT.
+%
+%   The DIRFILE object should have previously been created with GD_OPEN.
+%
+%   See the documentation on the C API function gd_add_raw(3) in section 3
+%   of the UNIX manual for more details.
+%
+%   See also GD_ADD, GD_OPEN
+
+  GD = getdata_constants();
+  gd_add(D, struct('field', field_code, 'field_type', GD.RAW_ENTRY, ...
+  'fragment_index', fragment_index, 'data_type', data_type, 'spf', spf));
+end
+
+% Copyright (C) 2013 D. V. Wiebe
+%
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%
+% This file is part of the GetData project.
+%
+% GetData is free software; you can redistribute it and/or modify it under
+% the terms of the GNU Lesser General Public License as published by the
+% Free Software Foundation; either version 2.1 of the License, or (at your
+% option) any later version.
+%
+% GetData is distributed in the hope that it will be useful, but WITHOUT
+% ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+% FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+% License for more details.
+%
+% You should have received a copy of the GNU Lesser General Public License
+% along with GetData; if not, write to the Free Software Foundation, Inc.,
+% 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
diff --git a/bindings/matlab/gd_add_recip.m b/bindings/matlab/gd_add_recip.m
new file mode 100644
index 0000000..8f182d4
--- /dev/null
+++ b/bindings/matlab/gd_add_recip.m
@@ -0,0 +1,40 @@
+function gd_add_recip(D, field_code, in_field, dividend, fragment_index)
+% GD_ADD_RECIP  Add a RECIP field
+%
+%   GD_ADD_RECIP(DIRFILE,NAME,INPUT,DIVIDEND,FRAGMENT)
+%             adds a RECIP field called NAME to the dirfile specified by
+%             DIRFILE.  The scalar dividend is DIVIDEND, which may be complex
+%             valued.  The field is added to the fragment indexed by FRAGMENT.
+%
+%   The DIRFILE object should have previously been created with GD_OPEN.
+%
+%   See the documentation on the C API function gd_add_recip(3) in section 3 of
+%   the UNIX manual for more details.
+%
+%   See also GD_ADD, GD_MADD_RECIP, GD_OPEN
+
+  GD = getdata_constants();
+  gd_add(D, struct('field', field_code, 'field_type', GD.RECIP_ENTRY, ...
+  'fragment_index', fragment_index, 'in_fields', {in_field}, ...
+  'dividend', dividend));
+end
+
+% Copyright (C) 2013 D. V. Wiebe
+%
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%
+% This file is part of the GetData project.
+%
+% GetData is free software; you can redistribute it and/or modify it under
+% the terms of the GNU Lesser General Public License as published by the
+% Free Software Foundation; either version 2.1 of the License, or (at your
+% option) any later version.
+%
+% GetData is distributed in the hope that it will be useful, but WITHOUT
+% ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+% FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+% License for more details.
+%
+% You should have received a copy of the GNU Lesser General Public License
+% along with GetData; if not, write to the Free Software Foundation, Inc.,
+% 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
diff --git a/bindings/matlab/gd_add_sbit.m b/bindings/matlab/gd_add_sbit.m
new file mode 100644
index 0000000..ac81aba
--- /dev/null
+++ b/bindings/matlab/gd_add_sbit.m
@@ -0,0 +1,41 @@
+function gd_add_sbit(D, field_code, in_fields, bitnum, numbits, fragment_index)
+% GD_ADD_SBIT  Add a SBIT field
+%
+%   GD_ADD_SBIT(DIRFILE,NAME,INPUT,BITNUM,NUMBITS,FRAGMENT)
+%             adds a SBIT field called NAME to the dirfile specified by DIRFILE.
+%             The input field is INPUT, the first bit is BITNUM and the length
+%             is NUMBITS.  The field is added to the fragment indexed by
+%             FRAGMENT.
+%
+%   The DIRFILE object should have previously been created with GD_OPEN.
+%
+%   See the documentation on the C API function gd_add_sbit(3) in section 3
+%   of the UNIX manual for more details.
+%
+%   See also GD_ADD, GD_MADD_SBIT, GD_OPEN
+
+  GD = getdata_constants();
+  gd_add(D, struct('field', field_code, 'field_type', GD.SBIT_ENTRY, ...
+  'fragment_index', fragment_index, 'in_fields', {in_fields}, ...
+  'bitnum', bitnum, 'numbits', numbits));
+end
+
+% Copyright (C) 2013 D. V. Wiebe
+%
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%
+% This file is part of the GetData project.
+%
+% GetData is free software; you can redistribute it and/or modify it under
+% the terms of the GNU Lesser General Public License as published by the
+% Free Software Foundation; either version 2.1 of the License, or (at your
+% option) any later version.
+%
+% GetData is distributed in the hope that it will be useful, but WITHOUT
+% ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+% FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+% License for more details.
+%
+% You should have received a copy of the GNU Lesser General Public License
+% along with GetData; if not, write to the Free Software Foundation, Inc.,
+% 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
diff --git a/bindings/matlab/gd_add_spec.c b/bindings/matlab/gd_add_spec.c
new file mode 100644
index 0000000..33f798f
--- /dev/null
+++ b/bindings/matlab/gd_add_spec.c
@@ -0,0 +1,56 @@
+/* Copyright (C) 2013 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+#include "gd_matlab.h"
+
+/*
+ % GD_ADD_SPEC  Add a field
+ %
+ %   GD_ADD_SPEC(DIRFILE,SPEC,FRAGMENT)
+ %             adds a field described by the field specification line SPEC to
+ %             the dirfile DIRFILE.  The field is added to the fragment indexed 
+ %             by FRAGMENT.
+ %
+ %   The DIRFILE object should have previously been created with GD_OPEN.
+ %
+ %   See the documentation on the C API function gd_add_spec(3) in section 3
+ %   of the UNIX manual for more details.
+ %
+ %   See also GD_ADD, GD_MADD_SPEC, GD_OPEN
+ */
+
+void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])
+{
+  DIRFILE *D;
+  char *spec;
+  int fragment_index;
+
+  GDMX_NO_LHS;
+  GDMX_CHECK_RHS(3);
+
+  D = gdmx_to_dirfile(prhs[0]);
+  spec = gdmx_to_string(prhs, 1, 0);
+  fragment_index = gdmx_to_int(prhs, 2);
+
+  gd_add_spec(D, spec, fragment_index);
+
+  mxFree(spec);
+  gdmx_err(D, 0);
+}
diff --git a/bindings/matlab/gd_add_string.c b/bindings/matlab/gd_add_string.c
new file mode 100644
index 0000000..18ca4f0
--- /dev/null
+++ b/bindings/matlab/gd_add_string.c
@@ -0,0 +1,58 @@
+/* Copyright (C) 2013 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+#include "gd_matlab.h"
+
+/*
+ % GD_ADD_STRING  Add a STRING field
+ %
+ %   GD_ADD_STRING(DIRFILE,NAME,VALUE,FRAGMENT)
+ %             adds a STRING field called NAME to the dirfile specified by
+ %             DIRFILE.  The value of the field is set to VALUE.  The field is
+ %             added to the fragment indexed by FRAGMENT.
+ %
+ %   The DIRFILE object should have previously been created with GD_OPEN.
+ %
+ %   See the documentation on the C API function gd_add_string(3) in section 3
+ %   of the UNIX manual for more details.
+ %
+ %   See also GD_ADD, GD_MADD_STRING, GD_OPEN
+ */
+
+void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])
+{
+  DIRFILE *D;
+  char *field_name, *value;
+  int fragment_index;
+
+  GDMX_NO_LHS;
+  GDMX_CHECK_RHS(4);
+
+  D = gdmx_to_dirfile(prhs[0]);
+  field_name = gdmx_to_string(prhs, 1, 0);
+  value = gdmx_to_string(prhs, 2, 0);
+  fragment_index = gdmx_to_int(prhs, 3);
+
+  gd_add_string(D, field_name, value, fragment_index);
+
+  mxFree(field_name);
+  mxFree(value);
+  gdmx_err(D, 0);
+}
diff --git a/bindings/matlab/gd_add_window.m b/bindings/matlab/gd_add_window.m
new file mode 100644
index 0000000..9cb9dd1
--- /dev/null
+++ b/bindings/matlab/gd_add_window.m
@@ -0,0 +1,44 @@
+function gd_add_window(D, field_code, in_field1, in_field2, windop, ...
+threshold, fragment_index);
+% GD_ADD_WINDOW  Add a WINDOW field
+%
+%   GD_ADD_WINDOW(DIRFILE,NAME,INPUT1,INPUT2,WINDOP,THRESHOLD,FRAGMENT)
+%             adds a WINDOW field called NAME to the dirfile specified by
+%             DIRFILE.  The data input field is INPUT1, and the mask field is
+%             INPUT2. The operator is specified by WINDOP, which should be one
+%             of the GD.WINDOP_... members provided by GETDATA_CONSTANTS, and
+%             the threshold is THRESHOLD.  The field is added to the fragment
+%             indexed by FRAGMENT.
+%
+%   The DIRFILE object should have previously been created with GD_OPEN.
+%
+%   See the documentation on the C API function gd_add_window(3) in section 3
+%   of the UNIX manual for more details.
+%
+%   See also GD_ADD, GD_MADD_WINDOW, GD_OPEN, GETDATA_CONSTANTS
+
+  GD = getdata_constants();
+  gd_add(D, struct('field', field_code, 'field_type', GD.WINDOW_ENTRY, ...
+  'fragment_index', fragment_index, 'in_fields', {{in_field1; in_field2}}, ...
+  'windop', windop, 'threshold', threshold));
+end
+
+% Copyright (C) 2013 D. V. Wiebe
+%
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%
+% This file is part of the GetData project.
+%
+% GetData is free software; you can redistribute it and/or modify it under
+% the terms of the GNU Lesser General Public License as published by the
+% Free Software Foundation; either version 2.1 of the License, or (at your
+% option) any later version.
+%
+% GetData is distributed in the hope that it will be useful, but WITHOUT
+% ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+% FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+% License for more details.
+%
+% You should have received a copy of the GNU Lesser General Public License
+% along with GetData; if not, write to the Free Software Foundation, Inc.,
+% 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
diff --git a/bindings/matlab/gd_alias_target.c b/bindings/matlab/gd_alias_target.c
new file mode 100644
index 0000000..e3679f3
--- /dev/null
+++ b/bindings/matlab/gd_alias_target.c
@@ -0,0 +1,54 @@
+/* Copyright (C) 2013 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+#include "gd_matlab.h"
+
+/*
+ % GD_ALIAS_TARGET  Report the target of an /ALIAS
+ %
+ %   T = GD_ALIAS_TARGET(DIRFILE,NAME)
+ %             returns the target, T, of the alias named NAME.
+ %
+ %   The DIRFILE object should have previously been created with GD_OPEN.
+ %
+ %   See the documentation on the C API function gd_alias_target(3) in section 3
+ %   of the UNIX manual for more details.
+ %
+ %   See also GD_ALIASES, GD_OPEN
+ */
+
+void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])
+{
+  DIRFILE *D;
+  const char *s;
+  char *field_code;
+
+  GDMX_CHECK_RHS(2);
+
+  D = gdmx_to_dirfile(prhs[0]);
+  field_code = gdmx_to_string(prhs, 1, 0);
+
+  s = gd_alias_target(D, field_code);
+
+  mxFree(field_code);
+  gdmx_err(D, 0);
+
+  plhs[0] = mxCreateString(s);
+}
diff --git a/bindings/matlab/gd_aliases.c b/bindings/matlab/gd_aliases.c
new file mode 100644
index 0000000..7c5277e
--- /dev/null
+++ b/bindings/matlab/gd_aliases.c
@@ -0,0 +1,55 @@
+/* Copyright (C) 2013 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+#include "gd_matlab.h"
+
+/*
+ % GD_ALIASES  Retrieve a list of aliases for a field
+ %
+ %   A = GD_ALIASES(DIRFILE,NAME)
+ %             returns a cell array of strings, A, comprising all the aliases of
+ %             the field called NAME.
+ %
+ %   The DIRFILE object should have previously been created with GD_OPEN.
+ %
+ %   See the documentation on the C API function gd_aliases(3) in section 3
+ %   of the UNIX manual for more details.
+ %
+ %   See also GD_NALIASES, GD_ENTRY_LIST, GD_ALIAS_TARGET, GD_OPEN
+ */
+
+void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])
+{
+  DIRFILE *D;
+  char *field_code;
+  const char **al;
+
+  GDMX_CHECK_RHS(2);
+
+  D = gdmx_to_dirfile(prhs[0]);
+  field_code = gdmx_to_string(prhs, 1, 0);
+
+  al = gd_aliases(D, field_code);
+
+  mxFree(field_code);
+  gdmx_err(D, 0);
+
+  plhs[0] = gdmx_from_string_list(al);
+}
diff --git a/bindings/matlab/gd_alter_affixes.c b/bindings/matlab/gd_alter_affixes.c
new file mode 100644
index 0000000..457e407
--- /dev/null
+++ b/bindings/matlab/gd_alter_affixes.c
@@ -0,0 +1,61 @@
+/* Copyright (C) 2013 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+#include "gd_matlab.h"
+
+/*
+ % GD_ALTER_AFFIXES  Modify the affixes of an included fragment
+ %
+ %   GD_ALTER_ENDIANNESS(DIRFILE,FRAGMENT,PREFIX,SUFFIX)
+ %             modifies the prefix and suffix associated with the fragment
+ %             indexed by FRAGMENT in the dirfile DIRFILE.  If PREFIX or SUFFIX
+ %             is numeric zero, no change is made to the associated affix.
+ %             Otherwise, the affix is set to the value of the parameter.  To
+ %             remove an affix, set it to the empty string: ''.
+ %             Otherwise, the binary files are not modified.
+ %
+ %   The DIRFILE object should have previously been created with GD_OPEN.
+ %
+ %   See the documentation on the C API function gd_alter_affixes(3) in
+ %   section 3 of the UNIX manual for more details.
+ %
+ %   See also GD_FRAGMENT_AFFIXES, GD_INCLUDE, GD_OPEN
+ */
+
+void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])
+{
+  DIRFILE *D;
+  int i;
+  char *p = NULL, *s = NULL;
+
+  GDMX_NO_LHS;
+  GDMX_CHECK_RHS(4);
+
+  D = gdmx_to_dirfile(prhs[0]);
+  i = gdmx_to_int(prhs, 1);
+  p = gdmx_to_string(prhs, 2, 1);
+  s = gdmx_to_string(prhs, 3, 1);
+
+  gd_alter_affixes(D, i, p, s);
+
+  mxFree(p);
+  mxFree(s);
+  gdmx_err(D, 0);
+}
diff --git a/bindings/matlab/gd_alter_bit.m b/bindings/matlab/gd_alter_bit.m
new file mode 100644
index 0000000..f4ab292
--- /dev/null
+++ b/bindings/matlab/gd_alter_bit.m
@@ -0,0 +1,39 @@
+function gd_alter_bit(D, field_code, in_fields, bitnum, numbits)
+% GD_ALTER_BIT  Modify the metadata of a BIT field
+%
+%   GD_ALTER_BIT(DIRFILE,NAME,INPUT,BITNUM,NUMBITS)
+%             modifies the metadata of the BIT field called NAME in the
+%             dirfile specified by DIRFILE.  The input field is set to INPUT,
+%             the first bit to BITNUM, and the number of bits to NUMBITS.
+%
+%   The DIRFILE object should have previously been created with GD_OPEN.
+%
+%   See the documentation on the C API function gd_alter_bit(3) in section 3
+%   of the UNIX manual for more details.
+%
+%   See also GD_ALTER_ENTRY, GD_OPEN
+
+  GD = getdata_constants();
+  gd_alter_entry(D, field_code, struct('field_type', GD.BIT_ENTRY, ...
+  'in_fields', {in_fields}, 'bitnum', bitnum, 'numbits', numbits), 0);
+end
+
+% Copyright (C) 2013 D. V. Wiebe
+%
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%
+% This file is part of the GetData project.
+%
+% GetData is free software; you can redistribute it and/or modify it under
+% the terms of the GNU Lesser General Public License as published by the
+% Free Software Foundation; either version 2.1 of the License, or (at your
+% option) any later version.
+%
+% GetData is distributed in the hope that it will be useful, but WITHOUT
+% ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+% FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+% License for more details.
+%
+% You should have received a copy of the GNU Lesser General Public License
+% along with GetData; if not, write to the Free Software Foundation, Inc.,
+% 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
diff --git a/bindings/matlab/gd_alter_carray.m b/bindings/matlab/gd_alter_carray.m
new file mode 100644
index 0000000..461559f
--- /dev/null
+++ b/bindings/matlab/gd_alter_carray.m
@@ -0,0 +1,40 @@
+function gd_alter_carray(D, field_code, const_type, array_len)
+% GD_ALTER_CARRAY  Modify the metadata of a CARRAY field
+%
+%   GD_ALTER_CARRAY(DIRFILE,NAME,TYPE,LEN)
+%             modifies the metadata of the CARRAY field called NAME in the
+%             dirfile specified by DIRFILE.  The storage type is set to TYPE,
+%             which should be one of the data type symbols provided by
+%             GETDATA_CONSTANTS, and the length of the CARRAY is set to LEN.
+%
+%   The DIRFILE object should have previously been created with GD_OPEN.
+%
+%   See the documentation on the C API function gd_alter_carray(3) in section 3
+%   of the UNIX manual for more details.
+%
+%   See also GD_ALTER_ENTRY, GD_OPEN, GETDATA_CONSTANTS
+
+  GD = getdata_constants();
+  gd_alter_entry(D, field_code, struct('field_type', GD.CARRAY_ENTRY, ...
+  'const_type', const_type, 'array_len', array_len), 0);
+end
+
+% Copyright (C) 2013 D. V. Wiebe
+%
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%
+% This file is part of the GetData project.
+%
+% GetData is free software; you can redistribute it and/or modify it under
+% the terms of the GNU Lesser General Public License as published by the
+% Free Software Foundation; either version 2.1 of the License, or (at your
+% option) any later version.
+%
+% GetData is distributed in the hope that it will be useful, but WITHOUT
+% ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+% FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+% License for more details.
+%
+% You should have received a copy of the GNU Lesser General Public License
+% along with GetData; if not, write to the Free Software Foundation, Inc.,
+% 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
diff --git a/bindings/matlab/gd_alter_const.m b/bindings/matlab/gd_alter_const.m
new file mode 100644
index 0000000..46b2d29
--- /dev/null
+++ b/bindings/matlab/gd_alter_const.m
@@ -0,0 +1,40 @@
+function gd_alter_const(D, field_code, const_type)
+% GD_ALTER_CONST  Modify the metadata of a CONST field
+%
+%   GD_ALTER_CONST(DIRFILE,NAME,TYPE)
+%             modifies the metadata of the CONST field called NAME in the
+%             dirfile specified by DIRFILE, setting the storage type of the
+%             field to TYPE, which should be one of the data type symbols
+%             provided by GETDATA_CONSTANTS.
+%
+%   The DIRFILE object should have previously been created with GD_OPEN.
+%
+%   See the documentation on the C API function gd_alter_const(3) in section 3
+%   of the UNIX manual for more details.
+%
+%   See also GD_ALTER_ENTRY, GD_OPEN, GETDATA_CONSTANTS
+
+  GD = getdata_constants();
+  gd_alter_entry(D, field_code, struct('field_type', GD.CONST_ENTRY, ...
+  'const_type', const_type), 0);
+end
+
+% Copyright (C) 2013 D. V. Wiebe
+%
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%
+% This file is part of the GetData project.
+%
+% GetData is free software; you can redistribute it and/or modify it under
+% the terms of the GNU Lesser General Public License as published by the
+% Free Software Foundation; either version 2.1 of the License, or (at your
+% option) any later version.
+%
+% GetData is distributed in the hope that it will be useful, but WITHOUT
+% ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+% FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+% License for more details.
+%
+% You should have received a copy of the GNU Lesser General Public License
+% along with GetData; if not, write to the Free Software Foundation, Inc.,
+% 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
diff --git a/bindings/matlab/gd_alter_divide.m b/bindings/matlab/gd_alter_divide.m
new file mode 100644
index 0000000..f1e3b8f
--- /dev/null
+++ b/bindings/matlab/gd_alter_divide.m
@@ -0,0 +1,39 @@
+function gd_alter_divide(D, field_code, in1, in2)
+% GD_ALTER_DIVIDE  Modify the metadata of a DIVIDE field
+%
+%   GD_ALTER_DIVIDE(DIRFILE,NAME,INPUT1,INPUT2)
+%             modifies the metadata of the DIVIDE field called NAME in the
+%             dirfile specified by DIRFILE.  The input fields are set to INPUT1,
+%             and INPUT2, if non-zero.
+%
+%   The DIRFILE object should have previously been created with GD_OPEN.
+%
+%   See the documentation on the C API function gd_alter_divide(3) in section 3
+%   of the UNIX manual for more details.
+%
+%   See also GD_ALTER_ENTRY, GD_OPEN
+
+  GD = getdata_constants();
+  gd_alter_entry(D, field_code, struct('field_type', GD.DIVIDE_ENTRY, ...
+  'in_fields', {{in1; in2}}), 0);
+end
+
+% Copyright (C) 2013 D. V. Wiebe
+%
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%
+% This file is part of the GetData project.
+%
+% GetData is free software; you can redistribute it and/or modify it under
+% the terms of the GNU Lesser General Public License as published by the
+% Free Software Foundation; either version 2.1 of the License, or (at your
+% option) any later version.
+%
+% GetData is distributed in the hope that it will be useful, but WITHOUT
+% ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+% FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+% License for more details.
+%
+% You should have received a copy of the GNU Lesser General Public License
+% along with GetData; if not, write to the Free Software Foundation, Inc.,
+% 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
diff --git a/bindings/matlab/gd_alter_encoding.c b/bindings/matlab/gd_alter_encoding.c
new file mode 100644
index 0000000..e534c6d
--- /dev/null
+++ b/bindings/matlab/gd_alter_encoding.c
@@ -0,0 +1,60 @@
+/* Copyright (C) 2013 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+#include "gd_matlab.h"
+
+/*
+ % GD_ALTER_ENCODING  Modify the encoding of a fragment
+ %
+ %   GD_ALTER_ENCODING(DIRFILE,ENCODING,FRAGMENT[,RECODE])
+ %             sets the encoding of the metadata fragment indexed by FRAGMENT
+ %             in the dirfile DIRFILE to ENCODING, which should be one of the
+ %             GD.xxx_ENCODED constants provided by GETDATA_CONSTANTS.
+ %             If RECODE is given and non-zero, binary files affected by the
+ %             encoding change will be converted.  Otherwise, the binary files
+ %             are not modified.
+ %
+ %   The DIRFILE object should have previously been created with GD_OPEN.
+ %
+ %   See the documentation on the C API function gd_alter_endianness(3) in
+ %   section 3 of the UNIX manual for more details.
+ %
+ %   See also GD_ENCODING, GD_OPEN, GETDATA_CONSTANTS
+ */
+void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])
+{
+  DIRFILE *D;
+  void *data;
+  int i, r = 0;
+  unsigned int e;
+
+  GDMX_NO_LHS;
+  GDMX_CHECK_RHS2(3,4);
+
+  D = gdmx_to_dirfile(prhs[0]);
+  e = gdmx_to_uint(prhs, 1);
+  i = gdmx_to_int(prhs, 2);
+  if (nrhs > 3)
+    r = gdmx_to_int(prhs, 3);
+
+  gd_alter_encoding(D, e, i, r);
+
+  gdmx_err(D, 0);
+}
diff --git a/bindings/matlab/gd_alter_endianness.c b/bindings/matlab/gd_alter_endianness.c
new file mode 100644
index 0000000..af3d629
--- /dev/null
+++ b/bindings/matlab/gd_alter_endianness.c
@@ -0,0 +1,63 @@
+/* Copyright (C) 2013 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+#include "gd_matlab.h"
+
+/*
+ % GD_ALTER_ENDIANNESS  Modify the byte sex of a fragment
+ %
+ %   GD_ALTER_ENDIANNESS(DIRFILE,ENDIANNESS,FRAGMENT[,RECODE])
+ %             sets the byte sex of the metadata fragment indexed by FRAGMENT
+ %             in the dirfile DIRFILE to ENDIANNESS, which should be one of:
+ %             numeric zero, indicating the native type of the platform;
+ %             GD.BIG_ENDIAN, or GD.LITTLE_ENDIAN, optionally bitwise or'd with
+ %             either GD.ARM_ENDIAN or GD.NOT_ARM_ENDIAN.  See GETDATA_CONSTANTS
+ %             for these constants.  If RECODE is given and non-zero, binary
+ %             files affected by the byte sex change will be converted.
+ %             Otherwise, the binary files are not modified.
+ %
+ %   The DIRFILE object should have previously been created with GD_OPEN.
+ %
+ %   See the documentation on the C API function gd_alter_endianness(3) in
+ %   section 3 of the UNIX manual for more details.
+ %
+ %   See also GD_ENDIANNESS, GD_OPEN, GETDATA_CONSTANTS
+ */
+
+void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])
+{
+  DIRFILE *D;
+  void *data;
+  int i, r = 0;
+  unsigned long e;
+
+  GDMX_NO_LHS;
+  GDMX_CHECK_RHS2(3,4);
+
+  D = gdmx_to_dirfile(prhs[0]);
+  e = gdmx_to_ulong(prhs, 1);
+  i = gdmx_to_int(prhs, 2);
+  if (nrhs > 3)
+    r = gdmx_to_int(prhs, 3);
+
+  gd_alter_endianness(D, e, i, r);
+
+  gdmx_err(D, 0);
+}
diff --git a/bindings/matlab/gd_alter_entry.c b/bindings/matlab/gd_alter_entry.c
new file mode 100644
index 0000000..10b8cd2
--- /dev/null
+++ b/bindings/matlab/gd_alter_entry.c
@@ -0,0 +1,66 @@
+/* Copyright (C) 2013 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+#include "gd_matlab.h"
+
+/*
+ % GD_ALTER_ENTRY  Modify field metadata
+ %
+ %   GD_ALTER_ENTRY(DIRFILE,FIELD_CODE,ENTRY[,RECODE])
+ %             modifies the metadata of the field FIELD_CODE in the dirfile
+ %             DIRFILE according to the contents of the ENTRY struct.  If
+ %             RECODE is given and non-zero, other data will be updated to
+ %             reflect metadata changes.
+ %
+ %   The DIRFILE object should have previously been created with GD_OPEN.
+ %
+ %   This function ignores both the .FIELD member and the .FRAGMENT_INDEX
+ %   member of the supplied ENTRY structure.  They may be omitted.  For a
+ %   discussion of the ENTRY structure, see GETDATA.
+ %
+ %   See the documentation on the C API function gd_alter_endianness(3) in
+ %   section 3 of the UNIX manual for more details.
+ %
+ %   See also GD_ADD, GD_OPEN, GETDATA
+ */
+
+void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])
+{
+  DIRFILE *D;
+  void *data;
+  char *field_code;
+  gd_entry_t *E;
+  int recode = 0;
+
+  GDMX_NO_LHS;
+  GDMX_CHECK_RHS2(3,4);
+
+  D = gdmx_to_dirfile(prhs[0]);
+  field_code = gdmx_to_string(prhs, 1, 0);
+  E = gdmx_to_entry(prhs, 2, GDMX_ENO_FRAG | GDMX_ENO_FIELD);
+  if (nrhs > 3)
+    recode = gdmx_to_int(prhs, 3);
+
+  gd_alter_entry(D, field_code, E, recode);
+
+  mxFree(field_code);
+  gdmx_free_entry(E);
+  gdmx_err(D, 0);
+}
diff --git a/bindings/matlab/gd_alter_frameoffset.c b/bindings/matlab/gd_alter_frameoffset.c
new file mode 100644
index 0000000..8922424
--- /dev/null
+++ b/bindings/matlab/gd_alter_frameoffset.c
@@ -0,0 +1,57 @@
+/* Copyright (C) 2013 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+#include "gd_matlab.h"
+
+/*
+ % GD_ALTER_FRAMEOFFSET  Modify the frameoffset of a fragment
+ %
+ %   GD_ALTER_FRAMEOFFSET(DIRFILE,OFFSET,FRAGMENT[,RECODE])
+ %             sets the byte sex of the metadata fragment indexed by FRAGMENT
+ %             in the dirfile DIRFILE to OFFSET.  If RECODE is given and
+ %             non-zero, binary files affected by the offset change will be
+ %             converted.  Otherwise, the binary files are not modified.
+ %
+ %   The DIRFILE object should have previously been created with GD_OPEN.
+ %
+ %   See the documentation on the C API function gd_alter_frameoffset(3) in
+ %   section 3 of the UNIX manual for more details.
+ %
+ %   See also GD_FRAMEOFFSET, GD_OPEN, GETDATA_CONSTANTS
+ */
+
+void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])
+{
+  DIRFILE *D;
+  int i, r;
+  unsigned long long o;
+
+  GDMX_NO_LHS;
+  GDMX_CHECK_RHS(4);
+
+  D = gdmx_to_dirfile(prhs[0]);
+  o = gdmx_to_ullong(prhs, 1);
+  i = gdmx_to_int(prhs, 2);
+  r = gdmx_to_int(prhs, 3);
+
+  gd_alter_frameoffset64(D, o, i, r);
+
+  gdmx_err(D, 0);
+}
diff --git a/bindings/matlab/gd_alter_lincom.m b/bindings/matlab/gd_alter_lincom.m
new file mode 100644
index 0000000..4ff624d
--- /dev/null
+++ b/bindings/matlab/gd_alter_lincom.m
@@ -0,0 +1,41 @@
+function gd_alter_lincom(D, field_code, in_fields, m, b)
+% GD_ALTER_LINCOM  Modify the metadata of a LINCOM field
+%
+%   GD_ALTER_LINCOM(DIRFILE,NAME,INPUTS,M,B)
+%             modifies the metadata of the LINCOM field called NAME in the
+%             dirfile specified by DIRFILE.  The input fields are set according
+%             to INPUT; changing the length of this cell array changes the
+%             number of input fields in the dirfile.  The slope and offsets are
+%             set to M and B.
+%
+%   The DIRFILE object should have previously been created with GD_OPEN.
+%
+%   See the documentation on the C API function gd_alter_lincom(3) in section 3
+%   of the UNIX manual for more details.
+%
+%   See also GD_ALTER_ENTRY, GD_OPEN
+
+  GD = getdata_constants();
+  gd_alter_entry(D, field_code, struct('field_type', GD.LINCOM_ENTRY, ...
+  'in_fields', {in_fields}, 'm', m, 'b', b), 0);
+end
+
+% Copyright (C) 2013 D. V. Wiebe
+%
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%
+% This file is part of the GetData project.
+%
+% GetData is free software; you can redistribute it and/or modify it under
+% the terms of the GNU Lesser General Public License as published by the
+% Free Software Foundation; either version 2.1 of the License, or (at your
+% option) any later version.
+%
+% GetData is distributed in the hope that it will be useful, but WITHOUT
+% ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+% FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+% License for more details.
+%
+% You should have received a copy of the GNU Lesser General Public License
+% along with GetData; if not, write to the Free Software Foundation, Inc.,
+% 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
diff --git a/bindings/matlab/gd_alter_linterp.m b/bindings/matlab/gd_alter_linterp.m
new file mode 100644
index 0000000..a24ff27
--- /dev/null
+++ b/bindings/matlab/gd_alter_linterp.m
@@ -0,0 +1,41 @@
+function gd_alter_linterp(D, field_code, in_fields, table, recode);
+% GD_ALTER_LINTERP  Modify the metadata of a LINTERP field
+%
+%   GD_ALTER_LINTERP(DIRFILE,NAME,INPUT,TABLE,RECODE)
+%             modifies the metadata of the LINTERP field called NAME in the
+%             dirfile specified by DIRFILE.  The input field is set to INPUT,
+%             and the associated look-up table path to TABLE, except when these
+%             inputs are numeric zero, indicating no change.  If RECODE is
+%             non-zero, an existing look-up table will be renamed to TABLE.
+%
+%   The DIRFILE object should have previously been created with GD_OPEN.
+%
+%   See the documentation on the C API function gd_alter_linterp(3) in section 3
+%   of the UNIX manual for more details.
+%
+%   See also GD_ALTER_ENTRY, GD_OPEN
+
+  GD = getdata_constants();
+  gd_alter_entry(D, field_code, struct('field_type', GD.LINTERP_ENTRY, ...
+  'in_fields', in_fields, 'table', table), recode);
+end
+
+% Copyright (C) 2013 D. V. Wiebe
+%
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%
+% This file is part of the GetData project.
+%
+% GetData is free software; you can redistribute it and/or modify it under
+% the terms of the GNU Lesser General Public License as published by the
+% Free Software Foundation; either version 2.1 of the License, or (at your
+% option) any later version.
+%
+% GetData is distributed in the hope that it will be useful, but WITHOUT
+% ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+% FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+% License for more details.
+%
+% You should have received a copy of the GNU Lesser General Public License
+% along with GetData; if not, write to the Free Software Foundation, Inc.,
+% 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
diff --git a/bindings/matlab/gd_alter_mplex.m b/bindings/matlab/gd_alter_mplex.m
new file mode 100644
index 0000000..aa81377
--- /dev/null
+++ b/bindings/matlab/gd_alter_mplex.m
@@ -0,0 +1,41 @@
+function gd_alter_mplex(D, field_code, in1, in2, count_val, period)
+% GD_ALTER_MPLEX  Modify the metadata of a MPLEX field
+%
+%   GD_ALTER_MPLEX(DIRFILE,NAME,INPUT1,INPUT2,COUNT_VAL,COUNT_MAX)
+%             modifies the metadata of the MPLEX field called NAME in the
+%             dirfile specified by DIRFILE.  The input fields are set to INPUT1,
+%             and INPUT2, if non-zero, and the count value and maximum are set
+%             to COUNT_VAL and COUNT_MAX, respectively.
+%
+%   The DIRFILE object should have previously been created with GD_OPEN.
+%
+%   See the documentation on the C API function gd_alter_mplex(3) in section 3
+%   of the UNIX manual for more details.
+%
+%   See also GD_ALTER_ENTRY, GD_OPEN
+
+  GD = getdata_constants();
+  gd_alter_entry(D, field_code, struct('field_type', GD.MPLEX_ENTRY, ...
+  'in_fields', {{in1; in2}}, 'count_val', count_val, ...
+  'period', period), 0);
+end
+
+% Copyright (C) 2013 D. V. Wiebe
+%
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%
+% This file is part of the GetData project.
+%
+% GetData is free software; you can redistribute it and/or modify it under
+% the terms of the GNU Lesser General Public License as published by the
+% Free Software Foundation; either version 2.1 of the License, or (at your
+% option) any later version.
+%
+% GetData is distributed in the hope that it will be useful, but WITHOUT
+% ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+% FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+% License for more details.
+%
+% You should have received a copy of the GNU Lesser General Public License
+% along with GetData; if not, write to the Free Software Foundation, Inc.,
+% 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
diff --git a/bindings/matlab/gd_alter_multiply.m b/bindings/matlab/gd_alter_multiply.m
new file mode 100644
index 0000000..550f831
--- /dev/null
+++ b/bindings/matlab/gd_alter_multiply.m
@@ -0,0 +1,39 @@
+function gd_alter_multiply(D, field_code, in1, in2)
+% GD_ALTER_MULTIPLY  Modify the metadata of a MULTIPLY field
+%
+%   GD_ALTER_MULTIPLY(DIRFILE,NAME,INPUT1,INPUT2)
+%             modifies the metadata of the MULTIPLY field called NAME in the
+%             dirfile specified by DIRFILE.  The input fields are set to INPUT1,
+%             and INPUT2, if non-zero.
+%
+%   The DIRFILE object should have previously been created with GD_OPEN.
+%
+%   See the documentation on the C API function gd_alter_multiply(3) in section
+%   3 of the UNIX manual for more details.
+%
+%   See also GD_ALTER_ENTRY, GD_OPEN
+
+  GD = getdata_constants();
+  gd_alter_entry(D, field_code, struct('field_type', GD.MULTIPLY_ENTRY, ...
+  'in_fields', {{in1; in2}}), 0);
+end
+
+% Copyright (C) 2013 D. V. Wiebe
+%
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%
+% This file is part of the GetData project.
+%
+% GetData is free software; you can redistribute it and/or modify it under
+% the terms of the GNU Lesser General Public License as published by the
+% Free Software Foundation; either version 2.1 of the License, or (at your
+% option) any later version.
+%
+% GetData is distributed in the hope that it will be useful, but WITHOUT
+% ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+% FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+% License for more details.
+%
+% You should have received a copy of the GNU Lesser General Public License
+% along with GetData; if not, write to the Free Software Foundation, Inc.,
+% 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
diff --git a/bindings/matlab/gd_alter_phase.m b/bindings/matlab/gd_alter_phase.m
new file mode 100644
index 0000000..ccdd0bc
--- /dev/null
+++ b/bindings/matlab/gd_alter_phase.m
@@ -0,0 +1,39 @@
+function gd_alter_phase(D, field_code, in_fields, shift)
+% GD_ALTER_PHASE  Modify the metadata of a PHASE field
+%
+%   GD_ALTER_PHASE(DIRFILE,NAME,INPUT,SHIFT)
+%             modifies the metadata of the PHASE field called NAME in the
+%             dirfile specified by DIRFILE.  The input field is set to INPUT,
+%             if non-zero, and the phase shift to SHIFT.
+%
+%   The DIRFILE object should have previously been created with GD_OPEN.
+%
+%   See the documentation on the C API function gd_alter_phase(3) in section 3
+%   of the UNIX manual for more details.
+%
+%   See also GD_ALTER_ENTRY, GD_OPEN
+
+  GD = getdata_constants();
+  gd_alter_entry(D, field_code, struct('field_type', GD.PHASE_ENTRY, ...
+  'in_fields', {in_fields}, 'shift', shift), 0);
+end
+
+% Copyright (C) 2013 D. V. Wiebe
+%
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%
+% This file is part of the GetData project.
+%
+% GetData is free software; you can redistribute it and/or modify it under
+% the terms of the GNU Lesser General Public License as published by the
+% Free Software Foundation; either version 2.1 of the License, or (at your
+% option) any later version.
+%
+% GetData is distributed in the hope that it will be useful, but WITHOUT
+% ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+% FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+% License for more details.
+%
+% You should have received a copy of the GNU Lesser General Public License
+% along with GetData; if not, write to the Free Software Foundation, Inc.,
+% 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
diff --git a/bindings/matlab/gd_alter_polynom.m b/bindings/matlab/gd_alter_polynom.m
new file mode 100644
index 0000000..ae255e4
--- /dev/null
+++ b/bindings/matlab/gd_alter_polynom.m
@@ -0,0 +1,39 @@
+function gd_alter_polynom(D, field_code, in_fields, a)
+% GD_ALTER_POLYNOM  Modify the metadata of a POLYNOM field
+%
+%   GD_ALTER_POLYNOM(DIRFILE,NAME,INPUT,A)
+%             modifies the metadata of the POLYNOM field called NAME in the
+%             dirfile specified by DIRFILE.  The input field is set to INPUT1,
+%             if non-zero, and the co-efficient vector to A.
+%
+%   The DIRFILE object should have previously been created with GD_OPEN.
+%
+%   See the documentation on the C API function gd_alter_polynom(3) in section 3
+%   of the UNIX manual for more details.
+%
+%   See also GD_ALTER_ENTRY, GD_OPEN
+
+  GD = getdata_constants();
+  gd_alter_entry(D, field_code, struct('field_type', GD.POLYNOM_ENTRY, ...
+  'in_fields', {in_fields}, 'a', a), 0);
+end
+
+% Copyright (C) 2013 D. V. Wiebe
+%
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%
+% This file is part of the GetData project.
+%
+% GetData is free software; you can redistribute it and/or modify it under
+% the terms of the GNU Lesser General Public License as published by the
+% Free Software Foundation; either version 2.1 of the License, or (at your
+% option) any later version.
+%
+% GetData is distributed in the hope that it will be useful, but WITHOUT
+% ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+% FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+% License for more details.
+%
+% You should have received a copy of the GNU Lesser General Public License
+% along with GetData; if not, write to the Free Software Foundation, Inc.,
+% 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
diff --git a/bindings/matlab/gd_alter_protection.c b/bindings/matlab/gd_alter_protection.c
new file mode 100644
index 0000000..01f5c7c
--- /dev/null
+++ b/bindings/matlab/gd_alter_protection.c
@@ -0,0 +1,55 @@
+/* Copyright (C) 2013 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+#include "gd_matlab.h"
+
+/*
+ % GD_ALTER_PROTECTION  Modify the byte sex of a fragment
+ %
+ %   GD_ALTER_PROTECTION(DIRFILE,LEVEL,FRAGMENT)
+ %             sets the protection level of the metadata fragment indexed by
+ %             FRAGMENT in the dirfile DIRFILE to LEVEL, which should be one of
+ %             the GD.PROTECT_[...] symbols provided by GETDATA_CONSTANTS.
+ %
+ %   The DIRFILE object should have previously been created with GD_OPEN.
+ %
+ %   See the documentation on the C API function gd_alter_protection(3) in
+ %   section 3 of the UNIX manual for more details.
+ %
+ %   See also GD_PROTECTION, GD_OPEN, GETDATA_CONSTANTS
+ */
+
+void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])
+{
+  DIRFILE *D;
+  void *data;
+  int i, n;
+
+  GDMX_NO_LHS;
+  GDMX_CHECK_RHS(3);
+
+  D = gdmx_to_dirfile(prhs[0]);
+  i = gdmx_to_int(prhs, 1);
+  n = gdmx_to_int(prhs, 2);
+
+  gd_alter_protection(D, n, i);
+
+  gdmx_err(D, 0);
+}
diff --git a/bindings/matlab/gd_alter_raw.m b/bindings/matlab/gd_alter_raw.m
new file mode 100644
index 0000000..9d97a03
--- /dev/null
+++ b/bindings/matlab/gd_alter_raw.m
@@ -0,0 +1,42 @@
+function gd_alter_raw(D, field_code, data_type, spf, recode)
+% GD_ALTER_RAW  Modify the metadata of a RAW field
+%
+%   GD_ALTER_RAW(DIRFILE,NAME,TYPE,SPF,RECODE)
+%             modifies the metadata of the RAW field called NAME in the
+%             dirfile specified by DIRFILE.  The data type is set to TYPE, if
+%             not GD.NULL, and the samples-per-frame to SPF, if not zero.  If
+%             RECODE is non-zero, the binary file associated with the field will
+%             be rewritten to reflect the changes; otherwise the binary file is
+%             not modified.
+%
+%   The DIRFILE object should have previously been created with GD_OPEN.
+%
+%   See the documentation on the C API function gd_alter_raw(3) in section 3
+%   of the UNIX manual for more details.
+%
+%   See also GD_ALTER_ENTRY, GD_OPEN
+
+  GD = getdata_constants();
+  gd_alter_entry(D, field_code, struct('field_type', GD.RAW_ENTRY, ...
+  'data_type', data_type, 'spf', spf), recode);
+end
+
+% Copyright (C) 2013 D. V. Wiebe
+%
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%
+% This file is part of the GetData project.
+%
+% GetData is free software; you can redistribute it and/or modify it under
+% the terms of the GNU Lesser General Public License as published by the
+% Free Software Foundation; either version 2.1 of the License, or (at your
+% option) any later version.
+%
+% GetData is distributed in the hope that it will be useful, but WITHOUT
+% ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+% FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+% License for more details.
+%
+% You should have received a copy of the GNU Lesser General Public License
+% along with GetData; if not, write to the Free Software Foundation, Inc.,
+% 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
diff --git a/bindings/matlab/gd_alter_recip.m b/bindings/matlab/gd_alter_recip.m
new file mode 100644
index 0000000..af312e6
--- /dev/null
+++ b/bindings/matlab/gd_alter_recip.m
@@ -0,0 +1,39 @@
+function gd_alter_recip(D, field_code, in_fields, dividend)
+% GD_ALTER_RECIP  Modify the metadata of a RECIP field
+%
+%   GD_ALTER_RECIP(DIRFILE,NAME,INPUT,DIVIDEND)
+%             modifies the metadata of the RECIP field called NAME in the
+%             dirfile specified by DIRFILE.  The input field is set to INPUT1,
+%             if non-zero, and the dividend to DIVIDEND.
+%
+%   The DIRFILE object should have previously been created with GD_OPEN.
+%
+%   See the documentation on the C API function gd_alter_recip(3) in section 3
+%   of the UNIX manual for more details.
+%
+%   See also GD_ALTER_ENTRY, GD_OPEN
+
+  GD = getdata_constants();
+  gd_alter_entry(D, field_code, struct('field_type', GD.RECIP_ENTRY, ...
+  'in_fields', {in_fields}, 'dividend', dividend), 0);
+end
+
+% Copyright (C) 2013 D. V. Wiebe
+%
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%
+% This file is part of the GetData project.
+%
+% GetData is free software; you can redistribute it and/or modify it under
+% the terms of the GNU Lesser General Public License as published by the
+% Free Software Foundation; either version 2.1 of the License, or (at your
+% option) any later version.
+%
+% GetData is distributed in the hope that it will be useful, but WITHOUT
+% ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+% FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+% License for more details.
+%
+% You should have received a copy of the GNU Lesser General Public License
+% along with GetData; if not, write to the Free Software Foundation, Inc.,
+% 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
diff --git a/bindings/matlab/gd_alter_sbit.m b/bindings/matlab/gd_alter_sbit.m
new file mode 100644
index 0000000..beb257d
--- /dev/null
+++ b/bindings/matlab/gd_alter_sbit.m
@@ -0,0 +1,39 @@
+function gd_alter_sbit(D, field_code, in_fields, bitnum, numbits)
+% GD_ALTER_SBIT  Modify the metadata of a SBIT field
+%
+%   GD_ALTER_SBIT(DIRFILE,NAME,INPUT,BITNUM,NUMBITS)
+%             modifies the metadata of the SBIT field called NAME in the
+%             dirfile specified by DIRFILE.  The input field is set to INPUT,
+%             the first bit to BITNUM, and the number of bits to NUMBITS.
+%
+%   The DIRFILE object should have previously been created with GD_OPEN.
+%
+%   See the documentation on the C API function gd_alter_sbit(3) in section 3
+%   of the UNIX manual for more details.
+%
+%   See also GD_ALTER_ENTRY, GD_OPEN
+
+  GD = getdata_constants();
+  gd_alter_entry(D, field_code, struct('field_type', GD.SBIT_ENTRY, ...
+  'in_fields', {in_fields}, 'bitnum', bitnum, 'numbits', numbits), 0);
+end
+
+% Copyright (C) 2013 D. V. Wiebe
+%
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%
+% This file is part of the GetData project.
+%
+% GetData is free software; you can redistribute it and/or modify it under
+% the terms of the GNU Lesser General Public License as published by the
+% Free Software Foundation; either version 2.1 of the License, or (at your
+% option) any later version.
+%
+% GetData is distributed in the hope that it will be useful, but WITHOUT
+% ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+% FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+% License for more details.
+%
+% You should have received a copy of the GNU Lesser General Public License
+% along with GetData; if not, write to the Free Software Foundation, Inc.,
+% 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
diff --git a/bindings/matlab/gd_alter_spec.c b/bindings/matlab/gd_alter_spec.c
new file mode 100644
index 0000000..8d93377
--- /dev/null
+++ b/bindings/matlab/gd_alter_spec.c
@@ -0,0 +1,58 @@
+/* Copyright (C) 2013 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+#include "gd_matlab.h"
+
+/*
+ % GD_ALTER_SPEC  Modify field metadata
+ %
+ %   GD_ALTER_SPEC(DIRFILE,SPEC[,RECODE])
+ %             modifies the metadata of a field in the dirfile DIRFILE
+ %             according to the field specification line SPEC.  If
+ %             RECODE is given and non-zero, other data will be updated to
+ %             reflect metadata changes.
+ %
+ %   The DIRFILE object should have previously been created with GD_OPEN.
+ %
+ %   See the documentation on the C API function gd_alter_spec(3) in
+ %   section 3 of the UNIX manual for more details.
+ %
+ %   See also GD_MALTER_SPEC, GD_OPEN
+ */
+
+void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])
+{
+  DIRFILE *D;
+  char *spec;
+  int recode = 0;
+
+  GDMX_NO_LHS;
+  GDMX_CHECK_RHS2(2,3);
+
+  D = gdmx_to_dirfile(prhs[0]);
+  spec = gdmx_to_string(prhs, 1, 0);
+  if (nrhs > 2)
+    recode = gdmx_to_int(prhs, 2);
+
+  gd_alter_spec(D, spec, recode);
+
+  mxFree(spec);
+  gdmx_err(D, 0);
+}
diff --git a/bindings/matlab/gd_alter_window.m b/bindings/matlab/gd_alter_window.m
new file mode 100644
index 0000000..804746a
--- /dev/null
+++ b/bindings/matlab/gd_alter_window.m
@@ -0,0 +1,40 @@
+function gd_alter_window(D, field_code, in1, in2, windop, threshold)
+% GD_ALTER_WINDOW  Modify the metadata of a WINDOW field
+%
+%   GD_ALTER_WINDOW(DIRFILE,NAME,INPUT1,INPUT2,WINDOP,THRESHOLD)
+%             modifies the metadata of the WINDOW field called NAME in the
+%             dirfile specified by DIRFILE.  The input fields are set to INPUT1,
+%             and INPUT2, if non-zero, the operator to WINDOP and the threshold
+%             to THRESHOLD.
+%
+%   The DIRFILE object should have previously been created with GD_OPEN.
+%
+%   See the documentation on the C API function gd_alter_window(3) in section 3
+%   of the UNIX manual for more details.
+%
+%   See also GD_ALTER_ENTRY, GD_OPEN
+
+  GD = getdata_constants();
+  gd_alter_entry(D, field_code, struct('field_type', GD.WINDOW_ENTRY, ...
+  'in_fields', {{in1; in2}}, 'windop', windop, 'threshold', threshold), 0);
+end
+
+% Copyright (C) 2013 D. V. Wiebe
+%
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%
+% This file is part of the GetData project.
+%
+% GetData is free software; you can redistribute it and/or modify it under
+% the terms of the GNU Lesser General Public License as published by the
+% Free Software Foundation; either version 2.1 of the License, or (at your
+% option) any later version.
+%
+% GetData is distributed in the hope that it will be useful, but WITHOUT
+% ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+% FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+% License for more details.
+%
+% You should have received a copy of the GNU Lesser General Public License
+% along with GetData; if not, write to the Free Software Foundation, Inc.,
+% 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
diff --git a/bindings/matlab/gd_bof.c b/bindings/matlab/gd_bof.c
new file mode 100644
index 0000000..597076c
--- /dev/null
+++ b/bindings/matlab/gd_bof.c
@@ -0,0 +1,56 @@
+/* Copyright (C) 2013 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+#include "gd_matlab.h"
+
+/*
+ % GD_BOF  Report the start of data in a field
+ %
+ %   S = GD_BOF(DIRFILE,FIELD_CODE)
+ %             reports the sample number, S,  where the data of the field
+ %             specified by FIELD_CODE starts.
+ %
+ %   The DIRFILE object should have previously been created with GD_OPEN.
+ %
+ %   See the documentation on the C API function gd_bof(3) in section 3
+ %   of the UNIX manual for more details.
+ %
+ %   See also GD_EOF, GD_OPEN, GD_NFRAMES
+ */
+
+void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])
+{
+  DIRFILE *D;
+  void *data;
+  char *field_code;
+  unsigned long long n;
+
+  GDMX_CHECK_RHS(2);
+
+  D = gdmx_to_dirfile(prhs[0]);
+  field_code = gdmx_to_string(prhs, 1, 0);
+
+  n = gd_bof64(D, field_code);
+
+  mxFree(field_code);
+  gdmx_err(D, 0);
+
+  plhs[0] = gdmx_from_ullong(n);
+}
diff --git a/bindings/matlab/gd_carray_len.c b/bindings/matlab/gd_carray_len.c
new file mode 100644
index 0000000..275ccb1
--- /dev/null
+++ b/bindings/matlab/gd_carray_len.c
@@ -0,0 +1,56 @@
+/* Copyright (C) 2013 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+#include "gd_matlab.h"
+
+/*
+ % GD_CARRAY_LEN  Report the length of a CARRAY field
+ %
+ %   L = GD_CARRAY_LEN(DIRFILE,FIELD_CODE)
+ %             reports the length, L, of the CARRAY field specified by
+ %             FIELD_CODE.
+ %
+ %   The DIRFILE object should have previously been created with GD_OPEN.
+ %
+ %   See the documentation on the C API function gd_alter_endianness(3) in
+ %   section 3 of the UNIX manual for more details.
+ %
+ %   See also GD_ENDIANNESS, GD_OPEN, GETDATA_CONSTANTS
+ */
+
+void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])
+{
+  DIRFILE *D;
+  void *data;
+  char *field_code;
+  size_t n;
+
+  GDMX_CHECK_RHS(2);
+
+  D = gdmx_to_dirfile(prhs[0]);
+  field_code = gdmx_to_string(prhs, 1, 0);
+
+  n = gd_carray_len(D, field_code);
+
+  mxFree(field_code);
+  gdmx_err(D, 0);
+
+  plhs[0] = gdmx_from_size_t(n);
+}
diff --git a/bindings/matlab/gd_carrays.c b/bindings/matlab/gd_carrays.c
new file mode 100644
index 0000000..5aa34a5
--- /dev/null
+++ b/bindings/matlab/gd_carrays.c
@@ -0,0 +1,61 @@
+/* Copyright (C) 2013 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+#include "gd_matlab.h"
+#include <string.h>
+
+/*
+ % GD_CARRAYS  Fetch all CARRAY values
+ %
+ %   A = GD_CARRAYS(DIRFILE[,TYPE])
+ %             returns a cell array of numeric arrays, A, containing all the
+ %             CARRAY data in the dirfile DIRFILE.  A corresponding array of
+ %             field names can be produced with GD_FIELD_LIST_BY_TYPE.  The
+ %             type of the returned data is given by TYPE, one of the data
+ %             type symbols provided by GETDATA_CONSTANTS.  If omitted, the
+ %             default type, GD.FLOAT64, is used.
+ %
+ %   The DIRFILE object should have previously been created with GD_OPEN.
+ %
+ %   See the documentation on the C API function gd_carrays(3) in section 3
+ %   of the UNIX manual for more details.
+ %
+ %   See also GD_MCARRAYS, GD_FIELD_LIST_BY_TYPE, GD_GET_CARRAY_SLICE
+ */
+
+void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])
+{
+  DIRFILE *D;
+  gd_type_t type = GD_FLOAT64;
+  const gd_carray_t *c;
+
+  GDMX_CHECK_RHS2(1,2);
+
+  D = gdmx_to_dirfile(prhs[0]);
+  if (nrhs > 1)
+    type = gdmx_to_gd_type(prhs, 1);
+
+  c = gd_carrays(D, type);
+
+  gdmx_err(D, 0);
+
+  /* convert to array of arrays */
+  plhs[0] = gdmx_from_carrays(c, type);
+}
diff --git a/bindings/matlab/gd_close.c b/bindings/matlab/gd_close.c
new file mode 100644
index 0000000..fff7a0d
--- /dev/null
+++ b/bindings/matlab/gd_close.c
@@ -0,0 +1,52 @@
+/* Copyright (C) 2013 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+#include "gd_matlab.h"
+
+/*
+ % GD_CLOSE  Save and close a dirfile
+ %
+ %   GD_CLOSE(DIRFILE)
+ %             flushes all changes and closes the dirfile DIRFILE.  The DIRFILE
+ %             object supplied will no longer be valid if this function
+ %             succeeds.
+ %
+ %   The DIRFILE object should have previously been created with GD_OPEN.
+ %
+ %   See the documentation on the C API function gd_close(3) in section 3
+ %   of the UNIX manual for more details.
+ %
+ %   See also GD_DISCARD, GD_OPEN, GD_FLUSH
+ */
+
+void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])
+{
+  DIRFILE *D;
+  int n;
+
+  GDMX_CHECK_RHS(1);
+
+  D = gdmx_to_dirfile(prhs[0]);
+
+  n = gd_close(D);
+
+  if (n)
+    gdmx_err(D, 1);
+}
diff --git a/bindings/matlab/gd_constants.c b/bindings/matlab/gd_constants.c
new file mode 100644
index 0000000..be42920
--- /dev/null
+++ b/bindings/matlab/gd_constants.c
@@ -0,0 +1,66 @@
+/* Copyright (C) 2013 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+#include "gd_matlab.h"
+
+/*
+ % GD_CONSTANTS  Fetch all CONST values
+ %
+ %   A = GD_CONSTANTS(DIRFILE[,TYPE])
+ %             returns a numeric array, A, containing all the CONST data in the
+ %             dirfile DIRFILE.  A corresponding array of field names can be
+ %             produced with GD_FIELD_LIST_BY_TYPE.  The type of the returned
+ %             data is given by TYPE, one of the data type symbols provided by
+ %             GETDATA_CONSTANTS.  If omitted, the default type, GD.FLOAT64, is
+ %             used.
+ %
+ %   The DIRFILE object should have previously been created with GD_OPEN.
+ %
+ %   See the documentation on the C API function gd_constants(3) in section 3
+ %   of the UNIX manual for more details.
+ %
+ %   See also GD_MCONSTANTS, GD_FIELD_LIST_BY_TYPE, GD_GET_CONSTANT,
+ %            GETDATA_CONSTANTS
+ */
+
+void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])
+{
+  DIRFILE *D;
+  const void *data;
+  unsigned int n;
+  gd_type_t type = GD_FLOAT64;
+
+  GDMX_CHECK_RHS2(1,2);
+
+  D = gdmx_to_dirfile(prhs[0]);
+  if (nrhs > 1)
+    type = gdmx_to_gd_type(prhs, 1);
+
+  data = gd_constants(D, type);
+
+  gdmx_err(D, 0);
+  
+  /* length */
+  n = gd_nfields_by_type(D, GD_CONST_ENTRY);
+
+  gdmx_err(D, 0);
+
+  plhs[0] = gdmx_from_data(data, type, n);
+}
diff --git a/bindings/matlab/gd_delete.c b/bindings/matlab/gd_delete.c
new file mode 100644
index 0000000..3c7838b
--- /dev/null
+++ b/bindings/matlab/gd_delete.c
@@ -0,0 +1,57 @@
+/* Copyright (C) 2013 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+#include "gd_matlab.h"
+
+/*
+ % GD_DELETE  Delete a field from a dirfile
+ %
+ %   GD_DELETE(DIRFILE,NAME[,FLAGS])
+ %             deletes the field called NAME from the dirfile DIRFILE.  If
+ %             given, FLAGS should be a bitwise or'd collection of zero or more
+ %             of the GD.DEL_... flags provided by GETDATA_CONSTANTS.
+ %
+ %   The DIRFILE object should have previously been created with GD_OPEN.
+ %
+ %   See the documentation on the C API function gd_delete_alias(3) in
+ %   section 3 of the UNIX manual for more details.
+ %
+ %   See also GD_DELETE_ALIAS, GD_OPEN, GETDATA_CONSTANTS
+ */
+
+void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])
+{
+  DIRFILE *D;
+  char *field_code;
+  unsigned int flags = 0;
+
+  GDMX_NO_LHS;
+  GDMX_CHECK_RHS2(2, 3);
+
+  D = gdmx_to_dirfile(prhs[0]);
+  field_code = gdmx_to_string(prhs, 1, 0);
+  if (nrhs > 2)
+    flags = gdmx_to_uint(prhs, 2);
+
+  gd_delete(D, field_code, flags);
+
+  mxFree(field_code);
+  gdmx_err(D, 0);
+}
diff --git a/bindings/matlab/gd_delete_alias.c b/bindings/matlab/gd_delete_alias.c
new file mode 100644
index 0000000..4c1ec1d
--- /dev/null
+++ b/bindings/matlab/gd_delete_alias.c
@@ -0,0 +1,57 @@
+/* Copyright (C) 2013 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+#include "gd_matlab.h"
+
+/*
+ % GD_DELETE_ALIAS  Delete an alias from a dirfile
+ %
+ %   GD_DELETE_ALIAS(DIRFILE,NAME[,FLAGS])
+ %             deletes the alias called NAME from the dirfile DIRFILE.  If
+ %             given, FLAGS should be a bitwise or'd collection of zero or more
+ %             of the GD.DEL_... flags provided by GETDATA_CONSTANTS.
+ %
+ %   The DIRFILE object should have previously been created with GD_OPEN.
+ %
+ %   See the documentation on the C API function gd_delete_alias(3) in
+ %   section 3 of the UNIX manual for more details.
+ %
+ %   See also GD_DELETE, GD_OPEN, GETDATA_CONSTANTS
+ */
+
+void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])
+{
+  DIRFILE *D;
+  char *field_code;
+  unsigned int flags = 0;
+
+  GDMX_NO_LHS;
+  GDMX_CHECK_RHS2(2, 3);
+
+  D = gdmx_to_dirfile(prhs[0]);
+  field_code = gdmx_to_string(prhs, 1, 0);
+  if (nrhs > 2)
+    flags = gdmx_to_uint(prhs, 2);
+
+  gd_delete_alias(D, field_code, flags);
+
+  mxFree(field_code);
+  gdmx_err(D, 0);
+}
diff --git a/bindings/matlab/gd_desync.c b/bindings/matlab/gd_desync.c
new file mode 100644
index 0000000..0cf4bc9
--- /dev/null
+++ b/bindings/matlab/gd_desync.c
@@ -0,0 +1,59 @@
+/* Copyright (C) 2013 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+#include "gd_matlab.h"
+
+/*
+ % GD_DESYNC  Modify the byte sex of a fragment
+ %
+ %   B = GD_DESYNC(DIRFILE[,FLAGS])
+ %             returns a boolean, B, indicating whether the dirfile DIRFILE on
+ %             disk has been changed by a third-party since having been opened
+ %             by GetData.  If given, FLAGS should be a bitwise-or'd collection
+ %             of zero or more of the GD.DESYNC_... symbols provided by
+ %             GETDATA_CONSTANTS.
+ %
+ %   The DIRFILE object should have previously been created with GD_OPEN.
+ %
+ %   See the documentation on the C API function gd_desync(3) in section 3
+ %   the UNIX manual for more details.
+ %
+ %   See also GD_OPEN, GETDATA_CONSTANTS
+ */
+
+void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])
+{
+  DIRFILE *D;
+  void *data;
+  unsigned int flags = 0;
+  int n;
+
+  GDMX_CHECK_RHS2(1,2);
+
+  D = gdmx_to_dirfile(prhs[0]);
+  if (nrhs > 1)
+    flags = gdmx_to_uint(prhs, 1);
+
+  n = gd_desync(D, 0);
+
+  gdmx_err(D, 0);
+
+  plhs[0] = gdmx_from_bool(n);
+}
diff --git a/bindings/matlab/gd_dirfile_standards.c b/bindings/matlab/gd_dirfile_standards.c
new file mode 100644
index 0000000..f40717e
--- /dev/null
+++ b/bindings/matlab/gd_dirfile_standards.c
@@ -0,0 +1,56 @@
+/* Copyright (C) 2013 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+#include "gd_matlab.h"
+
+/*
+ % GD_DIRFILE_STANDARDS  Change or report the Dirfile Standards Version
+ %
+ %   V = GD_DIRFILE_STANDARDS(DIRFILE[,VERSION])
+ %             if given, sets the standards version of DIRFILE to VERSION, which
+ %             may be a literal number or else one of the GD.VERSION_... symbols
+ %             provided by GETDATA_CONSTANTS.  Returns the current version
+ %             number, V, after possibly changing it.
+ %
+ %   The DIRFILE object should have previously been created with GD_OPEN.
+ %
+ %   See the documentation on the C API function gd_dirfile_standards(3) in
+ %   section 3 of the UNIX manual for more details.
+ %
+ %   See also GD_OPEN, GETDATA_CONSTANTS
+ */
+
+void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])
+{
+  DIRFILE *D;
+  int n, v = GD_VERSION_CURRENT;
+
+  GDMX_CHECK_RHS2(1,2);
+
+  D = gdmx_to_dirfile(prhs[0]);
+  if (nrhs > 1)
+    v = gdmx_to_int(prhs, 1);
+
+  n = gd_dirfile_standards(D, v);
+
+  gdmx_err(D, 0);
+
+  plhs[0] = gdmx_from_int(n);
+}
diff --git a/bindings/matlab/gd_dirfilename.c b/bindings/matlab/gd_dirfilename.c
new file mode 100644
index 0000000..1a52f32
--- /dev/null
+++ b/bindings/matlab/gd_dirfilename.c
@@ -0,0 +1,51 @@
+/* Copyright (C) 2013 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+#include "gd_matlab.h"
+
+/*
+ % GD_DIRFILENAME  Report the path to a dirfile
+ %
+ %   P = GD_DIRFILENAME(DIRFILE)
+ %             reports the path, P, to the dirfile DIRFILE.
+ %
+ %   The DIRFILE object should have previously been created with GD_OPEN.
+ %
+ %   See the documentation on the C API function gd_dirfilename(3) in
+ %   section 3 of the UNIX manual for more details.
+ %
+ %   See also GD_OPEN
+ */
+
+void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])
+{
+  DIRFILE *D;
+  const char *s;
+
+  GDMX_CHECK_RHS(1);
+
+  D = gdmx_to_dirfile(prhs[0]);
+
+  s = gd_dirfilename(D);
+
+  gdmx_err(D, 0);
+
+  plhs[0] = mxCreateString(s);
+}
diff --git a/bindings/matlab/gd_discard.c b/bindings/matlab/gd_discard.c
new file mode 100644
index 0000000..399e763
--- /dev/null
+++ b/bindings/matlab/gd_discard.c
@@ -0,0 +1,52 @@
+/* Copyright (C) 2013 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+#include "gd_matlab.h"
+
+/*
+ % GD_DISCARD  Close a dirfile
+ %
+ %   GD_DISCARD(DIRFILE)
+ %             discards all changes and closes the dirfile DIRFILE.  The DIRFILE
+ %             object supplied will no longer be valid if this function
+ %             succeeds.
+ %
+ %   The DIRFILE object should have previously been created with GD_OPEN.
+ %
+ %   See the documentation on the C API function gd_discard(3) in section 3
+ %   of the UNIX manual for more details.
+ %
+ %   See also GD_CLOSE, GD_OPEN
+ */
+
+void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])
+{
+  DIRFILE *D;
+  int n;
+
+  GDMX_CHECK_RHS(1);
+
+  D = gdmx_to_dirfile(prhs[0]);
+
+  n = gd_discard(D);
+
+  if (n)
+    gdmx_err(D, 1);
+}
diff --git a/bindings/matlab/gd_encoding.c b/bindings/matlab/gd_encoding.c
new file mode 100644
index 0000000..e3ff779
--- /dev/null
+++ b/bindings/matlab/gd_encoding.c
@@ -0,0 +1,55 @@
+/* Copyright (C) 2013 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+#include "gd_matlab.h"
+
+/*
+ % GD_ENCODING  Report the data encoding of a fragment
+ %
+ %   E = GD_ENCODING(DIRFILE,FRAGMENT)
+ %             reports the encoding, E, of the fragment indexed by FRAGMENT
+ %             in the dirfile DIRFILE.  The returned value will be one of the
+ %             GD.xxx_ENCODED symbols provided by GETDATA_CONSTANTS.
+ %
+ %   The DIRFILE object should have previously been created with GD_OPEN.
+ %
+ %   See the documentation on the C API function gd_encoding(3) in
+ %   section 3 of the UNIX manual for more details.
+ %
+ %   See also GD_ALTER_ENCODING, GD_OPEN, GETDATA_CONSTANTS
+ */
+
+void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])
+{
+  DIRFILE *D;
+  unsigned long n;
+  int i;
+
+  GDMX_CHECK_RHS(2);
+
+  D = gdmx_to_dirfile(prhs[0]);
+  i = gdmx_to_int(prhs, 1);
+
+  n = gd_encoding(D, i);
+
+  gdmx_err(D, 0);
+
+  plhs[0] = gdmx_from_ulong(n);
+}
diff --git a/bindings/matlab/gd_endianness.c b/bindings/matlab/gd_endianness.c
new file mode 100644
index 0000000..5f90fb0
--- /dev/null
+++ b/bindings/matlab/gd_endianness.c
@@ -0,0 +1,56 @@
+/* Copyright (C) 2013 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+#include "gd_matlab.h"
+
+/*
+ % GD_ENDIANNESS  Report the data byte sex of a fragment
+ %
+ %   E = GD_ENDIANNESS(DIRFILE,FRAGMENT)
+ %             reports the byte sex, E, of the fragment indexed by FRAGMENT
+ %             in the dirfile DIRFILE.  The returned value will (almost always)
+ %             be either GD.BIG_ENDIAN or GD.LITTLE_ENDIAN, which are provided
+ %             by GETDATA_CONSTANTS.
+ %
+ %   The DIRFILE object should have previously been created with GD_OPEN.
+ %
+ %   See the documentation on the C API function gd_endiannes(3) in
+ %   section 3 of the UNIX manual for more details.
+ %
+ %   See also GD_ALTER_ENDIANNESS, GD_OPEN, GETDATA_CONSTANTS
+ */
+
+void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])
+{
+  DIRFILE *D;
+  unsigned long n;
+  int i;
+
+  GDMX_CHECK_RHS(2);
+
+  D = gdmx_to_dirfile(prhs[0]);
+  i = gdmx_to_int(prhs, 1);
+
+  n = gd_endianness(D, i);
+
+  gdmx_err(D, 0);
+
+  plhs[0] = gdmx_from_ulong(n);
+}
diff --git a/bindings/matlab/gd_entry.c b/bindings/matlab/gd_entry.c
new file mode 100644
index 0000000..69aaa05
--- /dev/null
+++ b/bindings/matlab/gd_entry.c
@@ -0,0 +1,59 @@
+/* Copyright (C) 2013 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+#include "gd_matlab.h"
+
+/*
+ % GD_ENTRY  Retrieve field metadata
+ %
+ %   E = GD_ENTRY(DIRFILE,FIELD_CODE)
+ %             returns an structure, E, containing the metadata of the field
+ %             specified by FIELD_CODE in the dirfile DIRFILE.  See GETDATA 
+ %             and the corresponding C API documentation for information on
+ %             this structure.
+ %
+ %   The DIRFILE object should have previously been created with GD_OPEN.
+ %
+ %   See the documentation on the C API function gd_entry(3) in section 3
+ %   of the UNIX manual for more details.
+ %
+ %   See also GD_ADD, GD_ENTRY_TYPE, GD_ALTER_ENTRY, GD_OPEN, GETDATA
+ */
+
+void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])
+{
+  DIRFILE *D;
+  void *data;
+  char *field_code;
+  gd_entry_t E;
+
+  GDMX_CHECK_RHS(2);
+
+  D = gdmx_to_dirfile(prhs[0]);
+  field_code = gdmx_to_string(prhs, 1, 0);
+
+  gd_entry(D, field_code, &E);
+
+  mxFree(field_code);
+  gdmx_err(D, 0);
+
+  plhs[0] = gdmx_from_entry(&E);
+  gd_free_entry_strings(&E);
+}
diff --git a/bindings/matlab/gd_entry_list.c b/bindings/matlab/gd_entry_list.c
new file mode 100644
index 0000000..d365921
--- /dev/null
+++ b/bindings/matlab/gd_entry_list.c
@@ -0,0 +1,69 @@
+/* Copyright (C) 2013 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+#include "gd_matlab.h"
+
+/*
+ % GD_ENTRY_LIST  Retrieve a list of field names
+ %
+ %   L = GD_ENTRY_LIST(DIRFILE[,PARENT[,TYPE[,FLAGS]]])
+ %             returns a cell array of strings, L, listing all fields in the
+ %             dirfile DIRFILE which satisfy the supplied PARENT, TYPE, and/or
+ %             FLAGS.
+ %
+ %   If PARENT is given, and not numeric zero, metafields of the specified
+ %   parent field will be searched.  Otherwise, only top level fields are
+ %   considered.  If non-zero (matching all types), TYPE should be either one
+ %   of the GD.xxx_ENTRY symbols or else one of the special GD.xxx_ENTRIES
+ %   symbols provided by GETDATA_CONSTANTS.  FLAGS, if given, should be zero
+ %   or more of the GD.ENTRIES_... flags, bitwise or'd together.
+ %
+ %   The DIRFILE object should have previously been created with GD_OPEN.
+ %
+ %   See the documentation on the C API function gd_entry_list(3) in
+ %   section 3 of the UNIX manual for more details.
+ %
+ %   See also GD_NENTRIES, GD_OPEN, GETDATA_CONSTANTS
+ */
+
+void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])
+{
+  DIRFILE *D;
+  char *parent = NULL;
+  unsigned int type = 0, flags = 0;
+  const char **fl;
+
+  GDMX_CHECK_RHS2(1,4);
+
+  D = gdmx_to_dirfile(prhs[0]);
+  if (nrhs > 1)
+    parent = gdmx_to_string(prhs, 1, 1);
+  if (nrhs > 2)
+    type = gdmx_to_uint(prhs, 2);
+  if (nrhs > 3)
+    flags = gdmx_to_uint(prhs, 3);
+
+  fl = gd_entry_list(D, parent, type, flags);
+
+  mxFree(parent);
+  gdmx_err(D, 0);
+
+  plhs[0] = gdmx_from_string_list(fl);
+}
diff --git a/bindings/matlab/gd_entry_type.c b/bindings/matlab/gd_entry_type.c
new file mode 100644
index 0000000..f70ac83
--- /dev/null
+++ b/bindings/matlab/gd_entry_type.c
@@ -0,0 +1,57 @@
+/* Copyright (C) 2013 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+#include "gd_matlab.h"
+
+/*
+ % GD_ENTRY_TYPE  Retrieve the field type of a field
+ %
+ %   T = GD_ENTRY_TYPE(DIRFILE,FIELD_CODE)
+ %             returns the entry type, T, of the field specified by FIELD_CODE
+ %             in the dirfile DIRFILE.  The returned value will be one of the
+ %             GD.xxx_ENTRY symbols provided by GETDATA_CONSTANTS.
+ %
+ %   The DIRFILE object should have previously been created with GD_OPEN.
+ %
+ %   See the documentation on the C API function gd_entry_type(3) in section 3
+ %   of the UNIX manual for more details.
+ %
+ %   See also GD_ENTRY, GD_OPEN, GETDATA_CONSTANTS
+ */
+
+void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])
+{
+  DIRFILE *D;
+  void *data;
+  char *field_code;
+  gd_entype_t t;
+
+  GDMX_CHECK_RHS(2);
+
+  D = gdmx_to_dirfile(prhs[0]);
+  field_code = gdmx_to_string(prhs, 1, 0);
+
+  t = gd_entry_type(D, field_code);
+
+  mxFree(field_code);
+  gdmx_err(D, 0);
+
+  plhs[0] = gdmx_from_entype(t);
+}
diff --git a/bindings/matlab/gd_eof.c b/bindings/matlab/gd_eof.c
new file mode 100644
index 0000000..6e85037
--- /dev/null
+++ b/bindings/matlab/gd_eof.c
@@ -0,0 +1,56 @@
+/* Copyright (C) 2013 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+#include "gd_matlab.h"
+
+/*
+ % GD_EOF  Report the end of data in a field
+ %
+ %   S = GD_EOF(DIRFILE,FIELD_CODE)
+ %             reports the sample number, S,  where the data of the field
+ %             specified by FIELD_CODE ends.
+ %
+ %   The DIRFILE object should have previously been created with GD_OPEN.
+ %
+ %   See the documentation on the C API function gd_bof(3) in section 3
+ %   of the UNIX manual for more details.
+ %
+ %   See also GD_BOF, GD_OPEN, GD_NFRAMES
+ */
+
+void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])
+{
+  DIRFILE *D;
+  void *data;
+  char *field_code;
+  unsigned long long n;
+
+  GDMX_CHECK_RHS(2);
+
+  D = gdmx_to_dirfile(prhs[0]);
+  field_code = gdmx_to_string(prhs, 1, 0);
+
+  n = gd_eof64(D, field_code);
+
+  mxFree(field_code);
+  gdmx_err(D, 0);
+
+  plhs[0] = gdmx_from_ullong(n);
+}
diff --git a/bindings/matlab/gd_error.c b/bindings/matlab/gd_error.c
new file mode 100644
index 0000000..55067d5
--- /dev/null
+++ b/bindings/matlab/gd_error.c
@@ -0,0 +1,54 @@
+/* Copyright (C) 2013 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+#include "gd_matlab.h"
+
+/*
+ % GD_ERROR  Report the C library error code
+ %
+ %   E = GD_ERROR(DIRFILE)
+ %             returns the error code, E, associated with the last call to the
+ %             C GetData library.  This will be one of the GD.E_... symbols
+ %             provided by GETDATA_CONSTANTS.  Since the MATLAB bindings throw
+ %             exceptions on library error, it is only ever useful to use this
+ %             inside a CATCH block after a GetData Library error has been
+ %             thrown.
+ %
+ %   The DIRFILE object should have previously been created with GD_OPEN.
+ %
+ %   See the documentation on the C API function gd_error(3) in section 3
+ %   of the UNIX manual for more details.
+ %
+ %   See also GD_ERROR_STRING, GD_OPEN
+ */
+
+void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])
+{
+  DIRFILE *D;
+  int e;
+
+  GDMX_CHECK_RHS(1);
+
+  D = gdmx_to_dirfile(prhs[0]);
+
+  e = gd_error(D);
+
+  plhs[0] = gdmx_from_int(e);
+}
diff --git a/bindings/matlab/gd_error_string.c b/bindings/matlab/gd_error_string.c
new file mode 100644
index 0000000..c6969eb
--- /dev/null
+++ b/bindings/matlab/gd_error_string.c
@@ -0,0 +1,55 @@
+/* Copyright (C) 2013 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+#include "gd_matlab.h"
+
+/*
+ % GD_ERROR_STRING  retrieve the library error string
+ %
+ %   S = GD_ERROR_STRING(DIRFILE)
+ %             returns the error string, S, associated with the last call to the
+ %             C GetData library.  Since the MATLAB bindings throw exceptions
+ %             on library error, it is only ever useful to use this inside a
+ %             CATCH block after a GetData Library error has been thrown.  In
+ %             this case, the .message member of thrown MEXCEPTION object also
+ %             contains this string.
+ %
+ %   The DIRFILE object should have previously been created with GD_OPEN.
+ %
+ %   See the documentation on the C API function gd_error_string(3) in section 3
+ %   of the UNIX manual for more details.
+ %
+ %   See also GD_ERROR, GD_OPEN
+ */
+
+void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])
+{
+  DIRFILE *D;
+  char *s;
+
+  GDMX_CHECK_RHS(1);
+
+  D = gdmx_to_dirfile(prhs[0]);
+
+  s = gd_error_string(D, NULL, 0);
+
+  plhs[0] = gdmx_from_string(s);
+  free(s);
+}
diff --git a/bindings/matlab/gd_field_list.m b/bindings/matlab/gd_field_list.m
new file mode 100644
index 0000000..780b279
--- /dev/null
+++ b/bindings/matlab/gd_field_list.m
@@ -0,0 +1,30 @@
+function field_list = gd_field_list(D)
+% GD_FIELD_LIST  Retrieve a list of field names
+%
+%   GD_FIELD_LIST_BY_TYPE(DIRFILE)
+%             is equivalent to calling GD_ENTRY_LIST(DIRFILE,0,0,0)
+%
+%   See also GD_ENTRY_LIST
+
+  field_list = gd_entry_list(D, 0, 0, 0);
+end
+
+% Copyright (C) 2013 D. V. Wiebe
+%
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%
+% This file is part of the GetData project.
+%
+% GetData is free software; you can redistribute it and/or modify it under
+% the terms of the GNU Lesser General Public License as published by the
+% Free Software Foundation; either version 2.1 of the License, or (at your
+% option) any later version.
+%
+% GetData is distributed in the hope that it will be useful, but WITHOUT
+% ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+% FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+% License for more details.
+%
+% You should have received a copy of the GNU Lesser General Public License
+% along with GetData; if not, write to the Free Software Foundation, Inc.,
+% 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
diff --git a/bindings/matlab/gd_field_list_by_type.m b/bindings/matlab/gd_field_list_by_type.m
new file mode 100644
index 0000000..f73869d
--- /dev/null
+++ b/bindings/matlab/gd_field_list_by_type.m
@@ -0,0 +1,30 @@
+function field_list = gd_field_list_by_type(D, type)
+% GD_FIELD_LIST_BY_TYPE  Retrieve a list of field names
+%
+%   GD_FIELD_LIST_BY_TYPE(DIRFILE,TYPE)
+%             is equivalent to calling GD_ENTRY_LIST(DIRFILE,0,TYPE,0)
+%
+%   See also GD_ENTRY_LIST
+
+  field_list = gd_entry_list(D, 0, type, 0);
+end
+
+% Copyright (C) 2013 D. V. Wiebe
+%
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%
+% This file is part of the GetData project.
+%
+% GetData is free software; you can redistribute it and/or modify it under
+% the terms of the GNU Lesser General Public License as published by the
+% Free Software Foundation; either version 2.1 of the License, or (at your
+% option) any later version.
+%
+% GetData is distributed in the hope that it will be useful, but WITHOUT
+% ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+% FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+% License for more details.
+%
+% You should have received a copy of the GNU Lesser General Public License
+% along with GetData; if not, write to the Free Software Foundation, Inc.,
+% 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
diff --git a/bindings/matlab/gd_flags.c b/bindings/matlab/gd_flags.c
new file mode 100644
index 0000000..3423d12
--- /dev/null
+++ b/bindings/matlab/gd_flags.c
@@ -0,0 +1,57 @@
+/* Copyright (C) 2013 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+#include "gd_matlab.h"
+
+/*
+ % GD_FLAGS  Modify or report dirfile flags
+ %
+ %   F = GD_FLAGS(DIRFILE,SET,RESET)
+ %             sets the operational flags of the dirfile DIRFILE according to 
+ %             SET and RESET, which should be bitwise or'd collections of the
+ %             Dirfile flags provided by GETDATA_CONSTANTS.  This function then
+ %             returns the update flag register, F.
+ %
+ %   The DIRFILE object should have previously been created with GD_OPEN.
+ %
+ %   See the documentation on the C API function gd_flags(3) in section 3
+ %   of the UNIX manual for more details.
+ %
+ %   See also GD_OPEN, GETDATA_CONSTANTS
+ */
+
+void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])
+{
+  DIRFILE *D;
+  void *data;
+  unsigned long set, reset, flags;
+
+  GDMX_CHECK_RHS(3);
+
+  D = gdmx_to_dirfile(prhs[0]);
+  set = gdmx_to_ulong(prhs, 1);
+  reset = gdmx_to_ulong(prhs, 2);
+
+  flags = gd_flags(D, set, reset);
+
+  gdmx_err(D, 0);
+
+  plhs[0] = gdmx_from_ulong(flags);
+}
diff --git a/bindings/matlab/gd_flush.c b/bindings/matlab/gd_flush.c
new file mode 100644
index 0000000..b065036
--- /dev/null
+++ b/bindings/matlab/gd_flush.c
@@ -0,0 +1,57 @@
+/* Copyright (C) 2013 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+#include "gd_matlab.h"
+
+/*
+ % GD_FLUSH  Flush and close modified data files
+ %
+ %   GD_FLUSH(DIRFILE[,FIELD_CODE])
+ %             flushes the binary data files associated with the dirfile DIRFILE
+ %             to disk, and then closes open files.  If FIELD_CODE is given and
+ %             not numeric zero, only the specified field is flushed.  Otherwise
+ %             all open data files are flushed and closed.  In this second case,
+ %             modified metadata is also flushed.
+ %
+ %   The DIRFILE object should have previously been created with GD_OPEN.
+ %
+ %   See the documentation on the C API function gd_flush(3) in section 3
+ %   of the UNIX manual for more details.
+ %
+ %   See also GD_CLOSE, GD_SYNC, GD_RAW_CLOSE, GD_OPEN
+ */
+
+void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])
+{
+  DIRFILE *D;
+  char *field_code = NULL;
+
+  GDMX_NO_LHS;
+  GDMX_CHECK_RHS2(1,2);
+
+  D = gdmx_to_dirfile(prhs[0]);
+  if (nrhs > 1)
+    field_code = gdmx_to_string(prhs, 1, 1);
+
+  gd_flush(D, field_code);
+
+  mxFree(field_code);
+  gdmx_err(D, 0);
+}
diff --git a/bindings/matlab/gd_fragment_affixes.c b/bindings/matlab/gd_fragment_affixes.c
new file mode 100644
index 0000000..7999a0c
--- /dev/null
+++ b/bindings/matlab/gd_fragment_affixes.c
@@ -0,0 +1,60 @@
+/* Copyright (C) 2013 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+#include "gd_matlab.h"
+
+/*
+ % GD_FRAGMENT_AFFIXES  Retrieve the affixes of an included fragment
+ %
+ %  L = GD_FRAGMENT_AFFIXES(DIRFILE,FRAGMENT)
+ %             returns a two-element cell array containing the prefix and suffix
+ %             (in that order) of the fragment specified by FRAGMENT in the
+ %             dirfile DIRFILE.  If an affix is empty, numeric zero will be
+ %             reported in the corresponding cell.
+ %
+ %   The DIRFILE object should have previously been created with GD_OPEN.
+ %
+ %   See the documentation on the C API function gd_fragment_affixes(3) in
+ %   section 3 of the UNIX manual for more details.
+ %
+ %   See also GD_ALTER_AFFIXES, GD_INCLUDE, GD_OPEN
+ */
+
+void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])
+{
+  DIRFILE *D;
+  int fragment_index;
+  char *al[3];
+
+  GDMX_CHECK_RHS(2);
+
+  D = gdmx_to_dirfile(prhs[0]);
+  fragment_index = gdmx_to_int(prhs, 1);
+
+  gd_fragment_affixes(D, fragment_index, al, al + 1);
+  al[2] = NULL;
+
+  gdmx_err(D, 0);
+
+  plhs[0] = gdmx_from_string_list((const char**)al);
+
+  free(al[0]);
+  free(al[1]);
+}
diff --git a/bindings/matlab/gd_fragment_index.c b/bindings/matlab/gd_fragment_index.c
new file mode 100644
index 0000000..5d647b1
--- /dev/null
+++ b/bindings/matlab/gd_fragment_index.c
@@ -0,0 +1,56 @@
+/* Copyright (C) 2013 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+#include "gd_matlab.h"
+
+/*
+ % GD_FRAGMENT_INDEX  Report the fragment index of a field
+ %
+ %   I = GD_FRAGMENT_INDEX(DIRFILE,FIELD_CODE)
+ %             returns the fragment index, I, of the field specified by
+ %             FIELD_CODE in the dirfile DIRFILE.
+ %
+ %   The DIRFILE object should have previously been created with GD_OPEN.
+ %
+ %   See the documentation on the C API function gd_fragment_index(3) in
+ %   section 3 of the UNIX manual for more details.
+ %
+ %   See also GD_ENTRY, GD_OPEN
+ */
+
+void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])
+{
+  DIRFILE *D;
+  void *data;
+  char *field_code;
+  int n;
+
+  GDMX_CHECK_RHS(2);
+
+  D = gdmx_to_dirfile(prhs[0]);
+  field_code = gdmx_to_string(prhs, 1, 0);
+
+  n = gd_fragment_index(D, field_code);
+
+  mxFree(field_code);
+  gdmx_err(D, 0);
+
+  plhs[0] = gdmx_from_int(n);
+}
diff --git a/bindings/matlab/gd_fragmentname.c b/bindings/matlab/gd_fragmentname.c
new file mode 100644
index 0000000..10a2c7f
--- /dev/null
+++ b/bindings/matlab/gd_fragmentname.c
@@ -0,0 +1,54 @@
+/* Copyright (C) 2013 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+#include "gd_matlab.h"
+
+/*
+ % GD_FRAGMENTNAME  Report the pathname of a metdata fragment
+ %
+ %   P = GD_FRAGMENTNAME(DIRFILE,FRAGMENT)
+ %             reports the pathname, P, of the fragment indexed by FRAGMENT in
+ %             the dirfile DIRFILE.
+ %
+ %   The DIRFILE object should have previously been created with GD_OPEN.
+ %
+ %   See the documentation on the C API function gd_fragmentname(3) in section 3
+ %   of the UNIX manual for more details.
+ %
+ %   See also GD_OPEN, GD_INCLUDE
+ */
+
+void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])
+{
+  DIRFILE *D;
+  const char *s;
+  int i;
+
+  GDMX_CHECK_RHS(2);
+
+  D = gdmx_to_dirfile(prhs[0]);
+  i = gdmx_to_int(prhs, 1);
+
+  s = gd_fragmentname(D, i);
+
+  gdmx_err(D, 0);
+
+  plhs[0] = mxCreateString(s);
+}
diff --git a/bindings/matlab/gd_framenum.c b/bindings/matlab/gd_framenum.c
new file mode 100644
index 0000000..f9902e7
--- /dev/null
+++ b/bindings/matlab/gd_framenum.c
@@ -0,0 +1,64 @@
+/* Copyright (C) 2013 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+#include "gd_matlab.h"
+
+/*
+ % GD_FRAMENUM  Reverse look-up on a field
+ %
+ %   F = GD_FRAMENUM(DIRFILE,FIELD_CODE,VALUE[,START[,END]])
+ %             performs a reverse look-up on the field FIELD_CODE, reporting the
+ %             (fractional) frame number, F, where it takes on the value VALUE.
+ %             If given and non-zero, only the portion of the field between
+ %             START and END are considered.
+ %
+ %   The DIRFILE object should have previously been created with GD_OPEN.
+ %
+ %   See the documentation on the C API function gd_framenum_subset(3) in
+ %   section 3 of the UNIX manual for more details.
+ %
+ %   See also GD_BOF, GD_EOF, GD_OPEN, GD_GETDATA
+ */
+
+void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])
+{
+  DIRFILE *D;
+  void *data;
+  char *field_code;
+  double r, value;
+  long long first_samp = 0, last_samp = 0;
+
+  GDMX_CHECK_RHS2(3,5);
+
+  D = gdmx_to_dirfile(prhs[0]);
+  field_code = gdmx_to_string(prhs, 1, 0);
+  value = gdmx_to_double(prhs, 2);
+  if (nrhs > 3)
+    first_samp = gdmx_to_llong(prhs, 3);
+  if (nrhs > 4)
+    last_samp = gdmx_to_llong(prhs, 4);
+
+  r = gd_framenum_subset64(D, field_code, value, first_samp, last_samp);
+
+  mxFree(field_code);
+  gdmx_err(D, 0);
+
+  plhs[0] = gdmx_from_double(r);
+}
diff --git a/bindings/matlab/gd_frameoffset.c b/bindings/matlab/gd_frameoffset.c
new file mode 100644
index 0000000..c19b0f5
--- /dev/null
+++ b/bindings/matlab/gd_frameoffset.c
@@ -0,0 +1,54 @@
+/* Copyright (C) 2013 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+#include "gd_matlab.h"
+
+/*
+ % GD_FRAMEOFFSET  Report the frame offset of a fragment
+ %
+ %   O = GD_FRAME_OFFSET(DIRFILE,FRAGMENT)
+ %             reports the frame offset of the fragment specified by FRAGMENT
+ %             in the dirfile DIRFILE.
+ %
+ %   The DIRFILE object should have previously been created with GD_OPEN.
+ %
+ %   See the documentation on the C API function gd_frame_offset(3) in section 3
+ %   of the UNIX manual for more details.
+ %
+ %   See also GD_ALTER_FRAMEOFFSET, GD_OPEN
+ */
+
+void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])
+{
+  DIRFILE *D;
+  unsigned long long n;
+  int i;
+
+  GDMX_CHECK_RHS(2);
+
+  D = gdmx_to_dirfile(prhs[0]);
+  i = gdmx_to_int(prhs, 1);
+
+  n = gd_frameoffset64(D, i);
+
+  gdmx_err(D, 0);
+
+  plhs[0] = gdmx_from_ullong(n);
+}
diff --git a/bindings/matlab/gd_get_carray.c b/bindings/matlab/gd_get_carray.c
new file mode 100644
index 0000000..4a5fdb5
--- /dev/null
+++ b/bindings/matlab/gd_get_carray.c
@@ -0,0 +1,70 @@
+/* Copyright (C) 2013 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+#include "gd_matlab.h"
+
+/*
+ % GD_GET_CARRAY  Retrieve CARRAY data
+ %
+ %   A = GD_GET_CARRAY(DIRFILE,FIELD_CODE[,TYPE])
+ %             retrieves an array, A, of value of the CARRAY field called
+ %             FIELD_CODE.  If type is given, it should be one of the data type
+ %             symbols provided by GETDATA_CONSTANTS, otherwise the data are
+ %             returned in their native type.
+ %
+ %   The DIRFILE object should have previously been created with GD_OPEN.
+ %
+ %   See the documentation on the C API function gd_get_carray_slice(3) in
+ %   section 3 of the UNIX manual for more details.
+ %
+ %   See also GD_GET_CARRAY_SLICE, GD_PUT_CARRAY, GD_OPEN, GETDATA_CONSTANTS
+ */
+
+void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])
+{
+  DIRFILE *D;
+  void *data;
+  char *field_code;
+  gd_type_t type;
+  size_t len;
+
+  GDMX_CHECK_RHS2(2,3);
+
+  D = gdmx_to_dirfile(prhs[0]);
+  field_code = gdmx_to_string(prhs, 1, 0);
+  if (nrhs > 2)
+    type = gdmx_to_gd_type(prhs, 2);
+  else {
+    type = gd_native_type(D, field_code);
+    gdmx_err(D, 0);
+  }
+
+  len = gd_carray_len(D, field_code);
+  gdmx_err(D, 0);
+
+  plhs[0] = gdmx_vector(type, len, &data);
+
+  gd_get_carray(D, field_code, type, data);
+
+  mxFree(field_code);
+  gdmx_err(D, 0);
+
+  gdmx_fix_vector(plhs[0], type, len, data);
+}
diff --git a/bindings/matlab/gd_get_carray_slice.c b/bindings/matlab/gd_get_carray_slice.c
new file mode 100644
index 0000000..7dc8245
--- /dev/null
+++ b/bindings/matlab/gd_get_carray_slice.c
@@ -0,0 +1,71 @@
+/* Copyright (C) 2013 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+#include "gd_matlab.h"
+
+/*
+ % GD_GET_CARRAY_SLICE  Retrieve CARRAY data
+ %
+ %   A = GD_GET_CARRAY_SLICE(DIRFILE,FIELD_CODE,START,LEN[,TYPE])
+ %             retrieves a subset, A, of the CARRAY field called FIELD_CODE.
+ %             LEN elements are retrieved, starting with element START.  If type
+ %             is given, it should be one of the data type symbols provided by
+ %             GETDATA_CONSTANTS, otherwise the data are returned in their
+ %             native type.
+ %
+ %   The DIRFILE object should have previously been created with GD_OPEN.
+ %
+ %   See the documentation on the C API function gd_get_carray_slice(3) in
+ %   section 3 of the UNIX manual for more details.
+ %
+ %   See also GD_GET_CARRAY, GD_PUT_CARRAY_SLICE, GD_OPEN, GETDATA_CONSTANTS
+ */
+
+void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])
+{
+  DIRFILE *D;
+  void *data;
+  char *field_code;
+  unsigned int start;
+  size_t len;
+  gd_type_t type;
+
+  GDMX_CHECK_RHS2(4,5);
+
+  D = gdmx_to_dirfile(prhs[0]);
+  field_code = gdmx_to_string(prhs, 1, 0);
+  start = gdmx_to_uint(prhs, 2);
+  len = gdmx_to_size_t(prhs, 3);
+  if (nrhs > 4)
+    type = gdmx_to_gd_type(prhs, 4);
+  else {
+    type = gd_native_type(D, field_code);
+    gdmx_err(D, 0);
+  }
+
+  plhs[0] = gdmx_vector(type, len, &data);
+
+  gd_get_carray_slice(D, field_code, start, len, type, data);
+
+  mxFree(field_code);
+  gdmx_err(D, 0);
+
+  gdmx_fix_vector(plhs[0], type, len, data);
+}
diff --git a/bindings/matlab/gd_get_constant.m b/bindings/matlab/gd_get_constant.m
new file mode 100644
index 0000000..08ce4c8
--- /dev/null
+++ b/bindings/matlab/gd_get_constant.m
@@ -0,0 +1,37 @@
+function n = gd_get_constant(D, field_code, varargin)
+% GD_GET_CONSTANT  Retrieve CONST data
+%
+%   N = GD_GET_CONSTANT(DIRFILE,FIELD,TYPE)
+%             is equivalent to N = GD_GET_CARRAY_SLICE(DIRFILE,FIELD,0,1,TYPE)
+%
+%   N = GD_GET_CONSTANT(DIRFILE,FIELD)
+%             is equivalent to N = GD_GET_CARRAY_SLICE(DIRFILE,FIELD,0,1)
+%
+%   See also GD_GET_CARRAY_SLICE
+
+if (numel(varargin) > 0)
+  n = gd_get_carray_slice(D, field_code, 0, 1, varargin{1});
+else
+  n = gd_get_carray_slice(D, field_code, 0, 1);
+end
+end
+
+% Copyright (C) 2013 D. V. Wiebe
+%
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%
+% This file is part of the GetData project.
+%
+% GetData is free software; you can redistribute it and/or modify it under
+% the terms of the GNU Lesser General Public License as published by the
+% Free Software Foundation; either version 2.1 of the License, or (at your
+% option) any later version.
+%
+% GetData is distributed in the hope that it will be useful, but WITHOUT
+% ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+% FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+% License for more details.
+%
+% You should have received a copy of the GNU Lesser General Public License
+% along with GetData; if not, write to the Free Software Foundation, Inc.,
+% 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
diff --git a/bindings/matlab/gd_get_string.c b/bindings/matlab/gd_get_string.c
new file mode 100644
index 0000000..e47a699
--- /dev/null
+++ b/bindings/matlab/gd_get_string.c
@@ -0,0 +1,64 @@
+/* Copyright (C) 2013 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+#include "gd_matlab.h"
+
+/*
+ % GD_GET_CARRAY  Retrieve STRING data
+ %
+ %   S = GD_GET_CARRAY(DIRFILE,FIELD_CODE)
+ %             retrieves the value, S, the STRING field called FIELD_CODE.
+ %
+ %   The DIRFILE object should have previously been created with GD_OPEN.
+ %
+ %   See the documentation on the C API function gd_get_string(3) in
+ %   section 3 of the UNIX manual for more details.
+ %
+ %   See also GD_PUT_STRING, GD_OPEN
+ */
+
+void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])
+{
+  DIRFILE *D;
+  void *data;
+  char *field_code;
+  size_t len;
+  char *s;
+
+  GDMX_CHECK_RHS(2);
+
+  D = gdmx_to_dirfile(prhs[0]);
+  field_code = gdmx_to_string(prhs, 1, 0);
+
+  /* get length */
+  len = gd_get_string(D, field_code, 0, NULL);
+
+  gdmx_err(D, 0);
+
+  s = mxMalloc(len);
+
+  gd_get_string(D, field_code, len, s);
+
+  mxFree(field_code);
+  gdmx_err(D, 0);
+
+  plhs[0] = mxCreateString(s);
+  mxFree(s);
+}
diff --git a/bindings/matlab/gd_getdata.c b/bindings/matlab/gd_getdata.c
new file mode 100644
index 0000000..176e4a6
--- /dev/null
+++ b/bindings/matlab/gd_getdata.c
@@ -0,0 +1,75 @@
+/* Copyright (C) 2013 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+#include "gd_matlab.h"
+
+/*
+ % GD_GETDATA  Retrieve vector data
+ %
+ %   V = GD_GETDATA(DIRFILE,FIELD_CODE,FIRST_FRAME,FIRST_SAMP,NFRAMES,NSAMP ...
+ %                  [,TYPE])
+ %             retrieves a vector, V, of NFRAMES frames plus NSAMPLES samples of
+ %             data from the vector field FIELD_CODE starting FIRST_SAMP samples
+ %             past the start of FIRST_FRAME.  If type is given, it should be
+ %             one of the data type symbols provided by GETDATA_CONSTANTS,
+ %             otherwise the data are returned in their native type.
+ %
+ %   The DIRFILE object should have previously been created with GD_OPEN.
+ %
+ %   See the documentation on the C API function gd_getdata(3) in
+ %   section 3 of the UNIX manual for more details.
+ %
+ %   See also GD_PUTDATA, GD_OPEN
+ */
+
+
+void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])
+{
+  DIRFILE *D;
+  void *data;
+  char *field_code;
+  long long first_frame, first_samp;
+  size_t nsamp;
+  gd_type_t type;
+
+  GDMX_CHECK_RHS2(6,7);
+
+  D = gdmx_to_dirfile(prhs[0]);
+  field_code = gdmx_to_string(prhs, 1, 0);
+  first_frame = gdmx_to_llong(prhs, 2);
+  first_samp = gdmx_to_llong(prhs, 3);
+  nsamp = gdmx_to_nsamp(D, field_code, prhs, 4, 5);
+  if (nrhs > 6)
+    type = gdmx_to_gd_type(prhs, 6);
+  else {
+    type = gd_native_type(D, field_code);
+    gdmx_err(D, 0);
+  }
+
+  plhs[0] = gdmx_vector(type, nsamp, &data);
+
+  gd_getdata64(D, field_code, (gd_off64_t)first_frame, (gd_off64_t)first_samp,
+      0, nsamp, type, data);
+
+  mxFree(field_code);
+  gdmx_err(D, 0);
+
+  gdmx_fix_vector(plhs[0], type, nsamp, data);
+}
diff --git a/bindings/matlab/gd_hidden.c b/bindings/matlab/gd_hidden.c
new file mode 100644
index 0000000..afbbe10
--- /dev/null
+++ b/bindings/matlab/gd_hidden.c
@@ -0,0 +1,55 @@
+/* Copyright (C) 2013 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+#include "gd_matlab.h"
+
+/*
+ % GD_HIDDEN  Report whether a field is hidden
+ %
+ %   B = GD_HIDDEN(DIRFILE,FIELD_CODE)
+ %             returns boolean true, B, if FIELD_CODE is hidden in the metadata.
+ %
+ %   The DIRFILE object should have previously been created with GD_OPEN.
+ %
+ %   See the documentation on the C API function gd_hidden(3) in section 3
+ %   of the UNIX manual for more details.
+ %
+ %   See also GD_HIDE, GD_UNHIDE, GD_OPEN
+ */
+
+void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])
+{
+  DIRFILE *D;
+  void *data;
+  char *field_code;
+  int n;
+
+  GDMX_CHECK_RHS(2);
+
+  D = gdmx_to_dirfile(prhs[0]);
+  field_code = gdmx_to_string(prhs, 1, 0);
+
+  n = gd_hidden(D, field_code);
+
+  mxFree(field_code);
+  gdmx_err(D, 0);
+
+  plhs[0] = gdmx_from_bool(n);
+}
diff --git a/bindings/matlab/gd_hide.c b/bindings/matlab/gd_hide.c
new file mode 100644
index 0000000..a607775
--- /dev/null
+++ b/bindings/matlab/gd_hide.c
@@ -0,0 +1,52 @@
+/* Copyright (C) 2013 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+#include "gd_matlab.h"
+
+/*
+ % GD_HIDE  Hide a field
+ %
+ %   GD_HIDE(DIRFILE,FIELD_CODE)
+ %             hides the field called FIELD_CODE.
+ %
+ %   The DIRFILE object should have previously been created with GD_OPEN.
+ %
+ %   See the documentation on the C API function gd_hide(3) in section 3
+ %   of the UNIX manual for more details.
+ %
+ %   See also GD_HIDDEN, GD_UNHIDE, GD_OPEN
+ */
+
+void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])
+{
+  DIRFILE *D;
+  char *field_code;
+
+  GDMX_NO_LHS;
+  GDMX_CHECK_RHS(2);
+
+  D = gdmx_to_dirfile(prhs[0]);
+  field_code = gdmx_to_string(prhs, 1, 0);
+
+  gd_hide(D, field_code);
+
+  mxFree(field_code);
+  gdmx_err(D, 0);
+}
diff --git a/bindings/matlab/gd_include.c b/bindings/matlab/gd_include.c
new file mode 100644
index 0000000..fc6551a
--- /dev/null
+++ b/bindings/matlab/gd_include.c
@@ -0,0 +1,69 @@
+/* Copyright (C) 2013 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+#include "gd_matlab.h"
+
+/*
+ % GD_INCLUDE  Add a format metadata fragment
+ %
+ %   GD_INCLUDE(DIRFILE,PATH,PARENT,FLAGS[,PREFIX[,SUFFIX]])
+ %             adds the fragment at PATH to the open dirfile DIRFILE below the
+ %             current fragment indexed by PARENT.  FLAGS should be zero or more
+ %             Dirfile flags provided by GETDATA_CONSTANTS, bitwise-or'd
+ %             together.  If given an not numeric zero, PREFIX and SUFFIX
+ %             provide the fragment affixes.
+ %
+ %   The DIRFILE object should have previously been created with GD_OPEN.
+ %
+ %   See the documentation on the C API function gd_include_affix(3) in
+ %   section 3 of the UNIX manual for more details.
+ %
+ %   See also GD_UNINCLUDE, GD_FRAGMENT_AFFIXES, GD_ALTER_AFFIXEX, GD_OPEN
+ */
+
+void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])
+{
+  DIRFILE *D;
+  void *data;
+  char *filename;
+  char *prefix = NULL, *suffix = NULL;
+  int parent, n;
+  unsigned long flags;
+
+  GDMX_CHECK_RHS2(4,6);
+
+  D = gdmx_to_dirfile(prhs[0]);
+  filename = gdmx_to_string(prhs, 1, 0);
+  parent = gdmx_to_int(prhs, 2);
+  flags = gdmx_to_ulong(prhs, 3);
+  if (nrhs > 4)
+    prefix = gdmx_to_string(prhs, 4, 1);
+  if (nrhs > 5)
+    suffix = gdmx_to_string(prhs, 5, 1);
+
+  n = gd_include_affix(D, filename, parent, prefix, suffix, flags);
+
+  mxFree(filename);
+  mxFree(prefix);
+  mxFree(suffix);
+  gdmx_err(D, 0);
+
+  plhs[0] = gdmx_from_int(n);
+}
diff --git a/bindings/matlab/gd_invalid_dirfile.c b/bindings/matlab/gd_invalid_dirfile.c
new file mode 100644
index 0000000..4b01565
--- /dev/null
+++ b/bindings/matlab/gd_invalid_dirfile.c
@@ -0,0 +1,45 @@
+/* Copyright (C) 2013 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+#include "gd_matlab.h"
+
+/*
+ % GD_INVALID_DIRFILE  Create an invalid dirfile object
+ %
+ %   D = GD_INVALID_DIRFILE()
+ %             creates an invalid dirfile object, D.  It should be deallocated
+ %             with GD_CLOSE or GD_DISCARD when no longer needed.
+ %
+ %   See the documentation on the C API function gd_invalid_dirfile(3) in
+ %   section 3 of the UNIX manual for more details.
+ %
+ %   See also GD_CLOSE, GD_DISCARD, GD_OPEN
+ */
+
+void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])
+{
+  DIRFILE *D;
+
+  GDMX_CHECK_RHS(0);
+
+  D = gd_invalid_dirfile();
+
+  plhs[0] = gdmx_from_dirfile(D);
+}
diff --git a/bindings/matlab/gd_linterp_tablename.c b/bindings/matlab/gd_linterp_tablename.c
new file mode 100644
index 0000000..028573c
--- /dev/null
+++ b/bindings/matlab/gd_linterp_tablename.c
@@ -0,0 +1,55 @@
+/* Copyright (C) 2013 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+#include "gd_matlab.h"
+
+/*
+ % GD_LINTER_TABLENAME  Report the pathname of binary file
+ %
+ %   P = GD_LINTER_TABLENAME(DIRFILE,FIELD_CODE)
+ %             reports the pathname, P, of the look-up table associated with the
+ %             LINTERP field specified by FIELD_CODE in the the dirfile DIRFILE.
+ %
+ %   The DIRFILE object should have previously been created with GD_OPEN.
+ %
+ %   See the documentation on the C API function gd_linterp_tablename(3) in
+ %   section 3 of the UNIX manual for more details.
+ %
+ %   See also GD_OPEN
+ */
+
+void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])
+{
+  DIRFILE *D;
+  const char *s;
+  char *field_code;
+
+  GDMX_CHECK_RHS(2);
+
+  D = gdmx_to_dirfile(prhs[0]);
+  field_code = gdmx_to_string(prhs, 1, 0);
+
+  s = gd_linterp_tablename(D, field_code);
+
+  mxFree(field_code);
+  gdmx_err(D, 0);
+
+  plhs[0] = mxCreateString(s);
+}
diff --git a/bindings/matlab/gd_madd.c b/bindings/matlab/gd_madd.c
new file mode 100644
index 0000000..b9d6780
--- /dev/null
+++ b/bindings/matlab/gd_madd.c
@@ -0,0 +1,59 @@
+/* Copyright (C) 2013 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+#include "gd_matlab.h"
+
+/*
+ % GD_MADD  Add a metafield
+ %
+ %   GD_MADD(DIRFILE,ENTRY,PARENT)
+ %             adds a metafield described by ENTRY to the dirfile DIRFILE under
+ %             parent field PARENT.
+ %
+ %   The DIRFILE object should have previously been created with GD_OPEN.
+ %
+ %   The ENTRY object should be an entry struct; see GETDATA and gd_entry(3) in
+ %   the UNIX manual for details.
+ %
+ %   See the documentation on the C API function gd_madd(3) in section 3
+ %   of the UNIX manual for more details.
+ %
+ %   See also GD_ADD, GD_OPEN, GETDATA
+ */
+
+void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])
+{
+  DIRFILE *D;
+  void *data;
+  char *parent;
+  gd_entry_t *E;
+
+  GDMX_NO_LHS;
+  GDMX_CHECK_RHS(3);
+
+  D = gdmx_to_dirfile(prhs[0]);
+  E = gdmx_to_entry(prhs, 1, GDMX_ENO_FRAG);
+  parent = gdmx_to_string(prhs, 2, 0);
+
+  gd_madd(D, E, parent);
+
+  gdmx_free_entry(E);
+  gdmx_err(D, 0);
+}
diff --git a/bindings/matlab/gd_madd_alias.c b/bindings/matlab/gd_madd_alias.c
new file mode 100644
index 0000000..bb60e6c
--- /dev/null
+++ b/bindings/matlab/gd_madd_alias.c
@@ -0,0 +1,58 @@
+/* Copyright (C) 2013 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+#include "gd_matlab.h"
+
+/*
+ % GD_MADD_ALIAS  Add a field alias
+ %
+ %   GD_MADD_ALIAS(DIRFILE,PARENT,NAME,TARGET)
+ %             adds a field alias metafield called NAME pointing to TARGET under
+ %             parent field PARENT in the dirfile DIRFILE.
+ %
+ %   The DIRFILE object should have previously been created with GD_OPEN.
+ %
+ %   See the documentation on the C API function gd_madd_alias(3) in section 3
+ %   of the UNIX manual for more details.
+ %
+ %   See also GD_ADD_ALIAS, GD_OPEN
+ */
+
+void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])
+{
+  DIRFILE *D;
+  void *data;
+  char *field_code, *target, *parent;
+
+  GDMX_NO_LHS;
+  GDMX_CHECK_RHS(4);
+
+  D = gdmx_to_dirfile(prhs[0]);
+  parent = gdmx_to_string(prhs, 1, 0);
+  field_code = gdmx_to_string(prhs, 2, 0);
+  target = gdmx_to_string(prhs, 3, 0);
+
+  gd_madd_alias(D, parent, field_code, target);
+
+  mxFree(target);
+  mxFree(field_code);
+  mxFree(parent);
+  gdmx_err(D, 0);
+}
diff --git a/bindings/matlab/gd_madd_bit.m b/bindings/matlab/gd_madd_bit.m
new file mode 100644
index 0000000..8208d72
--- /dev/null
+++ b/bindings/matlab/gd_madd_bit.m
@@ -0,0 +1,39 @@
+function gd_madd_bit(D, parent, field_code, in_fields, bitnum, numbits)
+% GD_MADD_BIT  Add a BIT metafield
+%
+%   GD_MADD_BIT(DIRFILE,PARENT,NAME,INPUT,BITNUM,NUMBITS)
+%             adds a BIT metafield called NAME under PARENT to the dirfile
+%             specified by DIRFILE.  The input field is INPUT, the first bit is
+%             BITNUM and the length is NUMBITS.
+%
+%   The DIRFILE object should have previously been created with GD_OPEN.
+%
+%   See the documentation on the C API function gd_madd_bit(3) in section 3
+%   of the UNIX manual for more details.
+%
+%   See also GD_ADD_BIT, GD_MADD, GD_OPEN
+
+  GD = getdata_constants();
+  gd_madd(D, struct('field', field_code, 'field_type', GD.BIT_ENTRY, ...
+  'in_fields', {in_fields}, 'bitnum', bitnum, 'numbits', numbits), parent);
+end
+
+% Copyright (C) 2013 D. V. Wiebe
+%
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%
+% This file is part of the GetData project.
+%
+% GetData is free software; you can redistribute it and/or modify it under
+% the terms of the GNU Lesser General Public License as published by the
+% Free Software Foundation; either version 2.1 of the License, or (at your
+% option) any later version.
+%
+% GetData is distributed in the hope that it will be useful, but WITHOUT
+% ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+% FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+% License for more details.
+%
+% You should have received a copy of the GNU Lesser General Public License
+% along with GetData; if not, write to the Free Software Foundation, Inc.,
+% 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
diff --git a/bindings/matlab/gd_madd_carray.c b/bindings/matlab/gd_madd_carray.c
new file mode 100644
index 0000000..a72a75b
--- /dev/null
+++ b/bindings/matlab/gd_madd_carray.c
@@ -0,0 +1,62 @@
+/* Copyright (C) 2013 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+#include "gd_matlab.h"
+
+/*
+ % GD_MADD_CARRAY  Add a CARRAY field
+ %
+ %   GD_MADD_CARRAY(DIRFILE,PARENT,NAME,TYPE,VALUES)
+ %             adds a CARRAY metafield called NAME to the dirfile specified by
+ %             DIRFILE under parent field PARENT.  The storage type is TYPE,
+ %             and the values of the field are in VALUES.
+ %
+ %   The DIRFILE object should have previously been created with GD_OPEN.
+ %
+ %   See the documentation on the C API function gd_madd_carray(3) in section 3
+ %   of the UNIX manual for more details.
+ %
+ %   See also GD_MADD, GD_ADD_CARRAY, GD_OPEN
+ */
+
+void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])
+{
+  DIRFILE *D;
+  void *data;
+  char *field_name, *parent;
+  size_t n;
+  gd_type_t const_type, data_type;
+
+  GDMX_NO_LHS;
+  GDMX_CHECK_RHS(5);
+
+  D = gdmx_to_dirfile(prhs[0]);
+  parent = gdmx_to_string(prhs, 1, 0);
+  field_name = gdmx_to_string(prhs, 2, 0);
+  const_type = gdmx_to_gd_type(prhs, 3);
+  gdmx_to_data(&data, &data_type, &n, prhs, 4);
+
+  gd_madd_carray(D, parent, field_name, const_type, n, data_type, data);
+
+  gdmx_free_data(data, data_type);
+  mxFree(field_name);
+  mxFree(parent);
+  gdmx_err(D, 0);
+}
diff --git a/bindings/matlab/gd_madd_const.c b/bindings/matlab/gd_madd_const.c
new file mode 100644
index 0000000..480e824
--- /dev/null
+++ b/bindings/matlab/gd_madd_const.c
@@ -0,0 +1,62 @@
+/* Copyright (C) 2013 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+#include "gd_matlab.h"
+
+/*
+ % GD_MADD_CONST  Add a CONST metafield
+ %
+ %   GD_MADD_CONST(DIRFILE,PARENT,NAME,TYPE,VALUE)
+ %             adds a CONST metafield called NAME to the dirfile specified by
+ %             DIRFILE under parent PARENT.  The storage type is TYPE, and the
+ %             value of the field is VALUE.
+ %
+ %   The DIRFILE object should have previously been created with GD_OPEN.
+ %
+ %   See the documentation on the C API function gd_madd_const(3) in section 3
+ %   of the UNIX manual for more details.
+ %
+ %   See also GD_MADD, GD_ADD_CONST, GD_OPEN
+ */
+
+void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])
+{
+  DIRFILE *D;
+  void *data;
+  char *field_name, *parent;
+  size_t n;
+  gd_type_t const_type, data_type;
+
+  GDMX_NO_LHS;
+  GDMX_CHECK_RHS(5);
+
+  D = gdmx_to_dirfile(prhs[0]);
+  parent = gdmx_to_string(prhs, 1, 0);
+  field_name = gdmx_to_string(prhs, 2, 0);
+  const_type = gdmx_to_gd_type(prhs, 3);
+  gdmx_to_data(&data, &data_type, &n, prhs, 4);
+
+  n = gd_madd_const(D, parent, field_name, const_type, data_type, data);
+
+  gdmx_free_data(data, data_type);
+  mxFree(field_name);
+  mxFree(parent);
+  gdmx_err(D, 0);
+}
diff --git a/bindings/matlab/gd_madd_divide.m b/bindings/matlab/gd_madd_divide.m
new file mode 100644
index 0000000..45e5ed2
--- /dev/null
+++ b/bindings/matlab/gd_madd_divide.m
@@ -0,0 +1,38 @@
+function gd_madd_divide(D, parent, field_code, in1, in2)
+% GD_MADD_DIVIDE  Add a DIVIDE metafield
+%
+%   GD_MADD_DIVIDE(DIRFILE,PARENT,NAME,INPUT1,INPUT2)
+%             adds a DIVIDE metafield called NAME under PARENT to the dirfile
+%             specified by DIRFILE.  The input fields are INPUT1 and INPUT2.
+%
+%   The DIRFILE object should have previously been created with GD_OPEN.
+%
+%   See the documentation on the C API function gd_madd_divide(3) in section 3
+%   of the UNIX manual for more details.
+%
+%   See also GD_ADD_DIVIDE, GD_MADD, GD_OPEN
+
+  GD = getdata_constants();
+  gd_madd(D, struct('field', field_code, 'field_type', GD.DIVIDE_ENTRY, ...
+  'in_fields', {{in1; in2}}), parent);
+end
+
+% Copyright (C) 2013 D. V. Wiebe
+%
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%
+% This file is part of the GetData project.
+%
+% GetData is free software; you can redistribute it and/or modify it under
+% the terms of the GNU Lesser General Public License as published by the
+% Free Software Foundation; either version 2.1 of the License, or (at your
+% option) any later version.
+%
+% GetData is distributed in the hope that it will be useful, but WITHOUT
+% ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+% FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+% License for more details.
+%
+% You should have received a copy of the GNU Lesser General Public License
+% along with GetData; if not, write to the Free Software Foundation, Inc.,
+% 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
diff --git a/bindings/matlab/gd_madd_lincom.m b/bindings/matlab/gd_madd_lincom.m
new file mode 100644
index 0000000..1fa7cf6
--- /dev/null
+++ b/bindings/matlab/gd_madd_lincom.m
@@ -0,0 +1,40 @@
+function gd_madd_lincom(D, parent, field_code, in_fields, m, b);
+% GD_MADD_LINCOM  Add a LINCOM metafield
+%
+%   GD_MADD_LINCOM(DIRFILE,PARENT,NAME,IPUTS,M,B)
+%             adds a LINCOM metafield called NAME under PARENT to the dirfile
+%             specified by DIRFILE. The input fields are provided in the cell
+%             array INPUTS and the slopes and offsets given by the numeric
+%             arrays M and B, which may be complex valued.
+%
+%   The DIRFILE object should have previously been created with GD_OPEN.
+%
+%   See the documentation on the C API function gd_madd_lincom(3) in section 3
+%   of the UNIX manual for more details.
+%
+%   See also GD_ADD_LINCOM, GD_MADD, GD_OPEN
+
+  GD = getdata_constants();
+  gd_madd(D, struct('field', field_code, 'field_type', GD.LINCOM_ENTRY, ...
+  'in_fields', {in_fields}, 'm', m, 'b', b), parent);
+end
+
+% Copyright (C) 2013 D. V. Wiebe
+%
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%
+% This file is part of the GetData project.
+%
+% GetData is free software; you can redistribute it and/or modify it under
+% the terms of the GNU Lesser General Public License as published by the
+% Free Software Foundation; either version 2.1 of the License, or (at your
+% option) any later version.
+%
+% GetData is distributed in the hope that it will be useful, but WITHOUT
+% ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+% FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+% License for more details.
+%
+% You should have received a copy of the GNU Lesser General Public License
+% along with GetData; if not, write to the Free Software Foundation, Inc.,
+% 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
diff --git a/bindings/matlab/gd_madd_linterp.m b/bindings/matlab/gd_madd_linterp.m
new file mode 100644
index 0000000..e984d56
--- /dev/null
+++ b/bindings/matlab/gd_madd_linterp.m
@@ -0,0 +1,39 @@
+function gd_madd_linterp(D, parent, field_code, in_fields, table)
+% GD_MADD_LINTERP  Add a LINTERP metafield
+%
+%   GD_MADD_LINTERP(DIRFILE,PARENT,NAME,INPUT,TABLE)
+%             adds a LINTERP metafield called NAME under PARENT to the dirfile
+%             specified by DIRFILE.  The input field is INPUT and the associated
+%             look-up table is given by the path TABLE.
+%
+%   The DIRFILE object should have previously been created with GD_OPEN.
+%
+%   See the documentation on the C API function gd_madd_linterp(3) in section 3
+%   of the UNIX manual for more details.
+%
+%   See also GD_ADD_LINTERP, GD_MADD, GD_OPEN
+
+  GD = getdata_constants();
+  gd_madd(D, struct('field', field_code, 'field_type', GD.LINTERP_ENTRY, ...
+  'in_fields', in_fields, 'table', table), parent);
+end
+
+% Copyright (C) 2013 D. V. Wiebe
+%
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%
+% This file is part of the GetData project.
+%
+% GetData is free software; you can redistribute it and/or modify it under
+% the terms of the GNU Lesser General Public License as published by the
+% Free Software Foundation; either version 2.1 of the License, or (at your
+% option) any later version.
+%
+% GetData is distributed in the hope that it will be useful, but WITHOUT
+% ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+% FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+% License for more details.
+%
+% You should have received a copy of the GNU Lesser General Public License
+% along with GetData; if not, write to the Free Software Foundation, Inc.,
+% 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
diff --git a/bindings/matlab/gd_madd_mplex.m b/bindings/matlab/gd_madd_mplex.m
new file mode 100644
index 0000000..884d48a
--- /dev/null
+++ b/bindings/matlab/gd_madd_mplex.m
@@ -0,0 +1,42 @@
+function gd_madd_mplex(D, parent, field_code, in_field1, in_field2, ...
+count_val, period)
+% GD_MADD_MPLEX  Add a MPLEX metafield
+%
+%   GD_MADD_MPLEX(DIRFILE,PARENT,NAME,INPUT1,INPUT2,COUNT_VAL,COUNT_MAX)
+%             adds a MPLEX metafield called NAME under PARENT to the dirfile
+%             specified by DIRFILE.  The input data field is INPUT1, the index
+%             field is INPUT2.  The target value is COUNT_VAL and the maximum
+%             value of INPUT2 is COUNT_MAX.
+%
+%   The DIRFILE object should have previously been created with GD_OPEN.
+%
+%   See the documentation on the C API function gd_madd_mplex(3) in section 3
+%   of the UNIX manual for more details.
+%
+%   See also GD_ADD_MPLEX, GD_MADD, GD_OPEN
+
+  GD = getdata_constants();
+  gd_madd(D, struct('field', field_code, 'field_type', GD.MPLEX_ENTRY, ...
+  'in_fields', {{in_field1; in_field2}}, 'count_val', count_val, ...
+  'period', period), parent);
+end
+
+% Copyright (C) 2013 D. V. Wiebe
+%
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%
+% This file is part of the GetData project.
+%
+% GetData is free software; you can redistribute it and/or modify it under
+% the terms of the GNU Lesser General Public License as published by the
+% Free Software Foundation; either version 2.1 of the License, or (at your
+% option) any later version.
+%
+% GetData is distributed in the hope that it will be useful, but WITHOUT
+% ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+% FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+% License for more details.
+%
+% You should have received a copy of the GNU Lesser General Public License
+% along with GetData; if not, write to the Free Software Foundation, Inc.,
+% 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
diff --git a/bindings/matlab/gd_madd_multiply.m b/bindings/matlab/gd_madd_multiply.m
new file mode 100644
index 0000000..679cdcd
--- /dev/null
+++ b/bindings/matlab/gd_madd_multiply.m
@@ -0,0 +1,38 @@
+function gd_madd_multiply(D, parent, field_code, in1, in2)
+% GD_MADD_MULTIPLY  Add a MULTIPLY metafield
+%
+%   GD_MADD_MULTIPLY(DIRFILE,PARENT,NAME,INPUT1,INPUT2)
+%             adds a MULTIPLY metafield called NAME under PARENT to the dirfile
+%             specified by DIRFILE.  The input fields are INPUT1 and INPUT2.
+%
+%   The DIRFILE object should have previously been created with GD_OPEN.
+%
+%   See the documentation on the C API function gd_madd_multiply(3) in section 3
+%   of the UNIX manual for more details.
+%
+%   See also GD_ADD_MULTIPLY, GD_MADD, GD_OPEN
+
+  GD = getdata_constants();
+  gd_madd(D, struct('field', field_code, 'field_type', GD.MULTIPLY_ENTRY, ...
+  'in_fields', {{in1; in2}}), parent);
+end
+
+% Copyright (C) 2013 D. V. Wiebe
+%
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%
+% This file is part of the GetData project.
+%
+% GetData is free software; you can redistribute it and/or modify it under
+% the terms of the GNU Lesser General Public License as published by the
+% Free Software Foundation; either version 2.1 of the License, or (at your
+% option) any later version.
+%
+% GetData is distributed in the hope that it will be useful, but WITHOUT
+% ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+% FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+% License for more details.
+%
+% You should have received a copy of the GNU Lesser General Public License
+% along with GetData; if not, write to the Free Software Foundation, Inc.,
+% 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
diff --git a/bindings/matlab/gd_madd_phase.m b/bindings/matlab/gd_madd_phase.m
new file mode 100644
index 0000000..81287b2
--- /dev/null
+++ b/bindings/matlab/gd_madd_phase.m
@@ -0,0 +1,39 @@
+function gd_madd_phase(D, parent, field_code, in_fields, shift)
+% GD_MADD_PHASE  Add a PHASE metafield
+%
+%   GD_MADD_PHASE(DIRFILE,PARENT,NAME,INPUT,SHIFT)
+%             adds a PHASE metafield called NAME under PARENT to the dirfile
+%             specified by DIRFILE.  The input field is INPUT and the phase
+%             shift SHIFT.
+%
+%   The DIRFILE object should have previously been created with GD_OPEN.
+%
+%   See the documentation on the C API function gd_madd_phase(3) in section 3
+%   of the UNIX manual for more details.
+%
+%   See also GD_ADD_PHASE, GD_MADD, GD_OPEN
+
+  GD = getdata_constants();
+  gd_madd(D, struct('field', field_code, 'field_type', GD.PHASE_ENTRY, ...
+  'in_fields', {in_fields}, 'shift', shift), parent);
+end
+
+% Copyright (C) 2013 D. V. Wiebe
+%
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%
+% This file is part of the GetData project.
+%
+% GetData is free software; you can redistribute it and/or modify it under
+% the terms of the GNU Lesser General Public License as published by the
+% Free Software Foundation; either version 2.1 of the License, or (at your
+% option) any later version.
+%
+% GetData is distributed in the hope that it will be useful, but WITHOUT
+% ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+% FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+% License for more details.
+%
+% You should have received a copy of the GNU Lesser General Public License
+% along with GetData; if not, write to the Free Software Foundation, Inc.,
+% 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
diff --git a/bindings/matlab/gd_madd_polynom.m b/bindings/matlab/gd_madd_polynom.m
new file mode 100644
index 0000000..ed750d5
--- /dev/null
+++ b/bindings/matlab/gd_madd_polynom.m
@@ -0,0 +1,39 @@
+function gd_madd_polynom(D, parent, field_code, in_fields, a)
+% GD_MADD_POLYNOM  Add a POLYNOM metafield
+%
+%   GD_MADD_POLYNOM(DIRFILE,PARENT,NAME,INPUT,A)
+%             adds a POLYNOM metafield called NAME under PARENT to the dirfile
+%             specified by DIRFILE.  The input field is INPUT and the vector of
+%             co-efficients is A.
+%
+%   The DIRFILE object should have previously been created with GD_OPEN.
+%
+%   See the documentation on the C API function gd_madd_polynom(3) in section 3
+%   of the UNIX manual for more details.
+%
+%   See also GD_ADD_POLYNOM, GD_MADD, GD_OPEN
+
+  GD = getdata_constants();
+  gd_madd(D, struct('field', field_code, 'field_type', GD.POLYNOM_ENTRY, ...
+  'in_fields', {in_fields}, 'a', a), parent);
+end
+
+% Copyright (C) 2013 D. V. Wiebe
+%
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%
+% This file is part of the GetData project.
+%
+% GetData is free software; you can redistribute it and/or modify it under
+% the terms of the GNU Lesser General Public License as published by the
+% Free Software Foundation; either version 2.1 of the License, or (at your
+% option) any later version.
+%
+% GetData is distributed in the hope that it will be useful, but WITHOUT
+% ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+% FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+% License for more details.
+%
+% You should have received a copy of the GNU Lesser General Public License
+% along with GetData; if not, write to the Free Software Foundation, Inc.,
+% 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
diff --git a/bindings/matlab/gd_madd_recip.m b/bindings/matlab/gd_madd_recip.m
new file mode 100644
index 0000000..1b99d09
--- /dev/null
+++ b/bindings/matlab/gd_madd_recip.m
@@ -0,0 +1,39 @@
+function gd_madd_recip(D, parent, field_code, in_fields, dividend)
+% GD_MADD_RECIP  Add a RECIP metafield
+%
+%   GD_MADD_RECIP(DIRFILE,PARENT,NAME,INPUT,DIVIDEND)
+%             adds a RECIP metafield called NAME under PARENT to the dirfile
+%             specified by DIRFILE.  The input field is INPUT, and the dividend
+%             DIVIDEND.
+%
+%   The DIRFILE object should have previously been created with GD_OPEN.
+%
+%   See the documentation on the C API function gd_madd_recip(3) in section 3
+%   of the UNIX manual for more details.
+%
+%   See also GD_ADD_RECIP, GD_MADD, GD_OPEN
+
+  GD = getdata_constants();
+  gd_madd(D, struct('field', field_code, 'field_type', GD.RECIP_ENTRY, ...
+  'in_fields', {in_fields}, 'dividend', dividend), parent);
+end
+
+% Copyright (C) 2013 D. V. Wiebe
+%
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%
+% This file is part of the GetData project.
+%
+% GetData is free software; you can redistribute it and/or modify it under
+% the terms of the GNU Lesser General Public License as published by the
+% Free Software Foundation; either version 2.1 of the License, or (at your
+% option) any later version.
+%
+% GetData is distributed in the hope that it will be useful, but WITHOUT
+% ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+% FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+% License for more details.
+%
+% You should have received a copy of the GNU Lesser General Public License
+% along with GetData; if not, write to the Free Software Foundation, Inc.,
+% 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
diff --git a/bindings/matlab/gd_madd_sbit.m b/bindings/matlab/gd_madd_sbit.m
new file mode 100644
index 0000000..4a35307
--- /dev/null
+++ b/bindings/matlab/gd_madd_sbit.m
@@ -0,0 +1,39 @@
+function gd_madd_sbit(D, parent, field_code, in_fields, bitnum, numbits)
+% GD_MADD_SBIT  Add a SBIT metafield
+%
+%   GD_MADD_SBIT(DIRFILE,PARENT,NAME,INPUT,BITNUM,NUMBITS)
+%             adds a SBIT metafield called NAME under PARENT to the dirfile
+%             specified by DIRFILE.  The input field is INPUT, the first bit is
+%             BITNUM and the length is NUMBITS.
+%
+%   The DIRFILE object should have previously been created with GD_OPEN.
+%
+%   See the documentation on the C API function gd_madd_sbit(3) in section 3
+%   of the UNIX manual for more details.
+%
+%   See also GD_ADD_SBIT, GD_MADD, GD_OPEN
+
+  GD = getdata_constants();
+  gd_madd(D, struct('field', field_code, 'field_type', GD.SBIT_ENTRY, ...
+  'in_fields', {in_fields}, 'bitnum', bitnum, 'numbits', numbits), parent);
+end
+
+% Copyright (C) 2013 D. V. Wiebe
+%
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%
+% This file is part of the GetData project.
+%
+% GetData is free software; you can redistribute it and/or modify it under
+% the terms of the GNU Lesser General Public License as published by the
+% Free Software Foundation; either version 2.1 of the License, or (at your
+% option) any later version.
+%
+% GetData is distributed in the hope that it will be useful, but WITHOUT
+% ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+% FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+% License for more details.
+%
+% You should have received a copy of the GNU Lesser General Public License
+% along with GetData; if not, write to the Free Software Foundation, Inc.,
+% 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
diff --git a/bindings/matlab/gd_madd_spec.c b/bindings/matlab/gd_madd_spec.c
new file mode 100644
index 0000000..1d23f5a
--- /dev/null
+++ b/bindings/matlab/gd_madd_spec.c
@@ -0,0 +1,55 @@
+/* Copyright (C) 2013 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+#include "gd_matlab.h"
+
+/*
+ % GD_MADD_SPEC  Add a metafield
+ %
+ %   GD_MADD_SPEC(DIRFILE,SPEC,PARENT)
+ %             adds a metafield described by the field specification line SPEC
+ %             to the dirfile DIRFILE under parent field PARENT.
+ %
+ %   The DIRFILE object should have previously been created with GD_OPEN.
+ %
+ %   See the documentation on the C API function gd_madd_spec(3) in section 3
+ %   of the UNIX manual for more details.
+ %
+ %   See also GD_MADD, GD_ADD_SPEC, GD_OPEN
+ */
+
+void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])
+{
+  DIRFILE *D;
+  char *spec, *parent;
+
+  GDMX_NO_LHS;
+  GDMX_CHECK_RHS(3);
+
+  D = gdmx_to_dirfile(prhs[0]);
+  spec = gdmx_to_string(prhs, 1, 0);
+  parent = gdmx_to_string(prhs, 2, 0);
+
+  gd_madd_spec(D, spec, parent);
+
+  mxFree(parent);
+  mxFree(spec);
+  gdmx_err(D, 0);
+}
diff --git a/bindings/matlab/gd_madd_string.c b/bindings/matlab/gd_madd_string.c
new file mode 100644
index 0000000..1f5573e
--- /dev/null
+++ b/bindings/matlab/gd_madd_string.c
@@ -0,0 +1,58 @@
+/* Copyright (C) 2013 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+#include "gd_matlab.h"
+
+/*
+ % GD_MADD_STRING  Add a STRING field
+ %
+ %   GD_MADD_STRING(DIRFILE,PARENT,NAME,VALUE)
+ %             adds a STRING metafield called NAME to the dirfile specified by
+ %             DIRFILE under parent field PARENT.  The value of the field is
+ %             set to VALUE.
+ %
+ %   The DIRFILE object should have previously been created with GD_OPEN.
+ %
+ %   See the documentation on the C API function gd_madd_string(3) in section 3
+ %   of the UNIX manual for more details.
+ %
+ %   See also GD_MADD, GD_ADD_STRING, GD_OPEN
+ */
+
+void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])
+{
+  DIRFILE *D;
+  char *field_name, *value, *parent;
+
+  GDMX_NO_LHS;
+  GDMX_CHECK_RHS(4);
+
+  D = gdmx_to_dirfile(prhs[0]);
+  parent = gdmx_to_string(prhs, 1, 0);
+  field_name = gdmx_to_string(prhs, 2, 0);
+  value = gdmx_to_string(prhs, 3, 0);
+
+  gd_madd_string(D, parent, field_name, value);
+
+  mxFree(field_name);
+  mxFree(value);
+  mxFree(parent);
+  gdmx_err(D, 0);
+}
diff --git a/bindings/matlab/gd_madd_window.m b/bindings/matlab/gd_madd_window.m
new file mode 100644
index 0000000..8dcab8c
--- /dev/null
+++ b/bindings/matlab/gd_madd_window.m
@@ -0,0 +1,43 @@
+function gd_madd_window(D, parent, field_code, in_field1, in_field2, windop, ...
+threshold)
+% GD_MADD_WINDOW  Add a WINDOW metafield
+%
+%   GD_MADD_WINDOW(DIRFILE,PARENT,NAME,INPUT1,INPUT2)
+%             adds a WINDOW metafield called NAME under PARENT to the dirfile
+%             specified by DIRFILE.  The data input field is INPUT1, and the
+%             mask field is INPUT2. The operator is specified by WINDOP, which
+%             should be one of the GD.WINDOP_... members provided by
+%             GETDATA_CONSTANTS, and the threshold is THRESHOLD.
+%
+%   The DIRFILE object should have previously been created with GD_OPEN.
+%
+%   See the documentation on the C API function gd_madd_window(3) in section 3
+%   of the UNIX manual for more details.
+%
+%   See also GD_ADD_WINDOW, GD_MADD, GD_OPEN, GETDATA_CONSTANTS
+
+  GD = getdata_constants();
+  gd_madd(D, struct('field', field_code, 'field_type', GD.WINDOW_ENTRY, ...
+  'in_fields', {{in_field1; in_field2}}, 'windop', windop, ...
+  'threshold', threshold), parent);
+end
+
+% Copyright (C) 2013 D. V. Wiebe
+%
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%
+% This file is part of the GetData project.
+%
+% GetData is free software; you can redistribute it and/or modify it under
+% the terms of the GNU Lesser General Public License as published by the
+% Free Software Foundation; either version 2.1 of the License, or (at your
+% option) any later version.
+%
+% GetData is distributed in the hope that it will be useful, but WITHOUT
+% ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+% FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+% License for more details.
+%
+% You should have received a copy of the GNU Lesser General Public License
+% along with GetData; if not, write to the Free Software Foundation, Inc.,
+% 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
diff --git a/bindings/matlab/gd_malter_spec.c b/bindings/matlab/gd_malter_spec.c
new file mode 100644
index 0000000..8e4a1a4
--- /dev/null
+++ b/bindings/matlab/gd_malter_spec.c
@@ -0,0 +1,60 @@
+/* Copyright (C) 2013 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+#include "gd_matlab.h"
+
+/*
+ % GD_ALTER_SPEC  Modify metafield metadata
+ %
+ %   GD_ALTER_SPEC(DIRFILE,SPEC,PARENT[,RECODE])
+ %             modifies the metadata of a metafield under parent field PARENT in
+ %             the dirfile DIRFILE according to the field specification line
+ %             SPEC.  If RECODE is given and non-zero, other data will be
+ %             updated to reflect metadata changes.
+ %
+ %   The DIRFILE object should have previously been created with GD_OPEN.
+ %
+ %   See the documentation on the C API function gd_malter_spec(3) in
+ %   section 3 of the UNIX manual for more details.
+ %
+ %   See also GD_ALTER_SPEC, GD_OPEN
+ */
+
+void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])
+{
+  DIRFILE *D;
+  char *spec, *parent;
+  int recode = 0;
+
+  GDMX_NO_LHS;
+  GDMX_CHECK_RHS2(3,4);
+
+  D = gdmx_to_dirfile(prhs[0]);
+  spec = gdmx_to_string(prhs, 1, 0);
+  parent = gdmx_to_string(prhs, 2, 0);
+  if (nrhs > 3)
+    recode = gdmx_to_int(prhs, 3);
+
+  gd_malter_spec(D, spec, parent, recode);
+
+  mxFree(spec);
+  mxFree(parent);
+  gdmx_err(D, 0);
+}
diff --git a/bindings/matlab/gd_matlab.h b/bindings/matlab/gd_matlab.h
new file mode 100644
index 0000000..f3f0b83
--- /dev/null
+++ b/bindings/matlab/gd_matlab.h
@@ -0,0 +1,113 @@
+/* Copyright (C) 2013 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+#ifndef GD_MATLAB_H
+
+/* mex runs GCC in -ansi mode */
+#ifndef GDMXLIB
+#define GD_C89_API
+#endif
+#define GD_64BIT_API
+#include "getdata.h"
+
+#include <mex.h>
+
+#define GDMX_INTERNAL_ERROR \
+  mexErrMsgIdAndTxt("GetData:GDMX:InternalError", \
+      "Internal error at [%s,%i]", __FILE__, __LINE__ )
+
+#define GDMX_NO_LHS \
+  if (nlhs > 0) \
+    mexErrMsgIdAndTxt("GetData:GDMX:nLHS", \
+        "Too many output arguments.")
+
+#define GDMX_CHECK_RHS(n) \
+  if (nrhs != (n)) \
+    mexErrMsgIdAndTxt("GetData:GDMX:nRHS", \
+        "Invalid argument count; wanted %i, given %i", \
+        (n), nrhs)
+
+#define GDMX_CHECK_RHS2(m,n) \
+  if (nrhs < (m)) \
+    mexErrMsgIdAndTxt("GetData:GDMX:nRHS", \
+        "Invalid argument count; wanted at least %i, given %i", \
+        (m), nrhs); \
+  else if (nrhs > (n)) \
+    mexErrMsgIdAndTxt("GetData:GDMX:nRHS", \
+        "Invalid argument count; wanted at most %i, given %i", \
+        (n), nrhs)
+
+/* integer type aliases */
+#if SIZEOF_SIZE_T == 8
+#define gdmx_to_size_t(a,b) ((size_t)gdmx_to_ullong(a,b))
+#define gdmx_from_size_t gdmx_from_ullong
+#else
+#define gdmx_to_size_t(a,b) ((size_t)gdmx_to_ulong(a,b))
+#define gdmx_from_size_t gdmx_from_ulong
+#endif
+#define gdmx_to_gd_type(a,b) ((gd_type_t)gdmx_to_int(a,b))
+#define gdmx_from_gd_type gdmx_from_int
+#define gdmx_from_entype gdmx_from_int
+#define gdmx_from_windop gdmx_from_int
+
+void gdmx_err(DIRFILE *, int);
+mxClassID gdmx_classid(gd_type_t);
+void gdmx_free_entry(gd_entry_t *);
+
+/* convert to MATLAB type */
+#define gdmx_from_string mxCreateString
+mxArray *gdmx_from_dirfile(const DIRFILE*);
+mxArray *gdmx_from_data(const void *, gd_type_t, size_t);
+mxArray *gdmx_from_entry(const gd_entry_t*);
+mxArray *gdmx_from_string_list(const char **);
+
+#define gdmx_from_int gdmx_from_long
+#define gdmx_from_uint gdmx_from_ulong
+#define gdmx_from_double mxCreateDoubleScalar
+mxArray *gdmx_from_bool(int);
+mxArray *gdmx_from_long(long);
+mxArray *gdmx_from_llong(long long);
+mxArray *gdmx_from_ulong(unsigned long);
+mxArray *gdmx_from_ullong(unsigned long long);
+
+mxArray *gdmx_from_carrays(const gd_carray_t *, gd_type_t);
+mxArray *gdmx_vector(gd_type_t, size_t, void**);
+
+/* convert from MATLAB type */
+DIRFILE *gdmx_to_dirfile(const mxArray *);
+char *gdmx_to_string(const mxArray **, int, int);
+int gdmx_to_int(const mxArray **, int);
+
+#define GDMX_ENO_FRAG  0x1
+#define GDMX_ENO_FIELD 0x2
+gd_entry_t *gdmx_to_entry(const mxArray **, int, unsigned);
+
+double gdmx_to_double(const mxArray **, int);
+long gdmx_to_long(const mxArray **, int);
+long long gdmx_to_llong(const mxArray **, int);
+#define gdmx_to_uint(a,b) ((unsigned int)gdmx_to_ulong(a,b))
+unsigned long gdmx_to_ulong(const mxArray **, int);
+unsigned long long gdmx_to_ullong(const mxArray **, int);
+
+size_t gdmx_to_nsamp(DIRFILE*, const char*, const mxArray**, int, int);
+void gdmx_to_data(void**, gd_type_t*, size_t*, const mxArray**, int);
+void gdmx_free_data(void*, gd_type_t);
+
+#endif
diff --git a/bindings/matlab/gd_mcarrays.c b/bindings/matlab/gd_mcarrays.c
new file mode 100644
index 0000000..42c402b
--- /dev/null
+++ b/bindings/matlab/gd_mcarrays.c
@@ -0,0 +1,65 @@
+/* Copyright (C) 2013 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+#include "gd_matlab.h"
+#include <string.h>
+
+/*
+ % GD_MCARRAYS  Fetch all CARRAY metafield values
+ %
+ %   A = GD_MCARRAYS(DIRFILE,PARENT[,TYPE])
+ %             returns a cell array of numeric arrays, A, containing all the
+ %             CARRAY data in the for metafields under parent field PARENT.  A
+ %             corresponding array of field names can be produced with
+ %             GD_MFIELD_LIST_BY_TYPE.  The type of the returned data is given
+ %             by TYPE, one of the data type symbols provided by
+ %             GETDATA_CONSTANTS.  If omitted, the default type, GD.FLOAT64, is
+ %             used.
+ %
+ %   The DIRFILE object should have previously been created with GD_OPEN.
+ %
+ %   See the documentation on the C API function gd_mcarrays(3) in section 3
+ %   of the UNIX manual for more details.
+ %
+ %   See also GD_CARRAYS, GD_MFIELD_LIST_BY_TYPE, GD_GET_CARRAY_SLICE
+ */
+
+void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])
+{
+  DIRFILE *D;
+  gd_type_t type = GD_FLOAT64;
+  const gd_carray_t *c;
+  char *parent;
+
+  GDMX_CHECK_RHS2(2,3);
+
+  D = gdmx_to_dirfile(prhs[0]);
+  parent = gdmx_to_string(prhs, 1, 0);
+  if (nrhs > 2)
+    type = gdmx_to_gd_type(prhs, 2);
+
+  c = gd_mcarrays(D, parent, type);
+  mxFree(parent);
+
+  gdmx_err(D, 0);
+
+  /* convert to array of arrays */
+  plhs[0] = gdmx_from_carrays(c, type);
+}
diff --git a/bindings/matlab/gd_mconstants.c b/bindings/matlab/gd_mconstants.c
new file mode 100644
index 0000000..2479120
--- /dev/null
+++ b/bindings/matlab/gd_mconstants.c
@@ -0,0 +1,69 @@
+/* Copyright (C) 2013 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+#include "gd_matlab.h"
+
+/*
+ % GD_MCONSTANTS  Fetch all CONST metafield values
+ %
+ %   A = GD_MCONSTANTS(DIRFILE,PARENT[,TYPE])
+ %             returns a numeric array, A, containing all the CONST metafield
+ %             data under parent field PARENT.  A corresponding array of field
+ %             names can be produced with GD_MFIELD_LIST_BY_TYPE.  The type of
+ %             the returned data is given by TYPE, one of the data type symbols
+ %             provided by GETDATA_CONSTANTS.  If omitted, the default type,
+ %             GD.FLOAT64, is used.
+ %
+ %   The DIRFILE object should have previously been created with GD_OPEN.
+ %
+ %   See the documentation on the C API function gd_mconstants(3) in section 3
+ %   of the UNIX manual for more details.
+ %
+ %   See also GD_CONSTANTS, GD_FIELD_LIST_BY_TYPE, GD_GET_CONSTANT,
+ %            GETDATA_CONSTANTS
+ */
+
+void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])
+{
+  DIRFILE *D;
+  const void *data;
+  unsigned int n;
+  char *field_code;
+  gd_type_t type = GD_FLOAT64;
+
+  GDMX_CHECK_RHS2(2,3);
+
+  D = gdmx_to_dirfile(prhs[0]);
+  field_code = gdmx_to_string(prhs, 1, 0);
+  if (nrhs > 2)
+    type = gdmx_to_gd_type(prhs, 2);
+
+  data = gd_mconstants(D, field_code, type);
+
+  gdmx_err(D, 0);
+  
+  /* length */
+  n = gd_nmfields_by_type(D, field_code, GD_CONST_ENTRY);
+
+  mxFree(field_code);
+  gdmx_err(D, 0);
+
+  plhs[0] = gdmx_from_data(data, type, n);
+}
diff --git a/bindings/matlab/gd_metaflush.c b/bindings/matlab/gd_metaflush.c
new file mode 100644
index 0000000..c7aa140
--- /dev/null
+++ b/bindings/matlab/gd_metaflush.c
@@ -0,0 +1,50 @@
+/* Copyright (C) 2013 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+#include "gd_matlab.h"
+
+/*
+ % GD_METAFLUSH  Flush metadata changes to disk
+ %
+ %   GD_METAFLUSH(DIRFILE)
+ %             flushes all pending metadata changes in the dirfile DIRFILE to
+ %             disk.
+ %
+ %   The DIRFILE object should have previously been created with GD_OPEN.
+ %
+ %   See the documentation on the C API function gd_metaflush(3) in section 3
+ %   of the UNIX manual for more details.
+ %
+ %   See also GD_CLOSE, GD_FLUSH, GD_OPEN, GD_REWRITE_FRAGMENT
+ */
+
+void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])
+{
+  DIRFILE *D;
+
+  GDMX_NO_LHS;
+  GDMX_CHECK_RHS(1);
+
+  D = gdmx_to_dirfile(prhs[0]);
+
+  gd_metaflush(D);
+
+  gdmx_err(D, 0);
+}
diff --git a/bindings/matlab/gd_mfield_list.m b/bindings/matlab/gd_mfield_list.m
new file mode 100644
index 0000000..864fde0
--- /dev/null
+++ b/bindings/matlab/gd_mfield_list.m
@@ -0,0 +1,30 @@
+function field_list = gd_mfield_list(D, parent)
+% GD_MFIELD_LIST  Retrieve a list of field names
+%
+%   GD_FIELD_LIST(DIRFILE,PARENT)
+%             is equivalent to calling GD_ENTRY_LIST(DIRFILE,PARENT,0,0)
+%
+%   See also GD_ENTRY_LIST
+
+  field_list = gd_entry_list(D, parent, 0, 0);
+end
+
+% Copyright (C) 2013 D. V. Wiebe
+%
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%
+% This file is part of the GetData project.
+%
+% GetData is free software; you can redistribute it and/or modify it under
+% the terms of the GNU Lesser General Public License as published by the
+% Free Software Foundation; either version 2.1 of the License, or (at your
+% option) any later version.
+%
+% GetData is distributed in the hope that it will be useful, but WITHOUT
+% ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+% FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+% License for more details.
+%
+% You should have received a copy of the GNU Lesser General Public License
+% along with GetData; if not, write to the Free Software Foundation, Inc.,
+% 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
diff --git a/bindings/matlab/gd_mfield_list_by_type.m b/bindings/matlab/gd_mfield_list_by_type.m
new file mode 100644
index 0000000..f5f36f6
--- /dev/null
+++ b/bindings/matlab/gd_mfield_list_by_type.m
@@ -0,0 +1,30 @@
+function field_list = gd_mfield_list_by_type(D, parent, type)
+% GD_MFIELD_LIST_BY_TYPE  Retrieve a list of field names
+%
+%   GD_MFIELD_LIST_BY_TYPE(DIRFILE,PARENT,TYPE)
+%             is equivalent to calling GD_ENTRY_LIST(DIRFILE,PARENT,TYPE,0)
+%
+%   See also GD_ENTRY_LIST
+
+  field_list = gd_entry_list(D, parent, type, 0);
+end
+
+% Copyright (C) 2013 D. V. Wiebe
+%
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%
+% This file is part of the GetData project.
+%
+% GetData is free software; you can redistribute it and/or modify it under
+% the terms of the GNU Lesser General Public License as published by the
+% Free Software Foundation; either version 2.1 of the License, or (at your
+% option) any later version.
+%
+% GetData is distributed in the hope that it will be useful, but WITHOUT
+% ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+% FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+% License for more details.
+%
+% You should have received a copy of the GNU Lesser General Public License
+% along with GetData; if not, write to the Free Software Foundation, Inc.,
+% 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
diff --git a/bindings/matlab/gd_move.c b/bindings/matlab/gd_move.c
new file mode 100644
index 0000000..b6a3ee5
--- /dev/null
+++ b/bindings/matlab/gd_move.c
@@ -0,0 +1,59 @@
+/* Copyright (C) 2013 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+#include "gd_matlab.h"
+
+/*
+ % GD_MOVE  Move a field between fragments
+ %
+ %   GD_MOVE(DIRFILE,FIELD_CODE,NEW_FRAGMENT[,MOVE_DATA])
+ %             moves the field called FIELD_CODE to the new fragment indexed by
+ %             NEW_FRAGMENT.  If MOVE_DATA is given and non-zero, and the field
+ %             is a RAW field, the binary file associated with it will also be
+ %             moved, if necessary.
+ %
+ %   The DIRFILE object should have previously been created with GD_OPEN.
+ %
+ %   See the documentation on the C API function gd_move(3) in
+ %   section 3 of the UNIX manual for more details.
+ %
+ %   See also GD_MOVE_ALIAS, GD_OPEN
+ */
+
+void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])
+{
+  DIRFILE *D;
+  char *field_code;
+  int new_frag, move_data = 0;
+
+  GDMX_NO_LHS;
+  GDMX_CHECK_RHS2(3,4);
+
+  D = gdmx_to_dirfile(prhs[0]);
+  field_code = gdmx_to_string(prhs, 1, 0);
+  new_frag = gdmx_to_int(prhs, 2);
+  if (nrhs > 3)
+    move_data = gdmx_to_int(prhs, 3);
+
+  gd_move(D, field_code, new_frag, move_data);
+
+  mxFree(field_code);
+  gdmx_err(D, 0);
+}
diff --git a/bindings/matlab/gd_move_alias.c b/bindings/matlab/gd_move_alias.c
new file mode 100644
index 0000000..ba3ad6c
--- /dev/null
+++ b/bindings/matlab/gd_move_alias.c
@@ -0,0 +1,55 @@
+/* Copyright (C) 2013 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+#include "gd_matlab.h"
+
+/*
+ % GD_MOVE_ALIAS  Move an alias between fragments
+ %
+ %   GD_MOVE_ALIAS(DIRFILE,NAME,NEW_FRAGMENT)
+ %             moves the alias called NAME to the fragment indexed by
+ %             NEW_FRAGMENT.
+ %
+ %   The DIRFILE object should have previously been created with GD_OPEN.
+ %
+ %   See the documentation on the C API function gd_move_alias(3) in
+ %   section 3 of the UNIX manual for more details.
+ %
+ %   See also GD_MOVE, GD_OPEN
+ */
+
+void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])
+{
+  DIRFILE *D;
+  char *field_code;
+  int new_frag;
+
+  GDMX_NO_LHS;
+  GDMX_CHECK_RHS(3);
+
+  D = gdmx_to_dirfile(prhs[0]);
+  field_code = gdmx_to_string(prhs, 1, 0);
+  new_frag = gdmx_to_int(prhs, 2);
+
+  gd_move_alias(D, field_code, new_frag);
+
+  mxFree(field_code);
+  gdmx_err(D, 0);
+}
diff --git a/bindings/matlab/gd_mplex_lookback.c b/bindings/matlab/gd_mplex_lookback.c
new file mode 100644
index 0000000..485143a
--- /dev/null
+++ b/bindings/matlab/gd_mplex_lookback.c
@@ -0,0 +1,54 @@
+/* Copyright (C) 2013 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+#include "gd_matlab.h"
+
+/*
+ % GD_MPLEX_LOOKBACK  Set the MPLEX look-back length
+ %
+ %   GD_MPLEX_LOOKBACK(DIRFILE,LOOKBACK)
+ %             sets the lookback length to LOOKBACK, which should be a number
+ %             or the special symbol GD.LOOKBACK_ALL provided by
+ %             GETDATA_CONSTANTS.
+ %
+ %   The DIRFILE object should have previously been created with GD_OPEN.
+ %
+ %   See the documentation on the C API function gd_mplex_lookback(3) in
+ %   section 3 of the UNIX manual for more details.
+ %
+ %   See also GD_GETDATA, GD_OPEN, GETDATA_CONSTANTS
+ */
+
+void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])
+{
+  DIRFILE *D;
+  void *data;
+  int lookback;
+
+  GDMX_NO_LHS;
+  GDMX_CHECK_RHS(2);
+
+  D = gdmx_to_dirfile(prhs[0]);
+  lookback = gdmx_to_int(prhs, 1);
+
+  gd_mplex_lookback(D, lookback);
+
+  gdmx_err(D, 0);
+}
diff --git a/bindings/matlab/gd_mstrings.c b/bindings/matlab/gd_mstrings.c
new file mode 100644
index 0000000..34d0664
--- /dev/null
+++ b/bindings/matlab/gd_mstrings.c
@@ -0,0 +1,57 @@
+/* Copyright (C) 2013 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+#include "gd_matlab.h"
+
+/*
+ % GD_MSTRINGS  Fetch all STRING metafield values
+ %
+ %   A = GD_MSTRINGS(DIRFILE,PARENT)
+ %             returns a cell array of strings, A, containing the values of all
+ %             STRING metafields under parent field PARENT.  A corresponding
+ %             array of field names can be produced with GD_MFIELD_LIST_BY_TYPE.
+ %
+ %   The DIRFILE object should have previously been created with GD_OPEN.
+ %
+ %   See the documentation on the C API function gd_mstrings(3) in section 3
+ %   of the UNIX manual for more details.
+ %
+ %   See also GD_STRINGS, GD_MFIELD_LIST_BY_TYPE, GD_GET_STRING
+ */
+
+
+void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])
+{
+  DIRFILE *D;
+  char *parent;
+  const char **sl;
+
+  GDMX_CHECK_RHS(2);
+
+  D = gdmx_to_dirfile(prhs[0]);
+  parent = gdmx_to_string(prhs, 1, 0);
+
+  sl = gd_mstrings(D, parent);
+
+  mxFree(parent);
+  gdmx_err(D, 0);
+
+  plhs[0] = gdmx_from_string_list(sl);
+}
diff --git a/bindings/matlab/gd_mvector_list.m b/bindings/matlab/gd_mvector_list.m
new file mode 100644
index 0000000..ade6ebc
--- /dev/null
+++ b/bindings/matlab/gd_mvector_list.m
@@ -0,0 +1,34 @@
+function field_list = gd_mvector_list(D, parent)
+% GD_MVECTOR_LIST  Retrieve a list of field names
+%
+%   GD_MVECTOR_LIST(DIRFILE,PARENT)
+%             is equivalent to calling GD_ENTRY_LIST(DIRFILE,PARENT, ...
+%                                                           GD.VECTOR_ENTRIES,0)
+%
+%   For GD, see GETDATA_CONSTANTS.
+%
+%   See also GD_ENTRY_LIST, GETDATA_CONSTANTS
+
+  GD = getdata_constants();
+  field_list = gd_entry_list(D, parent, GD.VECTOR_ENTRIES, 0);
+end
+
+% Copyright (C) 2013 D. V. Wiebe
+%
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%
+% This file is part of the GetData project.
+%
+% GetData is free software; you can redistribute it and/or modify it under
+% the terms of the GNU Lesser General Public License as published by the
+% Free Software Foundation; either version 2.1 of the License, or (at your
+% option) any later version.
+%
+% GetData is distributed in the hope that it will be useful, but WITHOUT
+% ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+% FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+% License for more details.
+%
+% You should have received a copy of the GNU Lesser General Public License
+% along with GetData; if not, write to the Free Software Foundation, Inc.,
+% 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
diff --git a/bindings/matlab/gd_naliases.c b/bindings/matlab/gd_naliases.c
new file mode 100644
index 0000000..9be49a7
--- /dev/null
+++ b/bindings/matlab/gd_naliases.c
@@ -0,0 +1,55 @@
+/* Copyright (C) 2013 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+#include "gd_matlab.h"
+
+/*
+ % GD_NALIASES  Retrieve the number of names for a field
+ %
+ %   N = GD_NALIASES(DIRFILE,FIELD_CODE)
+ %             returns the number of aliases, N, of FIELD_CODE (including
+ %             FIELD_CODE itself.
+ %
+ %   The DIRFILE object should have previously been created with GD_OPEN.
+ %
+ %   See the documentation on the C API function gd_naliases(3) in section 3
+ %   of the UNIX manual for more details.
+ %
+ %   See also GD_ALIASES, GD_NENTRIES, GD_OPEN
+ */
+
+void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])
+{
+  DIRFILE *D;
+  char *field_code = NULL;
+  unsigned int n;
+
+  GDMX_CHECK_RHS(2);
+
+  D = gdmx_to_dirfile(prhs[0]);
+  field_code = gdmx_to_string(prhs, 1, 0);
+
+  n = gd_naliases(D, field_code);
+
+  mxFree(field_code);
+  gdmx_err(D, 0);
+
+  plhs[0] = gdmx_from_uint(n);
+}
diff --git a/bindings/matlab/gd_native_type.c b/bindings/matlab/gd_native_type.c
new file mode 100644
index 0000000..19d290d
--- /dev/null
+++ b/bindings/matlab/gd_native_type.c
@@ -0,0 +1,57 @@
+/* Copyright (C) 2013 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+#include "gd_matlab.h"
+
+/*
+ % GD_NATIVE_TYPE  Report the native data type of a field
+ %
+ %   T = GD_NATIVE_TYPE(DIRFILE,FIELD_CODE)
+ %             returns the native data type, T, of the field specified by
+ %             FIELD_CODE.  The returned value will be one of the data type
+ %             symbols provided by GETDATA_CONSTATNS.
+ %
+ %   The DIRFILE object should have previously been created with GD_OPEN.
+ %
+ %   See the documentation on the C API function gd_native_type(3) in section 3
+ %   of the UNIX manual for more details.
+ %
+ %   See also GD_OPEN, GETDATA_CONSTANTS
+ */
+
+void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])
+{
+  DIRFILE *D;
+  void *data;
+  char *field_code;
+  gd_type_t n;
+
+  GDMX_CHECK_RHS(2);
+
+  D = gdmx_to_dirfile(prhs[0]);
+  field_code = gdmx_to_string(prhs, 1, 0);
+
+  n = gd_native_type(D, field_code);
+
+  mxFree(field_code);
+  gdmx_err(D, 0);
+
+  plhs[0] = gdmx_from_gd_type(n);
+}
diff --git a/bindings/matlab/gd_nentries.c b/bindings/matlab/gd_nentries.c
new file mode 100644
index 0000000..6cb26e6
--- /dev/null
+++ b/bindings/matlab/gd_nentries.c
@@ -0,0 +1,67 @@
+/* Copyright (C) 2013 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+#include "gd_matlab.h"
+
+/*
+ % GD_NENTRIES  Retrieve a count of fields
+ %
+ %   N = GD_NENTRIES(DIRFILE[,PARENT[,TYPE[,FLAGS]]])
+ %             returns the number of fields, N, in the dirfile DIRFILE which
+ %             satisfy the supplied PARENT, TYPE, and/or FLAGS.
+ %
+ %   If PARENT is given, and not numeric zero, metafields of the specified
+ %   parent field will be searched.  Otherwise, only top level fields are
+ %   considered.  If non-zero (matching all types), TYPE should be either one
+ %   of the GD.xxx_ENTRY symbols or else one of the special GD.xxx_ENTRIES
+ %   symbols provided by GETDATA_CONSTANTS.  FLAGS, if given, should be zero
+ %   or more of the GD.ENTRIES_... flags, bitwise or'd together.
+ %
+ %   The DIRFILE object should have previously been created with GD_OPEN.
+ %
+ %   See the documentation on the C API function gd_nentries(3) in
+ %   section 3 of the UNIX manual for more details.
+ %
+ %   See also GD_ENTRY_LIST, GD_OPEN, GETDATA_CONSTANTS
+ */
+
+void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])
+{
+  DIRFILE *D;
+  char *parent = NULL;
+  unsigned int n, type = 0, flags = 0;
+
+  GDMX_CHECK_RHS2(1,4);
+
+  D = gdmx_to_dirfile(prhs[0]);
+  if (nrhs > 1)
+    parent = gdmx_to_string(prhs, 1, 1);
+  if (nrhs > 2)
+    type = gdmx_to_uint(prhs, 2);
+  if (nrhs > 3)
+    flags = gdmx_to_uint(prhs, 3);
+
+  n = gd_nentries(D, parent, type, flags);
+
+  mxFree(parent);
+  gdmx_err(D, 0);
+
+  plhs[0] = gdmx_from_uint(n);
+}
diff --git a/bindings/matlab/gd_nfields.m b/bindings/matlab/gd_nfields.m
new file mode 100644
index 0000000..bd63c37
--- /dev/null
+++ b/bindings/matlab/gd_nfields.m
@@ -0,0 +1,30 @@
+function nfields = gd_nfields(D)
+% GD_NFIELDS  Retrieve a count of fields
+%
+%   GD_NFIELDS(DIRFILE)
+%             is equivalent to calling GD_NENTRIES(DIRFILE,0,0,0)
+%
+%   See also GD_NENTRIES
+
+  nfields = gd_nentries(D, 0, 0, 0);
+end
+
+% Copyright (C) 2013 D. V. Wiebe
+%
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%
+% This file is part of the GetData project.
+%
+% GetData is free software; you can redistribute it and/or modify it under
+% the terms of the GNU Lesser General Public License as published by the
+% Free Software Foundation; either version 2.1 of the License, or (at your
+% option) any later version.
+%
+% GetData is distributed in the hope that it will be useful, but WITHOUT
+% ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+% FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+% License for more details.
+%
+% You should have received a copy of the GNU Lesser General Public License
+% along with GetData; if not, write to the Free Software Foundation, Inc.,
+% 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
diff --git a/bindings/matlab/gd_nfields_by_type.m b/bindings/matlab/gd_nfields_by_type.m
new file mode 100644
index 0000000..78db654
--- /dev/null
+++ b/bindings/matlab/gd_nfields_by_type.m
@@ -0,0 +1,30 @@
+function nfields = gd_nfields_by_type(D, type)
+% GD_NFIELDS_BY_TYPE  Retrieve a count of fields
+%
+%   GD_NFIELDS_BY_TYPE(DIRFILE,TYPE)
+%             is equivalent to calling GD_NENTRIES(DIRFILE,0,TYPE,0)
+%
+%   See also GD_NENTRIES
+
+  nfields = gd_nentries(D, 0, type, 0);
+end
+
+% Copyright (C) 2013 D. V. Wiebe
+%
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%
+% This file is part of the GetData project.
+%
+% GetData is free software; you can redistribute it and/or modify it under
+% the terms of the GNU Lesser General Public License as published by the
+% Free Software Foundation; either version 2.1 of the License, or (at your
+% option) any later version.
+%
+% GetData is distributed in the hope that it will be useful, but WITHOUT
+% ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+% FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+% License for more details.
+%
+% You should have received a copy of the GNU Lesser General Public License
+% along with GetData; if not, write to the Free Software Foundation, Inc.,
+% 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
diff --git a/bindings/matlab/gd_nfragments.c b/bindings/matlab/gd_nfragments.c
new file mode 100644
index 0000000..d11d334
--- /dev/null
+++ b/bindings/matlab/gd_nfragments.c
@@ -0,0 +1,51 @@
+/* Copyright (C) 2013 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+#include "gd_matlab.h"
+
+/*
+ % GD_NFRAGMETNS  Report the number of fragments in a dirfile
+ %
+ %   N = GD_NFRAGMENTS(DIRFILE)
+ %             returns the number of fragments, N, in the dirfile DIRFILE.
+ %
+ %   The DIRFILE object should have previously been created with GD_OPEN.
+ %
+ %   See the documentation on the C API function gd_nfragments(3) in section 3
+ %   of the UNIX manual for more details.
+ %
+ %   See also GD_OPEN
+ */
+
+void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])
+{
+  DIRFILE *D;
+  int n;
+
+  GDMX_CHECK_RHS(1);
+
+  D = gdmx_to_dirfile(prhs[0]);
+
+  n = gd_nfragments(D);
+
+  gdmx_err(D, 0);
+
+  plhs[0] = gdmx_from_int(n);
+}
diff --git a/bindings/matlab/gd_nframes.c b/bindings/matlab/gd_nframes.c
new file mode 100644
index 0000000..280f995
--- /dev/null
+++ b/bindings/matlab/gd_nframes.c
@@ -0,0 +1,51 @@
+/* Copyright (C) 2013 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+#include "gd_matlab.h"
+
+/*
+ % GD_NFRAMES  Report the length of a dirfile
+ %
+ %   N = GD_NFRAMES(DIRFILE)
+ %             returns the nominal number of frames, N, in the dirfile DIRFILE.
+ %
+ %   The DIRFILE object should have previously been created with GD_OPEN.
+ %
+ %   See the documentation on the C API function gd_nframes(3) in section 3
+ %   of the UNIX manual for more details.
+ %
+ %   See also GD_OPEN
+ */
+
+void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])
+{
+  DIRFILE *D;
+  unsigned long long n;
+
+  GDMX_CHECK_RHS(1);
+
+  D = gdmx_to_dirfile(prhs[0]);
+
+  n = gd_nframes64(D);
+
+  gdmx_err(D, 0);
+
+  plhs[0] = gdmx_from_ullong(n);
+}
diff --git a/bindings/matlab/gd_nmfields.m b/bindings/matlab/gd_nmfields.m
new file mode 100644
index 0000000..551355c
--- /dev/null
+++ b/bindings/matlab/gd_nmfields.m
@@ -0,0 +1,30 @@
+function nfields = gd_nmfields(D, parent)
+% GD_NMFIELDS  Retrieve a count of fields
+%
+%   GD_NMFIELDS(DIRFILE,PARENT)
+%             is equivalent to calling GD_NENTRIES(DIRFILE,PARENT,0,0)
+%
+%   See also GD_NENTRIES
+
+  nfields = gd_nentries(D, parent, 0, 0);
+end
+
+% Copyright (C) 2013 D. V. Wiebe
+%
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%
+% This file is part of the GetData project.
+%
+% GetData is free software; you can redistribute it and/or modify it under
+% the terms of the GNU Lesser General Public License as published by the
+% Free Software Foundation; either version 2.1 of the License, or (at your
+% option) any later version.
+%
+% GetData is distributed in the hope that it will be useful, but WITHOUT
+% ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+% FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+% License for more details.
+%
+% You should have received a copy of the GNU Lesser General Public License
+% along with GetData; if not, write to the Free Software Foundation, Inc.,
+% 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
diff --git a/bindings/matlab/gd_nmfields_by_type.m b/bindings/matlab/gd_nmfields_by_type.m
new file mode 100644
index 0000000..dca8cee
--- /dev/null
+++ b/bindings/matlab/gd_nmfields_by_type.m
@@ -0,0 +1,30 @@
+function nfields = gd_nmfields_by_type(D, parent, type)
+% GD_NMFIELDS_BY_TYPE  Retrieve a count of fields
+%
+%   GD_NMFIELDS_BY_TYPE(DIRFILE,PARENT,TYPE)
+%             is equivalent to calling GD_NENTRIES(DIRFILE,PARENT,TYPE,0)
+%
+%   See also GD_NENTRIES
+
+  nfields = gd_nentries(D, parent, type, 0);
+end
+
+% Copyright (C) 2013 D. V. Wiebe
+%
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%
+% This file is part of the GetData project.
+%
+% GetData is free software; you can redistribute it and/or modify it under
+% the terms of the GNU Lesser General Public License as published by the
+% Free Software Foundation; either version 2.1 of the License, or (at your
+% option) any later version.
+%
+% GetData is distributed in the hope that it will be useful, but WITHOUT
+% ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+% FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+% License for more details.
+%
+% You should have received a copy of the GNU Lesser General Public License
+% along with GetData; if not, write to the Free Software Foundation, Inc.,
+% 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
diff --git a/bindings/matlab/gd_nmvectors.m b/bindings/matlab/gd_nmvectors.m
new file mode 100644
index 0000000..f5780cd
--- /dev/null
+++ b/bindings/matlab/gd_nmvectors.m
@@ -0,0 +1,34 @@
+function nfields = gd_nmvectors(D, parent)
+% GD_NMVECTORS  Retrieve a count of fields
+%
+%   GD_NMVECTORS(DIRFILE,PARENT)
+%             is equivalent to calling GD_NENTRIES(DIRFILE,PARENT, ...
+%                                                           GD.VECTOR_ENTRIES,0)
+%
+%   For GD, see GETDATA_CONSTANTS.
+%
+%   See also GD_NENTRIES, GETDATA_CONSTANTS
+
+  GD = getdata_constants();
+  nfields = gd_nentries(D, parent, GD.VECTOR_ENTRIES, 0);
+end
+
+% Copyright (C) 2013 D. V. Wiebe
+%
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%
+% This file is part of the GetData project.
+%
+% GetData is free software; you can redistribute it and/or modify it under
+% the terms of the GNU Lesser General Public License as published by the
+% Free Software Foundation; either version 2.1 of the License, or (at your
+% option) any later version.
+%
+% GetData is distributed in the hope that it will be useful, but WITHOUT
+% ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+% FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+% License for more details.
+%
+% You should have received a copy of the GNU Lesser General Public License
+% along with GetData; if not, write to the Free Software Foundation, Inc.,
+% 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
diff --git a/bindings/matlab/gd_nvectors.m b/bindings/matlab/gd_nvectors.m
new file mode 100644
index 0000000..e7dabc7
--- /dev/null
+++ b/bindings/matlab/gd_nvectors.m
@@ -0,0 +1,34 @@
+function nvectors = gd_nvectors(D)
+% GD_NVECTORS  Retrieve a count of fields
+%
+%   GD_NVECTORS(DIRFILE)
+%             is equivalent to calling GD_NENTRIES(DIRFILE,0, ...
+%                                                           GD.VECTOR_ENTRIES,0)
+%
+%   For GD, see GETDATA_CONSTANTS.
+%
+%   See also GD_NENTRIES, GETDATA_CONSTANTS
+
+  GD = getdata_constants();
+  nvectors = gd_nentries(D, 0, GD.VECTOR_ENTRIES, 0);
+end
+
+% Copyright (C) 2013 D. V. Wiebe
+%
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%
+% This file is part of the GetData project.
+%
+% GetData is free software; you can redistribute it and/or modify it under
+% the terms of the GNU Lesser General Public License as published by the
+% Free Software Foundation; either version 2.1 of the License, or (at your
+% option) any later version.
+%
+% GetData is distributed in the hope that it will be useful, but WITHOUT
+% ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+% FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+% License for more details.
+%
+% You should have received a copy of the GNU Lesser General Public License
+% along with GetData; if not, write to the Free Software Foundation, Inc.,
+% 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
diff --git a/bindings/matlab/gd_open.c b/bindings/matlab/gd_open.c
new file mode 100644
index 0000000..4b579f9
--- /dev/null
+++ b/bindings/matlab/gd_open.c
@@ -0,0 +1,62 @@
+/* Copyright (C) 2013 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+#include "gd_matlab.h"
+
+/*
+ % GD_OPEN  Open or create a dirfile
+ %
+ %   D = GD_OPEN(PATH[,FLAGS])
+ %             opens the dirfile PATH, returning a dirfile object, D.  If
+ %             given, FLAGS should be a bitwise or'd collection of dirfile flags
+ %             provided by GETDATA_CONSTANTS.  If omitted, FLAGS defaults to
+ %             GD.RDONLY.
+ %
+ %   Unlike in the C API, an error in GD_OPEN does not result in the creation of
+ %   an invalid dirfile (so GD_ERROR and GD_ERROR_STRING cannot be used in a
+ %   CATCH block after a failed a GD_OPEN call).  Open dirfiles should be
+ %   deallocated by calling GD_DISCARD or GD_CLOSE when no longer needed.
+ %
+ %   See the documentation on the C API function gd_open(3) in section 3
+ %   of the UNIX manual for more details.
+ %
+ %   See also GD_DISCARD, GD_CLOSE, GETDATA_CONSTANTS
+ */
+
+void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])
+{
+  char *filename;
+  unsigned long flags = GD_RDONLY;
+  DIRFILE *D;
+
+  GDMX_CHECK_RHS2(1,2);
+
+  filename = gdmx_to_string(prhs, 0, 0);
+
+  if (nrhs > 1)
+    flags = gdmx_to_ulong(prhs, 1);
+
+  D = gd_open(filename, flags);
+  mxFree(filename);
+
+  gdmx_err(D, 1);
+
+  plhs[0] = gdmx_from_dirfile(D);
+}
diff --git a/bindings/matlab/gd_parent_fragment.c b/bindings/matlab/gd_parent_fragment.c
new file mode 100644
index 0000000..52f984b
--- /dev/null
+++ b/bindings/matlab/gd_parent_fragment.c
@@ -0,0 +1,54 @@
+/* Copyright (C) 2013 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+#include "gd_matlab.h"
+
+/*
+ % GD_PARENT_FRAGMENT  Report the parent of a fragment
+ %
+ %  F = GD_PARENT_FRAGMENT(DIRFILE,FRAGMENT)
+ %             reports the parent fragment index, F, of the fragment indexed by
+ %             FRAGMENT.
+ %
+ %   The DIRFILE object should have previously been created with GD_OPEN.
+ %
+ %   See the documentation on the C API function gd_parent_fragment(3) in
+ %   section 3 of the UNIX manual for more details.
+ %
+ %   See also GD_INCLUDE, GD_OPEN
+ */
+
+void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])
+{
+  DIRFILE *D;
+  void *data;
+  int i, n;
+
+  GDMX_CHECK_RHS(2);
+
+  D = gdmx_to_dirfile(prhs[0]);
+  i = gdmx_to_int(prhs, 1);
+
+  n = gd_parent_fragment(D, i);
+
+  gdmx_err(D, 0);
+
+  plhs[0] = gdmx_from_int(n);
+}
diff --git a/bindings/matlab/gd_protection.c b/bindings/matlab/gd_protection.c
new file mode 100644
index 0000000..428cc3d
--- /dev/null
+++ b/bindings/matlab/gd_protection.c
@@ -0,0 +1,55 @@
+/* Copyright (C) 2013 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+#include "gd_matlab.h"
+
+/*
+ % GD_PROTECTION  Report the protection level of a fragment
+ %
+ %   P = GD_PROTECTION(DIRFILE,FRAGMENT)
+ %             reports the protection level, P, of the fragment given by
+ %             FRAGMENT.  The returned value will be one of the GD.PROTECT_...
+ %             symbols provided by GETDATA_CONSTANTS.
+ %
+ %   The DIRFILE object should have previously been created with GD_OPEN.
+ %
+ %   See the documentation on the C API function gd_protection(3) in section 3
+ %   of the UNIX manual for more details.
+ %
+ %   See also GD_ALTER_PROTECTION, GD_OPEN, GETDATA_CONSTANTS
+ */
+
+void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])
+{
+  DIRFILE *D;
+  void *data;
+  int i, n;
+
+  GDMX_CHECK_RHS(2);
+
+  D = gdmx_to_dirfile(prhs[0]);
+  i = gdmx_to_int(prhs, 1);
+
+  n = gd_protection(D, i);
+
+  gdmx_err(D, 0);
+
+  plhs[0] = gdmx_from_int(n);
+}
diff --git a/bindings/matlab/gd_put_carray.m b/bindings/matlab/gd_put_carray.m
new file mode 100644
index 0000000..bc28e49
--- /dev/null
+++ b/bindings/matlab/gd_put_carray.m
@@ -0,0 +1,31 @@
+function gd_put_carray(D, field_code, data)
+% GD_PUT_CARRAY  Modify CARRAY values
+%
+%   GD_PUT_CARRAY(DIRFILE,FIELD_CODE,DATA)
+%             is equivalent to calling GD_PUT_ARRAY_SLICE(DIRFILE, ...
+%                                                             FIELD_CODE,0,DATA)
+%
+%   See also GD_PUT_ARRAY_SLICE
+
+  gd_put_carray_slice(D, field_code, 0, data);
+end
+
+% Copyright (C) 2013 D. V. Wiebe
+%
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%
+% This file is part of the GetData project.
+%
+% GetData is free software; you can redistribute it and/or modify it under
+% the terms of the GNU Lesser General Public License as published by the
+% Free Software Foundation; either version 2.1 of the License, or (at your
+% option) any later version.
+%
+% GetData is distributed in the hope that it will be useful, but WITHOUT
+% ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+% FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+% License for more details.
+%
+% You should have received a copy of the GNU Lesser General Public License
+% along with GetData; if not, write to the Free Software Foundation, Inc.,
+% 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
diff --git a/bindings/matlab/gd_put_carray_slice.c b/bindings/matlab/gd_put_carray_slice.c
new file mode 100644
index 0000000..ff6463d
--- /dev/null
+++ b/bindings/matlab/gd_put_carray_slice.c
@@ -0,0 +1,60 @@
+/* Copyright (C) 2013 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+#include "gd_matlab.h"
+
+/*
+ % GD_PUT_CARRAY_SLICE  Modify CARRAY or CONST values
+ %
+ %   GD_PUT_CARRAY_SLICE(DIRFILE,FIELD_CODE,START,VALUES)
+ %             sets elements of the CARRAY or CONST field called FIELD_CODE
+ %             starting at element START to the values in the array VALUE.
+ %
+ %   The DIRFILE object should have previously been created with GD_OPEN.
+ %
+ %   See the documentation on the C API function gd_put_carray_slice(3) in
+ %   section 3 of the UNIX manual for more details.
+ %
+ %   See also GD_GET_CARRAY_SLICE, GD_OPEN
+ */
+
+void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])
+{
+  DIRFILE *D;
+  void *data;
+  char *field_code;
+  unsigned int start;
+  size_t nsamp, n;
+  gd_type_t type;
+
+  GDMX_NO_LHS;
+  GDMX_CHECK_RHS(4);
+
+  D = gdmx_to_dirfile(prhs[0]);
+  field_code = gdmx_to_string(prhs, 1, 0);
+  start = gdmx_to_uint(prhs, 2);
+  gdmx_to_data(&data, &type, &nsamp, prhs, 3);
+
+  gd_put_carray_slice(D, field_code, start, nsamp, type, data);
+
+  gdmx_free_data(data, type);
+  mxFree(field_code);
+  gdmx_err(D, 0);
+}
diff --git a/bindings/matlab/gd_put_constant.m b/bindings/matlab/gd_put_constant.m
new file mode 100644
index 0000000..181e35c
--- /dev/null
+++ b/bindings/matlab/gd_put_constant.m
@@ -0,0 +1,31 @@
+function gd_put_constant(D, field_code, data)
+% GD_PUT_CONSTANT  Modify CONST values
+%
+%   GD_PUT_CONSTANT(DIRFILE,FIELD_CODE,DATA)
+%             is equivalent to calling GD_PUT_ARRAY_SLICE(DIRFILE, ...
+%                                                             FIELD_CODE,0,DATA)
+%
+%   See also GD_PUT_ARRAY_SLICE
+
+  gd_put_carray_slice(D, field_code, 0, data(1));
+end
+
+% Copyright (C) 2013 D. V. Wiebe
+%
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%
+% This file is part of the GetData project.
+%
+% GetData is free software; you can redistribute it and/or modify it under
+% the terms of the GNU Lesser General Public License as published by the
+% Free Software Foundation; either version 2.1 of the License, or (at your
+% option) any later version.
+%
+% GetData is distributed in the hope that it will be useful, but WITHOUT
+% ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+% FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+% License for more details.
+%
+% You should have received a copy of the GNU Lesser General Public License
+% along with GetData; if not, write to the Free Software Foundation, Inc.,
+% 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
diff --git a/bindings/matlab/gd_put_string.c b/bindings/matlab/gd_put_string.c
new file mode 100644
index 0000000..931a2fc
--- /dev/null
+++ b/bindings/matlab/gd_put_string.c
@@ -0,0 +1,54 @@
+/* Copyright (C) 2013 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+#include "gd_matlab.h"
+
+/*
+ % GD_PUT_STRING  Modify STRING values
+ %
+ %   GD_PUT_STRING(DIRFILE,FIELD_CODE,VALUE)
+ %             sets the value of the STRING field FIELD_CODE to VALUE.
+ %
+ %   The DIRFILE object should have previously been created with GD_OPEN.
+ %
+ %   See the documentation on the C API function gd_put_string(3) in section 3
+ %   of the UNIX manual for more details.
+ %
+ %   See also GD_GET_STRING, GD_OPEN
+ */
+
+void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])
+{
+  DIRFILE *D;
+  char *field_name, *value;
+
+  GDMX_NO_LHS;
+  GDMX_CHECK_RHS(3);
+
+  D = gdmx_to_dirfile(prhs[0]);
+  field_name = gdmx_to_string(prhs, 1, 0);
+  value = gdmx_to_string(prhs, 2, 0);
+
+  gd_put_string(D, field_name, value);
+
+  mxFree(field_name);
+  mxFree(value);
+  gdmx_err(D, 0);
+}
diff --git a/bindings/matlab/gd_putdata.c b/bindings/matlab/gd_putdata.c
new file mode 100644
index 0000000..623b2af
--- /dev/null
+++ b/bindings/matlab/gd_putdata.c
@@ -0,0 +1,64 @@
+/* Copyright (C) 2013 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+#include "gd_matlab.h"
+
+/*
+ % GD_PUTDATA  Write vector data
+ %
+ %   GD_PUTDATA(DIRFILE,FIELD_CODE,FIRST_FRAME,FIRST_SAMPLE,DATA)
+ %             writes the data in DATA to the field called FIELD_CODE.  The
+ %             sequential samples are written starting FIRST_SAMPLE samples
+ %             after the start of frame FIRST_FRAME.
+ %
+ %   The DIRFILE object should have previously been created with GD_OPEN.
+ %
+ %   See the documentation on the C API function gd_putdata(3) in section 3
+ %   of the UNIX manual for more details.
+ %
+ %   See also GD_GETDATA, GD_PUT_CARRAY_SLICE, GD_OPEN
+ */
+
+void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])
+{
+  DIRFILE *D;
+  void *data;
+  char *field_code;
+  long long first_frame, first_samp;
+  size_t nsamp, n;
+  gd_type_t type;
+
+  GDMX_CHECK_RHS(5);
+
+  D = gdmx_to_dirfile(prhs[0]);
+  field_code = gdmx_to_string(prhs, 1, 0);
+  first_frame = gdmx_to_llong(prhs, 2);
+  first_samp = gdmx_to_llong(prhs, 3);
+  gdmx_to_data(&data, &type, &nsamp, prhs, 4);
+
+  n = gd_putdata64(D, field_code, (gd_off64_t)first_frame,
+      (gd_off64_t)first_samp, 0, nsamp, type, data);
+
+  gdmx_free_data(data, type);
+  mxFree(field_code);
+  gdmx_err(D, 0);
+
+  plhs[0] = gdmx_from_size_t(n);
+}
diff --git a/bindings/matlab/gd_raw_close.c b/bindings/matlab/gd_raw_close.c
new file mode 100644
index 0000000..2a8fd1e
--- /dev/null
+++ b/bindings/matlab/gd_raw_close.c
@@ -0,0 +1,55 @@
+/* Copyright (C) 2013 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+#include "gd_matlab.h"
+
+/*
+ % GD_RAW_CLOSE  Close binary files
+ %
+ %   GD_RAW_CLOSE(DIRFILE[,FIELD_CODE])
+ %             closes open binary data files associated with the dirfile
+ %             DIRFILE.  If FIELD_CODE is given and not numeric zero, only the
+ %             specified field is closed.  Otherwise all open data files closed.
+ %
+ %   The DIRFILE object should have previously been created with GD_OPEN.
+ %
+ %   See the documentation on the C API function gd_raw_close(3) in section 3
+ %   of the UNIX manual for more details.
+ %
+ %   See also GD_CLOSE, GD_SYNC, GD_FLUSH, GD_OPEN
+ */
+
+void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])
+{
+  DIRFILE *D;
+  char *field_code = NULL;
+
+  GDMX_NO_LHS;
+  GDMX_CHECK_RHS2(1,2);
+
+  D = gdmx_to_dirfile(prhs[0]);
+  if (nrhs > 1)
+    field_code = gdmx_to_string(prhs, 1, 1);
+
+  gd_raw_close(D, field_code);
+
+  mxFree(field_code);
+  gdmx_err(D, 0);
+}
diff --git a/bindings/matlab/gd_raw_filename.c b/bindings/matlab/gd_raw_filename.c
new file mode 100644
index 0000000..df1f25c
--- /dev/null
+++ b/bindings/matlab/gd_raw_filename.c
@@ -0,0 +1,55 @@
+/* Copyright (C) 2013 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+#include "gd_matlab.h"
+
+/*
+ % GD_RAW_FILENAME  Report the pathname of a binary data file
+ %
+ %   P = GD_RAW_FILENAME(DIRFILE,FIELD_CODE)
+ %             reports the pathname, P, of the binary file backing the RAW field
+ %             specified by FIELD_CODE in the the dirfile DIRFILE.
+ %
+ %   The DIRFILE object should have previously been created with GD_OPEN.
+ %
+ %   See the documentation on the C API function gd_raw_filename(3) in section 3
+ %   of the UNIX manual for more details.
+ %
+ %   See also GD_OPEN
+ */
+
+void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])
+{
+  DIRFILE *D;
+  const char *s;
+  char *field_code;
+
+  GDMX_CHECK_RHS(2);
+
+  D = gdmx_to_dirfile(prhs[0]);
+  field_code = gdmx_to_string(prhs, 1, 0);
+
+  s = gd_raw_filename(D, field_code);
+
+  mxFree(field_code);
+  gdmx_err(D, 0);
+
+  plhs[0] = mxCreateString(s);
+}
diff --git a/bindings/matlab/gd_reference.c b/bindings/matlab/gd_reference.c
new file mode 100644
index 0000000..8786d12
--- /dev/null
+++ b/bindings/matlab/gd_reference.c
@@ -0,0 +1,57 @@
+/* Copyright (C) 2013 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+#include "gd_matlab.h"
+
+/*
+ % GD_REFERENCE  Set or report the reference field name
+ %
+ %   F = GD_REFERENCE(DIRFILE[,FIELD_CODE])
+ %             sets the reference field of DIRFILE to FIELD_CODE, if given and
+ %             not numeric zero.  Returns the reference field, F, after possibly
+ %             updating it.
+ %
+ %   The DIRFILE object should have previously been created with GD_OPEN.
+ %
+ %   See the documentation on the C API function gd_reference(3) in section 3
+ %   of the UNIX manual for more details.
+ %
+ %   See also GD_NFRAMES, GD_OPEN
+ */
+
+void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])
+{
+  DIRFILE *D;
+  const char *s;
+  char *field_code = NULL;
+
+  GDMX_CHECK_RHS2(1,2);
+
+  D = gdmx_to_dirfile(prhs[0]);
+  if (nrhs > 1)
+    field_code = gdmx_to_string(prhs, 1, 1);
+
+  s = gd_reference(D, field_code);
+
+  mxFree(field_code);
+  gdmx_err(D, 0);
+
+  plhs[0] = mxCreateString(s);
+}
diff --git a/bindings/matlab/gd_rename.c b/bindings/matlab/gd_rename.c
new file mode 100644
index 0000000..99b27ca
--- /dev/null
+++ b/bindings/matlab/gd_rename.c
@@ -0,0 +1,58 @@
+/* Copyright (C) 2013 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+#include "gd_matlab.h"
+
+/*
+ % GD_RENAME  Rename a field or alias
+ %
+ %   GD_RENAME(DIRFILE,OLD_NAME,NEW_NAME[,FLAGS])
+ %             renames the field called OLD_NAME to NEW_NAME.  If given, FLAGS
+ %             should be zero or more of the GD.REN_... symbols provided by
+ %             GETDATA_CONSTANTS.
+ %
+ %   The DIRFILE object should have previously been created with GD_OPEN.
+ %
+ %   See the documentation on the C API function gd_rename(3) in section 3
+ %   of the UNIX manual for more details.
+ %
+ %   See also GD_OPEN
+ */
+
+void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])
+{
+  DIRFILE *D;
+  char *field_code, *new_code;
+  unsigned int flags = 0;
+
+  GDMX_NO_LHS;
+  GDMX_CHECK_RHS2(3,4);
+
+  D = gdmx_to_dirfile(prhs[0]);
+  field_code = gdmx_to_string(prhs, 1, 0);
+  new_code = gdmx_to_string(prhs, 2, 0);
+  if (nrhs > 3)
+    flags = gdmx_to_uint(prhs, 3);
+
+  gd_rename(D, field_code, new_code, flags);
+
+  mxFree(field_code);
+  gdmx_err(D, 0);
+}
diff --git a/bindings/matlab/gd_rewrite_fragment.c b/bindings/matlab/gd_rewrite_fragment.c
new file mode 100644
index 0000000..c1fbe73
--- /dev/null
+++ b/bindings/matlab/gd_rewrite_fragment.c
@@ -0,0 +1,54 @@
+/* Copyright (C) 2013 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+#include "gd_matlab.h"
+
+/*
+ % GD_REWRITE_FRAGMENT  Rewrite fragment metadata to disk
+ %
+ %   GD_REWRITE_FRAGMENT(DIRFILE[,FRAGMENT])
+ %             forces a rewrite of the fragment metadata on disk of the fragment
+ %             indexed by FRAGMENT, if given, or else all fragments.
+ %
+ %   The DIRFILE object should have previously been created with GD_OPEN.
+ %
+ %   See the documentation on the C API function gd_rewrite_fragment(3) in
+ %   section 3 of the UNIX manual for more details.
+ %
+ %   See also GD_METAFLUSH, GD_OPEN, GD_CLOSE
+ */
+
+void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])
+{
+  DIRFILE *D;
+  void *data;
+  int i = GD_ALL_FRAGMENTS;
+
+  GDMX_NO_LHS;
+  GDMX_CHECK_RHS2(1,2);
+
+  D = gdmx_to_dirfile(prhs[0]);
+  if (nrhs > 1)
+    i = gdmx_to_int(prhs, 1);
+
+  gd_rewrite_fragment(D, i);
+
+  gdmx_err(D, 0);
+}
diff --git a/bindings/matlab/gd_seek.c b/bindings/matlab/gd_seek.c
new file mode 100644
index 0000000..0b9f161
--- /dev/null
+++ b/bindings/matlab/gd_seek.c
@@ -0,0 +1,66 @@
+/* Copyright (C) 2013 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+#include "gd_matlab.h"
+
+/*
+ % GD_SEEK  Set the location of a field's I/O pointer
+ %
+ %   P = GD_SEEK(DIRFILE,FIELD_CODE,FRAME,SAMPLE,FLAGS)
+ %             places the I/O pointer of the field FIELD_CODE SAMPLE samples
+ %             after the start of frame number FRAME.  Flags should be one of
+ %             GD.SEEK_SET, GD.SEEK_CUR, or GD.SEEK_END, possibly bitwise or'd
+ %             with GD.SEEK_WRITE.  These symbols are provided by
+ %             GETDATA_CONSTANTS.  Returns the position, P, in samples, after
+ %             setting it.
+ %
+ %   The DIRFILE object should have previously been created with GD_OPEN.
+ %
+ %   See the documentation on the C API function gd_seek(3) in section 3
+ %   of the UNIX manual for more details.
+ %
+ %   See also GD_TELL, GD_GETDATA, GD_OPEN.
+ */
+
+void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])
+{
+  DIRFILE *D;
+  void *data;
+  char *field_code;
+  long long first_frame, first_samp;
+  int flags;
+  unsigned long long pos;
+
+  GDMX_CHECK_RHS(5);
+
+  D = gdmx_to_dirfile(prhs[0]);
+  field_code = gdmx_to_string(prhs, 1, 0);
+  first_frame = gdmx_to_llong(prhs, 2);
+  first_samp = gdmx_to_llong(prhs, 3);
+  flags = gdmx_to_int(prhs, 4);
+
+  pos = gd_seek64(D, field_code, (gd_off64_t)first_frame,
+      (gd_off64_t)first_samp, flags);
+
+  mxFree(field_code);
+  gdmx_err(D, 0);
+
+  plhs[0] = gdmx_from_ullong(pos);
+}
diff --git a/bindings/matlab/gd_spf.c b/bindings/matlab/gd_spf.c
new file mode 100644
index 0000000..207e322
--- /dev/null
+++ b/bindings/matlab/gd_spf.c
@@ -0,0 +1,54 @@
+/* Copyright (C) 2013 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+#include "gd_matlab.h"
+
+/*
+ % GD_SPF  Report the samples-per-frame of a field
+ %
+ %   S = GD_SPF(DIRFILE,FIELD_CODE)
+ %             reports the samples-per-frame, S, of the field called FIELD_CODE.
+ %
+ %   The DIRFILE object should have previously been created with GD_OPEN.
+ %
+ %   See the documentation on the C API function gd_spf(3) in section 3
+ %   of the UNIX manual for more details.
+ %
+ %   See also GD_OPEN
+ */
+
+void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])
+{
+  DIRFILE *D;
+  char *field_code;
+  unsigned int n;
+
+  GDMX_CHECK_RHS(2);
+
+  D = gdmx_to_dirfile(prhs[0]);
+  field_code = gdmx_to_string(prhs, 1, 0);
+
+  n = gd_spf(D, field_code);
+
+  mxFree(field_code);
+  gdmx_err(D, 0);
+
+  plhs[0] = gdmx_from_uint(n);
+}
diff --git a/bindings/matlab/gd_strings.c b/bindings/matlab/gd_strings.c
new file mode 100644
index 0000000..28f003a
--- /dev/null
+++ b/bindings/matlab/gd_strings.c
@@ -0,0 +1,53 @@
+/* Copyright (C) 2013 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+#include "gd_matlab.h"
+
+/*
+ % GD_STRINGS  Fetch all STRING values
+ %
+ %   A = GD_STRINGS(DIRFILE)
+ %             returns a cell array of strings, A, containing all the STRING
+ %             data in the dirfile DIRFILE.  A corresponding array of field
+ %             names can be produced with GD_FIELD_LIST_BY_TYPE.
+ %
+ %   The DIRFILE object should have previously been created with GD_OPEN.
+ %
+ %   See the documentation on the C API function gd_strings(3) in section 3
+ %   of the UNIX manual for more details.
+ %
+ %   See also GD_MSTRINGS, GD_FIELD_LIST_BY_TYPE, GD_GET_STRING
+ */
+
+void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])
+{
+  DIRFILE *D;
+  const char **sl;
+
+  GDMX_CHECK_RHS(1);
+
+  D = gdmx_to_dirfile(prhs[0]);
+
+  sl = gd_strings(D);
+
+  gdmx_err(D, 0);
+
+  plhs[0] = gdmx_from_string_list(sl);
+}
diff --git a/bindings/matlab/gd_strtok.c b/bindings/matlab/gd_strtok.c
new file mode 100644
index 0000000..0c89a7d
--- /dev/null
+++ b/bindings/matlab/gd_strtok.c
@@ -0,0 +1,69 @@
+/* Copyright (C) 2013 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+#include "gd_matlab.h"
+
+/*
+ % GD_STRTOK  Tokenise a string using the GetData parser
+ %
+ %   A = GD_STRTOK(DIRFILE,STRING)
+ %             Converts the string STRING into a cell array of strings, A, by
+ %             tokenising it using the GetData library parser.  Unlike the C API
+ %             this function completely tokenises the provided string at once,
+ %             returning all tokens, and should not be called repeatedly.
+ %
+ %   The DIRFILE object should have previously been created with GD_OPEN.
+ %
+ %   See the documentation on the C API function gd_strtok(3) in section 3
+ %   of the UNIX manual for more details.
+ %
+ %   See also GD_OPEN, GD_DIRFILE_STANDARDS
+ */
+
+void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])
+{
+  DIRFILE *D;
+  char *tok, *s;
+  mxArray **sl = NULL;
+  size_t i, n = 0;
+
+  GDMX_CHECK_RHS(2);
+
+  D = gdmx_to_dirfile(prhs[0]);
+  s = gdmx_to_string(prhs, 1, 0);
+
+  /* convert */
+  for (tok = gd_strtok(D, s); tok; tok = gd_strtok(D, NULL)) {
+    mxArray **ptr = (mxArray**)mxRealloc(sl, sizeof(mxArray*) * (n + 1));
+    if (ptr == NULL)
+      mexErrMsgIdAndTxt("GetData:GDMX:Alloc", "Out of memory.");
+
+    sl = ptr;
+    sl[n++] = mxCreateString(tok);
+    free(tok);
+  }
+
+  gdmx_err(D, 0);
+
+  plhs[0] = mxCreateCellMatrix(1, n);
+  for (i = 0; i < n; ++i)
+    mxSetCell(plhs[0], i, sl[i]);
+  mxFree(sl);
+}
diff --git a/bindings/matlab/gd_sync.c b/bindings/matlab/gd_sync.c
new file mode 100644
index 0000000..5b36d9d
--- /dev/null
+++ b/bindings/matlab/gd_sync.c
@@ -0,0 +1,56 @@
+/* Copyright (C) 2013 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+#include "gd_matlab.h"
+
+/*
+ % GD_SYNC  Flush modifications to disk
+ %
+ %   GD_SYNC(DIRFILE[,FIELD_CODE])
+ %             flushes the binary data files associated with the dirfile DIRFILE
+ %             to disk.  If FIELD_CODE is given and not numeric zero, only the
+ %             specified field is synced.  Otherwise all open data files are
+ %             synced.  In this second case, modified metadata is also flushed.
+ %
+ %   The DIRFILE object should have previously been created with GD_OPEN.
+ %
+ %   See the documentation on the C API function gd_sync(3) in section 3
+ %   of the UNIX manual for more details.
+ %
+ %   See also GD_CLOSE, GD_FLUSH, GD_RAW_CLOSE, GD_OPEN
+ */
+
+void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])
+{
+  DIRFILE *D;
+  char *field_code = NULL;
+
+  GDMX_NO_LHS;
+  GDMX_CHECK_RHS2(1,2);
+
+  D = gdmx_to_dirfile(prhs[0]);
+  if (nrhs > 1)
+    field_code = gdmx_to_string(prhs, 1, 1);
+
+  gd_sync(D, field_code);
+
+  mxFree(field_code);
+  gdmx_err(D, 0);
+}
diff --git a/bindings/matlab/gd_tell.c b/bindings/matlab/gd_tell.c
new file mode 100644
index 0000000..4546ec5
--- /dev/null
+++ b/bindings/matlab/gd_tell.c
@@ -0,0 +1,56 @@
+/* Copyright (C) 2013 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+#include "gd_matlab.h"
+
+/*
+ % GD_TELL  Report the location of a field's I/O pointer
+ %
+ %   P = GD_TELL(DIRFILE,FIELD_CODE)
+ %             returns the position, P, in samples, of the field FIELD_CODE's
+ %             I/O pointer.
+ %
+ %   The DIRFILE object should have previously been created with GD_OPEN.
+ %
+ %   See the documentation on the C API function gd_tell(3) in section 3
+ %   of the UNIX manual for more details.
+ %
+ %   See also GD_SEEK, GD_GETDATA, GD_OPEN.
+ */
+
+void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])
+{
+  DIRFILE *D;
+  void *data;
+  char *field_code;
+  unsigned long long pos;
+
+  GDMX_CHECK_RHS(2);
+
+  D = gdmx_to_dirfile(prhs[0]);
+  field_code = gdmx_to_string(prhs, 1, 0);
+
+  pos = gd_tell64(D, field_code);
+
+  mxFree(field_code);
+  gdmx_err(D, 0);
+
+  plhs[0] = gdmx_from_ullong(pos);
+}
diff --git a/bindings/matlab/gd_unhide.c b/bindings/matlab/gd_unhide.c
new file mode 100644
index 0000000..d562e41
--- /dev/null
+++ b/bindings/matlab/gd_unhide.c
@@ -0,0 +1,52 @@
+/* Copyright (C) 2013 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+#include "gd_matlab.h"
+
+/*
+ % GD_UNHIDE  Unhide a field
+ %
+ %   GD_UNHIDE(DIRFILE,FIELD_CODE)
+ %             unhides the field called FIELD_CODE.
+ %
+ %   The DIRFILE object should have previously been created with GD_OPEN.
+ %
+ %   See the documentation on the C API function gd_unhide(3) in section 3
+ %   of the UNIX manual for more details.
+ %
+ %   See also GD_HIDDEN, GD_HIDE, GD_OPEN
+ */
+
+void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])
+{
+  DIRFILE *D;
+  char *field_code;
+
+  GDMX_NO_LHS;
+  GDMX_CHECK_RHS(2);
+
+  D = gdmx_to_dirfile(prhs[0]);
+  field_code = gdmx_to_string(prhs, 1, 0);
+
+  gd_unhide(D, field_code);
+
+  mxFree(field_code);
+  gdmx_err(D, 0);
+}
diff --git a/bindings/matlab/gd_uninclude.c b/bindings/matlab/gd_uninclude.c
new file mode 100644
index 0000000..0157226
--- /dev/null
+++ b/bindings/matlab/gd_uninclude.c
@@ -0,0 +1,56 @@
+/* Copyright (C) 2013 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+#include "gd_matlab.h"
+
+/*
+ % GD_UNINCLUDE  Remove a metadata fragment from a dirfile
+ %
+ %   GD_FLUSH(DIRFILE,FRAGMENT[,DEL])
+ %             removes the fragment indexed by FRAGMENT from the dirfile
+ %             DIRFILE.  If DEL is given and non-zero, also deletes the file
+ %             on disk.
+ %
+ %   The DIRFILE object should have previously been created with GD_OPEN.
+ %
+ %   See the documentation on the C API function gd_uninclude(3) in section 3
+ %   of the UNIX manual for more details.
+ %
+ %   See also GD_INCLUDE, GD_OPEN
+ */
+
+void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])
+{
+  DIRFILE *D;
+  void *data;
+  int i, d = 0;
+
+  GDMX_NO_LHS;
+  GDMX_CHECK_RHS2(2,3);
+
+  D = gdmx_to_dirfile(prhs[0]);
+  i = gdmx_to_int(prhs, 1);
+  if (nrhs > 2)
+    d = gdmx_to_int(prhs, 2);
+
+  gd_uninclude(D, i, d);
+
+  gdmx_err(D, 0);
+}
diff --git a/bindings/matlab/gd_validate.c b/bindings/matlab/gd_validate.c
new file mode 100644
index 0000000..40a4019
--- /dev/null
+++ b/bindings/matlab/gd_validate.c
@@ -0,0 +1,55 @@
+/* Copyright (C) 2013 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+#include "gd_matlab.h"
+
+/*
+ % GD_VALIDATE  flush modifications to disk
+ %
+ %   B = GD_VALIDATE(DIRFILE,FIELD_CODE)
+ %             returns boolean true, B, if FIELD_CODE is a valid field.
+ %
+ %   The DIRFILE object should have previously been created with GD_OPEN.
+ %
+ %   See the documentation on the C API function gd_validate(3) in section 3
+ %   of the UNIX manual for more details.
+ %
+ %   See also GD_OPEN
+ */
+
+void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])
+{
+  DIRFILE *D;
+  void *data;
+  char *field_code;
+  int n;
+
+  GDMX_CHECK_RHS(2);
+
+  D = gdmx_to_dirfile(prhs[0]);
+  field_code = gdmx_to_string(prhs, 1, 0);
+
+  n = gd_validate(D, field_code);
+
+  mxFree(field_code);
+  gdmx_err(D, 0);
+
+  plhs[0] = gdmx_from_int(n);
+}
diff --git a/bindings/matlab/gd_vector_list.m b/bindings/matlab/gd_vector_list.m
new file mode 100644
index 0000000..2b145ba
--- /dev/null
+++ b/bindings/matlab/gd_vector_list.m
@@ -0,0 +1,34 @@
+function field_list = gd_vector_list(D)
+% GD_VECTOR_LIST  Retrieve a list of field names
+%
+%   GD_VECTOR_LIST(DIRFILE)
+%             is equivalent to calling GD_ENTRY_LIST(DIRFILE,0, ...
+%                                                           GD.VECTOR_ENTRIES,0)
+%
+%   For GD, see GETDATA_CONSTANTS.
+%
+%   See also GD_ENTRY_LIST, GETDATA_CONSTANTS
+
+  GD = getdata_constants();
+  field_list = gd_entry_list(D, 0, GD.VECTOR_ENTRIES, 0);
+end
+
+% Copyright (C) 2013 D. V. Wiebe
+%
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%
+% This file is part of the GetData project.
+%
+% GetData is free software; you can redistribute it and/or modify it under
+% the terms of the GNU Lesser General Public License as published by the
+% Free Software Foundation; either version 2.1 of the License, or (at your
+% option) any later version.
+%
+% GetData is distributed in the hope that it will be useful, but WITHOUT
+% ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+% FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+% License for more details.
+%
+% You should have received a copy of the GNU Lesser General Public License
+% along with GetData; if not, write to the Free Software Foundation, Inc.,
+% 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
diff --git a/bindings/matlab/gd_verbose_prefix.c b/bindings/matlab/gd_verbose_prefix.c
new file mode 100644
index 0000000..ed4add4
--- /dev/null
+++ b/bindings/matlab/gd_verbose_prefix.c
@@ -0,0 +1,53 @@
+/* Copyright (C) 2013 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+#include "gd_matlab.h"
+
+/*
+ % GD_VERBOSE_PREFIX  set the prefix on error messages
+ %
+ %   GD_FLUSH(DIRFILE,PREFIX)
+ %             set the prefix on Library error messages printed when running in
+ %             verbose mode to PREFIX.
+ %
+ %   The DIRFILE object should have previously been created with GD_OPEN.
+ %
+ %   See the documentation on the C API function gd_verbose_prefix(3) in
+ %   section 3 of the UNIX manual for more details.
+ %
+ %   See also GD_OPEN, GD_ERROR_STRING
+ */
+
+void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])
+{
+  DIRFILE *D;
+  char *prefix;
+
+  GDMX_NO_LHS;
+  GDMX_CHECK_RHS(2);
+
+  D = gdmx_to_dirfile(prhs[0]);
+  prefix = gdmx_to_string(prhs, 1, 1);
+
+  gd_verbose_prefix(D, prefix);
+
+  mxFree(prefix);
+  gdmx_err(D, 0);
+}
diff --git a/bindings/matlab/getdata_constants.m b/bindings/matlab/getdata_constants.m
new file mode 100644
index 0000000..808d0a9
--- /dev/null
+++ b/bindings/matlab/getdata_constants.m
@@ -0,0 +1,221 @@
+function GD = getdata_constants()
+% GETDATA_CONSTANTS  Define GetData symbolic constants
+%
+%   GETDATA_CONSTANTS  produces a structure containing the symbolic constants
+%   used by the GetData bindings.  Member names of the structure correspond to
+%   names of symbolic constants used in the GetData C API.
+%
+%   Although it can be used in immediate context by doing something like
+%
+%     >> GETDATA_CONSTANTS.FLOAT64
+%
+%     ans =
+%
+%              136
+%
+%   it is usually assigned to a variable, which prevents having to evaluate this
+%   function more than once.  We recommend calling this variable GD:
+%
+%     >> GD = GETDATA_CONSTANTS;
+%     >> GD.FLOAT64
+%
+%     ans =
+%
+%              136
+%
+%   providing more succinct symbol names which closely resemble the cor-
+%   respondng C API symbol names (e.g. GD_FLOAT64).  In the documentation for
+%   these bindings, we assume such a GD variable has been defined, and refer to
+%   symbolic constants as GD.<...> when necessary.
+%
+%   See also GETDATA
+
+  GD = struct(...
+    'VERSION', '0.8.5', ...
+    'E_OK', int32(0), ...
+    'E_OPEN', int32(1), ...
+    'E_FORMAT', int32(2), ...
+    'E_TRUNC', int32(3), ...
+    'E_CREAT', int32(4), ...
+    'E_BAD_CODE', int32(5), ...
+    'E_BAD_TYPE', int32(6), ...
+    'E_RAW_IO', int32(7), ...
+    'E_OPEN_FRAGMENT', int32(8), ...
+    'E_INTERNAL_ERROR', int32(9), ...
+    'E_ALLOC', int32(10), ...
+    'E_RANGE', int32(11), ...
+    'E_OPEN_LINFILE', int32(12), ...
+    'E_RECURSE_LEVEL', int32(13), ...
+    'E_BAD_DIRFILE', int32(14), ...
+    'E_BAD_FIELD_TYPE', int32(15), ...
+    'E_ACCMODE', int32(16), ...
+    'E_UNSUPPORTED', int32(17), ...
+    'E_UNKNOWN_ENCODING', int32(18), ...
+    'E_BAD_ENTRY', int32(19), ...
+    'E_DUPLICATE', int32(20), ...
+    'E_DIMENSION', int32(21), ...
+    'E_BAD_INDEX', int32(22), ...
+    'E_BAD_SCALAR', int32(23), ...
+    'E_BAD_REFERENCE', int32(24), ...
+    'E_PROTECTED', int32(25), ...
+    'E_DELETE', int32(26), ...
+    'E_ARGUMENT', int32(27), ...
+    'E_CALLBACK', int32(28), ...
+    'E_EXISTS', int32(29), ...
+    'E_UNCLEAN_DB', int32(30), ...
+    'E_DOMAIN', int32(31), ...
+    'E_BAD_REPR', int32(32), ...
+    'E_FLUSH', int32(34), ...
+    'E_BOUNDS', int32(35), ...
+    'E_LINE_TOO_LONG', int32(36), ...
+    'E_OPEN_INCLUDE', int32(8), ...
+    'E_BAD_ENDIANNESS', int32(27), ...
+    'E_BAD_PROTECTION', int32(27), ...
+    'E_BAD_VERSION', int32(27), ...
+    'RDONLY', int32(0), ...
+    'RDWR', int32(1), ...
+    'FORCE_ENDIAN', int32(2), ...
+    'BIG_ENDIAN', int32(4), ...
+    'LITTLE_ENDIAN', int32(8), ...
+    'CREAT', int32(16), ...
+    'EXCL', int32(32), ...
+    'TRUNC', int32(64), ...
+    'PEDANTIC', int32(128), ...
+    'FORCE_ENCODING', int32(256), ...
+    'VERBOSE', int32(512), ...
+    'IGNORE_DUPS', int32(1024), ...
+    'IGNORE_REFS', int32(2048), ...
+    'PRETTY_PRINT', int32(4096), ...
+    'ARM_ENDIAN', int32(8192), ...
+    'NOT_ARM_ENDIAN', int32(0), ...
+    'PERMISSIVE', int32(16384), ...
+    'TRUNCSUB', int32(32768), ...
+    'AUTO_ENCODED', int32(0), ...
+    'BZIP2_ENCODED', int32(83886080), ...
+    'GZIP_ENCODED', int32(67108864), ...
+    'LZMA_ENCODED', int32(100663296), ...
+    'SIE_ENCODED', int32(117440512), ...
+    'SLIM_ENCODED', int32(50331648), ...
+    'TEXT_ENCODED', int32(33554432), ...
+    'UNENCODED', int32(16777216), ...
+    'ZZSLIM_ENCODED', int32(150994944), ...
+    'ZZIP_ENCODED', int32(134217728), ...
+    'NO_ENTRY', int32(0), ...
+    'RAW_ENTRY', int32(1), ...
+    'LINCOM_ENTRY', int32(2), ...
+    'LINTERP_ENTRY', int32(3), ...
+    'BIT_ENTRY', int32(4), ...
+    'MULTIPLY_ENTRY', int32(5), ...
+    'PHASE_ENTRY', int32(6), ...
+    'INDEX_ENTRY', int32(7), ...
+    'POLYNOM_ENTRY', int32(8), ...
+    'SBIT_ENTRY', int32(9), ...
+    'DIVIDE_ENTRY', int32(10), ...
+    'RECIP_ENTRY', int32(11), ...
+    'WINDOW_ENTRY', int32(12), ...
+    'MPLEX_ENTRY', int32(13), ...
+    'CONST_ENTRY', int32(16), ...
+    'CARRAY_ENTRY', int32(18), ...
+    'STRING_ENTRY', int32(17), ...
+    'NULL', int32(0), ...
+    'UINT8', int32(1), ...
+    'INT8', int32(33), ...
+    'UINT16', int32(2), ...
+    'INT16', int32(34), ...
+    'UINT32', int32(4), ...
+    'INT32', int32(36), ...
+    'UINT64', int32(8), ...
+    'INT64', int32(40), ...
+    'FLOAT32', int32(132), ...
+    'FLOAT64', int32(136), ...
+    'COMPLEX64', int32(264), ...
+    'COMPLEX128', int32(272), ...
+    'DEL_META', int32(1), ...
+    'DEL_DATA', int32(2), ...
+    'DEL_DEREF', int32(4), ...
+    'DEL_FORCE', int32(8), ...
+    'REN_DATA', int32(1), ...
+    'REN_UPDB', int32(2), ...
+    'PROTECT_NONE', int32(0), ...
+    'PROTECT_FORMAT', int32(1), ...
+    'PROTECT_DATA', int32(2), ...
+    'PROTECT_ALL', int32(3), ...
+    'SYNTAX_ABORT', int32(0), ...
+    'SYNTAX_RESCAN', int32(1), ...
+    'SYNTAX_IGNORE', int32(2), ...
+    'SYNTAX_CONTINUE', int32(3), ...
+    'E_FORMAT_BAD_SPF', int32(1), ...
+    'E_FORMAT_N_FIELDS', int32(2), ...
+    'E_FORMAT_N_TOK', int32(3), ...
+    'E_FORMAT_NUMBITS', int32(4), ...
+    'E_FORMAT_BITNUM', int32(5), ...
+    'E_FORMAT_BITSIZE', int32(6), ...
+    'E_FORMAT_CHARACTER', int32(7), ...
+    'E_FORMAT_BAD_LINE', int32(8), ...
+    'E_FORMAT_RES_NAME', int32(9), ...
+    'E_FORMAT_ENDIAN', int32(10), ...
+    'E_FORMAT_BAD_TYPE', int32(11), ...
+    'E_FORMAT_BAD_NAME', int32(12), ...
+    'E_FORMAT_UNTERM', int32(13), ...
+    'E_FORMAT_METARAW', int32(14), ...
+    'E_FORMAT_NO_PARENT', int32(15), ...
+    'E_FORMAT_DUPLICATE', int32(16), ...
+    'E_FORMAT_LOCATION', int32(17), ...
+    'E_FORMAT_PROTECT', int32(18), ...
+    'E_FORMAT_LITERAL', int32(19), ...
+    'E_FORMAT_WINDOP', int32(20), ...
+    'E_FORMAT_META_META', int32(21), ...
+    'E_FORMAT_ALIAS', int32(22), ...
+    'E_FORMAT_MPLEXVAL', int32(23), ...
+    'VERSION_CURRENT', int32(-1), ...
+    'VERSION_LATEST', int32(-2), ...
+    'VERSION_EARLIEST', int32(-3), ...
+    'SEEK_SET', int32(0), ...
+    'SEEK_CUR', int32(1), ...
+    'SEEK_END', int32(2), ...
+    'SEEK_WRITE', int32(4), ...
+    'WINDOP_UNK', int32(0), ...
+    'WINDOP_EQ', int32(1), ...
+    'WINDOP_GE', int32(2), ...
+    'WINDOP_GT', int32(3), ...
+    'WINDOP_LE', int32(4), ...
+    'WINDOP_LT', int32(5), ...
+    'WINDOP_NE', int32(6), ...
+    'WINDOP_SET', int32(7), ...
+    'WINDOP_CLR', int32(8), ...
+    'DESYNC_PATHCHECK', int32(1), ...
+    'DESYNC_REOPEN', int32(2), ...
+    'ALL_ENTRIES', int32(0), ...
+    'VECTOR_ENTRIES', int32(33), ...
+    'SCALAR_ENTRIES', int32(34), ...
+    'ALIAS_ENTRIES', int32(-1), ...
+    'ENTRIES_HIDDEN', int32(1), ...
+    'ENTRIES_NOALIAS', int32(2), ...
+    'ALL_FRAGMENTS', int32(-1), ...
+    'DEFAULT_LOOKBACK', int32(10), ...
+    'DIRFILE_STANDARDS_VERSION', int32(9), ...
+    'HERE', int32(-1), ...
+    'LOOKBACK_ALL', int32(-1), ...
+    'MAX_LINE_LENGTH', int32(4096) ...
+  );
+end
+
+% Copyright (C) 2013 D. V. Wiebe
+%
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%
+% This file is part of the GetData project.
+%
+% GetData is free software; you can redistribute it and/or modify it under
+% the terms of the GNU Lesser General Public License as published by the
+% Free Software Foundation; either version 2.1 of the License, or (at your
+% option) any later version.
+%
+% GetData is distributed in the hope that it will be useful, but WITHOUT
+% ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+% FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+% License for more details.
+%
+% You should have received a copy of the GNU Lesser General Public License
+% along with GetData; if not, write to the Free Software Foundation, Inc.,
+% 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
diff --git a/bindings/matlab/make_contents.sh.in b/bindings/matlab/make_contents.sh.in
new file mode 100644
index 0000000..1d8dcd7
--- /dev/null
+++ b/bindings/matlab/make_contents.sh.in
@@ -0,0 +1,55 @@
+#!/bin/sh
+# Copyright (C) 2013 D. V. Wiebe
+#
+##########################################################################
+#
+# This file is part of the GetData project.
+#
+# GetData is free software; you can redistribute it and/or modify it under
+# the terms of the GNU Lesser General Public License as published by the
+# Free Software Foundation; either version 2.1 of the License, or (at your
+# option) any later version.
+#
+# GetData is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+# License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public License
+# along with GetData; if not, write to the Free Software Foundation, Inc.,
+# 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+# 
+# @configure_input@
+
+AWK=@AWK@
+DATE=@DATE@
+GREP=@GREP@
+PRINTF=@PRINTF@
+SED=@SED@
+VERSION=@GETDATA_MAJOR at .@GETDATA_MINOR@
+REVISION=R at GETDATA_REVISION@@GETDATA_VERSION_SUFFIX@
+SRCDIR=$1
+
+if test $SRCDIR != "."; then
+  BUILT_FILES=$SRCDIR/gd_*.m
+fi
+
+if test "x$DATE" == "xnot found"; then
+  BUILD_DATE=
+else
+  BUILD_DATE=`$DATE +%d-%b-%Y`
+fi
+
+echo "% GetData bindings for MATLAB"
+echo "% Version $VERSION ($REVISION) $BUILD_DATE"
+echo "%"
+cat $SRCDIR/Contents.m.head
+if test "x$PRINTF" != "xnot found"; then
+  (
+  ls getdata*.m gd_*.m ${BUILT_FILES} | while read x; do
+    ${PRINTF} "%%   %-22s - %s\n" \
+      "`basename $x | ${AWK} 'BEGIN{FS="."} { print toupper($1) }'`" \
+      "`${GREP} -m 1 '^%' $x | ${SED} 's/% *[A-Z_]* *\(.*\)/\1/'`"
+  done
+  ) | sort
+fi
diff --git a/bindings/matlab/matlab.c b/bindings/matlab/matlab.c
new file mode 100644
index 0000000..16f0404
--- /dev/null
+++ b/bindings/matlab/matlab.c
@@ -0,0 +1,1541 @@
+/* Copyright (C) 2013 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "gd_config.h"
+#endif
+
+#ifdef GD_EXTERNAL
+# define GD_C89_API
+# define dtracevoid()
+# define dtrace(...)
+# define dprintf(...)
+# define dreturnvoid()
+# define dreturn(...)
+# define dwatch(...)
+# define GD_SIZE_T_MAX ((size_t)-1)
+# define GD_INT_TYPE ((gd_type_t)((sizeof(int)) | GD_SIGNED))
+# define GD_UINT_TYPE ((gd_type_t)(sizeof(unsigned int)))
+# define EN(t,v) u.t.v
+# define GD_DCOMPLEXP_t double *
+# define GD_DCOMPLEXV(v) double v[][2]
+# define gd_cs2cs_(a,b) do { (a)[0] = (b)[0]; (a)[1] = (b)[1]; } while(0)
+# define gd_ca2cs_(a,b,i) gd_cs2cs_((a),(b) + 2 * i)
+#else
+#include "internal.h"
+#endif
+
+#define GDMXLIB
+#include "gd_matlab.h"
+
+#ifdef HAVE_STDINT_H
+#include <stdint.h>
+#endif
+#include <string.h>
+
+#define GD_LIBCOMP "GetData:Lib:"
+static const char *gdmx_msgid[GD_N_ERROR_CODES] =
+{
+  NULL, /* GD_E_OK */
+  GD_LIBCOMP "Open",
+  GD_LIBCOMP "Format",
+  GD_LIBCOMP "Trunc",
+  GD_LIBCOMP "Creat",
+  GD_LIBCOMP "BadCode",
+  GD_LIBCOMP "BadType",
+  GD_LIBCOMP "RawIO",
+  GD_LIBCOMP "OpenFragment",
+  GD_LIBCOMP "InternalError",
+  GD_LIBCOMP "Alloc",
+  GD_LIBCOMP "Range",
+  GD_LIBCOMP "OpenLinfile",
+  GD_LIBCOMP "RecurseLevel",
+  GD_LIBCOMP "BadDirfile",
+  GD_LIBCOMP "BadFieldType",
+  GD_LIBCOMP "AccMode",
+  GD_LIBCOMP "Unsupported",
+  GD_LIBCOMP "UnknownEncoding",
+  GD_LIBCOMP "BadEntry",
+  GD_LIBCOMP "Duplicate",
+  GD_LIBCOMP "Dimension",
+  GD_LIBCOMP "BadIndex",
+  GD_LIBCOMP "BadScalar",
+  GD_LIBCOMP "BadReference",
+  GD_LIBCOMP "Protected",
+  GD_LIBCOMP "Delete",
+  GD_LIBCOMP "Argument",
+  GD_LIBCOMP "Callback",
+  GD_LIBCOMP "Exists",
+  GD_LIBCOMP "UncleanDB",
+  GD_LIBCOMP "Domain",
+  GD_LIBCOMP "BadRepr",
+  GD_LIBCOMP "Error33", /* unused */
+  GD_LIBCOMP "Flush",
+  GD_LIBCOMP "Bounds",
+  GD_LIBCOMP "LineTooLong"
+};
+
+/* persistent errors */
+static int gdmx_errno = GD_E_OK;
+static char *gdmx_estring = NULL;
+
+/* for error reporting */
+struct gdmx_context_t {
+  const char *name;
+  const char *field;
+  int num;
+};
+
+static char gdmx_context_buf[1024];
+const char *gdmx_context(const struct gdmx_context_t *x, int uc)
+{
+  dtrace("%p, %i", x, uc);
+
+  if (x == NULL)
+    strcpy(gdmx_context_buf, "(unknown item)");
+  else {
+    if (x->name == NULL) {
+      if (x->field == NULL)
+        sprintf(gdmx_context_buf, "parameter %i", x->num);
+      else
+        sprintf(gdmx_context_buf, "field '%s' of struct parameter %i",
+            x->field, x->num);
+    } else {
+      if (x->field == NULL)
+        strcpy(gdmx_context_buf, x->name);
+      else
+        sprintf(gdmx_context_buf, "field '%s' of %s", x->field, x->name);
+    }
+
+    gdmx_context_buf[1023] = 0;
+    if (uc)
+      gdmx_context_buf[0] += 'A' - 'a';
+  }
+
+  dreturn("\"%s\"", gdmx_context_buf);
+  return gdmx_context_buf;
+}
+
+/* doesn't return on error */
+void gdmx_err(DIRFILE *D, int discard)
+{
+  dtrace("%p, %i", D, discard);
+
+  if (gdmx_estring) {
+    free(gdmx_estring);
+    gdmx_estring = NULL;
+  }
+
+  gdmx_errno = gd_error(D);
+
+  if (gdmx_errno == GD_E_OK) {
+    dreturnvoid();
+    return;
+  }
+
+  gdmx_estring = gd_error_string(D, NULL, 0);
+
+  if (discard)
+    gd_discard(D);
+
+#ifdef GETDATA_DEBUG
+  gd_colclear();
+#endif
+
+  mexErrMsgIdAndTxt(gdmx_msgid[gdmx_errno],
+      gdmx_estring);
+}
+
+static gd_type_t gdmx_type(const mxArray *a, const struct gdmx_context_t *ctx,
+    int cflag)
+{
+  gd_type_t t = GD_UNKNOWN;
+  mxClassID id;
+
+  dtrace("%p, %p, %i", a, ctx, cflag);
+
+  id = mxGetClassID(a);
+
+  switch (id) {
+    case mxDOUBLE_CLASS:
+      t = GD_FLOAT64;
+      break;
+    case mxSINGLE_CLASS:
+      t = GD_FLOAT32;
+      break;
+    case mxINT8_CLASS:
+      t = GD_INT8;
+      break;
+    case mxUINT8_CLASS:
+      t = GD_UINT8;
+      break;
+    case mxINT16_CLASS:
+      t = GD_INT16;
+      break;
+    case mxUINT16_CLASS:
+      t = GD_UINT16;
+      break;
+    case mxINT32_CLASS:
+      t = GD_INT32;
+      break;
+    case mxUINT32_CLASS:
+      t = GD_UINT32;
+      break;
+    case mxINT64_CLASS:
+      t = GD_INT64;
+      break;
+    case mxUINT64_CLASS:
+      t = GD_UINT64;
+      break;
+    default:
+      if (ctx)
+        mexErrMsgIdAndTxt("GetData:GDMX:NotNumber", "%s must be numerical.",
+            gdmx_context(ctx, 1));
+  }
+
+  /* handle complex data */
+  if (cflag) {
+    if (t == GD_FLOAT64)
+      t = GD_COMPLEX128;
+    else if (t == GD_FLOAT32)
+      t = GD_COMPLEX64;
+    else if (ctx)
+      mexErrMsgIdAndTxt("GetData:GDMX:ComplexInt",
+          "GetData cannot handle integer complex data in %s.",
+          gdmx_context(ctx, 0));
+    else
+      t = GD_UNKNOWN;
+  }
+
+  dreturn("0x%X", (unsigned)t);
+  return t;
+}
+
+mxClassID gdmx_classid(gd_type_t t)
+{
+  mxClassID id = mxUNKNOWN_CLASS;
+
+  dtrace("0x%X", t);
+
+  switch (t) {
+    case GD_UINT8:
+      id = mxUINT8_CLASS;
+      break;
+    case GD_INT8:
+      id = mxINT8_CLASS;
+      break;
+    case GD_UINT16:
+      id = mxUINT16_CLASS;
+      break;
+    case GD_INT16:
+      id = mxINT16_CLASS;
+      break;
+    case GD_UINT32:
+      id = mxUINT32_CLASS;
+      break;
+    case GD_INT32:
+      id = mxINT32_CLASS;
+      break;
+    case GD_UINT64:
+      id = mxUINT64_CLASS;
+      break;
+    case GD_INT64:
+      id = mxINT64_CLASS;
+      break;
+    case GD_FLOAT32:
+    case GD_COMPLEX64:
+      id = mxSINGLE_CLASS;
+      break;
+    case GD_FLOAT64:
+    case GD_COMPLEX128:
+      id = mxDOUBLE_CLASS;
+      break;
+    default:
+      mexErrMsgIdAndTxt("GetData:GDMX:BadType",
+          "Bad GetData data type: 0x%X", t);
+  }
+
+  dreturn("%i", (int)id);
+  return id;
+}
+
+static size_t gdmx_get_length(const mxArray *a)
+{
+  const mwSize *dims;
+  int i, ndims;
+  size_t nelem = 1;
+
+  dtrace("%p", a);
+
+  ndims = mxGetNumberOfDimensions(a);
+
+  dims = mxGetDimensions(a);
+  for (i = 0; i < ndims; ++i)
+    nelem *= dims[i];
+
+  dreturn("%zu", nelem);
+  return nelem;
+}
+
+/* returns zero if it's a scalar */
+static int gdmx_check_scalar(const mxArray *a, const struct gdmx_context_t *ctx)
+{
+  size_t nelem;
+
+  dtrace("%p, %p", a, ctx);
+
+  nelem = gdmx_get_length(a);
+
+  if (ctx && nelem > 1)
+    mexErrMsgIdAndTxt("GetData:GDMX:NotScalar", "%s must be scalar.",
+        gdmx_context(ctx, 1));
+
+  dreturn("%i", (nelem > 1) ? 1 : 0);
+  return (nelem > 1) ? 1 : 0;
+}
+
+/* convert to a desired scalar type */
+#define CONVERT_TO_CTYPE(f,t) \
+  switch (t) { \
+    case GD_UINT8:       *((uint8_t*)v) = ((f*)datum)[i]; break; \
+    case GD_INT8:         *((int8_t*)v) = ((f*)datum)[i]; break; \
+    case GD_UINT16:     *((uint16_t*)v) = ((f*)datum)[i]; break; \
+    case GD_INT16:       *((int16_t*)v) = ((f*)datum)[i]; break; \
+    case GD_UINT32:     *((uint32_t*)v) = ((f*)datum)[i]; break; \
+    case GD_INT32:       *((int32_t*)v) = ((f*)datum)[i]; break; \
+    case GD_UINT64:     *((uint64_t*)v) = ((f*)datum)[i]; break; \
+    case GD_INT64:       *((int64_t*)v) = ((f*)datum)[i]; break; \
+    case GD_FLOAT32:       *((float*)v) = ((f*)datum)[i]; break; \
+    case GD_FLOAT64:      *((double*)v) = ((f*)datum)[i]; break; \
+    case GD_COMPLEX64:   ((float*)v)[0] = ((f*)datum)[i]; \
+                         ((float*)v)[1] = c ? ((f*)idatum)[i] : 0; break; \
+    case GD_COMPLEX128: ((double*)v)[0] = ((f*)datum)[i]; \
+                        ((double*)v)[1] = c ? ((f*)idatum)[i] : 0; break; \
+    default: GDMX_INTERNAL_ERROR; \
+  }
+
+static mxArray *gdmx_get_field(const mxArray *a,
+    const struct gdmx_context_t *ctx, const char *field)
+{
+  mxArray *v;
+
+  dtrace("%p, %p, \"%s\"", a, ctx, field);
+
+  v = mxGetField(a, 0, field);
+  if (ctx && v == NULL)
+    mexErrMsgIdAndTxt("GetData:GDMX:BadStruct",
+        "Missing required field '%s' in %s", field, gdmx_context(ctx, 0));
+
+  dreturn("%p", v);
+  return v;
+}
+
+static int gdmx_convert_scalar(const mxArray *a,
+    const struct gdmx_context_t *ctx, gd_type_t t, int i, void *v)
+{
+  mxClassID id;
+  void *datum, *idatum = NULL;
+  int c;
+
+  dtrace("%p, %p, 0x%X, %i, %p", a, ctx, t, v);
+
+  /* check for scalarity */
+  if (i == -1) {
+    gdmx_check_scalar(a, ctx);
+    i = 0;
+  }
+
+  /* matlab type */
+  c = mxIsComplex(a);
+  id = mxGetClassID(a);
+
+  /* data pointer */
+  datum = mxGetData(a);
+  if (c)
+    idatum = mxGetImagData(a);
+
+  switch (id) {
+    case mxDOUBLE_CLASS:
+      CONVERT_TO_CTYPE(double,t);
+      break;
+    case mxSINGLE_CLASS:
+      CONVERT_TO_CTYPE(float,t);
+      break;
+    case mxINT8_CLASS:
+      CONVERT_TO_CTYPE(int8_t,t);
+      break;
+    case mxUINT8_CLASS:
+      CONVERT_TO_CTYPE(uint8_t,t);
+      break;
+    case mxINT16_CLASS:
+      CONVERT_TO_CTYPE(int16_t,t);
+      break;
+    case mxUINT16_CLASS:
+      CONVERT_TO_CTYPE(uint16_t,t);
+      break;
+    case mxINT32_CLASS:
+      CONVERT_TO_CTYPE(int32_t,t);
+      break;
+    case mxUINT32_CLASS:
+      CONVERT_TO_CTYPE(uint32_t,t);
+      break;
+    case mxINT64_CLASS:
+      CONVERT_TO_CTYPE(int64_t,t);
+      break;
+    case mxUINT64_CLASS:
+      CONVERT_TO_CTYPE(uint64_t,t);
+      break;
+    default:
+      if (ctx)
+        mexErrMsgIdAndTxt("GetData:GDMX:NotNumber",
+            "%s must be numerical.", gdmx_context(ctx, 1));
+      dreturn("%i", 1);
+      return 1;
+  }
+
+  dreturn("%i", 0);
+  return 0;
+}
+
+/* this is only really appropriate for small arrays */
+static void *gdmx_convert_array(const mxArray *a,
+    const struct gdmx_context_t *ctx, gd_type_t t, size_t *n)
+{
+  char *ptr;
+  size_t i, nelem;
+
+  dtrace("%p, %p, 0x%X, %p(%zu)", a, ctx, t, n, *n);
+
+  nelem = gdmx_get_length(a);
+  if (nelem > *n)
+    nelem = *n;
+  else if (nelem < *n)
+    *n = nelem;
+
+  if (nelem == 0) {
+    dreturn("%p", NULL);
+    return NULL;
+  }
+
+  ptr = (char*)mxMalloc(GD_SIZE(t) * nelem);
+  if (!ptr)
+    mexErrMsgIdAndTxt("GetData:GDMX:Alloc", "Out of memory.");
+
+  for (i = 0; i < nelem; ++i)
+    gdmx_convert_scalar(a, ctx, t, i, ptr + GD_SIZE(t) * i);
+
+  dreturn("%p", ptr);
+  return ptr;
+}
+
+static void gdmx_convert_struct_scalar(const mxArray *a,
+    const struct gdmx_context_t *ctx_in, const char *field, gd_type_t t,
+    void *v)
+{
+  mxArray *e;
+  struct gdmx_context_t ctx = { ctx_in->name, field, ctx_in->num };
+
+  dtrace("%p, %p, \"%s\", 0x%X, %p", a, ctx_in, field, t, v);
+
+  e = gdmx_get_field(a, ctx_in, field);
+
+  gdmx_convert_scalar(e, &ctx, t, -1, v);
+
+  dreturnvoid();
+}
+
+static int gdmx_is_zero(const mxArray *a)
+{
+  double v;
+
+  dtrace("%p", a);
+
+  if (gdmx_convert_scalar(a, NULL, GD_FLOAT64, -1, &v)) {
+    dreturn("%i", 0);
+    return 0;
+  }
+
+  dreturn("%i", v ? 0 : 1);
+  return v ? 0 : 1;
+}
+
+
+/* strings created thus need to be mxFree'd by the caller */
+static char *gdmx_to_string_(const mxArray *a, const struct gdmx_context_t *ctx,
+    int null_ok)
+{
+  char *s = NULL;
+
+  dtrace("%p, %p, %i", a, ctx, null_ok);
+
+  s = mxArrayToString(a);
+
+  if (s == NULL) {
+    if (null_ok && gdmx_is_zero(a)) {
+      dreturn("%p", NULL);
+      return NULL;
+    }
+    if (ctx)
+      mexErrMsgIdAndTxt("GetData:GDMX:StringConversion",
+          "Unable to interpret %s as string.", gdmx_context(ctx, 0));
+  }
+
+  dreturn("\"%s\"", s);
+
+  return s;
+}
+
+char *gdmx_to_string(const mxArray **rhs, int n, int null_ok)
+{
+  struct gdmx_context_t ctx = { NULL, NULL, n };
+  return gdmx_to_string_(rhs[n], &ctx, null_ok);
+}
+
+static char *gdmx_convert_struct_string(const mxArray *a,
+    const struct gdmx_context_t *ctx_in, const char *field)
+{
+  char *s;
+  mxArray *e;
+  struct gdmx_context_t ctx = { ctx_in->name, field, ctx_in->num };
+
+  dtrace("%p, %p, \"%s\"", a, ctx_in, field);
+
+  e = gdmx_get_field(a, ctx_in, field);
+
+  s = gdmx_to_string_(e, &ctx, 1);
+
+  dreturn("\"%s\"", s ? s : "(nil)");
+  return s;
+}
+
+static double gdmx_to_double_(const mxArray *a,
+    const struct gdmx_context_t *ctx)
+{
+  double v;
+
+  dtrace("%p, %p", a, ctx);
+
+  gdmx_convert_scalar(a, ctx, GD_FLOAT64, -1, &v);
+
+  dreturn("%g", v);
+
+  return v;
+}
+
+double gdmx_to_double(const mxArray **rhs, int n)
+{
+  struct gdmx_context_t ctx = { NULL, NULL, n };
+  return gdmx_to_double_(rhs[n], &ctx);
+}
+
+static int gdmx_to_int_(const mxArray *a, const struct gdmx_context_t *ctx)
+{
+  int v;
+
+  dtrace("%p, %p", a, ctx);
+
+  gdmx_convert_scalar(a, ctx, GD_INT_TYPE, -1, &v);
+
+  dreturn("%i", v);
+
+  return v;
+}
+
+int gdmx_to_int(const mxArray **rhs, int n)
+{
+  struct gdmx_context_t ctx = { NULL, NULL, n };
+  return gdmx_to_int_(rhs[n], &ctx);
+}
+
+
+static long long gdmx_to_llong_(const mxArray *a,
+    const struct gdmx_context_t *ctx)
+{
+  int64_t v;
+
+  dtrace("%p, %p", a, ctx);
+
+  gdmx_convert_scalar(a, ctx, GD_INT64, -1, &v);
+
+  dreturn("%lli", (long long)v);
+
+  return (long long)v;
+}
+
+long long gdmx_to_llong(const mxArray **rhs, int n)
+{
+  struct gdmx_context_t ctx = { NULL, NULL, n };
+  return gdmx_to_llong_(rhs[n], &ctx);
+}
+
+static unsigned long long gdmx_to_ullong_(const mxArray *a,
+    const struct gdmx_context_t *ctx)
+{
+  uint64_t v;
+
+  dtrace("%p, %p", a, ctx);
+
+  gdmx_convert_scalar(a, ctx, GD_UINT64, -1, &v);
+
+  dreturn("%llu", (unsigned long long)v);
+
+  return (unsigned long long)v;
+}
+
+unsigned long long gdmx_to_ullong(const mxArray **rhs, int n)
+{
+  struct gdmx_context_t ctx = { NULL, NULL, n };
+  return gdmx_to_ullong_(rhs[n], &ctx);
+}
+
+static unsigned long gdmx_to_ulong_(const mxArray *a,
+    const struct gdmx_context_t *ctx)
+{
+  uint64_t v;
+
+  dtrace("%p, %p", a, ctx);
+
+  gdmx_convert_scalar(a, ctx, GD_UINT64, -1, &v);
+
+  dreturn("%lu", (unsigned long)v);
+
+  return (unsigned long)v;
+}
+
+unsigned long gdmx_to_ulong(const mxArray **rhs, int n)
+{
+  struct gdmx_context_t ctx = { NULL, NULL, n };
+  return gdmx_to_ulong_(rhs[n], &ctx);
+}
+
+static mxArray *gdmx_from_cdouble(double* x)
+{
+  mxArray *lhs;
+
+  dtrace("{%g, %g}", x[0], x[1]);
+
+  lhs = mxCreateNumericMatrix(1, 1, mxDOUBLE_CLASS, mxCOMPLEX);
+  *((double*)mxGetData(lhs)) = x[0];
+  *((double*)mxGetImagData(lhs)) = x[1];
+
+  dreturn("%p", lhs);
+  return lhs;
+}
+
+mxArray *gdmx_from_bool(int x)
+{
+  mxArray *lhs;
+
+  dtrace("%i", x);
+
+  lhs = mxCreateLogicalScalar(x ? true : false);
+
+  dreturn("%p", lhs);
+  return lhs;
+}
+
+mxArray *gdmx_from_long(long x)
+{
+  mxArray *lhs;
+
+  dtrace("%li", x);
+
+  lhs = mxCreateNumericMatrix(1, 1, mxINT32_CLASS, mxREAL);
+  *((int32_t*)mxGetData(lhs)) = x;
+
+  dreturn("%p", lhs);
+  return lhs;
+}
+
+mxArray *gdmx_from_llong(long long x)
+{
+  mxArray *lhs;
+
+  dtrace("%lli", x);
+
+  lhs = mxCreateNumericMatrix(1, 1, mxINT64_CLASS, mxREAL);
+  *((int64_t*)mxGetData(lhs)) = x;
+
+  dreturn("%p", lhs);
+  return lhs;
+}
+
+mxArray *gdmx_from_ulong(unsigned long x)
+{
+  mxArray *lhs;
+
+  dtrace("%lu", x);
+
+  lhs = mxCreateNumericMatrix(1, 1, mxUINT32_CLASS, mxREAL);
+  *((uint32_t*)mxGetData(lhs)) = x;
+
+  dreturn("%p", lhs);
+  return lhs;
+}
+
+mxArray *gdmx_from_ullong(unsigned long long x)
+{
+  mxArray *lhs;
+
+  dtrace("%llu", x);
+
+  lhs = mxCreateNumericMatrix(1, 1, mxUINT64_CLASS, mxREAL);
+  *((uint64_t*)mxGetData(lhs)) = x;
+
+  dreturn("%p", lhs);
+  return lhs;
+}
+
+mxArray *gdmx_from_triplet(gd_triplet_t datum, gd_windop_t windop)
+{
+  mxArray *a;
+
+  dtrace("{%g, %llu, %lli}, %i", datum.r, datum.u, datum.i, windop);
+
+  switch (windop) {
+    case GD_WINDOP_EQ:
+    case GD_WINDOP_NE:
+      a = gdmx_from_llong(datum.i);
+      break;
+    case GD_WINDOP_SET:
+    case GD_WINDOP_CLR:
+      a = gdmx_from_ullong(datum.u);
+      break;
+    default:
+      a = gdmx_from_double(datum.r);
+      break;
+  }
+
+  dreturn("%p", a);
+  return a;
+}
+
+mxArray *gdmx_from_data(const void *data, gd_type_t type, size_t n)
+{
+  mxArray *a;
+
+  dtrace("%p, 0x%X, %zu", data, type, n);
+
+  a = mxCreateNumericMatrix(1, n, gdmx_classid(type),
+      (type & GD_COMPLEX) ? mxCOMPLEX : mxREAL);
+
+  if (type == GD_COMPLEX64) {
+    size_t i;
+    float *p, *pr, *pi;
+
+    p = (float*)data;
+    pr = (float*)mxGetData(a);
+    pi = (float*)mxGetImagData(a);
+
+    for (i = 0; i < n; ++i) {
+      pr[i] = *(p++);
+      pi[i] = *(p++);
+    }
+  } else if (type == GD_COMPLEX128) {
+    size_t i;
+    double *p, *pr, *pi;
+
+    p = (double*)data;
+    pr = (double*)mxGetData(a);
+    pi = (double*)mxGetImagData(a);
+
+    for (i = 0; i < n; ++i) {
+      pr[i] = *(p++);
+      pi[i] = *(p++);
+    }
+  } else
+    memcpy(mxGetData(a), data, GD_SIZE(type) * n);
+
+  dreturn("%p", a);
+  return a;
+}
+
+mxArray *gdmx_from_nstring_list(const char **l, size_t n)
+{
+  mxArray *lhs;
+  size_t i;
+
+  dtrace("%p", l);
+
+  /* create and populate cell array */
+  lhs = mxCreateCellMatrix(1, n);
+  for (i = 0; i < n; ++i)
+    if (l[i] == NULL)
+      mxSetCell(lhs, i, mxCreateDoubleScalar(0));
+    else
+      mxSetCell(lhs, i, mxCreateString(l[i]));
+
+  dreturn("%p", lhs);
+  return lhs;
+}
+
+mxArray *gdmx_from_string_list(const char **l)
+{
+  mxArray *lhs;
+  mxArray **s = NULL, **ptr;
+  int i;
+
+  dtrace("%p", l);
+
+  /* count and stringify */
+  for (i = 0; l[i]; ++i) {
+    ptr = (mxArray **)mxRealloc(s, sizeof(mxArray*) * (i + 1));
+    if (ptr == NULL) {
+      free(s);
+      mexErrMsgIdAndTxt("GetData:GDMX:Alloc", "Out of memory.");
+    }
+    s = ptr;
+    s[i] = mxCreateString(l[i]);
+  }
+
+  /* create and populate cell array */
+  lhs = mxCreateCellMatrix(1, i);
+  for (--i; i >= 0; --i)
+    mxSetCell(lhs, i, s[i]);
+
+  mxFree(s);
+
+  dreturn("%p", lhs);
+  return lhs;
+}
+
+#define GDMX_COMMON_FIELDS "field", "field_type", "fragment_index"
+#define GDMX_NCOMMON 3
+#define GDMX_SCALAR_FIELDS "scalar", "scalar_ind"
+#define GDMX_NSCALAR 2
+mxArray *gdmx_from_entry(const gd_entry_t *E)
+{
+  mxArray *lhs;
+  int nfields = 0;
+  int nscalar = 0;
+  const char **field_names = NULL;
+
+  /* field lists */
+  const int bit_nfields = GDMX_NSCALAR + 3;
+  const char *bit_fields[] = {GDMX_COMMON_FIELDS, "in_fields", "bitnum",
+    "numbits", GDMX_SCALAR_FIELDS};
+  const int carray_nfields = 2;
+  const char *carray_fields[] = {GDMX_COMMON_FIELDS, "const_type", "array_len"};
+  const int const_nfields = 1;
+  const char *const_fields[] = {GDMX_COMMON_FIELDS, "const_type"};
+  const int lincom_nfields = GDMX_NSCALAR + 3;
+  const char *lincom_fields[] = {GDMX_COMMON_FIELDS, "in_fields", "m", "b",
+    GDMX_SCALAR_FIELDS};
+  const int linterp_nfields = 2;
+  const char *linterp_fields[] = {GDMX_COMMON_FIELDS, "in_fields", "table"};
+  const int mplex_nfields = GDMX_NSCALAR + 3;
+  const char *mplex_fields[] = {GDMX_COMMON_FIELDS, "in_fields", "count_val",
+    "period", GDMX_SCALAR_FIELDS};
+  const int multiply_nfields = 1;
+  const char *multiply_fields[] = {GDMX_COMMON_FIELDS, "in_fields"};
+  const int phase_nfields = GDMX_NSCALAR + 2;
+  const char *phase_fields[] = {GDMX_COMMON_FIELDS, "in_fields", "shift",
+    GDMX_SCALAR_FIELDS};
+  const int polynom_nfields = GDMX_NSCALAR + 2;
+  const char *polynom_fields[] = {GDMX_COMMON_FIELDS, "in_fields", "a",
+    GDMX_SCALAR_FIELDS};
+  const int raw_nfields = GDMX_NSCALAR + 2;
+  const char *raw_fields[] = {GDMX_COMMON_FIELDS, "spf", "data_type",
+    GDMX_SCALAR_FIELDS};
+  const int recip_nfields = GDMX_NSCALAR + 2;
+  const char *recip_fields[] = {GDMX_COMMON_FIELDS, "in_fields", "dividend",
+    GDMX_SCALAR_FIELDS};
+  const int window_nfields = GDMX_NSCALAR + 3;
+  const char *window_fields[] = {GDMX_COMMON_FIELDS, "in_fields", "windop",
+    "threshold", GDMX_SCALAR_FIELDS};
+  const char *common_fields[] = {GDMX_COMMON_FIELDS};
+
+  dtrace("%p", E);
+
+  switch (E->field_type) {
+    case GD_BIT_ENTRY:
+    case GD_SBIT_ENTRY:
+      nfields = GDMX_NCOMMON + bit_nfields;
+      field_names = bit_fields;
+      break;
+    case GD_CARRAY_ENTRY:
+      nfields = GDMX_NCOMMON + carray_nfields;
+      field_names = carray_fields;
+      break;
+    case GD_CONST_ENTRY:
+      nfields = GDMX_NCOMMON + const_nfields;
+      field_names = const_fields;
+      break;
+    case GD_INDEX_ENTRY:
+    case GD_STRING_ENTRY:
+      nfields = GDMX_NCOMMON;
+      field_names = common_fields;
+      break;
+    case GD_LINCOM_ENTRY:
+      nfields = GDMX_NCOMMON + lincom_nfields;
+      field_names = lincom_fields;
+      break;
+    case GD_LINTERP_ENTRY:
+      nfields = GDMX_NCOMMON + linterp_nfields;
+      field_names = linterp_fields;
+      break;
+    case GD_MPLEX_ENTRY:
+      nfields = GDMX_NCOMMON + mplex_nfields;
+      field_names = mplex_fields;
+      break;
+    case GD_MULTIPLY_ENTRY:
+    case GD_DIVIDE_ENTRY:
+      nfields = GDMX_NCOMMON + multiply_nfields;
+      field_names = multiply_fields;
+      break;
+    case GD_PHASE_ENTRY:
+      nfields = GDMX_NCOMMON + phase_nfields;
+      field_names = phase_fields;
+      break;
+    case GD_POLYNOM_ENTRY:
+      nfields = GDMX_NCOMMON + polynom_nfields;
+      field_names = polynom_fields;
+      break;
+    case GD_RAW_ENTRY:
+      nfields = GDMX_NCOMMON + raw_nfields;
+      field_names = raw_fields;
+      break;
+    case GD_RECIP_ENTRY:
+      nfields = GDMX_NCOMMON + recip_nfields;
+      field_names = recip_fields;
+      break;
+    case GD_WINDOW_ENTRY:
+      nfields = GDMX_NCOMMON + window_nfields;
+      field_names = window_fields;
+      break;
+    default:
+      GDMX_INTERNAL_ERROR;
+  }
+
+  lhs = mxCreateStructMatrix(1, 1, nfields, field_names);
+
+  /* populate */
+  mxSetField(lhs, 0, "field", mxCreateString(E->field));
+  mxSetField(lhs, 0, "field_type", gdmx_from_entype(E->field_type));
+  mxSetField(lhs, 0, "fragment_index", gdmx_from_int(E->fragment_index));
+  switch (E->field_type) {
+    case GD_BIT_ENTRY:
+    case GD_SBIT_ENTRY:
+      mxSetField(lhs, 0, "in_fields", mxCreateString(E->in_fields[0]));
+      mxSetField(lhs, 0, "bitnum", gdmx_from_int(E->EN(bit,bitnum)));
+      mxSetField(lhs, 0, "numbits", gdmx_from_int(E->EN(bit,numbits)));
+      nscalar = 2;
+      break;
+    case GD_CARRAY_ENTRY:
+      mxSetField(lhs, 0, "array_len",
+          gdmx_from_size_t(E->EN(scalar,array_len)));
+      /* fallthrough */
+    case GD_CONST_ENTRY:
+      mxSetField(lhs, 0, "const_type",
+          gdmx_from_gd_type(E->EN(scalar,const_type)));
+      break;
+    case GD_INDEX_ENTRY:
+    case GD_STRING_ENTRY:
+      break;
+    case GD_LINCOM_ENTRY:
+      mxSetField(lhs, 0, "in_fields",
+          gdmx_from_nstring_list((const char**)E->in_fields,
+            E->EN(lincom,n_fields)));
+      if (E->comp_scal) {
+        mxSetField(lhs, 0, "m", gdmx_from_data(E->EN(lincom,cm), GD_COMPLEX128,
+              E->EN(lincom,n_fields)));
+        mxSetField(lhs, 0, "b", gdmx_from_data(E->EN(lincom,cb), GD_COMPLEX128,
+              E->EN(lincom,n_fields)));
+      } else {
+        mxSetField(lhs, 0, "m", gdmx_from_data(E->EN(lincom,m), GD_FLOAT64,
+              E->EN(lincom,n_fields)));
+        mxSetField(lhs, 0, "b", gdmx_from_data(E->EN(lincom,b), GD_FLOAT64,
+              E->EN(lincom,n_fields)));
+      }
+      nscalar = GD_MAX_LINCOM * 2;
+      break;
+    case GD_LINTERP_ENTRY:
+      mxSetField(lhs, 0, "in_fields", mxCreateString(E->in_fields[0]));
+      mxSetField(lhs, 0, "table", mxCreateString(E->EN(linterp,table)));
+      break;
+    case GD_MPLEX_ENTRY:
+      mxSetField(lhs, 0, "in_fields",
+          gdmx_from_nstring_list((const char**)E->in_fields, 2));
+      mxSetField(lhs, 0, "count_val", gdmx_from_int(E->EN(mplex,count_val)));
+      mxSetField(lhs, 0, "period", gdmx_from_int(E->EN(mplex,period)));
+      nscalar = 2;
+      break;
+    case GD_MULTIPLY_ENTRY:
+    case GD_DIVIDE_ENTRY:
+      mxSetField(lhs, 0, "in_fields",
+          gdmx_from_nstring_list((const char**)E->in_fields, 2));
+      break;
+    case GD_PHASE_ENTRY:
+      mxSetField(lhs, 0, "in_fields", mxCreateString(E->in_fields[0]));
+      mxSetField(lhs, 0, "shift", gdmx_from_llong(E->EN(phase,shift)));
+      nscalar = 1;
+      break;
+    case GD_POLYNOM_ENTRY:
+      mxSetField(lhs, 0, "in_fields", mxCreateString(E->in_fields[0]));
+      if (E->comp_scal) {
+        mxSetField(lhs, 0, "a", gdmx_from_data(E->EN(polynom,ca), GD_COMPLEX128,
+              E->EN(polynom,poly_ord) + 1));
+      } else {
+        mxSetField(lhs, 0, "a", gdmx_from_data(E->EN(polynom,a), GD_FLOAT64,
+              E->EN(polynom,poly_ord) + 1));
+      }
+      nscalar = E->EN(polynom,poly_ord) + 1;
+      break;
+    case GD_RAW_ENTRY:
+      mxSetField(lhs, 0, "data_type", gdmx_from_gd_type(E->EN(raw,data_type)));
+      mxSetField(lhs, 0, "spf", gdmx_from_uint(E->EN(raw,spf)));
+      nscalar = 1;
+      break;
+    case GD_RECIP_ENTRY:
+      mxSetField(lhs, 0, "in_fields", mxCreateString(E->in_fields[0]));
+      if (E->comp_scal)
+        mxSetField(lhs, 0, "dividend",
+            gdmx_from_cdouble((double*)&E->EN(recip,cdividend)));
+      else
+        mxSetField(lhs, 0, "dividend", gdmx_from_double(E->EN(recip,dividend)));
+      nscalar = 1;
+      break;
+    case GD_WINDOW_ENTRY:
+      mxSetField(lhs, 0, "in_fields",
+          gdmx_from_nstring_list((const char**)E->in_fields, 2));
+      mxSetField(lhs, 0, "windop", gdmx_from_windop(E->EN(window,windop)));
+      mxSetField(lhs, 0, "threshold", gdmx_from_triplet(E->EN(window,threshold),
+            E->EN(window,windop)));
+      nscalar = 1;
+      break;
+    default:
+      GDMX_INTERNAL_ERROR;
+  }
+
+  /* handle scalars */
+  if (nscalar > 0) {
+    mxSetField(lhs, 0, "scalar",
+        gdmx_from_nstring_list((const char **)E->scalar, nscalar));
+    mxSetField(lhs, 0, "scalar_ind", gdmx_from_data(E->scalar_ind, GD_INT_TYPE,
+          nscalar));
+  }
+
+  dreturn("%p", lhs);
+  return lhs;
+}
+
+mxArray *gdmx_from_carrays(const gd_carray_t *c, gd_type_t type)
+{
+  size_t i, n, comp;
+  mxArray *lhs;
+  mxClassID id;
+
+  dtrace("%p, 0x%X", c, type);
+
+  id = gdmx_classid(type);
+  comp = type & GD_COMPLEX;
+
+  /* count */
+  for (n = 0; c[n].n; ++n)
+    ;
+
+  lhs = mxCreateCellMatrix(1, n);
+
+  for (n = 0; c[n].n; ++n) {
+    mxArray *a = mxCreateNumericMatrix(1, c[n].n, id,
+        comp ? mxCOMPLEX : mxREAL);
+    void *pr = mxGetData(a);
+
+    if (type == GD_COMPLEX128) {
+      double *pi = mxGetImagData(a);
+      for (i = 0; i < c[n].n; ++i) {
+        ((double*)pr)[i] = ((double*)c[n].d)[2 * i];
+        pi[i] = ((double*)c[n].d)[2 * i + 1];
+      }
+    } else if (type == GD_COMPLEX64) {
+      float *pi = mxGetImagData(a);
+      for (i = 0; i < c[n].n; ++i) {
+        ((float*)pr)[i] = ((float*)c[n].d)[2 * i];
+        pi[i] = ((float*)c[n].d)[2 * i + 1];
+      }
+    } else
+      memcpy(pr, c[n].d, GD_SIZE(type) * c[n].n);
+
+    mxSetCell(lhs, n, a);
+  }
+
+  dreturn("%p", lhs);
+  return lhs;
+}
+
+#define GDMX_MXDIRFILE_FMT "MXDIRFILE:%p;"
+mxArray *gdmx_from_dirfile(const DIRFILE *D)
+{
+  dtrace("%p", D);
+
+  mxArray *a;
+  char s[100];
+
+  sprintf(s, GDMX_MXDIRFILE_FMT, D);
+
+  a = mxCreateString(s);
+
+  dreturn("%p (\"%s\")", a, s);
+  return a;
+}
+
+DIRFILE *gdmx_to_dirfile(const mxArray *mxa)
+{
+  DIRFILE *D = NULL;
+  const char *dirfile;
+
+  dtrace("%p", mxa);
+
+  dirfile = mxArrayToString(mxa);
+
+  if (dirfile)
+    sscanf(dirfile, GDMX_MXDIRFILE_FMT, &D);
+  else
+    mexErrMsgIdAndTxt("GetData:GDMX:BadMXDirfile",
+        "Indeciperhable MXDirfile.", dirfile);
+
+  if (D == NULL)
+    mexErrMsgIdAndTxt("GetData:GDMX:BadMXDirfile",
+        "Indeciperhable MXDirfile: '%s'.", dirfile);
+
+  dreturn("%p", D);
+
+  return D;
+}
+
+void gdmx_free_entry(gd_entry_t *E)
+{
+  int i, ns = 0, ni = 0;
+
+  dtrace("%p", E);
+
+  if (E) {
+    switch (E->field_type) {
+      case GD_LINCOM_ENTRY:
+        ni = E->EN(lincom,n_fields);
+        ns = ni * 2;
+        break;
+      case GD_LINTERP_ENTRY:
+        mxFree(E->EN(linterp,table));
+      case GD_DIVIDE_ENTRY:
+      case GD_MULTIPLY_ENTRY:
+        ni = 2;
+        break;
+      case GD_BIT_ENTRY:
+      case GD_SBIT_ENTRY:
+        ni = 1;
+        ns = 2;
+        break;
+      case GD_PHASE_ENTRY:
+      case GD_RECIP_ENTRY:
+        ns = ni = 1;
+        break;
+      case GD_POLYNOM_ENTRY:
+        ni = 1;
+        ns = E->EN(polynom,poly_ord) + 1;
+        break;
+      case GD_RAW_ENTRY:
+        ni = 1;
+        break;
+      case GD_WINDOW_ENTRY:
+        ni = 2;
+        ns = 1;
+        break;
+      case GD_MPLEX_ENTRY:
+        ni = ns = 2;
+        break;
+      default:
+        break;
+    }
+
+    for (i = 0; i < ni; ++i)
+      if (E->in_fields[i])
+        mxFree(E->in_fields[i]);
+
+    for (i = 0; i < ns; ++i)
+      if (E->scalar[i])
+        mxFree(E->scalar[i]);
+    mxFree(E);
+  }
+
+  dreturnvoid();
+}
+
+static int gdmx_convert_in_fields(const mxArray *str,
+    const struct gdmx_context_t *ctx, gd_entry_t *E)
+{
+  mxArray *a;
+  size_t i, nelem = 1;
+  struct gdmx_context_t ectx = { ctx->name, "in_fields", ctx->num };
+
+  dtrace("%p, %p, %p", str, ctx, E);
+
+  a = gdmx_get_field(str, ctx, "in_fields");
+
+  if (mxIsCell(a)) {
+    nelem = gdmx_get_length(a);
+    if (nelem > GD_MAX_LINCOM)
+      nelem = GD_MAX_LINCOM;
+
+    for (i = 0; i < nelem; ++i) {
+      E->in_fields[i] = gdmx_to_string_(mxGetCell(a, i), &ectx, 1);
+    }
+  } else if (mxIsChar(a)) /* a single in_field */
+    E->in_fields[0] = gdmx_to_string_(a, &ectx, 0);
+  else if (gdmx_is_zero(a))
+    E->in_fields[0] = NULL;
+  else
+    mexErrMsgIdAndTxt("GetData:GDMX:BadEntry",
+        "Expected cell array or string %s.", gdmx_context(&ectx, 0));
+
+  dreturn("%i", nelem);
+  return nelem;
+}
+
+static int gdmx_convert_entry_array(const mxArray *str,
+    const struct gdmx_context_t *ctx, const char *field, GD_DCOMPLEXV(d),
+    size_t nelem)
+{
+  size_t i;
+  mxArray *a;
+  GD_DCOMPLEXP_t v;
+  struct gdmx_context_t ectx = { ctx->name, field, ctx->num };
+
+  dtrace("%p, %p, \"%s\", %p, %zu", str, ctx, field, d, nelem);
+
+  a = gdmx_get_field(str, ctx, field);
+  v = gdmx_convert_array(a, &ectx, GD_COMPLEX128, &nelem);
+
+  for (i = 0; i < nelem; ++i)
+    gd_ca2cs_(d[i],v,i);
+
+  mxFree(v);
+
+  dreturn("%i", nelem);
+  return nelem;
+}
+
+
+gd_entry_t *gdmx_to_entry(const mxArray **rhs, int n, unsigned flags)
+{
+  int v;
+  uint64_t s;
+  size_t nscalar = 0;
+  gd_entry_t *E;
+  struct gdmx_context_t ctx = { NULL, NULL, n };
+
+  dtrace("%p, %i, %x", rhs, n, flags);
+
+  /* check for struct */
+  if (!mxIsStruct(rhs[n]))
+    mexErrMsgIdAndTxt("GetData:GDMX:BadEntry",
+        "Expected entry struct for %s.", gdmx_context(&ctx, 0));
+
+  E = mxMalloc(sizeof(gd_entry_t));
+  memset(E, 0, sizeof(gd_entry_t));
+
+  /* fill the entry */
+  if (~flags & GDMX_ENO_FIELD)
+    E->field = gdmx_convert_struct_string(rhs[n], &ctx, "field");
+
+  gdmx_convert_struct_scalar(rhs[n], &ctx, "field_type", GD_INT_TYPE, &v);
+  E->field_type = v;
+  if (~flags & GDMX_ENO_FRAG)
+    gdmx_convert_struct_scalar(rhs[n], &ctx, "fragment_index", GD_INT_TYPE,
+        &E->fragment_index);
+
+  switch (E->field_type) {
+    case GD_BIT_ENTRY:
+    case GD_SBIT_ENTRY:
+      gdmx_convert_in_fields(rhs[n], &ctx, E);
+      gdmx_convert_struct_scalar(rhs[n], &ctx, "bitnum", GD_INT_TYPE,
+          &E->EN(bit,bitnum));
+      gdmx_convert_struct_scalar(rhs[n], &ctx, "numbits", GD_INT_TYPE,
+          &E->EN(bit,numbits));
+      break;
+    case GD_CARRAY_ENTRY:
+      gdmx_convert_struct_scalar(rhs[n], &ctx, "array_len", GD_UINT64, &s);
+      E->EN(scalar,array_len) = (size_t)s;
+      /* fallthrough */
+    case GD_CONST_ENTRY:
+      gdmx_convert_struct_scalar(rhs[n], &ctx, "const_type", GD_INT_TYPE, &v);
+      E->EN(scalar,const_type) = v;
+      break;
+    case GD_DIVIDE_ENTRY:
+    case GD_MULTIPLY_ENTRY:
+      gdmx_convert_in_fields(rhs[n], &ctx, E);
+      break;
+    case GD_LINCOM_ENTRY:
+      E->EN(lincom,n_fields) = gdmx_convert_in_fields(rhs[n], &ctx, E);
+      E->comp_scal = 1;
+      gdmx_convert_entry_array(rhs[n], &ctx, "m", E->EN(lincom,cm),
+          E->EN(lincom,n_fields));
+      gdmx_convert_entry_array(rhs[n], &ctx, "b", E->EN(lincom,cb),
+          E->EN(lincom,n_fields));
+      break;
+    case GD_LINTERP_ENTRY:
+      gdmx_convert_in_fields(rhs[n], &ctx, E);
+      E->EN(linterp,table) = gdmx_convert_struct_string(rhs[n], &ctx, "table");
+      break;
+    case GD_MPLEX_ENTRY:
+      gdmx_convert_in_fields(rhs[n], &ctx, E);
+      gdmx_convert_struct_scalar(rhs[n], &ctx, "count_val", GD_INT_TYPE,
+          &E->EN(mplex,count_val));
+      gdmx_convert_struct_scalar(rhs[n], &ctx, "period", GD_INT_TYPE,
+          &E->EN(mplex,period));
+      break;
+    case GD_PHASE_ENTRY:
+      gdmx_convert_in_fields(rhs[n], &ctx, E);
+      gdmx_convert_struct_scalar(rhs[n], &ctx, "shift", GD_INT64,
+          &E->EN(phase,shift));
+      break;
+    case GD_POLYNOM_ENTRY:
+      gdmx_convert_in_fields(rhs[n], &ctx, E);
+      E->comp_scal = 1;
+      E->EN(polynom,poly_ord) = gdmx_convert_entry_array(rhs[n], &ctx, "a",
+          E->EN(polynom,ca), GD_MAX_POLYORD + 1) - 1;
+      break;
+    case GD_RAW_ENTRY:
+      gdmx_convert_struct_scalar(rhs[n], &ctx, "data_type", GD_INT_TYPE, &v);
+      E->EN(raw,data_type) = v;
+      gdmx_convert_struct_scalar(rhs[n], &ctx, "spf", GD_UINT_TYPE,
+          &E->EN(raw,spf));
+      nscalar = 1;
+      break;
+    case GD_RECIP_ENTRY:
+      gdmx_convert_in_fields(rhs[n], &ctx, E);
+      E->comp_scal = 1;
+      gdmx_convert_struct_scalar(rhs[n], &ctx, "dividend", GD_COMPLEX128,
+          &E->EN(recip,cdividend));
+      break;
+    case GD_STRING_ENTRY:
+      break;
+    case GD_WINDOW_ENTRY:
+      gdmx_convert_in_fields(rhs[n], &ctx, E);
+      gdmx_convert_struct_scalar(rhs[n], &ctx, "windop", GD_INT_TYPE, &v);
+      E->EN(window,windop) = v;
+      switch (v) {
+        case GD_WINDOP_EQ:
+        case GD_WINDOP_NE:
+          gdmx_convert_struct_scalar(rhs[n], &ctx, "threshold", GD_INT64,
+              &E->EN(window,threshold).i);
+          break;
+        case GD_WINDOP_SET:
+        case GD_WINDOP_CLR:
+          gdmx_convert_struct_scalar(rhs[n], &ctx, "threshold", GD_UINT64,
+              &E->EN(window,threshold).u);
+          break;
+        default:
+          gdmx_convert_struct_scalar(rhs[n], &ctx, "threshold", GD_FLOAT64,
+              &E->EN(window,threshold).r);
+          break;
+      }
+      break;
+    default:
+      mexErrMsgIdAndTxt("GetData:GDMX:BadEntryType",
+          "Invalid field_type %i for entry struct in parameter %i.",
+          E->field_type, n);
+  }
+
+  if (nscalar > 0) {
+    mxArray *scalar = gdmx_get_field(rhs[n], NULL, "scalar");
+
+    if (scalar) {
+      int *si = NULL;
+      mxArray *scalar_ind = gdmx_get_field(rhs[n], NULL, "scalar_ind");
+
+      if (scalar_ind) {
+        struct gdmx_context_t si_ctx = { NULL, "scalar_ind", n };
+        si = gdmx_convert_array(scalar_ind, &si_ctx, GD_INT_TYPE, &nscalar);
+      }
+
+      if (mxIsChar(scalar)) {
+        /* a single scalar */
+        E->scalar[0] = gdmx_to_string_(scalar, NULL, 0);
+        if (si)
+          E->scalar_ind[0] = si[0];
+        else
+          E->scalar_ind[0] = -1;
+      } else if (!mxIsCell(scalar))
+        mexErrMsgIdAndTxt("GetData:GDMX:BadEntryScalars",
+            "Field 'scalar' must be a string or cell array in parameter %i", n,
+            mxGetClassName(scalar));
+      else {
+        abort();
+      }
+
+      mxFree(si);
+    }
+  }
+
+  dreturn("%p", E);
+  return E;
+}
+
+/* convert nframes and nsamples from the rhs into nsamples */
+size_t gdmx_to_nsamp(DIRFILE *D, const char *field_code, const mxArray **rhs,
+    int nf, int ns)
+{
+  size_t nframes;
+  size_t nsamp;
+
+  dtrace("%p, %i, %i", rhs, nf, ns);
+
+  nframes = gdmx_to_size_t(rhs, nf);
+  nsamp = gdmx_to_size_t(rhs, ns);
+
+  if (nframes > 0) {
+    unsigned int spf = gd_spf(D, field_code);
+    gdmx_err(D, 0);
+
+    /* overflow */
+    if ((GD_SIZE_T_MAX - nsamp) / spf <= nframes)
+      mexErrMsgIdAndTxt("GetData:GDMX:Overflow", "Data range too large.");
+
+    nsamp += spf * nframes;
+  }
+
+  dreturn("%zu", nsamp);
+  return nsamp;
+}
+
+/* create a matlab vector; call gdmx_fix_vector after loading data */
+mxArray *gdmx_vector(gd_type_t type, size_t nsamp, void **data)
+{
+  mxArray *lhs;
+  mxComplexity cflag = (type & GD_COMPLEX) ? mxCOMPLEX : mxREAL;
+
+  dtrace("0x%X, %zu, %p", type, nsamp, data);
+
+  lhs = mxCreateNumericMatrix(1, (mwSize)nsamp, gdmx_classid(type), cflag);
+
+  if (data) {
+    /* in the complex place, we have to do the load out-of-place */
+    if (type & GD_COMPLEX)
+      *data = mxMalloc(GD_SIZE(type) * nsamp);
+    else
+      *data = mxGetData(lhs);
+  }
+
+  dreturn("%p (%p)", lhs, data ? *data : NULL);
+  return lhs;
+}
+
+/* store complex data, if necessary */
+void gdmx_fix_vector(mxArray *lhs, gd_type_t type, size_t nsamp, void *data)
+{
+  dtrace("%p, 0x%x, %zu, %p", lhs, type, nsamp, data);
+
+  if (type & GD_COMPLEX) {
+    size_t i;
+
+    if (type == GD_COMPLEX64) {
+      const float *ptr = (float *)data;
+      float *pr = (float*)mxGetData(lhs);
+      float *pi = (float*)mxGetImagData(lhs);
+
+      for (i = 0; i < nsamp; ++i) {
+        pr[i] = *(ptr++);
+        pi[i] = *(ptr++);
+      }
+    } else {
+      const double *ptr = (double *)data;
+      double *pr = (double*)mxGetData(lhs);
+      double *pi = (double*)mxGetImagData(lhs);
+
+      for (i = 0; i < nsamp; ++i) {
+        pr[i] = *(ptr++);
+        pi[i] = *(ptr++);
+      }
+    }
+    mxFree(data);
+  }
+
+  dreturnvoid();
+}
+
+void gdmx_to_data(void **data, gd_type_t *type, size_t *nsamp,
+    const mxArray **rhs, int n)
+{
+  int cflag = 0;
+  size_t i, ndims, ns = 1;
+  gd_type_t t;
+  const mwSize *dims;
+  struct gdmx_context_t ctx = { NULL, NULL, n };
+
+  dtrace("%p, %p, %p, %p, %i", data, type, nsamp, rhs, n);
+
+  /* check for complex data */
+  if (mxIsComplex(rhs[n]))
+    cflag = 1;
+
+  /* datatype */
+  *type = t = gdmx_type(rhs[n], &ctx, cflag);
+
+  /* length */
+  ndims = mxGetNumberOfDimensions(rhs[n]);
+
+  dims = mxGetDimensions(rhs[n]);
+  for (i = 0; i < ndims; ++i)
+    ns *= dims[i];
+
+  *nsamp = ns;
+
+  /* complex data needs a temporary buffer */
+  if (t == GD_COMPLEX64) {
+    float *d, *pr, *pi;
+    *data = mxMalloc(sizeof(float) * 2 * ns);
+    d = (float*)*data;
+
+    pr = (float*)mxGetData(rhs[n]);
+    pi = (float*)mxGetImagData(rhs[n]);
+
+    for (i = 0; i < ns; ++i) {
+      d[i * 2] = pr[i];
+      d[i * 2 + 1] = pi[i];
+    }
+  } else if (t == GD_COMPLEX128) {
+    double *d, *pr, *pi;
+    *data = mxMalloc(sizeof(double) * 2 * ns);
+    d = (double*)*data;
+
+    pr = (double*)mxGetData(rhs[n]);
+    pi = (double*)mxGetImagData(rhs[n]);
+
+    for (i = 0; i < ns; ++i) {
+      d[i * 2] = pr[i];
+      d[i * 2 + 1] = pi[i];
+    }
+  } else
+    *data = mxGetData(rhs[n]);
+
+  dreturn("%p; 0x%X, %zu", *data, *type, *nsamp);
+}
+
+void gdmx_free_data(void *data, gd_type_t type)
+{
+  dtrace("%p, 0x%X", data, type);
+
+  if (type & GD_COMPLEX)
+    mxFree(data);
+
+  dreturnvoid();
+}
diff --git a/bindings/matlab/test/Makefile.am b/bindings/matlab/test/Makefile.am
new file mode 100644
index 0000000..be285b1
--- /dev/null
+++ b/bindings/matlab/test/Makefile.am
@@ -0,0 +1,41 @@
+# Copyright (C) 2013 D. V. Wiebe
+#
+##########################################################################
+#
+# This file is part of the GetData project.
+#
+# GetData is free software; you can redistribute it and/or modify it under
+# the terms of the GNU Lesser General Public License as published by the
+# Free Software Foundation; either version 2.1 of the License, or (at your
+# option) any later version.
+#
+# GetData is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+# License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public License
+# along with GetData; if not, write to the Free Software Foundation, Inc.,
+# 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+#
+AUTOMAKE_OPTIONS = foreign
+
+if TEST_MATLAB
+TESTS_ENVIRONMENT=${DL_LIBRARY_PATH}=${${DL_LIBRARY_PATH}}:../../../src/.libs:../.libs MATLABPATH=${srcdir}:..:${srcdir}/.. ${srcdir}/test.sh ${MATLAB}
+
+matlabTESTS=big_test.m
+
+TESTS=$(addprefix ${srcdir}/,$(matlabTESTS))
+endif
+
+EXTRA_DIST=${matlabTESTS} test.sh
+
+check-local: check-TESTS
+	echo $(MAKE) getdata-clean-dirs
+
+getdata-clean-dirs:
+	rm -rf dirfile
+
+clean-local:
+	$(MAKE) getdata-clean-dirs
+	rm -rf *~
diff --git a/bindings/matlab/test/Makefile.in b/bindings/matlab/test/Makefile.in
new file mode 100644
index 0000000..247c7fa
--- /dev/null
+++ b/bindings/matlab/test/Makefile.in
@@ -0,0 +1,608 @@
+# Makefile.in generated by automake 1.11.5 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software
+# Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+ at SET_MAKE@
+VPATH = @srcdir@
+am__make_dryrun = \
+  { \
+    am__dry=no; \
+    case $$MAKEFLAGS in \
+      *\\[\ \	]*) \
+        echo 'am--echo: ; @echo "AM"  OK' | $(MAKE) -f - 2>/dev/null \
+          | grep '^AM OK$$' >/dev/null || am__dry=yes;; \
+      *) \
+        for am__flg in $$MAKEFLAGS; do \
+          case $$am__flg in \
+            *=*|--*) ;; \
+            *n*) am__dry=yes; break;; \
+          esac; \
+        done;; \
+    esac; \
+    test $$am__dry = yes; \
+  }
+pkgdatadir = $(datadir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkglibexecdir = $(libexecdir)/@PACKAGE@
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+subdir = bindings/matlab/test
+DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/m4/ax_compare_version.m4 \
+	$(top_srcdir)/m4/compiler.m4 $(top_srcdir)/m4/encoding.m4 \
+	$(top_srcdir)/m4/floatordering.m4 $(top_srcdir)/m4/idl.m4 \
+	$(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \
+	$(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \
+	$(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/m4/matlab.m4 \
+	$(top_srcdir)/m4/perl.m4 $(top_srcdir)/m4/python.m4 \
+	$(top_srcdir)/m4/win32.m4 $(top_srcdir)/m4/version.m4 \
+	$(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+	$(ACLOCAL_M4)
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = $(top_builddir)/src/gd_config.h \
+	$(top_builddir)/src/getdata.h
+CONFIG_CLEAN_FILES =
+CONFIG_CLEAN_VPATH_FILES =
+SOURCES =
+DIST_SOURCES =
+am__can_run_installinfo = \
+  case $$AM_UPDATE_INFO_DIR in \
+    n|no|NO) false;; \
+    *) (install-info --version) >/dev/null 2>&1;; \
+  esac
+am__tty_colors = \
+red=; grn=; lgn=; blu=; std=
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+AMTAR = @AMTAR@
+AR = @AR@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+BUILDCC = @BUILDCC@
+BZIP2_CPPFLAGS = @BZIP2_CPPFLAGS@
+BZIP2_LDFLAGS = @BZIP2_LDFLAGS@
+BZIP2_LIBS = @BZIP2_LIBS@
+CC = @CC@
+CCAS = @CCAS@
+CCASDEPMODE = @CCASDEPMODE@
+CCASFLAGS = @CCASFLAGS@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DATE = @DATE@
+DEFINE_GD_LEGACY_API = @DEFINE_GD_LEGACY_API@
+DEFINE_GD_NO_C99_API = @DEFINE_GD_NO_C99_API@
+DEFINE_gd_int16_t = @DEFINE_gd_int16_t@
+DEFINE_gd_int64_t = @DEFINE_gd_int64_t@
+DEFINE_gd_uint16_t = @DEFINE_gd_uint16_t@
+DEFINE_gd_uint64_t = @DEFINE_gd_uint64_t@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+DIFF = @DIFF@
+DLLTOOL = @DLLTOOL@
+DL_LIBRARY_PATH = @DL_LIBRARY_PATH@
+DSYMUTIL = @DSYMUTIL@
+DUMPBIN = @DUMPBIN@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+F77 = @F77@
+F95GETDATA_VERSION = @F95GETDATA_VERSION@
+FC = @FC@
+FCFLAGS = @FCFLAGS@
+FFLAGS = @FFLAGS@
+FGETDATA_VERSION = @FGETDATA_VERSION@
+FGREP = @FGREP@
+FLIBS = @FLIBS@
+GD_DIRSEP = @GD_DIRSEP@
+GD_FDIRSEP = @GD_FDIRSEP@
+GETDATAXX_VERSION = @GETDATAXX_VERSION@
+GETDATA_DEBUG = @GETDATA_DEBUG@
+GETDATA_IFACE_AGE = @GETDATA_IFACE_AGE@
+GETDATA_IFACE_VERSION = @GETDATA_IFACE_VERSION@
+GETDATA_IMPL_REVISION = @GETDATA_IMPL_REVISION@
+GETDATA_MAJOR = @GETDATA_MAJOR@
+GETDATA_MINOR = @GETDATA_MINOR@
+GETDATA_REVISION = @GETDATA_REVISION@
+GETDATA_VERSION_SUFFIX = @GETDATA_VERSION_SUFFIX@
+GREP = @GREP@
+GZIP_CPPFLAGS = @GZIP_CPPFLAGS@
+GZIP_LDFLAGS = @GZIP_LDFLAGS@
+GZIP_LIBS = @GZIP_LIBS@
+IDL = @IDL@
+IDL_CFLAGS = @IDL_CFLAGS@
+IDL_LIBS = @IDL_LIBS@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+JOT = @JOT@
+LD = @LD@
+LDFLAGS = @LDFLAGS@
+LIBLTDL = @LIBLTDL@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LIBTOOL_DEPS = @LIBTOOL_DEPS@
+LIPO = @LIPO@
+LN_S = @LN_S@
+LTDLINCL = @LTDLINCL@
+LTLIBOBJS = @LTLIBOBJS@
+LZMA_CPPFLAGS = @LZMA_CPPFLAGS@
+LZMA_LDFLAGS = @LZMA_LDFLAGS@
+LZMA_LIBS = @LZMA_LIBS@
+MAKEINFO = @MAKEINFO@
+MANIFEST_TOOL = @MANIFEST_TOOL@
+MATLAB = @MATLAB@
+MATLABGETDATA_VERSION = @MATLABGETDATA_VERSION@
+MATLAB_CPPFLAGS = @MATLAB_CPPFLAGS@
+MEX = @MEX@
+MKDIR_P = @MKDIR_P@
+NM = @NM@
+NMEDIT = @NMEDIT@
+NUMPY_CPPFLAGS = @NUMPY_CPPFLAGS@
+OBJDUMP = @OBJDUMP@
+OBJEXT = @OBJEXT@
+OTOOL = @OTOOL@
+OTOOL64 = @OTOOL64@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_URL = @PACKAGE_URL@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PERL = @PERL@
+PERL_MAN3EXT = @PERL_MAN3EXT@
+PRINTF = @PRINTF@
+PRIVATE_LIBS = @PRIVATE_LIBS@
+PYTHON = @PYTHON@
+PYTHON_CPPFLAGS = @PYTHON_CPPFLAGS@
+PYTHON_LIBS = @PYTHON_LIBS@
+RANLIB = @RANLIB@
+SED = @SED@
+SEQ = @SEQ@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+SLIM_CPPFLAGS = @SLIM_CPPFLAGS@
+SLIM_LDFLAGS = @SLIM_LDFLAGS@
+SLIM_LIBS = @SLIM_LIBS@
+STRIP = @STRIP@
+VERSION = @VERSION@
+ZZIP_CPPFLAGS = @ZZIP_CPPFLAGS@
+ZZIP_LDFLAGS = @ZZIP_LDFLAGS@
+ZZIP_LIBS = @ZZIP_LIBS@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+absolute_docdir = @absolute_docdir@
+ac_ct_AR = @ac_ct_AR@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
+ac_ct_F77 = @ac_ct_F77@
+ac_ct_FC = @ac_ct_FC@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+builddir = @builddir@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+idldir = @idldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+mandir = @mandir@
+matlabbasedir = @matlabbasedir@
+mexext = @mexext@
+mkdir_p = @mkdir_p@
+moduledir = @moduledir@
+oldincludedir = @oldincludedir@
+path_bunzip2 = @path_bunzip2@
+path_bzip2 = @path_bzip2@
+path_gunzip = @path_gunzip@
+path_gzip = @path_gzip@
+path_slim = @path_slim@
+path_unslim = @path_unslim@
+path_unzip = @path_unzip@
+path_xz = @path_xz@
+path_zip = @path_zip@
+pdfdir = @pdfdir@
+perldir = @perldir@
+perlmandir = @perlmandir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+pythondir = @pythondir@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+top_build_prefix = @top_build_prefix@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+
+# Copyright (C) 2013 D. V. Wiebe
+#
+##########################################################################
+#
+# This file is part of the GetData project.
+#
+# GetData is free software; you can redistribute it and/or modify it under
+# the terms of the GNU Lesser General Public License as published by the
+# Free Software Foundation; either version 2.1 of the License, or (at your
+# option) any later version.
+#
+# GetData is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+# License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public License
+# along with GetData; if not, write to the Free Software Foundation, Inc.,
+# 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+#
+AUTOMAKE_OPTIONS = foreign
+ at TEST_MATLAB_TRUE@TESTS_ENVIRONMENT = ${DL_LIBRARY_PATH}=${${DL_LIBRARY_PATH}}:../../../src/.libs:../.libs MATLABPATH=${srcdir}:..:${srcdir}/.. ${srcdir}/test.sh ${MATLAB}
+ at TEST_MATLAB_TRUE@matlabTESTS = big_test.m
+ at TEST_MATLAB_TRUE@TESTS = $(addprefix ${srcdir}/,$(matlabTESTS))
+EXTRA_DIST = ${matlabTESTS} test.sh
+all: all-am
+
+.SUFFIXES:
+$(srcdir)/Makefile.in:  $(srcdir)/Makefile.am  $(am__configure_deps)
+	@for dep in $?; do \
+	  case '$(am__configure_deps)' in \
+	    *$$dep*) \
+	      ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
+	        && { if test -f $@; then exit 0; else break; fi; }; \
+	      exit 1;; \
+	  esac; \
+	done; \
+	echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign bindings/matlab/test/Makefile'; \
+	$(am__cd) $(top_srcdir) && \
+	  $(AUTOMAKE) --foreign bindings/matlab/test/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+	@case '$?' in \
+	  *config.status*) \
+	    cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+	  *) \
+	    echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+	    cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+	esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure:  $(am__configure_deps)
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4):  $(am__aclocal_m4_deps)
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(am__aclocal_m4_deps):
+
+mostlyclean-libtool:
+	-rm -f *.lo
+
+clean-libtool:
+	-rm -rf .libs _libs
+tags: TAGS
+TAGS:
+
+ctags: CTAGS
+CTAGS:
+
+
+check-TESTS: $(TESTS)
+	@failed=0; all=0; xfail=0; xpass=0; skip=0; \
+	srcdir=$(srcdir); export srcdir; \
+	list=' $(TESTS) '; \
+	$(am__tty_colors); \
+	if test -n "$$list"; then \
+	  for tst in $$list; do \
+	    if test -f ./$$tst; then dir=./; \
+	    elif test -f $$tst; then dir=; \
+	    else dir="$(srcdir)/"; fi; \
+	    if $(TESTS_ENVIRONMENT) $${dir}$$tst; then \
+	      all=`expr $$all + 1`; \
+	      case " $(XFAIL_TESTS) " in \
+	      *[\ \	]$$tst[\ \	]*) \
+		xpass=`expr $$xpass + 1`; \
+		failed=`expr $$failed + 1`; \
+		col=$$red; res=XPASS; \
+	      ;; \
+	      *) \
+		col=$$grn; res=PASS; \
+	      ;; \
+	      esac; \
+	    elif test $$? -ne 77; then \
+	      all=`expr $$all + 1`; \
+	      case " $(XFAIL_TESTS) " in \
+	      *[\ \	]$$tst[\ \	]*) \
+		xfail=`expr $$xfail + 1`; \
+		col=$$lgn; res=XFAIL; \
+	      ;; \
+	      *) \
+		failed=`expr $$failed + 1`; \
+		col=$$red; res=FAIL; \
+	      ;; \
+	      esac; \
+	    else \
+	      skip=`expr $$skip + 1`; \
+	      col=$$blu; res=SKIP; \
+	    fi; \
+	    echo "$${col}$$res$${std}: $$tst"; \
+	  done; \
+	  if test "$$all" -eq 1; then \
+	    tests="test"; \
+	    All=""; \
+	  else \
+	    tests="tests"; \
+	    All="All "; \
+	  fi; \
+	  if test "$$failed" -eq 0; then \
+	    if test "$$xfail" -eq 0; then \
+	      banner="$$All$$all $$tests passed"; \
+	    else \
+	      if test "$$xfail" -eq 1; then failures=failure; else failures=failures; fi; \
+	      banner="$$All$$all $$tests behaved as expected ($$xfail expected $$failures)"; \
+	    fi; \
+	  else \
+	    if test "$$xpass" -eq 0; then \
+	      banner="$$failed of $$all $$tests failed"; \
+	    else \
+	      if test "$$xpass" -eq 1; then passes=pass; else passes=passes; fi; \
+	      banner="$$failed of $$all $$tests did not behave as expected ($$xpass unexpected $$passes)"; \
+	    fi; \
+	  fi; \
+	  dashes="$$banner"; \
+	  skipped=""; \
+	  if test "$$skip" -ne 0; then \
+	    if test "$$skip" -eq 1; then \
+	      skipped="($$skip test was not run)"; \
+	    else \
+	      skipped="($$skip tests were not run)"; \
+	    fi; \
+	    test `echo "$$skipped" | wc -c` -le `echo "$$banner" | wc -c` || \
+	      dashes="$$skipped"; \
+	  fi; \
+	  report=""; \
+	  if test "$$failed" -ne 0 && test -n "$(PACKAGE_BUGREPORT)"; then \
+	    report="Please report to $(PACKAGE_BUGREPORT)"; \
+	    test `echo "$$report" | wc -c` -le `echo "$$banner" | wc -c` || \
+	      dashes="$$report"; \
+	  fi; \
+	  dashes=`echo "$$dashes" | sed s/./=/g`; \
+	  if test "$$failed" -eq 0; then \
+	    col="$$grn"; \
+	  else \
+	    col="$$red"; \
+	  fi; \
+	  echo "$${col}$$dashes$${std}"; \
+	  echo "$${col}$$banner$${std}"; \
+	  test -z "$$skipped" || echo "$${col}$$skipped$${std}"; \
+	  test -z "$$report" || echo "$${col}$$report$${std}"; \
+	  echo "$${col}$$dashes$${std}"; \
+	  test "$$failed" -eq 0; \
+	else :; fi
+
+distdir: $(DISTFILES)
+	@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+	topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+	list='$(DISTFILES)'; \
+	  dist_files=`for file in $$list; do echo $$file; done | \
+	  sed -e "s|^$$srcdirstrip/||;t" \
+	      -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+	case $$dist_files in \
+	  */*) $(MKDIR_P) `echo "$$dist_files" | \
+			   sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+			   sort -u` ;; \
+	esac; \
+	for file in $$dist_files; do \
+	  if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+	  if test -d $$d/$$file; then \
+	    dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+	    if test -d "$(distdir)/$$file"; then \
+	      find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+	    fi; \
+	    if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+	      cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
+	      find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+	    fi; \
+	    cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
+	  else \
+	    test -f "$(distdir)/$$file" \
+	    || cp -p $$d/$$file "$(distdir)/$$file" \
+	    || exit 1; \
+	  fi; \
+	done
+check-am: all-am
+	$(MAKE) $(AM_MAKEFLAGS) check-TESTS check-local
+check: check-am
+all-am: Makefile
+installdirs:
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+	@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+	if test -z '$(STRIP)'; then \
+	  $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+	    install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+	      install; \
+	else \
+	  $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+	    install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+	    "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
+	fi
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+	-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+	-test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
+
+maintainer-clean-generic:
+	@echo "This command is intended for maintainers to use"
+	@echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-generic clean-libtool clean-local mostlyclean-am
+
+distclean: distclean-am
+	-rm -f Makefile
+distclean-am: clean-am distclean-generic
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+html-am:
+
+info: info-am
+
+info-am:
+
+install-data-am:
+
+install-dvi: install-dvi-am
+
+install-dvi-am:
+
+install-exec-am:
+
+install-html: install-html-am
+
+install-html-am:
+
+install-info: install-info-am
+
+install-info-am:
+
+install-man:
+
+install-pdf: install-pdf-am
+
+install-pdf-am:
+
+install-ps: install-ps-am
+
+install-ps-am:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+	-rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-generic mostlyclean-libtool
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am:
+
+.MAKE: check-am install-am install-strip
+
+.PHONY: all all-am check check-TESTS check-am check-local clean \
+	clean-generic clean-libtool clean-local distclean \
+	distclean-generic distclean-libtool distdir dvi dvi-am html \
+	html-am info info-am install install-am install-data \
+	install-data-am install-dvi install-dvi-am install-exec \
+	install-exec-am install-html install-html-am install-info \
+	install-info-am install-man install-pdf install-pdf-am \
+	install-ps install-ps-am install-strip installcheck \
+	installcheck-am installdirs maintainer-clean \
+	maintainer-clean-generic mostlyclean mostlyclean-generic \
+	mostlyclean-libtool pdf pdf-am ps ps-am uninstall uninstall-am
+
+
+check-local: check-TESTS
+	echo $(MAKE) getdata-clean-dirs
+
+getdata-clean-dirs:
+	rm -rf dirfile
+
+clean-local:
+	$(MAKE) getdata-clean-dirs
+	rm -rf *~
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/bindings/matlab/test/big_test.m b/bindings/matlab/test/big_test.m
new file mode 100644
index 0000000..a4c5caa
--- /dev/null
+++ b/bindings/matlab/test/big_test.m
@@ -0,0 +1,2227 @@
+% Copyright (C) 2013 D. V. Wiebe
+%
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%
+% This file is part of the GetData project.
+%
+% GetData is free software; you can redistribute it and/or modify it under
+% the terms of the GNU Lesser General Public License as published by the
+% Free Software Foundation; either version 2.1 of the License, or (at your
+% option) any later version.
+%
+% GetData is distributed in the hope that it will be useful, but WITHOUT
+% ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+% FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+% License for more details.
+%
+% You should have received a copy of the GNU Lesser General Public License
+% along with GetData; if not, write to the Free Software Foundation, Inc.,
+% 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+function big_test
+try
+  ne = 0;
+
+  filedir='dirfile';
+  format=strcat(filedir, '/format');
+  format1=strcat(filedir, '/format1');
+  form2=strcat(filedir, '/form2');
+  data=strcat(filedir, '/data');
+  new1=strcat(filedir, '/new1');
+  format_data =[...
+  '/ENDIAN little\n'...
+  'data RAW INT8 8\n'...
+  'lincom LINCOM data 1.1 2.2 INDEX 2.2 3.3;4.4 linterp const const\n'...
+  '/META data mstr STRING "This is a string constant."\n'...
+  '/META data mconst CONST COMPLEX128 3.3;4.4\n'...
+  '/META data mcarray CARRAY FLOAT64 1.9 2.8 3.7 4.6 5.5\n'...
+  '/META data mlut LINTERP DATA ./lut\n'...
+  'const CONST FLOAT64 5.5\n'...
+  'carray CARRAY FLOAT64 1.1 2.2 3.3 4.4 5.5 6.6\n'...
+  'linterp LINTERP data ./lut\n'...
+  'polynom POLYNOM data 1.1 2.2 2.2 3.3;4.4 const const\n'...
+  'bit BIT data 3 4\n'...
+  'sbit SBIT data 5 6\n'...
+  'mplex MPLEX data sbit 1 10\n'...
+  'mult MULTIPLY data sbit\n'...
+  'div DIVIDE mult bit\n'...
+  'recip RECIP div 6.5;4.3\n'...
+  'phase PHASE data 11\n'...
+  'window WINDOW linterp mult LT 4.1\n'...
+  '/ALIAS alias data\n'...
+  'string STRING "Zaphod Beeblebrox"\n'];
+  form2_data = 'const2 CONST INT8 -19\n';
+
+  fields = {'INDEX'; 'alias'; 'bit'; 'carray'; 'const'; 'data'; 'div'; ...
+  'lincom'; 'linterp'; 'mplex'; 'mult'; 'phase'; 'polynom'; 'recip'; 'sbit'; ...
+  'string'; 'window'};
+  nfields = 17;
+
+  % Create the dirfile
+  mkdir(filedir);
+
+  fid=fopen(format, 'w');
+  fprintf(fid, format_data);
+  fclose(fid);
+
+  fid=fopen(form2, 'w');
+  fprintf(fid, form2_data);
+  fclose(fid);
+
+  data_data=0:1:80;
+  fid=fopen(data, 'w');
+  fwrite(fid, data_data);
+  fclose(fid);
+
+  % 140: getdata_constants check
+  GD = getdata_constants();
+  ne = ne + check_num(140, GD.RDWR, 1);
+
+  % 0: gd_error check
+  try
+    D = gd_open('x');
+  catch exc
+    ne = ne + check_exc(exc, 0, 'Open');
+  end
+
+  % 1: gd_open check
+  try
+    D = gd_open(filedir, GD.RDWR);
+  catch exc
+    ne = ne + check_ok(exc, 1);
+  end
+
+  % 2: getdata check
+  try
+    d = gd_getdata(D, 'data', 5, 0, 1, 0);
+    ne = ne + check_array(2, d, [40:47]);
+  catch exc
+    ne = ne + check_ok(exc, 2);
+  end
+
+  % 108: getdata check (complex128)
+  try
+    d = gd_getdata(D, 'data', 5, 0, 1, 0, GD.COMPLEX128);
+    ne = ne + check_array(2, d, [ complex(40,0), complex(41,0), ...
+    complex(42,0), complex(43,0), complex(44,0), complex(45,0), ...
+    complex(46,0), complex(47,0) ]);
+  catch exc
+    ne = ne + check_ok(exc, 108);
+  end
+
+  % 3: gd_get_constant check
+  try
+    d = gd_get_constant(D, 'const');
+    ne = ne + check_num(3, d, 5.5);
+  catch exc
+    ne = ne + check_ok(exc, 3);
+  end
+
+  % 6: gd_nfields check
+  try
+    d = gd_nfields(D);
+    ne = ne + check_num(6, d, nfields);
+  catch exc
+    ne = ne + check_ok(exc, 6);
+  end
+
+  % 8: gd_field_list check
+  try
+    d = gd_field_list(D);
+    ne = ne + check_sarray(8, d, fields);
+  catch exc
+    ne = ne + check_ok(exc, 8);
+  end
+
+  % 9: gd_nmfields check
+  try
+    d = gd_nmfields(D, 'data');
+    ne = ne + check_num(9, d, 4);
+  catch exc
+    ne = ne + check_ok(exc, 9);
+  end
+
+  % 10: gd_mfield_list check
+  try
+    d = gd_mfield_list(D, 'data');
+    ne = ne + check_sarray(10, d, { 'mstr'; 'mconst'; 'mcarray'; 'mlut' });
+  catch exc
+    ne = ne + check_ok(exc, 10);
+  end
+
+  % 11: gd_nframes check
+  try
+    d = gd_nframes(D);
+    ne = ne + check_num(11, d, 10);
+  catch exc
+    ne = ne + check_ok(exc, 11);
+  end
+
+  % 12: gd_spf check
+  try
+    d = gd_spf(D, 'data');
+    ne = ne + check_num(12, d, 8);
+  catch exc
+    ne = ne + check_ok(exc, 12);
+  end
+
+  % 13: gd_putdata check
+  p = [ 13, 14, 15, 16 ];
+  try
+    d = gd_putdata(D, 'data', 5, 1, p);
+    ne = ne + check_num(13, d, 4);
+  catch exc
+    ne = ne + check_ok2(exc, 13, 1);
+  end
+
+  try
+    d = gd_getdata(D, 'data', 5, 0, 1, 0);
+  catch exc
+    ne = ne + check_ok2(exc, 13, 2);
+  end
+
+  % 124: gd_putdata check (complex)
+  p = [ complex(33,0), complex(34,0), complex(35,0), complex(36,0) ];
+  try
+    d = gd_putdata(D, 'data', 5, 1, p);
+    ne = ne + check_num(124, d, 4);
+  catch exc
+    ne = ne + check_ok2(exc, 124, 1);
+  end
+
+  try
+    d = gd_getdata(D, 'data', 5, 0, 1, 0);
+    ne = ne + check_array(124, d, [40, 33, 34, 35, 36, 45, 46, 47]);
+  catch exc
+    ne = ne + check_ok2(exc, 124, 2);
+  end
+
+  % 14: error_string
+  try
+    gd_getdata(D, 'x', 1, 0, 1, 0);
+  catch exc
+    ne = ne + check_exc(exc, 14, 'BadCode');
+  end
+  ne = ne + check_num(14, gd_error(D), GD.E_BAD_CODE);
+  ne = ne + check_string(14, gd_error_string(D), 'Field not found: x');
+
+  % 15: entry_type
+  try
+    d = gd_entry_type(D, 'data');
+    ne = ne + check_num(15, d, GD.RAW_ENTRY);
+  catch exc
+    ne = ne + check_ok(exc, 15);
+  end
+
+  % 16: entry (raw) check
+  try
+    d = gd_entry(D, 'data');
+    ne = ne + check_string2(16, 1, d.field, 'data');
+    ne = ne + check_num2(16, 2, d.field_type, GD.RAW_ENTRY);
+    ne = ne + check_num2(16, 3, d.fragment_index, 0);
+    ne = ne + check_num2(16, 4, d.data_type, GD.INT8);
+  catch exc
+    ne = ne + check_ok(exc, 16);
+  end
+
+  % 18: entry (lincom) check
+  try
+    d = gd_entry(D, 'lincom');
+    ne = ne + check_string2(18, 1, d.field, 'lincom');
+    ne = ne + check_num2(18, 2, d.field_type, GD.LINCOM_ENTRY);
+    ne = ne + check_num2(18, 3, d.fragment_index, 0);
+    ne = ne + check_sarray2(18, 4, d.in_fields, { 'data'; 'INDEX'; 'linterp' });
+    ne = ne + check_array2(18, 5, d.m, [ 1.1, 2.2, 5.5 ]);
+    ne = ne + check_array2(18, 6, d.b, [ 2.2, complex(3.3,4.4), 5.5 ]);
+    ne = ne + check_sarray2(18, 7, d.scalar, {0; 0; 'const'; 0; 0; 'const'});
+    ne = ne + check_array2(18, 8, d.scalar_ind, [0, 0, -1, 0, 0, -1]);
+  catch exc
+    ne = ne + check_ok(exc, 18);
+  end
+
+  % 20: entry (polynom) check
+  try
+    d = gd_entry(D, 'polynom');
+    ne = ne + check_string2(20, 1, d.field, 'polynom');
+    ne = ne + check_num2(20, 2, d.field_type, GD.POLYNOM_ENTRY);
+    ne = ne + check_num2(20, 3, d.fragment_index, 0);
+    ne = ne + check_string2(20, 4, d.in_fields, 'data');
+    ne = ne + check_array2(20, 5, d.a, [ 1.1, 2.2, 2.2, complex(3.3, 4.4), ...
+    5.5, 5.5]);
+    ne = ne + check_sarray2(20, 6, d.scalar, {0; 0; 0; 0; 'const'; 'const'});
+    ne = ne + check_array2(20, 7, d.scalar_ind, [0, 0, 0, 0, -1, -1]);
+  catch exc
+    ne = ne + check_ok(exc, 20);
+  end
+
+  % 21: entry (linterp) check
+  try
+    d = gd_entry(D, 'linterp');
+    ne = ne + check_string2(21, 1, d.field, 'linterp');
+    ne = ne + check_num2(21, 2, d.field_type, GD.LINTERP_ENTRY);
+    ne = ne + check_num2(21, 3, d.fragment_index, 0);
+    ne = ne + check_string2(21, 4, d.in_fields, 'data');
+    ne = ne + check_string2(21, 5, d.table, './lut');
+  catch exc
+    ne = ne + check_ok(exc, 21);
+  end
+
+  % 22: entry (bit) check
+  try
+    d = gd_entry(D, 'bit');
+    ne = ne + check_string2(22, 1, d.field, 'bit');
+    ne = ne + check_num2(22, 2, d.field_type, GD.BIT_ENTRY);
+    ne = ne + check_num2(22, 3, d.fragment_index, 0);
+    ne = ne + check_string2(22, 4, d.in_fields, 'data');
+    ne = ne + check_num2(22, 5, d.bitnum, 3);
+    ne = ne + check_num2(22, 6, d.numbits, 4);
+  catch exc
+    ne = ne + check_ok(exc, 22);
+  end
+
+  % 23: entry (sbit) check
+  try
+    d = gd_entry(D, 'sbit');
+    ne = ne + check_string2(23, 1, d.field, 'sbit');
+    ne = ne + check_num2(23, 2, d.field_type, GD.SBIT_ENTRY);
+    ne = ne + check_num2(23, 3, d.fragment_index, 0);
+    ne = ne + check_string2(23, 4, d.in_fields, 'data');
+    ne = ne + check_num2(23, 5, d.bitnum, 5);
+    ne = ne + check_num2(23, 6, d.numbits, 6);
+  catch exc
+    ne = ne + check_ok(exc, 23);
+  end
+
+  % 24: entry (mult) check
+  try
+    d = gd_entry(D, 'mult');
+    ne = ne + check_string2(24, 1, d.field, 'mult');
+    ne = ne + check_num2(24, 2, d.field_type, GD.MULTIPLY_ENTRY);
+    ne = ne + check_num2(24, 3, d.fragment_index, 0);
+    ne = ne + check_sarray2(24, 4, d.in_fields, { 'data'; 'sbit'; });
+  catch exc
+    ne = ne + check_ok(exc, 24);
+  end
+
+  % 25: entry (phase) check
+  try
+    d = gd_entry(D, 'phase');
+    ne = ne + check_string2(25, 1, d.field, 'phase');
+    ne = ne + check_num2(25, 2, d.field_type, GD.PHASE_ENTRY);
+    ne = ne + check_num2(25, 3, d.fragment_index, 0);
+    ne = ne + check_string2(25, 4, d.in_fields, 'data');
+    ne = ne + check_num2(25, 5, d.shift, 11);
+  catch exc
+    ne = ne + check_ok(exc, 25);
+  end
+
+  % 26: entry (const) check
+  try
+    d = gd_entry(D, 'const');
+    ne = ne + check_string2(26, 1, d.field, 'const');
+    ne = ne + check_num2(26, 2, d.field_type, GD.CONST_ENTRY);
+    ne = ne + check_num2(26, 3, d.fragment_index, 0);
+    ne = ne + check_num2(26, 5, d.const_type, GD.FLOAT64);
+  catch exc
+    ne = ne + check_ok(exc, 26);
+  end
+
+  % 134: entry (string) check
+  try
+    d = gd_entry(D, 'string');
+    ne = ne + check_string2(134, 1, d.field, 'string');
+    ne = ne + check_num2(134, 2, d.field_type, GD.STRING_ENTRY);
+    ne = ne + check_num2(134, 3, d.fragment_index, 0);
+  catch exc
+    ne = ne + check_ok(exc, 134);
+  end
+
+  % 27: gd_fragment_index check
+  try
+    d = gd_fragment_index(D, 'data');
+  catch exc
+    ne = ne + check_ok(exc, 27);
+  end
+  ne = ne + check_num(27, d, 0);
+
+  % 28: add_raw
+  try
+    gd_add_raw(D, 'new1', GD.FLOAT64, 3, 0);
+  catch exc
+    ne = ne + check_ok2(exc, 28, 1);
+  end
+
+  try
+    d = gd_entry(D, 'new1');
+    ne = ne + check_string2(28, 1, d.field, 'new1');
+    ne = ne + check_num2(28, 2, d.field_type, GD.RAW_ENTRY);
+    ne = ne + check_num2(28, 3, d.fragment_index, 0);
+    ne = ne + check_num2(28, 4, d.data_type, GD.FLOAT64);
+    ne = ne + check_num2(28, 4, d.spf, 3);
+  catch exc
+    ne = ne + check_ok2(exc, 28, 2);
+  end
+
+  % 29: add entry (lincom) check
+  try
+    gd_add_lincom(D, 'new2', { 'in1'; 'in2' }, [9.9, 7.7], [8.8, 6.6], 0);
+  catch exc
+    ne = ne + check_ok2(exc, 29, 1);
+  end
+
+  try
+    d = gd_entry(D, 'new2');
+    ne = ne + check_string2(29, 1, d.field, 'new2');
+    ne = ne + check_num2(29, 2, d.field_type, GD.LINCOM_ENTRY);
+    ne = ne + check_num2(29, 3, d.fragment_index, 0);
+    ne = ne + check_sarray2(29, 4, d.in_fields, { 'in1'; 'in2' });
+    ne = ne + check_array2(29, 5, d.m, [ 9.9, 7.7 ]);
+    ne = ne + check_array2(29, 6, d.b, [ 8.8, 6.6 ]);
+  catch exc
+    ne = ne + check_ok2(exc, 29, 2);
+  end
+
+  % 32: add entry (polynom) check
+  try
+    gd_add_polynom(D, 'new5', 'in1', [3.9, 4.8, 5.7, complex(6.6,7.5)], 0);
+  catch exc
+    ne = ne + check_ok2(exc, 32, 1);
+  end
+
+  try
+    d = gd_entry(D, 'new5');
+    ne = ne + check_string2(32, 1, d.field, 'new5');
+    ne = ne + check_num2(32, 2, d.field_type, GD.POLYNOM_ENTRY);
+    ne = ne + check_num2(32, 3, d.fragment_index, 0);
+    ne = ne + check_string2(32, 4, d.in_fields, 'in1');
+    ne = ne + check_array2(32, 5, d.a, [3.9, 4.8, 5.7, complex(6.6,7.5)]);
+  catch exc
+    ne = ne + check_ok2(exc, 32, 2);
+  end
+
+  % 33: add entry (linterp) check
+  try
+    gd_add_linterp(D, 'new6', 'in', './some/table', 0);
+  catch exc
+    ne = ne + check_ok2(exc, 33, 1);
+  end
+
+  try
+    d = gd_entry(D, 'new6');
+    ne = ne + check_string2(33, 1, d.field, 'new6');
+    ne = ne + check_num2(33, 2, d.field_type, GD.LINTERP_ENTRY);
+    ne = ne + check_num2(33, 3, d.fragment_index, 0);
+    ne = ne + check_string2(33, 4, d.in_fields, 'in');
+    ne = ne + check_string2(33, 5, d.table, './some/table');
+  catch exc
+    ne = ne + check_ok2(exc, 33, 2);
+  end
+
+  % 34: add entry (bit) check
+  try
+    gd_add_bit(D, 'new7', 'in', 13, 12, 0);
+  catch exc
+    ne = ne + check_ok2(exc, 34, 1);
+  end
+
+  try
+    d = gd_entry(D, 'new7');
+    ne = ne + check_string2(34, 1, d.field, 'new7');
+    ne = ne + check_num2(34, 2, d.field_type, GD.BIT_ENTRY);
+    ne = ne + check_num2(34, 3, d.fragment_index, 0);
+    ne = ne + check_string2(34, 4, d.in_fields, 'in');
+    ne = ne + check_num2(34, 5, d.bitnum, 13);
+    ne = ne + check_num2(34, 6, d.numbits, 12);
+  catch exc
+    ne = ne + check_ok2(exc, 34, 2);
+  end
+
+  % 35: add entry (sbit) check
+  try
+    gd_add_sbit(D, 'new8', 'in', 14, 15, 0);
+  catch exc
+    ne = ne + check_ok2(exc, 35, 1);
+  end
+
+  try
+    d = gd_entry(D, 'new8');
+    ne = ne + check_string2(35, 1, d.field, 'new8');
+    ne = ne + check_num2(35, 2, d.field_type, GD.SBIT_ENTRY);
+    ne = ne + check_num2(35, 3, d.fragment_index, 0);
+    ne = ne + check_string2(35, 4, d.in_fields, 'in');
+    ne = ne + check_num2(35, 5, d.bitnum, 14);
+    ne = ne + check_num2(35, 6, d.numbits, 15);
+  catch exc
+    ne = ne + check_ok2(exc, 35, 2);
+  end
+
+  % 36: add entry (mult) check
+  try
+    gd_add_multiply(D, 'new9', 'in1', 'in2', 0);
+  catch exc
+    ne = ne + check_ok2(exc, 36, 1);
+  end
+
+  try
+    d = gd_entry(D, 'new9');
+    ne = ne + check_string2(36, 1, d.field, 'new9');
+    ne = ne + check_num2(36, 2, d.field_type, GD.MULTIPLY_ENTRY);
+    ne = ne + check_num2(36, 3, d.fragment_index, 0);
+    ne = ne + check_sarray2(36, 4, d.in_fields, { 'in1'; 'in2'; });
+  catch exc
+    ne = ne + check_ok2(exc, 36, 2);
+  end
+
+  % 37: add entry (phase) check
+  try
+    gd_add_phase(D, 'new10', 'in1', 22, 0);
+  catch exc
+    ne = ne + check_ok2(exc, 37, 1);
+  end
+
+  try
+    d = gd_entry(D, 'new10');
+    ne = ne + check_string2(37, 1, d.field, 'new10');
+    ne = ne + check_num2(37, 2, d.field_type, GD.PHASE_ENTRY);
+    ne = ne + check_num2(37, 3, d.fragment_index, 0);
+    ne = ne + check_string2(37, 4, d.in_fields, 'in1');
+    ne = ne + check_num2(37, 5, d.shift, 22);
+  catch exc
+    ne = ne + check_ok2(exc, 37, 2);
+  end
+
+  % 38: add entry (const) check
+  try
+    gd_add_const(D, 'new11', GD.COMPLEX128, 2.6, 0);
+  catch exc
+    ne = ne + check_ok2(exc, 38, 1);
+  end
+
+  try
+    d = gd_entry(D, 'new11');
+    ne = ne + check_string2(38, 1, d.field, 'new11');
+    ne = ne + check_num2(38, 2, d.field_type, GD.CONST_ENTRY);
+    ne = ne + check_num2(38, 3, d.fragment_index, 0);
+    ne = ne + check_num2(38, 5, d.const_type, GD.COMPLEX128);
+  catch exc
+    ne = ne + check_ok2(exc, 38, 2);
+  end
+
+  try
+    d = gd_get_constant(D, 'new11', GD.FLOAT64);
+    ne = ne + check_num2(38, 6, d, 2.6);
+  catch exc
+    ne = ne + check_ok2(exc, 38, 3);
+  end
+
+  % 39: fragmentname
+  try
+    d = gd_fragmentname(D, 0);
+    ne = ne + check_eostring(39, d, 'dirfile/format');
+  catch exc
+    ne = ne + check_ok(exc, 39);
+  end
+
+  % 40: nfragments
+  try
+    d = gd_nfragments(D);
+    ne = ne + check_num(40, d, 1);
+  catch exc
+    ne = ne + check_ok(exc, 40);
+  end
+
+  % 41: include
+  try
+    d = gd_include(D, 'form2', 0, 0);
+    ne = ne + check_num2(41, 1, d, 1);
+  catch exc
+    ne = ne + check_ok2(exc, 41, 1);
+  end
+
+  try
+    d = gd_get_constant(D, 'const2');
+    ne = ne + check_num2(41, 2, d, -19);
+  catch exc
+    ne = ne + check_ok2(exc, 41, 2);
+  end
+
+  % 42: nfields_by_type
+  try
+    d = gd_nfields_by_type(D, GD.LINCOM_ENTRY);
+    ne = ne + check_num(42, d, 2);
+  catch exc
+    ne = ne + check_ok(exc, 42);
+  end
+
+  % 43: field_list_by_type
+  try
+    d = gd_field_list_by_type(D, GD.LINCOM_ENTRY);
+    ne = ne + check_sarray(43, d, { 'lincom', 'new2' });
+  catch exc
+    ne = ne + check_ok(exc, 43);
+  end
+
+  % 44: nfields_by_type
+  try
+    d = gd_nvectors(D);
+    ne = ne + check_num(44, d, 22);
+  catch exc
+    ne = ne + check_ok(exc, 44);
+  end
+
+  % 45: vector_list check
+  try
+    d = gd_vector_list(D);
+    ne = ne + check_sarray(45, d, ...
+    {'INDEX'; 'alias'; 'bit'; 'data'; 'div'; 'lincom'; 'linterp'; 'mplex'; ...
+    'mult'; 'new1'; 'new10'; 'new2'; 'new5'; 'new6'; 'new7'; 'new8'; 'new9'; ...
+    'phase'; 'polynom'; 'recip'; 'sbit'; 'window'});
+  catch exc
+    ne = ne + check_ok(exc, 45);
+  end
+
+  % 46: madd entry (lincom) check
+  try
+    gd_madd_lincom(D, 'data', 'mnew1', { 'in1'; 'in2' }, [9.9, 7.7], ...
+    [8.8, 6.6]);
+  catch exc
+    ne = ne + check_ok2(exc, 46, 1);
+  end
+
+  try
+    d = gd_entry(D, 'data/mnew1');
+    ne = ne + check_string2(46, 1, d.field, 'data/mnew1');
+    ne = ne + check_num2(46, 2, d.field_type, GD.LINCOM_ENTRY);
+    ne = ne + check_num2(46, 3, d.fragment_index, 0);
+    ne = ne + check_sarray2(46, 4, d.in_fields, { 'in1'; 'in2' });
+    ne = ne + check_array2(46, 5, d.m, [ 9.9, 7.7 ]);
+    ne = ne + check_array2(46, 6, d.b, [ 8.8, 6.6 ]);
+  catch exc
+    ne = ne + check_ok2(exc, 46, 2);
+  end
+
+  % 49: madd polynom check
+  try
+    gd_madd_polynom(D, 'data', 'mnew4', 'in1', [3.9, 4.8, 5.7, ...
+    complex(6.6,7.5)]);
+  catch exc
+    ne = ne + check_ok2(exc, 49, 1);
+  end
+
+  try
+    d = gd_entry(D, 'data/mnew4');
+    ne = ne + check_string2(49, 1, d.field, 'data/mnew4');
+    ne = ne + check_num2(49, 2, d.field_type, GD.POLYNOM_ENTRY);
+    ne = ne + check_num2(49, 3, d.fragment_index, 0);
+    ne = ne + check_string2(49, 4, d.in_fields, 'in1');
+    ne = ne + check_array2(49, 5, d.a, [3.9, 4.8, 5.7, complex(6.6,7.5)]);
+  catch exc
+    ne = ne + check_ok2(exc, 49, 2);
+  end
+
+  % 50: add entry (linterp) check
+  try
+    gd_madd_linterp(D, 'data', 'mnew6', 'in', './some/table');
+  catch exc
+    ne = ne + check_ok2(exc, 50, 1);
+  end
+
+  try
+    d = gd_entry(D, 'data/mnew6');
+    ne = ne + check_string2(50, 1, d.field, 'data/mnew6');
+    ne = ne + check_num2(50, 2, d.field_type, GD.LINTERP_ENTRY);
+    ne = ne + check_num2(50, 3, d.fragment_index, 0);
+    ne = ne + check_string2(50, 4, d.in_fields, 'in');
+    ne = ne + check_string2(50, 5, d.table, './some/table');
+  catch exc
+    ne = ne + check_ok2(exc, 50, 2);
+  end
+
+  % 51: add entry (bit) check
+  try
+    gd_madd_bit(D, 'data', 'mnew7', 'in', 13, 12);
+  catch exc
+    ne = ne + check_ok2(exc, 51, 1);
+  end
+
+  try
+    d = gd_entry(D, 'data/mnew7');
+    ne = ne + check_string2(51, 1, d.field, 'data/mnew7');
+    ne = ne + check_num2(51, 2, d.field_type, GD.BIT_ENTRY);
+    ne = ne + check_num2(51, 3, d.fragment_index, 0);
+    ne = ne + check_string2(51, 4, d.in_fields, 'in');
+    ne = ne + check_num2(51, 5, d.bitnum, 13);
+    ne = ne + check_num2(51, 6, d.numbits, 12);
+  catch exc
+    ne = ne + check_ok2(exc, 34, 2);
+  end
+
+  % 52: add entry (sbit) check
+  try
+    gd_madd_sbit(D, 'data', 'mnew8', 'in', 14, 15);
+  catch exc
+    ne = ne + check_ok2(exc, 52, 1);
+  end
+
+  try
+    d = gd_entry(D, 'data/mnew8');
+    ne = ne + check_string2(52, 1, d.field, 'data/mnew8');
+    ne = ne + check_num2(52, 2, d.field_type, GD.SBIT_ENTRY);
+    ne = ne + check_num2(52, 3, d.fragment_index, 0);
+    ne = ne + check_string2(52, 4, d.in_fields, 'in');
+    ne = ne + check_num2(52, 5, d.bitnum, 14);
+    ne = ne + check_num2(52, 6, d.numbits, 15);
+  catch exc
+    ne = ne + check_ok2(exc, 52, 2);
+  end
+
+  % 53: add entry (mult) check
+  try
+    gd_madd_multiply(D, 'data', 'mnew9', 'in1', 'in2');
+  catch exc
+    ne = ne + check_ok2(exc, 53, 1);
+  end
+
+  try
+    d = gd_entry(D, 'data/mnew9');
+    ne = ne + check_string2(53, 1, d.field, 'data/mnew9');
+    ne = ne + check_num2(53, 2, d.field_type, GD.MULTIPLY_ENTRY);
+    ne = ne + check_num2(53, 3, d.fragment_index, 0);
+    ne = ne + check_sarray2(53, 4, d.in_fields, { 'in1'; 'in2'; });
+  catch exc
+    ne = ne + check_ok2(exc, 53, 2);
+  end
+
+  % 54: add entry (phase) check
+  try
+    gd_madd_phase(D, 'data', 'mnew10', 'in1', 22);
+  catch exc
+    ne = ne + check_ok2(exc, 54, 1);
+  end
+
+  try
+    d = gd_entry(D, 'data/mnew10');
+    ne = ne + check_string2(54, 1, d.field, 'data/mnew10');
+    ne = ne + check_num2(54, 2, d.field_type, GD.PHASE_ENTRY);
+    ne = ne + check_num2(54, 3, d.fragment_index, 0);
+    ne = ne + check_string2(54, 4, d.in_fields, 'in1');
+    ne = ne + check_num2(54, 5, d.shift, 22);
+  catch exc
+    ne = ne + check_ok2(exc, 54, 2);
+  end
+
+  % 55: madd entry (const) check
+  try
+    gd_madd_const(D, 'data', 'mnew11', GD.FLOAT64, 2.6);
+  catch exc
+    ne = ne + check_ok2(exc, 55, 1);
+  end
+
+  try
+    d = gd_entry(D, 'data/mnew11');
+    ne = ne + check_string2(55, 1, d.field, 'data/mnew11');
+    ne = ne + check_num2(55, 2, d.field_type, GD.CONST_ENTRY);
+    ne = ne + check_num2(55, 3, d.fragment_index, 0);
+    ne = ne + check_num2(55, 5, d.const_type, GD.FLOAT64);
+  catch exc
+    ne = ne + check_ok2(exc, 55, 2);
+  end
+
+  try
+    d = gd_get_constant(D, 'data/mnew11');
+    ne = ne + check_num2(55, 6, d, 2.6);
+  catch exc
+    ne = ne + check_ok2(exc, 55, 3);
+  end
+
+  % 56: get_string
+  try
+    d = gd_get_string(D, 'string');
+    ne = ne + check_string(56, d, 'Zaphod Beeblebrox');
+  catch exc
+    ne = ne + check_ok(exc, 56);
+  end
+
+  % 57: add string
+  try
+    gd_add_string(D, 'new12', '---string---', 0);
+  catch exc
+    ne = ne + check_ok2(exc, 57, 1);
+  end
+
+  try
+    d = gd_entry(D, 'new12');
+    ne = ne + check_string2(57, 1, d.field, 'new12');
+    ne = ne + check_num2(57, 2, d.field_type, GD.STRING_ENTRY);
+    ne = ne + check_num2(57, 3, d.fragment_index, 0);
+  catch exc
+    ne = ne + check_ok2(exc, 57, 2);
+  end
+
+  try
+    d = gd_get_string(D, 'new12');
+    ne = ne + check_string(57, d, '---string---');
+  catch exc
+    ne = ne + check_ok(exc, 57);
+  end
+
+  % 58: madd string
+  try
+    gd_madd_string(D, 'data', 'mnew12', '---mstring---');
+  catch exc
+    ne = ne + check_ok2(exc, 58, 1);
+  end
+
+  try
+    d = gd_entry(D, 'data/mnew12');
+    ne = ne + check_string2(58, 1, d.field, 'data/mnew12');
+    ne = ne + check_num2(58, 2, d.field_type, GD.STRING_ENTRY);
+    ne = ne + check_num2(58, 3, d.fragment_index, 0);
+  catch exc
+    ne = ne + check_ok2(exc, 58, 2);
+  end
+
+  try
+    d = gd_get_string(D, 'data/mnew12');
+    ne = ne + check_string(58, d, '---mstring---');
+  catch exc
+    ne = ne + check_ok(exc, 58);
+  end
+
+  % 59: add_spec
+  try
+    gd_add_spec(D, 'lorem STRING "Lorem ipsum"', 0);
+  catch exc
+    ne = ne + check_ok2(exc, 59, 1);
+  end
+
+  try
+    d = gd_get_string(D, 'lorem');
+    ne = ne + check_string(59, d, 'Lorem ipsum');
+  catch exc
+    ne = ne + check_ok2(exc, 59, 2);
+  end
+
+  % 60: madd_spec
+  try
+    gd_madd_spec(D, 'ipsum STRING "dolor sit amet."', 'lorem');
+  catch exc
+    ne = ne + check_ok2(exc, 60, 1);
+  end
+
+  try
+    d = gd_get_string(D, 'lorem/ipsum');
+    ne = ne + check_string(60, d, 'dolor sit amet.');
+  catch exc
+    ne = ne + check_ok2(exc, 60, 2);
+  end
+
+  % 61: put_constant
+  try
+    gd_put_constant(D, 'const', 61);
+  catch exc
+    ne = ne + check_ok2(exc, 61, 1);
+  end
+
+  try
+    d = gd_get_constant(D, 'const');
+    ne = ne + check_num2(61, 6, d, 61);
+  catch exc
+    ne = ne + check_ok2(exc, 61, 2);
+  end
+
+  % 133: put_constant
+  try
+    gd_put_constant(D, 'new11', complex(133,134));
+  catch exc
+    ne = ne + check_ok2(exc, 133, 1);
+  end
+
+  try
+    d = gd_get_constant(D, 'new11');
+    ne = ne + check_num2(133, 6, d, complex(133,134));
+  catch exc
+    ne = ne + check_ok2(exc, 133, 2);
+  end
+
+  % 62: put_string
+  try
+    gd_put_string(D, 'string', 'Arthur Dent');
+  catch exc
+    ne = ne + check_ok2(exc, 62, 1);
+  end
+
+  try
+    d = gd_get_string(D, 'string');
+    ne = ne + check_string(62, d, 'Arthur Dent');
+  catch exc
+    ne = ne + check_ok2(exc, 62, 2);
+  end
+
+  % 63: nmfields_by_type
+  try
+    d = gd_nmfields_by_type(D, 'data', GD.LINCOM_ENTRY);
+    ne = ne + check_num(63, d, 1);
+  catch exc
+    ne = ne + check_ok(exc, 63);
+  end
+
+  % 64: mfield_list_by_type
+  try
+    d = gd_mfield_list_by_type(D, 'data', GD.LINCOM_ENTRY);
+    ne = ne + check_sarray(64, d, {'mnew1'});
+  catch exc
+    ne = ne + check_ok(exc, 64);
+  end
+
+  % 65: nmvectors
+  try
+    d = gd_nmvectors(D, 'data');
+    ne = ne + check_num(65, d, 8);
+  catch exc
+    ne = ne + check_ok(exc, 65);
+  end
+
+  % 66: mvector_list
+  try
+    d = gd_mvector_list(D, 'data');
+    ne = ne + check_sarray(66, d, {'mlut', 'mnew1', 'mnew4', 'mnew6', ...
+    'mnew7', 'mnew8', 'mnew9', 'mnew10'});
+  catch exc
+    ne = ne + check_ok(exc, 66);
+  end
+
+  % 67: gd_alter_raw
+  try
+    gd_alter_raw(D, 'new1', GD.INT32, 4, 0);
+  catch exc
+    ne = ne + check_ok2(exc, 67, 1);
+  end
+
+  try
+    d = gd_entry(D, 'new1');
+    ne = ne + check_string2(67, 1, d.field, 'new1');
+    ne = ne + check_num2(67, 2, d.field_type, GD.RAW_ENTRY);
+    ne = ne + check_num2(67, 3, d.fragment_index, 0);
+    ne = ne + check_num2(67, 4, d.data_type, GD.INT32);
+    ne = ne + check_num2(67, 4, d.spf, 4);
+  catch exc
+    ne = ne + check_ok2(exc, 67, 2);
+  end
+
+  % 68: gd_alter_lincom
+  try
+    gd_alter_lincom(D, 'new2', {'in4'; 0; 'in6'}, [ 0.99, 11, 1.96 ], ...
+    [ 7.8, 0.022, 0 ]);
+  catch exc
+    ne = ne + check_ok2(exc, 68, 1);
+  end
+
+  try
+    d = gd_entry(D, 'new2');
+    ne = ne + check_string2(68, 1, d.field, 'new2');
+    ne = ne + check_num2(68, 2, d.field_type, GD.LINCOM_ENTRY);
+    ne = ne + check_num2(68, 3, d.fragment_index, 0);
+    ne = ne + check_sarray2(68, 4, d.in_fields, { 'in4'; 'in2'; 'in6' });
+    ne = ne + check_array2(68, 5, d.m, [ 0.99, 11, 1.96 ]);
+    ne = ne + check_array2(68, 6, d.b, [ 7.8, 0.022, 0 ]);
+  catch exc
+    ne = ne + check_ok2(exc, 68, 2);
+  end
+
+  % 70: gd_alter_polynom
+  try
+    gd_alter_polynom(D, 'new5', 0, [ 1.1, 1.2, 1.3, 1.4, 1.5 ]);
+  catch exc
+    ne = ne + check_ok2(exc, 70, 1);
+  end
+
+  try
+    d = gd_entry(D, 'new5');
+    ne = ne + check_string2(70, 1, d.field, 'new5');
+    ne = ne + check_num2(70, 2, d.field_type, GD.POLYNOM_ENTRY);
+    ne = ne + check_num2(70, 3, d.fragment_index, 0);
+    ne = ne + check_string2(70, 4, d.in_fields, 'in1');
+    ne = ne + check_array2(70, 5, d.a, [1.1, 1.2, 1.3, 1.4, 1.5]);
+  catch exc
+    ne = ne + check_ok2(exc, 70, 2);
+  end
+
+  % 72: gd_alter_linterp
+  try
+    gd_alter_linterp(D, 'new6', 'in3', 0, 0);
+  catch exc
+    ne = ne + check_ok2(exc, 72, 1);
+  end
+
+  try
+    d = gd_entry(D, 'new6');
+    ne = ne + check_string2(72, 1, d.field, 'new6');
+    ne = ne + check_num2(72, 2, d.field_type, GD.LINTERP_ENTRY);
+    ne = ne + check_num2(72, 3, d.fragment_index, 0);
+    ne = ne + check_string2(72, 4, d.in_fields, 'in3');
+    ne = ne + check_string2(72, 5, d.table, './some/table');
+  catch exc
+    ne = ne + check_ok2(exc, 72, 2);
+  end
+
+  % 73: gd_alter_bit
+  try
+    gd_alter_bit(D, 'new7', 'in3', 3, 0);
+  catch exc
+    ne = ne + check_ok2(exc, 73, 1);
+  end
+
+  try
+    d = gd_entry(D, 'new7');
+    ne = ne + check_string2(73, 1, d.field, 'new7');
+    ne = ne + check_num2(73, 2, d.field_type, GD.BIT_ENTRY);
+    ne = ne + check_num2(73, 3, d.fragment_index, 0);
+    ne = ne + check_string2(73, 4, d.in_fields, 'in3');
+    ne = ne + check_num2(73, 5, d.bitnum, 3);
+    ne = ne + check_num2(73, 6, d.numbits, 12);
+  catch exc
+    ne = ne + check_ok2(exc, 73, 2);
+  end
+
+  % 74: gd_alter_sbit
+  try
+    gd_alter_sbit(D, 'new8', 'in3', 3, 9);
+  catch exc
+    ne = ne + check_ok2(exc, 74, 1);
+  end
+
+  try
+    d = gd_entry(D, 'new8');
+    ne = ne + check_string2(74, 1, d.field, 'new8');
+    ne = ne + check_num2(74, 2, d.field_type, GD.SBIT_ENTRY);
+    ne = ne + check_num2(74, 3, d.fragment_index, 0);
+    ne = ne + check_string2(74, 4, d.in_fields, 'in3');
+    ne = ne + check_num2(74, 5, d.bitnum, 3);
+    ne = ne + check_num2(74, 6, d.numbits, 9);
+  catch exc
+    ne = ne + check_ok2(exc, 74, 2);
+  end
+
+  % 75: gd_alter_multiply
+  try
+    gd_alter_multiply(D, 'new9', 'in6', 0);
+  catch exc
+    ne = ne + check_ok2(exc, 75, 1);
+  end
+
+  try
+    d = gd_entry(D, 'new9');
+    ne = ne + check_string2(75, 1, d.field, 'new9');
+    ne = ne + check_num2(75, 2, d.field_type, GD.MULTIPLY_ENTRY);
+    ne = ne + check_num2(75, 3, d.fragment_index, 0);
+    ne = ne + check_sarray2(75, 4, d.in_fields, { 'in6'; 'in2'; });
+  catch exc
+    ne = ne + check_ok2(exc, 75, 2);
+  end
+
+  % 76: alter phase
+  try
+    gd_alter_phase(D, 'new10', 'in2', 23);
+  catch exc
+    ne = ne + check_ok2(exc, 76, 1);
+  end
+
+  try
+    d = gd_entry(D, 'new10');
+    ne = ne + check_string2(76, 1, d.field, 'new10');
+    ne = ne + check_num2(76, 2, d.field_type, GD.PHASE_ENTRY);
+    ne = ne + check_num2(76, 3, d.fragment_index, 0);
+    ne = ne + check_string2(76, 4, d.in_fields, 'in2');
+    ne = ne + check_num2(76, 5, d.shift, 23);
+  catch exc
+    ne = ne + check_ok2(exc, 76, 2);
+  end
+
+  % 77: atler const
+  try
+    gd_alter_const(D, 'new11', GD.FLOAT64);
+  catch exc
+    ne = ne + check_ok2(exc, 77, 1);
+  end
+
+  try
+    d = gd_entry(D, 'new11');
+    ne = ne + check_string2(77, 1, d.field, 'new11');
+    ne = ne + check_num2(77, 2, d.field_type, GD.CONST_ENTRY);
+    ne = ne + check_num2(77, 3, d.fragment_index, 0);
+    ne = ne + check_num2(77, 5, d.const_type, GD.FLOAT64);
+  catch exc
+    ne = ne + check_ok2(exc, 77, 2);
+  end
+
+  % 78: gd_encoding
+  try
+    d = gd_encoding(D, 0);
+    ne = ne + check_num(78, d, GD.UNENCODED);
+  catch exc
+    ne = ne + check_ok(exc, 78);
+  end
+
+  % 79: gd_encoding
+  try
+    d = gd_endianness(D, 0);
+    ne = ne + check_num(79, d, GD.LITTLE_ENDIAN + GD.NOT_ARM_ENDIAN);
+  catch exc
+    ne = ne + check_ok(exc, 79);
+  end
+
+  % 80: dirfilename
+  try
+    d = gd_dirfilename(D);
+    ne = ne + check_eostring(80, d, 'dirfile');
+  catch exc
+    ne = ne + check_ok(exc, 80);
+  end
+
+  % 81: gd_parent_fragment
+  try
+    d = gd_parent_fragment(D, 1);
+    ne = ne + check_num(81, d, 0);
+  catch exc
+    ne = ne + check_ok(exc, 81);
+  end
+
+  % 82: gd_alter_protection
+  try
+    gd_alter_protection(D, 0, GD.PROTECT_DATA);
+  catch exc
+    ne = ne + check_ok(exc, 82);
+  end
+
+  % 83: gd_protection
+  try
+    d = gd_protection(D, 0);
+    ne = ne + check_num(83, d, GD.PROTECT_DATA);
+  catch exc
+    ne = ne + check_ok(exc, 83);
+  end
+
+  % 84: gd_raw_filename
+  try
+    d = gd_raw_filename(D, 'data');
+    ne = ne + check_eostring(84, d, 'dirfile/data');
+  catch exc
+    ne = ne + check_ok(exc, 84);
+  end
+
+  % 85: gd_reference
+  try
+    d = gd_reference(D);
+    ne = ne + check_string2(85, 1, d, 'data');
+  catch exc
+    ne = ne + check_ok2(exc, 85, 1);
+  end
+
+  try
+    d = gd_reference(D, 'new1');
+    ne = ne + check_string2(85, 2, d, 'new1');
+  catch exc
+    ne = ne + check_ok2(exc, 85, 2);
+  end
+
+  % 87: gd_alter_encoding
+  try
+    gd_alter_encoding(D, GD.SLIM_ENCODED, 1, 0);
+  catch exc
+    ne = ne + check_ok(exc, 87);
+  end
+
+  % 88: gd_alter_endiannness
+  try
+    gd_alter_endianness(D, GD.BIG_ENDIAN, 1, 0);
+  catch exc
+    ne = ne + check_ok(exc, 88);
+  end
+
+  % 89: gd_alter_spec
+  try
+    gd_alter_spec(D, 'new10 PHASE in5 3', 0);
+  catch exc
+    ne = ne + check_ok2(exc, 89, 1);
+  end
+
+  try
+    d = gd_entry(D, 'new10');
+    ne = ne + check_string2(89, 1, d.field, 'new10');
+    ne = ne + check_num2(89, 2, d.field_type, GD.PHASE_ENTRY);
+    ne = ne + check_num2(89, 3, d.fragment_index, 0);
+    ne = ne + check_string2(89, 4, d.in_fields, 'in5');
+    ne = ne + check_num2(89, 5, d.shift, 3);
+  catch exc
+    ne = ne + check_ok2(exc, 89, 2);
+  end
+
+  % 90: gd_delete
+  try
+    gd_delete(D, 'new10', 0);
+  catch exc
+    ne = ne + check_ok2(exc, 90, 1);
+  end
+
+  try
+    d = gd_entry(D, 'new10');
+  catch exc
+    ne = ne + check_exc2(exc, 90, 2, 'BadCode');
+  end
+
+  % 91: gd_malter_spec
+  try
+    gd_malter_spec(D, 'mnew10 PHASE in4 11', 'data', 0);
+  catch exc
+    ne = ne + check_ok2(exc, 91, 1);
+  end
+
+  try
+    d = gd_entry(D, 'data/mnew10');
+    ne = ne + check_string2(91, 1, d.field, 'data/mnew10');
+    ne = ne + check_num2(91, 2, d.field_type, GD.PHASE_ENTRY);
+    ne = ne + check_num2(91, 3, d.fragment_index, 0);
+    ne = ne + check_string2(91, 4, d.in_fields, 'in4');
+    ne = ne + check_num2(91, 5, d.shift, 11);
+  catch exc
+    ne = ne + check_ok2(exc, 91, 2);
+  end
+
+  % 92: move
+  try
+    gd_move(D, 'new9', 1, 0);
+  catch exc
+    ne = ne + check_ok2(exc, 92, 1);
+  end
+
+  try
+    d = gd_fragment_index(D, 'new9');
+    ne = ne + check_num(92, d, 1);
+  catch exc
+    ne = ne + check_ok2(exc, 92, 2);
+  end
+
+  % 93: rename
+  try
+    gd_rename(D, 'new9', 'newer', 0);
+  catch exc
+    ne = ne + check_ok2(exc, 93, 1);
+  end
+
+  try
+    d = gd_fragment_index(D, 'newer');
+    ne = ne + check_num(93, d, 1);
+  catch exc
+    ne = ne + check_ok2(exc, 93, 2);
+  end
+
+  % 94: unclude
+  try
+    gd_uninclude(D, 1, 0);
+  catch exc
+    ne = ne + check_ok2(exc, 94, 1);
+  end
+
+  try
+    d = gd_nfragments(D);
+    ne = ne + check_num(94, d, 1);
+  catch exc
+    ne = ne + check_ok2(exc, 94, 2);
+  end
+
+  % 95: frameoffset
+  try
+    d = gd_frameoffset(D, 0);
+    ne = ne + check_num(95, d, 0);
+  catch exc
+    ne = ne + check_ok(exc, 95);
+  end
+
+  % 96: alter_frameoffset
+  try
+    gd_alter_frameoffset(D, 33, 0, 0);
+  catch exc
+    ne = ne + check_ok2(exc, 96, 1);
+  end
+
+  try
+    d = gd_frameoffset(D, 0);
+    ne = ne + check_num(96, d, 33);
+  catch exc
+    ne = ne + check_ok2(exc, 96, 2);
+  end
+
+  % 97: native_type
+  try
+    d = gd_native_type(D, 'data');
+    ne = ne + check_num(97, d, GD.INT8);
+  catch exc
+    ne = ne + check_ok(exc, 97);
+  end
+
+  % 99: validate
+  try
+    d = gd_validate(D, 'new7');
+  catch exc
+    ne = ne + check_exc(exc, 99, 'BadCode');
+  end
+
+  % 100: framenum
+  try
+    gd_reference(D, 'data');
+    d = gd_framenum(D, 'data', 33.3);
+    ne = ne + check_num(100, d, 37.1625);
+  catch exc
+    ne = ne + check_ok(exc, 100);
+  end
+
+  % 101: framenum_subset
+  try
+    d = gd_framenum(D, 'data', 33.3, 6);
+    ne = ne + check_num(101, d, 37.1625);
+  catch exc
+    ne = ne + check_ok(exc, 101);
+  end
+
+  % 86: gd_eof
+  try
+    d = gd_eof(D, 'lincom');
+    ne = ne + check_num(86, d, 345);
+  catch exc
+    ne = ne + check_ok(exc, 86);
+  end
+
+  % 142: gd_bof
+  try
+    d = gd_bof(D, 'lincom');
+    ne = ne + check_num(142, d, 264);
+  catch exc
+    ne = ne + check_ok(exc, 142);
+  end
+
+  % 143: entry (div) check
+  try
+    d = gd_entry(D, 'div');
+    ne = ne + check_string2(143, 1, d.field, 'div');
+    ne = ne + check_num2(143, 2, d.field_type, GD.DIVIDE_ENTRY);
+    ne = ne + check_num2(143, 3, d.fragment_index, 0);
+    ne = ne + check_sarray2(143, 4, d.in_fields, { 'mult'; 'bit'; });
+  catch exc
+    ne = ne + check_ok(exc, 143);
+  end
+
+  % 145: entry (recip) check
+  try
+    d = gd_entry(D, 'recip');
+    ne = ne + check_string2(145, 1, d.field, 'recip');
+    ne = ne + check_num2(145, 2, d.field_type, GD.RECIP_ENTRY);
+    ne = ne + check_num2(145, 3, d.fragment_index, 0);
+    ne = ne + check_num2(145, 4, d.dividend, complex(6.5,4.3));
+  catch exc
+    ne = ne + check_ok(exc, 145);
+  end
+
+  % 146: add entry (mult) check
+  try
+    gd_add_divide(D, 'new14', 'in1', 'in2', 0);
+  catch exc
+    ne = ne + check_ok2(exc, 146, 1);
+  end
+
+  try
+    d = gd_entry(D, 'new14');
+    ne = ne + check_string2(146, 1, d.field, 'new14');
+    ne = ne + check_num2(146, 2, d.field_type, GD.DIVIDE_ENTRY);
+    ne = ne + check_num2(146, 3, d.fragment_index, 0);
+    ne = ne + check_sarray2(146, 4, d.in_fields, { 'in1'; 'in2'; });
+  catch exc
+    ne = ne + check_ok2(exc, 146, 2);
+  end
+
+  % 148: add entry (recip) check
+  try
+    gd_add_recip(D, 'new16', 'in3', 33.3, 0);
+  catch exc
+    ne = ne + check_ok2(exc, 148, 1);
+  end
+
+  try
+    d = gd_entry(D, 'new16');
+    ne = ne + check_string2(148, 1, d.field, 'new16');
+    ne = ne + check_num2(148, 2, d.field_type, GD.RECIP_ENTRY);
+    ne = ne + check_num2(148, 3, d.fragment_index, 0);
+    ne = ne + check_string2(148, 4, d.in_fields, 'in3');
+    ne = ne + check_num2(148, 3, d.dividend, 33.3);
+  catch exc
+    ne = ne + check_ok2(exc, 148, 2);
+  end
+
+  % 149: madd entry (div) check
+  try
+    gd_madd_divide(D, 'data', 'mnew14', 'in1', 'in2');
+  catch exc
+    ne = ne + check_ok2(exc, 149, 1);
+  end
+
+  try
+    d = gd_entry(D, 'data/mnew14');
+    ne = ne + check_string2(149, 1, d.field, 'data/mnew14');
+    ne = ne + check_num2(149, 2, d.field_type, GD.DIVIDE_ENTRY);
+    ne = ne + check_num2(149, 3, d.fragment_index, 0);
+    ne = ne + check_sarray2(149, 4, d.in_fields, { 'in1'; 'in2'; });
+  catch exc
+    ne = ne + check_ok2(exc, 149, 2);
+  end
+
+  % 151: madd entry (recip) check
+  try
+    gd_madd_recip(D, 'data', 'mnew16', 'in1', complex(5.5,6.6));
+  catch exc
+    ne = ne + check_ok2(exc, 151, 1);
+  end
+
+  try
+    d = gd_entry(D, 'data/mnew16');
+    ne = ne + check_string2(151, 1, d.field, 'data/mnew16');
+    ne = ne + check_num2(151, 2, d.field_type, GD.RECIP_ENTRY);
+    ne = ne + check_num2(151, 3, d.fragment_index, 0);
+    ne = ne + check_string2(151, 4, d.in_fields, 'in1');
+    ne = ne + check_num2(151, 5, d.dividend, complex(5.5,6.6));
+  catch exc
+    ne = ne + check_ok2(exc, 151, 2);
+  end
+
+  % 155: rewrite_fragment
+  try
+    gd_rewrite_fragment(D, 0);
+  catch exc
+    ne = ne + check_ok(exc, 155);
+  end
+
+  % 156: invalid_dirfile
+  try
+    d = gd_invalid_dirfile();
+  catch exc
+    ne = ne + check_ok(exc, 156);
+  end
+
+  try
+    gd_discard(d);
+  catch
+    [];
+  end
+
+  % 157: standards
+  try
+    d = gd_dirfile_standards(D);
+    ne = ne + check_num(157, d, GD.DIRFILE_STANDARDS_VERSION);
+  catch exc
+    ne = ne + check_ok2(exc, 157, 1);
+  end
+
+  try
+    d = gd_dirfile_standards(D, 0);
+  catch exc
+    ne = ne + check_exc2(exc, 157, 2, 'Argument');
+  end
+
+  % 158: get_carray
+  try
+    d = gd_get_carray(D, 'carray');
+    ne = ne + check_array(158, d, [1.1, 2.2, 3.3, 4.4, 5.5, 6.6]);
+  catch exc
+    ne = ne + check_ok(exc, 158);
+  end
+
+  % 159: gd_carray_slice
+  try
+    d = gd_get_carray_slice(D, 'carray', 2, 2);
+    ne = ne + check_array(159, d, [3.3, 4.4]);
+  catch exc
+    ne = ne + check_ok(exc, 159);
+  end
+
+  % 167: gd_carrays
+  try
+    d = gd_carrays(D);
+    ne = ne + check_num(167, length(d), 1);
+    ne = ne + check_array(167, d{1}, [1.1, 2.2, 3.3, 4.4, 5.5, 6.6]);
+  catch exc
+    ne = ne + check_ok(exc, 167);
+  end
+
+  % 168: gd_put_carray
+  try
+    gd_put_carray(D, 'carray', [9,8,7,6,5,4]);
+  catch exc
+    ne = ne + check_ok2(exc, 168, 1);
+  end
+
+  try
+    d = gd_get_carray(D, 'carray');
+    ne = ne + check_array(168, d, [9,8,7,6,5,4]);
+  catch exc
+    ne = ne + check_ok2(exc, 168, 2);
+  end
+
+  % 169: gd_put_carray
+  try
+    gd_put_carray_slice(D, 'carray', 2, [169,169]);
+  catch exc
+    ne = ne + check_ok2(exc, 169, 1);
+  end
+
+  try
+    d = gd_get_carray(D, 'carray');
+    ne = ne + check_array(169, d, [9,8,169,169,5,4]);
+  catch exc
+    ne = ne + check_ok2(exc, 169, 2);
+  end
+
+  % 177: gd_carray_len
+  try
+    d = gd_carray_len(D, 'carray');
+    ne = ne + check_num(177, d, 6);
+  catch exc
+    ne = ne + check_ok(exc, 177);
+  end
+
+  % 178: gd_entry (carray)
+  try
+    d = gd_entry(D, 'carray');
+    ne = ne + check_string2(178, 1, d.field, 'carray');
+    ne = ne + check_num2(178, 2, d.field_type, GD.CARRAY_ENTRY);
+    ne = ne + check_num2(178, 3, d.fragment_index, 0);
+    ne = ne + check_num2(178, 4, d.const_type, GD.FLOAT64);
+    ne = ne + check_num2(178, 4, d.array_len, 6);
+  catch exc
+    ne = ne + check_ok(exc, 178);
+  end
+
+  % 179: add_carray
+  try
+    gd_add_carray(D, 'new17', GD.FLOAT64, [1.1,2.2,3.3,4.4], 0);
+  catch exc
+    ne = ne + check_ok2(exc, 179, 1);
+  end
+
+  try
+    d = gd_entry(D, 'new17');
+    ne = ne + check_string2(179, 1, d.field, 'new17');
+    ne = ne + check_num2(179, 2, d.field_type, GD.CARRAY_ENTRY);
+    ne = ne + check_num2(179, 3, d.fragment_index, 0);
+    ne = ne + check_num2(179, 4, d.const_type, GD.FLOAT64);
+    ne = ne + check_num2(179, 4, d.array_len, 4);
+  catch exc
+    ne = ne + check_ok2(exc, 179, 2);
+  end
+
+  try
+    d = gd_get_carray(D, 'new17');
+    ne = ne + check_array(179, d, [1.1,2.2,3.3,4.4]);
+  catch exc
+    ne = ne + check_ok2(exc, 179, 3);
+  end
+
+  % 180: add_carray
+  try
+    gd_madd_carray(D, 'data', 'mnew17', GD.FLOAT64, [1.8, 18.0]);
+  catch exc
+    ne = ne + check_ok2(exc, 180, 1);
+  end
+
+  try
+    d = gd_entry(D, 'data/mnew17');
+    ne = ne + check_string2(180, 1, d.field, 'data/mnew17');
+    ne = ne + check_num2(180, 2, d.field_type, GD.CARRAY_ENTRY);
+    ne = ne + check_num2(180, 3, d.fragment_index, 0);
+    ne = ne + check_num2(180, 4, d.const_type, GD.FLOAT64);
+    ne = ne + check_num2(180, 4, d.array_len, 2);
+  catch exc
+    ne = ne + check_ok2(exc, 180, 2);
+  end
+
+  try
+    d = gd_get_carray(D, 'data/mnew17');
+    ne = ne + check_array(180, d, [1.8, 18.0]);
+  catch exc
+    ne = ne + check_ok2(exc, 180, 3);
+  end
+
+  % 181: add_carray
+  try
+    gd_alter_carray(D, 'new17', GD.INT32, 5);
+  catch exc
+    ne = ne + check_ok2(exc, 181, 1);
+  end
+
+  try
+    d = gd_entry(D, 'new17');
+    ne = ne + check_string2(181, 1, d.field, 'new17');
+    ne = ne + check_num2(181, 2, d.field_type, GD.CARRAY_ENTRY);
+    ne = ne + check_num2(181, 3, d.fragment_index, 0);
+    ne = ne + check_num2(181, 4, d.const_type, GD.INT32);
+    ne = ne + check_num2(181, 4, d.array_len, 5);
+  catch exc
+    ne = ne + check_ok2(exc, 181, 2);
+  end
+
+  try
+    d = gd_get_carray(D, 'new17');
+    ne = ne + check_array(181, d, [1,2,3,4,0]);
+  catch exc
+    ne = ne + check_ok2(exc, 181, 3);
+  end
+
+  % 183: gd_constants
+  try
+    d = gd_constants(D);
+    ne = ne + check_array(183, d, [61, 133]);
+  catch exc
+    ne = ne + check_ok(exc, 183);
+  end
+
+  % 191: gd_mconstants
+  try
+    d = gd_mconstants(D, 'data');
+    ne = ne + check_array(191, d, [3.3, 2.6]);
+  catch exc
+    ne = ne + check_ok(exc, 191);
+  end
+
+  % 199: gd_strings
+  try
+    d = gd_strings(D);
+    ne = ne + check_sarray(199, d, {'Lorem ipsum'; '---string---'; ...
+    'Arthur Dent'});
+  catch exc
+    ne = ne + check_ok(exc, 199);
+  end
+
+  % 200: gd_mstrings
+  try
+    d = gd_mstrings(D, 'data');
+    ne = ne + check_sarray(200, d, {'This is a string constant.'; ...
+    '---mstring---'});
+  catch exc
+    ne = ne + check_ok(exc, 200);
+  end
+
+  % 203: seek
+  try
+    d = gd_seek(D, 'data', 35, 0, GD.SEEK_SET);
+    ne = ne + check_num(203, d, 280);
+  catch exc
+    ne = ne + check_ok2(exc, 203, 1);
+  end
+
+  try
+    d = gd_getdata(D, 'data', GD.HERE, 0, 1, 0);
+    ne = ne + check_array(203, d, [16:1:23]);
+  catch exc
+    ne = ne + check_ok2(exc, 203, 2);
+  end
+
+  % 204: tell
+  try
+    d = gd_tell(D, 'data');
+    ne = ne + check_num(204, d, 288);
+  catch exc
+    ne = ne + check_ok(exc, 204);
+  end
+
+  % 205: hide
+  try
+    gd_hide(D, 'data');
+  catch exc
+    ne = ne + check_ok(exc, 205);
+  end
+
+  % 206: hidden
+  try
+    d = gd_hidden(D, 'data');
+    ne = ne + check_num(206, d, 1);
+  catch exc
+    ne = ne + check_ok(exc, 206);
+  end
+
+  % 207: unhide
+  try
+    gd_unhide(D, 'data');
+  catch exc
+    ne = ne + check_ok2(exc, 207, 1);
+  end
+
+  try
+    d = gd_hidden(D, 'data');
+    ne = ne + check_num(207, d, 0);
+  catch exc
+    ne = ne + check_ok2(exc, 207, 2);
+  end
+
+  % 208: sync
+  try
+    gd_sync(D, 'data');
+  catch exc
+    ne = ne + check_ok(exc, 208);
+  end
+
+  % 209: sync
+  try
+    gd_flush(D, 'data');
+  catch exc
+    ne = ne + check_ok(exc, 209);
+  end
+
+  % 210: metaflush
+  try
+    gd_metaflush(D);
+  catch exc
+    ne = ne + check_ok(exc, 210);
+  end
+
+  % 211: gd_entry (window)
+  try
+    d = gd_entry(D, 'window');
+    ne = ne + check_string2(211, 1, d.field, 'window');
+    ne = ne + check_num2(211, 2, d.field_type, GD.WINDOW_ENTRY);
+    ne = ne + check_num2(211, 3, d.fragment_index, 0);
+    ne = ne + check_sarray2(211, 4, d.in_fields, { 'linterp'; 'mult' });
+    ne = ne + check_num2(211, 5, d.windop, GD.WINDOP_LT);
+    ne = ne + check_num2(211, 6, d.threshold, 4.1);
+  catch exc
+    ne = ne + check_ok(exc, 211);
+  end
+
+  % 212: gd_add_window
+  try
+    gd_add_window(D, 'new18', 'in1', 'in2', GD.WINDOP_NE, 32, 0);
+  catch exc
+    ne = ne + check_ok2(exc, 212, 1);
+  end
+
+  try
+    d = gd_entry(D, 'new18');
+    ne = ne + check_string2(212, 1, d.field, 'new18');
+    ne = ne + check_num2(212, 2, d.field_type, GD.WINDOW_ENTRY);
+    ne = ne + check_num2(212, 3, d.fragment_index, 0);
+    ne = ne + check_sarray2(212, 4, d.in_fields, { 'in1'; 'in2' });
+    ne = ne + check_num2(212, 5, d.windop, GD.WINDOP_NE);
+    ne = ne + check_num2(212, 6, d.threshold, 32);
+  catch exc
+    ne = ne + check_ok2(exc, 212, 2);
+  end
+
+  % 214: gd_add_window
+  try
+    gd_madd_window(D, 'data', 'mnew18', 'in1', 'in2', GD.WINDOP_EQ, 214);
+  catch exc
+    ne = ne + check_ok2(exc, 214, 1);
+  end
+
+  try
+    d = gd_entry(D, 'data/mnew18');
+    ne = ne + check_string2(214, 1, d.field, 'data/mnew18');
+    ne = ne + check_num2(214, 2, d.field_type, GD.WINDOW_ENTRY);
+    ne = ne + check_num2(214, 3, d.fragment_index, 0);
+    ne = ne + check_sarray2(214, 4, d.in_fields, { 'in1'; 'in2' });
+    ne = ne + check_num2(214, 5, d.windop, GD.WINDOP_EQ);
+    ne = ne + check_num2(214, 6, d.threshold, 214);
+  catch exc
+    ne = ne + check_ok2(exc, 214, 2);
+  end
+
+  % 217: gd_alter_window
+  try
+    gd_alter_window(D, 'new18', 'in3', 0, GD.WINDOP_GE, 32e2);
+  catch exc
+    ne = ne + check_ok2(exc, 217, 1);
+  end
+
+  try
+    d = gd_entry(D, 'new18');
+    ne = ne + check_string2(217, 1, d.field, 'new18');
+    ne = ne + check_num2(217, 2, d.field_type, GD.WINDOW_ENTRY);
+    ne = ne + check_num2(217, 3, d.fragment_index, 0);
+    ne = ne + check_sarray2(217, 4, d.in_fields, { 'in3'; 'in2' });
+    ne = ne + check_num2(217, 5, d.windop, GD.WINDOP_GE);
+    ne = ne + check_num2(217, 6, d.threshold, 32e2);
+  catch exc
+    ne = ne + check_ok2(exc, 217, 2);
+  end
+
+  % 218: gd_alias_target
+  try
+    d = gd_alias_target(D, 'alias');
+    ne = ne + check_string(218, d, 'data');
+  catch exc
+    ne = ne + check_ok(exc, 218);
+  end
+
+  % 219: gd_add_alias
+  try
+    gd_add_alias(D, 'new20', 'data', 0);
+  catch exc
+    ne = ne + check_ok2(exc, 219, 1);
+  end
+
+  try
+    d = gd_alias_target(D, 'new20');
+    ne = ne + check_string(219, d, 'data');
+  catch exc
+    ne = ne + check_ok2(exc, 219, 2);
+  end
+
+  % 220: madd_alias
+  try
+    gd_madd_alias(D, 'data', 'mnew20', 'data');
+  catch exc
+    ne = ne + check_ok2(exc, 219, 1);
+  end
+
+  try
+    d = gd_alias_target(D, 'data/mnew20');
+    ne = ne + check_string(219, d, 'data');
+  catch exc
+    ne = ne + check_ok2(exc, 219, 2);
+  end
+
+  % 221: naliases
+  try
+    d = gd_naliases(D, 'data');
+    ne = ne + check_num(221, d, 4);
+  catch exc
+    ne = ne + check_ok(exc, 221);
+  end
+
+  % 222: aliases
+  try
+    d = gd_aliases(D, 'data');
+    ne = ne + check_sarray(222, d, {'data'; 'alias'; 'data/mnew20'; 'new20'});
+  catch exc
+    ne = ne + check_ok(exc, 222);
+  end
+
+  % 223: include_affix
+  try
+    gd_include(D, 'format1', 0, GD.CREAT + GD.EXCL, 'A', 'Z');
+  catch exc
+    ne = ne + check_ok2(exc, 41, 1);
+  end
+
+  % 224: move_alias
+  try
+    gd_move_alias(D, 'new20', 1);
+  catch exc
+    ne = ne + check_ok2(exc, 224, 1);
+  end
+
+  try
+    d = gd_fragment_index(D, 'Anew20Z');
+    ne = ne + check_num(224, d, 1);
+  catch exc
+    ne = ne + check_ok2(exc, 224, 2);
+  end
+
+  % 225: delete_alias
+  try
+    gd_delete_alias(D, 'Anew20Z');
+  catch exc
+    ne = ne + check_ok2(exc, 225, 1);
+  end
+
+  try
+    d = gd_fragment_index(D, 'Anew20Z');
+  catch exc
+    ne = ne + check_exc2(exc, 225, 2, 'BadCode');
+  end
+
+  % 226: fragment_affixes
+  try
+    d = gd_fragment_affixes(D, 1);
+    ne = ne + check_sarray(226, d, {'A'; 'Z'});
+  catch exc
+    ne = ne + check_ok(exc, 226);
+  end
+
+  % 227: alter_affixes
+  try
+    gd_alter_affixes(D, 1, 'B', '');
+  catch exc
+    ne = ne + check_ok2(exc, 227, 1);
+  end
+
+  try
+    d = gd_fragment_affixes(D, 1);
+    ne = ne + check_sarray(226, d, {'B'; ''});
+  catch exc
+    ne = ne + check_ok2(exc, 227, 2);
+  end
+
+  % 228: gd_entry (mplex)
+  try
+    d = gd_entry(D, 'mplex');
+    ne = ne + check_string2(228, 1, d.field, 'mplex');
+    ne = ne + check_num2(228, 2, d.field_type, GD.MPLEX_ENTRY);
+    ne = ne + check_num2(228, 3, d.fragment_index, 0);
+    ne = ne + check_sarray2(228, 4, d.in_fields, { 'data'; 'sbit' });
+    ne = ne + check_num2(228, 5, d.count_val, 1);
+    ne = ne + check_num2(228, 6, d.period, 10);
+  catch exc
+    ne = ne + check_ok(exc, 228);
+  end
+
+  % 229: gd_add_mplex
+  try
+    gd_add_mplex(D, 'new21', 'in1', 'in2', 5, 6, 0);
+  catch exc
+    ne = ne + check_ok2(exc, 229, 1);
+  end
+
+  try
+    d = gd_entry(D, 'new21');
+    ne = ne + check_string2(229, 1, d.field, 'new21');
+    ne = ne + check_num2(229, 2, d.field_type, GD.MPLEX_ENTRY);
+    ne = ne + check_num2(229, 3, d.fragment_index, 0);
+    ne = ne + check_sarray2(229, 4, d.in_fields, { 'in1'; 'in2' });
+    ne = ne + check_num2(229, 5, d.count_val, 5);
+    ne = ne + check_num2(229, 6, d.period, 6);
+  catch exc
+    ne = ne + check_ok2(exc, 229, 2);
+  end
+
+  % 230: gd_add_mplex
+  try
+    gd_madd_mplex(D, 'data', 'mnew21', 'in3', 'in2', 0, 12);
+  catch exc
+    ne = ne + check_ok2(exc, 230, 1);
+  end
+
+  try
+    d = gd_entry(D, 'data/mnew21');
+    ne = ne + check_string2(230, 1, d.field, 'data/mnew21');
+    ne = ne + check_num2(230, 2, d.field_type, GD.MPLEX_ENTRY);
+    ne = ne + check_num2(230, 3, d.fragment_index, 0);
+    ne = ne + check_sarray2(230, 4, d.in_fields, { 'in3'; 'in2' });
+    ne = ne + check_num2(230, 5, d.count_val, 0);
+    ne = ne + check_num2(230, 6, d.period, 12);
+  catch exc
+    ne = ne + check_ok2(exc, 230, 2);
+  end
+
+  % 231: gd_alter_mplex
+  try
+    gd_alter_mplex(D, 'new21', 'in4', 0, 3, 7);
+  catch exc
+    ne = ne + check_ok2(exc, 231, 1);
+  end
+
+  try
+    d = gd_entry(D, 'new21');
+    ne = ne + check_string2(231, 1, d.field, 'new21');
+    ne = ne + check_num2(231, 2, d.field_type, GD.MPLEX_ENTRY);
+    ne = ne + check_num2(231, 3, d.fragment_index, 0);
+    ne = ne + check_sarray2(231, 4, d.in_fields, { 'in4'; 'in2' });
+    ne = ne + check_num2(231, 5, d.count_val, 3);
+    ne = ne + check_num2(231, 6, d.period, 7);
+  catch exc
+    ne = ne + check_ok2(exc, 231, 2);
+  end
+
+  % 232: gd_strtok
+  try
+    d = gd_strtok(D, '"test1 test2" test3\ test4');
+    ne = ne + check_sarray(232, d, {'test1 test2'; 'test3 test4'});
+  catch exc
+    ne = ne + check_ok(exc, 232);
+  end
+
+  % 233: raw_close
+  try
+    gd_raw_close(D, 'data');
+  catch exc
+    ne = ne + check_ok(exc, 233);
+  end
+
+  % 234: desync
+  try
+    d = gd_desync(D);
+    ne = ne + check_num(234, d, 0);
+  catch exc
+    ne = ne + check_ok(exc, 234);
+  end
+
+  % 235: gd_flags
+  try
+    d = gd_flags(D, GD.PRETTY_PRINT, 0);
+    ne = ne + check_num(235, d, GD.PRETTY_PRINT);
+  catch exc
+    ne = ne + check_ok(exc, 235);
+  end
+
+  % 236: gd_verbose_prefix
+  try
+    gd_verbose_prefix(D, 'big_test: ');
+  catch exc
+    ne = ne + check_ok(exc, 236);
+  end
+
+  % 237: gd_nentries
+  try
+    d = gd_nentries(D, 'data', GD.SCALAR_ENTRIES, ...
+    GD.ENTRIES_HIDDEN + GD.ENTRIES_NOALIAS);
+    ne = ne + check_num(237, d, 6);
+  catch exc
+    ne = ne + check_ok(exc, 237);
+  end
+
+  % 239: gd_nentries
+  try
+    d = gd_entry_list(D, 'data', GD.SCALAR_ENTRIES, ...
+    GD.ENTRIES_HIDDEN + GD.ENTRIES_NOALIAS);
+    ne = ne + check_sarray(239, d, {'mstr', 'mconst', 'mcarray', 'mnew11', ...
+    'mnew12', 'mnew17'});
+  catch exc
+    ne = ne + check_ok(exc, 239);
+  end
+
+  % 240: gd_mplex_lookback
+  try
+    gd_mplex_lookback(D, GD.LOOKBACK_ALL);
+  catch exc
+    ne = ne + check_ok(exc, 240);
+  end
+
+  % 241: gd_linterp_tablename
+  try
+    d = gd_linterp_tablename(D, 'linterp');
+    ne = ne + check_eostring(241, d, 'dirfile/lut');
+  catch exc
+    ne = ne + check_ok(exc, 241);
+  end
+
+  % 242: gd_carrays
+  try
+    d = gd_mcarrays(D, 'data');
+    ne = ne + check_num2(242, 1, length(d), 2);
+    ne = ne + check_array2(242, 2, d{1}, [1.9, 2.8, 3.7, 4.6, 5.5]);
+    ne = ne + check_array2(242, 3, d{2}, [1.8, 18.0]);
+  catch exc
+    ne = ne + check_ok(exc, 242);
+  end
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+  gd_discard(D);
+  rmdir(filedir, 's');
+  if ne > 0
+    ne
+    fail;
+  end
+
+catch exc
+  disp(exc.getReport);
+  disp('Stack:');
+  disp(struct2cell(transpose(exc.stack)));
+  fail
+end
+end
+
+% hackery
+function fail
+  fid=fopen('test_failed', 'w');
+  fclose(fid);
+  exit force
+end
+
+% pretty-print an array
+function str = pp_array(a)
+  str = ['[ ', num2str(a), ' ]'];
+end
+
+function str = pp_sarray(a)
+  str = '[';
+  for i = 1:length(a)
+    if (isnumeric(a{i}))
+      str = strcat(str, sprintf(' %s', num2str(a{i})));
+    else
+      str = strcat(str, sprintf(' %s', a{i}));
+    end
+  end
+  str = strcat(str, ' ]');
+end
+
+% Check functions
+
+function ne = check_ok(exc, t)
+  if (isempty(strmatch('GetData:', exc.identifier)))
+    rethrow(exc);
+  end
+  fprintf(2, 'e[%i] = %s\n', t, exc.identifier);
+  disp(exc.getReport);
+  ne = 1;
+end
+
+function ne = check_ok2(exc, t, m)
+  if (isempty(strmatch('GetData:', exc.identifier)))
+    rethrow(exc);
+  end
+  fprintf(2, 'e[%i,%i] = %s\n', t, m, exc.identifier);
+  disp(exc.getReport);
+  ne = 1;
+end
+
+function ne = check_exc(exc, t, v)
+  if (isempty(strmatch('GetData:', exc.identifier)))
+    rethrow(exc);
+  end
+  ne = check_string(t,exc.identifier,strcat('GetData:Lib:', v));
+end
+
+function ne = check_exc2(exc, t, m, v)
+  if (isempty(strmatch('GetData:', exc.identifier)))
+    rethrow(exc);
+  end
+  ne = check_string2(t,m,exc.identifier,strcat('GetData:Lib:', v));
+end
+
+function ne = check_eostring(t,v,g)
+  l = length(v);
+  f = l - length(g) + 1;
+  if (strcmp(v(f:l), g) == 0)
+    fprintf(2, 's[%i] = [...]''%s'', expected [...]''%s''\n', t, v(f:l), g);
+    ne = 1;
+  else
+    ne = 0;
+  end
+end
+function ne = check_string(t,v,g)
+  if (strcmp(v, g) == 0)
+    fprintf(2, 's[%i] = ''%s'', expected ''%s''\n', t, v, g);
+    ne = 1;
+  else
+    ne = 0;
+  end
+end
+
+function ne = check_string2(t,m,v,g)
+  if (strcmp(v, g) == 0)
+    fprintf(2, 's[%i,%i] = ''%s'', expected ''%s''\n', t, m, v, g);
+    ne = 1;
+  else
+    ne = 0;
+  end
+end
+
+function ne = check_sarray(t,v,g)
+  same = 1;
+  if (length(v) ~= length(g))
+    same = 0;
+  else
+    for i = 1:length(v)
+      if (isnumeric(v{i}) ~= isnumeric(g{i}))
+        same = 0;
+      elseif (isnumeric(v{i}))
+        if (v{i} ~= g{i})
+          same = 0;
+        end
+      elseif (strcmp(v{i},g{i}) == 0)
+        same = 0;
+      end
+    end
+  end
+  if (~same)
+    fprintf(2, 's[%i] = %s, expected %s\n', t, pp_sarray(v), pp_sarray(g));
+    ne = 1;
+  else
+    ne = 0;
+  end
+end
+
+function ne = check_sarray2(t,m,v,g)
+  same = 1;
+  if (length(v) ~= length(g))
+    same = 0;
+  else
+    for i = 1:length(v)
+      if (isnumeric(v{i}) ~= isnumeric(g{i}))
+        same = 0;
+      elseif (isnumeric(v{i}))
+        if (v{i} ~= g{i})
+          same = 0;
+        end
+      elseif (strcmp(v{i},g{i}) == 0)
+        same = 0;
+      end
+    end
+  end
+  if (~same)
+    fprintf(2, 's[%i,%i] = %s, expected %s\n', t, m, pp_sarray(v), ...
+      pp_sarray(g));
+    ne = 1;
+  else
+    ne = 0;
+  end
+end
+
+function ne = check_array(t,v,g)
+  if (~isequal(v,g))
+    fprintf(2, 'a[%i] = %s, expected %s\n', t, pp_array(v), pp_array(g));
+    ne = 1;
+  else
+    ne = 0;
+  end
+end
+
+function ne = check_array2(t,m,v,g)
+  if (~isequal(v,g))
+    fprintf(2, 'a[%i,%i] = %s, expected %s\n', t, m, pp_array(v), pp_array(g));
+    ne = 1;
+  else
+    ne = 0;
+  end
+end
+
+function ne = check_num(t,v,g)
+  if (v ~= g)
+    fprintf(2, 'n[%i] = %s, expected %s\n', t, num2str(v), num2str(g));
+    ne = 1;
+  else
+    ne = 0;
+  end
+end
+
+function ne = check_num2(t,m,v,g)
+  if (v ~= g)
+    fprintf(2, 'n[%i,%i] = %s, expected %s\n', t, m, num2str(v), num2str(g));
+    ne = 1;
+  else
+    ne = 0;
+  end
+end
diff --git a/bindings/matlab/test/test.sh b/bindings/matlab/test/test.sh
new file mode 100755
index 0000000..1aa0192
--- /dev/null
+++ b/bindings/matlab/test/test.sh
@@ -0,0 +1,10 @@
+#!/bin/sh
+s=`basename $2 .m`
+rm -f ./test_failed
+$1 -nodesktop -nodisplay -nosplash -nojvm -r "$s; quit;"
+
+#lame
+if test -e ./test_failed; then
+  rm -f ./test_failed
+  exit 1
+fi
diff --git a/bindings/perl/Build.PL.in b/bindings/perl/Build.PL.in
new file mode 100644
index 0000000..8bc6450
--- /dev/null
+++ b/bindings/perl/Build.PL.in
@@ -0,0 +1,57 @@
+# Copyright (C) 2011-2013 D. V. Wiebe
+#
+##########################################################################
+#
+# This file is part of the GetData project.
+#
+# GetData is free software; you can redistribute it and/or modify it under
+# the terms of the GNU Lesser General Public License as published by the
+# Free Software Foundation; either version 2.1 of the License, or (at your
+# option) any later version.
+#
+# GetData is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+#
+# @configure_input@
+
+use Module::Build;
+
+# divert up_to_date to allow consideration of various other dependencies
+my $class = Module::Build->subclass(
+  class => "GetData::Build",
+  code => <<'SUBCLASS' );
+
+sub up_to_date {
+  my ($self, $source, $derived) = @_;
+
+  if ($source eq "lib/GetData.xs") {
+    return 0 if (not $self->up_to_date("lib/typemap", $derived));
+    return 0 if (not $self->up_to_date("lib/simple_funcs.xs", $derived));
+    return 0 if (not $self->up_to_date("@top_builddir@/src/getdata.h",
+      $derived));
+    return 0 if (not $self->up_to_date("@top_builddir@/src/internal.h",
+      $derived));
+  }
+  return $self->SUPER::up_to_date($source, $derived);
+}
+SUBCLASS
+
+my $build = $class->new(
+  dist_abstract => "Perl bindings to the GetData library",
+  dist_author => 'The GetData Project <@PACKAGE_BUGREPORT@>',
+  dist_version_from => "GetData.pm",
+  extra_compiler_flags => ['@DEFS@', '-I at top_builddir@/src'],
+  extra_linker_flags => ['-L at top_builddir@/src/.libs/', '-lgetdata'],
+  include_dirs => ['@top_srcdir@/src'],
+  license => 'lgpl',
+  module_name => "GetData",
+  pm_files => { 'GetData.pm' => 'lib/GetData.pm' },
+  release_status => "testing",
+  requires => {
+    perl => '5.6.0',
+    'Math::Complex' => '1.34'
+  },
+  test_files => '@srcdir@/t/*.t',
+  xs_files => { 'lib/GetData.xs' => 'lib/GetData.xs' }
+);
+$build->create_build_script;
diff --git a/bindings/perl/GetData.pm.in b/bindings/perl/GetData.pm.in
new file mode 100644
index 0000000..94aed87
--- /dev/null
+++ b/bindings/perl/GetData.pm.in
@@ -0,0 +1,1239 @@
+# Copyright (C) 2011 D. V. Wiebe
+#
+##########################################################################
+#
+# This file is part of the GetData project.
+#
+# GetData is free software; you can redistribute it and/or modify it under
+# the terms of the GNU Lesser General Public License as published by the
+# Free Software Foundation; either version 2.1 of the License, or (at your
+# option) any later version.
+#
+# GetData is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+# License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public License
+# along with GetData; if not, write to the Free Software Foundation, Inc.,
+# 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+#
+package GetData;
+
+use 5.00800;
+use strict;
+use warnings;
+
+require Exporter;
+require XSLoader;
+require Math::Complex;
+
+our @ISA = qw(Exporter);
+our %EXPORT_TAGS = ('all' => [qw(VERSION @FUNCLIST@ @PARAMLIST@)],
+'constants' => [qw(VERSION @PARAMLIST@)], 'functions' => [qw(@FUNCLIST@)]);
+
+our @EXPORT_OK = (@{$EXPORT_TAGS{'all'}});
+our @EXPORT = qw();
+
+ at PARAMETERS@
+
+XSLoader::load('GetData', $VERSION);
+
+1;
+__END__
+
+=head1 NAME
+
+GetData - Perl bindings to the GetData library for Dirfile access
+
+=head1 SYNOPSIS
+
+  use GetData;
+
+  my $DIRFILE = GetData::open("./dirfile/", $GetData::RDONLY);
+
+  # the following calls are equivalent
+  my $data = GetData::getdata($DIRFILE, "field", 5, 0, 1,
+                              $GetData::UINT8);
+  my $data = $DIRFILE->getdata("field", 5, 0, 1, $GetData::UINT8);
+
+=head1 DESCRIPTION
+
+This module provides simple, lightweight bindings from Perl to the C GetData
+library.  It provides a simple mapping between public C functions and Perl
+methods.  All C functions and constants are replicated in the GetData package.
+These methods have the same name as their C counterparts, excluding the C
+namespace prefix `gd_' (or `GD_', for C preprocessor constants).
+
+The dirfile lvalue returned by GetData::open is a simplistic object.  Any
+GetData method which takes a dirfile as a parameter, may instead be called as
+method of the dirfile object itself.  (See the synopsis above for an example.)
+Dirfile metadata entries (which are C structs of type gd_entry_t) are
+represented as simple hashes.
+
+By default, GetData does not export any symbols.  All symbols in the GetData
+package may be exported with:
+
+  use GetData "all";
+
+but this is discouraged, as it will overwrite useful things like &CORE::open.
+
+Throughout the module, complex data are generally represented as
+C<Math::Complex> objects, but may be simplified to ordinary floating point
+numbers if the imaginary part is zero.
+
+=head1 CONSTANTS
+
+The module defines a large number of symbolic constants used by the API which
+mirror the constants defined in the C API.  The "constants" tag may be used to
+export just the constants from the module, if desired.  Some genericly useful
+sets of constants are discussed below.  Other constants are discussed in the
+method descriptions where they are used.
+
+=head2 Data Types
+
+GetData knows the following data types:
+
+=over
+
+=item $GetData::NULL
+
+the null data type, which returns no data.
+
+=item $GetData::UINT8
+
+unsigned 8-bit integer
+
+=item $GetData::INT8
+
+signed (two's complement) 8-bit integer
+
+=item $GetData::UINT16
+
+unsigned 16-bit integer
+
+=item $GetData::INT16
+
+signed (two's complement) 16-bit integer
+
+=item $GetData::UINT32
+
+unsigned 32-bit integer
+
+=item $GetData::INT32
+
+signed (two's complement) 32-bit integer
+
+=item $GetData::UINT64
+
+unsigned 64-bit integer
+
+=item $GetData::INT64
+
+signed (two's complement) 64-bit integer
+
+=item $GetData::FLOAT32
+
+IEEE-754 standard 32-bit single precision floating point number
+
+=item $GetData::FLOAT64
+
+IEEE-754 standard 64-bit double precision floating point number
+
+=item $GetData::COMPLEX64
+
+FORTRAN and C99 conformant 64-bit single precision floating point complex number
+
+=item $GetData::COMPLEX128
+
+FORTRAN and C99 conformant 128-bit double precision floating point complex
+number
+
+=back
+
+=head2 Encoding Types
+
+The following encoding types are known by GetData:
+
+=over
+
+$GetData::BZIP2_ENCODED,
+$GetData::GZIP_ENCODED,
+$GetData::LZMA_ENCODED,
+$GetData::SIE_ENCODED,
+$GetData::SLIM_ENCODED,
+$GetData::TEXT_ENCODED,
+$GetData::ZZIP_ENCODED,
+$GetData::ZZSLIM_ENCODED,
+$GetData::UNENCODED.
+
+=back
+
+Details of these encoding types are given in the dirfile-format(5) manual page.
+
+=head2 Entry Types
+
+The following symbols are used to indicate entry types:
+
+=over
+
+$GetData::NO_ENTRY,
+$GetData::BIT_ENTRY,
+$GetData::CARRAY_ENTRY,
+$GetData::CONST_ENTRY,
+$GetData::DIVIDE_ENTRY,
+$GetData::INDEX_ENTRY,
+$GetData::LINCOM_ENTRY,
+$GetData::LINTERP_ENTRY,
+$GetData::MPLEX_ENTRY,
+$GetData::MULTIPLY_ENTRY,
+$GetData::PHASE_ENTRY,
+$GetData::POLYNOM_ENTRY,
+$GetData::RAW_ENTRY,
+$GetData::RECIP_ENTRY,
+$GetData::SBIT_ENTRY,
+$GetData::STRING_ENTRY,
+$GetData::WINDOW_ENTRY
+
+=back
+
+Of these, C<$GetData::NO_ENTRY> is used to flag invalid entry types and
+C<$GetData::INDEX_ENTRY> is used only for the implicit B<INDEX> field.  See
+gd_entry(3) and dirfile-format(5) for details of the other entry types.
+
+=head2 WINDOW Operators
+
+The following symbols are used to indicate WINDOW operators:
+
+=over
+
+$GetData::WINDOP_EQ,
+$GetData::WINDOP_GE,
+$GetData::WINDOP_GT,
+$GetData::WINDOP_LE,
+$GetData::WINDOP_LT,
+$GetData::WINDOP_NE,
+$GetData::WINDOP_CLR,
+$GetData::WINDOP_SET.
+
+=back
+
+=head1 INPUT DATA
+
+Functions which take sets of data as input (L<add_carray>, L<madd_carray>,
+L<put_carray>, L<put_carray_slice>, and L<putdata>) accept data in a number of
+ways.  The arguments specifying the data always appear at the end of the
+argument list.  They are represented as C<{DATA...}> in the method descriptions
+below.  Input data arguments are parsed as follows.
+
+=over
+
+=item 1.
+
+If the first data argument is undef, then it is ignored and all subsequent
+arguments are taken as data:
+
+    $dirfile->putdata("field_code", $first_frame, $first_sample,
+                      undef, @data)
+
+or
+
+    $dirfile->putdata("field_code", $first_frame, $first_sample,
+                      undef, $data[0], $data[1], $data[2], ...)
+
+=item 2.
+
+Otherwise, if the first data argument is a reference to an array, the array is
+taken as data (and any further arguments are ignored):
+
+    $dirfile->putdata("field_code", $first_frame, $first_sample,
+                      \@data)
+
+=item 3.
+
+Otherwise, if only two arguments make up the data argument list, and the second
+is a reference to an array, the first is taken as a type code specifing the
+conversion type, and the second is taken as the data:
+
+    $dirfile->putdata("field_code", $first_frame, $first_sample,
+                      $GetData::UINT8, \@data)
+
+=item 4.
+
+Otherwise, if only two arguments make up the data argument list, and the second
+is not a reference to an array, the first is, again, taken as a type code, and
+the second is assumed to be a packed string containing the data in a format
+appropriate for the type code specified:
+
+    $packed_data = pack("C", @data)
+    $dirfile->putdata("field_code", $first_frame, $first_sample,
+                      $GetData::UINT8, $packed_data)
+
+=item 5.
+
+Otherwise, finally, the data argument list elements are simply taken as data
+themselves:
+
+    $dirfile->putdata("field_code", $first_frame, $first_sample,
+                      @data)
+
+or
+
+    $dirfile->putdata("field_code", $first_frame, $first_sample,
+                      $data[0], $data[1], $data[2], ...)
+
+
+=back
+
+GetData internally converts the Perl data into a format readable by the C API.
+In cases 3 and 4 above, the type the data is converted into is specified
+explicitly in the call.  In the other cases, GetData must guess an appropriate
+C type into which to convert the data.  It does so by looking at the first
+data value:
+
+=over
+
+=item *
+
+if the value is a C<Math::Complex> object, the data are converted to double
+precision complex data (C<COMPLEX128>)
+
+=item *
+
+if the value is an integer, the data are converted to a 64-bit signed integer
+(C<INT64>)
+
+=item *
+
+otherwise, the data are converted to a double precision float (C<FLOAT64>).
+
+=back
+
+Of the above methods, the first is only necessary when the data array has only
+two elements, and so would be mistaken for method four if specified without the
+initial undef.  Furthermore, the fourth method is typically the most efficient,
+since the packed data scalar can often be used as the input to the C API without
+need for type conversion.
+
+=head1 ENTRY HASHES
+
+The replacement for the C<gd_entry_t> object of the C API is a simple hash.  The
+key names are the same as the names of the C<gd_entry_t> members.  (See
+gd_entry(3) for details).
+
+In entry hashes returned by GetData, only those keys appropriate for the entry
+type specified will be present.  Entry hashes passed to GetData from the caller
+may have other keys than those required by the entry type.  They will be
+ignored.
+
+The value associated with the C<field_type> key will be one of the symbols
+listed under L</"Entry Types"> above.  For entry types which have (potentially)
+more than one input field (DIVIDE, LINCOM, MPLEX, MULTIPLY, WINDOW), the value
+associated with the C<"in_fields"> key will be a list of strings, regardless of
+how many elements it has; other entry types which provide C<"in_fields"> will be
+a scalar, even though the key name is still plural.
+
+Elements of the C<scalar> array which are undef indicate literal parameters
+(equivalent to C<NULL> in the C<gd_entry_t>'s C<scalar> member).  Similarly,
+undef is used in C<scalar_ind> where the C API uses -1, to indicate CONST
+fields, instead of CARRAYs.
+
+=head1 DIRFILE CREATION METHODS
+
+=over
+
+=item open ($DIRFILENAME, $FLAGS, $SEHANDLER=undef, $EXTRA=undef)
+
+Create or open a Dirfile database called C<$DIRFILENAME>.  C<$FLAGS> should be
+either C<$GetData::RDONLY> (for read-only access) or C<$GetData::RDWR> (for
+read-write access), optionally bitwise or'd with any of the following flags:
+
+=over
+
+$GetData::ARM_ENDIAN,
+$GetData::BIG_ENDIAN,
+$GetData::CREAT,
+$GetData::EXCL,
+$GetData::FORCE_ENCODING,
+$GetData::FORCE_ENDIAN,
+$GetData::IGNORE_DUPS,
+$GetData::IGNORE_REFS,
+$GetData::LITTLE_ENDIAN,
+$GetData::NOT_ARM_ENDIAN,
+$GetData::PEDANTIC,
+$GetData::PERMISSIVE,
+$GetData::PRETTY_PRINT,
+$GetData::TRUNC,
+$GetData::TRUNCSUB,
+$GetData::VERBOSE,
+
+=back
+
+and at most one of the encoding symbols listed above in the L</"Encoding Types">
+section or else C<$GetData::AUTO_ENCODED> indicating that GetData should attempt
+to automatically determine the encoding.  The meaning of the dirfile flags
+may be found in the gd_cbopen(3) manual page.
+
+$SEHANDLER is a Perl callback function which will be executed whenever a syntax
+error is encountered.  It may be undef, if no callback is desired.  When
+called, C<$SEHANDLER> will be passed two arguments.  The first is a reference to
+a hash containing the parser data.  The second is the C<$EXTRA> scalar passed to
+this method.  C<$SEHANDLER> is called in scalar context, and should return
+either:
+
+=over
+
+=item *
+
+an integer, one of the symbolic constants:
+
+=over
+
+$GetData::SYNTAX_ABORT,
+$GetData::SYNTAX_CONTINUE,
+$GetData::SYNTAX_IGNORE,
+$GetData::SYNTAX_RESCAN;
+
+=back
+
+(see gd_cbopen(3) for their meaning), or
+
+=item *
+
+a string containing the corrected line, in which case C<$GetData::SYNTAX_RESCAN>
+is assumed; or,
+
+=item *
+
+a reference to a list consisting of an integer, one of the
+C<$GetData::SYNTAX_...> constants listed above, and then, optionally, a string
+containing the corrected line.
+
+=back
+
+This function always returns a Dirfile object, even if the call failed;
+the caller should use the returned dirfile's L<error>() method to test for
+success.  On error, the returned object will be flagged as invalid.
+
+=item invalid_dirfile ()
+
+This function always returns a newly created, but invalid, Dirfile object.
+Unlike an invalid dirfile created (either accidentally or purposefully) using
+L<open>(), the dirfile returned by this function always has a zero error code.
+See gd_invalid_dirfile(3).
+
+=back
+
+=head1 DIRFILE OBJECT METHODS
+
+The following methods all operate on a dirfile object returned by one of the
+above methods and can either be called as:
+
+  $GetData::method($dirfile, ...)
+
+or else, as
+
+  $dirfile->method(...)
+
+without change in operation.
+
+=head2 List of Methods
+
+=over
+
+=item $dirfile->add_carray ($FIELD_NAME, $DATA_TYPE, $FRAGMENT_INDEX,
+{DATA...})
+
+Adds a new CARRAY field called C<$FIELD_NAME> to the metadata fragment indexed
+by C<$FRAGMENT_INDEX>.  The storage type of the CARRAY is given by
+C<$DATA_TYPE>, which should be one of the symbols listed above under
+L</"Data Types">.  The value of the CARRAY is then set to the data given in
+the C<{DATA...}> argument list, which also determines its length.  See the
+L</"Input Data"> section above for details on the allowed forms of C<{DATA...}>.
+See gd_add_carray(3).
+
+=item $dirfile->add_const ($FIELD_NAME, $DATA_TYPE, [$VALUE, $FRAGMENT_INDEX])
+
+Adds a new CONST field called C<$FIELD_NAME> to the metadata fragment indexed
+by C<$FRAGMENT_INDEX>, or to the primary format file if omitted.  The
+C<$DATA_TYPE> argument indicates the storage type, which should be one of the
+symbols listed above under L</"Data Types">.  If given, the value of the field
+is set to C<$VALUE>, otherwise the field will be initialised to zero.  See
+gd_add_const(3).
+
+=item $dirfile->aliases ($FIELD_CODE)
+
+In scalar context, returns the number of aliases of C<$FIELD_CODE>.  In list
+context, returns an array of alias names for C<$FIELD_CODE>.  See gd_naliases(3)
+and gd_aliases(3).
+
+=item $dirfile->carrays ($RETURN_TYPE)
+
+Returns the value of all carrays (excluding metafields) in the dirfile after
+converting them to the return type C<$RETURN_TYPE>, which should be one of the
+symbols listed under L</"Data Types"> above.  If called in scalar context,
+returns a reference to an array of packed string data.  If called in list
+context, returns an array of arrays of unpacked data.  See gd_carrays(3).
+
+=item $dirfile->close ()
+
+Closes the dirfile, writing changes to disk.  Upon successful completion, the
+dirfile object will be invalidated, prohibiting further operation on it.  A
+dirfile which is destroyed by garbage collection is discarded (see L</"discard">
+below).  This function should be called if metadata need to be written to disk
+before the object goes out of scope.  See gd_close(3).
+
+=item $dirfile->constants ($RETURN_TYPE)
+
+Returns the value of all constants (excluding metafields) in the dirfile after
+converting them to the return type C<$RETURN_TYPE>, which should be one of the
+symbols listed under L</"Data Types"> above.  If called in scalar context,
+returns a packed string containing the data.  If called in list context, the
+data will be unpacked and returned as an array.  See gd_constants(3).
+
+=item $dirfile->discard ()
+
+Closes the dirfile, ignoring changes to metadata, but writing changed data to
+disk.  Upon successful completion, the dirfile object will be invalidated,
+prohibiting further operation on it.  This function is called automatically by
+the dirfile destructor, and need not be called explicitly.  To save the metadata
+on close, use L</close>.  See gd_discard(3).
+
+=item $dirfile->entry ($FIELD_CODE)
+
+If called in scalar context, returns the entry type of C<$FIELD_CODE>, one
+of the symbols listed above under L</"Entry Types">.  In array context, returns
+a hash describing the indicated field.  See gd_entry_type(3) and gd_entry(3).
+
+=item $dirfile->entry_list ($PARENT, $TYPE, $FLAGS)
+
+In scalar context, returns the number of entries matching the supplied criteria.
+In list context, returns an array of the names of the entries.  If C<$PARENT>
+is undef, top-level entries are considered, otherwise meta entries under
+C<$PARENT> are considered.  If C<$TYPE> is one of the entry types listed above
+under L</"Entry Types">, only entries of that type are considered.  Alternatley,
+C<$TYPE> may be one of:
+
+=over
+
+$GetData::ALL_ENTRIES,
+$GetData::SCALAR_ENTRIES,
+$GetData::VECTOR_ENTRIES.
+
+=back
+
+Setting C<$TYPE> to undef is equivalent to setting it to
+C<$GetData::ALL_ENTRIES>.  If not undef, which is treated as zero, C<$FLAGS>
+should be zero or more of the following flags:
+
+=over
+
+$GetData::ENTRIES_HIDDEN,
+$GetData::ENTRIES_NOALIAS.
+
+=back
+
+See gd_nentries(3) and gd_entry_list(3) for the meaning of these symbols.
+
+=item $dirfile->error ()
+
+Returns the error code of the last operation on this dirfile.  See gd_error(3).
+
+=item $dirfile->error_string ()
+
+Returns a string describing the error encountered (if any) by the last operation
+on this dirfile.  See gd_error_string(3).
+
+=item $dirfile->field_list ()
+
+Equivalent to: C<$dirfile-E<gt>entry_list(undef, undef, undef)>.
+
+=item $dirfile->field_list_by_type ($TYPE)
+
+Equivalent to: C<$dirfile-E<gt>entry_list(undef, $TYPE, undef)>.
+
+=item $dirfile->fragment_affixes ($FRAGMENT_INDEX)
+
+Returns an array containing the prefix (first) and suffix (second) of the
+fragment indexed by C<$FRAGMENT_INDEX>.  See gd_fragment_affixes(3).
+
+=item $dirfile->fragments ()
+
+In scalar context, returns the number of metadata fragments in the dirfile.
+In list context, returns an array of pathnames to the fragments on disk, in the
+order that they're indexed.  See gd_nfragments(3) and gd_fragmentname(3).
+
+=item $dirfile->get_carray ($FIELD_CODE, $RETURN_TYPE)
+
+Returns the value of the CARRAY named C<$FIELD_CODE> after converting its
+elements to the return type C<$RETURN_TYPE>, which should be one of the symbols
+listed under L</"Data Types"> above.  If called in scalar context, returns a
+packed string containing the data.  If called in list context, the data will be
+unpacked and returned as an array.  See gd_get_carray(3).
+
+=item $dirfile->get_carray_slice ($FIELD_CODE, $START, $LEN, $RETURN_TYPE)
+
+Returns the value of a portion of the CARRAY named C<$FIELD_CODE> after
+converting its elements to the return type C<$RETURN_TYPE>, which should be one
+of the symbols listed under L</"Data Types"> above.  The first element returned
+is given by C<$START>, and the number of elements by C<$LEN>.  If called in
+scalar context, returns a packed string containing the data.  If called in list
+context, the data will be unpacked and returned as an array.  Less data than
+requested may be returned, if insufficient data exists.  See
+gd_get_carray_slice(3).
+
+=item $dirfile->get_constant ($FIELD_CODE, $RETURN_TYPE)
+
+Returns the value of the CONST named C<$FIELD_CODE> after converting it to the
+return type C<$RETURN_TYPE>, which should be one of the symbols listed under
+L</"Data Types"> above.  See gd_get_constant(3).
+
+=item $dirfile->getdata ($FIELD_CODE, $FIRST_FRAME, $FIRST_SAMP, $NUM_FRAMES,
+$NUM_SAMP, $RETURN_TYPE)
+
+Returns data from the field specified by C<$FIELD_CODE> after converting them
+to the return type C<$RETURN_TYPE>, which should be one of the symbols listed
+under L</"Data Types"> above.  The first sample returned is C<$FIRST_SAMP>
+samples after the start of C<$FIRST_FRAME> and the amount of data returned is
+L<$NUM_FRAMES> frames plus L<$NUM_SAMP> samples.  If called in scalar context
+returns a string of packed data.  If called in array context, the data will be
+unpacked and returned as an array.  Complex data are returned as
+C<Math::Complex> objects.  See gd_getdata(3).
+
+=item $dirfile->get_string ($FIELD_CODE)
+
+Returns the value of the STRING named C<$FIELD_CODE>.  See gd_get_string(3).
+
+=item $dirfile->include ($FILE, $PARENT_FRAGMENT, $FLAGS, [$PREFIX, $SUFFIX])
+
+Includes the fragment metadata file C<$FILE> under the fragment indexed by
+C<$PARENT_FRAGMENT>.  C<$FLAGS> should be a bitwise or'd collection of zero or
+more of the following flags:
+
+=over
+
+$GetData::BIG_ENDIAN,
+$GetData::CREAT,
+$GetData::EXCL,
+$GetData::FORCE_ENCODING,
+$GetData::FORCE_ENDIAN,
+$GetData::IGNORE_DUPS,
+$GetData::IGNORE_REFS,
+$GetData::LITTLE_ENDIAN,
+$GetData::PEDANTIC,
+$GetData::TRUNC,
+
+=back
+
+and at most one of the encoding symbols listed above in the L</"Encoding Types">
+section or else C<$GetData::AUTO_ENCODED> indicating that GetData should attempt
+to automatically determine the encoding.  If C<$PREFIX> or C<$SUFFIX> are
+omitted or undef, the added fragment will contain no such affix.  See
+gd_include_affix(3).
+
+=item $dirfile->madd_carray ($PARENT, $FIELD_NAME, $DATA_TYPE, {DATA...})
+
+Adds a new CARRAY metafield called C<$FIELD_NAME> under the parent field
+C<$PARENT>.  The storage type of the CARRAY is given by C<$DATA_TYPE>, which
+should be one of the symbols listed above under L</"Data Types">.  The value of
+the CARRAY is then set to the data given in the C<{DATA...}> argument list,
+which also determines its length.  See the L</"Input Data"> section above for
+details on the allowed forms of C<{DATA...}>.  See gd_madd_carray(3).
+
+=item $dirfile->madd_const ($PARENT, $FIELD_NAME, $DATA_TYPE, [$VALUE])
+
+Adds a new CONST metafield called C<$FIELD_NAME> under the field C<$PARENT>.
+The C<$DATA_TYPE> argument indicates the storage type, which should be one of
+the symbols listed above under L</"Data Types">.  If given, the value of the
+field is set to C<$VALUE>, otherwise the field will be initialised to zero.
+See gd_madd_const(3).
+
+=item $dirfile->mcarrays ($PARENT, $RETURN_TYPE)
+
+Behaves analogously to L<carrays>() (I<q.v.>), but returns CARRAYs which are
+metafields under the parent specified by C<$PARENT>.
+
+=item $dirfile->mconstants ($PARENT, $RETURN_TYPE)
+
+Behaves analogously to L<constants>() (I<q.v.>), but returns CONSTs which are
+metafields under the parent specified by C<$PARENT>.
+
+=item $dirfile->mfield_list ($PARENT)
+
+Equivalent to C<$dirfile-E<gt>entry_list($PARENT, undef, undef)>.
+
+=item $dirfile->mfield_list_by_type ($PARENT, $TYPE)
+
+Equivalent to C<$dirfile-E<gt>entry_list($PARENT, $TYPE, undef)>.
+
+=item $dirfile->mstrings ($PARENT)
+
+Behaves analogously to L<strings>() (I<q.v.>), but returns STRINGs which are
+metafields under the parent specified by C<$PARENT>.
+
+=item $dirfile->mvector_list ($PARENT)
+
+Equivalent to:
+  $dirfile-E<gt>entry_list($PARENT, $GetData::VECTOR_ENTRIES, undef).
+
+=item $dirfile->parser_callback ($SEHANDLER, $EXTRA=undef)
+
+Sets the registered parser callback function for the dirfile to C<$SEHANDLER>,
+or to nothing if undef, and updates the C<$EXTRA> parameter.  See
+gd_parser_callback(3).
+
+=item $dirfile->put_carray ($FIELD_CODE, {DATA...})
+
+Sets the value of the CARRAY named C<$FIELD_CODE> to the values contained in
+the C<{DATA...}> argument list.  See the L</"Input Data"> section above for
+details on the allowed forms of C<{DATA...}>.  See gd_put_carray(3).
+
+=item $dirfile->put_carray_slice ($FIELD_CODE, $START, {DATA...})
+
+Sets a value of the portion of the CARRAY named C<$FIELD_CODE> beginning with
+element numbered C<$START> to the values contained in the C<{DATA...}> argument
+list.  See the L</"Input Data"> section above for details on the allowed forms
+of C<{DATA...}>.  See gd_put_carray_slice(3).
+
+=item $dirfile->put_constant ($FIELD_CODE, $DATUM)
+
+Sets the value of the CONST field C<$FIELD_CODE> to the value C<$DATUM>.  See
+gd_put_constant(3).
+
+=item $dirfile->putdata ($FIELD_CODE, $FIRST_FRAME, $FIRST_SAMPLE, {DATA...})
+
+Sets a portion of the vector given by C<$FIELD_CODE> to the values contained in
+the C<{DATA...}> argument list.  The first sample written is C<$FIRST_SAMPLE>
+samples after the start of C<$FIRST_FRAME>.  See the L</"Input Data"> section
+above for details on the allowed forms of C<{DATA...}>.  See gd_putdata(3).
+
+=item $dirfile->strings ()
+
+In scalar context, returns the number of STRING fields.  In list context,
+returns an array of strings containing the values of all the STRING fields.
+See gd_strings(3).
+
+=item $dirfile->strtok ($STRING)
+
+Tokenises C<$STRING>, returning an array of tokens.  See gd_strtok(3).
+
+=item $dirfile->vector_list ()
+
+Equivalent to:
+  $dirfile-E<gt>entry_list(undef, $GetData::VECTOR_ENTRIES, undef).
+
+=back
+
+=head2 Other Methods
+
+For the most part, following methods behave identically to their C API
+counterpart.  See the corresponding C API manual page for details.  Different
+behaviour, if any, is indicated.
+
+=over
+
+=item $dirfile->add ($ENTRY)
+
+C<$ENTRY> should be a reference to an entry hash; see L</"ENTRY HASHES"> above.
+
+=item $dirfile->add_alias ($FIELD_CODE, $TARGET, [$FRAGMENT_INDEX])
+
+C<$FRAGMENT_INDEX> = 0 is assumed if not specified.
+
+=item $dirfile->add_bit ($FIELD_CODE, $IN_FIELD, $BITNUM, $NUMBITS,
+[$FRAGMENT_INDEX])
+
+C<$FRAGMENT_INDEX> = 0 is assumed if not specified.
+
+=item $dirfile->add_divide ($FIELD_CODE, $IN_FIELD1, $IN_FIELD2,
+[$FRAGMENT_INDEX])
+
+C<$FRAGMENT_INDEX> = 0 is assumed if not specified.
+
+=item $dirfile->add_lincom ($FIELD_CODE, $N_FIELDS, $IN_FIELDS, $M, $B,
+[$FRAGMENT_INDEX])
+
+C<$IN_FIELDS>, C<$M>, and C<$B> should be references to arrays of the
+appropriate length.  The elements of C<$M> and C<$B> may be of any numerical
+type, including C<Math::Complex>.  C<$FRAGMENT_INDEX> = 0 is assumed if not
+specified.
+
+=item $dirfile->add_linterp ($FIELD_CODE, $IN_FIELD, $TABLE, [$FRAGMENT_INDEX])
+
+C<$FRAGMENT_INDEX> = 0 is assumed if not specified.
+
+=item $dirfile->add_mplex ($FIELD_CODE, $IN_FIELD, $COUNT_FIELD, $COUNT_VAL,
+$COUNT_MAX, [$FRAGMENT_INDEX])
+
+C<$FRAGMENT_INDEX> = 0 is assumed if not specified.
+
+=item $dirfile->add_multiply ($FIELD_CODE, $IN_FIELD1, $IN_FIELD2,
+[$FRAGMENT_INDEX])
+
+C<$FRAGMENT_INDEX> = 0 is assumed if not specified.
+
+=item $dirfile->add_phase ($FIELD_CODE, $IN_FIELD, $SHIFT, [$FRAGMENT_INDEX])
+
+C<$FRAGMENT_INDEX> = 0 is assumed if not specified.
+
+=item $dirfile->add_polynom ($FIELD_CODE, $POLY_ORD, $IN_FIELD, $A,
+[$FRAGMENT_INDEX])
+
+C<$A> should be a reference to an array of numbers (of any numerical type,
+including C<Math::Complex>) of the appropriate length.  C<$FRAGMENT_INDEX> = 0
+is assumed if not specified.
+
+=item $dirfile->add_raw ($FIELD_CODE, $DATA_TYPE, $SPF, [$FRAGMENT_INDEX])
+
+C<$DATA_TYPE> should be one of the symbols listed under L</"Data Types"> above.
+C<$FRAGMENT_INDEX> = 0 is assumed if not specified.
+
+=item $dirfile->add_recip ($FIELD_CODE, $IN_FIELD, $DIVIDEND, [$FRAGMENT_INDEX])
+
+C<$DIVIDEND> may be of any numerical type, including C<Math::Complex>.
+C<$FRAGMENT_INDEX> = 0 is assumed if not specified.
+
+=item $dirfile->add_sbit ($FIELD_CODE, $IN_FIELD, $BITNUM, $NUMBITS,
+[$FRAGMENT_INDEX])
+
+C<$FRAGMENT_INDEX> = 0 is assumed if not specified.
+
+=item $dirfile->add_spec ($LINE, [$FRAGMENT_INDEX])
+
+C<$FRAGMENT_INDEX> = 0 is assumed if not specified.
+
+=item $dirfile->add_string ($FIELD_CODE, $VALUE, [$FRAGMENT_INDEX])
+
+C<$FRAGMENT_INDEX> = 0 is assumed if not specified.
+
+=item $dirfile->add_window ($FIELD_CODE, $IN_FIELD, $CHECK_FIELD, $WINDOP,
+$THRESHOLD, [$FRAGMENT_INDEX])
+
+C<$WINDOP> should be one of the symbols listed under L</WINDOW Operators> above.
+C<$FRAGMENT_INDEX> = 0 is assumed if not specified.
+
+=item $dirfile->alias_target ($FIELD_CODE)
+
+Z<>
+
+=item $dirfile->alter_affixes ($FRAGMENT_INDEX, $PREFIX, [$SUFFIX])
+
+If C<$PREFIX> or C<$SUFFIX> are undef, or if C<$SUFFIX> is omitted, that
+affix is not changed.
+
+=item $dirfile->alter_bit ($FIELD_CODE, [$IN_FIELD, $BITNUM, $NUMBITS])
+
+Arguments not given or set to undef are not changed.
+Additionally, if C<$BITNUM == -1>, or C<$NUMBITS == 0>, that parameter is not
+changed.
+
+=item $dirfile->alter_carray ($FIELD_CODE, $CONST_TYPE, $ARRAY_LEN)
+
+C<$CONST_TYPE> should be one of the symbols listed under L</"Data Types"> above.
+
+=item $dirfile->alter_const ($FIELD_CODE, [$CONST_TYPE])
+
+If C<$CONST_TYPE> is omitted, or equal to C<$GetData::NULL>, it is not changed;
+otherwise, it should be one of the symbols listed under L</"Data Types"> above.
+
+=item $dirfile->alter_divide ($FIELD_CODE, [$IN_FIELD1, $IN_FIELD2])
+
+Arguments not given or set to undef are not changed.
+
+=item $dirfile->alter_encoding ($ENCODING, [$FRAGMENT_INDEX, $RECODE])
+
+Both C<$FRAGMENT_INDEX> and C<$RECODE> default to 0 if not given.
+
+=item $dirfile->alter_endianness ($BYTE_SEX, [$FRAGMENT_INDEX, $RECODE])
+
+Both C<$FRAGMENT_INDEX> and C<$RECODE> default to 0 if not given.
+
+=item $dirfile->alter_entry ($FIELD_CODE, $ENTRY, [$RECODE])
+
+C<$ENTRY> should be a reference to an entry hash; see L</"ENTRY HASHES"> above.
+If not given, C<$RECODE> defaults to 0.
+
+=item $dirfile->alter_frameoffset ($OFFSET, [$FRAGMENT_INDEX, $RECODE])
+
+Both C<$FRAGMENT_INDEX> and C<$RECODE> default to 0 if not given.
+
+=item $dirfile->alter_lincom ($FIELD_CODE, [$N_FIELDS, $IN_FIELDS, $M, $B])
+
+Arguments not given or set to undef are not changed.
+If given, C<$IN_FIELDS>, C<$M>, and C<$B> should be references to arrays of the
+appropriate length.
+
+=item $dirfile->alter_linterp ($FIELD_CODE, [$IN_FIELD, $TABLE, $RENAME_TABLE])
+
+Arguments not given or set to undef are not changed.
+If not given, C<$RENAME_TABLE> defaults to 0.
+
+=item $dirfile->alter_mplex ($FIELD_CODE, [$IN_FIELD, $COUNT_FIELD, $COUNT_VAL,
+$COUNT_MAX])
+
+Arguments not given or set to undef are not changed.
+Additionally, if C<$COUNT_VAL> or C<$COUNT_MAX> are -1, that parameter is not
+chaged.
+
+=item $dirfile->alter_multiply ($FIELD_CODE, [$IN_FIELD1, $IN_FIELD2])
+
+Arguments not given or set to undef are not changed.
+
+=item $dirfile->alter_phase ($FIELD_CODE, $IN_FIELD, $SHIFT)
+
+If C<$IN_FIELD == undef>, it is not changed.
+
+=item $dirfile->alter_polynom ($FIELD_CODE, [$POLY_ORD, $IN_FIELD, $A])
+
+Arguments not given or set to undef are not changed.
+Additionally, if C<$POLY_ORD == 0>, it is not changed.
+
+=item $dirfile->alter_protection ($PROTECTION_LEVEL, $FRAGMENT_INDEX)
+
+Z<>
+
+=item $dirfile->alter_raw ($FIELD_CODE, [$DATA_TYPE, $SPF, $RECODE])
+
+Arguments not given or set to undef are not changed.
+Additionally, if C<$DATA_TYPE == $GetData::NULL> or C<$SPF == 0>, that parameter
+is not changed.
+If not given, C<$RECODE> defaults to 0.
+
+=item $dirfile->alter_recip ($FIELD_CODE, [$IN_FIELD, $DIVIDEND])
+
+Arguments not given or set to undef are not changed.
+Additionally, if C<$DIVIDEND == 0>, it is not changed.
+C<$DIVIDEND> may be of any numerical type, including C<Math::Complex>.
+
+=item $dirfile->alter_sbit ($FIELD_CODE, [$IN_FIELD, $BITNUM, $NUMBITS])
+
+Arguments not given or set to undef are not changed.
+Additionally, if C<$BITNUM == -1>, or C<$NUMBITS == 0>, that parameter is not
+changed.
+
+=item $dirfile->alter_spec ($LINE, [$RECODE])
+
+If not given, C<$RECODE> defaults to 0.
+
+=item $dirfile->alter_window ($FIELD_CODE, $IN_FIELD, $CHECK_FIELD, $WINDOP,
+$THRESHOLD)
+
+If C<$IN_FIELD> or C<$CHECK_FIELD> are undef, or if C<$WINDOP ==
+$GetData::WINDOP_UNK>, that paremeter is not changed. Otherwise,
+C<$WINDOP> should be one of the symbols listed under L</WINDOW Operators> above.
+
+=item $dirfile->bof ($FIELD_CODE)
+
+Z<>
+
+=item $dirfile->carray_len ($FIELD_CODE)
+
+Z<>
+
+=item $dirfile->delete ($FIELD_CODE, [$FLAGS])
+
+If not given, C<$FLAGS> defaults to 0.  Otherwise, it should be a bitwise or'd
+collection of zero or more of the following flags:
+
+=over
+
+$GetData::DEL_DATA,
+$GetData::DEL_DEREF,
+$GetData::DEL_FORCE,
+$GetData::DEL_META.
+
+=back
+
+=item $dirfile->delete_alias ($FIELD_CODE, [$FLAGS])
+
+If not given, C<$FLAGS> defaults to 0; otherwise, see the description of
+L</delete> above for valid values.
+
+=item $dirfile->desync ([$FLAGS])
+
+If omitted, C<$FLAGS> defaults to zero.  Otherwise, it should be zero or more
+of the following flags bitwise or'd together:
+
+=over
+
+$GetData::DESYNC_PATHCHECK,
+$GetData::DESYNC_REOPEN.
+
+=back
+
+=item $dirfile->dirfilename ()
+
+Z<>
+
+=item $dirfile->dirfile_standards ([$VERSION])
+
+In addition to a simple integer verison number, C<$VERSION> may be one of the
+symbols
+
+=over
+
+$GetData::VERSION_CURRENT,
+$GetData::VERSION_EARLIEST,
+$GetData::VERSION_LATEST.
+
+=back
+
+If not given, C<$GetData::VERSION_CURRENT> is assumed.
+
+=item $dirfile->encoding ($FRAGMENT_INDEX)
+
+Z<>
+
+=item $dirfile->endianness ($FRAGMENT_INDEX)
+
+Z<>
+
+=item $dirfile->eof ($FIELD_CODE)
+
+Z<>
+
+=item $dirfile->error_count ()
+
+Z<>
+
+=item $dirfile->flags ([$SET, $RESET])
+
+If omitted, C<$SET> and C<$RESET> default to 0.  Otherwise, they should be
+zero or more of the following flags, bitwise or'd together:
+
+=over
+
+$GetData::PRETTY_PRINT,
+$GetData::VERBOSE.
+
+=back
+
+=item $dirfile->flush ($FIELD_CODE)
+
+Z<>
+
+=item $dirfile->fragment_index ($FIELD_CODE)
+
+Z<>
+
+=item $dirfile->fragmentname ($FRAGMENT_INDEX)
+
+Z<>
+
+=item $dirfile->frameoffset ($FRAGMENT_INDEX)
+
+Z<>
+
+=item $dirfile->framenum ($FIELD_CODE, $VALUE, [$START, $END])
+
+C<$START> and C<$END> default to 0 if not given.
+
+=item $dirfile->hidden ($FIELD_CODE)
+
+Z<>
+
+=item $dirfile->hide ($FIELD_CODE)
+
+Z<>
+
+=item $dirfile->madd ($ENTRY, $PARENT)
+
+C<$ENTRY> should be a reference to an entry hash; see L</"ENTRY HASHES"> above.
+
+=item $dirfile->madd_alias ($PARENT, $FIELD_CODE, $TARGET)
+
+Z<>
+
+=item $dirfile->madd_bit ($PARENT, $FIELD_CODE, $IN_FIELD, $BITNUM, $NUMBITS)
+
+Z<>
+
+=item $dirfile->madd_divide ($PARENT, $FIELD_CODE, $IN_FIELD1, $IN_FIELD2)
+
+Z<>
+
+=item $dirfile->madd_lincom ($PARENT, $FIELD_CODE, $N_FIELDS, $IN_FIELDS, $M,
+$B)
+
+C<$IN_FIELDS>, C<$M>, and C<$B> should be references to arrays of the
+appropriate length.  The elements of C<$M> and C<$B> may be of any numerical
+type, including C<Math::Complex>.
+
+=item $dirfile->madd_linterp ($PARENT, $FIELD_CODE, $IN_FIELD, $TABLE)
+
+Z<>
+
+=item $dirfile->madd_mplex ($PARENT, $FIELD_CODE, $IN_FIELD, $COUNT_FIELD,
+$COUNT_VAL, $COUNT_MAX)
+
+Z<>
+
+=item $dirfile->madd_multiply ($PARENT, $FIELD_CODE, $IN_FIELD1, $IN_FIELD2)
+
+Z<>
+
+=item $dirfile->madd_phase ($PARENT, $FIELD_CODE, $IN_FIELD, $SHIFT)
+
+Z<>
+
+=item $dirfile->madd_polynom ($PARENT, $FIELD_CODE, $POLY_ORD, $IN_FIELD, $A)
+
+C<$A> should be a reference to an array of numbers (of any numerical type,
+including C<Math::Complex>) of the appropriate length.
+
+=item $dirfile->madd_recip ($PARENT, $FIELD_CODE, $IN_FIELD, $DIVIDEND)
+
+C<$DIVIDEND> may be of any numerical type, including C<Math::Complex>.
+
+=item $dirfile->madd_sbit ($PARENT, $FIELD_CODE, $IN_FIELD, $BITNUM, $NUMBITS)
+
+Z<>
+
+=item $dirfile->madd_spec ($LINE, $PARENT)
+
+Z<>
+
+=item $dirfile->madd_string ($PARENT, $FIELD_CODE, $VALUE)
+
+Z<>
+
+=item $dirfile->madd_window ($PARENT, $FIELD_CODE, $IN_FIELD, $CHECK_FIELD,
+$WINDOP, $THRESHOLD)
+
+C<$WINDOP> should be one of the symbols listed under L</WINDOW Operators> above.
+
+=item $dirfile->malter_spec ($LINE, $PARENT, [$RECODE])
+
+If not given, C<$RECODE> defaults to 0.
+
+=item $dirfile->metaflush ()
+
+Z<>
+
+=item $dirfile->move ($FIELD_CODE, $NEW_FRAGMENT, [$MOVE_DATA])
+
+If not given, C<$MOVE_DATA> defaults to 0.
+
+=item $dirfile->move_alias ($FIELD_CODE, $NEW_FRAGMENT)
+
+Z<>
+
+=item $dirfile->mplex_lookback ($LOOKBACK)
+
+Z<>
+
+=item $dirfile->native_type ($FIELD_CODE)
+
+The returned value will be one of the symbols listed above under
+L</"Data Types">.
+
+=item $dirfile->nframes ()
+
+Z<>
+
+=item $dirfile->parent_fragment ($FRAGMENT_INDEX)
+
+Z<>
+
+=item $dirfile->protection ($FRAGMENT_INDEX)
+
+Z<>
+
+=item $dirfile->put_string ($FIELD_CODE, $STRING)
+
+Z<>
+
+=item $dirfile->raw_close ($FIELD_CODE)
+
+Z<>
+
+=item $dirfile->raw_filename ($FIELD_CODE)
+
+Z<>
+
+=item $dirfile->reference ([$FIELD_CODE])
+
+If C<$FIELD_CODE> is not given or undef, this function simply reports the
+current reference field.
+
+=item $dirfile->rename ($OLD_CODE, $NEW_NAME, [$FLAGS])
+
+If not given, C<$FLAGS> defaults to 0.  Otherwise, it should be a bitwise or'd
+collection of zero or more of the following flags:
+
+=over
+
+$GetData::REN_DATA,
+$GetData::REN_UPDB.
+
+=back
+
+=item $dirfile->rewrite_fragment ($FRAGMENT_INDEX)
+
+Z<>
+
+=item $dirfile->seek ($FIELD_CODE, $FRAME_NUM, $SAMPLE_NUM, [$FLAGS])
+
+If not given, C<$FLAGS> defaults to C<$GetData::SEEK_SET>.  Otherwise, it should
+be one of:
+
+=over
+
+$GetData::SEEK_CUR,
+$GetData::SEEK_END,
+$GetData::SEEK_SET.
+
+=back
+
+Furthermore, this value should be bitwise or'd with C<$GetData::SEEK_WRITE> if
+the next operation on the field is a write (via L</putdata>).
+
+=item $dirfile->spf ($FIELD_CODE)
+
+Z<>
+
+=item $dirfile->sync ($FIELD_CODE)
+
+Z<>
+
+=item $dirfile->tell ($FIELD_CODE)
+
+Z<>
+
+=item $dirfile->unhide ($FIELD_CODE)
+
+Z<>
+
+=item $dirfile->uninclude ($FRAGMENT_INDEX, [$DEL])
+
+If not given, C<$DEL> defaults to 0.
+
+=item $dirfile->validate ($FIELD_CODE)
+
+Z<>
+
+=item $dirfile->verbose_prefix ([$PREFIX])
+
+If C<$PREFIX> is omitted or undef, the prefix is removed.
+
+=back 
+
+=head1 COPYRIGHT
+
+Copyright (C) 2012 D. V. Wiebe
+
+GetData is free software; you can redistribute it and/or modify it under the
+terms of the GNU Lesser General Public License as published by the Free Software
+Foundation: either version 2.1 of the License, or (at your option) any later
+version.
+
+GetData is distributed in the hope that it will be useful, but without any
+warranty; without even the implied warranty of merchantability or fitness for
+a particular purpose. See the GNU Lesser General Public License for more
+details.
+
+=head1 SEE ALSO
+
+Math::Complex(3), dirfile(5)
+
+=cut
diff --git a/bindings/perl/GetData.xs b/bindings/perl/GetData.xs
new file mode 100644
index 0000000..5c24fcc
--- /dev/null
+++ b/bindings/perl/GetData.xs
@@ -0,0 +1,2098 @@
+/* Copyright (C) 2011-2013 D. V. Wiebe
+ *
+ **************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ *
+ */
+#include "EXTERN.h"
+#include "perl.h"
+#include "XSUB.h"
+#undef _BSD_SOURCE
+#undef _POSIX_SOURCE
+#undef _SVID_SOURCE
+#undef VERSION
+#include "internal.h"
+
+#ifdef GETDATA_DEBUG
+#include "debug.c"
+#endif
+
+/* Perl 5.8.9 and earlier don't provide hv_fetchs */
+#ifdef hv_fetchs
+# define gdp_hv_fetchs hv_fetchs
+#else
+# define gdp_hv_fetchs(hv,key,lval) hv_fetch(hv, key, sizeof(key) - 1, lval)
+#endif
+
+#define undef &PL_sv_undef
+
+/* lfs hackery */
+#if defined _LARGEFILE64_SOURCE || (defined _FILE_OFFSET_BITS && \
+    _FILE_OFFSET_BITS == 64) || (defined __CYGWIN__) || (defined __APPLE__)
+# define gdp64(x) x ## 64
+#else
+# define gdp64(x) x
+#endif
+
+/* fake data types to simplify our typemap */
+typedef GD_DCOMPLEXP_t gdp_complex_in;
+typedef GD_DCOMPLEXA(gdpu_complex);
+typedef int gdpu_bitnum_t;
+typedef int gdpu_numbits_t;
+typedef gd_shift_t gdpu_shift_t;
+typedef unsigned int gdpu_uint_t;
+typedef gd_type_t gdpu_type_t;
+typedef int gdpu_int;
+typedef const char gdpu_char;
+
+#define GDP_DIRFILE_ALIAS \
+  const char *gdp_package = ix ? "GetData::Dirifle" : "GetData";
+
+#define GDP_UNDEF_ON_ERROR(x) \
+      if (gd_error(dirfile)) { x; dreturnvoid(); XSRETURN_UNDEF; }
+
+#define GDP_PUSHpvn(s)      XPUSHs(sv_2mortal(newSVpvn(s, sizeof(s) - 1)))
+#define GDP_PUSHpvz(s)      XPUSHs(sv_2mortal(newSVpv(s, 0)))
+#define GDP_PUSHuv(s)       XPUSHs(sv_2mortal(newSVuv(s)))
+#define GDP_PUSHiv(s)       XPUSHs(sv_2mortal(newSViv(s)))
+#define GDP_PUSHnv(s)       XPUSHs(sv_2mortal(newSVnv(s)))
+#define GDP_PUSHrv(s)       XPUSHs(sv_2mortal(newRV_noinc((SV*)s)))
+#define GDP_PUSHcmp(r,i)    XPUSHs(sv_2mortal(gdp_newSVcmp(r,i)))
+#define GDP_PUSHrvavpv(s,n) XPUSHs(sv_2mortal(gdp_newRVavpv((const char**)s,n)))
+#define GDP_PUSHrvavcmp(s,n) XPUSHs(sv_2mortal(gdp_newRVavcmp(s,n)))
+#define GDP_PUSHrvavnv(s,n) XPUSHs(sv_2mortal(gdp_newRVavnv(s,n)))
+
+struct gdp_callback_stuff_t {
+  SV *func;
+  SV *data;
+};
+
+struct gdp_dirfile_t {
+  DIRFILE *D;
+  struct gdp_callback_stuff_t cbdata;
+};
+
+static DIRFILE *gdp_invalid = NULL;
+
+
+/* sv might be NULL, indicating undef */
+static gd_type_t gdp_get_type(SV **sv, const char *pkg, const char *func)
+{
+  dtrace("%p, \"%s\", \"%s\"", sv, pkg, func);
+
+  if (sv == NULL && *sv == undef)
+    croak("%s::%s() - Value may not be undef", pkg, func);
+
+  if (sv_isa(*sv, "Math::Complex")) {
+    dreturn("%03x", GD_COMPLEX128);
+    return GD_COMPLEX128;
+  } else if (SvTYPE(*sv) == SVt_IV) {
+    dreturn("%03x", GD_INT64);
+    return GD_INT64;
+  }
+
+  dreturn("%03x", GD_FLOAT64);
+  return GD_FLOAT64;
+}
+
+/* convert a Perl object into a complex number */
+static void gdp_convert_cmp(GD_DCOMPLEXP_t val, SV *src, int *ok,
+    const char* pkg, const char *func)
+{
+  dtrace("%p, %p, %p, \"%s\", \"%s\"", val, src, ok, pkg, func);
+
+  if (sv_isa(src, "Math::Complex")) {
+    HV *hv = (HV *)SvRV(src);
+    SV **c_dirty = gdp_hv_fetchs(hv, "c_dirty", 0);
+    if (c_dirty == NULL)
+      croak("%s::%s() - Malformed Math::Complex object", pkg, func);
+    if (SvIV(*c_dirty)) {
+      SV **sv = gdp_hv_fetchs(hv, "polar", 0);
+      if (sv == NULL || !SvROK(*sv) || SvTYPE(SvRV(*sv)) != SVt_PVAV)
+        croak("%s::%s() - Malformed Math::Complex object", pkg, func);
+
+      AV *data = (AV*)SvRV(*sv);
+      SV **m = av_fetch(data, 0, 0);
+      SV **a = av_fetch(data, 1, 0);
+      if (m == NULL || a == NULL)
+        croak("%s::%s() - Malformed Math::Complex object", pkg, func);
+      gd_po2cp_(val, SvNV(*m), SvNV(*a));
+    } else {
+      SV **sv = gdp_hv_fetchs(hv, "cartesian", 0);
+      if (sv == NULL || !SvROK(*sv) || SvTYPE(SvRV(*sv)) != SVt_PVAV)
+        croak("%s::%s() - Malformed Math::Complex object", pkg, func);
+
+      AV *data = (AV*)SvRV(*sv);
+      SV **r = av_fetch(data, 0, 0);
+      SV **i = av_fetch(data, 1, 0);
+      if (r == NULL || i == NULL)
+        croak("%s::%s() - Malformed Math::Complex object", pkg, func);
+      gd_li2cp_(val, SvNV(*r), SvNV(*i));
+    }
+  } else if (ok) {
+    /* if ok is non-NULL, the caller is prepared to handle non-complex data */
+    *ok = 0;
+  } else {
+    gd_rs2cp_(val, SvNV(src));
+  }
+
+  dreturn("(%g;%g)", crealp(val), cimagp(val));
+}
+
+#define GDP_EHASH_FETCH(key) \
+  v = gdp_hv_fetchs((HV*)sv, key, 0); \
+  if (v == NULL) \
+    croak("%s::%s() - Missing required key '" key "' in entry hash", pkg, func)
+
+#define GDP_EHASH_FETCH_CMP(key,member) do { \
+    GDP_EHASH_FETCH(key); \
+    gdp_convert_cmp(gd_csp_(E->member), *v, NULL, pkg, func); \
+  } while(0)
+
+#define GDP_EHASH_FETCH_IV(key,member,type) \
+  do { GDP_EHASH_FETCH(key); E->member = (type)SvIV(*v); } while(0)
+
+#define GDP_EHASH_FETCH_NV(key,member) \
+  do { GDP_EHASH_FETCH(key); E->member = SvNV(*v); } while(0)
+
+#define GDP_EHASH_FETCH_UV(key,member,type) \
+  do { GDP_EHASH_FETCH(key); E->member = (type)SvUV(*v); } while(0)
+
+#define GDP_EHASH_FETCH_UV_REQ(key,member,type) \
+  do { GDP_EHASH_FETCH_REQ(key); E->member = (type)SvUV(*v); } while(0)
+
+#define GDP_EHASH_FETCH_PV(key,member) \
+ do { \
+    GDP_EHASH_FETCH(key); \
+    E->member = (!SvOK(*v)) ? NULL : SvPV_nolen(*v); \
+  } while(0)
+
+/* populate a complex double array in gd_entry_t */
+static void gdp_fetch_cmp_list(GD_DCOMPLEXV(c), HV *hv, const char* key,
+  int n, const char *pkg, const char *func)
+{
+  dtrace("%p, %p, \"%s\", %i, \"%s\", \"%s\"", c, hv, key, n, pkg, func);
+  int i;
+  SV **v = hv_fetch(hv, key, strlen(key), 0);
+
+  if (v == NULL)
+    croak("%s::%s() - Missing required key '%s' in entry hash", pkg, func, key);
+
+  if (SvTYPE(*v) != SVt_PVAV)
+    croak("%s::%s() - Key '%s' must be list in entry hash", pkg, func, key);
+
+  for (i = 0; i < n; ++i) {
+    v = av_fetch((AV*)*v, i, 0);
+    if (v)
+      gdp_convert_cmp(gd_cap_(c,i), *v, NULL, pkg, func);
+  }
+
+  dreturnvoid();
+}
+
+/* populate in_fields in gd_entry_t */
+static void gdp_fetch_in_fields(char **in_fields, SV *sv, int n,
+  const char *pkg, const char *func)
+{
+  dtrace("%p, %p, %i, \"%s\", \"%s\"", in_fields, sv, n, pkg, func);
+  int i;
+  SV **v;
+
+  GDP_EHASH_FETCH("in_fields");
+
+  if (SvTYPE(*v) != SVt_PVAV)
+    croak("%s::%s() - Key 'in_fields' must be list in entry hash", pkg, func);
+
+  for (i = 0; i < n; ++i) {
+    v = av_fetch((AV*)*v, i, 0);
+    if (v)
+      in_fields[i] = SvPV_nolen(*v);
+  }
+
+  dreturnvoid();
+}
+
+/* populate scalar elements of gd_entry_t */
+static void gdp_fetch_scalars(gd_entry_t *E, HV *hv, unsigned int mask,
+  const char *pkg, const char* func)
+{
+  dtrace("%p, %p, %06x \"%s\", \"%s\"", E, hv, mask, pkg, func);
+  int i;
+
+  SV **scalar = gdp_hv_fetchs(hv, "scalar", 0);
+  SV **scalar_ind = gdp_hv_fetchs(hv, "scalar_ind", 0);
+  SV **v;
+
+  /* there's no point in recording scalar indicies if we don't have scalars */
+  if (scalar == NULL) {
+    dreturnvoid();
+    return;
+  }
+
+  if (SvTYPE(*scalar) != SVt_PVAV)
+    croak("%s::%s() - Key 'scalar' must be list in entry hash", pkg, func);
+  if (scalar_ind && SvTYPE(*scalar_ind) != SVt_PVAV)
+    croak("%s::%s() - Key 'scalar_ind' must be list in entry hash", pkg, func);
+
+  for (i = 0; i <= GD_MAX_POLYORD; ++i)
+    if (mask & (1 << i)) {
+      v = av_fetch((AV*)*scalar, i, 0);
+      if (v) {
+        E->scalar[i] = SvPV_nolen(*v);
+        if (scalar_ind) {
+          v = av_fetch((AV*)*scalar_ind, i, 0);
+          if (v)
+            E->scalar_ind[i] = SvIV(*v);
+        }
+      }
+    }
+
+  dreturnvoid();
+}
+
+/* convert a Perl hash into a gd_entry_t */
+static void gdp_to_entry(gd_entry_t *E, SV *sv, const char *pkg,
+  const char *func)
+{
+  dtrace("%p, %p, \"%s\", \"%s\"", E, sv, pkg, func);
+  SV **v;
+  int n;
+
+  memset(E, 0, sizeof(gd_entry_t));
+
+  /* de-reference as needed */
+  while (SvROK(sv))
+    sv = SvRV(sv);
+
+  if (SvTYPE(sv) != SVt_PVHV)
+    croak("%s::%s() - Entry must be hash", pkg, func);
+
+  GDP_EHASH_FETCH_UV("field_type", field_type, gd_entype_t);
+  GDP_EHASH_FETCH_PV("field", field);
+  GDP_EHASH_FETCH_UV("fragment_index", fragment_index, int);
+
+  switch (E->field_type) {
+    case GD_BIT_ENTRY:
+    case GD_SBIT_ENTRY:
+      GDP_EHASH_FETCH_PV("in_fields", in_fields[0]);
+      GDP_EHASH_FETCH_UV("bitnum", EN(bit,bitnum), int);
+      GDP_EHASH_FETCH_UV("numbits", EN(bit,numbits), int);
+      gdp_fetch_scalars(E, (HV*)sv, 0x3, pkg, func);
+      break;
+    case GD_CARRAY_ENTRY:
+      GDP_EHASH_FETCH_IV("array_len", EN(scalar,array_len), size_t);
+      /* fallthrough */
+    case GD_CONST_ENTRY:
+      GDP_EHASH_FETCH_UV("const_type", EN(scalar,const_type), gd_type_t);
+      break;
+    case GD_LINCOM_ENTRY:
+      GDP_EHASH_FETCH_IV("n_fields", EN(lincom,n_fields), int);
+      n = (E->EN(lincom,n_fields) > GD_MAX_LINCOM) ? GD_MAX_LINCOM
+        : E->EN(lincom,n_fields);
+      gdp_fetch_in_fields(E->in_fields, sv, n, pkg, func);
+      E->comp_scal = 1;
+      gdp_fetch_cmp_list(E->EN(lincom,cm), (HV*)sv, "cm", n, pkg, func);
+      gdp_fetch_cmp_list(E->EN(lincom,cb), (HV*)sv, "cb", n, pkg, func);
+      gdp_fetch_scalars(E, (HV*)sv, ((1 << n) - 1) * 9, pkg, func);
+      break;
+    case GD_LINTERP_ENTRY:
+      GDP_EHASH_FETCH_PV("in_fields", in_fields[0]);
+      GDP_EHASH_FETCH_PV("table", EN(linterp,table));
+      break;
+    case GD_MULTIPLY_ENTRY:
+    case GD_DIVIDE_ENTRY:
+      gdp_fetch_in_fields(E->in_fields, sv, 2, pkg, func);
+      break;
+    case GD_PHASE_ENTRY:
+      GDP_EHASH_FETCH_PV("in_fields", in_fields[0]);
+      GDP_EHASH_FETCH_IV("shift", EN(phase,shift), gd_shift_t);
+      gdp_fetch_scalars(E, (HV*)sv, 1, pkg, func);
+      break;
+    case GD_POLYNOM_ENTRY:
+      GDP_EHASH_FETCH_PV("in_fields", in_fields[0]);
+      GDP_EHASH_FETCH_IV("poly_ord", EN(polynom,poly_ord), int);
+      n = (E->EN(polynom,poly_ord) > GD_MAX_POLYORD) ? GD_MAX_POLYORD
+        : E->EN(polynom,poly_ord);
+      E->comp_scal = 1;
+      gdp_fetch_cmp_list(E->EN(polynom,ca), (HV*)sv, "ca", n, pkg, func);
+      gdp_fetch_scalars(E, (HV*)sv, (1 << (n + 1)) - 1, pkg, func);
+      break;
+    case GD_RECIP_ENTRY:
+      GDP_EHASH_FETCH_PV("in_fields", in_fields[0]);
+      E->comp_scal = 1;
+      GDP_EHASH_FETCH_CMP("cdividend", EN(recip,cdividend));
+      gdp_fetch_scalars(E, (HV*)sv, 1, pkg, func);
+      break;
+    case GD_WINDOW_ENTRY:
+      gdp_fetch_in_fields(E->in_fields, sv, 2, pkg, func);
+      GDP_EHASH_FETCH_IV("windop", EN(window,windop), gd_windop_t);
+      switch(E->EN(window,windop)) {
+        case GD_WINDOP_EQ:
+        case GD_WINDOP_NE:
+          GDP_EHASH_FETCH_IV("threshold", EN(window,threshold).i, int64_t);
+          break;
+        case GD_WINDOP_SET:
+        case GD_WINDOP_CLR:
+          GDP_EHASH_FETCH_UV("threshold", EN(window,threshold).u, uint64_t);
+          break;
+        default:
+          GDP_EHASH_FETCH_NV("threshold", EN(window,threshold).r);
+          break;
+      }
+      gdp_fetch_scalars(E, (HV*)sv, 1, pkg, func);
+      break;
+    case GD_MPLEX_ENTRY:
+      gdp_fetch_in_fields(E->in_fields, sv, 2, pkg, func);
+      GDP_EHASH_FETCH_UV("count_val", EN(mplex,count_val), int);
+      GDP_EHASH_FETCH_UV("period", EN(mplex,period), int);
+      gdp_fetch_scalars(E, (HV*)sv, 0x3, pkg, func);
+      break;
+    case GD_RAW_ENTRY:
+      GDP_EHASH_FETCH_UV("spf", EN(raw,spf), unsigned int);
+      GDP_EHASH_FETCH_UV("data_type", EN(raw,data_type), gd_type_t);
+      gdp_fetch_scalars(E, (HV*)sv, 1, pkg, func);
+      break;
+    case GD_NO_ENTRY:
+    case GD_INDEX_ENTRY:
+    case GD_STRING_ENTRY:
+      break;
+    default:
+      croak("%s::%s() - Invalid field type %x in entry hash", pkg, func,
+        E->field_type);
+  }
+
+  dreturnvoid();
+}
+
+/* convert a single perl datum into the desired type */
+static void gdp_convert_from_perl(void *dest, SV *src, gd_type_t type,
+  const char *pkg, const char *func)
+{
+  dtrace("%p, %p, %03x, \"%s\", \"%s\"", dest, src, type, pkg, func);
+  GD_DCOMPLEXA(c);
+  int cmp = 1;
+
+  /* undef results in randomness */
+  if (src == NULL) {
+    dreturnvoid();
+    return;
+  }
+
+  /* check for and convert complex data */
+  gdp_convert_cmp(gd_csp_(c), src, &cmp, pkg, func);
+
+  switch (type) {
+    case GD_UINT8:
+      *(uint8_t*)dest = cmp ? (uint8_t)creal(c) : (uint8_t)SvUV(src);
+      break;
+    case GD_INT8:
+      *(int8_t*)dest = cmp ? (int8_t)creal(c) : (int8_t)SvIV(src);
+      break;
+    case GD_UINT16:
+      *(uint16_t*)dest = cmp ? (uint16_t)creal(c) : (uint16_t)SvUV(src);
+      break;
+    case GD_INT16:
+      *(int16_t*)dest = cmp ? (int16_t)creal(c) : (int16_t)SvIV(src);
+      break;
+    case GD_UINT32:
+      *(uint32_t*)dest = cmp ? (uint32_t)creal(c) : (uint32_t)SvUV(src);
+      break;
+    case GD_INT32:
+      *(int32_t*)dest = cmp ? (int32_t)creal(c) : (int32_t)SvIV(src);
+      break;
+    case GD_UINT64:
+      *(uint64_t*)dest = cmp ? (uint64_t)creal(c) : (uint64_t)SvUV(src);
+      break;
+    case GD_INT64:
+      *(int64_t*)dest = cmp ? (int64_t)creal(c) : (int64_t)SvIV(src);
+      break;
+    case GD_FLOAT32:
+      *(float*)dest = cmp ? (float)creal(c) : (float)SvNV(src);
+      break;
+    case GD_FLOAT64:
+      *(double*)dest = cmp ? (double)creal(c) : (double)SvNV(src);
+      break;
+    case GD_COMPLEX64:
+      if (cmp)
+        gd_cs2ca_(dest,0,c,float);
+      else
+        gd_rs2ca_(dest,0,SvNV(src),float);
+      break;
+    case GD_COMPLEX128:
+      if (cmp)
+        gd_cs2ca_(dest,0,c,double);
+      else
+        gd_rs2ca_(dest,0,SvNV(src),double);
+      break;
+    case GD_NULL:
+    case GD_UNKNOWN:
+      ;
+  }
+
+  dreturnvoid();
+}
+
+struct gdp_din {
+  void *data_in;
+  gd_type_t type;
+  int arg_type;
+  size_t nsamp;
+};
+
+#define GDP_DATA_IN_LIST 0
+#define GDP_DATA_IN_PACK 1
+#define GDP_DATA_IN_REF  2
+static struct gdp_din gdp_convert_data(SV *d, I32 items, I32 ax, size_t idx,
+  const char *pkg, const char *func)
+{
+  struct gdp_din din = {NULL, GD_NULL, GDP_DATA_IN_PACK, 0};
+  size_t i;
+  AV *av = NULL;
+
+  dtrace("%p, %i, %i, %zi, \"%s\", \"%s\"", d, (int)items, (int)ax, idx, pkg,
+      func);
+
+  /* argument grokking goes thus (in order!):
+   * if d == undef, the remaining arguments are taken to be data
+   * if d == reference to an array, the array is taken to be data, and
+   *            remaining arguments ignored
+   * if there is exactly one argument after d, d is taken as a type code
+   *            and the following argument as either packed data or a
+   *            reference to a list.
+   * otherwise, d is taken to be the first datum in a list of data.
+   */
+
+  if (d == undef) {
+    idx++;
+    din.arg_type = GDP_DATA_IN_LIST;
+  } else if (sv_isa(d, "Math::Complex"))
+    din.arg_type = GDP_DATA_IN_LIST;
+  else if (SvROK(d)) {
+    av = (AV*)SvRV(d);
+    din.arg_type = GDP_DATA_IN_REF;
+  } else if (items != 6)
+    din.arg_type = GDP_DATA_IN_LIST;
+  else if (SvROK(ST(5))) {
+    av = (AV*)SvRV(ST(5));
+    din.arg_type = GDP_DATA_IN_REF;
+  }
+
+  if (din.arg_type == GDP_DATA_IN_LIST) {
+    din.nsamp = items - idx;
+    din.type = gdp_get_type(&ST(idx), pkg, func);
+  } else if (din.arg_type == GDP_DATA_IN_REF) {
+    if (SvTYPE((SV*)av) != SVt_PVAV)
+      croak("%s::%s() - Expected array reference, but found some other "
+          "type of object", pkg, func);
+    din.nsamp = (size_t)av_len(av) + 1;
+    din.type = gdp_get_type(av_fetch(av, 0, 0), pkg, func);
+  } else {
+    din.type = (gd_type_t)SvIV(d);
+    if (GD_SIZE(din.type) == 0)
+      croak("%s::%s() - Invalid type code", pkg, func);
+    STRLEN n;
+    din.data_in = SvPV(ST(5), n);
+    din.nsamp = (size_t)n / GD_SIZE(din.type);
+  }
+
+  if (din.arg_type != GDP_DATA_IN_PACK)
+    din.data_in = safemalloc(din.nsamp * GD_SIZE(din.type));
+
+  if (din.arg_type == GDP_DATA_IN_LIST) {
+    for (i = idx; i < items; ++i)
+      gdp_convert_from_perl((char*)din.data_in + GD_SIZE(din.type) * (i - idx),
+          ST(i), din.type, pkg, func);
+  } else if (din.arg_type == GDP_DATA_IN_REF) {
+    for (i = 0; i < din.nsamp; ++i) {
+      SV **sv = av_fetch(av, i, 0);
+      if (sv == NULL)
+        croak("%s::%s() - Undefined datum encountered", pkg, func);
+      gdp_convert_from_perl((char*)din.data_in + GD_SIZE(din.type) * i, *sv,
+          din.type, pkg, func);
+    }
+  }
+
+  dreturn("{ %p, %03x, %i, %zi }", din.data_in, din.type, din.arg_type,
+    din.nsamp);
+  return din;
+}
+
+/* convert perl datum (in some sort of format) into an appropriate
+ * C datum, with type */
+static gd_type_t gdp_to_voidp(void *dest, SV *src, gd_type_t hint,
+  const char *pkg, const char *func)
+{
+  dtrace("%p, %p, %03x, \"%s\", \"%s\"", dest, src, hint, pkg, func);
+  gd_type_t type = GD_UNKNOWN;
+
+  /* treat undef as zero */
+  if (src == undef) {
+    memset(dest, 0, 1);
+    type = GD_UINT8;
+  } else {
+    int cmp = 0;
+    GD_DCOMPLEXA(c);
+    gdp_convert_cmp(gd_csp_(c), src, &cmp, pkg, func);
+
+    if (cmp) {
+      gd_cs2ca_(dest, 0, c, double);
+      type = GD_COMPLEX128;
+    } else if (SvNOK(src)) {
+      *(double*)dest = SvNV(src);
+      type = GD_FLOAT64;
+    } else if (SvUOK(src)) {
+      *(uint64_t*)dest = (uint64_t)SvUV(src);
+      type = GD_UINT64;
+    } else if (SvIOK(src)) {
+      *(int64_t*)dest = (int64_t)SvIV(src);
+      type = GD_INT64;
+    } else if (hint & GD_COMPLEX || hint & GD_IEEE754) {
+      *(double*)dest = SvNV(src);
+      type = GD_FLOAT64;
+    } else if (hint & GD_SIGNED) {
+      *(int64_t*)dest = (int64_t)SvIV(src);
+      type = GD_INT64;
+    } else {
+      *(uint64_t*)dest = (uint64_t)SvUV(src);
+      type = GD_UINT64;
+    }
+  }
+
+  dreturn("%03x", type);
+  return type;
+}
+
+static SV *gdp_newSVcmp(double r, double i)
+{
+  SV **dummy;
+  SV *sv;
+  AV *av;
+  HV *hv, *stash;
+
+  dtrace("%g; %g", r, i);
+
+  /* build a list containing the data, and take it's reference */
+  av = newAV();
+  av_extend(av, 1);
+  av_store(av, 0, newSVnv(r));
+  av_store(av, 1, newSVnv(i));
+  sv = newRV_noinc((SV*)av);
+
+  /* create a Math::Complex object */
+  hv = newHV();
+  dummy = hv_store(hv, "p_dirty", 7, newSVuv(1), 0);
+  dummy = hv_store(hv, "c_dirty", 7, newSVuv(0), 0);
+  dummy = hv_store(hv, "cartesian", 9, sv, 0);
+  stash = gv_stashpv("Math::Complex", GV_ADD);
+  sv = sv_bless(newRV_noinc((SV*)hv), stash);
+
+  dreturn("%p", sv);
+  return sv;
+}
+
+/* convert a char ** into a reference to a list of strings */
+static SV *gdp_newRVavpv(const char **l, size_t n)
+{
+  dtrace("%p, %zi", l, n);
+  SV *rv;
+  int i;
+  AV *av = newAV();
+  av_extend(av, n - 1);
+
+  for (i = 0; i < n; ++i)
+    av_store(av, i, newSVpv(l[i], 0));
+
+  rv = newRV_noinc((SV*)av);
+  dreturn("%p", rv);
+  return rv;
+}
+
+/* convert a complex double * into a reference to a list of complex data */
+static SV *gdp_newRVavcmp(GD_DCOMPLEXV(l), size_t n)
+{
+  dtrace("%p, %zi", l, n);
+  SV *rv;
+  int i;
+  AV *av = newAV();
+  av_extend(av, n - 1);
+
+  for (i = 0; i < n; ++i)
+    av_store(av, i, gdp_newSVcmp(creal(l[i]), cimag(l[i])));
+
+  rv = newRV_noinc((SV*)av);
+  dreturn("%p", rv);
+  return rv;
+}
+
+/* store some scalar values in the entry hash on the stack from the gd_entry_t
+*/
+static SV **gdp_store_scalars(SV **sp, const gd_entry_t *E, unsigned int mask)
+{
+  dtrace("%p, %p, %06x", sp, E, mask);
+  int i;
+
+  if (!mask) {
+    dreturn("%p", sp);
+    return sp;
+  }
+
+  AV *scalar = newAV();
+  AV *scalar_ind = newAV();
+  av_extend(scalar, GD_MAX_POLYORD);
+  av_extend(scalar_ind, GD_MAX_POLYORD);
+  for (i = 0; i <= GD_MAX_POLYORD; ++i)
+    if (mask & (1 << i)) {
+      av_store(scalar, i, newSVpv(E->scalar[i], 0));
+      if (E->scalar[i] == NULL)
+        av_store(scalar_ind, i, undef);
+      else
+        av_store(scalar_ind, i, newSViv(E->scalar_ind[i]));
+    }
+  GDP_PUSHpvn("scalar");
+  GDP_PUSHrv(scalar);
+  GDP_PUSHpvn("scalar_ind");
+  GDP_PUSHrv(scalar_ind);
+
+  dreturn("%p", sp);
+  return sp;
+}
+
+/* parser callback wrapper */
+static int gdp_parser_callback(gd_parser_data_t *pdata, void *extra)
+{
+  SV *callback_func = ((struct gdp_callback_stuff_t *)extra)->func;
+  SV *callback_data = ((struct gdp_callback_stuff_t *)extra)->data;
+  SV *ret, **dummy;
+  int n, sem = GD_SYNTAX_ABORT;
+  int was_rv = 0;
+
+  /* local stack pointer */
+  dSP;
+
+  dtrace("%p, %p", pdata, extra);
+
+  /* create pseudo-block */
+  ENTER;
+  SAVETMPS;
+
+  /* create the parser data hash */
+  HV *phash = newHV();
+  dummy = hv_store(phash, "suberror", 8, newSVuv(pdata->suberror), 0);
+  dummy = hv_store(phash, "linenum", 7, newSVuv(pdata->linenum), 0);
+  dummy = hv_store(phash, "line", 4, newSVpv(pdata->line, 0), 0);
+  dummy = hv_store(phash, "filename", 8, newSVpv(pdata->filename, 0), 0);
+
+  /* create stack frame */
+  PUSHMARK(SP);
+
+  XPUSHs(sv_2mortal(newRV_noinc((SV *)phash)));
+  XPUSHs(callback_data);
+
+  /* finalise stack frame */
+  PUTBACK;
+
+  /* call the object */
+  n = call_sv(callback_func, G_SCALAR);
+
+  /* refresh local stack pointer */
+  SPAGAIN;
+
+  /* delete the hash */
+  hv_undef(phash);
+
+  /* Make sure we got a scalar back; otherwise complain and abort */
+  if (n != 1) {
+    croak("GetData: expected scalar response from parser callback.");
+    return GD_SYNTAX_ABORT; /* ca'n't get here */
+  }
+
+  /* pop our return value */
+  ret = POPs;
+
+  /* de-reference as needed */
+  while (SvROK(ret)) {
+    ret = SvRV(ret);
+    was_rv = 1;
+  }
+
+  /* ferret out response */
+  switch (SvTYPE(ret)) {
+    AV *av;
+    int len;
+
+    case SVt_IV:
+    sem = SvIV(ret);
+    break;
+    case SVt_PVAV:
+    av = (AV *)ret;
+    len = av_len(av);
+    if (len < 0) {
+      croak("GetData: parser callback returned empty array.");
+      return GD_SYNTAX_ABORT; /* ca'n't get here */
+    } else if (len > 1) {
+      croak("GetData: too many elements in array returned by parser "
+          "callback.");
+      return GD_SYNTAX_ABORT; /* ca'n't get here */
+    } else if (len == 0) {
+      SV **val = av_fetch(av, 0, 0);
+      if (val == NULL || SvROK(*val)) {
+        croak("GetData: bad data type in array returned by parser callback.");
+        return GD_SYNTAX_ABORT; /* ca'n't get here */
+      }
+
+      if (SvTYPE(*val) == SVt_IV) {
+        sem = SvIV(*val);
+      } else if (SvTYPE(*val) == SVt_PV) {
+        pdata->line = strdup(SvPV_nolen(*val));
+        sem = GD_SYNTAX_RESCAN;
+      } else {
+        croak("GetData: bad data type in array returned by parser callback.");
+        return GD_SYNTAX_ABORT; /* ca'n't get here */
+      }
+    } else { /* len == 1 */
+      SV **val0 = av_fetch(av, 0, 0);
+      SV **val1 = av_fetch(av, 1, 0);
+
+      if (val0 == NULL || SvROK(*val0) || val1 == NULL || SvROK(*val1)) {
+        croak("GetData: bad data type in array returned by parser callback.");
+        return GD_SYNTAX_ABORT; /* ca'n't get here */
+      }
+
+      if (SvTYPE(*val0) == SVt_IV && SvTYPE(*val1) == SVt_PV) {
+        sem = SvIV(*val0);
+        pdata->line = strdup(SvPV_nolen(*val1));
+      } else {
+        croak("GetData: bad data type in array returned by parser callback.");
+        return GD_SYNTAX_ABORT; /* ca'n't get here */
+      }
+    }
+    break;
+    case SVt_PV:
+    pdata->line = strdup(SvPV_nolen(ret));
+    sem = GD_SYNTAX_RESCAN;
+    break;
+    default:
+    croak("GetData: bad data type returned by parser callback.");
+    return GD_SYNTAX_ABORT; /* ca'n't get here */
+  }
+
+  /* resync global stack pointer */
+  PUTBACK;
+
+  /* destroy pseudo-block */
+  FREETMPS;
+  LEAVE;
+
+  dreturn("%i", sem);
+  return sem;
+}
+
+#define GDP_UNPACKU(t) \
+  if (sp) for (i = 0; i < n; ++i) XPUSHs(sv_2mortal(newSVuv(((t*)data)[i]))); \
+  else    for (i = 0; i < n; ++i) av_store(av, i,   newSVuv(((t*)data)[i]));
+
+#define GDP_UNPACKI(t) \
+  if (sp) for (i = 0; i < n; ++i) XPUSHs(sv_2mortal(newSViv(((t*)data)[i]))); \
+  else    for (i = 0; i < n; ++i) av_store(av, i,   newSViv(((t*)data)[i]));
+
+#define GDP_UNPACKN(t) \
+  if (sp) for (i = 0; i < n; ++i) XPUSHs(sv_2mortal(newSVnv(((t*)data)[i]))); \
+  else    for (i = 0; i < n; ++i) av_store(av, i,   newSVnv(((t*)data)[i]));
+
+#define GDP_UNPACKC(t) \
+  if (sp) for (i = 0; i < n; ++i) \
+      XPUSHs(sv_2mortal(gdp_newSVcmp(((t*)data)[2 * i], \
+              ((t*)data)[2 * i + 1]))); \
+  else for (i = 0; i < n; ++i) av_store(av, i, \
+      gdp_newSVcmp(((t*)data)[2 * i], ((t*)data)[2 * i + 1]));
+
+/* unpack data. If sp is NULL, return an AV, otherwise push it onto the perl
+ * stack; returns the updated stack pointer */
+static void * gdp_unpack(SV **sp, const void *data, size_t n, gd_type_t type)
+{
+  dtrace("%p, %p, %zi, %03x", sp, data, n, type);
+  size_t i;
+  AV *av = NULL;
+
+  if (!sp) {
+    av = newAV();
+    av_extend(av, n - 1);
+  }
+
+  if (n == 0) {
+    dreturn("%p", sp);
+    return sp ? (void *)sp : (void *)av;
+  }
+
+  switch (type) {
+    case GD_UINT8:
+      GDP_UNPACKU(uint8_t);
+      break;
+    case GD_INT8:
+      GDP_UNPACKI(int8_t);
+      break;
+    case GD_UINT16:
+      GDP_UNPACKU(uint16_t);
+      break;
+    case GD_INT16:
+      GDP_UNPACKI(int16_t);
+      break;
+    case GD_UINT32:
+      GDP_UNPACKU(uint32_t);
+      break;
+    case GD_INT32:
+      GDP_UNPACKI(int32_t);
+      break;
+    case GD_UINT64:
+      GDP_UNPACKU(uint64_t);
+      break;
+    case GD_INT64:
+      GDP_UNPACKI(int64_t);
+      break;
+    case GD_FLOAT32:
+      GDP_UNPACKN(float);
+      break;
+    case GD_FLOAT64:
+      GDP_UNPACKN(double);
+      break;
+    case GD_COMPLEX64:
+      GDP_UNPACKC(float);
+      break;
+    case GD_COMPLEX128:
+      GDP_UNPACKC(double);
+      break;
+    case GD_UNKNOWN:
+    case GD_NULL:
+      break;
+  }
+
+  dreturn("%p", sp ? (void *)sp : (void *)av);
+  return sp ? (void *)sp : (void *)av;
+}
+
+/* Module starts here --------------------------------------------------- */
+MODULE = GetData  PACKAGE = GetData
+PROTOTYPES: ENABLE
+
+BOOT:
+  gdp_invalid = gd_invalid_dirfile();
+
+void
+DESTROY(dirfile)
+  DIRFILE * dirfile
+  PREINIT:
+    GDP_DIRFILE_ALIAS;
+  ALIAS:
+    GetData::Dirfile::DESTROY = 1
+  CODE:
+    dtrace("%p", dirfile);
+    if (dirfile != gdp_invalid)
+      gd_discard(dirfile);
+    safefree(gdp_dirfile);
+  CLEANUP:
+    dreturnvoid();
+
+int
+error(dirfile)
+  DIRFILE * dirfile
+  PREINIT:
+    GDP_DIRFILE_ALIAS;
+  ALIAS:
+    GetData::Dirfile::error = 1
+  CODE:
+    dtrace("%p", dirfile);
+
+    RETVAL = gd_error(dirfile);
+  OUTPUT:
+    RETVAL
+  CLEANUP:
+    dreturn("%i", RETVAL);
+
+
+DIRFILE *
+open(dirfilename, flags, sehandler=undef, extra=undef)
+  const char * dirfilename
+  unsigned long flags
+  SV * sehandler
+  SV * extra
+  PREINIT:
+    struct gdp_dirfile_t *gdp_dirfile =
+    (struct gdp_dirfile_t *)safemalloc(sizeof(struct gdp_dirfile_t));
+  CODE:
+    dtrace("\"%s\", %lu, %p, %p", dirfilename, flags, sehandler, extra);
+    if (sehandler == undef) {
+      gdp_dirfile->cbdata.func = NULL;
+      gdp_dirfile->cbdata.data = NULL;
+
+      RETVAL = gd_cbopen(dirfilename, flags, NULL, NULL);
+    } else {
+      gdp_dirfile->cbdata.func = sehandler;
+      gdp_dirfile->cbdata.data = extra;
+
+      RETVAL = gd_cbopen(dirfilename, flags, gdp_parser_callback,
+          &gdp_dirfile->cbdata);
+    }
+  OUTPUT:
+    RETVAL
+  CLEANUP:
+    dreturn("%p", gdp_dirfile);
+
+DIRFILE *
+invalid_dirfile()
+  PREINIT:
+    struct gdp_dirfile_t *gdp_dirfile =
+    (struct gdp_dirfile_t *)safemalloc(sizeof(struct gdp_dirfile_t));
+  CODE:
+    dtracevoid();
+    gdp_dirfile->cbdata.func = NULL;
+    gdp_dirfile->cbdata.data = NULL;
+
+    RETVAL = gd_invalid_dirfile();
+  OUTPUT:
+    RETVAL
+  CLEANUP:
+    dreturn("%p", gdp_dirfile);
+
+void
+get_carray(dirfile, field_code, return_type)
+  DIRFILE * dirfile
+  const char * field_code
+  gd_type_t return_type
+  PREINIT:
+    void *data_out = NULL;
+    GDP_DIRFILE_ALIAS;
+  ALIAS:
+    GetData::Dirfile::get_carray = 1
+  PPCODE:
+    dtrace("%p, \"%s\", %03x; %i", dirfile, field_code, return_type,
+        (int)GIMME_V);
+    size_t len = gd_carray_len(dirfile, field_code);
+    data_out = safemalloc(GD_SIZE(return_type) * len);
+    gd_get_carray(dirfile, field_code, return_type, data_out);
+
+    GDP_UNDEF_ON_ERROR(safefree(data_out));
+
+    if (GIMME_V == G_ARRAY)
+      sp = (SV **)gdp_unpack(sp, data_out, len, return_type);
+    else
+      XPUSHs(sv_2mortal(newSVpvn(data_out, len * GD_SIZE(return_type))));
+
+    safefree(data_out);
+    dreturnvoid();
+
+void
+get_carray_slice(dirfile, field_code, start, len, return_type)
+  DIRFILE * dirfile
+  const char * field_code
+  gd_type_t return_type
+  unsigned int start
+  size_t len
+  PREINIT:
+    void *data_out = NULL;
+    GDP_DIRFILE_ALIAS;
+  ALIAS:
+    GetData::Dirfile::get_carray_slice = 1
+  PPCODE:
+    dtrace("%p, \"%s\", %u, %zi, %03x; %i", dirfile, field_code, start, len,
+      return_type, (int)GIMME_V);
+    data_out = safemalloc(GD_SIZE(return_type) * len);
+    gd_get_carray_slice(dirfile, field_code, start, len, return_type, data_out);
+
+    GDP_UNDEF_ON_ERROR(safefree(data_out));
+
+    if (GIMME_V == G_ARRAY)
+      sp = (SV **)gdp_unpack(sp, data_out, len, return_type);
+    else
+      XPUSHs(sv_2mortal(newSVpvn(data_out, len * GD_SIZE(return_type))));
+
+    safefree(data_out);
+    dreturnvoid();
+
+SV *
+get_constant(dirfile, field_code, return_type)
+  DIRFILE * dirfile
+  const char * field_code
+  gd_type_t return_type
+  PREINIT:
+    void *data_out = NULL;
+    GDP_DIRFILE_ALIAS;
+  ALIAS:
+    GetData::Dirfile::get_constant = 1
+  CODE:
+    gd_type_t type;
+    dtrace("%p, \"%s\", %03x", dirfile, field_code, return_type);
+    data_out = safemalloc(16);
+
+    if (return_type & GD_COMPLEX)
+      type = GD_COMPLEX128;
+    else if (return_type & GD_IEEE754)
+      type = GD_FLOAT64;
+    else if (return_type & GD_SIGNED)
+      type = GD_INT64;
+    else
+      type = GD_UINT64;
+
+    gd_get_constant(dirfile, field_code, type, data_out);
+
+    GDP_UNDEF_ON_ERROR(safefree(data_out));
+
+    if (type == GD_COMPLEX128)
+      RETVAL = gdp_newSVcmp(((double*)data_out)[0], ((double*)data_out)[1]);
+    else if (type == GD_FLOAT64)
+      RETVAL = newSVnv(*(double*)data_out);
+    else if (type == GD_INT64)
+      RETVAL = newSViv(*(int64_t*)data_out);
+    else
+      RETVAL = newSVuv(*(uint64_t*)data_out);
+  OUTPUT:
+    RETVAL
+  CLEANUP:
+    safefree(data_out);
+    dreturn("%p", RETVAL);
+
+void
+constants(dirfile, return_type)
+  DIRFILE * dirfile
+  gd_type_t return_type
+  PREINIT:
+    const void *data_out = NULL;
+    GDP_DIRFILE_ALIAS;
+  ALIAS:
+    GetData::Dirfile::constants = 1
+  PPCODE:
+    dtrace("%p, %03x; %i", dirfile, return_type, (int)GIMME_V);
+    int len = gd_nfields_by_type(dirfile, GD_CONST_ENTRY);
+    data_out = gd_constants(dirfile, return_type);
+
+    GDP_UNDEF_ON_ERROR();
+
+    if (GIMME_V == G_ARRAY)
+      sp = (SV **)gdp_unpack(sp, data_out, len, return_type);
+    else
+      XPUSHs(sv_2mortal(newSVpvn(data_out, len * GD_SIZE(return_type))));
+
+    dreturnvoid();
+
+void
+carrays(dirfile, return_type)
+  DIRFILE * dirfile
+  gd_type_t return_type
+  PREINIT:
+    const gd_carray_t *data_out = NULL;
+    GDP_DIRFILE_ALIAS;
+  ALIAS:
+    GetData::Dirfile::carrays = 1
+  PPCODE:
+    dtrace("%p, %03x; %i", dirfile, return_type, (int)GIMME_V);
+    I32 i, len = (I32)gd_nfields_by_type(dirfile, GD_CARRAY_ENTRY);
+    data_out = gd_carrays(dirfile, return_type);
+
+    GDP_UNDEF_ON_ERROR();
+
+    /* in array context, return an array of arrays of unpacked data.
+     * Otherwise, return a reference to an array of packed data. */
+    if (GIMME_V == G_ARRAY)
+      for (i = 0; i < len; ++i)
+        XPUSHs(sv_2mortal(newRV_noinc((SV *)gdp_unpack(NULL, data_out[i].d,
+                  data_out[i].n, return_type))));
+    else {
+      AV *av = newAV();
+      for (i = 0; i < len; ++i)
+        av_store(av, i, newSVpvn(data_out[i].d,
+              data_out[i].n * GD_SIZE(return_type)));
+      XPUSHs(sv_2mortal(newRV_noinc((SV*)av)));
+    }
+
+    dreturnvoid();
+
+void
+entry(dirfile, field_code)
+  DIRFILE * dirfile
+  const char * field_code
+  PREINIT:
+    GDP_DIRFILE_ALIAS;
+  ALIAS:
+    GetData::Dirfile::entry = 1
+  PPCODE:
+    dtrace("%p, \"%s\"; %i", dirfile, field_code, (int)GIMME_V);
+
+    if (GIMME_V == G_ARRAY) {
+      gd_entry_t E;
+      gd_entry(dirfile, field_code, &E);
+
+      GDP_UNDEF_ON_ERROR();
+
+      /* push the hash onto the stack */
+      GDP_PUSHpvn("field");
+      GDP_PUSHpvz(E.field);
+      GDP_PUSHpvn("field_type");
+      GDP_PUSHuv(E.field_type);
+      GDP_PUSHpvn("fragment_index");
+      GDP_PUSHuv(E.fragment_index);
+      switch (E.field_type) {
+        case GD_BIT_ENTRY:
+        case GD_SBIT_ENTRY:
+          GDP_PUSHpvn("in_fields");
+          GDP_PUSHpvz(E.in_fields[0]);
+          GDP_PUSHpvn("bitnum");
+          GDP_PUSHuv(E.EN(bit,bitnum));
+          GDP_PUSHpvn("numbits");
+          GDP_PUSHuv(E.EN(bit,numbits));
+          sp = gdp_store_scalars(sp, &E, 0x3);
+          break;
+        case GD_CARRAY_ENTRY:
+          GDP_PUSHpvn("array_len");
+          GDP_PUSHuv(E.EN(scalar,array_len));
+          /* fallthrough */
+        case GD_CONST_ENTRY:
+          GDP_PUSHpvn("const_type");
+          GDP_PUSHuv(E.EN(scalar,const_type));
+          break;
+        case GD_LINCOM_ENTRY:
+          GDP_PUSHpvn("n_fields");
+          GDP_PUSHiv(E.EN(lincom,n_fields));
+          GDP_PUSHpvn("in_fields");
+          GDP_PUSHrvavpv(E.in_fields, E.EN(lincom,n_fields));
+          GDP_PUSHpvn("m");
+          GDP_PUSHrvavcmp(E.EN(lincom,cm), E.EN(lincom,n_fields));
+          GDP_PUSHpvn("b");
+          GDP_PUSHrvavcmp(E.EN(lincom,cb), E.EN(lincom,n_fields));
+          sp = gdp_store_scalars(sp, &E, ((1 << E.EN(lincom,n_fields)) - 1) * 9);
+          break;
+        case GD_LINTERP_ENTRY:
+          GDP_PUSHpvn("in_fields");
+          GDP_PUSHpvz(E.in_fields[0]);
+          GDP_PUSHpvn("table");
+          GDP_PUSHpvz(E.EN(linterp,table));
+          break;
+        case GD_MULTIPLY_ENTRY:
+        case GD_DIVIDE_ENTRY:
+          GDP_PUSHpvn("in_fields");
+          GDP_PUSHrvavpv(E.in_fields, 2);
+          break;
+        case GD_PHASE_ENTRY:
+          GDP_PUSHpvn("in_fields");
+          GDP_PUSHpvz(E.in_fields[0]);
+          GDP_PUSHpvn("shift");
+          GDP_PUSHiv(E.EN(phase,shift));
+          sp = gdp_store_scalars(sp, &E, 1);
+          break;
+        case GD_POLYNOM_ENTRY:
+          GDP_PUSHpvn("poly_ord");
+          GDP_PUSHiv(E.EN(polynom,poly_ord));
+          GDP_PUSHpvn("in_fields");
+          GDP_PUSHpvz(E.in_fields[0]);
+          GDP_PUSHpvn("a");
+          GDP_PUSHrvavcmp(E.EN(polynom,ca), E.EN(polynom,poly_ord) + 1);
+          sp = gdp_store_scalars(sp, &E,
+              (1 << (E.EN(polynom,poly_ord) + 1)) - 1);
+          break;
+        case GD_RECIP_ENTRY:
+          GDP_PUSHpvn("in_fields");
+          GDP_PUSHpvz(E.in_fields[0]);
+          GDP_PUSHpvn("dividend");
+          GDP_PUSHcmp(creal(E.EN(recip,cdividend)),
+              cimag(E.EN(recip,cdividend)));
+          sp = gdp_store_scalars(sp, &E, 1);
+          break;
+        case GD_RAW_ENTRY:
+          GDP_PUSHpvn("spf");
+          GDP_PUSHuv(E.EN(raw,spf));
+          GDP_PUSHpvn("data_type");
+          GDP_PUSHuv(E.EN(raw,data_type));
+          sp = gdp_store_scalars(sp, &E, 1);
+          break;
+        case GD_WINDOW_ENTRY:
+          GDP_PUSHpvn("in_fields");
+          GDP_PUSHrvavpv(E.in_fields, 2);
+          GDP_PUSHpvn("windop");
+          GDP_PUSHiv(E.EN(window,windop));
+          GDP_PUSHpvn("threshold");
+          switch(E.EN(window,windop)) {
+            case GD_WINDOP_EQ:
+            case GD_WINDOP_NE:
+              GDP_PUSHiv(E.EN(window,threshold).i);
+              break;
+            case GD_WINDOP_SET:
+            case GD_WINDOP_CLR:
+              GDP_PUSHuv(E.EN(window,threshold).u);
+              break;
+            default:
+              GDP_PUSHnv(E.EN(window,threshold).r);
+              break;
+          }
+          sp = gdp_store_scalars(sp, &E, 1);
+          break;
+        case GD_MPLEX_ENTRY:
+          GDP_PUSHpvn("in_fields");
+          GDP_PUSHrvavpv(E.in_fields, 2);
+          GDP_PUSHpvn("count_val");
+          GDP_PUSHuv(E.EN(mplex,count_val));
+          GDP_PUSHpvn("period");
+          GDP_PUSHuv(E.EN(mplex,period));
+          sp = gdp_store_scalars(sp, &E, 0x3);
+          break;
+        case GD_INDEX_ENTRY:
+        case GD_STRING_ENTRY:
+        case GD_NO_ENTRY:
+          break;
+      }
+
+      gd_free_entry_strings(&E);
+    } else {
+      gd_entype_t t = gd_entry_type(dirfile, field_code);
+
+      GDP_UNDEF_ON_ERROR();
+
+      GDP_PUSHiv(t);
+    }
+    dreturnvoid();
+
+SV *
+error_string(dirfile)
+  DIRFILE * dirfile
+  PREINIT:
+    GDP_DIRFILE_ALIAS;
+  ALIAS:
+    GetData::Dirfile::error_string = 1
+  CODE:
+    dtrace("%p", dirfile);
+    char *s = gd_error_string(dirfile, NULL, 0);
+
+    RETVAL = newSVpv(s, 0);
+  OUTPUT:
+    RETVAL
+  CLEANUP:
+    free(s);
+    dreturn("%p", RETVAL);
+
+AV *
+mcarrays(dirfile, parent, return_type)
+  DIRFILE * dirfile
+  const char * parent;
+  gd_type_t return_type
+  PREINIT:
+    const gd_carray_t *data_out = NULL;
+    GDP_DIRFILE_ALIAS;
+  ALIAS:
+    GetData::Dirfile::mcarrays = 1
+  PPCODE:
+    dtrace("%p, %03x; %i", dirfile, return_type, (int)GIMME_V);
+    I32 i, len = (I32)gd_nmfields_by_type(dirfile, parent, GD_CARRAY_ENTRY);
+    data_out = gd_mcarrays(dirfile, parent, return_type);
+
+    GDP_UNDEF_ON_ERROR();
+
+    /* in array context, return an array of arrays of unpacked data.
+     * Otherwise, return a reference to an array of packed data. */
+    if (GIMME_V == G_ARRAY)
+      for (i = 0; i < len; ++i)
+        XPUSHs(sv_2mortal(newRV_noinc((SV *)gdp_unpack(NULL, data_out[i].d,
+                  data_out[i].n, return_type))));
+    else {
+      AV *av = newAV();
+      for (i = 0; i < len; ++i)
+        av_store(av, i, newSVpvn(data_out[i].d,
+              data_out[i].n * GD_SIZE(return_type)));
+      XPUSHs(sv_2mortal(newRV_noinc((SV*)av)));
+    }
+
+    dreturnvoid();
+
+void
+mconstants(dirfile, parent, return_type)
+  DIRFILE * dirfile
+  const char * parent
+  gd_type_t return_type
+  PREINIT:
+    const void *data_out = NULL;
+    GDP_DIRFILE_ALIAS;
+  ALIAS:
+    GetData::Dirfile::mconstants = 1
+  PPCODE:
+    dtrace("%p, %03x; %i", dirfile, return_type, (int)GIMME_V);
+    int len = gd_nmfields_by_type(dirfile, parent, GD_CONST_ENTRY);
+    data_out = gd_mconstants(dirfile, parent, return_type);
+
+    GDP_UNDEF_ON_ERROR();
+
+    if (GIMME_V == G_ARRAY)
+      sp = (SV **)gdp_unpack(sp, data_out, len, return_type);
+    else
+      XPUSHs(sv_2mortal(newSVpvn(data_out, len * GD_SIZE(return_type))));
+
+    dreturnvoid();
+
+void
+parser_callback(dirfile, sehandler, extra=undef)
+  DIRFILE * dirfile
+  SV *sehandler
+  SV *extra
+  PREINIT:
+    GDP_DIRFILE_ALIAS;
+  ALIAS:
+    GetData::Dirfile::parser_callback = 1
+  CODE:
+    dtrace("%p, %p, %p", dirfile, sehandler, extra);
+    if (sehandler == undef) {
+      gdp_dirfile->cbdata.func = NULL;
+      gdp_dirfile->cbdata.data = NULL;
+
+      gd_parser_callback(dirfile, NULL, NULL);
+    } else {
+      gdp_dirfile->cbdata.func = sehandler;
+      gdp_dirfile->cbdata.data = extra;
+
+      gd_parser_callback(dirfile, gdp_parser_callback, &gdp_dirfile->cbdata);
+    }
+  CLEANUP:
+    dreturnvoid();
+
+char *
+get_string(dirfile, field_code)
+  DIRFILE * dirfile
+  const char * field_code
+  PREINIT:
+    GDP_DIRFILE_ALIAS;
+  ALIAS:
+    GetData::Dirfile::get_string = 1
+  CODE:
+    dtrace("%p, \"%s\"", dirfile, field_code);
+
+    /* get string length */
+    size_t len = gd_get_string(dirfile, field_code, 0, NULL);
+    RETVAL = safemalloc(len);
+
+    /* get string */
+    gd_get_string(dirfile, field_code, len, RETVAL);
+  OUTPUT:
+    RETVAL
+  CLEANUP:
+    dreturn("\"%s\"", RETVAL);
+    safefree(RETVAL);
+
+int
+close(dirfile)
+  DIRFILE * dirfile
+  PREINIT:
+    GDP_DIRFILE_ALIAS;
+  ALIAS:
+    GetData::Dirfile::close = 1
+  CODE:
+    dtrace("%p", dirfile);
+
+    if (dirfile != gdp_invalid) {
+      RETVAL = gd_close(dirfile);
+
+      if (!RETVAL)
+        gdp_dirfile->D = NULL;
+    } else
+      RETVAL = 0;
+  OUTPUT:
+    RETVAL
+  CLEANUP:
+    dreturn("%i", RETVAL);
+
+int
+discard(dirfile)
+  DIRFILE * dirfile
+  PREINIT:
+    GDP_DIRFILE_ALIAS;
+  ALIAS:
+    GetData::Dirfile::discard = 1
+  CODE:
+    dtrace("%p", dirfile);
+
+    if (dirfile != gdp_invalid) {
+      RETVAL = gd_discard(dirfile);
+
+      if (!RETVAL)
+        gdp_dirfile->D = NULL;
+    } else
+      RETVAL = 0;
+  OUTPUT:
+    RETVAL
+  CLEANUP:
+    dreturn("%i", RETVAL);
+
+void
+getdata(dirfile, field_code, first_frame, first_samp, num_frames, num_samp, return_type)
+  DIRFILE * dirfile
+  const char * field_code
+  off64_t first_frame
+  off64_t first_samp
+  size_t num_frames
+  size_t num_samp
+  gd_type_t return_type
+  PREINIT:
+    void *data_out = NULL;
+    unsigned int spf = 1;
+    GDP_DIRFILE_ALIAS;
+  ALIAS:
+    GetData::Dirfile::getdata = 1
+  PPCODE:
+    dtrace("%p, \"%s\", %lli, %lli, %zi, %zi, %03x; %i", dirfile, field_code,
+        (long long)first_frame, (long long)first_samp, num_frames, num_samp,
+        return_type, (int)GIMME_V);
+
+    if (num_frames) {
+      spf = gd_spf(dirfile, field_code);
+
+      GDP_UNDEF_ON_ERROR();
+    }
+
+    data_out = safemalloc(GD_SIZE(return_type) * (spf * num_frames + num_samp));
+
+    size_t len = gdp64(gd_getdata)(dirfile, field_code, first_frame, first_samp,
+        num_frames, num_samp, return_type, data_out);
+
+    GDP_UNDEF_ON_ERROR(safefree(data_out));
+
+    /* In array context, unpack the array and push it onto the stack, otherwise
+     * just return the packed data */
+    if (GIMME_V == G_ARRAY)
+      sp = (SV **)gdp_unpack(sp, data_out, len, return_type);
+    else
+      XPUSHs(sv_2mortal(newSVpvn(data_out, len * GD_SIZE(return_type))));
+
+    safefree(data_out);
+    dreturnvoid();
+
+void
+field_list(dirfile)
+    DIRFILE * dirfile
+  PREINIT:
+    GDP_DIRFILE_ALIAS;
+  ALIAS:
+    GetData::Dirfile::field_list = 1
+  PPCODE:
+    dtrace("%p; %i", dirfile, (int)GIMME_V);
+
+    /* in array context, return the field list, otherwise return nfields */
+    if (GIMME_V == G_ARRAY) {
+      int i;
+      const char **fl = gd_field_list(dirfile);
+
+      GDP_UNDEF_ON_ERROR();
+
+      for (i = 0; fl[i]; ++i)
+        GDP_PUSHpvz(fl[i]);
+    } else {
+      unsigned int nf = gd_nfields(dirfile);
+
+      GDP_UNDEF_ON_ERROR();
+
+      GDP_PUSHuv(nf);
+    }
+
+    dreturnvoid();
+
+void
+field_list_by_type(dirfile, type)
+    DIRFILE * dirfile
+    gd_entype_t type
+  PREINIT:
+    GDP_DIRFILE_ALIAS;
+  ALIAS:
+    GetData::Dirfile::field_list_by_type = 1
+  PPCODE:
+    dtrace("%p, %i; %i", dirfile, type, (int)GIMME_V);
+
+    /* in array context, return the field list, otherwise return nfields */
+    if (GIMME_V == G_ARRAY) {
+      int i;
+      const char **fl = gd_field_list_by_type(dirfile, type);
+
+      GDP_UNDEF_ON_ERROR();
+
+      for (i = 0; fl[i]; ++i)
+        GDP_PUSHpvz(fl[i]);
+    } else {
+      unsigned int nf = gd_nfields_by_type(dirfile, type);
+
+      GDP_UNDEF_ON_ERROR();
+
+      GDP_PUSHuv(nf);
+    }
+
+    dreturnvoid();
+
+void
+entry_list(dirfile, parent, type, flags)
+    DIRFILE * dirfile
+    gdpu_char * parent
+    gdpu_int    type
+    gdpu_uint_t flags
+  PREINIT:
+    GDP_DIRFILE_ALIAS;
+  ALIAS:
+    GetData::Dirfile::entry_list = 1
+  PPCODE:
+    dtrace("%p, \"%s\", %i, %u; %i", dirfile, parent, type, flags,
+      (int)GIMME_V);
+
+    /* in array context, return the field list, otherwise return nfields */
+    if (GIMME_V == G_ARRAY) {
+      int i;
+      const char **el = gd_entry_list(dirfile, parent, type, flags);
+
+      GDP_UNDEF_ON_ERROR();
+
+      for (i = 0; el[i]; ++i)
+        GDP_PUSHpvz(el[i]);
+    } else {
+      unsigned int ne = gd_nentries(dirfile, parent, type, flags);
+
+      GDP_UNDEF_ON_ERROR();
+
+      GDP_PUSHuv(ne);
+    }
+
+    dreturnvoid();
+
+void
+vector_list(dirfile)
+    DIRFILE * dirfile
+  PREINIT:
+    GDP_DIRFILE_ALIAS;
+  ALIAS:
+    GetData::Dirfile::vector_list = 1
+  PPCODE:
+    dtrace("%p; %i", dirfile, (int)GIMME_V);
+
+    /* in array context, return the field list, otherwise return nfields */
+    if (GIMME_V == G_ARRAY) {
+      int i;
+      const char **fl = gd_vector_list(dirfile);
+
+      GDP_UNDEF_ON_ERROR();
+
+      for (i = 0; fl[i]; ++i)
+        GDP_PUSHpvz(fl[i]);
+    } else {
+      unsigned int nf = gd_nvectors(dirfile);
+
+      GDP_UNDEF_ON_ERROR();
+
+      GDP_PUSHuv(nf);
+    }
+
+    dreturnvoid();
+
+void
+strings(dirfile)
+    DIRFILE * dirfile
+  PREINIT:
+    GDP_DIRFILE_ALIAS;
+  ALIAS:
+    GetData::Dirfile::strings = 1
+  PPCODE:
+    dtrace("%p; %i", dirfile, (int)GIMME_V);
+
+    /* in array context, return the field list, otherwise return nfields */
+    if (GIMME_V == G_ARRAY) {
+      int i;
+      const char **fl = gd_strings(dirfile);
+
+      GDP_UNDEF_ON_ERROR();
+
+      for (i = 0; fl[i]; ++i)
+        GDP_PUSHpvz(fl[i]);
+    } else {
+      unsigned int nf = gd_nfields_by_type(dirfile, GD_STRING_ENTRY);
+
+      GDP_UNDEF_ON_ERROR();
+
+      GDP_PUSHuv(nf);
+    }
+
+    dreturnvoid();
+
+void
+mfield_list(dirfile, field_code)
+  DIRFILE * dirfile
+  const char * field_code
+  PREINIT:
+    GDP_DIRFILE_ALIAS;
+  ALIAS:
+    GetData::Dirfile::mfield_list = 1
+  PPCODE:
+    dtrace("%p, \"%s\"; %i", dirfile, field_code, (int)GIMME_V);
+
+    /* in array context, return the field list, otherwise return nfields */
+    if (GIMME_V == G_ARRAY) {
+      int i;
+      const char **fl = gd_mfield_list(dirfile, field_code);
+
+      GDP_UNDEF_ON_ERROR();
+
+      for (i = 0; fl[i]; ++i)
+        GDP_PUSHpvz(fl[i]);
+    } else {
+      unsigned int nf = gd_nmfields(dirfile, field_code);
+
+      GDP_UNDEF_ON_ERROR();
+
+      GDP_PUSHuv(nf);
+    }
+
+    dreturnvoid();
+
+void
+mfield_list_by_type(dirfile, parent, type)
+    DIRFILE * dirfile
+    const char * parent
+    gd_entype_t type
+  PREINIT:
+    GDP_DIRFILE_ALIAS;
+  ALIAS:
+    GetData::Dirfile::mfield_list_by_type = 1
+  PPCODE:
+    dtrace("%p, \"%s\", %i; %i", dirfile, parent, type, (int)GIMME_V);
+
+    /* in array context, return the field list, otherwise return nfields */
+    if (GIMME_V == G_ARRAY) {
+      int i;
+      const char **fl = gd_mfield_list_by_type(dirfile, parent, type);
+
+      GDP_UNDEF_ON_ERROR();
+
+      for (i = 0; fl[i]; ++i)
+        GDP_PUSHpvz(fl[i]);
+    } else {
+      unsigned int nf = gd_nmfields_by_type(dirfile, parent, type);
+
+      GDP_UNDEF_ON_ERROR();
+
+      GDP_PUSHuv(nf);
+    }
+
+    dreturnvoid();
+
+void
+mvector_list(dirfile, parent)
+    DIRFILE * dirfile
+    const char * parent
+  PREINIT:
+    GDP_DIRFILE_ALIAS;
+  ALIAS:
+    GetData::Dirfile::mvector_list = 1
+  PPCODE:
+    dtrace("%p; %i", dirfile, (int)GIMME_V);
+
+    /* in array context, return the field list, otherwise return nfields */
+    if (GIMME_V == G_ARRAY) {
+      int i;
+      const char **fl = gd_mvector_list(dirfile, parent);
+
+      GDP_UNDEF_ON_ERROR();
+
+      for (i = 0; fl[i]; ++i)
+        GDP_PUSHpvz(fl[i]);
+    } else {
+      unsigned int nf = gd_nmvectors(dirfile, parent);
+
+      GDP_UNDEF_ON_ERROR();
+
+      GDP_PUSHuv(nf);
+    }
+
+    dreturnvoid();
+
+void
+mstrings(dirfile, field_code)
+  DIRFILE * dirfile
+  const char * field_code
+  PREINIT:
+    GDP_DIRFILE_ALIAS;
+  ALIAS:
+    GetData::Dirfile::mstrings = 1
+  PPCODE:
+    dtrace("%p, \"%s\"; %i", dirfile, field_code, (int)GIMME_V);
+
+    /* in array context, return the field list, otherwise return nfields */
+    if (GIMME_V == G_ARRAY) {
+      int i;
+      const char **fl = gd_mstrings(dirfile, field_code);
+
+      GDP_UNDEF_ON_ERROR();
+
+      for (i = 0; fl[i]; ++i)
+        GDP_PUSHpvz(fl[i]);
+    } else {
+      unsigned int nf = gd_nmfields_by_type(dirfile, field_code,
+          GD_STRING_ENTRY);
+
+      GDP_UNDEF_ON_ERROR();
+
+      GDP_PUSHuv(nf);
+    }
+
+    dreturnvoid();
+
+int
+put_carray(dirfile, field_code, d, ...)
+    DIRFILE * dirfile
+    const char * field_code
+    SV *d;
+  PREINIT:
+    GDP_DIRFILE_ALIAS;
+    struct gdp_din din;
+  ALIAS:
+    GetData::Dirfile::put_carray = 1
+  CODE:
+    dtrace("%p, \"%s\", %p, ...[%li]", dirfile, field_code, d, (long)items - 3);
+
+    din = gdp_convert_data(d, items, ax, 2, gdp_package, "put_carray");
+
+    RETVAL = gd_put_carray(dirfile, field_code, din.type, din.data_in);
+
+    GDP_UNDEF_ON_ERROR(if (din.arg_type != GDP_DATA_IN_PACK)
+      safefree(din.data_in));
+  OUTPUT:
+    RETVAL
+  CLEANUP:
+    if (din.arg_type != GDP_DATA_IN_PACK)
+      safefree(din.data_in);
+    dreturn("%i", RETVAL);
+
+int
+put_carray_slice(dirfile, field_code, start, d, ...)
+    DIRFILE * dirfile
+    const char * field_code
+    off64_t start
+    SV *d;
+  PREINIT:
+    GDP_DIRFILE_ALIAS;
+    struct gdp_din din;
+  ALIAS:
+    GetData::Dirfile::put_carray_slice = 1
+  CODE:
+    dtrace("%p, \"%s\", %lli, %p, ...[%li]", dirfile, field_code,
+        (long long)start, d, (long)items - 4);
+
+    din = gdp_convert_data(d, items, ax, 3, gdp_package, "put_carray");
+
+    RETVAL = gd_put_carray_slice(dirfile, field_code, start, din.nsamp,
+        din.type, din.data_in);
+
+    GDP_UNDEF_ON_ERROR(if (din.arg_type != GDP_DATA_IN_PACK)
+      safefree(din.data_in));
+  OUTPUT:
+    RETVAL
+  CLEANUP:
+    if (din.arg_type != GDP_DATA_IN_PACK)
+      safefree(din.data_in);
+    dreturn("%i", RETVAL);
+
+int
+add_carray(dirfile, field_code, const_type, fragment_index, d, ...)
+    DIRFILE * dirfile
+    const char * field_code
+    int fragment_index
+    gd_type_t const_type
+    SV *d
+  PREINIT:
+    GDP_DIRFILE_ALIAS;
+    struct gdp_din din;
+  ALIAS:
+    GetData::Dirfile::add_carray = 1
+  CODE:
+    dtrace("%p, \"%s\", %03x, %i, %p, ...[%li]", dirfile, field_code,
+        const_type, fragment_index, d, (long)items - 5);
+
+    din = gdp_convert_data(d, items, ax, 4, gdp_package, "put_carray");
+
+    RETVAL = gd_add_carray(dirfile, field_code, const_type, din.nsamp,
+        din.type, din.data_in, fragment_index);
+
+    GDP_UNDEF_ON_ERROR(if (din.arg_type != GDP_DATA_IN_PACK)
+      safefree(din.data_in));
+  OUTPUT:
+    RETVAL
+  CLEANUP:
+    if (din.arg_type != GDP_DATA_IN_PACK)
+      safefree(din.data_in);
+    dreturn("%i", RETVAL);
+
+int
+madd_carray(dirfile, parent, field_code, const_type, d, ...)
+    DIRFILE * dirfile
+    const char * parent
+    const char * field_code
+    gd_type_t const_type
+    SV *d
+  PREINIT:
+    GDP_DIRFILE_ALIAS;
+    struct gdp_din din;
+  ALIAS:
+    GetData::Dirfile::madd_carray = 1
+  CODE:
+    dtrace("%p, \"%s\", \"%s\", %03x, %p, ...[%li]", dirfile, parent,
+        field_code, const_type, d, (long)items - 5);
+
+    din = gdp_convert_data(d, items, ax, 4, gdp_package, "put_carray");
+
+    RETVAL = gd_madd_carray(dirfile, parent, field_code, const_type, din.nsamp,
+        din.type, din.data_in);
+
+    GDP_UNDEF_ON_ERROR(if (din.arg_type != GDP_DATA_IN_PACK)
+      safefree(din.data_in));
+  OUTPUT:
+    RETVAL
+  CLEANUP:
+    if (din.arg_type != GDP_DATA_IN_PACK)
+      safefree(din.data_in);
+    dreturn("%i", RETVAL);
+
+size_t
+putdata(dirfile, field_code, first_frame, first_sample, d, ...)
+    DIRFILE * dirfile
+    const char * field_code
+    off64_t first_frame
+    off64_t first_sample
+    SV *d;
+  PREINIT:
+    GDP_DIRFILE_ALIAS;
+    struct gdp_din din;
+  ALIAS:
+    GetData::Dirfile::putdata = 1
+  CODE:
+    dtrace("%p, \"%s\", %lli, %lli, %p, ...[%li]", dirfile, field_code,
+        (long long)first_frame, (long long)first_sample, d, (long)items - 5);
+
+    din = gdp_convert_data(d, items, ax, 4, gdp_package, "putdata");
+
+    RETVAL = gd_putdata(dirfile, field_code, first_frame, first_sample, 0,
+        din.nsamp, din.type, din.data_in);
+
+    GDP_UNDEF_ON_ERROR(if (din.arg_type != GDP_DATA_IN_PACK)
+      safefree(din.data_in));
+  OUTPUT:
+    RETVAL
+  CLEANUP:
+    if (din.arg_type != GDP_DATA_IN_PACK)
+      safefree(din.data_in);
+    dreturn("%zi", RETVAL);
+
+int
+add_const(dirfile, field_code, const_type, value=undef, fragment_index=0)
+  DIRFILE * dirfile
+  const char * field_code
+  gd_type_t const_type
+  SV * value
+  int fragment_index
+  PREINIT:
+    gd_type_t data_type;
+    char data_in[16];
+    GDP_DIRFILE_ALIAS;
+  ALIAS:
+    GetData::Dirfile::add_const = 1
+  CODE:
+    dtrace("%p, \"%s\", %03x, %p, %i", dirfile, field_code, const_type, value,
+        fragment_index);
+
+    data_type = gdp_to_voidp(data_in, value, const_type, gdp_package,
+      "add_const");
+
+    RETVAL = gd_add_const(dirfile, field_code, const_type, data_type, data_in,
+        fragment_index);
+
+    GDP_UNDEF_ON_ERROR();
+  OUTPUT:
+    RETVAL
+  CLEANUP:
+    dreturn("%i", RETVAL);
+
+int
+madd_const(dirfile, parent, field_code, const_type, value=undef)
+  DIRFILE * dirfile
+  const char * parent
+  const char * field_code
+  gd_type_t const_type
+  SV * value
+  PREINIT:
+    gd_type_t data_type;
+    char data_in[16];
+    GDP_DIRFILE_ALIAS;
+  ALIAS:
+    GetData::Dirfile::madd_const = 1
+  CODE:
+    dtrace("%p, \"%s\", \"%s\", %03x, %p", dirfile, parent, field_code,
+        const_type, value);
+
+    data_type = gdp_to_voidp(data_in, value, const_type, gdp_package,
+      "madd_const");
+
+    RETVAL = gd_madd_const(dirfile, parent, field_code, const_type, data_type,
+        data_in);
+
+    GDP_UNDEF_ON_ERROR();
+  OUTPUT:
+    RETVAL
+  CLEANUP:
+    dreturn("%i", RETVAL);
+
+int
+put_constant(dirfile, field_code, value)
+  DIRFILE * dirfile
+  const char * field_code
+  SV * value
+  PREINIT:
+    gd_type_t data_type;
+    char data_in[16];
+    GDP_DIRFILE_ALIAS;
+  ALIAS:
+    GetData::Dirfile::put_constant = 1
+  CODE:
+    dtrace("%p, \"%s\", %p", dirfile, field_code, value);
+
+    data_type = gdp_to_voidp(data_in, value, GD_FLOAT64, gdp_package,
+      "put_constant");
+
+    RETVAL = gd_put_constant(dirfile, field_code, data_type, data_in);
+
+    GDP_UNDEF_ON_ERROR();
+  OUTPUT:
+    RETVAL
+  CLEANUP:
+    dreturn("%i", RETVAL);
+
+void
+fragments(dirfile)
+  DIRFILE * dirfile
+  PREINIT:
+    GDP_DIRFILE_ALIAS;
+    unsigned int nf;
+  ALIAS:
+    GetData::Dirfile::fragments = 1
+  PPCODE:
+    dtrace("%p; %i", dirfile, (int)GIMME_V);
+
+    nf = gd_nfragments(dirfile);
+
+    if (GIMME_V == G_ARRAY) {
+      unsigned int i;
+      for (i = 0; i < nf; ++i)
+        GDP_PUSHpvz(gd_fragmentname(dirfile, i));
+    } else
+      GDP_PUSHuv(nf);
+
+    dreturnvoid();
+
+void
+aliases(dirfile, field_code)
+  DIRFILE * dirfile
+  const char * field_code
+  PREINIT:
+    GDP_DIRFILE_ALIAS;
+  ALIAS:
+    GetData::Dirfile::aliases = 1
+  PPCODE:
+    dtrace("%p, \"%s\"; %i", dirfile, field_code, (int)GIMME_V);
+
+    /* in array context, return the field list, otherwise return naliases */
+    if (GIMME_V == G_ARRAY) {
+      int i;
+      const char **fl = gd_aliases(dirfile, field_code);
+
+      GDP_UNDEF_ON_ERROR();
+
+      for (i = 0; fl[i]; ++i)
+        GDP_PUSHpvz(fl[i]);
+    } else {
+      unsigned int nf = gd_naliases(dirfile, field_code);
+
+      GDP_UNDEF_ON_ERROR();
+
+      GDP_PUSHuv(nf);
+    }
+
+    dreturnvoid();
+
+void
+fragment_affixes(dirfile, fragment_index)
+  DIRFILE * dirfile
+  int fragment_index
+  PREINIT:
+    char *prefix;
+    char *suffix;
+    GDP_DIRFILE_ALIAS;
+  ALIAS:
+    GetData::Dirfile::fragment_affixes = 1
+  PPCODE:
+    dtrace("%p, %i", dirfile, fragment_index);
+
+    gd_fragment_affixes(dirfile, fragment_index, &prefix, &suffix);
+
+    GDP_UNDEF_ON_ERROR();
+
+    GDP_PUSHpvz(prefix);
+    GDP_PUSHpvz(suffix);
+
+    dreturnvoid();
+
+void
+strtok(dirfile, string)
+  DIRFILE * dirfile
+  const char * string
+  PREINIT:
+    int i;
+    char *token;
+    GDP_DIRFILE_ALIAS;
+  ALIAS:
+    GetData::Dirfile::strtok = 1
+  PPCODE:
+    dtrace("%p, \"%s\"", dirfile, string);
+
+    /* return an array of all the parsed tokens */
+    for (token = gd_strtok(dirfile, string); token;
+      token = gd_strtok(dirfile, NULL))
+    {
+      GDP_UNDEF_ON_ERROR();
+
+      GDP_PUSHpvz(token);
+      free(token);
+    }
+
+    dreturnvoid();
+
+int
+include(dirfile, file, fragment_index, flags, prefix=NULL, suffix=NULL)
+	DIRFILE * dirfile
+	const char * file
+	int fragment_index
+	unsigned long int flags
+	gdpu_char * prefix
+	gdpu_char * suffix
+	PREINIT:
+		GDP_DIRFILE_ALIAS;
+	ALIAS:
+		GetData::Dirfile::include = 1
+	CODE:
+		dtrace("%p, \"%s\", %i, %lu, \"%s\", \"%s\"", dirfile, file, fragment_index,
+        flags, prefix, suffix);
+		RETVAL = gd_include_affix(dirfile, file, fragment_index, prefix, suffix,
+        flags);
+		GDP_UNDEF_ON_ERROR();
+	OUTPUT:
+		RETVAL
+	CLEANUP:
+		dreturn("%i", RETVAL);
+
+INCLUDE: simple_funcs.xs
diff --git a/bindings/perl/MANIFEST.in b/bindings/perl/MANIFEST.in
new file mode 100644
index 0000000..c6136cc
--- /dev/null
+++ b/bindings/perl/MANIFEST.in
@@ -0,0 +1,2 @@
+MANIFEST			This list of files
+GetData.pm
diff --git a/bindings/perl/Makefile.am b/bindings/perl/Makefile.am
new file mode 100644
index 0000000..4d0600a
--- /dev/null
+++ b/bindings/perl/Makefile.am
@@ -0,0 +1,103 @@
+# Copyright (C) 2011, 2012 D. V. Wiebe
+#
+##########################################################################
+#
+# This file is part of the GetData project.
+#
+# GetData is free software; you can redistribute it and/or modify it under
+# the terms of the GNU Lesser General Public License as published by the
+# Free Software Foundation; either version 2.1 of the License, or (at your
+# option) any later version.
+#
+# GetData is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+# License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public License
+# along with GetData; if not, write to the Free Software Foundation, Inc.,
+# 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+#
+AUTOMAKE_OPTIONS = foreign
+
+if GETDATA_DEBUG
+TEST_VERBOSE=verbose=1
+endif
+
+plTESTS=t/big_test.t t/callback.t
+PERL_TESTS=$(addprefix ${srcdir}/, $(plTESTS))
+
+EXTRA_DIST=funclist.pl GetData.xs simple_funcs.pl simple_funcs.xsin typemap \
+					 GetData.pm.in MANIFEST.in ${plTESTS}
+
+man3dir=${perlmandir}
+nodist_man3_MANS=blib/libdoc/GetData.$(PERL_MAN3EXT)
+
+nodist_perl_SCRIPTS=blib/lib/GetData.pm
+
+perlautogetdatadir=${perldir}/auto/GetData
+nodist_perlautogetdata_SCRIPTS=blib/arch/auto/GetData/GetData.bs blib/arch/auto/GetData/GetData.so
+
+lib:
+	mkdir -p $@
+
+lib/GetData.xs: GetData.xs
+	$(MAKE) lib
+	cat $(srcdir)/GetData.xs > $@
+
+lib/typemap: typemap
+	$(MAKE) lib
+	cat $(srcdir)/typemap > $@
+
+lib/simple_funcs.xs: simple_funcs.xsin simple_funcs.pl
+	$(MAKE) lib
+	$(PERL) $(srcdir)/simple_funcs.pl $(srcdir)/simple_funcs.xsin > $@
+
+MANIFEST: MANIFEST.in
+	cat $(srcdir)/MANIFEST.in > $@
+
+make_parameters.sed: ../make_parameters ../../src/getdata.h
+	  ../make_parameters P > $@
+
+../make_parameters: ../make_parameters.c ../../src/gd_config.h
+	  cd .. && ${MAKE} make_parameters
+
+GetData.pm: GetData.pm.in make_parameters.sed funclist.pl lib/GetData.xs \
+	lib/simple_funcs.xs
+	rm -f $@
+	$(SED) -f make_parameters.sed $(srcdir)/GetData.pm.in | \
+		$(PERL) $(srcdir)/funclist.pl lib/GetData.xs lib/simple_funcs.xs > $@
+	chmod a-w $@
+
+blib/arch/auto/GetData/GetData.bs blib/arch/auto/GetData/GetData.so \
+	blib/lib/GetData.pm blib/libdoc/GetData.$(PERL_MAN3EXT): build.stamp
+	
+build.stamp: Build lib/GetData.xs lib/simple_funcs.xs lib/typemap
+	$(PERL) Build build
+	touch $@
+
+.PRECIOUS: Build
+Build: Build.PL GetData.pm lib/GetData.xs lib/simple_funcs.xs lib/typemap \
+	MANIFEST
+	$(PERL) Build.PL
+
+clean-local: 
+	rm -rf lib blib
+	if test -e Build; then \
+		$(PERL) Build clean || true; \
+	fi
+	rm -f $(BUILT_SOURCES) make_parameters.sed MYMETA.yml MYMETA.json GetData.pm
+	rm -rf Build _build MANIFEST build.stamp t/*~
+
+uninstall-hook:
+	rmdir $(DESTDIR)${perlautogetdatadir}
+
+if TEST_PERL
+check: $(PERL_TESTS)
+	${DL_LIBRARY_PATH}=${${DL_LIBRARY_PATH}}:../../src/.libs $(PERL) ./Build test ${TEST_VERBOSE}
+
+testdb testcover: $(PERL_TESTS)
+	${DL_LIBRARY_PATH}=${${DL_LIBRARY_PATH}}:../../src/.libs $(PERL) ./Build $@ ${TEST_VERBOSE}
+
+.PHONY: check testdb testcover
+endif
diff --git a/bindings/perl/Makefile.in b/bindings/perl/Makefile.in
new file mode 100644
index 0000000..0e0ec7f
--- /dev/null
+++ b/bindings/perl/Makefile.in
@@ -0,0 +1,742 @@
+# Makefile.in generated by automake 1.11.5 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software
+# Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+ at SET_MAKE@
+
+VPATH = @srcdir@
+am__make_dryrun = \
+  { \
+    am__dry=no; \
+    case $$MAKEFLAGS in \
+      *\\[\ \	]*) \
+        echo 'am--echo: ; @echo "AM"  OK' | $(MAKE) -f - 2>/dev/null \
+          | grep '^AM OK$$' >/dev/null || am__dry=yes;; \
+      *) \
+        for am__flg in $$MAKEFLAGS; do \
+          case $$am__flg in \
+            *=*|--*) ;; \
+            *n*) am__dry=yes; break;; \
+          esac; \
+        done;; \
+    esac; \
+    test $$am__dry = yes; \
+  }
+pkgdatadir = $(datadir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkglibexecdir = $(libexecdir)/@PACKAGE@
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+subdir = bindings/perl
+DIST_COMMON = $(srcdir)/Build.PL.in $(srcdir)/Makefile.am \
+	$(srcdir)/Makefile.in
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/m4/ax_compare_version.m4 \
+	$(top_srcdir)/m4/compiler.m4 $(top_srcdir)/m4/encoding.m4 \
+	$(top_srcdir)/m4/floatordering.m4 $(top_srcdir)/m4/idl.m4 \
+	$(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \
+	$(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \
+	$(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/m4/matlab.m4 \
+	$(top_srcdir)/m4/perl.m4 $(top_srcdir)/m4/python.m4 \
+	$(top_srcdir)/m4/win32.m4 $(top_srcdir)/m4/version.m4 \
+	$(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+	$(ACLOCAL_M4)
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = $(top_builddir)/src/gd_config.h \
+	$(top_builddir)/src/getdata.h
+CONFIG_CLEAN_FILES = Build.PL
+CONFIG_CLEAN_VPATH_FILES =
+am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
+am__vpath_adj = case $$p in \
+    $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
+    *) f=$$p;; \
+  esac;
+am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`;
+am__install_max = 40
+am__nobase_strip_setup = \
+  srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'`
+am__nobase_strip = \
+  for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||"
+am__nobase_list = $(am__nobase_strip_setup); \
+  for p in $$list; do echo "$$p $$p"; done | \
+  sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \
+  $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \
+    if (++n[$$2] == $(am__install_max)) \
+      { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \
+    END { for (dir in files) print dir, files[dir] }'
+am__base_list = \
+  sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \
+  sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
+am__uninstall_files_from_dir = { \
+  test -z "$$files" \
+    || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \
+    || { echo " ( cd '$$dir' && rm -f" $$files ")"; \
+         $(am__cd) "$$dir" && rm -f $$files; }; \
+  }
+am__installdirs = "$(DESTDIR)$(perldir)" \
+	"$(DESTDIR)$(perlautogetdatadir)" "$(DESTDIR)$(man3dir)"
+SCRIPTS = $(nodist_perl_SCRIPTS) $(nodist_perlautogetdata_SCRIPTS)
+SOURCES =
+DIST_SOURCES =
+am__can_run_installinfo = \
+  case $$AM_UPDATE_INFO_DIR in \
+    n|no|NO) false;; \
+    *) (install-info --version) >/dev/null 2>&1;; \
+  esac
+NROFF = nroff
+MANS = $(nodist_man3_MANS)
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+AMTAR = @AMTAR@
+AR = @AR@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+BUILDCC = @BUILDCC@
+BZIP2_CPPFLAGS = @BZIP2_CPPFLAGS@
+BZIP2_LDFLAGS = @BZIP2_LDFLAGS@
+BZIP2_LIBS = @BZIP2_LIBS@
+CC = @CC@
+CCAS = @CCAS@
+CCASDEPMODE = @CCASDEPMODE@
+CCASFLAGS = @CCASFLAGS@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DATE = @DATE@
+DEFINE_GD_LEGACY_API = @DEFINE_GD_LEGACY_API@
+DEFINE_GD_NO_C99_API = @DEFINE_GD_NO_C99_API@
+DEFINE_gd_int16_t = @DEFINE_gd_int16_t@
+DEFINE_gd_int64_t = @DEFINE_gd_int64_t@
+DEFINE_gd_uint16_t = @DEFINE_gd_uint16_t@
+DEFINE_gd_uint64_t = @DEFINE_gd_uint64_t@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+DIFF = @DIFF@
+DLLTOOL = @DLLTOOL@
+DL_LIBRARY_PATH = @DL_LIBRARY_PATH@
+DSYMUTIL = @DSYMUTIL@
+DUMPBIN = @DUMPBIN@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+F77 = @F77@
+F95GETDATA_VERSION = @F95GETDATA_VERSION@
+FC = @FC@
+FCFLAGS = @FCFLAGS@
+FFLAGS = @FFLAGS@
+FGETDATA_VERSION = @FGETDATA_VERSION@
+FGREP = @FGREP@
+FLIBS = @FLIBS@
+GD_DIRSEP = @GD_DIRSEP@
+GD_FDIRSEP = @GD_FDIRSEP@
+GETDATAXX_VERSION = @GETDATAXX_VERSION@
+GETDATA_DEBUG = @GETDATA_DEBUG@
+GETDATA_IFACE_AGE = @GETDATA_IFACE_AGE@
+GETDATA_IFACE_VERSION = @GETDATA_IFACE_VERSION@
+GETDATA_IMPL_REVISION = @GETDATA_IMPL_REVISION@
+GETDATA_MAJOR = @GETDATA_MAJOR@
+GETDATA_MINOR = @GETDATA_MINOR@
+GETDATA_REVISION = @GETDATA_REVISION@
+GETDATA_VERSION_SUFFIX = @GETDATA_VERSION_SUFFIX@
+GREP = @GREP@
+GZIP_CPPFLAGS = @GZIP_CPPFLAGS@
+GZIP_LDFLAGS = @GZIP_LDFLAGS@
+GZIP_LIBS = @GZIP_LIBS@
+IDL = @IDL@
+IDL_CFLAGS = @IDL_CFLAGS@
+IDL_LIBS = @IDL_LIBS@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+JOT = @JOT@
+LD = @LD@
+LDFLAGS = @LDFLAGS@
+LIBLTDL = @LIBLTDL@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LIBTOOL_DEPS = @LIBTOOL_DEPS@
+LIPO = @LIPO@
+LN_S = @LN_S@
+LTDLINCL = @LTDLINCL@
+LTLIBOBJS = @LTLIBOBJS@
+LZMA_CPPFLAGS = @LZMA_CPPFLAGS@
+LZMA_LDFLAGS = @LZMA_LDFLAGS@
+LZMA_LIBS = @LZMA_LIBS@
+MAKEINFO = @MAKEINFO@
+MANIFEST_TOOL = @MANIFEST_TOOL@
+MATLAB = @MATLAB@
+MATLABGETDATA_VERSION = @MATLABGETDATA_VERSION@
+MATLAB_CPPFLAGS = @MATLAB_CPPFLAGS@
+MEX = @MEX@
+MKDIR_P = @MKDIR_P@
+NM = @NM@
+NMEDIT = @NMEDIT@
+NUMPY_CPPFLAGS = @NUMPY_CPPFLAGS@
+OBJDUMP = @OBJDUMP@
+OBJEXT = @OBJEXT@
+OTOOL = @OTOOL@
+OTOOL64 = @OTOOL64@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_URL = @PACKAGE_URL@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PERL = @PERL@
+PERL_MAN3EXT = @PERL_MAN3EXT@
+PRINTF = @PRINTF@
+PRIVATE_LIBS = @PRIVATE_LIBS@
+PYTHON = @PYTHON@
+PYTHON_CPPFLAGS = @PYTHON_CPPFLAGS@
+PYTHON_LIBS = @PYTHON_LIBS@
+RANLIB = @RANLIB@
+SED = @SED@
+SEQ = @SEQ@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+SLIM_CPPFLAGS = @SLIM_CPPFLAGS@
+SLIM_LDFLAGS = @SLIM_LDFLAGS@
+SLIM_LIBS = @SLIM_LIBS@
+STRIP = @STRIP@
+VERSION = @VERSION@
+ZZIP_CPPFLAGS = @ZZIP_CPPFLAGS@
+ZZIP_LDFLAGS = @ZZIP_LDFLAGS@
+ZZIP_LIBS = @ZZIP_LIBS@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+absolute_docdir = @absolute_docdir@
+ac_ct_AR = @ac_ct_AR@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
+ac_ct_F77 = @ac_ct_F77@
+ac_ct_FC = @ac_ct_FC@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+builddir = @builddir@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+idldir = @idldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+mandir = @mandir@
+matlabbasedir = @matlabbasedir@
+mexext = @mexext@
+mkdir_p = @mkdir_p@
+moduledir = @moduledir@
+oldincludedir = @oldincludedir@
+path_bunzip2 = @path_bunzip2@
+path_bzip2 = @path_bzip2@
+path_gunzip = @path_gunzip@
+path_gzip = @path_gzip@
+path_slim = @path_slim@
+path_unslim = @path_unslim@
+path_unzip = @path_unzip@
+path_xz = @path_xz@
+path_zip = @path_zip@
+pdfdir = @pdfdir@
+perldir = @perldir@
+perlmandir = @perlmandir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+pythondir = @pythondir@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+top_build_prefix = @top_build_prefix@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+
+# Copyright (C) 2011, 2012 D. V. Wiebe
+#
+##########################################################################
+#
+# This file is part of the GetData project.
+#
+# GetData is free software; you can redistribute it and/or modify it under
+# the terms of the GNU Lesser General Public License as published by the
+# Free Software Foundation; either version 2.1 of the License, or (at your
+# option) any later version.
+#
+# GetData is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+# License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public License
+# along with GetData; if not, write to the Free Software Foundation, Inc.,
+# 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+#
+AUTOMAKE_OPTIONS = foreign
+ at GETDATA_DEBUG_TRUE@TEST_VERBOSE = verbose=1
+plTESTS = t/big_test.t t/callback.t
+PERL_TESTS = $(addprefix ${srcdir}/, $(plTESTS))
+EXTRA_DIST = funclist.pl GetData.xs simple_funcs.pl simple_funcs.xsin typemap \
+					 GetData.pm.in MANIFEST.in ${plTESTS}
+
+man3dir = ${perlmandir}
+nodist_man3_MANS = blib/libdoc/GetData.$(PERL_MAN3EXT)
+nodist_perl_SCRIPTS = blib/lib/GetData.pm
+perlautogetdatadir = ${perldir}/auto/GetData
+nodist_perlautogetdata_SCRIPTS = blib/arch/auto/GetData/GetData.bs blib/arch/auto/GetData/GetData.so
+all: all-am
+
+.SUFFIXES:
+$(srcdir)/Makefile.in:  $(srcdir)/Makefile.am  $(am__configure_deps)
+	@for dep in $?; do \
+	  case '$(am__configure_deps)' in \
+	    *$$dep*) \
+	      ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
+	        && { if test -f $@; then exit 0; else break; fi; }; \
+	      exit 1;; \
+	  esac; \
+	done; \
+	echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign bindings/perl/Makefile'; \
+	$(am__cd) $(top_srcdir) && \
+	  $(AUTOMAKE) --foreign bindings/perl/Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+	@case '$?' in \
+	  *config.status*) \
+	    cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+	  *) \
+	    echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+	    cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+	esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure:  $(am__configure_deps)
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4):  $(am__aclocal_m4_deps)
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(am__aclocal_m4_deps):
+Build.PL: $(top_builddir)/config.status $(srcdir)/Build.PL.in
+	cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@
+install-nodist_perlSCRIPTS: $(nodist_perl_SCRIPTS)
+	@$(NORMAL_INSTALL)
+	@list='$(nodist_perl_SCRIPTS)'; test -n "$(perldir)" || list=; \
+	if test -n "$$list"; then \
+	  echo " $(MKDIR_P) '$(DESTDIR)$(perldir)'"; \
+	  $(MKDIR_P) "$(DESTDIR)$(perldir)" || exit 1; \
+	fi; \
+	for p in $$list; do \
+	  if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+	  if test -f "$$d$$p"; then echo "$$d$$p"; echo "$$p"; else :; fi; \
+	done | \
+	sed -e 'p;s,.*/,,;n' \
+	    -e 'h;s|.*|.|' \
+	    -e 'p;x;s,.*/,,;$(transform)' | sed 'N;N;N;s,\n, ,g' | \
+	$(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1; } \
+	  { d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \
+	    if ($$2 == $$4) { files[d] = files[d] " " $$1; \
+	      if (++n[d] == $(am__install_max)) { \
+		print "f", d, files[d]; n[d] = 0; files[d] = "" } } \
+	    else { print "f", d "/" $$4, $$1 } } \
+	  END { for (d in files) print "f", d, files[d] }' | \
+	while read type dir files; do \
+	     if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \
+	     test -z "$$files" || { \
+	       echo " $(INSTALL_SCRIPT) $$files '$(DESTDIR)$(perldir)$$dir'"; \
+	       $(INSTALL_SCRIPT) $$files "$(DESTDIR)$(perldir)$$dir" || exit $$?; \
+	     } \
+	; done
+
+uninstall-nodist_perlSCRIPTS:
+	@$(NORMAL_UNINSTALL)
+	@list='$(nodist_perl_SCRIPTS)'; test -n "$(perldir)" || exit 0; \
+	files=`for p in $$list; do echo "$$p"; done | \
+	       sed -e 's,.*/,,;$(transform)'`; \
+	dir='$(DESTDIR)$(perldir)'; $(am__uninstall_files_from_dir)
+install-nodist_perlautogetdataSCRIPTS: $(nodist_perlautogetdata_SCRIPTS)
+	@$(NORMAL_INSTALL)
+	@list='$(nodist_perlautogetdata_SCRIPTS)'; test -n "$(perlautogetdatadir)" || list=; \
+	if test -n "$$list"; then \
+	  echo " $(MKDIR_P) '$(DESTDIR)$(perlautogetdatadir)'"; \
+	  $(MKDIR_P) "$(DESTDIR)$(perlautogetdatadir)" || exit 1; \
+	fi; \
+	for p in $$list; do \
+	  if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+	  if test -f "$$d$$p"; then echo "$$d$$p"; echo "$$p"; else :; fi; \
+	done | \
+	sed -e 'p;s,.*/,,;n' \
+	    -e 'h;s|.*|.|' \
+	    -e 'p;x;s,.*/,,;$(transform)' | sed 'N;N;N;s,\n, ,g' | \
+	$(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1; } \
+	  { d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \
+	    if ($$2 == $$4) { files[d] = files[d] " " $$1; \
+	      if (++n[d] == $(am__install_max)) { \
+		print "f", d, files[d]; n[d] = 0; files[d] = "" } } \
+	    else { print "f", d "/" $$4, $$1 } } \
+	  END { for (d in files) print "f", d, files[d] }' | \
+	while read type dir files; do \
+	     if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \
+	     test -z "$$files" || { \
+	       echo " $(INSTALL_SCRIPT) $$files '$(DESTDIR)$(perlautogetdatadir)$$dir'"; \
+	       $(INSTALL_SCRIPT) $$files "$(DESTDIR)$(perlautogetdatadir)$$dir" || exit $$?; \
+	     } \
+	; done
+
+uninstall-nodist_perlautogetdataSCRIPTS:
+	@$(NORMAL_UNINSTALL)
+	@list='$(nodist_perlautogetdata_SCRIPTS)'; test -n "$(perlautogetdatadir)" || exit 0; \
+	files=`for p in $$list; do echo "$$p"; done | \
+	       sed -e 's,.*/,,;$(transform)'`; \
+	dir='$(DESTDIR)$(perlautogetdatadir)'; $(am__uninstall_files_from_dir)
+
+mostlyclean-libtool:
+	-rm -f *.lo
+
+clean-libtool:
+	-rm -rf .libs _libs
+install-man3: $(nodist_man3_MANS)
+	@$(NORMAL_INSTALL)
+	@list1='$(nodist_man3_MANS)'; \
+	list2=''; \
+	test -n "$(man3dir)" \
+	  && test -n "`echo $$list1$$list2`" \
+	  || exit 0; \
+	echo " $(MKDIR_P) '$(DESTDIR)$(man3dir)'"; \
+	$(MKDIR_P) "$(DESTDIR)$(man3dir)" || exit 1; \
+	{ for i in $$list1; do echo "$$i"; done;  \
+	if test -n "$$list2"; then \
+	  for i in $$list2; do echo "$$i"; done \
+	    | sed -n '/\.3[a-z]*$$/p'; \
+	fi; \
+	} | while read p; do \
+	  if test -f $$p; then d=; else d="$(srcdir)/"; fi; \
+	  echo "$$d$$p"; echo "$$p"; \
+	done | \
+	sed -e 'n;s,.*/,,;p;h;s,.*\.,,;s,^[^3][0-9a-z]*$$,3,;x' \
+	      -e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,' | \
+	sed 'N;N;s,\n, ,g' | { \
+	list=; while read file base inst; do \
+	  if test "$$base" = "$$inst"; then list="$$list $$file"; else \
+	    echo " $(INSTALL_DATA) '$$file' '$(DESTDIR)$(man3dir)/$$inst'"; \
+	    $(INSTALL_DATA) "$$file" "$(DESTDIR)$(man3dir)/$$inst" || exit $$?; \
+	  fi; \
+	done; \
+	for i in $$list; do echo "$$i"; done | $(am__base_list) | \
+	while read files; do \
+	  test -z "$$files" || { \
+	    echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(man3dir)'"; \
+	    $(INSTALL_DATA) $$files "$(DESTDIR)$(man3dir)" || exit $$?; }; \
+	done; }
+
+uninstall-man3:
+	@$(NORMAL_UNINSTALL)
+	@list='$(nodist_man3_MANS)'; test -n "$(man3dir)" || exit 0; \
+	files=`{ for i in $$list; do echo "$$i"; done; \
+	} | sed -e 's,.*/,,;h;s,.*\.,,;s,^[^3][0-9a-z]*$$,3,;x' \
+	      -e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,'`; \
+	dir='$(DESTDIR)$(man3dir)'; $(am__uninstall_files_from_dir)
+tags: TAGS
+TAGS:
+
+ctags: CTAGS
+CTAGS:
+
+
+distdir: $(DISTFILES)
+	@list='$(MANS)'; if test -n "$$list"; then \
+	  list=`for p in $$list; do \
+	    if test -f $$p; then d=; else d="$(srcdir)/"; fi; \
+	    if test -f "$$d$$p"; then echo "$$d$$p"; else :; fi; done`; \
+	  if test -n "$$list" && \
+	    grep 'ab help2man is required to generate this page' $$list >/dev/null; then \
+	    echo "error: found man pages containing the \`missing help2man' replacement text:" >&2; \
+	    grep -l 'ab help2man is required to generate this page' $$list | sed 's/^/         /' >&2; \
+	    echo "       to fix them, install help2man, remove and regenerate the man pages;" >&2; \
+	    echo "       typically \`make maintainer-clean' will remove them" >&2; \
+	    exit 1; \
+	  else :; fi; \
+	else :; fi
+	@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+	topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+	list='$(DISTFILES)'; \
+	  dist_files=`for file in $$list; do echo $$file; done | \
+	  sed -e "s|^$$srcdirstrip/||;t" \
+	      -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+	case $$dist_files in \
+	  */*) $(MKDIR_P) `echo "$$dist_files" | \
+			   sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+			   sort -u` ;; \
+	esac; \
+	for file in $$dist_files; do \
+	  if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+	  if test -d $$d/$$file; then \
+	    dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+	    if test -d "$(distdir)/$$file"; then \
+	      find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+	    fi; \
+	    if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+	      cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
+	      find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+	    fi; \
+	    cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
+	  else \
+	    test -f "$(distdir)/$$file" \
+	    || cp -p $$d/$$file "$(distdir)/$$file" \
+	    || exit 1; \
+	  fi; \
+	done
+check-am: all-am
+check: check-am
+all-am: Makefile $(SCRIPTS) $(MANS)
+installdirs:
+	for dir in "$(DESTDIR)$(perldir)" "$(DESTDIR)$(perlautogetdatadir)" "$(DESTDIR)$(man3dir)"; do \
+	  test -z "$$dir" || $(MKDIR_P) "$$dir"; \
+	done
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+	@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+	if test -z '$(STRIP)'; then \
+	  $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+	    install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+	      install; \
+	else \
+	  $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+	    install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+	    "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
+	fi
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+	-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+	-test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
+
+maintainer-clean-generic:
+	@echo "This command is intended for maintainers to use"
+	@echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-generic clean-libtool clean-local mostlyclean-am
+
+distclean: distclean-am
+	-rm -f Makefile
+distclean-am: clean-am distclean-generic
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+html-am:
+
+info: info-am
+
+info-am:
+
+install-data-am: install-man install-nodist_perlSCRIPTS \
+	install-nodist_perlautogetdataSCRIPTS
+
+install-dvi: install-dvi-am
+
+install-dvi-am:
+
+install-exec-am:
+
+install-html: install-html-am
+
+install-html-am:
+
+install-info: install-info-am
+
+install-info-am:
+
+install-man: install-man3
+
+install-pdf: install-pdf-am
+
+install-pdf-am:
+
+install-ps: install-ps-am
+
+install-ps-am:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+	-rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-generic mostlyclean-libtool
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am: uninstall-man uninstall-nodist_perlSCRIPTS \
+	uninstall-nodist_perlautogetdataSCRIPTS
+	@$(NORMAL_INSTALL)
+	$(MAKE) $(AM_MAKEFLAGS) uninstall-hook
+uninstall-man: uninstall-man3
+
+.MAKE: install-am install-strip uninstall-am
+
+.PHONY: all all-am check check-am clean clean-generic clean-libtool \
+	clean-local distclean distclean-generic distclean-libtool \
+	distdir dvi dvi-am html html-am info info-am install \
+	install-am install-data install-data-am install-dvi \
+	install-dvi-am install-exec install-exec-am install-html \
+	install-html-am install-info install-info-am install-man \
+	install-man3 install-nodist_perlSCRIPTS \
+	install-nodist_perlautogetdataSCRIPTS install-pdf \
+	install-pdf-am install-ps install-ps-am install-strip \
+	installcheck installcheck-am installdirs maintainer-clean \
+	maintainer-clean-generic mostlyclean mostlyclean-generic \
+	mostlyclean-libtool pdf pdf-am ps ps-am uninstall uninstall-am \
+	uninstall-hook uninstall-man uninstall-man3 \
+	uninstall-nodist_perlSCRIPTS \
+	uninstall-nodist_perlautogetdataSCRIPTS
+
+
+lib:
+	mkdir -p $@
+
+lib/GetData.xs: GetData.xs
+	$(MAKE) lib
+	cat $(srcdir)/GetData.xs > $@
+
+lib/typemap: typemap
+	$(MAKE) lib
+	cat $(srcdir)/typemap > $@
+
+lib/simple_funcs.xs: simple_funcs.xsin simple_funcs.pl
+	$(MAKE) lib
+	$(PERL) $(srcdir)/simple_funcs.pl $(srcdir)/simple_funcs.xsin > $@
+
+MANIFEST: MANIFEST.in
+	cat $(srcdir)/MANIFEST.in > $@
+
+make_parameters.sed: ../make_parameters ../../src/getdata.h
+	  ../make_parameters P > $@
+
+../make_parameters: ../make_parameters.c ../../src/gd_config.h
+	  cd .. && ${MAKE} make_parameters
+
+GetData.pm: GetData.pm.in make_parameters.sed funclist.pl lib/GetData.xs \
+	lib/simple_funcs.xs
+	rm -f $@
+	$(SED) -f make_parameters.sed $(srcdir)/GetData.pm.in | \
+		$(PERL) $(srcdir)/funclist.pl lib/GetData.xs lib/simple_funcs.xs > $@
+	chmod a-w $@
+
+blib/arch/auto/GetData/GetData.bs blib/arch/auto/GetData/GetData.so \
+	blib/lib/GetData.pm blib/libdoc/GetData.$(PERL_MAN3EXT): build.stamp
+
+build.stamp: Build lib/GetData.xs lib/simple_funcs.xs lib/typemap
+	$(PERL) Build build
+	touch $@
+
+.PRECIOUS: Build
+Build: Build.PL GetData.pm lib/GetData.xs lib/simple_funcs.xs lib/typemap \
+	MANIFEST
+	$(PERL) Build.PL
+
+clean-local: 
+	rm -rf lib blib
+	if test -e Build; then \
+		$(PERL) Build clean || true; \
+	fi
+	rm -f $(BUILT_SOURCES) make_parameters.sed MYMETA.yml MYMETA.json GetData.pm
+	rm -rf Build _build MANIFEST build.stamp t/*~
+
+uninstall-hook:
+	rmdir $(DESTDIR)${perlautogetdatadir}
+
+ at TEST_PERL_TRUE@check: $(PERL_TESTS)
+ at TEST_PERL_TRUE@	${DL_LIBRARY_PATH}=${${DL_LIBRARY_PATH}}:../../src/.libs $(PERL) ./Build test ${TEST_VERBOSE}
+
+ at TEST_PERL_TRUE@testdb testcover: $(PERL_TESTS)
+ at TEST_PERL_TRUE@	${DL_LIBRARY_PATH}=${${DL_LIBRARY_PATH}}:../../src/.libs $(PERL) ./Build $@ ${TEST_VERBOSE}
+
+ at TEST_PERL_TRUE@.PHONY: check testdb testcover
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/bindings/perl/funclist.pl b/bindings/perl/funclist.pl
new file mode 100644
index 0000000..2f61a80
--- /dev/null
+++ b/bindings/perl/funclist.pl
@@ -0,0 +1,19 @@
+use strict;
+use warnings;
+
+my $preamble = 1;
+
+# Generate the list
+my @funclist;
+for (<>) {
+  $preamble = 0 if (/^MODULE/);
+  next if $preamble;
+  next unless /^(\w*)\(/;
+  push @funclist, $1;
+}
+my $funclist = join(' ', sort @funclist);
+
+for (<STDIN>) {
+  s/\@FUNCLIST@/$funclist/g;
+  print $_;
+}
diff --git a/bindings/perl/simple_funcs.pl b/bindings/perl/simple_funcs.pl
new file mode 100644
index 0000000..4864a42
--- /dev/null
+++ b/bindings/perl/simple_funcs.pl
@@ -0,0 +1,160 @@
+#!/usr/bin/perl -w
+# Copyright (C) 2011-2013 D. V. Wiebe
+#
+##########################################################################
+#
+# This file is part of the GetData project.
+#
+# GetData is free software; you can redistribute it and/or modify it under
+# the terms of the GNU Lesser General Public License as published by the
+# Free Software Foundation; either version 2.1 of the License, or (at your
+# option) any later version.
+#
+# GetData is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+# License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public License
+# along with GetData; if not, write to the Free Software Foundation, Inc.,
+# 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+#
+use strict;
+use warnings;
+
+my %rec;
+my $i;
+
+sub printcleanup {
+  $_ = shift;
+  my ($t, $n) = @$_;
+
+  return "\t\tsafefree($n);\n" if (
+    $t eq "gdp_complex_in" or $t eq "const char **" or $t eq "gdp_data_in *"
+      or $t eq "gdp_double_in *"
+  );
+  return "";
+}
+
+sub printmunge {
+  $_ = shift;
+  my ($t, $n) = @$_;
+
+  return "&$n" if ($t =~ /&$/);
+  return "(long long)$n" if ($t eq "off64_t" or $t eq "gd_shift_t" or
+    $t eq "gdpu_shift_t" or $t eq "int64_t");
+  return "(unsigned long long)$n" if ($t eq "uint64_t");
+  return "creal($n), cimag($n)" if ($t eq "_Complex double" or
+    $t eq "gdpu_complex");
+  return "$n.r, (unsigned long long)$n.u, (long long)$n.i"
+  if ($t eq "gd_triplet_t");
+  return $n;
+}
+
+sub printfmt {
+  $_ = shift;
+  s/^const //g;
+
+  if (/char \*$/) {
+    return "\\\"%s\\\"";
+  } elsif (/[\*&]$/ or $_ eq "gdp_complex_in") {
+    return "%p";
+  } elsif ($_ eq "_Complex double" or $_ eq "gdpu_complex") {
+    return "%g;%g";
+  } elsif ($_ eq "double") {
+    return "%g";
+  } elsif ($_ eq "gdpu_bitnum_t" or $_ eq "gdpu_numbits_t"
+      or $_ eq "gd_windop_t")
+  {
+    return "%i";
+  } elsif ($_ eq "gd_entype_t") {
+    return "%02x";
+  } elsif ($_ eq "gd_shift_t" or $_ eq "gdpu_shift_t") {
+    return "%lli";
+  } elsif ($_ eq "gdpu_uint_t") {
+    return "%u";
+  } elsif ($_ eq "gd_type_t" or $_ eq "gdpu_type_t") {
+    return "%03x";
+  } elsif ($_ eq "int" or $_ eq "gdpu_int") {
+    return "%i";
+  } elsif ($_ eq "off64_t") {
+    return "%lli";
+  } elsif ($_ eq "size_t") {
+    return "%zi";
+  } elsif ($_ eq "unsigned int") {
+    return "%u";
+  } elsif ($_ eq "unsigned long int") {
+    return "%lu";
+  } elsif ($_ eq "gd_triplet_t") {
+    return "{%g,%llX,%lli}";
+  } else {
+    die "Can't format \"$_\"";
+  }
+}
+
+while (<>) {
+  chomp;
+  until (/\)/) {
+    $_ .= " " . <>;
+    chomp;
+  }
+
+  my ($ret, $func, $args) = /(.*?) *([:\w]+)\((.*)\)/;
+  die "Spurious gd_" if ($func =~ /^gd_/);
+  my $lfs = ($func =~ /64$/);
+  $func =~ s/64$// if ($lfs);
+  my $name = $func;
+  if ($func =~ /:/) {
+    ($func, $name) = $func =~ /(.*):(.*)/;
+  }
+
+  die $_ unless $args;
+  my @args = split ",", $args;
+
+  my (@argtype, @arg);
+  my $arglist = undef;
+  my $prmlist = undef;
+  for (@args) {
+    my ($t, $n, $d) = /\s*(.*?)\s*(\w+)(?:=(.*))?$/;
+    push @argtype, $t;
+    push @arg, [ $t, $n ];
+    $_ = "$t $n";
+    $arglist .= ", " if $arglist;
+    $prmlist .= ", " if $prmlist;
+    $arglist .= "&" if ($t =~ /&$/);
+    $arglist .= $n;
+    $prmlist .= $n;
+    $prmlist .= "=$d" if defined $d;
+  }
+  s/^\s*// for @args;
+
+  print "$ret\n$name($prmlist)\n\t", join("\n\t", @args), "\n";
+  print "\tPREINIT:\n\t\tGDP_DIRFILE_ALIAS;\n" . 
+        "\tALIAS:\n\t\tGetData::Dirfile::$name = 1\n"
+    if ($args[0] =~ /DIRFILE/);
+
+  print "\tCODE:\n\t\tdtrace(\"", join(", ", map(printfmt($_), @argtype));
+  print "\", ", join(", ", map(printmunge($_), @arg)), ");\n";
+
+  print "\t\t";
+  if ($ret ne "void") {
+    print "RETVAL = ";
+  }
+  print (($lfs) ? "gdp64(gd_$func)" : "gd_$func");
+  print "($arglist);\n";
+
+  if ($ret ne "void") {
+    print "\t\tGDP_UNDEF_ON_ERROR();\n";
+    print "\tOUTPUT:\n\t\tRETVAL\n";
+  }
+
+  print "\tCLEANUP:\n", map(printcleanup($_), @arg);
+  if ($ret eq "void") {
+    print "\t\tdreturnvoid();\n";
+  } else {
+    print "\t\tdreturn(\"", &printfmt($ret), "\", ";
+    print &printmunge([$ret, "RETVAL"]), ");\n";
+  }
+  print "\t\tsafefree(RETVAL);\n" if $ret eq "char *";
+  print "\n";
+}
diff --git a/bindings/perl/simple_funcs.xsin b/bindings/perl/simple_funcs.xsin
new file mode 100644
index 0000000..bb365af
--- /dev/null
+++ b/bindings/perl/simple_funcs.xsin
@@ -0,0 +1,157 @@
+int add_bit(DIRFILE *dirfile, const char *field_code, const char *in_field,
+    int bitnum, int numbits, int fragment_index=0)
+int add_clincom:add_lincom(DIRFILE *dirfile, const char *field_code,
+    int n_fields, const char **in_fields, gdp_complex_in cm,
+    gdp_complex_in cb, int fragment_index=0)
+int add_cpolynom:add_polynom(DIRFILE *dirfile, const char *field_code,
+    int poly_ord, const char *in_field, gdp_complex_in ca,
+    int fragment_index=0)
+int add_crecip:add_recip(DIRFILE *dirfile, const char *field_code,
+    const char *in_field, gdpu_complex cdividend, int fragment_index=0)
+int add_divide(DIRFILE *dirfile, const char *field_code, const char *in_field1,
+    const char *in_field2, int fragment_index=0)
+int add_linterp(DIRFILE *dirfile, const char *field_code, const char *in_field,
+    const char *table, int fragment_index=0)
+int add_multiply(DIRFILE *dirfile, const char *field_code,
+    const char *in_field1, const char *in_field2, int fragment_index=0)
+int add_phase(DIRFILE *dirfile, const char *field_code, const char *in_field,
+    gd_shift_t shift, int fragment_index=0)
+int add_sbit(DIRFILE *dirfile, const char *field_code, const char *in_field,
+    int bitnum, int numbits, int fragment_index=0)
+int add_string(DIRFILE *dirfile, const char *field_code, const char *value,
+    int fragment_index=0)
+int alter_bit(DIRFILE *dirfile, const char *field_code,
+    gdpu_char *in_field=NULL, gdpu_bitnum_t bitnum=-1, gdpu_numbits_t numbits=0)
+int alter_carray(DIRFILE* dirfile, const char* field_code, gd_type_t const_type,
+    size_t array_len)
+int alter_clincom:alter_lincom(DIRFILE *dirfile, const char *field_code,
+    gdpu_int n_fields=0, const char **in_fields=NULL, gdp_complex_in m=NULL,
+    gdp_complex_in b=NULL)
+int alter_cpolynom:alter_polynom(DIRFILE *dirfile, const char *field_code,
+    gdpu_int poly_ord=0, gdpu_char *in_field=NULL, gdp_complex_in a=NULL)
+int alter_crecip:alter_recip(DIRFILE *dirfile, const char *field_code,
+    gdpu_char *in_field=NULL, gdpu_complex cdividend)
+int alter_divide(DIRFILE *dirfile, const char *field_code,
+    gdpu_char *in_field1=NULL, gdpu_char *in_field2=NULL)
+int alter_multiply(DIRFILE *dirfile, const char *field_code,
+    gdpu_char *in_field1=NULL, gdpu_char *in_field2=NULL)
+int alter_phase(DIRFILE *dirfile, const char *field_code,
+    gdpu_char *in_field, gdpu_shift_t shift)
+int alter_sbit(DIRFILE *dirfile, const char *field_code,
+    gdpu_char *in_field=NULL, gdpu_bitnum_t bitnum=-1, gdpu_numbits_t numbits=0)
+size_t carray_len(DIRFILE *dirfile, const char *field_code)
+unsigned long int encoding(DIRFILE *dirfile, int fragment)
+unsigned long int endianness(DIRFILE *dirfile, int fragment)
+int fragment_index(DIRFILE *dirfile, const char *field_code)
+const char *fragmentname(DIRFILE *dirfile, int index)
+int madd(DIRFILE *dirfile, gd_entry_t &entry, const char *parent)
+int madd_bit(DIRFILE *dirfile, const char *parent, const char *field_code,
+    const char *in_field, int bitnum, int numbits)
+int madd_clincom:madd_lincom(DIRFILE *dirfile, const char *parent,
+    const char *field_code, int n_fields, const char **in_fields,
+    gdp_complex_in cm, gdp_complex_in cb)
+int madd_cpolynom:madd_polynom(DIRFILE *dirfile, const char *parent,
+    const char *field_code, int poly_ord, const char *in_field,
+    gdp_complex_in ca)
+int madd_crecip:madd_recip(DIRFILE *dirfile, const char *parent,
+    const char *field_code, const char *in_field, gdpu_complex cdividend)
+int madd_divide(DIRFILE *dirfile, const char *parent, const char *field_code,
+    const char *in_field1, const char *in_field2)
+int madd_linterp(DIRFILE *dirfile, const char *parent, const char *field_code,
+    const char *in_field, const char *table)
+int madd_multiply(DIRFILE *dirfile, const char *parent, const char *field_code,
+    const char *in_field1, const char *in_field2)
+int madd_phase(DIRFILE *dirfile, const char *parent, const char *field_code,
+    const char *in_field, gd_shift_t shift)
+int madd_sbit(DIRFILE *dirfile, const char *parent, const char *field_code,
+    const char *in_field, int bitnum, int numbits)
+int madd_spec(DIRFILE *dirfile, const char *line, const char *parent)
+int madd_string(DIRFILE *dirfile, const char *parent, const char *field_code,
+    const char *value)
+int dirfile_standards(DIRFILE *dirfile, int version=GD_VERSION_CURRENT)
+const char *dirfilename(DIRFILE *dirfile)
+gd_type_t native_type(DIRFILE *dirfile, const char *field_code)
+int parent_fragment(DIRFILE *dirfile, int fragment_index)
+int alter_protection(DIRFILE *dirfile, int protection_level, int fragment_index)
+int protection(DIRFILE *dirfile, int fragment_index)
+const char *raw_filename(DIRFILE *dirfile, const char *field_code)
+const char *reference(DIRFILE *dirfile, gdpu_char *field_code=NULL)
+unsigned int spf(DIRFILE *dirfile, const char *field_code)
+size_t put_string(DIRFILE *dirfile, const char *field_code, const char *data)
+int validate(DIRFILE *dirfile, const char *field_code)
+int add(DIRFILE *dirfile, gd_entry_t &entry)
+int add_raw(DIRFILE *dirfile, const char *field_code, gd_type_t data_type,
+    unsigned int spf, int fragment_index=0)
+int add_spec(DIRFILE *dirfile, const char *line, int fragment_index=0)
+int alter_const(DIRFILE *dirfile, const char *field_code,
+    gdpu_type_t const_type=GD_NULL);
+int alter_encoding(DIRFILE *dirfile, unsigned long int encoding, int fragment=0,
+    int recode=0)
+int alter_endianness(DIRFILE *dirfile, unsigned long int byte_sex,
+    int fragment=0, int recode=0)
+int alter_entry(DIRFILE *dirfile, const char *field_code, gd_entry_t &entry,
+    int recode=0)
+int alter_linterp(DIRFILE *dirfile, const char *field_code,
+    gdpu_char *in_field=NULL, gdpu_char *table=NULL, int recode=0)
+int alter_raw(DIRFILE *dirfile, const char *field_code,
+    gdpu_type_t data_type=GD_NULL, gdpu_uint_t spf=0, int recode=0)
+int alter_spec(DIRFILE *dirfile, const char *line, int recode=0)
+int delete(DIRFILE *dirfile, const char *field_code, int flags=0)
+int flush(DIRFILE *dirfile, const char *field_code)
+int malter_spec(DIRFILE *dirfile, const char *line, const char *parent,
+    int recode=0)
+int metaflush(DIRFILE *dirfile)
+int move(DIRFILE *dirfile, const char *field_code, int new_fragment,
+    unsigned int flags=0)
+int rename(DIRFILE *dirfile, const char *old_code, const char *new_name,
+    int move_data=0)
+int rewrite_fragment(DIRFILE *dirfile, int fragment)
+int uninclude(DIRFILE *dirfile, int fragment_index, int del=0)
+int alter_frameoffset64(DIRFILE *dirfile, off64_t offset, int fragment=0,
+    int recode=0)
+off64_t frameoffset64(DIRFILE *dirfile, int fragment)
+double framenum_subset64:framenum(DIRFILE *dirfile, const char* field_code_in,
+    double value, off64_t field_start=0, off64_t field_end=0)
+off64_t nframes64(DIRFILE *dirfile)
+off64_t bof64(DIRFILE *dirfile, const char* field_code)
+off64_t eof64(DIRFILE *dirfile, const char* field_code)
+int error_count(DIRFILE *dirfile)
+off64_t seek(DIRFILE *dirfile, const char* field_code, off64_t frame_num,
+    off64_t sample_num, int flags=GD_SEEK_SET)
+off64_t tell(DIRFILE *dirfile, const char* field_code)
+int hide(DIRFILE *dirfile, const char *field_code)
+int hidden(DIRFILE *dirfile, const char *field_code)
+int unhide(DIRFILE *dirfile, const char *field_code)
+int sync(DIRFILE *dirfile, const char *field_code)
+int move_alias(DIRFILE *dirfile, const char *field_code, int new_fragment)
+int delete_alias(DIRFILE *dirfile, const char *field_code, unsigned int flags=0)
+const char *alias_target(DIRFILE *dirfile, const char *field_code)
+int add_alias(DIRFILE *dirfile, const char *field_code, const char *target,
+    int fragment_index=0)
+int madd_alias(DIRFILE *dirfile, const char *parent, const char *field_code,
+    const char *target)
+int add_window(DIRFILE *dirfile, const char *field_code, const char *in_field,
+    const char *check_field, gd_windop_t windop, gd_triplet_t threshold,
+    int fragment_index=0)
+int madd_window(DIRFILE *dirfile, const char *parent, const char *field_code,
+    const char *in_field, const char *check_field, gd_windop_t windop,
+    gd_triplet_t threshold)
+int alter_window(DIRFILE *dirfile, const char *field_code, gdpu_char *in_field,
+    gdpu_char *check_field, gd_windop_t windop, gd_triplet_t threshold)
+int alter_affixes(DIRFILE *dirfile, int index, gdpu_char *prefix,
+    gdpu_char *suffix=NULL)
+int add_mplex(DIRFILE *dirfile, const char *field_code, const char *in_field,
+    const char *count_field, int count_val, int period, int fragment_index=0)
+int alter_mplex(DIRFILE *dirfile, const char *field_code,
+    gdpu_char *in_field=NULL, gdpu_char *count_field=NULL, int count_val=-1,
+    int period=-1)
+int madd_mplex(DIRFILE *dirfile, const char *parent, const char *field_code,
+    const char *in_field, const char *count_field, int count_val,
+    int period)
+int raw_close(DIRFILE *dirfile, const char *field_code)
+int desync(DIRFILE *dirfile, unsigned int flags=0)
+unsigned long int flags(DIRFILE *dirfile, unsigned long int set=0,
+    unsigned long int reset=0)
+int verbose_prefix(DIRFILE *dirfile, gdpu_char *prefix=NULL)
+void mplex_lookback(DIRFILE *dirfile, int lookback)
+char *linterp_tablename(DIRFILE *dirfile, const char *field_code)
diff --git a/bindings/perl/t/big_test.t b/bindings/perl/t/big_test.t
new file mode 100644
index 0000000..ded2df6
--- /dev/null
+++ b/bindings/perl/t/big_test.t
@@ -0,0 +1,1728 @@
+#!/usr/bin/perl -w
+# Copyright (C) 2011-2012 D. V. Wiebe
+#
+##########################################################################
+#
+# This file is part of the GetData project.
+#
+# GetData is free software; you can redistribute it and/or modify it under
+# the terms of the GNU Lesser General Public License as published by the
+# Free Software Foundation; either version 2.1 of the License, or (at your
+# option) any later version.
+#
+# GetData is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+# License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public License
+# along with GetData; if not, write to the Free Software Foundation, Inc.,
+# 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+
+use GetData;
+use Math::Complex;
+use strict;
+use Test::More tests => 1317;
+
+my $ne = 0;
+my ($s, @a, %h);
+select STDERR; $| = 1;
+select STDOUT; $| = 1;
+
+sub isn {
+  cmp_ok (
+    (defined $_[0]) ? $_[0] : "undef",
+    (defined $_[0] and defined $_[1]) ? '==' : 'eq',
+    (defined $_[1]) ? $_[1] : "undef", $_[2] . " = " .
+    ((defined $_[0]) ? $_[0] : "undef") . ", expected " .
+    ((defined $_[1]) ? $_[1] : "undef"));
+}
+
+sub CheckError {
+  my $e = $_->error;
+  print "\n";
+  is ($e, $_[1], "e[$_[0]] = $e, expected $_[1]");
+  print "#";
+}
+
+sub CheckError2 {
+  my $e = $_->error;
+  print "\n";
+  is ($e, $_[2], "e[$_[0],$_[1]] = $e, expected $_[2]");
+  print "#";
+}
+
+sub CheckArray {
+  my $i;
+  print "\n";
+  is ($#{$_[1]}, $#_ - 2,
+    "a[$_[0]]: " . (1 + $#{$_[1]}) . " elements, expected " . ($#_ - 1));
+  for $i (0 .. $#_ - 2) {
+    isn (${$_[1]}[$i], $_[$i + 2], "a($i)[$_[0]]");
+  }
+  print "#";
+}
+
+sub CheckArray2 {
+  my $i;
+  print "\n";
+  is ($#{$_[2]}, $#_ - 3,
+    "a[$_[0],$_[1]]: " . (1 + $#{$_[2]}) . " elements, expected " . ($#_ - 2));
+  for $i (0 .. $#_ - 3) {
+    isn (${$_[2]}[$i], $_[$i + 3], "a($i)[$_[0],$_[1]]" );
+  }
+  print "#";
+}
+
+sub CheckSArray {
+  my $i;
+  print "\n";
+  is ($#{$_[1]}, $#_ - 2,
+    "a[$_[0]]: " . (1 + $#{$_[1]}) . " elements, expected " . ($#_ - 1));
+  for $i (0 .. $#_ - 2) {
+    is (${$_[1]}[$i], $_[$i + 2],
+      "s($i)[$_[0]] = \"${$_[1]}[$i]\", expected \"" . $_[$i + 2] . "\"");
+  }
+  print "#";
+}
+
+sub CheckSArray2 {
+  my $i;
+  print "\n";
+  is ($#{$_[2]}, $#_ - 3,
+    "a[$_[0],$_[1]]: " . (1 + $#{$_[2]}) . " elements, expected " . ($#_ - 2));
+  for $i (0 .. $#_ - 3) {
+    is (${$_[2]}[$i], $_[$i + 3], "s($i)[$_[0],$_[1]] = " .
+      ((defined ${$_[2]}[$i]) ? "\"" . ${$_[2]}[$i] . "\"" : "undef") .
+      ", expected " .
+      ((defined $_[$i + 3]) ? "\"" . $_[$i + 3] . "\"" : "undef"));
+  }
+  print "#";
+}
+
+sub CheckNum {
+  print "\n";
+  isn ($_[1], $_[2], "n[$_[0]]");
+  print "#";
+}
+sub CheckNum2 {
+  print "\n";
+  isn ($_[2], $_[3], "n[$_[0],$_[1]]");
+  print "#";
+}
+
+sub CheckString {
+  print "\n";
+  is ($_[1], $_[2], "s[$_[0]] = \"$_[1]\", expected \"$_[2]\"");
+  print "#";
+}
+
+sub CheckString2 {
+  print "\n";
+  is ($_[2], $_[3], "s[$_[0],$_[1]] = \"$_[2]\", expected \"$_[3]\"");
+  print "#";
+}
+
+sub CheckEOString {
+  print "\n";
+  ok ($_[1] =~ m#$_[2]$#, "s[$_[0]] = \"$_[1]\", expected \"$_[2]\"");
+  print "#";
+}
+
+sub CheckEOSArray {
+  my $i;
+  print "\n";
+  is ($#{$_[1]}, $#_ - 2,
+    "a[$_[0]]: " . (1 + $#{$_[1]}) . " elements, expected " . ($#_ - 1));
+  for $i (0 .. $#_ - 2) {
+    ok (${$_[1]}[$i] =~ m#$_[$i + 2]$#,
+      "s($i)[$_[0]] = \"${$_[1]}[$i]\", expected \"$_[$i + 2]\"");
+  }
+  print "#";
+}
+
+sub CheckOK { &CheckError($_[0], 0) }
+sub CheckOK2 { &CheckError2(@_, 0) }
+
+my $nfields = 17;
+my @fields = (qw(INDEX alias bit carray const data div lincom linterp mplex mult
+  phase polynom recip sbit string window));
+
+#create the dirfile
+system "rm -rf dirfile" if (-e "dirfile" and not -d "dirfile");
+(mkdir "dirfile" or die) unless -e "dirfile";
+
+open GLOB, ">dirfile/data" or die;
+print GLOB map chr, 1 .. 81;
+
+open GLOB, ">dirfile/format" or die;
+print GLOB <<EOF
+/ENDIAN little
+data RAW INT8 8
+lincom LINCOM data 1.1 2.2 INDEX 2.2 3.3;4.4 linterp const const
+/META data mstr STRING "This is a string constant."
+/META data mconst CONST COMPLEX128 3.3;4.4
+/META data mcarray CARRAY FLOAT64 1.9 2.8 3.7 4.6 5.5
+/META data mlut LINTERP DATA ./lut
+const CONST FLOAT64 5.5
+carray CARRAY FLOAT64 1.1 2.2 3.3 4.4 5.5 6.6
+linterp LINTERP data ./lut
+polynom POLYNOM data 1.1 2.2 2.2 3.3;4.4 const const
+bit BIT data 3 4
+sbit SBIT data 5 6
+mplex MPLEX data sbit 1 10
+mult MULTIPLY data sbit
+div DIVIDE mult bit
+recip RECIP div 6.5;4.3
+phase PHASE data 11
+window WINDOW linterp mult LT 4.1
+ALIAS alias data
+string STRING \"Zaphod Beeblebrox\"
+EOF
+  or die;
+
+open GLOB, ">dirfile/form2" or die;
+print GLOB "const2 CONST INT8 -19\n" or die;
+close GLOB;
+
+# 0: error check
+$_ = &GetData::open("x", $GetData::RDONLY);
+CheckError(0, $GetData::E_OPEN);
+
+# 1: open check
+$_ = &GetData::open("dirfile", $GetData::RDWR);
+CheckOK(1);
+
+# 2: getdata (INT8) check
+$s = $_->getdata("data", 5, 0, 1, 0, $GetData::INT8);
+CheckOK(2);
+CheckString(2, $s, join "", map chr, 41 .. 48);
+
+# 102: getdata (unpacked) check
+ at a = $_->getdata("data", 5, 0, 1, 0, $GetData::INT16);
+CheckOK(102);
+CheckArray(102, \@a, 41 .. 48);
+
+# 108: getdata (complex unpacked) check
+ at a = $_->getdata("data", 5, 0, 1, 0, $GetData::COMPLEX128);
+CheckOK(108);
+CheckArray(108, \@a, 41 .. 48);
+
+# 3: constant (INT8) check
+$s = $_->get_constant("const", $GetData::INT8);
+CheckOK(3);
+CheckNum(3, $s, 5);
+
+# 116: constant (COMPLEX128) check
+$s = $_->get_constant("const", $GetData::COMPLEX128);
+CheckOK(116);
+CheckNum(116, $s, 5.5);
+
+# 6: nfields check
+$s = $_->field_list;
+CheckOK(6);
+CheckNum(6, $s, $nfields);
+
+# 8: field_list check
+ at a = $_->field_list;
+CheckOK(8);
+CheckSArray(8, \@a, @fields);
+
+# 9: nmfields check
+$s = $_->mfield_list("data");
+CheckOK(9);
+CheckNum(9, $s, 4);
+
+# 10: mfield_list check
+ at a = $_->mfield_list("data");
+CheckOK(10);
+CheckSArray(10, \@a, qw(mstr mconst mcarray mlut));
+
+# 11: nframes check
+$s = $_->nframes;
+CheckOK(11);
+CheckNum(11, $s, 10);
+
+# 12: spf check
+$s = $_->spf("data");
+CheckOK(12);
+CheckNum(12, $s, 8);
+
+# 13: putdata (packed) check
+$s = $_->putdata("data", 5, 1, $GetData::UINT8, "\15\16\17\20");
+CheckOK2(13,1);
+CheckNum(13,$s,4);
+
+ at a = $_->getdata("data", 5, 0, 1, 0, $GetData::UINT8);
+CheckOK2(13,2);
+CheckArray(13, \@a, 41, 015, 016, 017, 020, 46, 47, 48);
+
+# 118: putdata (typed ref) check
+$s = $_->putdata("data", 5, 1, $GetData::UINT16, [ 23, 24, 25, 26 ]);
+CheckOK2(118,1);
+CheckNum(118,$s,4);
+
+ at a = $_->getdata("data", 5, 0, 1, 0, $GetData::UINT8);
+CheckOK2(118,2);
+CheckArray(118, \@a, 41, 23, 24, 25, 26, 46, 47, 48);
+
+# 120: putdata (untyped ref) check
+$s = $_->putdata("data", 5, 1, [ 33, 34, 35, 36 ]);
+CheckOK2(120,1);
+CheckNum(120,$s,4);
+
+ at a = $_->getdata("data", 5, 0, 1, 0, $GetData::UINT8);
+CheckOK2(120,2);
+CheckArray(120, \@a, 41, 33, 34, 35, 36, 46, 47, 48);
+
+# 122: putdata (simple list) check
+$s = $_->putdata("data", 5, 1, 23., 24., 25., 26.);
+CheckOK2(122,1);
+CheckNum(122,$s,4);
+
+ at a = $_->getdata("data", 5, 0, 1, 0, $GetData::UINT8);
+CheckOK2(122,2);
+CheckArray(122, \@a, 41, 23, 24, 25, 26, 46, 47, 48);
+
+# 124: putdata (undef list) check
+$s = $_->putdata("data", 5, 1, undef, 13.+0*i, 14.+0*i, 15.+0*i, 16.+0*i);
+CheckOK2(124,1);
+CheckNum(124,$s,4);
+
+ at a = $_->getdata("data", 5, 0, 1, 0, $GetData::UINT8);
+CheckOK2(124,2);
+CheckArray(124, \@a, 41, 13, 14, 15, 16, 46, 47, 48);
+
+# 14: error_string check
+$s = $_->getdata("x", 5, 0, 1, 0, $GetData::UINT8);
+CheckError(14,$GetData::E_BAD_CODE);
+CheckString(14, $_->error_string, "Field not found: x");
+
+# 15: get_entry check
+$s = $_->entry("data");
+CheckOK(15);
+CheckNum(15,$s,$GetData::RAW_ENTRY);
+
+# 16: get_entry check
+%h = $_->entry("data");
+CheckOK(16);
+CheckSArray2(16, 0, [ sort keys %h ],
+  qw(data_type field field_type fragment_index scalar scalar_ind spf));
+CheckNum2(16, 1, $h{'data_type'}, $GetData::INT8);
+CheckString2(16, 2, $h{'field'}, "data");
+CheckNum2(16, 3, $h{'field_type'}, $GetData::RAW_ENTRY);
+CheckNum2(16, 4, $h{'fragment_index'}, 0);
+CheckSArray2(16, 6, $h{'scalar'}, undef);
+CheckArray2(16, 7, $h{'scalar_ind'}, undef);
+CheckNum2(16, 8, $h{'spf'}, 8);
+
+# 18: get_entry check
+%h = $_->entry("lincom");
+CheckOK(18);
+CheckSArray2(18, 1, [ sort keys %h ], qw(b field field_type),
+  qw(fragment_index in_fields m n_fields scalar scalar_ind));
+CheckArray2(18, 2, $h{'b'}, 2.2, 3.3+4.4*i, 5.5);
+CheckString2(18, 5, $h{'field'}, "lincom");
+CheckNum2(18, 6, $h{'field_type'}, $GetData::LINCOM_ENTRY);
+CheckNum2(18, 7, $h{'fragment_index'}, 0);
+CheckSArray2(18, 8, $h{'in_fields'}, qw(data INDEX linterp));
+CheckArray2(18, 3, $h{'m'}, 1.1, 2.2, 5.5);
+CheckNum2(18, 10, $h{'n_fields'}, 3);
+CheckSArray2(18, 11, $h{'scalar'}, undef, undef, "const", undef, undef,
+  "const");
+CheckArray2(18, 12, $h{'scalar_ind'}, undef, undef, -1, undef, undef, -1);
+
+# 20: get_entry check
+%h = $_->entry("polynom");
+CheckOK(20);
+CheckSArray2(20, 1, [ sort keys %h ], qw(a field field_type),
+  qw(fragment_index in_fields poly_ord scalar scalar_ind));
+CheckArray2(20, 2, $h{'a'}, 1.1, 2.2, 2.2, 3.3+4.4*i, 5.5, 5.5);
+CheckString2(20, 4, $h{'field'}, "polynom");
+CheckNum2(20, 5, $h{'field_type'}, $GetData::POLYNOM_ENTRY);
+CheckNum2(20, 6, $h{'fragment_index'}, 0);
+CheckString2(20, 7, $h{'in_fields'}, "data");
+CheckNum2(20, 8, $h{'poly_ord'}, 5);
+CheckSArray2(20, 9, $h{'scalar'}, undef, undef, undef, undef, "const", "const");
+CheckArray2(20, 10, $h{'scalar_ind'}, undef, undef, undef, undef, -1, -1);
+
+# 21: get_entry check
+%h = $_->entry("linterp");
+CheckOK(21);
+CheckSArray2(21, 0, [ sort keys %h ], qw(field field_type fragment_index),
+  qw(in_fields table));
+CheckString2(21, 1, $h{'field'}, "linterp");
+CheckNum2(21, 2, $h{'field_type'}, $GetData::LINTERP_ENTRY);
+CheckNum2(21, 3, $h{'fragment_index'}, 0);
+CheckString2(21, 4, $h{'in_fields'}, "data");
+CheckString2(21, 5, $h{'table'}, "./lut");
+
+# 22: get_entry check
+%h = $_->entry("bit");
+CheckOK(22);
+CheckSArray2(22, 0, [ sort keys %h ], qw(bitnum field field_type),
+  qw(fragment_index in_fields numbits scalar scalar_ind));
+CheckNum2(22, 1, $h{'bitnum'}, 3);
+CheckString2(22, 2, $h{'field'}, "bit");
+CheckNum2(22, 3, $h{'field_type'}, $GetData::BIT_ENTRY);
+CheckNum2(22, 4, $h{'fragment_index'}, 0);
+CheckString2(22, 5, $h{'in_fields'}, "data");
+CheckNum2(22, 6, $h{'numbits'}, 4);
+CheckSArray2(22, 7, $h{'scalar'}, undef, undef);
+CheckArray2(22, 8, $h{'scalar_ind'}, undef, undef);
+
+# 23: get_entry check
+%h = $_->entry("sbit");
+CheckOK(23);
+CheckSArray2(23, 0, [ sort keys %h ], qw(bitnum field field_type),
+  qw(fragment_index in_fields numbits scalar scalar_ind));
+CheckNum2(23, 1, $h{'bitnum'}, 5);
+CheckString2(23, 2, $h{'field'}, "sbit");
+CheckNum2(23, 3, $h{'field_type'}, $GetData::SBIT_ENTRY);
+CheckNum2(23, 4, $h{'fragment_index'}, 0);
+CheckString2(23, 5, $h{'in_fields'}, "data");
+CheckNum2(23, 6, $h{'numbits'}, 6);
+CheckSArray2(23, 7, $h{'scalar'}, undef, undef);
+CheckArray2(23, 8, $h{'scalar_ind'}, undef, undef);
+
+# 24: get_entry check
+%h = $_->entry("mult");
+CheckOK(24);
+CheckSArray2(24, 0, [ sort keys %h ], qw(field field_type fragment_index),
+  "in_fields");
+CheckString2(24, 1, $h{'field'}, "mult");
+CheckNum2(24, 2, $h{'field_type'}, $GetData::MULTIPLY_ENTRY);
+CheckNum2(24, 3, $h{'fragment_index'}, 0);
+CheckSArray2(24, 4, $h{'in_fields'}, qw(data sbit));
+
+# 25: get_entry check
+%h = $_->entry("phase");
+CheckOK(25);
+CheckSArray2(25, 0, [ sort keys %h ], qw(field field_type fragment_index),
+  qw(in_fields scalar scalar_ind shift));
+CheckString2(25, 1, $h{'field'}, "phase");
+CheckNum2(25, 2, $h{'field_type'}, $GetData::PHASE_ENTRY);
+CheckNum2(25, 3, $h{'fragment_index'}, 0);
+CheckString2(25, 4, $h{'in_fields'}, "data");
+CheckSArray2(25, 5, $h{'scalar'}, undef);
+CheckArray2(25, 6, $h{'scalar_ind'}, undef);
+CheckNum2(25, 7, $h{'shift'}, 11);
+
+# 26: get_entry check
+%h = $_->entry("const");
+CheckOK(26);
+CheckSArray2(26, 0, [ sort keys %h ], qw(const_type field field_type),
+  "fragment_index");
+CheckNum2(26, 1, $h{'const_type'}, $GetData::FLOAT64);
+CheckString2(26, 2, $h{'field'}, "const");
+CheckNum2(26, 3, $h{'field_type'}, $GetData::CONST_ENTRY);
+CheckNum2(26, 4, $h{'fragment_index'}, 0);
+
+# 134: get_entry check
+%h = $_->entry("string");
+CheckOK(134);
+CheckSArray2(134, 0, [ sort keys %h ], qw(field field_type fragment_index));
+CheckString2(134, 1, $h{'field'}, "string");
+CheckNum2(134, 2, $h{'field_type'}, $GetData::STRING_ENTRY);
+CheckNum2(134, 3, $h{'fragment_index'}, 0);
+
+# 27: fragment_index check
+$s = $_->fragment_index("data");
+CheckOK(27);
+CheckNum(27, $s, 0);
+
+# 28: add_raw check
+$s = $_->add_raw("new1", $GetData::FLOAT64, 3);
+CheckOK2(28, 1);
+CheckNum2(28, 2, $s, 0);
+
+%h = $_->entry("new1");
+CheckOK2(28, 3);
+CheckNum2(28, 4, $h{'data_type'}, $GetData::FLOAT64);
+CheckString2(28, 5, $h{'field'}, "new1");
+CheckNum2(28, 6, $h{'field_type'}, $GetData::RAW_ENTRY);
+CheckNum2(28, 7, $h{'fragment_index'}, 0);
+CheckSArray2(28, 8, $h{'scalar'}, undef);
+CheckArray2(28, 9, $h{'scalar_ind'}, undef);
+CheckNum2(28, 10, $h{'spf'}, 3);
+
+#30: add_lincom check
+$s = $_->add_lincom("new3", 2, [ qw(in1 in2) ], [ 1.1+1.2*i, 1.4+1.5*i ],
+  [ 1.3+1.4*i, 1.6+1.7*i ], 0);
+CheckOK2(30, 1);
+CheckNum2(30, 2, $s, 0);
+
+%h = $_->entry("new3");
+CheckOK2(30, 3);
+CheckArray2(30, 4, $h{'b'}, 1.3+1.4*i, 1.6+1.7*i);
+CheckString2(30, 6, $h{'field'}, "new3");
+CheckNum2(30, 7, $h{'field_type'}, $GetData::LINCOM_ENTRY);
+CheckNum2(30, 8, $h{'fragment_index'}, 0);
+CheckSArray2(30, 9, $h{'in_fields'}, qw(in1 in2));
+CheckArray2(30, 10, $h{'m'}, 1.1+1.2*i, 1.4+1.5*i);
+CheckNum2(30, 11, $h{'n_fields'}, 2);
+CheckSArray2(30, 12, $h{'scalar'}, undef, undef, undef, undef, undef);
+CheckArray2(30, 13, $h{'scalar_ind'}, undef, undef, undef, undef, undef);
+
+# 31: add_polynom
+$s = $_->add_polynom("new4", 3, "in1", [ 3.9, 4.8, 5.7, 6.6 ], 0);
+CheckOK2(31, 1);
+CheckNum2(31, 2, $s, 0);
+
+%h = $_->entry("new4");
+CheckOK2(31, 3);
+CheckArray2(31, 4, $h{'a'}, 3.9, 4.8, 5.7, 6.6);
+CheckString2(31, 7, $h{'field'}, "new4");
+CheckNum2(31, 8, $h{'field_type'}, $GetData::POLYNOM_ENTRY);
+CheckNum2(31, 9, $h{'fragment_index'}, 0);
+CheckString2(31, 10, $h{'in_fields'}, "in1");
+CheckNum2(31, 11, $h{'poly_ord'}, 3);
+CheckSArray2(31, 12, $h{'scalar'}, undef, undef, undef, undef);
+CheckArray2(31, 13, $h{'scalar_ind'}, undef, undef, undef, undef);
+
+# 33: add_linterp
+$s = $_->add_linterp("new6", "in", "./some/table");
+CheckOK2(33, 1);
+CheckNum2(33, 2, $s, 0);
+
+%h = $_->entry("new6");
+CheckOK2(33, 2);
+CheckString2(33, 3, $h{'field'}, "new6");
+CheckNum2(33, 4, $h{'field_type'}, $GetData::LINTERP_ENTRY);
+CheckNum2(33, 5, $h{'fragment_index'}, 0);
+CheckString2(33, 6, $h{'in_fields'}, "in");
+CheckString2(33, 7, $h{'table'}, "./some/table");
+
+# 34: add_bit
+$s = $_->add_bit("new7", "in1", 11, 22);
+CheckOK2(34, 1);
+CheckNum2(34, 2, $s, 0);
+
+%h = $_->entry("new7");
+CheckOK(34, 2);
+CheckNum2(34, 3, $h{'bitnum'}, 11);
+CheckString2(34, 4, $h{'field'}, "new7");
+CheckNum2(34, 5, $h{'field_type'}, $GetData::BIT_ENTRY);
+CheckNum2(34, 6, $h{'fragment_index'}, 0);
+CheckString2(34, 7, $h{'in_fields'}, "in1");
+CheckNum2(34, 8, $h{'numbits'}, 22);
+CheckSArray2(34, 9, $h{'scalar'}, undef, undef);
+CheckArray2(34, 10, $h{'scalar_ind'}, undef, undef);
+
+# 35: add_sbit
+$s = $_->add_sbit("new8", "in2", 5, 10);
+CheckOK2(35, 1);
+CheckNum2(35, 2, $s, 0);
+
+%h = $_->entry("new8");
+CheckOK(35, 2);
+CheckNum2(35, 3, $h{'bitnum'}, 5);
+CheckString2(35, 4, $h{'field'}, "new8");
+CheckNum2(35, 5, $h{'field_type'}, $GetData::SBIT_ENTRY);
+CheckNum2(35, 6, $h{'fragment_index'}, 0);
+CheckString2(35, 7, $h{'in_fields'}, "in2");
+CheckNum2(35, 8, $h{'numbits'}, 10);
+CheckSArray2(35, 9, $h{'scalar'}, undef, undef);
+CheckArray2(35, 10, $h{'scalar_ind'}, undef, undef);
+
+# 36: add_mutiply
+$s = $_->add_multiply("new9", "in2", "in3");
+CheckOK2(36, 1);
+CheckNum2(36, 2, $s, 0);
+
+%h = $_->entry("new9");
+CheckOK2(36, 3);
+CheckString2(36, 4, $h{'field'}, "new9");
+CheckNum2(36, 5, $h{'field_type'}, $GetData::MULTIPLY_ENTRY);
+CheckNum2(36, 6, $h{'fragment_index'}, 0);
+CheckSArray2(36, 7, $h{'in_fields'}, qw(in2 in3));
+
+# 37: add_phase
+$s = $_->add_phase("new10", "in6", 42);
+CheckOK2(37, 1);
+CheckNum2(37, 2, $s, 0);
+
+%h = $_->entry("new10");
+CheckOK2(37, 2);
+CheckString2(37, 3, $h{'field'}, "new10");
+CheckNum2(37, 4, $h{'field_type'}, $GetData::PHASE_ENTRY);
+CheckNum2(37, 5, $h{'fragment_index'}, 0);
+CheckString2(37, 6, $h{'in_fields'}, "in6");
+CheckSArray2(37, 7, $h{'scalar'}, undef);
+CheckArray2(37, 8, $h{'scalar_ind'}, undef);
+CheckNum2(37, 9, $h{'shift'}, 42);
+
+# 38: add_const
+$s = $_->add_const("new11", $GetData::FLOAT64, "33.3");
+CheckOK2(38, 1);
+CheckNum2(38, 2, $s, 0);
+
+%h = $_->entry("new11");
+CheckOK2(38, 3);
+CheckNum2(38, 4, $h{'const_type'}, $GetData::FLOAT64);
+CheckString2(38, 5, $h{'field'}, "new11");
+CheckNum2(38, 6, $h{'field_type'}, $GetData::CONST_ENTRY);
+CheckNum2(38, 7, $h{'fragment_index'}, 0);
+
+$s = $_->get_constant("new11", $GetData::FLOAT64);
+CheckOK2(38, 8);
+CheckNum2(38, 9, $s, 33.3);
+
+# 125: add check
+$s = $_->add({
+    field          => "new13",
+    field_type     => $GetData::PHASE_ENTRY,
+    fragment_index => 0,
+    in_fields      => "new9",
+    shift          => -88
+  });
+CheckOK2(125,1);
+CheckNum2(125, 2, $s, 0);
+
+%h = $_->entry("new13");
+CheckOK2(125, 2);
+CheckString2(125, 3, $h{'field'}, "new13");
+CheckNum2(125, 4, $h{'field_type'}, $GetData::PHASE_ENTRY);
+CheckNum2(125, 5, $h{'fragment_index'}, 0);
+CheckString2(125, 6, $h{'in_fields'}, "new9");
+CheckSArray2(125, 7, $h{'scalar'}, undef);
+CheckArray2(125, 8, $h{'scalar_ind'}, undef);
+CheckNum2(125, 9, $h{'shift'}, -88);
+
+# 39: fragment_name
+$s = $_->fragmentname(0);
+CheckOK(39);
+CheckEOString(39, $s, "dirfile/format");
+
+# 40: nfragments
+$s = $_->fragments;
+CheckOK(40);
+CheckNum(40, $s, 1);
+
+# 182: fragment list
+ at a = $_->fragments;
+CheckOK(182);
+CheckEOSArray(182, \@a, "dirfile/format");
+
+# 41: include
+$s = $_->include("form2", 0, 0);
+CheckOK2(41, 1);
+CheckNum2(41, 2, $s, 1);
+
+$s = $_->get_constant("const2", $GetData::INT32);
+CheckOK2(41, 3);
+CheckNum2(41, 4, $s, -19);
+
+# 42: nfields_by_type
+$s = $_->field_list_by_type($GetData::LINCOM_ENTRY);
+CheckOK(42);
+CheckNum(42, $s, 2);
+
+# 43: field_list_by_type
+ at a = $_->field_list_by_type($GetData::LINCOM_ENTRY);
+CheckOK(43);
+CheckSArray(43, \@a, qw(lincom new3));
+
+# 44: nvectors
+$s = $_->vector_list;
+CheckOK(44);
+CheckNum(44, $s, 23);
+
+# 45: vector_list
+ at a = $_->vector_list;
+CheckOK(45);
+CheckSArray(45, \@a, qw(INDEX alias bit data div lincom linterp mplex mult),
+  qw(new1 new10 new13 new3 new4 new6 new7 new8 new9 phase polynom recip sbit),
+  qw(window));
+
+#47: madd_lincom check
+$s = $_->madd_lincom("data", "mnew2", 2, [ qw(in1 in2) ], [ 9.9+8.8*i, 7.7 ],
+  [ 6.6, 5.5 ]);
+CheckOK2(47, 1);
+CheckNum2(47, 2, $s, 0);
+
+%h = $_->entry("data/mnew2");
+CheckOK2(47, 3);
+CheckArray2(47, 4, $h{'b'}, 6.6, 5.5);
+CheckArray2(47, 5, $h{'m'}, 9.9+8.8*i, 7.7);
+CheckString2(47, 7, $h{'field'}, "data/mnew2");
+CheckNum2(47, 8, $h{'field_type'}, $GetData::LINCOM_ENTRY);
+CheckNum2(47, 9, $h{'fragment_index'}, 0);
+CheckSArray2(47, 10, $h{'in_fields'}, qw(in1 in2));
+CheckNum2(47, 11, $h{'n_fields'}, 2);
+CheckSArray2(47, 12, $h{'scalar'}, undef, undef, undef, undef, undef);
+CheckArray2(47, 13, $h{'scalar_ind'}, undef, undef, undef, undef, undef);
+
+# 48: madd_polynom
+$s = $_->madd_polynom("data", "mnew3", 3, "in1", [ 3.9, 4.8, 5.7, 6.6 ]);
+CheckOK2(48, 1);
+CheckNum2(48, 2, $s, 0);
+
+%h = $_->entry("data/mnew3");
+CheckOK2(48, 3);
+CheckArray2(48, 4, $h{'a'}, 3.9, 4.8, 5.7, 6.6);
+CheckString2(48, 7, $h{'field'}, "data/mnew3");
+CheckNum2(48, 8, $h{'field_type'}, $GetData::POLYNOM_ENTRY);
+CheckNum2(48, 9, $h{'fragment_index'}, 0);
+CheckString2(48, 10, $h{'in_fields'}, "in1");
+CheckNum2(48, 11, $h{'poly_ord'}, 3);
+CheckSArray2(48, 12, $h{'scalar'}, undef, undef, undef, undef);
+CheckArray2(48, 13, $h{'scalar_ind'}, undef, undef, undef, undef);
+
+# 50: madd_linterp
+$s = $_->madd_linterp("data", "mnew6", "in", "./more/table");
+CheckOK2(50, 1);
+CheckNum2(50, 2, $s, 0);
+
+%h = $_->entry("data/mnew6");
+CheckOK2(50, 2);
+CheckString2(50, 3, $h{'field'}, "data/mnew6");
+CheckNum2(50, 4, $h{'field_type'}, $GetData::LINTERP_ENTRY);
+CheckNum2(50, 5, $h{'fragment_index'}, 0);
+CheckString2(50, 6, $h{'in_fields'}, "in");
+CheckString2(50, 7, $h{'table'}, "./more/table");
+
+# 51: madd_bit
+$s = $_->madd_bit("data", "mnew7", "in1", 3, 2);
+CheckOK2(51, 1);
+CheckNum2(51, 2, $s, 0);
+
+%h = $_->entry("data/mnew7");
+CheckOK(51, 2);
+CheckNum2(51, 3, $h{'bitnum'}, 3);
+CheckString2(51, 4, $h{'field'}, "data/mnew7");
+CheckNum2(51, 5, $h{'field_type'}, $GetData::BIT_ENTRY);
+CheckNum2(51, 6, $h{'fragment_index'}, 0);
+CheckString2(51, 7, $h{'in_fields'}, "in1");
+CheckNum2(51, 8, $h{'numbits'}, 2);
+CheckSArray2(51, 9, $h{'scalar'}, undef, undef);
+CheckArray2(51, 10, $h{'scalar_ind'}, undef, undef);
+
+# 52: madd_sbit
+$s = $_->madd_sbit("data", "mnew8", "in2", 4, 5);
+CheckOK2(52, 1);
+CheckNum2(52, 2, $s, 0);
+
+%h = $_->entry("data/mnew8");
+CheckOK(52, 2);
+CheckNum2(52, 3, $h{'bitnum'}, 4);
+CheckString2(52, 4, $h{'field'}, "data/mnew8");
+CheckNum2(52, 5, $h{'field_type'}, $GetData::SBIT_ENTRY);
+CheckNum2(52, 6, $h{'fragment_index'}, 0);
+CheckString2(52, 7, $h{'in_fields'}, "in2");
+CheckNum2(52, 8, $h{'numbits'}, 5);
+CheckSArray2(52, 9, $h{'scalar'}, undef, undef);
+CheckArray2(52, 10, $h{'scalar_ind'}, undef, undef);
+
+# 53: madd_mutiply
+$s = $_->madd_multiply("data", "mnew9", "in3", "in2");
+CheckOK2(53, 1);
+CheckNum2(53, 2, $s, 0);
+
+%h = $_->entry("data/mnew9");
+CheckOK2(53, 3);
+CheckString2(53, 4, $h{'field'}, "data/mnew9");
+CheckNum2(53, 5, $h{'field_type'}, $GetData::MULTIPLY_ENTRY);
+CheckNum2(53, 6, $h{'fragment_index'}, 0);
+CheckSArray2(53, 7, $h{'in_fields'}, qw(in3 in2));
+
+# 54: madd_phase
+$s = $_->madd_phase("data", "mnew10", "in6", 44);
+CheckOK2(54, 1);
+CheckNum2(54, 2, $s, 0);
+
+%h = $_->entry("data/mnew10");
+CheckOK2(54, 2);
+CheckString2(54, 3, $h{'field'}, "data/mnew10");
+CheckNum2(54, 4, $h{'field_type'}, $GetData::PHASE_ENTRY);
+CheckNum2(54, 5, $h{'fragment_index'}, 0);
+CheckString2(54, 6, $h{'in_fields'}, "in6");
+CheckSArray2(54, 7, $h{'scalar'}, undef);
+CheckArray2(54, 8, $h{'scalar_ind'}, undef);
+CheckNum2(54, 9, $h{'shift'}, 44);
+
+# 55: madd_const
+$s = $_->madd_const("data", "mnew11", $GetData::FLOAT64, 9.2);
+CheckOK2(55, 1);
+CheckNum2(55, 2, $s, 0);
+
+%h = $_->entry("data/mnew11");
+CheckOK2(55, 3);
+CheckNum2(55, 4, $h{'const_type'}, $GetData::FLOAT64);
+CheckString2(55, 5, $h{'field'}, "data/mnew11");
+CheckNum2(55, 6, $h{'field_type'}, $GetData::CONST_ENTRY);
+CheckNum2(55, 7, $h{'fragment_index'}, 0);
+
+$s = $_->get_constant("data/mnew11", $GetData::FLOAT64);
+CheckOK2(55, 8);
+CheckNum2(55, 9, $s, 9.2);
+
+# 126: madd check
+$s = $_->madd({
+    field          => "mnew13",
+    field_type     => $GetData::PHASE_ENTRY,
+    fragment_index => 0,
+    in_fields      => "data",
+    shift          => 2
+  }, "data");
+CheckOK2(126,1);
+CheckNum2(126, 2, $s, 0);
+
+%h = $_->entry("data/mnew13");
+CheckOK2(126, 2);
+CheckString2(126, 3, $h{'field'}, "data/mnew13");
+CheckNum2(126, 4, $h{'field_type'}, $GetData::PHASE_ENTRY);
+CheckNum2(126, 5, $h{'fragment_index'}, 0);
+CheckString2(126, 6, $h{'in_fields'}, "data");
+CheckSArray2(126, 7, $h{'scalar'}, undef);
+CheckArray2(126, 8, $h{'scalar_ind'}, undef);
+CheckNum2(126, 9, $h{'shift'}, 2);
+
+# 56: get_string
+$s = $_->get_string("string");
+CheckOK(56);
+CheckString(56, $s, "Zaphod Beeblebrox");
+
+# 57: add_string
+$s = $_->add_string("new12", "a string");
+CheckOK2(57, 1);
+CheckNum2(57, 2, $s, 0);
+
+%h = $_->entry("new12");
+CheckOK2(57, 3);
+CheckString2(57, 4, $h{'field'}, "new12");
+CheckNum2(57, 5, $h{'field_type'}, $GetData::STRING_ENTRY);
+CheckNum2(57, 6, $h{'fragment_index'}, 0);
+
+$s = $_->get_string("new12");
+CheckOK2(57, 7);
+CheckString2(57, 8, $s, "a string");
+
+# 58: madd_string
+$s = $_->madd_string("data", "mnew12", "another string");
+CheckOK2(58, 1);
+CheckNum2(58, 2, $s, 0);
+
+%h = $_->entry("data/mnew12");
+CheckOK2(58, 3);
+CheckString2(58, 4, $h{'field'}, "data/mnew12");
+CheckNum2(58, 5, $h{'field_type'}, $GetData::STRING_ENTRY);
+CheckNum2(58, 6, $h{'fragment_index'}, 0);
+
+$s = $_->get_string("data/mnew12");
+CheckOK2(58, 7);
+CheckString2(58, 8, $s, "another string");
+
+# 59: add_spec
+$s = $_->add_spec("lorem STRING \"Lorem ipsum\"", 0);
+CheckOK2(59, 1);
+CheckNum2(59, 2, $s, 0);
+
+%h = $_->entry("lorem");
+CheckOK2(59, 3);
+CheckString2(59, 4, $h{'field'}, "lorem");
+CheckNum2(59, 5, $h{'field_type'}, $GetData::STRING_ENTRY);
+CheckNum2(59, 6, $h{'fragment_index'}, 0);
+
+$s = $_->get_string("lorem");
+CheckOK2(59, 7);
+CheckString2(59, 8, $s, "Lorem ipsum");
+
+# 60: add_spec
+$s = $_->madd_spec("ipsum STRING \"dolor sit amet.\"", "lorem");
+CheckOK2(60, 1);
+CheckNum2(60, 2, $s, 0);
+
+%h = $_->entry("lorem/ipsum");
+CheckOK2(60, 3);
+CheckString2(60, 4, $h{'field'}, "lorem/ipsum");
+CheckNum2(60, 5, $h{'field_type'}, $GetData::STRING_ENTRY);
+CheckNum2(60, 6, $h{'fragment_index'}, 0);
+
+$s = $_->get_string("lorem/ipsum");
+CheckOK2(60, 7);
+CheckString2(60, 8, $s, "dolor sit amet.");
+
+# 61: put_constant
+$s = $_->put_constant("const", 61);
+CheckOK2(61, 1);
+CheckNum2(61, 2, $s, 0);
+
+$s = $_->get_constant("const", $GetData::FLOAT64);
+CheckOK2(61, 3);
+CheckNum2(61, 4, $s, 61.);
+
+# 62: put_string
+$s = $_->put_string("string", "Arthur Dent");
+CheckOK2(62, 1);
+CheckNum2(62, 2, $s, 12);
+
+$s = $_->get_string("string");
+CheckOK2(62, 3);
+CheckString2(62, 4, $s, "Arthur Dent");
+
+# 63: nmfields_by_type
+$s = $_->mfield_list_by_type("data", $GetData::LINCOM_ENTRY);
+CheckOK(63);
+CheckNum(63, $s, 1);
+
+# 64: mfield_list_by_type
+ at a = $_->mfield_list_by_type("data", $GetData::LINCOM_ENTRY);
+CheckOK(64);
+CheckSArray(64, \@a, qw(mnew2));
+
+# 65: nmfields_by_type
+$s = $_->mvector_list("data");
+CheckOK(65);
+CheckNum(65, $s, 9);
+
+# 66: mfield_list_by_type
+ at a = $_->mvector_list("data");
+CheckOK(66);
+CheckSArray(66, \@a,
+  qw(mlut mnew2 mnew3 mnew6 mnew7 mnew8 mnew9 mnew10 mnew13));
+
+# 67: alter raw
+$s = $_->alter_raw("new1", $GetData::INT32, undef);
+CheckOK2(67, 1);
+CheckNum2(67, 2, $s, 0);
+
+%h = $_->entry("new1");
+CheckOK2(67, 3);
+CheckNum2(67, 4, $h{'data_type'}, $GetData::INT32);
+CheckString2(67, 5, $h{'field'}, "new1");
+CheckNum2(67, 6, $h{'field_type'}, $GetData::RAW_ENTRY);
+CheckNum2(67, 7, $h{'fragment_index'}, 0);
+CheckSArray2(67, 8, $h{'scalar'}, undef);
+CheckArray2(67, 9, $h{'scalar_ind'}, undef);
+CheckNum2(67, 10, $h{'spf'}, 3);
+
+#69: alter_lincom check
+$s = $_->alter_lincom("new3", undef, [ qw(in3 in4) ], [ 3., 4. ]);
+CheckOK2(69, 1);
+CheckNum2(69, 2, $s, 0);
+
+%h = $_->entry("new3");
+CheckOK2(69, 3);
+CheckArray2(69, 4, $h{'b'}, 1.3+1.4*i, 1.6+1.7*i);
+CheckArray2(69, 5, $h{'m'}, 3, 4);
+CheckString2(69, 7, $h{'field'}, "new3");
+CheckNum2(69, 8, $h{'field_type'}, $GetData::LINCOM_ENTRY);
+CheckNum2(69, 9, $h{'fragment_index'}, 0);
+CheckSArray2(69, 10, $h{'in_fields'}, qw(in3 in4));
+CheckNum2(69, 11, $h{'n_fields'}, 2);
+CheckSArray2(69, 12, $h{'scalar'}, undef, undef, undef, undef, undef);
+CheckArray2(69, 13, $h{'scalar_ind'}, undef, undef, undef, undef, undef);
+
+# 71: alter_polynom
+$s = $_->alter_polynom("new4", 4, undef, [ 1*i, 2*i, 3*i, 4*i, 5*i ]);
+CheckOK2(71, 1);
+CheckNum2(71, 2, $s, 0);
+
+%h = $_->entry("new4");
+CheckOK2(71, 3);
+CheckArray2(71, 4, $h{'a'}, 1*i, 2*i, 3*i, 4*i, 5*i);
+CheckString2(71, 7, $h{'field'}, "new4");
+CheckNum2(71, 8, $h{'field_type'}, $GetData::POLYNOM_ENTRY);
+CheckNum2(71, 9, $h{'fragment_index'}, 0);
+CheckString2(71, 10, $h{'in_fields'}, "in1");
+CheckNum2(71, 11, $h{'poly_ord'}, 4);
+CheckSArray2(71, 12, $h{'scalar'}, undef, undef, undef, undef, undef);
+CheckArray2(71, 13, $h{'scalar_ind'}, undef, undef, undef, undef, undef);
+
+# 72: alter_linterp
+$s = $_->alter_linterp("new6", undef, "./other/table");
+CheckOK2(72, 1);
+CheckNum2(72, 2, $s, 0);
+
+%h = $_->entry("new6");
+CheckOK2(72, 2);
+CheckString2(72, 3, $h{'field'}, "new6");
+CheckNum2(72, 4, $h{'field_type'}, $GetData::LINTERP_ENTRY);
+CheckNum2(72, 5, $h{'fragment_index'}, 0);
+CheckString2(72, 6, $h{'in_fields'}, "in");
+CheckString2(72, 7, $h{'table'}, "./other/table");
+
+# 73: alter_bit
+$s = $_->alter_bit("new7", "in3", undef, 8);
+CheckOK2(73, 1);
+CheckNum2(73, 2, $s, 0);
+
+%h = $_->entry("new7");
+CheckOK(73, 2);
+CheckNum2(73, 3, $h{'bitnum'}, 11);
+CheckString2(73, 4, $h{'field'}, "new7");
+CheckNum2(73, 5, $h{'field_type'}, $GetData::BIT_ENTRY);
+CheckNum2(73, 6, $h{'fragment_index'}, 0);
+CheckString2(73, 7, $h{'in_fields'}, "in3");
+CheckNum2(73, 8, $h{'numbits'}, 8);
+CheckSArray2(73, 9, $h{'scalar'}, undef, undef);
+CheckArray2(73, 10, $h{'scalar_ind'}, undef, undef);
+
+# 74: alter_sbit
+$s = $_->alter_sbit("new8", "in1");
+CheckOK2(74, 1);
+CheckNum2(74, 2, $s, 0);
+
+%h = $_->entry("new8");
+CheckOK(74, 2);
+CheckNum2(74, 3, $h{'bitnum'}, 5);
+CheckString2(74, 4, $h{'field'}, "new8");
+CheckNum2(74, 5, $h{'field_type'}, $GetData::SBIT_ENTRY);
+CheckNum2(74, 6, $h{'fragment_index'}, 0);
+CheckString2(74, 7, $h{'in_fields'}, "in1");
+CheckNum2(74, 8, $h{'numbits'}, 10);
+CheckSArray2(74, 9, $h{'scalar'}, undef, undef);
+CheckArray2(74, 10, $h{'scalar_ind'}, undef, undef);
+
+# 75: alter_mutiply
+$s = $_->alter_multiply("new9", "in1");
+CheckOK2(75, 1);
+CheckNum2(75, 2, $s, 0);
+
+%h = $_->entry("new9");
+CheckOK2(75, 3);
+CheckString2(75, 4, $h{'field'}, "new9");
+CheckNum2(75, 5, $h{'field_type'}, $GetData::MULTIPLY_ENTRY);
+CheckNum2(75, 6, $h{'fragment_index'}, 0);
+CheckSArray2(75, 7, $h{'in_fields'}, qw(in1 in3));
+
+# 76: alter_phase
+$s = $_->alter_phase("new10", undef, -3);
+CheckOK2(76, 1);
+CheckNum2(76, 2, $s, 0);
+
+%h = $_->entry("new10");
+CheckOK2(76, 2);
+CheckString2(76, 3, $h{'field'}, "new10");
+CheckNum2(76, 4, $h{'field_type'}, $GetData::PHASE_ENTRY);
+CheckNum2(76, 5, $h{'fragment_index'}, 0);
+CheckString2(76, 6, $h{'in_fields'}, "in6");
+CheckSArray2(76, 7, $h{'scalar'}, undef);
+CheckArray2(76, 8, $h{'scalar_ind'}, undef);
+CheckNum2(76, 9, $h{'shift'}, -3);
+
+# 77: alter_const
+$s = $_->alter_const("new11", $GetData::FLOAT32);
+CheckOK2(77, 1);
+CheckNum2(77, 2, $s, 0);
+
+%h = $_->entry("new11");
+CheckOK2(77, 3);
+CheckNum2(77, 4, $h{'const_type'}, $GetData::FLOAT32);
+CheckString2(77, 5, $h{'field'}, "new11");
+CheckNum2(77, 6, $h{'field_type'}, $GetData::CONST_ENTRY);
+CheckNum2(77, 7, $h{'fragment_index'}, 0);
+
+# 141: alter check
+$s = $_->alter_entry("new13", {
+    field          => undef,
+    field_type     => $GetData::PHASE_ENTRY,
+    fragment_index => 0,
+    in_fields      => "new3",
+    shift          => -2
+  });
+CheckOK2(141,1);
+CheckNum2(141, 2, $s, 0);
+
+%h = $_->entry("new13");
+CheckOK2(141, 2);
+CheckString2(141, 3, $h{'field'}, "new13");
+CheckNum2(141, 4, $h{'field_type'}, $GetData::PHASE_ENTRY);
+CheckNum2(141, 5, $h{'fragment_index'}, 0);
+CheckString2(141, 6, $h{'in_fields'}, "new3");
+CheckSArray2(141, 7, $h{'scalar'}, undef);
+CheckArray2(141, 8, $h{'scalar_ind'}, undef);
+CheckNum2(141, 9, $h{'shift'}, -2);
+
+# 78: encoding check
+$s = $_->encoding(0);
+CheckOK(78);
+CheckNum(78, $s, $GetData::UNENCODED);
+
+# 79: endianness check
+$s = $_->endianness(0);
+CheckOK(79);
+CheckNum(79, $s, $GetData::LITTLE_ENDIAN | $GetData::NOT_ARM_ENDIAN);
+
+# 80: dirfilename
+$s = $_->dirfilename;
+CheckOK(80);
+CheckEOString(80, $s, "dirfile");
+
+# 81: parent_fragment
+$s = $_->parent_fragment(1);
+CheckOK(81);
+CheckNum(81, $s, 0);
+
+# 82: alter_protection
+$s = $_->alter_protection($GetData::PROTECT_DATA, 1);
+CheckOK(82);
+CheckNum(82, $s, 0);
+
+# 83: protection
+$s = $_->protection(1);
+CheckOK(83);
+CheckNum(83, $s, $GetData::PROTECT_DATA);
+
+# 84: raw_filename
+$s = $_->raw_filename("data");
+CheckOK(84);
+CheckEOString(84, $s, "dirfile/data");
+
+# 85: reference
+$s = $_->reference("new1");
+CheckOK(85);
+CheckString(85, $s, "new1");
+
+# 87: alter_encoding
+$s = $_->alter_encoding($GetData::SLIM_ENCODED, 1);
+CheckOK2(87, 1);
+CheckNum2(87, 2, $s, 0);
+
+$s = $_->encoding(1);
+CheckOK2(87, 3);
+CheckNum2(87, 4, $s, $GetData::SLIM_ENCODED);
+
+# 88: alter_endianness
+$s = $_->alter_endianness($GetData::BIG_ENDIAN, 1);
+CheckOK2(88, 1);
+CheckNum2(88, 2, $s, 0);
+
+$s = $_->endianness(1);
+CheckOK2(88, 3);
+CheckNum2(88, 4, $s, $GetData::BIG_ENDIAN);
+
+# 89: alter_spec
+$s = $_->alter_spec("new10 PHASE in const");
+CheckOK2(89, 1);
+CheckNum2(89, 2, $s, 0);
+
+%h = $_->entry("new10");
+CheckOK2(89, 2);
+CheckString2(89, 3, $h{'field'}, "new10");
+CheckNum2(89, 4, $h{'field_type'}, $GetData::PHASE_ENTRY);
+CheckNum2(89, 5, $h{'fragment_index'}, 0);
+CheckString2(89, 6, $h{'in_fields'}, "in");
+CheckSArray2(89, 7, $h{'scalar'}, "const");
+CheckArray2(89, 8, $h{'scalar_ind'}, -1);
+CheckNum2(89, 9, $h{'shift'}, 61);
+
+# 90: delete
+$s = $_->delete("new10");
+CheckOK2(90, 0);
+CheckNum2(90, 1, $s, 0);
+
+$s = $_->entry("new10");
+CheckError2(90, 2, $GetData::E_BAD_CODE);
+CheckNum2(90, 3, $s, undef);
+
+# 91: malter_spec
+$s = $_->malter_spec("mnew10 PHASE in4 11", "data");
+CheckOK2(91, 0);
+CheckNum2(91, 1, $s, 0);
+
+%h = $_->entry("data/mnew10");
+CheckOK2(91, 2);
+CheckString2(91, 3, $h{'field'}, "data/mnew10");
+CheckNum2(91, 4, $h{'field_type'}, $GetData::PHASE_ENTRY);
+CheckNum2(91, 5, $h{'fragment_index'}, 0);
+CheckString2(91, 6, $h{'in_fields'}, "in4");
+CheckSArray2(91, 7, $h{'scalar'}, undef);
+CheckArray2(91, 8, $h{'scalar_ind'}, undef);
+CheckNum2(91, 9, $h{'shift'}, 11);
+
+# 92: move
+$s = $_->move("new9", 1);
+CheckOK2(92, 0);
+CheckNum2(92, 1, $s, 0);
+
+%h = $_->entry("new9");
+CheckOK2(92, 3);
+CheckString2(92, 4, $h{'field'}, "new9");
+CheckNum2(92, 5, $h{'field_type'}, $GetData::MULTIPLY_ENTRY);
+CheckNum2(92, 6, $h{'fragment_index'}, 1);
+CheckSArray2(92, 7, $h{'in_fields'}, qw(in1 in3));
+
+# 93: move
+$s = $_->rename(qw(new9 newer));
+CheckOK2(93, 0);
+CheckNum2(93, 1, $s, 0);
+
+$s = $_->entry("new9");
+CheckError2(93, 2, $GetData::E_BAD_CODE);
+
+%h = $_->entry("newer");
+CheckOK2(93, 3);
+CheckString2(93, 4, $h{'field'}, "newer");
+CheckNum2(93, 5, $h{'field_type'}, $GetData::MULTIPLY_ENTRY);
+CheckNum2(93, 6, $h{'fragment_index'}, 1);
+CheckSArray2(93, 7, $h{'in_fields'}, qw(in1 in3));
+
+# 94: uninclude
+$s = $_->uninclude(1);
+CheckOK2(94, 0);
+CheckNum2(94, 1, $s, 0);
+
+$s = $_->entry("newer");
+CheckError2(94, 2, $GetData::E_BAD_CODE);
+
+# 95: frameoffset
+$s = $_->frameoffset(0);
+CheckOK(95);
+CheckNum(95, $s, 0);
+
+# 96: alter_frameoffset
+$s = $_->alter_frameoffset(33, 0);
+CheckOK2(96, 0);
+CheckNum2(96, 1, $s, 0);
+
+$s = $_->frameoffset(0);
+CheckOK2(96, 2);
+CheckNum2(96, 3, $s, 33);
+
+# 97: native_type
+$s = $_->native_type("data");
+CheckOK(97);
+CheckNum(97, $s, $GetData::INT8);
+
+# 99: validate
+$s = $_->validate("new7");
+CheckError(99, $GetData::E_BAD_CODE);
+CheckNum(99, $s, undef);
+
+# 101: framenum
+$s = $_->framenum("data", 33.3, 6);
+CheckOK(101);
+CheckNum(101, $s, 37.0375);
+
+# 86: gd_eof
+$s = $_->eof("lincom");
+CheckOK(86);
+CheckNum(86, $s, 345);
+
+# 142: gd_bof
+$s = $_->bof("lincom");
+CheckOK(142);
+CheckNum(142, $s, 264);
+
+# 143: divide entry
+%h = $_->entry("div");
+CheckOK(143);
+CheckSArray2(143, 0, [ sort keys %h ], qw(field field_type fragment_index),
+  "in_fields");
+CheckString2(143, 1, $h{'field'}, "div");
+CheckNum2(143, 2, $h{'field_type'}, $GetData::DIVIDE_ENTRY);
+CheckNum2(143, 3, $h{'fragment_index'}, 0);
+CheckSArray2(143, 4, $h{'in_fields'}, qw(mult bit));
+
+# 145: recip entry
+%h = $_->entry("recip");
+CheckOK(145);
+CheckSArray2(145, 1, [ sort keys %h ], qw(dividend field field_type),
+  qw(fragment_index in_fields scalar scalar_ind));
+CheckNum2(145, 2, $h{'dividend'}, 6.5 + 4.3 * i);
+CheckString2(145, 3, $h{'field'}, "recip");
+CheckNum2(145, 4, $h{'field_type'}, $GetData::RECIP_ENTRY);
+CheckNum2(145, 5, $h{'fragment_index'}, 0);
+CheckString2(145, 6, $h{'in_fields'}, "div");
+CheckSArray2(145, 7, $h{'scalar'}, undef);
+CheckArray2(145, 8, $h{'scalar_ind'}, undef);
+
+# 146: add divide
+$s = $_->add_divide(qw(new14 in2 in3));
+CheckOK2(146, 0);
+CheckNum2(146, 1, $s, 0);
+
+%h = $_->entry("new14");
+CheckOK(146);
+CheckString2(146, 1, $h{'field'}, "new14");
+CheckNum2(146, 2, $h{'field_type'}, $GetData::DIVIDE_ENTRY);
+CheckNum2(146, 3, $h{'fragment_index'}, 0);
+CheckSArray2(146, 4, $h{'in_fields'}, qw(in2 in3));
+
+# 148: add recip
+$s = $_->add_recip(qw(new16 in2), 33.3 + 44.4 * i);
+CheckOK2(148, 0);
+CheckNum2(148, 1, $s, 0);
+
+%h = $_->entry("new16");
+CheckOK(148);
+CheckNum2(148, 2, $h{'dividend'}, 33.3 + 44.4 * i);
+CheckString2(148, 3, $h{'field'}, "new16");
+CheckNum2(148, 4, $h{'field_type'}, $GetData::RECIP_ENTRY);
+CheckNum2(148, 5, $h{'fragment_index'}, 0);
+CheckString2(148, 6, $h{'in_fields'}, "in2");
+CheckSArray2(148, 7, $h{'scalar'}, undef);
+CheckArray2(148, 8, $h{'scalar_ind'}, undef);
+
+# 149: madd divide
+$s = $_->madd_divide(qw(data mnew14 in1 in8));
+CheckOK2(149, 0);
+CheckNum2(149, 1, $s, 0);
+
+%h = $_->entry("data/mnew14");
+CheckOK(149);
+CheckString2(149, 1, $h{'field'}, "data/mnew14");
+CheckNum2(149, 2, $h{'field_type'}, $GetData::DIVIDE_ENTRY);
+CheckNum2(149, 3, $h{'fragment_index'}, 0);
+CheckSArray2(149, 4, $h{'in_fields'}, qw(in1 in8));
+
+# 151: add recip
+$s = $_->madd_recip(qw(data mnew16 in2), 1.0);
+CheckOK2(151, 0);
+CheckNum2(151, 1, $s, 0);
+
+%h = $_->entry("data/mnew16");
+CheckOK(151);
+CheckNum2(151, 2, $h{'dividend'}, 1);
+CheckString2(151, 3, $h{'field'}, "data/mnew16");
+CheckNum2(151, 4, $h{'field_type'}, $GetData::RECIP_ENTRY);
+CheckNum2(151, 5, $h{'fragment_index'}, 0);
+CheckString2(151, 6, $h{'in_fields'}, "in2");
+CheckSArray2(151, 7, $h{'scalar'}, undef);
+CheckArray2(151, 8, $h{'scalar_ind'}, undef);
+
+# 152: alter_divide
+$s = $_->alter_divide("new14", "in5");
+CheckOK2(152, 1);
+CheckNum2(152, 2, $s, 0);
+
+%h = $_->entry("new14");
+CheckOK2(152, 3);
+CheckString2(152, 4, $h{'field'}, "new14");
+CheckNum2(152, 5, $h{'field_type'}, $GetData::DIVIDE_ENTRY);
+CheckNum2(152, 6, $h{'fragment_index'}, 0);
+CheckSArray2(152, 7, $h{'in_fields'}, qw(in5 in3));
+
+# 153: alter recip
+$s = $_->alter_recip("new16", "in6", undef);
+CheckOK2(153, 1);
+CheckNum2(153, 2, $s, 0);
+
+%h = $_->entry("new16");
+CheckOK(151);
+CheckNum2(151, 2, $h{'dividend'}, 33.3 + 44.4 * i);
+CheckString2(151, 3, $h{'field'}, "new16");
+CheckNum2(151, 4, $h{'field_type'}, $GetData::RECIP_ENTRY);
+CheckNum2(151, 5, $h{'fragment_index'}, 0);
+CheckString2(151, 6, $h{'in_fields'}, "in6");
+CheckSArray2(151, 7, $h{'scalar'}, undef);
+CheckArray2(151, 8, $h{'scalar_ind'}, undef);
+
+# 155: rewrite fragment
+$s = $_->rewrite_fragment(0);
+CheckOK(155, 0);
+CheckNum(155, $s, 0);
+
+# 156: invalid dirfile
+my $d = $_;
+$_ = &GetData::invalid_dirfile;
+CheckOK2(156, 0);
+$s = $_->fragments;
+CheckError2(156, 1, $GetData::E_BAD_DIRFILE);
+CheckNum2(156, 2, $s, 0);
+$_->close;
+$_ = $d;
+
+# 157: dirfile standards
+$s = $_->dirfile_standards;
+CheckOK2(157, 1);
+CheckNum2(157, 2, $s, $GetData::DIRFILE_STANDARDS_VERSION);
+
+$s = $_->dirfile_standards(0);
+CheckError2(157, 3, $GetData::E_ARGUMENT);
+CheckNum2(157, 4, $s, undef);
+
+# 158: get_carray
+$s = $_->get_carray("carray", $GetData::INT8);
+CheckOK(158);
+CheckString(158, $s, "\1\2\3\4\5\6");
+
+# 164: get_carray_slice
+ at a = $_->get_carray_slice("carray", 2, 2, $GetData::FLOAT64);
+CheckOK(164);
+CheckArray(164, \@a, 3.3, 4.4);
+
+# 167: carrays
+$s = $_->carrays($GetData::INT8);
+CheckOK2(167, 1);
+CheckNum2(167, 2, $#$s, 0);
+CheckSArray2(167, 3, $s, "\1\2\3\4\5\6");
+
+ at a = $_->carrays($GetData::FLOAT64);
+CheckOK2(167, 4);
+CheckNum2(167, 5, $#a, 0);
+CheckArray2(167, 6, $a[0], 1.1, 2.2, 3.3, 4.4, 5.5, 6.6 );
+
+# 168: put carray
+$s = $_->put_carray("carray", 9, 8, 7, 6, 5, 4);
+CheckOK2(168, 1);
+CheckNum2(168, 2, $s, 0);
+
+ at a = $_->get_carray("carray", $GetData::INT8);
+CheckOK2(168, 3);
+CheckArray2(168, 4, \@a, 9, 8, 7, 6, 5, 4);
+
+#169 put caray slice
+$s = $_->put_carray_slice("carray", 2, [ 169, 169 ]);
+CheckOK2(168, 1);
+CheckNum2(168, 2, $s, 0);
+
+ at a = $_->get_carray("carray", $GetData::UINT8);
+CheckOK2(168, 3);
+CheckArray2(168, 4, \@a, 9, 8, 169, 169, 5, 4);
+
+# 177: carray len
+$s = $_->carray_len("carray");
+CheckOK(177);
+CheckNum(177, $s, 6);
+
+# 178: carray entry
+%h = $_->entry("carray");
+CheckOK2(178, 1);
+CheckSArray2(178, 2, [ sort keys %h ],
+  qw(array_len const_type field field_type fragment_index));
+CheckNum2(178, 3, $h{'array_len'}, 6);
+CheckNum2(178, 4, $h{'const_type'}, $GetData::FLOAT64);
+CheckString2(178, 5, $h{'field'}, "carray");
+CheckNum2(178, 6, $h{'field_type'}, $GetData::CARRAY_ENTRY);
+CheckNum2(178, 7, $h{'fragment_index'}, 0);
+
+# 179: add carray
+$s = $_->add_carray("new17", $GetData::FLOAT64, 0, undef, 1.79, 17.9);
+CheckOK2(179, 1);
+CheckNum2(179, 2, $s, 0);
+
+%h = $_->entry("new17");
+CheckOK2(179, 3);
+CheckNum2(179, 4, $h{'array_len'}, 2);
+CheckNum2(179, 5, $h{'const_type'}, $GetData::FLOAT64);
+CheckString2(179, 6, $h{'field'}, "new17");
+CheckNum2(179, 7, $h{'field_type'}, $GetData::CARRAY_ENTRY);
+CheckNum2(179, 8, $h{'fragment_index'}, 0);
+
+ at a = $_->get_carray("new17", $GetData::FLOAT64);
+CheckOK2(179, 9);
+CheckArray2(179, 10, \@a, 1.79, 17.9);
+
+# 180: add carray
+$s = $_->madd_carray("data", "mnew17", $GetData::FLOAT64, undef, 1.80, 18.0);
+CheckOK2(180, 1);
+CheckNum2(180, 2, $s, 0);
+
+%h = $_->entry("data/mnew17");
+CheckOK2(180, 3);
+CheckNum2(180, 4, $h{'array_len'}, 2);
+CheckNum2(180, 5, $h{'const_type'}, $GetData::FLOAT64);
+CheckString2(180, 6, $h{'field'}, "data/mnew17");
+CheckNum2(180, 7, $h{'field_type'}, $GetData::CARRAY_ENTRY);
+CheckNum2(180, 8, $h{'fragment_index'}, 0);
+
+ at a = $_->get_carray("data/mnew17", $GetData::FLOAT64);
+CheckOK2(180, 9);
+CheckArray2(180, 10, \@a, 1.80, 18.0);
+
+# 183: constants
+$s = $_->constants($GetData::UINT8);
+CheckOK2(183, 0);
+CheckString2(183, 1, $s, "=!");
+
+ at a = $_->constants($GetData::FLOAT64);
+CheckOK2(183, 2);
+CheckArray2(183, 3, \@a, 61, 33.3);
+
+# 191: mconstants
+$s = $_->mconstants("data", $GetData::UINT8);
+CheckOK2(191, 0);
+CheckString2(191, 1, $s, "\3\011");
+
+ at a = $_->mconstants("data", $GetData::FLOAT64);
+CheckOK2(191, 2);
+CheckArray2(191, 3, \@a, 3.3, 9.2);
+
+# 199: strings
+$s = $_->strings;
+CheckOK2(199, 1);
+CheckNum2(199, 2, $s, 3);
+
+ at a = $_->strings;
+CheckOK2(199, 3);
+CheckSArray2(199, 4, \@a, "Lorem ipsum", "a string", "Arthur Dent");
+
+# 200: mstrings
+$s = $_->mstrings("data");
+CheckOK2(200, 1);
+CheckNum2(200, 2, $s, 2);
+
+ at a = $_->mstrings("data");
+CheckOK2(200, 3);
+CheckSArray2(200, 4, \@a, "This is a string constant.", "another string");
+
+# 203: seek
+$s = $_->seek("data", 35, 0, $GetData::SEEK_SET);
+CheckOK2(203, 0);
+CheckNum2(203, 0, $s, 280);
+
+$s = $_->getdata("data", $GetData::HERE, 0, 1, 0, $GetData::INT8);
+CheckOK2(203, 1);
+CheckNum2(203, 1, length($s), 8);
+CheckString2(203, 2, $s, join "", map chr, 17 .. 24);
+
+# 204: tell
+$s = $_->tell("data");
+CheckOK(204);
+CheckNum(204,$s,288);
+
+# 205: gd_hide check
+$s = $_->hide('data');
+CheckOK(205);
+
+# 206: gd_hidden check
+$s = $_->hidden('data');
+CheckOK2(206, 1);
+CheckNum2(206, 1, $s, 1);
+
+$s = $_->hidden('lincom');
+CheckOK2(206, 2);
+CheckNum2(206, 2, $s, 0);
+
+# 207: gd_unhide check
+$s = $_->unhide('data');
+CheckOK2(206, 1);
+$s = $_->hidden('data');
+CheckOK2(206, 2);
+CheckNum(206, $s, 0);
+
+# 208: gd_sync check
+$s = $_->sync('data');
+CheckOK(208);
+
+# 209: gd_flush check
+$s = $_->flush('data');
+CheckOK(209);
+
+# 210: gd_metaflush check
+$s = $_->metaflush();
+CheckOK(210);
+
+# 211: gd_entry (WINDOW) check
+%h = $_->entry('window');
+CheckOK(211);
+CheckNum2(211, 1, $h{"field_type"}, $GetData::WINDOW_ENTRY);
+CheckNum2(211, 2, $h{"fragment_index"}, 0);
+CheckNum2(211, 3, $h{"windop"}, $GetData::WINDOP_LT);
+CheckSArray2(211, 4, $h{"in_fields"}, 'linterp', 'mult');
+CheckNum2(211, 5, $h{"threshold"}, 4.1);
+
+# 212: gd_add_window check
+$s = $_->add_window('new18', 'in1', 'in2', $GetData::WINDOP_NE, 32, 0);
+CheckOK2(212, 1);
+
+%h = $_->entry('new18');
+CheckOK2(212, 2);
+CheckNum2(212, 1, $h{"field_type"}, $GetData::WINDOW_ENTRY);
+CheckNum2(212, 2, $h{"fragment_index"}, 0);
+CheckNum2(212, 3, $h{"windop"}, $GetData::WINDOP_NE);
+CheckSArray2(212, 4, $h{"in_fields"}, 'in1', 'in2');
+CheckNum2(212, 5, $h{"threshold"}, 32);
+
+# 214: gd_madd_window check
+$s = $_->madd_window('data', 'mnew18', 'in2', 'in3', $GetData::WINDOP_SET, 128);
+CheckOK2(214, 1);
+
+%h = $_->entry('data/mnew18');
+CheckOK2(214, 2);
+CheckNum2(214, 1, $h{"field_type"}, $GetData::WINDOW_ENTRY);
+CheckNum2(214, 2, $h{"fragment_index"}, 0);
+CheckNum2(214, 3, $h{"windop"}, $GetData::WINDOP_SET);
+CheckSArray2(214, 4, $h{"in_fields"}, 'in2', 'in3');
+CheckNum2(214, 5, $h{"threshold"}, 128);
+
+# 217: gd_alter_window check
+$s = $_->alter_window('new18', 'in3', 'in4', $GetData::WINDOP_GE, 32e3);
+CheckOK2(217, 1);
+
+%h = $_->entry('new18');
+CheckOK2(217, 2);
+CheckNum2(217, 1, $h{"field_type"}, $GetData::WINDOW_ENTRY);
+CheckNum2(217, 2, $h{"fragment_index"}, 0);
+CheckNum2(217, 3, $h{"windop"}, $GetData::WINDOP_GE);
+CheckSArray2(217, 4, $h{"in_fields"}, 'in3', 'in4');
+CheckNum2(217, 5, $h{"threshold"}, 32e3);
+
+# 218: gd_alias_target check
+$s = $_->alias_target('alias');
+CheckOK(218);
+CheckString(218, $s, 'data');
+
+# 219: gd_add_alias check
+$s = $_->add_alias('new20', 'data', 0);
+CheckOK2(219, 1);
+
+$s = $_->alias_target('new20');
+CheckOK2(219, 2);
+CheckString(219, $s, 'data');
+
+# 220: gd_madd_alias check
+$s = $_->madd_alias('data', 'mnew20', 'data');
+CheckOK2(220, 1);
+
+$s = $_->alias_target('data/mnew20');
+CheckOK2(220, 2);
+CheckString(220, $s, 'data');
+
+# 221: gd_naliases check
+$s = $_->aliases('data');
+CheckOK(221);
+CheckNum(221, $s, 4);
+
+# 222: gd_aliases check
+ at a = $_->aliases('data');
+CheckOK(222);
+CheckSArray(222, \@a, "data", "alias", "data/mnew20", "new20");
+
+# 223: gd_include_affix check
+$s = $_->include('format1', 0, $GetData::CREAT | $GetData::EXCL, 'A', 'Z');
+CheckOK(223);
+
+# 224: GDMOVA check
+$s = $_->move_alias('new20', 1);
+CheckOK2(224, 1);
+
+$s = $_->fragment_index('Anew20Z');
+CheckOK2(224, 2);
+CheckNum(224, $s, 1);
+
+# 225: gd_delete_alias check
+$s = $_->delete_alias('Anew20Z', 0);
+CheckOK2(225, 1);
+
+$_->fragment_index('Anew20Z');
+CheckError2(225, 2, $GetData::E_BAD_CODE);
+
+# 226: gd_fragment_affixes check
+ at a = $_->fragment_affixes(1);
+CheckOK(226);
+CheckSArray(226, \@a, "A", "Z");
+
+# 227: gd_alter_affixes check
+$s = $_->alter_affixes(1, 'B', '');
+CheckOK2(227, 1);
+
+ at a = $_->fragment_affixes(1);
+CheckOK2(227, 2);
+CheckSArray(227, \@a, "B", "");
+
+# 228: gd_entry (MPLEX) check
+%h = $_->entry('mplex');
+CheckOK(228);
+CheckNum2(228, 1, $h{"field_type"}, $GetData::MPLEX_ENTRY);
+CheckNum2(228, 2, $h{"fragment_index"}, 0);
+CheckNum2(228, 3, $h{"count_val"}, 1);
+CheckSArray2(228, 4, $h{"in_fields"}, 'data', 'sbit');
+CheckNum2(228, 5, $h{"period"}, 10);
+
+# 229: gd_add_mplex check
+$s = $_->add_mplex('new21', 'in1', 'in2', 5, 6, 0);
+CheckOK2(229, 1);
+
+%h = $_->entry('new21');
+CheckOK2(229, 2);
+CheckNum2(229, 1, $h{"field_type"}, $GetData::MPLEX_ENTRY);
+CheckNum2(229, 2, $h{"fragment_index"}, 0);
+CheckNum2(229, 3, $h{"count_val"}, 5);
+CheckSArray2(229, 4, $h{"in_fields"}, 'in1', 'in2');
+CheckNum2(229, 5, $h{"period"}, 6);
+
+# 230: gd_madd_mplex check
+$s = $_->madd_mplex('data', 'mnew21', 'in2', 'in3', 0, 12);
+CheckOK2(230, 1);
+
+%h = $_->entry('data/mnew21');
+CheckOK2(230, 2);
+CheckNum2(230, 1, $h{"field_type"}, $GetData::MPLEX_ENTRY);
+CheckNum2(230, 2, $h{"fragment_index"}, 0);
+CheckNum2(230, 3, $h{"count_val"}, 0);
+CheckSArray2(230, 4, $h{"in_fields"}, 'in2', 'in3');
+CheckNum2(230, 5, $h{"period"}, 12);
+
+# 231: gd_alter_mplex check
+$s = $_->alter_mplex('new21', 'in3', 'in4', 7, -1);
+CheckOK2(231, 1);
+
+%h = $_->entry('new21');
+CheckOK2(231, 2);
+CheckNum2(231, 1, $h{"field_type"}, $GetData::MPLEX_ENTRY);
+CheckNum2(231, 2, $h{"fragment_index"}, 0);
+CheckNum2(231, 3, $h{"count_val"}, 7);
+CheckSArray2(231, 4, $h{"in_fields"}, 'in3', 'in4');
+CheckNum2(231, 5, $h{"period"}, 6);
+
+# 232: gd_strtok check
+ at a = $_->strtok('"test1 test2" test3\ test4 test5');
+CheckOK(232);
+CheckSArray(232, \@a, "test1 test2", "test3 test4", "test5");
+
+# 233: gd_raw_close check
+$s = $_->raw_close('data');
+CheckOK(233);
+
+# 234: gd_desync
+$s = $_->desync(0);
+CheckOK(234);
+CheckNum(234, $s, 0);
+
+# 235: gd_flags
+$s = $_->flags($GetData::PRETTY_PRINT, 0);
+CheckOK(235);
+CheckNum(235, $s, $GetData::PRETTY_PRINT);
+
+# 236: gd_verbose_prefix
+$s = $_->verbose_prefix("big_test: ");
+CheckOK(236);
+CheckNum(236, $s, 0);
+
+# 237: gd_nentries
+$s = $_->entry_list("data", $GetData::SCALAR_ENTRIES,
+  $GetData::ENTRIES_HIDDEN | $GetData::ENTRIES_NOALIAS);
+CheckOK2(237, 1);
+CheckNum2(237, 1, $s, 6);
+$s = $_->entry_list(undef, $GetData::VECTOR_ENTRIES,
+  $GetData::ENTRIES_HIDDEN | $GetData::ENTRIES_NOALIAS);
+CheckOK2(237, 2);
+CheckNum2(237, 2, $s, 24);
+
+# 239: gd_entry_list
+ at a = $_->entry_list(undef, $GetData::VECTOR_ENTRIES,
+  $GetData::ENTRIES_HIDDEN | $GetData::ENTRIES_NOALIAS);
+CheckOK(239);
+CheckSArray(239, \@a, qw(INDEX bit data div lincom linterp mplex mult new1 new13
+new14 new16 new18 new21 new3 new4 new6 new7 new8 phase polynom recip sbit
+window));
+
+# 240: gd_mplex_lookback
+$_->mplex_lookback($GetData::LOOKBACK_ALL);
+CheckOK(240);
+
+# 241: raw_filename
+$s = $_->linterp_tablename("linterp");
+CheckOK(241);
+CheckEOString(241, $s, "dirfile/lut");
+
+# 242: mcarrays
+ at a = $_->mcarrays("data", $GetData::FLOAT64);
+CheckOK2(242, 1);
+CheckNum2(242, 2, $#a, 1);
+CheckArray2(242, 3, $a[0], 1.9, 2.8, 3.7, 4.6, 5.5 );
+CheckArray2(242, 4, $a[1], 1.8, 18 );
+
+
+
+
+
+
+
+
+$d = $_ = undef;
+system "rm -rf dirfile";
diff --git a/bindings/perl/t/callback.t b/bindings/perl/t/callback.t
new file mode 100644
index 0000000..edb7192
--- /dev/null
+++ b/bindings/perl/t/callback.t
@@ -0,0 +1,37 @@
+use GetData;
+use strict;
+use Test::More tests => 8;
+
+# callback
+sub callback {
+  my ($pdata, $extra) = @_;
+
+  print "\n";
+  is ($extra, "extra stuff", "\$extra parameter good");
+  is ($$pdata{'suberror'}, $GetData::E_FORMAT_BAD_LINE, "suberror good");
+  is ($$pdata{'linenum'}, 2, "linenum good");
+  ok ($$pdata{'filename'} =~ m"dirfile/format$", "filename good");
+
+  $GetData::SYNTAX_IGNORE
+}
+
+# create the dirfile
+system "rm -rf dirfile" if (-e "dirfile" and not -d "dirfile");
+print "\n";
+ok(-e "dirfile" or mkdir "dirfile");
+
+open GLOB, ">dirfile/format" or die;
+print GLOB "data RAW UINT16 8\nbad line\n" or die;
+close GLOB or die;
+
+my $d = &GetData::open("dirfile", $GetData::RDONLY, \&callback, "extra stuff");
+print "\n";
+ok (defined $d, "open created an object");
+my $e = &GetData::error($d);
+print "\n";
+is ($e, $GetData::E_OK, "no error from open");
+my $close_ret = $d->close();
+print "\n";
+is ($close_ret, 0, "close succeeded");
+
+system "rm -rf dirfile";
diff --git a/bindings/perl/typemap b/bindings/perl/typemap
new file mode 100644
index 0000000..6dc84f7
--- /dev/null
+++ b/bindings/perl/typemap
@@ -0,0 +1,148 @@
+# Copyright (C) 2011-2013 D. V. Wiebe
+#
+##########################################################################
+#
+# This file is part of the GetData project.
+#
+# GetData is free software; you can redistribute it and/or modify it under
+# the terms of the GNU Lesser General Public License as published by the
+# Free Software Foundation; either version 2.1 of the License, or (at your
+# option) any later version.
+#
+# GetData is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+# License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public License
+# along with GetData; if not, write to the Free Software Foundation, Inc.,
+
+TYPEMAP
+# basic C types
+const char ** T_CONST_AVPV
+_Complex double T_COMPLEX
+off64_t T_IV
+unsigned long int T_UV
+
+# GetData types
+DIRFILE * T_DIRFILE
+gd_entry_t T_ENTRY
+gd_entype_t T_UV
+gd_shift_t T_IV
+gd_triplet_t T_TRIPLET
+gd_type_t T_IV
+gd_windop_t T_IV
+
+# GetData Perl pseudotypes
+gdp_complex_in T_COMPLEXIN
+gdpu_bitnum_t T_IV_FFFF
+gdpu_char * T_PV_NULL
+gdpu_int T_IV_ZERO
+gdpu_numbits_t T_IV_ZERO
+gdpu_shift_t T_IV_ZERO
+gdpu_uint_t T_UV_ZERO
+gdpu_type_t T_IV_ZERO
+gdpu_complex T_COMPLEX_ZERO
+
+
+INPUT
+T_DIRFILE
+  struct gdp_dirfile_t *gdp_dirfile;
+  if (sv_isa($arg, \"GetData::Dirfile\")) {
+    gdp_dirfile = INT2PTR(struct gdp_dirfile_t*, SvIV((SV*)SvRV($arg)));
+    $var = gdp_dirfile->D;
+    if ($var == NULL)
+      $var = gdp_invalid;
+  } else
+    croak(\"%s::${func_name}() - Invalid dirfile object\", gdp_package);
+T_COMPLEXIN
+  if ($arg == undef)
+    $var = NULL;
+  else if (SvROK($arg) && SvTYPE(SvRV($arg)) == SVt_PVAV) {
+    AV *av = (AV*)SvRV($arg);
+    I32 i, len = av_len(av);
+
+    $var = ($type)safemalloc(2 * sizeof(double) * (1 + len));
+    for (i = 0; i <= len; ++i) {
+      SV **sv = av_fetch(av, i, 0);
+      if (sv == NULL) {
+        safefree($var);
+        croak(\"%s::${func_name}() - Expected array of complex numbers\",
+            gdp_package);
+      }
+      gdp_convert_cmp(gd_cap_(${var}, i), *sv, NULL, gdp_package,
+          \"${func_name}\");
+    }
+  } else {
+    $var = NULL;
+    croak(\"%s::${func_name}() - Expected array of complex numbers\",
+      gdp_package);
+  }
+T_CONST_AVPV
+  if ($arg == undef)
+    $var = NULL;
+  else if (SvROK($arg) && SvTYPE(SvRV($arg)) == SVt_PVAV) {
+    AV *av = (AV*)SvRV($arg);
+    I32 i, len = av_len(av);
+
+    $var = ($type)safemalloc(sizeof(char*) * (1 + len));
+    for (i = 0; i <= len; ++i) {
+      SV **sv = av_fetch(av, i, 0);
+      if (sv == NULL || SvTYPE(*sv) != SVt_PV) {
+        safefree($var);
+        croak(\"%s::${func_name}() - Expected array of strings\", gdp_package);
+      }
+      ${var}[i] = SvPV_nolen(*av_fetch(av, i, 0));
+    }
+  } else
+    croak(\"%s::${func_name}() - Expected array of strings\", gdp_package);
+T_COMPLEX
+  { gdp_convert_cmp(gd_csp_($var), $arg, NULL, gdp_package, \"${func_name}\"); }
+T_ENTRY
+  gdp_to_entry(&$var, $arg, gdp_package, \"${func_name}\");
+T_IV_FFFF
+  if ($arg == undef)
+    $var = ($type)-1;
+  else
+    $var = ($type)SvIV($arg);
+T_IV_ZERO
+  if ($arg == undef)
+    $var = ($type)0;
+  else
+    $var = ($type)SvIV($arg);
+T_UV_ZERO
+  if ($arg == undef)
+    $var = ($type)0;
+  else
+    $var = ($type)SvUV($arg);
+T_PV_NULL
+  if ($arg == undef)
+    $var = NULL;
+  else
+    $var = SvPV_nolen($arg);
+T_COMPLEX_ZERO
+  if ($arg == undef)
+    gd_rs2cs_($var, 0);
+  else
+    gdp_convert_cmp(gd_csp_($var), $arg, NULL, gdp_package, \"${func_name}\");
+T_TRIPLET
+  { switch (windop) {
+    case GD_WINDOP_EQ:
+    case GD_WINDOP_NE:
+      $var.i = (int64_t)SvIV($arg);
+      break;
+    case GD_WINDOP_SET:
+    case GD_WINDOP_CLR:
+      $var.u = (uint64_t)SvUV($arg);
+      break;
+    default:
+      $var.r = SvNV($arg);
+      break;
+  }}
+
+ 
+
+OUTPUT
+T_DIRFILE
+  gdp_dirfile->D = $var;
+  sv_setref_uv($arg, \"${Package}::Dirfile\", PTR2UV(gdp_dirfile));
diff --git a/bindings/python/Makefile.am b/bindings/python/Makefile.am
index df987f7..c2ab221 100644
--- a/bindings/python/Makefile.am
+++ b/bindings/python/Makefile.am
@@ -31,6 +31,7 @@ endif
 SUBDIRS=test
 
 python_LTLIBRARIES = pygetdata.la
+LIBS=
 
 BUILT_SOURCES = pyconstants.c
 AM_CFLAGS = ${WALL} -fno-strict-aliasing
diff --git a/bindings/python/Makefile.in b/bindings/python/Makefile.in
index ee6ec6b..e85f9f7 100644
--- a/bindings/python/Makefile.in
+++ b/bindings/python/Makefile.in
@@ -1,9 +1,9 @@
-# Makefile.in generated by automake 1.11.1 from Makefile.am.
+# Makefile.in generated by automake 1.11.5 from Makefile.am.
 # @configure_input@
 
 # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005, 2006, 2007, 2008, 2009  Free Software Foundation,
-# Inc.
+# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software
+# Foundation, Inc.
 # This Makefile.in is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
@@ -16,6 +16,23 @@
 @SET_MAKE@
 
 VPATH = @srcdir@
+am__make_dryrun = \
+  { \
+    am__dry=no; \
+    case $$MAKEFLAGS in \
+      *\\[\ \	]*) \
+        echo 'am--echo: ; @echo "AM"  OK' | $(MAKE) -f - 2>/dev/null \
+          | grep '^AM OK$$' >/dev/null || am__dry=yes;; \
+      *) \
+        for am__flg in $$MAKEFLAGS; do \
+          case $$am__flg in \
+            *=*|--*) ;; \
+            *n*) am__dry=yes; break;; \
+          esac; \
+        done;; \
+    esac; \
+    test $$am__dry = yes; \
+  }
 pkgdatadir = $(datadir)/@PACKAGE@
 pkgincludedir = $(includedir)/@PACKAGE@
 pkglibdir = $(libdir)/@PACKAGE@
@@ -39,15 +56,17 @@ DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
 am__aclocal_m4_deps = $(top_srcdir)/m4/ax_compare_version.m4 \
 	$(top_srcdir)/m4/compiler.m4 $(top_srcdir)/m4/encoding.m4 \
-	$(top_srcdir)/m4/idl.m4 $(top_srcdir)/m4/libtool.m4 \
-	$(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \
-	$(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \
-	$(top_srcdir)/m4/python.m4 $(top_srcdir)/m4/win32.m4 \
-	$(top_srcdir)/m4/version.m4 $(top_srcdir)/configure.ac
+	$(top_srcdir)/m4/floatordering.m4 $(top_srcdir)/m4/idl.m4 \
+	$(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \
+	$(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \
+	$(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/m4/matlab.m4 \
+	$(top_srcdir)/m4/perl.m4 $(top_srcdir)/m4/python.m4 \
+	$(top_srcdir)/m4/win32.m4 $(top_srcdir)/m4/version.m4 \
+	$(top_srcdir)/configure.ac
 am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
 	$(ACLOCAL_M4)
 mkinstalldirs = $(install_sh) -d
-CONFIG_HEADER = $(top_builddir)/src/config.h \
+CONFIG_HEADER = $(top_builddir)/src/gd_config.h \
 	$(top_builddir)/src/getdata.h
 CONFIG_CLEAN_FILES =
 CONFIG_CLEAN_VPATH_FILES =
@@ -72,6 +91,12 @@ am__nobase_list = $(am__nobase_strip_setup); \
 am__base_list = \
   sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \
   sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
+am__uninstall_files_from_dir = { \
+  test -z "$$files" \
+    || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \
+    || { echo " ( cd '$$dir' && rm -f" $$files ")"; \
+         $(am__cd) "$$dir" && rm -f $$files; }; \
+  }
 am__installdirs = "$(DESTDIR)$(pythondir)"
 LTLIBRARIES = $(python_LTLIBRARIES)
 am__DEPENDENCIES_1 =
@@ -110,6 +135,11 @@ RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \
 	install-pdf-recursive install-ps-recursive install-recursive \
 	installcheck-recursive installdirs-recursive pdf-recursive \
 	ps-recursive uninstall-recursive
+am__can_run_installinfo = \
+  case $$AM_UPDATE_INFO_DIR in \
+    n|no|NO) false;; \
+    *) (install-info --version) >/dev/null 2>&1;; \
+  esac
 RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive	\
   distclean-recursive maintainer-clean-recursive
 AM_RECURSIVE_TARGETS = $(RECURSIVE_TARGETS:-recursive=) \
@@ -152,10 +182,13 @@ AUTOHEADER = @AUTOHEADER@
 AUTOMAKE = @AUTOMAKE@
 AWK = @AWK@
 BUILDCC = @BUILDCC@
-BUILD_DATE = @BUILD_DATE@
 BZIP2_CPPFLAGS = @BZIP2_CPPFLAGS@
 BZIP2_LDFLAGS = @BZIP2_LDFLAGS@
+BZIP2_LIBS = @BZIP2_LIBS@
 CC = @CC@
+CCAS = @CCAS@
+CCASDEPMODE = @CCASDEPMODE@
+CCASFLAGS = @CCASFLAGS@
 CCDEPMODE = @CCDEPMODE@
 CFLAGS = @CFLAGS@
 CPP = @CPP@
@@ -171,6 +204,7 @@ DEFINE_GD_NO_C99_API = @DEFINE_GD_NO_C99_API@
 DEFINE_gd_int16_t = @DEFINE_gd_int16_t@
 DEFINE_gd_int64_t = @DEFINE_gd_int64_t@
 DEFINE_gd_uint16_t = @DEFINE_gd_uint16_t@
+DEFINE_gd_uint64_t = @DEFINE_gd_uint64_t@
 DEFS = @DEFS@
 DEPDIR = @DEPDIR@
 DIFF = @DIFF@
@@ -191,13 +225,21 @@ FFLAGS = @FFLAGS@
 FGETDATA_VERSION = @FGETDATA_VERSION@
 FGREP = @FGREP@
 FLIBS = @FLIBS@
+GD_DIRSEP = @GD_DIRSEP@
+GD_FDIRSEP = @GD_FDIRSEP@
 GETDATAXX_VERSION = @GETDATAXX_VERSION@
+GETDATA_DEBUG = @GETDATA_DEBUG@
 GETDATA_IFACE_AGE = @GETDATA_IFACE_AGE@
 GETDATA_IFACE_VERSION = @GETDATA_IFACE_VERSION@
 GETDATA_IMPL_REVISION = @GETDATA_IMPL_REVISION@
+GETDATA_MAJOR = @GETDATA_MAJOR@
+GETDATA_MINOR = @GETDATA_MINOR@
+GETDATA_REVISION = @GETDATA_REVISION@
+GETDATA_VERSION_SUFFIX = @GETDATA_VERSION_SUFFIX@
 GREP = @GREP@
 GZIP_CPPFLAGS = @GZIP_CPPFLAGS@
 GZIP_LDFLAGS = @GZIP_LDFLAGS@
+GZIP_LIBS = @GZIP_LIBS@
 IDL = @IDL@
 IDL_CFLAGS = @IDL_CFLAGS@
 IDL_LIBS = @IDL_LIBS@
@@ -211,7 +253,7 @@ LD = @LD@
 LDFLAGS = @LDFLAGS@
 LIBLTDL = @LIBLTDL@
 LIBOBJS = @LIBOBJS@
-LIBS = @LIBS@
+LIBS = 
 LIBTOOL = @LIBTOOL@
 LIBTOOL_DEPS = @LIBTOOL_DEPS@
 LIPO = @LIPO@
@@ -220,8 +262,13 @@ LTDLINCL = @LTDLINCL@
 LTLIBOBJS = @LTLIBOBJS@
 LZMA_CPPFLAGS = @LZMA_CPPFLAGS@
 LZMA_LDFLAGS = @LZMA_LDFLAGS@
+LZMA_LIBS = @LZMA_LIBS@
 MAKEINFO = @MAKEINFO@
 MANIFEST_TOOL = @MANIFEST_TOOL@
+MATLAB = @MATLAB@
+MATLABGETDATA_VERSION = @MATLABGETDATA_VERSION@
+MATLAB_CPPFLAGS = @MATLAB_CPPFLAGS@
+MEX = @MEX@
 MKDIR_P = @MKDIR_P@
 NM = @NM@
 NMEDIT = @NMEDIT@
@@ -238,6 +285,9 @@ PACKAGE_TARNAME = @PACKAGE_TARNAME@
 PACKAGE_URL = @PACKAGE_URL@
 PACKAGE_VERSION = @PACKAGE_VERSION@
 PATH_SEPARATOR = @PATH_SEPARATOR@
+PERL = @PERL@
+PERL_MAN3EXT = @PERL_MAN3EXT@
+PRINTF = @PRINTF@
 PRIVATE_LIBS = @PRIVATE_LIBS@
 PYTHON = @PYTHON@
 PYTHON_CPPFLAGS = @PYTHON_CPPFLAGS@
@@ -249,8 +299,12 @@ SET_MAKE = @SET_MAKE@
 SHELL = @SHELL@
 SLIM_CPPFLAGS = @SLIM_CPPFLAGS@
 SLIM_LDFLAGS = @SLIM_LDFLAGS@
+SLIM_LIBS = @SLIM_LIBS@
 STRIP = @STRIP@
 VERSION = @VERSION@
+ZZIP_CPPFLAGS = @ZZIP_CPPFLAGS@
+ZZIP_LDFLAGS = @ZZIP_LDFLAGS@
+ZZIP_LIBS = @ZZIP_LIBS@
 abs_builddir = @abs_builddir@
 abs_srcdir = @abs_srcdir@
 abs_top_builddir = @abs_top_builddir@
@@ -294,6 +348,8 @@ libexecdir = @libexecdir@
 localedir = @localedir@
 localstatedir = @localstatedir@
 mandir = @mandir@
+matlabbasedir = @matlabbasedir@
+mexext = @mexext@
 mkdir_p = @mkdir_p@
 moduledir = @moduledir@
 oldincludedir = @oldincludedir@
@@ -303,8 +359,12 @@ path_gunzip = @path_gunzip@
 path_gzip = @path_gzip@
 path_slim = @path_slim@
 path_unslim = @path_unslim@
+path_unzip = @path_unzip@
 path_xz = @path_xz@
+path_zip = @path_zip@
 pdfdir = @pdfdir@
+perldir = @perldir@
+perlmandir = @perlmandir@
 prefix = @prefix@
 program_transform_name = @program_transform_name@
 psdir = @psdir@
@@ -391,7 +451,6 @@ $(ACLOCAL_M4):  $(am__aclocal_m4_deps)
 $(am__aclocal_m4_deps):
 install-pythonLTLIBRARIES: $(python_LTLIBRARIES)
 	@$(NORMAL_INSTALL)
-	test -z "$(pythondir)" || $(MKDIR_P) "$(DESTDIR)$(pythondir)"
 	@list='$(python_LTLIBRARIES)'; test -n "$(pythondir)" || list=; \
 	list2=; for p in $$list; do \
 	  if test -f $$p; then \
@@ -399,6 +458,8 @@ install-pythonLTLIBRARIES: $(python_LTLIBRARIES)
 	  else :; fi; \
 	done; \
 	test -z "$$list2" || { \
+	  echo " $(MKDIR_P) '$(DESTDIR)$(pythondir)'"; \
+	  $(MKDIR_P) "$(DESTDIR)$(pythondir)" || exit 1; \
 	  echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(pythondir)'"; \
 	  $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(pythondir)"; \
 	}
@@ -420,7 +481,7 @@ clean-pythonLTLIBRARIES:
 	  echo "rm -f \"$${dir}/so_locations\""; \
 	  rm -f "$${dir}/so_locations"; \
 	done
-pygetdata.la: $(pygetdata_la_OBJECTS) $(pygetdata_la_DEPENDENCIES) 
+pygetdata.la: $(pygetdata_la_OBJECTS) $(pygetdata_la_DEPENDENCIES) $(EXTRA_pygetdata_la_DEPENDENCIES) 
 	$(pygetdata_la_LINK) -rpath $(pythondir) $(pygetdata_la_OBJECTS) $(pygetdata_la_LIBADD) $(LIBS)
 
 mostlyclean-compile:
@@ -637,13 +698,10 @@ distdir: $(DISTFILES)
 	done
 	@list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
 	  if test "$$subdir" = .; then :; else \
-	    test -d "$(distdir)/$$subdir" \
-	    || $(MKDIR_P) "$(distdir)/$$subdir" \
-	    || exit 1; \
-	  fi; \
-	done
-	@list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
-	  if test "$$subdir" = .; then :; else \
+	    $(am__make_dryrun) \
+	      || test -d "$(distdir)/$$subdir" \
+	      || $(MKDIR_P) "$(distdir)/$$subdir" \
+	      || exit 1; \
 	    dir1=$$subdir; dir2="$(distdir)/$$subdir"; \
 	    $(am__relativize); \
 	    new_distdir=$$reldir; \
@@ -683,10 +741,15 @@ install-am: all-am
 
 installcheck: installcheck-recursive
 install-strip:
-	$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
-	  install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
-	  `test -z '$(STRIP)' || \
-	    echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+	if test -z '$(STRIP)'; then \
+	  $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+	    install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+	      install; \
+	else \
+	  $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+	    install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+	    "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
+	fi
 mostlyclean-generic:
 
 clean-generic:
diff --git a/bindings/python/pydirfile.c b/bindings/python/pydirfile.c
index 0f8a952..a47f406 100644
--- a/bindings/python/pydirfile.c
+++ b/bindings/python/pydirfile.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2009, 2010 D. V. Wiebe
+/* Copyright (C) 2009-2013 D. V. Wiebe
  *
  ***************************************************************************
  *
@@ -22,21 +22,26 @@
 #include "pygetdata.h"
 
 /* Dirfile */
-static int gdpy_callback_func(gd_parser_data_t* pdata, void* extra)
+static int gdpy_callback_func(gd_parser_data_t *pdata, void *extra)
 {
-  dtrace("%p, %p", pdata, extra);
-
   int r = GD_SYNTAX_ABORT;
-  struct gdpy_dirfile_t* self = extra;
+  struct gdpy_dirfile_t *self = extra;
+
+  dtrace("%p, %p", pdata, extra);
 
   if (self->callback != NULL) {
-    char buffer[GD_MAX_LINE_LENGTH];
-    gd_error_string(pdata->dirfile, buffer, GD_MAX_LINE_LENGTH);
+    char *new_string;
+    PyObject *result, *arglist;
+    char *estring;
 
-    PyObject* arglist = Py_BuildValue("({sssisssiss}O)", "error_string", buffer,
+    estring = gd_error_string(pdata->dirfile, NULL, 0);
+
+    arglist = Py_BuildValue("({sssisssiss}O)", "error_string", estring,
         "suberror", pdata->suberror, "line", pdata->line, "linenum",
         pdata->linenum, "filename", pdata->filename, self->callback_data);
 
+    free(estring);
+
     /* an exception results in an abort */
     if (arglist == NULL) {
       self->callback_exception = 1;
@@ -44,7 +49,7 @@ static int gdpy_callback_func(gd_parser_data_t* pdata, void* extra)
       return GD_SYNTAX_ABORT;
     }
 
-    PyObject* result = PyEval_CallObject(self->callback, arglist);
+    result = PyEval_CallObject(self->callback, arglist);
     Py_DECREF(arglist);
 
     /* result may be:
@@ -78,30 +83,28 @@ static int gdpy_callback_func(gd_parser_data_t* pdata, void* extra)
             r = GD_SYNTAX_ABORT;
           }
 
-          char* new_string = PyString_AsString(PyTuple_GetItem(result, 1));
+          new_string = PyString_AsString(PyTuple_GetItem(result, 1));
 
           if (new_string == NULL) {
             self->callback_exception = 1;
             r = GD_SYNTAX_ABORT;
           }
-          
-          strncpy(pdata->line, new_string, GD_MAX_LINE_LENGTH - 1);
-          pdata->line[GD_MAX_LINE_LENGTH - 1] = '\0';
+
+          pdata->line = new_string;
       }
 
       if (PyTuple_Size(result) == 1) {
       }
     } else if (PyString_Check(result)) {
-      char* new_string = PyString_AsString(result);
+      new_string = PyString_AsString(result);
 
       if (new_string == NULL) {
         self->callback_exception = 1;
         r = GD_SYNTAX_ABORT;
       }
-          
+
       r = GD_SYNTAX_RESCAN;
-      strncpy(pdata->line, new_string, GD_MAX_LINE_LENGTH - 1);
-      pdata->line[GD_MAX_LINE_LENGTH - 1] = '\0';
+      pdata->line = new_string;
     } else if (PyInt_Check(result))
       r = (int)PyInt_AsLong(result);
     else {
@@ -115,24 +118,29 @@ static int gdpy_callback_func(gd_parser_data_t* pdata, void* extra)
   return r;
 }
 
-static void gdpy_dirfile_delete(struct gdpy_dirfile_t* self)
+static void gdpy_dirfile_delete(struct gdpy_dirfile_t *self)
 {
   dtrace("%p", self);
 
   gd_close(self->D);
+  free(self->verbose_prefix);
 
   dreturnvoid();
 }
 
-static PyObject* gdpy_dirfile_create(PyTypeObject *type, PyObject *args,
+static PyObject *gdpy_dirfile_create(PyTypeObject *type, PyObject *args,
     PyObject *keys)
 {
+  struct gdpy_dirfile_t *self;
+
   dtrace("%p, %p, %p", type, args, keys);
 
-  struct gdpy_dirfile_t *self = (struct gdpy_dirfile_t*)type->tp_alloc(type, 0);
+  self = (struct gdpy_dirfile_t*)type->tp_alloc(type, 0);
 
   if (self) {
     self->D = NULL;
+    self->mplex_lookback = GD_DEFAULT_LOOKBACK;
+    self->verbose_prefix = NULL;
     self->callback = NULL;
     self->callback_data = NULL;
   }
@@ -141,17 +149,17 @@ static PyObject* gdpy_dirfile_create(PyTypeObject *type, PyObject *args,
   return (PyObject*)self;
 }
 
-static int gdpy_dirfile_init(struct gdpy_dirfile_t* self, PyObject *args,
+static int gdpy_dirfile_init(struct gdpy_dirfile_t *self, PyObject *args,
     PyObject *keys)
 {
-  dtrace("%p, %p, %p", self, args, keys);
-
-  PyObject* pycallback = NULL;
-  PyObject* pycallback_data = Py_None;
+  PyObject *pycallback = NULL;
+  PyObject *pycallback_data = Py_None;
   char *keywords[] = {"name", "flags", "callback", "extra", NULL};
-  PyObject* name = NULL;
+  PyObject *name = NULL;
   unsigned long flags = GD_RDONLY;
 
+  dtrace("%p, %p, %p", self, args, keys);
+
   if (!PyArg_ParseTupleAndKeywords(args, keys,
         "|OkOO:pygetdata.dirfile.__init__", keywords, &name, &flags,
         &pycallback, &pycallback_data))
@@ -204,13 +212,13 @@ static int gdpy_dirfile_init(struct gdpy_dirfile_t* self, PyObject *args,
   return 0;
 }
 
-static PyObject* gdpy_dirfile_add(struct gdpy_dirfile_t* self,
-    PyObject* args, PyObject* keys)
+static PyObject *gdpy_dirfile_add(struct gdpy_dirfile_t *self,
+    PyObject *args, PyObject *keys)
 {
-  dtrace("%p, %p, %p", self, args, keys);
+  char *keywords[] = { "entry", NULL };
+  struct gdpy_entry_t *entry = NULL;
 
-  char* keywords[] = { "entry", NULL };
-  struct gdpy_entry_t* entry = NULL;
+  dtrace("%p, %p, %p", self, args, keys);
 
   if (!PyArg_ParseTupleAndKeywords(args, keys, "O!:pygetdata.dirfile.add",
         keywords, &gdpy_entry, &entry))
@@ -228,15 +236,15 @@ static PyObject* gdpy_dirfile_add(struct gdpy_dirfile_t* self,
   return Py_None;
 }
 
-static PyObject* gdpy_dirfile_addspec(struct gdpy_dirfile_t* self,
-    PyObject* args, PyObject* keys)
+static PyObject *gdpy_dirfile_addspec(struct gdpy_dirfile_t *self,
+    PyObject *args, PyObject *keys)
 {
-  dtrace("%p, %p, %p", self, args, keys);
-
-  char* keywords[] = { "spec", "fragment_index", NULL };
-  const char* spec;
+  char *keywords[] = { "spec", "fragment_index", NULL };
+  const char *spec;
   int fragment = 0;
 
+  dtrace("%p, %p, %p", self, args, keys);
+
   if (!PyArg_ParseTupleAndKeywords(args, keys, "s|i:pygetdata.dirfile.add_spec",
         keywords, &spec, &fragment))
   {
@@ -253,16 +261,16 @@ static PyObject* gdpy_dirfile_addspec(struct gdpy_dirfile_t* self,
   return Py_None;
 }
 
-static PyObject* gdpy_dirfile_alter(struct gdpy_dirfile_t* self,
-    PyObject* args, PyObject* keys)
+static PyObject *gdpy_dirfile_alter(struct gdpy_dirfile_t *self,
+    PyObject *args, PyObject *keys)
 {
-  dtrace("%p, %p, %p", self, args, keys);
-
-  char* keywords[] = { "field_code", "entry", "recode", NULL };
-  struct gdpy_entry_t* entry = NULL;
+  char *keywords[] = { "field_code", "entry", "recode", NULL };
+  struct gdpy_entry_t *entry = NULL;
   int recode = 0;
   char *field_code;
 
+  dtrace("%p, %p, %p", self, args, keys);
+
   if (!PyArg_ParseTupleAndKeywords(args, keys, "sO!|i:pygetdata.dirfile.alter",
         keywords, &field_code, &gdpy_entry, &entry, &recode))
   {
@@ -279,15 +287,15 @@ static PyObject* gdpy_dirfile_alter(struct gdpy_dirfile_t* self,
   return Py_None;
 }
 
-static PyObject* gdpy_dirfile_alterspec(struct gdpy_dirfile_t* self,
-    PyObject* args, PyObject* keys)
+static PyObject *gdpy_dirfile_alterspec(struct gdpy_dirfile_t *self,
+    PyObject *args, PyObject *keys)
 {
-  dtrace("%p, %p, %p", self, args, keys);
-
-  char* keywords[] = { "spec", "recode", NULL };
-  const char* spec;
+  char *keywords[] = { "spec", "recode", NULL };
+  const char *spec;
   int recode = 0;
 
+  dtrace("%p, %p, %p", self, args, keys);
+
   if (!PyArg_ParseTupleAndKeywords(args, keys,
         "s|i:pygetdata.dirfile.alter_spec", keywords, &spec, &recode))
   {
@@ -304,7 +312,7 @@ static PyObject* gdpy_dirfile_alterspec(struct gdpy_dirfile_t* self,
   return Py_None;
 }
 
-static PyObject* gdpy_dirfile_close(struct gdpy_dirfile_t* self)
+static PyObject *gdpy_dirfile_close(struct gdpy_dirfile_t *self)
 {
   dtrace("%p", self);
 
@@ -318,15 +326,15 @@ static PyObject* gdpy_dirfile_close(struct gdpy_dirfile_t* self)
   return Py_None;
 }
 
-static PyObject* gdpy_dirfile_delentry(struct gdpy_dirfile_t* self,
-    void* args, void* keys)
+static PyObject *gdpy_dirfile_delentry(struct gdpy_dirfile_t *self,
+    void *args, void *keys)
 {
-  dtrace("%p, %p, %p", self, args, keys);
-
-  char* keywords[] = {"field_code", "flags", NULL};
-  const char* field_code;
+  char *keywords[] = {"field_code", "flags", NULL};
+  const char *field_code;
   int flags = 0;
 
+  dtrace("%p, %p, %p", self, args, keys);
+
   if (!PyArg_ParseTupleAndKeywords(args, keys,
         "s|i:pygetdata.dirfile.delete", keywords, &field_code, &flags))
   {
@@ -343,7 +351,7 @@ static PyObject* gdpy_dirfile_delentry(struct gdpy_dirfile_t* self,
   return Py_None;
 }
 
-static PyObject* gdpy_dirfile_discard(struct gdpy_dirfile_t* self)
+static PyObject *gdpy_dirfile_discard(struct gdpy_dirfile_t *self)
 {
   dtrace("%p", self);
 
@@ -359,22 +367,22 @@ static PyObject* gdpy_dirfile_discard(struct gdpy_dirfile_t* self)
   return Py_None;
 }
 
-static PyObject* gdpy_dirfile_getcarray(struct gdpy_dirfile_t* self,
-    void* args, void* keys)
+static PyObject *gdpy_dirfile_getcarray(struct gdpy_dirfile_t *self,
+    void *args, void *keys)
 {
-  dtrace("%p, %p, %p", self, args, keys);
-
-  char* keywords[] = {"field_code", "return_type", "start", "len", "as_list",
+  char *keywords[] = {"field_code", "return_type", "start", "len", "as_list",
     NULL};
-  const char* field_code;
+  const char *field_code;
   unsigned int start = 0, len = 0;
   int as_list = 0;
   gd_type_t return_type;
-  PyObject* pylist = NULL;
+  PyObject *pyobj = NULL;
 #ifdef USE_NUMPY
   npy_intp dims[] = { 0 };
 #endif
 
+  dtrace("%p, %p, %p", self, args, keys);
+
   if (!PyArg_ParseTupleAndKeywords(args, keys,
         "si|IIi:pygetdata.dirfile.get_carray", keywords, &field_code,
         &return_type, &start, &len, &as_list))
@@ -394,17 +402,17 @@ static PyObject* gdpy_dirfile_getcarray(struct gdpy_dirfile_t* self,
   if (len == 0) {
 #ifdef USE_NUMPY
     if (!as_list)
-      pylist = PyArray_ZEROS(1, dims, NPY_INT, 0);
+      pyobj = PyArray_ZEROS(1, dims, NPY_INT, 0);
     else
 #endif
-      pylist = Py_BuildValue("[]");
+      pyobj = Py_BuildValue("[]");
   } else {
-    void* data;
+    void *data;
 #ifdef USE_NUMPY
     if (!as_list) {
       dims[0] = (npy_intp)len;
-      pylist = PyArray_SimpleNew(1, dims, gdpy_npytype_from_type(return_type));
-      data = PyArray_DATA(pylist);
+      pyobj = PyArray_SimpleNew(1, dims, gdpy_npytype_from_type(return_type));
+      data = PyArray_DATA(pyobj);
     } else
 #endif
       data = malloc(len * GD_SIZE(return_type));
@@ -419,24 +427,26 @@ static PyObject* gdpy_dirfile_getcarray(struct gdpy_dirfile_t* self,
 #endif
     {
       PYGD_CHECK_ERROR2(self->D, NULL, free(data));
-      pylist = gdpy_convert_to_pylist(data, return_type, len);
+      pyobj = gdpy_convert_to_pylist(data, return_type, len);
 
       free(data);
     }
   }
 
-  dreturn("%p", pylist);
-  return pylist;
+  dreturn("%p", pyobj);
+  return pyobj;
 }
 
-static PyObject* gdpy_dirfile_getconstant(struct gdpy_dirfile_t* self,
-    void* args, void* keys)
+static PyObject *gdpy_dirfile_getconstant(struct gdpy_dirfile_t *self,
+    void *args, void *keys)
 {
-  dtrace("%p, %p, %p", self, args, keys);
-
-  char* keywords[] = {"field_code", "return_type", NULL};
-  const char* field_code;
+  char *keywords[] = {"field_code", "return_type", NULL};
+  const char *field_code;
   gd_type_t return_type;
+  char data[16];
+  PyObject *pyobj;
+
+  dtrace("%p, %p, %p", self, args, keys);
 
   if (!PyArg_ParseTupleAndKeywords(args, keys,
         "si:pygetdata.dirfile.get_constant", keywords, &field_code,
@@ -446,25 +456,25 @@ static PyObject* gdpy_dirfile_getconstant(struct gdpy_dirfile_t* self,
     return NULL;
   }
 
-  char data[16];
-
   gd_get_constant(self->D, field_code, return_type, data);
 
   PYGD_CHECK_ERROR(self->D, NULL);
 
-  PyObject* pyobj = gdpy_convert_to_pyobj(data, return_type);
+  pyobj = gdpy_convert_to_pyobj(data, return_type);
 
   dreturn("%p", pyobj);
   return pyobj;
 }
 
-static PyObject* gdpy_dirfile_carraylen(struct gdpy_dirfile_t* self,
-    PyObject* args, PyObject* keys)
+static PyObject *gdpy_dirfile_carraylen(struct gdpy_dirfile_t *self,
+    PyObject *args, PyObject *keys)
 {
-  dtrace("%p, %p, %p", self, args, keys);
+  char *keywords[] = { "field_code", NULL };
+  const char *field_code;
+  size_t len;
+  PyObject *pyobj;
 
-  char* keywords[] = { "field_code", NULL };
-  const char* field_code;
+  dtrace("%p, %p, %p", self, args, keys);
 
   if (!PyArg_ParseTupleAndKeywords(args, keys, "s:pygetdata.dirfile.carray_len",
         keywords, &field_code)) {
@@ -472,28 +482,30 @@ static PyObject* gdpy_dirfile_carraylen(struct gdpy_dirfile_t* self,
     return NULL;
   }
 
-  size_t len = gd_carray_len(self->D, field_code);
+  len = gd_carray_len(self->D, field_code);
 
   PYGD_CHECK_ERROR(self->D, NULL);
 
-  PyObject* pyobj = PyInt_FromLong((long)len);
+  pyobj = PyInt_FromLong((long)len);
   dreturn("%p", pyobj);
   return pyobj;
 }
 
-static PyObject* gdpy_dirfile_carrays(struct gdpy_dirfile_t* self,
-    void* args, void* keys)
+static PyObject *gdpy_dirfile_carrays(struct gdpy_dirfile_t *self,
+    void *args, void *keys)
 {
-  dtrace("%p, %p, %p", self, args, keys);
-
-  char* keywords[] = {"return_type", "as_list", NULL};
+  char *keywords[] = {"return_type", "as_list", NULL};
   const char **fields;
   int as_list = 0, i;
   gd_type_t return_type;
+  const gd_carray_t *carrays;
+  PyObject *pyobj;
 #ifdef USE_NUMPY
   npy_intp dims[] = { 0 };
 #endif
 
+  dtrace("%p, %p, %p", self, args, keys);
+
   if (!PyArg_ParseTupleAndKeywords(args, keys, "i|i:pygetdata.dirfile.carrays",
         keywords, &return_type, &as_list))
   {
@@ -505,9 +517,9 @@ static PyObject* gdpy_dirfile_carrays(struct gdpy_dirfile_t* self,
 
   PYGD_CHECK_ERROR(self->D, NULL);
 
-  const gd_carray_t *carrays = gd_carrays(self->D, return_type);
+  carrays = gd_carrays(self->D, return_type);
 
-  PyObject *pylist = PyList_New(0);
+  pyobj = PyList_New(0);
 
   for (i = 0; carrays[i].n != 0; ++i) {
     PyObject *pydata;
@@ -521,23 +533,24 @@ static PyObject* gdpy_dirfile_carrays(struct gdpy_dirfile_t* self,
 #endif
       pydata = gdpy_convert_to_pylist(carrays[i].d, return_type, carrays[i].n);
 
-    PyList_Append(pylist, Py_BuildValue("sN", fields[i], pydata));
+    PyList_Append(pyobj, Py_BuildValue("sN", fields[i], pydata));
   }
 
-  dreturn("%p", pylist);
-  return pylist;
+  dreturn("%p", pyobj);
+  return pyobj;
 }
 
-static PyObject* gdpy_dirfile_getconstants(struct gdpy_dirfile_t* self,
-    void* args, void* keys)
+static PyObject *gdpy_dirfile_getconstants(struct gdpy_dirfile_t *self,
+    void *args, void *keys)
 {
-  dtrace("%p, %p, %p", self, args, keys);
-
   int i;
-  char* keywords[] = {"return_type", NULL};
-  const char** fields;
-  const char* values;
+  char *keywords[] = {"return_type", NULL};
+  const char **fields;
+  const char *values;
   gd_type_t return_type;
+  PyObject *pyobj;
+
+  dtrace("%p, %p, %p", self, args, keys);
 
   if (!PyArg_ParseTupleAndKeywords(args, keys,
         "i:pygetdata.dirfile.constants", keywords, &return_type))
@@ -554,51 +567,57 @@ static PyObject* gdpy_dirfile_getconstants(struct gdpy_dirfile_t* self,
 
   PYGD_CHECK_ERROR(self->D, NULL);
 
-  PyObject* list = PyList_New(0);
+  pyobj = PyList_New(0);
 
   for (i = 0; fields[i] != NULL; ++i)
-    PyList_Append(list, Py_BuildValue("sN", fields[i],
+    PyList_Append(pyobj, Py_BuildValue("sN", fields[i],
           gdpy_convert_to_pyobj(values + i * GD_SIZE(return_type),
             return_type)));
 
-  dreturn("%p", list);
-  return list;
+  dreturn("%p", pyobj);
+  return pyobj;
 }
 
-static PyObject* gdpy_dirfile_getdata(struct gdpy_dirfile_t* self,
-    PyObject* args, PyObject* keys)
+static PyObject *gdpy_dirfile_getdata(struct gdpy_dirfile_t *self,
+    PyObject *args, PyObject *keys)
 {
-  dtrace("%p, %p, %p", self, args, keys);
-
-  char* keywords[] = { "field_code", "return_type", "first_frame",
+  char *keywords[] = { "field_code", "return_type", "first_frame",
     "first_sample", "num_frames", "num_samples", "as_list", NULL };
-  const char* field_code;
+  const char *field_code;
   PY_LONG_LONG first_frame = 0, first_sample = 0;
   PyObject *num_frames_obj = NULL, *num_samples_obj = NULL;
+  PyObject *return_type_obj = NULL;
   long int num_frames = 0, num_samples = 0;
-  int as_list = 0;
+  size_t ns;
+  int as_list = 0, read_to_end = 0;
   gd_type_t return_type;
-  gd_spf_t spf = 1;
-  PyObject* pylist = NULL;
+  unsigned int spf = 1;
+  PyObject *pyobj = NULL;
 #ifdef USE_NUMPY
   npy_intp dims[] = { 0 };
 #endif
 
+  dtrace("%p, %p, %p", self, args, keys);
+
   if (!PyArg_ParseTupleAndKeywords(args, keys,
-        "si|LLOOi:pygetdata.dirfile.getdata", keywords, &field_code,
-        &return_type, &first_frame, &first_sample, &num_frames_obj,
+        "s|OLLOOi:pygetdata.dirfile.getdata", keywords, &field_code,
+        &return_type_obj, &first_frame, &first_sample, &num_frames_obj,
         &num_samples_obj, &as_list))
   {
     dreturn("%p", NULL);
     return NULL;
   }
 
-  /* sanity check */
-  if (num_frames_obj == NULL && num_samples_obj == NULL) {
-      PyErr_SetString(PyExc_ValueError, "pygetdata.dirfile.gd_getdata(): at "
-          "least one of num_frames and num_samples must be specified");
+  /* get return type */
+  if (return_type_obj) {
+    return_type = (gd_type_t)PyInt_AsLong(return_type_obj);
+    if (PyErr_Occurred()) {
       dreturn("%p", NULL);
       return NULL;
+    }
+  } else {
+    return_type = gd_native_type(self->D, field_code);
+    PYGD_CHECK_ERROR(self->D, NULL);
   }
 
   if (num_frames_obj) {
@@ -627,61 +646,90 @@ static PyObject* gdpy_dirfile_getdata(struct gdpy_dirfile_t* self,
     }
   }
 
+  /* read to end mode */
+  if (num_frames_obj == NULL && num_samples_obj == NULL)
+    read_to_end = 1;
+
   /* we need the SPF to know how many samples we have to allocate */
-  if (num_frames) {
+  if (read_to_end || num_frames) {
     spf = gd_spf(self->D, field_code);
 
     PYGD_CHECK_ERROR(self->D, NULL);
-  }
 
-  size_t ns = num_samples + num_frames * spf;
+    if (read_to_end) {
+      num_samples = gd_nframes(self->D) * spf;
+      PYGD_CHECK_ERROR(self->D, NULL);
+
+      /* don't read past the frame indicated by nframes */
+      num_samples -= first_frame * spf - first_sample;
+      if (num_samples < 0)
+        num_samples = 0;
+    } else
+      num_samples += num_frames * spf;
+  }
 
-  if (ns == 0) {
+  if (num_samples == 0) {
 #ifdef USE_NUMPY
     if (!as_list)
-      pylist = PyArray_ZEROS(1, dims, NPY_INT, 0);
+      pyobj = PyArray_ZEROS(1, dims, gdpy_npytype_from_type(return_type), 0);
     else
 #endif
-      pylist = Py_BuildValue("[]");
+      pyobj = Py_BuildValue("[]");
   } else {
-    void* data;
+    void *data;
 #ifdef USE_NUMPY
     if (!as_list) {
-      dims[0] = (npy_intp)ns;
-      pylist = PyArray_SimpleNew(1, dims, gdpy_npytype_from_type(return_type));
-      data = PyArray_DATA(pylist);
+      dims[0] = (npy_intp)num_samples;
+      pyobj = PyArray_SimpleNew(1, dims, gdpy_npytype_from_type(return_type));
+      data = PyArray_DATA(pyobj);
     } else
 #endif
-      data = malloc(ns * GD_SIZE(return_type));
-
-    ns = gd_getdata(self->D, field_code, first_frame, first_sample,
-        (size_t)num_frames, (size_t)num_samples, return_type, data);
+      data = malloc(num_samples * GD_SIZE(return_type));
 
+    ns = gd_getdata(self->D, field_code, first_frame, first_sample, 0, (size_t)num_samples,
+        return_type, data);
 
 #ifdef USE_NUMPY
-    if (!as_list)
+    if (!as_list) {
       PYGD_CHECK_ERROR(self->D, NULL);
-    else
+      /* resize, if necessary */
+      if (ns < num_samples) {
+        PyObject *check;
+        PyArray_Dims new_dims;
+
+        new_dims.ptr = dims;
+        new_dims.len = 1;
+        dims[0] = (npy_intp)ns;
+        check = PyArray_Resize((PyArrayObject*)pyobj, &new_dims, 0, NPY_ANYORDER);
+
+        if (check == NULL) /* error -- exception already raised */
+          return NULL;
+        Py_DECREF(check); /* Despite the docs, PyArray_Resize returns an INCREF'd Py_None on
+                             success */
+      }
+    } else
 #endif
     {
       PYGD_CHECK_ERROR2(self->D, NULL, free(data));
-      pylist = gdpy_convert_to_pylist(data, return_type, ns);
+      pyobj = gdpy_convert_to_pylist(data, return_type, ns);
 
       free(data);
     }
   }
 
-  dreturn("%p", pylist);
-  return pylist;
+  dreturn("%p", pyobj);
+  return pyobj;
 }
 
-static PyObject* gdpy_dirfile_getentry(struct gdpy_dirfile_t* self,
-    void* args, void* keys)
+static PyObject *gdpy_dirfile_getentry(struct gdpy_dirfile_t *self,
+    void *args, void *keys)
 {
-  dtrace("%p, %p, %p", self, args, keys);
+  char *keywords[] = {"field_code", NULL};
+  const char *field_code;
+  struct gdpy_entry_t *obj;
+  gd_entry_t *E;
 
-  char* keywords[] = {"field_code", NULL};
-  const char* field_code;
+  dtrace("%p, %p, %p", self, args, keys);
 
   if (!PyArg_ParseTupleAndKeywords(args, keys, "s:pygetdata.dirfile.entry",
         keywords, &field_code))
@@ -690,7 +738,7 @@ static PyObject* gdpy_dirfile_getentry(struct gdpy_dirfile_t* self,
     return NULL;
   }
 
-  gd_entry_t* E = malloc(sizeof(gd_entry_t));
+  E = malloc(sizeof(gd_entry_t));
 
   if (E == NULL) {
     PyErr_NoMemory();
@@ -702,8 +750,7 @@ static PyObject* gdpy_dirfile_getentry(struct gdpy_dirfile_t* self,
 
   PYGD_CHECK_ERROR(self->D, NULL);
 
-  struct gdpy_entry_t *obj =
-    (struct gdpy_entry_t*)gdpy_entry.tp_alloc(&gdpy_entry, 0);
+  obj = (struct gdpy_entry_t*)gdpy_entry.tp_alloc(&gdpy_entry, 0);
 
   if (obj == NULL) {
     PyErr_NoMemory();
@@ -717,24 +764,40 @@ static PyObject* gdpy_dirfile_getentry(struct gdpy_dirfile_t* self,
   return (PyObject*)obj;
 }
 
-static PyObject* gdpy_dirfile_geterror(struct gdpy_dirfile_t* self,
-    void* closure)
+static PyObject *gdpy_dirfile_geterror(struct gdpy_dirfile_t *self,
+    void *closure)
 {
+  PyObject *error;
+
   dtrace("%p, %p", self, closure);
 
-  PyObject* error = PyInt_FromLong(gd_error(self->D));
+  error = PyInt_FromLong(gd_error(self->D));
 
   dreturn("%p", error);
   return error;
 }
 
-static PyObject* gdpy_dirfile_getfragment(struct gdpy_dirfile_t* self,
-    void* args, void* keys)
+static PyObject *gdpy_dirfile_geterrorcount(struct gdpy_dirfile_t *self,
+    void *closure)
 {
-  dtrace("%p, %p, %p", self, args, keys);
+  PyObject *count;
+
+  dtrace("%p, %p", self, closure);
 
-  char* keywords[] = {"fragment_index", NULL};
+  count = PyInt_FromLong(gd_error_count(self->D));
+
+  dreturn("%p", count);
+  return count;
+}
+
+static PyObject *gdpy_dirfile_getfragment(struct gdpy_dirfile_t *self,
+    void *args, void *keys)
+{
+  char *keywords[] = {"fragment_index", NULL};
   int fragment_index;
+  struct gdpy_fragment_t *obj;
+
+  dtrace("%p, %p, %p", self, args, keys);
 
   if (!PyArg_ParseTupleAndKeywords(args, keys, "i:pygetdata.dirfile.fragment",
         keywords, &fragment_index))
@@ -743,8 +806,7 @@ static PyObject* gdpy_dirfile_getfragment(struct gdpy_dirfile_t* self,
     return NULL;
   }
 
-  struct gdpy_fragment_t *obj =
-    (struct gdpy_fragment_t*)gdpy_fragment.tp_alloc(&gdpy_fragment, 0);
+  obj = (struct gdpy_fragment_t*)gdpy_fragment.tp_alloc(&gdpy_fragment, 0);
 
   if (obj == NULL) {
     PyErr_NoMemory();
@@ -760,13 +822,15 @@ static PyObject* gdpy_dirfile_getfragment(struct gdpy_dirfile_t* self,
   return (PyObject*)obj;
 }
 
-static PyObject* gdpy_dirfile_getfragmentindex(struct gdpy_dirfile_t* self,
-    void* args, void* keys)
+static PyObject *gdpy_dirfile_getfragmentindex(struct gdpy_dirfile_t *self,
+    void *args, void *keys)
 {
-  dtrace("%p, %p, %p", self, args, keys);
+  char *keywords[] = {"field_code", NULL};
+  const char *field_code;
+  PyObject *pyobj;
+  int index;
 
-  char* keywords[] = {"field_code", NULL};
-  const char* field_code;
+  dtrace("%p, %p, %p", self, args, keys);
 
   if (!PyArg_ParseTupleAndKeywords(args, keys,
         "s:pygetdata.dirfile.fragment_index", keywords, &field_code))
@@ -775,57 +839,62 @@ static PyObject* gdpy_dirfile_getfragmentindex(struct gdpy_dirfile_t* self,
     return NULL;
   }
 
-  int index = gd_fragment_index(self->D, field_code);
+  index = gd_fragment_index(self->D, field_code);
 
   PYGD_CHECK_ERROR(self->D, NULL);
 
-  PyObject* pyobj = PyInt_FromLong(index);
+  pyobj = PyInt_FromLong(index);
 
   dreturn("%p", pyobj);
   return pyobj;
 }
 
-static PyObject* gdpy_dirfile_geterrorstring(struct gdpy_dirfile_t* self,
-    void* closure)
+static PyObject *gdpy_dirfile_geterrorstring(struct gdpy_dirfile_t *self,
+    void *closure)
 {
-  dtrace("%p, %p", self, closure);
+  char *estring;
+  PyObject *pyobj;
 
-  char buffer[GD_MAX_LINE_LENGTH];
+  dtrace("%p, %p", self, closure);
 
-  PyObject* error = PyString_FromString(gd_error_string(self->D, buffer,
-        GD_MAX_LINE_LENGTH));
+  estring = gd_error_string(self->D, NULL, 0);
+  pyobj = PyString_FromString(estring);
+  free(estring);
 
-  dreturn("%p", error);
-  return error;
+  dreturn("%p", pyobj);
+  return pyobj;
 }
 
-static PyObject* gdpy_dirfile_getvectorlist(struct gdpy_dirfile_t* self)
+static PyObject *gdpy_dirfile_getvectorlist(struct gdpy_dirfile_t *self)
 {
-  dtrace("%p", self);
-
+  const char **vectors;
   int i;
+  PyObject *pyobj;
 
-  const char **vectors = gd_vector_list(self->D);
+  dtrace("%p", self);
+
+  vectors = gd_vector_list(self->D);
 
   PYGD_CHECK_ERROR(self->D, NULL);
 
-  PyObject* pylist = PyList_New(0);
+  pyobj = PyList_New(0);
 
   for (i = 0; vectors[i] != NULL; ++i)
-    PyList_Append(pylist, PyString_FromString(vectors[i]));
+    PyList_Append(pyobj, PyString_FromString(vectors[i]));
 
-  dreturn("%p", pylist);
-  return pylist;
+  dreturn("%p", pyobj);
+  return pyobj;
 }
 
-static PyObject* gdpy_dirfile_getfieldlist(struct gdpy_dirfile_t* self,
-    void* args, void* keys)
+static PyObject *gdpy_dirfile_getfieldlist(struct gdpy_dirfile_t *self,
+    void *args, void *keys)
 {
-  dtrace("%p, %p, %p", self, args, keys);
-
   const char **fields;
-  char* keywords[] = { "type", NULL };
+  char *keywords[] = { "type", NULL };
   int i, type = (int)GD_NO_ENTRY;
+  PyObject *pyobj;
+
+  dtrace("%p, %p, %p", self, args, keys);
 
   if (!PyArg_ParseTupleAndKeywords(args, keys,
         "|i:pygetdata.dirfile.field_list", keywords, &type))
@@ -841,22 +910,22 @@ static PyObject* gdpy_dirfile_getfieldlist(struct gdpy_dirfile_t* self,
 
   PYGD_CHECK_ERROR(self->D, NULL);
 
-  PyObject* pylist = PyList_New(0);
+  pyobj = PyList_New(0);
 
   for (i = 0; fields[i] != NULL; ++i)
-    PyList_Append(pylist, PyString_FromString(fields[i]));
+    PyList_Append(pyobj, PyString_FromString(fields[i]));
 
-  dreturn("%p", pylist);
-  return pylist;
+  dreturn("%p", pyobj);
+  return pyobj;
 }
 
-static PyObject* gdpy_dirfile_flush(struct gdpy_dirfile_t* self,
-    PyObject* args, PyObject* keys)
+static PyObject *gdpy_dirfile_flush(struct gdpy_dirfile_t *self,
+    PyObject *args, PyObject *keys)
 {
-  dtrace("%p, %p, %p", self, args, keys);
+  char *keywords[] = { "field_code", NULL };
+  const char *field_code = NULL;
 
-  char* keywords[] = { "field_code", NULL };
-  const char* field_code = NULL;
+  dtrace("%p, %p, %p", self, args, keys);
 
   if (!PyArg_ParseTupleAndKeywords(args, keys, "|s:pygetdata.dirfile.flush",
         keywords, &field_code))
@@ -874,18 +943,71 @@ static PyObject* gdpy_dirfile_flush(struct gdpy_dirfile_t* self,
   return Py_None;
 }
 
-static PyObject* gdpy_dirfile_include(struct gdpy_dirfile_t* self,
-    PyObject* args, PyObject* keys)
+static PyObject *gdpy_dirfile_sync(struct gdpy_dirfile_t *self,
+    PyObject *args, PyObject *keys)
+{
+  char *keywords[] = { "field_code", NULL };
+  const char *field_code = NULL;
+
+  dtrace("%p, %p, %p", self, args, keys);
+
+  if (!PyArg_ParseTupleAndKeywords(args, keys, "|s:pygetdata.dirfile.sync",
+        keywords, &field_code))
+  {
+    dreturn("%p", NULL);
+    return NULL;
+  }
+
+  gd_sync(self->D, field_code);
+
+  PYGD_CHECK_ERROR(self->D, NULL);
+
+  Py_INCREF(Py_None);
+  dreturn("%p", Py_None);
+  return Py_None;
+}
+
+static PyObject *gdpy_dirfile_raw_close(struct gdpy_dirfile_t *self,
+    PyObject *args, PyObject *keys)
 {
+  char *keywords[] = { "field_code", NULL };
+  const char *field_code = NULL;
+
   dtrace("%p, %p, %p", self, args, keys);
 
-  char* keywords[] = { "file", "fragment_index", "flags", NULL };
-  const char* file = NULL;
+  if (!PyArg_ParseTupleAndKeywords(args, keys, "|s:pygetdata.dirfile.raw_close",
+        keywords, &field_code))
+  {
+    dreturn("%p", NULL);
+    return NULL;
+  }
+
+  gd_raw_close(self->D, field_code);
+
+  PYGD_CHECK_ERROR(self->D, NULL);
+
+  Py_INCREF(Py_None);
+  dreturn("%p", Py_None);
+  return Py_None;
+}
+
+static PyObject *gdpy_dirfile_include(struct gdpy_dirfile_t *self,
+    PyObject *args, PyObject *keys)
+{
+  char *keywords[] = { "file", "fragment_index", "flags", "prefix", "suffix",
+    NULL };
+  const char *file = NULL;
   int fragment_index = 0;
   unsigned int flags = 0;
+  char *prefix = NULL, *suffix = NULL;
+  long index;
+  PyObject *pyobj;
+
+  dtrace("%p, %p, %p", self, args, keys);
 
-  if (!PyArg_ParseTupleAndKeywords(args, keys, "s|ii:pygetdata.dirfile.include",
-        keywords, &file, &fragment_index, &flags))
+  if (!PyArg_ParseTupleAndKeywords(args, keys,
+        "s|iiss:pygetdata.dirfile.include", keywords, &file, &fragment_index,
+        &flags, &prefix, &suffix))
   {
     dreturn("%p", NULL);
     return NULL;
@@ -893,7 +1015,8 @@ static PyObject* gdpy_dirfile_include(struct gdpy_dirfile_t* self,
 
   self->callback_exception = 0;
 
-  long index = gd_include(self->D, file, fragment_index, flags);
+  index = gd_include_affix(self->D, file, fragment_index, prefix, suffix,
+      flags);
 
   if (self->callback_exception) {
     dreturn("%p", NULL);
@@ -902,20 +1025,20 @@ static PyObject* gdpy_dirfile_include(struct gdpy_dirfile_t* self,
 
   PYGD_CHECK_ERROR(self->D, NULL);
 
-  PyObject* obj = PyInt_FromLong(index);
+  pyobj = PyInt_FromLong(index);
 
-  dreturn("%p", obj);
-  return obj;
+  dreturn("%p", pyobj);
+  return pyobj;
 }
 
-static PyObject* gdpy_dirfile_madd(struct gdpy_dirfile_t* self,
-    PyObject* args, PyObject* keys)
+static PyObject *gdpy_dirfile_madd(struct gdpy_dirfile_t *self,
+    PyObject *args, PyObject *keys)
 {
-  dtrace("%p, %p, %p", self, args, keys);
+  char *keywords[] = { "entry", "parent", NULL };
+  struct gdpy_entry_t *entry = NULL;
+  const char *parent;
 
-  char* keywords[] = { "entry", "parent", NULL };
-  struct gdpy_entry_t* entry = NULL;
-  const char* parent;
+  dtrace("%p, %p, %p", self, args, keys);
 
   if (!PyArg_ParseTupleAndKeywords(args, keys, "O!s:pygetdata.dirfile.madd",
         keywords, &gdpy_entry, &entry, &parent))
@@ -933,14 +1056,14 @@ static PyObject* gdpy_dirfile_madd(struct gdpy_dirfile_t* self,
   return Py_None;
 }
 
-static PyObject* gdpy_dirfile_maddspec(struct gdpy_dirfile_t* self,
-    PyObject* args, PyObject* keys)
+static PyObject *gdpy_dirfile_maddspec(struct gdpy_dirfile_t *self,
+    PyObject *args, PyObject *keys)
 {
-  dtrace("%p, %p, %p", self, args, keys);
+  char *keywords[] = { "spec", "parent", NULL };
+  const char *spec;
+  const char *parent;
 
-  char* keywords[] = { "spec", "parent", NULL };
-  const char* spec;
-  const char* parent;
+  dtrace("%p, %p, %p", self, args, keys);
 
   if (!PyArg_ParseTupleAndKeywords(args, keys, "ss:pygetdata.dirfile.madd_spec",
         keywords, &spec, &parent))
@@ -958,15 +1081,15 @@ static PyObject* gdpy_dirfile_maddspec(struct gdpy_dirfile_t* self,
   return Py_None;
 }
 
-static PyObject* gdpy_dirfile_malterspec(struct gdpy_dirfile_t* self,
-    PyObject* args, PyObject* keys)
+static PyObject *gdpy_dirfile_malterspec(struct gdpy_dirfile_t *self,
+    PyObject *args, PyObject *keys)
 {
-  dtrace("%p, %p, %p", self, args, keys);
-
-  char* keywords[] = { "spec", "parent", "recode", NULL };
+  char *keywords[] = { "spec", "parent", "recode", NULL };
   const char *spec, *parent;
   int recode = 0;
 
+  dtrace("%p, %p, %p", self, args, keys);
+
   if (!PyArg_ParseTupleAndKeywords(args, keys,
         "ss|i:pygetdata.dirfile.malter_spec", keywords, &spec, &parent,
         &recode))
@@ -984,20 +1107,22 @@ static PyObject* gdpy_dirfile_malterspec(struct gdpy_dirfile_t* self,
   return Py_None;
 }
 
-static PyObject* gdpy_dirfile_mcarrays(struct gdpy_dirfile_t* self,
-    void* args, void* keys)
+static PyObject *gdpy_dirfile_mcarrays(struct gdpy_dirfile_t *self,
+    void *args, void *keys)
 {
-  dtrace("%p, %p, %p", self, args, keys);
-
-  char* keywords[] = {"parent", "return_type", "as_list", NULL};
+  char *keywords[] = {"parent", "return_type", "as_list", NULL};
   const char **fields;
   const char *parent;
   int as_list = 0, i;
   gd_type_t return_type;
+  const gd_carray_t *carrays;
+  PyObject *pyobj;
 #ifdef USE_NUMPY
   npy_intp dims[] = { 0 };
 #endif
 
+  dtrace("%p, %p, %p", self, args, keys);
+
   if (!PyArg_ParseTupleAndKeywords(args, keys,
         "si|i:pygetdata.dirfile.mcarrays", keywords, &parent, &return_type,
         &as_list))
@@ -1010,9 +1135,9 @@ static PyObject* gdpy_dirfile_mcarrays(struct gdpy_dirfile_t* self,
 
   PYGD_CHECK_ERROR(self->D, NULL);
 
-  const gd_carray_t *carrays = gd_mcarrays(self->D, parent, return_type);
+  carrays = gd_mcarrays(self->D, parent, return_type);
 
-  PyObject *pylist = PyList_New(0);
+  pyobj = PyList_New(0);
 
   for (i = 0; carrays[i].n != 0; ++i) {
     PyObject *pydata;
@@ -1026,24 +1151,25 @@ static PyObject* gdpy_dirfile_mcarrays(struct gdpy_dirfile_t* self,
 #endif
       pydata = gdpy_convert_to_pylist(carrays[i].d, return_type, carrays[i].n);
 
-    PyList_Append(pylist, Py_BuildValue("sN", fields[i], pydata));
+    PyList_Append(pyobj, Py_BuildValue("sN", fields[i], pydata));
   }
 
-  dreturn("%p", pylist);
-  return pylist;
+  dreturn("%p", pyobj);
+  return pyobj;
 }
 
-static PyObject* gdpy_dirfile_getmconstants(struct gdpy_dirfile_t* self,
-    void* args, void* keys)
+static PyObject *gdpy_dirfile_getmconstants(struct gdpy_dirfile_t *self,
+    void *args, void *keys)
 {
-  dtrace("%p, %p, %p", self, args, keys);
-
   int i;
-  char* keywords[] = {"parent", "return_type", NULL};
-  const char** fields;
-  const char* values;
-  const char* parent = NULL;
+  char *keywords[] = {"parent", "return_type", NULL};
+  const char **fields;
+  const char *values;
+  const char *parent = NULL;
   gd_type_t return_type;
+  PyObject *pyobj;
+
+  dtrace("%p, %p, %p", self, args, keys);
 
   if (!PyArg_ParseTupleAndKeywords(args, keys,
         "si:pygetdata.dirfile.mconstants", keywords, &parent, &return_type))
@@ -1060,18 +1186,18 @@ static PyObject* gdpy_dirfile_getmconstants(struct gdpy_dirfile_t* self,
 
   PYGD_CHECK_ERROR(self->D, NULL);
 
-  PyObject* list = PyList_New(0);
+  pyobj = PyList_New(0);
 
   for (i = 0; fields[i] != NULL; ++i)
-    PyList_Append(list, Py_BuildValue("sN", fields[i],
+    PyList_Append(pyobj, Py_BuildValue("sN", fields[i],
           gdpy_convert_to_pyobj(values + i * GD_SIZE(return_type),
             return_type)));
 
-  dreturn("%p", list);
-  return list;
+  dreturn("%p", pyobj);
+  return pyobj;
 }
 
-static PyObject* gdpy_dirfile_metaflush(struct gdpy_dirfile_t* self)
+static PyObject *gdpy_dirfile_metaflush(struct gdpy_dirfile_t *self)
 {
   dtrace("%p", self);
 
@@ -1084,16 +1210,17 @@ static PyObject* gdpy_dirfile_metaflush(struct gdpy_dirfile_t* self)
   return Py_None;
 }
 
-static PyObject* gdpy_dirfile_getmfieldlist(struct gdpy_dirfile_t* self,
-    void* args, void* keys)
+static PyObject *gdpy_dirfile_getmfieldlist(struct gdpy_dirfile_t *self,
+    void *args, void *keys)
 {
-  dtrace("%p, %p, %p", self, args, keys);
-
-  const char** fields;
-  char* keywords[] = { "parent", "type", NULL };
-  const char* parent = NULL;
+  const char **fields;
+  char *keywords[] = { "parent", "type", NULL };
+  const char *parent = NULL;
   gd_entype_t type = GD_NO_ENTRY;
   int i;
+  PyObject *pyobj;
+
+  dtrace("%p, %p, %p", self, args, keys);
 
   if (!PyArg_ParseTupleAndKeywords(args, keys,
         "s|i:pygetdata.dirfile.field_list_by_type", keywords, &parent, &type))
@@ -1109,43 +1236,47 @@ static PyObject* gdpy_dirfile_getmfieldlist(struct gdpy_dirfile_t* self,
 
   PYGD_CHECK_ERROR(self->D, NULL);
 
-  PyObject* pylist = PyList_New(0);
+  pyobj = PyList_New(0);
 
   for (i = 0; fields[i] != NULL; ++i)
-    PyList_Append(pylist, PyString_FromString(fields[i]));
+    PyList_Append(pyobj, PyString_FromString(fields[i]));
 
-  dreturn("%p", pylist);
-  return pylist;
+  dreturn("%p", pyobj);
+  return pyobj;
 }
 
-static PyObject* gdpy_dirfile_getname(struct gdpy_dirfile_t* self,
-    void* closure)
+static PyObject *gdpy_dirfile_getname(struct gdpy_dirfile_t *self,
+    void *closure)
 {
+  const char *name;
+  PyObject *pyobj;
+
   dtrace("%p, %p", self, closure);
 
-  const char* name = gd_dirfilename(self->D);
+  name = gd_dirfilename(self->D);
 
   PYGD_CHECK_ERROR(self->D, NULL);
 
-  PyObject* pyname = PyString_FromString(name);
+  pyobj = PyString_FromString(name);
 
-  dreturn("%p", pyname);
-  return pyname;
+  dreturn("%p", pyobj);
+  return pyobj;
 }
 
-static PyObject* gdpy_dirfile_getmstrings(struct gdpy_dirfile_t* self,
-    void* args, void* keys)
+static PyObject *gdpy_dirfile_getmstrings(struct gdpy_dirfile_t *self,
+    void *args, void *keys)
 {
-  dtrace("%p, %p, %p", self, args, keys);
-
   int i;
-  char* keywords[] = {"parent", NULL};
-  const char** fields;
-  const char** values;
-  const char* parent = NULL;
+  char *keywords[] = {"parent", NULL};
+  const char **fields;
+  const char **values;
+  const char *parent = NULL;
+  PyObject *pyobj;
 
-  if (!PyArg_ParseTupleAndKeywords(args, keys,
-        "s:pygetdata.dirfile.mconstants", keywords, &parent))
+  dtrace("%p, %p, %p", self, args, keys);
+
+  if (!PyArg_ParseTupleAndKeywords(args, keys, "s:pygetdata.dirfile.mstrings",
+        keywords, &parent))
   {
     dreturn("%p", NULL);
     return NULL;
@@ -1159,24 +1290,26 @@ static PyObject* gdpy_dirfile_getmstrings(struct gdpy_dirfile_t* self,
 
   PYGD_CHECK_ERROR(self->D, NULL);
 
-  PyObject* list = PyList_New(0);
+  pyobj = PyList_New(0);
 
   for (i = 0; fields[i] != NULL; ++i)
-    PyList_Append(list, Py_BuildValue("ss", fields[i], values[i]));
+    PyList_Append(pyobj, Py_BuildValue("ss", fields[i], values[i]));
 
-  dreturn("%p", list);
-  return list;
+  dreturn("%p", pyobj);
+  return pyobj;
 }
 
-static PyObject* gdpy_dirfile_getmvectorlist(struct gdpy_dirfile_t* self,
-    void* args, void* keys)
+static PyObject *gdpy_dirfile_getmvectorlist(struct gdpy_dirfile_t *self,
+    void *args, void *keys)
 {
-  dtrace("%p, %p, %p", self, args, keys);
-
   int i;
+  char *keywords[] = {"parent", NULL};
+  const char *parent = NULL;
+  const char **fields;
+  PyObject *pyobj;
+
+  dtrace("%p, %p, %p", self, args, keys);
 
-  char* keywords[] = {"parent", NULL};
-  const char* parent = NULL;
   if (!PyArg_ParseTupleAndKeywords(args, keys,
         "s:pygetdata.dirfile.mvector_list", keywords, &parent))
   {
@@ -1184,27 +1317,28 @@ static PyObject* gdpy_dirfile_getmvectorlist(struct gdpy_dirfile_t* self,
     return NULL;
   }
 
-  const char **fields = gd_mvector_list(self->D, parent);
+  fields = gd_mvector_list(self->D, parent);
 
   PYGD_CHECK_ERROR(self->D, NULL);
 
-  PyObject* pylist = PyList_New(0);
+  pyobj = PyList_New(0);
 
   for (i = 0; fields[i] != NULL; ++i)
-    PyList_Append(pylist, PyString_FromString(fields[i]));
+    PyList_Append(pyobj, PyString_FromString(fields[i]));
 
-  dreturn("%p", pylist);
-  return pylist;
+  dreturn("%p", pyobj);
+  return pyobj;
 }
 
-static PyObject* gdpy_dirfile_getrawfilename(struct gdpy_dirfile_t* self,
-    PyObject* args, PyObject* keys)
+static PyObject *gdpy_dirfile_getrawfilename(struct gdpy_dirfile_t *self,
+    PyObject *args, PyObject *keys)
 {
-  dtrace("%p, %p, %p", self, args, keys);
+  char *keywords[] = { "field_code", NULL };
+  const char *field_code;
+  const char *filename;
+  PyObject *pyobj;
 
-  char* keywords[] = { "field_code", NULL };
-  const char* field_code;
-  const char* filename;
+  dtrace("%p, %p, %p", self, args, keys);
 
   if (!PyArg_ParseTupleAndKeywords(args, keys,
         "s:pygetdata.dirfile.raw_filename", keywords, &field_code))
@@ -1217,18 +1351,20 @@ static PyObject* gdpy_dirfile_getrawfilename(struct gdpy_dirfile_t* self,
 
   PYGD_CHECK_ERROR(self->D, NULL);
 
-  PyObject* pyobj = PyString_FromString(filename);
+  pyobj = PyString_FromString(filename);
   dreturn("%p", pyobj);
   return pyobj;
 }
 
-static PyObject* gdpy_dirfile_getnativetype(struct gdpy_dirfile_t* self,
-    PyObject* args, PyObject* keys)
+static PyObject *gdpy_dirfile_getnativetype(struct gdpy_dirfile_t *self,
+    PyObject *args, PyObject *keys)
 {
-  dtrace("%p, %p, %p", self, args, keys);
+  char *keywords[] = { "field_code", NULL };
+  const char *field_code;
+  PyObject *pyobj;
+  gd_type_t ntype;
 
-  char* keywords[] = { "field_code", NULL };
-  const char* field_code;
+  dtrace("%p, %p, %p", self, args, keys);
 
   if (!PyArg_ParseTupleAndKeywords(args, keys,
         "s:pygetdata.dirfile.native_type", keywords, &field_code))
@@ -1237,23 +1373,26 @@ static PyObject* gdpy_dirfile_getnativetype(struct gdpy_dirfile_t* self,
     return NULL;
   }
 
-  gd_type_t ntype = gd_native_type(self->D, field_code);
+  ntype = gd_native_type(self->D, field_code);
 
   PYGD_CHECK_ERROR(self->D, NULL);
 
-  PyObject* pyobj = PyInt_FromLong((long)ntype);
+  pyobj = PyInt_FromLong((long)ntype);
+
   dreturn("%p", pyobj);
   return pyobj;
 }
 
-static PyObject* gdpy_dirfile_getnativetypename(struct gdpy_dirfile_t* self,
-    PyObject* args, PyObject* keys)
+static PyObject *gdpy_dirfile_getnativetypename(struct gdpy_dirfile_t *self,
+    PyObject *args, PyObject *keys)
 {
-  dtrace("%p, %p, %p", self, args, keys);
-
-  char* keywords[] = { "field_code", NULL };
-  const char* field_code;
+  char *keywords[] = { "field_code", NULL };
+  const char *field_code;
   char tbuffer[11];
+  PyObject *pyobj;
+  gd_type_t t;
+
+  dtrace("%p, %p, %p", self, args, keys);
 
   if (!PyArg_ParseTupleAndKeywords(args, keys,
         "s:pygetdata.dirfile.native_type_name", keywords, &field_code))
@@ -1262,7 +1401,7 @@ static PyObject* gdpy_dirfile_getnativetypename(struct gdpy_dirfile_t* self,
     return NULL;
   }
 
-  gd_type_t t = gd_native_type(self->D, field_code);
+  t = gd_native_type(self->D, field_code);
 
   PYGD_CHECK_ERROR(self->D, NULL);
 
@@ -1270,19 +1409,21 @@ static PyObject* gdpy_dirfile_getnativetypename(struct gdpy_dirfile_t* self,
         (t & GD_IEEE754) ? "FLOAT" : (t & GD_SIGNED) ?  "INT" : "UINT"),
       (int)(8 * GD_SIZE(t)));
 
-  PyObject* pyobj = PyString_FromString(tbuffer);
+  pyobj = PyString_FromString(tbuffer);
+
   dreturn("%p", pyobj);
   return pyobj;
 }
 
-static PyObject* gdpy_dirfile_getnfields(struct gdpy_dirfile_t* self,
-    PyObject* args, PyObject* keys)
+static PyObject *gdpy_dirfile_getnfields(struct gdpy_dirfile_t *self,
+    PyObject *args, PyObject *keys)
 {
-  dtrace("%p, %p, %p", self, args, keys);
-
   unsigned int nfields;
-  char* keywords[] = { "type", NULL };
+  char *keywords[] = { "type", NULL };
   int type = GD_NO_ENTRY;
+  PyObject *pyobj;
+
+  dtrace("%p, %p, %p", self, args, keys);
 
   if (!PyArg_ParseTupleAndKeywords(args, keys, "|i:pygetdata.dirfile.nfields",
         keywords, &type))
@@ -1298,51 +1439,58 @@ static PyObject* gdpy_dirfile_getnfields(struct gdpy_dirfile_t* self,
 
   PYGD_CHECK_ERROR(self->D, NULL);
 
-  PyObject* pynfields = PyInt_FromLong((long)nfields);
+  pyobj = PyInt_FromLong((long)nfields);
 
-  dreturn("%p", pynfields);
-  return pynfields;
+  dreturn("%p", pyobj);
+  return pyobj;
 }
 
-static PyObject* gdpy_dirfile_getnfragments(struct gdpy_dirfile_t* self,
-    void* closure)
+static PyObject *gdpy_dirfile_getnfragments(struct gdpy_dirfile_t *self,
+    void *closure)
 {
+  long nfragments;
+  PyObject *pyobj;
+
   dtrace("%p, %p", self, closure);
 
-  long nfragments = gd_nfragments(self->D);
+  nfragments = gd_nfragments(self->D);
 
   PYGD_CHECK_ERROR(self->D, NULL);
 
-  PyObject* pynfragments = PyInt_FromLong(nfragments);
+  pyobj = PyInt_FromLong(nfragments);
 
-  dreturn("%p", pynfragments);
-  return pynfragments;
+  dreturn("%p", pyobj);
+  return pyobj;
 }
 
-static PyObject* gdpy_dirfile_getnframes(struct gdpy_dirfile_t* self,
-    void* closure)
+static PyObject *gdpy_dirfile_getnframes(struct gdpy_dirfile_t *self,
+    void *closure)
 {
+  off_t nframes;
+  PyObject *pyobj;
+
   dtrace("%p, %p", self, closure);
 
-  off_t nframes = gd_nframes(self->D);
+  nframes = gd_nframes(self->D);
 
   PYGD_CHECK_ERROR(self->D, NULL);
 
-  PyObject* pynframes = PyLong_FromLongLong(nframes);
+  pyobj = PyLong_FromLongLong(nframes);
 
-  dreturn("%p", pynframes);
-  return pynframes;
+  dreturn("%p", pyobj);
+  return pyobj;
 }
 
-static PyObject* gdpy_dirfile_getnmfields(struct gdpy_dirfile_t* self,
-    PyObject* args, PyObject* keys)
+static PyObject *gdpy_dirfile_getnmfields(struct gdpy_dirfile_t *self,
+    PyObject *args, PyObject *keys)
 {
-  dtrace("%p, %p, %p", self, args, keys);
-
-  char* keywords[] = { "parent", "type", NULL };
-  const char* parent = NULL;
+  char *keywords[] = { "parent", "type", NULL };
+  const char *parent = NULL;
   int type = GD_NO_ENTRY;
   unsigned int nmfields;
+  PyObject *pyobj;
+
+  dtrace("%p, %p, %p", self, args, keys);
 
   if (!PyArg_ParseTupleAndKeywords(args, keys, "s|i:pygetdata.dirfile.nmfields",
         keywords, &parent, &type))
@@ -1358,19 +1506,21 @@ static PyObject* gdpy_dirfile_getnmfields(struct gdpy_dirfile_t* self,
 
   PYGD_CHECK_ERROR(self->D, NULL);
 
-  PyObject* pyobj = PyInt_FromLong((long)nmfields);
+  pyobj = PyInt_FromLong((long)nmfields);
 
   dreturn("%p", pyobj);
   return pyobj;
 }
 
-static PyObject* gdpy_dirfile_getnmvectors(struct gdpy_dirfile_t* self,
-    PyObject* args, PyObject* keys)
+static PyObject *gdpy_dirfile_getnmvectors(struct gdpy_dirfile_t *self,
+    PyObject *args, PyObject *keys)
 {
-  dtrace("%p, %p, %p", self, args, keys);
+  char *keywords[] = { "parent", NULL };
+  const char *parent = NULL;
+  PyObject *pyobj;
+  unsigned int nmvectors;
 
-  char* keywords[] = { "parent", NULL };
-  const char* parent = NULL;
+  dtrace("%p, %p, %p", self, args, keys);
 
   if (!PyArg_ParseTupleAndKeywords(args, keys,
         "s:pygetdata.dirfile.nmvectors", keywords, &parent))
@@ -1379,23 +1529,25 @@ static PyObject* gdpy_dirfile_getnmvectors(struct gdpy_dirfile_t* self,
     return NULL;
   }
 
-  unsigned int nmvectors = gd_nmvectors(self->D, parent);
+  nmvectors = gd_nmvectors(self->D, parent);
 
   PYGD_CHECK_ERROR(self->D, NULL);
 
-  PyObject* pyobj = PyInt_FromLong((long)nmvectors);
+  pyobj = PyInt_FromLong((long)nmvectors);
 
   dreturn("%p", pyobj);
   return pyobj;
 }
 
-static PyObject* gdpy_dirfile_getbof(struct gdpy_dirfile_t* self,
-    PyObject* args, PyObject* keys)
+static PyObject *gdpy_dirfile_getbof(struct gdpy_dirfile_t *self,
+    PyObject *args, PyObject *keys)
 {
-  dtrace("%p, %p, %p", self, args, keys);
+  char *keywords[] = { "field_code", NULL };
+  const char *field_code;
+  off_t bof;
+  PyObject *pyobj;
 
-  char* keywords[] = { "field_code", NULL };
-  const char* field_code;
+  dtrace("%p, %p, %p", self, args, keys);
 
   if (!PyArg_ParseTupleAndKeywords(args, keys,
         "s:pygetdata.dirfile.bof", keywords, &field_code))
@@ -1404,23 +1556,25 @@ static PyObject* gdpy_dirfile_getbof(struct gdpy_dirfile_t* self,
     return NULL;
   }
 
-  off_t bof = gd_bof(self->D, field_code);
+  bof = gd_bof(self->D, field_code);
 
   PYGD_CHECK_ERROR(self->D, NULL);
 
-  PyObject* pybof = PyLong_FromLongLong(bof);
+  pyobj = PyLong_FromLongLong(bof);
 
-  dreturn("%p", pybof);
-  return pybof;
+  dreturn("%p", pyobj);
+  return pyobj;
 }
 
-static PyObject* gdpy_dirfile_geteof(struct gdpy_dirfile_t* self,
-    PyObject* args, PyObject* keys)
+static PyObject *gdpy_dirfile_geteof(struct gdpy_dirfile_t *self,
+    PyObject *args, PyObject *keys)
 {
-  dtrace("%p, %p, %p", self, args, keys);
+  char *keywords[] = { "field_code", NULL };
+  const char *field_code;
+  PyObject *pyobj;
+  off_t eof;
 
-  char* keywords[] = { "field_code", NULL };
-  const char* field_code;
+  dtrace("%p, %p, %p", self, args, keys);
 
   if (!PyArg_ParseTupleAndKeywords(args, keys,
         "s:pygetdata.dirfile.eof", keywords, &field_code))
@@ -1429,51 +1583,59 @@ static PyObject* gdpy_dirfile_geteof(struct gdpy_dirfile_t* self,
     return NULL;
   }
 
-  off_t eof = gd_eof(self->D, field_code);
+  eof = gd_eof(self->D, field_code);
 
   PYGD_CHECK_ERROR(self->D, NULL);
 
-  PyObject* pyeof = PyLong_FromLongLong(eof);
+  pyobj = PyLong_FromLongLong(eof);
 
-  dreturn("%p", pyeof);
-  return pyeof;
+  dreturn("%p", pyobj);
+  return pyobj;
 }
 
-static PyObject* gdpy_dirfile_getnvectors(struct gdpy_dirfile_t* self)
+static PyObject *gdpy_dirfile_getnvectors(struct gdpy_dirfile_t *self)
 {
+  unsigned int nvectors;
+  PyObject *pyobj;
+
   dtrace("%p", self);
 
-  unsigned int nvectors = gd_nvectors(self->D);
+  nvectors = gd_nvectors(self->D);
 
   PYGD_CHECK_ERROR(self->D, NULL);
 
-  PyObject* pynvectors = PyInt_FromLong((long)nvectors);
+  pyobj = PyInt_FromLong((long)nvectors);
 
-  dreturn("%p", pynvectors);
-  return pynvectors;
+  dreturn("%p", pyobj);
+  return pyobj;
 }
 
-static PyObject* gdpy_dirfile_getreference(struct gdpy_dirfile_t* self,
-    void* closure)
+static PyObject *gdpy_dirfile_getreference(struct gdpy_dirfile_t *self,
+    void *closure)
 {
+  const char *ref;
+  PyObject *pyobj;
+
   dtrace("%p, %p", self, closure);
 
-  const char *ref = gd_reference(self->D, NULL);
+  ref = gd_reference(self->D, NULL);
 
   PYGD_CHECK_ERROR(self->D, NULL);
 
-  PyObject* pyref = PyString_FromString(ref);
+  pyobj = PyString_FromString(ref);
 
-  dreturn("%p", pyref);
-  return pyref;
+  dreturn("%p", pyobj);
+  return pyobj;
 }
 
-static int gdpy_dirfile_setreference(struct gdpy_dirfile_t* self,
+static int gdpy_dirfile_setreference(struct gdpy_dirfile_t *self,
     PyObject *value, void *closure)
 {
+  const char *ref;
+
   dtrace("%p, %p, %p", self, value, closure);
 
-  const char* ref = PyString_AsString(value);
+  ref = PyString_AsString(value);
 
   /* TypeError already raised on error */
   if (ref == NULL) {
@@ -1489,13 +1651,16 @@ static int gdpy_dirfile_setreference(struct gdpy_dirfile_t* self,
   return 0;
 }
 
-static PyObject* gdpy_dirfile_getstring(struct gdpy_dirfile_t* self,
-    void* args, void* keys)
+static PyObject *gdpy_dirfile_getstring(struct gdpy_dirfile_t *self,
+    void *args, void *keys)
 {
-  dtrace("%p, %p, %p", self, args, keys);
+  char *keywords[] = { "field_code", NULL };
+  const char *field_code;
+  PyObject *pyobj;
+  size_t len;
+  char *data;
 
-  char* keywords[] = { "field_code", NULL };
-  const char* field_code;
+  dtrace("%p, %p, %p", self, args, keys);
 
   if (!PyArg_ParseTupleAndKeywords(args, keys, "s:pygetdata.dirfile.get_string",
         keywords, &field_code))
@@ -1504,29 +1669,37 @@ static PyObject* gdpy_dirfile_getstring(struct gdpy_dirfile_t* self,
     return NULL;
   }
 
-  char data[GD_MAX_LINE_LENGTH];
+  len = gd_get_string(self->D, field_code, 0, NULL);
+
+  PYGD_CHECK_ERROR(self->D, NULL);
+
+  data = malloc(len);
+  if (data == NULL) {
+    PyErr_NoMemory();
+    dreturn("%p", NULL);
+    return NULL;
+  }
 
-  gd_get_string(self->D, field_code, GD_MAX_LINE_LENGTH, data);
+  gd_get_string(self->D, field_code, len, data);
 
   PYGD_CHECK_ERROR(self->D, NULL);
 
-  /* using the \u escape, it is possible to create a string longer than
-   * GD_MAX_LINE_LENGTH -- this ensures we remain NULL terminated */
-  data[GD_MAX_LINE_LENGTH - 1] = 0;
+  pyobj = PyString_FromString(data);
 
-  PyObject* pyobj = PyString_FromString(data);
+  free(data);
 
   dreturn("%p", pyobj);
   return pyobj;
 }
 
-static PyObject* gdpy_dirfile_getstrings(struct gdpy_dirfile_t* self)
+static PyObject *gdpy_dirfile_getstrings(struct gdpy_dirfile_t *self)
 {
-  dtrace("%p", self);
-
   int i;
-  const char** fields;
-  const char** values;
+  const char **fields;
+  const char **values;
+  PyObject *pyobj;
+
+  dtrace("%p", self);
 
   fields = gd_field_list_by_type(self->D, GD_STRING_ENTRY);
 
@@ -1536,24 +1709,26 @@ static PyObject* gdpy_dirfile_getstrings(struct gdpy_dirfile_t* self)
 
   PYGD_CHECK_ERROR(self->D, NULL);
 
-  PyObject* list = PyList_New(0);
+  pyobj = PyList_New(0);
 
   for (i = 0; fields[i] != NULL; ++i)
-    PyList_Append(list, Py_BuildValue("ss", fields[i], values[i]));
+    PyList_Append(pyobj, Py_BuildValue("ss", fields[i], values[i]));
 
-  dreturn("%p", list);
-  return list;
+  dreturn("%p", pyobj);
+  return pyobj;
 }
 
-static PyObject* gdpy_dirfile_putconstant(struct gdpy_dirfile_t* self,
-    void* args, void* keys)
+static PyObject *gdpy_dirfile_putconstant(struct gdpy_dirfile_t *self,
+    void *args, void *keys)
 {
-  dtrace("%p, %p, %p", self, args, keys);
-
-  char* keywords[] = {"field_code", "value", "type", NULL};
-  const char* field_code;
-  PyObject* value;
+  char *keywords[] = {"field_code", "value", "type", NULL};
+  const char *field_code;
+  PyObject *value;
   gd_type_t type = GD_UNKNOWN;
+  union gdpy_quadruple_value data;
+  int data_type;
+
+  dtrace("%p, %p, %p", self, args, keys);
 
   if (!PyArg_ParseTupleAndKeywords(args, keys,
         "sO|i:pygetdata.dirfile.put_constant", keywords, &field_code, &value,
@@ -1563,8 +1738,7 @@ static PyObject* gdpy_dirfile_putconstant(struct gdpy_dirfile_t* self,
     return NULL;
   }
 
-  union gdpy_quadruple_value data;
-  int data_type = gdpy_convert_from_pyobj(value, &data, type);
+  data_type = gdpy_convert_from_pyobj(value, &data, type);
 
   if (data_type == -1) {
     dreturn("%p", NULL);
@@ -1587,16 +1761,19 @@ static PyObject* gdpy_dirfile_putconstant(struct gdpy_dirfile_t* self,
   return Py_None;
 }
 
-static PyObject* gdpy_dirfile_putcarray(struct gdpy_dirfile_t* self,
-    PyObject* args, PyObject* keys)
+static PyObject *gdpy_dirfile_putcarray(struct gdpy_dirfile_t *self,
+    PyObject *args, PyObject *keys)
 {
-  dtrace("%p, %p, %p", self, args, keys);
-
-  char* keywords[] = { "field_code", "data", "type", "start", NULL };
-  const char* field_code;
+  char *keywords[] = { "field_code", "data", "type", "start", NULL };
+  const char *field_code;
   unsigned int start = 0, len;
   gd_type_t type = GD_UNKNOWN;
-  PyObject* pyobj;
+  PyObject *pyobj;
+#ifdef USE_NUMPY
+  int have_ndarray = 0;
+#endif
+
+  dtrace("%p, %p, %p", self, args, keys);
 
   if (!PyArg_ParseTupleAndKeywords(args, keys,
         "sO|iI:pygetdata.dirfile.putdata", keywords, &field_code, &pyobj,
@@ -1607,7 +1784,6 @@ static PyObject* gdpy_dirfile_putcarray(struct gdpy_dirfile_t* self,
 
   /* we only handle list or ndarray data */
 #ifdef USE_NUMPY
-  int have_ndarray = 0;
   if (PyArray_Check(pyobj)) {
     if (PyArray_NDIM(pyobj) != 1) {
       PyErr_SetString(PyExc_ValueError,
@@ -1635,7 +1811,7 @@ static PyObject* gdpy_dirfile_putcarray(struct gdpy_dirfile_t* self,
   }
 
   if (len > 0) {
-    void* data;
+    void *data;
 
 #ifdef USE_NUMPY
     if (have_ndarray) {
@@ -1696,18 +1872,21 @@ static PyObject* gdpy_dirfile_putcarray(struct gdpy_dirfile_t* self,
   return Py_None;
 }
 
-static PyObject* gdpy_dirfile_putdata(struct gdpy_dirfile_t* self,
-    PyObject* args, PyObject* keys)
+static PyObject *gdpy_dirfile_putdata(struct gdpy_dirfile_t *self,
+    PyObject *args, PyObject *keys)
 {
-  dtrace("%p, %p, %p", self, args, keys);
-
-  char* keywords[] = { "field_code", "data", "type", "first_frame",
+  char *keywords[] = { "field_code", "data", "type", "first_frame",
     "first_sample", NULL };
-  const char* field_code;
+  const char *field_code;
   off_t first_frame = 0, first_sample = 0;
   gd_type_t type = GD_UNKNOWN;
-  PyObject* pyobj;
+  PyObject *pyobj;
   size_t ns;
+#ifdef USE_NUMPY
+  int have_ndarray = 0;
+#endif
+
+  dtrace("%p, %p, %p", self, args, keys);
 
   if (!PyArg_ParseTupleAndKeywords(args, keys,
         "sO|iLL:pygetdata.dirfile.putdata", keywords, &field_code, &pyobj,
@@ -1718,7 +1897,6 @@ static PyObject* gdpy_dirfile_putdata(struct gdpy_dirfile_t* self,
 
   /* we only handle list or ndarray data */
 #ifdef USE_NUMPY
-  int have_ndarray = 0;
   if (PyArray_Check(pyobj)) {
     if (PyArray_NDIM(pyobj) != 1) {
       PyErr_SetString(PyExc_ValueError,
@@ -1746,7 +1924,7 @@ static PyObject* gdpy_dirfile_putdata(struct gdpy_dirfile_t* self,
   }
 
   if (ns > 0) {
-    void* data;
+    void *data;
 
 #ifdef USE_NUMPY
     if (have_ndarray) {
@@ -1803,75 +1981,497 @@ static PyObject* gdpy_dirfile_putdata(struct gdpy_dirfile_t* self,
     }
   }
 
-  pyobj = PyLong_FromLongLong(ns);
+  pyobj = PyLong_FromLongLong(ns);
+
+  dreturn("%p", pyobj);
+  return pyobj;
+}
+
+static PyObject *gdpy_dirfile_putstring(struct gdpy_dirfile_t *self,
+    PyObject *args, PyObject *keys)
+{
+  char *keywords[] = { "field_code", "data", NULL };
+  const char *field_code;
+  const char *data;
+
+  dtrace("%p, %p, %p", self, args, keys);
+
+  if (!PyArg_ParseTupleAndKeywords(args, keys,
+        "ss:pygetdata.dirfile.put_string", keywords, &field_code, &data))
+  {
+    dreturn ("%p", NULL);
+    return NULL;
+  }
+
+  gd_put_string(self->D, field_code, data);
+
+  PYGD_CHECK_ERROR(self->D, NULL);
+
+  Py_INCREF(Py_None);
+  dreturn("%p", Py_None);
+  return Py_None;
+}
+
+static PyObject *gdpy_dirfile_getspf(struct gdpy_dirfile_t *self,
+    PyObject *args, PyObject *keys)
+{
+  char *keywords[] = { "field_code", NULL };
+  const char *field_code;
+  PyObject *pyobj;
+  unsigned int spf;
+
+  dtrace("%p, %p, %p", self, args, keys);
+
+  if (!PyArg_ParseTupleAndKeywords(args, keys, "s:pygetdata.dirfile.spf",
+        keywords, &field_code)) {
+    dreturn ("%p", NULL);
+    return NULL;
+  }
+
+  spf = gd_spf(self->D, field_code);
+
+  PYGD_CHECK_ERROR(self->D, NULL);
+
+  pyobj = PyInt_FromLong((long)spf);
+  dreturn("%p", pyobj);
+  return pyobj;
+}
+
+static PyObject *gdpy_dirfile_validate(struct gdpy_dirfile_t *self,
+    PyObject *args, PyObject *keys)
+{
+  char *keywords[] = { "field_code", NULL };
+  const char *field_code;
+
+  dtrace("%p, %p, %p", self, args, keys);
+
+  if (!PyArg_ParseTupleAndKeywords(args, keys, "s:pygetdata.dirfile.validate",
+        keywords, &field_code)) {
+    dreturn ("%p", NULL);
+    return NULL;
+  }
+
+  gd_validate(self->D, field_code);
+
+  PYGD_CHECK_ERROR(self->D, NULL);
+
+  Py_INCREF(Py_None);
+  dreturn("%p", Py_None);
+  return Py_None;
+}
+
+static PyObject *gdpy_dirfile_getframenum(struct gdpy_dirfile_t *self,
+    PyObject *args, PyObject *keys)
+{
+  char *keywords[] = { "field_code", "value", "start", "end", NULL };
+  const char *field_code;
+  double value, frame;
+  off_t frame_start = 0;
+  off_t frame_end = 0;
+  PyObject *pyobj;
+
+  dtrace("%p, %p, %p", self, args, keys);
+
+  if (!PyArg_ParseTupleAndKeywords(args, keys,
+        "sd|KK:pygetdata.dirfile.framenum", keywords, &field_code, &value,
+        &frame_start, &frame_end))
+  {
+    dreturn ("%p", NULL);
+    return NULL;
+  }
+
+ frame = gd_framenum_subset(self->D, field_code, value, frame_start, frame_end);
+
+  PYGD_CHECK_ERROR(self->D, NULL);
+
+  pyobj = PyFloat_FromDouble(frame);
+  dreturn("%p", pyobj);
+  return pyobj;
+}
+
+static PyObject *gdpy_dirfile_callback(struct gdpy_dirfile_t *self,
+    PyObject *args, PyObject *keys)
+{
+  PyObject *pycallback = NULL;
+  PyObject *pycallback_data = Py_None;
+  char *keywords[] = {"callback", "extra", NULL};
+
+  dtrace("%p, %p, %p", self, args, keys);
+
+  if (!PyArg_ParseTupleAndKeywords(args, keys,
+        "OO:pygetdata.dirfile.set_callback", keywords, &pycallback,
+        &pycallback_data))
+  {
+    dreturn("%p", NULL);
+    return NULL;
+  }
+
+  if (pycallback && pycallback != Py_None && !PyCallable_Check(pycallback)) {
+    PyErr_SetString(PyExc_TypeError, "callback function must be callable");
+    dreturn("%p", NULL);
+    return NULL;
+  }
+
+  Py_XINCREF(pycallback);
+  Py_XINCREF(pycallback_data);
+  Py_XDECREF(self->callback);
+  Py_XDECREF(self->callback_data);
+  self->callback = pycallback;
+  self->callback_data = pycallback_data;
+
+  gd_parser_callback(self->D, (pycallback == NULL) ? NULL :
+      gdpy_callback_func, self);
+
+  PYGD_CHECK_ERROR(self->D, NULL);
+
+  Py_INCREF(Py_None);
+  dreturn("%p", Py_None);
+  return Py_None;
+}
+
+static PyObject *gdpy_dirfile_uninclude(struct gdpy_dirfile_t *self,
+    PyObject *args, PyObject *keys)
+{
+  char *keywords[] = {"fragment_index", "del", NULL};
+  int fragment_index;
+  int del = 0;
+
+  dtrace("%p, %p, %p", self, args, keys);
+
+  if (!PyArg_ParseTupleAndKeywords(args, keys,
+        "i|i:pygetdata.dirfile.uninclude", keywords, &fragment_index, &del))
+  {
+    dreturn("%p", NULL);
+    return NULL;
+  }
+
+  gd_uninclude(self->D, fragment_index, del);
+
+  PYGD_CHECK_ERROR(self->D, NULL);
+
+  Py_INCREF(Py_None);
+  dreturn("%p", Py_None);
+  return Py_None;
+}
+
+static PyObject *gdpy_dirfile_move(struct gdpy_dirfile_t *self, PyObject *args,
+    PyObject *keys)
+{
+  char *keywords[] = { "field_code", "new_fragment", "move_data", NULL };
+  const char *field_code;
+  int new_fragment;
+  int move_data = 0;
+
+  dtrace("%p, %p, %p", self, args, keys);
+
+  if (!PyArg_ParseTupleAndKeywords(args, keys, "si|i:pygetdata.dirfile.move",
+        keywords, &field_code, &new_fragment, &move_data)) {
+    dreturn ("%p", NULL);
+    return NULL;
+  }
+
+  gd_move(self->D, field_code, new_fragment, move_data);
+
+  PYGD_CHECK_ERROR(self->D, NULL);
+
+  Py_INCREF(Py_None);
+  dreturn("%p", Py_None);
+  return Py_None;
+}
+
+static PyObject *gdpy_dirfile_rename(struct gdpy_dirfile_t *self,
+    PyObject *args, PyObject *keys)
+{
+  char *keywords[] = { "old_code", "new_name", "flags", NULL };
+  const char *old_code;
+  const char *new_name;
+  unsigned flags = 0;
+
+  dtrace("%p, %p, %p", self, args, keys);
+
+  if (!PyArg_ParseTupleAndKeywords(args, keys, "ss|I:pygetdata.dirfile.rename",
+        keywords, &old_code, &new_name, &flags)) {
+    dreturn ("%p", NULL);
+    return NULL;
+  }
+
+  gd_rename(self->D, old_code, new_name, flags);
+
+  PYGD_CHECK_ERROR(self->D, NULL);
+
+  Py_INCREF(Py_None);
+  dreturn("%p", Py_None);
+  return Py_None;
+}
+
+static PyObject *gdpy_dirfile_getstandards(struct gdpy_dirfile_t *self,
+    void *closure)
+{
+  int vers;
+  PyObject *pyobj;
+
+  dtrace("%p, %p", self, closure);
+
+  vers = gd_dirfile_standards(self->D, GD_VERSION_CURRENT);
+
+  PYGD_CHECK_ERROR(self->D, NULL);
+
+  pyobj = PyInt_FromLong(vers);
+
+  dreturn("%p", pyobj);
+  return pyobj;
+}
+
+static int gdpy_dirfile_setstandards(struct gdpy_dirfile_t *self,
+    PyObject *value, void *closure)
+{
+  int vers;
+
+  dtrace("%p, %p, %p", self, value, closure);
+
+  vers = (int)PyInt_AsLong(value);
+
+  if (PyErr_Occurred()) {
+    dreturn("%i", -1);
+    return -1;
+  }
+
+  gd_dirfile_standards(self->D, vers);
+
+  PYGD_CHECK_ERROR(self->D, -1);
+
+  dreturn("%i", 0);
+  return 0;
+}
+
+static PyObject *gdpy_dirfile_seek(struct gdpy_dirfile_t *self, PyObject *args,
+    PyObject *keys)
+{
+  char *keywords[] = { "field_code", "flags", "frame_num", "sample_num", NULL };
+  const char *field_code;
+  PY_LONG_LONG frame_num = 0, sample_num = 0;
+  int flags;
+  off_t pos;
+  PyObject *pyobj;
+
+  dtrace("%p, %p, %p", self, args, keys);
+
+  if (!PyArg_ParseTupleAndKeywords(args, keys, "si|LL:pygetdata.dirfile.seek",
+        keywords, &field_code, &flags, &frame_num, &sample_num))
+  {
+    dreturn("%p", NULL);
+    return NULL;
+  }
+
+  pos = gd_seek(self->D, field_code, (off_t)frame_num, (off_t)sample_num,
+      flags);
+
+  PYGD_CHECK_ERROR(self->D, NULL);
+
+  pyobj = PyLong_FromLongLong((long long)pos);
+
+  dreturn("%p", pyobj);
+  return pyobj;
+}
+
+static PyObject *gdpy_dirfile_tell(struct gdpy_dirfile_t *self, PyObject *args,
+    PyObject *keys)
+{
+  char *keywords[] = { "field_code", NULL };
+  const char *field_code;
+  off_t pos;
+  PyObject *pyobj;
+
+  dtrace("%p, %p, %p", self, args, keys);
+
+  if (!PyArg_ParseTupleAndKeywords(args, keys, "s:pygetdata.dirfile.tell",
+        keywords, &field_code))
+  {
+    dreturn("%p", NULL);
+    return NULL;
+  }
+
+  pos = gd_tell(self->D, field_code);
+
+  PYGD_CHECK_ERROR(self->D, NULL);
+
+  pyobj = PyLong_FromLongLong((long long)pos);
+
+  dreturn("%p", pyobj);
+  return pyobj;
+}
+
+static PyObject *gdpy_dirfile_hide(struct gdpy_dirfile_t *self,
+    PyObject *args, PyObject *keys)
+{
+  char *keywords[] = { "field_code", NULL };
+  const char *field_code;
+
+  dtrace("%p, %p, %p", self, args, keys);
+
+  if (!PyArg_ParseTupleAndKeywords(args, keys,
+        "s:pygetdata.dirfile.hide", keywords, &field_code))
+  {
+    dreturn("%p", NULL);
+    return NULL;
+  }
+
+  gd_hide(self->D, field_code);
+
+  PYGD_CHECK_ERROR(self->D, NULL);
+
+  Py_INCREF(Py_None);
+  dreturn("%p", Py_None);
+  return Py_None;
+}
+
+static PyObject *gdpy_dirfile_unhide(struct gdpy_dirfile_t *self,
+    PyObject *args, PyObject *keys)
+{
+  char *keywords[] = { "field_code", NULL };
+  const char *field_code;
+
+  dtrace("%p, %p, %p", self, args, keys);
+
+  if (!PyArg_ParseTupleAndKeywords(args, keys,
+        "s:pygetdata.dirfile.unhide", keywords, &field_code))
+  {
+    dreturn("%p", NULL);
+    return NULL;
+  }
+
+  gd_unhide(self->D, field_code);
+
+  PYGD_CHECK_ERROR(self->D, NULL);
+
+  Py_INCREF(Py_None);
+  dreturn("%p", Py_None);
+  return Py_None;
+}
+
+static PyObject *gdpy_dirfile_naliases(struct gdpy_dirfile_t *self,
+    PyObject *args, PyObject *keys)
+{
+  char *keywords[] = { "field_code", NULL };
+  const char *field_code;
+  PyObject *pyobj;
+  long naliases;
+
+  dtrace("%p, %p, %p", self, args, keys);
+
+  if (!PyArg_ParseTupleAndKeywords(args, keys,
+        "s:pygetdata.dirfile.naliases", keywords, &field_code))
+  {
+    dreturn("%p", NULL);
+    return NULL;
+  }
+
+  naliases = gd_naliases(self->D, field_code);
+
+  PYGD_CHECK_ERROR(self->D, NULL);
+
+  pyobj = PyInt_FromLong(naliases);
+
+  dreturn("%p", pyobj);
+  return pyobj;
+}
+
+static PyObject *gdpy_dirfile_aliastarget(struct gdpy_dirfile_t *self,
+    PyObject *args, PyObject *keys)
+{
+  char *keywords[] = { "field_code", NULL };
+  const char *field_code, *target;
+  PyObject *pyobj;
+
+  dtrace("%p, %p, %p", self, args, keys);
+
+  if (!PyArg_ParseTupleAndKeywords(args, keys,
+        "s:pygetdata.dirfile.alias_target", keywords, &field_code))
+  {
+    dreturn("%p", NULL);
+    return NULL;
+  }
+
+  target = gd_alias_target(self->D, field_code);
+
+  PYGD_CHECK_ERROR(self->D, NULL);
+
+  pyobj = PyString_FromString(target);
 
   dreturn("%p", pyobj);
   return pyobj;
 }
 
-static PyObject* gdpy_dirfile_putstring(struct gdpy_dirfile_t* self,
-    PyObject* args, PyObject* keys)
+static PyObject *gdpy_dirfile_hidden(struct gdpy_dirfile_t *self,
+    PyObject *args, PyObject *keys)
 {
-  dtrace("%p, %p, %p", self, args, keys);
+  char *keywords[] = { "field_code", NULL };
+  const char *field_code;
+  PyObject *pyobj;
+  long hidden;
 
-  char* keywords[] = { "field_code", "data", NULL };
-  const char* field_code;
-  const char* data;
+  dtrace("%p, %p, %p", self, args, keys);
 
   if (!PyArg_ParseTupleAndKeywords(args, keys,
-        "ss:pygetdata.dirfile.put_string", keywords, &field_code, &data))
+        "s:pygetdata.dirfile.hidden", keywords, &field_code))
   {
-    dreturn ("%p", NULL);
+    dreturn("%p", NULL);
     return NULL;
   }
 
-  gd_put_string(self->D, field_code, data);
+  hidden = gd_hidden(self->D, field_code);
 
   PYGD_CHECK_ERROR(self->D, NULL);
 
-  Py_INCREF(Py_None);
-  dreturn("%p", Py_None);
-  return Py_None;
+  pyobj = PyInt_FromLong(hidden);
+
+  dreturn("%p", pyobj);
+  return pyobj;
 }
 
-static PyObject* gdpy_dirfile_getspf(struct gdpy_dirfile_t* self,
-    PyObject* args, PyObject* keys)
+static PyObject *gdpy_dirfile_movealias(struct gdpy_dirfile_t *self,
+    PyObject *args, PyObject *keys)
 {
-  dtrace("%p, %p, %p", self, args, keys);
+  char *keywords[] = { "field_code", "new_fragment", NULL };
+  const char *field_code;
+  int new_fragment;
 
-  char* keywords[] = { "field_code", NULL };
-  const char* field_code;
+  dtrace("%p, %p, %p", self, args, keys);
 
-  if (!PyArg_ParseTupleAndKeywords(args, keys, "s:pygetdata.dirfile.spf",
-        keywords, &field_code)) {
+  if (!PyArg_ParseTupleAndKeywords(args, keys,
+        "si:pygetdata.dirfile.move_alias", keywords, &field_code,
+        &new_fragment))
+  {
     dreturn ("%p", NULL);
     return NULL;
   }
 
-  unsigned int spf = gd_spf(self->D, field_code);
+  gd_move_alias(self->D, field_code, new_fragment);
 
   PYGD_CHECK_ERROR(self->D, NULL);
 
-  PyObject* pyobj = PyInt_FromLong((long)spf);
-  dreturn("%p", pyobj);
-  return pyobj;
+  Py_INCREF(Py_None);
+  dreturn("%p", Py_None);
+  return Py_None;
 }
 
-static PyObject* gdpy_dirfile_validate(struct gdpy_dirfile_t* self,
-    PyObject* args, PyObject* keys)
+static PyObject *gdpy_dirfile_deletealias(struct gdpy_dirfile_t *self,
+    void *args, void *keys)
 {
-  dtrace("%p, %p, %p", self, args, keys);
+  char *keywords[] = {"field_code", "flags", NULL};
+  const char *field_code;
+  unsigned flags = 0;
 
-  char* keywords[] = { "field_code", NULL };
-  const char* field_code;
+  dtrace("%p, %p, %p", self, args, keys);
 
-  if (!PyArg_ParseTupleAndKeywords(args, keys, "s:pygetdata.dirfile.validate",
-        keywords, &field_code)) {
-    dreturn ("%p", NULL);
+  if (!PyArg_ParseTupleAndKeywords(args, keys,
+        "s|I:pygetdata.dirfile.delete", keywords, &field_code, &flags))
+  {
+    dreturn("%p", NULL);
     return NULL;
   }
 
-  gd_validate(self->D, field_code);
+  gd_delete_alias(self->D, field_code, flags);
 
   PYGD_CHECK_ERROR(self->D, NULL);
 
@@ -1880,67 +2480,55 @@ static PyObject* gdpy_dirfile_validate(struct gdpy_dirfile_t* self,
   return Py_None;
 }
 
-static PyObject* gdpy_dirfile_getframenum(struct gdpy_dirfile_t* self,
-    PyObject* args, PyObject* keys)
+static PyObject *gdpy_dirfile_aliaslist(struct gdpy_dirfile_t *self,
+    void *args, void *keys)
 {
-  dtrace("%p, %p, %p", self, args, keys);
+  const char **fields;
+  char *keywords[] = { "field_code", NULL };
+  int i;
+  const char *field_code;
+  PyObject *pyobj;
 
-  char* keywords[] = { "field_code", "value", "start", "end", NULL };
-  const char* field_code;
-  double value;
-  off_t frame_start = 0;
-  off_t frame_end = 0;
+  dtrace("%p, %p, %p", self, args, keys);
 
   if (!PyArg_ParseTupleAndKeywords(args, keys,
-        "sd|KK:pygetdata.dirfile.framenum", keywords, &field_code, &value,
-        &frame_start, &frame_end))
+        "s:pygetdata.dirfile.alias_list", keywords, &field_code))
   {
-    dreturn ("%p", NULL);
+    dreturn("%p", NULL);
     return NULL;
   }
 
-  double frame = gd_framenum_subset(self->D, field_code, value, frame_start,
-      frame_end);
+  fields = gd_aliases(self->D, field_code);
 
   PYGD_CHECK_ERROR(self->D, NULL);
 
-  PyObject* pyobj = PyFloat_FromDouble(frame);
+  pyobj = PyList_New(0);
+
+  for (i = 0; fields[i] != NULL; ++i)
+    PyList_Append(pyobj, PyString_FromString(fields[i]));
+
   dreturn("%p", pyobj);
   return pyobj;
 }
 
-static PyObject* gdpy_dirfile_callback(struct gdpy_dirfile_t* self,
-    PyObject *args, PyObject *keys)
+static PyObject *gdpy_dirfile_addalias(struct gdpy_dirfile_t *self,
+    void *args, void *keys)
 {
-  dtrace("%p, %p, %p", self, args, keys);
+  char *keywords[] = { "field_code", "target", "fragment_index", NULL };
+  const char *field_code, *target;
+  int fragment_index = 0;
 
-  PyObject* pycallback = NULL;
-  PyObject* pycallback_data = Py_None;
-  char *keywords[] = {"callback", "extra", NULL};
+  dtrace("%p, %p, %p", self, args, keys);
 
   if (!PyArg_ParseTupleAndKeywords(args, keys,
-        "OO:pygetdata.dirfile.set_callback", keywords, &pycallback,
-        &pycallback_data))
+        "ss|i:pygetdata.dirfile.add_alias", keywords, &field_code, &target,
+        &fragment_index))
   {
     dreturn("%p", NULL);
     return NULL;
   }
 
-  if (pycallback && pycallback != Py_None && !PyCallable_Check(pycallback)) {
-    PyErr_SetString(PyExc_TypeError, "callback function must be callable");
-    dreturn("%p", NULL);
-    return NULL;
-  }
-
-  Py_XINCREF(pycallback);
-  Py_XINCREF(pycallback_data);
-  Py_XDECREF(self->callback);
-  Py_XDECREF(self->callback_data);
-  self->callback = pycallback;
-  self->callback_data = pycallback_data;
-
-  gd_parser_callback(self->D, (pycallback == NULL) ? NULL :
-      gdpy_callback_func, self);
+  gd_add_alias(self->D, field_code, target, fragment_index);
 
   PYGD_CHECK_ERROR(self->D, NULL);
 
@@ -1949,23 +2537,23 @@ static PyObject* gdpy_dirfile_callback(struct gdpy_dirfile_t* self,
   return Py_None;
 }
 
-static PyObject* gdpy_dirfile_uninclude(struct gdpy_dirfile_t* self,
-    PyObject *args, PyObject *keys)
+static PyObject *gdpy_dirfile_maddalias(struct gdpy_dirfile_t *self,
+    void *args, void *keys)
 {
-  dtrace("%p, %p, %p", self, args, keys);
+  char *keywords[] = { "parent", "field_code", "target", NULL };
+  const char *field_code, *target, *parent;
 
-  char *keywords[] = {"fragment_index", "del", NULL};
-  int fragment_index;
-  int del = 0;
+  dtrace("%p, %p, %p", self, args, keys);
 
   if (!PyArg_ParseTupleAndKeywords(args, keys,
-        "i|i:pygetdata.dirfile.uninclude", keywords, &fragment_index, &del))
+        "sss:pygetdata.dirfile.madd_alias", keywords, &parent, &field_code,
+        &target))
   {
     dreturn("%p", NULL);
     return NULL;
   }
 
-  gd_uninclude(self->D, fragment_index, del);
+  gd_madd_alias(self->D, parent, field_code, target);
 
   PYGD_CHECK_ERROR(self->D, NULL);
 
@@ -1974,84 +2562,167 @@ static PyObject* gdpy_dirfile_uninclude(struct gdpy_dirfile_t* self,
   return Py_None;
 }
 
-static PyObject* gdpy_dirfile_move(struct gdpy_dirfile_t* self, PyObject* args,
-    PyObject* keys)
+static PyObject *gdpy_dirfile_strtok(struct gdpy_dirfile_t *self,
+    void *args, void *keys)
 {
-  dtrace("%p, %p, %p", self, args, keys);
+  char *token;
+  char *keywords[] = { "string", NULL };
+  const char *string = NULL;
+  PyObject *pyobj;
 
-  char* keywords[] = { "field_code", "new_fragment", "move_data", NULL };
-  const char* field_code;
-  int new_fragment;
-  int move_data = 0;
+  dtrace("%p, %p, %p", self, args, keys);
 
-  if (!PyArg_ParseTupleAndKeywords(args, keys, "si|i:pygetdata.dirfile.move",
-        keywords, &field_code, &new_fragment, &move_data)) {
-    dreturn ("%p", NULL);
+  if (!PyArg_ParseTupleAndKeywords(args, keys, "|s:pygetdata.dirfile.strtok",
+        keywords, &string))
+  {
+    dreturn("%p", NULL);
     return NULL;
   }
 
-  gd_move(self->D, field_code, new_fragment, move_data);
+  token = gd_strtok(self->D, string);
 
-  PYGD_CHECK_ERROR(self->D, NULL);
+  pyobj = PyString_FromString(token);
+  free(token);
 
-  Py_INCREF(Py_None);
-  dreturn("%p", Py_None);
-  return Py_None;
+  dreturn("%p", pyobj);
+  return pyobj;
 }
 
-static PyObject* gdpy_dirfile_rename(struct gdpy_dirfile_t* self,
-    PyObject* args, PyObject* keys)
+static PyObject *gdpy_dirfile_desync(struct gdpy_dirfile_t *self,
+    void *args, void *keys)
 {
-  dtrace("%p, %p, %p", self, args, keys);
+  int ret;
+  char *keywords[] = { "flags", NULL };
+  unsigned int flags = 0;
+  PyObject *pyobj;
 
-  char* keywords[] = { "old_code", "new_name", "move_data", NULL };
-  const char* old_code;
-  const char* new_name;
-  int move_data = 0;
+  dtrace("%p, %p, %p", self, args, keys);
 
-  if (!PyArg_ParseTupleAndKeywords(args, keys, "ss|i:pygetdata.dirfile.move",
-        keywords, &old_code, &new_name, &move_data)) {
-    dreturn ("%p", NULL);
+  if (!PyArg_ParseTupleAndKeywords(args, keys, "|I:pygetdata.dirfile.desync",
+        keywords, &flags))
+  {
+    dreturn("%p", NULL);
     return NULL;
   }
 
-  gd_rename(self->D, old_code, new_name, move_data);
+  ret = gd_desync(self->D, flags);
+
+  pyobj = PyInt_FromLong((long)ret);
+  dreturn("%p", pyobj);
+  return pyobj;
+}
+
+static PyObject *gdpy_dirfile_getflags(struct gdpy_dirfile_t *self,
+    void *closure)
+{
+  PyObject *pyobj;
+  unsigned long flags;
+
+  dtrace("%p, %p", self, closure);
+
+  flags = gd_flags(self->D, 0, 0);
 
   PYGD_CHECK_ERROR(self->D, NULL);
 
-  Py_INCREF(Py_None);
-  dreturn("%p", Py_None);
-  return Py_None;
+  pyobj = PyLong_FromUnsignedLong(flags);
+  dreturn("%p", pyobj);
+  return pyobj;
+}
+
+static int gdpy_dirfile_setflags(struct gdpy_dirfile_t *self,
+    PyObject *value, void *closure)
+{
+  unsigned long new_flags;
+
+  dtrace("%p, %p, %p", self, value, closure);
+
+  new_flags = PyLong_AsUnsignedLong(value);
+
+  if (PyErr_Occurred()) {
+    dreturn("%i", -1);
+    return -1;
+  }
+
+  gd_flags(self->D, new_flags, ~new_flags);
+
+  PYGD_CHECK_ERROR(self->D, -1);
+
+  dreturn("%i", 0);
+  return 0;
 }
 
-static PyObject* gdpy_dirfile_getstandards(struct gdpy_dirfile_t* self,
-    void* closure)
+static PyObject *gdpy_dirfile_getverboseprefix(struct gdpy_dirfile_t *self,
+    void *closure)
 {
+  PyObject *pyobj;
+
   dtrace("%p, %p", self, closure);
 
-  int vers = gd_dirfile_standards(self->D, GD_VERSION_CURRENT);
+  if (self->verbose_prefix == NULL) {
+    Py_INCREF(Py_None);
+    dreturn("%p", Py_None);
+    return Py_None;
+  }
+
+  pyobj = PyString_FromString(self->verbose_prefix);
+  dreturn("%p", pyobj);
+  return pyobj;
+}
 
-  PYGD_CHECK_ERROR(self->D, NULL);
+static int gdpy_dirfile_setverboseprefix(struct gdpy_dirfile_t *self,
+    PyObject *value, void *closure)
+{
+  dtrace("%p, %p, %p", self, value, closure);
 
-  PyObject* pyobj = PyInt_FromLong(vers);
+  free(self->verbose_prefix);
+  if (value == Py_None)
+    self->verbose_prefix = NULL;
+  else {
+    char *string = PyString_AsString(value);
+    if (string == NULL) {
+      dreturn("%i", -1);
+      return -1;
+    }
+    self->verbose_prefix = strdup(string);
+  }
+
+  gd_verbose_prefix(self->D, self->verbose_prefix);
+
+  PYGD_CHECK_ERROR(self->D, -1);
+
+  dreturn("%i", 0);
+  return 0;
+}
+
+static PyObject *gdpy_dirfile_getmplexlookback(struct gdpy_dirfile_t *self,
+    void *closure)
+{
+  PyObject *pyobj;
+
+  dtrace("%p, %p", self, closure);
 
+  pyobj = PyInt_FromLong(self->mplex_lookback);
   dreturn("%p", pyobj);
   return pyobj;
 }
 
-static int gdpy_dirfile_setstandards(struct gdpy_dirfile_t* self,
+static int gdpy_dirfile_setmplexlookback(struct gdpy_dirfile_t *self,
     PyObject *value, void *closure)
 {
+  int lookback;
+
   dtrace("%p, %p, %p", self, value, closure);
 
-  int vers = (int)PyInt_AsLong(value);
+  lookback = (int)PyInt_AsLong(value);
 
   if (PyErr_Occurred()) {
     dreturn("%i", -1);
     return -1;
   }
 
-  gd_dirfile_standards(self->D, vers);
+  self->mplex_lookback = lookback;
+
+  gd_mplex_lookback(self->D, lookback);
 
   PYGD_CHECK_ERROR(self->D, -1);
 
@@ -2059,6 +2730,93 @@ static int gdpy_dirfile_setstandards(struct gdpy_dirfile_t* self,
   return 0;
 }
 
+static PyObject *gdpy_dirfile_nentries(struct gdpy_dirfile_t *self,
+    PyObject *args, PyObject *keys)
+{
+  char *keywords[] = { "parent", "type", "flags", NULL };
+  unsigned int nentries, flags = 0;
+  int type = 0;
+  const char *parent = NULL;
+  PyObject *pyobj;
+
+  dtrace("%p, %p, %p", self, args, keys);
+
+  if (!PyArg_ParseTupleAndKeywords(args, keys,
+        "|siI:pygetdata.dirfile.nentries", keywords, &parent, &type, &flags))
+  {
+    dreturn("%p", NULL);
+    return NULL;
+  }
+
+  nentries = gd_nentries(self->D, parent, type, flags);
+
+  PYGD_CHECK_ERROR(self->D, NULL);
+
+  pyobj = PyInt_FromLong((long)nentries);
+
+  dreturn("%p", pyobj);
+  return pyobj;
+}
+
+static PyObject *gdpy_dirfile_entrylist(struct gdpy_dirfile_t *self,
+    void *args, void *keys)
+{
+  const char **entries;
+  char *keywords[] = { "parent", "type", "flags", NULL };
+  int i, type = 0;
+  unsigned int flags = 0;
+  const char *parent = NULL;
+  PyObject *pyobj;
+
+  dtrace("%p, %p, %p", self, args, keys);
+
+  if (!PyArg_ParseTupleAndKeywords(args, keys,
+        "|siI:pygetdata.dirfile.entry_list", keywords, &parent, &type, &flags))
+  {
+    dreturn("%p", NULL);
+    return NULL;
+  }
+
+  entries = gd_entry_list(self->D, parent, type, flags);
+
+  PYGD_CHECK_ERROR(self->D, NULL);
+
+  pyobj = PyList_New(0);
+
+  for (i = 0; entries[i] != NULL; ++i)
+    PyList_Append(pyobj, PyString_FromString(entries[i]));
+
+  dreturn("%p", pyobj);
+  return pyobj;
+}
+
+static PyObject *gdpy_dirfile_linterptablename(struct gdpy_dirfile_t *self,
+    PyObject *args, PyObject *keys)
+{
+  char *keywords[] = { "field_code", NULL };
+  const char *field_code;
+  char *filename;
+  PyObject *pyobj;
+
+  dtrace("%p, %p, %p", self, args, keys);
+
+  if (!PyArg_ParseTupleAndKeywords(args, keys,
+        "s:pygetdata.dirfile.linterp_tablename", keywords, &field_code))
+  {
+    dreturn ("%p", NULL);
+    return NULL;
+  }
+
+  filename = gd_linterp_tablename(self->D, field_code);
+
+  PYGD_CHECK_ERROR(self->D, NULL);
+
+  pyobj = PyString_FromString(filename);
+  free(filename);
+  dreturn("%p", pyobj);
+  return pyobj;
+}
+
 static PyGetSetDef gdpy_dirfile_getset[] = {
   { "error", (getter)gdpy_dirfile_geterror, NULL,
     "The numerical error code encountered by the last call to the GetData\n"
@@ -2067,10 +2825,19 @@ static PyGetSetDef gdpy_dirfile_getset[] = {
       "errors, it is typically not necessary to check this value; use a\n"
       "try/except statement instead.  See gd_error(3).",
     NULL },
+  { "error_count", (getter)gdpy_dirfile_geterrorcount, NULL,
+    "The number of errors encountered by the GetData library for this\n"
+      "dirfile since the last time this member was accessed.  Note:\n"
+      "accessing this member, resets it to zero.  See gd_error_count(3).",
+    NULL },
   { "error_string", (getter)gdpy_dirfile_geterrorstring, NULL,
     "A human-readable description of the last error encountered by the\n"
       "GetData library for this dirfile.  See gd_error_string(3).",
     NULL },
+  { "flags", (getter)gdpy_dirfile_getflags, (setter)gdpy_dirfile_setflags,
+    "The operational flags of the open dirfile.  This contains a subset\n"
+      "of the dirfile creation flags specified when the object was\n"
+      "instantiated.  See gd_flags(3).", NULL },
   { "name", (getter)gdpy_dirfile_getname, NULL,
     "The name of the Dirfile.  See gd_dirfilename(3).",
     NULL },
@@ -2092,6 +2859,20 @@ static PyGetSetDef gdpy_dirfile_getset[] = {
       "same effect as passing the corresponding C API symbols to\n"
       "gd_dirfile_standards(3), q.v.",
     NULL },
+  {"verbose_prefix", (getter)gdpy_dirfile_getverboseprefix,
+    (setter)gdpy_dirfile_setverboseprefix,
+      "If opened with pygetdata::VERBOSE, a string prefixed to error\n"
+        "messages printed by the library, or None, if no prefix is\n"
+        "defined.  See gd_verbose_prefix(3)."
+  },
+  {"mplex_lookback", (getter)gdpy_dirfile_getmplexlookback,
+    (setter)gdpy_dirfile_setmplexlookback,
+      "The number of MPLEX cycles to search before the requested start of\n"
+        "the returned data when reading data from a MPLEX field.  Set\n"
+        "to zero to disable lookback, or to -1 to make the lookback\n"
+        "unlimited.  See gd_mplex_lookback(3) for the definition of a\n"
+        "\"MPLEX cycle\"."
+  },
   { NULL }
 };
 
@@ -2153,10 +2934,8 @@ static PyMethodDef gdpy_dirfile_methods[] = {
   },
   {"flush", (PyCFunction)gdpy_dirfile_flush, METH_VARARGS | METH_KEYWORDS,
     "flush([field_code])\n\n"
-      "Flush pending writes to the specified field to disk.  This does\n"
-      "not flush pending metadata changes.  For that, use metaflush.\n"
-      "However, if field_code is omitted, all data *and* metadata will be\n"
-      "written to disk.  See gd_flush(3)."
+      "Equivalent to sync([field_code]) && raw_close([field_code]).\n"
+      "See gd_flush(3)."
   },
   {"bof", (PyCFunction)gdpy_dirfile_getbof, METH_VARARGS | METH_KEYWORDS,
     "bof(field_code)\n\n"
@@ -2214,7 +2993,6 @@ static PyMethodDef gdpy_dirfile_methods[] = {
       "field.  If NumPy support is present in pygetdata, and 'as_list' is\n"
       "not given or zero, the values will be returned in NumPy arrays;\n"
       "otherwise, the values will be returned as lists.\n\n"
-      /* -----------------------------------------------------------------| */
       "The 'return_type' parameter indicates the desired type of the values\n"
       "returned, and should be (typically) one of: pygetdata.INT,\n"
       "pygetdata.LONG, pygetdata.ULONG, pygetdata.FLOAT, or\n"
@@ -2223,7 +3001,7 @@ static PyMethodDef gdpy_dirfile_methods[] = {
       "and values, unlike the C API counterpart."
   },
   {"getdata", (PyCFunction)gdpy_dirfile_getdata, METH_VARARGS | METH_KEYWORDS,
-    "gd_getdata(field_code, return_type [, first_frame, first_sample,\n"
+    "getdata(field_code [, return_type, first_frame, first_sample,\n"
       "num_frames, num_samples, as_list])\n\n"
       "Retrieve a data vector from the dirfile.  If NumPy support is\n"
       "present in pygetdata, and 'as_list' is not given or zero, a NumPy\n"
@@ -2236,12 +3014,15 @@ static PyMethodDef gdpy_dirfile_methods[] = {
       "indicated.  For list data it should be (typically) one of:\n"
       "pygetdata.INT, pygetdata.LONG, pygetdata.ULONG, pygetdata.FLOAT, or\n"
       "pygetdata.COMPLEX, although any GetData data type code is permitted.\n"
-      "The 'first_frame' and 'first_samples' parameters indicate first\n"
+      "If omitted, the return type defaults to the native type of the field\n"
+      "(see dirfile.native_type()).\n\n"
+      "The 'first_frame' and 'first_sample' parameters indicate first\n"
       "datum to read.  If they are both omitted, data is read from the\n"
       "first sample.  Similarly, 'num_frames' and 'num_samples' indicate\n"
-      "the amount of data.  Omitting both of these results in an error.\n"
-      "Fewer samples than requested may be returned without causing an\n"
-      "error.  See gd_getdata(3)."
+      "the amount of data.  Omitting both is equivalent to setting\n"
+      "'num_frames' to dirfile.nframes (ie. all available data).  Fewer\n"
+      "samples than requested may be returned without causing an error.\n"
+      "See gd_getdata(3)."
   },
   { "entry", (PyCFunction)gdpy_dirfile_getentry,
     METH_VARARGS | METH_KEYWORDS,
@@ -2287,6 +3068,23 @@ static PyMethodDef gdpy_dirfile_methods[] = {
       "search begins at the first sample.  If 'end' is omitted, the search\n"
       "ends at the last sample.  See gd_framenum_subset(3)."
   },
+  {"hidden", (PyCFunction)gdpy_dirfile_hidden, METH_VARARGS | METH_KEYWORDS,
+    "hidden(field_code)\n\n"
+      "Returns true if field_code (alias or real field) is hidden  See \n"
+      "gd_hidden(3)."
+  },
+  {"hide", (PyCFunction)gdpy_dirfile_hide, METH_VARARGS | METH_KEYWORDS,
+    "hide(field_code)\n\n"
+      "Sets the hidden flag on the specified field.  See gd_hide(3)."
+  },
+  {"linterp_tablename", (PyCFunction)gdpy_dirfile_linterptablename,
+    METH_VARARGS | METH_KEYWORDS,
+    "linterp_tablename(field_code)\n\n"
+      "Return the pathname of the look-up table (LUT) on disk used by the\n"
+      /* ------- handy ruler ---------------------------------------------| */
+      "LINTERP field specified by 'field_code'.  See\n"
+      "gd_linterp_tablename(3)."
+  },
   {"mcarrays", (PyCFunction)gdpy_dirfile_mcarrays, METH_VARARGS | METH_KEYWORDS,
     "mcarrays(parent, return_type [, as_list])\n\n"
       "Retrieve all CARRAY metafields, and their values, for the parent\n"
@@ -2338,8 +3136,9 @@ static PyMethodDef gdpy_dirfile_methods[] = {
     METH_VARARGS | METH_KEYWORDS,
     "mvector_list(parent)\n\n"
       "Retrieve a list of all vector type metafields (that is: BIT, DIVIDE,\n"
-      "LINCOM, LINTERP, MULTIPLY, PHASE, POLYNOM, RECIP, and SBIT\n"
-      "metafields) for the parent field 'parent'.  See gd_mvector_list(3)."
+      "LINCOM, LINTERP, MPLEX, MULTIPLY, PHASE, POLYNOM, RECIP, SBIT, and\n"
+      "WINDOW metafields) for the parent field 'parent'.  See\n"
+      "gd_mvector_list(3)."
   },
   {"native_type", (PyCFunction)gdpy_dirfile_getnativetype,
     METH_VARARGS | METH_KEYWORDS,
@@ -2359,6 +3158,17 @@ static PyMethodDef gdpy_dirfile_methods[] = {
       "identically, but returns a numeric data type code.  See\n"
       "gd_native_type(3)."
   },
+  {"nentries", (PyCFunction)gdpy_dirfile_nentries, METH_VARARGS | METH_KEYWORDS,
+    "nentries([parent, type, flags])\n\n"
+      "Return a count of entries in the database.  If 'parent' is given,\n"
+      "metafields under 'parent' will be considered, otherwise top-level\n"
+      "fields are counted.  If given, 'type' should be either one of the\n"
+      "the pygetdata.*_ENTRY symbols, or else one of the special\n"
+      "pygetdata.*_ENTRIES symbols; if not given, 'type' defaults to\n"
+      "pygetdata.ALL_ENTRIES.  If given 'flags' should be a bitwise or'd\n"
+      "collection of zero or more of the pygetdata.ENTRIES_* flags.\n"
+      "See gd_nentries(3)."
+  },
   {"nfields", (PyCFunction)gdpy_dirfile_getnfields,
     METH_VARARGS | METH_KEYWORDS,
     "nfields([entry_type])\n\n"
@@ -2383,14 +3193,16 @@ static PyMethodDef gdpy_dirfile_methods[] = {
     METH_VARARGS | METH_KEYWORDS,
     "nmvectors(parent)\n\n"
       "Return the number of vector type metafields (that is: BIT, DIVIDE,\n"
-      "LINCOM, LINTERP, MULTIPLY, PHASE, POLYNOM, RECIP, and SBIT\n"
-      "metafields) for the parent field 'parent'.  See gd_nmvectors(3)."
+      "LINCOM, LINTERP, MPLEX, MULTIPLY, PHASE, POLYNOM, RECIP, SBIT, and\n"
+      "WINDOW metafields) for the parent field 'parent'.  See\n"
+      "gd_nmvectors(3)."
   },
   {"nvectors", (PyCFunction)gdpy_dirfile_getnvectors, METH_NOARGS,
     "nvectors()\n\n"
       "Return the number of vector type fields (that is: BIT, DIVIDE,\n"
-      "INDEX, LINCOM, LINTERP, MULTIPLY, PHASE, POLYNOM, RAW, RECIP, and\n"
-      "SBIT fields) defined in the database.  See gd_nvectors(3)."
+      "INDEX, LINCOM, LINTERP, MPLEX, MULTIPLY, PHASE, POLYNOM, RAW, RECIP,\n"
+      "SBIT, and WINDOW fields) defined in the database.  See\n"
+      "gd_nvectors(3)."
   },
   {"raw_filename", (PyCFunction)gdpy_dirfile_getrawfilename,
     METH_VARARGS | METH_KEYWORDS,
@@ -2419,17 +3231,20 @@ static PyMethodDef gdpy_dirfile_methods[] = {
   { "vector_list", (PyCFunction)gdpy_dirfile_getvectorlist, METH_NOARGS,
     "vector_list()\n\n"
       "Retrieve a list of all vector type fields (that is: BIT, DIVIDE,\n"
-      "INDEX, LINCOM, LINTERP, MULTIPLY, PHASE, POLYNOM, RAW, RECIP, and\n"
-      "SBIT metafields) defined in the database.  See gd_vector_list(3)."
+      "INDEX, LINCOM, LINTERP, MPLEX, MULTIPLY, PHASE, POLYNOM, RAW, RECIP,\n"
+      "SBIT, and WINDOW metafields) defined in the database.  See\n"
+      "gd_vector_list(3)."
   },
   {"include", (PyCFunction)gdpy_dirfile_include, METH_VARARGS | METH_KEYWORDS,
-    "include(filename [, fragment_index, flags])\n\n"
+    "include(filename [, fragment_index, flags, prefix, suffix])\n\n"
       "Add (and possibly create) a new format file fragment specified by\n"
       "'filename' to the database, as an include in the existing fragment\n"
       "indexed by 'fragment_index'.  If 'fragment_index' is not given,\n"
-      "zero is assumed (ie. the primary format file).  If flags is given,\n"
+      "zero is assumed (ie. the primary format file).  If 'flags' is given,\n"
       "it should be a bitwise or'd collection of flags listed in the\n"
-      "gd_include manual page.  See gd_include(3)."
+      "gd_include manual page.  If 'prefix' or 'suffix' are given, they\n"
+      "will be applied to the field codes defined in the file.  See\n"
+      "gd_include_affix(3)."
   },
   {"madd", (PyCFunction)gdpy_dirfile_madd, METH_VARARGS | METH_KEYWORDS,
     "madd(entry, parent)\n\n"
@@ -2511,11 +3326,19 @@ static PyMethodDef gdpy_dirfile_methods[] = {
       "'field_code'.  See gd_put_string(3)."
   },
   {"rename", (PyCFunction)gdpy_dirfile_rename, METH_VARARGS | METH_KEYWORDS,
-    "rename(old_code, new_name [, move_data])\n\n"
+    "rename(old_code, new_name [, flags])\n\n"
       "Change the name of the field specified by 'old_code' to 'new_name'.\n"
-      "If 'move_data' is given and is non-zero, and if 'old_code' specifies\n"
-      "a RAW field, the file on disk will also be renamed accordingly.\n"
-      "See gd_rename(3)."
+      "If 'flags' is given and is non-zero, it should be a bitwise or'd\n"
+      "collection of the pygetdat.REN_* symbols.  See gd_rename(3)."
+  },
+  {"seek", (PyCFunction)gdpy_dirfile_seek, METH_VARARGS | METH_KEYWORDS,
+    "seek(field_code, flags [, frame_num, sample_num])\n\n"
+      "Set the field pointer of the field specified by 'field_code'.  The\n"
+      "'frame_num' and 'sample_num' parameters indicate desired position.\n"
+      "If they are both omitted, the field pointer is set to sample zero.\n"
+      "The 'flags' parameter must contain one of pygetdata.SEEK_SET,\n"
+      "pygetdata.SEEK_CUR and pygetdata.SEEK_END, which may be bitwise or'd\n"
+      "with pygetdata.SEEK_PAD.  See gd_seek(3)."
   },
   {"set_callback", (PyCFunction)gdpy_dirfile_callback,
     METH_VARARGS | METH_KEYWORDS,
@@ -2528,6 +3351,15 @@ static PyMethodDef gdpy_dirfile_methods[] = {
       "handler, or None, if no such object is needed.  See\n"
       "gd_parser_callback(3)."
   },
+  {"tell", (PyCFunction)gdpy_dirfile_tell, METH_VARARGS | METH_KEYWORDS,
+    "tell(field_code)\n\n"
+      "Report the current position of the field pointer of 'field_code'.\n"
+      "See gd_tell(3)."
+  },
+  {"unhide", (PyCFunction)gdpy_dirfile_unhide, METH_VARARGS | METH_KEYWORDS,
+    "unhide(field_code)\n\n"
+      "Clears the hidden flag on the specified field.  See gd_unhide(3)."
+  },
   {"uninclude", (PyCFunction)gdpy_dirfile_uninclude,
     METH_VARARGS | METH_KEYWORDS,
     "uninclude(fragment_index [, del])\n\n"
@@ -2542,6 +3374,93 @@ static PyMethodDef gdpy_dirfile_methods[] = {
       "reading and writing.  Throws an error if it is not.  See\n"
       "gd_validate(3)."
   },
+  {"sync", (PyCFunction)gdpy_dirfile_sync, METH_VARARGS | METH_KEYWORDS,
+    "sync([field_code])\n\n"
+      "Flush pending writes to the specified field to disk.  This does\n"
+      "not flush pending metadata changes.  For that, use metaflush.\n"
+      "However, if field_code is omitted, all data *and* metadata will be\n"
+      "written to disk.  See gd_sync(3)."
+  },
+  {"raw_close", (PyCFunction)gdpy_dirfile_raw_close,
+    METH_VARARGS | METH_KEYWORDS,
+    "raw_close([field_code])\n\n"
+      "Close any open raw data files associated with field_code, freeing\n"
+      "resources which may be used for other purposes.  If field_code is\n"
+      "omitted, all open raw data files are closed.  See gd_raw_close(3)."
+  },
+  {"naliases", (PyCFunction)gdpy_dirfile_naliases, METH_VARARGS | METH_KEYWORDS,
+    "naliases(field_code)\n\n"
+      "This function returns the number of aliases defined for the specified\n"
+      "field.  If field_code is valid, this will be at least one.  See\n"
+      "gd_naliases(3)."
+  },
+  {"move_alias", (PyCFunction)gdpy_dirfile_movealias,
+    METH_VARARGS | METH_KEYWORDS,
+    "move_alias(field_code, new_fragment)\n\n"
+      "This moves the alias specified by 'field_code' to the fragment\n"
+      "indexed by 'new_fragment'.  See gd_move_alias(3)."
+  },
+  {"delete_alias", (PyCFunction)gdpy_dirfile_deletealias,
+    METH_VARARGS | METH_KEYWORDS,
+    "delete_alias(field_code[, flags])\n\n"
+      "Delete the alias 'field_code' from the database.  If 'flags' is\n"
+      "omitted, it is assumed to be zero.  Otherwise, 'flags' should be a\n"
+      "bitwise or'd collection of the pygetdata.DEL_* symbols, whose\n"
+      "meanings are described in the gd_delete manual page.  See\n"
+      "gd_delete_alias(3)."
+  },
+  {"alias_target", (PyCFunction)gdpy_dirfile_aliastarget,
+    METH_VARARGS | METH_KEYWORDS,
+    "alias_target(field_code)\n\n"
+      "Returns the target of the alias specified by 'field_code'.\n"
+      "See gd_alias_target(3)."
+  },
+  {"aliases", (PyCFunction)gdpy_dirfile_aliaslist, METH_VARARGS | METH_KEYWORDS,
+    "aliases(field_code)\n\n"
+      "Returns a list of aliases for 'field_code'.  If successful, the\n"
+      "list returned will always contain at least one entry, field_code\n"
+      "itself.  See gd_alias_list(3)."
+  },
+  {"add_alias", (PyCFunction)gdpy_dirfile_addalias,
+    METH_VARARGS | METH_KEYWORDS,
+    "add_alias(field_code, target [, fragment_index])\n\n"
+      "Adds a new alias called 'field_code' pointing to 'target' to the\n"
+      "fragment indexed by 'fragment_index', which defaults to 0 if not\n"
+      "given.  See gd_add_alias(3)."
+  },
+  {"madd_alias", (PyCFunction)gdpy_dirfile_maddalias,
+    METH_VARARGS | METH_KEYWORDS,
+    "add_alias(parent, field_code, target)\n\n"
+      "Adds a new alias called 'field_code' pointing to 'target' as a\n"
+      "metalias under 'parent'.  See gd_madd_alias(3)."
+  },
+  {"strtok", (PyCFunction)gdpy_dirfile_strtok, METH_VARARGS | METH_KEYWORDS,
+    "strtok([string])\n\n"
+      "If 'string' is given, runs the GetData tokeniser on 'string' and\n"
+      "returns the first token.  If 'string' is not given, returns\n"
+      "subsequent tokens (one per call) of the last string that was\n"
+      "provided.  Note: an error will result if the string being parsed\n"
+      "goes out of scope.  See gd_strtok(3)."
+  },
+  {"desync", (PyCFunction)gdpy_dirfile_desync, METH_VARARGS | METH_KEYWORDS,
+    "desync([flags])\n\n"
+      "Returns non-zero if the metadata on disk has changed since the\n"
+      "dirfile was opened, and optionally automatically reloads it.  If\n"
+      "given, flags should be a bitwise or'd  collection of the\n"
+      "pygetdata.DESYNC_... flags.  See gd_desync(3)."
+  },
+  {"entry_list", (PyCFunction)gdpy_dirfile_entrylist,
+    METH_VARARGS | METH_KEYWORDS,
+    "entry_list([parent, type, flags])\n\n"
+      "Return a list of entry names in the database.  If 'parent' is\n"
+      "given metafields under 'parent' will be considered, otherwise\n"
+      "top-level entries are returned.  If given, 'type' should be either\n"
+      "one of the the pygetdata.*_ENTRY symbols, or else one of the\n"
+      "special pygetdata.*_ENTRIES symbols; if not given, 'type' defaults\n"
+      "to pygetdata.ALL_ENTRIES.  If given 'flags' should be a bitwise\n"
+      "or'd collection of zero or more of the pygetdata.ENTRIES_* flags.\n"
+      "See gd_entry_list(3)."
+  },
   { NULL, NULL, 0, NULL }
 };
 
diff --git a/bindings/python/pyentry.c b/bindings/python/pyentry.c
index 6883516..149db10 100644
--- a/bindings/python/pyentry.c
+++ b/bindings/python/pyentry.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2009, 2010 D. V. Wiebe
+/* Copyright (C) 2009-2013 D. V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,7 +21,7 @@
 #define NO_IMPORT_ARRAY
 #include "pygetdata.h"
 
-static const char* gdpy_entry_type_names[] = 
+static const char *gdpy_entry_type_names[] =
 {
   "NO_ENTRY",       /* 0x00 */
   "RAW_ENTRY",      /* 0x01 */
@@ -35,8 +35,8 @@ static const char* gdpy_entry_type_names[] =
   "SBIT_ENTRY",     /* 0x09 */
   "DIVIDE_ENTRY",   /* 0x0A */
   "RECIP_ENTRY",    /* 0x0B */
-  NULL,             /* 0x0C - unused */
-  NULL,             /* 0x0D - unused */
+  "WINDOW_ENTRY",   /* 0x0C */
+  "MPLEX_ENTRY",    /* 0x0D */
   NULL,             /* 0x0E - unused */
   NULL,             /* 0x0F - unused */
   "CONST_ENTRY",    /* 0x10 */
@@ -45,10 +45,13 @@ static const char* gdpy_entry_type_names[] =
 };
 
 /* Entry */
-static char* gdpy_dup_pystring(PyObject* obj)
+static char *gdpy_dup_pystring(PyObject *obj)
 {
+  char *s;
+
   dtrace("%p", obj);
-  char* s = PyString_AsString(obj);
+
+  s = PyString_AsString(obj);
 
   if (s != NULL) {
     s = strdup(s);
@@ -61,7 +64,7 @@ static char* gdpy_dup_pystring(PyObject* obj)
   return s;
 }
 
-static void gdpy_entry_delete(struct gdpy_entry_t* self)
+static void gdpy_entry_delete(struct gdpy_entry_t *self)
 {
   dtrace("%p", self);
 
@@ -71,12 +74,14 @@ static void gdpy_entry_delete(struct gdpy_entry_t* self)
   dreturnvoid();
 }
 
-static PyObject* gdpy_entry_create(PyTypeObject *type, PyObject *args,
+static PyObject *gdpy_entry_create(PyTypeObject *type, PyObject *args,
     PyObject *keys)
 {
+  struct gdpy_entry_t *self;
+
   dtrace("%p, %p, %p", type, args, keys);
 
-  struct gdpy_entry_t *self = (struct gdpy_entry_t*)type->tp_alloc(type, 0);
+  self = (struct gdpy_entry_t*)type->tp_alloc(type, 0);
 
   if (self) {
     self->E = NULL;
@@ -86,42 +91,76 @@ static PyObject* gdpy_entry_create(PyTypeObject *type, PyObject *args,
   return (PyObject*)self;
 }
 
-static void gdpy_set_scalar_from_pyobj(PyObject* pyobj, gd_type_t type,
-    char** scalar, void* data)
+static void gdpy_set_scalar_from_pyobj(PyObject *pyobj, gd_type_t type,
+    char **scalar, void *data)
 {
   dtrace("%p, %x, %p, %p", pyobj, type, scalar, data);
+  /* FIXME */
 
   if (PyString_Check(pyobj))
     *scalar = gdpy_dup_pystring(pyobj);
   else {
     *scalar = NULL;
-    if (type == GD_INT64)
-      *(int64_t*)data = (int64_t)PyLong_AsLongLong(pyobj);
-    else if (type & GD_COMPLEX128)
-      *(double complex*)data = gdpy_as_complex(pyobj);
-    else if (type & GD_FLOAT64)
-      *(double*)data = PyFloat_AsDouble(pyobj);
-    else if (type & GD_INT16)
-      *(int16_t*)data = PyLong_AsUnsignedLong(pyobj);
-    else if (type & GD_UINT16)
-      *(uint16_t*)data = PyLong_AsUnsignedLong(pyobj);
+    switch (type) {
+      case GD_UINT8:
+        *(uint8_t*)data = (uint8_t)PyInt_AsUnsignedLongMask(pyobj);
+        break;
+      case GD_INT8:
+        *(int8_t*)data = (int8_t)PyInt_AsLong(pyobj);
+        break;
+      case GD_UINT16:
+        *(uint16_t*)data = (uint16_t)PyInt_AsUnsignedLongMask(pyobj);
+        break;
+      case GD_INT16:
+        *(int16_t*)data = (int16_t)PyInt_AsLong(pyobj);
+        break;
+      case GD_UINT32:
+        *(uint32_t*)data = (uint32_t)PyLong_AsUnsignedLong(pyobj);
+        break;
+      case GD_INT32:
+        *(int32_t*)data = (int32_t)PyLong_AsLong(pyobj);
+        break;
+      case GD_UINT64:
+        if (PyLong_Check(pyobj))
+          *(uint64_t*)data = PyLong_AsUnsignedLongLong(pyobj);
+        else
+          *(uint64_t*)data = PyInt_AsUnsignedLongLongMask(pyobj);
+        break;
+      case GD_INT64:
+        *(int64_t*)data = (int64_t)PyLong_AsLongLong(pyobj);
+        break;
+      case GD_FLOAT32:
+        *(float*)data = (float)PyFloat_AsDouble(pyobj);
+        break;
+      case GD_FLOAT64:
+        *(double*)data = PyFloat_AsDouble(pyobj);
+        break;
+      case GD_COMPLEX64:
+        gdpy_as_complex((float*)data, pyobj);
+        break;
+      case GD_COMPLEX128:
+        gdpy_as_complex((double*)data, pyobj);
+        break;
+      default:
+        PyErr_Format(PyExc_RuntimeError,
+              "unexpected field type (%x) inside %s", type, __func__);
+    }
   }
 
   dreturnvoid();
 }
 
-static void gdpy_set_entry_from_tuple(gd_entry_t *E, PyObject* tuple,
-    const char* name)
+static void gdpy_set_entry_from_tuple(gd_entry_t *E, PyObject *tuple,
+    const char *name)
 {
   PyObject *parm1;
   PyObject *parm2;
   PyObject *parm3;
   PyObject *obj;
-  int i, count;
+  int i, count, size, min;
 
   dtrace("%p, %p, \"%s\"", E, tuple, name);
 
-  int min;
   switch (E->field_type)
   {
     case GD_INDEX_ENTRY:
@@ -146,6 +185,10 @@ static void gdpy_set_entry_from_tuple(gd_entry_t *E, PyObject* tuple,
     case GD_LINCOM_ENTRY:
       min = 3;
       break;
+    case GD_WINDOW_ENTRY:
+    case GD_MPLEX_ENTRY:
+      min = 4;
+      break;
     default:
       PyErr_Format(PyExc_TypeError, "%s: unrecognised field type", name);
       dreturnvoid();
@@ -157,7 +200,7 @@ static void gdpy_set_entry_from_tuple(gd_entry_t *E, PyObject* tuple,
     return;
   }
 
-  int size = PyTuple_Size(tuple);
+  size = PyTuple_Size(tuple);
   if (size < min) {
     PyErr_Format(PyExc_TypeError, "'pygetdata.entry' "
         "%s: needed %d entry parameters, but got only %d",
@@ -169,13 +212,13 @@ static void gdpy_set_entry_from_tuple(gd_entry_t *E, PyObject* tuple,
   switch (E->field_type)
   {
     case GD_RAW_ENTRY:
-      E->data_type = (gd_type_t)PyInt_AsLong(PyTuple_GetItem(tuple, 0));
-      if (GDPY_INVALID_TYPE(E->data_type))
+      E->EN(raw,data_type) = (gd_type_t)PyInt_AsLong(PyTuple_GetItem(tuple, 0));
+      if (GDPY_INVALID_TYPE(E->EN(raw,data_type)))
         PyErr_SetString(PyExc_ValueError,
             "'pygetdata.entry' invalid data type");
 
-      gdpy_set_scalar_from_pyobj(PyTuple_GetItem(tuple, 1), GD_UINT16,
-          &E->scalar[0], &E->spf);
+      gdpy_set_scalar_from_pyobj(PyTuple_GetItem(tuple, 1), GD_UINT_TYPE,
+          &E->scalar[0], &E->EN(raw,spf));
       break;
     case GD_LINCOM_ENTRY:
       parm1 = PyTuple_GetItem(tuple, 0);
@@ -190,7 +233,7 @@ static void gdpy_set_entry_from_tuple(gd_entry_t *E, PyObject* tuple,
         return;
       }
 
-      count = E->n_fields = PyTuple_Size(parm1);
+      count = E->EN(lincom,n_fields) = PyTuple_Size(parm1);
       if (count > GD_MAX_LINCOM)
         count = GD_MAX_LINCOM;
 
@@ -212,14 +255,14 @@ static void gdpy_set_entry_from_tuple(gd_entry_t *E, PyObject* tuple,
         obj = PyTuple_GetItem(parm2, i);
         if (PyComplex_Check(obj)) {
           E->comp_scal = 1;
-          E->cm[i] = gdpy_as_complex(obj);
+          gdpy_as_complex(gd_csp_(E->EN(lincom,cm)[i]), obj);
         } else if (E->comp_scal)
           gdpy_set_scalar_from_pyobj(obj, GD_COMPLEX128, &E->scalar[i],
-              &E->cm[i]);
+              &E->EN(lincom,cm)[i]);
         else {
           gdpy_set_scalar_from_pyobj(obj, GD_FLOAT64, &E->scalar[i],
-              &E->m[i]);
-          E->cm[i] = E->m[i];
+              &E->EN(lincom,m)[i]);
+          gd_rs2cs_(E->EN(lincom,cm)[i], E->EN(lincom,m)[i]);
         }
 
         if (PyErr_Occurred()) {
@@ -230,14 +273,14 @@ static void gdpy_set_entry_from_tuple(gd_entry_t *E, PyObject* tuple,
         obj = PyTuple_GetItem(parm3, i);
         if (PyComplex_Check(obj)) {
           E->comp_scal = 1;
-          E->cb[i] = gdpy_as_complex(obj);
+          gdpy_as_complex(gd_csp_(E->EN(lincom,cb)[i]), obj);
         } else if (E->comp_scal)
           gdpy_set_scalar_from_pyobj(obj, GD_COMPLEX128,
-              &E->scalar[i + GD_MAX_LINCOM], &E->cb[i]);
+              &E->scalar[i + GD_MAX_LINCOM], &E->EN(lincom,cb)[i]);
         else {
           gdpy_set_scalar_from_pyobj(obj, GD_FLOAT64,
-              &E->scalar[i + GD_MAX_LINCOM], &E->b[i]);
-          E->cb[i] = E->b[i];
+              &E->scalar[i + GD_MAX_LINCOM], &E->EN(lincom,b)[i]);
+          gd_rs2cs_(E->EN(lincom,cb)[i], E->EN(lincom,b)[i]);
         }
 
         if (PyErr_Occurred()) {
@@ -254,7 +297,7 @@ static void gdpy_set_entry_from_tuple(gd_entry_t *E, PyObject* tuple,
         return;
       }
 
-      E->table = gdpy_dup_pystring(PyTuple_GetItem(tuple, 1));
+      E->EN(linterp,table) = gdpy_dup_pystring(PyTuple_GetItem(tuple, 1));
 
       if (PyErr_Occurred()) {
         dreturnvoid();
@@ -270,13 +313,13 @@ static void gdpy_set_entry_from_tuple(gd_entry_t *E, PyObject* tuple,
         return;
       }
 
-      gdpy_set_scalar_from_pyobj(PyTuple_GetItem(tuple, 1), GD_INT16,
-          &E->scalar[0], &E->bitnum);
+      gdpy_set_scalar_from_pyobj(PyTuple_GetItem(tuple, 1), GD_INT_TYPE,
+          &E->scalar[0], &E->EN(bit,bitnum));
       if (size > 2)
-        gdpy_set_scalar_from_pyobj(PyTuple_GetItem(tuple, 2), GD_INT16,
-            &E->scalar[1], &E->numbits);
+        gdpy_set_scalar_from_pyobj(PyTuple_GetItem(tuple, 2), GD_INT_TYPE,
+            &E->scalar[1], &E->EN(bit,numbits));
       else {
-        E->numbits = 1;
+        E->EN(bit,numbits) = 1;
         E->scalar[1] = NULL;
       }
       break;
@@ -307,14 +350,14 @@ static void gdpy_set_entry_from_tuple(gd_entry_t *E, PyObject* tuple,
       obj = PyTuple_GetItem(tuple, 1);
       if (PyComplex_Check(obj)) {
         E->comp_scal = 1;
-        E->cdividend = gdpy_as_complex(obj);
+        gdpy_as_complex(gd_csp_(E->EN(recip,cdividend)), obj);
       } else if (E->comp_scal)
         gdpy_set_scalar_from_pyobj(obj, GD_COMPLEX128, &E->scalar[0],
-            &E->cdividend);
+            &E->EN(recip,cdividend));
       else {
         gdpy_set_scalar_from_pyobj(obj, GD_FLOAT64, &E->scalar[0],
-            &E->dividend);
-        E->cdividend = E->dividend;
+            &E->EN(recip,dividend));
+        gd_rs2cs_(E->EN(recip,cdividend), E->EN(recip,dividend));
       }
 
       if (PyErr_Occurred()) {
@@ -331,7 +374,7 @@ static void gdpy_set_entry_from_tuple(gd_entry_t *E, PyObject* tuple,
       }
 
       gdpy_set_scalar_from_pyobj(PyTuple_GetItem(tuple, 1), GD_INT64,
-          &E->scalar[0], &E->shift);
+          &E->scalar[0], &E->EN(phase,shift));
       break;
     case GD_POLYNOM_ENTRY:
       parm2 = PyTuple_GetItem(tuple, 1);
@@ -342,7 +385,7 @@ static void gdpy_set_entry_from_tuple(gd_entry_t *E, PyObject* tuple,
         return;
       }
 
-      E->poly_ord = count = PyTuple_Size(parm2) - 1;
+      E->EN(polynom,poly_ord) = count = PyTuple_Size(parm2) - 1;
       if (count > GD_MAX_POLYORD)
         count = GD_MAX_POLYORD;
 
@@ -357,15 +400,15 @@ static void gdpy_set_entry_from_tuple(gd_entry_t *E, PyObject* tuple,
         obj = PyTuple_GetItem(parm2, i);
         if (PyComplex_Check(obj)) {
           E->comp_scal = 1;
-          E->ca[i] = gdpy_as_complex(obj);
+          gdpy_as_complex(gd_csp_(E->EN(polynom,ca)[i]), obj);
           E->scalar[i] = NULL;
         } else if (E->comp_scal)
           gdpy_set_scalar_from_pyobj(obj, GD_COMPLEX128, &E->scalar[i],
-              &E->ca[i]);
+              &E->EN(polynom,ca)[i]);
         else {
           gdpy_set_scalar_from_pyobj(obj, GD_FLOAT64, &E->scalar[i],
-              &E->a[i]);
-          E->ca[i] = E->a[i];
+              &E->EN(polynom,a)[i]);
+          gd_rs2cs_(E->EN(polynom,ca)[i], E->EN(polynom,a)[i]);
         }
 
         if (PyErr_Occurred()) {
@@ -374,15 +417,83 @@ static void gdpy_set_entry_from_tuple(gd_entry_t *E, PyObject* tuple,
         }
       }
       break;
+    case GD_WINDOW_ENTRY:
+      E->in_fields[0] = gdpy_dup_pystring(PyTuple_GetItem(tuple, 0));
+
+      if (PyErr_Occurred()) {
+        dreturnvoid();
+        return;
+      }
+
+      E->in_fields[1] = gdpy_dup_pystring(PyTuple_GetItem(tuple, 1));
+
+      if (PyErr_Occurred()) {
+        dreturnvoid();
+        return;
+      }
+
+      E->EN(window,windop) =
+        (gd_windop_t)PyInt_AsLong(PyTuple_GetItem(tuple, 2));
+      if (GDPY_INVALID_OP(E->EN(window,windop)))
+        PyErr_SetString(PyExc_ValueError,
+            "'pygetdata.entry' invalid window operation");
+
+      obj = PyTuple_GetItem(tuple, 3);
+      switch (E->EN(window,windop)) {
+        case GD_WINDOP_EQ:
+        case GD_WINDOP_NE:
+          gdpy_set_scalar_from_pyobj(obj, GD_INT64, &E->scalar[0],
+              &E->EN(window,threshold).i);
+          break;
+        case GD_WINDOP_SET:
+        case GD_WINDOP_CLR:
+          gdpy_set_scalar_from_pyobj(obj, GD_UINT64, &E->scalar[0],
+              &E->EN(window,threshold).u);
+          break;
+        default:
+          gdpy_set_scalar_from_pyobj(obj, GD_FLOAT64, &E->scalar[0],
+              &E->EN(window,threshold).r);
+          break;
+      }
+
+      if (PyErr_Occurred()) {
+        dreturnvoid();
+        return;
+      }
+      break;
+    case GD_MPLEX_ENTRY:
+      E->in_fields[0] = gdpy_dup_pystring(PyTuple_GetItem(tuple, 0));
+
+      if (PyErr_Occurred()) {
+        dreturnvoid();
+        return;
+      }
+
+      E->in_fields[1] = gdpy_dup_pystring(PyTuple_GetItem(tuple, 1));
+
+      if (PyErr_Occurred()) {
+        dreturnvoid();
+        return;
+      }
+
+      gdpy_set_scalar_from_pyobj(PyTuple_GetItem(tuple, 2), GD_INT_TYPE,
+          &E->scalar[0], &E->EN(mplex,count_val));
+
+      gdpy_set_scalar_from_pyobj(PyTuple_GetItem(tuple, 3), GD_INT_TYPE,
+          &E->scalar[1], &E->EN(mplex,period));
+      break;
     case GD_CARRAY_ENTRY:
-      E->array_len = (size_t)PyLong_AsUnsignedLong(PyTuple_GetItem(tuple, 1));
+      E->EN(scalar,array_len) =
+        (size_t)PyLong_AsUnsignedLong(PyTuple_GetItem(tuple, 1));
       /* fallthrough */
     case GD_CONST_ENTRY:
-      E->const_type = (gd_type_t)PyInt_AsLong(PyTuple_GetItem(tuple, 0));
-      if (GDPY_INVALID_TYPE(E->const_type))
+      E->EN(scalar,const_type) =
+        (gd_type_t)PyInt_AsLong(PyTuple_GetItem(tuple, 0));
+      if (GDPY_INVALID_TYPE(E->EN(scalar,const_type)))
         PyErr_SetString(PyExc_ValueError,
             "'pygetdata.entry' invalid data type");
     case GD_NO_ENTRY:
+    case GD_ALIAS_ENTRY:
     case GD_STRING_ENTRY:
     case GD_INDEX_ENTRY:
       break;
@@ -391,15 +502,15 @@ static void gdpy_set_entry_from_tuple(gd_entry_t *E, PyObject* tuple,
   dreturnvoid();
 }
 
-static void gdpy_set_entry_from_dict(gd_entry_t *E, PyObject* parms,
-    const char* name)
+static void gdpy_set_entry_from_dict(gd_entry_t *E, PyObject *parms,
+    const char *name)
 {
-  dtrace("%p, %p, \"%s\"", E, parms, name);
-
-  PyObject* tuple = Py_None;
-  const char* key[3];
+  PyObject *tuple = Py_None;
+  const char *key[4];
   int i, size = 0;
 
+  dtrace("%p, %p, \"%s\"", E, parms, name);
+
   /* convert the dictionary to a tuple */
 
   /* variadic objects for entry types:
@@ -412,6 +523,8 @@ static void gdpy_set_entry_from_dict(gd_entry_t *E, PyObject* parms,
    * DIVIDE:   in_field1, in_field2        = 2
    * RECIP:    in_field, dividend          = 2
    * POLYNOM:  in_field, a                 = 2
+   * WINDOW:   in_field1, in_field2, op, thresh = 4
+   * MPLEX:    in_field1, in_field2, val, max = 4
    * CONST:    type                        = 1
    * CARRAY:   type, array_len             = 2
    * STRING:   (none)                      = 0
@@ -467,6 +580,20 @@ static void gdpy_set_entry_from_dict(gd_entry_t *E, PyObject* parms,
       key[1] = "a";
       size = 2;
       break;
+    case GD_WINDOW_ENTRY:
+      key[0] = "in_field1";
+      key[1] = "in_field2";
+      key[2] = "windop";
+      key[3] = "threshold";
+      size = 4;
+      break;
+    case GD_MPLEX_ENTRY:
+      key[0] = "in_field1";
+      key[1] = "in_field2";
+      key[2] = "count_val";
+      key[3] = "period";
+      size = 4;
+      break;
     case GD_CARRAY_ENTRY:
       key[0] = "type";
       key[1] = "array_len";
@@ -478,6 +605,7 @@ static void gdpy_set_entry_from_dict(gd_entry_t *E, PyObject* parms,
       break;
     case GD_STRING_ENTRY:
     case GD_NO_ENTRY:
+    case GD_ALIAS_ENTRY:
     case GD_INDEX_ENTRY:
       break;
   }
@@ -485,7 +613,7 @@ static void gdpy_set_entry_from_dict(gd_entry_t *E, PyObject* parms,
   if (size > 0) {
     tuple = PyTuple_New(size);
     for (i = 0; i < size; ++i) {
-      PyObject* o = PyDict_GetItemString(parms, key[i]);
+      PyObject *o = PyDict_GetItemString(parms, key[i]);
 
       if (o == NULL) {
         PyErr_Format(PyExc_KeyError, "%s: missing required parameter key %s",
@@ -494,6 +622,7 @@ static void gdpy_set_entry_from_dict(gd_entry_t *E, PyObject* parms,
         return;
       }
 
+      Py_INCREF(o);
       PyTuple_SET_ITEM(tuple, i, o);
     }
   }
@@ -503,15 +632,15 @@ static void gdpy_set_entry_from_dict(gd_entry_t *E, PyObject* parms,
   dreturnvoid();
 }
 
-static int gdpy_entry_init(struct gdpy_entry_t* self, PyObject *args,
+static int gdpy_entry_init(struct gdpy_entry_t *self, PyObject *args,
     PyObject *keys)
 {
-  dtrace("%p, %p, %p", self, args, keys);
-
   gd_entry_t E;
   char *keywords[] = {"type", "name", "fragment_index", "parameters", NULL};
-  PyObject* parms = NULL;
-  const char* field_name;
+  PyObject *parms = NULL;
+  const char *field_name;
+
+  dtrace("%p, %p, %p", self, args, keys);
 
   memset(&E, 0, sizeof(gd_entry_t));
 
@@ -538,7 +667,7 @@ static int gdpy_entry_init(struct gdpy_entry_t* self, PyObject *args,
     return -1;
   }
 
-  if (E.field_type == GD_STRING_ENTRY) 
+  if (E.field_type == GD_STRING_ENTRY)
     ; /* no parameters required */
   else if (parms == NULL)
     PyErr_Format(PyExc_TypeError, "pygetdata.entry.__init__() initialisation "
@@ -548,7 +677,7 @@ static int gdpy_entry_init(struct gdpy_entry_t* self, PyObject *args,
     gdpy_set_entry_from_dict(&E, parms, "pygetdata.entry.__init__");
   else if (PyTuple_Check(parms))
     gdpy_set_entry_from_tuple(&E, parms, "pygetdata.entry.__init__");
-  else 
+  else
     PyErr_SetString(PyExc_TypeError, "pygetdata.dirfile.__init__() argument 3 "
         "must be a tuple or dictionary");
 
@@ -564,7 +693,7 @@ static int gdpy_entry_init(struct gdpy_entry_t* self, PyObject *args,
       dreturn("%i", -1);
       return -1;
     }
-  } else 
+  } else
     gd_free_entry_strings(self->E);
 
   memcpy(self->E, &E, sizeof(gd_entry_t));
@@ -573,22 +702,26 @@ static int gdpy_entry_init(struct gdpy_entry_t* self, PyObject *args,
   return 0;
 }
 
-static PyObject* gdpy_entry_getname(struct gdpy_entry_t* self, void* closure)
+static PyObject *gdpy_entry_getname(struct gdpy_entry_t *self, void *closure)
 {
+  PyObject *pyobj;
+
   dtrace("%p, %p", self, closure);
 
-  PyObject* pyname = PyString_FromString(self->E->field);
+  pyobj = PyString_FromString(self->E->field);
 
-  dreturn("%p", pyname);
-  return pyname;
+  dreturn("%p", pyobj);
+  return pyobj;
 }
 
-static int gdpy_entry_setname(struct gdpy_entry_t* self, PyObject *value,
+static int gdpy_entry_setname(struct gdpy_entry_t *self, PyObject *value,
     void *closure)
 {
+  char *s;
+
   dtrace("%p, %p, %p", self, value, closure);
 
-  char *s = gdpy_dup_pystring(value);
+  s = gdpy_dup_pystring(value);
 
   if (PyErr_Occurred()) {
     dreturn("%i", -1);
@@ -602,23 +735,27 @@ static int gdpy_entry_setname(struct gdpy_entry_t* self, PyObject *value,
   return 0;
 }
 
-static PyObject* gdpy_entry_getfragment(struct gdpy_entry_t* self,
-    void* closure)
+static PyObject *gdpy_entry_getfragment(struct gdpy_entry_t *self,
+    void *closure)
 {
+  PyObject *pyobj;
+
   dtrace("%p, %p", self, closure);
 
-  PyObject* pyobj = PyInt_FromLong(self->E->fragment_index);
+  pyobj = PyInt_FromLong(self->E->fragment_index);
 
   dreturn("%p", pyobj);
   return pyobj;
 }
 
-static int gdpy_entry_setfragment(struct gdpy_entry_t* self, PyObject *value,
+static int gdpy_entry_setfragment(struct gdpy_entry_t *self, PyObject *value,
     void *closure)
 {
+  int t;
+
   dtrace("%p, %p, %p", self, value, closure);
 
-  int t = (int)PyInt_AsLong(value);
+  t = (int)PyInt_AsLong(value);
   if (PyErr_Occurred()) {
     dreturn("%i", -1);
     return -1;
@@ -630,42 +767,44 @@ static int gdpy_entry_setfragment(struct gdpy_entry_t* self, PyObject *value,
   return 0;
 }
 
-static PyObject* gdpy_entry_gettypename(struct gdpy_entry_t* self,
-    void* closure)
+static PyObject *gdpy_entry_gettypename(struct gdpy_entry_t *self,
+    void *closure)
 {
+  PyObject *pyobj;
+
   dtrace("%p, %p", self, closure);
 
-  PyObject* pyobj =
-    PyString_FromString(gdpy_entry_type_names[self->E->field_type]);
+  pyobj = PyString_FromString(gdpy_entry_type_names[self->E->field_type]);
 
   dreturn("%p", pyobj);
   return pyobj;
 }
 
-static PyObject* gdpy_entry_gettype(struct gdpy_entry_t* self, void* closure)
+static PyObject *gdpy_entry_gettype(struct gdpy_entry_t *self, void *closure)
 {
+  PyObject *pyobj;
+
   dtrace("%p, %p", self, closure);
 
-  PyObject* pyobj = PyInt_FromLong(self->E->field_type);
+  pyobj = PyInt_FromLong(self->E->field_type);
 
   dreturn("%p", pyobj);
   return pyobj;
 }
 
-static PyObject* gdpy_entry_getinfields(struct gdpy_entry_t* self,
-    void* closure)
+static PyObject *gdpy_entry_getinfields(struct gdpy_entry_t *self,
+    void *closure)
 {
   int i;
+  PyObject *tuple = NULL;
 
   dtrace("%p, %p", self, closure);
 
-  PyObject* tuple = NULL;
-
   switch (self->E->field_type)
   {
     case GD_LINCOM_ENTRY:
-      tuple = PyTuple_New(self->E->n_fields);
-      for (i = 0; i < self->E->n_fields; ++i)
+      tuple = PyTuple_New(self->E->EN(lincom,n_fields));
+      for (i = 0; i < self->E->EN(lincom,n_fields); ++i)
         PyTuple_SetItem(tuple, i, PyString_FromString(self->E->in_fields[i]));
       break;
     case GD_LINTERP_ENTRY:
@@ -678,10 +817,13 @@ static PyObject* gdpy_entry_getinfields(struct gdpy_entry_t* self,
       break;
     case GD_MULTIPLY_ENTRY:
     case GD_DIVIDE_ENTRY:
+    case GD_WINDOW_ENTRY:
+    case GD_MPLEX_ENTRY:
       tuple = Py_BuildValue("(ss)", self->E->in_fields[0],
           self->E->in_fields[1]);
       break;
     case GD_NO_ENTRY:
+    case GD_ALIAS_ENTRY:
     case GD_RAW_ENTRY:
     case GD_INDEX_ENTRY:
     case GD_CONST_ENTRY:
@@ -689,7 +831,7 @@ static PyObject* gdpy_entry_getinfields(struct gdpy_entry_t* self,
     case GD_STRING_ENTRY:
       PyErr_Format(PyExc_AttributeError, "'pygetdata.entry' "
           "attribute 'in_fields' not available for entry type %s",
-          gdpy_entry_type_names[self->E->field_type]); 
+          gdpy_entry_type_names[self->E->field_type]);
       break;
   }
 
@@ -697,11 +839,11 @@ static PyObject* gdpy_entry_getinfields(struct gdpy_entry_t* self,
   return tuple;
 }
 
-static int gdpy_entry_setinfields(struct gdpy_entry_t* self, PyObject *value,
+static int gdpy_entry_setinfields(struct gdpy_entry_t *self, PyObject *value,
     void *closure)
 {
   int i;
-  char*  s[GD_MAX_LINCOM];
+  char *s[GD_MAX_LINCOM];
 
   dtrace("%p, %p, %p", self, value, closure);
 
@@ -715,14 +857,14 @@ static int gdpy_entry_setinfields(struct gdpy_entry_t* self, PyObject *value,
         return -1;
       }
 
-      if (PyTuple_Size(value) < self->E->n_fields) {
+      if (PyTuple_Size(value) < self->E->EN(lincom,n_fields)) {
         PyErr_SetString(PyExc_TypeError, "'pygetdata.entry' "
             "not enough items in tuple for in_fields");
         dreturn("%i", -1);
         return -1;
       }
 
-      for (i = 0; i < self->E->n_fields; ++i)
+      for (i = 0; i < self->E->EN(lincom,n_fields); ++i)
         s[i] = gdpy_dup_pystring(PyTuple_GetItem(value, i));
 
       if (PyErr_Occurred()) {
@@ -730,7 +872,7 @@ static int gdpy_entry_setinfields(struct gdpy_entry_t* self, PyObject *value,
         return -1;
       }
 
-      for (i = 0; i < self->E->n_fields; ++i) {
+      for (i = 0; i < self->E->EN(lincom,n_fields); ++i) {
         free(self->E->in_fields[i]);
         self->E->in_fields[i] = s[i];
       }
@@ -763,6 +905,8 @@ static int gdpy_entry_setinfields(struct gdpy_entry_t* self, PyObject *value,
       break;
     case GD_MULTIPLY_ENTRY:
     case GD_DIVIDE_ENTRY:
+    case GD_WINDOW_ENTRY:
+    case GD_MPLEX_ENTRY:
       if (!PyTuple_Check(value)) {
         PyErr_SetString(PyExc_TypeError, "'pygetdata.entry' "
             "attribute 'in_fields' must be a tuple");
@@ -791,6 +935,7 @@ static int gdpy_entry_setinfields(struct gdpy_entry_t* self, PyObject *value,
       }
       break;
     case GD_NO_ENTRY:
+    case GD_ALIAS_ENTRY:
     case GD_RAW_ENTRY:
     case GD_INDEX_ENTRY:
     case GD_CONST_ENTRY:
@@ -798,7 +943,7 @@ static int gdpy_entry_setinfields(struct gdpy_entry_t* self, PyObject *value,
     case GD_STRING_ENTRY:
       PyErr_Format(PyExc_AttributeError, "'pygetdata.entry' "
           "attribute 'in_fields' not available for entry type %s",
-          gdpy_entry_type_names[self->E->field_type]); 
+          gdpy_entry_type_names[self->E->field_type]);
       break;
   }
 
@@ -806,25 +951,24 @@ static int gdpy_entry_setinfields(struct gdpy_entry_t* self, PyObject *value,
   return 0;
 }
 
-static PyObject* gdpy_entry_getdatatypename(struct gdpy_entry_t* self,
-    void* closure)
+static PyObject *gdpy_entry_getdatatypename(struct gdpy_entry_t *self,
+    void *closure)
 {
-  PyObject* obj = NULL;
-
+  PyObject *obj = NULL;
   int t = -1;
   char buffer[11];
 
   dtrace("%p, %p", self, closure);
 
   if (self->E->field_type == GD_RAW_ENTRY)
-    t = self->E->data_type;
+    t = self->E->EN(raw,data_type);
   else if (self->E->field_type == GD_CONST_ENTRY ||
       self->E->field_type == GD_CARRAY_ENTRY)
-    t = self->E->const_type;
+    t = self->E->EN(scalar,const_type);
   else
     PyErr_Format(PyExc_AttributeError, "'pygetdata.entry' "
         "attribute 'data_type_name' not available for entry type %s",
-        gdpy_entry_type_names[self->E->field_type]); 
+        gdpy_entry_type_names[self->E->field_type]);
 
   if (t != -1) {
     sprintf(buffer, "%s%i", (t & GD_COMPLEX) ? "COMPLEX" :
@@ -837,30 +981,32 @@ static PyObject* gdpy_entry_getdatatypename(struct gdpy_entry_t* self,
   return obj;
 }
 
-static PyObject* gdpy_entry_getdatatype(struct gdpy_entry_t* self,
-    void* closure)
+static PyObject *gdpy_entry_getdatatype(struct gdpy_entry_t *self,
+    void *closure)
 {
-  PyObject* obj = NULL;
+  PyObject *obj = NULL;
 
   dtrace("%p, %p", self, closure);
 
   if (self->E->field_type == GD_RAW_ENTRY)
-    obj = PyInt_FromLong(self->E->data_type);
+    obj = PyInt_FromLong(self->E->EN(raw,data_type));
   else if (self->E->field_type == GD_CONST_ENTRY ||
       self->E->field_type == GD_CARRAY_ENTRY)
-    obj = PyInt_FromLong(self->E->const_type);
+    obj = PyInt_FromLong(self->E->EN(scalar,const_type));
   else
     PyErr_Format(PyExc_AttributeError, "'pygetdata.entry' "
         "attribute 'data_type' not available for entry type %s",
-        gdpy_entry_type_names[self->E->field_type]); 
+        gdpy_entry_type_names[self->E->field_type]);
 
   dreturn("%p", obj);
   return obj;
 }
 
-static int gdpy_entry_setdatatype(struct gdpy_entry_t* self, PyObject *value,
+static int gdpy_entry_setdatatype(struct gdpy_entry_t *self, PyObject *value,
     void *closure)
 {
+  int t;
+
   dtrace("%p, %p, %p", self, value, closure);
 
   if (self->E->field_type != GD_RAW_ENTRY &&
@@ -869,12 +1015,12 @@ static int gdpy_entry_setdatatype(struct gdpy_entry_t* self, PyObject *value,
   {
     PyErr_Format(PyExc_AttributeError, "'pygetdata.entry' "
         "attribute 'data_type' not available for entry type %s",
-        gdpy_entry_type_names[self->E->field_type]); 
+        gdpy_entry_type_names[self->E->field_type]);
     dreturn("%i", -1);
     return -1;
   }
 
-  int t = PyInt_AsLong(value);
+  t = PyInt_AsLong(value);
   if (PyErr_Occurred()) {
     dreturn("%i", -1);
     return -1;
@@ -889,38 +1035,38 @@ static int gdpy_entry_setdatatype(struct gdpy_entry_t* self, PyObject *value,
   }
 
   if (self->E->field_type == GD_RAW_ENTRY)
-    self->E->data_type = (gd_type_t)t;
+    self->E->EN(raw,data_type) = (gd_type_t)t;
   else
-    self->E->const_type = (gd_type_t)t;
+    self->E->EN(scalar,const_type) = (gd_type_t)t;
 
   dreturn("%i", 0);
   return 0;
 }
 
-static PyObject* gdpy_entry_getspf(struct gdpy_entry_t* self, void* closure)
+static PyObject *gdpy_entry_getspf(struct gdpy_entry_t *self, void *closure)
 {
-  PyObject* obj = NULL;
+  PyObject *obj = NULL;
 
   dtrace("%p, %p", self, closure);
 
   if (self->E->field_type == GD_RAW_ENTRY) {
     if (self->E->scalar[0] == NULL)
-      obj = PyInt_FromLong(self->E->spf);
+      obj = PyInt_FromLong(self->E->EN(raw,spf));
     else
       obj = PyString_FromString(self->E->scalar[0]);
   } else
     PyErr_Format(PyExc_AttributeError, "'pygetdata.entry' "
         "attribute 'spf' not available for entry type %s",
-        gdpy_entry_type_names[self->E->field_type]); 
+        gdpy_entry_type_names[self->E->field_type]);
 
   dreturn("%p", obj);
   return obj;
 }
 
-static int gdpy_entry_setspf(struct gdpy_entry_t* self, PyObject *value,
+static int gdpy_entry_setspf(struct gdpy_entry_t *self, PyObject *value,
     void *closure)
 {
-  gd_spf_t spf;
+  unsigned int spf;
   char *scalar;
 
   dtrace("%p, %p, %p", self, value, closure);
@@ -928,12 +1074,12 @@ static int gdpy_entry_setspf(struct gdpy_entry_t* self, PyObject *value,
   if (self->E->field_type != GD_RAW_ENTRY) {
     PyErr_Format(PyExc_AttributeError, "'pygetdata.entry' "
         "attribute 'spf' not available for entry type %s",
-        gdpy_entry_type_names[self->E->field_type]); 
+        gdpy_entry_type_names[self->E->field_type]);
     dreturn("%i", -1);
     return -1;
   }
 
-  gdpy_set_scalar_from_pyobj(value, GD_UINT16, &scalar, &spf);
+  gdpy_set_scalar_from_pyobj(value, GD_UINT_TYPE, &scalar, &spf);
 
   if (PyErr_Occurred()) {
     free(scalar);
@@ -943,31 +1089,31 @@ static int gdpy_entry_setspf(struct gdpy_entry_t* self, PyObject *value,
 
   free(self->E->scalar[0]);
   self->E->scalar[0] = scalar;
-  self->E->spf = spf;
+  self->E->EN(raw,spf) = spf;
 
   dreturn("%i", 0);
   return 0;
 }
 
-static PyObject* gdpy_entry_getarraylen(struct gdpy_entry_t* self,
-    void* closure)
+static PyObject *gdpy_entry_getarraylen(struct gdpy_entry_t *self,
+    void *closure)
 {
-  PyObject* obj = NULL;
+  PyObject *obj = NULL;
 
   dtrace("%p, %p", self, closure);
 
   if (self->E->field_type == GD_CARRAY_ENTRY)
-      obj = PyLong_FromUnsignedLong(self->E->array_len);
+      obj = PyLong_FromUnsignedLong(self->E->EN(scalar,array_len));
   else
     PyErr_Format(PyExc_AttributeError, "'pygetdata.entry' "
         "attribute 'array_len' not available for entry type %s",
-        gdpy_entry_type_names[self->E->field_type]); 
+        gdpy_entry_type_names[self->E->field_type]);
 
   dreturn("%p", obj);
   return obj;
 }
 
-static int gdpy_entry_setarraylen(struct gdpy_entry_t* self, PyObject *value,
+static int gdpy_entry_setarraylen(struct gdpy_entry_t *self, PyObject *value,
     void *closure)
 {
   size_t array_len;
@@ -977,7 +1123,7 @@ static int gdpy_entry_setarraylen(struct gdpy_entry_t* self, PyObject *value,
   if (self->E->field_type != GD_CARRAY_ENTRY) {
     PyErr_Format(PyExc_AttributeError, "'pygetdata.entry' "
         "attribute 'array_len' not available for entry type %s",
-        gdpy_entry_type_names[self->E->field_type]); 
+        gdpy_entry_type_names[self->E->field_type]);
     dreturn("%i", -1);
     return -1;
   }
@@ -989,44 +1135,45 @@ static int gdpy_entry_setarraylen(struct gdpy_entry_t* self, PyObject *value,
     return -1;
   }
 
-  self->E->array_len = array_len;
+  self->E->EN(scalar,array_len) = array_len;
 
   dreturn("%i", 0);
   return 0;
 }
 
-static PyObject* gdpy_entry_getnfields(struct gdpy_entry_t* self, void* closure)
+static PyObject *gdpy_entry_getnfields(struct gdpy_entry_t *self, void *closure)
 {
-  PyObject* obj = NULL;
+  PyObject *obj = NULL;
 
   dtrace("%p, %p", self, closure);
 
   if (self->E->field_type == GD_LINCOM_ENTRY) {
-    obj = PyInt_FromLong(self->E->n_fields);
+    obj = PyInt_FromLong(self->E->EN(lincom,n_fields));
   } else
     PyErr_Format(PyExc_AttributeError, "'pygetdata.entry' "
         "attribute 'n_fields' not available for entry type %s",
-        gdpy_entry_type_names[self->E->field_type]); 
+        gdpy_entry_type_names[self->E->field_type]);
 
   dreturn("%p", obj);
   return obj;
 }
 
-static int gdpy_entry_setnfields(struct gdpy_entry_t* self, PyObject *value,
+static int gdpy_entry_setnfields(struct gdpy_entry_t *self, PyObject *value,
     void *closure)
 {
-  int i;
+  int i, n;
+
   dtrace("%p, %p, %p", self, value, closure);
 
   if (self->E->field_type != GD_LINCOM_ENTRY) {
     PyErr_Format(PyExc_AttributeError, "'pygetdata.entry' "
         "attribute 'n_fields' not available for entry type %s",
-        gdpy_entry_type_names[self->E->field_type]); 
+        gdpy_entry_type_names[self->E->field_type]);
     dreturn("%i", -1);
     return -1;
   }
 
-  int n = (int)PyInt_AsLong(value);
+  n = (int)PyInt_AsLong(value);
   if (PyErr_Occurred()) {
     dreturn("%i", -1);
     return -1;
@@ -1038,51 +1185,51 @@ static int gdpy_entry_setnfields(struct gdpy_entry_t* self, PyObject *value,
   }
 
   /* free extra terms */
-  for (i = n; i < self->E->n_fields; ++i)
+  for (i = n; i < self->E->EN(lincom,n_fields); ++i)
     free(self->E->in_fields[i]);
 
   /* initialise new terms */
-  for (i = self->E->n_fields; i < n; ++i) {
+  for (i = self->E->EN(lincom,n_fields); i < n; ++i) {
     self->E->in_fields[i] = strdup("");
-    self->E->m[i] = self->E->b[i] = 0;
+    self->E->EN(lincom,m)[i] = self->E->EN(lincom,b)[i] = 0;
   }
 
-  self->E->n_fields = n;
+  self->E->EN(lincom,n_fields) = n;
 
   dreturn("%i", 0);
   return 0;
 }
 
-static PyObject* gdpy_entry_getm(struct gdpy_entry_t* self, void* closure)
+static PyObject *gdpy_entry_getm(struct gdpy_entry_t *self, void *closure)
 {
   int i;
-  PyObject* obj = NULL;
+  PyObject *obj = NULL;
 
   dtrace("%p, %p", self, closure);
 
   if (self->E->field_type == GD_LINCOM_ENTRY) {
-    obj = PyTuple_New(self->E->n_fields);
-    for (i = 0; i < self->E->n_fields; ++i)
+    obj = PyTuple_New(self->E->EN(lincom,n_fields));
+    for (i = 0; i < self->E->EN(lincom,n_fields); ++i)
       PyTuple_SetItem(obj, i, (self->E->scalar[i] == NULL) ?
-          (self->E->comp_scal) ?  gdpy_from_complex(self->E->cm[i]) :
-          PyFloat_FromDouble(self->E->m[i]) :
+          (self->E->comp_scal) ?  gdpy_from_complex(self->E->EN(lincom,cm)[i]) :
+          PyFloat_FromDouble(self->E->EN(lincom,m)[i]) :
           PyString_FromString(self->E->scalar[i]));
   } else
     PyErr_Format(PyExc_AttributeError, "'pygetdata.entry' "
         "attribute 'm' not available for entry type %s",
-        gdpy_entry_type_names[self->E->field_type]); 
+        gdpy_entry_type_names[self->E->field_type]);
 
   dreturn("%p", obj);
   return obj;
 }
 
-static int gdpy_entry_setm(struct gdpy_entry_t* self, PyObject *value,
+static int gdpy_entry_setm(struct gdpy_entry_t *self, PyObject *value,
     void *closure)
 {
   int i;
   int comp_scal = 0;
   double m[GD_MAX_LINCOM];
-  double complex cm[GD_MAX_LINCOM];
+  GD_DCOMPLEXM(cm[GD_MAX_LINCOM]);
   char *scalar[GD_MAX_LINCOM];
 
   dtrace("%p, %p, %p", self, value, closure);
@@ -1090,7 +1237,7 @@ static int gdpy_entry_setm(struct gdpy_entry_t* self, PyObject *value,
   if (self->E->field_type != GD_LINCOM_ENTRY) {
     PyErr_Format(PyExc_AttributeError, "'pygetdata.entry' "
         "attribute 'm' not available for entry type %s",
-        gdpy_entry_type_names[self->E->field_type]); 
+        gdpy_entry_type_names[self->E->field_type]);
     dreturn("%i", -1);
     return -1;
   }
@@ -1102,25 +1249,26 @@ static int gdpy_entry_setm(struct gdpy_entry_t* self, PyObject *value,
     return -1;
   }
 
-  if (PyTuple_Size(value) < self->E->n_fields) {
+  if (PyTuple_Size(value) < self->E->EN(lincom,n_fields)) {
     PyErr_SetString(PyExc_TypeError, "'pygetdata.entry' "
         "not enough items in tuple for attribute 'm'");
     dreturn("%i", -1);
     return -1;
   }
 
-  for (i = 0; i < self->E->n_fields; ++i) {
+  for (i = 0; i < self->E->EN(lincom,n_fields); ++i) {
     PyObject *obj = PyTuple_GetItem(value, i);
     if (PyComplex_Check(obj)) {
       comp_scal = 1;
-      m[i] = (double)(cm[i] = gdpy_as_complex(obj));
+      gdpy_as_complex(gd_csp_(cm[i]), obj);
+      m[i] = creal(cm[i]);
       scalar[i] = NULL;
     } else if (comp_scal) {
       gdpy_set_scalar_from_pyobj(obj, GD_COMPLEX128, scalar + i, cm + i);
       m[i] = creal(cm[i]);
     } else {
       gdpy_set_scalar_from_pyobj(obj, GD_FLOAT64, scalar + i, m + i);
-      cm[i] = m[i];
+      gd_rs2cs_(cm[i], m[i]);
     }
   }
 
@@ -1131,11 +1279,12 @@ static int gdpy_entry_setm(struct gdpy_entry_t* self, PyObject *value,
     return -1;
   }
 
-  for (i = 0; i < self->E->n_fields; ++i) {
-    if (cimag(self->E->cb[i]))
+  for (i = 0; i < self->E->EN(lincom,n_fields); ++i) {
+    /* check whether the corresponding cb is complex */
+    if (!comp_scal && cimag(self->E->EN(lincom,cb)[i]))
       comp_scal = 1;
-    self->E->cm[i] = cm[i];
-    self->E->m[i] = m[i];
+    gd_cs2cs_(self->E->EN(lincom,cm)[i], cm[i]);
+    self->E->EN(lincom,m)[i] = m[i];
     free(self->E->scalar[i]);
     self->E->scalar[i] = scalar[i];
   }
@@ -1145,36 +1294,36 @@ static int gdpy_entry_setm(struct gdpy_entry_t* self, PyObject *value,
   return 0;
 }
 
-static PyObject* gdpy_entry_getb(struct gdpy_entry_t* self, void* closure)
+static PyObject *gdpy_entry_getb(struct gdpy_entry_t *self, void *closure)
 {
   int i;
-  PyObject* obj = NULL;
+  PyObject *obj = NULL;
 
   dtrace("%p, %p", self, closure);
 
   if (self->E->field_type == GD_LINCOM_ENTRY) {
-    obj = PyTuple_New(self->E->n_fields);
-    for (i = 0; i < self->E->n_fields; ++i)
+    obj = PyTuple_New(self->E->EN(lincom,n_fields));
+    for (i = 0; i < self->E->EN(lincom,n_fields); ++i)
       PyTuple_SetItem(obj, i, (self->E->scalar[i + GD_MAX_LINCOM] == NULL) ?
-          (self->E->comp_scal) ?  gdpy_from_complex(self->E->cb[i]) :
-          PyFloat_FromDouble(self->E->b[i]) :
+          (self->E->comp_scal) ?  gdpy_from_complex(self->E->EN(lincom,cb)[i]) :
+          PyFloat_FromDouble(self->E->EN(lincom,b)[i]) :
           PyString_FromString(self->E->scalar[i + GD_MAX_LINCOM]));
   } else
     PyErr_Format(PyExc_AttributeError, "'pygetdata.entry' "
         "attribute 'b' not available for entry type %s",
-        gdpy_entry_type_names[self->E->field_type]); 
+        gdpy_entry_type_names[self->E->field_type]);
 
   dreturn("%p", obj);
   return obj;
 }
 
-static int gdpy_entry_setb(struct gdpy_entry_t* self, PyObject *value,
+static int gdpy_entry_setb(struct gdpy_entry_t *self, PyObject *value,
     void *closure)
 {
   int i;
   int comp_scal = 0;
   double b[GD_MAX_LINCOM];
-  double complex cb[GD_MAX_LINCOM];
+  GD_DCOMPLEXM(cb[GD_MAX_LINCOM]);
   char *scalar[GD_MAX_LINCOM];
 
   dtrace("%p, %p, %p", self, value, closure);
@@ -1182,7 +1331,7 @@ static int gdpy_entry_setb(struct gdpy_entry_t* self, PyObject *value,
   if (self->E->field_type != GD_LINCOM_ENTRY) {
     PyErr_Format(PyExc_AttributeError, "'pygetdata.entry' "
         "attribute 'b' not available for entry type %s",
-        gdpy_entry_type_names[self->E->field_type]); 
+        gdpy_entry_type_names[self->E->field_type]);
     dreturn("%i", -1);
     return -1;
   }
@@ -1194,25 +1343,26 @@ static int gdpy_entry_setb(struct gdpy_entry_t* self, PyObject *value,
     return -1;
   }
 
-  if (PyTuple_Size(value) < self->E->n_fields) {
+  if (PyTuple_Size(value) < self->E->EN(lincom,n_fields)) {
     PyErr_SetString(PyExc_TypeError, "'pygetdata.entry' "
         "not enough items in tuple for attribute 'b'");
     dreturn("%i", -1);
     return -1;
   }
 
-  for (i = 0; i < self->E->n_fields; ++i) {
+  for (i = 0; i < self->E->EN(lincom,n_fields); ++i) {
     PyObject *obj = PyTuple_GetItem(value, i);
     if (PyComplex_Check(obj)) {
       comp_scal = 1;
-      b[i] = (double)(cb[i] = gdpy_as_complex(obj));
+      gdpy_as_complex(gd_csp_(cb[i]), obj);
+      b[i] = creal(cb[i]);
       scalar[i] = NULL;
     } else if (comp_scal) {
       gdpy_set_scalar_from_pyobj(obj, GD_COMPLEX128, scalar + i, cb + i);
       b[i] = creal(cb[i]);
     } else {
       gdpy_set_scalar_from_pyobj(obj, GD_FLOAT64, scalar + i, b + i);
-      cb[i] = b[i];
+      gd_rs2cs_(cb[i], b[i]);
     }
   }
 
@@ -1223,11 +1373,12 @@ static int gdpy_entry_setb(struct gdpy_entry_t* self, PyObject *value,
     return -1;
   }
 
-  for (i = 0; i < self->E->n_fields; ++i) {
-    if (cimag(self->E->cm[i]))
+  for (i = 0; i < self->E->EN(lincom,n_fields); ++i) {
+    /* check whether the corresponding cm is complex */
+    if (!comp_scal && cimag(self->E->EN(lincom,cm)[i]))
       comp_scal = 1;
-    self->E->cb[i] = cb[i];
-    self->E->b[i] = b[i];
+    gd_cs2cs_(self->E->EN(lincom,cb)[i], cb[i]);
+    self->E->EN(lincom,b)[i] = b[i];
     free(self->E->scalar[i + GD_MAX_LINCOM]);
     self->E->scalar[i + GD_MAX_LINCOM] = scalar[i];
   }
@@ -1237,23 +1388,24 @@ static int gdpy_entry_setb(struct gdpy_entry_t* self, PyObject *value,
   return 0;
 }
 
-static PyObject* gdpy_entry_gettable(struct gdpy_entry_t* self, void* closure)
+static PyObject *gdpy_entry_gettable(struct gdpy_entry_t *self, void *closure)
 {
+  PyObject *obj = NULL;
+
   dtrace("%p, %p", self, closure);
 
-  PyObject* obj = NULL;
   if (self->E->field_type == GD_LINTERP_ENTRY)
-    obj = PyString_FromString(self->E->table);
+    obj = PyString_FromString(self->E->EN(linterp,table));
   else
     PyErr_Format(PyExc_AttributeError, "'pygetdata.entry' "
         "attribute 'table' not available for entry type %s",
-        gdpy_entry_type_names[self->E->field_type]); 
+        gdpy_entry_type_names[self->E->field_type]);
 
   dreturn("%p", obj);
   return obj;
 }
 
-static int gdpy_entry_settable(struct gdpy_entry_t* self, PyObject *value,
+static int gdpy_entry_settable(struct gdpy_entry_t *self, PyObject *value,
     void *closure)
 {
   dtrace("%p, %p, %p", self, value, closure);
@@ -1266,12 +1418,12 @@ static int gdpy_entry_settable(struct gdpy_entry_t* self, PyObject *value,
       return -1;
     }
 
-    free(self->E->field);
-    self->E->field = s;
+    free(self->E->EN(linterp,table));
+    self->E->EN(linterp,table) = s;
   } else {
     PyErr_Format(PyExc_AttributeError, "'pygetdata.entry' "
         "attribute 'table' not available for entry type %s",
-        gdpy_entry_type_names[self->E->field_type]); 
+        gdpy_entry_type_names[self->E->field_type]);
     dreturn("%i", -1);
     return -1;
   }
@@ -1280,9 +1432,9 @@ static int gdpy_entry_settable(struct gdpy_entry_t* self, PyObject *value,
   return 0;
 }
 
-static PyObject* gdpy_entry_getbitnum(struct gdpy_entry_t* self, void* closure)
+static PyObject *gdpy_entry_getbitnum(struct gdpy_entry_t *self, void *closure)
 {
-  PyObject* obj = NULL;
+  PyObject *obj = NULL;
 
   dtrace("%p, %p", self, closure);
 
@@ -1290,19 +1442,19 @@ static PyObject* gdpy_entry_getbitnum(struct gdpy_entry_t* self, void* closure)
       self->E->field_type == GD_SBIT_ENTRY)
   {
     if (self->E->scalar[0] == NULL)
-      obj = PyInt_FromLong(self->E->bitnum);
+      obj = PyInt_FromLong(self->E->EN(bit,bitnum));
     else
       obj = PyString_FromString(self->E->scalar[0]);
   } else
     PyErr_Format(PyExc_AttributeError, "'pygetdata.entry' "
         "attribute 'bitnum' not available for entry type %s",
-        gdpy_entry_type_names[self->E->field_type]); 
+        gdpy_entry_type_names[self->E->field_type]);
 
   dreturn("%p", obj);
   return obj;
 }
 
-static int gdpy_entry_setbitnum(struct gdpy_entry_t* self, PyObject *value,
+static int gdpy_entry_setbitnum(struct gdpy_entry_t *self, PyObject *value,
     void *closure)
 {
   int bitnum;
@@ -1314,19 +1466,19 @@ static int gdpy_entry_setbitnum(struct gdpy_entry_t* self, PyObject *value,
   {
     PyErr_Format(PyExc_AttributeError, "'pygetdata.entry' "
         "attribute 'bitnum' not available for entry type %s",
-        gdpy_entry_type_names[self->E->field_type]); 
+        gdpy_entry_type_names[self->E->field_type]);
     dreturn("%i", -1);
     return -1;
   }
 
-  gdpy_set_scalar_from_pyobj(value, GD_INT16, &scalar, &bitnum);
+  gdpy_set_scalar_from_pyobj(value, GD_INT_TYPE, &scalar, &bitnum);
   if (PyErr_Occurred()) {
     free(scalar);
     dreturn("%i", -1);
     return -1;
   }
 
-  self->E->bitnum = (gd_bit_t)bitnum;
+  self->E->EN(bit,bitnum) = bitnum;
   free(self->E->scalar[0]);
   self->E->scalar[0] = scalar;
 
@@ -1334,9 +1486,9 @@ static int gdpy_entry_setbitnum(struct gdpy_entry_t* self, PyObject *value,
   return 0;
 }
 
-static PyObject* gdpy_entry_getnumbits(struct gdpy_entry_t* self, void* closure)
+static PyObject *gdpy_entry_getnumbits(struct gdpy_entry_t *self, void *closure)
 {
-  PyObject* obj = NULL;
+  PyObject *obj = NULL;
 
   dtrace("%p, %p", self, closure);
 
@@ -1344,19 +1496,19 @@ static PyObject* gdpy_entry_getnumbits(struct gdpy_entry_t* self, void* closure)
       self->E->field_type == GD_SBIT_ENTRY)
   {
     if (self->E->scalar[1] == NULL)
-      obj = PyInt_FromLong(self->E->numbits);
+      obj = PyInt_FromLong(self->E->EN(bit,numbits));
     else
       obj = PyString_FromString(self->E->scalar[1]);
   } else
     PyErr_Format(PyExc_AttributeError, "'pygetdata.entry' "
         "attribute 'numbits' not available for entry type %s",
-        gdpy_entry_type_names[self->E->field_type]); 
+        gdpy_entry_type_names[self->E->field_type]);
 
   dreturn("%p", obj);
   return obj;
 }
 
-static int gdpy_entry_setnumbits(struct gdpy_entry_t* self, PyObject *value,
+static int gdpy_entry_setnumbits(struct gdpy_entry_t *self, PyObject *value,
     void *closure)
 {
   int numbits;
@@ -1369,19 +1521,19 @@ static int gdpy_entry_setnumbits(struct gdpy_entry_t* self, PyObject *value,
   {
     PyErr_Format(PyExc_AttributeError, "'pygetdata.entry' "
         "attribute 'numbits' not available for entry type %s",
-        gdpy_entry_type_names[self->E->field_type]); 
+        gdpy_entry_type_names[self->E->field_type]);
     dreturn("%i", -1);
     return -1;
   }
 
-  gdpy_set_scalar_from_pyobj(value, GD_INT16, &scalar, &numbits);
+  gdpy_set_scalar_from_pyobj(value, GD_INT_TYPE, &scalar, &numbits);
 
   if (PyErr_Occurred()) {
     dreturn("%i", -1);
     return -1;
   }
 
-  self->E->numbits = (gd_bit_t)numbits;
+  self->E->EN(bit,numbits) = numbits;
   free(self->E->scalar[1]);
   self->E->scalar[1] = scalar;
 
@@ -1389,10 +1541,10 @@ static int gdpy_entry_setnumbits(struct gdpy_entry_t* self, PyObject *value,
   return 0;
 }
 
-static PyObject* gdpy_entry_getdividend(struct gdpy_entry_t* self,
-    void* closure)
+static PyObject *gdpy_entry_getdividend(struct gdpy_entry_t *self,
+    void *closure)
 {
-  PyObject* obj = NULL;
+  PyObject *obj = NULL;
 
   dtrace("%p, %p", self, closure);
 
@@ -1400,32 +1552,34 @@ static PyObject* gdpy_entry_getdividend(struct gdpy_entry_t* self,
     if (self->E->scalar[0])
       obj = PyString_FromString(self->E->scalar[0]);
     else if (self->E->comp_scal)
-      obj = gdpy_from_complex(self->E->cdividend);
+      obj = gdpy_from_complex(self->E->EN(recip,cdividend));
     else
-      obj = PyFloat_FromDouble(self->E->dividend);
+      obj = PyFloat_FromDouble(self->E->EN(recip,dividend));
   } else
     PyErr_Format(PyExc_AttributeError, "'pygetdata.entry' "
         "attribute 'dividend' not available for entry type %s",
-        gdpy_entry_type_names[self->E->field_type]); 
+        gdpy_entry_type_names[self->E->field_type]);
 
   dreturn("%p", obj);
   return obj;
 }
 
-static int gdpy_entry_setdividend(struct gdpy_entry_t* self, PyObject *value,
+static int gdpy_entry_setdividend(struct gdpy_entry_t *self, PyObject *value,
     void *closure)
 {
   int comp_scal = 0;
   char *scalar;
-  double complex cdividend = 0;
+  GD_DCOMPLEXA(cdividend);
   double dividend = 0;
 
   dtrace("%p, %p, %p", self, value, closure);
 
+  gd_li2cs_(cdividend, 0, 0);
+
   if (self->E->field_type != GD_RECIP_ENTRY) {
     PyErr_Format(PyExc_AttributeError, "'pygetdata.entry' "
         "attribute 'dividend' not available for entry type %s",
-        gdpy_entry_type_names[self->E->field_type]); 
+        gdpy_entry_type_names[self->E->field_type]);
     dreturn("%i", -1);
     return -1;
   }
@@ -1438,7 +1592,7 @@ static int gdpy_entry_setdividend(struct gdpy_entry_t* self, PyObject *value,
     dividend = creal(cdividend);
   } else {
     gdpy_set_scalar_from_pyobj(value, GD_FLOAT64, &scalar, &dividend);
-    cdividend = dividend;
+    gd_rs2cs_(cdividend, dividend);
   }
 
   if (PyErr_Occurred()) {
@@ -1447,8 +1601,8 @@ static int gdpy_entry_setdividend(struct gdpy_entry_t* self, PyObject *value,
   }
 
   self->E->comp_scal = comp_scal;
-  self->E->cdividend = cdividend;
-  self->E->dividend = dividend;
+  gd_cs2cs_(self->E->EN(recip,cdividend), cdividend);
+  self->E->EN(recip,dividend) = dividend;
   free(self->E->scalar[0]);
   self->E->scalar[0] = scalar;
 
@@ -1456,27 +1610,27 @@ static int gdpy_entry_setdividend(struct gdpy_entry_t* self, PyObject *value,
   return 0;
 }
 
-static PyObject* gdpy_entry_getshift(struct gdpy_entry_t* self, void* closure)
+static PyObject *gdpy_entry_getshift(struct gdpy_entry_t *self, void *closure)
 {
-  PyObject* obj = NULL;
+  PyObject *obj = NULL;
 
   dtrace("%p, %p", self, closure);
 
   if (self->E->field_type == GD_PHASE_ENTRY) {
     if (self->E->scalar[0] == NULL)
-      obj = PyLong_FromLongLong((PY_LONG_LONG)self->E->shift);
+      obj = PyLong_FromLongLong((PY_LONG_LONG)self->E->EN(phase,shift));
     else
       obj = PyString_FromString(self->E->scalar[0]);
   } else
     PyErr_Format(PyExc_AttributeError, "'pygetdata.entry' "
         "attribute 'shift' not available for entry type %s",
-        gdpy_entry_type_names[self->E->field_type]); 
+        gdpy_entry_type_names[self->E->field_type]);
 
   dreturn("%p", obj);
   return obj;
 }
 
-static int gdpy_entry_setshift(struct gdpy_entry_t* self, PyObject *value,
+static int gdpy_entry_setshift(struct gdpy_entry_t *self, PyObject *value,
     void *closure)
 {
   int64_t shift;
@@ -1487,7 +1641,7 @@ static int gdpy_entry_setshift(struct gdpy_entry_t* self, PyObject *value,
   if (self->E->field_type != GD_PHASE_ENTRY) {
     PyErr_Format(PyExc_AttributeError, "'pygetdata.entry' "
         "attribute 'shift' not available for entry type %s",
-        gdpy_entry_type_names[self->E->field_type]); 
+        gdpy_entry_type_names[self->E->field_type]);
     dreturn("%i", -1);
     return -1;
   }
@@ -1499,7 +1653,7 @@ static int gdpy_entry_setshift(struct gdpy_entry_t* self, PyObject *value,
     return -1;
   }
 
-  self->E->shift = shift;
+  self->E->EN(phase,shift) = shift;
   free(self->E->scalar[0]);
   self->E->scalar[0] = scalar;
 
@@ -1507,44 +1661,148 @@ static int gdpy_entry_setshift(struct gdpy_entry_t* self, PyObject *value,
   return 0;
 }
 
-static PyObject* gdpy_entry_geta(struct gdpy_entry_t* self, void* closure)
+static PyObject *gdpy_entry_getcountval(struct gdpy_entry_t *self,
+    void *closure)
+{
+  PyObject *obj = NULL;
+
+  dtrace("%p, %p", self, closure);
+
+  if (self->E->field_type == GD_MPLEX_ENTRY) {
+    if (self->E->scalar[0] == NULL)
+      obj = PyInt_FromLong(self->E->EN(mplex,count_val));
+    else
+      obj = PyString_FromString(self->E->scalar[0]);
+  } else
+    PyErr_Format(PyExc_AttributeError, "'pygetdata.entry' "
+        "attribute 'count_val' not available for entry type %s",
+        gdpy_entry_type_names[self->E->field_type]);
+
+  dreturn("%p", obj);
+  return obj;
+}
+
+static int gdpy_entry_setcountval(struct gdpy_entry_t *self, PyObject *value,
+    void *closure)
+{
+  int count_val;
+  char *scalar;
+
+  dtrace("%p, %p, %p", self, value, closure);
+
+  if (self->E->field_type != GD_MPLEX_ENTRY) {
+    PyErr_Format(PyExc_AttributeError, "'pygetdata.entry' "
+        "attribute 'count_val' not available for entry type %s",
+        gdpy_entry_type_names[self->E->field_type]);
+    dreturn("%i", -1);
+    return -1;
+  }
+
+  gdpy_set_scalar_from_pyobj(value, GD_INT_TYPE, &scalar, &count_val);
+
+  if (PyErr_Occurred()) {
+    dreturn("%i", -1);
+    return -1;
+  }
+
+  self->E->EN(mplex,count_val) = count_val;
+  free(self->E->scalar[0]);
+  self->E->scalar[0] = scalar;
+
+  dreturn("%i", 0);
+  return 0;
+}
+
+static PyObject *gdpy_entry_getperiod(struct gdpy_entry_t *self,
+    void *closure)
+{
+  PyObject *obj = NULL;
+
+  dtrace("%p, %p", self, closure);
+
+  if (self->E->field_type == GD_MPLEX_ENTRY) {
+    if (self->E->scalar[0] == NULL)
+      obj = PyInt_FromLong(self->E->EN(mplex,period));
+    else
+      obj = PyString_FromString(self->E->scalar[0]);
+  } else
+    PyErr_Format(PyExc_AttributeError, "'pygetdata.entry' "
+        "attribute 'period' not available for entry type %s",
+        gdpy_entry_type_names[self->E->field_type]);
+
+  dreturn("%p", obj);
+  return obj;
+}
+
+static int gdpy_entry_setperiod(struct gdpy_entry_t *self, PyObject *value,
+    void *closure)
+{
+  int period;
+  char *scalar;
+
+  dtrace("%p, %p, %p", self, value, closure);
+
+  if (self->E->field_type != GD_MPLEX_ENTRY) {
+    PyErr_Format(PyExc_AttributeError, "'pygetdata.entry' "
+        "attribute 'period' not available for entry type %s",
+        gdpy_entry_type_names[self->E->field_type]);
+    dreturn("%i", -1);
+    return -1;
+  }
+
+  gdpy_set_scalar_from_pyobj(value, GD_INT_TYPE, &scalar, &period);
+
+  if (PyErr_Occurred()) {
+    dreturn("%i", -1);
+    return -1;
+  }
+
+  self->E->EN(mplex,period) = period;
+  free(self->E->scalar[1]);
+  self->E->scalar[1] = scalar;
+
+  dreturn("%i", 0);
+  return 0;
+}
+
+static PyObject *gdpy_entry_geta(struct gdpy_entry_t *self, void *closure)
 {
   int i;
-  PyObject* obj = NULL;
+  PyObject *obj = NULL;
 
   dtrace("%p, %p", self, closure);
 
   if (self->E->field_type == GD_POLYNOM_ENTRY) {
-    obj = PyTuple_New(self->E->poly_ord + 1);
-    for (i = 0; i <= self->E->poly_ord; ++i)
+    obj = PyTuple_New(self->E->EN(polynom,poly_ord) + 1);
+    for (i = 0; i <= self->E->EN(polynom,poly_ord); ++i)
       PyTuple_SetItem(obj, i, (self->E->scalar[i] == NULL) ?
-          (self->E->comp_scal) ?  gdpy_from_complex(self->E->ca[i]) :
-          PyFloat_FromDouble(self->E->a[i]) :
+          (self->E->comp_scal) ? gdpy_from_complex(self->E->EN(polynom,ca)[i]) :
+          PyFloat_FromDouble(self->E->EN(polynom,a)[i]) :
           PyString_FromString(self->E->scalar[i]));
   } else
     PyErr_Format(PyExc_AttributeError, "'pygetdata.entry' "
         "attribute 'a' not available for entry type %s",
-        gdpy_entry_type_names[self->E->field_type]); 
+        gdpy_entry_type_names[self->E->field_type]);
 
   dreturn("%p", obj);
   return obj;
 }
 
-static int gdpy_entry_seta(struct gdpy_entry_t* self, PyObject *value,
+static int gdpy_entry_seta(struct gdpy_entry_t *self, PyObject *value,
     void *closure)
 {
   int i;
   int comp_scal = 0;
   double a[GD_MAX_POLYORD + 1];
-  double complex ca[GD_MAX_POLYORD + 1];
-  char* scalar[GD_MAX_POLYORD + 1];
+  GD_DCOMPLEXM(ca[GD_MAX_POLYORD + 1]);
+  char *scalar[GD_MAX_POLYORD + 1];
 
   dtrace("%p, %p, %p", self, value, closure);
 
   if (self->E->field_type != GD_POLYNOM_ENTRY) {
     PyErr_Format(PyExc_AttributeError, "'pygetdata.entry' "
         "attribute 'a' not available for entry type %s",
-        gdpy_entry_type_names[self->E->field_type]); 
+        gdpy_entry_type_names[self->E->field_type]);
     dreturn("%i", -1);
     return -1;
   }
@@ -1556,24 +1814,24 @@ static int gdpy_entry_seta(struct gdpy_entry_t* self, PyObject *value,
     return -1;
   }
 
-  if (PyTuple_Size(value) < self->E->poly_ord + 1) {
+  if (PyTuple_Size(value) < self->E->EN(polynom,poly_ord) + 1) {
     PyErr_SetString(PyExc_TypeError, "'pygetdata.entry' "
         "not enough items in tuple for attribute 'a'");
     dreturn("%i", -1);
     return -1;
   }
 
-  for (i = 0; i <= self->E->poly_ord; ++i) {
+  for (i = 0; i <= self->E->EN(polynom,poly_ord); ++i) {
     PyObject *obj = PyTuple_GetItem(value, i);
     if (PyComplex_Check(obj)) {
       comp_scal = 1;
       scalar[i] = NULL;
     } else if (comp_scal) {
       gdpy_set_scalar_from_pyobj(obj, GD_COMPLEX128, scalar + i, ca + i);
-      a[i] = (double)ca[i];
+      a[i] = creal(ca[i]);
     } else {
       gdpy_set_scalar_from_pyobj(obj, GD_FLOAT64, scalar + i, a + i);
-      ca[i] = a[i];
+      gd_rs2cs_(ca[i], a[i]);
     }
   }
 
@@ -1582,9 +1840,9 @@ static int gdpy_entry_seta(struct gdpy_entry_t* self, PyObject *value,
     return -1;
   }
 
-  for (i = 0; i <= self->E->poly_ord; ++i) {
-    self->E->a[i] = a[i];
-    self->E->ca[i] = ca[i];
+  for (i = 0; i <= self->E->EN(polynom,poly_ord); ++i) {
+    self->E->EN(polynom,a)[i] = a[i];
+    gd_cs2cs_(self->E->EN(polynom,ca)[i], ca[i]);
     free(self->E->scalar[i]);
     self->E->scalar[i] = scalar[i];
   }
@@ -1594,37 +1852,39 @@ static int gdpy_entry_seta(struct gdpy_entry_t* self, PyObject *value,
   return 0;
 }
 
-static PyObject* gdpy_entry_getpolyord(struct gdpy_entry_t* self, void* closure)
+static PyObject *gdpy_entry_getpolyord(struct gdpy_entry_t *self, void *closure)
 {
-  PyObject* obj = NULL;
+  PyObject *obj = NULL;
 
   dtrace("%p, %p", self, closure);
 
   if (self->E->field_type == GD_POLYNOM_ENTRY)
-    obj = PyInt_FromLong(self->E->poly_ord);
+    obj = PyInt_FromLong(self->E->EN(polynom,poly_ord));
   else
     PyErr_Format(PyExc_AttributeError, "'pygetdata.entry' "
         "attribute 'poly_ord' not available for entry type %s",
-        gdpy_entry_type_names[self->E->field_type]); 
+        gdpy_entry_type_names[self->E->field_type]);
 
   dreturn("%p", obj);
   return obj;
 }
 
-static int gdpy_entry_setpolyord(struct gdpy_entry_t* self, PyObject *value,
+static int gdpy_entry_setpolyord(struct gdpy_entry_t *self, PyObject *value,
     void *closure)
 {
+  int n;
+
   dtrace("%p, %p, %p", self, value, closure);
 
   if (self->E->field_type != GD_POLYNOM_ENTRY) {
     PyErr_Format(PyExc_AttributeError, "'pygetdata.entry' "
         "attribute 'poly_ord' not available for entry type %s",
-        gdpy_entry_type_names[self->E->field_type]); 
+        gdpy_entry_type_names[self->E->field_type]);
     dreturn("%i", -1);
     return -1;
   }
 
-  int n = (int)PyLong_AsUnsignedLongLong(value);
+  n = (int)PyLong_AsUnsignedLongLong(value);
 
   if (PyErr_Occurred()) {
     dreturn("%i", -1);
@@ -1636,39 +1896,41 @@ static int gdpy_entry_setpolyord(struct gdpy_entry_t* self, PyObject *value,
     return -1;
   }
 
-  self->E->poly_ord = n;
+  self->E->EN(polynom,poly_ord) = n;
 
   dreturn("%i", 0);
   return 0;
 }
 
-static PyObject* gdpy_entry_getparms(struct gdpy_entry_t* self, void* closure)
+static PyObject *gdpy_entry_getparms(struct gdpy_entry_t *self, void *closure)
 {
   int i;
+  PyObject *a, *tuple = NULL;
 
   dtrace("%p, %p", self, closure);
 
-  PyObject *a, *tuple = NULL;
-
   switch (self->E->field_type)
   {
     case GD_NO_ENTRY:
+    case GD_ALIAS_ENTRY:
     case GD_INDEX_ENTRY:
     case GD_STRING_ENTRY:
       tuple = Py_BuildValue("()");
       break;
     case GD_CONST_ENTRY:
-      tuple = Py_BuildValue("(i)", self->E->const_type);
+      tuple = Py_BuildValue("(i)", self->E->EN(scalar,const_type));
       break;
     case GD_CARRAY_ENTRY:
-      tuple = Py_BuildValue("(iI)", self->E->const_type, self->E->array_len);
+      tuple = Py_BuildValue("(iI)", self->E->EN(scalar,const_type),
+          self->E->EN(scalar,array_len));
       break;
     case GD_RAW_ENTRY:
-      tuple = Py_BuildValue("(iI)", self->E->data_type, self->E->spf);
+      tuple = Py_BuildValue("(iI)", self->E->EN(raw,data_type),
+          self->E->EN(raw,spf));
       break;
     case GD_LINTERP_ENTRY:
       tuple = Py_BuildValue("(ss)", self->E->in_fields[0],
-          self->E->table);
+          self->E->EN(linterp,table));
       break;
     case GD_MULTIPLY_ENTRY:
     case GD_DIVIDE_ENTRY:
@@ -1676,75 +1938,101 @@ static PyObject* gdpy_entry_getparms(struct gdpy_entry_t* self, void* closure)
           self->E->in_fields[1]);
       break;
     case GD_RECIP_ENTRY:
-      if (self->E->comp_scal) 
+      if (self->E->comp_scal)
         tuple = Py_BuildValue("(sO)", self->E->in_fields[0],
-            gdpy_from_complex(self->E->cdividend));
+            gdpy_from_complex(self->E->EN(recip,cdividend)));
       else
         tuple = Py_BuildValue("(sd)", self->E->in_fields[0],
-            self->E->dividend);
+            self->E->EN(recip,dividend));
       break;
     case GD_PHASE_ENTRY:
       tuple = Py_BuildValue("(si)", self->E->in_fields[0],
-          self->E->shift);
+          self->E->EN(phase,shift));
       break;
     case GD_POLYNOM_ENTRY:
-      a = PyTuple_New(self->E->poly_ord + 1);
+      a = PyTuple_New(self->E->EN(polynom,poly_ord) + 1);
       if (self->E->comp_scal)
-        for (i = 0; i <= self->E->poly_ord; ++i)
-          PyTuple_SetItem(a, i, gdpy_from_complex(self->E->ca[i]));
+        for (i = 0; i <= self->E->EN(polynom,poly_ord); ++i)
+          PyTuple_SetItem(a, i, gdpy_from_complex(self->E->EN(polynom,ca)[i]));
       else
-        for (i = 0; i <= self->E->poly_ord; ++i)
-          PyTuple_SetItem(a, i, PyFloat_FromDouble(self->E->a[i]));
+        for (i = 0; i <= self->E->EN(polynom,poly_ord); ++i)
+          PyTuple_SetItem(a, i, PyFloat_FromDouble(self->E->EN(polynom,a)[i]));
       tuple = Py_BuildValue("(sO)", self->E->in_fields[0], a);
       break;
     case GD_LINCOM_ENTRY:
-      switch (self->E->n_fields) {
+      switch (self->E->EN(lincom,n_fields)) {
         case 1:
           if (self->E->comp_scal)
             tuple = Py_BuildValue("((s)(O)(O))", self->E->in_fields[0],
-                gdpy_from_complex(self->E->cm[0]),
-                gdpy_from_complex(self->E->cb[0]));
+                gdpy_from_complex(self->E->EN(lincom,cm)[0]),
+                gdpy_from_complex(self->E->EN(lincom,cb)[0]));
           else
             tuple = Py_BuildValue("((s)(d)(d))", self->E->in_fields[0],
-                self->E->m[0], self->E->b[0]);
+                self->E->EN(lincom,m)[0], self->E->EN(lincom,b)[0]);
           break;
         case 2:
           if (self->E->comp_scal)
             tuple = Py_BuildValue("((ss)(OO)(OO))", self->E->in_fields[0],
                 self->E->in_fields[1],
-                gdpy_from_complex(self->E->cm[0]),
-                gdpy_from_complex(self->E->cm[1]),
-                gdpy_from_complex(self->E->cb[0]),
-                gdpy_from_complex(self->E->cb[1]));
+                gdpy_from_complex(self->E->EN(lincom,cm)[0]),
+                gdpy_from_complex(self->E->EN(lincom,cm)[1]),
+                gdpy_from_complex(self->E->EN(lincom,cb)[0]),
+                gdpy_from_complex(self->E->EN(lincom,cb)[1]));
           else
             tuple = Py_BuildValue("((ss)(dd)(dd))", self->E->in_fields[0],
-                self->E->in_fields[1], self->E->m[0],
-                self->E->m[1], self->E->b[0],
-                self->E->b[1]);
+                self->E->in_fields[1], self->E->EN(lincom,m)[0],
+                self->E->EN(lincom,m)[1], self->E->EN(lincom,b)[0],
+                self->E->EN(lincom,b)[1]);
           break;
         case 3:
           if (self->E->comp_scal)
             tuple = Py_BuildValue("((sss)(OOO)(OOO))", self->E->in_fields[0],
                 self->E->in_fields[1], self->E->in_fields[2],
-                gdpy_from_complex(self->E->cm[0]),
-                gdpy_from_complex(self->E->cm[1]),
-                gdpy_from_complex(self->E->cm[2]),
-                gdpy_from_complex(self->E->cb[0]),
-                gdpy_from_complex(self->E->cb[1]),
-                gdpy_from_complex(self->E->cb[2]));
+                gdpy_from_complex(self->E->EN(lincom,cm)[0]),
+                gdpy_from_complex(self->E->EN(lincom,cm)[1]),
+                gdpy_from_complex(self->E->EN(lincom,cm)[2]),
+                gdpy_from_complex(self->E->EN(lincom,cb)[0]),
+                gdpy_from_complex(self->E->EN(lincom,cb)[1]),
+                gdpy_from_complex(self->E->EN(lincom,cb)[2]));
           else
             tuple = Py_BuildValue("((sss)(ddd)(ddd))", self->E->in_fields[0],
                 self->E->in_fields[1], self->E->in_fields[2],
-                self->E->m[0], self->E->m[1],
-                self->E->m[2], self->E->b[0],
-                self->E->b[1], self->E->b[2]);
+                self->E->EN(lincom,m)[0], self->E->EN(lincom,m)[1],
+                self->E->EN(lincom,m)[2], self->E->EN(lincom,b)[0],
+                self->E->EN(lincom,b)[1], self->E->EN(lincom,b)[2]);
+          break;
+      }
+      break;
+    case GD_WINDOW_ENTRY:
+      switch (self->E->EN(window,windop)) {
+        case GD_WINDOP_EQ:
+        case GD_WINDOP_NE:
+          tuple = Py_BuildValue("(ssiL)", self->E->in_fields[0],
+              self->E->in_fields[1], self->E->EN(window,windop),
+              (long long)self->E->EN(window,threshold).i);
+          break;
+        case GD_WINDOP_SET:
+        case GD_WINDOP_CLR:
+          tuple = Py_BuildValue("(ssiK)", self->E->in_fields[0],
+              self->E->in_fields[1], self->E->EN(window,windop),
+              (unsigned long long)self->E->EN(window,threshold).u);
+          break;
+        default:
+          tuple = Py_BuildValue("(ssid)", self->E->in_fields[0],
+              self->E->in_fields[1], self->E->EN(window,windop),
+              self->E->EN(window,threshold).r);
           break;
       }
       break;
     case GD_BIT_ENTRY:
     case GD_SBIT_ENTRY:
       tuple = Py_BuildValue("(sii)", self->E->in_fields[0],
-          self->E->bitnum, self->E->numbits);
+          self->E->EN(bit,bitnum), self->E->EN(bit,numbits));
+      break;
+    case GD_MPLEX_ENTRY:
+      tuple = Py_BuildValue("(ssII)", self->E->in_fields[0],
+          self->E->in_fields[1], (unsigned int)self->E->EN(mplex,count_val),
+          (unsigned int)self->E->EN(mplex,period));
       break;
   }
 
@@ -1752,12 +2040,13 @@ static PyObject* gdpy_entry_getparms(struct gdpy_entry_t* self, void* closure)
   return tuple;
 }
 
-static int gdpy_entry_setparms(struct gdpy_entry_t* self, PyObject *value,
+static int gdpy_entry_setparms(struct gdpy_entry_t *self, PyObject *value,
     void *closure)
 {
+  gd_entry_t E;
+
   dtrace("%p, %p, %p", self, value, closure);
 
-  gd_entry_t E;
   memset(&E, 0, sizeof(gd_entry_t));
 
   E.field = self->E->field;
@@ -1768,7 +2057,7 @@ static int gdpy_entry_setparms(struct gdpy_entry_t* self, PyObject *value,
     gdpy_set_entry_from_dict(&E, value, "pygetdata.entry");
   else if (PyTuple_Check(value))
     gdpy_set_entry_from_tuple(&E, value, "pygetdata.entry");
-  else 
+  else
     PyErr_SetString(PyExc_TypeError, "'pygetdata.entry' "
         "attribute 'parameters' must be a tuple or dictionary");
 
@@ -1786,6 +2075,126 @@ static int gdpy_entry_setparms(struct gdpy_entry_t* self, PyObject *value,
   return 0;
 }
 
+static PyObject *gdpy_entry_getwindop(struct gdpy_entry_t *self, void *closure)
+{
+  PyObject *obj = NULL;
+
+  dtrace("%p, %p", self, closure);
+
+  if (self->E->field_type == GD_WINDOW_ENTRY)
+    obj = PyInt_FromLong(self->E->EN(window,windop));
+  else
+    PyErr_Format(PyExc_AttributeError, "'pygetdata.entry' "
+        "attribute 'windop' not available for entry type %s",
+        gdpy_entry_type_names[self->E->field_type]);
+
+  dreturn("%p", obj);
+  return obj;
+}
+
+static int gdpy_entry_setwindop(struct gdpy_entry_t *self, PyObject *value,
+    void *closure)
+{
+  int t;
+
+  dtrace("%p, %p, %p", self, value, closure);
+
+  if (self->E->field_type != GD_WINDOW_ENTRY) {
+    PyErr_Format(PyExc_AttributeError, "'pygetdata.entry' "
+        "attribute 'windop' not available for entry type %s",
+        gdpy_entry_type_names[self->E->field_type]);
+    dreturn("%i", -1);
+    return -1;
+  }
+
+  t = PyInt_AsLong(value);
+  if (PyErr_Occurred()) {
+    dreturn("%i", -1);
+    return -1;
+  }
+
+  if (GDPY_INVALID_OP(t)) {
+    PyErr_SetString(PyExc_ValueError, "'pygetdata.entry' invalid data type");
+    dreturn("%i", -1);
+    return -1;
+  }
+
+  self->E->EN(window,windop) = (gd_windop_t)t;
+
+  dreturn("%i", 0);
+  return 0;
+}
+
+static PyObject *gdpy_entry_getthreshold(struct gdpy_entry_t *self,
+    void *closure)
+{
+  PyObject *obj = NULL;
+
+  dtrace("%p, %p", self, closure);
+
+  if (self->E->field_type == GD_WINDOW_ENTRY) {
+    switch (self->E->EN(window,windop)) {
+      case GD_WINDOP_EQ:
+      case GD_WINDOP_NE:
+        obj = PyLong_FromLongLong((long long)self->E->EN(window,threshold).i);
+        break;
+      case GD_WINDOP_SET:
+      case GD_WINDOP_CLR:
+        obj = PyLong_FromUnsignedLongLong(
+            (unsigned long long)self->E->EN(window,threshold).u);
+        break;
+      default:
+        obj = PyFloat_FromDouble(self->E->EN(window,threshold).r);
+        break;
+    }
+  } else
+    PyErr_Format(PyExc_AttributeError, "'pygetdata.entry' "
+        "attribute 'threshold' not available for entry type %s",
+        gdpy_entry_type_names[self->E->field_type]);
+
+  dreturn("%p", obj);
+  return obj;
+}
+
+static int gdpy_entry_setthreshold(struct gdpy_entry_t *self, PyObject *value,
+    void *closure)
+{
+  gd_triplet_t t;
+  dtrace("%p, %p, %p", self, value, closure);
+
+  if (self->E->field_type != GD_WINDOW_ENTRY) {
+    PyErr_Format(PyExc_AttributeError, "'pygetdata.entry' "
+        "attribute 'threshold' not available for entry type %s",
+        gdpy_entry_type_names[self->E->field_type]);
+    dreturn("%i", -1);
+    return -1;
+  }
+
+  switch (self->E->EN(window,windop)) {
+    case GD_WINDOP_EQ:
+    case GD_WINDOP_NE:
+      t.i = PyLong_AsLongLong(value);
+      break;
+    case GD_WINDOP_SET:
+    case GD_WINDOP_CLR:
+      t.u = PyLong_AsUnsignedLongLong(value);
+      break;
+    default:
+      t.r = PyFloat_AsDouble(value);
+      break;
+  }
+
+  if (PyErr_Occurred()) {
+    dreturn("%i", -1);
+    return -1;
+  }
+
+  self->E->EN(window,threshold) = t;
+
+  dreturn("%i", 0);
+  return 0;
+}
+
 static PyGetSetDef gdpy_entry_getset[] = {
   { "a", (getter)gdpy_entry_geta, (setter)gdpy_entry_seta,
     "The POLYNOM co-efficients.  A tuple of numerical and/or string data.\n"
@@ -1820,6 +2229,11 @@ static PyGetSetDef gdpy_entry_getset[] = {
   { "const_type", (getter)gdpy_entry_getdatatype,
     (setter)gdpy_entry_setdatatype, "An alias for the data_type attribute.",
     NULL },
+  { "count_val", (getter)gdpy_entry_getcountval, (setter)gdpy_entry_setcountval,
+    "The target value of the counter of a MPLEX field.  If this is\n"
+      "specified using a CONST scalar field, this will be the field code of\n"
+      "that field, otherwise, it will be the number itself.",
+    NULL },
   { "data_type", (getter)gdpy_entry_getdatatype, (setter)gdpy_entry_setdatatype,
     "A numeric code indicating the underlying data type of a CONST or RAW\n"
       "field.  It should be one of the data type symbols: pygetdata.UINT8,\n"
@@ -1833,7 +2247,6 @@ static PyGetSetDef gdpy_entry_getset[] = {
     NULL },
   { "dividend", (getter)gdpy_entry_getdividend, (setter)gdpy_entry_setdividend,
     "The dividend of a RECIP field.  If this is specified using a CONST\n"
-      /* -----------------------------------------------------------------| */
       "scalar field, this will be the field code of that field, otherwise,\n"
       "it will be the number itself.",
     NULL },
@@ -1876,7 +2289,7 @@ static PyGetSetDef gdpy_entry_getset[] = {
       "fields in the LINCOM: assigning a tuple of different size to this\n"
       "attribute will not result in a change in the number of fields used.\n"
       "To do that, modify the n_fields attribute directly.\n",
-    NULL }, 
+    NULL },
   { "n_fields", (getter)gdpy_entry_getnfields, (setter)gdpy_entry_setnfields,
     "The number of fields in a LINCOM.  Modifying this will change the\n"
       "number of fields used.  If this number is increased, the added\n"
@@ -1902,6 +2315,13 @@ static PyGetSetDef gdpy_entry_getset[] = {
       "dictionary, in which case it will be converted internally to the\n"
       "corresponding parameters tuple.",
     NULL },
+  { "period", (getter)gdpy_entry_getperiod, (setter)gdpy_entry_setperiod,
+    "The number of samples between successive occurrences of the MPLEX\n"
+      "value in the index vector (or zero, if unknown or not constant).  If\n"
+      /* ------ handy ruler ----------------------------------------------| */
+      "this is specified using a CONST scalar field, this will be the field\n"
+      "code of that field, otherwise, it will be the number itself.",
+    NULL },
   { "poly_ord", (getter)gdpy_entry_getpolyord, (setter)gdpy_entry_setpolyord,
     "The polynomial order of a POLYNOM field.  Modifying this will change\n"
       "the number of terms in the polynomial.  If this number is increased,\n"
@@ -1922,6 +2342,14 @@ static PyGetSetDef gdpy_entry_getset[] = {
   { "table", (getter)gdpy_entry_gettable, (setter)gdpy_entry_settable,
     "The pathname of the look-up table of a LINTERP field.",
     NULL },
+  { "windop", (getter)gdpy_entry_getwindop, (setter)gdpy_entry_setwindop,
+    "The operation of a WINDOW field.",
+    NULL },
+  { "threshold", (getter)gdpy_entry_getthreshold,
+    (setter)gdpy_entry_setthreshold,
+    "The threshold of a WINDOW field.  The numerical type depends on the\n"
+      "operation of the field.\n",
+    NULL },
   { NULL }
 };
 
@@ -1956,7 +2384,6 @@ static PyGetSetDef gdpy_entry_getset[] = {
 "                    more than three elements, the remainder will be\n"\
 "                    ignored.\n"\
 "    'm', 'b':     the scale factors and offset terms of the LINCOM.\n"\
-/* ---------------------------------------------------------------------| */\
 "                    These are also tuples and should have the same\n"\
 "                    number of elements as 'in_fields'.  Data can be any\n"\
 "                    mix of numeric types and, to specify CONST scalars,\n"\
@@ -1989,7 +2416,17 @@ static PyGetSetDef gdpy_entry_getset[] = {
 "  RECIP:        (in_field, dividend)\n"\
 "    'in_field':   a string containing the input field code.\n"\
 "    'dividend':   a number or CONST field code specifying the dividend\n"\
-"                    of the RECIP.\n\n"\
+"                    of the RECIP.\n"\
+"  WINDOW:       (in_field1, in_fields2, windop, threshold)\n"\
+"    'in_field1':  a string containing the input field code.\n"\
+"    'in_field2':  a string containing the check field code.\n"\
+"    'windop':     the window operation.  Should be one of the windop\n"\
+"                    symbols: pygetdata.WINDOP_EQ, pygetdata.WINDOP_NE,\n"\
+"                    &c.\n"\
+"    'threshold':  a scalar containing the threshold value.  The type of\n"\
+"                    this value depends on the window operation used.\n"\
+"\n"\
+/* ---------------------------------------------------------------------| */\
 "If a dictionary, the keys of 'parameters' should be the names of the\n"\
 "tuple parameters listed above (e.g. 'type' and 'spf' for a RAW field),\n"\
 "and the values the same as their tuple counterparts.\n\n"\
diff --git a/bindings/python/pyfragment.c b/bindings/python/pyfragment.c
index 9ecd7d2..4554563 100644
--- a/bindings/python/pyfragment.c
+++ b/bindings/python/pyfragment.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2009, 2010 D. V. Wiebe
+/* Copyright (C) 2009-2011, 2013 D. V. Wiebe
  *
  ***************************************************************************
  *
@@ -22,7 +22,7 @@
 #include "pygetdata.h"
 
 /* Fragment */
-static void gdpy_fragment_delete(struct gdpy_fragment_t* self)
+static void gdpy_fragment_delete(struct gdpy_fragment_t *self)
 {
   dtrace("%p", self);
 
@@ -31,13 +31,14 @@ static void gdpy_fragment_delete(struct gdpy_fragment_t* self)
   dreturnvoid();
 }
 
-static PyObject* gdpy_fragment_create(PyTypeObject *type, PyObject *args,
+static PyObject *gdpy_fragment_create(PyTypeObject *type, PyObject *args,
     PyObject *keys)
 {
+  struct gdpy_fragment_t *self;
+
   dtrace("%p, %p, %p", type, args, keys);
 
-  struct gdpy_fragment_t *self = (struct gdpy_fragment_t*)type->tp_alloc(type,
-      0);
+  self = (struct gdpy_fragment_t*)type->tp_alloc(type, 0);
 
   if (self)
     self->dirfile = NULL;
@@ -46,13 +47,13 @@ static PyObject* gdpy_fragment_create(PyTypeObject *type, PyObject *args,
   return (PyObject*)self;
 }
 
-static int gdpy_fragment_init(struct gdpy_fragment_t* self, PyObject *args,
+static int gdpy_fragment_init(struct gdpy_fragment_t *self, PyObject *args,
     PyObject *keys)
 {
-  dtrace("%p, %p, %p", self, args, keys);
-
   char *keywords[] = {"dirifle", "index", NULL};
 
+  dtrace("%p, %p, %p", self, args, keys);
+
   if (!PyArg_ParseTupleAndKeywords(args, keys,
         "O!i:pygetdata.fragment.__init__", keywords, &gdpy_dirfile,
         &self->dirfile, self->n))
@@ -67,56 +68,64 @@ static int gdpy_fragment_init(struct gdpy_fragment_t* self, PyObject *args,
   return 0;
 }
 
-static PyObject* gdpy_fragment_getindex(struct gdpy_fragment_t* self,
-    void* closure)
+static PyObject *gdpy_fragment_getindex(struct gdpy_fragment_t *self,
+    void *closure)
 {
+  PyObject *pyobj;
+
   dtrace("%p, %p", self, closure);
-  
-  PyObject* obj = PyInt_FromLong(self->n);
 
-  dreturn("%p", obj);
-  return obj;
+  pyobj = PyInt_FromLong(self->n);
+
+  dreturn("%p", pyobj);
+  return pyobj;
 }
 
-static PyObject* gdpy_fragment_getname(struct gdpy_fragment_t* self,
-    void* closure)
+static PyObject *gdpy_fragment_getname(struct gdpy_fragment_t *self,
+    void *closure)
 {
+  const char *name;
+  PyObject *pyobj;
+
   dtrace("%p, %p", self, closure);
-  
-  const char* name = gd_fragmentname(self->dirfile->D, self->n);
+
+  name = gd_fragmentname(self->dirfile->D, self->n);
 
   PYGD_CHECK_ERROR(self->dirfile->D, NULL);
 
-  PyObject* pyname = PyString_FromString(name);
+  pyobj = PyString_FromString(name);
 
-  dreturn("%p", pyname);
-  return pyname;
+  dreturn("%p", pyobj);
+  return pyobj;
 }
 
-static PyObject* gdpy_fragment_getencoding(struct gdpy_fragment_t* self,
-    void* closure)
+static PyObject *gdpy_fragment_getencoding(struct gdpy_fragment_t *self,
+    void *closure)
 {
+  unsigned long enc;
+  PyObject *pyobj;
+
   dtrace("%p, %p", self, closure);
-  
-  unsigned long enc = gd_encoding(self->dirfile->D, self->n);
+
+  enc = gd_encoding(self->dirfile->D, self->n);
 
   PYGD_CHECK_ERROR(self->dirfile->D, NULL);
 
-  PyObject* obj = PyLong_FromUnsignedLong(enc);
+  pyobj = PyLong_FromUnsignedLong(enc);
 
-  dreturn("%p", obj);
-  return obj;
+  dreturn("%p", pyobj);
+  return pyobj;
 }
 
-static PyObject* gdpy_fragment_setencoding(struct gdpy_fragment_t* self,
-    PyObject* args, PyObject* keys)
+static PyObject *gdpy_fragment_setencoding(struct gdpy_fragment_t *self,
+    PyObject *args, PyObject *keys)
 {
-  dtrace("%p, %p, %p", self, args, keys);
-
-  char* keywords[] = { "encoding", "recode", NULL };
+  char *keywords[] = { "encoding", "recode", NULL };
   unsigned long enc;
   int recode = 0;
 
+  dtrace("%p, %p, %p", self, args, keys);
+
   if (!PyArg_ParseTupleAndKeywords(args, keys,
         "k|i:pygetdata.fragment.alter_encoding", keywords, &enc, &recode))
   {
@@ -133,30 +142,33 @@ static PyObject* gdpy_fragment_setencoding(struct gdpy_fragment_t* self,
   return Py_None;
 }
 
-static PyObject* gdpy_fragment_getendianness(struct gdpy_fragment_t* self,
-    void* closure)
+static PyObject *gdpy_fragment_getendianness(struct gdpy_fragment_t *self,
+    void *closure)
 {
+  unsigned long end;
+  PyObject *pyobj;
+
   dtrace("%p, %p", self, closure);
-  
-  unsigned long end = gd_endianness(self->dirfile->D, self->n);
+
+  end = gd_endianness(self->dirfile->D, self->n);
 
   PYGD_CHECK_ERROR(self->dirfile->D, NULL);
 
-  PyObject* obj = PyLong_FromUnsignedLong(end);
+  pyobj = PyLong_FromUnsignedLong(end);
 
-  dreturn("%p", obj);
-  return obj;
+  dreturn("%p", pyobj);
+  return pyobj;
 }
 
-static PyObject* gdpy_fragment_setendianness(struct gdpy_fragment_t* self,
-    PyObject* args, PyObject* keys)
+static PyObject *gdpy_fragment_setendianness(struct gdpy_fragment_t *self,
+    PyObject *args, PyObject *keys)
 {
-  dtrace("%p, %p, %p", self, args, keys);
-
-  char* keywords[] = { "endianness", "recode", NULL };
+  char *keywords[] = { "endianness", "recode", NULL };
   unsigned long end;
   int recode = 0;
 
+  dtrace("%p, %p, %p", self, args, keys);
+
   if (!PyArg_ParseTupleAndKeywords(args, keys,
         "k|i:pygetdata.fragment.alter_endianness", keywords, &end, &recode))
   {
@@ -173,7 +185,7 @@ static PyObject* gdpy_fragment_setendianness(struct gdpy_fragment_t* self,
   return Py_None;
 }
 
-static PyObject* gdpy_fragment_rewrite(struct gdpy_fragment_t* self)
+static PyObject *gdpy_fragment_rewrite(struct gdpy_fragment_t *self)
 {
   dtrace("%p", self);
 
@@ -186,30 +198,33 @@ static PyObject* gdpy_fragment_rewrite(struct gdpy_fragment_t* self)
   return Py_None;
 }
 
-static PyObject* gdpy_fragment_getoffset(struct gdpy_fragment_t* self,
-    void* closure)
+static PyObject *gdpy_fragment_getoffset(struct gdpy_fragment_t *self,
+    void *closure)
 {
+  off_t offset;
+  PyObject *pyobj;
+
   dtrace("%p, %p", self, closure);
-  
-  off_t offset = gd_frameoffset(self->dirfile->D, self->n);
+
+  offset = gd_frameoffset(self->dirfile->D, self->n);
 
   PYGD_CHECK_ERROR(self->dirfile->D, NULL);
 
-  PyObject* obj = PyLong_FromLongLong((long long)offset);
+  pyobj = PyLong_FromLongLong((long long)offset);
 
-  dreturn("%p", obj);
-  return obj;
+  dreturn("%p", pyobj);
+  return pyobj;
 }
 
-static PyObject* gdpy_fragment_setoffset(struct gdpy_fragment_t* self,
-    PyObject* args, PyObject* keys)
+static PyObject *gdpy_fragment_setoffset(struct gdpy_fragment_t *self,
+    PyObject *args, PyObject *keys)
 {
-  dtrace("%p, %p, %p", self, args, keys);
-
-  char* keywords[] = { "frameoffset", "recode", NULL };
+  char *keywords[] = { "frameoffset", "recode", NULL };
   long long offset;
   int recode = 0;
 
+  dtrace("%p, %p, %p", self, args, keys);
+
   if (!PyArg_ParseTupleAndKeywords(args, keys,
         "L|i:pygetdata.fragment.alter_frameoffset", keywords, &offset, &recode))
   {
@@ -227,42 +242,50 @@ static PyObject* gdpy_fragment_setoffset(struct gdpy_fragment_t* self,
   return Py_None;
 }
 
-static PyObject* gdpy_fragment_getparent(struct gdpy_fragment_t* self,
-    void* closure)
+static PyObject *gdpy_fragment_getparent(struct gdpy_fragment_t *self,
+    void *closure)
 {
+  int parent;
+  PyObject *pyobj;
+
   dtrace("%p, %p", self, closure);
-  
-  int parent = gd_parent_fragment(self->dirfile->D, self->n);
+
+  parent = gd_parent_fragment(self->dirfile->D, self->n);
 
   PYGD_CHECK_ERROR(self->dirfile->D, NULL);
 
-  PyObject* obj = PyInt_FromLong(parent);
+  pyobj = PyInt_FromLong(parent);
 
-  dreturn("%p", obj);
-  return obj;
+  dreturn("%p", pyobj);
+  return pyobj;
 }
 
-static PyObject* gdpy_fragment_getprotection(struct gdpy_fragment_t* self,
-    void* closure)
+static PyObject *gdpy_fragment_getprotection(struct gdpy_fragment_t *self,
+    void *closure)
 {
+  int prot;
+  PyObject *pyobj;
+
   dtrace("%p, %p", self, closure);
-  
-  int prot = gd_protection(self->dirfile->D, self->n);
+
+  prot = gd_protection(self->dirfile->D, self->n);
 
   PYGD_CHECK_ERROR(self->dirfile->D, NULL);
 
-  PyObject* obj = PyInt_FromLong(prot);
+  pyobj = PyInt_FromLong(prot);
 
-  dreturn("%p", obj);
-  return obj;
+  dreturn("%p", pyobj);
+  return pyobj;
 }
 
-static int gdpy_fragment_setprotection(struct gdpy_fragment_t* self,
+static int gdpy_fragment_setprotection(struct gdpy_fragment_t *self,
     PyObject *value, void *closure)
 {
+  int p;
+
   dtrace("%p, %p, %p", self, value, closure);
 
-  int p = PyInt_AsLong(value);
+  p = PyInt_AsLong(value);
 
   if (PyErr_Occurred()) {
     dreturn("%i", -1);
@@ -277,6 +300,98 @@ static int gdpy_fragment_setprotection(struct gdpy_fragment_t* self,
   return 0;
 }
 
+static PyObject *gdpy_fragment_getprefix(struct gdpy_fragment_t *self,
+    void *closure)
+{
+  char *prefix, *suffix;
+  PyObject *pyobj;
+
+  dtrace("%p, %p", self, closure);
+
+  gd_fragment_affixes(self->dirfile->D, self->n, &prefix, &suffix);
+
+  PYGD_CHECK_ERROR(self->dirfile->D, NULL);
+
+  if (prefix == NULL) {
+    Py_INCREF(Py_None);
+    dreturn("%p", Py_None);
+    return Py_None;
+  }
+
+  pyobj = PyString_FromString(prefix);
+
+  dreturn("%p", pyobj);
+  return pyobj;
+}
+
+static int gdpy_fragment_setprefix(struct gdpy_fragment_t *self,
+    PyObject *value, void *closure)
+{
+  const char *prefix;
+
+  dtrace("%p, %p, %p", self, value, closure);
+
+  prefix = PyString_AsString(value);
+
+  if (PyErr_Occurred()) {
+    dreturn("%i", -1);
+    return -1;
+  }
+
+  gd_alter_affixes(self->dirfile->D, self->n, prefix, NULL);
+
+  PYGD_CHECK_ERROR(self->dirfile->D, -1);
+
+  dreturn("%i", 0);
+  return 0;
+}
+
+static PyObject *gdpy_fragment_getsuffix(struct gdpy_fragment_t *self,
+    void *closure)
+{
+  char *prefix, *suffix;
+  PyObject *pyobj;
+
+  dtrace("%p, %p", self, closure);
+
+  gd_fragment_affixes(self->dirfile->D, self->n, &prefix, &suffix);
+
+  PYGD_CHECK_ERROR(self->dirfile->D, NULL);
+
+  if (suffix == NULL) {
+    Py_INCREF(Py_None);
+    dreturn("%p", Py_None);
+    return Py_None;
+  }
+
+  pyobj = PyString_FromString(suffix);
+
+  dreturn("%p", pyobj);
+  return pyobj;
+}
+
+static int gdpy_fragment_setsuffix(struct gdpy_fragment_t *self,
+    PyObject *value, void *closure)
+{
+  const char *suffix;
+
+  dtrace("%p, %p, %p", self, value, closure);
+
+  suffix = PyString_AsString(value);
+
+  if (PyErr_Occurred()) {
+    dreturn("%i", -1);
+    return -1;
+  }
+
+  gd_alter_affixes(self->dirfile->D, self->n, NULL, suffix);
+
+  PYGD_CHECK_ERROR(self->dirfile->D, -1);
+
+  dreturn("%i", 0);
+  return 0;
+}
+
 static PyGetSetDef gdpy_fragment_getset[] = {
   { "encoding", (getter)gdpy_fragment_getencoding, NULL,
     "The encoding scheme of this fragment.  This will be one of the\n"
@@ -308,6 +423,10 @@ static PyGetSetDef gdpy_fragment_getset[] = {
       "cannot be changed.  To move a format file fragment to a different\n"
       "parent fragment, use dirfile.uninclude() and dirfile.include().",
     NULL },
+  { "prefix", (getter)gdpy_fragment_getprefix, (setter)gdpy_fragment_setprefix,
+    "The prefix applied to all fields defined in this fragment and\n"
+      "subfragments.  See gd_fragment_affixes(3).",
+    NULL },
   { "protection", (getter)gdpy_fragment_getprotection,
     (setter)gdpy_fragment_setprotection,
     "The (advisory) protection level of this fragment.  This will be one\n"
@@ -315,6 +434,10 @@ static PyGetSetDef gdpy_fragment_getset[] = {
       "fragment can be changed by assigning to this attribute.  See\n"
       "gd_protection(3) and gd_alter_protection(3).",
     NULL },
+  { "suffix", (getter)gdpy_fragment_getsuffix, (setter)gdpy_fragment_setsuffix,
+    "The suffix applied to all fields defined in this fragment and\n"
+      "subfragments.  See gd_fragment_affixes(3).",
+    NULL },
   { NULL }
 };
 
diff --git a/bindings/python/pygetdata.c b/bindings/python/pygetdata.c
index 1edf0ba..6534dce 100644
--- a/bindings/python/pygetdata.c
+++ b/bindings/python/pygetdata.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2009, 2010 D. V. Wiebe
+/* Copyright (C) 2009-2013 D. V. Wiebe
  *
  ***************************************************************************
  *
@@ -31,7 +31,7 @@ static const char *gdpy_exception_list[GD_N_ERROR_CODES] = {
   "BadType",
   "RawIO",
   "OpenFragment",
-  "InternalError",
+  "Internal",
   "Alloc",
   "Range",
   "OpenLinfile",
@@ -49,23 +49,26 @@ static const char *gdpy_exception_list[GD_N_ERROR_CODES] = {
   "BadReference",
   "Protected",
   "Deletion",
-  "BadEndianess",
+  "Argument",
   "Callback",
-  "BadProtection",
+  "Exists",
   "UncleanDatabase",
   "Domain",
   "BadRepr",
-  "BadVersion",
-  "Flush"
+  NULL,
+  "Flush",
+  "Bounds",
+  "LineTooLong"
 };
 PyObject *gdpy_exceptions[GD_N_ERROR_CODES];
 
-int gdpy_convert_from_pyobj(PyObject* value, union gdpy_quadruple_value *data,
+int gdpy_convert_from_pyobj(PyObject *value, union gdpy_quadruple_value *data,
     gd_type_t type)
 {
-  dtrace("%p, %p, %02x", value, data, type);
   int data_type;
 
+  dtrace("%p, %p, %02x", value, data, type);
+
   /* check value type, and figure out autotype, if needed */
   if (PyInt_Check(value)) {
     data->s = PyInt_AsLong(value);
@@ -147,7 +150,7 @@ int gdpy_convert_from_pyobj(PyObject* value, union gdpy_quadruple_value *data,
       return -1;
     }
   } else if (PyComplex_Check(value)) {
-    data->c = gdpy_as_complex(value);
+    gdpy_as_complex(gd_csp_(data->c), value);
     data_type = GDPY_COMPLEX_AS_COMPLEX;
 
     if (PyErr_Occurred()) {
@@ -164,16 +167,17 @@ int gdpy_convert_from_pyobj(PyObject* value, union gdpy_quadruple_value *data,
   return data_type;
 }
 
-gd_type_t gdpy_convert_from_pylist(PyObject* value, void *data, gd_type_t type,
+gd_type_t gdpy_convert_from_pylist(PyObject *value, void *data, gd_type_t type,
     size_t ns)
 {
   size_t i;
+  int data_type;
   union gdpy_quadruple_value tmp;
 
   dtrace("%p, %p, %02x, %zi", value, data, type, ns);
 
   /* use the first element to determine the data type */
-  int data_type = gdpy_convert_from_pyobj(PyList_GetItem(value, 0), &tmp, type);
+  data_type = gdpy_convert_from_pyobj(PyList_GetItem(value, 0), &tmp, type);
 
   if (data_type == -1) {
     dreturn("%02x", GD_UNKNOWN);
@@ -214,9 +218,9 @@ gd_type_t gdpy_convert_from_pylist(PyObject* value, void *data, gd_type_t type,
       break;
     case GDPY_COMPLEX_AS_COMPLEX:
       type = GD_COMPLEX128;
-      *(complex double*)data = tmp.c;
+      gd_cs2ca_(data, 0, tmp.c, double);
       for (i = 1; i < ns; ++i)
-        ((double complex*)data)[i] = gdpy_as_complex(PyList_GetItem(value, i));
+        gdpy_as_complex(((double*)data) + 2 * i, PyList_GetItem(value, i));
       break;
   }
 
@@ -351,16 +355,15 @@ int gdpy_npytype_from_type(gd_type_t type)
 }
 #endif
 
-PyObject* gdpy_convert_to_pylist(const void* data, gd_type_t type, size_t ns)
+PyObject *gdpy_convert_to_pylist(const void *data, gd_type_t type, size_t ns)
 {
   size_t i;
+  PyObject *pyobj;
 
   dtrace("%p, %02x, %zi", data, type, ns);
 
-  PyObject* pylist;
-
   if (type != GD_NULL)
-    pylist = PyList_New(0);
+    pyobj = PyList_New(0);
 
   switch(type) {
     case GD_NULL:
@@ -369,82 +372,80 @@ PyObject* gdpy_convert_to_pylist(const void* data, gd_type_t type, size_t ns)
       return Py_None;
     case GD_UINT8:
       for (i = 0; i < ns; ++i)
-        if (PyList_Append(pylist, PyInt_FromLong((long)((uint8_t*)data)[i])))
+        if (PyList_Append(pyobj, PyInt_FromLong((long)((uint8_t*)data)[i])))
           return NULL;
       break;
     case GD_INT8:
       for (i = 0; i < ns; ++i)
-        if (PyList_Append(pylist, PyInt_FromLong((long)((int8_t*)data)[i])))
+        if (PyList_Append(pyobj, PyInt_FromLong((long)((int8_t*)data)[i])))
           return NULL;
       break;
     case GD_UINT16:
       for (i = 0; i < ns; ++i)
-        if (PyList_Append(pylist, PyInt_FromLong((long)((uint16_t*)data)[i])))
+        if (PyList_Append(pyobj, PyInt_FromLong((long)((uint16_t*)data)[i])))
           return NULL;
       break;
     case GD_INT16:
       for (i = 0; i < ns; ++i)
-        if (PyList_Append(pylist, PyInt_FromLong((long)((int16_t*)data)[i])))
+        if (PyList_Append(pyobj, PyInt_FromLong((long)((int16_t*)data)[i])))
           return NULL;
       break;
     case GD_UINT32:
       for (i = 0; i < ns; ++i)
-        if (PyList_Append(pylist,
+        if (PyList_Append(pyobj,
               PyLong_FromUnsignedLong((unsigned long)((uint32_t*)data)[i])))
           return NULL;
       break;
     case GD_INT32:
       for (i = 0; i < ns; ++i)
-        if (PyList_Append(pylist, PyInt_FromLong((long)((int32_t*)data)[i])))
+        if (PyList_Append(pyobj, PyInt_FromLong((long)((int32_t*)data)[i])))
           return NULL;
       break;
     case GD_UINT64:
       for (i = 0; i < ns; ++i)
-        if (PyList_Append(pylist, PyLong_FromUnsignedLongLong(
+        if (PyList_Append(pyobj, PyLong_FromUnsignedLongLong(
                 (unsigned long long)((uint64_t*)data)[i])))
           return NULL;
       break;
     case GD_INT64:
       for (i = 0; i < ns; ++i)
-        if (PyList_Append(pylist,
+        if (PyList_Append(pyobj,
               PyLong_FromLongLong((long long)((int64_t*)data)[i])))
           return NULL;
       break;
     case GD_FLOAT32:
       for (i = 0; i < ns; ++i)
-        if (PyList_Append(pylist,
-              PyFloat_FromDouble((double)((float*)data)[i])))
+        if (PyList_Append(pyobj, PyFloat_FromDouble((double)((float*)data)[i])))
           return NULL;
       break;
     case GD_FLOAT64:
       for (i = 0; i < ns; ++i)
-        if (PyList_Append(pylist, PyFloat_FromDouble(((double*)data)[i])))
+        if (PyList_Append(pyobj, PyFloat_FromDouble(((double*)data)[i])))
           return NULL;
       break;
     case GD_COMPLEX64:
       for (i = 0; i < ns; ++i)
-        if (PyList_Append(pylist,
-              gdpy_from_complex((double complex)((float complex*)data)[i])))
+        if (PyList_Append(pyobj, gdpy_from_complexp(((float*)data) + 2 * i)))
           return NULL;
       break;
     case GD_COMPLEX128:
       for (i = 0; i < ns; ++i)
-        if (PyList_Append(pylist,
-              gdpy_from_complex(((double complex*)data)[i])))
+        if (PyList_Append(pyobj, gdpy_from_complexp(((double*)data) + 2 * i)))
           return NULL;
       break;
     case GD_UNKNOWN: /* prevent compiler warning */
       break;
   }
 
-  dreturn("%p", pylist);
-  return pylist;
+  dreturn("%p", pyobj);
+  return pyobj;
 }
 
-PyObject* gdpy_convert_to_pyobj(const void* data, gd_type_t type)
+PyObject *gdpy_convert_to_pyobj(const void *data, gd_type_t type)
 {
+  PyObject *pyobj = NULL;
+
   dtrace("%p, %02x", data, type);
-  PyObject* pyobj = NULL;
 
   switch(type) {
     case GD_NULL:
@@ -482,10 +483,10 @@ PyObject* gdpy_convert_to_pyobj(const void* data, gd_type_t type)
       pyobj = PyFloat_FromDouble(*(double*)data);
       break;
     case GD_COMPLEX64:
-      pyobj = gdpy_from_complex((double complex)*(float complex*)data);
+      pyobj = gdpy_from_complexp((float*)data);
       break;
     case GD_COMPLEX128:
-      pyobj = gdpy_from_complex(*(double complex*)data);
+      pyobj = gdpy_from_complexp((double*)data);
       break;
     case GD_UNKNOWN: /* prevent compiler warning */
       break;
@@ -503,21 +504,27 @@ static PyMethodDef GetDataMethods[] = {
 PyMODINIT_FUNC initpygetdata(void)
 {
   int i;
-  PyObject* mod;
+  PyObject *mod;
+
+  dtracevoid();
 
   if (PyType_Ready(&gdpy_dirfile) < 0)
     return;
+  dprintf("gdpy_dirfile ready");
 
   if (PyType_Ready(&gdpy_entry) < 0)
     return;
+  dprintf("gdpy_entry ready");
 
   if (PyType_Ready(&gdpy_fragment) < 0)
     return;
+  dprintf("gdpy_fragment ready");
 
 #ifdef USE_NUMPY
   /* The following macro will cause this function to return if importing numpy
    * fails */
   import_array()
+  dprintf("imported NumPy");
 #endif
 
   mod = Py_InitModule3("pygetdata", GetDataMethods,
@@ -570,28 +577,35 @@ PyMODINIT_FUNC initpygetdata(void)
 
   if (mod == NULL)
     return;
+  dprintf("module init");
 
   Py_INCREF(&gdpy_dirfile);
   PyModule_AddObject(mod, "dirfile", (PyObject *)&gdpy_dirfile);
+  dprintf("gdpy_dirfile added");
 
   Py_INCREF(&gdpy_entry);
   PyModule_AddObject(mod, "entry", (PyObject *)&gdpy_entry);
+  dprintf("gdpy_entry added");
 
   Py_INCREF(&gdpy_fragment);
   PyModule_AddObject(mod, "fragment", (PyObject *)&gdpy_fragment);
+  dprintf("gdpy_fragment added");
 
   /* version */
   PyModule_AddObject(mod, "__version__", Py_BuildValue("(iiis)", GETDATA_MAJOR,
         GETDATA_MINOR, GETDATA_REVISION, GETDATA_VERSION_SUFFIX));
+  dprintf(".__version__ added");
 
   /* author */
   PyModule_AddStringConstant(mod, "__author__",
       "D. V. Wiebe <getdata at ketiltrout.net>");
+  dprintf(".__author__ added");
 
   /* add constants */
   for (i = 0; gdpy_constant_list[i].name != NULL; ++i)
     PyModule_AddIntConstant(mod, gdpy_constant_list[i].name,
         gdpy_constant_list[i].value);
+  dprintf("constants added");
 
   PyModule_AddIntConstant(mod, "__numpy_supported__",
 #ifdef USE_NUMPY
@@ -600,6 +614,7 @@ PyMODINIT_FUNC initpygetdata(void)
       0
 #endif
       );
+  dprintf(".__numpy_supported__ added");
 
   /* add exceptions */
   GdPy_DirfileError = PyErr_NewException("pygetdata.DirfileError",
@@ -608,10 +623,16 @@ PyMODINIT_FUNC initpygetdata(void)
   PyModule_AddObject(mod, "DirfileError", GdPy_DirfileError);
 
   for (i = 1; i < GD_N_ERROR_CODES; ++i) {
-    char name[40];
-    sprintf(name, "pygetdata.%sError", gdpy_exception_list[i]);
-    gdpy_exceptions[i] = PyErr_NewException(name, GdPy_DirfileError, NULL);
-    Py_INCREF(gdpy_exceptions[i]);
-    PyModule_AddObject(mod, name + 10, gdpy_exceptions[i]);
+    if (gdpy_exception_list[i]) {
+      char name[40];
+      sprintf(name, "pygetdata.%sError", gdpy_exception_list[i]);
+      gdpy_exceptions[i] = PyErr_NewException(name, GdPy_DirfileError, NULL);
+      Py_INCREF(gdpy_exceptions[i]);
+      PyModule_AddObject(mod, name + 10, gdpy_exceptions[i]);
+    } else
+      gdpy_exceptions[i] = GdPy_DirfileError;
   }
+  dprintf("Exceptions added");
+
+  dreturnvoid();
 }
diff --git a/bindings/python/pygetdata.h b/bindings/python/pygetdata.h
index 48089dc..9349ba7 100644
--- a/bindings/python/pygetdata.h
+++ b/bindings/python/pygetdata.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 2009, 2010 D. V. Wiebe
+/* Copyright (C) 2009-2013 D. V. Wiebe
  *
  ***************************************************************************
  *
@@ -51,6 +51,12 @@
 #define GDPY_FLOAT_AS_DOUBLE    (GDPY_FLOAT     | GDPY_IEEE754)
 #define GDPY_COMPLEX_AS_COMPLEX (GDPY_PYCOMPLEX | GDPY_COMPLEX)
 
+#define GDPY_INVALID_OP(t) ( \
+    t != GD_WINDOP_EQ && t != GD_WINDOP_NE && \
+    t != GD_WINDOP_GE && t != GD_WINDOP_GT && \
+    t != GD_WINDOP_LE && t != GD_WINDOP_LT && \
+    t != GD_WINDOP_SET && t != GD_WINDOP_CLR )
+
 #define GDPY_INVALID_TYPE(t) ( \
     t != GD_UINT8     && t != GD_INT8    && \
     t != GD_UINT16    && t != GD_INT16   && \
@@ -80,49 +86,51 @@ extern PyTypeObject gdpy_entry;
 extern PyTypeObject gdpy_fragment;
 
 extern const struct gdpy_constant_t {
-  char* name;
+  char *name;
   long value;
 } gdpy_constant_list[];
 
 struct gdpy_dirfile_t {
   PyObject_HEAD
-  DIRFILE* D;
-  PyObject* callback_data;
-  PyObject* callback;
+  DIRFILE *D;
+  int mplex_lookback;
+  char *verbose_prefix;
+  PyObject *callback_data;
+  PyObject *callback;
   int callback_exception;
 };
 
 struct gdpy_entry_t {
   PyObject_HEAD
-  gd_entry_t* E;
+  gd_entry_t *E;
 };
 
 struct gdpy_fragment_t {
   PyObject_HEAD
   int n;
-  struct gdpy_dirfile_t* dirfile;
+  struct gdpy_dirfile_t *dirfile;
 };
 
 union gdpy_quadruple_value {
   uint64_t u;
   int64_t s;
   double f;
-  double complex c;
+  GD_DCOMPLEXA(c);
 };
 
-static inline double complex gdpy_as_complex(PyObject* o)
-{
-  Py_complex c = PyComplex_AsCComplex(o);
-  return c.real + _Complex_I * c.imag;
-}
+#define gdpy_as_complex(v,o) do { \
+  Py_complex c = PyComplex_AsCComplex(o); \
+  gd_li2cp_((v), c.real, c.imag); \
+} while(0)
 
+#define gdpy_from_complexp(c) PyComplex_FromDoubles((c)[0], (c)[1])
 #define gdpy_from_complex(c) PyComplex_FromDoubles(creal(c), cimag(c))
 
 extern int gdpy_convert_from_pyobj(PyObject*, union gdpy_quadruple_value*,
     gd_type_t);
 extern gd_type_t gdpy_convert_from_pylist(PyObject*, void*, gd_type_t, size_t);
-extern PyObject* gdpy_convert_to_pyobj(const void*, gd_type_t);
-extern PyObject* gdpy_convert_to_pylist(const void*, gd_type_t, size_t);
+extern PyObject *gdpy_convert_to_pyobj(const void*, gd_type_t);
+extern PyObject *gdpy_convert_to_pylist(const void*, gd_type_t, size_t);
 extern int gdpy_npytype_from_type(gd_type_t type);
 extern gd_type_t gdpy_type_from_npytype(int npytype);
 PyMODINIT_FUNC initpygetdata(void);
diff --git a/bindings/python/test/Makefile.am b/bindings/python/test/Makefile.am
index 55083ff..d159cad 100644
--- a/bindings/python/test/Makefile.am
+++ b/bindings/python/test/Makefile.am
@@ -22,7 +22,7 @@ AUTOMAKE_OPTIONS = foreign
 
 if TEST_PYTHON
 TESTS_ENVIRONMENT=${DL_LIBRARY_PATH}=${${DL_LIBRARY_PATH}}:../../../src/.libs PYTHONPATH=../.libs/ ${PYTHON}
-pyTESTS=big_test.py callback.py
+pyTESTS=callback.py big_test.py
 TESTS=$(addprefix ${srcdir}/,$(pyTESTS))
 endif
 
diff --git a/bindings/python/test/Makefile.in b/bindings/python/test/Makefile.in
index 48dabc5..94954bb 100644
--- a/bindings/python/test/Makefile.in
+++ b/bindings/python/test/Makefile.in
@@ -1,9 +1,9 @@
-# Makefile.in generated by automake 1.11.1 from Makefile.am.
+# Makefile.in generated by automake 1.11.5 from Makefile.am.
 # @configure_input@
 
 # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005, 2006, 2007, 2008, 2009  Free Software Foundation,
-# Inc.
+# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software
+# Foundation, Inc.
 # This Makefile.in is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
@@ -15,6 +15,23 @@
 
 @SET_MAKE@
 VPATH = @srcdir@
+am__make_dryrun = \
+  { \
+    am__dry=no; \
+    case $$MAKEFLAGS in \
+      *\\[\ \	]*) \
+        echo 'am--echo: ; @echo "AM"  OK' | $(MAKE) -f - 2>/dev/null \
+          | grep '^AM OK$$' >/dev/null || am__dry=yes;; \
+      *) \
+        for am__flg in $$MAKEFLAGS; do \
+          case $$am__flg in \
+            *=*|--*) ;; \
+            *n*) am__dry=yes; break;; \
+          esac; \
+        done;; \
+    esac; \
+    test $$am__dry = yes; \
+  }
 pkgdatadir = $(datadir)/@PACKAGE@
 pkgincludedir = $(includedir)/@PACKAGE@
 pkglibdir = $(libdir)/@PACKAGE@
@@ -38,20 +55,27 @@ DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
 am__aclocal_m4_deps = $(top_srcdir)/m4/ax_compare_version.m4 \
 	$(top_srcdir)/m4/compiler.m4 $(top_srcdir)/m4/encoding.m4 \
-	$(top_srcdir)/m4/idl.m4 $(top_srcdir)/m4/libtool.m4 \
-	$(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \
-	$(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \
-	$(top_srcdir)/m4/python.m4 $(top_srcdir)/m4/win32.m4 \
-	$(top_srcdir)/m4/version.m4 $(top_srcdir)/configure.ac
+	$(top_srcdir)/m4/floatordering.m4 $(top_srcdir)/m4/idl.m4 \
+	$(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \
+	$(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \
+	$(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/m4/matlab.m4 \
+	$(top_srcdir)/m4/perl.m4 $(top_srcdir)/m4/python.m4 \
+	$(top_srcdir)/m4/win32.m4 $(top_srcdir)/m4/version.m4 \
+	$(top_srcdir)/configure.ac
 am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
 	$(ACLOCAL_M4)
 mkinstalldirs = $(install_sh) -d
-CONFIG_HEADER = $(top_builddir)/src/config.h \
+CONFIG_HEADER = $(top_builddir)/src/gd_config.h \
 	$(top_builddir)/src/getdata.h
 CONFIG_CLEAN_FILES =
 CONFIG_CLEAN_VPATH_FILES =
 SOURCES =
 DIST_SOURCES =
+am__can_run_installinfo = \
+  case $$AM_UPDATE_INFO_DIR in \
+    n|no|NO) false;; \
+    *) (install-info --version) >/dev/null 2>&1;; \
+  esac
 am__tty_colors = \
 red=; grn=; lgn=; blu=; std=
 DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
@@ -63,10 +87,13 @@ AUTOHEADER = @AUTOHEADER@
 AUTOMAKE = @AUTOMAKE@
 AWK = @AWK@
 BUILDCC = @BUILDCC@
-BUILD_DATE = @BUILD_DATE@
 BZIP2_CPPFLAGS = @BZIP2_CPPFLAGS@
 BZIP2_LDFLAGS = @BZIP2_LDFLAGS@
+BZIP2_LIBS = @BZIP2_LIBS@
 CC = @CC@
+CCAS = @CCAS@
+CCASDEPMODE = @CCASDEPMODE@
+CCASFLAGS = @CCASFLAGS@
 CCDEPMODE = @CCDEPMODE@
 CFLAGS = @CFLAGS@
 CPP = @CPP@
@@ -82,6 +109,7 @@ DEFINE_GD_NO_C99_API = @DEFINE_GD_NO_C99_API@
 DEFINE_gd_int16_t = @DEFINE_gd_int16_t@
 DEFINE_gd_int64_t = @DEFINE_gd_int64_t@
 DEFINE_gd_uint16_t = @DEFINE_gd_uint16_t@
+DEFINE_gd_uint64_t = @DEFINE_gd_uint64_t@
 DEFS = @DEFS@
 DEPDIR = @DEPDIR@
 DIFF = @DIFF@
@@ -102,13 +130,21 @@ FFLAGS = @FFLAGS@
 FGETDATA_VERSION = @FGETDATA_VERSION@
 FGREP = @FGREP@
 FLIBS = @FLIBS@
+GD_DIRSEP = @GD_DIRSEP@
+GD_FDIRSEP = @GD_FDIRSEP@
 GETDATAXX_VERSION = @GETDATAXX_VERSION@
+GETDATA_DEBUG = @GETDATA_DEBUG@
 GETDATA_IFACE_AGE = @GETDATA_IFACE_AGE@
 GETDATA_IFACE_VERSION = @GETDATA_IFACE_VERSION@
 GETDATA_IMPL_REVISION = @GETDATA_IMPL_REVISION@
+GETDATA_MAJOR = @GETDATA_MAJOR@
+GETDATA_MINOR = @GETDATA_MINOR@
+GETDATA_REVISION = @GETDATA_REVISION@
+GETDATA_VERSION_SUFFIX = @GETDATA_VERSION_SUFFIX@
 GREP = @GREP@
 GZIP_CPPFLAGS = @GZIP_CPPFLAGS@
 GZIP_LDFLAGS = @GZIP_LDFLAGS@
+GZIP_LIBS = @GZIP_LIBS@
 IDL = @IDL@
 IDL_CFLAGS = @IDL_CFLAGS@
 IDL_LIBS = @IDL_LIBS@
@@ -131,8 +167,13 @@ LTDLINCL = @LTDLINCL@
 LTLIBOBJS = @LTLIBOBJS@
 LZMA_CPPFLAGS = @LZMA_CPPFLAGS@
 LZMA_LDFLAGS = @LZMA_LDFLAGS@
+LZMA_LIBS = @LZMA_LIBS@
 MAKEINFO = @MAKEINFO@
 MANIFEST_TOOL = @MANIFEST_TOOL@
+MATLAB = @MATLAB@
+MATLABGETDATA_VERSION = @MATLABGETDATA_VERSION@
+MATLAB_CPPFLAGS = @MATLAB_CPPFLAGS@
+MEX = @MEX@
 MKDIR_P = @MKDIR_P@
 NM = @NM@
 NMEDIT = @NMEDIT@
@@ -149,6 +190,9 @@ PACKAGE_TARNAME = @PACKAGE_TARNAME@
 PACKAGE_URL = @PACKAGE_URL@
 PACKAGE_VERSION = @PACKAGE_VERSION@
 PATH_SEPARATOR = @PATH_SEPARATOR@
+PERL = @PERL@
+PERL_MAN3EXT = @PERL_MAN3EXT@
+PRINTF = @PRINTF@
 PRIVATE_LIBS = @PRIVATE_LIBS@
 PYTHON = @PYTHON@
 PYTHON_CPPFLAGS = @PYTHON_CPPFLAGS@
@@ -160,8 +204,12 @@ SET_MAKE = @SET_MAKE@
 SHELL = @SHELL@
 SLIM_CPPFLAGS = @SLIM_CPPFLAGS@
 SLIM_LDFLAGS = @SLIM_LDFLAGS@
+SLIM_LIBS = @SLIM_LIBS@
 STRIP = @STRIP@
 VERSION = @VERSION@
+ZZIP_CPPFLAGS = @ZZIP_CPPFLAGS@
+ZZIP_LDFLAGS = @ZZIP_LDFLAGS@
+ZZIP_LIBS = @ZZIP_LIBS@
 abs_builddir = @abs_builddir@
 abs_srcdir = @abs_srcdir@
 abs_top_builddir = @abs_top_builddir@
@@ -205,6 +253,8 @@ libexecdir = @libexecdir@
 localedir = @localedir@
 localstatedir = @localstatedir@
 mandir = @mandir@
+matlabbasedir = @matlabbasedir@
+mexext = @mexext@
 mkdir_p = @mkdir_p@
 moduledir = @moduledir@
 oldincludedir = @oldincludedir@
@@ -214,8 +264,12 @@ path_gunzip = @path_gunzip@
 path_gzip = @path_gzip@
 path_slim = @path_slim@
 path_unslim = @path_unslim@
+path_unzip = @path_unzip@
 path_xz = @path_xz@
+path_zip = @path_zip@
 pdfdir = @pdfdir@
+perldir = @perldir@
+perlmandir = @perlmandir@
 prefix = @prefix@
 program_transform_name = @program_transform_name@
 psdir = @psdir@
@@ -251,7 +305,7 @@ top_srcdir = @top_srcdir@
 #
 AUTOMAKE_OPTIONS = foreign
 @TEST_PYTHON_TRUE at TESTS_ENVIRONMENT = ${DL_LIBRARY_PATH}=${${DL_LIBRARY_PATH}}:../../../src/.libs PYTHONPATH=../.libs/ ${PYTHON}
- at TEST_PYTHON_TRUE@pyTESTS = big_test.py callback.py
+ at TEST_PYTHON_TRUE@pyTESTS = callback.py big_test.py
 @TEST_PYTHON_TRUE at TESTS = $(addprefix ${srcdir}/,$(pyTESTS))
 EXTRA_DIST = ${pyTESTS}
 all: all-am
@@ -381,14 +435,15 @@ check-TESTS: $(TESTS)
 	  fi; \
 	  dashes=`echo "$$dashes" | sed s/./=/g`; \
 	  if test "$$failed" -eq 0; then \
-	    echo "$$grn$$dashes"; \
+	    col="$$grn"; \
 	  else \
-	    echo "$$red$$dashes"; \
+	    col="$$red"; \
 	  fi; \
-	  echo "$$banner"; \
-	  test -z "$$skipped" || echo "$$skipped"; \
-	  test -z "$$report" || echo "$$report"; \
-	  echo "$$dashes$$std"; \
+	  echo "$${col}$$dashes$${std}"; \
+	  echo "$${col}$$banner$${std}"; \
+	  test -z "$$skipped" || echo "$${col}$$skipped$${std}"; \
+	  test -z "$$report" || echo "$${col}$$report$${std}"; \
+	  echo "$${col}$$dashes$${std}"; \
 	  test "$$failed" -eq 0; \
 	else :; fi
 
@@ -437,10 +492,15 @@ install-am: all-am
 
 installcheck: installcheck-am
 install-strip:
-	$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
-	  install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
-	  `test -z '$(STRIP)' || \
-	    echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+	if test -z '$(STRIP)'; then \
+	  $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+	    install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+	      install; \
+	else \
+	  $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+	    install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+	    "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
+	fi
 mostlyclean-generic:
 
 clean-generic:
diff --git a/bindings/python/test/big_test.py b/bindings/python/test/big_test.py
index eca0f2c..a8dbaf1 100644
--- a/bindings/python/test/big_test.py
+++ b/bindings/python/test/big_test.py
@@ -1,4 +1,4 @@
-# Copyright (C) 2009-2010 D. V. Wiebe
+# Copyright (C) 2009-2012 D. V. Wiebe
 #
 ##########################################################################
 #
@@ -20,6 +20,7 @@
 
 import sys
 import os
+import re
 import array
 import pygetdata
 
@@ -40,37 +41,43 @@ def CheckException(t,g):
   global ne
   if (sys.exc_type != g):
     ne+=1
-    print "e[", t, "] =", sys.exc_type
+    print "e[", t, "] =", sys.exc_type, "expected", g
 
 def CheckException2(t,m,g):
   global ne
   if (sys.exc_type != g):
     ne+=1
-    print "e[", t, ",", m, "] =", sys.exc_type
+    print "e[", t, ",", m, "] =", sys.exc_type, "expected", g
 
 def CheckNumpy(t,v,g):
   global ne
   if (numpy.any(v - g)):
     ne+=1
-    print "a[", t, "] =", v
+    print "a[", t, "] =", v, "expected", g
 
 def CheckNumpy2(t,m,v,g):
   global ne
   if (numpy.any(v - g)):
     ne+=1
-    print "a[", t, ",", m, "] =", v
+    print "a[", t, ",", m, "] =", v, "expected", g
 
 def CheckSimple(t,v,g):
   global ne
   if (v != g):
     ne+=1
-    print "n[", t, "] =", v
+    print "n[", t, "] =", v, "expected", g
 
 def CheckSimple2(t,m,v,g):
   global ne
   if (v != g):
     ne+=1
-    print "n[", t, ",", m, "] =", v
+    print "n[", t, ",", m, "] =", v, "expected", g
+
+def CheckEOS(t,v,g):
+  global ne
+  if (re.search(g + "$", v) == None):
+    ne+=1
+    print "n[", t, "] =", v, "expected", g
 
 # create the dirfile first
 data=array.array("B",range(1,81))
@@ -82,10 +89,11 @@ file.close()
 
 ne = 0
 
-fields = ["INDEX", "bit", "carray", "const", "data", "div", "lincom",
-"linterp", "mult", "phase", "polynom", "recip", "sbit", "string"]
+fields = ["INDEX", "alias", "bit", "carray", "const", "data", "div", "lincom",
+"linterp", "mplex", "mult", "phase", "polynom", "recip", "sbit", "string",
+"window"]
 
-nfields = 14
+nfields = 17
 file=open("dirfile/format", 'w')
 file.write(
     "/ENDIAN little\n"
@@ -93,17 +101,21 @@ file.write(
     "lincom LINCOM data 1.1 2.2 INDEX 2.2 3.3;4.4 linterp const const\n"
     "/META data mstr STRING \"This is a string constant.\"\n"
     "/META data mconst CONST COMPLEX128 3.3;4.4\n"
+    "/META data mcarray CARRAY FLOAT64 1.9 2.8 3.7 4.6 5.5\n"
     "/META data mlut LINTERP DATA ./lut\n"
     "const CONST FLOAT64 5.5\n"
     "carray CARRAY FLOAT64 1.1 2.2 3.3 4.4 5.5 6.6\n"
-    "linterp LINTERP data /look/up/file\n"
+    "linterp LINTERP data ./lut\n"
     "polynom POLYNOM data 1.1 2.2 2.2 3.3;4.4 const const\n"
     "bit BIT data 3 4\n"
     "sbit SBIT data 5 6\n"
+    "mplex MPLEX data sbit 1 10\n"
     "mult MULTIPLY data sbit\n"
     "div DIVIDE mult bit\n"
     "recip RECIP div 6.5;4.3\n"
     "phase PHASE data 11\n"
+    "window WINDOW linterp mult LT 4.1\n"
+    "/ALIAS alias data\n"
     "string STRING \"Zaphod Beeblebrox\"\n"
     )
 file.close()
@@ -215,14 +227,14 @@ try:
   n = d.nmfields("data")
 except:
   CheckOK(9)
-CheckSimple(9,n,3)
+CheckSimple(9,n,4)
 
 # 10: mfield_list check
 try:
   n = d.mfield_list("data")
 except:
   CheckOK(10)
-CheckSimple(10,n,["mstr", "mconst", "mlut"])
+CheckSimple(10,n,["mstr", "mconst", "mcarray", "mlut"])
 
 # 11: nframes check
 try:
@@ -296,7 +308,7 @@ except:
 CheckSimple2(122,2,n,[41, 33, 34, 35, 36, 46, 47, 48])
 
 # 124: putdata (complex) check
-p = [ 43.+0j, 44.+0j, 45.+0j, 46.+0j ]
+p = [ 124.+1j, 125.+2j, 126.+3j, 127.+4j ]
 try:
   n = d.putdata("data", p, pygetdata.COMPLEX, first_frame=5, first_sample=1)
 except:
@@ -307,7 +319,7 @@ try:
   n = d.getdata("data", pygetdata.INT, first_frame=5, num_frames=1, as_list=1)
 except:
   CheckOK2(124,2)
-CheckSimple2(124,2,n,[41, 43, 44, 45, 46, 46, 47, 48])
+CheckSimple2(124,2,n,[41, 124, 125, 126, 127, 46, 47, 48])
 
 # 136: putdata (auto) check
 p = [ 53.+0j, 54.+0j, 55.+0j, 56.+0j ]
@@ -376,7 +388,7 @@ CheckSimple2(21,1,ent.field_type,pygetdata.LINTERP_ENTRY)
 CheckSimple2(21,2,ent.field_type_name,"LINTERP_ENTRY")
 CheckSimple2(21,3,ent.fragment,0)
 CheckSimple2(21,4,ent.in_fields,( "data", ))
-CheckSimple2(21,5,ent.table,"/look/up/file")
+CheckSimple2(21,5,ent.table,"./lut")
 
 # 22: entry (bit) check
 try:
@@ -551,15 +563,15 @@ except:
   CheckOK2(35,1)
 
 try:
-  ent = d.entry("sbit")
+  ent = d.entry("new8")
 except:
   CheckOK2(35,2)
 CheckSimple2(35,1,ent.field_type,pygetdata.SBIT_ENTRY)
 CheckSimple2(35,2,ent.field_type_name,"SBIT_ENTRY")
 CheckSimple2(35,3,ent.fragment,0)
-CheckSimple2(35,4,ent.in_fields,( "data", ))
-CheckSimple2(35,5,ent.numbits,6)
-CheckSimple2(35,6,ent.bitnum,5)
+CheckSimple2(35,4,ent.in_fields,( "in2", ))
+CheckSimple2(35,5,ent.bitnum,14)
+CheckSimple2(35,6,ent.numbits,15)
 
 # 36: add / entry (mult) check
 ent = pygetdata.entry(pygetdata.MULTIPLY_ENTRY, "new9", 0, ("in1", "in2"))
@@ -616,7 +628,7 @@ try:
   f = d.fragment(0)
 except:
   CheckOK(39)
-CheckSimple(39,f.name,"dirfile/format")
+CheckEOS(39,f.name,"dirfile/format")
 
 # 40: nfragments check
 try:
@@ -657,16 +669,16 @@ try:
   n = d.nvectors()
 except:
   CheckOK(44)
-CheckSimple(44,n,19)
+CheckSimple(44,n,22)
 
 # 45: field_list check
 try:
   n = d.vector_list()
 except:
   CheckOK(45)
-CheckSimple(45,n,['INDEX', 'bit', 'data', 'div', 'lincom', 'linterp', 'mult',
-  'new1', 'new10', 'new2', 'new4', 'new6', 'new7', 'new8', 'new9', 'phase',
-  'polynom', 'recip', 'sbit'])
+CheckSimple(45,n,['INDEX', 'alias', 'bit', 'data', 'div', 'lincom', 'linterp',
+  'mplex', 'mult', 'new1', 'new10', 'new2', 'new4', 'new6', 'new7', 'new8',
+  'new9', 'phase', 'polynom', 'recip', 'sbit', 'window'])
 
 # 46: add / entry (lincom) check
 ent = pygetdata.entry(pygetdata.LINCOM_ENTRY, "mnew1", 0,
@@ -948,14 +960,14 @@ except:
   CheckOK(64)
 CheckSimple(64,n,["mnew1"])
 
-# 65: nmfields_by_type check
+# 65: nmvectors check
 try:
   n = d.nmvectors("data")
 except:
   CheckOK(65)
 CheckSimple(65,n,8)
 
-# 66: mfield_list_by_type check
+# 66: mvector_list check
 try:
   n = d.mvector_list("data")
 except:
@@ -998,7 +1010,7 @@ except:
 
 # 80: dirfilename check
 try:
-  CheckSimple(80,d.name,"dirfile")
+  CheckEOS(80,d.name,"dirfile")
 except:
   CheckOK(80)
 
@@ -1027,7 +1039,7 @@ try:
   n = d.raw_filename("data")
 except:
   CheckOK(84)
-CheckSimple(84,n,"dirfile/data")
+CheckEOS(84,n,"dirfile/data")
 
 # 85: reference check
 try:
@@ -1111,7 +1123,7 @@ CheckSimple2(92,2,ent.field_type_name,"MULTIPLY_ENTRY")
 CheckSimple2(92,3,ent.fragment,1)
 CheckSimple2(92,4,ent.in_fields,( "in1", "in2"))
 
-# 93: move check
+# 93: rename check
 try:
   d.rename("new9", "newer", 0)
 except:
@@ -1233,7 +1245,7 @@ CheckSimple2(146,1,ent.field_type,pygetdata.DIVIDE_ENTRY)
 CheckSimple2(146,2,ent.fragment,0)
 CheckSimple2(146,3,ent.in_fields,( "in1", "in2"))
 
-# 148: add / entry (divide) check
+# 148: add / entry (recip) check
 ent = pygetdata.entry(pygetdata.RECIP_ENTRY, "new16", 0, ("in3", 33.3))
 try:
   d.add(ent)
@@ -1249,7 +1261,7 @@ CheckSimple2(148,2,ent.fragment,0)
 CheckSimple2(148,3,ent.in_fields,( "in3",))
 CheckSimple2(148,4,ent.dividend,33.3)
 
-# 149: add / entry (mult) check
+# 149: madd / entry (div) check
 ent = pygetdata.entry(pygetdata.DIVIDE_ENTRY, "mnew14", 0,
     {"in_field1": "in3", "in_field2": "in2"})
 try:
@@ -1265,7 +1277,7 @@ CheckSimple2(149,1,ent.field_type,pygetdata.DIVIDE_ENTRY)
 CheckSimple2(149,2,ent.fragment,0)
 CheckSimple2(149,3,ent.in_fields,( "in3", "in2"))
 
-# 151: add / entry (mult) check
+# 151: madd / entry (recip) check
 ent = pygetdata.entry(pygetdata.RECIP_ENTRY, "mnew16", 0,
     {"in_field": "in3", "dividend": "const"})
 try:
@@ -1290,7 +1302,7 @@ except:
 
 # 156: invalid dirfile check
 try:
-  m = pygetdata.dirfile(None);
+  m = pygetdata.dirfile(None)
 except:
   CheckOK2(156,1)
 
@@ -1300,21 +1312,21 @@ except:
   CheckException2(156,2,pygetdata.BadDirfileError)
 
 try:
-  m.discard();
+  m.discard()
 except:
-  pass;
+  pass
 
 # 157: standards version
 try:
-  n = d.standards;
+  n = d.standards
 except:
-  CheckOK2(157,1);
-CheckSimple(157,n,8)
+  CheckOK2(157,1)
+CheckSimple(157,n,9)
 
 try:
-  d.standards = 0;
+  d.standards = 0
 except:
-  CheckException2(157,2,pygetdata.BadVersionError)
+  CheckException2(157,2,pygetdata.ArgumentError)
 
 # 158: gd_get_carray
 try:
@@ -1380,7 +1392,7 @@ except:
 CheckSimple2(167,1,len(n),1)
 if (pygetdata.__numpy_supported__):
   CheckSimple2(167,2,n[0][0],"carray")
-  CheckNumpy2(167,2,n[0][1],numpy.arange(1,7))
+  CheckNumpy2(167,3,n[0][1],numpy.arange(1,7))
 else:
   CheckSimple(167,n,[("carray", [1,2,3,4,5,6])])
 
@@ -1521,6 +1533,498 @@ CheckSimple2(180,4,ent.data_type,pygetdata.FLOAT64)
 CheckSimple2(180,5,ent.data_type_name,"FLOAT64")
 CheckSimple2(180,6,ent.array_len,2)
 
+# 183: gd_constants (int)
+try:
+  n = d.constants(pygetdata.INT)
+except:
+  CheckOK(183)
+CheckSimple(183,n,[('const', 133), ('new11', 0)])
+
+# 186: gd_constants (long)
+try:
+  n = d.constants(pygetdata.LONG)
+except:
+  CheckOK(186)
+CheckSimple(186,n,[('const', 133L), ('new11', 0L)])
+
+# 188: gd_constants (float)
+try:
+  n = d.constants(pygetdata.FLOAT)
+except:
+  CheckOK(188)
+CheckSimple(188,n,[('const', 133.0), ('new11', 0.0)])
+
+# 190: gd_constants (complex)
+try:
+  n = d.constants(pygetdata.COMPLEX)
+except:
+  CheckOK(190)
+CheckSimple(190,n,[('const', 133.0), ('new11', 0.0)])
+
+# 191: gd_constants (int)
+try:
+  n = d.mconstants("data", pygetdata.INT)
+except:
+  CheckOK(191)
+CheckSimple(191,n,[('mconst', 3), ('mnew11', 0)])
+
+# 194: gd_constants (long)
+try:
+  n = d.mconstants("data", pygetdata.LONG)
+except:
+  CheckOK(194)
+CheckSimple(194,n,[('mconst', 3L), ('mnew11', 0L)])
+
+# 196: gd_constants (float)
+try:
+  n = d.mconstants("data", pygetdata.FLOAT)
+except:
+  CheckOK(196)
+CheckSimple(196,n,[('mconst', 3.3), ('mnew11', 0.)])
+
+# 198: gd_constants (complex)
+try:
+  n = d.mconstants("data", pygetdata.COMPLEX)
+except:
+  CheckOK(198)
+CheckSimple(198,n,[('mconst', 3.3+4.4j), ('mnew11', 0j)])
+
+# 199: gd_strings
+try:
+  n = d.strings()
+except:
+  CheckOK(199)
+CheckSimple(199,n,[('lorem', 'Lorem ipsum'), ('new12', ''), 
+  ('string', 'Arthur Dent')])
+
+# 200: gd_strings
+try:
+  n = d.mstrings("data")
+except:
+  CheckOK(200)
+CheckSimple(200,n,[('mstr', 'This is a string constant.')])
+
+# 203: gd_seek
+try:
+  n = d.seek("data", pygetdata.SEEK_SET, frame_num=35)
+except:
+  CheckOK2(203,0)
+
+try:
+  m = d.getdata("data", pygetdata.INT, first_frame=pygetdata.HERE, num_frames=1)
+except:
+  CheckOK2(203,1)
+CheckSimple2(203,0,n,280)
+CheckSimple2(203,1,len(m),8)
+if (pygetdata.__numpy_supported__):
+  CheckNumpy2(203,2,m,numpy.arange(17,25))
+else:
+  CheckSimple2(203,2,m,range(17,25))
+
+# 204: gd_tell
+try:
+  n = d.tell("data")
+except:
+  CheckOK(204)
+CheckSimple(204,n,288)
+
+# 205: gd_hide check
+try:
+  d.hide('data')
+except:
+  CheckOK(205)
+
+# 206: gd_hidden check
+try:
+  n = d.hidden('data')
+except:
+  CheckOK2(206, 1)
+CheckSimple2(206, 1, n, 1)
+
+try:
+  n = d.hidden('lincom')
+except:
+  CheckOK2(206, 2)
+CheckSimple2(206, 2, n, 0)
+
+# 207: gd_unhide check
+try:
+  d.unhide('data')
+except:
+  CheckOK2(206, 1)
+
+try:
+  n = d.hidden('data')
+except:
+  CheckOK2(206, 2)
+CheckSimple(206, n, 0)
+
+# 208: gd_sync check
+try:
+  d.sync('data')
+except:
+  CheckOK(208)
+
+# 209: gd_flush check
+try:
+  d.flush('data')
+except:
+  CheckOK(209)
+
+# 210: gd_metaflush check
+try:
+  d.metaflush()
+except:
+  CheckOK(210)
+
+# 211: gd_entry (WINDOW) check
+try:
+  ent = d.entry('window')
+except:
+  CheckOK(211)
+CheckSimple2(211, 1, ent.field_type, pygetdata.WINDOW_ENTRY)
+CheckSimple2(211, 2, ent.fragment, 0)
+CheckSimple2(211, 3, ent.windop, pygetdata.WINDOP_LT)
+CheckSimple2(211, 4, ent.in_fields, ( 'linterp', 'mult' ))
+CheckSimple2(211, 5, ent.threshold, 4.1)
+
+# 212: gd_add_window check
+ent = pygetdata.entry(pygetdata.WINDOW_ENTRY, "new18", 0,
+    ("in1", "in2", pygetdata.WINDOP_NE, 32))
+try:
+  d.add(ent)
+except:
+  CheckOK2(212, 1)
+
+try:
+  ent = d.entry('new18')
+except:
+  CheckOK2(212, 2)
+CheckSimple2(212, 1, ent.field_type, pygetdata.WINDOW_ENTRY)
+CheckSimple2(212, 2, ent.fragment, 0)
+CheckSimple2(212, 3, ent.windop, pygetdata.WINDOP_NE)
+CheckSimple2(212, 4, ent.in_fields, ( 'in1', 'in2' ))
+CheckSimple2(212, 5, ent.threshold, 32)
+
+# 214: gd_madd_window check
+ent = pygetdata.entry(pygetdata.WINDOW_ENTRY, "mnew18", 0,
+    ("in2", "in3", pygetdata.WINDOP_SET, 128))
+try:
+  d.madd(ent, "data")
+except:
+  CheckOK2(214, 1)
+
+try:
+  ent = d.entry('data/mnew18')
+except:
+  CheckOK2(214, 2)
+CheckSimple2(214, 1, ent.field_type, pygetdata.WINDOW_ENTRY)
+CheckSimple2(214, 2, ent.fragment, 0)
+CheckSimple2(214, 3, ent.windop, pygetdata.WINDOP_SET)
+CheckSimple2(214, 4, ent.in_fields, ( 'in2', 'in3' ))
+CheckSimple2(214, 5, ent.threshold, 128)
+
+# 217: gd_alter_window check
+ent = pygetdata.entry(pygetdata.WINDOW_ENTRY, "new18", 0, { "threshold": 32e3,
+  "in_field1": "in3", "in_field2": "in4", "windop": pygetdata.WINDOP_GE })
+try:
+  d.alter('new18', ent)
+except:
+  CheckOK2(217, 1)
+
+try:
+  ent = d.entry('new18')
+except:
+  CheckOK2(217, 2)
+CheckSimple2(217, 1, ent.field_type, pygetdata.WINDOW_ENTRY)
+CheckSimple2(217, 2, ent.fragment, 0)
+CheckSimple2(217, 3, ent.windop, pygetdata.WINDOP_GE)
+CheckSimple2(217, 4, ent.in_fields, ( 'in3', 'in4' ))
+CheckSimple2(217, 5, ent.threshold, 32e3)
+
+# 218: gd_alias_target check
+try:
+  str = d.alias_target('alias')
+except:
+  CheckOK(218)
+CheckSimple(218, str, 'data')
+
+# 219: gd_add_alias check
+try:
+  d.add_alias('new20', 'data', 0)
+except:
+  CheckOK2(219, 1)
+
+try:
+  str = d.alias_target('new20')
+except:
+  CheckOK2(219, 2)
+CheckSimple(219, str, 'data')
+
+# 220: gd_madd_alias check
+try:
+  d.madd_alias('data', 'mnew20', 'data')
+except:
+  CheckOK2(220, 1)
+
+try:
+  str = d.alias_target('data/mnew20')
+except:
+  CheckOK2(220, 2)
+CheckSimple(220, str, 'data')
+
+# 221: gd_naliases check
+try:
+  n = d.naliases('data')
+except:
+  CheckOK(221)
+CheckSimple(221, n, 4)
+
+# 222: gd_aliases check
+try:
+  n = d.aliases('data')
+except:
+  CheckOK(222)
+CheckSimple(222, n, [ 'data', 'alias', 'data/mnew20', 'new20' ])
+
+# 223: gd_include_affix check
+try:
+  d.include('format1', 0, prefix='A', suffix='Z',
+      flags=pygetdata.CREAT | pygetdata.EXCL)
+except:
+  CheckOK(223)
+
+# 224: gd_move_alias check
+try:
+  d.move_alias('new20', 1)
+except:
+  CheckOK2(224, 1)
+
+try:
+  n = d.fragment_index('Anew20Z')
+except:
+  CheckOK2(224, 2)
+CheckSimple(224, n, 1)
+
+# 225: gd_delete_alias check
+try:
+  d.delete_alias('Anew20Z', 0)
+except:
+  CheckOK2(225, 1)
+
+try:
+  n = d.fragment_index('Anew20Z')
+except:
+  CheckException2(255, 2, pygetdata.BadCodeError)
+
+# 226: gd_fragment_affixes check
+try:
+  n = d.fragment(1).prefix
+  m = d.fragment(1).suffix
+except:
+  CheckOK(226)
+CheckSimple2(226, 1, n, "A")
+CheckSimple2(226, 2, m, "Z")
+
+# 227: gd_alter_affixes check
+try:
+  d.fragment(1).prefix = "B"
+  d.fragment(1).suffix = ""
+except:
+  CheckOK2(227, 1)
+
+try:
+  n = d.fragment(1).prefix
+  m = d.fragment(1).suffix
+except:
+  CheckOK2(227, 2)
+CheckSimple2(227, 1, n, "B")
+CheckSimple2(227, 2, m, "")
+
+# 228: gd_entry (MPLEX) check
+try:
+  ent = d.entry('mplex')
+except:
+  CheckOK(228)
+CheckSimple2(228, 1, ent.field_type, pygetdata.MPLEX_ENTRY)
+CheckSimple2(228, 2, ent.fragment, 0)
+CheckSimple2(228, 3, ent.count_val, 1)
+CheckSimple2(228, 4, ent.in_fields, ( 'data', 'sbit' ))
+CheckSimple2(228, 5, ent.period, 10)
+
+# 229: gd_add_mplex check
+ent = pygetdata.entry(pygetdata.MPLEX_ENTRY, "new21", 0, ("in1", "in2", 5, 6))
+try:
+  d.add(ent)
+except:
+  CheckOK2(229, 1)
+
+try:
+  ent = d.entry('new21')
+except:
+  CheckOK2(229, 2)
+CheckSimple2(229, 1, ent.field_type, pygetdata.MPLEX_ENTRY)
+CheckSimple2(229, 2, ent.fragment, 0)
+CheckSimple2(229, 3, ent.count_val, 5)
+CheckSimple2(229, 4, ent.in_fields, ( 'in1', 'in2' ))
+CheckSimple2(229, 5, ent.period, 6)
+
+# 230: gd_madd_mplex check
+ent = pygetdata.entry(pygetdata.MPLEX_ENTRY, "mnew21", 0, ("in2", "in3", 0, 12))
+try:
+  d.madd(ent, "data")
+except:
+  CheckOK2(230, 1)
+
+try:
+  ent = d.entry('data/mnew21')
+except:
+  CheckOK2(230, 2)
+CheckSimple2(230, 1, ent.field_type, pygetdata.MPLEX_ENTRY)
+CheckSimple2(230, 2, ent.fragment, 0)
+CheckSimple2(230, 3, ent.count_val, 0)
+CheckSimple2(230, 4, ent.in_fields, ( 'in2', 'in3' ))
+CheckSimple2(230, 5, ent.period, 12)
+
+# 231: gd_alter_mplex check
+ent = pygetdata.entry(pygetdata.MPLEX_ENTRY, "new21", 0, { "count_val": 3,
+  "in_field1": "in3", "in_field2": "in4", "period": 7 })
+try:
+  d.alter('new21', ent)
+except:
+  CheckOK2(231, 1)
+
+try:
+  ent = d.entry('new21')
+except:
+  CheckOK2(231, 2)
+CheckSimple2(231, 1, ent.field_type, pygetdata.MPLEX_ENTRY)
+CheckSimple2(231, 2, ent.fragment, 0)
+CheckSimple2(231, 3, ent.count_val, 3)
+CheckSimple2(231, 4, ent.in_fields, ( 'in3', 'in4' ))
+CheckSimple2(231, 5, ent.period, 7)
+
+# 232: gd_strtok check
+try:
+  str = d.strtok("\"test1 test2\" test3\ test4")
+except:
+  CheckOK2(232, 1)
+CheckSimple2(232, 2, str, "test1 test2")
+
+try:
+  str = d.strtok()
+except:
+  CheckOK2(232, 3)
+CheckSimple2(232, 4, str, "test3 test4")
+
+# 233: gd_raw_close check
+try:
+  d.raw_close('data')
+except:
+  CheckOK(233)
+
+# 234: gd_desync check
+try:
+  n = d.desync()
+except:
+  CheckOK(234)
+CheckSimple(234, n, 0)
+
+# 235: gd_flags check
+try:
+  d.flags = pygetdata.PRETTY_PRINT
+except:
+  CheckOK2(235,1)
+
+try:
+  CheckSimple(235, d.flags, pygetdata.PRETTY_PRINT)
+except:
+  CheckOK2(235,2)
+
+# 236: gd_verbose_prefix check
+try:
+  CheckSimple(236, d.verbose_prefix, None)
+except:
+  CheckOK2(236, 1)
+
+try:
+  d.verbose_prefix = "big_test: "
+except:
+  CheckOK2(236, 2)
+CheckSimple(236, d.verbose_prefix, "big_test: ")
+
+# 237: gd_nentries check
+try:
+  n = d.nentries("data", pygetdata.SCALAR_ENTRIES,
+      pygetdata.ENTRIES_HIDDEN | pygetdata.ENTRIES_NOALIAS)
+except:
+  CheckOK2(237, 1)
+CheckSimple2(237, 1, n, 5)
+try:
+  n = d.nentries(type = pygetdata.VECTOR_ENTRIES,
+      flags = pygetdata.ENTRIES_HIDDEN | pygetdata.ENTRIES_NOALIAS)
+except:
+  CheckOK2(237, 2)
+CheckSimple2(237, 2, n, 23)
+
+# 239: gd_entry_list check
+try:
+  n = d.entry_list(type = pygetdata.VECTOR_ENTRIES,
+      flags = pygetdata.ENTRIES_HIDDEN | pygetdata.ENTRIES_NOALIAS)
+except:
+  CheckOK(239)
+CheckSimple(239,n, ['INDEX', 'bit', 'data', 'div', 'lincom', 'linterp',
+  'mplex', 'mult', 'new1', 'new14', 'new16', 'new18', 'new2', 'new21', 'new4',
+  'new6', 'new7', 'new8', 'phase', 'polynom', 'recip', 'sbit', 'window'])
+
+# 240: gd_mplex_lookback check
+try:
+  d.mplex_lookback = pygetdata.LOOKBACK_ALL
+except:
+  CheckOK(240, 1)
+
+try:
+  n = d.mplex_lookback
+except:
+  CheckOK2(240, 2)
+CheckSimple(240, n, pygetdata.LOOKBACK_ALL)
+
+# 241: linterp_tablename check
+try:
+  n = d.linterp_tablename("linterp")
+except:
+  CheckOK(241)
+CheckEOS(241,n,"dirfile/lut")
+
+# 242: mcarrays
+try:
+  n = d.mcarrays("data", pygetdata.FLOAT)
+except:
+  CheckOK(242)
+
+CheckSimple2(242,1,len(n),2)
+if (pygetdata.__numpy_supported__):
+  CheckSimple2(242,2,n[0][0],"mcarray")
+  CheckNumpy2(242,3,n[0][1],1.9 + 0.9 * numpy.arange(0,5))
+  CheckSimple2(242,4,n[1][0],"mnew17")
+  CheckNumpy2(242,5,n[1][1],[0,0])
+else:
+  CheckSimple(242,n,[("mcarray", [1.9, 2.8, 3.7, 4.6, 5.5]), ("mnew17", [0,0])])
+
+
+
+
+
+
+
+
+
+
+
+
+# ==========================================================================
+
+d.discard()
 del d
 os.system("rm -rf dirfile")
 
diff --git a/bindings/python/test/callback.py b/bindings/python/test/callback.py
index 64d35b8..3aa58ac 100644
--- a/bindings/python/test/callback.py
+++ b/bindings/python/test/callback.py
@@ -1,5 +1,6 @@
 import sys
 import os
+import re
 import array
 import pygetdata
 
@@ -21,7 +22,7 @@ def parser_callback(pdata, extra):
     print "linenum =", pdata["linenum"]
     sys.exit(1);
 
-  if (pdata["filename"] != "dirfile/format"):
+  if (re.search("dirfile/format$", pdata["filename"]) == None):
     print "filename =", pdata["filename"]
     sys.exit(1);
 
diff --git a/config.guess b/config.guess
index dc84c68..d622a44 100755
--- a/config.guess
+++ b/config.guess
@@ -1,10 +1,10 @@
 #! /bin/sh
 # Attempt to guess a canonical system name.
 #   Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
-#   2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009
-#   Free Software Foundation, Inc.
+#   2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010,
+#   2011, 2012 Free Software Foundation, Inc.
 
-timestamp='2009-11-20'
+timestamp='2012-02-10'
 
 # This file is free software; you can redistribute it and/or modify it
 # under the terms of the GNU General Public License as published by
@@ -17,9 +17,7 @@ timestamp='2009-11-20'
 # General Public License for more details.
 #
 # You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA
-# 02110-1301, USA.
+# along with this program; if not, see <http://www.gnu.org/licenses/>.
 #
 # As a special exception to the GNU General Public License, if you
 # distribute this file as part of a program that contains a
@@ -56,8 +54,9 @@ version="\
 GNU config.guess ($timestamp)
 
 Originally written by Per Bothner.
-Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001,
-2002, 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
+Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
+2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012
+Free Software Foundation, Inc.
 
 This is free software; see the source for copying conditions.  There is NO
 warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
@@ -144,7 +143,7 @@ UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown
 case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
     *:NetBSD:*:*)
 	# NetBSD (nbsd) targets should (where applicable) match one or
-	# more of the tupples: *-*-netbsdelf*, *-*-netbsdaout*,
+	# more of the tuples: *-*-netbsdelf*, *-*-netbsdaout*,
 	# *-*-netbsdecoff* and *-*-netbsd*.  For targets that recently
 	# switched to ELF, *-*-netbsd* would select the old
 	# object file format.  This provides both forward
@@ -180,7 +179,7 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
 		fi
 		;;
 	    *)
-	        os=netbsd
+		os=netbsd
 		;;
 	esac
 	# The OS release
@@ -223,7 +222,7 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
 		UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'`
 		;;
 	*5.*)
-	        UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'`
+		UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'`
 		;;
 	esac
 	# According to Compaq, /usr/sbin/psrinfo has been available on
@@ -269,7 +268,10 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
 	# A Xn.n version is an unreleased experimental baselevel.
 	# 1.2 uses "1.2" for uname -r.
 	echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
-	exit ;;
+	# Reset EXIT trap before exiting to avoid spurious non-zero exit code.
+	exitcode=$?
+	trap '' 0
+	exit $exitcode ;;
     Alpha\ *:Windows_NT*:*)
 	# How do we know it's Interix rather than the generic POSIX subsystem?
 	# Should we change UNAME_MACHINE based on the output of uname instead
@@ -295,7 +297,7 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
 	echo s390-ibm-zvmoe
 	exit ;;
     *:OS400:*:*)
-        echo powerpc-ibm-os400
+	echo powerpc-ibm-os400
 	exit ;;
     arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*)
 	echo arm-acorn-riscix${UNAME_RELEASE}
@@ -394,23 +396,23 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
     # MiNT.  But MiNT is downward compatible to TOS, so this should
     # be no problem.
     atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*)
-        echo m68k-atari-mint${UNAME_RELEASE}
+	echo m68k-atari-mint${UNAME_RELEASE}
 	exit ;;
     atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*)
 	echo m68k-atari-mint${UNAME_RELEASE}
-        exit ;;
+	exit ;;
     *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*)
-        echo m68k-atari-mint${UNAME_RELEASE}
+	echo m68k-atari-mint${UNAME_RELEASE}
 	exit ;;
     milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*)
-        echo m68k-milan-mint${UNAME_RELEASE}
-        exit ;;
+	echo m68k-milan-mint${UNAME_RELEASE}
+	exit ;;
     hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*)
-        echo m68k-hades-mint${UNAME_RELEASE}
-        exit ;;
+	echo m68k-hades-mint${UNAME_RELEASE}
+	exit ;;
     *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*)
-        echo m68k-unknown-mint${UNAME_RELEASE}
-        exit ;;
+	echo m68k-unknown-mint${UNAME_RELEASE}
+	exit ;;
     m68k:machten:*:*)
 	echo m68k-apple-machten${UNAME_RELEASE}
 	exit ;;
@@ -480,8 +482,8 @@ EOF
 	echo m88k-motorola-sysv3
 	exit ;;
     AViiON:dgux:*:*)
-        # DG/UX returns AViiON for all architectures
-        UNAME_PROCESSOR=`/usr/bin/uname -p`
+	# DG/UX returns AViiON for all architectures
+	UNAME_PROCESSOR=`/usr/bin/uname -p`
 	if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110 ]
 	then
 	    if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \
@@ -494,7 +496,7 @@ EOF
 	else
 	    echo i586-dg-dgux${UNAME_RELEASE}
 	fi
- 	exit ;;
+	exit ;;
     M88*:DolphinOS:*:*)	# DolphinOS (SVR3)
 	echo m88k-dolphin-sysv3
 	exit ;;
@@ -551,7 +553,7 @@ EOF
 		echo rs6000-ibm-aix3.2
 	fi
 	exit ;;
-    *:AIX:*:[456])
+    *:AIX:*:[4567])
 	IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'`
 	if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then
 		IBM_ARCH=rs6000
@@ -594,52 +596,52 @@ EOF
 	    9000/[678][0-9][0-9])
 		if [ -x /usr/bin/getconf ]; then
 		    sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null`
-                    sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null`
-                    case "${sc_cpu_version}" in
-                      523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0
-                      528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1
-                      532)                      # CPU_PA_RISC2_0
-                        case "${sc_kernel_bits}" in
-                          32) HP_ARCH="hppa2.0n" ;;
-                          64) HP_ARCH="hppa2.0w" ;;
+		    sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null`
+		    case "${sc_cpu_version}" in
+		      523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0
+		      528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1
+		      532)                      # CPU_PA_RISC2_0
+			case "${sc_kernel_bits}" in
+			  32) HP_ARCH="hppa2.0n" ;;
+			  64) HP_ARCH="hppa2.0w" ;;
 			  '') HP_ARCH="hppa2.0" ;;   # HP-UX 10.20
-                        esac ;;
-                    esac
+			esac ;;
+		    esac
 		fi
 		if [ "${HP_ARCH}" = "" ]; then
 		    eval $set_cc_for_build
-		    sed 's/^              //' << EOF >$dummy.c
+		    sed 's/^		//' << EOF >$dummy.c
 
-              #define _HPUX_SOURCE
-              #include <stdlib.h>
-              #include <unistd.h>
+		#define _HPUX_SOURCE
+		#include <stdlib.h>
+		#include <unistd.h>
 
-              int main ()
-              {
-              #if defined(_SC_KERNEL_BITS)
-                  long bits = sysconf(_SC_KERNEL_BITS);
-              #endif
-                  long cpu  = sysconf (_SC_CPU_VERSION);
+		int main ()
+		{
+		#if defined(_SC_KERNEL_BITS)
+		    long bits = sysconf(_SC_KERNEL_BITS);
+		#endif
+		    long cpu  = sysconf (_SC_CPU_VERSION);
 
-                  switch (cpu)
-              	{
-              	case CPU_PA_RISC1_0: puts ("hppa1.0"); break;
-              	case CPU_PA_RISC1_1: puts ("hppa1.1"); break;
-              	case CPU_PA_RISC2_0:
-              #if defined(_SC_KERNEL_BITS)
-              	    switch (bits)
-              		{
-              		case 64: puts ("hppa2.0w"); break;
-              		case 32: puts ("hppa2.0n"); break;
-              		default: puts ("hppa2.0"); break;
-              		} break;
-              #else  /* !defined(_SC_KERNEL_BITS) */
-              	    puts ("hppa2.0"); break;
-              #endif
-              	default: puts ("hppa1.0"); break;
-              	}
-                  exit (0);
-              }
+		    switch (cpu)
+			{
+			case CPU_PA_RISC1_0: puts ("hppa1.0"); break;
+			case CPU_PA_RISC1_1: puts ("hppa1.1"); break;
+			case CPU_PA_RISC2_0:
+		#if defined(_SC_KERNEL_BITS)
+			    switch (bits)
+				{
+				case 64: puts ("hppa2.0w"); break;
+				case 32: puts ("hppa2.0n"); break;
+				default: puts ("hppa2.0"); break;
+				} break;
+		#else  /* !defined(_SC_KERNEL_BITS) */
+			    puts ("hppa2.0"); break;
+		#endif
+			default: puts ("hppa1.0"); break;
+			}
+		    exit (0);
+		}
 EOF
 		    (CCOPTS= $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy`
 		    test -z "$HP_ARCH" && HP_ARCH=hppa
@@ -730,22 +732,22 @@ EOF
 	exit ;;
     C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*)
 	echo c1-convex-bsd
-        exit ;;
+	exit ;;
     C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*)
 	if getsysinfo -f scalar_acc
 	then echo c32-convex-bsd
 	else echo c2-convex-bsd
 	fi
-        exit ;;
+	exit ;;
     C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*)
 	echo c34-convex-bsd
-        exit ;;
+	exit ;;
     C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*)
 	echo c38-convex-bsd
-        exit ;;
+	exit ;;
     C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*)
 	echo c4-convex-bsd
-        exit ;;
+	exit ;;
     CRAY*Y-MP:*:*:*)
 	echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
 	exit ;;
@@ -769,14 +771,14 @@ EOF
 	exit ;;
     F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*)
 	FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
-        FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
-        FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'`
-        echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
-        exit ;;
+	FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
+	FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'`
+	echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
+	exit ;;
     5000:UNIX_System_V:4.*:*)
-        FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
-        FUJITSU_REL=`echo ${UNAME_RELEASE} | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/ /_/'`
-        echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
+	FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
+	FUJITSU_REL=`echo ${UNAME_RELEASE} | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/ /_/'`
+	echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
 	exit ;;
     i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*)
 	echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE}
@@ -788,13 +790,12 @@ EOF
 	echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE}
 	exit ;;
     *:FreeBSD:*:*)
-	case ${UNAME_MACHINE} in
-	    pc98)
-		echo i386-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
+	UNAME_PROCESSOR=`/usr/bin/uname -p`
+	case ${UNAME_PROCESSOR} in
 	    amd64)
 		echo x86_64-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
 	    *)
-		echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
+		echo ${UNAME_PROCESSOR}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
 	esac
 	exit ;;
     i*:CYGWIN*:*)
@@ -803,15 +804,18 @@ EOF
     *:MINGW*:*)
 	echo ${UNAME_MACHINE}-pc-mingw32
 	exit ;;
+    i*:MSYS*:*)
+	echo ${UNAME_MACHINE}-pc-msys
+	exit ;;
     i*:windows32*:*)
-    	# uname -m includes "-pc" on this system.
-    	echo ${UNAME_MACHINE}-mingw32
+	# uname -m includes "-pc" on this system.
+	echo ${UNAME_MACHINE}-mingw32
 	exit ;;
     i*:PW*:*)
 	echo ${UNAME_MACHINE}-pc-pw32
 	exit ;;
     *:Interix*:*)
-    	case ${UNAME_MACHINE} in
+	case ${UNAME_MACHINE} in
 	    x86)
 		echo i586-pc-interix${UNAME_RELEASE}
 		exit ;;
@@ -857,6 +861,13 @@ EOF
     i*86:Minix:*:*)
 	echo ${UNAME_MACHINE}-pc-minix
 	exit ;;
+    aarch64:Linux:*:*)
+	echo ${UNAME_MACHINE}-unknown-linux-gnu
+	exit ;;
+    aarch64_be:Linux:*:*)
+	UNAME_MACHINE=aarch64_be
+	echo ${UNAME_MACHINE}-unknown-linux-gnu
+	exit ;;
     alpha:Linux:*:*)
 	case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in
 	  EV5)   UNAME_MACHINE=alphaev5 ;;
@@ -866,7 +877,7 @@ EOF
 	  EV6)   UNAME_MACHINE=alphaev6 ;;
 	  EV67)  UNAME_MACHINE=alphaev67 ;;
 	  EV68*) UNAME_MACHINE=alphaev68 ;;
-        esac
+	esac
 	objdump --private-headers /bin/sh | grep -q ld.so.1
 	if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi
 	echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC}
@@ -878,20 +889,29 @@ EOF
 	then
 	    echo ${UNAME_MACHINE}-unknown-linux-gnu
 	else
-	    echo ${UNAME_MACHINE}-unknown-linux-gnueabi
+	    if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \
+		| grep -q __ARM_PCS_VFP
+	    then
+		echo ${UNAME_MACHINE}-unknown-linux-gnueabi
+	    else
+		echo ${UNAME_MACHINE}-unknown-linux-gnueabihf
+	    fi
 	fi
 	exit ;;
     avr32*:Linux:*:*)
 	echo ${UNAME_MACHINE}-unknown-linux-gnu
 	exit ;;
     cris:Linux:*:*)
-	echo cris-axis-linux-gnu
+	echo ${UNAME_MACHINE}-axis-linux-gnu
 	exit ;;
     crisv32:Linux:*:*)
-	echo crisv32-axis-linux-gnu
+	echo ${UNAME_MACHINE}-axis-linux-gnu
 	exit ;;
     frv:Linux:*:*)
-    	echo frv-unknown-linux-gnu
+	echo ${UNAME_MACHINE}-unknown-linux-gnu
+	exit ;;
+    hexagon:Linux:*:*)
+	echo ${UNAME_MACHINE}-unknown-linux-gnu
 	exit ;;
     i*86:Linux:*:*)
 	LIBC=gnu
@@ -933,7 +953,7 @@ EOF
 	test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; }
 	;;
     or32:Linux:*:*)
-	echo or32-unknown-linux-gnu
+	echo ${UNAME_MACHINE}-unknown-linux-gnu
 	exit ;;
     padre:Linux:*:*)
 	echo sparc-unknown-linux-gnu
@@ -959,7 +979,7 @@ EOF
 	echo ${UNAME_MACHINE}-ibm-linux
 	exit ;;
     sh64*:Linux:*:*)
-    	echo ${UNAME_MACHINE}-unknown-linux-gnu
+	echo ${UNAME_MACHINE}-unknown-linux-gnu
 	exit ;;
     sh*:Linux:*:*)
 	echo ${UNAME_MACHINE}-unknown-linux-gnu
@@ -967,14 +987,17 @@ EOF
     sparc:Linux:*:* | sparc64:Linux:*:*)
 	echo ${UNAME_MACHINE}-unknown-linux-gnu
 	exit ;;
+    tile*:Linux:*:*)
+	echo ${UNAME_MACHINE}-unknown-linux-gnu
+	exit ;;
     vax:Linux:*:*)
 	echo ${UNAME_MACHINE}-dec-linux-gnu
 	exit ;;
     x86_64:Linux:*:*)
-	echo x86_64-unknown-linux-gnu
+	echo ${UNAME_MACHINE}-unknown-linux-gnu
 	exit ;;
     xtensa*:Linux:*:*)
-    	echo ${UNAME_MACHINE}-unknown-linux-gnu
+	echo ${UNAME_MACHINE}-unknown-linux-gnu
 	exit ;;
     i*86:DYNIX/ptx:4*:*)
 	# ptx 4.0 does uname -s correctly, with DYNIX/ptx in there.
@@ -983,11 +1006,11 @@ EOF
 	echo i386-sequent-sysv4
 	exit ;;
     i*86:UNIX_SV:4.2MP:2.*)
-        # Unixware is an offshoot of SVR4, but it has its own version
-        # number series starting with 2...
-        # I am not positive that other SVR4 systems won't match this,
+	# Unixware is an offshoot of SVR4, but it has its own version
+	# number series starting with 2...
+	# I am not positive that other SVR4 systems won't match this,
 	# I just have to hope.  -- rms.
-        # Use sysv4.2uw... so that sysv4* matches it.
+	# Use sysv4.2uw... so that sysv4* matches it.
 	echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION}
 	exit ;;
     i*86:OS/2:*:*)
@@ -1019,7 +1042,7 @@ EOF
 	fi
 	exit ;;
     i*86:*:5:[678]*)
-    	# UnixWare 7.x, OpenUNIX and OpenServer 6.
+	# UnixWare 7.x, OpenUNIX and OpenServer 6.
 	case `/bin/uname -X | grep "^Machine"` in
 	    *486*)	     UNAME_MACHINE=i486 ;;
 	    *Pentium)	     UNAME_MACHINE=i586 ;;
@@ -1047,13 +1070,13 @@ EOF
 	exit ;;
     pc:*:*:*)
 	# Left here for compatibility:
-        # uname -m prints for DJGPP always 'pc', but it prints nothing about
-        # the processor, so we play safe by assuming i586.
+	# uname -m prints for DJGPP always 'pc', but it prints nothing about
+	# the processor, so we play safe by assuming i586.
 	# Note: whatever this is, it MUST be the same as what config.sub
 	# prints for the "djgpp" host, or else GDB configury will decide that
 	# this is a cross-build.
 	echo i586-pc-msdosdjgpp
-        exit ;;
+	exit ;;
     Intel:Mach:3*:*)
 	echo i386-pc-mach3
 	exit ;;
@@ -1088,8 +1111,8 @@ EOF
 	/bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \
 	  && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;;
     3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*)
-        /bin/uname -p 2>/dev/null | grep 86 >/dev/null \
-          && { echo i486-ncr-sysv4; exit; } ;;
+	/bin/uname -p 2>/dev/null | grep 86 >/dev/null \
+	  && { echo i486-ncr-sysv4; exit; } ;;
     NCR*:*:4.2:* | MPRAS*:*:4.2:*)
 	OS_REL='.3'
 	test -r /etc/.relid \
@@ -1132,10 +1155,10 @@ EOF
 		echo ns32k-sni-sysv
 	fi
 	exit ;;
-    PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort
-                      # says <Richard.M.Bartel at ccMail.Census.GOV>
-        echo i586-unisys-sysv4
-        exit ;;
+    PENTIUM:*:4.0*:*)	# Unisys `ClearPath HMP IX 4000' SVR4/MP effort
+			# says <Richard.M.Bartel at ccMail.Census.GOV>
+	echo i586-unisys-sysv4
+	exit ;;
     *:UNIX_System_V:4*:FTX*)
 	# From Gerald Hewes <hewes at openmarket.com>.
 	# How about differentiating between stratus architectures? -djm
@@ -1161,11 +1184,11 @@ EOF
 	exit ;;
     R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*)
 	if [ -d /usr/nec ]; then
-	        echo mips-nec-sysv${UNAME_RELEASE}
+		echo mips-nec-sysv${UNAME_RELEASE}
 	else
-	        echo mips-unknown-sysv${UNAME_RELEASE}
+		echo mips-unknown-sysv${UNAME_RELEASE}
 	fi
-        exit ;;
+	exit ;;
     BeBox:BeOS:*:*)	# BeOS running on hardware made by Be, PPC only.
 	echo powerpc-be-beos
 	exit ;;
@@ -1230,6 +1253,9 @@ EOF
     *:QNX:*:4*)
 	echo i386-pc-qnx
 	exit ;;
+    NEO-?:NONSTOP_KERNEL:*:*)
+	echo neo-tandem-nsk${UNAME_RELEASE}
+	exit ;;
     NSE-?:NONSTOP_KERNEL:*:*)
 	echo nse-tandem-nsk${UNAME_RELEASE}
 	exit ;;
@@ -1275,13 +1301,13 @@ EOF
 	echo pdp10-unknown-its
 	exit ;;
     SEI:*:*:SEIUX)
-        echo mips-sei-seiux${UNAME_RELEASE}
+	echo mips-sei-seiux${UNAME_RELEASE}
 	exit ;;
     *:DragonFly:*:*)
 	echo ${UNAME_MACHINE}-unknown-dragonfly`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`
 	exit ;;
     *:*VMS:*:*)
-    	UNAME_MACHINE=`(uname -p) 2>/dev/null`
+	UNAME_MACHINE=`(uname -p) 2>/dev/null`
 	case "${UNAME_MACHINE}" in
 	    A*) echo alpha-dec-vms ; exit ;;
 	    I*) echo ia64-dec-vms ; exit ;;
@@ -1299,6 +1325,9 @@ EOF
     i*86:AROS:*:*)
 	echo ${UNAME_MACHINE}-pc-aros
 	exit ;;
+    x86_64:VMkernel:*:*)
+	echo ${UNAME_MACHINE}-unknown-esx
+	exit ;;
 esac
 
 #echo '(No uname command or uname output not recognized.)' 1>&2
@@ -1321,11 +1350,11 @@ main ()
 #include <sys/param.h>
   printf ("m68k-sony-newsos%s\n",
 #ifdef NEWSOS4
-          "4"
+	"4"
 #else
-	  ""
+	""
 #endif
-         ); exit (0);
+	); exit (0);
 #endif
 #endif
 
diff --git a/config.sub b/config.sub
index 2a55a50..c894da4 100755
--- a/config.sub
+++ b/config.sub
@@ -1,10 +1,10 @@
 #! /bin/sh
 # Configuration validation subroutine script.
 #   Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
-#   2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009
-#   Free Software Foundation, Inc.
+#   2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010,
+#   2011, 2012 Free Software Foundation, Inc.
 
-timestamp='2009-11-20'
+timestamp='2012-02-10'
 
 # This file is (in principle) common to ALL GNU software.
 # The presence of a machine in this file suggests that SOME GNU software
@@ -21,9 +21,7 @@ timestamp='2009-11-20'
 # GNU General Public License for more details.
 #
 # You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA
-# 02110-1301, USA.
+# along with this program; if not, see <http://www.gnu.org/licenses/>.
 #
 # As a special exception to the GNU General Public License, if you
 # distribute this file as part of a program that contains a
@@ -75,8 +73,9 @@ Report bugs and patches to <config-patches at gnu.org>."
 version="\
 GNU config.sub ($timestamp)
 
-Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001,
-2002, 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
+Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
+2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012
+Free Software Foundation, Inc.
 
 This is free software; see the source for copying conditions.  There is NO
 warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
@@ -123,13 +122,18 @@ esac
 # Here we must recognize all the valid KERNEL-OS combinations.
 maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'`
 case $maybe_os in
-  nto-qnx* | linux-gnu* | linux-dietlibc | linux-newlib* | linux-uclibc* | \
-  uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | knetbsd*-gnu* | netbsd*-gnu* | \
+  nto-qnx* | linux-gnu* | linux-android* | linux-dietlibc | linux-newlib* | \
+  linux-uclibc* | uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | \
+  knetbsd*-gnu* | netbsd*-gnu* | \
   kopensolaris*-gnu* | \
   storm-chaos* | os2-emx* | rtmk-nova*)
     os=-$maybe_os
     basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`
     ;;
+  android-linux)
+    os=-linux-android
+    basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`-unknown
+    ;;
   *)
     basic_machine=`echo $1 | sed 's/-[^-]*$//'`
     if [ $basic_machine != $1 ]
@@ -156,8 +160,8 @@ case $os in
 		os=
 		basic_machine=$1
 		;;
-        -bluegene*)
-	        os=-cnk
+	-bluegene*)
+		os=-cnk
 		;;
 	-sim | -cisco | -oki | -wec | -winbond)
 		os=
@@ -173,10 +177,10 @@ case $os in
 		os=-chorusos
 		basic_machine=$1
 		;;
- 	-chorusrdb)
- 		os=-chorusrdb
+	-chorusrdb)
+		os=-chorusrdb
 		basic_machine=$1
- 		;;
+		;;
 	-hiux*)
 		os=-hiuxwe2
 		;;
@@ -245,17 +249,22 @@ case $basic_machine in
 	# Some are omitted here because they have special meanings below.
 	1750a | 580 \
 	| a29k \
+	| aarch64 | aarch64_be \
 	| alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \
 	| alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \
 	| am33_2.0 \
 	| arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr | avr32 \
+        | be32 | be64 \
 	| bfin \
 	| c4x | clipper \
 	| d10v | d30v | dlx | dsp16xx \
+	| epiphany \
 	| fido | fr30 | frv \
 	| h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \
+	| hexagon \
 	| i370 | i860 | i960 | ia64 \
 	| ip2k | iq2000 \
+	| le32 | le64 \
 	| lm32 \
 	| m32c | m32r | m32rle | m68000 | m68k | m88k \
 	| maxq | mb | microblaze | mcore | mep | metag \
@@ -281,29 +290,39 @@ case $basic_machine in
 	| moxie \
 	| mt \
 	| msp430 \
+	| nds32 | nds32le | nds32be \
 	| nios | nios2 \
 	| ns16k | ns32k \
+	| open8 \
 	| or32 \
 	| pdp10 | pdp11 | pj | pjl \
-	| powerpc | powerpc64 | powerpc64le | powerpcle | ppcbe \
+	| powerpc | powerpc64 | powerpc64le | powerpcle \
 	| pyramid \
-	| rx \
+	| rl78 | rx \
 	| score \
 	| sh | sh[1234] | sh[24]a | sh[24]aeb | sh[23]e | sh[34]eb | sheb | shbe | shle | sh[1234]le | sh3ele \
 	| sh64 | sh64le \
 	| sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet | sparclite \
 	| sparcv8 | sparcv9 | sparcv9b | sparcv9v \
-	| spu | strongarm \
-	| tahoe | thumb | tic4x | tic80 | tron \
+	| spu \
+	| tahoe | tic4x | tic54x | tic55x | tic6x | tic80 | tron \
 	| ubicom32 \
-	| v850 | v850e \
+	| v850 | v850e | v850e1 | v850e2 | v850es | v850e2v3 \
 	| we32k \
-	| x86 | xc16x | xscale | xscalee[bl] | xstormy16 | xtensa \
+	| x86 | xc16x | xstormy16 | xtensa \
 	| z8k | z80)
 		basic_machine=$basic_machine-unknown
 		;;
-	m6811 | m68hc11 | m6812 | m68hc12 | picochip)
-		# Motorola 68HC11/12.
+	c54x)
+		basic_machine=tic54x-unknown
+		;;
+	c55x)
+		basic_machine=tic55x-unknown
+		;;
+	c6x)
+		basic_machine=tic6x-unknown
+		;;
+	m6811 | m68hc11 | m6812 | m68hc12 | m68hcs12x | picochip)
 		basic_machine=$basic_machine-unknown
 		os=-none
 		;;
@@ -313,6 +332,21 @@ case $basic_machine in
 		basic_machine=mt-unknown
 		;;
 
+	strongarm | thumb | xscale)
+		basic_machine=arm-unknown
+		;;
+	xgate)
+		basic_machine=$basic_machine-unknown
+		os=-none
+		;;
+	xscaleeb)
+		basic_machine=armeb-unknown
+		;;
+
+	xscaleel)
+		basic_machine=armel-unknown
+		;;
+
 	# We use `pc' rather than `unknown'
 	# because (1) that's what they normally are, and
 	# (2) the word "unknown" tends to confuse beginning users.
@@ -327,21 +361,25 @@ case $basic_machine in
 	# Recognize the basic CPU types with company name.
 	580-* \
 	| a29k-* \
+	| aarch64-* | aarch64_be-* \
 	| alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \
 	| alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \
 	| alphapca5[67]-* | alpha64pca5[67]-* | arc-* \
 	| arm-*  | armbe-* | armle-* | armeb-* | armv*-* \
 	| avr-* | avr32-* \
+	| be32-* | be64-* \
 	| bfin-* | bs2000-* \
-	| c[123]* | c30-* | [cjt]90-* | c4x-* | c54x-* | c55x-* | c6x-* \
+	| c[123]* | c30-* | [cjt]90-* | c4x-* \
 	| clipper-* | craynv-* | cydra-* \
 	| d10v-* | d30v-* | dlx-* \
 	| elxsi-* \
 	| f30[01]-* | f700-* | fido-* | fr30-* | frv-* | fx80-* \
 	| h8300-* | h8500-* \
 	| hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \
+	| hexagon-* \
 	| i*86-* | i860-* | i960-* | ia64-* \
 	| ip2k-* | iq2000-* \
+	| le32-* | le64-* \
 	| lm32-* \
 	| m32c-* | m32r-* | m32rle-* \
 	| m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \
@@ -367,25 +405,29 @@ case $basic_machine in
 	| mmix-* \
 	| mt-* \
 	| msp430-* \
+	| nds32-* | nds32le-* | nds32be-* \
 	| nios-* | nios2-* \
 	| none-* | np1-* | ns16k-* | ns32k-* \
+	| open8-* \
 	| orion-* \
 	| pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \
-	| powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* | ppcbe-* \
+	| powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* \
 	| pyramid-* \
-	| romp-* | rs6000-* | rx-* \
+	| rl78-* | romp-* | rs6000-* | rx-* \
 	| sh-* | sh[1234]-* | sh[24]a-* | sh[24]aeb-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \
 	| shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \
 	| sparc-* | sparc64-* | sparc64b-* | sparc64v-* | sparc86x-* | sparclet-* \
 	| sparclite-* \
-	| sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | strongarm-* | sv1-* | sx?-* \
-	| tahoe-* | thumb-* \
-	| tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* | tile-* \
+	| sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | sv1-* | sx?-* \
+	| tahoe-* \
+	| tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \
+	| tile*-* \
 	| tron-* \
 	| ubicom32-* \
-	| v850-* | v850e-* | vax-* \
+	| v850-* | v850e-* | v850e1-* | v850es-* | v850e2-* | v850e2v3-* \
+	| vax-* \
 	| we32k-* \
-	| x86-* | x86_64-* | xc16x-* | xps100-* | xscale-* | xscalee[bl]-* \
+	| x86-* | x86_64-* | xc16x-* | xps100-* \
 	| xstormy16-* | xtensa*-* \
 	| ymp-* \
 	| z8k-* | z80-*)
@@ -410,7 +452,7 @@ case $basic_machine in
 		basic_machine=a29k-amd
 		os=-udi
 		;;
-    	abacus)
+	abacus)
 		basic_machine=abacus-unknown
 		;;
 	adobe68k)
@@ -480,11 +522,20 @@ case $basic_machine in
 		basic_machine=powerpc-ibm
 		os=-cnk
 		;;
+	c54x-*)
+		basic_machine=tic54x-`echo $basic_machine | sed 's/^[^-]*-//'`
+		;;
+	c55x-*)
+		basic_machine=tic55x-`echo $basic_machine | sed 's/^[^-]*-//'`
+		;;
+	c6x-*)
+		basic_machine=tic6x-`echo $basic_machine | sed 's/^[^-]*-//'`
+		;;
 	c90)
 		basic_machine=c90-cray
 		os=-unicos
 		;;
-        cegcc)
+	cegcc)
 		basic_machine=arm-unknown
 		os=-cegcc
 		;;
@@ -516,7 +567,7 @@ case $basic_machine in
 		basic_machine=craynv-cray
 		os=-unicosmp
 		;;
-	cr16)
+	cr16 | cr16-*)
 		basic_machine=cr16-unknown
 		os=-elf
 		;;
@@ -674,7 +725,6 @@ case $basic_machine in
 	i370-ibm* | ibm*)
 		basic_machine=i370-ibm
 		;;
-# I'm not sure what "Sysv32" means.  Should this be sysv3.2?
 	i*86v32)
 		basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
 		os=-sysv32
@@ -732,7 +782,7 @@ case $basic_machine in
 		basic_machine=ns32k-utek
 		os=-sysv
 		;;
-        microblaze)
+	microblaze)
 		basic_machine=microblaze-xilinx
 		;;
 	mingw32)
@@ -771,10 +821,18 @@ case $basic_machine in
 	ms1-*)
 		basic_machine=`echo $basic_machine | sed -e 's/ms1-/mt-/'`
 		;;
+	msys)
+		basic_machine=i386-pc
+		os=-msys
+		;;
 	mvs)
 		basic_machine=i370-ibm
 		os=-mvs
 		;;
+	nacl)
+		basic_machine=le32-unknown
+		os=-nacl
+		;;
 	ncr3000)
 		basic_machine=i486-ncr
 		os=-sysv4
@@ -839,6 +897,12 @@ case $basic_machine in
 	np1)
 		basic_machine=np1-gould
 		;;
+	neo-tandem)
+		basic_machine=neo-tandem
+		;;
+	nse-tandem)
+		basic_machine=nse-tandem
+		;;
 	nsr-tandem)
 		basic_machine=nsr-tandem
 		;;
@@ -921,9 +985,10 @@ case $basic_machine in
 		;;
 	power)	basic_machine=power-ibm
 		;;
-	ppc)	basic_machine=powerpc-unknown
+	ppc | ppcbe)	basic_machine=powerpc-unknown
 		;;
-	ppc-*)	basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'`
+	ppc-* | ppcbe-*)
+		basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'`
 		;;
 	ppcle | powerpclittle | ppc-le | powerpc-little)
 		basic_machine=powerpcle-unknown
@@ -1017,6 +1082,9 @@ case $basic_machine in
 		basic_machine=i860-stratus
 		os=-sysv4
 		;;
+	strongarm-* | thumb-*)
+		basic_machine=arm-`echo $basic_machine | sed 's/^[^-]*-//'`
+		;;
 	sun2)
 		basic_machine=m68000-sun
 		;;
@@ -1073,20 +1141,8 @@ case $basic_machine in
 		basic_machine=t90-cray
 		os=-unicos
 		;;
-	tic54x | c54x*)
-		basic_machine=tic54x-unknown
-		os=-coff
-		;;
-	tic55x | c55x*)
-		basic_machine=tic55x-unknown
-		os=-coff
-		;;
-	tic6x | c6x*)
-		basic_machine=tic6x-unknown
-		os=-coff
-		;;
 	tile*)
-		basic_machine=tile-unknown
+		basic_machine=$basic_machine-unknown
 		os=-linux-gnu
 		;;
 	tx39)
@@ -1156,6 +1212,9 @@ case $basic_machine in
 	xps | xps100)
 		basic_machine=xps100-honeywell
 		;;
+	xscale-* | xscalee[bl]-*)
+		basic_machine=`echo $basic_machine | sed 's/^xscale/arm/'`
+		;;
 	ymp)
 		basic_machine=ymp-cray
 		os=-unicos
@@ -1253,11 +1312,11 @@ esac
 if [ x"$os" != x"" ]
 then
 case $os in
-        # First match some system type aliases
-        # that might get confused with valid system types.
+	# First match some system type aliases
+	# that might get confused with valid system types.
 	# -solaris* is a basic system type, with this one exception.
-        -auroraux)
-	        os=-auroraux
+	-auroraux)
+		os=-auroraux
 		;;
 	-solaris1 | -solaris1.*)
 		os=`echo $os | sed -e 's|solaris1|sunos4|'`
@@ -1293,8 +1352,9 @@ case $os in
 	      | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \
 	      | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \
 	      | -chorusos* | -chorusrdb* | -cegcc* \
-	      | -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \
-	      | -mingw32* | -linux-gnu* | -linux-newlib* | -linux-uclibc* \
+	      | -cygwin* | -msys* | -pe* | -psos* | -moss* | -proelf* | -rtems* \
+	      | -mingw32* | -linux-gnu* | -linux-android* \
+	      | -linux-newlib* | -linux-uclibc* \
 	      | -uxpv* | -beos* | -mpeix* | -udk* \
 	      | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \
 	      | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \
@@ -1341,7 +1401,7 @@ case $os in
 	-opened*)
 		os=-openedition
 		;;
-        -os400*)
+	-os400*)
 		os=-os400
 		;;
 	-wince*)
@@ -1390,7 +1450,7 @@ case $os in
 	-sinix*)
 		os=-sysv4
 		;;
-        -tpf*)
+	-tpf*)
 		os=-tpf
 		;;
 	-triton*)
@@ -1435,6 +1495,8 @@ case $os in
 	-dicos*)
 		os=-dicos
 		;;
+	-nacl*)
+		;;
 	-none)
 		;;
 	*)
@@ -1457,10 +1519,10 @@ else
 # system, and we'll never get to this point.
 
 case $basic_machine in
-        score-*)
+	score-*)
 		os=-elf
 		;;
-        spu-*)
+	spu-*)
 		os=-elf
 		;;
 	*-acorn)
@@ -1472,8 +1534,17 @@ case $basic_machine in
 	arm*-semi)
 		os=-aout
 		;;
-        c4x-* | tic4x-*)
-        	os=-coff
+	c4x-* | tic4x-*)
+		os=-coff
+		;;
+	tic54x-*)
+		os=-coff
+		;;
+	tic55x-*)
+		os=-coff
+		;;
+	tic6x-*)
+		os=-coff
 		;;
 	# This must come before the *-dec entry.
 	pdp10-*)
@@ -1493,14 +1564,11 @@ case $basic_machine in
 		;;
 	m68000-sun)
 		os=-sunos3
-		# This also exists in the configure program, but was not the
-		# default.
-		# os=-sunos4
 		;;
 	m68*-cisco)
 		os=-aout
 		;;
-        mep-*)
+	mep-*)
 		os=-elf
 		;;
 	mips*-cisco)
@@ -1527,7 +1595,7 @@ case $basic_machine in
 	*-ibm)
 		os=-aix
 		;;
-    	*-knuth)
+	*-knuth)
 		os=-mmixware
 		;;
 	*-wec)
diff --git a/configure b/configure
index 33b68f9..dbfe547 100755
--- a/configure
+++ b/configure
@@ -1,17 +1,23 @@
 #! /bin/sh
 # Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.68 for GetData 0.7.3.
+# Generated by GNU Autoconf 2.69 for GetData 0.8.5.
 #
 # Report bugs to <getdata-devel at lists.sourceforge.net>.
 #
 #
-# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001,
-# 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free Software
-# Foundation, Inc.
+# Copyright (C) 1992-1996, 1998-2012 Free Software Foundation, Inc.
 #
 #
 # This configure script is free software; the Free Software Foundation
 # gives unlimited permission to copy, distribute and modify it.
+#
+# Parts of this program are copyright (C) 2008-2013 D. V. Wiebe.
+#
+# These parts may be redistributed and/or modified under the terms of the GNU
+# Lesser General Public License as published by the Free Software Foundation;
+# either version 2.1 of the License, or (at your option) any later version.
+# See the file COPYING for details.
+#
 ## -------------------- ##
 ## M4sh Initialization. ##
 ## -------------------- ##
@@ -136,6 +142,31 @@ export LANGUAGE
 # CDPATH.
 (unset CDPATH) >/dev/null 2>&1 && unset CDPATH
 
+# Use a proper internal environment variable to ensure we don't fall
+  # into an infinite loop, continuously re-executing ourselves.
+  if test x"${_as_can_reexec}" != xno && test "x$CONFIG_SHELL" != x; then
+    _as_can_reexec=no; export _as_can_reexec;
+    # We cannot yet assume a decent shell, so we have to provide a
+# neutralization value for shells without unset; and this also
+# works around shells that cannot unset nonexistent variables.
+# Preserve -v and -x to the replacement shell.
+BASH_ENV=/dev/null
+ENV=/dev/null
+(unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV
+case $- in # ((((
+  *v*x* | *x*v* ) as_opts=-vx ;;
+  *v* ) as_opts=-v ;;
+  *x* ) as_opts=-x ;;
+  * ) as_opts= ;;
+esac
+exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"}
+# Admittedly, this is quite paranoid, since all the known shells bail
+# out after a failed `exec'.
+$as_echo "$0: could not re-execute with $CONFIG_SHELL" >&2
+as_fn_exit 255
+  fi
+  # We don't want this to propagate to other subprocesses.
+          { _as_can_reexec=; unset _as_can_reexec;}
 if test "x$CONFIG_SHELL" = x; then
   as_bourne_compatible="if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then :
   emulate sh
@@ -169,7 +200,8 @@ if ( set x; as_fn_ret_success y && test x = \"\$1\" ); then :
 else
   exitcode=1; echo positional parameters were not saved.
 fi
-test x\$exitcode = x0 || exit 1"
+test x\$exitcode = x0 || exit 1
+test -x / || exit 1"
   as_suggested="  as_lineno_1=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_1a=\$LINENO
   as_lineno_2=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_2a=\$LINENO
   eval 'test \"x\$as_lineno_1'\$as_run'\" != \"x\$as_lineno_2'\$as_run'\" &&
@@ -222,21 +254,25 @@ IFS=$as_save_IFS
 
 
       if test "x$CONFIG_SHELL" != x; then :
-  # We cannot yet assume a decent shell, so we have to provide a
-	# neutralization value for shells without unset; and this also
-	# works around shells that cannot unset nonexistent variables.
-	# Preserve -v and -x to the replacement shell.
-	BASH_ENV=/dev/null
-	ENV=/dev/null
-	(unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV
-	export CONFIG_SHELL
-	case $- in # ((((
-	  *v*x* | *x*v* ) as_opts=-vx ;;
-	  *v* ) as_opts=-v ;;
-	  *x* ) as_opts=-x ;;
-	  * ) as_opts= ;;
-	esac
-	exec "$CONFIG_SHELL" $as_opts "$as_myself" ${1+"$@"}
+  export CONFIG_SHELL
+             # We cannot yet assume a decent shell, so we have to provide a
+# neutralization value for shells without unset; and this also
+# works around shells that cannot unset nonexistent variables.
+# Preserve -v and -x to the replacement shell.
+BASH_ENV=/dev/null
+ENV=/dev/null
+(unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV
+case $- in # ((((
+  *v*x* | *x*v* ) as_opts=-vx ;;
+  *v* ) as_opts=-v ;;
+  *x* ) as_opts=-x ;;
+  * ) as_opts= ;;
+esac
+exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"}
+# Admittedly, this is quite paranoid, since all the known shells bail
+# out after a failed `exec'.
+$as_echo "$0: could not re-execute with $CONFIG_SHELL" >&2
+exit 255
 fi
 
     if test x$as_have_required = xno; then :
@@ -339,6 +375,14 @@ $as_echo X"$as_dir" |
 
 
 } # as_fn_mkdir_p
+
+# as_fn_executable_p FILE
+# -----------------------
+# Test if FILE is an executable regular file.
+as_fn_executable_p ()
+{
+  test -f "$1" && test -x "$1"
+} # as_fn_executable_p
 # as_fn_append VAR VALUE
 # ----------------------
 # Append the text in VALUE to the end of the definition contained in VAR. Take
@@ -460,6 +504,10 @@ as_cr_alnum=$as_cr_Letters$as_cr_digits
   chmod +x "$as_me.lineno" ||
     { $as_echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2; as_fn_exit 1; }
 
+  # If we had to re-execute with $CONFIG_SHELL, we're ensured to have
+  # already done that, so ensure we don't try to do so again and fall
+  # in an infinite loop.  This has already happened in practice.
+  _as_can_reexec=no; export _as_can_reexec
   # Don't try to exec as it changes $[0], causing all sort of problems
   # (the dirname of $[0] is not the place where we might find the
   # original and so on.  Autoconf is especially sensitive to this).
@@ -494,16 +542,16 @@ if (echo >conf$$.file) 2>/dev/null; then
     # ... but there are two gotchas:
     # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail.
     # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable.
-    # In both cases, we have to default to `cp -p'.
+    # In both cases, we have to default to `cp -pR'.
     ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe ||
-      as_ln_s='cp -p'
+      as_ln_s='cp -pR'
   elif ln conf$$.file conf$$ 2>/dev/null; then
     as_ln_s=ln
   else
-    as_ln_s='cp -p'
+    as_ln_s='cp -pR'
   fi
 else
-  as_ln_s='cp -p'
+  as_ln_s='cp -pR'
 fi
 rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file
 rmdir conf$$.dir 2>/dev/null
@@ -515,28 +563,8 @@ else
   as_mkdir_p=false
 fi
 
-if test -x / >/dev/null 2>&1; then
-  as_test_x='test -x'
-else
-  if ls -dL / >/dev/null 2>&1; then
-    as_ls_L_option=L
-  else
-    as_ls_L_option=
-  fi
-  as_test_x='
-    eval sh -c '\''
-      if test -d "$1"; then
-	test -d "$1/.";
-      else
-	case $1 in #(
-	-*)set "./$1";;
-	esac;
-	case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in #((
-	???[sx]*):;;*)false;;esac;fi
-    '\'' sh
-  '
-fi
-as_executable_p=$as_test_x
+as_test_x='test -x'
+as_executable_p=as_fn_executable_p
 
 # Sed expression to map a string onto a valid CPP name.
 as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'"
@@ -570,10 +598,10 @@ MAKEFLAGS=
 # Identity of this package.
 PACKAGE_NAME='GetData'
 PACKAGE_TARNAME='getdata'
-PACKAGE_VERSION='0.7.3'
-PACKAGE_STRING='GetData 0.7.3'
+PACKAGE_VERSION='0.8.5'
+PACKAGE_STRING='GetData 0.8.5'
 PACKAGE_BUGREPORT='getdata-devel at lists.sourceforge.net'
-PACKAGE_URL=''
+PACKAGE_URL='http://getdata.sourceforge.net/'
 
 ac_unique_file="src/getdata.c"
 # Factoring default headers for most tests.
@@ -616,16 +644,26 @@ ac_subst_vars='am__EXEEXT_FALSE
 am__EXEEXT_TRUE
 LTLIBOBJS
 LIBOBJS
-GDIDL_EXTERNAL_FALSE
-GDIDL_EXTERNAL_TRUE
+GD_EXTERNAL_FALSE
+GD_EXTERNAL_TRUE
+USE_ZZSLIM_FALSE
+USE_ZZSLIM_TRUE
 HAVE_DIFF_FALSE
 HAVE_DIFF_TRUE
+TEST_MATLAB_FALSE
+TEST_MATLAB_TRUE
+TEST_PERL_FALSE
+TEST_PERL_TRUE
 TEST_IDL_FALSE
 TEST_IDL_TRUE
 TEST_PYTHON_FALSE
 TEST_PYTHON_TRUE
 USE_MODULES_FALSE
 USE_MODULES_TRUE
+MAKE_MATLABBINDINGS_FALSE
+MAKE_MATLABBINDINGS_TRUE
+MAKE_PERLBINDINGS_FALSE
+MAKE_PERLBINDINGS_TRUE
 MAKE_IDLBINDINGS_FALSE
 MAKE_IDLBINDINGS_TRUE
 MAKE_PYBINDINGS_FALSE
@@ -638,14 +676,14 @@ MAKE_CXXBINDINGS_FALSE
 MAKE_CXXBINDINGS_TRUE
 INCLUDE_LEGACY_API_FALSE
 INCLUDE_LEGACY_API_TRUE
-LFS_TRANSITIONAL_API_FALSE
-LFS_TRANSITIONAL_API_TRUE
 INTEL_FC_COMPILER_FALSE
 INTEL_FC_COMPILER_TRUE
 INTEL_F77_COMPILER_FALSE
 INTEL_F77_COMPILER_TRUE
 FC_WEXTRA_FALSE
 FC_WEXTRA_TRUE
+F77_FNO_BACKSLASH_FALSE
+F77_FNO_BACKSLASH_TRUE
 F77_WEXTRA_FALSE
 F77_WEXTRA_TRUE
 CXX_WEXTRA_FALSE
@@ -664,31 +702,49 @@ GETDATA_DEBUG_FALSE
 GETDATA_DEBUG_TRUE
 absolute_docdir
 PRIVATE_LIBS
+USE_ZZIP_FALSE
+USE_ZZIP_TRUE
+path_unzip
+path_zip
+ZZIP_LIBS
+ZZIP_LDFLAGS
+ZZIP_CPPFLAGS
+USE_SLIM_FALSE
+USE_SLIM_TRUE
+path_unslim
+path_slim
+SLIM_LIBS
+SLIM_LDFLAGS
+SLIM_CPPFLAGS
 USE_LZMA_FALSE
 USE_LZMA_TRUE
 path_xz
+LZMA_LIBS
 LZMA_LDFLAGS
 LZMA_CPPFLAGS
 USE_GZIP_FALSE
 USE_GZIP_TRUE
 path_gunzip
 path_gzip
+GZIP_LIBS
 GZIP_LDFLAGS
 GZIP_CPPFLAGS
-USE_SLIM_FALSE
-USE_SLIM_TRUE
-path_unslim
-path_slim
-SLIM_LDFLAGS
-SLIM_CPPFLAGS
 USE_BZIP2_FALSE
 USE_BZIP2_TRUE
 path_bunzip2
 path_bzip2
+BZIP2_LIBS
 BZIP2_LDFLAGS
 BZIP2_CPPFLAGS
-BUILD_DATE
-DATE
+MATLAB_CPPFLAGS
+mexext
+matlabbasedir
+MATLAB
+MEX
+PERL_MAN3EXT
+perlmandir
+perldir
+PERL
 IDL_LIBS
 IDL_CFLAGS
 idldir
@@ -698,8 +754,7 @@ pythondir
 PYTHON_LIBS
 PYTHON_CPPFLAGS
 PYTHON
-JOT
-SEQ
+DEFINE_gd_uint64_t
 DEFINE_gd_int64_t
 DEFINE_gd_uint16_t
 DEFINE_gd_int16_t
@@ -737,12 +792,18 @@ CXXDEPMODE
 ac_ct_CXX
 CXXFLAGS
 CXX
+am__fastdepCCAS_FALSE
+am__fastdepCCAS_TRUE
+CCASDEPMODE
+CCASFLAGS
+CCAS
 EGREP
 CPP
 DEFINE_GD_NO_C99_API
 am__fastdepCC_FALSE
 am__fastdepCC_TRUE
 CCDEPMODE
+am__nodep
 AMDEPBACKSLASH
 AMDEP_FALSE
 AMDEP_TRUE
@@ -756,7 +817,13 @@ CPPFLAGS
 LDFLAGS
 CFLAGS
 CC
+GD_DIRSEP
+GD_FDIRSEP
+SEQ
+PRINTF
+JOT
 DIFF
+DATE
 SED
 GREP
 LN_S
@@ -785,6 +852,7 @@ INSTALL_SCRIPT
 INSTALL_PROGRAM
 moduledir
 DL_LIBRARY_PATH
+GETDATA_DEBUG
 DEFINE_GD_LEGACY_API
 host_os
 host_vendor
@@ -794,6 +862,7 @@ build_os
 build_vendor
 build_cpu
 build
+MATLABGETDATA_VERSION
 F95GETDATA_VERSION
 FGETDATA_VERSION
 GETDATAXX_VERSION
@@ -801,6 +870,10 @@ GETDATA_IFACE_AGE
 GETDATA_IMPL_REVISION
 GETDATA_IFACE_VERSION
 BUILDCC
+GETDATA_VERSION_SUFFIX
+GETDATA_REVISION
+GETDATA_MINOR
+GETDATA_MAJOR
 target_alias
 host_alias
 build_alias
@@ -852,10 +925,13 @@ enable_fortran
 enable_fortran95
 enable_python
 enable_idl
+enable_perl
+enable_matlab
 enable_modules
 with_module_dir
 with_ltdl
 with_external_libraries
+enable_fast_unaligned
 enable_dependency_tracking
 enable_shared
 enable_static
@@ -868,21 +944,35 @@ with_python
 with_python_module_dir
 with_idl
 with_idl_dlm_dir
+with_perl
+with_perl_dir
+with_matlab
+with_mex
+with_matlab_dir
 with_libbz2
-with_libslim
 with_libz
 with_liblzma
+with_libslim
+with_libzzip
+enable_zzslim
 '
       ac_precious_vars='build_alias
 host_alias
 target_alias
 BUILDCC
+DATE
+DIFF
+JOT
+PRINTF
+SEQ
 CC
 CFLAGS
 LDFLAGS
 LIBS
 CPPFLAGS
 CPP
+CCAS
+CCASFLAGS
 CXX
 CXXFLAGS
 CCC
@@ -1346,8 +1436,6 @@ target=$target_alias
 if test "x$host_alias" != x; then
   if test "x$build_alias" = x; then
     cross_compiling=maybe
-    $as_echo "$as_me: WARNING: if you wanted to set the --build type, don't use --host.
-    If a cross compiler is detected then cross compile mode will be used" >&2
   elif test "x$build_alias" != "x$host_alias"; then
     cross_compiling=yes
   fi
@@ -1433,7 +1521,7 @@ if test "$ac_init_help" = "long"; then
   # Omit some internal or obsolete options to make the list less imposing.
   # This message is too long to be a string in the A/UX 3.1 sh.
   cat <<_ACEOF
-\`configure' configures GetData 0.7.3 to adapt to many kinds of systems.
+\`configure' configures GetData 0.8.5 to adapt to many kinds of systems.
 
 Usage: $0 [OPTION]... [VAR=VALUE]...
 
@@ -1503,7 +1591,7 @@ fi
 
 if test -n "$ac_init_help"; then
   case $ac_init_help in
-     short | recursive ) echo "Configuration of GetData 0.7.3:";;
+     short | recursive ) echo "Configuration of GetData 0.8.5:";;
    esac
   cat <<\_ACEOF
 
@@ -1523,9 +1611,16 @@ Optional Features:
   --disable-python        don't build the Python bindings (pygetdata)
   --disable-idl           don't build the Interactive Data Language (IDL)
                           bindings (IDL_GetData)
+  --disable-perl          don't build the Perl bindings (GetData)
+  --disable-matlab        don't build the MATLAB bindings
   --enable-modules        build external encodings in dynamically loaded
                           modules instead of directly into the core GetData
                           library
+  --enable-fast-unaligned use fast loads and stores with non-aligned data.
+                          WARNING: Enabling this on a platform which does not
+                          support fast unaligned memory access may cause the
+                          library to silently corrupt data. [default:
+                          autodetect]
   --disable-dependency-tracking  speeds up one-time build
   --enable-dependency-tracking   do not reject slow dependency extractors
   --enable-shared[=PKGS]  build shared libraries [default=yes]
@@ -1533,6 +1628,11 @@ Optional Features:
   --enable-fast-install[=PKGS]
                           optimize for fast installation [default=yes]
   --disable-libtool-lock  avoid locking (might break parallel builds)
+  --enable-zzslim         skip probing for zzslim required features and enable
+                          the zzslim encoding. The default is to autodetect
+                          support. Note: zzslim encoding support requires both
+                          slim and zzip encoding support.
+  --disable-zzslim        disable zzslim encodings support
 
 Optional Packages:
   --with-PACKAGE[=ARG]    use PACKAGE [ARG=yes]
@@ -1541,36 +1641,68 @@ Optional Packages:
                           ignored if --enable-modules isn't specified
                           [default: LIBDIR/getdata]
   --with-ltdl=PREFIX      if building modules, use the GNU ltdl library
-                          located in PREFIX [autodetect]
+                          located in PREFIX [default: autodetect]
   --without-external-libraries
                           disable all features relying on external libraries
-  --with-pic              try to use only PIC/non-PIC objects [default=use
+  --with-pic[=PKGS]       try to use only PIC/non-PIC objects [default=use
                           both]
   --with-gnu-ld           assume the C compiler uses GNU ld [default=no]
   --with-sysroot=DIR Search for dependent libraries within DIR
                         (or the compiler's sysroot if not specified).
-  --with-python=PATH      use the Python interpreter located in PATH
-                          [autodetect]
+  --with-python=PATH      use the Python interpreter located in PATH [default:
+                          autodetect]
   --with-python-module-dir=PATH
-                          install the Python bindings into PATH [autodetect]
-  --with-idl=PATH         use the IDL interpreter located in PATH [autodetect]
-  --with-idl-dlm-dir=PATH install the IDL bindings into PATH [autodetect]
-  --with-libbz2=PREFIX    use the libbz2 installed in PREFIX [autodetect]
+                          install the Python bindings into PATH [default:
+                          autodetect]
+  --with-idl=PATH         use the IDL interpreter located in PATH [default:
+                          autodetect]
+  --with-idl-dlm-dir=PATH install the IDL bindings into PATH [default:
+                          autodetect]
+  --with-perl=PATH        use the Perl interpreter located in PATH. [default:
+                          autodetect]
+  --with-perl-dir=PATH    Install Perl bindings in PATH. If PATH is the
+                          special word `vendor', install Perl bindings into
+                          the default vendor-specific module directory (if
+                          present). If PATH is the special word `site',
+                          install Perl bindings into the default site-specific
+                          module directory. [default: site]
+  --with-matlab=PATH      use the MATLAB interpreter located at PATH.
+                          [default: autodetect]
+  --with-mex=PATH         use the MATLAB MEX compiler located at PATH.
+                          [default: autodetect]
+  --with-matlab-dir=PATH  Install Matlab bindings in PATH/getdata. [default:
+                          LIBDIR/getdata/matlab]
+  --with-libbz2=PREFIX    use the libbz2 installed in PREFIX [default:
+                          autodetect]
   --without-libbz2        disable encodings supported by libbz2, even if the
                           library is present
-  --with-libslim=PREFIX   use the libslim installed in PREFIX [autodetect]
-  --without-libslim       disable encodings supported by libslim, even if the
-                          library is present
-  --with-libz=PREFIX      use the libz installed in PREFIX [autodetect]
+  --with-libz=PREFIX      use the libz installed in PREFIX [default:
+                          autodetect]
   --without-libz          disable encodings supported by libz, even if the
                           library is present
-  --with-liblzma=PREFIX   use the liblzma installed in PREFIX [autodetect]
+  --with-liblzma=PREFIX   use the liblzma installed in PREFIX [default:
+                          autodetect]
   --without-liblzma       disable encodings supported by liblzma, even if the
                           library is present
+  --with-libslim=PREFIX   use the libslim installed in PREFIX [default:
+                          autodetect]
+  --without-libslim       disable encodings supported by libslim, even if the
+                          library is present
+  --with-libzzip=PREFIX   use the libzzip installed in PREFIX [default:
+                          autodetect]
+  --without-libzzip       disable encodings supported by libzzip, even if the
+                          library is present
 
 Some influential environment variables:
   BUILDCC     C compiler command on the build system (only needed if
               cross-compiling)
+  DATE        a date program which supports '+%...' conversion specifiers
+  DIFF        a POSIX-compatible diff
+  JOT         a BSD-style jot; SysV-derived systems (like GNU/Linux) may find
+              it easier to use SEQ (q.v.)
+  PRINTF      a POSIX-compatible printf
+  SEQ         a SysV-style seq; BSD-derived systems (like MacOS X) may find it
+              easier to use JOT (q.v.)
   CC          C compiler command
   CFLAGS      C compiler flags
   LDFLAGS     linker flags, e.g. -L<lib dir> if you have libraries in a
@@ -1579,6 +1711,8 @@ Some influential environment variables:
   CPPFLAGS    (Objective) C/C++ preprocessor flags, e.g. -I<include dir> if
               you have headers in a nonstandard directory <include dir>
   CPP         C preprocessor
+  CCAS        assembler compiler command (defaults to CC)
+  CCASFLAGS   assembler compiler flags (defaults to CFLAGS)
   CXX         C++ compiler command
   CXXFLAGS    C++ compiler flags
   F77         Fortran 77 compiler command
@@ -1591,6 +1725,7 @@ Use these variables to override the choices made by `configure' or to help
 it to find libraries and programs with nonstandard names/locations.
 
 Report bugs to <getdata-devel at lists.sourceforge.net>.
+GetData home page: <http://getdata.sourceforge.net/>.
 _ACEOF
 ac_status=$?
 fi
@@ -1653,12 +1788,20 @@ fi
 test -n "$ac_init_help" && exit $ac_status
 if $ac_init_version; then
   cat <<\_ACEOF
-GetData configure 0.7.3
-generated by GNU Autoconf 2.68
+GetData configure 0.8.5
+generated by GNU Autoconf 2.69
 
-Copyright (C) 2010 Free Software Foundation, Inc.
+Copyright (C) 2012 Free Software Foundation, Inc.
 This configure script is free software; the Free Software Foundation
 gives unlimited permission to copy, distribute and modify it.
+
+Parts of this program are copyright (C) 2008-2013 D. V. Wiebe.
+
+These parts may be redistributed and/or modified under the terms of the GNU
+Lesser General Public License as published by the Free Software Foundation;
+either version 2.1 of the License, or (at your option) any later version.
+See the file COPYING for details.
+
 _ACEOF
   exit
 fi
@@ -1925,7 +2068,7 @@ $as_echo "$ac_try_echo"; } >&5
 	 test ! -s conftest.err
        } && test -s conftest$ac_exeext && {
 	 test "$cross_compiling" = yes ||
-	 $as_test_x conftest$ac_exeext
+	 test -x conftest$ac_exeext
        }; then :
   ac_retval=0
 else
@@ -2106,7 +2249,7 @@ $as_echo "$ac_try_echo"; } >&5
 	 test ! -s conftest.err
        } && test -s conftest$ac_exeext && {
 	 test "$cross_compiling" = yes ||
-	 $as_test_x conftest$ac_exeext
+	 test -x conftest$ac_exeext
        }; then :
   ac_retval=0
 else
@@ -2152,7 +2295,7 @@ $as_echo "$ac_try_echo"; } >&5
 	 test ! -s conftest.err
        } && test -s conftest$ac_exeext && {
 	 test "$cross_compiling" = yes ||
-	 $as_test_x conftest$ac_exeext
+	 test -x conftest$ac_exeext
        }; then :
   ac_retval=0
 else
@@ -2198,7 +2341,7 @@ $as_echo "$ac_try_echo"; } >&5
 	 test ! -s conftest.err
        } && test -s conftest$ac_exeext && {
 	 test "$cross_compiling" = yes ||
-	 $as_test_x conftest$ac_exeext
+	 test -x conftest$ac_exeext
        }; then :
   ac_retval=0
 else
@@ -2308,60 +2451,6 @@ fi
 
 } # ac_fn_c_check_header_mongrel
 
-# ac_fn_c_check_decl LINENO SYMBOL VAR INCLUDES
-# ---------------------------------------------
-# Tests whether SYMBOL is declared in INCLUDES, setting cache variable VAR
-# accordingly.
-ac_fn_c_check_decl ()
-{
-  as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
-  as_decl_name=`echo $2|sed 's/ *(.*//'`
-  as_decl_use=`echo $2|sed -e 's/(/((/' -e 's/)/) 0&/' -e 's/,/) 0& (/g'`
-  { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $as_decl_name is declared" >&5
-$as_echo_n "checking whether $as_decl_name is declared... " >&6; }
-if eval \${$3+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-$4
-#ifdef F77_DUMMY_MAIN
-
-#  ifdef __cplusplus
-     extern "C"
-#  endif
-   int F77_DUMMY_MAIN() { return 1; }
-
-#endif
-int
-main ()
-{
-#ifndef $as_decl_name
-#ifdef __cplusplus
-  (void) $as_decl_use;
-#else
-  (void) $as_decl_name;
-#endif
-#endif
-
-  ;
-  return 0;
-}
-_ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
-  eval "$3=yes"
-else
-  eval "$3=no"
-fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-eval ac_res=\$$3
-	       { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
-$as_echo "$ac_res" >&6; }
-  eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
-
-} # ac_fn_c_check_decl
-
 # ac_fn_c_check_type LINENO TYPE VAR INCLUDES
 # -------------------------------------------
 # Tests whether TYPE exists after having included INCLUDES, setting cache
@@ -2457,7 +2546,8 @@ int
 main ()
 {
 static int test_array [1 - 2 * !(($2) >= 0)];
-test_array [0] = 0
+test_array [0] = 0;
+return test_array [0];
 
   ;
   return 0;
@@ -2481,7 +2571,8 @@ int
 main ()
 {
 static int test_array [1 - 2 * !(($2) <= $ac_mid)];
-test_array [0] = 0
+test_array [0] = 0;
+return test_array [0];
 
   ;
   return 0;
@@ -2515,7 +2606,8 @@ int
 main ()
 {
 static int test_array [1 - 2 * !(($2) < 0)];
-test_array [0] = 0
+test_array [0] = 0;
+return test_array [0];
 
   ;
   return 0;
@@ -2539,7 +2631,8 @@ int
 main ()
 {
 static int test_array [1 - 2 * !(($2) >= $ac_mid)];
-test_array [0] = 0
+test_array [0] = 0;
+return test_array [0];
 
   ;
   return 0;
@@ -2581,7 +2674,8 @@ int
 main ()
 {
 static int test_array [1 - 2 * !(($2) <= $ac_mid)];
-test_array [0] = 0
+test_array [0] = 0;
+return test_array [0];
 
   ;
   return 0;
@@ -2690,7 +2784,8 @@ int
 main ()
 {
 static int test_array [1 - 2 * !((($ac_type) -1 >> ($2 / 2 - 1)) >> ($2 / 2 - 1) == 3)];
-test_array [0] = 0
+test_array [0] = 0;
+return test_array [0];
 
   ;
   return 0;
@@ -2752,7 +2847,8 @@ int
 main ()
 {
 static int test_array [1 - 2 * !(0 < ($ac_type) ((((($ac_type) 1 << N) << N) - 1) * 2 + 1))];
-test_array [0] = 0
+test_array [0] = 0;
+return test_array [0];
 
   ;
   return 0;
@@ -2776,7 +2872,8 @@ main ()
 {
 static int test_array [1 - 2 * !(($ac_type) ((((($ac_type) 1 << N) << N) - 1) * 2 + 1)
 		 < ($ac_type) ((((($ac_type) 1 << N) << N) - 1) * 2 + 2))];
-test_array [0] = 0
+test_array [0] = 0;
+return test_array [0];
 
   ;
   return 0;
@@ -2808,12 +2905,66 @@ $as_echo "$ac_res" >&6; }
   eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
 
 } # ac_fn_c_find_intX_t
+
+# ac_fn_c_check_decl LINENO SYMBOL VAR INCLUDES
+# ---------------------------------------------
+# Tests whether SYMBOL is declared in INCLUDES, setting cache variable VAR
+# accordingly.
+ac_fn_c_check_decl ()
+{
+  as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+  as_decl_name=`echo $2|sed 's/ *(.*//'`
+  as_decl_use=`echo $2|sed -e 's/(/((/' -e 's/)/) 0&/' -e 's/,/) 0& (/g'`
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $as_decl_name is declared" >&5
+$as_echo_n "checking whether $as_decl_name is declared... " >&6; }
+if eval \${$3+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+$4
+#ifdef F77_DUMMY_MAIN
+
+#  ifdef __cplusplus
+     extern "C"
+#  endif
+   int F77_DUMMY_MAIN() { return 1; }
+
+#endif
+int
+main ()
+{
+#ifndef $as_decl_name
+#ifdef __cplusplus
+  (void) $as_decl_use;
+#else
+  (void) $as_decl_name;
+#endif
+#endif
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  eval "$3=yes"
+else
+  eval "$3=no"
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+eval ac_res=\$$3
+	       { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+  eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
+
+} # ac_fn_c_check_decl
 cat >config.log <<_ACEOF
 This file contains any messages produced by compilers while
 running configure, to aid debugging if configure makes a mistake.
 
-It was created by GetData $as_me 0.7.3, which was
-generated by GNU Autoconf 2.68.  Invocation command line was
+It was created by GetData $as_me 0.8.5, which was
+generated by GNU Autoconf 2.69.  Invocation command line was
 
   $ $0 $@
 
@@ -3162,45 +3313,58 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu
 
 
 
+
+
 $as_echo "#define GETDATA_MAJOR 0" >>confdefs.h
 
 
-$as_echo "#define GETDATA_MINOR 7" >>confdefs.h
+$as_echo "#define GETDATA_MINOR 8" >>confdefs.h
 
 
-$as_echo "#define GETDATA_REVISION 3" >>confdefs.h
+$as_echo "#define GETDATA_REVISION 5" >>confdefs.h
 
 
 $as_echo "#define GETDATA_VERSION_SUFFIX \"\"" >>confdefs.h
 
 
+GETDATA_MAJOR=0
+
+GETDATA_MINOR=8
+
+GETDATA_REVISION=5
 
+GETDATA_VERSION_SUFFIX=
 
 
 
 
 
 
-GETDATA_IFACE_VERSION=4
 
-GETDATA_IMPL_REVISION=3
 
-GETDATA_IFACE_AGE=0
 
-GETDATAXX_VERSION=2:0:0
+GETDATA_IFACE_VERSION=6
 
-FGETDATA_VERSION=2:1:0
+GETDATA_IMPL_REVISION=4
 
-F95GETDATA_VERSION=2:0:0
+GETDATA_IFACE_AGE=1
 
+GETDATAXX_VERSION=5:0:2
 
+FGETDATA_VERSION=4:1:2
 
-ac_config_headers="$ac_config_headers src/config.h"
+F95GETDATA_VERSION=5:0:3
+
+MATLABGETDATA_VERSION=0:1:0
+
+
+
+ac_config_headers="$ac_config_headers src/gd_config.h"
 
 
 BUINDINGS_BUILT=
 BINDINGS_LEFT=
-ENCODINGS_BUILT=" raw ascii"
+ENCODINGS_BUILT=" raw ascii sie"
 ENCODINGS_LEFT=
 PRIVATE_LIBS=
 
@@ -3366,8 +3530,12 @@ if test "x$enable_debug" = "xyes"; then
 $as_echo "#define GETDATA_DEBUG /**/" >>confdefs.h
 
   enable_assert="yes"
+  GETDATA_DEBUG=1
+else
+  GETDATA_DEBUG=0
 fi
 
+
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to enable assertions" >&5
 $as_echo_n "checking whether to enable assertions... " >&6; }
 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $enable_assert" >&5
@@ -3400,6 +3568,8 @@ make_cxxbindings="yes"
 make_f77bindings="yes"
 make_pybindings="yes"
 make_idlbindings="yes"
+make_perlbindings="yes"
+make_matlabbindings="yes"
 # Check whether --enable-bindings was given.
 if test "${enable_bindings+set}" = set; then :
   enableval=$enable_bindings;
@@ -3408,6 +3578,8 @@ if test "${enable_bindings+set}" = set; then :
                  make_f77bindings="no"
                  make_pybindings="no"
                  make_idlbindings="no"
+                 make_perlbindings="no"
+                 make_matlabbindings="no"
                fi
 
 fi
@@ -3485,14 +3657,8 @@ fi
 
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to include the Python bindings" >&5
 $as_echo_n "checking whether to include the Python bindings... " >&6; }
-if test "x$disable_c99" = "xyes"; then
-  make_pybindings="no";
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no (requires C99 compiler)" >&5
-$as_echo "no (requires C99 compiler)" >&6; }
-else
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $make_pybindings" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $make_pybindings" >&5
 $as_echo "$make_pybindings" >&6; }
-fi
 
 # Check whether --enable-idl was given.
 if test "${enable_idl+set}" = set; then :
@@ -3507,15 +3673,41 @@ fi
 
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to include the IDL bindings" >&5
 $as_echo_n "checking whether to include the IDL bindings... " >&6; }
-if test "x$disable_c99" = "xyes"; then
-  make_idlbindings="no";
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no (requires C99 compiler)" >&5
-$as_echo "no (requires C99 compiler)" >&6; }
-else
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $make_idlbindings" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $make_idlbindings" >&5
 $as_echo "$make_idlbindings" >&6; }
+
+# Check whether --enable-perl was given.
+if test "${enable_perl+set}" = set; then :
+  enableval=$enable_perl;
+               case "${enableval}" in
+                 no) make_perlbindings="no" ;;
+                 *) make_perlbindings="yes" ;;
+               esac
+
 fi
 
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to include the Perl bindings" >&5
+$as_echo_n "checking whether to include the Perl bindings... " >&6; }
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $make_perlbindings" >&5
+$as_echo "$make_perlbindings" >&6; }
+
+# Check whether --enable-matlab was given.
+if test "${enable_matlab+set}" = set; then :
+  enableval=$enable_matlab;
+               case "${enableval}" in
+                 no) make_matlabbindings="no" ;;
+                 *) make_matlabbindings="yes" ;;
+               esac
+
+fi
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to include the MATLAB bindings" >&5
+$as_echo_n "checking whether to include the MATLAB bindings... " >&6; }
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $make_matlabbindings" >&5
+$as_echo "$make_matlabbindings" >&6; }
+
 # Check whether --enable-modules was given.
 if test "${enable_modules+set}" = set; then :
   enableval=$enable_modules;
@@ -3623,7 +3815,7 @@ case $as_dir/ in #((
     # by default.
     for ac_prog in ginstall scoinst install; do
       for ac_exec_ext in '' $ac_executable_extensions; do
-	if { test -f "$as_dir/$ac_prog$ac_exec_ext" && $as_test_x "$as_dir/$ac_prog$ac_exec_ext"; }; then
+	if as_fn_executable_p "$as_dir/$ac_prog$ac_exec_ext"; then
 	  if test $ac_prog = install &&
 	    grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then
 	    # AIX install.  It has an incompatible calling convention.
@@ -3792,7 +3984,7 @@ do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
     for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
     ac_cv_prog_STRIP="${ac_tool_prefix}strip"
     $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
@@ -3832,7 +4024,7 @@ do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
     for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
     ac_cv_prog_ac_ct_STRIP="strip"
     $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
@@ -3883,7 +4075,7 @@ do
   test -z "$as_dir" && as_dir=.
     for ac_prog in mkdir gmkdir; do
 	 for ac_exec_ext in '' $ac_executable_extensions; do
-	   { test -f "$as_dir/$ac_prog$ac_exec_ext" && $as_test_x "$as_dir/$ac_prog$ac_exec_ext"; } || continue
+	   as_fn_executable_p "$as_dir/$ac_prog$ac_exec_ext" || continue
 	   case `"$as_dir/$ac_prog$ac_exec_ext" --version 2>&1` in #(
 	     'mkdir (GNU coreutils) '* | \
 	     'mkdir (coreutils) '* | \
@@ -3936,7 +4128,7 @@ do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
     for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
     ac_cv_prog_AWK="$ac_prog"
     $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
@@ -4022,7 +4214,7 @@ fi
 
 # Define the identity of the package.
  PACKAGE='getdata'
- VERSION='0.7.3'
+ VERSION='0.8.5'
 
 
 cat >>confdefs.h <<_ACEOF
@@ -4052,11 +4244,11 @@ MAKEINFO=${MAKEINFO-"${am_missing_run}makeinfo"}
 
 # We need awk for the "check" target.  The system "awk" is bad on
 # some platforms.
-# Always define AMTAR for backward compatibility.
-
-AMTAR=${AMTAR-"${am_missing_run}tar"}
+# Always define AMTAR for backward compatibility.  Yes, it's still used
+# in the wild :-(  We should find a proper way to deprecate it ...
+AMTAR='$${TAR-tar}'
 
-am__tar='${AMTAR} chof - "$$tardir"'; am__untar='${AMTAR} xf -'
+am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -'
 
 
 
@@ -4073,6 +4265,48 @@ else
 $as_echo "no, using $LN_S" >&6; }
 fi
 
+for ac_prog in gawk mawk nawk awk
+do
+  # Extract the first word of "$ac_prog", so it can be a program name with args.
+set dummy $ac_prog; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_AWK+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$AWK"; then
+  ac_cv_prog_AWK="$AWK" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_prog_AWK="$ac_prog"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+fi
+fi
+AWK=$ac_cv_prog_AWK
+if test -n "$AWK"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $AWK" >&5
+$as_echo "$AWK" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+  test -n "$AWK" && break
+done
+
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for grep that handles long lines and -e" >&5
 $as_echo_n "checking for grep that handles long lines and -e... " >&6; }
 if ${ac_cv_path_GREP+:} false; then :
@@ -4089,7 +4323,7 @@ do
     for ac_prog in grep ggrep; do
     for ac_exec_ext in '' $ac_executable_extensions; do
       ac_path_GREP="$as_dir/$ac_prog$ac_exec_ext"
-      { test -f "$ac_path_GREP" && $as_test_x "$ac_path_GREP"; } || continue
+      as_fn_executable_p "$ac_path_GREP" || continue
 # Check for GNU ac_path_GREP and select it if it is found.
   # Check for GNU $ac_path_GREP
 case `"$ac_path_GREP" --version 2>&1` in
@@ -4136,48 +4370,6 @@ $as_echo "$ac_cv_path_GREP" >&6; }
  GREP="$ac_cv_path_GREP"
 
 
-for ac_prog in gawk mawk nawk awk
-do
-  # Extract the first word of "$ac_prog", so it can be a program name with args.
-set dummy $ac_prog; ac_word=$2
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_prog_AWK+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  if test -n "$AWK"; then
-  ac_cv_prog_AWK="$AWK" # Let the user override the test.
-else
-as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
-  IFS=$as_save_IFS
-  test -z "$as_dir" && as_dir=.
-    for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
-    ac_cv_prog_AWK="$ac_prog"
-    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
-    break 2
-  fi
-done
-  done
-IFS=$as_save_IFS
-
-fi
-fi
-AWK=$ac_cv_prog_AWK
-if test -n "$AWK"; then
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $AWK" >&5
-$as_echo "$AWK" >&6; }
-else
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-fi
-
-
-  test -n "$AWK" && break
-done
-
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for a sed that does not truncate output" >&5
 $as_echo_n "checking for a sed that does not truncate output... " >&6; }
 if ${ac_cv_path_SED+:} false; then :
@@ -4200,7 +4392,7 @@ do
     for ac_prog in sed gsed; do
     for ac_exec_ext in '' $ac_executable_extensions; do
       ac_path_SED="$as_dir/$ac_prog$ac_exec_ext"
-      { test -f "$ac_path_SED" && $as_test_x "$ac_path_SED"; } || continue
+      as_fn_executable_p "$ac_path_SED" || continue
 # Check for GNU ac_path_SED and select it if it is found.
   # Check for GNU $ac_path_SED
 case `"$ac_path_SED" --version 2>&1` in
@@ -4247,6 +4439,53 @@ $as_echo "$ac_cv_path_SED" >&6; }
  SED="$ac_cv_path_SED"
   rm -f conftest.sed
 
+
+
+for ac_prog in date
+do
+  # Extract the first word of "$ac_prog", so it can be a program name with args.
+set dummy $ac_prog; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_DATE+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$DATE"; then
+  ac_cv_prog_DATE="$DATE" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_prog_DATE="$ac_prog"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+fi
+fi
+DATE=$ac_cv_prog_DATE
+if test -n "$DATE"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DATE" >&5
+$as_echo "$DATE" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+  test -n "$DATE" && break
+done
+test -n "$DATE" || DATE="not found"
+
+
+
 for ac_prog in diff
 do
   # Extract the first word of "$ac_prog", so it can be a program name with args.
@@ -4265,7 +4504,7 @@ do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
     for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
     ac_cv_prog_DIFF="$ac_prog"
     $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
@@ -4290,6 +4529,142 @@ fi
 done
 
 
+
+for ac_prog in jot
+do
+  # Extract the first word of "$ac_prog", so it can be a program name with args.
+set dummy $ac_prog; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_JOT+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$JOT"; then
+  ac_cv_prog_JOT="$JOT" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_prog_JOT="$ac_prog"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+fi
+fi
+JOT=$ac_cv_prog_JOT
+if test -n "$JOT"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $JOT" >&5
+$as_echo "$JOT" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+  test -n "$JOT" && break
+done
+test -n "$JOT" || JOT="not found"
+
+
+
+for ac_prog in printf
+do
+  # Extract the first word of "$ac_prog", so it can be a program name with args.
+set dummy $ac_prog; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_PRINTF+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$PRINTF"; then
+  ac_cv_prog_PRINTF="$PRINTF" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_prog_PRINTF="$ac_prog"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+fi
+fi
+PRINTF=$ac_cv_prog_PRINTF
+if test -n "$PRINTF"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PRINTF" >&5
+$as_echo "$PRINTF" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+  test -n "$PRINTF" && break
+done
+test -n "$PRINTF" || PRINTF="not found"
+
+
+
+for ac_prog in seq
+do
+  # Extract the first word of "$ac_prog", so it can be a program name with args.
+set dummy $ac_prog; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_SEQ+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$SEQ"; then
+  ac_cv_prog_SEQ="$SEQ" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_prog_SEQ="$ac_prog"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+fi
+fi
+SEQ=$ac_cv_prog_SEQ
+if test -n "$SEQ"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $SEQ" >&5
+$as_echo "$SEQ" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+  test -n "$SEQ" && break
+done
+test -n "$SEQ" || SEQ="not found"
+
+
+
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we're running under Msys" >&5
 $as_echo_n "checking whether we're running under Msys... " >&6; }
 if test "x`uname -o 2> /dev/null`" = "xMsys"; then
@@ -4315,6 +4690,76 @@ _ACEOF
 
 fi
 
+
+echo
+echo "*** Checking host environment"
+echo
+
+# Check whether --enable-fast-unaligned was given.
+if test "${enable_fast_unaligned+set}" = set; then :
+  enableval=$enable_fast_unaligned;
+   case "${enableval}" in
+     yes) gd_unaligned_override="yes" ;;
+     no) gd_unaligned_override="no" ;;
+     *) gd_unaligned_override="check" ;;
+   esac
+
+else
+  gd_unaligned_override="check"
+fi
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ${host} supports fast unaligned memory access" >&5
+$as_echo_n "checking whether ${host} supports fast unaligned memory access... " >&6; }
+if test "x$gd_unaligned_override" = "xyes"; then
+  gd_unaligned_ok=yes
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes (forced)" >&5
+$as_echo "yes (forced)" >&6; }
+elif test "x$gd_unaligned_override" = "xno"; then
+  gd_unaligned_ok=no
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no (forced)" >&5
+$as_echo "no (forced)" >&6; }
+else
+  case "${host}" in
+    i?86-*-*|powerpc*-*-*|x86_64-*-*|armv6789*-*-*) gd_unaligned_ok=yes ;;
+  *) gd_unaligned_ok=no ;;
+  esac
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $gd_unaligned_ok" >&5
+$as_echo "$gd_unaligned_ok" >&6; }
+fi
+
+if test "x$gd_unaligned_ok" = "xyes"; then
+
+$as_echo "#define UNALIGNED_ACCESS_OK 1" >>confdefs.h
+
+fi
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking the directory separator" >&5
+$as_echo_n "checking the directory separator... " >&6; }
+case "${host}" in
+  *-*-djgpp|*-*-mingw32) GD_FDIRSEP=\\; GD_DIRSEP=\\\\ ;;
+  *) GD_FDIRSEP=/; GD_DIRSEP=/ ;;
+esac
+
+
+
+cat >>confdefs.h <<_ACEOF
+#define GD_DIRSEP '$GD_DIRSEP'
+_ACEOF
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $GD_FDIRSEP" >&5
+$as_echo "$GD_FDIRSEP" >&6; }
+
+case "${host}" in
+  *-pc-mingw*)
+  NO_UNDEFINED=" -no-undefined"
+  NO_DLOPEN_TESTS=1 ;;
+  *-pc-cygwin*)
+  NO_UNDEFINED=" -no-undefined -enable-auto-import"
+  NO_DLOPEN_TESTS=1 ;;
+  *) NO_DLOPEN_TESTS=0 ;;
+esac
+
 echo
 echo "*** Checking C compiler characteristics"
 echo
@@ -4340,7 +4785,7 @@ do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
     for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
     ac_cv_prog_CC="${ac_tool_prefix}gcc"
     $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
@@ -4380,7 +4825,7 @@ do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
     for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
     ac_cv_prog_ac_ct_CC="gcc"
     $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
@@ -4433,7 +4878,7 @@ do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
     for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
     ac_cv_prog_CC="${ac_tool_prefix}cc"
     $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
@@ -4474,7 +4919,7 @@ do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
     for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
     if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then
        ac_prog_rejected=yes
        continue
@@ -4532,7 +4977,7 @@ do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
     for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
     ac_cv_prog_CC="$ac_tool_prefix$ac_prog"
     $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
@@ -4576,7 +5021,7 @@ do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
     for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
     ac_cv_prog_ac_ct_CC="$ac_prog"
     $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
@@ -5022,8 +5467,7 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 #include <stdarg.h>
 #include <stdio.h>
-#include <sys/types.h>
-#include <sys/stat.h>
+struct stat;
 /* Most of the following tests are stolen from RCS 5.7's src/conf.sh.  */
 struct buf { int x; };
 FILE * (*rcsopen) (struct buf *, struct stat *, int);
@@ -5159,6 +5603,7 @@ fi
 if test "x$enable_dependency_tracking" != xno; then
   am_depcomp="$ac_aux_dir/depcomp"
   AMDEPBACKSLASH='\'
+  am__nodep='_no'
 fi
  if test "x$enable_dependency_tracking" != xno; then
   AMDEP_TRUE=
@@ -5183,6 +5628,7 @@ else
   # instance it was reported that on HP-UX the gcc test will end up
   # making a dummy file named `D' -- because `-MD' means `put the output
   # in D'.
+  rm -rf conftest.dir
   mkdir conftest.dir
   # Copy depcomp to subdir because otherwise we won't find it if we're
   # using a relative directory.
@@ -5242,7 +5688,7 @@ else
 	break
       fi
       ;;
-    msvisualcpp | msvcmsys)
+    msvc7 | msvc7msys | msvisualcpp | msvcmsys)
       # This compiler won't grok `-c -o', but also, the minuso test has
       # not run yet.  These depmodes are late enough in the game, and
       # so weak that their functioning should not be impacted.
@@ -5556,7 +6002,7 @@ main ()
   return 0;
 }
 _ACEOF
-for ac_arg in '' -std=gnu99 -std=c99 -c99 -AC99 -xc99=all -qlanglvl=extc99
+for ac_arg in '' -std=gnu99 -std=c99 -c99 -AC99 -D_STDC_C99= -qlanglvl=extc99
 do
   CC="$ac_save_CC $ac_arg"
   if ac_fn_c_try_compile "$LINENO"; then :
@@ -5589,8 +6035,6 @@ fi
 
   if test "x$ac_cv_prog_cc_c99" = "xno"; then
     disable_c99="yes"
-    make_pybindings="no"
-    make_idlbindings="no"
   fi
 fi
 if test "x$disable_c99" = "xyes"; then
@@ -5758,7 +6202,7 @@ do
     for ac_prog in egrep; do
     for ac_exec_ext in '' $ac_executable_extensions; do
       ac_path_EGREP="$as_dir/$ac_prog$ac_exec_ext"
-      { test -f "$ac_path_EGREP" && $as_test_x "$ac_path_EGREP"; } || continue
+      as_fn_executable_p "$ac_path_EGREP" || continue
 # Check for GNU ac_path_EGREP and select it if it is found.
   # Check for GNU $ac_path_EGREP
 case `"$ac_path_EGREP" --version 2>&1` in
@@ -5918,11 +6362,144 @@ $as_echo "#define STDC_HEADERS 1" >>confdefs.h
 
 fi
 
-if test "x$make_cxxbindings" != "xno"; then
-  echo
-  echo "*** Checking C++ compiler characteristics"
-  echo
-  ac_ext=cpp
+# By default we simply use the C compiler to build assembly code.
+
+test "${CCAS+set}" = set || CCAS=$CC
+test "${CCASFLAGS+set}" = set || CCASFLAGS=$CFLAGS
+
+
+
+depcc="$CCAS"   am_compiler_list=
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking dependency style of $depcc" >&5
+$as_echo_n "checking dependency style of $depcc... " >&6; }
+if ${am_cv_CCAS_dependencies_compiler_type+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then
+  # We make a subdir and do the tests there.  Otherwise we can end up
+  # making bogus files that we don't know about and never remove.  For
+  # instance it was reported that on HP-UX the gcc test will end up
+  # making a dummy file named `D' -- because `-MD' means `put the output
+  # in D'.
+  rm -rf conftest.dir
+  mkdir conftest.dir
+  # Copy depcomp to subdir because otherwise we won't find it if we're
+  # using a relative directory.
+  cp "$am_depcomp" conftest.dir
+  cd conftest.dir
+  # We will build objects and dependencies in a subdirectory because
+  # it helps to detect inapplicable dependency modes.  For instance
+  # both Tru64's cc and ICC support -MD to output dependencies as a
+  # side effect of compilation, but ICC will put the dependencies in
+  # the current directory while Tru64 will put them in the object
+  # directory.
+  mkdir sub
+
+  am_cv_CCAS_dependencies_compiler_type=none
+  if test "$am_compiler_list" = ""; then
+     am_compiler_list=`sed -n 's/^#*\([a-zA-Z0-9]*\))$/\1/p' < ./depcomp`
+  fi
+  am__universal=false
+
+
+  for depmode in $am_compiler_list; do
+    # Setup a source with many dependencies, because some compilers
+    # like to wrap large dependency lists on column 80 (with \), and
+    # we should not choose a depcomp mode which is confused by this.
+    #
+    # We need to recreate these files for each test, as the compiler may
+    # overwrite some of them when testing with obscure command lines.
+    # This happens at least with the AIX C compiler.
+    : > sub/conftest.c
+    for i in 1 2 3 4 5 6; do
+      echo '#include "conftst'$i'.h"' >> sub/conftest.c
+      # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with
+      # Solaris 8's {/usr,}/bin/sh.
+      touch sub/conftst$i.h
+    done
+    echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
+
+    # We check with `-c' and `-o' for the sake of the "dashmstdout"
+    # mode.  It turns out that the SunPro C++ compiler does not properly
+    # handle `-M -o', and we need to detect this.  Also, some Intel
+    # versions had trouble with output in subdirs
+    am__obj=sub/conftest.${OBJEXT-o}
+    am__minus_obj="-o $am__obj"
+    case $depmode in
+    gcc)
+      # This depmode causes a compiler race in universal mode.
+      test "$am__universal" = false || continue
+      ;;
+    nosideeffect)
+      # after this tag, mechanisms are not by side-effect, so they'll
+      # only be used when explicitly requested
+      if test "x$enable_dependency_tracking" = xyes; then
+	continue
+      else
+	break
+      fi
+      ;;
+    msvc7 | msvc7msys | msvisualcpp | msvcmsys)
+      # This compiler won't grok `-c -o', but also, the minuso test has
+      # not run yet.  These depmodes are late enough in the game, and
+      # so weak that their functioning should not be impacted.
+      am__obj=conftest.${OBJEXT-o}
+      am__minus_obj=
+      ;;
+    none) break ;;
+    esac
+    if depmode=$depmode \
+       source=sub/conftest.c object=$am__obj \
+       depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \
+       $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \
+         >/dev/null 2>conftest.err &&
+       grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 &&
+       grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 &&
+       grep $am__obj sub/conftest.Po > /dev/null 2>&1 &&
+       ${MAKE-make} -s -f confmf > /dev/null 2>&1; then
+      # icc doesn't choke on unknown options, it will just issue warnings
+      # or remarks (even with -Werror).  So we grep stderr for any message
+      # that says an option was ignored or not supported.
+      # When given -MP, icc 7.0 and 7.1 complain thusly:
+      #   icc: Command line warning: ignoring option '-M'; no argument required
+      # The diagnosis changed in icc 8.0:
+      #   icc: Command line remark: option '-MP' not supported
+      if (grep 'ignoring option' conftest.err ||
+          grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else
+        am_cv_CCAS_dependencies_compiler_type=$depmode
+        break
+      fi
+    fi
+  done
+
+  cd ..
+  rm -rf conftest.dir
+else
+  am_cv_CCAS_dependencies_compiler_type=none
+fi
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_CCAS_dependencies_compiler_type" >&5
+$as_echo "$am_cv_CCAS_dependencies_compiler_type" >&6; }
+CCASDEPMODE=depmode=$am_cv_CCAS_dependencies_compiler_type
+
+ if
+  test "x$enable_dependency_tracking" != xno \
+  && test "$am_cv_CCAS_dependencies_compiler_type" = gcc3; then
+  am__fastdepCCAS_TRUE=
+  am__fastdepCCAS_FALSE='#'
+else
+  am__fastdepCCAS_TRUE='#'
+  am__fastdepCCAS_FALSE=
+fi
+
+
+
+echo
+echo "*** Checking C++ compiler characteristics"
+echo
+ac_ext=cpp
 ac_cpp='$CXXCPP $CPPFLAGS'
 ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
 ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
@@ -5950,7 +6527,7 @@ do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
     for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
     ac_cv_prog_CXX="$ac_tool_prefix$ac_prog"
     $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
@@ -5994,7 +6571,7 @@ do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
     for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
     ac_cv_prog_ac_ct_CXX="$ac_prog"
     $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
@@ -6192,6 +6769,7 @@ else
   # instance it was reported that on HP-UX the gcc test will end up
   # making a dummy file named `D' -- because `-MD' means `put the output
   # in D'.
+  rm -rf conftest.dir
   mkdir conftest.dir
   # Copy depcomp to subdir because otherwise we won't find it if we're
   # using a relative directory.
@@ -6251,7 +6829,7 @@ else
 	break
       fi
       ;;
-    msvisualcpp | msvcmsys)
+    msvc7 | msvc7msys | msvisualcpp | msvcmsys)
       # This compiler won't grok `-c -o', but also, the minuso test has
       # not run yet.  These depmodes are late enough in the game, and
       # so weak that their functioning should not be impacted.
@@ -6306,7 +6884,7 @@ else
 fi
 
 
-  ac_ext=cpp
+ac_ext=cpp
 ac_cpp='$CXXCPP $CPPFLAGS'
 ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
 ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
@@ -6371,7 +6949,7 @@ ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
 ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
 ac_compiler_gnu=$ac_cv_c_compiler_gnu
 
-fi
+
 if test "x$make_f77bindings" != "xno"; then
   echo
   echo "*** Checking Fortran 77 compiler characteristics"
@@ -6381,7 +6959,7 @@ ac_compile='$F77 -c $FFLAGS conftest.$ac_ext >&5'
 ac_link='$F77 -o conftest$ac_exeext $FFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
 ac_compiler_gnu=$ac_cv_f77_compiler_gnu
 if test -n "$ac_tool_prefix"; then
-  for ac_prog in g77 xlf f77 frt pgf77 cf77 fort77 fl32 af77 xlf90 f90 pgf90 pghpf epcf90 gfortran g95 xlf95 f95 fort ifort ifc efc pgfortran pgf95 lf95 ftn
+  for ac_prog in g77 xlf f77 frt pgf77 cf77 fort77 fl32 af77 xlf90 f90 pgf90 pghpf epcf90 gfortran g95 xlf95 f95 fort ifort ifc efc pgfortran pgf95 lf95 ftn nagfor
   do
     # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args.
 set dummy $ac_tool_prefix$ac_prog; ac_word=$2
@@ -6399,7 +6977,7 @@ do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
     for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
     ac_cv_prog_F77="$ac_tool_prefix$ac_prog"
     $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
@@ -6425,7 +7003,7 @@ fi
 fi
 if test -z "$F77"; then
   ac_ct_F77=$F77
-  for ac_prog in g77 xlf f77 frt pgf77 cf77 fort77 fl32 af77 xlf90 f90 pgf90 pghpf epcf90 gfortran g95 xlf95 f95 fort ifort ifc efc pgfortran pgf95 lf95 ftn
+  for ac_prog in g77 xlf f77 frt pgf77 cf77 fort77 fl32 af77 xlf90 f90 pgf90 pghpf epcf90 gfortran g95 xlf95 f95 fort ifort ifc efc pgfortran pgf95 lf95 ftn nagfor
 do
   # Extract the first word of "$ac_prog", so it can be a program name with args.
 set dummy $ac_prog; ac_word=$2
@@ -6443,7 +7021,7 @@ do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
     for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
     ac_cv_prog_ac_ct_F77="$ac_prog"
     $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
@@ -6656,7 +7234,7 @@ ac_compile='$FC -c $FCFLAGS $ac_fcflags_srcext conftest.$ac_ext >&5'
 ac_link='$FC -o conftest$ac_exeext $FCFLAGS $LDFLAGS $ac_fcflags_srcext conftest.$ac_ext $LIBS >&5'
 ac_compiler_gnu=$ac_cv_fc_compiler_gnu
 if test -n "$ac_tool_prefix"; then
-  for ac_prog in gfortran g95 xlf95 f95 fort ifort ifc efc pgfortran pgf95 lf95 ftn xlf90 f90 pgf90 pghpf epcf90 g77 xlf f77 frt pgf77 cf77 fort77 fl32 af77
+  for ac_prog in gfortran g95 xlf95 f95 fort ifort ifc efc pgfortran pgf95 lf95 ftn nagfor xlf90 f90 pgf90 pghpf epcf90 g77 xlf f77 frt pgf77 cf77 fort77 fl32 af77
   do
     # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args.
 set dummy $ac_tool_prefix$ac_prog; ac_word=$2
@@ -6674,7 +7252,7 @@ do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
     for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
     ac_cv_prog_FC="$ac_tool_prefix$ac_prog"
     $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
@@ -6700,7 +7278,7 @@ fi
 fi
 if test -z "$FC"; then
   ac_ct_FC=$FC
-  for ac_prog in gfortran g95 xlf95 f95 fort ifort ifc efc pgfortran pgf95 lf95 ftn xlf90 f90 pgf90 pghpf epcf90 g77 xlf f77 frt pgf77 cf77 fort77 fl32 af77
+  for ac_prog in gfortran g95 xlf95 f95 fort ifort ifc efc pgfortran pgf95 lf95 ftn nagfor xlf90 f90 pgf90 pghpf epcf90 g77 xlf f77 frt pgf77 cf77 fort77 fl32 af77
 do
   # Extract the first word of "$ac_prog", so it can be a program name with args.
 set dummy $ac_prog; ac_word=$2
@@ -6718,7 +7296,7 @@ do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
     for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
     ac_cv_prog_ac_ct_FC="$ac_prog"
     $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
@@ -6851,6 +7429,11 @@ else
   fi
 fi
 
+if test $ac_compiler_gnu = yes; then
+  GFC=yes
+else
+  GFC=
+fi
 ac_ext=c
 ac_cpp='$CPP $CPPFLAGS'
 ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
@@ -6970,7 +7553,7 @@ do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
     for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
     ac_cv_prog_BUILDCC="$ac_prog"
     $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
@@ -7015,7 +7598,7 @@ do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
     for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
     ac_cv_prog_BUILDCC="$ac_prog"
     $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
@@ -7056,8 +7639,8 @@ esac
 
 
 
-macro_version='2.4'
-macro_revision='1.3293'
+macro_version='2.4.2'
+macro_revision='1.3337'
 
 
 
@@ -7164,7 +7747,7 @@ do
     for ac_prog in sed gsed; do
     for ac_exec_ext in '' $ac_executable_extensions; do
       ac_path_SED="$as_dir/$ac_prog$ac_exec_ext"
-      { test -f "$ac_path_SED" && $as_test_x "$ac_path_SED"; } || continue
+      as_fn_executable_p "$ac_path_SED" || continue
 # Check for GNU ac_path_SED and select it if it is found.
   # Check for GNU $ac_path_SED
 case `"$ac_path_SED" --version 2>&1` in
@@ -7243,7 +7826,7 @@ do
     for ac_prog in fgrep; do
     for ac_exec_ext in '' $ac_executable_extensions; do
       ac_path_FGREP="$as_dir/$ac_prog$ac_exec_ext"
-      { test -f "$ac_path_FGREP" && $as_test_x "$ac_path_FGREP"; } || continue
+      as_fn_executable_p "$ac_path_FGREP" || continue
 # Check for GNU ac_path_FGREP and select it if it is found.
   # Check for GNU $ac_path_FGREP
 case `"$ac_path_FGREP" --version 2>&1` in
@@ -7499,7 +8082,7 @@ do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
     for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
     ac_cv_prog_DUMPBIN="$ac_tool_prefix$ac_prog"
     $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
@@ -7543,7 +8126,7 @@ do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
     for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
     ac_cv_prog_ac_ct_DUMPBIN="$ac_prog"
     $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
@@ -7690,6 +8273,11 @@ else
     lt_cv_sys_max_cmd_len=196608
     ;;
 
+  os2*)
+    # The test takes a long time on OS/2.
+    lt_cv_sys_max_cmd_len=8192
+    ;;
+
   osf*)
     # Dr. Hans Ekkehard Plesser reports seeing a kernel panic running configure
     # due to this test when exec_disable_arg_limit is 1 on Tru64. It is not
@@ -7729,7 +8317,7 @@ else
       # If test is not a shell built-in, we'll probably end up computing a
       # maximum length that is only half of the actual maximum length, but
       # we can't tell.
-      while { test "X"`func_fallback_echo "$teststring$teststring" 2>/dev/null` \
+      while { test "X"`env echo "$teststring$teststring" 2>/dev/null` \
 	         = "X$teststring$teststring"; } >/dev/null 2>&1 &&
 	      test $i != 17 # 1/2 MB should be enough
       do
@@ -7951,7 +8539,7 @@ do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
     for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
     ac_cv_prog_OBJDUMP="${ac_tool_prefix}objdump"
     $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
@@ -7991,7 +8579,7 @@ do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
     for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
     ac_cv_prog_ac_ct_OBJDUMP="objdump"
     $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
@@ -8158,7 +8746,7 @@ irix5* | irix6* | nonstopux*)
   lt_cv_deplibs_check_method=pass_all
   ;;
 
-# This must be Linux ELF.
+# This must be glibc/ELF.
 linux* | k*bsd*-gnu | kopensolaris*-gnu)
   lt_cv_deplibs_check_method=pass_all
   ;;
@@ -8297,7 +8885,7 @@ do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
     for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
     ac_cv_prog_DLLTOOL="${ac_tool_prefix}dlltool"
     $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
@@ -8337,7 +8925,7 @@ do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
     for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
     ac_cv_prog_ac_ct_DLLTOOL="dlltool"
     $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
@@ -8440,7 +9028,7 @@ do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
     for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
     ac_cv_prog_AR="$ac_tool_prefix$ac_prog"
     $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
@@ -8484,7 +9072,7 @@ do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
     for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
     ac_cv_prog_ac_ct_AR="$ac_prog"
     $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
@@ -8609,7 +9197,7 @@ do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
     for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
     ac_cv_prog_STRIP="${ac_tool_prefix}strip"
     $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
@@ -8649,7 +9237,7 @@ do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
     for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
     ac_cv_prog_ac_ct_STRIP="strip"
     $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
@@ -8708,7 +9296,7 @@ do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
     for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
     ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib"
     $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
@@ -8748,7 +9336,7 @@ do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
     for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
     ac_cv_prog_ac_ct_RANLIB="ranlib"
     $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
@@ -8798,13 +9386,13 @@ old_postuninstall_cmds=
 if test -n "$RANLIB"; then
   case $host_os in
   openbsd*)
-    old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB -t \$oldlib"
+    old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB -t \$tool_oldlib"
     ;;
   *)
-    old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB \$oldlib"
+    old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB \$tool_oldlib"
     ;;
   esac
-  old_archive_cmds="$old_archive_cmds~\$RANLIB \$oldlib"
+  old_archive_cmds="$old_archive_cmds~\$RANLIB \$tool_oldlib"
 fi
 
 case $host_os in
@@ -8951,6 +9539,7 @@ for ac_symprfx in "" "_"; do
     # which start with @ or ?.
     lt_cv_sys_global_symbol_pipe="$AWK '"\
 "     {last_section=section; section=\$ 3};"\
+"     /^COFF SYMBOL TABLE/{for(i in hide) delete hide[i]};"\
 "     /Section length .*#relocs.*(pick any)/{hide[last_section]=1};"\
 "     \$ 0!~/External *\|/{next};"\
 "     / 0+ UNDEF /{next}; / UNDEF \([^|]\)*()/{next};"\
@@ -9339,7 +9928,7 @@ $as_echo "$lt_cv_cc_needs_belf" >&6; }
     CFLAGS="$SAVE_CFLAGS"
   fi
   ;;
-sparc*-*solaris*)
+*-*solaris*)
   # Find out which ABI we are using.
   echo 'int i;' > conftest.$ac_ext
   if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5
@@ -9350,7 +9939,20 @@ sparc*-*solaris*)
     case `/usr/bin/file conftest.o` in
     *64-bit*)
       case $lt_cv_prog_gnu_ld in
-      yes*) LD="${LD-ld} -m elf64_sparc" ;;
+      yes*)
+        case $host in
+        i?86-*-solaris*)
+          LD="${LD-ld} -m elf_x86_64"
+          ;;
+        sparc*-*-solaris*)
+          LD="${LD-ld} -m elf64_sparc"
+          ;;
+        esac
+        # GNU ld 2.21 introduced _sol2 emulations.  Use them if available.
+        if ${LD-ld} -V | grep _sol2 >/dev/null 2>&1; then
+          LD="${LD-ld}_sol2"
+        fi
+        ;;
       *)
 	if ${LD-ld} -64 -r -o conftest2.o conftest.o >/dev/null 2>&1; then
 	  LD="${LD-ld} -64"
@@ -9383,7 +9985,7 @@ do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
     for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
     ac_cv_prog_MANIFEST_TOOL="${ac_tool_prefix}mt"
     $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
@@ -9423,7 +10025,7 @@ do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
     for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
     ac_cv_prog_ac_ct_MANIFEST_TOOL="mt"
     $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
@@ -9503,7 +10105,7 @@ do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
     for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
     ac_cv_prog_DSYMUTIL="${ac_tool_prefix}dsymutil"
     $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
@@ -9543,7 +10145,7 @@ do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
     for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
     ac_cv_prog_ac_ct_DSYMUTIL="dsymutil"
     $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
@@ -9595,7 +10197,7 @@ do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
     for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
     ac_cv_prog_NMEDIT="${ac_tool_prefix}nmedit"
     $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
@@ -9635,7 +10237,7 @@ do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
     for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
     ac_cv_prog_ac_ct_NMEDIT="nmedit"
     $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
@@ -9687,7 +10289,7 @@ do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
     for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
     ac_cv_prog_LIPO="${ac_tool_prefix}lipo"
     $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
@@ -9727,7 +10329,7 @@ do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
     for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
     ac_cv_prog_ac_ct_LIPO="lipo"
     $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
@@ -9779,7 +10381,7 @@ do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
     for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
     ac_cv_prog_OTOOL="${ac_tool_prefix}otool"
     $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
@@ -9819,7 +10421,7 @@ do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
     for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
     ac_cv_prog_ac_ct_OTOOL="otool"
     $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
@@ -9871,7 +10473,7 @@ do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
     for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
     ac_cv_prog_OTOOL64="${ac_tool_prefix}otool64"
     $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
@@ -9911,7 +10513,7 @@ do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
     for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
     ac_cv_prog_ac_ct_OTOOL64="otool64"
     $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
@@ -9990,7 +10592,13 @@ else
 	$LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \
 	  -dynamiclib -Wl,-single_module conftest.c 2>conftest.err
         _lt_result=$?
-	if test -f libconftest.dylib && test ! -s conftest.err && test $_lt_result = 0; then
+	# If there is a non-empty error log, and "single_module"
+	# appears in it, assume the flag caused a linker warning
+        if test -s conftest.err && $GREP single_module conftest.err; then
+	  cat conftest.err >&5
+	# Otherwise, if the output was created with a 0 exit code from
+	# the compiler, it worked.
+	elif test -f libconftest.dylib && test $_lt_result -eq 0; then
 	  lt_cv_apple_cc_single_mod=yes
 	else
 	  cat conftest.err >&5
@@ -10001,6 +10609,7 @@ else
 fi
 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_apple_cc_single_mod" >&5
 $as_echo "$lt_cv_apple_cc_single_mod" >&6; }
+
     { $as_echo "$as_me:${as_lineno-$LINENO}: checking for -exported_symbols_list linker flag" >&5
 $as_echo_n "checking for -exported_symbols_list linker flag... " >&6; }
 if ${lt_cv_ld_exported_symbols_list+:} false; then :
@@ -10033,6 +10642,7 @@ rm -f core conftest.err conftest.$ac_objext \
 fi
 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ld_exported_symbols_list" >&5
 $as_echo "$lt_cv_ld_exported_symbols_list" >&6; }
+
     { $as_echo "$as_me:${as_lineno-$LINENO}: checking for -force_load linker flag" >&5
 $as_echo_n "checking for -force_load linker flag... " >&6; }
 if ${lt_cv_ld_force_load+:} false; then :
@@ -10054,7 +10664,9 @@ _LT_EOF
       echo "$LTCC $LTCFLAGS $LDFLAGS -o conftest conftest.c -Wl,-force_load,./libconftest.a" >&5
       $LTCC $LTCFLAGS $LDFLAGS -o conftest conftest.c -Wl,-force_load,./libconftest.a 2>conftest.err
       _lt_result=$?
-      if test -f conftest && test ! -s conftest.err && test $_lt_result = 0 && $GREP forced_load conftest 2>&1 >/dev/null; then
+      if test -s conftest.err && $GREP force_load conftest.err; then
+	cat conftest.err >&5
+      elif test -f conftest && test $_lt_result -eq 0 && $GREP forced_load conftest >/dev/null 2>&1 ; then
 	lt_cv_ld_force_load=yes
       else
 	cat conftest.err >&5
@@ -10220,7 +10832,22 @@ fi
 
 # Check whether --with-pic was given.
 if test "${with_pic+set}" = set; then :
-  withval=$with_pic; pic_mode="$withval"
+  withval=$with_pic; lt_p=${PACKAGE-default}
+    case $withval in
+    yes|no) pic_mode=$withval ;;
+    *)
+      pic_mode=default
+      # Look at the argument we got.  We use all the common list separators.
+      lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR,"
+      for lt_pkg in $withval; do
+	IFS="$lt_save_ifs"
+	if test "X$lt_pkg" = "X$lt_p"; then
+	  pic_mode=yes
+	fi
+      done
+      IFS="$lt_save_ifs"
+      ;;
+    esac
 else
   pic_mode=default
 fi
@@ -10298,6 +10925,10 @@ LIBTOOL='$(SHELL) $(top_builddir)/libtool'
 
 
 
+
+
+
+
 test -z "$LN_S" && LN_S="ln -s"
 
 
@@ -10757,7 +11388,9 @@ lt_prog_compiler_static=
     case $cc_basename in
     nvcc*) # Cuda Compiler Driver 2.2
       lt_prog_compiler_wl='-Xlinker '
-      lt_prog_compiler_pic='-Xcompiler -fPIC'
+      if test -n "$lt_prog_compiler_pic"; then
+        lt_prog_compiler_pic="-Xcompiler $lt_prog_compiler_pic"
+      fi
       ;;
     esac
   else
@@ -10848,18 +11481,33 @@ lt_prog_compiler_static=
 	;;
       *)
 	case `$CC -V 2>&1 | sed 5q` in
-	*Sun\ F* | *Sun*Fortran*)
+	*Sun\ Ceres\ Fortran* | *Sun*Fortran*\ [1-7].* | *Sun*Fortran*\ 8.[0-3]*)
 	  # Sun Fortran 8.3 passes all unrecognized flags to the linker
 	  lt_prog_compiler_pic='-KPIC'
 	  lt_prog_compiler_static='-Bstatic'
 	  lt_prog_compiler_wl=''
 	  ;;
+	*Sun\ F* | *Sun*Fortran*)
+	  lt_prog_compiler_pic='-KPIC'
+	  lt_prog_compiler_static='-Bstatic'
+	  lt_prog_compiler_wl='-Qoption ld '
+	  ;;
 	*Sun\ C*)
 	  # Sun C 5.9
 	  lt_prog_compiler_pic='-KPIC'
 	  lt_prog_compiler_static='-Bstatic'
 	  lt_prog_compiler_wl='-Wl,'
 	  ;;
+        *Intel*\ [CF]*Compiler*)
+	  lt_prog_compiler_wl='-Wl,'
+	  lt_prog_compiler_pic='-fPIC'
+	  lt_prog_compiler_static='-static'
+	  ;;
+	*Portland\ Group*)
+	  lt_prog_compiler_wl='-Wl,'
+	  lt_prog_compiler_pic='-fpic'
+	  lt_prog_compiler_static='-Bstatic'
+	  ;;
 	esac
 	;;
       esac
@@ -11221,7 +11869,6 @@ $as_echo_n "checking whether the $compiler linker ($LD) supports shared librarie
   hardcode_direct=no
   hardcode_direct_absolute=no
   hardcode_libdir_flag_spec=
-  hardcode_libdir_flag_spec_ld=
   hardcode_libdir_separator=
   hardcode_minus_L=no
   hardcode_shlibpath_var=unsupported
@@ -11471,8 +12118,7 @@ _LT_EOF
 	xlf* | bgf* | bgxlf* | mpixlf*)
 	  # IBM XL Fortran 10.1 on PPC cannot create shared libs itself
 	  whole_archive_flag_spec='--whole-archive$convenience --no-whole-archive'
-	  hardcode_libdir_flag_spec=
-	  hardcode_libdir_flag_spec_ld='-rpath $libdir'
+	  hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
 	  archive_cmds='$LD -shared $libobjs $deplibs $linker_flags -soname $soname -o $lib'
 	  if test "x$supports_anon_versioning" = xyes; then
 	    archive_expsym_cmds='echo "{ global:" > $output_objdir/$libname.ver~
@@ -11851,6 +12497,7 @@ fi
 	# The linker will not automatically build a static lib if we build a DLL.
 	# _LT_TAGVAR(old_archive_from_new_cmds, )='true'
 	enable_shared_with_static_runtimes=yes
+	exclude_expsyms='_NULL_IMPORT_DESCRIPTOR|_IMPORT_DESCRIPTOR_.*'
 	export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS][ ]/s/.*[ ]\([^ ]*\)/\1,DATA/'\'' | $SED -e '\''/^[AITW][ ]/s/.*[ ]//'\'' | sort | uniq > $export_symbols'
 	# Don't use ranlib
 	old_postinstall_cmds='chmod 644 $oldlib'
@@ -11896,6 +12543,7 @@ fi
   hardcode_shlibpath_var=unsupported
   if test "$lt_cv_ld_force_load" = "yes"; then
     whole_archive_flag_spec='`for conv in $convenience\"\"; do test  -n \"$conv\" && new_convenience=\"$new_convenience ${wl}-force_load,$conv\"; done; func_echo_all \"$new_convenience\"`'
+
   else
     whole_archive_flag_spec=''
   fi
@@ -11924,10 +12572,6 @@ fi
       hardcode_shlibpath_var=no
       ;;
 
-    freebsd1*)
-      ld_shlibs=no
-      ;;
-
     # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor
     # support.  Future versions do this automatically, but an explicit c++rt0.o
     # does not break anything, and helps significantly (at the cost of a little
@@ -11940,7 +12584,7 @@ fi
       ;;
 
     # Unfortunately, older versions of FreeBSD 2 do not have this feature.
-    freebsd2*)
+    freebsd2.*)
       archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'
       hardcode_direct=yes
       hardcode_minus_L=yes
@@ -11979,7 +12623,6 @@ fi
       fi
       if test "$with_gnu_ld" = no; then
 	hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir'
-	hardcode_libdir_flag_spec_ld='+b $libdir'
 	hardcode_libdir_separator=:
 	hardcode_direct=yes
 	hardcode_direct_absolute=yes
@@ -12603,11 +13246,6 @@ esac
 
 
 
-
-
-
-
-
   { $as_echo "$as_me:${as_lineno-$LINENO}: checking dynamic linker characteristics" >&5
 $as_echo_n "checking dynamic linker characteristics... " >&6; }
 
@@ -12697,7 +13335,7 @@ need_version=unknown
 
 case $host_os in
 aix3*)
-  version_type=linux
+  version_type=linux # correct to gnu/linux during the next big refactor
   library_names_spec='${libname}${release}${shared_ext}$versuffix $libname.a'
   shlibpath_var=LIBPATH
 
@@ -12706,7 +13344,7 @@ aix3*)
   ;;
 
 aix[4-9]*)
-  version_type=linux
+  version_type=linux # correct to gnu/linux during the next big refactor
   need_lib_prefix=no
   need_version=no
   hardcode_into_libs=yes
@@ -12771,7 +13409,7 @@ beos*)
   ;;
 
 bsdi[45]*)
-  version_type=linux
+  version_type=linux # correct to gnu/linux during the next big refactor
   need_version=no
   library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
   soname_spec='${libname}${release}${shared_ext}$major'
@@ -12910,7 +13548,7 @@ darwin* | rhapsody*)
   ;;
 
 dgux*)
-  version_type=linux
+  version_type=linux # correct to gnu/linux during the next big refactor
   need_lib_prefix=no
   need_version=no
   library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname$shared_ext'
@@ -12918,10 +13556,6 @@ dgux*)
   shlibpath_var=LD_LIBRARY_PATH
   ;;
 
-freebsd1*)
-  dynamic_linker=no
-  ;;
-
 freebsd* | dragonfly*)
   # DragonFly does not have aout.  When/if they implement a new
   # versioning mechanism, adjust this.
@@ -12929,7 +13563,7 @@ freebsd* | dragonfly*)
     objformat=`/usr/bin/objformat`
   else
     case $host_os in
-    freebsd[123]*) objformat=aout ;;
+    freebsd[23].*) objformat=aout ;;
     *) objformat=elf ;;
     esac
   fi
@@ -12947,7 +13581,7 @@ freebsd* | dragonfly*)
   esac
   shlibpath_var=LD_LIBRARY_PATH
   case $host_os in
-  freebsd2*)
+  freebsd2.*)
     shlibpath_overrides_runpath=yes
     ;;
   freebsd3.[01]* | freebsdelf3.[01]*)
@@ -12967,17 +13601,18 @@ freebsd* | dragonfly*)
   ;;
 
 gnu*)
-  version_type=linux
+  version_type=linux # correct to gnu/linux during the next big refactor
   need_lib_prefix=no
   need_version=no
   library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}'
   soname_spec='${libname}${release}${shared_ext}$major'
   shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=no
   hardcode_into_libs=yes
   ;;
 
 haiku*)
-  version_type=linux
+  version_type=linux # correct to gnu/linux during the next big refactor
   need_lib_prefix=no
   need_version=no
   dynamic_linker="$host_os runtime_loader"
@@ -13038,7 +13673,7 @@ hpux9* | hpux10* | hpux11*)
   ;;
 
 interix[3-9]*)
-  version_type=linux
+  version_type=linux # correct to gnu/linux during the next big refactor
   need_lib_prefix=no
   need_version=no
   library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}'
@@ -13054,7 +13689,7 @@ irix5* | irix6* | nonstopux*)
     nonstopux*) version_type=nonstopux ;;
     *)
 	if test "$lt_cv_prog_gnu_ld" = yes; then
-		version_type=linux
+		version_type=linux # correct to gnu/linux during the next big refactor
 	else
 		version_type=irix
 	fi ;;
@@ -13091,9 +13726,9 @@ linux*oldld* | linux*aout* | linux*coff*)
   dynamic_linker=no
   ;;
 
-# This must be Linux ELF.
+# This must be glibc/ELF.
 linux* | k*bsd*-gnu | kopensolaris*-gnu)
-  version_type=linux
+  version_type=linux # correct to gnu/linux during the next big refactor
   need_lib_prefix=no
   need_version=no
   library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
@@ -13175,7 +13810,7 @@ netbsd*)
   ;;
 
 newsos6)
-  version_type=linux
+  version_type=linux # correct to gnu/linux during the next big refactor
   library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
   shlibpath_var=LD_LIBRARY_PATH
   shlibpath_overrides_runpath=yes
@@ -13244,7 +13879,7 @@ rdos*)
   ;;
 
 solaris*)
-  version_type=linux
+  version_type=linux # correct to gnu/linux during the next big refactor
   need_lib_prefix=no
   need_version=no
   library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
@@ -13269,7 +13904,7 @@ sunos4*)
   ;;
 
 sysv4 | sysv4.3*)
-  version_type=linux
+  version_type=linux # correct to gnu/linux during the next big refactor
   library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
   soname_spec='${libname}${release}${shared_ext}$major'
   shlibpath_var=LD_LIBRARY_PATH
@@ -13293,7 +13928,7 @@ sysv4 | sysv4.3*)
 
 sysv4*MP*)
   if test -d /usr/nec ;then
-    version_type=linux
+    version_type=linux # correct to gnu/linux during the next big refactor
     library_names_spec='$libname${shared_ext}.$versuffix $libname${shared_ext}.$major $libname${shared_ext}'
     soname_spec='$libname${shared_ext}.$major'
     shlibpath_var=LD_LIBRARY_PATH
@@ -13324,7 +13959,7 @@ sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*)
 
 tpf*)
   # TPF is a cross-target only.  Preferred cross-host = GNU/Linux.
-  version_type=linux
+  version_type=linux # correct to gnu/linux during the next big refactor
   need_lib_prefix=no
   need_version=no
   library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
@@ -13334,7 +13969,7 @@ tpf*)
   ;;
 
 uts4*)
-  version_type=linux
+  version_type=linux # correct to gnu/linux during the next big refactor
   library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
   soname_spec='${libname}${release}${shared_ext}$major'
   shlibpath_var=LD_LIBRARY_PATH
@@ -14259,7 +14894,6 @@ export_dynamic_flag_spec_CXX=
 hardcode_direct_CXX=no
 hardcode_direct_absolute_CXX=no
 hardcode_libdir_flag_spec_CXX=
-hardcode_libdir_flag_spec_ld_CXX=
 hardcode_libdir_separator_CXX=
 hardcode_minus_L_CXX=no
 hardcode_shlibpath_var_CXX=unsupported
@@ -14843,6 +15477,7 @@ fi
   hardcode_shlibpath_var_CXX=unsupported
   if test "$lt_cv_ld_force_load" = "yes"; then
     whole_archive_flag_spec_CXX='`for conv in $convenience\"\"; do test  -n \"$conv\" && new_convenience=\"$new_convenience ${wl}-force_load,$conv\"; done; func_echo_all \"$new_convenience\"`'
+
   else
     whole_archive_flag_spec_CXX=''
   fi
@@ -14887,7 +15522,7 @@ fi
         esac
         ;;
 
-      freebsd[12]*)
+      freebsd2.*)
         # C++ shared libraries reported to be fairly broken before
 	# switch to ELF
         ld_shlibs_CXX=no
@@ -15563,6 +16198,7 @@ _lt_libdeps_save_CFLAGS=$CFLAGS
 case "$CC $CFLAGS " in #(
 *\ -flto*\ *) CFLAGS="$CFLAGS -fno-lto" ;;
 *\ -fwhopr*\ *) CFLAGS="$CFLAGS -fno-whopr" ;;
+*\ -fuse-linker-plugin*\ *) CFLAGS="$CFLAGS -fno-use-linker-plugin" ;;
 esac
 
 if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5
@@ -16352,7 +16988,9 @@ $as_echo_n "checking whether the $compiler linker ($LD) supports shared librarie
     ;;
   cygwin* | mingw* | cegcc*)
     case $cc_basename in
-    cl*) ;;
+    cl*)
+      exclude_expsyms_CXX='_NULL_IMPORT_DESCRIPTOR|_IMPORT_DESCRIPTOR_.*'
+      ;;
     *)
       export_symbols_cmds_CXX='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS][ ]/s/.*[ ]\([^ ]*\)/\1 DATA/;s/^.*[ ]__nm__\([^ ]*\)[ ][^ ]*/\1 DATA/;/^I[ ]/d;/^[AITW][ ]/s/.* //'\'' | sort | uniq > $export_symbols'
       exclude_expsyms_CXX='[_]+GLOBAL_OFFSET_TABLE_|[_]+GLOBAL__[FID]_.*|[_]+head_[A-Za-z0-9_]+_dll|[A-Za-z0-9_]+_dll_iname'
@@ -16505,8 +17143,6 @@ esac
 
 
 
-
-
     { $as_echo "$as_me:${as_lineno-$LINENO}: checking dynamic linker characteristics" >&5
 $as_echo_n "checking dynamic linker characteristics... " >&6; }
 
@@ -16532,7 +17168,7 @@ need_version=unknown
 
 case $host_os in
 aix3*)
-  version_type=linux
+  version_type=linux # correct to gnu/linux during the next big refactor
   library_names_spec='${libname}${release}${shared_ext}$versuffix $libname.a'
   shlibpath_var=LIBPATH
 
@@ -16541,7 +17177,7 @@ aix3*)
   ;;
 
 aix[4-9]*)
-  version_type=linux
+  version_type=linux # correct to gnu/linux during the next big refactor
   need_lib_prefix=no
   need_version=no
   hardcode_into_libs=yes
@@ -16606,7 +17242,7 @@ beos*)
   ;;
 
 bsdi[45]*)
-  version_type=linux
+  version_type=linux # correct to gnu/linux during the next big refactor
   need_version=no
   library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
   soname_spec='${libname}${release}${shared_ext}$major'
@@ -16743,7 +17379,7 @@ darwin* | rhapsody*)
   ;;
 
 dgux*)
-  version_type=linux
+  version_type=linux # correct to gnu/linux during the next big refactor
   need_lib_prefix=no
   need_version=no
   library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname$shared_ext'
@@ -16751,10 +17387,6 @@ dgux*)
   shlibpath_var=LD_LIBRARY_PATH
   ;;
 
-freebsd1*)
-  dynamic_linker=no
-  ;;
-
 freebsd* | dragonfly*)
   # DragonFly does not have aout.  When/if they implement a new
   # versioning mechanism, adjust this.
@@ -16762,7 +17394,7 @@ freebsd* | dragonfly*)
     objformat=`/usr/bin/objformat`
   else
     case $host_os in
-    freebsd[123]*) objformat=aout ;;
+    freebsd[23].*) objformat=aout ;;
     *) objformat=elf ;;
     esac
   fi
@@ -16780,7 +17412,7 @@ freebsd* | dragonfly*)
   esac
   shlibpath_var=LD_LIBRARY_PATH
   case $host_os in
-  freebsd2*)
+  freebsd2.*)
     shlibpath_overrides_runpath=yes
     ;;
   freebsd3.[01]* | freebsdelf3.[01]*)
@@ -16800,17 +17432,18 @@ freebsd* | dragonfly*)
   ;;
 
 gnu*)
-  version_type=linux
+  version_type=linux # correct to gnu/linux during the next big refactor
   need_lib_prefix=no
   need_version=no
   library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}'
   soname_spec='${libname}${release}${shared_ext}$major'
   shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=no
   hardcode_into_libs=yes
   ;;
 
 haiku*)
-  version_type=linux
+  version_type=linux # correct to gnu/linux during the next big refactor
   need_lib_prefix=no
   need_version=no
   dynamic_linker="$host_os runtime_loader"
@@ -16871,7 +17504,7 @@ hpux9* | hpux10* | hpux11*)
   ;;
 
 interix[3-9]*)
-  version_type=linux
+  version_type=linux # correct to gnu/linux during the next big refactor
   need_lib_prefix=no
   need_version=no
   library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}'
@@ -16887,7 +17520,7 @@ irix5* | irix6* | nonstopux*)
     nonstopux*) version_type=nonstopux ;;
     *)
 	if test "$lt_cv_prog_gnu_ld" = yes; then
-		version_type=linux
+		version_type=linux # correct to gnu/linux during the next big refactor
 	else
 		version_type=irix
 	fi ;;
@@ -16924,9 +17557,9 @@ linux*oldld* | linux*aout* | linux*coff*)
   dynamic_linker=no
   ;;
 
-# This must be Linux ELF.
+# This must be glibc/ELF.
 linux* | k*bsd*-gnu | kopensolaris*-gnu)
-  version_type=linux
+  version_type=linux # correct to gnu/linux during the next big refactor
   need_lib_prefix=no
   need_version=no
   library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
@@ -17008,7 +17641,7 @@ netbsd*)
   ;;
 
 newsos6)
-  version_type=linux
+  version_type=linux # correct to gnu/linux during the next big refactor
   library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
   shlibpath_var=LD_LIBRARY_PATH
   shlibpath_overrides_runpath=yes
@@ -17077,7 +17710,7 @@ rdos*)
   ;;
 
 solaris*)
-  version_type=linux
+  version_type=linux # correct to gnu/linux during the next big refactor
   need_lib_prefix=no
   need_version=no
   library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
@@ -17102,7 +17735,7 @@ sunos4*)
   ;;
 
 sysv4 | sysv4.3*)
-  version_type=linux
+  version_type=linux # correct to gnu/linux during the next big refactor
   library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
   soname_spec='${libname}${release}${shared_ext}$major'
   shlibpath_var=LD_LIBRARY_PATH
@@ -17126,7 +17759,7 @@ sysv4 | sysv4.3*)
 
 sysv4*MP*)
   if test -d /usr/nec ;then
-    version_type=linux
+    version_type=linux # correct to gnu/linux during the next big refactor
     library_names_spec='$libname${shared_ext}.$versuffix $libname${shared_ext}.$major $libname${shared_ext}'
     soname_spec='$libname${shared_ext}.$major'
     shlibpath_var=LD_LIBRARY_PATH
@@ -17157,7 +17790,7 @@ sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*)
 
 tpf*)
   # TPF is a cross-target only.  Preferred cross-host = GNU/Linux.
-  version_type=linux
+  version_type=linux # correct to gnu/linux during the next big refactor
   need_lib_prefix=no
   need_version=no
   library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
@@ -17167,7 +17800,7 @@ tpf*)
   ;;
 
 uts4*)
-  version_type=linux
+  version_type=linux # correct to gnu/linux during the next big refactor
   library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
   soname_spec='${libname}${release}${shared_ext}$major'
   shlibpath_var=LD_LIBRARY_PATH
@@ -17313,7 +17946,6 @@ export_dynamic_flag_spec_F77=
 hardcode_direct_F77=no
 hardcode_direct_absolute_F77=no
 hardcode_libdir_flag_spec_F77=
-hardcode_libdir_flag_spec_ld_F77=
 hardcode_libdir_separator_F77=
 hardcode_minus_L_F77=no
 hardcode_automatic_F77=no
@@ -17549,7 +18181,9 @@ lt_prog_compiler_static_F77=
     case $cc_basename in
     nvcc*) # Cuda Compiler Driver 2.2
       lt_prog_compiler_wl_F77='-Xlinker '
-      lt_prog_compiler_pic_F77='-Xcompiler -fPIC'
+      if test -n "$lt_prog_compiler_pic_F77"; then
+        lt_prog_compiler_pic_F77="-Xcompiler $lt_prog_compiler_pic_F77"
+      fi
       ;;
     esac
   else
@@ -17640,18 +18274,33 @@ lt_prog_compiler_static_F77=
 	;;
       *)
 	case `$CC -V 2>&1 | sed 5q` in
-	*Sun\ F* | *Sun*Fortran*)
+	*Sun\ Ceres\ Fortran* | *Sun*Fortran*\ [1-7].* | *Sun*Fortran*\ 8.[0-3]*)
 	  # Sun Fortran 8.3 passes all unrecognized flags to the linker
 	  lt_prog_compiler_pic_F77='-KPIC'
 	  lt_prog_compiler_static_F77='-Bstatic'
 	  lt_prog_compiler_wl_F77=''
 	  ;;
+	*Sun\ F* | *Sun*Fortran*)
+	  lt_prog_compiler_pic_F77='-KPIC'
+	  lt_prog_compiler_static_F77='-Bstatic'
+	  lt_prog_compiler_wl_F77='-Qoption ld '
+	  ;;
 	*Sun\ C*)
 	  # Sun C 5.9
 	  lt_prog_compiler_pic_F77='-KPIC'
 	  lt_prog_compiler_static_F77='-Bstatic'
 	  lt_prog_compiler_wl_F77='-Wl,'
 	  ;;
+        *Intel*\ [CF]*Compiler*)
+	  lt_prog_compiler_wl_F77='-Wl,'
+	  lt_prog_compiler_pic_F77='-fPIC'
+	  lt_prog_compiler_static_F77='-static'
+	  ;;
+	*Portland\ Group*)
+	  lt_prog_compiler_wl_F77='-Wl,'
+	  lt_prog_compiler_pic_F77='-fpic'
+	  lt_prog_compiler_static_F77='-Bstatic'
+	  ;;
 	esac
 	;;
       esac
@@ -17998,7 +18647,6 @@ $as_echo_n "checking whether the $compiler linker ($LD) supports shared librarie
   hardcode_direct_F77=no
   hardcode_direct_absolute_F77=no
   hardcode_libdir_flag_spec_F77=
-  hardcode_libdir_flag_spec_ld_F77=
   hardcode_libdir_separator_F77=
   hardcode_minus_L_F77=no
   hardcode_shlibpath_var_F77=unsupported
@@ -18248,8 +18896,7 @@ _LT_EOF
 	xlf* | bgf* | bgxlf* | mpixlf*)
 	  # IBM XL Fortran 10.1 on PPC cannot create shared libs itself
 	  whole_archive_flag_spec_F77='--whole-archive$convenience --no-whole-archive'
-	  hardcode_libdir_flag_spec_F77=
-	  hardcode_libdir_flag_spec_ld_F77='-rpath $libdir'
+	  hardcode_libdir_flag_spec_F77='${wl}-rpath ${wl}$libdir'
 	  archive_cmds_F77='$LD -shared $libobjs $deplibs $linker_flags -soname $soname -o $lib'
 	  if test "x$supports_anon_versioning" = xyes; then
 	    archive_expsym_cmds_F77='echo "{ global:" > $output_objdir/$libname.ver~
@@ -18616,6 +19263,7 @@ fi
 	# The linker will not automatically build a static lib if we build a DLL.
 	# _LT_TAGVAR(old_archive_from_new_cmds, F77)='true'
 	enable_shared_with_static_runtimes_F77=yes
+	exclude_expsyms_F77='_NULL_IMPORT_DESCRIPTOR|_IMPORT_DESCRIPTOR_.*'
 	export_symbols_cmds_F77='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS][ ]/s/.*[ ]\([^ ]*\)/\1,DATA/'\'' | $SED -e '\''/^[AITW][ ]/s/.*[ ]//'\'' | sort | uniq > $export_symbols'
 	# Don't use ranlib
 	old_postinstall_cmds_F77='chmod 644 $oldlib'
@@ -18661,6 +19309,7 @@ fi
   hardcode_shlibpath_var_F77=unsupported
   if test "$lt_cv_ld_force_load" = "yes"; then
     whole_archive_flag_spec_F77='`for conv in $convenience\"\"; do test  -n \"$conv\" && new_convenience=\"$new_convenience ${wl}-force_load,$conv\"; done; func_echo_all \"$new_convenience\"`'
+    compiler_needs_object_F77=yes
   else
     whole_archive_flag_spec_F77=''
   fi
@@ -18689,10 +19338,6 @@ fi
       hardcode_shlibpath_var_F77=no
       ;;
 
-    freebsd1*)
-      ld_shlibs_F77=no
-      ;;
-
     # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor
     # support.  Future versions do this automatically, but an explicit c++rt0.o
     # does not break anything, and helps significantly (at the cost of a little
@@ -18705,7 +19350,7 @@ fi
       ;;
 
     # Unfortunately, older versions of FreeBSD 2 do not have this feature.
-    freebsd2*)
+    freebsd2.*)
       archive_cmds_F77='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'
       hardcode_direct_F77=yes
       hardcode_minus_L_F77=yes
@@ -18744,7 +19389,6 @@ fi
       fi
       if test "$with_gnu_ld" = no; then
 	hardcode_libdir_flag_spec_F77='${wl}+b ${wl}$libdir'
-	hardcode_libdir_flag_spec_ld_F77='+b $libdir'
 	hardcode_libdir_separator_F77=:
 	hardcode_direct_F77=yes
 	hardcode_direct_absolute_F77=yes
@@ -19231,8 +19875,6 @@ esac
 
 
 
-
-
     { $as_echo "$as_me:${as_lineno-$LINENO}: checking dynamic linker characteristics" >&5
 $as_echo_n "checking dynamic linker characteristics... " >&6; }
 
@@ -19258,7 +19900,7 @@ need_version=unknown
 
 case $host_os in
 aix3*)
-  version_type=linux
+  version_type=linux # correct to gnu/linux during the next big refactor
   library_names_spec='${libname}${release}${shared_ext}$versuffix $libname.a'
   shlibpath_var=LIBPATH
 
@@ -19267,7 +19909,7 @@ aix3*)
   ;;
 
 aix[4-9]*)
-  version_type=linux
+  version_type=linux # correct to gnu/linux during the next big refactor
   need_lib_prefix=no
   need_version=no
   hardcode_into_libs=yes
@@ -19332,7 +19974,7 @@ beos*)
   ;;
 
 bsdi[45]*)
-  version_type=linux
+  version_type=linux # correct to gnu/linux during the next big refactor
   need_version=no
   library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
   soname_spec='${libname}${release}${shared_ext}$major'
@@ -19469,7 +20111,7 @@ darwin* | rhapsody*)
   ;;
 
 dgux*)
-  version_type=linux
+  version_type=linux # correct to gnu/linux during the next big refactor
   need_lib_prefix=no
   need_version=no
   library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname$shared_ext'
@@ -19477,10 +20119,6 @@ dgux*)
   shlibpath_var=LD_LIBRARY_PATH
   ;;
 
-freebsd1*)
-  dynamic_linker=no
-  ;;
-
 freebsd* | dragonfly*)
   # DragonFly does not have aout.  When/if they implement a new
   # versioning mechanism, adjust this.
@@ -19488,7 +20126,7 @@ freebsd* | dragonfly*)
     objformat=`/usr/bin/objformat`
   else
     case $host_os in
-    freebsd[123]*) objformat=aout ;;
+    freebsd[23].*) objformat=aout ;;
     *) objformat=elf ;;
     esac
   fi
@@ -19506,7 +20144,7 @@ freebsd* | dragonfly*)
   esac
   shlibpath_var=LD_LIBRARY_PATH
   case $host_os in
-  freebsd2*)
+  freebsd2.*)
     shlibpath_overrides_runpath=yes
     ;;
   freebsd3.[01]* | freebsdelf3.[01]*)
@@ -19526,17 +20164,18 @@ freebsd* | dragonfly*)
   ;;
 
 gnu*)
-  version_type=linux
+  version_type=linux # correct to gnu/linux during the next big refactor
   need_lib_prefix=no
   need_version=no
   library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}'
   soname_spec='${libname}${release}${shared_ext}$major'
   shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=no
   hardcode_into_libs=yes
   ;;
 
 haiku*)
-  version_type=linux
+  version_type=linux # correct to gnu/linux during the next big refactor
   need_lib_prefix=no
   need_version=no
   dynamic_linker="$host_os runtime_loader"
@@ -19597,7 +20236,7 @@ hpux9* | hpux10* | hpux11*)
   ;;
 
 interix[3-9]*)
-  version_type=linux
+  version_type=linux # correct to gnu/linux during the next big refactor
   need_lib_prefix=no
   need_version=no
   library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}'
@@ -19613,7 +20252,7 @@ irix5* | irix6* | nonstopux*)
     nonstopux*) version_type=nonstopux ;;
     *)
 	if test "$lt_cv_prog_gnu_ld" = yes; then
-		version_type=linux
+		version_type=linux # correct to gnu/linux during the next big refactor
 	else
 		version_type=irix
 	fi ;;
@@ -19650,9 +20289,9 @@ linux*oldld* | linux*aout* | linux*coff*)
   dynamic_linker=no
   ;;
 
-# This must be Linux ELF.
+# This must be glibc/ELF.
 linux* | k*bsd*-gnu | kopensolaris*-gnu)
-  version_type=linux
+  version_type=linux # correct to gnu/linux during the next big refactor
   need_lib_prefix=no
   need_version=no
   library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
@@ -19728,7 +20367,7 @@ netbsd*)
   ;;
 
 newsos6)
-  version_type=linux
+  version_type=linux # correct to gnu/linux during the next big refactor
   library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
   shlibpath_var=LD_LIBRARY_PATH
   shlibpath_overrides_runpath=yes
@@ -19797,7 +20436,7 @@ rdos*)
   ;;
 
 solaris*)
-  version_type=linux
+  version_type=linux # correct to gnu/linux during the next big refactor
   need_lib_prefix=no
   need_version=no
   library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
@@ -19822,7 +20461,7 @@ sunos4*)
   ;;
 
 sysv4 | sysv4.3*)
-  version_type=linux
+  version_type=linux # correct to gnu/linux during the next big refactor
   library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
   soname_spec='${libname}${release}${shared_ext}$major'
   shlibpath_var=LD_LIBRARY_PATH
@@ -19846,7 +20485,7 @@ sysv4 | sysv4.3*)
 
 sysv4*MP*)
   if test -d /usr/nec ;then
-    version_type=linux
+    version_type=linux # correct to gnu/linux during the next big refactor
     library_names_spec='$libname${shared_ext}.$versuffix $libname${shared_ext}.$major $libname${shared_ext}'
     soname_spec='$libname${shared_ext}.$major'
     shlibpath_var=LD_LIBRARY_PATH
@@ -19877,7 +20516,7 @@ sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*)
 
 tpf*)
   # TPF is a cross-target only.  Preferred cross-host = GNU/Linux.
-  version_type=linux
+  version_type=linux # correct to gnu/linux during the next big refactor
   need_lib_prefix=no
   need_version=no
   library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
@@ -19887,7 +20526,7 @@ tpf*)
   ;;
 
 uts4*)
-  version_type=linux
+  version_type=linux # correct to gnu/linux during the next big refactor
   library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
   soname_spec='${libname}${release}${shared_ext}$major'
   shlibpath_var=LD_LIBRARY_PATH
@@ -20027,7 +20666,6 @@ export_dynamic_flag_spec_FC=
 hardcode_direct_FC=no
 hardcode_direct_absolute_FC=no
 hardcode_libdir_flag_spec_FC=
-hardcode_libdir_flag_spec_ld_FC=
 hardcode_libdir_separator_FC=
 hardcode_minus_L_FC=no
 hardcode_automatic_FC=no
@@ -20183,6 +20821,7 @@ _lt_libdeps_save_CFLAGS=$CFLAGS
 case "$CC $CFLAGS " in #(
 *\ -flto*\ *) CFLAGS="$CFLAGS -fno-lto" ;;
 *\ -fwhopr*\ *) CFLAGS="$CFLAGS -fno-whopr" ;;
+*\ -fuse-linker-plugin*\ *) CFLAGS="$CFLAGS -fno-use-linker-plugin" ;;
 esac
 
 if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5
@@ -20409,7 +21048,9 @@ lt_prog_compiler_static_FC=
     case $cc_basename in
     nvcc*) # Cuda Compiler Driver 2.2
       lt_prog_compiler_wl_FC='-Xlinker '
-      lt_prog_compiler_pic_FC='-Xcompiler -fPIC'
+      if test -n "$lt_prog_compiler_pic_FC"; then
+        lt_prog_compiler_pic_FC="-Xcompiler $lt_prog_compiler_pic_FC"
+      fi
       ;;
     esac
   else
@@ -20500,18 +21141,33 @@ lt_prog_compiler_static_FC=
 	;;
       *)
 	case `$CC -V 2>&1 | sed 5q` in
-	*Sun\ F* | *Sun*Fortran*)
+	*Sun\ Ceres\ Fortran* | *Sun*Fortran*\ [1-7].* | *Sun*Fortran*\ 8.[0-3]*)
 	  # Sun Fortran 8.3 passes all unrecognized flags to the linker
 	  lt_prog_compiler_pic_FC='-KPIC'
 	  lt_prog_compiler_static_FC='-Bstatic'
 	  lt_prog_compiler_wl_FC=''
 	  ;;
+	*Sun\ F* | *Sun*Fortran*)
+	  lt_prog_compiler_pic_FC='-KPIC'
+	  lt_prog_compiler_static_FC='-Bstatic'
+	  lt_prog_compiler_wl_FC='-Qoption ld '
+	  ;;
 	*Sun\ C*)
 	  # Sun C 5.9
 	  lt_prog_compiler_pic_FC='-KPIC'
 	  lt_prog_compiler_static_FC='-Bstatic'
 	  lt_prog_compiler_wl_FC='-Wl,'
 	  ;;
+        *Intel*\ [CF]*Compiler*)
+	  lt_prog_compiler_wl_FC='-Wl,'
+	  lt_prog_compiler_pic_FC='-fPIC'
+	  lt_prog_compiler_static_FC='-static'
+	  ;;
+	*Portland\ Group*)
+	  lt_prog_compiler_wl_FC='-Wl,'
+	  lt_prog_compiler_pic_FC='-fpic'
+	  lt_prog_compiler_static_FC='-Bstatic'
+	  ;;
 	esac
 	;;
       esac
@@ -20858,7 +21514,6 @@ $as_echo_n "checking whether the $compiler linker ($LD) supports shared librarie
   hardcode_direct_FC=no
   hardcode_direct_absolute_FC=no
   hardcode_libdir_flag_spec_FC=
-  hardcode_libdir_flag_spec_ld_FC=
   hardcode_libdir_separator_FC=
   hardcode_minus_L_FC=no
   hardcode_shlibpath_var_FC=unsupported
@@ -21108,8 +21763,7 @@ _LT_EOF
 	xlf* | bgf* | bgxlf* | mpixlf*)
 	  # IBM XL Fortran 10.1 on PPC cannot create shared libs itself
 	  whole_archive_flag_spec_FC='--whole-archive$convenience --no-whole-archive'
-	  hardcode_libdir_flag_spec_FC=
-	  hardcode_libdir_flag_spec_ld_FC='-rpath $libdir'
+	  hardcode_libdir_flag_spec_FC='${wl}-rpath ${wl}$libdir'
 	  archive_cmds_FC='$LD -shared $libobjs $deplibs $linker_flags -soname $soname -o $lib'
 	  if test "x$supports_anon_versioning" = xyes; then
 	    archive_expsym_cmds_FC='echo "{ global:" > $output_objdir/$libname.ver~
@@ -21476,6 +22130,7 @@ fi
 	# The linker will not automatically build a static lib if we build a DLL.
 	# _LT_TAGVAR(old_archive_from_new_cmds, FC)='true'
 	enable_shared_with_static_runtimes_FC=yes
+	exclude_expsyms_FC='_NULL_IMPORT_DESCRIPTOR|_IMPORT_DESCRIPTOR_.*'
 	export_symbols_cmds_FC='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS][ ]/s/.*[ ]\([^ ]*\)/\1,DATA/'\'' | $SED -e '\''/^[AITW][ ]/s/.*[ ]//'\'' | sort | uniq > $export_symbols'
 	# Don't use ranlib
 	old_postinstall_cmds_FC='chmod 644 $oldlib'
@@ -21521,6 +22176,7 @@ fi
   hardcode_shlibpath_var_FC=unsupported
   if test "$lt_cv_ld_force_load" = "yes"; then
     whole_archive_flag_spec_FC='`for conv in $convenience\"\"; do test  -n \"$conv\" && new_convenience=\"$new_convenience ${wl}-force_load,$conv\"; done; func_echo_all \"$new_convenience\"`'
+    compiler_needs_object_FC=yes
   else
     whole_archive_flag_spec_FC=''
   fi
@@ -21549,10 +22205,6 @@ fi
       hardcode_shlibpath_var_FC=no
       ;;
 
-    freebsd1*)
-      ld_shlibs_FC=no
-      ;;
-
     # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor
     # support.  Future versions do this automatically, but an explicit c++rt0.o
     # does not break anything, and helps significantly (at the cost of a little
@@ -21565,7 +22217,7 @@ fi
       ;;
 
     # Unfortunately, older versions of FreeBSD 2 do not have this feature.
-    freebsd2*)
+    freebsd2.*)
       archive_cmds_FC='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'
       hardcode_direct_FC=yes
       hardcode_minus_L_FC=yes
@@ -21604,7 +22256,6 @@ fi
       fi
       if test "$with_gnu_ld" = no; then
 	hardcode_libdir_flag_spec_FC='${wl}+b ${wl}$libdir'
-	hardcode_libdir_flag_spec_ld_FC='+b $libdir'
 	hardcode_libdir_separator_FC=:
 	hardcode_direct_FC=yes
 	hardcode_direct_absolute_FC=yes
@@ -22091,8 +22742,6 @@ esac
 
 
 
-
-
     { $as_echo "$as_me:${as_lineno-$LINENO}: checking dynamic linker characteristics" >&5
 $as_echo_n "checking dynamic linker characteristics... " >&6; }
 
@@ -22118,7 +22767,7 @@ need_version=unknown
 
 case $host_os in
 aix3*)
-  version_type=linux
+  version_type=linux # correct to gnu/linux during the next big refactor
   library_names_spec='${libname}${release}${shared_ext}$versuffix $libname.a'
   shlibpath_var=LIBPATH
 
@@ -22127,7 +22776,7 @@ aix3*)
   ;;
 
 aix[4-9]*)
-  version_type=linux
+  version_type=linux # correct to gnu/linux during the next big refactor
   need_lib_prefix=no
   need_version=no
   hardcode_into_libs=yes
@@ -22192,7 +22841,7 @@ beos*)
   ;;
 
 bsdi[45]*)
-  version_type=linux
+  version_type=linux # correct to gnu/linux during the next big refactor
   need_version=no
   library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
   soname_spec='${libname}${release}${shared_ext}$major'
@@ -22329,7 +22978,7 @@ darwin* | rhapsody*)
   ;;
 
 dgux*)
-  version_type=linux
+  version_type=linux # correct to gnu/linux during the next big refactor
   need_lib_prefix=no
   need_version=no
   library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname$shared_ext'
@@ -22337,10 +22986,6 @@ dgux*)
   shlibpath_var=LD_LIBRARY_PATH
   ;;
 
-freebsd1*)
-  dynamic_linker=no
-  ;;
-
 freebsd* | dragonfly*)
   # DragonFly does not have aout.  When/if they implement a new
   # versioning mechanism, adjust this.
@@ -22348,7 +22993,7 @@ freebsd* | dragonfly*)
     objformat=`/usr/bin/objformat`
   else
     case $host_os in
-    freebsd[123]*) objformat=aout ;;
+    freebsd[23].*) objformat=aout ;;
     *) objformat=elf ;;
     esac
   fi
@@ -22366,7 +23011,7 @@ freebsd* | dragonfly*)
   esac
   shlibpath_var=LD_LIBRARY_PATH
   case $host_os in
-  freebsd2*)
+  freebsd2.*)
     shlibpath_overrides_runpath=yes
     ;;
   freebsd3.[01]* | freebsdelf3.[01]*)
@@ -22386,17 +23031,18 @@ freebsd* | dragonfly*)
   ;;
 
 gnu*)
-  version_type=linux
+  version_type=linux # correct to gnu/linux during the next big refactor
   need_lib_prefix=no
   need_version=no
   library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}'
   soname_spec='${libname}${release}${shared_ext}$major'
   shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=no
   hardcode_into_libs=yes
   ;;
 
 haiku*)
-  version_type=linux
+  version_type=linux # correct to gnu/linux during the next big refactor
   need_lib_prefix=no
   need_version=no
   dynamic_linker="$host_os runtime_loader"
@@ -22457,7 +23103,7 @@ hpux9* | hpux10* | hpux11*)
   ;;
 
 interix[3-9]*)
-  version_type=linux
+  version_type=linux # correct to gnu/linux during the next big refactor
   need_lib_prefix=no
   need_version=no
   library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}'
@@ -22473,7 +23119,7 @@ irix5* | irix6* | nonstopux*)
     nonstopux*) version_type=nonstopux ;;
     *)
 	if test "$lt_cv_prog_gnu_ld" = yes; then
-		version_type=linux
+		version_type=linux # correct to gnu/linux during the next big refactor
 	else
 		version_type=irix
 	fi ;;
@@ -22510,9 +23156,9 @@ linux*oldld* | linux*aout* | linux*coff*)
   dynamic_linker=no
   ;;
 
-# This must be Linux ELF.
+# This must be glibc/ELF.
 linux* | k*bsd*-gnu | kopensolaris*-gnu)
-  version_type=linux
+  version_type=linux # correct to gnu/linux during the next big refactor
   need_lib_prefix=no
   need_version=no
   library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
@@ -22588,7 +23234,7 @@ netbsd*)
   ;;
 
 newsos6)
-  version_type=linux
+  version_type=linux # correct to gnu/linux during the next big refactor
   library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
   shlibpath_var=LD_LIBRARY_PATH
   shlibpath_overrides_runpath=yes
@@ -22657,7 +23303,7 @@ rdos*)
   ;;
 
 solaris*)
-  version_type=linux
+  version_type=linux # correct to gnu/linux during the next big refactor
   need_lib_prefix=no
   need_version=no
   library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
@@ -22682,7 +23328,7 @@ sunos4*)
   ;;
 
 sysv4 | sysv4.3*)
-  version_type=linux
+  version_type=linux # correct to gnu/linux during the next big refactor
   library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
   soname_spec='${libname}${release}${shared_ext}$major'
   shlibpath_var=LD_LIBRARY_PATH
@@ -22706,7 +23352,7 @@ sysv4 | sysv4.3*)
 
 sysv4*MP*)
   if test -d /usr/nec ;then
-    version_type=linux
+    version_type=linux # correct to gnu/linux during the next big refactor
     library_names_spec='$libname${shared_ext}.$versuffix $libname${shared_ext}.$major $libname${shared_ext}'
     soname_spec='$libname${shared_ext}.$major'
     shlibpath_var=LD_LIBRARY_PATH
@@ -22737,7 +23383,7 @@ sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*)
 
 tpf*)
   # TPF is a cross-target only.  Preferred cross-host = GNU/Linux.
-  version_type=linux
+  version_type=linux # correct to gnu/linux during the next big refactor
   need_lib_prefix=no
   need_version=no
   library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
@@ -22747,7 +23393,7 @@ tpf*)
   ;;
 
 uts4*)
-  version_type=linux
+  version_type=linux # correct to gnu/linux during the next big refactor
   library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
   soname_spec='${libname}${release}${shared_ext}$major'
   shlibpath_var=LD_LIBRARY_PATH
@@ -22875,22 +23521,16 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu
 
 
 
-        ac_config_commands="$ac_config_commands libtool"
 
 
+        ac_config_commands="$ac_config_commands libtool"
 
 
-# Only expand once:
 
 
+# Only expand once:
 
 
-case "${host}" in
-  *-pc-mingw*|*-pc-cygwin*)
-  NO_UNDEFINED=" -no-undefined --enable-auto-import";
-  NO_DLOPEN_TESTS=1 ;;
-  *) NO_DLOPEN_TESTS=0 ;;
-esac
 
 : ${CONFIG_LT=./config.lt}
 { $as_echo "$as_me:${as_lineno-$LINENO}: creating $CONFIG_LT" >&5
@@ -23179,16 +23819,16 @@ if (echo >conf$$.file) 2>/dev/null; then
     # ... but there are two gotchas:
     # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail.
     # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable.
-    # In both cases, we have to default to `cp -p'.
+    # In both cases, we have to default to `cp -pR'.
     ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe ||
-      as_ln_s='cp -p'
+      as_ln_s='cp -pR'
   elif ln conf$$.file conf$$ 2>/dev/null; then
     as_ln_s=ln
   else
-    as_ln_s='cp -p'
+    as_ln_s='cp -pR'
   fi
 else
-  as_ln_s='cp -p'
+  as_ln_s='cp -pR'
 fi
 rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file
 rmdir conf$$.dir 2>/dev/null
@@ -23248,28 +23888,16 @@ else
   as_mkdir_p=false
 fi
 
-if test -x / >/dev/null 2>&1; then
-  as_test_x='test -x'
-else
-  if ls -dL / >/dev/null 2>&1; then
-    as_ls_L_option=L
-  else
-    as_ls_L_option=
-  fi
-  as_test_x='
-    eval sh -c '\''
-      if test -d "$1"; then
-	test -d "$1/.";
-      else
-	case $1 in #(
-	-*)set "./$1";;
-	esac;
-	case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in #((
-	???[sx]*):;;*)false;;esac;fi
-    '\'' sh
-  '
-fi
-as_executable_p=$as_test_x
+
+# as_fn_executable_p FILE
+# -----------------------
+# Test if FILE is an executable regular file.
+as_fn_executable_p ()
+{
+  test -f "$1" && test -x "$1"
+} # as_fn_executable_p
+as_test_x='test -x'
+as_executable_p=as_fn_executable_p
 
 # Sed expression to map a string onto a valid CPP name.
 as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'"
@@ -23310,10 +23938,10 @@ Usage: $0 [OPTIONS]
 Report bugs to <bug-libtool at gnu.org>."
 
 lt_cl_version="\
-GetData config.lt 0.7.3
-configured by $0, generated by GNU Autoconf 2.68.
+GetData config.lt 0.8.5
+configured by $0, generated by GNU Autoconf 2.69.
 
-Copyright (C) 2010 Free Software Foundation, Inc.
+Copyright (C) 2011 Free Software Foundation, Inc.
 This config.lt script is free software; the Free Software Foundation
 gives unlimited permision to copy, distribute and modify it."
 
@@ -23361,6 +23989,7 @@ pic_mode='`$ECHO "$pic_mode" | $SED "$delay_single_quote_subst"`'
 enable_fast_install='`$ECHO "$enable_fast_install" | $SED "$delay_single_quote_subst"`'
 SHELL='`$ECHO "$SHELL" | $SED "$delay_single_quote_subst"`'
 ECHO='`$ECHO "$ECHO" | $SED "$delay_single_quote_subst"`'
+PATH_SEPARATOR='`$ECHO "$PATH_SEPARATOR" | $SED "$delay_single_quote_subst"`'
 host_alias='`$ECHO "$host_alias" | $SED "$delay_single_quote_subst"`'
 host='`$ECHO "$host" | $SED "$delay_single_quote_subst"`'
 host_os='`$ECHO "$host_os" | $SED "$delay_single_quote_subst"`'
@@ -23443,7 +24072,6 @@ with_gnu_ld='`$ECHO "$with_gnu_ld" | $SED "$delay_single_quote_subst"`'
 allow_undefined_flag='`$ECHO "$allow_undefined_flag" | $SED "$delay_single_quote_subst"`'
 no_undefined_flag='`$ECHO "$no_undefined_flag" | $SED "$delay_single_quote_subst"`'
 hardcode_libdir_flag_spec='`$ECHO "$hardcode_libdir_flag_spec" | $SED "$delay_single_quote_subst"`'
-hardcode_libdir_flag_spec_ld='`$ECHO "$hardcode_libdir_flag_spec_ld" | $SED "$delay_single_quote_subst"`'
 hardcode_libdir_separator='`$ECHO "$hardcode_libdir_separator" | $SED "$delay_single_quote_subst"`'
 hardcode_direct='`$ECHO "$hardcode_direct" | $SED "$delay_single_quote_subst"`'
 hardcode_direct_absolute='`$ECHO "$hardcode_direct_absolute" | $SED "$delay_single_quote_subst"`'
@@ -23567,9 +24195,6 @@ no_undefined_flag_FC='`$ECHO "$no_undefined_flag_FC" | $SED "$delay_single_quote
 hardcode_libdir_flag_spec_CXX='`$ECHO "$hardcode_libdir_flag_spec_CXX" | $SED "$delay_single_quote_subst"`'
 hardcode_libdir_flag_spec_F77='`$ECHO "$hardcode_libdir_flag_spec_F77" | $SED "$delay_single_quote_subst"`'
 hardcode_libdir_flag_spec_FC='`$ECHO "$hardcode_libdir_flag_spec_FC" | $SED "$delay_single_quote_subst"`'
-hardcode_libdir_flag_spec_ld_CXX='`$ECHO "$hardcode_libdir_flag_spec_ld_CXX" | $SED "$delay_single_quote_subst"`'
-hardcode_libdir_flag_spec_ld_F77='`$ECHO "$hardcode_libdir_flag_spec_ld_F77" | $SED "$delay_single_quote_subst"`'
-hardcode_libdir_flag_spec_ld_FC='`$ECHO "$hardcode_libdir_flag_spec_ld_FC" | $SED "$delay_single_quote_subst"`'
 hardcode_libdir_separator_CXX='`$ECHO "$hardcode_libdir_separator_CXX" | $SED "$delay_single_quote_subst"`'
 hardcode_libdir_separator_F77='`$ECHO "$hardcode_libdir_separator_F77" | $SED "$delay_single_quote_subst"`'
 hardcode_libdir_separator_FC='`$ECHO "$hardcode_libdir_separator_FC" | $SED "$delay_single_quote_subst"`'
@@ -23652,6 +24277,7 @@ _LTECHO_EOF'
 # Quote evaled strings.
 for var in SHELL \
 ECHO \
+PATH_SEPARATOR \
 SED \
 GREP \
 EGREP \
@@ -23702,7 +24328,6 @@ with_gnu_ld \
 allow_undefined_flag \
 no_undefined_flag \
 hardcode_libdir_flag_spec \
-hardcode_libdir_flag_spec_ld \
 hardcode_libdir_separator \
 exclude_expsyms \
 include_expsyms \
@@ -23766,9 +24391,6 @@ no_undefined_flag_FC \
 hardcode_libdir_flag_spec_CXX \
 hardcode_libdir_flag_spec_F77 \
 hardcode_libdir_flag_spec_FC \
-hardcode_libdir_flag_spec_ld_CXX \
-hardcode_libdir_flag_spec_ld_F77 \
-hardcode_libdir_flag_spec_ld_FC \
 hardcode_libdir_separator_CXX \
 hardcode_libdir_separator_F77 \
 hardcode_libdir_separator_FC \
@@ -23923,8 +24545,8 @@ $as_echo "$as_me: creating $ofile" >&6;}
 # NOTE: Changes made to this file will be lost: look at ltmain.sh.
 #
 #   Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005,
-#                 2006, 2007, 2008, 2009, 2010 Free Software Foundation,
-#                 Inc.
+#                 2006, 2007, 2008, 2009, 2010, 2011 Free Software
+#                 Foundation, Inc.
 #   Written by Gordon Matzigkeit, 1996
 #
 #   This file is part of GNU Libtool.
@@ -23978,6 +24600,9 @@ SHELL=$lt_SHELL
 # An echo program that protects backslashes.
 ECHO=$lt_ECHO
 
+# The PATH separator for the build system.
+PATH_SEPARATOR=$lt_PATH_SEPARATOR
+
 # The host system.
 host_alias=$host_alias
 host=$host
@@ -24279,10 +24904,6 @@ no_undefined_flag=$lt_no_undefined_flag
 # This must work even if \$libdir does not exist
 hardcode_libdir_flag_spec=$lt_hardcode_libdir_flag_spec
 
-# If ld is used when linking, flag to hardcode \$libdir into a binary
-# during linking.  This must work even if \$libdir does not exist.
-hardcode_libdir_flag_spec_ld=$lt_hardcode_libdir_flag_spec_ld
-
 # Whether we need a single "-rpath" flag with a separated argument.
 hardcode_libdir_separator=$lt_hardcode_libdir_separator
 
@@ -24625,10 +25246,6 @@ no_undefined_flag=$lt_no_undefined_flag_CXX
 # This must work even if \$libdir does not exist
 hardcode_libdir_flag_spec=$lt_hardcode_libdir_flag_spec_CXX
 
-# If ld is used when linking, flag to hardcode \$libdir into a binary
-# during linking.  This must work even if \$libdir does not exist.
-hardcode_libdir_flag_spec_ld=$lt_hardcode_libdir_flag_spec_ld_CXX
-
 # Whether we need a single "-rpath" flag with a separated argument.
 hardcode_libdir_separator=$lt_hardcode_libdir_separator_CXX
 
@@ -24782,10 +25399,6 @@ no_undefined_flag=$lt_no_undefined_flag_F77
 # This must work even if \$libdir does not exist
 hardcode_libdir_flag_spec=$lt_hardcode_libdir_flag_spec_F77
 
-# If ld is used when linking, flag to hardcode \$libdir into a binary
-# during linking.  This must work even if \$libdir does not exist.
-hardcode_libdir_flag_spec_ld=$lt_hardcode_libdir_flag_spec_ld_F77
-
 # Whether we need a single "-rpath" flag with a separated argument.
 hardcode_libdir_separator=$lt_hardcode_libdir_separator_F77
 
@@ -24939,10 +25552,6 @@ no_undefined_flag=$lt_no_undefined_flag_FC
 # This must work even if \$libdir does not exist
 hardcode_libdir_flag_spec=$lt_hardcode_libdir_flag_spec_FC
 
-# If ld is used when linking, flag to hardcode \$libdir into a binary
-# during linking.  This must work even if \$libdir does not exist.
-hardcode_libdir_flag_spec_ld=$lt_hardcode_libdir_flag_spec_ld_FC
-
 # Whether we need a single "-rpath" flag with a separated argument.
 hardcode_libdir_separator=$lt_hardcode_libdir_separator_FC
 
@@ -25091,7 +25700,7 @@ fi
   LIBS=$saved_libs
 
   if test "x$have_ltdl" == "xno"; then
-    as_fn_error $? "libltdl is required to build modules.  Please either specify the location of the libltdl library using --with-ldtl-prefix=PREFIX or else disable the building of modules by using --disable-modules." "$LINENO" 5
+    as_fn_error $? "libltdl is required to build modules.  Please either specify the location of the libltdl library using --with-ldtl=PREFIX or else disable the building of modules by using --disable-modules." "$LINENO" 5
   fi
 
   if test "x$ltdl_prefix" != "x"; then
@@ -25124,6 +25733,81 @@ done
 
     LIBLTDL="-lltdl"
   fi
+
+    { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing pthread_mutex_lock" >&5
+$as_echo_n "checking for library containing pthread_mutex_lock... " >&6; }
+if ${ac_cv_search_pthread_mutex_lock+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  ac_func_search_save_LIBS=$LIBS
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+/* Override any GCC internal prototype to avoid an error.
+   Use char because int might match the return type of a GCC
+   builtin and then its argument prototype would still apply.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+char pthread_mutex_lock ();
+int
+main ()
+{
+return pthread_mutex_lock ();
+  ;
+  return 0;
+}
+_ACEOF
+for ac_lib in '' pthread; do
+  if test -z "$ac_lib"; then
+    ac_res="none required"
+  else
+    ac_res=-l$ac_lib
+    LIBS="-l$ac_lib  $ac_func_search_save_LIBS"
+  fi
+  if ac_fn_c_try_link "$LINENO"; then :
+  ac_cv_search_pthread_mutex_lock=$ac_res
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext
+  if ${ac_cv_search_pthread_mutex_lock+:} false; then :
+  break
+fi
+done
+if ${ac_cv_search_pthread_mutex_lock+:} false; then :
+
+else
+  ac_cv_search_pthread_mutex_lock=no
+fi
+rm conftest.$ac_ext
+LIBS=$ac_func_search_save_LIBS
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_pthread_mutex_lock" >&5
+$as_echo "$ac_cv_search_pthread_mutex_lock" >&6; }
+ac_res=$ac_cv_search_pthread_mutex_lock
+if test "$ac_res" != no; then :
+  test "$ac_res" = "none required" || LIBS="$ac_res $LIBS"
+  use_pthread=yes
+
+$as_echo "#define USE_PTHREAD /**/" >>confdefs.h
+
+
+else
+  use_pthread=no
+fi
+
+  for ac_header in pthread.h
+do :
+  ac_fn_c_check_header_mongrel "$LINENO" "pthread.h" "ac_cv_header_pthread_h" "$ac_includes_default"
+if test "x$ac_cv_header_pthread_h" = xyes; then :
+  cat >>confdefs.h <<_ACEOF
+#define HAVE_PTHREAD_H 1
+_ACEOF
+
+fi
+
+done
+
 fi
 
 
@@ -25186,6 +25870,91 @@ _ACEOF
     ;;
 esac
 
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for C/C++ restrict keyword" >&5
+$as_echo_n "checking for C/C++ restrict keyword... " >&6; }
+if ${ac_cv_c_restrict+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  ac_cv_c_restrict=no
+   # The order here caters to the fact that C++ does not require restrict.
+   for ac_kw in __restrict __restrict__ _Restrict restrict; do
+     cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+typedef int * int_ptr;
+	int foo (int_ptr $ac_kw ip) {
+	return ip[0];
+       }
+int
+main ()
+{
+int s[1];
+	int * $ac_kw t = s;
+	t[0] = 0;
+	return foo(t)
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  ac_cv_c_restrict=$ac_kw
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+     test "$ac_cv_c_restrict" != no && break
+   done
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_restrict" >&5
+$as_echo "$ac_cv_c_restrict" >&6; }
+
+ case $ac_cv_c_restrict in
+   restrict) ;;
+   no) $as_echo "#define restrict /**/" >>confdefs.h
+ ;;
+   *)  cat >>confdefs.h <<_ACEOF
+#define restrict $ac_cv_c_restrict
+_ACEOF
+ ;;
+ esac
+
+
+if ! test "x$ac_cv_c_restrict" = "xno"; then
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether restrict can be applied to pointer array arguments" >&5
+$as_echo_n "checking whether restrict can be applied to pointer array arguments... " >&6; }
+if ${gd_cv_c_restrict_array+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+    int *foo (int *restrict bar[3]) { return bar[2]; }
+
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  gd_cv_c_restrict_array="yes"
+else
+  gd_cv_c_restrict_array="no"
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gd_cv_c_restrict_array" >&5
+$as_echo "$gd_cv_c_restrict_array" >&6; }
+fi
+
+if test "x$gd_cv_c_restrict_array" = "xyes"; then
+
+$as_echo "#define GD_RESTRICT_ARRAY_OK 1" >>confdefs.h
+
+fi
+
 gd_saved_CFLAGS=$CFLAGS
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -Wall" >&5
 $as_echo_n "checking whether $CC accepts -Wall... " >&6; }
@@ -25243,7 +26012,7 @@ fi
 $as_echo "$gd_cv_prog_cc_wextra" >&6; }
 CFLAGS=$gd_saved_CFLAGS
 
-if test "x$make_c++bindings" != "xno"; then
+if test "x$make_cxxbindings" != "xno"; then
   gd_saved_CXXFLAGS=$CXXFLAGS
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CXX accepts -Wall" >&5
 $as_echo_n "checking whether $CXX accepts -Wall... " >&6; }
@@ -25393,63 +26162,13 @@ fi
 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $gd_cv_prog_f77_wextra" >&5
 $as_echo "$gd_cv_prog_f77_wextra" >&6; }
 FFLAGS=$gd_saved_FFLAGS
-  { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the Intel Fortran-77 compiler" >&5
-$as_echo_n "checking whether we are using the Intel Fortran-77 compiler... " >&6; }
-if ${gd_cv_f77_compiler_intel+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  if $F77 -help 2>/dev/null | grep -q 'Intel.R. Fortran Compiler'; then
-gd_cv_f77_compiler_intel=yes
-else
-gd_cv_f77_compiler_intel=no
-fi
-
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gd_cv_f77_compiler_intel" >&5
-$as_echo "$gd_cv_f77_compiler_intel" >&6; }
-fi
-
-if test "x$make_f95bindings" != "xno"; then
-  gd_saved_FCFLAGS=$FCFLAGS
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $FC accepts -Wall" >&5
-$as_echo_n "checking whether $FC accepts -Wall... " >&6; }
-if ${gd_cv_prog_fc_wall+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  FCFLAGS="-Wall"
-ac_ext=f
-ac_compile='$F77 -c $FFLAGS conftest.$ac_ext >&5'
-ac_link='$F77 -o conftest$ac_exeext $FFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
-ac_compiler_gnu=$ac_cv_f77_compiler_gnu
-
-cat > conftest.$ac_ext <<_ACEOF
-      program main
-
-      end
-_ACEOF
-if ac_fn_f77_try_compile "$LINENO"; then :
-  gd_cv_prog_fc_wall=yes
-else
-  gd_cv_prog_fc_wall=no
-fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-ac_ext=c
-ac_cpp='$CPP $CPPFLAGS'
-ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
-ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
-ac_compiler_gnu=$ac_cv_c_compiler_gnu
-
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gd_cv_prog_fc_wall" >&5
-$as_echo "$gd_cv_prog_fc_wall" >&6; }
-FCFLAGS=$gd_saved_FCFLAGS
-  gd_saved_FCFLAGS=$FCFLAGS
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $FC accepts -Wextra" >&5
-$as_echo_n "checking whether $FC accepts -Wextra... " >&6; }
-if ${gd_cv_prog_fc_wextra+:} false; then :
+  gd_saved_FFLAGS=$FFLAGS
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $F77 accepts -fno-backslash" >&5
+$as_echo_n "checking whether $F77 accepts -fno-backslash... " >&6; }
+if ${gd_cv_prog_f77_fno_backslash+:} false; then :
   $as_echo_n "(cached) " >&6
 else
-  FCFLAGS="-Wextra"
+  FFLAGS="-fno-backslash"
 ac_ext=f
 ac_compile='$F77 -c $FFLAGS conftest.$ac_ext >&5'
 ac_link='$F77 -o conftest$ac_exeext $FFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
@@ -25461,9 +26180,9 @@ cat > conftest.$ac_ext <<_ACEOF
       end
 _ACEOF
 if ac_fn_f77_try_compile "$LINENO"; then :
-  gd_cv_prog_fc_wextra=yes
+  gd_cv_prog_f77_fno_backslash=yes
 else
-  gd_cv_prog_fc_wextra=no
+  gd_cv_prog_f77_fno_backslash=no
 fi
 rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
 ac_ext=c
@@ -25473,23 +26192,23 @@ ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $
 ac_compiler_gnu=$ac_cv_c_compiler_gnu
 
 fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gd_cv_prog_fc_wextra" >&5
-$as_echo "$gd_cv_prog_fc_wextra" >&6; }
-FCFLAGS=$gd_saved_FCFLAGS
-  { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the Intel Fortran compiler" >&5
-$as_echo_n "checking whether we are using the Intel Fortran compiler... " >&6; }
-if ${gd_cv_fc_compiler_intel+:} false; then :
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gd_cv_prog_f77_fno_backslash" >&5
+$as_echo "$gd_cv_prog_f77_fno_backslash" >&6; }
+FFLAGS=$gd_saved_FFLAGS
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the Intel Fortran-77 compiler" >&5
+$as_echo_n "checking whether we are using the Intel Fortran-77 compiler... " >&6; }
+if ${gd_cv_f77_compiler_intel+:} false; then :
   $as_echo_n "(cached) " >&6
 else
-  if $FC -help 2>/dev/null | grep -q 'Intel.R. Fortran Compiler'; then
-gd_cv_fc_compiler_intel=yes
+  if $F77 -help 2>/dev/null | grep -q 'Intel.R. Fortran Compiler'; then
+gd_cv_f77_compiler_intel=yes
 else
-gd_cv_fc_compiler_intel=no
+gd_cv_f77_compiler_intel=no
 fi
 
 fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gd_cv_fc_compiler_intel" >&5
-$as_echo "$gd_cv_fc_compiler_intel" >&6; }
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gd_cv_f77_compiler_intel" >&5
+$as_echo "$gd_cv_f77_compiler_intel" >&6; }
 fi
 
 if test "x$make_f77bindings" != "xno"; then
@@ -25547,9 +26266,16 @@ ac_f77_v_output="`echo $ac_f77_v_output |
 #        that detects unbalanced quotes in FLIBS should be implemented
 #        and (ugh) tested at some point.
 case $ac_f77_v_output in
-  # If we are using xlf then replace all the commas with spaces.
+  # With xlf replace commas with spaces,
+  # and remove "-link" and closing parenthesis.
   *xlfentry*)
-    ac_f77_v_output=`echo $ac_f77_v_output | sed 's/,/ /g'` ;;
+    ac_f77_v_output=`echo $ac_f77_v_output |
+      sed '
+        s/,/ /g
+        s/ -link / /g
+        s/) *$//
+      '
+    ` ;;
 
   # With Intel ifc, ignore the quoted -mGLOB_options_string stuff (quoted
   # $LIBS confuse us, and the libraries appear later in the output anyway).
@@ -25565,6 +26291,16 @@ case $ac_f77_v_output in
 	s/-ignore  *'[^']*'/ /g; s/-ignore  *\"[^\"]*\"/ /g
 	s/-def  *'[^']*'/ /g; s/-def  *\"[^\"]*\"/ /g"` ;;
 
+  # If we are using fort77 (the f2c wrapper) then filter output and delete quotes.
+  *fort77*f2c*gcc*)
+    ac_f77_v_output=`echo "$ac_f77_v_output" | sed -n '
+        /:[	 ]\+Running[	 ]\{1,\}"gcc"/{
+          /"-c"/d
+          /[.]c"*/d
+          s/^.*"gcc"/"gcc"/
+          s/"//gp
+        }'` ;;
+
   # If we are using Cray Fortran then delete quotes.
   *cft90*)
     ac_f77_v_output=`echo $ac_f77_v_output | sed 's/"//g'` ;;
@@ -25638,9 +26374,16 @@ ac_f77_v_output="`echo $ac_f77_v_output |
 #        that detects unbalanced quotes in FLIBS should be implemented
 #        and (ugh) tested at some point.
 case $ac_f77_v_output in
-  # If we are using xlf then replace all the commas with spaces.
+  # With xlf replace commas with spaces,
+  # and remove "-link" and closing parenthesis.
   *xlfentry*)
-    ac_f77_v_output=`echo $ac_f77_v_output | sed 's/,/ /g'` ;;
+    ac_f77_v_output=`echo $ac_f77_v_output |
+      sed '
+        s/,/ /g
+        s/ -link / /g
+        s/) *$//
+      '
+    ` ;;
 
   # With Intel ifc, ignore the quoted -mGLOB_options_string stuff (quoted
   # $LIBS confuse us, and the libraries appear later in the output anyway).
@@ -25656,6 +26399,16 @@ case $ac_f77_v_output in
 	s/-ignore  *'[^']*'/ /g; s/-ignore  *\"[^\"]*\"/ /g
 	s/-def  *'[^']*'/ /g; s/-def  *\"[^\"]*\"/ /g"` ;;
 
+  # If we are using fort77 (the f2c wrapper) then filter output and delete quotes.
+  *fort77*f2c*gcc*)
+    ac_f77_v_output=`echo "$ac_f77_v_output" | sed -n '
+        /:[	 ]\+Running[	 ]\{1,\}"gcc"/{
+          /"-c"/d
+          /[.]c"*/d
+          s/^.*"gcc"/"gcc"/
+          s/"//gp
+        }'` ;;
+
   # If we are using Cray Fortran then delete quotes.
   *cft90*)
     ac_f77_v_output=`echo $ac_f77_v_output | sed 's/"//g'` ;;
@@ -25714,7 +26467,11 @@ fi
 	  |-LANG:=* | -LIST:* | -LNO:* | -link)
 	  ;;
 	-lkernel32)
-	  test x"$CYGWIN" != xyes && ac_cv_f77_libs="$ac_cv_f77_libs $ac_arg"
+	  case $host_os in
+	  *cygwin*) ;;
+	  *) ac_cv_f77_libs="$ac_cv_f77_libs $ac_arg"
+	    ;;
+	  esac
 	  ;;
 	-[LRuYz])
 	  # These flags, when seen by themselves, take an argument.
@@ -26139,6 +26896,93 @@ ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
 ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
 ac_compiler_gnu=$ac_cv_c_compiler_gnu
 
+  if test "x$ac_cv_f77_mangling" == "xunknown"; then
+    make_f77bindings=no
+    make_f95bindings=no
+  fi
+fi
+
+if test "x$make_f95bindings" != "xno"; then
+  gd_saved_FCFLAGS=$FCFLAGS
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $FC accepts -Wall" >&5
+$as_echo_n "checking whether $FC accepts -Wall... " >&6; }
+if ${gd_cv_prog_fc_wall+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  FCFLAGS="-Wall"
+ac_ext=f
+ac_compile='$F77 -c $FFLAGS conftest.$ac_ext >&5'
+ac_link='$F77 -o conftest$ac_exeext $FFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_f77_compiler_gnu
+
+cat > conftest.$ac_ext <<_ACEOF
+      program main
+
+      end
+_ACEOF
+if ac_fn_f77_try_compile "$LINENO"; then :
+  gd_cv_prog_fc_wall=yes
+else
+  gd_cv_prog_fc_wall=no
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gd_cv_prog_fc_wall" >&5
+$as_echo "$gd_cv_prog_fc_wall" >&6; }
+FCFLAGS=$gd_saved_FCFLAGS
+  gd_saved_FCFLAGS=$FCFLAGS
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $FC accepts -Wextra" >&5
+$as_echo_n "checking whether $FC accepts -Wextra... " >&6; }
+if ${gd_cv_prog_fc_wextra+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  FCFLAGS="-Wextra"
+ac_ext=f
+ac_compile='$F77 -c $FFLAGS conftest.$ac_ext >&5'
+ac_link='$F77 -o conftest$ac_exeext $FFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_f77_compiler_gnu
+
+cat > conftest.$ac_ext <<_ACEOF
+      program main
+
+      end
+_ACEOF
+if ac_fn_f77_try_compile "$LINENO"; then :
+  gd_cv_prog_fc_wextra=yes
+else
+  gd_cv_prog_fc_wextra=no
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gd_cv_prog_fc_wextra" >&5
+$as_echo "$gd_cv_prog_fc_wextra" >&6; }
+FCFLAGS=$gd_saved_FCFLAGS
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the Intel Fortran compiler" >&5
+$as_echo_n "checking whether we are using the Intel Fortran compiler... " >&6; }
+if ${gd_cv_fc_compiler_intel+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if $FC -help 2>/dev/null | grep -q 'Intel.R. Fortran Compiler'; then
+gd_cv_fc_compiler_intel=yes
+else
+gd_cv_fc_compiler_intel=no
+fi
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gd_cv_fc_compiler_intel" >&5
+$as_echo "$gd_cv_fc_compiler_intel" >&6; }
 fi
 
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking if we're linking against the Microsoft C Run-Time" >&5
@@ -26181,20 +27025,23 @@ $as_echo "#define __MSVCRT_VERSION__ 0x601" >>confdefs.h
 fi
 
 
-$as_echo "#define _BSD_SOURCE /**/" >>confdefs.h
+$as_echo "#define _GNU_SOURCE 1" >>confdefs.h
+
 
+$as_echo "#define _BSD_SOURCE 1" >>confdefs.h
 
-$as_echo "#define _SVID_SOURCE /**/" >>confdefs.h
 
+$as_echo "#define _SVID_SOURCE 1" >>confdefs.h
 
-$as_echo "#define _POSIX_SOURCE /**/" >>confdefs.h
+
+$as_echo "#define _POSIX_SOURCE 1" >>confdefs.h
 
 
 $as_echo "#define _POSIX_C_SOURCE 200809L" >>confdefs.h
 
 
 echo
-echo "*** Looking for library functions"
+echo "*** Looking for additional libraries"
 echo
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing ceil" >&5
 $as_echo_n "checking for library containing ceil... " >&6; }
@@ -26261,232 +27108,13 @@ if test "$ac_res" != no; then :
 fi
 
 
-if test "x${use_modules}" != "xno"; then
-  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing pthread_mutex_lock" >&5
-$as_echo_n "checking for library containing pthread_mutex_lock... " >&6; }
-if ${ac_cv_search_pthread_mutex_lock+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  ac_func_search_save_LIBS=$LIBS
-cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-
-/* Override any GCC internal prototype to avoid an error.
-   Use char because int might match the return type of a GCC
-   builtin and then its argument prototype would still apply.  */
-#ifdef __cplusplus
-extern "C"
-#endif
-char pthread_mutex_lock ();
-#ifdef F77_DUMMY_MAIN
-
-#  ifdef __cplusplus
-     extern "C"
-#  endif
-   int F77_DUMMY_MAIN() { return 1; }
-
-#endif
-int
-main ()
-{
-return pthread_mutex_lock ();
-  ;
-  return 0;
-}
-_ACEOF
-for ac_lib in '' pthread; do
-  if test -z "$ac_lib"; then
-    ac_res="none required"
-  else
-    ac_res=-l$ac_lib
-    LIBS="-l$ac_lib  $ac_func_search_save_LIBS"
-  fi
-  if ac_fn_c_try_link "$LINENO"; then :
-  ac_cv_search_pthread_mutex_lock=$ac_res
-fi
-rm -f core conftest.err conftest.$ac_objext \
-    conftest$ac_exeext
-  if ${ac_cv_search_pthread_mutex_lock+:} false; then :
-  break
-fi
-done
-if ${ac_cv_search_pthread_mutex_lock+:} false; then :
-
-else
-  ac_cv_search_pthread_mutex_lock=no
-fi
-rm conftest.$ac_ext
-LIBS=$ac_func_search_save_LIBS
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_pthread_mutex_lock" >&5
-$as_echo "$ac_cv_search_pthread_mutex_lock" >&6; }
-ac_res=$ac_cv_search_pthread_mutex_lock
-if test "$ac_res" != no; then :
-  test "$ac_res" = "none required" || LIBS="$ac_res $LIBS"
-  use_pthread=yes
-
-$as_echo "#define USE_PTHREAD /**/" >>confdefs.h
-
-
-else
-  use_pthread=no
-fi
-
-  for ac_header in pthread.h
-do :
-  ac_fn_c_check_header_mongrel "$LINENO" "pthread.h" "ac_cv_header_pthread_h" "$ac_includes_default"
-if test "x$ac_cv_header_pthread_h" = xyes; then :
-  cat >>confdefs.h <<_ACEOF
-#define HAVE_PTHREAD_H 1
-_ACEOF
-
-fi
-
-done
-
-fi
-
-for ac_func in _commit fchmod _fdopen fseeko fseeko64 fsync ftello ftello64 \
-                getcwd _getcwd getdelim gmtime_r _lseeki64 _mkdir mkstemp nan \
-                _open _read _rmdir _snprintf stat64 _stat64 _strtoi64 strtoll \
-                _strtoui64 strtoull _unlink _write
-do :
-  as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
-ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var"
-if eval test \"x\$"$as_ac_var"\" = x"yes"; then :
-  cat >>confdefs.h <<_ACEOF
-#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
-_ACEOF
-
-fi
-done
-
-if test "x$disable_c99" = "xno"; then
-  for ac_func in cabs
-do :
-  ac_fn_c_check_func "$LINENO" "cabs" "ac_cv_func_cabs"
-if test "x$ac_cv_func_cabs" = xyes; then :
-  cat >>confdefs.h <<_ACEOF
-#define HAVE_CABS 1
-_ACEOF
-
-fi
-done
-
-fi
-ac_fn_c_check_decl "$LINENO" "strerror_r" "ac_cv_have_decl_strerror_r" "$ac_includes_default"
-if test "x$ac_cv_have_decl_strerror_r" = xyes; then :
-  ac_have_decl=1
-else
-  ac_have_decl=0
-fi
-
-cat >>confdefs.h <<_ACEOF
-#define HAVE_DECL_STRERROR_R $ac_have_decl
-_ACEOF
-
-for ac_func in strerror_r
-do :
-  ac_fn_c_check_func "$LINENO" "strerror_r" "ac_cv_func_strerror_r"
-if test "x$ac_cv_func_strerror_r" = xyes; then :
-  cat >>confdefs.h <<_ACEOF
-#define HAVE_STRERROR_R 1
-_ACEOF
-
-fi
-done
-
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether strerror_r returns char *" >&5
-$as_echo_n "checking whether strerror_r returns char *... " >&6; }
-if ${ac_cv_func_strerror_r_char_p+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-
-    ac_cv_func_strerror_r_char_p=no
-    if test $ac_cv_have_decl_strerror_r = yes; then
-      cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-$ac_includes_default
-#ifdef F77_DUMMY_MAIN
-
-#  ifdef __cplusplus
-     extern "C"
-#  endif
-   int F77_DUMMY_MAIN() { return 1; }
-
-#endif
-int
-main ()
-{
-
-	  char buf[100];
-	  char x = *strerror_r (0, buf, sizeof buf);
-	  char *p = strerror_r (0, buf, sizeof buf);
-	  return !p || x;
-
-  ;
-  return 0;
-}
-_ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
-  ac_cv_func_strerror_r_char_p=yes
-fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-    else
-      # strerror_r is not declared.  Choose between
-      # systems that have relatively inaccessible declarations for the
-      # function.  BeOS and DEC UNIX 4.0 fall in this category, but the
-      # former has a strerror_r that returns char*, while the latter
-      # has a strerror_r that returns `int'.
-      # This test should segfault on the DEC system.
-      if test "$cross_compiling" = yes; then :
-  :
-else
-  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-$ac_includes_default
-	extern char *strerror_r ();
-#ifdef F77_DUMMY_MAIN
-
-#  ifdef __cplusplus
-     extern "C"
-#  endif
-   int F77_DUMMY_MAIN() { return 1; }
-
-#endif
-int
-main ()
-{
-char buf[100];
-	  char x = *strerror_r (0, buf, sizeof buf);
-	  return ! isalpha (x);
-  ;
-  return 0;
-}
-_ACEOF
-if ac_fn_c_try_run "$LINENO"; then :
-  ac_cv_func_strerror_r_char_p=yes
-fi
-rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
-  conftest.$ac_objext conftest.beam conftest.$ac_ext
-fi
-
-    fi
-
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_strerror_r_char_p" >&5
-$as_echo "$ac_cv_func_strerror_r_char_p" >&6; }
-if test $ac_cv_func_strerror_r_char_p = yes; then
-
-$as_echo "#define STRERROR_R_CHAR_P 1" >>confdefs.h
-
-fi
-
-
 echo
 echo "*** Looking for additional header files"
 echo
-for ac_header in direct.h fcntl.h libgen.h stdint.h unistd.h
+for ac_header in asm/unaligned.h Availability.h byteswap.h direct.h fcntl.h \
+                  float.h inttypes.h io.h libgen.h libkern/OSByteOrder.h \
+                  math.h stddef.h stdint.h sys/endian.h sys/file.h sys/param.h \
+                  sys/stat.h sys/types.h sys/wait.h unistd.h
 do :
   as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
 ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default"
@@ -26696,70 +27324,6 @@ fi
 fi
 
 
-for ac_header in io.h
-do :
-  ac_fn_c_check_header_mongrel "$LINENO" "io.h" "ac_cv_header_io_h" "$ac_includes_default"
-if test "x$ac_cv_header_io_h" = xyes; then :
-  cat >>confdefs.h <<_ACEOF
-#define HAVE_IO_H 1
-_ACEOF
-
-fi
-
-done
-
-
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether mkdir accepts two arguments" >&5
-$as_echo_n "checking whether mkdir accepts two arguments... " >&6; }
-cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-
-#if HAVE_SYS_STAT_H
-#include <sys/stat.h>
-#endif
-#if HAVE_SYS_TYPES_H
-#include <sys/types.h>
-#endif
-#if HAVE_IO_H
-#include <io.h>
-#endif
-
-#ifdef F77_DUMMY_MAIN
-
-#  ifdef __cplusplus
-     extern "C"
-#  endif
-   int F77_DUMMY_MAIN() { return 1; }
-
-#endif
-int
-main ()
-{
-
-#ifdef HAVE__MKDIR
-_mkdir("x", 00777);
-#else
-mkdir("x", 00777);
-#endif
-
-  ;
-  return 0;
-}
-_ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
-  gd_2arg_mkdir=yes
-else
-  gd_2arg_mkdir=no
-fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gd_2arg_mkdir" >&5
-$as_echo "$gd_2arg_mkdir" >&6; }
-
-if test $gd_2arg_mkdir = "no"; then
-
-$as_echo "#define MKDIR_NO_MODE 1" >>confdefs.h
-
-fi
 echo
 echo "*** Checking data types"
 echo
@@ -26782,11 +27346,11 @@ else
 int
 main ()
 {
-/* FIXME: Include the comments suggested by Paul. */
+
 #ifndef __cplusplus
-  /* Ultrix mips cc rejects this.  */
+  /* Ultrix mips cc rejects this sort of thing.  */
   typedef int charset[2];
-  const charset cs;
+  const charset cs = { 0, 0 };
   /* SunOS 4.1.1 cc rejects this.  */
   char const *const *pcpcc;
   char **ppc;
@@ -26803,8 +27367,9 @@ main ()
   ++pcpcc;
   ppc = (char**) pcpcc;
   pcpcc = (char const *const *) ppc;
-  { /* SCO 3.2v4 cc rejects this.  */
-    char *t;
+  { /* SCO 3.2v4 cc rejects this sort of thing.  */
+    char tx;
+    char *t = &tx;
     char const *s = 0 ? (char *) 0 : (char const *) 0;
 
     *t++ = 0;
@@ -26820,10 +27385,10 @@ main ()
     iptr p = 0;
     ++p;
   }
-  { /* AIX XL C 1.02.0.0 rejects this saying
+  { /* AIX XL C 1.02.0.0 rejects this sort of thing, saying
        "k.c", line 2.27: 1506-025 (S) Operand must be a modifiable lvalue. */
-    struct s { int j; const int *ap[3]; };
-    struct s *b; b->j = 5;
+    struct s { int j; const int *ap[3]; } bx;
+    struct s *b = &bx; b->j = 5;
   }
   { /* ULTRIX-32 V3.1 (Rev 9) vcc rejects this */
     const int foo = 10;
@@ -27839,17 +28404,6 @@ $as_echo "#define HAVE_OFF64_T 1" >>confdefs.h
 fi
 
 
-if test "x$gd_cv_c_need_lfs_defined" = "xyes"; then
-
-$as_echo "#define _LARGEFILE64_SOURCE 1" >>confdefs.h
-
-fi
-
-if test "x$gd_cv_type_off64_t" = "xyes"; then
-
-$as_echo "#define HAVE_OFF64_T 1" >>confdefs.h
- fi
-
 # The cast to long int works around a bug in the HP C Compiler
 # version HP92453-01 B.11.11.23709.GP, which incorrectly rejects
 # declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'.
@@ -28114,6 +28668,39 @@ cat >>confdefs.h <<_ACEOF
 _ACEOF
 
 
+# The cast to long int works around a bug in the HP C Compiler
+# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects
+# declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'.
+# This bug is HP SR number 8606223364.
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking size of void *" >&5
+$as_echo_n "checking size of void *... " >&6; }
+if ${ac_cv_sizeof_void_p+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (void *))" "ac_cv_sizeof_void_p"        "$ac_includes_default"; then :
+
+else
+  if test "$ac_cv_type_void_p" = yes; then
+     { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error 77 "cannot compute sizeof (void *)
+See \`config.log' for more details" "$LINENO" 5; }
+   else
+     ac_cv_sizeof_void_p=0
+   fi
+fi
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sizeof_void_p" >&5
+$as_echo "$ac_cv_sizeof_void_p" >&6; }
+
+
+
+cat >>confdefs.h <<_ACEOF
+#define SIZEOF_VOID_P $ac_cv_sizeof_void_p
+_ACEOF
+
+
 
 if test $ac_cv_sizeof_int -eq 2; then
   gd_int16_t="int"
@@ -28145,315 +28732,220 @@ elif test $ac_cv_sizeof_long_long_int -eq 8; then
   gd_int64_t="long long int"
 fi
 
-DEFINE_gd_int16_t="#define gd_int16_t $gd_int16_t";
-DEFINE_gd_uint16_t="#define gd_uint16_t $gd_uint16_t";
-DEFINE_gd_int64_t="#define gd_int64_t $gd_int64_t";
+if test $ac_cv_sizeof_unsigned_int -eq 8; then
+  gd_uint64_t="unsigned int"
+elif test $ac_cv_sizeof_unsigned_short_int -eq 8; then
+  gd_uint64_t="unsigned short int"
+elif test $ac_cv_sizeof_unsigned_long_int -eq 8; then
+  gd_uint64_t="unsigned long int"
+elif test $ac_cv_sizeof_unsigned_long_long_int -eq 8; then
+  gd_uint64_t="unsigned long long int"
+fi
 
+if test "x$gd_cv_type_off64_t" = "xyes"; then
 
+$as_echo "#define HAVE_OFF64_T 1" >>confdefs.h
+ fi
 
+DEFINE_gd_int16_t="# define gd_int16_t $gd_int16_t";
+DEFINE_gd_uint16_t="# define gd_uint16_t $gd_uint16_t";
+DEFINE_gd_int64_t="# define gd_int64_t $gd_int64_t";
+DEFINE_gd_uint64_t="# define gd_uint64_t $gd_uint64_t";
 
-if test "x$make_pybindings" = "xyes"; then
-  echo
-  echo "*** Configuring python bindings"
-  echo
 
-last_python=2.7
-first_python=2.3
 
-for ac_prog in seq
-do
-  # Extract the first word of "$ac_prog", so it can be a program name with args.
-set dummy $ac_prog; ac_word=$2
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_prog_SEQ+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  if test -n "$SEQ"; then
-  ac_cv_prog_SEQ="$SEQ" # Let the user override the test.
-else
-as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
-  IFS=$as_save_IFS
-  test -z "$as_dir" && as_dir=.
-    for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
-    ac_cv_prog_SEQ="$ac_prog"
-    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
-    break 2
-  fi
-done
-  done
-IFS=$as_save_IFS
 
-fi
-fi
-SEQ=$ac_cv_prog_SEQ
-if test -n "$SEQ"; then
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $SEQ" >&5
-$as_echo "$SEQ" >&6; }
-else
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-fi
 
+echo
+echo "*** Looking for additional library functions"
+echo
+for ac_func in basename _chsize _chsize_s _commit fchmod _fdopen fdopendir \
+                _finite fpathconf fseeko fseeko64 _fstat fstat64 _fstat64 \
+                fstatat fstatat64 fsync ftello ftello64 ftruncate ftruncate64 \
+                getcwd _getcwd getdelim gmtime_r isnan _isnan lseek64 \
+                _lseeki64 lstat lstat64 _mkdir mkfifo nan _open openat \
+                pathconf _read readdir_r readlink renameat _rmdir snprintf \
+                _snprintf stat64 _stat64 _strtoi64 strtoll strtoq _strtoui64 \
+                strtoull strtouq symlink _unlink unlinkat _write
+do :
+  as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
+ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var"
+if eval test \"x\$"$as_ac_var"\" = x"yes"; then :
+  cat >>confdefs.h <<_ACEOF
+#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
+_ACEOF
 
-  test -n "$SEQ" && break
+fi
 done
-test -n "$SEQ" || SEQ="not found"
 
-if test "x$SEQ" == "xnot found"; then
-  for ac_prog in jot
-do
-  # Extract the first word of "$ac_prog", so it can be a program name with args.
-set dummy $ac_prog; ac_word=$2
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_prog_JOT+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  if test -n "$JOT"; then
-  ac_cv_prog_JOT="$JOT" # Let the user override the test.
-else
-as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
-  IFS=$as_save_IFS
-  test -z "$as_dir" && as_dir=.
-    for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
-    ac_cv_prog_JOT="$ac_prog"
-    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
-    break 2
-  fi
-done
-  done
-IFS=$as_save_IFS
+if test "x$disable_c99" = "xno"; then
+  for ac_func in cabs
+do :
+  ac_fn_c_check_func "$LINENO" "cabs" "ac_cv_func_cabs"
+if test "x$ac_cv_func_cabs" = xyes; then :
+  cat >>confdefs.h <<_ACEOF
+#define HAVE_CABS 1
+_ACEOF
 
 fi
+done
+
 fi
-JOT=$ac_cv_prog_JOT
-if test -n "$JOT"; then
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $JOT" >&5
-$as_echo "$JOT" >&6; }
+ac_fn_c_check_decl "$LINENO" "strerror_r" "ac_cv_have_decl_strerror_r" "$ac_includes_default"
+if test "x$ac_cv_have_decl_strerror_r" = xyes; then :
+  ac_have_decl=1
 else
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
+  ac_have_decl=0
 fi
 
+cat >>confdefs.h <<_ACEOF
+#define HAVE_DECL_STRERROR_R $ac_have_decl
+_ACEOF
 
-  test -n "$JOT" && break
-done
-test -n "$JOT" || JOT="not found"
+for ac_func in strerror_r
+do :
+  ac_fn_c_check_func "$LINENO" "strerror_r" "ac_cv_func_strerror_r"
+if test "x$ac_cv_func_strerror_r" = xyes; then :
+  cat >>confdefs.h <<_ACEOF
+#define HAVE_STRERROR_R 1
+_ACEOF
 
-  if test "x$JOT" == "xnot found"; then
-    python_prog_list="python python2"
-  else
-    python_prog_list="python python2     `$JOT -w 'python%.1f' - $last_python $first_python -0.1`" #'
-  fi
-else
-  python_prog_list="python python2   `$SEQ -f 'python%.1f' $last_python -0.1 $first_python`" #'
 fi
+done
 
-
-# Check whether --with-python was given.
-if test "${with_python+set}" = set; then :
-  withval=$with_python;
-              case "${withval}" in
-                no) have_python="no" ;;
-                yes) user_python= ; have_python= ;;
-                *) user_python="${withval}"; have_python= ;;
-              esac
-
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether strerror_r returns char *" >&5
+$as_echo_n "checking whether strerror_r returns char *... " >&6; }
+if ${ac_cv_func_strerror_r_char_p+:} false; then :
+  $as_echo_n "(cached) " >&6
 else
-   user_python=; have_python=
-fi
 
+    ac_cv_func_strerror_r_char_p=no
+    if test $ac_cv_have_decl_strerror_r = yes; then
+      cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+$ac_includes_default
+#ifdef F77_DUMMY_MAIN
 
+#  ifdef __cplusplus
+     extern "C"
+#  endif
+   int F77_DUMMY_MAIN() { return 1; }
 
-# Check whether --with-python-module-dir was given.
-if test "${with_python_module_dir+set}" = set; then :
-  withval=$with_python_module_dir;
-        case "${withval}" in
-          no) local_python_modpath= ;;
-          *) local_python_modpath="${withval}"
-        esac
+#endif
+int
+main ()
+{
 
-else
-   local_python_modpath=
-fi
+	  char buf[100];
+	  char x = *strerror_r (0, buf, sizeof buf);
+	  char *p = strerror_r (0, buf, sizeof buf);
+	  return !p || x;
 
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  ac_cv_func_strerror_r_char_p=yes
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+    else
+      # strerror_r is not declared.  Choose between
+      # systems that have relatively inaccessible declarations for the
+      # function.  BeOS and DEC UNIX 4.0 fall in this category, but the
+      # former has a strerror_r that returns char*, while the latter
+      # has a strerror_r that returns `int'.
+      # This test should segfault on the DEC system.
+      if test "$cross_compiling" = yes; then :
+  :
+else
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+$ac_includes_default
+	extern char *strerror_r ();
+#ifdef F77_DUMMY_MAIN
 
-if test "x${have_python}" != "xno"; then
+#  ifdef __cplusplus
+     extern "C"
+#  endif
+   int F77_DUMMY_MAIN() { return 1; }
 
-if test "x$user_python" != "x"; then
-  { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $user_python version >= $first_python" >&5
-$as_echo_n "checking whether $user_python version >= $first_python... " >&6; }
-  prog="import sys
-# split strings by '.' and convert to numeric.  Append some zeros
-# because we need at least 4 digits for the hex conversion.
-# map returns an iterator in Python 3.0 and a list in 2.x
-minver = list(map(int, '$first_python'.split('.'))) + [0, 0, 0]
-minverhex = 0
-# xrange is not present in Python 3.0 and range returns an iterator
-for i in list(range(0, 4)): minverhex = (minverhex << 8) + minver[i]
-sys.exit(sys.hexversion < minverhex)"
-  if { echo "$as_me:$LINENO: $user_python -c "$prog"" >&5
-   ($user_python -c "$prog") >&5 2>&5
-   ac_status=$?
-   echo "$as_me:$LINENO: \$? = $ac_status" >&5
-   (exit $ac_status); }; then :
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
-$as_echo "yes" >&6; }
-  PYTHON=$user_python
-else
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-  PYTHON="not found"
+#endif
+int
+main ()
+{
+char buf[100];
+	  char x = *strerror_r (0, buf, sizeof buf);
+	  return ! isalpha (x);
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_run "$LINENO"; then :
+  ac_cv_func_strerror_r_char_p=yes
 fi
-else
-  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Python interpreter version >= $first_python" >&5
-$as_echo_n "checking for Python interpreter version >= $first_python... " >&6; }
-  PYTHON="not found"
-  for py in $python_prog_list; do
-  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
-  IFS=$as_save_IFS
-  test -z "$as_dir" && as_dir=.
-    for exec_ext in '' $ac_executable_extensions; do
-    if { test -f "$as_dir/$py$exec_ext" && $as_test_x "$as_dir/$py$exec_ext"; }; then
-      prog="import sys
-# split strings by '.' and convert to numeric.  Append some zeros
-# because we need at least 4 digits for the hex conversion.
-# map returns an iterator in Python 3.0 and a list in 2.x
-minver = list(map(int, '$first_python'.split('.'))) + [0, 0, 0]
-minverhex = 0
-# xrange is not present in Python 3.0 and range returns an iterator
-for i in list(range(0, 4)): minverhex = (minverhex << 8) + minver[i]
-sys.exit(sys.hexversion < minverhex)"
-  if { echo "$as_me:$LINENO: "$as_dir/$py$exec_ext" -c "$prog"" >&5
-   ("$as_dir/$py$exec_ext" -c "$prog") >&5 2>&5
-   ac_status=$?
-   echo "$as_me:$LINENO: \$? = $ac_status" >&5
-   (exit $ac_status); }; then :
-   PYTHON="$as_dir/$py$exec_ext"; break 3
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
+  conftest.$ac_objext conftest.beam conftest.$ac_ext
 fi
-    fi
-  done
-  done
-IFS=$as_save_IFS
 
-  done
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PYTHON" >&5
-$as_echo "$PYTHON" >&6; }
-fi
+    fi
 
-if test "x$PYTHON" = "xnot found"; then
-  have_python="no"
-  PYTHON=
 fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_strerror_r_char_p" >&5
+$as_echo "$ac_cv_func_strerror_r_char_p" >&6; }
+if test $ac_cv_func_strerror_r_char_p = yes; then
 
+$as_echo "#define STRERROR_R_CHAR_P 1" >>confdefs.h
 
 fi
 
-if test "x${have_python}" != "xno"; then
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking $PYTHON version" >&5
-$as_echo_n "checking $PYTHON version... " >&6; }
-PYTHON_VERSION=`$PYTHON -c "import sys; print sys.version[:3]"`
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $PYTHON_VERSION" >&5
-$as_echo "$PYTHON_VERSION" >&6; }
+ac_fn_c_check_type "$LINENO" "pid_t" "ac_cv_type_pid_t" "$ac_includes_default"
+if test "x$ac_cv_type_pid_t" = xyes; then :
 
-if test -x $PYTHON-config; then
-  if test -n "$user_python"; then
-    python_exec_prefix=`$PYTHON-config --exec-prefix`
-    PYTHON_LIBS="-L${python_exec_prefix}/lib "
-  else
-    PYTHON_LIBS=""
-  fi
-  PYTHON_CPPFLAGS=`$PYTHON-config --includes 2>/dev/null`
-  PYTHON_LIBS="${PYTHON_LIBS}`$PYTHON-config --ldflags 2>/dev/null`"
 else
-  python_prefix=`$PYTHON -c "import sys; print sys.prefix"`
-  python_exec_prefix=`$PYTHON -c "import sys; print sys.exec_prefix"`
-  python_libdir=`$PYTHON -c "from distutils import sysconfig; print sysconfig.get_config_var('LIBDIR')"`
-  python_syslibs=`$PYTHON -c "from distutils import sysconfig; print sysconfig.get_config_var('SYSLIBS')"`
-  python_shlibs=`$PYTHON -c "from distutils import sysconfig; print sysconfig.get_config_var('SHLIBS')"`
-  python_modlibs=`$PYTHON -c "from distutils import sysconfig; print sysconfig.get_config_var('MODLIBS')"`
-
-  PYTHON_CPPFLAGS="-I${python_prefix}/include/python${PYTHON_VERSION} -I${python_exec_prefix}/include/python${PYTHON_VERSION}"
-  if test -n "$user_python"; then
-    PYTHON_LIBS="-L${python_libdir} "
-  else
-    PYTHON_LIBS=""
-  fi
-  PYTHON_LIBS="${PYTHON_LIBS}$python_syslibs $python_shlibs $python_modlibs -lpython${PYTHON_VERSION}"
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking Python includes" >&5
-$as_echo_n "checking Python includes... " >&6; }
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $PYTHON_CPPFLAGS" >&5
-$as_echo "$PYTHON_CPPFLAGS" >&6; }
 
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking Python libraries" >&5
-$as_echo_n "checking Python libraries... " >&6; }
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $PYTHON_LIBS" >&5
-$as_echo "$PYTHON_LIBS" >&6; }
+cat >>confdefs.h <<_ACEOF
+#define pid_t int
+_ACEOF
 
+fi
 
-saved_CPPFLAGS=${CPPFLAGS}
-CPPFLAGS="${CPPFLAGS} ${PYTHON_CPPFLAGS}"
-for ac_header in Python.h
+for ac_header in vfork.h
 do :
-  ac_fn_c_check_header_mongrel "$LINENO" "Python.h" "ac_cv_header_Python_h" "$ac_includes_default"
-if test "x$ac_cv_header_Python_h" = xyes; then :
+  ac_fn_c_check_header_mongrel "$LINENO" "vfork.h" "ac_cv_header_vfork_h" "$ac_includes_default"
+if test "x$ac_cv_header_vfork_h" = xyes; then :
   cat >>confdefs.h <<_ACEOF
-#define HAVE_PYTHON_H 1
+#define HAVE_VFORK_H 1
 _ACEOF
 
-else
-  have_python="no"
 fi
 
 done
 
-CPPFLAGS=${saved_CPPFLAGS}
+for ac_func in fork vfork
+do :
+  as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
+ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var"
+if eval test \"x\$"$as_ac_var"\" = x"yes"; then :
+  cat >>confdefs.h <<_ACEOF
+#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
+_ACEOF
 
 fi
+done
 
-if test "x${have_python}" != "xno"; then
-
-pyexec_prefix=$exec_prefix
-test "x$pyexec_prefix" = xNONE && pyexec_prefix=$prefix
-test "x$pyexec_prefix" = xNONE && pyexec_prefix=$ac_default_prefix
-
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking Python extension module directory" >&5
-$as_echo_n "checking Python extension module directory... " >&6; }
-if test "x${local_python_modpath}" = "x"; then
-  pythondir=`$PYTHON -c "from distutils import sysconfig; print sysconfig.get_python_lib(1,0,prefix='${pyexec_prefix}')" 2>/dev/null || echo "${pyexec_prefix}/lib/python${PYTHON_VERSION}/site-packages"`
+if test "x$ac_cv_func_fork" = xyes; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for working fork" >&5
+$as_echo_n "checking for working fork... " >&6; }
+if ${ac_cv_func_fork_works+:} false; then :
+  $as_echo_n "(cached) " >&6
 else
-  pythondir=$local_python_modpath
-fi
-
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $pythondir" >&5
-$as_echo "$pythondir" >&6; }
-
-saved_CPPFLAGS=${CPPFLAGS}
-CPPFLAGS="${CPPFLAGS} ${PYTHON_CPPFLAGS}"
-saved_LIBS=$LIBS
-LIBS="$LIBS ${PYTHON_LIBS}"
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if we can compile a simple Python extension module" >&5
-$as_echo_n "checking if we can compile a simple Python extension module... " >&6; }
-cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+  if test "$cross_compiling" = yes; then :
+  ac_cv_func_fork_works=cross
+else
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
-
-/* Override any GCC internal prototype to avoid an error.
-   Use char because int might match the return type of a GCC
-   builtin and then its argument prototype would still apply.  */
-#ifdef __cplusplus
-extern "C"
-#endif
-char Py_Initialize ();
+$ac_includes_default
 #ifdef F77_DUMMY_MAIN
 
 #  ifdef __cplusplus
@@ -28465,58 +28957,624 @@ char Py_Initialize ();
 int
 main ()
 {
-return Py_Initialize ();
+
+	  /* By Ruediger Kuhlmann. */
+	  return fork () < 0;
+
   ;
   return 0;
 }
 _ACEOF
-if ac_fn_c_try_link "$LINENO"; then :
-   { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
-$as_echo "yes" >&6; }
+if ac_fn_c_try_run "$LINENO"; then :
+  ac_cv_func_fork_works=yes
 else
-   { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }; have_python="no"
+  ac_cv_func_fork_works=no
 fi
-rm -f core conftest.err conftest.$ac_objext \
-    conftest$ac_exeext conftest.$ac_ext
-CPPFLAGS=$saved_CPPFLAGS
-LIBS=$saved_LIBS
-
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
+  conftest.$ac_objext conftest.beam conftest.$ac_ext
 fi
 
-  have_numpy="no"
-  if test "x$have_python" = "xno"; then
-    make_pybindings="no"
-  else
-    { $as_echo "$as_me:${as_lineno-$LINENO}: checking for NumPy" >&5
-$as_echo_n "checking for NumPy... " >&6; }
-    cat > conftest.py << EOF
-import sys
-try:
-  import numpy
-except ImportError:
-  sys.exit(1)
-EOF
-    if $PYTHON conftest.py > /dev/null 2>&1; then
-      have_numpy="yes"
-    fi
-    { $as_echo "$as_me:${as_lineno-$LINENO}: result: $have_numpy" >&5
-$as_echo "$have_numpy" >&6; }
-  fi
-  if test "x$have_numpy" = "xyes"; then
-    { $as_echo "$as_me:${as_lineno-$LINENO}: checking NumPy includes" >&5
-$as_echo_n "checking NumPy includes... " >&6; }
-    NUMPY_CPPFLAGS=-I`$PYTHON -c "import numpy; print numpy.get_include()"`
-    { $as_echo "$as_me:${as_lineno-$LINENO}: result: $NUMPY_CPPFLAGS" >&5
-$as_echo "$NUMPY_CPPFLAGS" >&6; }
-
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_fork_works" >&5
+$as_echo "$ac_cv_func_fork_works" >&6; }
 
-    saved_cppflags=$CPPFLAGS
-    CPPFLAGS="${CPPFLAGS} ${PYTHON_CPPFLAGS} ${NUMPY_CPPFLAGS}"
-    for ac_header in numpy/arrayobject.h
-do :
-  ac_fn_c_check_header_compile "$LINENO" "numpy/arrayobject.h" "ac_cv_header_numpy_arrayobject_h" "
-#include<Python.h>
+else
+  ac_cv_func_fork_works=$ac_cv_func_fork
+fi
+if test "x$ac_cv_func_fork_works" = xcross; then
+  case $host in
+    *-*-amigaos* | *-*-msdosdjgpp*)
+      # Override, as these systems have only a dummy fork() stub
+      ac_cv_func_fork_works=no
+      ;;
+    *)
+      ac_cv_func_fork_works=yes
+      ;;
+  esac
+  { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: result $ac_cv_func_fork_works guessed because of cross compilation" >&5
+$as_echo "$as_me: WARNING: result $ac_cv_func_fork_works guessed because of cross compilation" >&2;}
+fi
+ac_cv_func_vfork_works=$ac_cv_func_vfork
+if test "x$ac_cv_func_vfork" = xyes; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for working vfork" >&5
+$as_echo_n "checking for working vfork... " >&6; }
+if ${ac_cv_func_vfork_works+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test "$cross_compiling" = yes; then :
+  ac_cv_func_vfork_works=cross
+else
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+/* Thanks to Paul Eggert for this test.  */
+$ac_includes_default
+#include <sys/wait.h>
+#ifdef HAVE_VFORK_H
+# include <vfork.h>
+#endif
+/* On some sparc systems, changes by the child to local and incoming
+   argument registers are propagated back to the parent.  The compiler
+   is told about this with #include <vfork.h>, but some compilers
+   (e.g. gcc -O) don't grok <vfork.h>.  Test for this by using a
+   static variable whose address is put into a register that is
+   clobbered by the vfork.  */
+static void
+#ifdef __cplusplus
+sparc_address_test (int arg)
+# else
+sparc_address_test (arg) int arg;
+#endif
+{
+  static pid_t child;
+  if (!child) {
+    child = vfork ();
+    if (child < 0) {
+      perror ("vfork");
+      _exit(2);
+    }
+    if (!child) {
+      arg = getpid();
+      write(-1, "", 0);
+      _exit (arg);
+    }
+  }
+}
+
+int
+main ()
+{
+  pid_t parent = getpid ();
+  pid_t child;
+
+  sparc_address_test (0);
+
+  child = vfork ();
+
+  if (child == 0) {
+    /* Here is another test for sparc vfork register problems.  This
+       test uses lots of local variables, at least as many local
+       variables as main has allocated so far including compiler
+       temporaries.  4 locals are enough for gcc 1.40.3 on a Solaris
+       4.1.3 sparc, but we use 8 to be safe.  A buggy compiler should
+       reuse the register of parent for one of the local variables,
+       since it will think that parent can't possibly be used any more
+       in this routine.  Assigning to the local variable will thus
+       munge parent in the parent process.  */
+    pid_t
+      p = getpid(), p1 = getpid(), p2 = getpid(), p3 = getpid(),
+      p4 = getpid(), p5 = getpid(), p6 = getpid(), p7 = getpid();
+    /* Convince the compiler that p..p7 are live; otherwise, it might
+       use the same hardware register for all 8 local variables.  */
+    if (p != p1 || p != p2 || p != p3 || p != p4
+	|| p != p5 || p != p6 || p != p7)
+      _exit(1);
+
+    /* On some systems (e.g. IRIX 3.3), vfork doesn't separate parent
+       from child file descriptors.  If the child closes a descriptor
+       before it execs or exits, this munges the parent's descriptor
+       as well.  Test for this by closing stdout in the child.  */
+    _exit(close(fileno(stdout)) != 0);
+  } else {
+    int status;
+    struct stat st;
+
+    while (wait(&status) != child)
+      ;
+    return (
+	 /* Was there some problem with vforking?  */
+	 child < 0
+
+	 /* Did the child fail?  (This shouldn't happen.)  */
+	 || status
+
+	 /* Did the vfork/compiler bug occur?  */
+	 || parent != getpid()
+
+	 /* Did the file descriptor bug occur?  */
+	 || fstat(fileno(stdout), &st) != 0
+	 );
+  }
+}
+_ACEOF
+if ac_fn_c_try_run "$LINENO"; then :
+  ac_cv_func_vfork_works=yes
+else
+  ac_cv_func_vfork_works=no
+fi
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
+  conftest.$ac_objext conftest.beam conftest.$ac_ext
+fi
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_vfork_works" >&5
+$as_echo "$ac_cv_func_vfork_works" >&6; }
+
+fi;
+if test "x$ac_cv_func_fork_works" = xcross; then
+  ac_cv_func_vfork_works=$ac_cv_func_vfork
+  { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: result $ac_cv_func_vfork_works guessed because of cross compilation" >&5
+$as_echo "$as_me: WARNING: result $ac_cv_func_vfork_works guessed because of cross compilation" >&2;}
+fi
+
+if test "x$ac_cv_func_vfork_works" = xyes; then
+
+$as_echo "#define HAVE_WORKING_VFORK 1" >>confdefs.h
+
+else
+
+$as_echo "#define vfork fork" >>confdefs.h
+
+fi
+if test "x$ac_cv_func_fork_works" = xyes; then
+
+$as_echo "#define HAVE_WORKING_FORK 1" >>confdefs.h
+
+fi
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether mkdir accepts two arguments" >&5
+$as_echo_n "checking whether mkdir accepts two arguments... " >&6; }
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+#if HAVE_SYS_STAT_H
+#include <sys/stat.h>
+#endif
+#if HAVE_SYS_TYPES_H
+#include <sys/types.h>
+#endif
+#if HAVE_IO_H
+#include <io.h>
+#endif
+
+#ifdef F77_DUMMY_MAIN
+
+#  ifdef __cplusplus
+     extern "C"
+#  endif
+   int F77_DUMMY_MAIN() { return 1; }
+
+#endif
+int
+main ()
+{
+
+#ifdef HAVE__MKDIR
+_mkdir("x", 00777);
+#else
+mkdir("x", 00777);
+#endif
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  gd_2arg_mkdir=yes
+else
+  gd_2arg_mkdir=no
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gd_2arg_mkdir" >&5
+$as_echo "$gd_2arg_mkdir" >&6; }
+
+if test $gd_2arg_mkdir = "no"; then
+
+$as_echo "#define MKDIR_NO_MODE 1" >>confdefs.h
+
+fi
+ac_fn_c_check_decl "$LINENO" "isfinite" "ac_cv_have_decl_isfinite" "
+#ifdef HAVE_MATH_H
+#include <math.h>
+#endif
+
+"
+if test "x$ac_cv_have_decl_isfinite" = xyes; then :
+  ac_have_decl=1
+else
+  ac_have_decl=0
+fi
+
+cat >>confdefs.h <<_ACEOF
+#define HAVE_DECL_ISFINITE $ac_have_decl
+_ACEOF
+
+ac_fn_c_check_decl "$LINENO" "bswap16" "ac_cv_have_decl_bswap16" "
+#ifdef HAVE_BYTESWAP_H
+#include <byteswap.h>
+#endif
+#ifdef HAVE_SYS_ENDIAN_H
+#include <sys/endian.h>
+#endif
+#ifdef HAVE_LIBKERN_OSBYTEORDER_H
+#include <libkern/OSByteOrder.h>
+#endif
+
+"
+if test "x$ac_cv_have_decl_bswap16" = xyes; then :
+  ac_have_decl=1
+else
+  ac_have_decl=0
+fi
+
+cat >>confdefs.h <<_ACEOF
+#define HAVE_DECL_BSWAP16 $ac_have_decl
+_ACEOF
+ac_fn_c_check_decl "$LINENO" "bswap_16" "ac_cv_have_decl_bswap_16" "
+#ifdef HAVE_BYTESWAP_H
+#include <byteswap.h>
+#endif
+#ifdef HAVE_SYS_ENDIAN_H
+#include <sys/endian.h>
+#endif
+#ifdef HAVE_LIBKERN_OSBYTEORDER_H
+#include <libkern/OSByteOrder.h>
+#endif
+
+"
+if test "x$ac_cv_have_decl_bswap_16" = xyes; then :
+  ac_have_decl=1
+else
+  ac_have_decl=0
+fi
+
+cat >>confdefs.h <<_ACEOF
+#define HAVE_DECL_BSWAP_16 $ac_have_decl
+_ACEOF
+ac_fn_c_check_decl "$LINENO" "OSSwapInt16" "ac_cv_have_decl_OSSwapInt16" "
+#ifdef HAVE_BYTESWAP_H
+#include <byteswap.h>
+#endif
+#ifdef HAVE_SYS_ENDIAN_H
+#include <sys/endian.h>
+#endif
+#ifdef HAVE_LIBKERN_OSBYTEORDER_H
+#include <libkern/OSByteOrder.h>
+#endif
+
+"
+if test "x$ac_cv_have_decl_OSSwapInt16" = xyes; then :
+  ac_have_decl=1
+else
+  ac_have_decl=0
+fi
+
+cat >>confdefs.h <<_ACEOF
+#define HAVE_DECL_OSSWAPINT16 $ac_have_decl
+_ACEOF
+
+
+ac_fn_c_check_decl "$LINENO" "get_unaligned" "ac_cv_have_decl_get_unaligned" "
+#ifdef HAVE_ASM_UNALIGNED_H
+#include <asm/unaligned.h>
+#endif
+
+"
+if test "x$ac_cv_have_decl_get_unaligned" = xyes; then :
+  ac_have_decl=1
+else
+  ac_have_decl=0
+fi
+
+cat >>confdefs.h <<_ACEOF
+#define HAVE_DECL_GET_UNALIGNED $ac_have_decl
+_ACEOF
+ac_fn_c_check_decl "$LINENO" "put_unaligned" "ac_cv_have_decl_put_unaligned" "
+#ifdef HAVE_ASM_UNALIGNED_H
+#include <asm/unaligned.h>
+#endif
+
+"
+if test "x$ac_cv_have_decl_put_unaligned" = xyes; then :
+  ac_have_decl=1
+else
+  ac_have_decl=0
+fi
+
+cat >>confdefs.h <<_ACEOF
+#define HAVE_DECL_PUT_UNALIGNED $ac_have_decl
+_ACEOF
+
+
+if test "x$make_pybindings" = "xyes"; then
+  echo
+  echo "*** Configuring python bindings"
+  echo
+
+last_python=2.7
+first_python=2.3
+
+if test "x$SEQ" == "xnot found"; then
+  if test "x$JOT" == "xnot found"; then
+    python_prog_list="python python2"
+  else
+    python_prog_list="python python2     `$JOT -w 'python%.1f' - $last_python $first_python -0.1`" #'
+  fi
+else
+  python_prog_list="python python2   `$SEQ -f 'python%.1f' $last_python -0.1 $first_python`" #'
+fi
+
+
+# Check whether --with-python was given.
+if test "${with_python+set}" = set; then :
+  withval=$with_python;
+              case "${withval}" in
+                no) have_python="no" ;;
+                yes) user_python= ; have_python= ;;
+                *) user_python="${withval}"; have_python= ;;
+              esac
+
+else
+   user_python=; have_python=
+fi
+
+
+
+# Check whether --with-python-module-dir was given.
+if test "${with_python_module_dir+set}" = set; then :
+  withval=$with_python_module_dir;
+        case "${withval}" in
+          no) local_python_modpath= ;;
+          *) local_python_modpath="${withval}"
+        esac
+
+else
+   local_python_modpath=
+fi
+
+
+if test "x${have_python}" != "xno"; then
+
+if test "x$user_python" != "x"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $user_python version >= $first_python" >&5
+$as_echo_n "checking whether $user_python version >= $first_python... " >&6; }
+  prog="import sys
+# split strings by '.' and convert to numeric.  Append some zeros
+# because we need at least 4 digits for the hex conversion.
+# map returns an iterator in Python 3.0 and a list in 2.x
+minver = list(map(int, '$first_python'.split('.'))) + [0, 0, 0]
+minverhex = 0
+# xrange is not present in Python 3.0 and range returns an iterator
+for i in list(range(0, 4)): minverhex = (minverhex << 8) + minver[i]
+sys.exit(sys.hexversion < minverhex)"
+  if { echo "$as_me:$LINENO: $user_python -c "$prog"" >&5
+   ($user_python -c "$prog") >&5 2>&5
+   ac_status=$?
+   echo "$as_me:$LINENO: \$? = $ac_status" >&5
+   (exit $ac_status); }; then :
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+  PYTHON=$user_python
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+  PYTHON="not found"
+fi
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Python interpreter version >= $first_python" >&5
+$as_echo_n "checking for Python interpreter version >= $first_python... " >&6; }
+  PYTHON="not found"
+  for py in $python_prog_list; do
+  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for exec_ext in '' $ac_executable_extensions; do
+    if as_fn_executable_p "$as_dir/$py$exec_ext"; then
+      prog="import sys
+# split strings by '.' and convert to numeric.  Append some zeros
+# because we need at least 4 digits for the hex conversion.
+# map returns an iterator in Python 3.0 and a list in 2.x
+minver = list(map(int, '$first_python'.split('.'))) + [0, 0, 0]
+minverhex = 0
+# xrange is not present in Python 3.0 and range returns an iterator
+for i in list(range(0, 4)): minverhex = (minverhex << 8) + minver[i]
+sys.exit(sys.hexversion < minverhex)"
+  if { echo "$as_me:$LINENO: "$as_dir/$py$exec_ext" -c "$prog"" >&5
+   ("$as_dir/$py$exec_ext" -c "$prog") >&5 2>&5
+   ac_status=$?
+   echo "$as_me:$LINENO: \$? = $ac_status" >&5
+   (exit $ac_status); }; then :
+   PYTHON="$as_dir/$py$exec_ext"; break 3
+fi
+    fi
+  done
+  done
+IFS=$as_save_IFS
+
+  done
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PYTHON" >&5
+$as_echo "$PYTHON" >&6; }
+fi
+
+if test "x$PYTHON" = "xnot found"; then
+  have_python="no"
+  PYTHON=
+fi
+
+
+fi
+
+if test "x${have_python}" != "xno"; then
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking $PYTHON version" >&5
+$as_echo_n "checking $PYTHON version... " >&6; }
+PYTHON_VERSION=`$PYTHON -c "import sys; print sys.version[:3]"`
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $PYTHON_VERSION" >&5
+$as_echo "$PYTHON_VERSION" >&6; }
+
+if test -x $PYTHON-config; then
+  if test -n "$user_python"; then
+    python_exec_prefix=`$PYTHON-config --exec-prefix`
+    PYTHON_LIBS="-L${python_exec_prefix}/lib "
+  else
+    PYTHON_LIBS=""
+  fi
+  PYTHON_CPPFLAGS=`$PYTHON-config --includes 2>/dev/null`
+  PYTHON_LIBS="${PYTHON_LIBS}`$PYTHON-config --ldflags 2>/dev/null`"
+else
+  python_prefix=`$PYTHON -c "import sys; print sys.prefix"`
+  python_exec_prefix=`$PYTHON -c "import sys; print sys.exec_prefix"`
+  python_libdir=`$PYTHON -c "from distutils import sysconfig; print sysconfig.get_config_var('LIBDIR')"`
+  python_syslibs=`$PYTHON -c "from distutils import sysconfig; print sysconfig.get_config_var('SYSLIBS')"`
+  python_shlibs=`$PYTHON -c "from distutils import sysconfig; print sysconfig.get_config_var('SHLIBS')"`
+  python_modlibs=`$PYTHON -c "from distutils import sysconfig; print sysconfig.get_config_var('MODLIBS')"`
+
+  PYTHON_CPPFLAGS="-I${python_prefix}/include/python${PYTHON_VERSION} -I${python_exec_prefix}/include/python${PYTHON_VERSION}"
+  if test -n "$user_python"; then
+    PYTHON_LIBS="-L${python_libdir} "
+  else
+    PYTHON_LIBS=""
+  fi
+  PYTHON_LIBS="${PYTHON_LIBS}$python_syslibs $python_shlibs $python_modlibs -lpython${PYTHON_VERSION}"
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking Python includes" >&5
+$as_echo_n "checking Python includes... " >&6; }
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $PYTHON_CPPFLAGS" >&5
+$as_echo "$PYTHON_CPPFLAGS" >&6; }
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking Python libraries" >&5
+$as_echo_n "checking Python libraries... " >&6; }
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $PYTHON_LIBS" >&5
+$as_echo "$PYTHON_LIBS" >&6; }
+
+
+saved_CPPFLAGS=${CPPFLAGS}
+CPPFLAGS="${CPPFLAGS} ${PYTHON_CPPFLAGS}"
+for ac_header in Python.h
+do :
+  ac_fn_c_check_header_mongrel "$LINENO" "Python.h" "ac_cv_header_Python_h" "$ac_includes_default"
+if test "x$ac_cv_header_Python_h" = xyes; then :
+  cat >>confdefs.h <<_ACEOF
+#define HAVE_PYTHON_H 1
+_ACEOF
+
+else
+  have_python="no"
+fi
+
+done
+
+CPPFLAGS=${saved_CPPFLAGS}
+
+fi
+
+if test "x${have_python}" != "xno"; then
+
+pyexec_prefix=$exec_prefix
+test "x$pyexec_prefix" = xNONE && pyexec_prefix=$prefix
+test "x$pyexec_prefix" = xNONE && pyexec_prefix=$ac_default_prefix
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking Python extension module directory" >&5
+$as_echo_n "checking Python extension module directory... " >&6; }
+if test "x${local_python_modpath}" = "x"; then
+  pythondir=`$PYTHON -c "from distutils import sysconfig; print sysconfig.get_python_lib(1,0,prefix='${pyexec_prefix}')" 2>/dev/null || echo "${pyexec_prefix}/lib/python${PYTHON_VERSION}/site-packages"`
+else
+  pythondir=$local_python_modpath
+fi
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $pythondir" >&5
+$as_echo "$pythondir" >&6; }
+
+saved_CPPFLAGS=${CPPFLAGS}
+CPPFLAGS="${CPPFLAGS} ${PYTHON_CPPFLAGS}"
+saved_LIBS=$LIBS
+LIBS="$LIBS ${PYTHON_LIBS}"
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if we can compile a simple Python extension module" >&5
+$as_echo_n "checking if we can compile a simple Python extension module... " >&6; }
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+/* Override any GCC internal prototype to avoid an error.
+   Use char because int might match the return type of a GCC
+   builtin and then its argument prototype would still apply.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+char Py_Initialize ();
+#ifdef F77_DUMMY_MAIN
+
+#  ifdef __cplusplus
+     extern "C"
+#  endif
+   int F77_DUMMY_MAIN() { return 1; }
+
+#endif
+int
+main ()
+{
+return Py_Initialize ();
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+   { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+else
+   { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }; have_python="no"
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+CPPFLAGS=$saved_CPPFLAGS
+LIBS=$saved_LIBS
+
+fi
+
+  have_numpy="no"
+  if test "x$have_python" = "xno"; then
+    make_pybindings="no"
+  else
+    { $as_echo "$as_me:${as_lineno-$LINENO}: checking for NumPy" >&5
+$as_echo_n "checking for NumPy... " >&6; }
+    cat > conftest.py << EOF
+import sys
+try:
+  import numpy
+except ImportError:
+  sys.exit(1)
+EOF
+    if $PYTHON conftest.py > /dev/null 2>&1; then
+      have_numpy="yes"
+    fi
+    { $as_echo "$as_me:${as_lineno-$LINENO}: result: $have_numpy" >&5
+$as_echo "$have_numpy" >&6; }
+  fi
+  if test "x$have_numpy" = "xyes"; then
+    { $as_echo "$as_me:${as_lineno-$LINENO}: checking NumPy includes" >&5
+$as_echo_n "checking NumPy includes... " >&6; }
+    NUMPY_CPPFLAGS=-I`$PYTHON -c "import numpy; print numpy.get_include()"`
+    { $as_echo "$as_me:${as_lineno-$LINENO}: result: $NUMPY_CPPFLAGS" >&5
+$as_echo "$NUMPY_CPPFLAGS" >&6; }
+
+
+    saved_cppflags=$CPPFLAGS
+    CPPFLAGS="${CPPFLAGS} ${PYTHON_CPPFLAGS} ${NUMPY_CPPFLAGS}"
+    for ac_header in numpy/arrayobject.h
+do :
+  ac_fn_c_check_header_compile "$LINENO" "numpy/arrayobject.h" "ac_cv_header_numpy_arrayobject_h" "
+#include<Python.h>
 
 "
 if test "x$ac_cv_header_numpy_arrayobject_h" = xyes; then :
@@ -28544,6 +29602,18 @@ if test "x$make_idlbindings" = "xyes"; then
   echo
   echo "*** Configuring interactive data language (IDL) bindings"
   echo
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C99 is supported" >&5
+$as_echo_n "checking whether C99 is supported... " >&6; }
+  if test "x$disable_c99" = "xno"; then
+    { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+  else
+    { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+    make_idlbindings=no
+  fi
+fi
+if test "x$make_idlbindings" = "xyes"; then
 
 idl_min_version=5.5
 
@@ -28646,7 +29716,7 @@ do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
     for exec_ext in '' $ac_executable_extensions; do
-    if { test -f "$as_dir/$prog$exec_ext" && $as_test_x "$as_dir/$prog$exec_ext"; }; then
+    if as_fn_executable_p "$as_dir/$prog$exec_ext"; then
 
 idl_version_ok="no"
 idl_header=`( echo | "$as_dir/$prog$exec_ext" 2>&1 )` #''
@@ -28740,7 +29810,7 @@ $as_echo "$IDL_CFLAGS" >&6; }
 
 
 
-IDL_LIBS=`(echo 'print,"@@@"+!MAKE_DLL.LD' | $IDL 2>&1) | $GREP '@@@' | sed -e 's/@@@[^ ]* \(.*\?\) -o.*/\1/' | sed -e 's/-m /-m/g'`
+IDL_LIBS=`(echo 'print,"@@@"+!MAKE_DLL.LD' | $IDL 2>&1) | $GREP '@@@' | sed -e 's/@@@[^ ]* \(.*\?\) -o.*/\1/' | sed -e 's/-m \?\w*//g'`
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking IDL linker flags" >&5
 $as_echo_n "checking IDL linker flags... " >&6; }
 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $IDL_LIBS" >&5
@@ -28769,27 +29839,386 @@ fi
 
   if test "x$have_idl" = "xno"; then
     make_idlbindings="no"
+  fi
+fi
+
+if test "x$make_perlbindings" = "xyes"; then
+  echo
+  echo "*** Configuring Perl bindings"
+  echo
+
+first_perl=5.8.0
+perl_prog_list="perl perl5 \
+perl5.14 perl5.12 perl5.10 perl5.8 \
+perl5.14.0 \
+perl5.12.3 perl5.12.2 perl5.12.1 perl5.12.0 \
+perl5.10.1 perl5.10.0 \
+perl5.8.9 perl5.8.8 perl5.8.7 perl5.8.6 perl5.8.5 perl5.8.4 perl5.8.3 \
+perl5.8.2 perl5.8.1 perl5.8.0"
+
+
+# Check whether --with-perl was given.
+if test "${with_perl+set}" = set; then :
+  withval=$with_perl;
+              case "${withval}" in
+                no) have_perl="no" ;;
+                yes) user_perl= ; have_perl= ;;
+                *) user_perl="${withval}"; have_perl= ;;
+              esac
+
+else
+   user_perl=; have_perl=
+fi
+
+
+if test "x${have_perl}" != "xno"; then
+
+    if test "x$user_perl" != "x"; then
+    { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $user_perl version >= $first_perl" >&5
+$as_echo_n "checking whether $user_perl version >= $first_perl... " >&6; }
+
+perl_version_ok="no"
+
+perl_int=$user_perl
+# 3=$user_perl
+PERL_VERSION=`$perl_int -V::version: | sed -e "s/'//g" | sed -e "s/ \t*$//"`
+
+
+
+
+  # Used to indicate true or false condition
+  ax_compare_version=false
+
+  # Convert the two version strings to be compared into a format that
+  # allows a simple string comparison.  The end result is that a version
+  # string of the form 1.12.5-r617 will be converted to the form
+  # 0001001200050617.  In other words, each number is zero padded to four
+  # digits, and non digits are removed.
+
+  ax_compare_version_A=`echo "$PERL_VERSION" | sed -e 's/\([0-9]*\)/Z\1Z/g' \
+                     -e 's/Z\([0-9]\)Z/Z0\1Z/g' \
+                     -e 's/Z\([0-9][0-9]\)Z/Z0\1Z/g' \
+                     -e 's/Z\([0-9][0-9][0-9]\)Z/Z0\1Z/g' \
+                     -e 's/[^0-9]//g'`
+
+
+  ax_compare_version_B=`echo "$first_perl" | sed -e 's/\([0-9]*\)/Z\1Z/g' \
+                     -e 's/Z\([0-9]\)Z/Z0\1Z/g' \
+                     -e 's/Z\([0-9][0-9]\)Z/Z0\1Z/g' \
+                     -e 's/Z\([0-9][0-9][0-9]\)Z/Z0\1Z/g' \
+                     -e 's/[^0-9]//g'`
+
+
+    ax_compare_version=`echo "x$ax_compare_version_A
+x$ax_compare_version_B" | sed 's/^ *//' | sort -r | sed "s/x${ax_compare_version_A}/true/;s/x${ax_compare_version_B}/false/;1q"`
+
+
+
+    if test "$ax_compare_version" = "true" ; then
+    perl_version_ok="yes"
+      fi
+
+if test "x$perl_version_ok" = "xyes"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+    PERL=$user_perl
+  true
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+    PERL="not found"
+  true
+fi
+
   else
-        for ac_prog in date
+    { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Perl interpreter version >= $first_perl" >&5
+$as_echo_n "checking for Perl interpreter version >= $first_perl... " >&6; }
+    PERL="not found"
+    for perl in $perl_prog_list; do
+    as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
 do
-  # Extract the first word of "$ac_prog", so it can be a program name with args.
-set dummy $ac_prog; ac_word=$2
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for exec_ext in '' $ac_executable_extensions; do
+      if as_fn_executable_p "$as_dir/$perl$exec_ext"; then
+
+perl_version_ok="no"
+
+perl_int="$as_dir/$perl$exec_ext"
+# 3="$as_dir/$perl$exec_ext"
+PERL_VERSION=`$perl_int -V::version: | sed -e "s/'//g" | sed -e "s/ \t*$//"`
+
+
+
+
+  # Used to indicate true or false condition
+  ax_compare_version=false
+
+  # Convert the two version strings to be compared into a format that
+  # allows a simple string comparison.  The end result is that a version
+  # string of the form 1.12.5-r617 will be converted to the form
+  # 0001001200050617.  In other words, each number is zero padded to four
+  # digits, and non digits are removed.
+
+  ax_compare_version_A=`echo "$PERL_VERSION" | sed -e 's/\([0-9]*\)/Z\1Z/g' \
+                     -e 's/Z\([0-9]\)Z/Z0\1Z/g' \
+                     -e 's/Z\([0-9][0-9]\)Z/Z0\1Z/g' \
+                     -e 's/Z\([0-9][0-9][0-9]\)Z/Z0\1Z/g' \
+                     -e 's/[^0-9]//g'`
+
+
+  ax_compare_version_B=`echo "$first_perl" | sed -e 's/\([0-9]*\)/Z\1Z/g' \
+                     -e 's/Z\([0-9]\)Z/Z0\1Z/g' \
+                     -e 's/Z\([0-9][0-9]\)Z/Z0\1Z/g' \
+                     -e 's/Z\([0-9][0-9][0-9]\)Z/Z0\1Z/g' \
+                     -e 's/[^0-9]//g'`
+
+
+    ax_compare_version=`echo "x$ax_compare_version_A
+x$ax_compare_version_B" | sed 's/^ *//' | sort -r | sed "s/x${ax_compare_version_A}/true/;s/x${ax_compare_version_B}/false/;1q"`
+
+
+
+    if test "$ax_compare_version" = "true" ; then
+    perl_version_ok="yes"
+      fi
+
+if test "x$perl_version_ok" = "xyes"; then
+   PERL="$as_dir/$perl$exec_ext"; break 3
+  true
+else
+
+  true
+fi
+
+      fi
+    done
+  done
+IFS=$as_save_IFS
+
+    done
+    { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PERL" >&5
+$as_echo "$PERL" >&6; }
+  fi
+
+  if test "x$PERL" = "xnot found"; then
+    have_perl="no"
+    PERL=
+  fi
+
+
+  fi
+
+  if test "x${have_perl}" != "xno"; then
+    { $as_echo "$as_me:${as_lineno-$LINENO}: checking $PERL version" >&5
+$as_echo_n "checking $PERL version... " >&6; }
+
+perl_int=$PERL
+# 3=
+PERL_VERSION=`$perl_int -V::version: | sed -e "s/'//g" | sed -e "s/ \t*$//"`
+
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PERL_VERSION" >&5
+$as_echo "$PERL_VERSION" >&6; }
+
+fi
+
+
+# Check whether --with-perl-dir was given.
+if test "${with_perl_dir+set}" = set; then :
+  withval=$with_perl_dir;
+    case "${withval}" in
+    vendor|site) perl_inst_type="${withval}" ;;
+    no) perl_inst_type="site" ;;
+    *) perl_inst_type="local"; local_perl_path="${withval}" ;;
+    esac
+
+else
+   perl_inst_type="site"
+fi
+
+
+if test "x${have_perl}" != "xno"; then
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for Math::Complex" >&5
+$as_echo_n "checking for Math::Complex... " >&6; }
+if $PERL -MMath::Complex -e 'exit' > /dev/null 2>&1; then
+  HAVE_Math__Complex=yes
+else
+  HAVE_Math__Complex=no
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: ${HAVE_Math__Complex}" >&5
+$as_echo "${HAVE_Math__Complex}" >&6; }
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for Module::Build" >&5
+$as_echo_n "checking for Module::Build... " >&6; }
+if $PERL -MModule::Build -e 'exit' > /dev/null 2>&1; then
+  HAVE_Module__Build=yes
+else
+  HAVE_Module__Build=no
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: ${HAVE_Module__Build}" >&5
+$as_echo "${HAVE_Module__Build}" >&6; }
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for Test::Harness" >&5
+$as_echo_n "checking for Test::Harness... " >&6; }
+if $PERL -MTest::Harness -e 'exit' > /dev/null 2>&1; then
+  HAVE_Test__Harness=yes
+else
+  HAVE_Test__Harness=no
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: ${HAVE_Test__Harness}" >&5
+$as_echo "${HAVE_Test__Harness}" >&6; }
+
+fi
+
+if test "$HAVE_Math__Complex$HAVE_Module__Build" != "yesyes"; then
+  have_perl=no
+fi
+
+if test "x${have_perl}" != "xno"; then
+
+    { $as_echo "$as_me:${as_lineno-$LINENO}: checking Perl module directory" >&5
+$as_echo_n "checking Perl module directory... " >&6; }
+  if test $perl_inst_type = "vendor"; then
+
+perl_int=$PERL
+# 3=
+perldir=`$perl_int -V::vendorarchexp: | sed -e "s/'//g" | sed -e "s/ \t*$//"`
+
+
+perl_int=$PERL
+# 3=
+perlmandir=`$perl_int -V::vendorman3direxp: | sed -e "s/'//g" | sed -e "s/ \t*$//"`
+
+    if test perldir = "UNKNOWN"; then
+      perl_inst_type = "site";
+    fi
+  fi
+
+  if test $perl_inst_type = "site"; then
+
+perl_int=$PERL
+# 3=
+perldir=`$perl_int -V::sitearchexp: | sed -e "s/'//g" | sed -e "s/ \t*$//"`
+
+
+perl_int=$PERL
+# 3=
+perlmandir=`$perl_int -V::siteman3direxp: | sed -e "s/'//g" | sed -e "s/ \t*$//"`
+
+  elif test $perl_inst_type != "vendor"; then
+    perldir="${local_perl_path}"
+    perlmandir="${man3dir}"
+  fi
+
+  if test $perlmandir = "UNKNOWN"; then
+    perlmandir="${mandir}"
+  fi
+
+
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $perldir" >&5
+$as_echo "$perldir" >&6; }
+
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking Perl man directory" >&5
+$as_echo_n "checking Perl man directory... " >&6; }
+
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $perlmandir" >&5
+$as_echo "$perlmandir" >&6; }
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for the section 3 manual page extension" >&5
+$as_echo_n "checking for the section 3 manual page extension... " >&6; }
+PERL_MAN3EXT=`$PERL -MModule::Build -e 'print "\n>>GD ", Module::Build->new(module_name=>"conftest",dist_version=>0)->config('man3ext'), " GD<<";' | $AWK '/>>GD .* GD<</ { print $2 }'`
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: .$PERL_MAN3EXT" >&5
+$as_echo ".$PERL_MAN3EXT" >&6; }
+
+
+fi
+
+  if test "x$have_perl" = "xno"; then
+    make_perlbindings=no
+  fi
+fi
+
+if test "x$make_matlabbindings" = "xyes"; then
+  echo
+  echo "*** Configuring MATLAB bindings"
+  echo
+
+
+# Check whether --with-matlab was given.
+if test "${with_matlab+set}" = set; then :
+  withval=$with_matlab;
+              case "${withval}" in
+                no) have_matlab="no" ;;
+                yes) user_matlab= ; have_matlab= ;;
+                *) user_matlab="${withval}"; have_matlab= ;;
+              esac
+
+else
+   user_matlab=; have_matlab=
+fi
+
+
+if test "x${have_matlab}" != "xno"; then
+
+
+# Check whether --with-mex was given.
+if test "${with_mex+set}" = set; then :
+  withval=$with_mex;
+              case "${withval}" in
+                no) have_matlab="no" ;;
+                yes) user_mex= ;;
+                *) user_mex="${withval}";;
+              esac
+
+else
+   user_mex=
+fi
+
+
+MEX="not found"
+if test "x$user_mex" != "x"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $user_mex is a MATLAB mex compiler" >&5
+$as_echo_n "checking if $user_mex is a MATLAB mex compiler... " >&6; }
+  mex_out=`$user_mex 2>&1`
+  mex_status=$?
+  if test $mex_status -eq 1; then
+    if echo $mex_out | grep -q 'consult the MATLAB External Interfaces Guide'; then
+      MEX=$user_mex
+    fi
+  fi
+  if test "x$MEX" = "xnot found"; then
+    { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+  else
+    { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+  fi
+else
+  # Extract the first word of "mex", so it can be a program name with args.
+set dummy mex; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_prog_DATE+:} false; then :
+if ${ac_cv_path_MEX+:} false; then :
   $as_echo_n "(cached) " >&6
 else
-  if test -n "$DATE"; then
-  ac_cv_prog_DATE="$DATE" # Let the user override the test.
-else
-as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+  case $MEX in
+  [\\/]* | ?:[\\/]*)
+  ac_cv_path_MEX="$MEX" # Let the user override the test with a path.
+  ;;
+  *)
+  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
 for as_dir in $PATH
 do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
     for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
-    ac_cv_prog_DATE="$ac_prog"
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_path_MEX="$as_dir/$ac_word$ac_exec_ext"
     $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
   fi
@@ -28797,28 +30226,143 @@ done
   done
 IFS=$as_save_IFS
 
+  test -z "$ac_cv_path_MEX" && ac_cv_path_MEX="not found"
+  ;;
+esac
 fi
+MEX=$ac_cv_path_MEX
+if test -n "$MEX"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MEX" >&5
+$as_echo "$MEX" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
 fi
-DATE=$ac_cv_prog_DATE
-if test -n "$DATE"; then
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DATE" >&5
-$as_echo "$DATE" >&6; }
+
+
+fi
+
+if test "x$MEX" = "xnot found"; then
+  have_matlab="no"
+  MEX=
+fi
+
+
+fi
+
+if test "x${have_matlab}" != "xno"; then
+    MATLAB="not found"
+  if test "x$user_matlab" != "x"; then
+    { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $user_matlab is a MATLAB interpreter" >&5
+$as_echo_n "checking if $user_matlab is a MATLAB interpreter... " >&6; }
+
+matlab_int=$user_matlab
+matlab_ver=`$matlab_int -nodisplay -nosplash -nojvm -nodesktop -r "fprintf(2, '@@@%s@@@\n', version); quit" 2>&1 >/dev/null | ${AWK} 'BEGIN { FS="@@@" } /^@@@/ { print $2 }'`
+
+    if test "x$matlab_ver" = "x"; then
+      { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+    else
+      { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+      MATLAB=$user_matlab
+      MATLAB_VERSION=$matlab_ver
+    fi
+  else
+    # Extract the first word of "matlab", so it can be a program name with args.
+set dummy matlab; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_path_MATLAB+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  case $MATLAB in
+  [\\/]* | ?:[\\/]*)
+  ac_cv_path_MATLAB="$MATLAB" # Let the user override the test with a path.
+  ;;
+  *)
+  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_path_MATLAB="$as_dir/$ac_word$ac_exec_ext"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+  test -z "$ac_cv_path_MATLAB" && ac_cv_path_MATLAB="not found"
+  ;;
+esac
+fi
+MATLAB=$ac_cv_path_MATLAB
+if test -n "$MATLAB"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MATLAB" >&5
+$as_echo "$MATLAB" >&6; }
 else
   { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
 $as_echo "no" >&6; }
 fi
 
 
-  test -n "$DATE" && break
-done
-test -n "$DATE" || DATE="not found"
+  fi
+
+  if test "x$MATLAB" = "xnot found"; then
+    have_matlab=no
+    MATLAB=
+  fi
+
+fi
+
+if test "x${have_matlab}" != "xno"; then
+    default_matlabbasedir=$libdir/getdata/matlab
+
+# Check whether --with-matlab-dir was given.
+if test "${with_matlab_dir+set}" = set; then :
+  withval=$with_matlab_dir;
+      case "${withval}" in
+      no) matlabbasedir=$default_matlabbasedir ;;
+      *) matlabbasedir="${withval}" ;;
+      esac
+
+else
+   matlabbasedir=$default_matlabbasedir
+fi
+
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking matlab install directory" >&5
+$as_echo_n "checking matlab install directory... " >&6; }
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $matlabbasedir" >&5
+$as_echo "$matlabbasedir" >&6; }
+
+
+    { $as_echo "$as_me:${as_lineno-$LINENO}: checking MEX extension" >&5
+$as_echo_n "checking MEX extension... " >&6; }
+
+matlab_int=$MATLAB
+mexext=`$matlab_int -nodisplay -nosplash -nojvm -nodesktop -r "fprintf(2, '@@@%s@@@\n', mexext); quit" 2>&1 >/dev/null | ${AWK} 'BEGIN { FS="@@@" } /^@@@/ { print $2 }'`
+
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: .$mexext" >&5
+$as_echo ".$mexext" >&6; }
 
-    if test "x$DATE" == "xnot found"; then
-      BUILD_DATE="Build date unspecified"
-    else
-      BUILD_DATE=`$DATE`
-    fi
 
+    { $as_echo "$as_me:${as_lineno-$LINENO}: checking MatLab CPPFLAGS" >&5
+$as_echo_n "checking MatLab CPPFLAGS... " >&6; }
+
+matlab_prefix=`$MEX -v 2>/dev/null | ${AWK} '/MATLAB *=/ { print $4 }'`
+
+  MATLAB_CPPFLAGS="-I${matlab_prefix}/extern/include"
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MATLAB_CPPFLAGS" >&5
+$as_echo "$MATLAB_CPPFLAGS" >&6; }
+
+fi
+
+  if test "x$have_matlab" = "xno"; then
+    make_matlabbindings=no
   fi
 fi
 
@@ -28902,11 +30446,14 @@ fi
 $as_echo "$ac_cv_lib_bz2_BZ2_bzReadOpen" >&6; }
 if test "x$ac_cv_lib_bz2_BZ2_bzReadOpen" = xyes; then :
   have_this_lib=yes
+  LIBS="$LIBS -lbz2"
 
 $as_echo "#define HAVE_LIBBZ2 1" >>confdefs.h
 
 fi
 
+
+
   LDFLAGS=$saved_ldflags
   LIBS=$saved_libs
 
@@ -28931,13 +30478,15 @@ fi
 
 BZIP2_CPPFLAGS=
 BZIP2_LDFLAGS=
+BZIP2_LIBS=
 if test "x$have_this_header" = "xyes" -a "x$have_this_lib" = "xyes"; then
   if test "x$bzip2_prefix" = "x"; then
-    BZIP2_LDFLAGS="-lbz2"
+    BZIP2_LIBS="-lbz2"
     BZIP2_SEARCHPATH="$PATH"
   else
     BZIP2_CPPFLAGS="-I$bzip2_prefix/include"
-    BZIP2_LDFLAGS="-L$bzip2_prefix/lib -lbz2"
+    BZIP2_LDFLAGS="-L$bzip2_prefix/lib"
+    BZIP2_LIBS="-lbz2"
     BZIP2_SEARCHPATH="$bzip2_prefix/bin:$PATH"
   fi
 
@@ -28951,6 +30500,7 @@ fi
 
 
 
+
 for ac_prog in bzip2
 do
   # Extract the first word of "$ac_prog", so it can be a program name with args.
@@ -28971,7 +30521,7 @@ do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
     for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
     ac_cv_path_path_bzip2="$as_dir/$ac_word$ac_exec_ext"
     $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
@@ -29028,7 +30578,7 @@ do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
     for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
     ac_cv_path_path_bunzip2="$as_dir/$ac_word$ac_exec_ext"
     $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
@@ -29063,7 +30613,6 @@ _ACEOF
 
 fi
 
-
  if test "x$use_bzip2" = "xyes"; then
   USE_BZIP2_TRUE=
   USE_BZIP2_FALSE='#'
@@ -29086,9 +30635,9 @@ if test "x$use_bzip2" != "xno"; then
   else
     ENCODINGS_BUILT="${ENCODINGS_BUILT} bzip2";
     if test -z "$PRIVATE_LIBS"; then
-      PRIVATE_LIBS="$BZIP2_LDFLAGS"
+      PRIVATE_LIBS="$BZIP2_LDFLAGS $BZIP2_LIBS"
     else
-      PRIVATE_LIBS="$PRIVATE_LIBS $BZIP2_LDFLAGS"
+      PRIVATE_LIBS="$BZIP2_LDFLAGS $PRIVATE_LIBS $BZIP2_LIBS"
     fi
   fi
 else
@@ -29100,6 +30649,506 @@ have_this_header=
 have_this_lib=
 
 
+# Check whether --with-libz was given.
+if test "${with_libz+set}" = set; then :
+  withval=$with_libz;
+             case "${withval}" in
+               no) use_gzip="no" ;;
+               yes) use_gzip="yes"; gzip_prefix= ;;
+               *) use_gzip="yes"; gzip_prefix="${withval}" ;;
+             esac
+
+else
+   use_gzip="yes"; gzip_prefix=;
+fi
+
+
+
+echo
+echo "*** Configuring gzip support"
+echo
+
+if test "x$no_extern" = "xyes"; then
+  use_gzip="no";
+fi
+
+if test "x$use_gzip" = "xyes"; then
+    saved_ldflags=$LDFLAGS
+  saved_libs=$LIBS
+  if test "x$gzip_prefix" != "x"; then
+    LDFLAGS="$LDFLAGS -L$gzip_prefix/lib"
+  fi
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for gzopen in -lz" >&5
+$as_echo_n "checking for gzopen in -lz... " >&6; }
+if ${ac_cv_lib_z_gzopen+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-lz  $LIBS"
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+/* Override any GCC internal prototype to avoid an error.
+   Use char because int might match the return type of a GCC
+   builtin and then its argument prototype would still apply.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+char gzopen ();
+#ifdef F77_DUMMY_MAIN
+
+#  ifdef __cplusplus
+     extern "C"
+#  endif
+   int F77_DUMMY_MAIN() { return 1; }
+
+#endif
+int
+main ()
+{
+return gzopen ();
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+  ac_cv_lib_z_gzopen=yes
+else
+  ac_cv_lib_z_gzopen=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_z_gzopen" >&5
+$as_echo "$ac_cv_lib_z_gzopen" >&6; }
+if test "x$ac_cv_lib_z_gzopen" = xyes; then :
+  have_this_lib=yes
+  LIBS="$LIBS -lz"
+
+$as_echo "#define HAVE_LIBZ 1" >>confdefs.h
+
+fi
+
+
+
+  LDFLAGS=$saved_ldflags
+  LIBS=$saved_libs
+
+  saved_cppflags=$CPPFLAGS
+  if test "x$gzip_prefix" != "x"; then
+    CPPFLAGS="$CPPFLAGS -I$gzip_prefix/include"
+  fi
+  for ac_header in zlib.h
+do :
+  ac_fn_c_check_header_mongrel "$LINENO" "zlib.h" "ac_cv_header_zlib_h" "$ac_includes_default"
+if test "x$ac_cv_header_zlib_h" = xyes; then :
+  cat >>confdefs.h <<_ACEOF
+#define HAVE_ZLIB_H 1
+_ACEOF
+ have_this_header=yes
+fi
+
+done
+
+  CPPFLAGS=$saved_cppflags
+fi
+
+GZIP_CPPFLAGS=
+GZIP_LDFLAGS=
+GZIP_LIBS=
+if test "x$have_this_header" = "xyes" -a "x$have_this_lib" = "xyes"; then
+  if test "x$gzip_prefix" = "x"; then
+    GZIP_LIBS="-lz"
+    GZIP_SEARCHPATH="$PATH"
+  else
+    GZIP_CPPFLAGS="-I$gzip_prefix/include"
+    GZIP_LDFLAGS="-L$gzip_prefix/lib"
+    GZIP_LIBS="-lz"
+    GZIP_SEARCHPATH="$gzip_prefix/bin:$PATH"
+  fi
+
+$as_echo "#define USE_GZIP /**/" >>confdefs.h
+
+else
+  use_gzip="no";
+  GZIP_SEARCHPATH="$PATH"
+fi
+
+
+
+
+
+for ac_prog in gzip
+do
+  # Extract the first word of "$ac_prog", so it can be a program name with args.
+set dummy $ac_prog; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_path_path_gzip+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  case $path_gzip in
+  [\\/]* | ?:[\\/]*)
+  ac_cv_path_path_gzip="$path_gzip" # Let the user override the test with a path.
+  ;;
+  *)
+  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $GZIP_SEARCHPATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_path_path_gzip="$as_dir/$ac_word$ac_exec_ext"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+  ;;
+esac
+fi
+path_gzip=$ac_cv_path_path_gzip
+if test -n "$path_gzip"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $path_gzip" >&5
+$as_echo "$path_gzip" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+  test -n "$path_gzip" && break
+done
+test -n "$path_gzip" || path_gzip="not found"
+
+
+if test "x$path_gzip" != "xnot found"; then
+
+cat >>confdefs.h <<_ACEOF
+#define GZIP "$path_gzip"
+_ACEOF
+
+fi
+
+
+
+for ac_prog in gunzip
+do
+  # Extract the first word of "$ac_prog", so it can be a program name with args.
+set dummy $ac_prog; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_path_path_gunzip+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  case $path_gunzip in
+  [\\/]* | ?:[\\/]*)
+  ac_cv_path_path_gunzip="$path_gunzip" # Let the user override the test with a path.
+  ;;
+  *)
+  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $GZIP_SEARCHPATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_path_path_gunzip="$as_dir/$ac_word$ac_exec_ext"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+  ;;
+esac
+fi
+path_gunzip=$ac_cv_path_path_gunzip
+if test -n "$path_gunzip"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $path_gunzip" >&5
+$as_echo "$path_gunzip" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+  test -n "$path_gunzip" && break
+done
+test -n "$path_gunzip" || path_gunzip="not found"
+
+
+if test "x$path_gunzip" != "xnot found"; then
+
+cat >>confdefs.h <<_ACEOF
+#define GUNZIP "$path_gunzip"
+_ACEOF
+
+fi
+
+ if test "x$use_gzip" = "xyes"; then
+  USE_GZIP_TRUE=
+  USE_GZIP_FALSE='#'
+else
+  USE_GZIP_TRUE='#'
+  USE_GZIP_FALSE=
+fi
+
+
+if test "x$path_gzip" != "xnot found" -a \
+  "x$path_gunzip" != "xnot found"; then
+
+$as_echo "#define TEST_GZIP /**/" >>confdefs.h
+
+fi
+
+if test "x$use_gzip" != "xno"; then
+  if test "x$use_modules" != "xno"; then
+    ENCODINGS_MODS="${ENCODINGS_MODS} gzip";
+  else
+    ENCODINGS_BUILT="${ENCODINGS_BUILT} gzip";
+    if test -z "$PRIVATE_LIBS"; then
+      PRIVATE_LIBS="$GZIP_LDFLAGS $GZIP_LIBS"
+    else
+      PRIVATE_LIBS="$GZIP_LDFLAGS $PRIVATE_LIBS $GZIP_LIBS"
+    fi
+  fi
+else
+  ENCODINGS_LEFT="${ENCODINGS_LEFT} gzip";
+fi
+
+
+have_this_header=
+have_this_lib=
+
+
+# Check whether --with-liblzma was given.
+if test "${with_liblzma+set}" = set; then :
+  withval=$with_liblzma;
+             case "${withval}" in
+               no) use_lzma="no" ;;
+               yes) use_lzma="yes"; lzma_prefix= ;;
+               *) use_lzma="yes"; lzma_prefix="${withval}" ;;
+             esac
+
+else
+   use_lzma="yes"; lzma_prefix=;
+fi
+
+
+
+echo
+echo "*** Configuring lzma support"
+echo
+
+if test "x$no_extern" = "xyes"; then
+  use_lzma="no";
+fi
+
+if test "x$use_lzma" = "xyes"; then
+    saved_ldflags=$LDFLAGS
+  saved_libs=$LIBS
+  if test "x$lzma_prefix" != "x"; then
+    LDFLAGS="$LDFLAGS -L$lzma_prefix/lib"
+  fi
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for lzma_auto_decoder in -llzma" >&5
+$as_echo_n "checking for lzma_auto_decoder in -llzma... " >&6; }
+if ${ac_cv_lib_lzma_lzma_auto_decoder+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-llzma  $LIBS"
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+/* Override any GCC internal prototype to avoid an error.
+   Use char because int might match the return type of a GCC
+   builtin and then its argument prototype would still apply.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+char lzma_auto_decoder ();
+#ifdef F77_DUMMY_MAIN
+
+#  ifdef __cplusplus
+     extern "C"
+#  endif
+   int F77_DUMMY_MAIN() { return 1; }
+
+#endif
+int
+main ()
+{
+return lzma_auto_decoder ();
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+  ac_cv_lib_lzma_lzma_auto_decoder=yes
+else
+  ac_cv_lib_lzma_lzma_auto_decoder=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_lzma_lzma_auto_decoder" >&5
+$as_echo "$ac_cv_lib_lzma_lzma_auto_decoder" >&6; }
+if test "x$ac_cv_lib_lzma_lzma_auto_decoder" = xyes; then :
+  have_this_lib=yes
+  LIBS="$LIBS -llzma"
+
+$as_echo "#define HAVE_LIBLZMA 1" >>confdefs.h
+
+fi
+
+
+
+  LDFLAGS=$saved_ldflags
+  LIBS=$saved_libs
+
+  saved_cppflags=$CPPFLAGS
+  if test "x$lzma_prefix" != "x"; then
+    CPPFLAGS="$CPPFLAGS -I$lzma_prefix/include"
+  fi
+  for ac_header in lzma.h
+do :
+  ac_fn_c_check_header_mongrel "$LINENO" "lzma.h" "ac_cv_header_lzma_h" "$ac_includes_default"
+if test "x$ac_cv_header_lzma_h" = xyes; then :
+  cat >>confdefs.h <<_ACEOF
+#define HAVE_LZMA_H 1
+_ACEOF
+ have_this_header=yes
+fi
+
+done
+
+  CPPFLAGS=$saved_cppflags
+fi
+
+LZMA_CPPFLAGS=
+LZMA_LDFLAGS=
+LZMA_LIBS=
+if test "x$have_this_header" = "xyes" -a "x$have_this_lib" = "xyes"; then
+  if test "x$lzma_prefix" = "x"; then
+    LZMA_LIBS="-llzma"
+    LZMA_SEARCHPATH="$PATH"
+  else
+    LZMA_CPPFLAGS="-I$lzma_prefix/include"
+    LZMA_LDFLAGS="-L$lzma_prefix/lib"
+    LZMA_LIBS="-llzma"
+    LZMA_SEARCHPATH="$lzma_prefix/bin:$PATH"
+  fi
+
+$as_echo "#define USE_LZMA /**/" >>confdefs.h
+
+else
+  use_lzma="no";
+  LZMA_SEARCHPATH="$PATH"
+fi
+
+
+
+
+
+for ac_prog in xz
+do
+  # Extract the first word of "$ac_prog", so it can be a program name with args.
+set dummy $ac_prog; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_path_path_xz+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  case $path_xz in
+  [\\/]* | ?:[\\/]*)
+  ac_cv_path_path_xz="$path_xz" # Let the user override the test with a path.
+  ;;
+  *)
+  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $LZMA_SEARCHPATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_path_path_xz="$as_dir/$ac_word$ac_exec_ext"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+  ;;
+esac
+fi
+path_xz=$ac_cv_path_path_xz
+if test -n "$path_xz"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $path_xz" >&5
+$as_echo "$path_xz" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+  test -n "$path_xz" && break
+done
+test -n "$path_xz" || path_xz="not found"
+
+
+if test "x$path_xz" != "xnot found"; then
+
+cat >>confdefs.h <<_ACEOF
+#define XZ "$path_xz"
+_ACEOF
+
+fi
+
+
+ if test "x$use_lzma" = "xyes"; then
+  USE_LZMA_TRUE=
+  USE_LZMA_FALSE='#'
+else
+  USE_LZMA_TRUE='#'
+  USE_LZMA_FALSE=
+fi
+
+
+if test "x$path_xz" != "xnot found" -a \
+  "x$path_gunzip" != "xnot found"; then
+
+$as_echo "#define TEST_LZMA /**/" >>confdefs.h
+
+fi
+
+if test "x$use_lzma" != "xno"; then
+  if test "x$use_modules" != "xno"; then
+    ENCODINGS_MODS="${ENCODINGS_MODS} lzma";
+  else
+    ENCODINGS_BUILT="${ENCODINGS_BUILT} lzma";
+    if test -z "$PRIVATE_LIBS"; then
+      PRIVATE_LIBS="$LZMA_LDFLAGS $LZMA_LIBS"
+    else
+      PRIVATE_LIBS="$LZMA_LDFLAGS $PRIVATE_LIBS $LZMA_LIBS"
+    fi
+  fi
+else
+  ENCODINGS_LEFT="${ENCODINGS_LEFT} lzma";
+fi
+
+
+have_this_header=
+have_this_lib=
+
+
 # Check whether --with-libslim was given.
 if test "${with_libslim+set}" = set; then :
   withval=$with_libslim;
@@ -29175,11 +31224,26 @@ fi
 $as_echo "$ac_cv_lib_slim_slimopen" >&6; }
 if test "x$ac_cv_lib_slim_slimopen" = xyes; then :
   have_this_lib=yes
+  LIBS="$LIBS -lslim"
 
 $as_echo "#define HAVE_LIBSLIM 1" >>confdefs.h
 
 fi
 
+
+
+  for ac_func in slimdopen
+do :
+  ac_fn_c_check_func "$LINENO" "slimdopen" "ac_cv_func_slimdopen"
+if test "x$ac_cv_func_slimdopen" = xyes; then :
+  cat >>confdefs.h <<_ACEOF
+#define HAVE_SLIMDOPEN 1
+_ACEOF
+
+fi
+done
+
+
   LDFLAGS=$saved_ldflags
   LIBS=$saved_libs
 
@@ -29204,13 +31268,15 @@ fi
 
 SLIM_CPPFLAGS=
 SLIM_LDFLAGS=
+SLIM_LIBS=
 if test "x$have_this_header" = "xyes" -a "x$have_this_lib" = "xyes"; then
   if test "x$slim_prefix" = "x"; then
-    SLIM_LDFLAGS="-lslim"
+    SLIM_LIBS="-lslim"
     SLIM_SEARCHPATH="$PATH"
   else
     SLIM_CPPFLAGS="-I$slim_prefix/include"
-    SLIM_LDFLAGS="-L$slim_prefix/lib -lslim"
+    SLIM_LDFLAGS="-L$slim_prefix/lib"
+    SLIM_LIBS="-lslim"
     SLIM_SEARCHPATH="$slim_prefix/bin:$PATH"
   fi
 
@@ -29224,6 +31290,7 @@ fi
 
 
 
+
 for ac_prog in slim slimdata
 do
   # Extract the first word of "$ac_prog", so it can be a program name with args.
@@ -29244,7 +31311,7 @@ do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
     for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
     ac_cv_path_path_slim="$as_dir/$ac_word$ac_exec_ext"
     $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
@@ -29301,7 +31368,7 @@ do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
     for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
     ac_cv_path_path_unslim="$as_dir/$ac_word$ac_exec_ext"
     $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
@@ -29336,7 +31403,6 @@ _ACEOF
 
 fi
 
-
  if test "x$use_slim" = "xyes"; then
   USE_SLIM_TRUE=
   USE_SLIM_FALSE='#'
@@ -29359,9 +31425,9 @@ if test "x$use_slim" != "xno"; then
   else
     ENCODINGS_BUILT="${ENCODINGS_BUILT} slim";
     if test -z "$PRIVATE_LIBS"; then
-      PRIVATE_LIBS="$SLIM_LDFLAGS"
+      PRIVATE_LIBS="$SLIM_LDFLAGS $SLIM_LIBS"
     else
-      PRIVATE_LIBS="$PRIVATE_LIBS $SLIM_LDFLAGS"
+      PRIVATE_LIBS="$SLIM_LDFLAGS $PRIVATE_LIBS $SLIM_LIBS"
     fi
   fi
 else
@@ -29373,42 +31439,42 @@ have_this_header=
 have_this_lib=
 
 
-# Check whether --with-libz was given.
-if test "${with_libz+set}" = set; then :
-  withval=$with_libz;
+# Check whether --with-libzzip was given.
+if test "${with_libzzip+set}" = set; then :
+  withval=$with_libzzip;
              case "${withval}" in
-               no) use_gzip="no" ;;
-               yes) use_gzip="yes"; gzip_prefix= ;;
-               *) use_gzip="yes"; gzip_prefix="${withval}" ;;
+               no) use_zzip="no" ;;
+               yes) use_zzip="yes"; zzip_prefix= ;;
+               *) use_zzip="yes"; zzip_prefix="${withval}" ;;
              esac
 
 else
-   use_gzip="yes"; gzip_prefix=;
+   use_zzip="yes"; zzip_prefix=;
 fi
 
 
 
 echo
-echo "*** Configuring gzip support"
+echo "*** Configuring zzip support"
 echo
 
 if test "x$no_extern" = "xyes"; then
-  use_gzip="no";
+  use_zzip="no";
 fi
 
-if test "x$use_gzip" = "xyes"; then
+if test "x$use_zzip" = "xyes"; then
     saved_ldflags=$LDFLAGS
   saved_libs=$LIBS
-  if test "x$gzip_prefix" != "x"; then
-    LDFLAGS="$LDFLAGS -L$gzip_prefix/lib"
+  if test "x$zzip_prefix" != "x"; then
+    LDFLAGS="$LDFLAGS -L$zzip_prefix/lib"
   fi
-  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for gzopen in -lz" >&5
-$as_echo_n "checking for gzopen in -lz... " >&6; }
-if ${ac_cv_lib_z_gzopen+:} false; then :
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for zzip_open in -lzzip" >&5
+$as_echo_n "checking for zzip_open in -lzzip... " >&6; }
+if ${ac_cv_lib_zzip_zzip_open+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   ac_check_lib_save_LIBS=$LIBS
-LIBS="-lz  $LIBS"
+LIBS="-lzzip  $LIBS"
 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
@@ -29418,7 +31484,7 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 #ifdef __cplusplus
 extern "C"
 #endif
-char gzopen ();
+char zzip_open ();
 #ifdef F77_DUMMY_MAIN
 
 #  ifdef __cplusplus
@@ -29430,42 +31496,45 @@ char gzopen ();
 int
 main ()
 {
-return gzopen ();
+return zzip_open ();
   ;
   return 0;
 }
 _ACEOF
 if ac_fn_c_try_link "$LINENO"; then :
-  ac_cv_lib_z_gzopen=yes
+  ac_cv_lib_zzip_zzip_open=yes
 else
-  ac_cv_lib_z_gzopen=no
+  ac_cv_lib_zzip_zzip_open=no
 fi
 rm -f core conftest.err conftest.$ac_objext \
     conftest$ac_exeext conftest.$ac_ext
 LIBS=$ac_check_lib_save_LIBS
 fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_z_gzopen" >&5
-$as_echo "$ac_cv_lib_z_gzopen" >&6; }
-if test "x$ac_cv_lib_z_gzopen" = xyes; then :
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_zzip_zzip_open" >&5
+$as_echo "$ac_cv_lib_zzip_zzip_open" >&6; }
+if test "x$ac_cv_lib_zzip_zzip_open" = xyes; then :
   have_this_lib=yes
+  LIBS="$LIBS -lzzip"
 
-$as_echo "#define HAVE_LIBZ 1" >>confdefs.h
+$as_echo "#define HAVE_LIBZZIP 1" >>confdefs.h
 
 fi
 
+
+
   LDFLAGS=$saved_ldflags
   LIBS=$saved_libs
 
   saved_cppflags=$CPPFLAGS
-  if test "x$gzip_prefix" != "x"; then
-    CPPFLAGS="$CPPFLAGS -I$gzip_prefix/include"
+  if test "x$zzip_prefix" != "x"; then
+    CPPFLAGS="$CPPFLAGS -I$zzip_prefix/include"
   fi
-  for ac_header in zlib.h
+  for ac_header in zzip/lib.h
 do :
-  ac_fn_c_check_header_mongrel "$LINENO" "zlib.h" "ac_cv_header_zlib_h" "$ac_includes_default"
-if test "x$ac_cv_header_zlib_h" = xyes; then :
+  ac_fn_c_check_header_mongrel "$LINENO" "zzip/lib.h" "ac_cv_header_zzip_lib_h" "$ac_includes_default"
+if test "x$ac_cv_header_zzip_lib_h" = xyes; then :
   cat >>confdefs.h <<_ACEOF
-#define HAVE_ZLIB_H 1
+#define HAVE_ZZIP_LIB_H 1
 _ACEOF
  have_this_header=yes
 fi
@@ -29475,50 +31544,53 @@ done
   CPPFLAGS=$saved_cppflags
 fi
 
-GZIP_CPPFLAGS=
-GZIP_LDFLAGS=
+ZZIP_CPPFLAGS=
+ZZIP_LDFLAGS=
+ZZIP_LIBS=
 if test "x$have_this_header" = "xyes" -a "x$have_this_lib" = "xyes"; then
-  if test "x$gzip_prefix" = "x"; then
-    GZIP_LDFLAGS="-lz"
-    GZIP_SEARCHPATH="$PATH"
+  if test "x$zzip_prefix" = "x"; then
+    ZZIP_LIBS="-lzzip"
+    ZZIP_SEARCHPATH="$PATH"
   else
-    GZIP_CPPFLAGS="-I$gzip_prefix/include"
-    GZIP_LDFLAGS="-L$gzip_prefix/lib -lz"
-    GZIP_SEARCHPATH="$gzip_prefix/bin:$PATH"
+    ZZIP_CPPFLAGS="-I$zzip_prefix/include"
+    ZZIP_LDFLAGS="-L$zzip_prefix/lib"
+    ZZIP_LIBS="-lzzip"
+    ZZIP_SEARCHPATH="$zzip_prefix/bin:$PATH"
   fi
 
-$as_echo "#define USE_GZIP /**/" >>confdefs.h
+$as_echo "#define USE_ZZIP /**/" >>confdefs.h
 
 else
-  use_gzip="no";
-  GZIP_SEARCHPATH="$PATH"
+  use_zzip="no";
+  ZZIP_SEARCHPATH="$PATH"
 fi
 
 
 
 
-for ac_prog in gzip
+
+for ac_prog in zip
 do
   # Extract the first word of "$ac_prog", so it can be a program name with args.
 set dummy $ac_prog; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_path_path_gzip+:} false; then :
+if ${ac_cv_path_path_zip+:} false; then :
   $as_echo_n "(cached) " >&6
 else
-  case $path_gzip in
+  case $path_zip in
   [\\/]* | ?:[\\/]*)
-  ac_cv_path_path_gzip="$path_gzip" # Let the user override the test with a path.
+  ac_cv_path_path_zip="$path_zip" # Let the user override the test with a path.
   ;;
   *)
   as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $GZIP_SEARCHPATH
+for as_dir in $ZZIP_SEARCHPATH
 do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
     for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
-    ac_cv_path_path_gzip="$as_dir/$ac_word$ac_exec_ext"
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_path_path_zip="$as_dir/$ac_word$ac_exec_ext"
     $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
   fi
@@ -29529,53 +31601,53 @@ IFS=$as_save_IFS
   ;;
 esac
 fi
-path_gzip=$ac_cv_path_path_gzip
-if test -n "$path_gzip"; then
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $path_gzip" >&5
-$as_echo "$path_gzip" >&6; }
+path_zip=$ac_cv_path_path_zip
+if test -n "$path_zip"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $path_zip" >&5
+$as_echo "$path_zip" >&6; }
 else
   { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
 $as_echo "no" >&6; }
 fi
 
 
-  test -n "$path_gzip" && break
+  test -n "$path_zip" && break
 done
-test -n "$path_gzip" || path_gzip="not found"
+test -n "$path_zip" || path_zip="not found"
 
 
-if test "x$path_gzip" != "xnot found"; then
+if test "x$path_zip" != "xnot found"; then
 
 cat >>confdefs.h <<_ACEOF
-#define GZIP "$path_gzip"
+#define ZIP "$path_zip"
 _ACEOF
 
 fi
 
 
 
-for ac_prog in gunzip
+for ac_prog in unzip
 do
   # Extract the first word of "$ac_prog", so it can be a program name with args.
 set dummy $ac_prog; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_path_path_gunzip+:} false; then :
+if ${ac_cv_path_path_unzip+:} false; then :
   $as_echo_n "(cached) " >&6
 else
-  case $path_gunzip in
+  case $path_unzip in
   [\\/]* | ?:[\\/]*)
-  ac_cv_path_path_gunzip="$path_gunzip" # Let the user override the test with a path.
+  ac_cv_path_path_unzip="$path_unzip" # Let the user override the test with a path.
   ;;
   *)
   as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $GZIP_SEARCHPATH
+for as_dir in $ZZIP_SEARCHPATH
 do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
     for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
-    ac_cv_path_path_gunzip="$as_dir/$ac_word$ac_exec_ext"
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_path_path_unzip="$as_dir/$ac_word$ac_exec_ext"
     $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
   fi
@@ -29586,112 +31658,129 @@ IFS=$as_save_IFS
   ;;
 esac
 fi
-path_gunzip=$ac_cv_path_path_gunzip
-if test -n "$path_gunzip"; then
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $path_gunzip" >&5
-$as_echo "$path_gunzip" >&6; }
+path_unzip=$ac_cv_path_path_unzip
+if test -n "$path_unzip"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $path_unzip" >&5
+$as_echo "$path_unzip" >&6; }
 else
   { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
 $as_echo "no" >&6; }
 fi
 
 
-  test -n "$path_gunzip" && break
+  test -n "$path_unzip" && break
 done
-test -n "$path_gunzip" || path_gunzip="not found"
+test -n "$path_unzip" || path_unzip="not found"
 
 
-if test "x$path_gunzip" != "xnot found"; then
+if test "x$path_unzip" != "xnot found"; then
 
 cat >>confdefs.h <<_ACEOF
-#define GUNZIP "$path_gunzip"
+#define UNZIP "$path_unzip"
 _ACEOF
 
 fi
 
-
- if test "x$use_gzip" = "xyes"; then
-  USE_GZIP_TRUE=
-  USE_GZIP_FALSE='#'
+ if test "x$use_zzip" = "xyes"; then
+  USE_ZZIP_TRUE=
+  USE_ZZIP_FALSE='#'
 else
-  USE_GZIP_TRUE='#'
-  USE_GZIP_FALSE=
+  USE_ZZIP_TRUE='#'
+  USE_ZZIP_FALSE=
 fi
 
 
-if test "x$path_gzip" != "xnot found" -a \
-  "x$path_gunzip" != "xnot found"; then
+if test "x$path_zip" != "xnot found" -a \
+  "x$path_unzip" != "xnot found"; then
 
-$as_echo "#define TEST_GZIP /**/" >>confdefs.h
+$as_echo "#define TEST_ZZIP /**/" >>confdefs.h
 
 fi
 
-if test "x$use_gzip" != "xno"; then
+if test "x$use_zzip" != "xno"; then
   if test "x$use_modules" != "xno"; then
-    ENCODINGS_MODS="${ENCODINGS_MODS} gzip";
+    ENCODINGS_MODS="${ENCODINGS_MODS} zzip";
   else
-    ENCODINGS_BUILT="${ENCODINGS_BUILT} gzip";
+    ENCODINGS_BUILT="${ENCODINGS_BUILT} zzip";
     if test -z "$PRIVATE_LIBS"; then
-      PRIVATE_LIBS="$GZIP_LDFLAGS"
+      PRIVATE_LIBS="$ZZIP_LDFLAGS $ZZIP_LIBS"
     else
-      PRIVATE_LIBS="$PRIVATE_LIBS $GZIP_LDFLAGS"
+      PRIVATE_LIBS="$ZZIP_LDFLAGS $PRIVATE_LIBS $ZZIP_LIBS"
     fi
   fi
 else
-  ENCODINGS_LEFT="${ENCODINGS_LEFT} gzip";
+  ENCODINGS_LEFT="${ENCODINGS_LEFT} zzip";
 fi
 
 
-have_this_header=
-have_this_lib=
-
-
-# Check whether --with-liblzma was given.
-if test "${with_liblzma+set}" = set; then :
-  withval=$with_liblzma;
-             case "${withval}" in
-               no) use_lzma="no" ;;
-               yes) use_lzma="yes"; lzma_prefix= ;;
-               *) use_lzma="yes"; lzma_prefix="${withval}" ;;
-             esac
+# Check whether --enable-zzslim was given.
+if test "${enable_zzslim+set}" = set; then :
+  enableval=$enable_zzslim;
+               case "${enableval}" in
+                 no) zzslim_override="no" ;;
+                 *) zzslim_override="yes" ;;
+               esac
 
 else
-   use_lzma="yes"; lzma_prefix=;
+   zzslim_override="auto"
 fi
 
 
 
 echo
-echo "*** Configuring lzma support"
+echo "*** Configuring zzslim support "
 echo
+if test $zzslim_override = "no"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for zzslim support" >&5
+$as_echo_n "checking for zzslim support... " >&6; }
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no (forced)" >&5
+$as_echo "no (forced)" >&6; }
+  use_zzslim=no
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for slim support" >&5
+$as_echo_n "checking for slim support... " >&6; }
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $use_slim" >&5
+$as_echo "$use_slim" >&6; }
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for zzip support" >&5
+$as_echo_n "checking for zzip support... " >&6; }
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $use_zzip" >&5
+$as_echo "$use_zzip" >&6; }
+  if test "$use_slim$use_zzip" == "yesyes"; then
+    if test $zzslim_override = "yes"; then
+      { $as_echo "$as_me:${as_lineno-$LINENO}: checking for zzslim support" >&5
+$as_echo_n "checking for zzslim support... " >&6; }
+      { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes (forced)" >&5
+$as_echo "yes (forced)" >&6; }
+      use_zzslim=yes
+    elif test "x$CXX" = "x"; then
+      { $as_echo "$as_me:${as_lineno-$LINENO}: checking for zzslim support" >&5
+$as_echo_n "checking for zzslim support... " >&6; }
+      { $as_echo "$as_me:${as_lineno-$LINENO}: result: no (no C++ compiler available for configure test)" >&5
+$as_echo "no (no C++ compiler available for configure test)" >&6; }
+      use_zzslim=no
+    else
+                        { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether -lslim contains zzip capability" >&5
+$as_echo_n "checking whether -lslim contains zzip capability... " >&6; }
+      ac_ext=cpp
+ac_cpp='$CXXCPP $CPPFLAGS'
+ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
 
-if test "x$no_extern" = "xyes"; then
-  use_lzma="no";
-fi
-
-if test "x$use_lzma" = "xyes"; then
-    saved_ldflags=$LDFLAGS
-  saved_libs=$LIBS
-  if test "x$lzma_prefix" != "x"; then
-    LDFLAGS="$LDFLAGS -L$lzma_prefix/lib"
-  fi
-  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for lzma_auto_decoder in -llzma" >&5
-$as_echo_n "checking for lzma_auto_decoder in -llzma... " >&6; }
-if ${ac_cv_lib_lzma_lzma_auto_decoder+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  ac_check_lib_save_LIBS=$LIBS
-LIBS="-llzma  $LIBS"
-cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+      saved_ldflags=$LDFLAGS
+      saved_libs=$LIBS
+      LDFLAGS="$SLIM_LDFLAGS $LDFLAGS"
+      LIBS="$SLIM_LIBS $LIBS"
+      cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
-/* Override any GCC internal prototype to avoid an error.
-   Use char because int might match the return type of a GCC
-   builtin and then its argument prototype would still apply.  */
-#ifdef __cplusplus
-extern "C"
-#endif
-char lzma_auto_decoder ();
+                       struct zzip_file;
+                       typedef struct zzip_file ZZIP_FILE;
+                       class ibitstream {
+                       public:
+                       ibitstream(ZZIP_FILE *file, int buffersize);
+                     };
+
 #ifdef F77_DUMMY_MAIN
 
 #  ifdef __cplusplus
@@ -29703,161 +31792,53 @@ char lzma_auto_decoder ();
 int
 main ()
 {
-return lzma_auto_decoder ();
+
+                      ZZIP_FILE *file;
+                      ibitstream foo(file, 0);
+
+
   ;
   return 0;
 }
 _ACEOF
-if ac_fn_c_try_link "$LINENO"; then :
-  ac_cv_lib_lzma_lzma_auto_decoder=yes
+if ac_fn_cxx_try_link "$LINENO"; then :
+  slim_zzip="yes"
 else
-  ac_cv_lib_lzma_lzma_auto_decoder=no
+  slim_zzip="no"
 fi
 rm -f core conftest.err conftest.$ac_objext \
     conftest$ac_exeext conftest.$ac_ext
-LIBS=$ac_check_lib_save_LIBS
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_lzma_lzma_auto_decoder" >&5
-$as_echo "$ac_cv_lib_lzma_lzma_auto_decoder" >&6; }
-if test "x$ac_cv_lib_lzma_lzma_auto_decoder" = xyes; then :
-  have_this_lib=yes
-
-$as_echo "#define HAVE_LIBLZMA 1" >>confdefs.h
-
-fi
-
-  LDFLAGS=$saved_ldflags
-  LIBS=$saved_libs
-
-  saved_cppflags=$CPPFLAGS
-  if test "x$lzma_prefix" != "x"; then
-    CPPFLAGS="$CPPFLAGS -I$lzma_prefix/include"
-  fi
-  for ac_header in lzma.h
-do :
-  ac_fn_c_check_header_mongrel "$LINENO" "lzma.h" "ac_cv_header_lzma_h" "$ac_includes_default"
-if test "x$ac_cv_header_lzma_h" = xyes; then :
-  cat >>confdefs.h <<_ACEOF
-#define HAVE_LZMA_H 1
-_ACEOF
- have_this_header=yes
-fi
-
-done
+      { $as_echo "$as_me:${as_lineno-$LINENO}: result: $slim_zzip" >&5
+$as_echo "$slim_zzip" >&6; }
+      LDFLAGS=$saved_ldflags
+      LIBS=$saved_libs
+      ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
 
-  CPPFLAGS=$saved_cppflags
-fi
 
-LZMA_CPPFLAGS=
-LZMA_LDFLAGS=
-if test "x$have_this_header" = "xyes" -a "x$have_this_lib" = "xyes"; then
-  if test "x$lzma_prefix" = "x"; then
-    LZMA_LDFLAGS="-llzma"
-    LZMA_SEARCHPATH="$PATH"
+      use_zzslim=$slim_zzip
+    fi
   else
-    LZMA_CPPFLAGS="-I$lzma_prefix/include"
-    LZMA_LDFLAGS="-L$lzma_prefix/lib -llzma"
-    LZMA_SEARCHPATH="$lzma_prefix/bin:$PATH"
+    use_zzslim="no"
   fi
-
-$as_echo "#define USE_LZMA /**/" >>confdefs.h
-
-else
-  use_lzma="no";
-  LZMA_SEARCHPATH="$PATH"
 fi
 
+if test "x$use_zzslim" != "xno"; then
 
+$as_echo "#define USE_ZZSLIM /**/" >>confdefs.h
 
-
-for ac_prog in xz
-do
-  # Extract the first word of "$ac_prog", so it can be a program name with args.
-set dummy $ac_prog; ac_word=$2
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_path_path_xz+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  case $path_xz in
-  [\\/]* | ?:[\\/]*)
-  ac_cv_path_path_xz="$path_xz" # Let the user override the test with a path.
-  ;;
-  *)
-  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $LZMA_SEARCHPATH
-do
-  IFS=$as_save_IFS
-  test -z "$as_dir" && as_dir=.
-    for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
-    ac_cv_path_path_xz="$as_dir/$ac_word$ac_exec_ext"
-    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
-    break 2
-  fi
-done
-  done
-IFS=$as_save_IFS
-
-  ;;
-esac
-fi
-path_xz=$ac_cv_path_path_xz
-if test -n "$path_xz"; then
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $path_xz" >&5
-$as_echo "$path_xz" >&6; }
-else
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-fi
-
-
-  test -n "$path_xz" && break
-done
-test -n "$path_xz" || path_xz="not found"
-
-
-if test "x$path_xz" != "xnot found"; then
-
-cat >>confdefs.h <<_ACEOF
-#define XZ "$path_xz"
-_ACEOF
-
-fi
-
-
- if test "x$use_lzma" = "xyes"; then
-  USE_LZMA_TRUE=
-  USE_LZMA_FALSE='#'
-else
-  USE_LZMA_TRUE='#'
-  USE_LZMA_FALSE=
-fi
-
-
-if test "x$path_xz" != "xnot found" -a \
-  "x$path_gunzip" != "xnot found"; then
-
-$as_echo "#define TEST_LZMA /**/" >>confdefs.h
-
-fi
-
-if test "x$use_lzma" != "xno"; then
   if test "x$use_modules" != "xno"; then
-    ENCODINGS_MODS="${ENCODINGS_MODS} lzma";
+    ENCODINGS_MODS="${ENCODINGS_MODS} zzslim";
   else
-    ENCODINGS_BUILT="${ENCODINGS_BUILT} lzma";
-    if test -z "$PRIVATE_LIBS"; then
-      PRIVATE_LIBS="$LZMA_LDFLAGS"
-    else
-      PRIVATE_LIBS="$PRIVATE_LIBS $LZMA_LDFLAGS"
-    fi
+    ENCODINGS_BUILT="${ENCODINGS_BUILT} zzslim";
   fi
 else
-  ENCODINGS_LEFT="${ENCODINGS_LEFT} lzma";
+  ENCODINGS_LEFT="${ENCODINGS_LEFT} zzslim";
 fi
 
-
 if test ! -z "${LIBS}"; then
   PRIVATE_LIBS="${LIBS} ${PRIVATE_LIBS}"
 fi
@@ -29890,12 +31871,24 @@ ac_config_files="$ac_config_files bindings/f77/Makefile"
 
 ac_config_files="$ac_config_files bindings/f77/test/Makefile"
 
+ac_config_files="$ac_config_files bindings/f77/test/test_getdata.f"
+
 ac_config_files="$ac_config_files bindings/idl/Makefile"
 
 ac_config_files="$ac_config_files bindings/idl/makedlm.sh"
 
 ac_config_files="$ac_config_files bindings/idl/test/Makefile"
 
+ac_config_files="$ac_config_files bindings/matlab/Makefile"
+
+ac_config_files="$ac_config_files bindings/matlab/make_contents.sh"
+
+ac_config_files="$ac_config_files bindings/matlab/test/Makefile"
+
+ac_config_files="$ac_config_files bindings/perl/Makefile"
+
+ac_config_files="$ac_config_files bindings/perl/Build.PL"
+
 ac_config_files="$ac_config_files bindings/python/Makefile"
 
 ac_config_files="$ac_config_files bindings/python/test/Makefile"
@@ -29987,6 +31980,14 @@ else
   F77_WEXTRA_FALSE=
 fi
 
+ if test "x$gd_cv_prog_f77_fno_backslash" == "xyes"; then
+  F77_FNO_BACKSLASH_TRUE=
+  F77_FNO_BACKSLASH_FALSE='#'
+else
+  F77_FNO_BACKSLASH_TRUE='#'
+  F77_FNO_BACKSLASH_FALSE=
+fi
+
  if test "x$gd_cv_prog_fc_wextra" == "xyes"; then
   FC_WEXTRA_TRUE=
   FC_WEXTRA_FALSE='#'
@@ -30011,14 +32012,6 @@ else
   INTEL_FC_COMPILER_FALSE=
 fi
 
- if test "x$gd_cv_type_off64_t" = "xyes"; then
-  LFS_TRANSITIONAL_API_TRUE=
-  LFS_TRANSITIONAL_API_FALSE='#'
-else
-  LFS_TRANSITIONAL_API_TRUE='#'
-  LFS_TRANSITIONAL_API_FALSE=
-fi
-
  if test "x$include_legacy_api" != "xno"; then
   INCLUDE_LEGACY_API_TRUE=
   INCLUDE_LEGACY_API_FALSE='#'
@@ -30067,6 +32060,22 @@ else
   MAKE_IDLBINDINGS_FALSE=
 fi
 
+ if test "x$make_perlbindings" = "xyes"; then
+  MAKE_PERLBINDINGS_TRUE=
+  MAKE_PERLBINDINGS_FALSE='#'
+else
+  MAKE_PERLBINDINGS_TRUE='#'
+  MAKE_PERLBINDINGS_FALSE=
+fi
+
+ if test "x$make_matlabbindings" = "xyes"; then
+  MAKE_MATLABBINDINGS_TRUE=
+  MAKE_MATLABBINDINGS_FALSE='#'
+else
+  MAKE_MATLABBINDINGS_TRUE='#'
+  MAKE_MATLABBINDINGS_FALSE=
+fi
+
  if test "x$use_modules" != "xno"; then
   USE_MODULES_TRUE=
   USE_MODULES_FALSE='#'
@@ -30091,6 +32100,22 @@ else
   TEST_IDL_FALSE=
 fi
 
+ if test "x$HAVE_Test__Harness" = "xyes"; then
+  TEST_PERL_TRUE=
+  TEST_PERL_FALSE='#'
+else
+  TEST_PERL_TRUE='#'
+  TEST_PERL_FALSE=
+fi
+
+ if test "x$NO_DLOPEN_TESTS" = "x0"; then
+  TEST_MATLAB_TRUE=
+  TEST_MATLAB_FALSE='#'
+else
+  TEST_MATLAB_TRUE='#'
+  TEST_MATLAB_FALSE=
+fi
+
  if test "x$DIFF" != "x"; then
   HAVE_DIFF_TRUE=
   HAVE_DIFF_FALSE='#'
@@ -30099,15 +32124,24 @@ else
   HAVE_DIFF_FALSE=
 fi
 
+ if test "x$use_zzslim" = "xyes"; then
+  USE_ZZSLIM_TRUE=
+  USE_ZZSLIM_FALSE='#'
+else
+  USE_ZZSLIM_TRUE='#'
+  USE_ZZSLIM_FALSE=
+fi
+
  if false; then
-  GDIDL_EXTERNAL_TRUE=
-  GDIDL_EXTERNAL_FALSE='#'
+  GD_EXTERNAL_TRUE=
+  GD_EXTERNAL_FALSE='#'
 else
-  GDIDL_EXTERNAL_TRUE='#'
-  GDIDL_EXTERNAL_FALSE=
+  GD_EXTERNAL_TRUE='#'
+  GD_EXTERNAL_FALSE=
 fi
 
 
+
 LDFLAGS="${LDFLAGS}${NO_UNDEFINED}"
 
 cat >confcache <<\_ACEOF
@@ -30235,6 +32269,10 @@ if test -z "${am__fastdepCC_TRUE}" && test -z "${am__fastdepCC_FALSE}"; then
   as_fn_error $? "conditional \"am__fastdepCC\" was never defined.
 Usually this means the macro was only invoked conditionally." "$LINENO" 5
 fi
+if test -z "${am__fastdepCCAS_TRUE}" && test -z "${am__fastdepCCAS_FALSE}"; then
+  as_fn_error $? "conditional \"am__fastdepCCAS\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
 if test -z "${am__fastdepCXX_TRUE}" && test -z "${am__fastdepCXX_FALSE}"; then
   as_fn_error $? "conditional \"am__fastdepCXX\" was never defined.
 Usually this means the macro was only invoked conditionally." "$LINENO" 5
@@ -30244,10 +32282,6 @@ if test -z "${USE_BZIP2_TRUE}" && test -z "${USE_BZIP2_FALSE}"; then
   as_fn_error $? "conditional \"USE_BZIP2\" was never defined.
 Usually this means the macro was only invoked conditionally." "$LINENO" 5
 fi
-if test -z "${USE_SLIM_TRUE}" && test -z "${USE_SLIM_FALSE}"; then
-  as_fn_error $? "conditional \"USE_SLIM\" was never defined.
-Usually this means the macro was only invoked conditionally." "$LINENO" 5
-fi
 if test -z "${USE_GZIP_TRUE}" && test -z "${USE_GZIP_FALSE}"; then
   as_fn_error $? "conditional \"USE_GZIP\" was never defined.
 Usually this means the macro was only invoked conditionally." "$LINENO" 5
@@ -30256,6 +32290,14 @@ if test -z "${USE_LZMA_TRUE}" && test -z "${USE_LZMA_FALSE}"; then
   as_fn_error $? "conditional \"USE_LZMA\" was never defined.
 Usually this means the macro was only invoked conditionally." "$LINENO" 5
 fi
+if test -z "${USE_SLIM_TRUE}" && test -z "${USE_SLIM_FALSE}"; then
+  as_fn_error $? "conditional \"USE_SLIM\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
+if test -z "${USE_ZZIP_TRUE}" && test -z "${USE_ZZIP_FALSE}"; then
+  as_fn_error $? "conditional \"USE_ZZIP\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
 if test -z "${GETDATA_DEBUG_TRUE}" && test -z "${GETDATA_DEBUG_FALSE}"; then
   as_fn_error $? "conditional \"GETDATA_DEBUG\" was never defined.
 Usually this means the macro was only invoked conditionally." "$LINENO" 5
@@ -30288,6 +32330,10 @@ if test -z "${F77_WEXTRA_TRUE}" && test -z "${F77_WEXTRA_FALSE}"; then
   as_fn_error $? "conditional \"F77_WEXTRA\" was never defined.
 Usually this means the macro was only invoked conditionally." "$LINENO" 5
 fi
+if test -z "${F77_FNO_BACKSLASH_TRUE}" && test -z "${F77_FNO_BACKSLASH_FALSE}"; then
+  as_fn_error $? "conditional \"F77_FNO_BACKSLASH\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
 if test -z "${FC_WEXTRA_TRUE}" && test -z "${FC_WEXTRA_FALSE}"; then
   as_fn_error $? "conditional \"FC_WEXTRA\" was never defined.
 Usually this means the macro was only invoked conditionally." "$LINENO" 5
@@ -30300,10 +32346,6 @@ if test -z "${INTEL_FC_COMPILER_TRUE}" && test -z "${INTEL_FC_COMPILER_FALSE}";
   as_fn_error $? "conditional \"INTEL_FC_COMPILER\" was never defined.
 Usually this means the macro was only invoked conditionally." "$LINENO" 5
 fi
-if test -z "${LFS_TRANSITIONAL_API_TRUE}" && test -z "${LFS_TRANSITIONAL_API_FALSE}"; then
-  as_fn_error $? "conditional \"LFS_TRANSITIONAL_API\" was never defined.
-Usually this means the macro was only invoked conditionally." "$LINENO" 5
-fi
 if test -z "${INCLUDE_LEGACY_API_TRUE}" && test -z "${INCLUDE_LEGACY_API_FALSE}"; then
   as_fn_error $? "conditional \"INCLUDE_LEGACY_API\" was never defined.
 Usually this means the macro was only invoked conditionally." "$LINENO" 5
@@ -30328,6 +32370,14 @@ if test -z "${MAKE_IDLBINDINGS_TRUE}" && test -z "${MAKE_IDLBINDINGS_FALSE}"; th
   as_fn_error $? "conditional \"MAKE_IDLBINDINGS\" was never defined.
 Usually this means the macro was only invoked conditionally." "$LINENO" 5
 fi
+if test -z "${MAKE_PERLBINDINGS_TRUE}" && test -z "${MAKE_PERLBINDINGS_FALSE}"; then
+  as_fn_error $? "conditional \"MAKE_PERLBINDINGS\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
+if test -z "${MAKE_MATLABBINDINGS_TRUE}" && test -z "${MAKE_MATLABBINDINGS_FALSE}"; then
+  as_fn_error $? "conditional \"MAKE_MATLABBINDINGS\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
 if test -z "${USE_MODULES_TRUE}" && test -z "${USE_MODULES_FALSE}"; then
   as_fn_error $? "conditional \"USE_MODULES\" was never defined.
 Usually this means the macro was only invoked conditionally." "$LINENO" 5
@@ -30340,12 +32390,24 @@ if test -z "${TEST_IDL_TRUE}" && test -z "${TEST_IDL_FALSE}"; then
   as_fn_error $? "conditional \"TEST_IDL\" was never defined.
 Usually this means the macro was only invoked conditionally." "$LINENO" 5
 fi
+if test -z "${TEST_PERL_TRUE}" && test -z "${TEST_PERL_FALSE}"; then
+  as_fn_error $? "conditional \"TEST_PERL\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
+if test -z "${TEST_MATLAB_TRUE}" && test -z "${TEST_MATLAB_FALSE}"; then
+  as_fn_error $? "conditional \"TEST_MATLAB\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
 if test -z "${HAVE_DIFF_TRUE}" && test -z "${HAVE_DIFF_FALSE}"; then
   as_fn_error $? "conditional \"HAVE_DIFF\" was never defined.
 Usually this means the macro was only invoked conditionally." "$LINENO" 5
 fi
-if test -z "${GDIDL_EXTERNAL_TRUE}" && test -z "${GDIDL_EXTERNAL_FALSE}"; then
-  as_fn_error $? "conditional \"GDIDL_EXTERNAL\" was never defined.
+if test -z "${USE_ZZSLIM_TRUE}" && test -z "${USE_ZZSLIM_FALSE}"; then
+  as_fn_error $? "conditional \"USE_ZZSLIM\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
+if test -z "${GD_EXTERNAL_TRUE}" && test -z "${GD_EXTERNAL_FALSE}"; then
+  as_fn_error $? "conditional \"GD_EXTERNAL\" was never defined.
 Usually this means the macro was only invoked conditionally." "$LINENO" 5
 fi
 
@@ -30646,16 +32708,16 @@ if (echo >conf$$.file) 2>/dev/null; then
     # ... but there are two gotchas:
     # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail.
     # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable.
-    # In both cases, we have to default to `cp -p'.
+    # In both cases, we have to default to `cp -pR'.
     ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe ||
-      as_ln_s='cp -p'
+      as_ln_s='cp -pR'
   elif ln conf$$.file conf$$ 2>/dev/null; then
     as_ln_s=ln
   else
-    as_ln_s='cp -p'
+    as_ln_s='cp -pR'
   fi
 else
-  as_ln_s='cp -p'
+  as_ln_s='cp -pR'
 fi
 rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file
 rmdir conf$$.dir 2>/dev/null
@@ -30715,28 +32777,16 @@ else
   as_mkdir_p=false
 fi
 
-if test -x / >/dev/null 2>&1; then
-  as_test_x='test -x'
-else
-  if ls -dL / >/dev/null 2>&1; then
-    as_ls_L_option=L
-  else
-    as_ls_L_option=
-  fi
-  as_test_x='
-    eval sh -c '\''
-      if test -d "$1"; then
-	test -d "$1/.";
-      else
-	case $1 in #(
-	-*)set "./$1";;
-	esac;
-	case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in #((
-	???[sx]*):;;*)false;;esac;fi
-    '\'' sh
-  '
-fi
-as_executable_p=$as_test_x
+
+# as_fn_executable_p FILE
+# -----------------------
+# Test if FILE is an executable regular file.
+as_fn_executable_p ()
+{
+  test -f "$1" && test -x "$1"
+} # as_fn_executable_p
+as_test_x='test -x'
+as_executable_p=as_fn_executable_p
 
 # Sed expression to map a string onto a valid CPP name.
 as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'"
@@ -30757,8 +32807,8 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
 # report actual input values of CONFIG_FILES etc. instead of their
 # values after options handling.
 ac_log="
-This file was extended by GetData $as_me 0.7.3, which was
-generated by GNU Autoconf 2.68.  Invocation command line was
+This file was extended by GetData $as_me 0.8.5, which was
+generated by GNU Autoconf 2.69.  Invocation command line was
 
   CONFIG_FILES    = $CONFIG_FILES
   CONFIG_HEADERS  = $CONFIG_HEADERS
@@ -30817,17 +32867,18 @@ $config_headers
 Configuration commands:
 $config_commands
 
-Report bugs to <getdata-devel at lists.sourceforge.net>."
+Report bugs to <getdata-devel at lists.sourceforge.net>.
+GetData home page: <http://getdata.sourceforge.net/>."
 
 _ACEOF
 cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
 ac_cs_version="\\
-GetData config.status 0.7.3
-configured by $0, generated by GNU Autoconf 2.68,
+GetData config.status 0.8.5
+configured by $0, generated by GNU Autoconf 2.69,
   with options \\"\$ac_cs_config\\"
 
-Copyright (C) 2010 Free Software Foundation, Inc.
+Copyright (C) 2012 Free Software Foundation, Inc.
 This config.status script is free software; the Free Software Foundation
 gives unlimited permission to copy, distribute and modify it."
 
@@ -30918,7 +32969,7 @@ fi
 _ACEOF
 cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
 if \$ac_cs_recheck; then
-  set X '$SHELL' '$0' $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion
+  set X $SHELL '$0' $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion
   shift
   \$as_echo "running CONFIG_SHELL=$SHELL \$*" >&6
   CONFIG_SHELL='$SHELL'
@@ -30960,6 +33011,7 @@ pic_mode='`$ECHO "$pic_mode" | $SED "$delay_single_quote_subst"`'
 enable_fast_install='`$ECHO "$enable_fast_install" | $SED "$delay_single_quote_subst"`'
 SHELL='`$ECHO "$SHELL" | $SED "$delay_single_quote_subst"`'
 ECHO='`$ECHO "$ECHO" | $SED "$delay_single_quote_subst"`'
+PATH_SEPARATOR='`$ECHO "$PATH_SEPARATOR" | $SED "$delay_single_quote_subst"`'
 host_alias='`$ECHO "$host_alias" | $SED "$delay_single_quote_subst"`'
 host='`$ECHO "$host" | $SED "$delay_single_quote_subst"`'
 host_os='`$ECHO "$host_os" | $SED "$delay_single_quote_subst"`'
@@ -31042,7 +33094,6 @@ with_gnu_ld='`$ECHO "$with_gnu_ld" | $SED "$delay_single_quote_subst"`'
 allow_undefined_flag='`$ECHO "$allow_undefined_flag" | $SED "$delay_single_quote_subst"`'
 no_undefined_flag='`$ECHO "$no_undefined_flag" | $SED "$delay_single_quote_subst"`'
 hardcode_libdir_flag_spec='`$ECHO "$hardcode_libdir_flag_spec" | $SED "$delay_single_quote_subst"`'
-hardcode_libdir_flag_spec_ld='`$ECHO "$hardcode_libdir_flag_spec_ld" | $SED "$delay_single_quote_subst"`'
 hardcode_libdir_separator='`$ECHO "$hardcode_libdir_separator" | $SED "$delay_single_quote_subst"`'
 hardcode_direct='`$ECHO "$hardcode_direct" | $SED "$delay_single_quote_subst"`'
 hardcode_direct_absolute='`$ECHO "$hardcode_direct_absolute" | $SED "$delay_single_quote_subst"`'
@@ -31166,9 +33217,6 @@ no_undefined_flag_FC='`$ECHO "$no_undefined_flag_FC" | $SED "$delay_single_quote
 hardcode_libdir_flag_spec_CXX='`$ECHO "$hardcode_libdir_flag_spec_CXX" | $SED "$delay_single_quote_subst"`'
 hardcode_libdir_flag_spec_F77='`$ECHO "$hardcode_libdir_flag_spec_F77" | $SED "$delay_single_quote_subst"`'
 hardcode_libdir_flag_spec_FC='`$ECHO "$hardcode_libdir_flag_spec_FC" | $SED "$delay_single_quote_subst"`'
-hardcode_libdir_flag_spec_ld_CXX='`$ECHO "$hardcode_libdir_flag_spec_ld_CXX" | $SED "$delay_single_quote_subst"`'
-hardcode_libdir_flag_spec_ld_F77='`$ECHO "$hardcode_libdir_flag_spec_ld_F77" | $SED "$delay_single_quote_subst"`'
-hardcode_libdir_flag_spec_ld_FC='`$ECHO "$hardcode_libdir_flag_spec_ld_FC" | $SED "$delay_single_quote_subst"`'
 hardcode_libdir_separator_CXX='`$ECHO "$hardcode_libdir_separator_CXX" | $SED "$delay_single_quote_subst"`'
 hardcode_libdir_separator_F77='`$ECHO "$hardcode_libdir_separator_F77" | $SED "$delay_single_quote_subst"`'
 hardcode_libdir_separator_FC='`$ECHO "$hardcode_libdir_separator_FC" | $SED "$delay_single_quote_subst"`'
@@ -31251,6 +33299,7 @@ _LTECHO_EOF'
 # Quote evaled strings.
 for var in SHELL \
 ECHO \
+PATH_SEPARATOR \
 SED \
 GREP \
 EGREP \
@@ -31301,7 +33350,6 @@ with_gnu_ld \
 allow_undefined_flag \
 no_undefined_flag \
 hardcode_libdir_flag_spec \
-hardcode_libdir_flag_spec_ld \
 hardcode_libdir_separator \
 exclude_expsyms \
 include_expsyms \
@@ -31365,9 +33413,6 @@ no_undefined_flag_FC \
 hardcode_libdir_flag_spec_CXX \
 hardcode_libdir_flag_spec_F77 \
 hardcode_libdir_flag_spec_FC \
-hardcode_libdir_flag_spec_ld_CXX \
-hardcode_libdir_flag_spec_ld_F77 \
-hardcode_libdir_flag_spec_ld_FC \
 hardcode_libdir_separator_CXX \
 hardcode_libdir_separator_F77 \
 hardcode_libdir_separator_FC \
@@ -31506,7 +33551,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
 for ac_config_target in $ac_config_targets
 do
   case $ac_config_target in
-    "src/config.h") CONFIG_HEADERS="$CONFIG_HEADERS src/config.h" ;;
+    "src/gd_config.h") CONFIG_HEADERS="$CONFIG_HEADERS src/gd_config.h" ;;
     "depfiles") CONFIG_COMMANDS="$CONFIG_COMMANDS depfiles" ;;
     "libtool") CONFIG_COMMANDS="$CONFIG_COMMANDS libtool" ;;
     "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;;
@@ -31515,9 +33560,15 @@ do
     "bindings/cxx/test/Makefile") CONFIG_FILES="$CONFIG_FILES bindings/cxx/test/Makefile" ;;
     "bindings/f77/Makefile") CONFIG_FILES="$CONFIG_FILES bindings/f77/Makefile" ;;
     "bindings/f77/test/Makefile") CONFIG_FILES="$CONFIG_FILES bindings/f77/test/Makefile" ;;
+    "bindings/f77/test/test_getdata.f") CONFIG_FILES="$CONFIG_FILES bindings/f77/test/test_getdata.f" ;;
     "bindings/idl/Makefile") CONFIG_FILES="$CONFIG_FILES bindings/idl/Makefile" ;;
     "bindings/idl/makedlm.sh") CONFIG_FILES="$CONFIG_FILES bindings/idl/makedlm.sh" ;;
     "bindings/idl/test/Makefile") CONFIG_FILES="$CONFIG_FILES bindings/idl/test/Makefile" ;;
+    "bindings/matlab/Makefile") CONFIG_FILES="$CONFIG_FILES bindings/matlab/Makefile" ;;
+    "bindings/matlab/make_contents.sh") CONFIG_FILES="$CONFIG_FILES bindings/matlab/make_contents.sh" ;;
+    "bindings/matlab/test/Makefile") CONFIG_FILES="$CONFIG_FILES bindings/matlab/test/Makefile" ;;
+    "bindings/perl/Makefile") CONFIG_FILES="$CONFIG_FILES bindings/perl/Makefile" ;;
+    "bindings/perl/Build.PL") CONFIG_FILES="$CONFIG_FILES bindings/perl/Build.PL" ;;
     "bindings/python/Makefile") CONFIG_FILES="$CONFIG_FILES bindings/python/Makefile" ;;
     "bindings/python/test/Makefile") CONFIG_FILES="$CONFIG_FILES bindings/python/test/Makefile" ;;
     "doc/Makefile") CONFIG_FILES="$CONFIG_FILES doc/Makefile" ;;
@@ -32242,8 +34293,8 @@ $as_echo X"$file" |
 # NOTE: Changes made to this file will be lost: look at ltmain.sh.
 #
 #   Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005,
-#                 2006, 2007, 2008, 2009, 2010 Free Software Foundation,
-#                 Inc.
+#                 2006, 2007, 2008, 2009, 2010, 2011 Free Software
+#                 Foundation, Inc.
 #   Written by Gordon Matzigkeit, 1996
 #
 #   This file is part of GNU Libtool.
@@ -32297,6 +34348,9 @@ SHELL=$lt_SHELL
 # An echo program that protects backslashes.
 ECHO=$lt_ECHO
 
+# The PATH separator for the build system.
+PATH_SEPARATOR=$lt_PATH_SEPARATOR
+
 # The host system.
 host_alias=$host_alias
 host=$host
@@ -32598,10 +34652,6 @@ no_undefined_flag=$lt_no_undefined_flag
 # This must work even if \$libdir does not exist
 hardcode_libdir_flag_spec=$lt_hardcode_libdir_flag_spec
 
-# If ld is used when linking, flag to hardcode \$libdir into a binary
-# during linking.  This must work even if \$libdir does not exist.
-hardcode_libdir_flag_spec_ld=$lt_hardcode_libdir_flag_spec_ld
-
 # Whether we need a single "-rpath" flag with a separated argument.
 hardcode_libdir_separator=$lt_hardcode_libdir_separator
 
@@ -32944,10 +34994,6 @@ no_undefined_flag=$lt_no_undefined_flag_CXX
 # This must work even if \$libdir does not exist
 hardcode_libdir_flag_spec=$lt_hardcode_libdir_flag_spec_CXX
 
-# If ld is used when linking, flag to hardcode \$libdir into a binary
-# during linking.  This must work even if \$libdir does not exist.
-hardcode_libdir_flag_spec_ld=$lt_hardcode_libdir_flag_spec_ld_CXX
-
 # Whether we need a single "-rpath" flag with a separated argument.
 hardcode_libdir_separator=$lt_hardcode_libdir_separator_CXX
 
@@ -33101,10 +35147,6 @@ no_undefined_flag=$lt_no_undefined_flag_F77
 # This must work even if \$libdir does not exist
 hardcode_libdir_flag_spec=$lt_hardcode_libdir_flag_spec_F77
 
-# If ld is used when linking, flag to hardcode \$libdir into a binary
-# during linking.  This must work even if \$libdir does not exist.
-hardcode_libdir_flag_spec_ld=$lt_hardcode_libdir_flag_spec_ld_F77
-
 # Whether we need a single "-rpath" flag with a separated argument.
 hardcode_libdir_separator=$lt_hardcode_libdir_separator_F77
 
@@ -33258,10 +35300,6 @@ no_undefined_flag=$lt_no_undefined_flag_FC
 # This must work even if \$libdir does not exist
 hardcode_libdir_flag_spec=$lt_hardcode_libdir_flag_spec_FC
 
-# If ld is used when linking, flag to hardcode \$libdir into a binary
-# during linking.  This must work even if \$libdir does not exist.
-hardcode_libdir_flag_spec_ld=$lt_hardcode_libdir_flag_spec_ld_FC
-
 # Whether we need a single "-rpath" flag with a separated argument.
 hardcode_libdir_separator=$lt_hardcode_libdir_separator_FC
 
@@ -33401,6 +35439,18 @@ else
   BINDINGS_LEFT="${BINDINGS_LEFT} IDL"
 fi
 
+if test "x$make_matlabbindings" != "xno"; then
+  BINDINGS_BUILT="${BINDINGS_BUILT} MATLAB"
+else
+  BINDINGS_LEFT="${BINDINGS_LEFT} MATLAB"
+fi
+
+if test "x$make_perlbindings" != "xno"; then
+  BINDINGS_BUILT="${BINDINGS_BUILT} Perl"
+else
+  BINDINGS_LEFT="${BINDINGS_LEFT} Perl"
+fi
+
 if test "x$make_pybindings" != "xno"; then
   BINDINGS_BUILT="${BINDINGS_BUILT} Python"
 else
@@ -33427,32 +35477,26 @@ if test "x$enable_debug$enable_assert" = "xnoyes"; then
   enable_debug="assert only"
 fi
 
-if test "x$gd_cv_type_off64_t" = "xyes"; then
-  lfs_transitional_api="yes"
-else
-  lfs_transitional_api="no"
-fi
-
 echo
 echo "Configuration summary: "
-echo "  ANSI C compatibility mode:    ${disable_c99}"
-echo "  LFS transitional API:         ${lfs_transitional_api}"
-echo "  Legacy API:                   ${include_legacy_api}"
-echo "  Verbose debugging:            ${enable_debug}"
-echo "  Use modules:                  ${use_modules}"
+echo "  ANSI C compatibility mode:     ${disable_c99}"
+echo "  Legacy API:                    ${include_legacy_api}"
+echo "  Verbose debugging:             ${enable_debug}"
+echo "  Fast unaligned memory access:  ${gd_unaligned_ok}"
+echo "  Use modules:                   ${use_modules}"
 if test "x${use_modules}" != "xno"; then
-  echo "  Thread-safe dynamic loading:  ${use_pthread}"
+  echo "  Thread-safe dynamic loading:   ${use_pthread}"
 fi
 echo
-echo "  Supported internal encodings:${ENCODINGS_BUILT}"
+echo "  Supported internal encodings: ${ENCODINGS_BUILT}"
 if test "x${use_modules}" != "xno"; then
-  echo "  Supported external encodings:${ENCODINGS_MODS}"
+  echo "  Supported external encodings: ${ENCODINGS_MODS}"
 fi
-echo "  Unsupported encodings:       ${ENCODINGS_LEFT}"
+echo "  Unsupported encodings:        ${ENCODINGS_LEFT}"
 echo
-echo "  Bindings built:              ${BINDINGS_BUILT}"
-echo "  Bindings not built:          ${BINDINGS_LEFT}"
+echo "  Bindings built:               ${BINDINGS_BUILT}"
+echo "  Bindings not built:           ${BINDINGS_LEFT}"
 if test "x$make_pybindings" != "xno"; then
-  echo "  NumPy support in Python:      ${have_numpy}"
+  echo "  NumPy support in Python:       ${have_numpy}"
 fi
 echo
diff --git a/configure.ac b/configure.ac
index 721b9a2..a2299f9 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1,4 +1,4 @@
-dnl Copyright (C) 2008-2011 D. V. Wiebe
+dnl Copyright (C) 2008-2013 D. V. Wiebe
 dnl
 dnllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllll
 dnl
@@ -21,7 +21,17 @@ dnl
 
 m4_include([m4/version.m4])
 
-AC_INIT([GetData],[getdata_version],[getdata-devel at lists.sourceforge.net])
+AC_INIT([GetData],[getdata_version],[getdata-devel at lists.sourceforge.net],,
+        [http://getdata.sourceforge.net/])
+
+AC_COPYRIGHT(
+[Parts of this program are copyright (C) 2008-2013 D. V. Wiebe.
+
+These parts may be redistributed and/or modified under the terms of the GNU
+Lesser General Public License as published by the Free Software Foundation;
+either version 2.1 of the License, or (at your option) any later version.
+See the file COPYING for details.]
+)
 
 AC_DEFINE([GETDATA_MAJOR], [getdata_major], [ The major version number ])
 AC_DEFINE([GETDATA_MINOR], [getdata_minor], [ The minor version number ])
@@ -29,6 +39,11 @@ AC_DEFINE([GETDATA_REVISION], [getdata_revision], [ The revision number ])
 AC_DEFINE([GETDATA_VERSION_SUFFIX], ["getdata_extra"],
           [ Other qualifiers on the version number triplet (if any) ])
 
+AC_SUBST([GETDATA_MAJOR], [getdata_major])
+AC_SUBST([GETDATA_MINOR], [getdata_minor])
+AC_SUBST([GETDATA_REVISION], [getdata_revision])
+AC_SUBST([GETDATA_VERSION_SUFFIX], [getdata_extra])
+
 AC_PREREQ([2.63])
 AC_CONFIG_MACRO_DIR([m4])
 
@@ -44,14 +59,15 @@ AC_SUBST(GETDATA_IFACE_AGE, [getdata_iface_age])
 AC_SUBST(GETDATAXX_VERSION, [getdataxx_version])
 AC_SUBST(FGETDATA_VERSION, [fgetdata_version])
 AC_SUBST(F95GETDATA_VERSION, [f95getdata_version])
+AC_SUBST(MATLABGETDATA_VERSION, [matlabgetdata_version])
 
 AC_CONFIG_SRCDIR([src/getdata.c])
-AC_CONFIG_HEADER([src/config.h])
+AC_CONFIG_HEADER([src/gd_config.h])
 
 dnl Features
 BUINDINGS_BUILT=
 BINDINGS_LEFT=
-ENCODINGS_BUILT=" raw ascii"
+ENCODINGS_BUILT=" raw ascii sie"
 ENCODINGS_LEFT=
 PRIVATE_LIBS=
 
@@ -59,6 +75,7 @@ echo "*** Checking GetData configuration"
 echo
 
 dnl Build/Host triplets
+AC_CANONICAL_BUILD
 AC_CANONICAL_HOST
 
 dnl Legacy API
@@ -104,7 +121,11 @@ if test "x$enable_debug" = "xyes"; then
   AC_DEFINE([GETDATA_DEBUG], [],
             [ Define to enable debugging messages ])
   enable_assert="yes"
+  GETDATA_DEBUG=1
+else
+  GETDATA_DEBUG=0
 fi
+AC_SUBST([GETDATA_DEBUG])
 
 AC_MSG_CHECKING([whether to enable assertions])
 AC_MSG_RESULT([$enable_assert])
@@ -130,6 +151,8 @@ make_cxxbindings="yes"
 make_f77bindings="yes"
 make_pybindings="yes"
 make_idlbindings="yes"
+make_perlbindings="yes"
+make_matlabbindings="yes"
 AC_ARG_ENABLE(bindings, AS_HELP_STRING([--disable-bindings],
               [don't build any bindings, just build the C library]),
               [
@@ -138,6 +161,8 @@ AC_ARG_ENABLE(bindings, AS_HELP_STRING([--disable-bindings],
                  make_f77bindings="no"
                  make_pybindings="no"
                  make_idlbindings="no"
+                 make_perlbindings="no"
+                 make_matlabbindings="no"
                fi
               ])
 
@@ -202,12 +227,7 @@ AC_ARG_ENABLE(python, AS_HELP_STRING([--disable-python],
               ])
 
 AC_MSG_CHECKING([whether to include the Python bindings])
-if test "x$disable_c99" = "xyes"; then
-  make_pybindings="no";
-  AC_MSG_RESULT([no (requires C99 compiler)])
-else
-  AC_MSG_RESULT([$make_pybindings])
-fi
+AC_MSG_RESULT([$make_pybindings])
 
 dnl IDL bindings
 AC_ARG_ENABLE(idl, AS_HELP_STRING([--disable-idl],
@@ -220,12 +240,33 @@ AC_ARG_ENABLE(idl, AS_HELP_STRING([--disable-idl],
               ])
 
 AC_MSG_CHECKING([whether to include the IDL bindings])
-if test "x$disable_c99" = "xyes"; then
-  make_idlbindings="no";
-  AC_MSG_RESULT([no (requires C99 compiler)])
-else
-  AC_MSG_RESULT([$make_idlbindings])
-fi
+AC_MSG_RESULT([$make_idlbindings])
+
+dnl Perl bindings
+AC_ARG_ENABLE(perl, AS_HELP_STRING([--disable-perl],
+              [don't build the Perl bindings (GetData)]),
+              [
+               case "${enableval}" in
+                 no) make_perlbindings="no" ;;
+                 *) make_perlbindings="yes" ;;
+               esac
+              ])
+
+AC_MSG_CHECKING([whether to include the Perl bindings])
+AC_MSG_RESULT([$make_perlbindings])
+
+dnl MATLAB bindings
+AC_ARG_ENABLE(matlab, AS_HELP_STRING([--disable-matlab],
+              [don't build the MATLAB bindings]),
+              [
+               case "${enableval}" in
+                 no) make_matlabbindings="no" ;;
+                 *) make_matlabbindings="yes" ;;
+               esac
+              ])
+
+AC_MSG_CHECKING([whether to include the MATLAB bindings])
+AC_MSG_RESULT([$make_matlabbindings])
 
 dnl Modules
 AC_ARG_ENABLE(modules, AS_HELP_STRING([--enable-modules],
@@ -257,7 +298,7 @@ AC_SUBST([moduledir])
 dnl LTDL
 AC_ARG_WITH([ltdl], AS_HELP_STRING([--with-ltdl=PREFIX],
               [if building modules, use the GNU ltdl library located in
-               PREFIX [autodetect]]),
+               PREFIX [default: autodetect]]),
               [
                case "${withval}" in
                  no) ltdl_prefix= ;;
@@ -281,11 +322,90 @@ echo "*** Initialising build system"
 echo
 AM_INIT_AUTOMAKE
 AC_PROG_LN_S
-AC_PROG_GREP
 AC_PROG_AWK
+AC_PROG_GREP
 AC_PROG_SED
+
+AC_ARG_VAR([DATE], \
+           [a date program which supports '+%...' conversion specifiers])
+AC_CHECK_PROGS([DATE], [date], [not found])
+
+AC_ARG_VAR([DIFF], [a POSIX-compatible diff])
 AC_CHECK_PROGS([DIFF], [diff], [])
+
+AC_ARG_VAR([JOT], [a BSD-style jot;]
+[SysV-derived systems (like GNU/Linux) may find it easier to use SEQ (q.v.)])
+AC_CHECK_PROGS([JOT], [jot], [not found])
+
+AC_ARG_VAR([PRINTF], [a POSIX-compatible printf])
+AC_CHECK_PROGS([PRINTF], [printf], [not found])
+
+AC_ARG_VAR([SEQ], [a SysV-style seq;]
+[BSD-derived systems (like MacOS X) may find it easier to use JOT (q.v.)])
+AC_CHECK_PROGS([SEQ], [seq], [not found])
+
 GD_MSYS_SHELL
+
+echo
+echo "*** Checking host environment"
+echo
+
+dnl unaligned memory access
+dnl user knows best
+AC_ARG_ENABLE([fast-unaligned], AS_HELP_STRING([--enable-fast-unaligned],
+  [use fast loads and stores with non-aligned data.  WARNING: Enabling this on ]
+  [a platform which does not support fast unaligned memory access may cause ]
+  [the library to silently corrupt data. [default: autodetect]]),
+  [
+   case "${enableval}" in
+     yes) gd_unaligned_override="yes" ;;
+     no) gd_unaligned_override="no" ;;
+     *) gd_unaligned_override="check" ;;
+   esac
+   ], [gd_unaligned_override="check"])
+
+AC_MSG_CHECKING([whether ${host} supports fast unaligned memory access])
+if test "x$gd_unaligned_override" = "xyes"; then
+  gd_unaligned_ok=yes
+  AC_MSG_RESULT([yes (forced)])
+elif test "x$gd_unaligned_override" = "xno"; then
+  gd_unaligned_ok=no
+  AC_MSG_RESULT([no (forced)])
+else
+  case "${host}" in
+    i?86-*-*|powerpc*-*-*|x86_64-*-*|armv[6789]*-*-*) gd_unaligned_ok=yes ;;
+  *) gd_unaligned_ok=no ;;
+  esac
+  AC_MSG_RESULT([$gd_unaligned_ok])
+fi
+
+if test "x$gd_unaligned_ok" = "xyes"; then
+  AC_DEFINE([UNALIGNED_ACCESS_OK], [1],
+            [Define to 1 if the platform supports fast unaligned memory access])
+fi
+
+dnl FDIRSEP is used in Fortran, where '\' should not be escaped.
+AC_MSG_CHECKING([the directory separator])
+case "${host}" in
+  *-*-djgpp|*-*-mingw32) GD_FDIRSEP=\\; GD_DIRSEP=\\\\ ;;
+  *) GD_FDIRSEP=/; GD_DIRSEP=/ ;;
+esac
+AC_SUBST([GD_FDIRSEP])
+AC_SUBST([GD_DIRSEP])
+AC_DEFINE_UNQUOTED([GD_DIRSEP], ['$GD_DIRSEP'],
+                   [ The directory separator between path elements ])
+AC_MSG_RESULT([$GD_FDIRSEP])
+
+case "${host}" in
+  *-pc-mingw*)
+  NO_UNDEFINED=" -no-undefined"
+  NO_DLOPEN_TESTS=1 ;;
+  *-pc-cygwin*)
+  NO_UNDEFINED=" -no-undefined -enable-auto-import"
+  NO_DLOPEN_TESTS=1 ;;
+  *) NO_DLOPEN_TESTS=0 ;;
+esac
+
 echo
 echo "*** Checking C compiler characteristics"
 echo
@@ -296,8 +416,6 @@ if test "x$disable_c99" != "xyes"; then
   AC_PROG_CC_C99
   if test "x$ac_cv_prog_cc_c99" = "xno"; then
     disable_c99="yes"
-    make_pybindings="no"
-    make_idlbindings="no"
   fi
 fi
 if test "x$disable_c99" = "xyes"; then
@@ -308,13 +426,14 @@ fi
 AC_SUBST([DEFINE_GD_NO_C99_API])
 
 AC_HEADER_STDC
-if test "x$make_cxxbindings" != "xno"; then
-  echo
-  echo "*** Checking C++ compiler characteristics"
-  echo
-  AC_PROG_CXX
-  AC_PROG_CXX_C_O
-fi
+AM_PROG_AS
+
+echo
+echo "*** Checking C++ compiler characteristics"
+echo
+AC_PROG_CXX
+AC_PROG_CXX_C_O
+
 if test "x$make_f77bindings" != "xno"; then
   echo
   echo "*** Checking Fortran 77 compiler characteristics"
@@ -360,14 +479,6 @@ echo "*** Building libtool"
 echo
 LT_INIT([dlopen])
 AC_SUBST([LIBTOOL_DEPS])
-
-case "${host}" in
-  *-pc-mingw*|*-pc-cygwin*)
-  NO_UNDEFINED=" -no-undefined --enable-auto-import";
-  NO_DLOPEN_TESTS=1 ;;
-  *) NO_DLOPEN_TESTS=0 ;;
-esac
-
 LT_OUTPUT
 
 dnl libltdl stuff
@@ -386,7 +497,7 @@ if test "x${use_modules}" != "xno"; then
   LIBS=$saved_libs
 
   if test "x$have_ltdl" == "xno"; then
-    AC_MSG_ERROR([libltdl is required to build modules.  Please either specify the location of the libltdl library using --with-ldtl-prefix=PREFIX or else disable the building of modules by using --disable-modules.])
+    AC_MSG_ERROR([libltdl is required to build modules.  Please either specify the location of the libltdl library using --with-ldtl=PREFIX or else disable the building of modules by using --disable-modules.])
   fi
 
   if test "x$ltdl_prefix" != "x"; then
@@ -397,6 +508,16 @@ if test "x${use_modules}" != "xno"; then
     AC_CHECK_HEADERS(ltdl.h)
     LIBLTDL="-lltdl"
   fi
+
+  dnl pthread
+  AC_SEARCH_LIBS([pthread_mutex_lock],[pthread],
+                 [use_pthread=yes
+                  AC_DEFINE([USE_PTHREAD], [],
+                            [Define if you have a POSIX compliant thread ]
+                            [library])
+                  ],
+                  [use_pthread=no])
+  AC_CHECK_HEADERS(pthread.h)
 fi
 AC_SUBST([LIBLTDL])
 AC_SUBST([LTDLINCL])
@@ -422,10 +543,12 @@ echo
 echo "*** Checking additional compiler characteristics"
 echo
 AC_C_INLINE
+AC_C_RESTRICT
+GD_C_RESTRICT_ARRAY
 GD_PROG_CC_WALL
 GD_PROG_CC_WEXTRA
 
-if test "x$make_c++bindings" != "xno"; then
+if test "x$make_cxxbindings" != "xno"; then
   GD_PROG_CXX_WALL
   GD_PROG_CXX_WEXTRA
 fi
@@ -433,20 +556,25 @@ fi
 if test "x$make_f77bindings" != "xno"; then
   GD_PROG_F77_WALL
   GD_PROG_F77_WEXTRA
+  GD_PROG_F77_FNO_BACKSLASH
   GD_LANG_F77_COMPILER_INTEL
 fi
 
+dnl F77 stuff
+if test "x$make_f77bindings" != "xno"; then
+  AC_F77_WRAPPERS
+  if test "x$ac_cv_f77_mangling" == "xunknown"; then
+    make_f77bindings=no
+    make_f95bindings=no
+  fi
+fi
+
 if test "x$make_f95bindings" != "xno"; then
   GD_PROG_FC_WALL
   GD_PROG_FC_WEXTRA
   GD_LANG_FC_COMPILER_INTEL
 fi
 
-dnl F77 stuff
-if test "x$make_f77bindings" != "xno"; then
-  AC_F77_WRAPPERS
-fi
-
 AC_MSG_CHECKING([if we're linking against the Microsoft C Run-Time]) #'
 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([], [[#ifndef __MSVCRT__
        choke me
@@ -464,78 +592,32 @@ if test "$gd_msvcrt" = "yes"; then
 fi
 
 dnl Declare a few feature test macros
-AC_DEFINE([_BSD_SOURCE], [], [ Expose BSD-derived definitions ])
-AC_DEFINE([_SVID_SOURCE], [], [ Expose System V-derived definitions ])
-AC_DEFINE([_POSIX_SOURCE], [], [ Expose POSIX.1-1990 conforming definitions ])
+AC_DEFINE([_GNU_SOURCE], [1], [ Expose GNU extensions ])
+AC_DEFINE([_BSD_SOURCE], [1], [ Expose BSD-derived definitions ])
+AC_DEFINE([_SVID_SOURCE], [1], [ Expose System V-derived definitions ])
+AC_DEFINE([_POSIX_SOURCE], [1], [ Expose POSIX.1-1990 conforming definitions ])
 AC_DEFINE([_POSIX_C_SOURCE], [200809L],
           [ Expose POSIX:2008 conforming definitions ])
 
 dnl libraries
 echo
-echo "*** Looking for library functions"
+echo "*** Looking for additional libraries"
 echo
 AC_SEARCH_LIBS([ceil],[m])
 
-dnl pthread
-if test "x${use_modules}" != "xno"; then
-  AC_SEARCH_LIBS([pthread_mutex_lock],[pthread],
-                 [use_pthread=yes
-                  AC_DEFINE([USE_PTHREAD], [],
-                          [Define if you have a POSIX compliant thread library])
-                  ],
-                  [use_pthread=no])
-  AC_CHECK_HEADERS(pthread.h)
-fi
-
-dnl functions
-AC_CHECK_FUNCS([_commit fchmod _fdopen fseeko fseeko64 fsync ftello ftello64 \
-                getcwd _getcwd getdelim gmtime_r _lseeki64 _mkdir mkstemp nan \
-                _open _read _rmdir _snprintf stat64 _stat64 _strtoi64 strtoll \
-                _strtoui64 strtoull _unlink _write])
-if test "x$disable_c99" = "xno"; then
-  AC_CHECK_FUNCS([cabs])
-fi
-AC_FUNC_STRERROR_R
-
 dnl headers
 echo
 echo "*** Looking for additional header files"
 echo
-AC_CHECK_HEADERS([direct.h fcntl.h libgen.h stdint.h unistd.h])
+AC_CHECK_HEADERS([asm/unaligned.h Availability.h byteswap.h direct.h fcntl.h \
+                  float.h inttypes.h io.h libgen.h libkern/OSByteOrder.h \
+                  math.h stddef.h stdint.h sys/endian.h sys/file.h sys/param.h \
+                  sys/stat.h sys/types.h sys/wait.h unistd.h])
 if test "x$disable_c99" = "xno"; then
 AC_CHECK_HEADERS([complex.h])
 fi
 AC_HEADER_DIRENT
 
-AC_CHECK_HEADERS([io.h])
-
-AC_MSG_CHECKING([whether mkdir accepts two arguments])
-AC_COMPILE_IFELSE([AC_LANG_PROGRAM([
-#if HAVE_SYS_STAT_H
-#include <sys/stat.h>
-#endif
-#if HAVE_SYS_TYPES_H
-#include <sys/types.h>
-#endif
-#if HAVE_IO_H
-#include <io.h>
-#endif
-], [[
-#ifdef HAVE__MKDIR
-_mkdir("x", 00777);
-#else
-mkdir("x", 00777);
-#endif
-]])],
-[gd_2arg_mkdir=yes],
-[gd_2arg_mkdir=no])
-AC_MSG_RESULT([$gd_2arg_mkdir])
-
-if test $gd_2arg_mkdir = "no"; then
-  AC_DEFINE([MKDIR_NO_MODE], [1],
-            [ Define to 1 if the `mkdir' function takes only one argument.])
-fi dnl`
-
 dnl types
 echo
 echo "*** Checking data types"
@@ -600,17 +682,6 @@ GD_CHECK_LFS_TYPE([off64_t],[
 #endif
 ])
 
-if test "x$gd_cv_c_need_lfs_defined" = "xyes"; then
-  AC_DEFINE([_LARGEFILE64_SOURCE], [1],
-            [ Additional functionality from LFS for large files. ])
-fi
-
-if test "x$gd_cv_type_off64_t" = "xyes"; then
-  dnl Assume we have the entire LFS defined transitional API
-  AC_DEFINE([HAVE_OFF64_T], [1],
-            [ Define to 1 if the system has the type `off64_t'. ]) dnl `
-fi
-
 dnl integer sizes
 AC_CHECK_SIZEOF([short int])
 AC_CHECK_SIZEOF([int])
@@ -620,6 +691,7 @@ AC_CHECK_SIZEOF([unsigned short int])
 AC_CHECK_SIZEOF([unsigned int])
 AC_CHECK_SIZEOF([unsigned long int])
 AC_CHECK_SIZEOF([unsigned long long int])
+AC_CHECK_SIZEOF([void *])
 
 dnl C89 API types
 if test $ac_cv_sizeof_int -eq 2; then
@@ -652,12 +724,101 @@ elif test $ac_cv_sizeof_long_long_int -eq 8; then
   gd_int64_t="long long int"
 fi
 
-DEFINE_gd_int16_t="#define gd_int16_t $gd_int16_t";
-DEFINE_gd_uint16_t="#define gd_uint16_t $gd_uint16_t";
-DEFINE_gd_int64_t="#define gd_int64_t $gd_int64_t";
+if test $ac_cv_sizeof_unsigned_int -eq 8; then
+  gd_uint64_t="unsigned int"
+elif test $ac_cv_sizeof_unsigned_short_int -eq 8; then
+  gd_uint64_t="unsigned short int"
+elif test $ac_cv_sizeof_unsigned_long_int -eq 8; then
+  gd_uint64_t="unsigned long int"
+elif test $ac_cv_sizeof_unsigned_long_long_int -eq 8; then
+  gd_uint64_t="unsigned long long int"
+fi
+
+if test "x$gd_cv_type_off64_t" = "xyes"; then
+  dnl Assume we have the entire LFS defined transitional API
+  AC_DEFINE([HAVE_OFF64_T], [1],
+            [ Define to 1 if the system has the type `off64_t'. ]) dnl `
+fi
+
+DEFINE_gd_int16_t="# define gd_int16_t $gd_int16_t";
+DEFINE_gd_uint16_t="# define gd_uint16_t $gd_uint16_t";
+DEFINE_gd_int64_t="# define gd_int64_t $gd_int64_t";
+DEFINE_gd_uint64_t="# define gd_uint64_t $gd_uint64_t";
 AC_SUBST([DEFINE_gd_int16_t])
 AC_SUBST([DEFINE_gd_uint16_t])
 AC_SUBST([DEFINE_gd_int64_t])
+AC_SUBST([DEFINE_gd_uint64_t])
+
+dnl library functions
+echo
+echo "*** Looking for additional library functions"
+echo
+AC_CHECK_FUNCS([basename _chsize _chsize_s _commit fchmod _fdopen fdopendir \
+                _finite fpathconf fseeko fseeko64 _fstat fstat64 _fstat64 \
+                fstatat fstatat64 fsync ftello ftello64 ftruncate ftruncate64 \
+                getcwd _getcwd getdelim gmtime_r isnan _isnan lseek64 \
+                _lseeki64 lstat lstat64 _mkdir mkfifo nan _open openat \
+                pathconf _read readdir_r readlink renameat _rmdir snprintf \
+                _snprintf stat64 _stat64 _strtoi64 strtoll strtoq _strtoui64 \
+                strtoull strtouq symlink _unlink unlinkat _write])
+if test "x$disable_c99" = "xno"; then
+  AC_CHECK_FUNCS([cabs])
+fi
+AC_FUNC_STRERROR_R
+AC_FUNC_FORK
+
+AC_MSG_CHECKING([whether mkdir accepts two arguments])
+AC_COMPILE_IFELSE([AC_LANG_PROGRAM([
+#if HAVE_SYS_STAT_H
+#include <sys/stat.h>
+#endif
+#if HAVE_SYS_TYPES_H
+#include <sys/types.h>
+#endif
+#if HAVE_IO_H
+#include <io.h>
+#endif
+], [[
+#ifdef HAVE__MKDIR
+_mkdir("x", 00777);
+#else
+mkdir("x", 00777);
+#endif
+]])],
+[gd_2arg_mkdir=yes],
+[gd_2arg_mkdir=no])
+AC_MSG_RESULT([$gd_2arg_mkdir])
+
+if test $gd_2arg_mkdir = "no"; then
+  AC_DEFINE([MKDIR_NO_MODE], [1],
+            [ Define to 1 if the `mkdir' function takes only one argument.])
+fi dnl`
+
+AC_CHECK_DECLS([isfinite],,,
+               [
+#ifdef HAVE_MATH_H
+#include <math.h>
+#endif
+])
+AC_CHECK_DECLS([bswap16, bswap_16, OSSwapInt16],,,
+              [
+#ifdef HAVE_BYTESWAP_H
+#include <byteswap.h>
+#endif
+#ifdef HAVE_SYS_ENDIAN_H
+#include <sys/endian.h>
+#endif
+#ifdef HAVE_LIBKERN_OSBYTEORDER_H
+#include <libkern/OSByteOrder.h>
+#endif
+])
+
+AC_CHECK_DECLS([get_unaligned, put_unaligned],,,
+              [
+#ifdef HAVE_ASM_UNALIGNED_H
+#include <asm/unaligned.h>
+#endif
+])
 
 dnl python
 if test "x$make_pybindings" = "xyes"; then
@@ -698,7 +859,7 @@ EOF
 
   if test "x$have_numpy" = "xyes"; then
     AC_DEFINE([USE_NUMPY], [],
-              [ Define to to enable NumPy support in the Python bindings ])
+              [ Define to enable NumPy support in the Python bindings ])
   fi
 fi
 
@@ -707,26 +868,133 @@ if test "x$make_idlbindings" = "xyes"; then
   echo
   echo "*** Configuring interactive data language (IDL) bindings"
   echo
+  AC_MSG_CHECKING([whether C99 is supported])
+  if test "x$disable_c99" = "xno"; then
+    AC_MSG_RESULT([yes])
+  else
+    AC_MSG_RESULT([no])
+    make_idlbindings=no
+  fi
+fi
+if test "x$make_idlbindings" = "xyes"; then
   GD_IDL([5.5])
   if test "x$have_idl" = "xno"; then
     make_idlbindings="no"
-  else
-    dnl build date
-    AC_CHECK_PROGS([DATE], [date], [not found])
-    if test "x$DATE" == "xnot found"; then
-      BUILD_DATE="Build date unspecified"
-    else
-      BUILD_DATE=`$DATE`
-    fi
-    AC_SUBST([BUILD_DATE])
+  fi
+fi
+
+dnl perl
+if test "x$make_perlbindings" = "xyes"; then
+  echo
+  echo "*** Configuring Perl bindings"
+  echo
+  GD_PERL
+  if test "x$have_perl" = "xno"; then
+    make_perlbindings=no
+  fi
+fi
+
+dnl matlab
+if test "x$make_matlabbindings" = "xyes"; then
+  echo
+  echo "*** Configuring MATLAB bindings"
+  echo
+  GD_MATLAB
+  if test "x$have_matlab" = "xno"; then
+    make_matlabbindings=no
   fi
 fi
 
 dnl external encodings
-GD_CHECK_ENCODING([bzip2],[bz2],[BZ2_bzReadOpen],[bzlib.h],[bzip2],[bunzip2])
-GD_CHECK_ENCODING([slim],[slim],[slimopen],[slimlib.h],[slim slimdata],[unslim],[])
+GD_CHECK_ENCODING([bzip2],[bz2],[BZ2_bzReadOpen],[bzlib.h],[bzip2],[bunzip2],[])
 GD_CHECK_ENCODING([gzip],[z],[gzopen],[zlib.h],[gzip],[gunzip],[])
 GD_CHECK_ENCODING([lzma],[lzma],[lzma_auto_decoder],[lzma.h],[xz],[],[])
+GD_CHECK_ENCODING([slim],[slim],[slimopen],[slimlib.h], [slim slimdata],
+                  [unslim],[slimdopen])
+GD_CHECK_ENCODING([zzip],[zzip],[zzip_open],[zzip/lib.h],[zip],[unzip],[])
+
+dnl zzslim hackery -- there's no easy way to check whether slim supports zzip
+AC_ARG_ENABLE(zzslim, AS_HELP_STRING([--enable-zzslim],
+              [skip probing for zzslim required features and enable the zzslim
+               encoding.  The default is to autodetect support.  Note: zzslim
+               encoding support requires both slim and zzip encoding support.]),
+              [
+               case "${enableval}" in
+                 no) zzslim_override="no" ;;
+                 *) zzslim_override="yes" ;;
+               esac
+              ], [ zzslim_override="auto" ])
+m4_divert_once([HELP_ENABLE], AS_HELP_STRING([--disable-zzslim],
+            [disable zzslim encodings support]))
+
+echo
+echo "*** Configuring zzslim support "
+echo
+if test $zzslim_override = "no"; then
+  AC_MSG_CHECKING([for zzslim support])
+  AC_MSG_RESULT([no (forced)])
+  use_zzslim=no
+else
+  AC_MSG_CHECKING([for slim support])
+  AC_MSG_RESULT([$use_slim])
+  AC_MSG_CHECKING([for zzip support])
+  AC_MSG_RESULT([$use_zzip])
+  if test "$use_slim$use_zzip" == "yesyes"; then
+    if test $zzslim_override = "yes"; then
+      AC_MSG_CHECKING([for zzslim support])
+      AC_MSG_RESULT([yes (forced)])
+      use_zzslim=yes
+    elif test "x$CXX" = "x"; then
+      AC_MSG_CHECKING([for zzslim support])
+      AC_MSG_RESULT([no (no C++ compiler available for configure test)])
+      use_zzslim=no
+    else
+      dnl try linking to the slim library to see if it contains the unprototyped
+      dnl   ibitstream::ibitstream(ZZIP_FILE *file, int buffersize)
+      dnl given that this function isn't public, this is probably easily broken
+      AC_MSG_CHECKING([whether -lslim contains zzip capability])
+      AC_LANG_PUSH([C++])
+      saved_ldflags=$LDFLAGS
+      saved_libs=$LIBS
+      LDFLAGS="$SLIM_LDFLAGS $LDFLAGS"
+      LIBS="$SLIM_LIBS $LIBS"
+      AC_LINK_IFELSE([AC_LANG_PROGRAM(
+                      [[
+                       struct zzip_file;
+                       typedef struct zzip_file ZZIP_FILE;
+                       class ibitstream {
+                       public:
+                       ibitstream(ZZIP_FILE *file, int buffersize);
+                     };
+                     ]],
+                     [[
+                      ZZIP_FILE *file;
+                      ibitstream foo(file, 0);
+                      ]]
+                     )], [slim_zzip="yes"], [slim_zzip="no"])
+      AC_MSG_RESULT([$slim_zzip])
+      LDFLAGS=$saved_ldflags
+      LIBS=$saved_libs
+      AC_LANG_POP
+
+      use_zzslim=$slim_zzip
+    fi
+  else
+    use_zzslim="no"
+  fi
+fi
+
+dnl add to summary and private lib list
+if test "x$use_zzslim" != "xno"; then
+  AC_DEFINE([USE_ZZSLIM], [], [ Define to enable zzslim support ])
+  if test "x$use_modules" != "xno"; then
+    ENCODINGS_MODS="${ENCODINGS_MODS} zzslim";
+  else
+    ENCODINGS_BUILT="${ENCODINGS_BUILT} zzslim";
+  fi
+else
+  ENCODINGS_LEFT="${ENCODINGS_LEFT} zzslim";
+fi
 
 if test ! -z "${LIBS}"; then
   PRIVATE_LIBS="${LIBS} ${PRIVATE_LIBS}"
@@ -756,9 +1024,15 @@ AC_CONFIG_FILES([bindings/cxx/Makefile])
 AC_CONFIG_FILES([bindings/cxx/test/Makefile])
 AC_CONFIG_FILES([bindings/f77/Makefile])
 AC_CONFIG_FILES([bindings/f77/test/Makefile])
+AC_CONFIG_FILES([bindings/f77/test/test_getdata.f])
 AC_CONFIG_FILES([bindings/idl/Makefile])
 AC_CONFIG_FILES([bindings/idl/makedlm.sh])
 AC_CONFIG_FILES([bindings/idl/test/Makefile])
+AC_CONFIG_FILES([bindings/matlab/Makefile])
+AC_CONFIG_FILES([bindings/matlab/make_contents.sh])
+AC_CONFIG_FILES([bindings/matlab/test/Makefile])
+AC_CONFIG_FILES([bindings/perl/Makefile])
+AC_CONFIG_FILES([bindings/perl/Build.PL])
 AC_CONFIG_FILES([bindings/python/Makefile])
 AC_CONFIG_FILES([bindings/python/test/Makefile])
 AC_CONFIG_FILES([doc/Makefile])
@@ -767,8 +1041,8 @@ AC_CONFIG_FILES([man/gd_alter_encoding.3])
 AC_CONFIG_FILES([man/gd_alter_endianness.3])
 AC_CONFIG_FILES([man/gd_alter_frameoffset.3])
 AC_CONFIG_FILES([src/Makefile])
-dnl This doubling allows us to build getdata.h as a normal AC_CONFIG_FILE, but use
-dnl AC_CONFIG_HEADERS to check whether it has changed.
+dnl This doubling allows us to build getdata.h as a normal AC_CONFIG_FILE, but
+dnl use AC_CONFIG_HEADERS to check whether it has changed.
 AC_CONFIG_FILES([src/getdata.ah:src/getdata.h.in])
 AC_CONFIG_HEADERS([src/getdata.h:src/getdata.ah], [chmod a-w src/getdata.h])
 AC_CONFIG_FILES([src/getdata.pc])
@@ -784,22 +1058,29 @@ AM_CONDITIONAL(FC_WALL, [test "x$gd_cv_prog_fc_wall" == "xyes"])
 AM_CONDITIONAL(CC_WEXTRA, [test "x$gd_cv_prog_cc_wextra" == "xyes"])
 AM_CONDITIONAL(CXX_WEXTRA, [test "x$gd_cv_prog_cxx_wextra" == "xyes"])
 AM_CONDITIONAL(F77_WEXTRA, [test "x$gd_cv_prog_f77_wextra" == "xyes"])
+AM_CONDITIONAL(F77_FNO_BACKSLASH,
+               [test "x$gd_cv_prog_f77_fno_backslash" == "xyes"])
 AM_CONDITIONAL(FC_WEXTRA, [test "x$gd_cv_prog_fc_wextra" == "xyes"])
 AM_CONDITIONAL(INTEL_F77_COMPILER,
                [test "x$gd_cv_f77_compiler_intel" == "xyes"])
 AM_CONDITIONAL(INTEL_FC_COMPILER, [test "x$gd_cv_fc_compiler_intel" == "xyes"])
-AM_CONDITIONAL(LFS_TRANSITIONAL_API, [test "x$gd_cv_type_off64_t" = "xyes"])
 AM_CONDITIONAL(INCLUDE_LEGACY_API, [test "x$include_legacy_api" != "xno"])
 AM_CONDITIONAL(MAKE_CXXBINDINGS, [test "x$make_cxxbindings" = "xyes"])
 AM_CONDITIONAL(MAKE_F77BINDINGS, [test "x$make_f77bindings" != "xno"])
 AM_CONDITIONAL(MAKE_F95BINDINGS, [test "x$make_f95bindings" = "xyes"])
 AM_CONDITIONAL(MAKE_PYBINDINGS, [test "x$make_pybindings" = "xyes"])
 AM_CONDITIONAL(MAKE_IDLBINDINGS, [test "x$make_idlbindings" = "xyes"])
+AM_CONDITIONAL(MAKE_PERLBINDINGS, [test "x$make_perlbindings" = "xyes"])
+AM_CONDITIONAL(MAKE_MATLABBINDINGS, [test "x$make_matlabbindings" = "xyes"])
 AM_CONDITIONAL(USE_MODULES, [test "x$use_modules" != "xno"])
 AM_CONDITIONAL(TEST_PYTHON, [test "x$NO_DLOPEN_TESTS" = "x0"])
 AM_CONDITIONAL(TEST_IDL, [test "x$NO_DLOPEN_TESTS" = "x0"])
+AM_CONDITIONAL(TEST_PERL, [test "x$HAVE_Test__Harness" = "xyes"])
+AM_CONDITIONAL(TEST_MATLAB, [test "x$NO_DLOPEN_TESTS" = "x0"])
 AM_CONDITIONAL(HAVE_DIFF, [test "x$DIFF" != "x"])
-AM_CONDITIONAL(GDIDL_EXTERNAL, [false])
+AM_CONDITIONAL(USE_ZZSLIM, [test "x$use_zzslim" = "xyes"])
+AM_CONDITIONAL(GD_EXTERNAL, [false])
+
 
 dnl we do this here to avoid screwing up other tests
 LDFLAGS="${LDFLAGS}${NO_UNDEFINED}"
@@ -831,6 +1112,18 @@ else
   BINDINGS_LEFT="${BINDINGS_LEFT} IDL"
 fi
 
+if test "x$make_matlabbindings" != "xno"; then
+  BINDINGS_BUILT="${BINDINGS_BUILT} MATLAB"
+else
+  BINDINGS_LEFT="${BINDINGS_LEFT} MATLAB"
+fi
+
+if test "x$make_perlbindings" != "xno"; then
+  BINDINGS_BUILT="${BINDINGS_BUILT} Perl"
+else
+  BINDINGS_LEFT="${BINDINGS_LEFT} Perl"
+fi
+
 if test "x$make_pybindings" != "xno"; then
   BINDINGS_BUILT="${BINDINGS_BUILT} Python"
 else
@@ -857,32 +1150,26 @@ if test "x$enable_debug$enable_assert" = "xnoyes"; then
   enable_debug="assert only"
 fi
 
-if test "x$gd_cv_type_off64_t" = "xyes"; then
-  lfs_transitional_api="yes"
-else
-  lfs_transitional_api="no"
-fi
-
 echo
 echo "Configuration summary: "
-echo "  ANSI C compatibility mode:    ${disable_c99}"
-echo "  LFS transitional API:         ${lfs_transitional_api}"
-echo "  Legacy API:                   ${include_legacy_api}"
-echo "  Verbose debugging:            ${enable_debug}"
-echo "  Use modules:                  ${use_modules}"
+echo "  ANSI C compatibility mode:     ${disable_c99}"
+echo "  Legacy API:                    ${include_legacy_api}"
+echo "  Verbose debugging:             ${enable_debug}"
+echo "  Fast unaligned memory access:  ${gd_unaligned_ok}"
+echo "  Use modules:                   ${use_modules}"
 if test "x${use_modules}" != "xno"; then
-  echo "  Thread-safe dynamic loading:  ${use_pthread}"
+  echo "  Thread-safe dynamic loading:   ${use_pthread}"
 fi
 echo
-echo "  Supported internal encodings:${ENCODINGS_BUILT}"
+echo "  Supported internal encodings: ${ENCODINGS_BUILT}"
 if test "x${use_modules}" != "xno"; then
-  echo "  Supported external encodings:${ENCODINGS_MODS}"
+  echo "  Supported external encodings: ${ENCODINGS_MODS}"
 fi
-echo "  Unsupported encodings:       ${ENCODINGS_LEFT}"
+echo "  Unsupported encodings:        ${ENCODINGS_LEFT}"
 echo
-echo "  Bindings built:              ${BINDINGS_BUILT}"
-echo "  Bindings not built:          ${BINDINGS_LEFT}"
+echo "  Bindings built:               ${BINDINGS_BUILT}"
+echo "  Bindings not built:           ${BINDINGS_LEFT}"
 if test "x$make_pybindings" != "xno"; then
-  echo "  NumPy support in Python:      ${have_numpy}"
+  echo "  NumPy support in Python:       ${have_numpy}"
 fi
 echo
diff --git a/depcomp b/depcomp
index df8eea7..25a39e6 100755
--- a/depcomp
+++ b/depcomp
@@ -1,10 +1,10 @@
 #! /bin/sh
 # depcomp - compile a program generating dependencies as side-effects
 
-scriptversion=2009-04-28.21; # UTC
+scriptversion=2012-03-27.16; # UTC
 
-# Copyright (C) 1999, 2000, 2003, 2004, 2005, 2006, 2007, 2009 Free
-# Software Foundation, Inc.
+# Copyright (C) 1999, 2000, 2003, 2004, 2005, 2006, 2007, 2009, 2010,
+# 2011, 2012 Free Software Foundation, Inc.
 
 # This program is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -28,7 +28,7 @@ scriptversion=2009-04-28.21; # UTC
 
 case $1 in
   '')
-     echo "$0: No command.  Try \`$0 --help' for more information." 1>&2
+     echo "$0: No command.  Try '$0 --help' for more information." 1>&2
      exit 1;
      ;;
   -h | --h*)
@@ -40,11 +40,11 @@ as side-effects.
 
 Environment variables:
   depmode     Dependency tracking mode.
-  source      Source file read by `PROGRAMS ARGS'.
-  object      Object file output by `PROGRAMS ARGS'.
+  source      Source file read by 'PROGRAMS ARGS'.
+  object      Object file output by 'PROGRAMS ARGS'.
   DEPDIR      directory where to store dependencies.
   depfile     Dependency file to output.
-  tmpdepfile  Temporary file to use when outputing dependencies.
+  tmpdepfile  Temporary file to use when outputting dependencies.
   libtool     Whether libtool is used (yes/no).
 
 Report bugs to <bug-automake at gnu.org>.
@@ -57,6 +57,12 @@ EOF
     ;;
 esac
 
+# A tabulation character.
+tab='	'
+# A newline character.
+nl='
+'
+
 if test -z "$depmode" || test -z "$source" || test -z "$object"; then
   echo "depcomp: Variables source, object and depmode must be set" 1>&2
   exit 1
@@ -90,10 +96,24 @@ if test "$depmode" = msvcmsys; then
    # This is just like msvisualcpp but w/o cygpath translation.
    # Just convert the backslash-escaped backslashes to single forward
    # slashes to satisfy depend.m4
-   cygpath_u="sed s,\\\\\\\\,/,g"
+   cygpath_u='sed s,\\\\,/,g'
    depmode=msvisualcpp
 fi
 
+if test "$depmode" = msvc7msys; then
+   # This is just like msvc7 but w/o cygpath translation.
+   # Just convert the backslash-escaped backslashes to single forward
+   # slashes to satisfy depend.m4
+   cygpath_u='sed s,\\\\,/,g'
+   depmode=msvc7
+fi
+
+if test "$depmode" = xlc; then
+   # IBM C/C++ Compilers xlc/xlC can output gcc-like dependency informations.
+   gccflag=-qmakedep=gcc,-MF
+   depmode=gcc
+fi
+
 case "$depmode" in
 gcc3)
 ## gcc 3 implements dependency tracking that does exactly what
@@ -148,20 +168,21 @@ gcc)
 ## The second -e expression handles DOS-style file names with drive letters.
   sed -e 's/^[^:]*: / /' \
       -e 's/^['$alpha']:\/[^:]*: / /' < "$tmpdepfile" >> "$depfile"
-## This next piece of magic avoids the `deleted header file' problem.
+## This next piece of magic avoids the "deleted header file" problem.
 ## The problem is that when a header file which appears in a .P file
 ## is deleted, the dependency causes make to die (because there is
 ## typically no way to rebuild the header).  We avoid this by adding
 ## dummy dependencies for each header file.  Too bad gcc doesn't do
 ## this for us directly.
-  tr ' ' '
-' < "$tmpdepfile" |
-## Some versions of gcc put a space before the `:'.  On the theory
+  tr ' ' "$nl" < "$tmpdepfile" |
+## Some versions of gcc put a space before the ':'.  On the theory
 ## that the space means something, we add a space to the output as
-## well.
+## well.  hp depmode also adds that space, but also prefixes the VPATH
+## to the object.  Take care to not repeat it in the output.
 ## Some versions of the HPUX 10.20 sed can't process this invocation
 ## correctly.  Breaking it into two sed invocations is a workaround.
-    sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
+    sed -e 's/^\\$//' -e '/^$/d' -e "s|.*$object$||" -e '/:$/d' \
+      | sed -e 's/$/ :/' >> "$depfile"
   rm -f "$tmpdepfile"
   ;;
 
@@ -193,18 +214,15 @@ sgi)
     # clever and replace this with sed code, as IRIX sed won't handle
     # lines with more than a fixed number of characters (4096 in
     # IRIX 6.2 sed, 8192 in IRIX 6.5).  We also remove comment lines;
-    # the IRIX cc adds comments like `#:fec' to the end of the
+    # the IRIX cc adds comments like '#:fec' to the end of the
     # dependency line.
-    tr ' ' '
-' < "$tmpdepfile" \
+    tr ' ' "$nl" < "$tmpdepfile" \
     | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' | \
-    tr '
-' ' ' >> "$depfile"
+    tr "$nl" ' ' >> "$depfile"
     echo >> "$depfile"
 
     # The second pass generates a dummy entry for each header file.
-    tr ' ' '
-' < "$tmpdepfile" \
+    tr ' ' "$nl" < "$tmpdepfile" \
    | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \
    >> "$depfile"
   else
@@ -216,10 +234,17 @@ sgi)
   rm -f "$tmpdepfile"
   ;;
 
+xlc)
+  # This case exists only to let depend.m4 do its work.  It works by
+  # looking at the text of this script.  This case will never be run,
+  # since it is checked for above.
+  exit 1
+  ;;
+
 aix)
   # The C for AIX Compiler uses -M and outputs the dependencies
   # in a .u file.  In older versions, this file always lives in the
-  # current directory.  Also, the AIX compiler puts `$object:' at the
+  # current directory.  Also, the AIX compiler puts '$object:' at the
   # start of each line; $object doesn't have directory information.
   # Version 6 uses the directory in both cases.
   dir=`echo "$object" | sed -e 's|/[^/]*$|/|'`
@@ -249,12 +274,11 @@ aix)
     test -f "$tmpdepfile" && break
   done
   if test -f "$tmpdepfile"; then
-    # Each line is of the form `foo.o: dependent.h'.
+    # Each line is of the form 'foo.o: dependent.h'.
     # Do two passes, one to just change these to
-    # `$object: dependent.h' and one to simply `dependent.h:'.
+    # '$object: dependent.h' and one to simply 'dependent.h:'.
     sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile"
-    # That's a tab and a space in the [].
-    sed -e 's,^.*\.[a-z]*:[	 ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile"
+    sed -e 's,^.*\.[a-z]*:['"$tab"' ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile"
   else
     # The sourcefile does not contain any dependencies, so just
     # store a dummy comment line, to avoid errors with the Makefile
@@ -265,23 +289,26 @@ aix)
   ;;
 
 icc)
-  # Intel's C compiler understands `-MD -MF file'.  However on
-  #    icc -MD -MF foo.d -c -o sub/foo.o sub/foo.c
+  # Intel's C compiler anf tcc (Tiny C Compiler) understand '-MD -MF file'.
+  # However on
+  #    $CC -MD -MF foo.d -c -o sub/foo.o sub/foo.c
   # ICC 7.0 will fill foo.d with something like
   #    foo.o: sub/foo.c
   #    foo.o: sub/foo.h
-  # which is wrong.  We want:
+  # which is wrong.  We want
   #    sub/foo.o: sub/foo.c
   #    sub/foo.o: sub/foo.h
   #    sub/foo.c:
   #    sub/foo.h:
   # ICC 7.1 will output
   #    foo.o: sub/foo.c sub/foo.h
-  # and will wrap long lines using \ :
+  # and will wrap long lines using '\':
   #    foo.o: sub/foo.c ... \
   #     sub/foo.h ... \
   #     ...
-
+  # tcc 0.9.26 (FIXME still under development at the moment of writing)
+  # will emit a similar output, but also prepend the continuation lines
+  # with horizontal tabulation characters.
   "$@" -MD -MF "$tmpdepfile"
   stat=$?
   if test $stat -eq 0; then :
@@ -290,15 +317,21 @@ icc)
     exit $stat
   fi
   rm -f "$depfile"
-  # Each line is of the form `foo.o: dependent.h',
-  # or `foo.o: dep1.h dep2.h \', or ` dep3.h dep4.h \'.
+  # Each line is of the form 'foo.o: dependent.h',
+  # or 'foo.o: dep1.h dep2.h \', or ' dep3.h dep4.h \'.
   # Do two passes, one to just change these to
-  # `$object: dependent.h' and one to simply `dependent.h:'.
-  sed "s,^[^:]*:,$object :," < "$tmpdepfile" > "$depfile"
-  # Some versions of the HPUX 10.20 sed can't process this invocation
-  # correctly.  Breaking it into two sed invocations is a workaround.
-  sed 's,^[^:]*: \(.*\)$,\1,;s/^\\$//;/^$/d;/:$/d' < "$tmpdepfile" |
-    sed -e 's/$/ :/' >> "$depfile"
+  # '$object: dependent.h' and one to simply 'dependent.h:'.
+  sed -e "s/^[ $tab][ $tab]*/  /" -e "s,^[^:]*:,$object :," \
+    < "$tmpdepfile" > "$depfile"
+  sed '
+    s/[ '"$tab"'][ '"$tab"']*/ /g
+    s/^ *//
+    s/ *\\*$//
+    s/^[^:]*: *//
+    /^$/d
+    /:$/d
+    s/$/ :/
+  ' < "$tmpdepfile" >> "$depfile"
   rm -f "$tmpdepfile"
   ;;
 
@@ -334,7 +367,7 @@ hp2)
   done
   if test -f "$tmpdepfile"; then
     sed -e "s,^.*\.[a-z]*:,$object:," "$tmpdepfile" > "$depfile"
-    # Add `dependent.h:' lines.
+    # Add 'dependent.h:' lines.
     sed -ne '2,${
 	       s/^ *//
 	       s/ \\*$//
@@ -349,9 +382,9 @@ hp2)
 
 tru64)
    # The Tru64 compiler uses -MD to generate dependencies as a side
-   # effect.  `cc -MD -o foo.o ...' puts the dependencies into `foo.o.d'.
+   # effect.  'cc -MD -o foo.o ...' puts the dependencies into 'foo.o.d'.
    # At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put
-   # dependencies in `foo.d' instead, so we check for that too.
+   # dependencies in 'foo.d' instead, so we check for that too.
    # Subdirectories are respected.
    dir=`echo "$object" | sed -e 's|/[^/]*$|/|'`
    test "x$dir" = "x$object" && dir=
@@ -397,14 +430,59 @@ tru64)
    done
    if test -f "$tmpdepfile"; then
       sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile"
-      # That's a tab and a space in the [].
-      sed -e 's,^.*\.[a-z]*:[	 ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile"
+      sed -e 's,^.*\.[a-z]*:['"$tab"' ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile"
    else
       echo "#dummy" > "$depfile"
    fi
    rm -f "$tmpdepfile"
    ;;
 
+msvc7)
+  if test "$libtool" = yes; then
+    showIncludes=-Wc,-showIncludes
+  else
+    showIncludes=-showIncludes
+  fi
+  "$@" $showIncludes > "$tmpdepfile"
+  stat=$?
+  grep -v '^Note: including file: ' "$tmpdepfile"
+  if test "$stat" = 0; then :
+  else
+    rm -f "$tmpdepfile"
+    exit $stat
+  fi
+  rm -f "$depfile"
+  echo "$object : \\" > "$depfile"
+  # The first sed program below extracts the file names and escapes
+  # backslashes for cygpath.  The second sed program outputs the file
+  # name when reading, but also accumulates all include files in the
+  # hold buffer in order to output them again at the end.  This only
+  # works with sed implementations that can handle large buffers.
+  sed < "$tmpdepfile" -n '
+/^Note: including file:  *\(.*\)/ {
+  s//\1/
+  s/\\/\\\\/g
+  p
+}' | $cygpath_u | sort -u | sed -n '
+s/ /\\ /g
+s/\(.*\)/'"$tab"'\1 \\/p
+s/.\(.*\) \\/\1:/
+H
+$ {
+  s/.*/'"$tab"'/
+  G
+  p
+}' >> "$depfile"
+  rm -f "$tmpdepfile"
+  ;;
+
+msvc7msys)
+  # This case exists only to let depend.m4 do its work.  It works by
+  # looking at the text of this script.  This case will never be run,
+  # since it is checked for above.
+  exit 1
+  ;;
+
 #nosideeffect)
   # This comment above is used by automake to tell side-effect
   # dependency tracking mechanisms from slower ones.
@@ -422,7 +500,7 @@ dashmstdout)
     shift
   fi
 
-  # Remove `-o $object'.
+  # Remove '-o $object'.
   IFS=" "
   for arg
   do
@@ -442,15 +520,14 @@ dashmstdout)
   done
 
   test -z "$dashmflag" && dashmflag=-M
-  # Require at least two characters before searching for `:'
+  # Require at least two characters before searching for ':'
   # in the target name.  This is to cope with DOS-style filenames:
-  # a dependency such as `c:/foo/bar' could be seen as target `c' otherwise.
+  # a dependency such as 'c:/foo/bar' could be seen as target 'c' otherwise.
   "$@" $dashmflag |
-    sed 's:^[  ]*[^: ][^:][^:]*\:[    ]*:'"$object"'\: :' > "$tmpdepfile"
+    sed 's:^['"$tab"' ]*[^:'"$tab"' ][^:][^:]*\:['"$tab"' ]*:'"$object"'\: :' > "$tmpdepfile"
   rm -f "$depfile"
   cat < "$tmpdepfile" > "$depfile"
-  tr ' ' '
-' < "$tmpdepfile" | \
+  tr ' ' "$nl" < "$tmpdepfile" | \
 ## Some versions of the HPUX 10.20 sed can't process this invocation
 ## correctly.  Breaking it into two sed invocations is a workaround.
     sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
@@ -503,9 +580,10 @@ makedepend)
   touch "$tmpdepfile"
   ${MAKEDEPEND-makedepend} -o"$obj_suffix" -f"$tmpdepfile" "$@"
   rm -f "$depfile"
-  cat < "$tmpdepfile" > "$depfile"
-  sed '1,2d' "$tmpdepfile" | tr ' ' '
-' | \
+  # makedepend may prepend the VPATH from the source file name to the object.
+  # No need to regex-escape $object, excess matching of '.' is harmless.
+  sed "s|^.*\($object *:\)|\1|" "$tmpdepfile" > "$depfile"
+  sed '1,2d' "$tmpdepfile" | tr ' ' "$nl" | \
 ## Some versions of the HPUX 10.20 sed can't process this invocation
 ## correctly.  Breaking it into two sed invocations is a workaround.
     sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
@@ -525,7 +603,7 @@ cpp)
     shift
   fi
 
-  # Remove `-o $object'.
+  # Remove '-o $object'.
   IFS=" "
   for arg
   do
@@ -594,8 +672,8 @@ msvisualcpp)
   sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::\1:p' | $cygpath_u | sort -u > "$tmpdepfile"
   rm -f "$depfile"
   echo "$object : \\" > "$depfile"
-  sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s::	\1 \\:p' >> "$depfile"
-  echo "	" >> "$depfile"
+  sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s::'"$tab"'\1 \\:p' >> "$depfile"
+  echo "$tab" >> "$depfile"
   sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s::\1\::p' >> "$depfile"
   rm -f "$tmpdepfile"
   ;;
diff --git a/doc/Makefile.am b/doc/Makefile.am
index 459f79e..aa6e31d 100644
--- a/doc/Makefile.am
+++ b/doc/Makefile.am
@@ -1,4 +1,4 @@
-# Copyright (C) 2008 D. V. Wiebe
+# Copyright (C) 2008, 2012 D. V. Wiebe
 #
 ##########################################################################
 #
@@ -36,12 +36,21 @@ if MAKE_IDLBINDINGS
 READMEIDL=README.idl
 endif
 
+if MAKE_MATLABBINDINGS
+READMEMATLAB=README.matlab
+endif
+
+if MAKE_PERLBINDINGS
+READMEPERL=README.perl
+endif
+
 if MAKE_PYBINDINGS
 READMEPYTHON=README.python
 endif
 
 dist_doc_DATA = ${READMECXX} ${READMEF77} ${READMEF95} ${READMEIDL} \
-								${READMEPYTHON} unclean_database_recovery.txt
+								${READMEMATLAB} ${READMEPERL} ${READMEPYTHON} \
+								unclean_database_recovery.txt
 
 clean-local:
 	rm -rf *~
diff --git a/doc/Makefile.in b/doc/Makefile.in
index 13ddb23..f3f557c 100644
--- a/doc/Makefile.in
+++ b/doc/Makefile.in
@@ -1,9 +1,9 @@
-# Makefile.in generated by automake 1.11.1 from Makefile.am.
+# Makefile.in generated by automake 1.11.5 from Makefile.am.
 # @configure_input@
 
 # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005, 2006, 2007, 2008, 2009  Free Software Foundation,
-# Inc.
+# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software
+# Foundation, Inc.
 # This Makefile.in is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
@@ -16,6 +16,23 @@
 @SET_MAKE@
 
 VPATH = @srcdir@
+am__make_dryrun = \
+  { \
+    am__dry=no; \
+    case $$MAKEFLAGS in \
+      *\\[\ \	]*) \
+        echo 'am--echo: ; @echo "AM"  OK' | $(MAKE) -f - 2>/dev/null \
+          | grep '^AM OK$$' >/dev/null || am__dry=yes;; \
+      *) \
+        for am__flg in $$MAKEFLAGS; do \
+          case $$am__flg in \
+            *=*|--*) ;; \
+            *n*) am__dry=yes; break;; \
+          esac; \
+        done;; \
+    esac; \
+    test $$am__dry = yes; \
+  }
 pkgdatadir = $(datadir)/@PACKAGE@
 pkgincludedir = $(includedir)/@PACKAGE@
 pkglibdir = $(libdir)/@PACKAGE@
@@ -40,22 +57,30 @@ DIST_COMMON = $(am__dist_doc_DATA_DIST) $(srcdir)/Makefile.am \
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
 am__aclocal_m4_deps = $(top_srcdir)/m4/ax_compare_version.m4 \
 	$(top_srcdir)/m4/compiler.m4 $(top_srcdir)/m4/encoding.m4 \
-	$(top_srcdir)/m4/idl.m4 $(top_srcdir)/m4/libtool.m4 \
-	$(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \
-	$(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \
-	$(top_srcdir)/m4/python.m4 $(top_srcdir)/m4/win32.m4 \
-	$(top_srcdir)/m4/version.m4 $(top_srcdir)/configure.ac
+	$(top_srcdir)/m4/floatordering.m4 $(top_srcdir)/m4/idl.m4 \
+	$(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \
+	$(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \
+	$(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/m4/matlab.m4 \
+	$(top_srcdir)/m4/perl.m4 $(top_srcdir)/m4/python.m4 \
+	$(top_srcdir)/m4/win32.m4 $(top_srcdir)/m4/version.m4 \
+	$(top_srcdir)/configure.ac
 am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
 	$(ACLOCAL_M4)
 mkinstalldirs = $(install_sh) -d
-CONFIG_HEADER = $(top_builddir)/src/config.h \
+CONFIG_HEADER = $(top_builddir)/src/gd_config.h \
 	$(top_builddir)/src/getdata.h
 CONFIG_CLEAN_FILES =
 CONFIG_CLEAN_VPATH_FILES =
 SOURCES =
 DIST_SOURCES =
+am__can_run_installinfo = \
+  case $$AM_UPDATE_INFO_DIR in \
+    n|no|NO) false;; \
+    *) (install-info --version) >/dev/null 2>&1;; \
+  esac
 am__dist_doc_DATA_DIST = README.cxx README.f77 README.f95 README.idl \
-	README.python unclean_database_recovery.txt
+	README.matlab README.perl README.python \
+	unclean_database_recovery.txt
 am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
 am__vpath_adj = case $$p in \
     $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
@@ -77,6 +102,12 @@ am__nobase_list = $(am__nobase_strip_setup); \
 am__base_list = \
   sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \
   sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
+am__uninstall_files_from_dir = { \
+  test -z "$$files" \
+    || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \
+    || { echo " ( cd '$$dir' && rm -f" $$files ")"; \
+         $(am__cd) "$$dir" && rm -f $$files; }; \
+  }
 am__installdirs = "$(DESTDIR)$(docdir)"
 DATA = $(dist_doc_DATA)
 DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
@@ -88,10 +119,13 @@ AUTOHEADER = @AUTOHEADER@
 AUTOMAKE = @AUTOMAKE@
 AWK = @AWK@
 BUILDCC = @BUILDCC@
-BUILD_DATE = @BUILD_DATE@
 BZIP2_CPPFLAGS = @BZIP2_CPPFLAGS@
 BZIP2_LDFLAGS = @BZIP2_LDFLAGS@
+BZIP2_LIBS = @BZIP2_LIBS@
 CC = @CC@
+CCAS = @CCAS@
+CCASDEPMODE = @CCASDEPMODE@
+CCASFLAGS = @CCASFLAGS@
 CCDEPMODE = @CCDEPMODE@
 CFLAGS = @CFLAGS@
 CPP = @CPP@
@@ -107,6 +141,7 @@ DEFINE_GD_NO_C99_API = @DEFINE_GD_NO_C99_API@
 DEFINE_gd_int16_t = @DEFINE_gd_int16_t@
 DEFINE_gd_int64_t = @DEFINE_gd_int64_t@
 DEFINE_gd_uint16_t = @DEFINE_gd_uint16_t@
+DEFINE_gd_uint64_t = @DEFINE_gd_uint64_t@
 DEFS = @DEFS@
 DEPDIR = @DEPDIR@
 DIFF = @DIFF@
@@ -127,13 +162,21 @@ FFLAGS = @FFLAGS@
 FGETDATA_VERSION = @FGETDATA_VERSION@
 FGREP = @FGREP@
 FLIBS = @FLIBS@
+GD_DIRSEP = @GD_DIRSEP@
+GD_FDIRSEP = @GD_FDIRSEP@
 GETDATAXX_VERSION = @GETDATAXX_VERSION@
+GETDATA_DEBUG = @GETDATA_DEBUG@
 GETDATA_IFACE_AGE = @GETDATA_IFACE_AGE@
 GETDATA_IFACE_VERSION = @GETDATA_IFACE_VERSION@
 GETDATA_IMPL_REVISION = @GETDATA_IMPL_REVISION@
+GETDATA_MAJOR = @GETDATA_MAJOR@
+GETDATA_MINOR = @GETDATA_MINOR@
+GETDATA_REVISION = @GETDATA_REVISION@
+GETDATA_VERSION_SUFFIX = @GETDATA_VERSION_SUFFIX@
 GREP = @GREP@
 GZIP_CPPFLAGS = @GZIP_CPPFLAGS@
 GZIP_LDFLAGS = @GZIP_LDFLAGS@
+GZIP_LIBS = @GZIP_LIBS@
 IDL = @IDL@
 IDL_CFLAGS = @IDL_CFLAGS@
 IDL_LIBS = @IDL_LIBS@
@@ -156,8 +199,13 @@ LTDLINCL = @LTDLINCL@
 LTLIBOBJS = @LTLIBOBJS@
 LZMA_CPPFLAGS = @LZMA_CPPFLAGS@
 LZMA_LDFLAGS = @LZMA_LDFLAGS@
+LZMA_LIBS = @LZMA_LIBS@
 MAKEINFO = @MAKEINFO@
 MANIFEST_TOOL = @MANIFEST_TOOL@
+MATLAB = @MATLAB@
+MATLABGETDATA_VERSION = @MATLABGETDATA_VERSION@
+MATLAB_CPPFLAGS = @MATLAB_CPPFLAGS@
+MEX = @MEX@
 MKDIR_P = @MKDIR_P@
 NM = @NM@
 NMEDIT = @NMEDIT@
@@ -174,6 +222,9 @@ PACKAGE_TARNAME = @PACKAGE_TARNAME@
 PACKAGE_URL = @PACKAGE_URL@
 PACKAGE_VERSION = @PACKAGE_VERSION@
 PATH_SEPARATOR = @PATH_SEPARATOR@
+PERL = @PERL@
+PERL_MAN3EXT = @PERL_MAN3EXT@
+PRINTF = @PRINTF@
 PRIVATE_LIBS = @PRIVATE_LIBS@
 PYTHON = @PYTHON@
 PYTHON_CPPFLAGS = @PYTHON_CPPFLAGS@
@@ -185,8 +236,12 @@ SET_MAKE = @SET_MAKE@
 SHELL = @SHELL@
 SLIM_CPPFLAGS = @SLIM_CPPFLAGS@
 SLIM_LDFLAGS = @SLIM_LDFLAGS@
+SLIM_LIBS = @SLIM_LIBS@
 STRIP = @STRIP@
 VERSION = @VERSION@
+ZZIP_CPPFLAGS = @ZZIP_CPPFLAGS@
+ZZIP_LDFLAGS = @ZZIP_LDFLAGS@
+ZZIP_LIBS = @ZZIP_LIBS@
 abs_builddir = @abs_builddir@
 abs_srcdir = @abs_srcdir@
 abs_top_builddir = @abs_top_builddir@
@@ -230,6 +285,8 @@ libexecdir = @libexecdir@
 localedir = @localedir@
 localstatedir = @localstatedir@
 mandir = @mandir@
+matlabbasedir = @matlabbasedir@
+mexext = @mexext@
 mkdir_p = @mkdir_p@
 moduledir = @moduledir@
 oldincludedir = @oldincludedir@
@@ -239,8 +296,12 @@ path_gunzip = @path_gunzip@
 path_gzip = @path_gzip@
 path_slim = @path_slim@
 path_unslim = @path_unslim@
+path_unzip = @path_unzip@
 path_xz = @path_xz@
+path_zip = @path_zip@
 pdfdir = @pdfdir@
+perldir = @perldir@
+perlmandir = @perlmandir@
 prefix = @prefix@
 program_transform_name = @program_transform_name@
 psdir = @psdir@
@@ -254,7 +315,7 @@ top_build_prefix = @top_build_prefix@
 top_builddir = @top_builddir@
 top_srcdir = @top_srcdir@
 
-# Copyright (C) 2008 D. V. Wiebe
+# Copyright (C) 2008, 2012 D. V. Wiebe
 #
 ##########################################################################
 #
@@ -279,9 +340,12 @@ AUTOMAKE_OPTIONS = foreign
 @MAKE_F77BINDINGS_TRUE at READMEF77 = README.f77
 @MAKE_F95BINDINGS_TRUE at READMEF95 = README.f95
 @MAKE_IDLBINDINGS_TRUE at READMEIDL = README.idl
+ at MAKE_MATLABBINDINGS_TRUE@READMEMATLAB = README.matlab
+ at MAKE_PERLBINDINGS_TRUE@READMEPERL = README.perl
 @MAKE_PYBINDINGS_TRUE at READMEPYTHON = README.python
 dist_doc_DATA = ${READMECXX} ${READMEF77} ${READMEF95} ${READMEIDL} \
-								${READMEPYTHON} unclean_database_recovery.txt
+								${READMEMATLAB} ${READMEPERL} ${READMEPYTHON} \
+								unclean_database_recovery.txt
 
 all: all-am
 
@@ -324,8 +388,11 @@ clean-libtool:
 	-rm -rf .libs _libs
 install-dist_docDATA: $(dist_doc_DATA)
 	@$(NORMAL_INSTALL)
-	test -z "$(docdir)" || $(MKDIR_P) "$(DESTDIR)$(docdir)"
 	@list='$(dist_doc_DATA)'; test -n "$(docdir)" || list=; \
+	if test -n "$$list"; then \
+	  echo " $(MKDIR_P) '$(DESTDIR)$(docdir)'"; \
+	  $(MKDIR_P) "$(DESTDIR)$(docdir)" || exit 1; \
+	fi; \
 	for p in $$list; do \
 	  if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
 	  echo "$$d$$p"; \
@@ -339,9 +406,7 @@ uninstall-dist_docDATA:
 	@$(NORMAL_UNINSTALL)
 	@list='$(dist_doc_DATA)'; test -n "$(docdir)" || list=; \
 	files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \
-	test -n "$$files" || exit 0; \
-	echo " ( cd '$(DESTDIR)$(docdir)' && rm -f" $$files ")"; \
-	cd "$(DESTDIR)$(docdir)" && rm -f $$files
+	dir='$(DESTDIR)$(docdir)'; $(am__uninstall_files_from_dir)
 tags: TAGS
 TAGS:
 
@@ -396,10 +461,15 @@ install-am: all-am
 
 installcheck: installcheck-am
 install-strip:
-	$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
-	  install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
-	  `test -z '$(STRIP)' || \
-	    echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+	if test -z '$(STRIP)'; then \
+	  $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+	    install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+	      install; \
+	else \
+	  $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+	    install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+	    "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
+	fi
 mostlyclean-generic:
 
 clean-generic:
diff --git a/doc/README.cxx b/doc/README.cxx
index 7d38717..a0956ba 100644
--- a/doc/README.cxx
+++ b/doc/README.cxx
@@ -2,9 +2,83 @@ C++ BINDINGS FOR GETDATA
 ========================
 
 This README describes the C++ bindings for the GetData library.  These bindings
-consist of a several C++ classes in the `GetData' namespace.  Header files
-defining these classes are installed into the ${includedir}/getdata directory.
-The following classes are available:
+consist of a several C++ classes in the `GetData' namespace, plus a few
+associated named constants.  Header files defining these data types are
+installed into the ${includedir}/getdata directory.  The classes defined in
+the GetData namespace are: Dirfile, Entry, Fragment, plus an additional Entry
+subclass for each field type (i.e. RawEntry, LincomEntry, &c.)
+
+CONSTANTS
+=========
+
+Because the C++ headers include the C API header getdata.h, all named constants
+defined in the C API may also be used in the C++ API without change in meaning.
+
+In addition to the classes documented below, the C++ bindings define the
+following enumerated constants.  These are re-encapsulations of various C API
+named constants permitting better type safety in C++.  In all cases, the
+corresponding C API constant can be used in place of the C++ named constant,
+with an appropriate type-cast (so that, e.g., (GetData::DataType)GD_NULL can
+be used in place of GetData::Null).
+
+The GetData data types (defined in getdata/entry.h):
+
+  enum DataType {
+    Null      = GD_NULL,      Unknown    = GD_UNKNOWN,
+    UInt8     = GD_UINT8,     Int8       = GD_INT8,
+    UInt16    = GD_UINT16,    Int16      = GD_INT16,
+    UInt32    = GD_UINT32,    Int32      = GD_INT32,
+    UInt64    = GD_UINT64,    Int64      = GD_INT64,
+    Float32   = GD_FLOAT32,   Float64    = GD_FLOAT64,
+    Complex64 = GD_COMPLEX64, Complex128 = GD_COMPLEX128
+  };
+
+The GetData entry types (defined in getdata/entry.h):
+
+  enum EntryType {
+    NoEntryType       = GD_NO_ENTRY,
+    RawEntryType      = GD_RAW_ENTRY,
+    LincomEntryType   = GD_LINCOM_ENTRY,
+    LinterpEntryType  = GD_LINTERP_ENTRY,
+    BitEntryType      = GD_BIT_ENTRY,
+    MultiplyEntryType = GD_MULTIPLY_ENTRY,
+    PhaseEntryType    = GD_PHASE_ENTRY,
+    SBitEntryType     = GD_SBIT_ENTRY,
+    PolynomEntryType  = GD_POLYNOM_ENTRY,
+    ConstEntryType    = GD_CONST_ENTRY,
+    CarrayEntryType   = GD_CARRAY_ENTRY,
+    StringEntryType   = GD_STRING_ENTRY,
+    IndexEntryType    = GD_INDEX_ENTRY,
+    DivideEntryType   = GD_DIVIDE_ENTRY,
+    RecipEntryType    = GD_RECIP_ENTRY,
+    WindowEntryType   = GD_WINDOW_ENTRY,
+    MPlexEntryType    = GD_MPLEX_ENTRY
+  };
+
+The GetData window operations (defined in getdata/entry.h):
+
+  enum WindOpType {
+    WindOpEq = GD_WINDOP_EQ,
+    WindOpNe = GD_WINDOP_NE,
+    WindOpGe = GD_WINDOP_GE,
+    WindOpGt = GD_WINDOP_GT,
+    WindOpLe = GD_WINDOP_LE,
+    WindOpLt = GD_WINDOP_LT,
+    WindOpSet = GD_WINDOP_SET,
+    WindOpClr = GD_WINDOP_CLR
+  };
+
+The GetData encoding schemes (defined in getdata/fragment.h):
+
+  enum EncodingScheme {
+    AutoEncoding  = GD_AUTO_ENCODED, RawEncoding   = GD_UNENCODED,
+    TextEncoding  = GD_TEXT_ENCODED, SlimEncoding  = GD_SLIM_ENCODED,
+    GzipEncoding  = GD_GZIP_ENCODED, Bzip2Encoding = GD_BZIP2_ENCODED,
+    SieEncoding   = GD_SIE_ENCODED,  ZzipEncoding  = GD_ZZIP_ENCODED,
+    ZzslimEncoding = GD_ZZSLIM_ENCODED, UnsupportedEncoding = GD_ENC_UNSUPPORTED
+  };
+
+
 
 DIRFILE CLASS
 =============
@@ -47,8 +121,14 @@ are available:
 
 * int Dirfile::Error()
 
-  The Error method provides access to the error member of the underlying
-  DIRFILE* object.
+  The Error method calls gd_error(3) to return the error status of the last
+  GetData library call on this Dirfile object.
+
+* int Dirfile::ErrorCount()
+
+  The ErrorCount method calls gd_error_count(3) to return the number of errors
+  encountered by the GetData library on this Dirfile object since this method
+  was last called (or, the first time, since the object was created).
 
 * const char *Dirfile::ErrorString()
 * const char *Dirfile::ErrorString(size_t len)
@@ -127,14 +207,22 @@ are available:
   retained.
 
 * int Dirfile::Add(const Entry &entry)
-* int Dirfile::AddSpec(const char *spec, int format_file = 0)
+* int Dirfile::AddAlias(const char* field_code, const char* target,
+    int fragment_index = 0)
+* int Dirfile::AddSpec(const char *spec, int fragment_index = 0)
+* const char** Dirfile::Aliases(const char* field_code)
+* const char* Dirfile::AliasTarget(const char* field_code)
 * int Dirfile::AlterSpec(const char *line, int recode = 0)
 * const gd_carray_t *Dirfile::Carrays(GetData::DataType type = Float64)
 * const size_t Dirfile::CarrayLen(const char *field_code)
 * const void *Dirfile::Constants(GetData::DataType type = Float64)
-* int Delete(const char *field_code, int flags = 0)
+* int Dirfile::Delete(const char *field_code, int flags = 0)
+* int Dirfile::DeleteAlias(const char* field_code, int flags = 0)
+* const char **Dirfile::EntryList(const char *parent = NULL, int type = 0,
+    unsigned int flags = 0)
 * const char **Dirfile::FieldList()
 * const char **Dirfile::FieldListByType(GetData::EntryType type)
+* unsigned long Dirfile::Flags(unsigned long set = 0, unsigned long reset = 0)
 * int Dirfile::Flush(const char *field_code = NULL)
 * const char *Dirfile::FormatFilename(int index)
 * int Dirfile::GetCarray(const char *field_code, GetData::DataType type,
@@ -145,19 +233,31 @@ are available:
     off_t first_sample, size_t num_frames, size_t num_samples,
     GetData::DataType type, void *data_out)
 * size_t Dirfile::GetString(const char *field_code, size_t len, char *data_out)
-* int Include(const char *file, int format_file, unsigned int flags)
+* int Dirfile::Hidden(const char* field_code)
+* int Dirfile::Hide(const char* field_code)
+* int Dirfile::Include(const char *file, int fragment_index, unsigned int flags)
+* int Dirfile::IncludeAffix(const char *file, int fragment_index = 0,
+    const char* prefix = NULL, const char* suffix = NULL,
+    unsigned long flags = 0)
 * int Dirfile::MAdd(const Entry &entry, const char *parent)
+* int Dirfile::MAddAlias(const char* parent, const char* name,
+    const char* target)
 * int Dirfile::MAddSpec(const char *spec, const char *parent)
 * int Dirfile::MAlterSpec(const char *line, const char *parent)
 * const gd_carray_t *Dirfile::MCarrays(GetData::DataType type = Float64)
 * const void *Dirfile::MConstants(const char *parent, GetData::DataType type)
+* int Dirfile::MetaFlush()
 * const char **Dirfile::MFieldList(const char *parent)
 * const char **Dirfile::MFieldListByType(const char *parent,
-    * GetData::EntryType type)
-* int Dirfile::MetaFlush()
+    GetData::EntryType type)
+* void MplexLookback(int lookback)
+* int Dirfile::MoveAlias(const char* field_code, int new_fragment)
 * const char **Dirfile::MStrings(const char *parent)
 * const char **Dirfile::MVectorList(const char *parent)
+* int Dirfile::NAliases(const char* field_code)
 * DataType Dirfile::NativeType(const char *field_code)
+* unsigned int Dirfile::NEntries(const char *parent = NULL, int type = 0,
+    unsigned int flags = 0)
 * unsigned int Dirfile::NFields()
 * unsigned int Dirfile::NFieldsByType(GetData::EntryType type)
 * off_t Dirfile::NFrames()
@@ -175,29 +275,25 @@ are available:
     off_t first_sample, size_t num_frames, size_t num_samples,
     GetData::DataType type, const void *data_in)
 * size_t Dirfile::PutString(const char *field_code, const char *data_in)
+* int RawClose(const char *field_code = NULL)
 * unsigned int Dirfile::SamplesPerFrame(const char *field_code)
+* off_t Dirfile::Seek(const char *field_code, off_t frame_num, off_t sample_num,
+    int whence)
 * const char **Dirfile::Strings()
+* char *StrTok(const char *string = NULL)
+* int Dirfile::Sync(const char* field_code = NULL)
+* off_t Dirfile::Tell(const char *field_code)
+* int Dirfile::UnHide(const char* field_code)
 * int Dirfile::Validate(const char *field_code)
 * const char **Dirfile::VectorList()
+* int VerbosePrefix(const char *prefix = NULL)
 
   These methods call the corresponding function from the C API on the C DIRFILE
-  object associated with the C++ object.  Arguments of type GetData::DataType
-  should be one of:
-
-    Null, Unknown, UInt8, Int8, UInt16, Int16, UInt32, Int32, UInt64, Int64,
-    Float32, Float64, Complex64, Complex128
-
-  which are aliases for the gd_type_t values GD_NULL, GD_UNKNOWN, GD_UINT8, &c.
-  Arguments of type GetData::EntryType should be one of 
+  object associated with the C++ object.  For allowed values for arguments of
+  type GetData::DataType or GetData::EntryType, see the CONSTANTS section above.
 
-    NoEntryType, BitEntryType, CarrayEntry, ConstEntryType, DivideEntryType,
-    IndexEntryType, LincomEntryType, LinterpEntryType, MultiplyEntryType,
-    PhaseEntryType, PolynomEntryType, RawEntryType, RecipEntryType,
-    SBitEntryType, StringEntryType
-
-  which are aliases for the gd_entype_t values GD_NO_ENTRY, GD_RAW_ENTRY, &c.
-  Note that the arguments to AddSpec are opposite of the corresponding function
-  in add_spec.
+  Note that the arguments to AddSpec are opposite to that of the corresponding
+  function add_spec(3) in the C API.
 
 
 FRAGMENT CLASS
@@ -220,21 +316,19 @@ be incorrect, and all pre-existing Fragment objects should be destroyed.
 * int Fragment::Index()
 
   These methods return the specified information on the associated fragment.
-  Variables of type EncodingScheme will be one of
-  
-    AutoEncoding, RawEncoding, TextEncoding, SlimEncoding, GzipEncoding,
-    Bzip2Encoding, UnsupportedEncoding
-
-  which are aliases for GD_AUTO_ENCODED, GD_UNENCODED, GD_TEXT_ENCODED, &c.
+  For allowed values for arguments of type EncodingScheme, see the CONSTANTS
+  section above.
 
 * int SetEncoding(EncodingScheme encoding, int recode = 0)
 * int SetEndianness(unsigned long byte_sex, int recode = 0)
 * int SetFrameOffset(off_t offset, int recode = 0)
+* int SetPrefix(const char *prefix)
 * int SetProtection(int protection_level)
+* int SetSuffix(const char *suffix)
 
   These methods set the specified information on the associated fragment by
   calling gd_alter_encoding(3), gd_alter_endianness(3), gd_alter_frameoffset(3),
-  or gd_protect(3) as appropriate.
+  gd_protect(3), or gd_alter_affixes(3) as appropriate.
 
 
 ENTRY CLASS
@@ -267,12 +361,8 @@ The following methods are available:
 
 * EntryType Entry::Type()
 
-  This will return the field type of the Entry's field.  This will be one of:
-
-    NoEntryType, BitEntryType, ConstEntryType, DivideEntryType, IndexEntryType,
-    LincomEntryType, LinterpEntryType, MultiplyEntryType, PhaseEntryType,
-    PolynomEntryType, RawEntryType, RecipEntryType, SBitEntryType,
-    StringEntryType
+  This will return the field type of the Entry's field.  This will be one of the
+  Entry types listed above in the CONSTANTS section.
 
 * int Entry::SetFragmentIndex(int fragment_index)
 * int Entry::Move(int new_fragment, int move_data = 0)
@@ -307,6 +397,10 @@ The following methods are available:
 * virtual DataType Entry::ConstType()
 * virtual size_t Entry::ArrayLen()
 * virtual const char *Entry::Table()
+* virtual WindOpType Entry::WindOp()
+* virtual gd_triplet_t Entry::Threshold()
+* virtual int Entry::CountVal()
+* virtual int Entry::Period()
 
   These methods will return the corresponding member of the gd_entry_t object.
   Only methods reasonable to be queried for the given field type will return
@@ -320,7 +414,7 @@ The following methods are available:
 * virtual double Entry::Coefficient(int index = 0)
 * virtual std::complex<double> Entry::CCoefficient(int index = 0)
 * virtual const char *Entry::Scalar(int index = 0)
-* virtual int Entry::ScalaIndexr(int index = 0)
+* virtual int Entry::ScalaIndex(int index = 0)
 
   These methods will return an element from the gd_entry_t members in_fields[],
   m[], or b[], indexed by the supplied parameter.  Attempts to access elements
@@ -347,7 +441,7 @@ Defined in getdata/rawentry.h
   This creates a new RAW entry object with default parameters.
 
 * RawEntry::RawEntry(const char *field_code, DataType data_type,
-    unsigned int spf, int format_file = 0)
+    unsigned int spf, int fragment_index = 0)
 
 * const char *RawEntry::FileName()
 
@@ -381,10 +475,10 @@ Defined in getdata/lincomentry.h
   This creates a new LINCOM entry object with default parameters.
 
 * LincomEntry::LincomEntry(const char *field_code, int n_fields,
-    const char **in_fields, double *m, double *b, int format_file = 0)
+    const char **in_fields, double *m, double *b, int fragment_index = 0)
 * LincomEntry::LincomEntry(const char *field_code, int n_fields,
     const char **in_fields, std::complex<double> *m, std::complex<double> *b,
-    int format_file = 0)
+    int fragment_index = 0)
 
 * virtual const char *LincomEntry::Input(int index = 0)
 * virtual int LincomEntry::ComplexScalars()
@@ -430,7 +524,7 @@ Defined in getdata/linterpentry.h
   This creates a new LINTERP entry object with default parameters.
 
 * LinterpEntry::LinterpEntry(const char *field_code, const char *in_field,
-    const char *table, int format_file = 0)
+    const char *table, int fragment_index = 0)
 
 * virtual const char *Entry::Input()
 * virtual const char *LinterpEntry::Table()
@@ -457,9 +551,9 @@ Defined in getdata/bitentry.h and getdata/sbitentry.h
   These creates a new BIT or SBIT entry object with default parameters.
 
 * BitEntry::BitEntry(const char *field_code, const char *in_field, int bitnum,
-    int numbits = 1, int format_file = 0)
+    int numbits = 1, int fragment_index = 0)
 * SBitEntry::SBitEntry(const char *field_code, const char *in_field, int bitnum,
-    int numbits = 1, int format_file = 0)
+    int numbits = 1, int fragment_index = 0)
 
 * virtual const char *Input(int __gd_unused index = 0)
 * virtual int FirstBit()
@@ -489,7 +583,7 @@ Defined in getdata/multiplyentry.h
   This creates a new MULTIPLY entry object with default parameters.
 
 * MultiplyEntry::MultiplyEntry(const char *field_code, const char *in_field1,
-    const char *in_field2, int format_file = 0)
+    const char *in_field2, int fragment_index = 0)
 
 * virtual const char *MultiplyEntry::Input(int index = 0)
 
@@ -512,7 +606,7 @@ Defined in getdata/phaseentry.h
   This creates a new PHASE entry object with default parameters.
 
 * PhaseEntry::PhaseEntry(const char *field_code, const char *in_field,
-    int shift, int format_file = 0)
+    int shift, int fragment_index = 0)
 
 * virtual const char *PhaseEntry::Input()
 * virtual long int PhaseEntry::Shift()
@@ -538,9 +632,9 @@ Defined in getdata/lincomentry.h
   This creates a new LINCOM entry object with default parameters.
 
 * PolynomEntry::PolynomEntry(const char *field_code, int poly_ord,
-    const char *in_field, double *a, int format_file = 0)
+    const char *in_field, double *a, int fragment_index = 0)
 * PolynomEntry::PolynomEntry(const char *field_code, int poly_ord,
-    const char *in_field, std::complex<double> *a int format_file = 0)
+    const char *in_field, std::complex<double> *a int fragment_index = 0)
 
 * virtual const char *PolynomEntry::Input(int index = 0)
 * virtual int PolynomEntry::ComplexScalars()
@@ -581,7 +675,7 @@ Defined in getdata/divideentry.h
   This creates a new DIVIDE entry object with default parameters.
 
 * DivideEntry::DivideEntry(const char *field_code, const char *in_field1,
-    const char *in_field2, int format_file = 0)
+    const char *in_field2, int fragment_index = 0)
 
 * virtual const char *DivideEntry::Input(int index = 0)
 
@@ -604,7 +698,7 @@ Defined in getdata/recipentry.h
   This creates a new RECIP entry object with default parameters.
 
 * RecipEntry::RecipEntry(const char *field_code, const char *in_field1,
-    const char *in_field2, int format_file = 0)
+    const char *in_field2, int fragment_index = 0)
 
 * virtual const char *RecipEntry::Input()
 * virtual int RecipEntry::ComplexScalars()
@@ -617,14 +711,76 @@ Defined in getdata/recipentry.h
   field parameter.
 
 * int RecipEntry::SetInput(const char *field)
-* virtual std::complex<double> CDividend()
-* int SetInput(const char* field)
-* int SetDividend(double coeff)
-* int SetDividend(const char* coeff)
-* int SetDividend(std::complex<double> coeff)
+* int RecipEntry::SetDividend(double coeff)
+* int RecipEntry::SetDividend(const char* coeff)
+* int RecipEntry::SetDividend(std::complex<double> coeff)
 
-  This function will change the specified input field with the given index,
-  which should be zero or one.
+  These functions will change the specified input field or the field dividend
+  to the the value or field code supplied.
+
+
+WindowEntry Class
+-------------------
+
+Defined in getdata/windowentry.h
+
+* WindowEntry::WindowEntry()
+  
+  This creates a new WINDOW entry object with default parameters.
+
+* WindowEntry::WindowEntry(const char *field_code, const char *in_field,
+    const char *check_field, int fragment_index = 0)
+
+* virtual const char *WindowEntry::Input(int index = 0)
+* virtual const char *WindowEntry::Scalar()
+* virtual int WindowEntry::ScalarIndex()
+* virtual WindOpType WindowEntry::WindOp()
+* virtual gd_triplet_t WindowEntry::Threshold()
+
+  These methods, re-implemented from the Entry class, return the corresponding
+  field parameter.
+
+* int WindowEntry::SetInput(const char *field, int index)
+* int WindowEntry::SetWindOp(WindOpType coeff)
+* int WindowEntry::SetThreshold(gd_triplet_t threshold)
+* int WindowEntry::SetThreshold(const char *threhsold)
+
+  These functions will change the specified input field, check field, or the
+  window operation or threshold to the the value or field code supplied.  For
+  allowed values of variables of type WindOpType, see the CONSTANTS section
+  above.
+
+
+MplexEntry Class
+-------------------
+
+Defined in getdata/mplex.h
+
+* Mplex::MplexEntry()
+  
+  This creates a new MPLEX entry object with default parameters.
+
+* MplexEntry::MplexEntry(const char *field_code, const char *in_field,
+    const char *check_field, int fragment_index = 0)
+
+* virtual const char *MplexEntry::Input(int index = 0)
+* virtual const char *MplexEntry::Scalar()
+* virtual int MplexEntry::ScalarIndex()
+* virtual int MplexEntry::CountVal()
+* virtual int MplexEntry::Period()
+
+  These methods, re-implemented from the Entry class, return the corresponding
+  field parameter.
+
+* int MplexEntry::SetInput(const char *field, int index)
+* int MplexEntry::SetWindOp(WindOpType coeff)
+* int MplexEntry::SetCountVal(int count_val)
+* int MplexEntry::SetCountVal(const char *count_val)
+* int MplexEntry::SetPeriod(int period)
+* int MplexEntry::SetPeriod(const char *period)
+
+  These functions will change the specified input field, check field, or the
+  count value or max to the value or field code supplied.
 
 
 CarraytEntry Class
@@ -637,7 +793,7 @@ Defined in getdata/constentry.h
   This creates a new CONST entry object with default parameters.
 
 * CarraytEntry::CarraytEntry(const char *field_code, DataType type,
-    int format_file = 0)
+    int fragment_index = 0)
 
 * virtual DataType CarraytEntry::ConstType()
 * virtual size_t Carray::ArrayLen()
@@ -662,7 +818,7 @@ Defined in getdata/constentry.h
   This creates a new CONST entry object with default parameters.
 
 * ConstEntry::ConstEntry(const char *field_code, DataType type,
-    int format_file = 0)
+    int fragment_index = 0)
 
 * virtual DataType ConstEntry::ConstType()
 
@@ -684,7 +840,7 @@ Defined in getdata/stringentry.h
   
   This creates a new STRING entry object with default parameters.
 
-* StringEntry::StringEntry(const char *field_code, int format_file = 0)
+* StringEntry::StringEntry(const char *field_code, int fragment_index = 0)
 
 
 IndexEntry Class
diff --git a/doc/README.f77 b/doc/README.f77
index 5a868e9..5fe24f8 100644
--- a/doc/README.f77
+++ b/doc/README.f77
@@ -2,8 +2,8 @@ FORTRAN 77 BINDINGS FOR GETDATA
 ===============================
 
 This README describes the Fortran 77 bindings for the GetData library.  These
-bindings consist of a Fortran compatibility library `libfgetdata' (written in
-C) and a Fortran 77 source file `getdata.f' which defines useful Fortran
+bindings consist of a Fortran compatibility library, 'libfgetdata' (written in
+C) and a Fortran 77 source file, 'getdata.f' which defines useful Fortran
 parameters and declares the external subroutines.
 
 These bindings are designed to comply to the Fortran 77 standards.  As a result,
@@ -31,7 +31,7 @@ Fortran program to define these constants.
 
 All integer type parameters passed to the compatibility library are of type
 INTEGER (i.e. the native size of the platform).  As a result, largefile support
-will not be available in the Fortran 77 bindings on a 32-bit system.
+are not be available in the Fortran 77 bindings.
 
 All character string arguments require also an integer indicating the size of
 the character buffer.  In cases where the bindings return a string value, the
@@ -86,9 +86,30 @@ Subroutines interacting with the database
   listed below.  If GDCOPN is passed zero as sehandler, no callback is set.
 
   The callback subroutine is wrapped by the Fortran 77 library to properly
-  interface with GetData.  Other than GDCOPN, the only other subroutine which
-  potentially could cause the callback subroutine to be called is GDINCL.  Use
-  GDCLBK to change the callback function before calling GDINCL, if required.
+  interface with GetData.  Other than GDCOPN, the only other subroutines which
+  potentially could cause the callback subroutine to be called are GDINCL and
+  GDINCA.  Use GDCLBK to change the callback function before calling GDINCL or
+  GDINCA, if required.
+
+* GDCLBK(dirfile_unit, callback)
+
+  Input:
+    INTEGER dirfile_unit
+    EXTERNAL callback
+
+  This wraps gd_parser_callback(3), setting the registered parser callback to
+  the subroutine given.  The signature of this subroutine is given above under
+  GDCOPN.  Unlike the C interface, this function cannot be used to remove a
+  registered callback; use GDNOCB for that.
+
+* GDNOCB(dirfile_unit)
+
+  Input:
+    INTEGER dirfile_unit
+
+  This calls gd_parser_callback(3) to deregister a previous parser callback
+  associated with the specified dirfile.  If it had none, this procedure does
+  nothing.
 
 * GDINVD(dirfile_unit)
 
@@ -125,6 +146,26 @@ Subroutines interacting with the database
   flushed, and field_code will be ignored.  Otherwise the field named by
   field_code will be flushed.
 
+* GDSYNC(dirfile_unit, field_code, field_code_len)
+
+  Input:
+    INTEGER dirfile_unit, field_code_len
+    CHARACTER*<field_code_len> field_code
+
+  This wraps gd_sync(3).  If field_code_len is zero, the entire dirfile will be
+  synced, and field_code will be ignored.  Otherwise the field named by
+  field_code will be synced.
+
+* GDRCLO(dirfile_unit, field_code, field_code_len)
+
+  Input:
+    INTEGER dirfile_unit, field_code_len
+    CHARACTER*<field_code_len> field_code
+
+  This wraps gd_raw_close(3).  If field_code_len is zero, the entire dirfile
+  will be closed, and field_code will be ignored.  Otherwise the field named by
+  field_code will be closed.
+
 * GDMFLS(dirfile_unit)
 
   Input:
@@ -133,6 +174,51 @@ Subroutines interacting with the database
   This subroutine wraps gd_metaflush(3), and will cause metadata changes to be
   written to disk.
 
+* GDDSYN(desync, dirfile_unit, flags)
+
+  Output:
+    INTEGER desync
+  Input:
+    INTEGER dirfile_unit, flags
+
+  This wraps gd_desync(3), and sets desync to a non-zero value if the loaded
+  dirfile has become desynchronised from the metadata on disk and will,
+  optionally, reload the dirfile.
+
+* GDFLAG(flags, dirfile_unit, set, reset)
+
+  Output:
+    INTEGER flags
+  Input:
+    INTEGER dirfile_unit, set, reset
+
+  This wraps gd_flags(3).  The value of the flags after modification are
+  returned in flags.
+
+* GDTOKE(token, token_len, dirfile_unit, string, string_len)
+
+  Output:
+    CHARACTER*<token_len> token
+  Input/Output:
+    INTEGER token_len
+  Input:
+    INTEGER dirfile_unit, string_len
+    CHARACTER*<string_len> string
+
+  This wraps gd_strtok(3).  If string_len <= 0, the next token of the previously
+  supplied string is returned in token (ie. NULL is passed to gd_strtok(3)),
+  otherwise, the first token from string is returned, and the string is cached
+  by GetData.  If the output token is longer than the supplied token_len, the
+  actual length of the token is returned in token_len and token is unmodified.
+
+* GDVBPX(dirfile_unit, prefix, prefix_len
+
+  Input:
+    INTEGER dirfile_unit, prefix_len
+    CHARACTER*<prefix_len> prefix
+
+  This wraps gd_verbose_prefix(3).  To remove a prefix, set prefix_len to
+  zero, in which case prefix itself is ignored.
 
 Subroutines interacting with data
 ---------------------------------
@@ -308,153 +394,214 @@ Subroutines interacting with data
   This subroutine wraps gd_framenum_subset(3), and performs a reverse
   look-up on a field.
 
+* GDSEEK(pos, dirfile_unit, field_code, field_code_len, frame_num, sample_num,
+  flags)
 
-Subroutines interacting with global metadata
---------------------------------------------
+  Output:
+    INTEGER pos
+  Input:
+    INTEGER dirfile_unit, field_code_len, frame_num, sample_num, flags
+    CHARACTER*<field_code_len> field_code
 
-* GDNFLD(nfields, dirfile_unit)
+  This subroutine wraps gd_seek(3), and repositions the field pointer of the
+  specified field.  It returns the new value of the field pointer.  The
+  'flags' argument should be one of GDSK_S, GDSK_C, or GDSK_E, optionally
+  bitwise or'd with GDSK_E.
+
+* GDTELL(pos, dirfile_unit, field_code)
 
   Output:
-    INTEGER nframes
+    INTEGER pos
   Input:
-    INTEGER dirfile_unit
+    INTEGER dirfile_unit, field_code_len
+    CHARACTER*<field_code_len> field_code
 
-  This wraps gd_nfields(3).  It takes the dirfile unit number as input and
-  returns the number of fields in the dirfile in nfields.
+  This subroutine wraps gd_tell(3), and returns the current value of the field
+  pointer for the specified field.
 
-* GDNFDT(nfields, dirfile_unit, type)
+* GDMXLB(dirfile_unit, lookback)
 
-  Output:
-    INTEGER nframes
   Input:
-    INTEGER dirfile_unit, type
+    INTEGER dirfile_unit, lookback
 
-  This wraps gd_nfields_by_type(3).  It takes the dirfile unit number, and
-  type specifier as input and returns the number of fields of the specified type
-  in the dirfile in nfields.
+  This wraps gd_mplex_lookback(3).
 
-* GDNVEC(nvectors, dirfile_unit)
+
+Subroutines interacting with global metadata
+--------------------------------------------
+
+* GDNENT(nentries dirfile_unit, parent, parent_len, type, flags)
 
   Output:
-    INTEGER nvectors
+    INTEGER nentries
   Input:
-    INTEGER dirfile_unit
-
-  This wraps gd_nvectors(3).  It takes the dirfile unit number as input and
-  returns the number of vector fields in the dirfile in nfields.
+    INTEGER dirfile_unit, parent_len, type, flags
+    CHARACTER*<parent_len> parent
+ 
+  This wraps gd_nentries(3).  It returns the number of entries in the dirfile
+  satisfying the supplied criteria.  If parent_len is zero, parent itself is
+  ignored, and top-level entries are considered.  Otherwise, meta-entries
+  under parent are considered.
 
+* GDNFLD(nfields, dirfile_unit)
+* GDNFDT(nfields, dirfile_unit, type)
+* GDNVEC(nvectors, dirfile_unit)
 * GDNMFD(nfields, dirfile, parent, parent_l)
 * GDNMFT(nfields, dirfile, parent, parent_l, type)
 * GDNMVE(nvectors, dirfile, parent, parent_l)
 
-  These subroutine wrap gd_nmfields(3), gd_nmfields_by_type(3), and
-  gd_nmvectors(3).  They behave analogously to GDNFLD, GDNFDT, and GDNVEC.
+  These procedures wrap, respectively, gd_nfields(3), gd_nfields_by_type(3),
+  gd_nvectors(3), gd_nmfields(3), gd_nmfields_by_type(3), and gd_nmvectors(3),
+  and are all special cases of GDNENT.
 
-* GDFDNX(field_max, dirfile_unit)
+* GDNALS(nfields, dirfile_unit, field_code, field_code_len)
 
   Output:
-    INTEGER field_max
+    INTEGER nframes
   Input:
     INTEGER dirfile_unit
+    CHARACTER*<field_code_len> field_code
 
-  This subroutine, which has no direct analogue in the C API, returns the
-  length of the longest field name defined in the dirfile.  It takes the
-  dirfile unit number as input and returns the length (in characters) of
-  the longest field name in the dirfile in field_max.
- 
-* GDMFNX(field_max, dirfile_unit, parent, parent_len)
+  This wraps gd_naliases(3).  It returns the number of aliases of field_code
+  (including field_code itself).
+
+* GDENTX(entry_max, dirfile_unit, parent, parent_len, type, flags)
 
   Output:
-    INTEGER field_max
+    INTEGER entry_max
   Input:
-    INTEGER dirfile_unit, parent_len
+    INTEGER dirfile_unit, parent_len, type, flags
     CHARACTER*<parent_len> parent
-
+ 
   This subroutine, which has no direct analogue in the C API, returns the
-  length of the longest field name defined in the dirfile for META fields of the
-  supplied parent field.  It returns the length (in characters) of the longest
-  META field name for the supplied parent in field_max.
+  length of the longest entry name defined in the dirfile.  It returns
+  the length (in characters) of the longest entry name in the dirfile in
+  entry_max which satisfies the given criteria.  If parent_len is zero,
+  parent itself is ignored, and top-level entries are considered.
+  Otherwise, meta-entries under parent are considered.
  
-* GDFLDN(name, name_len, dirfile_unit, field_num)
+* GDFDNX(field_max, dirfile_unit)
+* GDMFNX(field_max, dirfile_unit, parent, parent_len)
+
+  These subroutines are special cases of GDENTX, with type and flags both
+  equal to zero, and, in the case of GDFDNX, parent_len also zero.
+ 
+* GDENTN(name, name_len, dirfile_unit, parent, parent_len, type, flags,
+  entry_num)
 
   Output:
     CHARACTER*<name_len> name
   Input/Output:
     INTEGER name_len
   Input:
-    INTEGER dirfile_unit, field_num
+    INTEGER dirfile_unit, parent_len, type, flags, entry_num
+    CHARACTER*<parent_len> parent
 
-  This subroutine is the replacement for gd_field_list(3).  It returns in
-  name a Fortran 77 string containing the field name of the field indexed by
-  field_num (which is should be a number between 1 and the output of GDNFLD).
+  This subroutine is the replacement for gd_entry_list(3).  It returns in
+  name a Fortran 77 string containing the entry name of the entry indexed by
+  entry_num (which is should be a number between 1 and the output of GDNENT).
   If the name of the field is longer than name_len, it will return the actual
   length of the field in name_len and not modify the name argument.  If
-  field_num is out of range, name_len will be set to zero, and name will not be
+  entry_num is out of range, name_len will be set to zero, and name will not be
   modified.
 
+* GDFLDN(name, name_len, dirfile_unit, field_num)
 * GDFDNT(name, name_len, dirfile_unit, type, field_num)
-  
+* GDVECN(name, name_len, dirfile_unit, field_num)
+* GDMFDN(name, name_len, dirfile_unit, parent, parent_len, field_num)
+* GDMFDT(name, name_len, dirfile_unit, parent, parent_len, type, field_num)
+* GDMVEN(name, name_len, dirfile_unit, parent, parent_len, field_num)
+
+  These subroutines are replacements for, respectively, gd_field_list(3),
+  gd_field_list_by_type(3), gd_vector_list(3), gd_mfield_list(3),
+  gd_mfield_list_by_type(3), and gd_mvector_list(3), and are all special cases
+  of GDENTN.
+
+* GDALSS(name, name_len, dirfile_unit, field_code, field_code_len, field_num)
+
   Output:
     CHARACTER*<name_len> name
   Input/Output:
     INTEGER name_len
   Input:
-    INTEGER dirfile_unit, field_num, type
+    INTEGER dirfile_unit, field_num, field_code_len
+    CHARACTER*<field_code_len> field_code
 
-  This subroutine is the replacement for gd_field_list_by_type(3) and
-  behaves in the same manner as GDFLDN.  Type should be one of the parameters
-  defined in getdata.f (see below).
-    
-* GDVECN(name, name_len, dirfile_unit, field_num)
+  This subroutine is the replacement for gd_aliases(3) and behaves in
+  the same manner as GDFLDN.
+
+* GDSTRX(string_max, dirfile_unit)
+
+  Output:
+    INTEGER string_max
+  Input:
+    INTEGER dirfile_unit
+
+  This subroutine, which has no direct analogue in the C API, returns the length
+  of the longest STRING field defined in the dirfile.  It takes the dirfile unit
+  number as input and returns the length (in characters) of the longest STRING
+  in the dirfile in string_max.
+ 
+* GDMSTX(string_max, dirfile_unit, parent, parent_len)
+
+  Output:
+    INTEGER string_max
+  Input:
+    INTEGER dirfile_unit, parent_len
+    CHARACTER*<parent_len> parent
+
+  This subroutine, which has no direct analogue in the C API, returns the length
+  of the longest STRING defined in the dirfile for META fields of the supplied
+  parent field.  It returns the length (in characters) of the longest STRING
+  META field for the supplied parent in string_max.
+ 
+* GDCONS(value, dirfile_unit, return_type, field_num)
 
   Output:
     CHARACTER*<name_len> name
-  Input/Output:
-    INTEGER name_len
+    <datatype> value
   Input:
     INTEGER dirfile_unit, field_num
 
-  This subroutine is the replacement for gd_vector_list(3) and behaves in
-  the same manner as GDFLDN.
+  This subroutine is the replacement for gd_constants(3) and behaves in the same
+  manner as GDFLDN.
 
-* GDMFDN(name, name_len, dirfile_unit, parent, parent_len, field_num)
+* GDMCOS(value, dirfile_unit, parent, parent_len, return_type, field_num)
 
   Output:
     CHARACTER*<name_len> name
-  Input/Output:
-    INTEGER name_len
+    <datatype> value
   Input:
     INTEGER dirfile_unit, field_num, parent_len
     CHARACTER*<parent_len> parent
 
-  This subroutine is the replacement for gd_mfield_list(3) and behaves in
-  the same manner as GDFLDN.
+  This subroutine is the replacement for gd_mconstants(3) and behaves in the
+  same manner as GDFLDN.
+
+* GDSTRS(value, value_len, dirfile_unit, field_num)
 
-* GDMFDT(name, name_len, dirfile_unit, parent, parent_len, type, field_num)
-  
   Output:
-    CHARACTER*<name_len> name
+    CHARACTER*<value_len> value
   Input/Output:
-    INTEGER name_len
+    INTEGER value_len
   Input:
-    INTEGER dirfile_unit, field_num, parent_len, type
-    CHARACTER*<parent_len> parent
+    INTEGER dirfile_unit, field_num
 
-  This subroutine is the replacement for gd_mfield_list_by_type(3) and
-  behaves in the same manner as GDFDNT.
-    
-* GDMVEN(name, name_len, dirfile_unit, parent, parent_len, field_num)
+  This subroutine is the replacement for gd_strings(3) and behaves in the same
+  manner as GDSTRS.
+
+* GDMSTS(value, value_len, dirfile_unit, parent, parent_len, field_num)
 
   Output:
-    CHARACTER*<name_len> name
+    CHARACTER*<value_len> value
   Input/Output:
-    INTEGER name_len
+    INTEGER value_len
   Input:
     INTEGER dirfile_unit, field_num, parent_len
     CHARACTER*<parent_len> parent
 
-  This subroutine is the replacement for gd_mvector_list(3) and behaves in
-  the same manner as GDVECN.
+  This subroutine is the replacement for gd_mstrings(3) and behaves in the same
+  manner as GDFLDN.
 
 * GDNFRM(nframes, dirfile_unit)
 
@@ -466,6 +613,29 @@ Subroutines interacting with global metadata
   This wraps gd_nframes(3).  It takes the dirfile unit number as input and
   returns the number of frames in the dirfile in nframes.
 
+* GDALSX(alias_max, dirfile_unit, field_code, field_code_len)
+
+  Output:
+    INTEGER alias_max
+  Input:
+    INTEGER dirfile_unit, field_code_len
+    CHARACTER*<field_code_len> field_code
+
+  This subroutine, which has no direct analogue in the C API, returns the
+  length of the longest alias defined in the dirfile for field_code.
+ 
+* GDECNT(error_count, dirfile_unit)
+
+  Output:
+    INTEGER error_count
+  Input:
+    INTEGER dirfile_unit
+
+  This subroutine wraps gd_error_count(3).  It takes the dirfile unit number as
+  input and returns the number of errors encountered by GetData since the last
+  call to this subroutine (or since the dirfile was first opened) in
+  error_count.
+
 * GDEROR(error, dirfile_unit)
 
   Output:
@@ -473,9 +643,9 @@ Subroutines interacting with global metadata
   Input:
     INTEGER dirfile_unit
 
-  This subroutine takes a dirfile unit as input and returns the DIRFILE.error
-  value associated with it in error.  The value of error will equal one of the
-  error codes defined in getdata.f.
+  This subroutine wraps gd_error(3).  It takes the dirfile unit number as input
+  and returns the error value arising from the last library call in error.  The
+  value of error will equal one of the error codes defined in getdata.f.
 
 * GDESTR(dirfile_unit, buffer, buffer_len)
 
@@ -569,6 +739,21 @@ Subroutines interacting with fragment metadata
   callback subroutine, if any.  See the caveat in the description of GDCOPN
   above.
 
+* GDINCA(dirfile_unit, file, file_len, fragment_index, prefix, prefix_len,
+  suffix, suffix_len, flags)
+
+  Input:
+    INTEGER dirfile_unit, field_code_len, fragment_index, prefix_len,
+    INTEGER suffix_len, flags
+    CHARACTER*<file_len> file
+    CHARACTER*<prefix_len> prefix
+    CHARACTER*<suffix_len> suffix
+
+  This subroutine wraps gd_include_affix(3), and allows the inclusion of another
+  format file fragment into the current dirfile with the specified field code
+  prefix and suffix.  This may call the registered callback subroutine, if any.
+  See the caveat in the description of GDCOPN above.
+
 * GDUINC(dirfile_unit, fragment, del)
 
   Input:
@@ -670,6 +855,32 @@ Subroutines interacting with fragment metadata
   This subroutine wraps gd_parent_fragment(3).  It returns the parent
   fragment of the specified fragment, or -1 on error.
 
+* GDFRAF(prefix, prefix_len, suffix, suffix_len, dirfile_unit, fragment_index)
+  
+  Output:
+    CHARACTER*<prefix_len> prefix
+    CHARACTER*<suffix_len> suffix
+  Input/Output:
+    INTEGER prefix_len, suffix_len
+  Input:
+    INTEGER dirfile_unit, fragment_index
+
+  This subroutine wraps gd_fragment_affixes(3), returning the field code
+  prefix and suffix for the specified fragment.  On error, it sets prefix_len
+  to zero.  In this case the value of the other output parameters in
+  unspecified.
+
+* GDAAFX(dirfile_unit, fragment, prefix, prefix_len, suffix, suffix_len
+
+  Input:
+    INTEGER dirfile_unit, fragment
+    CHARACTER*<prefix_len> prefix
+    CHARACTER*<suffix_len> suffix
+
+  This subroutine wraps gd_alter_affix(3).  It sets the field code prefix and
+  suffix of the specified fragment to the value of the prefix and suffix
+  parameters.
+
 
 Subroutines interacting with field metadata
 -------------------------------------------
@@ -863,78 +1074,82 @@ Subroutines interacting with field metadata
     CHARACTER*<field_code_len> field_code
 
   This subroutine returns metadata describing a PHASE field.  If field_code
-  is not found, or the field specified is not of PHASE type, shift will
+  is not found, or the field specified is not of PHASE type, infield_len will
   be set to zero.  In this case the value of the remaining data is unspecified.
 
-* GDGECP(poly_ord, infield, infield_len, a0, a1, a2, a3, a4, a5, fragment_index,
+* GDGEPN(poly_ord, infield, infield_len, a0, a1, a2, a3, a4, a5, fragment_index,
   dirfile_unit, field_code, field_code_len)
 
   Output:
     INTEGER poly_ord, fragment_index
     CHARACTER*<infield_len> infield
-    COMPLEX*16 a0, a1, a2, a3, a4, a5
+    REAL*8 a0, a1, a2, a3, a4, a5
   Input/Output:
     INTEGER infield1_len, infield2_len, infield3_len
   Input:
     INTEGER dirfile_unit, field_code_len
     CHARACTER*<field_code_len> field_code
 
-  This subroutine returns metadata describing a POLYNOM field.  Although six
-  coefficients, only poly_ord + 1 of them will be updated.  If field_code is not
-  found, or the field specified is not of POLYNOM type, nfields will be set to
-  zero.  In this case the value of the remaining data is unspecified.
+  This is equivalent to GDGECP above, but returns only the real part of the
+  coefficients.
 
-* GDGEPN(poly_ord, infield, infield_len, a0, a1, a2, a3, a4, a5, fragment_index,
+* GDGECP(poly_ord, infield, infield_len, a0, a1, a2, a3, a4, a5, fragment_index,
   dirfile_unit, field_code, field_code_len)
 
   Output:
     INTEGER poly_ord, fragment_index
     CHARACTER*<infield_len> infield
-    REAL*8 a0, a1, a2, a3, a4, a5
+    COMPLEX*16 a0, a1, a2, a3, a4, a5
   Input/Output:
     INTEGER infield1_len, infield2_len, infield3_len
   Input:
     INTEGER dirfile_unit, field_code_len
     CHARACTER*<field_code_len> field_code
 
-  This is equivalent to GDGECP above, but returns only the real part of the
-  coefficients.
+  This subroutine returns metadata describing a POLYNOM field.  Although six
+  coefficients must be provided, only poly_ord + 1 of them will be updated.  If
+  field_code is not found, or the field specified is not of POLYNOM type,
+  nfields will be set to zero.  In this case the value of the remaining data is
+  unspecified.
 
-* GDGECP(poly_ord, infield, infield_len, a0, a1, a2, a3, a4, a5, fragment_index,
-  dirfile_unit, field_code, field_code_len)
+* GDGEWD(infield, infield_len, checkfield, checkfield_len, windop, ithreshold,
+  rthreshold, fragment_index, dirfile_unit, field_code, field_code_len)
 
   Output:
-    INTEGER poly_ord, fragment_index
+    INTEGER windop, ithreshold, fragment_index
     CHARACTER*<infield_len> infield
-    COMPLEX*16 a0, a1, a2, a3, a4, a5
+    CHARACTER*<checkfield_len> checkfield
   Input/Output:
-    INTEGER infield1_len, infield2_len, infield3_len
+    INTEGER infield_len, checkfield_len
   Input:
     INTEGER dirfile_unit, field_code_len
     CHARACTER*<field_code_len> field_code
 
-  This subroutine returns metadata describing a POLYNOM field.  Although six
-  coefficients, only poly_ord + 1 of them will be updated.  If field_code is not
-  found, or the field specified is not of POLYNOM type, nfields will be set to
-  zero.  In this case the value of the remaining data is unspecified.
+  This subroutine returns metadata describing a WINDOW field.  Only one of
+  ithreshold and rthreshold is ever updated.  If the returned windop is one of
+  GDW_EQ, GDW_NE, GDW_ST, or GDW_CL, ithreshold will be updated, otherwise,
+  rthreshold will be updated.  If field_code is not found, or the field
+  specified is not of POLYNOM type, infield_len will be set to zero.  In this
+  case the value of the remaining data is unspecified.
 
-* GDGEPN(poly_ord, infield, infield_len, a0, a1, a2, a3, a4, a5, fragment_index,
-  dirfile_unit, field_code, field_code_len)
+* GDGEMX(infield, infield_len, countfield, countfield_len, countval, period,
+  fragment_index, dirfile_unit, field_code, field_code_len)
 
   Output:
-    INTEGER poly_ord, fragment_index
+    INTEGER countval, period, fragment_index
     CHARACTER*<infield_len> infield
-    REAL*8 a0, a1, a2, a3, a4, a5
+    CHARACTER*<countfield_len> countfield
   Input/Output:
-    INTEGER infield1_len, infield2_len, infield3_len
+    INTEGER infield_len, countfield_len
   Input:
     INTEGER dirfile_unit, field_code_len
     CHARACTER*<field_code_len> field_code
 
-  This is equivalent to GDGECP above, but returns only the real part of the
-  coefficients.
+  This subroutine returns metadata describing a MPLEX field.  If field_code
+  is not found, or the field specified is not of MPLEX type, infield_len will
+  be set to zero.  In this case the value of the remaining data is unspecified.
 
-* GDGECO(const_type, array_len, fragment_index, dirfile_unit, field_code,
+* GDGECA(const_type, array_len, fragment_index, dirfile_unit, field_code,
   field_code_len)
 
   Output: 
@@ -1007,7 +1222,47 @@ Subroutines interacting with field metadata
   fragment index for the supplied field.  If the field does not exist, or an
   error occurred, -1 is returned.
 
-* GDGBOF(bof, dirfile, field_code, field_code_len)
+* GDATRG(targ, targ_len, dirfile_unit, field_code, field_code_len)
+
+  Output:
+    CHARACTER*<targ_len> targ
+  Input/Output:
+    INTEGER targ_len
+  Input:
+    INTEGER dirfile_unit, field_code_len
+    CHARACTER*<field_code_len> field_code
+
+  This subroutine wraps gd_alias_target(3), and returns the target of the
+  alias specified by format_file.
+
+* GDHIDN(result, dirfile_unit, field_code, field_code_len)
+
+  Output:
+    INTEGER result
+  Input:
+    INTEGER dirfile_unit, field_code_len
+    CHARACTER*<field_code_len> field_code
+
+  This subroutine wraps gd_hidden(3).  It sets result to one if the specified
+  field is hidden, or zero if it is not.  On error, it sets result to -1.
+
+* GDHIDE(dirfile_unit, field_code, field_code_len)
+
+  Input:
+    INTEGER dirfile_unit, field_code_len
+    CHARACTER*<field_code_len> field_code
+
+  This subroutine wraps gd_hide(3).  It hides the specified field.
+
+* GDUHID(dirfile_unit, field_code, field_code_len)
+
+  Input:
+    INTEGER dirfile_unit, field_code_len
+    CHARACTER*<field_code_len> field_code
+
+  This subroutine wraps gd_unhide(3).  It unhides the specified field.
+
+* GDGBOF(bof, dirfile_unit, field_code, field_code_len)
 
   Output:
     INTEGER bof
@@ -1188,6 +1443,35 @@ Subroutines interacting with field metadata
   This subroutine wraps gd_alter_recip(3), and modifies the specified field
   metadata.
 
+* GDALWD(dirfile_unit, field_code, field_code_len, in_field, in_field_len,
+  check_field, check_field_len, windop, threshold)
+
+  Input:
+    INTEGER dirfile_unit, field_code_len, in_field_len, check_field_len, windop
+    CHARACTER*<field_code_len> field_code
+    CHARACTER*<in_field_len> in_field
+    CHARACTER*<check_field_len> check_field
+    INTEGER threshold
+      or
+    DOUBLE PRECISION threshold
+
+  This subroutine wraps gd_alter_windop(3), and modifies the specified field
+  metadata.  If windop is one of GDW_EQ, GDW_NE, GDW_ST, or GDW_CL, threshold
+  should be of type integer, otherwise it should be double precision.
+
+* GDALMX(dirfile_unit, field_code, field_code_len, infield, infield_len,
+  countfield, countfield_len, countval, period)
+
+  Input:
+    INTEGER dirfile_unit, field_code_len, infield_len, countfile_len, countval
+    INTEGER period
+    CHARACTER*<field_code_len> field_code
+    CHARACTER*<infield_len> infield
+    CHARACTER*<countfield_len> countfield
+
+  This subroutine wraps gd_alter_mplex(3), and modifies the specified field
+  metadata.
+
 * GDALCA(dirfile_unit, field_code, field_code_len, const_type, array_len)
 
   Input:
@@ -1252,17 +1536,26 @@ Subroutines interacting with field metadata
   fragment given.  If move_data is non-zero, the binary file, for RAW fields, is
   also moved, if necessary.
 
+* GDMOVA(dirfile_unit, field_code, field_code_len, new_fragment)
+
+  Input:
+    INTEGER dirfile_unit, field_code_len, new_fragment
+    CHARACTER*<field_code_len> field_code
+
+  This subroutine wraps gd_move_alias(3), and moves the specified alias to the
+  new fragment given.
+
 * GDRENM(dirfile_unit, field_code, field_code_len, new_name, new_name_len,
-  move_data)
+  flags)
 
   Input:
-    INTEGER dirfile_unit, field_code_len, new_name_len, move_data
+    INTEGER dirfile_unit, field_code_len, new_name_len, flags
     CHARACTER*<field_code_len> field_code
     CHARACTER*<new_name_len> new_name
 
-  This subroutine wraps gd_rename(3), and changes the name of a field.  If
-  move_data is non-zero, and the field is a RAW field, the binary file
-  associated with the field will also be renamed.
+  This subroutine wraps gd_rename(3), and changes the name of a field.  The
+  flags parameter should be zero or more of the GDR_xx parameters, bitwise or'd
+  together.
 
 * GDNTYP(ntype, dirfile_unit, field_code, field_code_len)
 
@@ -1317,12 +1610,12 @@ Subroutines interacting with field metadata
   This subroutine modifies the element indexed by index of the scalar array
   member of the gd_entry_t object associated with the specified field code.  If
   index is too large for the specified field, nothing happens.  The array is
-  indexed starting from one.  If scalar indicates a CONST field, sclaar_index
+  indexed starting from one.  If scalar indicates a CONST field, scalar_index
   is ignored.
 
 
-Subroutines which add or delete fields
---------------------------------------
+Subroutines which add or delete fields and aliases
+--------------------------------------------------
 
 * GDDELE(dirfile_unit, field_code, field_code_len, flags)
 
@@ -1332,7 +1625,29 @@ Subroutines which add or delete fields
 
   This subroutine wraps gd_delete(3).  It deletes the indicated field.  The
   flags parameter should be either zero, or one or more of the delete flags
-  listed below combined with a bitwise or.
+  listed below bitwise or'd together.
+
+* GDDELA(dirfile_unit, field_code, field_code_len, flags)
+
+  Input:
+    INTEGER dirfile_unit field_code_len, flags
+    CHARACTER*<field_code_len> field_code
+
+  This subroutine wraps gd_delete_alias(3).  It deletes the indicated alias.
+  The flags parameter should be either zero, or one or more of the delete flags
+  listed below bitwise or'd together.
+
+* GDADAL(dirfile_unit, field_code, field_code_len, targ, targ_len,
+  fragment_index)
+
+  Input:
+    INTEGER dirfile_unit, field_code_len, targ_len, fragment_index
+    CHARACTER*<field_code_len> field_code
+    CHARACTER*<targ_len> targ
+
+  This subroutine wraps gd_add_alias(3).  It adds an alias named field_code
+  pointing to targ in the fragment indexed by fragment_index.
+
 
 * GDADRW(dirfile_unit, field_code, field_code_len, data_type, spf,
   fragment_index)
@@ -1502,7 +1817,37 @@ Subroutines which add or delete fields
     CHARACTER*<in_field_len> in_field
 
   This subroutine adds a PHASE field with the supplied parameters to the
-  specified format file fragment of the dirfile.
+  specified fragment of the dirfile.
+
+* GDADWD(dirfile_unit, field_code, field_code_len, in_field, in_field_len,
+  check_field, check_field_len, windop, threshold, fragment_index)
+
+  Input:
+    INTEGER dirfile_unit, field_code_len, in_field_len, check_field_len, windop
+    CHARACTER*<field_code_len> field_code
+    CHARACTER*<in_field_len> in_field
+    CHARACTER*<check_field_len> check_field
+    INTEGER threshold
+      or
+    DOUBLE PRECISION threshold
+
+    This subroutine adds a WINDOW field with the supplied parameters to the
+    specified fragment of the dirfile.  If windop is one of GDW_EQ, GDW_NE,
+    GDW_ST, or GDW_CL, threshold should be an integer; otherwise, threshold
+    should be of type double precision.
+
+* GDADMX(dirfile_unit, field_code, field_code_len, infield, infield_len,
+  countfield, countfield_len, countval, period, fragment_index)
+
+  Input:
+    INTEGER dirfile_unit, field_code_len, infield_len, countfile_len, countval
+    INTEGER period, fragment_index
+    CHARACTER*<field_code_len> field_code
+    CHARACTER*<infield_len> infield
+    CHARACTER*<countfield_len> countfield
+
+  This subroutine adds a MPLEX field with the supplied parameters to the
+  specified fragment of the dirfile.
 
 * GDADCA(dirfile_unit, field_code, field_code_len, const_type, array_len,
   data_type, data, fragment_index)
@@ -1561,6 +1906,8 @@ Subroutines which add or delete fields
   This subroutine wraps gd_madd_spec(3), and allows adding a metafield to a
   dirfile given a field specification line.
 
+* GDMDAL(dirfile_unit, parent, parent_len, field_code, field_code_len, targ,
+  targ_len)
 * GDMDBT(dirfile_unit, parent, parent_len, field_code, field_code_len, in_field,
   in_field_len, bitnum, numbits)
 * GDMDCL(dirfile_unit, parent, parent_len, field_code, field_code_len, nfields,
@@ -1589,6 +1936,10 @@ Subroutines which add or delete fields
   in_field_len, dividend)
 * GDMDSB(dirfile_unit, parent, parent_len, field_code, field_code_len, in_field,
   in_field_len, bitnum, numbits)
+* GDMDWD(dirfile_unit, parent, field_code, field_code_len, in_field,
+  in_field_len, check_field, check_field_len, windop, threshold)
+* GDMDMX(dirfile_unit, parent, field_code, field_code_len, in_field,
+  in_field_len, count_field, count_field_len, count_val, period)
 * GDMDCA(dirfile_unit, parent, parent_len, field_code, field_code_len,
   const_type, array_len, data_type, data)
 * GDMDCO(dirfile_unit, parent, parent_len, field_code, field_code_len,
@@ -1611,70 +1962,84 @@ Error codes (returned by GDEROR):
   F77 symbol      C symbol             Notes
   ----------      -------------------  ---------------------------------------
   GD_EOK          GD_E_OK              This is guaranteed to be equal to zero.
-  GD_EOP          GD_E_OPEN
-  GD_EFO          GD_E_FORMAT
-  GD_ETR          GD_E_TRUNC
-  GD_ECR          GD_E_CREAT
-  GD_EBC          GD_E_BAD_CODE
-  GD_EBT          GD_E_BAD_TYPE
-  GD_ERW          GD_E_RAW_IO
-  GD_EOF          GD_E_OPEN_FRAGMENT
-  GD_EOI          GD_E_OPEN_INCLUDE    An alias for GD_E_OPEN_FRAGMENT.
-  GD_EIE          GD_E_INTERNAL_ERROR
+  GD_EAC          GD_E_ACCMODE
   GD_EAL          GD_E_ALLOC
-  GD_ERA          GD_E_RANGE
-  GD_EOL          GD_E_OPEN_LINFILE
-  GD_ERL          GD_E_RECURSE_LEVEL
+  GD_EAR          GD_E_ARGUMENT
+  GD_EBC          GD_E_BAD_CODE
   GD_EBD          GD_E_BAD_DIRFILE
-  GD_EBF          GD_E_BAD_FIELD_TYPE
-  GD_EAC          GD_E_ACCMODE
   GD_EBE          GD_E_BAD_ENTRY
-  GD_EDU          GD_E_DUPLICATE
-  GD_EDM          GD_E_DIMENSION
+  GD_EBF          GD_E_BAD_FIELD_TYPE
   GD_EBI          GD_E_BAD_INDEX
-  GD_EBS          GD_E_BAD_SCALAR
+  GD_EBO          GD_E_BOUNDS
+  GD_EBP          GD_E_BAD_PROTECTION  Deprecated; kept as an alias for GD_EAR.
   GD_EBR          GD_E_BAD_REFERENCE
-  GD_EPT          GD_E_PROTECTED
-  GD_EDL          GD_E_DELETE
-  GD_EEN          GD_E_BAD_ENDIANNESS
+  GD_EBS          GD_E_BAD_SCALAR
+  GD_EBT          GD_E_BAD_TYPE
   GD_ECB          GD_E_CALLBACK
-  GD_EBP          GD_E_BAD_PROTECTION
-  GD_UCL          GD_E_UNCLEAN_DB
+  GD_ECR          GD_E_CREAT
+  GD_EDL          GD_E_DELETE
+  GD_EDM          GD_E_DIMENSION
   GD_EDO          GD_E_DOMAIN
-  GD_ERP          GD_E_BAD_REPR
-  GD_EVR          GD_E_BAD_VERSION
+  GD_EDU          GD_E_DUPLICATE
+  GD_EEN          GD_E_BAD_ENDIANNESS  Deprecated; kept as an alias for GD_EAR.
+  GD_EEX          GD_E_EXISTS
   GD_EFL          GD_E_FLUSH
-  GD_EBO          GD_E_BOUNDS
+  GD_EFO          GD_E_FORMAT
+  GD_EIE          GD_E_INTERNAL_ERROR
+  GD_EOF          GD_E_OPEN_FRAGMENT
+  GD_EOI          GD_E_OPEN_INCLUDE    Deprecated; kept as an alias for GD_EOF.
+  GD_EOL          GD_E_OPEN_LINFILE
+  GD_EOP          GD_E_OPEN
+  GD_EPT          GD_E_PROTECTED
+  GD_ERA          GD_E_RANGE
+  GD_ERL          GD_E_RECURSE_LEVEL
+  GD_ERP          GD_E_BAD_REPR
+  GD_ERW          GD_E_RAW_IO
   GD_ETL          GD_E_LINE_TOO_LONG
+  GD_ETR          GD_E_TRUNC
+  GD_EUE          GD_E_UNKNOWN_ENCODING
+  GD_EVR          GD_E_BAD_VERSION    Deprecated; kept as an alias for GD_EAR.
+  GD_UCL          GD_E_UNCLEAN_DB
+  GD_UNS          GD_E_UNSUPPORTED
 
-Dirfile flags (required by GDOPEN, GDCOPN, and GDINCL):
+Dirfile flags (required by GDOPEN, GDCOPN, GDINCL, GDINCA, and GDFLAG):
 
   F77 symbol      C symbol          Notes
   ----------      ----------------- --------------------------------------
   GD_RO           GD_RDONLY         The flags argument passed to GDOPEN
   GD_RW           GD_RDWR           must contain at least GD_RO or GD_RW
-  GD_CR           GD_CREAT
-  GD_EX           GD_EXCL
-  GD_TR           GD_TRUNC
+
   GD_AE           GD_ARM_ENDIAN
   GD_BE           GD_BIG_ENDIAN
-  GD_LE           GD_LITTLE_ENDIAN
-  GD_NA           GD_NOT_ARM_ENDIAN
+  GD_CR           GD_CREAT
+  GD_EX           GD_EXCL
   GD_FC           GD_FORCE_ENCODING
   GD_FE           GD_FORCE_ENDIAN
-  GD_PE           GD_PEDANTIC
-  GD_PM           GD_PERMISSIVE
-  GD_VB           GD_VERBOSE
   GD_ID           GD_IGNORE_DUPS
   GD_IR           GD_IGNORE_REFS
+  GD_LE           GD_LITTLE_ENDIAN
+  GD_NA           GD_NOT_ARM_ENDIAN
+  GD_PE           GD_PEDANTIC
+  GD_PM           GD_PERMISSIVE
   GD_PP           GD_PRETTY_PRINT
-  GD_EA           GD_AUTO_ENCODED
-  GD_EN           GD_UNENCODED
-  GD_ET           GD_TEXT_ENCODED
-  GD_ES           GD_SLIM_ENCODED
-  GD_EG           GD_GZIP_ENCODED
-  GD_EB           GD_BZIP2_ENCODED
-  GD_EL           GD_LZMA_ENCODED
+  GD_TR           GD_TRUNC
+  GD_TS           GD_TRUNCSUB
+  GD_VB           GD_VERBOSE
+
+Encoding types:
+
+  F77 symbol      C symbol          Notes
+  ----------      ----------------- --------------------------------------
+  GDE_AU          GD_AUTO_ENCODED
+  GDE_BZ          GD_BZIP2_ENCODED
+  GDE_GZ          GD_GZIP_ENCODED
+  GDE_LZ          GD_LZMA_ENCODED
+  GDE_SL          GD_SLIM_ENCODED
+  GDE_SI          GD_SIE_ENCODED
+  GDE_TX          GD_TEXT_ENCODED
+  GDE_UN          GD_UNENCODED
+  GDE_ZS          GD_ZZSLIM_ENCODED
+  GDE_ZZ          GD_ZZIP_ENCODED
 
 Entry types (required by GDFLDT):
 
@@ -1692,6 +2057,8 @@ Entry types (required by GDFLDT):
   GD_SBE          GD_SBIT_ENTRY
   GD_DVE          GD_DIVIDE_ENTRY
   GD_RCE          GD_RECIP_ENTRY
+  GD_WDE          GD_WINDOW_ENTRY
+  GD_MXE          GD_MPLEX_ENTRY
   GD_COE          GD_CONST_ENTRY
   GD_CAE          GD_CARRAY_ENTRY
   GD_STE          GD_STRING_ENTRY
@@ -1726,6 +2093,13 @@ Delete flags (required by GDDELE):
   GDD_DR          GD_DEL_DEREF
   GDD_FO          GD_DEL_FORCE
 
+Rename flags (requred by GDRENM):
+
+  F77 symbol      C symbol
+  ----------      -----------------
+  GDR_DT          GD_REN_DATA
+  GDR_UP          GD_REN_UPDB
+
 Protection levels (returned by GDGPRT and required by GDAPRT):
 
   F77 symbol      C symbol          Notes
@@ -1749,13 +2123,17 @@ Syntax suberrors (provided to the registered callback function, see GDCOPN):
 
   F77 symbol      C symbol
   ----------      ---------------------
+  GDF_AL          GD_E_FORMAT_ALIAS
   GDF_BN          GD_E_FORMAT_BITNUM
   GDF_CH          GD_E_FORMAT_CHARACTER
   GDF_DU          GD_E_FORMAT_DUPLICATE
   GDF_EN          GD_E_FORMAT_ENDIAN
   GDF_LI          GD_E_FORMAT_BAD_LINE
   GDF_LO          GD_E_FORMAT_LOCATION
+  GDF_LT          GD_E_FORMAT_LITERAL
+  GDF_MM          GD_E_FORMAT_META_META
   GDF_MR          GD_E_FORMAT_METARAW
+  GDF_MV          GD_E_FORMAT_MPLEXVAL
   GDF_NA          GD_E_FORMAT_BAD_NAME
   GDF_NB          GD_E_FORMAT_NUMBITS
   GDF_NF          GD_E_FORMAT_N_FIELDS
@@ -1767,7 +2145,7 @@ Syntax suberrors (provided to the registered callback function, see GDCOPN):
   GDF_SZ          GD_E_FORMAT_BITSIZE
   GDF_TY          GD_E_FORMAT_BAD_TYPE
   GDF_UM          GD_E_FORMAT_UNTERM
-  GDF_LT          GD_E_FORMAT_LITERAL
+  GDF_WO          GD_E_FORMAT_WINDOP
 
 Special version symbols:
 
@@ -1777,10 +2155,48 @@ Special version symbols:
   GDSV_L          GD_VERSION_LATEST
   GDSV_E          GD_VERSION_EARLIEST
 
+Seek flags:
+
+  F77 symbol      C symbol
+  ----------      ---------------------
+  GDSK_C          GD_SEEK_CUR
+  GDSK_E          GD_SEEK_END
+  GDSK_P          GD_SEEK_PAD
+  GDSK_S          GD_SEEK_SET
+
+WINDOW entry operations:
+
+  F77 symbol      C symbol
+  ----------      ---------------------
+  GDW_CL          GD_WINDOP_CLR
+  GDW_EQ          GD_WINDOP_EQ
+  GDW_GE          GD_WINDOP_GE
+  GDW_GT          GD_WINDOP_GT
+  GDW_LE          GD_WINDOP_LE
+  GDW_LT          GD_WINDOP_LT
+  GDW_NE          GD_WINDOP_NE
+  GDW_ST          GD_WINDOP_SET
+  GDW_UN          GD_WINDOP_UNK
+
+Desync flags:
+
+  F77 symbol      C symbol
+  ----------      ---------------------
+  GDDS_P          GD_DESYNC_PATHCHECK
+  GDDS_O          GD_DESYNC_REOPEN
+
+MPLEX lookback parameters:
+
+  F77 symbol      C symbol
+  ----------      ---------------------
+  GDLB_A          GD_LOOKBACK_ALL
+  GDLB_D          GD_DEFAULT_LOOKBACK
+
 Miscellaneous parameters:
 
   F77 symbol      C symbol
   ----------      -------------------------
   GD_ALL          GD_ALL_FRAGMENTS
-  GD_DSV          DIRFILE_STANDARDS_VERSION
+  GD_DSV          GD_DIRFILE_STANDARDS_VERSION
+  GD_HER          GD_HERE
   GD_MLL          GD_MAX_LINE_LENGTH
diff --git a/doc/README.f95 b/doc/README.f95
index 877c70d..11d2735 100644
--- a/doc/README.f95
+++ b/doc/README.f95
@@ -42,10 +42,6 @@ unit numbers in place of C's DIRFILE pointers are:
   character (len=*), intent(in) :: dirfilename
   integer, intent(in) :: flags
 
-* integer function fgd_carray_len (dirfile_unit, field_code)
-  integer, intent(in) :: dirfile
-  character (len=*), intent(in) :: field_code
-
 * integer function fgd_cbopen (dirfilename, flags, sehandler)
   character (len=*), intent (in) :: dirfilename
   integer, intent (in) :: flags
@@ -60,14 +56,34 @@ unit numbers in place of C's DIRFILE pointers are:
 * subroutine fgd_close (dirfile_unit)
   integer, intent(in) :: dirfile
 
+* subroutine fgd_desync (dirfile_unit, flags)
+  integer :: fgd_desync
+  integer, intent(in) :: dirfile, flags
+
 * subroutine fgd_discard (dirfile_unit)
   integer, intent(in) :: dirfile
 
+* subroutine fgd_verbose_prefix(dirfile, prefix)
+  integer, intent(in) :: dirfile
+  character (len=*), intent(in) :: prefix
+
+* subroutine fgd_mplex_lookback(dirfile, lookback)
+  integer, intent(in) :: dirfile, lookback
+
 * subroutine fgd_flush (dirfile_unit, field_code)
   integer, intent(in) :: dirfile
   character (len=*), intent(in) :: field_code
 
-  (If field_code is the empty string, the entire dirfile will be flushed.)
+* subroutine fgd_sync (dirfile, field_code)
+  integer, intent(in) :: dirfile
+  character (len=*), intent(in) :: field_code
+
+* subroutine fgd_raw_close (dirfile, field_code)
+  integer, intent(in) :: dirfile
+  character (len=*), intent(in) :: field_code
+
+  (For fgd_flush, fgd_sync and fgd_raw_close, if field_code is the empty string,
+  the operation will be performed on the entire dirfile.)
 
 * subroutine fgd_metaflush (dirfile_unit)
   integer, intent(in) :: dirfile
@@ -76,6 +92,12 @@ unit numbers in place of C's DIRFILE pointers are:
   ind)
   integer, intent(in) :: dirfile_unit, ind
 
+* function fgd_nentries (dirfile, parent, entype, flags)
+  integer :: fgd_nentries
+  integer, intent(in) :: dirfile, entype, flags
+  character (len=*), intent(in) :: parent
+  integer :: parent_l
+
 * integer function fgd_nfields (dirfile_unit)
   integer, intent(in) :: dirfile_unit
 
@@ -107,6 +129,12 @@ unit numbers in place of C's DIRFILE pointers are:
   integer, intent(in) :: dirfile
   character (len=*), intent(in) :: field_code
 
+* integer function fgd_error (dirfile_unit)
+  integer, intent(in) :: dirfile_unit
+ 
+* integer function fgd_error_count (dirfile_unit)
+  integer, intent(in) :: dirfile_unit
+ 
 * integer function fgd_error_string (dirfile, buffer, len)
   integer, intent(in) :: dirfile, len
   character (len=<len>), intent(out) :: buffer
@@ -132,6 +160,19 @@ unit numbers in place of C's DIRFILE pointers are:
   integer, intent(in) :: dirfile, fragment_index, flags
   character (len=*), intent(in) :: inc_file
 
+* subroutine fgd_include_affix (dirfile, fragmentname, fragment_index, prefix,
+  suffix, flags)
+  integer, intent(in) :: dirfile, fragment_index, flags
+  character (len=*), intent(in) :: fragmentname, prefix, suffix
+
+* integer function fgd_carray_len (dirfile_unit, field_code)
+  integer, intent(in) :: dirfile
+  character (len=*), intent(in) :: field_code
+
+* subroutine fgd_add_alias (dirfile, field_code, targ, fragment_index)
+  integer, intent(in) :: dirfile, fragment_index
+  character(len=*), intent(in) :: field_code, targ
+
 * subroutine fgd_add_bit (dirfile, field_name, in_field, bitnum, numbits,
   fragment_index)
   integer, intent(in) :: dirfile, bitnum, numbits, fragment_index
@@ -189,6 +230,11 @@ unit numbers in place of C's DIRFILE pointers are:
   integer, intent(in) :: dirfile, fragment_index
   character (len=*), intent(in) :: field_name, in_field, table
 
+* subroutine fgd_add_mplex (dirfile, field_code, in_field, count_field,
+  count_val, period, fragment_index)
+  character(len=*), intent(in) :: field_code, in_field, count_field
+  integer, intent(in) :: dirfile, count_val, period, fragment_index
+
 * subroutine fgd_add_multiply (dirfile, field_name, in_field1, in_field2,
   fragment_index)
   integer, intent(in) :: dirfile, fragment_index
@@ -229,6 +275,21 @@ unit numbers in place of C's DIRFILE pointers are:
   the value of the string.  Use the gd_put_string procedures after creating the
   field).
 
+* subroutine fgd_add_window_i (dirfile, field_code, in_field, check_field,
+  windop, threshold, fragment_index)
+  character(len=*), intent(in) :: field_code, in_field, check_field
+  integer, intent(in) :: dirfile, windop, threshold, fragment_index
+
+* subroutine fgd_add_window_r (dirfile, field_code, in_field, check_field, &
+  windop, threshold, fragment_index)
+  character(len=*), intent(in) :: field_code, in_field, check_field
+  integer, intent(in) :: dirfile, windop, fragment_index
+  double precision, intent(in) :: threshold
+
+* subroutine fgd_madd_alias (dirfile, parent, field_code, targ)
+  integer, intent(in) :: dirfile
+  character(len=*), intent(in) :: parent, field_code, targ
+
 * subroutine fgd_madd_bit (dirfile, parent, field_name, in_field, bitnum,
   numbits)
   integer, intent(in) :: dirfile, bitnum, numbits
@@ -291,6 +352,11 @@ unit numbers in place of C's DIRFILE pointers are:
   integer, intent(in) :: dirfile
   character (len=*), intent(in) :: field_name, in_field, table, parent
 
+* subroutine fgd_madd_mplex (dirfile, parent, field_code, in_field, count_field,
+  count_val, period)
+  character(len=*), intent(in) :: parent, field_code, in_field, count_field
+  integer, intent(in) :: dirfile, count_val, period
+
 * subroutine fgd_madd_phase (dirfile, parent, field_name, in_field, phase)
   integer, intent(in) :: dirfile, phase
   character (len=*), intent(in) :: field_name, in_field, parent
@@ -319,11 +385,21 @@ unit numbers in place of C's DIRFILE pointers are:
   set the value of the string.  Use the gd_put_string procedures after creating
   the field).
 
+* subroutine fgd_madd_window_i (dirfile, parent, field_code, in_field,
+  check_field, windop, threshold)
+  character(len=*), intent(in) :: parent, field_code, in_field, check_field
+  integer, intent(in) :: dirfile, windop, threshold
+
+* subroutine fgd_madd_window_r (dirfile, parent, field_code, in_field,
+  check_field, windop, threshold)
+  character(len=*), intent(in) :: parent, field_code, in_field, check_field
+  integer, intent(in) :: dirfile, windop
+  double precision, intent(in) :: threshold
+
 * character (len=GD_FIELD_LEN) function fgd_reference (dirfile)
   integer, intent(in) :: dirfile
 
-* character (len=GD_FIELD_LEN)  function fgd_reference (dirfile, &
-  field_code)
+* character (len=GD_FIELD_LEN)  function fgd_reference (dirfile, field_code)
   integer, intent(in) :: dirfile
   character (len=*), intent(in) :: field_code
 
@@ -358,9 +434,17 @@ unit numbers in place of C's DIRFILE pointers are:
 * integer function fgd_protection (dirfile, fragment)
   integer, intent(in) :: dirfile, fragment
 
-* subroutine fgd_protect (dirfile, protection_level, fragment)
+* subroutine fgd_alter_protection (dirfile, protection_level, fragment)
   integer, intent(in) :: dirfile, protection_level, fragment
 
+* subroutine fgd_fragment_affixes (prefix, suffix, dirfile, fragment_index)
+  character(len=*), intent(out) :: prefix, suffix
+  integer, intent(in) :: dirfile, fragment_index
+
+* subroutine fgd_alter_affixes (dirfile, fragment_index, prefix, suffix)
+  integer, intent(in) :: dirfile, fragment_index
+  character(len=*), intent(in) :: prefix, suffix
+
 * integer function fgd_native_type (dirfile, field_code)
   integer integer(in) :: dirfile
   character (len=*), intent(in) :: field_code
@@ -380,6 +464,10 @@ unit numbers in place of C's DIRFILE pointers are:
   integer, intent(in) :: dirfile, new_fragment, move_data
   character (len=*), intent(in) :: field_code
 
+* subroutine fgd_move_alias (dirfile, field_code, new_fragment)
+  integer, intent(in) :: dirfile, new_fragment
+  character (len=*), intent(in) :: field_code
+
 * subroutine fgd_alter_bit (dirfile, field_name, in_field, bitnum, numbits)
   integer, intent(in) :: dirfile, bitnum, numbits
   character (len=*), intent(in) :: field_name, in_field
@@ -423,6 +511,11 @@ unit numbers in place of C's DIRFILE pointers are:
   integer, intent(in) :: dirfile, move
   character (len=*), intent(in) :: field_name, in_field, table
 
+* subroutine fgd_alter_mplex (dirfile, field_name, in_field, count_field,
+  count_val, period)
+  integer, intent(in) :: dirfile, count_val, period
+  character (len=*), intent(in) :: field_name, in_field, count_field
+
 * subroutine fgd_alter_multiply (dirfile, field_name, in_field1, in_field2)
   integer, intent(in) :: dirfile
   character (len=*), intent(in) :: field_name, in_field1, in_field2
@@ -450,6 +543,17 @@ unit numbers in place of C's DIRFILE pointers are:
   integer, intent(in) :: dirfile, bitnum, numbits
   character (len=*), intent(in) :: field_name, in_field
 
+* subroutine fgd_alter_window_i (dirfile, field_name, in_field, check_field,
+  windop, threshold)
+  integer, intent(in) :: dirfile, windop, threshold
+  character (len=*), intent(in) :: field_name, in_field, check_field
+
+* subroutine fgd_alter_window_r (dirfile, field_name, in_field, check_field,
+  windop, threshold)
+  integer, intent(in) :: dirfile, windop
+  character (len=*), intent(in) :: field_name, in_field, check_field
+  double precision, intent(in) :: threshold
+
 * subroutine fgd_alter_spec (dirfile, spec, recode)
   integer, intent(in) :: dirfile, recode
   character (len=*), intent(in) :: spec
@@ -458,14 +562,18 @@ unit numbers in place of C's DIRFILE pointers are:
   integer, intent(in) :: dirfile, recode
   character (len=*), intent(in) :: parent, spec
 
-* subroutine fgd_rename (dirfile, field_code, new_name, move_data)
-  integer, intent(in) :: dirfile, move_data
+* subroutine fgd_rename (dirfile, field_code, new_name, flags)
+  integer, intent(in) :: dirfile, flags
   character (len=*), intent(in) :: field_code, new_name
 
 * subroutine fgd_delete (dirfile, field_code, flags)
   integer, intent(in) :: dirfile, flags
   character (len=*), intent(in) :: field_code
 
+* subroutine fgd_delete_alias (dirfile, field_code, flags)
+  integer, intent(in) :: dirfile, flags
+  character (len=*), intent(in) :: field_code
+
 * integer function fgd_entry_type (dirfile, field_code)
   integer, intent(in) :: dirfile
   character (len=*), intent(in) :: field_code
@@ -508,6 +616,44 @@ unit numbers in place of C's DIRFILE pointers are:
 
 * integer function fgd_invalid_dirfile ()
 
+* integer function fgd_seek (dirfile, field_code, frame_num, sample_num, flags)
+  integer, intent(in) :: dirfile, frame_num, sample_num, flags
+  character (len=*), intent(in): field_code
+
+* subroutine fgd_strtok (token, token_len, dirfile, string)
+  character (len=*), intent(out) :: token
+  integer, intent(inout) :: token_len
+  integer, intent(in) :: dirfile
+  character (len=*), intent(in) :: string
+
+  (If passed the empty string, the next token of the previous string is
+  returned.)
+
+* integer function fgd_tell (dirfile, field_code)
+  integer, intent(in) :: dirfile
+  character (len=*), intent(in): field_code
+
+* character (len=GD_MAX_LINE_LENGTH) function fgd_alias_target (dirfile,
+  field_code)
+  integer, intent(in) :: dirfile
+  character(len=*), intent(in) :: field_code
+
+* integer function fgd_naliases (dirfile, field_code)
+  integer, intent(in) :: dirfile
+  character(len=*), intent(in) :: field_code
+
+* integer function fgd_hidden (dirfile, field_code)
+  integer, intent(in) :: dirfile
+  character (len=*), intent(in) :: field_code
+
+* subroutine fgd_hide (dirfile, field_code)
+  integer, intent(in) :: dirfile
+  character (len=*), intent(in) :: field_code
+
+* subroutine fgd_unhide (dirfile, field_code)
+  integer, intent(in) :: dirfile
+  character (len=*), intent(in) :: field_code
+
 
 In order to respect type safety, the gd_getdata and gd_putdata analogues encode
 the data type of their array in their function name, rather than as a parameter.
@@ -572,27 +718,33 @@ Otherwise, they behave the same as their C counterparts.
   <datatype>, dimension(:), intent(in) :: data_in
 
   No corresponding fgd_putdata_n function exists, since GD_NULL is not an
-  acceptable input data_type for putdata(3).
+  acceptable input data_type for gd_putdata(3).
 
-  Analogously for gd_get_carray_slice, gd_get_constant, gd_put_carray_slice, and
-  gd_put_constant, for which only the _i1 versions are shown here:
+  Analogously for gd_constants, gd_get_carray_slice, gd_get_constant,
+  gd_mconstants, gd_put_carray_slice, and gd_put_constant, for which only the
+  _i1 versions are shown here:
 
+* subroutine fgd_constants_i1(values, dirfile)
+  integer(1), dimension(:), intent(out) :: values
 * subroutine fgd_get_carray_i1 (dirfile, field_code, data_out, start, array_len)
   integer, intent(in) :: dirfile_unit, start, array_len
   character (len=*), intent(in) :: field_code
-  <datatype>, intent(out) :: data_out
+  integer(1), intent(out) :: data_out
 * subroutine fgd_get_constant_i1 (dirfile, field_code, data_out)
   integer, intent(in) :: dirfile_unit
   character (len=*), intent(in) :: field_code
-  <datatype>, intent(out) :: data_out
+  integer(1), intent(out) :: data_out
+* subroutine fgd_mconstants_i1(values, dirfile, parent)
+  integer(1), dimension(:), intent(out) :: values
+  character (len=*), intent(in) :: parent
 * subroutine fgd_put_carray_i1 (dirfile, field_code, data_in, start, array_len)
   integer, intent(in) :: dirfile_unit, start, array_len
   character (len=*), intent(in) :: field_code
-  <datatype>, intent(in) :: data_in
+  integer(1), intent(in) :: data_in
 * subroutine fgd_put_constant_i1 (dirfile, field_code, data_in)
   integer, intent(in) :: dirfile_unit
   character (len=*), intent(in) :: field_code
-  <datatype>, intent(in) :: data_in
+  integer(1), intent(in) :: data_in
 
   For the carray functions, if len is zero, gd_get_carray(3) or gd_put_carray(3)
   will be called to read or write the whole array.  Otherwise these subroutines
@@ -600,6 +752,16 @@ Otherwise, they behave the same as their C counterparts.
 
 Other procedures in the Fortran 95 bindings are:
 
+function fgd_entry_name_max (dirfile, parent, entype, flags)
+  integer :: fgd_entry_name_max
+  integer, intent(in) :: dirfile, entype, flags
+  character (len=*), intent(in) :: parent
+  integer :: parent_l
+
+  This function returns the length of the longest entry name defined in the
+  dirfile satisfying the given criteria.  The parameters are the same as they
+  are for fgd_nentries.
+
 * integer fgd_field_name_max (dirfile_unit)
   integer, intent(in) :: dirfile_unit
 
@@ -613,20 +775,47 @@ Other procedures in the Fortran 95 bindings are:
   This function returns the length of the longest field name defined in the
   dirfile for META fields of the supplied parent field.
 
-* subroutine fgd_field_list (field_list, dirfile, field_len)
-  character (len=<field_len>) dimension(:), intent(out) :: field_list
+* integer fgd_string_value_max (dirfile_unit)
   integer, intent(in) :: dirfile_unit
-  integer, intent(inout) :: field_len
 
-  This subroutine behaves analogously to gd_get_field_list(3), except that it
-  requires a third argument, field_len, which is the longest field name which
-  will fit in the supplied field_list array.  If the longest field name in the
-  dirfile is longer than field_len, field_len will be set to this value (which
-  is equivalent to the return value of fgd_field_name_max) and field_list
-  will remain untouched.  The character strings returned are Fortran strings.
+  This function returns the length of the longest STRING field (excluding /META
+  fields) in the database.
+
+* integer fgd_mstring_value_max (dirfile_unit, parent)
+  integer, intent(in) :: dirfile_unit
+  character (len=*), intent(in) :: parent
+
+  This function returns the length of the longest STRING metafield for the given
+  parent field.
+
+* integer fgd_alias_max (dirfile, field_code)
+  integer, intent(in) :: dirfile
+  character(len=*), intent(in) :: field_code
+
+  This function returns the length of the longest alias for the given
+  field_code.
+
+* subroutine fgd_entry_list (entry_list, dirfile, parent, entype, flags,
+  entry_len)
+  character(len=*), dimension(:), intent(out) :: entry_list
+  integer, intent(in) :: dirfile, entype, flags
+  integer, intent(inout) :: entry_len
+  character (len=*), intent(in) :: parent
+  integer :: max_len, nentries, i, parent_l
+
+  This subroutine behaves analogously to gd_entry_list(3), except that it
+  requires an additional argument, entry_len, which is the longest entry name
+  which will fit in the supplied entry_list array.  If the longest entry name in
+  the dirfile is longer than entry_len, entry_len will be set to this value
+  (which is equivalent to the return value of fgd_entry_name_max) and entry_list
+  will remain untouched.
 
   Analogously:
 
+* subroutine fgd_field_list (field_list, dirfile, field_len)
+  character (len=<field_len>) dimension(:), intent(out) :: field_list
+  integer, intent(in) :: dirfile_unit
+  integer, intent(inout) :: field_len
 * subroutine fgd_field_list_by_type (field_list, dirfile, entype, field_len)
   character (len=<field_len>) dimension(:), intent(out) :: field_list
   integer, intent(in) :: dirfile_unit, entype
@@ -635,31 +824,40 @@ Other procedures in the Fortran 95 bindings are:
   character (len=<field_len>) dimension(:), intent(out) :: field_list
   integer, intent(in) :: dirfile_unit
   integer, intent(inout) :: field_len
+* subroutine fgd_strings (strings, dirfile, string_len)
+  character (len=<string_len>) dimension(:), intent(out) :: string_list
+  integer, intent(in) :: dirfile_unit
+  integer, intent(inout) :: string_len
+* subroutine fgd_aliases (aliases, dirfile, field_code, alias_len)
+  character(len=<alias_len> dimension(:), intent(out) :: aliases
+  integer, intent(in) :: dirfile
+  character(len=*), intent(in) :: field_code
+  integer, intent(inout) :: alias_len
 
   Also analogously, except that field_len will be equivalent to the return
-  value of fgd_mfield_name_max, if too small:
+  value of fgd_mfield_name_max or fgd_string_value_max, if too small:
 
-* subroutine fgd_mfield_list (field_list, dirfile, field_len)
+* subroutine fgd_mfield_list (field_list, dirfile, parent, field_len)
   character (len=<field_len>) dimension(:), intent(out) :: field_list
   integer, intent(in) :: dirfile_unit
   integer, intent(inout) :: field_len
   character (len=*), intent(in) :: parent
 * subroutine fgd_mfield_list_by_type (field_list, dirfile, entype,
-  field_len)
+  parent, field_len)
   character (len=<field_len>) dimension(:), intent(out) :: field_list
   integer, intent(in) :: dirfile_unit, entype
   integer, intent(inout) :: field_len
   character (len=*), intent(in) :: parent
-* subroutine fgd_mvector_list (field_list, dirfile, field_len)
+* subroutine fgd_mvector_list (field_list, dirfile, parent, field_len)
   character (len=<field_len>) dimension(:), intent(out) :: field_list
   integer, intent(in) :: dirfile_unit
   integer, intent(inout) :: field_len
   character (len=*), intent(in) :: parent
-
-* integer function fgd_error (dirfile_unit)
+* subroutine fgd_mstrings (string_list, dirfile, parent, string_len)
+  character (len=<string_len>) dimension(:), intent(out) :: string_list
   integer, intent(in) :: dirfile_unit
- 
-  This returns the DIRFILE error associated with the supplied dirfile unit.
+  integer, intent(inout) :: string_len
+  character (len=*), intent(in) :: parent
 
 * integer function fgd_entry (dirfile_unit, field_code, ent)
   integer, intent(in) :: dirfile_unit
@@ -667,19 +865,20 @@ Other procedures in the Fortran 95 bindings are:
   type(gd_entry), intent(out) :: ent
 
   This fills ent with the metadata for field_code obtained by calling
-  gd_get_entry(3).  It returns the field type, or GD_NO_ENTRY if an error
-  occurred in the gd_get_entry() call.  The gd_entry type is defined in the
+  gd_entry(3).  It returns the field type, or GD_NO_ENTRY if an error
+  occurred in the gd_entry() call.  The gd_entry type is defined in the
   getdata module to be:
 
   type gd_entry
     integer :: field_type, n_fields, spf, data_type, bitnum, numbits, shift
-    integer :: fragment_index, comp_scal, poly_ord, array_len
+    integer :: fragment_index, comp_scal, poly_ord, array_len, windop
+    integer :: ithreshold, count_val, period
     character (len=GD_FIELD_LEN), dimension(3) :: field
     character (len=GD_FIELD_LEN), dimension(6) :: scalar
     integer, dimension(6) :: scalar_ind
     double precision, dimension(3) :: m, b
     double precision, dimension(6) :: a
-    double precision :: dividend
+    double precision :: dividend, rthreshold
     double complex, dimension(3) :: cm, cb
     double complex, dimension(6) :: ca
     double complex :: cdividend
@@ -688,22 +887,26 @@ Other procedures in the Fortran 95 bindings are:
   where GD_FIELD_LEN is a constant parameter equal to 4096.  Character strings
   are all stored in field(:) according to the following table:
 
-    TYPES              FIELD(1)    FIELD(2)    FIELD(3)
-    -----------------  ----------  ----------  ----------
-    RAW                 --          --          --
+    TYPES               FIELD(1)    FIELD(2)    FIELD(3)
+    ------------------  ----------  ----------  ----------
+    RAW                  --          --          --
 
-    LINCOM             infield[0]  infield[1]  infield[2]
+    LINCOM              infield[0]  infield[1]  infield[2]
 
-    LINTERP            infield[0]  table        --
+    LINTERP             infield[0]  table        --
 
     BIT / SBIT /
-    PHASE / RECIP /    infield[0]   --          --
+    PHASE / RECIP /     infield[0]   --          --
     POLYNOM
 
-    MULTIPLY / DIVIDE  infield[0]  infield[1]   --
+    MULTIPLY / DIVIDE / infield[0]  infield[1]   --
+    WINDOW
+
 
   Furthermore, data_type does double duty as the data_type parameter for RAW
-  fields, and the const_type parameter for CONST and CARRAY fields.
+  fields, and the const_type parameter for CONST and CARRAY fields.  For WINDOW
+  fields, only one of ithreshold and rthreshold will be set, according to the
+  windop parameter.
 
 * subroutine fgd_add (dirfile_unit, field_code, ent)
   integer, intent(in) :: dirfile_unit
diff --git a/doc/README.idl b/doc/README.idl
index f643289..7e89b0d 100644
--- a/doc/README.idl
+++ b/doc/README.idl
@@ -21,7 +21,7 @@ If the GetData IDL bindings have been found, you should see among the output
 something similar to:
 
   *** GETDATA - IDL GetData bindings (not loaded)
-      Version: 0.7.0, Build Date: Sat Oct 23 00:00:00 UTC 2010, Source: The GetData Project <getdata-devel at lists.sourceforge.net>
+      Version: 0.8.0, Build Date: Thu Apr 12 00:00:00 UTC 2012, Source: The GetData Project <getdata-devel at lists.sourceforge.net>
       Path: /usr/local/rsi/idl/bin/bin.linux.x86/idl_getdata.so
 
 The DLM will be automatically loaded by the interpreter the first time a IDL
@@ -75,25 +75,26 @@ refer to an open dirfile object.  Space is available in the DLM for only 1023
 dirfile units.  If an application attempts to open more than 1023 dirfiles
 simultaneously, the DLM will emit an error message and immediately return to the
 interpreter.  Passing an invalid dirfile unit number to a procedure which
-requires one as input (other than GD_CLOSE, which will simply ignore it)
-will result in the call failing with error code !GD.E_BAD_DIRFILE.
+requires one as input (other than GD_CLOSE and GD_DISCARD, which will simply
+ignore it) will result in the call failing with error code !GD.E_BAD_DIRFILE.
 
 IDL supports all GetData data types with the exception of INT8.  Attempting to
 return data as INT8 will result in an error.
 
-Except for the functions GETDATA_CONSTANTS, GD_ERROR, GD_ERROR_STRING, and
-GD_INVALID_DIRFILE, all IDL GetData functions and procedures may take two
-optional keyword parameters which deal with error reporting:
+Except for the functions GETDATA_CONSTANTS, GD_ERROR, GD_ERROR_COUNT,
+GD_ERROR_STRING, and GD_INVALID_DIRFILE, all IDL GetData functions and
+procedures may take two optional keyword parameters which deal with error
+reporting:
 
-  ERROR:   a variable in which the dirfile error number resulting from this
-           call will be stored.  It will be the !GD.E_* error codes
-           corresponding to the C API error code.  On success this will be
-           !GD.E_OK (= 0).  If this parameter is not specified, the dirfile
-           error can still be retrieved by calling GD_ERROR() after this call.
+  ERROR:   a variable into which the dirfile error number resulting from this
+           call will be stored.  It will be the !GD.E_* error code corresponding
+           to the C API error code.  On success this will be !GD.E_OK (= 0).  If
+           this parameter is not specified, the dirfile error can still be
+           retrieved by calling GD_ERROR() after this call.
   ESTRING: a variable in which the string representation of the error resulting
            from this call will be stored.  If this parameter is not specified,
            the the dirfile error string can still be retrieved by calling
-           GD_ERROR_STRING().
+           GD_ERROR_STRING() after the call.
 
 For brevity, these keyword parameters are omitted from the subroutine prototypes
 given below.
@@ -104,30 +105,37 @@ The GD_ENTRY Structure
 The GD_ENTRY structure is used in place of the C API's gd_entry_t data type.  It
 is essentially equivalent and is defined as:
 
+** Structure GD_ENTRY, 30 tags, length=512, data length=502:
   FIELD        STRING
-  FIELD_TYPE   INTEGER
-  FRAGMENT     INTEGER
+  FIELD_TYPE   INT
+  FRAGMENT     INT
   IN_FIELDS    STRING     Array[3]
   A            DOUBLE     Array[6]
   CA           DCOMPLEX   Array[6]
-  ARRAY_LEN    INTEGER
+  ARRAY_LEN    INT
   B            DOUBLE     Array[3]
   CB           DCOMPLEX   Array[3]
-  BITNUM       INTEGER
-  COMP_SCAL    INTEGER
-  DATA_TYPE    INTEGER
+  BITNUM       INT
+  COMP_SCAL    INT
+  COUNT_VAL    INT
+  DATA_TYPE    INT
   DIVIDEND     DOUBLE
   CDIVIDEND    DCOMPLEX
   M            DOUBLE     Array[3]
   CM           DCOMPLEX   Array[3]
-  N_FIELDS     INTEGER
-  NUMBITS      INTEGER
-  POLY_ORD     INTEGER
+  N_FIELDS     INT
+  NUMBITS      INT
+  PERIOD       INT
+  POLY_ORD     INT
   SCALAR       STRING     Array[6]
-  SCALAR_IND   INTEGER    Array[6]
+  SCALAR_IND   INT        Array[6]
   SHIFT        LONG
   SPF          UINT
   TABLE        STRING
+  UTHRESHOLD   ULONG
+  ITHRESHOLD   LONG
+  RTHRESHOLD   DOUBLE
+  WINDOP       INT
 
 The DATA_TYPE member is used for both RAW and CONST fields.  (The gd_entry_t
 object has a 'const_type' member for the CONST fields instead.)  For details on
@@ -154,8 +162,13 @@ PROCEDURE GD_ADD, dirfile_unit, entry, PARENT=parent
   'entry' input should be a GD_ENTRY structure.  If the keyword parameter
   PARENT is given, the field will be added as a metafield under the given parent
   field, otherwise the field will be added to the fragment index indicated in
-  the 'entry' structure.  This procedure may also be called as GD_MADD with
-  no change in functionality.  See gd_add(3) and gd_madd(3).
+  the 'entry' structure.  See gd_add(3) and gd_madd(3).
+
+PROCEDURE GD_ADD_ALIAS, dirfile_unit, field_code, target, FRAGMENT=fragment,
+  PARENT=parent
+
+  This procedure adds an alias called 'field_code' pointing to 'target' to
+  the fragment indicated by 'fragment'.  See gd_add_alias(3).
 
 PROCEDURE GD_ADD_BIT, dirfile_unit, field_name, in_field, BITNUM=bitnum,
   FRAGMENT=fragment, NUMBITS=numbits, PARENT=parent
@@ -165,9 +178,7 @@ PROCEDURE GD_ADD_BIT, dirfile_unit, field_name, in_field, BITNUM=bitnum,
   defaults to zero and numbits to one.  If PARENT is given, this field is
   added as a metafield under the given parent field.  Otherwise, the field is
   added to the fragment indexed by FRAGMENT, or the primary format file if
-  FRAGMENT is not given either.  This procedure may also be called as
-  GD_MADD_BIT with no change in functionality.  See gd_add_bit(3) and
-  gd_madd_bit(3).
+  FRAGMENT is not given either.  See gd_add_bit(3) and gd_madd_bit(3).
 
 PROCEDURE GD_ADD_CARRAY, dirfile_unit, field_name, FRAGMENT=fragment,
   LENGTH=length, PARENT=parent, TYPE=type, VALUE=value
@@ -179,9 +190,8 @@ PROCEDURE GD_ADD_CARRAY, dirfile_unit, field_name, FRAGMENT=fragment,
   given, LENGTH must be specified, and the field will be initialised to all
   zeros.  If PARENT is given, this field is added as a metafield under the
   given parent field.  Otherwise, the field is added to the fragment indexed by
-  FRAGMENT, or the primary format file if FRAGMENT is not given either.  This
-  procedure may also be called as GD_MADD_CARRAY with no change in
-  functionality.  See gd_add_carray(3) and gd_madd_carray(3).
+  FRAGMENT, or the primary format file if FRAGMENT is not given either.  See
+  gd_add_carray(3) and gd_madd_carray(3).
 
 PROCEDURE GD_ADD_CONST, dirfile_unit, field_name, FRAGMENT=fragment,
   PARENT=parent, TYPE=type, VALUE=value
@@ -192,8 +202,7 @@ PROCEDURE GD_ADD_CONST, dirfile_unit, field_name, FRAGMENT=fragment,
   which defaults to zero.  If PARENT is given, this field is added as a
   metafield under the given parent field.  Otherwise, the field is added to the
   fragment indexed by FRAGMENT, or the primary format file if FRAGMENT is not
-  given either.  This procedure may also be called as GD_MADD_CONST with no
-  change in functionality.  See gd_add_const(3) and gd_madd_const(3).
+  given either.  See gd_add_const(3) and gd_madd_const(3).
 
 PROCEDURE GD_ADD_DIVIDE, dirfile_unit, field_name, in_field1, in_field2,
   FRAGMENT=fragment, PARENT=parent
@@ -202,9 +211,8 @@ PROCEDURE GD_ADD_DIVIDE, dirfile_unit, field_name, in_field1, in_field2,
   The input vector fields are given by 'in_field1' and 'in_field2'.  If PARENT
   is given, this field is added as a metafield under the given parent field.
   Otherwise, the field is added to the fragment indexed by FRAGMENT, or the
-  primary format file if FRAGMENT is not given either.  This procedure may also
-  be called as GD_MADD_DIVIDE without change in functionality.  See
-  gd_add_divide(3) and gd_madd_divide(3).
+  primary format file if FRAGMENT is not given either.  See gd_add_divide(3)
+  and gd_madd_divide(3).
 
 PROCEDURE GD_ADD_LINCOM, dirfile_unit, field_name, in_field1, m1, b1,
   [in_field2, m2, b2, [in_field3, m3, b3,]] FRAGMENT=fragment, PARENT=parent
@@ -214,9 +222,7 @@ PROCEDURE GD_ADD_LINCOM, dirfile_unit, field_name, in_field1, m1, b1,
   passed to the function.  The scale factors and offset terms may be real or
   complex valued.  If PARENT is given, this field is added as a metafield under
   the given parent field.  Otherwise, the field is added to the fragment indexed
-  by FRAGMENT, or the primary format file if FRAGMENT is not given either.  This
-  procedure may also be called as GD_ADD_CLINCOM, GD_MADD_LINCOM, or
-  GD_MADD_CLINCOM without change in functionality.  See
+  by FRAGMENT, or the primary format file if FRAGMENT is not given either.  See
   gd_add_lincom(3), gd_add_clincom(3), gd_madd_lincom(3), and
   gd_madd_clincom(3). 
 
@@ -228,9 +234,18 @@ PROCEDURE GD_ADD_LINTERP, dirfile_unit, field_name, in_field, table,
   table is 'table'.  If PARENT is given, this field is added as a metafield
   under the given parent field.  Otherwise, the field is added to the fragment
   indexed by FRAGMENT, or the primary format file if FRAGMENT is not given
-  either.  This procedure may also be called as GD_MADD_LINTERP without
-  change in functionality.  See gd_add_linterp(3) and
-  gd_madd_linterp(3).
+  either.  See gd_add_linterp(3) and gd_madd_linterp(3).
+
+PROCEDURE GD_ADD_MPLEX, dirfile_unit, field_name, in_field, count_field,
+  value, FRAGMENT=fragment, MAX=max, PARENT=parent
+
+  This procedure adds a MPLEX field with the name 'field_name' to the dirfile.
+  The input vector is 'in_field', the multiplex index vector is 'count_field',
+  the value of the multiplex index is 'value' and the maximum value is 'max',
+  if specified.  If PARENT is given, this field is added as a metafield under
+  the given parent field.  Otherwise, the field is added to the fragment indexed
+  by FRAGMENT, or the primary format file if FRAGMENT is not given either.  See
+  gd_add_mplex(3) and gd_madd_mplex(3).
 
 PROCEDURE GD_ADD_MULTIPLY, dirfile_unit, field_name, in_field1, in_field2,
   FRAGMENT=fragment, PARENT=parent
@@ -239,8 +254,7 @@ PROCEDURE GD_ADD_MULTIPLY, dirfile_unit, field_name, in_field1, in_field2,
   dirfile.  The input vector fields are given by 'in_field1' and 'in_field2'.
   If PARENT is given, this field is added as a metafield under the given parent
   field.  Otherwise, the field is added to the fragment indexed by FRAGMENT, or
-  the primary format file if FRAGMENT is not given either.  This procedure may
-  also be called as GD_MADD_MULTIPLY without change in functionality.  See
+  the primary format file if FRAGMENT is not given either.  See
   gd_add_multiply(3) and gd_madd_multiply(3).
 
 PROCEDURE GD_ADD_PHASE, dirfile_unit, field_name, in_field, shift,
@@ -250,12 +264,11 @@ PROCEDURE GD_ADD_PHASE, dirfile_unit, field_name, in_field, shift,
   The input vector field is given by 'in_field' and the shift by 'shift'.  If
   PARENT is given, this field is added as a metafield under the given parent
   field.  Otherwise, the field is added to the fragment indexed by FRAGMENT, or
-  the primary format file if FRAGMENT is not given either.  This procedure may
-  also be called as GD_MADD_PHASE without change in functionality.  See
-  gd_add_phase(3) and gd_madd_phase(3).
+  the primary format file if FRAGMENT is not given either.  See gd_add_phase(3)
+  and gd_madd_phase(3).
 
 PROCEDURE GD_ADD_POLYNOM, dirfile_unit, field_name, in_field, a0, [a1, [a2,
-  [a3, [a4, [a5,]]]]], FRAGMENT=fragment, PARENT=parent
+  [a3, [a4, [a5,]]]]] FRAGMENT=fragment, PARENT=parent
 
   This procedure adds a POLYNOM field with the name 'field_name' to the dirfile.
   The input vector field is given by 'in_field' and the shift by the remaining
@@ -264,10 +277,8 @@ PROCEDURE GD_ADD_POLYNOM, dirfile_unit, field_name, in_field, a0, [a1, [a2,
   containing the co-efficients, otherwise each a<i> should be one co-efficient.
   If PARENT is given, this field is added as a metafield under the given parent
   field.  Otherwise, the field is added to the fragment indexed by FRAGMENT, or
-  the primary format file if FRAGMENT is not given either.  This procedure may
-  also be called as GD_MADD_CPOLYNOM, GD_MADD_POLYNOM, or GD_MADD_CPOLYNOM
-  without change in functionality.  See gd_add_polynom(3) and
-  gd_madd_polynom(3).
+  the primary format file if FRAGMENT is not given either.  See
+  gd_add_polynom(3) and gd_madd_polynom(3).
 
 PROCEDURE GD_ADD_RAW, dirfile_unit, field_name data_type, FRAGMENT=fragment,
   SPF=spf
@@ -287,9 +298,8 @@ PROCEDURE GD_ADD_RECIP, dirfile_unit, field_name, in_field, DIVIDEND=dividend,
   defaults to one.  If PARENT is given, this field is added as a metafield under
   the given parent field.  Otherwise, the field is added to the fragment
   indexed by FRAGMENT, or the primary format file if FRAGMENT is not given
-  either.  This procedure may also be called as GD_ADD_CRECIP, GD_MADD_RECIP, or
-  GD_MADD_CRECIP with no change in functionality.  See gd_add_recip(3),
-  gd_add_crecip(3), gd_madd_recip(3), gd_madd_crecip(3).
+  either.  See gd_add_recip(3), gd_add_crecip(3), gd_madd_recip(3),
+  gd_madd_crecip(3).
 
 PROCEDURE GD_ADD_SBIT, dirfile_unit, field_name, in_field, BITNUM=bitnum,
   FRAGMENT=fragment, NUMBITS=numbits, PARENT=parent
@@ -299,18 +309,15 @@ PROCEDURE GD_ADD_SBIT, dirfile_unit, field_name, in_field, BITNUM=bitnum,
   defaults to zero and numbits to one.  If PARENT is given, this field is
   added as a metafield under the given parent field.  Otherwise, the field is
   added to the fragment indexed by FRAGMENT, or the primary format file if
-  FRAGMENT is not given either.  This procedure may also be called as
-  GD_MADD_SBIT with no change in functionality.  See gd_add_sbit(3)
-  and gd_madd_sbit(3).
+  FRAGMENT is not given either.  See gd_add_sbit(3) and gd_madd_sbit(3).
 
 PROCEDURE GD_ADD_SPEC, dirfile_unit, line, FRAGMENT=fragment, PARENT=parent
 
   This procedure adds a field described by the field specification line 'line'
   to the dirfile.  If PARENT is given, this field is added as a metafield under
   the given parent field.  Otherwise, the field is added to the fragment indexed
-  by FRAGMENT, or the primary format file if FRAGMENT is not given either.  This
-  procedure may also be called as GD_MADD_SPEC with no change in
-  functionality.  See gd_add_spec(3) and gd_madd_spec(3).
+  by FRAGMENT, or the primary format file if FRAGMENT is not given either.  See
+  gd_add_spec(3) and gd_madd_spec(3).
 
 PROCEDURE GD_ADD_STRING, dirfile_unit, field_name, FRAGMENT=fragment,
   PARENT=parent, VALUE=value
@@ -320,9 +327,36 @@ PROCEDURE GD_ADD_STRING, dirfile_unit, field_name, FRAGMENT=fragment,
   to the empty string.  If PARENT is given, this field is added as a metafield
   under the given parent field.  Otherwise, the field is added to the fragment
   indexed by FRAGMENT, or the primary format file if FRAGMENT is not given
-  either.  This procedure may also be called as GD_MADD_STRING with no
-  change in functionality.  See gd_add_string(3) and
-  gd_madd_string(3).
+  either.  See gd_add_string(3) and gd_madd_string(3).
+
+PROCEDURE GD_ADD_WINDOW, dirfile_unit, field_name, in_field, check_field,
+  threshold, /CLR, /EQ, /GE, /GT, /LE, /LT, /NE, /SET, FRAGMENT=fragment,
+  PARENT=parent
+
+  This procedure adds a WINDOW field with the name 'field_name' to the dirfile.
+  The input vector field is given by 'in_field' and the check field is given by
+  'check_field.  The window operation is specified by one of the optional
+  parameters, CLR, EQ, GE, &c.  If PARENT is given, this field is added as a
+  metafield under the given parent field.  Otherwise, the field is added to the
+  fragment indexed by FRAGMENT, or the primary format file if FRAGMENT is not
+  given either.  See gd_add_window(3), and gd_madd_window(3).
+
+FUNCTION GD_ALIASES(dirfile_unit, field_code)
+
+  This function returns a list of aliases of 'field_code' (including field_code)
+  itself.  See gd_aliases(3).
+
+FUNCTION GD_ALIAS_TARGET(dirfile_unit, field_code)
+
+  This procedure returns the target pointed to by the alias 'field_code'.  See
+  gd_alias_target(3).
+
+PROCEDURE GD_ALTER_AFFIXES(dirfile_unit, FRAGMENT=fragment, PREFIX=prefix,
+  SUFFIX=suffix)
+
+  This procedure modifies the prefix and/or suffix of the fragment index
+  specified by FRAGMENT.  Zero is assumed if FRAGMENT is not specified.  See
+  gd_alter_affixes(3).
 
 PROCEDURE GD_ALTER_BIT, dirfile_unit, field_code, BITNUM=bitnum,
   IN_FIELD=in_field, NUMBITS=numbits
@@ -399,9 +433,7 @@ PROCEDURE GD_ALTER_LINCOM, dirfile_unit, field_code, B=b,
   (which may be simultaneously updated).  The numeric parameters may be either
   real or complex valued.  If N_FIELDS specifies more fields than the field
   currently has, but B, IN_FIELDS, or M are not specified, the new values will
-  contain uninitialised data.  This procedure may also be called
-  GD_ALTER_CLINCOM without change of functionality.  See
-  gd_alter_lincom(3) and gd_alter_clincom(3).
+  contain uninitialised data.  See gd_alter_lincom(3) and gd_alter_clincom(3).
 
 PROCEDURE GD_ALTER_LINTERP, dirfile_unit, field_code, IN_FIELD=in_field,
   /RENAME_TABLE, TABLE=table
@@ -412,6 +444,13 @@ PROCEDURE GD_ALTER_LINTERP, dirfile_unit, field_code, IN_FIELD=in_field,
   file containing the look up table will be renamed to reflect changes to the
   field metadata.  See gd_alter_linterp(3).
 
+PROCEDURE GD_ALTER_MPLEX, dirfile_unit, field_code, COUNT_FIELD=count_field,
+  PERIOD=period, COUNT_VAL=count_val, IN_FIELD=in_field
+
+  This procedure modifies the metadata of the MPLEX field specified by
+  'field_code', updating only those field parameters specified as keyword
+  parameters.  See gd_alter_mplex(3).
+
 PROCEDURE GD_ALTER_MULTIPLY, dirfile_unit, field_code, IN_FIELD1=in_field1,
   IN_FIELD2=in_field2
 
@@ -454,8 +493,7 @@ PROCEDURE GD_ALTER_RECIP, dirfile_unit, field_code, DIVIDEND=dividend,
 
   This procedure modifies the metadata of the RECIP field specified by
   'field_code', updating only those field parameters specified as keyword
-  parameters.  This procedure may also be called GD_ALTER_CRECIP without change
-  in functionality.  See gd_alter_recip(3) and gd_alter_crecip(3).
+  parameters.  See gd_alter_recip(3) and gd_alter_crecip(3).
 
 PROCEDURE GD_ALTER_SBIT, dirfile_unit, field_code, BITNUM=bitnum,
   IN_FIELD=in_field, NUMBITS=numbits
@@ -470,9 +508,15 @@ PROCEDURE GD_ALTER_SPEC, dirfile_unit, line, PARENT=parent, /RECODE
   specification line 'line' to conform to the specification.  If /RECODE is
   given, data on disk is update, if applicable, to correspond with changes made
   to the field metadata.  If PARENT is given, the field is assumed to be a
-  metafield under the given parent.  This procedure may also be called as
-  GD_MALTER_SPEC without change in functionality.  See
-  gd_alter_spec(3) and gd_malter_spec(3).
+  metafield under the given parent.  See gd_alter_spec(3) and gd_malter_spec(3).
+
+PROCEDURE GD_ALTER_WINDOW, dirfile_unit, field_code, CHECK_FIELD=check_field,
+  /CLR, /EQ, /GE, /GT, IN_FIELD=in_field, /LE, /LT, /NE, /SET,
+  THRESHOLD=threshold
+
+  This procedure modifies the metadata of the WINDOW field specified by
+  'field_code', updating only those field parameters specified as keyword
+  parameters.  See gd_alter_window(3).
 
 FUNCTION GD_BOF(dirfile_unit, field_code)
 
@@ -499,21 +543,31 @@ FUNCTION GD_CONSTANTS(dirfile_unit, PARENT=parent, TYPE=type)
   values are returned as double precision data, even if they are stored as
   complex values.  If PARENT is given, the value of CONST metafields defined
   for the given parent field will be returned, otherwise all non-meta CONST
-  fields will be returned.  This function may be called as GD_MCONSTANTS
-  without change in functionality.  See gd_constants(3) and gd_mconstants(3).
+  fields will be returned.  See gd_constants(3) and gd_mconstants(3).
 
-PROCEDURE GD_DELETE, dirfile_unit, field_code, /DEL_DATA, /DEREF, /FORCE
+PROCEDURE GD_DELETE, dirfile_unit, field_code, /DEL_DATA, /DEREF, /FORCE, /ALIAS
 
   This procedure delete the field specified by 'field_code' from the database.
-  The meanings of the three keyword flags are discussed in the gd_delete
-  manual page.  See gd_delete(3).
+  If /ALIAS is specified, the alias 'field_code' is deleted instead.  The
+  meanings of the three other keyword flags are discussed in the gd_delete(3)
+  manual page.  See gd_delete(3) and gd_delete_alias(3).
+
+FUNCTION GD_DESYNC(dirfile_unit, /PATHCHECK, /REOPEN)
+
+  This function returns non-zero if the loaded dirfile has become desynchronised
+  from the metadata on disk (due to a third party modifying the dirfile on
+  disk).  If /PATHCHECK is specified, the metadata on disk will be probed via
+  the full canonicalised pathnames to the fragment files, otherwise the
+  dirfile's cached directory descriptors will be used.  If /REOPEN is given,
+  the dirfile will be rescanned and updated if a change is discovered.  See
+  gd_desync(3).
 
 FUNCTION GD_DIRFILENAME(dirfile_unit)
 
   This function returns the name of the dirfile specified by 'dirfile_unit'.
   See dirfilename(3).
 
-FUNCTION GD_DIRFILE_STANDARDS(dirfile_unit, [version], /LATEST, /EARLIEST)
+FUNCTION GD_DIRFILE_STANDARDS(dirfile_unit, [version,] /LATEST, /EARLIEST)
 
   This function returns the current Standards Version of the loaded dirfile,
   optionally setting it first.  If more than one of version, LATEST or
@@ -537,6 +591,18 @@ FUNCTION GD_ENTRY(dirfile_unit, field_code)
   This function returns a GD_ENTRY structure containing the field metadata for
   the field specified by 'field_code'.  See gd_entry(3).
 
+FUNCTION GD_ENTRY_LIST(dirfile_unit, /ALIASES, /HIDDEN, /NOALIAS, PARENT=parent,
+    /SCALARS, TYPE=type, /VECTORS)
+
+  This function returns a list of entry names defined by the dirfile.  If PARENT
+  is given, a list of metafields for the given parent will be returned otherwise
+  top-level fields are considered.  If TYPE is given, which should be one of the
+  !GD.*_ENTRY constants, only fields of the given type will be returned.  If
+  /ALIASES, /SCALARS or /VECTORS is specified, the TYPE parameter is ignored if
+  it is also given.  The list returned includes aliases, unless /NOALIAS is
+  specified, but not hidden fields, unless /HIDDEN is specified.  See
+  gd_entry_list(3).
+
 FUNCTION GD_ENTRY_TYPE(dirfile_unit, field_code)
 
   This function returns the field type of the field specified by 'field_code'.
@@ -555,6 +621,13 @@ FUNCTION GD_ERROR(dirfile_unit)
   This function does not take the normal ERROR and ESTRING keyword parameters.
   See gd_error(3).
 
+FUNCTION GD_ERROR_COUNT(dirfile_unit)
+
+  This function returns the number of errors encountered by the GetData library
+  on the specified dirfile since this function was last called (or since the
+  dirfile was opened, if this is the first call to this function).  See
+  gd_error_count(3).
+
 FUNCTION GD_ERROR_STRING(dirfile_unit)
 
   This function returns a human readable string describing the error status of
@@ -562,22 +635,34 @@ FUNCTION GD_ERROR_STRING(dirfile_unit)
   does not take the normal ERROR and ESTRING keyword parameters.  See
   gd_error_string(3).
 
-FUNCTION GD_FIELD_LIST(dirfile_unit, PARENT=parent, TYPE=type)
+FUNCTION GD_FIELD_LIST(dirfile_unit, /HIDDEN, /NOALIAS, PARENT=parent, /SCALARS,
+    TYPE=type, /VECTORS)
+
+  An alias for GD_ENTRY_LIST (q.v.) kept for backwards compatibility.
 
-  This function returns a list of field names defined by the dirfile.  If PARENT
-  is given, a list of metafields for the given parent will be returned.  If TYPE
-  is given, which should be one of the !GD.*_ENTRY constants, only fields of the
-  given type will be returned.  If neither PARENT, nor TYPE, are given, all
-  fields are returned.  This function may also be called as
-  GD_FIELD_LIST_BY_TYPE, GD_MFIELD_LIST, or GD_MFIELD_LIST_BY_TYPE, without
-  change in functionality.  See gd_field_list(3), gd_field_list_by_type(3),
-  gd_mfield_list(3), and gd_mfield_list_by_type(3).
+FUNCTION GD_FLAGS(dirfile_unit, PRETTY_PRINT=pretty_print, VERBOSE=verbose)
 
-PROCEDURE GD_FLUSH, dirfile_unit, FIELD_CODE=field_code
+  This function modifies the operational flags of the dirfile.  If a keyword
+  parameter is zero, the corresponding flag will be cleared; if a keyword
+  parameter is one, the corresponding flag will be set; otherwise, the flag is
+  unchanged.  The function returns the value of the flags register after
+  modification.  See gd_flags(3).
+
+PROCEDURE GD_FLUSH, dirfile_unit, FIELD_CODE=field_code, /NOCLOSE, /NOSYNC
 
   This procedure flushes pending data writes to disk.  If FIELD_CODE is given,
   only writes for the given field are flushed to disk.  Otherwise, all fields
-  and metadata changes are flushed to disk.  see gd_flush(3).
+  and metadata changes are flushed to disk.  In normal operation, first the
+  raw data is flushed (synced) and then the raw data files are closed.
+  Specifying /NOSYNC will skip the flushing; specifying /NOCLOSE will skip the
+  closing.  Specifying both will result in an error (since the function is left
+  with nothing to do.)  See gd_flush(3), gd_sync(3) and gd_raw_close(3).
+
+FUNCTION GD_FRAGMENT_AFFIXES(dirfile_unit, FRAGMENT=fragment)
+
+  This function returns a two element array of the field code prefix and suffix
+  of the fragment specified by FRAGMENT.  Zero is assumed if FRAGMENT is not
+  specified.  See gd_fragment_affixes(3).
 
 FUNCTION GD_FRAGMENT_INDEX(dirfile_unit, field_code)
 
@@ -596,9 +681,8 @@ FUNCTION GD_FRAMENUM(dirfile_unit, field_code, value, FIELD_START=field_start,
   'field_code'.  It returns the fractional frame number where the field has the
   value given by 'value'.  The search is performed between the frame limits
   FRAME_START and FRAME_END.  If FRAME_START is omitted, the beginning of the
-  frame is used; if FRAME_END is omitted, the end of frame is used.  This
-  function may also be called as GD_FRAMENUM_SUBSET without change in
-  functionality.  See gd_framenum(3) and gd_framenum_subset(3).
+  frame is used; if FRAME_END is omitted, the end of frame is used.  See
+  gd_framenum(3) and gd_framenum_subset(3).
 
 FUNCTION GD_FRAMEOFFSET(dirfile_unit, FRAGMENT=fragment_index)
 
@@ -613,10 +697,11 @@ FUNCTION GD_GETDATA(dirfile_unit, field_code, FIRST_FRAME=first_frame,
   returns a list of data, of the type given by TYPE, which should be one of the
   data type constants: !GD.UINT8, !GD.UINT16, &c.  If TYPE is omitted, this
   function returns double precision data, even if originally complex valued.
-  The first sample read is given by FIRST_FRAME and/or FIRST_SAMPLE.  The
-  number of samples requested is given by NUM_FRAMES and/or NUM_SAMPLES.  Fewer
-  samples than requested may be returned, without causing an error, if the end
-  of the field is encountered.  See getdata(3).
+  The first sample read is given by FIRST_FRAME and/or FIRST_SAMPLE.  If neither
+  of these are given, reading occurs at the current position.  The number of
+  samples requested is given by NUM_FRAMES and/or NUM_SAMPLES.  Fewer samples
+  than requested may be returned, without causing an error, if the end of the
+  field is encountered.  See getdata(3).
 
 FUNCTION GD_GET_CARRAY(dirfile_unit, field_code, TYPE=type)
 
@@ -640,10 +725,20 @@ FUNCTION GD_GET_STRING(dirfile_unit, field_code)
   This function returns the value of a STRING field specified by 'field_code'.
   See gd_get_string(3).
 
+FUNCTION GD_HIDDEN(dirfile_unit, field_code)
+
+  This function returns one if the field or alias specified by 'field_code' is
+  hidden, or zero if it is not.  On error it returns -1.  See gd_hidden(3).
+
+PROCEDURE GD_HIDE, dirfile_unit, field_code
+
+  This procedure hides the field or alias specified by 'field_code'.  See
+  gd_hide(3).
+
 PROCEDURE GD_INCLUDE, dirfile_unit, fragment_name, /ARM_ENDIAN, /BIG_ENDIAN,
   /CREAT, ENCODING=encoding, /EXCL, /FORCE_ENCODING, /FORCE_ENDIANNESS,
   FRAGMENT=fragment, INDEX=index, /IGNORE_DUPS, /IGNORE_REFS, /LITTLE_ENDIAN,
-  /NOT_ARM_ENDIAN, /PEDANTIC, /PERMISSIVE, /TRUNC
+  /NOT_ARM_ENDIAN, /PEDANTIC, /PERMISSIVE, PREFIX=prefix, SUFFIX=suffix, /TRUNC
 
   This procedure adds the format file fragment specified by 'fragment_name' to
   the format file indexed by FRAGMENT, or else the primary format file, if
@@ -652,7 +747,7 @@ PROCEDURE GD_INCLUDE, dirfile_unit, fragment_name, /ARM_ENDIAN, /BIG_ENDIAN,
   string indicating the encoding type: 'BZIP2', 'GZIP', 'LZMA', 'SLIM', 'TEXT',
   'NONE', or else a numeric encoding type: !GD.BZIP2_ENCODED, &c.  The meaning
   of the remaining keyword flags is discussed in the gd_include manual page.
-  See gd_include(3).
+  See gd_include(3) and gd_include_affix(3).
  
 FUNCTION GD_INVALID_DIRFILE()
 
@@ -664,12 +759,24 @@ PROCEDURE GD_METAFLUSH, dirfile_unit
   This procedure flushes pending metadata changes to the dirfile to disk.  See
   gd_metaflush(3).
 
-PROCEDURE GD_MOVE, dirfile_unit, field_code, new_fragment, /MOVE_DATA
+PROCEDURE GD_MOVE, dirfile_unit, field_code, new_fragment, /ALIAS, /MOVE_DATA
 
   This procedure moves the field specified by 'field_code' to the new format
-  file fragment indexed by 'new_fragment'.  If MOVE_DATA is specified, and
+  file fragment indexed by 'new_fragment'.  If ALIAS is specified, the alias
+  'field_code' is moved instead.  Otherwise, if MOVE_DATA is specified, and
   'field_code' specifies a RAW file, the data file on disk will also be moved,
-  if necessary.  See gd_move(3).
+  if necessary.  See gd_move(3) and gd_move_alias(3).
+
+PROCEDURE GD_MPLEX_LOOKBACK dirfile_unit, [lookback,] /ALL
+
+  This procedure sets the MPLEX lookback length to the value given, if supplied,
+  or to the maximum value, if /ALL is given, or else to the default value if
+  neither is provided.  See gd_mplex_lookback(3).
+
+FUNCTION GD_NALIASES(dirfile_unit, field_code)
+
+  This function returns the number of aliases of 'field_code' (including
+  field_code itself).  See gd_naliases(3).
 
 FUNCTION GD_NATIVE_TYPE(dirfile_unit, field_code)
 
@@ -677,16 +784,22 @@ FUNCTION GD_NATIVE_TYPE(dirfile_unit, field_code)
   The return value will be one of the data type constants: !GD.UINT8, !GD.INT8,
   &c.  See gd_native_type(3).
 
-FUNCTION GD_NFIELDS(dirfile_unit, PARENT=parent, TYPE=type)
+FUNCTION GD_NENTRIES(dirfile_unit, /ALIAS, /HIDDEN, /NOALIAS, PARENT=parent,
+    /SCALARS, TYPE=type, /VECTORS)
 
-  This function returns the number of fields defined by the dirfile.  If PARENT
-  is given, the number metafields for the given parent will be returned.  If
-  TYPE is given, which should be one of the !GD.*_ENTRY constants, only fields
-  of the given type will be counted.  If neither PARENT, nor TYPE, are given,
-  the total number of fields in the database will be returned.  This function
-  may also be called as GD_NFIELDS_BY_TYPE, GD_NMFIELDS, or
-  GD_NMFIELDS_BY_TYPE, without change in functionality.  See gd_nfields(3),
-  gd_nfields_by_type(3), gd_nmfields(3), and gd_nmfields_by_type(3).
+  This function returns the number of entries in the dirfile satisfying the
+  given criteria.  If PARENT is given, the number of metafields for the given
+  parent will be returned otherwise top-level fields are considered.  If TYPE is
+  given, which should be one of the !GD.*_ENTRY constants, only fields of the
+  given type will be counted.  If /ALIASES, /SCALARS or /VECTORS is specified,
+  the TYPE parameter is ignored if it is also given.  The number returned
+  includes aliases, unless /NOALIAS is specified, but not hidden fields, unless
+  /HIDDEN is specified.  See gd_nentries(3).
+
+FUNCTION GD_NFIELDS(dirfile_unit, /HIDDEN, /NOALIAS, PARENT=parent, /SCALARS,
+    TYPE=type, /VECTORS)
+
+  An alias for GD_NENTRIES (q.v.) kept for backwards compatibility.
 
 FUNCTION GD_NFRAGMENTS(dirfile_unit)
 
@@ -703,21 +816,20 @@ FUNCTION GD_NVECTORS(dirfile_unit, PARENT=parent)
   This function returns the number of vector type fields defined by the dirfile.
   If PARENT is given, the number vector type metafields for the given parent
   will be returned.  Otherwise, the total number of vector fields in the
-  database will be returned.  This function may also be called as GD_NMVECTORS,
-  without change in functionality.  See gd_nvectors(3) and gd_nmvectors(3).
+  database will be returned.  See gd_nvectors(3) and gd_nmvectors(3).
 
 FUNCTION GD_OPEN(dirfilename, /ARM_ENDIAN, /BIG_ENDIAN, /CREAT,
   ENCODING=encoding, /EXCL, /FORCE_ENCODING, /FORCE_ENDIANNESS, /IGNORE_DUPS,
-  /LITTLE_ENDIAN, /NOT_ARM_ENDIAN, /PEDANTIC, /PERMISSIVE, /RDWR, /TRUNC,
-  /VERBOSE)
+  /IGNORE_REFS, /LITTLE_ENDIAN, /NOT_ARM_ENDIAN, /PEDANTIC, /PERMISSIVE,
+  /PRETTY_PRINT, /RDWR, /TRUNC, /TRUNCSUB, /VERBOSE)
 
   This function opens the dirfile specified by 'dirfilename', returning the
   dirfile unit number which can be subsequently used to refer to it.  If
   specified, ENCODING should either be a string indicating the encoding type:
-  'BZIP2', 'GZIP', 'LZMA', 'SLIM', 'TEXT',   'NONE', or else a numeric
-  encoding type: !GD.BZIP2_ENCODED, &c.  The meaning of the other keyword flags
-  is explained in the gd_open manual page.  A parser callback function
-  cannot be used by the IDL GetData bindings.  See gd_open(3).
+  'BZIP2', 'GZIP', 'LZMA', 'SIE', 'SLIM', 'TEXT', 'ZZIP', 'ZZSLIM', 'NONE', or
+  else a numeric encoding type: !GD.BZIP2_ENCODED, &c.  The meaning of the other
+  keyword flags is explained in the gd_open(3) manual page.  A parser callback
+  function cannot be used by the IDL GetData bindings.  See gd_open(3).
 
 FUNCTION GD_PARENT_FRAGMENT(dirfile_unit, fragment_index)
 
@@ -744,7 +856,7 @@ PROCEDURE GD_PUTDATA, dirfile_unit, field_code, data, FIRST_FRAME=first_frame,
   This procedure writes data in the numerical vector 'data' to the field
   specified by 'field_code'.  The keywords FIRST_FRAME and/or FIRST_SAMPLE
   indicate the first sample written.  If neither of these are specified, the
-  data is written from the beginning of the frame.  See putdata(3).
+  data is written at the current position.  See putdata(3).
 
 PROCEDURE GD_PUT_CARRAY, dirfile_unit, field_code, value, START=start
 
@@ -772,11 +884,22 @@ FUNCTION GD_REFERENCE(dirfile_unit)
   This function returns the name of the RAW field used as the reference field
   for the dirfile.  See gd_reference(3).
 
-PROCEDURE GD_RENAME, dirfile_unit, field_code, new_name, /MOVE_DATA
+PROCEDURE GD_RENAME, dirfile_unit, field_code, new_name, /MOVE_DATA, /UPDATEDB
 
   This function renames the field specified by 'field_code' to 'new_name'.  If
   MOVE_DATA is specified, and the field is a RAW field, the data file on disk
-  is renamed as well.  See gd_rename(3).
+  is renamed as well.  If UPDATEDB is specified, fields whose definition depends
+  on this field are also updated to reflect the change in name.  See
+  gd_rename(3).
+
+FUNCTION GD_SEEK(dirfile_unit, field_code, FRAME_NUM=frame_num,
+  SAMPLE_NUM=sample_num, WHENCE=whence, /WRITE)
+
+  This function sets the current I/O position of the field specified by
+  'field_code' to the position given by FRAME_NUM and SAMPLE_NUM (which both
+  default to zero).  WHENCE should be one of the !GD.SEEK_* symbols.  If the
+  next operation on the field is a write (via GD_PUTDATA), the /WRITE flag
+  should also be specified.  See gd_seek(3).
 
 FUNCTION GD_SPF(dirfile_unit, field_code)
 
@@ -788,9 +911,24 @@ FUNCTION GD_STRINGS(dirfile_unit, PARENT=parent, TYPE=type)
   This function returns the value of all STRING fields in the dirfile.  If
   PARENT is given, the value of STRING metafields defined for the given parent
   field will be returned, otherwise all non-meta STRING fields will be returned.
-  This function may be called as GD_MSTRINGS without change in functionality.
   See gd_strings(3) and gd_mstrings(3).
 
+FUNCTION GD_STRTOK(dirfile_unit, STRING=string)
+
+  If STRING is given, this function returns the first token of the string.
+  Otherwise, it returns the next token of a string provided to a previous call.
+  See gd_strtok(3).
+
+FUNCTION GD_TELL(dirfile_unit, field_code)
+  
+  This function returns the current I/O position of the specified field.  See
+  gd_tell(3).
+
+PROCEDURE GD_UNHIDE, dirfile_unit, field_code
+
+  This procedure unhides the field or alias specified by 'field_code'.  See
+  gd_unhide(3).
+
 PROCEDURE GD_UNINCLUDE, dirfile_unit, fragment_index, /DELETE
 
   This function removes the format file fragment indexed by 'fragment_index'.
@@ -803,11 +941,14 @@ FUNCTION GD_VALIDATE(dirfile_unit, field_code)
   If it is this function returns zero.  Otherwise it returns non-zero.  See
   gd_validate(3).
 
+PROCEDURE GD_VERBOSE_PREFIX, dirfile_unit, PREFIX=prefix)
+
+  This procedure sets the dirfile verbose prefix to PREFIX, if given, or else
+  removes it.  See gd_verbose_prefix(3).
+
 FUNCTION GD_VECTOR_LIST(dirfile_unit, PARENT=parent)
 
   This function returns a list of vector type fields defined by the dirfile.  If
   PARENT is given, a list of vector metafields for the given parent will be
-  returned.  Otherwise all non-meta vector fields will be returned.  This
-  function may also be called as GD_MVECTOR_LIST, without change in
-  functionality.  See gd_vector_list(3) and gd_mvector_list(3).
-
+  returned.  Otherwise all non-meta vector fields will be returned.  See
+  gd_vector_list(3) and gd_mvector_list(3).
diff --git a/doc/README.matlab b/doc/README.matlab
new file mode 100644
index 0000000..687cb52
--- /dev/null
+++ b/doc/README.matlab
@@ -0,0 +1,19 @@
+MATLAB BINDINGS FOR GETDATA
+===========================
+
+The MATLAB bindings consist of a compatibility library, libgetdata-matlab, a
+collection of MEX functions, and a few pure MATLAB functions implementing the
+bindings.
+
+The compatibility library is installed in ${libdir}.  By default, the MATLAB
+files are installed in ${libdir}/getdata/matlab/getdata, although this path
+can be changed with the --with-matlab-dir option to ./configure.  To use the
+bindings, the installation directory must be added to the MATLAB path.
+
+Full documentation of the bindings are provided from within the MATLAB help
+system.  After installing the bindings, running
+
+  >> help getdata
+
+will provide an overview of the bindings and provide a list of the functions
+availabe.
diff --git a/doc/README.perl b/doc/README.perl
new file mode 100644
index 0000000..46be671
--- /dev/null
+++ b/doc/README.perl
@@ -0,0 +1,16 @@
+PERL BINDINGS FOR GETDATA
+=========================
+
+The Perl bindings consist of a perl module, `GetData.pm'.  They should work with
+Perl 5.6 or newer.  Complex data are represented within the module as
+Math::Complex objects.
+
+The GetData Perl bindings are documented in POD markup within GetData.pm.
+After installation, this documentation should be available in section 3 of
+the UNIX manual:
+
+  $ man 3 GetData
+
+Before installation, the manual can be read using a command along the lines of
+
+ $ pod2man bindings/perl/GetData.pm.in | nroff -mandoc | less
diff --git a/doc/README.python b/doc/README.python
index 027592c..bdb332f 100644
--- a/doc/README.python
+++ b/doc/README.python
@@ -20,4 +20,4 @@ from the system shell, or
 >>> import pygetdata
 >>> help(pygetdata)
 
-from within the Python interpereter after the bindings have been installed.
+from within the Python interpreter, after the bindings have been installed.
diff --git a/install-sh b/install-sh
index 6781b98..a9244eb 100755
--- a/install-sh
+++ b/install-sh
@@ -1,7 +1,7 @@
 #!/bin/sh
 # install - install a program, script, or datafile
 
-scriptversion=2009-04-28.21; # UTC
+scriptversion=2011-01-19.21; # UTC
 
 # This originates from X11R5 (mit/util/scripts/install.sh), which was
 # later released in X11R6 (xc/config/util/install.sh) with the
@@ -156,6 +156,10 @@ while test $# -ne 0; do
     -s) stripcmd=$stripprog;;
 
     -t) dst_arg=$2
+	# Protect names problematic for `test' and other utilities.
+	case $dst_arg in
+	  -* | [=\(\)!]) dst_arg=./$dst_arg;;
+	esac
 	shift;;
 
     -T) no_target_directory=true;;
@@ -186,6 +190,10 @@ if test $# -ne 0 && test -z "$dir_arg$dst_arg"; then
     fi
     shift # arg
     dst_arg=$arg
+    # Protect names problematic for `test' and other utilities.
+    case $dst_arg in
+      -* | [=\(\)!]) dst_arg=./$dst_arg;;
+    esac
   done
 fi
 
@@ -200,7 +208,11 @@ if test $# -eq 0; then
 fi
 
 if test -z "$dir_arg"; then
-  trap '(exit $?); exit' 1 2 13 15
+  do_exit='(exit $ret); exit $ret'
+  trap "ret=129; $do_exit" 1
+  trap "ret=130; $do_exit" 2
+  trap "ret=141; $do_exit" 13
+  trap "ret=143; $do_exit" 15
 
   # Set umask so as not to create temps with too-generous modes.
   # However, 'strip' requires both read and write access to temps.
@@ -228,9 +240,9 @@ fi
 
 for src
 do
-  # Protect names starting with `-'.
+  # Protect names problematic for `test' and other utilities.
   case $src in
-    -*) src=./$src;;
+    -* | [=\(\)!]) src=./$src;;
   esac
 
   if test -n "$dir_arg"; then
@@ -252,12 +264,7 @@ do
       echo "$0: no destination specified." >&2
       exit 1
     fi
-
     dst=$dst_arg
-    # Protect names starting with `-'.
-    case $dst in
-      -*) dst=./$dst;;
-    esac
 
     # If destination is a directory, append the input filename; won't work
     # if double slashes aren't ignored.
@@ -385,7 +392,7 @@ do
 
       case $dstdir in
 	/*) prefix='/';;
-	-*) prefix='./';;
+	[-=\(\)!]*) prefix='./';;
 	*)  prefix='';;
       esac
 
@@ -403,7 +410,7 @@ do
 
       for d
       do
-	test -z "$d" && continue
+	test X"$d" = X && continue
 
 	prefix=$prefix$d
 	if test -d "$prefix"; then
diff --git a/ltmain.sh b/ltmain.sh
old mode 100755
new mode 100644
index db863e6..6a2f116
--- a/ltmain.sh
+++ b/ltmain.sh
@@ -1,9 +1,9 @@
 
-# libtool (GNU libtool) 2.4
+# libtool (GNU libtool) 2.4.2
 # Written by Gordon Matzigkeit <gord at gnu.ai.mit.edu>, 1996
 
 # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, 2006,
-# 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
+# 2007, 2008, 2009, 2010, 2011 Free Software Foundation, Inc.
 # This is free software; see the source for copying conditions.  There is NO
 # warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 
@@ -41,6 +41,7 @@
 #       --quiet, --silent    don't print informational messages
 #       --no-quiet, --no-silent
 #                            print informational messages (default)
+#       --no-warn            don't display warning messages
 #       --tag=TAG            use configuration variables from tag TAG
 #   -v, --verbose            print more informational messages than default
 #       --no-verbose         don't print the extra informational messages
@@ -69,7 +70,7 @@
 #         compiler:		$LTCC
 #         compiler flags:		$LTCFLAGS
 #         linker:		$LD (gnu? $with_gnu_ld)
-#         $progname:	(GNU libtool) 2.4
+#         $progname:	(GNU libtool) 2.4.2
 #         automake:	$automake_version
 #         autoconf:	$autoconf_version
 #
@@ -79,9 +80,9 @@
 
 PROGRAM=libtool
 PACKAGE=libtool
-VERSION=2.4
+VERSION=2.4.2
 TIMESTAMP=""
-package_revision=1.3293
+package_revision=1.3337
 
 # Be Bourne compatible
 if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
@@ -136,15 +137,10 @@ progpath="$0"
 
 : ${CP="cp -f"}
 test "${ECHO+set}" = set || ECHO=${as_echo-'printf %s\n'}
-: ${EGREP="grep -E"}
-: ${FGREP="grep -F"}
-: ${GREP="grep"}
-: ${LN_S="ln -s"}
 : ${MAKE="make"}
 : ${MKDIR="mkdir"}
 : ${MV="mv -f"}
 : ${RM="rm -f"}
-: ${SED="sed"}
 : ${SHELL="${CONFIG_SHELL-/bin/sh}"}
 : ${Xsed="$SED -e 1s/^X//"}
 
@@ -387,7 +383,7 @@ case $progpath in
      ;;
   *)
      save_IFS="$IFS"
-     IFS=:
+     IFS=${PATH_SEPARATOR-:}
      for progdir in $PATH; do
        IFS="$save_IFS"
        test -x "$progdir/$progname" && break
@@ -771,8 +767,8 @@ func_help ()
 	s*\$LTCFLAGS*'"$LTCFLAGS"'*
 	s*\$LD*'"$LD"'*
 	s/\$with_gnu_ld/'"$with_gnu_ld"'/
-	s/\$automake_version/'"`(automake --version) 2>/dev/null |$SED 1q`"'/
-	s/\$autoconf_version/'"`(autoconf --version) 2>/dev/null |$SED 1q`"'/
+	s/\$automake_version/'"`(${AUTOMAKE-automake} --version) 2>/dev/null |$SED 1q`"'/
+	s/\$autoconf_version/'"`(${AUTOCONF-autoconf} --version) 2>/dev/null |$SED 1q`"'/
 	p
 	d
      }
@@ -1052,6 +1048,7 @@ opt_finish=false
 opt_help=false
 opt_help_all=false
 opt_silent=:
+opt_warning=:
 opt_verbose=:
 opt_silent=false
 opt_verbose=false
@@ -1120,6 +1117,10 @@ esac
 			opt_silent=false
 func_append preserve_args " $opt"
 			;;
+      --no-warning|--no-warn)
+			opt_warning=false
+func_append preserve_args " $opt"
+			;;
       --no-verbose)
 			opt_verbose=false
 func_append preserve_args " $opt"
@@ -2059,7 +2060,7 @@ func_mode_compile ()
     *.[cCFSifmso] | \
     *.ada | *.adb | *.ads | *.asm | \
     *.c++ | *.cc | *.ii | *.class | *.cpp | *.cxx | \
-    *.[fF][09]? | *.for | *.java | *.obj | *.sx | *.cu | *.cup)
+    *.[fF][09]? | *.for | *.java | *.go | *.obj | *.sx | *.cu | *.cup)
       func_xform "$libobj"
       libobj=$func_xform_result
       ;;
@@ -3201,11 +3202,13 @@ func_mode_install ()
 
       # Set up the ranlib parameters.
       oldlib="$destdir/$name"
+      func_to_tool_file "$oldlib" func_convert_file_msys_to_w32
+      tool_oldlib=$func_to_tool_file_result
 
       func_show_eval "$install_prog \$file \$oldlib" 'exit $?'
 
       if test -n "$stripme" && test -n "$old_striplib"; then
-	func_show_eval "$old_striplib $oldlib" 'exit $?'
+	func_show_eval "$old_striplib $tool_oldlib" 'exit $?'
       fi
 
       # Do each command in the postinstall commands.
@@ -3470,7 +3473,7 @@ static const void *lt_preloaded_setup() {
 	  # linked before any other PIC object.  But we must not use
 	  # pic_flag when linking with -static.  The problem exists in
 	  # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1.
-	  *-*-freebsd2*|*-*-freebsd3.0*|*-*-freebsdelf3.0*)
+	  *-*-freebsd2.*|*-*-freebsd3.0*|*-*-freebsdelf3.0*)
 	    pic_flag_for_symtable=" $pic_flag -DFREEBSD_WORKAROUND" ;;
 	  *-*-hpux*)
 	    pic_flag_for_symtable=" $pic_flag"  ;;
@@ -3982,14 +3985,17 @@ func_exec_program_core ()
 # launches target application with the remaining arguments.
 func_exec_program ()
 {
-  for lt_wr_arg
-  do
-    case \$lt_wr_arg in
-    --lt-*) ;;
-    *) set x \"\$@\" \"\$lt_wr_arg\"; shift;;
-    esac
-    shift
-  done
+  case \" \$* \" in
+  *\\ --lt-*)
+    for lt_wr_arg
+    do
+      case \$lt_wr_arg in
+      --lt-*) ;;
+      *) set x \"\$@\" \"\$lt_wr_arg\"; shift;;
+      esac
+      shift
+    done ;;
+  esac
   func_exec_program_core \${1+\"\$@\"}
 }
 
@@ -5057,9 +5063,15 @@ void lt_dump_script (FILE* f)
 {
 EOF
 	    func_emit_wrapper yes |
-              $SED -e 's/\([\\"]\)/\\\1/g' \
-	           -e 's/^/  fputs ("/' -e 's/$/\\n", f);/'
-
+	      $SED -n -e '
+s/^\(.\{79\}\)\(..*\)/\1\
+\2/
+h
+s/\([\\"]\)/\\\1/g
+s/$/\\n/
+s/\([^\n]*\).*/  fputs ("\1", f);/p
+g
+D'
             cat <<"EOF"
 }
 EOF
@@ -5643,7 +5655,8 @@ func_mode_link ()
 	continue
 	;;
 
-      -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe|-threads)
+      -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe \
+      |-threads|-fopenmp|-openmp|-mp|-xopenmp|-omp|-qsmp=*)
 	func_append compiler_flags " $arg"
 	func_append compile_command " $arg"
 	func_append finalize_command " $arg"
@@ -6147,7 +6160,8 @@ func_mode_link ()
 	lib=
 	found=no
 	case $deplib in
-	-mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe|-threads)
+	-mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe \
+        |-threads|-fopenmp|-openmp|-mp|-xopenmp|-omp|-qsmp=*)
 	  if test "$linkmode,$pass" = "prog,link"; then
 	    compile_deplibs="$deplib $compile_deplibs"
 	    finalize_deplibs="$deplib $finalize_deplibs"
@@ -6831,7 +6845,7 @@ func_mode_link ()
 	         test "$hardcode_direct_absolute" = no; then
 		add="$dir/$linklib"
 	      elif test "$hardcode_minus_L" = yes; then
-		add_dir="-L$dir"
+		add_dir="-L$absdir"
 		# Try looking first in the location we're being installed to.
 		if test -n "$inst_prefix_dir"; then
 		  case $libdir in
@@ -7316,6 +7330,7 @@ func_mode_link ()
 	  # which has an extra 1 added just for fun
 	  #
 	  case $version_type in
+	  # correct linux to gnu/linux during the next big refactor
 	  darwin|linux|osf|windows|none)
 	    func_arith $number_major + $number_minor
 	    current=$func_arith_result
@@ -7432,7 +7447,7 @@ func_mode_link ()
 	  versuffix="$major.$revision"
 	  ;;
 
-	linux)
+	linux) # correct to gnu/linux during the next big refactor
 	  func_arith $current - $age
 	  major=.$func_arith_result
 	  versuffix="$major.$age.$revision"
@@ -8020,6 +8035,11 @@ EOF
 
       # Test again, we may have decided not to build it any more
       if test "$build_libtool_libs" = yes; then
+	# Remove ${wl} instances when linking with ld.
+	# FIXME: should test the right _cmds variable.
+	case $archive_cmds in
+	  *\$LD\ *) wl= ;;
+        esac
 	if test "$hardcode_into_libs" = yes; then
 	  # Hardcode the library paths
 	  hardcode_libdirs=
@@ -8050,7 +8070,7 @@ EOF
 	    elif test -n "$runpath_var"; then
 	      case "$perm_rpath " in
 	      *" $libdir "*) ;;
-	      *) func_apped perm_rpath " $libdir" ;;
+	      *) func_append perm_rpath " $libdir" ;;
 	      esac
 	    fi
 	  done
@@ -8058,11 +8078,7 @@ EOF
 	  if test -n "$hardcode_libdir_separator" &&
 	     test -n "$hardcode_libdirs"; then
 	    libdir="$hardcode_libdirs"
-	    if test -n "$hardcode_libdir_flag_spec_ld"; then
-	      eval dep_rpath=\"$hardcode_libdir_flag_spec_ld\"
-	    else
-	      eval dep_rpath=\"$hardcode_libdir_flag_spec\"
-	    fi
+	    eval "dep_rpath=\"$hardcode_libdir_flag_spec\""
 	  fi
 	  if test -n "$runpath_var" && test -n "$perm_rpath"; then
 	    # We should set the runpath_var.
@@ -9152,6 +9168,8 @@ EOF
 	    esac
 	  done
 	fi
+	func_to_tool_file "$oldlib" func_convert_file_msys_to_w32
+	tool_oldlib=$func_to_tool_file_result
 	eval cmds=\"$old_archive_cmds\"
 
 	func_len " $cmds"
@@ -9261,7 +9279,8 @@ EOF
 	      *.la)
 		func_basename "$deplib"
 		name="$func_basename_result"
-		eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
+		func_resolve_sysroot "$deplib"
+		eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $func_resolve_sysroot_result`
 		test -z "$libdir" && \
 		  func_fatal_error "\`$deplib' is not a valid libtool archive"
 		func_append newdependency_libs " ${lt_sysroot:+=}$libdir/$name"
diff --git a/m4/compiler.m4 b/m4/compiler.m4
index 5f11869..7347cab 100644
--- a/m4/compiler.m4
+++ b/m4/compiler.m4
@@ -101,6 +101,20 @@ AC_LANG_POP([Fortran 77])])
 FFLAGS=$gd_saved_FFLAGS])
 
 
+dnl GD_PROG_F77_FNO_BACKSLASH
+dnl -------------------------------------------------------------
+dnl Check whether the Fotran-77 compiler accepts -fno-backslash
+AC_DEFUN([GD_PROG_F77_FNO_BACKSLASH],
+[gd_saved_FFLAGS=$FFLAGS
+AC_CACHE_CHECK([whether $F77 accepts -fno-backslash],
+gd_cv_prog_f77_fno_backslash, [FFLAGS="-fno-backslash"
+AC_LANG_PUSH([Fortran 77])
+AC_COMPILE_IFELSE([AC_LANG_PROGRAM()], [gd_cv_prog_f77_fno_backslash=yes],
+[gd_cv_prog_f77_fno_backslash=no])
+AC_LANG_POP([Fortran 77])])
+FFLAGS=$gd_saved_FFLAGS])
+
+
 dnl GD_PROG_FC_WEXTRA
 dnl -------------------------------------------------------------
 dnl Check whether the free-form Fotran compiler accepts -Wextra
@@ -167,56 +181,6 @@ AC_COMPILE_IFELSE([AC_LANG_PROGRAM()], [gd_cv_prog_fc_wall=yes],
 AC_LANG_POP([Fortran 77])])
 FCFLAGS=$gd_saved_FCFLAGS])
 
-dnl GD_C_FLOATORDERING
-dnl -----------------------------------------------------------
-dnl Attempt to determine the ordering of double precision floats
-AC_DEFUN([GD_C_FLOATORDERING],
-  [AC_CACHE_CHECK([floating point endianness], [gd_cv_c_floatordering],
-[gd_cv_c_floatordering=unknown
-# check for arm middle endianness
-AC_COMPILE_IFELSE([AC_LANG_SOURCE(
-[[#if ! (defined __arm__ && ! (defined __VFP_FP__ || defined __MAVERICK___))
-  not arm middle endian
-#endif
-]])],
-[gd_cv_c_floatordering=arm],
-[# not middle-endian arm, check for __FLOAT_WORD_ORDER
-AC_COMPILE_IFELSE(
-[AC_LANG_PROGRAM([[#include <endian.h>]],
-[[#ifndef __FLOAT_WORD_ORDER
-  no __FLOAT_WORD_ORDER defined
-#endif
-]])],
-[# __FLOAT_WORD_ORDER is defined; is it BIG_ENDIAN?
-AC_COMPILE_IFELSE(
-[AC_LANG_PROGRAM([[#include <endian.h>]],
-[[#if __FLOAT_WORD_ORDER != BIG_ENDIAN
-  not big endian
-#endif
-]])],
-[gd_cv_c_floatordering="big"],
-[gd_cv_c_floatordering="little"])],
-[# no __FLOAT_WORD_ORDER defined; so we just assume it's the same as the
- # integer ordering
-AC_COMPILE_IFELSE(
-[AC_LANG_SOURCE(
-[[#ifndef WORDS_BIGENDIAN
-  not big endian
-#endif
-]])],
-[gd_cv_c_floatordering="big"],
-[gd_cv_c_floatordering="little"])])])])
-
-if test $gd_cv_c_floatordering = "arm"; then
-AC_DEFINE([ARM_ENDIAN_DOUBLES], [1],
-  [ Define to 1 if your processor stores double-precision floats in the old
-    ARM middle-endian format ])
-elif test $gd_cv_c_floatordering = "big"; then
-AC_DEFINE([FLOATS_BIGENDIAN], [1],
-  [ Define to 1 if your processor stores double-precision floats in big-endian
-    order])
-fi])
-
 dnl GD_CHECK_LFS_TYPE
 dnl -----------------------------------------------------------
 dnl Check whether the specified type exists, and whether _LARGEFILE64_SOURCE
@@ -251,3 +215,24 @@ AC_DEFINE(AS_TR_CPP([HAVE_$1]), [1],
 [ Define to 1 if you have the type `$1' ])
 fi
 ])
+
+dnl GD_C_RESTRICT_ARRAY
+dnl -----------------------------------------------------------
+dnl Check whether "<type> *restrict foo[]" is allowed.
+AC_DEFUN([GD_C_RESTRICT_ARRAY],[
+dnl do nothing if restrict hasn't been found
+if ! test "x$ac_cv_c_restrict" = "xno"; then
+AC_CACHE_CHECK([whether restrict can be applied to pointer array arguments],
+[gd_cv_c_restrict_array],[
+AC_COMPILE_IFELSE([AC_LANG_PROGRAM([
+    int *foo (int *restrict bar@<:@3@:>@) { return bar@<:@2@:>@; }
+], [])],
+[gd_cv_c_restrict_array="yes"],[gd_cv_c_restrict_array="no"])
+])
+fi
+
+if test "x$gd_cv_c_restrict_array" = "xyes"; then
+AC_DEFINE([GD_RESTRICT_ARRAY_OK], [1],
+[Define to 1 if restrict can used on pointer arrays])
+fi
+])
diff --git a/m4/encoding.m4 b/m4/encoding.m4
index c1292c2..d93f919 100644
--- a/m4/encoding.m4
+++ b/m4/encoding.m4
@@ -28,7 +28,7 @@ have_this_header=
 have_this_lib=
 m4_define([gd_encoding], [$1])
 AC_ARG_WITH([lib$2], AS_HELP_STRING([--with-lib$2=PREFIX],
-            [use the lib$2 installed in PREFIX [autodetect]]),
+            [use the lib$2 installed in PREFIX [default: autodetect]]),
             [
              case "${withval}" in
                no) use_[]gd_encoding="no" ;;
@@ -54,9 +54,14 @@ if test "x$use_[]gd_encoding" = "xyes"; then
   if test "x$gd_encoding[]_prefix" != "x"; then
     LDFLAGS="$LDFLAGS -L$gd_encoding[]_prefix/lib"
   fi
-  AC_CHECK_LIB([$2],[$3],[have_this_lib=yes]
+  AC_CHECK_LIB([$2],[$3],[have_this_lib=yes
+  LIBS="$LIBS -l$2"]
   AC_DEFINE(AS_TR_CPP([HAVE_LIB$2]), 1,
     [Define to 1 if you have the `$2' library (-l$2).]))
+
+ifelse(`x$7', `x',,[
+  AC_CHECK_FUNCS([$7])
+])
   LDFLAGS=$saved_ldflags
   LIBS=$saved_libs
 
@@ -72,13 +77,15 @@ fi
 dnl cleanup
 AS_TR_CPP(gd_encoding[_CPPFLAGS])=
 AS_TR_CPP(gd_encoding[_LDFLAGS])=
+AS_TR_CPP(gd_encoding[_LIBS])=
 if test "x$have_this_header" = "xyes" -a "x$have_this_lib" = "xyes"; then
   if test "x$gd_encoding[]_prefix" = "x"; then
-    AS_TR_CPP(gd_encoding[_LDFLAGS])="-l$2"
+    AS_TR_CPP(gd_encoding[_LIBS])="-l$2"
     AS_TR_CPP(gd_encoding[_SEARCHPATH])="$PATH"
   else 
     AS_TR_CPP(gd_encoding[_CPPFLAGS])="-I$gd_encoding[]_prefix/include"
-    AS_TR_CPP(gd_encoding[_LDFLAGS])="-L$gd_encoding[]_prefix/lib -l$2"
+    AS_TR_CPP(gd_encoding[_LDFLAGS])="-L$gd_encoding[]_prefix/lib"
+    AS_TR_CPP(gd_encoding[_LIBS])="-l$2"
     AS_TR_CPP(gd_encoding[_SEARCHPATH])="$gd_encoding[]_prefix/bin:$PATH"
   fi
   AC_DEFINE(AS_TR_CPP([USE_]gd_encoding), [], [ Define to enable ]gd_encoding[ support ])
@@ -88,9 +95,10 @@ else
 fi
 AC_SUBST(AS_TR_CPP(gd_encoding[_CPPFLAGS]))
 AC_SUBST(AS_TR_CPP(gd_encoding[_LDFLAGS]))
+AC_SUBST(AS_TR_CPP(gd_encoding[_LIBS]))
 
 dnl executables needed for tests
-m4_define(gd_progname, regexp([$5 ], [^\([^ ]*\) ], [\1]))
+m4_define([gd_progname], regexp([$5 ], [^\([^ ]*\) ], [\1]))
 AC_PATH_PROGS([path_]gd_progname, [$5], [not found], [$AS_TR_CPP(gd_encoding[_SEARCHPATH])])
 
 if test "x$path_[]gd_progname" != "xnot found"; then
@@ -99,14 +107,13 @@ if test "x$path_[]gd_progname" != "xnot found"; then
 fi
 
 ifelse(`x$6', `x',,[
-m4_define(gd_unprogname, regexp([$6 ], [^\([^ ]*\) ], [\1]))
+m4_define([gd_unprogname], regexp([$6 ], [^\([^ ]*\) ], [\1]))
 AC_PATH_PROGS([path_]gd_unprogname, [$6], [not found], [$AS_TR_CPP(gd_encoding[_SEARCHPATH])])
 
 if test "x$path_[]gd_unprogname" != "xnot found"; then
   AC_DEFINE_UNQUOTED(AS_TR_CPP(gd_unprogname), ["$path_]gd_unprogname["],
                      [ Define to the full path to the `]gd_unprogname[' binary ])
 fi
-$7
 ])
 AM_CONDITIONAL(AS_TR_CPP([USE_]gd_encoding), [test "x$use_]gd_encoding[" = "xyes"])
 
@@ -122,9 +129,9 @@ if test "x$use_[]gd_encoding" != "xno"; then
   else
     ENCODINGS_BUILT="${ENCODINGS_BUILT} gd_encoding";
     if test -z "$PRIVATE_LIBS"; then
-      PRIVATE_LIBS="[$]AS_TR_CPP(gd_encoding[_LDFLAGS])"
+      PRIVATE_LIBS="[$]AS_TR_CPP(gd_encoding[_LDFLAGS]) [$]AS_TR_CPP(gd_encoding[_LIBS])"
     else
-      PRIVATE_LIBS="$PRIVATE_LIBS [$]AS_TR_CPP(gd_encoding[_LDFLAGS])"
+      PRIVATE_LIBS="[$]AS_TR_CPP(gd_encoding[_LDFLAGS]) $PRIVATE_LIBS [$]AS_TR_CPP(gd_encoding[_LIBS])"
     fi
   fi
 else
diff --git a/m4/floatordering.m4 b/m4/floatordering.m4
new file mode 100644
index 0000000..7a58ba2
--- /dev/null
+++ b/m4/floatordering.m4
@@ -0,0 +1,69 @@
+dnl Copyright (C) 2010 D. V. Wiebe
+dnl
+dnl llllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllll
+dnl
+dnl This file is part of the GetData project.
+dnl
+dnl GetData is free software; you can redistribute it and/or modify it under
+dnl the terms of the GNU Lesser General Public License as published by the
+dnl Free Software Foundation; either version 2.1 of the License, or (at your
+dnl option) any later version.
+dnl
+dnl GetData is distributed in the hope that it will be useful, but WITHOUT
+dnl ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+dnl FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+dnl License for more details.
+dnl
+dnl You should have received a copy of the GNU Lesser General Public License
+dnl along with GetData; if not, write to the Free Software Foundation, Inc.,
+dnl 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+
+dnl GD_C_FLOATORDERING
+dnl -----------------------------------------------------------
+dnl Attempt to determine the ordering of double precision floats
+AC_DEFUN([GD_C_FLOATORDERING],
+  [AC_CACHE_CHECK([floating point endianness], [gd_cv_c_floatordering],
+[gd_cv_c_floatordering=unknown
+# check for arm middle endianness
+AC_COMPILE_IFELSE([AC_LANG_SOURCE(
+[[#if ! (defined __arm__ && ! (defined __VFP_FP__ || defined __MAVERICK___))
+  not arm middle endian
+#endif
+]])],
+[gd_cv_c_floatordering=arm],
+[# not middle-endian arm, check for __FLOAT_WORD_ORDER
+AC_COMPILE_IFELSE(
+[AC_LANG_PROGRAM([[#include <endian.h>]],
+[[#ifndef __FLOAT_WORD_ORDER
+  no __FLOAT_WORD_ORDER defined
+#endif
+]])],
+[# __FLOAT_WORD_ORDER is defined; is it BIG_ENDIAN?
+AC_COMPILE_IFELSE(
+[AC_LANG_PROGRAM([[#include <endian.h>]],
+[[#if __FLOAT_WORD_ORDER != BIG_ENDIAN
+  not big endian
+#endif
+]])],
+[gd_cv_c_floatordering="big"],
+[gd_cv_c_floatordering="little"])],
+[# no __FLOAT_WORD_ORDER defined; so we just assume it's the same as the
+ # integer ordering
+AC_COMPILE_IFELSE(
+[AC_LANG_SOURCE(
+[[#ifndef WORDS_BIGENDIAN
+  not big endian
+#endif
+]])],
+[gd_cv_c_floatordering="big"],
+[gd_cv_c_floatordering="little"])])])])
+
+if test $gd_cv_c_floatordering = "arm"; then
+AC_DEFINE([ARM_ENDIAN_DOUBLES], [1],
+  [ Define to 1 if your processor stores double-precision floats in the old
+    ARM middle-endian format ])
+elif test $gd_cv_c_floatordering = "big"; then
+AC_DEFINE([FLOATS_BIGENDIAN], [1],
+  [ Define to 1 if your processor stores double-precision floats in big-endian
+    order])
+fi])
diff --git a/m4/idl.m4 b/m4/idl.m4
index aad5d42..9cca8b5 100644
--- a/m4/idl.m4
+++ b/m4/idl.m4
@@ -46,7 +46,7 @@ AC_DEFUN([GD_IDL],
 [
 idl_min_version=$1
 AC_ARG_WITH([idl], AS_HELP_STRING([--with-idl=PATH],
-            [use the IDL interpreter located in PATH [autodetect]]),
+            [use the IDL interpreter located in PATH [default: autodetect]]),
             [
               case "${withval}" in
                 no) have_idl="no" ;;
@@ -57,7 +57,7 @@ AC_ARG_WITH([idl], AS_HELP_STRING([--with-idl=PATH],
 
 
 AC_ARG_WITH([idl-dlm-dir], AS_HELP_STRING([--with-idl-dlm-dir=PATH],
-      [install the IDL bindings into PATH [autodetect]]),
+      [install the IDL bindings into PATH [default: autodetect]]),
       [
         case "${withval}" in
           no) local_idl_dlm_path= ;;
@@ -119,7 +119,7 @@ AC_MSG_RESULT([$IDL_CFLAGS])
 AC_SUBST([IDL_CFLAGS])
 
 AC_SUBST([IDL_CFLAGS])
-IDL_LIBS=`(echo 'print,"@@@"+!MAKE_DLL.LD' | $IDL 2>&1) | $GREP '@@@' | sed -e 's/@@@@<:@^ @:>@* \(.*\?\) -o.*/\1/' | sed -e 's/-m /-m/g'`
+IDL_LIBS=`(echo 'print,"@@@"+!MAKE_DLL.LD' | $IDL 2>&1) | $GREP '@@@' | sed -e 's/@@@@<:@^ @:>@* \(.*\?\) -o.*/\1/' | sed -e 's/-m \?[\w]*//g'`
 AC_MSG_CHECKING([IDL linker flags])
 AC_MSG_RESULT([$IDL_LIBS])
 AC_SUBST([IDL_LIBS])
diff --git a/m4/libtool.m4 b/m4/libtool.m4
index d812584..44e0ecf 100644
--- a/m4/libtool.m4
+++ b/m4/libtool.m4
@@ -1,8 +1,8 @@
 # libtool.m4 - Configure libtool for the host system. -*-Autoconf-*-
 #
 #   Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005,
-#                 2006, 2007, 2008, 2009, 2010 Free Software Foundation,
-#                 Inc.
+#                 2006, 2007, 2008, 2009, 2010, 2011 Free Software
+#                 Foundation, Inc.
 #   Written by Gordon Matzigkeit, 1996
 #
 # This file is free software; the Free Software Foundation gives
@@ -11,8 +11,8 @@
 
 m4_define([_LT_COPYING], [dnl
 #   Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005,
-#                 2006, 2007, 2008, 2009, 2010 Free Software Foundation,
-#                 Inc.
+#                 2006, 2007, 2008, 2009, 2010, 2011 Free Software
+#                 Foundation, Inc.
 #   Written by Gordon Matzigkeit, 1996
 #
 #   This file is part of GNU Libtool.
@@ -146,6 +146,8 @@ AC_REQUIRE([AC_CANONICAL_BUILD])dnl
 AC_REQUIRE([_LT_PREPARE_SED_QUOTE_VARS])dnl
 AC_REQUIRE([_LT_PROG_ECHO_BACKSLASH])dnl
 
+_LT_DECL([], [PATH_SEPARATOR], [1], [The PATH separator for the build system])dnl
+dnl
 _LT_DECL([], [host_alias], [0], [The host system])dnl
 _LT_DECL([], [host], [0])dnl
 _LT_DECL([], [host_os], [0])dnl
@@ -637,7 +639,7 @@ m4_ifset([AC_PACKAGE_NAME], [AC_PACKAGE_NAME ])config.lt[]dnl
 m4_ifset([AC_PACKAGE_VERSION], [ AC_PACKAGE_VERSION])
 configured by $[0], generated by m4_PACKAGE_STRING.
 
-Copyright (C) 2010 Free Software Foundation, Inc.
+Copyright (C) 2011 Free Software Foundation, Inc.
 This config.lt script is free software; the Free Software Foundation
 gives unlimited permision to copy, distribute and modify it."
 
@@ -801,6 +803,7 @@ AC_DEFUN([LT_LANG],
 m4_case([$1],
   [C],			[_LT_LANG(C)],
   [C++],		[_LT_LANG(CXX)],
+  [Go],			[_LT_LANG(GO)],
   [Java],		[_LT_LANG(GCJ)],
   [Fortran 77],		[_LT_LANG(F77)],
   [Fortran],		[_LT_LANG(FC)],
@@ -822,6 +825,31 @@ m4_defun([_LT_LANG],
 ])# _LT_LANG
 
 
+m4_ifndef([AC_PROG_GO], [
+############################################################
+# NOTE: This macro has been submitted for inclusion into   #
+#  GNU Autoconf as AC_PROG_GO.  When it is available in    #
+#  a released version of Autoconf we should remove this    #
+#  macro and use it instead.                               #
+############################################################
+m4_defun([AC_PROG_GO],
+[AC_LANG_PUSH(Go)dnl
+AC_ARG_VAR([GOC],     [Go compiler command])dnl
+AC_ARG_VAR([GOFLAGS], [Go compiler flags])dnl
+_AC_ARG_VAR_LDFLAGS()dnl
+AC_CHECK_TOOL(GOC, gccgo)
+if test -z "$GOC"; then
+  if test -n "$ac_tool_prefix"; then
+    AC_CHECK_PROG(GOC, [${ac_tool_prefix}gccgo], [${ac_tool_prefix}gccgo])
+  fi
+fi
+if test -z "$GOC"; then
+  AC_CHECK_PROG(GOC, gccgo, gccgo, false)
+fi
+])#m4_defun
+])#m4_ifndef
+
+
 # _LT_LANG_DEFAULT_CONFIG
 # -----------------------
 m4_defun([_LT_LANG_DEFAULT_CONFIG],
@@ -852,6 +880,10 @@ AC_PROVIDE_IFELSE([AC_PROG_GCJ],
        m4_ifdef([LT_PROG_GCJ],
 	[m4_define([LT_PROG_GCJ], defn([LT_PROG_GCJ])[LT_LANG(GCJ)])])])])])
 
+AC_PROVIDE_IFELSE([AC_PROG_GO],
+  [LT_LANG(GO)],
+  [m4_define([AC_PROG_GO], defn([AC_PROG_GO])[LT_LANG(GO)])])
+
 AC_PROVIDE_IFELSE([LT_PROG_RC],
   [LT_LANG(RC)],
   [m4_define([LT_PROG_RC], defn([LT_PROG_RC])[LT_LANG(RC)])])
@@ -954,7 +986,13 @@ m4_defun_once([_LT_REQUIRED_DARWIN_CHECKS],[
 	$LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \
 	  -dynamiclib -Wl,-single_module conftest.c 2>conftest.err
         _lt_result=$?
-	if test -f libconftest.dylib && test ! -s conftest.err && test $_lt_result = 0; then
+	# If there is a non-empty error log, and "single_module"
+	# appears in it, assume the flag caused a linker warning
+        if test -s conftest.err && $GREP single_module conftest.err; then
+	  cat conftest.err >&AS_MESSAGE_LOG_FD
+	# Otherwise, if the output was created with a 0 exit code from
+	# the compiler, it worked.
+	elif test -f libconftest.dylib && test $_lt_result -eq 0; then
 	  lt_cv_apple_cc_single_mod=yes
 	else
 	  cat conftest.err >&AS_MESSAGE_LOG_FD
@@ -962,6 +1000,7 @@ m4_defun_once([_LT_REQUIRED_DARWIN_CHECKS],[
 	rm -rf libconftest.dylib*
 	rm -f conftest.*
       fi])
+
     AC_CACHE_CHECK([for -exported_symbols_list linker flag],
       [lt_cv_ld_exported_symbols_list],
       [lt_cv_ld_exported_symbols_list=no
@@ -973,6 +1012,7 @@ m4_defun_once([_LT_REQUIRED_DARWIN_CHECKS],[
 	[lt_cv_ld_exported_symbols_list=no])
 	LDFLAGS="$save_LDFLAGS"
     ])
+
     AC_CACHE_CHECK([for -force_load linker flag],[lt_cv_ld_force_load],
       [lt_cv_ld_force_load=no
       cat > conftest.c << _LT_EOF
@@ -990,7 +1030,9 @@ _LT_EOF
       echo "$LTCC $LTCFLAGS $LDFLAGS -o conftest conftest.c -Wl,-force_load,./libconftest.a" >&AS_MESSAGE_LOG_FD
       $LTCC $LTCFLAGS $LDFLAGS -o conftest conftest.c -Wl,-force_load,./libconftest.a 2>conftest.err
       _lt_result=$?
-      if test -f conftest && test ! -s conftest.err && test $_lt_result = 0 && $GREP forced_load conftest 2>&1 >/dev/null; then
+      if test -s conftest.err && $GREP force_load conftest.err; then
+	cat conftest.err >&AS_MESSAGE_LOG_FD
+      elif test -f conftest && test $_lt_result -eq 0 && $GREP forced_load conftest >/dev/null 2>&1 ; then
 	lt_cv_ld_force_load=yes
       else
 	cat conftest.err >&AS_MESSAGE_LOG_FD
@@ -1035,8 +1077,8 @@ _LT_EOF
 ])
 
 
-# _LT_DARWIN_LINKER_FEATURES
-# --------------------------
+# _LT_DARWIN_LINKER_FEATURES([TAG])
+# ---------------------------------
 # Checks for linker and compiler features on darwin
 m4_defun([_LT_DARWIN_LINKER_FEATURES],
 [
@@ -1047,6 +1089,8 @@ m4_defun([_LT_DARWIN_LINKER_FEATURES],
   _LT_TAGVAR(hardcode_shlibpath_var, $1)=unsupported
   if test "$lt_cv_ld_force_load" = "yes"; then
     _LT_TAGVAR(whole_archive_flag_spec, $1)='`for conv in $convenience\"\"; do test  -n \"$conv\" && new_convenience=\"$new_convenience ${wl}-force_load,$conv\"; done; func_echo_all \"$new_convenience\"`'
+    m4_case([$1], [F77], [_LT_TAGVAR(compiler_needs_object, $1)=yes],
+                  [FC],  [_LT_TAGVAR(compiler_needs_object, $1)=yes])
   else
     _LT_TAGVAR(whole_archive_flag_spec, $1)=''
   fi
@@ -1330,14 +1374,27 @@ s390*-*linux*|s390*-*tpf*|sparc*-*linux*)
     CFLAGS="$SAVE_CFLAGS"
   fi
   ;;
-sparc*-*solaris*)
+*-*solaris*)
   # Find out which ABI we are using.
   echo 'int i;' > conftest.$ac_ext
   if AC_TRY_EVAL(ac_compile); then
     case `/usr/bin/file conftest.o` in
     *64-bit*)
       case $lt_cv_prog_gnu_ld in
-      yes*) LD="${LD-ld} -m elf64_sparc" ;;
+      yes*)
+        case $host in
+        i?86-*-solaris*)
+          LD="${LD-ld} -m elf_x86_64"
+          ;;
+        sparc*-*-solaris*)
+          LD="${LD-ld} -m elf64_sparc"
+          ;;
+        esac
+        # GNU ld 2.21 introduced _sol2 emulations.  Use them if available.
+        if ${LD-ld} -V | grep _sol2 >/dev/null 2>&1; then
+          LD="${LD-ld}_sol2"
+        fi
+        ;;
       *)
 	if ${LD-ld} -64 -r -o conftest2.o conftest.o >/dev/null 2>&1; then
 	  LD="${LD-ld} -64"
@@ -1414,13 +1471,13 @@ old_postuninstall_cmds=
 if test -n "$RANLIB"; then
   case $host_os in
   openbsd*)
-    old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB -t \$oldlib"
+    old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB -t \$tool_oldlib"
     ;;
   *)
-    old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB \$oldlib"
+    old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB \$tool_oldlib"
     ;;
   esac
-  old_archive_cmds="$old_archive_cmds~\$RANLIB \$oldlib"
+  old_archive_cmds="$old_archive_cmds~\$RANLIB \$tool_oldlib"
 fi
 
 case $host_os in
@@ -1600,6 +1657,11 @@ AC_CACHE_VAL([lt_cv_sys_max_cmd_len], [dnl
     lt_cv_sys_max_cmd_len=196608
     ;;
 
+  os2*)
+    # The test takes a long time on OS/2.
+    lt_cv_sys_max_cmd_len=8192
+    ;;
+
   osf*)
     # Dr. Hans Ekkehard Plesser reports seeing a kernel panic running configure
     # due to this test when exec_disable_arg_limit is 1 on Tru64. It is not
@@ -1639,7 +1701,7 @@ AC_CACHE_VAL([lt_cv_sys_max_cmd_len], [dnl
       # If test is not a shell built-in, we'll probably end up computing a
       # maximum length that is only half of the actual maximum length, but
       # we can't tell.
-      while { test "X"`func_fallback_echo "$teststring$teststring" 2>/dev/null` \
+      while { test "X"`env echo "$teststring$teststring" 2>/dev/null` \
 	         = "X$teststring$teststring"; } >/dev/null 2>&1 &&
 	      test $i != 17 # 1/2 MB should be enough
       do
@@ -2185,7 +2247,7 @@ need_version=unknown
 
 case $host_os in
 aix3*)
-  version_type=linux
+  version_type=linux # correct to gnu/linux during the next big refactor
   library_names_spec='${libname}${release}${shared_ext}$versuffix $libname.a'
   shlibpath_var=LIBPATH
 
@@ -2194,7 +2256,7 @@ aix3*)
   ;;
 
 aix[[4-9]]*)
-  version_type=linux
+  version_type=linux # correct to gnu/linux during the next big refactor
   need_lib_prefix=no
   need_version=no
   hardcode_into_libs=yes
@@ -2259,7 +2321,7 @@ beos*)
   ;;
 
 bsdi[[45]]*)
-  version_type=linux
+  version_type=linux # correct to gnu/linux during the next big refactor
   need_version=no
   library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
   soname_spec='${libname}${release}${shared_ext}$major'
@@ -2398,7 +2460,7 @@ m4_if([$1], [],[
   ;;
 
 dgux*)
-  version_type=linux
+  version_type=linux # correct to gnu/linux during the next big refactor
   need_lib_prefix=no
   need_version=no
   library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname$shared_ext'
@@ -2406,10 +2468,6 @@ dgux*)
   shlibpath_var=LD_LIBRARY_PATH
   ;;
 
-freebsd1*)
-  dynamic_linker=no
-  ;;
-
 freebsd* | dragonfly*)
   # DragonFly does not have aout.  When/if they implement a new
   # versioning mechanism, adjust this.
@@ -2417,7 +2475,7 @@ freebsd* | dragonfly*)
     objformat=`/usr/bin/objformat`
   else
     case $host_os in
-    freebsd[[123]]*) objformat=aout ;;
+    freebsd[[23]].*) objformat=aout ;;
     *) objformat=elf ;;
     esac
   fi
@@ -2435,7 +2493,7 @@ freebsd* | dragonfly*)
   esac
   shlibpath_var=LD_LIBRARY_PATH
   case $host_os in
-  freebsd2*)
+  freebsd2.*)
     shlibpath_overrides_runpath=yes
     ;;
   freebsd3.[[01]]* | freebsdelf3.[[01]]*)
@@ -2455,17 +2513,18 @@ freebsd* | dragonfly*)
   ;;
 
 gnu*)
-  version_type=linux
+  version_type=linux # correct to gnu/linux during the next big refactor
   need_lib_prefix=no
   need_version=no
   library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}'
   soname_spec='${libname}${release}${shared_ext}$major'
   shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=no
   hardcode_into_libs=yes
   ;;
 
 haiku*)
-  version_type=linux
+  version_type=linux # correct to gnu/linux during the next big refactor
   need_lib_prefix=no
   need_version=no
   dynamic_linker="$host_os runtime_loader"
@@ -2526,7 +2585,7 @@ hpux9* | hpux10* | hpux11*)
   ;;
 
 interix[[3-9]]*)
-  version_type=linux
+  version_type=linux # correct to gnu/linux during the next big refactor
   need_lib_prefix=no
   need_version=no
   library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}'
@@ -2542,7 +2601,7 @@ irix5* | irix6* | nonstopux*)
     nonstopux*) version_type=nonstopux ;;
     *)
 	if test "$lt_cv_prog_gnu_ld" = yes; then
-		version_type=linux
+		version_type=linux # correct to gnu/linux during the next big refactor
 	else
 		version_type=irix
 	fi ;;
@@ -2579,9 +2638,9 @@ linux*oldld* | linux*aout* | linux*coff*)
   dynamic_linker=no
   ;;
 
-# This must be Linux ELF.
+# This must be glibc/ELF.
 linux* | k*bsd*-gnu | kopensolaris*-gnu)
-  version_type=linux
+  version_type=linux # correct to gnu/linux during the next big refactor
   need_lib_prefix=no
   need_version=no
   library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
@@ -2644,7 +2703,7 @@ netbsd*)
   ;;
 
 newsos6)
-  version_type=linux
+  version_type=linux # correct to gnu/linux during the next big refactor
   library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
   shlibpath_var=LD_LIBRARY_PATH
   shlibpath_overrides_runpath=yes
@@ -2713,7 +2772,7 @@ rdos*)
   ;;
 
 solaris*)
-  version_type=linux
+  version_type=linux # correct to gnu/linux during the next big refactor
   need_lib_prefix=no
   need_version=no
   library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
@@ -2738,7 +2797,7 @@ sunos4*)
   ;;
 
 sysv4 | sysv4.3*)
-  version_type=linux
+  version_type=linux # correct to gnu/linux during the next big refactor
   library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
   soname_spec='${libname}${release}${shared_ext}$major'
   shlibpath_var=LD_LIBRARY_PATH
@@ -2762,7 +2821,7 @@ sysv4 | sysv4.3*)
 
 sysv4*MP*)
   if test -d /usr/nec ;then
-    version_type=linux
+    version_type=linux # correct to gnu/linux during the next big refactor
     library_names_spec='$libname${shared_ext}.$versuffix $libname${shared_ext}.$major $libname${shared_ext}'
     soname_spec='$libname${shared_ext}.$major'
     shlibpath_var=LD_LIBRARY_PATH
@@ -2793,7 +2852,7 @@ sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*)
 
 tpf*)
   # TPF is a cross-target only.  Preferred cross-host = GNU/Linux.
-  version_type=linux
+  version_type=linux # correct to gnu/linux during the next big refactor
   need_lib_prefix=no
   need_version=no
   library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
@@ -2803,7 +2862,7 @@ tpf*)
   ;;
 
 uts4*)
-  version_type=linux
+  version_type=linux # correct to gnu/linux during the next big refactor
   library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
   soname_spec='${libname}${release}${shared_ext}$major'
   shlibpath_var=LD_LIBRARY_PATH
@@ -3225,7 +3284,7 @@ irix5* | irix6* | nonstopux*)
   lt_cv_deplibs_check_method=pass_all
   ;;
 
-# This must be Linux ELF.
+# This must be glibc/ELF.
 linux* | k*bsd*-gnu | kopensolaris*-gnu)
   lt_cv_deplibs_check_method=pass_all
   ;;
@@ -3645,6 +3704,7 @@ for ac_symprfx in "" "_"; do
     # which start with @ or ?.
     lt_cv_sys_global_symbol_pipe="$AWK ['"\
 "     {last_section=section; section=\$ 3};"\
+"     /^COFF SYMBOL TABLE/{for(i in hide) delete hide[i]};"\
 "     /Section length .*#relocs.*(pick any)/{hide[last_section]=1};"\
 "     \$ 0!~/External *\|/{next};"\
 "     / 0+ UNDEF /{next}; / UNDEF \([^|]\)*()/{next};"\
@@ -4229,7 +4289,9 @@ m4_if([$1], [CXX], [
     case $cc_basename in
     nvcc*) # Cuda Compiler Driver 2.2
       _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Xlinker '
-      _LT_TAGVAR(lt_prog_compiler_pic, $1)='-Xcompiler -fPIC'
+      if test -n "$_LT_TAGVAR(lt_prog_compiler_pic, $1)"; then
+        _LT_TAGVAR(lt_prog_compiler_pic, $1)="-Xcompiler $_LT_TAGVAR(lt_prog_compiler_pic, $1)"
+      fi
       ;;
     esac
   else
@@ -4321,18 +4383,33 @@ m4_if([$1], [CXX], [
 	;;
       *)
 	case `$CC -V 2>&1 | sed 5q` in
-	*Sun\ F* | *Sun*Fortran*)
+	*Sun\ Ceres\ Fortran* | *Sun*Fortran*\ [[1-7]].* | *Sun*Fortran*\ 8.[[0-3]]*)
 	  # Sun Fortran 8.3 passes all unrecognized flags to the linker
 	  _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
 	  _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
 	  _LT_TAGVAR(lt_prog_compiler_wl, $1)=''
 	  ;;
+	*Sun\ F* | *Sun*Fortran*)
+	  _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
+	  _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+	  _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld '
+	  ;;
 	*Sun\ C*)
 	  # Sun C 5.9
 	  _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
 	  _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
 	  _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
 	  ;;
+        *Intel*\ [[CF]]*Compiler*)
+	  _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+	  _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
+	  _LT_TAGVAR(lt_prog_compiler_static, $1)='-static'
+	  ;;
+	*Portland\ Group*)
+	  _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+	  _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fpic'
+	  _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+	  ;;
 	esac
 	;;
       esac
@@ -4492,7 +4569,9 @@ m4_if([$1], [CXX], [
     ;;
   cygwin* | mingw* | cegcc*)
     case $cc_basename in
-    cl*) ;;
+    cl*)
+      _LT_TAGVAR(exclude_expsyms, $1)='_NULL_IMPORT_DESCRIPTOR|_IMPORT_DESCRIPTOR_.*'
+      ;;
     *)
       _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]][[ ]]/s/.*[[ ]]\([[^ ]]*\)/\1 DATA/;s/^.*[[ ]]__nm__\([[^ ]]*\)[[ ]][[^ ]]*/\1 DATA/;/^I[[ ]]/d;/^[[AITW]][[ ]]/s/.* //'\'' | sort | uniq > $export_symbols'
       _LT_TAGVAR(exclude_expsyms, $1)=['[_]+GLOBAL_OFFSET_TABLE_|[_]+GLOBAL__[FID]_.*|[_]+head_[A-Za-z0-9_]+_dll|[A-Za-z0-9_]+_dll_iname']
@@ -4517,7 +4596,6 @@ m4_if([$1], [CXX], [
   _LT_TAGVAR(hardcode_direct, $1)=no
   _LT_TAGVAR(hardcode_direct_absolute, $1)=no
   _LT_TAGVAR(hardcode_libdir_flag_spec, $1)=
-  _LT_TAGVAR(hardcode_libdir_flag_spec_ld, $1)=
   _LT_TAGVAR(hardcode_libdir_separator, $1)=
   _LT_TAGVAR(hardcode_minus_L, $1)=no
   _LT_TAGVAR(hardcode_shlibpath_var, $1)=unsupported
@@ -4768,8 +4846,7 @@ _LT_EOF
 	xlf* | bgf* | bgxlf* | mpixlf*)
 	  # IBM XL Fortran 10.1 on PPC cannot create shared libs itself
 	  _LT_TAGVAR(whole_archive_flag_spec, $1)='--whole-archive$convenience --no-whole-archive'
-	  _LT_TAGVAR(hardcode_libdir_flag_spec, $1)=
-	  _LT_TAGVAR(hardcode_libdir_flag_spec_ld, $1)='-rpath $libdir'
+	  _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
 	  _LT_TAGVAR(archive_cmds, $1)='$LD -shared $libobjs $deplibs $linker_flags -soname $soname -o $lib'
 	  if test "x$supports_anon_versioning" = xyes; then
 	    _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $output_objdir/$libname.ver~
@@ -5064,6 +5141,7 @@ _LT_EOF
 	# The linker will not automatically build a static lib if we build a DLL.
 	# _LT_TAGVAR(old_archive_from_new_cmds, $1)='true'
 	_LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes
+	_LT_TAGVAR(exclude_expsyms, $1)='_NULL_IMPORT_DESCRIPTOR|_IMPORT_DESCRIPTOR_.*'
 	_LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]][[ ]]/s/.*[[ ]]\([[^ ]]*\)/\1,DATA/'\'' | $SED -e '\''/^[[AITW]][[ ]]/s/.*[[ ]]//'\'' | sort | uniq > $export_symbols'
 	# Don't use ranlib
 	_LT_TAGVAR(old_postinstall_cmds, $1)='chmod 644 $oldlib'
@@ -5110,10 +5188,6 @@ _LT_EOF
       _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
       ;;
 
-    freebsd1*)
-      _LT_TAGVAR(ld_shlibs, $1)=no
-      ;;
-
     # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor
     # support.  Future versions do this automatically, but an explicit c++rt0.o
     # does not break anything, and helps significantly (at the cost of a little
@@ -5126,7 +5200,7 @@ _LT_EOF
       ;;
 
     # Unfortunately, older versions of FreeBSD 2 do not have this feature.
-    freebsd2*)
+    freebsd2.*)
       _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'
       _LT_TAGVAR(hardcode_direct, $1)=yes
       _LT_TAGVAR(hardcode_minus_L, $1)=yes
@@ -5165,7 +5239,6 @@ _LT_EOF
       fi
       if test "$with_gnu_ld" = no; then
 	_LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir'
-	_LT_TAGVAR(hardcode_libdir_flag_spec_ld, $1)='+b $libdir'
 	_LT_TAGVAR(hardcode_libdir_separator, $1)=:
 	_LT_TAGVAR(hardcode_direct, $1)=yes
 	_LT_TAGVAR(hardcode_direct_absolute, $1)=yes
@@ -5607,9 +5680,6 @@ _LT_TAGDECL([], [no_undefined_flag], [1],
 _LT_TAGDECL([], [hardcode_libdir_flag_spec], [1],
     [Flag to hardcode $libdir into a binary during linking.
     This must work even if $libdir does not exist])
-_LT_TAGDECL([], [hardcode_libdir_flag_spec_ld], [1],
-    [[If ld is used when linking, flag to hardcode $libdir into a binary
-    during linking.  This must work even if $libdir does not exist]])
 _LT_TAGDECL([], [hardcode_libdir_separator], [1],
     [Whether we need a single "-rpath" flag with a separated argument])
 _LT_TAGDECL([], [hardcode_direct], [0],
@@ -5767,7 +5837,6 @@ _LT_TAGVAR(export_dynamic_flag_spec, $1)=
 _LT_TAGVAR(hardcode_direct, $1)=no
 _LT_TAGVAR(hardcode_direct_absolute, $1)=no
 _LT_TAGVAR(hardcode_libdir_flag_spec, $1)=
-_LT_TAGVAR(hardcode_libdir_flag_spec_ld, $1)=
 _LT_TAGVAR(hardcode_libdir_separator, $1)=
 _LT_TAGVAR(hardcode_minus_L, $1)=no
 _LT_TAGVAR(hardcode_shlibpath_var, $1)=unsupported
@@ -6137,7 +6206,7 @@ if test "$_lt_caught_CXX_error" != yes; then
         esac
         ;;
 
-      freebsd[[12]]*)
+      freebsd2.*)
         # C++ shared libraries reported to be fairly broken before
 	# switch to ELF
         _LT_TAGVAR(ld_shlibs, $1)=no
@@ -6898,12 +6967,18 @@ public class foo {
   }
 };
 _LT_EOF
+], [$1], [GO], [cat > conftest.$ac_ext <<_LT_EOF
+package foo
+func foo() {
+}
+_LT_EOF
 ])
 
 _lt_libdeps_save_CFLAGS=$CFLAGS
 case "$CC $CFLAGS " in #(
 *\ -flto*\ *) CFLAGS="$CFLAGS -fno-lto" ;;
 *\ -fwhopr*\ *) CFLAGS="$CFLAGS -fno-whopr" ;;
+*\ -fuse-linker-plugin*\ *) CFLAGS="$CFLAGS -fno-use-linker-plugin" ;;
 esac
 
 dnl Parse the compiler output and extract the necessary
@@ -7100,7 +7175,6 @@ _LT_TAGVAR(export_dynamic_flag_spec, $1)=
 _LT_TAGVAR(hardcode_direct, $1)=no
 _LT_TAGVAR(hardcode_direct_absolute, $1)=no
 _LT_TAGVAR(hardcode_libdir_flag_spec, $1)=
-_LT_TAGVAR(hardcode_libdir_flag_spec_ld, $1)=
 _LT_TAGVAR(hardcode_libdir_separator, $1)=
 _LT_TAGVAR(hardcode_minus_L, $1)=no
 _LT_TAGVAR(hardcode_automatic, $1)=no
@@ -7233,7 +7307,6 @@ _LT_TAGVAR(export_dynamic_flag_spec, $1)=
 _LT_TAGVAR(hardcode_direct, $1)=no
 _LT_TAGVAR(hardcode_direct_absolute, $1)=no
 _LT_TAGVAR(hardcode_libdir_flag_spec, $1)=
-_LT_TAGVAR(hardcode_libdir_flag_spec_ld, $1)=
 _LT_TAGVAR(hardcode_libdir_separator, $1)=
 _LT_TAGVAR(hardcode_minus_L, $1)=no
 _LT_TAGVAR(hardcode_automatic, $1)=no
@@ -7420,6 +7493,77 @@ CFLAGS=$lt_save_CFLAGS
 ])# _LT_LANG_GCJ_CONFIG
 
 
+# _LT_LANG_GO_CONFIG([TAG])
+# --------------------------
+# Ensure that the configuration variables for the GNU Go compiler
+# are suitably defined.  These variables are subsequently used by _LT_CONFIG
+# to write the compiler configuration to `libtool'.
+m4_defun([_LT_LANG_GO_CONFIG],
+[AC_REQUIRE([LT_PROG_GO])dnl
+AC_LANG_SAVE
+
+# Source file extension for Go test sources.
+ac_ext=go
+
+# Object file extension for compiled Go test sources.
+objext=o
+_LT_TAGVAR(objext, $1)=$objext
+
+# Code to be used in simple compile tests
+lt_simple_compile_test_code="package main; func main() { }"
+
+# Code to be used in simple link tests
+lt_simple_link_test_code='package main; func main() { }'
+
+# ltmain only uses $CC for tagged configurations so make sure $CC is set.
+_LT_TAG_COMPILER
+
+# save warnings/boilerplate of simple test code
+_LT_COMPILER_BOILERPLATE
+_LT_LINKER_BOILERPLATE
+
+# Allow CC to be a program name with arguments.
+lt_save_CC=$CC
+lt_save_CFLAGS=$CFLAGS
+lt_save_GCC=$GCC
+GCC=yes
+CC=${GOC-"gccgo"}
+CFLAGS=$GOFLAGS
+compiler=$CC
+_LT_TAGVAR(compiler, $1)=$CC
+_LT_TAGVAR(LD, $1)="$LD"
+_LT_CC_BASENAME([$compiler])
+
+# Go did not exist at the time GCC didn't implicitly link libc in.
+_LT_TAGVAR(archive_cmds_need_lc, $1)=no
+
+_LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds
+_LT_TAGVAR(reload_flag, $1)=$reload_flag
+_LT_TAGVAR(reload_cmds, $1)=$reload_cmds
+
+## CAVEAT EMPTOR:
+## There is no encapsulation within the following macros, do not change
+## the running order or otherwise move them around unless you know exactly
+## what you are doing...
+if test -n "$compiler"; then
+  _LT_COMPILER_NO_RTTI($1)
+  _LT_COMPILER_PIC($1)
+  _LT_COMPILER_C_O($1)
+  _LT_COMPILER_FILE_LOCKS($1)
+  _LT_LINKER_SHLIBS($1)
+  _LT_LINKER_HARDCODE_LIBPATH($1)
+
+  _LT_CONFIG($1)
+fi
+
+AC_LANG_RESTORE
+
+GCC=$lt_save_GCC
+CC=$lt_save_CC
+CFLAGS=$lt_save_CFLAGS
+])# _LT_LANG_GO_CONFIG
+
+
 # _LT_LANG_RC_CONFIG([TAG])
 # -------------------------
 # Ensure that the configuration variables for the Windows resource compiler
@@ -7489,6 +7633,13 @@ dnl aclocal-1.4 backwards compatibility:
 dnl AC_DEFUN([LT_AC_PROG_GCJ], [])
 
 
+# LT_PROG_GO
+# ----------
+AC_DEFUN([LT_PROG_GO],
+[AC_CHECK_TOOL(GOC, gccgo,)
+])
+
+
 # LT_PROG_RC
 # ----------
 AC_DEFUN([LT_PROG_RC],
diff --git a/m4/ltoptions.m4 b/m4/ltoptions.m4
index 17cfd51..5d9acd8 100644
--- a/m4/ltoptions.m4
+++ b/m4/ltoptions.m4
@@ -326,9 +326,24 @@ dnl AC_DEFUN([AM_DISABLE_FAST_INSTALL], [])
 # MODE is either `yes' or `no'.  If omitted, it defaults to `both'.
 m4_define([_LT_WITH_PIC],
 [AC_ARG_WITH([pic],
-    [AS_HELP_STRING([--with-pic],
+    [AS_HELP_STRING([--with-pic@<:@=PKGS@:>@],
 	[try to use only PIC/non-PIC objects @<:@default=use both@:>@])],
-    [pic_mode="$withval"],
+    [lt_p=${PACKAGE-default}
+    case $withval in
+    yes|no) pic_mode=$withval ;;
+    *)
+      pic_mode=default
+      # Look at the argument we got.  We use all the common list separators.
+      lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR,"
+      for lt_pkg in $withval; do
+	IFS="$lt_save_ifs"
+	if test "X$lt_pkg" = "X$lt_p"; then
+	  pic_mode=yes
+	fi
+      done
+      IFS="$lt_save_ifs"
+      ;;
+    esac],
     [pic_mode=default])
 
 test -z "$pic_mode" && pic_mode=m4_default([$1], [default])
diff --git a/m4/ltversion.m4 b/m4/ltversion.m4
index 9c7b5d4..07a8602 100644
--- a/m4/ltversion.m4
+++ b/m4/ltversion.m4
@@ -9,15 +9,15 @@
 
 # @configure_input@
 
-# serial 3293 ltversion.m4
+# serial 3337 ltversion.m4
 # This file is part of GNU Libtool
 
-m4_define([LT_PACKAGE_VERSION], [2.4])
-m4_define([LT_PACKAGE_REVISION], [1.3293])
+m4_define([LT_PACKAGE_VERSION], [2.4.2])
+m4_define([LT_PACKAGE_REVISION], [1.3337])
 
 AC_DEFUN([LTVERSION_VERSION],
-[macro_version='2.4'
-macro_revision='1.3293'
+[macro_version='2.4.2'
+macro_revision='1.3337'
 _LT_DECL(, macro_version, 0, [Which release of libtool.m4 was used?])
 _LT_DECL(, macro_revision, 0)
 ])
diff --git a/m4/matlab.m4 b/m4/matlab.m4
new file mode 100644
index 0000000..a43c2f2
--- /dev/null
+++ b/m4/matlab.m4
@@ -0,0 +1,161 @@
+dnl Copyright (C) 2013 D. V. Wiebe
+dnl
+dnl llllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllll
+dnl
+dnl This file is part of the GetData project.
+dnl
+dnl GetData is free software; you can redistribute it and/or modify it under
+dnl the terms of the GNU Lesser General Public License as published by the
+dnl Free Software Foundation; either version 2.1 of the License, or (at your
+dnl option) any later version.
+dnl
+dnl GetData is distributed in the hope that it will be useful, but WITHOUT
+dnl ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+dnl FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+dnl License for more details.
+dnl
+dnl You should have received a copy of the GNU Lesser General Public License
+dnl along with GetData; if not, write to the Free Software Foundation, Inc.,
+dnl 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+
+dnl GD_MATLAB
+dnl ---------------------------------------------------------------
+dnl Look for mex; sets and substs MEX on success
+AC_DEFUN([GD_MEX],
+[
+dnl --without-mex basically does the same as --disable-matlab
+AC_ARG_WITH([mex], AS_HELP_STRING([--with-mex=PATH],
+            [use the MATLAB MEX compiler located at PATH.  ]
+            [[default: autodetect]]),
+            [
+              case "${withval}" in
+                no) have_matlab="no" ;;
+                yes) user_mex= ;;
+                *) user_mex="${withval}";;
+              esac
+            ], [ user_mex= ])
+
+dnl try to find mex
+MEX="not found"
+if test "x$user_mex" != "x"; then
+  AC_MSG_CHECKING([if $user_mex is a MATLAB mex compiler])
+  mex_out=`$user_mex 2>&1`
+  mex_status=$?
+  if test $mex_status -eq 1; then
+    if echo $mex_out | grep -q 'consult the MATLAB External Interfaces Guide'; then
+      MEX=$user_mex
+    fi
+  fi
+  if test "x$MEX" = "xnot found"; then
+    AC_MSG_RESULT([no])
+  else
+    AC_MSG_RESULT([yes])
+  fi
+else
+  AC_PATH_PROG([MEX], [mex], [not found])
+fi
+
+if test "x$MEX" = "xnot found"; then
+  have_matlab="no"
+  MEX=
+fi
+AC_SUBST([MEX])
+])
+
+dnl GD_MEX_VAR
+dnl ---------------------------------------------------------------
+dnl Determine a MEX variable and store it in the supplied local
+dnl variable
+AC_DEFUN([GD_MEX_VAR],
+[
+$1=`$MEX -v 2>/dev/null | ${AWK} '/$2 *=/ { print @S|@4 }'`
+])
+
+dnl GD_MATLAB_EVAL
+dnl ---------------------------------------------------------------
+dnl Evaluate something in MATLAB and store it in the supplied local
+dnl variable
+AC_DEFUN([GD_MATLAB_EVAL],
+[
+ifelse(`$#', `2', [matlab_int=$MATLAB], [matlab_int=$3])
+$1=`$matlab_int -nodisplay -nosplash -nojvm -nodesktop -r "fprintf(2, '@@@%s@@@\n', $2); quit" 2>&1 >/dev/null | ${AWK} 'BEGIN { FS="@@@" } /^@@@/ { print @S|@2 }'`
+])
+
+dnl GD_MATLAB
+dnl ---------------------------------------------------------------
+dnl Look for matlab, &c.
+dnl
+AC_DEFUN([GD_MATLAB],
+[
+dnl --without-matlab basically does the same as --disable-matlab
+AC_ARG_WITH([matlab], AS_HELP_STRING([--with-matlab=PATH],
+            [use the MATLAB interpreter located at PATH.  ]
+            [[default: autodetect]]),
+            [
+              case "${withval}" in
+                no) have_matlab="no" ;;
+                yes) user_matlab= ; have_matlab= ;;
+                *) user_matlab="${withval}"; have_matlab= ;;
+              esac
+            ], [ user_matlab=; have_matlab= ])
+
+dnl find MEX first
+if test "x${have_matlab}" != "xno"; then
+  GD_MEX
+fi
+
+dnl find matlab
+if test "x${have_matlab}" != "xno"; then
+  dnl try to find matlab
+  MATLAB="not found"
+  if test "x$user_matlab" != "x"; then
+    AC_MSG_CHECKING([if $user_matlab is a MATLAB interpreter])
+    GD_MATLAB_EVAL([matlab_ver], [version], [$user_matlab])
+    if test "x$matlab_ver" = "x"; then
+      AC_MSG_RESULT([no])
+    else
+      AC_MSG_RESULT([yes])
+      MATLAB=$user_matlab
+      MATLAB_VERSION=$matlab_ver
+    fi
+  else
+    AC_PATH_PROG([MATLAB], [matlab], [not found])
+  fi
+
+  if test "x$MATLAB" = "xnot found"; then
+    have_matlab=no
+    MATLAB=
+  fi
+  AC_SUBST([MATLAB])
+fi
+
+if test "x${have_matlab}" != "xno"; then
+  dnl installdir
+  default_matlabbasedir=$libdir/getdata/matlab
+  AC_ARG_WITH([matlab-dir], AS_HELP_STRING([--with-matlab-dir=PATH],
+        [ Install Matlab bindings in PATH/getdata.  ]
+        [[default: LIBDIR/getdata/matlab]]),
+      [
+      case "${withval}" in
+      no) matlabbasedir=$default_matlabbasedir ;;
+      *) matlabbasedir="${withval}" ;;
+      esac
+      ], [ matlabbasedir=$default_matlabbasedir ])
+  AC_MSG_CHECKING([matlab install directory])
+  AC_MSG_RESULT([$matlabbasedir])
+  AC_SUBST([matlabbasedir])
+
+  dnl mex extension
+  AC_MSG_CHECKING([MEX extension])
+  GD_MATLAB_EVAL([mexext], [mexext])
+  AC_MSG_RESULT([.$mexext])
+  AC_SUBST([mexext])
+
+  dnl flags
+  AC_MSG_CHECKING([MatLab CPPFLAGS])
+  GD_MEX_VAR([matlab_prefix], [MATLAB])
+  MATLAB_CPPFLAGS="-I${matlab_prefix}/extern/include"
+  AC_MSG_RESULT([$MATLAB_CPPFLAGS])
+  AC_SUBST([MATLAB_CPPFLAGS])
+fi
+])
diff --git a/m4/perl.m4 b/m4/perl.m4
new file mode 100644
index 0000000..944facf
--- /dev/null
+++ b/m4/perl.m4
@@ -0,0 +1,196 @@
+dnl Copyright (C) 2009-2011 D. V. Wiebe
+dnl
+dnl llllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllll
+dnl
+dnl This file is part of the GetData project.
+dnl
+dnl GetData is free software; you can redistribute it and/or modify it under
+dnl the terms of the GNU Lesser General Public License as published by the
+dnl Free Software Foundation; either version 2.1 of the License, or (at your
+dnl option) any later version.
+dnl
+dnl GetData is distributed in the hope that it will be useful, but WITHOUT
+dnl ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+dnl FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+dnl License for more details.
+dnl
+dnl You should have received a copy of the GNU Lesser General Public License
+dnl along with GetData; if not, write to the Free Software Foundation, Inc.,
+dnl 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+
+dnl GD_PERL_CONFIG
+dnl ---------------------------------------------------------------
+dnl query perl for the specified configuration value and store it in the
+dnl supplied local variable
+AC_DEFUN([GD_PERL_CONFIG],
+[
+ifelse(`$#', `2', [perl_int=$PERL], [perl_int=$3])
+# 3=$3
+$1=`$perl_int -V::$2: | sed -e "s/'//g" | sed -e "s/[ \t]*$//"`
+])
+
+dnl GD_PERL_CHECK_VERSION
+dnl ---------------------------------------------------------------
+dnl Define PERL_VERSION to the version of the idl interpreter
+AC_DEFUN([GD_PERL_CHECK_VERSION],
+[
+perl_version_ok="no"
+GD_PERL_CONFIG([PERL_VERSION], [version], [$1])
+AX_COMPARE_VERSION([$PERL_VERSION],[ge],[$2],[perl_version_ok="yes"])
+if test "x$perl_version_ok" = "xyes"; then
+  $3
+  true
+else
+  $4
+  true
+fi
+])
+
+dnl GD_PERL_MAN3EXT
+dnl ---------------------------------------------------------------
+dnl Define PERL_MAN3EXT to the section 3 manual extension used by Module::Build
+AC_DEFUN([GD_PERL_MAN3EXT],
+[
+AC_MSG_CHECKING([for the section 3 manual page extension])
+PERL_MAN3EXT=`$PERL -MModule::Build -e 'print "\n>>GD ", Module::Build->new(module_name=>"conftest",dist_version=>0)->config('man3ext'), " GD<<";' | $AWK '/>>GD .* GD<</ { print @S|@2 }'`
+AC_MSG_RESULT([.$PERL_MAN3EXT])
+AC_SUBST([PERL_MAN3EXT])
+])
+
+dnl GD_PERL_CHECK_MODULE
+dnl ---------------------------------------------------------------
+dnl Define HAVE_<MODULE_NAME> if the specified module exists
+AC_DEFUN([GD_PERL_CHECK_MODULE],
+[
+AC_MSG_CHECKING([for $1])
+if $PERL -M$1 -e 'exit' > /dev/null 2>&1; then
+  AS_TR_SH([HAVE_$1])=yes
+else
+  AS_TR_SH([HAVE_$1])=no
+fi
+AC_MSG_RESULT([${AS_TR_SH([HAVE_$1])}])
+])
+
+dnl GD_PERL
+dnl ---------------------------------------------------------------
+dnl Look for perl5.  Then determine whether we can build XSUBs.
+AC_DEFUN([GD_PERL],
+[
+first_perl=5.8.0
+perl_prog_list="perl perl5 \
+perl5.14 perl5.12 perl5.10 perl5.8 \
+perl5.14.0 \
+perl5.12.3 perl5.12.2 perl5.12.1 perl5.12.0 \
+perl5.10.1 perl5.10.0 \
+perl5.8.9 perl5.8.8 perl5.8.7 perl5.8.6 perl5.8.5 perl5.8.4 perl5.8.3 \
+perl5.8.2 perl5.8.1 perl5.8.0"
+
+dnl --without-perl basically does the same as --disable-perl
+AC_ARG_WITH([perl], AS_HELP_STRING([--with-perl=PATH],
+            [use the Perl interpreter located in PATH.  [default: autodetect]]),
+            [
+              case "${withval}" in
+                no) have_perl="no" ;;
+                yes) user_perl= ; have_perl= ;;
+                *) user_perl="${withval}"; have_perl= ;;
+              esac
+            ], [ user_perl=; have_perl= ])
+
+if test "x${have_perl}" != "xno"; then
+
+  dnl try to find a sufficiently new perl.
+  if test "x$user_perl" != "x"; then
+    AC_MSG_CHECKING([whether $user_perl version >= $first_perl])
+    GD_PERL_CHECK_VERSION([$user_perl], [$first_perl],
+    [AC_MSG_RESULT([yes])
+    PERL=$user_perl],
+    [AC_MSG_RESULT([no])
+    PERL="not found"])
+  else
+    AC_MSG_CHECKING([for Perl interpreter version >= $first_perl])
+    PERL="not found"
+    for perl in $perl_prog_list; do
+    _AS_PATH_WALK([$PATH],
+    [for exec_ext in '' $ac_executable_extensions; do
+      if AS_EXECUTABLE_P(["$as_dir/$perl$exec_ext"]); then
+        GD_PERL_CHECK_VERSION( ["$as_dir/$perl$exec_ext"],
+        [$first_perl], [ PERL="$as_dir/$perl$exec_ext"; break 3] )
+      fi
+    done])
+    done
+    AC_MSG_RESULT([$PERL])
+  fi
+
+  if test "x$PERL" = "xnot found"; then
+    have_perl="no"
+    PERL=
+  fi
+  AC_SUBST([PERL])
+
+  fi
+
+  if test "x${have_perl}" != "xno"; then
+  dnl perl version
+  AC_MSG_CHECKING([$PERL version])
+  GD_PERL_CONFIG([PERL_VERSION], [version])
+  AC_MSG_RESULT([$PERL_VERSION])
+
+fi
+
+AC_ARG_WITH([perl-dir], AS_HELP_STRING([--with-perl-dir=PATH],
+[ Install Perl bindings in PATH.  If PATH is the special word `vendor', install
+Perl bindings into the default vendor-specific module directory (if present).
+If PATH is the special word `site', install Perl bindings into the default
+site-specific module directory.  [default: site] ]),
+    [
+    case "${withval}" in
+    vendor|site) perl_inst_type="${withval}" ;;
+    no) perl_inst_type="site" ;;
+    *) perl_inst_type="local"; local_perl_path="${withval}" ;;
+    esac
+    ], [ perl_inst_type="site" ])
+
+if test "x${have_perl}" != "xno"; then
+  GD_PERL_CHECK_MODULE([Math::Complex])
+  GD_PERL_CHECK_MODULE([Module::Build])
+  GD_PERL_CHECK_MODULE([Test::Harness])
+fi
+
+if test "$HAVE_Math__Complex$HAVE_Module__Build" != "yesyes"; then
+  have_perl=no
+fi
+
+if test "x${have_perl}" != "xno"; then
+
+  dnl calculate the extension module directory
+  AC_MSG_CHECKING([Perl module directory])
+  if test $perl_inst_type = "vendor"; then
+    GD_PERL_CONFIG([perldir], [vendorarchexp])
+    GD_PERL_CONFIG([perlmandir], [vendorman3direxp])
+    if test perldir = "UNKNOWN"; then
+      perl_inst_type = "site";
+    fi
+  fi
+
+  if test $perl_inst_type = "site"; then
+    GD_PERL_CONFIG([perldir], [sitearchexp])
+    GD_PERL_CONFIG([perlmandir], [siteman3direxp])
+  elif test $perl_inst_type != "vendor"; then
+    perldir="${local_perl_path}"
+    perlmandir="${man3dir}"
+  fi
+
+  if test $perlmandir = "UNKNOWN"; then
+    perlmandir="${mandir}"
+  fi
+
+  AC_SUBST([perldir])
+  AC_MSG_RESULT([$perldir])
+
+  AC_MSG_CHECKING([Perl man directory])
+  AC_SUBST([perlmandir])
+  AC_MSG_RESULT([$perlmandir])
+
+  GD_PERL_MAN3EXT
+fi
+])
diff --git a/m4/python.m4 b/m4/python.m4
index fba7e1d..29d973c 100644
--- a/m4/python.m4
+++ b/m4/python.m4
@@ -26,9 +26,7 @@ AC_DEFUN([GD_PYTHON],
 last_python=2.7
 first_python=$1
 
-AC_CHECK_PROGS([SEQ], [seq], [not found])
 if test "x$SEQ" == "xnot found"; then
-  AC_CHECK_PROGS([JOT], [jot], [not found])
   if test "x$JOT" == "xnot found"; then
     python_prog_list="python python2"
   else
@@ -42,7 +40,7 @@ fi
 
 dnl --without-python basically does the same as --disable-python
 AC_ARG_WITH([python], AS_HELP_STRING([--with-python=PATH],
-            [use the Python interpreter located in PATH [autodetect]]),
+            [use the Python interpreter located in PATH [default: autodetect]]),
             [
               case "${withval}" in
                 no) have_python="no" ;;
@@ -52,7 +50,7 @@ AC_ARG_WITH([python], AS_HELP_STRING([--with-python=PATH],
             ], [ user_python=; have_python= ])
 
 AC_ARG_WITH([python-module-dir], AS_HELP_STRING([--with-python-module-dir=PATH],
-      [install the Python bindings into PATH [autodetect]]),
+      [install the Python bindings into PATH [default: autodetect]]),
       [
         case "${withval}" in
           no) local_python_modpath= ;;
diff --git a/m4/version.m4 b/m4/version.m4
index f81efbc..b6d6c1a 100644
--- a/m4/version.m4
+++ b/m4/version.m4
@@ -19,24 +19,27 @@ dnl along with GetData; if not, write to the Free Software Foundation, Inc.,
 dnl 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 
 m4_define(getdata_major,    0)
-m4_define(getdata_minor,    7)
-m4_define(getdata_revision, 3)
+m4_define(getdata_minor,    8)
+m4_define(getdata_revision, 5)
 m4_define(getdata_extra,    [])
 m4_define(getdata_version,
           getdata_major.getdata_minor.getdata_revision[]getdata_extra)
 
 dnl libgetdata current interface version
-m4_define(getdata_iface_version,    4)
+m4_define(getdata_iface_version,    6)
 dnl libgetdata current interface implementation revision
-m4_define(getdata_impl_revision,    3)
+m4_define(getdata_impl_revision,    4)
 dnl libgetdata interface age (current interface - oldest supported interface)
-m4_define(getdata_iface_age,        0)
+m4_define(getdata_iface_age,        1)
 
 dnl libgetdata++ interface version info
-m4_define(getdataxx_version, 2:0:0)
+m4_define(getdataxx_version, 5:0:2)
 
 dnl libfgetdata interface version info
-m4_define(fgetdata_version, 2:1:0)
+m4_define(fgetdata_version, 4:1:2)
 
 dnl libf95getdata interface version info
-m4_define(f95getdata_version, 2:0:0)
+m4_define(f95getdata_version, 5:0:3)
+
+dnl libgetdata-matlab interface version info
+m4_define(matlabgetdata_version, 0:1:0)
diff --git a/man/GD_SIZE.3 b/man/GD_SIZE.3
new file mode 100644
index 0000000..6818fe5
--- /dev/null
+++ b/man/GD_SIZE.3
@@ -0,0 +1,59 @@
+.\" GD_SIZE.3.  The GD_SIZE man page.
+.\"
+.\" Copyright (C) 2013 D. V. Wiebe
+.\"
+.\""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
+.\"
+.\" This file is part of the GetData project.
+.\"
+.\" Permission is granted to copy, distribute and/or modify this document
+.\" under the terms of the GNU Free Documentation License, Version 1.2 or
+.\" any later version published by the Free Software Foundation; with no
+.\" Invariant Sections, with no Front-Cover Texts, and with no Back-Cover
+.\" Texts.  A copy of the license is included in the `COPYING.DOC' file
+.\" as part of this distribution.
+.\"
+.TH GD_SIZE 3 "20 February 2013" "Version 0.8.3" "GETDATA"
+.SH NAME
+GD_SIZE \(em report the size of a GetData data sample
+.SH SYNOPSIS
+.B #include <getdata.h>
+.HP
+.nh
+.ad l
+.BI "int GD_SIZE(gd_type_t " type );
+.hy
+.ad n
+.SH DESCRIPTION
+The
+.BR GD_SIZE ()
+preprocessor macro returns the size (in bytes) of a single sample of data of the type
+specified by
+.IR type ,
+which should be one of the symbols
+.IP
+.nh
+.ad l
+.BR GD_NULL ", " GD_UINT8 ", " GD_INT8 ", " GD_UINT16 ", " GD_INT16 ,
+.BR GD_UINT32 ", " GD_INT32 ", " GD_FLOAT32 ", " GD_FLOAT64 ", " GD_COMPLEX64 ,
+.BR GD_COMPLEX128 ", " GD_UNKNOWN .
+.ad n
+.hy
+.PP
+Passing
+.B GD_NULL
+or
+.B GD_UNKNOWN
+to this macro will return zero.  For the other types, the value returned is simply the bit-size encoded
+in the type symbol divided by eight, so, e.g.,
+.B GD_SIZE(GD_COMPLEX64)
+will return 8.
+.PP
+No error checking is performed on
+.IR type :
+behaviour resulting from passing something other than the symbols listed above to this macro is unspecified.
+See
+.BR gd_getdata (3)
+for the meaning of the above symbols.
+.SH SEE ALSO
+.BR gd_getdata (3)
diff --git a/man/Makefile.am b/man/Makefile.am
index 5505910..5ad1224 100644
--- a/man/Makefile.am
+++ b/man/Makefile.am
@@ -20,77 +20,96 @@
 #
 AUTOMAKE_OPTIONS = foreign
 
-if LFS_TRANSITIONAL_API
-LFS_transitional_mans = gd_getdata64.3 gd_framenum_subset64.3 \
-												gd_frameoffset64.3 gd_nframes64.3 gd_putdata64.3
-MAN3ALIASES64=gd_frameoffset64.3:gd_alter_frameoffset64.3
-endif
-
 nodist_man_MANS = gd_alter_encoding.3 gd_alter_endianness.3 \
 											 gd_alter_frameoffset.3
-dist_man_MANS = checkdirfile.1 dirfile2ascii.1 gd_add.3 gd_add_bit.3 \
-								gd_add_spec.3 gd_alter_bit.3 gd_alter_entry.3 \
-								gd_alter_protection.3 gd_alter_spec.3 gd_bof.3 gd_carray_len.3 \
-								gd_carrays.3 gd_cbopen.3 gd_close.3 gd_get_carray_slice.3 \
-								gd_put_carray_slice.3 gd_get_constant.3 gd_put_constant.3 \
-								gd_constants.3 gd_dirfile_standards.3 gd_getdata.3 \
-								gd_putdata.3 gd_delete.3 gd_encoding.3 gd_endianness.3 \
-								gd_entry.3 gd_entry_type.3 gd_eof.3 gd_error.3 \
-								gd_error_string.3 gd_field_list.3 gd_field_list_by_type.3 \
-								gd_flush.3 gd_fragment_index.3 gd_fragmentname.3 \
-								gd_framenum_subset.3 gd_frameoffset.3 gd_free_entry_strings.3 \
-								gd_include.3 gd_invalid_dirfile.3 gd_madd_bit.3 gd_mcarrays.3 \
-								gd_mconstants.3 gd_metaflush.3 gd_mfield_list.3 \
-								gd_mfield_list_by_type.3 gd_move.3 gd_mstrings.3 \
-								gd_mvector_list.3 gd_dirfilename.3 gd_native_type.3 \
-								gd_nfields.3 gd_nfields_by_type.3 gd_nfragments.3 gd_nframes.3 \
-								gd_nmfields.3 gd_nmfields_by_type.3 gd_nmvectors.3 \
-								gd_nvectors.3 gd_parent_fragment.3 gd_parser_callback.3 \
-								gd_protection.3 gd_raw_filename.3 gd_reference.3 gd_rename.3 \
-								gd_rewrite_fragment.3 gd_spf.3 gd_get_string.3 gd_put_string.3 \
-								gd_strings.3 gd_uninclude.3 gd_validate.3 gd_vector_list.3 \
-								dirfile.5 dirfile-encoding.5 dirfile-format.5 \
-								$(LFS_transitional_mans)
+dist_man_MANS = checkdirfile.1 dirfile2ascii.1 gd_add.3 gd_add_alias.3 \
+								gd_add_bit.3 gd_add_spec.3 gd_alias_target.3 gd_aliases.3 \
+								gd_alter_affixes.3 gd_alter_bit.3 gd_alter_entry.3 \
+								gd_alter_protection.3 gd_alter_spec.3 gd_bof.3 gd_bof64.3 \
+								gd_carray_len.3 gd_carrays.3 gd_cbopen.3 gd_close.3 \
+								gd_constants.3 gd_delete.3 gd_desync.3 gd_dirfile_standards.3 \
+								gd_dirfilename.3 gd_encoding.3 gd_endianness.3 gd_entry.3 \
+								gd_entry_list.3 gd_entry_type.3 gd_eof.3 gd_eof64.3 gd_error.3 \
+								gd_error_count.3 gd_error_string.3 gd_flags.3 gd_flush.3 \
+								gd_fragment_affixes.3 gd_fragment_index.3 gd_fragmentname.3 \
+								gd_framenum_subset.3 gd_framenum_subset64.3 gd_frameoffset.3 \
+								gd_frameoffset64.3 gd_free_entry_strings.3 \
+								gd_get_carray_slice.3 gd_get_string.3 gd_getdata.3 \
+								gd_getdata64.3 gd_hidden.3 gd_hide.3 gd_include_affix.3 \
+								gd_invalid_dirfile.3 gd_linterp_tablename.3 gd_madd_bit.3 \
+								gd_mcarrays.3 gd_mconstants.3 gd_metaflush.3 gd_move.3 \
+								gd_mplex_lookback.3 gd_mstrings.3 gd_naliases.3 \
+								gd_native_type.3 gd_nentries.3 gd_nfragments.3 gd_nframes.3 \
+								gd_nframes64.3 gd_parent_fragment.3 gd_parser_callback.3 \
+								gd_protection.3 gd_put_carray_slice.3 \
+								gd_put_string.3 gd_putdata.3 gd_putdata64.3 gd_raw_filename.3 \
+								gd_reference.3 gd_rename.3 gd_rewrite_fragment.3 gd_seek.3 \
+								gd_seek64.3 gd_spf.3 gd_strings.3 gd_strtok.3 gd_tell.3 \
+								gd_tell64.3 gd_uninclude.3 gd_validate.3 gd_verbose_prefix.3 \
+								GD_SIZE.3 dirfile.5 dirfile-encoding.5 dirfile-format.5
 
+# these are real_file:alias
 MAN3ALIASES=gd_add_bit.3:gd_add_carray.3 gd_add_bit.3:gd_add_clincom.3 \
 	gd_add_bit.3:gd_add_const.3 gd_add_bit.3:gd_add_cpolynom.3 \
 	gd_add_bit.3:gd_add_crecip.3 gd_add_bit.3:gd_add_divide.3 \
 	gd_add_bit.3:gd_add_lincom.3 gd_add_bit.3:gd_add_linterp.3 \
-	gd_add_bit.3:gd_add_multiply.3 gd_add_bit.3:gd_add_polynom.3 \
-	gd_add_bit.3:gd_add_phase.3 gd_add_bit.3:gd_add_raw.3 \
-	gd_add_bit.3:gd_add_recip.3 gd_add_bit.3:gd_add_sbit.3 \
-	gd_add_bit.3:gd_add_string.3 gd_madd_bit.3:gd_madd_carray.3 \
-	gd_madd_bit.3:gd_madd_clincom.3 gd_madd_bit.3:gd_madd_const.3 \
-	gd_madd_bit.3:gd_madd_cpolynom.3 gd_madd_bit.3:gd_madd_crecip.3 \
-	gd_madd_bit.3:gd_madd_divide.3 gd_madd_bit.3:gd_madd_lincom.3 \
-	gd_madd_bit.3:gd_madd_linterp.3 gd_madd_bit.3:gd_madd_multiply.3 \
+	gd_add_bit.3:gd_add_mplex.3 gd_add_bit.3:gd_add_multiply.3 \
+	gd_add_bit.3:gd_add_polynom.3 gd_add_bit.3:gd_add_phase.3 \
+	gd_add_bit.3:gd_add_raw.3 gd_add_bit.3:gd_add_recip.3 \
+	gd_add_bit.3:gd_add_sbit.3 gd_add_bit.3:gd_add_string.3 \
+	gd_add_bit.3:gd_add_window.3 \
+	gd_madd_bit.3:gd_madd_carray.3 gd_madd_bit.3:gd_madd_clincom.3 \
+	gd_madd_bit.3:gd_madd_const.3 gd_madd_bit.3:gd_madd_cpolynom.3 \
+	gd_madd_bit.3:gd_madd_crecip.3 gd_madd_bit.3:gd_madd_divide.3 \
+	gd_madd_bit.3:gd_madd_lincom.3 gd_madd_bit.3:gd_madd_linterp.3 \
+	gd_madd_bit.3:gd_madd_mplex.3 gd_madd_bit.3:gd_madd_multiply.3 \
 	gd_madd_bit.3:gd_madd_phase.3 gd_madd_bit.3:gd_madd_polynom.3 \
 	gd_madd_bit.3:gd_madd_recip.3 gd_madd_bit.3:gd_madd_sbit.3 \
-	gd_madd_bit.3:gd_madd_string.3 gd_add.3:gd_madd.3 \
-	gd_add_spec.3:gd_madd_spec.3 gd_cbopen.3:gd_open.3 \
-	gd_close.3:gd_discard.3 gd_alter_bit.3:gd_alter_carray.3 \
-	gd_alter_bit.3:gd_alter_clincom.3 gd_alter_bit.3:gd_alter_const.3 \
-	gd_alter_bit.3:gd_alter_cpolynom.3 gd_alter_bit.3:gd_alter_crecip.3 \
-	gd_alter_bit.3:gd_alter_divide.3 gd_alter_bit.3:gd_alter_lincom.3 \
-	gd_alter_bit.3:gd_alter_linterp.3 gd_alter_bit.3:gd_alter_multiply.3 \
+	gd_madd_bit.3:gd_madd_string.3 gd_madd_bit.3:gd_madd_window.3 \
+	gd_add.3:gd_madd.3 \
+	gd_add_spec.3:gd_madd_spec.3 \
+	gd_cbopen.3:gd_open.3 \
+	gd_close.3:gd_discard.3 \
+	gd_include_affix.3:gd_include.3 \
+	gd_alter_bit.3:gd_alter_carray.3 gd_alter_bit.3:gd_alter_clincom.3 \
+	gd_alter_bit.3:gd_alter_const.3 gd_alter_bit.3:gd_alter_cpolynom.3 \
+	gd_alter_bit.3:gd_alter_crecip.3 gd_alter_bit.3:gd_alter_divide.3 \
+	gd_alter_bit.3:gd_alter_lincom.3 gd_alter_bit.3:gd_alter_linterp.3 \
+	gd_alter_bit.3:gd_alter_mplex.3 gd_alter_bit.3:gd_alter_multiply.3 \
 	gd_alter_bit.3:gd_alter_phase.3 gd_alter_bit.3:gd_alter_polynom.3 \
 	gd_alter_bit.3:gd_alter_recip.3 gd_alter_bit.3:gd_alter_raw.3 \
-	gd_alter_bit.3:gd_alter_sbit.3 gd_alter_spec.3:gd_malter_spec.3 \
-	gd_framenum_subset.3:gd_framenum.3 gd_get_carray_slice.3:gd_get_carray.3 \
-	gd_put_carray_slice.3:gd_put_carray.3 $(MAN3ALIASES64)
+	gd_alter_bit.3:gd_alter_sbit.3 gd_alter_bit.3:gd_alter_window.3 \
+	gd_alter_spec.3:gd_malter_spec.3 \
+	gd_framenum_subset.3:gd_framenum.3 \
+	gd_get_carray_slice.3:gd_get_carray.3 \
+	gd_get_carray_slice.3:gd_get_constant.3 \
+	gd_put_carray_slice.3:gd_put_carray.3 \
+	gd_put_carray_slice.3:gd_put_constant.3 \
+	gd_delete.3:gd_delete_alias.3 \
+	gd_move.3:gd_move_alias.3 \
+	gd_hide.3:gd_unhide.3 \
+	gd_add_alias.3:gd_madd_alias.3 \
+	gd_flush.3:gd_sync.3 gd_flush.3:gd_raw_close.3 \
+	gd_nentries.3:gd_nfields.3 gd_nentries.3:gd_nfields_by_type.3 \
+	gd_nentries.3:gd_nmfields.3 gd_nentries.3:gd_nmfields_by_type.3 \
+	gd_nentries.3:gd_nmvectore.3 gd_nentries.3:gd_nvectors.3 \
+	gd_entry_list.3:gd_field_list.3 gd_entry_list.3:gd_field_list_by_type.3 \
+	gd_entry_list.3:gd_mfield_list.3 gd_entry_list.3:gd_mfield_list_by_type.3 \
+	gd_entry_list.3:gd_nmvectore.3 gd_entry_list.3:gd_vector_list.3 \
+	gd_frameoffset64.3:gd_alter_frameoffset64.3
 
 #man conversion
-HTMLMANS=$(addsuffix .html,$(nodist_man_MANS)) \
-				 $(addsuffix .html,$(dist_man_MANS))
+HTMLMANS=$(addsuffix .html,${nodist_man_MANS}) \
+				 $(addsuffix .html,${dist_man_MANS})
 
-%.html: %
-	man2html -r $< | tail -n +2 | $(SED) -e 's/~/\ /g' > $@
+%.html: % make_html.pl
+	./make_html.pl $< > $@
 
 htmlman: $(HTMLMANS)
 	for m in $(MAN3ALIASES); do \
-		rm -f `echo $$m | $(SED) -e 's/3/3.html/g' | $(SED) -e 's/.*://'`; \
-		$(LN_S) `echo $$m | $(SED) -e 's/3/3.html/g' | $(SED) -e 's/:/ /'`; \
-		done
+		./make_html.pl `echo $$m | $(SED) -e 's/:\\(.*\\).3/ \\1/'` \
+			> `echo $$m | $(SED) -e 's/3/3.html/g' | $(SED) -e 's/.*://'`; \
+	 done
 
 install-data-hook:
 	cd $(DESTDIR)$(mandir)/man3 && \
diff --git a/man/Makefile.in b/man/Makefile.in
index 7f60b30..bdd362f 100644
--- a/man/Makefile.in
+++ b/man/Makefile.in
@@ -1,9 +1,9 @@
-# Makefile.in generated by automake 1.11.1 from Makefile.am.
+# Makefile.in generated by automake 1.11.5 from Makefile.am.
 # @configure_input@
 
 # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005, 2006, 2007, 2008, 2009  Free Software Foundation,
-# Inc.
+# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software
+# Foundation, Inc.
 # This Makefile.in is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
@@ -15,6 +15,23 @@
 
 @SET_MAKE@
 VPATH = @srcdir@
+am__make_dryrun = \
+  { \
+    am__dry=no; \
+    case $$MAKEFLAGS in \
+      *\\[\ \	]*) \
+        echo 'am--echo: ; @echo "AM"  OK' | $(MAKE) -f - 2>/dev/null \
+          | grep '^AM OK$$' >/dev/null || am__dry=yes;; \
+      *) \
+        for am__flg in $$MAKEFLAGS; do \
+          case $$am__flg in \
+            *=*|--*) ;; \
+            *n*) am__dry=yes; break;; \
+          esac; \
+        done;; \
+    esac; \
+    test $$am__dry = yes; \
+  }
 pkgdatadir = $(datadir)/@PACKAGE@
 pkgincludedir = $(includedir)/@PACKAGE@
 pkglibdir = $(libdir)/@PACKAGE@
@@ -41,21 +58,28 @@ DIST_COMMON = $(dist_man_MANS) $(srcdir)/Makefile.am \
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
 am__aclocal_m4_deps = $(top_srcdir)/m4/ax_compare_version.m4 \
 	$(top_srcdir)/m4/compiler.m4 $(top_srcdir)/m4/encoding.m4 \
-	$(top_srcdir)/m4/idl.m4 $(top_srcdir)/m4/libtool.m4 \
-	$(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \
-	$(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \
-	$(top_srcdir)/m4/python.m4 $(top_srcdir)/m4/win32.m4 \
-	$(top_srcdir)/m4/version.m4 $(top_srcdir)/configure.ac
+	$(top_srcdir)/m4/floatordering.m4 $(top_srcdir)/m4/idl.m4 \
+	$(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \
+	$(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \
+	$(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/m4/matlab.m4 \
+	$(top_srcdir)/m4/perl.m4 $(top_srcdir)/m4/python.m4 \
+	$(top_srcdir)/m4/win32.m4 $(top_srcdir)/m4/version.m4 \
+	$(top_srcdir)/configure.ac
 am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
 	$(ACLOCAL_M4)
 mkinstalldirs = $(install_sh) -d
-CONFIG_HEADER = $(top_builddir)/src/config.h \
+CONFIG_HEADER = $(top_builddir)/src/gd_config.h \
 	$(top_builddir)/src/getdata.h
 CONFIG_CLEAN_FILES = gd_alter_encoding.3 gd_alter_endianness.3 \
 	gd_alter_frameoffset.3
 CONFIG_CLEAN_VPATH_FILES =
 SOURCES =
 DIST_SOURCES =
+am__can_run_installinfo = \
+  case $$AM_UPDATE_INFO_DIR in \
+    n|no|NO) false;; \
+    *) (install-info --version) >/dev/null 2>&1;; \
+  esac
 am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
 am__vpath_adj = case $$p in \
     $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
@@ -77,6 +101,12 @@ am__nobase_list = $(am__nobase_strip_setup); \
 am__base_list = \
   sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \
   sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
+am__uninstall_files_from_dir = { \
+  test -z "$$files" \
+    || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \
+    || { echo " ( cd '$$dir' && rm -f" $$files ")"; \
+         $(am__cd) "$$dir" && rm -f $$files; }; \
+  }
 man1dir = $(mandir)/man1
 am__installdirs = "$(DESTDIR)$(man1dir)" "$(DESTDIR)$(man3dir)" \
 	"$(DESTDIR)$(man5dir)"
@@ -93,10 +123,13 @@ AUTOHEADER = @AUTOHEADER@
 AUTOMAKE = @AUTOMAKE@
 AWK = @AWK@
 BUILDCC = @BUILDCC@
-BUILD_DATE = @BUILD_DATE@
 BZIP2_CPPFLAGS = @BZIP2_CPPFLAGS@
 BZIP2_LDFLAGS = @BZIP2_LDFLAGS@
+BZIP2_LIBS = @BZIP2_LIBS@
 CC = @CC@
+CCAS = @CCAS@
+CCASDEPMODE = @CCASDEPMODE@
+CCASFLAGS = @CCASFLAGS@
 CCDEPMODE = @CCDEPMODE@
 CFLAGS = @CFLAGS@
 CPP = @CPP@
@@ -112,6 +145,7 @@ DEFINE_GD_NO_C99_API = @DEFINE_GD_NO_C99_API@
 DEFINE_gd_int16_t = @DEFINE_gd_int16_t@
 DEFINE_gd_int64_t = @DEFINE_gd_int64_t@
 DEFINE_gd_uint16_t = @DEFINE_gd_uint16_t@
+DEFINE_gd_uint64_t = @DEFINE_gd_uint64_t@
 DEFS = @DEFS@
 DEPDIR = @DEPDIR@
 DIFF = @DIFF@
@@ -132,13 +166,21 @@ FFLAGS = @FFLAGS@
 FGETDATA_VERSION = @FGETDATA_VERSION@
 FGREP = @FGREP@
 FLIBS = @FLIBS@
+GD_DIRSEP = @GD_DIRSEP@
+GD_FDIRSEP = @GD_FDIRSEP@
 GETDATAXX_VERSION = @GETDATAXX_VERSION@
+GETDATA_DEBUG = @GETDATA_DEBUG@
 GETDATA_IFACE_AGE = @GETDATA_IFACE_AGE@
 GETDATA_IFACE_VERSION = @GETDATA_IFACE_VERSION@
 GETDATA_IMPL_REVISION = @GETDATA_IMPL_REVISION@
+GETDATA_MAJOR = @GETDATA_MAJOR@
+GETDATA_MINOR = @GETDATA_MINOR@
+GETDATA_REVISION = @GETDATA_REVISION@
+GETDATA_VERSION_SUFFIX = @GETDATA_VERSION_SUFFIX@
 GREP = @GREP@
 GZIP_CPPFLAGS = @GZIP_CPPFLAGS@
 GZIP_LDFLAGS = @GZIP_LDFLAGS@
+GZIP_LIBS = @GZIP_LIBS@
 IDL = @IDL@
 IDL_CFLAGS = @IDL_CFLAGS@
 IDL_LIBS = @IDL_LIBS@
@@ -161,8 +203,13 @@ LTDLINCL = @LTDLINCL@
 LTLIBOBJS = @LTLIBOBJS@
 LZMA_CPPFLAGS = @LZMA_CPPFLAGS@
 LZMA_LDFLAGS = @LZMA_LDFLAGS@
+LZMA_LIBS = @LZMA_LIBS@
 MAKEINFO = @MAKEINFO@
 MANIFEST_TOOL = @MANIFEST_TOOL@
+MATLAB = @MATLAB@
+MATLABGETDATA_VERSION = @MATLABGETDATA_VERSION@
+MATLAB_CPPFLAGS = @MATLAB_CPPFLAGS@
+MEX = @MEX@
 MKDIR_P = @MKDIR_P@
 NM = @NM@
 NMEDIT = @NMEDIT@
@@ -179,6 +226,9 @@ PACKAGE_TARNAME = @PACKAGE_TARNAME@
 PACKAGE_URL = @PACKAGE_URL@
 PACKAGE_VERSION = @PACKAGE_VERSION@
 PATH_SEPARATOR = @PATH_SEPARATOR@
+PERL = @PERL@
+PERL_MAN3EXT = @PERL_MAN3EXT@
+PRINTF = @PRINTF@
 PRIVATE_LIBS = @PRIVATE_LIBS@
 PYTHON = @PYTHON@
 PYTHON_CPPFLAGS = @PYTHON_CPPFLAGS@
@@ -190,8 +240,12 @@ SET_MAKE = @SET_MAKE@
 SHELL = @SHELL@
 SLIM_CPPFLAGS = @SLIM_CPPFLAGS@
 SLIM_LDFLAGS = @SLIM_LDFLAGS@
+SLIM_LIBS = @SLIM_LIBS@
 STRIP = @STRIP@
 VERSION = @VERSION@
+ZZIP_CPPFLAGS = @ZZIP_CPPFLAGS@
+ZZIP_LDFLAGS = @ZZIP_LDFLAGS@
+ZZIP_LIBS = @ZZIP_LIBS@
 abs_builddir = @abs_builddir@
 abs_srcdir = @abs_srcdir@
 abs_top_builddir = @abs_top_builddir@
@@ -235,6 +289,8 @@ libexecdir = @libexecdir@
 localedir = @localedir@
 localstatedir = @localstatedir@
 mandir = @mandir@
+matlabbasedir = @matlabbasedir@
+mexext = @mexext@
 mkdir_p = @mkdir_p@
 moduledir = @moduledir@
 oldincludedir = @oldincludedir@
@@ -244,8 +300,12 @@ path_gunzip = @path_gunzip@
 path_gzip = @path_gzip@
 path_slim = @path_slim@
 path_unslim = @path_unslim@
+path_unzip = @path_unzip@
 path_xz = @path_xz@
+path_zip = @path_zip@
 pdfdir = @pdfdir@
+perldir = @perldir@
+perlmandir = @perlmandir@
 prefix = @prefix@
 program_transform_name = @program_transform_name@
 psdir = @psdir@
@@ -280,68 +340,90 @@ top_srcdir = @top_srcdir@
 # 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 #
 AUTOMAKE_OPTIONS = foreign
- at LFS_TRANSITIONAL_API_TRUE@LFS_transitional_mans = gd_getdata64.3 gd_framenum_subset64.3 \
- at LFS_TRANSITIONAL_API_TRUE@												gd_frameoffset64.3 gd_nframes64.3 gd_putdata64.3
-
- at LFS_TRANSITIONAL_API_TRUE@MAN3ALIASES64 = gd_frameoffset64.3:gd_alter_frameoffset64.3
 nodist_man_MANS = gd_alter_encoding.3 gd_alter_endianness.3 \
 											 gd_alter_frameoffset.3
 
-dist_man_MANS = checkdirfile.1 dirfile2ascii.1 gd_add.3 gd_add_bit.3 \
-								gd_add_spec.3 gd_alter_bit.3 gd_alter_entry.3 \
-								gd_alter_protection.3 gd_alter_spec.3 gd_bof.3 gd_carray_len.3 \
-								gd_carrays.3 gd_cbopen.3 gd_close.3 gd_get_carray_slice.3 \
-								gd_put_carray_slice.3 gd_get_constant.3 gd_put_constant.3 \
-								gd_constants.3 gd_dirfile_standards.3 gd_getdata.3 \
-								gd_putdata.3 gd_delete.3 gd_encoding.3 gd_endianness.3 \
-								gd_entry.3 gd_entry_type.3 gd_eof.3 gd_error.3 \
-								gd_error_string.3 gd_field_list.3 gd_field_list_by_type.3 \
-								gd_flush.3 gd_fragment_index.3 gd_fragmentname.3 \
-								gd_framenum_subset.3 gd_frameoffset.3 gd_free_entry_strings.3 \
-								gd_include.3 gd_invalid_dirfile.3 gd_madd_bit.3 gd_mcarrays.3 \
-								gd_mconstants.3 gd_metaflush.3 gd_mfield_list.3 \
-								gd_mfield_list_by_type.3 gd_move.3 gd_mstrings.3 \
-								gd_mvector_list.3 gd_dirfilename.3 gd_native_type.3 \
-								gd_nfields.3 gd_nfields_by_type.3 gd_nfragments.3 gd_nframes.3 \
-								gd_nmfields.3 gd_nmfields_by_type.3 gd_nmvectors.3 \
-								gd_nvectors.3 gd_parent_fragment.3 gd_parser_callback.3 \
-								gd_protection.3 gd_raw_filename.3 gd_reference.3 gd_rename.3 \
-								gd_rewrite_fragment.3 gd_spf.3 gd_get_string.3 gd_put_string.3 \
-								gd_strings.3 gd_uninclude.3 gd_validate.3 gd_vector_list.3 \
-								dirfile.5 dirfile-encoding.5 dirfile-format.5 \
-								$(LFS_transitional_mans)
-
+dist_man_MANS = checkdirfile.1 dirfile2ascii.1 gd_add.3 gd_add_alias.3 \
+								gd_add_bit.3 gd_add_spec.3 gd_alias_target.3 gd_aliases.3 \
+								gd_alter_affixes.3 gd_alter_bit.3 gd_alter_entry.3 \
+								gd_alter_protection.3 gd_alter_spec.3 gd_bof.3 gd_bof64.3 \
+								gd_carray_len.3 gd_carrays.3 gd_cbopen.3 gd_close.3 \
+								gd_constants.3 gd_delete.3 gd_desync.3 gd_dirfile_standards.3 \
+								gd_dirfilename.3 gd_encoding.3 gd_endianness.3 gd_entry.3 \
+								gd_entry_list.3 gd_entry_type.3 gd_eof.3 gd_eof64.3 gd_error.3 \
+								gd_error_count.3 gd_error_string.3 gd_flags.3 gd_flush.3 \
+								gd_fragment_affixes.3 gd_fragment_index.3 gd_fragmentname.3 \
+								gd_framenum_subset.3 gd_framenum_subset64.3 gd_frameoffset.3 \
+								gd_frameoffset64.3 gd_free_entry_strings.3 \
+								gd_get_carray_slice.3 gd_get_string.3 gd_getdata.3 \
+								gd_getdata64.3 gd_hidden.3 gd_hide.3 gd_include_affix.3 \
+								gd_invalid_dirfile.3 gd_linterp_tablename.3 gd_madd_bit.3 \
+								gd_mcarrays.3 gd_mconstants.3 gd_metaflush.3 gd_move.3 \
+								gd_mplex_lookback.3 gd_mstrings.3 gd_naliases.3 \
+								gd_native_type.3 gd_nentries.3 gd_nfragments.3 gd_nframes.3 \
+								gd_nframes64.3 gd_parent_fragment.3 gd_parser_callback.3 \
+								gd_protection.3 gd_put_carray_slice.3 \
+								gd_put_string.3 gd_putdata.3 gd_putdata64.3 gd_raw_filename.3 \
+								gd_reference.3 gd_rename.3 gd_rewrite_fragment.3 gd_seek.3 \
+								gd_seek64.3 gd_spf.3 gd_strings.3 gd_strtok.3 gd_tell.3 \
+								gd_tell64.3 gd_uninclude.3 gd_validate.3 gd_verbose_prefix.3 \
+								GD_SIZE.3 dirfile.5 dirfile-encoding.5 dirfile-format.5
+
+
+# these are real_file:alias
 MAN3ALIASES = gd_add_bit.3:gd_add_carray.3 gd_add_bit.3:gd_add_clincom.3 \
 	gd_add_bit.3:gd_add_const.3 gd_add_bit.3:gd_add_cpolynom.3 \
 	gd_add_bit.3:gd_add_crecip.3 gd_add_bit.3:gd_add_divide.3 \
 	gd_add_bit.3:gd_add_lincom.3 gd_add_bit.3:gd_add_linterp.3 \
-	gd_add_bit.3:gd_add_multiply.3 gd_add_bit.3:gd_add_polynom.3 \
-	gd_add_bit.3:gd_add_phase.3 gd_add_bit.3:gd_add_raw.3 \
-	gd_add_bit.3:gd_add_recip.3 gd_add_bit.3:gd_add_sbit.3 \
-	gd_add_bit.3:gd_add_string.3 gd_madd_bit.3:gd_madd_carray.3 \
-	gd_madd_bit.3:gd_madd_clincom.3 gd_madd_bit.3:gd_madd_const.3 \
-	gd_madd_bit.3:gd_madd_cpolynom.3 gd_madd_bit.3:gd_madd_crecip.3 \
-	gd_madd_bit.3:gd_madd_divide.3 gd_madd_bit.3:gd_madd_lincom.3 \
-	gd_madd_bit.3:gd_madd_linterp.3 gd_madd_bit.3:gd_madd_multiply.3 \
+	gd_add_bit.3:gd_add_mplex.3 gd_add_bit.3:gd_add_multiply.3 \
+	gd_add_bit.3:gd_add_polynom.3 gd_add_bit.3:gd_add_phase.3 \
+	gd_add_bit.3:gd_add_raw.3 gd_add_bit.3:gd_add_recip.3 \
+	gd_add_bit.3:gd_add_sbit.3 gd_add_bit.3:gd_add_string.3 \
+	gd_add_bit.3:gd_add_window.3 \
+	gd_madd_bit.3:gd_madd_carray.3 gd_madd_bit.3:gd_madd_clincom.3 \
+	gd_madd_bit.3:gd_madd_const.3 gd_madd_bit.3:gd_madd_cpolynom.3 \
+	gd_madd_bit.3:gd_madd_crecip.3 gd_madd_bit.3:gd_madd_divide.3 \
+	gd_madd_bit.3:gd_madd_lincom.3 gd_madd_bit.3:gd_madd_linterp.3 \
+	gd_madd_bit.3:gd_madd_mplex.3 gd_madd_bit.3:gd_madd_multiply.3 \
 	gd_madd_bit.3:gd_madd_phase.3 gd_madd_bit.3:gd_madd_polynom.3 \
 	gd_madd_bit.3:gd_madd_recip.3 gd_madd_bit.3:gd_madd_sbit.3 \
-	gd_madd_bit.3:gd_madd_string.3 gd_add.3:gd_madd.3 \
-	gd_add_spec.3:gd_madd_spec.3 gd_cbopen.3:gd_open.3 \
-	gd_close.3:gd_discard.3 gd_alter_bit.3:gd_alter_carray.3 \
-	gd_alter_bit.3:gd_alter_clincom.3 gd_alter_bit.3:gd_alter_const.3 \
-	gd_alter_bit.3:gd_alter_cpolynom.3 gd_alter_bit.3:gd_alter_crecip.3 \
-	gd_alter_bit.3:gd_alter_divide.3 gd_alter_bit.3:gd_alter_lincom.3 \
-	gd_alter_bit.3:gd_alter_linterp.3 gd_alter_bit.3:gd_alter_multiply.3 \
+	gd_madd_bit.3:gd_madd_string.3 gd_madd_bit.3:gd_madd_window.3 \
+	gd_add.3:gd_madd.3 \
+	gd_add_spec.3:gd_madd_spec.3 \
+	gd_cbopen.3:gd_open.3 \
+	gd_close.3:gd_discard.3 \
+	gd_include_affix.3:gd_include.3 \
+	gd_alter_bit.3:gd_alter_carray.3 gd_alter_bit.3:gd_alter_clincom.3 \
+	gd_alter_bit.3:gd_alter_const.3 gd_alter_bit.3:gd_alter_cpolynom.3 \
+	gd_alter_bit.3:gd_alter_crecip.3 gd_alter_bit.3:gd_alter_divide.3 \
+	gd_alter_bit.3:gd_alter_lincom.3 gd_alter_bit.3:gd_alter_linterp.3 \
+	gd_alter_bit.3:gd_alter_mplex.3 gd_alter_bit.3:gd_alter_multiply.3 \
 	gd_alter_bit.3:gd_alter_phase.3 gd_alter_bit.3:gd_alter_polynom.3 \
 	gd_alter_bit.3:gd_alter_recip.3 gd_alter_bit.3:gd_alter_raw.3 \
-	gd_alter_bit.3:gd_alter_sbit.3 gd_alter_spec.3:gd_malter_spec.3 \
-	gd_framenum_subset.3:gd_framenum.3 gd_get_carray_slice.3:gd_get_carray.3 \
-	gd_put_carray_slice.3:gd_put_carray.3 $(MAN3ALIASES64)
+	gd_alter_bit.3:gd_alter_sbit.3 gd_alter_bit.3:gd_alter_window.3 \
+	gd_alter_spec.3:gd_malter_spec.3 \
+	gd_framenum_subset.3:gd_framenum.3 \
+	gd_get_carray_slice.3:gd_get_carray.3 \
+	gd_get_carray_slice.3:gd_get_constant.3 \
+	gd_put_carray_slice.3:gd_put_carray.3 \
+	gd_put_carray_slice.3:gd_put_constant.3 \
+	gd_delete.3:gd_delete_alias.3 \
+	gd_move.3:gd_move_alias.3 \
+	gd_hide.3:gd_unhide.3 \
+	gd_add_alias.3:gd_madd_alias.3 \
+	gd_flush.3:gd_sync.3 gd_flush.3:gd_raw_close.3 \
+	gd_nentries.3:gd_nfields.3 gd_nentries.3:gd_nfields_by_type.3 \
+	gd_nentries.3:gd_nmfields.3 gd_nentries.3:gd_nmfields_by_type.3 \
+	gd_nentries.3:gd_nmvectore.3 gd_nentries.3:gd_nvectors.3 \
+	gd_entry_list.3:gd_field_list.3 gd_entry_list.3:gd_field_list_by_type.3 \
+	gd_entry_list.3:gd_mfield_list.3 gd_entry_list.3:gd_mfield_list_by_type.3 \
+	gd_entry_list.3:gd_nmvectore.3 gd_entry_list.3:gd_vector_list.3 \
+	gd_frameoffset64.3:gd_alter_frameoffset64.3
 
 
 #man conversion
-HTMLMANS = $(addsuffix .html,$(nodist_man_MANS)) \
-				 $(addsuffix .html,$(dist_man_MANS))
+HTMLMANS = $(addsuffix .html,${nodist_man_MANS}) \
+				 $(addsuffix .html,${dist_man_MANS})
 
 all: all-am
 
@@ -390,11 +472,18 @@ clean-libtool:
 	-rm -rf .libs _libs
 install-man1: $(dist_man_MANS) $(nodist_man_MANS)
 	@$(NORMAL_INSTALL)
-	test -z "$(man1dir)" || $(MKDIR_P) "$(DESTDIR)$(man1dir)"
-	@list=''; test -n "$(man1dir)" || exit 0; \
-	{ for i in $$list; do echo "$$i"; done; \
-	l2='$(dist_man_MANS) $(nodist_man_MANS)'; for i in $$l2; do echo "$$i"; done | \
-	  sed -n '/\.1[a-z]*$$/p'; \
+	@list1=''; \
+	list2='$(dist_man_MANS) $(nodist_man_MANS)'; \
+	test -n "$(man1dir)" \
+	  && test -n "`echo $$list1$$list2`" \
+	  || exit 0; \
+	echo " $(MKDIR_P) '$(DESTDIR)$(man1dir)'"; \
+	$(MKDIR_P) "$(DESTDIR)$(man1dir)" || exit 1; \
+	{ for i in $$list1; do echo "$$i"; done;  \
+	if test -n "$$list2"; then \
+	  for i in $$list2; do echo "$$i"; done \
+	    | sed -n '/\.1[a-z]*$$/p'; \
+	fi; \
 	} | while read p; do \
 	  if test -f $$p; then d=; else d="$(srcdir)/"; fi; \
 	  echo "$$d$$p"; echo "$$p"; \
@@ -423,16 +512,21 @@ uninstall-man1:
 	  sed -n '/\.1[a-z]*$$/p'; \
 	} | sed -e 's,.*/,,;h;s,.*\.,,;s,^[^1][0-9a-z]*$$,1,;x' \
 	      -e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,'`; \
-	test -z "$$files" || { \
-	  echo " ( cd '$(DESTDIR)$(man1dir)' && rm -f" $$files ")"; \
-	  cd "$(DESTDIR)$(man1dir)" && rm -f $$files; }
+	dir='$(DESTDIR)$(man1dir)'; $(am__uninstall_files_from_dir)
 install-man3: $(dist_man_MANS) $(nodist_man_MANS)
 	@$(NORMAL_INSTALL)
-	test -z "$(man3dir)" || $(MKDIR_P) "$(DESTDIR)$(man3dir)"
-	@list=''; test -n "$(man3dir)" || exit 0; \
-	{ for i in $$list; do echo "$$i"; done; \
-	l2='$(dist_man_MANS) $(nodist_man_MANS)'; for i in $$l2; do echo "$$i"; done | \
-	  sed -n '/\.3[a-z]*$$/p'; \
+	@list1=''; \
+	list2='$(dist_man_MANS) $(nodist_man_MANS)'; \
+	test -n "$(man3dir)" \
+	  && test -n "`echo $$list1$$list2`" \
+	  || exit 0; \
+	echo " $(MKDIR_P) '$(DESTDIR)$(man3dir)'"; \
+	$(MKDIR_P) "$(DESTDIR)$(man3dir)" || exit 1; \
+	{ for i in $$list1; do echo "$$i"; done;  \
+	if test -n "$$list2"; then \
+	  for i in $$list2; do echo "$$i"; done \
+	    | sed -n '/\.3[a-z]*$$/p'; \
+	fi; \
 	} | while read p; do \
 	  if test -f $$p; then d=; else d="$(srcdir)/"; fi; \
 	  echo "$$d$$p"; echo "$$p"; \
@@ -461,16 +555,21 @@ uninstall-man3:
 	  sed -n '/\.3[a-z]*$$/p'; \
 	} | sed -e 's,.*/,,;h;s,.*\.,,;s,^[^3][0-9a-z]*$$,3,;x' \
 	      -e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,'`; \
-	test -z "$$files" || { \
-	  echo " ( cd '$(DESTDIR)$(man3dir)' && rm -f" $$files ")"; \
-	  cd "$(DESTDIR)$(man3dir)" && rm -f $$files; }
+	dir='$(DESTDIR)$(man3dir)'; $(am__uninstall_files_from_dir)
 install-man5: $(dist_man_MANS) $(nodist_man_MANS)
 	@$(NORMAL_INSTALL)
-	test -z "$(man5dir)" || $(MKDIR_P) "$(DESTDIR)$(man5dir)"
-	@list=''; test -n "$(man5dir)" || exit 0; \
-	{ for i in $$list; do echo "$$i"; done; \
-	l2='$(dist_man_MANS) $(nodist_man_MANS)'; for i in $$l2; do echo "$$i"; done | \
-	  sed -n '/\.5[a-z]*$$/p'; \
+	@list1=''; \
+	list2='$(dist_man_MANS) $(nodist_man_MANS)'; \
+	test -n "$(man5dir)" \
+	  && test -n "`echo $$list1$$list2`" \
+	  || exit 0; \
+	echo " $(MKDIR_P) '$(DESTDIR)$(man5dir)'"; \
+	$(MKDIR_P) "$(DESTDIR)$(man5dir)" || exit 1; \
+	{ for i in $$list1; do echo "$$i"; done;  \
+	if test -n "$$list2"; then \
+	  for i in $$list2; do echo "$$i"; done \
+	    | sed -n '/\.5[a-z]*$$/p'; \
+	fi; \
 	} | while read p; do \
 	  if test -f $$p; then d=; else d="$(srcdir)/"; fi; \
 	  echo "$$d$$p"; echo "$$p"; \
@@ -499,9 +598,7 @@ uninstall-man5:
 	  sed -n '/\.5[a-z]*$$/p'; \
 	} | sed -e 's,.*/,,;h;s,.*\.,,;s,^[^5][0-9a-z]*$$,5,;x' \
 	      -e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,'`; \
-	test -z "$$files" || { \
-	  echo " ( cd '$(DESTDIR)$(man5dir)' && rm -f" $$files ")"; \
-	  cd "$(DESTDIR)$(man5dir)" && rm -f $$files; }
+	dir='$(DESTDIR)$(man5dir)'; $(am__uninstall_files_from_dir)
 tags: TAGS
 TAGS:
 
@@ -569,10 +666,15 @@ install-am: all-am
 
 installcheck: installcheck-am
 install-strip:
-	$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
-	  install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
-	  `test -z '$(STRIP)' || \
-	    echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+	if test -z '$(STRIP)'; then \
+	  $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+	    install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+	      install; \
+	else \
+	  $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+	    install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+	    "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
+	fi
 mostlyclean-generic:
 
 clean-generic:
@@ -671,14 +773,14 @@ uninstall-man: uninstall-man1 uninstall-man3 uninstall-man5
 	uninstall-man5
 
 
-%.html: %
-	man2html -r $< | tail -n +2 | $(SED) -e 's/~/\ /g' > $@
+%.html: % make_html.pl
+	./make_html.pl $< > $@
 
 htmlman: $(HTMLMANS)
 	for m in $(MAN3ALIASES); do \
-		rm -f `echo $$m | $(SED) -e 's/3/3.html/g' | $(SED) -e 's/.*://'`; \
-		$(LN_S) `echo $$m | $(SED) -e 's/3/3.html/g' | $(SED) -e 's/:/ /'`; \
-		done
+		./make_html.pl `echo $$m | $(SED) -e 's/:\\(.*\\).3/ \\1/'` \
+			> `echo $$m | $(SED) -e 's/3/3.html/g' | $(SED) -e 's/.*://'`; \
+	 done
 
 install-data-hook:
 	cd $(DESTDIR)$(mandir)/man3 && \
diff --git a/man/checkdirfile.1 b/man/checkdirfile.1
index 63c0967..0a66635 100644
--- a/man/checkdirfile.1
+++ b/man/checkdirfile.1
@@ -1,6 +1,6 @@
 .\" checkdirfile.1.  The checkdirfile man page.
 .\"
-.\" Copyright (C) 2010 D. V. Wiebe
+.\" Copyright (C) 2010, 2012 D. V. Wiebe
 .\"
 .\""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
 .\"
@@ -13,7 +13,7 @@
 .\" Texts.  A copy of the license is included in the `COPYING.DOC' file
 .\" as part of this distribution.
 .\"
-.TH checkdirfile 1 "22 November 2010" "Version 0.7.0" "GETDATA"
+.TH checkdirfile 1 "21 February 2012" "Version 0.8.0" "GETDATA"
 .SH NAME
 checkdirfile \(em verify Dirfile database metadata
 .SH SYNOPSIS
@@ -43,6 +43,25 @@ self-consistency.  Finally, the database is queried for its length.
 .B --version
 Show usage and version information and exit.
 
+.SH AUTHOR
+
+checkdirfile was written by D. V. Wiebe.
+
+.SH REPORTING BUGS
+
+Please send reports of bugs to getdata\-devel at lists.sourceforge.net
+
+The GetData home page: <http://getdata.sourceforge.net/>
+
+.SH COPYRIGHT
+
+Copyright \(co 2010 D. V. Wiebe
+
+checkdirfile is licenced under the GNU LPGL version 2.1 or later.
+
+This is free software: you are free to change and redistribute it.
+There is NO WARRANTY, to the extent permitted by law.
+
 .SH SEE ALSO
 .BR dirfile (5),
 .BR dirfile-format (5)
diff --git a/man/dirfile-encoding.5 b/man/dirfile-encoding.5
index cee8da5..5a02421 100644
--- a/man/dirfile-encoding.5
+++ b/man/dirfile-encoding.5
@@ -1,6 +1,6 @@
 .\" dirfile-encoding.5.  The dirfile-encoding man page.
 .\"
-.\" Copyright (C) 2008, 2009, 2010 D. V. Wiebe
+.\" Copyright (C) 2008, 2009, 2010, 2012, 2013 D. V. Wiebe
 .\"
 .\""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
 .\"
@@ -13,7 +13,7 @@
 .\" Texts.  A copy of the license is included in the `COPYING.DOC' file
 .\" as part of this distribution.
 .\"
-.TH dirfile-encoding 5 "4 August 2010" "Standards Version 8" "DATA FORMATS"
+.TH dirfile-encoding 5 "26 January 2013" "Standards Version 9" "DATA FORMATS"
 .SH NAME
 dirfile-encoding \(em dirfile database encoding schemes
 .SH DESCRIPTION
@@ -28,7 +28,7 @@ form.  This is accomplished by
 .I encoding
 the binary file into the alternate form.  A common use-case for encoding a
 binary file is to compress it to save disk space.  Only data is modified by an
-encoding scheme.  Database metadata is unaffected.
+encoding scheme.  Database metadata is never encoded.
 
 Support for encoding schemes is optional.  An implementation need not support
 any particular encoding scheme, or may only support certain operations with it,
@@ -56,11 +56,11 @@ The GetData library provides an encoding framework which abstracts binary file
 I/O, allowing for generic support for a wide variety of encoding schemes.
 Functions which may make use of the encoding framework are:
 .IP
-.BR gd_add (3),\~ gd_add_raw (3),\~ gd_add_spec (3),
-.BR gd_alter_encoding (3),\~ gd_alter_endianness (3),
-.BR gd_alter_frameoffset (3),\~ gd_alter_entry (3),
-.BR gd_alter_raw (3),\~ gd_alter_spec (3),\~ gd_getdata (3),
-.BR gd_move (3),\~ gd_nframes (3),\~ gd_putdata (3),
+.BR gd_add "(3), " gd_add_raw "(3), " gd_add_spec (3),
+.BR gd_alter_encoding "(3), " gd_alter_endianness (3),
+.BR gd_alter_frameoffset "(3), " gd_alter_entry (3),
+.BR gd_alter_raw "(3), " gd_alter_spec "(3), " gd_getdata (3),
+.BR gd_move "(3), " gd_nframes "(3), " gd_putdata (3),
 and
 .BR gd_rename (3).
 .P
@@ -83,7 +83,7 @@ field has multiple data files with different, supported file extensions which
 could legitimately be associated with it, the encoding scheme discovered by
 GetData is not well defined.
 
-In addition to raw (unencoded) data, GetData supports five other encoding
+In addition to raw (unencoded) data, GetData supports eight other encoding
 schemes:
 .I text
 encoding,
@@ -92,28 +92,25 @@ encoding,
 .I gzip
 encoding,
 .I lzma
-encoding, and
+encoding, 
+.I sie
+(sample-index encoding),
 .I slim
+encoding,
+.I zzip
+encoding, and
+.I zzslim
 encoding, all discussed below.
-
-.SS Text Encoding
-
-The Text Encoding is unique among GetData encoding schemes in that it requires
-no external library.  As a result, all builds of the library contain full
-support for this encoding.  It is meant to serve as a reference encoding and
-example of the encoding framework for work on other encoding schemes.
-
-The Text Encoding replaces the binary data files with 7-bit ASCII files
-containing a decimal text encoding of the data, one sample per line.  All
-operations are supported by the Text Encoding.  The file extension of the
-Text Encoding is
-.BR .txt .
+.PP
+The text encoding and the sample-index encoding are implemented by GetData
+natively and need no external library.  As a result, they are always present in
+the library.
 
 .SS BZip2 Encoding
 
-The BZip2 Encoding compresses raw binary files using the Burrows-Wheeler block
-sorting text compression algorithm and Huffman coding, as implemented in the
-bzip2 format.  GetData's BZip2 Encoding scheme is implemented through the the
+The BZip2 Encoding reads compressed raw binary files using the Burrows-Wheeler
+block sorting text compression algorithm and Huffman coding, as implemented in
+the bzip2 format.  GetData's BZip2 Encoding scheme is implemented through the
 .I bzip2 compression library
 written by Julian Seward.  GetData's BZip2 Encoding framework currently lacks
 write capabilities; as a result the BZip2 Encoding does not support functions
@@ -121,7 +118,7 @@ which modify binary data.
 
 GetData caches an uncompressed megabyte of data at a time to speed access times.
 A call to
-.BR get_nframes (3)
+.BR gd_nframes (3)
 requires decompression of the entire binary file to determine its uncompressed
 size, and may take some time to complete.
 The file extension of the BZip2 Encoding is
@@ -133,24 +130,26 @@ The GZip Encoding compresses raw binary files using Lempel-Ziv coding (LZ77) as
 implemented in the gzip format.  GetData's GZip Encoding scheme is implemented
 through the the
 .I zlib compression library
-written by Jean-loup Gailly and Mark Adler.  GetData's GZip Encoding framework
-currently lacks write capabilities; as a result the GZip Encoding does not
-support functions which modify binary data.
+written by Jean-loup Gailly and Mark Adler. All operations are supported by the
+GZip Encoding.  Writes to GZip encoded data occur out-of-place; that is: writing
+GZip Encoded data requires making a copy of the whole binary data file.  A side
+effect of this is that concurrently reading a GZip Encoded Dirfile which is
+being written to usually doesn't work.
 
 To speed the operation of
-.BR get_nframes (3),
+.BR gd_nframes (3),
 the GZip Encoding takes the uncompressed size of the file the gzip footer, which
-contains the file's uncompressed size in bytes, modulo 2^32.  As a result, using
-a field with an (uncompressed) binary file size larger than 4\~GiB as the
+contains the file's uncompressed size in bytes, modulo 2**32.  As a result,
+using a field with an (uncompressed) binary file size larger than 4\~GiB as the
 reference field will result in the wrong number of frames being reported.
 The file extension of the GZip Encoding is
 .BR .gz .
 
 .SS LZMA Encoding
 
-The LZMA Encoding compresses raw binary files using the Lempel-Ziv Markov Chain
-Algorithm (LZMA) as implemented in the xz container format.  GetData's LZMA
-Encoding scheme is implemented through the
+The LZMA Encoding reads compressed raw binary files using the Lempel-Ziv Markov
+Chain Algorithm (LZMA) as implemented in the xz container format.  GetData's
+LZMA Encoding scheme is implemented through the
 .IR "lzma library" ,
 part of the
 .I XZ Utils
@@ -160,7 +159,7 @@ Encoding does not support functions which modify binary data.
 
 As with the BZip2 Encoding, GetData caches an uncompressed megabyte of data at a
 time to speed access times.  A call to
-.BR get_nframes (3)
+.BR gd_nframes (3)
 requires decompression of the entire binary file to determine its uncompressed
 size, and may take some time to complete.
 The file extension of the LZMA Encoding is
@@ -168,19 +167,102 @@ The file extension of the LZMA Encoding is
 or
 .BR .lzma .
 
+.SS Sample-Index Encoding
+
+The Sample-Index Encoding (SIE) compresses raw binary data by replacing runs of
+repeated data, similar to run-length encoding.  SIE files contain binary records
+consisting of a 64-bit sample number followed by a datum (the size and format of
+which is determined by the RAW field's data type in the format metadata).  The
+sample number indicates the last sample of the field which has the specified
+value.  The first sample with the value is the sample immediately following the
+data in the previous record, or sample number zero, for the first record.
+Sample numbers are relative to any
+.B /FRAMEOFFSET
+specified in the Dirfile metadata.  All operations are supported by the
+Sample-Index Encoding.  The file extension of the Sample-Index Encoding is
+.BR .sie .
+
 .SS Slim Encoding
 
-The Slim Encoding compresses raw binary files using the slimlib compression
-library written by Joseph Fowler.  The slimlib library was developed at
-Princeton University to compress dirfile-like data.  GetData's Slim Encoding
+The Slim Encoding reads compressed raw binary files using the slimlib
+compression library written by Joseph Fowler.  The slimlib library was developed
+at Princeton University to compress dirfile-like data.  GetData's Slim Encoding
 framework currently lacks write capabilities; as a result, the Slim Encoding
 does not support function which modify binary files.  The file extension of the
 Slim Encoding is
 .BR .slm .
 
+Using the Slim Encoding with GetData may result in unexpected, but manageable,
+memory usage.  See the
+.BR gd_getdata (3)
+manual page for details.
+
+.SS Text Encoding
+
+The Text Encoding replaces the binary data files with 7-bit ASCII files
+containing a decimal text encoding of the data, one sample per line.  All
+operations are supported by the Text Encoding.  The file extension of the
+Text Encoding is
+.BR .txt .
+
+.SS ZZip Encoding
+
+The ZZip Encoding reads compressed raw binary files using the DEFLATE algorithm
+as implemented in the PKWARE ZIP archive container format.  GetData's ZZip
+Encoding scheme is implemented through the
+.I zzip library
+written by Tomi Ollila and Guido Draheim.  The ZZip Encoding framework
+currently lacks write capabilities; as a result the ZZip Encoding does not
+support functions which modify binary data.
+.PP
+Unlike most encoding schemes, the ZZip encoding merges all binary data files
+defined in a given fragment into a single ZIP archive.  The name of this
+archive is
+.I raw.zip
+by default, but a different name may be specified using the second parameter to
+the 
+.B /ENCODING
+directive.  For example,
+.IP
+.B /ENCODING zzip
+archive
+.PP
+indicates that the ZIP archive is called
+.IR archive.zip .
+The file extension of the ZZip Encoding is
+.BR .zip .
+
+.SS ZZSlim Encoding
+
+The ZZSlim Encoding is a convolution of the Slim Encoding and the ZZip Encoding.
+To create ZZSlim Encoded files, first the raw data are compressed using the
+slim library, and then these slim-compressed files are archived (and compressed
+again) into a ZIP archive.  As with the ZZip Encoding, the ZIP archive is
+.I raw.zip
+by default, but a different name may be specified with the
+.B /ENCODING
+directive.
+.PP
+Notably, since the archives have the same name as ZZip Encoded data, automatic
+encoding detection on ZZSlim Encoded data always fails: they are incorrectly
+identified as simply ZZip Encoded.  As a result, an
+.B /ENCODING
+directive in the format file or else a
+.B GD_ZZSLIM_ENCODED
+flag passed to
+.BR gd_open (3)
+is required to read ZZSlim encoded data.  The file extension of the ZZSlim
+Encoding is
+.BR .zip .
+
+Using the ZZSlim Encoding with GetData may result in unexpected, but manageable,
+memory usage.  See the
+.BR gd_getdata (3)
+manual page for details.
+
 .SH AUTHOR
 
-This manual page was by D. V. Wiebe
+This manual page was written by D. V. Wiebe
 .nh
 <dvw at ketiltrout.net>.
 .hy 1
@@ -190,4 +272,5 @@ This manual page was by D. V. Wiebe
 .BR dirfile\-format (5),
 .BR bzip2 (1),
 .BR gzip (1),
+.BR xz (1),
 .BR zlib (3).
diff --git a/man/dirfile-format.5 b/man/dirfile-format.5
index b8676e5..c1be545 100644
--- a/man/dirfile-format.5
+++ b/man/dirfile-format.5
@@ -1,6 +1,6 @@
 .\" dirfile-format.5.  The dirfile format specification man page.
 .\"
-.\" Copyright (C) 2005, 2006, 2008, 2009, 2010 D. V. Wiebe
+.\" Copyright (C) 2005, 2006, 2008, 2009, 2010, 2012, 2013 D. V. Wiebe
 .\"
 .\""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
 .\"
@@ -13,7 +13,7 @@
 .\" Texts.  A copy of the license is included in the `COPYING.DOC' file
 .\" as part of this distribution.
 .\"
-.TH dirfile\-format 5 "23 October 2010" "Standards Version 8" "DATA FORMATS"
+.TH dirfile\-format 5 "3 April 2013" "Standards Version 9" "DATA FORMATS"
 .SH NAME
 dirfile\-format \(em the dirfile database format specification file
 .SH DESCRIPTION
@@ -35,13 +35,19 @@ the format specification, and may reference other fragments (using the
 directive) containing further format specification.  This inclusion mechanism
 may be nested arbitrarily deep.
 
-The explicit text encoding of these files is not specified by these standards,
-but must be 7-bit ASCII compatible. Examples of acceptable character encodings
-include all the ISO\~8859 character sets
+The explicit text encoding of these files is not specified by these Standards,
+but it must be 7\-bit ASCII compatible. Examples of acceptable character
+encodings include all the ISO\~8859 character sets
 .RI ( i.e.
 Latin-1 through Latin-10, among others), as well as the UTF-8 encoding of
 Unicode and UCS.
 
+This document primarily describes the latest version of the Standards (Version
+9); differences with previous versions are noted where relevant.  A complete
+list of changes between versions is given in the
+.B HISTORY
+section below.
+
 .SH SYNTAX
 The format specification is composed of field specification lines and directive lines,
 optionally separated by blank lines or lines containing only whitespace.
@@ -68,7 +74,7 @@ or be replaced by a
 .I character escape sequence
 (see below), or else the token must be enclosed in quotation marks
 .RB ( """" ).
-The quotation marks themselves will be stripped from the token. The
+The quotation marks themselves are stripped from the token. The
 .I null-token
 (that is, the token consisting of zero characters) may be specified by a pair
 of quotation marks with nothing between them
@@ -78,7 +84,7 @@ To include a literal quotation mark in a token, it must be escaped
 Similarly, a hash mark may be included in a token by including it in a quoted
 token or else by escaping it
 .RB ( \e# ),
-otherwise the hash mark will be understood as the comment delimiter.
+otherwise the hash mark is understood as the comment delimiter.
 
 It is a syntax error to have a line which contains unmatched quotation marks, or
 in which the last character is the backslash character.
@@ -117,16 +123,19 @@ a backslash character (ASCII 0x5C / U+005C)
 .TP
 .BI \e ooo
 the single byte given by the octal number
-.IR ooo .
+.I ooo 
+(1 to 3 octal digits).
 .TP
 .BI \ex hh
 the single byte given by the hexadecimal number
-.IR hh .
+.I hh
+(1 or 2 hexadecimal digits).
 .TP
 .BI \eu hhhhhhh
 the UTF-8 byte sequence encoding the Unicode code point given by the hexadecimal
 number
-.IR hhhhhhh .
+.I hhhhhhh
+(1 to 7 hexadecimal digits).
 .RE
 
 Any other character which is escaped is interpreted as the character itself.
@@ -151,16 +160,23 @@ character forms a valid token.  However, there may be further restrictions on
 allowed characters for a token in a particular situation, (for example, when
 used as a field name).
 
+Standards Version 5 and earlier do not recognise the character escape sequences,
+nor allow quoting of tokens. As a result, they prohibit both whitespace and the
+comment delimiter from being used in tokens. 
+
 .SH DIRECTIVES
 
-There are eight 
-.IR "reserved words" ,
-which cannot be used as field names in the dirfile.  Instead, these specify
-directives.  All reserved words start with an initial forward slash
+There are ten 
+.IR directives ,
+each specified by a different
+.IR "reserved word", 
+which cannot be used as field names in the dirfile.  As of Standards Version 8,
+all reserved words start with an initial forward slash
 .RB ( / ),
-to distinguish them from field names.  Previous versions of the Standards
-permitted the omission of the slash.  Like the rest of the format specification,
-directives are case sensitive.
+to distinguish them from field names.  Standards Versions 5, 6, and 7 permitted
+the omission of the initial forward slash, while in Standards Version 4 and
+earlier, reserved words may not have an initial forward slash.  Like the rest of
+the format specification, directives are case sensitive.
 
 A number of the directives have
 .IR "fragment scope" .
@@ -169,17 +185,69 @@ present, plus any sub-fragments indicated by the
 .B /INCLUDE
 directive, but only if those sub-fragments don't have their own corresponding
 directive.  Directives which have fragment scope are:
-.BR /ENCODING ,\~ /ENDIAN ,\~ /FRAMEOFFSET ", and " /PROTECT .
+.BR /ENCODING ", " /ENDIAN ", " /FRAMEOFFSET ", and " /PROTECT .
 Because of these scoping rules, different portions of the dirfile may have
 different encodings, endiannesses, frame offsets, or protection levels.
 
 If a directive with fragment scope appears more than once in a fragment, only
-the last such directive will be honoured, with the exception that the effect of
-a directive will not be propagated to sub-fragments if the directive line
+the last such directive is honoured, with the exception that the effect of
+a directive is not propagated to sub-fragments if the directive line
 appears after the sub-fragment is included.  The scoping rules of the remaining
 directives are discussed below.
 
 .TP
+.B /ALIAS
+The /ALIAS directive defines an alternate name for a field defined elsewhere in
+the format specification (called the "target").  Aliases may not be used as the
+parent field in a
+.B /META
+directive, but are in most other ways indistinguishable from the target's
+original, canonical name.  Aliases may be chained (that is, the target name
+appearing in an /ALIAS directive may itself be an alias).  In this case, the new
+alias is another name for the target's own target.  Just as there is no
+requirement that the input fields of a derived field exist,
+it is not an error for the target of an alias to not exist.  Syntax is:
+.IP
+.RS
+.B /ALIAS
+.I <name> <target>
+.RE
+.IP
+A metafield alias may defined using the
+.IR <parent-field> / <alias-name>
+syntax for
+.I name
+in the /ALIAS directive.  No restriction is placed on
+.IR target ;
+specifically, a metafield alias may target a top-level field, or a metafield
+of with a different parent; conversely, a top-level alias may target a
+metafield.
+.IP
+A metafield alias may never appear as the parent part of a metafield field code,
+even if it refers to a top-level field.  That is, given the valid format:
+.IP
+.RS
+field1 \fBRAW UINT8\fR 1
+.br
+field1/meta \fBCONST FLOAT64\fR 0.0
+.br
+field2 \fBRAW UINT8\fR 1
+.br
+\fB/ALIAS\fR field2/alias field1
+.RE
+.IP
+the metafield
+.I field1/meta
+may not be referred to as
+.IR field2/alias/meta ,
+even though
+.I field2/alias
+is a valid field code referring to
+.IR field1 .
+.IP
+The /ALIAS directive has no scope: it is processed immediately.  It appeared in
+Standards Version 9.
+.TP
 .B /ENCODING
 The /ENCODING directive specifies the encoding scheme used to encode binary
 files in the dirfile.  The encoding scheme may be one of the predefined names
@@ -188,32 +256,58 @@ listed below, which are described in more detail in
 or any other site-specific encoding scheme.  The predefined scheme names are:
 .RS
 .TP
-.I none
+.B none
 The dirfile is unencoded.
 .TP
-.I bzip2
+.B bzip2
 The dirfile is compressed using the bzip2 compression scheme.
 .TP
-.I gzip
+.B gzip
 The dirfile is compressed using the gzip compression scheme.
 .TP
-.I lzma
+.B lzma
 The dirfile is compressed using the LZMA compression scheme.
 .TP
-.I slim
+.B slim
 The dirfile is compressed using the slim compression scheme.
 .TP
-.I text
+.B sie
+The dirfile is sample-index encoded (a variant of run-length encoding).
+.TP
+.B text
 The dirfile is text encoded.
+.TP
+.B zzip
+The dirfile is compressed and encapsulated using the zzip compression scheme.
+.TP
+.B zzslim
+The dirfile is compressed and encapsulated using a combination of the zzip
+and slim compression schemes.
 .PP
 Implementations should fail gracefully when encountering an unknown encoding
 scheme.  If no encoding scheme is specified, behaviour is implementation
 dependent.  Syntax is:
 .IP
-.BI /ENCODING\~ <scheme>
+.B /ENCODING \fI<scheme> \fR[\fI<enc-datum>\fR]
+.PP
+The
+.I enc-datum
+token provides additional data for certain encoding schemes; see
+.BR dirfile-encoding (5)
+for details.  The form of enc-datum is not specified.
 .PP
 The /ENCODING directive has
 .IR "fragment scope" .
+It appeared in Standards Version 6.  The predefined schemes
+.nh
+.BR sie ", " zzip ", and " zzslim ,
+.hy
+and the optional
+.I enc-datum
+token, appeared in Standards Version 9; the predefined scheme
+.B lzma
+appeared in Standards Version 7; all other predefined schemes appeared in
+Standards Version 6.
 .RE
 .TP
 .B /ENDIAN
@@ -224,11 +318,14 @@ is:
 .RS
 .IP
 .B /ENDIAN
-.IR "( " big " | " little " ) [ " arm " ]"
+.RB "( " big " | " little " ) [ " arm " ]"
 .PP
 where the "arm" token should be included if double precision floating point data
 are stored in the ARM middle-endian format.  The /ENDIAN directive has
 .IR "fragment scope" .
+It appeared in Standards Version 5.  The optional
+.B arm
+token appeared in Standards Version 8.
 .RE
 .TP
 .B /FRAMEOFFSET
@@ -242,24 +339,72 @@ fields.  Syntax is:
 .PP
 The /FRAMEOFFSET directive has
 .IR "fragment scope" .
+It appeared in Standards Version 1.
+.RE
+.TP
+.B /HIDDEN
+The /HIDDEN directive indicates that the specified field name is
+.IR hidden .
+The difference (if any) between a field name which is
+.I hidden
+and one that is not is implementation dependent.  Hiddenness is not inherited
+by metafields of the specified field.  Hiddenness applies to the name, not the
+field itself; it does not hide all aliases of the field-name, and if field-name
+an alias, the alias is hidden, not its target.  Syntax is:
+.RS
+.IP
+.BR /HIDDEN\~ <field-name>
+.PP
+A /HIDDEN directive must appear after the specification of
+.IR field-name ,
+(which occurs either in a field specification line, or an
+.B /ALIAS
+directive, or a
+.B /META
+directive) in the same fragment.
+.PP
+The /HIDDEN directive has no scope: it is processed immediately.  It appeared in
+Standards Version 9.
 .RE
 .TP
 .B /INCLUDE
 The /INCLUDE directive specifies another file (called a
 .IR "fragment" )
 to parse for additional format specification for the dirfile.  The inclusion is
-treated as if the lines of the fragment were pasted verbatim in place of the
-INCLUDE directive line.  The exception to this is that RAW fields specified in
-the fragment are located in the directory containing the fragment and not in the
-directory containing the parent fragment, and the binary file encoding may be
-different for each fragment.  The fragment may be specified either with an
-absolute path, or else a relative path from the current file.  Syntax is:
+processed immediately, before the fragment containing the /INCLUDE directive
+(the
+.IR "parent fragment" )
+is parsed further.  RAW fields specified in the included fragment are located in
+the directory containing the fragment file, and not in the directory containing
+the parent fragment, and the binary file encoding may be different for each
+fragment.  The fragment may be specified either with an absolute path, or else a
+path relative to the directory containing the parent fragment.
+.IP
+The /INCLUDE directive may optionally specify a
+.I prefix
+and/or
+.I suffix
+to apply to field names defined in the included fragment.  If present, affixes
+are applied to all field-names (including aliases) defined in the included
+fragment and any fragments it further includes.  Affixes nest, with the affixes
+of the deepest inclusion innermost.  Affixes are not applied to the names of
+binary files associated with
+.B RAW
+fields.  Syntax is:
 .RS
 .IP
-.BI /INCLUDE\~ <file>
+.B /INCLUDE \fI<file> \fR[\fI<prefix> \fR[\fI<suffix>\fR]]
 .PP
-The /INCLUDE directive has no scope: it is processed immediately and has no
-long-term effect.
+To specify only a suffix, use the null-token
+.RB ( """""" )
+as
+.IR prefix .
+The /INCLUDE directive has no scope: it is processed immediately.  It appeared
+in Standards Version 3.  The optional
+.I prefix
+and
+.I suffix
+appeared in Standards Version 9.
 .RE
 .TP
 .B /META
@@ -280,7 +425,9 @@ META fields may not be specified before their parent field has been.  Syntax is:
 .I <parent-field>
 {field specification line}
 .PP
-As an illustration of this concept,
+The
+.I <parent-field>
+code may not be an alias.  As an illustration of this concept,
 .IP
 .B /META 
 pfield meta
@@ -297,8 +444,8 @@ This particular metafield may be referred to by the
 the same name, since all references to metafields must include the parent
 field name.  Metafields may not themselves have further sub-metafields.
 .PP
-As an alternative to the /META directive, a metafield may be specified by a
-standard field specification line, using
+As an alternative to the /META directive, starting with Standards Version 7,
+a metafield may be specified by a standard field specification line, using
 .IP
 .IB <parent-field> / <meta-field>
 .PP
@@ -309,8 +456,8 @@ pfield/meta
 .B CONST FLOAT64
 3.291882
 .PP
-The /META directive has no scope: it is processed immediately and has no
-long-term effect.
+The /META directive has no scope: it is processed immediately.  It appeared in
+Standards Version 6.
 .RE
 .TP
 .B /PROTECT
@@ -344,6 +491,7 @@ Both metadata and data on disk are protected from change.
 .PP
 The /PROTECT directive has
 .IR "fragment scope" .
+It appeared in Standards Version 6.
 .RE
 .TP
 .B /REFERENCE
@@ -363,7 +511,7 @@ field.  Syntax is:
 The /REFERENCE directive has
 .IR "global scope" :
 if multiple /REFERENCE directives appear in the dirfile metadata, only the last
-such will be honoured.
+such is honoured.  It appeared in Standards Version 6.
 .RE
 .TP
 .B /VERSION
@@ -379,9 +527,16 @@ ease forward compatibility.  Syntax is:
 The /VERSION directive has
 .IR "immediate scope" :
 its effect is immediate, and it applies only to metadata below it, including
-and propagating downwards to sub-fragments after the directive.  Its effect
-will also propagate upwards back to the parent fragment, and affect subsequent
-metadata.
+and propagating downwards to sub-fragments after the directive.
+.PP
+In Standards Version 8 and earlier, its effect also propagates upwards back to
+the parent fragment, and affects subsequent metadata.  Starting with Standards
+Version 9, this no longer happens.  As a result, a /VERSION directive which
+indicates a version of 9 or later never propagates upwards; additionally,
+/VERSION directives found in subfragments included in a Version 9 or later
+fragment aren't propagated upwards into that fragment, regardless of the
+Version of the subfragments.  The /VERSION directive appeared in Standards
+Version 5.
 .RE
 
 .SH FIELD SPECIFICATION LINES
@@ -406,23 +561,89 @@ characters, excluding both ASCII control characters (the bytes 0x01 through
 .PP
 which are reserved (but see below for the use of
 .B /
-to specify metafields).  The field name may not be
+to specify metafields).
+The full stop
+.RB ( . )
+is allowed in Standards Version 5 and earlier.  The ampersand, semicolon, less
+than, greater than, and vertical line
+.RB ( "& / ; < > |" )
+are allowed in Standards Version 4 and earlier.  Furthermore, due to the lack
+of an escape or quoting mechanism (see 
+.B Tokens
+above), Standards Version 5 and earlier also prohibit whitespace and the
+comment delimiter
+.RB ( # )
+in field names.
+.PP
+The field name may not be
 .IR INDEX ,
 which is a special, implicit field which contains the integer frame index.
-Field names are case sensitive.
+Standards Version 5 and earlier also prohibit
+.IR FILEFRAM ,
+which was an alias for
+.IR INDEX .
+Field names are case sensitive.  Standards Version 3 and 4 restrict field names
+to 50 characters. Standards Version 2 and earlier restrict field names to 16
+characters. Additionally, the filesystem may put restrictions on the length 
+and acceptable characters of a
+.B RAW
+field name, regardless of Standards Version. 
 
-If the field name beginning a field specification line does contain a
+Starting in Standards Version 7, if the field name beginning a field
+specification line contains exactly one
 .B /
 character, the line is assumed to specify a metafield.  See the
 .B /META
-directive above for further details.
+directive above for further details.  A field name may not contain more than one
+.BR / .
 
 .SS Field Types
-There are thirteen field types.  Of these, ten are of vector type
-.RB ( BIT ", " DIVIDE ", " LINCOM ", " LINTERP ", " MULTIPLY ", " PHASE ,
-.BR POLYNOM ", " RAW ", " RECIP ", and " SBIT )
+There are fifteen field types.  Of these, twelve are of vector type
+.RB ( BIT ", " DIVIDE ", " LINCOM ", " LINTERP ", " MPLEX ", " MULTIPLY ,
+.BR PHASE ", " POLYNOM ", " RAW ", " RECIP ", " SBIT ", and " WINDOW )
 and three are of scalar type
 .RB ( CONST ", " CARRAY ", and " STRING ).
+The eleven vector field types other than
+.B RAW
+fields are also called
+.IR "derived fields" ,
+since they derive their value from one or more input fields.
+.PP
+Five of these derived fields
+.RB ( DIVIDE ", " LINCOM ", " MPLEX ", " MULTIPLY ", and " WINDOW )
+may have more than one input field.  In situations where these input fields
+have differing sample rates, the sample rate of the derived field is the same
+as the sample rate of the first (left-most) input field specified.  Furthermore,
+the input fields are synchronised by aligning them on frame boundaries, assuming
+equally-spaced sampling throughout a frame, and using the last sample of each
+input field which did not occur after the sample of the derived field being
+computed.  That is, if the first and second input fields have sample rates
+.I s1
+and
+.IR s2 ,
+the derived field also has sample rate
+.I s1
+and, for every sample of the derived field,
+.IR n ,
+the
+.IR n 'th
+sample of the first field is used (since they have the same sample rate by
+definition), and the sample number used of the second field,
+.IR m ,
+is computed as:
+.IP
+\fIm\fR = \fBfloor\fR((\fIn\fR * \fIs2\fR) / \fIs1\fR).
+.PP
+Starting in Standards Version 6, certain scalar field parameters in the field
+specifications may be specified using
+.B CONST
+or
+.B CARRAY
+fields, instead of literal values.  A list of parameters for which this is
+allowed is given below in the
+.B Field Parameters
+section.
+.PP
 The possible fields types are:
 .TP
 .B BIT
@@ -430,32 +651,28 @@ The BIT vector field type extracts one or more bits out of an input vector
 field as an unsigned number.  Syntax is:
 .RS
 .IP
-.I <field-name>
+.I <fieldname>
 .B BIT
-.I <input> <first-bit> [<bits>]
+.I <input> <first-bit> \fR[\fI<num-bits>\fR]
 .PP
 which specifies
-.I field-name
+.I fieldname
 to be the value of bits
 .I first-bit
 through
-.IR first-bit + bits -1
+.IR first-bit + num-bits -1
 of the input vector field
 .IR input ,
 when
 .I input
 is converted from its native type to an (endianness corrected) unsigned 64-bit
 integer.  If
-.I bits
-is omitted, it is assumed to be 1.  Both
-.IR first-bit " and " bits
-may be either literal numbers, or else the field code of a
-.B CONST
-or
-.B CARRAY
-field type containing their values.  The
+.I num-bits
+is omitted, it is assumed to be 1.  The
 .B SBIT
-field type is a signed version of this field type.
+field type is a signed version of this field type.  The optional
+.I num-bits
+parameter appeared in Standards Version 1.
 .RE
 .TP
 .B CARRAY
@@ -463,7 +680,7 @@ The CARRAY scalar field type is a list of constants fully specified in the
 format specification metadata.  Syntax is:
 .RS
 .IP
-.I <field-name>
+.I <fieldname>
 .B CARRAY
 .I <type> <value0> <value1> <value2> ...
 .PP
@@ -481,7 +698,7 @@ No limit is placed on the number of elements in a
 (Note: despite being multivalued, this is not considered a vector field since
 the elements of the
 .B CARRAY
-are not indexed by frames.)
+are not indexed by frames.)  It appeared in Standards Version 8.
 .RE
 .TP
 .B CONST
@@ -489,7 +706,7 @@ The CONST scalar field type is a constant fully specified in the format
 specification metadata.  Syntax is:
 .RS
 .IP
-.I <field-name>
+.I <fieldname>
 .B CONST
 .I <type> <value>
 .PP
@@ -501,25 +718,22 @@ field type below), and
 .I value
 is the numerical value of the constant interpreted as indicated by
 .IR type .
+It appeared in Standards Version 6.
 .RE
 .TP
 .B DIVIDE
 The DIVIDE vector field type is the quotient of two vector fields.  Syntax is:
 .RS
 .IP
-.I <field-name>
+.I <fieldname>
 .B DIVIDE
 .I <field1> <field1>
 .PP
-The derived field will be computed as:
+The derived field is computed as:
 .IP
-field-name[n] = field1[n] / field2[n2]
+fieldname = field1 / field2.
 .PP
-with the index
-.I n2
-computed appropriately for the (potentially differing) sample rates of the
-input fields.  The resultant field will have the same sample rate as
-.IR field1 .
+It was introduced in Standards Version 8.
 .RE
 .TP
 .B LINCOM
@@ -527,36 +741,23 @@ The LINCOM vector field type is the linear combination of one, two or three
 input vector fields.  Syntax is:
 .RS
 .IP
-.I <field-name>
+.I <fieldname>
 .B LINCOM
-.RI [ <n> "] " "<field1> <a1> <b1>"\~ [ "<field2> <a2> <b2>"\~ [ "<field3> <a3>"
+.RI [ <n> "] " "<field1> <a1> <b1> " [ "<field2> <a2> <b2> " [ "<field3> <a3>"
 .IR <b3> ]]
 .PP
 where
 .IR n ,
 if present, indicates the number of input vector fields (1, 2, or 3).  The
-derived field will be computed as:
+derived field is computed as:
 .IP
-field-name[n] = (a1 * field1[n] + b1) + (a2 * field2[n2] + b2) + (a3 * field3[n3] + b3)
+fieldname = (a1 * field1 + b1) + (a2 * field2 + b2) + (a3 * field3 + b3)
 .PP
 with the
 .I field2
 and
 .I field3
-terms included only if specified and the indices
-.I n2
-and
-.I n3
-computed appropriately for the (potentially differing) sample rates of the
-input fields.  The resultant field will have the same sample rate as
-.IR field1 .
-Each supplied co-efficient
-.RI ( a1 ,\~ b1 ,\~ a2 ,
-&c.) may be either a literal number, or else the field code of a
-.B CONST
-or
-.B CARRAY
-field type containing its value.
+terms included only if specified.
 
 If
 .I n
@@ -571,7 +772,9 @@ That is, if the field code specifying
 .I field1
 could be mistaken for a literal number,
 .I n
-must be specified to prevent ambiguity.
+must be specified to prevent ambiguity.  In standards Version 6 and earlier,
+.I n
+is mandatory.
 .RE
 .TP
 .B LINTERP
@@ -579,7 +782,7 @@ The LINTERP vector field type specifies a table look up based on another vector
 field.  Syntax is:
 .RS
 .IP
-.I <field-name>
+.I <fieldname>
 .B LINTERP
 .I <input> <table>
 .PP
@@ -598,23 +801,93 @@ values.  Values are linearly interpolated between the points specified in the
 lookup table.
 .RE
 .TP
+.B MPLEX
+The MPLEX vector field type permits the multiplexing of several low sample rate
+fields into a single data field of higher sample rate.  Syntax is:
+.RS
+.IP
+.I <fieldname>
+.B MPLEX
+.I <input> <index> <count> \fR[\fI<period>\fR]
+.PP
+where
+.I input
+is the input vector containing the multiplexed fields,
+.I index
+is the vector containing the mutliplex index,
+.I count
+is the value of the multiplex index when the computed field is stored in
+.IR input ,
+and
+.IR period ,
+if present and non-zero, is the number of samples between successive occurrances
+of the value
+.I count
+in the index vector.  A
+.I period 
+of zero (or, equivalently, it's omission) indicates that either the value
+.I count
+is not equally spaced in the index vector, or else that the spacing is unknown. 
+Both
+.I count
+and
+.I period
+are integers, and
+.I period
+may not be negative.
+.PP
+At every sample
+.IR n ,
+the derived field is computed as:
+.IP
+fieldname[n] = (index == count) ? input[n] : fieldname[n - 1]
+.PP
+The
+.I index
+vector is converted to an integer type for comparison.  The value of the
+derived field before the first sample where
+.I index
+equals
+.I count
+is implementation dependent.
+.PP
+The values of
+.I count
+and
+.I period
+place no restrictions on values contained in
+.IR index .
+Specifically, particular values of
+.I index
+(including
+.IR count )
+need not be equally spaced (neither by
+.I period
+nor any other spacing);
+.I index
+need not ever take on the value
+.I count
+(in which case the value of the entirety of the derived field is
+implementation dependent).  Different MPLEX field definitions which use the
+same index vector may specify different
+.IR period s.
+MPLEX appeared in Standards Version 9.
+
+.RE
+.TP
 .B MULTIPLY
 The MULTIPLY vector field type is the product of two vector fields.  Syntax is:
 .RS
 .IP
-.I <field-name>
+.I <fieldname>
 .B MULTIPLY
 .I <field1> <field2>
 .PP
-The derived field will be computed as:
+The derived field is computed as:
 .IP
-field-name[n] = field1[n] * field2[n2]
+fieldname = field1 * field2.
 .PP
-with the index
-.I n2
-computed appropriately for the (potentially differing) sample rates of the
-input fields.  The resultant field will have the same sample rate as
-.IR field1 .
+It appeared in Standards Version 2.
 .RE
 .TP
 .B PHASE
@@ -622,12 +895,12 @@ The PHASE vector field type shifts an input vector field by the specified number
 of samples.  Syntax is:
 .RS
 .IP
-.I <field-name>
+.I <fieldname>
 .B PHASE
 .I <input> <shift>
 .PP
 which specifies
-.I field-name
+.I fieldname
 to be the input vector field,
 .IR input ,
 shifted by
@@ -635,13 +908,8 @@ shifted by
 samples.  A positive
 .I shift
 indicates a forward shift, towards the end-of-field.  Results of shifting past
-the beginning- or end-of-field is implementation dependent.  The
-.I shift
-parameter may be either a literal number, or else the field code of a
-.B CONST
-or
-.B CARRAY
-field type containing its values.
+the beginning- or end-of-field is implementation dependent.  PHASE appeared in
+Standards Version 4.
 .RE
 .TP
 .B POLYNOM
@@ -652,7 +920,7 @@ vector field.  Syntax is:
 .I <field_name>
 .B POLYNOM
 .I <input> <a0> <a1>
-.RI [ <a2> \~[ <a3> \~[ <a4> \~[ <a5> ]]]]
+.RI [ <a2> " [" <a3> " [" <a4> " [" <a5> ]]]]
 .PP
 where
 .I <input>
@@ -660,45 +928,15 @@ is the input field code, and the order of the computed polynomial is determined
 by how many co-efficients are present in the specification.  The derived field
 is computed as:
 .IP
-field-name[n] = a0 + a1 * input[n] + a2 * input[n]**2 + a3 * input[n]**3 +
-a4 * input[n]**4 + a5 * input[n]**5
+fieldname = a0 + a1 * input + a2 * input**2 + a3 * input**3 + a4 * input**4
++ a5 * input**5
 .PP
 where
 .I **
-is the exponentiation operator, and the higher order terms are computed only
-if the corresponding co-efficients
+is the element-wise exponentiation operator, and the higher order terms are
+computed only if the corresponding co-efficients
 .RI a i
-are specified.  The coefficients, if specified, may be either literal numbers,
-or else the field code of a
-.B CONST
-or
-.B CARRAY
-field type containing the value.
-.RE
-.TP
-.B RECIP
-The RECIP vector field type computes the reciprocal of a single input vector
-field.  Syntax is:
-.RS
-.IP
-.I <field_name>
-.B RECIP
-.I <input> <dividend>
-.PP
-where
-.I <input>
-is the input field code and
-.I <dividend>
-is a scalar quantity.  The derived field is computed as:
-.IP
-field-name[n] = dividend / input[n].
-.PP
-The dividend, if specified, may be either literal numbers, or else the field
-code of a
-.B CONST
-or
-.B CARRAY
-field type containing the value.
+are specified.  POLYNOM appeared in Standards Version 7.
 .RE
 .TP
 .B RAW
@@ -707,7 +945,7 @@ field name should correspond to the name of the file containing the time stream.
 Syntax is:
 .RS
 .IP
-.I <field-name>
+.I <fieldname>
 .B RAW
 .I <type> <sample-rate>
 .PP
@@ -742,27 +980,38 @@ unsigned 64-bit integer
 .I INT64
 signed (two's complement) 64-bit integer
 .TP
-.IR FLOAT32 \~or\~ FLOAT
+.I FLOAT32
 IEEE-754 standard 32-bit single precision floating point number
 .TP
-.IR FLOAT64 \~or\~ DOUBLE
+.I FLOAT64
 IEEE-754 standard 64-bit double precision floating point number
 .TP
 .I COMPLEX64
 a 64-bit complex number consisting of two IEEE-754 standard 32-bit single
 precision floating point numbers representing the real and imaginary parts of
-the complex number.
+the complex number (Standards Version 7 and later)
 .TP
 .I COMPLEX128
 a 128-bit complex number consisting of two IEEE-754 standard 64-bit double
 precision floating point numbers representing the real and imaginary parts of
-the complex number.
+the complex number (Standards Version 7 and later).
 .RE
 
 For more information on the storage of complex valued data, see dirfile(5).
+Two additional type names exist:
+.I FLOAT
+is equivalent to
+.IR FLOAT32 ,
+and
+.I DOUBLE
+is equivalent to
+.IR FLOAT64 .
+Standards Version 9 deprecates these two aliases, but still allows them.
+
+All these type names (except those for complex data, which came later) were
+introduced in Standards Version 5.  Earlier Standards Versions specified data
+types with single character type aliases:
 
-For backwards compatibility, implementations should also recognise the following
-single character type aliases in use prior to Standards Version 5:
 .RS
 .TP
 .I c
@@ -777,31 +1026,43 @@ INT16
 .I U
 UINT32
 .TP
-.IR i ,\~ S
+.IR i ", " S
 INT32
 .TP
-.IR f
+.I f
 FLOAT32
 .TP
-.IR d
+.I d
 FLOAT64
 .RE
 
 Types
-.IR INT8 ,\~ UINT64 ,\~ INT64 ,\~ COMPLEX64 ,
+.IR INT8 ", " UINT64 ", " INT64 ", " COMPLEX64 ,
 and
 .I COMPLEX128
 are not supported before Standards Version 5, so no single character type
-aliases exist for these types.  Standards Version 8 removed support for these
-single character type codes.
-
-The
-.I sample-rate
-parameter may be either a literal number, or else the name of a
-.B CONST
-or
-.B CARRAY
-field type containing its values.
+aliases exist for these types.  These single character type aliases were
+deprecated in Standards Version 5 and removed in Standards Version 8.
+.RE
+.TP
+.B RECIP
+The RECIP vector field type computes the reciprocal of a single input vector
+field.  Syntax is:
+.RS
+.IP
+.I <field_name>
+.B RECIP
+.I <input> <dividend>
+.PP
+where
+.I <input>
+is the input field code and
+.I <dividend>
+is a scalar quantity.  The derived field is computed as:
+.IP
+fieldname = dividend / input.
+.PP
+RECIP appeared in Standards Version 8.
 .RE
 .TP
 .B SBIT
@@ -809,12 +1070,12 @@ The SBIT vector field type extracts one or more bits out of an input vector
 field as a signed number.  Syntax is:
 .RS
 .IP
-.I <field-name>
+.I <fieldname>
 .B SBIT
-.I <input> <first-bit> [<bits>]
+.I <input> <first-bit> \fR[\fI<bits>\fR]
 .PP
 which specifies
-.I field-name
+.I fieldname
 to be the value of bits
 .I first-bit
 through
@@ -826,15 +1087,10 @@ when
 is converted from its native type to a (endianness corrected) signed 64-bit
 integer.  If
 .I bits
-is omitted, it is assumed to be 1.  Both
-.IR first-bit " and " bits
-may be either literal numbers, or else the field code of a
-.B CONST
-or
-.B CARRAY
-field type containing their values.  The
+is omitted, it is assumed to be 1.  The
 .B BIT
-field type is an unsigned version of this field type.
+field type is an unsigned version of this field type.  SBIT appeared in
+Standards Version 7.
 .RE
 .TP
 .B STRING
@@ -842,7 +1098,7 @@ The STRING scalar field type is a character string fully specified in the format
 file metadata.  Syntax is:
 .RS
 .IP
-.I <field-name>
+.I <fieldname>
 .B STRING
 .I <value>
 .PP
@@ -856,12 +1112,103 @@ in quotation marks
 .RB ( """" ),
 or else escape the whitespace with the backslash character
 .RB ( \e ).
+STRING appeared in Standards Version 6.
+.RE
+.TP
+.B WINDOW
+The WINDOW vector field type isolates a portion of an input vector based on a 
+comparison.  Syntax is:
+.RS
+.IP
+.I <fieldname>
+.B WINDOW
+.I <input> <check> <op> <threshold>
+.PP
+where
+.I input
+is the vector containing the data to extract,
+.I check
+is the vector on which to test the comparison,
+.I threshold
+is the value against which
+.I check
+is compared, and
+.I op
+is one of the following tokens indicating the particular comparison performed:
+.RS
+.TP
+.I EQ
+data are extracted where
+.IR check ,
+converted to a 64-bit signed integer, equals
+.IR threshold ,
+.TP
+.I GE
+data are extracted where
+.IR check ,
+converted to a 64-bit floating-point number, is greater than or equal to
+.IR threshold ,
+.TP
+.I GT
+data are extracted where
+.IR check ,
+converted to a 64-bit floating-point number, is strictly greater than
+.IR threshold ,
+.TP
+.I LE
+data are extracted where
+.IR check ,
+converted to a 64-bit floating-point number, is less than or equal to
+.IR threshold ,
+.TP
+.I LT
+data are extracted where
+.IR check ,
+converted to a 64-bit floating-point number, is strictly less than
+.IR threshold ,
+.TP
+.I NE
+data are extracted where
+.IR check ,
+converted to a 64-bit signed integer, is not equal to
+.IR threshold ,
+.TP
+.I SET
+data are extracted where at least one bit set in
+.IR threshold
+is also set in
+.IR check ,
+when converted to a 64-bit unsigned integer,
+.TP
+.I CLR
+data are extracted where at least one bit set in
+.IR threshold
+is not set in
+.IR check ,
+when converted to a 64-bit unsigned integer,
+.RE
+.PP
+The storage type of
+.I threshold
+depends on the operator, and follows the interpretation of
+.IR check .
+It may never be complex valued.
+.PP
+Outside the region extracted, the value of the derived field is implementation
+dependent.
+.PP
+Note: with the
+.B EQ
+operator, this derived field type is very similar to the MPLEX field type above.
+The primary difference is that MPLEX mandates the value of the derived field
+outside the extracted region, while WINDOW does not.  WINDOW appeared in
+Standards Version 9.
 .RE
 
 .SS Field Parameters
 All input vector field parameters should be
 .I field codes
-(see below).  Additionally, some of the numerical field parameters may be either
+(see below).  Additionally, the scalar field parameters listed may be either
 literal numbers or else the
 .I field code
 of a
@@ -878,14 +1225,44 @@ element index, then a right angle bracket
 .RI ( > ),
 that is:
 .IP
-.IB field_code < n >
+.IB fieldcode < n >
 .PP
-Parameters which allow non-literal values are indicated above.  If the angle
+If the angle
 brackets and element index are omitted from a
 .B CARRAY
 field code used as a parameter, the first element in the field (index zero) is
 assumed.
-
+.PP
+Field parameters which may be specified using a scalar field code are:
+.RS
+.TP
+.BR BIT ", " SBIT
+.IR bitnum ", " numbits
+.TP
+.B LINCOM
+any of the
+.IR m "i, or " b i
+.TP
+.B MPLEX
+.IR count ", " max
+.TP
+.B PHASE
+.I shift
+.TP
+.B POLYNOM
+any of the
+.IR a i
+.TP
+.B RAW
+.I spf
+.TP
+.B RECIP
+.I dividend
+.TP
+.B WINDOW
+.I threshold
+.RE
+.PP
 Since it is possible to create a field code which is identical to a literal
 number, a parameter is assumed to be the field code of a scalar field only if
 the entire token cannot be parsed as a literal number using the rules outlined
@@ -896,12 +1273,12 @@ For example, a
 field whose field code consists solely of digits can never be used as a
 parameter in a field specification line.
 
-A literal complex number is specified as two real (floating point) numbers
-separated by a semicolon
+Starting in Standards Version 7, literal complex number is specified as two
+real (floating point) numbers separated by a semicolon
 .RB ( ; )
 with no intervening whitespace.  So, for example, the tokens
 .IP
-1;0 0;1 4;0 0;5 9.313e2;74.1
+1;0 \t 0;1 \t 4;0 \t 0;5 \t 9.313e2;74.1
 .PP
 represent, respectively, the real unit, the imaginary unit, the real number
 four, the imaginary number
@@ -927,6 +1304,50 @@ specification:
 1 0
 .I im
 0;1 0
+.PP
+Starting in Standards Version 9, in additional to decimal notation, literal
+integer parameters may be specified as hexadecimal numbers, by prefixing the
+number (after an optional
+.RB ' + '
+or
+.RB ' - '
+sign) with
+.B 0x
+or
+.BR 0X ,
+or as octal numbers, by prefixing the number with
+.BR 0 ,
+as described in
+.BR strtol (3).
+Similarly, floating point literal numbers (both purely real ones and
+components of complex literals) may be specified in hexadecimal by prefixing
+them with
+.B 0x
+or
+.BR 0X ,
+and using
+.B p
+or
+.B P
+as the binary exponent prefix, as described in the C99 standard.  Both uppercase
+and lowercase hexadecimal digits may be used.  In cases where a literal
+floating point number may apear, the tokens
+.B INF
+or
+.BR INFINITY ,
+optionally preceded by a
+.RB ' + '
+or
+.RB ' - '
+sign, and
+.BR NAN ,
+optionally immediately followed by
+.RB ' ( ',
+then a sequence of characters, then
+.RB ' ) ',
+and all disregarding case, will be interpreted as the special floating point
+values explained in
+.BR strtod (3).
 
 .SS Field Codes
 When specifying the input to a field, either as a scalar parameter, or as an
@@ -938,7 +1359,7 @@ are used.  A
 .I field code
 is one of:
 .IP \(bu 4
-a simple field name, indicating a vector or scalar field
+a simple field name, possibly an alias, indicating a vector or scalar field
 .IP \(bu 4
 a parent field name, followed by a forward slash, followed by a metafield name,
 indicating a metafield.  See the description of the
@@ -961,7 +1382,9 @@ This representation indicates the angle (in radians) between the positive real
 axis and the value (ie. the complex argument).  The argument is in the range
 [-pi, pi], and a branch cut exists along the negative real axis.  At the branch
 cut, -pi is returned if the imaginary part is -0, and pi is returned if the
-imaginary part is +0.  If z=0, zero is returned.
+imaginary part is +0.  If
+.IR z =0,
+zero is returned.
 .TP
 .B .i
 This representation indicates the projection of the value onto the imaginary
@@ -980,7 +1403,7 @@ if the imaginary part was equal to +0.  For example, given a complex valued
 vector,
 .IR z ,
 a vector containing the real part of
-.IR z ,\~  re_z ,
+.IR z ", "  re_z ,
 could be produced with:
 .IP
 .I re_z
@@ -996,9 +1419,33 @@ could be used wherever
 .I re_z
 would be.)
 
-.SH STANDARDS VERSIONS
+.SH HISTORY
 
-This document describes Version 8 of the Dirfile Standards.
+This document describes Versions 9 and earlier of the Dirfile Standards.
+
+Version 9 of the Standards (April 2012) added the
+.B MPLEX
+and
+.B WINDOW
+field types, the
+.B /ALIAS
+and
+.B /HIDDEN
+directives, the affixes to
+.BR /INCLUDE ,
+the 
+.BR sie ", " zzip ,
+and
+.B zzslim
+encoding schemes, along with the optional
+.I enc_datum
+token to
+.BR /ENCODING .
+It permitted specification of integer literals in octal and hexadecimal.
+Finally, it deprecated the type aliases
+.I FLOAT
+and
+.IR DOUBLE .
 
 Version 8 of the Standards (November 2010) added the
 .BR DIVIDE ", " RECIP ,
@@ -1023,13 +1470,15 @@ introduced the data types
 and
 .IR COMPLEX64 ,
 along with the notion of
-.IR representations .
-Finally, it made the number of fields parameter for
+.IR representations ,
+and the
+.B lzma
+encoding scheme.  Finally, it made the number of fields parameter for
 .I LINCOM
 optional.
 
 Version 6 of the Standards (October 2008) added the
-.BR /ENCODING ,\~ /META ,\~ /PROTECT ", and " /REFERENCE
+.BR /ENCODING ", " /META ", " /PROTECT ", and " /REFERENCE
 directives, and the
 .B CONST
 and
@@ -1055,7 +1504,7 @@ and
 .BR ENDIAN ,
 slash demarcation of reserved words, and removed the restriction on field
 name length.  It introduced the data types
-.IR INT8 ,\~ INT64 ,
+.IR INT8 ", " INT64 ,
 and
 .IR UINT64 ,
 the new-style type specifiers, and increased the range of the
diff --git a/man/dirfile.5 b/man/dirfile.5
index a291e22..5658d88 100644
--- a/man/dirfile.5
+++ b/man/dirfile.5
@@ -13,9 +13,9 @@
 .\" Texts.  A copy of the license is included in the `COPYING.DOC' file
 .\" as part of this distribution.
 .\"
-.TH dirfile 5 "21 July 2010" "Standards Version 8" "DATA FORMATS"
+.TH dirfile 5 "1 April 2012" "Standards Version 9" "DATA FORMATS"
 .SH NAME
-dirfile \(em a filesystem based database format for time-ordered binary data
+dirfile \(em a filesystem-based database format for time-ordered binary data
 .SH DESCRIPTION
 The
 .I dirfile
@@ -126,12 +126,11 @@ purely real data.  See
 
 .SH AUTHORS
 
-The dirfile specification was developed by C. B. Netterfield
+The Dirfile format was developed by C. B. Netterfield
 .nh
 <netterfield at astro.utoronto.ca>.
 .hy 1
-
-The dirfile specification is now maintained by D. V. Wiebe
+It is now maintained by D. V. Wiebe
 .nh
 <getdata at ketiltrout.net>.
 .hy 1
diff --git a/man/dirfile2ascii.1 b/man/dirfile2ascii.1
index bc6a82f..68201f6 100644
--- a/man/dirfile2ascii.1
+++ b/man/dirfile2ascii.1
@@ -1,6 +1,6 @@
 .\" dirfile2ascii.1.  The dirfile2ascii man page.
 .\"
-.\" Copyright (C) 2010 D. V. Wiebe
+.\" Copyright (C) 2010, 2012 D. V. Wiebe
 .\"
 .\""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
 .\"
@@ -13,13 +13,13 @@
 .\" Texts.  A copy of the license is included in the `COPYING.DOC' file
 .\" as part of this distribution.
 .\"
-.TH dirfile2ascii 1 "30 November 2010" "Version 0.7.1" "GETDATA"
+.TH dirfile2ascii 1 "21 February 2012" "Version 0.8.0" "GETDATA"
 .SH NAME
 dirfile2ascii \(em output dirfile database vectors as ASCII text
 .SH SYNOPSIS
 .nh
 .ad l
-.TP
+.HP
 \fBdirfile2ascii\fR [ \fIOPTION\fR ]... \fIDIRFILE\fR
 .RB "[ [ " \-a " | " \-A " | " \-e " | " \-E " | " \-F " | " \-g " | " \-G " |"
 .BR \-o " | " \-i " | " \-u " | " \-x " | " \-X " ]"
@@ -129,7 +129,6 @@ data is read as 64-bit unsigned integers.
 No native support for printing complex data is provided.  This may be worked
 around by using dirfile(5) representation suffixes.  For example, the command
 .IP
-$
 .B dirfile2ascii
 .I DIRFILE
 .IB FIELD .r
@@ -139,6 +138,26 @@ will print the real and imaginary parts of the complex valued field
 .I FIELD
 in the first and second columns, respectively.
 
+.SH AUTHOR
+
+dirfile2ascii was written by Matthew Truch and D. V. Wiebe.
+
+.SH REPORTING BUGS
+
+Please send reports of bugs to getdata\-devel at lists.sourceforge.net
+
+The GetData home page: <http://getdata.sourceforge.net/>
+
+.SH COPYRIGHT
+
+Copyright \(co 2010 Matthew Truch.
+
+dirfile2ascii is licenced under the GNU LPGL version 2.1 or later.
+
+This is free software: you are free to change and redistribute it.
+There is NO WARRANTY, to the extent permitted by law.
+
 .SH SEE ALSO
+.BR defile (1),
 .BR dirfile (5),
 .BR printf (3)
diff --git a/man/gd_add.3 b/man/gd_add.3
index cc528cb..05dc71b 100644
--- a/man/gd_add.3
+++ b/man/gd_add.3
@@ -1,6 +1,6 @@
 .\" gd_add.3.  The gd_add man page.
 .\"
-.\" Copyright (C) 2008, 2009, 2010 D. V. Wiebe
+.\" Copyright (C) 2008, 2009, 2010, 2012 D. V. Wiebe
 .\"
 .\""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
 .\"
@@ -13,7 +13,7 @@
 .\" Texts.  A copy of the license is included in the `COPYING.DOC' file
 .\" as part of this distribution.
 .\"
-.TH gd_add 3 "30 November 2010" "Version 0.7.1" "GETDATA"
+.TH gd_add 3 "26 July 2012" "Version 0.8.1" "GETDATA"
 .SH NAME
 gd_add, gd_madd \(em add a field to a dirfile
 .SH SYNOPSIS
@@ -30,7 +30,7 @@ gd_add, gd_madd \(em add a field to a dirfile
 .SH DESCRIPTION
 The
 .BR gd_add ()
-function adds the field described by 
+function adds the field described by
 .I entry
 to the dirfile specified by
 .IR dirfile .
@@ -58,16 +58,22 @@ specifies a
 .B STRING
 field, the field data will be set to the empty string.
 
-When adding a metafield, the
+A metafield may be added either by calling
+.BR gd_madd ()
+with
 .IR entry -> field
-member should contain just the metafield's name, not the fully formed
+containing only the metafield's name, or else by calling
+.BR gd_add ()
+with the fully formed
 .IB <parent-field> / <meta-field>
-field code.  Also,
-.BR gd_madd ()
-ignores the value of
-.IR entry -> fragment_index ,
-and instead adds the new meta field to the same format specification fragment in
-which the parent field is defined.
+field code in
+.IR entry -> field .
+Regardless of which interface is used, when adding a metafield the value of
+.IR entry -> fragment_index
+is ignored and GetData will add the new metafield to the same format
+specification fragment in which the parent field is defined.  If the specified
+parent field name is an alias, the canonical name of the field will be
+substituted.
 
 Fields added with this interface may contain either literal parameters or
 parameters based on scalar fields.  If an element of the
@@ -100,7 +106,8 @@ The library was unable to allocate memory.
 .B GD_E_BAD_CODE
 The field name provided in
 .IR entry -> field
-contained invalid characters. Alternately, the
+contained invalid characters; or it or an input field did not contain the
+affected fragment's prefix or suffix. Alternately, the
 .I parent
 field code was not found, or was already a metafield.
 .TP
@@ -128,7 +135,7 @@ entry, or the
 .IR entry -> const_type
 parameter provided with a
 .B CONST
-or 
+or
 .B CARRAY
 entry, was invalid.
 .TP
@@ -140,7 +147,7 @@ parameter provided with a
 entry was greater than GD_MAX_CARRAY_LENGTH.
 .TP
 .B GD_E_DUPLICATE
-The field name provided in 
+The field name provided in
 .IR entry -> field
 duplicated that of an already existing field.
 .TP
@@ -179,7 +186,7 @@ A descriptive error string for the last error encountered can be obtained from
 a call to
 .BR gd_error_string (3).
 .SH NOTES
-GetData artifically limits the number of elements in a
+GetData artificially limits the number of elements in a
 .B CARRAY
 to the value of the symbol GD_MAX_CARRAY_LENGTH defined in getdata.h.  This is
 done to be certain that the
diff --git a/man/gd_add_alias.3 b/man/gd_add_alias.3
new file mode 100644
index 0000000..de290ee
--- /dev/null
+++ b/man/gd_add_alias.3
@@ -0,0 +1,101 @@
+.\" gd_add_alias.3.  The gd_add_alias man page.
+.\"
+.\" Copyright (C) 2012 D. V. Wiebe
+.\"
+.\""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
+.\"
+.\" This file is part of the GetData project.
+.\"
+.\" Permission is granted to copy, distribute and/or modify this document
+.\" under the terms of the GNU Free Documentation License, Version 1.2 or
+.\" any later version published by the Free Software Foundation; with no
+.\" Invariant Sections, with no Front-Cover Texts, and with no Back-Cover
+.\" Texts.  A copy of the license is included in the `COPYING.DOC' file
+.\" as part of this distribution.
+.\"
+.TH gd_add_alias 3 "26 July 2012" "Version 0.8.1" "GETDATA"
+.SH NAME
+gd_add_alias, gd_madd_alias \(em add a field to a dirfile
+.SH SYNOPSIS
+.B #include <getdata.h>
+.HP
+.nh
+.ad l
+.BI "int gd_add_alias(DIRFILE *" dirfile ", const char *" alias_name ,
+.BI "const char *" target_code ", int " fragment_index );
+.HP
+.BI "int gd_madd_alias(DIRFILE *" dirfile ", const char *" parent ,
+.BI "const char *" alias_name ", const char *" target_code );
+.hy
+.ad n
+.SH DESCRIPTION
+The
+.BR gd_add_alias ()
+function adds the alias named
+.I alias_name
+pointing to
+.I target_code
+to the fragment indexed by
+.I fragment_index
+in the dirfile specified by
+.IR dirfile .
+The
+.BR gd_madd_alias ()
+function behaves similarly, but adds the field as a meta-entry under the field
+indicated by the field code
+.IR parent .
+
+.SH RETURN VALUE
+On success,
+.BR gd_add_alias ()
+and
+.BR gd_madd_alias ()
+return zero.   On error, -1 is returned and the dirfile error is set to a
+non-zero error value.  Possible error values are:
+.TP 8
+.B GD_E_ACCMODE
+The specified dirfile was opened read-only.
+.TP
+.B GD_E_ALLOC
+The library was unable to allocate memory.
+.TP
+.B GD_E_BAD_CODE
+The
+.IR alias_name
+contained invalid characters; or it or an input field did not contain the
+affected fragment's prefix or suffix. Alternately, the
+.I parent
+field code was not found, or was already a metafield.
+.TP
+.B GD_E_BAD_DIRFILE
+The supplied dirfile was invalid.
+.TP
+.B GD_E_BAD_INDEX
+The
+.I fragment_index
+specified was out of range.
+.TP
+.B GD_E_DUPLICATE
+The
+.I alias_name
+parameter duplicated that of an already existing entry.
+.TP
+.B GD_E_PROTECTED
+The metadata of the fragment was protected from change.  Or, the creation of a
+.B RAW
+field was attempted and the data of the fragment was protected.
+.PP
+The dirfile error may be retrieved by calling
+.BR gd_error (3).
+A descriptive error string for the last error encountered can be obtained from
+a call to
+.BR gd_error_string (3).
+
+.SH SEE ALSO
+.BR gd_add (3),
+.BR gd_alias_target (3),
+.BR gd_entry (3),
+.BR gd_madd (3),
+.BR gd_metaflush (3),
+.BR gd_open (3),
+.BR dirfile-format (5)
diff --git a/man/gd_add_bit.3 b/man/gd_add_bit.3
index 27f4b39..c3eb543 100644
--- a/man/gd_add_bit.3
+++ b/man/gd_add_bit.3
@@ -1,6 +1,6 @@
 .\" gd_add_bit.3.  The gd_add_bit man page.
 .\"
-.\" Copyright (C) 2008, 2009, 2010 D. V. Wiebe
+.\" Copyright (C) 2008, 2009, 2010, 2012 D. V. Wiebe
 .\"
 .\""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
 .\"
@@ -13,7 +13,7 @@
 .\" Texts.  A copy of the license is included in the `COPYING.DOC' file
 .\" as part of this distribution.
 .\"
-.TH gd_add_bit 3 "3 November 2010" "Version 0.7.0" "GETDATA"
+.TH gd_add_bit 3 "26 July 2012" "Version 0.8.1" "GETDATA"
 .SH NAME
 gd_add_bit, gd_add_carray gd_add_clincom, gd_add_const, gd_add_cpolynom,
 gd_add_crecip, gd_add_divide, gd_add_lincom, gd_add_linterp, gd_add_multiply,
@@ -26,7 +26,7 @@ gd_add_string
 .nh
 .ad l
 .BI "int gd_add_bit(DIRFILE *" dirfile ", const char *" field_name ,
-.BI "const char *" in_field ", gd_bit_t " bitnum ", gd_bit_t " numbits ,
+.BI "const char *" in_field ", int " bitnum ", int " numbits ,
 .BI "int " fragment_index );
 .HP
 .BI "int gd_add_carray(DIRFILE *" dirfile ", const char *" field_name ,
@@ -43,7 +43,7 @@ gd_add_string
 .HP
 .BI "int gd_add_cpolynom(DIRFILE *" dirfile ", const char *" field_name ,
 .BI "int " poly_ord ", const char *" in_fields ", const double complex *" ca ,
-.BI int " fragment_index );
+.BI "int " fragment_index );
 .HP
 .BI "int gd_add_crecip(DIRFILE *" dirfile ", const char *" field_name ,
 .BI "const char *" in_field ", double complex " cdividend ,
@@ -60,6 +60,10 @@ gd_add_string
 .BI "int gd_add_linterp(DIRFILE *" dirfile ", const char *" field_name ,
 .BI "const char *" in_field ", const char *" table ", int " fragment_index );
 .HP
+.BI "int gd_add_mplex(DIRFILE *" dirfile ", const char *" field_name ,
+.BI "const char *" in_field ", const char *" count_field ,
+.BI "int " count_val ", int " period ", int " fragment_index );
+.HP
 .BI "int gd_add_multiply(DIRFILE *" dirfile ", const char *" field_name ,
 .BI "const char *" in_field1 ", const char *" in_field2 ,
 .BI "int " fragment_index );
@@ -72,17 +76,21 @@ gd_add_string
 .BI int " fragment_index );
 .HP
 .BI "int gd_add_raw(DIRFILE *" dirfile ", const char *" field_name ,
-.BI "gd_type_t " data_type ", gd_spf_t " spf ", int " fragment_index );
+.BI "gd_type_t " data_type ", unsigned int " spf ", int " fragment_index );
 .HP
 .BI "int gd_add_recip(DIRFILE *" dirfile ", const char *" field_name ,
 .BI "const char *" in_field ", double " dividend ", int " fragment_index );
 .HP
 .BI "int gd_add_sbit(DIRFILE *" dirfile ", const char *" field_name ,
-.BI "const char *" in_field ", gd_bit_t " bitnum ", gd_bit_t " numbits ,
+.BI "const char *" in_field ", int " bitnum ", int " numbits ,
 .BI "int " fragment_index );
 .HP
 .BI "int gd_add_string(DIRFILE *" dirfile ", const char *" field_name ,
 .BI "const char *" value ", int " fragment_index );
+.HP
+.BI "int gd_add_window(DIRFILE *" dirfile ", const char *" field_name ,
+.BI "const char *" in_field ", const char *" check_field ", gd_windop_t"
+.IB windop ", gd_triplet_t " threshold ", int " fragment_index );
 .hy
 .ad n
 .SH DESCRIPTION
@@ -139,14 +147,15 @@ containing the polynomial co-efficients
 .RI ( a " or " ca ).
 
 The
-.BR gd_add_string (),\~ gd_add_carry (),
+.BR gd_add_string (),
+.BR gd_add_carry (),
 and
 .BR gd_add_const ()
 functions add the field and set the value of the field to
 .IR value .
 For
 .BR gd_add_const ()
-and 
+and
 .BR gd_add_carray (),
 the
 .I const_type
@@ -156,12 +165,45 @@ specifies the data type of the value pointed to by
 .IR value .
 
 The
-.B gd_bit_t
-type is a signed 16-bit integer type.  The
 .B gd_shift_t
 type is a signed 64-bit integer type.  The
-.B gd_spf_t
-type is an unsigned 16-bit integer type.
+.B gd_triplet_t
+type is defined as:
+.PP
+.in +4n
+.nf
+.fam C
+typedef union {
+  gd_int64_t i;
+  gd_uint64_t u;
+  double r;
+} gd_triplet_t;
+.fam
+.fi
+.in
+.PP
+Which element of this
+.B gd_triplet_t
+union to set depends on the operator selected for the
+.B WINDOW
+field.  See
+.BR gd_entry (3)
+for details.
+.PP
+A metafield may be added to the dirfile either by calling these functions with
+.I field_name
+containing the fully formed
+.IB <parent-field> / <meta-field>
+field code, or else by using the corresponding
+.BR gd_madd_ ...()
+function (see
+.BR gd_madd_bit (3),
+&c.) When adding a metafield with these functions,
+.I fragment_index
+is ignored and GetData will add the new metafield to the same format
+specification fragment in which the parent field is defined.  If the specified
+parent field name is an alias, the canonical name of the field will be
+substituted.
 
 All fields added with this interface must contain literal parameters.  Fields
 with scalar fields as parameters cannot be added with these functions.  Those
@@ -173,13 +215,13 @@ or
 See
 .B NOTES
 below for information on using
-.BR gd_add_clincom (),\~ gd_add_carray (),
-and 
-.BR gd_add_cpolynom ()
+.BR gd_add_clincom ()", " gd_add_cpolynom (),
+and
+.BR gd_add_crecip ()
 in the C89 GetData API.
 
 .SH RETURN VALUE
-On success, any of these functions returns zero.   On error, -1 is returned and 
+On success, any of these functions returns zero.   On error, -1 is returned and
 the dirfile error is set to a non-zero error value.  Possible error values are:
 .TP 8
 .B GD_E_ACCMODE
@@ -191,7 +233,8 @@ The library was unable to allocate memory.
 .B GD_E_BAD_CODE
 The
 .IR field_name
-argument contained invalid characters.
+contained invalid characters; or it or an input field did not contain the
+affected fragment's prefix or suffix.
 .TP
 .B GD_E_BAD_DIRFILE
 The supplied dirfile was invalid.
@@ -259,7 +302,7 @@ a call to
 .BR gd_error_string (3).
 
 .SH NOTES
-GetData artifically limits the number of elements in a
+GetData artificially limits the number of elements in a
 .B CARRAY
 to the value of the symbol GD_MAX_CARRAY_LENGTH defined in getdata.h.  This is
 done to be certain that the
@@ -268,13 +311,14 @@ won't overrun the line when flushed to disk.  On a 32-bit system, this number
 is 2**24.  It is larger on a 64-bit system.
 
 The C89 GetData API provides different prototypes for
-.BR gd_add_clincom (),\~ gd_add_cpolynom (),
+.BR gd_add_clincom ()", " gd_add_cpolynom (),
 and
 .BR gd_add_crecip ():
 .PP
 .nf
 .B #define GD_C89_API
 .B #include <getdata.h>
+.fi
 .HP
 .nh
 .ad l
@@ -291,10 +335,9 @@ and
 .BI "int " fragment_index );
 .hy
 .ad n
-.fi
 .PP
 In this case, the array pointers passed as
-.IR cm ,\~ cb
+.IR cm ", " cb
 or
 .IR ca
 should have twice as many (purely real) elements, consisting of alternating
@@ -313,6 +356,7 @@ parameter becomes a double precision array of length two.
 .SH SEE ALSO
 .BR gd_add (3),
 .BR gd_add_spec (3),
+.BR gd_entry (3),
 .BR gd_error (3),
 .BR gd_error_string (3),
 .BR gd_madd_bit (3),
@@ -321,12 +365,14 @@ parameter becomes a double precision array of length two.
 .BR gd_madd_divide (3),
 .BR gd_madd_lincom (3),
 .BR gd_madd_linterp (3),
+.BR gd_madd_mplex (3),
 .BR gd_madd_multiply (3),
 .BR gd_madd_phase (3),
 .BR gd_madd_polynom (3),
 .BR gd_madd_recip (3),
 .BR gd_madd_sbit (3),
 .BR gd_madd_string (3),
+.BR gd_madd_window (3),
 .BR gd_metaflush (3),
 .BR gd_open (3),
 .BR dirfile-format (5)
diff --git a/man/gd_alias_target.3 b/man/gd_alias_target.3
new file mode 100644
index 0000000..9565130
--- /dev/null
+++ b/man/gd_alias_target.3
@@ -0,0 +1,81 @@
+.\" gd_alias_target.3.  The gd_alias_target man page.
+.\"
+.\" Copyright (C) 2012 D. V. Wiebe
+.\"
+.\""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
+.\"
+.\" This file is part of the GetData project.
+.\"
+.\" Permission is granted to copy, distribute and/or modify this document
+.\" under the terms of the GNU Free Documentation License, Version 1.2 or
+.\" any later version published by the Free Software Foundation; with no
+.\" Invariant Sections, with no Front-Cover Texts, and with no Back-Cover
+.\" Texts.  A copy of the license is included in the `COPYING.DOC' file
+.\" as part of this distribution.
+.\"
+.TH gd_alias_target 3 "1 January 2012" "Version 0.8.0" "GETDATA"
+.SH NAME
+gd_alias_target \(em return the target of an alias defined in a dirfile database
+.SH SYNOPSIS
+.B #include <getdata.h>
+.HP
+.nh
+.ad l
+.BI "const char *gd_alias_target(DIRFILE *" dirfile ,
+.BI "const char *" alias_name );
+.hy
+.ad n
+.SH DESCRIPTION
+The
+.BR gd_alias_target ()
+function queries a dirfile(5) database specified by
+.I dirfile
+and returns the target field code of the alias specified by
+.IR alias_name .
+
+The
+.I dirfile
+argument must point to a valid DIRFILE object previously created by a call to
+.BR gd_open (3).
+
+Note: the target may itself be the an alias, which will have its own target.  To
+obtain the canonical name of the field ultimately referenced by
+.IR alias_name ,
+pass it to
+.BR gd_entry (3)
+and inspect the
+.I field
+member of the gd_entry_t structure returned.
+
+.SH RETURN VALUE
+Upon successful completion,
+.BR gd_alias_target ()
+returns a pointer to a read-only character string containing the name of the
+target of the specified alias.  On error,
+.BR gd_alias_target ()
+returns NULL and sets the dirfile error a non-zero error value.  Possible error
+values are:
+.TP 8
+.B GD_E_BAD_CODE
+The name
+.I alias_name
+was not found in the dirfile.
+.B GD_E_BAD_DIRFILE
+The supplied dirfile was invalid.
+.TP
+.B GD_E_BAD_FIELD_TYPE
+The entry specified by
+.I alias_name
+was not an alias.
+.PP
+The dirfile error may be retrieved by calling
+.BR gd_error (3).
+A descriptive error string for the last error encountered can be obtained from
+a call to
+.BR gd_error_string (3).
+
+.SH SEE ALSO
+.BR gd_aliases (3),
+.BR gd_entry (3),
+.BR gd_open (3),
+.BR dirfile (5)
diff --git a/man/gd_aliases.3 b/man/gd_aliases.3
new file mode 100644
index 0000000..1a476a4
--- /dev/null
+++ b/man/gd_aliases.3
@@ -0,0 +1,84 @@
+.\" gd_aliases.3.  The gd_aliases man page.
+.\"
+.\" Copyright (C) 2012 D. V. Wiebe
+.\"
+.\""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
+.\"
+.\" This file is part of the GetData project.
+.\"
+.\" Permission is granted to copy, distribute and/or modify this document
+.\" under the terms of the GNU Free Documentation License, Version 1.2 or
+.\" any later version published by the Free Software Foundation; with no
+.\" Invariant Sections, with no Front-Cover Texts, and with no Back-Cover
+.\" Texts.  A copy of the license is included in the `COPYING.DOC' file
+.\" as part of this distribution.
+.\"
+.TH gd_aliases 3 "1 January 2012" "Version 0.8.0" "GETDATA"
+.SH NAME
+gd_aliases \(em retrieve a list of aliases for a field in a dirfile database
+.SH SYNOPSIS
+.B #include <getdata.h>
+.HP
+.nh
+.ad l
+.BI "const char **gd_aliases(DIRFILE *" dirfile ", const char *" field_code );
+.hy
+.ad n
+.SH DESCRIPTION
+The
+.BR gd_aliases ()
+function queries a dirfile(5) database specified by
+.I dirfile
+and returns a read-only list of aliases of the field specified by
+.IR field_code .
+
+The
+.I dirfile
+argument must point to a valid DIRFILE object previously created by a call to
+.BR gd_open (3).
+
+The array returned will be de-allocated by a call to
+.BR gd_close (3)
+and should not be de-allocated by the caller.  The list returned should not be
+assumed to be in any particular order.  The array is terminated by a NULL
+pointer.  The number of strings in the array can be obtained from a call to
+.BR gd_naliases (3).
+
+The caller may not modify any strings in the array, or the array itself.  Doing
+so may cause database corruption.  The pointer returned is guaranteed to be
+valid until
+.BR gd_aliases ()
+is called again with the same arguments, or until the array is de-allocated by
+a call to
+.BR gd_close (3).
+
+.SH RETURN VALUE
+Upon successful completion,
+.BR gd_aliases ()
+returns a pointer to an array of strings containing the values of all the
+aliases for the specified field.  The array is terminated by a NULL pointer.
+If successful, this list will always contain at least one entry, to wit:
+.IR field_code .
+
+On error it returns NULL and sets the dirfile error to a non-zero error value.
+Possible error values are:
+.TP 8
+.B GD_E_ALLOC
+The library was unable to allocate memory.
+.TP
+.B GD_E_BAD_CODE
+The specified field code was not found in the database.
+.TP
+.B GD_E_BAD_DIRFILE
+The supplied dirfile was invalid.
+.PP
+The dirfile error may be retrieved by calling
+.BR gd_error (3).
+A descriptive error string for the last error encountered can be obtained from
+a call to
+.BR gd_error_string (3).
+.SH SEE ALSO
+.BR dirfile (5),
+.BR gd_open (3),
+.BR gd_alias_target (3),
+.BR gd_naliases (3)
diff --git a/man/gd_alter_affixes.3 b/man/gd_alter_affixes.3
new file mode 100644
index 0000000..3c0b890
--- /dev/null
+++ b/man/gd_alter_affixes.3
@@ -0,0 +1,112 @@
+.\" gd_alter_affixes.3.  The gd_alter_affixes man page.
+.\"
+.\" Copyright (C) 2012 D. V. Wiebe
+.\"
+.\""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
+.\"
+.\" This file is part of the GetData project.
+.\"
+.\" Permission is granted to copy, distribute and/or modify this document
+.\" under the terms of the GNU Free Documentation License, Version 1.2 or
+.\" any later version published by the Free Software Foundation; with no
+.\" Invariant Sections, with no Front-Cover Texts, and with no Back-Cover
+.\" Texts.  A copy of the license is included in the `COPYING.DOC' file
+.\" as part of this distribution.
+.\"
+.TH gd_alter_affixes 3 "1 January 2012" "Version 0.8.0" "GETDATA"
+.SH NAME
+gd_alter_affixes \(em modify the field affixes of a fragments in a dirfile
+.SH SYNOPSIS
+.B #include <getdata.h>
+.HP
+.nh
+.ad l
+.BI "int gd_alter_affixes(DIRFILE *" dirfile ", int " fragment_index ,
+.BI "const char *" prefix ", const char *" suffix );
+.hy
+.ad n
+.SH DESCRIPTION
+The
+.BR gd_alter_affixes ()
+function sets the field prefix and suffix of fields defined in the format
+specification fragment given by
+.I fragment_index
+to
+.I prefix
+and
+.I suffix
+in the dirfile(5) database specified by
+.IR dirfile .
+
+The field prefix and suffix are appended to all field codes found in the
+specified fragment.  If the parent fragment to the modified fragment contains
+field affixes themselves, they should be included in the affixes passed to
+.BR gd_alter_affixes ().
+See EXAMPLES below for further details.  If
+.I prefix
+or
+.I suffix
+is NULL, the corresponding affix will be unchanged.  To remove an affix, set it
+to the parent fragment's corresponding affix, which may be the empty string
+("").
+
+It is not possible to set affixes on the root format file (i.e.
+.I fragment_index
+may not be zero).
+
+The
+.I dirfile
+argument must point to a valid DIRFILE object previously created by a call to
+.BR gd_open (3).
+
+.SH RETURN VALUE
+Upon successful completion,
+.BR gd_alter_affixes ()
+returns zero.  On error, it returns -1 and sets the dirfile error to a non-zero
+error value.  Possible error values are:
+.TP 8
+.B GD_E_ACCMODE
+The specified dirfile was opened read-only.
+.TP
+.B GD_E_ALLOC
+The library was unable to allocate memory.
+.TP
+.B GD_E_BAD_CODE
+The supplied
+.I prefix
+or
+.I suffix
+contained invalid characters.
+.TP
+.B GD_E_BAD_DIRFILE
+The supplied dirfile was invalid.
+.TP
+.B GD_E_BAD_INDEX
+The supplied index was out of range.
+.TP
+.B GD_E_DUPLICATE
+The supplied affixes would result in one or more field codes duplicating an
+existing field code.
+.TP
+.B GD_E_PROTECTED
+The metadata of the given fragment's parent fragment was protected from
+change.
+.PP
+The dirfile error may be retrieved by calling
+.BR gd_error (3).
+A descriptive error string for the last error encountered can be obtained from
+a call to
+.BR gd_error_string (3).
+.SH EXAMPLES
+Dealing with affixes of parent fragments is relatively straightforward.  Say,
+for instance, fragment #1 has a prefix "A" and a suffix "B" and fragment #2 is
+included from fragment #1.  In this case any prefix for fragment #2 must end
+with "A" and any suffix for fragment #2 must begin with "B".
+.SH SEE ALSO
+.BR gd_open (3),
+.BR gd_error (3),
+.BR gd_error_string (3),
+.BR gd_fragment_affixes (3),
+.BR gd_include_affix (3),
+.BR dirfile (5),
+.BR dirfile-format (5)
diff --git a/man/gd_alter_bit.3 b/man/gd_alter_bit.3
index 7e061d5..98c6cfb 100644
--- a/man/gd_alter_bit.3
+++ b/man/gd_alter_bit.3
@@ -1,6 +1,6 @@
 .\" gd_alter_bit.3.  The gd_alter_bit man page.
 .\"
-.\" Copyright (C) 2008, 2009, 2010 D. V. Wiebe
+.\" Copyright (C) 2008, 2009, 2010, 2012 D. V. Wiebe
 .\"
 .\""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
 .\"
@@ -13,7 +13,7 @@
 .\" Texts.  A copy of the license is included in the `COPYING.DOC' file
 .\" as part of this distribution.
 .\"
-.TH gd_alter_bit 3 "3 November 2010" "Version 0.7.0" "GETDATA"
+.TH gd_alter_bit 3 "26 July 2012" "Version 0.8.1" "GETDATA"
 .SH NAME
 gd_alter_bit, gd_alter_carray, gd_alter_clincom, gd_alter_const,
 gd_alter_cpolynom, gd_alter_crecip, gd_alter_divide, gd_alter_lincom,
@@ -26,7 +26,7 @@ gd_alter_raw, gd_alter_recip, gd_alter_sbit
 .nh
 .ad l
 .BI "int gd_alter_bit(DIRFILE *" dirfile ", const char *" field_code ,
-.BI "const char *" in_field ", gd_bit_t " bitnum ", gd_bit_t " numbits );
+.BI "const char *" in_field ", int " bitnum ", int " numbits );
 .HP
 .BI "int gd_alter_carray(DIRFILE *" dirfile ", const char *" field_code ,
 .BI "gd_type_t " const_type ", size_t " array_len );
@@ -54,6 +54,10 @@ gd_alter_raw, gd_alter_recip, gd_alter_sbit
 .BI "int gd_alter_linterp(DIRFILE *" dirfile ", const char *" field_code ,
 .BI "const char *" in_field ", const char *" table ", int " rename_table );
 .HP
+.BI "int gd_alter_mplex(DIRFILE *" dirfile ", const char *" field_name ,
+.BI "const char *" in_field ", const char *" count_field ,
+.BI "int " count_val ", int " period );
+.HP
 .BI "int gd_alter_multiply(DIRFILE *" dirfile ", const char *" field_code ,
 .BI "const char *" in_field1 ", const char *" in_field2 );
 .HP
@@ -64,13 +68,17 @@ gd_alter_raw, gd_alter_recip, gd_alter_sbit
 .BI "int " poly_ord ", const char *" in_field ", const double *" ca );
 .HP
 .BI "int gd_alter_raw(DIRFILE *" dirfile ", const char *" field_code ,
-.BI "gd_type_t " data_type ", gd_spf_t " spf ", int " recode );
+.BI "gd_type_t " data_type ", unsigned int " spf ", int " recode );
 .HP
 .BI "int gd_alter_recip(DIRFILE *" dirfile ", const char *" field_code ,
 .BI "const char *" in_field ", double " dividend );
 .HP
 .BI "int gd_alter_sbit(DIRFILE *" dirfile ", const char *" field_code ,
-.BI "const char *" in_field ", gd_bit_t " bitnum ", gd_bit_t " numbits );
+.BI "const char *" in_field ", int " bitnum ", int " numbits );
+.HP
+.BI "int gd_alter_window(DIRFILE *" dirfile ", const char *" field_code ,
+.BI "const char *" in_field ", const char *" check_field ,
+.BI "gd_windop_t " windop ", gd_triplet_t " threshold );
 .hy
 .ad n
 .SH DESCRIPTION
@@ -89,12 +97,30 @@ types of other arguments may be obtained from the
 and
 .BR dirfile-format (5)
 manual pages.  The
-.B gd_bit_t
-type is a signed 16-bit integer type.  The
 .B gd_shift_t
 type is a signed 64-bit integer type.  The
-.B gd_spf_t
-type is an unsigned 16-bit integer type.
+.B gd_triplet_t
+type is defined as:
+.PP
+.in +4n
+.nf
+.fam C
+typedef union {
+  gd_int64_t i;
+  gd_uint64_t u;
+  double r;
+} gd_triplet_t;
+.fam
+.fi
+.in
+.PP
+Which element of this
+.B gd_triplet_t
+union to set depends on the operator selected for the
+.B WINDOW
+field.  See
+.BR gd_entry (3)
+for details.
 
 The
 .BR gd_alter_clincom ()
@@ -130,26 +156,28 @@ and
 .BR gd_alter_cpolynom ()
 take an array of length
 .I poly_ord
-+ 1
-containing the polynomial co-efficients
++ 1 containing the polynomial co-efficients
 .RI ( a " or " ca ).
 
 Some field parameters have special values which indicate no change should be
-made to the parameter.  Specifically, if any of the string parameters or 
-.IR m ,\~ b ", or " a
-.RI ( cm ,\~ cb ", or " ca )
-are NULL, the old values will be retained.  Similarly, if
-.IR spf ,\~ n_fields ,\~ numbits ,\~ cdividend ,
-or
-.I dividend
-is zero, or if
-.IR bitnum
-is -1, or if
-.IR data_type ", or " const_type
-are equal to
-.BR GD_NULL , 
-these parameters will not be modified.
-
+made to the parameter.  These special values are:
+.TP
+.B NULL\fR:
+any of the string parameters, also 
+.IR m ", " b ", " a ", " cm ", " cb ", or " ca ;
+.TP
+.B 0\fR:
+.IR spf ", " n_fields ", " numbits ", " cdividend ", or " dividend ;
+.TP
+.B -1\fR:
+.IR bitnum " or " period ;
+.TP
+.B GD_NULL\fR:
+.IR data_type " or " const_type ;
+.TP
+.B GD_WINDOP_UNK\fR:
+.IR windop .
+.PP
 All field parameters introduced with this interface must contain literal
 parameters.  Field parameters which are scalar fields cannot be introduced with
 these functions.  To do that, use
@@ -174,7 +202,7 @@ field will be re-encoded to reflect the new field parameters.
 See
 .B NOTES
 below for information on using
-.BR gd_alter_clincom (),\~ gd_alter_crecip (),
+.BR gd_alter_clincom "(), " gd_alter_crecip (),
 and 
 .BR gd_alter_cpolynom ()
 in the C89 GetData API.
@@ -193,7 +221,8 @@ The library was unable to allocate memory.
 .B GD_E_BAD_CODE
 The field specified by
 .I field_code
-was not found.
+was not found, or a supplied field code did not contain the appropriate prefix
+or suffix.
 .TP
 .B GD_E_BAD_DIRFILE
 The supplied dirfile was invalid.
@@ -246,13 +275,14 @@ a call to
 
 .SH NOTES
 The C89 GetData API provides different prototypes for
-.BR gd_alter_clincom (),\~ gd_alter_cpolynom (),
+.BR gd_alter_clincom "(), " gd_alter_cpolynom (),
 and
 .BR gd_alter_crecip ():
 .PP
 .nf
 .B #define GD_C89_API
 .B #include <getdata.h>
+.fi
 .HP
 .nh
 .ad l
@@ -267,10 +297,9 @@ and
 .BI "const char *" in_field ", double " cdividend [2]);
 .hy
 .ad n
-.fi
 .PP
 In this case, the array pointers passed as
-.IR cm ,\~ cb
+.IR cm ", " cb
 or
 .IR ca
 should have twice as many (purely real) elements, consisting of alternating
diff --git a/man/gd_alter_encoding.3.in b/man/gd_alter_encoding.3.in
index acd6011..9951113 100644
--- a/man/gd_alter_encoding.3.in
+++ b/man/gd_alter_encoding.3.in
@@ -54,12 +54,12 @@ argument should be one of the following:
 .BR GD_LZMA_ENCODED ,\~ GD_SLIM_ENCODED  ,\~ GD_TEXT_ENCODED .
 .ad n
 .hy
-.P
+.PP
 See
 .BR gd_cbopen (3)
 and dirfile-encoding(5) for the meanings of these symbols and details on the
 supported encoding schemes.
-.P
+.PP
 In addition to being simply a valid fragment index,
 .I fragment_index
 may also be the special value
@@ -116,7 +116,7 @@ The encoding scheme of the fragment is unknown.
 .TP
 .B GD_E_UNSUPPORTED
 The encoding scheme of the fragment does not support binary file recoding.
-.P
+.PP
 The dirfile error may be retrieved by calling
 .BR gd_error (3).
 A descriptive error string for the last error encountered can be obtained from
diff --git a/man/gd_alter_endianness.3.in b/man/gd_alter_endianness.3.in
index 190233d..bec720f 100644
--- a/man/gd_alter_endianness.3.in
+++ b/man/gd_alter_endianness.3.in
@@ -2,7 +2,7 @@
 .\"
 .\" @configure_input@
 .\"
-.\" Copyright (C) 2008, 2010 D. V. Wiebe
+.\" Copyright (C) 2008, 2010, 2012 D. V. Wiebe
 .\"
 .\""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
 .\"
@@ -15,7 +15,7 @@
 .\" Texts.  A copy of the license is included in the `COPYING.DOC' file
 .\" as part of this distribution.
 .\"
-.TH gd_alter_endianness 3 "21 October 2010" "Version 0.7.0" "GETDATA"
+.TH gd_alter_endianness 3 "1 January 2012" "Version 0.8.0" "GETDATA"
 .SH NAME
 gd_alter_endianness \(em modify the byte sex of fields in a dirfile
 .SH SYNOPSIS
@@ -61,7 +61,7 @@ Indicating that the byte sex should be little endian.
 .RB ( GD_BIG_ENDIAN " | " GD_LITTLE_ENDIAN )
 Indicating that the byte sex should be the opposite of the native endianness of
 the host, whichever that may be.
-.P
+.PP
 Furthermore, any of these may be bitwise or'd
 with
 .B GD_ARM_ENDIAN
@@ -69,7 +69,7 @@ or
 .B GD_NOT_ARM_ENDIAN
 indicating that the floating point data are stored in the ARM middle-endian
 format.
-.P
+.PP
 In addition to being simply a valid fragment index,
 .I fragment_index
 may also be the special value
@@ -99,6 +99,11 @@ The specified dirfile was opened read-only.
 .B GD_E_ALLOC
 The library was unable to allocate memory.
 .TP
+.B GD_E_ARGUMENT
+The supplied
+.I byte_sex
+was invalid.
+.TP
 .B GD_E_BAD_DIRFILE
 The supplied dirfile was invalid.
 .TP
@@ -126,7 +131,7 @@ The encoding scheme of the fragment is unknown.
 .TP
 .B GD_E_UNSUPPORTED
 The encoding scheme of the fragment does not support binary file byte swapping.
-.P
+.PP
 The dirfile error may be retrieved by calling
 .BR gd_error (3).
 A descriptive error string for the last error encountered can be obtained from
diff --git a/man/gd_alter_entry.3 b/man/gd_alter_entry.3
index a7f75be..48eeb31 100644
--- a/man/gd_alter_entry.3
+++ b/man/gd_alter_entry.3
@@ -1,6 +1,6 @@
 .\" gd_alter_entry.3.  The gd_alter_entry man page.
 .\"
-.\" Copyright (C) 2008, 2009, 2010 D. V. Wiebe
+.\" Copyright (C) 2008, 2009, 2010, 2012 D. V. Wiebe
 .\"
 .\""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
 .\"
@@ -13,7 +13,7 @@
 .\" Texts.  A copy of the license is included in the `COPYING.DOC' file
 .\" as part of this distribution.
 .\"
-.TH gd_alter_entry 3 "3 November 2010" "Version 0.7.0" "GETDATA"
+.TH gd_alter_entry 3 "26 July 2012" "Version 0.8.1" "GETDATA"
 .SH NAME
 gd_alter_entry \(em modify the metadata of a dirfile field
 .SH SYNOPSIS
@@ -173,8 +173,9 @@ The library was unable to allocate memory.
 .B GD_E_BAD_CODE
 The field specified by
 .I field_code
-was not found.  This error may also result from attempting to dereference a
-scalar field code which indicates a non-existent field.
+was not found or a supplied field code did not contain the appropriate prefix
+or suffix.  This error may also result from attempting to dereference a scalar
+field code which indicates a non-existent field.
 .TP
 .B GD_E_BAD_DIRFILE
 The supplied dirfile was invalid.
diff --git a/man/gd_alter_frameoffset.3.in b/man/gd_alter_frameoffset.3.in
index b917f67..521bcfd 100644
--- a/man/gd_alter_frameoffset.3.in
+++ b/man/gd_alter_frameoffset.3.in
@@ -109,7 +109,7 @@ The encoding scheme of the fragment is unknown.
 .TP
 .B GD_E_UNSUPPORTED
 The encoding scheme of the fragment does not support binary file shifting.
-.P
+.PP
 The dirfile error may be retrieved by calling
 .BR gd_error (3).
 A descriptive error string for the last error encountered can be obtained from
diff --git a/man/gd_alter_protection.3 b/man/gd_alter_protection.3
index cc69bdb..1025ece 100644
--- a/man/gd_alter_protection.3
+++ b/man/gd_alter_protection.3
@@ -1,6 +1,6 @@
 .\" gd_alter_protection.3.  The gd_alter_protection man page.
 .\"
-.\" Copyright (C) 2008, 2010 D. V. Wiebe
+.\" Copyright (C) 2008, 2010, 2012 D. V. Wiebe
 .\"
 .\""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
 .\"
@@ -13,7 +13,7 @@
 .\" Texts.  A copy of the license is included in the `COPYING.DOC' file
 .\" as part of this distribution.
 .\"
-.TH gd_alter_protection 3 "21 July 2010" "Version 0.7.0" "GETDATA"
+.TH gd_alter_protection 3 "1 January 2012" "Version 0.8.0" "GETDATA"
 .SH NAME
 gd_alter_protection \(em modify the protection level of a dirfile fragment
 .SH SYNOPSIS
@@ -72,6 +72,11 @@ error value.  Possible error values are:
 .B GD_E_ACCMODE
 The specified dirfile was opened read-only.
 .TP
+.B GD_E_ARGUMENT
+The supplied
+.I protection_level
+was invalid.
+.TP
 .B GD_E_BAD_DIRFILE
 The supplied dirfile was invalid.
 .TP
diff --git a/man/gd_alter_spec.3 b/man/gd_alter_spec.3
index 230a99c..5d11cf8 100644
--- a/man/gd_alter_spec.3
+++ b/man/gd_alter_spec.3
@@ -1,6 +1,6 @@
 .\" gd_alter_spec.3.  The gd_alter_spec man page.
 .\"
-.\" Copyright (C) 2008, 2010 D. V. Wiebe
+.\" Copyright (C) 2008, 2010, 2011 D. V. Wiebe
 .\"
 .\""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
 .\"
@@ -13,7 +13,7 @@
 .\" Texts.  A copy of the license is included in the `COPYING.DOC' file
 .\" as part of this distribution.
 .\"
-.TH gd_alter_spec 3 "21 July 2010" "Version 0.7.0" "GETDATA"
+.TH gd_alter_spec 3 "17 August 2011" "Version 0.8.0" "GETDATA"
 .SH NAME
 gd_alter_spec, gd_malter_spec \(em modify a field in a dirfile
 .SH SYNOPSIS
@@ -64,7 +64,7 @@ If the modified field is of type
 and the
 .I recode
 argument is non-zero, the look-up table file will be moved if
-.IR entry -> table
+.I line
 specifies a different path, overwriting an existing file with the new
 pathname, if present.  If the field specified by
 .I field_code
@@ -152,6 +152,12 @@ The dirfile error may be retrieved by calling
 A descriptive error string for the last error encountered can be obtained from
 a call to
 .BR gd_error_string (3).
+.SH BUGS
+If a
+.B CARRAY
+field with more than GD_MAX_CARRAY_LENGTH elements is provided, subsequent
+elements will be silently truncated.  GD_MAX_CARRAY_LENGTH is 2**24 on 32-bit
+systems.  It is larger on 64-bit systems.
 .SH SEE ALSO
 .BR gd_alter_bit (3),
 .BR gd_alter_const (3),
diff --git a/man/gd_bof.3 b/man/gd_bof.3
index 9c17f25..4355201 100644
--- a/man/gd_bof.3
+++ b/man/gd_bof.3
@@ -1,6 +1,6 @@
 .\" gd_bof.3.  The gd_bof man page.
 .\"
-.\" Copyright (C) 2010 D. V. Wiebe
+.\" Copyright (C) 2010, 2011 D. V. Wiebe
 .\"
 .\""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
 .\"
@@ -13,7 +13,7 @@
 .\" Texts.  A copy of the license is included in the `COPYING.DOC' file
 .\" as part of this distribution.
 .\"
-.TH gd_bof 3 "15 October 2010" "Version 0.7.0" "GETDATA"
+.TH gd_bof 3 "17 August 2011" "Version 0.8.0" "GETDATA"
 .SH NAME
 gd_bof \(em report the start of data in a field
 .SH SYNOPSIS
@@ -67,6 +67,9 @@ returns the sample number of the end-of-field marker for the indicated field.
 On error, it returns -1 and sets the dirfile error to a non-zero error value.
 Possible error values are:
 .TP 8
+.B GD_E_ALLOC
+The library was unable to allocate memory.
+.TP
 .B GD_E_BAD_CODE
 The field specified by
 .I field_code
@@ -88,6 +91,11 @@ or one of its inputs, or else
 .I field_code
 itself specified a scalar field.
 .TP
+.B GD_E_INTERNAL_ERROR
+An internal error occurred in the library while trying to perform the task.
+This indicates a bug in the library.  Please report the incident to the
+GetData developers.
+.TP
 .B GD_E_RECURSE_LEVEL
 Too many levels of recursion were encountered while trying to resolve
 .IR field_code .
diff --git a/man/gd_bof64.3 b/man/gd_bof64.3
new file mode 100644
index 0000000..1118b6c
--- /dev/null
+++ b/man/gd_bof64.3
@@ -0,0 +1,54 @@
+.\" gd_bof64.3.  The gd_bof64 man page.
+.\"
+.\" Copyright (C) 2012 D. V. Wiebe
+.\"
+.\""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
+.\"
+.\" This file is part of the GetData project.
+.\"
+.\" Permission is granted to copy, distribute and/or modify this document
+.\" under the terms of the GNU Free Documentation License, Version 1.2 or
+.\" any later version published by the Free Software Foundation; with no
+.\" Invariant Sections, with no Front-Cover Texts, and with no Back-Cover
+.\" Texts.  A copy of the license is included in the `COPYING.DOC' file
+.\" as part of this distribution.
+.\"
+.TH gd_bof64 3 "25 May 2012" "Version 0.8.0" "GETDATA"
+.SH NAME
+gd_bof64 \(em retrieve data from a dirfile database, with largefile support
+.SH SYNOPSIS
+.B #define GD_64BIT_API
+
+.B #include <getdata.h>
+.HP
+.nh
+.ad l
+.BI "gd_off64_t gd_bof64(DIRFILE *" dirfile ", const char *" field_code );
+.hy
+.ad n
+.SH DESCRIPTION
+This version of
+.BR gd_bof (3)
+uses a 64-bit offset type
+.RB ( gd_off64_t ),
+where one is available, regardless of the size of
+.BR off_t .
+It is only available if one defines
+.IR GD_64BIT_API
+or
+.IR _LARGEFILE64_SOURCE
+before including getdata.h.
+
+If
+.I off_t
+is a 64-bit type (possibly because
+.I _FILE_OFFSET_BITS
+has been defined to 64), this function will the same as
+.BR gd_bof (3).
+Otherwise,
+.BR gd_bof (3)
+will be a version of this function which uses a 32-bit
+.IR off_t .
+.SH SEE ALSO
+.BR gd_bof (3),
+.BR feature_test_macros (7)
diff --git a/man/gd_carray_len.3 b/man/gd_carray_len.3
index d6ea1e7..d26db17 100644
--- a/man/gd_carray_len.3
+++ b/man/gd_carray_len.3
@@ -1,6 +1,6 @@
 .\" gd_carray_len.3.  The gd_carray_len man page.
 .\"
-.\" Copyright (C) 2010 D. V. Wiebe
+.\" Copyright (C) 2010, 2011, 2012 D. V. Wiebe
 .\"
 .\""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
 .\"
@@ -13,7 +13,7 @@
 .\" Texts.  A copy of the license is included in the `COPYING.DOC' file
 .\" as part of this distribution.
 .\"
-.TH gd_carray_len 3 "3 November 2010" "Version 0.7.0" "GETDATA"
+.TH gd_carray_len 3 "4 July 2012" "Version 0.8.0" "GETDATA"
 .SH NAME
 gd_carray_len \(em returns the length of a CARRAY field in a dirfile
 .SH SYNOPSIS
@@ -30,12 +30,14 @@ The
 function queries a dirfile(5) database specified by
 .I dirfile
 and returns the number of length of the
+.B CONST
+or
 .B CARRAY
 field
 .IR field_code .
 If
 .I field_code
-contains a valid representation suffix, it will be ignored.  
+contains a valid representation suffix, it will be ignored.
 
 The 
 .I dirfile
@@ -45,9 +47,14 @@ argument must point to a valid DIRFILE object previously created by a call to
 .SH RETURN VALUE
 Upon successful completion,
 .BR gd_carray_len ()
-returns the length of the field specified.  On error, it returns zero and sets
-the dirfile error to a non-zero error value.  Possible error values are:
+returns the array length of the field specified.  (The length of a
+.B CONST
+field is always 1.)  On error, it returns zero and sets the dirfile error to a
+non-zero error value.  Possible error values are:
 .TP 8
+.B GD_E_ALLOC
+The library was unable to allocate memory.
+.TP
 .B GD_E_BAD_CODE
 The field specified by
 .I field_code
@@ -59,9 +66,10 @@ The supplied dirfile was invalid.
 .B GD_E_BAD_FIELD_TYPE
 The field specified by
 .I field_code
-was not of
-.B CARRAY
-type.
+was not a
+.B CONST
+or
+.BR CARRAY .
 .TP
 .B GD_E_BAD_REPR
 The representation suffix specified in
diff --git a/man/gd_carrays.3 b/man/gd_carrays.3
index cceb589..f79e5ab 100644
--- a/man/gd_carrays.3
+++ b/man/gd_carrays.3
@@ -1,6 +1,6 @@
-.\" gd_constants.3.  The gd_constants man page.
+.\" gd_carrays.3.  The gd_carrays man page.
 .\"
-.\" Copyright (C) 2010 D. V. Wiebe
+.\" Copyright (C) 2010, 2011 D. V. Wiebe
 .\"
 .\""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
 .\"
@@ -13,9 +13,9 @@
 .\" Texts.  A copy of the license is included in the `COPYING.DOC' file
 .\" as part of this distribution.
 .\"
-.TH gd_carrays 3 "3 November 2010" "Version 0.7.0" "GETDATA"
+.TH gd_carrays 3 "17 August 2011" "Version 0.8.0" "GETDATA"
 .SH NAME
-gd_constants \(em retrieve a list of CARRAY values from a dirfile
+gd_carrays \(em retrieve a list of CARRAY values from a dirfile
 .SH SYNOPSIS
 .B #include <getdata.h>
 .HP
@@ -123,6 +123,11 @@ The supplied dirfile was invalid.
 The
 .I return_type
 specified was invalid.
+.TP
+.B GD_E_INTERNAL_ERROR
+An internal error occurred in the library while trying to perform the task.
+This indicates a bug in the library.  Please report the incident to the
+GetData developers.
 .PP
 The dirfile error may be retrieved by calling
 .BR gd_error (3).
diff --git a/man/gd_cbopen.3 b/man/gd_cbopen.3
index 46b2f80..0484b60 100644
--- a/man/gd_cbopen.3
+++ b/man/gd_cbopen.3
@@ -1,6 +1,6 @@
 .\" gd_cbopen.3.  The gd_cbopen man page.
 .\"
-.\" Copyright (C) 2008, 2009, 2010 D. V. Wiebe
+.\" Copyright (C) 2008, 2009, 2010, 2011, 2012, 2013 D. V. Wiebe
 .\"
 .\""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
 .\"
@@ -13,7 +13,7 @@
 .\" Texts.  A copy of the license is included in the `COPYING.DOC' file
 .\" as part of this distribution.
 .\"
-.TH gd_cbopen 3 "3 November 2010" "Version 0.7.0" "GETDATA"
+.TH gd_cbopen 3 "3 April 2013" "Version 0.8.4" "GETDATA"
 .SH NAME
 gd_cbopen, gd_open \(em open or create a dirfile
 .SH SYNOPSIS
@@ -69,15 +69,15 @@ argument should include one of the
 (read-write), and may also contain zero or more of the following flags,
 bitwise-or'd together:
 .PP
-.B GD_ARM_ENDIAN
 .PD 0
+.B GD_ARM_ENDIAN
 .TP
 .PD
 .B GD_NOT_ARM_ENDIAN
-Specifies that double precision floating point raw data on disk is, or is not,
+Specifies that double precision floating point raw data on disk are, or are not,
 stored in the middle-endian format used by older ARM processors.
 
-These flag are only set the default endianness, and will be overridden when an
+These flag only set the default endianness, and will be overridden when an
 .B /ENDIAN
 directive specifies the byte sex of
 .B RAW
@@ -91,8 +91,8 @@ on all but middle-ended ARM systems)
 indicates the native behaviour of the platform.  That symbol will equal zero,
 and may be omitted.
 .PP
-.B GD_BIG_ENDIAN
 .PD 0
+.B GD_BIG_ENDIAN
 .TP
 .PD
 .B GD_LITTLE_ENDIAN
@@ -106,7 +106,7 @@ Specifying both these flags together will cause the library to assume that the
 endianness of the data is opposite to that of the native architecture, whatever
 that might be.
 
-These flag are only set the default endianness, and will be overridden when an
+These flag only set the default endianness, and will be overridden when an
 .B /ENDIAN
 directive specifies the byte sex of
 .B RAW
@@ -139,9 +139,10 @@ Ensure that this call creates a dirfile: when specified along with
 .BR GD_CREAT ,
 the call will fail if the dirfile specified by
 .I dirfilename
-already exists.  Behaviour of this flag is undefined if
+already exists.  If
 .B GD_CREAT
-is not specified.  This flag suffers from all the limitations of the
+is not specified, this flag is ignored.  This flag suffers from all the
+limitations of the
 .B O_EXCL
 flag as indicated in
 .BR open (2).
@@ -162,8 +163,8 @@ Specifies that
 directives (see
 .BR dirfile-format (5))
 found in the dirfile format specification should be ignored.  All raw data will
-be assumed to have the byte sex indicated through the presence or absense of the
-.BR GD_ARM_ENDIAN ,\~ GD_BIG_ENDIAN ,\~ GD_LITTLE_ENDIAN ,
+be assumed to have the byte sex indicated through the presence or absence of the
+.BR GD_ARM_ENDIAN ", " GD_BIG_ENDIAN ", " GD_LITTLE_ENDIAN ,
 and
 .B GD_NOT_ARM_ENDIAN
 flags.
@@ -197,10 +198,10 @@ directive.  See the
 section below for full details.
 .TP
 .B GD_PRETTY_PRINT
-When dirfile metadata is flushed to disk (either explicitly via
-.BR gd_metaflush (),\~ gd_rewrite_fragment (),
+When dirfile metadata are flushed to disk (either explicitly via
+.BR gd_metaflush "(3), " gd_rewrite_fragment (3),
 or 
-.BR gd_flush ()
+.BR gd_flush (3)
 or implicitly by closing the dirfile), an attempt will be made to create a
 nicer looking format specification (from a human-readable standpoint).  What
 this explicitly means is not part of the API, and any particular behaviour
@@ -222,23 +223,42 @@ containing a regular file called
 .BR format ,
 regardless of the content or form of that file.
 
-Truncation occurs by deleting every regular file in the specified directory,
-whether the files were referred to by the dirfile before truncation or not.
-Accordingly, this flag should be used with caution.  Subdirectories are
-left untouched.  Notably, this operation does not consider the presence of
-subdirfiles declared by
-.B INCLUDE
+Truncation occurs by deleting every regular file and symlink in the specified
+directory, whether the files were referred to by the dirfile before truncation
+or not.  Accordingly, this flag should be used with caution.  Unless
+.B GD_TRUNCSUB
+is also specified, subdirectories are left untouched.  Notably, this operation
+does not consider directories used in
+.B /INCLUDE
 directives.  If the dirfile does not exist, this flag is ignored.
 .TP
+.B GD_TRUNCSUB
+If specified along with
+.BR GD_TRUNC ,
+truncation will descend into subdirectories, deleting all regular files and
+symlinks recursively.  It does not descend into directories pointed to by
+symbolic links: in these cases, just the symlink itself is deleted.  If
+specified without an accompanying
+.BR GD_TRUNC ,
+this flag is ignored.
+.TP
 .B GD_VERBOSE
 Specifies that whenever an error is triggered by the library when working
 on this dirfile, the corresponding error string, which can be retrieved by
 calling 
 .BR gd_error_string (3),
-should be written on standard error by the library.  Without this flag,
-GetData writes nothing to standard error.  (GetData never writes to standard
-output.)
-
+should be written on the caller's standard error stream
+.RB ( stderr (3))
+by GetData.  The error string may be prefixed by a string specified by the
+caller; see
+.BR gd_verbose_prefix (3).
+Without this flag, GetData writes nothing to standard error.  (GetData never
+writes to standard output.)
+.PP
+Those flags which affect the operation of the library beyond this call itself
+may be modified later using the
+.BR gd_flags (3)
+function.
 .PP
 The
 .I flags
@@ -267,28 +287,47 @@ to create a previously non-existent raw field unless a read is first
 successfully performed on the dirfile.  Once the library has determined the
 encoding scheme for the first time, it remembers it for subsequent calls.
 .TP
-.B GD_BZIP2_ENDODED
+.B GD_BZIP2_ENCODED
 Specifies that raw data files are compressed using the Burrows-Wheeler block
 sorting text compression algorithm and Huffman coding, as implemented in the
 bzip2 format.
 .TP
-.B GD_GZIP_ENDODED
+.B GD_GZIP_ENCODED
 Specifies that raw data files are compressed using Lempel-Ziv coding (LZ77)
 as implemented in the gzip format.
 .TP
-.B GD_LZMA_ENDODED
+.B GD_LZMA_ENCODED
 Specifies that raw data files are compressed using the Lempel-Ziv Markov Chain
 Algorithm (LZMA) as implemented in the xz container format.
 .TP
 .B GD_SLIM_ENCODED
 Specifies that raw data files are compressed using the slimlib library.
 .TP
+.B GD_SIE_ENCODED
+Specified that raw data files are sample-index encoded, similar to run-length
+encoding, suitable for data that change rarely.
+.TP
 .B GD_TEXT_ENCODED
 Specifies that raw data files are encoded as text files containing one data
 sample per line.  
 .TP
 .B GD_UNENCODED
-Specifies that raw data files are not encoded, but written verbatim to disk.
+Specifies that raw data files are not encoded, but written as simply binary data
+to disk.
+.TP
+.B GD_ZZIP_ENCODED
+Specifies that raw data files are compressed using the DEFLATE algorithm.  All
+raw data files for a given fragment are collected together and stored in a PKZIP
+archive called raw.zip.
+.TP
+.B GD_ZZSLIM_ENCODED
+Specifies that raw data files are compressed using a combinations of compression
+schemes: first files are slim-compressed, as with the
+.B GD_SLIM_ENCODED
+scheme, and then they are collected together and compressed (again) into a PKZIP
+archive called raw.zip, as in the
+.B GD_ZZIP_ENCODED
+scheme.
 
 .SS Standards Compliance
 The latest Dirfile Standards Version which this release of GetData understands
@@ -302,9 +341,10 @@ manual page lists the changes between Standards Versions.
 The GetData parser can operate in two modes: a
 .I permissive
 mode, in which much
-non-Standards compliant syntax is allowed, and a
-.I pedanitc
-mode, in which the parser adheres strictly to the Standards.  If
+non-Standards-compliant syntax is allowed, and a
+.I pedantic
+mode, in which the parser adheres strictly to the Standards.  The mode made
+change during the parsing of a dirfile.  If
 .B GD_PEDANTIC
 is passed to
 .BR gd_cbopen (),
@@ -332,7 +372,7 @@ mode, actual syntax errors are still reported as such.
 
 In
 .I pedantic
-mode, the parser conforms to one specified Standards Version. This target
+mode, the parser conforms to one specific Standards Version. This target
 version may change any number of times in the course of scanning a single
 format specification.  If invoked using the
 .B GD_PEDANTIC
@@ -397,6 +437,7 @@ The
 type is a structure with at least the following members:
 
 .in +4n
+.fam C
 .nf
 typedef struct {
   const DIRFILE* dirfile;
@@ -409,6 +450,7 @@ typedef struct {
   ...
 } gd_parser_data_t;
 .fi
+.fam
 .in
 .PP
 The
@@ -425,6 +467,9 @@ The
 parameter will be one of the following symbols indicating the type of syntax
 error encountered:
 .TP
+.B GD_E_FORMAT_ALIAS
+The parent specified for a meta field was an alias.
+.TP
 .B GD_E_FORMAT_BAD_LINE
 The line was indecipherable.  Typically this means that the line contained
 neither a reserved word, nor a field type.
@@ -462,16 +507,22 @@ An unexpected character was encountered in a complex literal.
 .B GD_E_FORMAT_LOCATION
 The parent of a metafield was defined in another fragment.
 .TP
+.B GD_E_FORMAT_META_META
+An attempt was made to use a metafield as the parent to a new metafield.
+.TP
 .B GD_E_FORMAT_METARAW
 An attempt was made to add a RAW metafield.
 .TP
+.B GD_E_FORMAT_MPLEXVAL
+A MPLEX specification has a negative period.
+.TP
 .B GD_E_FORMAT_N_FIELDS
 The number of fields of a LINCOM field was out-of-range.
 .TP
 .B GD_E_FORMAT_N_TOK
 An insufficient number of tokens was found on the line.
 .TP
-.B GD_E_FORMAT_NO_PARENT
+.B GD_E_FORMAT_NO_FIELD
 The parent of a metafield was not found.
 .TP
 .B GD_E_FORMAT_NUMBITS
@@ -479,7 +530,7 @@ The number of bits of a BIT field was out-of-range.
 .TP
 .B GD_E_FORMAT_PROTECT
 The protection level specified by a
-.B PROTECT
+.B /PROTECT
 directive was unrecognised.
 .TP
 .B GD_E_FORMAT_RES_NAME
@@ -491,13 +542,16 @@ in a dirfile conforming to Standards Version 5 or earlier).
 .TP
 .B GD_E_FORMAT_UNTERM
 The last token of the line was unterminated.
+.TP
+.B GD_E_FORMAT_WINDOP
+The operation in a WINDOW field was not recognised.
 .PP
 .IR pdata -> filename
 and
 .IR pdata -> linenum
 members contains the pathname of the fragment and line number where the syntax
 error was encountered.  The first line in a fragment is line one.
-
+.PP
 The
 .IR pdata -> line
 member contains a copy of the line containing the syntax error.  This line may
@@ -567,11 +621,12 @@ A call to
 .BR gd_cbopen ()
 or
 .BR gd_open ()
-always returns a pointer to a newly allocated DIRFILE object.  The DIRFILE
-object is an opaque structure containing the parsed dirfile metadata.
-If an error occurred, the dirfile error will be set to a non-zero error value.
-The DIRFILE object will also be internally flagged as invalid.  Possible error
-values are:
+always returns a pointer to a newly allocated DIRFILE object, except in
+instances when it is unable to allocate memory for the DIRFILE object itself,
+in which case it will return NULL.  The DIRFILE object is an opaque structure
+containing the parsed dirfile metadata.  If an error occurred, the dirfile
+error will be set to a non-zero error value.  The DIRFILE object will also
+be internally flagged as invalid.  Possible error values are:
 .TP 8
 .B GD_E_ACCMODE
 The library was asked to create or truncate a dirfile opened read-only (i.e.
@@ -601,7 +656,10 @@ The registered callback function,
 returned an unrecognised response.
 .TP
 .B GD_E_CREAT
-The library was unable to create the dirfile, or the dirfile exists and both
+The library was unable to create the dirfile.
+.TP
+.B GD_E_EXISTS
+The dirfile already exists and both
 .BR GD_CREAT " and " GD_EXCL
 were specified.
 .TP
@@ -610,11 +668,6 @@ A syntax error occurred in the format specification.  See also
 .B The Callback Function
 section above.
 .TP
-.B GD_E_INTERNAL_ERROR
-An internal error occurred in the library while trying to perform the task.
-This indicates a bug in the library.  Please report the incident to the
-GetData developers.
-.TP
 .B GD_E_LINE_TOO_LONG
 The parser encountered a line in the format specification longer than it was
 able to deal with.  Lines are limited by the storage size of
@@ -648,10 +701,10 @@ even if the open failed.
 .SH BUGS
 When working with dirfiles conforming to Standards Versions 4 and earlier
 (before the introduction of the
-.B ENDIAN
+.B /ENDIAN
 directive), GetData assumes the dirfile has native byte sex, even though,
 officially, these early Standards stipulated data to be little-endian.  This is
-necessary since, in the absense of an explicit
+necessary since, in the absence of an explicit
 .B /VERSION
 directive, it is often impossible to determine the intended Standards Version of
 a dirfile, and the current behaviour is to assume native byte sex for modern
@@ -663,12 +716,12 @@ directive should be added to the format specification, or else
 .B GD_LITTLE_ENDIAN
 should be specified by the caller.
 
-GetData artifically limits the size of a
+GetData artificially limits the size of a
 .B CARRAY
 field to GD_MAX_CARRAY_LENGTH elements, to be certain it is always able to
 write the CARRAY back to disk without overrunning its maximum line length.
 On 32-bit systems, GD_MAX_CARRAY_LENGTH is 2**24.  It is larger on 64-bit
-systems.  Excess elements are silently truncatd on dirfile open.
+systems.  Excess elements are silently truncated on dirfile open.
 
 GetData's parser assumes it is running on an ASCII-compatible platform.  Format
 specification parsing will fail gloriously on an EBCDIC platform.
@@ -681,6 +734,8 @@ specification parsing will fail gloriously on an EBCDIC platform.
 .BR gd_discard (3),
 .BR gd_error (3),
 .BR gd_error_string (3),
+.BR gd_flags (3),
 .BR gd_getdata (3),
 .BR gd_include (3),
-.BR gd_parser_callback (3)
+.BR gd_parser_callback (3),
+.BR gd_verbose_prefix (3)
diff --git a/man/gd_close.3 b/man/gd_close.3
index 5a5389a..d58029c 100644
--- a/man/gd_close.3
+++ b/man/gd_close.3
@@ -1,6 +1,6 @@
 .\" gd_close.3.  The gd_close man page.
 .\"
-.\" Copyright (C) 2008, 2009, 2010 D. V. Wiebe
+.\" Copyright (C) 2008, 2009, 2010, 2011 D. V. Wiebe
 .\"
 .\""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
 .\"
@@ -13,7 +13,7 @@
 .\" Texts.  A copy of the license is included in the `COPYING.DOC' file
 .\" as part of this distribution.
 .\"
-.TH gd_close 3 "20 October 2010" "Version 0.7.0" "GETDATA"
+.TH gd_close 3 "17 August 2011" "Version 0.8.0" "GETDATA"
 .SH NAME
 gd_close, gd_discard \(em close a dirfile and free associated memory.
 .SH SYNOPSIS
@@ -51,9 +51,9 @@ fields are properly terminated, changes to
 data files are still flushed to disk by this function.  If
 .I dirfile
 was opened in read-only mode,
-.BR gd_discard()
+.BR gd_discard ()
 and
-.BR gd_close()
+.BR gd_close ()
 behave identically.
 
 One of these functions should be called on all pointers returned by
@@ -64,7 +64,7 @@ and
 even if the call to those function failed.  After
 .BR gd_close ()
 or
-.BR gd_discard()
+.BR gd_discard ()
 returns successfully, the pointer
 .I dirfile
 should be considered invalid.
@@ -85,6 +85,9 @@ return zero on success.  On error, they do not de-allocate
 and set the dirfile error to a non-zero error value.  Possible error values
 are:
 .TP 8
+.B GD_E_ALLOC
+The library was unable to allocate memory.
+.TP
 .B GD_E_FLUSH
 A temporary file could not be opened into which to write the modified metadata,
 or renaming the temporary file over the original fragment failed.
diff --git a/man/gd_constants.3 b/man/gd_constants.3
index 16ef3c3..228a2bb 100644
--- a/man/gd_constants.3
+++ b/man/gd_constants.3
@@ -13,7 +13,7 @@
 .\" Texts.  A copy of the license is included in the `COPYING.DOC' file
 .\" as part of this distribution.
 .\"
-.TH gd_constants 3 "15 October 2010" "Version 0.7.0" "GETDATA"
+.TH gd_constants 3 "18 August 2011" "Version 0.8.0" "GETDATA"
 .SH NAME
 gd_constants \(em retrieve a list of constant values from a dirfile
 .SH SYNOPSIS
@@ -89,6 +89,11 @@ The supplied dirfile was invalid.
 The
 .I return_type
 specified was invalid.
+.TP
+.B GD_E_INTERNAL_ERROR
+An internal error occurred in the library while trying to perform the task.
+This indicates a bug in the library.  Please report the incident to the
+GetData developers.
 .PP
 The dirfile error may be retrieved by calling
 .BR gd_error (3).
diff --git a/man/gd_delete.3 b/man/gd_delete.3
index 14a3c8e..5d470c4 100644
--- a/man/gd_delete.3
+++ b/man/gd_delete.3
@@ -1,6 +1,6 @@
 .\" gd_delete.3.  The gd_delete man page.
 .\"
-.\" Copyright (C) 2008, 2009, 2010 D. V. Wiebe
+.\" Copyright (C) 2008, 2009, 2010, 2012 D. V. Wiebe
 .\"
 .\""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
 .\"
@@ -13,16 +13,19 @@
 .\" Texts.  A copy of the license is included in the `COPYING.DOC' file
 .\" as part of this distribution.
 .\"
-.TH gd_delete 3 "3 November 2010" "Version 0.7.0" "GETDATA"
+.TH gd_delete 3 "1 January 2012" "Version 0.8.0" "GETDATA"
 .SH NAME
-gd_delete \(em remove a field from a dirfile
+gd_delete, gd_delete_alias \(em remove an entry from a dirfile
 .SH SYNOPSIS
 .B #include <getdata.h>
 .HP
 .nh
 .ad l
 .BI "int gd_delete(DIRFILE *" dirfile ", const char *" field_code ,
-.BI "int " flags );
+.BI "unsigned int " flags );
+.HP
+.BI "int gd_delete_alias(DIRFILE *" dirfile ", const char *" alias_name ,
+.BI "unsigned int " flags );
 .hy
 .ad n
 .SH DESCRIPTION
@@ -37,6 +40,18 @@ The
 should not contain a representation suffix.
 
 The
+.BR gd_delete_alias ()
+function behaves similarly, but deletes the alias specified by
+.I alias_name
+instead.  (This function is needed, since passing
+.I alias_name
+to
+.BR gd_delete ()
+as
+.I field_code
+would have resulted in the field pointed to by the alias being deleted instead.)
+
+The
 .I flags
 argument influences how the deletion attempt occurs.  It may be zero, for the
 default behaviour, or else one or more of the following flags, bitwise or'd
@@ -50,7 +65,8 @@ field, also delete the binary data file associated with it.  If
 specified a
 .B RAW
 field and this flag is not specified, the field will still be deleted but the
-binary file will be left untouched.
+binary file will be left untouched.  Ignored by
+.BR gd_delete_alias ().
 .TP
 .B GD_DEL_DEREF
 If the field to be deleted is a
@@ -63,16 +79,17 @@ these other fields dependence on the deleted field by replacing instances of
 in their field specifications with the value of the scalar field.
 .TP
 .B GD_DEL_FORCE
-Delete the indicated field, even if it is used in the specification of other
+Delete the indicated entry, even if it is used in the specification of other
 fields, either as a input for a derived vector field or as a scalar parameter in
-a field specification.
+a field specification, or if it has aliases pointing to it.
 .TP
 .B GD_DEL_META
 If the field to be deleted has metafields attached to it, attempt to delete
 those, too.  If the field has metafields and this flag is not specified, the
 call will fail with the
 .B GD_E_DELETE
-error.
+error.  Ignored by
+.BR gd_delete_alias ().
 .SH RETURN VALUE
 On successful deletion, zero is returned.  On error, -1 is returned and the
 dirfile error is set to a non-zero error value.  Possible error values are:
diff --git a/man/gd_desync.3 b/man/gd_desync.3
new file mode 100644
index 0000000..017d53b
--- /dev/null
+++ b/man/gd_desync.3
@@ -0,0 +1,129 @@
+.\" gd_desync.3.  The gd_desync man page.
+.\"
+.\" Copyright (C) 2012 D. V. Wiebe
+.\"
+.\""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
+.\"
+.\" This file is part of the GetData project.
+.\"
+.\" Permission is granted to copy, distribute and/or modify this document
+.\" under the terms of the GNU Free Documentation License, Version 1.2 or
+.\" any later version published by the Free Software Foundation; with no
+.\" Invariant Sections, with no Front-Cover Texts, and with no Back-Cover
+.\" Texts.  A copy of the license is included in the `COPYING.DOC' file
+.\" as part of this distribution.
+.\"
+.TH gd_desync 3 "15 March 2012" "Version 0.8.0" "GETDATA"
+.SH NAME
+gd_desync \(em check for a change of metadata on disk
+.SH SYNOPSIS
+.B #include <getdata.h>
+.HP
+.nh
+.ad l
+.BI "int gd_desync(DIRFILE *" dirfile ", unsigned int " flags );
+.hy
+.ad n
+.SH DESCRIPTION
+The
+.BR gd_desync ()
+function reports whether the metadata of the loaded
+.I dirfile
+has become desynchronised from the format specification fragments on disk, due
+to a third party modifying the Dirfile metadata on disk after GetData opened
+it.  If
+.I dirfile
+has become desynchronised, this function can, optionally, reload the dirfile.
+
+The
+.I flags
+argument influences how the function works.  It should be zero, or else one
+or more of the following flags, bitwise or'd together:
+.TP 8
+.B GD_DESYNC_PATHCHECK
+Ignore GetData's internal directory cache, and use the format specification
+fragments' full path when checking for modifications.  This flag is of
+particular importance when the
+.I dirfilename
+passed to
+.BR gd_cbopen (3),
+or directory paths used in included fragments, contain symbolic links: with this
+flag, these symbolic links will be re-evaluated.  Without it, the target of
+the symbolic links in effect when the dirfile was first opened will be
+considered instead.
+.TP
+.B GD_DESYNC_REOPEN
+If this flag is specified, and
+.BR gd_desync ()
+detects desynchronisation, the Dirfile will be re-opened in place using the
+exiting
+.I dirfile
+pointer.  In this case, upon a positive result from this function, the caller
+must discard all cached information about the dirfile, even the assumption that
+.I dirfile
+has been successfully opened.
+
+Re-opening the dirfile is equivalent to calling
+.BR gd_discard (3),
+and then
+.BR gd_cbopen (3)
+with the same arguments used when originally creating
+.IR dirfile ,
+except that the
+.I dirfile
+pointer doesn't change its value.  As a result, this function may invoke the
+registered parser callback function (see
+.BR gd_cbopen (3)
+and
+.BR gd_parser_callback (3)).
+.SH RETURN VALUE
+On successful deletion, zero is returned if the loaded dirfile has not
+desynchronised, or 1 if it has.  On error, -1 is returned, regardless of
+desynchronisation and the dirfile error is set to a non-zero error value.
+Possible error values are:
+.TP 8
+.B GD_E_ALLOC
+The library was unable to allocate memory.
+.TP
+.B GD_E_BAD_DIRFILE
+The supplied dirfile was invalid.
+.TP
+.B GD_E_RAW_IO
+An error occurred while trying to obtain the modification time of a fragment.
+.PP
+Additionally, if
+.B GD_DESYNC_REOPEN
+is used, this function may fail for any of the reasons listed in the
+.BR gd_discard (3)
+and
+.BR gd_cbopen (3)
+manual pages.
+.PP
+The dirfile error may be retrieved by calling
+.BR gd_error (3).
+A descriptive error string for the last error encountered can be obtained from
+a call to
+.BR gd_error_string (3).
+.SH LIMITATIONS
+The current implementation uses file modification times as reported by
+.BR stat (2)
+to detect changes.  These times have a granularity of, at best, one second.  As
+a result, desynchronisation will not be detected in the case when a fragment is
+modified, then GetData reads it, then the fragment is modified again, all within
+one second.  The caller may wish to perform its own monitoring using the
+pathnames returned by
+.BR gd_fragmentname (3).
+.PP
+On systems lacking a POSIX.1-2008 conformant
+.BR fstatat (2)
+(q.v.), this function may always operate as if
+.B GD_DESYNC_PATHCHECK
+had been specified, regardless of the actual
+.IR flags .
+.SH SEE ALSO
+.BR fstatat (2),
+.BR gd_cbopen (3),
+.BR gd_discard (3),
+.BR gd_error (3),
+.BR gd_error_string (3),
+.BR gd_parser_callback (3)
diff --git a/man/gd_dirfile_standards.3 b/man/gd_dirfile_standards.3
index ea1a433..62bdc53 100644
--- a/man/gd_dirfile_standards.3
+++ b/man/gd_dirfile_standards.3
@@ -1,6 +1,6 @@
 .\" gd_dirfile_standards.3.  The gd_dirfile_standards man page.
 .\"
-.\" Copyright (C) 2010 D. V. Wiebe
+.\" Copyright (C) 2010, 2012 D. V. Wiebe
 .\"
 .\""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
 .\"
@@ -13,7 +13,7 @@
 .\" Texts.  A copy of the license is included in the `COPYING.DOC' file
 .\" as part of this distribution.
 .\"
-.TH gd_dirfile_standards 3 "15 October 2010" "Version 0.7.0" "GETDATA"
+.TH gd_dirfile_standards 3 "29 June 2012" "Version 0.8.0" "GETDATA"
 .SH NAME
 gd_dirfile_standards \(em change or report the current Dirfile Standards Version
 for a DirFile
@@ -28,7 +28,7 @@ for a DirFile
 .SH DESCRIPTION
 The
 .BR gd_dirfile_standards ()
-version updates the current Standards Version for the open dirfile
+function updates the current Standards Version for the open dirfile
 .I dirfile
 to the value specified by
 .IR version ,
@@ -93,12 +93,12 @@ inclusive.  On error, -1 is returned and the dirfile error is set to a non-zero
 error value, and the current Standards Version is not changed.  Possible error
 values are:
 .TP 8
-.B GD_E_BAD_DIRFILE
-The supplied dirfile was invalid.
-.TP
-.B GD_E_BAD_VERSION
+.B GD_E_ARGUMENT
 The loaded dirfile did not conform to the specified version.  Or the dirfile
 conforms to no known Standards Version.
+.TP
+.B GD_E_BAD_DIRFILE
+The supplied dirfile was invalid.
 .PP
 The dirfile error may be retrieved by calling
 .BR gd_error (3).
diff --git a/man/gd_dirfilename.3 b/man/gd_dirfilename.3
index 0a0e24e..ff103ee 100644
--- a/man/gd_dirfilename.3
+++ b/man/gd_dirfilename.3
@@ -1,6 +1,6 @@
 .\" gd_dirfilename.3.  The dirfilename man page.
 .\"
-.\" Copyright (C) 2008, 2010 D. V. Wiebe
+.\" Copyright (C) 2008, 2010, 2012 D. V. Wiebe
 .\"
 .\""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
 .\"
@@ -13,7 +13,7 @@
 .\" Texts.  A copy of the license is included in the `COPYING.DOC' file
 .\" as part of this distribution.
 .\"
-.TH gd_dirfilename 3 "25 May 2010" "Version 0.7.0" "GETDATA"
+.TH gd_dirfilename 3 "1 August 2012" "Version 0.8.1" "GETDATA"
 .SH NAME
 gd_dirfilename \(em retrieve the name of a dirfile
 .SH SYNOPSIS
@@ -21,7 +21,7 @@ gd_dirfilename \(em retrieve the name of a dirfile
 .HP
 .nh
 .ad l
-.BI "const char *gd_dirfilename(const DIRFILE *" dirfile );
+.BI "const char *gd_dirfilename(DIRFILE *" dirfile );
 .hy
 .ad n
 .SH DESCRIPTION
@@ -29,11 +29,8 @@ The
 .BR gd_dirfilename ()
 function queries a dirfile(5) database specified by
 .I dirfile
-and returns its name.  The name of a dirfile is the pathname passed to
-.BR gd_cbopen ()
-or
-.BR gd_open ()
-when the dirfile was opened.
+and returns its name.  The name of a dirfile is an absolute pathname which
+refers to the dirfile base directory.
 
 The 
 .I dirfile
@@ -58,4 +55,5 @@ A descriptive error string for the last error encountered can be obtained from
 a call to
 .BR gd_error_string (3).
 .SH SEE ALSO
-.BR gd_cbopen (3)
+.BR gd_cbopen (3),
+.BR path_resolution (7)
diff --git a/man/gd_encoding.3 b/man/gd_encoding.3
index 42cbe3b..bec02b6 100644
--- a/man/gd_encoding.3
+++ b/man/gd_encoding.3
@@ -1,6 +1,6 @@
 .\" gd_encoding.3.  The gd_encoding man page.
 .\"
-.\" Copyright (C) 2008, 2009, 2010 D. V. Wiebe
+.\" Copyright (C) 2008, 2009, 2010, 2012 D. V. Wiebe
 .\"
 .\""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
 .\"
@@ -13,7 +13,7 @@
 .\" Texts.  A copy of the license is included in the `COPYING.DOC' file
 .\" as part of this distribution.
 .\"
-.TH gd_encoding 3 "15 July 2010" "Version 0.7.0" "GETDATA"
+.TH gd_encoding 3 "21 April 2012" "Version 0.8.0" "GETDATA"
 .SH NAME
 gd_encoding \(em report the binary encoding of data in a dirfile
 .SH SYNOPSIS
@@ -47,19 +47,26 @@ following symbols:
 .IP
 .nh
 .ad l
-.BR GD_UNENCODED ,\~ GD_TEXT_ENCODED ,\~ GD_SLIM_ENCODED ,\~
-.BR GD_GZIP_ENCODED ,\~ GD_BZIP2_ENCODED ,\~ GD_LZMA_ENCODED ,\~
+.BR GD_UNENCODED ,
+.BR GD_BZIP2_ENCODED ,
+.BR GD_GZIP_ENCODED ,
+.BR GD_LZMA_ENCODED ,
+.BR GD_SIE_ENCODED ,
+.BR GD_SLIM_ENCODED ,
+.BR GD_TEXT_ENCODED ,
+.BR GD_ZZIP_ENCODED ,
+.BR GD_ZZSLIM_ENCODED ,
 .BR GD_ENC_UNSUPPORTED .
 .ad n
 .hy
 .PP
-See
-.BR gd_cbopen (3)
-and dirfile-encoding(5) for the meanings of these symbols and details on the
-supported encoding schemes.  If the encoding scheme specified in the dirfile
+If the encoding scheme specified in the dirfile
 metadata is unknown to GetData,
 .B GD_ENC_UNSUPPORTED
-will be returned.
+will be returned.  See
+.BR gd_cbopen (3)
+and dirfile-encoding(5) for the meanings of the other symbols and details on the
+supported encoding schemes.
 .PP
 On error, it returns zero and sets the dirfile error to a non-zero error value. 
 Possible error values are:
diff --git a/man/gd_entry.3 b/man/gd_entry.3
index c7b2ffc..2412350 100644
--- a/man/gd_entry.3
+++ b/man/gd_entry.3
@@ -1,6 +1,6 @@
 .\" gd_entry.3.  The gd_entry man page.
 .\"
-.\" Copyright (C) 2008, 2009, 2010 D. V. Wiebe
+.\" Copyright (C) 2008, 2009, 2010, 2011, 2012, 2013 D. V. Wiebe
 .\"
 .\""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
 .\"
@@ -13,7 +13,7 @@
 .\" Texts.  A copy of the license is included in the `COPYING.DOC' file
 .\" as part of this distribution.
 .\"
-.TH gd_entry 3 "3 November 2010" "Version 0.7.0" "GETDATA"
+.TH gd_entry 3 "3 April 2013" "Version 0.8.4" "GETDATA"
 .SH NAME
 gd_entry \(em retrieve a dirfile field's metadata
 .SH SYNOPSIS
@@ -75,6 +75,9 @@ On error, the supplied gd_entry_t buffer is not modified.  In this case,
 returns -1 and sets the dirfile error to a non-zero error value.  Possible
 error values are:
 .TP 8
+.B GD_E_ALLOC
+The library was unable to allocate memory.
+.TP
 .B GD_E_BAD_CODE
 The field specified by
 .I field_code
@@ -131,17 +134,29 @@ to one of the following symbols:
 .IP
 .nh
 .ad l
-.BR GD_BIT_ENTRY ", " GD_CARRAY_ENTRY ", " GD_CONST_ENTRY ", " GD_DIVIDE_ENTRY ,
-.BR GD_INDEX_ENTRY ", " GD_LINCOM_ENTRY ", " GD_LINTERP_ENTRY ,
-.BR GD_MULTIPLY_ENTRY ", " GD_PHASE_ENTRY ", " GD_POLYNOM_ENTRY ,
-.BR GD_RAW_ENTRY ", " GD_RECIP_ENTRY ", " GD_SBIT_ENTRY ", " GD_STRING_ENTRY .
+.BR GD_BIT_ENTRY ,
+.BR GD_CARRAY_ENTRY ,
+.BR GD_CONST_ENTRY ,
+.BR GD_DIVIDE_ENTRY ,
+.BR GD_INDEX_ENTRY ,
+.BR GD_LINCOM_ENTRY ,
+.BR GD_LINTERP_ENTRY ,
+.BR GD_MPLEX_ENTRY ,
+.BR GD_MULTIPLY_ENTRY ,
+.BR GD_PHASE_ENTRY ,
+.BR GD_POLYNOM_ENTRY ,
+.BR GD_RAW_ENTRY ,
+.BR GD_RECIP_ENTRY ,
+.BR GD_SBIT_ENTRY ,
+.BR GD_STRING_ENTRY ,
+.BR GD_WINDOW_ENTRY .
 .ad n
 .hy
 .PP
 .B GD_INDEX_ENTRY
 is a special field type used only for the implicit
 .I INDEX
-field.  The meaning of the other symbols should be self-explanatory.
+field.  The other entry types are explained in detail in dirfile-format(5).
 .PP
 The 
 .I fragment_index
@@ -169,7 +184,8 @@ have unspecified results.
 .SS Scalar Parameter Members
 A gd_entry_t describing any field type which permits non-literal scalar field
 parameters
-.RB ( BIT ", " LINCOM ", " PHASE ", " POLYNOM ", " RECIP ", " RAW ", or " SBIT )
+.RB ( BIT ", " LINCOM ", " MPLEX ", " PHASE ", " POLYNOM ", " RAW ", " RECIP ,
+.BR SBIT ", or " WINDOW )
 will also provide:
 .PP
 .in +4n
@@ -188,7 +204,7 @@ typedef struct {
 .in
 .PP
 Only certain elements of these arrays will be initialised:
-.IP \(bu 4
+.IP \(bu
 For
 .B BIT
 and
@@ -198,7 +214,7 @@ fields, the first element corresponds to
 and the second to
 .IR numbits .
 The remainder are uninitialised.
-.IP \(bu 4
+.IP \(bu
 For
 .B LINCOM
 fields, the first
@@ -218,13 +234,21 @@ arrays between the element corresponding to
 .IR cm [ n_fields
 - 1] and the element corresponding to
 .IR cb [0].
-.IP \(bu 4
+.IP \(bu
+For
+.B MPLEX
+fields, the first element corresponds to
+.I count_val
+and the second to
+.IR period .
+The remainder are uninitialised.
+.IP \(bu
 For
 .B PHASE
 fields, the first element corresponds to
 .IR shift .
-The remainder are unitialised.
-.IP \(bu 4
+The remainder are uninitialised.
+.IP \(bu
 For
 .B POLYNOM
 fields, these arrays correspond with the co-efficients
@@ -232,18 +256,24 @@ fields, these arrays correspond with the co-efficients
 Only the first
 .I poly_ord
 + 1 elements are initialised.
-.IP \(bu 4
+.IP \(bu
+For
+.B RAW
+fields, the first element corresponds to
+.IR spf .
+The remainder are uninitialised.
+.IP \(bu
 For
 .B RECIP
 fields, the first element corresponds to
 .IR cdividend .
-The remainder are unitialised.
-.IP \(bu 4
+The remainder are uninitialised.
+.IP \(bu
 For
-.B RAW
+.B WINDOW
 fields, the first element corresponds to
-.IR spf .
-The remainder are unitialised.
+.IR threshold .
+The remainder are uninitialised.
 .PP
 The
 .I scalar
@@ -278,8 +308,8 @@ typedef struct {
   ...
 
   const char *in_fields[1];     /* input field code */
-  gd_bit_t    bitnum;           /* first bit */
-  gd_bit_t    numbits;          /* bit length */
+  int         bitnum;           /* first bit */
+  int         numbits;          /* bit length */
 
   ...
 } gd_entry_t;
@@ -294,10 +324,8 @@ member is an array of length one containing the input field code.
 The
 .I bitnum
 member indicates the number of the first bit (counted from zero) extracted from
-the input.  The
-.I gd_bit_t
-type is a signed 16-bit integer type.  If this value was specified as a
-scalar field code, this will be the numerical value of that field, and
+the input.  If this value was specified as a scalar field code, this will be
+the numerical value of that field, and
 .IR scalar [0]
 will contain the field code itself, otherwise
 .IR scalar [0]
@@ -410,8 +438,9 @@ The
 .I n_fields
 member indicates the number of input fields.  It will be between one and
 .B GD_MAX_LINCOM
-inclusive, which is defined in getdata.h to the maximum number of input fields
-permitted by a
+inclusive.
+.B GD_MAX_LINCOM
+is defined in getdata.h as the maximum number of input fields permitted by a
 .BR LINCOM .
 .PP
 The
@@ -494,12 +523,55 @@ typedef struct {
 .PP
 The
 .I table
-member is the pathname to the look up table on disk.
+member is the pathname to the look up table on disk.  This the path as it appars
+in the format specification.  It may be a path relative to the fragment
+directory.  For an canonicalised, absolute version of this path, see
+.BR gd_linterp_tablename (3).
 .PP
 The
 .I in_fields
 member is an array of length one containing the input field code.
 
+.SS MPLEX Members
+A gd_entry_t describing a
+.B MPLEX
+entry, will also provide:
+.PP
+.in +4n
+.nf
+.fam C
+typedef struct {
+  ...
+
+  const char    *in_fields[2];  /* input field codes */
+  int           count_val;      /* value of the multiplex index */
+  int           period;         /* samples between successive count_vals */
+
+  ...
+} gd_entry_t;
+.fam
+.fi
+.in
+.PP
+The
+.I in_fields
+member contains the field codes of the input field (element 0) and the multiplex
+index field (element 1).
+.PP
+The
+.I count_val
+member is the value of the multiplex index field when the output field is stored
+in the input field.
+.PP
+The
+.I period
+member is the number of samples between successive occurrances of
+.I count_val
+in the index vector, or zero, if this is not known or constant.  This is only
+used to determine how far to look back for a starting value for the output
+field; see
+.BR gd_mplex_lookback (3).
+
 .SS MULTIPLY and DIVIDE Members
 A gd_entry_t describing a
 .B MULTIPLY
@@ -588,8 +660,9 @@ The
 .I poly_ord
 member indicates the order of the polynomial.  It will be between one and
 .B GD_MAX_POLY_ORD
-inclusive, which is defined in getdata.h to the maximum order of polynomial
-permitted by a
+inclusive.
+.B GD_MAX_POLY_ORD
+is defined in getdata.h as the maximum order of polynomial permitted by a
 .BR POLYNOM .
 .PP
 The
@@ -629,6 +702,44 @@ The elements of
 are the real parts of the corresponding elements of
 .IR ca .
 
+.SS RAW Members
+A gd_entry_t describing a
+.B RAW
+entry, will also provide:
+.PP
+.in +4n
+.nf
+.fam C
+typedef struct {
+  ...
+
+  unsigned int  spf;          /* samples per frame on disk */
+  gd_type_t     data_type;    /* data type on disk */
+
+  ...
+} gd_entry_t;
+.fam
+.fi
+.in
+.PP
+The
+.I spf
+member contains the samples per frame of the binary data on disk.  If this value
+was specified as a scalar field code, this will be the numerical value of that
+field, and
+.IR scalar [0]
+will contain the field code itself, otherwise
+.IR scalar [0]
+will be NULL.
+.PP
+The
+.I data_type
+member indicates the data type of the binary data on disk.  See
+.BR gd_getdata (3)
+for a list of valid values that a variable of type
+.B gd_type_t
+may take.
+
 .SS RECIP Members
 A gd_entry_t describing a
 .B RECIP
@@ -676,9 +787,14 @@ will be NULL.  The
 member contains the real part of
 .IR cdividend .
 
-.SS RAW Members
+.SS STRING Members
 A gd_entry_t describing a
-.B RAW
+.B STRING
+entry provides no additional data.
+
+.SS WINDOW Members
+A gd_entry_t describing a
+.B WINDOW
 entry, will also provide:
 .PP
 .in +4n
@@ -687,8 +803,9 @@ entry, will also provide:
 typedef struct {
   ...
 
-  gd_spf_t      spf;          /* samples per frame on disk */
-  gd_type_t     data_type;    /* data type on disk */
+  const char    *in_fields[2];  /* input field codes */
+  gd_windop_t   windop;         /* comparison operator */
+  gd_triplet_t  threshold;      /* the value compared against */
 
   ...
 } gd_entry_t;
@@ -697,28 +814,91 @@ typedef struct {
 .in
 .PP
 The
-.I spf
-member contains the samples per frame of the binary data on disk.  The
-.I gd_spf_t
-type is an unsigned 16-bit integer type.  If this value was specified as a
-scalar field code, this will be the numerical value of that field, and
-.IR scalar [0]
-will contain the field code itself, otherwise
-.IR scalar [0]
-will be NULL.
+.I in_fields
+member contains the field codes of the input field (element 0) and the check
+field (element 1).
 .PP
 The
-.I data_type
-member indicates the data type of the binary data on disk.  See
-.BR gd_getdata (3)
-for a list of valid values that a variable of type
-.B gd_type_t
-may take.
-
-.SS STRING Members
-A gd_entry_t describing a
-.B STRING
-entry provides no additional data.
+.I windop
+member equals one of the following symbols, indicating the particular comparison
+performed on the check field:
+.TP
+.B GD_WINDOP_EQ
+data are extracted when the check field equals
+.IR threshold ;
+.TP
+.B GD_WINDOP_GE
+data are extracted when the check field is greater than or equal to
+.IR threshold ;
+.TP
+.B GD_WINDOP_GT
+data are extracted when the check field is strictly greater than
+.IR threshold ;
+.TP
+.B GD_WINDOP_LE
+data are extracted when the check field is less than or equal to
+.IR threshold ;
+.TP
+.B GD_WINDOP_LT
+data are extracted when the check field is strictly less than
+.IR threshold ;
+.TP
+.B GD_WINDOP_NE
+data are extracted when the check field is not equal to
+.IR threshold ;
+.TP
+.B GD_WINDOP_SET
+data are extracted when at least one bit in
+.I threshold 
+is also set in the check field;
+.TP
+.B GD_WINDOP_CLR
+data are extracted when at least one bit in
+.I threshold 
+is not set in the check field.
+.PP
+The
+.I threshold
+is the value against the check field is compared.  The
+.B gd_triplet_t
+type is defined as:
+.PP
+.in +4n
+.nf
+.fam C
+typedef union {
+  gd_int64_t i;
+  gd_uint64_t u;
+  double r;
+} gd_triplet_t;
+.fam
+.fi
+.in
+.PP
+The particular element of the union to use depends on the value of
+.I windop:
+.IP \(bu
+For
+.B GD_WINDOP_EQ
+and
+.BR GD_WINDOP_NE ,
+the signed integer element,
+.IB threshold . i
+is set;
+.IP \(bu
+For
+.B GD_WINDOP_SET
+and
+.BR GD_WINDOP_CLR ,
+the unsigned integer element,
+.IB threshold . u
+is set;
+.IP \(bu
+For all other values of
+.IR windop ,
+the floating point element,
+.IB threshold . r
+is set.
 
 .SH NOTES
 When using the C89 GetData API (by defining
@@ -732,29 +912,33 @@ center tab(|);
 cbscbs
 rlrl.
 C99 API|C89 API
-gd_spf_t|spf|gd_spf_t|u.raw.spf
-gd_type_t|data_type|gd_type_t|u.raw.data_type
+int|bitnum|int|u.bit.bitnum
+int|numbits|int|u.bit.numbits
 int|n_fields|int|u.lincom.n_fields
-double compex|cm[3]|double|u.lincom.cm[3][2]
+double complex|cm[3]|double|u.lincom.cm[3][2]
 double|m[3]|double|u.lincom.m[3]
-double compex|cb[3]|double|u.lincom.cb[3][2]
+double complex|cb[3]|double|u.lincom.cb[3][2]
 double|b[3]|double|u.lincom.b[3]
-int|poly_ord|int|u.polynom.poly_ord
-double compex|ca[3]|double|u.polynom.ca[3][2]
-double|a[3]|double|u.polynom.a[3]
 const char*|table|const char*|u.linterp.table
-gd_bit_t|bitnum|gd_bit_t|u.bit.bitnum
-gd_bit_t|numbits|gd_bit_t|u.bit.numbits
+int|count_val|int|u.mplex.count_val
+int|period|int|u.mplex.period
 gd_shift_t|shift|gd_shift_t|u.phase.shift
-double compex|cdividend|double|u.recip.cdividend[2]
+int|poly_ord|int|u.polynom.poly_ord
+double complex|ca[3]|double|u.polynom.ca[3][2]
+double|a[3]|double|u.polynom.a[3]
+unsigned int|spf|unsigned int|u.raw.spf
+gd_type_t|data_type|gd_type_t|u.raw.data_type
+double complex|cdividend|double|u.recip.cdividend[2]
 double|dividend|double|u.recip.dividend
 gd_type_t|const_type|gd_type_t|u.scalar.const_type
 size_t|array_len|size_t|u.scalar.array_len
+gd_windop_t|windop|gd_windop_t|u.window.windop
+gd_triplet_t|threshold|gd_triplet_t|u.window.threshold
 .TE
 .PP
-In the case of complex valued data in the C89 API, the first element of the two
-element array is the real part of the complex number, and the second element is
-the imaginary part.
+In the case of complex valued data in the C89 API, the first element of the
+two-element array is the real part of the complex number, and the second
+element is the imaginary part.
 
 .SH SEE ALSO
 .BR dirfile (5),
@@ -764,5 +948,6 @@ the imaginary part.
 .BR gd_error_string (3),
 .BR gd_field_list (3),
 .BR gd_fragmentname (3),
-.BR gd_getdata (3),
+.BR gd_linterp_tablename (3)
+.BR gd_mplex_lookback (3),
 .BR gd_raw_filename (3)
diff --git a/man/gd_entry_list.3 b/man/gd_entry_list.3
new file mode 100644
index 0000000..e95c63f
--- /dev/null
+++ b/man/gd_entry_list.3
@@ -0,0 +1,210 @@
+.\" gd_entry_list.3.  The gd_entry_list man page.
+.\"
+.\" Copyright (C) 2012 D. V. Wiebe
+.\"
+.\""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
+.\"
+.\" This file is part of the GetData project.
+.\"
+.\" Permission is granted to copy, distribute and/or modify this document
+.\" under the terms of the GNU Free Documentation License, Version 1.2 or
+.\" any later version published by the Free Software Foundation; with no
+.\" Invariant Sections, with no Front-Cover Texts, and with no Back-Cover
+.\" Texts.  A copy of the license is included in the `COPYING.DOC' file
+.\" as part of this distribution.
+.\"
+.TH gd_entry_list 3 "28 June 2012" "Version 0.8.0" "GETDATA"
+.SH NAME
+gd_entry_list, gd_field_list, gd_field_list_by_type gd_mfield_list, gd_mfield_list_by_type,
+gd_mvector_list, gd_vector_list \(em list field entries in a dirfile
+.SH SYNOPSIS
+.B #include <getdata.h>
+.HP
+.nh
+.ad l
+.BI "const char **gd_entry_list(DIRFILE *" dirfile ", const char *" parent ,
+.BI "unsigned int " type ", unsigned int " flags );
+.HP
+.BI "const char **gd_field_list(DIRFILE *" dirfile );
+.HP
+.BI "const char **gd_field_list_by_type(DIRFILE *" dirfile ", gd_entype_t " type );
+.HP
+.BI "const char **gd_mfield_list(DIRFILE *" dirfile ", const char *" parent );
+.HP
+.BI "const char **gd_mfield_list_by_type(DIRFILE *" dirfile ,
+.BI "const char *" parent ", gd_entype_t " type );
+.HP
+.BI "const char **gd_mvector_list(DIRFILE *" dirfile ", const char *" parent );
+.HP
+.BI "const char **gd_vector_list(DIRFILE *" dirfile );
+.hy
+.ad n
+.SH DESCRIPTION
+The
+.BR gd_entry_list ()
+function queries a dirfile(5) database specified by
+.I dirfile
+and returns a list of names of field entries satisfying the supplied criteria.
+If
+.I parent
+is non-NULL, metafields under the field specified by
+.I parent
+are considered; otherwise, top-level fields are considered, and metafields
+ignored.
+
+The
+.I type
+argument should be one of the following symbols indicating an explicit entry
+type to list:
+.IP
+.nh
+.ad l
+.BR GD_BIT_ENTRY ", " GD_CARRAY_ENTRY ", " GD_CONST_ENTRY ", " GD_DIVIDE_ENTRY ,
+.BR GD_INDEX_ENTRY ", " GD_LINCOM_ENTRY ", " GD_LINTERP_ENTRY ,
+.BR GD_MPLEX_ENTRY ", " GD_MULTIPLY_ENTRY ", " GD_PHASE_ENTRY ,
+.BR GD_POLYNOM_ENTRY ", " GD_RAW_ENTRY ", " GD_RECIP_ENTRY ,
+.BR GD_SBIT_ENTRY ", " GD_STRING_ENTRY ", " GD_WINDOW_ENTRY .
+.ad n
+.hy
+.PP
+.RB ( GD_INDEX_ENTRY
+is a special field type for the implicit
+.I INDEX
+field) or else one of the following special symbols:
+.TP
+.B GD_ALL_ENTRIES \fR(= 0)
+List entries of all types.
+.TP
+.B GD_ALIAS_ENTRIES
+List only aliases.  This is the only way to get a list including aliases which
+do not point to valid field codes.
+.TP
+.B GD_SCALAR_ENTRIES
+List only scalar field types
+.RB ( CONST ", " CARRAY ", " STRING ).
+.TP
+.B GD_VECTOR_ENTRIES
+List only vector field types (all field types except the scalar field types
+listed above).
+.PP
+The
+.I flags
+argument should be zero or more of the following flags, bitwise or'd together:
+.TP
+.B GD_ENTRIES_HIDDEN
+Include hidden entries (see
+.BR gd_hidden (3))
+in the list: normally hidden entries are skipped;
+.TP
+.B GD_ENTRIES_NOALIAS
+Exclude aliases from the list: normally aliases are considered the same as
+their target (that is: if a field satisfies the criteria, both its canonical
+name and all its aliases will appear in the list).
+.PP
+The array returned will be de-allocated by a call to
+.BR gd_close (3)
+and should not be de-allocated by the caller.  The list returned should not be
+assumed to be in any particular order.  The array is terminated by a NULL
+pointer.  The number of elements in the array, excluding the terminating NULL,
+can be obtained from an equivalent call to
+.BR gd_nentries (3).
+
+The caller may not modify any strings in the array, or the array itself.  Doing
+so may cause database corruption.  The pointer returned is guaranteed to be
+valid at least until
+.BR gd_entry_list ()
+is called again on the same DIRFILE object, or until the array is de-allocated
+by a call to
+.BR gd_close (3).
+(Although the data may have become obsolete, if metadata have been modified in
+the interrim.)
+.SS Special Cases
+The call
+.RS
+.BI gd_field_list( dirfile );
+.RE
+.PP
+is equivalent to
+.RS
+.BI gd_entry_list( dirfile ", NULL, GD_ALL_ENTRIES, 0);
+.RE
+.PP
+The call
+.RS
+.BI gd_field_list_by_type( dirfile ", " type );
+.RE
+.PP
+is equivalent to
+.RS
+.BI gd_entry_list( dirfile ", NULL, " type ", 0);"
+.RE
+.PP
+The call
+.RS
+.BI gd_mfield_list( dirfile ", " parent );
+.RE
+.PP
+is equivalent to
+.RS
+.BI gd_entry_list( dirfile ", " parent ", GD_ALL_ENTRIES, 0);"
+.RE
+.PP
+The call
+.RS
+.BI gd_mfield_list_by_type( dirfile ", " parent ", " type );
+.RE
+.PP
+is equivalent to
+.RS
+.BI gd_entry_list( dirfile ", " parent ", " type ", 0);"
+.RE
+.PP
+The call
+.RS
+.BI gd_mvector_list( dirfile ", " parent );
+.RE
+.PP
+is equivalent to
+.RS
+.BI gd_entry_list( dirfile ", " parent ", GD_VECTOR_ENTRIES, 0);"
+.RE
+.PP
+The call
+.RS
+.BI gd_vector_list( dirfile );
+.RE
+.PP
+is equivalent to
+.RS
+.BI gd_entry_list( dirfile ", NULL, GD_VECTOR_ENTRIES, 0);"
+.RE
+
+.SH RETURN VALUE
+Upon successful completion, these functions returns a pointer to an array of
+strings containing the names of all the entries in the database satisfying the
+supplied criteria.  On error, they return zero and sets
+the dirfile error to a non-zero error value.  Possible error values are:
+.TP 8
+.B GD_E_BAD_CODE
+The supplied parent field code was not found, or referred to a metafield itself.
+.TP
+.B GD_E_BAD_DIRFILE
+The supplied dirfile was invalid.
+.TP
+.B GD_E_BAD_ENTRY
+The
+.I type
+parameter supplied was not one of the symbols listed above.
+.PP
+The dirfile error may be retrieved by calling
+.BR gd_error (3).
+A descriptive error string for the last error encountered can be obtained from
+a call to
+.BR gd_error_string (3).
+.SH SEE ALSO
+.BR dirfile (5),
+.BR gd_open (3),
+.BR gd_error (3),
+.BR gd_error_string (3),
+.BR gd_hidden (3),
+.BR gd_nentries (3)
diff --git a/man/gd_entry_type.3 b/man/gd_entry_type.3
index 6c3e3b2..d120840 100644
--- a/man/gd_entry_type.3
+++ b/man/gd_entry_type.3
@@ -1,6 +1,6 @@
 .\" gd_entry_type.3.  The gd_entry_type man page.
 .\"
-.\" Copyright (C) 2008, 2009, 2010 D. V. Wiebe
+.\" Copyright (C) 2008, 2009, 2010, 2011, 2012 D. V. Wiebe
 .\"
 .\""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
 .\"
@@ -13,7 +13,7 @@
 .\" Texts.  A copy of the license is included in the `COPYING.DOC' file
 .\" as part of this distribution.
 .\"
-.TH gd_entry_type 3 "3 November 2010" "Version 0.7.0" "GETDATA"
+.TH gd_entry_type 3 "21 August 2012" "Version 0.8.0" "GETDATA"
 .SH NAME
 gd_entry_type \(em retrieve the type of a dirfile field
 .SH SYNOPSIS
@@ -42,10 +42,22 @@ type is an enumerated type which may take any of the following values:
 .IP
 .nh
 .ad l
-.BR GD_BIT_ENTRY ", " GD_CARRAY_ENTRY ", " GD_CONST_ENTRY ", " GD_DIVIDE_ENTRY ,
-.BR GD_INDEX_ENTRY ", " GD_LINCOM_ENTRY ", " GD_LINTERP_ENTRY ,
-.BR GD_MULTIPLY_ENTRY ", " GD_PHASE_ENTRY ", " GD_POLYNOM_ENTRY ,
-.BR GD_RAW_ENTRY ", " GD_RECIP_ENTRY ", " GD_SBIT_ENTRY ", " GD_STRING_ENTRY .
+.BR GD_BIT_ENTRY ,
+.BR GD_CARRAY_ENTRY ,
+.BR GD_CONST_ENTRY ,
+.BR GD_DIVIDE_ENTRY ,
+.BR GD_INDEX_ENTRY ,
+.BR GD_LINCOM_ENTRY ,
+.BR GD_LINTERP_ENTRY ,
+.BR GD_MPLEX_ENTRY ,
+.BR GD_MULTIPLY_ENTRY ,
+.BR GD_PHASE_ENTRY ,
+.BR GD_POLYNOM_ENTRY ,
+.BR GD_RAW_ENTRY ,
+.BR GD_RECIP_ENTRY ,
+.BR GD_SBIT_ENTRY ,
+.BR GD_STRING_ENTRY ,
+.BR GD_WINDOW_ENTRY .
 .ad n
 .hy
 .SH RETURN VALUE
@@ -58,6 +70,9 @@ returns
 and sets the dirfile error a non-zero error value.  Possible error
 values are:
 .TP 8
+.B GD_E_ALLOC
+The library was unable to allocate memory.
+.TP
 .B GD_E_BAD_DIRFILE
 The supplied dirfile was invalid.
 .TP
diff --git a/man/gd_eof.3 b/man/gd_eof.3
index 2371ca7..e6c8dba 100644
--- a/man/gd_eof.3
+++ b/man/gd_eof.3
@@ -1,6 +1,6 @@
 .\" gd_eof.3.  The gd_eof man page.
 .\"
-.\" Copyright (C) 2010 D. V. Wiebe
+.\" Copyright (C) 2010, 2011 D. V. Wiebe
 .\"
 .\""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
 .\"
@@ -13,7 +13,7 @@
 .\" Texts.  A copy of the license is included in the `COPYING.DOC' file
 .\" as part of this distribution.
 .\"
-.TH gd_eof 3 "15 October 2010" "Version 0.7.0" "GETDATA"
+.TH gd_eof 3 "18 August 2011" "Version 0.8.0" "GETDATA"
 .SH NAME
 gd_eof \(em report the number of samples in a dirfile field
 .SH SYNOPSIS
@@ -69,6 +69,9 @@ returns the sample number of the end-of-field marker for the indicated field.
 On error, it returns -1 and sets the dirfile error to a non-zero error value.
 Possible error values are:
 .TP 8
+.B GD_E_ALLOC
+The library was unable to allocate memory.
+.TP
 .B GD_E_BAD_CODE
 The field specified by
 .I field_code
@@ -99,6 +102,11 @@ or one of its inputs, or else
 .I field_code
 itself specified a scalar field.
 .TP
+.B GD_E_INTERNAL_ERROR
+An internal error occurred in the library while trying to perform the task.
+This indicates a bug in the library.  Please report the incident to the
+GetData developers.
+.TP
 .B GD_E_RAW_IO
 An attempt to
 .BR stat (2)
diff --git a/man/gd_eof64.3 b/man/gd_eof64.3
new file mode 100644
index 0000000..101acf3
--- /dev/null
+++ b/man/gd_eof64.3
@@ -0,0 +1,54 @@
+.\" gd_eof64.3.  The gd_eof64 man page.
+.\"
+.\" Copyright (C) 2012 D. V. Wiebe
+.\"
+.\""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
+.\"
+.\" This file is part of the GetData project.
+.\"
+.\" Permission is granted to copy, distribute and/or modify this document
+.\" under the terms of the GNU Free Documentation License, Version 1.2 or
+.\" any later version published by the Free Software Foundation; with no
+.\" Invariant Sections, with no Front-Cover Texts, and with no Back-Cover
+.\" Texts.  A copy of the license is included in the `COPYING.DOC' file
+.\" as part of this distribution.
+.\"
+.TH gd_eof64 3 "25 May 2012" "Version 0.8.0" "GETDATA"
+.SH NAME
+gd_eof64 \(em retrieve data from a dirfile database, with largefile support
+.SH SYNOPSIS
+.B #define GD_64BIT_API
+
+.B #include <getdata.h>
+.HP
+.nh
+.ad l
+.BI "gd_off64_t gd_eof64(DIRFILE *" dirfile ", const char *" field_code );
+.hy
+.ad n
+.SH DESCRIPTION
+This version of
+.BR gd_eof (3)
+uses a 64-bit offset type
+.RB ( gd_off64_t ),
+where one is available, regardless of the size of
+.BR off_t .
+It is only available if one defines
+.IR GD_64BIT_API
+or
+.IR _LARGEFILE64_SOURCE
+before including getdata.h.
+
+If
+.I off_t
+is a 64-bit type (possibly because
+.I _FILE_OFFSET_BITS
+has been defined to 64), this function will the same as
+.BR gd_eof (3).
+Otherwise,
+.BR gd_eof (3)
+will be a version of this function which uses a 32-bit
+.IR off_t .
+.SH SEE ALSO
+.BR gd_eof (3),
+.BR feature_test_macros (7)
diff --git a/man/gd_error.3 b/man/gd_error.3
index 273ba0f..9ddd489 100644
--- a/man/gd_error.3
+++ b/man/gd_error.3
@@ -1,6 +1,6 @@
 .\" gd_error.3.  The gd_error man page.
 .\"
-.\" Copyright (C) 2008, 2010 D. V. Wiebe
+.\" Copyright (C) 2008, 2010, 2011 D. V. Wiebe
 .\"
 .\""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
 .\"
@@ -13,7 +13,7 @@
 .\" Texts.  A copy of the license is included in the `COPYING.DOC' file
 .\" as part of this distribution.
 .\"
-.TH gd_error 3 "25 May 2010" "Version 0.7.0" "GETDATA"
+.TH gd_error 3 "20 April 2011" "Version 0.8.0" "GETDATA"
 .SH NAME
 gd_error \(em report a GetData library error
 .SH SYNOPSIS
@@ -31,11 +31,6 @@ function returns the numeric dirfile error associated with the dirfile
 .I dirfile
 which is set by many GetData library functions.
 
-The 
-.I dirfile
-argument should point to a DIRFILE object previously created by a call to
-.BR gd_open (3).
-
 A textual description of the error may be obtained by calling
 .BR gd_error_string (3).
 
@@ -45,5 +40,5 @@ The
 function always returns the dirfile error corresponding to the error state of
 the last library call on the supplied DIRFILE object.
 .SH SEE ALSO
-.BR gd_open (3),
+.BR gd_error_count (3),
 .BR gd_error_string (3)
diff --git a/man/gd_error_count.3 b/man/gd_error_count.3
new file mode 100644
index 0000000..0b9a7a9
--- /dev/null
+++ b/man/gd_error_count.3
@@ -0,0 +1,58 @@
+.\" gd_error_count.3.  The gd_error_count man page.
+.\"
+.\" Copyright (C) 2011 D. V. Wiebe
+.\"
+.\""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
+.\"
+.\" This file is part of the GetData project.
+.\"
+.\" Permission is granted to copy, distribute and/or modify this document
+.\" under the terms of the GNU Free Documentation License, Version 1.2 or
+.\" any later version published by the Free Software Foundation; with no
+.\" Invariant Sections, with no Front-Cover Texts, and with no Back-Cover
+.\" Texts.  A copy of the license is included in the `COPYING.DOC' file
+.\" as part of this distribution.
+.\"
+.TH gd_error_count 3 "18 August 2011" "Version 0.8.0" "GETDATA"
+.SH NAME
+gd_error_count \(em report the number of errors encountered by the GetData
+library
+.SH SYNOPSIS
+.B #inlcude <getdata.h>
+.HP
+.nh
+.ad l
+.BI "int gd_error_check(DIRFILE *" dirfile );
+.hy
+.ad n
+.SH DESCRIPTION
+The first time
+.BR gd_error_count ()
+is called with the DIRFILE object
+.IR dirfile ,
+it returns the number of errors encountered by the GetData library while
+operating on the specified DIRFILE object, since the DIRFILE's creation.
+Calling this function resets the internal count, so that subsequent calls to
+.BR gd_error_count ()
+return the number of errors encountered only since the previous call to this
+function, for the specified DIRFILE.
+
+The errors themselves are not cached by the library.  The error status of
+the 
+.I last
+library call on
+.I dirfile
+(which might be
+.BR GD_E_OK ,
+indicating no error) can be obtained by calling
+.BR gd_error (3).
+
+.SH RETURN VALUE
+The
+.BR gd_error_count ()
+function always returns the number of GetData errors encountered since the last
+time it was called, or since the dirfile was created. This will be zero, if no
+error has occurred over the given time.
+.SH SEE ALSO
+.BR gd_error (3),
+.BR gd_error_string (3)
diff --git a/man/gd_error_string.3 b/man/gd_error_string.3
index 8366535..9cdd0b6 100644
--- a/man/gd_error_string.3
+++ b/man/gd_error_string.3
@@ -1,6 +1,6 @@
 .\" gd_error_string.3.  The gd_error_string man page.
 .\"
-.\" Copyright (C) 2008, 2009, 2010 D. V. Wiebe
+.\" Copyright (C) 2008, 2009, 2010, 2011 D. V. Wiebe
 .\"
 .\""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
 .\"
@@ -13,7 +13,8 @@
 .\" Texts.  A copy of the license is included in the `COPYING.DOC' file
 .\" as part of this distribution.
 .\"
-.TH gd_error_string 3 "3 November 2010" "Version 0.7.0" "GETDATA"
+.TH gd_error_string 3 "20 April 2011" "Version 0.8.0" "GETDATA"
+.SH NAME
 gd_error_string \(em report a GetData library error
 .SH SYNOPSIS
 .B #include <getdata.h>
@@ -53,11 +54,6 @@ using
 .BR free (3)
 when it is no longer needed.
 
-The 
-.I dirfile
-argument should point to a DIRFILE object previously created by a call to
-.BR gd_open (3).
-
 .SH RETURN VALUE
 If
 .I buffer
@@ -71,5 +67,5 @@ error state of
 .I dirfile
 is unchanged.
 .SH SEE ALSO
-.BR gd_open (3),
-.BR gd_error (3)
+.BR gd_error (3),
+.BR gd_error_count (3)
diff --git a/man/gd_flags.3 b/man/gd_flags.3
new file mode 100644
index 0000000..4794806
--- /dev/null
+++ b/man/gd_flags.3
@@ -0,0 +1,93 @@
+.\" gd_flags.3.  The gd_flags man page.
+.\"
+.\" Copyright (C) 2012 D. V. Wiebe
+.\"
+.\""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
+.\"
+.\" This file is part of the GetData project.
+.\"
+.\" Permission is granted to copy, distribute and/or modify this document
+.\" under the terms of the GNU Free Documentation License, Version 1.2 or
+.\" any later version published by the Free Software Foundation; with no
+.\" Invariant Sections, with no Front-Cover Texts, and with no Back-Cover
+.\" Texts.  A copy of the license is included in the `COPYING.DOC' file
+.\" as part of this distribution.
+.\"
+.TH gd_flags 3 "1 April 2012" "Version 0.8.0" "GETDATA"
+.SH NAME
+gd_flags \(em alter GetData operational flags
+.SH SYNOPSIS
+.B #include <getdata.h>
+.HP
+.nh
+.ad l
+.BI "unsigned long gd_flags(DIRFILE *" dirfile ", unsigned long " set ,
+.BI "unsigned long " reset );
+.hy
+.ad n
+.SH DESCRIPTION
+The
+.BR gd_flags ()
+function modifies the operational flags of the dirfile(5) database specified by
+.IR dirfile ,
+and returns the new value of the flags register.
+
+The flags which may be queried or modified with this interface are a subset of
+the open flags (see
+.BR gd_cbopen (3)).
+These are:
+.TP
+.B GD_PRETTY_PRINT
+When dirfile metadata are flushed to disk (either explicitly via
+.BR gd_metaflush "(3), " gd_rewrite_fragment (3),
+or 
+.BR gd_flush (3)
+or implicitly by closing the dirfile), an attempt will be made to create a
+nicer looking format specification (from a human-readable standpoint).  What
+this explicitly means is not part of the API, and any particular behaviour
+should not be relied on.  If the dirfile has been opened read-only, this flag is
+ignored.
+.TP
+.B GD_VERBOSE
+Specifies that whenever an error is triggered by the library when working
+on this dirfile, the corresponding error string, which can be retrieved by
+calling 
+.BR gd_error_string (3),
+should be written on the caller's standard error stream
+.RB ( stderr (3))
+by GetData.  The error string may be prefixed by a string specified by the
+caller; see
+.BR gd_verbose_prefix (3).
+Without this flag, GetData writes nothing to standard error.  (GetData never
+writes to standard output.)
+.PP
+Flags which appear only in
+.I set
+will be turned on (enabled); flags which appear only in
+.I reset
+will be turned off (disabled); flags which appear in both
+.I set
+and
+.I reset
+will be toggled.  Flags which appear in neither of these are left unchanged.
+Accordingly, to simply query the current flags, both
+.I set
+and
+.I reset
+should be zero, and to explicitly specify all the flags, ignoring their old
+values, the new flags register should be given in
+.IR set ,
+and it's bitwise complement in
+.IR reset .
+
+.SH RETURN VALUE
+The
+.BR gd_flags ()
+function returns a bitwise or'd collection those of the above flags which are
+enabled after performing the modifications specified (if any).  This function
+does not fail.
+.SH SEE ALSO
+.BR dirfile (5),
+.BR gd_cbopen (3),
+.BR gd_verbose_prefix (3),
+.BR stderr (3).
diff --git a/man/gd_flush.3 b/man/gd_flush.3
index bffa767..6443807 100644
--- a/man/gd_flush.3
+++ b/man/gd_flush.3
@@ -1,6 +1,6 @@
 .\" gd_flush.3.  The gd_flush man page.
 .\"
-.\" Copyright (C) 2008, 2009, 2010 D. V. Wiebe
+.\" Copyright (C) 2008, 2009, 2010, 2011, 2012 D. V. Wiebe
 .\"
 .\""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
 .\"
@@ -13,21 +13,27 @@
 .\" Texts.  A copy of the license is included in the `COPYING.DOC' file
 .\" as part of this distribution.
 .\"
-.TH gd_flush 3 "24 July 2010" "Version 0.7.0" "GETDATA"
+.TH gd_flush 3 "15 March 2012" "Version 0.8.0" "GETDATA"
 .SH NAME
-gd_flush \(em write all pending dirfile changes to disk.
+gd_flush gd_raw_close gd_sync \(em write all pending dirfile changes to disk or
+close open raw fields
 .SH SYNOPSIS
 .B #include <getdata.h>
 .HP
 .nh
 .ad l
+.HP
 .BI "int gd_flush(DIRFILE *" dirfile ", const char *" field_code );
+.HP
+.BI "int gd_raw_close(DIRFILE *" dirfile ", const char *" field_code );
+.HP
+.BI "int gd_sync(DIRFILE *" dirfile ", const char *" field_code );
 .hy
 .ad n
 .SH DESCRIPTION
 The
-.BR gd_flush ()
-function flushes and closes all file handles associated with
+.BR gd_sync ()
+function flushes all pending writes to disk of raw data files associated with
 .IR field_code ,
 or its input(s), in the dirfile specified by
 .IR dirfile .
@@ -38,22 +44,37 @@ if
 .I field_code
 is NULL, all fields in
 .I dirfile
-will be flushed and closed.  In this special case, modified metadata will
-also be flushed to disk as if
+will be flushed.  In this special case, modified metadata will also be flushed
+to disk as if
 .BR gd_metaflush (3)
-had been called.
+had been called.  If the dirfile has been opened read-only, this function does
+nothing.  Additionally, some encoding schemes may implement this as a NOP.
 .PP
-Metadata is written to disk using the current Standards Version as stored in the
-.I dirfile
-object.  See
-.BR gd_dirfile_standards (3)
-to change or report the current Standards Version.  If the dirfile metadata
-conforms to no known Standards Version, a Standards non-compliant fragment will
-be written.
+The
+.BR gd_raw_close ()
+function closes any raw data files which GetData has opened associated with
+.IR field_code ,
+or its input(s).  Again, if
+.I field_code
+is NULL, all open data files are closed.
+.PP
+Calling
+.BR gd_flush ()
+is essentially equivalent to calling first
+.BR gd_sync ()
+and then
+.BR gd_raw_close ()
+(ie. it does both tasks), although, if
+.I field_code
+is NULL, the order of operations if may be different than making the two explicit
+calls.
 .SH RETURN VALUE
-On success, zero is returned.  On error, -1 is returned and the dirfile error is
-set to a non-zero error value.  Possible error values are:
+On success, these functions return zero.  On error, -1 is returned and the
+dirfile error is set to a non-zero error value.  Possible error values are:
 .TP 8
+.B GD_E_ALLOC
+The library was unable to allocate memory.
+.TP
 .B GD_E_BAD_CODE
 The field specified by
 .I field_code
@@ -68,6 +89,8 @@ The representation suffix specified in
 was not recognised.
 .TP
 .B GD_E_FLUSH
+(Not
+.BR gd_raw_close ().)
 A temporary file could not be opened into which to write the modified metadata,
 or renaming the temporary file over the original fragment failed.  Only returned
 when
@@ -76,6 +99,12 @@ is NULL.
 .TP
 .B GD_E_RAW_IO
 An error occurred while trying to flush or close the field(s).
+.TP
+.B GD_E_RECURSE_LEVEL
+Too many levels of recursion were encountered while trying to resolve
+.IR field_code .
+This usually indicates a circular dependency in field specification in the
+dirfile.
 .PP
 The dirfile error may be retrieved by calling
 .BR gd_error (3).
diff --git a/man/gd_fragment_affixes.3 b/man/gd_fragment_affixes.3
new file mode 100644
index 0000000..3f9526a
--- /dev/null
+++ b/man/gd_fragment_affixes.3
@@ -0,0 +1,88 @@
+.\" gd_fragment_affix.3.  The gd_fragment_affix man page.
+.\"
+.\" Copyright (C) 2012 D. V. Wiebe
+.\"
+.\""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
+.\"
+.\" This file is part of the GetData project.
+.\"
+.\" Permission is granted to copy, distribute and/or modify this document
+.\" under the terms of the GNU Free Documentation License, Version 1.2 or
+.\" any later version published by the Free Software Foundation; with no
+.\" Invariant Sections, with no Front-Cover Texts, and with no Back-Cover
+.\" Texts.  A copy of the license is included in the `COPYING.DOC' file
+.\" as part of this distribution.
+.\"
+.TH gd_fragment_affix 3 "2 August 2012" "Version 0.8.1" "GETDATA"
+.SH NAME
+gd_fragment_affix \(em report the field affixes of a fragment of a dirfile database
+.SH SYNOPSIS
+.B #include <getdata.h>
+.HP
+.nh
+.ad l
+.BI "int gd_fragment_affix(DIRFILE *" dirfile ", int " fragment_index ,
+.BI "char **" prefix ", char **" suffix );
+.hy
+.ad n
+.SH DESCRIPTION
+The
+.BR gd_fragment_affix ()
+function queries a dirfile(5) database specified by
+.I dirfile
+and returns the field affixes for the fragment indexed by
+.IR fragment_index .
+The field prefix and suffix are appended to all field codes found in the
+specified fragment.
+
+The
+.I prefix
+and
+.I suffix
+parameters point to memory locations in which store the addresses of the
+returned strings.
+
+The
+.I dirfile
+argument must point to a valid DIRFILE object previously created by a call to
+.BR gd_open (3).
+
+.SH RETURN VALUE
+Upon successful completion,
+.BR gd_fragment_affix ()
+returns zero.  If non-empty, the prefix and suffix are reported in
+.BR malloc (3)'d
+buffers whose addresses are returned in
+.BI * prefix
+and
+.BI * suffix\fR.
+They should be deallocated by the caller when no longer needed by calling
+.BR free (3).
+If the fragment prefix or suffix is the empty string, NULL is returned in the
+corresponding pointer.
+
+On error, -1 is returned and sets the dirfile error to a non-zero error value.
+In this case, the values of
+.BI * prefix
+and
+.BI * suffix
+are unspecified, but will NOT be pointers to valid allocated memory.  Possible
+dirfile error values are:
+.TP 8
+.B GD_E_BAD_DIRFILE
+The supplied dirfile was invalid.
+.TP
+.B GD_E_BAD_INDEX
+The supplied index was out of range.
+.PP
+The dirfile error may be retrieved by calling
+.BR gd_error (3).
+A descriptive error string for the last error encountered can be obtained from
+a call to
+.BR gd_error_string (3).
+.SH SEE ALSO
+.BR gd_alter_frameoffset (3),
+.BR gd_include_affixes (3),
+.BR gd_open (3),
+.BR dirfile (5),
+.BR dirfile-format (5)
diff --git a/man/gd_fragment_index.3 b/man/gd_fragment_index.3
index eb11e72..ee33739 100644
--- a/man/gd_fragment_index.3
+++ b/man/gd_fragment_index.3
@@ -1,6 +1,6 @@
 .\" gd_fragment_index.3.  The gd_fragment_index man page.
 .\"
-.\" Copyright (C) 2008, 2009, 2010 D. V. Wiebe
+.\" Copyright (C) 2008, 2009, 2010, 2011, 2012 D. V. Wiebe
 .\"
 .\""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
 .\"
@@ -13,7 +13,7 @@
 .\" Texts.  A copy of the license is included in the `COPYING.DOC' file
 .\" as part of this distribution.
 .\"
-.TH gd_fragment_index 3 "15 July 2010" "Version 0.7.0" "GETDATA"
+.TH gd_fragment_index 3 "1 January 2012" "Version 0.8.0" "GETDATA"
 .SH NAME
 gd_fragment_index \(em retrieve the fragment containing a dirfile field
 .SH SYNOPSIS
@@ -22,7 +22,7 @@ gd_fragment_index \(em retrieve the fragment containing a dirfile field
 .nh
 .ad l
 .BI "int gd_fragment_index(const DIRFILE *" dirfile ", const char"
-.BI * field_code );
+.BI * entry_name );
 .hy
 .ad n
 .SH DESCRIPTION
@@ -30,11 +30,16 @@ The
 .BR gd_fragment_index ()
 function queries a dirfile(5) database specified by
 .I dirfile
-and returns the index number of the fragment defining the field specified by
-.IR field_code .
-If
-.I field_code
-contains a representation suffix, it will be ignored.
+and returns the index number of the fragment defining the field or alias
+specified by
+.IR entry_name ,
+which may not contain a representation suffix.
+
+This is one of the few GetData functions which does not resolve aliases:
+supplying the name of an alias as
+.I entry_name
+will return the index of the fragment containing the alias itself and not that
+of its target.
 .SH RETURN VALUE
 Upon successful completion,
 .BR gd_fragment_index ()
@@ -43,18 +48,16 @@ returns the requested fragment index.  On error,
 returns -1 and sets the dirfile error a non-zero error value.  Possible error
 values are:
 .TP 8
-.B GD_E_BAD_DIRFILE
-The supplied dirfile was invalid.
+.B GD_E_ALLOC
+The library was unable to allocate memory.
 .TP
 .B GD_E_BAD_CODE
-The field specified by
-.I field_code
+The entry specified by
+.I entry_name
 was not found in the database.
 .TP
-.B GD_E_BAD_REPR
-The representation suffix specified in
-.I field_code
-was not recognised.
+.B GD_E_BAD_DIRFILE
+The supplied dirfile was invalid.
 .PP
 The dirfile error may be retrieved by calling
 .BR gd_error (3).
diff --git a/man/gd_framenum_subset.3 b/man/gd_framenum_subset.3
index 9890473..94e3aec 100644
--- a/man/gd_framenum_subset.3
+++ b/man/gd_framenum_subset.3
@@ -1,6 +1,6 @@
 .\" gd_framenum_subset.3.  The gd_framenum man page.
 .\"
-.\" Copyright (C) 2009, 2010 D. V. Wiebe
+.\" Copyright (C) 2009, 2010, 2011 D. V. Wiebe
 .\"
 .\""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
 .\"
@@ -13,7 +13,7 @@
 .\" Texts.  A copy of the license is included in the `COPYING.DOC' file
 .\" as part of this distribution.
 .\"
-.TH gd_framenum_subset 3 "23 October 2010" "Version 0.7.0" "GETDATA"
+.TH gd_framenum_subset 3 "18 August 2011" "Version 0.8.0" "GETDATA"
 .SH NAME
 gd_framenum_subset, gd_framenum \(em perform a reverse look-up on a
 monotonic dirfile field
@@ -110,11 +110,6 @@ was not found.
 .B GD_E_BAD_DIRFILE
 The supplied dirfile was invalid.
 .TP
-.B GD_E_BAD_FIELD_TYPE
-The field specified by
-.I field_code
-was not a vector field.
-.TP
 .B GD_E_BAD_REPR
 The representation suffix specified in
 .IR field_code ,
@@ -125,7 +120,10 @@ A scalar field used in the definition of the field was not found, or was not of
 scalar type.
 .TP
 .B GD_E_DIMENSION
-A scalar field was found where a vector field was expected.
+The field specified by
+.I field_code
+was not a vector field.  Or, a scalar field was found where a vector field was
+expected in the definition of the field or one of its inputs.
 .TP
 .B GD_E_DOMAIN
 The specified field was complex valued, or the supplied frame range was too
diff --git a/man/gd_framenum_subset64.3 b/man/gd_framenum_subset64.3
index ac1e96d..2223068 100644
--- a/man/gd_framenum_subset64.3
+++ b/man/gd_framenum_subset64.3
@@ -1,6 +1,6 @@
 .\" gd_framenum_subset64.3.  The gd_framenum_subset64 man page.
 .\"
-.\" Copyright (C) 2008, 2010 D. V. Wiebe
+.\" Copyright (C) 2008, 2010, 2012 D. V. Wiebe
 .\"
 .\""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
 .\"
@@ -13,37 +13,43 @@
 .\" Texts.  A copy of the license is included in the `COPYING.DOC' file
 .\" as part of this distribution.
 .\"
-.TH gd_framenum_subset64 3 "15 July 2010" "Version 0.7.0" "GETDATA"
+.TH gd_framenum_subset64 3 "25 May 2012" "Version 0.8.0" "GETDATA"
 .SH NAME
 gd_framenum_subset64 \(em perform a reverse look-up on a monotonic dirfile
-field
+field, with largefile support.
 .SH SYNOPSIS
-.B #define _LARGEFILE64_SOURCE
+.B #define GD_64BIT_API
 
 .B #include <getdata.h>
 .HP
 .nh
 .ad l
 .BI "double gd_framenum_subset64(DIRFILE *" dirfile ,
-.BI "const char *" field_code ", double " value ", off64_t " field_start ,
-.BI "off64_t " field_end );
+.BI "const char *" field_code ", double " value ", gd_off64_t " field_start ,
+.BI "gd_off64_t " field_end );
 .hy
 .ad n
 .SH DESCRIPTION
 This version of
 .BR gd_framenum_subset (3)
-uses a 64-bit offset type, even if
-.I off_t
-is a 32-bit type.  It is only available if one defines
-.IR _LARGEFILE64_SOURCE .
+uses a 64-bit offset type
+.RB ( gd_off64_t ),
+where one is available, regardless of the size of
+.BR off_t .
+It is only available if one defines
+.IR GD_64BIT_API
+or
+.IR _LARGEFILE64_SOURCE
+before including getdata.h.
+
 If
 .I off_t
-is a 64-bit type (i.e. if
+is a 64-bit type (possibly because
 .I _FILE_OFFSET_BITS
-is defined to be 64), this function will be called
-.BR gd_framenum_subset ().
+has been defined to 64), this function will the same as
+.BR gd_framenum_subset (3).
 Otherwise,
-.BR gd_framenum_subset ()
+.BR gd_framenum_subset (3)
 will be a version of this function which uses a 32-bit
 .IR off_t .
 .SH SEE ALSO
diff --git a/man/gd_frameoffset64.3 b/man/gd_frameoffset64.3
index e382efa..459e895 100644
--- a/man/gd_frameoffset64.3
+++ b/man/gd_frameoffset64.3
@@ -13,47 +13,51 @@
 .\" Texts.  A copy of the license is included in the `COPYING.DOC' file
 .\" as part of this distribution.
 .\"
-.TH gd_frameoffset64 3 "16 July 2010" "Version 0.7.0" "GETDATA"
+.TH gd_frameoffset64 3 "25 May 2012" "Version 0.8.0" "GETDATA"
 .SH NAME
 gd_frameoffset64, gd_alter_frameoffset64 \(em report or change the frame
 offset of fields in a dirfile, with largefile support
 .SH SYNOPSIS
-.B #define _LARGEFILE64_SOURCE
+.B #define GD_64BIT_API
 
 .B #include <getdata.h>
 .HP
 .nh
 .ad l
-.BI "off64_t gd_frameoffset(DIRFILE *" dirfile ", int " fragment_index );
+.BI "gd_off64_t gd_frameoffset(DIRFILE *" dirfile ", int " fragment_index );
 .HP
-.BI "int gd_alter_frameoffset64(DIRFILE *" dirfile ", off64_t " offset ,
+.BI "int gd_alter_frameoffset64(DIRFILE *" dirfile ", gd_off64_t " offset ,
 .BI "int " fragment_index ", int " move );
 .hy
 .ad n
 .SH DESCRIPTION
-These version of
+These versions of
 .BR gd_frameoffset (3)
 and
 .BR gd_alter_frameoffset (3)
-use a 64-bit offset type, even if
-.I off_t
-is a 32-bit type.  They are only available if the caller defines
-.I _LARGEFILE64_SOURCE 
+use a 64-bit offset type
+.RB ( gd_off64_t ),
+where one is available, regardless of the size of
+.BR off_t .
+They are only available if one defines
+.IR GD_64BIT_API
+or
+.IR _LARGEFILE64_SOURCE
 before including getdata.h.
 
 If
 .I off_t
-is a 64-bit type (i.e. if
+is a 64-bit type (possibly because
 .I _FILE_OFFSET_BITS
-is defined to be 64), these function will be called
-.BR gd_frameoffset ()
+has been defined to 64), these functions will the same as
+.BR gd_framenum_subset (3)
 and
-.BR gd_alter_frameoffset ().
+.BR gd_alter_frameoffset (3).
 Otherwise,
-.BR gd_frameoffset ()
+.BR gd_framenum_subset (3)
 and
-.BR gd_alter_frameoffset ()
-will be versions of these functions which use a 32-bit
+.BR gd_alter_frameoffset (3)
+will be versions of these function which use a 32-bit
 .IR off_t .
 .SH SEE ALSO
 .BR gd_alter_frameoffset (3),
diff --git a/man/gd_get_carray_slice.3 b/man/gd_get_carray_slice.3
index a548390..2d98774 100644
--- a/man/gd_get_carray_slice.3
+++ b/man/gd_get_carray_slice.3
@@ -1,6 +1,6 @@
 .\" gd_get_carray_slice.3.  The gd_get_carray_slice man page.
 .\"
-.\" Copyright (C) 2010 D. V. Wiebe
+.\" Copyright (C) 2010, 2011, 2012 D. V. Wiebe
 .\"
 .\""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
 .\"
@@ -13,10 +13,9 @@
 .\" Texts.  A copy of the license is included in the `COPYING.DOC' file
 .\" as part of this distribution.
 .\"
-.TH gd_get_carray_slice 3 "3 Novmeber 2010" "Version 0.7.0" "GETDATA"
+.TH gd_get_carray_slice 3 "4 July 2012" "Version 0.8.0" "GETDATA"
 .SH NAME
-gd_get_carray gd_get_carray_slice \(em retrieve CARRAY data from a dirfile
-database
+gd_get_carray, gd_get_carray_slice, gd_get_constant \(em retrieve CONST or\CARRAY data from a dirfile database
 .SH SYNOPSIS
 .B #include <getdata.h>
 .HP
@@ -28,6 +27,9 @@ database
 .HP
 .BI "int gd_get_carray(DIRFILE *" dirfile ", const char *" field_code ,
 .BI "gd_type_t " return_type ", void *" data_out );
+.HP
+.BI "int gd_get_constant(DIRFILE *" dirfile ", const char *" field_code ,
+.BI "gd_type_t " return_type ", void *" data_out );
 .hy
 .ad n
 .SH DESCRIPTION
@@ -36,6 +38,8 @@ The
 function queries a dirfile(5) database specified by
 .I dirfile
 for the
+.B CONST
+or
 .B CARRAY
 scalar array
 .IR field_code ,
@@ -48,9 +52,26 @@ The first element of the field stored is given by
 .IR start ,
 and the number of elements stored is given by
 .IR len .
+
 The
 .BR gd_get_carray ()
-function behaves similarly, except it returns the entire field.
+function behaves similarly, except it returns the entire field, as if
+.BR gd_get_carray_slice ()
+were called with
+.I start
+equal to zero and
+.I len
+equal to the value returned by
+.BR gd_carray_len (3).
+The
+.BR gd_get_constant ()
+function is equivalent to calling
+.BR gd_get_carray_slice ()
+with
+.I start
+equal to zero and
+.I len
+equal to one.
 
 The 
 .I dirfile
@@ -69,8 +90,7 @@ Unlike
 calling
 .BR gd_get_carray_slice ()
 never results in a short read; attempting to read past the end of the
-.B CARRAY
-will result in an error, and no data will be returned.
+field will result in an error, and no data will be returned.
 
 The 
 .I return_type
@@ -78,43 +98,43 @@ argument should be one of the following symbols, which indicates the desired
 return type of the data:
 .RS
 .TP 11
-.I GD_UINT8
+.B GD_UINT8
 unsigned 8-bit integer
 .TP
-.I GD_INT8
+.B GD_INT8
 signed (two's complement) 8-bit integer
 .TP
-.I GD_UINT16
+.B GD_UINT16
 unsigned 16-bit integer
 .TP
-.I GD_INT16
+.B GD_INT16
 signed (two's complement) 16-bit integer
 .TP
-.I GD_UINT32
+.B GD_UINT32
 unsigned 32-bit integer
 .TP
-.I GD_INT32
+.B GD_INT32
 signed (two's complement) 32-bit integer
 .TP
-.I GD_UINT64
+.B GD_UINT64
 unsigned 64-bit integer
 .TP
-.I GD_INT64
+.B GD_INT64
 signed (two's complement) 64-bit integer
 .TP
-.IR GD_FLOAT32
+.B GD_FLOAT32
 IEEE-754 standard 32-bit single precision floating point number
 .TP
-.IR GD_FLOAT64
+.B GD_FLOAT64
 IEEE-754 standard 64-bit double precision floating point number
 .TP
-.IR GD_COMPLEX64
+.B GD_COMPLEX64
 C99-conformant 64-bit single precision complex number
 .TP
-.IR GD_COMPLEX128
+.B GD_COMPLEX128
 C99-conformant 128-bit double precision complex number
 .TP
-.I GD_NULL
+.B GD_NULL
 the null type: the database is queried as usual, but no data is returned.
 In this case,
 .I data_out
@@ -136,6 +156,9 @@ and
 return zero.  On error, they return -1 and set the dirfile error to a non-zero
 value.  Possible error values are:
 .TP 8
+.B GD_E_ALLOC
+The library was unable to allocate memory.
+.TP
 .B GD_E_BAD_CODE
 The field specified by
 .I field_code
@@ -149,11 +172,12 @@ was supplied.
 .B GD_E_BAD_FIELD_TYPE
 The supplied
 .I field_code
-referred to a field of a type other than 
+was not a
+.BR CONST
+nor
 .BR CARRAY .
 The caller should use
-.BR gd_getdata (3),
-.BR gd_get_constant (3),
+.BR gd_getdata (3)
 or
 .BR gd_get_string (3)
 instead.
@@ -168,7 +192,7 @@ An invalid
 .I return_type
 was specified.
 .TP
-.B GE_E_BOUNDS
+.B GD_E_BOUNDS
 A request for data beyond the end of the field was made.
 .TP
 .B GD_E_INTERNAL_ERROR
diff --git a/man/gd_getdata.3 b/man/gd_getdata.3
index 539afa5..536cf1c 100644
--- a/man/gd_getdata.3
+++ b/man/gd_getdata.3
@@ -1,6 +1,6 @@
 .\" gd_getdata.3.  The gd_getdata man page.
 .\"
-.\" Copyright (C) 2008, 2009, 2010 D. V. Wiebe
+.\" Copyright (C) 2008, 2009, 2010, 2011, 2012, 2013 D. V. Wiebe
 .\"
 .\""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
 .\"
@@ -13,7 +13,7 @@
 .\" Texts.  A copy of the license is included in the `COPYING.DOC' file
 .\" as part of this distribution.
 .\"
-.TH gd_getdata 3 "3 November 2010" "Version 0.7.0" "GETDATA"
+.TH gd_getdata 3 "26 January 2013" "Version 0.8.3" "GETDATA"
 .SH NAME
 gd_getdata \(em retrieve data from a dirfile database
 .SH SYNOPSIS
@@ -62,18 +62,20 @@ The argument
 must point to a valid memory location of sufficient size to hold all data
 requested.
 
-The first sample returned will be
-.RS
+Unless using
+.B GD_HERE 
+(see below), the first sample returned will be
+.IP
 .IR first_frame " * " samples_per_frame " + " first_sample
-.RE
+.PP
 as measured from the start of the dirfile, where
 .I samples_per_frame
 is the number of samples per frame as returned by
 .BR gd_spf (3).
 The number of samples fetched is, similarly,
-.RS
+.IP
 .IR num_frames " * " samples_per_frame " + " num_samples .
-.RE
+.PP
 Although calling
 .BR gd_getdata ()
 using both samples and frames is possible, the function is typically called
@@ -83,49 +85,61 @@ or
 .IR num_frames " and " first_frames ,
 equal to zero.
 
+Instead of explicitly specifying the origin of the read, the caller may pass the
+special symbol
+.B GD_HERE
+as
+.IR first_frame .
+This will result in the read occurring at the current position of the I/O
+pointer for the field (see
+.BR gd_seek (3)
+for a discussion of field I/O pointers).  In this case, the value of
+.I first_sample
+is ignored.
+
 The 
 .I return_type
 argument should be one of the following symbols, which indicates the desired
 return type of the data:
 .RS
 .TP 11
-.I GD_UINT8
+.B GD_UINT8
 unsigned 8-bit integer
 .TP
-.I GD_INT8
+.B GD_INT8
 signed (two's complement) 8-bit integer
 .TP
-.I GD_UINT16
+.B GD_UINT16
 unsigned 16-bit integer
 .TP
-.I GD_INT16
+.B GD_INT16
 signed (two's complement) 16-bit integer
 .TP
-.I GD_UINT32
+.B GD_UINT32
 unsigned 32-bit integer
 .TP
-.I GD_INT32
+.B GD_INT32
 signed (two's complement) 32-bit integer
 .TP
-.I GD_UINT64
+.B GD_UINT64
 unsigned 64-bit integer
 .TP
-.I GD_INT64
+.B GD_INT64
 signed (two's complement) 64-bit integer
 .TP
-.IR GD_FLOAT32
+.B GD_FLOAT32
 IEEE-754 standard 32-bit single precision floating point number
 .TP
-.IR GD_FLOAT64
+.B GD_FLOAT64
 IEEE-754 standard 64-bit double precision floating point number
 .TP
-.IR GD_COMPLEX64
+.B GD_COMPLEX64
 C99-conformant 64-bit single precision complex number
 .TP
-.IR GD_COMPLEX128
+.B GD_COMPLEX128
 C99-conformant 128-bit double precision complex number
 .TP
-.I GD_NULL
+.B GD_NULL
 the null type: the database is queried as usual, but no data is returned.
 In this case,
 .I data_out
@@ -140,6 +154,93 @@ does not indicate a representation, but conversion from a complex value to a
 purely real one is required, only the real portion of the requested vector will
 be returned.
 
+Upon successful completion, the I/O pointer of the field will be on the sample
+immediately following the last sample returned.  On error, the position of the
+I/O pointer is not specified, and may not even be well defined.
+
+.SS Behaviour While Reading Specific Field Types
+
+.TP
+.BR PHASE :
+A forward-shifted
+.B PHASE
+field will always encounter the end-of-field marker before its input field does.
+This has ramifications when reading
+streaming data
+with
+.BR gd_getdata ()
+and using
+.BR gd_nframes (3)
+to gauge field lengths (that is: a
+forward-shifted
+.B PHASE
+field always has less data in it than
+.BR gd_nframes (3)
+implies that it does).  As with any other field,
+.BR gd_getdata ()
+will return a short count whenever a read from a
+.B PHASE
+field encounters the end-of-field marker.
+
+Backward-shifted
+.B PHASE
+fields do not suffer from this problem, since
+.BR gd_getdata ()
+pads reads past the beginning-of-field marker with NaN or zero as appropriate.
+Database creators who wish to use the
+.B PHASE
+field type with streaming data are encouraged to work around this limitation
+by only using backward-shifted 
+.B PHASE
+fields, by writing
+.B RAW
+data at the maximal frame lag, and then back-shifting all data which should have
+been written earlier.  Another possible work-around is to write
+systematically less data to the reference
+.B RAW
+field in proportion to the maximal forward phase shift.  This method will work
+with applications which respect the database size reported by
+.BR gd_nframes (3)
+resulting in these applications effectively ignoring all frames past the frame
+containing the maximally forward-shifted
+.B PHASE
+field's end-of-field marker.
+
+.TP
+.BR MPLEX :
+Reading an
+.B MPLEX
+field typically requires GetData to read data before the range returned in order
+to determine the value of the first sample returned.  This can become expensive
+if the encoding of the underlying RAW data does not support seeking backwards
+(which is true of most compression encodings).  How much preceding data GetData
+searches for the initial value of the returned data can be adjusted, or the
+lookback disabled completely, using
+.BR gd_mplex_lookback (3).
+If the initial value of the field is not found in the data searched, GetData
+will fill the returned vector, up to the next available sample of the
+mulitplexed field, with zero for integer return types, or IEEE-754-conforming
+NaN (not-a-number) for floating point return types, as it does when providing
+data before the beginning-of-field.
+
+GetData caches the value of the last sample from every
+.B MPLEX
+it reads so that a subsequent read of the field starting from the following
+sample (either through an explicit starting sample given by the caller or else
+implicitly using
+.BR GD_HERE )
+will not need to scan the field backwards.  This cache is invalidated if a
+different return type is used, or if an intervening operation moves the field's
+I/O pointer.
+
+.TP
+.BR WINDOW :
+The samples of a
+.B WINDOW
+for which the field conditional is false will be filled with either zero for
+integer return types, or IEEE-754-conforming NaN (not-a-number) for floating
+point return types.
+
 .SH RETURN VALUE
 In all cases,
 .BR gd_getdata ()
@@ -168,19 +269,6 @@ An invalid
 .I dirfile
 was supplied.
 .TP
-.B GD_E_BAD_FIELD_TYPE
-The supplied
-.I field_code
-referred to a 
-.BR CONST ,\~ CARRAY ,
-or 
-.B STRING
-field.  The caller should use
-.BR gd_get_constant (3),\~ gd_get_carray (3) ,
-or
-.BR gd_get_string (3)
-instead.
-.TP
 .B GD_E_BAD_REPR
 The representation suffix specified in
 .IR field_code ,
@@ -196,7 +284,26 @@ An invalid
 was specified.
 .TP
 .B GD_E_DIMENSION
-A scalar field was found where a vector field was expected.
+The supplied
+.I field_code
+referred to a 
+.BR CONST ,\~ CARRAY ,
+or 
+.B STRING
+field.  The caller should use
+.BR gd_get_constant (3),\~ gd_get_carray (3) ,
+or
+.BR gd_get_string (3)
+instead.  Or, a scalar field was found where a vector field was expected in
+the definition of
+.I field_code
+or one of its inputs.
+.TP
+.B GD_E_DOMAIN
+An immediate read was attempted using
+.BR GD_HERE ,
+but the I/O pointer of the field was not well defined because two or more of
+the field's inputs did not agree as to the location of the I/O pointer.
 .TP
 .B GD_E_INTERNAL_ERROR
 An internal error occurred in the library while trying to perform the task.
@@ -225,65 +332,44 @@ Reading from dirfiles with the encoding scheme of the specified dirfile is not
 supported by the library.  See
 .BR dirfile-encoding (5)
 for details on dirfile encoding schemes.
-.RE
 .PP
 The dirfile error may be retrieved by calling
 .BR gd_error (3).
 A descriptive error string for the last error encountered can be obtained from
 a call to
 .BR gd_error_string (3).
-.SH LIMITATIONS
-The
-.B PHASE
-field type is poorly defined, since a forward-shifted
-.B PHASE
-field will always encounter the end-of-field marker before its input field does.
-This has ramifications when using
+.SH NOTES
+To save memory,
 .BR gd_getdata ()
-with streaming data.  The Dirfile
-Standards make tacit admission to this problem by indicating the results of
-reading a
-.B PHASE
-field beyond the beginning- or end-of-field is "implementation dependent" (see
-.BR dirfile-format (5)).
-As with any other field,
+uses the memory pointed to by
+.I data_out
+as scratch space while computing derived fields.  As a result, if an error is
+encountered during the computation, the contents of this memory buffer are
+unspecified, and may have been modified by this call, even though
 .BR gd_getdata ()
-will return a short count whenever a read from a
-.B PHASE
-field encounters the end-of-field marker.
+will report zero samples returned on error.
 
-Backward-shifted
-.B PHASE
-fields do not suffer from this problem, since
+Reading slim-compressed data (see defile-encoding(5)), may cause unexpected
+memory usage.  This is because slimlib internally caches open decompressed files
+as they are read, and getdata doesn't close data files between
 .BR gd_getdata ()
-pads reads past the beginning-of-field marker with NaN or zero as appropriate.
-Database creators who wish to use the
-.B PHASE
-field type with streaming data are encouraged to work around this limitation
-by only using backward-shifted 
-.B PHASE
-fields, by writing
-.B RAW
-data at the maximal time lag, and then back-shifting all data which should have
-been written earlier.  Another possible work-around is to write
-systematically less data to the first
-.B RAW
-field in proportion to the maximal forward phase shift.  This method will work
-with applications which respect the database size reported by
-.BR gd_nframes (3)
-resulting in these applications effectively ignoring all frames past the frame
-containing the maximally forward-shifted
-.B PHASE
-field's end-of-field marker.
+calls for efficiency's sake.  Memory used by this internal slimlib buffer can be
+reclaimed by calling
+.BR df_raw_close (3)
+on fields when finished reading them.
 
 .SH SEE ALSO
 .BR dirfile (5),
 .BR dirfile-encoding (5),
-.BR gd_open (3),
 .BR gd_get_constant (3),
+.BR gd_get_string (3),
 .BR gd_error (3),
 .BR gd_error_string (3),
+.BR gd_mplex_lookback (3),
 .BR gd_nframes (3),
+.BR gd_open (3),
+.BR gd_raw_close (3),
+.BR gd_seek (3),
 .BR gd_spf (3),
-.BR gd_get_string (3),
-.BR gd_putdata (3)
+.BR gd_putdata (3),
+.BR GD_SIZE (3)
diff --git a/man/gd_getdata64.3 b/man/gd_getdata64.3
index 219a8f6..51fb0fd 100644
--- a/man/gd_getdata64.3
+++ b/man/gd_getdata64.3
@@ -1,6 +1,6 @@
 .\" gd_getdata64.3.  The gd_getdata64 man page.
 .\"
-.\" Copyright (C) 2008, 2010 D. V. Wiebe
+.\" Copyright (C) 2008, 2010, 2012 D. V. Wiebe
 .\"
 .\""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
 .\"
@@ -13,36 +13,43 @@
 .\" Texts.  A copy of the license is included in the `COPYING.DOC' file
 .\" as part of this distribution.
 .\"
-.TH gd_getdata64 3 "25 May 2010" "Version 0.7.0" "GETDATA"
+.TH gd_getdata64 3 "25 May 2012" "Version 0.8.0" "GETDATA"
 .SH NAME
-gd_getdata64 \(em retrieve data from a dirfile database with largefile support
+gd_getdata64 \(em retrieve data from a dirfile database, with largefile support
 .SH SYNOPSIS
-.B #define _LARGEFILE64_SOURCE
+.B #define GD_64BIT_API
 
 .B #include <getdata.h>
 .HP
 .nh
 .ad l
-.BI "size_t gd_getdata64(DIRFILE *" dirfile ", const char *" field_code ", off64_t"
-.IB first_frame ", off64_t " first_sample ", size_t " num_frames ", size_t"
-.IB num_samples ", gd_type_t " return_type ", void *" data_out );
+.BI "size_t gd_getdata64(DIRFILE *" dirfile ", const char *" field_code ,
+.BI "gd_off64_t " first_frame ", gd_off64_t " first_sample ", size_t
+.IB num_frames ", size_t " num_samples ", gd_type_t " return_type ,
+.BI "void *" data_out );
 .hy
 .ad n
 .SH DESCRIPTION
 This version of
 .BR gd_getdata (3)
-uses a 64-bit offset type, even if
-.I off_t
-is a 32-bit type.  It is only available if one defines
-.IR _LARGEFILE64_SOURCE .
+uses a 64-bit offset type
+.RB ( gd_off64_t ),
+where one is available, regardless of the size of
+.BR off_t .
+It is only available if one defines
+.IR GD_64BIT_API
+or
+.IR _LARGEFILE64_SOURCE
+before including getdata.h.
+
 If
 .I off_t
-is a 64-bit type (i.e. if
+is a 64-bit type (possibly because
 .I _FILE_OFFSET_BITS
-is defined to be 64), this function will be called
-.BR gd_getdata ().
+has been defined to 64), this function will the same as
+.BR gd_getdata (3).
 Otherwise,
-.BR gd_getdata ()
+.BR gd_getdata (3)
 will be a version of this function which uses a 32-bit
 .IR off_t .
 .SH SEE ALSO
diff --git a/man/gd_hidden.3 b/man/gd_hidden.3
new file mode 100644
index 0000000..bc7336d
--- /dev/null
+++ b/man/gd_hidden.3
@@ -0,0 +1,77 @@
+.\" gd_hidden.3.  The gd_hidden man page.
+.\"
+.\" Copyright (C) 2012 D. V. Wiebe
+.\"
+.\""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
+.\"
+.\" This file is part of the GetData project.
+.\"
+.\" Permission is granted to copy, distribute and/or modify this document
+.\" under the terms of the GNU Free Documentation License, Version 1.2 or
+.\" any later version published by the Free Software Foundation; with no
+.\" Invariant Sections, with no Front-Cover Texts, and with no Back-Cover
+.\" Texts.  A copy of the license is included in the `COPYING.DOC' file
+.\" as part of this distribution.
+.\"
+.TH gd_hidden 3 "1 January 2012" "Version 0.8.0" "GETDATA"
+.SH NAME
+gd_hidden \(em retrieve the fragment containing a dirfile field
+.SH SYNOPSIS
+.B #include <getdata.h>
+.HP
+.nh
+.ad l
+.BI "int gd_hidden(const DIRFILE *" dirfile ", const char"
+.BI * entry_name );
+.hy
+.ad n
+.SH DESCRIPTION
+The
+.BR gd_hidden ()
+function queries a dirfile(5) database specified by
+.I dirfile
+and indicates whether the field or alias called
+.IR entry_name
+is hidden or not.
+
+A hidden entry does not appear in the field lists returned by the functions
+.BR gd_field_list (3),
+.BR gd_field_list_by_type (3),
+.BR gd_vectors (3),
+.BR gd_constants (3),
+and
+.BR gd_strings (3).
+These omissions are also reflected in the counts returned by the corresponding
+field counting functions
+.RB ( gd_nfields (3),
+&c.).
+.SH RETURN VALUE
+Upon successful completion,
+.BR gd_hidden ()
+returns one if the field or alias is hidden, or zero if the entry is not hidden.
+On error it returns -1 and sets the dirfile error a non-zero error value.  (As a
+result, the caller checking simply whether the return value of this function is
+non-zero is usually an error.)  Possible error values are:
+.TP 8
+.B GD_E_BAD_CODE
+The field specified by
+.I field_code
+was not found in the database.
+.TP
+.B GD_E_BAD_DIRFILE
+The supplied dirfile was invalid.
+.PP
+The dirfile error may be retrieved by calling
+.BR gd_error (3).
+A descriptive error string for the last error encountered can be obtained from
+a call to
+.BR gd_error_string (3).
+
+.SH SEE ALSO
+.BR gd_entry (3),
+.BR gd_field_list (3),
+.BR gd_hide (3),
+.BR gd_nfields (3),
+.BR gd_open (3),
+.BR gd_unhide (3),
+.BR dirfile (5)
diff --git a/man/gd_hide.3 b/man/gd_hide.3
new file mode 100644
index 0000000..d283c68
--- /dev/null
+++ b/man/gd_hide.3
@@ -0,0 +1,89 @@
+.\" gd_hide.3.  The gd_hidden man page.
+.\"
+.\" Copyright (C) 2012 D. V. Wiebe
+.\"
+.\""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
+.\"
+.\" This file is part of the GetData project.
+.\"
+.\" Permission is granted to copy, distribute and/or modify this document
+.\" under the terms of the GNU Free Documentation License, Version 1.2 or
+.\" any later version published by the Free Software Foundation; with no
+.\" Invariant Sections, with no Front-Cover Texts, and with no Back-Cover
+.\" Texts.  A copy of the license is included in the `COPYING.DOC' file
+.\" as part of this distribution.
+.\"
+.TH gd_hide 3 "1 January 2012" "Version 0.8.0" "GETDATA"
+.SH NAME
+gd_hide, gd_unhide \(em hide or unhide a dirfile database entry
+.SH SYNOPSIS
+.B #include <getdata.h>
+.HP
+.nh
+.ad l
+.BI "int gd_hide(const DIRFILE *" dirfile ", const char"
+.BI * entry_name );
+.HP
+.BI "int gd_unhide(const DIRFILE *" dirfile ", const char"
+.BI * entry_name );
+.hy
+.ad n
+.SH DESCRIPTION
+The
+.BR gd_hide ()
+function hides the field or alias called
+.IR entry_name
+in the dirfile(5) database specified by
+.I dirfile
+and indicates whether the field or alias called is hidden or not.  Similarly,
+the
+.BR gd_unhide ()
+function unhides the specified entry.
+
+A hidden entry does not appear in the field lists returned by the functions
+.BR gd_field_list (3),
+.BR gd_field_list_by_type (3),
+.BR gd_vectors (3),
+.BR gd_constants (3),
+and
+.BR gd_strings (3).
+These omissions are also reflected in the counts returned by the corresponding
+field counting functions
+.RB ( gd_nfields (3),
+&c.).  A hidden field is otherwise no different than an unhidden field.
+.SH RETURN VALUE
+Upon successful completion,
+.BR gd_hide ()
+and
+.BR gd_unhide ()
+return zero.  On error they returns -1 and sets the dirfile error a non-zero
+error value.  Possible error values are:
+.TP 8
+.B GD_E_ACCMODE
+The specified dirfile was opened read-only.
+.TP
+.B GD_E_BAD_CODE
+The field specified by
+.I field_code
+was not found in the database.
+.TP
+.B GD_E_BAD_DIRFILE
+The supplied dirfile was invalid.
+.TP
+.B GD_E_PROTECTED
+The metadata of the affected format specification fragments was protected from
+change.
+.PP
+The dirfile error may be retrieved by calling
+.BR gd_error (3).
+A descriptive error string for the last error encountered can be obtained from
+a call to
+.BR gd_error_string (3).
+
+.SH SEE ALSO
+.BR gd_entry (3),
+.BR gd_field_list (3),
+.BR gd_hidden (3),
+.BR gd_nfields (3),
+.BR gd_open (3),
+.BR dirfile (5)
diff --git a/man/gd_include_affix.3 b/man/gd_include_affix.3
new file mode 100644
index 0000000..c4d3633
--- /dev/null
+++ b/man/gd_include_affix.3
@@ -0,0 +1,354 @@
+.\" gd_include_affix.3.  The gd_include_affix man page.
+.\"
+.\" Copyright (C) 2008, 2009, 2010, 2011, 2012 D. V. Wiebe
+.\"
+.\""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
+.\"
+.\" This file is part of the GetData project.
+.\"
+.\" Permission is granted to copy, distribute and/or modify this document
+.\" under the terms of the GNU Free Documentation License, Version 1.2 or
+.\" any later version published by the Free Software Foundation; with no
+.\" Invariant Sections, with no Front-Cover Texts, and with no Back-Cover
+.\" Texts.  A copy of the license is included in the `COPYING.DOC' file
+.\" as part of this distribution.
+.\"
+.TH gd_include_affix 3 "21 April 2012" "Version 0.8.0" "GETDATA"
+.SH NAME
+gd_include_affix, gd_include \(em add a format specification fragment to a
+dirfile
+.SH SYNOPSIS
+.B #include <getdata.h>
+.HP
+.nh
+.ad l
+.BI "int gd_include_affix(DIRFILE *" dirfile ", const char *" include_file ,
+.BI "int " parent_fragment ", const char *" prefix ", const char *" suffix ,
+.BI "unsigned long " flags );
+.HP
+.BI "int gd_include(DIRFILE *" dirfile ", const char *" include_file ,
+.BI "int " parent_fragment ", unsigned long " flags );
+.hy
+.ad n
+.SH DESCRIPTION
+The
+.BR gd_include_affix ()
+function adds the format specification fragment given by the path
+.I include_file
+to the specified dirfile, possibly creating the fragment, using the affixes
+specified.  This occurs as if, in the existing fragment indexed
+by
+.IR parent_fragment ,
+the following directive were present:
+.IP
+.B /INCLUDE
+.I <include_file> <prefix> <suffix>
+.PP
+(see
+.BR dirfile-format (5)).
+If a parser callback function had been specified when the dirfile was opened
+using
+.BR gd_cbopen (3),
+or added later with
+.BR gd_parser_callback (3),
+this callback function will be called if a syntax error is encountered while
+parsing the included fragment.
+
+Passing NULL as
+.I prefix
+or
+.I suffix
+is the same as using the empty string (ie. the corresponding affix is empty).
+The function
+.BR gd_include ()
+is equivalent to calling
+.BR gd_include_affix ()
+with both
+.I prefix
+and
+.I suffix
+equal to NULL.
+
+The 
+.I flags
+argument should be a bitwise-or'd collection of zero or more of the following
+flags:
+.PP
+.PD 0
+.B GD_ARM_ENDIAN
+.TP
+.PD
+.B GD_NOT_ARM_ENDIAN
+Specifies that double precision floating point raw data on disk are, or are not,
+stored in the middle-endian format used by older ARM processors.
+
+These flag only set the default endianness, and will be overridden when an
+.B /ENDIAN
+directive specifies the byte sex of
+.B RAW
+fields, unless
+.B GD_FORCE_ENDIAN
+is also specified.
+
+On every platform, one of these flags
+.RB ( GD_NOT_ARM_ENDIAN
+on all but middle-ended ARM systems)
+indicates the native behaviour of the platform.  That symbol will equal zero,
+and may be omitted.
+.PP
+.PD 0
+.B GD_BIG_ENDIAN
+.TP
+.PD
+.B GD_LITTLE_ENDIAN
+Specifies the default byte sex of raw data stored on disk to be either
+big-endian (most significant byte first) or little-endian (least significant
+byte first).  Omitting both flags indicates the default should be the native
+endianness of the platform.
+
+Unlike the ARM endianness flags above, neither of these symbols is ever zero.
+Specifying both these flags together will cause the library to assume that the
+endianness of the data is opposite to that of the native architecture, whatever
+that might be.
+
+These flag only set the default endianness, and will be overridden when an
+.B /ENDIAN
+directive specifies the byte sex of
+.B RAW
+fields, unless
+.B GD_FORCE_ENDIAN
+is also specified.
+.TP
+.B GD_CREAT
+An empty fragment will be created, if one does not already exist.  The fragment
+will have mode
+.BR S_IRUSR " | " S_IWUSR " | "  S_IRGRP " | "  S_IWGRP " | " S_IROTH " | " S_IWOTH
+(0666), modified by the caller's umask value (see
+.BR umask (2)).
+.TP
+.B GD_EXCL
+Ensure that this call creates a new fragment: when specified along with
+.BR GD_CREAT ,
+the call will fail if the file specified by
+.I include_file
+already exists.  If
+.B GD_CREAT
+is not specified, this flag is ignord.  This flag suffers from all the
+limitations of the
+.B O_EXCL
+flag as indicated in
+.BR open (2).
+.TP
+.B GD_FORCE_ENCODING
+Specifies that
+.B /ENCODING
+directives (see
+.BR dirfile-format (5))
+found in the fragment should be ignored.  The encoding scheme
+specified in
+.I flags
+will be used instead (see below).
+.TP
+.B GD_FORCE_ENDIAN
+Specifies that
+.B /ENDIAN
+directives (see
+.BR dirfile-format (5))
+found in the fragment should be ignored.  When specified with one of
+.BR GD_BIG_ENDIAN " or " GD_LITTLE_ENDIAN ,
+the indicated endianness will be assumed.  If this flag is specified with
+neither of those flags, the fragment will be assumed to have the endianness of
+the native architecture.
+.TP
+.B GD_IGNORE_DUPS
+If the fragment specifies more than one field with the same name, or a field 
+with the same name as an existing field, all but one of them will be ignored by
+the parser.  Without this flag, parsing would fail with the
+.B GD_E_FORMAT 
+error, possibly resulting in invocation of the registered callback function.
+Which of the duplicate fields is kept is not specified, nor whether an existing
+field takes precedence over a new one or not.  As a result, this flag is
+typically only useful in the case where identical copies of a field
+specification line are present.
+
+No indication is provided to indicate whether a duplicate field has been
+discarded.  If finer grained control is required, the caller should handle
+.B GD_E_FORMAT_DUPLICATE
+suberrors itself with an appropriate callback function.
+.TP
+.B GD_IGNORE_REFS
+If the dirfile currently has a reference field (either because one was specified
+explicitly, or else because the first
+.B RAW
+field was used),
+.B /REFERENCE
+directives in the included fragment will be ignored.  Otherwise, a
+.B /REFERENCE
+directive in the included fragment will replace the current reference field in
+the dirfile.
+.TP
+.B GD_PEDANTIC
+Specifies that unrecognised lines found during the parsing of the fragment
+should always cause a fatal error.  Without this flag, if a
+.B VERSION
+directive (see
+.BR dirfile-format (5))
+indicates that the fragment being opened conforms Standards Version newer than
+the version understood by the library, unrecognised lines will be silently
+ignored.
+.TP
+.B GD_TRUNC
+If
+.I include_file
+already exists, it will be truncated before opening.  If the file does not
+exist, this flag is ignored.
+
+.PP
+The
+.I flags
+argument may also be bitwise or'd with one of the following symbols indicating
+the default encoding scheme of the fragment.  Like the endianness flags, the
+choice of encoding here is ignored if the encoding is specified in the fragment
+itself, unless
+.B GD_FORCE_ENCODED
+is also specified.  If none of these symbols is present,
+.B GD_AUTO_ENCODED
+is assumed, unless this call results in creation or truncation of the fragment. 
+In that case,
+.B GD_UNENCODED
+is assumed.  See
+.BR dirfile-encoding (5)
+for details on dirfile encoding schemes.
+.TP
+.B GD_AUTO_ENCODED
+Specifies that the encoding type is not known in advance, but should be detected
+by the GetData library.  Detection is accomplished by searching for raw data
+files with extensions appropriate to the encoding scheme.  This method will
+notably fail if the the library is called via
+.BR gd_putdata (3)
+to create a previously non-existent raw field unless a read is first
+successfully performed on the dirfile.  Once the library has determined the
+encoding scheme for the first time, it remembers it for subsequent calls.
+.TP
+.B GD_BZIP2_ENCODED
+Specifies that raw data files are compressed using the Burrows-Wheeler block
+sorting text compression algorithm and Huffman coding, as implemented in the
+bzip2 format.
+.TP
+.B GD_GZIP_ENCODED
+Specifies that raw data files are compressed using Lempel-Ziv coding (LZ77)
+as implemented in the gzip format.
+.TP
+.B GD_LZMA_ENCODED
+Specifies that raw data files are compressed using the Lempel-Ziv Markov Chain
+Algorithm (LZMA) as implemented in the xz container format.
+.TP
+.B GD_SIE_ENCODED
+Specified that raw data files are sample-index encoded, similar to run-length
+encoding, suitable for data that change rarely.
+.TP
+.B GD_SLIM_ENCODED
+Specifies that raw data files are compressed using the slimlib library.
+.TP
+.B GD_TEXT_ENCODED
+Specifies that raw data files are encoded as text files containing one data
+sample per line.  
+.TP
+.B GD_UNENCODED
+Specifies that raw data files are not encoded, but written verbatim to disk.
+.TP
+.B GD_ZZIP_ENCODED
+Specifies that raw data files are compressed using the DEFLATE algorithm.  All
+raw data files for a given fragment are collected together and stored in a PKZIP
+archive called raw.zip.
+.TP
+.B GD_ZZSLIM_ENCODED
+Specifies that raw data files are compressed using a combinations of compression
+schemes: first files are slim-compressed, as with the
+.B GD_SLIM_ENCODED
+scheme, and then they are collected together and compressed (again) into a PKZIP
+archive called raw.zip, as in the
+.B GD_ZZIP_ENCODED
+scheme.
+
+.SH RETURN VALUE
+On success, these functions return the format specification index of the newly
+added fragment.  On error, -1 is returned and the dirfile error is set to a
+non-zero error value.  Possible error values are:
+.TP 8
+.B GD_E_ACCMODE
+The supplied dirfile was opened in read-only mode.
+.TP
+.B GD_E_ALLOC
+The library was unable to allocate memory.
+.TP
+.B GD_E_BAD_DIRFILE
+The supplied dirfile was invalid.
+.TP
+.B GD_E_BAD_INDEX
+The supplied parent fragment index was out of range.
+.TP
+.B GD_E_BAD_REFERENCE
+The reference field specified by a
+.B /REFERENCE
+directive in the fragment (see
+.BR dirfile-format (5))
+was not found, or was not a
+.B RAW
+field.  In this case, the included fragment will still be added to the dirfile,
+but the
+.B /REFERENCE
+directive will be ignored.  See also the
+.B BUGS
+section below.
+.TP
+.B GD_E_CALLBACK
+The registered callback function returned an unrecognised response.
+.TP
+.B GD_E_FORMAT
+A syntax error occurred in the fragment.
+.TP
+.B GD_E_LINE_TOO_LONG
+The parser encountered a line in the format specification longer than it was
+able to deal with.  Lines are limited by the storage size of
+.BR ssize_t .
+On 32-bit systems, this limits format specification lines to 2**31 characters.
+The limit is larger on 64-bit systems.
+.TP
+.B GD_E_OPEN_FRAGMENT
+The fragment could not be opened or created.
+.TP
+.B GD_E_PROTECTED
+The metadata of the parent fragment was protected from change.
+.PP
+The dirfile error may be retrieved by calling
+.BR gd_error (3).
+A descriptive error string for the last error encountered can be obtained from
+a call to
+.BR gd_error_string (3).
+
+.SH BUGS
+If this function fails with the error
+.BR GD_E_BAD_REFERENCE ,
+it typically results in no reference field being defined for the dirfile, even
+if the dirfile contains
+.B RAW
+fields.  As a result, functions which rely on the reference field, such as
+.BR gd_nframes (3),
+will operate incorrectly.  Callers should explicitly set the reference field
+with
+.BR gd_reference (3)
+in this case.
+.SH SEE ALSO
+.BR gd_open (3),
+.BR gd_alter_affixes (3),
+.BR gd_error (3),
+.BR gd_error_string (3),
+.BR gd_fragmentname (3),
+.BR gd_nfragments (3),
+.BR gd_parser_callback (3),
+.BR gd_reference (3),
+.BR gd_uninclude (3),
+.BR dirfile (5),
+.BR dirfile-encoding (5),
+.BR dirfile-format (5)
diff --git a/man/gd_invalid_dirfile.3 b/man/gd_invalid_dirfile.3
index 14d6788..34814d1 100644
--- a/man/gd_invalid_dirfile.3
+++ b/man/gd_invalid_dirfile.3
@@ -13,7 +13,7 @@
 .\" Texts.  A copy of the license is included in the `COPYING.DOC' file
 .\" as part of this distribution.
 .\"
-.TH gd_invalid_dirfile 3 "20 October 2010" "Version 0.7.0" "GETDATA"
+.TH gd_invalid_dirfile 3 "17 August 2011" "Version 0.8.0" "GETDATA"
 .SH NAME
 gd_invalid_dirfile \(em obtain an pointer to an invalid DIRFILE object
 .SH SYNOPSIS
@@ -63,7 +63,8 @@ is zero (indicating success).
 
 .SH RETURN VALUE
 This function always returns a pointer to a newly allocated, invalid DIRFILE
-object.
+object, except when it is unable to allocate memory for the DIRFILE, in which
+case it returns NULL.
 
 .SH SEE ALSO
 .BR gd_close (3),
diff --git a/man/gd_linterp_tablename.3 b/man/gd_linterp_tablename.3
new file mode 100644
index 0000000..51ab1e0
--- /dev/null
+++ b/man/gd_linterp_tablename.3
@@ -0,0 +1,91 @@
+.\" gd_linterp_tablename.3.  The gd_linterp_tablename man page.
+.\"
+.\" Copyright (C) 2012 D. V. Wiebe
+.\"
+.\""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
+.\"
+.\" This file is part of the GetData project.
+.\"
+.\" Permission is granted to copy, distribute and/or modify this document
+.\" under the terms of the GNU Free Documentation License, Version 1.2 or
+.\" any later version published by the Free Software Foundation; with no
+.\" Invariant Sections, with no Front-Cover Texts, and with no Back-Cover
+.\" Texts.  A copy of the license is included in the `COPYING.DOC' file
+.\" as part of this distribution.
+.\"
+.TH gd_linterp_tablename 3 "1 August 2012" "Version 0.8.1" "GETDATA"
+.SH NAME
+gd_linterp_tablename \(em retrieve the pathname of a look-up table in a dirfile
+.SH SYNOPSIS
+.B #include <getdata.h>
+.HP
+.nh
+.ad l
+.BI "const char *gd_linterp_tablename(DIRFILE *" dirfile ", const char"
+.BI * field_code );
+.hy
+.ad n
+.SH DESCRIPTION
+The
+.BR gd_linterp_tablename ()
+function retrieves the pathname of the look-up table (LUT) used by the
+.B LINTERP
+field specified by
+.I field_code
+in the dirfile specified by
+.IR dirfile .
+If
+.I field_code
+contains a valid representation suffix, it will be ignored.
+
+Note: this function returns a fully canonicalised, absolute path.  The value of
+the
+.I table
+member in a
+.B gd_entry_t
+object (see
+.BR gd_entry (3))
+is the path which appears in the format specification on disk, which may be a
+path relative to the fragment directory.
+
+.SH RETURN VALUE
+On success,
+.BR gd_linterp_tablename ()
+returns the full pathname of the LUT associated with the specified field.  On
+error, NULL is returned and the dirfile error is set to a non-zero error value.
+Possible error values are:
+.TP 8
+.B GD_E_ALLOC
+The library was unable to allocate memory.
+.TP
+.B GD_E_BAD_CODE
+The field specified by
+.I field_code
+was not found.
+.TP
+.B GD_E_BAD_DIRFILE
+The supplied dirfile was invalid.
+.TP
+.B GD_E_BAD_FIELD_TYPE
+The field specified by
+.I field_code
+was not a
+.B LINTERP
+field.
+.TP
+.B GD_E_BAD_REPR
+The representation suffix specified in
+.I field_code
+was not recognised.
+.PP
+The dirfile error may be retrieved by calling
+.BR gd_error (3).
+A descriptive error string for the last error encountered can be obtained from
+a call to
+.BR gd_error_string (3).
+.SH SEE ALSO
+.BR gd_entry (3),
+.BR gd_error (3),
+.BR gd_error_string (3),
+.BR dirfile (5),
+.BR dirfile-format (5)
diff --git a/man/gd_madd_bit.3 b/man/gd_madd_bit.3
index 4b3d060..74ec7be 100644
--- a/man/gd_madd_bit.3
+++ b/man/gd_madd_bit.3
@@ -1,6 +1,6 @@
 .\" gd_madd_bit.3.  The gd_madd_bit man page.
 .\"
-.\" Copyright (C) 2008, 2009, 2010 D. V. Wiebe
+.\" Copyright (C) 2008, 2009, 2010, 2012 D. V. Wiebe
 .\"
 .\""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
 .\"
@@ -13,7 +13,7 @@
 .\" Texts.  A copy of the license is included in the `COPYING.DOC' file
 .\" as part of this distribution.
 .\"
-.TH gd_madd_bit 3 "3 November 2010" "Version 0.7.0" "GETDATA"
+.TH gd_madd_bit 3 "1 April 2012" "Version 0.8.0" "GETDATA"
 .SH NAME
 gd_madd_bit, gd_madd_carray, gd_madd_clincom, gd_madd_const, gd_madd_cpolynom,
 gd_madd_crecip, gd_madd_divide, gd_madd_lincom, gd_madd_linterp,
@@ -27,7 +27,7 @@ gd_madd_string
 .ad l
 .BI "int gd_madd_bit(DIRFILE *" dirfile ,
 .BI "const char *" parent ", const char *" field_name ,
-.BI "const char *" in_field ", gd_bit_t " bitnum ", gd_bit_t " numbits );
+.BI "const char *" in_field ", int " bitnum ", int " numbits );
 .HP
 .BI "int gd_madd_carray(DIRFILE *" dirfile ,
 .BI "const char *" parent ", const char *" field_name ,
@@ -62,6 +62,11 @@ gd_madd_string
 .BI "const char *" parent ", const char *" field_name ,
 .BI "const char *" in_field ", const char *" table );
 .HP
+.BI "int gd_madd_mplex(DIRFILE *" dirfile ,
+.BI "const char *" parent ", const char *" field_name ,
+.BI "const char *" in_field ", const char *" count_field ,
+.BI "int " count_val ", int " period );
+.HP
 .BI "int gd_madd_multiply(DIRFILE *" dirfile ,
 .BI "const char *" parent ", const char *" field_name ,
 .BI " const char *" in_field1 ", const char *" in_field2 );
@@ -80,16 +85,19 @@ gd_madd_string
 .HP
 .BI "int gd_madd_sbit(DIRFILE *" dirfile ,
 .BI "const char *" parent ", const char *" field_name ,
-.BI "const char *" in_field ", gd_bit_t " bitnum ", gd_bit_t " numbits );
+.BI "const char *" in_field ", int " bitnum ", int " numbits );
 .HP
 .BI "int gd_madd_string(DIRFILE *" dirfile ", const char *" parent ,
 .BI "const char *" field_name ", const char *" value );
+.HP
+.BI "int gd_madd_window(DIRFILE *" dirfile ,
+.BI "const char *" parent ", const char *" field_name ,
+.BI "const char *" in_field ", const char *" check_field ", gd_windop_t"
+.IB windop ", gd_triplet_t " threshold );
 .hy
 .ad n
 .SH DESCRIPTION
-These functions provide alternatives to using the
-.BR gd_madd ()
-function to add a new metafield of the indicated type under the parent field
+These functions add a new metafield of the indicated type under the parent field
 given by
 .I parent
 in the dirfile specified by
@@ -156,24 +164,47 @@ specifies the data type of the value pointed to by
 .IR value .
 
 The
-.B gd_bit_t
-type is a signed 16-bit integer type.  The
 .B gd_shift_t
-type is a signed 64-bit integer type.
-
+type is a signed 64-bit integer type.  The
+.B gd_triplet_t
+type is defined as:
+.PP
+.in +4n
+.nf
+.fam C
+typedef union {
+  gd_int64_t i;
+  gd_uint64_t u;
+  double r;
+} gd_triplet_t;
+.fam
+.fi
+.in
+.PP
+Which element of this
+.B gd_triplet_t
+union to set depends on the operator selected for the
+.B WINDOW
+field.  See
+.BR gd_entry (3)
+for details.
+.PP
 All fields added with this interface must contain numerical parameters.  Fields
 with scalar fields as parameters cannot be added with these functions.  Those
 fields must be added with
 .BR gd_madd (3)
 or
 .BR gd_madd_spec (3).
+See
+.BR gd_add_bit (3),
+&c. for an alternate way of adding metafields with explicit parameters.
 
 See
 .B NOTES
 below for information on using
-.BR gd_madd_clincom ()
+.BR gd_madd_clincom "(), " gd_madd_cpolynom (),
 and 
-.BR gd_madd_cpolynom ()
+.BR gd_madd_crecip ()
 in the C89 GetData API.
 
 .SH RETURN VALUE
@@ -228,7 +259,6 @@ The C89 GetData API provides different prototypes for
 and
 .BR gd_madd_crecip ():
 .PP
-.nf
 .B #define GD_C89_API
 .B #include <getdata.h>
 .HP
@@ -244,10 +274,9 @@ and
 .HP
 .BI "int gd_madd_crecip(DIRFILE *" dirfile ", const char *" parent ,
 .BI "const char *" field_name ", const char *" in_field ,
-.BI "double " cdividend "[2], int " fragment_index );
+.BI "double " cdividend\fR[2] ", int " fragment_index );
 .hy
 .ad n
-.fi
 .PP
 In this case, the array pointers passed as
 .IR cm ", " cb
@@ -269,15 +298,21 @@ parameter becomes a double precision array of length two.
 .SH SEE ALSO
 .BR gd_add_bit (3),
 .BR gd_add_const (3),
+.BR gd_add_divide (3),
 .BR gd_add_lincom (3),
 .BR gd_add_linterp (3),
+.BR gd_add_mplex (3),
 .BR gd_add_multiply (3),
 .BR gd_add_phase (3),
+.BR gd_add_polynom (3),
+.BR gd_add_recip (3),
 .BR gd_add_string (3),
+.BR gd_add_windop (3),
+.BR gd_entry (3),
+.BR gd_error (3),
+.BR gd_error_string (3),
 .BR gd_madd (3),
 .BR gd_madd_spec (3),
 .BR gd_metaflush (3),
 .BR gd_open (3),
-.BR gd_error (3),
-.BR gd_error_string (3),
 .BR dirfile-format (5)
diff --git a/man/gd_mcarrays.3 b/man/gd_mcarrays.3
index 03c7013..edced73 100644
--- a/man/gd_mcarrays.3
+++ b/man/gd_mcarrays.3
@@ -1,6 +1,6 @@
 .\" gd_constants.3.  The gd_constants man page.
 .\"
-.\" Copyright (C) 2010 D. V. Wiebe
+.\" Copyright (C) 2010, 2011 D. V. Wiebe
 .\"
 .\""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
 .\"
@@ -13,7 +13,7 @@
 .\" Texts.  A copy of the license is included in the `COPYING.DOC' file
 .\" as part of this distribution.
 .\"
-.TH gd_mcarrays 3 "3 November 2010" "Version 0.7.0" "GETDATA"
+.TH gd_mcarrays 3 "19 August 2011" "Version 0.7.0" "GETDATA"
 .SH NAME
 gd_constants \(em retrieve a list of CARRAY values from a dirfile
 .SH SYNOPSIS
@@ -125,6 +125,11 @@ The supplied dirfile was invalid.
 The
 .I return_type
 specified was invalid.
+.TP
+.B GD_E_INTERNAL_ERROR
+An internal error occurred in the library while trying to perform the task.
+This indicates a bug in the library.  Please report the incident to the
+GetData developers.
 .PP
 The dirfile error may be retrieved by calling
 .BR gd_error (3).
diff --git a/man/gd_mconstants.3 b/man/gd_mconstants.3
index 0d12fa7..589d174 100644
--- a/man/gd_mconstants.3
+++ b/man/gd_mconstants.3
@@ -1,6 +1,6 @@
 .\" gd_mconstants.3.  The gd_mconstants man page.
 .\"
-.\" Copyright (C) 2008, 2010 D. V. Wiebe
+.\" Copyright (C) 2008, 2010, 2011 D. V. Wiebe
 .\"
 .\""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
 .\"
@@ -13,7 +13,7 @@
 .\" Texts.  A copy of the license is included in the `COPYING.DOC' file
 .\" as part of this distribution.
 .\"
-.TH gd_mconstants 3 "3 November 2010" "Version 0.7.0" "GETDATA"
+.TH gd_mconstants 3 "17 August 2011" "Version 0.8.0" "GETDATA"
 .SH NAME
 gd_mconstants \(em retrieve a list of constant values from a dirfile
 .SH SYNOPSIS
@@ -86,6 +86,11 @@ The supplied dirfile was invalid.
 The
 .I return_type
 specified was invalid.
+.TP
+.B GD_E_INTERNAL_ERROR
+An internal error occurred in the library while trying to perform the task.
+This indicates a bug in the library.  Please report the incident to the
+GetData developers.
 .PP
 The dirfile error may be retrieved by calling
 .BR gd_error (3).
diff --git a/man/gd_metaflush.3 b/man/gd_metaflush.3
index 440437f..d9cd628 100644
--- a/man/gd_metaflush.3
+++ b/man/gd_metaflush.3
@@ -1,6 +1,6 @@
 .\" gd_metaflush.3.  The gd_metaflush man page.
 .\"
-.\" Copyright (C) 2008, 2010 D. V. Wiebe
+.\" Copyright (C) 2008, 2010, 2011, 2012 D. V. Wiebe
 .\"
 .\""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
 .\"
@@ -13,7 +13,7 @@
 .\" Texts.  A copy of the license is included in the `COPYING.DOC' file
 .\" as part of this distribution.
 .\"
-.TH gd_metaflush 3 "24 July 2010" "Version 0.7.0" "GETDATA"
+.TH gd_metaflush 3 "15 March 2012" "Version 0.8.0" "GETDATA"
 .SH NAME
 gd_metaflush \(em write modified dirfile metadata to disk
 .SH SYNOPSIS
@@ -30,7 +30,7 @@ The
 function flushes all pending metadata changes in the dirfile specified by
 .I dirfile 
 to disk.  This is accomplished by re-writing the format specification fragments
-containing modified metadata overwriting the existing files.  Format file
+containing modified metadata, overwriting the existing files.  Format file
 fragments which are unchanged are not touched.
 .PP
 Metadata is written to disk using the current Standards Version as stored in the
@@ -42,7 +42,7 @@ conforms to no known Standards Version, a Standards non-compliant fragment will
 be written.
 .PP
 This function flushes only metadata.  To flush the field data as well, call
-.BR gd_flush (3)
+.BR gd_sync (3)
 instead.
 .SH RETURN VALUE
 On success, zero is returned.  On error, -1 is returned and the dirfile error is
@@ -51,17 +51,15 @@ set to a non-zero error value.  Possible error values are:
 .B GD_E_ACCMODE
 The supplied dirfile was opened in read-only mode.
 .TP
+.B GD_E_ALLOC
+The library was unable to allocate memory.
+.TP
 .B GD_E_BAD_DIRFILE
 The supplied dirfile was invalid.
 .TP
 .B GD_E_FLUSH
 A temporary file could not be opened into which to write the modified metadata,
 or renaming the temporary file over the original fragment failed.
-.TP
-.B GD_E_INTERNAL_ERROR
-An internal error occurred in the library while trying to perform the task.
-This indicates a bug in the library.  Please report the incident to the
-maintainer.
 .PP
 The dirfile error may be retrieved by calling
 .BR gd_error (3).
@@ -79,5 +77,5 @@ directive.  A work-around is to upgrade to Standards Version 5 or later.
 .BR gd_dirfile_standards (3),
 .BR gd_error (3),
 .BR gd_error_string (3),
-.BR gd_flush (3),
-.BR gd_rewrite_fragment (3)
+.BR gd_rewrite_fragment (3),
+.BR gd_sync (3)
diff --git a/man/gd_move.3 b/man/gd_move.3
index c0ebdd0..c6c68e3 100644
--- a/man/gd_move.3
+++ b/man/gd_move.3
@@ -1,6 +1,6 @@
 .\" gd_move.3.  The gd_move man page.
 .\"
-.\" Copyright (C) 2008, 2009, 2010 D. V. Wiebe
+.\" Copyright (C) 2008, 2009, 2010, 2012 D. V. Wiebe
 .\"
 .\""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
 .\"
@@ -13,9 +13,9 @@
 .\" Texts.  A copy of the license is included in the `COPYING.DOC' file
 .\" as part of this distribution.
 .\"
-.TH gd_move 3 "21 July 2010" "Version 0.7.0" "GETDATA"
+.TH gd_move 3 "1 January 2012" "Version 0.8.0" "GETDATA"
 .SH NAME
-gd_move \(em move a dirfile field between format specification fragments
+gd_move, gd_move_alias \(em move a dirfile entry between format specification fragments
 .SH SYNOPSIS
 .B #include <getdata.h>
 .HP
@@ -23,6 +23,9 @@ gd_move \(em move a dirfile field between format specification fragments
 .ad l
 .BI "int gd_move(DIRFILE *" dirfile ", const char"
 .BI * field_code ", int " new_fragment ", int " move_data );
+.HP
+.BI "int gd_move_alias(DIRFILE *" dirfile ", const char"
+.BI * alias_name ", int " new_fragment );
 .hy
 .ad n
 .SH DESCRIPTION
@@ -33,15 +36,28 @@ function transfers the field specified by
 which should not have a representation suffix, defined in the dirfile
 specified by
 .IR dirfile
-from it's current format specification fragment to the fragment index by
+from it's current format specification fragment to the fragment indexed by
 .IR new_fragment .
 If the field is already defined in the fragment index by
 .IR new_fragment ,
 this function does nothing.
 
+The
+.BR gd_move_alias ()
+function behaves similarly, but moves the alias named
+.I alias_name
+to the new fragment.  (Passing
+.I alias_name
+to
+.BR gd_move ()
+as
+.I field_code
+will result in the field ultimately pointed to be the alias being moved, and
+not the alias itself.)
+
 If the flag
 .I move_data
-is non-zero, and
+is one, and
 .I field_code
 specifies a
 .B RAW
diff --git a/man/gd_mplex_lookback.3 b/man/gd_mplex_lookback.3
new file mode 100644
index 0000000..bc1be23
--- /dev/null
+++ b/man/gd_mplex_lookback.3
@@ -0,0 +1,124 @@
+.\" gd_mplex_lookback.3.  The gd_mplex_lookback man page.
+.\"
+.\" Copyright (C) 2012, 2013 D. V. Wiebe
+.\"
+.\""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
+.\"
+.\" This file is part of the GetData project.
+.\"
+.\" Permission is granted to copy, distribute and/or modify this document
+.\" under the terms of the GNU Free Documentation License, Version 1.2 or
+.\" any later version published by the Free Software Foundation; with no
+.\" Invariant Sections, with no Front-Cover Texts, and with no Back-Cover
+.\" Texts.  A copy of the license is included in the `COPYING.DOC' file
+.\" as part of this distribution.
+.\"
+.TH gd_mplex_lookback 3 "3 April 2013" "Version 0.8.4" "GETDATA"
+.SH NAME
+gd_mplex_lookback \(em set the GetData lookback length for MPLEX fields.
+.SH SYNOPSIS
+.B #include <getdata.h>
+.HP
+.nh
+.ad l
+.BI "void gd_mplex_lookback(DIRFILE *" dirfile ", int " lookback );
+.hy
+.ad n
+.SH DESCRIPTION
+The
+.BR gd_mplex_lookback ()
+function controls how far GetData searches backwards for the initial value of
+a field when reading a
+.B MPLEX
+field from the dirfile(5) database specified by
+.IR dirfile .
+
+If the first sample returned of a
+.B MPLEX
+field does not contain the value of the field, because the index field does not
+take on the specified multiplex index value, GetData must search the field
+backwards to find the last time the field was updated, in order to propagate
+that value into the initial portion of the returned data.  (See
+.BR gd_getdata (3)
+for further discussion on the data returned for a
+.B MPLEX
+field).
+
+This function sets the amount of data GetData searches before giving up
+according to the value of
+.IR lookback .
+If
+.I lookback
+is zero, this search is disabled completely, and the start of the returned data
+will be padded (with zero or IEEE-754-conformant not-a-number) unless the first
+sample returned happens to contain the value of the field.  If
+.I lookback
+is the special symbol
+.BR GD_LOOKBACK_ALL ,
+GetData will exhaustively search all available data before the returned portion
+for an initial value.
+
+Otherwise,
+.I lookback
+should be a positive number specifying the number of
+.B MPLEX
+periods to search.  Each
+.B MPLEX
+field has its own period, measured in samples of the index field, which is
+defined as follows:
+.IP \(bu
+if the
+.B MPLEX
+field in question specifies an optional
+.I period
+positive parameter (see the
+.B MPLEX
+definition in
+.BR dirfile-format (5)),
+its period is that many samples;
+.IP \(bu
+otherwise, if the
+.B MPLEX
+field's
+.I count_val
+is at least five, its period is one more sample than twice that value;
+.IP \(bu
+otherwise, the period is ten samples.
+.PP
+So, given the following
+.B MPLEX
+definitions:
+.IP
+field1 \fBMPLEX\fR data_field index_field 7 12
+.br
+field2 \fBMPLEX\fR data_field index_field 2 6
+.br
+field3 \fBMPLEX\fR data_field index_field 7
+.br
+field4 \fBMPLEX\fR data_field index_field 2
+.PP
+.I field1
+has a period of 12 samples and
+.I field2
+a period of 6 samples (both the value of their
+.I period
+parameters);
+.I field3
+has a period of 15 samples (one more than twice it's
+.IR count_val ),
+and
+.I field4
+has a period of 10 samples (the default value, since its
+.I count_val
+is less than five).
+.PP
+The initial value of the
+.B MPLEX
+lookback is ten periods.  This value is provided in getdata.h as
+.BR GD_DEFAULT_LOOKBACK .
+
+This function always succeeds and returns no value.
+.SH SEE ALSO
+.BR dirfile (5),
+.BR dirfile-format (5),
+.BR gd_getdata (3).
diff --git a/man/gd_mstrings.3 b/man/gd_mstrings.3
index 407ca1f..db862c8 100644
--- a/man/gd_mstrings.3
+++ b/man/gd_mstrings.3
@@ -1,6 +1,6 @@
 .\" gd_mstrings.3.  The gd_mstrings man page.
 .\"
-.\" Copyright (C) 2008, 2010 D. V. Wiebe
+.\" Copyright (C) 2008, 2010, 2011 D. V. Wiebe
 .\"
 .\""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
 .\"
@@ -13,7 +13,7 @@
 .\" Texts.  A copy of the license is included in the `COPYING.DOC' file
 .\" as part of this distribution.
 .\"
-.TH gd_mstrings 3 "15 October 2010" "Version 0.7.0" "GETDATA"
+.TH gd_mstrings 3 "19 October 2011" "Version 0.8.0" "GETDATA"
 .SH NAME
 gd_mstrings \(em retrieve a list of string values from a dirfile
 .SH SYNOPSIS
@@ -68,8 +68,11 @@ Upon successful completion,
 .BR gd_mstrings ()
 returns a pointer to an array of strings containing the values of all the
 .B STRING
-metafields for the specified parent field.  On error it returns NULL and sets
-the dirfile error to a non-zero error value.  Possible error values are:
+metafields for the specified parent field.  The array is terminated by a NULL
+pointer.  If no strings are defined in the database for the specified parent, an
+array consisting of only the NULL pointer is returned.  On error it returns NULL
+and sets the dirfile error to a non-zero error value.  Possible error values
+are:
 .TP 8
 .B GD_E_ALLOC
 The library was unable to allocate memory.
diff --git a/man/gd_naliases.3 b/man/gd_naliases.3
new file mode 100644
index 0000000..ec01e8d
--- /dev/null
+++ b/man/gd_naliases.3
@@ -0,0 +1,62 @@
+.\" gd_naliases.3.  The gd_naliases man page.
+.\"
+.\" Copyright (C) 2012 D. V. Wiebe
+.\"
+.\""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
+.\"
+.\" This file is part of the GetData project.
+.\"
+.\" Permission is granted to copy, distribute and/or modify this document
+.\" under the terms of the GNU Free Documentation License, Version 1.2 or
+.\" any later version published by the Free Software Foundation; with no
+.\" Invariant Sections, with no Front-Cover Texts, and with no Back-Cover
+.\" Texts.  A copy of the license is included in the `COPYING.DOC' file
+.\" as part of this distribution.
+.\"
+.TH gd_naliases 3 "1 January 2012" "Version 0.8.0" "GETDATA"
+.SH NAME
+gd_naliases \(em report the number of aliases of a field in a dirfile
+.SH SYNOPSIS
+.B #include <getdata.h>
+.HP
+.nh
+.ad l
+.BI "unsigned int gd_naliases(DIRFILE *" dirfile ", const char *" field_code );
+.hy
+.ad n
+.SH DESCRIPTION
+The
+.BR gd_naliases ()
+function queries a dirfile(5) database specified by
+.I dirfile
+and returns the number of aliases of the field specified by
+.IR field_code .
+
+The
+.I dirfile
+argument must point to a valid DIRFILE object previously created by a call to
+.BR gd_open (3).
+
+.SH RETURN VALUE
+Upon successful completion,
+.BR gd_naliases ()
+returns the number of vector fields in the dirfile.  If successful, this count
+will be at least one.  On error, it returns zero and sets the dirfile error
+to a non-zero error value.  Possible error values are:
+.TP 8
+.B GD_E_BAD_CODE
+The supplied field code was not found in the database.
+.TP
+.B GD_E_BAD_DIRFILE
+The supplied dirfile was invalid.
+.PP
+The dirfile error may be retrieved by calling
+.BR gd_error (3).
+A descriptive error string for the last error encountered can be obtained from
+a call to
+.BR gd_error_string (3).
+.SH SEE ALSO
+.BR dirfile (5),
+.BR gd_open (3),
+.BR gd_aliases (3),
+.BR gd_alias_target (3)
diff --git a/man/gd_native_type.3 b/man/gd_native_type.3
index a641e85..0bb7bb6 100644
--- a/man/gd_native_type.3
+++ b/man/gd_native_type.3
@@ -1,6 +1,6 @@
 .\" gd_native_type.3.  The gd_native_type man page.
 .\"
-.\" Copyright (C) 2009, 2010 D. V. Wiebe
+.\" Copyright (C) 2009, 2010, 2011, 2012 D. V. Wiebe
 .\"
 .\""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
 .\"
@@ -13,7 +13,7 @@
 .\" Texts.  A copy of the license is included in the `COPYING.DOC' file
 .\" as part of this distribution.
 .\"
-.TH gd_native_type 3 "3 November 2010" "Version 0.7.0" "GETDATA"
+.TH gd_native_type 3 "17 August 2012" "Version 0.8.0" "GETDATA"
 .SH NAME
 gd_native_type \(em returns the native data type of a field in a dirfile
 .SH SYNOPSIS
@@ -40,48 +40,51 @@ argument must point to a valid DIRFILE object previously created by a call to
 
 The native data type of a field of a given entry type is calculated as:
 .TP
-.BR BIT \~or\~ INDEX \~Entry:
+.BR BIT " or " INDEX " Entry:"
 .BR GD_UINT64 ;
 .TP
-.BR CONST \~or\~ CARRAY \~Entry:
+.BR CONST " or " CARRAY " Entry:"
 the data type of the field;
 .TP
-.BR LINCOM \~or\~ POLYNOM \~Entry:
+.BR LINCOM " or " POLYNOM " Entry:"
 if any of the scalar parameters is complex valued, or if the native data type of
 any of the input fields is complex valued:
 .BR GD_COMPLEX128 ,
 otherwise:
 .BR GD_FLOAT64 ;
 .TP
-.BR LINTERP \~Entry:
+.BR LINTERP " Entry:"
 if the look-up table is complex valued:
 .BR GD_COMPLEX128 ,
 otherwise:
 .BR GD_FLOAT64 ;
 .TP
-.BR MULTIPLY \~or\~ DIVIDE \~Entry:
+.BR MPLEX " or " WINDOW " Entry:"
+the native data type of the data field;
+.TP
+.BR MULTIPLY " or " DIVIDE " Entry:"
 if either input field is complex valued:
 .BR GD_COMPLEX128 ,
 otherwise:
 .BR GD_FLOAT64 ;
 .BR 
 .TP
-.BR PHASE \~Entry:
+.BR PHASE " Entry:"
 the native data type of the input field;
 .TP
-.BR RAW \~Entry:
+.BR RAW " Entry:"
 the data type of the raw data on disk;
 .TP
-.BR RECIP \~Entry:
+.BR RECIP " Entry:"
 if the dividend or the native data type of the input field is complex valued:
 .BR GD_COMPLEX128 ,
 otherwise:
 .BR GD_FLOAT64 ;
 .TP
-.BR SBIT \~Entry:
+.BR SBIT " Entry:"
 .BR GD_INT64 ;
 .TP
-.BR STRING \~Entry:
+.BR STRING " Entry:"
 .BR GD_NULL .
 .PP
 Furthermore, if the supplied
@@ -98,8 +101,9 @@ the symbols:
 .IP
 .nh
 .ad l
-.BR GD_NULL ,\~ GD_UINT8 ,\~ GD_INT8 ,\~ GD_UINT16 ,\~ GD_INT16 ,\~ GD_UINT32 ,
-.BR GD_INT32 ,\~ GD_FLOAT32 ,\~ GD_FLOAT64 ,\~ GD_COMPLEX64 ,\~ GD_COMPLEX128 .
+.BR GD_NULL ", " GD_UINT8 ", " GD_INT8 ", " GD_UINT16 ", " GD_INT16 ,
+.BR GD_UINT32 ", " GD_INT32 ", " GD_FLOAT32 ", " GD_FLOAT64 ", " GD_COMPLEX64 ,
+.BR GD_COMPLEX128 .
 .ad n
 .hy
 .PP
@@ -110,6 +114,9 @@ manual page.  On error, it returns
 and sets the dirfile error to a non-zero error value.  Possible error values
 are:
 .TP 8
+.B GD_E_ALLOC
+The library was unable to allocate memory.
+.TP
 .B GD_E_BAD_CODE
 The field specified by
 .I field_code
@@ -123,14 +130,6 @@ The representation suffix specified in
 .IR field_code ,
 or in one of its input fields, was not recognised.
 .TP
-.B GD_E_BAD_SCALAR
-A non-literal scalar used in the definition of the field or one of its inputs
-was not found, or was not a
-.B CONST
-or
-.B CARRAY
-field.
-.TP
 .B GD_E_DIMENSION
 A scalar field was found where a vector field was expected.
 .TP
diff --git a/man/gd_nentries.3 b/man/gd_nentries.3
new file mode 100644
index 0000000..5dd3b71
--- /dev/null
+++ b/man/gd_nentries.3
@@ -0,0 +1,194 @@
+.\" gd_nentries.3.  The gd_nentries man page.
+.\"
+.\" Copyright (C) 2012 D. V. Wiebe
+.\"
+.\""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
+.\"
+.\" This file is part of the GetData project.
+.\"
+.\" Permission is granted to copy, distribute and/or modify this document
+.\" under the terms of the GNU Free Documentation License, Version 1.2 or
+.\" any later version published by the Free Software Foundation; with no
+.\" Invariant Sections, with no Front-Cover Texts, and with no Back-Cover
+.\" Texts.  A copy of the license is included in the `COPYING.DOC' file
+.\" as part of this distribution.
+.\"
+.TH gd_nentries 3 "28 June 2012" "Version 0.8.0" "GETDATA"
+.SH NAME
+gd_nentries, gd_nfields, gd_nfields_by_type gd_nmfields, gd_nmfields_by_type,
+gd_nmvectors, gd_nvectors \(em count field entries in a dirfile
+.SH SYNOPSIS
+.B #include <getdata.h>
+.HP
+.nh
+.ad l
+.BI "unsigned int gd_nentries(DIRFILE *" dirfile ", const char *" parent ,
+.BI "unsigned int " type ", unsigned int " flags );
+.HP
+.BI "unsigned int gd_nfields(DIRFILE *" dirfile );
+.HP
+.BI "unsigned int gd_nfields_by_type(DIRFILE *" dirfile ", gd_entype_t " type );
+.HP
+.BI "unsigned int gd_nmfields(DIRFILE *" dirfile ", const char *" parent );
+.HP
+.BI "unsigned int gd_nmfields_by_type(DIRFILE *" dirfile ,
+.BI "const char *" parent ", gd_entype_t " type );
+.HP
+.BI "unsigned int gd_nmvectors(DIRFILE *" dirfile ", const char *" parent );
+.HP
+.BI "unsigned int gd_nvectors(DIRFILE *" dirfile );
+.hy
+.ad n
+.SH DESCRIPTION
+The
+.BR gd_nentries ()
+function queries a dirfile(5) database specified by
+.I dirfile
+and returns a count of metadata entries satisfying the supplied criteria.
+If
+.I parent
+is non-NULL, metafields under the field specified by
+.I parent
+are considered; otherwise, top-level fields are considered, and metafields
+ignored.
+
+The
+.I type
+argument should be one of the following symbols indicating an explicit entry
+type to count:
+.IP
+.nh
+.ad l
+.BR GD_BIT_ENTRY ", " GD_CARRAY_ENTRY ", " GD_CONST_ENTRY ", " GD_DIVIDE_ENTRY ,
+.BR GD_INDEX_ENTRY ", " GD_LINCOM_ENTRY ", " GD_LINTERP_ENTRY ,
+.BR GD_MPLEX_ENTRY ", " GD_MULTIPLY_ENTRY ", " GD_PHASE_ENTRY ,
+.BR GD_POLYNOM_ENTRY ", " GD_RAW_ENTRY ", " GD_RECIP_ENTRY ,
+.BR GD_SBIT_ENTRY ", " GD_STRING_ENTRY ", " GD_WINDOW_ENTRY .
+.ad n
+.hy
+.PP
+.RB ( GD_INDEX_ENTRY
+is a special field type for the implicit
+.I INDEX
+field) or else one of the following special symbols:
+.TP
+.B GD_ALL_ENTRIES \fR(= 0)
+Count entries of all types.
+.TP
+.B GD_ALIAS_ENTRIES
+Count only aliases.  This is the only way to get a count including aliases which
+do not point to valid field codes.
+.TP
+.B GD_SCALAR_ENTRIES
+Count only scalar field types
+.RB ( CONST ", " CARRAY ", " STRING ).
+.TP
+.B GD_VECTOR_ENTRIES
+Count only vector field types (all field types except the scalar field types
+listed above).
+.PP
+The
+.I flags
+argument should be zero or more of the following flags, bitwise or'd together:
+.TP
+.B GD_ENTRIES_HIDDEN
+Include hidden entries (see
+.BR gd_hidden (3))
+in the count: normally hidden entries are skipped;
+.TP
+.B GD_ENTRIES_NOALIAS
+Exclude aliases from the count: normally aliases are considered the same as
+their target (that is: a field with
+.I n
+aliases, plus its canonical name, will be counted
+.IR n +1
+times).
+.SS Special Cases
+The call
+.RS
+.BI gd_nfields( dirfile );
+.RE
+.PP
+is equivalent to
+.RS
+.BI gd_nentries( dirfile ", NULL, GD_ALL_ENTRIES, 0);
+.RE
+.PP
+The call
+.RS
+.BI gd_nfields_by_type( dirfile ", " type );
+.RE
+.PP
+is equivalent to
+.RS
+.BI gd_nentries( dirfile ", NULL, " type ", 0);"
+.RE
+.PP
+The call
+.RS
+.BI gd_nmfields( dirfile ", " parent );
+.RE
+.PP
+is equivalent to
+.RS
+.BI gd_nentries( dirfile ", " parent ", GD_ALL_ENTRIES, 0);"
+.RE
+.PP
+The call
+.RS
+.BI gd_nmfields_by_type( dirfile ", " parent ", " type );
+.RE
+.PP
+is equivalent to
+.RS
+.BI gd_nentries( dirfile ", " parent ", " type ", 0);"
+.RE
+.PP
+The call
+.RS
+.BI gd_nmvectors( dirfile ", " parent );
+.RE
+.PP
+is equivalent to
+.RS
+.BI gd_nentries( dirfile ", " parent ", GD_VECTOR_ENTRIES, 0);"
+.RE
+.PP
+The call
+.RS
+.BI gd_nvectors( dirfile );
+.RE
+.PP
+is equivalent to
+.RS
+.BI gd_nentries( dirfile ", NULL, GD_VECTOR_ENTRIES, 0);"
+.RE
+
+.SH RETURN VALUE
+Upon successful completion, these functions return the number of entries in the
+database satisfying the supplied criteria.  On error, they return zero and sets
+the dirfile error to a non-zero error value.  Possible error values are:
+.TP 8
+.B GD_E_BAD_CODE
+The supplied parent field code was not found, or referred to a metafield itself.
+.TP
+.B GD_E_BAD_DIRFILE
+The supplied dirfile was invalid.
+.TP
+.B GD_E_BAD_ENTRY
+The
+.I type
+parameter supplied was not one of the symbols listed above.
+.PP
+The dirfile error may be retrieved by calling
+.BR gd_error (3).
+A descriptive error string for the last error encountered can be obtained from
+a call to
+.BR gd_error_string (3).
+.SH SEE ALSO
+.BR dirfile (5),
+.BR gd_open (3),
+.BR gd_entry_list (3),
+.BR gd_error (3),
+.BR gd_error_string (3),
+.BR gd_hidden (3)
diff --git a/man/gd_nframes.3 b/man/gd_nframes.3
index 9eeaae2..9b86c71 100644
--- a/man/gd_nframes.3
+++ b/man/gd_nframes.3
@@ -1,6 +1,6 @@
 .\" gd_nframes.3.  The gd_nframes man page.
 .\"
-.\" Copyright (C) 2008, 2010 D. V. Wiebe
+.\" Copyright (C) 2008, 2010, 2011 D. V. Wiebe
 .\"
 .\""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
 .\"
@@ -13,7 +13,7 @@
 .\" Texts.  A copy of the license is included in the `COPYING.DOC' file
 .\" as part of this distribution.
 .\"
-.TH gd_nframes 3 "22 July 2010" "Version 0.7.0" "GETDATA"
+.TH gd_nframes 3 "19 August 2011" "Version 0.8.0" "GETDATA"
 .SH NAME
 gd_nframes \(em report the size of a dirfile
 .SH SYNOPSIS
@@ -55,13 +55,15 @@ Upon successful completion,
 returns the number of frames in the dirfile.  On error, it returns zero and sets
 the dirfile error to a non-zero error value.  Possible error values are:
 .TP 8
+.B GD_E_ALLOC
+The library was unable to allocate memory.
+.TP
 .B GD_E_BAD_DIRFILE
 The supplied dirfile was invalid.
 .TP
 .B GD_E_RAW_IO
-An attempt to
-.BR stat (2)
-the file associated with the reference field failed.
+An attempt to determine the (unencoded) size of the data file associated with
+the reference field failed.
 .TP
 .B GD_E_UNKNOWN_ENCODING
 The size of the decoded data file associated with the reference field could not
diff --git a/man/gd_nframes64.3 b/man/gd_nframes64.3
index b505876..e67a43a 100644
--- a/man/gd_nframes64.3
+++ b/man/gd_nframes64.3
@@ -1,6 +1,6 @@
 .\" gd_nframes64.3.  The gd_nframes64 man page.
 .\"
-.\" Copyright (C) 2008, 2010 D. V. Wiebe
+.\" Copyright (C) 2008, 2010, 2012 D. V. Wiebe
 .\"
 .\""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
 .\"
@@ -13,34 +13,40 @@
 .\" Texts.  A copy of the license is included in the `COPYING.DOC' file
 .\" as part of this distribution.
 .\"
-.TH gd_nframes64 3 "16 July 2010" "Version 0.7.0" "GETDATA"
+.TH gd_nframes64 3 "25 May 2012" "Version 0.8.0" "GETDATA"
 .SH NAME
-gd_nframes64 \(em report the size of a dirfile with largefile support
+gd_nframes64 \(em report the size of a dirfile, with largefile support
 .SH SYNOPSIS
-.B #define _LARGEFILE64_SOURCE
+.B #define GD_64BIT_API
 
 .B #include <getdata.h>
 .HP
 .nh
 .ad l
-.BI "off64_t gd_nframes64(DIRFILE *" dirfile );
+.BI "gd_off64_t gd_nframes64(DIRFILE *" dirfile );
 .hy
 .ad n
 .SH DESCRIPTION
 This version of
 .BR gd_nframes (3)
-uses a 64-bit offset type, even if
-.I off_t
-is a 32-bit type.  It is only available if one defines
-.IR _LARGEFILE64_SOURCE .
+uses a 64-bit offset type
+.RB ( gd_off64_t ),
+where one is available, regardless of the size of
+.BR off_t .
+It is only available if one defines
+.IR GD_64BIT_API
+or
+.IR _LARGEFILE64_SOURCE
+before including getdata.h.
+
 If
 .I off_t
-is a 64-bit type (i.e. if
+is a 64-bit type (possibly because
 .I _FILE_OFFSET_BITS
-is defined to be 64), this function will be called
-.BR gd_nframes ().
+has been defined to 64), this function will the same as
+.BR gd_nframes (3).
 Otherwise,
-.BR gd_nframes ()
+.BR gd_nframes (3)
 will be a version of this function which uses a 32-bit
 .IR off_t .
 .SH SEE ALSO
diff --git a/man/gd_parent_fragment.3 b/man/gd_parent_fragment.3
index 30afa5e..53addf0 100644
--- a/man/gd_parent_fragment.3
+++ b/man/gd_parent_fragment.3
@@ -1,6 +1,6 @@
 .\" gd_parent_fragment.3.  The gd_parent_fragment man page.
 .\"
-.\" Copyright (C) 2008, 2010 D. V. Wiebe
+.\" Copyright (C) 2008, 2010, 2012 D. V. Wiebe
 .\"
 .\""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
 .\"
@@ -13,7 +13,7 @@
 .\" Texts.  A copy of the license is included in the `COPYING.DOC' file
 .\" as part of this distribution.
 .\"
-.TH gd_parent_fragment 3 "21 July 2010" "Version 0.7.0" "GETDATA"
+.TH gd_parent_fragment 3 "21 April 2012" "Version 0.8.0" "GETDATA"
 .SH NAME
 gd_parent_fragment \(em retrieve the parent fragment of a fragment in a dirfile
 .SH SYNOPSIS
@@ -21,7 +21,7 @@ gd_parent_fragment \(em retrieve the parent fragment of a fragment in a dirfile
 .HP
 .nh
 .ad l
-.BI "int gd_parent_fragment(const DIRFILE *" dirfile ", int " fragment_index );
+.BI "int gd_parent_fragment(DIRFILE *" dirfile ", int " fragment_index );
 .hy
 .ad n
 .SH DESCRIPTION
diff --git a/man/gd_put_carray_slice.3 b/man/gd_put_carray_slice.3
index a8a4a18..2e18777 100644
--- a/man/gd_put_carray_slice.3
+++ b/man/gd_put_carray_slice.3
@@ -1,6 +1,6 @@
 .\" gd_put_carray_slice.3.  The gd_put_carray_slice man page.
 .\"
-.\" Copyright (C) 2010 D. V. Wiebe
+.\" Copyright (C) 2010, 2011, 2012 D. V. Wiebe
 .\"
 .\""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
 .\"
@@ -13,9 +13,10 @@
 .\" Texts.  A copy of the license is included in the `COPYING.DOC' file
 .\" as part of this distribution.
 .\"
-.TH gd_put_carray_slice 3 "4 Novmeber 2010" "Version 0.7.0" "GETDATA"
+.TH gd_put_carray_slice 3 "4 July 2012" "Version 0.8.0" "GETDATA"
 .SH NAME
-gd_put_carray gd_put_carray_slice \(em write CARRAY data to a dirfile database
+gd_put_carray, gd_put_carray_slice, gd_put_constant \(em write CONST or CARRAY
+data to a dirfile database
 .SH SYNOPSIS
 .B #include <getdata.h>
 .HP
@@ -27,6 +28,9 @@ gd_put_carray gd_put_carray_slice \(em write CARRAY data to a dirfile database
 .HP
 .BI "int gd_put_carray(DIRFILE *" dirfile ", const char *" field_code ,
 .BI "gd_type_t " data_type ", const void *" data_in );
+.HP
+.BI "int gd_put_constant(DIRFILE *" dirfile ", const char *" field_code ,
+.BI "gd_type_t " data_type ", const void *" data_in );
 .hy
 .ad n
 .SH DESCRIPTION
@@ -47,10 +51,26 @@ given by
 .IR start ,
 and the number of elements stored is given by
 .IR len .
+
 The
 .BR gd_put_carray ()
-function behaves similarly, except the whole scalar array is written.  These
-interface cannot write to field represetations.
+function behaves similarly, except the whole scalar array is written, as if
+.BR gd_put_carray_slice ()
+were called with
+.I start
+equal zero and
+.I len
+equal to the value returned by
+.BR gd_carray_len (3).
+The
+.BR gd_put_constant ()
+function is equivalent to calling
+.BR gd_put_carray_slice ()
+with
+.I start
+equal to zero and
+.I len
+equal to one.  None of these interfaces can write to field representations.
 
 The argument
 .I data_in
@@ -61,7 +81,7 @@ may be obtained by calling
 .BR gd_carray_len (3).
 Unlike
 .BR gd_putdata (3),
-writing data past the end of the field is not permitted.  To add data to the
+writing data past the end of the field is not permitted.  To add data to a
 .BR CARRAY ,
 first increase its length by calling
 .BR gd_alter_carray (3),
@@ -74,47 +94,46 @@ of the data pointed to by
 .IR data_in :
 .RS
 .TP 11
-.I GD_UINT8
+.B GD_UINT8
 unsigned 8-bit integer
 .TP
-.I GD_INT8
+.B GD_INT8
 signed (two's complement) 8-bit integer
 .TP
-.I GD_UINT16
+.B GD_UINT16
 unsigned 16-bit integer
 .TP
-.I GD_INT16
+.B GD_INT16
 signed (two's complement) 16-bit integer
 .TP
-.I GD_UINT32
+.B GD_UINT32
 unsigned 32-bit integer
 .TP
-.I GD_INT32
+.B GD_INT32
 signed (two's complement) 32-bit integer
 .TP
-.I GD_UINT64
+.B GD_UINT64
 unsigned 64-bit integer
 .TP
-.I GD_INT64
+.B GD_INT64
 signed (two's complement) 64-bit integer
 .TP
-.IR GD_FLOAT32
+.B GD_FLOAT32
 IEEE-754 standard 32-bit single precision floating point number
 .TP
-.IR GD_FLOAT64
+.B GD_FLOAT64
 IEEE-754 standard 64-bit double precision floating point number
 .TP
-.IR GD_COMPLEX64
+.B GD_COMPLEX64
 C99-conformant 64-bit single precision complex number
 .TP
-.IR GD_COMPLEX128
+.B GD_COMPLEX128
 C99-conformant 128-bit double precision complex number
 .RE
 
-The type of the input data need not be the same as the
-.B CARRAY
-storage type.  Type conversion will be performed as necessary to return the
-requested type.  The 
+The type of the input data need not be the same as the storage type of the
+field.  Type conversion will be performed as necessary to return the requested
+type.  The 
 .I dirfile
 argument must point to a valid DIRFILE object previously created by a call to
 .BR gd_open (3).
@@ -131,6 +150,9 @@ The specified
 .I dirfile
 was opened read-only.
 .TP
+.B GD_E_ALLOC
+The library was unable to allocate memory.
+.TP
 .B GD_E_BAD_CODE
 The field specified by
 .I field_code
@@ -144,7 +166,9 @@ was supplied.
 .B GD_E_BAD_FIELD_TYPE
 The supplied
 .I field_code
-referred to a field of a type other than 
+was not a
+.B CONST
+nor a
 .BR CARRAY .
 The caller should use
 .BR gd_putdata (3),
@@ -162,13 +186,16 @@ An invalid
 .I data_type
 was specified.
 .TP
-.B GE_E_BOUNDS
+.B GD_E_BOUNDS
 A request for data beyond the end of the field was made.
 .TP
 .B GD_E_INTERNAL_ERROR
 An internal error occurred in the library while trying to perform the task.
 This indicates a bug in the library.  Please report the incident to the
 maintainer.
+.TP
+.B GD_E_PROTECTED
+The fragment containing the constant was protected from change.
 .PP
 The dirfile error may be retrieved by calling
 .BR gd_error (3).
diff --git a/man/gd_put_string.3 b/man/gd_put_string.3
index f620f80..c6c3d41 100644
--- a/man/gd_put_string.3
+++ b/man/gd_put_string.3
@@ -1,6 +1,6 @@
 .\" gd_put_string.3.  The gd_put_string man page.
 .\"
-.\" Copyright (C) 2008, 2009, 2010 D. V. Wiebe
+.\" Copyright (C) 2008, 2009, 2010, 2011 D. V. Wiebe
 .\"
 .\""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
 .\"
@@ -13,7 +13,7 @@
 .\" Texts.  A copy of the license is included in the `COPYING.DOC' file
 .\" as part of this distribution.
 .\"
-.TH gd_put_string 3 "25 May 2010" "Version 0.7.0" "GETDATA"
+.TH gd_put_string 3 "19 August 2011" "Version 0.8.0" "GETDATA"
 .SH NAME
 gd_put_string \(em retrieve a string from a dirfile database
 .SH SYNOPSIS
@@ -53,6 +53,11 @@ returns the length of the string stored, including the trailing NUL character.
 On error, it returns 0 and sets the dirfile error to a non-zero value.  Possible
 error values are:
 .TP 8
+.B GD_E_ACCMODE
+The specified
+.I dirfile
+was opened read-only.
+.TP
 .B GD_E_BAD_CODE
 The field specified by
 .I field_code
@@ -70,6 +75,7 @@ referred to a field of type other than
 .BR STRING .
 The caller should use
 .BR gd_putdata (3),
+.BR gd_put_carray (3),
 or
 .BR gd_put_constant (3)
 instead.
diff --git a/man/gd_putdata.3 b/man/gd_putdata.3
index 5e54f86..f6d45fd 100644
--- a/man/gd_putdata.3
+++ b/man/gd_putdata.3
@@ -1,6 +1,6 @@
 .\" gd_putdata.3.  The gd_putdata man page.
 .\"
-.\" Copyright (C) 2008, 2009, 2010 D. V. Wiebe
+.\" Copyright (C) 2008, 2009, 2010, 2011, 2012 D. V. Wiebe
 .\"
 .\""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
 .\"
@@ -13,7 +13,7 @@
 .\" Texts.  A copy of the license is included in the `COPYING.DOC' file
 .\" as part of this distribution.
 .\"
-.TH gd_putdata 3 "4 November 2010" "Version 0.7.0" "GETDATA"
+.TH gd_putdata 3 "21 April 2012" "Version 0.8.0" "GETDATA"
 .SH NAME
 gd_putdata \(em write data to a dirfile database
 .SH SYNOPSIS
@@ -52,7 +52,9 @@ The
 argument must point to a valid DIRFILE object previously created by a call to
 .BR gd_open (3).
 
-The first sample written will be
+Unless using
+.B GD_HERE 
+(see below), the first sample written will be
 .RS
 .IR first_frame " * " samples_per_frame " + " first_sample
 .RE
@@ -75,41 +77,59 @@ or
 .IR num_frames " and " first_frames ,
 equal to zero.
 
+Instead of explicitly specifying the origin of the write, the caller may pass
+the special symbol
+.B GD_HERE
+as
+.IR first_frame .
+This will result in the write occurring at the current position of the I/O
+pointer for the field (see
+.BR gd_seek (3)
+for a discussion of I/O pointers).  In this case, the value of
+.I first_sample
+is ignored.
+
 The 
 .I data_type
 argument should be one of the following symbols, which indicates the type of
 the input data:
 .RS
 .TP 11
-.I GD_UINT8
+.B GD_UINT8
 unsigned 8-bit integer
 .TP
-.I GD_INT8
+.B GD_INT8
 signed (two's complement) 8-bit integer
 .TP
-.I GD_UINT16
+.B GD_UINT16
 unsigned 16-bit integer
 .TP
-.I GD_INT16
+.B GD_INT16
 signed (two's complement) 16-bit integer
 .TP
-.I GD_UINT32
+.B GD_UINT32
 unsigned 32-bit integer
 .TP
-.I GD_INT32
+.B GD_INT32
 signed (two's complement) 32-bit integer
 .TP
-.I GD_UINT64
+.B GD_UINT64
 unsigned 64-bit integer
 .TP
-.I GD_INT64
+.B GD_INT64
 signed (two's complement) 64-bit integer
 .TP
-.IR GD_FLOAT32 \~or\~ GD_FLOAT
+.B GD_FLOAT32
 IEEE-754 standard 32-bit single precision floating point number
 .TP
-.IR GD_FLOAT64 \~or\~ GD_DOUBLE
+.B GD_FLOAT64
 IEEE-754 standard 64-bit double precision floating point number
+.TP
+.B GD_COMPLEX64
+C99-conformant 64-bit single precision complex number
+.TP
+.B GD_COMPLEX128
+C99-conformant 128-bit double precision complex number
 .RE
 
 The type of the input data need not be the same as the type of the data stored
@@ -117,6 +137,11 @@ in the database.  Type conversion will be performed as necessary to write the
 appropriate type.  The argument
 .I data_in
 must point to a valid memory location of containing all the data to be written.
+
+Upon successful completion, the I/O pointer of the field will be on the sample
+immediately following the last sample written.  On error, the position of the
+I/O pointer is not specified.
+
 .SH RETURN VALUE
 In all cases,
 .BR gd_putdata ()
@@ -153,10 +178,9 @@ or
 .B DIVIDE
 type, or
 .B LINCOM
-type with more than one input fields.  In this case,
-.BR gd_putdata ()
-has no knowledge on how to partition the input data.  Alternately, the caller
-may have attempted to write to the implicit INDEX field, which is not possible.
+type with more than one input fields.  In this case, GetData has no knowledge on
+how to partition the input data.  Alternately, the caller may have attempted to
+write to the implicit INDEX field, which is not possible.
 .TP
 .B GD_E_BAD_REPR
 The representation suffix specified in
@@ -170,7 +194,21 @@ An invalid
 was specified.
 .TP
 .B GD_E_DIMENSION
-A scalar field was found where a vector field was expected.
+The field specified by
+.I field_code
+was not a vector field.  The caller should use
+.BR gd_put_carray (3),
+.BR gd_put_constant (3),
+or
+.BR gd_put_string (3)
+instead.  Or, a scalar field was found where a vector field was expected in
+the definition of
+.IR field_code .
+.TP
+.B GD_E_DOMAIN
+An attempt was made to write to a
+.B LINTERP
+field with a look-up table which was not monotonic or not purely real.
 .TP
 .B GD_E_INTERNAL_ERROR
 An internal error occurred in the library while trying to perform the task.
@@ -178,7 +216,9 @@ This indicates a bug in the library.  Please report the incident to the
 maintainer.
 .TP
 .B GD_E_OPEN_LINFILE
-An error occurred while trying to read a LINTERP table from disk.
+An error occurred while trying to read a
+.B LINTERP
+table from disk.
 .TP
 .B GD_E_PROTECTED
 The data of the
@@ -207,7 +247,6 @@ Reading from dirfiles with the encoding scheme of the specified dirfile is not
 supported by the library.  See
 .BR dirfile-encoding (5)
 for details on dirfile encoding schemes.
-.RE
 .PP
 The dirfile error may be retrieved by calling
 .BR gd_error (3).
@@ -223,4 +262,6 @@ a call to
 .BR gd_getdata (3),
 .BR gd_put_carray (3),
 .BR gd_put_constant (3),
-.BR gd_spf (3)
+.BR gd_seek (3),
+.BR gd_spf (3),
+.BR GD_SIZE (3)
diff --git a/man/gd_putdata64.3 b/man/gd_putdata64.3
index d0e13a8..97eb6c4 100644
--- a/man/gd_putdata64.3
+++ b/man/gd_putdata64.3
@@ -1,6 +1,6 @@
 .\" gd_putdata64.3.  The gd_putdata64 man page.
 .\"
-.\" Copyright (C) 2008, 2010 D. V. Wiebe
+.\" Copyright (C) 2008, 2010, 2012 D. V. Wiebe
 .\"
 .\""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
 .\"
@@ -13,36 +13,43 @@
 .\" Texts.  A copy of the license is included in the `COPYING.DOC' file
 .\" as part of this distribution.
 .\"
-.TH gd_putdata64 3 "25 May 2010" "Version 0.7.0" "GETDATA"
+.TH gd_putdata64 3 "25 May 2012" "Version 0.8.0" "GETDATA"
 .SH NAME
-gd_putdata64 \(em write data to a dirfile database with largefile support
+gd_putdata64 \(em write data to a dirfile database, with largefile support
 .SH SYNOPSIS
-.B #define _LARGEFILE64_SOURCE
+.B #define GD_64BIT_API
 
 .B #include <getdata.h>
 .HP
 .nh
 .ad l
-.BI "size_t gd_putdata64(DIRFILE *" dirfile ", const char *" field_code ", off64_t"
-.IB first_frame ", off64_t " first_sample ", size_t " num_frames ", size_t"
-.IB num_samples ", gd_type_t " data_type ", const void *" data_out );
+.BI "size_t gd_putdata64(DIRFILE *" dirfile ", const char *" field_code ,
+.BI "gd_off64_t " first_frame ", gd_off64_t " first_sample ", size_t 
+.IB num_frames ", size_t " num_samples ", gd_type_t " data_type ,
+.BI "const void *" data_out );
 .hy
 .ad n
 .SH DESCRIPTION
 This version of
 .BR gd_putdata (3)
-uses a 64-bit offset type, even if
-.I off_t
-is a 32-bit type.  It is only available if one defines
-.IR _LARGEFILE64_SOURCE .
+uses a 64-bit offset type
+.RB ( gd_off64_t ),
+where one is available, regardless of the size of
+.BR off_t .
+It is only available if one defines
+.IR GD_64BIT_API
+or
+.IR _LARGEFILE64_SOURCE
+before including getdata.h.
+
 If
 .I off_t
-is a 64-bit type (i.e. if
+is a 64-bit type (possibly because
 .I _FILE_OFFSET_BITS
-is defined to be 64), this function will be called
-.BR gd_putdata ().
+has been defined to 64), this function will the same as
+.BR gd_putdata (3).
 Otherwise,
-.BR gd_putdata ()
+.BR gd_putdata (3)
 will be a version of this function which uses a 32-bit
 .IR off_t .
 .SH SEE ALSO
diff --git a/man/gd_rename.3 b/man/gd_rename.3
index 94d5e4f..c1ac341 100644
--- a/man/gd_rename.3
+++ b/man/gd_rename.3
@@ -1,6 +1,6 @@
 .\" gd_rename.3.  The gd_rename man page.
 .\"
-.\" Copyright (C) 2008, 2009, 2010 D. V. Wiebe
+.\" Copyright (C) 2008, 2009, 2010, 2011, 2012 D. V. Wiebe
 .\"
 .\""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
 .\"
@@ -13,22 +13,22 @@
 .\" Texts.  A copy of the license is included in the `COPYING.DOC' file
 .\" as part of this distribution.
 .\"
-.TH gd_rename 3 "20 July 2010" "Version 0.7.0" "GETDATA"
+.TH gd_rename 3 "27 June 2012" "Version 0.8.0" "GETDATA"
 .SH NAME
-gd_rename \(em change the name of a dirfile field
+gd_rename \(em change the name of a dirfile field or alias
 .SH SYNOPSIS
 .B #include <getdata.h>
 .HP
 .nh
 .ad l
 .BI "int gd_rename(DIRFILE *" dirfile ", const char"
-.BI * old_code ", const char *" new_name ", int " move_data );
+.BI * old_code ", const char *" new_name ", unsigned int " flags );
 .hy
 .ad n
 .SH DESCRIPTION
 The
 .BR gd_rename ()
-function changes the name of the field specified by
+function changes the name of the field or alias specified by
 .IR old_code ,
 which should not contain a representation suffix, defined in the dirfile
 specified by
@@ -43,22 +43,27 @@ by its full (slashed) field code, while
 .I new_name
 should only contain the new name (without slash).
 
-If the flag
-.I move_data
-is non-zero, and
+The
+.I flags
+parameter should be zero or more of the following flags, bitwise or'd together:
+.TP
+.B GD_REN_DATA
+if
 .I old_code
 specifies a
 .B RAW
 field, the binary file associated with the field will be renamed as well.
-If
-.I move_data
-is zero, no changes will be made to the binary file.  If
+Without this flag, no changes are made to the binary file.  If
 .I field_code
 specifies a field of type other than
 .BR RAW ,
-the
-.I move_data
-flag is ignored.
+this flag is ignored.
+.TP
+.B GD_REN_UPDB
+Rename the field in any other field specifications which use this field as an
+input (either as a vector input field to a derived field, or else as a scalar
+field parameter).  Without this flag, fields which depend on the old name of
+this field are left unmodified.
 
 .SH RETURN VALUE
 On success,
@@ -85,18 +90,13 @@ An attempt was made to rename the immutable
 .I INDEX
 field.
 .TP
-.B GD_E_BAD_REPR
-The representation suffix specified in
-.I field_code
-was not recognised.
-.TP
 .B GD_E_DUPLICATE
-The new name specified is already in use by another field.
+The new name specified is already in use by another entry.
 .TP
 .B GD_E_PROTECTED
-The metadata of the format specification fragment containing the field was
+The metadata of the format specification fragment containing the entry was
 protected from change, or the binary data of the fragments was protected from
-change and binary file translation was requested.
+change and a binary file move was requested.
 .TP
 .B GD_E_RAW_IO
 An I/O error occurred while attempting to rename the binary file.
diff --git a/man/gd_rewrite_fragment.3 b/man/gd_rewrite_fragment.3
index 429a590..aeb8d79 100644
--- a/man/gd_rewrite_fragment.3
+++ b/man/gd_rewrite_fragment.3
@@ -1,6 +1,6 @@
 .\" gd_rewrite_fragment.3.  The gd_rewrite_fragment man page.
 .\"
-.\" Copyright (C) 2010 D. V. Wiebe
+.\" Copyright (C) 2010, 2011 D. V. Wiebe
 .\"
 .\""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
 .\"
@@ -13,7 +13,7 @@
 .\" Texts.  A copy of the license is included in the `COPYING.DOC' file
 .\" as part of this distribution.
 .\"
-.TH gd_rewrite_fragment 3 "22 March 2011" "Version 0.7.2" "GETDATA"
+.TH gd_rewrite_fragment 3 "19 August 2011" "Version 0.8.0" "GETDATA"
 .SH NAME
 gd_rewrite_fragment \(em re-write a dirfile format specification fragment
 .SH SYNOPSIS
@@ -52,6 +52,9 @@ set to a non-zero error value.  Possible error values are:
 .B GD_E_ACCMODE
 The supplied dirfile was opened in read-only mode.
 .TP
+.B GD_E_ALLOC
+The library was unable to allocate memory.
+.TP
 .B GD_E_BAD_DIRFILE
 The supplied dirfile was invalid.
 .TP
@@ -61,11 +64,6 @@ The supplied fragment index was out of range.
 .B GD_E_FLUSH
 A temporary file could not be opened into which to write the modified metadata,
 or renaming the temporary file over the original fragment failed.
-.TP
-.B GD_E_INTERNAL_ERROR
-An internal error occurred in the library while trying to perform the task.
-This indicates a bug in the library.  Please report the incident to the
-maintainer.
 .PP
 The dirfile error may be retrieved by calling
 .BR gd_error (3).
diff --git a/man/gd_seek.3 b/man/gd_seek.3
new file mode 100644
index 0000000..d647c0f
--- /dev/null
+++ b/man/gd_seek.3
@@ -0,0 +1,212 @@
+.\" gd_getdata.3.  The gd_getdata man page.
+.\"
+.\" Copyright (C) 2011, 2012, 2013 D. V. Wiebe
+.\"
+.\""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
+.\"
+.\" This file is part of the GetData project.
+.\"
+.\" Permission is granted to copy, distribute and/or modify this document
+.\" under the terms of the GNU Free Documentation License, Version 1.2 or
+.\" any later version published by the Free Software Foundation; with no
+.\" Invariant Sections, with no Front-Cover Texts, and with no Back-Cover
+.\" Texts.  A copy of the license is included in the `COPYING.DOC' file
+.\" as part of this distribution.
+.\"
+.TH gd_seek 3 "12 March 2013" "Version 0.8.4" "GETDATA"
+.SH NAME
+gd_seek \(em reposition a dirfile field pointer
+.SH SYNOPSIS
+.B #include <getdata.h>
+.HP
+.nh
+.ad l
+.BI "off_t gd_seek(DIRFILE *" dirfile ", const char *" field_code ", off_t"
+.IB frame_num ", off_t " sample_num ", int " flags );
+.hy
+.ad n
+.SH DESCRIPTION
+The
+.BR gd_seek ()
+function changes the position of the I/O pointer associated with the field
+.I field_code
+in the dirfile(5) database specified by
+.IR dirfile .
+In normal operation,
+.BR gd_seek ()
+advances the field I/O pointer
+.I frame_num
+frames plus
+.I sample_num
+samples from the origin point specified in
+.IR flags ,
+which should contain one of
+.BR GD_SEEK_SET ", " GD_SEEK_CUR ,
+or
+.BR GD_SEEK_END ,
+indicating, respectively, sample zero, the current position of the
+field pointer, and the location of the end-of-field marker (see
+.BR gd_eof (3)).
+
+In addition to one of the symbols above, the
+.I flags
+parameter may also, optionally, be bitwise or'd with
+.BR GD_SEEK_WRITE ,
+which will result in the field being padded (with zero for integer types or a
+IEEE-754 conforming not-a-number otherwise) in the event of seeking past the
+end-of-field marker.  Note: for some data encodings, the padding may be deferred
+until a write occurs.  The result of calling
+.BR gd_seek ()
+with
+.BR GD_SEEK_WRITE ,
+but without a subsequent call to
+.BR gd_putdata (3),
+is encoding specific, and may not actually advance the end of field.  Attempting
+to seek past the end-of-field marker without specifying
+.B GD_SEEK_WRITE
+is also encoding specific: in some encodings the field pointer will be moved
+past the end-of-field marker, while in others, it will result in an error.
+
+In general,
+.B GD_SEEK_WRITE
+should be used on
+.BR gd_seek ()
+calls before a write via
+.BR gd_putdata (3),
+while calls before a read via
+.BR gd_getdata (3)
+should omit the
+.B GD_SEEK_WRITE
+flag.  So the following:
+.IP
+.nh
+.ad l
+.BI "gd_seek(" dirfile ", " field_code ", " a ", " b ,
+.B GD_SEEK_SET | GD_SEEK_WRITE);
+.br
+.BI "gd_putdata(" dirfile ", "field_code ", GD_HERE, 0, " c ", " d ", " type ,
+.IB data );
+.ad n
+.hy
+.P
+is equivalent to:
+.IP
+.nh
+.ad l
+.BI "gd_putdata(" dirfile ", "field_code ", " a ", " b ", " c ", " d ", " type ,
+.IB data );
+.P
+and, similarly,
+.IP
+.nh
+.ad l
+.BI "gd_seek(" dirfile ", " field_code ", " a ", " b ", GD_SEEK_SET);"
+.br
+.BI "gd_getdata(" dirfile ", "field_code ", GD_HERE, 0, " c ", " d ", " type ,
+.IB data );
+.ad n
+.hy
+.P
+is equivalent to:
+.IP
+.nh
+.ad l
+.BI "gd_getdata(" dirfile ", "field_code ", " a ", " b ", " c ", " d ", " type ,
+.IB data );
+.P
+Only
+.B RAW
+fields (and the implicit
+.I INDEX
+field) have field I/O pointers associated with them.  Calling
+.BR gd_seek ()
+on a derived field will move the field pointers of all of the field's inputs.
+It is possible to create derived fields which simultaneously read from different
+places of the same input field.  Calling
+.BR gd_seek ()
+on such a field will result in an error.
+
+.SH RETURN VALUE
+Upon successful completion,
+.BR gd_seek ()
+returns the field position of the specified field in samples.  On error, it
+returns -1 and set the dirfile error to a non-zero value.  Possible error values
+are:
+.TP 8
+.B GD_E_ALLOC
+The library was unable to allocate memory.
+.TP
+.B GD_E_ARGUMENT
+The
+.I flags
+parameter didn't contain exactly one of
+.BR GD_SEEK_SET ", " GD_SEEK_CUR ,
+or
+.BR GD_SEEK_END .
+.TP
+.B GD_E_BAD_CODE
+The field specified by
+.IR field_code ,
+or one of the fields it uses for input, was not found in the database.
+.TP
+.B GD_E_BAD_DIRFILE
+The supplied dirfile was invalid.
+.TP
+.B GD_E_BAD_FIELD_TYPE
+An attempt was made to seek relative to
+.B GD_SEEK_END
+on the
+.I INDEX
+field, which has no end-of-field marker.
+.TP
+.B GD_E_BAD_REPR
+The representation suffix specified in
+.IR field_code ,
+or in one of the field codes it uses for input, was invalid.
+.TP
+.B GD_E_DIMENSION
+The specified field or one of its inputs wasn't of vector type.
+.TP
+.B GD_E_DOMAIN
+The field position couldn't be set due to a derived field reading simultaneously
+from more than one place in an input field.
+.TP
+.B GD_E_INTERNAL_ERROR
+An internal error occurred in the library while trying to perform the task.
+This indicates a bug in the library.  Please report the incident to the
+maintainer.
+.TP
+.B GD_E_RAW_IO
+An error occurred while trying to open or read from a file on disk containing
+a raw field.
+.TP
+.B GD_E_RANGE
+The request resulted an attempt to move the I/O pointer of the specified field
+or one of its inputs to a negative sample number.
+.TP
+.B GD_E_RECURSE_LEVEL
+Too many levels of recursion were encountered while trying to resolve
+.IR field_code .
+This usually indicates a circular dependency in field specification in the
+dirfile.
+.TP
+.B GD_E_UNKNOWN_ENCODING
+The encoding scheme of a RAW field could not be determined.  This may also
+indicate that the binary file associated with the RAW field could not be found.
+.TP
+.B GD_E_UNSUPPORTED
+Reading from dirfiles with the encoding scheme of the specified dirfile is not
+supported by the library.  See
+.BR dirfile-encoding (5)
+for details on dirfile encoding schemes.
+.PP
+The dirfile error may be retrieved by calling
+.BR gd_error (3).
+A descriptive error string for the last error encountered can be obtained from
+a call to
+.BR gd_error_string (3).
+.SH SEE ALSO
+.BR gd_open (3),
+.BR gd_getdata (3),
+.BR gd_putdata (3),
+.BR gd_tell (3).
diff --git a/man/gd_seek64.3 b/man/gd_seek64.3
new file mode 100644
index 0000000..4a54605
--- /dev/null
+++ b/man/gd_seek64.3
@@ -0,0 +1,55 @@
+.\" gd_seek64.3.  The gd_seek64 man page.
+.\"
+.\" Copyright (C) 2012 D. V. Wiebe
+.\"
+.\""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
+.\"
+.\" This file is part of the GetData project.
+.\"
+.\" Permission is granted to copy, distribute and/or modify this document
+.\" under the terms of the GNU Free Documentation License, Version 1.2 or
+.\" any later version published by the Free Software Foundation; with no
+.\" Invariant Sections, with no Front-Cover Texts, and with no Back-Cover
+.\" Texts.  A copy of the license is included in the `COPYING.DOC' file
+.\" as part of this distribution.
+.\"
+.TH gd_seek64 3 "25 May 2012" "Version 0.8.0" "GETDATA"
+.SH NAME
+gd_seek64 \(em retrieve data from a dirfile database, with largefile support
+.SH SYNOPSIS
+.B #define GD_64BIT_API
+
+.B #include <getdata.h>
+.HP
+.nh
+.ad l
+.BI "gd_off64_t gd_seek64(DIRFILE *" dirfile ", const char *" field_code ,
+.BI "gd_off64_t " frame_num ", gd_off64_t " sample_num ", int " flags );
+.hy
+.ad n
+.SH DESCRIPTION
+This version of
+.BR gd_seek (3)
+uses a 64-bit offset type
+.RB ( gd_off64_t ),
+where one is available, regardless of the size of
+.BR off_t .
+It is only available if one defines
+.IR GD_64BIT_API
+or
+.IR _LARGEFILE64_SOURCE
+before including getdata.h.
+
+If
+.I off_t
+is a 64-bit type (possibly because
+.I _FILE_OFFSET_BITS
+has been defined to 64), this function will the same as
+.BR gd_seek (3).
+Otherwise,
+.BR gd_seek (3)
+will be a version of this function which uses a 32-bit
+.IR off_t .
+.SH SEE ALSO
+.BR gd_seek (3),
+.BR feature_test_macros (7)
diff --git a/man/gd_spf.3 b/man/gd_spf.3
index af814a1..b8841c6 100644
--- a/man/gd_spf.3
+++ b/man/gd_spf.3
@@ -1,6 +1,6 @@
 .\" gd_spf.3.  The gd_spf man page.
 .\"
-.\" Copyright (C) 2008, 2009, 2010 D. V. Wiebe
+.\" Copyright (C) 2008, 2009, 2010, 2011, 2012 D. V. Wiebe
 .\"
 .\""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
 .\"
@@ -13,7 +13,7 @@
 .\" Texts.  A copy of the license is included in the `COPYING.DOC' file
 .\" as part of this distribution.
 .\"
-.TH gd_spf 3 "24 July 2010" "Version 0.7.0" "GETDATA"
+.TH gd_spf 3 "1 April 2012" "Version 0.8.0" "GETDATA"
 .SH NAME
 gd_spf \(em returns the samples per frame for a field in a
 dirfile
@@ -22,7 +22,7 @@ dirfile
 .HP
 .nh
 .ad l
-.BI "gd_spf_t gd_spf(DIRFILE *" dirfile ", const char *" field_code );
+.BI "unsigned int gd_spf(DIRFILE *" dirfile ", const char *" field_code );
 .hy
 .ad n
 .SH DESCRIPTION
@@ -34,9 +34,7 @@ and returns the number of samples per frame for the field
 .IR field_code .
 If
 .I field_code
-contains a valid representation suffix, it will be ignored.  The
-.IR gd_spf_t
-type is an unsigned 16-bit integer type.
+contains a valid representation suffix, it will be ignored.
 
 The 
 .I dirfile
@@ -50,6 +48,9 @@ returns the number of samples per frame for the field specified.  On error, it
 returns zero and sets the dirfile error
 to a non-zero error value.  Possible error values are:
 .TP 8
+.B GD_E_ALLOC
+The library was unable to allocate memory.
+.TP
 .B GD_E_BAD_CODE
 The field specified by
 .I field_code
diff --git a/man/gd_strings.3 b/man/gd_strings.3
index 51a2c53..d680b2d 100644
--- a/man/gd_strings.3
+++ b/man/gd_strings.3
@@ -1,6 +1,6 @@
 .\" gd_strings.3.  The gd_strings man page.
 .\"
-.\" Copyright (C) 2008, 2010 D. V. Wiebe
+.\" Copyright (C) 2008, 2010, 2011 D. V. Wiebe
 .\"
 .\""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
 .\"
@@ -13,7 +13,7 @@
 .\" Texts.  A copy of the license is included in the `COPYING.DOC' file
 .\" as part of this distribution.
 .\"
-.TH gd_strings 3 "15 October 2010" "Version 0.7.0" "GETDATA"
+.TH gd_strings 3 "19 October 2011" "Version 0.8.0" "GETDATA"
 .SH NAME
 gd_strings \(em retrieve a list of string values from a dirfile
 .SH SYNOPSIS
@@ -68,9 +68,10 @@ Upon successful completion,
 .BR gd_strings ()
 returns a pointer to an array of strings containing the values of all the
 .B STRING
-fields defined in the dirfile database.  If no strings are defined in the
-database, NULL is returned.  On error it returns NULL and sets the dirfile error
-to a non-zero error value.  Possible error values are:
+fields defined in the dirfile database.  The array is terminated by a NULL
+pointer.  If no strings are defined in the database, an array consisting of only
+the NULL pointer is returned.  On error it returns NULL and sets the dirfile
+error to a non-zero error value.  Possible error values are:
 .TP 8
 .B GD_E_ALLOC
 The library was unable to allocate memory.
diff --git a/man/gd_strtok.3 b/man/gd_strtok.3
new file mode 100644
index 0000000..9ead5d8
--- /dev/null
+++ b/man/gd_strtok.3
@@ -0,0 +1,97 @@
+.\" gd_strtok.3.  The gd_strtok man page.
+.\"
+.\" Copyright (C) 2012 D. V. Wiebe
+.\"
+.\""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
+.\"
+.\" This file is part of the GetData project.
+.\"
+.\" Permission is granted to copy, distribute and/or modify this document
+.\" under the terms of the GNU Free Documentation License, Version 1.2 or
+.\" any later version published by the Free Software Foundation; with no
+.\" Invariant Sections, with no Front-Cover Texts, and with no Back-Cover
+.\" Texts.  A copy of the license is included in the `COPYING.DOC' file
+.\" as part of this distribution.
+.\"
+.TH gd_strtok 3 "28 June 2012" "Version 0.8.0" "GETDATA"
+.SH NAME
+gd_strtok \(em tokenise a string using the GetData parser
+.SH SYNOPSIS
+.B #include <getdata.h>
+.HP
+.nh
+.ad l
+.BI "char *gd_strtok(DIRFILE *" dirfile ", const char *" string );
+.hy
+.ad n
+.SH DESCRIPTION
+The
+.BR gd_strtok ()
+function parses a string into a series of tokens according to the rules of the
+Dirfile metadata syntax (see dirfile-format(5)).  The first time
+.BR gd_strtok ()
+is called, the string to be parsed should be passed in
+.IR string .
+The first token will be returned.  In subsequent calls to parse the same string,
+.I string
+should be NULL (as with
+.BR strtok (3)).
+Each time 
+.BR gd_strtok ()
+is called like this, the next token is returned.
+
+Operation of the Dirfile tokeniser varies between Dirfile Standards Versions.
+The Standards Version used is the current Version of the loaded DIRFILE
+.IR dirfile .
+Use
+.BR gd_dirfile_standards (3)
+to retrieve or change this value.  Changing the Standards Version of
+.I dirfile
+while parsing a string will affect the parsing of subsequent tokens, but does
+not affect tokens already returned.  A copy of the string is cached in the
+.I dirfile
+object.  Calling
+.BR gd_strtok ()
+with different
+.IR dirfile s
+will parse different strings.
+
+.SH RETURN VALUE
+Upon successful completion,
+.BR gd_strtok ()
+returns a copy of the first token (if
+.I string
+is non-NULL), or the subsequent token.  The token strings returned are each
+allocated with
+.BR malloc (3)
+and should be deallocated by the caller when no longer needed using
+.BR free (3).
+.PP
+If no more tokens are available, or if an error occurred, NULL is returned.
+If an error has occurred, it will also set the dirfile error a non-zero error
+value.  Possible error values are:
+.TP 8
+.B GD_E_ALLOC
+A memory allocation error occurred.
+.TP
+.B GD_E_ARGUMENT
+There was no string to parse (i.e.
+.I string
+was NULL, but no previous call specified a string to parse).
+.TP
+.B GD_E_BAD_DIRFILE
+The supplied dirfile was invalid.
+.TP
+.B GD_E_FORMAT
+A syntax error was found in the string.
+.PP
+The dirfile error may be retrieved by calling
+.BR gd_error (3).
+A descriptive error string for the last error encountered can be obtained from
+a call to
+.BR gd_error_string (3).
+
+.SH SEE ALSO
+.BR gd_dirfile_standards (3),
+.BR gd_open (3),
+.BR dirfile-format (5)
diff --git a/man/gd_tell.3 b/man/gd_tell.3
new file mode 100644
index 0000000..df6fbe1
--- /dev/null
+++ b/man/gd_tell.3
@@ -0,0 +1,110 @@
+.\" gd_getdata.3.  The gd_getdata man page.
+.\"
+.\" Copyright (C) 2011 D. V. Wiebe
+.\"
+.\""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
+.\"
+.\" This file is part of the GetData project.
+.\"
+.\" Permission is granted to copy, distribute and/or modify this document
+.\" under the terms of the GNU Free Documentation License, Version 1.2 or
+.\" any later version published by the Free Software Foundation; with no
+.\" Invariant Sections, with no Front-Cover Texts, and with no Back-Cover
+.\" Texts.  A copy of the license is included in the `COPYING.DOC' file
+.\" as part of this distribution.
+.\"
+.TH gd_tell 3 "14 October 2011" "Version 0.8.0" "GETDATA"
+.SH NAME
+gd_tell \(em reposition a dirfile field pointer
+.SH SYNOPSIS
+.B #include <getdata.h>
+.HP
+.nh
+.ad l
+.BI "off_t gd_tell(DIRFILE *" dirfile ", const char *" field_code );
+.hy
+.ad n
+.SH DESCRIPTION
+The
+.BR gd_tell ()
+function reports the current position of the I/O pointer of the field
+.I field_code
+in the dirfile(5) database specified by
+.IR dirfile .
+.P
+Only
+.B RAW
+fields (and the implicit
+.I INDEX
+field) have field pointers associated with them.  Calling
+.BR gd_tell ()
+on a derived field will report the position of the I/O pointer of the derived
+field only if all of it's inputs are positioned the same.  Otherwise, an error
+results.
+
+.SH RETURN VALUE
+Upon successful completion,
+.BR gd_tell ()
+returns the I/O position of the specified field in samples.  On error, it
+returns -1 and set the dirfile error to a non-zero value.  Possible error values
+are:
+.TP 8
+.B GD_E_ALLOC
+The library was unable to allocate memory.
+.TP
+.B GD_E_BAD_CODE
+The field specified by
+.IR field_code ,
+or one of the fields it uses for input, was not found in the database.
+.TP
+.B GD_E_BAD_DIRFILE
+The supplied dirfile was invalid.
+.TP
+.B GD_E_BAD_REPR
+The representation suffix specified in
+.IR field_code ,
+or in one of the field codes it uses for input, was invalid.
+.TP
+.B GD_E_DIMENSION
+The specified field or one of its inputs wasn't of vector type.
+.TP
+.B GD_E_DOMAIN
+The field position couldn't be determined due to a mismatch in the I/O pointer
+of field reading simultaneously
+from more than one place in an input field.
+.TP
+.B GD_E_INTERNAL_ERROR
+An internal error occurred in the library while trying to perform the task.
+This indicates a bug in the library.  Please report the incident to the
+maintainer.
+.TP
+.B GD_E_RAW_IO
+An error occurred while trying to open or read from a file on disk containing
+a raw field.
+.TP
+.B GD_E_RECURSE_LEVEL
+Too many levels of recursion were encountered while trying to resolve
+.IR field_code .
+This usually indicates a circular dependency in field specification in the
+dirfile.
+.TP
+.B GD_E_UNKNOWN_ENCODING
+The encoding scheme of a RAW field could not be determined.  This may also
+indicate that the binary file associated with the RAW field could not be found.
+.TP
+.B GD_E_UNSUPPORTED
+Reading from dirfiles with the encoding scheme of the specified dirfile is not
+supported by the library.  See
+.BR dirfile-encoding (5)
+for details on dirfile encoding schemes.
+.PP
+The dirfile error may be retrieved by calling
+.BR gd_error (3).
+A descriptive error string for the last error encountered can be obtained from
+a call to
+.BR gd_error_string (3).
+.SH SEE ALSO
+.BR gd_open (3),
+.BR gd_getdata (3),
+.BR gd_putdata (3),
+.BR gd_seek (3).
diff --git a/man/gd_tell64.3 b/man/gd_tell64.3
new file mode 100644
index 0000000..828229a
--- /dev/null
+++ b/man/gd_tell64.3
@@ -0,0 +1,54 @@
+.\" gd_tell64.3.  The gd_tell64 man page.
+.\"
+.\" Copyright (C) 2012 D. V. Wiebe
+.\"
+.\""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
+.\"
+.\" This file is part of the GetData project.
+.\"
+.\" Permission is granted to copy, distribute and/or modify this document
+.\" under the terms of the GNU Free Documentation License, Version 1.2 or
+.\" any later version published by the Free Software Foundation; with no
+.\" Invariant Sections, with no Front-Cover Texts, and with no Back-Cover
+.\" Texts.  A copy of the license is included in the `COPYING.DOC' file
+.\" as part of this distribution.
+.\"
+.TH gd_tell64 3 "25 May 2012" "Version 0.8.0" "GETDATA"
+.SH NAME
+gd_tell64 \(em retrieve data from a dirfile database, with largefile support
+.SH SYNOPSIS
+.B #define GD_64BIT_API
+
+.B #include <getdata.h>
+.HP
+.nh
+.ad l
+.BI "gd_off64_t gd_tell64(DIRFILE *" dirfile ", const char *" field_code );
+.hy
+.ad n
+.SH DESCRIPTION
+This version of
+.BR gd_tell (3)
+uses a 64-bit offset type
+.RB ( gd_off64_t ),
+where one is available, regardless of the size of
+.BR off_t .
+It is only available if one defines
+.IR GD_64BIT_API
+or
+.IR _LARGEFILE64_SOURCE
+before including getdata.h.
+
+If
+.I off_t
+is a 64-bit type (possibly because
+.I _FILE_OFFSET_BITS
+has been defined to 64), this function will the same as
+.BR gd_tell (3).
+Otherwise,
+.BR gd_tell (3)
+will be a version of this function which uses a 32-bit
+.IR off_t .
+.SH SEE ALSO
+.BR gd_tell (3),
+.BR feature_test_macros (7)
diff --git a/man/gd_validate.3 b/man/gd_validate.3
index f3dfe66..07081fa 100644
--- a/man/gd_validate.3
+++ b/man/gd_validate.3
@@ -1,6 +1,6 @@
 .\" gd_validate.3.  The gd_validate man page.
 .\"
-.\" Copyright (C) 2009, 2010 D. V. Wiebe
+.\" Copyright (C) 2009, 2010, 2011 D. V. Wiebe
 .\"
 .\""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
 .\"
@@ -13,7 +13,7 @@
 .\" Texts.  A copy of the license is included in the `COPYING.DOC' file
 .\" as part of this distribution.
 .\"
-.TH gd_validate 3 "3 November 2010" "Version 0.7.0" "GETDATA"
+.TH gd_validate 3 "19 August 2011" "Version 0.8.0" "GETDATA"
 .SH NAME
 gd_validate \(em check a dirfile field code for validity
 .SH SYNOPSIS
@@ -71,12 +71,6 @@ field.
 .TP
 .B GD_E_DIMENSION
 A scalar field was found where a vector field was expected.
-.TP
-.B GD_E_RECURSE_LEVEL
-Too many levels of recursion were encountered while trying to resolve
-.IR field_code .
-This usually indicates a circular dependency in field specification in the
-dirfile.
 .PP
 The dirfile error may be retrieved by calling
 .BR gd_error (3).
diff --git a/man/gd_verbose_prefix.3 b/man/gd_verbose_prefix.3
new file mode 100644
index 0000000..017084b
--- /dev/null
+++ b/man/gd_verbose_prefix.3
@@ -0,0 +1,82 @@
+.\" gd_verbose_prefix.3.  The gd_verbose_prefix man page.
+.\"
+.\" Copyright (C) 2012 D. V. Wiebe
+.\"
+.\""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
+.\"
+.\" This file is part of the GetData project.
+.\"
+.\" Permission is granted to copy, distribute and/or modify this document
+.\" under the terms of the GNU Free Documentation License, Version 1.2 or
+.\" any later version published by the Free Software Foundation; with no
+.\" Invariant Sections, with no Front-Cover Texts, and with no Back-Cover
+.\" Texts.  A copy of the license is included in the `COPYING.DOC' file
+.\" as part of this distribution.
+.\"
+.TH gd_verbose_prefix 3 "1 April 2012" "Version 0.8.0" "GETDATA"
+.SH NAME
+gd_verbose_prefix \(em set the prefix on error messages printed by GetData
+.SH SYNOPSIS
+.B #include <getdata.h>
+.HP
+.nh
+.ad l
+.BI "int gd_verbose_prefix(DIRFILE *" dirfile ", const char *" prefix );
+.hy
+.ad n
+.SH DESCRIPTION
+The
+.BR gd_verbose_prefix ()
+sets the prefix printed before error messages output by the GetData library
+for the dirfile(5) database specified by
+.IR dirfile .
+If
+.I prefix
+is NULL, the current prefix (if any) is deleted and no new prefix is saved.
+
+GetData only prints error messages for a given Dirfile if opened along with the
+.B GD_VERBOSE
+flag, or if the flag has been subsequently set on the dirfile using
+.BR gd_flags (3).
+If this flag is not set, this function still updates the prefix, but GetData
+does not use it.
+.PP
+If
+.B GD_VERBOSE
+is set, when the library encounters an error, it prints the supplied prefix (if
+any), followed immediately by the error message (which is the message returned
+by
+.BR gd_error_string (3)),
+followed by a newline.  All output goes to the standard error I/O stream
+.RB ( stderr (3))
+of the caller.
+
+The 
+.I dirfile
+argument must point to a valid DIRFILE object previously created by a call to
+.BR gd_open (3).
+
+.SH RETURN VALUE
+Upon successful completion,
+.BR gd_verbose_prefix ()
+returns the zero.  On error, it returns -1 and sets the dirfile error
+to a non-zero error value.  Possible error values are:
+.TP
+.B GD_E_ALLOC
+The library was unable to allocate memory.
+.TP
+.B GD_E_BAD_DIRFILE
+The supplied dirfile was invalid.
+.PP
+The dirfile error may be retrieved by calling
+.BR gd_error (3).
+A descriptive error string for the last error encountered can be obtained from
+a call to
+.BR gd_error_string (3).
+.SH SEE ALSO
+.BR dirfile (5),
+.BR gd_flags (3),
+.BR gd_open (3),
+.BR gd_error (3),
+.BR gd_error_string (3),
+.BR stderr (3).
diff --git a/missing b/missing
index 28055d2..86a8fc3 100755
--- a/missing
+++ b/missing
@@ -1,10 +1,10 @@
 #! /bin/sh
 # Common stub for a few missing GNU programs while installing.
 
-scriptversion=2009-04-28.21; # UTC
+scriptversion=2012-01-06.13; # UTC
 
 # Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003, 2004, 2005, 2006,
-# 2008, 2009 Free Software Foundation, Inc.
+# 2008, 2009, 2010, 2011, 2012 Free Software Foundation, Inc.
 # Originally by Fran,cois Pinard <pinard at iro.umontreal.ca>, 1996.
 
 # This program is free software; you can redistribute it and/or modify
@@ -84,7 +84,6 @@ Supported PROGRAM values:
   help2man     touch the output file
   lex          create \`lex.yy.c', if possible, from existing .c
   makeinfo     touch the output file
-  tar          try tar, gnutar, gtar, then tar without non-portable flags
   yacc         create \`y.tab.[ch]', if possible, from existing .[ch]
 
 Version suffixes to PROGRAM as well as the prefixes \`gnu-', \`gnu', and
@@ -122,15 +121,6 @@ case $1 in
     # Not GNU programs, they don't have --version.
     ;;
 
-  tar*)
-    if test -n "$run"; then
-       echo 1>&2 "ERROR: \`tar' requires --run"
-       exit 1
-    elif test "x$2" = "x--version" || test "x$2" = "x--help"; then
-       exit 1
-    fi
-    ;;
-
   *)
     if test -z "$run" && ($1 --version) > /dev/null 2>&1; then
        # We have it, but it failed.
@@ -226,7 +216,7 @@ WARNING: \`$1' $msg.  You should only need it if
          \`Bison' from any GNU archive site."
     rm -f y.tab.c y.tab.h
     if test $# -ne 1; then
-        eval LASTARG="\${$#}"
+        eval LASTARG=\${$#}
 	case $LASTARG in
 	*.y)
 	    SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'`
@@ -256,7 +246,7 @@ WARNING: \`$1' is $msg.  You should only need it if
          \`Flex' from any GNU archive site."
     rm -f lex.yy.c
     if test $# -ne 1; then
-        eval LASTARG="\${$#}"
+        eval LASTARG=\${$#}
 	case $LASTARG in
 	*.l)
 	    SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'`
@@ -318,41 +308,6 @@ WARNING: \`$1' is $msg.  You should only need it if
     touch $file
     ;;
 
-  tar*)
-    shift
-
-    # We have already tried tar in the generic part.
-    # Look for gnutar/gtar before invocation to avoid ugly error
-    # messages.
-    if (gnutar --version > /dev/null 2>&1); then
-       gnutar "$@" && exit 0
-    fi
-    if (gtar --version > /dev/null 2>&1); then
-       gtar "$@" && exit 0
-    fi
-    firstarg="$1"
-    if shift; then
-	case $firstarg in
-	*o*)
-	    firstarg=`echo "$firstarg" | sed s/o//`
-	    tar "$firstarg" "$@" && exit 0
-	    ;;
-	esac
-	case $firstarg in
-	*h*)
-	    firstarg=`echo "$firstarg" | sed s/h//`
-	    tar "$firstarg" "$@" && exit 0
-	    ;;
-	esac
-    fi
-
-    echo 1>&2 "\
-WARNING: I can't seem to be able to run \`tar' with the given arguments.
-         You may want to install GNU tar or Free paxutils, or check the
-         command line arguments."
-    exit 1
-    ;;
-
   *)
     echo 1>&2 "\
 WARNING: \`$1' is needed, and is $msg.
diff --git a/src/Makefile.am b/src/Makefile.am
index e368196..b4bae92 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -64,14 +64,33 @@ LZMA_C=lzma.c
 endif
 endif
 
+if USE_ZZIP
+if USE_MODULES
+LIBGETDATAZZIP_LA=libgetdatazzip.la
+DLOPEN_LIBGETDATAZZIP_LA=-dlopen libgetdatazzip.la
+else
+ZZIP_C=zzip.c
+endif
+endif
+
+if USE_ZZSLIM
+if USE_MODULES
+LIBGETDATAZZSLIM_LA=libgetdatazzslim.la
+DLOPEN_LIBGETDATAZZSLIM_LA=-dlopen libgetdatazzslim.la
+else
+ZZSLIM_C=zzslim.c
+endif
+endif
+
 if USE_MODULES
 EXPORT_DYNAMIC=-export-dynamic
 DGETDATA_MODULEDIR=-DGETDATA_MODULEDIR="\"$(moduledir)\""
 else
 EXTERNAL_CPPFLAGS=$(SLIM_CPPFLAGS) $(GZIP_CPPFLAGS) $(BZIP2_CPPFLAGS) \
-									$(LZMA_CPPFLAGS)
+									$(LZMA_CPPFLAGS) $(ZZIP_CPPFLAGS)
 EXTERNAL_LDFLAGS=$(SLIM_LDFLAGS) $(GZIP_LDFLAGS) $(BZIP2_LDFLAGS) \
-								 $(LZMA_LDFLAGS)
+								 $(LZMA_LDFLAGS) $(ZZIP_LDFLAGS)
+EXTERNAL_LIBS=$(SLIM_LIBS) $(GZIP_LIBS) $(BZIP2_LIBS) $(LZMA_LIBS) $(ZZIP_LIBS)
 endif
 
 if INCLUDE_LEGACY_API
@@ -102,42 +121,57 @@ pkgconfig_DATA = getdata.pc
 
 lib_LTLIBRARIES = libgetdata.la
 module_LTLIBRARIES = ${LIBGETDATASLIM_LA} ${LIBGETDATAGZIP_LA} \
-									${LIBGETDATABZIP2_LA} ${LIBGETDATALZMA_LA}
+									${LIBGETDATABZIP2_LA} ${LIBGETDATALZMA_LA} \
+									${LIBGETDATAZZIP_LA} ${LIBGETDATAZZSLIM_LA}
 libgetdata_la_SOURCES = add.c ascii.c ${BZIP2_C} close.c common.c compat.c \
 												constant.c ${DEBUG_C} del.c encoding.c endian.c \
-												entry.c errors.c field_list.c flimits.c flush.c \
+												entry.c errors.c field_list.c flimits.c flush.c fpos.c \
 												fragment.c getdata.c globals.c ${GZIP_C} index.c \
-												include.c ${LEGACY_C} ${LZMA_C} meta_list.c mod.c \
-												move.c name.c native.c nfields.c nframes.c nmeta.c \
-												open.c parse.c protect.c putdata.c raw.c ${SLIM_C} \
-												spf.c string.c types.c ${GETDATA_LEGACY_H} internal.h \
+												include.c ${LEGACY_C} ${LZMA_C} mod.c move.c name.c \
+												native.c nfields.c nframes.c open.c parse.c protect.c \
+												putdata.c raw.c sie.c ${SLIM_C} spf.c string.c types.c \
+												${ZZIP_C} ${ZZSLIM_C} ${GETDATA_LEGACY_H} internal.h \
 												nan.h
 libgetdata_la_LDFLAGS = $(EXPORT_DYNAMIC) -export-symbols-regex '^[^_]' \
 												-version-info \
 												${GETDATA_IFACE_VERSION}:${GETDATA_IMPL_REVISION}:${GETDATA_IFACE_AGE} \
-												$(EXTERNAL_LDFLAGS)
+												$(EXTERNAL_LDFLAGS) $(EXTERNAL_LIBS)
 libgetdata_la_LIBADD = $(LIBLTDL) $(DLOPEN_LIBGETDATASLIM_LA) \
-											 $(DLOPEN_LIBGETDATAGZIP_LA) \
-											 $(DLOPEN_LIBGETDATABZIP2_LA) $(DLOPEN_LIBGETDATALZMA_LA)
+											 $(DLOPEN_LIBGETDATAGZIP_LA) 
+											 $(DLOPEN_LIBGETDATABZIP2_LA) \
+											 $(DLOPEN_LIBGETDATALZMA_LA) $(DLOPEN_LIBGETDATAZZIP_LA) \
+											 $(DLOPEN_LIBGETDATAZZSLIM_LA)
 
-libgetdataslim_la_SOURCES = slim.c ${DEBUG_C}
+libgetdataslim_la_SOURCES = slim.c
 libgetdataslim_la_LDFLAGS = $(SLIM_LDFLAGS) -release $(PACKAGE_VERSION) \
-														-module
+														-module $(SLIM_LIBS)
 libgetdataslim_la_CPPFLAGS = $(AM_CPPFLAGS) $(SLIM_CPPFLAGS)
 
-libgetdatagzip_la_SOURCES = gzip.c ${DEBUG_C}
-libgetdatagzip_la_LDFLAGS = $(GZIP_LDFLAGS) -release $(PACKAGE_VERSION) -module
+libgetdatagzip_la_SOURCES = gzip.c
+libgetdatagzip_la_LDFLAGS = $(GZIP_LDFLAGS) -release $(PACKAGE_VERSION) \
+														-module $(GZIP_LIBS)
 libgetdatagzip_la_CPPFLAGS = $(AM_CPPFLAGS) $(GZIP_CPPFLAGS)
 
-libgetdatabzip2_la_SOURCES = bzip.c ${DEBUG_C}
+libgetdatabzip2_la_SOURCES = bzip.c
 libgetdatabzip2_la_LDFLAGS = $(BZIP2_LDFLAGS) -release $(PACKAGE_VERSION) \
-														 -module
+														 -module $(BZIP2_LIBS)
 libgetdatabzip2_la_CPPFLAGS = $(AM_CPPFLAGS) $(BZIP2_CPPFLAGS)
 
-libgetdatalzma_la_SOURCES = lzma.c ${DEBUG_C}
+libgetdatalzma_la_SOURCES = lzma.c
 libgetdatalzma_la_LDFLAGS = $(LZMA_LDFLAGS) -release $(PACKAGE_VERSION) \
-														 -module
+														 -module $(LZMA_LIBS)
 libgetdatalzma_la_CPPFLAGS = $(AM_CPPFLAGS) $(LZMA_CPPFLAGS)
 
+libgetdatazzip_la_SOURCES = zzip.c
+libgetdatazzip_la_LDFLAGS = $(ZZIP_LDFLAGS) -release $(PACKAGE_VERSION) \
+														 -module $(ZZIP_LIBS)
+libgetdatazzip_la_CPPFLAGS = $(AM_CPPFLAGS) $(ZZIP_CPPFLAGS)
+
+libgetdatazzslim_la_SOURCES = zzslim.c
+libgetdatazzslim_la_LDFLAGS = $(SLIM_LDFLAGS) $(ZZIP_LDFLAGS) \
+														-release $(PACKAGE_VERSION) -module \
+														$(SLIM_LIBS) $(ZZIP_LIBS)
+libgetdatazzslim_la_CPPFLAGS = $(AM_CPPFLAGS) $(SLIM_CPPFLAGS) $(ZZIP_CPPFLAGS)
+
 clean-local:
 	rm -rf *~ getdata.pc
diff --git a/src/Makefile.in b/src/Makefile.in
index 8560856..9094759 100644
--- a/src/Makefile.in
+++ b/src/Makefile.in
@@ -1,9 +1,9 @@
-# Makefile.in generated by automake 1.11.1 from Makefile.am.
+# Makefile.in generated by automake 1.11.5 from Makefile.am.
 # @configure_input@
 
 # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005, 2006, 2007, 2008, 2009  Free Software Foundation,
-# Inc.
+# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software
+# Foundation, Inc.
 # This Makefile.in is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
@@ -18,6 +18,23 @@
 
 
 VPATH = @srcdir@
+am__make_dryrun = \
+  { \
+    am__dry=no; \
+    case $$MAKEFLAGS in \
+      *\\[\ \	]*) \
+        echo 'am--echo: ; @echo "AM"  OK' | $(MAKE) -f - 2>/dev/null \
+          | grep '^AM OK$$' >/dev/null || am__dry=yes;; \
+      *) \
+        for am__flg in $$MAKEFLAGS; do \
+          case $$am__flg in \
+            *=*|--*) ;; \
+            *n*) am__dry=yes; break;; \
+          esac; \
+        done;; \
+    esac; \
+    test $$am__dry = yes; \
+  }
 pkgdatadir = $(datadir)/@PACKAGE@
 pkgincludedir = $(includedir)/@PACKAGE@
 pkglibdir = $(libdir)/@PACKAGE@
@@ -38,20 +55,22 @@ build_triplet = @build@
 host_triplet = @host@
 subdir = src
 DIST_COMMON = $(am__include_HEADERS_DIST) $(srcdir)/Makefile.am \
-	$(srcdir)/Makefile.in $(srcdir)/config.h.in \
+	$(srcdir)/Makefile.in $(srcdir)/gd_config.h.in \
 	$(srcdir)/getdata.h.in $(srcdir)/getdata.pc.in
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
 am__aclocal_m4_deps = $(top_srcdir)/m4/ax_compare_version.m4 \
 	$(top_srcdir)/m4/compiler.m4 $(top_srcdir)/m4/encoding.m4 \
-	$(top_srcdir)/m4/idl.m4 $(top_srcdir)/m4/libtool.m4 \
-	$(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \
-	$(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \
-	$(top_srcdir)/m4/python.m4 $(top_srcdir)/m4/win32.m4 \
-	$(top_srcdir)/m4/version.m4 $(top_srcdir)/configure.ac
+	$(top_srcdir)/m4/floatordering.m4 $(top_srcdir)/m4/idl.m4 \
+	$(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \
+	$(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \
+	$(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/m4/matlab.m4 \
+	$(top_srcdir)/m4/perl.m4 $(top_srcdir)/m4/python.m4 \
+	$(top_srcdir)/m4/win32.m4 $(top_srcdir)/m4/version.m4 \
+	$(top_srcdir)/configure.ac
 am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
 	$(ACLOCAL_M4)
 mkinstalldirs = $(install_sh) -d
-CONFIG_HEADER = config.h getdata.h
+CONFIG_HEADER = gd_config.h getdata.h
 CONFIG_CLEAN_FILES = getdata.ah getdata.pc
 CONFIG_CLEAN_VPATH_FILES =
 am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
@@ -75,6 +94,12 @@ am__nobase_list = $(am__nobase_strip_setup); \
 am__base_list = \
   sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \
   sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
+am__uninstall_files_from_dir = { \
+  test -z "$$files" \
+    || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \
+    || { echo " ( cd '$$dir' && rm -f" $$files ")"; \
+         $(am__cd) "$$dir" && rm -f $$files; }; \
+  }
 am__installdirs = "$(DESTDIR)$(libdir)" "$(DESTDIR)$(moduledir)" \
 	"$(DESTDIR)$(pkgconfigdir)" "$(DESTDIR)$(includedir)" \
 	"$(DESTDIR)$(includedir)"
@@ -84,45 +109,39 @@ am__DEPENDENCIES_1 =
 @USE_MODULES_TRUE@@USE_SLIM_TRUE@	libgetdataslim.la
 @USE_GZIP_TRUE@@USE_MODULES_TRUE at am__DEPENDENCIES_3 =  \
 @USE_GZIP_TRUE@@USE_MODULES_TRUE@	libgetdatagzip.la
- at USE_BZIP2_TRUE@@USE_MODULES_TRUE at am__DEPENDENCIES_4 =  \
- at USE_BZIP2_TRUE@@USE_MODULES_TRUE@	libgetdatabzip2.la
- at USE_LZMA_TRUE@@USE_MODULES_TRUE at am__DEPENDENCIES_5 =  \
- at USE_LZMA_TRUE@@USE_MODULES_TRUE@	libgetdatalzma.la
 libgetdata_la_DEPENDENCIES = $(am__DEPENDENCIES_1) \
-	$(am__DEPENDENCIES_2) $(am__DEPENDENCIES_3) \
-	$(am__DEPENDENCIES_4) $(am__DEPENDENCIES_5)
+	$(am__DEPENDENCIES_2) $(am__DEPENDENCIES_3)
 am__libgetdata_la_SOURCES_DIST = add.c ascii.c bzip.c close.c common.c \
 	compat.c constant.c debug.c del.c encoding.c endian.c entry.c \
-	errors.c field_list.c flimits.c flush.c fragment.c getdata.c \
-	globals.c gzip.c index.c include.c legacy.c lzma.c meta_list.c \
-	mod.c move.c name.c native.c nfields.c nframes.c nmeta.c \
-	open.c parse.c protect.c putdata.c raw.c slim.c spf.c string.c \
-	types.c getdata_legacy.h internal.h nan.h
+	errors.c field_list.c flimits.c flush.c fpos.c fragment.c \
+	getdata.c globals.c gzip.c index.c include.c legacy.c lzma.c \
+	mod.c move.c name.c native.c nfields.c nframes.c open.c \
+	parse.c protect.c putdata.c raw.c sie.c slim.c spf.c string.c \
+	types.c zzip.c zzslim.c getdata_legacy.h internal.h nan.h
 @USE_BZIP2_TRUE@@USE_MODULES_FALSE at am__objects_1 = bzip.lo
 @GETDATA_DEBUG_TRUE at am__objects_2 = debug.lo
 @USE_GZIP_TRUE@@USE_MODULES_FALSE at am__objects_3 = gzip.lo
 @INCLUDE_LEGACY_API_TRUE at am__objects_4 = legacy.lo
 @USE_LZMA_TRUE@@USE_MODULES_FALSE at am__objects_5 = lzma.lo
 @USE_MODULES_FALSE@@USE_SLIM_TRUE at am__objects_6 = slim.lo
-am__objects_7 =
+ at USE_MODULES_FALSE@@USE_ZZIP_TRUE at am__objects_7 = zzip.lo
+ at USE_MODULES_FALSE@@USE_ZZSLIM_TRUE at am__objects_8 = zzslim.lo
+am__objects_9 =
 am_libgetdata_la_OBJECTS = add.lo ascii.lo $(am__objects_1) close.lo \
 	common.lo compat.lo constant.lo $(am__objects_2) del.lo \
 	encoding.lo endian.lo entry.lo errors.lo field_list.lo \
-	flimits.lo flush.lo fragment.lo getdata.lo globals.lo \
+	flimits.lo flush.lo fpos.lo fragment.lo getdata.lo globals.lo \
 	$(am__objects_3) index.lo include.lo $(am__objects_4) \
-	$(am__objects_5) meta_list.lo mod.lo move.lo name.lo native.lo \
-	nfields.lo nframes.lo nmeta.lo open.lo parse.lo protect.lo \
-	putdata.lo raw.lo $(am__objects_6) spf.lo string.lo types.lo \
-	$(am__objects_7)
+	$(am__objects_5) mod.lo move.lo name.lo native.lo nfields.lo \
+	nframes.lo open.lo parse.lo protect.lo putdata.lo raw.lo \
+	sie.lo $(am__objects_6) spf.lo string.lo types.lo \
+	$(am__objects_7) $(am__objects_8) $(am__objects_9)
 libgetdata_la_OBJECTS = $(am_libgetdata_la_OBJECTS)
 libgetdata_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
 	$(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
 	$(libgetdata_la_LDFLAGS) $(LDFLAGS) -o $@
 libgetdatabzip2_la_LIBADD =
-am__libgetdatabzip2_la_SOURCES_DIST = bzip.c debug.c
- at GETDATA_DEBUG_TRUE@am__objects_8 = libgetdatabzip2_la-debug.lo
-am_libgetdatabzip2_la_OBJECTS = libgetdatabzip2_la-bzip.lo \
-	$(am__objects_8)
+am_libgetdatabzip2_la_OBJECTS = libgetdatabzip2_la-bzip.lo
 libgetdatabzip2_la_OBJECTS = $(am_libgetdatabzip2_la_OBJECTS)
 libgetdatabzip2_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
 	$(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
@@ -130,10 +149,7 @@ libgetdatabzip2_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
 @USE_BZIP2_TRUE@@USE_MODULES_TRUE at am_libgetdatabzip2_la_rpath =  \
 @USE_BZIP2_TRUE@@USE_MODULES_TRUE@	-rpath $(moduledir)
 libgetdatagzip_la_LIBADD =
-am__libgetdatagzip_la_SOURCES_DIST = gzip.c debug.c
- at GETDATA_DEBUG_TRUE@am__objects_9 = libgetdatagzip_la-debug.lo
-am_libgetdatagzip_la_OBJECTS = libgetdatagzip_la-gzip.lo \
-	$(am__objects_9)
+am_libgetdatagzip_la_OBJECTS = libgetdatagzip_la-gzip.lo
 libgetdatagzip_la_OBJECTS = $(am_libgetdatagzip_la_OBJECTS)
 libgetdatagzip_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
 	$(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
@@ -141,10 +157,7 @@ libgetdatagzip_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
 @USE_GZIP_TRUE@@USE_MODULES_TRUE at am_libgetdatagzip_la_rpath = -rpath \
 @USE_GZIP_TRUE@@USE_MODULES_TRUE@	$(moduledir)
 libgetdatalzma_la_LIBADD =
-am__libgetdatalzma_la_SOURCES_DIST = lzma.c debug.c
- at GETDATA_DEBUG_TRUE@am__objects_10 = libgetdatalzma_la-debug.lo
-am_libgetdatalzma_la_OBJECTS = libgetdatalzma_la-lzma.lo \
-	$(am__objects_10)
+am_libgetdatalzma_la_OBJECTS = libgetdatalzma_la-lzma.lo
 libgetdatalzma_la_OBJECTS = $(am_libgetdatalzma_la_OBJECTS)
 libgetdatalzma_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
 	$(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
@@ -152,16 +165,29 @@ libgetdatalzma_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
 @USE_LZMA_TRUE@@USE_MODULES_TRUE at am_libgetdatalzma_la_rpath = -rpath \
 @USE_LZMA_TRUE@@USE_MODULES_TRUE@	$(moduledir)
 libgetdataslim_la_LIBADD =
-am__libgetdataslim_la_SOURCES_DIST = slim.c debug.c
- at GETDATA_DEBUG_TRUE@am__objects_11 = libgetdataslim_la-debug.lo
-am_libgetdataslim_la_OBJECTS = libgetdataslim_la-slim.lo \
-	$(am__objects_11)
+am_libgetdataslim_la_OBJECTS = libgetdataslim_la-slim.lo
 libgetdataslim_la_OBJECTS = $(am_libgetdataslim_la_OBJECTS)
 libgetdataslim_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
 	$(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
 	$(libgetdataslim_la_LDFLAGS) $(LDFLAGS) -o $@
 @USE_MODULES_TRUE@@USE_SLIM_TRUE at am_libgetdataslim_la_rpath = -rpath \
 @USE_MODULES_TRUE@@USE_SLIM_TRUE@	$(moduledir)
+libgetdatazzip_la_LIBADD =
+am_libgetdatazzip_la_OBJECTS = libgetdatazzip_la-zzip.lo
+libgetdatazzip_la_OBJECTS = $(am_libgetdatazzip_la_OBJECTS)
+libgetdatazzip_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
+	$(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
+	$(libgetdatazzip_la_LDFLAGS) $(LDFLAGS) -o $@
+ at USE_MODULES_TRUE@@USE_ZZIP_TRUE at am_libgetdatazzip_la_rpath = -rpath \
+ at USE_MODULES_TRUE@@USE_ZZIP_TRUE@	$(moduledir)
+libgetdatazzslim_la_LIBADD =
+am_libgetdatazzslim_la_OBJECTS = libgetdatazzslim_la-zzslim.lo
+libgetdatazzslim_la_OBJECTS = $(am_libgetdatazzslim_la_OBJECTS)
+libgetdatazzslim_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
+	$(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
+	$(libgetdatazzslim_la_LDFLAGS) $(LDFLAGS) -o $@
+ at USE_MODULES_TRUE@@USE_ZZSLIM_TRUE at am_libgetdatazzslim_la_rpath =  \
+ at USE_MODULES_TRUE@@USE_ZZSLIM_TRUE@	-rpath $(moduledir)
 DEFAULT_INCLUDES = -I. at am__isrc@
 depcomp = $(SHELL) $(top_srcdir)/depcomp
 am__depfiles_maybe = depfiles
@@ -177,12 +203,17 @@ LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
 	$(LDFLAGS) -o $@
 SOURCES = $(libgetdata_la_SOURCES) $(libgetdatabzip2_la_SOURCES) \
 	$(libgetdatagzip_la_SOURCES) $(libgetdatalzma_la_SOURCES) \
-	$(libgetdataslim_la_SOURCES)
+	$(libgetdataslim_la_SOURCES) $(libgetdatazzip_la_SOURCES) \
+	$(libgetdatazzslim_la_SOURCES)
 DIST_SOURCES = $(am__libgetdata_la_SOURCES_DIST) \
-	$(am__libgetdatabzip2_la_SOURCES_DIST) \
-	$(am__libgetdatagzip_la_SOURCES_DIST) \
-	$(am__libgetdatalzma_la_SOURCES_DIST) \
-	$(am__libgetdataslim_la_SOURCES_DIST)
+	$(libgetdatabzip2_la_SOURCES) $(libgetdatagzip_la_SOURCES) \
+	$(libgetdatalzma_la_SOURCES) $(libgetdataslim_la_SOURCES) \
+	$(libgetdatazzip_la_SOURCES) $(libgetdatazzslim_la_SOURCES)
+am__can_run_installinfo = \
+  case $$AM_UPDATE_INFO_DIR in \
+    n|no|NO) false;; \
+    *) (install-info --version) >/dev/null 2>&1;; \
+  esac
 DATA = $(pkgconfig_DATA)
 am__include_HEADERS_DIST = getdata_legacy.h
 HEADERS = $(include_HEADERS) $(nodist_include_HEADERS)
@@ -197,10 +228,13 @@ AUTOHEADER = @AUTOHEADER@
 AUTOMAKE = @AUTOMAKE@
 AWK = @AWK@
 BUILDCC = @BUILDCC@
-BUILD_DATE = @BUILD_DATE@
 BZIP2_CPPFLAGS = @BZIP2_CPPFLAGS@
 BZIP2_LDFLAGS = @BZIP2_LDFLAGS@
+BZIP2_LIBS = @BZIP2_LIBS@
 CC = @CC@
+CCAS = @CCAS@
+CCASDEPMODE = @CCASDEPMODE@
+CCASFLAGS = @CCASFLAGS@
 CCDEPMODE = @CCDEPMODE@
 CFLAGS = @CFLAGS@
 CPP = @CPP@
@@ -216,6 +250,7 @@ DEFINE_GD_NO_C99_API = @DEFINE_GD_NO_C99_API@
 DEFINE_gd_int16_t = @DEFINE_gd_int16_t@
 DEFINE_gd_int64_t = @DEFINE_gd_int64_t@
 DEFINE_gd_uint16_t = @DEFINE_gd_uint16_t@
+DEFINE_gd_uint64_t = @DEFINE_gd_uint64_t@
 DEFS = @DEFS@
 DEPDIR = @DEPDIR@
 DIFF = @DIFF@
@@ -236,13 +271,21 @@ FFLAGS = @FFLAGS@
 FGETDATA_VERSION = @FGETDATA_VERSION@
 FGREP = @FGREP@
 FLIBS = @FLIBS@
+GD_DIRSEP = @GD_DIRSEP@
+GD_FDIRSEP = @GD_FDIRSEP@
 GETDATAXX_VERSION = @GETDATAXX_VERSION@
+GETDATA_DEBUG = @GETDATA_DEBUG@
 GETDATA_IFACE_AGE = @GETDATA_IFACE_AGE@
 GETDATA_IFACE_VERSION = @GETDATA_IFACE_VERSION@
 GETDATA_IMPL_REVISION = @GETDATA_IMPL_REVISION@
+GETDATA_MAJOR = @GETDATA_MAJOR@
+GETDATA_MINOR = @GETDATA_MINOR@
+GETDATA_REVISION = @GETDATA_REVISION@
+GETDATA_VERSION_SUFFIX = @GETDATA_VERSION_SUFFIX@
 GREP = @GREP@
 GZIP_CPPFLAGS = @GZIP_CPPFLAGS@
 GZIP_LDFLAGS = @GZIP_LDFLAGS@
+GZIP_LIBS = @GZIP_LIBS@
 IDL = @IDL@
 IDL_CFLAGS = @IDL_CFLAGS@
 IDL_LIBS = @IDL_LIBS@
@@ -265,8 +308,13 @@ LTDLINCL = @LTDLINCL@
 LTLIBOBJS = @LTLIBOBJS@
 LZMA_CPPFLAGS = @LZMA_CPPFLAGS@
 LZMA_LDFLAGS = @LZMA_LDFLAGS@
+LZMA_LIBS = @LZMA_LIBS@
 MAKEINFO = @MAKEINFO@
 MANIFEST_TOOL = @MANIFEST_TOOL@
+MATLAB = @MATLAB@
+MATLABGETDATA_VERSION = @MATLABGETDATA_VERSION@
+MATLAB_CPPFLAGS = @MATLAB_CPPFLAGS@
+MEX = @MEX@
 MKDIR_P = @MKDIR_P@
 NM = @NM@
 NMEDIT = @NMEDIT@
@@ -283,6 +331,9 @@ PACKAGE_TARNAME = @PACKAGE_TARNAME@
 PACKAGE_URL = @PACKAGE_URL@
 PACKAGE_VERSION = @PACKAGE_VERSION@
 PATH_SEPARATOR = @PATH_SEPARATOR@
+PERL = @PERL@
+PERL_MAN3EXT = @PERL_MAN3EXT@
+PRINTF = @PRINTF@
 PRIVATE_LIBS = @PRIVATE_LIBS@
 PYTHON = @PYTHON@
 PYTHON_CPPFLAGS = @PYTHON_CPPFLAGS@
@@ -294,8 +345,12 @@ SET_MAKE = @SET_MAKE@
 SHELL = @SHELL@
 SLIM_CPPFLAGS = @SLIM_CPPFLAGS@
 SLIM_LDFLAGS = @SLIM_LDFLAGS@
+SLIM_LIBS = @SLIM_LIBS@
 STRIP = @STRIP@
 VERSION = @VERSION@
+ZZIP_CPPFLAGS = @ZZIP_CPPFLAGS@
+ZZIP_LDFLAGS = @ZZIP_LDFLAGS@
+ZZIP_LIBS = @ZZIP_LIBS@
 abs_builddir = @abs_builddir@
 abs_srcdir = @abs_srcdir@
 abs_top_builddir = @abs_top_builddir@
@@ -339,6 +394,8 @@ libexecdir = @libexecdir@
 localedir = @localedir@
 localstatedir = @localstatedir@
 mandir = @mandir@
+matlabbasedir = @matlabbasedir@
+mexext = @mexext@
 mkdir_p = @mkdir_p@
 moduledir = @moduledir@
 oldincludedir = @oldincludedir@
@@ -348,8 +405,12 @@ path_gunzip = @path_gunzip@
 path_gzip = @path_gzip@
 path_slim = @path_slim@
 path_unslim = @path_unslim@
+path_unzip = @path_unzip@
 path_xz = @path_xz@
+path_zip = @path_zip@
 pdfdir = @pdfdir@
+perldir = @perldir@
+perlmandir = @perlmandir@
 prefix = @prefix@
 program_transform_name = @program_transform_name@
 psdir = @psdir@
@@ -398,14 +459,21 @@ AUTOMAKE_OPTIONS = foreign
 @USE_LZMA_TRUE@@USE_MODULES_TRUE at LIBGETDATALZMA_LA = libgetdatalzma.la
 @USE_LZMA_TRUE@@USE_MODULES_TRUE at DLOPEN_LIBGETDATALZMA_LA = -dlopen libgetdatalzma.la
 @USE_LZMA_TRUE@@USE_MODULES_FALSE at LZMA_C = lzma.c
+ at USE_MODULES_TRUE@@USE_ZZIP_TRUE at LIBGETDATAZZIP_LA = libgetdatazzip.la
+ at USE_MODULES_TRUE@@USE_ZZIP_TRUE at DLOPEN_LIBGETDATAZZIP_LA = -dlopen libgetdatazzip.la
+ at USE_MODULES_FALSE@@USE_ZZIP_TRUE at ZZIP_C = zzip.c
+ at USE_MODULES_TRUE@@USE_ZZSLIM_TRUE at LIBGETDATAZZSLIM_LA = libgetdatazzslim.la
+ at USE_MODULES_TRUE@@USE_ZZSLIM_TRUE at DLOPEN_LIBGETDATAZZSLIM_LA = -dlopen libgetdatazzslim.la
+ at USE_MODULES_FALSE@@USE_ZZSLIM_TRUE at ZZSLIM_C = zzslim.c
 @USE_MODULES_TRUE at EXPORT_DYNAMIC = -export-dynamic
 @USE_MODULES_TRUE at DGETDATA_MODULEDIR = -DGETDATA_MODULEDIR="\"$(moduledir)\""
 @USE_MODULES_FALSE at EXTERNAL_CPPFLAGS = $(SLIM_CPPFLAGS) $(GZIP_CPPFLAGS) $(BZIP2_CPPFLAGS) \
- at USE_MODULES_FALSE@									$(LZMA_CPPFLAGS)
+ at USE_MODULES_FALSE@									$(LZMA_CPPFLAGS) $(ZZIP_CPPFLAGS)
 
 @USE_MODULES_FALSE at EXTERNAL_LDFLAGS = $(SLIM_LDFLAGS) $(GZIP_LDFLAGS) $(BZIP2_LDFLAGS) \
- at USE_MODULES_FALSE@								 $(LZMA_LDFLAGS)
+ at USE_MODULES_FALSE@								 $(LZMA_LDFLAGS) $(ZZIP_LDFLAGS)
 
+ at USE_MODULES_FALSE@EXTERNAL_LIBS = $(SLIM_LIBS) $(GZIP_LIBS) $(BZIP2_LIBS) $(LZMA_LIBS) $(ZZIP_LIBS)
 @INCLUDE_LEGACY_API_TRUE at LEGACY_C = legacy.c
 @INCLUDE_LEGACY_API_TRUE at GETDATA_LEGACY_H = getdata_legacy.h
 @GETDATA_DEBUG_TRUE at DEBUG_C = debug.c
@@ -418,46 +486,59 @@ include_HEADERS = ${GETDATA_LEGACY_H}
 pkgconfig_DATA = getdata.pc
 lib_LTLIBRARIES = libgetdata.la
 module_LTLIBRARIES = ${LIBGETDATASLIM_LA} ${LIBGETDATAGZIP_LA} \
-									${LIBGETDATABZIP2_LA} ${LIBGETDATALZMA_LA}
+									${LIBGETDATABZIP2_LA} ${LIBGETDATALZMA_LA} \
+									${LIBGETDATAZZIP_LA} ${LIBGETDATAZZSLIM_LA}
 
 libgetdata_la_SOURCES = add.c ascii.c ${BZIP2_C} close.c common.c compat.c \
 												constant.c ${DEBUG_C} del.c encoding.c endian.c \
-												entry.c errors.c field_list.c flimits.c flush.c \
+												entry.c errors.c field_list.c flimits.c flush.c fpos.c \
 												fragment.c getdata.c globals.c ${GZIP_C} index.c \
-												include.c ${LEGACY_C} ${LZMA_C} meta_list.c mod.c \
-												move.c name.c native.c nfields.c nframes.c nmeta.c \
-												open.c parse.c protect.c putdata.c raw.c ${SLIM_C} \
-												spf.c string.c types.c ${GETDATA_LEGACY_H} internal.h \
+												include.c ${LEGACY_C} ${LZMA_C} mod.c move.c name.c \
+												native.c nfields.c nframes.c open.c parse.c protect.c \
+												putdata.c raw.c sie.c ${SLIM_C} spf.c string.c types.c \
+												${ZZIP_C} ${ZZSLIM_C} ${GETDATA_LEGACY_H} internal.h \
 												nan.h
 
 libgetdata_la_LDFLAGS = $(EXPORT_DYNAMIC) -export-symbols-regex '^[^_]' \
 												-version-info \
 												${GETDATA_IFACE_VERSION}:${GETDATA_IMPL_REVISION}:${GETDATA_IFACE_AGE} \
-												$(EXTERNAL_LDFLAGS)
+												$(EXTERNAL_LDFLAGS) $(EXTERNAL_LIBS)
 
 libgetdata_la_LIBADD = $(LIBLTDL) $(DLOPEN_LIBGETDATASLIM_LA) \
-											 $(DLOPEN_LIBGETDATAGZIP_LA) \
-											 $(DLOPEN_LIBGETDATABZIP2_LA) $(DLOPEN_LIBGETDATALZMA_LA)
+											 $(DLOPEN_LIBGETDATAGZIP_LA) 
 
-libgetdataslim_la_SOURCES = slim.c ${DEBUG_C}
+libgetdataslim_la_SOURCES = slim.c
 libgetdataslim_la_LDFLAGS = $(SLIM_LDFLAGS) -release $(PACKAGE_VERSION) \
-														-module
+														-module $(SLIM_LIBS)
 
 libgetdataslim_la_CPPFLAGS = $(AM_CPPFLAGS) $(SLIM_CPPFLAGS)
-libgetdatagzip_la_SOURCES = gzip.c ${DEBUG_C}
-libgetdatagzip_la_LDFLAGS = $(GZIP_LDFLAGS) -release $(PACKAGE_VERSION) -module
+libgetdatagzip_la_SOURCES = gzip.c
+libgetdatagzip_la_LDFLAGS = $(GZIP_LDFLAGS) -release $(PACKAGE_VERSION) \
+														-module $(GZIP_LIBS)
+
 libgetdatagzip_la_CPPFLAGS = $(AM_CPPFLAGS) $(GZIP_CPPFLAGS)
-libgetdatabzip2_la_SOURCES = bzip.c ${DEBUG_C}
+libgetdatabzip2_la_SOURCES = bzip.c
 libgetdatabzip2_la_LDFLAGS = $(BZIP2_LDFLAGS) -release $(PACKAGE_VERSION) \
-														 -module
+														 -module $(BZIP2_LIBS)
 
 libgetdatabzip2_la_CPPFLAGS = $(AM_CPPFLAGS) $(BZIP2_CPPFLAGS)
-libgetdatalzma_la_SOURCES = lzma.c ${DEBUG_C}
+libgetdatalzma_la_SOURCES = lzma.c
 libgetdatalzma_la_LDFLAGS = $(LZMA_LDFLAGS) -release $(PACKAGE_VERSION) \
-														 -module
+														 -module $(LZMA_LIBS)
 
 libgetdatalzma_la_CPPFLAGS = $(AM_CPPFLAGS) $(LZMA_CPPFLAGS)
-all: $(BUILT_SOURCES) config.h getdata.h
+libgetdatazzip_la_SOURCES = zzip.c
+libgetdatazzip_la_LDFLAGS = $(ZZIP_LDFLAGS) -release $(PACKAGE_VERSION) \
+														 -module $(ZZIP_LIBS)
+
+libgetdatazzip_la_CPPFLAGS = $(AM_CPPFLAGS) $(ZZIP_CPPFLAGS)
+libgetdatazzslim_la_SOURCES = zzslim.c
+libgetdatazzslim_la_LDFLAGS = $(SLIM_LDFLAGS) $(ZZIP_LDFLAGS) \
+														-release $(PACKAGE_VERSION) -module \
+														$(SLIM_LIBS) $(ZZIP_LIBS)
+
+libgetdatazzslim_la_CPPFLAGS = $(AM_CPPFLAGS) $(SLIM_CPPFLAGS) $(ZZIP_CPPFLAGS)
+all: $(BUILT_SOURCES) gd_config.h getdata.h
 	$(MAKE) $(AM_MAKEFLAGS) all-am
 
 .SUFFIXES:
@@ -493,39 +574,34 @@ $(ACLOCAL_M4):  $(am__aclocal_m4_deps)
 	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
 $(am__aclocal_m4_deps):
 
-config.h: stamp-h1
-	@if test ! -f $@; then \
-	  rm -f stamp-h1; \
-	  $(MAKE) $(AM_MAKEFLAGS) stamp-h1; \
-	else :; fi
+gd_config.h: stamp-h1
+	@if test ! -f $@; then rm -f stamp-h1; else :; fi
+	@if test ! -f $@; then $(MAKE) $(AM_MAKEFLAGS) stamp-h1; else :; fi
 
-stamp-h1: $(srcdir)/config.h.in $(top_builddir)/config.status
+stamp-h1: $(srcdir)/gd_config.h.in $(top_builddir)/config.status
 	@rm -f stamp-h1
-	cd $(top_builddir) && $(SHELL) ./config.status src/config.h
-$(srcdir)/config.h.in:  $(am__configure_deps) 
+	cd $(top_builddir) && $(SHELL) ./config.status src/gd_config.h
+$(srcdir)/gd_config.h.in:  $(am__configure_deps) 
 	($(am__cd) $(top_srcdir) && $(AUTOHEADER))
 	rm -f stamp-h1
 	touch $@
 
 getdata.h: stamp-h2
-	@if test ! -f $@; then \
-	  rm -f stamp-h2; \
-	  $(MAKE) $(AM_MAKEFLAGS) stamp-h2; \
-	else :; fi
+	@if test ! -f $@; then rm -f stamp-h2; else :; fi
+	@if test ! -f $@; then $(MAKE) $(AM_MAKEFLAGS) stamp-h2; else :; fi
 
 stamp-h2: getdata.ah $(top_builddir)/config.status
 	@rm -f stamp-h2
 	cd $(top_builddir) && $(SHELL) ./config.status src/getdata.h
 
 distclean-hdr:
-	-rm -f config.h stamp-h1 getdata.h stamp-h2
+	-rm -f gd_config.h stamp-h1 getdata.h stamp-h2
 getdata.ah: $(top_builddir)/config.status $(srcdir)/getdata.h.in
 	cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@
 getdata.pc: $(top_builddir)/config.status $(srcdir)/getdata.pc.in
 	cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@
 install-libLTLIBRARIES: $(lib_LTLIBRARIES)
 	@$(NORMAL_INSTALL)
-	test -z "$(libdir)" || $(MKDIR_P) "$(DESTDIR)$(libdir)"
 	@list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \
 	list2=; for p in $$list; do \
 	  if test -f $$p; then \
@@ -533,6 +609,8 @@ install-libLTLIBRARIES: $(lib_LTLIBRARIES)
 	  else :; fi; \
 	done; \
 	test -z "$$list2" || { \
+	  echo " $(MKDIR_P) '$(DESTDIR)$(libdir)'"; \
+	  $(MKDIR_P) "$(DESTDIR)$(libdir)" || exit 1; \
 	  echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(libdir)'"; \
 	  $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(libdir)"; \
 	}
@@ -556,7 +634,6 @@ clean-libLTLIBRARIES:
 	done
 install-moduleLTLIBRARIES: $(module_LTLIBRARIES)
 	@$(NORMAL_INSTALL)
-	test -z "$(moduledir)" || $(MKDIR_P) "$(DESTDIR)$(moduledir)"
 	@list='$(module_LTLIBRARIES)'; test -n "$(moduledir)" || list=; \
 	list2=; for p in $$list; do \
 	  if test -f $$p; then \
@@ -564,6 +641,8 @@ install-moduleLTLIBRARIES: $(module_LTLIBRARIES)
 	  else :; fi; \
 	done; \
 	test -z "$$list2" || { \
+	  echo " $(MKDIR_P) '$(DESTDIR)$(moduledir)'"; \
+	  $(MKDIR_P) "$(DESTDIR)$(moduledir)" || exit 1; \
 	  echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(moduledir)'"; \
 	  $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(moduledir)"; \
 	}
@@ -585,16 +664,20 @@ clean-moduleLTLIBRARIES:
 	  echo "rm -f \"$${dir}/so_locations\""; \
 	  rm -f "$${dir}/so_locations"; \
 	done
-libgetdata.la: $(libgetdata_la_OBJECTS) $(libgetdata_la_DEPENDENCIES) 
+libgetdata.la: $(libgetdata_la_OBJECTS) $(libgetdata_la_DEPENDENCIES) $(EXTRA_libgetdata_la_DEPENDENCIES) 
 	$(libgetdata_la_LINK) -rpath $(libdir) $(libgetdata_la_OBJECTS) $(libgetdata_la_LIBADD) $(LIBS)
-libgetdatabzip2.la: $(libgetdatabzip2_la_OBJECTS) $(libgetdatabzip2_la_DEPENDENCIES) 
+libgetdatabzip2.la: $(libgetdatabzip2_la_OBJECTS) $(libgetdatabzip2_la_DEPENDENCIES) $(EXTRA_libgetdatabzip2_la_DEPENDENCIES) 
 	$(libgetdatabzip2_la_LINK) $(am_libgetdatabzip2_la_rpath) $(libgetdatabzip2_la_OBJECTS) $(libgetdatabzip2_la_LIBADD) $(LIBS)
-libgetdatagzip.la: $(libgetdatagzip_la_OBJECTS) $(libgetdatagzip_la_DEPENDENCIES) 
+libgetdatagzip.la: $(libgetdatagzip_la_OBJECTS) $(libgetdatagzip_la_DEPENDENCIES) $(EXTRA_libgetdatagzip_la_DEPENDENCIES) 
 	$(libgetdatagzip_la_LINK) $(am_libgetdatagzip_la_rpath) $(libgetdatagzip_la_OBJECTS) $(libgetdatagzip_la_LIBADD) $(LIBS)
-libgetdatalzma.la: $(libgetdatalzma_la_OBJECTS) $(libgetdatalzma_la_DEPENDENCIES) 
+libgetdatalzma.la: $(libgetdatalzma_la_OBJECTS) $(libgetdatalzma_la_DEPENDENCIES) $(EXTRA_libgetdatalzma_la_DEPENDENCIES) 
 	$(libgetdatalzma_la_LINK) $(am_libgetdatalzma_la_rpath) $(libgetdatalzma_la_OBJECTS) $(libgetdatalzma_la_LIBADD) $(LIBS)
-libgetdataslim.la: $(libgetdataslim_la_OBJECTS) $(libgetdataslim_la_DEPENDENCIES) 
+libgetdataslim.la: $(libgetdataslim_la_OBJECTS) $(libgetdataslim_la_DEPENDENCIES) $(EXTRA_libgetdataslim_la_DEPENDENCIES) 
 	$(libgetdataslim_la_LINK) $(am_libgetdataslim_la_rpath) $(libgetdataslim_la_OBJECTS) $(libgetdataslim_la_LIBADD) $(LIBS)
+libgetdatazzip.la: $(libgetdatazzip_la_OBJECTS) $(libgetdatazzip_la_DEPENDENCIES) $(EXTRA_libgetdatazzip_la_DEPENDENCIES) 
+	$(libgetdatazzip_la_LINK) $(am_libgetdatazzip_la_rpath) $(libgetdatazzip_la_OBJECTS) $(libgetdatazzip_la_LIBADD) $(LIBS)
+libgetdatazzslim.la: $(libgetdatazzslim_la_OBJECTS) $(libgetdatazzslim_la_DEPENDENCIES) $(EXTRA_libgetdatazzslim_la_DEPENDENCIES) 
+	$(libgetdatazzslim_la_LINK) $(am_libgetdatazzslim_la_rpath) $(libgetdatazzslim_la_OBJECTS) $(libgetdatazzslim_la_LIBADD) $(LIBS)
 
 mostlyclean-compile:
 	-rm -f *.$(OBJEXT)
@@ -618,6 +701,7 @@ distclean-compile:
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/field_list.Plo at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/flimits.Plo at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/flush.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/fpos.Plo at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/fragment.Plo at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/getdata.Plo at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/globals.Plo at am__quote@
@@ -626,31 +710,30 @@ distclean-compile:
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/index.Plo at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/legacy.Plo at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libgetdatabzip2_la-bzip.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libgetdatabzip2_la-debug.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libgetdatagzip_la-debug.Plo at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libgetdatagzip_la-gzip.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libgetdatalzma_la-debug.Plo at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libgetdatalzma_la-lzma.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libgetdataslim_la-debug.Plo at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libgetdataslim_la-slim.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libgetdatazzip_la-zzip.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libgetdatazzslim_la-zzslim.Plo at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/lzma.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/meta_list.Plo at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/mod.Plo at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/move.Plo at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/name.Plo at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/native.Plo at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/nfields.Plo at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/nframes.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/nmeta.Plo at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/open.Plo at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/parse.Plo at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/protect.Plo at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/putdata.Plo at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/raw.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/sie.Plo at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/slim.Plo at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/spf.Plo at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/string.Plo at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/types.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/zzip.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/zzslim.Plo at am__quote@
 
 .c.o:
 @am__fastdepCC_TRUE@	$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
@@ -680,13 +763,6 @@ libgetdatabzip2_la-bzip.lo: bzip.c
 @AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCC_FALSE@	$(LIBTOOL)  --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgetdatabzip2_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libgetdatabzip2_la-bzip.lo `test -f 'bzip.c' || echo '$(srcdir)/'`bzip.c
 
-libgetdatabzip2_la-debug.lo: debug.c
- at am__fastdepCC_TRUE@	$(LIBTOOL)  --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgetdatabzip2_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libgetdatabzip2_la-debug.lo -MD -MP -MF $(DEPDIR)/libgetdatabzip2_la-debug.Tpo -c -o libgetdatabzip2_la-debug.lo `test -f 'debug.c' || echo '$(srcdir)/'`debug.c
- at am__fastdepCC_TRUE@	$(am__mv) $(DEPDIR)/libgetdatabzip2_la-debug.Tpo $(DEPDIR)/libgetdatabzip2_la-debug.Plo
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	source='debug.c' object='libgetdatabzip2_la-debug.lo' libtool=yes @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCC_FALSE@	$(LIBTOOL)  --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgetdatabzip2_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libgetdatabzip2_la-debug.lo `test -f 'debug.c' || echo '$(srcdir)/'`debug.c
-
 libgetdatagzip_la-gzip.lo: gzip.c
 @am__fastdepCC_TRUE@	$(LIBTOOL)  --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgetdatagzip_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libgetdatagzip_la-gzip.lo -MD -MP -MF $(DEPDIR)/libgetdatagzip_la-gzip.Tpo -c -o libgetdatagzip_la-gzip.lo `test -f 'gzip.c' || echo '$(srcdir)/'`gzip.c
 @am__fastdepCC_TRUE@	$(am__mv) $(DEPDIR)/libgetdatagzip_la-gzip.Tpo $(DEPDIR)/libgetdatagzip_la-gzip.Plo
@@ -694,13 +770,6 @@ libgetdatagzip_la-gzip.lo: gzip.c
 @AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCC_FALSE@	$(LIBTOOL)  --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgetdatagzip_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libgetdatagzip_la-gzip.lo `test -f 'gzip.c' || echo '$(srcdir)/'`gzip.c
 
-libgetdatagzip_la-debug.lo: debug.c
- at am__fastdepCC_TRUE@	$(LIBTOOL)  --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgetdatagzip_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libgetdatagzip_la-debug.lo -MD -MP -MF $(DEPDIR)/libgetdatagzip_la-debug.Tpo -c -o libgetdatagzip_la-debug.lo `test -f 'debug.c' || echo '$(srcdir)/'`debug.c
- at am__fastdepCC_TRUE@	$(am__mv) $(DEPDIR)/libgetdatagzip_la-debug.Tpo $(DEPDIR)/libgetdatagzip_la-debug.Plo
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	source='debug.c' object='libgetdatagzip_la-debug.lo' libtool=yes @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCC_FALSE@	$(LIBTOOL)  --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgetdatagzip_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libgetdatagzip_la-debug.lo `test -f 'debug.c' || echo '$(srcdir)/'`debug.c
-
 libgetdatalzma_la-lzma.lo: lzma.c
 @am__fastdepCC_TRUE@	$(LIBTOOL)  --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgetdatalzma_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libgetdatalzma_la-lzma.lo -MD -MP -MF $(DEPDIR)/libgetdatalzma_la-lzma.Tpo -c -o libgetdatalzma_la-lzma.lo `test -f 'lzma.c' || echo '$(srcdir)/'`lzma.c
 @am__fastdepCC_TRUE@	$(am__mv) $(DEPDIR)/libgetdatalzma_la-lzma.Tpo $(DEPDIR)/libgetdatalzma_la-lzma.Plo
@@ -708,13 +777,6 @@ libgetdatalzma_la-lzma.lo: lzma.c
 @AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCC_FALSE@	$(LIBTOOL)  --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgetdatalzma_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libgetdatalzma_la-lzma.lo `test -f 'lzma.c' || echo '$(srcdir)/'`lzma.c
 
-libgetdatalzma_la-debug.lo: debug.c
- at am__fastdepCC_TRUE@	$(LIBTOOL)  --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgetdatalzma_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libgetdatalzma_la-debug.lo -MD -MP -MF $(DEPDIR)/libgetdatalzma_la-debug.Tpo -c -o libgetdatalzma_la-debug.lo `test -f 'debug.c' || echo '$(srcdir)/'`debug.c
- at am__fastdepCC_TRUE@	$(am__mv) $(DEPDIR)/libgetdatalzma_la-debug.Tpo $(DEPDIR)/libgetdatalzma_la-debug.Plo
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	source='debug.c' object='libgetdatalzma_la-debug.lo' libtool=yes @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCC_FALSE@	$(LIBTOOL)  --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgetdatalzma_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libgetdatalzma_la-debug.lo `test -f 'debug.c' || echo '$(srcdir)/'`debug.c
-
 libgetdataslim_la-slim.lo: slim.c
 @am__fastdepCC_TRUE@	$(LIBTOOL)  --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgetdataslim_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libgetdataslim_la-slim.lo -MD -MP -MF $(DEPDIR)/libgetdataslim_la-slim.Tpo -c -o libgetdataslim_la-slim.lo `test -f 'slim.c' || echo '$(srcdir)/'`slim.c
 @am__fastdepCC_TRUE@	$(am__mv) $(DEPDIR)/libgetdataslim_la-slim.Tpo $(DEPDIR)/libgetdataslim_la-slim.Plo
@@ -722,12 +784,19 @@ libgetdataslim_la-slim.lo: slim.c
 @AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCC_FALSE@	$(LIBTOOL)  --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgetdataslim_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libgetdataslim_la-slim.lo `test -f 'slim.c' || echo '$(srcdir)/'`slim.c
 
-libgetdataslim_la-debug.lo: debug.c
- at am__fastdepCC_TRUE@	$(LIBTOOL)  --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgetdataslim_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libgetdataslim_la-debug.lo -MD -MP -MF $(DEPDIR)/libgetdataslim_la-debug.Tpo -c -o libgetdataslim_la-debug.lo `test -f 'debug.c' || echo '$(srcdir)/'`debug.c
- at am__fastdepCC_TRUE@	$(am__mv) $(DEPDIR)/libgetdataslim_la-debug.Tpo $(DEPDIR)/libgetdataslim_la-debug.Plo
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	source='debug.c' object='libgetdataslim_la-debug.lo' libtool=yes @AMDEPBACKSLASH@
+libgetdatazzip_la-zzip.lo: zzip.c
+ at am__fastdepCC_TRUE@	$(LIBTOOL)  --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgetdatazzip_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libgetdatazzip_la-zzip.lo -MD -MP -MF $(DEPDIR)/libgetdatazzip_la-zzip.Tpo -c -o libgetdatazzip_la-zzip.lo `test -f 'zzip.c' || echo '$(srcdir)/'`zzip.c
+ at am__fastdepCC_TRUE@	$(am__mv) $(DEPDIR)/libgetdatazzip_la-zzip.Tpo $(DEPDIR)/libgetdatazzip_la-zzip.Plo
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@	source='zzip.c' object='libgetdatazzip_la-zzip.lo' libtool=yes @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCC_FALSE@	$(LIBTOOL)  --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgetdataslim_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libgetdataslim_la-debug.lo `test -f 'debug.c' || echo '$(srcdir)/'`debug.c
+ at am__fastdepCC_FALSE@	$(LIBTOOL)  --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgetdatazzip_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libgetdatazzip_la-zzip.lo `test -f 'zzip.c' || echo '$(srcdir)/'`zzip.c
+
+libgetdatazzslim_la-zzslim.lo: zzslim.c
+ at am__fastdepCC_TRUE@	$(LIBTOOL)  --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgetdatazzslim_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libgetdatazzslim_la-zzslim.lo -MD -MP -MF $(DEPDIR)/libgetdatazzslim_la-zzslim.Tpo -c -o libgetdatazzslim_la-zzslim.lo `test -f 'zzslim.c' || echo '$(srcdir)/'`zzslim.c
+ at am__fastdepCC_TRUE@	$(am__mv) $(DEPDIR)/libgetdatazzslim_la-zzslim.Tpo $(DEPDIR)/libgetdatazzslim_la-zzslim.Plo
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@	source='zzslim.c' object='libgetdatazzslim_la-zzslim.lo' libtool=yes @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCC_FALSE@	$(LIBTOOL)  --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgetdatazzslim_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libgetdatazzslim_la-zzslim.lo `test -f 'zzslim.c' || echo '$(srcdir)/'`zzslim.c
 
 mostlyclean-libtool:
 	-rm -f *.lo
@@ -736,8 +805,11 @@ clean-libtool:
 	-rm -rf .libs _libs
 install-pkgconfigDATA: $(pkgconfig_DATA)
 	@$(NORMAL_INSTALL)
-	test -z "$(pkgconfigdir)" || $(MKDIR_P) "$(DESTDIR)$(pkgconfigdir)"
 	@list='$(pkgconfig_DATA)'; test -n "$(pkgconfigdir)" || list=; \
+	if test -n "$$list"; then \
+	  echo " $(MKDIR_P) '$(DESTDIR)$(pkgconfigdir)'"; \
+	  $(MKDIR_P) "$(DESTDIR)$(pkgconfigdir)" || exit 1; \
+	fi; \
 	for p in $$list; do \
 	  if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
 	  echo "$$d$$p"; \
@@ -751,13 +823,14 @@ uninstall-pkgconfigDATA:
 	@$(NORMAL_UNINSTALL)
 	@list='$(pkgconfig_DATA)'; test -n "$(pkgconfigdir)" || list=; \
 	files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \
-	test -n "$$files" || exit 0; \
-	echo " ( cd '$(DESTDIR)$(pkgconfigdir)' && rm -f" $$files ")"; \
-	cd "$(DESTDIR)$(pkgconfigdir)" && rm -f $$files
+	dir='$(DESTDIR)$(pkgconfigdir)'; $(am__uninstall_files_from_dir)
 install-includeHEADERS: $(include_HEADERS)
 	@$(NORMAL_INSTALL)
-	test -z "$(includedir)" || $(MKDIR_P) "$(DESTDIR)$(includedir)"
 	@list='$(include_HEADERS)'; test -n "$(includedir)" || list=; \
+	if test -n "$$list"; then \
+	  echo " $(MKDIR_P) '$(DESTDIR)$(includedir)'"; \
+	  $(MKDIR_P) "$(DESTDIR)$(includedir)" || exit 1; \
+	fi; \
 	for p in $$list; do \
 	  if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
 	  echo "$$d$$p"; \
@@ -771,13 +844,14 @@ uninstall-includeHEADERS:
 	@$(NORMAL_UNINSTALL)
 	@list='$(include_HEADERS)'; test -n "$(includedir)" || list=; \
 	files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \
-	test -n "$$files" || exit 0; \
-	echo " ( cd '$(DESTDIR)$(includedir)' && rm -f" $$files ")"; \
-	cd "$(DESTDIR)$(includedir)" && rm -f $$files
+	dir='$(DESTDIR)$(includedir)'; $(am__uninstall_files_from_dir)
 install-nodist_includeHEADERS: $(nodist_include_HEADERS)
 	@$(NORMAL_INSTALL)
-	test -z "$(includedir)" || $(MKDIR_P) "$(DESTDIR)$(includedir)"
 	@list='$(nodist_include_HEADERS)'; test -n "$(includedir)" || list=; \
+	if test -n "$$list"; then \
+	  echo " $(MKDIR_P) '$(DESTDIR)$(includedir)'"; \
+	  $(MKDIR_P) "$(DESTDIR)$(includedir)" || exit 1; \
+	fi; \
 	for p in $$list; do \
 	  if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
 	  echo "$$d$$p"; \
@@ -791,9 +865,7 @@ uninstall-nodist_includeHEADERS:
 	@$(NORMAL_UNINSTALL)
 	@list='$(nodist_include_HEADERS)'; test -n "$(includedir)" || list=; \
 	files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \
-	test -n "$$files" || exit 0; \
-	echo " ( cd '$(DESTDIR)$(includedir)' && rm -f" $$files ")"; \
-	cd "$(DESTDIR)$(includedir)" && rm -f $$files
+	dir='$(DESTDIR)$(includedir)'; $(am__uninstall_files_from_dir)
 
 ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
 	list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
@@ -805,11 +877,11 @@ ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
 	mkid -fID $$unique
 tags: TAGS
 
-TAGS:  $(HEADERS) $(SOURCES) config.h.in getdata.ah $(TAGS_DEPENDENCIES) \
+TAGS:  $(HEADERS) $(SOURCES) gd_config.h.in getdata.ah $(TAGS_DEPENDENCIES) \
 		$(TAGS_FILES) $(LISP)
 	set x; \
 	here=`pwd`; \
-	list='$(SOURCES) $(HEADERS) config.h.in getdata.ah $(LISP) $(TAGS_FILES)'; \
+	list='$(SOURCES) $(HEADERS) gd_config.h.in getdata.ah $(LISP) $(TAGS_FILES)'; \
 	unique=`for i in $$list; do \
 	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
 	  done | \
@@ -827,9 +899,9 @@ TAGS:  $(HEADERS) $(SOURCES) config.h.in getdata.ah $(TAGS_DEPENDENCIES) \
 	  fi; \
 	fi
 ctags: CTAGS
-CTAGS:  $(HEADERS) $(SOURCES) config.h.in getdata.ah $(TAGS_DEPENDENCIES) \
+CTAGS:  $(HEADERS) $(SOURCES) gd_config.h.in getdata.ah $(TAGS_DEPENDENCIES) \
 		$(TAGS_FILES) $(LISP)
-	list='$(SOURCES) $(HEADERS) config.h.in getdata.ah $(LISP) $(TAGS_FILES)'; \
+	list='$(SOURCES) $(HEADERS) gd_config.h.in getdata.ah $(LISP) $(TAGS_FILES)'; \
 	unique=`for i in $$list; do \
 	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
 	  done | \
@@ -880,7 +952,8 @@ distdir: $(DISTFILES)
 check-am: all-am
 check: $(BUILT_SOURCES)
 	$(MAKE) $(AM_MAKEFLAGS) check-am
-all-am: Makefile $(LTLIBRARIES) $(DATA) $(HEADERS) config.h getdata.h
+all-am: Makefile $(LTLIBRARIES) $(DATA) $(HEADERS) gd_config.h \
+		getdata.h
 installdirs:
 	for dir in "$(DESTDIR)$(libdir)" "$(DESTDIR)$(moduledir)" "$(DESTDIR)$(pkgconfigdir)" "$(DESTDIR)$(includedir)" "$(DESTDIR)$(includedir)"; do \
 	  test -z "$$dir" || $(MKDIR_P) "$$dir"; \
@@ -896,10 +969,15 @@ install-am: all-am
 
 installcheck: installcheck-am
 install-strip:
-	$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
-	  install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
-	  `test -z '$(STRIP)' || \
-	    echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+	if test -z '$(STRIP)'; then \
+	  $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+	    install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+	      install; \
+	else \
+	  $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+	    install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+	    "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
+	fi
 mostlyclean-generic:
 
 clean-generic:
@@ -1020,6 +1098,9 @@ uninstall-am: uninstall-includeHEADERS uninstall-libLTLIBRARIES \
 
 @INCLUDE_LEGACY_API_TRUE at uninstall-hook:
 @INCLUDE_LEGACY_API_TRUE@	cd $(DESTDIR)$(includedir) && rm -rf getdata_struct.h
+											 $(DLOPEN_LIBGETDATABZIP2_LA) \
+											 $(DLOPEN_LIBGETDATALZMA_LA) $(DLOPEN_LIBGETDATAZZIP_LA) \
+											 $(DLOPEN_LIBGETDATAZZSLIM_LA)
 
 clean-local:
 	rm -rf *~ getdata.pc
diff --git a/src/add.c b/src/add.c
index 0237f3b..7d8d332 100644
--- a/src/add.c
+++ b/src/add.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2010 D. V. Wiebe
+/* Copyright (C) 2008-2012 D. V. Wiebe
  *
  ***************************************************************************
  *
@@ -20,28 +20,88 @@
  */
 #include "internal.h"
 
-#ifdef STDC_HEADERS
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-#include <errno.h>
-#endif
+int _GD_InvalidEntype(gd_entype_t t) {
+  dtrace("0x%X", t);
 
-#ifdef HAVE_LIBGEN_H
-#include <libgen.h>
-#endif
+  if (t != GD_RAW_ENTRY && t != GD_LINCOM_ENTRY && t != GD_LINTERP_ENTRY &&
+      t != GD_BIT_ENTRY && t != GD_MULTIPLY_ENTRY && t != GD_PHASE_ENTRY &&
+      t != GD_CONST_ENTRY && t != GD_POLYNOM_ENTRY && t != GD_SBIT_ENTRY &&
+      t != GD_DIVIDE_ENTRY && t != GD_RECIP_ENTRY && t != GD_WINDOW_ENTRY &&
+      t != GD_MPLEX_ENTRY && t != GD_CARRAY_ENTRY && t != GD_STRING_ENTRY)
+  {
+    dreturn("%i", -1);
+    return -1;
+  }
 
-/* add an entry */
-static int _GD_Add(DIRFILE* D, const gd_entry_t* entry, const char* parent)
+  dreturn("%i", 0);
+  return 0;
+}
+
+static gd_entry_t *_GD_FixName(DIRFILE *restrict D, char **restrict buffer,
+    const char *name, int frag, int *restrict offset)
 {
-  char temp_buffer[FILENAME_MAX];
-  int i, is_dot;
+  gd_entry_t *P;
+  char *ptr;
+
+  dtrace("%p, %p, \"%s\", %i, %p", D, buffer, name, frag, offset);
+
+  /* Check prefix and suffix */
+  if (_GD_CheckCodeAffixes(D, NULL, name, frag)) {
+    dreturn("%p", NULL);
+    return NULL;
+  }
+    
+  *buffer = ptr = _GD_Strdup(D, name);
+
+  if (ptr == NULL) {
+    free(ptr);
+    dreturn("%p", NULL);
+    return NULL;
+  }
+
+  P = _GD_CheckParent(D, &ptr, -1, 0);
+
+  if (D->error) {
+    free(*buffer);
+    dreturn("%p", NULL);
+    return NULL;
+  }
+
+  if (P) {
+    char *temp2;
+    /* make the new name -- this may be different because P may have been
+     * dealiased */
+
+    *offset = strlen(P->field) + 1;
+    temp2 = (char*)_GD_Malloc(D, *offset + strlen(ptr) + 1);
+    if (temp2 == NULL) {
+      free(*buffer);
+      dreturn("%p", NULL);
+      return NULL;
+    }
+
+    sprintf(temp2, "%s/%s", P->field, ptr);
+    free(*buffer);
+    *buffer = temp2;
+  } else
+    *offset = 0;
+
+  dreturn("%p (\"%s\", %i)", P, *buffer, *offset);
+  return P;
+}
+
+/* add an entry - returns the added entry on success. */
+static gd_entry_t *_GD_Add(DIRFILE *restrict D,
+    const gd_entry_t *restrict entry, const char *restrict parent)
+{
+  char *temp_buffer;
+  int i, is_dot, offset;
   int copy_scalar[GD_MAX_POLYORD + 1];
-  void* new_list;
-  void* new_ref = NULL;
+  void *new_list;
+  void *new_ref = NULL;
   unsigned int u;
-  gd_entry_t* E;
-  gd_entry_t* P = NULL;
+  gd_entry_t *E;
+  gd_entry_t *P = NULL;
 
   dtrace("%p, %p, \"%s\"", D, entry, parent);
 
@@ -52,83 +112,81 @@ static int _GD_Add(DIRFILE* D, const gd_entry_t* entry, const char* parent)
   /* check access mode */
   if ((D->flags & GD_ACCMODE) == GD_RDONLY) {
     _GD_SetError(D, GD_E_ACCMODE, 0, NULL, 0, NULL);
-    dreturn("%i", -1);
-    return -1;
+    dreturn("%p", NULL);
+    return NULL;
   }
 
   /* check for include index out of range */
-  if (P == NULL && (entry->fragment_index < 0 ||
+  if (parent == NULL && (entry->fragment_index < 0 ||
         entry->fragment_index >= D->n_fragment))
   {
     _GD_SetError(D, GD_E_BAD_INDEX, 0, NULL, entry->fragment_index, NULL);
-    dreturn("%i", -1);
-    return -1;
-  }
-
-  /* check protection */
-  if (D->fragment[entry->fragment_index].protection & GD_PROTECT_FORMAT) {
-    _GD_SetError(D, GD_E_PROTECTED, GD_E_PROTECTED_FORMAT, NULL, 0,
-        D->fragment[entry->fragment_index].cname);
-    dreturn("%i", -1);
-    return -1;
+    dreturn("%p", NULL);
+    return NULL;
   }
 
   /* check parent */
   if (parent != NULL) {
+    P = _GD_FindField(D, parent, D->entry, D->n_entries, 1, NULL);
+    if (P == NULL) {
+      _GD_SetError(D, GD_E_BAD_CODE, GD_E_CODE_MISSING, NULL, 0, parent);
+      dreturn("%p", NULL);
+      return NULL;
+    }
+
     /* make sure it's not a meta field already */
-    if (strchr(parent, '/') != NULL) {
-      _GD_SetError(D, GD_E_BAD_CODE, 0, NULL, 0, parent);
-      dreturn("%i", -1);
-      return -1;
+    if (P->e->n_meta == -1) {
+      _GD_SetError(D, GD_E_BAD_CODE, GD_E_CODE_INVALID, NULL, 0, parent);
+      dreturn("%p", NULL);
+      return NULL;
     }
 
-    P = _GD_FindField(D, parent, D->entry, D->n_entries, NULL);
-    if (P == NULL) {
-      _GD_SetError(D, GD_E_BAD_CODE, 0, NULL, 0, parent);
-      dreturn("%i", -1);
-      return -1;
+    /* make name */
+    offset = strlen(parent) + 1;
+    temp_buffer = (char *)_GD_Malloc(D, offset + strlen(entry->field) + 1);
+
+    if (temp_buffer == NULL) {
+      dreturn("%p", NULL);
+      return NULL;
     }
 
-    snprintf(temp_buffer, FILENAME_MAX, "%s/%s", parent, entry->field);
-  } else
-    snprintf(temp_buffer, FILENAME_MAX, "%s", entry->field);
+    strcpy(temp_buffer, parent);
+    temp_buffer[offset - 1] = '/';
+    strcpy(temp_buffer + offset, entry->field);
+  } else {
+    /* this will check for affixes and take care of detecting Barth-style
+     * metafield definitions */
+    P = _GD_FixName(D, &temp_buffer, entry->field, entry->fragment_index,
+        &offset);
+
+    if (D->error) {
+      dreturn("%p", NULL);
+      return NULL;
+    }
+  }
 
   /* check for duplicate field */
-  E = _GD_FindField(D, temp_buffer, D->entry, D->n_entries, &u);
-
-  if (E != NULL) { /* matched */
+  if (_GD_FindField(D, temp_buffer, D->entry, D->n_entries, 1, &u)) {
     _GD_SetError(D, GD_E_DUPLICATE, 0, NULL, 0, temp_buffer);
-    dreturn("%i", -1);
-    return -1;
+    free(temp_buffer);
+    dreturn("%p", NULL);
+    return NULL;
   }
 
   /* check for bad field type */
-  if (entry->field_type != GD_RAW_ENTRY &&
-      entry->field_type != GD_LINCOM_ENTRY &&
-      entry->field_type != GD_LINTERP_ENTRY &&
-      entry->field_type != GD_BIT_ENTRY &&
-      entry->field_type != GD_MULTIPLY_ENTRY &&
-      entry->field_type != GD_PHASE_ENTRY &&
-      entry->field_type != GD_CONST_ENTRY &&
-      entry->field_type != GD_POLYNOM_ENTRY &&
-      entry->field_type != GD_SBIT_ENTRY &&
-      entry->field_type != GD_DIVIDE_ENTRY &&
-      entry->field_type != GD_RECIP_ENTRY &&
-      entry->field_type != GD_CARRAY_ENTRY &&
-      entry->field_type != GD_STRING_ENTRY)
-  {
-    _GD_SetError(D, GD_E_BAD_ENTRY, GD_E_BAD_ENTRY_TYPE, NULL,
-        entry->field_type, NULL);
-    dreturn("%i", -1);
-    return -1;
+  if (_GD_InvalidEntype(entry->field_type)) {
+    _GD_SetError(D, GD_E_BAD_ENTRY, GD_E_ENTRY_TYPE, NULL, entry->field_type,
+        NULL);
+    free(temp_buffer);
+    dreturn("%p", NULL);
+    return NULL;
   }
 
   /* New entry */
-  E = (gd_entry_t *)malloc(sizeof(gd_entry_t));
+  E = (gd_entry_t *)_GD_Malloc(D, sizeof(gd_entry_t));
   if (E == NULL) {
-    _GD_SetError(D, GD_E_ALLOC, 0, NULL, 0, NULL);
-    dreturn("%i", -1);
-    return -1;
+    dreturn("%p", NULL);
+    return NULL;
   }
   memset(E, 0, sizeof(gd_entry_t));
   if (P)
@@ -136,44 +194,53 @@ static int _GD_Add(DIRFILE* D, const gd_entry_t* entry, const char* parent)
   else
     E->fragment_index = entry->fragment_index;
 
-  E->e = (struct _gd_private_entry *)malloc(sizeof(struct _gd_private_entry));
+  /* check protection */
+  if (D->fragment[E->fragment_index].protection & GD_PROTECT_FORMAT) {
+    _GD_SetError(D, GD_E_PROTECTED, GD_E_PROTECTED_FORMAT, NULL, 0,
+        D->fragment[E->fragment_index].cname);
+    free(E);
+    free(temp_buffer);
+    dreturn("%p", NULL);
+    return NULL;
+  }
+
+  E->e = (struct gd_private_entry_ *)_GD_Malloc(D,
+      sizeof(struct gd_private_entry_));
   if (E->e == NULL) {
-    _GD_SetError(D, GD_E_ALLOC, 0, NULL, 0, NULL);
     free(E);
-    dreturn("%i", -1);
-    return -1;
+    free(temp_buffer);
+    dreturn("%p", NULL);
+    return NULL;
   }
-  memset(E->e, 0, sizeof(struct _gd_private_entry));
+  memset(E->e, 0, sizeof(struct gd_private_entry_));
   E->e->calculated = 0;
-
-  /* Validate field code */
   E->field_type = entry->field_type;
-  E->field = _GD_ValidateField(P, entry->field, D->standards, 1, &is_dot);
 
-  if (E->field == entry->field) {
-    _GD_SetError(D, GD_E_BAD_CODE, 0, NULL, 0, entry->field);
-    E->field = NULL;
-    _GD_FreeE(E, 1);
-    dreturn("%i", -1);
-    return -1;
-  } else if (E->field == NULL) {
-    _GD_SetError(D, GD_E_ALLOC, 0, NULL, 0, NULL);
-    _GD_FreeE(E, 1);
-    dreturn("%i", -1);
-    return -1;
+  E->field = temp_buffer;
+
+  /* Check */
+  if (_GD_ValidateField(E->field + offset, D->standards, 1, 0, &is_dot)) {
+    _GD_SetError(D, GD_E_BAD_CODE, GD_E_CODE_INVALID, NULL, 0, entry->field);
+    _GD_FreeE(D, E, 1);
+    dreturn("%p", NULL);
+    return NULL;
   }
 
-  /* Set meta indicies */
-  if (parent != NULL)
+  /* Set meta indices */
+  if (P != NULL)
     E->e->n_meta = -1;
 
+  /* Hidden */
+  if (entry->hidden)
+    E->hidden = 1;
+
   /* Validate entry and add auxiliary data */
   switch(entry->field_type)
   {
     case GD_RAW_ENTRY:
       /* no METARAW fields allowed */
-      if (parent != NULL) {
-        _GD_SetError(D, GD_E_BAD_ENTRY, GD_E_BAD_ENTRY_METARAW, NULL,
+      if (P != NULL) {
+        _GD_SetError(D, GD_E_BAD_ENTRY, GD_E_ENTRY_METARAW, NULL,
             entry->field_type, NULL);
         break;
       }
@@ -182,41 +249,33 @@ static int _GD_Add(DIRFILE* D, const gd_entry_t* entry, const char* parent)
       if (D->fragment[entry->fragment_index].protection & GD_PROTECT_DATA) {
         _GD_SetError(D, GD_E_PROTECTED, GD_E_PROTECTED_DATA, NULL, 0,
             D->fragment[entry->fragment_index].cname);
-        dreturn("%i", -1);
-        return -1;
+        break;
       }
 
       E->EN(raw,data_type) = entry->EN(raw,data_type);
-      E->e->u.raw.file[0].fp = E->e->u.raw.file[1].fp = -1;
-      E->e->u.raw.file[0].encoding = GD_ENC_UNKNOWN;
-
-      if ((E->e->u.raw.filebase = (char *)malloc(FILENAME_MAX)) == NULL) {
-        _GD_SetError(D, GD_E_ALLOC, 0, NULL, 0, NULL);
+      E->e->u.raw.file[0].idata = E->e->u.raw.file[1].idata = -1;
+      E->e->u.raw.file[0].subenc = GD_ENC_UNKNOWN;
+
+      E->e->u.raw.filebase = _GD_MungeCode(D, NULL,
+          D->fragment[entry->fragment_index].prefix,
+          D->fragment[entry->fragment_index].suffix, NULL, NULL, E->field,
+          &offset, 0);
+      if (D->error)
         break;
-      }
- 
-      snprintf(E->e->u.raw.filebase, FILENAME_MAX, "%s/%s",
-          D->fragment[E->fragment_index].sname ?
-          D->fragment[E->fragment_index].sname : D->name, E->field);
 
       if ((E->EN(raw,spf) = entry->EN(raw,spf)) == 0)
-        _GD_SetError(D, GD_E_BAD_ENTRY, GD_E_BAD_ENTRY_SPF, NULL,
+        _GD_SetError(D, GD_E_BAD_ENTRY, GD_E_ENTRY_SPF, NULL,
             entry->EN(raw,spf), NULL);
       else if (E->EN(raw,data_type) & 0x40 || (E->e->u.raw.size =
             GD_SIZE(E->EN(raw,data_type))) == 0)
         _GD_SetError(D, GD_E_BAD_TYPE, entry->EN(raw,data_type), NULL, 0, NULL);
-      else if (!_GD_Supports(D, E, GD_EF_TOUCH))
-        ; /* error already set */
-      else if (_GD_SetEncodedName(D, E->e->u.raw.file, E->e->u.raw.filebase, 0))
-        ; /* error already set */
-      else if ((*_gd_ef[E->e->u.raw.file[0].encoding].touch)(E->e->u.raw.file))
-        _GD_SetError(D, GD_E_RAW_IO, 0, E->e->u.raw.file[0].name, errno,
-            NULL);
-      else if (D->fragment[E->fragment_index].ref_name == NULL) {
+      else if (_GD_InitRawIO(D, E, NULL, 0, NULL, 0,
+            GD_FILE_WRITE | GD_FILE_TOUCH, 0))
+      {
+        ;
+      } else if (D->fragment[E->fragment_index].ref_name == NULL) {
         /* This is the first raw field in this fragment */
-        new_ref = strdup(E->field);
-        if (new_ref == NULL)
-          _GD_SetError(D, GD_E_ALLOC, 0, NULL, 0, NULL);
+        new_ref = _GD_Strdup(D, E->field);
       }
       copy_scalar[0] = 1;
       break;
@@ -224,8 +283,20 @@ static int _GD_Add(DIRFILE* D, const gd_entry_t* entry, const char* parent)
       E->EN(lincom,n_fields) = entry->EN(lincom,n_fields);
 
       if (E->EN(lincom,n_fields) < 1 || E->EN(lincom,n_fields) > GD_MAX_LINCOM)
-        _GD_SetError(D, GD_E_BAD_ENTRY, GD_E_BAD_ENTRY_NFIELDS, NULL,
+        _GD_SetError(D, GD_E_BAD_ENTRY, GD_E_ENTRY_NFIELDS, NULL,
             E->EN(lincom,n_fields), NULL);
+      
+      for (i = 0; i < E->EN(lincom,n_fields); ++i) {
+        _GD_CheckCodeAffixes(D, NULL, entry->in_fields[i],
+            entry->fragment_index);
+        _GD_CheckCodeAffixes(D, NULL, entry->scalar[i], entry->fragment_index);
+        _GD_CheckCodeAffixes(D, NULL, entry->scalar[i + GD_MAX_LINCOM],
+            entry->fragment_index);
+      }
+
+      if (D->error)
+        break;
+
       else {
         if (entry->comp_scal) {
           int cs = 0;
@@ -246,15 +317,14 @@ static int _GD_Add(DIRFILE* D, const gd_entry_t* entry, const char* parent)
           memcpy(E->EN(lincom,b), entry->EN(lincom,b), sizeof(double) *
               E->EN(lincom,n_fields));
           for (i = 0; i < E->EN(lincom,n_fields); ++i) {
-            _gd_r2c(E->EN(lincom,cm)[i], E->EN(lincom,m)[i]);
-            _gd_r2c(E->EN(lincom,cb)[i], E->EN(lincom,b)[i]);
+            gd_rs2cs_(E->EN(lincom,cm)[i], E->EN(lincom,m)[i]);
+            gd_rs2cs_(E->EN(lincom,cb)[i], E->EN(lincom,b)[i]);
           }
           E->comp_scal = 0;
         }
 
         for (i = 0; i < E->EN(lincom,n_fields); ++i) {
-          if ((E->in_fields[i] = strdup(entry->in_fields[i])) == NULL)
-            _GD_SetError(D, GD_E_ALLOC, 0, NULL, 0, NULL);
+          E->in_fields[i] = _GD_Strdup(D, entry->in_fields[i]);
           copy_scalar[i] = copy_scalar[i + GD_MAX_LINCOM] = 1;
         }
       }
@@ -262,33 +332,44 @@ static int _GD_Add(DIRFILE* D, const gd_entry_t* entry, const char* parent)
     case GD_LINTERP_ENTRY:
       E->e->u.linterp.table_len = -1;
 
-      if ((E->in_fields[0] = strdup(entry->in_fields[0])) == NULL)
-        _GD_SetError(D, GD_E_ALLOC, 0, NULL, 0, NULL);
-      else if ((E->EN(linterp,table) = strdup(entry->EN(linterp,table)))
-          == NULL)
+      if (_GD_CheckCodeAffixes(D, NULL, entry->in_fields[0],
+            entry->fragment_index))
       {
-        _GD_SetError(D, GD_E_ALLOC, 0, NULL, 0, NULL);
+        break;
       }
+
+      E->in_fields[0] = _GD_Strdup(D, entry->in_fields[0]);
+      E->EN(linterp,table) = _GD_Strdup(D, entry->EN(linterp,table));
       break;
     case GD_MULTIPLY_ENTRY:
     case GD_DIVIDE_ENTRY:
-      if ((E->in_fields[0] = strdup(entry->in_fields[0])) == NULL)
-        _GD_SetError(D, GD_E_ALLOC, 0, NULL, 0, NULL);
-      else if ((E->in_fields[1] = strdup(entry->in_fields[1])) == NULL)
-        _GD_SetError(D, GD_E_ALLOC, 0, NULL, 0, NULL);
+      if (_GD_CheckCodeAffixes(D, NULL, entry->in_fields[0],
+            entry->fragment_index) || _GD_CheckCodeAffixes(D, NULL,
+              entry->in_fields[1], entry->fragment_index))
+      {
+        break;
+      }
+
+      E->in_fields[0] = _GD_Strdup(D, entry->in_fields[0]);
+      E->in_fields[1] = _GD_Strdup(D, entry->in_fields[1]);
       break;
     case GD_RECIP_ENTRY:
-      if ((E->in_fields[0] = strdup(entry->in_fields[0])) == NULL)
-        _GD_SetError(D, GD_E_ALLOC, 0, NULL, 0, NULL);
+      if (_GD_CheckCodeAffixes(D, NULL, entry->in_fields[0],
+            entry->fragment_index))
+      {
+        break;
+      }
+
+      E->in_fields[0] = _GD_Strdup(D, entry->in_fields[0]);
 
       copy_scalar[0] = 1;
       if (entry->comp_scal) {
-        _gd_c2c(E->EN(recip,cdividend), entry->EN(recip,cdividend));
+        gd_cs2cs_(E->EN(recip,cdividend), entry->EN(recip,cdividend));
         E->EN(recip,dividend) = creal(E->EN(recip,cdividend));
         E->comp_scal = (cimag(E->EN(recip,cdividend)) == 0) ? 0 : 1;
       } else {
         E->EN(recip,dividend) = entry->EN(recip,dividend);
-        _gd_r2c(E->EN(recip,cdividend), E->EN(recip,dividend));
+        gd_rs2cs_(E->EN(recip,cdividend), E->EN(recip,dividend));
         E->comp_scal = 0;
       }
       break;
@@ -297,26 +378,78 @@ static int _GD_Add(DIRFILE* D, const gd_entry_t* entry, const char* parent)
       E->EN(bit,numbits) = entry->EN(bit,numbits);
       E->EN(bit,bitnum) = entry->EN(bit,bitnum);
 
-      if ((E->in_fields[0] = strdup(entry->in_fields[0])) == NULL)
-        _GD_SetError(D, GD_E_ALLOC, 0, NULL, 0, NULL);
-      else if (E->EN(bit,numbits) < 1)
-        _GD_SetError(D, GD_E_BAD_ENTRY, GD_E_BAD_ENTRY_NUMBITS, NULL, 
+      if (_GD_CheckCodeAffixes(D, NULL, entry->in_fields[0],
+            entry->fragment_index))
+      {
+        break;
+      }
+
+      E->in_fields[0] = _GD_Strdup(D, entry->in_fields[0]);
+      if (E->EN(bit,numbits) < 1)
+        _GD_SetError(D, GD_E_BAD_ENTRY, GD_E_ENTRY_NUMBITS, NULL,
             entry->EN(bit,numbits), NULL);
       else if (E->EN(bit,bitnum) < 0)
-        _GD_SetError(D, GD_E_BAD_ENTRY, GD_E_BAD_ENTRY_BITNUM, NULL, 
+        _GD_SetError(D, GD_E_BAD_ENTRY, GD_E_ENTRY_BITNUM, NULL,
             entry->EN(bit,bitnum), NULL);
       else if (E->EN(bit,bitnum) + E->EN(bit,numbits) - 1 > 63)
-        _GD_SetError(D, GD_E_BAD_ENTRY, GD_E_BAD_ENTRY_BITSIZE, NULL, 
+        _GD_SetError(D, GD_E_BAD_ENTRY, GD_E_ENTRY_BITSIZE, NULL,
             E->EN(bit,bitnum) + E->EN(bit,numbits) - 1, NULL);
       copy_scalar[0] = copy_scalar[1] = 1;
       break;
     case GD_PHASE_ENTRY:
       E->EN(phase,shift) = entry->EN(phase,shift);
 
-      if ((E->in_fields[0] = strdup(entry->in_fields[0])) == NULL)
-        _GD_SetError(D, GD_E_ALLOC, 0, NULL, 0, NULL);
+      if (_GD_CheckCodeAffixes(D, NULL, entry->in_fields[0],
+            entry->fragment_index))
+      {
+        break;
+      }
+
+      E->in_fields[0] = _GD_Strdup(D, entry->in_fields[0]);
+      copy_scalar[0] = 1;
+      break;
+    case GD_WINDOW_ENTRY:
+      E->EN(window,windop) = entry->EN(window,windop);
+      E->EN(window,threshold) = entry->EN(window,threshold);
+
+      if (_GD_CheckCodeAffixes(D, NULL, entry->in_fields[0],
+            entry->fragment_index) || _GD_CheckCodeAffixes(D, NULL,
+              entry->in_fields[1], entry->fragment_index))
+      {
+        break;
+      }
+
+      E->in_fields[0] = _GD_Strdup(D, entry->in_fields[0]);
+      E->in_fields[1] = _GD_Strdup(D, entry->in_fields[1]);
+      if (_GD_BadWindop(E->EN(window,windop)))
+        _GD_SetError(D, GD_E_BAD_ENTRY, GD_E_ENTRY_WINDOP, NULL,
+            entry->EN(window,windop), NULL);
       copy_scalar[0] = 1;
       break;
+    case GD_MPLEX_ENTRY:
+      E->EN(mplex,count_val) = entry->EN(mplex,count_val);
+      E->EN(mplex,period) = entry->EN(mplex,period);
+
+      if (_GD_CheckCodeAffixes(D, NULL, entry->in_fields[0],
+            entry->fragment_index) || _GD_CheckCodeAffixes(D, NULL,
+              entry->in_fields[1], entry->fragment_index))
+      {
+        break;
+      }
+
+      E->in_fields[0] = _GD_Strdup(D, entry->in_fields[0]);
+      E->in_fields[1] = _GD_Strdup(D, entry->in_fields[1]);
+      E->e->u.mplex.type = GD_NULL;
+
+      if (entry->EN(mplex,period) < 0)
+        _GD_SetError(D, GD_E_BAD_ENTRY, GD_E_ENTRY_PERIOD, NULL,
+            entry->EN(mplex,period), NULL);
+      else if (entry->EN(mplex,count_val) < 0)
+        _GD_SetError(D, GD_E_BAD_ENTRY, GD_E_ENTRY_CNTVAL, NULL,
+            entry->EN(mplex,count_val), NULL);
+
+      copy_scalar[0] = copy_scalar[1] = 1;
+      break;
     case GD_CONST_ENTRY:
       E->EN(scalar,const_type) = entry->EN(scalar,const_type);
       E->EN(scalar,array_len) = -1;
@@ -327,10 +460,9 @@ static int _GD_Add(DIRFILE* D, const gd_entry_t* entry, const char* parent)
         _GD_SetError(D, GD_E_BAD_TYPE, E->EN(scalar,const_type), NULL, 0, NULL);
       } else {
         size_t size = GD_SIZE(_GD_ConstType(D, E->EN(scalar,const_type)));
-        E->e->u.scalar.d = malloc(size);
-        if (!D->error && E->e->u.scalar.d == NULL)
-          _GD_SetError(D, GD_E_ALLOC, 0, NULL, 0, NULL);
-        else
+        if (!D->error)
+          E->e->u.scalar.d = _GD_Malloc(D, size);
+        if (E->e->u.scalar.d)
           memset(E->e->u.scalar.d, 0, size);
       }
       break;
@@ -347,17 +479,14 @@ static int _GD_Add(DIRFILE* D, const gd_entry_t* entry, const char* parent)
       else {
         size_t size = GD_SIZE(_GD_ConstType(D, E->EN(scalar,const_type))) *
           E->EN(scalar,array_len);
-        E->e->u.scalar.d = malloc(size);
-        if (!D->error && E->e->u.scalar.d == NULL)
-          _GD_SetError(D, GD_E_ALLOC, 0, NULL, 0, NULL);
-        else
+        if (!D->error)
+          E->e->u.scalar.d = _GD_Malloc(D, size);
+        if (E->e->u.scalar.d)
           memset(E->e->u.scalar.d, 0, size);
       }
       break;
     case GD_STRING_ENTRY:
-      E->e->u.string = strdup("");
-      if (E->e->u.string == NULL)
-        _GD_SetError(D, GD_E_ALLOC, 0, NULL, 0, NULL);
+      E->e->u.string = _GD_Strdup(D, "");
       break;
     case GD_POLYNOM_ENTRY:
       E->EN(polynom,poly_ord) = entry->EN(polynom,poly_ord);
@@ -365,35 +494,42 @@ static int _GD_Add(DIRFILE* D, const gd_entry_t* entry, const char* parent)
       if (E->EN(polynom,poly_ord) < 1 || E->EN(polynom,poly_ord) >
           GD_MAX_POLYORD)
       {
-        _GD_SetError(D, GD_E_BAD_ENTRY, GD_E_BAD_ENTRY_NFIELDS, NULL,
+        _GD_SetError(D, GD_E_BAD_ENTRY, GD_E_ENTRY_NFIELDS, NULL,
             E->EN(polynom,poly_ord), NULL);
+      } else {
+        _GD_CheckCodeAffixes(D, NULL, entry->in_fields[0],
+            entry->fragment_index);
+        _GD_CheckCodeAffixes(D, NULL, entry->in_fields[1],
+            entry->fragment_index);
       }
-      else {
-        if (entry->comp_scal) {
-          int cs = 0;
-          memcpy(E->EN(polynom,ca), entry->EN(polynom,ca), sizeof(double) * 2 *
-              (E->EN(polynom,poly_ord) + 1));
-          for (i = 0; i <= E->EN(polynom,poly_ord); ++i) {
-            E->EN(polynom,a)[i] = creal(E->EN(polynom,ca)[i]);
-            if (cimag(E->EN(polynom,ca)[i]))
-              cs = 1;
-          }
-          E->comp_scal = cs;
-        } else {
-          memcpy(E->EN(polynom,a), entry->EN(polynom,a), sizeof(double) *
-              (E->EN(polynom,poly_ord) + 1));
-          for (i = 0; i <= E->EN(polynom,poly_ord); ++i)
-            _gd_r2c(E->EN(polynom,ca)[i], E->EN(polynom,a)[i]);
-          E->comp_scal = 0;
-        }
 
-        if ((E->in_fields[0] = strdup(entry->in_fields[0])) == NULL)
-          _GD_SetError(D, GD_E_ALLOC, 0, NULL, 0, NULL);
+      if (D->error)
+        break;
+
+      if (entry->comp_scal) {
+        int cs = 0;
+        memcpy(E->EN(polynom,ca), entry->EN(polynom,ca), sizeof(double) * 2 *
+            (E->EN(polynom,poly_ord) + 1));
+        for (i = 0; i <= E->EN(polynom,poly_ord); ++i) {
+          E->EN(polynom,a)[i] = creal(E->EN(polynom,ca)[i]);
+          if (cimag(E->EN(polynom,ca)[i]))
+            cs = 1;
+        }
+        E->comp_scal = cs;
+      } else {
+        memcpy(E->EN(polynom,a), entry->EN(polynom,a), sizeof(double) *
+            (E->EN(polynom,poly_ord) + 1));
+        for (i = 0; i <= E->EN(polynom,poly_ord); ++i)
+          gd_rs2cs_(E->EN(polynom,ca)[i], E->EN(polynom,a)[i]);
+        E->comp_scal = 0;
       }
 
+      E->in_fields[0] = _GD_Strdup(D, entry->in_fields[0]);
+
       for (i = 0; i < E->EN(polynom,poly_ord); ++i)
         copy_scalar[i] = 1;
       break;
+    case GD_ALIAS_ENTRY:
     case GD_INDEX_ENTRY:
     case GD_NO_ENTRY:
       _GD_InternalError(D); /* We've already verrified field_type is valid */
@@ -405,47 +541,52 @@ static int _GD_Add(DIRFILE* D, const gd_entry_t* entry, const char* parent)
     if (!copy_scalar[i] || entry->scalar[i] == NULL)
       E->scalar[i] = NULL;
     else {
-      E->scalar[i] = strdup(entry->scalar[i]);
-      if (E->scalar[i] == NULL)
-        _GD_SetError(D, GD_E_ALLOC, 0, NULL, 0, NULL);
+      if (_GD_CheckCodeAffixes(D, NULL, entry->scalar[i],
+            entry->fragment_index))
+      {
+        break;
+      }
+      E->scalar[i] = _GD_Strdup(D, entry->scalar[i]);
+      E->scalar_ind[i] = entry->scalar_ind[i];
     }
   }
 
   if (D->error != GD_E_OK) {
     free(new_ref);
-    _GD_FreeE(E, 1);
-    dreturn("%i", -1);
-    return -1;
+    _GD_FreeE(D, E, 1);
+    dreturn("%p", NULL);
+    return NULL;
   }
 
-  new_list = realloc(D->entry, (D->n_entries + 1) * sizeof(gd_entry_t*));
+  new_list = _GD_Realloc(D, D->entry, (D->n_entries + 1) * sizeof(gd_entry_t*));
   if (new_list == NULL) {
     free(new_ref);
-    _GD_FreeE(E, 1);
-    dreturn("%i", -1);
-    return -1;
+    _GD_FreeE(D, E, 1);
+    dreturn("%p", NULL);
+    return NULL;
   }
   D->entry = (gd_entry_t **)new_list;
 
   if (is_dot) {
-    new_list = realloc(D->dot_list, (D->n_dot + 1) * sizeof(gd_entry_t*));
+    new_list = _GD_Realloc(D, D->dot_list, (D->n_dot + 1) *
+        sizeof(gd_entry_t*));
     if (new_list == NULL) {
       free(new_ref);
-      _GD_FreeE(E, 1);
-      dreturn("%i", -1);
-      return -1;
+      _GD_FreeE(D, E, 1);
+      dreturn("%p", NULL);
+      return NULL;
     }
     D->dot_list = (gd_entry_t **)new_list;
   }
 
   if (P) {
-    void *ptr = realloc(P->e->p.meta_entry, (P->e->n_meta + 1) *
+    void *ptr = _GD_Realloc(D, P->e->p.meta_entry, (P->e->n_meta + 1) *
         sizeof(gd_entry_t*));
     if (ptr == NULL) {
       free(new_ref);
-      _GD_FreeE(E, 1);
-      dreturn("%i", -1);
-      return -1;
+      _GD_FreeE(D, E, 1);
+      dreturn("%p", NULL);
+      return NULL;
     }
 
     /* From here on, nothing may fail */
@@ -453,31 +594,22 @@ static int _GD_Add(DIRFILE* D, const gd_entry_t* entry, const char* parent)
     P->e->p.meta_entry = (gd_entry_t **)ptr;
     P->e->p.meta_entry[P->e->n_meta] = E;
     P->e->n_meta++;
-    D->n_meta++;
-
-  }
-
-  if (E->field_type == GD_STRING_ENTRY) {
-    if (P)
-      P->e->n_meta_string++;
-    else
-      D->n_string++;
-  } else if (E->field_type == GD_CONST_ENTRY) {
-    if (P)
-      P->e->n_meta_const++;
-    else
-      D->n_const++;
-  } else if (E->field_type == GD_CARRAY_ENTRY) {
-    if (P)
-      P->e->n_meta_carray++;
-    else
-      D->n_carray++;
-  } else if (E->field_type == GD_RAW_ENTRY) {
+
+    P->e->value_list_validity = 0;
+    P->e->entry_list_validity = 0;
+  } else {
+    /* Invalidate the field lists */
+    D->value_list_validity = 0;
+    D->entry_list_validity = 0;
+  }
+
+
+  if (E->field_type == GD_RAW_ENTRY) {
     if (new_ref != NULL) {
       /* This is the first raw field in this fragment; propagate it upwards */
       for (i = E->fragment_index; i != -1; i = D->fragment[i].parent) {
         if (D->fragment[i].ref_name == NULL) {
-          D->fragment[i].ref_name = strdup(new_ref);
+          D->fragment[i].ref_name = (char *)strdup((const char*)new_ref);
           D->fragment[i].modified = 1;
         } else
           break;
@@ -485,13 +617,14 @@ static int _GD_Add(DIRFILE* D, const gd_entry_t* entry, const char* parent)
 
       if (D->reference_field == NULL)
         D->reference_field = E;
+      free(new_ref);
     }
   }
 
   /* add the entry to the dot list, if needed */
   if (is_dot) {
     D->dot_list[D->n_dot++] = E;
-    qsort(D->dot_list, D->n_dot, sizeof(gd_entry_t*), entry_cmp);
+    qsort(D->dot_list, D->n_dot, sizeof(gd_entry_t*), _GD_EntryCmp);
   }
 
   /* add the entry and resort the entry list */
@@ -500,12 +633,11 @@ static int _GD_Add(DIRFILE* D, const gd_entry_t* entry, const char* parent)
   D->fragment[E->fragment_index].modified = 1;
   D->flags &= ~GD_HAVE_VERSION;
 
-  /* Invalidate the field lists */
-  D->list_validity = 0;
-  D->type_list_validity = 0;
+  /* Update aliases - no reason to do a reset: all we did was add a field */
+  _GD_UpdateAliases(D, 0);
 
-  dreturn("%i", 0);
-  return 0;
+  dreturn("%p", E);
+  return E;
 }
 
 /* add a META field by parsing a field spec */
@@ -535,9 +667,11 @@ int gd_madd_spec(DIRFILE* D, const char* line, const char* parent) gd_nothrow
 
   _GD_ClearError(D);
 
-  E = _GD_FindField(D, parent, D->entry, D->n_entries, NULL);
+  /* Find parent -- we don't do code mungeing here because we don't know
+   * which fragment this is yet.  */
+  E = _GD_FindField(D, parent, D->entry, D->n_entries, 1, NULL);
   if (E == NULL) {
-    _GD_SetError(D, GD_E_BAD_CODE, 0, NULL, 0, parent);
+    _GD_SetError(D, GD_E_BAD_CODE, GD_E_CODE_MISSING, NULL, 0, parent);
     dreturn("%i", -1);
     return -1;
   }
@@ -553,11 +687,11 @@ int gd_madd_spec(DIRFILE* D, const char* line, const char* parent) gd_nothrow
   }
 
   /* start parsing */
-  n_cols = _GD_Tokenise(D, line, &outstring, &tok_pos, in_cols,
+  n_cols = _GD_Tokenise(D, line, &outstring, &tok_pos, MAX_IN_COLS, in_cols,
       "dirfile_madd_spec()", 0, D->standards, D->flags & GD_PERMISSIVE);
 
   /* Directive parsing is skipped -- The Field Spec parser will add the field */
-  if (!D->error) 
+  if (!D->error)
     _GD_ParseFieldSpec(D, n_cols, in_cols, E, "dirfile_madd_spec()", 0, me,
         D->standards, 1, GD_PEDANTIC, 1, &outstring, tok_pos);
 
@@ -568,6 +702,9 @@ int gd_madd_spec(DIRFILE* D, const char* line, const char* parent) gd_nothrow
     return -1;
   }
 
+  /* Update aliases */
+  _GD_UpdateAliases(D, 0);
+
   D->fragment[me].modified = 1;
   D->flags &= ~GD_HAVE_VERSION;
   dreturn("%i", 0);
@@ -615,12 +752,12 @@ int gd_add_spec(DIRFILE* D, const char* line, int fragment_index)
   _GD_ClearError(D);
 
   /* start parsing */
-  n_cols = _GD_Tokenise(D, line, &outstring, &tok_pos, in_cols,
+  n_cols = _GD_Tokenise(D, line, &outstring, &tok_pos, MAX_IN_COLS, in_cols,
       "dirfile_add_spec()", 0, D->standards, D->flags & GD_PERMISSIVE);
 
   /* Directive parsing is skipped -- The Field Spec parser will add the field */
   if (!D->error)
-    _GD_ParseFieldSpec(D, n_cols, in_cols, NULL, "dirfile_add_spec()", 0, 
+    _GD_ParseFieldSpec(D, n_cols, in_cols, NULL, "dirfile_add_spec()", 0,
         fragment_index, D->standards, 1, GD_PEDANTIC, 1, &outstring, tok_pos);
 
   free(outstring);
@@ -630,6 +767,9 @@ int gd_add_spec(DIRFILE* D, const char* line, int fragment_index)
     return -1;
   }
 
+  /* Update aliases */
+  _GD_UpdateAliases(D, 0);
+
   D->fragment[fragment_index].modified = 1;
   D->flags &= ~GD_HAVE_VERSION;
   dreturn("%i", 0);
@@ -648,7 +788,7 @@ int gd_add(DIRFILE* D, const gd_entry_t* entry)
     return -1;
   }
 
-  ret = _GD_Add(D, entry, NULL);
+  ret = (_GD_Add(D, entry, NULL) == NULL) ? -1 : 0;
 
   dreturn("%i", ret);
   return ret;
@@ -656,12 +796,12 @@ int gd_add(DIRFILE* D, const gd_entry_t* entry)
 
 /* add a RAW entry */
 int gd_add_raw(DIRFILE* D, const char* field_code, gd_type_t data_type,
-    gd_spf_t spf, int fragment_index)
+    unsigned int spf, int fragment_index)
 {
   gd_entry_t R;
   int error;
 
-  dtrace("%p, \"%s\", %x, %i %i", D, field_code, data_type, spf,
+  dtrace("%p, \"%s\", 0x%X, %i, %i", D, field_code, data_type, spf,
       fragment_index);
 
   if (D->flags & GD_INVALID) {/* don't crash */
@@ -676,7 +816,7 @@ int gd_add_raw(DIRFILE* D, const char* field_code, gd_type_t data_type,
   R.EN(raw,spf) = spf;
   R.EN(raw,data_type) = data_type;
   R.fragment_index = fragment_index;
-  error = _GD_Add(D, &R, NULL);
+  error = (_GD_Add(D, &R, NULL) == NULL) ? -1 : 0;
 
   dreturn("%i", error);
   return error;
@@ -700,8 +840,7 @@ int gd_add_lincom(DIRFILE* D, const char* field_code, int n_fields,
   }
 
   if (n_fields < 1 || n_fields > GD_MAX_LINCOM) {
-    _GD_SetError(D, GD_E_BAD_ENTRY, GD_E_BAD_ENTRY_NFIELDS, NULL, n_fields,
-        NULL);
+    _GD_SetError(D, GD_E_BAD_ENTRY, GD_E_ENTRY_NFIELDS, NULL, n_fields, NULL);
     dreturn("%i", -1);
     return -1;
   }
@@ -718,7 +857,7 @@ int gd_add_lincom(DIRFILE* D, const char* field_code, int n_fields,
     L.EN(lincom,m)[i] = m[i];
     L.EN(lincom,b)[i] = b[i];
   }
-  error = _GD_Add(D, &L, NULL);
+  error = (_GD_Add(D, &L, NULL) == NULL) ? -1 : 0;
 
   dreturn("%i", error);
   return error;
@@ -742,8 +881,7 @@ int gd_add_clincom(DIRFILE* D, const char* field_code, int n_fields,
   }
 
   if (n_fields < 1 || n_fields > GD_MAX_LINCOM) {
-    _GD_SetError(D, GD_E_BAD_ENTRY, GD_E_BAD_ENTRY_NFIELDS, NULL, n_fields,
-        NULL);
+    _GD_SetError(D, GD_E_BAD_ENTRY, GD_E_ENTRY_NFIELDS, NULL, n_fields, NULL);
     dreturn("%i", -1);
     return -1;
   }
@@ -757,10 +895,10 @@ int gd_add_clincom(DIRFILE* D, const char* field_code, int n_fields,
 
   for (i = 0; i < n_fields; ++i) {
     L.in_fields[i] = (char *)in_fields[i];
-    _gd_ca2c(L.EN(lincom,cm)[i], cm, i);
-    _gd_ca2c(L.EN(lincom,cb)[i], cb, i);
+    gd_ca2cs_(L.EN(lincom,cm)[i], cm, i);
+    gd_ca2cs_(L.EN(lincom,cb)[i], cb, i);
   }
-  error = _GD_Add(D, &L, NULL);
+  error = (_GD_Add(D, &L, NULL) == NULL) ? -1 : 0;
 
   dreturn("%i", error);
   return error;
@@ -788,7 +926,7 @@ int gd_add_linterp(DIRFILE* D, const char* field_code, const char* in_field,
   L.in_fields[0] = (char *)in_field;
   L.EN(linterp,table) = (char *)table;
   L.fragment_index = fragment_index;
-  error = _GD_Add(D, &L, NULL);
+  error = (_GD_Add(D, &L, NULL) == NULL) ? -1 : 0;
 
   dreturn("%i", error);
   return error;
@@ -796,12 +934,12 @@ int gd_add_linterp(DIRFILE* D, const char* field_code, const char* in_field,
 
 /* add a BIT entry */
 int gd_add_bit(DIRFILE* D, const char* field_code, const char* in_field,
-    gd_bit_t bitnum, gd_bit_t numbits, int fragment_index) gd_nothrow
+    int bitnum, int numbits, int fragment_index) gd_nothrow
 {
   gd_entry_t B;
   int error;
 
-  dtrace("%p, \"%s\", \"%s\", %i, %i, %i\n", D, field_code, in_field, bitnum,
+  dtrace("%p, \"%s\", \"%s\", %i, %i, %i", D, field_code, in_field, bitnum,
       numbits, fragment_index);
 
   if (D->flags & GD_INVALID) {/* don't crash */
@@ -817,7 +955,7 @@ int gd_add_bit(DIRFILE* D, const char* field_code, const char* in_field,
   B.EN(bit,bitnum) = bitnum;
   B.EN(bit,numbits) = numbits;
   B.fragment_index = fragment_index;
-  error = _GD_Add(D, &B, NULL);
+  error = (_GD_Add(D, &B, NULL) == NULL) ? -1 : 0;
 
   dreturn("%i", error);
   return error;
@@ -825,12 +963,12 @@ int gd_add_bit(DIRFILE* D, const char* field_code, const char* in_field,
 
 /* add a SBIT entry */
 int gd_add_sbit(DIRFILE* D, const char* field_code, const char* in_field,
-    gd_bit_t bitnum, gd_bit_t numbits, int fragment_index) gd_nothrow
+    int bitnum, int numbits, int fragment_index) gd_nothrow
 {
   gd_entry_t B;
   int error;
 
-  dtrace("%p, \"%s\", \"%s\", %i, %i, %i\n", D, field_code, in_field, bitnum,
+  dtrace("%p, \"%s\", \"%s\", %i, %i, %i", D, field_code, in_field, bitnum,
       numbits, fragment_index);
 
   if (D->flags & GD_INVALID) {/* don't crash */
@@ -846,7 +984,7 @@ int gd_add_sbit(DIRFILE* D, const char* field_code, const char* in_field,
   B.EN(bit,bitnum) = bitnum;
   B.EN(bit,numbits) = numbits;
   B.fragment_index = fragment_index;
-  error = _GD_Add(D, &B, NULL);
+  error = (_GD_Add(D, &B, NULL) == NULL) ? -1 : 0;
 
   dreturn("%i", error);
   return error;
@@ -874,7 +1012,7 @@ int gd_add_multiply(DIRFILE* D, const char* field_code, const char* in_field1,
   M.in_fields[0] = (char *)in_field1;
   M.in_fields[1] = (char *)in_field2;
   M.fragment_index = fragment_index;
-  error = _GD_Add(D, &M, NULL);
+  error = (_GD_Add(D, &M, NULL) == NULL) ? -1 : 0;
 
   dreturn("%i", error);
   return error;
@@ -902,7 +1040,7 @@ int gd_add_divide(DIRFILE* D, const char* field_code, const char* in_field1,
   E.in_fields[0] = (char *)in_field1;
   E.in_fields[1] = (char *)in_field2;
   E.fragment_index = fragment_index;
-  error = _GD_Add(D, &E, NULL);
+  error = (_GD_Add(D, &E, NULL) == NULL) ? -1 : 0;
 
   dreturn("%i", error);
   return error;
@@ -931,7 +1069,7 @@ int gd_add_recip(DIRFILE* D, const char* field_code, const char* in_field,
   E.comp_scal = 0;
   E.in_fields[0] = (char *)in_field;
   E.fragment_index = fragment_index;
-  error = _GD_Add(D, &E, NULL);
+  error = (_GD_Add(D, &E, NULL) == NULL) ? -1 : 0;
 
   dreturn("%i", error);
   return error;
@@ -941,6 +1079,8 @@ int gd_add_recip(DIRFILE* D, const char* field_code, const char* in_field,
 int gd_add_crecip(DIRFILE* D, const char* field_code, const char* in_field,
     double complex cdividend, int fragment_index) gd_nothrow
 {
+  int error;
+
   dtrace("%p, \"%s\", \"%s\", %g;%g, %i", D, field_code, in_field,
       creal(cdividend), cimag(cdividend), fragment_index);
 
@@ -958,7 +1098,7 @@ int gd_add_crecip(DIRFILE* D, const char* field_code, const char* in_field,
   E.comp_scal = 1;
   E.in_fields[0] = (char *)in_field;
   E.fragment_index = fragment_index;
-  int error = _GD_Add(D, &E, NULL);
+  error = (_GD_Add(D, &E, NULL) == NULL) ? -1 : 0;
 
   dreturn("%i", error);
   return error;
@@ -983,11 +1123,11 @@ int gd_add_crecip89(DIRFILE* D, const char* field_code, const char* in_field,
   memset(&E, 0, sizeof(gd_entry_t));
   E.field = (char *)field_code;
   E.field_type = GD_RECIP_ENTRY;
-  _gd_a2c(E.EN(recip,cdividend), cdividend);
+  gd_ra2cs_(E.EN(recip,cdividend), cdividend);
   E.comp_scal = 1;
   E.in_fields[0] = (char *)in_field;
   E.fragment_index = fragment_index;
-  error = _GD_Add(D, &E, NULL);
+  error = (_GD_Add(D, &E, NULL) == NULL) ? -1 : 0;
 
   dreturn("%i", error);
   return error;
@@ -1010,8 +1150,7 @@ int gd_add_polynom(DIRFILE* D, const char* field_code, int poly_ord,
   }
 
   if (poly_ord < 1 || poly_ord > GD_MAX_LINCOM) {
-    _GD_SetError(D, GD_E_BAD_ENTRY, GD_E_BAD_ENTRY_POLYORD, NULL, poly_ord,
-        NULL);
+    _GD_SetError(D, GD_E_BAD_ENTRY, GD_E_ENTRY_POLYORD, NULL, poly_ord, NULL);
     dreturn("%i", -1);
     return -1;
   }
@@ -1027,7 +1166,7 @@ int gd_add_polynom(DIRFILE* D, const char* field_code, int poly_ord,
   for (i = 0; i <= poly_ord; ++i)
     E.EN(polynom,a)[i] = a[i];
 
-  error = _GD_Add(D, &E, NULL);
+  error = (_GD_Add(D, &E, NULL) == NULL) ? -1 : 0;
 
   dreturn("%i", error);
   return error;
@@ -1049,8 +1188,7 @@ int gd_add_cpolynom(DIRFILE* D, const char* field_code, int poly_ord,
   }
 
   if (poly_ord < 1 || poly_ord > GD_MAX_LINCOM) {
-    _GD_SetError(D, GD_E_BAD_ENTRY, GD_E_BAD_ENTRY_POLYORD, NULL, poly_ord,
-        NULL);
+    _GD_SetError(D, GD_E_BAD_ENTRY, GD_E_ENTRY_POLYORD, NULL, poly_ord, NULL);
     dreturn("%i", -1);
     return -1;
   }
@@ -1064,9 +1202,9 @@ int gd_add_cpolynom(DIRFILE* D, const char* field_code, int poly_ord,
   E.in_fields[0] = (char *)in_field;
 
   for (i = 0; i <= poly_ord; ++i)
-    _gd_ca2c(E.EN(polynom,ca)[i], ca, i);
+    gd_ca2cs_(E.EN(polynom,ca)[i], ca, i);
 
-  error = _GD_Add(D, &E, NULL);
+  error = (_GD_Add(D, &E, NULL) == NULL) ? -1 : 0;
 
   dreturn("%i", error);
   return error;
@@ -1094,7 +1232,70 @@ int gd_add_phase(DIRFILE* D, const char* field_code, const char* in_field,
   P.in_fields[0] = (char *)in_field;
   P.EN(phase,shift) = shift;
   P.fragment_index = fragment_index;
-  error = _GD_Add(D, &P, NULL);
+  error = (_GD_Add(D, &P, NULL) == NULL) ? -1 : 0;
+
+  dreturn("%i", error);
+  return error;
+}
+
+/* add a WINDOW entry */
+int gd_add_window(DIRFILE *D, const char *field_code, const char *in_field,
+    const char *check_field, gd_windop_t windop, gd_triplet_t threshold,
+    int fragment_index) gd_nothrow
+{
+  gd_entry_t E;
+  int error;
+
+  dtrace("%p, \"%s\", \"%s\", \"%s\", %i, {%g,%llx,%lli}, %i", D, field_code,
+      in_field, check_field, windop, threshold.r,
+      (unsigned long long)threshold.u, (long long)threshold.i, fragment_index);
+
+  if (D->flags & GD_INVALID) {/* don't crash */
+    _GD_SetError(D, GD_E_BAD_DIRFILE, 0, NULL, 0, NULL);
+    dreturn("%i", -1);
+    return -1;
+  }
+
+  memset(&E, 0, sizeof(gd_entry_t));
+  E.field = (char *)field_code;
+  E.field_type = GD_WINDOW_ENTRY;
+  E.EN(window,threshold) = threshold;
+  E.EN(window,windop) = windop;
+  E.in_fields[0] = (char *)in_field;
+  E.in_fields[1] = (char *)check_field;
+  E.fragment_index = fragment_index;
+  error = (_GD_Add(D, &E, NULL) == NULL) ? -1 : 0;
+
+  dreturn("%i", error);
+  return error;
+}
+
+/* add a MPLEX entry */
+int gd_add_mplex(DIRFILE *D, const char *field_code, const char *in_field,
+    const char *count_field, int count_val, int period, int fragment_index)
+  gd_nothrow
+{
+  gd_entry_t E;
+  int error;
+
+  dtrace("%p, \"%s\", \"%s\", \"%s\", %i, %i, %i", D, field_code, in_field,
+      count_field, count_val, period, fragment_index);
+
+  if (D->flags & GD_INVALID) {/* don't crash */
+    _GD_SetError(D, GD_E_BAD_DIRFILE, 0, NULL, 0, NULL);
+    dreturn("%i", -1);
+    return -1;
+  }
+
+  memset(&E, 0, sizeof(gd_entry_t));
+  E.field = (char *)field_code;
+  E.field_type = GD_MPLEX_ENTRY;
+  E.EN(mplex,count_val) = count_val;
+  E.EN(mplex,period) = period;
+  E.in_fields[0] = (char *)in_field;
+  E.in_fields[1] = (char *)count_field;
+  E.fragment_index = fragment_index;
+  error = (_GD_Add(D, &E, NULL) == NULL) ? -1 : 0;
 
   dreturn("%i", error);
   return error;
@@ -1106,7 +1307,6 @@ int gd_add_string(DIRFILE* D, const char* field_code, const char* value,
 {
   gd_entry_t *entry;
   gd_entry_t S;
-  int error;
 
   dtrace("%p, \"%s\", \"%s\", %i", D, field_code, value, fragment_index);
 
@@ -1120,23 +1320,14 @@ int gd_add_string(DIRFILE* D, const char* field_code, const char* value,
   S.field = (char *)field_code;
   S.field_type = GD_STRING_ENTRY;
   S.fragment_index = fragment_index;
-  error = _GD_Add(D, &S, NULL);
+  entry = _GD_Add(D, &S, NULL);
 
   /* Actually store the string, now */
-  if (!error) {
-    entry = _GD_FindField(D, field_code, D->entry, D->n_entries, NULL);
-
-    if (entry == NULL)
-      _GD_InternalError(D); /* We should be able to find it: we just added it */
-    else
-      _GD_DoFieldOut(D, entry, 0, 0, 0, GD_NULL, value);
+  if (entry)
+    _GD_DoStringOut(D, entry, value);
 
-    if (D->error)
-      error = -1;
-  }
-
-  dreturn("%i", error);
-  return error;
+  dreturn("%i", D->error ? -1 : 0);
+  return D->error ? -1 : 0;
 }
 
 /* add a CONST entry */
@@ -1145,9 +1336,8 @@ int gd_add_const(DIRFILE* D, const char* field_code, gd_type_t const_type,
 {
   gd_entry_t *entry;
   gd_entry_t C;
-  int error;
 
-  dtrace("%p, \"%s\", 0x%x, 0x%x, %p, %i", D, field_code, const_type, data_type,
+  dtrace("%p, \"%s\", 0x%X, 0x%X, %p, %i", D, field_code, const_type, data_type,
       value, fragment_index);
 
   if (D->flags & GD_INVALID) {/* don't crash */
@@ -1161,23 +1351,14 @@ int gd_add_const(DIRFILE* D, const char* field_code, gd_type_t const_type,
   C.field_type = GD_CONST_ENTRY;
   C.EN(scalar,const_type) = const_type;
   C.fragment_index = fragment_index;
-  error = _GD_Add(D, &C, NULL);
+  entry = _GD_Add(D, &C, NULL);
 
   /* Actually store the constant, now */
-  if (!error) {
-    entry = _GD_FindField(D, field_code, D->entry, D->n_entries, NULL);
-
-    if (entry == NULL)
-      _GD_InternalError(D); /* We should be able to find it: we just added it */
-    else
-      _GD_DoFieldOut(D, entry, 0, 0, 1, data_type, value);
+  if (entry)
+    _GD_DoFieldOut(D, entry, 0, 0, 1, data_type, value);
 
-    if (D->error)
-      error = -1;
-  }
-
-  dreturn("%i", error);
-  return error;
+  dreturn("%i", D->error ? -1 : 0);
+  return D->error ? -1 : 0;
 }
 
 /* add a CARRAY entry */
@@ -1187,10 +1368,9 @@ int gd_add_carray(DIRFILE* D, const char* field_code, gd_type_t const_type,
 {
   gd_entry_t *entry;
   gd_entry_t C;
-  int error;
 
-  dtrace("%p, \"%s\", 0x%x, %zi, 0x%x, %p, %i", D, field_code, const_type,
-      array_len, data_type, values, fragment_index);
+  dtrace("%p, \"%s\", 0x%X, %" PRNsize_t ", 0x%X, %p, %i", D, field_code,
+      const_type, array_len, data_type, values, fragment_index);
 
   if (D->flags & GD_INVALID) {
     _GD_SetError(D, GD_E_BAD_DIRFILE, 0, NULL, 0, NULL);
@@ -1204,23 +1384,14 @@ int gd_add_carray(DIRFILE* D, const char* field_code, gd_type_t const_type,
   C.EN(scalar,const_type) = const_type;
   C.EN(scalar,array_len) = array_len;
   C.fragment_index = fragment_index;
-  error = _GD_Add(D, &C, NULL);
+  entry = _GD_Add(D, &C, NULL);
 
   /* Actually store the carray, now */
-  if (!error) {
-    entry = _GD_FindField(D, field_code, D->entry, D->n_entries, NULL);
-
-    if (entry == NULL)
-      _GD_InternalError(D); /* We should be able to find it: we just added it */
-    else
-      _GD_DoFieldOut(D, entry, 0, 0, array_len, data_type, values);
+  if (entry)
+    _GD_DoFieldOut(D, entry, 0, 0, array_len, data_type, values);
 
-    if (D->error)
-      error = -1;
-  }
-
-  dreturn("%i", error);
-  return error;
+  dreturn("%i", D->error ? -1 : 0);
+  return D->error ? -1 : 0;
 }
 
 int gd_madd(DIRFILE* D, const gd_entry_t* entry, const char* parent) gd_nothrow
@@ -1235,7 +1406,7 @@ int gd_madd(DIRFILE* D, const gd_entry_t* entry, const char* parent) gd_nothrow
     return -1;
   }
 
-  ret = _GD_Add(D, entry, parent);
+  ret = (_GD_Add(D, entry, parent) == NULL) ? -1 : 0;
 
   dreturn("%i", ret);
   return ret;
@@ -1244,7 +1415,7 @@ int gd_madd(DIRFILE* D, const gd_entry_t* entry, const char* parent) gd_nothrow
 /* add a META LINCOM entry */
 int gd_madd_lincom(DIRFILE* D, const char* parent, const char* field_code,
     int n_fields, const char** in_fields, const double* m, const double* b)
-gd_nothrow
+  gd_nothrow
 {
   int i, error;
   gd_entry_t L;
@@ -1259,12 +1430,12 @@ gd_nothrow
   }
 
   if (n_fields < 1 || n_fields > GD_MAX_LINCOM) {
-    _GD_SetError(D, GD_E_BAD_ENTRY, GD_E_BAD_ENTRY_NFIELDS, NULL, n_fields,
-        NULL);
+    _GD_SetError(D, GD_E_BAD_ENTRY, GD_E_ENTRY_NFIELDS, NULL, n_fields, NULL);
     dreturn("%i", -1);
     return -1;
   }
 
+  memset(&L, 0, sizeof(gd_entry_t));
   L.field = (char *)field_code;
   L.field_type = GD_LINCOM_ENTRY;
   L.EN(lincom,n_fields) = n_fields;
@@ -1278,7 +1449,7 @@ gd_nothrow
     L.scalar[i] = NULL;
     L.scalar[i + GD_MAX_LINCOM] = NULL;
   }
-  error = _GD_Add(D, &L, parent);
+  error = (_GD_Add(D, &L, parent) == NULL) ? -1 : 0;
 
   dreturn("%i", error);
   return error;
@@ -1302,12 +1473,12 @@ int gd_madd_clincom(DIRFILE* D, const char* parent, const char* field_code,
   }
 
   if (n_fields < 1 || n_fields > GD_MAX_LINCOM) {
-    _GD_SetError(D, GD_E_BAD_ENTRY, GD_E_BAD_ENTRY_NFIELDS, NULL, n_fields,
-        NULL);
+    _GD_SetError(D, GD_E_BAD_ENTRY, GD_E_ENTRY_NFIELDS, NULL, n_fields, NULL);
     dreturn("%i", -1);
     return -1;
   }
 
+  memset(&L, 0, sizeof(gd_entry_t));
   L.field = (char *)field_code;
   L.field_type = GD_LINCOM_ENTRY;
   L.EN(lincom,n_fields) = n_fields;
@@ -1316,12 +1487,12 @@ int gd_madd_clincom(DIRFILE* D, const char* parent, const char* field_code,
 
   for (i = 0; i < n_fields; ++i) {
     L.in_fields[i] = (char *)in_fields[i];
-    _gd_ca2c(L.EN(lincom,cm)[i], cm, i);
-    _gd_ca2c(L.EN(lincom,cb)[i], cb, i);
+    gd_ca2cs_(L.EN(lincom,cm)[i], cm, i);
+    gd_ca2cs_(L.EN(lincom,cb)[i], cb, i);
     L.scalar[i] = NULL;
     L.scalar[i + GD_MAX_LINCOM] = NULL;
   }
-  error = _GD_Add(D, &L, parent);
+  error = (_GD_Add(D, &L, parent) == NULL) ? -1 : 0;
 
   dreturn("%i", error);
   return error;
@@ -1343,12 +1514,13 @@ int gd_madd_linterp(DIRFILE* D, const char* parent,
     return -1;
   }
 
+  memset(&L, 0, sizeof(gd_entry_t));
   L.field = (char *)field_code;
   L.field_type = GD_LINTERP_ENTRY;
   L.in_fields[0] = (char *)in_field;
   L.EN(linterp,table) = (char *)table;
   L.fragment_index = 0;
-  error = _GD_Add(D, &L, parent);
+  error = (_GD_Add(D, &L, parent) == NULL) ? -1 : 0;
 
   dreturn("%i", error);
   return error;
@@ -1356,7 +1528,7 @@ int gd_madd_linterp(DIRFILE* D, const char* parent,
 
 /* add a META BIT entry */
 int gd_madd_bit(DIRFILE* D, const char* parent, const char* field_code,
-    const char* in_field, gd_bit_t bitnum, gd_bit_t numbits) gd_nothrow
+    const char* in_field, int bitnum, int numbits) gd_nothrow
 {
   gd_entry_t B;
   int error;
@@ -1370,6 +1542,7 @@ int gd_madd_bit(DIRFILE* D, const char* parent, const char* field_code,
     return -1;
   }
 
+  memset(&B, 0, sizeof(gd_entry_t));
   B.field = (char *)field_code;
   B.field_type = GD_BIT_ENTRY;
   B.in_fields[0] = (char *)in_field;
@@ -1377,7 +1550,7 @@ int gd_madd_bit(DIRFILE* D, const char* parent, const char* field_code,
   B.EN(bit,numbits) = numbits;
   B.fragment_index = 0;
   B.scalar[0] = B.scalar[1] = NULL;
-  error = _GD_Add(D, &B, parent);
+  error = (_GD_Add(D, &B, parent) == NULL) ? -1 : 0;
 
   dreturn("%i", error);
   return error;
@@ -1385,7 +1558,7 @@ int gd_madd_bit(DIRFILE* D, const char* parent, const char* field_code,
 
 /* add a META SBIT entry */
 int gd_madd_sbit(DIRFILE* D, const char* parent, const char* field_code,
-    const char* in_field, gd_bit_t bitnum, gd_bit_t numbits) gd_nothrow
+    const char* in_field, int bitnum, int numbits) gd_nothrow
 {
   gd_entry_t B;
   int error;
@@ -1399,6 +1572,7 @@ int gd_madd_sbit(DIRFILE* D, const char* parent, const char* field_code,
     return -1;
   }
 
+  memset(&B, 0, sizeof(gd_entry_t));
   B.field = (char *)field_code;
   B.field_type = GD_SBIT_ENTRY;
   B.in_fields[0] = (char *)in_field;
@@ -1406,7 +1580,7 @@ int gd_madd_sbit(DIRFILE* D, const char* parent, const char* field_code,
   B.EN(bit,numbits) = numbits;
   B.fragment_index = 0;
   B.scalar[0] = B.scalar[1] = NULL;
-  error = _GD_Add(D, &B, parent);
+  error = (_GD_Add(D, &B, parent) == NULL) ? -1 : 0;
 
   dreturn("%i", error);
   return error;
@@ -1428,12 +1602,13 @@ int gd_madd_multiply(DIRFILE* D, const char* parent, const char* field_code,
     return -1;
   }
 
+  memset(&M, 0, sizeof(gd_entry_t));
   M.field = (char *)field_code;
   M.field_type = GD_MULTIPLY_ENTRY;
   M.in_fields[0] = (char *)in_field1;
   M.in_fields[1] = (char *)in_field2;
   M.fragment_index = 0;
-  error = _GD_Add(D, &M, parent);
+  error = (_GD_Add(D, &M, parent) == NULL) ? -1 : 0;
 
   dreturn("%i", error);
   return error;
@@ -1455,13 +1630,14 @@ int gd_madd_phase(DIRFILE* D, const char* parent, const char* field_code,
     return -1;
   }
 
+  memset(&P, 0, sizeof(gd_entry_t));
   P.field = (char *)field_code;
   P.field_type = GD_PHASE_ENTRY;
   P.in_fields[0] = (char *)in_field;
   P.EN(phase,shift) = shift;
   P.fragment_index = 0;
   P.scalar[0] = NULL;
-  error = _GD_Add(D, &P, parent);
+  error = (_GD_Add(D, &P, parent) == NULL) ? -1 : 0;
 
   dreturn("%i", error);
   return error;
@@ -1484,12 +1660,12 @@ int gd_madd_polynom(DIRFILE* D, const char* parent, const char* field_code,
   }
 
   if (poly_ord < 1 || poly_ord > GD_MAX_POLYORD) {
-    _GD_SetError(D, GD_E_BAD_ENTRY, GD_E_BAD_ENTRY_POLYORD, NULL, poly_ord,
-        NULL);
+    _GD_SetError(D, GD_E_BAD_ENTRY, GD_E_ENTRY_POLYORD, NULL, poly_ord, NULL);
     dreturn("%i", -1);
     return -1;
   }
 
+  memset(&E, 0, sizeof(gd_entry_t));
   E.field = (char *)field_code;
   E.field_type = GD_POLYNOM_ENTRY;
   E.EN(polynom,poly_ord) = poly_ord;
@@ -1502,7 +1678,7 @@ int gd_madd_polynom(DIRFILE* D, const char* parent, const char* field_code,
     E.scalar[i] = NULL;
   }
 
-  error = _GD_Add(D, &E, parent);
+  error = (_GD_Add(D, &E, parent) == NULL) ? -1 : 0;
 
   dreturn("%i", error);
   return error;
@@ -1525,12 +1701,12 @@ int gd_madd_cpolynom(DIRFILE* D, const char* parent, const char* field_code,
   }
 
   if (poly_ord < 1 || poly_ord > GD_MAX_POLYORD) {
-    _GD_SetError(D, GD_E_BAD_ENTRY, GD_E_BAD_ENTRY_POLYORD, NULL, poly_ord,
-        NULL);
+    _GD_SetError(D, GD_E_BAD_ENTRY, GD_E_ENTRY_POLYORD, NULL, poly_ord, NULL);
     dreturn("%i", -1);
     return -1;
   }
 
+  memset(&E, 0, sizeof(gd_entry_t));
   E.field = (char *)field_code;
   E.field_type = GD_POLYNOM_ENTRY;
   E.EN(polynom,poly_ord) = poly_ord;
@@ -1539,11 +1715,11 @@ int gd_madd_cpolynom(DIRFILE* D, const char* parent, const char* field_code,
   E.in_fields[0] = (char *)in_field;
 
   for (i = 0; i <= poly_ord; ++i) {
-    _gd_ca2c(E.EN(polynom,ca)[i], ca, i);
+    gd_ca2cs_(E.EN(polynom,ca)[i], ca, i);
     E.scalar[i] = NULL;
   }
 
-  error = _GD_Add(D, &E, parent);
+  error = (_GD_Add(D, &E, parent) == NULL) ? -1 : 0;
 
   dreturn("%i", error);
   return error;
@@ -1570,7 +1746,7 @@ int gd_madd_divide(DIRFILE* D, const char *parent, const char* field_code,
   E.field_type = GD_DIVIDE_ENTRY;
   E.in_fields[0] = (char *)in_field1;
   E.in_fields[1] = (char *)in_field2;
-  error = _GD_Add(D, &E, parent);
+  error = (_GD_Add(D, &E, parent) == NULL) ? -1 : 0;
 
   dreturn("%i", error);
   return error;
@@ -1598,7 +1774,7 @@ int gd_madd_recip(DIRFILE* D, const char *parent, const char* field_code,
   E.EN(recip,dividend) = dividend;
   E.comp_scal = 0;
   E.in_fields[0] = (char *)in_field;
-  error = _GD_Add(D, &E, parent);
+  error = (_GD_Add(D, &E, parent) == NULL) ? -1 : 0;
 
   dreturn("%i", error);
   return error;
@@ -1608,6 +1784,8 @@ int gd_madd_recip(DIRFILE* D, const char *parent, const char* field_code,
 int gd_madd_crecip(DIRFILE* D, const char *parent, const char* field_code, const
     char* in_field, double complex cdividend)
 {
+  int error;
+
   dtrace("%p, \"%s\", \"%s\", \"%s\", %g;%g", D, parent, field_code, in_field,
       creal(cdividend), cimag(cdividend));
 
@@ -1624,7 +1802,7 @@ int gd_madd_crecip(DIRFILE* D, const char *parent, const char* field_code, const
   E.EN(recip,cdividend) = cdividend;
   E.comp_scal = 1;
   E.in_fields[0] = (char *)in_field;
-  int error = _GD_Add(D, &E, parent);
+  error = (_GD_Add(D, &E, parent) == NULL) ? -1 : 0;
 
   dreturn("%i", error);
   return error;
@@ -1649,10 +1827,71 @@ int gd_madd_crecip89(DIRFILE* D, const char *parent, const char* field_code,
   memset(&E, 0, sizeof(gd_entry_t));
   E.field = (char *)field_code;
   E.field_type = GD_RECIP_ENTRY;
-  _gd_a2c(E.EN(recip,cdividend), cdividend);
+  gd_ra2cs_(E.EN(recip,cdividend), cdividend);
   E.comp_scal = 1;
   E.in_fields[0] = (char *)in_field;
-  error = _GD_Add(D, &E, parent);
+  error = (_GD_Add(D, &E, parent) == NULL) ? -1 : 0;
+
+  dreturn("%i", error);
+  return error;
+}
+
+/* add a META WINDOW entry */
+int gd_madd_window(DIRFILE *D, const char *parent, const char *field_code,
+    const char *in_field, const char *check_field, gd_windop_t windop,
+    gd_triplet_t threshold) gd_nothrow
+{
+  int error;
+  gd_entry_t E;
+
+  dtrace("%p, \"%s\", \"%s\", \"%s\", \"%s\", %i, {%g,%llx,%lli}", D, parent,
+      field_code, in_field, check_field, windop, threshold.r,
+      (unsigned long long)threshold.u, (long long)threshold.i);
+
+  if (D->flags & GD_INVALID) {/* don't crash */
+    _GD_SetError(D, GD_E_BAD_DIRFILE, 0, NULL, 0, NULL);
+    dreturn("%i", -1);
+    return -1;
+  }
+
+  memset(&E, 0, sizeof(gd_entry_t));
+  E.field = (char *)field_code;
+  E.field_type = GD_WINDOW_ENTRY;
+  E.EN(window,threshold) = threshold;
+  E.EN(window,windop) = windop;
+  E.in_fields[0] = (char *)in_field;
+  E.in_fields[1] = (char *)check_field;
+  error = (_GD_Add(D, &E, parent) == NULL) ? -1 : 0;
+
+  dreturn("%i", error);
+  return error;
+}
+
+/* add a META MPLEX entry */
+int gd_madd_mplex(DIRFILE *D, const char *parent, const char *field_code,
+    const char *in_field, const char *count_field, int count_val, int period)
+  gd_nothrow
+{
+  int error;
+  gd_entry_t E;
+
+  dtrace("%p, \"%s\", \"%s\", \"%s\", \"%s\", %i, %i", D, parent, field_code,
+      in_field, count_field, count_val, period);
+
+  if (D->flags & GD_INVALID) {/* don't crash */
+    _GD_SetError(D, GD_E_BAD_DIRFILE, 0, NULL, 0, NULL);
+    dreturn("%i", -1);
+    return -1;
+  }
+
+  memset(&E, 0, sizeof(gd_entry_t));
+  E.field = (char *)field_code;
+  E.field_type = GD_MPLEX_ENTRY;
+  E.EN(mplex,count_val) = count_val;
+  E.EN(mplex,period) = period;
+  E.in_fields[0] = (char *)in_field;
+  E.in_fields[1] = (char *)count_field;
+  error = (_GD_Add(D, &E, parent) == NULL) ? -1 : 0;
 
   dreturn("%i", error);
   return error;
@@ -1662,8 +1901,6 @@ int gd_madd_crecip89(DIRFILE* D, const char *parent, const char* field_code,
 int gd_madd_string(DIRFILE* D, const char* parent,
     const char* field_code, const char* value) gd_nothrow
 {
-  char *buffer;
-  int error;
   gd_entry_t *entry;
   gd_entry_t S;
 
@@ -1675,47 +1912,28 @@ int gd_madd_string(DIRFILE* D, const char* parent,
     return -1;
   }
 
+  memset(&S, 0, sizeof(gd_entry_t));
   S.field = (char *)field_code;
   S.field_type = GD_STRING_ENTRY;
   S.fragment_index = 0;
-  error = _GD_Add(D, &S, parent);
+  entry = _GD_Add(D, &S, parent);
 
   /* Actually store the string, now */
-  if (!error) {
-    buffer = (char *)malloc(strlen(parent) + strlen(field_code) + 2);
-    if (buffer == NULL) {
-      _GD_SetError(D, GD_E_ALLOC, 0, NULL, 0, NULL);
-      dreturn("%i", -1);
-      return -1;
-    }
-
-    sprintf(buffer, "%s/%s", parent, field_code);
-    entry = _GD_FindField(D, buffer, D->entry, D->n_entries, NULL);
-    free(buffer);
-
-    if (entry == NULL)
-      _GD_InternalError(D); /* We should be able to find it: we just added it */
-    else
-      _GD_DoFieldOut(D, entry, 0, 0, 0, GD_NULL, value);
-
-    if (D->error)
-      error = -1;
-  }
+  if (entry)
+    _GD_DoStringOut(D, entry, value);
 
-  dreturn("%i", error);
-  return error;
+  dreturn("%i", D->error ? -1 : 0);
+  return D->error ? -1 : 0;
 }
 
 /* add a META CONST entry */
 int gd_madd_const(DIRFILE* D, const char* parent, const char* field_code,
     gd_type_t const_type, gd_type_t data_type, const void* value) gd_nothrow
 {
-  char *buffer;
-  int error;
   gd_entry_t *entry;
   gd_entry_t C;
 
-  dtrace("%p, \"%s\", \"%s\", 0x%x, 0x%x, %p", D, parent, field_code,
+  dtrace("%p, \"%s\", \"%s\", 0x%X, 0x%X, %p", D, parent, field_code,
       const_type, data_type, value);
 
   if (D->flags & GD_INVALID) {/* don't crash */
@@ -1724,36 +1942,19 @@ int gd_madd_const(DIRFILE* D, const char* parent, const char* field_code,
     return -1;
   }
 
+  memset(&C, 0, sizeof(gd_entry_t));
   C.field = (char *)field_code;
   C.field_type = GD_CONST_ENTRY;
   C.EN(scalar,const_type) = const_type;
   C.fragment_index = 0;
-  error = _GD_Add(D, &C, parent);
+  entry = _GD_Add(D, &C, parent);
 
   /* Actually store the constant, now */
-  if (!error) {
-    buffer = (char *)malloc(strlen(parent) + strlen(field_code) + 2);
-    if (buffer == NULL) {
-      _GD_SetError(D, GD_E_ALLOC, 0, NULL, 0, NULL);
-      dreturn("%i", -1);
-      return -1;
-    }
+  if (entry)
+    _GD_DoFieldOut(D, entry, 0, 0, 1, data_type, value);
 
-    sprintf(buffer, "%s/%s", parent, field_code);
-    entry = _GD_FindField(D, buffer, D->entry, D->n_entries, NULL);
-    free(buffer);
-
-    if (entry == NULL)
-      _GD_InternalError(D); /* We should be able to find it: we just added it */
-    else
-      _GD_DoFieldOut(D, entry, 0, 0, 1, data_type, value);
-
-    if (D->error)
-      error = -1;
-  }
-
-  dreturn("%i", error);
-  return error;
+  dreturn("%i", D->error ? -1 : 0);
+  return D->error ? -1 : 0;
 }
 
 /* add a META CARRAY entry */
@@ -1761,13 +1962,11 @@ int gd_madd_carray(DIRFILE* D, const char* parent, const char* field_code,
     gd_type_t const_type, size_t array_len, gd_type_t data_type,
     const void* values) gd_nothrow
 {
-  char *buffer;
-  int error;
   gd_entry_t *entry;
   gd_entry_t C;
 
-  dtrace("%p, \"%s\", \"%s\", 0x%x, %zi 0x%x, %p", D, parent, field_code,
-      const_type, array_len, data_type, values);
+  dtrace("%p, \"%s\", \"%s\", 0x%X, %" PRNsize_t ", 0x%X, %p", D, parent,
+      field_code, const_type, array_len, data_type, values);
 
   if (D->flags & GD_INVALID) {/* don't crash */
     _GD_SetError(D, GD_E_BAD_DIRFILE, 0, NULL, 0, NULL);
@@ -1775,35 +1974,186 @@ int gd_madd_carray(DIRFILE* D, const char* parent, const char* field_code,
     return -1;
   }
 
+  memset(&C, 0, sizeof(gd_entry_t));
   C.field = (char *)field_code;
   C.field_type = GD_CARRAY_ENTRY;
   C.EN(scalar,const_type) = const_type;
   C.EN(scalar,array_len) = array_len;
   C.fragment_index = 0;
-  error = _GD_Add(D, &C, parent);
+  entry = _GD_Add(D, &C, parent);
 
   /* Actually store the carray, now */
-  if (!error) {
-    buffer = (char *)malloc(strlen(parent) + strlen(field_code) + 2);
-    if (buffer == NULL) {
-      _GD_SetError(D, GD_E_ALLOC, 0, NULL, 0, NULL);
-      dreturn("%i", -1);
-      return -1;
+  if (entry)
+    _GD_DoFieldOut(D, entry, 0, 0, array_len, data_type, values);
+
+  dreturn("%i", D->error ? -1 : 0);
+  return D->error ? -1 : 0;
+}
+
+/* add an alias */
+static int _GD_AddAlias(DIRFILE *restrict D, const char *restrict parent,
+    const char *restrict field_code, const char *restrict target,
+    int fragment_index)
+{
+  unsigned u;
+  int offset;
+  char *munged_code = NULL;
+  void *ptr;
+  gd_entry_t *E = NULL, *P = NULL;
+  dtrace("%p, \"%s\", \"%s\", \"%s\", %i", D, parent, field_code, target,
+      fragment_index);
+
+  /* Early checks */
+  if (D->flags & GD_INVALID)
+    _GD_SetError(D, GD_E_BAD_DIRFILE, 0, NULL, 0, NULL);
+  else if ((D->flags & GD_ACCMODE) == GD_RDONLY)
+    _GD_SetError(D, GD_E_ACCMODE, 0, NULL, 0, NULL);
+  else if (fragment_index < 0 || fragment_index >= D->n_fragment)
+    _GD_SetError(D, GD_E_BAD_INDEX, 0, NULL, fragment_index, NULL);
+  else if (D->fragment[fragment_index].protection & GD_PROTECT_FORMAT)
+    _GD_SetError(D, GD_E_PROTECTED, GD_E_PROTECTED_FORMAT, NULL, 0,
+        D->fragment[fragment_index].cname);
+
+  if (D->error) {
+    dreturn("%i", -1);
+    return -1;
+  }
+
+  _GD_ClearError(D);
+
+  if (parent != NULL) {
+    /* look for parent */
+    P = _GD_FindField(D, parent, D->entry, D->n_entries, 1, NULL);
+    if (P == NULL) {
+      _GD_SetError(D, GD_E_BAD_CODE, GD_E_CODE_MISSING, NULL, 0, parent);
+      goto add_alias_error;
     }
+    fragment_index = P->fragment_index;
+
+    /* make sure it's not a meta field already */
+    if (P->e->n_meta == -1) {
+      _GD_SetError(D, GD_E_BAD_CODE, GD_E_CODE_INVALID, NULL, 0, parent);
+      goto add_alias_error;
+    }
+
+    offset = strlen(parent) + 1;
+    munged_code = (char *)_GD_Malloc(D, offset + strlen(field_code) + 1);
+    if (munged_code) {
+      strcpy(munged_code, parent);
+      munged_code[offset - 1] = '/';
+      strcpy(munged_code + offset, field_code);
+    }
+  } else
+    /* this will check for affixes and take care of detecting Barth-style
+     * metafield definitions */
+    P = _GD_FixName(D, &munged_code, field_code, fragment_index, &offset);
+
+  if (D->error)
+    goto add_alias_error;
+
+  /* check alias name */
+  if (munged_code && _GD_ValidateField(munged_code + offset, D->standards, 1, 0,
+        NULL))
+  {
+    _GD_SetError(D, GD_E_BAD_CODE, GD_E_CODE_INVALID, NULL, 0, field_code);
+  } else if (_GD_FindField(D, munged_code, D->entry, D->n_entries, 1, &u))
+    _GD_SetError(D, GD_E_DUPLICATE, 0, NULL, 0, munged_code);
+  else
+    _GD_CheckCodeAffixes(D, NULL, target, fragment_index); /* check target */
+
+  if (D->error)
+    goto add_alias_error;
+
+  ptr = _GD_Realloc(D, D->entry, (D->n_entries + 1) * sizeof(gd_entry_t*));
+  if (ptr == NULL)
+    goto add_alias_error;
+  D->entry = (gd_entry_t **)ptr;
+
+  /* create and store */
+  E = (gd_entry_t *)_GD_Malloc(D, sizeof(gd_entry_t));
+  if (E == NULL)
+    goto add_alias_error;
+
+  memset(E, 0, sizeof(gd_entry_t));
+  E->e = (struct gd_private_entry_ *)_GD_Malloc(D,
+      sizeof(struct gd_private_entry_));
+  if (E->e == NULL)
+    goto add_alias_error;
+
+  memset(E->e, 0, sizeof(struct gd_private_entry_));
+
+  E->field = munged_code;
+  E->fragment_index = fragment_index;
+  E->in_fields[0] = _GD_Strdup(D, target);
+  E->field_type = GD_ALIAS_ENTRY;
+  E->e->calculated = 1;
 
-    sprintf(buffer, "%s/%s", parent, field_code);
-    entry = _GD_FindField(D, buffer, D->entry, D->n_entries, NULL);
-    free(buffer);
+  if (D->error) {
+    _GD_FreeE(D, E, 1);
+    dreturn("%i", -1);
+    return -1;
+  }
 
-    if (entry == NULL)
-      _GD_InternalError(D); /* We should be able to find it: we just added it */
-    else
-      _GD_DoFieldOut(D, entry, 0, 0, array_len, data_type, values);
+  /* add the entry and resort the entry list */
+  _GD_InsertSort(D, E, u);
+  D->n_entries++;
+  D->fragment[fragment_index].modified = 1;
+  D->flags &= ~GD_HAVE_VERSION;
 
-    if (D->error)
-      error = -1;
+  /* Invalidate the field lists */
+  if (P) {
+    P->e->value_list_validity = 0;
+    P->e->entry_list_validity = 0;
+  } else {
+    D->value_list_validity = 0;
+    D->entry_list_validity = 0;
   }
 
-  dreturn("%i", error);
-  return error;
+  /* Update aliases */
+  _GD_UpdateAliases(D, 0);
+
+  dreturn("%i", 0);
+  return 0;
+
+add_alias_error:
+  free(E);
+  free(munged_code);
+  dreturn("%i", -1);
+  return -1;
+}
+
+int gd_add_alias(DIRFILE *D, const char *alias_name, const char *target_code,
+    int fragment_index) gd_nothrow
+{
+  int ret;
+
+  dtrace("%p, \"%s\", \"%s\", %i", D, alias_name, target_code, fragment_index);
+
+  if (D->flags & GD_INVALID) {
+    _GD_SetError(D, GD_E_BAD_DIRFILE, 0, NULL, 0, NULL);
+    dreturn("%i", -1);
+    return -1;
+  }
+
+  _GD_ClearError(D);
+
+  ret = _GD_AddAlias(D, NULL, alias_name, target_code, fragment_index);
+
+  dreturn("%i", ret);
+  return ret;
+}
+
+int gd_madd_alias(DIRFILE *D, const char *parent, const char *alias_name,
+    const char *target_code) gd_nothrow
+{
+  int ret;
+
+  dtrace("%p, \"%s\", \"%s\", \"%s\"", D, parent, alias_name, target_code);
+
+  _GD_ClearError(D);
+
+  ret = _GD_AddAlias(D, parent, alias_name, target_code, 0);
+
+  dreturn("%i", ret);
+  return ret;
 }
diff --git a/src/ascii.c b/src/ascii.c
index 89b496c..d5ff21a 100644
--- a/src/ascii.c
+++ b/src/ascii.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2010 D. V. Wiebe
+/* Copyright (C) 2008-2011 D. V. Wiebe
  *
  ***************************************************************************
  *
@@ -20,70 +20,74 @@
  */
 #include "internal.h"
 
-#ifdef STDC_HEADERS
-#include <stdlib.h>
-#include <inttypes.h>
-#include <sys/stat.h>
-#include <sys/types.h>
-#include <fcntl.h>
-#include <stdio.h>
-#include <string.h>
-#include <errno.h>
-#endif
-
-/* The ASCII encoding uses file->fp as to indicate the current line and
- * file->edata for the stream pointer */
+/* The ASCII encoding uses file->edata for the stream pointer */
 
-int _GD_AsciiOpen(struct _gd_raw_file* file, int mode, int creat)
+int _GD_AsciiOpen(int fd, struct gd_raw_file_* file, int swap gd_unused_,
+    unsigned int mode)
 {
-  int fp;
+  dtrace("%i, %p, <unused>, %u", fd, file, mode);
 
-  dtrace("%p, %i, %i", file, mode, creat);
+  if (!(mode & GD_FILE_TEMP)) {
+    if (file->mode & mode) {
+      dreturn("%i", 0);
+      return 0;
+    } else if (file->edata != NULL)
+      fclose((FILE*)file->edata);
 
-  fp = open(file->name, ((mode == GD_RDWR) ? O_RDWR : O_RDONLY) |
-      (creat ? O_CREAT : 0) | O_BINARY, 0666);
+    file->idata = gd_OpenAt(file->D, fd, file->name, ((mode & GD_FILE_WRITE)
+          ? (O_RDWR | O_CREAT) : O_RDONLY) | O_BINARY, 0666);
 
-  file->edata = fdopen(fp, (mode == GD_RDWR) ? "r+" : "r");
+    if (file->idata < 0) {
+      dreturn("%i", -1);
+      return -1;
+    }
+  } else
+    file->idata = fd;
 
-  if (file->edata != NULL) {
-    file->fp = 0;
-    dreturn("%i", 0);
-    return 0;
+  file->edata = fdopen(file->idata, (mode & GD_FILE_WRITE) ? "rb+" : "rb");
+
+  if (file->edata == NULL) {
+    close(file->idata);
+    file->idata = -1;
+    dreturn("%i", -1);
+    return -1;
   }
 
-  dreturn("%i", -1);
-  return -1;
+  file->mode = mode | GD_FILE_READ;
+  file->pos = 0;
+  dreturn("%i", 0);
+  return 0;
 }
 
-off64_t _GD_AsciiSeek(struct _gd_raw_file* file, off64_t count,
-    gd_type_t data_type __gd_unused, int pad)
+off64_t _GD_AsciiSeek(struct gd_raw_file_* file, off64_t count,
+    gd_type_t data_type gd_unused_, unsigned int mode)
 {
   char line[64];
 
-  dtrace("%p, %lli, <unused>, %i", file, count, pad);
+  dtrace("%p, %lli, <unused>, 0x%X", file, (long long)count, mode);
 
-  if (count < file->fp) {
+  if (count < file->pos) {
     rewind((FILE *)file->edata);
-    file->fp = 0;
+    file->pos = 0;
   }
 
-  for (; count > file->fp; ++file->fp)
+  for (; count > file->pos; ++file->pos)
     if (fgets(line, 64, (FILE *)file->edata) == NULL)
       break;
 
-  if (pad && count > file->fp) {
+  if (mode & GD_FILE_WRITE && count > file->pos) {
     strcpy(line, "0\n");
-    for (; count > file->fp; ++file->fp)
+    for (; count > file->pos; ++file->pos)
       fputs(line, (FILE *)file->edata);
   }
 
-  dreturn("%i", file->fp);
-  return file->fp;
+  dreturn("%lli", (long long)file->pos);
+  return file->pos;
 }
 
 static void _GD_ScanFormat(char* fmt, gd_type_t data_type)
 {
-  dtrace("%p, %x", fmt, data_type);
+  dtrace("%p, 0x%X", fmt, data_type);
 
   switch(data_type) {
     case GD_UINT8:
@@ -134,8 +138,8 @@ static void _GD_ScanFormat(char* fmt, gd_type_t data_type)
   dreturn("[\"%s\"]", fmt);
 }
 
-ssize_t _GD_AsciiRead(struct _gd_raw_file *file, void *ptr, gd_type_t data_type,
-    size_t nmemb)
+ssize_t _GD_AsciiRead(struct gd_raw_file_ *restrict file, void *restrict ptr,
+    gd_type_t data_type, size_t nmemb)
 {
   char fmt[50];
   size_t n = 0;
@@ -144,7 +148,7 @@ ssize_t _GD_AsciiRead(struct _gd_raw_file *file, void *ptr, gd_type_t data_type,
   short int i16;
 #endif
 
-  dtrace("%p, %p, 0x%x, %zu", file, ptr, data_type, nmemb);
+  dtrace("%p, %p, 0x%X, %" PRNsize_t, file, ptr, data_type, nmemb);
 
   _GD_ScanFormat(fmt, data_type);
   if (data_type & GD_COMPLEX) {
@@ -159,7 +163,7 @@ ssize_t _GD_AsciiRead(struct _gd_raw_file *file, void *ptr, gd_type_t data_type,
           ret = -1;
         break;
       }
-      file->fp++;
+      file->pos++;
     }
   } else {
     for (n = 0; n < nmemb; ++n) {
@@ -189,7 +193,7 @@ ssize_t _GD_AsciiRead(struct _gd_raw_file *file, void *ptr, gd_type_t data_type,
           break;
         }
       }
-      file->fp++;
+      file->pos++;
     }
   }
 
@@ -197,13 +201,13 @@ ssize_t _GD_AsciiRead(struct _gd_raw_file *file, void *ptr, gd_type_t data_type,
   return (ret) ? ret : (ssize_t)n;
 }
 
-ssize_t _GD_AsciiWrite(struct _gd_raw_file *file, const void *ptr,
-    gd_type_t data_type, size_t nmemb)
+ssize_t _GD_AsciiWrite(struct gd_raw_file_ *restrict file,
+    const void *restrict ptr, gd_type_t data_type, size_t nmemb)
 {
   ssize_t ret = 0;
   size_t n = 0;
 
-  dtrace("%p, %p, 0x%x, %zu", file, ptr, data_type, nmemb);
+  dtrace("%p, %p, 0x%X, %" PRNsize_t, file, ptr, data_type, nmemb);
 
   switch(data_type) {
     case GD_UINT8:
@@ -319,7 +323,7 @@ ssize_t _GD_AsciiWrite(struct _gd_raw_file *file, const void *ptr,
   return (ret) ? ret : (ssize_t)n;
 }
 
-int _GD_AsciiSync(struct _gd_raw_file *file)
+int _GD_AsciiSync(struct gd_raw_file_ *file)
 {
   int ret;
 
@@ -327,41 +331,51 @@ int _GD_AsciiSync(struct _gd_raw_file *file)
 
   ret = fflush((FILE *)file->edata);
 
+#ifndef __MSVCRT__
   if (!ret)
     ret = fsync(fileno((FILE *)file->edata));
+#endif
 
   dreturn("%i", ret);
   return ret;
 }
 
-int _GD_AsciiClose(struct _gd_raw_file* file)
+int _GD_AsciiClose(struct gd_raw_file_* file)
 {
   int ret;
 
   dtrace("%p", file);
 
   ret = fclose((FILE *)file->edata);
-  if (ret != EOF) {
-    file->fp = -1;
-    dreturn("%i", 0);
-    return 0;
+  if (ret == EOF) {
+    dreturn("%i", 1);
+    return 1;
   }
 
-  dreturn("%i", 1);
-  return 1;
+  file->idata = -1;
+  file->mode = 0;
+  dreturn("%i", 0);
+  return 0;
 }
 
-off64_t _GD_AsciiSize(struct _gd_raw_file* file,
-    gd_type_t data_type __gd_unused)
+off64_t _GD_AsciiSize(int dirfd, struct gd_raw_file_* file,
+    gd_type_t data_type gd_unused_, int swap gd_unused_)
 {
   FILE* stream;
   char *buffer = NULL;
   size_t len = 0;
   off64_t n = 0;
+  int fd;
 
-  dtrace("%p, <unused>", file);
+  dtrace("%i, %p, <unused>, <unused>", dirfd, file);
+
+  fd = gd_OpenAt(file->D, dirfd, file->name, O_RDONLY, 0666);
+  if (fd < 0) {
+    dreturn("%i", -1);
+    return -1;
+  }
 
-  stream = fopen(file->name, "r");
+  stream = fdopen(fd, "rb");
 
   if (stream == NULL) {
     dreturn("%i", -1);
@@ -374,74 +388,6 @@ off64_t _GD_AsciiSize(struct _gd_raw_file* file,
 
   fclose(stream);
 
-  dreturn("%lli", n);
+  dreturn("%lli", (long long)n);
   return n;
 }
-
-int _GD_AsciiTemp(struct _gd_raw_file *file, int method)
-{
-  int move_error = 0;
-  struct stat stat_buf;
-  mode_t mode;
-  int fp;
-
-  dtrace("%p, %i", file, method);
-
-  switch(method) {
-    case GD_TEMP_OPEN:
-      fp = mkstemp(file[1].name);
-
-      file[1].edata = fdopen(fp, "r+");
-
-      if (file[1].edata == NULL) {
-        dreturn("%i", -1);
-        return -1;
-      }
-
-      file[1].fp = 0;
-      break;
-    case GD_TEMP_MOVE:
-      if (file[1].name == NULL)
-        break;
-
-      if (stat(file[0].name, &stat_buf))
-        mode = 0644;
-      else
-        mode = stat_buf.st_mode;
-
-      if (!_GD_Rename(file[1].name, file[0].name)) {
-        chmod(file[0].name, mode);
-        free(file[1].name);
-        file[1].name = NULL;
-        dreturn("%i", 0);
-        return 0;
-      }
-      move_error = errno;
-      /* fallthrough on error */
-    case GD_TEMP_DESTROY:
-      if (file[1].name != NULL) {
-        if (file[1].fp >= 0)
-          if (_GD_AsciiClose(file + 1)) {
-            dreturn("%i", -1);
-            return -1;
-          }
-
-        if (unlink(file[1].name)) {
-          dreturn("%i", -1);
-          return -1;
-        }
-
-        if (method == GD_TEMP_MOVE) {
-          errno = move_error;
-          dreturn("%i", -1);
-          return -1;
-        }
-        free(file[1].name);
-        file[1].name = NULL;
-      }
-      break;
-  }
-
-  dreturn("%i", 0);
-  return 0;
-}
diff --git a/src/bzip.c b/src/bzip.c
index 35f6b15..b8ca6c0 100644
--- a/src/bzip.c
+++ b/src/bzip.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2010 D. V. Wiebe
+/* Copyright (C) 2008-2011 D. V. Wiebe
  *
  ***************************************************************************
  *
@@ -20,14 +20,6 @@
  */
 #include "internal.h"
 
-#ifdef STDC_HEADERS
-#include <stdlib.h>
-#include <errno.h>
-#include <time.h>
-#include <stdio.h>
-#include <string.h>
-#endif
-
 #ifdef HAVE_BZLIB_H
 #include <bzlib.h>
 #endif
@@ -57,20 +49,28 @@ struct gd_bzdata {
 };
 
 /* The bzip encoding scheme uses edata as a gd_bzdata pointer.  If a file is
- * open, fp = 0 otherwise fp = -1. */
+ * open, idata = 0 otherwise idata = -1. */
 
-static struct gd_bzdata *_GD_Bzip2DoOpen(struct _gd_raw_file* file)
+static struct gd_bzdata *_GD_Bzip2DoOpen(int dirfd, struct gd_raw_file_* file)
 {
+  int fd;
   struct gd_bzdata *ptr;
 
-  dtrace("%p", file);
+  dtrace("%i, %p", dirfd, file);
 
   if ((ptr = (struct gd_bzdata *)malloc(sizeof(struct gd_bzdata))) == NULL) {
     dreturn("%p", NULL);
     return NULL;
   }
 
-  if ((ptr->stream = fopen(file->name, "rb")) == NULL) {
+  if ((fd = gd_OpenAt(file->D, dirfd, file->name, O_RDONLY, 0666)) == -1) {
+    free(ptr);
+    dreturn("%p", NULL);
+    return NULL;
+  }
+
+  if ((ptr->stream = fdopen(fd, "rb")) == NULL) {
+    close(fd);
     free(ptr);
     dreturn("%p", NULL);
     return NULL;
@@ -93,29 +93,30 @@ static struct gd_bzdata *_GD_Bzip2DoOpen(struct _gd_raw_file* file)
   return ptr;
 }
 
-int _GD_Bzip2Open(struct _gd_raw_file* file, int mode __gd_unused,
-    int creat __gd_unused)
+int _GD_Bzip2Open(int dirfd, struct gd_raw_file_* file, int swap gd_unused_,
+    unsigned int mode gd_unused_)
 {
-  dtrace("%p, <unused>, <unused>", file);
+  dtrace("%i, %p, <unused>, <unused>", dirfd, file);
 
-  file->edata = _GD_Bzip2DoOpen(file);
+  file->edata = _GD_Bzip2DoOpen(dirfd, file);
 
   if (file->edata == NULL) {
     dreturn("%i", 1);
     return 1;
   }
 
-  file->fp = 0;
+  file->mode = GD_FILE_READ;
+  file->idata = 0;
   dreturn("%i", 0);
   return 0;
 }
 
-off64_t _GD_Bzip2Seek(struct _gd_raw_file* file, off64_t count,
-    gd_type_t data_type, int pad __gd_unused)
+off64_t _GD_Bzip2Seek(struct gd_raw_file_* file, off64_t count,
+    gd_type_t data_type, unsigned int mode gd_unused_)
 {
   struct gd_bzdata *ptr = (struct gd_bzdata *)file->edata;
 
-  dtrace("%p, %lli, %x, <unused>", file, (long long)count, data_type);
+  dtrace("%p, %lli, 0x%X, <unused>", file, (long long)count, data_type);
 
   count *= GD_SIZE(data_type);
 
@@ -127,8 +128,8 @@ off64_t _GD_Bzip2Seek(struct _gd_raw_file* file, off64_t count,
 
     if (ptr->bzfile == NULL || ptr->bzerror != BZ_OK) {
       fclose(ptr->stream);
-      dreturn("%i", 1);
-      return 1;
+      dreturn("%i", -1);
+      return -1;
     }
     ptr->pos = ptr->end = 0;
     ptr->base = ptr->stream_end = 0;
@@ -164,14 +165,14 @@ off64_t _GD_Bzip2Seek(struct _gd_raw_file* file, off64_t count,
   return (ptr->base + ptr->pos) / GD_SIZE(data_type);
 }
 
-ssize_t _GD_Bzip2Read(struct _gd_raw_file *file, void *data,
+ssize_t _GD_Bzip2Read(struct gd_raw_file_ *restrict file, void *restrict data,
     gd_type_t data_type, size_t nmemb)
 {
   char* output = (char*)data;
   struct gd_bzdata *ptr = (struct gd_bzdata *)file->edata;
   unsigned long long nbytes = nmemb * GD_SIZE(data_type);
 
-  dtrace("%p, %p, %x, %zu", file, data, data_type, nmemb);
+  dtrace("%p, %p, 0x%X, %" PRNsize_t, file, data, data_type, nmemb);
 
   while (nbytes > (unsigned long long)(ptr->end - ptr->pos)) {
     int n;
@@ -220,32 +221,34 @@ ssize_t _GD_Bzip2Read(struct _gd_raw_file *file, void *data,
   return nmemb - nbytes / GD_SIZE(data_type);
 }
 
-int _GD_Bzip2Close(struct _gd_raw_file *file)
+int _GD_Bzip2Close(struct gd_raw_file_ *file)
 {
   struct gd_bzdata *ptr = (struct gd_bzdata *)file->edata;
   dtrace("%p", file);
 
   ptr->bzerror = 0;
   BZ2_bzReadClose(&ptr->bzerror, ptr->bzfile);
-  if (!fclose(ptr->stream)) {
-    file->fp = -1;
-    free(file->edata);
-    dreturn("%i", 0);
-    return 0;
+  if (fclose(ptr->stream)) {
+    dreturn("%i", 1);
+    return 1;
   }
 
-  dreturn("%i", 1);
-  return 1;
+  file->idata = -1;
+  file->mode = 0;
+  free(file->edata);
+  dreturn("%i", 0);
+  return 0;
 }
 
-off64_t _GD_Bzip2Size(struct _gd_raw_file *file, gd_type_t data_type)
+off64_t _GD_Bzip2Size(int dirfd, struct gd_raw_file_ *file, gd_type_t data_type,
+    int swap gd_unused_)
 {
   struct gd_bzdata *ptr;
   off_t n;
 
-  dtrace("%p, %x", file, data_type);
+  dtrace("%i, %p, 0x%X, <unused>", dirfd, file, data_type);
 
-  ptr = _GD_Bzip2DoOpen(file);
+  ptr = _GD_Bzip2DoOpen(dirfd, file);
 
   if (ptr == NULL) {
     dreturn("%i", -1);
diff --git a/src/close.c b/src/close.c
index ca6a90b..25ac590 100644
--- a/src/close.c
+++ b/src/close.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2010 D. V. Wiebe
+/* Copyright (C) 2008-2012 D. V. Wiebe
  *
  ***************************************************************************
  *
@@ -20,37 +20,37 @@
  */
 #include "internal.h"
 
-#ifdef STDC_HEADERS
-#include <stdlib.h>
-#endif
-
 /* _GD_FreeD: free the DIRFILE and its subordinates
 */
-static void _GD_FreeD(DIRFILE* D)
+static void _GD_FreeD(DIRFILE *D, int keep_dirfile)
 {
   unsigned int i;
   int j;
 
-  dtrace("%p", D);
+  dtrace("%p, %i", D, keep_dirfile);
 
-  for (i = 0; i < D->n_entries; ++i) 
-    _GD_FreeE(D->entry[i], 1);
+  for (i = 0; i < D->n_entries; ++i)
+    _GD_FreeE(D, D->entry[i], 1);
 
   for (j = 0; j < D->n_fragment; ++j) {
+    free(D->fragment[j].enc_data);
+    free(D->fragment[j].prefix);
+    free(D->fragment[j].suffix);
+    free(D->fragment[j].bname);
     free(D->fragment[j].cname);
-    free(D->fragment[j].sname);
     free(D->fragment[j].ename);
+    free(D->fragment[j].sname);
     free(D->fragment[j].ref_name);
   }
 
   free(D->entry);
+  free(D->tok_base);
   free(D->dot_list);
+  free(D->error_prefix);
   free(D->error_string);
   free(D->error_file);
-  free(D->field_list);
-  free(D->vector_list);
-  for (j = 0; j < GD_N_ENTYPES; ++j)
-    free(D->type_list[j]);
+  for (j = 0; j < GD_N_ENTRY_LISTS; ++j)
+    free(D->entry_list[j]);
   free(D->string_value_list);
   free(D->const_value_list);
   if (D->carray_value_list)
@@ -59,16 +59,21 @@ static void _GD_FreeD(DIRFILE* D)
   free(D->carray_value_list);
   free(D->fragment);
   free(D->name);
-  free(D);
+  for (i = 0; i < D->ndir; ++i)
+    free(D->dir[i].path);
+  free(D->dir);
+
+  if (!keep_dirfile)
+    free(D);
 
   dreturnvoid();
 }
 
-static int _GD_ShutdownDirfile(DIRFILE* D, int flush_meta)
+int _GD_ShutdownDirfile(DIRFILE* D, int flush_meta, int keep_dirfile)
 {
   unsigned int i;
 
-  dtrace("%p, %i", D, flush_meta);
+  dtrace("%p, %i, %i", D, flush_meta, keep_dirfile);
 
   if (D == NULL) {
     dreturn("%i", 0);
@@ -83,14 +88,20 @@ static int _GD_ShutdownDirfile(DIRFILE* D, int flush_meta)
 
   for(i = 0; i < D->n_entries; ++i)
     if (D->entry[i]->field_type == GD_RAW_ENTRY)
-      _GD_Flush(D, D->entry[i]);
+      _GD_Flush(D, D->entry[i], 0, 1);
 
   if (D->error) {
     dreturn("%i", 1);
     return -1;
   }
 
-  _GD_FreeD(D);
+#ifndef GD_NO_DIR_OPEN
+  /* close the directory */
+  for (i = 0; i < (unsigned int)D->ndir; ++i)
+    close(D->dir[i].fd);
+#endif
+
+  _GD_FreeD(D, keep_dirfile);
 
   dreturn("%i", 0);
   return 0;
@@ -102,7 +113,7 @@ int gd_close(DIRFILE *D)
 
   dtrace("%p", D);
 
-  ret = _GD_ShutdownDirfile(D, 1);
+  ret = _GD_ShutdownDirfile(D, 1, 0);
 
   dreturn("%i", ret);
   return ret;
@@ -114,7 +125,7 @@ int gd_discard(DIRFILE* D)
 
   dtrace("%p", D);
 
-  ret = _GD_ShutdownDirfile(D, 0);
+  ret = _GD_ShutdownDirfile(D, 0, 0);
 
   dreturn("%i", ret);
   return ret;
diff --git a/src/common.c b/src/common.c
index 665a7c8..14141d9 100644
--- a/src/common.c
+++ b/src/common.c
@@ -1,5 +1,5 @@
 /* Copyright (C) 2002-2005 C. Barth Netterfield
- * Copyright (C) 2005-2010 D. V. Wiebe
+ * Copyright (C) 2005-2012 D. V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,17 +21,9 @@
  */
 #include "internal.h"
 
-#ifdef STDC_HEADERS
-#include <inttypes.h>
-#include <errno.h>
-#include <fcntl.h>
-#include <math.h>
-#include <stdlib.h>
-#include <string.h>
-#endif
-
-#ifdef HAVE_LIBGEN_H
-#include <libgen.h>
+/* This is defined on BSD */
+#ifndef MAXSYMLINKS
+#define MAXSYMLINKS 20
 #endif
 
 #ifdef GETDATA_DEBUG
@@ -39,11 +31,16 @@ int gd_col_count = 0;
 char gd_debug_col[GD_COL_SIZE + 1] = "";
 #endif
 
+int _GD_EntryCmp(const void *a, const void *b)
+{
+  return strcmp((*(gd_entry_t**)a)->field, (*(gd_entry_t**)b)->field);
+}
+
 /* _GD_GetLine: read non-comment line from format file.  The line is newly
  *      malloc'd.  Returns a pointer if successful, NULL if unsuccessful.
  *      The length read is provided in *n.  Increments *linenum as appropriate;
  */
-char *_GD_GetLine(FILE *fp, size_t *n, int* linenum)
+char *_GD_GetLine(FILE *restrict fp, size_t *restrict n, int *restrict linenum)
 {
   ssize_t len;
 
@@ -62,7 +59,7 @@ char *_GD_GetLine(FILE *fp, size_t *n, int* linenum)
 
 
   if (len != -1) {
-    dreturn("\"%s\" (%zu)", line, *n);
+    dreturn("\"%s\" (%" PRNsize_t ")", line, *n);
     return line; /* a line was read */
   }
 
@@ -99,13 +96,17 @@ gd_type_t _GD_LegacyType(char c)
 }
 
 /* Binary search to find the field */
-gd_entry_t* _GD_FindField(DIRFILE* D, const char* field_code,
-    gd_entry_t** list, unsigned int u, unsigned int *index)
+gd_entry_t *_GD_FindField(const DIRFILE *restrict D,
+    const char *restrict field_code, gd_entry_t *const *list, unsigned int u,
+    int dealias, unsigned int *restrict index)
 {
   int c;
+  char *ptr;
+  gd_entry_t *E = NULL;
   unsigned int i, l = 0;
+  const unsigned int ou = u;
 
-  dtrace("%p, \"%s\", %p, %u, %p", D, field_code, list, u, index);
+  dtrace("%p, \"%s\", %p, %u, %i, %p", D, field_code, list, u, dealias, index);
 
   /* handle FILEFRAM */
   if (D->standards < 6 && (D->flags & GD_PEDANTIC) &&
@@ -120,23 +121,53 @@ gd_entry_t* _GD_FindField(DIRFILE* D, const char* field_code,
     else if (c > 0)
       l = i + 1;
     else {
-      if (index != NULL) 
+      E = list[i];
+      if (dealias && E && E->field_type == GD_ALIAS_ENTRY)
+        E = E->e->entry[0];
+
+      if (index != NULL)
         *index = i;
 
-      dreturn("%p", list[i]);
-      return list[i];
+      dreturn("%p", E);
+      return E;
     }
   }
 
-  if (index != NULL) 
+  if (index != NULL)
     *index = u;
 
-  dreturn("%p", NULL);
-  return NULL;
+  /* not found perhaps it's an subfield of an aliased field? */
+  if ((ptr = (char*)strchr(field_code, '/'))) {
+    char *new_code = strdup(field_code);
+    if (new_code) {
+      new_code[ptr - field_code] = '\0';
+      E = _GD_FindField(D, new_code, list, ou, 0, NULL);
+      free(new_code);
+
+      if (E && E->field_type == GD_ALIAS_ENTRY && E->e->entry[0]) {
+        size_t plen = strlen(E->e->entry[0]->field);
+        new_code = (char*)malloc(plen + strlen(ptr) + 2);
+        if (new_code) {
+          strcpy(new_code, E->e->entry[0]->field);
+          new_code[plen] = '/';
+          strcpy(new_code + plen + 1, ptr + 1);
+
+          E = _GD_FindField(D, new_code, list, ou, 1, NULL);
+
+          free(new_code);
+        }
+      } else
+        E = NULL;
+    }
+  }
+
+  dreturn("%p", E);
+  return E;
 }
 
 /* Insertion sort the entry list */
-void _GD_InsertSort(DIRFILE* D, gd_entry_t* E, int u) gd_nothrow
+void _GD_InsertSort(DIRFILE *restrict D, gd_entry_t *restrict E, int u)
+  gd_nothrow
 {
   dtrace("%p, %p, %i", D, E, u);
 
@@ -154,7 +185,7 @@ void* _GD_Alloc(DIRFILE* D, gd_type_t type, size_t n)
 {
   void* ptr = NULL;
 
-  dtrace("%p, 0x%x, %zu", D, type, n);
+  dtrace("%p, 0x%x, %" PRNsize_t, D, type, n);
   if (n == 0) {
     _GD_InternalError(D);
     dreturn("%p", NULL);
@@ -172,43 +203,37 @@ void* _GD_Alloc(DIRFILE* D, gd_type_t type, size_t n)
     return NULL;
   }
 
-  ptr = malloc(n * GD_SIZE(type));
-
-  if (ptr == NULL)
-    _GD_SetError(D, GD_E_ALLOC, 0, NULL, 0, NULL);
+  ptr = _GD_Malloc(D, n * GD_SIZE(type));
 
   dreturn("%p", ptr);
   return ptr;
 }
 
 /* compute LUT table path -- this is used by _GD_Change, so e may not be E->e */
-int _GD_SetTablePath(DIRFILE *D, gd_entry_t *E, struct _gd_private_entry *e)
+int _GD_SetTablePath(DIRFILE *restrict D, const gd_entry_t *restrict E,
+    struct gd_private_entry_ *restrict e)
 {
   char *temp_buffer;
 
   dtrace("%p, %p, %p", D, E, e);
 
-  if (E->EN(linterp,table)[0] == '/') {
-    e->u.linterp.table_path = strdup(E->EN(linterp,table));
-    if (e->u.linterp.table_path == NULL) {
-      _GD_SetError(D, GD_E_ALLOC, 0, NULL, 0, NULL);
-      dreturn("%i", 1);
-      return 1;
-    }
-  } else {
-    e->u.linterp.table_path = (char *)malloc(strlen(E->EN(linterp,table)) + 2 +
-        strlen(D->fragment[E->fragment_index].cname));
-    if (e->u.linterp.table_path == NULL) {
-      _GD_SetError(D, GD_E_ALLOC, 0, NULL, 0, NULL);
-      dreturn("%i", 1);
-      return 1;
-    }
-    temp_buffer = strdup(D->fragment[E->fragment_index].cname);
-    strcpy(e->u.linterp.table_path, dirname(temp_buffer));
-    strcat(e->u.linterp.table_path, "/");
-    strcat(e->u.linterp.table_path, E->EN(linterp,table));
+  e->u.linterp.table_dirfd = _GD_GrabDir(D,
+      D->fragment[E->fragment_index].dirfd, E->EN(linterp,table));
+
+  temp_buffer = _GD_Strdup(D, E->EN(linterp,table));
+  if (temp_buffer == NULL) {
+    _GD_ReleaseDir(D, e->u.linterp.table_dirfd);
+    dreturn("%i", 1);
+    return 1;
+  }
+  e->u.linterp.table_file = _GD_Strdup(D, basename(temp_buffer));
+  if (e->u.linterp.table_file == NULL) {
+    _GD_ReleaseDir(D, e->u.linterp.table_dirfd);
     free(temp_buffer);
+    dreturn("%i", 1);
+    return 1;
   }
+  free(temp_buffer);
 
   dreturn("%i", 0);
   return 0;
@@ -217,17 +242,17 @@ int _GD_SetTablePath(DIRFILE *D, gd_entry_t *E, struct _gd_private_entry *e)
 /* LUT comparison function for qsort */
 static int lutcmp(const void* a, const void* b)
 {
-  double dx = ((struct _gd_lut *)a)->x - ((struct _gd_lut *)b)->x;
+  double dx = ((struct gd_lut_ *)a)->x - ((struct gd_lut_ *)b)->x;
   return (dx < 0) ? -1 : (dx > 0) ? 1 : 0;
 }
 
 /* _GD_ReadLinterpFile: Read in the linterp data for this field
 */
-void _GD_ReadLinterpFile(DIRFILE* D, gd_entry_t *E)
+void _GD_ReadLinterpFile(DIRFILE *restrict D, gd_entry_t *restrict E)
 {
   FILE *fp;
-  struct _gd_lut *ptr;
-  int i;
+  struct gd_lut_ *ptr;
+  int i, fd;
   int dir = -1;
   char *line;
   size_t n = 0;
@@ -237,16 +262,25 @@ void _GD_ReadLinterpFile(DIRFILE* D, gd_entry_t *E)
 
   dtrace("%p, %p", D, E);
 
-  if (E->e->u.linterp.table_path == NULL)
+  if (E->e->u.linterp.table_file == NULL)
     if (_GD_SetTablePath(D, E, E->e)) {
       dreturnvoid();
       return;
     }
 
-  fp = fopen(E->e->u.linterp.table_path, "r");
+  fd = gd_OpenAt(D, E->e->u.linterp.table_dirfd, E->e->u.linterp.table_file,
+      O_RDONLY, 0666);
+  if (fd == -1) {
+    _GD_SetError(D, GD_E_OPEN_LINFILE, GD_E_LINFILE_OPEN, NULL, 0,
+        E->EN(linterp,table));
+    dreturnvoid();
+    return;
+  }
+
+  fp = fdopen(fd, "rb");
   if (fp == NULL) {
     _GD_SetError(D, GD_E_OPEN_LINFILE, GD_E_LINFILE_OPEN, NULL, 0,
-        E->e->u.linterp.table_path);
+        E->EN(linterp,table));
     dreturnvoid();
     return;
   }
@@ -259,22 +293,21 @@ void _GD_ReadLinterpFile(DIRFILE* D, gd_entry_t *E)
   } else {
     if (errno == EOVERFLOW)
       /* line too long */
-      _GD_SetError(D, GD_E_LINE_TOO_LONG, 0, E->e->u.linterp.table_path,
-          linenum, NULL);
+      _GD_SetError(D, GD_E_LINE_TOO_LONG, 0, E->EN(linterp,table), linenum,
+          NULL);
     else 
       /* no data in file! */
       _GD_SetError(D, GD_E_OPEN_LINFILE, GD_E_LINFILE_LENGTH, NULL, 0,
-          E->e->u.linterp.table_path);
+          E->EN(linterp,table));
     fclose(fp);
     dreturnvoid();
     return;
   }
 
-  E->e->u.linterp.lut = (struct _gd_lut *)malloc(buf_len *
-      sizeof(struct _gd_lut));
+  E->e->u.linterp.lut = (struct gd_lut_ *)_GD_Malloc(D, buf_len *
+      sizeof(struct gd_lut_));
 
   if (E->e->u.linterp.lut == NULL) {
-    _GD_SetError(D, GD_E_ALLOC, 0, NULL, 0, NULL);
     fclose(fp);
     dreturnvoid();
     return;
@@ -285,7 +318,7 @@ void _GD_ReadLinterpFile(DIRFILE* D, gd_entry_t *E)
   do {
     if (E->e->u.linterp.complex_table) {
       sscanf(line, "%lg %lg;%lg", &(E->e->u.linterp.lut[i].x), &yr, &yi);
-      _gd_l2c(E->e->u.linterp.lut[i].y.c, yr, yi);
+      gd_li2cs_(E->e->u.linterp.lut[i].y.c, yr, yi);
     } else
       sscanf(line, "%lg %lg", &(E->e->u.linterp.lut[i].x),
           &(E->e->u.linterp.lut[i].y.r));
@@ -302,12 +335,11 @@ void _GD_ReadLinterpFile(DIRFILE* D, gd_entry_t *E)
     i++;
     if (i >= buf_len) {
       buf_len += 100;
-      ptr = (struct _gd_lut *)realloc(E->e->u.linterp.lut, buf_len *
-          sizeof(struct _gd_lut));
+      ptr = (struct gd_lut_ *)_GD_Realloc(D, E->e->u.linterp.lut, buf_len *
+          sizeof(struct gd_lut_));
 
       if (ptr == NULL) {
         free(E->e->u.linterp.lut);
-        _GD_SetError(D, GD_E_ALLOC, 0, NULL, 0, NULL);
         fclose(fp);
         dreturnvoid();
         return;
@@ -321,19 +353,18 @@ void _GD_ReadLinterpFile(DIRFILE* D, gd_entry_t *E)
   if (i < 2) {
     free(E->e->u.linterp.lut);
     _GD_SetError(D, GD_E_OPEN_LINFILE, GD_E_LINFILE_LENGTH, NULL, 0,
-        E->e->u.linterp.table_path);
+        E->EN(linterp,table));
     fclose(fp);
     dreturnvoid();
     return;
   }
 
   /* Free unused memory */
-  ptr = (struct _gd_lut *)realloc(E->e->u.linterp.lut, i
-      * sizeof(struct _gd_lut));
+  ptr = (struct gd_lut_ *)_GD_Realloc(D, E->e->u.linterp.lut, i
+      * sizeof(struct gd_lut_));
 
   if (ptr == NULL) {
     free(E->e->u.linterp.lut);
-    _GD_SetError(D, GD_E_ALLOC, 0, NULL, 0, NULL);
     fclose(fp);
     dreturnvoid();
     return;
@@ -345,7 +376,7 @@ void _GD_ReadLinterpFile(DIRFILE* D, gd_entry_t *E)
 
   /* sort the LUT */
   if (dir == -2)
-    qsort(E->e->u.linterp.lut, i, sizeof(struct _gd_lut), lutcmp);
+    qsort(E->e->u.linterp.lut, i, sizeof(struct gd_lut_), lutcmp);
 
   fclose(fp);
   dreturnvoid();
@@ -353,10 +384,10 @@ void _GD_ReadLinterpFile(DIRFILE* D, gd_entry_t *E)
 
 /* _GD_GetIndex: get LUT index.
 */
-static size_t _GD_GetIndex(double x, const struct _gd_lut *lut, size_t idx,
+static size_t _GD_GetIndex(double x, const struct gd_lut_ *lut, size_t idx,
     size_t n)
 {
-  dtrace("%g, %p, %zu, %zu", x, lut, idx, n);
+  dtrace("%g, %p, %" PRNsize_t ", %" PRNsize_t, x, lut, idx, n);
 
   /* Just linearly search - we're probably right to start    */
   /* increment until we are bigger */
@@ -367,7 +398,7 @@ static size_t _GD_GetIndex(double x, const struct _gd_lut *lut, size_t idx,
   while ((idx > 0) && (x < lut[idx].x))
     idx--;
 
-  dreturn("%zu", idx);
+  dreturn("%" PRNsize_t, idx);
   return idx;
 }
 
@@ -441,15 +472,16 @@ static size_t _GD_GetIndex(double x, const struct _gd_lut *lut, size_t idx,
 
 /* _GD_LinterpData: calibrate data using lookup table lut
 */
-void _GD_LinterpData(DIRFILE* D, void *data, gd_type_t type, int complex_table,
-    const double *data_in, size_t npts, const struct _gd_lut *lut, size_t n_ln)
+void _GD_LinterpData(DIRFILE *restrict D, void *restrict data, gd_type_t type,
+    int complex_table, const double *restrict data_in, size_t npts,
+    const struct gd_lut_ *restrict lut, size_t n_ln)
 {
   int idx = 0;
   size_t i;
   double x;
 
-  dtrace("%p, %p, 0x%x, %i, %p, %zu, %p, %zu", D, data, type, complex_table,
-      data_in, npts, lut, n_ln);
+  dtrace("%p, %p, 0x%x, %i, %p, %" PRNsize_t ", %p, %" PRNsize_t, D, data, type,
+      complex_table, data_in, npts, lut, n_ln);
 
   switch (type) {
     case GD_NULL:                          break;
@@ -535,14 +567,15 @@ void _GD_LinterpData(DIRFILE* D, void *data, gd_type_t type, int complex_table,
   }
 
 /* Compute a lincom, all at once */
-void _GD_LincomData(DIRFILE* D, int n, void* data1, gd_type_t return_type,
-    double *data2, double *data3, double* m, double *b, gd_spf_t *spf,
-    size_t n_read)
+void _GD_LincomData(DIRFILE *restrict D, int n, void *restrict data1,
+    gd_type_t return_type, const double *restrict data2,
+    const double *restrict data3, const double *restrict m,
+    const double *restrict b, const unsigned int *restrict spf, size_t n_read)
 {
   size_t i;
 
-  dtrace("%p, %i, %p, 0x%x, %p, %p, %p, %p, %p, %zu", D, n, data1, return_type,
-      data2, data3, m, b, spf, n_read);
+  dtrace("%p, %i, %p, 0x%x, %p, %p, %p, %p, %p, %" PRNsize_t, D, n, data1,
+      return_type, data2, data3, m, b, spf, n_read);
 
   switch(return_type) {
     case GD_NULL:                         break;
@@ -643,14 +676,15 @@ void _GD_LincomData(DIRFILE* D, int n, void* data1, gd_type_t return_type,
 #endif
 
 /* Compute a complex valued lincom, all at once */
-void _GD_CLincomData(DIRFILE* D, int n, void* data1, gd_type_t return_type,
-    GD_DCOMPLEXP(data2), GD_DCOMPLEXP(data3), GD_DCOMPLEXV(m), GD_DCOMPLEXV(b),
-    gd_spf_t *spf, size_t n_read)
+void _GD_CLincomData(DIRFILE *restrict D, int n, void *restrict data1,
+    gd_type_t return_type, const GD_DCOMPLEXP_t restrict data2,
+    const GD_DCOMPLEXP_t restrict data3, GD_DCOMPLEXV(m), GD_DCOMPLEXV(b),
+    const unsigned int *restrict spf, size_t n_read)
 {
   size_t i;
 
-  dtrace("%p, %i, %p, 0x%x, %p, %p, %p, %p, %p, %zu", D, n, data1, return_type,
-      data2, data3, m, b, spf, n_read);
+  dtrace("%p, %i, %p, 0x%x, %p, %p, %p, %p, %p, %" PRNsize_t, D, n, data1,
+      return_type, data2, data3, m, b, spf, n_read);
 
   switch(return_type) {
     case GD_NULL:                         break;
@@ -677,7 +711,7 @@ void _GD_CLincomData(DIRFILE* D, int n, void* data1, gd_type_t return_type,
   do { \
     for (i = 0; i < n_read; i++) { \
       const t d = ((t *)data)[2 * i] * ((t *)data)[2 * i] + \
-        ((t *)data)[2 * i + 1] * ((t *)data)[2 * i + 1]; \
+      ((t *)data)[2 * i + 1] * ((t *)data)[2 * i + 1]; \
       ((t *)data)[2 * i] = (t)(dividend * ((t *)data)[2 * i] / d); \
       ((t *)data)[2 * i + 1] = (t)(-dividend * ((t *)data)[2 * i + 1] / d); \
     } \
@@ -690,12 +724,13 @@ void _GD_CLincomData(DIRFILE* D, int n, void* data1, gd_type_t return_type,
                            ((t *)data)[i] = (t)(dividend / ((t *)data)[i])
 
 /* Invert a vector */
-void _GD_InvertData(DIRFILE* D, void* data, gd_type_t return_type,
-    double dividend, size_t n_read)
+void _GD_InvertData(DIRFILE *restrict D, void *restrict data,
+    gd_type_t return_type, double dividend, size_t n_read)
 {
   size_t i;
 
-  dtrace("%p, %p, 0x%x, %g, %zu", D, data, return_type, dividend, n_read);
+  dtrace("%p, %p, 0x%x, %g, %" PRNsize_t, D, data, return_type, dividend,
+      n_read);
 
   switch(return_type) {
     case GD_NULL:                         break;
@@ -725,7 +760,7 @@ void _GD_InvertData(DIRFILE* D, void* data, gd_type_t return_type,
   do { \
     for (i = 0; i < n_read; i++) { \
       const t d = ((t *)data)[2 * i] * ((t *)data)[2 * i] + \
-        ((t *)data)[2 * i + 1] * ((t *)data)[2 * i + 1]; \
+      ((t *)data)[2 * i + 1] * ((t *)data)[2 * i + 1]; \
       ((t *)data)[2 * i] = (t)((dividend[0] * ((t *)data)[2 * i] - \
           dividend[1] * ((t *)data)[2 * i + 1]) / d); \
       ((t *)data)[2 * i + 1] = (t)((dividend[1] * ((t *)data)[2 * i] - \
@@ -737,7 +772,7 @@ void _GD_InvertData(DIRFILE* D, void* data, gd_type_t return_type,
   do { \
     for (i = 0; i < n_read; i++) { \
       const t d = ((t *)data)[2 * i] * ((t *)data)[2 * i] + \
-        ((t *)data)[2 * i + 1] * ((t *)data)[2 * i + 1]; \
+      ((t *)data)[2 * i + 1] * ((t *)data)[2 * i + 1]; \
       ((t *)data)[2 * i] = (t)((dividend[0] * ((t *)data)[2 * i] - \
           dividend[1] * ((t *)data)[2 * i + 1]) / d); \
     } \
@@ -746,13 +781,13 @@ void _GD_InvertData(DIRFILE* D, void* data, gd_type_t return_type,
 #endif
 
 /* Invert a vector */
-void _GD_CInvertData(DIRFILE* D, void* data, gd_type_t return_type,
-    GD_DCOMPLEXA(dividend), size_t n_read)
+void _GD_CInvertData(DIRFILE *restrict D, void *restrict data,
+    gd_type_t return_type, GD_DCOMPLEXA(dividend), size_t n_read)
 {
   size_t i;
 
-  dtrace("%p, %p, 0x%x, %g;%g, %zu", D, data, return_type, creal(dividend),
-      cimag(dividend), n_read);
+  dtrace("%p, %p, 0x%x, %g;%g, %" PRNsize_t, D, data, return_type,
+      creal(dividend), cimag(dividend), n_read);
 
   switch(return_type) {
     case GD_NULL:                         break;
@@ -774,12 +809,13 @@ void _GD_CInvertData(DIRFILE* D, void* data, gd_type_t return_type,
   dreturnvoid();
 }
 
-int _GD_GetRepr(DIRFILE* D, const char* field_code_in, char** field_code)
+int _GD_GetRepr(DIRFILE *restrict D, const char *restrict field_code_in,
+    char **restrict field_code, int err)
 {
   int repr = GD_REPR_NONE;
   const int field_code_len = strlen(field_code_in);
 
-  dtrace("%p, \"%s\", %p", D, field_code_in, field_code);
+  dtrace("%p, \"%s\", %p, %i", D, field_code_in, field_code, err);
 
   *field_code = (char *)field_code_in;
   /* find the representation, if any */
@@ -798,17 +834,16 @@ int _GD_GetRepr(DIRFILE* D, const char* field_code_in, char** field_code)
         repr = GD_REPR_ARG;
         break;
       default:
-        _GD_SetError(D, GD_E_BAD_REPR, GD_E_REPR_UNKNOWN, NULL, 0,
-            field_code_in + field_code_len - 1);
+        if (err)
+          _GD_SetError(D, GD_E_BAD_REPR, GD_E_REPR_UNKNOWN, NULL, 0,
+              field_code_in + field_code_len - 1);
         dreturn("%i", 0);
         return 0;
     }
 
     /* make a copy of the field code without the representation */
-    *field_code = strdup(field_code_in);
-    if (*field_code == NULL) 
-      _GD_SetError(D, GD_E_ALLOC, 0, NULL, 0, NULL);
-    else
+    *field_code = _GD_Strdup(D, field_code_in);
+    if (*field_code)
       (*field_code)[field_code_len - 2] = '\0';
   }
 
@@ -817,17 +852,17 @@ int _GD_GetRepr(DIRFILE* D, const char* field_code_in, char** field_code)
 }
 
 /* Ensure that an input field has been identified (with error checking) */
-int _GD_BadInput(DIRFILE* D, gd_entry_t* E, int i)
+int _GD_BadInput(DIRFILE *D, const gd_entry_t *E, int i, int err)
 {
-  char* code;
+  char *code;
 
-  dtrace("%p, %p, %i", D, E, i);
+  dtrace("%p, %p, %i, %i", D, E, i, err);
 
   if (E->e->entry[i] == NULL) {
     E->e->entry[i] = _GD_FindFieldAndRepr(D, E->in_fields[i], &code,
-        &E->e->repr[i], NULL, 1);
+        &E->e->repr[i], NULL, 1, err);
 
-    if (D->error) {
+    if (E->e->entry[i] == NULL) {
       dreturn("%i", 1);
       return 1;
     }
@@ -837,7 +872,7 @@ int _GD_BadInput(DIRFILE* D, gd_entry_t* E, int i)
   }
 
   /* scalar entries not allowed */
-  if (E->e->entry[i]->field_type & GD_SCALAR_ENTRY) {
+  if (E->e->entry[i]->field_type & GD_SCALAR_ENTRY_BIT) {
     _GD_SetError(D, GD_E_DIMENSION, GD_E_DIM_FORMAT, E->field, 0,
         E->e->entry[i]->field);
     dreturn("%i", 1);
@@ -849,18 +884,20 @@ int _GD_BadInput(DIRFILE* D, gd_entry_t* E, int i)
 }
 
 /* Find the entry and the representation */
-gd_entry_t* _GD_FindFieldAndRepr(DIRFILE* D, const char* field_code_in,
-    char** field_code, int* repr, unsigned int *index, int set)
+gd_entry_t *_GD_FindFieldAndRepr(DIRFILE *restrict D,
+    const char *restrict field_code_in, char **restrict field_code,
+    int *restrict repr, unsigned int *restrict index, int set, int err)
 {
-  gd_entry_t* E = NULL;
+  gd_entry_t *E = NULL;
 
-  dtrace("%p, \"%s\", %p, %p, %p, %i", D, field_code_in, field_code, repr,
-      index, set);
+  dtrace("%p, \"%s\", %p, %p, %p, %i, %i", D, field_code_in, field_code, repr,
+      index, set, err);
 
-  E = _GD_FindField(D, field_code_in, D->dot_list, D->n_dot, NULL);
+  if (D->n_dot > 0)
+    E = _GD_FindField(D, field_code_in, D->dot_list, D->n_dot, 1, NULL);
 
   if (E == NULL) {
-    *repr = _GD_GetRepr(D, field_code_in, field_code);
+    *repr = _GD_GetRepr(D, field_code_in, field_code, err);
 
     if (D->error) {
       dreturn("%p", NULL);
@@ -872,10 +909,11 @@ gd_entry_t* _GD_FindFieldAndRepr(DIRFILE* D, const char* field_code_in,
   }
 
   if (E == NULL || index != NULL)
-    E = _GD_FindField(D, *field_code, D->entry, D->n_entries, index);
+    E = _GD_FindField(D, *field_code, D->entry, D->n_entries, 1, index);
 
   if (E == NULL && set) {
-    _GD_SetError(D, GD_E_BAD_CODE, 0, NULL, 0, field_code_in);
+    if (err)
+      _GD_SetError(D, GD_E_BAD_CODE, GD_E_CODE_MISSING, NULL, 0, field_code_in);
     if (field_code_in != *field_code)
       free(*field_code);
   }
@@ -883,5 +921,506 @@ gd_entry_t* _GD_FindFieldAndRepr(DIRFILE* D, const char* field_code_in,
   dreturn("%p %i", E, *repr);
   return E;
 }
+
+const char *_GD_DirName(const DIRFILE *D, int dirfd)
+{
+#ifndef GD_NO_DIR_OPEN
+  unsigned int i;
+#endif
+
+  dtrace("%p, %i", D, dirfd);
+
+#ifdef GD_NO_DIR_OPEN
+  /* in the non-POSIX case, dirfd is just the index in the dir list */
+  if (D->ndir > 0) {
+    dreturn("\"%s\"", D->dir[dirfd].path);
+    return D->dir[dirfd].path;
+  }
+#else
+  for (i = 0; i < D->ndir; ++i)
+    if (dirfd == D->dir[i].fd) {
+      dreturn("\"%s\"", D->dir[i].path);
+      return D->dir[i].path;
+    }
+#endif
+
+  /* we only get here in the early stages of opening a dirfile */
+  dreturn("\"%s\"", D->name);
+  return D->name;
+}
+
+/* This is mostly the POSIX.1 realpath(3) function, but with some
+ * optimisation due to the fact that we know that the front part of the
+ * path (car) has already been canonicalised */
+char *_GD_CanonicalPath(const char *car, const char *cdr)
+{
+  int last_element = 0;
+#if defined HAVE_READLINK && defined HAVE_LSTAT64
+  int loop_count = 0;
+#endif
+  size_t res_len, res_root, res_size, len;
+  char *res = NULL, *ptr, *work, *cur, *end;
+  dtrace("\"%s\", \"%s\"", car, cdr);
+
+  if (car && !_GD_AbsPath(cdr)) {
+    if (!_GD_AbsPath(car)) {
+      /* car is not abosulte -- don't bother trying to do anything fancy */
+      res = (char*)malloc(strlen(car) + strlen(cdr) + 2);
+      if (res == NULL) {
+        dreturn("%p", NULL);
+        return NULL;
+      }
+      sprintf(res, "%s%c%s", car, GD_DIRSEP, cdr);
+      dreturn("%s", res);
+      return res;
+    }
+    /* car is nonnull and cdr is not absolute: copy car into res and
+     * cdr into work */
+    res = strdup(car);
+    if (res == NULL) {
+      dreturn("%p", NULL);
+      return NULL;
+    }
+    res_size = (res_len = strlen(car)) + 1;
+    res_root = _GD_RootLen(res);
+
+    cur = work = strdup(cdr);
+    if (work == NULL) {
+      free(res);
+      dreturn("%p", NULL);
+      return NULL;
+    }
+  } else if (_GD_AbsPath(cdr)) {
+    /* cdr is absolute: make res "/" and copy cdr relative to / into work;
+     * ignore car */
+    res = (char*)malloc(res_size = PATH_MAX);
+    if (res == NULL) {
+      dreturn("%p", NULL);
+      return NULL;
+    }
+    _GD_Root(res, cdr, res_root);
+    res_len = res_root;
+
+    if (cdr[res_len] == '\0') {
+      dreturn("\"%s\"", res);
+      return res;
+    }
+
+    cur = work = strdup(cdr + res_len);
+    if (work == NULL) {
+      free(res);
+      dreturn("%p", NULL);
+      return NULL;
+    }
+  } else {
+    /* car is not present and cdr is relative: try to get the CWD; and make
+     * work CWD/cdr, relative to / if getcwd returned an absolute path.  If
+     * getcwd fails, just use cdr, and abandon hope of an absolute path.
+     */
+    res = (char*)malloc(res_size = PATH_MAX);
+    work = (char*)malloc(PATH_MAX);
+    if (res == NULL || work == NULL) {
+      free(res);
+      free(res);
+      dreturn("%p", NULL);
+      return NULL;
+    }
+
+    if (gd_getcwd(work, PATH_MAX) == NULL) {
+      /* if getcwd fails, we're stuck with a relative path, oh well. */
+      free(work);
+      cur = work = strdup(cdr);
+      if (work == NULL) {
+        free(res);
+        dreturn("%p", NULL);
+        return NULL;
+      }
+      res[0] = '\0';
+      res_root = res_len = 0;
+    } else {
+      if ((len = strlen(work) + 2 + strlen(cdr)) < PATH_MAX) {
+        ptr = (char*)realloc(work, len);
+        if (ptr == NULL) {
+          free(res);
+          free(work);
+          dreturn("%p", NULL);
+          return NULL;
+        }
+        work = ptr;
+      }
+      ptr = work + strlen(work);
+      *(ptr++) = GD_DIRSEP;
+      strcpy(ptr, cdr);
+
+      if (_GD_AbsPath(work)) {
+        _GD_Root(res, work, res_root);
+        res_len = res_root;
+        cur = work + res_len;
+      } else {
+        res[0] = '\0';
+        res_root = res_len = 0;
+        cur = work;
+      }
+    }
+  }
+
+  /* now step through work, building up res as appropriate */
+  for (end = cur ; !last_element; cur = end) {
+    /* look for the next GD_DIRSEP or NUL */
+    for (; *end != '\0' && !_GD_IsDirSep(*end); ++end)
+      ;
+
+    /* end of string */
+    if (*end == '\0' && cur == end)
+      break;
+    else if (*end == '\0')
+      last_element = 1;
+    else
+      *(end++) = '\0';
+
+    if (cur[0] == '\0')
+      /* consecutive /s */
+      ;
+    else if (cur[0] == '.' && cur[1] == '\0') {
+      /* discard . */
+      continue;
+    } else if (cur[0] == '.' && cur[1] == '.' && cur[2] == '\0') {
+      /* don't strip the leading GD_DIRSEP */
+      if (res_len > res_root) {
+        /* find the last GD_DIRSEP, but don't strip the leading GD_DIRSEP */
+        for(ptr = res + res_len - 1;
+            !_GD_IsDirSep(*ptr) && ptr > res + res_root; --ptr)
+          ;
+
+        /* strip the .. if possible, otherwise append it */
+        *ptr = '\0';
+        res_len = ptr - res;
+      }
+    } else {
+      /* a path element, copy it to res */
+      len = strlen(cur) + 1;
+      if (res_len + len >= res_size) {
+        ptr = (char*)realloc(res, res_size += (len < 1000) ? 1000 : len);
+        if (ptr == NULL) {
+          free(res);
+          free(work);
+          dreturn("%p", NULL);
+          return NULL;
+        }
+        res = ptr;
+      }
+      if (res_len > 1 && !_GD_IsDirSep(res[res_len - 1]))
+        res[res_len++] = GD_DIRSEP;
+      strcpy(res + res_len, cur);
+      res_len += len - 1;
+#if defined HAVE_READLINK && defined HAVE_LSTAT64
+      {
+        gd_stat64_t statbuf;
+
+        /* check if it's a symlink */
+        if (lstat64(res, &statbuf)) {
+          if (errno == ENOENT) {
+            /* the thing doesn't exist.  I guess that means we're done;
+             * copy the rest of the work buffer onto the resul and call it a
+             * day. */
+            if (*end) {
+              len = strlen(end) + 1;
+              if (res_len + len >= res_size) {
+                ptr = (char*)realloc(res, res_size += len);
+                if (ptr == NULL) {
+                  free(res);
+                  free(work);
+                  dreturn("%p", NULL);
+                  return NULL;
+                }
+                res = ptr;
+              }
+              res[res_len++] = GD_DIRSEP;
+              strcpy(res + res_len, end);
+              res_len += len - 1;
+            }
+            goto _GD_CanonicalPath_DONE;
+          }
+          /* lstat error */
+          free(res);
+          free(work);
+          dreturn("%p", NULL);
+          return NULL;
+        }
+
+        if (S_ISLNK(statbuf.st_mode)) {
+          char target[PATH_MAX];
+          ssize_t slen;
+
+          /* check for symlink loop */
+          if (loop_count++ > MAXSYMLINKS) {
+            errno = ELOOP;
+            free(res);
+            free(work);
+            dreturn("%p", NULL);
+            return NULL;
+          }
+
+          /* get the link target */
+          slen = readlink(res, target, PATH_MAX);
+          if (slen == -1) {
+            free(res);
+            free(work);
+            dreturn("%p", NULL);
+            return NULL;
+          }
+          target[slen] = 0;
+
+          /* now we have to start all over again */
+          ptr = target;
+          if (_GD_AbsPath(ptr)) {
+            _GD_Root(res, target, res_root);
+            res_len = res_root;
+            ptr += res_root;
+            slen -= res_root;
+          } else if (res_len > res_root) {
+            /* strip the symlink name from res */
+            char *rptr;
+            for (rptr = res + res_len - 1; !_GD_IsDirSep(*rptr); --rptr)
+              ;
+
+            /* don't strip the root /; but do strip a previous DIRSEP */
+            if ((size_t)(rptr - res) < res_root) {
+              *(rptr + 1) = '\0';
+              res_len = (rptr - res) + 1;
+            } else {
+              *rptr = '\0';
+              res_len = rptr - res;
+            }
+          }
+
+          /* now make a new work buffer of "target/remaining", asusming
+           * remaining is non-null, otherwise, just use target */
+          if (*end == '\0') {
+            last_element = 0;
+            free(work);
+            end = work = strdup(target);
+            if (work == NULL) {
+              free(res);
+              dreturn("%p", NULL);
+              return NULL;
+            }
+          } else {
+            char *new_work, slash[2] = { GD_DIRSEP, 0 };
+            len = strlen(end) + slen + 2;
+
+            if (_GD_IsDirSep(*(ptr + slen - 1))) {
+              slash[0] = '\0';
+              len--;
+            }
+
+            new_work = (char*)malloc(len);
+            if (new_work == NULL) {
+              free(res);
+              free(work);
+              dreturn("%p", NULL);
+              return NULL;
+            }
+            sprintf(new_work, "%s%s%s", ptr, slash, end);
+            free(work);
+            end = work = new_work;
+          }
+        }
+      }
+#endif
+    }
+  }
+
+#if defined HAVE_READLINK && defined HAVE_LSTAT64
+_GD_CanonicalPath_DONE:
+#endif
+  free(work);
+
+  /* trim */
+  ptr = (char*)realloc(res, res_len + 1);
+  if (ptr)
+    res = ptr;
+
+  dreturn("\"%s\"", res);
+  return res;
+}
+
+char *_GD_MakeFullPath(DIRFILE *D, int dirfd, const char *name, int seterr)
+{
+  const char *dir;
+  char *filepath;
+  dtrace("%p, %i, \"%s\", %i", D, dirfd, name, seterr);
+
+  if (dirfd >= 0) {
+    dir = _GD_DirName(D, dirfd);
+    if (dir == NULL) {
+      dreturn("%p", NULL);
+      return NULL;
+    }
+  } else
+    dir = NULL;
+
+  filepath = _GD_CanonicalPath(dir, name);
+
+  if (seterr && filepath == NULL) {
+    if (errno == ENOMEM)
+      _GD_SetError(D, GD_E_ALLOC, 0, NULL, 0, NULL);
+    else {
+      /* a last ditch attempt */
+      if (dir) {
+        filepath = (char*)_GD_Malloc(D, strlen(dir) + strlen(name) + 2);
+        if (filepath)
+          sprintf(filepath, "%s%c%s", dir, GD_DIRSEP, name);
+      } else 
+        filepath = _GD_Strdup(D, name);
+    }
+  }
+
+  dreturn("\"%s\"", filepath);
+  return filepath;
+}
+
+char *_GD_MakeFullPathOnly(const DIRFILE *D, int dirfd, const char *name)
+{
+  char *filepath;
+
+  dtrace("%p, %i, \"%s\"", D, dirfd, name);
+
+  /* although we cast away the constness, seterr=0 ensures nothing gets
+   * modified
+   */
+  filepath = _GD_MakeFullPath((DIRFILE*)D, dirfd, name, 0);
+
+  dreturn("\"%s\"", filepath);
+  return filepath;
+}
+
+int _GD_GrabDir(DIRFILE *D, int dirfd, const char *name)
+{
+  unsigned int i;
+  char *path, *dir = NULL;
+  void *ptr;
+
+  dtrace("%p, %i, \"%s\"", D, dirfd, name);
+
+  path = _GD_MakeFullPath(D, dirfd, name, 1);
+
+  if (path == NULL) {
+    dreturn("%i", -1);
+    return -1;
+  }
+
+  dir = dirname(path);
+
+  for (i = 0; i < D->ndir; ++i)
+    if (strcmp(dir, D->dir[i].path) == 0) {
+      D->dir[i].rc++;
+      free(path);
+      dreturn("%i", D->dir[i].fd);
+      return D->dir[i].fd;
+    }
+
+  /* new one */
+  ptr = _GD_Realloc(D, D->dir, sizeof(struct gd_dir_t) * (D->ndir + 1));
+
+  if (ptr == NULL) {
+    free(path);
+    dreturn("%i", -1);
+    return -1;
+  }
+
+  D->dir = (struct gd_dir_t*)ptr;
+  D->dir[D->ndir].rc = 1;
+  D->dir[D->ndir].path = _GD_Strdup(D, dir);
+
+  if (D->dir[D->ndir].path == NULL) {
+    free(path);
+    dreturn("%i", -1);
+    return -1;
+  }
+
+#ifdef GD_NO_DIR_OPEN
+  D->dir[D->ndir].fd = D->ndir;
+  free(path);
+#else
+  if (_GD_AbsPath(name)) {
+    D->dir[D->ndir].fd = open(dir, O_RDONLY);
+  } else {
+    free(path);
+    path = _GD_Strdup(D, name);
+    if (path == NULL) {
+      free(D->dir[D->ndir].path);
+      dreturn("%i", -1);
+      return -1;
+    }
+    D->dir[D->ndir].fd = gd_OpenAt(D, dirfd, dirname(path), O_RDONLY, 0666);
+  }
+  free(path);
+
+  if (D->dir[D->ndir].fd == -1) {
+    free(D->dir[D->ndir].path);
+    dreturn("%i", -1);
+    return -1;
+  }
+#endif
+  D->ndir++;
+
+  dreturn("%i", D->dir[D->ndir - 1].fd);
+  return D->dir[D->ndir - 1].fd;
+}
+
+void _GD_ReleaseDir(DIRFILE *D, int dirfd)
+{
+#ifndef GD_NO_DIR_OPEN
+  unsigned int i;
+#endif
+
+  dtrace("%p, %i", D, dirfd);
+
+#ifdef GD_NO_DIR_OPEN
+  if (--D->dir[dirfd].rc == 0) {
+    free(D->dir[dirfd].path);
+    D->dir[dirfd] = D->dir[--D->ndir];
+  }
+#else
+  for (i = 0; i < D->ndir; ++i)
+    if (D->dir[i].fd == dirfd) {
+      if (--D->dir[i].rc == 0) {
+        free(D->dir[i].path);
+        close(D->dir[i].fd);
+        D->dir[i] = D->dir[--D->ndir];
+      }
+      break;
+    }
+#endif
+
+  dreturnvoid();
+}
+
+/* allocation boilerplates */
+void *_GD_Malloc(DIRFILE *D, size_t size)
+{
+  void *ptr = malloc(size);
+  if (ptr == NULL)
+    _GD_SetError(D, GD_E_ALLOC, 0, NULL, 0, NULL);
+  return ptr;
+}
+
+void *_GD_Realloc(DIRFILE *restrict D, void *restrict old, size_t size)
+{
+  void *ptr = realloc(old, size);
+  if (ptr == NULL)
+    _GD_SetError(D, GD_E_ALLOC, 0, NULL, 0, NULL);
+  return ptr;
+}
+
+char *_GD_Strdup(DIRFILE *D, const char *s)
+{
+  char *ptr = strdup(s);
+  if (ptr == NULL)
+    _GD_SetError(D, GD_E_ALLOC, 0, NULL, 0, NULL);
+  return ptr;
+}
+
 /* vim: ts=2 sw=2 et tw=80
 */
diff --git a/src/compat.c b/src/compat.c
index 4dc387a..486fea8 100644
--- a/src/compat.c
+++ b/src/compat.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2010 D. V. Wiebe
+/* Copyright (C) 2010, 2011, 2012 D. V. Wiebe
  *
  ***************************************************************************
  *
@@ -20,19 +20,9 @@
  */
 #include "internal.h"
 
-#ifdef STDC_HEADERS
-#include <stdlib.h>
-#include <stdio.h>
-#include <fcntl.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <errno.h>
-#include <time.h>
-#endif
-
 /* The MSVCRT gmtime() is threadsafe */
 #ifndef HAVE_GMTIME_R
-struct tm *gmtime_r(const time_t *timep, struct tm *result)
+struct tm *gmtime_r(const time_t *restrict timep, struct tm *restrict result)
 {
   struct tm *ptr;
 
@@ -49,53 +39,110 @@ struct tm *gmtime_r(const time_t *timep, struct tm *result)
 }
 #endif
 
-/* MSVCRT based implementation of mkstemp(3). */
-#ifndef HAVE_MKSTEMP
-int mkstemp(char *template) {
-  int ret = -1;
-  char *template_template;
-
-  dtrace("\"%s\"", template);
-
-  template_template = strdup(template);
-
-  /* for sanity's sake */
-  errno = 0;
+/* ...at() functions for platforms lacking them.  These are originally Solaris
+ * extensions which have subsequently been included in POSIX.1-2008.
+ */
+#ifndef HAVE_OPENAT
+int gd_OpenAt(const DIRFILE *D, int dirfd, const char *name, int flags,
+    mode_t mode)
+{
+  int ret;
+  char *path;
 
-  /* loop while open returns EEXIST */
-  do {
-    char *ptr;
-    strcpy(template, template_template);
-    ptr = mktemp(template);
+  dtrace("%p, %i, \"%s\", %x, 0%o", D, dirfd, name, flags, mode);
 
-    if (ptr == NULL)
-      errno = EINVAL;
-    else
-      ret = open(ptr, O_RDWR | O_BINARY | O_CREAT | O_EXCL | O_BINARY, 0600);
-  } while (errno == EEXIST);
+  path = _GD_MakeFullPathOnly(D, dirfd, name);
+  ret = open(path, flags | O_BINARY, mode);
+  free(path);
 
-  free(template_template);
   dreturn("%i", ret);
   return ret;
 }
 #endif
 
-/* An overwriting rename for use with the MSVCRT */
-#ifdef __MSVCRT__
-int _GD_Rename(const char *oldname, const char *newname)
+#ifndef HAVE_RENAMEAT
+int gd_RenameAt(const DIRFILE *D, int olddirfd, const char *oldname,
+    int newdirfd, const char *newname)
 {
   int ret;
+  char *oldpath, *newpath;
 
-  dtrace("\"%s\", \"%s\"", oldname, newname);
+  dtrace("%p, %i, \"%s\", %i, \"%s\"", D, olddirfd, oldname, newdirfd, newname);
 
-  if (unlink(newname)) {
+  newpath = _GD_MakeFullPathOnly(D, newdirfd, newname);
+#ifdef __MSVCRT__
+  if (unlink(newpath)) {
     if (errno != ENOENT) {
+      free(newpath);
       dreturn("%i", -1);
       return -1;
     }
   }
+#endif
+
+  oldpath = _GD_MakeFullPathOnly(D, olddirfd, oldname);
+  ret = rename(oldpath, newpath);
+  free(newpath);
+  free(oldpath);
+
+  dreturn("%i", ret);
+  return ret;
+}
+#endif
+
+#ifndef HAVE_FSTATAT
+int gd_StatAt(const DIRFILE* D, int dirfd, const char* name, struct stat* buf,
+    int flags)
+{
+  int ret;
+  char *path;
+
+  dtrace("%p, %i, \"%s\", %p, %x", D, dirfd, name, buf, flags);
+
+  path = _GD_MakeFullPathOnly(D, dirfd, name);
+#if defined(HAVE_LSTAT) && defined(AT_SYMLINK_NOFOLLOW)
+  if (flags & AT_SYMLINK_NOFOLLOW)
+    ret = lstat(path, buf);
+  else
+#endif
+    ret = stat(path, buf);
+  free(path);
+
+  dreturn("%i", ret);
+  return ret;
+}
+#endif
+
+#ifndef HAVE_FSTATAT64
+int gd_StatAt64(const DIRFILE* D, int dirfd, const char* name, gd_stat64_t* buf,
+    int flags gd_unused_)
+{
+  int ret;
+  char *path;
+
+  dtrace("%p, %i, \"%s\", %p, <unused>", D, dirfd, name, buf);
+
+  path = _GD_MakeFullPathOnly(D, dirfd, name);
+  ret = gd_stat64(path, buf);
+  free(path);
+
+  dreturn("%i", ret);
+  return ret;
+}
+#endif
+
+#ifndef HAVE_UNLINKAT
+int gd_UnlinkAt(const DIRFILE *D, int dirfd, const char *name,
+    int flags gd_unused_)
+{
+  int ret;
+  char *path;
 
-  ret = rename(oldname, newname);
+  dtrace("%p, %i, \"%s\", <unused>", D, dirfd, name);
+
+  path = _GD_MakeFullPathOnly(D, dirfd, name);
+  ret = unlink(path);
+  free(path);
 
   dreturn("%i", ret);
   return ret;
@@ -108,11 +155,12 @@ int strerror_r(int errnum, char *buf, size_t buflen)
 {
   char *ptr;
 
-  dtrace("%i, %p, %zu", errnum, buf, buflen);
-  
+  dtrace("%i, %p, %" PRNsize_t, errnum, buf, buflen);
+
   ptr = strerror(errnum);
   strncpy(buf, ptr, buflen);
 
+  dreturn("%i", 0);
   return 0;
 }
 #endif
@@ -121,7 +169,6 @@ int strerror_r(int errnum, char *buf, size_t buflen)
  * extension and has subsequently been POSIXised in POSIX.1-2008.
  */
 #ifndef HAVE_GETDELIM
-#define GD_SSIZE_T_MAX ((ssize_t)((size_t)-1>>1))
 ssize_t getdelim(char **lineptr, size_t *n, int delim, FILE *stream)
 {
   size_t nread;
@@ -136,7 +183,7 @@ ssize_t getdelim(char **lineptr, size_t *n, int delim, FILE *stream)
   if (*lineptr == NULL || *n == 0) {
     *lineptr = (char *)malloc(*n = 100);
     if (*lineptr == NULL) {
-      dreturn("%i)", -1);
+      dreturn("%i", -1);
       return -1;
     }
   }
@@ -150,7 +197,7 @@ ssize_t getdelim(char **lineptr, size_t *n, int delim, FILE *stream)
 
   if (nread == 0) {
     /* this is an error or EOF with no data read */
-    dreturn("%i)", -1);
+    dreturn("%i", -1);
     return -1;
   }
 
@@ -232,3 +279,191 @@ ssize_t getdelim(char **lineptr, size_t *n, int delim, FILE *stream)
   return count;
 }
 #endif
+
+#ifndef HAVE_BASENAME
+char *basename(char *path)
+{
+  char *last_elem, *ptr;
+
+  last_elem = path;
+
+  for (ptr = path; *ptr; ++ptr)
+    if ((*ptr == '/' || *ptr == GD_DIRSEP) && *(ptr + 1))
+      last_elem = ptr + 1;
+
+  return last_elem;
+}
+#endif
+
+/* emulate readdir_r(3) with non-threadsafe readdir(3) */
+#ifndef HAVE_READDIR_R
+int _GD_ReadDir(DIR *dirp, struct dirent *entry, struct dirent **result)
+{
+  struct dirent *local_entry;
+
+  dtrace("%p, %p, %p", dirp, entry, result);
+
+  errno = 0;
+  local_entry = readdir(dirp);
+  if (local_entry == NULL) {
+    *result = NULL;
+    if (errno) {
+      dreturn("%i", errno);
+      return errno;
+    }
+    dreturn("%i", 0);
+    return 0;
+  }
+
+  *result = entry;
+  memcpy(entry, local_entry, sizeof(struct dirent));
+  dreturn("%i", 0);
+  return 0;
+}
+#endif
+
+/* the MSVCRT's strtod isn't POSIX compliant */
+#ifdef __MSVCRT__
+double gd_strtod(const char *nptr, char **endptr)
+{
+  const char *ptr = nptr;
+  double r = 0;
+  int sign = 0;
+
+  dtrace("\"%s\", %p", nptr, endptr);
+
+  /* the basic problem here is that MSVCRT's strtod() doesn't properly covert
+   * hexadecimal numbers, nor does it do the special values "INF" and "NAN".
+   */
+
+  /* skip sign */
+  if (*ptr == '+' || *ptr == '-') {
+    if (*ptr == '-')
+      sign = 0x80;
+    ptr++;
+  }
+
+  /* check for hex, either integer or floating point */
+  if (*ptr == '0' && (*(ptr + 1) | 0x20) == 'x') {
+    double fact = 1.;
+    /* we store the mantissa in r */
+    for (ptr += 2; *ptr; ++ptr) {
+      if ((*ptr >= '0' && *ptr <= '9') ||
+          ((*ptr | 0x20) >= 'a' && (*ptr | 0x20) <= 'f'))
+      {
+        if (fact == 1.)
+          r *= 16;
+        else if (fact == 0.)
+          fact = 1./16;
+        else
+          fact /= 16;
+
+        if (*ptr >= '0' && *ptr <= '9')
+          r += fact * (*ptr - '0');
+        else
+          r += fact * ((*ptr | 0x20) - 'a' + 10);
+      } else if (*ptr == '.' && fact == 1.)
+        fact = 0.;
+      else if ((*ptr | 0x20) == 'p') {
+        /* use strtol to get exponent, which is in decimal */
+        long exp = strtol(ptr + 1, endptr, 10);
+        r *= pow(2., exp);
+
+        /* to avoid setting it again */
+        endptr = NULL;
+        break;
+      } else
+        break;
+    }
+
+    if (endptr)
+      *endptr = (char*)ptr;
+
+    if (sign)
+      r = -r;
+
+    dreturn("%g (%c)", r, endptr ? **endptr : '-');
+    return r;
+  } else if ((*ptr | 0x20) == 'n') {
+    if (((*(ptr + 1) | 0x20) == 'a') && ((*(ptr + 2) | 0x20) == 'n')) {
+      /* an IEEE-754 double-precision quiet NaN:
+       *
+       * 1111 1111 1111 1111 1111 1111 1111 1111
+       * 1111 1111 1111 1111 1111 1111 1111 1111
+       * = 0xFFFFFFFFFFFFFFFF
+       *
+       * (a signalling NaN doesn't set the MSB of the mantissa)
+       *
+       * There are several of these; this one is nice because it's byte-sex
+       * independent, unlike INF below.
+       */
+      const union {
+        unsigned char x[8];
+        double d;
+      } nan_punning = {{ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF }};
+
+      if (endptr) {
+        *endptr = (char*)(ptr += 3);
+        /* a NaN may end with something in parentheses */
+        if (*ptr == '(') {
+          while (*++ptr) {
+            if (*ptr == ')') {
+              *endptr = (char*)(ptr + 1);
+              break;
+            }
+          }
+        }
+      }
+
+      /* return NaN */
+      dreturn("%g (%c)", nan_punning.d, endptr ? **endptr : '-');
+      return nan_punning.d;
+    }
+  } else if ((*ptr | 0x20) == 'i') {
+    if (((*(ptr + 1) | 0x20) == 'n') && ((*(ptr + 2) | 0x20) == 'f')) {
+      /* an IEEE-754 double-precision infinity (s is the sign bit):
+       *
+       * s111 1111 1111 1000 0000 0000 0000 0000
+       * 0000 0000 0000 0000 0000 0000 0000 0000
+       * = 0x7FF0000000000000 (+INF), or
+       *   0xFFF0000000000000 (-INF)
+       */
+      const union {
+        unsigned char x[8];
+        double d;
+      } inf_punning = {{
+#ifdef ARM_ENDIAN_DOUBLES
+        0x00, 0x00, 0xF0, 0x7F | sign, 0x00, 0x00, 0x00, 0x00
+#elif defined(FLOATS_BIGENDIAN)
+          0x7F | sign, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
+#else
+          0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xF0, 0x7F | sign
+#endif
+      }};
+
+      if (endptr) {
+        *endptr = (char*)(ptr += 3);
+        /* INF may also be INFINITY, disregarding case */
+        if (
+            ((*ptr | 0x20) == 'i') &&
+            ((*(ptr + 1) | 0x20) == 'n') &&
+            ((*(ptr + 2) | 0x20) == 'i') &&
+            ((*(ptr + 3) | 0x20) == 't') &&
+            ((*(ptr + 4) | 0x20) == 'y'))
+        {
+          *endptr += 5;
+        }
+      }
+
+      /* return signed infinity */
+      dreturn("%g (%c)", inf_punning.d, endptr ? **endptr : '-');
+      return inf_punning.d;
+    }
+  }
+
+  /* otherwise, just run strtod */
+  r = strtod(nptr, endptr);
+  dreturn("%g (%c)", r, endptr ? **endptr : '-');
+  return r;
+}
+#endif
diff --git a/src/constant.c b/src/constant.c
index 97fb078..c7874a5 100644
--- a/src/constant.c
+++ b/src/constant.c
@@ -20,52 +20,6 @@
  */
 #include "internal.h"
 
-#ifdef STDC_HEADERS
-#include <stdlib.h>
-#endif
-
-/* this function is little more than a public boilerplate for _GD_DoField */
-int gd_get_constant(DIRFILE* D, const char *field_code_in,
-    gd_type_t return_type, void *data_out) gd_nothrow
-{
-  gd_entry_t *entry;
-  char* field_code;
-  int repr;
-
-  dtrace("%p, \"%s\", 0x%x, %p", D, field_code_in, return_type, data_out);
-
-  if (D->flags & GD_INVALID) {/* don't crash */
-    _GD_SetError(D, GD_E_BAD_DIRFILE, 0, NULL, 0, NULL);
-    dreturn("%i", -1);
-    return -1;
-  }
-
-  _GD_ClearError(D);
-
-  entry = _GD_FindFieldAndRepr(D, field_code_in, &field_code, &repr, NULL, 1);
-    
-  if (D->error) {
-    dreturn("%i", -1);
-    return -1;
-  }
-
-  if (entry->field_type != GD_CONST_ENTRY)
-    _GD_SetError(D, GD_E_BAD_FIELD_TYPE, GD_E_FIELD_BAD, NULL, 0, field_code);
-  else if (!D->error)
-    _GD_DoField(D, entry, repr, 0, 1, return_type, data_out);
-
-  if (field_code != field_code_in)
-    free(field_code);
-
-  if (D->error) {
-    dreturn("%i", -1);
-    return -1;
-  }
-
-  dreturn("%i", 0);
-  return 0;
-}
-
 int gd_get_carray_slice(DIRFILE* D, const char *field_code_in,
     unsigned int start, size_t n, gd_type_t return_type, void *data_out)
 gd_nothrow
@@ -74,8 +28,8 @@ gd_nothrow
   char* field_code;
   int repr;
 
-  dtrace("%p, \"%s\", %i, %zi, 0x%x, %p", D, field_code_in, (int)start, n,
-      return_type, data_out);
+  dtrace("%p, \"%s\", %i, %" PRNsize_t ", 0x%x, %p", D, field_code_in,
+      (int)start, n, return_type, data_out);
 
   if (D->flags & GD_INVALID) {
     _GD_SetError(D, GD_E_BAD_DIRFILE, 0, NULL, 0, NULL);
@@ -85,18 +39,23 @@ gd_nothrow
 
   _GD_ClearError(D);
 
-  entry = _GD_FindFieldAndRepr(D, field_code_in, &field_code, &repr, NULL, 1);
-    
+  entry = _GD_FindFieldAndRepr(D, field_code_in, &field_code, &repr, NULL, 1,
+      1);
+
   if (D->error) {
     dreturn("%i", -1);
     return -1;
   }
 
-  if (entry->field_type != GD_CARRAY_ENTRY)
+  if (entry->field_type != GD_CARRAY_ENTRY &&
+      entry->field_type != GD_CONST_ENTRY)
+  {
     _GD_SetError(D, GD_E_BAD_FIELD_TYPE, GD_E_FIELD_BAD, NULL, 0, field_code);
-  else if (start + n > entry->EN(scalar,array_len))
+  } else if (start + n > ((entry->field_type == GD_CONST_ENTRY) ? 1 :
+      entry->EN(scalar,array_len)))
+  {
     _GD_SetError(D, GD_E_BOUNDS, 0, NULL, 0, NULL);
-  else if (!D->error)
+  } else if (!D->error)
     _GD_DoField(D, entry, repr, start, n, return_type, data_out);
 
   if (field_code != field_code_in)
@@ -128,18 +87,21 @@ int gd_get_carray(DIRFILE *D, const char *field_code_in, gd_type_t return_type,
 
   _GD_ClearError(D);
 
-  entry = _GD_FindFieldAndRepr(D, field_code_in, &field_code, &repr, NULL, 1);
-    
+  entry = _GD_FindFieldAndRepr(D, field_code_in, &field_code, &repr, NULL, 1,
+      1);
+
   if (D->error) {
     dreturn("%i", -1);
     return -1;
   }
 
-  if (entry->field_type != GD_CARRAY_ENTRY)
+  if (entry->field_type != GD_CARRAY_ENTRY &&
+      entry->field_type != GD_CONST_ENTRY)
+  {
     _GD_SetError(D, GD_E_BAD_FIELD_TYPE, GD_E_FIELD_BAD, NULL, 0, field_code);
-  else if (!D->error)
-    _GD_DoField(D, entry, repr, 0, entry->EN(scalar,array_len), return_type,
-        data_out);
+  } else if (!D->error)
+    _GD_DoField(D, entry, repr, 0, (entry->field_type == GD_CONST_ENTRY) ? 1 :
+        entry->EN(scalar,array_len), return_type, data_out);
 
   if (field_code != field_code_in)
     free(field_code);
@@ -153,6 +115,12 @@ int gd_get_carray(DIRFILE *D, const char *field_code_in, gd_type_t return_type,
   return 0;
 }
 
+int gd_get_constant(DIRFILE* D, const char *field_code_in,
+    gd_type_t return_type, void *data_out) gd_nothrow
+{
+  return gd_get_carray_slice(D, field_code_in, 0, 1, return_type, data_out);
+}
+
 size_t gd_carray_len(DIRFILE *D, const char *field_code_in) gd_nothrow
 {
   gd_entry_t *entry;
@@ -169,15 +137,19 @@ size_t gd_carray_len(DIRFILE *D, const char *field_code_in) gd_nothrow
 
   _GD_ClearError(D);
 
-  entry = _GD_FindFieldAndRepr(D, field_code_in, &field_code, &repr, NULL, 1);
-    
+  entry = _GD_FindFieldAndRepr(D, field_code_in, &field_code, &repr, NULL, 1,
+      1);
+
   if (D->error) {
     dreturn("%i", 0);
     return 0;
   }
 
-  if (entry->field_type != GD_CARRAY_ENTRY)
+  if (entry->field_type != GD_CARRAY_ENTRY &&
+      entry->field_type != GD_CONST_ENTRY)
+  {
     _GD_SetError(D, GD_E_BAD_FIELD_TYPE, GD_E_FIELD_BAD, NULL, 0, field_code);
+  }
 
   if (field_code != field_code_in)
     free(field_code);
@@ -187,66 +159,10 @@ size_t gd_carray_len(DIRFILE *D, const char *field_code_in) gd_nothrow
     return 0;
   }
 
-  dreturn("%zu", entry->EN(scalar,array_len));
-  return entry->EN(scalar,array_len);
-}
-
-/* this function is little more than a public boilerplate for _GD_DoFieldOut */
-int gd_put_constant(DIRFILE* D, const char *field_code_in, gd_type_t data_type,
-    const void *data_in) gd_nothrow
-{
-  int i;
-  gd_entry_t *entry;
-  int repr;
-  char* field_code;
-
-  dtrace("%p, \"%s\", 0x%x, %p", D, field_code_in, data_type, data_in);
-
-  if (D->flags & GD_INVALID) {/* don't crash */
-    _GD_SetError(D, GD_E_BAD_DIRFILE, 0, NULL, 0, NULL);
-    dreturn("%i", -1);
-    return -1;
-  }
-
-  if ((D->flags & GD_ACCMODE) != GD_RDWR) {
-    _GD_SetError(D, GD_E_ACCMODE, 0, NULL, 0, NULL);
-    dreturn("%i", -1);
-    return -1;
-  }
-
-  _GD_ClearError(D);
-
-  entry = _GD_FindFieldAndRepr(D, field_code_in, &field_code, &repr, NULL, 1);
-
-  if (D->error) {
-    dreturn("%i", -1);
-    return -1;
-  }
-
-  if (entry->field_type != GD_CONST_ENTRY)
-    _GD_SetError(D, GD_E_BAD_FIELD_TYPE, GD_E_FIELD_BAD, NULL, 0, field_code);
-  else 
-    _GD_DoFieldOut(D, entry, repr, 0, 1, data_type, data_in);
-
-  if (field_code != field_code_in)
-    free(field_code);
-
-  if (D->error) {
-    dreturn("%i", -1);
-    return -1;
-  }
-
-  /* Flag all clients as needing recalculation */
-  for (i = 0; i < entry->e->u.scalar.n_client; ++i)
-    entry->e->u.scalar.client[i]->e->calculated = 0;
-
-  /* Clear the client list */
-  free(entry->e->u.scalar.client);
-  entry->e->u.scalar.client = NULL;
-  entry->e->u.scalar.n_client = 0;
-
-  dreturn("%i", 0);
-  return 0;
+  dreturn("%" PRNsize_t, (entry->field_type == GD_CONST_ENTRY) ? 1 :
+    entry->EN(scalar,array_len));
+  return (entry->field_type == GD_CONST_ENTRY) ? 1 :
+    entry->EN(scalar,array_len);
 }
 
 int gd_put_carray_slice(DIRFILE* D, const char *field_code_in,
@@ -258,8 +174,8 @@ gd_nothrow
   int repr;
   char* field_code;
 
-  dtrace("%p, \"%s\", %i, %zu, 0x%x, %p", D, field_code_in, first, n, data_type,
-      data_in);
+  dtrace("%p, \"%s\", %i, %" PRNsize_t ", 0x%x, %p", D, field_code_in, first, n,
+      data_type, data_in);
 
   if (D->flags & GD_INVALID) {
     _GD_SetError(D, GD_E_BAD_DIRFILE, 0, NULL, 0, NULL);
@@ -275,18 +191,23 @@ gd_nothrow
 
   _GD_ClearError(D);
 
-  entry = _GD_FindFieldAndRepr(D, field_code_in, &field_code, &repr, NULL, 1);
+  entry = _GD_FindFieldAndRepr(D, field_code_in, &field_code, &repr, NULL, 1,
+      1);
 
   if (D->error) {
     dreturn("%i", -1);
     return -1;
   }
 
-  if (entry->field_type != GD_CARRAY_ENTRY)
+  if (entry->field_type != GD_CARRAY_ENTRY &&
+      entry->field_type != GD_CONST_ENTRY)
+  {
     _GD_SetError(D, GD_E_BAD_FIELD_TYPE, GD_E_FIELD_BAD, NULL, 0, field_code);
-  else if (first + n > entry->EN(scalar,array_len))
+  } else if (first + n > ((entry->field_type == GD_CONST_ENTRY) ? 1 :
+        entry->EN(scalar,array_len)))
+  {
     _GD_SetError(D, GD_E_BOUNDS, 0, NULL, 0, NULL);
-  else 
+  } else
     _GD_DoFieldOut(D, entry, repr, first, n, data_type, data_in);
 
   if (field_code != field_code_in)
@@ -334,18 +255,22 @@ int gd_put_carray(DIRFILE* D, const char *field_code_in, gd_type_t data_type,
 
   _GD_ClearError(D);
 
-  entry = _GD_FindFieldAndRepr(D, field_code_in, &field_code, &repr, NULL, 1);
+  entry = _GD_FindFieldAndRepr(D, field_code_in, &field_code, &repr, NULL, 1,
+      1);
 
   if (D->error) {
     dreturn("%i", -1);
     return -1;
   }
 
-  if (entry->field_type != GD_CARRAY_ENTRY)
+  if (entry->field_type != GD_CARRAY_ENTRY &&
+      entry->field_type != GD_CONST_ENTRY)
+  {
     _GD_SetError(D, GD_E_BAD_FIELD_TYPE, GD_E_FIELD_BAD, NULL, 0, field_code);
-  else 
-    _GD_DoFieldOut(D, entry, repr, 0, entry->EN(scalar,array_len), data_type,
-        data_in);
+  } else
+    _GD_DoFieldOut(D, entry, repr, 0,
+        (entry->field_type == GD_CONST_ENTRY) ? 1 : entry->EN(scalar,array_len),
+        data_type, data_in);
 
   if (field_code != field_code_in)
     free(field_code);
@@ -368,5 +293,11 @@ int gd_put_carray(DIRFILE* D, const char *field_code_in, gd_type_t data_type,
   return 0;
 }
 
+int gd_put_constant(DIRFILE* D, const char *field_code_in, gd_type_t data_type,
+    const void *data_in) gd_nothrow
+{
+  return gd_put_carray_slice(D, field_code_in, 0, 1, data_type, data_in);
+}
+
 /* vim: ts=2 sw=2 et tw=80
 */
diff --git a/src/debug.c b/src/debug.c
index 1da8dc1..5e5f0f4 100644
--- a/src/debug.c
+++ b/src/debug.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008, 2010 D. V. Wiebe
+/* Copyright (C) 2008, 2010, 2013 D. V. Wiebe
  *
  ***************************************************************************
  *
@@ -20,31 +20,36 @@
  */
 #include "internal.h"
 
-#include <string.h>
 extern char gd_debug_col[GD_COL_SIZE + 1];
 extern int gd_col_count;
 
-const char* _gd_colnil(void) {
+const char* gd_colnil(void) {
   return gd_debug_col;
 }
 
-const char* _gd_coladd(void)
+const char* gd_coladd(void)
 {
   if (gd_col_count < GD_COL_SIZE) {
     gd_debug_col[gd_col_count++] = ':';
     gd_debug_col[gd_col_count] = '\0';
   }
 
-  return _gd_colnil();
+  return gd_colnil();
 }
 
-const char* _gd_colsub(void)
+const char* gd_colsub(void)
 {
   static char buffer[GD_COL_SIZE + 1];
-  strcpy(buffer, _gd_colnil());
+  strcpy(buffer, gd_colnil());
 
   if (gd_col_count > 0)
     gd_debug_col[--gd_col_count] = '\0';
 
   return buffer;
 }
+
+void gd_colclear(void)
+{
+  gd_col_count = 0;
+  gd_debug_col[0] = '\0';
+}
diff --git a/src/del.c b/src/del.c
index 5eb05b5..8f8659d 100644
--- a/src/del.c
+++ b/src/del.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2010 D. V. Wiebe
+/* Copyright (C) 2008-2012 D. V. Wiebe
  *
  ***************************************************************************
  *
@@ -20,14 +20,8 @@
  */
 #include "internal.h"
 
-#ifdef STDC_HEADERS
-#include <stdlib.h>
-#include <string.h>
-#include <errno.h>
-#endif
-
-static void _GD_ClearDerived(DIRFILE* D, gd_entry_t* E, const gd_entry_t* C,
-    int check)
+static void _GD_ClearDerived(DIRFILE *restrict D, gd_entry_t *restrict E,
+    const gd_entry_t *restrict C, int check)
 {
   int i;
 
@@ -46,6 +40,8 @@ static void _GD_ClearDerived(DIRFILE* D, gd_entry_t* E, const gd_entry_t* C,
       break;
     case GD_MULTIPLY_ENTRY:
     case GD_DIVIDE_ENTRY:
+    case GD_WINDOW_ENTRY:
+    case GD_MPLEX_ENTRY:
       if (strcmp(E->in_fields[1], C->field) == 0) {
         if (check)
           _GD_SetError(D, GD_E_DELETE, GD_E_DEL_DERIVED, E->field, 0,
@@ -76,13 +72,22 @@ static void _GD_ClearDerived(DIRFILE* D, gd_entry_t* E, const gd_entry_t* C,
     case GD_CARRAY_ENTRY:
     case GD_STRING_ENTRY:
       break;
+    default:
+      if (E->field_type == GD_ALIAS_ENTRY)
+        if (E->e->entry[0] == C) {
+          if (check)
+            _GD_SetError(D, GD_E_DELETE, GD_E_DEL_ALIAS, E->field, 0, C->field);
+          else
+            E->e->entry[0] = NULL;
+        }
   }
 
   dreturnvoid();
 }
 
-static int _GD_DeReferenceOne(DIRFILE* D, gd_entry_t* E, gd_entry_t* C,
-    int check, int i, gd_type_t type, void *data)
+static int _GD_DeReferenceOne(DIRFILE *restrict D, gd_entry_t *restrict E,
+    gd_entry_t *restrict C, int check, int i, gd_type_t type,
+    void *restrict data)
 {
   int repr;
   char *field_code;
@@ -90,7 +95,7 @@ static int _GD_DeReferenceOne(DIRFILE* D, gd_entry_t* E, gd_entry_t* C,
   dtrace("%p, %p, %p, %i, %i, 0x%03x, %p", D, E, C, check, i, type, data);
 
   if (E->scalar[i] != NULL) {
-    repr = _GD_GetRepr(D, E->scalar[i], &field_code);
+    repr = _GD_GetRepr(D, E->scalar[i], &field_code, 1);
 
     if (D->error) {
       dreturn("%i", 1);
@@ -121,8 +126,8 @@ static int _GD_DeReferenceOne(DIRFILE* D, gd_entry_t* E, gd_entry_t* C,
   return 0;
 }
 
-static void _GD_DeReference(DIRFILE* D, gd_entry_t* E, gd_entry_t* C,
-    int check)
+static void _GD_DeReference(DIRFILE *restrict D, gd_entry_t *restrict E,
+    gd_entry_t *restrict C, int check)
 {
   int i;
 
@@ -130,7 +135,7 @@ static void _GD_DeReference(DIRFILE* D, gd_entry_t* E, gd_entry_t* C,
 
   switch(E->field_type) {
     case GD_RAW_ENTRY:
-      _GD_DeReferenceOne(D, E, C, check, 0, GD_UINT16, &E->EN(raw,spf));
+      _GD_DeReferenceOne(D, E, C, check, 0, GD_UINT_TYPE, &E->EN(raw,spf));
       break;
     case GD_POLYNOM_ENTRY:
       for (i = 0; i <= E->EN(polynom,poly_ord); ++i) {
@@ -168,14 +173,39 @@ static void _GD_DeReference(DIRFILE* D, gd_entry_t* E, gd_entry_t* C,
       break;
     case GD_BIT_ENTRY:
     case GD_SBIT_ENTRY:
-      if (_GD_DeReferenceOne(D, E, C, check, 0, GD_INT16, &E->EN(bit,bitnum)))
+      if (_GD_DeReferenceOne(D, E, C, check, 0, GD_INT_TYPE,
+            &E->EN(bit,bitnum)))
         break;
 
-      _GD_DeReferenceOne(D, E, C, check, 1, GD_INT16, &E->EN(bit,numbits));
+      _GD_DeReferenceOne(D, E, C, check, 1, GD_INT_TYPE, &E->EN(bit,numbits));
       break;
     case GD_PHASE_ENTRY:
       _GD_DeReferenceOne(D, E, C, check, 0, GD_INT64, &E->EN(phase,shift));
       break;
+    case GD_WINDOW_ENTRY:
+      switch (E->EN(window,windop)) {
+        case GD_WINDOP_EQ:
+        case GD_WINDOP_NE:
+          _GD_DeReferenceOne(D, E, C, check, 0, GD_INT64,
+              &E->EN(window,threshold.i));
+          break;
+        case GD_WINDOP_SET:
+        case GD_WINDOP_CLR:
+          _GD_DeReferenceOne(D, E, C, check, 0, GD_UINT64,
+              &E->EN(window,threshold.u));
+          break;
+        default:
+          _GD_DeReferenceOne(D, E, C, check, 0, GD_FLOAT64,
+              &E->EN(window,threshold.r));
+          break;
+      }
+      break;
+    case GD_MPLEX_ENTRY:
+      _GD_DeReferenceOne(D, E, C, check, 0, GD_INT_TYPE,
+          &E->EN(mplex,count_val));
+      _GD_DeReferenceOne(D, E, C, check, 1, GD_INT_TYPE,
+          &E->EN(mplex,period));
+      break;
     case GD_NO_ENTRY:
     case GD_LINTERP_ENTRY:
     case GD_MULTIPLY_ENTRY:
@@ -184,30 +214,24 @@ static void _GD_DeReference(DIRFILE* D, gd_entry_t* E, gd_entry_t* C,
     case GD_CONST_ENTRY:
     case GD_CARRAY_ENTRY:
     case GD_INDEX_ENTRY:
+    case GD_ALIAS_ENTRY:
       break;
   }
 
   dreturnvoid();
 }
 
-int gd_delete(DIRFILE* D, const char* field_code_in, int flags)
+static int _GD_Delete(DIRFILE *restrict D, gd_entry_t *restrict E,
+    unsigned int index, unsigned int flags)
 {
-  unsigned int index;
   unsigned int first, last = 0;
-  int n_del, i, repr, len;
+  int n_del, i, len;
   unsigned int j;
-  char *field_code;
   char **new_ref = NULL;
-  gd_entry_t *reference = NULL, *E;
+  gd_entry_t *reference = NULL;
   gd_entry_t **del_list;
 
-  dtrace("%p, \"%s\", %x", D, field_code_in, flags);
-
-  if (D->flags & GD_INVALID) {/* don't crash */
-    _GD_SetError(D, GD_E_BAD_DIRFILE, 0, NULL, 0, NULL);
-    dreturn("%i", -1);
-    return -1;
-  }
+  dtrace("%p, %p, %u, 0x%X", D, E, index, flags);
 
   if ((D->flags & GD_ACCMODE) != GD_RDWR) {
     _GD_SetError(D, GD_E_ACCMODE, 0, NULL, 0, NULL);
@@ -215,16 +239,7 @@ int gd_delete(DIRFILE* D, const char* field_code_in, int flags)
     return -1;
   }
 
-  _GD_ClearError(D);
-
-  E = _GD_FindFieldAndRepr(D, field_code_in, &field_code, &repr, &index, 1);
-
-  if (D->error) {
-    dreturn("%i", -1);
-    return -1;
-  }
-
-  len = strlen(field_code);
+  len = strlen(E->field);
 
   /* check protection */
   if (D->fragment[E->fragment_index].protection & GD_PROTECT_FORMAT) {
@@ -237,18 +252,16 @@ int gd_delete(DIRFILE* D, const char* field_code_in, int flags)
   /* If this field has metafields, and we weren't asked to delete those too,
    * complain */
   if (E->e->n_meta > 0 && ~flags & GD_DEL_META) {
-    _GD_SetError(D, GD_E_DELETE, GD_E_DEL_META, NULL, 0, field_code);
+    _GD_SetError(D, GD_E_DELETE, GD_E_DEL_META, NULL, 0, E->field);
     dreturn("%i", -1);
     return -1;
   } else if (E->e->n_meta > 0) {
     /* find one of the meta fields -- it's not true that metafields are
      * necessarily sorted directly after their parent */
     if (_GD_FindField(D, E->e->p.meta_entry[0]->field, D->entry, D->n_entries,
-          &first) == NULL)
+          0, &first) == NULL)
     {
       _GD_InternalError(D);
-      if (field_code != field_code_in)
-        free(field_code);
       dreturn("%i", -1);
       return -1;
     }
@@ -258,29 +271,25 @@ int gd_delete(DIRFILE* D, const char* field_code_in, int flags)
      * search linearly in both directions until we find something that isn't a
      * meta field of our parent */
     while (first > 0)
-      if (strncmp(D->entry[first - 1]->field, field_code, len) == 0 &&
+      if (strncmp(D->entry[first - 1]->field, E->field, len) == 0 &&
           D->entry[first - 1]->field[len] == '/')
         first--;
       else
         break;
 
     while (last < D->n_entries - 1)
-      if (strncmp(D->entry[last + 1]->field, field_code, len) == 0 &&
+      if (strncmp(D->entry[last + 1]->field, E->field, len) == 0 &&
           D->entry[last + 1]->field[len] == '/')
         last++;
       else
         break;
   }
 
-  if (field_code != field_code_in)
-    free(field_code);
-
   /* gather a list of fields */
-  del_list = (gd_entry_t **)malloc(sizeof(gd_entry_t*) * ((E->e->n_meta == -1) ?
-        1 : 1 + E->e->n_meta));
+  del_list = (gd_entry_t **)_GD_Malloc(D, sizeof(gd_entry_t*) *
+        (((E->e->n_meta == -1) ?  0 : E->e->n_meta) + 1));
 
   if (del_list == NULL) {
-    _GD_SetError(D, GD_E_ALLOC, 0, NULL, 0, NULL);
     dreturn("%i", -1);
     return -1;
   }
@@ -299,7 +308,7 @@ int gd_delete(DIRFILE* D, const char* field_code_in, int flags)
               del_list[i]->field_type == GD_CARRAY_ENTRY) &&
             ~flags & GD_DEL_DEREF)
           _GD_DeReference(D, D->entry[j], del_list[i], 1);
-        else if (~del_list[i]->field_type & GD_SCALAR_ENTRY)
+        else if (del_list[i]->field_type != GD_STRING_ENTRY)
           _GD_ClearDerived(D, D->entry[j], del_list[i], 1);
 
         if (D->error) {
@@ -320,27 +329,31 @@ int gd_delete(DIRFILE* D, const char* field_code_in, int flags)
       return -1;
     }
 
-    if (!_GD_Supports(D, E, GD_EF_UNLINK)) {
+    if (!_GD_Supports(D, E, GD_EF_NAME | GD_EF_UNLINK)) {
       free(del_list);
       dreturn("%i", -1);
       return -1;
     }
 
-    if (_GD_SetEncodedName(D, E->e->u.raw.file, E->e->u.raw.filebase, 0)) {
+    if ((*gd_ef_[E->e->u.raw.file[0].subenc].name)(D,
+          (const char*)D->fragment[E->fragment_index].enc_data,
+          E->e->u.raw.file, E->e->u.raw.filebase, 0, 0))
+    {
       free(del_list);
       dreturn("%i", -1);
       return -1;
     }
 
-    if ((*_gd_ef[E->e->u.raw.file[0].encoding].unlink)(E->e->u.raw.file)) {
+    if ((*gd_ef_[E->e->u.raw.file[0].subenc].unlink)(
+          D->fragment[E->fragment_index].dirfd, E->e->u.raw.file))
+    {
       _GD_SetError(D, GD_E_RAW_IO, 0, E->e->u.raw.file[0].name, errno, NULL);
       free(del_list);
       dreturn("%i", -1);
       return -1;
     }
-  } else if (E->field_type == GD_RAW_ENTRY && E->e->u.raw.file->fp != -1) {
-    if ((*_gd_ef[E->e->u.raw.file[0].encoding].close)(E->e->u.raw.file)) {
-      _GD_SetError(D, GD_E_RAW_IO, 0, E->e->u.raw.file[0].name, errno, NULL);
+  } else if (E->field_type == GD_RAW_ENTRY && E->e->u.raw.file->idata >= 0) {
+    if (_GD_FiniRawIO(D, E, E->fragment_index, GD_FINIRAW_DISCARD)) {
       free(del_list);
       dreturn("%i", -1);
       return -1;
@@ -349,10 +362,9 @@ int gd_delete(DIRFILE* D, const char* field_code_in, int flags)
 
   /* Fix up reference fields */
   if (E->field_type == GD_RAW_ENTRY) {
-    new_ref = (char **)malloc(sizeof(char*) * D->n_fragment);
+    new_ref = (char **)_GD_Malloc(D, sizeof(char*) * D->n_fragment);
     if (new_ref == NULL) {
       free(del_list);
-      _GD_SetError(D, GD_E_ALLOC, 0, NULL, 0, NULL);
       dreturn("%i", -1);
       return -1;
     }
@@ -378,13 +390,12 @@ int gd_delete(DIRFILE* D, const char* field_code_in, int flags)
               }
 
             if (in_scope) {
-              new_ref[i] = strdup(D->entry[j]->field);
-              if (new_ref == NULL) {
+              new_ref[i] = _GD_Strdup(D, D->entry[j]->field);
+              if (new_ref[i] == NULL) {
                 for (f = 0; f < i; ++f)
                   free(new_ref[f]);
                 free(new_ref);
                 free(del_list);
-                _GD_SetError(D, GD_E_ALLOC, 0, NULL, 0, NULL);
                 dreturn("%i", -1);
                 return -1;
               }
@@ -419,7 +430,7 @@ int gd_delete(DIRFILE* D, const char* field_code_in, int flags)
       if ((del_list[i]->field_type == GD_CONST_ENTRY ||
             del_list[i]->field_type == GD_CARRAY_ENTRY) && flags & GD_DEL_DEREF)
         _GD_DeReference(D, D->entry[j], del_list[i], 0);
-      else if (~del_list[i]->field_type & GD_SCALAR_ENTRY)
+      else if (del_list[i]->field_type != GD_STRING_ENTRY)
         _GD_ClearDerived(D, D->entry[j], del_list[i], 0);
 
   free(del_list);
@@ -429,53 +440,116 @@ int gd_delete(DIRFILE* D, const char* field_code_in, int flags)
     if (E->e->n_meta > 0) {
       /* Remove all meta fields -- there are no RAW fields here */
       for (j = first; j <= last; ++j)
-        _GD_FreeE(D->entry[j], 1);
+        _GD_FreeE(D, D->entry[j], 1);
 
       memmove(D->entry + first, D->entry + last + 1,
           sizeof(gd_entry_t*) * (D->n_entries - last - 1));
-      D->n_meta -= last - first + 1;
       D->n_entries -= last - first + 1;
     }
 
-    if (E->field_type == GD_CONST_ENTRY)
-      D->n_const--;
-    else if (E->field_type == GD_CARRAY_ENTRY)
-      D->n_carray--;
-    else if (E->field_type == GD_STRING_ENTRY)
-      D->n_string--;
+    /* Invalidate the field lists */
+    D->entry_list_validity = 0;
+    D->value_list_validity = 0;
   } else {
     /* If this is a metafield, update its parent's lists */
-    struct _gd_private_entry *Pe = E->e->p.parent->e;
+    struct gd_private_entry_ *Pe = E->e->p.parent->e;
 
     /* search and destroy */
-    for (i = 0; i < Pe->n_meta; ++i) 
+    for (i = 0; i < Pe->n_meta; ++i)
       if (Pe->p.meta_entry[i] == E) {
         Pe->p.meta_entry[i] = Pe->p.meta_entry[Pe->n_meta - 1];
         break;
       }
 
+    /* Decrement entry count */
     Pe->n_meta--;
-    if (E->field_type == GD_CONST_ENTRY)
-      Pe->n_meta_const--;
-    else if (E->field_type == GD_CARRAY_ENTRY)
-      Pe->n_meta_carray--;
-    else if (E->field_type == GD_STRING_ENTRY)
-      Pe->n_meta_string--;
+
+    /* Invalidate the field lists */
+    Pe->entry_list_validity = 0;
+    Pe->value_list_validity = 0;
   }
 
   /* Remove the entry from the list -- we need not worry about the way we've
    * already modified D->entry, since E is guaranteed to be before the stuff
    * we've already removed */
-  _GD_FreeE(E, 1);
+  D->fragment[E->fragment_index].modified = 1;
+  _GD_FreeE(D, E, 1);
 
   memmove(D->entry + index, D->entry + index + 1,
       sizeof(gd_entry_t *) * (D->n_entries - index - 1));
   D->n_entries--;
 
-  /* Invalidate the field lists */
-  D->list_validity = 0;
-  D->type_list_validity = 0;
-
   dreturn("%i", 0);
   return 0;
 }
+
+int gd_delete(DIRFILE *D, const char *field_code_in, unsigned int flags)
+{
+  unsigned index;
+  int repr, ret;
+  char *field_code;
+  gd_entry_t *E;
+
+  dtrace("%p, \"%s\", 0x%X", D, field_code_in, flags);
+
+  if (D->flags & GD_INVALID) {/* don't crash */
+    _GD_SetError(D, GD_E_BAD_DIRFILE, 0, NULL, 0, NULL);
+    dreturn("%i", -1);
+    return -1;
+  }
+
+  _GD_ClearError(D);
+
+  E = _GD_FindFieldAndRepr(D, field_code_in, &field_code, &repr, &index, 1, 1);
+
+  if (field_code != field_code_in)
+    free(field_code);
+
+  if (D->error) {
+    dreturn("%i", -1);
+    return -1;
+  }
+
+  ret = _GD_Delete(D, E, index, flags);
+
+  dreturn("%i", ret);
+  return ret;
+}
+
+
+int gd_delete_alias(DIRFILE *D, const char *field_code, unsigned int flags)
+  gd_nothrow
+{
+  unsigned index;
+  int ret;
+  gd_entry_t *E;
+
+  dtrace("%p, \"%s\", 0x%X", D, field_code, flags);
+
+  if (D->flags & GD_INVALID) {
+    _GD_SetError(D, GD_E_BAD_DIRFILE, 0, NULL, 0, NULL);
+    dreturn("%i", -1);
+    return -1;
+  }
+
+  _GD_ClearError(D);
+
+  E = _GD_FindField(D, field_code, D->entry, D->n_entries, 0, &index);
+
+  if (!E) {
+    _GD_SetError(D, GD_E_BAD_CODE, GD_E_CODE_MISSING, NULL, 0, field_code);
+    dreturn("%i", -1);
+    return -1;
+  }
+
+  if (E->field_type != GD_ALIAS_ENTRY) {
+    _GD_SetError(D, GD_E_BAD_FIELD_TYPE, GD_E_FIELD_BAD, NULL, 0, field_code);
+    dreturn("%i", -1);
+    return -1;
+  }
+
+  ret = _GD_Delete(D, E, index, flags);
+
+  dreturn("%i", ret);
+  return ret;
+}
diff --git a/src/encoding.c b/src/encoding.c
index 48374ba..5515d60 100644
--- a/src/encoding.c
+++ b/src/encoding.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011 D. V. Wiebe
+/* Copyright (C) 2008-2012 D. V. Wiebe
  *
  ***************************************************************************
  *
@@ -20,136 +20,156 @@
  */
 #include "internal.h"
 
-#ifdef STDC_HEADERS
-#include <inttypes.h>
-#include <errno.h>
-#include <fcntl.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <math.h>
-#include <stdlib.h>
-#include <string.h>
-#endif
-
 #ifdef USE_MODULES
 #ifdef USE_PTHREAD
 #ifdef HAVE_PTHREAD_H
 #include <pthread.h>
 #endif
-static pthread_mutex_t _gd_mutex = PTHREAD_MUTEX_INITIALIZER;
+static pthread_mutex_t gd_mutex_ = PTHREAD_MUTEX_INITIALIZER;
 #endif
 
 static int framework_initialised = 0;
 #endif
 
 /* encoding schemas */
-struct encoding_t _gd_ef[GD_N_SUBENCODINGS] = {
-  { GD_UNENCODED, "", 1, NULL, "none", 0,
-    &_GD_RawOpen, &_GD_RawClose, &_GD_GenericTouch, &_GD_RawSeek,
-    &_GD_RawRead, &_GD_RawSize, &_GD_RawWrite, &_GD_RawSync,
-    &_GD_GenericMove, &_GD_GenericUnlink, &_GD_RawTemp
-  },
+#define GD_EF_NULL_SET NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, \
+  NULL
+#define GD_EF_GENERIC_SET &_GD_GenericName, NULL, NULL, NULL, NULL, NULL, \
+  NULL, NULL, &_GD_GenericMove, &_GD_GenericUnlink
 #ifdef USE_MODULES
-  /* Modules are external */
-  { GD_GZIP_ENCODED, ".gz", 1, "Gzip", "gzip",
-# ifdef USE_GZIP
-    GD_EF_OPEN | GD_EF_CLOSE | GD_EF_SEEK | GD_EF_READ | GD_EF_SIZE,
-# else
-    0,
-# endif
-    NULL, NULL, NULL, NULL, NULL, NULL, NULL , NULL, &_GD_GenericMove,
-    &_GD_GenericUnlink, NULL },
-  { GD_BZIP2_ENCODED, ".bz2", 1, "Bzip2", "bzip2",
-# ifdef USE_BZIP2
-    GD_EF_OPEN | GD_EF_CLOSE | GD_EF_SEEK | GD_EF_READ | GD_EF_SIZE,
-# else
-    0,
-# endif
-    NULL, NULL, NULL, NULL, NULL, NULL, NULL , NULL, &_GD_GenericMove,
-    &_GD_GenericUnlink, NULL },
-  { GD_SLIM_ENCODED, ".slm", 1, "Slim", "slim",
-# ifdef USE_SLIM
-    GD_EF_OPEN | GD_EF_CLOSE | GD_EF_SEEK | GD_EF_READ | GD_EF_SIZE,
-# else
-    0,
-# endif
-    NULL, NULL, NULL, NULL, NULL, NULL, NULL , NULL, &_GD_GenericMove,
-    &_GD_GenericUnlink, NULL },
-  { GD_LZMA_ENCODED, ".xz", 1, "Lzma", "lzma",
-# ifdef USE_LZMA
-    GD_EF_OPEN | GD_EF_CLOSE | GD_EF_SEEK | GD_EF_READ | GD_EF_SIZE,
-# else
-    0,
-# endif
-    NULL, NULL, NULL, NULL, NULL, NULL, NULL , NULL, &_GD_GenericMove,
-    &_GD_GenericUnlink, NULL },
-  { GD_LZMA_ENCODED, ".lzma", 1, "Lzma", "lzma",
-# ifdef USE_LZMA
-    GD_EF_OPEN | GD_EF_CLOSE | GD_EF_SEEK | GD_EF_READ | GD_EF_SIZE,
-# else
-    0,
-# endif
-    NULL, NULL, NULL, NULL, NULL, NULL, NULL , NULL, &_GD_GenericMove,
-    &_GD_GenericUnlink, NULL },
+#define GD_EXT_ENCODING_NULL(sc,ex,ec,af,ff) \
+{ sc,ex,ec,af,ff,GD_EF_PROVIDES,GD_EF_NULL_SET }
+#define GD_EXT_ENCODING_GEN(sc,ex,ec,af,ff) \
+{ sc,ex,ec,af,ff,GD_EF_PROVIDES,GD_EF_GENERIC_SET }
 #else
-  /* Modules are internal */
-  { GD_GZIP_ENCODED, ".gz", 1, NULL, "gzip", 0,
-# ifdef USE_GZIP
-    &_GD_GzipOpen, &_GD_GzipClose, NULL /* TOUCH */,
-    &_GD_GzipSeek, &_GD_GzipRead, &_GD_GzipSize, NULL /* WRITE */,
-    NULL /* SYNC */, &_GD_GenericMove, &_GD_GenericUnlink, NULL /* TEMP */
-# else
-    NULL, NULL, NULL, NULL, NULL, NULL, NULL , NULL, &_GD_GenericMove,
-    &_GD_GenericUnlink, NULL
-# endif
-  },
-  { GD_BZIP2_ENCODED, ".bz2", 1, NULL, "bzip2", 0,
-# ifdef USE_BZIP2
-    &_GD_Bzip2Open, &_GD_Bzip2Close, NULL /* TOUCH */,
-    &_GD_Bzip2Seek, &_GD_Bzip2Read, &_GD_Bzip2Size, NULL /* WRITE */,
-    NULL /* SYNC */, &_GD_GenericMove, &_GD_GenericUnlink, NULL /* TEMP */
-# else
-    NULL, NULL, NULL, NULL, NULL, NULL, NULL , NULL, &_GD_GenericMove,
-    &_GD_GenericUnlink, NULL
-# endif
-  },
-  { GD_SLIM_ENCODED, ".slm", 1, NULL, "slim", 0,
-# ifdef USE_SLIM
-    &_GD_SlimOpen, &_GD_SlimClose, NULL /* TOUCH */,
-    &_GD_SlimSeek, &_GD_SlimRead, &_GD_SlimSize, NULL /* WRITE */,
-    NULL /* SYNC */, &_GD_GenericMove, &_GD_GenericUnlink, NULL /* TEMP */
-# else
-    NULL, NULL, NULL, NULL, NULL, NULL, NULL , NULL, &_GD_GenericMove,
-    &_GD_GenericUnlink, NULL
-# endif
+#define GD_EXT_ENCODING(sc,ex,ec,af,ff) { sc,ex,ec,af,ff,0,GD_INT_FUNCS }
+#define GD_EXT_ENCODING_NULL GD_EXT_ENCODING
+#define GD_EXT_ENCODING_GEN GD_EXT_ENCODING
+#endif
+struct encoding_t gd_ef_[GD_N_SUBENCODINGS] = {
+  { GD_UNENCODED, "", GD_EF_ECOR, NULL, "none", 0,
+    &_GD_GenericName, &_GD_RawOpen, &_GD_RawClose, &_GD_RawSeek, &_GD_RawRead,
+    &_GD_RawSize, &_GD_RawWrite, &_GD_RawSync, &_GD_GenericMove,
+    &_GD_GenericUnlink
   },
-  { GD_LZMA_ENCODED, ".xz", 1, NULL, "lzma", 0,
-# ifdef USE_LZMA
-    &_GD_LzmaOpen, &_GD_LzmaClose, NULL /* TOUCH */,
-    &_GD_LzmaSeek, &_GD_LzmaRead, &_GD_LzmaSize, NULL /* WRITE */,
-    NULL /* SYNC */, &_GD_GenericMove, &_GD_GenericUnlink, NULL /* TEMP */
-# else
-    NULL, NULL, NULL, NULL, NULL, NULL, NULL , NULL, &_GD_GenericMove,
-    &_GD_GenericUnlink, NULL
+
+#ifdef USE_GZIP
+#define GD_EF_PROVIDES \
+  GD_EF_OPEN | GD_EF_CLOSE | GD_EF_SEEK | GD_EF_READ | GD_EF_SIZE | \
+  GD_EF_WRITE | GD_EF_SYNC
+#define GD_INT_FUNCS \
+  &_GD_GenericName, &_GD_GzipOpen, &_GD_GzipClose, &_GD_GzipSeek, \
+  &_GD_GzipRead, &_GD_GzipSize, &_GD_GzipWrite, &_GD_GzipSync, \
+  &_GD_GenericMove, &_GD_GenericUnlink
+#else
+#define GD_EF_PROVIDES 0
+#define GD_INT_FUNCS GD_EF_NULL_SET
+#endif
+  GD_EXT_ENCODING_GEN(GD_GZIP_ENCODED, ".gz", GD_EF_ECOR | GD_EF_OOP, "Gzip",
+      "gzip"),
+#undef GD_INT_FUNCS
+#undef GD_EF_PROVIDES
+
+
+#ifdef USE_BZIP2
+#define GD_EF_PROVIDES \
+    GD_EF_OPEN | GD_EF_CLOSE | GD_EF_SEEK | GD_EF_READ | GD_EF_SIZE
+#define GD_INT_FUNCS \
+  &_GD_GenericName, &_GD_Bzip2Open, &_GD_Bzip2Close, &_GD_Bzip2Seek, \
+  &_GD_Bzip2Read, &_GD_Bzip2Size, NULL /* WRITE */, NULL /* SYNC */, \
+  &_GD_GenericMove, &_GD_GenericUnlink
+#else
+#define GD_INT_FUNCS GD_EF_NULL_SET
+#define GD_EF_PROVIDES 0
 #endif
+  GD_EXT_ENCODING_GEN(GD_BZIP2_ENCODED, ".bz2", GD_EF_ECOR, "Bzip2", "bzip2"),
+#undef GD_INT_FUNCS
+#undef GD_EF_PROVIDES
+
+
+#ifdef USE_SLIM
+#define GD_EF_PROVIDES \
+  GD_EF_OPEN | GD_EF_CLOSE | GD_EF_SEEK | GD_EF_READ | GD_EF_SIZE
+#define GD_INT_FUNCS \
+  &_GD_GenericName, &_GD_SlimOpen, &_GD_SlimClose, &_GD_SlimSeek, \
+  &_GD_SlimRead, &_GD_SlimSize, NULL /* WRITE */, NULL /* SYNC */, \
+  &_GD_GenericMove, &_GD_GenericUnlink
+#else
+#define GD_INT_FUNCS GD_EF_NULL_SET
+#define GD_EF_PROVIDES 0
+#endif
+  GD_EXT_ENCODING_GEN(GD_SLIM_ENCODED, ".slm", GD_EF_ECOR, "Slim", "slim"),
+#undef GD_INT_FUNCS
+#undef GD_EF_PROVIDES
+
+
+#ifdef USE_LZMA
+#define GD_EF_PROVIDES \
+    GD_EF_OPEN | GD_EF_CLOSE | GD_EF_SEEK | GD_EF_READ | GD_EF_SIZE
+#define GD_INT_FUNCS \
+  &_GD_GenericName, &_GD_LzmaOpen, &_GD_LzmaClose, &_GD_LzmaSeek, \
+  &_GD_LzmaRead, &_GD_LzmaSize, NULL /* WRITE */, NULL /* SYNC */, \
+  &_GD_GenericMove, &_GD_GenericUnlink
+#else
+#define GD_INT_FUNCS GD_EF_NULL_SET
+#define GD_EF_PROVIDES 0
+#endif
+  GD_EXT_ENCODING_GEN(GD_LZMA_ENCODED, ".xz", GD_EF_ECOR, "Lzma", "lzma"),
+  GD_EXT_ENCODING_GEN(GD_LZMA_ENCODED, ".lzma", GD_EF_ECOR, "Lzma", "lzma"),
+#undef GD_INT_FUNCS
+#undef GD_EF_PROVIDES
+
+
+  { GD_TEXT_ENCODED, ".txt", 0, NULL, "text", 0,
+    &_GD_GenericName, &_GD_AsciiOpen, &_GD_AsciiClose, &_GD_AsciiSeek,
+    &_GD_AsciiRead, &_GD_AsciiSize, &_GD_AsciiWrite, &_GD_AsciiSync,
+    &_GD_GenericMove, &_GD_GenericUnlink
   },
-  { GD_LZMA_ENCODED, ".lzma", 1, NULL, "lzma", 0,
-# ifdef USE_LZMA
-    &_GD_LzmaOpen, &_GD_LzmaClose, NULL /* TOUCH */,
-    &_GD_LzmaSeek, &_GD_LzmaRead, &_GD_LzmaSize, NULL /* WRITE */,
-    NULL /* SYNC */, &_GD_GenericMove, &_GD_GenericUnlink, NULL /* TEMP */
-# else
-    NULL, NULL, NULL, NULL, NULL, NULL, NULL , NULL, &_GD_GenericMove,
-    &_GD_GenericUnlink, NULL
-# endif
+
+  { GD_SIE_ENCODED, ".sie", GD_EF_ECOR | GD_EF_SWAP, NULL, "sie", 0,
+    &_GD_GenericName, &_GD_SampIndOpen, &_GD_SampIndClose, &_GD_SampIndSeek,
+    &_GD_SampIndRead, &_GD_SampIndSize, &_GD_SampIndWrite, &_GD_SampIndSync,
+    &_GD_GenericMove, &_GD_GenericUnlink
   },
+
+
+#ifdef USE_ZZIP
+#define GD_EF_PROVIDES \
+    GD_EF_NAME | GD_EF_OPEN | GD_EF_CLOSE | GD_EF_SEEK | GD_EF_READ | GD_EF_SIZE
+#define GD_INT_FUNCS \
+  &_GD_ZzipName, &_GD_ZzipOpen, &_GD_ZzipClose, &_GD_ZzipSeek, &_GD_ZzipRead, \
+  &_GD_ZzipSize, NULL /* WRITE */, NULL /* SYNC */, NULL /* MOVE */, \
+  NULL /* UNLINK */
+#else
+#define GD_INT_FUNCS NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL
+#define GD_EF_PROVIDES 0
 #endif
-  { GD_TEXT_ENCODED, ".txt", 0, NULL, "text", 0,
-    &_GD_AsciiOpen, &_GD_AsciiClose, &_GD_GenericTouch,
-    &_GD_AsciiSeek, &_GD_AsciiRead, &_GD_AsciiSize, &_GD_AsciiWrite,
-    &_GD_AsciiSync, &_GD_GenericMove, &_GD_GenericUnlink, &_GD_AsciiTemp },
-  { GD_ENC_UNSUPPORTED, "", 0, "", "", 0,
-    NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL },
+  GD_EXT_ENCODING_NULL(GD_ZZIP_ENCODED, NULL, GD_EF_ECOR | GD_EF_EDAT, "Zzip",
+      "zzip"),
+#undef GD_INT_FUNCS
+#undef GD_EF_PROVIDES
+
+
+#ifdef USE_ZZSLIM
+#define GD_EF_PROVIDES \
+    GD_EF_NAME | GD_EF_OPEN | GD_EF_CLOSE | GD_EF_SEEK | GD_EF_READ | GD_EF_SIZE
+#define GD_INT_FUNCS \
+  &_GD_ZzslimName, &_GD_ZzslimOpen, &_GD_ZzslimClose, &_GD_ZzslimSeek, \
+  &_GD_ZzslimRead, &_GD_ZzslimSize, NULL /* WRITE */, NULL /* SYNC */, \
+  NULL /* MOVE */, NULL /* UNLINK */
+#else
+#define GD_INT_FUNCS NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL
+#define GD_EF_PROVIDES 0
+#endif
+  GD_EXT_ENCODING_NULL(GD_ZZSLIM_ENCODED, NULL, GD_EF_ECOR | GD_EF_EDAT,
+      "Zzslim", "zzslim"),
+#undef GD_INT_FUNCS
+#undef GD_EF_PROVIDES
+
+
+  { GD_ENC_UNSUPPORTED, NULL, 0, "", "", 0,
+    NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL
+  }
 };
 
 void _GD_InitialiseFramework(void)
@@ -157,14 +177,14 @@ void _GD_InitialiseFramework(void)
   dtracevoid();
 #ifdef USE_MODULES
 #ifdef USE_PTHREAD
-  pthread_mutex_lock(&_gd_mutex);
+  pthread_mutex_lock(&gd_mutex_);
 #endif
   if (!framework_initialised) {
     framework_initialised = 1;
     lt_dlinit();
   }
 #ifdef USE_PTHREAD
-  pthread_mutex_unlock(&_gd_mutex);
+  pthread_mutex_unlock(&gd_mutex_);
 #endif
 #endif
   dreturnvoid();
@@ -173,11 +193,12 @@ void _GD_InitialiseFramework(void)
 #define _GD_EncodingUnderstood(encoding) \
   ((encoding == GD_UNENCODED || encoding == GD_SLIM_ENCODED || \
     encoding == GD_GZIP_ENCODED || encoding == GD_BZIP2_ENCODED || \
-    encoding == GD_TEXT_ENCODED || encoding == GD_LZMA_ENCODED))
+    encoding == GD_TEXT_ENCODED || encoding == GD_LZMA_ENCODED || \
+    encoding == GD_SIE_ENCODED))
 
 #ifdef USE_MODULES
-static void* _GD_ResolveSymbol(lt_dlhandle lib, struct encoding_t* enc,
-    const char* name)
+static void *_GD_ResolveSymbol(lt_dlhandle lib, struct encoding_t *restrict enc,
+    const char *restrict name)
 {
   void* func;
   char symbol[100];
@@ -197,135 +218,451 @@ int _GD_MissingFramework(int encoding, unsigned int funcs)
 {
   int ret;
 
-  dtrace("%x, %x", encoding, funcs);
+  dtrace("%i, 0x%X", encoding, funcs);
 
 #ifdef USE_MODULES
 #ifdef USE_PTHREAD
-  pthread_mutex_lock(&_gd_mutex);
+  pthread_mutex_lock(&gd_mutex_);
 #endif
 
   /* set up the encoding library if required */
-  if (_gd_ef[encoding].provides) {
-    char library[FILENAME_MAX];
+  if (gd_ef_[encoding].provides) {
+    char *library;
     lt_dlhandle lib;
 
     /* make the library name */
-    sprintf(library, "%s/libgetdata%s-%s", GETDATA_MODULEDIR,
-        _gd_ef[encoding].affix, PACKAGE_VERSION);
+    library = (char *)malloc(sizeof(GETDATA_MODULEDIR) +
+        strlen(gd_ef_[encoding].affix) + sizeof(PACKAGE_VERSION) + 13);
+    if (!library) {
+      gd_ef_[encoding].provides = 0;
+#ifdef USE_PTHREAD
+      pthread_mutex_unlock(&gd_mutex_);
+#endif
+      dreturn("%i", 1);
+      return 1;
+    }
+
+    strcat(strcat(strcpy(library, GETDATA_MODULEDIR "/libgetdata"),
+          gd_ef_[encoding].affix), "-" PACKAGE_VERSION);
     library[sizeof(GETDATA_MODULEDIR) + 10] -= 'A' - 'a';
 
     /* open */
     if ((lib = lt_dlopenext(library)) == NULL) {
       /* if that didn't work, look for it in the search path */
-      sprintf(library, "libgetdata%s-%s", _gd_ef[encoding].affix,
-          PACKAGE_VERSION);
-      library[10] -= 'A' - 'a';
-      if ((lib = lt_dlopenext(library)) == NULL) {
-        _gd_ef[encoding].provides = 0;
+      if ((lib = lt_dlopenext(library + sizeof(GETDATA_MODULEDIR))) == NULL)
+      {
+        free(library);
+        gd_ef_[encoding].provides = 0;
 #ifdef USE_PTHREAD
-        pthread_mutex_unlock(&_gd_mutex);
+        pthread_mutex_unlock(&gd_mutex_);
 #endif
         dreturn("%i", 1);
         return 1;
       }
     }
+    free(library);
 
     /* Try to resolve the symbols */
-    if (_gd_ef[encoding].provides & GD_EF_OPEN)
-      _gd_ef[encoding].open = (int (*)(struct _gd_raw_file*, int,
-            int))_GD_ResolveSymbol(lib, _gd_ef + encoding, "Open");
-    if (_gd_ef[encoding].provides & GD_EF_CLOSE)
-      _gd_ef[encoding].close =
-        (int (*)(struct _gd_raw_file*))_GD_ResolveSymbol(lib, _gd_ef + encoding,
-            "Close");
-    if (_gd_ef[encoding].provides & GD_EF_TOUCH)
-      _gd_ef[encoding].touch = (int (*)(struct _gd_raw_file*))
-        _GD_ResolveSymbol(lib, _gd_ef + encoding, "Touch");
-    if (_gd_ef[encoding].provides & GD_EF_SEEK)
-      _gd_ef[encoding].seek = (off64_t (*)(struct _gd_raw_file*, off64_t,
-            gd_type_t, int))_GD_ResolveSymbol(lib, _gd_ef + encoding, "Seek");
-    if (_gd_ef[encoding].provides & GD_EF_READ)
-      _gd_ef[encoding].read = (ssize_t (*)(struct _gd_raw_file*, void*,
-            gd_type_t, size_t))_GD_ResolveSymbol(lib, _gd_ef + encoding,
-            "Read");
-    if (_gd_ef[encoding].provides & GD_EF_SIZE)
-      _gd_ef[encoding].size = (off64_t (*)(struct _gd_raw_file*,
-            gd_type_t))_GD_ResolveSymbol(lib, _gd_ef + encoding, "Size");
-    if (_gd_ef[encoding].provides & GD_EF_WRITE)
-      _gd_ef[encoding].write = (ssize_t (*)(struct _gd_raw_file*, const void*,
-            gd_type_t, size_t))_GD_ResolveSymbol(lib, _gd_ef + encoding,
-            "Write");
-    if (_gd_ef[encoding].provides & GD_EF_SYNC)
-      _gd_ef[encoding].sync =
-        (int (*)(struct _gd_raw_file*))_GD_ResolveSymbol(lib, _gd_ef + encoding,
-            "Sync");
-    if (_gd_ef[encoding].provides & GD_EF_UNLINK)
-      _gd_ef[encoding].unlink =
-        (int (*)(struct _gd_raw_file*))_GD_ResolveSymbol(lib, _gd_ef + encoding,
-            "Unlink");
-    if (_gd_ef[encoding].provides & GD_EF_TEMP)
-      _gd_ef[encoding].temp = (int (*)(struct _gd_raw_file*,
-            int))_GD_ResolveSymbol(lib, _gd_ef + encoding, "Temp");
+    if (gd_ef_[encoding].provides & GD_EF_NAME)
+      gd_ef_[encoding].name = (gd_ef_name_t)_GD_ResolveSymbol(lib,
+          gd_ef_ + encoding, "Name");
+    if (gd_ef_[encoding].provides & GD_EF_OPEN)
+      gd_ef_[encoding].open = (gd_ef_open_t)_GD_ResolveSymbol(lib,
+          gd_ef_ + encoding, "Open");
+    if (gd_ef_[encoding].provides & GD_EF_CLOSE)
+      gd_ef_[encoding].close = (gd_ef_close_t)_GD_ResolveSymbol(lib,
+          gd_ef_ + encoding, "Close");
+    if (gd_ef_[encoding].provides & GD_EF_SEEK)
+      gd_ef_[encoding].seek = (gd_ef_seek_t)_GD_ResolveSymbol(lib,
+          gd_ef_ + encoding, "Seek");
+    if (gd_ef_[encoding].provides & GD_EF_READ)
+      gd_ef_[encoding].read = (gd_ef_read_t)_GD_ResolveSymbol(lib,
+          gd_ef_ + encoding, "Read");
+    if (gd_ef_[encoding].provides & GD_EF_SIZE)
+      gd_ef_[encoding].size = (gd_ef_size_t)_GD_ResolveSymbol(lib,
+          gd_ef_ + encoding, "Size");
+    if (gd_ef_[encoding].provides & GD_EF_WRITE)
+      gd_ef_[encoding].write = (gd_ef_write_t)_GD_ResolveSymbol(lib,
+          gd_ef_ + encoding, "Write");
+    if (gd_ef_[encoding].provides & GD_EF_SYNC)
+      gd_ef_[encoding].sync = (gd_ef_sync_t)_GD_ResolveSymbol(lib,
+          gd_ef_ + encoding, "Sync");
+    if (gd_ef_[encoding].provides & GD_EF_UNLINK)
+      gd_ef_[encoding].unlink = (gd_ef_unlink_t)_GD_ResolveSymbol(lib,
+          gd_ef_ + encoding, "Unlink");
 
     /* we tried our best, don't bother trying again */
-    _gd_ef[encoding].provides = 0;
+    gd_ef_[encoding].provides = 0;
   }
 #ifdef USE_PTHREAD
-  pthread_mutex_unlock(&_gd_mutex);
+  pthread_mutex_unlock(&gd_mutex_);
 #endif
 #endif
 
   ret =
-    (funcs & GD_EF_OPEN   && _gd_ef[encoding].open   == NULL) ||
-    (funcs & GD_EF_CLOSE  && _gd_ef[encoding].close  == NULL) ||
-    (funcs & GD_EF_TOUCH  && _gd_ef[encoding].touch  == NULL) ||
-    (funcs & GD_EF_SEEK   && _gd_ef[encoding].seek   == NULL) ||
-    (funcs & GD_EF_READ   && _gd_ef[encoding].read   == NULL) ||
-    (funcs & GD_EF_SIZE   && _gd_ef[encoding].size   == NULL) ||
-    (funcs & GD_EF_WRITE  && _gd_ef[encoding].write  == NULL) ||
-    (funcs & GD_EF_SYNC   && _gd_ef[encoding].sync   == NULL) ||
-    (funcs & GD_EF_UNLINK && _gd_ef[encoding].unlink == NULL) ||
-    (funcs & GD_EF_TEMP   && _gd_ef[encoding].temp   == NULL);
+    (funcs & GD_EF_NAME    && gd_ef_[encoding].name    == NULL) ||
+    (funcs & GD_EF_OPEN    && gd_ef_[encoding].open    == NULL) ||
+    (funcs & GD_EF_CLOSE   && gd_ef_[encoding].close   == NULL) ||
+    (funcs & GD_EF_SEEK    && gd_ef_[encoding].seek    == NULL) ||
+    (funcs & GD_EF_READ    && gd_ef_[encoding].read    == NULL) ||
+    (funcs & GD_EF_SIZE    && gd_ef_[encoding].size    == NULL) ||
+    (funcs & GD_EF_WRITE   && gd_ef_[encoding].write   == NULL) ||
+    (funcs & GD_EF_SYNC    && gd_ef_[encoding].sync    == NULL) ||
+    (funcs & GD_EF_UNLINK  && gd_ef_[encoding].unlink  == NULL);
 
   dreturn("%i", ret);
   return ret;
 }
 
+static int _GD_MoveOver(DIRFILE *restrict D, int fragment,
+    struct gd_raw_file_ *restrict file)
+{
+  const int dirfd = D->fragment[fragment].dirfd;
+#ifdef HAVE_FCHMOD
+  int fd;
+  struct stat stat_buf;
+  mode_t mode;
+#endif
+  dtrace("%p, %i, %p", D, fragment, file);
+
+#ifdef HAVE_FCHMOD
+  if (gd_StatAt(D, dirfd, file[0].name, &stat_buf, 0))
+    mode = 0644;
+  else
+    mode = stat_buf.st_mode;
+#endif
+
+  if (gd_RenameAt(D, dirfd, file[1].name, dirfd, file[0].name)) {
+    int move_errno = errno;
+    if (gd_UnlinkAt(D, dirfd, file[1].name, 0) == 0) {
+      free(file[1].name);
+      file[1].name = NULL;
+    }
+    errno = move_errno;
+    _GD_SetError(D, GD_E_UNCLEAN_DB, 0, D->fragment[fragment].cname, 0, NULL);
+    D->flags |= GD_INVALID;
+    dreturn("%i", -1);
+    return -1;
+  }
+
+#ifdef HAVE_FCHMOD
+  fd = gd_OpenAt(file->D, dirfd, file[0].name, O_RDONLY, 0666);
+  fchmod(fd, mode);
+  close(fd);
+#endif
+
+  dreturn("%i", 0);
+  return 0;
+}
+
+/* Close a raw file, taking care of cleaning-up out-of-place writes, and
+ * discarding temporary files */
+int _GD_FiniRawIO(DIRFILE *D, const gd_entry_t *E, int fragment, int flags)
+{
+  const int clotemp = (flags & GD_FINIRAW_CLOTEMP) ? 1 : 0;
+  const int old_mode = E->e->u.raw.file[0].mode;
+  const int oop_write = ((gd_ef_[E->e->u.raw.file[0].subenc].flags & GD_EF_OOP)
+      && (old_mode & GD_FILE_WRITE)) ? 1 : 0;
+  dtrace("%p, %p, %i, 0x%X", D, E, fragment, flags);
+
+  if ((E->e->u.raw.file[clotemp].idata >= 0) ||
+      (clotemp == 0 && oop_write && (E->e->u.raw.file[1].idata >= 0)))
+  {
+    /* close the secondary file in write mode (but not temp mode) */
+    if (oop_write && E->e->u.raw.file[1].idata >= 0) {
+      if (E->e->u.raw.file[0].idata >= 0) {
+        /* copy the rest of the input to the output */
+        char buffer[GD_BUFFER_SIZE];
+        int n_read, n_wrote, n_to_write;
+
+        do {
+          n_to_write = n_read = (*gd_ef_[E->e->u.raw.file[0].subenc].read)(
+              E->e->u.raw.file, buffer, E->EN(raw,data_type), GD_BUFFER_SIZE);
+          if (n_read < 0) {
+            _GD_SetError(D, GD_E_RAW_IO, 0, E->e->u.raw.file[0].name, errno,
+                NULL);
+            dreturn("%i", -1);
+            return -1;
+          } else while (n_to_write > 0) {
+            n_wrote = (*gd_ef_[E->e->u.raw.file[0].subenc].write)(
+                E->e->u.raw.file + 1, buffer, E->EN(raw,data_type), n_to_write);
+            if (n_wrote < 0) {
+              _GD_SetError(D, GD_E_RAW_IO, 0, E->e->u.raw.file[0].name, errno,
+                  NULL);
+              dreturn("%i", -1);
+              return -1;
+            }
+            n_to_write -= n_wrote;
+          }
+        } while (n_read == GD_BUFFER_SIZE);
+      }
+
+      if ((*gd_ef_[E->e->u.raw.file[0].subenc].close)(E->e->u.raw.file + 1)) {
+        dreturn("%i", -1);
+        return -1;
+      }
+    }
+
+    /* close the file */
+    if ((E->e->u.raw.file[clotemp].idata >= 0) &&
+      (*gd_ef_[E->e->u.raw.file[clotemp].subenc].close)(E->e->u.raw.file +
+          clotemp))
+    {
+      if (D->error == GD_E_OK)
+        _GD_SetError(D, GD_E_RAW_IO, 0, E->e->u.raw.file[clotemp].name, errno,
+            NULL);
+      dreturn("%i", 1);
+      return 1;
+    }
+  }
+
+  if (flags & GD_FINIRAW_DEFER) {
+    dreturn("%i", 0);
+    return 0;
+  }
+
+  /* take care of moving things into place */
+  if (oop_write || clotemp) {
+    if (flags & GD_FINIRAW_DISCARD) {
+      /* Throw away the temporary file */
+      if (E->e->u.raw.file[1].name != NULL &&
+          gd_UnlinkAt(D, D->fragment[fragment].dirfd, E->e->u.raw.file[1].name,
+            0))
+      {
+        if (D->error == GD_E_OK)
+          _GD_SetError(D, GD_E_RAW_IO, 0, E->e->u.raw.file[1].name, errno,
+              NULL);
+        dreturn("%i", -1);
+        return -1;
+      }
+    } else {
+      /* Move the old file over the new file */
+      if (_GD_MoveOver(D, fragment, E->e->u.raw.file)) {
+        dreturn("%i", -1);
+        return -1;
+      }
+    }
+
+    free(E->e->u.raw.file[1].name);
+    E->e->u.raw.file[1].name = NULL;
+  }
+
+  dreturn("%i", 0);
+  return 0;
+}
+
+/* Perform a RAW field write */
+ssize_t _GD_WriteOut(const gd_entry_t *E, const struct encoding_t *enc,
+    const void *ptr, gd_type_t type, size_t n, int temp)
+{
+  ssize_t n_wrote;
+
+  dtrace("%p, %p, %p, 0x%X, %" PRNsize_t ", %i", E, enc, ptr, type, n, temp);
+
+  if (temp)
+    n_wrote = (*enc->write)(E->e->u.raw.file + 1, ptr, type, n);
+  else {
+    if (enc->flags & GD_EF_OOP) {
+      n_wrote = (*enc->write)(E->e->u.raw.file + 1, ptr, type, n);
+
+      if (n_wrote > 0 && E->e->u.raw.file[0].idata >= 0) {
+        /* advance the read pointer by the appropriate amount */
+        if ((*enc->seek)(E->e->u.raw.file, E->e->u.raw.file[0].pos + n_wrote,
+              E->EN(raw,data_type), GD_FILE_READ) < 0)
+        {
+          n_wrote = -1;
+        }
+      }
+    } else 
+      n_wrote = (*enc->write)(E->e->u.raw.file, ptr, type, n);
+  }
+
+  dreturn("%" PRNssize_t, n_wrote);
+  return n_wrote;
+}
+
+/* Open a raw file, if necessary; also check for required functions */
+int _GD_InitRawIO(DIRFILE *D, const gd_entry_t *E, const char *filebase,
+    int fragment, const struct encoding_t *enc, unsigned int funcs,
+    unsigned int mode, int swap)
+{
+  int temp_fd = -1;
+  const int touch = mode & GD_FILE_TOUCH;
+  int oop_write = 0;
+
+  dtrace("%p, %p, \"%s\", %i, %p, 0x%X, 0x%X, %i", D, E, filebase, fragment,
+      enc, funcs, mode, swap);
+
+  if (mode & (GD_FILE_WRITE | GD_FILE_TOUCH))
+    funcs |= GD_EF_WRITE;
+
+  mode &= ~GD_FILE_TOUCH;
+
+  if (!(mode & GD_FILE_TEMP)) {
+    if (!_GD_Supports(D, E, GD_EF_NAME | GD_EF_OPEN | funcs)) {
+      dreturn("%i", 1);
+      return 1;
+    }
+
+    enc = gd_ef_ + E->e->u.raw.file[0].subenc;
+    oop_write = ((enc->flags & GD_EF_OOP) && mode == GD_FILE_WRITE) ? 1 : 0;
+
+    /* Do nothing, if possible */
+    if (!touch && (((mode & GD_FILE_READ) && (E->e->u.raw.file[0].idata >= 0)
+            && (E->e->u.raw.file[0].mode & GD_FILE_READ))
+          || ((mode & GD_FILE_WRITE) && (E->e->u.raw.file[oop_write].idata >= 0)
+            && (E->e->u.raw.file[0].mode & GD_FILE_WRITE))))
+    {
+      dreturn("%i", 0);
+      return 0;
+    }
+
+    /* close the file, if necessary */
+    if ((E->e->u.raw.file[0].idata >= 0 || ((enc->flags & GD_EF_OOP)
+            && (E->e->u.raw.file[1].idata >= 0)))
+        && ((mode == GD_FILE_READ && (enc->flags & GD_EF_OOP)
+            && (E->e->u.raw.file[0].mode & GD_FILE_WRITE))
+          || (mode == GD_FILE_WRITE
+            && !(E->e->u.raw.file[0].mode & GD_FILE_WRITE))))
+    {
+      if (_GD_FiniRawIO(D, E, E->fragment_index, GD_FINIRAW_KEEP)) {
+        dreturn("%i", 1);
+        return 1;
+      }
+    }
+  }
+
+  if (filebase == NULL)
+    filebase = E->e->u.raw.filebase;
+
+  if (fragment == -1)
+    fragment = E->fragment_index;
+
+  if (mode & GD_FILE_TEMP) {
+    /* create temporary file in file[1] */
+    if ((*enc->name)(D, (const char*)D->fragment[E->fragment_index].enc_data,
+          E->e->u.raw.file + 1, filebase, 1, 0))
+    {
+      ; /* error already set */
+    } else if ((temp_fd = _GD_MakeTempFile(D, D->fragment[fragment].dirfd,
+            E->e->u.raw.file[1].name)) < 0)
+    {
+      _GD_SetError(D, GD_E_RAW_IO, 0, E->e->u.raw.file[1].name, errno, NULL);
+    } else if ((*enc->open)(temp_fd, E->e->u.raw.file + 1, swap,
+          GD_FILE_WRITE | GD_FILE_TEMP))
+    {
+      _GD_SetError(D, GD_E_RAW_IO, 0, E->e->u.raw.file[1].name, errno, NULL);
+    }
+
+    if (D->error) {
+      dreturn("%i", 1);
+      return 1;
+    }
+    dreturn("%i", 0);
+    return 0;
+  }
+
+  if (oop_write) {
+    /* an out-of-place write requires us to open a temporary file and pass
+     * in its fd */
+    if ((*enc->name)(D, (const char*)D->fragment[E->fragment_index].enc_data,
+          E->e->u.raw.file + 1, filebase, 1, 0))
+    {
+      dreturn("%i", 1);
+      return 1;
+    } else if ((temp_fd = _GD_MakeTempFile(D,
+            D->fragment[E->fragment_index].dirfd, E->e->u.raw.file[1].name))
+          < 0)
+    {
+      dreturn("%i", 1);
+      return 1;
+    } else if ((*enc->open)(temp_fd, E->e->u.raw.file + 1, _GD_FileSwapBytes(D,
+            E->fragment_index), GD_FILE_WRITE)) {
+      _GD_SetError(D, GD_E_RAW_IO, 0, E->e->u.raw.file[0].name, errno, NULL);
+      dreturn("%i", 1);
+      return 1;
+    }
+    /* The read file in OOP mode is flagged as RW. */
+    mode = GD_FILE_RDWR;
+  }
+
+  /* open a regular file, if necessary */
+  if (E->e->u.raw.file[0].idata < 0) {
+    if ((*enc->name)(D, (const char*)D->fragment[E->fragment_index].enc_data,
+          E->e->u.raw.file, filebase, 0, 0))
+    {
+      dreturn("%i", 1);
+      return 1;
+    } else if ((*enc->open)(D->fragment[E->fragment_index].dirfd,
+          E->e->u.raw.file, _GD_FileSwapBytes(D, E->fragment_index), mode))
+    {
+      /* In oop_write mode, it doesn't matter if the old file doesn't exist */
+      if (!oop_write || errno != ENOENT) {
+        _GD_SetError(D, GD_E_RAW_IO, 0, E->e->u.raw.file[0].name, errno, NULL);
+        dreturn("%i", 1);
+        return 1;
+      }
+      E->e->u.raw.file[0].mode = mode;
+    }
+  }
+
+  if (touch)
+    _GD_FiniRawIO(D, E, E->fragment_index, GD_FINIRAW_KEEP);
+
+  dreturn("%i", 0);
+  return 0;
+}
+
 /* Figure out the encoding scheme */
-static unsigned long _GD_ResolveEncoding(const char* name, unsigned long scheme,
-    struct _gd_raw_file *file)
+static unsigned long _GD_ResolveEncoding(DIRFILE *restrict D,
+    const char *restrict name, const char *restrict enc_data,
+    unsigned long scheme, int dirfd, struct gd_raw_file_ *restrict file)
 {
-  char candidate[FILENAME_MAX];
-  char* ptr;
-  int i, len = strlen(name);
-  gd_stat64_t statbuf;
+  char *candidate;
+  int i;
+  const size_t len = strlen(name);
+  struct stat statbuf;
 
-  dtrace("\"%s\", 0x%08lx, %p", name, scheme, file);
+  dtrace("%p, \"%s\", \"%s\", 0x%08lx, %i, %p", D, name, enc_data, scheme,
+      dirfd, file);
 
-  strcpy(candidate, name);
-  ptr = candidate + len;
-  len = FILENAME_MAX - len;
+  for (i = 0; gd_ef_[i].scheme != GD_ENC_UNSUPPORTED; i++) {
+    if (scheme == GD_AUTO_ENCODED || scheme == gd_ef_[i].scheme) {
+      if (gd_ef_[i].ext) {
+        candidate = (char *)malloc(len + strlen(gd_ef_[i].ext) + 1);
+        if (!candidate)
+          continue;
 
-  for (i = 0; _gd_ef[i].scheme != GD_ENC_UNSUPPORTED; i++) {
-    if (scheme == GD_AUTO_ENCODED || scheme == _gd_ef[i].scheme) {
-      strcpy(ptr, _gd_ef[i].ext);
+        strcat(strcpy(candidate, name), gd_ef_[i].ext);
+      } else {
+        if (_GD_MissingFramework(i, GD_EF_NAME))
+          continue;
 
-      if (gd_stat64(candidate, &statbuf) == 0) 
+        if ((*gd_ef_[i].name)(D, enc_data, file, name, 0, 1))
+          continue;
+
+        candidate = file->name;
+        file->name = NULL;
+      }
+
+      if (gd_StatAt(D, dirfd, candidate, &statbuf, 0) == 0)
         if (S_ISREG(statbuf.st_mode)) {
           if (file != NULL)
-            file->encoding = i;
-          dreturn("%08lx", _gd_ef[i].scheme);
-          return _gd_ef[i].scheme;
+            file->subenc = i;
+          free(candidate);
+          dreturn("%08lx", gd_ef_[i].scheme);
+          return gd_ef_[i].scheme;
         }
+      free(candidate);
     }
   }
 
   if (scheme != 0 && file != NULL) {
-    for (i = 0; _gd_ef[i].scheme != GD_ENC_UNSUPPORTED; i++)
-      if (scheme == _gd_ef[i].scheme) {
-        file->encoding = i;
-        dreturn("0x%08lx", _gd_ef[i].scheme);
-        return _gd_ef[i].scheme;;
+    for (i = 0; gd_ef_[i].scheme != GD_ENC_UNSUPPORTED; i++)
+      if (scheme == gd_ef_[i].scheme) {
+        file->subenc = i;
+        dreturn("0x%08lx", gd_ef_[i].scheme);
+        return gd_ef_[i].scheme;;
       }
   }
 
@@ -333,31 +670,34 @@ static unsigned long _GD_ResolveEncoding(const char* name, unsigned long scheme,
   return GD_AUTO_ENCODED;
 }
 
-int _GD_Supports(DIRFILE* D, gd_entry_t* E, unsigned int funcs)
+int _GD_Supports(DIRFILE *D, const gd_entry_t *E, unsigned int funcs)
 {
-  dtrace("%p, %p, %x", D, E, funcs);
+  dtrace("%p, %p, 0x%X", D, E, funcs);
 
   /* Figure out the dirfile encoding type, if required */
   if (D->fragment[E->fragment_index].encoding == GD_AUTO_ENCODED) {
     D->fragment[E->fragment_index].encoding =
-      _GD_ResolveEncoding(E->e->u.raw.filebase, GD_AUTO_ENCODED,
-          E->e->u.raw.file);
+      _GD_ResolveEncoding(D, E->e->u.raw.filebase,
+          (const char*)D->fragment[E->fragment_index].enc_data, GD_AUTO_ENCODED,
+          D->fragment[E->fragment_index].dirfd, E->e->u.raw.file);
   }
 
   /* If the encoding scheme is unknown, complain */
   if (D->fragment[E->fragment_index].encoding == GD_AUTO_ENCODED) {
-    _GD_SetError(D, GD_E_UNKNOWN_ENCODING, 0, NULL, 0, NULL);
+    _GD_SetError(D, GD_E_UNKNOWN_ENCODING, GD_E_UNENC_UNDET, NULL, 0, NULL);
     dreturn("%i", 0);
     return 0;
   }
 
   /* Figure out the encoding subtype, if required */
-  if (E->e->u.raw.file[0].encoding == GD_ENC_UNKNOWN)
-    _GD_ResolveEncoding(E->e->u.raw.filebase,
-        D->fragment[E->fragment_index].encoding, E->e->u.raw.file);
+  if (E->e->u.raw.file[0].subenc == GD_ENC_UNKNOWN)
+    _GD_ResolveEncoding(D, E->e->u.raw.filebase,
+        (const char*)D->fragment[E->fragment_index].enc_data,
+        D->fragment[E->fragment_index].encoding,
+        D->fragment[E->fragment_index].dirfd, E->e->u.raw.file);
 
   /* check for our function(s) */
-  if (_GD_MissingFramework(E->e->u.raw.file[0].encoding, funcs)) {
+  if (_GD_MissingFramework(E->e->u.raw.file[0].subenc, funcs)) {
     _GD_SetError(D, GD_E_UNSUPPORTED, 0, NULL, 0, NULL);
     dreturn("%i", 0);
     return 0;
@@ -367,27 +707,31 @@ int _GD_Supports(DIRFILE* D, gd_entry_t* E, unsigned int funcs)
   return 1;
 }
 
-int _GD_SetEncodedName(DIRFILE* D, struct _gd_raw_file* file, const char* base,
-    int temp)
+int _GD_GenericName(DIRFILE *restrict D,
+    const char *restrict enc_data gd_unused_,
+    struct gd_raw_file_ *restrict file, const char *restrict base, int temp,
+    int resolv gd_unused_)
 {
-  dtrace("%p, %p, \"%s\", %i", D, file, base, temp);
+  dtrace("%p, <unused>, %p, \"%s\", %i, <unused>", D, file, base, temp);
 
   if (file->name == NULL) {
-    file->name = (char *)malloc(FILENAME_MAX);
+    file->D = D;
+    file->name = (char *)_GD_Malloc(D, strlen(base) + (temp ? 8 :
+          strlen(gd_ef_[file->subenc].ext) + 1));
     if (file->name == NULL) {
-      _GD_SetError(D, GD_E_ALLOC, 0, NULL, 0, NULL);
       dreturn("%i", -1);
       return -1;
     }
 
-    snprintf(file->name, FILENAME_MAX, "%s%s", base, temp ? "_XXXXXX" :
-        _gd_ef[file->encoding].ext);
+    strcat(strcpy(file->name, base), temp ? "_XXXXXX" :
+        gd_ef_[file->subenc].ext);
   }
 
   dreturn("%i (%s)", 0, file->name);
   return 0;
 }
 
+/* This function assumes that the new encoding has no fragment->enc_data. */
 static void _GD_RecodeFragment(DIRFILE* D, unsigned long encoding, int fragment,
     int move)
 {
@@ -404,11 +748,10 @@ static void _GD_RecodeFragment(DIRFILE* D, unsigned long encoding, int fragment,
   }
 
   if (move && encoding != D->fragment[fragment].encoding) {
-    gd_entry_t **raw_entry = (gd_entry_t **)malloc(sizeof(gd_entry_t*) *
+    gd_entry_t **raw_entry = (gd_entry_t **)_GD_Malloc(D, sizeof(gd_entry_t*) *
         D->n_entries);
 
     if (raw_entry == NULL) {
-      _GD_SetError(D, GD_E_ALLOC, 0, NULL, 0, NULL);
       dreturnvoid();
       return;
     }
@@ -436,42 +779,40 @@ static void _GD_RecodeFragment(DIRFILE* D, unsigned long encoding, int fragment,
      * remove the temporary files */
     if (D->error) {
       for (i = 0; i < n_raw; ++i)
-        if (_gd_ef[raw_entry[i]->e->u.raw.file[1].encoding].temp != NULL && 
-            (*_gd_ef[raw_entry[i]->e->u.raw.file[1].encoding].temp)(
-              raw_entry[i]->e->u.raw.file, GD_TEMP_DESTROY))
-        {
-          _GD_SetError(D, GD_E_RAW_IO, 0, raw_entry[i]->e->u.raw.file[0].name,
-              errno, NULL);
-        }
-    } else 
+        _GD_FiniRawIO(D, raw_entry[i], fragment, GD_FINIRAW_DISCARD |
+            GD_FINIRAW_CLOTEMP);
+    } else
       for (i = 0; i < n_raw; ++i) {
-        struct _gd_raw_file temp;
+        struct gd_raw_file_ temp;
         memcpy(&temp, raw_entry[i]->e->u.raw.file, sizeof(temp));
 
         raw_entry[i]->e->u.raw.file[0].name = NULL;
-        raw_entry[i]->e->u.raw.file[0].encoding =
-          raw_entry[i]->e->u.raw.file[1].encoding;
+        raw_entry[i]->e->u.raw.file[0].subenc =
+          raw_entry[i]->e->u.raw.file[1].subenc;
 
-        if (_GD_SetEncodedName(D, raw_entry[i]->e->u.raw.file,
-              raw_entry[i]->e->u.raw.filebase, 0))
+        /* discard the old file */
+        _GD_FiniRawIO(D, raw_entry[i], fragment, GD_FINIRAW_DISCARD);
+
+        if ((*gd_ef_[temp.subenc].name)(D,
+              (const char*)D->fragment[raw_entry[i]->fragment_index].enc_data,
+              raw_entry[i]->e->u.raw.file, raw_entry[i]->e->u.raw.filebase, 0,
+              0))
         {
           raw_entry[i]->e->u.raw.file[0].name = temp.name;
-          raw_entry[i]->e->u.raw.file[0].encoding = temp.encoding;
-        } else if (
-            (*_gd_ef[raw_entry[i]->e->u.raw.file[1].encoding].temp)(
-              raw_entry[i]->e->u.raw.file, GD_TEMP_MOVE))
+          raw_entry[i]->e->u.raw.file[0].subenc = temp.subenc;
+        } else if (_GD_FiniRawIO(D, raw_entry[i], fragment,
+              GD_FINIRAW_KEEP | GD_FINIRAW_CLOTEMP))
         {
-          _GD_SetError(D, GD_E_UNCLEAN_DB, 0,
-              D->fragment[D->entry[i]->fragment_index].cname, 0, NULL);
-          D->flags |= GD_INVALID;
           raw_entry[i]->e->u.raw.file[0].name = temp.name;
-          raw_entry[i]->e->u.raw.file[0].encoding = temp.encoding;
-        } else if ((*_gd_ef[temp.encoding].unlink)(&temp)) {
+          raw_entry[i]->e->u.raw.file[0].subenc = temp.subenc;
+        } else if ((*gd_ef_[temp.subenc].unlink)(D->fragment[fragment].dirfd,
+              &temp))
+        {
           _GD_SetError(D, GD_E_UNCLEAN_DB, 0,
               D->fragment[D->entry[i]->fragment_index].cname, 0, NULL);
           D->flags |= GD_INVALID;
           raw_entry[i]->e->u.raw.file[0].name = temp.name;
-          raw_entry[i]->e->u.raw.file[0].encoding = temp.encoding;
+          raw_entry[i]->e->u.raw.file[0].subenc = temp.subenc;
         } else
           free(temp.name);
       }
@@ -488,8 +829,8 @@ static void _GD_RecodeFragment(DIRFILE* D, unsigned long encoding, int fragment,
           D->entry[i]->field_type == GD_RAW_ENTRY)
       {
         /* close the old file */
-        if (D->entry[i]->e->u.raw.file[0].fp != -1 &&
-            (*_gd_ef[D->entry[i]->e->u.raw.file[0].encoding].close)(
+        if (D->entry[i]->e->u.raw.file[0].idata != -1 &&
+            (*gd_ef_[D->entry[i]->e->u.raw.file[0].subenc].close)(
               D->entry[i]->e->u.raw.file))
         {
           _GD_SetError(D, GD_E_RAW_IO, 0, D->entry[i]->e->u.raw.file[1].name,
@@ -497,10 +838,12 @@ static void _GD_RecodeFragment(DIRFILE* D, unsigned long encoding, int fragment,
           break;
         }
         /* reset encoding subscheme. */
-        D->entry[i]->e->u.raw.file[0].encoding = GD_ENC_UNKNOWN;
+        D->entry[i]->e->u.raw.file[0].subenc = GD_ENC_UNKNOWN;
       }
   }
 
+  free(D->fragment[fragment].enc_data);
+  D->fragment[fragment].enc_data = NULL;
   D->fragment[fragment].encoding = encoding;
   D->fragment[fragment].modified = 1;
   D->flags &= ~GD_HAVE_VERSION;
@@ -534,7 +877,7 @@ int gd_alter_encoding(DIRFILE* D, unsigned long encoding, int fragment,
   }
 
   if (!_GD_EncodingUnderstood(encoding)) {
-    _GD_SetError(D, GD_E_UNKNOWN_ENCODING, 0, NULL, 0, NULL);
+    _GD_SetError(D, GD_E_UNKNOWN_ENCODING, GD_E_UNENC_TARGET, NULL, 0, NULL);
     dreturn("%i", -1);
     return -1;
   }
@@ -584,8 +927,9 @@ unsigned long gd_encoding(DIRFILE* D, int fragment) gd_nothrow
           D->entry[i]->field_type == GD_RAW_ENTRY)
       {
         D->fragment[fragment].encoding =
-          _GD_ResolveEncoding(D->entry[i]->e->u.raw.filebase, GD_AUTO_ENCODED,
-              D->entry[i]->e->u.raw.file);
+          _GD_ResolveEncoding(D, D->entry[i]->e->u.raw.filebase,
+              (const char*)D->fragment[fragment].enc_data, GD_AUTO_ENCODED,
+              D->fragment[fragment].dirfd, D->entry[i]->e->u.raw.file);
 
         if (D->fragment[fragment].encoding != GD_AUTO_ENCODED)
           break;
@@ -599,40 +943,63 @@ unsigned long gd_encoding(DIRFILE* D, int fragment) gd_nothrow
   return reported_encoding;
 }
 
-int _GD_GenericTouch(struct _gd_raw_file* file)
+/* This is basically the non-existant POSIX funcion mkstempat.  There are two
+ * approaches we could take here:
+ * 1) fchdir to dirfd, use mkstemp to grab a file descriptor; fchdir back to
+ *    cwd, but this isn't thread-safe, so we're stuck with:
+ * 2) use mktemp to generate a "unique" file name, and then try to openat it
+ *    exclusively; repeat as necessary.
+ */
+int _GD_MakeTempFile(const DIRFILE *D gd_unused_d, int dirfd, char *tmpl)
 {
-  int fd;
+  int fd = -1;
+  char *tmp = strdup(tmpl);
+
+  dtrace("%p, %i, \"%s\"", D, dirfd, tmpl);
 
-  dtrace("%p", file);
+  if (!tmp) {
+    dreturn("%i", -1);
+    return -1;
+  }
+
+  do {
+    strcpy(tmpl, tmp);
+    mktemp(tmpl);
+    if (tmpl[0] == 0) {
+      free(tmp);
+      dreturn("%i", -1);
+      return -1;
+    }
 
-  fd = open(file->name, O_RDWR | O_CREAT | O_TRUNC | O_BINARY, 0666);
+    fd = gd_OpenAt(D, dirfd, tmpl, O_RDWR | O_CREAT | O_EXCL, 0666);
+  } while (errno == EEXIST);
 
-  if (fd != -1)
-    fd = close(fd);
+  free(tmp);
 
   dreturn("%i", fd);
   return fd;
 }
 
-int _GD_GenericUnlink(struct _gd_raw_file* file)
+int _GD_GenericUnlink(int dirfd, struct gd_raw_file_* file)
 {
   int r;
 
-  dtrace("%p", file);
+  dtrace("%i, %p", dirfd, file);
 
-  r = unlink(file->name);
+  r = gd_UnlinkAt(file->D, dirfd, file->name, 0);
 
   dreturn("%i", r);
   return r;
 }
 
-int _GD_GenericMove(struct _gd_raw_file* file, char* new_path)
+int _GD_GenericMove(int olddirfd, struct gd_raw_file_ *restrict file,
+    int newdirfd, char *restrict new_path)
 {
   int r, rename_errno;
 
-  dtrace("%p, \"%s\"", file, new_path);
+  dtrace("%i, %p, %i, \"%s\"", olddirfd, file, newdirfd, new_path);
 
-  r = _GD_Rename(file->name, new_path);
+  r = gd_RenameAt(file->D, olddirfd, file->name, newdirfd, new_path);
 
   rename_errno = errno;
 
diff --git a/src/endian.c b/src/endian.c
index 28ad4b4..5f4dcff 100644
--- a/src/endian.c
+++ b/src/endian.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2010 D. V. Wiebe
+/* Copyright (C) 2008-2011 D. V. Wiebe
  *
  ***************************************************************************
  *
@@ -20,12 +20,6 @@
  */
 #include "internal.h"
 
-#ifdef STDC_HEADERS
-#include <stdlib.h>
-#include <string.h>
-#include <errno.h>
-#endif
-
 static void _GD_ByteSwapFragment(DIRFILE* D, unsigned long byte_sex,
     int fragment, int move)
 {
@@ -50,11 +44,10 @@ static void _GD_ByteSwapFragment(DIRFILE* D, unsigned long byte_sex,
   }
 
   if (move && byte_sex != D->fragment[fragment].byte_sex) {
-    gd_entry_t **raw_entry = (gd_entry_t **)malloc(sizeof(gd_entry_t*) *
+    gd_entry_t **raw_entry = (gd_entry_t **)_GD_Malloc(D, sizeof(gd_entry_t*) *
         D->n_entries);
 
     if (raw_entry == NULL) {
-      _GD_SetError(D, GD_E_ALLOC, 0, NULL, 0, NULL);
       dreturnvoid();
       return;
     }
@@ -65,14 +58,16 @@ static void _GD_ByteSwapFragment(DIRFILE* D, unsigned long byte_sex,
       if (D->entry[i]->fragment_index == fragment &&
           D->entry[i]->field_type == GD_RAW_ENTRY)
       {
-        /* if the field's data type is one byte long, do nothing */
-        if (D->entry[i]->e->u.raw.size == 1)
-          continue;
-
-        /* check subencoding support */
-        if (!_GD_Supports(D, D->entry[i], GD_EF_TEMP))
+        /* determine encoding scheme */
+        if (!_GD_Supports(D, D->entry[i], 0))
           break;
 
+        /* if the field's data type is one byte long, and no in-framework
+         * byte-swapping is required, do nothing */
+        if (D->entry[i]->e->u.raw.size == 1 &&
+            !(gd_ef_[D->entry[i]->e->u.raw.file[0].subenc].flags & GD_EF_SWAP))
+          continue;
+
         /* add this raw field to the list */
         raw_entry[n_raw++] = D->entry[i];
 
@@ -87,19 +82,12 @@ static void _GD_ByteSwapFragment(DIRFILE* D, unsigned long byte_sex,
      * remove the temporary files */
     if (D->error) {
       for (i = 0; i < n_raw; ++i)
-        if ((*_gd_ef[raw_entry[i]->e->u.raw.file[0].encoding].temp)(
-              raw_entry[i]->e->u.raw.file, GD_TEMP_DESTROY))
-          _GD_SetError(D, GD_E_RAW_IO, 0, raw_entry[i]->e->u.raw.file[0].name,
-              errno, NULL);
+        _GD_FiniRawIO(D, raw_entry[i], fragment, GD_FINIRAW_DISCARD |
+            GD_FINIRAW_CLOTEMP);
     } else {
       for (i = 0; i < n_raw; ++i)
-        if ((*_gd_ef[raw_entry[i]->e->u.raw.file[0].encoding].temp)(
-              raw_entry[i]->e->u.raw.file, GD_TEMP_MOVE))
-        {
-          _GD_SetError(D, GD_E_UNCLEAN_DB, 0,
-              D->fragment[D->entry[i]->fragment_index].cname, 0, NULL);
-          D->flags |= GD_INVALID;
-        }
+        _GD_FiniRawIO(D, raw_entry[i], fragment, GD_FINIRAW_KEEP |
+            GD_FINIRAW_CLOTEMP);
     }
 
     free(raw_entry);
@@ -143,7 +131,7 @@ int gd_alter_endianness(DIRFILE* D, unsigned long byte_sex, int fragment,
   }
 
   if (byte_sex != GD_BIG_ENDIAN && byte_sex != GD_LITTLE_ENDIAN) {
-    _GD_SetError(D, GD_E_BAD_ENDIANNESS, 0, NULL, 0, NULL);
+    _GD_SetError(D, GD_E_ARGUMENT, GD_E_ARG_ENDIANNESS, NULL, 0, NULL);
     dreturn("%i", -1);
     return -1;
   }
@@ -200,24 +188,26 @@ void _GD_ArmEndianise(uint64_t* databuffer, int is_complex, size_t ns)
   dreturnvoid();
 }
 
-void _GD_FixEndianness(char* databuffer, size_t size, size_t ns)
+void _GD_FixEndianness(void* databuffer, size_t size, size_t ns)
 {
-  size_t i, j;
-  char b;
-
-  dtrace("%p, %zu, %zu", databuffer, size, ns);
-
-  if (size == 1) {
-    dreturnvoid();
-    return;
+  size_t i;
+
+  dtrace("%p, %zu, %" PRNsize_t, databuffer, size, ns);
+
+  switch (size) {
+    case 2:
+      for (i = 0; i < ns; ++i)
+        ((uint16_t*)databuffer)[i] = gd_swap16(((uint16_t*)databuffer)[i]);
+      break;
+    case 4:
+      for (i = 0; i < ns; ++i)
+        ((uint32_t*)databuffer)[i] = gd_swap32(((uint32_t*)databuffer)[i]);
+      break;
+    case 8:
+      for (i = 0; i < ns; ++i)
+        ((uint64_t*)databuffer)[i] = gd_swap64(((uint64_t*)databuffer)[i]);
+      break;
   }
 
-  for (i = 0; i < ns; ++i)
-    for (j = 0; j < size / 2; ++j) {
-      b = databuffer[size * (i + 1) - j - 1];
-      databuffer[size * (i + 1) - j - 1] = databuffer[size * i + j];
-      databuffer[size * i + j] = b;
-    }
-
   dreturnvoid();
 }
diff --git a/src/entry.c b/src/entry.c
index 94beb0e..5b5d605 100644
--- a/src/entry.c
+++ b/src/entry.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2010 D. V. Wiebe
+/* Copyright (C) 2008-2013 D. V. Wiebe
  *
  ***************************************************************************
  *
@@ -20,16 +20,11 @@
  */
 #include "internal.h"
 
-#ifdef STDC_HEADERS
-#include <string.h>
-#include <stdlib.h>
-#endif
-
-void _GD_FreeE(gd_entry_t* entry, int priv)
+void _GD_FreeE(DIRFILE *restrict D, gd_entry_t *restrict entry, int priv)
 {
   int i;
 
-  dtrace("%p, %i", entry, priv);
+  dtrace("%p, %p, %i", D, entry, priv);
 
   if (!entry || entry->field_type == GD_NO_ENTRY) {
     dreturnvoid();
@@ -50,14 +45,12 @@ void _GD_FreeE(gd_entry_t* entry, int priv)
       free(entry->in_fields[0]);
       free(entry->EN(linterp,table));
       if (priv) {
-        free(entry->e->u.linterp.table_path);
+        if (entry->e->u.linterp.table_dirfd > 0)
+          _GD_ReleaseDir(D, entry->e->u.linterp.table_dirfd);
+        free(entry->e->u.linterp.table_file);
         free(entry->e->u.linterp.lut);
       }
       break;
-    case GD_RECIP_ENTRY:
-      free(entry->in_fields[0]);
-      free(entry->scalar[0]);
-      break;
     case GD_DIVIDE_ENTRY:
     case GD_MULTIPLY_ENTRY:
       free(entry->in_fields[1]);
@@ -65,9 +58,12 @@ void _GD_FreeE(gd_entry_t* entry, int priv)
       break;
     case GD_BIT_ENTRY:
     case GD_SBIT_ENTRY:
+      free(entry->scalar[0]);
       free(entry->scalar[1]);
-      /* fallthrough */
+      free(entry->in_fields[0]);
+      break;
     case GD_PHASE_ENTRY:
+    case GD_RECIP_ENTRY:
       free(entry->scalar[0]);
       free(entry->in_fields[0]);
       break;
@@ -95,17 +91,30 @@ void _GD_FreeE(gd_entry_t* entry, int priv)
         free(entry->e->u.raw.file[1].name);
       }
       break;
+    case GD_WINDOW_ENTRY:
+      free(entry->scalar[0]);
+      free(entry->in_fields[0]);
+      free(entry->in_fields[1]);
+      break;
+    case GD_MPLEX_ENTRY:
+      free(entry->scalar[0]);
+      free(entry->scalar[1]);
+      free(entry->in_fields[0]);
+      free(entry->in_fields[1]);
+      break;
     case GD_INDEX_ENTRY:
     case GD_NO_ENTRY:
       break;
+    default:
+      if (entry->field_type == GD_ALIAS_ENTRY)
+        free(entry->in_fields[0]);
   }
 
   if (priv) {
-    free(entry->e->field_list);
-    free(entry->e->vector_list);
+    free(entry->e->alias_list);
+    for (i = 0; i < GD_N_ENTRY_LISTS; ++i)
+      free(entry->e->entry_list[i]);
     free(entry->e->string_value_list);
-    for (i = 0; i < GD_N_ENTYPES; ++i)
-      free(entry->e->type_list[i]);
     free(entry->e->const_value_list);
     if (entry->e->carray_value_list)
       for (i = 0; entry->e->carray_value_list[i].n != 0; ++i)
@@ -125,53 +134,58 @@ gd_entry_t* gd_free_entry_strings(gd_entry_t* entry) gd_nothrow
 {
   dtrace("%p", entry);
 
-  _GD_FreeE(entry, 0);
+  _GD_FreeE(NULL, entry, 0);
 
   dreturn("%p", entry);
   return entry;
 }
 
-static void _GD_GetScalar(DIRFILE* D, gd_entry_t* E, int i, gd_type_t type,
-    void* data)
+static void _GD_GetScalar(DIRFILE *restrict D, gd_entry_t *restrict E, int i,
+    gd_type_t type, void *restrict data, int err)
 {
   void *ptr = NULL;
-  gd_entry_t* C;
+  gd_entry_t* C = NULL;
   int repr;
   char* field_code;
   const char* scalar = E->scalar[i];
   int index = E->scalar_ind[i];
 
-  dtrace("%p, %p, %i, %i, %p", D, E, i, type, data);
+  dtrace("%p, %p, %i, %i, %p, %i", D, E, i, type, data, err);
 
   if (scalar != NULL) {
-    C = _GD_FindFieldAndRepr(D, scalar, &field_code, &repr, NULL, 0);
+    C = _GD_FindFieldAndRepr(D, scalar, &field_code, &repr, NULL, 0, 1);
 
     if (D->error) {
       dreturnvoid();
       return;
     }
 
-    if (C == NULL)
-      _GD_SetError(D, GD_E_BAD_SCALAR, GD_E_SCALAR_CODE, E->field, 0,
-          field_code);
-    else if (C->field_type != GD_CONST_ENTRY &&
-        C->field_type != GD_CARRAY_ENTRY) 
-      _GD_SetError(D, GD_E_BAD_SCALAR, GD_E_SCALAR_TYPE, E->field, 0,
-          field_code);
-    else {
+    if (C == NULL) {
+      if (err)
+        _GD_SetError(D, GD_E_BAD_SCALAR, GD_E_SCALAR_CODE, E->field, 0,
+            field_code);
+    } else if (C->field_type != GD_CONST_ENTRY &&
+        C->field_type != GD_CARRAY_ENTRY)
+    {
+      if (err)
+        _GD_SetError(D, GD_E_BAD_SCALAR, GD_E_SCALAR_TYPE, E->field, 0,
+            field_code);
+    } else {
       if (C->field_type == GD_CONST_ENTRY) {
         index = 0;
         E->scalar_ind[i] = -1;
+      } else if (index < 0) {
+        /* a CARRAY masquerading as a CONST; default to the first element */
+        index = E->scalar_ind[i] = 0;
       }
 
-      if ((D->flags & GD_ACCMODE) == GD_RDWR) {
-        ptr = realloc(C->e->u.scalar.client, (C->e->u.scalar.n_client + 1) *
-            sizeof(gd_entry_t*));
-        if (ptr == NULL)
-          _GD_SetError(D, GD_E_ALLOC, 0, NULL, 0, NULL);
-      }
+      if ((D->flags & GD_ACCMODE) == GD_RDWR)
+        ptr = _GD_Realloc(D, C->e->u.scalar.client,
+            (C->e->u.scalar.n_client + 1) * sizeof(gd_entry_t*));
 
-      _GD_DoField(D, C, repr, index, 1, type, data);
+      /* err = 0 means we're only interested in initialising the client list */
+      if (err)
+        _GD_DoField(D, C, repr, index, 1, type, data);
 
       if (ptr) {
         C->e->u.scalar.client = (gd_entry_t **)ptr;
@@ -187,20 +201,20 @@ static void _GD_GetScalar(DIRFILE* D, gd_entry_t* E, int i, gd_type_t type,
 }
 
 /* resolve non-literal scalars */
-int _GD_CalculateEntry(DIRFILE* D, gd_entry_t* E)
+int _GD_CalculateEntry(DIRFILE *restrict D, gd_entry_t *restrict E, int err)
 {
   int i;
 
-  dtrace("%p, %p", D, E);
+  dtrace("%p, %p, %i", D, E, err);
 
   switch(E->field_type) {
     case GD_RAW_ENTRY:
-      _GD_GetScalar(D, E, 0, GD_UINT16, &E->EN(raw,spf));
+      _GD_GetScalar(D, E, 0, GD_UINT_TYPE, &E->EN(raw,spf), err);
       break;
     case GD_POLYNOM_ENTRY:
       E->comp_scal = 0;
       for (i = 0; i <= E->EN(polynom,poly_ord); ++i) {
-        _GD_GetScalar(D, E, i, GD_COMPLEX128, &E->EN(polynom,ca)[i]);
+        _GD_GetScalar(D, E, i, GD_COMPLEX128, &E->EN(polynom,ca)[i], err);
         E->EN(polynom,a)[i] = creal(E->EN(polynom,ca)[i]);
 
         if (cimag(E->EN(polynom,ca)[i]))
@@ -213,14 +227,14 @@ int _GD_CalculateEntry(DIRFILE* D, gd_entry_t* E)
     case GD_LINCOM_ENTRY:
       E->comp_scal = 0;
       for (i = 0; i < E->EN(lincom,n_fields); ++i) {
-        _GD_GetScalar(D, E, i, GD_COMPLEX128, &E->EN(lincom,cm)[i]);
+        _GD_GetScalar(D, E, i, GD_COMPLEX128, &E->EN(lincom,cm)[i], err);
         E->EN(lincom,m)[i] = creal(E->EN(lincom,cm)[i]);
 
         if (cimag(E->EN(lincom,cm)[i]))
           E->comp_scal = 1;
 
         _GD_GetScalar(D, E, i + GD_MAX_LINCOM, GD_COMPLEX128,
-            &E->EN(lincom,cb)[i]);
+            &E->EN(lincom,cb)[i], err);
         E->EN(lincom,b)[i] = creal(E->EN(lincom,cb)[i]);
 
         if (cimag(E->EN(lincom,cb)[i]))
@@ -231,17 +245,36 @@ int _GD_CalculateEntry(DIRFILE* D, gd_entry_t* E)
       }
       break;
     case GD_RECIP_ENTRY:
-      _GD_GetScalar(D, E, 0, GD_COMPLEX128, &E->EN(recip,cdividend));
+      _GD_GetScalar(D, E, 0, GD_COMPLEX128, &E->EN(recip,cdividend), err);
       E->EN(recip,dividend) = creal(E->EN(recip,cdividend));
       E->comp_scal = (cimag(E->EN(recip,cdividend)) == 0) ? 0 : 1;
       break;
     case GD_BIT_ENTRY:
     case GD_SBIT_ENTRY:
-      _GD_GetScalar(D, E, 0, GD_INT16, &E->EN(bit,bitnum));
-      _GD_GetScalar(D, E, 1, GD_INT16, &E->EN(bit,numbits));
+      _GD_GetScalar(D, E, 0, GD_INT_TYPE, &E->EN(bit,bitnum), err);
+      _GD_GetScalar(D, E, 1, GD_INT_TYPE, &E->EN(bit,numbits), err);
       break;
     case GD_PHASE_ENTRY:
-      _GD_GetScalar(D, E, 0, GD_INT64, &E->EN(phase,shift));
+      _GD_GetScalar(D, E, 0, GD_INT64, &E->EN(phase,shift), err);
+      break;
+    case GD_WINDOW_ENTRY:
+      switch (E->EN(window,windop)) {
+        case GD_WINDOP_EQ:
+        case GD_WINDOP_NE:
+          _GD_GetScalar(D, E, 0, GD_INT64, &E->EN(window,threshold.i), err);
+          break;
+        case GD_WINDOP_SET:
+        case GD_WINDOP_CLR:
+          _GD_GetScalar(D, E, 0, GD_UINT64, &E->EN(window,threshold.u), err);
+          break;
+        default:
+          _GD_GetScalar(D, E, 0, GD_FLOAT64, &E->EN(window,threshold.r), err);
+          break;
+      }
+      break;
+    case GD_MPLEX_ENTRY:
+      _GD_GetScalar(D, E, 0, GD_INT_TYPE, &E->EN(mplex,count_val), err);
+      _GD_GetScalar(D, E, 1, GD_INT_TYPE, &E->EN(mplex,period), err);
       break;
     case GD_NO_ENTRY:
     case GD_LINTERP_ENTRY:
@@ -251,6 +284,7 @@ int _GD_CalculateEntry(DIRFILE* D, gd_entry_t* E)
     case GD_CONST_ENTRY:
     case GD_CARRAY_ENTRY:
     case GD_INDEX_ENTRY:
+    case GD_ALIAS_ENTRY:
       break;
   }
 
@@ -261,10 +295,10 @@ int _GD_CalculateEntry(DIRFILE* D, gd_entry_t* E)
   return E->e->calculated;
 }
 
-const char* gd_raw_filename(DIRFILE* D, const char* field_code_in) gd_nothrow
+char* gd_raw_filename(DIRFILE* D, const char* field_code_in) gd_nothrow
 {
   int repr;
-  char* field_code;
+  char *field_code, *filename;
   gd_entry_t *E;
 
   dtrace("%p, \"%s\"", D, field_code_in);
@@ -278,7 +312,7 @@ const char* gd_raw_filename(DIRFILE* D, const char* field_code_in) gd_nothrow
   }
 
   /* Check field */
-  E = _GD_FindFieldAndRepr(D, field_code_in, &field_code, &repr, NULL, 1);
+  E = _GD_FindFieldAndRepr(D, field_code_in, &field_code, &repr, NULL, 1, 1);
 
   if (D->error) {
     dreturn("%p", NULL);
@@ -296,24 +330,29 @@ const char* gd_raw_filename(DIRFILE* D, const char* field_code_in) gd_nothrow
 
   if (E->e->u.raw.file[0].name == NULL) {
     /* ensure encoding sybtype is known */
-    if (!_GD_Supports(D, E, 0)) {
+    if (!_GD_Supports(D, E, GD_EF_NAME)) {
       dreturn("%p", NULL);
       return NULL;
     }
 
-    if (E->e->u.raw.file[0].encoding == GD_ENC_UNKNOWN) {
-      _GD_SetError(D, GD_E_UNKNOWN_ENCODING, 0, NULL, 0, NULL);
+    if (E->e->u.raw.file[0].subenc == GD_ENC_UNKNOWN) {
+      _GD_SetError(D, GD_E_UNKNOWN_ENCODING, GD_E_UNENC_UNDET, NULL, 0, NULL);
       dreturn("%p", NULL);
       return NULL;
-    } else if (_GD_SetEncodedName(D, E->e->u.raw.file, E->e->u.raw.filebase, 0))
+    } else if ((*gd_ef_[E->e->u.raw.file[0].subenc].name)(D,
+          (const char*)D->fragment[E->fragment_index].enc_data,
+          E->e->u.raw.file, E->e->u.raw.filebase, 0, 0))
     {
       dreturn("%p", NULL);
       return NULL;
     }
   }
 
-  dreturn("%p", E->e->u.raw.file[0].name);
-  return E->e->u.raw.file[0].name;
+  filename = _GD_MakeFullPath(D, D->fragment[E->fragment_index].dirfd,
+      E->e->u.raw.file->name, 1);
+
+  dreturn("%p", filename);
+  return filename;
 }
 
 int gd_entry(DIRFILE* D, const char* field_code_in, gd_entry_t* entry)
@@ -334,7 +373,7 @@ int gd_entry(DIRFILE* D, const char* field_code_in, gd_entry_t* entry)
   _GD_ClearError(D);
 
   /* get rid of the represenation, if any */
-  E = _GD_FindFieldAndRepr(D, field_code_in, &field_code, &repr, NULL, 1);
+  E = _GD_FindFieldAndRepr(D, field_code_in, &field_code, &repr, NULL, 1, 1);
 
   if (D->error) {
     dreturn("%i", -1);
@@ -346,7 +385,7 @@ int gd_entry(DIRFILE* D, const char* field_code_in, gd_entry_t* entry)
 
   /* Calculate the entry, if necessary */
   if (!E->e->calculated)
-    _GD_CalculateEntry(D, E);
+    _GD_CalculateEntry(D, E, 1);
 
   if (D->error) {
     dreturn("%i", -1);
@@ -404,11 +443,26 @@ int gd_entry(DIRFILE* D, const char* field_code_in, gd_entry_t* entry)
       if (E->scalar[0])
         entry->scalar[0] = strdup(E->scalar[0]);
       break;
+    case GD_WINDOW_ENTRY:
+      entry->in_fields[0] = strdup(E->in_fields[0]);
+      entry->in_fields[1] = strdup(E->in_fields[1]);
+      if (E->scalar[0])
+        entry->scalar[0] = strdup(E->scalar[0]);
+      break;
+    case GD_MPLEX_ENTRY:
+      entry->in_fields[0] = strdup(E->in_fields[0]);
+      entry->in_fields[1] = strdup(E->in_fields[1]);
+      if (E->scalar[0])
+        entry->scalar[0] = strdup(E->scalar[0]);
+      if (E->scalar[1])
+        entry->scalar[1] = strdup(E->scalar[1]);
+      break;
     case GD_INDEX_ENTRY:
     case GD_CONST_ENTRY:
     case GD_CARRAY_ENTRY:
     case GD_STRING_ENTRY:
     case GD_NO_ENTRY:
+    case GD_ALIAS_ENTRY:
       break;
   }
 
@@ -416,6 +470,122 @@ int gd_entry(DIRFILE* D, const char* field_code_in, gd_entry_t* entry)
   return 0;
 }
 
+const char *gd_alias_target(DIRFILE *D, const char *field_code) gd_nothrow
+{
+  gd_entry_t *E;
+
+  dtrace("%p, \"%s\"", D, field_code);
+
+  if (D->flags & GD_INVALID) {
+    _GD_SetError(D, GD_E_BAD_DIRFILE, 0, NULL, 0, NULL);
+    dreturn("%p", NULL);
+    return NULL;
+  }
+
+  E = _GD_FindField(D, field_code, D->entry, D->n_entries, 0, NULL);
+
+  if (E == NULL) {
+    _GD_SetError(D, GD_E_BAD_CODE, GD_E_CODE_MISSING, NULL, 0, field_code);
+    dreturn("%p", NULL);
+    return NULL;
+  }
+
+  if (E->field_type != GD_ALIAS_ENTRY) {
+    _GD_SetError(D, GD_E_BAD_FIELD_TYPE, GD_E_FIELD_BAD, NULL, 0, field_code);
+    dreturn("%p", NULL);
+    return NULL;
+  }
+
+  dreturn("\"%s\"", E->in_fields[0]);
+  return E->in_fields[0];
+}
+
+const char **gd_aliases(DIRFILE *D, const char *field_code) gd_nothrow
+{
+  gd_entry_t *E;
+  int n, j = 1;
+  unsigned u;
+
+  dtrace("%p, \"%s\"", D, field_code);
+
+  if (D->flags & GD_INVALID) {
+    _GD_SetError(D, GD_E_BAD_DIRFILE, 0, NULL, 0, NULL);
+    dreturn("%p", NULL);
+    return NULL;
+  }
+
+  n = gd_naliases(D, field_code) + 1;
+
+  if (D->error) {
+    dreturn("%p", NULL);
+    return NULL;
+  }
+
+  E = _GD_FindField(D, field_code, D->entry, D->n_entries, 1, NULL);
+
+  if (E == NULL) {
+    _GD_SetError(D, GD_E_BAD_CODE, GD_E_CODE_MISSING, NULL, 0, field_code);
+    dreturn("%p", NULL);
+    return NULL;
+  }
+
+  E->e->alias_list = (const char**)_GD_Realloc(D, E->e->alias_list,
+      sizeof(const char *) * n);
+
+  if (D->error) {
+    dreturn("%p", NULL);
+    return NULL;
+  }
+
+  E->e->alias_list[0] = E->field;
+
+  for (u = 0; u < D->n_entries; ++u)
+    if (D->entry[u]->field_type == GD_ALIAS_ENTRY &&
+        D->entry[u]->e->entry[0] == E)
+    {
+      E->e->alias_list[j++] = D->entry[u]->field;
+    }
+
+  /* terminate */
+  E->e->alias_list[j] = NULL;
+
+  dreturn("%p", E->e->alias_list);
+  return E->e->alias_list;
+}
+
+int gd_naliases(DIRFILE *D, const char *field_code) gd_nothrow
+{
+  gd_entry_t *E;
+  int n = 1;
+  unsigned u;
+
+  dtrace("%p, \"%s\"", D, field_code);
+
+  if (D->flags & GD_INVALID) {
+    _GD_SetError(D, GD_E_BAD_DIRFILE, 0, NULL, 0, NULL);
+    dreturn("%i", -1);
+    return -1;
+  }
+
+  E = _GD_FindField(D, field_code, D->entry, D->n_entries, 1, NULL);
+
+  if (E == NULL) {
+    _GD_SetError(D, GD_E_BAD_CODE, GD_E_CODE_MISSING, NULL, 0, field_code);
+    dreturn("%i", -1);
+    return -1;
+  }
+
+  for (u = 0; u < D->n_entries; ++u)
+    if (D->entry[u]->field_type == GD_ALIAS_ENTRY &&
+        D->entry[u]->e->entry[0] == E)
+    {
+      n++;
+    }
+
+  dreturn("%i", n);
+  return n;
+}
+
 gd_entype_t gd_entry_type(DIRFILE* D, const char* field_code_in) gd_nothrow
 {
   gd_entry_t* E;
@@ -433,7 +603,7 @@ gd_entype_t gd_entry_type(DIRFILE* D, const char* field_code_in) gd_nothrow
   _GD_ClearError(D);
 
   /* get rid of the represenation, if any */
-  E = _GD_FindFieldAndRepr(D, field_code_in, &field_code, &repr, NULL, 1);
+  E = _GD_FindFieldAndRepr(D, field_code_in, &field_code, &repr, NULL, 1, 1);
 
   if (D->error) {
     dreturn("%i", GD_NO_ENTRY);
@@ -447,13 +617,11 @@ gd_entype_t gd_entry_type(DIRFILE* D, const char* field_code_in) gd_nothrow
   return E->field_type;
 }
 
-int gd_fragment_index(DIRFILE* D, const char* field_code_in) gd_nothrow
+int gd_fragment_index(DIRFILE *D, const char *field_code) gd_nothrow
 {
-  gd_entry_t* E;
-  char* field_code;
-  int repr;
+  gd_entry_t *E;
 
-  dtrace("%p, \"%s\"", D, field_code_in);
+  dtrace("%p, \"%s\"", D, field_code);
 
   if (D->flags & GD_INVALID) {
     _GD_SetError(D, GD_E_BAD_DIRFILE, 0, NULL, 0, NULL);
@@ -463,21 +631,128 @@ int gd_fragment_index(DIRFILE* D, const char* field_code_in) gd_nothrow
 
   _GD_ClearError(D);
 
-  /* get rid of the represenation, if any */
-  E = _GD_FindFieldAndRepr(D, field_code_in, &field_code, &repr, NULL, 1);
+  E = _GD_FindField(D, field_code, D->entry, D->n_entries, 0, NULL);
 
-  if (D->error) {
+  if (E == NULL) {
+    _GD_SetError(D, GD_E_BAD_CODE, GD_E_CODE_MISSING, NULL, 0, field_code);
     dreturn("%i", -1);
     return -1;
   }
 
-  if (field_code != field_code_in)
-    free(field_code);
-
   dreturn("%i", E->fragment_index);
   return E->fragment_index;
 }
 
+int gd_hide(DIRFILE *D, const char *field_code) gd_nothrow
+{
+  gd_entry_t *E;
+
+  dtrace("%p, \"%s\"", D, field_code);
+
+  if (D->flags & GD_INVALID) {
+    _GD_SetError(D, GD_E_BAD_DIRFILE, 0, NULL, 0, NULL);
+    dreturn("%i", -1);
+    return -1;
+  } else if ((D->flags & GD_ACCMODE) != GD_RDWR) {
+    _GD_SetError(D, GD_E_ACCMODE, 0, NULL, 0, NULL);
+    dreturn("%i", -1);
+    return -1;
+  }
+
+  _GD_ClearError(D);
+
+  E = _GD_FindField(D, field_code, D->entry, D->n_entries, 0, NULL);
+
+  if (D->error) {
+    _GD_SetError(D, GD_E_BAD_CODE, GD_E_CODE_MISSING, NULL, 0, field_code);
+    dreturn("%i", -1);
+    return -1;
+  }
+
+  if (D->fragment[E->fragment_index].protection & GD_PROTECT_FORMAT) {
+    _GD_SetError(D, GD_E_PROTECTED, GD_E_PROTECTED_FORMAT, NULL, 0,
+        D->fragment[E->fragment_index].cname);
+    dreturn("%i", -1);
+    return -1;
+  }
+
+  if (!E->hidden) {
+    E->hidden = 1;
+    D->fragment[E->fragment_index].modified = 1;
+  }
+
+  dreturn("%i", 0);
+  return 0;
+}
+
+int gd_hidden(DIRFILE *D, const char *field_code) gd_nothrow
+{
+  gd_entry_t *E;
+
+  dtrace("%p, \"%s\"", D, field_code);
+
+  if (D->flags & GD_INVALID) {
+    _GD_SetError(D, GD_E_BAD_DIRFILE, 0, NULL, 0, NULL);
+    dreturn("%i", -1);
+    return -1;
+  }
+
+  _GD_ClearError(D);
+
+  E = _GD_FindField(D, field_code, D->entry, D->n_entries, 0, NULL);
+
+  if (D->error) {
+    _GD_SetError(D, GD_E_BAD_CODE, GD_E_CODE_MISSING, NULL, 0, field_code);
+    dreturn("%i", -1);
+    return -1;
+  }
+
+  dreturn("%i", E->hidden);
+  return E->hidden;
+}
+
+int gd_unhide(DIRFILE *D, const char *field_code) gd_nothrow
+{
+  gd_entry_t *E;
+
+  dtrace("%p, \"%s\"", D, field_code);
+
+  if (D->flags & GD_INVALID) {
+    _GD_SetError(D, GD_E_BAD_DIRFILE, 0, NULL, 0, NULL);
+    dreturn("%i", -1);
+    return -1;
+  } else if ((D->flags & GD_ACCMODE) != GD_RDWR) {
+    _GD_SetError(D, GD_E_ACCMODE, 0, NULL, 0, NULL);
+    dreturn("%i", -1);
+    return -1;
+  }
+
+  _GD_ClearError(D);
+
+  E = _GD_FindField(D, field_code, D->entry, D->n_entries, 0, NULL);
+
+  if (D->error) {
+    _GD_SetError(D, GD_E_BAD_CODE, GD_E_CODE_MISSING, NULL, 0, field_code);
+    dreturn("%i", -1);
+    return -1;
+  }
+
+  if (D->fragment[E->fragment_index].protection & GD_PROTECT_FORMAT) {
+    _GD_SetError(D, GD_E_PROTECTED, GD_E_PROTECTED_FORMAT, NULL, 0,
+        D->fragment[E->fragment_index].cname);
+    dreturn("%i", -1);
+    return -1;
+  }
+
+  if (E->hidden) {
+    E->hidden = 0;
+    D->fragment[E->fragment_index].modified = 1;
+  }
+
+  dreturn("%i", 0);
+  return 0;
+}
+
 int gd_validate(DIRFILE *D, const char *field_code_in) gd_nothrow
 {
   int i, repr;
@@ -495,7 +770,7 @@ int gd_validate(DIRFILE *D, const char *field_code_in) gd_nothrow
   _GD_ClearError(D);
 
   /* get rid of the representation, if any */
-  E = _GD_FindFieldAndRepr(D, field_code_in, &field_code, &repr, NULL, 1);
+  E = _GD_FindFieldAndRepr(D, field_code_in, &field_code, &repr, NULL, 1, 1);
 
   if (D->error) {
     dreturn("%i", -1);
@@ -507,17 +782,19 @@ int gd_validate(DIRFILE *D, const char *field_code_in) gd_nothrow
 
   /* calculate scalars */
   if (!E->e->calculated)
-    _GD_CalculateEntry(D, E);
+    _GD_CalculateEntry(D, E, 1);
 
   /* check input fields */
   switch (E->field_type) {
     case GD_LINCOM_ENTRY:
       for (i = 0; i < E->EN(lincom,n_fields); ++i)
-        _GD_BadInput(D, E, i);
+        _GD_BadInput(D, E, i, 1);
       break;
     case GD_DIVIDE_ENTRY:
     case GD_MULTIPLY_ENTRY:
-      _GD_BadInput(D, E, 1);
+    case GD_WINDOW_ENTRY:
+    case GD_MPLEX_ENTRY:
+      _GD_BadInput(D, E, 1, 1);
       /* fallthrough */
     case GD_LINTERP_ENTRY:
     case GD_BIT_ENTRY:
@@ -525,7 +802,7 @@ int gd_validate(DIRFILE *D, const char *field_code_in) gd_nothrow
     case GD_POLYNOM_ENTRY:
     case GD_SBIT_ENTRY:
     case GD_RECIP_ENTRY:
-      _GD_BadInput(D, E, 0);
+      _GD_BadInput(D, E, 0, 1);
       /* Fallthrough */
     case GD_RAW_ENTRY:
     case GD_CONST_ENTRY:
@@ -533,6 +810,7 @@ int gd_validate(DIRFILE *D, const char *field_code_in) gd_nothrow
     case GD_STRING_ENTRY:
     case GD_INDEX_ENTRY:
     case GD_NO_ENTRY:
+    case GD_ALIAS_ENTRY:
       break;
   }
 
@@ -544,3 +822,49 @@ int gd_validate(DIRFILE *D, const char *field_code_in) gd_nothrow
   dreturn("%i", 0);
   return 0;
 }
+
+char *gd_linterp_tablename(DIRFILE *D, const char *field_code_in) gd_nothrow
+{
+  int repr;
+  gd_entry_t *E;
+  char *field_code, *table;
+
+  dtrace("%p, \"%s\"", D, field_code_in);
+
+  if (D->flags & GD_INVALID) {
+    _GD_SetError(D, GD_E_BAD_DIRFILE, 0, NULL, 0, NULL);
+    dreturn("%p", NULL);
+    return NULL;
+  }
+
+  _GD_ClearError(D);
+
+  E = _GD_FindFieldAndRepr(D, field_code_in, &field_code, &repr, NULL, 1, 1);
+
+  if (D->error) {
+    dreturn("%p", NULL);
+    return NULL;
+  }
+
+  if (field_code != field_code_in)
+    free(field_code);
+
+  if (E->field_type != GD_LINTERP_ENTRY) {
+    _GD_SetError(D, GD_E_BAD_FIELD_TYPE, GD_E_FIELD_BAD, NULL, 0, field_code);
+    dreturn("%p", NULL);
+    return NULL;
+  }
+
+  /* initialise */
+  if (E->e->u.linterp.table_file == NULL)
+    if (_GD_SetTablePath(D, E, E->e)) {
+      dreturn("%p", NULL);
+      return NULL;
+    }
+
+  table = _GD_MakeFullPath(D, E->e->u.linterp.table_dirfd,
+      E->e->u.linterp.table_file, 1);
+
+  dreturn("%s", table);
+  return table;
+}
diff --git a/src/errors.c b/src/errors.c
index 2faaed6..110ff69 100644
--- a/src/errors.c
+++ b/src/errors.c
@@ -1,5 +1,5 @@
 /* Copyright (C) 2002-2005 C. Barth Netterfield
- * Copyright (C) 2005-2010 D. V. Wiebe
+ * Copyright (C) 2005-2012 D. V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,12 +21,6 @@
  */
 #include "internal.h"
 
-#ifdef STDC_HEADERS
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-#endif
-
 /* Error strings. */
 static const struct {
   int error;
@@ -39,6 +33,7 @@ static const struct {
   { GD_E_OPEN, GD_E_OPEN_NO_ACCESS,
     "Cannot open dirfile {2}: permission denied", 0 },
   { GD_E_OPEN, GD_E_OPEN_NOT_EXIST, "Dirfile does not exist: {2}", 0 },
+  { GD_E_OPEN, GD_E_OPEN_PATH, "Bad path: {2}", 0 },
   /* GD_E_FORMAT: 1 = suberror, 2 = formatfile, 3 = line number, 4 = token */
   { GD_E_FORMAT, GD_E_FORMAT_BAD_TYPE, "Bad data type on line {3} of {2}: {4}",
     0 },
@@ -66,8 +61,8 @@ static const struct {
     "Unterminated token on line {3} of {2}", 0 },
   { GD_E_FORMAT, GD_E_FORMAT_METARAW,
     "Invalid metafield type on line {3} of {2}", 0 },
-  { GD_E_FORMAT, GD_E_FORMAT_NO_PARENT,
-    "Meta field defined before parent ({4}) on line {3} of {2}", 0 },
+  { GD_E_FORMAT, GD_E_FORMAT_NO_FIELD,
+    "Field code not found on line {3} of {2}: {4}", 0 },
   { GD_E_FORMAT, GD_E_FORMAT_DUPLICATE,
     "Field code on line {3} of {2} already defined: {4}", 0 },
   { GD_E_FORMAT, GD_E_FORMAT_LOCATION,
@@ -76,18 +71,26 @@ static const struct {
     "Bad protection level on line {3} of {2}: {4}", 0 },
   { GD_E_FORMAT, GD_E_FORMAT_LITERAL,
     "Unexpected characters in scalar literal ({4}) on line {3} of {2}", 0 },
+  { GD_E_FORMAT, GD_E_FORMAT_WINDOP,
+    "Unrecognised operator ({4}) on line {3} of {2}", 0 },
+  { GD_E_FORMAT, GD_E_FORMAT_META_META,
+    "Cannot attach meta field to meta field {4} on line {3} of {2}", 0 },
+  { GD_E_FORMAT, GD_E_FORMAT_ALIAS,
+    "Cannot use alias {4} as parent to a meta field on line {3} of {2}", 0 },
+  { GD_E_FORMAT, GD_E_FORMAT_MPLEXVAL,
+    "Bad MPLEX period ({4}) on line {3} of {2}", 0 },
   /* GD_E_TRUNC: 1 = suberror, 2 = filename. 3 = errno */
   { GD_E_TRUNC, 0, "Error truncating {2}: ", 1 },
   /* GD_E_CREAT: 1 = suberror, 2 = filename, 3 = errno */
   { GD_E_CREAT, GD_E_CREAT_DIR, "Unable to create directory {2}: ", 1 },
+  { GD_E_CREAT, GD_E_CREAT_OPEN, "Unable to open directory {2}: ", 1 },
   { GD_E_CREAT, GD_E_CREAT_FORMAT, "Unable to create format file {2}: ", 1 },
-  { GD_E_CREAT, GD_E_CREAT_EXCL, "Unable to create dirfile {2}: already exists",
-    1 },
   /* GD_E_BAD_CODE: 4 = field code */
-  { GD_E_BAD_CODE, 0, "Field not found: {4}", 0 },
+  { GD_E_BAD_CODE, GD_E_CODE_MISSING, "Field not found: {4}", 0 },
+  { GD_E_BAD_CODE, GD_E_CODE_INVALID, "Bad field name: {4}", 0 },
   /* GD_E_BAD_TYPE: 1 = data type */
   { GD_E_BAD_TYPE, 0, "Unsupported data type: {1}", 0 },
-  /* GD_E_RAW_IO: 1 = suberror, 2 = filename, 3 = errno */
+  /* GD_E_RAW_IO: 2 = filename, 3 = errno */
   { GD_E_RAW_IO, 0, "Error accessing {2}: ", 1 },
   /* GD_E_OPEN_FRAGMENT: 1 = errno, 2 = format file, 3 = line, 4 = includefile*/
   { GD_E_OPEN_FRAGMENT, 0,
@@ -103,8 +106,11 @@ static const struct {
   /* GD_E_OPEN_LINFILE: 1 = suberror, 2 = errno, 4 = lutfile */
   { GD_E_OPEN_LINFILE, GD_E_LINFILE_LENGTH, "LINTERP table {4} too short", 0 },
   { GD_E_OPEN_LINFILE, 0, "Error opening LINTERP table {4}: ", 2 },
-  /* GD_E_RECURSE_LEVEL: 4 = fieldcode */
-  { GD_E_RECURSE_LEVEL, 0, "Recursion too deep resolving field {4}", 0 },
+  /* GD_E_RECURSE_LEVEL: 2 = file; 3 = line; 4 = name */
+  { GD_E_RECURSE_LEVEL, GD_E_RECURSE_CODE,
+    "Recursion too deep resolving field {4}", 0 },
+  { GD_E_RECURSE_LEVEL, GD_E_RECURSE_INCLUDE,
+    "Recursion too deep including {4} on line {3} of {2}", 0 },
   /* GD_E_BAD_DIRFILE: (nothing) */
   { GD_E_BAD_DIRFILE, 0, "Invalid dirfile", 0 },
   /* GD_E_BAD_FIELD_TYPE: 4 = fieldcode */
@@ -117,21 +123,23 @@ static const struct {
   { GD_E_UNSUPPORTED, 0, "Operation not supported by current encoding scheme",
     0 },
   /* GD_E_UNKNOWN_ENCODING: (nothing) */
-  { GD_E_UNKNOWN_ENCODING, 0, "Unable to determine encoding scheme", 0 },
-  /* GD_E_BAD_ENTRY: 3 = parameter */
-  { GD_E_BAD_ENTRY, GD_E_BAD_ENTRY_TYPE, "Invalid entry type: {3}", 0 },
-  { GD_E_BAD_ENTRY, GD_E_BAD_ENTRY_SPF, "Samples per frame out of range: {3}",
-    0 },
-  { GD_E_BAD_ENTRY, GD_E_BAD_ENTRY_NFIELDS,
-    "LINCOM field count out of range: {3}", 0 },
-  { GD_E_BAD_ENTRY, GD_E_BAD_ENTRY_BITNUM, "Starting bit out of range: {3}",
+  { GD_E_UNKNOWN_ENCODING, GD_E_UNENC_UNDET,
+    "Unable to determine encoding scheme", 0 },
+  { GD_E_UNKNOWN_ENCODING, GD_E_UNENC_TARGET, "Unknown ouput encoding scheme",
     0 },
-  { GD_E_BAD_ENTRY, GD_E_BAD_ENTRY_NUMBITS, "Numbits out of range: {3}", 0 },
-  { GD_E_BAD_ENTRY, GD_E_BAD_ENTRY_BITSIZE,
-    "End of bitfield out of range: {3}", 0 },
-  { GD_E_BAD_ENTRY, GD_E_BAD_ENTRY_METARAW, "Invalid metafield type: {3}", 0 },
-  { GD_E_BAD_ENTRY, GD_E_BAD_ENTRY_POLYORD, "POLYNOM order out of range: {3}",
+  /* GD_E_BAD_ENTRY: 3 = parameter */
+  { GD_E_BAD_ENTRY, GD_E_ENTRY_TYPE, "Invalid entry type: {3}", 0 },
+  { GD_E_BAD_ENTRY, GD_E_ENTRY_SPF, "Samples per frame out of range: {3}", 0 },
+  { GD_E_BAD_ENTRY, GD_E_ENTRY_NFIELDS, "LINCOM field count out of range: {3}",
     0 },
+  { GD_E_BAD_ENTRY, GD_E_ENTRY_BITNUM, "Starting bit out of range: {3}", 0 },
+  { GD_E_BAD_ENTRY, GD_E_ENTRY_NUMBITS, "Numbits out of range: {3}", 0 },
+  { GD_E_BAD_ENTRY, GD_E_ENTRY_BITSIZE, "End of bitfield out of range: {3}", 0},
+  { GD_E_BAD_ENTRY, GD_E_ENTRY_METARAW, "Invalid metafield type: {3}", 0 },
+  { GD_E_BAD_ENTRY, GD_E_ENTRY_POLYORD, "POLYNOM order out of range: {3}", 0 },
+  { GD_E_BAD_ENTRY, GD_E_ENTRY_WINDOP, "Unrecognised WINDOW operator: {3}", 0 },
+  { GD_E_BAD_ENTRY, GD_E_ENTRY_CNTVAL, "Count value out of range: {3}", 0 },
+  { GD_E_BAD_ENTRY, GD_E_ENTRY_PERIOD, "MPLEX period out of range: {3}", 0 },
   /* GD_E_DUPLICATE: 4 = name */
   { GD_E_DUPLICATE, 0, "Field code already present: {4}", 0 },
   /* GD_E_DIMENSION: 2 = parent field (if any), 4 = field code */
@@ -140,7 +148,7 @@ static const struct {
   { GD_E_DIMENSION, GD_E_DIM_CALLER,
     "Vector field expected, but scalar field given: {4}", 0 },
   /* GD_E_BAD_INDEX: 3 = index */
-  { GD_E_BAD_INDEX, 0, "Invalid format file index: {3}", 0 },
+  { GD_E_BAD_INDEX, 0, "Invalid fragment index: {3}", 0 },
   /* GD_E_BAD_SCALAR: 2 = parent field, 4 = scalar field */
   { GD_E_BAD_SCALAR, GD_E_SCALAR_CODE,
     "Scalar field {4} not found in definition of {2}", 0 },
@@ -161,12 +169,22 @@ static const struct {
     "Cannot delete field {4} used in definiton of field {2}", 0 },
   { GD_E_DELETE, GD_E_DEL_DERIVED,
     "Cannot delete field {4} used as input to field {2}", 0 },
-  /* GD_E_BAD_ENDIANNESS: (nothing) */
-  { GD_E_BAD_ENDIANNESS, 0, "Invalid endianness specified", 0 },
+  { GD_E_DELETE, GD_E_DEL_ALIAS, "Cannot delete field {4} with aliases", 0 },
+  /* GD_E_ARGUMENT: (nothing) */
+  { GD_E_ARGUMENT, GD_E_ARG_WHENCE, "Invalid origin specified", 0 },
+  { GD_E_ARGUMENT, GD_E_ARG_ENDIANNESS, "Invalid endianness specified", 0 },
+  { GD_E_ARGUMENT, GD_E_ARG_PROTECTION, "Invalid protection level specified",
+    0 },
+  { GD_E_ARGUMENT, GD_E_ARG_NODATA, "No data", 0 },
+  { GD_E_ARGUMENT, GD_E_ARG_NO_VERS, "Dirfile conforms to no Standards Version",
+    0 },
+  { GD_E_ARGUMENT, GD_E_ARG_BAD_VERS,
+    "Dirfile does not conform to specified Standards Version", 0 },
+  { GD_E_ARGUMENT, 0, "Bad argument", 0 },
   /* GD_E_CALLBACK: 3 = response */
   { GD_E_CALLBACK, 0, "Unrecognised response from callback function: {3}", 0 },
-  /* GD_E_BAD_PROTECTION: (nothing) */
-  { GD_E_BAD_PROTECTION, 0, "Invalid protection level specified", 0 },
+  /* GD_E_ExISTS: (nothing) */
+  { GD_E_EXISTS, 0, "Dirfile exists", 0 },
   /* GD_E_UNCLEAN_DB: 3 = fragment */
   { GD_E_UNCLEAN_DB, 0,
     "Unexpected system error processing {3}; database unclean", 0 },
@@ -174,19 +192,19 @@ static const struct {
   { GD_E_DOMAIN, GD_E_DOMAIN_COMPLEX, "Improper domain: complex valued", 0 },
   { GD_E_DOMAIN, GD_E_DOMAIN_EMPTY, "Improper domain: empty set", 0 },
   { GD_E_DOMAIN, GD_E_DOMAIN_ANTITONIC, "Improper domain: not monotonic", 0 },
+  { GD_E_DOMAIN, GD_E_DOMAIN_MULTIPOS, "I/O position mismatch in inputs", 0 },
   /* GD_E_UNCLEAN_DB: 4 = repr */
   { GD_E_BAD_REPR, GD_E_REPR_UNKNOWN, "Unknown field representation: .{4}", 0 },
   { GD_E_BAD_REPR, GD_E_REPR_PUT, "Unable to write to field reprentation: .{4}",
     0 },
-  /* GD_E_BAD_VERSION 3 = version */
-  { GD_E_BAD_VERSION, GD_E_VERS_NONE,
-    "Dirfile conforms to no Standards Version", 0 },
-  { GD_E_BAD_VERSION, GD_E_VERS_MISSING,
-    "Dirfile does not conform to Standards Version {3}", 0 },
   /* GD_E_FLUSH: 3 = suberror, 4 = filename */
   { GD_E_FLUSH, GD_E_FLUSH_MKTMP, "I/O error creating temporary file: ", 1 },
   { GD_E_FLUSH, GD_E_FLUSH_OPEN, "I/O error opening temporary file: ", 1 },
   { GD_E_FLUSH, GD_E_FLUSH_RENAME, "I/O error replacing format metadata: ", 1 },
+  /* GD_E_BOUNDS: (nothing) */
+  { GD_E_BOUNDS, 0, "CARRAY length out of bounds", 0 },
+  /* GD_E_LINE_TOO_LONG: 2 = fragment, 3 = line number */
+  { GD_E_LINE_TOO_LONG, 0, "Line {3} of {2} too long", 0 },
   /* GD_E_OK: (nothing) */
   { 0, 0, "Success", 0} /* this must be the last error string defined */
 };
@@ -200,6 +218,8 @@ void _GD_SetError(DIRFILE* D, int error, int suberror,
       line, token);
 
   D->error = error;
+  if (error != GD_E_OK)
+    D->n_error++;
   D->suberror = suberror;
   D->error_line = line;
   if (format_file != NULL) {
@@ -213,7 +233,8 @@ void _GD_SetError(DIRFILE* D, int error, int suberror,
 
   if (D->flags & GD_VERBOSE) {
     char *error_string = gd_error_string(D, NULL, 0);
-    fprintf(stderr, PACKAGE_NAME ": %s\n", error_string);
+    fprintf(stderr, "%slibgetdata: %s\n",
+        D->error_prefix ? D->error_prefix : "", error_string);
     free(error_string);
   }
 
@@ -242,7 +263,7 @@ char* gd_error_string(const DIRFILE* D, char* buffer, size_t buflen) gd_nothrow
   char* bufend;
   int i, s = -1;
 
-  dtrace("%p, %p, %zu", D, buffer, buflen);
+  dtrace("%p, %p, %" PRNsize_t, D, buffer, buflen);
 
   /* Sanity check */
   if (D == NULL || (buffer && buflen < 1)) {
@@ -326,5 +347,18 @@ char* gd_error_string(const DIRFILE* D, char* buffer, size_t buflen) gd_nothrow
   dreturn("\"%s\"", buffer);
   return buffer;
 }
+
+int gd_error_count(DIRFILE *D) gd_nothrow
+{
+  int count;
+
+  dtrace("%p", D);
+  count = D->n_error;
+  D->n_error = 0;
+
+  dreturn("%i", count);
+
+  return count;
+}
 /* vim: ts=2 sw=2 et tw=80
 */
diff --git a/src/field_list.c b/src/field_list.c
index bd41a71..a39576b 100644
--- a/src/field_list.c
+++ b/src/field_list.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2010 D. V. Wiebe
+/* Copyright (C) 2008-2012 D. V. Wiebe
  *
  ***************************************************************************
  *
@@ -20,22 +20,270 @@
  */
 #include "internal.h"
 
-#ifdef STDC_HEADERS
-#include <stdlib.h>
-#endif
-
 /* zero length lists */
 static const char* zero_list[1] = { NULL };
 static const gd_carray_t zero_carrays[1] = { {0, NULL} };
 
-/* correspondence between type_list index and gd_enttype_t */
-const gd_entype_t _gd_entype_index[GD_N_ENTYPES] =
+gd_static_inline_ int _GD_EntryIndex(unsigned int t)
+{
+  int i;
+
+  dtrace("%u", t);
+  switch(t) {
+    case GD_RAW_ENTRY:
+      i = 0;
+      break;
+    case GD_LINCOM_ENTRY:
+      i = 1;
+      break;
+    case GD_LINTERP_ENTRY:
+      i = 2;
+      break;
+    case GD_BIT_ENTRY:
+      i = 3;
+      break;
+    case GD_MULTIPLY_ENTRY:
+      i = 4;
+      break;
+    case GD_PHASE_ENTRY:
+      i = 5;
+      break;
+    case GD_INDEX_ENTRY:
+      i = 6;
+      break;
+    case GD_POLYNOM_ENTRY:
+      i = 7;
+      break;
+    case GD_SBIT_ENTRY:
+      i = 8;
+      break;
+    case GD_DIVIDE_ENTRY:
+      i = 9;
+      break;
+    case GD_RECIP_ENTRY:
+      i = 10;
+      break;
+    case GD_WINDOW_ENTRY:
+      i = 11;
+      break;
+    case GD_MPLEX_ENTRY:
+      i = 12;
+      break;
+    case GD_CONST_ENTRY:
+      i = 13;
+      break;
+    case GD_CARRAY_ENTRY:
+      i = 14;
+      break;
+    case GD_STRING_ENTRY:
+      i = 15;
+      break;
+    case GD_VECTOR_ENTRIES:
+      i = 16;
+      break;
+    case GD_SCALAR_ENTRIES:
+      i = 17;
+      break;
+    case GD_ALIAS_ENTRY:
+      i = 18;
+      break;
+    case GD_ALL_ENTRIES:
+      i = 19;
+      break;
+    default:
+      i = -1;
+      break;
+  }
+
+  dreturn("%i", i);
+  return i;
+}
+
+/* returns true if E a member of the given list */
+int _GD_ListEntry(const gd_entry_t *E, int meta, int hidden, int noalias,
+    int special, gd_entype_t type)
+{
+  dtrace("%p{%s}, %i, %i, %i, %i, 0x%X", E, E->field, meta, hidden, noalias,
+      special, type);
+
+  /* check hidden */
+  if (!hidden && E->hidden) {
+    dreturn("%i (hidden)", 0);
+    return 0;
+  }
+
+  /* check meta */
+  if (!meta && E->e->n_meta == -1) {
+    dreturn("%i (meta)", 0);
+    return 0;
+  }
+
+  /* aliases */
+  if (E->field_type == GD_ALIAS_ENTRY) {
+    int ret = 0;
+
+    if (noalias) {
+      dreturn("%i (alias)", 0);
+      return 0;
+    }
+
+    /* that's right: GD_ALIAS_ENTRY + noalias gets you what you deserve */
+    if (special == GD_ALIAS_ENTRIES) {
+      dreturn("%i (aliases)", 1);
+      return 1;
+    }
+      
+    if (E->e->entry[0])
+      ret = _GD_ListEntry(E->e->entry[0], meta, hidden, 0, special, type);
+    dreturn("%i", ret);
+    return ret;
+  }
+
+  /* type check */
+  if (special == GD_VECTOR_ENTRIES && (E->field_type & GD_SCALAR_ENTRY_BIT)) {
+    dreturn("%i (vector)", 0);
+    return 0;
+  } else if (special == GD_SCALAR_ENTRIES &&
+      !(E->field_type & GD_SCALAR_ENTRY_BIT))
+  {
+    dreturn("%i (scalar)", 0);
+    return 0;
+  } else if (special == GD_ALIAS_ENTRIES) { /* we weeded out aliases earlier */
+    dreturn("%i (aliases)", 0);
+    return 0;
+  } else if (type && E->field_type != type) {
+    dreturn("%i (type)", 0);
+    return 0;
+  }
+
+  dreturn("%i", 1);
+  return 1;
+}
+
+static const char **_GD_EntryList(DIRFILE *D, struct gd_private_entry_ *p,
+    size_t offs, int type, unsigned int flags) gd_nothrow
+{
+  char** el;
+  int i, index;
+  unsigned int u, n = 0;
+  const int special = (type & GD_SPECIAL_ENTRY_BIT) ? type : 0;
+  const gd_entype_t ctype = (type & GD_SPECIAL_ENTRY_BIT) ? GD_NO_ENTRY :
+    (gd_entype_t)type;
+  const int hidden = (flags & GD_ENTRIES_HIDDEN);
+  const int noalias = (flags & GD_ENTRIES_NOALIAS);
+
+  dtrace("%p, %p, %" PRNsize_t ", 0x%X, 0x%X", D, p, offs, type, flags);
+
+  if (D->flags & GD_INVALID) {
+    _GD_SetError(D, GD_E_BAD_DIRFILE, 0, NULL, 0, NULL);
+    dreturn("%p", NULL);
+    return NULL;
+  }
+
+  _GD_ClearError(D);
+
+  index = _GD_EntryIndex(type);
+  if (index < 0) {
+    _GD_SetError(D, GD_E_BAD_ENTRY, GD_E_ENTRY_TYPE, NULL, type, NULL);
+    dreturn("%p", NULL);
+    return NULL;
+  }
+
+  if (p) {
+    if (p->entry_list_validity & (1 << index) &&
+      p->entry_list_flags[index] == flags)
+    {
+      /* list already made */
+      dreturn("%p", p->entry_list[index]);
+      return p->entry_list[index];
+    }
+  } else if (D->entry_list_validity & (1 << index) &&
+      D->entry_list_flags[index] == flags)
+  {
+    /* list already made */
+    dreturn("%p", D->entry_list[index]);
+    return D->entry_list[index];
+  }
+
+  n = _GD_NEntries(D, p, type, flags);
+
+  if (D->error) {
+    dreturn("%p", NULL);
+    return NULL;
+  }
+
+  if (n == 0) {
+    dreturn("%p", zero_list);
+    return zero_list;
+  }
+
+  el = (char **)_GD_Malloc(D, sizeof(const char*) * (n + 1));
+
+  if (el == NULL) {
+    dreturn("%p", NULL);
+    return NULL;
+  }
+
+  n = 0;
+  if (p) {
+    for (i = 0; i < p->n_meta; ++i)
+      if (_GD_ListEntry(p->p.meta_entry[i], 1, hidden, noalias, special, ctype))
+        el[n++] = p->p.meta_entry[i]->field + offs;
+
+    free(p->entry_list[index]);
+    p->entry_list[index] = (const char **)el;
+    p->entry_list_flags[index] = flags;
+    p->entry_list_validity |= 1 << index;
+  } else {
+    for (u = 0; u < D->n_entries; ++u)
+      if (_GD_ListEntry(D->entry[u], 0, hidden, noalias, special, ctype))
+        el[n++] = D->entry[u]->field;
+
+    free(D->entry_list[index]);
+    D->entry_list[index] = (const char **)el;
+    D->entry_list_flags[index] = flags;
+    D->entry_list_validity |= 1 << index;
+  }
+  el[n] = NULL;
+
+  dreturn("%p", (const char **)el);
+  return (const char **)el;
+}
+
+const char **gd_entry_list(DIRFILE* D, const char *parent, int type,
+    unsigned int flags) gd_nothrow
 {
-  GD_RAW_ENTRY, GD_LINCOM_ENTRY, GD_LINTERP_ENTRY, GD_BIT_ENTRY,
-  GD_MULTIPLY_ENTRY, GD_PHASE_ENTRY, GD_INDEX_ENTRY, GD_POLYNOM_ENTRY,
-  GD_SBIT_ENTRY, GD_DIVIDE_ENTRY, GD_RECIP_ENTRY, GD_CONST_ENTRY,
-  GD_STRING_ENTRY, GD_CARRAY_ENTRY
-};
+  const char **el;
+  size_t offs = 0;
+  struct gd_private_entry_ *p = NULL;
+
+  dtrace("%p, \"%s\", %i, %u", D, parent, type, flags);
+
+  if (D->flags & GD_INVALID) {
+    _GD_SetError(D, GD_E_BAD_DIRFILE, 0, NULL, 0, NULL);
+    dreturn("%u", 0);
+    return 0;
+  }
+
+  if (parent) {
+    gd_entry_t *P = _GD_FindField(D, parent, D->entry, D->n_entries, 1, NULL);
+
+    if (P == NULL || P->e->n_meta == -1) {
+      _GD_SetError(D, GD_E_BAD_CODE, P ? GD_E_CODE_INVALID : GD_E_CODE_MISSING,
+          NULL, 0, parent);
+      dreturn("%u", 0);
+      return 0;
+    }
+    p = P->e;
+    offs = strlen(P->field) + 1;
+  }
+
+  _GD_ClearError(D);
+
+  el = _GD_EntryList(D, p, offs, type, flags);
+  dreturn("%p", el);
+  return el;
+}
 
 const void *gd_constants(DIRFILE* D, gd_type_t return_type) gd_nothrow
 {
@@ -52,13 +300,12 @@ const void *gd_constants(DIRFILE* D, gd_type_t return_type) gd_nothrow
 
   _GD_ClearError(D);
 
-  if (D->n_const == 0) {
+  if ((n = _GD_NEntries(D, NULL, GD_CONST_ENTRY, 0)) == 0) {
     dreturn("%p", NULL);
     return NULL;
   }
 
-  free(D->const_value_list);
-  fl = (char *)_GD_Alloc(D, return_type, D->n_const);
+  fl = (char *)_GD_Alloc(D, return_type, n);
 
   if (fl == NULL) {
     dreturn("%p", NULL);
@@ -66,13 +313,13 @@ const void *gd_constants(DIRFILE* D, gd_type_t return_type) gd_nothrow
   }
 
   for (i = n = 0; i < D->n_entries; ++i) {
-    if (D->entry[i]->field_type == GD_CONST_ENTRY &&
-        D->entry[i]->e->n_meta != -1)
+    if (_GD_ListEntry(D->entry[i], 0, 0, 0, 0, GD_CONST_ENTRY))
       if (_GD_DoField(D, D->entry[i], 0, 0, 1, return_type,
             fl + n++ * GD_SIZE(return_type)) != 1)
         break;
   }
 
+  free(D->const_value_list);
   D->const_value_list = fl;
 
   dreturn("%p", D->error ? NULL : D->const_value_list);
@@ -94,27 +341,22 @@ const gd_carray_t *gd_carrays(DIRFILE* D, gd_type_t return_type) gd_nothrow
 
   _GD_ClearError(D);
 
-  if (D->n_carray == 0) {
+  if ((n = _GD_NEntries(D, NULL, GD_CARRAY_ENTRY, 0)) == 0) {
     dreturn("%p", zero_carrays);
     return zero_carrays;
   }
 
-  if (D->carray_value_list)
-    for (i = 0; D->carray_value_list[i].n != 0; ++i)
-      free(D->carray_value_list[i].d);
-  free(D->carray_value_list);
-  fl = (gd_carray_t *)malloc(sizeof(gd_carray_t) * (D->n_carray + 1));
-  memset(fl, 0, sizeof(gd_carray_t) * (D->n_carray + 1));
+  fl = (gd_carray_t *)_GD_Malloc(D, sizeof(gd_carray_t) * (n + 1));
 
   if (fl == NULL) {
-    _GD_SetError(D, GD_E_ALLOC, 0, NULL, 0, NULL);
     dreturn("%p", NULL);
     return NULL;
   }
 
+  memset(fl, 0, sizeof(gd_carray_t) * (n + 1));
+
   for (i = n = 0; i < D->n_entries; ++i) {
-    if (D->entry[i]->field_type == GD_CARRAY_ENTRY &&
-        D->entry[i]->e->n_meta != -1) {
+    if (_GD_ListEntry(D->entry[i], 0, 0, 0, 0, GD_CARRAY_ENTRY)) {
       fl[n].n = D->entry[i]->EN(scalar,array_len);
       fl[n].d = _GD_Alloc(D, return_type, fl[n].n);
       if (D->error || _GD_DoField(D, D->entry[i], 0, 0, fl[n].n, return_type,
@@ -125,6 +367,10 @@ const gd_carray_t *gd_carrays(DIRFILE* D, gd_type_t return_type) gd_nothrow
   }
   fl[n].n = 0;
 
+  if (D->carray_value_list)
+    for (i = 0; D->carray_value_list[i].n != 0; ++i)
+      free(D->carray_value_list[i].d);
+  free(D->carray_value_list);
   D->carray_value_list = fl;
 
   dreturn("%p", D->error ? NULL : fl);
@@ -146,35 +392,33 @@ const char **gd_strings(DIRFILE* D) gd_nothrow
 
   _GD_ClearError(D);
 
-  if (D->n_string == 0) {
+  if ((n = _GD_NEntries(D, NULL, GD_STRING_ENTRY, 0)) == 0) {
     dreturn("%p", zero_list);
     return zero_list;
   }
 
-  if (D->list_validity & LIST_VALID_STRING_VALUE) {
+  if (D->value_list_validity & GD_LIST_VALID_STRING_VALUE) {
     /* list already made */
     dreturn("%p", D->string_value_list);
     return D->string_value_list;
   }
 
-  fl = (char **)realloc((char **)D->string_value_list, sizeof(const char*) *
-      (D->n_string + 1));
+  fl = (char **)_GD_Malloc(D, sizeof(const char*) * (n + 1));
 
   if (fl == NULL) {
-    _GD_SetError(D, GD_E_ALLOC, 0, NULL, 0, NULL);
     dreturn("%p", NULL);
     return NULL;
   }
 
   for (i = n = 0; i < D->n_entries; ++i) {
-    if (D->entry[i]->field_type == GD_STRING_ENTRY &&
-        D->entry[i]->e->n_meta != -1)
+    if (_GD_ListEntry(D->entry[i], 0, 0, 0, 0, GD_STRING_ENTRY))
       fl[n++] = D->entry[i]->e->u.string;
   }
   fl[n] = NULL;
 
+  free(D->string_value_list);
   D->string_value_list = (const char **)fl;
-  D->list_validity |= LIST_VALID_STRING_VALUE;
+  D->value_list_validity |= GD_LIST_VALID_STRING_VALUE;
 
   dreturn("%p", D->string_value_list);
   return D->string_value_list;
@@ -182,11 +426,44 @@ const char **gd_strings(DIRFILE* D) gd_nothrow
 
 const char **gd_field_list_by_type(DIRFILE* D, gd_entype_t type) gd_nothrow
 {
-  unsigned int i, n;
-  char** fl;
-  int index = -1;
+  const char** el;
+  dtrace("%p, 0x%X", D, type);
+
+  el = gd_entry_list(D, NULL, type, 0);
+  dreturn("%p", el);
+  return el;
+}
+
+const char **gd_vector_list(DIRFILE* D) gd_nothrow
+{
+  const char **el;
+  dtrace("%p", D);
+
+  el = gd_entry_list(D, NULL, GD_VECTOR_ENTRIES, 0);
+  dreturn("%p", el);
+  return el;
+}
+
+const char **gd_field_list(DIRFILE* D) gd_nothrow
+{
+  const char **el;
 
-  dtrace("%p, %x", D, type);
+  dtrace("%p", D);
+
+  el = gd_entry_list(D, NULL, GD_ALL_ENTRIES, 0);
+  dreturn("%p", el);
+  return el;
+}
+
+const void *gd_mconstants(DIRFILE* D, const char* parent,
+    gd_type_t return_type) gd_nothrow
+{
+  int i, n;
+  char* fl;
+  gd_entry_t *P;
+  struct gd_private_entry_ *e;
+
+  dtrace("%p, \"%s\", 0x%x", D, parent, return_type);
 
   if (D->flags & GD_INVALID) {
     _GD_SetError(D, GD_E_BAD_DIRFILE, 0, NULL, 0, NULL);
@@ -196,66 +473,54 @@ const char **gd_field_list_by_type(DIRFILE* D, gd_entype_t type) gd_nothrow
 
   _GD_ClearError(D);
 
-  n = gd_nfields_by_type(D, type);
+  P = _GD_FindField(D, parent, D->entry, D->n_entries, 1, NULL);
 
-  if (D->error) {
+  if (P == NULL || P->e->n_meta == -1) {
+    _GD_SetError(D, GD_E_BAD_CODE, P ? GD_E_CODE_INVALID : GD_E_CODE_MISSING,
+        NULL, 0, parent);
     dreturn("%p", NULL);
     return NULL;
   }
 
-  if (n == 0) {
-    dreturn("%p", zero_list);
-    return zero_list;
-  }
-
-  /* find the index -- get_nfields_by_type should have already tripped up
-   * if the type is invalid */
-  for (i = 0; i < GD_N_ENTYPES; ++i)
-    if (_gd_entype_index[i] == type) {
-      index = i;
-      break;
-    }
+  e = P->e;
 
-  if (index == -1) {
-    _GD_InternalError(D);
+  if ((n = gd_nmfields_by_type(D, parent, GD_CONST_ENTRY)) == 0) {
     dreturn("%p", NULL);
     return NULL;
   }
 
-  if (D->type_list_validity & (1 << index)) {
-    /* list already made */
-    dreturn("%p", D->type_list[index]);
-    return D->type_list[index];
-  }
-
-  fl = (char **)realloc((char **)D->type_list[index],
-      sizeof(const char*) * (n + 1));
+  fl = (char *)_GD_Alloc(D, return_type, n);
 
   if (fl == NULL) {
-    _GD_SetError(D, GD_E_ALLOC, 0, NULL, 0, NULL);
     dreturn("%p", NULL);
     return NULL;
   }
 
-  for (i = n = 0; i < D->n_entries; ++i) {
-    if (D->entry[i]->field_type == type && D->entry[i]->e->n_meta != -1)
-      fl[n++] = D->entry[i]->field;
+  /* DoField will implicitly choose GD_REPR_AUTO for complex data being returned
+   * as purely real */
+  for (i = n = 0; i < e->n_meta; ++i) {
+    if (_GD_ListEntry(e->p.meta_entry[i], 1, 0, 0, 0, GD_CONST_ENTRY))
+      if (_GD_DoField(D, e->p.meta_entry[i], 0, 0, 1, return_type,
+            fl + n++ * GD_SIZE(return_type)) != 1)
+        break;
   }
-  fl[n] = NULL;
 
-  D->type_list[index] = (const char **)fl;
-  D->type_list_validity |= 1 << index;
+  free(e->const_value_list);
+  e->const_value_list = fl;
 
-  dreturn("%p", D->type_list[index]);
-  return D->type_list[index];
+  dreturn("%p", e->const_value_list);
+  return e->const_value_list;
 }
 
-const char **gd_vector_list(DIRFILE* D) gd_nothrow
+const gd_carray_t *gd_mcarrays(DIRFILE* D, const char* parent,
+    gd_type_t return_type) gd_nothrow
 {
-  unsigned int i, n;
-  char **fl;
+  int i, n;
+  gd_carray_t *fl;
+  gd_entry_t *P;
+  struct gd_private_entry_ *e;
 
-  dtrace("%p", D);
+  dtrace("%p, \"%s\", 0x%x", D, parent, return_type);
 
   if (D->flags & GD_INVALID) {
     _GD_SetError(D, GD_E_BAD_DIRFILE, 0, NULL, 0, NULL);
@@ -265,47 +530,62 @@ const char **gd_vector_list(DIRFILE* D) gd_nothrow
 
   _GD_ClearError(D);
 
-  n = D->n_entries - D->n_meta - D->n_string - D->n_const - D->n_carray;
+  P = _GD_FindField(D, parent, D->entry, D->n_entries, 1, NULL);
 
-  if (n == 0) {
-    dreturn("%p", zero_list);
-    return zero_list;
+  if (P == NULL || P->e->n_meta == -1) {
+    _GD_SetError(D, GD_E_BAD_CODE, P ? GD_E_CODE_INVALID : GD_E_CODE_MISSING,
+        NULL, 0, parent);
+    dreturn("%p", NULL);
+    return NULL;
   }
 
-  if (D->list_validity & LIST_VALID_VECTOR) {
-    /* list already made */
-    dreturn("%p", D->vector_list);
-    return D->vector_list;
+  e = P->e;
+
+  if ((n = gd_nmfields_by_type(D, parent, GD_CARRAY_ENTRY)) == 0) {
+    dreturn("%p", zero_carrays);
+    return zero_carrays;
   }
 
-  fl = (char **)realloc((char **)D->vector_list, sizeof(const char*) * (n + 1));
+  fl = (gd_carray_t *)_GD_Malloc(D, sizeof(gd_carray_t) * (n + 1));
 
   if (fl == NULL) {
-    _GD_SetError(D, GD_E_ALLOC, 0, NULL, 0, NULL);
     dreturn("%p", NULL);
     return NULL;
   }
 
-  for (i = n = 0; i < D->n_entries; ++i) {
-    if (!(D->entry[i]->field_type & GD_SCALAR_ENTRY) &&
-        D->entry[i]->e->n_meta != -1)
-      fl[n++] = D->entry[i]->field;
+  /* DoField will implicitly choose GD_REPR_AUTO for complex data being returned
+   * as purely real */
+  for (i = n = 0; i < e->n_meta; ++i) {
+    if (_GD_ListEntry(e->p.meta_entry[i], 1, 0, 0, 0, GD_CARRAY_ENTRY)) {
+      fl[n].n = e->p.meta_entry[i]->EN(scalar,array_len);
+      fl[n].d = _GD_Alloc(D, return_type, fl[n].n);
+      if (D->error || _GD_DoField(D, e->p.meta_entry[i], 0, 0, fl[n].n,
+            return_type, fl[n].d) != 1)
+        break;
+      n++;
+    }
   }
-  fl[n] = NULL;
+  fl[n].n = 0;
 
-  D->vector_list = (const char **)fl;
-  D->list_validity |= LIST_VALID_VECTOR;
+  if (e->carray_value_list)
+    for (i = 0; e->carray_value_list[i].n != 0; ++i)
+      free(e->carray_value_list[i].d);
+  free(e->carray_value_list);
 
-  dreturn("%p", D->vector_list);
-  return D->vector_list;
+  e->carray_value_list = fl;
+
+  dreturn("%p", D->error ? NULL : fl);
+  return D->error ? NULL : fl;
 }
 
-const char **gd_field_list(DIRFILE* D) gd_nothrow
+const char **gd_mstrings(DIRFILE* D, const char* parent) gd_nothrow
 {
-  unsigned int i, n;
-  char **fl;
+  int i, n;
+  char** fl;
+  gd_entry_t *P;
+  struct gd_private_entry_ *e;
 
-  dtrace("%p", D);
+  dtrace("%p, \"%s\"", D, parent);
 
   if (D->flags & GD_INVALID) {
     _GD_SetError(D, GD_E_BAD_DIRFILE, 0, NULL, 0, NULL);
@@ -315,34 +595,68 @@ const char **gd_field_list(DIRFILE* D) gd_nothrow
 
   _GD_ClearError(D);
 
-  if (D->n_entries == 0) {
-    dreturn("%p", zero_list);
-    return zero_list;
+  P = _GD_FindField(D, parent, D->entry, D->n_entries, 1, NULL);
+
+  if (P == NULL || P->e->n_meta == -1) {
+    _GD_SetError(D, GD_E_BAD_CODE, P ? GD_E_CODE_INVALID : GD_E_CODE_MISSING,
+        NULL, 0, parent);
+    dreturn("%p", NULL);
+    return NULL;
   }
 
-  if (D->list_validity & LIST_VALID_FIELD) {
-    /* list already made */
-    dreturn("%p (old)", D->field_list);
-    return D->field_list;
+  e = P->e;
+
+  if ((n = gd_nmfields_by_type(D, parent, GD_STRING_ENTRY)) == 0) {
+    dreturn("%p", zero_list);
+    return zero_list;
   }
 
-  fl = (char **)realloc((char **)D->field_list, sizeof(const char*) *
-      (D->n_entries + 1 - D->n_meta));
+  fl = (char **)_GD_Realloc(D, (char **)e->string_value_list,
+      sizeof(const char*) * (n + 1));
 
   if (fl == NULL) {
-    _GD_SetError(D, GD_E_ALLOC, 0, NULL, 0, NULL);
     dreturn("%p", NULL);
     return NULL;
   }
 
-  for (i = n = 0; i < D->n_entries; ++i)
-    if (D->entry[i]->e->n_meta != -1)
-      fl[n++] = D->entry[i]->field;
+  for (i = n = 0; i < e->n_meta; ++i)
+    if (_GD_ListEntry(e->p.meta_entry[i], 1, 0, 0, 0, GD_STRING_ENTRY))
+      fl[n++] = e->p.meta_entry[i]->e->u.string;
   fl[n] = NULL;
 
-  D->field_list = (const char **)fl;
-  D->list_validity |= LIST_VALID_FIELD;
+  e->string_value_list = (const char **)fl;
+
+  dreturn("%p", e->string_value_list);
+  return e->string_value_list;
+}
+
+const char **gd_mfield_list_by_type(DIRFILE* D, const char* parent,
+    gd_entype_t type) gd_nothrow
+{
+  const char **el;
+  dtrace("%p, \"%s\", 0x%X", D, parent, type);
+
+  el = gd_entry_list(D, parent, type, 0);
+  dreturn("%p", el);
+  return el;
+}
+
+const char **gd_mvector_list(DIRFILE* D, const char* parent) gd_nothrow
+{
+  const char **el;
+  dtrace("%p, \"%s\"", D, parent);
+
+  el = gd_entry_list(D, parent, GD_VECTOR_ENTRIES, 0);
+  dreturn("%p", el);
+  return el;
+}
+
+const char **gd_mfield_list(DIRFILE* D, const char* parent) gd_nothrow
+{
+  const char **el;
+  dtrace("%p, \"%s\"", D, parent);
 
-  dreturn("%p", D->field_list);
-  return D->field_list;
+  el = gd_entry_list(D, parent, GD_ALL_ENTRIES, 0);
+  dreturn("%p", el);
+  return el;
 }
diff --git a/src/flimits.c b/src/flimits.c
index e30506c..38c7c9b 100644
--- a/src/flimits.c
+++ b/src/flimits.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2010 D. V. Wiebe
+/* Copyright (C) 2008-2012 D. V. Wiebe
  *
  ***************************************************************************
  *
@@ -20,12 +20,6 @@
  */
 #include "internal.h"
 
-#ifdef STDC_HEADERS
-#include <stdlib.h>
-#include <string.h>
-#include <errno.h>
-#endif
-
 static void _GD_ShiftFragment(DIRFILE* D, off64_t offset, int fragment,
     int move)
 {
@@ -42,11 +36,10 @@ static void _GD_ShiftFragment(DIRFILE* D, off64_t offset, int fragment,
   }
 
   if (move && offset != D->fragment[fragment].frame_offset) {
-    gd_entry_t **raw_entry = (gd_entry_t **)malloc(sizeof(gd_entry_t*) *
+    gd_entry_t **raw_entry = (gd_entry_t **)_GD_Malloc(D, sizeof(gd_entry_t*) *
         D->n_entries);
 
     if (raw_entry == NULL) {
-      _GD_SetError(D, GD_E_ALLOC, 0, NULL, 0, NULL);
       dreturnvoid();
       return;
     }
@@ -57,7 +50,8 @@ static void _GD_ShiftFragment(DIRFILE* D, off64_t offset, int fragment,
       if (D->entry[i]->fragment_index == fragment &&
           D->entry[i]->field_type == GD_RAW_ENTRY)
       {
-        if (!_GD_Supports(D, D->entry[i], GD_EF_TEMP))
+        /* determine encoding scheme */
+        if (!_GD_Supports(D, D->entry[i], 0))
           break;
 
         /* add this raw field to the list */
@@ -74,19 +68,12 @@ static void _GD_ShiftFragment(DIRFILE* D, off64_t offset, int fragment,
      * remove the temporary files */
     if (D->error) {
       for (i = 0; i < n_raw; ++i)
-        if ((*_gd_ef[raw_entry[i]->e->u.raw.file[0].encoding].temp)(
-              raw_entry[i]->e->u.raw.file, GD_TEMP_DESTROY))
-          _GD_SetError(D, GD_E_RAW_IO, 0, raw_entry[i]->e->u.raw.file[0].name,
-              errno, NULL);
+        _GD_FiniRawIO(D, raw_entry[i], fragment, GD_FINIRAW_DISCARD |
+            GD_FINIRAW_CLOTEMP);
     } else {
       for (i = 0; i < n_raw; ++i)
-        if ((*_gd_ef[raw_entry[i]->e->u.raw.file[0].encoding].temp)(
-              raw_entry[i]->e->u.raw.file, GD_TEMP_MOVE))
-        {
-          _GD_SetError(D, GD_E_UNCLEAN_DB, 0,
-              D->fragment[D->entry[i]->fragment_index].cname, 0, NULL);
-          D->flags |= GD_INVALID;
-        }
+        _GD_FiniRawIO(D, raw_entry[i], fragment, GD_FINIRAW_KEEP |
+            GD_FINIRAW_CLOTEMP);
     }
 
     free(raw_entry);
@@ -183,17 +170,17 @@ off_t gd_frameoffset(DIRFILE* D, int fragment) gd_nothrow
   return gd_frameoffset64(D, fragment);
 }
 
-static off64_t _GD_GetEOF(DIRFILE *D, gd_entry_t* E, const char *parent,
-    int *is_index)
+off64_t _GD_GetEOF(DIRFILE *restrict D, const gd_entry_t *restrict E,
+    const char *restrict parent, int *restrict is_index)
 {
   off64_t ns = -1, ns1;
-  gd_spf_t spf0, spf1;
+  unsigned int spf0, spf1;
   int i, is_index1;
 
   dtrace("%p, %p, \"%s\", %p", D, E, parent, is_index);
 
   if (++D->recurse_level >= GD_MAX_RECURSE_LEVEL) {
-    _GD_SetError(D, GD_E_RECURSE_LEVEL, 0, NULL, 0, E->field);
+    _GD_SetError(D, GD_E_RECURSE_LEVEL, GD_E_RECURSE_CODE, NULL, 0, E->field);
     D->recurse_level--;
     dreturn("%i ?", -1);
     return -1;
@@ -202,14 +189,19 @@ static off64_t _GD_GetEOF(DIRFILE *D, gd_entry_t* E, const char *parent,
   *is_index = 0;
   switch (E->field_type) {
     case GD_RAW_ENTRY:
-      if (!_GD_Supports(D, E, GD_EF_SIZE))
+      if (!_GD_Supports(D, E, GD_EF_NAME | GD_EF_SIZE))
         break;
 
-      if (_GD_SetEncodedName(D, E->e->u.raw.file, E->e->u.raw.filebase, 0))
+      if ((*gd_ef_[E->e->u.raw.file[0].subenc].name)(D,
+            (const char*)D->fragment[E->fragment_index].enc_data,
+            E->e->u.raw.file, E->e->u.raw.filebase, 0, 0))
+      {
         break;
+      }
 
-      ns = (*_gd_ef[E->e->u.raw.file[0].encoding].size)(E->e->u.raw.file,
-          E->EN(raw,data_type));
+      ns = (*gd_ef_[E->e->u.raw.file[0].subenc].size)(
+          D->fragment[E->fragment_index].dirfd, E->e->u.raw.file,
+          E->EN(raw,data_type), _GD_FileSwapBytes(D, E->fragment_index));
 
       if (ns < 0) {
         _GD_SetError(D, GD_E_RAW_IO, 0, E->e->u.raw.file[0].name, errno, NULL);
@@ -223,20 +215,17 @@ static off64_t _GD_GetEOF(DIRFILE *D, gd_entry_t* E, const char *parent,
     case GD_LINTERP_ENTRY:
     case GD_SBIT_ENTRY:
     case GD_POLYNOM_ENTRY:
-      if (_GD_BadInput(D, E, 0))
-        break;
-
-      ns = _GD_GetEOF(D, E->e->entry[0], E->field, is_index);
-      break;
     case GD_RECIP_ENTRY:
-      if (_GD_BadInput(D, E, 0))
+      if (_GD_BadInput(D, E, 0, 1))
         break;
 
       ns = _GD_GetEOF(D, E->e->entry[0], E->field, is_index);
       break;
     case GD_DIVIDE_ENTRY:
     case GD_MULTIPLY_ENTRY:
-      if (_GD_BadInput(D, E, 0) || _GD_BadInput(D, E, 1))
+    case GD_WINDOW_ENTRY:
+    case GD_MPLEX_ENTRY:
+      if (_GD_BadInput(D, E, 0, 1) || _GD_BadInput(D, E, 1, 1))
         break;
 
       ns = _GD_GetEOF(D, E->e->entry[0], E->field, is_index);
@@ -274,7 +263,7 @@ static off64_t _GD_GetEOF(DIRFILE *D, gd_entry_t* E, const char *parent,
       }
       break;
     case GD_LINCOM_ENTRY:
-      if (_GD_BadInput(D, E, 0))
+      if (_GD_BadInput(D, E, 0, 1))
         break;
 
       ns = _GD_GetEOF(D, E->e->entry[0], E->field, is_index);
@@ -295,7 +284,7 @@ static off64_t _GD_GetEOF(DIRFILE *D, gd_entry_t* E, const char *parent,
       }
 
       for (i = 1; i < E->EN(lincom,n_fields); ++i) {
-        if (_GD_BadInput(D, E, i)) {
+        if (_GD_BadInput(D, E, i, 1)) {
           ns = -1;
           break;
         }
@@ -324,7 +313,7 @@ static off64_t _GD_GetEOF(DIRFILE *D, gd_entry_t* E, const char *parent,
       }
       break;
     case GD_PHASE_ENTRY:
-      if (_GD_BadInput(D, E, 0))
+      if (_GD_BadInput(D, E, 0, 1))
         break;
 
       ns = _GD_GetEOF(D, E->e->entry[0], E->field, is_index);
@@ -350,6 +339,9 @@ static off64_t _GD_GetEOF(DIRFILE *D, gd_entry_t* E, const char *parent,
     case GD_NO_ENTRY:
       _GD_SetError(D, GD_E_BAD_FIELD_TYPE, GD_E_FIELD_BAD, NULL, 0, E->field);
       break;
+    case GD_ALIAS_ENTRY:
+      _GD_InternalError(D);
+      break;
   }
 
   D->recurse_level--;
@@ -375,7 +367,8 @@ off64_t gd_eof64(DIRFILE* D, const char *field_code_in)
     return -1;
   }
 
-  entry = _GD_FindFieldAndRepr(D, field_code_in, &field_code, &repr, NULL, 1);
+  entry = _GD_FindFieldAndRepr(D, field_code_in, &field_code, &repr, NULL, 1,
+      1);
 
   if (D->error) {
     dreturn("%i", -1);
@@ -400,18 +393,19 @@ off_t gd_eof(DIRFILE* D, const char *field_code)
   return (off_t)gd_eof64(D, field_code);
 }
 
-static off64_t _GD_GetBOF(DIRFILE *D, gd_entry_t* E, const char *parent,
-    gd_spf_t *spf, long long *ds)
+static off64_t _GD_GetBOF(DIRFILE *restrict D, const gd_entry_t *restrict E,
+    const char *restrict parent, unsigned int *restrict spf,
+    long long *restrict ds)
 {
   off64_t bof = -1, bof1;
-  gd_spf_t spf1;
+  unsigned int spf1;
   long long ds1;
   int i;
 
   dtrace("%p, %p, \"%s\", %p, %p", D, E, parent, spf, ds);
 
   if (++D->recurse_level >= GD_MAX_RECURSE_LEVEL) {
-    _GD_SetError(D, GD_E_RECURSE_LEVEL, 0, NULL, 0, E->field);
+    _GD_SetError(D, GD_E_RECURSE_LEVEL, GD_E_RECURSE_CODE, NULL, 0, E->field);
     D->recurse_level--;
     dreturn("%i", -1);
     return -1;
@@ -427,13 +421,14 @@ static off64_t _GD_GetBOF(DIRFILE *D, gd_entry_t* E, const char *parent,
     case GD_SBIT_ENTRY:
     case GD_LINTERP_ENTRY:
     case GD_POLYNOM_ENTRY:
-      if (_GD_BadInput(D, E, 0))
+    case GD_RECIP_ENTRY:
+      if (_GD_BadInput(D, E, 0, 1))
         break;
 
       bof = _GD_GetBOF(D, E->e->entry[0], E->field, spf, ds);
       break;
     case GD_PHASE_ENTRY:
-      if (_GD_BadInput(D, E, 0))
+      if (_GD_BadInput(D, E, 0, 1))
         break;
 
       bof = _GD_GetBOF(D, E->e->entry[0], E->field, spf, ds);
@@ -457,15 +452,11 @@ static off64_t _GD_GetBOF(DIRFILE *D, gd_entry_t* E, const char *parent,
       }
 
       break;
-    case GD_RECIP_ENTRY:
-      if (_GD_BadInput(D, E, 0))
-        break;
-
-      bof = _GD_GetBOF(D, E->e->entry[0], E->field, spf, ds);
-      break;
     case GD_MULTIPLY_ENTRY:
     case GD_DIVIDE_ENTRY:
-      if (_GD_BadInput(D, E, 0) || _GD_BadInput(D, E, 1))
+    case GD_WINDOW_ENTRY:
+    case GD_MPLEX_ENTRY:
+      if (_GD_BadInput(D, E, 0, 1) || _GD_BadInput(D, E, 1, 1))
         break;
 
       bof = _GD_GetBOF(D, E->e->entry[0], E->field, spf, ds);
@@ -490,7 +481,7 @@ static off64_t _GD_GetBOF(DIRFILE *D, gd_entry_t* E, const char *parent,
       }
       break;
     case GD_LINCOM_ENTRY:
-      if (_GD_BadInput(D, E, 0))
+      if (_GD_BadInput(D, E, 0, 1))
         break;
 
       bof = _GD_GetBOF(D, E->e->entry[0], E->field, spf, ds);
@@ -501,7 +492,7 @@ static off64_t _GD_GetBOF(DIRFILE *D, gd_entry_t* E, const char *parent,
       }
 
       for (i = 1; i < E->EN(lincom,n_fields); ++i) {
-        if (_GD_BadInput(D, E, i)) {
+        if (_GD_BadInput(D, E, i, 1)) {
           bof = -1;
           break;
         }
@@ -535,7 +526,8 @@ static off64_t _GD_GetBOF(DIRFILE *D, gd_entry_t* E, const char *parent,
         _GD_SetError(D, GD_E_DIMENSION, GD_E_DIM_CALLER, NULL, 0, E->field);
       break;
     case GD_NO_ENTRY:
-      _GD_SetError(D, GD_E_BAD_FIELD_TYPE, GD_E_FIELD_BAD, NULL, 0, E->field);
+    case GD_ALIAS_ENTRY:
+      _GD_InternalError(D);
       break;
   }
 
@@ -551,7 +543,7 @@ off64_t gd_bof64(DIRFILE* D, const char *field_code_in) gd_nothrow
   gd_entry_t *entry;
   int repr;
   char *field_code;
-  gd_spf_t spf;
+  unsigned int spf;
   long long ds;
 
   dtrace("%p, \"%s\"", D, field_code_in);
@@ -564,7 +556,8 @@ off64_t gd_bof64(DIRFILE* D, const char *field_code_in) gd_nothrow
     return -1;
   }
 
-  entry = _GD_FindFieldAndRepr(D, field_code_in, &field_code, &repr, NULL, 1);
+  entry = _GD_FindFieldAndRepr(D, field_code_in, &field_code, &repr, NULL, 1,
+      1);
 
   if (D->error) {
     dreturn("%i", -1);
@@ -590,4 +583,3 @@ off_t gd_bof(DIRFILE* D, const char *field_code) gd_nothrow
 }
 /* vim: ts=2 sw=2 et tw=80
 */
-
diff --git a/src/flush.c b/src/flush.c
index af55b08..a1b47e9 100644
--- a/src/flush.c
+++ b/src/flush.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2010 D. V. Wiebe
+/* Copyright (C) 2008-2012 D. V. Wiebe
  *
  ***************************************************************************
  *
@@ -20,26 +20,16 @@
  */
 #include "internal.h"
 
-#ifdef STDC_HEADERS
-#include <stdlib.h>
-#include <string.h>
-#include <errno.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <time.h>
-#include <limits.h>
-#endif
-
 #define GD_MAX_PRETTY_FIELD_WIDTH 80
 
-void _GD_Flush(DIRFILE* D, gd_entry_t *E)
+void _GD_Flush(DIRFILE *D, gd_entry_t *E, int syn, int clo)
 {
   int i;
 
-  dtrace("%p, %p", D, E);
+  dtrace("%p, %p, %i, %i", D, E, syn, clo);
 
   if (++D->recurse_level >= GD_MAX_RECURSE_LEVEL) {
-    _GD_SetError(D, GD_E_RECURSE_LEVEL, 0, NULL, 0, E->field);
+    _GD_SetError(D, GD_E_RECURSE_LEVEL, GD_E_RECURSE_CODE, NULL, 0, E->field);
     D->recurse_level--;
     dreturnvoid();
     return;
@@ -47,14 +37,19 @@ void _GD_Flush(DIRFILE* D, gd_entry_t *E)
 
   switch(E->field_type) {
     case GD_RAW_ENTRY:
-      if (E->e->u.raw.file[0].fp >= 0) {
-        if ((D->flags & GD_ACCMODE) == GD_RDWR &&
-            _gd_ef[E->e->u.raw.file[0].encoding].sync != NULL &&
-            (*_gd_ef[E->e->u.raw.file[0].encoding].sync)(E->e->u.raw.file))
+      if (E->e->u.raw.file[0].idata >= 0 ||
+          ((gd_ef_[E->e->u.raw.file[0].subenc].flags & GD_EF_OOP) &&
+           (E->e->u.raw.file[1].idata >= 0)))
+      {
+        if (syn && (D->flags & GD_ACCMODE) == GD_RDWR &&
+            (E->e->u.raw.file[0].mode & GD_FILE_WRITE) &&
+            gd_ef_[E->e->u.raw.file[0].subenc].sync != NULL &&
+            (*gd_ef_[E->e->u.raw.file[0].subenc].sync)(E->e->u.raw.file))
+        {
           _GD_SetError(D, GD_E_RAW_IO, 0, E->e->u.raw.file[0].name, errno,
               NULL);
-        else if ((*_gd_ef[E->e->u.raw.file[0].encoding].close)(
-              E->e->u.raw.file))
+        } else if (clo && _GD_FiniRawIO(D, E, E->fragment_index,
+              GD_FINIRAW_KEEP))
         {
           _GD_SetError(D, GD_E_RAW_IO, 0, E->e->u.raw.file[0].name, errno,
               NULL);
@@ -63,11 +58,13 @@ void _GD_Flush(DIRFILE* D, gd_entry_t *E)
       break;
     case GD_LINCOM_ENTRY:
       for (i = 2; i < E->EN(lincom,n_fields); ++i)
-        _GD_Flush(D, E->e->entry[i]);
+        _GD_Flush(D, E->e->entry[i], syn, clo);
       /* fallthrough */
     case GD_MULTIPLY_ENTRY:
     case GD_DIVIDE_ENTRY:
-      _GD_Flush(D, E->e->entry[1]);
+    case GD_WINDOW_ENTRY:
+    case GD_MPLEX_ENTRY:
+      _GD_Flush(D, E->e->entry[1], syn, clo);
       /* fallthrough */
     case GD_LINTERP_ENTRY:
     case GD_BIT_ENTRY:
@@ -75,12 +72,13 @@ void _GD_Flush(DIRFILE* D, gd_entry_t *E)
     case GD_POLYNOM_ENTRY:
     case GD_SBIT_ENTRY:
     case GD_RECIP_ENTRY:
-      _GD_Flush(D, E->e->entry[0]);
+      _GD_Flush(D, E->e->entry[0], syn, clo);
     case GD_CONST_ENTRY:
     case GD_CARRAY_ENTRY:
     case GD_STRING_ENTRY:
     case GD_INDEX_ENTRY:
     case GD_NO_ENTRY:
+    case GD_ALIAS_ENTRY:
       break;
   }
 
@@ -92,7 +90,7 @@ static const char* _GD_TypeName(DIRFILE* D, gd_type_t data_type)
 {
   const char* ptr;
 
-  dtrace("%p, 0x%x", D, data_type);
+  dtrace("%p, 0x%X", D, data_type);
 
   switch(data_type) {
     case GD_UINT8:
@@ -145,7 +143,7 @@ static const char* _GD_OldTypeName(DIRFILE* D, gd_type_t data_type)
 {
   const char* ptr;
 
-  dtrace("%p, 0x%x", D, data_type);
+  dtrace("%p, 0x%X", D, data_type);
 
   switch(data_type) {
     case GD_UINT8:
@@ -179,17 +177,64 @@ static const char* _GD_OldTypeName(DIRFILE* D, gd_type_t data_type)
   return ptr;
 }
 
-static size_t _GD_StringEscapeise(FILE* stream, const char* in, int permissive,
-    int standards)
+static const char *_GD_WindopName(DIRFILE *D, gd_windop_t op)
+{
+  const char *ptr;
+
+  dtrace("%p, %i", D, op);
+
+  switch(op) {
+    case GD_WINDOP_EQ:
+      ptr = "EQ";
+      break;
+    case GD_WINDOP_GE:
+      ptr = "GE";
+      break;
+    case GD_WINDOP_GT:
+      ptr = "GT";
+      break;
+    case GD_WINDOP_LE:
+      ptr = "LE";
+      break;
+    case GD_WINDOP_LT:
+      ptr = "LT";
+      break;
+    case GD_WINDOP_NE:
+      ptr = "NE";
+      break;
+    case GD_WINDOP_SET:
+      ptr = "SET";
+      break;
+    case GD_WINDOP_CLR:
+      ptr = "CLR";
+      break;
+    default:
+      _GD_InternalError(D);
+      ptr = "";
+      break;
+  }
+
+  dreturn("\"%s\"", ptr);
+  return ptr;
+}
+
+static size_t _GD_StringEscapeise(FILE *stream, const char *in, int meta,
+    int permissive, int standards)
 {
   const char* HexDigit = "0123456789ABCDEF";
   size_t len = 0;
 
   dtrace("%p, \"%s\", %i, %i", stream, in, permissive, standards);
 
+  if (in == NULL || in[0] == '\0') {
+    fputs("\"\"", stream);
+    dreturn("%i", 2);
+    return 2;
+  }
+
   if (!permissive && standards < 6) {
     fputs(in, stream);
-    dreturn("%zu", strlen(in));
+    dreturn("%" PRNsize_t, strlen(in));
     return strlen(in);
   }
 
@@ -198,7 +243,7 @@ static size_t _GD_StringEscapeise(FILE* stream, const char* in, int permissive,
       fputs("\\\"", stream);
       len += 2;
       fputc('\\', stream);
-    } else if (*in == '\\' || *in == '#' || *in == '"') {
+    } else if (*in == '\\' || *in == '#' || *in == '"' || *in == ' ') {
       fputc('\\', stream);
       fputc(*in, stream);
       len += 2;
@@ -211,45 +256,84 @@ static size_t _GD_StringEscapeise(FILE* stream, const char* in, int permissive,
       fputc(HexDigit[*in >> 8], stream);
       fputc(HexDigit[*in & 0xF], stream);
       len += 4;
-    } else {
+    } else if (meta && *in == '/')
+      break;
+    else {
       fputc(*in, stream);
       len++;
     }
   }
 
-  dreturn("%zu", len);
+  dreturn("%" PRNsize_t, len);
   return len;
 }
 
-static void _GD_PadField(FILE* stream, const char* in, size_t len,
-    int permissive, int standards)
+/* write a field code, taking care of stripping off affixes; returns the length
+ * written */
+static size_t _GD_WriteFieldCode(DIRFILE *D, FILE *stream, int me,
+    const char *code, int permissive, int standards)
+{
+  int dummy;
+  size_t len;
+  char *ptr;
+
+  dtrace("%p, %p, %i, \"%s\", %i, %i", D, stream, me, code, permissive,
+      standards);
+
+  ptr = _GD_MungeCode(D, NULL, D->fragment[me].prefix, D->fragment[me].suffix,
+      NULL, NULL, code, &dummy, 0);
+
+  len = _GD_StringEscapeise(stream, ptr, 0, permissive, standards);
+
+  free(ptr);
+
+  dreturn("%" PRNsize_t, len);
+  return len;
+}
+
+/* write a field, padding to the specified length */
+static void _GD_PadField(DIRFILE *D, FILE *stream, int me, const char *in,
+    size_t len, int permissive, int standards)
 {
   size_t i;
 
-  dtrace("%p, \"%s\", %zu, %i, %i", stream, in, len, permissive, standards);
+  dtrace("%p, %p, %i, \"%s\", %" PRNsize_t ", %i, %i", D, stream, me, in, len,
+      permissive, standards);
 
-  for (i = _GD_StringEscapeise(stream, in, permissive, standards); i < len; ++i)
+  for (i = _GD_WriteFieldCode(D, stream, me, in, permissive, standards);
+      i < len; ++i)
+  {
     fputc(' ', stream);
+  }
 
   dreturnvoid();
 }
 
 /* Write a litteral parameter or CONST name or CARRAY element */
-static void _GD_WriteConst(DIRFILE *D, FILE* stream, int type,
-    const void* value, const char* scalar, int index, const char* postamble)
+static void _GD_WriteConst(DIRFILE *D, FILE* stream, int me, int permissive,
+    int type, const void* value, const char* scalar, int index,
+    const char* postamble)
 {
-  dtrace("%p, %p, %i, %p, \"%s\", %i, \"%s\"", D, stream, type, value, scalar,
-      index, postamble);
+  dtrace("%p, %p, %i, %i, 0x%X, %p, \"%s\", %i, \"%s\"", D, stream, me,
+      permissive, type, value, scalar, index, postamble);
 
   if (scalar != NULL) {
+    _GD_WriteFieldCode(D, stream, me, scalar, permissive, D->standards);
     if (index == -1)
-      fprintf(stream, "%s%s", scalar, postamble);
+      fprintf(stream, "%s", postamble);
     else
-      fprintf(stream, "%s<%i>%s", scalar, index, postamble);
-  } else if (type == GD_UINT16)
-    fprintf(stream, "%" PRIu16 "%s", *(uint16_t *)value, postamble);
+      fprintf(stream, "<%i>%s", index, postamble);
+  }
+  else if (type == GD_UINT64)
+    fprintf(stream, "%" PRIu64 "%s", *(uint64_t *)value, postamble);
   else if (type == GD_INT64)
-    fprintf(stream, "%" PRIi64 "%s", *(uint64_t *)value, postamble);
+    fprintf(stream, "%" PRIi64 "%s", *(int64_t *)value, postamble);
+  else if (type == GD_UINT32)
+    fprintf(stream, "%" PRIu32 "%s", *(uint32_t *)value, postamble);
+  else if (type == GD_INT32)
+    fprintf(stream, "%" PRIi32 "%s", *(int32_t *)value, postamble);
+  else if (type == GD_UINT16)
+    fprintf(stream, "%" PRIu16 "%s", *(uint16_t *)value, postamble);
   else if (type == GD_INT16)
     fprintf(stream, "%" PRIi16 "%s", *(int16_t *)value, postamble);
   else if (type == GD_FLOAT64)
@@ -265,14 +349,14 @@ static void _GD_WriteConst(DIRFILE *D, FILE* stream, int type,
 
 /* Write a field specification line */
 static void _GD_FieldSpec(DIRFILE* D, FILE* stream, const gd_entry_t* E,
-    int meta, size_t max_len, int pretty, int permissive)
+    int me, int meta, size_t max_len, int pretty, int permissive)
 {
   int i;
   size_t z;
   char *ptr;
 
-  dtrace("%p, %p, %p, %i, %zi, %i, %i", D, stream, E, meta, max_len, pretty,
-      permissive);
+  dtrace("%p, %p, %p, %i, %i, %" PRNsize_t ", %i, %i", D, stream, E, me, meta,
+      max_len, pretty, permissive);
 
   /* INDEX is implicit, and it is an error to define it in the format file */
   if (E->field_type == GD_INDEX_ENTRY) {
@@ -280,137 +364,232 @@ static void _GD_FieldSpec(DIRFILE* D, FILE* stream, const gd_entry_t* E,
     return;
   }
 
-  ptr = E->field;
-
-  /* From Standards Version 8 and on, just use Barth-style */
-  if (meta && D->standards < 8) {
-    fputs("META ", stream);
-    for (; *ptr != '/'; ++ptr)
-      fputc(*ptr, stream);
+  /* aliases */
+  if (E->field_type == GD_ALIAS_ENTRY) {
+    fputs("/ALIAS ", stream);
+    _GD_WriteFieldCode(D, stream, me, E->field, permissive, D->standards);
     fputc(' ', stream);
-    ++ptr;
-  }
+    _GD_WriteFieldCode(D, stream, me, E->in_fields[0], permissive,
+        D->standards);
+    fputc('\n', stream);
+  } else {
+    ptr = E->field;
+
+    /* From Standards Version 7 and on, just use Barth-style */
+    if (meta && D->standards < 7) {
+      fputs("META ", stream);
+      _GD_StringEscapeise(stream, ptr, 1, permissive, D->standards);
+      fputc(' ', stream);
+      ptr = strchr(E->field, '/') + 1;
+    }
 
-  /* field name */
-  _GD_PadField(stream, ptr, max_len, permissive, D->standards);
+    /* field name */
+    _GD_PadField(D, stream, me, ptr, max_len, permissive, D->standards);
 
-  switch(E->field_type) {
-    case GD_RAW_ENTRY:
-      fprintf(stream, " RAW%s %s ", pretty ? "     " : "",
-          (permissive || D->standards >= 5) ?  _GD_TypeName(D,
-            E->EN(raw,data_type)) : _GD_OldTypeName(D, E->EN(raw,data_type)));
-      _GD_WriteConst(D, stream, GD_UINT16, &E->EN(raw,spf), E->scalar[0],
-          E->scalar_ind[0], "\n");
-      break;
-    case GD_LINCOM_ENTRY:
-      fprintf(stream, " LINCOM%s %i", pretty ? "  " : "",
-          E->EN(lincom,n_fields));
-      for (i = 0; i < E->EN(lincom,n_fields); ++i) {
-        fprintf(stream, " %s ", E->in_fields[i]);
-        if (E->comp_scal) {
-          _GD_WriteConst(D, stream, GD_COMPLEX128, &E->EN(lincom,cm)[i],
-              E->scalar[i], E->scalar_ind[i], " ");
-          _GD_WriteConst(D, stream, GD_COMPLEX128, &E->EN(lincom,cb)[i],
-              E->scalar[i + GD_MAX_LINCOM], E->scalar_ind[i + GD_MAX_LINCOM],
-              "");
-        } else {
-          _GD_WriteConst(D, stream, GD_FLOAT64, &E->EN(lincom,m)[i],
-              E->scalar[i], E->scalar_ind[i], " ");
-          _GD_WriteConst(D, stream, GD_FLOAT64, &E->EN(lincom,b)[i],
-              E->scalar[i + GD_MAX_LINCOM], E->scalar_ind[i + GD_MAX_LINCOM],
-              "");
+    switch(E->field_type) {
+      case GD_RAW_ENTRY:
+        fprintf(stream, " RAW%s %s ", pretty ? "     " : "",
+            (permissive || D->standards >= 5) ?  _GD_TypeName(D,
+              E->EN(raw,data_type)) : _GD_OldTypeName(D, E->EN(raw,data_type)));
+        _GD_WriteConst(D, stream, me, permissive, GD_UINT_TYPE, &E->EN(raw,spf),
+            E->scalar[0], E->scalar_ind[0], "\n");
+        break;
+      case GD_LINCOM_ENTRY:
+        fprintf(stream, " LINCOM%s %i", pretty ? "  " : "",
+            E->EN(lincom,n_fields));
+        for (i = 0; i < E->EN(lincom,n_fields); ++i) {
+          fputc(' ', stream);
+          _GD_WriteFieldCode(D, stream, me, E->in_fields[i], permissive,
+              D->standards);
+          fputc(' ', stream);
+          if (E->comp_scal) {
+            _GD_WriteConst(D, stream, me, permissive, GD_COMPLEX128,
+                &E->EN(lincom,cm)[i], E->scalar[i], E->scalar_ind[i], " ");
+            _GD_WriteConst(D, stream, me, permissive, GD_COMPLEX128,
+                &E->EN(lincom,cb)[i], E->scalar[i + GD_MAX_LINCOM],
+                E->scalar_ind[i + GD_MAX_LINCOM], "");
+          } else {
+            _GD_WriteConst(D, stream, me, permissive, GD_FLOAT64,
+                &E->EN(lincom,m)[i], E->scalar[i], E->scalar_ind[i], " ");
+            _GD_WriteConst(D, stream, me, permissive, GD_FLOAT64,
+                &E->EN(lincom,b)[i], E->scalar[i + GD_MAX_LINCOM],
+                E->scalar_ind[i + GD_MAX_LINCOM], "");
+          }
         }
-      }
-      fputs("\n", stream);
-      break;
-    case GD_LINTERP_ENTRY:
-      fprintf(stream, " LINTERP%s %s %s\n", pretty ? " " : "", E->in_fields[0],
-          E->EN(linterp,table));
-      break;
-    case GD_BIT_ENTRY:
-      fprintf(stream, " BIT%s %s ", pretty ? "     " : "", E->in_fields[0]);
-      _GD_WriteConst(D, stream, GD_INT16, &E->EN(bit,bitnum), E->scalar[0],
-          E->scalar_ind[0], " ");
-      _GD_WriteConst(D, stream, GD_INT16, &E->EN(bit,numbits), E->scalar[1],
-          E->scalar_ind[1], "\n");
-      break;
-    case GD_DIVIDE_ENTRY:
-      fprintf(stream, " DIVIDE%s %s %s", pretty ? "  " : "", E->in_fields[1],
-          E->in_fields[0]);
-      break;
-    case GD_RECIP_ENTRY:
-      fprintf(stream, " RECIP%s ", pretty ? "   " : "");
-      _GD_WriteConst(D, stream, GD_COMPLEX128, &E->EN(recip,cdividend),
-          E->scalar[0], E->scalar_ind[0], "");
-      fprintf(stream, " %s", E->in_fields[0]);
-      break;
-    case GD_MULTIPLY_ENTRY:
-      fprintf(stream, " MULTIPLY %s %s\n", E->in_fields[0], E->in_fields[1]);
-      break;
-    case GD_PHASE_ENTRY:
-      fprintf(stream, " PHASE%s %s ", pretty ? "   " : "", E->in_fields[0]);
-      _GD_WriteConst(D, stream, GD_INT64, &E->EN(phase,shift), E->scalar[0],
-          E->scalar_ind[0], "\n");
-      break;
-    case GD_POLYNOM_ENTRY:
-      fprintf(stream, " POLYNOM%s %s ", pretty ? " " : "", E->in_fields[0]);
-      for (i = 0; i <= E->EN(polynom,poly_ord); ++i)
-        if (E->comp_scal)
-          _GD_WriteConst(D, stream, GD_COMPLEX128, &E->EN(polynom,ca)[i],
-              E->scalar[i], E->scalar_ind[i], (i == E->EN(polynom,poly_ord)) ?
-              "\n" : " ");
+        fputc('\n', stream);
+        break;
+      case GD_LINTERP_ENTRY:
+        fprintf(stream, " LINTERP%s ", pretty ? " " : "");
+        _GD_WriteFieldCode(D, stream, me, E->in_fields[0], permissive,
+            D->standards);
+        fputc(' ', stream);
+        _GD_StringEscapeise(stream, E->EN(linterp,table), 0, permissive,
+            D->standards);
+        fputc('\n', stream);
+        break;
+      case GD_BIT_ENTRY:
+        fprintf(stream, " BIT%s ", pretty ? "     " : "");
+        _GD_WriteFieldCode(D, stream, me, E->in_fields[0], permissive,
+            D->standards);
+        fputc(' ', stream);
+        _GD_WriteConst(D, stream, me, permissive, GD_INT_TYPE,
+            &E->EN(bit,bitnum), E->scalar[0], E->scalar_ind[0], " ");
+        _GD_WriteConst(D, stream, me, permissive, GD_INT_TYPE,
+            &E->EN(bit,numbits), E->scalar[1], E->scalar_ind[1], "\n");
+        break;
+      case GD_DIVIDE_ENTRY:
+        fprintf(stream, " DIVIDE%s ", pretty ? "  " : "");
+        _GD_WriteFieldCode(D, stream, me, E->in_fields[0], permissive,
+            D->standards);
+        fputc(' ', stream);
+        _GD_WriteFieldCode(D, stream, me, E->in_fields[1], permissive,
+            D->standards);
+        fputc('\n', stream);
+        break;
+      case GD_RECIP_ENTRY:
+        fprintf(stream, " RECIP%s ", pretty ? "   " : "");
+        _GD_WriteFieldCode(D, stream, me, E->in_fields[0], permissive,
+            D->standards);
+        fputc(' ', stream);
+        _GD_WriteConst(D, stream, me, permissive, GD_COMPLEX128,
+            &E->EN(recip,cdividend), E->scalar[0], E->scalar_ind[0], "\n");
+        break;
+      case GD_MULTIPLY_ENTRY:
+        fputs(" MULTIPLY ", stream);
+        _GD_WriteFieldCode(D, stream, me, E->in_fields[0], permissive,
+            D->standards);
+        fputc(' ', stream);
+        _GD_WriteFieldCode(D, stream, me, E->in_fields[1], permissive,
+            D->standards);
+        fputc('\n', stream);
+        break;
+      case GD_PHASE_ENTRY:
+        fprintf(stream, " PHASE%s ", pretty ? "   " : "");
+        _GD_WriteFieldCode(D, stream, me, E->in_fields[0], permissive,
+            D->standards);
+        fputc(' ', stream);
+        _GD_WriteConst(D, stream, me, permissive, GD_INT64, &E->EN(phase,shift),
+            E->scalar[0], E->scalar_ind[0], "\n");
+        break;
+      case GD_POLYNOM_ENTRY:
+        fprintf(stream, " POLYNOM%s ", pretty ? " " : "");
+        _GD_WriteFieldCode(D, stream, me, E->in_fields[0], permissive,
+            D->standards);
+        fputc(' ', stream);
+        for (i = 0; i <= E->EN(polynom,poly_ord); ++i)
+          if (E->comp_scal)
+            _GD_WriteConst(D, stream, me, permissive, GD_COMPLEX128,
+                &E->EN(polynom,ca)[i], E->scalar[i], E->scalar_ind[i],
+                (i == E->EN(polynom,poly_ord)) ?  "\n" : " ");
+          else
+            _GD_WriteConst(D, stream, me, permissive, GD_FLOAT64,
+                &E->EN(polynom,a)[i], E->scalar[i], E->scalar_ind[i],
+                (i == E->EN(polynom,poly_ord)) ?  "\n" : " ");
+        break;
+      case GD_SBIT_ENTRY:
+        fprintf(stream, " SBIT%s ", pretty ? "    " : "");
+        _GD_WriteFieldCode(D, stream, me, E->in_fields[0], permissive,
+            D->standards);
+        fputc(' ', stream);
+        _GD_WriteConst(D, stream, me, permissive, GD_INT_TYPE, &E->EN(bit,bitnum),
+            E->scalar[0], E->scalar_ind[0], " ");
+        _GD_WriteConst(D, stream, me, permissive, GD_INT_TYPE,
+            &E->EN(bit,numbits), E->scalar[1], E->scalar_ind[1], "\n");
+        break;
+      case GD_WINDOW_ENTRY:
+        fprintf(stream, " WINDOW%s ", pretty ? "  " : "");
+        _GD_WriteFieldCode(D, stream, me, E->in_fields[0], permissive,
+            D->standards);
+        fputc(' ', stream);
+        _GD_WriteFieldCode(D, stream, me, E->in_fields[1], permissive,
+            D->standards);
+        fprintf(stream, " %s ", _GD_WindopName(D, E->EN(window,windop)));
+        switch (E->EN(window,windop)) {
+          case GD_WINDOP_EQ:
+          case GD_WINDOP_NE:
+            _GD_WriteConst(D, stream, me, permissive, GD_INT64,
+                &E->EN(window,threshold.i), E->scalar[0], E->scalar_ind[0],
+                "\n");
+            break;
+          case GD_WINDOP_SET:
+          case GD_WINDOP_CLR:
+            _GD_WriteConst(D, stream, me, permissive, GD_UINT64,
+                &E->EN(window,threshold.u), E->scalar[0], E->scalar_ind[0],
+                "\n");
+            break;
+          default:
+            _GD_WriteConst(D, stream, me, permissive, GD_FLOAT64,
+                &E->EN(window,threshold.r), E->scalar[0], E->scalar_ind[0],
+                "\n");
+            break;
+        }
+        break;
+      case GD_MPLEX_ENTRY:
+        fprintf(stream, " MPLEX%s ", pretty ? "   " : "");
+        _GD_WriteFieldCode(D, stream, me, E->in_fields[0], permissive,
+            D->standards);
+        fputc(' ', stream);
+        _GD_WriteFieldCode(D, stream, me, E->in_fields[1], permissive,
+            D->standards);
+        fputc(' ', stream);
+        _GD_WriteConst(D, stream, me, permissive, GD_INT_TYPE,
+            &E->EN(mplex,count_val), E->scalar[0], E->scalar_ind[0], "");
+        if (E->EN(mplex,period) > 0 || E->scalar[1]) {
+          fputc(' ', stream);
+          _GD_WriteConst(D, stream, me, permissive, GD_INT_TYPE,
+              &E->EN(mplex,period), E->scalar[1], E->scalar_ind[1], "\n");
+        } else
+          fputc('\n', stream);
+        break;
+      case GD_CONST_ENTRY:
+        fprintf(stream, " CONST%s %s ", pretty ? "   " : "", _GD_TypeName(D,
+              E->EN(scalar,const_type)));
+        if (E->EN(scalar,const_type) & GD_SIGNED)
+          fprintf(stream, "%" PRIi64 "\n", *(int64_t*)E->e->u.scalar.d);
+        else if (E->EN(scalar,const_type) & GD_IEEE754)
+          fprintf(stream, "%.15g\n", *(double*)E->e->u.scalar.d);
+        else if (E->EN(scalar,const_type) & GD_COMPLEX)
+          fprintf(stream, "%.15g;%.15g\n", *(double*)E->e->u.scalar.d,
+              *((double*)E->e->u.scalar.d + 1));
         else
-          _GD_WriteConst(D, stream, GD_FLOAT64, &E->EN(polynom,a)[i],
-              E->scalar[i], E->scalar_ind[i], (i == E->EN(polynom,poly_ord)) ?
-              "\n" : " ");
-      break;
-    case GD_SBIT_ENTRY:
-      fprintf(stream, " SBIT%s %s ", pretty ? "    " : "", E->in_fields[0]);
-      _GD_WriteConst(D, stream, GD_INT16, &E->EN(bit,bitnum), E->scalar[0],
-          E->scalar_ind[0], " ");
-      _GD_WriteConst(D, stream, GD_INT16, &E->EN(bit,numbits), E->scalar[1],
-          E->scalar_ind[1], "\n");
-      break;
-    case GD_CONST_ENTRY:
-      fprintf(stream, " CONST%s %s ", pretty ? "   " : "", _GD_TypeName(D,
-            E->EN(scalar,const_type)));
-      if (E->EN(scalar,const_type) & GD_SIGNED)
-        fprintf(stream, "%" PRIi64 "\n", *(int64_t*)E->e->u.scalar.d);
-      else if (E->EN(scalar,const_type) & GD_IEEE754)
-        fprintf(stream, "%.15g\n", *(double*)E->e->u.scalar.d);
-      else if (E->EN(scalar,const_type) & GD_COMPLEX)
-        fprintf(stream, "%.15g;%.15g\n", *(double*)E->e->u.scalar.d,
-            *((double*)E->e->u.scalar.d + 1));
-      else
-        fprintf(stream, "%" PRIu64 "\n", *(uint64_t*)E->e->u.scalar.d);
-      break;
-    case GD_CARRAY_ENTRY:
-      fprintf(stream, " CARRAY%s %s", pretty ? "  " : "", _GD_TypeName(D,
-            E->EN(scalar,const_type)));
-      if (E->EN(scalar,const_type) & GD_SIGNED)
-        for (z = 0; z < E->EN(scalar,array_len); ++z)
-          fprintf(stream, " %" PRIi64, ((int64_t*)E->e->u.scalar.d)[z]);
-      else if (E->EN(scalar,const_type) & GD_IEEE754)
-        for (z = 0; z < E->EN(scalar,array_len); ++z)
-          fprintf(stream, " %.15g", ((double*)E->e->u.scalar.d)[z]);
-      else if (E->EN(scalar,const_type) & GD_COMPLEX)
-        for (z = 0; z < E->EN(scalar,array_len); ++z)
-          fprintf(stream, " %.15g;%.15g", ((double*)E->e->u.scalar.d)[2 * z],
-              ((double*)E->e->u.scalar.d)[2 * z + 1]);
-      else
-        for (z = 0; z < E->EN(scalar,array_len); ++z)
-          fprintf(stream, " %" PRIu64, ((uint64_t*)E->e->u.scalar.d)[z]);
-      fputs("\n", stream);
-      break;
-    case GD_STRING_ENTRY:
-      fprintf(stream, " STRING%s \"", pretty ? "  " : "");
-      _GD_StringEscapeise(stream, E->e->u.string, permissive, D->standards);
-      fputs("\"\n", stream);
-      break;
-    case GD_INDEX_ENTRY:
-    case GD_NO_ENTRY:
-      _GD_InternalError(D);
-      break;
+          fprintf(stream, "%" PRIu64 "\n", *(uint64_t*)E->e->u.scalar.d);
+        break;
+      case GD_CARRAY_ENTRY:
+        fprintf(stream, " CARRAY%s %s", pretty ? "  " : "", _GD_TypeName(D,
+              E->EN(scalar,const_type)));
+        if (E->EN(scalar,const_type) & GD_SIGNED)
+          for (z = 0; z < E->EN(scalar,array_len); ++z)
+            fprintf(stream, " %" PRIi64, ((int64_t*)E->e->u.scalar.d)[z]);
+        else if (E->EN(scalar,const_type) & GD_IEEE754)
+          for (z = 0; z < E->EN(scalar,array_len); ++z)
+            fprintf(stream, " %.15g", ((double*)E->e->u.scalar.d)[z]);
+        else if (E->EN(scalar,const_type) & GD_COMPLEX)
+          for (z = 0; z < E->EN(scalar,array_len); ++z)
+            fprintf(stream, " %.15g;%.15g", ((double*)E->e->u.scalar.d)[2 * z],
+                ((double*)E->e->u.scalar.d)[2 * z + 1]);
+        else
+          for (z = 0; z < E->EN(scalar,array_len); ++z)
+            fprintf(stream, " %" PRIu64, ((uint64_t*)E->e->u.scalar.d)[z]);
+        fputc('\n', stream);
+        break;
+      case GD_STRING_ENTRY:
+        fprintf(stream, " STRING%s ", pretty ? "  " : "");
+        _GD_StringEscapeise(stream, E->e->u.string, 0, permissive,
+            D->standards);
+        fputc('\n', stream);
+        break;
+      case GD_INDEX_ENTRY:
+      case GD_ALIAS_ENTRY:
+      case GD_NO_ENTRY:
+        _GD_InternalError(D);
+        break;
+    }
+  }
+
+  if (!D->error && E->hidden && (permissive || D->standards >= 9)) {
+    fputs("/HIDDEN ", stream);
+    _GD_WriteFieldCode(D, stream, me, E->field, permissive, D->standards);
+    fputc('\n', stream);
   }
 
   dreturnvoid();
@@ -421,40 +600,40 @@ static void _GD_FlushFragment(DIRFILE* D, int i, int permissive)
   int j;
   FILE* stream;
   char buffer[GD_MAX_LINE_LENGTH];
-  char *temp_file;
+  char temp_file[] = "format_XXXXXX";
   char* ptr;
   struct tm now;
-  int fd;
+  int fd, dummy;
   int pretty = 0;
   size_t max_len = 0;
-  const size_t name_len = strlen(D->name);
   unsigned int u;
+#ifdef HAVE_FCHMOD
   mode_t mode;
+#endif
   struct stat stat_buf;
   time_t t;
+  int dirfd = D->fragment[i].dirfd;
 
   dtrace("%p, %i, %i", D, i, permissive);
 
+#ifdef HAVE_FCHMOD
   /* get the permissions of the old file */
   if (stat(D->fragment[i].cname, &stat_buf))
     mode = 0644;
   else
     mode = stat_buf.st_mode;
+#endif
 
   /* open a temporary file */
-  temp_file = (char *)malloc(name_len + 15);
-  snprintf(temp_file, name_len + 15, "%s/format_XXXXXX", D->name);
-  fd = mkstemp(temp_file);
+  fd = _GD_MakeTempFile(D, dirfd, temp_file);
   if (fd == -1) {
     _GD_SetError(D, GD_E_FLUSH, GD_E_FLUSH_MKTMP, NULL, errno, temp_file);
-    free(temp_file);
     dreturnvoid();
     return;
   }
-  stream = fdopen(fd, "w+");
+  stream = fdopen(fd, "wb+");
   if (stream == NULL) {
     _GD_SetError(D, GD_E_FLUSH, GD_E_FLUSH_OPEN, NULL, errno, temp_file);
-    free(temp_file);
     dreturnvoid();
     return;
   }
@@ -472,7 +651,7 @@ static void _GD_FlushFragment(DIRFILE* D, int i, int permissive)
         t += l;
         n++;
       }
-    max_len = 2 * t / n;
+    max_len = (n == 0) ? 0: 2 * t / n;
     if (max_len > m)
       max_len = m;
     if (max_len > GD_MAX_PRETTY_FIELD_WIDTH)
@@ -516,7 +695,7 @@ static void _GD_FlushFragment(DIRFILE* D, int i, int permissive)
       fputs("/PROTECT none\n", stream);
     else if (D->fragment[i].protection == GD_PROTECT_FORMAT)
       fputs("/PROTECT format\n", stream);
-    else if (D->fragment[i].protection == GD_PROTECT_FORMAT)
+    else if (D->fragment[i].protection == GD_PROTECT_DATA)
       fputs("/PROTECT data\n", stream);
     else
       fputs("/PROTECT all\n", stream);
@@ -547,7 +726,24 @@ static void _GD_FlushFragment(DIRFILE* D, int i, int permissive)
       case GD_TEXT_ENCODED:
         fputs("/ENCODING text\n", stream);
         break;
-      case 0:
+      case GD_SIE_ENCODED:
+        fputs("/ENCODING sie\n", stream);
+        break;
+      case GD_ZZIP_ENCODED:
+        if (D->fragment[i].enc_data)
+          fprintf(stream, "/ENCODING zzip %s\n",
+              (char*)D->fragment[i].enc_data);
+        else
+          fputs("/ENCODING zzip\n", stream);
+        break;
+      case GD_ZZSLIM_ENCODED:
+        if (D->fragment[i].enc_data)
+          fprintf(stream, "/ENCODING zzslim %s\n",
+              (char*)D->fragment[i].enc_data);
+        else
+          fputs("/ENCODING zzslim\n", stream);
+        break;
+      case GD_AUTO_ENCODED: /* an unresolved, auto-encoded fragment */
         break;
       default:
         fprintf(stream, "/ENCODING unknown # (%lx)\n", D->fragment[i].encoding);
@@ -558,17 +754,36 @@ static void _GD_FlushFragment(DIRFILE* D, int i, int permissive)
   /* The includes */
   if (permissive || D->standards >= 3)
     for (j = 0; j < D->n_fragment; ++j)
-      if (D->fragment[j].parent == i)
-        fprintf(stream, "%sINCLUDE %s\n", (D->standards >= 5) ? "/" : "",
-            D->fragment[j].ename);
+      if (D->fragment[j].parent == i) {
+        char *prefix = _GD_MungeCode(D, NULL, D->fragment[i].prefix, NULL, NULL,
+            NULL, D->fragment[j].prefix, &dummy, 0);
+        char *suffix = _GD_MungeCode(D, NULL, NULL, D->fragment[i].suffix, NULL,
+            NULL, D->fragment[j].suffix, &dummy, 0);
+
+        fprintf(stream, "%sINCLUDE ", (D->standards >= 5) ? "/" : "");
+        _GD_StringEscapeise(stream, D->fragment[j].ename, 0, permissive,
+            D->standards);
+        if (prefix || suffix) {
+          fputc(' ', stream);
+          _GD_StringEscapeise(stream, prefix, 0, permissive, D->standards);
+          free(prefix);
+        }
+
+        if (suffix) {
+          fputc(' ', stream);
+          _GD_StringEscapeise(stream, suffix, 0, permissive, D->standards);
+          free(suffix);
+        }
+        fputc('\n', stream);
+      }
 
   /* The fields */
   for (u = 0; u < D->n_entries; ++u)
     if (D->entry[u]->fragment_index == i && D->entry[u]->e->n_meta != -1) {
-      _GD_FieldSpec(D, stream, D->entry[u], 0, max_len, pretty, permissive);
+      _GD_FieldSpec(D, stream, D->entry[u], i, 0, max_len, pretty, permissive);
       if (permissive || D->standards >= 6)
         for (j = 0; j < D->entry[u]->e->n_meta; ++j)
-          _GD_FieldSpec(D, stream, D->entry[u]->e->p.meta_entry[j], 1, 0,
+          _GD_FieldSpec(D, stream, D->entry[u]->e->p.meta_entry[j], i, 1, 0,
               pretty, permissive);
     }
 
@@ -577,7 +792,7 @@ static void _GD_FlushFragment(DIRFILE* D, int i, int permissive)
   if (permissive || D->standards >= 6)
     if (D->fragment[i].ref_name != NULL) {
       fputs("/REFERENCE ", stream);
-      _GD_StringEscapeise(stream, D->fragment[i].ref_name, permissive,
+      _GD_WriteFieldCode(D, stream, i, D->fragment[i].ref_name, permissive,
           D->standards);
       fputc('\n', stream);
     }
@@ -585,30 +800,28 @@ static void _GD_FlushFragment(DIRFILE* D, int i, int permissive)
   /* That's all; flush, sync, and close */
   fflush(stream);
   fsync(fd);
-#ifdef HAVE_FCHMOD  
+#ifdef HAVE_FCHMOD
   fchmod(fd, mode);
 #endif
   fclose(stream);
 
   /* If no error was encountered, move the temporary file over the
    * old format file, otherwise abort */
-  if (D->error != GD_E_OK) {
-    unlink(temp_file);
-    free(temp_file);
-    dreturnvoid();
-    return;
-    /* Only assume we've synced the file if the rename succeeds */
-  } else if (_GD_Rename(temp_file, D->fragment[i].cname)) {
+
+  /* Only assume we've synced the file if the rename succeeds */
+  if (D->error != GD_E_OK)
+    gd_UnlinkAt(D, dirfd, temp_file, 0);
+  else if (gd_RenameAt(D, dirfd, temp_file, dirfd, D->fragment[i].bname)) {
     _GD_SetError(D, GD_E_FLUSH, GD_E_FLUSH_RENAME, NULL, errno,
         D->fragment[i].cname);
-    unlink(temp_file);
-    free(temp_file);
-    dreturnvoid();
-    return;
+    gd_UnlinkAt(D, dirfd, temp_file, 0);
   } else
     D->fragment[i].modified = 0;
 
-  free(temp_file);
+  /* update mtime, if successful */
+  if (!D->error && gd_StatAt(D, dirfd, D->fragment[i].bname, &stat_buf, 0) == 0)
+    D->fragment[i].mtime = stat_buf.st_mtime;
+
   dreturnvoid();
 }
 
@@ -682,14 +895,14 @@ int gd_rewrite_fragment(DIRFILE* D, int fragment)
   return (D->error == GD_E_OK) ? 0 : -1;
 }
 
-int gd_flush(DIRFILE* D, const char* field_code)
+static int _GD_SyncOrClose(DIRFILE* D, const char* field_code, int syn, int clo)
 {
   unsigned int i;
   int repr;
   char *simple_field_code;
   gd_entry_t *E;
 
-  dtrace("%p, \"%s\"", D, field_code);
+  dtrace("%p, \"%s\", %i, %i", D, field_code, syn, clo);
 
   _GD_ClearError(D);
 
@@ -700,13 +913,14 @@ int gd_flush(DIRFILE* D, const char* field_code)
     if (!D->error)
       for (i = 0; i < D->n_entries; ++i)
         if (D->entry[i]->field_type == GD_RAW_ENTRY)
-          _GD_Flush(D, D->entry[i]);
+          _GD_Flush(D, D->entry[i], syn, clo);
   } else {
     /* discard representation */
-    E = _GD_FindFieldAndRepr(D, field_code, &simple_field_code, &repr, NULL, 1);
+    E = _GD_FindFieldAndRepr(D, field_code, &simple_field_code, &repr, NULL, 1,
+        1);
 
     if (!D->error)
-      _GD_Flush(D, E);
+      _GD_Flush(D, E, syn, clo);
 
     if (field_code != simple_field_code)
       free(simple_field_code);
@@ -716,24 +930,62 @@ int gd_flush(DIRFILE* D, const char* field_code)
   return (D->error == GD_E_OK) ? 0 : -1;
 }
 
-#define GD_VERS_GE_1  0xFFFFFFFFFFFFFFFELU
-#define GD_VERS_GE_2  0xFFFFFFFFFFFFFFFCLU
-#define GD_VERS_GE_3  0xFFFFFFFFFFFFFFF8LU
-#define GD_VERS_GE_4  0xFFFFFFFFFFFFFFF0LU
-#define GD_VERS_GE_5  0xFFFFFFFFFFFFFFE0LU
-#define GD_VERS_GE_6  0xFFFFFFFFFFFFFFC0LU
-#define GD_VERS_GE_7  0xFFFFFFFFFFFFFF80LU
-#define GD_VERS_GE_8  0xFFFFFFFFFFFFFF00LU
-
-#define GD_VERS_LE_0  0x0000000000000001LU
-#define GD_VERS_LE_1  0x0000000000000003LU
-#define GD_VERS_LE_2  0x0000000000000007LU
-#define GD_VERS_LE_3  0x000000000000000fLU
-#define GD_VERS_LE_4  0x000000000000001fLU
-#define GD_VERS_LE_5  0x000000000000003fLU
-#define GD_VERS_LE_6  0x000000000000007fLU
-#define GD_VERS_LE_7  0x00000000000000ffLU
-#define GD_VERS_LE_8  0x00000000000001ffLU
+int gd_sync(DIRFILE *D, const char *field_code)
+{
+  int ret;
+
+  dtrace("%p, \"%s\"", D, field_code);
+
+  ret = _GD_SyncOrClose(D, field_code, 1, 0);
+
+  dreturn("%i", ret);
+  return ret;
+}
+
+int gd_raw_close(DIRFILE *D, const char *field_code)
+{
+  int ret;
+
+  dtrace("%p, \"%s\"", D, field_code);
+
+  ret = _GD_SyncOrClose(D, field_code, 0, 1);
+
+  dreturn("%i", ret);
+  return ret;
+}
+
+int gd_flush(DIRFILE *D, const char *field_code)
+{
+  int ret;
+
+  dtrace("%p, \"%s\"", D, field_code);
+
+  ret = _GD_SyncOrClose(D, field_code, 1, 1);
+
+  dreturn("%i", ret);
+  return ret;
+}
+
+#define GD_VERS_GE_1  0xFFFFFFFEUL
+#define GD_VERS_GE_2  0xFFFFFFFCUL
+#define GD_VERS_GE_3  0xFFFFFFF8UL
+#define GD_VERS_GE_4  0xFFFFFFF0UL
+#define GD_VERS_GE_5  0xFFFFFFE0UL
+#define GD_VERS_GE_6  0xFFFFFFC0UL
+#define GD_VERS_GE_7  0xFFFFFF80UL
+#define GD_VERS_GE_8  0xFFFFFF00UL
+#define GD_VERS_GE_9  0xFFFFFE00UL
+
+#define GD_VERS_LE_0  0x00000001UL
+#define GD_VERS_LE_1  0x00000003UL
+#define GD_VERS_LE_2  0x00000007UL
+#define GD_VERS_LE_3  0x0000000fUL
+#define GD_VERS_LE_4  0x0000001fUL
+#define GD_VERS_LE_5  0x0000003fUL
+#define GD_VERS_LE_6  0x0000007fUL
+#define GD_VERS_LE_7  0x000000ffUL
+#define GD_VERS_LE_8  0x000001ffUL
+#define GD_VERS_LE_9  0x000003ffUL
 
 uint64_t _GD_FindVersion(DIRFILE *D)
 {
@@ -747,10 +999,12 @@ uint64_t _GD_FindVersion(DIRFILE *D)
     D->av &= GD_VERS_GE_3;
 
   for (i = 0; D->av && i < (unsigned int)D->n_fragment; ++i) {
-    /* on an arm-endian platform, the arm flag is set by /ENDIAN directives
-     * missing an "arm" token, but it's absense might mean either an "arm"
-     * token was present, or else there was no /ENDIAN directive at all */
-    if (D->fragment[i].byte_sex & GD_ARM_FLAG)
+    if (D->fragment[i].prefix || D->fragment[i].suffix)
+      D->av &= GD_VERS_GE_9;
+    else if (D->fragment[i].byte_sex & GD_ARM_FLAG)
+      /* on an arm-endian platform, the arm flag is set by /ENDIAN directives
+       * missing an "arm" token, but it's absense might mean either an "arm"
+       * token was present, or else there was no /ENDIAN directive at all */
 #ifdef ARM_ENDIAN_DOUBLES
       D->av &= GD_VERS_GE_5;
 #else
@@ -774,61 +1028,70 @@ uint64_t _GD_FindVersion(DIRFILE *D)
   }
 
   for (i = 0; D->av && i < D->n_entries; ++i) {
-    switch (D->entry[i]->field_type) {
-      case GD_RAW_ENTRY:
-        switch (D->entry[i]->EN(raw,data_type)) {
-          case GD_COMPLEX128:
-          case GD_COMPLEX64:
-            D->av &= GD_VERS_GE_7;
-            break;
-          case GD_INT8:
-          case GD_INT64:
-          case GD_UINT64:
-            D->av &= GD_VERS_GE_5;
-            break;
-          default:
-            break;
-        }
-        break;
-      case GD_DIVIDE_ENTRY:
-      case GD_RECIP_ENTRY:
-      case GD_CARRAY_ENTRY:
-        D->av &= GD_VERS_GE_8;
-        break;
-      case GD_MULTIPLY_ENTRY:
-        D->av &= GD_VERS_GE_2;
-        break;
-      case GD_PHASE_ENTRY:
-        D->av &= GD_VERS_GE_4;
-        break;
-      case GD_POLYNOM_ENTRY:
-      case GD_SBIT_ENTRY:
-        D->av &= GD_VERS_GE_7;
-        break;
-      case GD_CONST_ENTRY:
-        if (D->entry[i]->EN(scalar,const_type) & GD_COMPLEX128)
+    if (D->entry[i]->hidden)
+      D->av &= GD_VERS_GE_9;
+    else
+      switch (D->entry[i]->field_type) {
+        case GD_RAW_ENTRY:
+          switch (D->entry[i]->EN(raw,data_type)) {
+            case GD_COMPLEX128:
+            case GD_COMPLEX64:
+              D->av &= GD_VERS_GE_7;
+              break;
+            case GD_INT8:
+            case GD_INT64:
+            case GD_UINT64:
+              D->av &= GD_VERS_GE_5;
+              break;
+            default:
+              break;
+          }
+          break;
+        case GD_DIVIDE_ENTRY:
+        case GD_RECIP_ENTRY:
+        case GD_CARRAY_ENTRY:
+          D->av &= GD_VERS_GE_8;
+          break;
+        case GD_MULTIPLY_ENTRY:
+          D->av &= GD_VERS_GE_2;
+          break;
+        case GD_PHASE_ENTRY:
+          D->av &= GD_VERS_GE_4;
+          break;
+        case GD_POLYNOM_ENTRY:
+        case GD_SBIT_ENTRY:
           D->av &= GD_VERS_GE_7;
-        else
+          break;
+        case GD_CONST_ENTRY:
+          if (D->entry[i]->EN(scalar,const_type) & GD_COMPLEX128)
+            D->av &= GD_VERS_GE_7;
+          else
+            D->av &= GD_VERS_GE_6;
+          break;
+        case GD_STRING_ENTRY:
           D->av &= GD_VERS_GE_6;
-        break;
-      case GD_STRING_ENTRY:
-        D->av &= GD_VERS_GE_6;
-        break;
-      case GD_BIT_ENTRY:
-        if (D->entry[i]->EN(bit,numbits) > 1)
-          D->av &= GD_VERS_GE_1;
-        else if (D->entry[i]->EN(bit,bitnum) + D->entry[i]->EN(bit,numbits) - 1
-            > 32)
-        {
-          D->av &= GD_VERS_GE_5;
-        }
-        break;
-      case GD_LINTERP_ENTRY:
-      case GD_LINCOM_ENTRY:
-      case GD_INDEX_ENTRY:
-      case GD_NO_ENTRY:
-        break;
-    }
+          break;
+        case GD_BIT_ENTRY:
+          if (D->entry[i]->EN(bit,numbits) > 1)
+            D->av &= GD_VERS_GE_1;
+          else if (D->entry[i]->EN(bit,bitnum) + D->entry[i]->EN(bit,numbits)
+              - 1 > 32)
+          {
+            D->av &= GD_VERS_GE_5;
+          }
+          break;
+        case GD_ALIAS_ENTRY:
+        case GD_WINDOW_ENTRY:
+        case GD_MPLEX_ENTRY:
+          D->av &= GD_VERS_GE_9;
+          break;
+        case GD_LINTERP_ENTRY:
+        case GD_LINCOM_ENTRY:
+        case GD_INDEX_ENTRY:
+        case GD_NO_ENTRY:
+          break;
+      }
+
     if (D->av & GD_VERS_GE_1 && strcmp(D->entry[i]->field, "FRAMEOFFSET") == 0)
       D->av &= (GD_VERS_LE_0 | GD_VERS_GE_8);
     else if (D->av & GD_VERS_GE_3 && strcmp(D->entry[i]->field, "INCLUDE") == 0)
@@ -868,7 +1131,7 @@ uint64_t _GD_FindVersion(DIRFILE *D)
   }
 
   D->flags |= GD_HAVE_VERSION;
-  dreturn("%04llx", D->av);
+  dreturn("0x%04" PRIx64, D->av);
   return D->av;
 }
 
@@ -930,8 +1193,8 @@ int gd_dirfile_standards(DIRFILE *D, int vers) gd_nothrow
   if (vers < 0 || vers > GD_DIRFILE_STANDARDS_VERSION ||
       ~D->av & (1ULL << vers))
   {
-    _GD_SetError(D, GD_E_BAD_VERSION, (D->av == 0) ? GD_E_VERS_NONE :
-        GD_E_VERS_MISSING, NULL, vers, NULL);
+    _GD_SetError(D, GD_E_ARGUMENT, (D->av == 0) ? GD_E_ARG_NO_VERS :
+        GD_E_ARG_BAD_VERS, NULL, vers, NULL);
     dreturn("%i", -1);
     return -1;
   }
diff --git a/src/fpos.c b/src/fpos.c
new file mode 100644
index 0000000..02b5ec6
--- /dev/null
+++ b/src/fpos.c
@@ -0,0 +1,402 @@
+/* Copyright (C) 2011-2012 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+#include "internal.h"
+
+off64_t _GD_GetFilePos(DIRFILE *D, gd_entry_t *E, off64_t index_pos)
+{
+  int i;
+  off64_t pos = -1, pos2;
+
+  dtrace("%p, %p, %lli", D, E, (long long)index_pos);
+
+  if (++D->recurse_level >= GD_MAX_RECURSE_LEVEL) {
+    _GD_SetError(D, GD_E_RECURSE_LEVEL, GD_E_RECURSE_CODE, NULL, 0, E->field);
+    dreturn("%u", 0);
+    D->recurse_level--;
+    return 0;
+  }
+
+  switch (E->field_type) {
+    case GD_RAW_ENTRY:
+      /* We must open the file to know its starting offset */
+      if (E->e->u.raw.file[0].idata < 0)
+        if (_GD_InitRawIO(D, E, NULL, 0, NULL, 0, GD_FILE_READ, 0))
+          break;
+      pos = E->e->u.raw.file[0].pos + E->EN(raw,spf) *
+        D->fragment[E->fragment_index].frame_offset;
+      break;
+    case GD_LINCOM_ENTRY:
+      if (_GD_BadInput(D, E, 0, 1))
+        break;
+
+      pos = _GD_GetFilePos(D, E->e->entry[0], -1);
+      if (!D->error)
+        for (i = 1; i < E->EN(lincom,n_fields); ++i) {
+          if (_GD_BadInput(D, E, i, 1)) {
+            pos = -1;
+            break;
+          }
+          pos2 = _GD_GetFilePos(D, E->e->entry[i], pos);
+          if (pos2 != pos) {
+            _GD_SetError(D, GD_E_DOMAIN, GD_E_DOMAIN_MULTIPOS, NULL, 0, NULL);
+            pos = -1;
+            break;
+          }
+        }
+      break;
+    case GD_LINTERP_ENTRY:
+    case GD_BIT_ENTRY:
+    case GD_POLYNOM_ENTRY:
+    case GD_SBIT_ENTRY:
+    case GD_RECIP_ENTRY:
+      if (_GD_BadInput(D, E, 0, 1))
+          break;
+      pos = _GD_GetFilePos(D, E->e->entry[0], -1);
+      break;
+    case GD_MULTIPLY_ENTRY:
+    case GD_DIVIDE_ENTRY:
+    case GD_WINDOW_ENTRY:
+    case GD_MPLEX_ENTRY:
+      if (_GD_BadInput(D, E, 0, 1) || _GD_BadInput(D, E, 1, 1))
+          break;
+      pos = _GD_GetFilePos(D, E->e->entry[0], -1);
+      if (D->error)
+        break;
+      pos2 = _GD_GetFilePos(D, E->e->entry[1], pos);
+      if (!D->error && pos != pos2) {
+        _GD_SetError(D, GD_E_DOMAIN, GD_E_DOMAIN_MULTIPOS, NULL, 0, NULL);
+        pos = -1;
+      }
+      break;
+    case GD_PHASE_ENTRY:
+      if (_GD_BadInput(D, E, 0, 1))
+        break;
+      pos = _GD_GetFilePos(D, E->e->entry[0], -1);
+      if (pos >= 0)
+        pos += E->EN(phase,shift);
+      break;
+    case GD_INDEX_ENTRY:
+      if (index_pos == -1)
+        pos = E->e->u.index_pos;
+      else
+        pos = index_pos;
+      break;
+    case GD_NO_ENTRY:
+    case GD_CONST_ENTRY:
+    case GD_STRING_ENTRY:
+    case GD_CARRAY_ENTRY:
+    case GD_ALIAS_ENTRY:
+      _GD_InternalError(D);
+  }
+
+  D->recurse_level--;
+  dreturn("%lli", (long long)pos);
+  return pos;
+}
+
+/* Get the current I/O position of the given field
+*/
+off64_t gd_tell64(DIRFILE *D, const char *field_code_in) gd_nothrow
+{
+  off64_t pos = -1;
+  gd_entry_t* entry;
+  char* field_code;
+  int repr;
+
+  dtrace("%p, \"%s\"", D, field_code_in);
+
+  if (D->flags & GD_INVALID) {/* don't crash */
+    _GD_SetError(D, GD_E_BAD_DIRFILE, 0, NULL, 0, NULL);
+    dreturn("%u", 0);
+    return 0;
+  }
+
+  _GD_ClearError(D);
+
+  entry = _GD_FindFieldAndRepr(D, field_code_in, &field_code, &repr, NULL, 1,
+      1);
+
+  if (D->error) {
+    dreturn("%u", 0);
+    return 0;
+  }
+
+  if (entry->field_type & GD_SCALAR_ENTRY_BIT)
+    _GD_SetError(D, GD_E_DIMENSION, GD_E_DIM_CALLER, NULL, 0, field_code);
+  else
+    pos = _GD_GetFilePos(D, entry, -1);
+
+  if (field_code != field_code_in)
+    free(field_code);
+
+  dreturn("%lli", (long long)pos);
+  return pos;
+}
+
+off_t gd_tell(DIRFILE *D, const char *field_code) gd_nothrow
+{
+  return (off_t)gd_tell64(D, field_code);
+}
+
+off64_t _GD_WriteSeek(DIRFILE *D, gd_entry_t *E, const struct encoding_t *enc,
+    off64_t offset, unsigned int mode)
+{
+  off64_t pos = 0;
+  const int which = (mode & GD_FILE_TEMP) ? 1 : 0;
+  const int oop_write = ((enc->flags & GD_EF_OOP) && (mode & GD_FILE_WRITE))
+    ? 1 : 0;
+
+  dtrace("%p, %p, %p, %lli, 0x%X", D, E, enc, (long long)offset, mode);
+
+  /* in this case we need to close and then re-open the file */
+  if ((offset < E->e->u.raw.file[which].pos) && oop_write) {
+    if (_GD_FiniRawIO(D, E, E->fragment_index, GD_FINIRAW_KEEP)) {
+      dreturn("%i", -1);
+      return -1;
+    } else if (_GD_InitRawIO(D, E, NULL, 0, NULL, GD_EF_SEEK, GD_FILE_WRITE, 0))
+    {
+      dreturn("%i", -1);
+      return -1;
+    }
+  }
+
+  if (oop_write && E->e->u.raw.file[0].idata >= 0) {
+    /* read from the old file until we reach the point we're interested in or
+     * run out of data */
+    char buffer[GD_BUFFER_SIZE];
+    ssize_t n_read, n_wrote;
+
+    while (offset * GD_SIZE(E->EN(raw,data_type)) > GD_BUFFER_SIZE) {
+      n_read = (*enc->read)(E->e->u.raw.file, buffer, E->EN(raw,data_type),
+            GD_BUFFER_SIZE);
+      if (n_read > 0) {
+        n_wrote = (*enc->write)(E->e->u.raw.file + 1, buffer,
+            E->EN(raw,data_type), n_read);
+        if (n_wrote != n_read) {
+          dreturn("%i", -1);
+          return -1;
+        }
+        offset -= n_wrote;
+        pos += n_wrote;
+      } else if (n_read < 0) {
+        dreturn("%i", -1);
+        return -1;
+      }
+    }
+
+    if (offset > 0) {
+      n_read = (*enc->read)(E->e->u.raw.file, buffer, E->EN(raw,data_type),
+            offset);
+      if (n_read > 0) {
+        n_wrote = (*enc->write)(E->e->u.raw.file + 1, buffer,
+            E->EN(raw,data_type), n_read);
+        if (n_wrote != n_read) {
+          dreturn("%i", -1);
+          return -1;
+        }
+        offset -= n_wrote;
+        pos += n_wrote;
+      } else if (n_read < 0) {
+        dreturn("%i", -1);
+        return -1;
+      }
+    }
+  }
+
+  pos += (*enc->seek)(E->e->u.raw.file + which, offset, E->EN(raw,data_type),
+      mode);
+
+  dreturn("%lli", (long long)pos);
+  return pos;
+}
+
+int _GD_Seek(DIRFILE *D, gd_entry_t *E, off64_t offset, unsigned int mode)
+{
+  int i;
+
+  dtrace("%p, %p, %lli, 0x%X", D, E, (long long)offset, mode);
+
+  if (++D->recurse_level >= GD_MAX_RECURSE_LEVEL) {
+    _GD_SetError(D, GD_E_RECURSE_LEVEL, GD_E_RECURSE_CODE, NULL, 0, E->field);
+    D->recurse_level--;
+    dreturn("%i", 1);
+    return 1;
+  }
+
+  if (offset < 0) {
+    _GD_SetError(D, GD_E_RANGE, GD_E_OUT_OF_RANGE, NULL, 0, NULL);
+    dreturn("%i", 1);
+    return 1;
+  }
+
+  switch (E->field_type) {
+    case GD_RAW_ENTRY:
+      /* open/create the file, if necessary */
+      if (_GD_InitRawIO(D, E, NULL, 0, NULL, GD_EF_SEEK, mode, 0))
+        break;
+
+      /* The requested offset is before the start of the file, so I guess
+       * pretend we've repositioned it...
+       */
+      if (E->EN(raw,spf) * D->fragment[E->fragment_index].frame_offset >
+          offset) {
+        E->e->u.raw.file[0].pos = offset - E->EN(raw,spf) *
+          D->fragment[E->fragment_index].frame_offset;
+        break;
+      }
+
+      if (_GD_WriteSeek(D, E, gd_ef_ + E->e->u.raw.file[0].subenc, offset -
+            E->EN(raw,spf) * D->fragment[E->fragment_index].frame_offset, mode)
+          == -1)
+      {
+        _GD_SetError(D, GD_E_RAW_IO, 0, E->e->u.raw.file[0].name, errno, NULL);
+      }
+      break;
+    case GD_LINCOM_ENTRY:
+      for (i = 0; i < E->EN(lincom,n_fields); ++i)
+        if (!_GD_BadInput(D, E, i, 1))
+          _GD_Seek(D, E->e->entry[i], offset, mode);
+        else
+          break;
+      break;
+    case GD_MULTIPLY_ENTRY:
+    case GD_DIVIDE_ENTRY:
+    case GD_WINDOW_ENTRY:
+    case GD_MPLEX_ENTRY:
+      if (_GD_BadInput(D, E, 1, 1))
+        break;
+      if (_GD_Seek(D, E->e->entry[1], offset, mode))
+        break;
+      /* fallthrough */
+    case GD_LINTERP_ENTRY:
+    case GD_BIT_ENTRY:
+    case GD_POLYNOM_ENTRY:
+    case GD_SBIT_ENTRY:
+    case GD_RECIP_ENTRY:
+      if (!_GD_BadInput(D, E, 0, 1))
+        _GD_Seek(D, E->e->entry[0], offset, mode);
+      break;
+    case GD_PHASE_ENTRY:
+      if (!_GD_BadInput(D, E, 0, 1))
+        _GD_Seek(D, E->e->entry[0], offset + E->EN(phase,shift), mode);
+      break;
+    case GD_INDEX_ENTRY:
+      E->e->u.index_pos = offset;
+      break;
+    case GD_NO_ENTRY:
+    case GD_CONST_ENTRY:
+    case GD_STRING_ENTRY:
+    case GD_CARRAY_ENTRY:
+    case GD_ALIAS_ENTRY:
+      _GD_InternalError(D);
+  }
+
+  D->recurse_level--;
+  dreturn("%i", (D->error == 0) ? 0 : 1);
+  return (D->error == 0) ? 0 : 1;
+}
+
+/* Set the I/O position of the given field
+ */
+off64_t gd_seek64(DIRFILE *D, const char *field_code_in, off64_t frame_num,
+    off64_t sample_num, int whence)
+{
+  unsigned int spf = 0;
+  off64_t pos = 0;
+  gd_entry_t* entry;
+  char* field_code;
+  int repr, is_index = 0;
+  unsigned int mode = (whence & GD_SEEK_WRITE) ? GD_FILE_WRITE : GD_FILE_READ;
+
+  dtrace("%p, \"%s\", %lli, %lli, 0x%X", D, field_code_in, (long long)frame_num,
+      (long long)sample_num, whence);
+
+  if (D->flags & GD_INVALID) {/* don't crash */
+    _GD_SetError(D, GD_E_BAD_DIRFILE, 0, NULL, 0, NULL);
+    dreturn("%u", 0);
+    return 0;
+  }
+
+  _GD_ClearError(D);
+
+  entry = _GD_FindFieldAndRepr(D, field_code_in, &field_code, &repr, NULL, 1,
+      1);
+
+  if (D->error) {
+    dreturn("%i", -1);
+    return -1;
+  }
+
+  if (entry->field_type & GD_SCALAR_ENTRY_BIT) {
+    _GD_SetError(D, GD_E_DIMENSION, GD_E_DIM_CALLER, NULL, 0, field_code);
+    if (field_code != field_code_in)
+      free(field_code);
+    dreturn("%i", -1);
+    return -1;
+  }
+
+  if (frame_num) {
+    spf = _GD_GetSPF(D, entry);
+
+    if (D->error) {
+      if (field_code != field_code_in)
+        free(field_code);
+      dreturn("%i", -1);
+      return -1;
+    }
+  }
+
+  sample_num += frame_num * spf;
+
+  whence &= (GD_SEEK_SET | GD_SEEK_CUR | GD_SEEK_END);
+  if (whence == GD_SEEK_SET)
+    pos = 0;
+  else if (whence == GD_SEEK_CUR)
+    pos = _GD_GetFilePos(D, entry, 1);
+  else if (whence == GD_SEEK_END) {
+    pos = _GD_GetEOF(D, entry, NULL, &is_index);
+    if (is_index)
+      _GD_SetError(D, GD_E_BAD_FIELD_TYPE, GD_E_FIELD_BAD, NULL, 0, field_code);
+  } else
+    _GD_SetError(D, GD_E_ARGUMENT, GD_E_ARG_WHENCE, NULL, 0, NULL);
+
+  if (!D->error)
+    _GD_Seek(D, entry, sample_num + pos, mode);
+
+  if (field_code != field_code_in)
+    free(field_code);
+
+  if (D->error)
+    pos = -1;
+  else
+    pos = _GD_GetFilePos(D, entry, 1);
+
+  dreturn("%lli", (long long)pos);
+  return pos;
+}
+
+off_t gd_seek(DIRFILE *D, const char *field_code, off_t frame_num,
+    off_t sample_num, int whence)
+{
+  return (off_t)gd_seek64(D, field_code, frame_num, sample_num, whence);
+}
+/* vim: ts=2 sw=2 et tw=80
+*/
diff --git a/src/fragment.c b/src/fragment.c
index df08a64..39c540c 100644
--- a/src/fragment.c
+++ b/src/fragment.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008,2010 D. V. Wiebe
+/* Copyright (C) 2008, 2010, 2011, 2012 D. V. Wiebe
  *
  ***************************************************************************
  *
@@ -20,10 +20,6 @@
  */
 #include "internal.h"
 
-#ifdef STDC_HEADERS
-#include <stdlib.h>
-#endif
-
 const char *gd_fragmentname(DIRFILE* D, int index) gd_nothrow
 {
   dtrace("%p, %i", D, index);
@@ -46,6 +42,231 @@ const char *gd_fragmentname(DIRFILE* D, int index) gd_nothrow
   return D->fragment[index].cname;
 }
 
+int gd_fragment_affixes(DIRFILE *D, int index, char **prefix, char **suffix)
+  gd_nothrow
+{
+  char *p = NULL, *s = NULL;
+  dtrace("%p, %i, %p, %p", D, index, prefix, suffix);
+
+  _GD_ClearError(D);
+
+  if (D->flags & GD_INVALID) {
+    _GD_SetError(D, GD_E_BAD_DIRFILE, 0, NULL, 0, NULL);
+    dreturn("%i", -1);
+    return -1;
+  }
+
+  if (index < 0 || index >= D->n_fragment) {
+    _GD_SetError(D, GD_E_BAD_INDEX, 0, NULL, 0, NULL);
+    dreturn("%i", -1);
+    return -1;
+  }
+
+  if (D->fragment[index].prefix)
+    p = _GD_Strdup(D, D->fragment[index].prefix);
+  if (D->fragment[index].suffix)
+    s = _GD_Strdup(D, D->fragment[index].suffix);
+
+  if (D->error) {
+    free(p);
+    free(s);
+    dreturn("%i", -1);
+    return -1;
+  }
+
+  *prefix = p;
+  *suffix = s;
+  dreturn("%i", 0);
+  return 0;
+}
+
+static char **_GD_CheckAffixes(DIRFILE *D, int i, const char *prefix,
+    const char *suffix, char **codes, unsigned *n)
+{
+  int j, dummy;
+  unsigned u, nn = *n;
+  char **new_codes = codes, **ptr;
+
+  dtrace("%p, %i, \"%s\", \"%s\", %p, %p", D, i, prefix, suffix, new_codes, n);
+
+  ptr = (char**)_GD_Realloc(D, codes, sizeof(char*) * (nn + 2));
+  if (!ptr) {
+    dreturn("%p (%i)", codes, *n);
+    return codes;
+  }
+  new_codes = ptr;
+
+  /* push the new prefix and suffix onto the code stack */
+  new_codes[nn++] = prefix ? _GD_Strdup(D, prefix) : NULL;
+  new_codes[nn++] = suffix ? _GD_Strdup(D, suffix) : NULL;
+  *n = nn;
+
+  if (D->error) {
+    dreturn("%p (%i)", new_codes, *n);
+    return new_codes;
+  }
+
+  /* Propagate changes downward */
+  for (j = 0; j < D->n_fragment; ++j)
+    if (D->fragment[j].parent == i) {
+      char *subprefix = _GD_MungeCode(D, NULL, D->fragment[i].prefix, NULL,
+          prefix, NULL, D->fragment[j].prefix, &dummy, 1);
+      char *subsuffix = _GD_MungeCode(D, NULL, NULL, D->fragment[i].suffix,
+          NULL, suffix, D->fragment[j].suffix, &dummy, 1);
+      if (D->error) {
+        free(subprefix);
+        dreturn("%p (%i)", new_codes, *n);
+        return new_codes;
+      }
+
+      new_codes = _GD_CheckAffixes(D, j, subprefix, subsuffix, new_codes, n);
+      free(subprefix);
+      free(subsuffix);
+      nn = *n;
+
+      if (D->error) {
+        dreturn("%p (%i)", new_codes, *n);
+        return new_codes;
+      }
+    }
+
+  /* Check for namespace clashes in our files */
+  for (u = 0; u < D->n_entries; ++u)
+    if (D->entry[u]->fragment_index == i && D->entry[u]->e->n_meta != -1) {
+      ptr = (char**)_GD_Realloc(D, new_codes, sizeof(char*) * ++nn);
+      if (ptr) {
+        new_codes = ptr;
+        /* remunge the code */
+        new_codes[nn - 1] = _GD_MungeCode(D, NULL, D->fragment[i].prefix,
+            D->fragment[i].suffix, prefix, suffix, D->entry[u]->field, &dummy,
+            0);
+
+        /* look for a duplicate and validate */
+        if (new_codes[nn - 1] && _GD_FindField(D, new_codes[nn - 1], D->entry,
+              D->n_entries, 1, NULL))
+        {
+          _GD_SetError(D, GD_E_DUPLICATE, 0, NULL, 0, new_codes[nn - 1]);
+        } else if (_GD_ValidateField(new_codes[nn - 1], D->standards, 1, 0,
+              NULL))
+        {
+          _GD_SetError(D, GD_E_BAD_CODE, GD_E_CODE_INVALID, NULL, 0,
+              new_codes[nn - 1]);
+        }
+      } else
+        nn--;
+
+      if (D->error)
+        break;
+    }
+
+  *n = nn;
+  dreturn("%p (%i)", new_codes, *n);
+  return new_codes;
+}
+
+static int _GD_ChangeAffixes(DIRFILE *D, int i, char **codes, int *resort)
+{
+  int j;
+  unsigned u, n = 2;
+
+  dtrace("%p, %i, %p, %p", D, i, codes, resort);
+
+  free(D->fragment[i].prefix);
+  free(D->fragment[i].suffix);
+  D->fragment[i].prefix = codes[0];
+  D->fragment[i].suffix = codes[1];
+
+  /* Propagate changes downward */
+  for (j = 0; j < D->n_fragment; ++j)
+    if (D->fragment[j].parent == i)
+      n += _GD_ChangeAffixes(D, j, codes + n, resort);
+
+  /* rename all the fields */
+  for (u = 0; u < D->n_entries; ++u)
+    if (D->entry[u]->fragment_index == i && D->entry[u]->e->n_meta != -1) {
+      *resort = 1;
+      free(D->entry[u]->field);
+      D->entry[u]->field = codes[n++];
+    }
+
+  dreturn("%i", n);
+  return n;
+}
+
+int gd_alter_affixes(DIRFILE *D, int index, const char *prefix,
+    const char *suffix) gd_nothrow
+{
+  unsigned u, n = 0;
+  char **new_codes;
+  int resort = 0;
+  dtrace("%p, %i, \"%s\", \"%s\"", D, index, prefix, suffix);
+
+  _GD_ClearError(D);
+
+  if (D->flags & GD_INVALID) {
+    _GD_SetError(D, GD_E_BAD_DIRFILE, 0, NULL, 0, NULL);
+    dreturn("%i", -1);
+    return -1;
+  }
+
+  if (index <= 0 || index >= D->n_fragment) {
+    _GD_SetError(D, GD_E_BAD_INDEX, 0, NULL, 0, NULL);
+    dreturn("%i", -1);
+    return -1;
+  }
+
+  if ((D->flags & GD_ACCMODE) == GD_RDONLY) {
+    _GD_SetError(D, GD_E_ACCMODE, 0, NULL, 0, NULL);
+    dreturn("%i", -1);
+    return -1;
+  }
+
+  if (D->fragment[D->fragment[index].parent].protection & GD_PROTECT_FORMAT) {
+    _GD_SetError(D, GD_E_PROTECTED, GD_E_PROTECTED_FORMAT, NULL, 0,
+        D->fragment[D->fragment[index].parent].cname);
+    dreturn("%i", -1);
+    return -1;
+  }
+
+  /* affixes to keep */
+  if (!prefix)
+    prefix = D->fragment[index].prefix;
+
+  if (!suffix)
+    suffix = D->fragment[index].suffix;
+
+  /* nothing to do */
+  if (strcmp(prefix, D->fragment[index].prefix) == 0 &&
+      strcmp(suffix, D->fragment[index].suffix) == 0)
+  {
+    dreturn("%i", 0);
+    return 0;
+  }
+
+  new_codes = _GD_CheckAffixes(D, index, prefix, suffix, NULL, &n);
+
+  if (D->error) {
+    for (u = 0; u < n; ++u)
+      free(new_codes[u]);
+    free(new_codes);
+    dreturn("%i", -1);
+    return -1;
+  }
+
+  _GD_ChangeAffixes(D, index, new_codes, &resort);
+
+  free(new_codes);
+
+  if (resort) {
+    /* resort */
+    qsort(D->entry, D->n_entries, sizeof(gd_entry_t*), _GD_EntryCmp);
+    qsort(D->dot_list, D->n_dot, sizeof(gd_entry_t*), _GD_EntryCmp);
+  }
+
+  dreturn("%i", 0);
+  return 0;
+}
+
 int gd_nfragments(DIRFILE* D) gd_nothrow
 {
   dtrace("%p", D);
@@ -83,3 +304,108 @@ int gd_parent_fragment(DIRFILE* D, int fragment_index) gd_nothrow
   dreturn("%i", D->fragment[fragment_index].parent);
   return D->fragment[fragment_index].parent;
 }
+
+/* returns non-zero if the metadata has changed on disk since the dirfile was
+ * opened and, optionally, re-opens the dirfile.
+ */
+int gd_desync(DIRFILE *D, unsigned int flags)
+{
+  int changed = 0, i;
+  struct stat statbuf;
+
+  dtrace("%p, 0x%x", D, flags);
+
+  /* if we can't open directories, we're stuck with the full path method */
+#ifdef GD_NO_DIR_OPEN
+  flags |= GD_DESYNC_PATHCHECK;
+#endif
+
+  _GD_ClearError(D);
+
+  if (D->flags & GD_INVALID) {
+    _GD_SetError(D, GD_E_BAD_DIRFILE, 0, NULL, 0, NULL);
+    dreturn("%i", 0);
+    return 0;
+  }
+
+  for (i = 0; i < D->n_fragment; ++i) {
+    if (flags & GD_DESYNC_PATHCHECK) {
+      /* stat the file via it's path relative to the original filedir */
+      char *buffer;
+      if (D->fragment[i].sname) {
+        buffer = (char*)_GD_Malloc(D, strlen(D->name) +
+            strlen(D->fragment[i].bname) + strlen(D->fragment[i].sname) + 3);
+        if (buffer == NULL) {
+          dreturn("%i", -1);
+          return -1;
+        }
+        sprintf(buffer, "%s%c%s%c%s", D->name, GD_DIRSEP, D->fragment[i].sname,
+            GD_DIRSEP, D->fragment[i].bname);
+      } else {
+        buffer = (char*)_GD_Malloc(D, strlen(D->name) +
+            strlen(D->fragment[i].bname) + 2);
+        if (buffer == NULL) {
+          dreturn("%i", -1);
+          return -1;
+        }
+        sprintf(buffer, "%s%c%s", D->name, GD_DIRSEP, D->fragment[i].bname);
+      }
+      if (stat(buffer, &statbuf)) {
+        _GD_SetError(D, GD_E_RAW_IO, 0, buffer, errno, NULL);
+        free(buffer);
+        dreturn("%i", -1);
+        return -1;
+      }
+      free(buffer);
+    } else
+      /* stat the file based on it's name and our cached dirfd */
+      if (gd_StatAt(D, D->fragment[i].dirfd, D->fragment[i].bname, &statbuf, 0))
+      {
+        _GD_SetError(D, GD_E_RAW_IO, 0, D->fragment[i].cname, errno, NULL);
+        dreturn("%i", -1);
+        return -1;
+      }
+
+    if (statbuf.st_mtime != D->fragment[i].mtime) {
+      changed = 1;
+      break;
+    }
+  }
+
+  if (changed && flags & GD_DESYNC_REOPEN) {
+    /* reopening is easy: just delete everything and start again.  In the
+     * non-PATHCHECK case, we also have to cache the dirfd to the root directory
+     */
+
+    /* remember how we were called */
+    char *name = D->name;
+    gd_parser_callback_t sehandler = D->sehandler;
+    void *extra = D->sehandler_extra;
+    unsigned long int flags = D->open_flags;
+    int dirfd = -1;
+
+    if (!(flags & GD_DESYNC_PATHCHECK)) {
+      dirfd = dup(D->fragment[0].dirfd);
+      if (dirfd == -1) {
+        _GD_SetError(D, GD_E_RAW_IO, 0, D->name, errno, NULL);
+        dreturn("%i", -1);
+        return -1;
+      }
+    }
+
+    D->name = NULL; /* so FreeD doesn't delete it */
+    if (_GD_ShutdownDirfile(D, 0, 1)) {
+      D->name = name;
+      dreturn("%i", -1);
+      return -1;
+    }
+    _GD_Open(D, dirfd, name, flags, sehandler, extra);
+    free(name);
+
+    if (D->error)
+      changed = -1;
+  }
+
+  dreturn("%i", changed);
+  return changed;
+}
diff --git a/src/gd_config.h.in b/src/gd_config.h.in
new file mode 100644
index 0000000..5b12fd0
--- /dev/null
+++ b/src/gd_config.h.in
@@ -0,0 +1,698 @@
+/* src/gd_config.h.in.  Generated from configure.ac by autoheader.  */
+
+/* Define if building universal (internal helper macro) */
+#undef AC_APPLE_UNIVERSAL_BUILD
+
+/* Define to 1 if your processor stores double-precision floats in the old ARM
+   middle-endian format */
+#undef ARM_ENDIAN_DOUBLES
+
+/* Define to the full path to the `bunzip2' binary */
+#undef BUNZIP2
+
+/* Define to the full path to the `bzip2' binary */
+#undef BZIP2
+
+/* Define to 1 if your C++ compiler doesn't accept -c and -o together. */
+#undef CXX_NO_MINUS_C_MINUS_O
+
+/* Define to dummy `main' function (if any) required to link to the Fortran
+   libraries. */
+#undef F77_DUMMY_MAIN
+
+/* Define to a macro mangling the given C identifier (in lower and upper
+   case), which must not contain underscores, for linking with Fortran. */
+#undef F77_FUNC
+
+/* As F77_FUNC, but for C identifiers containing underscores. */
+#undef F77_FUNC_
+
+/* Define to 1 if your Fortran compiler doesn't accept -c and -o together. */
+#undef F77_NO_MINUS_C_MINUS_O
+
+/* Define if F77 and FC dummy `main' functions are identical. */
+#undef FC_DUMMY_MAIN_EQ_F77
+
+/* Define to 1 if your Fortran compiler doesn't accept -c and -o together. */
+#undef FC_NO_MINUS_C_MINUS_O
+
+/* Define to 1 if your processor stores double-precision floats in big-endian
+   order */
+#undef FLOATS_BIGENDIAN
+
+/* The directory separator between path elements */
+#undef GD_DIRSEP
+
+/* Define to 1 if restrict can used on pointer arrays */
+#undef GD_RESTRICT_ARRAY_OK
+
+/* Define to enable debugging messages */
+#undef GETDATA_DEBUG
+
+/* The major version number */
+#undef GETDATA_MAJOR
+
+/* The minor version number */
+#undef GETDATA_MINOR
+
+/* The revision number */
+#undef GETDATA_REVISION
+
+/* Other qualifiers on the version number triplet (if any) */
+#undef GETDATA_VERSION_SUFFIX
+
+/* Define to the full path to the `gunzip' binary */
+#undef GUNZIP
+
+/* Define to the full path to the `gzip' binary */
+#undef GZIP
+
+/* Define to 1 if you have the <asm/unaligned.h> header file. */
+#undef HAVE_ASM_UNALIGNED_H
+
+/* Define to 1 if you have the <Availability.h> header file. */
+#undef HAVE_AVAILABILITY_H
+
+/* Define to 1 if you have the `basename' function. */
+#undef HAVE_BASENAME
+
+/* Define to 1 if you have the <byteswap.h> header file. */
+#undef HAVE_BYTESWAP_H
+
+/* Define to 1 if you have the <bzlib.h> header file. */
+#undef HAVE_BZLIB_H
+
+/* Define to 1 if you have the `cabs' function. */
+#undef HAVE_CABS
+
+/* Define to 1 if you have the <complex.h> header file. */
+#undef HAVE_COMPLEX_H
+
+/* Define to 1 if you have the declaration of `bswap16', and to 0 if you
+   don't. */
+#undef HAVE_DECL_BSWAP16
+
+/* Define to 1 if you have the declaration of `bswap_16', and to 0 if you
+   don't. */
+#undef HAVE_DECL_BSWAP_16
+
+/* Define to 1 if you have the declaration of `get_unaligned', and to 0 if you
+   don't. */
+#undef HAVE_DECL_GET_UNALIGNED
+
+/* Define to 1 if you have the declaration of `isfinite', and to 0 if you
+   don't. */
+#undef HAVE_DECL_ISFINITE
+
+/* Define to 1 if you have the declaration of `OSSwapInt16', and to 0 if you
+   don't. */
+#undef HAVE_DECL_OSSWAPINT16
+
+/* Define to 1 if you have the declaration of `put_unaligned', and to 0 if you
+   don't. */
+#undef HAVE_DECL_PUT_UNALIGNED
+
+/* Define to 1 if you have the declaration of `strerror_r', and to 0 if you
+   don't. */
+#undef HAVE_DECL_STRERROR_R
+
+/* Define to 1 if you have the <direct.h> header file. */
+#undef HAVE_DIRECT_H
+
+/* Define to 1 if you have the <dirent.h> header file, and it defines `DIR'.
+   */
+#undef HAVE_DIRENT_H
+
+/* Define to 1 if you have the <dlfcn.h> header file. */
+#undef HAVE_DLFCN_H
+
+/* Define to 1 if you have the `fchmod' function. */
+#undef HAVE_FCHMOD
+
+/* Define to 1 if you have the <fcntl.h> header file. */
+#undef HAVE_FCNTL_H
+
+/* Define to 1 if you have the `fdopendir' function. */
+#undef HAVE_FDOPENDIR
+
+/* Define to 1 if you have the <float.h> header file. */
+#undef HAVE_FLOAT_H
+
+/* Define to 1 if you have the `fork' function. */
+#undef HAVE_FORK
+
+/* Define to 1 if you have the `fpathconf' function. */
+#undef HAVE_FPATHCONF
+
+/* Define to 1 if you have the `fseeko' function. */
+#undef HAVE_FSEEKO
+
+/* Define to 1 if you have the `fseeko64' function. */
+#undef HAVE_FSEEKO64
+
+/* Define to 1 if you have the `fstat64' function. */
+#undef HAVE_FSTAT64
+
+/* Define to 1 if you have the `fstatat' function. */
+#undef HAVE_FSTATAT
+
+/* Define to 1 if you have the `fstatat64' function. */
+#undef HAVE_FSTATAT64
+
+/* Define to 1 if you have the `fsync' function. */
+#undef HAVE_FSYNC
+
+/* Define to 1 if you have the `ftello' function. */
+#undef HAVE_FTELLO
+
+/* Define to 1 if you have the `ftello64' function. */
+#undef HAVE_FTELLO64
+
+/* Define to 1 if you have the `ftruncate' function. */
+#undef HAVE_FTRUNCATE
+
+/* Define to 1 if you have the `ftruncate64' function. */
+#undef HAVE_FTRUNCATE64
+
+/* Define to 1 if you have the `getcwd' function. */
+#undef HAVE_GETCWD
+
+/* Define to 1 if you have the `getdelim' function. */
+#undef HAVE_GETDELIM
+
+/* Define to 1 if you have the `gmtime_r' function. */
+#undef HAVE_GMTIME_R
+
+/* Define to 1 if you have the <idl_export.h> header file. */
+#undef HAVE_IDL_EXPORT_H
+
+/* Define to 1 if you have the <inttypes.h> header file. */
+#undef HAVE_INTTYPES_H
+
+/* Define to 1 if you have the <io.h> header file. */
+#undef HAVE_IO_H
+
+/* Define to 1 if you have the `isnan' function. */
+#undef HAVE_ISNAN
+
+/* Define to 1 if you have the `bz2' library (-lbz2). */
+#undef HAVE_LIBBZ2
+
+/* Define to 1 if you have the <libgen.h> header file. */
+#undef HAVE_LIBGEN_H
+
+/* Define to 1 if you have the <libkern/OSByteOrder.h> header file. */
+#undef HAVE_LIBKERN_OSBYTEORDER_H
+
+/* Define to 1 if you have the `lzma' library (-llzma). */
+#undef HAVE_LIBLZMA
+
+/* Define to 1 if you have the `slim' library (-lslim). */
+#undef HAVE_LIBSLIM
+
+/* Define to 1 if you have the `z' library (-lz). */
+#undef HAVE_LIBZ
+
+/* Define to 1 if you have the `zzip' library (-lzzip). */
+#undef HAVE_LIBZZIP
+
+/* Define to 1 if you have the `lseek64' function. */
+#undef HAVE_LSEEK64
+
+/* Define to 1 if you have the `lstat' function. */
+#undef HAVE_LSTAT
+
+/* Define to 1 if you have the `lstat64' function. */
+#undef HAVE_LSTAT64
+
+/* Define to 1 if you have the <ltdl.h> header file. */
+#undef HAVE_LTDL_H
+
+/* Define to 1 if you have the <lzma.h> header file. */
+#undef HAVE_LZMA_H
+
+/* Define to 1 if you have the <math.h> header file. */
+#undef HAVE_MATH_H
+
+/* Define to 1 if you have the <memory.h> header file. */
+#undef HAVE_MEMORY_H
+
+/* Define to 1 if you have the `mkfifo' function. */
+#undef HAVE_MKFIFO
+
+/* Define to 1 if you have the `nan' function. */
+#undef HAVE_NAN
+
+/* Define to 1 if you have the <ndir.h> header file, and it defines `DIR'. */
+#undef HAVE_NDIR_H
+
+/* Define to 1 if you have the <numpy/arrayobject.h> header file. */
+#undef HAVE_NUMPY_ARRAYOBJECT_H
+
+/* Define to 1 if the system has the type `off64_t'. */
+#undef HAVE_OFF64_T
+
+/* Define to 1 if you have the `openat' function. */
+#undef HAVE_OPENAT
+
+/* Define to 1 if you have the `pathconf' function. */
+#undef HAVE_PATHCONF
+
+/* Define to 1 if you have the <pthread.h> header file. */
+#undef HAVE_PTHREAD_H
+
+/* Define to 1 if you have the <Python.h> header file. */
+#undef HAVE_PYTHON_H
+
+/* Define to 1 if you have the `readdir_r' function. */
+#undef HAVE_READDIR_R
+
+/* Define to 1 if you have the `readlink' function. */
+#undef HAVE_READLINK
+
+/* Define to 1 if you have the `renameat' function. */
+#undef HAVE_RENAMEAT
+
+/* Define to 1 if you have the `slimdopen' function. */
+#undef HAVE_SLIMDOPEN
+
+/* Define to 1 if you have the <slimlib.h> header file. */
+#undef HAVE_SLIMLIB_H
+
+/* Define to 1 if you have the `snprintf' function. */
+#undef HAVE_SNPRINTF
+
+/* Define to 1 if the system has the type `ssize_t'. */
+#undef HAVE_SSIZE_T
+
+/* Define to 1 if you have the `stat64' function. */
+#undef HAVE_STAT64
+
+/* Define to 1 if you have the <stddef.h> header file. */
+#undef HAVE_STDDEF_H
+
+/* Define to 1 if you have the <stdint.h> header file. */
+#undef HAVE_STDINT_H
+
+/* Define to 1 if you have the <stdlib.h> header file. */
+#undef HAVE_STDLIB_H
+
+/* Define to 1 if you have the `strerror_r' function. */
+#undef HAVE_STRERROR_R
+
+/* Define to 1 if you have the <strings.h> header file. */
+#undef HAVE_STRINGS_H
+
+/* Define to 1 if you have the <string.h> header file. */
+#undef HAVE_STRING_H
+
+/* Define to 1 if you have the `strtoll' function. */
+#undef HAVE_STRTOLL
+
+/* Define to 1 if you have the `strtoq' function. */
+#undef HAVE_STRTOQ
+
+/* Define to 1 if you have the `strtoull' function. */
+#undef HAVE_STRTOULL
+
+/* Define to 1 if you have the `strtouq' function. */
+#undef HAVE_STRTOUQ
+
+/* Define to 1 if you have the type `struct stat64' */
+#undef HAVE_STRUCT_STAT64
+
+/* Define to 1 if you have the type `struct _stat64' */
+#undef HAVE_STRUCT__STAT64
+
+/* Define to 1 if you have the type `struct __stat64' */
+#undef HAVE_STRUCT___STAT64
+
+/* Define to 1 if you have the `symlink' function. */
+#undef HAVE_SYMLINK
+
+/* Define to 1 if you have the <sys/dir.h> header file, and it defines `DIR'.
+   */
+#undef HAVE_SYS_DIR_H
+
+/* Define to 1 if you have the <sys/endian.h> header file. */
+#undef HAVE_SYS_ENDIAN_H
+
+/* Define to 1 if you have the <sys/file.h> header file. */
+#undef HAVE_SYS_FILE_H
+
+/* Define to 1 if you have the <sys/ndir.h> header file, and it defines `DIR'.
+   */
+#undef HAVE_SYS_NDIR_H
+
+/* Define to 1 if you have the <sys/param.h> header file. */
+#undef HAVE_SYS_PARAM_H
+
+/* Define to 1 if you have the <sys/stat.h> header file. */
+#undef HAVE_SYS_STAT_H
+
+/* Define to 1 if you have the <sys/types.h> header file. */
+#undef HAVE_SYS_TYPES_H
+
+/* Define to 1 if you have the <sys/wait.h> header file. */
+#undef HAVE_SYS_WAIT_H
+
+/* Define to 1 if you have the <unistd.h> header file. */
+#undef HAVE_UNISTD_H
+
+/* Define to 1 if you have the `unlinkat' function. */
+#undef HAVE_UNLINKAT
+
+/* Define to 1 if you have the `vfork' function. */
+#undef HAVE_VFORK
+
+/* Define to 1 if you have the <vfork.h> header file. */
+#undef HAVE_VFORK_H
+
+/* Define to 1 if `fork' works. */
+#undef HAVE_WORKING_FORK
+
+/* Define to 1 if `vfork' works. */
+#undef HAVE_WORKING_VFORK
+
+/* Define to 1 if you have the <zlib.h> header file. */
+#undef HAVE_ZLIB_H
+
+/* Define to 1 if you have the <zzip/lib.h> header file. */
+#undef HAVE_ZZIP_LIB_H
+
+/* Define to 1 if you have the `_chsize' function. */
+#undef HAVE__CHSIZE
+
+/* Define to 1 if you have the `_chsize_s' function. */
+#undef HAVE__CHSIZE_S
+
+/* Define to 1 if you have the `_commit' function. */
+#undef HAVE__COMMIT
+
+/* Define to 1 if the system has the type `_Complex double'. */
+#undef HAVE__COMPLEX_DOUBLE
+
+/* Define to 1 if the system has the type `_Complex float'. */
+#undef HAVE__COMPLEX_FLOAT
+
+/* Define to 1 if you have the `_fdopen' function. */
+#undef HAVE__FDOPEN
+
+/* Define to 1 if you have the `_finite' function. */
+#undef HAVE__FINITE
+
+/* Define to 1 if you have the `_fstat' function. */
+#undef HAVE__FSTAT
+
+/* Define to 1 if you have the `_fstat64' function. */
+#undef HAVE__FSTAT64
+
+/* Define to 1 if you have the `_getcwd' function. */
+#undef HAVE__GETCWD
+
+/* Define to 1 if you have the `_isnan' function. */
+#undef HAVE__ISNAN
+
+/* Define to 1 if you have the `_lseeki64' function. */
+#undef HAVE__LSEEKI64
+
+/* Define to 1 if you have the `_mkdir' function. */
+#undef HAVE__MKDIR
+
+/* Define to 1 if you have the `_open' function. */
+#undef HAVE__OPEN
+
+/* Define to 1 if you have the `_read' function. */
+#undef HAVE__READ
+
+/* Define to 1 if you have the `_rmdir' function. */
+#undef HAVE__RMDIR
+
+/* Define to 1 if you have the `_snprintf' function. */
+#undef HAVE__SNPRINTF
+
+/* Define to 1 if you have the `_stat64' function. */
+#undef HAVE__STAT64
+
+/* Define to 1 if you have the `_strtoi64' function. */
+#undef HAVE__STRTOI64
+
+/* Define to 1 if you have the `_strtoui64' function. */
+#undef HAVE__STRTOUI64
+
+/* Define to 1 if you have the `_unlink' function. */
+#undef HAVE__UNLINK
+
+/* Define to 1 if you have the `_write' function. */
+#undef HAVE__WRITE
+
+/* Define to the sub-directory in which libtool stores uninstalled libraries.
+   */
+#undef LT_OBJDIR
+
+/* Define to 1 if the `mkdir' function takes only one argument. */
+#undef MKDIR_NO_MODE
+
+/* Define to the full Win32 path to the `sh.exe' binary */
+#undef MSYS_SHELL
+
+/* Define to disable assertions */
+#undef NDEBUG
+
+/* Define to 1 if your C compiler doesn't accept -c and -o together. */
+#undef NO_MINUS_C_MINUS_O
+
+/* Name of package */
+#undef PACKAGE
+
+/* Define to the address where bug reports for this package should be sent. */
+#undef PACKAGE_BUGREPORT
+
+/* Define to the full name of this package. */
+#undef PACKAGE_NAME
+
+/* Define to the full name and version of this package. */
+#undef PACKAGE_STRING
+
+/* Define to the one symbol short name of this package. */
+#undef PACKAGE_TARNAME
+
+/* Define to the home page for this package. */
+#undef PACKAGE_URL
+
+/* Define to the version of this package. */
+#undef PACKAGE_VERSION
+
+/* The size of `int', as computed by sizeof. */
+#undef SIZEOF_INT
+
+/* The size of `long int', as computed by sizeof. */
+#undef SIZEOF_LONG_INT
+
+/* The size of `long long int', as computed by sizeof. */
+#undef SIZEOF_LONG_LONG_INT
+
+/* The size of `off_t', as computed by sizeof. */
+#undef SIZEOF_OFF_T
+
+/* The size of `short int', as computed by sizeof. */
+#undef SIZEOF_SHORT_INT
+
+/* The size of `size_t', as computed by sizeof. */
+#undef SIZEOF_SIZE_T
+
+/* The size of `unsigned int', as computed by sizeof. */
+#undef SIZEOF_UNSIGNED_INT
+
+/* The size of `unsigned long int', as computed by sizeof. */
+#undef SIZEOF_UNSIGNED_LONG_INT
+
+/* The size of `unsigned long long int', as computed by sizeof. */
+#undef SIZEOF_UNSIGNED_LONG_LONG_INT
+
+/* The size of `unsigned short int', as computed by sizeof. */
+#undef SIZEOF_UNSIGNED_SHORT_INT
+
+/* The size of `void *', as computed by sizeof. */
+#undef SIZEOF_VOID_P
+
+/* Define to the full path to the `slim' binary */
+#undef SLIM
+
+/* Define to 1 if you have the ANSI C header files. */
+#undef STDC_HEADERS
+
+/* Define to 1 if strerror_r returns char *. */
+#undef STRERROR_R_CHAR_P
+
+/* Define to enable bzip2 tests */
+#undef TEST_BZIP2
+
+/* Define to enable gzip tests */
+#undef TEST_GZIP
+
+/* Define to enable lzma tests */
+#undef TEST_LZMA
+
+/* Define to enable slim tests */
+#undef TEST_SLIM
+
+/* Define to enable zzip tests */
+#undef TEST_ZZIP
+
+/* Define to 1 if the platform supports fast unaligned memory access */
+#undef UNALIGNED_ACCESS_OK
+
+/* Define to the full path to the `unslim' binary */
+#undef UNSLIM
+
+/* Define to the full path to the `unzip' binary */
+#undef UNZIP
+
+/* Define to enable bzip2 support */
+#undef USE_BZIP2
+
+/* Define to enable gzip support */
+#undef USE_GZIP
+
+/* Define to enable lzma support */
+#undef USE_LZMA
+
+/* Define if building with modules */
+#undef USE_MODULES
+
+/* Define to enable NumPy support in the Python bindings */
+#undef USE_NUMPY
+
+/* Define if you have a POSIX compliant thread library */
+#undef USE_PTHREAD
+
+/* Define to enable slim support */
+#undef USE_SLIM
+
+/* Define to enable zzip support */
+#undef USE_ZZIP
+
+/* Define to enable zzslim support */
+#undef USE_ZZSLIM
+
+/* Version number of package */
+#undef VERSION
+
+/* Define WORDS_BIGENDIAN to 1 if your processor stores words with the most
+   significant byte first (like Motorola and SPARC, unlike Intel). */
+#if defined AC_APPLE_UNIVERSAL_BUILD
+# if defined __BIG_ENDIAN__
+#  define WORDS_BIGENDIAN 1
+# endif
+#else
+# ifndef WORDS_BIGENDIAN
+#  undef WORDS_BIGENDIAN
+# endif
+#endif
+
+/* Define to the full path to the `xz' binary */
+#undef XZ
+
+/* Define to the full path to the `zip' binary */
+#undef ZIP
+
+/* Expose BSD-derived definitions */
+#undef _BSD_SOURCE
+
+/* Expose GNU extensions */
+#undef _GNU_SOURCE
+
+/* Expose POSIX:2008 conforming definitions */
+#undef _POSIX_C_SOURCE
+
+/* Expose POSIX.1-1990 conforming definitions */
+#undef _POSIX_SOURCE
+
+/* Expose System V-derived definitions */
+#undef _SVID_SOURCE
+
+/* Define for Solaris 2.5.1 so the uint32_t typedef from <sys/synch.h>,
+   <pthread.h>, or <semaphore.h> is not used. If the typedef were allowed, the
+   #define below would cause a syntax error. */
+#undef _UINT32_T
+
+/* Define for Solaris 2.5.1 so the uint64_t typedef from <sys/synch.h>,
+   <pthread.h>, or <semaphore.h> is not used. If the typedef were allowed, the
+   #define below would cause a syntax error. */
+#undef _UINT64_T
+
+/* Define for Solaris 2.5.1 so the uint8_t typedef from <sys/synch.h>,
+   <pthread.h>, or <semaphore.h> is not used. If the typedef were allowed, the
+   #define below would cause a syntax error. */
+#undef _UINT8_T
+
+/* If compiling aginst the MSVCRT, define to 0x601 */
+#undef __MSVCRT_VERSION__
+
+/* Define to empty if `const' does not conform to ANSI C. */
+#undef const
+
+/* Define to `__inline__' or `__inline' if that's what the C compiler
+   calls it, or to nothing if 'inline' is not supported under any name.  */
+#ifndef __cplusplus
+#undef inline
+#endif
+
+/* Define to the type of a signed integer type of width exactly 16 bits if
+   such a type exists and the standard includes do not define it. */
+#undef int16_t
+
+/* Define to the type of a signed integer type of width exactly 32 bits if
+   such a type exists and the standard includes do not define it. */
+#undef int32_t
+
+/* Define to the type of a signed integer type of width exactly 64 bits if
+   such a type exists and the standard includes do not define it. */
+#undef int64_t
+
+/* Define to the type of a signed integer type of width exactly 8 bits if such
+   a type exists and the standard includes do not define it. */
+#undef int8_t
+
+/* Define to `long int' if <sys/types.h> does not define. */
+#undef off_t
+
+/* Define to `int' if <sys/types.h> does not define. */
+#undef pid_t
+
+/* Define to the equivalent of the C99 'restrict' keyword, or to
+   nothing if this is not supported.  Do not define if restrict is
+   supported directly.  */
+#undef restrict
+/* Work around a bug in Sun C++: it does not support _Restrict or
+   __restrict__, even though the corresponding Sun C compiler ends up with
+   "#define restrict _Restrict" or "#define restrict __restrict__" in the
+   previous line.  Perhaps some future version of Sun C++ will work with
+   restrict; if so, hopefully it defines __RESTRICT like Sun C does.  */
+#if defined __SUNPRO_CC && !defined __RESTRICT
+# define _Restrict
+# define __restrict__
+#endif
+
+/* Define to `unsigned int' if <sys/types.h> does not define. */
+#undef size_t
+
+/* Define to the type of an unsigned integer type of width exactly 16 bits if
+   such a type exists and the standard includes do not define it. */
+#undef uint16_t
+
+/* Define to the type of an unsigned integer type of width exactly 32 bits if
+   such a type exists and the standard includes do not define it. */
+#undef uint32_t
+
+/* Define to the type of an unsigned integer type of width exactly 64 bits if
+   such a type exists and the standard includes do not define it. */
+#undef uint64_t
+
+/* Define to the type of an unsigned integer type of width exactly 8 bits if
+   such a type exists and the standard includes do not define it. */
+#undef uint8_t
+
+/* Define as `fork' if `vfork' does not work. */
+#undef vfork
diff --git a/src/getdata.c b/src/getdata.c
index 6e3e1b0..5d420c1 100644
--- a/src/getdata.c
+++ b/src/getdata.c
@@ -1,5 +1,5 @@
 /* Copyright (C) 2002-2005 C. Barth Netterfield
- * Copyright (C) 2005-2010 D. V. Wiebe
+ * Copyright (C) 2005-2012 D. V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,16 +21,6 @@
  */
 #include "internal.h"
 
-#ifdef STDC_HEADERS
-#include <inttypes.h>
-#include <errno.h>
-#include <fcntl.h>
-#include <sys/stat.h>
-#include <math.h>
-#include <stdlib.h>
-#include <string.h>
-#endif
-
 #include "nan.h"
 
 #define EXTRACT_REPR(it,ot,f) \
@@ -109,13 +99,13 @@
 #endif
 
 
-static void _GD_ExtractRepr(DIRFILE* D, const void* cdata, gd_type_t in_type,
-    void* rdata, gd_type_t type, size_t n, int repr)
+static void _GD_ExtractRepr(DIRFILE *restrict D, const void *restrict cdata,
+    gd_type_t in_type, void *restrict rdata, gd_type_t type, size_t n, int repr)
 {
   size_t i;
 
-  dtrace("%p, %p, %x, %p, %x, %zu, %i", D, cdata, in_type, rdata, type, n,
-      repr);
+  dtrace("%p, %p, 0x%X, %p, 0x%X, %" PRNsize_t ", %i", D, cdata, in_type, rdata,
+      type, n, repr);
 
   switch (type) {
     case GD_UINT8:      EXTRACT_REPRS(       uint8_t); break;
@@ -158,6 +148,8 @@ static void _GD_ExtractRepr(DIRFILE* D, const void* cdata, gd_type_t in_type,
       _GD_SetError(D, GD_E_BAD_TYPE, type, NULL, 0, NULL);
       break;
   }
+
+  dreturnvoid();
 }
 
 /* _GD_FillFileFrame: fill dataout with frame indices
@@ -167,7 +159,7 @@ static void _GD_FillFileFrame(void *dataout, gd_type_t rtype, off64_t s0,
 {
   size_t i;
 
-  dtrace("%p, 0x%x, %lli, %zu", dataout, rtype, s0, n);
+  dtrace("%p, 0x%X, %lli, %" PRNsize_t, dataout, rtype, (long long)s0, n);
 
   switch (rtype) {
     case GD_INT8:
@@ -212,11 +204,11 @@ static void _GD_FillFileFrame(void *dataout, gd_type_t rtype, off64_t s0,
       break;
     case GD_COMPLEX64:
       for (i = 0; i < n; i++)
-        _gd_r2ca(dataout, i, i + s0, float);
+        gd_rs2ca_(dataout, i, i + s0, float);
       break;
     case GD_COMPLEX128:
       for (i = 0; i < n; i++)
-        _gd_r2ca(dataout, i, i + s0, double);
+        gd_rs2ca_(dataout, i, i + s0, double);
       break;
     default:
       break;
@@ -232,7 +224,7 @@ static int _GD_FillZero(void *databuffer, gd_type_t type, size_t nz)
   size_t i;
   const double NaN = NAN;
 
-  dtrace("%p, 0x%x, %zu", databuffer, type, nz);
+  dtrace("%p, 0x%X, %" PRNsize_t, databuffer, type, nz);
 
   if (type & GD_IEEE754) {
     if (type == GD_FLOAT32)
@@ -248,25 +240,26 @@ static int _GD_FillZero(void *databuffer, gd_type_t type, size_t nz)
     else
       for (i = 0; i < 2 * nz; ++i)
         *((double *)databuffer + i) = (double) NaN;
-  } else 
+  } else
     memset(databuffer, 0, nz * GD_SIZE(type));
 
-  dreturn("%zu", nz);
+  dreturn("%" PRNsize_t, nz);
 
   return (nz);
 }
 
 /* _GD_DoRaw:  Read from a raw.  Returns number of samples read.
 */
-static size_t _GD_DoRaw(DIRFILE *D, gd_entry_t *E, off64_t s0, size_t ns,
-    gd_type_t return_type, void *data_out)
+static size_t _GD_DoRaw(DIRFILE *restrict D, gd_entry_t *restrict E, off64_t s0,
+    size_t ns, gd_type_t return_type, void *restrict data_out)
 {
   size_t n_read = 0;
   ssize_t samples_read;
   char *databuffer;
   size_t zero_pad = 0;
 
-  dtrace("%p, %p, %lli, %zu, 0x%x, %p)", D, E, s0, ns, return_type, data_out);
+  dtrace("%p, %p, %lli, %" PRNsize_t ", 0x%X, %p)", D, E, (long long)s0, ns,
+      return_type, data_out);
 
   if (s0 < E->EN(raw,spf) * D->fragment[E->fragment_index].frame_offset)
     zero_pad = E->EN(raw,spf) * D->fragment[E->fragment_index].frame_offset -
@@ -274,9 +267,8 @@ static size_t _GD_DoRaw(DIRFILE *D, gd_entry_t *E, off64_t s0, size_t ns,
   else
     s0 -= E->EN(raw,spf) * D->fragment[E->fragment_index].frame_offset;
 
-  databuffer = (char *)malloc(ns * E->e->u.raw.size);
+  databuffer = (char *)_GD_Malloc(D, ns * E->e->u.raw.size);
   if (databuffer == NULL) {
-    _GD_SetError(D, GD_E_ALLOC, 0, NULL, 0, NULL);
     dreturn("%i", 0);
     return 0;
   }
@@ -286,35 +278,23 @@ static size_t _GD_DoRaw(DIRFILE *D, gd_entry_t *E, off64_t s0, size_t ns,
         ns :
         zero_pad);
     ns -= n_read;
+    E->e->u.raw.file[0].pos = s0 + n_read - E->EN(raw,spf) *
+      D->fragment[E->fragment_index].frame_offset;
     s0 = 0;
   }
 
   if (ns > 0) {
     /** open the file (and cache the fp) if it hasn't been opened yet. */
-    if (E->e->u.raw.file[0].fp < 0) {
-      if (!_GD_Supports(D, E, GD_EF_OPEN | GD_EF_SEEK | GD_EF_READ)) {
-        free(databuffer);
-        dreturn("%i", 0);
-        return 0;
-      } else if (_GD_SetEncodedName(D, E->e->u.raw.file, E->e->u.raw.filebase,
-            0))
-      {
-        free(databuffer);
-        dreturn("%i", 0);
-        return 0;
-      } else if ((*_gd_ef[E->e->u.raw.file[0].encoding].open)(E->e->u.raw.file,
-            D->flags & GD_ACCMODE, 0))
-      {
-        _GD_SetError(D, GD_E_RAW_IO, 0, E->e->u.raw.file[0].name, errno,
-            NULL);
-        free(databuffer);
-        dreturn("%i", 0);
-        return 0;
-      }
+    if (_GD_InitRawIO(D, E, NULL, 0, NULL, GD_EF_SEEK | GD_EF_READ,
+          GD_FILE_READ, 0))
+    {
+      free(databuffer);
+      dreturn("%i", 0);
+      return 0;
     }
 
-    if ((*_gd_ef[E->e->u.raw.file[0].encoding].seek)(E->e->u.raw.file, s0,
-          E->EN(raw,data_type), 0) == -1)
+    if ((*gd_ef_[E->e->u.raw.file[0].subenc].seek)(E->e->u.raw.file, s0,
+          E->EN(raw,data_type), GD_FILE_READ) == -1)
     {
       _GD_SetError(D, GD_E_RAW_IO, 0, E->e->u.raw.file[0].name, errno, NULL);
       free(databuffer);
@@ -323,8 +303,8 @@ static size_t _GD_DoRaw(DIRFILE *D, gd_entry_t *E, off64_t s0, size_t ns,
     }
 
     samples_read =
-      (*_gd_ef[E->e->u.raw.file[0].encoding].read)(E->e->u.raw.file,
-        databuffer + n_read * E->e->u.raw.size, E->EN(raw,data_type), ns);
+      (*gd_ef_[E->e->u.raw.file[0].subenc].read)(E->e->u.raw.file,
+          databuffer + n_read * E->e->u.raw.size, E->EN(raw,data_type), ns);
 
     if (samples_read == -1) {
       _GD_SetError(D, GD_E_RAW_IO, 0, E->e->u.raw.file[0].name, errno, NULL);
@@ -333,7 +313,7 @@ static size_t _GD_DoRaw(DIRFILE *D, gd_entry_t *E, off64_t s0, size_t ns,
       return 0;
     }
 
-    if (_gd_ef[E->e->u.raw.file[0].encoding].ecor) {
+    if (gd_ef_[E->e->u.raw.file[0].subenc].flags & GD_EF_ECOR) {
       /* convert to/from middle-ended doubles */
       if ((E->EN(raw,data_type) == GD_FLOAT64 ||
             E->EN(raw,data_type) == GD_COMPLEX128) &&
@@ -345,11 +325,11 @@ static size_t _GD_DoRaw(DIRFILE *D, gd_entry_t *E, off64_t s0, size_t ns,
 
       if (D->fragment[E->fragment_index].byte_sex &
 #ifdef WORDS_BIGENDIAN
-             GD_LITTLE_ENDIAN
+          GD_LITTLE_ENDIAN
 #else
-             GD_BIG_ENDIAN
+          GD_BIG_ENDIAN
 #endif
-             )
+         )
       {
         if (E->EN(raw,data_type) & GD_COMPLEX)
           _GD_FixEndianness(databuffer + n_read * E->e->u.raw.size,
@@ -367,7 +347,7 @@ static size_t _GD_DoRaw(DIRFILE *D, gd_entry_t *E, off64_t s0, size_t ns,
 
   free(databuffer);
 
-  dreturn("%zu", (D->error == GD_E_OK) ? n_read : (size_t)0);
+  dreturn("%" PRNsize_t, (D->error == GD_E_OK) ? n_read : (size_t)0);
   return (D->error == GD_E_OK) ? n_read : (size_t)0;
 }
 
@@ -428,12 +408,12 @@ static size_t _GD_DoRaw(DIRFILE *D, gd_entry_t *E, off64_t s0, size_t ns,
 /* _GD_PolynomData: Compute data = Sum(i=0..n; data**i * a[i]), for scalar a,
  * and integer 2 <= n < GD_MAX_POLYORD
  */
-static void _GD_PolynomData(DIRFILE* D, void *data, gd_type_t type, size_t npts,
-    int n, double* a)
+static void _GD_PolynomData(DIRFILE *restrict D, void *restrict data,
+    gd_type_t type, size_t npts, int n, const double *restrict a)
 {
   size_t i;
 
-  dtrace("%p, %p, 0x%x, %zu, %i, %p", D, data, type, npts, n, a);
+  dtrace("%p, %p, 0x%X, %" PRNsize_t ", %i, %p", D, data, type, npts, n, a);
 
   if (n == 1) {
     /* no need to duplicate this case */
@@ -615,12 +595,12 @@ static void _GD_PolynomData(DIRFILE* D, void *data, gd_type_t type, size_t npts,
 /* _GD_CPolynomData: Compute data = Sum(i=0..n; data**i * a[i]), for complex
  * scalar a, and integer 2 <= n < GD_MAX_POLYORD
  */
-static void _GD_CPolynomData(DIRFILE* D, void *data, gd_type_t type,
-    size_t npts, int n, GD_DCOMPLEXV(a))
+static void _GD_CPolynomData(DIRFILE *restrict D, void *restrict data,
+    gd_type_t type, size_t npts, int n, GD_DCOMPLEXV(a))
 {
   size_t i;
 
-  dtrace("%p, %p, 0x%x, %zu, %i, %p", D, data, type, npts, n, a);
+  dtrace("%p, %p, 0x%X, %" PRNsize_t ", %i, %p", D, data, type, npts, n, a);
 
   if (n == 1) {
     /* no need to duplicate this case */
@@ -665,12 +645,12 @@ static void _GD_CPolynomData(DIRFILE* D, void *data, gd_type_t type,
 
 /* MultiplyData: Multiply A by B.  B is unchanged.
 */
-static void _GD_MultiplyData(DIRFILE* D, void *A, gd_spf_t spfA, double *B,
-    gd_spf_t spfB, gd_type_t type, size_t n)
+static void _GD_MultiplyData(DIRFILE *restrict D, void *restrict A,
+    unsigned int spfA, double *B, unsigned int spfB, gd_type_t type, size_t n)
 {
   size_t i;
 
-  dtrace("%p, %p, %u, %p, %u, 0x%x, %zu", D, A, spfA, B, spfB, type, n);
+  dtrace("%p, %p, %u, %p, %u, 0x%X, %" PRNsize_t, D, A, spfA, B, spfB, type, n);
 
   switch (type) {
     case GD_NULL:                           break;
@@ -716,12 +696,13 @@ static void _GD_MultiplyData(DIRFILE* D, void *A, gd_spf_t spfA, double *B,
 
 /* CMultiplyData: Multiply A by B.  B is complex.
 */
-static void _GD_CMultiplyData(DIRFILE* D, void *A, gd_spf_t spfA,
-    GD_DCOMPLEXP(B), gd_spf_t spfB, gd_type_t type, size_t n)
+static void _GD_CMultiplyData(DIRFILE *restrict D, void *restrict A,
+    unsigned int spfA, GD_DCOMPLEXP(B), unsigned int spfB, gd_type_t type,
+    size_t n)
 {
   size_t i;
 
-  dtrace("%p, %p, %u, %p, %u, 0x%x, %zu", D, A, spfA, B, spfB, type, n);
+  dtrace("%p, %p, %u, %p, %u, 0x%X, %" PRNsize_t, D, A, spfA, B, spfB, type, n);
 
   switch (type) {
     case GD_NULL:                           break;
@@ -761,12 +742,13 @@ static void _GD_CMultiplyData(DIRFILE* D, void *A, gd_spf_t spfA,
 
 /* DivideData: Divide B by A.  B is unchanged.
 */
-static void _GD_DivideData(DIRFILE *D, void *A, gd_spf_t spfA, double *B,
-    gd_spf_t spfB, gd_type_t type, size_t n)
+static void _GD_DivideData(DIRFILE *restrict D, void *restrict A,
+    unsigned int spfA, double *restrict B, unsigned int spfB, gd_type_t type,
+    size_t n)
 {
   size_t i;
 
-  dtrace("%p, %p, %u, %p, %u, 0x%x, %zu", D, A, spfA, B, spfB, type, n);
+  dtrace("%p, %p, %u, %p, %u, 0x%X, %" PRNsize_t, D, A, spfA, B, spfB, type, n);
 
   switch (type) {
     case GD_NULL:                         break;
@@ -813,12 +795,13 @@ static void _GD_DivideData(DIRFILE *D, void *A, gd_spf_t spfA, double *B,
 
 /* CDivideData: Divide A by B.  B is complex.
 */
-static void _GD_CDivideData(DIRFILE *D, void *A, gd_spf_t spfA,
-    GD_DCOMPLEXP(B), gd_spf_t spfB, gd_type_t type, size_t n)
+static void _GD_CDivideData(DIRFILE *restrict D, void *restrict A,
+    unsigned int spfA, GD_DCOMPLEXP(B), unsigned int spfB, gd_type_t type,
+    size_t n)
 {
   size_t i;
 
-  dtrace("%p, %p, %u, %p, %u, 0x%x, %zu", D, A, spfA, B, spfB, type, n);
+  dtrace("%p, %p, %u, %p, %u, 0x%X, %" PRNsize_t, D, A, spfA, B, spfB, type, n);
 
   switch (type) {
     case GD_NULL:                         break;
@@ -841,12 +824,142 @@ static void _GD_CDivideData(DIRFILE *D, void *A, gd_spf_t spfA,
   dreturnvoid();
 }
 
+#define WINDOP(ot,ct,bo,op,tt,z) \
+  for (i = 0; i < n; i++) \
+    if (!((bo(((ct*)B)[i * spfB / spfA])) op threshold.tt)) \
+      ((ot*)A)[i] = (ot)(z)
+
+#define WINDOPC(ot,ct,bo,op,tt,z) \
+  for (i = 0; i < n; i++) \
+    if (!((bo(((ct*)B)[i * spfB / spfA])) op threshold.tt)) \
+      ((ot*)A)[i * 2] = ((ot*)A)[i * 2 + 1] = (ot)(z)
+
+#define WINDOW(t,z) \
+  switch (op) { \
+    case GD_WINDOP_EQ:  WINDOP(t, int64_t, ,==,i,z); break; \
+    case GD_WINDOP_GE:  WINDOP(t,  double, ,>=,r,z); break; \
+    case GD_WINDOP_GT:  WINDOP(t,  double, ,> ,r,z); break; \
+    case GD_WINDOP_LE:  WINDOP(t,  double, ,<=,r,z); break; \
+    case GD_WINDOP_LT:  WINDOP(t,  double, ,< ,r,z); break; \
+    case GD_WINDOP_NE:  WINDOP(t, int64_t, ,!=,i,z); break; \
+    case GD_WINDOP_SET: WINDOP(t,uint64_t, ,& ,u,z); break; \
+    case GD_WINDOP_CLR: WINDOP(t,uint64_t,~,& ,u,z); break; \
+    default: \
+      _GD_InternalError(D); \
+  }
+
+#define WINDOWC(t,z) \
+  switch (op) { \
+    case GD_WINDOP_EQ:  WINDOPC(t, int64_t, ,==,i,z); break; \
+    case GD_WINDOP_GE:  WINDOPC(t,  double, ,>=,r,z); break; \
+    case GD_WINDOP_GT:  WINDOPC(t,  double, ,> ,r,z); break; \
+    case GD_WINDOP_LE:  WINDOPC(t,  double, ,<=,r,z); break; \
+    case GD_WINDOP_LT:  WINDOPC(t,  double, ,< ,r,z); break; \
+    case GD_WINDOP_NE:  WINDOPC(t, int64_t, ,!=,i,z); break; \
+    case GD_WINDOP_SET: WINDOPC(t,uint64_t, ,& ,u,z); break; \
+    case GD_WINDOP_CLR: WINDOPC(t,uint64_t,~,& ,u,z); break; \
+    default: \
+      _GD_InternalError(D); \
+  }
+
+/* WindowData: Zero data in A where the condition is false.  B is unchanged.
+*/
+static void _GD_WindowData(DIRFILE *restrict D, void *restrict A,
+    unsigned int spfA, void *restrict B, unsigned int spfB, gd_type_t type,
+    gd_windop_t op, gd_triplet_t threshold, size_t n)
+{
+  size_t i;
+  const double NaN = NAN;
+
+  dtrace("%p, %p, %u, %p, %u, 0x%X, %i, {%g,%llx,%lli}, %" PRNsize_t, D, A,
+      spfA, B, spfB, type, op, threshold.r, (unsigned long long)threshold.u,
+      (long long)threshold.i, n);
+
+  switch (type) {
+    case GD_NULL:                            break;
+    case GD_UINT8:      WINDOW( uint8_t,  0) break;
+    case GD_INT8:       WINDOW(  int8_t,  0) break;
+    case GD_UINT16:     WINDOW(uint16_t,  0) break;
+    case GD_INT16:      WINDOW( int16_t,  0) break;
+    case GD_UINT32:     WINDOW(uint32_t,  0) break;
+    case GD_INT32:      WINDOW( int32_t,  0) break;
+    case GD_UINT64:     WINDOW(uint64_t,  0) break;
+    case GD_INT64:      WINDOW( int64_t,  0) break;
+    case GD_FLOAT32:    WINDOW(   float,NaN) break;
+    case GD_FLOAT64:    WINDOW(  double,NaN) break;
+    case GD_COMPLEX64:  WINDOWC(  float,NaN) break;
+    case GD_COMPLEX128: WINDOWC( double,NaN) break;
+    default:            _GD_SetError(D, GD_E_BAD_TYPE, type, NULL, 0, NULL);
+                        break;
+  }
+
+  dreturnvoid();
+}
+
+#define MPLEX(t) \
+  do { \
+    t last = *(t*)start; \
+    for (i = 0; i < n; i++) {\
+      if (B[i * spfB / spfA] == val) \
+        last = ((t*)A)[i]; \
+      else \
+        ((t*)A)[i] = last; \
+    } \
+  } while(0)
+
+#define MPLEXC(t) \
+  do { \
+    t rlast, ilast; \
+    rlast = *(t*)start; \
+    ilast = ((t*)start)[1]; \
+    for (i = 0; i < n; i++) \
+      if (B[i * spfB / spfA] == val) { \
+        rlast = ((t*)A)[i * 2]; \
+        ilast = ((t*)A)[i * 2 + 1]; \
+      } else { \
+        ((t*)A)[i * 2] = rlast; \
+        ((t*)A)[i * 2 + 1] = ilast; \
+      } \
+  } while(0)
+
+/* demultiplex data */
+static void _GD_MplexData(DIRFILE *restrict D, void *restrict A,
+    unsigned int spfA, const int *restrict B, unsigned int spfB, gd_type_t type,
+    int val, void *restrict start, size_t n)
+{
+  size_t i;
+
+  dtrace("%p, %p, %u, %p, %u, 0x%X, %i, %p, %" PRNsize_t, D, A, spfA, B, spfB,
+      type, val, start, n);
+
+  switch (type) {
+    case GD_NULL:                        break;
+    case GD_UINT8:      MPLEX( uint8_t); break;
+    case GD_INT8:       MPLEX(  int8_t); break;
+    case GD_UINT16:     MPLEX(uint16_t); break;
+    case GD_INT16:      MPLEX( int16_t); break;
+    case GD_UINT32:     MPLEX(uint32_t); break;
+    case GD_INT32:      MPLEX( int32_t); break;
+    case GD_UINT64:     MPLEX(uint64_t); break;
+    case GD_INT64:      MPLEX( int64_t); break;
+    case GD_FLOAT32:    MPLEX(   float); break;
+    case GD_FLOAT64:    MPLEX(  double); break;
+    case GD_COMPLEX64:  MPLEXC(  float); break;
+    case GD_COMPLEX128: MPLEXC( double); break;
+    default:            _GD_SetError(D, GD_E_BAD_TYPE, type, NULL, 0, NULL);
+                        break;
+  }
+
+  dreturnvoid();
+}
+
 /* _GD_DoLincom:  Read from a lincom.  Returns number of samples read.
 */
-static size_t _GD_DoLincom(DIRFILE *D, gd_entry_t *E, off64_t first_samp,
-    size_t num_samp, gd_type_t return_type, void *data_out)
+static size_t _GD_DoLincom(DIRFILE *restrict D, gd_entry_t *restrict E,
+    off64_t first_samp, size_t num_samp, gd_type_t return_type,
+    void *restrict data_out)
 {
-  gd_spf_t spf[GD_MAX_LINCOM];
+  unsigned int spf[GD_MAX_LINCOM];
   size_t n_read;
   int i;
   void *tmpbuf2 = NULL;
@@ -854,17 +967,17 @@ static size_t _GD_DoLincom(DIRFILE *D, gd_entry_t *E, off64_t first_samp,
   const gd_type_t ntype = (return_type & GD_COMPLEX) ? GD_COMPLEX128
     : GD_FLOAT64;
 
-  dtrace("%p, %p, %lli, %zu, 0x%x, %p", D, E, first_samp, num_samp, return_type,
-      data_out);
+  dtrace("%p, %p, %lli, %" PRNsize_t ", 0x%X, %p", D, E, (long long)first_samp,
+      num_samp, return_type, data_out);
 
   /* input field checks */
   for (i = 0; i < E->EN(lincom,n_fields); ++i) {
-    if (_GD_BadInput(D, E, i)) {
+    if (_GD_BadInput(D, E, i, 1)) {
       dreturn("%i", 0);
       return 0;
     }
 
-    spf[i] = _GD_GetSPF(D, E->e->entry[0]);
+    spf[i] = _GD_GetSPF(D, E->e->entry[i]);
     if (D->error != GD_E_OK) {
       dreturn("%i", 0);
       return 0;
@@ -891,10 +1004,10 @@ static size_t _GD_DoLincom(DIRFILE *D, gd_entry_t *E, off64_t first_samp,
   /* Some dirfiles use "bar LINCOM foo 1 0" to rename <foo> to <bar>.  I
    * recommend using "bar PHASE foo 0" in this case, but we'll accomodate them
    * as much as we can.  Suggested by MDT. */
-  if (E->EN(lincom,n_fields) == 1 && _gd_ccmpl(E->EN(lincom,cm)[0],1,0) &&
-      _gd_ccmpl(E->EN(lincom,cb)[0],0,0))
+  if (E->EN(lincom,n_fields) == 1 && gd_ccmpl_(E->EN(lincom,cm)[0],1,0) &&
+      gd_ccmpl_(E->EN(lincom,cb)[0],0,0))
   {
-    dreturn("%zu", n_read);
+    dreturn("%" PRNsize_t, n_read);
     return n_read;
   }
 
@@ -972,31 +1085,32 @@ static size_t _GD_DoLincom(DIRFILE *D, gd_entry_t *E, off64_t first_samp,
   if (D->error)
     n_read = 0;
 
-  dreturn("%zu", n_read);
+  dreturn("%" PRNsize_t, n_read);
   return n_read;
 }
 
 /* _GD_DoMultiply:  Read from a multiply.  Returns number of samples read.
 */
-static size_t _GD_DoMultiply(DIRFILE *D, gd_entry_t* E, off64_t first_samp,
-    size_t num_samp, gd_type_t return_type, void *data_out)
+static size_t _GD_DoMultiply(DIRFILE *restrict D, gd_entry_t *restrict E,
+    off64_t first_samp, size_t num_samp, gd_type_t return_type,
+    void *restrict data_out)
 {
   void *tmpbuf = NULL;
-  gd_spf_t spf1, spf2;
+  unsigned int spf1, spf2;
   size_t n_read, n_read2, num_samp2;
   off64_t first_samp2;
   gd_type_t type2;
 
-  dtrace("%p, %p, %lli, %zu, 0x%x, %p", D, E, first_samp, num_samp, return_type,
-      data_out);
+  dtrace("%p, %p, %lli, %" PRNsize_t ", 0x%X, %p", D, E, (long long)first_samp,
+      num_samp, return_type, data_out);
 
   /* Check input fields */
-  if (_GD_BadInput(D, E, 0)) {
+  if (_GD_BadInput(D, E, 0, 1)) {
     dreturn("%i", 0);
     return 0;
   }
 
-  if (_GD_BadInput(D, E, 1)) {
+  if (_GD_BadInput(D, E, 1, 1)) {
     dreturn("%i", 0);
     return 0;
   }
@@ -1070,22 +1184,23 @@ static size_t _GD_DoMultiply(DIRFILE *D, gd_entry_t* E, off64_t first_samp,
 
   free(tmpbuf);
 
-  dreturn("%zu", n_read);
+  dreturn("%" PRNsize_t, n_read);
   return n_read;
 }
 
 /* _GD_DoRecip:  Read from a recip.  Returns number of samples read.
 */
-static size_t _GD_DoRecip(DIRFILE *D, gd_entry_t* E, off64_t first_samp,
-    size_t num_samp, gd_type_t return_type, void *data_out)
+static size_t _GD_DoRecip(DIRFILE *restrict D, gd_entry_t *restrict E,
+    off64_t first_samp, size_t num_samp, gd_type_t return_type,
+    void *restrict data_out)
 {
   size_t n_read;
 
-  dtrace("%p, %p, %lli, %zu, 0x%x, %p", D, E, first_samp, num_samp, return_type,
-      data_out);
+  dtrace("%p, %p, %lli, %" PRNsize_t ", 0x%X, %p", D, E, (long long)first_samp,
+      num_samp, return_type, data_out);
 
   /* Check input fields */
-  if (_GD_BadInput(D, E, 0)) {
+  if (_GD_BadInput(D, E, 0, 1)) {
     dreturn("%i", 0);
     return 0;
   }
@@ -1111,26 +1226,27 @@ static size_t _GD_DoRecip(DIRFILE *D, gd_entry_t* E, off64_t first_samp,
   else
     _GD_InvertData(D, data_out, return_type, E->EN(recip,dividend), num_samp);
 
-  dreturn("%zu", n_read);
+  dreturn("%" PRNsize_t, n_read);
   return n_read;
 }
 
 /* _GD_DoDivide:  Read from a divide.  Returns number of samples read.
 */
-static size_t _GD_DoDivide(DIRFILE *D, gd_entry_t* E, off64_t first_samp,
-    size_t num_samp, gd_type_t return_type, void *data_out)
+static size_t _GD_DoDivide(DIRFILE *restrict D, gd_entry_t *restrict E,
+    off64_t first_samp, size_t num_samp, gd_type_t return_type,
+    void *restrict data_out)
 {
   void *tmpbuf = NULL;
-  gd_spf_t spf1, spf2;
+  unsigned int spf1, spf2;
   size_t n_read, n_read2, num_samp2;
   off64_t first_samp2;
   gd_type_t type2;
 
-  dtrace("%p, %p, %lli, %zu, 0x%x, %p", D, E, first_samp, num_samp, return_type,
-      data_out);
+  dtrace("%p, %p, %lli, %" PRNsize_t ", 0x%X, %p", D, E, (long long)first_samp,
+      num_samp, return_type, data_out);
 
   /* Check input fields */
-  if (_GD_BadInput(D, E, 0) || _GD_BadInput(D, E, 1)) {
+  if (_GD_BadInput(D, E, 0, 1) || _GD_BadInput(D, E, 1, 1)) {
     dreturn("%i", 0);
     return 0;
   }
@@ -1205,15 +1321,16 @@ static size_t _GD_DoDivide(DIRFILE *D, gd_entry_t* E, off64_t first_samp,
 
   free(tmpbuf);
 
-  dreturn("%zu", n_read);
+  dreturn("%" PRNsize_t, n_read);
   return n_read;
 }
 
 /* _GD_DoBit:  Read from a bitfield.  Returns number of samples read.
  *             This is used by both BIT and SBIT (is_signed distinguishes)
  */
-static size_t _GD_DoBit(DIRFILE *D, gd_entry_t *E, int is_signed,
-    off64_t first_samp, size_t num_samp, gd_type_t return_type, void *data_out)
+static size_t _GD_DoBit(DIRFILE *restrict D, gd_entry_t *restrict E,
+    int is_signed, off64_t first_samp, size_t num_samp, gd_type_t return_type,
+    void *restrict data_out)
 {
   void *tmpbuf;
   size_t i;
@@ -1221,20 +1338,19 @@ static size_t _GD_DoBit(DIRFILE *D, gd_entry_t *E, int is_signed,
   const uint64_t mask = (E->EN(bit,numbits) == 64) ? 0xffffffffffffffffULL :
     ((uint64_t)1 << E->EN(bit,numbits)) - 1;
 
-  dtrace("%p, %p, %i, %lli, %zu, 0x%x, %p", D, E, is_signed, first_samp,
-      num_samp, return_type, data_out);
+  dtrace("%p, %p, %i, %lli, %" PRNsize_t ", 0x%X, %p", D, E, is_signed,
+      (long long)first_samp, num_samp, return_type, data_out);
 
-  if (_GD_BadInput(D, E, 0)) {
+  if (_GD_BadInput(D, E, 0, 1)) {
     dreturn("%i", 0);
     return 0;
   }
 
   if (is_signed)
-    tmpbuf = (int64_t *)malloc(num_samp * sizeof(int64_t));
+    tmpbuf = (int64_t *)_GD_Malloc(D, num_samp * sizeof(int64_t));
   else
-    tmpbuf = (uint64_t *)malloc(num_samp * sizeof(uint64_t));
+    tmpbuf = (uint64_t *)_GD_Malloc(D, num_samp * sizeof(uint64_t));
   if (tmpbuf == NULL) {
-    _GD_SetError(D, GD_E_ALLOC, 0, NULL, 0, NULL);
     dreturn("%i", 0);
     return 0;
   }
@@ -1250,7 +1366,7 @@ static size_t _GD_DoBit(DIRFILE *D, gd_entry_t *E, int is_signed,
 
   /* extract bits */
   if (is_signed) {
-    uint64_t sign = -1 << (E->EN(bit,numbits) + - 1);
+    uint64_t sign = -1 << (E->EN(bit,numbits) - 1);
     for (i = 0; i < n_read; i++)
       ((int64_t *)tmpbuf)[i] =
         (((((uint64_t *)tmpbuf)[i] >> E->EN(bit,bitnum)) & mask) + sign) ^ sign;
@@ -1263,21 +1379,22 @@ static size_t _GD_DoBit(DIRFILE *D, gd_entry_t *E, int is_signed,
       return_type, n_read);
   free(tmpbuf);
 
-  dreturn("%zu", n_read);
+  dreturn("%" PRNsize_t, n_read);
   return n_read;
 }
 
 /* _GD_DoPhase:  Read from a phase.  Returns number of samples read.
 */
-static size_t _GD_DoPhase(DIRFILE *D, gd_entry_t *E, off64_t first_samp,
-    size_t num_samp, gd_type_t return_type, void *data_out)
+static size_t _GD_DoPhase(DIRFILE *restrict D, gd_entry_t *restrict E,
+    off64_t first_samp, size_t num_samp, gd_type_t return_type,
+    void *restrict data_out)
 {
   size_t n_read;
 
-  dtrace("%p, %p, %lli, %zu, 0x%x, %p", D, E, first_samp, num_samp, return_type,
-      data_out);
+  dtrace("%p, %p, %lli, %" PRNsize_t ", 0x%X, %p", D, E, (long long)first_samp,
+      num_samp, return_type, data_out);
 
-  if (_GD_BadInput(D, E, 0)) {
+  if (_GD_BadInput(D, E, 0, 1)) {
     dreturn("%i", 0);
     return 0;
   }
@@ -1285,20 +1402,21 @@ static size_t _GD_DoPhase(DIRFILE *D, gd_entry_t *E, off64_t first_samp,
   n_read = _GD_DoField(D, E->e->entry[0], E->e->repr[0], first_samp +
       E->EN(phase,shift), num_samp, return_type, data_out);
 
-  dreturn("%zu", n_read);
+  dreturn("%" PRNsize_t, n_read);
   return n_read;
 }
 
 /* _GD_DoLinterp:  Read from a linterp.  Returns number of samples read.
 */
-static size_t _GD_DoLinterp(DIRFILE *D, gd_entry_t* E, off64_t first_samp,
-    size_t num_samp, gd_type_t return_type, void *data_out)
+static size_t _GD_DoLinterp(DIRFILE *restrict D, gd_entry_t *restrict E,
+    off64_t first_samp, size_t num_samp, gd_type_t return_type,
+    void *restrict data_out)
 {
   size_t n_read = 0;
   double* data_in;
 
-  dtrace("%p, %p, %lli, %zu, 0x%x, %p", D, E, first_samp, num_samp, return_type,
-      data_out);
+  dtrace("%p, %p, %lli, %" PRNsize_t ", 0x%X, %p", D, E, (long long)first_samp,
+      num_samp, return_type, data_out);
 
   if (E->e->u.linterp.table_len < 0) {
     _GD_ReadLinterpFile(D, E);
@@ -1308,7 +1426,7 @@ static size_t _GD_DoLinterp(DIRFILE *D, gd_entry_t* E, off64_t first_samp,
     }
   }
 
-  if (_GD_BadInput(D, E, 0)) {
+  if (_GD_BadInput(D, E, 0, 1)) {
     dreturn("%i", 0);
     return 0;
   }
@@ -1335,21 +1453,22 @@ static size_t _GD_DoLinterp(DIRFILE *D, gd_entry_t* E, off64_t first_samp,
       data_in, n_read, E->e->u.linterp.lut, E->e->u.linterp.table_len);
 
   free(data_in);
-  dreturn("%zu", n_read);
+  dreturn("%" PRNsize_t, n_read);
   return n_read;
 }
 
 /* _GD_DoPolynom:  Read from a polynom.  Returns number of samples read.
 */
-static size_t _GD_DoPolynom(DIRFILE *D, gd_entry_t *E, off64_t first_samp,
-    size_t num_samp, gd_type_t return_type, void *data_out)
+static size_t _GD_DoPolynom(DIRFILE *restrict D, gd_entry_t *restrict E,
+    off64_t first_samp, size_t num_samp, gd_type_t return_type,
+    void *restrict data_out)
 {
   size_t n_read;
 
-  dtrace("%p, %p, %lli, %zu, 0x%x, %p", D, E, first_samp, num_samp, return_type,
-      data_out);
+  dtrace("%p, %p, %lli, %" PRNsize_t ", 0x%X, %p", D, E, (long long)first_samp,
+      num_samp, return_type, data_out);
 
-  if (_GD_BadInput(D, E, 0)) {
+  if (_GD_BadInput(D, E, 0, 1)) {
     dreturn("%i", 0);
     return 0;
   }
@@ -1376,19 +1495,308 @@ static size_t _GD_DoPolynom(DIRFILE *D, gd_entry_t *E, off64_t first_samp,
     _GD_PolynomData(D, data_out, return_type, n_read, E->EN(polynom,poly_ord),
         E->EN(polynom,a));
 
-  dreturn("%zu", n_read);
+  dreturn("%" PRNsize_t, n_read);
+  return n_read;
+}
+
+/* _GD_DoWindow:  Read from a window.  Returns number of samples read.
+*/
+static size_t _GD_DoWindow(DIRFILE *restrict D, gd_entry_t *restrict E,
+    off64_t first_samp, size_t num_samp, gd_type_t return_type,
+    void *restrict data_out)
+{
+  void *tmpbuf = NULL;
+  unsigned int spf1, spf2;
+  size_t n_read, n_read2, num_samp2;
+  off64_t first_samp2;
+  gd_type_t type2;
+
+  dtrace("%p, %p, %lli, %" PRNsize_t ", 0x%X, %p", D, E, (long long)first_samp,
+      num_samp, return_type, data_out);
+
+  /* Check input fields */
+  if (_GD_BadInput(D, E, 0, 1)) {
+    dreturn("%i", 0);
+    return 0;
+  }
+
+  if (_GD_BadInput(D, E, 1, 1)) {
+    dreturn("%i", 0);
+    return 0;
+  }
+
+  /* find the samples per frame of the input field */
+  spf1 = _GD_GetSPF(D, E->e->entry[0]);
+  if (D->error != GD_E_OK) {
+    dreturn("%i", 0);
+    return 0;
+  }
+
+  /* read the input field and record the number of samples returned */
+  n_read = _GD_DoField(D, E->e->entry[0], E->e->repr[0], first_samp, num_samp,
+      return_type, data_out);
+
+  if (D->error != GD_E_OK) {
+    dreturn("%i", 0);
+    return 0;
+  }
+
+  /* Nothing to window */
+  if (n_read == 0) {
+    dreturn("%i", 0);
+    return 0;
+  }
+
+  /* find the samples per frame of the check field */
+  spf2 = _GD_GetSPF(D, E->e->entry[1]);
+  if (D->error != GD_E_OK) {
+    dreturn("%i", 0);
+    return 0;
+  }
+
+  /* calculate the first sample and number of samples to read of the
+   * check field */
+  num_samp2 = (int)ceil((double)n_read * spf2 / spf1);
+  first_samp2 = first_samp * spf2 / spf1;
+
+  switch(E->EN(window,windop)) {
+    case GD_WINDOP_EQ:
+    case GD_WINDOP_NE:
+      type2 = GD_INT64;
+      break;
+    case GD_WINDOP_SET:
+    case GD_WINDOP_CLR:
+      type2 = GD_UINT64;
+      break;
+    default:
+      type2 = GD_FLOAT64;
+      break;
+  }
+
+  /* Allocate a temporary buffer for the check field */
+  tmpbuf = _GD_Alloc(D, type2, num_samp2);
+
+  if (D->error != GD_E_OK) {
+    free(tmpbuf);
+    dreturn("%i", 0);
+    return 0;
+  }
+
+  /* read the check field */
+  n_read2 = _GD_DoField(D, E->e->entry[1], E->e->repr[1], first_samp2,
+      num_samp2, type2, tmpbuf);
+
+  if (D->error != GD_E_OK) {
+    free(tmpbuf);
+    dreturn("%i", 0);
+    return 0;
+  }
+
+  if (n_read2 > 0 && n_read2 * spf1 < n_read * spf2)
+    n_read = n_read2 * spf1 / spf2;
+
+  _GD_WindowData(D, data_out, spf1, tmpbuf, spf2, return_type,
+      E->EN(window,windop), E->EN(window,threshold), n_read);
+
+  free(tmpbuf);
+
+  dreturn("%" PRNsize_t, n_read);
+  return n_read;
+}
+
+/* _GD_DoMplex:  Read from an mplex.  Returns number of samples read.
+*/
+static size_t _GD_DoMplex(DIRFILE *restrict D, gd_entry_t *restrict E,
+    off64_t first_samp, size_t num_samp, gd_type_t return_type,
+    void *restrict data_out)
+{
+  char start[16];
+  int *tmpbuf = NULL;
+  unsigned int spf1, spf2;
+  size_t n_read, n_read2, num_samp2;
+  const size_t size = GD_SIZE(return_type);
+  off64_t first_samp2;
+
+  dtrace("%p, %p, %lli, %" PRNsize_t ", 0x%X, %p", D, E, (long long)first_samp,
+      num_samp, return_type, data_out);
+
+  /* Check input fields */
+  if (_GD_BadInput(D, E, 0, 1)) {
+    dreturn("%i", 0);
+    return 0;
+  }
+
+  if (_GD_BadInput(D, E, 1, 1)) {
+    dreturn("%i", 0);
+    return 0;
+  }
+
+  /* find the samples per frame of the input field */
+  spf1 = _GD_GetSPF(D, E->e->entry[0]);
+  if (D->error != GD_E_OK) {
+    dreturn("%i", 0);
+    return 0;
+  }
+
+  /* set the start value */
+  _GD_FillZero(start, return_type, 1);
+
+  /* read the input field and record the number of samples returned */
+  n_read = _GD_DoField(D, E->e->entry[0], E->e->repr[0], first_samp, num_samp,
+      return_type, data_out);
+
+  if (D->error != GD_E_OK) {
+    dreturn("%i", 0);
+    return 0;
+  }
+
+  /* Nothing to mplex */
+  if (n_read == 0) {
+    dreturn("%i", 0);
+    return 0;
+  }
+
+  /* find the samples per frame of the count field -- it's probably weird if
+   * this isn't the same, but who am I to judge?  (It's extra weird if it's
+   * larger.) */
+  spf2 = _GD_GetSPF(D, E->e->entry[1]);
+  if (D->error != GD_E_OK) {
+    dreturn("%i", 0);
+    return 0;
+  }
+
+  /* calculate the first sample and number of samples to read of the
+   * count field */
+  num_samp2 = (int)ceil((double)n_read * spf2 / spf1);
+  first_samp2 = first_samp * spf2 / spf1;
+
+  /* Allocate a temporary buffer for the count field */
+  tmpbuf = (int*)_GD_Alloc(D, GD_INT_TYPE, num_samp2);
+
+  if (D->error != GD_E_OK) {
+    free(tmpbuf);
+    dreturn("%i", 0);
+    return 0;
+  }
+
+  /* read the count field */
+  n_read2 = _GD_DoField(D, E->e->entry[1], E->e->repr[1], first_samp2,
+      num_samp2, GD_INT_TYPE, tmpbuf);
+
+  if (D->error != GD_E_OK) {
+    free(tmpbuf);
+    dreturn("%i", 0);
+    return 0;
+  }
+
+  /* Check whether we've saved the last sample */
+  if (return_type == E->e->u.mplex.type && first_samp == E->e->u.mplex.sample)
+    memcpy(start, E->e->u.mplex.d, size);
+  /* Otherwise, check whether the caller was lucky/clever */
+  else if (tmpbuf[0] != E->EN(mplex,count_val) && D->lookback) {
+    /* It wasn't -- do a look-back to find the start value.  On a, say, gzipped
+     * field this is expensive since it involves a rewind.  Hmm... */
+    size_t lb_cycle = E->EN(mplex,period);
+    off64_t chunk_start = first_samp2, lb_start, lb_sample = -1;
+
+    /* if period is zero, use a period of GD_MPLEX_CYCLE or
+     * 2 * count_val + 1, whichever is larger */
+    if (lb_cycle == 0) {
+      lb_cycle = 2 * E->EN(mplex,count_val) + 1;
+      if (lb_cycle < GD_MPLEX_CYCLE)
+        lb_cycle = GD_MPLEX_CYCLE;
+    }
+
+    /* the first sample we're willing to consider */
+    lb_start = (D->lookback == GD_LOOKBACK_ALL) ? 0 :
+      first_samp2 - D->lookback * lb_cycle;
+    if (lb_start < 0)
+      lb_start = 0;
+
+    /* stop if we're at the start of the lookback or we found the value */
+    while (lb_sample == -1 && chunk_start > lb_start) {
+      /* the size of the next chunk */
+      size_t i, n_read3, chunk_size = chunk_start - lb_start;
+      int *tmpbuf2;
+      if (chunk_size > GD_BUFFER_SIZE)
+        chunk_size = GD_BUFFER_SIZE;
+
+      /* the start of the next chunk */
+      chunk_start -= chunk_size;
+
+      tmpbuf2 = (int*)_GD_Alloc(D, GD_INT_TYPE, chunk_size);
+      if (D->error) {
+        free(tmpbuf);
+        dreturn("%i", 0);
+        return 0;
+      }
+
+      n_read3 = _GD_DoField(D, E->e->entry[1], E->e->repr[1], chunk_start,
+          chunk_size, GD_INT_TYPE, tmpbuf2);
+
+      if (D->error) {
+        free(tmpbuf2);
+        free(tmpbuf);
+        dreturn("%i", 0);
+        return 0;
+      }
+
+      /* find the sample */
+      i = n_read3 - 1;
+      do {
+        if (tmpbuf2[i] == E->EN(mplex,count_val)) {
+          lb_sample = chunk_start + i;
+          break;
+        }
+      } while (i-- != 0);
+      free(tmpbuf2);
+    }
+
+    /* read the value of the start, if found */
+    if (lb_sample >= 0) {
+      _GD_DoField(D, E->e->entry[0], E->e->repr[0], lb_sample * spf1 / spf2, 1,
+          return_type, start);
+
+      if (D->error) {
+        free(tmpbuf);
+        dreturn("%i", 0);
+        return 0;
+      }
+    }
+
+    /* now go and put the I/O pointers back where they belong, sigh */
+    _GD_Seek(D, E->e->entry[0], first_samp + n_read, GD_SEEK_SET);
+    _GD_Seek(D, E->e->entry[1], first_samp2 + n_read2, GD_SEEK_SET);
+  }
+
+  if (n_read2 > 0 && n_read2 * spf1 < n_read * spf2)
+    n_read = n_read2 * spf1 / spf2;
+
+  _GD_MplexData(D, data_out, spf1, tmpbuf, spf2, return_type,
+      E->EN(mplex,count_val),  start, n_read);
+
+  /* Cache the last sample read */
+  if (n_read > 0) {
+    E->e->u.mplex.type = return_type;
+    E->e->u.mplex.sample = first_samp + n_read;
+    memcpy(E->e->u.mplex.d, (char*)data_out + size * (n_read - 1), size);
+  }
+
+  free(tmpbuf);
+
+  dreturn("%" PRNsize_t, n_read);
   return n_read;
 }
 
 /* _GD_DoConst:  Read from a const.  Returns number of samples read (ie. 1).
 */
-static size_t _GD_DoConst(DIRFILE *D, const gd_entry_t *E, off64_t first,
-    size_t len, gd_type_t return_type, void *data_out)
+static size_t _GD_DoConst(DIRFILE *restrict D, const gd_entry_t *restrict E,
+    off64_t first, size_t len, gd_type_t return_type, void *restrict data_out)
 {
   gd_type_t type;
 
-  dtrace("%p, %p, %lli, %zu, 0x%x, %p", D, E, first, len, return_type,
-      data_out);
+  dtrace("%p, %p, %lli, %" PRNsize_t ", 0x%X, %p", D, E, (long long)first, len,
+      return_type, data_out);
 
   type = _GD_ConstType(D, E->EN(scalar,const_type));
   _GD_ConvertType(D, (char *)E->e->u.scalar.d + first * GD_SIZE(type), type,
@@ -1403,43 +1811,30 @@ static size_t _GD_DoConst(DIRFILE *D, const gd_entry_t *E, off64_t first,
   return 1;
 }
 
-/* _GD_DoString:  Read from a string.  Returns number of samples read (ie. the
- * length of the string plus 1).
- */
-static size_t _GD_DoString(gd_entry_t *E, size_t num_samp, char *data_out)
-{
-  dtrace("%p, %zu, %p", E, num_samp, data_out);
-
-  if (num_samp > 0 && data_out != NULL)
-    strncpy(data_out, E->e->u.string, num_samp); 
-
-  dreturn("%zu", strlen(E->e->u.string) + 1);
-  return strlen(E->e->u.string) + 1;
-}
-
 /* _GD_DoField: Locate the field in the database and read it.
 */
-size_t _GD_DoField(DIRFILE *D, gd_entry_t *E, int repr, off64_t first_samp,
-    size_t num_samp, gd_type_t return_type, void *data_out)
+size_t _GD_DoField(DIRFILE *restrict D, gd_entry_t *restrict E, int repr,
+    off64_t first_samp, size_t num_samp, gd_type_t return_type,
+    void *restrict data_out)
 {
   size_t n_read = 0;
   gd_type_t ntype;
   void *true_data_out = data_out;
-  const gd_type_t true_return_type = return_type; 
+  const gd_type_t true_return_type = return_type;
   int out_of_place = 0;
 
-  dtrace("%p, %p(%s), %i, %lli, %zu, 0x%x, %p", D, E, E->field, repr,
-      first_samp, num_samp, return_type, data_out);
+  dtrace("%p, %p(%s), %i, %lli, %" PRNsize_t ", 0x%X, %p", D, E, E->field, repr,
+      (long long)first_samp, num_samp, return_type, data_out);
 
   if (++D->recurse_level >= GD_MAX_RECURSE_LEVEL) {
-    _GD_SetError(D, GD_E_RECURSE_LEVEL, 0, NULL, 0, E->field);
+    _GD_SetError(D, GD_E_RECURSE_LEVEL, GD_E_RECURSE_CODE, NULL, 0, E->field);
     D->recurse_level--;
     dreturn("%i", 0);
     return 0;
   }
 
   if (!E->e->calculated)
-    _GD_CalculateEntry(D, E);
+    _GD_CalculateEntry(D, E, 1);
 
   if (D->error) {
     dreturn("%i", 0);
@@ -1447,18 +1842,26 @@ size_t _GD_DoField(DIRFILE *D, gd_entry_t *E, int repr, off64_t first_samp,
   }
 
   /* calculate the native type */
-  ntype = _GD_NativeType(D, E, GD_REPR_NONE); 
+  ntype = _GD_NativeType(D, E, GD_REPR_NONE);
 
   if (D->error) {
     dreturn("%i", 0);
     return 0;
   }
 
+  if (first_samp == GD_HERE) {
+    first_samp = _GD_GetFilePos(D, E, -1);
+    if (D->error) {
+      dreturn("%i", 0);
+      return 0;
+    }
+  }
+
   /* short circuit for purely real native types */
   if (~ntype & GD_COMPLEX) {
     if (repr == GD_REPR_IMAG) {
       memset(data_out, 0, GD_SIZE(return_type) * num_samp);
-      dreturn("%zu", num_samp);
+      dreturn("%" PRNsize_t, num_samp);
       return num_samp;
     } else if (repr == GD_REPR_REAL)
       repr = GD_REPR_NONE;
@@ -1512,13 +1915,18 @@ size_t _GD_DoField(DIRFILE *D, gd_entry_t *E, int repr, off64_t first_samp,
     case GD_SBIT_ENTRY:
       n_read = _GD_DoBit(D, E, 1, first_samp, num_samp, return_type, data_out);
       break;
+    case GD_WINDOW_ENTRY:
+      n_read = _GD_DoWindow(D, E, first_samp, num_samp, return_type, data_out);
+      break;
+    case GD_MPLEX_ENTRY:
+      n_read = _GD_DoMplex(D, E, first_samp, num_samp, return_type, data_out);
+      break;
     case GD_CONST_ENTRY:
     case GD_CARRAY_ENTRY:
       n_read = _GD_DoConst(D, E, first_samp, num_samp, return_type, data_out);
       break;
     case GD_STRING_ENTRY:
-      n_read = _GD_DoString(E, num_samp, (char *)data_out);
-      break;
+    case GD_ALIAS_ENTRY:
     case GD_NO_ENTRY:
       /* Can't get here */
       _GD_InternalError(D);
@@ -1534,7 +1942,7 @@ size_t _GD_DoField(DIRFILE *D, gd_entry_t *E, int repr, off64_t first_samp,
     free(data_out);
 
   D->recurse_level--;
-  dreturn("%zu", n_read);
+  dreturn("%" PRNsize_t, n_read);
   return n_read;
 }
 
@@ -1547,10 +1955,11 @@ size_t gd_getdata64(DIRFILE* D, const char *field_code_in, off64_t first_frame,
   gd_entry_t* entry;
   char* field_code;
   int repr;
-  gd_spf_t spf;
+  unsigned int spf;
 
-  dtrace("%p, \"%s\", %lli, %lli, %zu, %zu, 0x%x, %p", D, field_code_in,
-      first_frame, first_samp, num_frames, num_samp, return_type, data_out);
+  dtrace("%p, \"%s\", %lli, %lli, %" PRNsize_t ", %" PRNsize_t ", 0x%X, %p", D,
+      field_code_in, (long long)first_frame, (long long)first_samp, num_frames,
+      num_samp, return_type, data_out);
 
   if (D->flags & GD_INVALID) {/* don't crash */
     _GD_SetError(D, GD_E_BAD_DIRFILE, 0, NULL, 0, NULL);
@@ -1560,14 +1969,15 @@ size_t gd_getdata64(DIRFILE* D, const char *field_code_in, off64_t first_frame,
 
   _GD_ClearError(D);
 
-  entry = _GD_FindFieldAndRepr(D, field_code_in, &field_code, &repr, NULL, 1);
+  entry = _GD_FindFieldAndRepr(D, field_code_in, &field_code, &repr, NULL, 1,
+      1);
 
   if (D->error) {
     dreturn("%i", 0);
     return 0;
   }
 
-  if (entry->field_type & GD_SCALAR_ENTRY)
+  if (entry->field_type & GD_SCALAR_ENTRY_BIT)
     _GD_SetError(D, GD_E_DIMENSION, GD_E_DIM_CALLER, NULL, 0, field_code);
 
   if (field_code != field_code_in)
@@ -1578,21 +1988,34 @@ size_t gd_getdata64(DIRFILE* D, const char *field_code_in, off64_t first_frame,
     return 0;
   }
 
-  /* get the samples per frame */
-  spf = _GD_GetSPF(D, entry);
+  if (first_frame == GD_HERE || first_samp == GD_HERE) {
+    first_samp = GD_HERE;
+    first_frame = 0;
+  }
+
+  if (first_frame > 0 || num_frames > 0) {
+    /* get the samples per frame */
+    spf = _GD_GetSPF(D, entry);
 
-  if (D->error) {
+    if (D->error) {
+      dreturn("%i", 0);
+      return 0;
+    }
+
+    first_samp += spf * first_frame;
+    num_samp += spf * num_frames;
+  }
+
+  if (first_samp < 0 && (first_samp != GD_HERE || first_frame != 0)) {
+    _GD_SetError(D, GD_E_RANGE, GD_E_OUT_OF_RANGE, NULL, 0, NULL);
     dreturn("%i", 0);
     return 0;
   }
 
-  first_samp += spf * first_frame;
-  num_samp += spf * num_frames;
-
   n_read = _GD_DoField(D, entry, repr, first_samp, num_samp, return_type,
       data_out);
 
-  dreturn("%zu", n_read);
+  dreturn("%" PRNsize_t, n_read);
   return n_read;
 }
 
diff --git a/src/getdata.h.in b/src/getdata.h.in
index 9b9e9c1..3a324fc 100644
--- a/src/getdata.h.in
+++ b/src/getdata.h.in
@@ -1,6 +1,6 @@
 /* Copyright (C) 2002-2005 C. Barth Netterfield
  * Copyright (C) 2003-2005 Theodore Kisner
- * Copyright (C) 2005-2011 D. V. Wiebe
+ * Copyright (C) 2005-2013 D. V. Wiebe
  *
  ***************************************************************************
  *
@@ -30,11 +30,20 @@
  * - defining GD_NO_LEGACY_API will prevent the Legacy API declarations in
  *   getdata_legacy.h from being declared.  If the Legacy API was omitted from
  *   the library when it was built, this symbol does nothing.
- * 
- * - defining GD_C89_API will prevent declarations herein from
- *   using the C99 keyword `_Complex'.  Affected declarations will instead use a
- *   two-element array of doubles in place of the complex types.  This symbol
- *   permits including these declarations using a non-C99 conforming compiler.
+ *
+ * - defining GD_C89_API will prevent declarations herein from using the C99
+ *   keyword `_Complex'.  Affected declarations will instead use a two-element
+ *   array of doubles in place of the complex types.  This symbol permits
+ *   including these declarations using a non-C99 conforming compiler.
+ *
+ * - defining GD_64BIT_API will expose the declaration of versions of funtions
+ *   using an explicitly 64-bit off_t type, regardless of the actual size of
+ *   off_t itself.  These functions have "64" appended to their name (e.g.
+ *   gd_getdata64()).  It will also define th gd_off64_t type, which is used in
+ *   these exposed definitions as a replacement for off_t.  This symbol is
+ *   automatically defined if _LARGEFILE64_SOURCE has been defined before
+ *   including this file, and may also be defined on certain platforms where
+ *   off_t is 64-bits.
  *
  * - defining GD_FUNCTION_ALIASES will result in a number of function aliases
  *   which map the version 0.7 function names to the names used in GetData-0.6.
@@ -50,7 +59,7 @@ extern "C" {
 #endif
 
 /* The most recent standards version supported by this library */
-#define GD_DIRFILE_STANDARDS_VERSION 8
+#define GD_DIRFILE_STANDARDS_VERSION 9
 
 #include <math.h>
 #include <sys/types.h>
@@ -102,7 +111,7 @@ extern "C" {
 #endif
 
 /* formerly, this was the maximum length of a format file line.  We keep it
- * around for legacy reasons.  (The actualy maximum length of a format file
+ * around for legacy reasons.  (The actual maximum length of a format file
  * line is the maximum value of ssize_t, i.e. 2**(n-1)-1 on a n-bit system.)
  */
 #define GD_MAX_LINE_LENGTH  4096
@@ -142,13 +151,13 @@ extern "C" {
 #define GD_E_BAD_REFERENCE    24
 #define GD_E_PROTECTED        25
 #define GD_E_DELETE           26
-#define GD_E_BAD_ENDIANNESS   27
+#define GD_E_ARGUMENT         27
 #define GD_E_CALLBACK         28
-#define GD_E_BAD_PROTECTION   29
+#define GD_E_EXISTS           29
 #define GD_E_UNCLEAN_DB       30
 #define GD_E_DOMAIN           31
 #define GD_E_BAD_REPR         32
-#define GD_E_BAD_VERSION      33
+/* unused                     33 */
 #define GD_E_FLUSH            34
 #define GD_E_BOUNDS           35
 #define GD_E_LINE_TOO_LONG    36
@@ -156,7 +165,10 @@ extern "C" {
 #define GD_N_ERROR_CODES      37
 
 /* Deprecated error codes */
-#define GD_E_OPEN_INCLUDE      GD_E_OPEN_FRAGMENT
+#define GD_E_OPEN_INCLUDE     GD_E_OPEN_FRAGMENT
+#define GD_E_BAD_ENDIANNESS   GD_E_ARGUMENT
+#define GD_E_BAD_PROTECTION   GD_E_ARGUMENT
+#define GD_E_BAD_VERSION      GD_E_ARGUMENT
 
 #define GD_MAX_LINCOM 3
 
@@ -178,11 +190,18 @@ extern "C" {
 #define GD_E_FORMAT_BAD_NAME  12
 #define GD_E_FORMAT_UNTERM    13
 #define GD_E_FORMAT_METARAW   14
-#define GD_E_FORMAT_NO_PARENT 15
+#define GD_E_FORMAT_NO_FIELD  15
 #define GD_E_FORMAT_DUPLICATE 16
 #define GD_E_FORMAT_LOCATION  17
 #define GD_E_FORMAT_PROTECT   18
 #define GD_E_FORMAT_LITERAL   19
+#define GD_E_FORMAT_WINDOP    20
+#define GD_E_FORMAT_META_META 21
+#define GD_E_FORMAT_ALIAS     22
+#define GD_E_FORMAT_MPLEXVAL  23
+
+/* deprecated syntax suberrors */
+#define GD_E_FORMAT_NO_PARENT GD_E_FORMAT_NO_FIELD
 
 /* parser callback return values */
 #define GD_SYNTAX_ABORT    0
@@ -197,14 +216,15 @@ extern "C" {
 #define GD_PROTECT_ALL    ( GD_PROTECT_DATA | GD_PROTECT_FORMAT )
 
 /* Standards specifiers */
-#define GD_VERSION_CURRENT  -1
-#define GD_VERSION_LATEST   -2
-#define GD_VERSION_EARLIEST -3
+#define GD_VERSION_CURRENT  (-1)
+#define GD_VERSION_LATEST   (-2)
+#define GD_VERSION_EARLIEST (-3)
 
 /* this MUST be one less than the lowest allowed fragment index */
-#define GD_ALL_FRAGMENTS -1
+#define GD_ALL_FRAGMENTS (-1)
 
-#define GD_SCALAR_ENTRY 0x10
+#define GD_SCALAR_ENTRY_BIT  0x10
+#define GD_SPECIAL_ENTRY_BIT 0x20
 /* field types */
 typedef enum {
   GD_NO_ENTRY       = 0x00,
@@ -219,40 +239,63 @@ typedef enum {
   GD_SBIT_ENTRY     = 0x09,
   GD_DIVIDE_ENTRY   = 0x0A,
   GD_RECIP_ENTRY    = 0x0B,
-  GD_CONST_ENTRY    = GD_SCALAR_ENTRY | 0x00,
-  GD_STRING_ENTRY   = GD_SCALAR_ENTRY | 0x01,
-  GD_CARRAY_ENTRY   = GD_SCALAR_ENTRY | 0x02
+  GD_WINDOW_ENTRY   = 0x0C,
+  GD_MPLEX_ENTRY    = 0x0D,
+  GD_CONST_ENTRY    = GD_SCALAR_ENTRY_BIT | 0x00,
+  GD_STRING_ENTRY   = GD_SCALAR_ENTRY_BIT | 0x01,
+  GD_CARRAY_ENTRY   = GD_SCALAR_ENTRY_BIT | 0x02,
+
+  /* not a real entry type, but it's convenient to put this here */
+  GD_ALIAS_ENTRY    =   -1
 } gd_entype_t;
 
-/* GD_NO_ENTRY is not part of this count */
-#define GD_N_ENTYPES 14
+/* GD_NO_ENTRY and GD_ALIAS_ENTRY are not part of this count */
+#define GD_N_ENTYPES 16
 
- at DEFINE_gd_int16_t@
- at DEFINE_gd_uint16_t@
- at DEFINE_gd_int64_t@
+/* Special types for gd_nentries(3) and gd_entry_list(3) */
+#define GD_ALL_ENTRIES    0
+#define GD_VECTOR_ENTRIES (GD_SPECIAL_ENTRY_BIT | 0x01)
+#define GD_SCALAR_ENTRIES (GD_SPECIAL_ENTRY_BIT | 0x02)
+#define GD_ALIAS_ENTRIES  GD_ALIAS_ENTRY
+
+/* gd_nentries(3) and gd_entry_list(3) flags */
+#define GD_ENTRIES_HIDDEN  0x1
+#define GD_ENTRIES_NOALIAS 0x2
 
+/* the current location of the I/O pointer */
+#define GD_HERE  (-1)
+
+/* MPLEX lookback defines */
+#define GD_DEFAULT_LOOKBACK 10
+#define GD_LOOKBACK_ALL (-1)
+
+/* C data types */
 #if ! defined GD_C89_API
-#  include <inttypes.h>
-#  define GD_DCOMPLEXM(v) double _Complex v
-#  define GD_DCOMPLEXP(v) double _Complex *v
-typedef int16_t gd_bit_t;
-typedef uint16_t gd_spf_t;
+# include <inttypes.h>
+# define gd_int64_t int64_t
+# define gd_uint64_t uint64_t
+# define GD_DCOMPLEXM(v) double _Complex v
+# define GD_DCOMPLEXP(v) double _Complex *v
 typedef int64_t gd_shift_t;
 #else
-#  define GD_DCOMPLEXM(v) double v[2]
-#  define GD_DCOMPLEXP(v) double *v
-typedef gd_int16_t gd_bit_t;
-typedef gd_uint16_t gd_spf_t;
+ at DEFINE_gd_int64_t@
+ at DEFINE_gd_uint64_t@
+# define GD_DCOMPLEXM(v) double v[2]
+# define GD_DCOMPLEXP(v) double *v
 typedef gd_int64_t gd_shift_t;
 #endif
 
+/* Deprecated types */
+typedef int gd_bit_t;
+typedef unsigned int gd_spf_t;
+
 /* Data types -- No valid type may set 0x40 */
 #define GD_SIZE8     0x001
 #define GD_SIZE16    0x002
 #define GD_SIZE32    0x004
 #define GD_SIZE64    0x008
 #define GD_SIZE128   0x010
-#define GD_SIZE(x)   (x & 0x01f)
+#define GD_SIZE(x)   ((x) & 0x01f)
 
 #define GD_SIGNED    0x020
 #define GD_IEEE754   0x080
@@ -274,10 +317,30 @@ typedef enum {
   GD_COMPLEX64  = GD_SIZE64  | GD_COMPLEX,
   GD_COMPLEX128 = GD_SIZE128 | GD_COMPLEX
 } gd_type_t;
+/* deprecated type aliases */
 #define GD_FLOAT     GD_FLOAT32
 #define GD_DOUBLE    GD_FLOAT64
 
-struct _gd_private_entry;
+/* Window operations */
+typedef enum {
+  GD_WINDOP_UNK,
+  GD_WINDOP_EQ,
+  GD_WINDOP_GE,
+  GD_WINDOP_GT,
+  GD_WINDOP_LE,
+  GD_WINDOP_LT,
+  GD_WINDOP_NE,
+  GD_WINDOP_SET,
+  GD_WINDOP_CLR
+} gd_windop_t;
+
+struct gd_private_entry_;
+
+typedef union {
+  gd_int64_t i;
+  gd_uint64_t u;
+  double r;
+} gd_triplet_t;
 
 /* ANSI C does not permit anonymous structs/unions */
 #ifdef GD_C89_API
@@ -286,7 +349,7 @@ struct _gd_private_entry;
 # define GD_ANON(x)
 #endif
 /* Unified entry struct */
-struct _gd_unified_entry {
+struct gd_unified_entry_ {
   char *field;
   gd_entype_t field_type;
   char *in_fields[GD_MAX_LINCOM];
@@ -294,9 +357,10 @@ struct _gd_unified_entry {
   int scalar_ind[GD_MAX_POLYORD + 1];
   int fragment_index;
   int comp_scal;
+  int hidden;
   union {
     struct { /* RAW */
-      gd_spf_t spf;
+      unsigned int spf;
       gd_type_t data_type;
     } GD_ANON(raw);
     struct { /* LINCOM */
@@ -307,8 +371,8 @@ struct _gd_unified_entry {
       GD_DCOMPLEXM(cb[GD_MAX_LINCOM]);
     } GD_ANON(lincom);
     struct { /* BIT and SBIT */
-      gd_bit_t bitnum;
-      gd_bit_t numbits;
+      int bitnum;
+      int numbits;
     } GD_ANON(bit);
     struct { /* POLYNOM */
       int poly_ord;
@@ -325,22 +389,30 @@ struct _gd_unified_entry {
     struct { /* PHASE */
       gd_shift_t shift;
     } GD_ANON(phase);
+    struct { /* WINDOW */
+      gd_windop_t windop;
+      gd_triplet_t threshold;
+    } GD_ANON(window);
+    struct { /* MPLEX */
+      int count_val;
+      int period;
+    } GD_ANON(mplex);
     struct { /* CONST */
       gd_type_t const_type;
       size_t array_len;
     } GD_ANON(scalar);
   } GD_ANON(u);
 
-  struct _gd_private_entry *e;
+  struct gd_private_entry_ *e;
 };
 
-typedef struct _gd_unified_entry gd_entry_t;
+typedef struct gd_unified_entry_ gd_entry_t;
 
 /* The dirifle object */
-typedef struct _GD_DIRFILE DIRFILE;
+typedef struct gd_dirfile_ DIRFILE;
 
 /* Parser callback objects */
-struct _gd_callback_data {
+struct gd_callback_data_ {
   const DIRFILE *dirfile;
   int suberror;
   int linenum;
@@ -350,14 +422,14 @@ struct _gd_callback_data {
 };
 
 /* the carray list object */
-struct _gd_carray_data {
+struct gd_carray_data_ {
   size_t n;
   void *d;
 };
 
-typedef struct _gd_carray_data gd_carray_t;
+typedef struct gd_carray_data_ gd_carray_t;
 
-typedef struct _gd_callback_data gd_parser_data_t;
+typedef struct gd_callback_data_ gd_parser_data_t;
 
 typedef int (*gd_parser_callback_t)(gd_parser_data_t*, void*);
 
@@ -390,16 +462,20 @@ typedef int (*gd_parser_callback_t)(gd_parser_data_t*, void*);
 #endif
 
 #define GD_PERMISSIVE     0x00004000 /* be permissive */
+#define GD_TRUNCSUB       0x00008000 /* truncate subdirectories */
 
 #define GD_ENCODING       0x0F000000 /* mask */
 #define GD_AUTO_ENCODED   0x00000000 /* Encoding scheme unknown */
-#define GD_UNENCODED      0x01000000 /* Dirfile is not encoded */
-#define GD_TEXT_ENCODED   0x02000000 /* Dirfile is text encoded */
-#define GD_SLIM_ENCODED   0x03000000 /* Dirfile is slimlib encoded */
-#define GD_GZIP_ENCODED   0x04000000 /* Dirfile is gzip encoded */
-#define GD_BZIP2_ENCODED  0x05000000 /* Dirfile is bzip2 encoded */
-#define GD_LZMA_ENCODED   0x06000000 /* Dirfile is xz encoded */
-#define GD_ENC_UNSUPPORTED GD_ENCODING /* Dirfile encoding unsupported */
+#define GD_UNENCODED      0x01000000 /* Data are not encoded */
+#define GD_TEXT_ENCODED   0x02000000 /* Data are text encoded */
+#define GD_SLIM_ENCODED   0x03000000 /* Data are slimlib encoded */
+#define GD_GZIP_ENCODED   0x04000000 /* Data are gzip encoded */
+#define GD_BZIP2_ENCODED  0x05000000 /* Data are bzip2 encoded */
+#define GD_LZMA_ENCODED   0x06000000 /* Data are xz encoded */
+#define GD_SIE_ENCODED    0x07000000 /* Data are sample index encoded */
+#define GD_ZZIP_ENCODED   0x08000000 /* Data are zzip encoded */
+#define GD_ZZSLIM_ENCODED 0x09000000 /* Data are zzslim encoded */
+#define GD_ENC_UNSUPPORTED GD_ENCODING /* Encoding unsupported */
 
 /* delete flags */
 #define GD_DEL_META  0x1
@@ -407,8 +483,26 @@ typedef int (*gd_parser_callback_t)(gd_parser_data_t*, void*);
 #define GD_DEL_DEREF 0x4
 #define GD_DEL_FORCE 0x8
 
+/* move flags */
+#define GD_REN_DATA  0x1
+#define GD_REN_UPDB  0x2
+
+/* seek flags */
+#define GD_SEEK_SET   0x0
+#define GD_SEEK_CUR   0x1
+#define GD_SEEK_END   0x2
+#define GD_SEEK_WRITE 0x4
+
+/* desync flags */
+#define GD_DESYNC_PATHCHECK 0x1
+#define GD_DESYNC_REOPEN    0x2
+
+extern int gd_add_alias(DIRFILE *dirfile, const char *alias_name,
+    const char *target_code, int fragment_index) gd_nothrow
+gd_nonnull ((1,2,3));
+
 extern int gd_add_bit(DIRFILE *dirfile, const char *field_code,
-    const char *in_field, gd_bit_t bitnum, gd_bit_t numbits, int fragment_index)
+    const char *in_field, int bitnum, int numbits, int fragment_index)
 gd_nothrow gd_nonnull ((1,2,3));
 
 extern int gd_add_clincom(DIRFILE *dirfile, const char *field_code,
@@ -453,6 +547,10 @@ extern int gd_add_linterp(DIRFILE *dirfile, const char *field_code,
     const char *in_field, const char *table, int fragment_index) gd_nothrow
 gd_nonnull ((1,2,3,4));
 
+extern int gd_add_mplex(DIRFILE *dirfile, const char *field_code,
+    const char *in_field, const char *count_field, int count_val, int period,
+    int fragment_index) gd_nothrow gd_nonnull ((1,2,3,4));
+
 extern int gd_add_multiply(DIRFILE *dirfile, const char *field_code,
     const char *in_field1, const char *in_field2, int fragment_index)
 gd_nothrow gd_nonnull ((1,2,3,4));
@@ -470,14 +568,28 @@ extern int gd_add_recip(DIRFILE *dirfile, const char *field_code,
 gd_nonnull ((1,2,3));
 
 extern int gd_add_sbit(DIRFILE *dirfile, const char *field_code,
-    const char *in_field, gd_bit_t bitnum, gd_bit_t numbits,
+    const char *in_field, int bitnum, int numbits,
     int fragment_index) gd_nothrow gd_nonnull ((1,2,3));
 
 extern int gd_add_string(DIRFILE *dirfile, const char *field_code,
     const char *value, int fragment_index) gd_nothrow gd_nonnull((1,2,3));
 
+extern int gd_add_window(DIRFILE *dirfile, const char *field_code,
+    const char *in_field, const char *check_field, gd_windop_t windop,
+    gd_triplet_t threshold, int fragment_index) gd_nothrow
+gd_nonnull ((1,2,3,4));
+
+extern const char *gd_alias_target(DIRFILE *dirfile,
+    const char *field_code) gd_nothrow gd_nonnull ((1,2));
+
+extern const char **gd_aliases(DIRFILE *dirfile,
+    const char *field_code) gd_nothrow gd_nonnull ((1,2));
+
+extern int gd_alter_affixes(DIRFILE *dirfile, int index, const char *prefix,
+        const char *suffix) gd_nothrow gd_nonnull ((1));
+
 extern int gd_alter_bit(DIRFILE *dirfile, const char *field_code,
-    const char *in_field, gd_bit_t bitnum, gd_bit_t numbits) gd_nothrow
+    const char *in_field, int bitnum, int numbits) gd_nothrow
 gd_nonnull((1,2));
 
 extern int gd_alter_carray(DIRFILE *dirfile, const char *field_code,
@@ -513,6 +625,10 @@ extern int gd_alter_lincom(DIRFILE *dirfile, const char *field_code,
     int n_fields, const char **in_fields, const double *m, const double *b)
 gd_nothrow gd_nonnull((1,2));
 
+extern int gd_alter_mplex(DIRFILE *dirfile, const char *field_code,
+    const char *in_field, const char *count_field, int count_val,
+    int period) gd_nothrow gd_nonnull((1,2));
+
 extern int gd_alter_multiply(DIRFILE *dirfile, const char *field_code,
     const char *in_field1, const char *in_field2) gd_nothrow gd_nonnull((1,2));
 
@@ -527,12 +643,19 @@ extern int gd_alter_recip(DIRFILE *dirfile, const char *field_code,
     const char *in_field, double cdividend) gd_nothrow gd_nonnull((1,2));
 
 extern int gd_alter_sbit(DIRFILE *dirfile, const char *field_code,
-    const char *in_field, gd_bit_t bitnum, gd_bit_t numbits) gd_nothrow
+    const char *in_field, int bitnum, int numbits) gd_nothrow
 gd_nonnull((1,2));
 
+extern int gd_alter_window(DIRFILE *dirfile, const char *field_code,
+    const char *in_field, const char *check_field, gd_windop_t windop,
+    gd_triplet_t threshold) gd_nothrow gd_nonnull((1,2));
+
 extern size_t gd_carray_len(DIRFILE *dirfile, const char *field_code) gd_nothrow
 gd_nonnull((1,2));
 
+extern int gd_delete_alias(DIRFILE *dirfile, const char *field_code,
+    unsigned int flags) gd_nothrow gd_nonnull ((1,2));
+
 extern int gd_get_carray(DIRFILE *dirfile, const char *field_code,
     gd_type_t return_type, void *data_out) gd_nothrow gd_nonnull((1,2));
 
@@ -570,11 +693,16 @@ extern unsigned long int gd_endianness(DIRFILE *dirfile,
 extern int gd_entry(DIRFILE *dirfile, const char *field_code,
     gd_entry_t *entry) gd_nothrow gd_nonnull ((1, 2));
 
+extern const char **gd_entry_list(DIRFILE* D, const char *parent, int type,
+    unsigned int flags) gd_nothrow gd_nonnull ((1));
+
 extern gd_entype_t gd_entry_type(DIRFILE *dirfile,
     const char *field_code) gd_nothrow gd_nonnull ((1));
 
 extern int gd_error(const DIRFILE *dirfile) gd_nothrow gd_nonnull ((1));
 
+extern int gd_error_count(DIRFILE *dirfile) gd_nothrow gd_nonnull ((1));
+
 extern char *gd_error_string(const DIRFILE *dirfile, char *buffer,
     size_t buflen) gd_nothrow gd_nonnull ((1));
 
@@ -583,20 +711,39 @@ extern const char **gd_field_list(DIRFILE *dirfile) gd_nothrow gd_nonnull ((1));
 extern const char **gd_field_list_by_type(DIRFILE *dirfile,
     gd_entype_t type) gd_nothrow gd_nonnull ((1));
 
+extern unsigned long gd_flags(DIRFILE *D, unsigned long set,
+    unsigned long resest) gd_nothrow gd_nonnull ((1));
+
+extern int gd_fragment_affixes(DIRFILE *dirfile, int index, char **prefix,
+    char **suffix) gd_nothrow gd_nonnull ((1,3,4));
+
 extern int gd_fragment_index(DIRFILE *dirfile,
     const char *field_code) gd_nothrow gd_nonnull ((1));
 
 extern const char *gd_fragmentname(DIRFILE *dirfile,
     int index) gd_nothrow gd_nonnull ((1));
 
+extern int gd_hidden(DIRFILE *dirfile, const char *field_code) gd_nothrow
+gd_nonnull ((1,2));
+
+extern int gd_hide(DIRFILE *dirfile, const char *field_code) gd_nothrow
+gd_nonnull ((1,2));
+
 extern DIRFILE *gd_invalid_dirfile(void) gd_nothrow;
 
+extern char *gd_linterp_tablename(DIRFILE *D, const char *field_code) gd_nothrow
+gd_nonnull ((1, 2));
+
 extern int gd_madd(DIRFILE *dirfile, const gd_entry_t *entry,
     const char *parent) gd_nothrow gd_nonnull ((1,2,3));
 
+extern int gd_madd_alias(DIRFILE *dirfile, const char *parent,
+    const char *alias_name, const char *target_code) gd_nothrow
+gd_nonnull ((1,2,3,4));
+
 extern int gd_madd_bit(DIRFILE *dirfile, const char *parent,
-    const char *field_code, const char *in_field, gd_bit_t bitnum,
-    gd_bit_t numbits) gd_nothrow gd_nonnull ((1,2,3,4));
+    const char *field_code, const char *in_field, int bitnum,
+    int numbits) gd_nothrow gd_nonnull ((1,2,3,4));
 
 extern int gd_madd_carray(DIRFILE *dirfile, const char *parent,
     const char *field_code, gd_type_t const_type, size_t array_len,
@@ -639,6 +786,11 @@ extern int gd_madd_linterp(DIRFILE *dirfile, const char *parent,
     const char *field_code, const char *in_field, const char *table)
 gd_nothrow gd_nonnull ((1,2,3,4,5));
 
+extern int gd_madd_mplex(DIRFILE *dirfile, const char *parent,
+    const char *field_code, const char *in_field, const char *count_field,
+    int count_val, int period) gd_nothrow
+gd_nonnull ((1,2,3,4,5));
+
 extern int gd_madd_multiply(DIRFILE *dirfile, const char *parent,
     const char *field_code, const char *in_field1, const char *in_field2)
 gd_nothrow gd_nonnull ((1,2,3,4,5));
@@ -656,8 +808,8 @@ extern int gd_madd_recip(DIRFILE *dirfile, const char *parent,
 gd_nonnull ((1,2,3,4));
 
 extern int gd_madd_sbit(DIRFILE *dirfile, const char *parent,
-    const char *field_code, const char *in_field, gd_bit_t bitnum,
-    gd_bit_t numbits) gd_nothrow gd_nonnull ((1,2,3,4));
+    const char *field_code, const char *in_field, int bitnum,
+    int numbits) gd_nothrow gd_nonnull ((1,2,3,4));
 
 extern int gd_madd_spec(DIRFILE *dirfile, const char *line,
     const char *parent) gd_nothrow gd_nonnull ((1,2,3));
@@ -666,6 +818,11 @@ extern int gd_madd_string(DIRFILE *dirfile, const char *parent,
     const char *field_code, const char *value) gd_nothrow
 gd_nonnull ((1,2,3,4));
 
+extern int gd_madd_window(DIRFILE *dirfile, const char *parent,
+    const char *field_code, const char *in_field, const char *check_field,
+    gd_windop_t windop, gd_triplet_t threshold) gd_nothrow
+gd_nonnull ((1,2,3,4,5));
+
 extern int gd_dirfile_standards(DIRFILE *dirfile, int vers) gd_nothrow
 gd_nonnull ((1));
 
@@ -681,6 +838,12 @@ extern const char **gd_mfield_list(DIRFILE *dirfile,
 extern const char **gd_mfield_list_by_type(DIRFILE *dirfile,
     const char *parent, gd_entype_t type) gd_nothrow gd_nonnull((1,2));
 
+extern int gd_move_alias(DIRFILE *dirfile, const char *field_code,
+    int new_fragment) gd_nothrow gd_nonnull ((1,2));
+
+extern void gd_mplex_lookback(DIRFILE *dirfile, int lookback) gd_nothrow
+gd_nonnull((1));
+
 extern const char **gd_mstrings(DIRFILE *dirfile, const char *parent) gd_nothrow
 gd_nonnull((1,2));
 
@@ -689,9 +852,15 @@ extern const char **gd_mvector_list(DIRFILE *dirfile,
 
 extern const char *gd_dirfilename(DIRFILE *dirfile) gd_nothrow gd_nonnull ((1));
 
+extern int gd_naliases(DIRFILE *dirfile, const char *field_code) gd_nothrow
+gd_nonnull ((1,2));
+
 extern gd_type_t gd_native_type(DIRFILE *dirfile,
     const char *field_code) gd_nothrow gd_nonnull ((1,2));
 
+extern unsigned int gd_nentries(DIRFILE *D, const char *parent, int type,
+    unsigned int flags) gd_nothrow gd_nonnull ((1));
+
 extern unsigned int gd_nfields(DIRFILE *dirfile) gd_nothrow gd_nonnull ((1));
 
 extern unsigned int gd_nfields_by_type(DIRFILE *dirfile,
@@ -722,13 +891,13 @@ extern int gd_alter_protection(DIRFILE *dirfile, int protection_level,
 extern int gd_protection(DIRFILE *dirfile, int fragment_index) gd_nothrow
 gd_nonnull ((1));
 
-extern const char *gd_raw_filename(DIRFILE *dirfile,
+extern char *gd_raw_filename(DIRFILE *dirfile,
     const char *field_code) gd_nothrow gd_nonnull ((1, 2));
 
 extern const char *gd_reference(DIRFILE *dirfile,
     const char *field_code) gd_nothrow gd_nonnull ((1));
 
-extern gd_spf_t gd_spf(DIRFILE *dirfile, const char *field_code) gd_nothrow
+extern unsigned int gd_spf(DIRFILE *dirfile, const char *field_code) gd_nothrow
 gd_nonnull ((1, 2));
 
 extern size_t gd_get_string(DIRFILE *dirfile, const char *field_code,
@@ -739,9 +908,18 @@ extern size_t gd_put_string(DIRFILE *dirfile, const char *field_code,
 
 extern const char **gd_strings(DIRFILE *dirfile) gd_nothrow gd_nonnull ((1));
 
+extern char *gd_strtok(DIRFILE *D, const char *string) gd_nothrow
+gd_nonnull ((1));
+
+extern int gd_unhide(DIRFILE *dirfile, const char *field_code) gd_nothrow
+gd_nonnull ((1,2));
+
 extern int gd_validate(DIRFILE *dirfile, const char *field_code) gd_nothrow
 gd_nonnull((1,2));
 
+extern int gd_verbose_prefix(DIRFILE *D, const char *prefix) gd_nothrow
+gd_nonnull ((1,2));
+
 extern const char **gd_vector_list(DIRFILE *dirfile) gd_nothrow gd_nonnull((1));
 
 /* The following functions contain calls to I/O functions, making them
@@ -750,7 +928,8 @@ extern const char **gd_vector_list(DIRFILE *dirfile) gd_nothrow gd_nonnull((1));
 extern int gd_add(DIRFILE *dirfile, const gd_entry_t *entry) gd_nonnull((1,2));
 
 extern int gd_add_raw(DIRFILE *dirfile, const char *field_code,
-    gd_type_t data_type, gd_spf_t spf, int fragment_index) gd_nonnull((1,2));
+    gd_type_t data_type, unsigned int spf,
+    int fragment_index) gd_nonnull((1,2));
 
 extern int gd_add_spec(DIRFILE *dirfile, const char *line,
     int fragment_index) gd_nonnull ((1,2));
@@ -768,7 +947,7 @@ extern int gd_alter_linterp(DIRFILE *dirfile, const char *field_code,
     const char *in_field, const char *table, int recode) gd_nonnull ((1,2));
 
 extern int gd_alter_raw(DIRFILE *dirfile, const char *field_code,
-    gd_type_t data_type, gd_spf_t spf, int recode) gd_nonnull ((1,2));
+    gd_type_t data_type, unsigned int spf, int recode) gd_nonnull ((1,2));
 
 extern int gd_alter_spec(DIRFILE *dirfile, const char *line,
     int recode) gd_nonnull ((1,2));
@@ -779,7 +958,9 @@ extern DIRFILE *gd_cbopen(const char *dirfilename, unsigned long int flags,
 extern int gd_close(DIRFILE *dirfile);
 
 extern int gd_delete(DIRFILE *dirfile, const char *field_code,
-    int flags) gd_nonnull ((1,2));
+    unsigned int flags) gd_nonnull ((1,2));
+
+extern int gd_desync(DIRFILE *dirfile, unsigned int flags);
 
 extern int gd_discard(DIRFILE *dirfile);
 
@@ -788,6 +969,10 @@ extern int gd_flush(DIRFILE *dirfile, const char *field_code) gd_nonnull ((1));
 extern int gd_include(DIRFILE *dirfile, const char *file, int fragment_index,
     unsigned long int flags) gd_nonnull ((1,2));
 
+extern int gd_include_affix(DIRFILE *dirfile, const char *file,
+    int fragment_index, const char *prefix, const char *suffix,
+    unsigned long int flags) gd_nonnull ((1,2));
+
 extern double gd_framenum(DIRFILE *dirfile, const char *field_code,
     double value) gd_nonnull ((1,2));
 
@@ -802,11 +987,16 @@ extern int gd_move(DIRFILE *dirfile, const char *field_code, int new_fragment,
 extern DIRFILE *gd_open(const char *dirfilename,
     unsigned long int flags) gd_nonnull ((1));
 
+extern int gd_raw_close(DIRFILE *dirfile,
+    const char *field_code) gd_nonnull ((1));
+
 extern int gd_rename(DIRFILE *dirfile, const char *old_code,
-    const char *new_name, int move_data) gd_nonnull ((1,2,3));
+    const char *new_name, unsigned flags) gd_nonnull ((1,2,3));
 
 extern int gd_rewrite_fragment(DIRFILE *dirfile, int fragment) gd_nonnull ((1));
 
+extern int gd_sync(DIRFILE *dirfile, const char *field_code) gd_nonnull ((1));
+
 extern int gd_uninclude(DIRFILE *dirfile, int fragment_index,
     int del) gd_nonnull ((1));
 
@@ -837,6 +1027,12 @@ gd_nonnull ((1,2));
 
 extern off_t gd_eof(DIRFILE *dirfile, const char *field_code)
   gd_nonnull ((1,2));
+
+extern off_t gd_seek(DIRFILE *dirfile, const char *field_code, off_t frame_num,
+    off_t sample_num, int whence) gd_nonnull ((1,2));
+
+extern off_t gd_tell(DIRFILE *dirfile, const char *field_code) gd_nothrow
+gd_nonnull ((1,2));
 #else
 # ifdef __REDIRECT_NTH
 extern off_t __REDIRECT_NTH (gd_bof, (DIRFILE *dirfile, const char *field_code),
@@ -844,9 +1040,13 @@ extern off_t __REDIRECT_NTH (gd_bof, (DIRFILE *dirfile, const char *field_code),
 
 extern off_t __REDIRECT_NTH (gd_frameoffset, (DIRFILE *dirfile, int fragment),
     gd_frameoffset64) gd_nonnull ((1));
+
+extern off_t __REDIRECT_NTH (gd_tell, (DIRFILE *dirfile,
+      const char *field_code), gd_tell64) gd_nonnull ((1,2));
 # else
 #  define gd_bof gd_bof64
 #  define gd_frameoffset gd_frameoffset64
+#  define gd_tell gd_tell64
 # endif
 
 # ifdef __REDIRECT
@@ -871,6 +1071,10 @@ extern off_t __REDIRECT (gd_eof, (DIRFILE *dirfile, const char *field_code),
 extern double __REDIRECT (gd_framenum_subset, (DIRFILE *dirfile,
       const char *field_code, double value, off_t field_start, off_t field_end),
     gd_framenum_subset64) gd_nonnull ((1,2));
+
+extern off_t __REDIRECT (gd_seek, (DIRFILE *dirfile, const char *field_code,
+      off_t frame_num, off_t sample_num, int whence), gd_seek64)
+gd_nonnull ((1,2));
 # else
 #  define gd_alter_frameoffset gd_alter_frameoffset64
 #  define gd_getdata gd_getdata64
@@ -878,19 +1082,27 @@ extern double __REDIRECT (gd_framenum_subset, (DIRFILE *dirfile,
 #  define gd_nframes gd_nframes64
 #  define gd_eof gd_eof64
 #  define gd_framenum_subset gd_framenum_subset64
+#  define gd_seek gd_seek64
 # endif
 #endif
 
 /* if required, declare the LFS transitional extension */
 #if defined _LARGEFILE64_SOURCE || (defined _FILE_OFFSET_BITS && \
     _FILE_OFFSET_BITS == 64) || (defined __CYGWIN__) || (defined __APPLE__)
+#if ! defined GD_64BIT_API
+#define GD_64BIT_API
+#endif
+#endif
 
-#if (defined _FILE_OFFSET_BITS && _FILE_OFFSET_BITS == 64) || \
-                                    (defined __APPLE__) || (defined __CYGWIN__)
-#define gd_off64_t off_t
+#ifdef GD_64BIT_API
+#ifdef __off64_t_defined
+typedef __off64_t gd_off64_t;
+#elif (defined _FILE_OFFSET_BITS && _FILE_OFFSET_BITS == 64)
+typedef off_t gd_off64_t;
 #else
-#define gd_off64_t off64_t
+typedef gd_int64_t gd_off64_t;
 #endif
+
 extern int gd_alter_frameoffset64(DIRFILE *dirfile, gd_off64_t offset,
     int fragment, int recode) gd_nonnull ((1));
 
@@ -917,6 +1129,12 @@ gd_nonnull ((1,2));
 
 extern gd_off64_t gd_eof64(DIRFILE *dirfile, const char *field_code)
   gd_nonnull ((1,2));
+
+extern gd_off64_t gd_seek64(DIRFILE *dirfile, const char *field_code,
+    gd_off64_t frame_num, gd_off64_t sample_num, int whence) gd_nonnull ((1,2));
+
+extern gd_off64_t gd_tell64(DIRFILE *dirfile, const char *field_code) gd_nothrow
+gd_nonnull ((1,2));
 #endif
 
 
diff --git a/src/getdata_legacy.h b/src/getdata_legacy.h
index 3439b83..0fd63e0 100644
--- a/src/getdata_legacy.h
+++ b/src/getdata_legacy.h
@@ -84,7 +84,7 @@ struct FormatType {
   int n_linterp;
   struct MultiplyEntryType *multiplyEntries;
   int n_multiply;
-  struct MplexEntryType *mplexEntries;
+  struct MPlexEntryType *mplexEntries;
   int n_mplex;
   struct BitEntryType *bitEntries;
   int n_bit;
diff --git a/src/globals.c b/src/globals.c
index fd4c4ad..6349fb9 100644
--- a/src/globals.c
+++ b/src/globals.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2010 D. V. Wiebe
+/* Copyright (C) 2008-2012 D. V. Wiebe
  *
  ***************************************************************************
  *
@@ -20,14 +20,10 @@
  */
 #include "internal.h"
 
-#ifdef STDC_HEADERS
-#include <string.h>
-#include <stdlib.h>
-#endif
-
-/* This is nothing other than what the caller gave us.  Presumably it should
- * be better at keeping track of such things than us, but this is present in
- * the event that it is not. */
+/* This is a canonicalised version of the path specified in the open call.
+ * In the presence of third parties modifying symlinks after dirfile open, the
+ * caller is unable to determine the actual path to the dirfile that was
+ * opened if we don't help out. */
 const char *gd_dirfilename(DIRFILE* D) gd_nothrow
 {
   dtrace("%p", D);
@@ -40,8 +36,8 @@ const char *gd_dirfilename(DIRFILE* D) gd_nothrow
 
   _GD_ClearError(D);
 
-  dreturn("\"%s\"", D->name);
-  return D->name;
+  dreturn("\"%s\"", D->dir[0].path);
+  return D->dir[0].path;
 }
 
 const char *gd_reference(DIRFILE* D, const char* field_code) gd_nothrow
@@ -78,10 +74,10 @@ const char *gd_reference(DIRFILE* D, const char* field_code) gd_nothrow
   }
 
   /* Check field */
-  E = _GD_FindField(D, field_code, D->entry, D->n_entries, NULL);
+  E = _GD_FindField(D, field_code, D->entry, D->n_entries, 1, NULL);
 
   if (E == NULL) {
-    _GD_SetError(D, GD_E_BAD_CODE, 0, NULL, 0, field_code);
+    _GD_SetError(D, GD_E_BAD_CODE, GD_E_CODE_MISSING, NULL, 0, field_code);
     dreturn("%p", NULL);
     return NULL;
   }
@@ -100,10 +96,9 @@ const char *gd_reference(DIRFILE* D, const char* field_code) gd_nothrow
     return NULL;
   }
   
-  ptr = strdup(E->field);
+  ptr = _GD_Strdup(D, E->field);
 
   if (ptr == NULL) {
-    _GD_SetError(D, GD_E_ALLOC, 0, NULL, 0, NULL);
     dreturn("%p", NULL);
     return NULL;
   }
@@ -118,3 +113,61 @@ const char *gd_reference(DIRFILE* D, const char* field_code) gd_nothrow
   dreturn("\"%s\"", D->reference_field->field);
   return D->reference_field->field;
 }
+
+/* the mask of allowed flags */
+#define GD_FLAG_MASK ( GD_VERBOSE | GD_PRETTY_PRINT)
+unsigned long gd_flags(DIRFILE *D, unsigned long set, unsigned long reset)
+  gd_nothrow
+{
+  dtrace("%p, 0x%lX, 0x%lX", D, set, reset);
+
+  _GD_ClearError(D);
+
+  set &= GD_FLAG_MASK;
+  reset &= GD_FLAG_MASK;
+
+  D->flags = (D->flags | set) & ~(D->flags & reset);
+  D->open_flags = (D->open_flags | set) & ~(D->open_flags & reset);
+
+  dreturn("0x%lX", D->flags & GD_FLAG_MASK);
+  return D->flags & GD_FLAG_MASK;
+}
+
+int gd_verbose_prefix(DIRFILE *D, const char *prefix) gd_nothrow
+{
+  char *ptr = NULL;
+  dtrace("%p, \"%s\"", D, prefix);
+
+  if (D->flags & GD_INVALID) {
+    _GD_SetError(D, GD_E_BAD_DIRFILE, 0, NULL, 0, NULL);
+    dreturn("%i", -1);
+    return -1;
+  }
+
+  _GD_ClearError(D);
+
+  if (prefix) {
+    ptr = _GD_Strdup(D, prefix);
+    if (D->error) {
+      dreturn("%i", -1);
+      return -1;
+    }
+  }
+
+  free(D->error_prefix);
+  D->error_prefix = ptr;
+
+  dreturn("%i", 0);
+  return 0;
+}
+
+void gd_mplex_lookback(DIRFILE *D, int lookback) gd_nothrow
+{
+  dtrace("%p, %i", D, lookback);
+
+  _GD_ClearError(D);
+
+  D->lookback = lookback;
+
+  dreturnvoid();
+}
diff --git a/src/gzip.c b/src/gzip.c
index 158c37f..9bbd241 100644
--- a/src/gzip.c
+++ b/src/gzip.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2010 D. V. Wiebe
+/* Copyright (C) 2008-2011 D. V. Wiebe
  *
  ***************************************************************************
  *
@@ -20,15 +20,6 @@
  */
 #include "internal.h"
 
-#ifdef STDC_HEADERS
-#include <stdlib.h>
-#include <errno.h>
-#include <time.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-#endif
-
 #ifdef HAVE_ZLIB_H
 #include <zlib.h>
 #endif
@@ -37,88 +28,163 @@
 #define _GD_GzipOpen libgetdatagzip_LTX_GD_GzipOpen
 #define _GD_GzipSeek libgetdatagzip_LTX_GD_GzipSeek
 #define _GD_GzipRead libgetdatagzip_LTX_GD_GzipRead
+#define _GD_GzipWrite libgetdatagzip_LTX_GD_GzipWrite
+#define _GD_GzipSync libgetdatagzip_LTX_GD_GzipSync
 #define _GD_GzipClose libgetdatagzip_LTX_GD_GzipClose
 #define _GD_GzipSize libgetdatagzip_LTX_GD_GzipSize
 #endif
 
-/* The zlib encoding scheme uses edata as a gzFile object.  If a file is
- * open, fp = 0 otherwise fp = -1. */
+/* The gzip encoding scheme uses edata as a gzFile object.  If a file is
+ * open, idata >= 0 otherwise idata = -1.  Writes occur out-of-place. */
+
+int _GD_GzipOpen(int fd, struct gd_raw_file_* file, int swap gd_unused_,
+    unsigned int mode)
+{
+  const char *gzmode = "w";
+  dtrace("%i, %p, <unused>, 0x%X", fd, file, mode);
+
+  if (mode & GD_FILE_READ) {
+    file->idata = gd_OpenAt(file->D, fd, file->name, O_RDONLY | O_BINARY, 0666);
+
+    if (file->idata == -1) {
+      dreturn("%i", 1);
+      return 1;
+    }
+    gzmode = "r";
+  } else
+    file->idata = fd;
+
+  file->edata = gzdopen(file->idata, gzmode);
+
+  if (file->edata == NULL) {
+    close(file->idata);
+    file->idata = -1;
+    dreturn("%i", 1);
+    return 1;
+  }
+
+  file->mode = mode;
+  file->pos = 0;
+  dreturn("%i", 0);
+  return 0;
+}
 
-int _GD_GzipOpen(struct _gd_raw_file* file, int mode __gd_unused,
-    int creat __gd_unused)
+off64_t _GD_GzipSeek(struct gd_raw_file_* file, off64_t count,
+    gd_type_t data_type, unsigned int mode)
 {
-  dtrace("%p, <unused>, <unused>", file);
+  off64_t n = 0;
 
-  file->edata = gzopen(file->name, "rb" /* writing not supported */);
+  dtrace("%p, %lli, 0x%X, 0x%X", file, (long long)count, data_type, mode);
 
-  if (file->edata != NULL) {
-    file->fp = 0;
-    dreturn("%i", 0);
-    return 0;
+  if (file->pos == count) {
+    dreturn("%lli", (long long)count);
+    return count;
   }
 
-  dreturn("%i", 1);
-  return 1;
+  count *= GD_SIZE(data_type);
+
+  if (count >= 0) {
+    n = (off64_t)gzseek((gzFile)file[(mode == GD_FILE_WRITE) ? 1 : 0].edata,
+        (off_t)count, SEEK_SET);
+
+    if (n == -1) {
+      dreturn("%i", -1);
+      return -1;
+    }
+
+    n /= GD_SIZE(data_type);
+    file->pos = n;
+  }
+
+  dreturn("%lli", (long long)n);
+  return n;
 }
 
-off64_t _GD_GzipSeek(struct _gd_raw_file* file, off64_t count,
-    gd_type_t data_type, int pad __gd_unused)
+ssize_t _GD_GzipRead(struct gd_raw_file_ *file, void *ptr, gd_type_t data_type,
+    size_t nmemb)
 {
-  off64_t n;
+  ssize_t n;
+  int errnum;
 
-  dtrace("%p, %lli, %x, <unused>", file, (long long)count, data_type);
+  dtrace("%p, %p, 0x%X, %" PRNsize_t, file, ptr, data_type, nmemb);
 
-  n = (off64_t)gzseek(file->edata, (off_t)count * GD_SIZE(data_type), SEEK_SET);
+  n = gzread((gzFile)file->edata, ptr, GD_SIZE(data_type) * nmemb);
 
-  if (n == -1) {
-    dreturn("%i", -1);
-    return -1;
+  if (n >= 0) {
+    n /= GD_SIZE(data_type);
+    file->pos += n;
+  } else {
+    gzerror((gzFile)file->edata, &errnum);
+    if (errnum < 0)
+      n = -1;
   }
 
-  dreturn("%lli", (long long)(n / GD_SIZE(data_type)));
-  return n / GD_SIZE(data_type);
+  dreturn("%" PRNsize_t, n);
+  return n;
 }
 
-ssize_t _GD_GzipRead(struct _gd_raw_file *file, void *ptr, gd_type_t data_type,
-    size_t nmemb)
+ssize_t _GD_GzipWrite(struct gd_raw_file_ *file, const void *ptr,
+    gd_type_t data_type, size_t nmemb)
 {
   ssize_t n;
+  int errnum;
 
-  dtrace("%p, %p, %x, %zu", file, ptr, data_type, nmemb);
+  dtrace("%p, %p, 0x%X, %" PRNsize_t, file, ptr, data_type, nmemb);
 
-  n = gzread(file->edata, ptr, GD_SIZE(data_type) * nmemb);
+  n = gzwrite((gzFile)file->edata, ptr, GD_SIZE(data_type) * nmemb);
 
-  if (n >= 0)
+  if (n >= 0) {
     n /= GD_SIZE(data_type);
+    file->pos += n;
+  } else {
+    gzerror((gzFile)file[1].edata, &errnum);
+    if (errnum < 0)
+      n = -1;
+  }
 
-  dreturn("%zu", n);
+  dreturn("%" PRNssize_t, n);
   return n;
 }
 
-int _GD_GzipClose(struct _gd_raw_file *file)
+/* Because calling gzflush can result in degredation of compression, we avoid
+ * doing anything here */
+int _GD_GzipSync(struct gd_raw_file_ *file gd_unused_)
+{
+  dtrace("<unused>");
+
+  dreturn("%i", 0);
+  return 0;
+}
+
+int _GD_GzipClose(struct gd_raw_file_ *file)
 {
   int ret;
 
   dtrace("%p", file);
 
-  ret = gzclose(file->edata);
-  if (!ret) {
-    file->fp = -1;
-    file->edata = NULL;
+  ret = gzclose((gzFile)file->edata);
+  if (ret) {
+    dreturn("%i", ret);
+    return ret;
   }
 
-  dreturn("%i", ret);
-  return ret;
+  file->idata = -1;
+  file->edata = NULL;
+  file->mode = 0;
+
+  dreturn("%i", 0);
+  return 0;
 }
 
-off64_t _GD_GzipSize(struct _gd_raw_file *file, gd_type_t data_type)
+off64_t _GD_GzipSize(int dirfd, struct gd_raw_file_ *file, gd_type_t data_type,
+    int swap gd_unused_)
 {
   int fd;
   uint32_t size = 0;
 
-  dtrace("%p, %x", file, data_type);
+  dtrace("%i, %p, 0x%X, <unused>", dirfd, file, data_type);
 
-  fd = open(file->name, O_RDONLY | O_BINARY);
+  fd = gd_OpenAt(file->D, dirfd, file->name, O_RDONLY | O_BINARY, 0666);
   if (fd < 0) {
     dreturn("%i", -1);
     return -1;
@@ -137,7 +203,7 @@ off64_t _GD_GzipSize(struct _gd_raw_file *file, gd_type_t data_type)
   /* the checksum size is stored little endian */
 #ifdef WORDS_BIGENDIAN
   size = (size << 24) | ((size << 8) & 0x00ff0000)
-       | (size >> 24) | ((size >> 8) & 0x0000ff00);
+    | (size >> 24) | ((size >> 8) & 0x0000ff00);
 #endif
 
   close(fd);
diff --git a/src/include.c b/src/include.c
index be8fea3..569672f 100644
--- a/src/include.c
+++ b/src/include.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2010 D. V. Wiebe
+/* Copyright (C) 2008-2011 D. V. Wiebe
  *
  ***************************************************************************
  *
@@ -20,174 +20,278 @@
  */
 #include "internal.h"
 
-#ifdef STDC_HEADERS
-#include <string.h>
-#include <stdlib.h>
-#include <errno.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-#endif
+/* Create new affixes given the current affixes and the new parts indicated
+ * on a /INCLUDE line */
+static int _GD_SetFieldAffixes(DIRFILE *D, int me, const char *prefix_in,
+    const char *suffix_in, int standards, int pedantic, const char *format_file,
+    int line, char **prefix, char **suffix)
+{
+  dtrace("%p, %i, \"%s\", \"%s\", %i, %i, \"%s\", %i, %p, %p", D, me, prefix_in,
+      suffix_in, standards, pedantic, format_file, line, prefix, suffix);
 
-#ifdef HAVE_LIBGEN_H
-#include <libgen.h>
-#endif
+  /* suffix first, for some reason */
+  if (suffix_in && suffix_in[0] != '\0') {
+    if (_GD_ValidateField(suffix_in, standards, pedantic, 1, NULL))
+    {
+      _GD_SetError(D, GD_E_FORMAT, GD_E_FORMAT_BAD_NAME, format_file, line,
+          suffix_in);
+      dreturn("%i", 1);
+      return 1;
+    }
+
+    if (D->fragment[me].suffix == NULL)
+      *suffix = _GD_Strdup(D, suffix_in);
+    else {
+      *suffix = (char*)_GD_Malloc(D, strlen(D->fragment[me].suffix) +
+          strlen(suffix_in) + 1);
+      if (*suffix)
+        strcat(strcpy(*suffix, suffix_in), D->fragment[me].suffix);
+    }
+  } else if (D->fragment[me].suffix)
+    *suffix = _GD_Strdup(D, D->fragment[me].suffix);
+
+  if (D->error) {
+    dreturn("%i", 1);
+    return 1;
+  }
+
+  /* now the prefix */
+  if (prefix_in && prefix_in[0] != '\0') {
+    if (_GD_ValidateField(prefix_in, standards, pedantic, 1, NULL))
+    {
+      _GD_SetError(D, GD_E_FORMAT, GD_E_FORMAT_BAD_NAME, format_file, line,
+          prefix_in);
+      dreturn("%i", 1);
+      return 1;
+    }
 
-/* Include a format file fragment -- returns the include index, or 
+    if (D->fragment[me].prefix == NULL)
+      *prefix = _GD_Strdup(D, prefix_in);
+    else {
+      *prefix = (char*)_GD_Malloc(D, strlen(D->fragment[me].prefix) +
+          strlen(prefix_in) + 1);
+      if (*prefix)
+        strcat(strcpy(*prefix, D->fragment[me].prefix), prefix_in);
+    }
+  } else if (D->fragment[me].prefix)
+    *prefix = _GD_Strdup(D, D->fragment[me].prefix);
+
+  dreturn("%i", D->error);
+  return D->error;
+}
+
+/* Include a format file fragment -- returns the mew fragment index, or
  * -1 on error */
-int _GD_Include(DIRFILE* D, const char* ename, const char* format_file,
-    int linenum, char** ref_name, int me, int* standards, unsigned long *flags)
+int _GD_Include(DIRFILE *D, const char *ename, const char *format_file,
+    int linenum, char **ref_name, int parent, const char *prefix_in,
+    const char *suffix_in, int *standards, unsigned long *flags, int resolve)
 {
   int i;
-  int abs = 0;
-  int sname_null_ok = 0;
-  int found = 0;
-  char temp_buf1[FILENAME_MAX];
-  char temp_buf2[FILENAME_MAX];
-  void* ptr;
+  int me = D->n_fragment;
+  int old_standards = *standards;
+  int old_pedantic = *flags & GD_PEDANTIC;
+  int dirfd = -1;
+  char *temp_buf1 = NULL, *temp_buf2, *sname = NULL;
+  char *base = NULL, *prefix = NULL, *suffix = NULL;
+  void *ptr = NULL;
   FILE* new_fp = NULL;
+  time_t mtime = 0;
+  struct stat statbuf;
 
-  dtrace("%p, \"%s\", \"%s\", %p, %i, %i, %p, %p\n", D, ename, format_file,
-      ref_name, linenum, me, standards, flags);
+  dtrace("%p, \"%s\", \"%s\", %p, %i, %i, \"%s\", \"%s\", %p, %p, %i", D, ename,
+      format_file, ref_name, linenum, parent, prefix_in, suffix_in, standards,
+      flags, resolve);
 
-  /* create the format filename */
-  if (
-      /* check for absolute path */
-#if defined _WIN32 || defined _WIN64
-      ename[0] != '\0' && ename[1] == ':'
-#else
-      ename[0] == '/'
-#endif
-     ) {
-    strncpy(temp_buf1, ename, FILENAME_MAX - 1);
-    temp_buf1[FILENAME_MAX - 1] = '\0';
-    abs = 1;
-  } else
-    snprintf(temp_buf1, FILENAME_MAX, "%s/%s", D->fragment[me].sname ?
-        D->fragment[me].sname : D->name, ename);
+  if (++D->recurse_level >= GD_MAX_RECURSE_LEVEL) {
+    _GD_SetError(D, GD_E_RECURSE_LEVEL, GD_E_RECURSE_INCLUDE, format_file,
+        linenum, ename);
+    goto include_error;
+  }
 
-  /* Run through the include list to see if we've already included this
-   * file */
-  for (i = 0; i < D->n_fragment; ++i)
-    if (strcmp(temp_buf1, D->fragment[i].cname) == 0) {
-      found = 1;
-      break;
-    }
+  if (_GD_SetFieldAffixes(D, parent, prefix_in, suffix_in, old_standards,
+        old_pedantic, format_file, linenum, &prefix, &suffix))
+  {
+    goto include_error;
+  }
 
-  /* If we found the file, we won't reopen it.  Continue parsing. */
-  if (found) {
-    dreturn("%i", i);
-    return i;
+  /* isolate filename */
+  temp_buf2 = _GD_Strdup(D, ename);
+  if (temp_buf2 == NULL)
+    goto include_error;
+  base = _GD_Strdup(D, basename(temp_buf2));
+  free(temp_buf2);
+  if (base == NULL)
+    goto include_error;
+
+  /* isolate relative path */
+  temp_buf2 = _GD_Strdup(D, ename);
+  if (temp_buf2 == NULL)
+    goto include_error;
+  sname = _GD_Strdup(D, dirname(temp_buf2));
+  free(temp_buf2);
+  if (sname == NULL)
+    goto include_error;
+
+  /* Open the containing directory */
+  dirfd = _GD_GrabDir(D, D->fragment[parent].dirfd, ename);
+  if (dirfd == -1 && D->error == GD_E_OK)
+    _GD_SetError(D, GD_E_OPEN_FRAGMENT, errno, format_file, linenum, ename);
+  if (D->error)
+    goto include_error;
+
+  temp_buf1 = _GD_MakeFullPath(D, dirfd, base, 1);
+  if (temp_buf1 == NULL) {
+    _GD_ReleaseDir(D, dirfd);
+    goto include_error;
   }
 
-  /* Otherwise, try to open the file */
-  if ((D->flags & GD_ACCMODE) == GD_RDWR) {
-    i = open(temp_buf1, O_RDWR | ((*flags & GD_CREAT) ? O_CREAT : 0) |
-        ((*flags & GD_TRUNC) ? O_TRUNC : 0) | ((*flags & GD_EXCL) ? O_EXCL : 0)
-        | O_BINARY, 0666);
-    if (i < 0) {
+  /* Reject weird stuff */
+  if (gd_StatAt(D, dirfd, base, &statbuf, 0)) {
+    if (!(*flags & GD_CREAT)) {
       _GD_SetError(D, GD_E_OPEN_FRAGMENT, errno, format_file, linenum,
           temp_buf1);
-      dreturn("%i", -1);
-      return -1;
+      _GD_ReleaseDir(D, dirfd);
+      goto include_error;
     }
-    new_fp = fdopen(i, "r+");
-  } else
-    new_fp = fopen(temp_buf1, "r");
+  } else {
+    if (S_ISDIR(statbuf.st_mode)) {
+      _GD_SetError(D, GD_E_OPEN_FRAGMENT, EISDIR, format_file, linenum,
+          temp_buf1);
+      _GD_ReleaseDir(D, dirfd);
+      goto include_error;
+    } else if (!S_ISREG(statbuf.st_mode)) {
+      _GD_SetError(D, GD_E_OPEN_FRAGMENT, EINVAL, format_file, linenum,
+          temp_buf1);
+      _GD_ReleaseDir(D, dirfd);
+      goto include_error;
+    }
+  }
+
+  /* Try to open the file */
+  i = gd_OpenAt(D, dirfd, base, (((D->flags & GD_ACCMODE) == GD_RDWR) ? O_RDWR :
+        O_RDONLY) | ((*flags & GD_CREAT) ? O_CREAT : 0) |
+      ((*flags & GD_TRUNC) ? O_TRUNC : 0) | ((*flags & GD_EXCL) ? O_EXCL : 0)
+      | O_BINARY, 0666);
+
+  if (i < 0) {
+    _GD_SetError(D, GD_E_OPEN_FRAGMENT, errno, format_file, linenum,
+        temp_buf1);
+    _GD_ReleaseDir(D, dirfd);
+    goto include_error;
+  }
+
+  new_fp = fdopen(i, ((D->flags & GD_ACCMODE) == GD_RDWR) ? "rb+" : "rb");
 
   /* If opening the file failed, set the error code and abort parsing. */
   if (new_fp == NULL) {
     _GD_SetError(D, GD_E_OPEN_FRAGMENT, errno, format_file, linenum, temp_buf1);
-    dreturn("%i", -1);
-    return -1;
+    _GD_ReleaseDir(D, dirfd);
+    goto include_error;
   }
 
+  /* fstat the file and record the mtime */
+  if (fstat(i, &statbuf) == 0)
+    mtime = statbuf.st_mtime;
+
   /* If we got here, we managed to open the included file; parse it */
-  ptr = realloc(D->fragment, (++D->n_fragment) * sizeof(struct gd_fragment_t));
+  ptr = _GD_Realloc(D, D->fragment,
+      (++D->n_fragment) * sizeof(struct gd_fragment_t));
   if (ptr == NULL) {
-    _GD_SetError(D, GD_E_ALLOC, 0, NULL, 0, NULL);
-    dreturn("%i", -1);
-    return -1;
+    _GD_ReleaseDir(D, dirfd);
+    D->n_fragment--;
+    goto include_error;
   }
   D->fragment = (struct gd_fragment_t *)ptr;
 
-  D->fragment[D->n_fragment - 1].cname = strdup(temp_buf1);
-  D->fragment[D->n_fragment - 1].ename = strdup(ename);
-  D->fragment[D->n_fragment - 1].modified = 0;
-  D->fragment[D->n_fragment - 1].parent = me;
-  D->fragment[D->n_fragment - 1].encoding = *flags & GD_ENCODING;
-  D->fragment[D->n_fragment - 1].byte_sex =
+  D->fragment[me].bname = base;
+  D->fragment[me].cname = temp_buf1;
+  D->fragment[me].ename = _GD_Strdup(D, ename);
+  D->fragment[me].enc_data = NULL;
+  D->fragment[me].modified = 0;
+  D->fragment[me].parent = parent;
+  D->fragment[me].dirfd = dirfd;
+  D->fragment[me].encoding = *flags & GD_ENCODING;
+  D->fragment[me].byte_sex =
 #ifdef WORDS_BIGENDIAN
     (*flags & GD_LITTLE_ENDIAN) ? GD_LITTLE_ENDIAN : GD_BIG_ENDIAN
 #else
     (*flags & GD_BIG_ENDIAN) ? GD_BIG_ENDIAN : GD_LITTLE_ENDIAN
 #endif
     ;
-  D->fragment[D->n_fragment - 1].ref_name = NULL;
-  D->fragment[D->n_fragment - 1].frame_offset = D->fragment[me].frame_offset;
-  D->fragment[D->n_fragment - 1].protection = GD_PROTECT_NONE;
-  D->fragment[D->n_fragment - 1].vers =
-    (*flags & GD_PEDANTIC) ? 1ULL << *standards : 0;
-
-  if (D->fragment[D->n_fragment - 1].cname == NULL ||
-      D->fragment[D->n_fragment - 1].ename == NULL)
-  {
-    _GD_SetError(D, GD_E_ALLOC, 0, NULL, 0, NULL);
-    dreturn("%i", -1);
-    return -1;
-  }
-
-  /* extract the subdirectory name - dirname both returns a volatile string
-   * and modifies its argument, ergo strcpy */
-  strncpy(temp_buf1, ename, FILENAME_MAX);
-  if (abs)
-    D->fragment[D->n_fragment - 1].sname = strdup(dirname(temp_buf1));
-  else {
-    strcpy(temp_buf2, dirname(temp_buf1));
-    if (temp_buf2[0] == '.' && temp_buf2[1] == '\0') {
-      if (D->fragment[me].sname)
-        D->fragment[D->n_fragment - 1].sname = strdup(D->fragment[me].sname);
-      else {
-        D->fragment[D->n_fragment - 1].sname = NULL;
-        sname_null_ok = 1;
-      }
-    } else {
-      strncpy(temp_buf1, ename, FILENAME_MAX);
-      snprintf(temp_buf2, FILENAME_MAX, "%s/%s", D->fragment[me].sname ? 
-          D->fragment[me].sname : D->name, dirname(temp_buf1));
-      D->fragment[D->n_fragment - 1].sname = strdup(temp_buf2);
-    }
-  }
+  D->fragment[me].ref_name = NULL;
+  D->fragment[me].frame_offset = D->fragment[parent].frame_offset;
+  D->fragment[me].protection = GD_PROTECT_NONE;
+  D->fragment[me].prefix = prefix;
+  D->fragment[me].suffix = suffix;
+  D->fragment[me].mtime = mtime;
+  D->fragment[me].vers = (*flags & GD_PEDANTIC) ? 1ULL << *standards : 0;
+
+  /* compute the (relative) subdirectory name */
+  if (sname[0] == '.' && sname[1] == '\0') {
+    /* dirname is the same as the parent fragment's */
+    D->fragment[me].sname = (D->fragment[parent].sname) ?
+      _GD_Strdup(D, D->fragment[parent].sname) : NULL;
+    free(sname);
+  } else if (D->fragment[parent].sname && _GD_AbsPath(sname)) {
+    /* have both a relative dirname and the parent's sname; squish them
+     * together */
+    D->fragment[me].sname = (char*)_GD_Malloc(D, strlen(sname) +
+        strlen(D->fragment[parent].sname) + 2);
+    if (D->fragment[me].sname)
+      sprintf(D->fragment[me].sname, "%s%c%s", D->fragment[parent].sname,
+          GD_DIRSEP, sname);
+    free(sname);
+  } else
+    /* just save the sname */
+    D->fragment[me].sname = sname;
 
-  if (!sname_null_ok && D->fragment[D->n_fragment - 1].sname == NULL) {
-    _GD_SetError(D, GD_E_ALLOC, 0, NULL, 0, NULL);
-    dreturn("%i", -1);
-    return -1;
+  /* catch alloc errors */
+  if (D->error) {
+    D->n_fragment--;
+    temp_buf1 = prefix = suffix = base = NULL;
+    fclose(new_fp);
+    _GD_ReleaseDir(D, dirfd);
+    goto include_error;
   }
 
-  *ref_name = _GD_ParseFragment(new_fp, D, D->n_fragment - 1, standards, flags);
+  *ref_name = _GD_ParseFragment(new_fp, D, me, standards, flags, resolve);
 
   fclose(new_fp);
 
-  dreturn("%i", D->n_fragment - 1);
-  return D->n_fragment - 1;
+  /* prevent /VERSION leak in DSV >= 9 */
+  if ((old_standards >= 9 && old_pedantic) || *standards >= 9) {
+    if (*standards != old_standards) {
+      *standards = old_standards;
+      D->flags |= GD_MULTISTANDARD;
+    }
+    if (!old_pedantic)
+      *flags &= ~GD_PEDANTIC;
+  }
+
+  D->recurse_level--;
+  dreturn("%i", me);
+  return me;
+
+include_error:
+  free(prefix);
+  free(suffix);
+  free(base);
+  free(sname);
+  free(temp_buf1);
+  D->recurse_level--;
+  dreturn("%i", -1);
+  return -1;
 }
 
-int gd_include(DIRFILE* D, const char* file, int fragment_index,
-    unsigned long flags)
+int gd_include_affix(DIRFILE* D, const char* file, int fragment_index,
+    const char *prefix, const char *suffix, unsigned long flags)
 {
   int standards = GD_DIRFILE_STANDARDS_VERSION;
-  char* ref_name = NULL; 
+  char* ref_name = NULL;
   int i, new_fragment;
 
-  dtrace("%p, \"%s\", %i, %lx", D, file, fragment_index, (unsigned long)flags);
-
-  if (~D->flags & GD_HAVE_VERSION)
-    _GD_FindVersion(D);
-
-  /* only set if the dirfile conforms to some standard */
-  if (D->av)
-    standards = D->standards;
+  dtrace("%p, \"%s\", %i, \"%s\", \"%s\", 0x%lX", D, file, fragment_index,
+      prefix, suffix, flags);
 
   _GD_ClearError(D);
 
@@ -218,13 +322,20 @@ int gd_include(DIRFILE* D, const char* file, int fragment_index,
     return -1;
   }
 
+  if (~D->flags & GD_HAVE_VERSION)
+    _GD_FindVersion(D);
+
+  /* only set if the dirfile conforms to some standard */
+  if (D->av)
+    standards = D->standards;
+
   /* if the caller specified no encoding scheme, but we were asked to create
    * the fragment, inherit it from the parent */
   if ((flags & (GD_ENCODING | GD_CREAT)) == GD_CREAT)
-    flags |= D->flags & GD_ENCODING;
+    flags |= D->fragment[fragment_index].encoding;
 
   new_fragment = _GD_Include(D, file, "dirfile_include()", 0, &ref_name,
-      fragment_index, &standards, &flags);
+      fragment_index, prefix, suffix, &standards, &flags, 1);
 
   if (!D->error) {
     D->fragment[fragment_index].modified = 1;
@@ -248,7 +359,7 @@ int gd_include(DIRFILE* D, const char* file, int fragment_index,
 
   /* Honour the reference directive, if not prohibited by the caller */
   if (ref_name != NULL && ~flags & GD_IGNORE_REFS) {
-    gd_entry_t *E = _GD_FindField(D, ref_name, D->entry, D->n_entries, NULL);
+    gd_entry_t *E = _GD_FindField(D, ref_name, D->entry, D->n_entries, 1, NULL);
 
     /* FIXME: These errors are problematic, since they'll cause the call to
      * fail, even though the new fragment has been integrated into the DIRFILE.
@@ -261,7 +372,7 @@ int gd_include(DIRFILE* D, const char* file, int fragment_index,
       _GD_SetError(D, GD_E_BAD_REFERENCE, GD_E_REFERENCE_TYPE, NULL, 0,
           ref_name);
     else
-      D->reference_field = E; 
+      D->reference_field = E;
   }
   free(ref_name);
 
@@ -269,6 +380,19 @@ int gd_include(DIRFILE* D, const char* file, int fragment_index,
   return new_fragment;
 }
 
+int gd_include(DIRFILE* D, const char* file, int fragment_index,
+    unsigned long flags)
+{
+  int new_fragment;
+
+  dtrace("%p, \"%s\", %i, 0x%lX", D, file, fragment_index, flags);
+
+  new_fragment = gd_include_affix(D, file, fragment_index, NULL, NULL, flags);
+
+  dreturn("%i", new_fragment);
+  return new_fragment;
+}
+
 static int _GD_CollectFragments(DIRFILE* D, int** f, int fragment, int nf)
 {
   int i;
@@ -276,9 +400,8 @@ static int _GD_CollectFragments(DIRFILE* D, int** f, int fragment, int nf)
 
   dtrace("%p, %p, %i, %i", D, f, fragment, nf);
 
-  new_f = (int *)realloc(*f, sizeof(int) * ++nf);
+  new_f = (int *)_GD_Realloc(D, *f, sizeof(int) * ++nf);
   if (new_f == NULL) {
-    _GD_SetError(D, GD_E_ALLOC, 0, NULL, 0, NULL);
     dreturn("%i", -1);
     return -1;
   }
@@ -291,7 +414,7 @@ static int _GD_CollectFragments(DIRFILE* D, int** f, int fragment, int nf)
         break;
     }
 
-  *f = new_f; 
+  *f = new_f;
 
   dreturn("%i", nf);
   return nf;
@@ -364,7 +487,7 @@ int gd_uninclude(DIRFILE* D, int fragment_index, int del)
     if (D->entry[i]->field_type == GD_RAW_ENTRY &&
         _GD_ContainsFragment(f, nf, D->entry[i]->fragment_index))
     {
-      _GD_Flush(D, D->entry[i]);
+      _GD_Flush(D, D->entry[i], 0, 1);
     }
 
   /* flush the fragment's metadata, if requested */
@@ -383,25 +506,17 @@ int gd_uninclude(DIRFILE* D, int fragment_index, int del)
   /* delete the fragments, if requested */
   if (del)
     for (j = 0; j < nf; ++j)
-      unlink(D->fragment[f[j]].cname);
+      gd_UnlinkAt(D, D->fragment[f[j]].dirfd, D->fragment[f[j]].bname, 0);
 
   /* delete fields from the fragment -- memory use is not sufficient to warrant
    * resizing D->entry */
   old_count = D->n_entries;
   for (i = o = 0; i < old_count; ++i)
     if (_GD_ContainsFragment(f, nf, D->entry[i]->fragment_index)) {
-      if (D->entry[i]->e->n_meta >= 0) {
+      if (D->entry[i]->e->n_meta >= 0)
         D->n_entries--;
-        if (D->entry[i]->field_type == GD_CONST_ENTRY)
-          D->n_const--;
-        else if (D->entry[i]->field_type == GD_CARRAY_ENTRY)
-          D->n_carray--;
-        else if (D->entry[i]->field_type == GD_STRING_ENTRY)
-          D->n_string--;
-      } else
-        D->n_meta--;
 
-      _GD_FreeE(D->entry[i], 1);
+      _GD_FreeE(D, D->entry[i], 1);
     } else
       D->entry[o++] = D->entry[i];
 
@@ -411,9 +526,10 @@ int gd_uninclude(DIRFILE* D, int fragment_index, int del)
 
   /* delete the fragments -- again, don't bother resizing D->fragment */
   for (j = 0; j < nf; ++j) {
+    _GD_ReleaseDir(D, D->fragment[f[j]].dirfd);
     free(D->fragment[f[j]].cname);
-    free(D->fragment[f[j]].sname);
     free(D->fragment[f[j]].ename);
+    free(D->fragment[f[j]].bname);
     free(D->fragment[f[j]].ref_name);
 
     memcpy(D->fragment + f[j], D->fragment + D->n_fragment - 1,
@@ -432,11 +548,13 @@ int gd_uninclude(DIRFILE* D, int fragment_index, int del)
     D->entry[i]->e->calculated = 0;
     for (j = 0; j < GD_MAX_LINCOM; ++j)
       D->entry[i]->e->entry[j] = NULL;
+    D->entry[i]->e->value_list_validity = 0;
+    D->entry[i]->e->entry_list_validity = 0;
   }
 
   /* Invalidate the field lists */
-  D->list_validity = 0;
-  D->type_list_validity = 0;
+  D->value_list_validity = 0;
+  D->entry_list_validity = 0;
 
   free(f);
 
diff --git a/src/index.c b/src/index.c
index 20ac4ac..adf3750 100644
--- a/src/index.c
+++ b/src/index.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2009-2010 D. V. Wiebe
+/* Copyright (C) 2009-2012 D. V. Wiebe
  *
  ***************************************************************************
  *
@@ -20,11 +20,6 @@
  */
 #include "internal.h"
 
-#ifdef STDC_HEADERS
-#include <stdlib.h>
-#include <string.h>
-#endif
-
 #include "nan.h"
 
 static double _GD_Extrapolate(DIRFILE *D, gd_entry_t *E, int repr, double value,
@@ -34,7 +29,7 @@ static double _GD_Extrapolate(DIRFILE *D, gd_entry_t *E, int repr, double value,
   double sample = NAN;
   double data[2];
 
-  dtrace("%p, %p, %i, %g, %lli, %i", D, E, repr, value, limit, eof);
+  dtrace("%p, %p, %i, %g, %lli, %i", D, E, repr, value, (long long)limit, eof);
 
   /* load data */
   n = _GD_DoField(D, E, repr, limit - eof, 2, GD_FLOAT64, data);
@@ -65,8 +60,8 @@ static double _GD_GetIndex(DIRFILE* D, gd_entry_t *E, int repr, double value,
   double low_v, high_v, field_start_v, c_v;
   size_t n;
 
-  dtrace("%p, %p, %i, %g, %lli, %lli", D, E, repr, value, field_start,
-      field_end);
+  dtrace("%p, %p, %i, %g, %lli, %lli", D, E, repr, value,
+      (long long)field_start, (long long)field_end);
 
   /* find the end-points */
   n = _GD_DoField(D, E, repr, field_start, 1, GD_FLOAT64, &low_v);
@@ -217,10 +212,10 @@ double gd_framenum_subset64(DIRFILE* D, const char* field_code_in,
   gd_entry_t* entry;
   char* field_code;
   int repr = GD_REPR_NONE;
-  gd_spf_t spf;
+  unsigned int spf;
 
-  dtrace("%p, \"%s\", %g, %lli, %lli", D, field_code_in, value, field_start,
-      field_end);
+  dtrace("%p, \"%s\", %g, %lli, %lli", D, field_code_in, value,
+      (long long)field_start, (long long)field_end);
 
   if (D->flags & GD_INVALID) {/* don't crash */
     _GD_SetError(D, GD_E_BAD_DIRFILE, 0, NULL, 0, NULL);
@@ -230,7 +225,8 @@ double gd_framenum_subset64(DIRFILE* D, const char* field_code_in,
 
   _GD_ClearError(D);
 
-  entry = _GD_FindFieldAndRepr(D, field_code_in, &field_code, &repr, NULL, 1);
+  entry = _GD_FindFieldAndRepr(D, field_code_in, &field_code, &repr, NULL, 1,
+      1);
 
   if (D->error) {
     dreturn("%g", frame);
@@ -239,6 +235,8 @@ double gd_framenum_subset64(DIRFILE* D, const char* field_code_in,
 
   if (_GD_NativeType(D, entry, repr) & GD_COMPLEX)
     _GD_SetError(D, GD_E_DOMAIN, GD_E_DOMAIN_COMPLEX, NULL, 0, NULL);
+  else if (entry->field_type & GD_SCALAR_ENTRY_BIT)
+    _GD_SetError(D, GD_E_DIMENSION, GD_E_DIM_CALLER, NULL, 0, field_code);
 
   if (field_code != field_code_in)
     free(field_code);
diff --git a/src/internal.h b/src/internal.h
index b409233..c82facd 100644
--- a/src/internal.h
+++ b/src/internal.h
@@ -1,5 +1,5 @@
 /* Copyright (C) 2002-2005 C. Barth Netterfield
- * Copyright (C) 2005-2010 D. V. Wiebe
+ * Copyright (C) 2005-2013 D. V. Wiebe
  *
  ***************************************************************************
  *
@@ -23,75 +23,202 @@
 #define GETDATA_INTERNAL_H
 
 #ifdef HAVE_CONFIG_H
-#include "config.h"
+#include "gd_config.h"
 #endif
 
+#define GD_64BIT_API
 #include "getdata.h"
+
+/* OS X 10.6 deprecates lstat64 */
+#ifdef HAVE_AVAILABILITY_H
+#include <Availability.h>
+#endif
+
+#if defined(__MAC_OS_X_VERSION_MIN_REQUIRED) && \
+  (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1060)
+# undef HAVE_LSTAT64
+# undef HAVE_STRUCT_STAT64
+# ifndef _DARWIN_FEATURE_64_BIT_INODE
+#  define _DARWIN_FEATURE_64_BIT_INODE
+# endif
+#endif
+
+/* library headers */
+#ifdef HAVE_SYS_FILE_H
+#include <sys/file.h>
+#endif
+#ifdef HAVE_SYS_PARAM_H
+#include <sys/param.h>
+#endif
+#ifdef HAVE_SYS_STAT_H
+#include <sys/stat.h>
+#endif
+#ifdef HAVE_SYS_TYPES_H
+#include <sys/types.h>
+#endif
+
+#ifdef STDC_HEADERS
+#include <stdlib.h>
 #include <string.h>
+#include <stdio.h>
+#include <stddef.h>
 #include <errno.h>
-#include <fcntl.h>
+#include <ctype.h>
+#include <limits.h>
+#include <math.h>
+#include <time.h>
+#endif
 
-#ifdef HAVE_UNISTD_H
-#include <unistd.h>
+#ifdef HAVE_FCNTL_H
+#include <fcntl.h>
+#endif
+#ifdef HAVE_DIRENT_H
+#include <dirent.h>
+#endif
+#ifdef HAVE_INTTYPES_H
+#ifndef __STDC_FORMAT_MACROS
+#define __STDC_FORMAT_MACROS
+#endif
+#include <inttypes.h>
+#endif
+#ifdef HAVE_LIBGEN_H
+#include <libgen.h>
+#endif
+#ifdef HAVE_STDDEF_H
+#include <stddef.h>
 #endif
 #ifdef HAVE_STDINT_H
 #include <stdint.h>
 #endif
+#ifdef HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+#ifdef HAVE_DIRECT_H
+#include <direct.h>
+#endif
 
 /* MSVC types */
 #ifdef _MSC_VER
-typedef size_t ssize_t;
+#ifdef _WIN64
+typedef __int64 ssize_t;
+#define PRNssize_t "li"
+#define PRNsize_t  "lu"
+#else
+typedef int ssize_t;
+#define PRNssize_t "i"
+#define PRNsize_t  "u"
+#endif
 typedef int mode_t;
+#else
+#define PRNssize_t "zi"
+#define PRNsize_t  "zu"
 #endif
 
+#ifndef HAVE_OFF64_T
+typedef gd_off64_t off64_t;
+#endif
 
 #ifdef _MSC_VER
-// missing in sys/stat.h
+/* missing in sys/stat.h */
 #define S_ISREG(m)  (((m) & _S_IFMT) == _S_IFREG)
 #define S_ISDIR(m) (((m) & _S_IFMT) == _S_IFDIR)
-#define snprintf _snprintf
 #endif
 
-#ifdef __APPLE__
-typedef off_t off64_t;
+/* the open() in the MSVCRT doesn't permit open()ing directories */
+#ifdef __MSVCRT__
+#define GD_NO_DIR_OPEN
+/* rename open() flags */
+#define O_RDWR _O_RDWR
+#define O_RDONLY _O_RDONLY
+#define O_CREAT _O_CREAT
+#define O_EXCL _O_EXCL
+#define O_TRUNC _O_TRUNC
 #endif
 
 #ifdef GD_NO_C99_API
+/* generic dcomplex pointer for passing around malloc'd vectors */
 #  define GD_DCOMPLEXP_t double *
+/* a dcomplex scalar */
 #  define GD_DCOMPLEXA(v) double v[2]
+/* used when passing the complex arrays from the entry struct */
 #  define GD_DCOMPLEXV(v) double v[][2]
+/* norm */
 #  define cabs(z)  sqrt((z)[0] * (z)[0] + (z)[1] * (z)[1])
+/* phase */
 #  define carg(z)  atan2((z)[1], (z)[0])
+/* real part of z */
 #  define creal(z) ((z)[0])
+/* imaginary part of z */
 #  define cimag(z) ((z)[1])
-#  define _gd_a2c _gd_c2c
-#  define _gd_c2c(a,b) do { (a)[0] = (b)[0]; (a)[1] = (b)[1]; } while(0)
-#  define _gd_c2cp _gd_c2c
-#  define _gd_ca2c(a,b,i) _gd_c2c((a),(b) + 2 * i)
-#  define _gd_cp2ca(a,i,b) do { \
+/* real part of (*z) */
+#  define crealp(z) creal(z)
+/* imaginary part of (*z) */
+#  define cimagp(z) cimag(z)
+/* a pointer to element i of GD_DCOMPLEXP_t array a */
+#  define gd_cap_(a,i) ((GD_DCOMPLEXP_t)(a + 2 * i))
+/* a pointer to a complex scalar */
+#  define gd_csp_(a) ((GD_DCOMPLEXP_t)a)
+/* assign real two-element array b to scalar a */
+#  define gd_ra2cs_(a,b) gd_cs2cs_(a,b)
+/* assign scalar b to scalar a */
+#  define gd_cs2cs_(a,b) do { (a)[0] = (b)[0]; (a)[1] = (b)[1]; } while(0)
+/* assign scalar b to scalar (*a) */
+#  define gd_cs2cp_(a,b) gd_cs2cs_(a,b)
+/* assign b[i] to scalar a */
+#  define gd_ca2cs_(a,b,i) gd_cs2cs_((a),(b) + 2 * i)
+/* assign scalar (*b) to a[i] */
+#  define gd_cp2ca_(a,i,b) do { \
   (a)[2 * i] = (b)[0]; (a)[2 * i + 1] = (b)[1]; \
 } while(0)
-#  define _gd_l2c(a,x,y) do { (a)[0] = (x); (a)[1] = (y); } while(0)
-#  define _gd_r2c(a,b) do { (a)[0] = b; (a)[1] = 0; } while(0)
-#  define _gd_r2ca(a,i,b,t) do { \
+/* assign literal (x;y) to scalar a */
+#  define gd_li2cs_(a,x,y) do { (a)[0] = (x); (a)[1] = (y); } while(0)
+/* assign literal (x;y) to scalar (*a) */
+#  define gd_li2cp_(a,x,y) gd_li2cs_(a,x,y)
+/* assign polar (r,p) to scalar a */
+#  define gd_po2cs_(a,r,p) do { \
+  (a)[0] = (r) * cos(p); (a)[1] = (r) * sin(p); \
+} while (0)
+/* assign polar (r,p) to scalar (*a) */
+#  define gd_po2cp_(a,r,p) gd_po2cs_(a,r,p)
+/* assign real scalar b to scalar a */
+#  define gd_rs2cs_(a,b) gd_li2cs_(a,b,0)
+/* assign real scalar b to scalar (*a) */
+#  define gd_rs2cp_(a,b) gd_rs2cs_(a,b)
+/* assign complex scalar b to a[i], both of type t */
+#  define gd_cs2ca_(a,i,b,t) do { \
+  ((t*)a)[2 * i] = (t)(b)[0]; ((t*)a)[2 * i + 1] = (t)(b)[1]; \
+} while(0)
+/* assign real scalar b to a[i], both of type t */
+#  define gd_rs2ca_(a,i,b,t) do { \
   ((t*)a)[2 * i] = (t)(b); ((t*)a)[2 * i + 1] = 0; \
 } while(0)
-#  define _gd_ccmpl(a,x,y) ((a)[0] == x && (a)[1] == y)
-#  define _gd_ccmpc(a,b) ((a)[0] == (b)[0] && (a)[1] == (b)[1])
+/* compare a to literal (x;y) */
+#  define gd_ccmpl_(a,x,y) ((a)[0] == x && (a)[1] == y)
+/* compare a to b */
+#  define gd_ccmpc_(a,b) ((a)[0] == (b)[0] && (a)[1] == (b)[1])
 #else
 #  define GD_DCOMPLEXP_t double _Complex *
 #  define GD_DCOMPLEXA(v) double _Complex v
-#  define GD_DCOMPLEXV(v) double _Complex* v
-#  define _gd_a2c(a,b) a = *((double complex*)(b))
-#  define _gd_c2c(a,b) a = b
-#  define _gd_c2cp(a,b) *a = b
-#  define _gd_ca2c(a,b,i) a = b[i]
-#  define _gd_cp2ca(a,i,b) (a)[i] = *(b)
-#  define _gd_l2c(a,x,y) a = (x + _Complex_I * y)
-#  define _gd_r2c(a,b) a = b
-#  define _gd_r2ca(a,i,b,t) ((complex t*)a)[i] = (complex t)(b)
-#  define _gd_ccmpl(a,x,y) (a == (x + _Complex_I * y))
-#  define _gd_ccmpc(a,b) (a == b)
+#  define GD_DCOMPLEXV(v) double _Complex *restrict v
+#  define crealp(z) creal(*(z))
+#  define cimagp(z) cimag(*(z))
+#  define gd_cap_(a,i) (a + i)
+#  define gd_csp_(a) (&(a))
+#  define gd_ra2cs_(a,b) a = *((double complex*)(b))
+#  define gd_cs2cs_(a,b) a = b
+#  define gd_cs2cp_(a,b) *a = b
+#  define gd_ca2cs_(a,b,i) a = b[i]
+#  define gd_cp2ca_(a,i,b) (a)[i] = *(b)
+#  define gd_li2cs_(a,x,y) a = (x + _Complex_I * y)
+#  define gd_li2cp_(a,x,y) *a = (x + _Complex_I * y)
+#  define gd_po2cs_(a,r,p) a = (r) * cexp(p)
+#  define gd_po2cp_(a,r,p) *a = (r) * cexp(p)
+#  define gd_rs2cs_(a,b) a = b
+#  define gd_rs2cp_(a,b) *a = b
+#  define gd_cs2ca_(a,i,b,t) ((complex t*)a)[i] = (complex t)(b)
+#  define gd_rs2ca_(a,i,b,t) gd_cs2ca_(a,i,b,t)
+#  define gd_ccmpl_(a,x,y) (a == (x + _Complex_I * y))
+#  define gd_ccmpc_(a,b) (a == b)
 
 #ifdef HAVE_COMPLEX_H
 #include <complex.h>
@@ -109,8 +236,90 @@ double cimag(double complex z);
 #endif
 #endif
 
-/* For FILENAME_MAX */
-#include <stdio.h>
+#ifdef GD_RESTRICT_ARRAY_OK
+#define gd_restrict_arr restrict
+#else
+#define gd_restrict_arr
+#endif
+
+#ifndef PATH_MAX
+# ifdef _POSIX_PATH_MAX
+#  define PATH_MAX _POSIX_PATH_MAX
+# elif defined MAXPATHLEN
+#  define PATH_MAX MAXPATHLEN
+# else
+/* POSIX says we're supposed to check _pathconf in this case, but it goes on to
+ * say that the PATH_MAX value reported by _pathconf isn't guaranteed to be
+ * suitable for mallocing, so its not clear what they're trying to do there.
+ * The following will have to do.
+ */
+#  define PATH_MAX 4096
+# endif
+#endif
+
+/* gd_type_t type for native integers */
+#ifndef SIZEOF_INT
+#define SIZEOF_INT (sizeof(int))
+#endif
+
+#ifndef SIZEOF_UNSIGNED_INT
+#define SIZEOF_UNSIGNED_INT (sizeof(unsigned int))
+#endif
+
+#ifndef SIZEOF_SIZE_T
+#define SIZEOF_SIZE_T (sizeof(size_t))
+#endif
+
+#define GD_SSIZE_T_MAX ((ssize_t)((size_t)-1>>1))
+#define GD_SIZE_T_MAX ((size_t)-1)
+
+#define GD_INT_TYPE ((gd_type_t)(SIZEOF_INT | GD_SIGNED))
+#define GD_UINT_TYPE ((gd_type_t)(SIZEOF_UNSIGNED_INT))
+
+/* default buffer size */
+#if SIZEOF_INT < 4
+#define GD_BUFFER_SIZE 32767
+#else
+#define GD_BUFFER_SIZE 1000000
+#endif
+
+/* the default mplex cycle length */
+#define GD_MPLEX_CYCLE 10
+
+#ifdef _MSC_VER
+# define gd_static_inline_ static
+#else
+# define gd_static_inline_ static inline
+#endif
+
+/* unaligned access */
+#ifdef UNALIGNED_ACCESS_OK
+#define gd_get_unaligned64(p) (*(p))
+#define gd_put_unaligned64(v,p) *(p) = (v)
+#else
+#ifdef HAVE_ASM_UNALIGNED_H
+#include <asm/unaligned.h>
+#endif
+#if defined HAVE_DECL_GET_UNALIGNED && HAVE_DECL_GET_UNALIGNED == 1
+#define gd_get_unaligned64 get_unaligned
+#else
+gd_static_inline_ int64_t gd_get_unaligned64(const void *p)
+{
+  int64_t v;
+  memcpy(&v, p, 8);
+  return v;
+}
+#endif
+#if defined HAVE_DECL_PUT_UNALIGNED && HAVE_DECL_PUT_UNALIGNED == 1
+#define gd_put_unaligned64 put_unaligned
+#else
+gd_static_inline_ int64_t gd_put_unaligned64(int64_t v, void *p)
+{
+  memcpy(p, &v, 8);
+  return v;
+}
+#endif
+#endif
 
 /* For the C99 integer types */
 #ifdef HAVE_INTTYPES_H
@@ -126,15 +335,15 @@ double cimag(double complex z);
 
 #define GD_ARM_FLAG (GD_ARM_ENDIAN | GD_NOT_ARM_ENDIAN)
 
-/* Type conventions:
+/* Internal type conventions:
  *
- *  - samples per frame is always gd_spf_t (aka uin16_t)
- *  - variables holding offsets or file sizes should be of type off64_t (which
- *    may be simply off_t, depending on local LFS support)
+ *  - samples per frame is always unsigned int
+ *  - variables holding offsets or file sizes should be of type gd_off64_t
+ *    (which may be simply off_t, if it's the right size)
  *  - variables holding object sizes or counts of items read or written should
  *    be of type size_t
  *  - public functions taking or returning types of off64_t should have both
- *    a off_t prototype and an off64_t type prototype.
+ *    a off_t prototype and a gd_off64_t type prototype.
  */
 
 #ifndef __attribute_malloc__
@@ -146,9 +355,9 @@ double cimag(double complex z);
 #endif
 
 #ifdef _MSC_VER
-# define __gd_unused
+# define gd_unused_
 #else
-# define __gd_unused __attribute__ (( unused ))
+# define gd_unused_ __attribute__ (( unused ))
 #endif
 
 /* disable the "unspecified order" remark in ICC */
@@ -165,18 +374,19 @@ double cimag(double complex z);
 /* debugging macros */
 #ifdef GETDATA_DEBUG
 #define GD_COL_SIZE 100
-const char* _gd_colnil(void);
-const char* _gd_coladd(void);
-const char* _gd_colsub(void);
-#define dtracevoid() printf("%s %s()\n", _gd_coladd(), __FUNCTION__)
-#define dtrace(fmt, ...) printf("%s %s(" fmt ")\n", _gd_coladd(), \
-    __FUNCTION__, __VA_ARGS__)
-#define dprintf(fmt, ...) printf("%s %s:%i " fmt "\n", _gd_colnil(), \
-    __FUNCTION__, __LINE__, __VA_ARGS__)
-#define dreturnvoid() printf("%s %s = (nil)\n", _gd_colsub(), __FUNCTION__)
-#define dreturn(fmt, ...) printf("%s %s = " fmt "\n", _gd_colsub(), \
-    __FUNCTION__, __VA_ARGS__)
-#define dwatch(fmt, v) printf("%s %s = " fmt "\n", _gd_colnil(), #v, v)
+const char* gd_colnil(void);
+const char* gd_coladd(void);
+const char* gd_colsub(void);
+void gd_colclear(void);
+#define dtracevoid() printf("%s %s()\n", gd_coladd(), __FUNCTION__)
+#define dtrace(fmt, ...) printf("%s %s(" fmt ")\n", gd_coladd(), \
+    __FUNCTION__, ##__VA_ARGS__)
+#define dprintf(fmt, ...) printf("%s %s:%i " fmt "\n", gd_colnil(), \
+    __FUNCTION__, __LINE__, ##__VA_ARGS__)
+#define dreturnvoid() printf("%s %s = (nil)\n", gd_colsub(), __FUNCTION__)
+#define dreturn(fmt, ...) printf("%s %s = " fmt "\n", gd_colsub(), \
+    __FUNCTION__, ##__VA_ARGS__)
+#define dwatch(fmt, v) printf("%s %s = " fmt "\n", gd_colnil(), #v, v)
 #else
 #define dtracevoid()
 #define dtrace(...)
@@ -191,9 +401,6 @@ const char* _gd_colsub(void);
 #endif
 #ifndef O_TEXT
 #define O_TEXT 0
-#define FOPEN_TEXT
-#else
-#define FOPEN_TEXT "t"
 #endif
 
 /* The Microsoft CRT appears to treat %hh as %h */
@@ -210,6 +417,24 @@ const char* _gd_colsub(void);
 #  endif
 #endif
 
+#ifdef HAVE__GETCWD
+# define gd_getcwd _getcwd
+#elif defined HAVE_GETCWD
+# define gd_getcwd getcwd
+#else
+# define gd_getcwd(...) (NULL)
+#endif
+
+#ifndef HAVE_SNPRINTF
+# ifdef HAVE__SNPRINTF
+#  define snprintf _snprintf
+# endif
+#endif
+
+#ifndef HAVE_BASENAME
+char *basename(char *path);
+#endif
+
 #ifndef HAVE_FTELLO64
 #  ifndef HAVE_FTELLO
 #    define ftello64 (off64_t)ftell
@@ -218,10 +443,29 @@ const char* _gd_colsub(void);
 #  endif
 #endif
 
+#ifndef HAVE_LSTAT64
+# ifdef HAVE_LSTAT
+#  define lstat64 lstat
+#  define HAVE_LSTAT64
+# endif
+#endif
+
+#ifndef offsetof
+#define offsetof(t,m) ((size_t)(((char*)&((t*)0)->m) - (char*)0))
+#endif
+
+#ifdef HAVE_READDIR_R
+# define _GD_ReadDir readdir_r
+#else
+int _GD_ReadDir(DIR *dirp, struct dirent *entry, struct dirent **result);
+#endif
+
 #ifdef HAVE__STRTOI64
 #  define gd_strtoll _strtoi64
 #elif defined(HAVE_STRTOLL)
 #  define gd_strtoll strtoll
+#elif defined(HAVE_STRTOQ)
+#  define gd_strtoll strtoq
 #else
 #  define gd_strtoll strtol
 #endif
@@ -230,10 +474,19 @@ const char* _gd_colsub(void);
 #  define gd_strtoull _strtoi64
 #elif defined(HAVE_STRTOULL)
 #  define gd_strtoull strtoull
+#elif defined(HAVE_STRTOUQ)
+#  define gd_strtoll strtouq
 #else
 #  define gd_strtoull strtoul
 #endif
 
+/* the MSVCRT's strtod is not POSIX compliant */
+#ifdef __MSVCRT__
+double gd_strtod(const char *nptr, char **endptr);
+#else
+#define gd_strtod strtod
+#endif
+
 #if defined __MSVCRT__ && defined HAVE__FDOPEN
 #define fdopen _fdopen
 #endif
@@ -242,13 +495,20 @@ const char* _gd_colsub(void);
 #  define fsync _commit
 #endif
 
+#ifndef __MINGW64_VERSION_MAJOR /* mingw-w64 has pthread.h*/
+#ifndef HAVE_PTHREAD_H
 #ifndef HAVE_GMTIME_R
-#include <time.h>
 struct tm *gmtime_r(const time_t *timep, struct tm *result);
 #endif
+#endif
+#endif
 
-#ifdef HAVE__LSEEKI64
-#define lseek64 (off64_t)_lseeki64
+#ifndef HAVE_LSEEK64
+# ifdef HAVE__LSEEKI64
+#  define lseek64 (off64_t)_lseeki64
+# else
+#  define lseek64 (off64_t)lseek
+# endif
 #endif
 
 #ifdef MKDIR_NO_MODE
@@ -263,10 +523,6 @@ struct tm *gmtime_r(const time_t *timep, struct tm *result);
 #define EOVERFLOW EINVAL
 #endif
 
-#ifndef HAVE_MKSTEMP
-int mkstemp(char*);
-#endif
-
 #if defined __MSVCRT__ && defined HAVE__OPEN
 #define open _open
 #endif
@@ -275,27 +531,10 @@ int mkstemp(char*);
 #define read _read
 #endif
 
-/* rename shenanigans: MSVCRT's rename doesn't overwrite existing files, so
- * we have to make a rename function that will, otherwise we just use the
- * system function. */
-#ifdef __MSVCRT__
-int _GD_Rename(const char*, const char*);
-#else
-#define _GD_Rename rename
-#endif
-
 #if defined __MSVCRT__ && defined HAVE__RMDIR
 #define rmdir _rmdir
 #endif
 
-#if HAVE_STAT64
-#  define gd_stat64 stat64
-#elif HAVE__STAT64
-#  define gd_stat64 _stat64
-#else
-#  define gd_stat64 stat
-#endif
-
 #if HAVE_STRUCT_STAT64
 typedef struct stat64 gd_stat64_t;
 #elif HAVE_STRUCT__STAT64
@@ -304,6 +543,69 @@ typedef struct _stat64 gd_stat64_t;
 typedef struct __stat64 gd_stat64_t;
 #else
 typedef struct stat gd_stat64_t;
+#define GD_NO_64BIT_STAT
+#endif
+
+#ifdef GD_NO_64BIT_STAT
+# define gd_stat64 stat
+# define gd_fstat64 fstat
+#else
+# if HAVE_STAT64
+#  define gd_stat64 stat64
+# elif HAVE__STAT64
+#  define gd_stat64 _stat64
+# else
+#  define gd_stat64 stat
+# endif
+
+# if HAVE_FSTAT64
+#  define gd_fstat64 fstat64
+# elif HAVE__FSTAT64
+#  define gd_fstat64 _fstat64
+# elif HAVE__FSTAT
+#  define gd_fstat64 _fstat
+# else
+#  define gd_fstat64 fstat
+# endif
+#endif
+
+#ifdef HAVE_OPENAT
+# ifdef GETDATA_DEBUG
+#  define gd_unused_d /**/
+# else
+#  define gd_unused_d gd_unused_
+# endif
+# define gd_OpenAt(d,...) openat(__VA_ARGS__)
+#else
+# define gd_unused_d /**/
+int gd_OpenAt(const DIRFILE*, int, const char*, int, mode_t);
+#endif
+
+#ifdef HAVE_FSTATAT
+# define gd_StatAt(d,...) fstatat(__VA_ARGS__)
+#else
+#ifndef HAVE_SYS_STAT_H
+struct stat;
+#endif
+int gd_StatAt(const DIRFILE*, int, const char*, struct stat*, int);
+#endif
+
+#ifdef HAVE_RENAMEAT
+#define gd_RenameAt(d,...) renameat(__VA_ARGS__)
+#else
+int gd_RenameAt(const DIRFILE *D, int, const char*, int, const char*);
+#endif
+
+#ifdef HAVE_UNLINKAT
+# define gd_UnlinkAt(d,...) unlinkat(__VA_ARGS__)
+#else
+int gd_UnlinkAt(const DIRFILE*, int, const char*, int);
+#endif
+
+#ifdef HAVE_FSTATAT64
+# define gd_StatAt64(d,...) fstatat64(__VA_ARGS__)
+#else
+int gd_StatAt64(const DIRFILE*, int, const char*, gd_stat64_t*, int);
 #endif
 
 #if ! HAVE_DECL_STRERROR_R
@@ -314,6 +616,16 @@ int strerror_r(int, char*, size_t);
 #endif
 #endif
 
+#if defined HAVE_FTRUNCATE64
+#define gd_truncate ftruncate64
+#elif defined HAVE_FTRUNCATE
+#define gd_truncate(d,l) ftruncate(d, (off_t)l)
+#elif defined HAVE__CHSIZE_S
+#define gd_truncate(d,l) _chsize_s(d, (int64_t)l)
+#elif defined HAVE__CHSIZE
+#define gd_truncate(d,l) _chsize(d, (long)l)
+#endif
+
 #if defined __MSVCRT__ && defined HAVE__UNLINK
 #define unlink _unlink
 #endif
@@ -326,46 +638,128 @@ int strerror_r(int, char*, size_t);
 ssize_t getdelim(char**, size_t*, int, FILE*);
 #endif
 
+/* byte swapping */
+#ifdef HAVE_BYTESWAP_H
+#include <byteswap.h>
+#endif
+#ifdef HAVE_SYS_ENDIAN_H
+#include <sys/endian.h>
+#endif
+#ifdef HAVE_LIBKERN_OSBYTEORDER_H
+#include <libkern/OSByteOrder.h>
+#endif
+#if defined HAVE_DECL_BSWAP_16 && HAVE_DECL_BSWAP_16 == 1
+# define gd_swap16 bswap_16
+# define gd_swap32 bswap_32
+# define gd_swap64 bswap_64
+#elif defined HAVE_DECL_OSSWAPINT16 && HAVE_DECL_OSSWAPINT16 == 1
+# define gd_swap16 OSSwapInt16
+# define gd_swap32 OSSwapInt32
+# define gd_swap64 OSSwapInt64
+#elif defined HAVE_DECL_BSWAP16 && HAVE_DECL_BSWAP16 == 1
+# define gd_swap16 bswap16
+# define gd_swap32 bswap32
+# define gd_swap64 bswap64
+#else
+# define gd_swap16(x) (((uint16_t)(x) << 8) | ((uint16_t)(x) >> 8))
+# define gd_swap32(x) ( \
+    (((uint32_t)(x) << 24) & 0xff000000UL) | \
+    (((uint32_t)(x) << 8)  & 0xff0000UL) | \
+    (((uint32_t)(x) >> 8)  & 0xff00UL) | \
+    ((uint32_t)(x) >> 24))
+#define gd_swap64(x) ( \
+     (((uint64_t)(x) << 56) | \
+     (((uint64_t)(x) << 40) & 0xff000000000000ULL) | \
+     (((uint64_t)(x) << 24) & 0xff0000000000ULL) | \
+     (((uint64_t)(x) << 8)  & 0xff00000000ULL) | \
+     (((uint64_t)(x) >> 8)  & 0xff000000ULL) | \
+     (((uint64_t)(x) >> 24) & 0xff0000ULL) | \
+     (((uint64_t)(x) >> 40) & 0xff00ULL) | \
+     ((uint64_t)(x)  >> 56)))
+#endif
+
+/* path malarkey */
+#define _GD_IsDirSep(c) (((c) == GD_DIRSEP) || ((c) == '/'))
+#if defined _WIN32 || defined _WIN64
+# define _GD_AbsPath(s)  (s && ((s)[0] == '/' || (s)[0] == GD_DIRSEP || \
+                                  ((s)[0] != '\0' && (s)[1] == ':')))
+# define _GD_Root(s,d,l) \
+  do { \
+    if ((d)[0] == '/' || (d)[0] == GD_DIRSEP) { \
+      (s)[0] = (d)[0]; \
+      l = 1; \
+      if ((d)[1] == '/' || (d)[1] == GD_DIRSEP) { \
+        (s)[1] = (d)[1]; \
+        l = 2; \
+      } \
+    } else { \
+      (s)[0] = (d)[0]; \
+      (s)[1] = ':'; \
+      (s)[2] = '\\'; \
+      (s)[3] = '\0'; \
+      l = 3; \
+    } \
+  } while (0)
+# define _GD_RootLen(d) ( \
+    ((d)[0] == '/' || (d)[0] == GD_DIRSEP) ? \
+    ((d)[1] == '/' || (d)[1] == GD_DIRSEP) ? 2 : 1 : 3 \
+    )
+#else
+# define _GD_AbsPath(s)  (s && (s)[0] == '/')
+# define _GD_Root(s,d,l) \
+  do { \
+    (s)[0] = '/'; \
+    (s)[1] = '\0'; \
+    l = 1; \
+  } while (0)
+# define _GD_RootLen(d) 1
+#endif
 
 /* maximum number of recursions */
 #define GD_MAX_RECURSE_LEVEL  32
 
 #define MAX_IN_COLS (3 * GD_MAX_LINCOM + 5) /* for META lincom */
 
-#ifndef FILENAME_MAX
-#  define FILENAME_MAX 4096
-#endif
-
 /* Suberror codes */
+/* GD_E_FORMAT suberrors are in getdata.h */
+
 #define GD_E_OPEN_NOT_EXIST    1
 #define GD_E_OPEN_NOT_DIRFILE  2
 #define GD_E_OPEN_NO_ACCESS    3
+#define GD_E_OPEN_PATH         4
 
 #define GD_E_TRUNC_STAT        1
 #define GD_E_TRUNC_UNLINK      2
 #define GD_E_TRUNC_DIR         3
 
 #define GD_E_CREAT_FORMAT      1
-#define GD_E_CREAT_EXCL        2
-#define GD_E_CREAT_DIR         3
+#define GD_E_CREAT_DIR         2
+#define GD_E_CREAT_OPEN        3
 
-/* GD_E_FORMAT suberrors are in getdata.h */
+#define GD_E_CODE_MISSING      1
+#define GD_E_CODE_INVALID      2
 
 #define GD_E_LINFILE_LENGTH    1
 #define GD_E_LINFILE_OPEN      2
 
+#define GD_E_RECURSE_CODE       1
+#define GD_E_RECURSE_INCLUDE    2
+
 #define GD_E_FIELD_PUT         1
 #define GD_E_FIELD_BAD         2
 #define GD_E_FIELD_MATCH       3
 
-#define GD_E_BAD_ENTRY_TYPE     1
-#define GD_E_BAD_ENTRY_METARAW  2
-#define GD_E_BAD_ENTRY_SPF      3 
-#define GD_E_BAD_ENTRY_NFIELDS  4
-#define GD_E_BAD_ENTRY_NUMBITS  5
-#define GD_E_BAD_ENTRY_BITNUM   6
-#define GD_E_BAD_ENTRY_BITSIZE  7
-#define GD_E_BAD_ENTRY_POLYORD  8
+#define GD_E_ENTRY_TYPE      1
+#define GD_E_ENTRY_METARAW   2
+#define GD_E_ENTRY_SPF       3
+#define GD_E_ENTRY_NFIELDS   4
+#define GD_E_ENTRY_NUMBITS   5
+#define GD_E_ENTRY_BITNUM    6
+#define GD_E_ENTRY_BITSIZE   7
+#define GD_E_ENTRY_POLYORD   8
+#define GD_E_ENTRY_WINDOP    9
+#define GD_E_ENTRY_CNTVAL   10
+#define GD_E_ENTRY_PERIOD   11
 
 #define GD_E_SCALAR_CODE        1
 #define GD_E_SCALAR_TYPE        2
@@ -379,6 +773,7 @@ ssize_t getdelim(char**, size_t*, int, FILE*);
 #define GD_E_DEL_META           1
 #define GD_E_DEL_CONST          2
 #define GD_E_DEL_DERIVED        3
+#define GD_E_DEL_ALIAS          4
 
 #define GD_E_REPR_UNKNOWN       1
 #define GD_E_REPR_PUT           2
@@ -386,6 +781,7 @@ ssize_t getdelim(char**, size_t*, int, FILE*);
 #define GD_E_DOMAIN_COMPLEX     1
 #define GD_E_DOMAIN_EMPTY       2
 #define GD_E_DOMAIN_ANTITONIC   3
+#define GD_E_DOMAIN_MULTIPOS    4
 
 #define GD_E_OUT_OF_RANGE       1
 #define GD_E_SINGULAR_RANGE     2
@@ -397,17 +793,40 @@ ssize_t getdelim(char**, size_t*, int, FILE*);
 #define GD_E_FLUSH_OPEN         2
 #define GD_E_FLUSH_RENAME       3
 
-#define GD_E_VERS_NONE          1
-#define GD_E_VERS_MISSING       2
+#define GD_E_UNENC_UNDET        1
+#define GD_E_UNENC_TARGET       2
+
+#define GD_E_ARG_WHENCE         1
+#define GD_E_ARG_ENDIANNESS     2
+#define GD_E_ARG_PROTECTION     3
+#define GD_E_ARG_NODATA         4
+#define GD_E_ARG_NO_VERS        5
+#define GD_E_ARG_BAD_VERS       6
+
 
-struct _gd_raw_file {
+/* I/O flags */
+#define GD_FILE_READ  0x1
+#define GD_FILE_WRITE 0x2
+#define GD_FILE_RDWR  ( GD_FILE_READ | GD_FILE_WRITE )
+#define GD_FILE_TEMP  0x4
+#define GD_FILE_TOUCH 0x8
+
+/* lists -- all the entry types plus alias, scalar, vector, all */
+#define GD_N_ENTRY_LISTS (GD_N_ENTYPES + 4)
+
+#define GD_LIST_VALID_STRING_VALUE 0x01
+
+struct gd_raw_file_ {
   char* name;
-  int fp;
+  int idata;
   void* edata;
-  int encoding;
+  int subenc;
+  const DIRFILE *D;
+  unsigned int mode;
+  off64_t pos;
 };
 
-struct _gd_lut {
+struct gd_lut_ {
   double x;
   union {
     double r;
@@ -416,48 +835,54 @@ struct _gd_lut {
 };
 
 /* Unified entry struct */
-struct _gd_private_entry {
+struct gd_private_entry_ {
   gd_entry_t* entry[GD_MAX_LINCOM];
   int repr[GD_MAX_LINCOM];
 
   int calculated;
 
   int n_meta;
-  int n_meta_string;
-  int n_meta_carray;
-  int n_meta_const;
   union {
     gd_entry_t** meta_entry;
     const gd_entry_t* parent;
   } p;
 
   /* field lists */
-  const char** field_list;
-  const char** vector_list;
-  char** type_list[GD_N_ENTYPES];
+  const char **alias_list;
+  const char **entry_list[GD_N_ENTRY_LISTS];
+  unsigned int entry_list_flags[GD_N_ENTRY_LISTS];
   const char** string_value_list;
-  void* const_value_list;
+  void *const_value_list;
   gd_carray_t *carray_value_list;
+  uint32_t value_list_validity;
+  uint32_t entry_list_validity;
 
   union {
     struct { /* RAW */
       char* filebase;
       size_t size;
-      struct _gd_raw_file file[2]; /* encoding framework data */
+      struct gd_raw_file_ file[2]; /* encoding framework data */
     } raw;
     struct { /* LINTERP */
-      char *table_path;
+      char *table_file;
+      int table_dirfd;
       int table_len;
       int complex_table;
       int table_monotonic;
-      struct _gd_lut *lut;
+      struct gd_lut_ *lut;
     } linterp;
     struct { /* CONST */
       void *d;
       int n_client;
       gd_entry_t** client;
     } scalar;
-    char* string;
+    struct { /* MPLEX */
+      gd_type_t type;
+      off64_t sample;
+      char d[16];
+    } mplex;
+    char *string; /* STRING */
+    off64_t index_pos; /* INDEX */
   } u;
 };
 
@@ -468,63 +893,75 @@ struct _gd_private_entry {
 #define GD_ENC_ASCII      4
 #define GD_ENC_LZMA_RAW   5
 #define GD_ENC_XZ_RAW     6
-#define GD_ENC_UNKNOWN    7
+#define GD_ENC_SIE        7
+#define GD_ENC_ZZIP       8
+#define GD_ENC_ZZSLIM     9
+#define GD_ENC_UNKNOWN   10
 
 #define GD_N_SUBENCODINGS (GD_ENC_UNKNOWN + 1)
 
-#define GD_EF_OPEN   0x001
-#define GD_EF_CLOSE  0x002
-#define GD_EF_TOUCH  0x004
-#define GD_EF_SEEK   0x008
-#define GD_EF_READ   0x010
-#define GD_EF_SIZE   0x020
-#define GD_EF_WRITE  0x040
-#define GD_EF_SYNC   0x080
-#define GD_EF_MOVE   0x100
-#define GD_EF_UNLINK 0x200
-#define GD_EF_TEMP   0x400
-
-#define GD_TEMP_OPEN    0
-#define GD_TEMP_MOVE    1
-#define GD_TEMP_DESTROY 2
+#define GD_EF_NAME    0x0001
+#define GD_EF_OPEN    0x0002
+#define GD_EF_CLOSE   0x0004
+#define GD_EF_SEEK    0x0008
+#define GD_EF_READ    0x0010
+#define GD_EF_SIZE    0x0020
+#define GD_EF_WRITE   0x0040
+#define GD_EF_SYNC    0x0080
+#define GD_EF_MOVE    0x0100
+#define GD_EF_UNLINK  0x0200
+
+#define GD_FINIRAW_KEEP      0x0
+#define GD_FINIRAW_DISCARD   0x1
+#define GD_FINIRAW_DEFER     0x2
+#define GD_FINIRAW_CLOTEMP   0x4
 
 #define BUFFER_SIZE 9000000
 
-#ifndef HAVE_OFF64_T
-# ifndef __APPLE__
-typedef off_t off64_t;
-# endif
-# define lseek64 lseek
-# define stat64 stat
-#endif
-
 /* helper macro */
 #if defined ARM_ENDIAN_FLOATS || \
   ((defined WORDS_BIGENDIAN) ^ (defined FLOATS_BIGENDIAN))
 #  define SCREWY_FLOATS
 #endif
 
+typedef int (*gd_ef_name_t)(DIRFILE *D, const char *, struct gd_raw_file_*,
+    const char*, int, int);
+typedef int (*gd_ef_open_t)(int, struct gd_raw_file_*, int, unsigned int);
+typedef off64_t (*gd_ef_seek_t)(struct gd_raw_file_*, off64_t, gd_type_t,
+    unsigned int);
+typedef off64_t (*gd_ef_size_t)(int, struct gd_raw_file_*, gd_type_t, int);
+typedef ssize_t (*gd_ef_read_t)(struct gd_raw_file_*, void*, gd_type_t, size_t);
+typedef ssize_t (*gd_ef_write_t)(struct gd_raw_file_*, const void*, gd_type_t,
+    size_t);
+typedef int (*gd_ef_close_t)(struct gd_raw_file_*);
+typedef int (*gd_ef_sync_t)(struct gd_raw_file_*);
+typedef int (*gd_ef_unlink_t)(int, struct gd_raw_file_*);
+typedef int (*gd_ef_move_t)(int, struct gd_raw_file_*, int, char*);
+
+/* Encoding scheme flags */
+#define GD_EF_ECOR 0x1 /* post-framework byte-sex correction required */
+#define GD_EF_SWAP 0x2 /* in-framework byte-sex metadata correction required */
+#define GD_EF_OOP  0x4 /* writes occur out-of-place */
+#define GD_EF_EDAT 0x8 /* The /ENCODING datum is used */
 /* Encoding schemes */
 extern struct encoding_t {
   unsigned long int scheme;
   const char* ext;
-  int ecor; /* encoding requires byte-sex correction */
+  unsigned int flags; /* flags */
   const char* affix;
   const char* ffname;
   unsigned int provides;
-  int (*open)(struct _gd_raw_file*, int, int);
-  int (*close)(struct _gd_raw_file*);
-  int (*touch)(struct _gd_raw_file*);
-  off64_t (*seek)(struct _gd_raw_file*, off64_t, gd_type_t, int);
-  ssize_t (*read)(struct _gd_raw_file*, void*, gd_type_t, size_t);
-  off64_t (*size)(struct _gd_raw_file*, gd_type_t);
-  ssize_t (*write)(struct _gd_raw_file*, const void*, gd_type_t,
-      size_t);
-  int (*sync)(struct _gd_raw_file*);
-  int (*move)(struct _gd_raw_file*, char*);
-  int (*unlink)(struct _gd_raw_file*);
-  int (*temp)(struct _gd_raw_file*, int);
-} _gd_ef[GD_N_SUBENCODINGS];
+  gd_ef_name_t name;
+  gd_ef_open_t open;
+  gd_ef_close_t close;
+  gd_ef_seek_t seek;
+  gd_ef_read_t read;
+  gd_ef_size_t size;
+  gd_ef_write_t write;
+  gd_ef_sync_t sync;
+  gd_ef_move_t move;
+  gd_ef_unlink_t unlink;
+} gd_ef_[GD_N_SUBENCODINGS];
 
 /* Format file fragment metadata */
 struct gd_fragment_t {
@@ -532,26 +969,39 @@ struct gd_fragment_t {
   char* cname;
   /* Subdirectory name */
   char* sname;
-  /* External name (relative to the parent format file fragment) */
+  /* basename */
+  char *bname;
+  /* External name (the one that appears in the format file) */
   char* ename;
+  void *enc_data;
   int modified;
   int parent;
+  int dirfd;
+  time_t mtime;
   unsigned long int encoding;
   unsigned long int byte_sex;
   int protection;
   char* ref_name;
   off64_t frame_offset;
   uint32_t vers;
+
+  char *prefix;
+  char *suffix;
+};
+
+/* directory metadata */
+struct gd_dir_t {
+  char *path;
+  int fd;
+  int rc;
 };
 
 /* internal flags */
+#define GD_MULTISTANDARD   0x20000000 /* have multiple standards in format */
 #define GD_HAVE_VERSION    0x40000000 /* have computed the version */
 #define GD_INVALID         0x80000000 /* the dirfile is invalid */
 
-#define LIST_VALID_FIELD        0x01
-#define LIST_VALID_VECTOR       0x02
-#define LIST_VALID_STRING_VALUE 0x04
-
+/* representation suffixes */
 #define GD_REPR_NONE 0
 #define GD_REPR_REAL 'r'
 #define GD_REPR_IMAG 'i'
@@ -561,7 +1011,7 @@ struct gd_fragment_t {
 #define GD_REPR_AUTO GD_REPR_REAL
 
 /* The DIRFILE struct.  */
-struct _GD_DIRFILE {
+struct gd_dirfile_ {
   /* library error data */
   int error;
   int suberror;
@@ -571,15 +1021,20 @@ struct _GD_DIRFILE {
 
   /* global data */
   unsigned long int flags;
+
+  char *error_prefix;
+  unsigned long int open_flags; /* the original flags (used in gd_desynced) */
   uint64_t av;
   int standards;
+  int n_error;
+  int lookback;
+
+  /* for the public tokeniser */
+  char *tok_base;
+  const char *tok_pos;
 
   /* field counts */
   unsigned int n_entries;
-  unsigned int n_string;
-  unsigned int n_carray;
-  unsigned int n_const;
-  unsigned int n_meta;
   unsigned int n_dot;
 
   /* field array */
@@ -589,9 +1044,13 @@ struct _GD_DIRFILE {
   /* the reference field */
   gd_entry_t* reference_field;
 
-  /* directory name */
+  /* directory name (this is just whatever was passed to gd_open() */
   char* name;
 
+  /* directory list */
+  unsigned int ndir;
+  struct gd_dir_t *dir;
+
   /* recursion counter */
   int recurse_level;
 
@@ -600,171 +1059,264 @@ struct _GD_DIRFILE {
   int n_fragment;
 
   /* field lists */
-  const char** field_list;
-  const char** vector_list;
-  const char** type_list[GD_N_ENTYPES];
-  const char** string_value_list;
-  void* const_value_list;
+  const char **entry_list[GD_N_ENTRY_LISTS];
+  unsigned int entry_list_flags[GD_N_ENTRY_LISTS];
+  const char **string_value_list;
+  void *const_value_list;
   gd_carray_t *carray_value_list;
-  int list_validity;
-  int type_list_validity;
+  uint32_t value_list_validity;
+  uint32_t entry_list_validity;
 
   /* syntax error callback */
   gd_parser_callback_t sehandler;
   void* sehandler_extra;
 };
 
-extern const gd_entype_t _gd_entype_index[GD_N_ENTYPES];
-
-void* _GD_Alloc(DIRFILE* D, gd_type_t type, size_t n);
-void _GD_ArmEndianise(uint64_t* databuffer, int is_complex, size_t ns);
-int _GD_BadInput(DIRFILE* D, gd_entry_t* E, int i);
-int _GD_CalculateEntry(DIRFILE* D, gd_entry_t* E);
-void _GD_CInvertData(DIRFILE* D, void* data, gd_type_t return_type,
-    GD_DCOMPLEXA(dividend), size_t n_read);
+/* forward declarations */
+void *_GD_Alloc(DIRFILE*, gd_type_t, size_t) __attribute_malloc__;
+void _GD_ArmEndianise(uint64_t*, int, size_t);
+int _GD_BadInput(DIRFILE *, const gd_entry_t *, int, int);
+
+#define _GD_BadWindop(op) \
+  ( \
+   (op != GD_WINDOP_EQ) && (op != GD_WINDOP_GE) && (op != GD_WINDOP_GT) && \
+   (op != GD_WINDOP_LE) && (op != GD_WINDOP_LT) && (op != GD_WINDOP_NE) && \
+   (op != GD_WINDOP_SET) && (op != GD_WINDOP_CLR) \
+  )
+
+int _GD_CalculateEntry(DIRFILE *restrict, gd_entry_t *restrict, int);
+char *_GD_CanonicalPath(const char *restrict, const char *restrict);
+gd_entry_t *_GD_CheckParent(DIRFILE *restrict D, char **restrict name, int me,
+    int linenum);
+int _GD_CheckCodeAffixes(DIRFILE *D, const gd_entry_t *P,
+    const char *field_code, int fragment);
+void _GD_CInvertData(DIRFILE *restrict, void *restrict, gd_type_t return_type,
+    GD_DCOMPLEXA(dividend), size_t);
 
 /* _GD_ClearError: Everything's A-OK; clear the last error. */
 #define _GD_ClearError(D) (D)->error = 0
 
-void _GD_CLincomData(DIRFILE* D, int n, void* data1, gd_type_t return_type,
-    GD_DCOMPLEXP(data2), GD_DCOMPLEXP(data3), GD_DCOMPLEXV(m), GD_DCOMPLEXV(b),
-    gd_spf_t *spf, size_t n_read);
-void _GD_ConvertType(DIRFILE* D, const void *data_in, gd_type_t in_type,
-    void *data_out, gd_type_t out_type, size_t n) gd_nothrow;
+void _GD_CLincomData(DIRFILE *restrict, int, void *restrict, gd_type_t,
+    const GD_DCOMPLEXP_t restrict, const GD_DCOMPLEXP_t restrict,
+    GD_DCOMPLEXV(m), GD_DCOMPLEXV(b), const unsigned int *restrict, size_t);
+void _GD_ConvertType(DIRFILE *restrict, const void *restrict, gd_type_t,
+    void *restrict, gd_type_t, size_t) gd_nothrow;
 gd_type_t _GD_ConstType(DIRFILE *D, gd_type_t type);
-size_t _GD_DoField(DIRFILE*, gd_entry_t*, int, off64_t, size_t, gd_type_t,
-    void*);
-size_t _GD_DoFieldOut(DIRFILE*, gd_entry_t*, int, off64_t, size_t, gd_type_t,
-    const void*);
-gd_entry_t* _GD_FindField(DIRFILE* D, const char* field_code,
-    gd_entry_t** list, unsigned int u, unsigned int *index);
-gd_entry_t* _GD_FindFieldAndRepr(DIRFILE* D, const char* field_code_in,
-    char** field_code, int* repr, unsigned int *index, int set);
+const char *_GD_DirName(const DIRFILE *D, int dirfd);
+size_t _GD_DoField(DIRFILE *restrict, gd_entry_t *restrict, int, off64_t,
+    size_t, gd_type_t, void *restrict);
+size_t _GD_DoFieldOut(DIRFILE *restrict, gd_entry_t *restrict, int, off64_t,
+    size_t, gd_type_t, const void *restrict);
+size_t _GD_DoStringOut(DIRFILE *restrict D, gd_entry_t *restrict E,
+    const char *data_in);
+int _GD_EntryCmp(const void*, const void*);
+gd_entry_t *_GD_FindField(const DIRFILE *restrict, const char *restrict,
+    gd_entry_t *const *, unsigned int, int, unsigned int *restrict);
+gd_entry_t *_GD_FindFieldAndRepr(DIRFILE *restrict, const char *restrict,
+    char **restrict, int *restrict, unsigned int *restrict, int, int);
 uint64_t _GD_FindVersion(DIRFILE *D);
-void _GD_FixEndianness(char* databuffer, size_t size, size_t ns);
-void _GD_Flush(DIRFILE* D, gd_entry_t *E);
+void _GD_FixEndianness(void* databuffer, size_t size, size_t ns);
+#ifdef WORDS_BIGENDIAN
+#define _GD_FileSwapBytes(D,i) ((D)->fragment[i].byte_sex & GD_LITTLE_ENDIAN)
+#else
+#define _GD_FileSwapBytes(D,i) ((D)->fragment[i].byte_sex & GD_BIG_ENDIAN)
+#endif
+int _GD_FiniRawIO(DIRFILE*, const gd_entry_t*, int, int);
+void _GD_Flush(DIRFILE *restrict, gd_entry_t *restrict, int, int);
 void _GD_FlushMeta(DIRFILE* D, int fragment, int force);
-void _GD_FreeE(gd_entry_t* E, int priv);
-char *_GD_GetLine(FILE *fp, size_t *n, int* linenum);
-int _GD_GetRepr(DIRFILE*, const char*, char**);
-gd_spf_t _GD_GetSPF(DIRFILE* D, gd_entry_t* E);
-int _GD_Include(DIRFILE* D, const char* ename, const char* format_file,
-    int linenum, char** ref_name, int me, int* standards, unsigned long *flags);
+void _GD_FreeE(DIRFILE *restrict, gd_entry_t *restrict, int);
+off64_t _GD_GetEOF(DIRFILE *restrict, const gd_entry_t *restrict,
+    const char *restrict, int *restrict);
+off64_t _GD_GetFilePos(DIRFILE *restrict, gd_entry_t *restrict, off64_t);
+char *_GD_GetLine(FILE *restrict, size_t *restrict, int *restrict);
+int _GD_GetRepr(DIRFILE *restrict, const char *restrict,
+    char **restrict, int);
+unsigned int _GD_GetSPF(DIRFILE*, gd_entry_t*);
+int _GD_GrabDir(DIRFILE*, int, const char *restrict);
+int _GD_Include(DIRFILE*, const char *restrict, const char *restrict, int,
+    char **restrict, int, const char *restrict, const char *restrict,
+    int *restrict, unsigned long *restrict, int);
 void _GD_InitialiseFramework(void);
-void _GD_InvertData(DIRFILE* D, void* data, gd_type_t return_type,
+int _GD_InitRawIO(DIRFILE*, const gd_entry_t*, const char*, int,
+    const struct encoding_t*, unsigned int, unsigned int, int);
+void _GD_InvertData(DIRFILE *restrict, void *restrict, gd_type_t return_type,
     double dividend, size_t n_read);
-void _GD_InsertSort(DIRFILE* D, gd_entry_t* E, int u) gd_nothrow;
+void _GD_InsertSort(DIRFILE *restrict, gd_entry_t *restrict, int u) gd_nothrow;
 
 #define _GD_InternalError(D) \
   _GD_SetError(D, GD_E_INTERNAL_ERROR, 0, __FILE__, __LINE__, NULL)
 
+int _GD_InvalidEntype(gd_entype_t t);
 gd_type_t _GD_LegacyType(char c);
-void _GD_LincomData(DIRFILE* D, int n, void* data1, gd_type_t return_type,
-    double *data2, double *data3, double* m, double *b, gd_spf_t *spf,
-    size_t n_read);
-void _GD_LinterpData(DIRFILE* D, void *data, gd_type_t type, int complex_table,
-    const double *data_in, size_t npts, const struct _gd_lut *lut, size_t n_ln);
-int _GD_MissingFramework(int32_t encoding, unsigned int funcs);
-int _GD_MogrifyFile(DIRFILE* D, gd_entry_t* E, unsigned long int encoding,
-    unsigned long int byte_sex, off64_t offset, int finalise, int new_fragment,
-    char* new_filebase);
-gd_type_t _GD_NativeType(DIRFILE* D, gd_entry_t* E, int repr);
-gd_entry_t* _GD_ParseFieldSpec(DIRFILE* D, int n_cols, char** in_cols,
-    const gd_entry_t* P, const char* format_file, int linenum, int me,
-    int standards, int creat, unsigned long flags, int insert, char **outstring,
-    const char *tok_pos);
-char* _GD_ParseFragment(FILE* fp, DIRFILE *D, int me, int* standards,
-    unsigned long int *flags);
-void _GD_ReadLinterpFile(DIRFILE* D, gd_entry_t *E);
-int _GD_SetEncodedName(DIRFILE* D, struct _gd_raw_file* file, const char* base,
-    int temp);
-void _GD_SetError(DIRFILE* D, int error, int suberror, const char* format_file,
-    int line, const char* token);
-int _GD_SetTablePath(DIRFILE *D, gd_entry_t *E, struct _gd_private_entry *e);
-int _GD_Supports(DIRFILE* D, gd_entry_t* E, unsigned int funcs);
-int _GD_Tokenise(DIRFILE *D, const char* instring, char **outstring,
-    const char **pos, char** in_cols, const char* format_file, int linenum,
+void _GD_LincomData(DIRFILE *restrict, int n, void *restrict,
+    gd_type_t return_type, const double *restrict, const double *restrict,
+    const double *restrict, const double *restrict,
+    const unsigned int *restrict, size_t);
+void _GD_LinterpData(DIRFILE *restrict, void *restrict, gd_type_t, int,
+    const double *restrict, size_t, const struct gd_lut_ *restrict, size_t);
+int _GD_ListEntry(const gd_entry_t *E, int meta, int hidden, int noalias,
+    int special, gd_entype_t type);
+char *_GD_MakeFullPath(DIRFILE *restrict, int, const char *restrict, int);
+#ifdef USE_MODULES
+#define _GD_MakeFullPathOnly gd_MakeFullPathOnly
+#else
+#define gd_MakeFullPathOnly _GD_MakeFullPathOnly
+#endif
+char *_GD_MakeFullPathOnly(const DIRFILE *D, int dirfd, const char *name);
+int _GD_MakeTempFile(const DIRFILE*, int, char*);
+void *_GD_Malloc(DIRFILE *D, size_t size);
+int _GD_MissingFramework(int encoding, unsigned int funcs);
+int _GD_MogrifyFile(DIRFILE *restrict, gd_entry_t *restrict, unsigned long int,
+    unsigned long int, off64_t, int, int, char *restrict);
+char *_GD_MungeCode(DIRFILE *restrict, const gd_entry_t *restrict,
+    const char *restrict, const char *restrict, const char *restrict,
+    const char *restrict, const char *restrict, int *restrict, int);
+char *_GD_MungeFromFrag(DIRFILE *restrict, const gd_entry_t *restrict, int,
+    const char *restrict, int *restrict);
+gd_type_t _GD_NativeType(DIRFILE *restrict, gd_entry_t *restrict, int);
+unsigned int _GD_NEntries(DIRFILE*, struct gd_private_entry_*, int,
+    unsigned int);
+DIRFILE *_GD_Open(DIRFILE*, int, const char*, unsigned long,
+    gd_parser_callback_t, void*);
+gd_entry_t *_GD_ParseFieldSpec(DIRFILE *restrict, int, char**,
+    const gd_entry_t *restrict, const char *restrict, int, int, int, int,
+    unsigned long, int, char**, const char*);
+char *_GD_ParseFragment(FILE *restrict, DIRFILE *, int, int *restrict,
+    unsigned long int *, int);
+void _GD_ReadLinterpFile(DIRFILE *restrict, gd_entry_t *restrict);
+void *_GD_Realloc(DIRFILE *restrict, void *restrict, size_t size);
+void _GD_ReleaseDir(DIRFILE *D, int dirfd);
+int _GD_Seek(DIRFILE *restrict, gd_entry_t *restrict, off64_t offset,
+    unsigned int mode);
+void _GD_SetError(DIRFILE*, int, int, const char*, int, const char*);
+int _GD_SetTablePath(DIRFILE *restrict, const gd_entry_t *restrict,
+    struct gd_private_entry_ *restrict);
+int _GD_ShutdownDirfile(DIRFILE*, int, int);
+int _GD_StrCmpNull(const char *restrict, const char *restrict);
+char *_GD_Strdup(DIRFILE *restrict, const char *restrict);
+int _GD_Supports(DIRFILE *, const gd_entry_t*, unsigned int funcs);
+int _GD_Tokenise(DIRFILE *restrict, const char *restrict, char **,
+    const char **, int, char **, const char *restrict, int linenum,
     int standards, int pedantic);
-char* _GD_ValidateField(const gd_entry_t* parent, const char* field_code,
-    int standards, int pedantic, int* is_dot);
+void _GD_UpdateAliases(DIRFILE*, int);
+int _GD_ValidateField(const char*, int, int, int, int*);
+off64_t _GD_WriteSeek(DIRFILE *restrict, gd_entry_t *restrict,
+    const struct encoding_t *restrict, off64_t, unsigned int mode);
+ssize_t _GD_WriteOut(const gd_entry_t*, const struct encoding_t*, const void*,
+    gd_type_t, size_t, int);
 
 /* generic I/O methods */
-int _GD_GenericTouch(struct _gd_raw_file* file);
-int _GD_GenericMove(struct _gd_raw_file* file, char* new_path);
-int _GD_GenericUnlink(struct _gd_raw_file* file);
+int _GD_GenericMove(int, struct gd_raw_file_ *restrict, int, char *restrict);
+int _GD_GenericName(DIRFILE *restrict, const char *restrict,
+    struct gd_raw_file_ *restrict, const char *restrict, int, int);
+int _GD_GenericUnlink(int, struct gd_raw_file_* file);
 
 /* unencoded I/O methods */
-int _GD_RawOpen(struct _gd_raw_file* file, int mode, int creat);
-off64_t _GD_RawSeek(struct _gd_raw_file* file, off64_t count,
-    gd_type_t data_type, int pad);
-ssize_t _GD_RawRead(struct _gd_raw_file* file, void *ptr, gd_type_t data_type,
-    size_t nmemb);
-ssize_t _GD_RawWrite(struct _gd_raw_file* file, const void *ptr,
-    gd_type_t data_type, size_t nmemb);
-int _GD_RawSync(struct _gd_raw_file* file);
-int _GD_RawClose(struct _gd_raw_file* file);
-off64_t _GD_RawSize(struct _gd_raw_file* file, gd_type_t data_type);
-int _GD_RawTemp(struct _gd_raw_file *file, int mode);
+int _GD_RawOpen(int, struct gd_raw_file_* file, int swap, unsigned int);
+off64_t _GD_RawSeek(struct gd_raw_file_* file, off64_t count,
+    gd_type_t data_type, unsigned int);
+ssize_t _GD_RawRead(struct gd_raw_file_ *restrict, void *restrict, gd_type_t,
+    size_t);
+ssize_t _GD_RawWrite(struct gd_raw_file_ *restrict, const void *restrict,
+    gd_type_t, size_t);
+int _GD_RawSync(struct gd_raw_file_* file);
+int _GD_RawClose(struct gd_raw_file_* file);
+off64_t _GD_RawSize(int, struct gd_raw_file_* file, gd_type_t data_type,
+    int swap);
 
 /* text I/O methods */
-int _GD_AsciiOpen(struct _gd_raw_file* file, int mode, int creat);
-off64_t _GD_AsciiSeek(struct _gd_raw_file* file, off64_t count,
-    gd_type_t data_type, int pad);
-ssize_t _GD_AsciiRead(struct _gd_raw_file* file, void *ptr, gd_type_t data_type,
-    size_t nmemb);
-ssize_t _GD_AsciiWrite(struct _gd_raw_file* file, const void *ptr,
-    gd_type_t data_type,
-    size_t nmemb);
-int _GD_AsciiSync(struct _gd_raw_file* file);
-int _GD_AsciiClose(struct _gd_raw_file* file);
-off64_t _GD_AsciiSize(struct _gd_raw_file* file, gd_type_t data_type);
-int _GD_AsciiTemp(struct _gd_raw_file *file, int mode);
+int _GD_AsciiOpen(int, struct gd_raw_file_* file, int swap, unsigned int);
+off64_t _GD_AsciiSeek(struct gd_raw_file_* file, off64_t count,
+    gd_type_t data_type, unsigned int);
+ssize_t _GD_AsciiRead(struct gd_raw_file_ *restrict, void *restrict, gd_type_t,
+    size_t);
+ssize_t _GD_AsciiWrite(struct gd_raw_file_ *restrict, const void *restrict,
+    gd_type_t, size_t);
+int _GD_AsciiSync(struct gd_raw_file_* file);
+int _GD_AsciiClose(struct gd_raw_file_* file);
+off64_t _GD_AsciiSize(int, struct gd_raw_file_* file, gd_type_t data_type,
+    int swap);
 
 /* bzip I/O methods */
-int _GD_Bzip2Open(struct _gd_raw_file* file, int mode, int creat);
-off64_t _GD_Bzip2Seek(struct _gd_raw_file* file, off64_t count,
-    gd_type_t data_type, int pad);
-ssize_t _GD_Bzip2Read(struct _gd_raw_file* file, void *ptr, gd_type_t data_type,
-    size_t nmemb);
-int _GD_Bzip2Close(struct _gd_raw_file* file);
-off64_t _GD_Bzip2Size(struct _gd_raw_file* file, gd_type_t data_type);
+int _GD_Bzip2Open(int, struct gd_raw_file_* file, int swap, unsigned int);
+off64_t _GD_Bzip2Seek(struct gd_raw_file_* file, off64_t count,
+    gd_type_t data_type, unsigned int);
+ssize_t _GD_Bzip2Read(struct gd_raw_file_ *restrict, void *restrict, gd_type_t,
+    size_t);
+int _GD_Bzip2Close(struct gd_raw_file_* file);
+off64_t _GD_Bzip2Size(int, struct gd_raw_file_* file, gd_type_t data_type,
+    int swap);
 
 /* gzip I/O methods */
-int _GD_GzipOpen(struct _gd_raw_file* file, int mode, int creat);
-off64_t _GD_GzipSeek(struct _gd_raw_file* file, off64_t count,
-    gd_type_t data_type, int pad);
-ssize_t _GD_GzipRead(struct _gd_raw_file* file, void *ptr, gd_type_t data_type,
-    size_t nmemb);
-int _GD_GzipClose(struct _gd_raw_file* file);
-off64_t _GD_GzipSize(struct _gd_raw_file* file, gd_type_t data_type);
+int _GD_GzipOpen(int, struct gd_raw_file_* file, int swap, unsigned int);
+off64_t _GD_GzipSeek(struct gd_raw_file_* file, off64_t count,
+    gd_type_t data_type, unsigned int);
+ssize_t _GD_GzipRead(struct gd_raw_file_ *restrict, void *restrict, gd_type_t,
+    size_t);
+ssize_t _GD_GzipWrite(struct gd_raw_file_ *restrict, const void *restrict,
+    gd_type_t, size_t);
+int _GD_GzipSync(struct gd_raw_file_* file);
+int _GD_GzipClose(struct gd_raw_file_* file);
+off64_t _GD_GzipSize(int, struct gd_raw_file_* file, gd_type_t data_type,
+    int swap);
 
 /* lzma I/O methods */
-int _GD_LzmaOpen(struct _gd_raw_file* file, int mode, int creat);
-off64_t _GD_LzmaSeek(struct _gd_raw_file* file, off64_t count,
-    gd_type_t data_type, int pad);
-ssize_t _GD_LzmaRead(struct _gd_raw_file* file, void *ptr, gd_type_t data_type,
-    size_t nmemb);
-int _GD_LzmaClose(struct _gd_raw_file* file);
-off64_t _GD_LzmaSize(struct _gd_raw_file* file, gd_type_t data_type);
+int _GD_LzmaOpen(int, struct gd_raw_file_* file, int swap, unsigned int);
+off64_t _GD_LzmaSeek(struct gd_raw_file_* file, off64_t count,
+    gd_type_t data_type, unsigned int);
+ssize_t _GD_LzmaRead(struct gd_raw_file_ *restrict, void *restrict, gd_type_t,
+    size_t);
+int _GD_LzmaClose(struct gd_raw_file_* file);
+off64_t _GD_LzmaSize(int, struct gd_raw_file_* file, gd_type_t data_type,
+    int swap);
 
 /* slim I/O methods */
-int _GD_SlimOpen(struct _gd_raw_file* file, int mode, int creat);
-off64_t _GD_SlimSeek(struct _gd_raw_file* file, off64_t count,
-    gd_type_t data_type, int pad);
-ssize_t _GD_SlimRead(struct _gd_raw_file* file, void *ptr, gd_type_t data_type,
-    size_t nmemb);
-int _GD_SlimClose(struct _gd_raw_file* file);
-off64_t _GD_SlimSize(struct _gd_raw_file* file, gd_type_t data_type);
-
-#ifdef _MSC_VER
-# define _gd_static_inline static
-#else
-# define _gd_static_inline static inline
-#endif
-_gd_static_inline int entry_cmp(const void *a, const void *b)
-{
-  return strcmp((*(gd_entry_t**)a)->field, (*(gd_entry_t**)b)->field);
-}
+int _GD_SlimOpen(int, struct gd_raw_file_* file, int, unsigned int);
+off64_t _GD_SlimSeek(struct gd_raw_file_* file, off64_t count,
+    gd_type_t data_type, unsigned int);
+ssize_t _GD_SlimRead(struct gd_raw_file_ *restrict, void *restrict, gd_type_t,
+    size_t);
+int _GD_SlimClose(struct gd_raw_file_* file);
+off64_t _GD_SlimSize(int, struct gd_raw_file_* file, gd_type_t data_type,
+    int swap);
+
+/* SIE I/O methods */
+int _GD_SampIndOpen(int, struct gd_raw_file_* file, int swap,
+    unsigned int);
+off64_t _GD_SampIndSeek(struct gd_raw_file_* file, off64_t count,
+    gd_type_t data_type, unsigned int);
+ssize_t _GD_SampIndRead(struct gd_raw_file_ *restrict, void *restrict,
+    gd_type_t, size_t);
+ssize_t _GD_SampIndWrite(struct gd_raw_file_ *restrict, const void *restrict,
+    gd_type_t, size_t);
+int _GD_SampIndSync(struct gd_raw_file_* file);
+int _GD_SampIndClose(struct gd_raw_file_* file);
+off64_t _GD_SampIndSize(int, struct gd_raw_file_* file, gd_type_t data_type,
+    int swap);
+
+/* zzip I/O methods */
+int _GD_ZzipName(DIRFILE *restrict, const char *restrict,
+    struct gd_raw_file_ *restrict, const char *restrict, int, int);
+int _GD_ZzipOpen(int, struct gd_raw_file_* file, int swap, unsigned int);
+off64_t _GD_ZzipSeek(struct gd_raw_file_* file, off64_t count,
+    gd_type_t data_type, unsigned int);
+ssize_t _GD_ZzipRead(struct gd_raw_file_ *restrict, void *restrict, gd_type_t,
+    size_t);
+int _GD_ZzipClose(struct gd_raw_file_* file);
+off64_t _GD_ZzipSize(int, struct gd_raw_file_* file, gd_type_t data_type,
+    int swap);
+
+/* zzslim I/O methods */
+int _GD_ZzslimName(DIRFILE *restrict, const char *restrict,
+    struct gd_raw_file_ *restrict, const char *restrict, int, int);
+int _GD_ZzslimOpen(int, struct gd_raw_file_* file, int swap, unsigned int);
+off64_t _GD_ZzslimSeek(struct gd_raw_file_* file, off64_t count,
+    gd_type_t data_type, unsigned int);
+ssize_t _GD_ZzslimRead(struct gd_raw_file_ *restrict, void *restrict, gd_type_t,
+    size_t);
+int _GD_ZzslimClose(struct gd_raw_file_* file);
+off64_t _GD_ZzslimSize(int, struct gd_raw_file_* file, gd_type_t data_type,
+    int swap);
 
 #ifndef __cplusplus
 # undef gd_nothrow
diff --git a/src/legacy.c b/src/legacy.c
index 4d5919c..3ca1070 100644
--- a/src/legacy.c
+++ b/src/legacy.c
@@ -1,6 +1,6 @@
 /* Copyright (C) 2002-2005 C. Barth Netterfield
  * Copyright (C) 2003-2005 Theodore Kisner
- * Copyright (C) 2005-2010 D. V. Wiebe
+ * Copyright (C) 2005-2012 D. V. Wiebe
  *
  ***************************************************************************
  *
@@ -22,11 +22,6 @@
  */
 #include "internal.h"
 
-#ifdef STDC_HEADERS
-#include <stdlib.h>
-#include <string.h>
-#endif
-
 static struct {
   unsigned int n;
   DIRFILE** D;
@@ -75,13 +70,13 @@ const char *GD_ERROR_CODES[GD_N_ERROR_CODES] = {
   "Bad REFERENCE field", /* GD_E_BAD_REFERENCE */
   "Operation prohibited by protection level", /* GD_E_PROTECTED */
   NULL, /* GD_E_DELETE */
-  NULL, /* GD_E_BAD_ENDIANNESS */
+  "Bad argument", /* GD_E_ARGUMENT */
   NULL, /* GD_E_CALLBACK */
-  NULL, /* GD_E_BAD_PROTECTION */
+  NULL, /* GD_E_EXISTS */
   NULL, /* GD_E_UNCLEAN_DB */
   "Improper domain", /* GD_E_DOMAIN */
   "Bad representation", /* GD_E_BAD_REPR */
-  NULL, /* GD_E_BAD_VERSION */
+  NULL, /* unused */
   NULL, /* GD_E_FLUSH */
   NULL, /* GD_E_BOUNDS */
   "Line too long", /* GD_E_LINE_TOO_LONG */
@@ -122,17 +117,24 @@ static DIRFILE *_GD_GetDirfile(const char *filename_in, int mode,
 {
   unsigned int i_dirfile;
   void *ptr;
-  char filedir[FILENAME_MAX];
+  char *filedir;
 
   dtrace("\"%s\", %x", filename_in, mode);
 
-  strncpy(filedir, filename_in, FILENAME_MAX);
+  filedir = strdup(filename_in);
+
+  if (!filedir) {
+    *error_code = GD_E_ALLOC;
+    dreturn("%p", NULL);
+    return NULL;
+  }
+
   if (filedir[strlen(filedir) - 1] == '/')
     filedir[strlen(filedir) - 1] = '\0';
 
   /* first check to see if we have already read it */
   for (i_dirfile = 0; i_dirfile < _GD_Dirfiles.n; i_dirfile++) {
-    if (strncmp(filedir, _GD_Dirfiles.D[i_dirfile]->name, FILENAME_MAX) == 0) {
+    if (strcmp(filedir, _GD_Dirfiles.D[i_dirfile]->name) == 0) {
       /* if the dirfile was previously opened read-only, close it so we can
        * re-open it read-write */
       if ((mode & GD_RDWR) && (_GD_Dirfiles.D[i_dirfile]->flags & GD_ACCMODE) ==
@@ -144,6 +146,7 @@ static DIRFILE *_GD_GetDirfile(const char *filename_in, int mode,
          * the counter -- next realloc will do nothing */
         _GD_Dirfiles.D[i_dirfile] = _GD_Dirfiles.D[--_GD_Dirfiles.n];
       } else {
+        free(filedir);
         _GD_ClearError(_GD_Dirfiles.D[i_dirfile]);
         dreturn("%p", _GD_Dirfiles.D[i_dirfile]);
         return _GD_Dirfiles.D[i_dirfile];
@@ -165,6 +168,7 @@ static DIRFILE *_GD_GetDirfile(const char *filename_in, int mode,
 
   /* Open a dirfile */
   _GD_Dirfiles.D[_GD_Dirfiles.n] = gd_open(filedir, mode);
+  free(filedir);
 
   /* Error encountered -- clean up */
   if (_GD_Dirfiles.D[_GD_Dirfiles.n]->error != GD_E_OK) {
@@ -347,6 +351,42 @@ static void CopyPhaseEntry(struct PhaseEntryType* P, gd_entry_t* E)
   dreturnvoid();
 }
 
+static void CopyWindowEntry(struct MPlexEntryType* M, gd_entry_t* E)
+{
+  dtrace("%p, %p", M, E);
+
+  if (E == NULL) {
+    dreturnvoid();
+    return;
+  }
+
+  M->field = E->field;
+  M->data_field = E->in_fields[0];
+  M->cnt_field = E->in_fields[1];
+  M->i = (int)E->EN(window,windop);
+  M->max_i = (int)E->EN(window,threshold.i);
+
+  dreturnvoid();
+}
+
+static void CopyMplexEntry(struct MPlexEntryType* M, gd_entry_t* E)
+{
+  dtrace("%p, %p", M, E);
+
+  if (E == NULL) {
+    dreturnvoid();
+    return;
+  }
+
+  M->field = E->field;
+  M->data_field = E->in_fields[0];
+  M->cnt_field = E->in_fields[1];
+  M->i = (int)E->EN(mplex,count_val);
+  M->max_i = (int)E->EN(mplex,period);
+
+  dreturnvoid();
+}
+
 /* Okay, reconstruct the old FormatType.  This is painful. */
 struct FormatType *GetFormat(const char *filedir, int *error_code) gd_nothrow
 {
@@ -358,6 +398,7 @@ struct FormatType *GetFormat(const char *filedir, int *error_code) gd_nothrow
   int nmultiply = 0;
   int nbit = 0;
   int nphase = 0;
+  int nmplex = 0;
   DIRFILE *D;
 
   dtrace("\"%s\", %p", filedir, error_code);
@@ -403,7 +444,12 @@ struct FormatType *GetFormat(const char *filedir, int *error_code) gd_nothrow
       case GD_PHASE_ENTRY:
         Format.n_phase++;
         break;
+      case GD_WINDOW_ENTRY:
+      case GD_MPLEX_ENTRY:
+        Format.n_mplex++;
+        break;
       case GD_NO_ENTRY:
+      case GD_ALIAS_ENTRY:
       case GD_CONST_ENTRY:
       case GD_CARRAY_ENTRY:
       case GD_INDEX_ENTRY:
@@ -471,10 +517,17 @@ struct FormatType *GetFormat(const char *filedir, int *error_code) gd_nothrow
       case GD_PHASE_ENTRY:
         CopyPhaseEntry(&Format.phaseEntries[nphase++], D->entry[i]);
         break;
+      case GD_WINDOW_ENTRY:
+        CopyWindowEntry(&Format.mplexEntries[nmplex++], D->entry[i]);
+        break;
+      case GD_MPLEX_ENTRY:
+        CopyMplexEntry(&Format.mplexEntries[nmplex++], D->entry[i]);
+        break;
       case GD_STRING_ENTRY:
       case GD_CONST_ENTRY:
       case GD_CARRAY_ENTRY:
       case GD_INDEX_ENTRY:
+      case GD_ALIAS_ENTRY:
       case GD_NO_ENTRY:
         break;
     }
@@ -516,7 +569,7 @@ int GetData(const char *filename, const char *field_code,
  * error_code?)
  */
 int GetNFrames(const char *filename, int *error_code,
-    const void *unused __gd_unused)
+    const void *unused gd_unused_)
 {
   DIRFILE* D;
   int nf;
diff --git a/src/lzma.c b/src/lzma.c
index dcb671b..1587656 100644
--- a/src/lzma.c
+++ b/src/lzma.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2009-2010 D. V. Wiebe
+/* Copyright (C) 2009-2011 D. V. Wiebe
  *
  ***************************************************************************
  *
@@ -20,14 +20,6 @@
  */
 #include "internal.h"
 
-#ifdef STDC_HEADERS
-#include <stdlib.h>
-#include <errno.h>
-#include <time.h>
-#include <stdio.h>
-#include <string.h>
-#endif
-
 #ifdef HAVE_LZMA_H
 #include <lzma.h>
 #endif
@@ -63,13 +55,14 @@ struct gd_lzmadata {
 };
 
 /* The bzip encoding scheme uses edata as a gd_lzmadata pointer.  If a file is
- * open, fp = 0 otherwise fp = -1. */
+ * open, idata = 0 otherwise idata = -1. */
 
-static struct gd_lzmadata *_GD_LzmaDoOpen(struct _gd_raw_file* file)
+static struct gd_lzmadata *_GD_LzmaDoOpen(int dirfd, struct gd_raw_file_* file)
 {
   struct gd_lzmadata *ptr;
+  int fd;
 
-  dtrace("%p", file);
+  dtrace("%i, %p", dirfd, file);
 
   if ((ptr = (struct gd_lzmadata *)malloc(sizeof(struct gd_lzmadata))) == NULL)
   {
@@ -77,12 +70,20 @@ static struct gd_lzmadata *_GD_LzmaDoOpen(struct _gd_raw_file* file)
     return NULL;
   }
 
-  if ((ptr->stream = fopen(file->name, "rb")) == NULL) {
+  if ((fd = gd_OpenAt(file->D, dirfd, file->name, O_RDONLY | O_BINARY, 0666))
+      == -1)
+  {
+    free(ptr);
+    dreturn("%p", NULL);
+    return NULL;
+  }
+
+  if ((ptr->stream = fdopen(fd, "rb")) == NULL) {
+    close(fd);
     free(ptr);
     dreturn("%p", NULL);
     return NULL;
   }
-  dprintf("%p = %s", ptr->stream, file->name);
 
   memset(&ptr->xzfile, 0, sizeof(lzma_stream));
   ptr->xzfile.next_in = ptr->data_in;
@@ -106,21 +107,23 @@ static struct gd_lzmadata *_GD_LzmaDoOpen(struct _gd_raw_file* file)
   return ptr;
 }
 
-int _GD_LzmaOpen(struct _gd_raw_file* file, int mode __gd_unused,
-    int creat __gd_unused)
+int _GD_LzmaOpen(int dirfd, struct gd_raw_file_* file, int swap gd_unused_,
+    unsigned int mode gd_unused_)
 {
   struct gd_lzmadata *ptr;
 
-  dtrace("%p, <unused>, <unused>", file);
+  dtrace("%i, %p, <unused>, <unused>", dirfd, file);
 
-  file->edata = ptr = _GD_LzmaDoOpen(file);
+  file->edata = ptr = _GD_LzmaDoOpen(dirfd, file);
 
   if (file->edata == NULL) {
     dreturn("%i", 1);
     return 1;
   }
 
-  file->fp = 0;
+  file->mode = GD_FILE_READ;
+  file->pos = 0;
+  file->idata = 0;
   dreturn("%i", 0);
   return 0;
 }
@@ -137,8 +140,6 @@ static int _GD_LzmaDecode(struct gd_lzmadata *ptr)
   if (!ptr->input_eof) {
     n = fread(ptr->data_in + ptr->read_in, 1, GD_LZMA_BUFFER_SIZE -
         ptr->read_in, ptr->stream);
-    dprintf("n=%i for %i on %p", n, GD_LZMA_BUFFER_SIZE - ptr->read_in,
-        ptr->stream);
 
     if (n < GD_LZMA_BUFFER_SIZE - ptr->read_in) {
       if (feof(ptr->stream))
@@ -150,12 +151,7 @@ static int _GD_LzmaDecode(struct gd_lzmadata *ptr)
     }
   }
 
-  dprintf("read_in=%i  n=%i", ptr->read_in, n);
   ptr->xzfile.avail_in = ptr->read_in + n;
-  dprintf("avail_in=%zu   total_in=%llu", ptr->xzfile.avail_in,
-      ptr->xzfile.total_in);
-  dprintf("avail_out=%zu  total_out=%llu", ptr->xzfile.avail_out,
-      ptr->xzfile.total_out);
 
   /* no more data to convert -- end of stream reached */
   if (ptr->xzfile.avail_in == 0) {
@@ -166,10 +162,6 @@ static int _GD_LzmaDecode(struct gd_lzmadata *ptr)
 
   /* amount of data = amount already in buffer + amount just now read */
   ptr->xzerror = lzma_code(&ptr->xzfile, LZMA_RUN);
-  dprintf("avail_in=%zu   total_in=%llu", ptr->xzfile.avail_in,
-      ptr->xzfile.total_in);
-  dprintf("avail_out=%zu  total_out=%llu", ptr->xzfile.avail_out,
-      ptr->xzfile.total_out);
 
   if (ptr->xzerror == LZMA_OK || ptr->xzerror == LZMA_STREAM_END) {
     ptr->base += ptr->end;
@@ -187,15 +179,21 @@ static int _GD_LzmaDecode(struct gd_lzmadata *ptr)
   return 0;
 }
 
-off64_t _GD_LzmaSeek(struct _gd_raw_file* file, off64_t count,
-    gd_type_t data_type, int pad __gd_unused)
+off64_t _GD_LzmaSeek(struct gd_raw_file_* file, off64_t count,
+    gd_type_t data_type, unsigned int mode gd_unused_)
 {
   struct gd_lzmadata *ptr = (struct gd_lzmadata *)file->edata;
 
-  dtrace("%p, %lli, %x, <unused>", file, (long long)count, data_type);
+  dtrace("%p, %lli, 0x%X, <unused>", file, (long long)count, data_type);
 
   count *= GD_SIZE(data_type);
 
+  /* the easy case */
+  if (file->pos == count) {
+    dreturn("%lli", (long long)count);
+    return count;
+  }
+
   if (ptr->base > count) {
     /* a backwards seek -- rewind to the beginning */
     lzma_end(&ptr->xzfile);
@@ -204,7 +202,7 @@ off64_t _GD_LzmaSeek(struct _gd_raw_file* file, off64_t count,
     ptr->xzerror = lzma_auto_decoder(&ptr->xzfile, 1000000000, 0);
     ptr->xzfile.total_in = GD_LZMA_BUFFER_SIZE;
     if (ptr->xzerror != LZMA_OK) {
-      file->fp = -1;
+      file->idata = -1;
       fclose(ptr->stream);
       dreturn("%i", 1);
       return 1;
@@ -229,18 +227,20 @@ off64_t _GD_LzmaSeek(struct _gd_raw_file* file, off64_t count,
   ptr->out_pos = (ptr->stream_end && count >= ptr->base + ptr->end) ?  ptr->end
     : count - ptr->base;
 
-  dreturn("%lli", (long long)((ptr->base + ptr->out_pos) / GD_SIZE(data_type)));
-  return (ptr->base + ptr->out_pos) / GD_SIZE(data_type);
+  file->pos = (ptr->base + ptr->out_pos) / GD_SIZE(data_type);
+
+  dreturn("%lli", (long long)(file->pos));
+  return file->pos;
 }
 
-ssize_t _GD_LzmaRead(struct _gd_raw_file *file, void *data, gd_type_t data_type,
+ssize_t _GD_LzmaRead(struct gd_raw_file_ *file, void *data, gd_type_t data_type,
     size_t nmemb)
 {
   char* output = (char *)data;
   struct gd_lzmadata *ptr = (struct gd_lzmadata *)file->edata;
   uint64_t nbytes = nmemb * GD_SIZE(data_type);
 
-  dtrace("%p, %p, %x, %zu", file, data, data_type, nmemb);
+  dtrace("%p, %p, 0x%X, %" PRNsize_t, file, data, data_type, nmemb);
 
   /* this loops over chunks of uncompressed data of size data_out until we
    * have as much data as we need in data_out, or until EOF */
@@ -277,11 +277,13 @@ ssize_t _GD_LzmaRead(struct _gd_raw_file *file, void *data, gd_type_t data_type,
     nbytes = 0;
   }
 
+  file->pos += nmemb - nbytes / GD_SIZE(data_type);
+
   dreturn("%li", (long)(nmemb - nbytes / GD_SIZE(data_type)));
   return nmemb - nbytes / GD_SIZE(data_type);
 }
 
-int _GD_LzmaClose(struct _gd_raw_file *file)
+int _GD_LzmaClose(struct gd_raw_file_ *file)
 {
   struct gd_lzmadata *ptr = (struct gd_lzmadata *)file->edata;
 
@@ -289,25 +291,27 @@ int _GD_LzmaClose(struct _gd_raw_file *file)
 
   ptr->xzerror = 0;
   lzma_end(&ptr->xzfile);
-  if (!fclose(ptr->stream)) {
-    file->fp = -1;
-    free(file->edata);
-    dreturn("%i", 0);
-    return 0;
+  if (fclose(ptr->stream)) {
+    dreturn("%i", 1);
+    return 1;
   }
 
-  dreturn("%i", 1);
-  return 1;
+  file->idata = -1;
+  file->mode = 0;
+  free(file->edata);
+  dreturn("%i", 0);
+  return 0;
 }
 
-off64_t _GD_LzmaSize(struct _gd_raw_file *file, gd_type_t data_type)
+off64_t _GD_LzmaSize(int dirfd, struct gd_raw_file_ *file, gd_type_t data_type,
+    int swap gd_unused_)
 {
   struct gd_lzmadata *ptr;
   off_t n;
 
-  dtrace("%p, %x", file, data_type);
+  dtrace("%i, %p, 0x%X, <unused>", dirfd, file, data_type);
 
-  ptr = _GD_LzmaDoOpen(file);
+  ptr = _GD_LzmaDoOpen(dirfd, file);
 
   if (ptr == NULL) {
     dreturn("%i", -1);
diff --git a/src/mod.c b/src/mod.c
index cda326e..9477efb 100644
--- a/src/mod.c
+++ b/src/mod.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2010 D. V. Wiebe
+/* Copyright (C) 2008-2012 D. V. Wiebe
  *
  ***************************************************************************
  *
@@ -20,17 +20,7 @@
  */
 #include "internal.h"
 
-#ifdef STDC_HEADERS
-#include <stdlib.h>
-#include <string.h>
-#include <errno.h>
-#endif
-
-#ifdef HAVE_LIBGEN_H
-#include <libgen.h>
-#endif
-
-static unsigned int _gd_max(unsigned int A, unsigned int B)
+static unsigned int gd_max_(unsigned int A, unsigned int B)
 {
   return (A > B) ? A : B;
 }
@@ -39,7 +29,7 @@ static unsigned int _gd_max(unsigned int A, unsigned int B)
 #define GD_AS_NEED_RECALC 2
 #define GD_AS_ERROR       4
 #define GD_AS_MODIFIED    8
-/*  sold snew alit 
+/*  sold snew alit
  * 0a N    N0   0     -> do nothing         ()
  * 1  N    N0   1     -> set lout           ()
  * 2  Na   a    01    -> set sout           (free scalar; need recalc)
@@ -49,14 +39,13 @@ static unsigned int _gd_max(unsigned int A, unsigned int B)
  */
 static int _GD_AlterScalar(DIRFILE* D, int alter_literal, gd_type_t type,
     void *lout, const void *lin, char **sout, int *iout, const char *sin,
-    int iin, int calculated)
+    int iin, int calculated, int fragment_index)
 {
   int r = 0;
   int set_lout = 0;
-  int error = 0;
 
-  dtrace("%p, %i, %x, %p, %p, %p, %p, \"%s\", %i, %i", D, alter_literal, type,
-      lout, lin, sout, iout, sin, iin, calculated);
+  dtrace("%p, %i, 0x%X, %p, %p, %p, %p, %p, %i, %i, %i", D, alter_literal, type,
+      lout, lin, sout, iout, sin, iin, calculated, fragment_index);
 
   if (sin == NULL) {
     if (*sout != NULL) {
@@ -72,7 +61,7 @@ static int _GD_AlterScalar(DIRFILE* D, int alter_literal, gd_type_t type,
          *    get_constant. */
         r = GD_AS_FREE_SCALAR | GD_AS_MODIFIED;
         if (!calculated)
-          error = gd_get_constant(D, *sout, GD_INT64, lout);
+          gd_get_constant(D, *sout, GD_INT64, lout);
         *sout = NULL;
       }
     } else if (alter_literal) {
@@ -90,14 +79,14 @@ static int _GD_AlterScalar(DIRFILE* D, int alter_literal, gd_type_t type,
     /* 2: set a new CONST field from sout; if this is a RAW field, and we've
      *    been asked to move the raw file, _GD_Change is going to need to
      *    recalculate the entry; no need to change lout: it's ignored. */
-    r = GD_AS_FREE_SCALAR | GD_AS_NEED_RECALC | GD_AS_MODIFIED;
-    *sout = strdup(sin);
-    if (*sout == NULL)
-      _GD_SetError(D, GD_E_ALLOC, 0, NULL, 0, NULL);
-    *iout = iin;
+    if (!_GD_CheckCodeAffixes(D, NULL, sin, fragment_index)) {
+      r = GD_AS_FREE_SCALAR | GD_AS_NEED_RECALC | GD_AS_MODIFIED;
+      *sout = _GD_Strdup(D, sin);
+      *iout = iin;
+    }
   }
 
-  if (!error && set_lout) {
+  if (!D->error && set_lout) {
     r |= GD_AS_MODIFIED;
     if (type == GD_INT64)
       *(int64_t *)lout = *(int64_t *)lin;
@@ -109,11 +98,19 @@ static int _GD_AlterScalar(DIRFILE* D, int alter_literal, gd_type_t type,
       *(int16_t *)lout = *(int16_t *)lin;
     else if (type == GD_UINT16)
       *(uint16_t *)lout = *(uint16_t *)lin;
+    else if (type == GD_INT32)
+      *(int32_t *)lout = *(int32_t *)lin;
+    else if (type == GD_UINT32)
+      *(uint32_t *)lout = *(uint32_t *)lin;
+    else if (type == GD_INT64)
+      *(int64_t *)lout = *(int64_t *)lin;
+    else if (type == GD_UINT64)
+      *(uint64_t *)lout = *(uint64_t *)lin;
     else
       _GD_InternalError(D);
   }
 
-  if (error)
+  if (D->error)
     r |= GD_AS_ERROR;
 
   dreturn("%i", r);
@@ -124,12 +121,12 @@ static int _GD_AlterScalar(DIRFILE* D, int alter_literal, gd_type_t type,
  * _GD_Change.  NB: Don't precompute (spfB / spfA) here: the order of operations
  * is important to get proper integer trucation.
  */
-static void _GD_SPFConvert(DIRFILE* D, void *A, gd_spf_t spfA, void *B,
-    gd_spf_t spfB, gd_type_t type, size_t n)
+static void _GD_SPFConvert(DIRFILE* D, void *A, unsigned int spfA, void *B,
+    unsigned int spfB, gd_type_t type, size_t n)
 {
   size_t i;
 
-  dtrace("%p, %p, %u, %p, %u, 0x%x, %zu", D, A, spfA, B, spfB, type, n);
+  dtrace("%p, %p, %u, %p, %u, 0x%X, %" PRNsize_t, D, A, spfA, B, spfB, type, n);
 
   switch (type) {
     case GD_NULL: /* null read */
@@ -192,6 +189,29 @@ static void _GD_SPFConvert(DIRFILE* D, void *A, gd_spf_t spfA, void *B,
   dreturnvoid();
 }
 
+/* returns -1 on error, 1 if modified, 0 if no change */
+static int _GD_AlterInField(DIRFILE *D, int i, char **Q, char *const *N,
+    char *const *E, int fragment_index, int force)
+{
+  dtrace("%p, %i, %p, %p, %p, %i, %i", D, i, Q, N, E, fragment_index, force);
+
+  if (force || (N[i] != NULL && strcmp(E[i], N[i]))) {
+    if (_GD_CheckCodeAffixes(D, NULL, N[i], fragment_index)) {
+      dreturn("%i", -1);
+      return -1;
+    } else if ((Q[i] = _GD_Strdup(D, N[i])) == NULL) {
+      dreturn("%i", -1); 
+      return -1;
+    }
+
+    dreturn("%i", 1);
+    return 1;
+  }
+
+  dreturn("%i", 0);
+  return 0;
+}
+
 /* N is the new entry, supplied by the user
  * E is the old entry, stored in the database
  * Q is our workspace; in the end, Q is a sanitised N which replaces E */
@@ -207,16 +227,16 @@ static int _GD_Change(DIRFILE *D, const char *field_code, const gd_entry_t *N,
   void *ptr;
   gd_entry_t *E = NULL;
   gd_entry_t Q;
-  struct _gd_private_entry Qe;
+  struct gd_private_entry_ Qe;
 
   dtrace("%p, \"%s\", %p, %i", D, field_code, N, flags);
 
   if ((D->flags & GD_ACCMODE) != GD_RDWR)
     _GD_SetError(D, GD_E_ACCMODE, 0, NULL, 0, NULL);
-  else if ((E = _GD_FindField(D, field_code, D->entry, D->n_entries, NULL))
+  else if ((E = _GD_FindField(D, field_code, D->entry, D->n_entries, 1, NULL))
       == NULL)
   {
-    _GD_SetError(D, GD_E_BAD_CODE, 0, NULL, 0, field_code);
+    _GD_SetError(D, GD_E_BAD_CODE, GD_E_CODE_MISSING, NULL, 0, field_code);
   } else if (D->fragment[E->fragment_index].protection & GD_PROTECT_FORMAT)
     _GD_SetError(D, GD_E_PROTECTED, GD_E_PROTECTED_FORMAT, NULL, 0,
         D->fragment[E->fragment_index].cname);
@@ -228,15 +248,18 @@ static int _GD_Change(DIRFILE *D, const char *field_code, const gd_entry_t *N,
     return -1;
   }
 
-  memcpy(&Qe, E->e, sizeof(struct _gd_private_entry));
+  memcpy(&Qe, E->e, sizeof(struct gd_private_entry_));
   memcpy(&Q, E, sizeof(gd_entry_t));
 
+  /* hiddenness isn't changeable with this interface */
+  Q.hidden = E->hidden;
+
   switch(E->field_type) {
     case GD_RAW_ENTRY:
       j = _GD_AlterScalar(D, N->EN(raw,spf) && N->EN(raw,spf) != E->EN(raw,spf),
-          GD_UINT16, &Q.EN(raw,spf), &N->EN(raw,spf), Q.scalar, Q.scalar_ind,
-          N->scalar[0], N->scalar_ind[0], E->e->calculated);
-      
+          GD_UINT_TYPE, &Q.EN(raw,spf), &N->EN(raw,spf), Q.scalar, Q.scalar_ind,
+          N->scalar[0], N->scalar_ind[0], E->e->calculated, E->fragment_index);
+
       if (j & GD_AS_ERROR)
         break;
       if (j & GD_AS_FREE_SCALAR)
@@ -270,11 +293,11 @@ static int _GD_Change(DIRFILE *D, const char *field_code, const gd_entry_t *N,
         struct encoding_t *enc;
 
         if (j & GD_AS_NEED_RECALC)
-          if (gd_get_constant(D, Q.scalar[0], GD_UINT16, &Q.EN(raw,spf)))
+          if (gd_get_constant(D, Q.scalar[0], GD_UINT_TYPE, &Q.EN(raw,spf)))
             break;
 
-        nf = BUFFER_SIZE / _gd_max(E->e->u.raw.size,
-            GD_SIZE(Q.EN(raw,data_type))) / _gd_max(E->EN(raw,spf),
+        nf = BUFFER_SIZE / gd_max_(E->e->u.raw.size,
+            GD_SIZE(Q.EN(raw,data_type))) / gd_max_(E->EN(raw,spf),
             Q.EN(raw,spf));
 
         if (D->fragment[E->fragment_index].protection & GD_PROTECT_DATA)
@@ -282,23 +305,18 @@ static int _GD_Change(DIRFILE *D, const char *field_code, const gd_entry_t *N,
               D->fragment[E->fragment_index].cname);
         else
           _GD_Supports(D, E, GD_EF_OPEN | GD_EF_CLOSE | GD_EF_SEEK |
-              GD_EF_READ | GD_EF_WRITE | GD_EF_SYNC | GD_EF_UNLINK |
-              GD_EF_TEMP);
+              GD_EF_READ | GD_EF_WRITE | GD_EF_SYNC | GD_EF_UNLINK);
 
         if (D->error)
           break;
 
-        enc = _gd_ef + E->e->u.raw.file[0].encoding;
+        enc = gd_ef_ + E->e->u.raw.file[0].subenc;
 
-        if (_GD_SetEncodedName(D, E->e->u.raw.file, E->e->u.raw.filebase, 0))
-          ; /* error already set */
-        else if (E->e->u.raw.file[0].fp == -1 && (*enc->open)(E->e->u.raw.file,
-              0, 0))
-        {
-          _GD_SetError(D, GD_E_RAW_IO, 0, E->e->u.raw.file[0].name, errno,
-              NULL);
-        } else if ((*enc->seek)(E->e->u.raw.file, 0, E->EN(raw,data_type), 1)
-            == -1)
+        /* open the old file */
+        if (_GD_InitRawIO(D, E, NULL, 0, NULL, 0, GD_FILE_READ, 0))
+          break;
+        else if ((*enc->seek)(E->e->u.raw.file, 0, E->EN(raw,data_type),
+              GD_FILE_READ) == -1)
         {
           _GD_SetError(D, GD_E_RAW_IO, 0, E->e->u.raw.file[0].name, errno,
               NULL);
@@ -308,28 +326,25 @@ static int _GD_Change(DIRFILE *D, const char *field_code, const gd_entry_t *N,
           break;
 
         /* Create a temporary file and open it */
-        if (_GD_SetEncodedName(D, E->e->u.raw.file + 1, E->e->u.raw.filebase,
-              1))
-        {
-          ; /* error already set */
-        } else if ((*enc->temp)(E->e->u.raw.file, GD_TEMP_OPEN))
-          _GD_SetError(D, GD_E_RAW_IO, 0, E->e->u.raw.file[1].name, errno,
-              NULL);
-        else if ((*enc->seek)(E->e->u.raw.file + 1, 0, E->EN(raw,data_type), 1)
+        if (_GD_InitRawIO(D, E, NULL, -1, enc, 0, GD_FILE_WRITE | GD_FILE_TEMP,
+              _GD_FileSwapBytes(D, E->fragment_index)))
+          break;
+        else if (_GD_WriteSeek(D, E, enc, 0, GD_FILE_WRITE | GD_FILE_TEMP)
             == -1)
         {
-          _GD_SetError(D, GD_E_RAW_IO, 0, E->e->u.raw.file[1].name, errno,
-              NULL);
+          _GD_FiniRawIO(D, E, E->fragment_index, GD_FINIRAW_DISCARD |
+              GD_FINIRAW_CLOTEMP);
+          break;
         }
 
+        buffer1 = _GD_Malloc(D, BUFFER_SIZE);
+        buffer2 = _GD_Malloc(D, BUFFER_SIZE);
+
         if (D->error) {
-          (*enc->temp)(E->e->u.raw.file, GD_TEMP_DESTROY);
+          free(buffer1);
           break;
         }
 
-        buffer1 = malloc(BUFFER_SIZE);
-        buffer2 = malloc(BUFFER_SIZE);
-
         /* Now copy the old file to the new file */
         for (;;) {
           nread = (*enc->read)(E->e->u.raw.file, buffer1, E->EN(raw,data_type),
@@ -366,8 +381,8 @@ static int _GD_Change(DIRFILE *D, const char *field_code, const gd_entry_t *N,
             buffer2 = ptr;
           }
 
-          nwrote = (*enc->write)(E->e->u.raw.file + 1, buffer1,
-              Q.EN(raw,data_type), ns_out);
+          nwrote = _GD_WriteOut(E, enc, buffer1, Q.EN(raw,data_type), ns_out,
+              1);
 
           if (nwrote < ns_out) {
             _GD_SetError(D, GD_E_RAW_IO, 0, E->e->u.raw.file[1].name, errno,
@@ -379,29 +394,26 @@ static int _GD_Change(DIRFILE *D, const char *field_code, const gd_entry_t *N,
         free(buffer1);
         free(buffer2);
 
-        /* An error occurred, clean up */
         if (D->error)
-          (*enc->temp)(E->e->u.raw.file, GD_TEMP_DESTROY);
-        /* Well, I suppose the copy worked.  Close both files */
-        else if ((*enc->close)(E->e->u.raw.file) ||
-            (*enc->sync)(E->e->u.raw.file + 1) ||
-            (*enc->close)(E->e->u.raw.file + 1))
-        {
-          _GD_SetError(D, GD_E_RAW_IO, 0, E->e->u.raw.file[1].name, errno,
-              NULL);
-        /* Move the temporary file over the old file */
-        } else if ((*enc->temp)(E->e->u.raw.file, GD_TEMP_MOVE))
-          _GD_SetError(D, GD_E_RAW_IO, 0, E->e->u.raw.file[0].name, errno,
-              NULL);
+          /* An error occurred, delete the temporary file (the old
+           * file can stay open) */
+          _GD_FiniRawIO(D, E, E->fragment_index,
+              GD_FINIRAW_CLOTEMP | GD_FINIRAW_DISCARD);
+        else {
+          /* discard the old file and move the temporary file into place */
+          if (_GD_FiniRawIO(D, E, E->fragment_index, GD_FINIRAW_DISCARD) == 0)
+            _GD_FiniRawIO(D, E, E->fragment_index,
+                GD_FINIRAW_KEEP | GD_FINIRAW_CLOTEMP);
+        }
       }
-      memcpy(Qe.u.raw.file, E->e->u.raw.file, sizeof(struct _gd_raw_file));
+      memcpy(Qe.u.raw.file, E->e->u.raw.file, sizeof(struct gd_raw_file_));
 
       break;
     case GD_LINCOM_ENTRY:
       Q.EN(lincom,n_fields) = (N->EN(lincom,n_fields) == 0) ?
         E->EN(lincom,n_fields) : N->EN(lincom,n_fields);
       if (Q.EN(lincom,n_fields) < 1 || Q.EN(lincom,n_fields) > GD_MAX_LINCOM) {
-        _GD_SetError(D, GD_E_BAD_ENTRY, GD_E_BAD_ENTRY_NFIELDS, NULL,
+        _GD_SetError(D, GD_E_BAD_ENTRY, GD_E_ENTRY_NFIELDS, NULL,
             E->EN(lincom,n_fields), NULL);
         break;
       }
@@ -419,31 +431,31 @@ static int _GD_Change(DIRFILE *D, const char *field_code, const gd_entry_t *N,
       Q.comp_scal = 0;
 
       for (i = 0; i < Q.EN(lincom,n_fields); ++i) {
-        if (flags & 0x1)
-          if (E->EN(lincom,n_fields) <= i || (N->in_fields[i] != NULL && 
-                strcmp(E->in_fields[i], N->in_fields[i])))
-          {
-            if ((Q.in_fields[i] = strdup(N->in_fields[i])) == NULL) {
-              _GD_SetError(D, GD_E_ALLOC, 0, NULL, 0, NULL);
-              break;
-            }
+        if (flags & 0x1) {
+          j = _GD_AlterInField(D, i, Q.in_fields, N->in_fields, E->in_fields,
+              E->fragment_index, E->EN(lincom,n_fields) <= i);
+          if (j < 0)
+            break;
+          else if (j) {
             modified = 1;
             field_free |= 1 << i;
           }
+        }
 
         if (flags & 0x2) {
           if (N->comp_scal) {
-            j = _GD_AlterScalar(D, !_gd_ccmpc(E->EN(lincom,cm)[i],
+            j = _GD_AlterScalar(D, !gd_ccmpc_(E->EN(lincom,cm)[i],
                   N->EN(lincom,cm)[i]), GD_COMPLEX128, Q.EN(lincom,cm) + i,
                 N->EN(lincom,cm) + i, Q.scalar + i, Q.scalar_ind + i,
-                N->scalar[i], N->scalar_ind[i], E->e->calculated);
+                N->scalar[i], N->scalar_ind[i], E->e->calculated,
+                E->fragment_index);
             Q.EN(lincom,m)[i] = creal(Q.EN(lincom,cm)[i]);
           } else {
             j = _GD_AlterScalar(D, E->EN(lincom,m)[i] != N->EN(lincom,m)[i],
                 GD_FLOAT64, Q.EN(lincom,m) + i, N->EN(lincom,m) + i,
                 Q.scalar + i, Q.scalar_ind + i, N->scalar[i], N->scalar_ind[i],
-                E->e->calculated);
-            _gd_r2c(Q.EN(lincom,cm)[i], Q.EN(lincom,m)[i]);
+                E->e->calculated, E->fragment_index);
+            gd_rs2cs_(Q.EN(lincom,cm)[i], Q.EN(lincom,m)[i]);
           }
 
           if (j & GD_AS_FREE_SCALAR)
@@ -458,19 +470,20 @@ static int _GD_Change(DIRFILE *D, const char *field_code, const gd_entry_t *N,
 
         if (flags & 0x4) {
           if (N->comp_scal) {
-            j = _GD_AlterScalar(D, !_gd_ccmpc(E->EN(lincom,cb)[i],
+            j = _GD_AlterScalar(D, !gd_ccmpc_(E->EN(lincom,cb)[i],
                   N->EN(lincom,cb)[i]), GD_COMPLEX128, Q.EN(lincom,cb) + i,
                 N->EN(lincom,cb) + i, Q.scalar + i + GD_MAX_LINCOM,
                 Q.scalar_ind + i + GD_MAX_LINCOM, N->scalar[i +  GD_MAX_LINCOM],
-                N->scalar_ind[i + GD_MAX_LINCOM], E->e->calculated);
+                N->scalar_ind[i + GD_MAX_LINCOM], E->e->calculated,
+                E->fragment_index);
             Q.EN(lincom,b)[i] = creal(Q.EN(lincom,cb)[i]);
           } else {
             j = _GD_AlterScalar(D, E->EN(lincom,b)[i] != N->EN(lincom,b)[i],
                 GD_FLOAT64, Q.EN(lincom,b) + i, N->EN(lincom,b) + i,
                 Q.scalar + i + GD_MAX_LINCOM, Q.scalar_ind + i + GD_MAX_LINCOM,
                 N->scalar[i + GD_MAX_LINCOM], N->scalar_ind[i + GD_MAX_LINCOM],
-                E->e->calculated);
-            _gd_r2c(Q.EN(lincom,cb)[i], Q.EN(lincom,b)[i]);
+                E->e->calculated, E->fragment_index);
+            gd_rs2cs_(Q.EN(lincom,cb)[i], Q.EN(lincom,b)[i]);
           }
 
           if (j & GD_AS_FREE_SCALAR)
@@ -491,11 +504,11 @@ static int _GD_Change(DIRFILE *D, const char *field_code, const gd_entry_t *N,
         modified = 1;
       break;
     case GD_LINTERP_ENTRY:
-      if (N->in_fields[0] != NULL && strcmp(E->in_fields[0], N->in_fields[0])) {
-        if ((Q.in_fields[0] = strdup(N->in_fields[0])) == NULL) {
-          _GD_SetError(D, GD_E_ALLOC, 0, NULL, 0, NULL);
-          break;
-        }
+      j = _GD_AlterInField(D, 0, Q.in_fields, N->in_fields, E->in_fields,
+          E->fragment_index, 0);
+      if (j < 0)
+        break;
+      else if (j) {
         modified = 1;
         field_free = 1;
       }
@@ -503,42 +516,43 @@ static int _GD_Change(DIRFILE *D, const char *field_code, const gd_entry_t *N,
       if (N->EN(linterp,table) != NULL && strcmp(E->EN(linterp,table),
             N->EN(linterp,table)))
       {
-        Q.EN(linterp,table) = strdup(N->EN(linterp,table));
-        Qe.u.linterp.table_path = NULL;
+        Q.EN(linterp,table) = _GD_Strdup(D, N->EN(linterp,table));
+        Qe.u.linterp.table_file = NULL;
 
-        if (Q.EN(linterp,table) == NULL) {
-          _GD_SetError(D, GD_E_ALLOC, 0, NULL, 0, NULL);
+        if (Q.EN(linterp,table) == NULL)
           break;
-        }
 
         if (flags) {
-          if (E->e->u.linterp.table_path == NULL)
+          if (E->e->u.linterp.table_file == NULL)
             if (_GD_SetTablePath(D, E, E->e))
               break;
 
-          if (Qe.u.linterp.table_path == NULL)
+          if (Qe.u.linterp.table_file == NULL)
             if (_GD_SetTablePath(D, &Q, &Qe))
               break;
 
-          if (_GD_Rename(E->e->u.linterp.table_path, Qe.u.linterp.table_path)) {
-            _GD_SetError(D, GD_E_RAW_IO, 0, E->e->u.linterp.table_path, errno,
-                0);
+          if (gd_RenameAt(D, E->e->u.linterp.table_dirfd,
+                E->e->u.linterp.table_file, Qe.u.linterp.table_dirfd,
+                Qe.u.linterp.table_file))
+          {
+            _GD_ReleaseDir(D, Qe.u.linterp.table_dirfd);
+            _GD_SetError(D, GD_E_RAW_IO, 0, E->EN(linterp,table), errno, 0);
             break;
           }
         }
 
         modified = 1;
         free(E->EN(linterp,table));
-        free(E->e->u.linterp.table_path);
+        free(E->e->u.linterp.table_file);
       }
 
       break;
     case GD_BIT_ENTRY:
     case GD_SBIT_ENTRY:
       j = _GD_AlterScalar(D, N->EN(bit,numbits) >= 1 && E->EN(bit,numbits) !=
-          N->EN(bit,numbits), GD_INT16, &Q.EN(bit,numbits), &N->EN(bit,numbits),
-          Q.scalar + 1, Q.scalar_ind + 1, N->scalar[1], N->scalar_ind[1],
-          E->e->calculated);
+          N->EN(bit,numbits), GD_INT_TYPE, &Q.EN(bit,numbits),
+          &N->EN(bit,numbits), Q.scalar + 1, Q.scalar_ind + 1, N->scalar[1],
+          N->scalar_ind[1], E->e->calculated, E->fragment_index);
 
       if (j & GD_AS_ERROR)
         break;
@@ -550,9 +564,9 @@ static int _GD_Change(DIRFILE *D, const char *field_code, const gd_entry_t *N,
         modified = 1;
 
       j = _GD_AlterScalar(D, N->EN(bit,bitnum) >= 0 && E->EN(bit,bitnum) !=
-          N->EN(bit,bitnum), GD_INT16, &Q.EN(bit,bitnum), &N->EN(bit,bitnum),
+          N->EN(bit,bitnum), GD_INT_TYPE, &Q.EN(bit,bitnum), &N->EN(bit,bitnum),
           Q.scalar, Q.scalar_ind, N->scalar[0], N->scalar_ind[0],
-          E->e->calculated);
+          E->e->calculated, E->fragment_index);
 
       if (j & GD_AS_ERROR)
         break;
@@ -563,11 +577,11 @@ static int _GD_Change(DIRFILE *D, const char *field_code, const gd_entry_t *N,
       if (j & GD_AS_MODIFIED)
         modified = 1;
 
-      if (N->in_fields[0] != NULL && strcmp(E->in_fields[0], N->in_fields[0])) {
-        if ((Q.in_fields[0] = strdup(N->in_fields[0])) == NULL) {
-          _GD_SetError(D, GD_E_ALLOC, 0, NULL, 0, NULL);
-          break;
-        }
+      j = _GD_AlterInField(D, 0, Q.in_fields, N->in_fields, E->in_fields,
+          E->fragment_index, 0);
+      if (j < 0)
+        break;
+      else if (j) {
         modified = 1;
         field_free = 1;
       }
@@ -575,31 +589,31 @@ static int _GD_Change(DIRFILE *D, const char *field_code, const gd_entry_t *N,
       break;
     case GD_MULTIPLY_ENTRY:
     case GD_DIVIDE_ENTRY:
-      if (N->in_fields[0] != NULL && strcmp(E->in_fields[0], N->in_fields[0])) {
-        if ((Q.in_fields[0] = strdup(N->in_fields[0])) == NULL) {
-          _GD_SetError(D, GD_E_ALLOC, 0, NULL, 0, NULL);
-          break;
-        }
+      j = _GD_AlterInField(D, 0, Q.in_fields, N->in_fields, E->in_fields,
+          E->fragment_index, 0);
+      if (j < 0)
+        break;
+      else if (j) {
         modified = 1;
         field_free = 1;
       }
 
-      if (N->in_fields[1] != NULL && strcmp(E->in_fields[1], N->in_fields[1])) {
-        if ((Q.in_fields[1] = strdup(N->in_fields[1])) == NULL) {
-          _GD_SetError(D, GD_E_ALLOC, 0, NULL, 0, NULL);
-          break;
-        }
+      j = _GD_AlterInField(D, 1, Q.in_fields, N->in_fields, E->in_fields,
+          E->fragment_index, 0);
+      if (j < 0)
+        break;
+      else if (j) {
         modified = 1;
         field_free |= 2;
       }
 
       break;
     case GD_RECIP_ENTRY:
-      if (N->in_fields[0] != NULL && strcmp(E->in_fields[0], N->in_fields[0])) {
-        if ((Q.in_fields[0] = strdup(N->in_fields[0])) == NULL) {
-          _GD_SetError(D, GD_E_ALLOC, 0, NULL, 0, NULL);
-          break;
-        }
+      j = _GD_AlterInField(D, 0, Q.in_fields, N->in_fields, E->in_fields,
+          E->fragment_index, 0);
+      if (j < 0)
+        break;
+      else if (j) {
         modified = 1;
         field_free = 1;
       }
@@ -607,10 +621,10 @@ static int _GD_Change(DIRFILE *D, const char *field_code, const gd_entry_t *N,
       Q.comp_scal = 0;
       if (N->comp_scal) {
         j = _GD_AlterScalar(D, cabs(N->EN(recip,cdividend)) != 0 &&
-              !_gd_ccmpc(E->EN(recip,cdividend), N->EN(recip,cdividend)),
-              GD_COMPLEX128, &Q.EN(recip,cdividend), &(N->EN(recip,cdividend)),
-              Q.scalar, Q.scalar_ind, N->scalar[0], N->scalar_ind[0],
-              E->e->calculated);
+            !gd_ccmpc_(E->EN(recip,cdividend), N->EN(recip,cdividend)),
+            GD_COMPLEX128, &Q.EN(recip,cdividend), &(N->EN(recip,cdividend)),
+            Q.scalar, Q.scalar_ind, N->scalar[0], N->scalar_ind[0],
+            E->e->calculated, E->fragment_index);
         Q.EN(recip,dividend) = creal(Q.EN(recip,cdividend));
         if (cimag(Q.EN(recip,cdividend)) != 0)
           Q.comp_scal = 1;
@@ -618,8 +632,9 @@ static int _GD_Change(DIRFILE *D, const char *field_code, const gd_entry_t *N,
         j = _GD_AlterScalar(D, N->EN(recip,dividend) != 0 &&
             E->EN(recip,dividend) != N->EN(recip,dividend), GD_FLOAT64,
             &Q.EN(recip,dividend), &(N->EN(recip,dividend)), Q.scalar,
-            Q.scalar_ind, N->scalar[0], N->scalar_ind[0], E->e->calculated);
-        _gd_r2c(Q.EN(recip,cdividend), Q.EN(recip,dividend));
+            Q.scalar_ind, N->scalar[0], N->scalar_ind[0], E->e->calculated,
+            E->fragment_index);
+        gd_rs2cs_(Q.EN(recip,cdividend), Q.EN(recip,dividend));
       }
 
       if (j & GD_AS_ERROR)
@@ -638,7 +653,7 @@ static int _GD_Change(DIRFILE *D, const char *field_code, const gd_entry_t *N,
     case GD_PHASE_ENTRY:
       j = _GD_AlterScalar(D, E->EN(phase,shift) != N->EN(phase,shift), GD_INT64,
           &Q.EN(phase,shift), &N->EN(phase,shift), Q.scalar, Q.scalar_ind,
-          N->scalar[0], N->scalar_ind[0], E->e->calculated);
+          N->scalar[0], N->scalar_ind[0], E->e->calculated, E->fragment_index);
 
       if (j & GD_AS_ERROR)
         break;
@@ -649,22 +664,22 @@ static int _GD_Change(DIRFILE *D, const char *field_code, const gd_entry_t *N,
       if (j & GD_AS_MODIFIED)
         modified = 1;
 
-      if (N->in_fields[0] != NULL && strcmp(E->in_fields[0], N->in_fields[0])) {
-        if ((Q.in_fields[0] = strdup(N->in_fields[0])) == NULL) {
-          _GD_SetError(D, GD_E_ALLOC, 0, NULL, 0, NULL);
-          break;
-        }
+      j = _GD_AlterInField(D, 0, Q.in_fields, N->in_fields, E->in_fields,
+          E->fragment_index, 0);
+      if (j < 0)
+        break;
+      else if (j) {
         modified = 1;
         field_free = 1;
       }
 
       break;
-    case GD_POLYNOM_ENTRY: 
-      if (N->in_fields[0] != NULL && strcmp(E->in_fields[0], N->in_fields[0])) {
-        if ((Q.in_fields[0] = strdup(N->in_fields[0])) == NULL) {
-          _GD_SetError(D, GD_E_ALLOC, 0, NULL, 0, NULL);
-          break;
-        }
+    case GD_POLYNOM_ENTRY:
+      j = _GD_AlterInField(D, 0, Q.in_fields, N->in_fields, E->in_fields,
+          E->fragment_index, 0);
+      if (j < 0)
+        break;
+      else if (j) {
         modified = 1;
         field_free = 1;
       }
@@ -679,17 +694,18 @@ static int _GD_Change(DIRFILE *D, const char *field_code, const gd_entry_t *N,
       if (flags & 0x1)
         for (i = 0; i <= Q.EN(polynom,poly_ord); ++i) {
           if (N->comp_scal) {
-            j = _GD_AlterScalar(D, !_gd_ccmpc(E->EN(polynom,ca)[i],
+            j = _GD_AlterScalar(D, !gd_ccmpc_(E->EN(polynom,ca)[i],
                   N->EN(polynom,ca)[i]), GD_COMPLEX128, Q.EN(polynom,ca) + i,
                 N->EN(polynom,ca) + i, Q.scalar + i, Q.scalar_ind + i,
-                N->scalar[i], N->scalar_ind[i], E->e->calculated);
+                N->scalar[i], N->scalar_ind[i], E->e->calculated,
+                E->fragment_index);
             Q.EN(polynom,a)[i] = creal(Q.EN(polynom,ca)[i]);
           } else {
             j = _GD_AlterScalar(D, E->EN(polynom,a)[i] != N->EN(polynom,a)[i],
                 GD_FLOAT64, Q.EN(polynom,a) + i, N->EN(polynom,a) + i,
                 Q.scalar + i, Q.scalar_ind + i, N->scalar[i], N->scalar_ind[i],
-                E->e->calculated);
-            _gd_r2c(Q.EN(polynom,ca)[i], Q.EN(polynom,a)[i]);
+                E->e->calculated, E->fragment_index);
+            gd_rs2cs_(Q.EN(polynom,ca)[i], Q.EN(polynom,a)[i]);
           }
 
           if (j & GD_AS_FREE_SCALAR)
@@ -709,6 +725,114 @@ static int _GD_Change(DIRFILE *D, const char *field_code, const gd_entry_t *N,
         modified = 1;
 
       break;
+    case GD_WINDOW_ENTRY:
+      if (N->EN(window,windop) == GD_WINDOP_UNK)
+        Q.EN(window,windop) = E->EN(window,windop);
+      else {
+        Q.EN(window,windop) = N->EN(window,windop);
+        modified = 1;
+      }
+
+      switch (Q.EN(window,windop)) {
+        case GD_WINDOP_EQ:
+        case GD_WINDOP_NE:
+          j = _GD_AlterScalar(D, E->EN(window,threshold.i) !=
+              N->EN(window,threshold.i), GD_INT64, &Q.EN(window,threshold.i),
+              &N->EN(window,threshold.i), Q.scalar, Q.scalar_ind, N->scalar[0],
+              N->scalar_ind[0], E->e->calculated, E->fragment_index);
+          break;
+        case GD_WINDOP_SET:
+        case GD_WINDOP_CLR:
+          j = _GD_AlterScalar(D, E->EN(window,threshold.u) !=
+              N->EN(window,threshold.u), GD_UINT64, &Q.EN(window,threshold.u),
+              &N->EN(window,threshold.u), Q.scalar, Q.scalar_ind, N->scalar[0],
+              N->scalar_ind[0], E->e->calculated, E->fragment_index);
+          break;
+        default:
+          j = _GD_AlterScalar(D, E->EN(window,threshold.r) !=
+              N->EN(window,threshold.r), GD_FLOAT64, &Q.EN(window,threshold.r),
+              &N->EN(window,threshold.r), Q.scalar, Q.scalar_ind, N->scalar[0],
+              N->scalar_ind[0], E->e->calculated, E->fragment_index);
+          break;
+      }
+
+      if (j & GD_AS_ERROR)
+        break;
+      if (j & GD_AS_FREE_SCALAR)
+        scalar_free |= 1;
+      if (j & GD_AS_NEED_RECALC)
+        Qe.calculated = 0;
+      if (j & GD_AS_MODIFIED)
+        modified = 1;
+
+      j = _GD_AlterInField(D, 0, Q.in_fields, N->in_fields, E->in_fields,
+          E->fragment_index, 0);
+      if (j < 0)
+        break;
+      else if (j) {
+        modified = 1;
+        field_free |= 1;
+      }
+
+      j = _GD_AlterInField(D, 1, Q.in_fields, N->in_fields, E->in_fields,
+          E->fragment_index, 0);
+      if (j < 0)
+        break;
+      else if (j) {
+        modified = 1;
+        field_free |= 2;
+      }
+
+      break;
+    case GD_MPLEX_ENTRY:
+      j = _GD_AlterScalar(D, N->EN(mplex,period) != -1 &&
+          E->EN(mplex,period) != N->EN(mplex,period), GD_INT_TYPE,
+          &Q.EN(mplex,period), &N->EN(mplex,period), Q.scalar,
+          Q.scalar_ind, N->scalar[0], N->scalar_ind[0], E->e->calculated,
+          E->fragment_index);
+
+      if (j & GD_AS_ERROR)
+        break;
+      if (j & GD_AS_FREE_SCALAR)
+        scalar_free |= 1;
+      if (j & GD_AS_NEED_RECALC)
+        Qe.calculated = 0;
+      if (j & GD_AS_MODIFIED)
+        modified = 1;
+
+      j = _GD_AlterScalar(D, E->EN(mplex,count_val) != N->EN(mplex,count_val),
+          GD_INT_TYPE, &Q.EN(mplex,count_val), &N->EN(mplex,count_val),
+          Q.scalar, Q.scalar_ind, N->scalar[1], N->scalar_ind[1],
+          E->e->calculated, E->fragment_index);
+
+      if (j & GD_AS_ERROR)
+        break;
+      if (j & GD_AS_FREE_SCALAR)
+        scalar_free |= 2;
+      if (j & GD_AS_NEED_RECALC)
+        Qe.calculated = 0;
+      if (j & GD_AS_MODIFIED)
+        modified = 1;
+
+      j = _GD_AlterInField(D, 0, Q.in_fields, N->in_fields, E->in_fields,
+          E->fragment_index, 0);
+      if (j < 0)
+        break;
+      else if (j) {
+        modified = 1;
+        field_free |= 1;
+      }
+
+      j = _GD_AlterInField(D, 1, Q.in_fields, N->in_fields, E->in_fields,
+          E->fragment_index, 0);
+      if (j < 0)
+        break;
+      else if (j) {
+        modified = 1;
+        field_free |= 2;
+      }
+
+      break;
     case GD_CONST_ENTRY:
       Q.EN(scalar,const_type) = (N->EN(scalar,const_type) == GD_NULL) ?
         E->EN(scalar,const_type) : N->EN(scalar,const_type);
@@ -722,16 +846,15 @@ static int _GD_Change(DIRFILE *D, const char *field_code, const gd_entry_t *N,
       }
 
       type = _GD_ConstType(D, Q.EN(scalar,const_type));
-      if (Q.EN(scalar,const_type) != E->EN(scalar,const_type)) 
-        modified = 1; 
+      if (Q.EN(scalar,const_type) != E->EN(scalar,const_type))
+        modified = 1;
 
       if (type == _GD_ConstType(D, E->EN(scalar,const_type)))
         Qe.u.scalar.d = E->e->u.scalar.d;
       else {
         /* type convert */
-        Qe.u.scalar.d = malloc(GD_SIZE(type));
+        Qe.u.scalar.d = _GD_Malloc(D, GD_SIZE(type));
         if (Qe.u.scalar.d == NULL) {
-          _GD_SetError(D, GD_E_ALLOC, 0, NULL, 0, NULL);
           dreturn("%i", -1);
           return -1;
         }
@@ -741,7 +864,7 @@ static int _GD_Change(DIRFILE *D, const char *field_code, const gd_entry_t *N,
             ? (double)*(int64_t*)E->e->u.scalar.d
             : (double)*(uint64_t*)E->e->u.scalar.d;
           ((double*)Qe.u.scalar.d)[1] = 0;
-        } else if (type == GD_IEEE754)
+        } else if (type == GD_FLOAT64)
           *(double*)Qe.u.scalar.d = (E->EN(scalar,const_type) & GD_COMPLEX) ?
             *(double*)E->e->u.scalar.d : (E->EN(scalar,const_type) & GD_SIGNED)
             ? (double)*(int64_t*)E->e->u.scalar.d
@@ -780,16 +903,16 @@ static int _GD_Change(DIRFILE *D, const char *field_code, const gd_entry_t *N,
       if (Q.EN(scalar,const_type) != E->EN(scalar,const_type) ||
           Q.EN(scalar,array_len) != E->EN(scalar,array_len))
       {
-        modified = 1; 
+        modified = 1;
       }
 
       type = _GD_ConstType(D, Q.EN(scalar,const_type));
-      Qe.u.scalar.d = malloc(GD_SIZE(type) * Q.EN(scalar,array_len));
+      Qe.u.scalar.d = _GD_Malloc(D, GD_SIZE(type) * Q.EN(scalar,array_len));
       if (Qe.u.scalar.d == NULL) {
-        _GD_SetError(D, GD_E_ALLOC, 0, NULL, 0, NULL);
         dreturn("%i", -1);
         return -1;
       }
+      memset(Qe.u.scalar.d, 0, GD_SIZE(type) * Q.EN(scalar,array_len));
 
       /* copy via type conversion, if array_len has increased, trailing elements
        * are uninitialised. */
@@ -812,6 +935,7 @@ static int _GD_Change(DIRFILE *D, const char *field_code, const gd_entry_t *N,
       /* INDEX may not be modified */
       _GD_SetError(D, GD_E_BAD_FIELD_TYPE, GD_E_FIELD_BAD, NULL, 0, field_code);
     case GD_NO_ENTRY:
+    case GD_ALIAS_ENTRY:
     case GD_STRING_ENTRY:
       break;
   }
@@ -834,7 +958,10 @@ static int _GD_Change(DIRFILE *D, const char *field_code, const gd_entry_t *N,
         free(E->scalar[i]);
     }
 
-    memcpy(E->e, &Qe, sizeof(struct _gd_private_entry));
+    if (E->field_type == GD_LINTERP_ENTRY && flags)
+      _GD_ReleaseDir(D, Qe.u.linterp.table_dirfd);
+
+    memcpy(E->e, &Qe, sizeof(struct gd_private_entry_));
     Q.e = E->e;
     memcpy(E, &Q, sizeof(gd_entry_t));
     D->fragment[E->fragment_index].modified = 1;
@@ -859,6 +986,8 @@ int gd_alter_entry(DIRFILE* D, const char* field_code,
     return -1;
   }
 
+  _GD_ClearError(D);
+
   /* To ensure .e is NULLed */
   memcpy(&N, entry, sizeof(gd_entry_t));
   N.e = NULL;
@@ -874,12 +1003,12 @@ int gd_alter_entry(DIRFILE* D, const char* field_code,
 }
 
 int gd_alter_raw(DIRFILE *D, const char *field_code,
-    gd_type_t data_type, gd_spf_t spf, int move)
+    gd_type_t data_type, unsigned int spf, int move)
 {
   int ret;
   gd_entry_t N;
 
-  dtrace("%p, \"%s\", %u, %x, %i", D, field_code, spf, data_type, move);
+  dtrace("%p, \"%s\", %u, 0x%X, %i", D, field_code, spf, data_type, move);
 
   if (D->flags & GD_INVALID) {/* don't crash */
     _GD_SetError(D, GD_E_BAD_DIRFILE, 0, NULL, 0, NULL);
@@ -889,6 +1018,7 @@ int gd_alter_raw(DIRFILE *D, const char *field_code,
 
   _GD_ClearError(D);
 
+  memset(&N, 0, sizeof(gd_entry_t));
   N.field_type = GD_RAW_ENTRY;
   N.EN(raw,spf) = spf;
   N.EN(raw,data_type) = data_type;
@@ -919,20 +1049,21 @@ int gd_alter_lincom(DIRFILE* D, const char* field_code, int n_fields,
 
   _GD_ClearError(D);
 
+  memset(&N, 0, sizeof(gd_entry_t));
   N.field_type = GD_LINCOM_ENTRY;
   N.comp_scal = 0;
   if (n_fields > GD_MAX_LINCOM || n_fields < 0) {
-    _GD_SetError(D, GD_E_BAD_ENTRY, GD_E_BAD_ENTRY_NFIELDS, NULL, n_fields,
-        NULL);
+    _GD_SetError(D, GD_E_BAD_ENTRY, GD_E_ENTRY_NFIELDS, NULL, n_fields, NULL);
     dreturn("%i", -1);
     return -1;
   } else if (n_fields != 0)
     N.EN(lincom,n_fields) = n_fields;
   else {
-    gd_entry_t *E = _GD_FindField(D, field_code, D->entry, D->n_entries, NULL);
+    gd_entry_t *E = _GD_FindField(D, field_code, D->entry, D->n_entries, 1,
+        NULL);
 
     if (E == NULL) {
-      _GD_SetError(D, GD_E_BAD_CODE, 0, NULL, 0, field_code);
+      _GD_SetError(D, GD_E_BAD_CODE, GD_E_CODE_MISSING, NULL, 0, field_code);
       dreturn("%i", -1);
       return -1;
     }
@@ -987,20 +1118,21 @@ int gd_alter_clincom(DIRFILE* D, const char* field_code, int n_fields,
 
   _GD_ClearError(D);
 
+  memset(&N, 0, sizeof(gd_entry_t));
   N.field_type = GD_LINCOM_ENTRY;
   N.comp_scal = 1;
   if (n_fields > GD_MAX_LINCOM || n_fields < 0) {
-    _GD_SetError(D, GD_E_BAD_ENTRY, GD_E_BAD_ENTRY_NFIELDS, NULL, n_fields,
-        NULL);
+    _GD_SetError(D, GD_E_BAD_ENTRY, GD_E_ENTRY_NFIELDS, NULL, n_fields, NULL);
     dreturn("%i", -1);
     return -1;
   } else if (n_fields != 0)
     N.EN(lincom,n_fields) = n_fields;
   else {
-    gd_entry_t *E = _GD_FindField(D, field_code, D->entry, D->n_entries, NULL);
+    gd_entry_t *E = _GD_FindField(D, field_code, D->entry, D->n_entries, 1,
+        NULL);
 
     if (E == NULL) {
-      _GD_SetError(D, GD_E_BAD_CODE, 0, NULL, 0, field_code);
+      _GD_SetError(D, GD_E_BAD_CODE, GD_E_CODE_MISSING, NULL, 0, field_code);
       dreturn("%i", -1);
       return -1;
     }
@@ -1017,14 +1149,14 @@ int gd_alter_clincom(DIRFILE* D, const char* field_code, int n_fields,
 
     if (cm != NULL) {
       flags |= 2;
-      _gd_ca2c(N.EN(lincom,cm)[i], cm, i);
+      gd_ca2cs_(N.EN(lincom,cm)[i], cm, i);
       N.scalar[i] = NULL;
     } else
       N.scalar[i] = "";
 
     if (cb != NULL) {
       flags |= 4;
-      _gd_ca2c(N.EN(lincom,cb)[i], cb, i);
+      gd_ca2cs_(N.EN(lincom,cb)[i], cb, i);
       N.scalar[i + GD_MAX_LINCOM] = NULL;
     } else
       N.scalar[i + GD_MAX_LINCOM] = "";
@@ -1051,6 +1183,7 @@ int gd_alter_linterp(DIRFILE* D, const char* field_code, const char* in_field,
     return -1;
   }
 
+  memset(&N, 0, sizeof(gd_entry_t));
   N.field_type = GD_LINTERP_ENTRY;
   N.in_fields[0] = (char *)in_field;
   N.EN(linterp,table) = (char *)table;
@@ -1063,7 +1196,7 @@ int gd_alter_linterp(DIRFILE* D, const char* field_code, const char* in_field,
 }
 
 int gd_alter_bit(DIRFILE* D, const char* field_code, const char* in_field,
-    gd_bit_t bitnum, gd_bit_t numbits) gd_nothrow
+    int bitnum, int numbits) gd_nothrow
 {
   int ret;
   gd_entry_t N;
@@ -1077,6 +1210,7 @@ int gd_alter_bit(DIRFILE* D, const char* field_code, const char* in_field,
     return -1;
   }
 
+  memset(&N, 0, sizeof(gd_entry_t));
   N.field_type = GD_BIT_ENTRY;
   N.in_fields[0] = (char *)in_field;
   N.EN(bit,bitnum) = bitnum;
@@ -1092,7 +1226,7 @@ int gd_alter_bit(DIRFILE* D, const char* field_code, const char* in_field,
 }
 
 int gd_alter_sbit(DIRFILE* D, const char* field_code, const char* in_field,
-    gd_bit_t bitnum, gd_bit_t numbits) gd_nothrow
+    int bitnum, int numbits) gd_nothrow
 {
   int ret;
   gd_entry_t N;
@@ -1106,6 +1240,7 @@ int gd_alter_sbit(DIRFILE* D, const char* field_code, const char* in_field,
     return -1;
   }
 
+  memset(&N, 0, sizeof(gd_entry_t));
   N.field_type = GD_SBIT_ENTRY;
   N.in_fields[0] = (char *)in_field;
   N.EN(bit,bitnum) = bitnum;
@@ -1134,6 +1269,7 @@ int gd_alter_recip(DIRFILE* D, const char* field_code, const char* in_field,
     return -1;
   }
 
+  memset(&N, 0, sizeof(gd_entry_t));
   N.field_type = GD_RECIP_ENTRY;
   N.in_fields[0] = (char *)in_field;
   N.scalar[0] = (dividend == 0) ? (char *)"" : NULL;
@@ -1163,6 +1299,7 @@ int gd_alter_crecip(DIRFILE* D, const char* field_code, const char* in_field,
     return -1;
   }
 
+  memset(&N, 0, sizeof(gd_entry_t));
   N.field_type = GD_RECIP_ENTRY;
   N.in_fields[0] = (char *)in_field;
   N.scalar[0] = (cdividend == 0) ? "" : NULL;
@@ -1183,8 +1320,9 @@ int gd_alter_crecip89(DIRFILE* D, const char* field_code, const char* in_field,
   int ret;
   gd_entry_t N;
 
-  dtrace("%p, \"%s\", \"%s\", [%g, %g]", D, field_code, in_field, cdividend[0],
-      cdividend[1]);
+  dtrace("%p, \"%s\", \"%s\", [%g, %g]", D, field_code, in_field,
+      (cdividend == NULL) ? 0 : cdividend[0],
+      (cdividend == NULL) ? 0 : cdividend[1]);
 
   if (D->flags & GD_INVALID) {/* don't crash */
     _GD_SetError(D, GD_E_BAD_DIRFILE, 0, NULL, 0, NULL);
@@ -1192,10 +1330,16 @@ int gd_alter_crecip89(DIRFILE* D, const char* field_code, const char* in_field,
     return -1;
   }
 
+  memset(&N, 0, sizeof(gd_entry_t));
   N.field_type = GD_RECIP_ENTRY;
   N.in_fields[0] = (char *)in_field;
-  N.scalar[0] = (cdividend[0] == 0 && cdividend[1] == 0) ? (char *)"" : NULL;
-  _gd_a2c(N.EN(recip,cdividend), cdividend);
+  if (cdividend == NULL) {
+    N.scalar[0] = "";
+    gd_li2cs_(N.EN(recip,cdividend), 0, 0);
+  } else {
+    N.scalar[0] = (cdividend[0] == 0 && cdividend[1] == 0) ? (char *)"" : NULL;
+    gd_ra2cs_(N.EN(recip,cdividend), cdividend);
+  }
   N.scalar_ind[0] = 0;
   N.comp_scal = 1;
   N.e = NULL;
@@ -1220,6 +1364,7 @@ int gd_alter_divide(DIRFILE* D, const char* field_code, const char* in_field1,
     return -1;
   }
 
+  memset(&N, 0, sizeof(gd_entry_t));
   N.field_type = GD_DIVIDE_ENTRY;
   N.in_fields[0] = (char *)in_field1;
   N.in_fields[1] = (char *)in_field2;
@@ -1245,6 +1390,7 @@ int gd_alter_multiply(DIRFILE* D, const char* field_code, const char* in_field1,
     return -1;
   }
 
+  memset(&N, 0, sizeof(gd_entry_t));
   N.field_type = GD_MULTIPLY_ENTRY;
   N.in_fields[0] = (char *)in_field1;
   N.in_fields[1] = (char *)in_field2;
@@ -1270,6 +1416,7 @@ int gd_alter_phase(DIRFILE* D, const char* field_code, const char* in_field,
     return -1;
   }
 
+  memset(&N, 0, sizeof(gd_entry_t));
   N.field_type = GD_PHASE_ENTRY;
   N.in_fields[0] = (char *)in_field;
   N.EN(phase,shift) = shift;
@@ -1288,7 +1435,7 @@ int gd_alter_const(DIRFILE* D, const char* field_code, gd_type_t const_type)
   int ret;
   gd_entry_t N;
 
-  dtrace("%p, \"%s\", 0x%x", D, field_code, const_type);
+  dtrace("%p, \"%s\", 0x%X", D, field_code, const_type);
 
   if (D->flags & GD_INVALID) {/* don't crash */
     _GD_SetError(D, GD_E_BAD_DIRFILE, 0, NULL, 0, NULL);
@@ -1296,6 +1443,7 @@ int gd_alter_const(DIRFILE* D, const char* field_code, gd_type_t const_type)
     return -1;
   }
 
+  memset(&N, 0, sizeof(gd_entry_t));
   N.field_type = GD_CONST_ENTRY;
   N.EN(scalar,const_type) = const_type;
   N.e = NULL;
@@ -1312,7 +1460,7 @@ int gd_alter_carray(DIRFILE* D, const char* field_code, gd_type_t const_type,
   int ret;
   gd_entry_t N;
 
-  dtrace("%p, \"%s\", 0x%x, %zu", D, field_code, const_type, array_len);
+  dtrace("%p, \"%s\", 0x%X, %" PRNsize_t, D, field_code, const_type, array_len);
 
   if (D->flags & GD_INVALID) {
     _GD_SetError(D, GD_E_BAD_DIRFILE, 0, NULL, 0, NULL);
@@ -1320,6 +1468,7 @@ int gd_alter_carray(DIRFILE* D, const char* field_code, gd_type_t const_type,
     return -1;
   }
 
+  memset(&N, 0, sizeof(gd_entry_t));
   N.field_type = GD_CARRAY_ENTRY;
   N.EN(scalar,const_type) = const_type;
   N.EN(scalar,array_len) = array_len;
@@ -1348,20 +1497,21 @@ int gd_alter_polynom(DIRFILE* D, const char* field_code, int poly_ord,
 
   _GD_ClearError(D);
 
+  memset(&N, 0, sizeof(gd_entry_t));
   N.field_type = GD_POLYNOM_ENTRY;
   N.comp_scal = 0;
   if (poly_ord > GD_MAX_POLYORD || poly_ord < 0) {
-    _GD_SetError(D, GD_E_BAD_ENTRY, GD_E_BAD_ENTRY_POLYORD, NULL, poly_ord,
-        NULL);
+    _GD_SetError(D, GD_E_BAD_ENTRY, GD_E_ENTRY_POLYORD, NULL, poly_ord, NULL);
     dreturn("%i", -1);
     return -1;
   } else if (poly_ord != 0)
     N.EN(polynom,poly_ord) = poly_ord;
   else {
-    gd_entry_t *E = _GD_FindField(D, field_code, D->entry, D->n_entries, NULL);
+    gd_entry_t *E = _GD_FindField(D, field_code, D->entry, D->n_entries, 1,
+        NULL);
 
     if (E == NULL) {
-      _GD_SetError(D, GD_E_BAD_CODE, 0, NULL, 0, field_code);
+      _GD_SetError(D, GD_E_BAD_CODE, GD_E_CODE_MISSING, NULL, 0, field_code);
       dreturn("%i", -1);
       return -1;
     }
@@ -1404,20 +1554,21 @@ int gd_alter_cpolynom(DIRFILE* D, const char* field_code, int poly_ord,
 
   _GD_ClearError(D);
 
+  memset(&N, 0, sizeof(gd_entry_t));
   N.field_type = GD_POLYNOM_ENTRY;
   N.comp_scal = 1;
   if (poly_ord > GD_MAX_POLYORD || poly_ord < 0) {
-    _GD_SetError(D, GD_E_BAD_ENTRY, GD_E_BAD_ENTRY_POLYORD, NULL, poly_ord,
-        NULL);
+    _GD_SetError(D, GD_E_BAD_ENTRY, GD_E_ENTRY_POLYORD, NULL, poly_ord, NULL);
     dreturn("%i", -1);
     return -1;
   } else if (poly_ord != 0)
     N.EN(polynom,poly_ord) = poly_ord;
   else {
-    gd_entry_t *E = _GD_FindField(D, field_code, D->entry, D->n_entries, NULL);
+    gd_entry_t *E = _GD_FindField(D, field_code, D->entry, D->n_entries, 1,
+        NULL);
 
     if (E == NULL) {
-      _GD_SetError(D, GD_E_BAD_CODE, 0, NULL, 0, field_code);
+      _GD_SetError(D, GD_E_BAD_CODE, GD_E_CODE_MISSING, NULL, 0, field_code);
       dreturn("%i", -1);
       return -1;
     }
@@ -1430,7 +1581,7 @@ int gd_alter_cpolynom(DIRFILE* D, const char* field_code, int poly_ord,
   if (ca != NULL)  {
     flags |= 1;
     for (i = 0; i <= N.EN(polynom,poly_ord); ++i) {
-      _gd_ca2c(N.EN(polynom,ca)[i], ca, i);
+      gd_ca2cs_(N.EN(polynom,ca)[i], ca, i);
       N.scalar[i] = NULL;
     }
   } else
@@ -1443,10 +1594,73 @@ int gd_alter_cpolynom(DIRFILE* D, const char* field_code, int poly_ord,
   return ret;
 }
 
+int gd_alter_window(DIRFILE* D, const char *field_code, const char *in_field,
+    const char *check_field, gd_windop_t windop, gd_triplet_t threshold)
+  gd_nothrow
+{
+  int ret;
+  gd_entry_t N;
+
+  dtrace("%p, \"%s\", \"%s\", \"%s\", %i, {%g,%llx,%lli}", D, field_code,
+      in_field, check_field, windop, threshold.r,
+      (unsigned long long)threshold.u, (long long)threshold.i);
+
+  if (D->flags & GD_INVALID) {
+    _GD_SetError(D, GD_E_BAD_DIRFILE, 0, NULL, 0, NULL);
+    dreturn("%i", -1);
+    return -1;
+  }
+
+  memset(&N, 0, sizeof(gd_entry_t));
+  N.field_type = GD_WINDOW_ENTRY;
+  N.in_fields[0] = (char *)in_field;
+  N.in_fields[1] = (char *)check_field;
+  N.EN(window,windop) = windop;
+  N.EN(window,threshold) = threshold;
+  N.scalar[0] = NULL;
+  N.e = NULL;
+
+  ret = _GD_Change(D, field_code, &N, 0);
+
+  dreturn("%i", ret);
+  return ret;
+}
+
+int gd_alter_mplex(DIRFILE* D, const char *field_code, const char *in_field,
+    const char *count_field, int count_val, int period)
+  gd_nothrow
+{
+  int ret;
+  gd_entry_t N;
+
+  dtrace("%p, \"%s\", \"%s\", \"%s\", %i, %i", D, field_code, in_field,
+      count_field, count_val, period);
+
+  if (D->flags & GD_INVALID) {
+    _GD_SetError(D, GD_E_BAD_DIRFILE, 0, NULL, 0, NULL);
+    dreturn("%i", -1);
+    return -1;
+  }
+
+  memset(&N, 0, sizeof(gd_entry_t));
+  N.field_type = GD_MPLEX_ENTRY;
+  N.in_fields[0] = (char *)in_field;
+  N.in_fields[1] = (char *)count_field;
+  N.EN(mplex,count_val) = count_val;
+  N.EN(mplex,period) = period;
+  N.scalar[0] = NULL;
+  N.e = NULL;
+
+  ret = _GD_Change(D, field_code, &N, 0);
+
+  dreturn("%i", ret);
+  return ret;
+}
+
 int gd_alter_spec(DIRFILE* D, const char* line, int move)
 {
   const char *tok_pos = NULL;
-  char *outstring = NULL;
+  char *outstring = NULL, *new_code;
   char *in_cols[MAX_IN_COLS];
   int n_cols, ret;
   int standards = GD_DIRFILE_STANDARDS_VERSION;
@@ -1476,7 +1690,7 @@ int gd_alter_spec(DIRFILE* D, const char* line, int move)
     standards = D->standards;
 
   /* start parsing */
-  n_cols = _GD_Tokenise(D, line, &outstring, &tok_pos, in_cols,
+  n_cols = _GD_Tokenise(D, line, &outstring, &tok_pos, MAX_IN_COLS, in_cols,
       "dirfile_alter_spec()", 0, standards, D->flags & GD_PERMISSIVE);
 
   if (D->error) {
@@ -1494,17 +1708,23 @@ int gd_alter_spec(DIRFILE* D, const char* line, int move)
     return -1;
   }
 
-  N = _GD_FindField(D, in_cols[0], D->entry, D->n_entries, NULL);
+  /* the parser will modifiy in_cols[0] if it contains a metafield code */
+  if ((new_code = _GD_Strdup(D, in_cols[0])) == NULL) {
+    dreturn("%i", -1);
+    return -1;
+  }
+
+  N = _GD_FindField(D, in_cols[0], D->entry, D->n_entries, 1, NULL);
 
   if (N == NULL) {
     free(outstring);
-    _GD_SetError(D, GD_E_BAD_CODE, 0, NULL, 0, in_cols[0]);
+    _GD_SetError(D, GD_E_BAD_CODE, GD_E_CODE_MISSING, NULL, 0, in_cols[0]);
     dreturn("%i", -1);
     return -1;
   }
 
   /* Let the parser compose the entry */
-  N = _GD_ParseFieldSpec(D, n_cols, in_cols, NULL, "dirfile_alter_spec()", 0, 
+  N = _GD_ParseFieldSpec(D, n_cols, in_cols, NULL, "dirfile_alter_spec()", 0,
       N->fragment_index, standards, 0, GD_PEDANTIC, 0, &outstring, tok_pos);
 
   free(outstring);
@@ -1514,13 +1734,17 @@ int gd_alter_spec(DIRFILE* D, const char* line, int move)
     return -1;
   }
 
+  /* The parse will have re-applied the prefix and suffix, undo that */
+  free(N->field);
+  N->field = new_code;
+
   if (N->field_type == GD_LINCOM_ENTRY)
     move = 7;
 
   /* Change the entry */
   ret = _GD_Change(D, N->field, N, move);
 
-  _GD_FreeE(N, 1);
+  _GD_FreeE(D, N, 1);
 
   dreturn("%i", ret);
   return ret;
@@ -1552,9 +1776,9 @@ int gd_malter_spec(DIRFILE* D, const char* line, const char* parent, int move)
 
   _GD_ClearError(D);
 
-  N = _GD_FindField(D, parent, D->entry, D->n_entries, NULL);
+  N = _GD_FindField(D, parent, D->entry, D->n_entries, 1, NULL);
   if (N == NULL) {
-    _GD_SetError(D, GD_E_BAD_CODE, 0, NULL, 0, parent);
+    _GD_SetError(D, GD_E_BAD_CODE, GD_E_CODE_MISSING, NULL, 0, parent);
     dreturn("%i", -1);
     return -1;
   }
@@ -1566,14 +1790,23 @@ int gd_malter_spec(DIRFILE* D, const char* line, const char* parent, int move)
     standards = D->standards;
 
   /* start parsing */
-  n_cols = _GD_Tokenise(D, line, &outstring, &tok_pos, in_cols,
+  n_cols = _GD_Tokenise(D, line, &outstring, &tok_pos, MAX_IN_COLS, in_cols,
       "dirfile_malter_spec()", 0, standards, D->flags & GD_PERMISSIVE);
 
-  if (!D->error)
+  if (!D->error) {
     /* Let the parser compose the entry */
     N = _GD_ParseFieldSpec(D, n_cols, in_cols, N, "dirfile_malter_spec()", 0,
         N->fragment_index, standards, 0, GD_PEDANTIC, 0, &outstring, tok_pos);
 
+    /* The parse will have re-applied the prefix and suffix, undo that */
+    free(N->field);
+    if ((N->field = (char*)_GD_Malloc(D, strlen(parent) + strlen(in_cols[0]) +
+            2)))
+    {
+      sprintf(N->field, "%s/%s", parent, in_cols[0]);
+    }
+  }
+
   free(outstring);
 
   if (D->error) {
@@ -1587,7 +1820,7 @@ int gd_malter_spec(DIRFILE* D, const char* line, const char* parent, int move)
   /* Change the entry */
   ret = _GD_Change(D, N->field, N, move);
 
-  _GD_FreeE(N, 1);
+  _GD_FreeE(D, N, 1);
 
   dreturn("%i", ret);
   return ret;
diff --git a/src/move.c b/src/move.c
index 9b1d078..aedeca6 100644
--- a/src/move.c
+++ b/src/move.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2010 D. V. Wiebe
+/* Copyright (C) 2008-2011 D. V. Wiebe
  *
  ***************************************************************************
  *
@@ -20,12 +20,6 @@
  */
 #include "internal.h"
 
-#ifdef STDC_HEADERS
-#include <stdlib.h>
-#include <string.h>
-#include <errno.h>
-#endif
-
 int _GD_MogrifyFile(DIRFILE* D, gd_entry_t* E, unsigned long encoding,
     unsigned long byte_sex, off64_t offset, int finalise, int new_fragment,
     char* new_filebase)
@@ -35,7 +29,7 @@ int _GD_MogrifyFile(DIRFILE* D, gd_entry_t* E, unsigned long encoding,
   const size_t ns = BUFFER_SIZE / E->e->u.raw.size;
   ssize_t nread, nwrote;
   int subencoding = GD_ENC_UNKNOWN;
-  int i;
+  int i, ef_swap;
   int arm_endianise;
   void *buffer;
 
@@ -46,9 +40,8 @@ int _GD_MogrifyFile(DIRFILE* D, gd_entry_t* E, unsigned long encoding,
     new_fragment = E->fragment_index;
 
   if (new_filebase == NULL) {
-    new_filebase = strdup(E->e->u.raw.filebase);
+    new_filebase = _GD_Strdup(D, E->e->u.raw.filebase);
     if (new_filebase == NULL) {
-      _GD_SetError(D, GD_E_ALLOC, 0, NULL, 0, NULL);
       dreturn("%i", -1);
       return -1;
     }
@@ -58,28 +51,29 @@ int _GD_MogrifyFile(DIRFILE* D, gd_entry_t* E, unsigned long encoding,
 
   /* Figure out the new subencoding scheme */
   if (encoding == D->fragment[E->fragment_index].encoding &&
-      E->e->u.raw.file[0].encoding != GD_ENC_UNKNOWN) {
-    subencoding = E->e->u.raw.file[0].encoding;
+      E->e->u.raw.file[0].subenc != GD_ENC_UNKNOWN)
+  {
+    subencoding = E->e->u.raw.file[0].subenc;
   } else
-    for (i = 0; _gd_ef[i].scheme != GD_ENC_UNSUPPORTED; i++) {
-      if (_gd_ef[i].scheme == encoding) {
+    for (i = 0; gd_ef_[i].scheme != GD_ENC_UNSUPPORTED; i++) {
+      if (gd_ef_[i].scheme == encoding) {
         subencoding = i;
         break;
       }
     }
 
   if (subencoding == GD_ENC_UNKNOWN) {
-    _GD_SetError(D, GD_E_UNKNOWN_ENCODING, 0, NULL, 0, NULL);
+    _GD_SetError(D, GD_E_UNKNOWN_ENCODING, GD_E_UNENC_TARGET, NULL, 0, NULL);
     free(new_filebase);
     dreturn("%i", -1);
     return -1;
   }
 
-  enc_out = _gd_ef + subencoding;
+  enc_out = gd_ef_ + subencoding;
 
   /* Check output encoding */
   if (_GD_MissingFramework(subencoding, GD_EF_CLOSE | GD_EF_SEEK | GD_EF_WRITE |
-        GD_EF_SYNC | GD_EF_TEMP))
+        GD_EF_SYNC))
   {
     _GD_SetError(D, GD_E_UNSUPPORTED, 0, NULL, 0, NULL);
     free(new_filebase);
@@ -88,30 +82,35 @@ int _GD_MogrifyFile(DIRFILE* D, gd_entry_t* E, unsigned long encoding,
   }
 
   /* input encoding check */
-  if (!_GD_Supports(D, E, GD_EF_OPEN | GD_EF_CLOSE | GD_EF_SEEK | GD_EF_READ
-        | GD_EF_UNLINK))
+  if (!_GD_Supports(D, E, GD_EF_NAME | GD_EF_OPEN | GD_EF_CLOSE | GD_EF_SEEK |
+        GD_EF_READ | GD_EF_UNLINK))
   {
     free(new_filebase);
     dreturn("%i", -1);
     return -1;
   }
 
-  enc_in = _gd_ef + E->e->u.raw.file[0].encoding;
+  enc_in = gd_ef_ + E->e->u.raw.file[0].subenc;
 
   /* Need to do the ARM thing? */
-  arm_endianise = (((byte_sex & GD_ARM_FLAG) && enc_out->ecor) ^
-    ((D->fragment[E->fragment_index].byte_sex & GD_ARM_FLAG) && enc_in->ecor))
-    && (E->EN(raw,data_type) == GD_FLOAT64 ||
-        E->EN(raw,data_type) == GD_COMPLEX128);
+  arm_endianise = (((byte_sex & GD_ARM_FLAG) && (enc_out->flags & GD_EF_ECOR)) ^
+      ((D->fragment[E->fragment_index].byte_sex & GD_ARM_FLAG) &&
+       (enc_in->flags & GD_EF_ECOR))) && (E->EN(raw,data_type) == GD_FLOAT64 ||
+       E->EN(raw,data_type) == GD_COMPLEX128);
 
   /* Normalise endiannesses */
 #ifdef WORDS_BIGENDIAN
-  byte_sex = ((byte_sex & GD_LITTLE_ENDIAN) && enc_out->ecor) ^
+  ef_swap = (byte_sex & GD_LITTLE_ENDIAN) ? 1 : 0;
+  byte_sex = ((byte_sex & GD_LITTLE_ENDIAN) &&
+      (enc_out->flags & (GD_EF_ECOR | GD_EF_SWAP))) ^
     ((D->fragment[E->fragment_index].byte_sex & GD_LITTLE_ENDIAN) &&
-     enc_in->ecor);
+     (enc_in->flags & (GD_EF_ECOR | GD_EF_SWAP)));
 #else
-  byte_sex = ((byte_sex & GD_BIG_ENDIAN) && enc_out->ecor) ^
-    ((D->fragment[E->fragment_index].byte_sex & GD_BIG_ENDIAN) && enc_in->ecor);
+  ef_swap = (byte_sex & GD_BIG_ENDIAN) ? 1 : 0;
+  byte_sex = ((byte_sex & GD_BIG_ENDIAN) &&
+      (enc_out->flags & (GD_EF_ECOR | GD_EF_SWAP))) ^
+    ((D->fragment[E->fragment_index].byte_sex & GD_BIG_ENDIAN) &&
+     (enc_in->flags & (GD_EF_ECOR | GD_EF_SWAP)));
 #endif
   /* Now byte_sex is true if endianness conversion is required. */
 
@@ -119,7 +118,8 @@ int _GD_MogrifyFile(DIRFILE* D, gd_entry_t* E, unsigned long encoding,
    * endianness conversion, don't do anything */
   if (offset == 0 && encoding == D->fragment[E->fragment_index].encoding &&
       !byte_sex && !arm_endianise && strcmp(new_filebase,
-        E->e->u.raw.filebase) == 0)
+        E->e->u.raw.filebase) == 0 && D->fragment[new_fragment].dirfd ==
+      D->fragment[E->fragment_index].dirfd)
   {
     free(new_filebase);
     dreturn("%i", 0);
@@ -137,32 +137,21 @@ int _GD_MogrifyFile(DIRFILE* D, gd_entry_t* E, unsigned long encoding,
     return -1;
   }
 
-  /* Create the output file and open it. If we're changing encodings, we
-   * could write to the new file directly.  However, we use a temporary file
-   * anyway just to keep things clean. */
-  E->e->u.raw.file[1].encoding = subencoding;
-
-  if (_GD_SetEncodedName(D, E->e->u.raw.file + 1, new_filebase, 1))
-    ; /* error already set */
-  else if ((*enc_out->temp)(E->e->u.raw.file, GD_TEMP_OPEN))
-    _GD_SetError(D, GD_E_RAW_IO, 0, E->e->u.raw.file[1].name, errno, NULL);
-
-  if (D->error) {
+  /* Open the input file, if necessary */
+  if (_GD_InitRawIO(D, E, NULL, 0, NULL, 0, GD_FILE_READ, 0)) {
     free(new_filebase);
     dreturn("%i", -1);
     return -1;
   }
 
-  /* Open the input file, if necessary */
-  if (_GD_SetEncodedName(D, E->e->u.raw.file, E->e->u.raw.filebase, 0))
-    ; /* error already set */
-  else if (E->e->u.raw.file[0].fp == -1 && (*enc_in->open)(E->e->u.raw.file, 0,
-        0))
-  {
-    _GD_SetError(D, GD_E_RAW_IO, 0, E->e->u.raw.file[0].name, errno, NULL);
-  }
+  /* Create the output file and open it. If we're changing encodings, we
+   * could write to the new file directly.  However, we use a temporary file
+   * anyway just to keep things clean. */
+  E->e->u.raw.file[1].subenc = subencoding;
 
-  if (D->error) {
+  if (_GD_InitRawIO(D, E, new_filebase, new_fragment, enc_out, 0,
+        GD_FILE_WRITE | GD_FILE_TEMP, ef_swap))
+  {
     free(new_filebase);
     dreturn("%i", -1);
     return -1;
@@ -170,23 +159,20 @@ int _GD_MogrifyFile(DIRFILE* D, gd_entry_t* E, unsigned long encoding,
 
   /* Adjust for the change in offset */
   if (offset < 0) { /* new offset is less, pad new file */
-    if ((*enc_in->seek)(E->e->u.raw.file, 0, E->EN(raw,data_type), 1) == -1)
-      _GD_SetError(D, GD_E_RAW_IO, 0, E->e->u.raw.file[0].name, errno, NULL);
-    else if ((*enc_out->seek)(E->e->u.raw.file + 1, -offset * E->EN(raw,spf),
-          E->EN(raw,data_type), 1) == -1)
+    if ((*enc_in->seek)(E->e->u.raw.file, 0, E->EN(raw,data_type),
+          GD_FILE_WRITE) == -1)
     {
-      _GD_SetError(D, GD_E_RAW_IO, 0, E->e->u.raw.file[1].name, errno, NULL);
-    }
+      _GD_SetError(D, GD_E_RAW_IO, 0, E->e->u.raw.file[0].name, errno, NULL);
+    } else
+      _GD_WriteSeek(D, E, enc_out, -offset * E->EN(raw,spf), GD_FILE_WRITE
+          | GD_FILE_TEMP);
   } else { /* new offset is more, truncate old file */
     if ((*enc_in->seek)(E->e->u.raw.file, offset * E->EN(raw,spf),
-          E->EN(raw,data_type), 0) == -1)
+          E->EN(raw,data_type), GD_FILE_READ) == -1)
     {
       _GD_SetError(D, GD_E_RAW_IO, 0, E->e->u.raw.file[0].name, errno, NULL);
-    } else if ((*enc_out->seek)(E->e->u.raw.file + 1, 0, E->EN(raw,data_type),
-          1) == -1)
-    {
-      _GD_SetError(D, GD_E_RAW_IO, 0, E->e->u.raw.file[1].name, errno, NULL);
-    }
+    } else
+      _GD_WriteSeek(D, E, enc_out, 0, GD_FILE_WRITE | GD_FILE_TEMP);
   }
 
   if (D->error) {
@@ -195,8 +181,7 @@ int _GD_MogrifyFile(DIRFILE* D, gd_entry_t* E, unsigned long encoding,
     return -1;
   }
 
-  if ((buffer = malloc(BUFFER_SIZE)) == NULL) {
-    _GD_SetError(D, GD_E_ALLOC, 0, NULL, 0, NULL);
+  if ((buffer = _GD_Malloc(D, BUFFER_SIZE)) == NULL) {
     free(new_filebase);
     dreturn("%i", -1);
     return -1;
@@ -217,8 +202,8 @@ int _GD_MogrifyFile(DIRFILE* D, gd_entry_t* E, unsigned long encoding,
 
     /* fix army-ness, if required */
     if (arm_endianise)
-        _GD_ArmEndianise((uint64_t *)buffer, E->EN(raw,data_type) & GD_COMPLEX,
-            nread);
+      _GD_ArmEndianise((uint64_t *)buffer, E->EN(raw,data_type) & GD_COMPLEX,
+          nread);
 
     /* swap endianness, if required */
     if (byte_sex) {
@@ -228,8 +213,7 @@ int _GD_MogrifyFile(DIRFILE* D, gd_entry_t* E, unsigned long encoding,
         _GD_FixEndianness((char *)buffer, E->e->u.raw.size, nread);
     }
 
-    nwrote = (*enc_out->write)(E->e->u.raw.file + 1, buffer,
-        E->EN(raw,data_type), nread);
+    nwrote = _GD_WriteOut(E, enc_out, buffer, E->EN(raw,data_type), nread, 1);
 
     if (nwrote < nread) {
       _GD_SetError(D, GD_E_RAW_IO, 0, E->e->u.raw.file[1].name, errno, NULL);
@@ -239,51 +223,58 @@ int _GD_MogrifyFile(DIRFILE* D, gd_entry_t* E, unsigned long encoding,
 
   free(buffer);
 
-  /* Close both files */
-  if ((*enc_in->close)(E->e->u.raw.file))
-    _GD_SetError(D, GD_E_RAW_IO, 0, E->e->u.raw.file[0].name, errno, NULL);
-
-  if ((*enc_out->sync)(E->e->u.raw.file + 1) ||
-      (*enc_out->close)(E->e->u.raw.file + 1))
-  {
-    _GD_SetError(D, GD_E_RAW_IO, 0, E->e->u.raw.file[1].name, errno, NULL);
-  }
 
   if (finalise) {
     /* Finalise the conversion: on error delete the temporary file, otherwise
      * copy it over top of the new one. */
-    if (D->error)
-      (*enc_out->temp)(E->e->u.raw.file, GD_TEMP_DESTROY);
-    else {
-      struct _gd_raw_file temp;
+    if (D->error) {
+      /* An error occurred, delete the temporary file (the old
+       * file can stay open) */
+      _GD_FiniRawIO(D, E, new_fragment, GD_FINIRAW_CLOTEMP
+          | GD_FINIRAW_DISCARD);
+    } else {
+      struct gd_raw_file_ temp;
       memcpy(&temp, E->e->u.raw.file, sizeof(temp));
 
+      /* discard the old file */
+      _GD_FiniRawIO(D, E, E->fragment_index, GD_FINIRAW_DISCARD);
+
       E->e->u.raw.file[0].name = NULL;
-      E->e->u.raw.file[0].encoding = subencoding;
+      E->e->u.raw.file[0].subenc = subencoding;
 
-      if (_GD_SetEncodedName(D, E->e->u.raw.file, new_filebase, 0)) {
+      if ((*gd_ef_[E->e->u.raw.file[0].subenc].name)(D,
+            (const char*)D->fragment[E->fragment_index].enc_data,
+            E->e->u.raw.file, new_filebase, 0, 0))
+      {
         E->e->u.raw.file[0].name = temp.name;
-        E->e->u.raw.file[0].encoding = temp.encoding;
-      } else if ((*enc_out->temp)(E->e->u.raw.file, GD_TEMP_MOVE)) {
-        _GD_SetError(D, GD_E_RAW_IO, 0, E->e->u.raw.file[1].name, errno,
-            NULL);
+        E->e->u.raw.file[0].subenc = temp.subenc;
+      } else if (_GD_FiniRawIO(D, E, new_fragment, GD_FINIRAW_KEEP |
+            GD_FINIRAW_CLOTEMP))
+      {
         E->e->u.raw.file[0].name = temp.name;
-        E->e->u.raw.file[0].encoding = temp.encoding;
-      } else if ((subencoding != temp.encoding || strcmp(E->e->u.raw.filebase,
-              new_filebase)) && (*enc_in->unlink)(&temp))
+        E->e->u.raw.file[0].subenc = temp.subenc;
+      } else if ((subencoding != temp.subenc || strcmp(E->e->u.raw.filebase,
+              new_filebase) || D->fragment[new_fragment].dirfd !=
+            D->fragment[E->fragment_index].dirfd) && (*enc_in->unlink)(
+              D->fragment[E->fragment_index].dirfd, &temp))
       {
         _GD_SetError(D, GD_E_RAW_IO, 0, temp.name, errno, NULL);
         E->e->u.raw.file[0].name = temp.name;
-        E->e->u.raw.file[0].encoding = temp.encoding;
+        E->e->u.raw.file[0].subenc = temp.subenc;
       } else {
         free(temp.name);
         free(E->e->u.raw.filebase);
         E->e->u.raw.filebase = new_filebase;
       }
     }
-  } else
+  } else {
     free(new_filebase);
 
+    /* Close both files */
+    _GD_FiniRawIO(D, E, E->fragment_index, GD_FINIRAW_DEFER);
+    _GD_FiniRawIO(D, E, new_fragment, GD_FINIRAW_DEFER | GD_FINIRAW_CLOTEMP);
+  }
+
   if (D->error) {
     dreturn("%i", -1);
     return -1;
@@ -293,7 +284,7 @@ int _GD_MogrifyFile(DIRFILE* D, gd_entry_t* E, unsigned long encoding,
   return 0;
 }
 
-static int strcmpnull(const char *s1, const char *s2)
+int _GD_StrCmpNull(const char *s1, const char *s2)
 {
   int r;
 
@@ -320,19 +311,13 @@ static int strcmpnull(const char *s1, const char *s2)
   return r;
 }
 
-int gd_move(DIRFILE* D, const char* field_code, int new_fragment, int move_data)
+int _GD_Move(DIRFILE *D, gd_entry_t *E, int new_fragment, int move_data)
 {
-  gd_entry_t *E;
-  char *new_filebase;
-  int i;
+  char *new_filebase, *new_code;
+  char **new_meta = NULL;
+  int i, dummy;
 
-  dtrace("%p, \"%s\", %i, %i", D, field_code, new_fragment, move_data);
-
-  if (D->flags & GD_INVALID) {/* don't crash */
-    _GD_SetError(D, GD_E_BAD_DIRFILE, 0, NULL, 0, NULL);
-    dreturn("%i", -1);
-    return -1;
-  }
+  dtrace("%p, %p, %i, %i", D, E, new_fragment, move_data);
 
   /* check access mode */
   if ((D->flags & GD_ACCMODE) == GD_RDONLY) {
@@ -341,41 +326,74 @@ int gd_move(DIRFILE* D, const char* field_code, int new_fragment, int move_data)
     return -1;
   }
 
-  if (new_fragment < 0 || new_fragment >= D->n_fragment) {
-    _GD_SetError(D, GD_E_BAD_INDEX, 0, NULL, new_fragment, NULL);
+  /* check metadata protection */
+  if (D->fragment[E->fragment_index].protection & GD_PROTECT_FORMAT ||
+      D->fragment[new_fragment].protection & GD_PROTECT_FORMAT)
+  {
+    _GD_SetError(D, GD_E_PROTECTED, GD_E_PROTECTED_FORMAT, NULL, 0,
+        D->fragment[E->fragment_index].cname);
     dreturn("%i", -1);
     return -1;
   }
 
-  _GD_ClearError(D);
-
-  E = _GD_FindField(D, field_code, D->entry, D->n_entries, NULL);
-
-  if (E == NULL) {
-    _GD_SetError(D, GD_E_BAD_CODE, 0, NULL, 0, field_code);
+  /* Compose the field's new name */
+  new_filebase = _GD_MungeCode(D, NULL, D->fragment[E->fragment_index].prefix,
+      D->fragment[E->fragment_index].suffix, NULL, NULL, E->field, &dummy, 0);
+  
+  if (!new_filebase) {
+    _GD_InternalError(D); /* the prefix/suffix wasn't found */
     dreturn("%i", -1);
     return -1;
   }
 
-  if (E->fragment_index == new_fragment) {
-    dreturn("%i", 0);
-    return 0;
-  }
+  new_code = _GD_MungeFromFrag(D, NULL, new_fragment, new_filebase, &dummy);
 
-  if (E->field_type == GD_INDEX_ENTRY) {
-    _GD_SetError(D, GD_E_BAD_FIELD_TYPE, GD_E_FIELD_BAD, NULL, 0, "INDEX");
-    dreturn("%i", -1);
-    return -1;
-  }
+  if (strcmp(new_code, E->field)) {
+    /* duplicate check */
+    if (_GD_FindField(D, new_code, D->entry, D->n_entries, 1, NULL)) {
+      _GD_SetError(D, GD_E_DUPLICATE, 0, NULL, 0, new_code);
+      free(new_filebase);
+      free(new_code);
+      dreturn("%i", -1);
+      return -1;
+    }
 
-  /* check metadata protection */
-  if (D->fragment[E->fragment_index].protection & GD_PROTECT_FORMAT ||
-      D->fragment[new_fragment].protection & GD_PROTECT_FORMAT)
-  {
-    _GD_SetError(D, GD_E_PROTECTED, GD_E_PROTECTED_FORMAT, NULL, 0,
-        D->fragment[E->fragment_index].cname);
-    dreturn("%i", -1);
-    return -1;
+    /* compose all the new meta field names.  We must do this now in 
+     * a temporary location in case it fails and/or subsequent stuff fails */
+    if (E->e->n_meta > 0) {
+      int nlen = strlen(new_code);
+      int olen = strlen(E->field);
+      new_meta = (char**)_GD_Malloc(D, sizeof(char *) * E->e->n_meta);
+      if (!new_meta) {
+        free(new_filebase);
+        free(new_code);
+        dreturn("%i", -1);
+        return -1;
+      }
+
+      memset(new_meta, 0, sizeof(char *) * E->e->n_meta);
+      for (i = 0; i < E->e->n_meta; ++i) {
+        new_meta[i] = (char*)_GD_Malloc(D,
+            strlen(E->e->p.meta_entry[i]->field) + nlen - olen + 1);
+        if (new_meta[i] == NULL)
+          break;
+        sprintf(new_meta[i], "%s/%s", new_code,
+            E->e->p.meta_entry[i]->field + olen + 1);
+      }
+
+      if (D->error) {
+        for (i = 0; i < E->e->n_meta; ++i)
+          free(new_meta[i]);
+        free(new_meta);
+        free(new_filebase);
+        free(new_code);
+        dreturn("%i", -1);
+        return -1;
+      }
+    }
+  } else {
+    free(new_code);
+    new_code = NULL;
   }
 
   if (move_data && E->field_type == GD_RAW_ENTRY &&
@@ -385,29 +403,25 @@ int gd_move(DIRFILE* D, const char* field_code, int new_fragment, int move_data)
        D->fragment[new_fragment].byte_sex ||
        D->fragment[E->fragment_index].frame_offset !=
        D->fragment[new_fragment].frame_offset ||
-       strcmpnull(D->fragment[E->fragment_index].sname,
+       _GD_StrCmpNull(D->fragment[E->fragment_index].sname,
          D->fragment[new_fragment].sname)))
   {
-    new_filebase = (char *)malloc(FILENAME_MAX);
-    if (new_filebase == NULL) {
-      _GD_SetError(D, GD_E_ALLOC, 0, NULL, 0, NULL);
-      dreturn("%i", -1);
-      return -1;
-    }
-
-    snprintf(new_filebase, FILENAME_MAX, "%s/%s",
-        D->fragment[new_fragment].sname ? D->fragment[new_fragment].sname :
-        D->name, E->field);
-
     if (_GD_MogrifyFile(D, E, D->fragment[new_fragment].encoding,
           D->fragment[new_fragment].byte_sex,
           D->fragment[new_fragment].frame_offset, 1, new_fragment,
           new_filebase))
     {
+      if (new_meta) {
+        for (i = 0; i < E->e->n_meta; ++i)
+          free(new_meta[i]);
+        free(new_meta);
+      }
+      free(new_code);
       dreturn("%i", -1);
       return -1;
     }
-  }
+  } else
+    free(new_filebase);
 
   /* nothing from now on may fail */
   D->fragment[E->fragment_index].modified = 1;
@@ -416,9 +430,113 @@ int gd_move(DIRFILE* D, const char* field_code, int new_fragment, int move_data)
   E->fragment_index = new_fragment;
 
   /* update meta fields */
-  for (i = 0; i < E->e->n_meta; ++i)
+  for (i = 0; i < E->e->n_meta; ++i) {
     E->e->p.meta_entry[i]->fragment_index = new_fragment;
+    if (new_meta) {
+      free(E->e->p.meta_entry[i]->field);
+      E->e->p.meta_entry[i]->field = new_meta[i];
+    }
+  }
+
+  if (new_code) {
+    free(new_meta);
+    free(E->field);
+    E->field = new_code;
+
+    /* resort */
+    qsort(D->entry, D->n_entries, sizeof(gd_entry_t*), _GD_EntryCmp);
+    qsort(D->dot_list, D->n_dot, sizeof(gd_entry_t*), _GD_EntryCmp);
+  }
 
   dreturn("%i", 0);
   return 0;
 }
+
+int gd_move(DIRFILE *D, const char *field_code, int new_fragment, int move_data)
+{
+  gd_entry_t *E;
+  int ret;
+
+  dtrace("%p, \"%s\", %i, %i", D, field_code, new_fragment, move_data);
+
+  if (D->flags & GD_INVALID) {
+    _GD_SetError(D, GD_E_BAD_DIRFILE, 0, NULL, 0, NULL);
+    dreturn("%i", -1);
+    return -1;
+  }
+
+  _GD_ClearError(D);
+
+  E = _GD_FindField(D, field_code, D->entry, D->n_entries, 1, NULL);
+
+  if (E == NULL) {
+    _GD_SetError(D, GD_E_BAD_CODE, GD_E_CODE_MISSING, NULL, 0, field_code);
+    dreturn("%i", -1);
+    return -1;
+  }
+
+  if (E->field_type == GD_INDEX_ENTRY) {
+    _GD_SetError(D, GD_E_BAD_FIELD_TYPE, GD_E_FIELD_BAD, NULL, 0, "INDEX");
+    dreturn("%i", -1);
+    return -1;
+  }
+
+  if (new_fragment < 0 || new_fragment >= D->n_fragment) {
+    _GD_SetError(D, GD_E_BAD_INDEX, 0, NULL, new_fragment, NULL);
+    dreturn("%i", -1);
+    return -1;
+  } else if (E->fragment_index == new_fragment) {
+    dreturn("%i", 0);
+    return 0;
+  }
+
+  ret = _GD_Move(D, E, new_fragment, move_data);
+
+  dreturn("%i", ret);
+  return ret;
+}
+
+int gd_move_alias(DIRFILE *D, const char *field_code, int new_fragment)
+  gd_nothrow
+{
+  gd_entry_t *E;
+  int ret;
+
+  dtrace("%p, \"%s\", %i", D, field_code, new_fragment);
+
+  if (D->flags & GD_INVALID) {
+    _GD_SetError(D, GD_E_BAD_DIRFILE, 0, NULL, 0, NULL);
+    dreturn("%i", -1);
+    return -1;
+  }
+
+  _GD_ClearError(D);
+
+  E = _GD_FindField(D, field_code, D->entry, D->n_entries, 0, NULL);
+
+  if (E == NULL) {
+    _GD_SetError(D, GD_E_BAD_CODE, GD_E_CODE_MISSING, NULL, 0, field_code);
+    dreturn("%i", -1);
+    return -1;
+  }
+
+  if (E->field_type != GD_ALIAS_ENTRY) {
+    _GD_SetError(D, GD_E_BAD_FIELD_TYPE, GD_E_FIELD_BAD, NULL, 0, field_code);
+    dreturn("%i", -1);
+    return -1;
+  }
+
+  if (new_fragment < 0 || new_fragment >= D->n_fragment) {
+    _GD_SetError(D, GD_E_BAD_INDEX, 0, NULL, new_fragment, NULL);
+    dreturn("%i", -1);
+    return -1;
+  } else if (E->fragment_index == new_fragment) {
+    dreturn("%i", 0);
+    return 0;
+  }
+
+  ret = _GD_Move(D, E, new_fragment, 0);
+
+  dreturn("%i", ret);
+  return ret;
+}
diff --git a/src/name.c b/src/name.c
index 97b05c0..8747c35 100644
--- a/src/name.c
+++ b/src/name.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2010 D. V. Wiebe
+/* Copyright (C) 2008-2012 D. V. Wiebe
  *
  ***************************************************************************
  *
@@ -20,117 +20,442 @@
  */
 #include "internal.h"
 
-#ifdef STDC_HEADERS
-#include <stdlib.h>
-#include <string.h>
-#include <errno.h>
-#endif
+/* add/remove/modify the prefix and suffix from a field code */
+char *_GD_MungeCode(DIRFILE *D, const gd_entry_t *P, const char *old_prefix,
+    const char *old_suffix, const char *new_prefix, const char *new_suffix,
+    const char *code, int *offset, int err_ok)
+{
+  size_t len, oplen = 0, oslen = 0, nplen = 0, nslen = 0, plen = 0, mlen = 0;
+  const char *ptr, *slash;
+  char *new_code;
+
+  dtrace("%p, %p, \"%s\", \"%s\", \"%s\", \"%s\", \"%s\", %p, %i", D, P,
+      old_prefix, old_suffix, new_prefix, new_suffix, code, offset, err_ok);
+
+  if (code == NULL) {
+    dreturn("%p", NULL);
+    return NULL;
+  }
+
+  len = strlen(code);
+
+  /* Verify the old prefix is present */
+  if (old_prefix) {
+    oplen = strlen(old_prefix);
+    if (strncmp(old_prefix, code, oplen)) {
+      /* prefix missing */
+      if (err_ok)
+        _GD_SetError(D, GD_E_BAD_CODE, GD_E_CODE_INVALID, NULL, 0, code);
+      else
+        _GD_InternalError(D);
+      dreturn("%p", NULL);
+      return NULL;
+    }
+    ptr = code + oplen;
+    len -= oplen;
+  } else
+    ptr = code;
+
+  /* look for a /, which could indicate this is a metafield code.  If it is
+   * just an illegal name with a / in it, mungeing will screw up, but
+   * validation will catch the illegal name later anyways.
+   */
+  if ((slash = (char*)memchr(ptr, '/', len))) {
+    mlen = len + (ptr - slash);
+    len = slash++ - ptr;
+  }
+
+  /* Verify the suffix is present */
+  if (old_suffix) {
+    oslen = strlen(old_suffix);
+    if (strncmp(old_suffix, ptr + len - oslen, oslen)) {
+      /* suffix missing */
+      if (err_ok)
+        _GD_SetError(D, GD_E_BAD_CODE, GD_E_CODE_INVALID, NULL, 0, code);
+      else
+        _GD_InternalError(D);
+      dreturn("%p", NULL);
+      return NULL;
+    }
+    len -= oslen;
+  }
+
+  if (new_prefix)
+    nplen = strlen(new_prefix);
+
+  if (new_suffix)
+    nslen = strlen(new_suffix);
+
+  if (P)
+    plen = strlen(P->field) + 1;
+
+  if ((new_code = (char*)_GD_Malloc(D, plen + nplen + len + nslen + mlen + 1))
+      == NULL)
+  {
+    dreturn("%p", NULL);
+    return NULL;
+  }
+
+  if (P) {
+    strcpy(new_code, P->field);
+    new_code[plen - 1] = '/';
+    strcpy(new_code + plen, ptr);
+  } else {
+    if (nplen > 0)
+      strcpy(new_code, new_prefix);
+
+    strncpy(new_code + nplen, ptr, len);
+
+    if (nslen > 0)
+      strcpy(new_code + nplen + len, new_suffix);
 
-/* Check for a valid field name -- returns input on error */
-char* _GD_ValidateField(const gd_entry_t* parent, const char* field_code,
-    int standards, int strict, int* is_dot)
+    if (slash) {
+      new_code[nplen + len + nslen] = '/';
+      strcpy(new_code + nplen + len + nslen + 1, slash);
+    }
+
+    new_code[nplen + len + nslen + mlen] = '\0';
+  }
+
+  *offset = plen;
+
+  dreturn("\"%s\" (%i)", new_code, *offset);
+  return new_code;
+}
+
+/* Munge a field code or field name using the prefix and suffix of the given
+ * fragment.  Returns a newly malloc'd munged code, or NULL on error */
+char *_GD_MungeFromFrag(DIRFILE *D, const gd_entry_t *P, int me,
+    const char *code, int *offset)
+{
+  char *new_code;
+  dtrace("%p, %p, %i, \"%s\", %p", D, P, me, code, offset);
+
+  new_code = _GD_MungeCode(D, P, NULL, NULL, D->fragment[me].prefix,
+      D->fragment[me].suffix, code, offset, 1);
+
+  dreturn("\"%s\"", new_code);
+  return new_code;
+}
+
+/* Return non-zero if the a field codes doesn't contain the correct affixes. */
+int _GD_CheckCodeAffixes(DIRFILE *D, const gd_entry_t *P,
+    const char *field_code, int fragment)
+{
+  int dummy;
+
+  dtrace("%p, %p, \"%s\", %i", D, P, field_code, fragment);
+
+  if (field_code == NULL) {
+    dreturn("%i", 0);
+    return 0;
+  }
+
+  free(_GD_MungeCode(D, P, D->fragment[fragment].prefix,
+        D->fragment[fragment].suffix, NULL, NULL, field_code, &dummy, 1));
+
+  dreturn("%i", D->error);
+  return D->error;
+}
+
+/* Check for a valid field name -- returns 1 on error */
+int _GD_ValidateField(const char* field_code, int standards, int strict,
+    int affix, int* is_dot)
 {
   const size_t len = strlen(field_code);
-  size_t i;
-  char* ptr;
+  size_t i, local_dot = 0;
 
-  dtrace("%p, \"%s\", %i, %i, %p", parent, field_code, standards, strict,
+  dtrace("\"%s\", %i, %i, %i, %p", field_code, standards, strict, affix,
       is_dot);
 
-  if (field_code[0] == '\0' || (strict && ((len > 50 && standards < 5) ||
-          (len > 16 && standards < 3))))
+  if (is_dot)
+    *is_dot = 0;
+
+  if (!affix && (field_code[0] == '\0' || (strict &&
+          ((len > 50 && standards < 5) || (len > 16 && standards < 3)))))
   {
-    dreturn("%p", field_code);
-    return (char *)field_code;
+    dreturn("%i", 1);
+    return 1;
   }
 
-  *is_dot = 0;
   for (i = 0; i < len; ++i)
-    if (field_code[i] == '/') {
-      /* fields may never contain '/', regardless of version and strictness */
-      dreturn("%p", field_code);
-      return (char *)field_code;
-    } else if (field_code[i] < 0x20) {
-      dreturn("%p", field_code);
-      return (char *)field_code;
+    if (field_code[i] == '/' || field_code[i] < 0x20) {
+      /* these characters are always forbidden */
+      dreturn("%i", 1);
+      return 1;
     } else if (strict && ((standards >= 5 && (field_code[i] == '<' ||
-            field_code[i] == '>' || field_code[i] == ';' ||
-            field_code[i] == '|' || field_code[i] == '&')) ||
-        (standards == 5 && (field_code[i] == '\\' || field_code[i] == '#'))))
+              field_code[i] == '>' || field_code[i] == ';' ||
+              field_code[i] == '|' || field_code[i] == '&')) ||
+          (standards == 5 && (field_code[i] == '\\' || field_code[i] == '#'))))
     {
-      dreturn("%p", field_code);
-      return (char *)field_code;
+      /* these characters are sometimes forbidden */
+      dreturn("%i", 1);
+      return 1;
     } else if (field_code[i] == '.') {
-      if (standards >= 6 && strict) {
-        dreturn("%p", field_code);
-        return (char *)field_code;
+      if (affix || is_dot == NULL || (standards >= 6 && strict)) {
+        dreturn("%i", 1);
+        return 1;
       } else
-        *is_dot = 1;
+        local_dot = 1;
     }
 
-  if (strict && standards < 8)
-    if ((strcmp("FRAMEOFFSET", field_code) == 0 && standards >= 1)
-        || (strcmp("ENCODING", field_code) == 0 && standards >= 6)
-        || (strcmp("ENDIAN", field_code) == 0 && standards >= 5)
-        || (strcmp("INCLUDE", field_code) == 0 && standards >= 3)
-        || (strcmp("META", field_code) == 0 && standards >= 6)
-        || (strcmp("VERSION", field_code) == 0 && standards >= 5)
-        || (strcmp("PROTECT", field_code) == 0 && standards >= 6)
-        || (strcmp("REFERENCE", field_code) == 0 && standards >= 6))
-    {
-      dreturn("%p", field_code);
-      return (char *)field_code;
-    }
+  if (!affix) {
+    if (strict && standards < 8)
+      if ((strcmp("FRAMEOFFSET", field_code) == 0 && standards >= 1)
+          || (strcmp("ENCODING", field_code) == 0 && standards >= 6)
+          || (strcmp("ENDIAN", field_code) == 0 && standards >= 5)
+          || (strcmp("INCLUDE", field_code) == 0 && standards >= 3)
+          || (strcmp("META", field_code) == 0 && standards >= 6)
+          || (strcmp("VERSION", field_code) == 0 && standards >= 5)
+          || (strcmp("PROTECT", field_code) == 0 && standards >= 6)
+          || (strcmp("REFERENCE", field_code) == 0 && standards >= 6))
+      {
+        dreturn("%i", 1);
+        return 1;
+      }
 
-  if (parent != NULL) {
-    ptr = (char *)malloc(strlen(parent->field) + strlen(field_code) + 2);
-    sprintf(ptr, "%s/%s", parent->field, field_code);
-  } else
-    ptr = strdup(field_code);
+    if (is_dot)
+      *is_dot = local_dot;
+  }
 
-  dreturn("\"%s\"", ptr);
-  return ptr;
+  dreturn("%i", 0);
+  return 0;
 }
 
-int gd_rename(DIRFILE *D, const char *old_code, const char *new_name,
-    int move_data)
+#define GD_UPDI 0x1
+#define GD_UPDU 0x2
+/* pass == 0: finalise clear
+ * pass == 1: initialise clear
+ * pass == 2: finalise update
+ * pass == 3: initialise update
+ */
+static char **_GD_UpdateScalar(DIRFILE *D, gd_entry_t *T, const gd_entry_t *E,
+    const char *old_name, char **list, size_t len, int n, int pass, int *nl)
 {
-  gd_entry_t *E, *Q;
-  char* name;
-  int new_dot, old_dot = 0;
-  unsigned int dot_ind;
+  char **ptr;
+  size_t old_len;
 
-  dtrace("%p, \"%s\", \"%s\", %i", D, old_code, new_name, move_data);
+  dtrace("%p, %p, %p, \"%s\", %p, %" PRNsize_t ", %i, %i, %i", D, T, E,
+      old_name, list, len, n, pass, *nl);
 
-  if (D->flags & GD_INVALID) {/* don't crash */
-    _GD_SetError(D, GD_E_BAD_DIRFILE, 0, NULL, 0, NULL);
-    dreturn("%i", -1);
-    return -1;
+  old_len = strlen(old_name);
+  if (strncmp(T->scalar[n], old_name, old_len) ||
+      !(T->scalar[n][old_len] == 0 || T->scalar[n][old_len] == '.'))
+  {
+    dreturn("%p (-)", list);
+    return list;
   }
 
-  /* check access mode */
-  if ((D->flags & GD_ACCMODE) == GD_RDONLY) {
-    _GD_SetError(D, GD_E_ACCMODE, 0, NULL, 0, NULL);
-    dreturn("%i", -1);
-    return -1;
+  if (pass & GD_UPDI) { /* pass 1 or 3 */
+    if ((ptr = (char**)_GD_Realloc(D, list, sizeof(char *) * (*nl + 1)))
+        == NULL)
+    {
+      *nl = -1;
+      dreturn("%p", list);
+      return list;
+    }
+    list = ptr;
+    list[(*nl)++] = (char*)_GD_Malloc(D, len + 3);
+  } else if (pass == 0) {
+    if (!T->e->calculated)
+      _GD_CalculateEntry(D, T, 0);
+  } else if (pass == 2) {
+    T->e->calculated = 0;
+    D->fragment[T->fragment_index].modified = 1;
+    free(T->scalar[n]);
+    T->scalar[n] = list[(*nl)++];
+
+    sprintf(T->scalar[n], "%s%s", E->field,
+        (T->e->repr[n] == GD_REPR_NONE) ? "" :
+        (T->e->repr[n] == GD_REPR_REAL) ? ".r" :
+        (T->e->repr[n] == GD_REPR_IMAG) ? ".i" :
+        (T->e->repr[n] == GD_REPR_MOD) ? ".m" : ".a");
   }
 
-  /* check for a dotted field name */
-  E = _GD_FindField(D, old_code, D->dot_list, D->n_dot, &dot_ind);
+  dreturn("%p (%i)", list, *nl);
+  return list;
+}
 
-  if (E)
-    old_dot = 1;
-  else
-    E = _GD_FindField(D, old_code, D->entry, D->n_entries, NULL);
+/* pass == 0: clear cached derived entries
+ * pass == 1: unused
+ * pass == 2: finalise re-writen derivd channels
+ * pass == 3: initialise re-writen derived channels
+ */
+static char **_GD_UpdateInField(DIRFILE *D, gd_entry_t *T, const gd_entry_t *E,
+    const char *old_name, char **list, size_t len, int n, int pass, int *nl)
+{
+  char **ptr;
+  int m = n;
+  dtrace("%p, %p, %p, \"%s\", %p, %" PRNsize_t ", %i, %i, %i", D, T, E,
+      old_name, list, len, n, pass, *nl);
+
+  if (T->field_type == GD_ALIAS_ENTRY)
+    m = 1;
+  else if (pass != 0 && T->e->entry[n] == NULL)
+    _GD_BadInput(D, T, n, 0);
+
+  if (E->field_type == GD_ALIAS_ENTRY) {
+    /* it's hard to detect the use of an alias other than by inspecting the
+     * name itself */
+    size_t len = strlen(old_name);
+    if (strncmp(T->in_fields[n], old_name, len) ||
+        !(T->in_fields[n][len] == 0 || T->in_fields[n][len] == '.'))
+    {
+        dreturn("%p (a-)", list);
+        return list;
+    }
+  } else if (T->e->entry[m] != E) {
+    dreturn("%p (-)", list);
+    return list;
+  }
 
-  if (E == NULL) {
-    _GD_SetError(D, GD_E_BAD_CODE, 0, NULL, 0, old_code);
-    dreturn("%i", -1);
-    return -1;
+  if (pass == 0)
+    T->e->entry[m] = NULL;
+  else if (pass == 3) {
+    if ((ptr = (char**)_GD_Realloc(D, list, sizeof(char *) * (*nl + 1)))
+        == NULL)
+    {
+      *nl = -1;
+      dreturn("%p", list);
+      return list;
+    }
+    list = ptr;
+    list[(*nl)++] = (char*)_GD_Malloc(D, len + 3);
+  } else if (pass == 2) {
+    D->fragment[T->fragment_index].modified = 1;
+    free(T->in_fields[n]);
+    T->in_fields[n] = list[(*nl)++];
+
+    sprintf(T->in_fields[n], "%s%s", E->field,
+        (T->e->repr[n] == GD_REPR_NONE) ? "" :
+        (T->e->repr[n] == GD_REPR_REAL) ? ".r" :
+        (T->e->repr[n] == GD_REPR_IMAG) ? ".i" :
+        (T->e->repr[n] == GD_REPR_MOD) ? ".m" : ".a");
   }
 
-  if (E->field_type == GD_INDEX_ENTRY) {
-    _GD_SetError(D, GD_E_BAD_FIELD_TYPE, GD_E_FIELD_BAD, NULL, 0, "INDEX");
+  dreturn("%p (%i)", list, *nl);
+  return list;
+}
+
+static char **_GD_InvalidateConst(DIRFILE *D, const gd_entry_t *E,
+    const char *old_name, char **list, size_t len, int pass, int *nl)
+{
+  int i;
+  unsigned u;
+
+  dtrace("%p, %p, \"%s\", %p, %" PRNsize_t ", %i, %p", D, E, old_name, list,
+      len, pass, nl);
+
+  /* aliases prevent us from just running over this field's client list */
+  for (u = 0; u < D->n_entries; ++u)
+    if (D->entry[u] != E) {
+      switch (D->entry[u]->field_type) {
+        case GD_LINCOM_ENTRY:
+          for (i = 0; i < D->entry[u]->EN(lincom,n_fields); ++i) {
+            list = _GD_UpdateScalar(D, D->entry[u], E, old_name, list, len, i,
+                pass, nl);
+            list = _GD_UpdateScalar(D, D->entry[u], E, old_name, list, len,
+                i + GD_MAX_LINCOM, pass, nl);
+          }
+          break;
+        case GD_POLYNOM_ENTRY:
+          for (i = 0; i <= D->entry[u]->EN(polynom,poly_ord); ++i)
+            list = _GD_UpdateScalar(D, D->entry[u], E, old_name, list, len, i,
+                pass, nl);
+          break;
+        case GD_BIT_ENTRY:
+        case GD_SBIT_ENTRY:
+        case GD_MPLEX_ENTRY:
+          list = _GD_UpdateScalar(D, D->entry[u], E, old_name, list, len, 1,
+              pass, nl);
+          /* Fallthrough */
+        case GD_PHASE_ENTRY:
+        case GD_RAW_ENTRY:
+        case GD_RECIP_ENTRY:
+        case GD_WINDOW_ENTRY:
+          list = _GD_UpdateScalar(D, D->entry[u], E, old_name, list, len, 0,
+              pass, nl);
+          break;
+        case GD_ALIAS_ENTRY:
+          list = _GD_UpdateInField(D, D->entry[u], E, old_name, list, len, 0,
+              pass, nl);
+          break;
+        case GD_NO_ENTRY:
+        case GD_LINTERP_ENTRY:
+        case GD_MULTIPLY_ENTRY:
+        case GD_DIVIDE_ENTRY:
+        case GD_INDEX_ENTRY:
+        case GD_STRING_ENTRY:
+        case GD_CONST_ENTRY:
+        case GD_CARRAY_ENTRY:
+          break;
+      }
+    }
+
+  dreturn("%p", list);
+  return list;
+}
+
+static char **_GD_InvalidateVect(DIRFILE *D, const gd_entry_t *E,
+    const char *old_name, char **list, size_t len, int pass, int *nl)
+{
+  unsigned u;
+
+  dtrace("%p, %p, %p, %" PRNsize_t ", %i, %p", D, E, list, len, pass, nl);
+
+  for (u = 0; u < D->n_entries; ++u) {
+    if (D->entry[u] != E)
+      switch (D->entry[u]->field_type) {
+        case GD_LINCOM_ENTRY:
+          list = _GD_UpdateInField(D, D->entry[u], E, old_name, list, len, 2,
+              pass, nl);
+          /* Fallthrough */
+        case GD_MULTIPLY_ENTRY:
+        case GD_DIVIDE_ENTRY:
+        case GD_WINDOW_ENTRY:
+        case GD_MPLEX_ENTRY:
+          list = _GD_UpdateInField(D, D->entry[u], E, old_name, list, len, 1,
+              pass, nl);
+          /* Fallthrough */
+        case GD_ALIAS_ENTRY:
+        case GD_LINTERP_ENTRY:
+        case GD_BIT_ENTRY:
+        case GD_PHASE_ENTRY:
+        case GD_POLYNOM_ENTRY:
+        case GD_RECIP_ENTRY:
+        case GD_SBIT_ENTRY:
+          list = _GD_UpdateInField(D, D->entry[u], E, old_name, list, len, 0,
+              pass, nl);
+          break;
+        case GD_INDEX_ENTRY:
+        case GD_RAW_ENTRY:
+        case GD_NO_ENTRY:
+        case GD_CONST_ENTRY:
+        case GD_CARRAY_ENTRY:
+        case GD_STRING_ENTRY:
+          break;
+      }
+    if (*nl == -1)
+      break;
+  }
+
+  dreturn("%p", list);
+  return list;
+}
+
+static int _GD_Rename(DIRFILE *D, gd_entry_t *E, const char *new_name,
+    int old_dot, unsigned dot_ind, unsigned flags)
+{
+  gd_entry_t *Q;
+  char *name;
+  int dummy, new_dot;
+
+  dtrace("%p, %p, \"%s\", %i, %u, 0x%X", D, E, new_name, old_dot, dot_ind,
+      flags);
+
+  /* check access mode */
+  if ((D->flags & GD_ACCMODE) == GD_RDONLY) {
+    _GD_SetError(D, GD_E_ACCMODE, 0, NULL, 0, NULL);
     dreturn("%i", -1);
     return -1;
   }
@@ -143,21 +468,43 @@ int gd_rename(DIRFILE *D, const char *old_code, const char *new_name,
     return -1;
   }
 
-  name = _GD_ValidateField(E->e->p.parent, new_name, D->standards, 1, &new_dot);
-  if (name == new_name) {
-    _GD_SetError(D, GD_E_BAD_CODE, 0, NULL, 0, new_name);
+  if (_GD_ValidateField(new_name, D->standards, 1, 0, &new_dot)) {
+    _GD_SetError(D, GD_E_BAD_CODE, GD_E_CODE_INVALID, NULL, 0, new_name);
     dreturn("%i", -1);
     return -1;
-  } else if (name == NULL) {
-    _GD_SetError(D, GD_E_ALLOC, 0, NULL, 0, NULL);
+  }
+
+  if (E->e->n_meta == -1) {
+    name = (char*)_GD_Malloc(D, strlen(E->e->p.parent->field) + strlen(new_name)
+        + 2);
+    if (name == NULL) {
+      dreturn("%i", -1);
+      return -1;
+    }      
+    sprintf(name, "%s/%s", E->e->p.parent->field, new_name);
+  } else {
+    /* Verify prefix and suffix */
+    name = _GD_MungeCode(D, NULL, D->fragment[E->fragment_index].prefix,
+        D->fragment[E->fragment_index].suffix, NULL, NULL, new_name, &dummy, 1);
+    if (name == NULL || name[0] == '\0') {
+      _GD_SetError(D, GD_E_BAD_CODE, GD_E_CODE_INVALID, NULL, 0, new_name);
+      dreturn("%i", -1);
+      return -1;
+    }
+    free(name);
+    name = _GD_Strdup(D, new_name);
+  }
+
+  if (D->error) {
     dreturn("%i", -1);
     return -1;
   }
 
   /* Duplicate check */
-  Q = _GD_FindField(D, name, D->entry, D->n_entries, NULL);
+  Q = _GD_FindField(D, name, D->entry, D->n_entries, 1, NULL);
 
   if (Q == E) {
+    free(name);
     dreturn("%i", 0);
     return 0;
   }
@@ -171,24 +518,16 @@ int gd_rename(DIRFILE *D, const char *old_code, const char *new_name,
 
   if (E->field_type == GD_RAW_ENTRY) {
     /* Compose the new filename */
-    char* filebase = (char *)malloc(FILENAME_MAX);
+    char *filebase = _GD_Strdup(D, new_name);
 
     if (filebase == NULL) {
-      _GD_SetError(D, GD_E_ALLOC, 0, NULL, 0, NULL);
       free(name);
       dreturn("%i", -1);
       return -1;
     }
 
-    snprintf(filebase, FILENAME_MAX, "%s/%s",
-        D->fragment[E->fragment_index].sname ?
-        D->fragment[E->fragment_index].sname : D->name, new_name);
-
     /* Close the old file */
-    if (E->e->u.raw.file->fp != -1 &&
-        (*_gd_ef[E->e->u.raw.file[0].encoding].close)(E->e->u.raw.file))
-    {
-      _GD_SetError(D, GD_E_RAW_IO, 0, E->e->u.raw.file[0].name, errno, NULL);
+    if (_GD_FiniRawIO(D, E, E->fragment_index, GD_FINIRAW_KEEP)) {
       free(name);
       free(filebase);
       dreturn("%i", -1);
@@ -197,11 +536,10 @@ int gd_rename(DIRFILE *D, const char *old_code, const char *new_name,
 
     /* Resize the dot list; this must be done early in case it fails */
     if (new_dot && !old_dot) {
-      gd_entry_t** ptr = (gd_entry_t **)realloc(D->dot_list,
+      gd_entry_t** ptr = (gd_entry_t **)_GD_Realloc(D, D->dot_list,
           sizeof(gd_entry_t*) * (D->n_dot + 1));
 
       if (ptr == NULL) {
-        _GD_SetError(D, GD_E_ALLOC, 0, NULL, 0, NULL);
         free(name);
         dreturn("%i", -1);
         return -1;
@@ -210,8 +548,8 @@ int gd_rename(DIRFILE *D, const char *old_code, const char *new_name,
       D->dot_list = ptr;
     }
 
-    if (move_data) {
-      struct _gd_raw_file temp;
+    if (flags & GD_REN_DATA) {
+      struct gd_raw_file_ temp;
 
       /* check data protection */
       if (D->fragment[E->fragment_index].protection & GD_PROTECT_DATA) {
@@ -223,31 +561,38 @@ int gd_rename(DIRFILE *D, const char *old_code, const char *new_name,
         return -1;
       }
 
-      if (!_GD_Supports(D, E, GD_EF_MOVE)) {
+      if (!_GD_Supports(D, E, GD_EF_NAME | GD_EF_MOVE)) {
         free(name);
         free(filebase);
         dreturn("%i", -1);
         return -1;
       }
 
-      memcpy(&temp, E->e->u.raw.file, sizeof(struct _gd_raw_file));
+      memcpy(&temp, E->e->u.raw.file, sizeof(struct gd_raw_file_));
       temp.name = NULL;
-      if (_GD_SetEncodedName(D, &temp, filebase, 0)) {
+      if ((*gd_ef_[temp.subenc].name)(D,
+            (const char*)D->fragment[E->fragment_index].enc_data, &temp,
+            filebase, 0, 0))
+      {
         free(name);
         free(filebase);
         dreturn("%i", -1);
         return -1;
       }
 
-      if (_GD_SetEncodedName(D, E->e->u.raw.file, E->e->u.raw.filebase, 0)) {
+      if ((*gd_ef_[temp.subenc].name)(D,
+            (const char*)D->fragment[E->fragment_index].enc_data,
+            E->e->u.raw.file, E->e->u.raw.filebase, 0, 0))
+      {
         free(name);
         free(filebase);
         dreturn("%i", -1);
         return -1;
       }
 
-      if ((*_gd_ef[E->e->u.raw.file[0].encoding].move)(E->e->u.raw.file,
-            temp.name))
+      if ((*gd_ef_[E->e->u.raw.file[0].subenc].move)(
+            D->fragment[E->fragment_index].dirfd, E->e->u.raw.file,
+            D->fragment[E->fragment_index].dirfd, temp.name))
       {
         _GD_SetError(D, GD_E_RAW_IO, 0, E->e->u.raw.file[0].name, errno, NULL);
         free(filebase);
@@ -269,6 +614,8 @@ int gd_rename(DIRFILE *D, const char *old_code, const char *new_name,
   free(E->field);
   E->field = name;
 
+  D->fragment[E->fragment_index].modified = 1;
+
   /* Update the dot list */
   if (old_dot && !new_dot)
     memmove(D->dot_list + dot_ind, D->dot_list + dot_ind + 1,
@@ -277,14 +624,114 @@ int gd_rename(DIRFILE *D, const char *old_code, const char *new_name,
     D->dot_list[D->n_dot++] = E;
 
   /* re-sort the lists */
-  qsort(D->entry, D->n_entries, sizeof(gd_entry_t*), entry_cmp);
+  qsort(D->entry, D->n_entries, sizeof(gd_entry_t*), _GD_EntryCmp);
   if (new_dot)
-    qsort(D->dot_list, D->n_dot, sizeof(gd_entry_t*), entry_cmp);
+    qsort(D->dot_list, D->n_dot, sizeof(gd_entry_t*), _GD_EntryCmp);
 
   /* Invalidate the field lists */
-  D->list_validity = 0;
-  D->type_list_validity = 0;
+  if (E->e->n_meta == -1) {
+    E->e->p.parent->e->value_list_validity = 0;
+    E->e->p.parent->e->entry_list_validity = 0;
+  } else {
+    D->value_list_validity = 0;
+    D->entry_list_validity = 0;
+  }
 
   dreturn("%i", 0);
   return 0;
 }
+
+int gd_rename(DIRFILE *D, const char *old_code, const char *new_name,
+    unsigned flags)
+{
+  gd_entry_t *E = NULL;
+  int ret, i, nl = 0, old_dot = 0;
+  size_t len;
+  gd_entype_t type;
+  unsigned dot_ind = 0;
+  char **code_list = NULL;
+
+  dtrace("%p, \"%s\", \"%s\", 0x%X", D, old_code, new_name, flags);
+
+  if (D->flags & GD_INVALID) {
+    _GD_SetError(D, GD_E_BAD_DIRFILE, 0, NULL, 0, NULL);
+    dreturn("%i", -1);
+    return -1;
+  }
+
+  _GD_ClearError(D);
+
+  len = strlen(new_name);
+
+  /* check for a dotted field name */
+  if (D->n_dot > 0)
+    E = _GD_FindField(D, old_code, D->dot_list, D->n_dot, 0, &dot_ind);
+
+  if (E)
+    old_dot = 1;
+  else
+    E = _GD_FindField(D, old_code, D->entry, D->n_entries, 0, NULL);
+
+  if (E == NULL) {
+    _GD_SetError(D, GD_E_BAD_CODE, GD_E_CODE_MISSING, NULL, 0, old_code);
+    dreturn("%i", -1);
+    return -1;
+  }
+
+  type = E->field_type;
+
+  if (type == GD_INDEX_ENTRY) {
+    _GD_SetError(D, GD_E_BAD_FIELD_TYPE, GD_E_FIELD_BAD, NULL, 0, "INDEX");
+    dreturn("%i", -1);
+    return -1;
+  }
+
+  /* resolve field type */
+  if (type == GD_ALIAS_ENTRY && E->e->entry[0])
+    type = E->e->entry[0]->field_type;
+
+  /* check derived/client fields */
+  if (type == GD_CARRAY_ENTRY || type == GD_CONST_ENTRY)
+    code_list = _GD_InvalidateConst(D, E, old_code, code_list, len,
+        GD_UPDI | (flags & GD_REN_UPDB ? GD_UPDU : 0), &nl);
+  else if (type != GD_STRING_ENTRY)
+    if (flags & GD_REN_UPDB)
+      code_list = _GD_InvalidateVect(D, E, old_code, code_list, len,
+          GD_UPDI | GD_UPDU, &nl);
+
+  if (D->error) {
+    if (code_list) {
+      for (i = 0; i < nl; ++i)
+        free(code_list[i]);
+      free(code_list);
+    }
+    dreturn("%i", -1);
+    return -1;
+  }
+
+  ret = _GD_Rename(D, E, new_name, old_dot, dot_ind, flags);
+
+  if (!ret) {
+    nl = 0;
+    /* update derived/client fields */
+    if (type == GD_CARRAY_ENTRY || type == GD_CONST_ENTRY)
+      _GD_InvalidateConst(D, E, old_code, code_list, 0,
+          flags & GD_REN_UPDB ? GD_UPDU : 0, &nl);
+    else if (type != GD_STRING_ENTRY)
+      _GD_InvalidateVect(D, E, old_code, code_list, 0,
+          flags & GD_REN_UPDB ? GD_UPDU : 0, &nl);
+  }
+
+  /* rehash the aliases */
+  _GD_UpdateAliases(D, 1);
+
+  if (code_list) {
+    if (D->error)
+      for (i = 0; i < nl; ++i)
+        free(code_list[i]);
+    free(code_list);
+  }
+
+  dreturn("%i", ret);
+  return ret;
+}
diff --git a/src/nan.h b/src/nan.h
index 1993b71..d9da387 100644
--- a/src/nan.h
+++ b/src/nan.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 2010 D. V. Wiebe
+/* Copyright (C) 2010, 2012 D. V. Wiebe
  *
  ***************************************************************************
  *
@@ -27,7 +27,7 @@
 # if HAVE_NAN
 #  define NAN nan("")
 # else
-#  define NAN strtod("NAN", NULL)
+#  define NAN gd_strtod("NAN", NULL)
 # endif
 #endif
 
diff --git a/src/native.c b/src/native.c
index c074569..028e50a 100644
--- a/src/native.c
+++ b/src/native.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2009-2010 D. V. Wiebe
+/* Copyright (C) 2009-2012 D. V. Wiebe
  *
  ***************************************************************************
  *
@@ -19,9 +19,8 @@
  * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
 #include "internal.h"
-#include <stdlib.h>
 
-gd_type_t _GD_NativeType(DIRFILE* D, gd_entry_t* E, int repr)
+gd_type_t _GD_NativeType(DIRFILE *restrict D, gd_entry_t *restrict E, int repr)
 {
   gd_type_t type = GD_UNKNOWN;
   int i;
@@ -29,7 +28,7 @@ gd_type_t _GD_NativeType(DIRFILE* D, gd_entry_t* E, int repr)
   dtrace("%p, %p, %i", D, E, repr);
 
   if (++D->recurse_level >= GD_MAX_RECURSE_LEVEL) {
-    _GD_SetError(D, GD_E_RECURSE_LEVEL, 0, NULL, 0, E->field);
+    _GD_SetError(D, GD_E_RECURSE_LEVEL, GD_E_RECURSE_CODE, NULL, 0, E->field);
     D->recurse_level--;
     dreturn("%u", type);
     return type;
@@ -41,7 +40,7 @@ gd_type_t _GD_NativeType(DIRFILE* D, gd_entry_t* E, int repr)
       break;
     case GD_LINCOM_ENTRY:
       if (!E->e->calculated)
-        _GD_CalculateEntry(D, E);
+        _GD_CalculateEntry(D, E, 1);
 
       if (E->comp_scal) {
         type = GD_COMPLEX128;
@@ -49,7 +48,7 @@ gd_type_t _GD_NativeType(DIRFILE* D, gd_entry_t* E, int repr)
       }
 
       for (i = 0; i < E->EN(lincom,n_fields); ++i) {
-        if (_GD_BadInput(D, E, i))
+        if (_GD_BadInput(D, E, i, 1))
           break;
 
         if (_GD_NativeType(D, E->e->entry[i], E->e->repr[i]) & GD_COMPLEX) {
@@ -71,7 +70,7 @@ gd_type_t _GD_NativeType(DIRFILE* D, gd_entry_t* E, int repr)
       break;
     case GD_MULTIPLY_ENTRY:
     case GD_DIVIDE_ENTRY:
-      if (_GD_BadInput(D, E, 0) || _GD_BadInput(D, E, 1))
+      if (_GD_BadInput(D, E, 0, 1) || _GD_BadInput(D, E, 1, 1))
         break;
 
       type = (_GD_NativeType(D, E->e->entry[0], E->e->repr[0]) & GD_COMPLEX
@@ -79,7 +78,7 @@ gd_type_t _GD_NativeType(DIRFILE* D, gd_entry_t* E, int repr)
         ? GD_COMPLEX128 : GD_FLOAT64;
       break;
     case GD_RECIP_ENTRY:
-      if (_GD_BadInput(D, E, 0))
+      if (_GD_BadInput(D, E, 0, 1))
         break;
 
       type = ((_GD_NativeType(D, E->e->entry[0], E->e->repr[0]) & GD_COMPLEX)
@@ -90,21 +89,23 @@ gd_type_t _GD_NativeType(DIRFILE* D, gd_entry_t* E, int repr)
       type = GD_UINT64;
       break;
     case GD_PHASE_ENTRY:
-      if (_GD_BadInput(D, E, 0))
+    case GD_WINDOW_ENTRY:
+    case GD_MPLEX_ENTRY:
+      if (_GD_BadInput(D, E, 0, 1))
         break;
 
       type = _GD_NativeType(D, E->e->entry[0], E->e->repr[0]);
       break;
     case GD_POLYNOM_ENTRY:
       if (!E->e->calculated)
-        _GD_CalculateEntry(D, E);
+        _GD_CalculateEntry(D, E, 1);
 
       if (E->comp_scal) {
         type = GD_COMPLEX128;
         break;
       }
 
-      if (_GD_BadInput(D, E, 0))
+      if (_GD_BadInput(D, E, 0, 1))
         break;
 
       type = (_GD_NativeType(D, E->e->entry[0], E->e->repr[0]) & GD_COMPLEX) ?
@@ -122,6 +123,7 @@ gd_type_t _GD_NativeType(DIRFILE* D, gd_entry_t* E, int repr)
       type = GD_NULL;
       break;
     case GD_NO_ENTRY:
+    case GD_ALIAS_ENTRY:
       _GD_InternalError(D);
   }
 
@@ -160,7 +162,8 @@ gd_type_t gd_native_type(DIRFILE* D, const char* field_code_in) gd_nothrow
 
   _GD_ClearError(D);
 
-  entry = _GD_FindFieldAndRepr(D, field_code_in, &field_code, &repr, NULL, 1);
+  entry = _GD_FindFieldAndRepr(D, field_code_in, &field_code, &repr, NULL, 1,
+      1);
 
   if (D->error) {
     dreturn("0x%x", GD_UNKNOWN);
diff --git a/src/nfields.c b/src/nfields.c
index efafba2..0b35eae 100644
--- a/src/nfields.c
+++ b/src/nfields.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2010 D. V. Wiebe
+/* Copyright (C) 2012 D. V. Wiebe
  *
  ***************************************************************************
  *
@@ -20,25 +20,47 @@
  */
 #include "internal.h"
 
-unsigned int gd_nfields(DIRFILE* D) gd_nothrow
+unsigned int _GD_NEntries(DIRFILE *D, struct gd_private_entry_ *p, int type,
+    unsigned int flags)
 {
-  dtrace("%p", D);
+  int i;
+  unsigned int u, n = 0;
+  const int special = (type & GD_SPECIAL_ENTRY_BIT) ? type : 0;
+  const gd_entype_t ctype = (type & GD_SPECIAL_ENTRY_BIT) ? GD_NO_ENTRY :
+    (gd_entype_t)type;
+  const int hidden = (flags & GD_ENTRIES_HIDDEN);
+  const int noalias = (flags & GD_ENTRIES_NOALIAS);
+  dtrace("%p, %p, 0x%X, 0x%X", D, p, type, flags);
 
-  if (D->flags & GD_INVALID) {
-    _GD_SetError(D, GD_E_BAD_DIRFILE, 0, NULL, 0, NULL);
+  /* check for invalid type */
+  if (ctype && _GD_InvalidEntype(ctype)) {
+    _GD_SetError(D, GD_E_BAD_ENTRY, GD_E_ENTRY_TYPE, NULL, type, NULL);
     dreturn("%u", 0);
     return 0;
   }
 
-  _GD_ClearError(D);
+  if (p) {
+    for (i = 0; i < p->n_meta; ++i)
+      if (_GD_ListEntry(p->p.meta_entry[i], 1, hidden, noalias, special,
+            ctype))
+        n++;
+  } else {
+    for (u = 0; u < D->n_entries; ++u)
+      if (_GD_ListEntry(D->entry[u], 0, hidden, noalias, special, ctype))
+        n++;
+  }
 
-  dreturn("%u", D->n_entries - D->n_meta);
-  return D->n_entries - D->n_meta;
+  dreturn("%u", n);
+  return n;
 }
 
-unsigned int gd_nvectors(DIRFILE* D) gd_nothrow
+unsigned int gd_nentries(DIRFILE *D, const char *parent, int type,
+    unsigned int flags) gd_nothrow
 {
-  dtrace("%p", D);
+  unsigned int n;
+  struct gd_private_entry_ *p = NULL;
+
+  dtrace("%p, \"%s\", 0x%X, 0x%X", D, parent, type, flags);
 
   if (D->flags & GD_INVALID) {
     _GD_SetError(D, GD_E_BAD_DIRFILE, 0, NULL, 0, NULL);
@@ -46,50 +68,82 @@ unsigned int gd_nvectors(DIRFILE* D) gd_nothrow
     return 0;
   }
 
+  if (parent) {
+    gd_entry_t *P = _GD_FindField(D, parent, D->entry, D->n_entries, 1, NULL);
+
+    if (P == NULL || P->e->n_meta == -1) {
+      _GD_SetError(D, GD_E_BAD_CODE, P ? GD_E_CODE_INVALID : GD_E_CODE_MISSING,
+          NULL, 0, parent);
+      dreturn("%u", 0);
+      return 0;
+    }
+    p = P->e;
+  }
+
   _GD_ClearError(D);
 
-  dreturn("%u", D->n_entries - D->n_meta - D->n_string - D->n_const -
-      D->n_carray);
-  return D->n_entries - D->n_meta - D->n_string - D->n_const - D->n_carray;
+  n = _GD_NEntries(D, p, type, flags);
+  dreturn("%u", n);
+  return n;
+}
+
+unsigned int gd_nfields(DIRFILE* D) gd_nothrow
+{
+  unsigned int n;
+  dtrace("%p", D);
+
+  n = gd_nentries(D, NULL, 0, 0);
+  dreturn("%u", n);
+  return n;
+}
+
+unsigned int gd_nvectors(DIRFILE* D) gd_nothrow
+{
+  unsigned int n;
+  dtrace("%p", D);
+
+  n = gd_nentries(D, NULL, GD_VECTOR_ENTRIES, 0);
+  dreturn("%u", n);
+  return n;
 }
 
 unsigned int gd_nfields_by_type(DIRFILE* D, gd_entype_t type) gd_nothrow
 {
-  unsigned int i, r = 0;
+  unsigned int n;
+  dtrace("%p, 0x%X", D, type);
 
-  dtrace("%p, %i", D, type);
+  n = gd_nentries(D, NULL, type, 0);
+  dreturn("%u", n);
+  return n;
+}
 
-  if (D->flags & GD_INVALID) {
-    _GD_SetError(D, GD_E_BAD_DIRFILE, 0, NULL, 0, NULL);
-    dreturn("%u", 0);
-    return 0;
-  }
+unsigned int gd_nmfields(DIRFILE* D, const char* parent) gd_nothrow
+{
+  unsigned int n;
+  dtrace("%p, \"%s\"", D, parent);
 
-  _GD_ClearError(D);
+  n = gd_nentries(D, parent, 0, 0);
+  dreturn("%u", n);
+  return n;
+}
 
-  switch(type) {
-    case GD_STRING_ENTRY:
-      r = D->n_string;
-      break;
-    case GD_CONST_ENTRY:
-      r = D->n_const;
-      break;
-    case GD_CARRAY_ENTRY:
-      r = D->n_carray;
-      break;
-    case GD_INDEX_ENTRY:
-      r = 1;
-      break;
-    case GD_NO_ENTRY:
-      _GD_SetError(D, GD_E_BAD_ENTRY, GD_E_BAD_ENTRY_TYPE, NULL, type, NULL);
-      break;
-    default:
-      for (i = 0; i < D->n_entries; ++i)
-        if (D->entry[i]->field_type == type && D->entry[i]->e->n_meta != -1)
-          r++;
-      break;
-  }
+unsigned int gd_nmvectors(DIRFILE* D, const char* parent) gd_nothrow
+{
+  unsigned int n;
+  dtrace("%p, \"%s\"", D, parent);
+
+  n = gd_nentries(D, parent, GD_VECTOR_ENTRIES, 0);
+  dreturn("%u", n);
+  return n;
+}
+
+unsigned int gd_nmfields_by_type(DIRFILE* D, const char* parent,
+    gd_entype_t type) gd_nothrow
+{
+  unsigned int n;
+  dtrace("%p, \"%s\", %i", D, parent, type);
 
-  dreturn("%u", r);
-  return r;
+  n = gd_nentries(D, parent, type, 0);
+  dreturn("%u", n);
+  return n;
 }
diff --git a/src/nframes.c b/src/nframes.c
index 2542624..d88d564 100644
--- a/src/nframes.c
+++ b/src/nframes.c
@@ -1,5 +1,5 @@
 /* Copyright (C) 2002-2005 C. Barth Netterfield
- * Copyright (C) 2005-2010 D. V. Wiebe
+ * Copyright (C) 2005-2011 D. V. Wiebe
  *
  ***************************************************************************
  *
@@ -22,10 +22,6 @@
 #include "internal.h"
 #undef gd_nframes64
 
-#ifdef STDC_HEADERS
-#include <errno.h>
-#endif
-
 off64_t gd_nframes64(DIRFILE* D)
 {
   off64_t nf;
@@ -45,21 +41,25 @@ off64_t gd_nframes64(DIRFILE* D)
     return 0;
   }
 
-  if (!_GD_Supports(D, D->reference_field, GD_EF_SIZE)) {
+  if (!_GD_Supports(D, D->reference_field, GD_EF_NAME | GD_EF_SIZE)) {
     dreturn("%i", 0);
     return 0;
   }
 
-  if (_GD_SetEncodedName(D, D->reference_field->e->u.raw.file,
-        D->reference_field->e->u.raw.filebase, 0))
+  if ((*gd_ef_[D->reference_field->e->u.raw.file[0].subenc].name)(D,
+        (const char*)D->fragment[D->reference_field->fragment_index].enc_data,
+        D->reference_field->e->u.raw.file,
+        D->reference_field->e->u.raw.filebase, 0, 0))
   {
     dreturn("%i", 0);
     return 0;
   }
 
-  nf = (*_gd_ef[D->reference_field->e->u.raw.file[0].encoding].size)(
+  nf = (*gd_ef_[D->reference_field->e->u.raw.file[0].subenc].size)(
+      D->fragment[D->reference_field->fragment_index].dirfd,
       D->reference_field->e->u.raw.file,
-      D->reference_field->EN(raw,data_type));
+      D->reference_field->EN(raw,data_type), _GD_FileSwapBytes(D,
+        D->reference_field->fragment_index));
 
   if (nf < 0) {
     _GD_SetError(D, GD_E_RAW_IO, 0, D->reference_field->e->u.raw.file[0].name,
diff --git a/src/open.c b/src/open.c
index 3a7b6c4..e764a52 100644
--- a/src/open.c
+++ b/src/open.c
@@ -1,5 +1,5 @@
 /* Copyright (C) 2002-2005 C. Barth Netterfield
- * Copyright (C) 2005-2010 D. V. Wiebe
+ * Copyright (C) 2005-2012 D. V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,55 +21,229 @@
  */
 #include "internal.h"
 
-#ifdef STDC_HEADERS
-#include <ctype.h>
-#include <math.h>
-#include <errno.h>
-#include <stdlib.h>
-#include <string.h>
-#include <sys/stat.h>
-#include <sys/types.h>
+/* crawl the directory, and delete everything */
+static int _GD_TruncDir(DIRFILE *D, int dirfd, const char *dirfile, int root)
+{
+  int ret, format_trunc = 0;
+  DIR* dir;
+  struct dirent *lamb, *result;
+  struct stat statbuf;
+  size_t dirent_len = offsetof(struct dirent, d_name);
+  size_t dirfile_len = strlen(dirfile);
+
+  dtrace("%p, %i, \"%s\", %i", D, dirfd, dirfile, root);
+
+#if defined(HAVE_FDOPENDIR) && !defined(GD_NO_DIR_OPEN)
+  {
+    int fd = dirfd;
+    /* only need to duplicate the fd of the root directory; otherwise this
+     * function will close the fd */
+    if (root && (fd = dup(dirfd)) == -1) {
+      _GD_SetError(D, GD_E_TRUNC, GD_E_TRUNC_DIR, dirfile, errno, NULL);
+      dreturn("%i", -1);
+      return -1;
+    }
+    dir = fdopendir(fd);
+
+#ifdef HAVE_FPATHCONF
+    dirent_len += fpathconf(fd, _PC_NAME_MAX) + 1;
+#elif defined HAVE_PATHCONF
+    dirent_len += pathconf(dirfile, _PC_NAME_MAX) + 1;
+#else
+    dirent_len += FILENAME_MAX;
+#endif
+  }
+
+#else
+  dir = opendir(dirfile);
+
+#ifdef HAVE_PATHCONF
+  dirent_len += pathconf(dirfile, _PC_NAME_MAX) + 1;
+#else
+  dirent_len += FILENAME_MAX;
+#endif
+
+#endif
+
+  if (dir == NULL) {
+    _GD_SetError(D, GD_E_TRUNC, GD_E_TRUNC_DIR, dirfile, errno, NULL);
+    dreturn("%i", -1);
+    return -1;
+  }
+
+  if ((lamb = (struct dirent*)_GD_Malloc(D, dirent_len)) == NULL) {
+    closedir(dir);
+    dreturn("%i", -1);
+    return -1;
+  }
+
+  ret = _GD_ReadDir(dir, lamb, &result);
+  for (; result; ret = _GD_ReadDir(dir, lamb, &result)) {
+    char *name;
+    if (lamb->d_name[0] == '.' && lamb->d_name[1] == '\0')
+      continue; /* skip current dir */
+    else if (lamb->d_name[0] == '.' && lamb->d_name[1] == '.' &&
+        lamb->d_name[2] == '\0')
+    {
+      continue; /* skip parent dir */
+    }
+
+    name = (char *)_GD_Malloc(D, dirfile_len + strlen(lamb->d_name) + 2);
+    if (name == NULL) {
+      free(lamb);
+      closedir(dir);
+      dreturn("%i", -1);
+      return -1;
+    }
+    sprintf(name, "%s%c%s", dirfile, GD_DIRSEP, lamb->d_name);
+    if (
+#if defined(HAVE_FSTATAT) && !defined(GD_NO_DIR_OPEN)
+        fstatat(dirfd, lamb->d_name, &statbuf, AT_SYMLINK_NOFOLLOW)
+#elif HAVE_LSTAT
+        lstat(name, &statbuf)
+#else
+        stat(name, &statbuf)
 #endif
+       )
+    {
+      _GD_SetError(D, GD_E_TRUNC, GD_E_TRUNC_STAT, name, errno, NULL);
+      free(name);
+      closedir(dir);
+      dreturn("%i", -1);
+      return -1;
+    }
 
-#ifdef HAVE_DIRENT_H
-#include <dirent.h>
+    /* check file type */
+    switch (statbuf.st_mode & S_IFMT) {
+      case S_IFREG:
+#ifdef S_IFBLK
+      case S_IFBLK:
+#endif
+#ifdef S_IFIFO
+      case S_IFIFO:
+#endif
+#ifdef S_IFCHR
+      case S_IFCHR:
+#endif
+#ifdef S_IFLNK
+      case S_IFLNK:
+#endif
+        if (root && strcmp(lamb->d_name, "format") == 0) {
+          /* don't delete the format file; we'll truncate it later */
+          format_trunc = 1;
+        } else if (
+#ifdef HAVE_UNLINKAT
+            unlinkat(dirfd, lamb->d_name, 0)
+#else
+            unlink(name)
+#endif
+            )
+        {
+          _GD_SetError(D, GD_E_TRUNC, GD_E_TRUNC_UNLINK, name, errno, NULL);
+          free(lamb);
+          free(name);
+          closedir(dir);
+          dreturn("%i", -1);
+          return -1;
+        }
+        break;
+      case S_IFDIR:
+        /* descend into subdir if requested */
+        if (D->flags & GD_TRUNCSUB) {
+          int subdirfd;
+#ifdef GD_NO_DIR_OPEN
+          subdirfd = 0; /* unused */
+#else
+          if ((
+#ifdef HAVE_OPENAT
+                subdirfd = openat(dirfd, lamb->d_name, O_RDONLY)
+#else
+                subdirfd = open(name, O_RDONLY)
 #endif
+              ) < 0)
+          {
+            _GD_SetError(D, GD_E_TRUNC, GD_E_TRUNC_STAT, name, errno, NULL);
+            free(lamb);
+            closedir(dir);
+            free(name);
+            dreturn("%i", -1);
+            return -1;
+          }
+#endif
+          /* descend -- this will close subdirfd */
+          _GD_TruncDir(D, subdirfd, name, 0);
 
-#ifdef HAVE_LIBGEN_H
-#include <libgen.h>
+          /* delete */
+          if (
+#ifdef HAVE_UNLINKAT
+              unlinkat(dirfd, lamb->d_name, AT_REMOVEDIR)
+#else
+              rmdir(name)
 #endif
+             ) {
+            _GD_SetError(D, GD_E_TRUNC, GD_E_TRUNC_UNLINK, name, errno, NULL);
+            free(lamb);
+            free(name);
+            closedir(dir);
+            dreturn("%i", -1);
+            return -1;
+          }
+        }
+    }
+    free(name);
+  }
+  free(lamb);
+
+  closedir(dir);
+
+  if (ret) {
+    _GD_SetError(D, GD_E_TRUNC, GD_E_TRUNC_DIR, dirfile, errno, NULL);
+    dreturn("%i", -1);
+    return -1;
+  }
+
+  dreturn("%i", format_trunc);
+  return format_trunc;
+}
 
 /* attempt to open or create a new dirfile - set error appropriately */
-static FILE* _GD_CreateDirfile(DIRFILE* D, const char* format_file,
-    const char* filedir)
+static FILE *_GD_CreateDirfile(DIRFILE *restrict D, int dirfd, int dir_error,
+    char *restrict dirfile, time_t *mtime)
 {
   struct stat statbuf;
-  char fullname[FILENAME_MAX];
-  DIR* dir;
-  char* dirfile_end;
-  struct dirent* lamb;
-  int dir_error = 0;
-  int format_error = 0;
+  int fd = -1;
+  int format_error = 0, format_trunc = 0;
   FILE* fp = NULL;
 
-  dtrace("%p, \"%s\", \"%s\"", D, format_file, filedir);
+  dtrace("%p, %i, %i, \"%s\", %p", D, dirfd, dir_error, dirfile, mtime);
 
   /* naively try to open the format file */
-  if ((fp = fopen(format_file, "rb")) == NULL) {
+  if (dirfd < 0)
+    format_error = ENOENT;
+  else if ((fd = gd_OpenAt(D, dirfd, "format", O_RDONLY | O_BINARY, 0666)) < 0)
+  {
     format_error = errno;
 
+    /* in the non-POSIX case, this has already been done. */
+#ifndef GD_NO_DIR_OPEN
     /* open failed, try to stat the directory itself */
-    if (stat(filedir, &statbuf))
+    if (fstat(dirfd, &statbuf))
       dir_error = errno;
     else if (!S_ISDIR(statbuf.st_mode))
       dir_error = ENOTDIR;
-  }
+#endif
+  } else
+    dir_error = 0;
 
   /* First, cast out our four failure modes */
 
   /* unable to read the format file */
   if (format_error == EACCES || dir_error == EACCES) {
+    char *format_file = (char *)malloc(strlen(dirfile) + 8);
+    sprintf(format_file, "%s%cformat", dirfile, GD_DIRSEP);
     _GD_SetError(D, GD_E_OPEN, GD_E_OPEN_NO_ACCESS, format_file, 0, NULL);
+    free(dirfile);
+    free(format_file);
     dreturn("%p", NULL);
     return NULL;
   }
@@ -77,30 +251,33 @@ static FILE* _GD_CreateDirfile(DIRFILE* D, const char* format_file,
   /* the directory exists, but it's not a dirfile, do nothing else -- even if we
    * were asked to truncate it */
   if (!dir_error && format_error) {
-    _GD_SetError(D, GD_E_OPEN, GD_E_OPEN_NOT_DIRFILE, filedir, 0, NULL);
+    _GD_SetError(D, GD_E_OPEN, GD_E_OPEN_NOT_DIRFILE, dirfile, 0, NULL);
+    free(dirfile);
     dreturn("%p", NULL);
     return NULL;
   }
 
   /* Couldn't open the file, and we weren't asked to create it */
   if (format_error && !(D->flags & GD_CREAT)) {
-    _GD_SetError(D, GD_E_OPEN, GD_E_OPEN_NOT_EXIST, filedir, format_error,
+    _GD_SetError(D, GD_E_OPEN, GD_E_OPEN_NOT_EXIST, dirfile, format_error,
         NULL);
+    free(dirfile);
     dreturn("%p", NULL);
     return NULL;
   }
 
   /* It does exist, but we were asked to exclusively create it */
   if (!format_error && (D->flags & GD_CREAT) && (D->flags & GD_EXCL)) {
-    _GD_SetError(D, GD_E_CREAT, GD_E_CREAT_EXCL, filedir, 0, NULL);
-    fclose(fp);
+    _GD_SetError(D, GD_E_EXISTS, 0, NULL, 0, NULL);
+    free(dirfile);
+    close(fd);
     dreturn("%p", NULL);
     return NULL;
   }
 
   /* If we made it here we either:
    * 1) have no such directory, but plan to create it, or
-   * 2) have a dirfile, which means the directory supplied contains a readable
+   * 2) have a "dirfile", i.e. the directory supplied contains a readable
    *   file called format */
 
   /* Truncate, if needed -- dangerous!  Truncating a dirfile deletes every
@@ -109,52 +286,22 @@ static FILE* _GD_CreateDirfile(DIRFILE* D, const char* format_file,
    * (specifically, we haven't bothered to see if the format file is parsable)
    * could be problematic if users use GD_TRUNC cavalierly. */
   if (D->flags & GD_TRUNC && !format_error) {
-    /* This file isn't going to be around much longer */
-    fclose(fp);
+    close(fd);
 
     /* can't truncate a read-only dirfile */
     if ((D->flags & GD_ACCMODE) == GD_RDONLY) {
       _GD_SetError(D, GD_E_ACCMODE, 0, NULL, 0, NULL);
+      free(dirfile);
       dreturn("%p", NULL);
       return NULL;
     }
 
-    /* This code is from defile */
-    if ((dir = opendir(filedir)) == NULL) {
-      _GD_SetError(D, GD_E_TRUNC, GD_E_TRUNC_DIR, filedir, errno, NULL);
+    format_trunc = _GD_TruncDir(D, dirfd, dirfile, 1);
+    if (format_trunc < 0) {
+      free(dirfile);
       dreturn("%p", NULL);
       return NULL;
     }
-
-    strcpy(fullname, filedir);
-    dirfile_end = fullname + strlen(fullname);
-    if (*(dirfile_end - 1) != '/') {
-      strcat(fullname, "/");
-      dirfile_end++;
-    }
-
-    while ((lamb = readdir(dir)) != NULL) {
-      strcpy(dirfile_end, lamb->d_name);
-
-      if (stat(fullname, &statbuf)) {
-        _GD_SetError(D, GD_E_TRUNC, GD_E_TRUNC_STAT, fullname, errno, NULL);
-        closedir(dir);
-        dreturn("%p", NULL);
-        return NULL;
-      }
-
-      /* only delete regular files */
-      if (S_ISREG(statbuf.st_mode)) {
-        if (unlink(fullname)) {
-          _GD_SetError(D, GD_E_TRUNC, GD_E_TRUNC_UNLINK, fullname, errno, NULL);
-          closedir(dir);
-          dreturn("%p", NULL);
-          return NULL;
-        }
-      }
-    }
-
-    closedir(dir);
   }
 
   /* Create, if needed */
@@ -163,21 +310,43 @@ static FILE* _GD_CreateDirfile(DIRFILE* D, const char* format_file,
     /* can't create a read-only dirfile */
     if ((D->flags & GD_ACCMODE) == GD_RDONLY) {
       _GD_SetError(D, GD_E_ACCMODE, 0, NULL, 0, NULL);
+      free(dirfile);
       dreturn("%p", NULL);
       return NULL;
     }
 
     /* attempt to create the dirfile directory, if not present */
-    if (dir_error) 
-      if (mkdir(filedir, 00777) < 0) {
-        _GD_SetError(D, GD_E_CREAT, GD_E_CREAT_DIR, filedir, errno, NULL);
+    if (dir_error) {
+      if (mkdir(dirfile, 0777) < 0) {
+        _GD_SetError(D, GD_E_CREAT, GD_E_CREAT_DIR, dirfile, errno, NULL);
+        free(dirfile);
+        dreturn("%p", NULL);
+        return NULL;
+      }
+
+#ifdef GD_NO_DIR_OPEN
+      /* in the non-POSIX situation, dirfd just holds the index in the
+       * directory entry */
+      dirfd = 0;
+#else
+      if ((dirfd = open(dirfile, O_RDONLY)) < 0) {
+        _GD_SetError(D, GD_E_CREAT, GD_E_CREAT_OPEN, dirfile, errno, NULL);
+        free(dirfile);
         dreturn("%p", NULL);
         return NULL;
       }
+#endif
+    }
 
-    /* create a new, empty format file */
-    if ((fp = fopen(format_file, "w")) == NULL) {
+    /* create a new, empty format file, or else truncate it */
+    if ((fd = gd_OpenAt(D, dirfd, "format", O_RDWR | O_CREAT | O_BINARY |
+            (format_trunc ? O_TRUNC : O_EXCL), 0666)) < 0)
+    {
+      char *format_file = (char *)malloc(strlen(dirfile) + 8);
+      strcat(strcpy(format_file, dirfile), "/format");
       _GD_SetError(D, GD_E_CREAT, GD_E_CREAT_FORMAT, format_file, errno, NULL);
+      free(dirfile);
+      free(format_file);
       dreturn("%p", NULL);
       return NULL;
     }
@@ -187,7 +356,29 @@ static FILE* _GD_CreateDirfile(DIRFILE* D, const char* format_file,
       D->flags = (D->flags & ~GD_ENCODING) | GD_UNENCODED;
   }
 
+  /* associate a stream with the format file */
+  if ((fp = fdopen(fd, "rb")) == NULL) {
+    char *format_file = (char *)malloc(strlen(dirfile) + 8);
+    strcat(strcpy(format_file, dirfile), "/format");
+    _GD_SetError(D, GD_E_CREAT, GD_E_CREAT_FORMAT, format_file, errno, NULL);
+    free(dirfile);
+    free(format_file);
+    close(fd);
+    dreturn("%p", NULL);
+    return NULL;
+  }
+
   /* open succeeds */
+  D->dir = (struct gd_dir_t *)malloc(sizeof(struct gd_dir_t));
+  D->dir[0].fd = dirfd;
+  D->dir[0].rc = 1;
+  D->dir[0].path = dirfile;
+  D->ndir = 1;
+
+  /* get the mtime */
+  if (fstat(fd, &statbuf) == 0)
+    *mtime = statbuf.st_mtime;
+
   dreturn("%p", fp);
   return fp;
 }
@@ -210,46 +401,88 @@ DIRFILE* gd_invalid_dirfile(void) gd_nothrow
   dtracevoid();
 
   D = (DIRFILE *)malloc(sizeof(DIRFILE));
-  memset(D, 0, sizeof(DIRFILE));
-  D->flags = GD_INVALID;
+  if (D) {
+    memset(D, 0, sizeof(DIRFILE));
+    D->flags = GD_INVALID;
+  }
 
   dreturn("%p", D);
   return D;
 }
 
-/* dirfile_cbopen: open (or, perhaps, create) and parse the specified dirfile
+/* _GD_Open: open (or, perhaps, create) and parse the specified dirfile
 */
-DIRFILE* gd_cbopen(const char* filedir, unsigned long flags,
-    gd_parser_callback_t sehandler, void* extra)
+DIRFILE *_GD_Open(DIRFILE *D, int dirfd, const char *filedir,
+    unsigned long flags, gd_parser_callback_t sehandler, void *extra)
 {
   FILE *fp;
-  char* ref_name;
-  DIRFILE* D;
+  char *ref_name;
+  char *dirfile;
   gd_entry_t* E;
-  char format_file[FILENAME_MAX];
+  int dirfd_error = 0;
+  time_t mtime = 0;
 
-  dtrace("\"%s\", 0x%lx, %p, %p", filedir, (unsigned long)flags, sehandler,
-      extra);
+#ifdef GD_NO_DIR_OPEN
+  gd_stat64_t statbuf;
+#endif
 
+  dtrace("%p, %i, \"%s\", 0x%lX, %p, %p", D, dirfd, filedir,
+      (unsigned long)flags, sehandler, extra);
+
+  errno = 0;
+
+  /* canonicalise the path to protect us against the caller chdir'ing away */
+  dirfile = _GD_CanonicalPath(NULL, filedir);
+
+#ifdef GD_NO_DIR_OPEN
+  /* if we can't cache directory descriptors, we just have to remember paths.
+   * so stat the path to see if it exists (and is a directory) */
+  if (dirfile) {
+    if (gd_stat64(dirfile, &statbuf))
+      dirfd_error = errno;
+    else if (!S_ISDIR(statbuf.st_mode))
+      dirfd_error = ENOTDIR;
+    else
+      dirfd = 0;
+  }
+#else
+  /* quickly, before it goes away, grab the directory (if it exists) */
+  if (dirfd == -1)
+    dirfd = open(dirfile, O_RDONLY);
+  dirfd_error = errno;
+#endif
   _GD_InitialiseFramework();
 
-  D = (DIRFILE *)malloc(sizeof(DIRFILE));
+  if (D == NULL)
+    D = (DIRFILE *)malloc(sizeof(DIRFILE));
+  if (D == NULL) {
+    free(dirfile);
+#ifndef GD_NO_DIR_OPEN
+    close(dirfd);
+#endif
+    dreturn("%p", NULL);
+    return NULL;
+  }
   memset(D, 0, sizeof(DIRFILE));
 
+  /* user specified flags (used if we're forced to re-open) */
+  D->open_flags = flags;
   /* clear GD_PERMISSIVE if it was specified along with GD_PEDANTIC */
   if (flags & GD_PERMISSIVE && flags & GD_PEDANTIC)
     flags &= ~GD_PERMISSIVE;
 
-  D->error_string = NULL;
-  D->error_file = NULL;
-  D->name = strdup(filedir);
+  D->name = dirfile; /* temporarily store canonicalised path here */
   D->flags = (flags | GD_INVALID) & ~GD_IGNORE_REFS;
   D->sehandler = sehandler;
   D->sehandler_extra = extra;
   D->standards = GD_DIRFILE_STANDARDS_VERSION;
+  D->lookback = GD_DEFAULT_LOOKBACK;
 
-  if (D->name == NULL) {
-    _GD_SetError(D, GD_E_ALLOC, 0, NULL, 0, NULL);
+  if (dirfile == NULL) {
+    _GD_SetError(D, GD_E_RAW_IO, 0, filedir, errno, NULL);
+#ifndef GD_NO_DIR_OPEN
+    close(dirfd);
+#endif
     dreturn("%p", D);
     return D;
   }
@@ -257,72 +490,104 @@ DIRFILE* gd_cbopen(const char* filedir, unsigned long flags,
   /* Add the INDEX entry */
   D->n_entries = 1;
 
-  D->entry = (gd_entry_t **)malloc(sizeof(gd_entry_t*));
-  if (D->entry == NULL) {
-    _GD_SetError(D, GD_E_ALLOC, 0, NULL, 0, NULL);
-    dreturn("%p", D);
-    return D;
-  }
+  D->entry = (gd_entry_t **)_GD_Malloc(D, sizeof(gd_entry_t*));
+  if (D->entry)
+    D->entry[0] = (gd_entry_t *)_GD_Malloc(D, sizeof(gd_entry_t));
 
-  D->entry[0] = (gd_entry_t *)malloc(sizeof(gd_entry_t));
-  if (D->entry == NULL) {
-    _GD_SetError(D, GD_E_ALLOC, 0, NULL, 0, NULL);
+  if (D->error) {
+    free(dirfile);
+#ifndef GD_NO_DIR_OPEN
+    close(dirfd);
+#endif
     dreturn("%p", D);
     return D;
   }
-  memset(D->entry[0], 0, sizeof(gd_entry_t));
 
+  memset(D->entry[0], 0, sizeof(gd_entry_t));
   D->entry[0]->field_type = GD_INDEX_ENTRY;
   D->entry[0]->e =
-    (struct _gd_private_entry *)malloc(sizeof(struct _gd_private_entry));
-  D->entry[0]->field = strdup("INDEX");
-  if (D->entry[0]->field == NULL || D->entry[0]->e == NULL) {
-    _GD_SetError(D, GD_E_ALLOC, 0, NULL, 0, NULL);
+    (struct gd_private_entry_ *)_GD_Malloc(D, sizeof(struct gd_private_entry_));
+  D->entry[0]->field = _GD_Strdup(D, "INDEX");
+  if (D->error) {
+    free(dirfile);
+#ifndef GD_NO_DIR_OPEN
+    close(dirfd);
+#endif
     dreturn("%p", D);
     return D;
   }
-  memset(D->entry[0]->e, 0, sizeof(struct _gd_private_entry));
+  memset(D->entry[0]->e, 0, sizeof(struct gd_private_entry_));
   D->entry[0]->e->calculated = 1;
 
-  snprintf(format_file, FILENAME_MAX, "%s%sformat", filedir,
-      (filedir[strlen(filedir) - 1] == '/') ? "" : "/");
-
   /* open the format file (or create it) */
-  if ((fp = _GD_CreateDirfile(D, format_file, filedir)) == NULL) {
+  if ((fp = _GD_CreateDirfile(D, dirfd, dirfd_error, dirfile, &mtime)) == NULL)
+  {
+#ifndef GD_NO_DIR_OPEN
+    close(dirfd);
+#endif
+    D->name = NULL; /* so a subsequent gd_discard() doesn't go awry. */
     dreturn("%p", D);
     return D; /* errors have already been set */
   }
 
+  /* remember back when we temporarily stored the canonicalised path here?
+   * We're over that.  Remember the dirfile's name.  */
+  D->name = strdup(filedir);
+
+  if (D->name == NULL) {
+    _GD_SetError(D, GD_E_ALLOC, 0, NULL, 0, NULL);
+    dreturn("%p", D);
+    return D;
+  }
+
   /* Parse the file.  This will take care of any necessary inclusions */
   D->n_fragment = 1;
 
-  D->fragment = (struct gd_fragment_t *)malloc(sizeof(struct gd_fragment_t));
-  if (D->fragment == NULL) {
-    _GD_SetError(D, GD_E_ALLOC, 0, NULL, 0, NULL);
+  D->fragment = (struct gd_fragment_t *)_GD_Malloc(D,
+      sizeof(struct gd_fragment_t));
+  if (D->error) {
+    dreturn("%p", D);
+    return D;
+  }
+
+  D->fragment[0].cname = _GD_CanonicalPath(dirfile, "format");
+  if (D->fragment[0].cname == NULL) {
+    if (errno == ENOMEM)
+      _GD_SetError(D, GD_E_ALLOC, 0, NULL, 0, NULL);
+    else
+      _GD_SetError(D, GD_E_OPEN, GD_E_OPEN_PATH, dirfile, 0, NULL);
+  }
+
+  D->fragment[0].bname = _GD_Strdup(D, "format");
+
+  if (D->error) {
     dreturn("%p", D);
     return D;
   }
-  D->fragment[0].cname = strdup(format_file);
   D->fragment[0].sname = NULL;
   /* The root format file needs no external name */
   D->fragment[0].ename = NULL;
+  D->fragment[0].enc_data = NULL;
   D->fragment[0].modified = 0;
   D->fragment[0].parent = -1;
+  D->fragment[0].dirfd = D->dir[0].fd;
   D->fragment[0].encoding = D->flags & GD_ENCODING;
   D->fragment[0].byte_sex = (
 #ifdef WORDS_BIGENDIAN
-    (D->flags & GD_LITTLE_ENDIAN) ? GD_LITTLE_ENDIAN : GD_BIG_ENDIAN
+      (D->flags & GD_LITTLE_ENDIAN) ? GD_LITTLE_ENDIAN : GD_BIG_ENDIAN
 #else
-    (D->flags & GD_BIG_ENDIAN) ? GD_BIG_ENDIAN : GD_LITTLE_ENDIAN
+      (D->flags & GD_BIG_ENDIAN) ? GD_BIG_ENDIAN : GD_LITTLE_ENDIAN
 #endif
-    ) | (D->flags & GD_ARM_FLAG);
+      ) | (D->flags & GD_ARM_FLAG);
   D->fragment[0].ref_name = NULL;
   D->fragment[0].frame_offset = 0;
+  D->fragment[0].mtime = mtime;
   D->fragment[0].protection = GD_PROTECT_NONE;
   D->fragment[0].vers = (flags & GD_PEDANTIC) ? GD_DIRFILE_STANDARDS_VERSION :
     0;
+  D->fragment[0].suffix = D->fragment[0].prefix = NULL;
 
-  ref_name = _GD_ParseFragment(fp, D, 0, &D->standards, &D->flags);
+  ref_name = _GD_ParseFragment(fp, D, 0, &D->standards, &D->flags, 1);
   fclose(fp);
 
   if (D->error != GD_E_OK) {
@@ -332,7 +597,7 @@ DIRFILE* gd_cbopen(const char* filedir, unsigned long flags,
 
   /* Find the reference field */
   if (ref_name != NULL) {
-    E = _GD_FindField(D, ref_name, D->entry, D->n_entries, NULL);
+    E = _GD_FindField(D, ref_name, D->entry, D->n_entries, 1, NULL);
     if (E == NULL)
       _GD_SetError(D, GD_E_BAD_REFERENCE, GD_E_REFERENCE_CODE, NULL, 0,
           ref_name);
@@ -340,7 +605,7 @@ DIRFILE* gd_cbopen(const char* filedir, unsigned long flags,
       _GD_SetError(D, GD_E_BAD_REFERENCE, GD_E_REFERENCE_TYPE, NULL, 0,
           ref_name);
     else
-      D->reference_field = E; 
+      D->reference_field = E;
     free(ref_name);
   }
 
@@ -348,9 +613,9 @@ DIRFILE* gd_cbopen(const char* filedir, unsigned long flags,
   if (D->error == GD_E_OK)
     D->flags &= ~GD_INVALID;
 
-  /* if GD_PEDANTIC is not set, we don't know which version this conforms to;
-   * try to figure it out. */
-  if (!D->error && !(D->flags & GD_PEDANTIC)) {
+  /* if GD_PEDANTIC is not set or GD_MULTISTANDARD is set, we don't know which
+   * version this conforms to; try to figure it out. */
+  if (!D->error && (!(D->flags & GD_PEDANTIC) || D->flags & GD_MULTISTANDARD)) {
     if (_GD_FindVersion(D)) {
       /* conforms to some standard, use the latest */
       gd_dirfile_standards(D, GD_VERSION_LATEST); /* can't fail */
@@ -365,13 +630,27 @@ DIRFILE* gd_cbopen(const char* filedir, unsigned long flags,
   return D;
 }
 
+DIRFILE *gd_cbopen(const char* filedir, unsigned long flags,
+    gd_parser_callback_t sehandler, void* extra)
+{
+  DIRFILE *D;
+
+  dtrace("\"%s\", 0x%lX, %p, %p", filedir, (unsigned long)flags, sehandler,
+      extra);
+
+  D = _GD_Open(NULL, -1, filedir, flags, sehandler, extra);
+
+  dreturn("%p", D);
+  return D;
+}
+
 DIRFILE* gd_open(const char* filedir, unsigned long flags)
 {
   DIRFILE *D;
 
-  dtrace("\"%s\", 0x%lx", filedir, (unsigned long)flags);
+  dtrace("\"%s\", 0x%lX", filedir, (unsigned long)flags);
 
-  D = gd_cbopen(filedir, flags, NULL, NULL);
+  D = _GD_Open(NULL, -1, filedir, flags, NULL, NULL);
 
   dreturn("%p", D);
   return D;
diff --git a/src/parse.c b/src/parse.c
index 4d93c64..2687490 100644
--- a/src/parse.c
+++ b/src/parse.c
@@ -1,5 +1,5 @@
 /* Copyright (C) 2002-2005 C. Barth Netterfield
- * Copyright (C) 2005-2010 D. V. Wiebe
+ * Copyright (C) 2005-2013 D. V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,31 +21,13 @@
  */
 #include "internal.h"
 
-#ifdef STDC_HEADERS
-#include <ctype.h>
-#include <math.h>
-#include <errno.h>
-#include <stdlib.h>
-#include <string.h>
-#include <sys/stat.h>
-#include <sys/types.h>
-#endif
-
-#ifdef HAVE_DIRENT_H
-#include <dirent.h>
-#endif
-
-#ifdef HAVE_LIBGEN_H
-#include <libgen.h>
-#endif
-
 static gd_type_t _GD_RawType(const char* type, int standards, int pedantic)
 {
   gd_type_t t = GD_UNKNOWN;;
   dtrace("\"%s\", %i, %i", type, standards, pedantic);
 
   /* for backwards compatibility */
-  if (strlen(type) == 1 && (!pedantic || standards < 8)) 
+  if (strlen(type) == 1 && (!pedantic || standards < 8))
     t = _GD_LegacyType(type[0]);
   else if (pedantic && standards < 5)
     t = GD_UNKNOWN;
@@ -84,26 +66,69 @@ static gd_type_t _GD_RawType(const char* type, int standards, int pedantic)
   else if (strcmp(type, "COMPLEX128") == 0)
     t = GD_COMPLEX128;
 
-  dreturn("%x", t);
+  dreturn("0x%X", t);
   return t;
 }
 
+static gd_windop_t _GD_WindOp(const char *op)
+{
+  gd_windop_t o = GD_WINDOP_UNK;
+  dtrace("\"%s\"", op);
+
+  switch (op[0]) {
+    case 'E':
+      if (op[1] == 'Q')
+        o = GD_WINDOP_EQ;
+      break;
+    case 'L':
+      if (op[1] == 'T')
+        o = GD_WINDOP_LT;
+      else if (op[1] == 'E')
+        o = GD_WINDOP_LE;
+      break;
+    case 'G':
+      if (op[1] == 'T')
+        o = GD_WINDOP_GT;
+      else if (op[1] == 'E')
+        o = GD_WINDOP_GE;
+      break;
+    case 'N':
+      if (op[1] == 'E')
+        o = GD_WINDOP_NE;
+      break;
+    case 'S':
+      if (op[1] == 'E' && op[2] == 'T')
+        o = GD_WINDOP_SET;
+      break;
+    case 'C':
+      if (op[1] == 'L' && op[2] == 'R')
+        o = GD_WINDOP_CLR;
+      break;
+  }
+
+  dreturn("%i", o);
+  return o;
+}
+
 /* Returns a newly malloc'd string containing the scalar field name, or NULL on
  * numeric literal or error */
-static char* _GD_SetScalar(DIRFILE* D, const char* token, void* data, int type,
-    const char* format_file, int line, int *index, int *comp_scal)
+static char *_GD_SetScalar(DIRFILE *restrict D, const char *restrict token,
+    void *restrict data, int type, int me, const char *restrict format_file,
+    int line, int *restrict index, int *restrict comp_scal, int standards,
+    int pedantic)
 {
   char *ptr = NULL;
-  char *lt; 
+  char *lt;
+  int dummy;
 
-  dtrace("%p, \"%s\", %p, %i, \"%s\", %i, %p, %p", D, token, data, type,
-      format_file, line, index, comp_scal);
+  dtrace("%p, \"%s\", %p, 0x%X, \"%s\", %i, %p, %p, %i, %i", D, token, data,
+      type, format_file, line, index, comp_scal, standards, pedantic);
 
   if (type & (GD_COMPLEX | GD_IEEE754)) {
     /* try to convert to double */
     const char *semicolon;
     double i = 0;
-    double d = strtod(token, &ptr); 
+    double d = gd_strtod(token, &ptr);
 
     /* check for a complex value -- look for the semicolon */
     for (semicolon = token; *semicolon; ++semicolon)
@@ -112,25 +137,29 @@ static char* _GD_SetScalar(DIRFILE* D, const char* token, void* data, int type,
 
     /* there were trailing characters in the double or real part of complex */
     if (ptr != semicolon) {
-      ptr = strdup(token);
+      ptr = _GD_Strdup(D, token);
+      if (D->error) {
+        dreturn("%p", NULL);
+        return NULL;
+      }
       goto carray_check;
     }
 
     /* If there was a semicolon, try to extract the imaginary part */
     if (*semicolon == ';') {
-      i = strtod(semicolon + 1, &ptr);
-
-      /* there were trailing characters in the imaginary part of complex -- this
-       * can't be a valid field name, since ; is prohibited */
-      if (*ptr != '\0') {
+      /* if a complex value is not permitted, complain */
+      if (!(type & GD_COMPLEX)) {
         _GD_SetError(D, GD_E_FORMAT, GD_E_FORMAT_LITERAL, format_file, line,
             token);
         dreturn("%p", NULL);
         return NULL;
       }
 
-      /* if a complex value is not permitted, complain */
-      if (!(type & GD_COMPLEX)) {
+      i = gd_strtod(semicolon + 1, &ptr);
+
+      /* there were trailing characters in the imaginary part of complex -- this
+       * can't be a valid field name, since ; is prohibited */
+      if (*ptr != '\0') {
         _GD_SetError(D, GD_E_FORMAT, GD_E_FORMAT_LITERAL, format_file, line,
             token);
         dreturn("%p", NULL);
@@ -139,7 +168,7 @@ static char* _GD_SetScalar(DIRFILE* D, const char* token, void* data, int type,
 
       *comp_scal = 1;
     }
-    
+
     if (type == GD_COMPLEX128) {
       *(double *)data = d;
       *((double *)data + 1) = i;
@@ -154,11 +183,16 @@ static char* _GD_SetScalar(DIRFILE* D, const char* token, void* data, int type,
       _GD_InternalError(D);
   } else if (type & GD_SIGNED) {
     /* try to convert to long long int */
-    long long int lli = gd_strtoll(token, &ptr, 10);
+    long long int lli = gd_strtoll(token, &ptr,
+        (!pedantic || standards >= 9) ? 0 : 10);
 
     /* there were trailing characters in the long long int */
     if (*ptr != '\0') {
-      ptr = strdup(token);
+      ptr = _GD_MungeFromFrag(D, NULL, me, token, &dummy);
+      if (D->error) {
+        dreturn("%p", NULL);
+        return NULL;
+      }
       goto carray_check;
     }
 
@@ -174,11 +208,16 @@ static char* _GD_SetScalar(DIRFILE* D, const char* token, void* data, int type,
       _GD_InternalError(D);
   } else {
     /* try to convert to unsigned long long int */
-    unsigned long long int ulli = gd_strtoull(token, &ptr, 10);
+    unsigned long long int ulli = gd_strtoull(token, &ptr,
+        (!pedantic || standards >= 9) ? 0 : 10);
 
     /* there were trailing characters in the unsigned long long int */
     if (*ptr != '\0') {
-      ptr = strdup(token);
+      ptr = _GD_MungeFromFrag(D, NULL, me, token, &dummy);
+      if (D->error) {
+        dreturn("%p", NULL);
+        return NULL;
+      }
       goto carray_check;
     }
 
@@ -213,14 +252,16 @@ carray_check:
 
 /* _GD_ParseRaw: parse a RAW entry in the format file
 */
-static gd_entry_t* _GD_ParseRaw(DIRFILE* D, char* in_cols[MAX_IN_COLS],
-    int n_cols, const gd_entry_t* parent, int me, const char* format_file,
-    int line, int standards, int pedantic, int *is_dot)
+static gd_entry_t *_GD_ParseRaw(DIRFILE *restrict D,
+    char *gd_restrict_arr in_cols[MAX_IN_COLS], int n_cols,
+    const gd_entry_t *restrict parent, const char *restrict format_file,
+    int line, int me, int standards, int pedantic, int *restrict is_dot)
 {
   gd_entry_t *E;
+  int offset;
 
-  dtrace("%p, %p, %i, %p, %i, \"%s\", %i, %i, %i, %p", D, in_cols, n_cols,
-      parent, me, format_file, line, standards, pedantic, is_dot);
+  dtrace("%p, %p, %i, %p, \"%s\", %i, %i, %i, %i, %p", D, in_cols, n_cols,
+      parent, format_file, line, me, standards, pedantic, is_dot);
 
   if (n_cols < 4) {
     _GD_SetError(D, GD_E_FORMAT, GD_E_FORMAT_N_TOK, format_file, line, NULL);
@@ -235,49 +276,39 @@ static gd_entry_t* _GD_ParseRaw(DIRFILE* D, char* in_cols[MAX_IN_COLS],
     return NULL;
   }
 
-  E = (gd_entry_t *)malloc(sizeof(gd_entry_t));
+  E = (gd_entry_t *)_GD_Malloc(D, sizeof(gd_entry_t));
   if (E == NULL) {
-    _GD_SetError(D, GD_E_ALLOC, 0, NULL, 0, NULL);
     dreturn("%p", NULL);
     return NULL;
   }
   memset(E, 0, sizeof(gd_entry_t));
 
-  E->e = (struct _gd_private_entry *)malloc(sizeof(struct _gd_private_entry));
+  E->e = (struct gd_private_entry_ *)_GD_Malloc(D,
+      sizeof(struct gd_private_entry_));
   if (E->e == NULL) {
-    _GD_SetError(D, GD_E_ALLOC, 0, NULL, 0, NULL);
     free(E);
     dreturn("%p", NULL);
     return NULL;
   }
-  memset(E->e, 0, sizeof(struct _gd_private_entry));
+  memset(E->e, 0, sizeof(struct gd_private_entry_));
 
   E->field_type = GD_RAW_ENTRY;
-  E->e->u.raw.file[0].fp = E->e->u.raw.file[1].fp = -1;
-  E->e->u.raw.file[0].encoding = GD_ENC_UNKNOWN; /* don't know the encoding
+  E->e->u.raw.file[0].idata = E->e->u.raw.file[1].idata = -1;
+  E->e->u.raw.file[0].subenc = GD_ENC_UNKNOWN; /* don't know the encoding
                                                     subscheme yet */
 
-  E->field = _GD_ValidateField(NULL, in_cols[0], standards, pedantic, is_dot);
-  if (E->field == in_cols[0]) {
+  E->field = _GD_MungeFromFrag(D, NULL, me, in_cols[0], &offset);
+  if (E->field && _GD_ValidateField(E->field + offset, standards, pedantic, 0,
+        is_dot))
+  {
     _GD_SetError(D, GD_E_FORMAT, GD_E_FORMAT_BAD_NAME, format_file, line,
         in_cols[0]);
-    E->field = NULL;
-    _GD_FreeE(E, 1);
-    dreturn("%p", NULL);
-    return NULL;
-  }
-
-  E->e->u.raw.filebase = (char *)malloc(FILENAME_MAX);
-  if (E->e->u.raw.filebase == NULL) {
-    _GD_SetError(D, GD_E_ALLOC, 0, NULL, 0, NULL);
-    _GD_FreeE(E, 1);
+    _GD_FreeE(D, E, 1);
     dreturn("%p", NULL);
     return NULL;
   }
 
-  snprintf(E->e->u.raw.filebase, FILENAME_MAX, "%s/%s", D->fragment[me].sname ?
-      D->fragment[me].sname : D->name, in_cols[0]);
-
+  E->e->u.raw.filebase = _GD_Strdup(D, in_cols[0]);
   E->EN(raw,data_type) = _GD_RawType(in_cols[2], standards, pedantic);
   E->e->u.raw.size = GD_SIZE(E->EN(raw,data_type));
 
@@ -285,7 +316,8 @@ static gd_entry_t* _GD_ParseRaw(DIRFILE* D, char* in_cols[MAX_IN_COLS],
     _GD_SetError(D, GD_E_FORMAT, GD_E_FORMAT_BAD_TYPE, format_file, line,
         in_cols[2]);
   else if ((E->scalar[0] = _GD_SetScalar(D, in_cols[3], &E->EN(raw,spf),
-          GD_UINT16, format_file, line, E->scalar_ind, NULL)) == NULL)
+          GD_UINT_TYPE, me, format_file, line, E->scalar_ind, NULL, standards,
+          pedantic)) == NULL)
   {
     E->e->calculated = 1;
     if (E->EN(raw,spf) <= 0)
@@ -294,7 +326,7 @@ static gd_entry_t* _GD_ParseRaw(DIRFILE* D, char* in_cols[MAX_IN_COLS],
   }
 
   if (D->error != GD_E_OK) {
-    _GD_FreeE(E, 1);
+    _GD_FreeE(D, E, 1);
     E = NULL;
   }
 
@@ -304,16 +336,17 @@ static gd_entry_t* _GD_ParseRaw(DIRFILE* D, char* in_cols[MAX_IN_COLS],
 
 /* _GD_ParseLincom: parse a LINCOM entry in the format file.
 */
-static gd_entry_t* _GD_ParseLincom(DIRFILE* D, char* in_cols[MAX_IN_COLS],
-    int n_cols, const gd_entry_t* parent, const char* format_file, int line,
-    int standards, int pedantic, int* is_dot)
+static gd_entry_t *_GD_ParseLincom(DIRFILE *restrict D,
+    char *gd_restrict_arr in_cols[MAX_IN_COLS], int n_cols,
+    const gd_entry_t *restrict parent, const char *restrict format_file,
+    int line, int me, int standards, int pedantic, int *restrict is_dot)
 {
-  int i;
+  int i, offset;
   char* ptr = NULL;
   gd_entry_t *E;
 
-  dtrace("%p, %p, %i, %p, \"%s\", %i, %i, %i, %p", D, in_cols, n_cols, parent,
-      format_file, line, standards, pedantic, is_dot);
+  dtrace("%p, %p, %i, %p, \"%s\", %i, %i, %i, %i, %p", D, in_cols, n_cols,
+      parent, format_file, line, me, standards, pedantic, is_dot);
 
   if (n_cols < 3) {
     _GD_SetError(D, GD_E_FORMAT, GD_E_FORMAT_N_TOK, format_file, line, NULL);
@@ -321,35 +354,31 @@ static gd_entry_t* _GD_ParseLincom(DIRFILE* D, char* in_cols[MAX_IN_COLS],
     return NULL;
   }
 
-  E = (gd_entry_t *)malloc(sizeof(gd_entry_t));
+  E = (gd_entry_t *)_GD_Malloc(D, sizeof(gd_entry_t));
   if (E == NULL) {
-    _GD_SetError(D, GD_E_ALLOC, 0, NULL, 0, NULL);
     dreturn("%p", NULL);
     return NULL;
   }
   memset(E, 0, sizeof(gd_entry_t));
 
-  E->e = (struct _gd_private_entry *)malloc(sizeof(struct _gd_private_entry));
+  E->e = (struct gd_private_entry_ *)_GD_Malloc(D,
+      sizeof(struct gd_private_entry_));
   if (E->e == NULL) {
-    _GD_SetError(D, GD_E_ALLOC, 0, NULL, 0, NULL);
     free(E);
     dreturn("%p", NULL);
     return NULL;
   }
-  memset(E->e, 0, sizeof(struct _gd_private_entry));
+  memset(E->e, 0, sizeof(struct gd_private_entry_));
 
   E->field_type = GD_LINCOM_ENTRY;
-  for (i = 0; i < GD_MAX_LINCOM; ++i) {
-    E->in_fields[i] = NULL;
-    E->e->entry[i] = NULL;
-  }
 
-  E->field = _GD_ValidateField(parent, in_cols[0], standards, pedantic, is_dot);
-  if (E->field == in_cols[0]) {
+  E->field = _GD_MungeFromFrag(D, parent, me, in_cols[0], &offset);
+  if (E->field && _GD_ValidateField(E->field + offset, standards, pedantic, 0,
+        is_dot))
+  {
     _GD_SetError(D, GD_E_FORMAT, GD_E_FORMAT_BAD_NAME, format_file, line,
         in_cols[0]);
-    E->field = NULL;
-    _GD_FreeE(E, 1);
+    _GD_FreeE(D, E, 1);
     dreturn("%p", NULL);
     return NULL;
   }
@@ -363,7 +392,7 @@ static gd_entry_t* _GD_ParseLincom(DIRFILE* D, char* in_cols[MAX_IN_COLS],
         > GD_MAX_LINCOM)
     {
       _GD_SetError(D, GD_E_FORMAT, GD_E_FORMAT_N_TOK, format_file, line, NULL);
-      _GD_FreeE(E, 1);
+      _GD_FreeE(D, E, 1);
       dreturn("%p", NULL);
       return NULL;
     }
@@ -372,9 +401,7 @@ static gd_entry_t* _GD_ParseLincom(DIRFILE* D, char* in_cols[MAX_IN_COLS],
     in_cols--;
   }
 
-  if (E->field == NULL)
-    _GD_SetError(D, GD_E_ALLOC, 0, NULL, 0, NULL);
-  else if ((E->EN(lincom,n_fields) < 1) || (E->EN(lincom,n_fields) >
+  if ((E->EN(lincom,n_fields) < 1) || (E->EN(lincom,n_fields) >
         GD_MAX_LINCOM))
     _GD_SetError(D, GD_E_FORMAT, GD_E_FORMAT_N_FIELDS, format_file, line,
         in_cols[2]);
@@ -382,16 +409,16 @@ static gd_entry_t* _GD_ParseLincom(DIRFILE* D, char* in_cols[MAX_IN_COLS],
     _GD_SetError(D, GD_E_FORMAT, GD_E_FORMAT_N_TOK, format_file, line, NULL);
   else
     for (i = 0; i < E->EN(lincom,n_fields); i++) {
-      E->in_fields[i] = strdup(in_cols[i * 3 + 3]);
-      if (E->in_fields[i] == NULL)
-        _GD_SetError(D, GD_E_ALLOC, 0, NULL, 0, NULL);
-
+      E->in_fields[i] = _GD_MungeFromFrag(D, NULL, me, in_cols[i * 3 + 3],
+          &offset);
       E->scalar[i] = _GD_SetScalar(D, in_cols[i * 3 + 4], &E->EN(lincom,cm)[i],
-          GD_COMPLEX128, format_file, line, E->scalar_ind + i, &E->comp_scal);
+          GD_COMPLEX128, me, format_file, line, E->scalar_ind + i,
+          &E->comp_scal, standards, pedantic);
       E->EN(lincom,m)[i] = creal(E->EN(lincom,cm)[i]);
       E->scalar[i + GD_MAX_LINCOM] = _GD_SetScalar(D, in_cols[i * 3 + 5],
-          &E->EN(lincom,cb)[i], GD_COMPLEX128, format_file, line,
-          E->scalar_ind + i + GD_MAX_LINCOM, &E->comp_scal);
+          &E->EN(lincom,cb)[i], GD_COMPLEX128, me, format_file, line,
+          E->scalar_ind + i + GD_MAX_LINCOM, &E->comp_scal, standards,
+          pedantic);
       E->EN(lincom,b)[i] = creal(E->EN(lincom,cb)[i]);
 
       if (E->scalar[i] != NULL || E->scalar[i + GD_MAX_LINCOM] != NULL)
@@ -399,7 +426,7 @@ static gd_entry_t* _GD_ParseLincom(DIRFILE* D, char* in_cols[MAX_IN_COLS],
     }
 
   if (D->error != GD_E_OK) {
-    _GD_FreeE(E, 1);
+    _GD_FreeE(D, E, 1);
     E = NULL;
   }
 
@@ -409,14 +436,16 @@ static gd_entry_t* _GD_ParseLincom(DIRFILE* D, char* in_cols[MAX_IN_COLS],
 
 /* _GD_ParseLinterp: parse a LINTERP entry in the format file.
 */
-static gd_entry_t* _GD_ParseLinterp(DIRFILE* D,
-    char* in_cols[MAX_IN_COLS], int n_cols, const gd_entry_t* parent,
-    const char* format_file, int line, int standards, int pedantic, int* is_dot)
+static gd_entry_t *_GD_ParseLinterp(DIRFILE *restrict D,
+    char *gd_restrict_arr in_cols[MAX_IN_COLS], int n_cols,
+    const gd_entry_t *restrict parent, const char *restrict format_file,
+    int line, int me, int standards, int pedantic, int *restrict is_dot)
 {
   gd_entry_t *E;
+  int offset;
 
-  dtrace("%p, %p, %i, %p, \"%s\", %i, %i, %i, %p", D, in_cols, n_cols, parent,
-      format_file, line, standards, pedantic, is_dot);
+  dtrace("%p, %p, %i, %p, \"%s\", %i, %i, %i, %i, %p", D, in_cols, n_cols,
+      parent, format_file, line, me, standards, pedantic, is_dot);
 
   if (n_cols < 4) {
     _GD_SetError(D, GD_E_FORMAT, GD_E_FORMAT_N_TOK, format_file, line, NULL);
@@ -424,22 +453,21 @@ static gd_entry_t* _GD_ParseLinterp(DIRFILE* D,
     return NULL;
   }
 
-  E = (gd_entry_t *)malloc(sizeof(gd_entry_t));
+  E = (gd_entry_t *)_GD_Malloc(D, sizeof(gd_entry_t));
   if (E == NULL) {
-    _GD_SetError(D, GD_E_ALLOC, 0, NULL, 0, NULL);
     dreturn("%p", NULL);
     return NULL;
   }
   memset(E, 0, sizeof(gd_entry_t));
 
-  E->e = (struct _gd_private_entry *)malloc(sizeof(struct _gd_private_entry));
+  E->e = (struct gd_private_entry_ *)_GD_Malloc(D,
+      sizeof(struct gd_private_entry_));
   if (E->e == NULL) {
-    _GD_SetError(D, GD_E_ALLOC, 0, NULL, 0, NULL);
     free(E);
     dreturn("%p", NULL);
     return NULL;
   }
-  memset(E->e, 0, sizeof(struct _gd_private_entry));
+  memset(E->e, 0, sizeof(struct gd_private_entry_));
 
   E->field_type = GD_LINTERP_ENTRY;
   E->in_fields[0] = NULL;
@@ -447,27 +475,24 @@ static gd_entry_t* _GD_ParseLinterp(DIRFILE* D,
   E->e->calculated = 1;
   E->EN(linterp,table) = NULL;
 
-  E->field = _GD_ValidateField(parent, in_cols[0], standards, pedantic, is_dot);
-  if (E->field == in_cols[0]) {
+  E->field = _GD_MungeFromFrag(D, parent, me, in_cols[0], &offset);
+  if (E->field && _GD_ValidateField(E->field + offset, standards, pedantic, 0,
+        is_dot))
+  {
     _GD_SetError(D, GD_E_FORMAT, GD_E_FORMAT_BAD_NAME, format_file, line,
         in_cols[0]);
-    E->field = NULL;
-    _GD_FreeE(E, 1);
+    _GD_FreeE(D, E, 1);
     dreturn("%p", NULL);
     return NULL;
   }
 
-  E->in_fields[0] = strdup(in_cols[2]);
+  E->in_fields[0] = _GD_MungeFromFrag(D, NULL, me, in_cols[2], &offset);
   E->e->u.linterp.table_len = -1; /* linterp file not read yet */
 
+  E->EN(linterp,table) = _GD_Strdup(D, in_cols[3]);
 
-  E->EN(linterp,table) = strdup(in_cols[3]);
-
-  if (E->field == NULL || E->in_fields[0] == NULL || E->EN(linterp,table) ==
-      NULL)
-  {
-    _GD_SetError(D, GD_E_ALLOC, 0, NULL, 0, NULL);
-    _GD_FreeE(E, 1);
+  if (D->error) {
+    _GD_FreeE(D, E, 1);
     E = NULL;
   }
 
@@ -477,14 +502,16 @@ static gd_entry_t* _GD_ParseLinterp(DIRFILE* D,
 
 /* _GD_ParseMultiply: parse MULTIPLY entry in format file.
 */
-static gd_entry_t* _GD_ParseMultiply(DIRFILE* D,
-    char* in_cols[MAX_IN_COLS], int n_cols, const gd_entry_t* parent,
-    const char* format_file, int line, int standards, int pedantic, int* is_dot)
+static gd_entry_t *_GD_ParseMultiply(DIRFILE *restrict D,
+    char *gd_restrict_arr in_cols[MAX_IN_COLS], int n_cols,
+    const gd_entry_t *restrict parent, const char *restrict format_file,
+    int line, int me, int standards, int pedantic, int *restrict is_dot)
 {
   gd_entry_t *E;
+  int offset;
 
-  dtrace("%p, %p, %i, %p, \"%s\", %i, %i, %i, %p", D, in_cols, n_cols, parent,
-      format_file, line, standards, pedantic, is_dot);
+  dtrace("%p, %p, %i, %p, \"%s\", %i, %i, %i, %i, %p", D, in_cols, n_cols,
+      parent, format_file, line, me, standards, pedantic, is_dot);
 
   if (n_cols < 4) {
     _GD_SetError(D, GD_E_FORMAT, GD_E_FORMAT_N_TOK, format_file, line, NULL);
@@ -492,44 +519,43 @@ static gd_entry_t* _GD_ParseMultiply(DIRFILE* D,
     return NULL;
   }
 
-  E = (gd_entry_t *)malloc(sizeof(gd_entry_t));
+  E = (gd_entry_t *)_GD_Malloc(D, sizeof(gd_entry_t));
   if (E == NULL) {
-    _GD_SetError(D, GD_E_ALLOC, 0, NULL, 0, NULL);
     dreturn("%p", NULL);
     return NULL;
   }
   memset(E, 0, sizeof(gd_entry_t));
 
-  E->e = (struct _gd_private_entry *)malloc(sizeof(struct _gd_private_entry));
+  E->e = (struct gd_private_entry_ *)_GD_Malloc(D,
+      sizeof(struct gd_private_entry_));
   if (E->e == NULL) {
-    _GD_SetError(D, GD_E_ALLOC, 0, NULL, 0, NULL);
     free(E);
     dreturn("%p", NULL);
     return NULL;
   }
-  memset(E->e, 0, sizeof(struct _gd_private_entry));
+  memset(E->e, 0, sizeof(struct gd_private_entry_));
 
   E->field_type = GD_MULTIPLY_ENTRY;
   E->in_fields[0] = E->in_fields[1] = NULL;
   E->e->entry[0] = E->e->entry[1] = NULL;
   E->e->calculated = 1;
 
-  E->field = _GD_ValidateField(parent, in_cols[0], standards, pedantic, is_dot);
-  if (E->field == in_cols[0]) {
+  E->field = _GD_MungeFromFrag(D, parent, me, in_cols[0], &offset);
+  if (E->field && _GD_ValidateField(E->field + offset, standards, pedantic, 0,
+        is_dot))
+  {
     _GD_SetError(D, GD_E_FORMAT, GD_E_FORMAT_BAD_NAME, format_file, line,
         in_cols[0]);
-    E->field = NULL;
-    _GD_FreeE(E, 1);
+    _GD_FreeE(D, E, 1);
     dreturn("%p", NULL);
     return NULL;
   }
 
-  E->in_fields[0] = strdup(in_cols[2]);
-  E->in_fields[1] = strdup(in_cols[3]);
+  E->in_fields[0] = _GD_MungeFromFrag(D, NULL, me, in_cols[2], &offset);
+  E->in_fields[1] = _GD_MungeFromFrag(D, NULL, me, in_cols[3], &offset);
 
-  if (E->field == NULL || E->in_fields[0] == NULL || E->in_fields[1] == NULL) {
-    _GD_SetError(D, GD_E_ALLOC, 0, NULL, 0, NULL);
-    _GD_FreeE(E, 1);
+  if (D->error) {
+    _GD_FreeE(D, E, 1);
     E = NULL;
   }
 
@@ -539,14 +565,16 @@ static gd_entry_t* _GD_ParseMultiply(DIRFILE* D,
 
 /* _GD_ParseRecip: parse RECIP entry in format file.
 */
-static gd_entry_t* _GD_ParseRecip(DIRFILE* D,
-    char* in_cols[MAX_IN_COLS], int n_cols, const gd_entry_t* parent,
-    const char* format_file, int line, int standards, int pedantic, int* is_dot)
+static gd_entry_t *_GD_ParseRecip(DIRFILE *restrict D,
+    char *gd_restrict_arr in_cols[MAX_IN_COLS], int n_cols,
+    const gd_entry_t *restrict parent, const char *restrict format_file,
+    int line, int me, int standards, int pedantic, int *restrict is_dot)
 {
   gd_entry_t *E;
+  int offset;
 
-  dtrace("%p, %p, %i, %p, \"%s\", %i, %i, %i, %p", D, in_cols, n_cols, parent,
-      format_file, line, standards, pedantic, is_dot);
+  dtrace("%p, %p, %i, %p, \"%s\", %i, %i, %i, %i, %p", D, in_cols, n_cols,
+      parent, format_file, line, me, standards, pedantic, is_dot);
 
   if (n_cols < 4) {
     _GD_SetError(D, GD_E_FORMAT, GD_E_FORMAT_N_TOK, format_file, line, NULL);
@@ -554,51 +582,213 @@ static gd_entry_t* _GD_ParseRecip(DIRFILE* D,
     return NULL;
   }
 
-  E = (gd_entry_t *)malloc(sizeof(gd_entry_t));
+  E = (gd_entry_t *)_GD_Malloc(D, sizeof(gd_entry_t));
   if (E == NULL) {
-    _GD_SetError(D, GD_E_ALLOC, 0, NULL, 0, NULL);
     dreturn("%p", NULL);
     return NULL;
   }
   memset(E, 0, sizeof(gd_entry_t));
 
-  E->e = (struct _gd_private_entry *)malloc(sizeof(struct _gd_private_entry));
+  E->e = (struct gd_private_entry_ *)_GD_Malloc(D,
+      sizeof(struct gd_private_entry_));
   if (E->e == NULL) {
-    _GD_SetError(D, GD_E_ALLOC, 0, NULL, 0, NULL);
     free(E);
     dreturn("%p", NULL);
     return NULL;
   }
-  memset(E->e, 0, sizeof(struct _gd_private_entry));
+  memset(E->e, 0, sizeof(struct gd_private_entry_));
 
   E->field_type = GD_RECIP_ENTRY;
   E->in_fields[0] = NULL;
   E->e->entry[0] = NULL;
   E->e->calculated = 0;
 
-  E->field = _GD_ValidateField(parent, in_cols[0], standards, pedantic, is_dot);
-  if (E->field == in_cols[0]) {
+  E->field = _GD_MungeFromFrag(D, parent, me, in_cols[0], &offset);
+  if (E->field && _GD_ValidateField(E->field + offset, standards, pedantic, 0,
+        is_dot))
+  {
     _GD_SetError(D, GD_E_FORMAT, GD_E_FORMAT_BAD_NAME, format_file, line,
         in_cols[0]);
-    E->field = NULL;
-    _GD_FreeE(E, 1);
+    _GD_FreeE(D, E, 1);
+    dreturn("%p", NULL);
+    return NULL;
+  }
+
+  E->in_fields[0] = _GD_MungeFromFrag(D, NULL, me, in_cols[2], &offset);
+
+  E->scalar[0] = _GD_SetScalar(D, in_cols[3], &E->EN(recip,cdividend),
+      GD_COMPLEX128, me, format_file, line, E->scalar_ind, &E->comp_scal,
+      standards, pedantic);
+  E->EN(recip,dividend) = creal(E->EN(recip,cdividend));
+  E->comp_scal = (cimag(E->EN(recip,cdividend)) == 0) ? 0 : 1;
+
+  if (D->error != GD_E_OK) {
+    _GD_FreeE(D, E, 1);
+    E = NULL;
+  }
+
+  dreturn("%p", E);
+  return E;
+}
+
+/* _GD_ParseWindow: parse WINDOW entry in format file.
+*/
+static gd_entry_t *_GD_ParseWindow(DIRFILE *restrict D,
+    char *gd_restrict_arr in_cols[MAX_IN_COLS], int n_cols,
+    const gd_entry_t *restrict parent, const char *restrict format_file,
+    int line, int me, int standards, int pedantic, int *restrict is_dot)
+{
+  gd_entry_t *E;
+  int offset;
+
+  dtrace("%p, %p, %i, %p, \"%s\", %i, %i, %i, %i, %p", D, in_cols, n_cols,
+      parent, format_file, line, me, standards, pedantic, is_dot);
+
+  if (n_cols < 6) {
+    _GD_SetError(D, GD_E_FORMAT, GD_E_FORMAT_N_TOK, format_file, line, NULL);
     dreturn("%p", NULL);
     return NULL;
   }
 
-  E->in_fields[0] = strdup(in_cols[2]);
+  E = (gd_entry_t *)_GD_Malloc(D, sizeof(gd_entry_t));
+  if (E == NULL) {
+    dreturn("%p", NULL);
+    return NULL;
+  }
+  memset(E, 0, sizeof(gd_entry_t));
 
-  if (E->field == NULL || E->in_fields[0] == NULL) {
-    _GD_SetError(D, GD_E_ALLOC, 0, NULL, 0, NULL);
-    _GD_FreeE(E, 1);
+  E->e = (struct gd_private_entry_ *)_GD_Malloc(D,
+      sizeof(struct gd_private_entry_));
+  if (E->e == NULL) {
+    free(E);
     dreturn("%p", NULL);
     return NULL;
   }
+  memset(E->e, 0, sizeof(struct gd_private_entry_));
 
-  E->scalar[0] = _GD_SetScalar(D, in_cols[3], &E->EN(recip,cdividend),
-      GD_COMPLEX128, format_file, line, E->scalar_ind, &E->comp_scal);
-  E->EN(recip,dividend) = creal(E->EN(recip,cdividend));
-  E->comp_scal = (cimag(E->EN(recip,cdividend)) == 0) ? 0 : 1;
+  E->field_type = GD_WINDOW_ENTRY;
+
+  E->field = _GD_MungeFromFrag(D, parent, me, in_cols[0], &offset);
+  if (E->field && _GD_ValidateField(E->field + offset, standards, pedantic, 0,
+        is_dot))
+  {
+    _GD_SetError(D, GD_E_FORMAT, GD_E_FORMAT_BAD_NAME, format_file, line,
+        in_cols[0]);
+    _GD_FreeE(D, E, 1);
+    dreturn("%p", NULL);
+    return NULL;
+  }
+
+  E->in_fields[0] = _GD_MungeFromFrag(D, NULL, me, in_cols[2], &offset);
+  E->in_fields[1] = _GD_MungeFromFrag(D, NULL, me, in_cols[3], &offset);
+
+  E->EN(window,windop) = _GD_WindOp(in_cols[4]);
+  if (E->EN(window,windop) == GD_WINDOP_UNK) {
+    _GD_SetError(D, GD_E_FORMAT, GD_E_FORMAT_WINDOP, format_file, line,
+        in_cols[4]);
+    _GD_FreeE(D, E, 1);
+    dreturn("%p", NULL);
+    return NULL;
+  }
+
+  switch (E->EN(window,windop)) {
+    case GD_WINDOP_EQ:
+    case GD_WINDOP_NE:
+      E->scalar[0] = _GD_SetScalar(D, in_cols[5], &E->EN(window,threshold.i),
+          GD_INT64, me, format_file, line, E->scalar_ind, NULL, standards,
+          pedantic);
+      break;
+    case GD_WINDOP_SET:
+    case GD_WINDOP_CLR:
+      E->scalar[0] = _GD_SetScalar(D, in_cols[5], &E->EN(window,threshold.u),
+          GD_UINT64, me, format_file, line, E->scalar_ind, NULL, standards,
+          pedantic);
+      break;
+    default:
+      E->scalar[0] = _GD_SetScalar(D, in_cols[5], &E->EN(window,threshold.r),
+          GD_FLOAT64, me, format_file, line, E->scalar_ind, NULL, standards,
+          pedantic);
+      break;
+  }
+
+  if (D->error != GD_E_OK) {
+    _GD_FreeE(D, E, 1);
+    E = NULL;
+  }
+
+  dreturn("%p", E);
+  return E;
+}
+
+/* _GD_ParseMplex: parse MPLEX entry in format file.
+*/
+static gd_entry_t *_GD_ParseMplex(DIRFILE *restrict D,
+    char *gd_restrict_arr in_cols[MAX_IN_COLS], int n_cols,
+    const gd_entry_t *restrict parent, const char *restrict format_file,
+    int line, int me, int standards, int pedantic, int *restrict is_dot)
+{
+  gd_entry_t *E;
+  int offset;
+
+  dtrace("%p, %p, %i, %p, \"%s\", %i, %i, %i, %i, %p", D, in_cols, n_cols,
+      parent, format_file, line, me, standards, pedantic, is_dot);
+
+  if (n_cols < 5) {
+    _GD_SetError(D, GD_E_FORMAT, GD_E_FORMAT_N_TOK, format_file, line, NULL);
+    dreturn("%p", NULL);
+    return NULL;
+  }
+
+  E = (gd_entry_t *)_GD_Malloc(D, sizeof(gd_entry_t));
+  if (E == NULL) {
+    dreturn("%p", NULL);
+    return NULL;
+  }
+  memset(E, 0, sizeof(gd_entry_t));
+
+  E->e = (struct gd_private_entry_ *)_GD_Malloc(D,
+      sizeof(struct gd_private_entry_));
+  if (E->e == NULL) {
+    free(E);
+    dreturn("%p", NULL);
+    return NULL;
+  }
+  memset(E->e, 0, sizeof(struct gd_private_entry_));
+
+  E->field_type = GD_MPLEX_ENTRY;
+
+  E->field = _GD_MungeFromFrag(D, parent, me, in_cols[0], &offset);
+  if (E->field && _GD_ValidateField(E->field + offset, standards, pedantic, 0,
+        is_dot))
+  {
+    _GD_SetError(D, GD_E_FORMAT, GD_E_FORMAT_BAD_NAME, format_file, line,
+        in_cols[0]);
+    _GD_FreeE(D, E, 1);
+    dreturn("%p", NULL);
+    return NULL;
+  }
+
+  E->in_fields[0] = _GD_MungeFromFrag(D, NULL, me, in_cols[2], &offset);
+  E->in_fields[1] = _GD_MungeFromFrag(D, NULL, me, in_cols[3], &offset);
+
+  E->scalar[0] = _GD_SetScalar(D, in_cols[4], &E->EN(mplex,count_val),
+      GD_INT_TYPE, me, format_file, line, E->scalar_ind, NULL, standards,
+      pedantic);
+
+  /* the count max, if present */
+  if (n_cols > 5) {
+    E->scalar[1] = _GD_SetScalar(D, in_cols[5], &E->EN(mplex,period),
+        GD_INT_TYPE, me, format_file, line, E->scalar_ind + 1, NULL, standards,
+        pedantic);
+    if (E->scalar[1] == NULL && E->EN(mplex,period) < 0)
+      _GD_SetError(D, GD_E_FORMAT, GD_E_FORMAT_MPLEXVAL, format_file, line,
+        in_cols[5]);
+  }
+
+  if (D->error != GD_E_OK) {
+    _GD_FreeE(D, E, 1);
+    E = NULL;
+  }
 
   dreturn("%p", E);
   return E;
@@ -606,14 +796,16 @@ static gd_entry_t* _GD_ParseRecip(DIRFILE* D,
 
 /* _GD_ParseDivide: parse DIVIDE entry in format file.
 */
-static gd_entry_t* _GD_ParseDivide(DIRFILE* D,
-    char* in_cols[MAX_IN_COLS], int n_cols, const gd_entry_t* parent,
-    const char* format_file, int line, int standards, int pedantic, int* is_dot)
+static gd_entry_t *_GD_ParseDivide(DIRFILE *restrict D,
+    char *gd_restrict_arr in_cols[MAX_IN_COLS], int n_cols,
+    const gd_entry_t *restrict parent, const char *restrict format_file,
+    int line, int me, int standards, int pedantic, int *restrict is_dot)
 {
   gd_entry_t *E;
+  int offset;
 
-  dtrace("%p, %p, %i, %p, \"%s\", %i, %i, %i, %p", D, in_cols, n_cols, parent,
-      format_file, line, standards, pedantic, is_dot);
+  dtrace("%p, %p, %i, %p, \"%s\", %i, %i, %i, %i, %p", D, in_cols, n_cols,
+      parent, format_file, line, me, standards, pedantic, is_dot);
 
   if (n_cols < 4) {
     _GD_SetError(D, GD_E_FORMAT, GD_E_FORMAT_N_TOK, format_file, line, NULL);
@@ -621,44 +813,43 @@ static gd_entry_t* _GD_ParseDivide(DIRFILE* D,
     return NULL;
   }
 
-  E = (gd_entry_t *)malloc(sizeof(gd_entry_t));
+  E = (gd_entry_t *)_GD_Malloc(D, sizeof(gd_entry_t));
   if (E == NULL) {
-    _GD_SetError(D, GD_E_ALLOC, 0, NULL, 0, NULL);
     dreturn("%p", NULL);
     return NULL;
   }
   memset(E, 0, sizeof(gd_entry_t));
 
-  E->e = (struct _gd_private_entry *)malloc(sizeof(struct _gd_private_entry));
+  E->e = (struct gd_private_entry_ *)_GD_Malloc(D,
+      sizeof(struct gd_private_entry_));
   if (E->e == NULL) {
-    _GD_SetError(D, GD_E_ALLOC, 0, NULL, 0, NULL);
     free(E);
     dreturn("%p", NULL);
     return NULL;
   }
-  memset(E->e, 0, sizeof(struct _gd_private_entry));
+  memset(E->e, 0, sizeof(struct gd_private_entry_));
 
   E->field_type = GD_DIVIDE_ENTRY;
   E->in_fields[0] = E->in_fields[1] = NULL;
   E->e->entry[0] = E->e->entry[1] = NULL;
   E->e->calculated = 0;
 
-  E->field = _GD_ValidateField(parent, in_cols[0], standards, pedantic, is_dot);
-  if (E->field == in_cols[0]) {
+  E->field = _GD_MungeFromFrag(D, parent, me, in_cols[0], &offset);
+  if (E->field && _GD_ValidateField(E->field + offset, standards, pedantic, 0,
+        is_dot))
+  {
     _GD_SetError(D, GD_E_FORMAT, GD_E_FORMAT_BAD_NAME, format_file, line,
         in_cols[0]);
-    E->field = NULL;
-    _GD_FreeE(E, 1);
+    _GD_FreeE(D, E, 1);
     dreturn("%p", NULL);
     return NULL;
   }
 
-  E->in_fields[0] = strdup(in_cols[2]);
-  E->in_fields[1] = strdup(in_cols[3]);
+  E->in_fields[0] = _GD_MungeFromFrag(D, NULL, me, in_cols[2], &offset);
+  E->in_fields[1] = _GD_MungeFromFrag(D, NULL, me, in_cols[3], &offset);
 
-  if (E->field == NULL || E->in_fields[0] == NULL || E->in_fields[1] == NULL) {
-    _GD_SetError(D, GD_E_ALLOC, 0, NULL, 0, NULL);
-    _GD_FreeE(E, 1);
+  if (D->error) {
+    _GD_FreeE(D, E, 1);
     dreturn("%p", NULL);
     return NULL;
   }
@@ -669,14 +860,17 @@ static gd_entry_t* _GD_ParseDivide(DIRFILE* D,
 
 /* _GD_ParseBit: parse BIT entry in format file.
 */
-static gd_entry_t* _GD_ParseBit(DIRFILE* D, int is_signed,
-    char* in_cols[MAX_IN_COLS], int n_cols, const gd_entry_t* parent,
-    const char* format_file, int line, int standards, int pedantic, int* is_dot)
+static gd_entry_t *_GD_ParseBit(DIRFILE *restrict D, int is_signed,
+    char *gd_restrict_arr in_cols[MAX_IN_COLS], int n_cols,
+    const gd_entry_t *restrict parent, const char *restrict format_file,
+    int line, int me, int standards, int pedantic, int *restrict is_dot)
 {
   gd_entry_t *E;
+  int offset;
 
-  dtrace("%p, %i, %p, %i, %p, \"%s\", %i, %i, %i, %p", D, is_signed, in_cols,
-      n_cols, parent, format_file, line, standards, pedantic, is_dot);
+  dtrace("%p, %i, %p, %i, %p, \"%s\", %i, %i, %i, %i, %p", D, is_signed,
+      in_cols, n_cols, parent, format_file, line, me, standards, pedantic,
+      is_dot);
 
   if (n_cols < 4) {
     _GD_SetError(D, GD_E_FORMAT, GD_E_FORMAT_N_TOK, format_file, line, NULL);
@@ -684,50 +878,46 @@ static gd_entry_t* _GD_ParseBit(DIRFILE* D, int is_signed,
     return NULL;
   }
 
-  E = (gd_entry_t *)malloc(sizeof(gd_entry_t));
+  E = (gd_entry_t *)_GD_Malloc(D, sizeof(gd_entry_t));
   if (E == NULL) {
-    _GD_SetError(D, GD_E_ALLOC, 0, NULL, 0, NULL);
     dreturn("%p", NULL);
     return NULL;
   }
   memset(E, 0, sizeof(gd_entry_t));
 
-  E->e = (struct _gd_private_entry *)malloc(sizeof(struct _gd_private_entry));
+  E->e = (struct gd_private_entry_ *)_GD_Malloc(D,
+      sizeof(struct gd_private_entry_));
   if (E->e == NULL) {
-    _GD_SetError(D, GD_E_ALLOC, 0, NULL, 0, NULL);
     free(E);
     dreturn("%p", NULL);
     return NULL;
   }
-  memset(E->e, 0, sizeof(struct _gd_private_entry));
+  memset(E->e, 0, sizeof(struct gd_private_entry_));
 
   E->field_type = (is_signed) ? GD_SBIT_ENTRY : GD_BIT_ENTRY;
   E->in_fields[0] = NULL;
   E->e->entry[0] = NULL;
   E->e->calculated = 1;
 
-  E->field = _GD_ValidateField(parent, in_cols[0], standards, pedantic, is_dot);
-  if (E->field == in_cols[0]) {
+  E->field = _GD_MungeFromFrag(D, parent, me, in_cols[0], &offset);
+  if (E->field && _GD_ValidateField(E->field + offset, standards, pedantic, 0,
+        is_dot))
+  {
     _GD_SetError(D, GD_E_FORMAT, GD_E_FORMAT_BAD_NAME, format_file, line,
         in_cols[0]);
-    E->field = NULL;
-    _GD_FreeE(E, 1);
+    _GD_FreeE(D, E, 1);
     dreturn("%p", NULL);
     return NULL;
   }
 
-  E->in_fields[0] = strdup(in_cols[2]);
-
-  if (E->field == NULL || E->in_fields[0] == NULL)
-    _GD_SetError(D, GD_E_ALLOC, 0, NULL, 0, NULL);
-
-
-  E->scalar[0] = _GD_SetScalar(D, in_cols[3], &E->EN(bit,bitnum), GD_INT16,
-      format_file, line, E->scalar_ind, NULL);
+  E->in_fields[0] = _GD_MungeFromFrag(D, NULL, me, in_cols[2], &offset);
+  E->scalar[0] = _GD_SetScalar(D, in_cols[3], &E->EN(bit,bitnum), GD_INT_TYPE,
+      me, format_file, line, E->scalar_ind, NULL, standards, pedantic);
 
   if (n_cols > 4)
-    E->scalar[1] = _GD_SetScalar(D, in_cols[4], &E->EN(bit,numbits), GD_INT16,
-        format_file, line, E->scalar_ind + 1, NULL);
+    E->scalar[1] = _GD_SetScalar(D, in_cols[4], &E->EN(bit,numbits),
+        GD_INT_TYPE, me, format_file, line, E->scalar_ind + 1, NULL, standards,
+        pedantic);
   else
     E->EN(bit,numbits) = 1;
 
@@ -742,7 +932,7 @@ static gd_entry_t* _GD_ParseBit(DIRFILE* D, int is_signed,
     _GD_SetError(D, GD_E_FORMAT, GD_E_FORMAT_BITSIZE, format_file, line, NULL);
 
   if (D->error != GD_E_OK) {
-    _GD_FreeE(E, 1);
+    _GD_FreeE(D, E, 1);
     E = NULL;
   }
 
@@ -752,14 +942,16 @@ static gd_entry_t* _GD_ParseBit(DIRFILE* D, int is_signed,
 
 /* _GD_ParsePhase: parse PHASE entry in formats file.
 */
-static gd_entry_t* _GD_ParsePhase(DIRFILE* D, char* in_cols[MAX_IN_COLS],
-    int n_cols, const gd_entry_t* parent, const char* format_file, int line,
-    int standards, int pedantic, int* is_dot)
+static gd_entry_t *_GD_ParsePhase(DIRFILE *restrict D,
+    char *gd_restrict_arr in_cols[MAX_IN_COLS], int n_cols,
+    const gd_entry_t *restrict parent, const char *restrict format_file,
+    int line, int me, int standards, int pedantic, int *restrict is_dot)
 {
   gd_entry_t *E;
+  int offset;
 
-  dtrace("%p, %p, %i, %p, \"%s\", %i, %i, %i, %p", D, in_cols, n_cols, parent,
-      format_file, line, standards, pedantic, is_dot);
+  dtrace("%p, %p, %i, %p, \"%s\", %i, %i, %i, %i, %p", D, in_cols, n_cols,
+      parent, format_file, line, me, standards, pedantic, is_dot);
 
   if (n_cols < 4) {
     _GD_SetError(D, GD_E_FORMAT, GD_E_FORMAT_N_TOK, format_file, line, NULL);
@@ -767,66 +959,67 @@ static gd_entry_t* _GD_ParsePhase(DIRFILE* D, char* in_cols[MAX_IN_COLS],
     return NULL;
   }
 
-  E = (gd_entry_t *)malloc(sizeof(gd_entry_t));
+  E = (gd_entry_t *)_GD_Malloc(D, sizeof(gd_entry_t));
   if (E == NULL) {
-    _GD_SetError(D, GD_E_ALLOC, 0, NULL, 0, NULL);
     dreturn("%p", NULL);
     return NULL;
   }
   memset(E, 0, sizeof(gd_entry_t));
 
-  E->e = (struct _gd_private_entry *)malloc(sizeof(struct _gd_private_entry));
+  E->e = (struct gd_private_entry_ *)_GD_Malloc(D,
+      sizeof(struct gd_private_entry_));
   if (E->e == NULL) {
-    _GD_SetError(D, GD_E_ALLOC, 0, NULL, 0, NULL);
     free(E);
     dreturn("%p", NULL);
     return NULL;
   }
-  memset(E->e, 0, sizeof(struct _gd_private_entry));
+  memset(E->e, 0, sizeof(struct gd_private_entry_));
 
   E->field_type = GD_PHASE_ENTRY;
   E->in_fields[0] = NULL;
   E->e->entry[0] = NULL;
 
-  E->field = _GD_ValidateField(parent, in_cols[0], standards, pedantic, is_dot);
-  if (E->field == in_cols[0]) {
+  E->field = _GD_MungeFromFrag(D, parent, me, in_cols[0], &offset);
+  if (E->field && _GD_ValidateField(E->field + offset, standards, pedantic, 0,
+        is_dot))
+  {
     _GD_SetError(D, GD_E_FORMAT, GD_E_FORMAT_BAD_NAME, format_file, line,
         in_cols[0]);
-    E->field = NULL;
-    _GD_FreeE(E, 1);
+    _GD_FreeE(D, E, 1);
     dreturn("%p", NULL);
     return NULL;
   }
 
-  E->in_fields[0] = strdup(in_cols[2]); /* field */
-
-  if (E->field == NULL || E->in_fields[0] == NULL) {
-    _GD_SetError(D, GD_E_ALLOC, 0, NULL, 0, NULL);
-    _GD_FreeE(E, 1);
-    E = NULL;
-  }
+  E->in_fields[0] = _GD_MungeFromFrag(D, NULL, me, in_cols[2], &offset);
 
   if ((E->scalar[0] = _GD_SetScalar(D, in_cols[3], &E->EN(phase,shift),
-          GD_INT64, format_file, line, E->scalar_ind, NULL)) == NULL)
+          GD_INT64, me, format_file, line, E->scalar_ind, NULL, standards,
+          pedantic)) == NULL)
   {
     E->e->calculated = 1;
   }
 
+  if (D->error != GD_E_OK) {
+    _GD_FreeE(D, E, 1);
+    E = NULL;
+  }
+
   dreturn("%p", E);
   return E;
 }
 
 /* _GD_ParsePolynom: parse a POLYNOM in the format file.
 */
-static gd_entry_t* _GD_ParsePolynom(DIRFILE* D,
-    char* in_cols[MAX_IN_COLS], int n_cols, const gd_entry_t* parent,
-    const char* format_file, int line, int standards, int pedantic, int* is_dot)
+static gd_entry_t *_GD_ParsePolynom(DIRFILE *restrict D,
+    char *gd_restrict_arr in_cols[MAX_IN_COLS], int n_cols,
+    const gd_entry_t *restrict parent, const char *restrict format_file,
+    int line, int me, int standards, int pedantic, int *restrict is_dot)
 {
-  int i;
+  int i, offset;
   gd_entry_t *E;
 
-  dtrace("%p, %p, %i, %p, \"%s\", %i, %i, %i, %p", D, in_cols, n_cols, parent,
-      format_file, line, standards, pedantic, is_dot);
+  dtrace("%p, %p, %i, %p, \"%s\", %i, %i, %i, %i, %p", D, in_cols, n_cols,
+      parent, format_file, line, me, standards, pedantic, is_dot);
 
   if (n_cols < 5) {
     _GD_SetError(D, GD_E_FORMAT, GD_E_FORMAT_N_TOK, format_file, line, NULL);
@@ -834,30 +1027,30 @@ static gd_entry_t* _GD_ParsePolynom(DIRFILE* D,
     return NULL;
   }
 
-  E = (gd_entry_t *)malloc(sizeof(gd_entry_t));
+  E = (gd_entry_t *)_GD_Malloc(D, sizeof(gd_entry_t));
   if (E == NULL) {
-    _GD_SetError(D, GD_E_ALLOC, 0, NULL, 0, NULL);
     dreturn("%p", NULL);
     return NULL;
   }
   memset(E, 0, sizeof(gd_entry_t));
 
-  E->e = (struct _gd_private_entry *)malloc(sizeof(struct _gd_private_entry));
+  E->e = (struct gd_private_entry_ *)_GD_Malloc(D,
+      sizeof(struct gd_private_entry_));
   if (E->e == NULL) {
-    _GD_SetError(D, GD_E_ALLOC, 0, NULL, 0, NULL);
     free(E);
     dreturn("%p", NULL);
     return NULL;
   }
-  memset(E->e, 0, sizeof(struct _gd_private_entry));
+  memset(E->e, 0, sizeof(struct gd_private_entry_));
 
   E->field_type = GD_POLYNOM_ENTRY;
-  E->field = _GD_ValidateField(parent, in_cols[0], standards, pedantic, is_dot);
-  if (E->field == in_cols[0]) {
+  E->field = _GD_MungeFromFrag(D, parent, me, in_cols[0], &offset);
+  if (E->field && _GD_ValidateField(E->field + offset, standards, pedantic, 0,
+        is_dot))
+  {
     _GD_SetError(D, GD_E_FORMAT, GD_E_FORMAT_BAD_NAME, format_file, line,
         in_cols[0]);
-    E->field = NULL;
-    _GD_FreeE(E, 1);
+    _GD_FreeE(D, E, 1);
     dreturn("%p", NULL);
     return NULL;
   }
@@ -870,25 +1063,20 @@ static gd_entry_t* _GD_ParsePolynom(DIRFILE* D,
 
   E->e->calculated = 1;
 
-  if (E->field == NULL)
-    _GD_SetError(D, GD_E_ALLOC, 0, NULL, 0, NULL);
-  else {
-    E->in_fields[0] = strdup(in_cols[2]);
-    if (E->in_fields[0] == NULL)
-      _GD_SetError(D, GD_E_ALLOC, 0, NULL, 0, NULL);
-    else
-      for (i = 0; i <= E->EN(polynom,poly_ord); i++) {
-        E->scalar[i] = _GD_SetScalar(D, in_cols[i + 3], &E->EN(polynom,ca)[i],
-            GD_COMPLEX128, format_file, line, E->scalar_ind + i, &E->comp_scal);
-        E->EN(polynom,a)[i] = creal(E->EN(polynom,ca)[i]);
+  E->in_fields[0] = _GD_MungeFromFrag(D, NULL, me, in_cols[2], &offset);
 
-        if (E->scalar[i] != NULL)
-          E->e->calculated = 0;
-      }
+  for (i = 0; i <= E->EN(polynom,poly_ord); i++) {
+    E->scalar[i] = _GD_SetScalar(D, in_cols[i + 3], &E->EN(polynom,ca)[i],
+        GD_COMPLEX128, me, format_file, line, E->scalar_ind + i, &E->comp_scal,
+        standards, pedantic);
+    E->EN(polynom,a)[i] = creal(E->EN(polynom,ca)[i]);
+
+    if (E->scalar[i] != NULL)
+      E->e->calculated = 0;
   }
 
   if (D->error != GD_E_OK) {
-    _GD_FreeE(E, 1);
+    _GD_FreeE(D, E, 1);
     E = NULL;
   }
 
@@ -898,45 +1086,46 @@ static gd_entry_t* _GD_ParsePolynom(DIRFILE* D,
 
 gd_type_t _GD_ConstType(DIRFILE *D, gd_type_t type)
 {
-  dtrace("%p, 0x%03x", D, type);
+  dtrace("%p, 0x%X", D, type);
 
   switch (type) {
     case GD_UINT8:
     case GD_UINT16:
     case GD_UINT32:
     case GD_UINT64:
-      dreturn("%i", GD_UINT64);
-      return GD_UINT64; 
+      dreturn("0x%X", GD_UINT64);
+      return GD_UINT64;
     case GD_INT8:
     case GD_INT16:
     case GD_INT32:
     case GD_INT64:
-      dreturn("%x", GD_INT64);
-      return GD_INT64; 
+      dreturn("0x%X", GD_INT64);
+      return GD_INT64;
     case GD_FLOAT32:
     case GD_FLOAT64:
-      dreturn("%x", GD_FLOAT64);
+      dreturn("0x%X", GD_FLOAT64);
       return GD_FLOAT64;
     case GD_COMPLEX64:
     case GD_COMPLEX128:
-      dreturn("%x", GD_COMPLEX128);
-      return GD_COMPLEX128; 
+      dreturn("0x%X", GD_COMPLEX128);
+      return GD_COMPLEX128;
     case GD_NULL:
     case GD_UNKNOWN:
       _GD_InternalError(D);
   }
 
-  dreturn("%x", GD_NULL);
+  dreturn("0x%X", GD_NULL);
   return GD_NULL;
 }
 
 /* _GD_ParseConst: parse CONST entry in formats file.
 */
-static gd_entry_t* _GD_ParseConst(DIRFILE* D, char* in_cols[MAX_IN_COLS],
-    int n_cols, const gd_entry_t* parent, const char* format_file, int line,
-    int standards, int pedantic, int* is_dot)
+static gd_entry_t *_GD_ParseConst(DIRFILE *restrict D,
+    char *gd_restrict_arr in_cols[MAX_IN_COLS], int n_cols,
+    const gd_entry_t *restrict parent, const char *restrict format_file,
+    int line, int me, int standards, int pedantic, int *restrict is_dot)
 {
-  int dummy;
+  int offset;
   char* ptr;
   gd_type_t type;
   gd_entry_t *E;
@@ -950,39 +1139,32 @@ static gd_entry_t* _GD_ParseConst(DIRFILE* D, char* in_cols[MAX_IN_COLS],
     return NULL;
   }
 
-  E = (gd_entry_t *)malloc(sizeof(gd_entry_t));
+  E = (gd_entry_t *)_GD_Malloc(D, sizeof(gd_entry_t));
   if (E == NULL) {
-    _GD_SetError(D, GD_E_ALLOC, 0, NULL, 0, NULL);
     dreturn("%p", NULL);
     return NULL;
   }
   memset(E, 0, sizeof(gd_entry_t));
 
-  E->e = (struct _gd_private_entry *)malloc(sizeof(struct _gd_private_entry));
+  E->e = (struct gd_private_entry_ *)_GD_Malloc(D,
+      sizeof(struct gd_private_entry_));
   if (E->e == NULL) {
-    _GD_SetError(D, GD_E_ALLOC, 0, NULL, 0, NULL);
     free(E);
     dreturn("%p", NULL);
     return NULL;
   }
-  memset(E->e, 0, sizeof(struct _gd_private_entry));
+  memset(E->e, 0, sizeof(struct gd_private_entry_));
 
   E->field_type = GD_CONST_ENTRY;
   E->e->calculated = 1;
 
-  E->field = _GD_ValidateField(parent, in_cols[0], standards, pedantic, is_dot);
-  if (E->field == in_cols[0]) {
+  E->field = _GD_MungeFromFrag(D, parent, me, in_cols[0], &offset);
+  if (E->field && _GD_ValidateField(E->field + offset, standards, pedantic, 0,
+        is_dot))
+  {
     _GD_SetError(D, GD_E_FORMAT, GD_E_FORMAT_BAD_NAME, format_file, line,
         in_cols[0]);
-    E->field = NULL;
-    _GD_FreeE(E, 1);
-    dreturn("%p", NULL);
-    return NULL;
-  }
-
-  if (E->field == NULL) {
-    _GD_SetError(D, GD_E_ALLOC, 0, NULL, 0, NULL);
-    _GD_FreeE(E, 1);
+    _GD_FreeE(D, E, 1);
     dreturn("%p", NULL);
     return NULL;
   }
@@ -994,24 +1176,22 @@ static gd_entry_t* _GD_ParseConst(DIRFILE* D, char* in_cols[MAX_IN_COLS],
   {
     _GD_SetError(D, GD_E_FORMAT, GD_E_FORMAT_BAD_TYPE, format_file, line,
         in_cols[2]);
-    _GD_FreeE(E, 1);
+    _GD_FreeE(D, E, 1);
     dreturn("%p", NULL);
     return NULL;
   }
 
   type = _GD_ConstType(D, E->EN(scalar,const_type));
-  E->e->u.scalar.d = malloc(GD_SIZE(type));
-  if (!D->error && E->e->u.scalar.d == NULL)
-    _GD_SetError(D, GD_E_ALLOC, 0, NULL, 0, NULL);
+  E->e->u.scalar.d = _GD_Malloc(D, GD_SIZE(type));
 
   if (D->error) {
-    _GD_FreeE(E, 1);
+    _GD_FreeE(D, E, 1);
     dreturn("%p", NULL);
     return NULL;
   }
 
-  ptr = _GD_SetScalar(D, in_cols[3], E->e->u.scalar.d, type, format_file, line,
-      &dummy, &dummy);
+  ptr = _GD_SetScalar(D, in_cols[3], E->e->u.scalar.d, type, me, format_file,
+      line, &offset, &offset, standards, pedantic);
   if (ptr) {
     free(ptr);
     _GD_SetError(D, GD_E_FORMAT, GD_E_FORMAT_LITERAL, format_file, line,
@@ -1019,7 +1199,7 @@ static gd_entry_t* _GD_ParseConst(DIRFILE* D, char* in_cols[MAX_IN_COLS],
   }
 
   if (D->error) {
-    _GD_FreeE(E, 1);
+    _GD_FreeE(D, E, 1);
     E = NULL;
   }
 
@@ -1029,21 +1209,21 @@ static gd_entry_t* _GD_ParseConst(DIRFILE* D, char* in_cols[MAX_IN_COLS],
 
 /* _GD_ParseCarray: parse CARRAY entry in formats file.
 */
-static gd_entry_t* _GD_ParseCarray(DIRFILE* D, char* in_cols[MAX_IN_COLS],
-    int n_cols, const gd_entry_t* parent, const char* format_file, int line,
-    int standards, int pedantic, int* is_dot, char **outstring,
-    const char *tok_pos)
+static gd_entry_t *_GD_ParseCarray(DIRFILE *restrict D,
+    char *in_cols[MAX_IN_COLS], int n_cols, const gd_entry_t *restrict parent,
+    const char *restrict format_file, int line, int me, int standards,
+    int pedantic, int *restrict is_dot, char **outstring, const char *tok_pos)
 {
-  int dummy;
+  int offset;
   int c, first, n, new_z, s, z;
   gd_type_t t;
   char* ptr;
   void *data;
   gd_entry_t *E;
 
-  dtrace("%p, %p, %i, %p, \"%s\", %i, %i, %i, %p, %p, %p", D, in_cols, n_cols,
-      parent, format_file, line, standards, pedantic, is_dot, outstring,
-      tok_pos);
+  dtrace("%p, %p, %i, %p, \"%s\", %i, %i, %i, %i, %p, %p, %p", D, in_cols,
+      n_cols, parent, format_file, line, me, standards, pedantic, is_dot,
+      outstring, tok_pos);
 
   if (n_cols < 4) {
     _GD_SetError(D, GD_E_FORMAT, GD_E_FORMAT_N_TOK, format_file, line, NULL);
@@ -1051,39 +1231,32 @@ static gd_entry_t* _GD_ParseCarray(DIRFILE* D, char* in_cols[MAX_IN_COLS],
     return NULL;
   }
 
-  E = (gd_entry_t *)malloc(sizeof(gd_entry_t));
+  E = (gd_entry_t *)_GD_Malloc(D, sizeof(gd_entry_t));
   if (E == NULL) {
-    _GD_SetError(D, GD_E_ALLOC, 0, NULL, 0, NULL);
     dreturn("%p", NULL);
     return NULL;
   }
   memset(E, 0, sizeof(gd_entry_t));
 
-  E->e = (struct _gd_private_entry *)malloc(sizeof(struct _gd_private_entry));
+  E->e = (struct gd_private_entry_ *)_GD_Malloc(D,
+      sizeof(struct gd_private_entry_));
   if (E->e == NULL) {
-    _GD_SetError(D, GD_E_ALLOC, 0, NULL, 0, NULL);
     free(E);
     dreturn("%p", NULL);
     return NULL;
   }
-  memset(E->e, 0, sizeof(struct _gd_private_entry));
+  memset(E->e, 0, sizeof(struct gd_private_entry_));
 
   E->field_type = GD_CARRAY_ENTRY;
   E->e->calculated = 1;
 
-  E->field = _GD_ValidateField(parent, in_cols[0], standards, pedantic, is_dot);
-  if (E->field == in_cols[0]) {
+  E->field = _GD_MungeFromFrag(D, parent, me, in_cols[0], &offset);
+  if (E->field && _GD_ValidateField(E->field + offset, standards, pedantic, 0,
+        is_dot))
+  {
     _GD_SetError(D, GD_E_FORMAT, GD_E_FORMAT_BAD_NAME, format_file, line,
         in_cols[0]);
-    E->field = NULL;
-    _GD_FreeE(E, 1);
-    dreturn("%p", NULL);
-    return NULL;
-  }
-
-  if (E->field == NULL) {
-    _GD_SetError(D, GD_E_ALLOC, 0, NULL, 0, NULL);
-    _GD_FreeE(E, 1);
+    _GD_FreeE(D, E, 1);
     dreturn("%p", NULL);
     return NULL;
   }
@@ -1093,7 +1266,10 @@ static gd_entry_t* _GD_ParseCarray(DIRFILE* D, char* in_cols[MAX_IN_COLS],
   if (GD_SIZE(E->EN(scalar,const_type)) == 0 || E->EN(raw,data_type) & 0x40) {
     _GD_SetError(D, GD_E_FORMAT, GD_E_FORMAT_BAD_TYPE, format_file, line,
         in_cols[2]);
-    _GD_FreeE(E, 1);
+  }
+
+  if (D->error) {
+    _GD_FreeE(D, E, 1);
     dreturn("%p", NULL);
     return NULL;
   }
@@ -1109,11 +1285,10 @@ static gd_entry_t* _GD_ParseCarray(DIRFILE* D, char* in_cols[MAX_IN_COLS],
 
   for (;;) {
     if (z < new_z) {
-      void *new_data = (char *)realloc(data, new_z * s);
+      void *new_data = (char *)_GD_Realloc(D, data, new_z * s);
       if (new_data == NULL) {
-        _GD_SetError(D, GD_E_ALLOC, 0, NULL, 0, NULL);
         free(data);
-        _GD_FreeE(E, 1);
+        _GD_FreeE(D, E, 1);
         dreturn("%p", NULL);
         return NULL;
       }
@@ -1122,27 +1297,27 @@ static gd_entry_t* _GD_ParseCarray(DIRFILE* D, char* in_cols[MAX_IN_COLS],
     }
 
     for (c = first; c < n_cols; ++c) {
-      ptr = _GD_SetScalar(D, in_cols[c], (char *)data + s * n++, t, format_file,
-          line, &dummy, &dummy);
+      ptr = _GD_SetScalar(D, in_cols[c], (char *)data + s * n++, t, me,
+          format_file, line, &offset, &offset, standards, pedantic);
       if (n == GD_MAX_CARRAY_LENGTH)
         break;
 
       if (ptr) {
         free(ptr);
         free(data);
-        _GD_FreeE(E, 1);
+        _GD_FreeE(D, E, 1);
         _GD_SetError(D, GD_E_FORMAT, GD_E_FORMAT_LITERAL, format_file, line,
             in_cols[c]);
       }
     }
 
-    if (n_cols < MAX_IN_COLS) 
+    if (n_cols < MAX_IN_COLS)
       break;
 
     /* get more tokens */
     free(*outstring);
-    n_cols = _GD_Tokenise(D, tok_pos, outstring, &tok_pos, in_cols, format_file,
-        line, standards, pedantic);
+    n_cols = _GD_Tokenise(D, tok_pos, outstring, &tok_pos, MAX_IN_COLS, in_cols,
+        format_file, line, standards, pedantic);
     if (n_cols == 0 || D->error)
       break;
     first = 0;
@@ -1153,8 +1328,7 @@ static gd_entry_t* _GD_ParseCarray(DIRFILE* D, char* in_cols[MAX_IN_COLS],
   E->EN(scalar,array_len) = n;
 
   if (D->error) {
-    free(data);
-    _GD_FreeE(E, 1);
+    _GD_FreeE(D, E, 1);
     E = NULL;
   }
 
@@ -1164,14 +1338,16 @@ static gd_entry_t* _GD_ParseCarray(DIRFILE* D, char* in_cols[MAX_IN_COLS],
 
 /* _GD_ParseString: parse STRING entry in formats file.
 */
-static gd_entry_t* _GD_ParseString(DIRFILE* D, char *in_cols[MAX_IN_COLS],
-    int n_cols, const gd_entry_t* parent, const char* format_file, int line,
-    int standards, int pedantic, int* is_dot)
+static gd_entry_t *_GD_ParseString(DIRFILE *restrict D,
+    char *gd_restrict_arr in_cols[MAX_IN_COLS], int n_cols,
+    const gd_entry_t *restrict parent, const char *restrict format_file,
+    int line, int me, int standards, int pedantic, int *restrict is_dot)
 {
   gd_entry_t *E;
+  int offset;
 
-  dtrace("%p, %p, %i, %p, \"%s\", %i, %i, %i, %p", D, in_cols, n_cols, parent,
-      format_file, line, standards, pedantic, is_dot);
+  dtrace("%p, %p, %i, %p, \"%s\", %i, %i, %i, %i, %p", D, in_cols, n_cols,
+      parent, format_file, line, me, standards, pedantic, is_dot);
 
   if (n_cols < 3) {
     _GD_SetError(D, GD_E_FORMAT, GD_E_FORMAT_N_TOK, format_file, line, NULL);
@@ -1179,50 +1355,45 @@ static gd_entry_t* _GD_ParseString(DIRFILE* D, char *in_cols[MAX_IN_COLS],
     return NULL;
   }
 
-  E = (gd_entry_t *)malloc(sizeof(gd_entry_t));
+  E = (gd_entry_t *)_GD_Malloc(D, sizeof(gd_entry_t));
   if (E == NULL) {
-    _GD_SetError(D, GD_E_ALLOC, 0, NULL, 0, NULL);
     dreturn("%p", NULL);
     return NULL;
   }
   memset(E, 0, sizeof(gd_entry_t));
 
-  E->e = (struct _gd_private_entry *)malloc(sizeof(struct _gd_private_entry));
+  E->e = (struct gd_private_entry_ *)_GD_Malloc(D,
+      sizeof(struct gd_private_entry_));
   if (E->e == NULL) {
-    _GD_SetError(D, GD_E_ALLOC, 0, NULL, 0, NULL);
     free(E);
     dreturn("%p", NULL);
     return NULL;
   }
-  memset(E->e, 0, sizeof(struct _gd_private_entry));
+  memset(E->e, 0, sizeof(struct gd_private_entry_));
 
   E->field_type = GD_STRING_ENTRY;
-  E->e->u.string = strdup(in_cols[2]);
+  E->e->u.string = _GD_Strdup(D, in_cols[2]);
   E->e->calculated = 1;
 
-  E->field = _GD_ValidateField(parent, in_cols[0], standards, pedantic, is_dot);
-  if (E->field == in_cols[0]) {
+  E->field = _GD_MungeFromFrag(D, parent, me, in_cols[0], &offset);
+  if (E->field && _GD_ValidateField(E->field + offset, standards, pedantic, 0,
+        is_dot))
+  {
     _GD_SetError(D, GD_E_FORMAT, GD_E_FORMAT_BAD_NAME, format_file, line,
         in_cols[0]);
-    E->field = NULL;
-    _GD_FreeE(E, 1);
-    dreturn("%p", NULL);
-    return NULL;
   }
 
-  if (E->field == NULL || E->e->u.string == NULL) {
-    _GD_SetError(D, GD_E_ALLOC, 0, NULL, 0, NULL);
-    _GD_FreeE(E, 1);
-    dreturn("%p", NULL);
-    return NULL;
+  if (D->error) {
+    _GD_FreeE(D, E, 1);
+    E = NULL;
   }
 
   dreturn("%p", E);
   return E;
 }
 
-static int utf8encode(DIRFILE* D, const char* format_file, int linenum,
-    char** op, uint32_t value)
+static int _GD_UTF8Encode(DIRFILE *restrict D, const char *restrict format_file,
+    int linenum, char **restrict op, uint32_t value)
 {
   dtrace("%p, %p, %llx", D, op, (long long)value);
 
@@ -1253,16 +1424,73 @@ static int utf8encode(DIRFILE* D, const char* format_file, int linenum,
   return 0;
 }
 
+/* _GD_CheckParent: look for a slashed field name and, if found, see if the
+ * parent exists in the current fragment.  Returns parent entry on success,
+ * and points *name to the metaname part.  me == -1 implies we're not in the
+ * parser, but called from _GD_Add.
+ */
+gd_entry_t *_GD_CheckParent(DIRFILE *restrict D, char **restrict name, int me,
+    int linenum)
+{
+  int dummy;
+  char *cptr, *munged_code;
+  gd_entry_t *P = NULL;
+
+  dtrace("%p, \"%s\", %i, %i", D, *name, me, linenum);
+
+  for (cptr = *name + 1; *cptr != '\0'; ++cptr)
+    if (*cptr == '/') {
+      *cptr = '\0';
+      if (me == -1)
+        munged_code = strdup(*name);
+      else
+        munged_code = _GD_MungeFromFrag(D, NULL, me, *name, &dummy);
+      if (munged_code) {
+        P = _GD_FindField(D, munged_code, D->entry, D->n_entries, 0, NULL);
+        free(munged_code);
+      }
+      if (P == NULL) {
+        if (me == -1) {
+          *cptr = '/'; /* undo field munging; _GD_Add will conclude this is
+                          a field with an illegal '/' */
+          dreturn("%p", NULL);
+          return NULL;
+        }
+        _GD_SetError(D, GD_E_FORMAT, GD_E_FORMAT_NO_FIELD,
+            D->fragment[me].cname, linenum, *name);
+      } else if (P->field_type == GD_ALIAS_ENTRY) {
+        if (me == -1)
+          P = P->e->entry[0]; /* just de-alias */
+        else
+          _GD_SetError(D, GD_E_FORMAT, GD_E_FORMAT_ALIAS, D->fragment[me].cname,
+              linenum, *name);
+      } else if (P->fragment_index != me && me != -1)
+        _GD_SetError(D, GD_E_FORMAT, GD_E_FORMAT_LOCATION,
+            D->fragment[me].cname, linenum, *name);
+
+      if (D->error) {
+        dreturn("%p", NULL);
+        return NULL;
+      }
+
+      /* point name to the metafield name */
+      *name = cptr + 1;
+      break;
+    }
+
+  dreturn("%p", P);
+  return P;
+}
+
 /* _GD_ParseFieldSpec: Parse a format file line fragment containing a field
  * specification */
-gd_entry_t* _GD_ParseFieldSpec(DIRFILE* D, int n_cols, char** in_cols,
-    const gd_entry_t* P, const char* format_file, int linenum, int me,
-    int standards, int creat, unsigned long flags, int insert, char **outstring,
-    const char *tok_pos)
+gd_entry_t *_GD_ParseFieldSpec(DIRFILE *restrict D, int n_cols, char **in_cols,
+    const gd_entry_t *restrict P, const char *restrict format_file, int linenum,
+    int me, int standards, int creat, unsigned long flags, int insert,
+    char **outstring, const char *tok_pos)
 {
   gd_entry_t* E = NULL;
   void *ptr;
-  char *cptr;
   int is_dot = 0;
   const int pedantic = flags & GD_PEDANTIC;
 
@@ -1271,33 +1499,22 @@ gd_entry_t* _GD_ParseFieldSpec(DIRFILE* D, int n_cols, char** in_cols,
       outstring, tok_pos);
 
   /* Check for barth-style metafield definition */
-  if (P == NULL && (!pedantic || standards >= 7))
-    for (cptr = in_cols[0] + 1; *cptr != '\0'; ++cptr)
-      if (*cptr == '/') {
-        *cptr = '\0';
-        P = _GD_FindField(D, in_cols[0], D->entry, D->n_entries, NULL);
-        if (P == NULL)
-          _GD_SetError(D, GD_E_FORMAT, GD_E_FORMAT_NO_PARENT,
-              D->fragment[me].cname, linenum, in_cols[0]);
-        else if (P->fragment_index != me)
-          _GD_SetError(D, GD_E_FORMAT, GD_E_FORMAT_LOCATION,
-              D->fragment[me].cname, linenum, in_cols[0]);
-        else if (n_cols < 2)
-          _GD_SetError(D, GD_E_FORMAT, GD_E_FORMAT_N_TOK, D->fragment[me].cname,
-              linenum, NULL);
-        else {
-          /* point in_cols[0] to the metafield name */
-          in_cols[0] = cptr + 1;
-          E = _GD_ParseFieldSpec(D, n_cols, in_cols, P, D->fragment[me].cname,
-              linenum, me, standards, creat, flags, insert, outstring, tok_pos);
-        }
-        dreturn("%p", (!insert) ? E : NULL);
-        return (!insert) ? E : NULL;
-      }
+  if (P == NULL && (!pedantic || standards >= 7)) {
+    P = _GD_CheckParent(D, in_cols + 0, me, linenum);
+    if (P) {
+      if (n_cols < 2)
+        _GD_SetError(D, GD_E_FORMAT, GD_E_FORMAT_N_TOK, D->fragment[me].cname,
+            linenum, NULL);
+      else
+        E = _GD_ParseFieldSpec(D, n_cols, in_cols, P, D->fragment[me].cname,
+            linenum, me, standards, creat, flags, insert, outstring, tok_pos);
+      dreturn("%p", (!insert) ? E : NULL);
+      return (!insert) ? E : NULL;
+    }
+  }
 
-  ptr = realloc(D->entry, (D->n_entries + 1) * sizeof(gd_entry_t*));
+  ptr = _GD_Realloc(D, D->entry, (D->n_entries + 1) * sizeof(gd_entry_t*));
   if (ptr == NULL) {
-    _GD_SetError(D, GD_E_ALLOC, 0, NULL, 0, NULL);
     dreturn ("%p", NULL);
     return NULL;
   }
@@ -1312,7 +1529,7 @@ gd_entry_t* _GD_ParseFieldSpec(DIRFILE* D, int n_cols, char** in_cols,
     _GD_SetError(D, GD_E_FORMAT, GD_E_FORMAT_RES_NAME, format_file, linenum,
         NULL);
   else if (strcmp(in_cols[1], "RAW") == 0) {
-    E = _GD_ParseRaw(D, in_cols, n_cols, P, me, format_file, linenum, standards,
+    E = _GD_ParseRaw(D, in_cols, n_cols, P, format_file, linenum, me, standards,
         pedantic, &is_dot);
 
     /* Create the binary file, if requested */
@@ -1323,16 +1540,12 @@ gd_entry_t* _GD_ParseFieldSpec(DIRFILE* D, int n_cols, char** in_cols,
             D->fragment[me].cname);
       /* If the encoding scheme is unknown, we can't add the field */
       if (D->fragment[me].encoding == GD_AUTO_ENCODED)
-        _GD_SetError(D, GD_E_UNKNOWN_ENCODING, 0, NULL, 0, NULL);
+        _GD_SetError(D, GD_E_UNKNOWN_ENCODING, GD_E_UNENC_UNDET, NULL, 0, NULL);
       else if (D->fragment[me].encoding == GD_ENC_UNSUPPORTED)
         /* If the encoding scheme is unsupported, we can't add the field */
         _GD_SetError(D, GD_E_UNSUPPORTED, 0, NULL, 0, NULL);
-      else if (!_GD_Supports(D, E, GD_EF_TOUCH))
-        ; /* error already set */
-      else if (_GD_SetEncodedName(D, E->e->u.raw.file, E->e->u.raw.filebase, 0))
-        ; /* error already set */
-      else if ((*_gd_ef[E->e->u.raw.file[0].encoding].touch)(E->e->u.raw.file))
-        _GD_SetError(D, GD_E_RAW_IO, 0, E->e->u.raw.file[0].name, errno, NULL);
+      else
+        _GD_InitRawIO(D, E, NULL, 0, NULL, 0, GD_FILE_WRITE | GD_FILE_TOUCH, 0);
     }
 
     /* Is this the first raw field ever defined? */
@@ -1340,57 +1553,54 @@ gd_entry_t* _GD_ParseFieldSpec(DIRFILE* D, int n_cols, char** in_cols,
       if (D->reference_field == NULL)
         D->reference_field = E;
   } else if (strcmp(in_cols[1], "LINCOM") == 0)
-    E = _GD_ParseLincom(D, in_cols, n_cols, P, format_file, linenum, standards,
-        pedantic, &is_dot);
+    E = _GD_ParseLincom(D, in_cols, n_cols, P, format_file, linenum, me,
+        standards, pedantic, &is_dot);
   else if (strcmp(in_cols[1], "LINTERP") == 0)
-    E = _GD_ParseLinterp(D, in_cols, n_cols, P, format_file, linenum, standards,
-        pedantic, &is_dot);
+    E = _GD_ParseLinterp(D, in_cols, n_cols, P, format_file, linenum, me,
+        standards, pedantic, &is_dot);
   else if (strcmp(in_cols[1], "MULTIPLY") == 0 && (!pedantic || standards >= 2))
-    E = _GD_ParseMultiply(D, in_cols, n_cols, P, format_file, linenum,
+    E = _GD_ParseMultiply(D, in_cols, n_cols, P, format_file, linenum, me,
         standards, pedantic, &is_dot);
   else if (strcmp(in_cols[1], "BIT") == 0)
-    E = _GD_ParseBit(D, 0, in_cols, n_cols, P, format_file, linenum, standards,
-        pedantic, &is_dot);
+    E = _GD_ParseBit(D, 0, in_cols, n_cols, P, format_file, linenum, me,
+        standards, pedantic, &is_dot);
   else if (strcmp(in_cols[1], "PHASE") == 0 && (!pedantic || standards >= 4))
-    E = _GD_ParsePhase(D, in_cols, n_cols, P, format_file, linenum, standards,
-        pedantic, &is_dot);
+    E = _GD_ParsePhase(D, in_cols, n_cols, P, format_file, linenum, me,
+        standards, pedantic, &is_dot);
   else if (strcmp(in_cols[1], "POLYNOM") == 0 && (!pedantic || standards >= 7))
-    E = _GD_ParsePolynom(D, in_cols, n_cols, P, format_file, linenum, standards,
-        pedantic, &is_dot);
+    E = _GD_ParsePolynom(D, in_cols, n_cols, P, format_file, linenum, me,
+        standards, pedantic, &is_dot);
   else if (strcmp(in_cols[1], "SBIT") == 0 && (!pedantic || standards >= 7))
-    E = _GD_ParseBit(D, 1, in_cols, n_cols, P, format_file, linenum, standards,
-        pedantic, &is_dot);
+    E = _GD_ParseBit(D, 1, in_cols, n_cols, P, format_file, linenum, me,
+        standards, pedantic, &is_dot);
   else if (strcmp(in_cols[1], "DIVIDE") == 0 && (!pedantic || standards >= 8))
-    E = _GD_ParseDivide(D, in_cols, n_cols, P, format_file, linenum, standards,
-        pedantic, &is_dot);
+    E = _GD_ParseDivide(D, in_cols, n_cols, P, format_file, linenum, me,
+        standards, pedantic, &is_dot);
   else if (strcmp(in_cols[1], "RECIP") == 0 && (!pedantic || standards >= 8))
-    E = _GD_ParseRecip(D, in_cols, n_cols, P, format_file, linenum, standards,
-        pedantic, &is_dot);
-  else if (strcmp(in_cols[1], "CONST") == 0 && (!pedantic || standards >= 6)) {
-    E = _GD_ParseConst(D, in_cols, n_cols, P, format_file, linenum, standards,
-        pedantic, &is_dot);
-    if (D->error == GD_E_OK && P == NULL)
-      D->n_const++;
-  } else if (strcmp(in_cols[1], "CARRAY") == 0 && (!pedantic || standards >= 8))
-  {
-    E = _GD_ParseCarray(D, in_cols, n_cols, P, format_file, linenum, standards,
-        pedantic, &is_dot, outstring, tok_pos);
-    if (D->error == GD_E_OK && P == NULL)
-      D->n_carray++;
-  } else if (strcmp(in_cols[1], "STRING") == 0 && (!pedantic || standards >= 6))
-  {
-    E = _GD_ParseString(D, in_cols, n_cols, P, format_file, linenum, standards,
-        pedantic, &is_dot);
-    if (D->error == GD_E_OK && P == NULL)
-      D->n_string++;
-  } else if (standards <= GD_DIRFILE_STANDARDS_VERSION || pedantic)
+    E = _GD_ParseRecip(D, in_cols, n_cols, P, format_file, linenum, me,
+        standards, pedantic, &is_dot);
+  else if (strcmp(in_cols[1], "WINDOW") == 0 && (!pedantic || standards >= 9))
+    E = _GD_ParseWindow(D, in_cols, n_cols, P, format_file, linenum, me,
+        standards, pedantic, &is_dot);
+  else if (strcmp(in_cols[1], "MPLEX") == 0 && (!pedantic || standards >= 9))
+    E = _GD_ParseMplex(D, in_cols, n_cols, P, format_file, linenum, me,
+        standards, pedantic, &is_dot);
+  else if (strcmp(in_cols[1], "CONST") == 0 && (!pedantic || standards >= 6))
+    E = _GD_ParseConst(D, in_cols, n_cols, P, format_file, linenum, me,
+        standards, pedantic, &is_dot);
+  else if (strcmp(in_cols[1], "CARRAY") == 0 && (!pedantic || standards >= 8))
+    E = _GD_ParseCarray(D, in_cols, n_cols, P, format_file, linenum, me,
+        standards, pedantic, &is_dot, outstring, tok_pos);
+  else if (strcmp(in_cols[1], "STRING") == 0 && (!pedantic || standards >= 6))
+    E = _GD_ParseString(D, in_cols, n_cols, P, format_file, linenum, me,
+        standards, pedantic, &is_dot);
+  else if (standards <= GD_DIRFILE_STANDARDS_VERSION || pedantic)
     _GD_SetError(D, GD_E_FORMAT, GD_E_FORMAT_BAD_LINE, format_file, linenum,
         NULL);
 
   if (is_dot) {
-    ptr = realloc(D->dot_list, (D->n_dot + 1) * sizeof(gd_entry_t*));
+    ptr = _GD_Realloc(D, D->dot_list, (D->n_dot + 1) * sizeof(gd_entry_t*));
     if (ptr == NULL) {
-      _GD_SetError(D, GD_E_ALLOC, 0, NULL, 0, NULL);
       dreturn ("%p", NULL);
       return NULL;
     }
@@ -1400,50 +1610,39 @@ gd_entry_t* _GD_ParseFieldSpec(DIRFILE* D, int n_cols, char** in_cols,
   if (insert && D->error == GD_E_OK && E != NULL) {
     /* the Format file fragment index */
     unsigned int u;
-    gd_entry_t *Q;
 
     E->fragment_index = me;
 
     /* Check for duplicate */
-    Q = _GD_FindField(D, E->field, D->entry, D->n_entries, &u);
-
-    if (Q) {
+    if (_GD_FindField(D, E->field, D->entry, D->n_entries, 0, &u)) {
       if (~flags & GD_IGNORE_DUPS)
         _GD_SetError(D, GD_E_FORMAT, GD_E_FORMAT_DUPLICATE, format_file,
             linenum, E->field);
-      _GD_FreeE(E, 1);
+      _GD_FreeE(D, E, 1);
       dreturn("%p", NULL);
       return NULL;
-    } 
+    }
 
     /* Initialse the meta counts */
     if (P != NULL) {
       E->e->n_meta = -1;
       E->e->p.parent = P;
       /* there is no need to sort this list */
-      ptr = realloc(P->e->p.meta_entry, (P->e->n_meta + 1) *
+      ptr = _GD_Realloc(D, P->e->p.meta_entry, (P->e->n_meta + 1) *
           sizeof(gd_entry_t*));
       if (ptr == NULL) {
-        _GD_SetError(D, GD_E_ALLOC, 0, NULL, 0, NULL);
+        _GD_FreeE(D, E, 1);
         dreturn ("%p", NULL);
         return NULL;
       }
       P->e->p.meta_entry = (gd_entry_t **)ptr;
       P->e->p.meta_entry[P->e->n_meta++] = E;
-
-      D->n_meta++;
-      if (E->field_type == GD_CONST_ENTRY)
-        P->e->n_meta_const++;
-      else if (E->field_type == GD_CARRAY_ENTRY)
-        P->e->n_meta_carray++;
-      else if (E->field_type == GD_STRING_ENTRY)
-        P->e->n_meta_string++;
     }
 
     /* update the dot list if necessary */
     if (is_dot) {
       D->dot_list[D->n_dot++] = E;
-      qsort(D->dot_list, D->n_dot, sizeof(gd_entry_t*), entry_cmp);
+      qsort(D->dot_list, D->n_dot, sizeof(gd_entry_t*), _GD_EntryCmp);
     }
 
     /* sort */
@@ -1453,7 +1652,7 @@ gd_entry_t* _GD_ParseFieldSpec(DIRFILE* D, int n_cols, char** in_cols,
 
   /* return the entry object if we either:
    * - didn't insert the object into the list of fields (ie. we were called
-   *   by [m]alter_spec
+   *   by [m]alter_spec)
    * - found a RAW field (which might be the reference field)
    */
   dreturn("%p", (!insert || (E && E->field_type == GD_RAW_ENTRY)) ? E : NULL);
@@ -1466,9 +1665,9 @@ gd_entry_t* _GD_ParseFieldSpec(DIRFILE* D, int n_cols, char** in_cols,
 #define ACC_MODE_OCTAL 1
 #define ACC_MODE_HEX   2
 #define ACC_MODE_UTF8  3
-int _GD_Tokenise(DIRFILE *D, const char* instring, char **outstring,
-    const char **pos, char** in_cols, const char* format_file, int linenum,
-    int standards, int pedantic)
+int _GD_Tokenise(DIRFILE *restrict D, const char *restrict instring,
+    char **outstring, const char **pos, int tok_want, char **in_cols,
+    const char *restrict format_file, int linenum, int standards, int pedantic)
 {
   const char* ip;
   char* op;
@@ -1480,12 +1679,12 @@ int _GD_Tokenise(DIRFILE *D, const char* instring, char **outstring,
   int n_acc = 0;
   int acc_mode = ACC_MODE_NONE;
 
-  dtrace("%p, \"%s\", %p, %p, %p, \"%s\", %i, %i, %i", D, instring, outstring,
-      pos, in_cols, format_file, linenum, standards, pedantic);
+  dtrace("%p, \"%s\", %p, %p, %i, %p, \"%s\", %i, %i, %i", D, instring,
+      outstring, pos, tok_want, in_cols, format_file, linenum, standards,
+      pedantic);
 
-  op = *outstring = strdup(instring);
+  op = *outstring = _GD_Strdup(D, instring);
   if (op == NULL) {
-    _GD_SetError(D, GD_E_ALLOC, 0, NULL, 0, NULL);
     dreturn("%i", 0);
     return 0;
   }
@@ -1495,9 +1694,10 @@ int _GD_Tokenise(DIRFILE *D, const char* instring, char **outstring,
   for (ip = instring; *ip != '\0'; ++ip) {
     if (escaped_char) {
       if (ws) {
-        if (n_cols >= MAX_IN_COLS)
+        if (n_cols >= tok_want)
           break; /* Ignore trailing data on the line */
         in_cols[n_cols++] = op;
+        ws = 0;
       }
 
       if (acc_mode == ACC_MODE_OCTAL) {
@@ -1518,6 +1718,7 @@ int _GD_Tokenise(DIRFILE *D, const char* instring, char **outstring,
           if (*ip < '0' || *ip > '7')
             ip--; /* rewind */
           escaped_char = 0;
+          acc_mode = ACC_MODE_NONE;
         }
       } else if (acc_mode != ACC_MODE_NONE) {
         if (isxdigit(*ip)) {
@@ -1542,15 +1743,17 @@ int _GD_Tokenise(DIRFILE *D, const char* instring, char **outstring,
           if (!isxdigit(*ip))
             ip--; /* rewind */
           escaped_char = 0;
+          acc_mode = ACC_MODE_NONE;
         } else if (acc_mode == ACC_MODE_UTF8 && (n_acc == 7 ||
               accumulator > 0x10FF || !isxdigit(*ip)))
         {
-          if (utf8encode(D, format_file, linenum, &op, accumulator))
+          if (_GD_UTF8Encode(D, format_file, linenum, &op, accumulator))
             break; /* syntax error */
 
           if (!isxdigit(*ip))
             ip--; /* rewind */
           escaped_char = 0;
+          acc_mode = ACC_MODE_NONE;
         }
       } else {
         switch(*ip) {
@@ -1622,7 +1825,7 @@ int _GD_Tokenise(DIRFILE *D, const char* instring, char **outstring,
       else if (*ip == '"' && (!pedantic || standards >= 6)) {
         if ((quotated = !quotated)) {
           if (ws) {
-            if (n_cols >= MAX_IN_COLS)
+            if (n_cols >= tok_want)
               break; /* Ignore trailing data on the line */
             in_cols[n_cols++] = op;
             ws = 0;
@@ -1640,7 +1843,7 @@ int _GD_Tokenise(DIRFILE *D, const char* instring, char **outstring,
         break;
       } else {
         if (ws) {
-          if (n_cols >= MAX_IN_COLS)
+          if (n_cols >= tok_want)
             break; /* Ignore trailing data on the line */
           in_cols[n_cols++] = op;
           ws = 0;
@@ -1651,9 +1854,17 @@ int _GD_Tokenise(DIRFILE *D, const char* instring, char **outstring,
   }
   *op = '\0';
 
-  if (quotated || escaped_char) /* Unterminated token */
-    _GD_SetError(D, GD_E_FORMAT, GD_E_FORMAT_UNTERM, format_file, linenum,
-        NULL);
+  if (quotated || escaped_char) {
+    if (*ip == 0 || *ip == '\n') {
+      /* Unterminated token */
+      _GD_SetError(D, GD_E_FORMAT, GD_E_FORMAT_UNTERM, format_file, linenum,
+          NULL);
+    } else {
+      /* a partial tokenisation where we've landed on top of " or \ when
+       * finishing up; back up a space */
+      ip--;
+    }
+  }
 
   if (pos)
     *pos = ip;
@@ -1662,16 +1873,119 @@ int _GD_Tokenise(DIRFILE *D, const char* instring, char **outstring,
   return n_cols;
 }
 
+/* _GD_ParseAlias: set up an alias
+ */
+static void _GD_ParseAlias(DIRFILE *restrict D, char **restrict name,
+    const char *restrict target, int me, int line, int standards, int pedantic,
+    int ignore_dups)
+{
+  gd_entry_t **new_meta_list = NULL;
+  gd_entry_t *E, *P = NULL;
+  unsigned int u;
+  int offset;
+  void *ptr;
+
+  dtrace("%p, \"%s\", \"%s\", %i, %i, %i, %i, %i", D, *name, target, me, line,
+      standards, pedantic, ignore_dups);
+
+  P = _GD_CheckParent(D, name, me, line);
+  if (D->error) {
+    dreturnvoid();
+    return;
+  }
+
+  ptr = _GD_Realloc(D, D->entry, (D->n_entries + 1) * sizeof(gd_entry_t*));
+  if (ptr == NULL) {
+    dreturnvoid();
+    return;
+  }
+  D->entry = (gd_entry_t **)ptr;
+
+  E = (gd_entry_t *)_GD_Malloc(D, sizeof(gd_entry_t));
+  if (E == NULL) {
+    dreturnvoid();
+    return;
+  }
+  memset(E, 0, sizeof(gd_entry_t));
+
+  E->e = (struct gd_private_entry_ *)_GD_Malloc(D,
+      sizeof(struct gd_private_entry_));
+  if (E->e == NULL) {
+    free(E);
+    dreturnvoid();
+    return;
+  }
+  memset(E->e, 0, sizeof(struct gd_private_entry_));
+
+  E->field_type = GD_ALIAS_ENTRY;
+  E->fragment_index = me;
+  E->in_fields[0] = _GD_MungeFromFrag(D, NULL, me, target, &offset);
+
+  E->field = _GD_MungeFromFrag(D, P, me, *name, &offset);
+  if (E->field && _GD_ValidateField(E->field + offset, standards, pedantic, 0,
+        NULL))
+  {
+    _GD_SetError(D, GD_E_FORMAT, GD_E_FORMAT_BAD_NAME, D->fragment[me].cname,
+        line, *name);
+  }
+
+  if (D->error != GD_E_OK) {
+    _GD_FreeE(D, E, 1);
+    dreturnvoid();
+    return;
+  }
+
+  /* Check for duplicate */
+  if (_GD_FindField(D, E->field, D->entry, D->n_entries, 0, &u)) {
+    if (!ignore_dups)
+      _GD_SetError(D, GD_E_FORMAT, GD_E_FORMAT_DUPLICATE, D->fragment[me].cname,
+          line, E->field);
+    _GD_FreeE(D, E, 1);
+    dreturnvoid();
+    return;
+  }
+
+  /* Allocate where necessary */
+  if (P) {
+    new_meta_list = (gd_entry_t **)_GD_Realloc(D, P->e->p.meta_entry,
+        (P->e->n_meta + 1) * sizeof(gd_entry_t*));
+    if (new_meta_list == NULL) {
+      _GD_FreeE(D, E, 1);
+      dreturnvoid();
+      return;
+    }
+  }
+
+  /* Nothing from here on may fail */
+
+  /* Initialse the meta counts */
+  if (P) {
+    E->e->n_meta = -1;
+    E->e->p.parent = P;
+    /* there is no need to sort this list */
+    P->e->p.meta_entry = new_meta_list;
+    P->e->p.meta_entry[P->e->n_meta++] = E;
+  }
+
+  /* sort */
+  _GD_InsertSort(D, E, u);
+  D->n_entries++;
+
+  dreturnvoid();
+}
+
 /* _GD_ParseDirective: Actually parse a single format file line.
  *       Returns 1 if a match was made.
  */
-static int _GD_ParseDirective(DIRFILE *D, char** in_cols, int n_cols,
-    int me, int* standards, int linenum, char** ref_name, unsigned long *flags,
-    char **outstring, const char *tok_pos)
+static int _GD_ParseDirective(DIRFILE *D, char **in_cols, int n_cols,
+    int me, int *restrict standards, int linenum, char **restrict ref_name,
+    unsigned long *flags, char **outstring, const char *tok_pos)
 {
   const char* ptr;
-  int i;
+  char *munged_code;
+  int i, dummy, matched = 0;
   int pedantic = *flags & GD_PEDANTIC;
+  gd_entry_t *E = NULL;
 
   dtrace("%p, %p, %i, %u, %p, %i, %p, %p, %p, %p", D, in_cols, n_cols, me,
       standards, linenum, ref_name, flags, outstring, tok_pos);
@@ -1705,101 +2019,245 @@ static int _GD_ParseDirective(DIRFILE *D, char** in_cols, int n_cols,
       return 0;
     }
 
-  if (strcmp(ptr, "ENCODING") == 0 && (!pedantic || *standards >= 6)) {
-    if (!(*flags & GD_FORCE_ENCODING)) {
-      D->fragment[me].encoding = GD_ENC_UNSUPPORTED;
-      for (i = 0; i < GD_N_SUBENCODINGS - 1; ++i)
-        if (strcmp(in_cols[1], _gd_ef[i].ffname) == 0) {
-          D->fragment[me].encoding = _gd_ef[i].scheme;
+  switch(ptr[0]) {
+    case 'A':
+      if (strcmp(ptr, "ALIAS") == 0 && (!pedantic || *standards >= 9)) {
+        matched = 1;
+        if (n_cols < 3) {
+          _GD_SetError(D, GD_E_FORMAT, GD_E_FORMAT_N_TOK, D->fragment[me].cname,
+              linenum, NULL);
           break;
         }
-    }
-  } else if (strcmp(ptr, "ENDIAN") == 0 && (!pedantic || *standards >= 5)) {
-    if (!(*flags & GD_FORCE_ENDIAN)) {
-      if (strcmp(in_cols[1], "big") == 0)
-        D->fragment[me].byte_sex = GD_BIG_ENDIAN;
-      else if (strcmp(in_cols[1], "little") == 0)
-        D->fragment[me].byte_sex = GD_LITTLE_ENDIAN;
-      else 
-        _GD_SetError(D, GD_E_FORMAT, GD_E_FORMAT_ENDIAN,
+
+        _GD_ParseAlias(D, in_cols + 1, in_cols[2], me, linenum, *standards,
+            pedantic, *flags & GD_IGNORE_DUPS);
+      }
+      break;
+    case 'E':
+      if (strcmp(ptr, "ENCODING") == 0 && (!pedantic || *standards >= 6)) {
+        matched = 1;
+        if (!(*flags & GD_FORCE_ENCODING)) {
+          D->fragment[me].encoding = GD_ENC_UNSUPPORTED;
+          for (i = 0; i < GD_N_SUBENCODINGS - 1; ++i)
+            if (strcmp(in_cols[1], gd_ef_[i].ffname) == 0) {
+              D->fragment[me].encoding = gd_ef_[i].scheme;
+              free(D->fragment[me].enc_data);
+              if (n_cols > 2 && gd_ef_[i].flags & GD_EF_EDAT)
+                D->fragment[me].enc_data = _GD_Strdup(D, in_cols[2]);
+              else
+                D->fragment[me].enc_data = NULL;
+              break;
+            }
+        }
+      } else if (strcmp(ptr, "ENDIAN") == 0 && (!pedantic || *standards >= 5)) {
+        matched = 1;
+        if (!(*flags & GD_FORCE_ENDIAN)) {
+          if (strcmp(in_cols[1], "big") == 0)
+            D->fragment[me].byte_sex = GD_BIG_ENDIAN;
+          else if (strcmp(in_cols[1], "little") == 0)
+            D->fragment[me].byte_sex = GD_LITTLE_ENDIAN;
+          else
+            _GD_SetError(D, GD_E_FORMAT, GD_E_FORMAT_ENDIAN,
             D->fragment[me].cname, linenum, NULL);
-      if (n_cols > 2 && (!pedantic || *standards >= 8)) {
-        if (strcmp(in_cols[2], "arm") == 0) {
+          if (n_cols > 2 && (!pedantic || *standards >= 8)) {
+            if (strcmp(in_cols[2], "arm") == 0) {
 #if ! defined(ARM_ENDIAN_DOUBLES)
-          D->fragment[me].byte_sex |= GD_ARM_FLAG;
+              D->fragment[me].byte_sex |= GD_ARM_FLAG;
 #endif
-        } else 
-          _GD_SetError(D, GD_E_FORMAT, GD_E_FORMAT_ENDIAN,
-              D->fragment[me].cname, linenum, NULL);
-      }
+            } else
+              _GD_SetError(D, GD_E_FORMAT, GD_E_FORMAT_ENDIAN,
+                  D->fragment[me].cname, linenum, NULL);
+          }
 #ifdef ARM_ENDIAN_DOUBLES
-      else
-        D->fragment[me].byte_sex |= GD_ARM_FLAG;
+          else
+            D->fragment[me].byte_sex |= GD_ARM_FLAG;
 #endif
+        }
+      }
+      break;
+    case 'F':
+      if (strcmp(ptr, "FRAMEOFFSET") == 0 && (!pedantic || *standards >= 1)) {
+        matched = 1;
+        D->fragment[me].frame_offset = gd_strtoll(in_cols[1], NULL,
+            (!pedantic || *standards >= 9) ? 0 : 10);
+      }
+      break;
+    case 'H':
+      if (strcmp(ptr, "HIDDEN") == 0 && (!pedantic || *standards >= 9)) {
+        matched = 1;
+        munged_code = _GD_MungeFromFrag(D, NULL, me, in_cols[1], &dummy);
+        if (munged_code)
+          E = _GD_FindField(D, munged_code, D->entry, D->n_entries, 0, NULL);
+        free(munged_code);
+
+        if (E == NULL)
+          _GD_SetError(D, GD_E_FORMAT, GD_E_FORMAT_NO_FIELD,
+              D->fragment[me].cname, linenum, in_cols[1]);
+        else if (E->fragment_index != me)
+          _GD_SetError(D, GD_E_FORMAT, GD_E_FORMAT_LOCATION,
+              D->fragment[me].cname, linenum, in_cols[1]);
+        else
+          E->hidden = 1;
+      }
+      break;
+    case 'I':
+      if (strcmp(ptr, "INCLUDE") == 0 && (!pedantic || *standards >= 3)) {
+        char *new_ref = NULL;
+        int frag;
+        unsigned long subflags = D->fragment[me].encoding
+          | D->fragment[me].byte_sex | (*flags & (GD_PEDANTIC | GD_PERMISSIVE
+                | GD_FORCE_ENDIAN | GD_FORCE_ENCODING | GD_IGNORE_DUPS
+                | GD_IGNORE_REFS));
+        matched = 1;
+
+        frag = _GD_Include(D, in_cols[1], D->fragment[me].cname, linenum,
+            &new_ref, me, (n_cols > 2) ? in_cols[2] : NULL,
+            (n_cols > 3) ? in_cols[3] : NULL, standards, &subflags, 0);
+
+        if (new_ref) {
+          free(*ref_name);
+          *ref_name = new_ref;
+        }
+
+        if ((pedantic = subflags & GD_PEDANTIC))
+          *flags |= GD_PEDANTIC;
+        if (frag != -1)
+          D->fragment[me].vers |= D->fragment[frag].vers;
+      }
+      break;
+    case 'M':
+      if (strcmp(ptr, "META") == 0 && (!pedantic || *standards >= 6)) {
+        matched = 1;
+        munged_code = _GD_MungeFromFrag(D, NULL, me, in_cols[1], &dummy);
+        if (munged_code) {
+          E = _GD_FindField(D, munged_code, D->entry, D->n_entries, 0, NULL);
+          free(munged_code);
+        }
+
+        if (E == NULL)
+          _GD_SetError(D, GD_E_FORMAT, GD_E_FORMAT_NO_FIELD,
+              D->fragment[me].cname, linenum, in_cols[1]);
+        else if (E->field_type == GD_ALIAS_ENTRY)
+          _GD_SetError(D, GD_E_FORMAT, GD_E_FORMAT_ALIAS, D->fragment[me].cname,
+              linenum, in_cols[1]);
+        else if (E->fragment_index != me)
+          _GD_SetError(D, GD_E_FORMAT, GD_E_FORMAT_LOCATION,
+              D->fragment[me].cname, linenum, in_cols[1]);
+        else if (E->e->n_meta == -1)
+          _GD_SetError(D, GD_E_FORMAT, GD_E_FORMAT_META_META,
+              D->fragment[me].cname, linenum, in_cols[1]);
+        else if (n_cols < 4)
+          _GD_SetError(D, GD_E_FORMAT, GD_E_FORMAT_N_TOK, D->fragment[me].cname,
+              linenum, NULL);
+        else
+          _GD_ParseFieldSpec(D, n_cols - 2, in_cols + 2, E,
+              D->fragment[me].cname, linenum, me, *standards, 0, *flags, 1,
+              outstring, tok_pos);
+      }
+      break;
+    case 'P':
+      if (strcmp(ptr, "PROTECT") == 0 && (!pedantic || *standards >= 6)) {
+        matched = 1;
+        if (strcmp(in_cols[1], "none") == 0)
+          D->fragment[me].protection = GD_PROTECT_NONE;
+        else if (strcmp(in_cols[1], "format") == 0)
+          D->fragment[me].protection = GD_PROTECT_FORMAT;
+        else if (strcmp(in_cols[1], "data") == 0)
+          D->fragment[me].protection = GD_PROTECT_DATA;
+        else if (strcmp(in_cols[1], "all") == 0)
+          D->fragment[me].protection = GD_PROTECT_ALL;
+        else
+          _GD_SetError(D, GD_E_FORMAT, GD_E_FORMAT_PROTECT,
+              D->fragment[me].cname, linenum, in_cols[1]);
+      }
+      break;
+    case 'R':
+      if (strcmp(ptr, "REFERENCE") == 0 && (!pedantic || *standards >= 6)) {
+        matched = 1;
+        free(*ref_name);
+        *ref_name = _GD_MungeFromFrag(D, NULL, me, in_cols[1], &dummy);
+      }
+      break;
+    case 'V':
+      if (strcmp(ptr, "VERSION") == 0 && (!pedantic || *standards >= 5)) {
+        matched = 1;
+        *standards = atoi(in_cols[1]);
+        if (!pedantic && ~(*flags) & GD_PERMISSIVE)
+          *flags |= (pedantic = GD_PEDANTIC);
+        if (pedantic)
+          D->fragment[me].vers |= 1ULL << *standards;
+      }
+      break;
+  }
+
+  dreturn("%i", matched);
+  return matched;
+}
+
+/* Resolve and record an alias, taking care of loops */
+static gd_entry_t *_GD_ResolveAlias(DIRFILE *restrict D, gd_entry_t *restrict E)
+{
+  gd_entry_t *T = NULL;
+
+  dtrace("%p, %p", D, E);
+
+  if (++D->recurse_level >= GD_MAX_RECURSE_LEVEL) {
+    _GD_SetError(D, GD_E_RECURSE_LEVEL, GD_E_RECURSE_CODE, NULL, 0, E->field);
+    D->recurse_level--;
+    dreturn("%p", NULL);
+    return NULL;
+  }
+
+  /* Find the target */
+  T = _GD_FindField(D, E->in_fields[0], D->entry, D->n_entries, 0, NULL);
+
+  /* Aliases store the ulitmate target in entry[0] and the direct link
+   * in entry[1].
+   */
+  E->e->entry[0] = E->e->entry[1] = T;
+  if (T) {
+    if (T->field_type == GD_ALIAS_ENTRY) {
+      if (T->e->entry[0])
+        T = T->e->entry[0];
+      else
+        T = _GD_ResolveAlias(D, T);
     }
-  } else if (strcmp(ptr, "FRAMEOFFSET") == 0 && (!pedantic || *standards >= 1))
-    D->fragment[me].frame_offset = gd_strtoll(in_cols[1], NULL, 10);
-  else if (strcmp(ptr, "INCLUDE") == 0 && (!pedantic || *standards >= 3)) {
-    unsigned long subflags = D->fragment[me].encoding | D->fragment[me].byte_sex
-      | (*flags & (GD_PEDANTIC | GD_PERMISSIVE | GD_FORCE_ENDIAN |
-            GD_FORCE_ENCODING | GD_IGNORE_DUPS | GD_IGNORE_REFS));
-    int frag = _GD_Include(D, in_cols[1], D->fragment[me].cname, linenum,
-        ref_name, me, standards, &subflags);
-    if ((pedantic = subflags & GD_PEDANTIC))
-      *flags |= GD_PEDANTIC;
-    if (frag != -1)
-      D->fragment[me].vers |= D->fragment[frag].vers;
-  } else if (strcmp(ptr, "META") == 0 && (!pedantic || *standards >= 6)) {
-    const gd_entry_t* P =  _GD_FindField(D, in_cols[1], D->entry, D->n_entries,
-        NULL);
-    if (P == NULL)
-      _GD_SetError(D, GD_E_FORMAT, GD_E_FORMAT_NO_PARENT, D->fragment[me].cname,
-          linenum, in_cols[1]);
-    else if (P->fragment_index != me)
-      _GD_SetError(D, GD_E_FORMAT, GD_E_FORMAT_LOCATION, D->fragment[me].cname,
-          linenum, in_cols[1]);
-    else if (n_cols < 4)
-      _GD_SetError(D, GD_E_FORMAT, GD_E_FORMAT_N_TOK, D->fragment[me].cname,
-          linenum, NULL);
-    else
-      _GD_ParseFieldSpec(D, n_cols - 2, in_cols + 2, P, D->fragment[me].cname,
-          linenum, me, *standards, 0, *flags, 1, outstring, tok_pos);
-  } else if (strcmp(ptr, "PROTECT") == 0 && (!pedantic || *standards >= 6)) {
-    if (strcmp(in_cols[1], "none") == 0)
-      D->fragment[me].protection = GD_PROTECT_NONE;
-    else if (strcmp(in_cols[1], "format") == 0)
-      D->fragment[me].protection = GD_PROTECT_FORMAT;
-    else if (strcmp(in_cols[1], "data") == 0)
-      D->fragment[me].protection = GD_PROTECT_DATA;
-    else if (strcmp(in_cols[1], "all") == 0)
-      D->fragment[me].protection = GD_PROTECT_ALL;
-    else
-      _GD_SetError(D, GD_E_FORMAT, GD_E_FORMAT_PROTECT, D->fragment[me].cname,
-          linenum, in_cols[1]);
-  } else if (strcmp(ptr, "REFERENCE") == 0 && (!pedantic || *standards >= 6)) {
-    free(*ref_name);
-    *ref_name = strdup(in_cols[1]);
-  } else if (strcmp(ptr, "VERSION") == 0 && (!pedantic || *standards >= 5)) {
-    *standards = atoi(in_cols[1]);
-    if (!pedantic && ~(*flags) & GD_PERMISSIVE)
-      *flags |= (pedantic = GD_PEDANTIC);
-    if (pedantic)
-      D->fragment[me].vers |= 1ULL << *standards;
-  } else {
-    dreturn("%i", 0);
-    return 0;
+
+    E->e->entry[0] = T;
   }
 
-  dreturn("%i", 1);
-  return 1;
+  D->recurse_level--;
+  dreturn("%p", D->error ? NULL : E->e->entry[0]);
+  return D->error ? NULL : E->e->entry[0];
+}
+
+void _GD_UpdateAliases(DIRFILE *D, int reset)
+{
+  unsigned u;
+
+  dtrace("%p, %i", D, reset);
+
+  if (reset)
+    for (u = 0; u < D->n_entries; ++u)
+      if (D->entry[u]->field_type == GD_ALIAS_ENTRY)
+        D->entry[u]->e->entry[0] = D->entry[u]->e->entry[1] = NULL;
+
+  for (u = 0; u < D->n_entries; ++u)
+    if (D->entry[u]->field_type == GD_ALIAS_ENTRY &&
+        D->entry[u]->e->entry[1] == NULL)
+    {
+      _GD_ResolveAlias(D, D->entry[u]);
+    }
+
+  dreturnvoid();
 }
 
 /* _GD_ParseFragment: Parse each line of the fragment.
  *
  *       Returns NULL unless this fragment contains a REFERENCE directive.
  */
-char* _GD_ParseFragment(FILE* fp, DIRFILE *D, int me, int* standards,
-    unsigned long *flags)
+char *_GD_ParseFragment(FILE *restrict fp, DIRFILE *D, int me,
+    int *restrict standards, unsigned long *flags, int resolve)
 {
   char *instring = NULL;
   char *outstring = NULL;
@@ -1820,13 +2278,14 @@ char* _GD_ParseFragment(FILE* fp, DIRFILE *D, int me, int* standards,
   int saved_line = 0;
   char* saved_token = NULL;
 
-  dtrace("%p, %p, %i, %p, %p", fp, D, me, standards, flags);
+  dtrace("%p, %p, %i, %p, %p, %i", fp, D, me, standards, flags, resolve);
 
   /* start parsing */
   while (rescan || (instring = _GD_GetLine(fp, &n, &linenum))) {
     rescan = 0;
-    n_cols = _GD_Tokenise(D, instring, &outstring, &tok_pos, in_cols,
-        D->fragment[me].cname, linenum, *standards, *flags & GD_PEDANTIC);
+    n_cols = _GD_Tokenise(D, instring, &outstring, &tok_pos, MAX_IN_COLS,
+        in_cols, D->fragment[me].cname, linenum, *standards,
+        *flags & GD_PEDANTIC);
 
     if (n_cols == 0) {/* a blank line */
       free(outstring);
@@ -1846,17 +2305,15 @@ char* _GD_ParseFragment(FILE* fp, DIRFILE *D, int me, int* standards,
           &outstring, tok_pos);
 
     if (D->error == GD_E_FORMAT) {
-      /* we guarantee a buffer size of at least GD_MAX_LINE_LENGTH */
-      if (n < GD_MAX_LINE_LENGTH) {
-        char *ptr = (char *)realloc(instring, GD_MAX_LINE_LENGTH);
-        if (ptr == NULL) {
-          _GD_SetError(D, GD_E_ALLOC, 0, NULL, 0, NULL);
-          break;
-        }
-        instring = ptr;
-      }
       /* call the callback for this error */
       if (D->sehandler != NULL) {
+        /* we guarantee a buffer size of at least GD_MAX_LINE_LENGTH */
+        if (n < GD_MAX_LINE_LENGTH) {
+          char *ptr = (char *)_GD_Realloc(D, instring, GD_MAX_LINE_LENGTH);
+          if (ptr == NULL)
+            break;
+          instring = ptr;
+        }
         pdata.dirfile = D;
         pdata.suberror = D->suberror;
         pdata.linenum = linenum;
@@ -1874,7 +2331,7 @@ char* _GD_ParseFragment(FILE* fp, DIRFILE *D, int me, int* standards,
             saved_suberror = D->suberror;
             saved_line = D->error_line;
             if (D->error_string != NULL)
-              saved_token = strdup(D->error_string);
+              saved_token = _GD_Strdup(D, D->error_string);
             saved_error = 1;
           }
           /* ... and continue parsing (fallthrough) */
@@ -1920,13 +2377,63 @@ char* _GD_ParseFragment(FILE* fp, DIRFILE *D, int me, int* standards,
   /* Set reference */
   if (!D->error) {
     if (ref_name != NULL)
-      D->fragment[me].ref_name = strdup(ref_name);
+      D->fragment[me].ref_name = _GD_Strdup(D, ref_name);
     else if (first_raw != NULL)
-      D->fragment[me].ref_name = strdup(first_raw->field);
+      D->fragment[me].ref_name = _GD_Strdup(D, first_raw->field);
   }
 
+  /* resolve aliases, if requested */
+  if (resolve && !D->error)
+    _GD_UpdateAliases(D, 0);
+
   dreturn("%p", ref_name);
   return ref_name;
 }
+
+/* public access to the GetData tokeniser */
+char *gd_strtok(DIRFILE *D, const char *string) gd_nothrow
+{
+  char *outstring, *in_col;
+  int n_cols;
+
+  dtrace("%p, \"%s\"", D, string);
+
+  if (D->flags & GD_INVALID) {
+    _GD_SetError(D, GD_E_BAD_DIRFILE, 0, NULL, 0, NULL);
+    dreturn("%p", NULL);
+    return NULL;
+  }
+
+  _GD_ClearError(D);
+
+  if (string) {
+    free(D->tok_base);
+    D->tok_pos = D->tok_base = _GD_Strdup(D, string);
+    if (D->error) {
+      dreturn("%p", NULL);
+      return NULL;
+    }
+  } else if (D->tok_pos == NULL) {
+    _GD_SetError(D, GD_E_ARGUMENT, GD_E_ARG_NODATA, NULL, 0, NULL);
+    dreturn("%p", NULL);
+    return NULL;
+  }
+
+  /* tokenise! */
+  n_cols = _GD_Tokenise(D, D->tok_pos, &outstring, (const char **)&D->tok_pos,
+      1, &in_col, "gd_strtok()", 0, D->standards, D->flags & GD_PERMISSIVE);
+
+  if (D->error || n_cols < 1) {
+    free(D->tok_base);
+    D->tok_pos = D->tok_base = NULL;
+    free(outstring);
+    outstring = NULL;
+  }
+
+  /* in_col invariably points to outstring, so just let the caller worry about
+   * cleaning up.  Ha! */
+  dreturn("\"%s\"", outstring);
+  return outstring;
+}
 /* vim: ts=2 sw=2 et tw=80
 */
diff --git a/src/protect.c b/src/protect.c
index 95ef09d..56c5576 100644
--- a/src/protect.c
+++ b/src/protect.c
@@ -20,10 +20,6 @@
  */
 #include "internal.h"
 
-#ifdef STDC_HEADERS
-#include <stdlib.h>
-#endif
-
 int gd_protection(DIRFILE* D, int fragment_index) gd_nothrow
 {
   dtrace("%p, %i", D, fragment_index);
@@ -37,7 +33,7 @@ int gd_protection(DIRFILE* D, int fragment_index) gd_nothrow
   }
 
   if (fragment_index < 0 || fragment_index >= D->n_fragment) {
-    _GD_SetError(D, GD_E_BAD_INDEX, 0, NULL, 0, NULL);
+    _GD_SetError(D, GD_E_BAD_INDEX, 0, NULL, fragment_index, NULL);
     dreturn("%i", -1);
     return -1;
   }
@@ -68,7 +64,7 @@ int gd_alter_protection(DIRFILE *D, int protection_level, int fragment_index)
   }
 
   if (fragment_index < GD_ALL_FRAGMENTS || fragment_index >= D->n_fragment) {
-    _GD_SetError(D, GD_E_BAD_INDEX, 0, NULL, 0, NULL);
+    _GD_SetError(D, GD_E_BAD_INDEX, 0, NULL, fragment_index, NULL);
     dreturn("%i", -1);
     return -1;
   }
@@ -78,7 +74,7 @@ int gd_alter_protection(DIRFILE *D, int protection_level, int fragment_index)
       protection_level != GD_PROTECT_DATA &&
       protection_level != GD_PROTECT_ALL)
   {
-    _GD_SetError(D, GD_E_BAD_PROTECTION, 0, NULL, 0, NULL);
+    _GD_SetError(D, GD_E_ARGUMENT, GD_E_ARG_PROTECTION, NULL, 0, NULL);
     dreturn("%i", -1);
     return -1;
   }
diff --git a/src/putdata.c b/src/putdata.c
index 1744528..5980d4b 100644
--- a/src/putdata.c
+++ b/src/putdata.c
@@ -1,6 +1,6 @@
 /* Copyright (C) 2003-2005 C. Barth Netterfield
  * Copyright (C) 2003-2005 Theodore Kisner
- * Copyright (C) 2005-2010 D. V. Wiebe
+ * Copyright (C) 2005-2012 D. V. Wiebe
  *
  ***************************************************************************
  *
@@ -22,18 +22,10 @@
  */
 #include "internal.h"
 
-#ifdef STDC_HEADERS
-#include <inttypes.h>
-#include <errno.h>
-#include <fcntl.h>
-#include <string.h>
-#include <stdlib.h>
-#endif
-
-static size_t _GD_DoRawOut(DIRFILE *D, gd_entry_t *E, off64_t s0,
-    size_t ns, gd_type_t data_type, const void *data_in)
+static size_t _GD_DoRawOut(DIRFILE *restrict D, gd_entry_t *restrict E,
+    off64_t s0, size_t ns, gd_type_t data_type, const void *restrict data_in)
 {
-  size_t n_wrote;
+  ssize_t n_wrote;
   void *databuffer;
 
   /* check protection */
@@ -44,7 +36,8 @@ static size_t _GD_DoRawOut(DIRFILE *D, gd_entry_t *E, off64_t s0,
     return 0;
   }
 
-  dtrace("%p, %p, %lli, %zu, 0x%x, %p", D, E, s0, ns, data_type, data_in);
+  dtrace("%p, %p, %lli, %" PRNsize_t ", 0x%X, %p", D, E, (long long)s0, ns,
+      data_type, data_in);
 
   if (s0 < D->fragment[E->fragment_index].frame_offset * E->EN(raw,spf)) {
     _GD_SetError(D, GD_E_RANGE, GD_E_OUT_OF_RANGE, NULL, 0, NULL);
@@ -74,7 +67,7 @@ static size_t _GD_DoRawOut(DIRFILE *D, gd_entry_t *E, off64_t s0,
     return 0;
   }
 
-  if (_gd_ef[E->e->u.raw.file[0].encoding].ecor) {
+  if (gd_ef_[E->e->u.raw.file[0].subenc].flags & GD_EF_ECOR) {
     /* convert to/from middle-ended doubles */
     if ((E->EN(raw,data_type) == GD_FLOAT64 || E->EN(raw,data_type) ==
           GD_COMPLEX128) &&
@@ -100,53 +93,48 @@ static size_t _GD_DoRawOut(DIRFILE *D, gd_entry_t *E, off64_t s0,
   }
   /* write data to file. */
 
-  if (E->e->u.raw.file[0].fp < 0) {
-    /* open file for reading / writing if not already opened */
-
-    if (_GD_SetEncodedName(D, E->e->u.raw.file, E->e->u.raw.filebase, 0)) {
-      free(databuffer);
-      dreturn("%i", 0);
-      return 0;
-    } else if ((*_gd_ef[E->e->u.raw.file[0].encoding].open)(E->e->u.raw.file,
-          D->flags & GD_ACCMODE, 1))
-    {
-      _GD_SetError(D, GD_E_RAW_IO, 0, E->e->u.raw.file[0].name, errno, NULL);
-      free(databuffer);
-      dreturn("%i", 0);
-      return 0;
-    }
+  if (_GD_InitRawIO(D, E, NULL, 0, NULL, 0, GD_FILE_WRITE, 0)) {
+    free(databuffer);
+    dreturn("%i", 0);
+    return 0;
   }
 
-  if ((*_gd_ef[E->e->u.raw.file[0].encoding].seek)(E->e->u.raw.file, s0,
-        E->EN(raw,data_type), 1) == -1)
+  if (_GD_WriteSeek(D, E, gd_ef_ + E->e->u.raw.file[0].subenc, s0,
+        GD_FILE_WRITE) == -1)
   {
-      _GD_SetError(D, GD_E_RAW_IO, 0, E->e->u.raw.file[0].name, errno, NULL);
-      free(databuffer);
-      dreturn("%i", 0);
-      return 0;
+    _GD_SetError(D, GD_E_RAW_IO, 0, E->e->u.raw.file[0].name, errno, NULL);
+    free(databuffer);
+    dreturn("%i", 0);
+    return 0;
   }
 
-  n_wrote = (*_gd_ef[E->e->u.raw.file[0].encoding].write)(E->e->u.raw.file,
-      databuffer, E->EN(raw,data_type), ns);
+  n_wrote = _GD_WriteOut(E, gd_ef_ + E->e->u.raw.file[0].subenc, databuffer,
+      E->EN(raw,data_type), ns, 0);
+
+  if (n_wrote < 0) {
+    _GD_SetError(D, GD_E_RAW_IO, 0, E->e->u.raw.file[0].name, errno, NULL);
+    n_wrote = 0;
+  }
 
   free(databuffer);
 
-  dreturn("%zu", n_wrote);
-  return n_wrote;
+  dreturn("%" PRNssize_t, n_wrote);
+  return (size_t)n_wrote;
 }
 
-static size_t _GD_DoLinterpOut(DIRFILE* D, gd_entry_t *E, off64_t first_samp,
-    size_t num_samp, gd_type_t data_type, const void *data_in)
+static size_t _GD_DoLinterpOut(DIRFILE *restrict D, gd_entry_t *restrict E,
+    off64_t first_samp, size_t num_samp, gd_type_t data_type,
+    const void *restrict data_in)
 {
   size_t n_wrote;
   int dir = -1, i;
   double *tmpbuf;
-  struct _gd_lut *tmp_lut;
+  struct gd_lut_ *tmp_lut;
 
-  dtrace("%p, %p, %lli, %zu, 0x%x, %p", D, E, first_samp, num_samp, data_type,
-      data_in);
+  dtrace("%p, %p, %lli, %" PRNsize_t ", 0x%X, %p", D, E, (long long)first_samp,
+      num_samp, data_type, data_in);
 
-  if (_GD_BadInput(D, E, 0)) {
+  if (_GD_BadInput(D, E, 0, 1)) {
     dreturn("%i", 0);
     return 0;
   }
@@ -205,11 +193,10 @@ static size_t _GD_DoLinterpOut(DIRFILE* D, gd_entry_t *E, off64_t first_samp,
   }
 
   /* Make the reverse lut */
-  tmp_lut = (struct _gd_lut *)malloc(E->e->u.linterp.table_len *
-      sizeof(struct _gd_lut));
+  tmp_lut = (struct gd_lut_ *)_GD_Malloc(D, E->e->u.linterp.table_len *
+      sizeof(struct gd_lut_));
   if (tmp_lut == NULL) {
     free(tmpbuf);
-    _GD_SetError(D, GD_E_ALLOC, 0, NULL, 0, NULL);
     dreturn("%i", 0);
     return 0;
   }
@@ -234,18 +221,19 @@ static size_t _GD_DoLinterpOut(DIRFILE* D, gd_entry_t *E, off64_t first_samp,
 
   free(tmpbuf);
 
-  dreturn("%zu", n_wrote);
+  dreturn("%" PRNsize_t, n_wrote);
   return n_wrote;
 }
 
-static size_t _GD_DoLincomOut(DIRFILE* D, gd_entry_t *E, off64_t first_samp,
-    size_t num_samp, gd_type_t data_type, const void *data_in)
+static size_t _GD_DoLincomOut(DIRFILE *restrict D, gd_entry_t *restrict E,
+    off64_t first_samp, size_t num_samp, gd_type_t data_type,
+    const void *restrict data_in)
 {
   size_t n_wrote;
   void* tmpbuf;
 
-  dtrace("%p, %p, %lli, %zu, 0x%x, %p", D, E, first_samp, num_samp, data_type,
-      data_in);
+  dtrace("%p, %p, %lli, %" PRNsize_t ", 0x%X, %p", D, E, (long long)first_samp,
+      num_samp, data_type, data_in);
 
   /* we cannot write to LINCOM fields that are a linear combination */
   /* of more than one raw field (no way to know how to split data). */
@@ -256,7 +244,7 @@ static size_t _GD_DoLincomOut(DIRFILE* D, gd_entry_t *E, off64_t first_samp,
     return 0;
   }
 
-  if (_GD_BadInput(D, E, 0)) {
+  if (_GD_BadInput(D, E, 0, 1)) {
     dreturn("%i", 0);
     return 0;
   }
@@ -309,12 +297,13 @@ static size_t _GD_DoLincomOut(DIRFILE* D, gd_entry_t *E, off64_t first_samp,
       num_samp, data_type, tmpbuf);
   free(tmpbuf);
 
-  dreturn("%zu", n_wrote);
+  dreturn("%" PRNsize_t, n_wrote);
   return n_wrote;
 }
 
-static size_t _GD_DoBitOut(DIRFILE* D, gd_entry_t *E, off64_t first_samp,
-    size_t num_samp, gd_type_t data_type, const void *data_in)
+static size_t _GD_DoBitOut(DIRFILE *restrict D, gd_entry_t *restrict E,
+    off64_t first_samp, size_t num_samp, gd_type_t data_type,
+    const void *restrict data_in)
 {
   uint64_t *tmpbuf;
   uint64_t *readbuf;
@@ -322,10 +311,10 @@ static size_t _GD_DoBitOut(DIRFILE* D, gd_entry_t *E, off64_t first_samp,
   const uint64_t mask = (E->EN(bit,numbits) == 64) ? 0xffffffffffffffffULL :
     ((uint64_t)1 << E->EN(bit,numbits)) - 1;
 
-  dtrace("%p, %p, %lli, %zu, 0x%x, %p", D, E, first_samp, num_samp, data_type,
-      data_in);
+  dtrace("%p, %p, %lli, %" PRNsize_t ", 0x%X, %p", D, E, (long long)first_samp,
+      num_samp, data_type, data_in);
 
-  if (_GD_BadInput(D, E, 0)) {
+  if (_GD_BadInput(D, E, 0, 1)) {
     dreturn("%i", 0);
     return 0;
   }
@@ -367,19 +356,20 @@ static size_t _GD_DoBitOut(DIRFILE* D, gd_entry_t *E, off64_t first_samp,
   free(readbuf);
   free(tmpbuf);
 
-  dreturn("%zu", n_wrote);
+  dreturn("%" PRNsize_t, n_wrote);
   return n_wrote;
 }
 
-static size_t _GD_DoPhaseOut(DIRFILE* D, gd_entry_t *E, off64_t first_samp,
-    size_t num_samp, gd_type_t data_type, const void *data_in)
+static size_t _GD_DoPhaseOut(DIRFILE *restrict D, gd_entry_t *restrict E,
+    off64_t first_samp, size_t num_samp, gd_type_t data_type,
+    const void *restrict data_in)
 {
   size_t n_wrote;
 
-  dtrace("%p, %p, %lli, %zu, 0x%x, %p", D, E, first_samp, num_samp, data_type,
-      data_in);
+  dtrace("%p, %p, %lli, %" PRNsize_t ", 0x%X, %p", D, E, (long long)first_samp,
+      num_samp, data_type, data_in);
 
-  if (_GD_BadInput(D, E, 0)) {
+  if (_GD_BadInput(D, E, 0, 1)) {
     dreturn("%i", 0);
     return 0;
   }
@@ -387,21 +377,22 @@ static size_t _GD_DoPhaseOut(DIRFILE* D, gd_entry_t *E, off64_t first_samp,
   n_wrote = _GD_DoFieldOut(D, E->e->entry[0], E->e->repr[0], first_samp +
       E->EN(phase,shift), num_samp, data_type, data_in);
 
-  dreturn("%zu", n_wrote);
+  dreturn("%" PRNsize_t, n_wrote);
 
   return n_wrote;
 }
 
-static size_t _GD_DoRecipOut(DIRFILE* D, gd_entry_t *E, off64_t first_samp,
-    size_t num_samp, gd_type_t data_type, const void *data_in)
+static size_t _GD_DoRecipOut(DIRFILE *restrict D, gd_entry_t *restrict E,
+    off64_t first_samp, size_t num_samp, gd_type_t data_type,
+    const void *restrict data_in)
 {
   size_t n_wrote;
   void* tmpbuf;
 
-  dtrace("%p, %p, %lli, %zu, 0x%x, %p", D, E, first_samp, num_samp, data_type,
-      data_in);
+  dtrace("%p, %p, %lli, %" PRNsize_t ", 0x%X, %p", D, E, (long long)first_samp,
+      num_samp, data_type, data_in);
 
-  if (_GD_BadInput(D, E, 0)) {
+  if (_GD_BadInput(D, E, 0, 1)) {
     dreturn("%i", 0);
     return 0;
   }
@@ -432,19 +423,20 @@ static size_t _GD_DoRecipOut(DIRFILE* D, gd_entry_t *E, off64_t first_samp,
       num_samp, data_type, tmpbuf);
   free(tmpbuf);
 
-  dreturn("%zu", n_wrote);
+  dreturn("%" PRNsize_t, n_wrote);
 
   return n_wrote;
 }
 
-static size_t _GD_DoPolynomOut(DIRFILE* D, gd_entry_t *E, off64_t first_samp,
-    size_t num_samp, gd_type_t data_type, const void *data_in)
+static size_t _GD_DoPolynomOut(DIRFILE *restrict D, gd_entry_t *restrict E,
+    off64_t first_samp, size_t num_samp, gd_type_t data_type,
+    const void *restrict data_in)
 {
   size_t n_wrote;
   void* tmpbuf;
 
-  dtrace("%p, %p, %lli, %zu, 0x%x, %p", D, E, first_samp, num_samp, data_type,
-      data_in);
+  dtrace("%p, %p, %lli, %" PRNsize_t ", 0x%X, %p", D, E, (long long)first_samp,
+      num_samp, data_type, data_in);
 
   /* we cannot write to POLYNOM fields that are quadradic or higher order */
 
@@ -454,7 +446,7 @@ static size_t _GD_DoPolynomOut(DIRFILE* D, gd_entry_t *E, off64_t first_samp,
     return 0;
   }
 
-  if (_GD_BadInput(D, E, 0)) {
+  if (_GD_BadInput(D, E, 0, 1)) {
     dreturn("%i", 0);
     return 0;
   }
@@ -513,81 +505,175 @@ static size_t _GD_DoPolynomOut(DIRFILE* D, gd_entry_t *E, off64_t first_samp,
       num_samp, data_type, tmpbuf);
   free(tmpbuf);
 
-  dreturn("%zu", n_wrote);
+  dreturn("%" PRNsize_t, n_wrote);
   return n_wrote;
 }
 
-static size_t _GD_DoConstOut(DIRFILE* D, gd_entry_t *E, off64_t first,
-    size_t len, gd_type_t data_type, const void *data_in)
+#define MPLEX(t) \
+  for (i = 0; i < n; i++) \
+    if (B[i] == val) \
+      ((t*)A)[i] = ((t*)C)[i * spfB / spfA];
+
+#define MPLEXC(t) \
+  do { \
+    for (i = 0; i < n; i++) \
+      if (B[i] == val) { \
+        ((t*)A)[i * 2] = ((t*)C)[i * spfB / spfA]; \
+        ((t*)A)[i * 2 + 1] = ((t*)C)[i * spfB / spfA + 1]; \
+      } \
+  } while (0)
+
+static void _GD_MplexOutData(DIRFILE *restrict D, void *restrict A,
+    unsigned int spfA, const int *restrict B, unsigned int spfB,
+    const void *restrict C, gd_type_t type, int val, size_t n)
 {
-  dtrace("%p, %p, %lli, %zu, 0x%x, %p", D, E, first, len, data_type, data_in);
+  size_t i;
+
+  dtrace("%p, %p, %u, %p, %u, %p, 0x%X %i, %" PRNsize_t, D, A, spfA, B, spfB, C,
+      type, val, n);
+
+  switch (type) {
+    case GD_NULL:                        break;
+    case GD_UINT8:      MPLEX( uint8_t); break;
+    case GD_INT8:       MPLEX(  int8_t); break;
+    case GD_UINT16:     MPLEX(uint16_t); break;
+    case GD_INT16:      MPLEX( int16_t); break;
+    case GD_UINT32:     MPLEX(uint32_t); break;
+    case GD_INT32:      MPLEX( int32_t); break;
+    case GD_UINT64:     MPLEX(uint64_t); break;
+    case GD_INT64:      MPLEX( int64_t); break;
+    case GD_FLOAT32:    MPLEX(   float); break;
+    case GD_FLOAT64:    MPLEX(  double); break;
+    case GD_COMPLEX64:  MPLEXC(  float); break;
+    case GD_COMPLEX128: MPLEXC( double); break;
+    default:            _GD_SetError(D, GD_E_BAD_TYPE, type, NULL, 0, NULL);
+                        break;
+  }
+
+  dreturnvoid();
+}
 
-  /* check protection */
-  if (D->fragment[E->fragment_index].protection & GD_PROTECT_FORMAT)
-    _GD_SetError(D, GD_E_PROTECTED, GD_E_PROTECTED_FORMAT, NULL, 0,
-        D->fragment[E->fragment_index].cname);
-  else {
-    gd_type_t type = _GD_ConstType(D, E->EN(scalar,const_type));
-    _GD_ConvertType(D, data_in, data_type, (char*)E->e->u.scalar.d + first *
-        GD_SIZE(type), type, len);
+static size_t _GD_DoMplexOut(DIRFILE *restrict D, gd_entry_t *restrict E,
+    off64_t first_samp, size_t num_samp, gd_type_t data_type,
+    const void *restrict data_in)
+{
+  size_t n_wrote = 0, num_samp2;
+  void *tmpbuf;
+  int *cntbuf;
+  off64_t first_samp2;
+  unsigned int spf1, spf2;
+
+  dtrace("%p, %p, %lli, %" PRNsize_t ", 0x%X, %p", D, E, (long long)first_samp,
+      num_samp, data_type, data_in);
+
+  if (_GD_BadInput(D, E, 0, 1)) {
+    dreturn("%i", 0);
+    return 0;
   }
 
-  if (D->error) { /* bad input type */
+  if (_GD_BadInput(D, E, 1, 1)) {
     dreturn("%i", 0);
     return 0;
   }
 
-  D->fragment[E->fragment_index].modified = 1;
+  /* read the data to be modified */
+  spf1 = _GD_GetSPF(D, E->e->entry[0]);
+  spf2 = _GD_GetSPF(D, E->e->entry[1]);
 
-  dreturn("%i", 1);
-  return 1;
+  if (D->error) {
+    dreturn("%i", 0);
+    return 0;
+  }
+
+  num_samp2 = (int)ceil((double)num_samp * spf2 / spf1);
+  first_samp2 = first_samp * spf2 / spf1;
+
+  tmpbuf = _GD_Alloc(D, data_type, num_samp);
+  cntbuf = (int*)_GD_Alloc(D, GD_INT_TYPE, num_samp2);
+
+  if (tmpbuf == NULL || cntbuf == NULL) {
+    free(tmpbuf);
+    dreturn("%i", 0);
+    return 0;
+  }
+
+  memset(tmpbuf, 0, num_samp * GD_SIZE(data_type));
+  memset(cntbuf, 0, num_samp2 * GD_SIZE(GD_INT_TYPE));
+
+  _GD_DoField(D, E->e->entry[0], E->e->repr[0], first_samp, num_samp, data_type,
+      tmpbuf);
+
+  _GD_DoField(D, E->e->entry[1], E->e->repr[1], first_samp2, num_samp2,
+      GD_INT_TYPE, cntbuf);
+
+  if (D->error != GD_E_OK) {
+    free(cntbuf);
+    free(tmpbuf);
+    dreturn("%i", 0);
+    return 0;
+  }
+
+  /* enmultiplex the data */
+  _GD_MplexOutData(D, tmpbuf, spf1, cntbuf, spf2, data_in, data_type,
+      E->EN(mplex,count_val), num_samp);
+  free(cntbuf);
+
+  /* and write it. */
+  if (!D->error)
+    n_wrote = _GD_DoFieldOut(D, E->e->entry[0], E->e->repr[0], first_samp,
+        num_samp, data_type, tmpbuf);
+  free(tmpbuf);
+
+  dreturn("%" PRNsize_t, n_wrote);
+  return n_wrote;
 }
 
-static size_t _GD_DoStringOut(DIRFILE* D, gd_entry_t *E, const char *data_in)
+static size_t _GD_DoConstOut(DIRFILE *restrict D, gd_entry_t *restrict E,
+    off64_t first, size_t len, gd_type_t data_type,
+    const void *restrict data_in)
 {
-  char* ptr = E->e->u.string;
-
-  dtrace("%p, %p, %p", D, E, data_in);
+  dtrace("%p, %p, %lli, %" PRNsize_t ", 0x%X, %p", D, E, (long long)first, len,
+      data_type, data_in);
 
   /* check protection */
-  if (D->fragment[E->fragment_index].protection & GD_PROTECT_FORMAT) {
+  if (D->fragment[E->fragment_index].protection & GD_PROTECT_FORMAT)
     _GD_SetError(D, GD_E_PROTECTED, GD_E_PROTECTED_FORMAT, NULL, 0,
         D->fragment[E->fragment_index].cname);
-    dreturn("%i", 0);
-    return 0;
+  else {
+    gd_type_t type = _GD_ConstType(D, E->EN(scalar,const_type));
+    _GD_ConvertType(D, data_in, data_type, (char*)E->e->u.scalar.d + first *
+        GD_SIZE(type), type, len);
   }
 
-  E->e->u.string = strdup(data_in);
-  if (E->e->u.string == NULL) {
-    E->e->u.string = ptr;
-    _GD_SetError(D, GD_E_ALLOC, 0, NULL, 0, NULL);
+  if (D->error) { /* bad input type */
     dreturn("%i", 0);
     return 0;
   }
-  free(ptr);
+
   D->fragment[E->fragment_index].modified = 1;
 
-  dreturn("%zu", strlen(E->e->u.string) + 1);
-  return strlen(E->e->u.string) + 1;
+  dreturn("%i", 1);
+  return 1;
 }
 
-size_t _GD_DoFieldOut(DIRFILE *D, gd_entry_t* E, int repr, off64_t first_samp,
-    size_t num_samp, gd_type_t data_type, const void *data_in)
+size_t _GD_DoFieldOut(DIRFILE *restrict D, gd_entry_t *restrict E, int repr,
+    off64_t first_samp, size_t num_samp, gd_type_t data_type,
+    const void *restrict data_in)
 {
   size_t n_wrote = 0;
 
-  dtrace("%p, %p, %i, %lli, %zu, 0x%x, %p", D, E, repr, first_samp, num_samp,
-      data_type, data_in);
+  dtrace("%p, %p, %i, %lli, %" PRNsize_t ", 0x%X, %p", D, E, repr,
+      (long long)first_samp, num_samp, data_type, data_in);
 
   if (++D->recurse_level >= GD_MAX_RECURSE_LEVEL) {
-    _GD_SetError(D, GD_E_RECURSE_LEVEL, 0, NULL, 0, E->field);
+    _GD_SetError(D, GD_E_RECURSE_LEVEL, GD_E_RECURSE_CODE, NULL, 0, E->field);
     D->recurse_level--;
     dreturn("%i", 0);
     return 0;
   }
 
   if (!E->e->calculated)
-    _GD_CalculateEntry(D, E);
+    _GD_CalculateEntry(D, E, 1);
 
   if (D->error) {
     dreturn("%i", 0);
@@ -602,6 +688,13 @@ size_t _GD_DoFieldOut(DIRFILE *D, gd_entry_t* E, int repr, off64_t first_samp,
     return 0;
   }
 
+  /* this call will throw GD_E_DOMAIN if a problem arises; however, that only
+   * happens in cases where the field has multiple inputs, which putdata will
+   * reject anyways; so we ignore this error for a more relevant one later
+   */
+  if (first_samp == GD_HERE)
+    first_samp = _GD_GetFilePos(D, E, -1);
+
   switch (E->field_type) {
     case GD_RAW_ENTRY:
       n_wrote = _GD_DoRawOut(D, E, first_samp, num_samp, data_type, data_in);
@@ -617,8 +710,12 @@ size_t _GD_DoFieldOut(DIRFILE *D, gd_entry_t* E, int repr, off64_t first_samp,
     case GD_SBIT_ENTRY:
       n_wrote = _GD_DoBitOut(D, E, first_samp, num_samp, data_type, data_in);
       break;
+    case GD_MPLEX_ENTRY:
+      n_wrote = _GD_DoMplexOut(D, E, first_samp, num_samp, data_type, data_in);
+      break;
     case GD_MULTIPLY_ENTRY:
     case GD_DIVIDE_ENTRY:
+    case GD_WINDOW_ENTRY:
     case GD_INDEX_ENTRY:
       _GD_SetError(D, GD_E_BAD_FIELD_TYPE, GD_E_FIELD_PUT, NULL, 0, E->field);
       break;
@@ -637,15 +734,14 @@ size_t _GD_DoFieldOut(DIRFILE *D, gd_entry_t* E, int repr, off64_t first_samp,
       n_wrote = _GD_DoConstOut(D, E, first_samp, num_samp, data_type, data_in);
       break;
     case GD_STRING_ENTRY:
-      n_wrote = _GD_DoStringOut(D, E, (const char *)data_in);
-      break;
+    case GD_ALIAS_ENTRY:
     case GD_NO_ENTRY:
       _GD_InternalError(D);
       break;
   }
 
   D->recurse_level--;
-  dreturn("%zu", n_wrote);
+  dreturn("%" PRNsize_t, n_wrote);
   return n_wrote;
 }
 
@@ -658,10 +754,11 @@ size_t gd_putdata64(DIRFILE* D, const char *field_code_in, off64_t first_frame,
   gd_entry_t *entry;
   char* field_code;
   int repr;
-  gd_spf_t spf;
+  unsigned int spf = 0;
 
-  dtrace("%p, \"%s\", %lli, %lli, %zu, %zu, 0x%x, %p", D, field_code_in,
-      first_frame, first_samp, num_frames, num_samp, data_type, data_in);
+  dtrace("%p, \"%s\", %lli, %lli, %" PRNsize_t ", %" PRNsize_t ", 0x%X, %p", D,
+      field_code_in, (long long)first_frame, (long long)first_samp, num_frames,
+      num_samp, data_type, data_in);
 
   if (D->flags & GD_INVALID) {/* don't crash */
     _GD_SetError(D, GD_E_BAD_DIRFILE, 0, NULL, 0, NULL);
@@ -677,14 +774,15 @@ size_t gd_putdata64(DIRFILE* D, const char *field_code_in, off64_t first_frame,
 
   _GD_ClearError(D);
 
-  entry = _GD_FindFieldAndRepr(D, field_code_in, &field_code, &repr, NULL, 1);
+  entry = _GD_FindFieldAndRepr(D, field_code_in, &field_code, &repr, NULL, 1,
+      1);
 
   if (D->error) {
     dreturn("%i", 0);
     return 0;
   }
 
-  if (entry->field_type & GD_SCALAR_ENTRY)
+  if (entry->field_type & GD_SCALAR_ENTRY_BIT)
     _GD_SetError(D, GD_E_DIMENSION, GD_E_DIM_CALLER, NULL, 0, field_code);
 
   if (field_code != field_code_in)
@@ -695,21 +793,40 @@ size_t gd_putdata64(DIRFILE* D, const char *field_code_in, off64_t first_frame,
     return 0;
   }
 
-  /* get the samples per frame */
-  spf = _GD_GetSPF(D, entry);
+  if (first_frame == GD_HERE || first_samp == GD_HERE) {
+    first_samp = GD_HERE;
+    first_frame = 0;
+  }
 
-  if (D->error) {
+  if (num_frames > 0 || first_frame > 0) {
+    /* get the samples per frame */
+    spf = _GD_GetSPF(D, entry);
+
+    if (D->error) {
+      dreturn("%i", 0);
+      return 0;
+    }
+
+    first_samp += spf * first_frame;
+    num_samp += spf * num_frames;
+  }
+
+  if (first_samp < 0 && (first_samp != GD_HERE || first_frame != 0)) {
+    _GD_SetError(D, GD_E_RANGE, GD_E_OUT_OF_RANGE, NULL, 0, NULL);
     dreturn("%i", 0);
     return 0;
   }
 
-  first_samp += spf * first_frame;
-  num_samp += spf * num_frames;
-
+  /* the easy case */
+  if (num_samp == 0) {
+    dreturn("%u", 0);
+    return 0;
+  }
+ 
   n_wrote = _GD_DoFieldOut(D, entry, repr, first_samp, num_samp, data_type,
       data_in);
 
-  dreturn("%zu", n_wrote);
+  dreturn("%" PRNsize_t, n_wrote);
   return n_wrote;
 }
 
diff --git a/src/raw.c b/src/raw.c
index ee92da1..6813453 100644
--- a/src/raw.c
+++ b/src/raw.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008, 2010 D. V. Wiebe
+/* Copyright (C) 2008, 2010, 2011 D. V. Wiebe
  *
  ***************************************************************************
  *
@@ -20,101 +20,121 @@
  */
 #include "internal.h"
 
-#ifdef STDC_HEADERS
-#include <stdlib.h>
-#include <sys/stat.h>
-#include <sys/types.h>
-#include <fcntl.h>
-#include <errno.h>
-#endif
-
-int _GD_RawOpen(struct _gd_raw_file* file, int mode, int creat)
+int _GD_RawOpen(int fd, struct gd_raw_file_* file, int swap gd_unused_,
+    unsigned int mode)
 {
-  dtrace("%p, %i, %i", file, mode, creat);
+  dtrace("%i, %p, <unused>, 0x%X", fd, file, mode);
+
+  if (!(mode & GD_FILE_TEMP)) {
+    if (file->mode & mode) {
+      dreturn("%i", 0);
+      return 0;
+    } else if (file->idata >= 0)
+      close(file->idata);
 
-  file->fp = open(file->name, ((mode == GD_RDWR) ? O_RDWR : O_RDONLY) |
-      (creat ? O_CREAT : 0) | O_BINARY, 0666);
+    file->idata = gd_OpenAt(file->D, fd, file->name, ((mode & GD_FILE_WRITE) ?
+          (O_RDWR | O_CREAT) : O_RDONLY) | O_BINARY, 0666);
+  } else
+    file->idata = fd;
 
-  dreturn("%i", file->fp < 0);
-  return (file->fp < 0);
+  file->pos = 0;
+  file->mode = mode | GD_FILE_READ;
+
+  dreturn("%i", file->idata < 0);
+  return (file->idata < 0);
 }
 
-off64_t _GD_RawSeek(struct _gd_raw_file* file, off64_t count,
-    gd_type_t data_type, int pad __gd_unused)
+off64_t _GD_RawSeek(struct gd_raw_file_* file, off64_t count,
+    gd_type_t data_type, unsigned int mode gd_unused_)
 {
   off64_t pos;
 
-  dtrace("%p, %lli, %x, <unused>", file, (long long)count, data_type);
+  dtrace("%p, %lli, 0x%X, <unused>", file, (long long)count, data_type);
+
+  /* short circuit */
+  if (file->pos == count) {
+    dreturn("%lli", (long long)count);
+    return count;
+  }
 
-  pos = lseek64(file->fp, count * GD_SIZE(data_type), SEEK_SET);
+  pos = lseek64(file->idata, count * GD_SIZE(data_type), SEEK_SET);
 
   if (pos == -1) {
     dreturn("%i", -1);
     return -1;
   }
 
+  file->pos = count;
+
   dreturn("%lli", (long long)count);
   return count;
 }
 
-ssize_t _GD_RawRead(struct _gd_raw_file *file, void *ptr, gd_type_t data_type,
-    size_t nmemb)
+ssize_t _GD_RawRead(struct gd_raw_file_ *restrict file, void *restrict ptr,
+    gd_type_t data_type, size_t nmemb)
 {
   ssize_t nread;
 
-  dtrace("%p, %p, %x, %zu", file, ptr, data_type, nmemb);
+  dtrace("%p, %p, 0x%X, %" PRNsize_t, file, ptr, data_type, nmemb);
 
-  nread = read(file->fp, ptr, nmemb * GD_SIZE(data_type));
+  nread = read(file->idata, ptr, nmemb * GD_SIZE(data_type));
 
-  if (nread >= 0)
+  if (nread >= 0) {
     nread /= GD_SIZE(data_type);
+    file->pos += nread;
+  }
 
-  dreturn("%zi", nread);
+  dreturn("%" PRNssize_t, nread);
   return nread;
 }
 
-ssize_t _GD_RawWrite(struct _gd_raw_file *file, const void *ptr,
-    gd_type_t data_type, size_t nmemb)
+ssize_t _GD_RawWrite(struct gd_raw_file_ *restrict file,
+    const void *restrict ptr, gd_type_t data_type, size_t nmemb)
 {
   ssize_t nwrote;
 
-  dtrace("%p, %p, %x, %zu", file, ptr, data_type, nmemb);
+  dtrace("%p, %p, 0x%X, %" PRNsize_t, file, ptr, data_type, nmemb);
 
-  nwrote = write(file->fp, ptr, nmemb * GD_SIZE(data_type));
+  nwrote = write(file->idata, ptr, nmemb * GD_SIZE(data_type));
 
-  if (nwrote >= 0)
+  if (nwrote >= 0) {
     nwrote /= GD_SIZE(data_type);
+    file->pos += nwrote;
+  }
 
-  dreturn("%zu", nwrote);
+  dreturn("%" PRNsize_t, nwrote);
   return nwrote;
 }
 
-int _GD_RawSync(struct _gd_raw_file *file)
+int _GD_RawSync(struct gd_raw_file_ *file)
 {
-  return fsync(file->fp);
+  return fsync(file->idata);
 }
 
-int _GD_RawClose(struct _gd_raw_file *file)
+int _GD_RawClose(struct gd_raw_file_ *file)
 {
   int ret;
 
   dtrace("%p", file);
 
-  ret = close(file->fp);
-  if (!ret)
-    file->fp = -1;
+  ret = close(file->idata);
+  if (!ret) {
+    file->idata = -1;
+    file->mode = 0;
+  }
 
   dreturn("%i", ret);
   return ret;
 }
 
-off64_t _GD_RawSize(struct _gd_raw_file *file, gd_type_t data_type)
+off64_t _GD_RawSize(int dirfd, struct gd_raw_file_ *file, gd_type_t data_type,
+    int swap gd_unused_)
 {
   gd_stat64_t statbuf;
 
-  dtrace("%p, %x", file, data_type);
+  dtrace("%i, %p, 0x%X, <unused>", dirfd, file, data_type);
 
-  if (gd_stat64(file->name, &statbuf) < 0)  {
+  if (gd_StatAt64(file->D, dirfd, file->name, &statbuf, 0) < 0)  {
     dreturn("%lli", -1LL);
     return -1;
   }
@@ -122,65 +142,3 @@ off64_t _GD_RawSize(struct _gd_raw_file *file, gd_type_t data_type)
   dreturn("%lli", (long long)statbuf.st_size);
   return statbuf.st_size / GD_SIZE(data_type);
 }
-
-int _GD_RawTemp(struct _gd_raw_file *file, int method)
-{
-  struct stat stat_buf;
-  int move_error = 0;
-  mode_t mode;
-
-  dtrace("%p, %i", file, method);
-
-  switch(method) {
-    case GD_TEMP_OPEN:
-      file[1].fp = mkstemp(file[1].name);
-
-      if (file[1].fp == -1) {
-        dreturn("%i", -1);
-        return -1;
-      }
-      break;
-    case GD_TEMP_MOVE:
-      if (file[1].name == NULL)
-        break;
-
-      if (stat(file[0].name, &stat_buf))
-        mode = 0644;
-      else
-        mode = stat_buf.st_mode;
-
-      if (!_GD_Rename(file[1].name, file[0].name)) {
-        chmod(file[0].name, mode);
-        free(file[1].name);
-        file[1].name = NULL;
-        dreturn("%i", 0);
-        return 0;
-      }
-      /* fallthrough on error */
-    case GD_TEMP_DESTROY:
-      if (file[1].name != NULL) {
-        if (file[1].fp >= 0)
-          if (_GD_RawClose(file + 1)) {
-            dreturn("%i", -1);
-            return -1;
-          }
-
-        if (unlink(file[1].name)) {
-          dreturn("%i", -1);
-          return -1;
-        }
-
-        if (method == GD_TEMP_MOVE) {
-          errno = move_error;
-          dreturn("%i", -1);
-          return -1;
-        }
-        free(file[1].name);
-        file[1].name = NULL;
-      }
-      break;
-  }
-
-  dreturn("%i", 0);
-  return 0;
-}
diff --git a/src/sie.c b/src/sie.c
new file mode 100644
index 0000000..027aa86
--- /dev/null
+++ b/src/sie.c
@@ -0,0 +1,519 @@
+/* Copyright (C) 2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+#include "internal.h"
+
+struct gd_siedata {
+  int swap;
+  ssize_t r;
+  int64_t p;
+  int64_t s;
+  FILE *fp;
+  int64_t d[3];
+};
+
+static int _GD_SampIndDoOpen(int fdin, struct gd_raw_file_ *file,
+    struct gd_siedata *f, int swap, unsigned int mode)
+{
+  int fd;
+  FILE *stream;
+
+  dtrace("%i, %p, %i, 0x%X", fdin, file, swap, mode);
+
+  if (!(mode & GD_FILE_TEMP)) {
+    fd = gd_OpenAt(file->D, fdin, file->name, ((mode & GD_FILE_WRITE) ?
+          (O_RDWR | O_CREAT) : O_RDONLY) | O_BINARY, 0666);
+
+    if (fd < 0) {
+      dreturn("%i", -1);
+      return -1;
+    }
+  } else
+    fd = fdin;
+
+  stream = fdopen(fd, (mode & GD_FILE_WRITE) ? "rb+" : "rb");
+
+  if (stream == NULL) {
+    close(fd);
+    dreturn("%i", -1);
+    return -1;
+  }
+
+  memset(f, 0, sizeof(struct gd_siedata));
+  f->r = f->s = f->p = f->d[0] = -1;
+  f->fp = stream;
+  f->swap = swap;
+  dreturn("%i", fd);
+  return fd;
+}
+
+int _GD_SampIndOpen(int fd, struct gd_raw_file_ *file, int swap,
+    unsigned int mode)
+{
+  dtrace("%i, %p, %i, 0x%X", fd, file, swap, mode);
+
+  if (file->mode & mode) {
+    dreturn("%i", 0);
+    return 0;
+  } else if (file->edata)
+    fclose(((struct gd_siedata *)(file->edata))->fp);
+  else
+    file->edata = malloc(sizeof(struct gd_siedata));
+
+  if (file->edata == NULL) {
+    dreturn("%i", -1);
+    return -1;
+  }
+
+  file->idata = _GD_SampIndDoOpen(fd, file, (struct gd_siedata*)file->edata,
+      swap, mode);
+
+  if (file->idata < 0) {
+    free(file->edata);
+    dreturn("%i", -1);
+    return -1;
+  }
+
+  file->mode = mode;
+  file->pos = 0;
+  dreturn("%i", 0);
+  return 0;
+}
+
+/* advance one record, with byte swapping and error checking; returns -1 on EOF,
+ * -2 on error */
+static int _GD_Advance(struct gd_siedata *f, size_t size)
+{
+  int64_t p[3];
+  size_t n;
+  dtrace("%p, %" PRNsize_t, f, size);
+
+  /* save the current record */
+  memcpy(p, f->d, 3 * sizeof(int64_t));
+
+  /* read the next record */
+  n = fread(f->d, size, 1, f->fp);
+  if (f->swap)
+    f->d[0] = gd_swap64(f->d[0]);
+
+  if (n != 1) {
+    if (ferror(f->fp)) {
+      dreturn("%i", -2);
+      return -2;
+    } else {
+      f->s = f->d[0];
+      f->p = f->d[0] + 1;
+      dreturn("%i", -1);
+      return -1;
+    }
+  }
+
+  f->s = f->p = p[0] + 1;
+  f->r++;
+
+  dreturn("%i", 0);
+  return 0;
+}
+
+off64_t _GD_SampIndSeek(struct gd_raw_file_ *file, off64_t sample,
+    gd_type_t data_type, unsigned int mode)
+{
+  int r;
+  const size_t size = sizeof(int64_t) + GD_SIZE(data_type);
+  struct gd_siedata *f = (struct gd_siedata*)(file->edata);
+
+  dtrace("%p, %llx, 0x%X, 0x%X", file, (long long)sample, data_type, mode);
+
+  if (file->pos == sample && f->p >= 0) {
+    dreturn("%lli", (long long)sample);
+    return sample;
+  }
+
+  if (sample < f->p) {
+    /* seek backwards -- reading a file backwards doesn't necessarily work
+     * that well.  So, let's just rewind to the beginning and try again. */
+    rewind(f->fp);
+    file->idata = 0;
+    f->r = f->p = f->d[0] = -1;
+  }
+
+  while (sample > f->d[0]) {
+    /* seek ahead ... */
+    r = _GD_Advance(f, size);
+    if (r == -2) {
+      dreturn("%i", -1);
+      return -1;
+    } else if (r == -1)
+      break;
+  }
+
+  if ((mode & GD_FILE_WRITE) && sample > f->d[0]) {
+    GD_DCOMPLEXM(p);
+    gd_li2cs_(p, 0, 0);
+    if (memcmp(f->d + 1, &p, GD_SIZE(data_type)) == 0) {
+      /* in this case, just increase the current record's end */
+      f->d[0] = sample;
+      /* back up and update the file */
+      fseek(f->fp, -size, SEEK_CUR);
+      fwrite(f->d, size, 1, f->fp);
+      /* The MSVCRT's stdio seems to screw up without the following: */
+      fflush(f->fp);
+    } else {
+      /* add a new record */
+      f->d[0] = sample;
+      f->d[1] = f->d[2] = 0;
+      fwrite(f->d, size, 1, f->fp);
+      fflush(f->fp);
+    }
+    f->s = sample;
+  }
+  file->pos = f->p = sample;
+
+  dreturn("%" PRIi64 , f->p);
+  return (off64_t)(f->p);
+}
+
+/* store n copies of s, which is of length l, in d */
+static void *_GD_Duplicate(void *restrict d, const void *restrict s, size_t l,
+    int64_t n)
+{
+  int64_t i;
+  dtrace("%p, %p, %" PRNsize_t ", 0x%llx", d, s, l, (long long)n);
+
+  if (n > 0) {
+    if (l == 1) {
+      memset(d, *(char*)s, (size_t)n);
+      d = (char*)d + n;
+    } else if (l == 2) {
+      uint16_t v = *(uint16_t*)s;
+      uint16_t *p = (uint16_t*)d;
+      for (i = 0; i < n; ++i)
+        *(p++) = v;
+      d = p;
+    } else if (l == 4) {
+      uint32_t v = *(uint32_t*)s;
+      uint32_t *p = (uint32_t*)d;
+      for (i = 0; i < n; ++i)
+        *(p++) = v;
+      d = p;
+    } else if (l == 8) {
+      uint64_t v = *(uint64_t*)s;
+      uint64_t *p = (uint64_t*)d;
+      for (i = 0; i < n; ++i)
+        *(p++) = v;
+      d = p;
+    } else if (l == 16) {
+#ifndef GD_NO_C99_API
+      double complex v = *(double complex*)s;
+      double complex *p = (double complex*)d;
+      for (i = 0; i < n; ++i)
+        *(p++) = v;
+#else
+      double v[2];
+      double *p = (double *)d;
+      v[0] = ((double*)s)[0];
+      v[1] = ((double*)s)[1];
+      for (i = 0; i < n; ++i) {
+        *(p++) = v[0];
+        *(p++) = v[1];
+      }
+#endif
+      d = p;
+    }
+  }
+
+  dreturn("%p", d);
+  return d;
+}
+
+ssize_t _GD_SampIndRead(struct gd_raw_file_ *restrict file, void *restrict ptr,
+    gd_type_t data_type, size_t nelem)
+{
+  int r;
+  ssize_t count = 0;
+  struct gd_siedata *f = (struct gd_siedata*)(file->edata);
+  void *cur = ptr;
+
+  dtrace("%p, %p, 0x%03x, %" PRNsize_t, file, ptr, data_type, nelem);
+
+  /* not enough data in the current run */
+  while (f->d[0] - f->p < (int64_t)(nelem - count)) {
+    /* copy what we've got */
+    cur = _GD_Duplicate(cur, f->d + 1, GD_SIZE(data_type), f->d[0] - f->p + 1);
+    count += f->d[0] - f->p + 1;
+
+    /* advance */
+    r = _GD_Advance(f, sizeof(int64_t) + GD_SIZE(data_type));
+    if (r == -2) {
+      dreturn("%i", -1);
+      return -1;
+    } else if (r == -1)
+      break;
+  }
+
+  /* copy the remnant */
+  if (f->d[0] - f->p >= (int64_t)(nelem - count)) {
+    _GD_Duplicate(cur, f->d + 1, GD_SIZE(data_type), nelem - count);
+    f->p += nelem - count;
+    count = nelem;
+  } else {
+    cur = _GD_Duplicate(cur, f->d + 1, GD_SIZE(data_type), f->d[0] - f->p + 1);
+    count += f->d[0] - f->p + 1;
+    f->p = f->d[0] + 1;
+  }
+
+  file->pos = f->p;
+
+  dreturn("%lli", (long long)count);
+  return count;
+}
+
+/* return the number of records in the file */
+static ssize_t _GD_GetNRec(struct gd_siedata *f, size_t size)
+{
+  gd_stat64_t statbuf;
+  dtrace("%p, %" PRNsize_t, f, size);
+
+  if (gd_fstat64(fileno(f->fp), &statbuf)) {
+    dreturn("%i", -1);
+    return -1;
+  }
+
+  dreturn("%" PRNssize_t, (ssize_t)(statbuf.st_size / size));
+  return (ssize_t)(statbuf.st_size / size);
+}
+
+ssize_t _GD_SampIndWrite(struct gd_raw_file_ *restrict file,
+    const void *restrict ptr, gd_type_t data_type, size_t nelem)
+{
+  ssize_t nrec;
+  void *p;
+  size_t i;
+  ssize_t rin = 0, rout = 0, plen = 10;
+  int64_t fr;
+  int r;
+  int64_t *cur_end;
+  void *cur_datum, *buffer;
+  struct gd_siedata *f = (struct gd_siedata*)(file->edata);
+  const size_t dlen = GD_SIZE(data_type);
+  const size_t size = sizeof(int64_t) + dlen;
+  dtrace("%p, %p, 0x%03x, %" PRNsize_t, file, ptr, data_type, nelem);
+
+  if ((nrec = _GD_GetNRec(f, size)) < 0) {
+    dreturn("%i", -1);
+    return -1;
+  }
+
+  /* compress the data in core first, including the current record. */
+  p = malloc(plen * size);
+  memcpy(p, f->d, size);
+  cur_end = (int64_t*)p;
+  cur_datum = ((int64_t*)p) + 1;
+
+  /* to prevent weirdness... */
+  if (f->p == f->s)
+    memcpy(cur_datum, ptr, dlen);
+
+  for (i = 0; i < nelem; ++i) {
+    if (memcmp(((const char*)ptr) + i * dlen, cur_datum, dlen)) {
+      if (++rin == plen) {
+        void *p2;
+        plen += 10;
+        p2 = realloc(p, plen * size);
+        if (p2 == NULL) {
+          free(p);
+          dreturn("%i", -1);
+          return -1;
+        }
+        p = p2;
+      }
+      gd_put_unaligned64(f->p + i - 1, cur_end);
+      cur_end = (int64_t*)((char*)p + size * rin);
+      cur_datum = cur_end + 1;
+      memcpy(cur_datum, ((const char*)ptr) + i * dlen, dlen);
+    }
+  }
+  gd_put_unaligned64(f->p + nelem - 1, cur_end);
+  rin++;
+
+  /* determine how many records we have to replace */
+  fr = f->r;
+  if (fr < 0) {
+    fr = 0;
+    rout--;
+  }
+
+  while (f->d[0] <= gd_get_unaligned64(cur_end)) {
+    ++rout;
+
+    r = _GD_Advance(f, sizeof(int64_t) + GD_SIZE(data_type));
+    if (r == -2) {
+      free(p);
+      dreturn("%i", -1);
+      return -1;
+    } else if (r == -1)
+      break;
+  }
+
+  /* fix the endianness */
+  if (f->swap)
+    for (i = 0; i < (size_t)rin; ++i) {
+      int64_t v = gd_get_unaligned64((int64_t*)(((char*)p) + size * i));
+      gd_put_unaligned64(gd_swap64(v), (int64_t*)(((char*)p) + size * i));
+    }
+
+  /* now, do some moving: first, move the trailing records, forward by
+   * (rin - rout) records */
+  if (nrec - (fr + rout) > 0) {
+    buffer = malloc((nrec - (fr + rout)) * size);
+    if (buffer == NULL) {
+      free(p);
+      dreturn("%i", -1);
+      return -1;
+    }
+    if (fseek(f->fp, (fr + rout) * size, SEEK_SET) ||
+        (fread(buffer, size, nrec - (fr + rout), f->fp)
+         < (size_t)(nrec - (fr + rout))))
+    {
+      free(buffer);
+      free(p);
+      dreturn("%i", -1);
+      return -1;
+    }
+    if (fseek(f->fp, (fr + rin) * size, SEEK_SET) ||
+        (fwrite(buffer, size, nrec - (fr + rout), f->fp)
+         < (size_t)(nrec - (fr + rout))))
+    {
+      free(buffer);
+      free(p);
+      dreturn("%i", -1);
+      return -1;
+    }
+    free(buffer);
+  }
+
+  /* now insert the new records */
+  if (fseek(f->fp, fr * size, SEEK_SET) ||
+      (fwrite(p, size, rin, f->fp) < (size_t)rin))
+  {
+    free(p);
+    dreturn("%i", -1);
+    return -1;
+  }
+
+  /* truncate the file if necessary */
+  if (rin < rout) {
+    if (gd_truncate(fileno(f->fp), (nrec - rout + rin) * size)) {
+      dreturn("%i", -1);
+      return -1;
+    }
+  }
+
+  /* update the current record */
+  memcpy(f->d, (char *)p + (rin - 1) * size, size);
+  f->s = f->d[0];
+  f->p = f->d[0] + 1;
+  f->r = fr + rin - 1;
+
+  free(p);
+
+  file->pos = f->p;
+  dreturn("%llu", (unsigned long long)nelem);
+  return nelem;
+}
+
+int _GD_SampIndSync(struct gd_raw_file_ *file)
+{
+  int ret;
+  struct gd_siedata *f = (struct gd_siedata*)(file->edata);
+
+  dtrace("%p", file);
+
+  ret = fflush(f->fp);
+
+  if (!ret)
+    ret = fsync(fileno(f->fp));
+
+  dreturn("%i", ret);
+  return ret;
+}
+
+int _GD_SampIndClose(struct gd_raw_file_* file)
+{
+  int ret;
+  struct gd_siedata *f = (struct gd_siedata*)(file->edata);
+
+  dtrace("%p", file);
+
+  ret = fclose(f->fp);
+  if (ret != EOF) {
+    file->mode = 0;
+    file->idata = -1;
+    free(file->edata);
+    file->edata = NULL;
+    dreturn("%i", 0);
+    return 0;
+  }
+
+  dreturn("%i", 1);
+  return 1;
+}
+
+off64_t _GD_SampIndSize(int dirfd, struct gd_raw_file_* file,
+    gd_type_t data_type, int swap)
+{
+  struct gd_siedata f;
+  ssize_t last_rec;
+  int64_t n;
+  const size_t size = sizeof(int64_t) + GD_SIZE(data_type);
+
+  dtrace("%i, %p, 0x%03x, %i", dirfd, file, data_type, swap);
+
+  /* open */
+  if (_GD_SampIndDoOpen(dirfd, file, &f, swap, GD_FILE_READ) < 0) {
+    dreturn("%i", -1);
+    return -1;
+  }
+
+  /* find the last record */
+  last_rec = _GD_GetNRec(&f, size) - 1;
+
+  /* seek to this record */
+  if (fseeko64(f.fp, last_rec * size, SEEK_SET)) {
+    fclose(f.fp);
+    dreturn("%i", -1);
+    return -1;
+  }
+
+  /* read the sample index */
+  if (fread(&n, sizeof(uint64_t), 1, f.fp) != 1) {
+    fclose(f.fp);
+    dreturn("%i", -1);
+    return -1;
+  }
+
+  if (swap)
+    n = gd_swap64(n);
+
+  fclose(f.fp);
+
+  dreturn("%llx", (long long unsigned)n);
+  return (off64_t)n;
+}
diff --git a/src/slim.c b/src/slim.c
index d7f7af8..8499e05 100644
--- a/src/slim.c
+++ b/src/slim.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008, 2010 D. V. Wiebe
+/* Copyright (C) 2008, 2010, 2011 D. V. Wiebe
  *
  ***************************************************************************
  *
@@ -20,12 +20,6 @@
  */
 #include "internal.h"
 
-#ifdef STDC_HEADERS
-#include <stdlib.h>
-#include <errno.h>
-#include <time.h>
-#endif
-
 #ifdef HAVE_SLIMLIB_H
 #include <slimlib.h>
 #endif
@@ -39,31 +33,42 @@
 #endif
 
 /* The slim encoding scheme uses edata as a slimfile pointer.  If a file is
- * open, fp = 0 otherwise fp = -1. */
+ * open, idata = 0 otherwise idata = -1. */
 
-int _GD_SlimOpen(struct _gd_raw_file* file, int mode __gd_unused,
-    int creat __gd_unused)
+int _GD_SlimOpen(int dirfd, struct gd_raw_file_* file, int swap gd_unused_,
+    unsigned int mode gd_unused_)
 {
-  dtrace("%p, <unused>, <unused>", file);
+  char *filepath;
+
+  dtrace("%i, %p, <unused>, <unused>", dirfd, file);
+
+  /* this is easily broken, but the best we can do for now... */
+  filepath = gd_MakeFullPathOnly(file->D, dirfd, file->name);
+  if (filepath == NULL) {
+    dreturn("%i", 1);
+    return 1;
+  }
 
-  file->edata = slimopen(file->name, "r" /* writing not supported */);
+  file->edata = slimopen(filepath, "r");
+  free(filepath);
 
-  if (file->edata != NULL) {
-    file->fp = 0;
-    dreturn("%i", 0);
-    return 0;
+  if (file->edata == NULL) {
+    dreturn("%i", 1);
+    return 1;
   }
 
-  dreturn("%i", 1);
-  return 1;
+  file->mode = GD_RDONLY;
+  file->idata = 0;
+  dreturn("%i", 0);
+  return 0;
 }
 
-off64_t _GD_SlimSeek(struct _gd_raw_file* file, off64_t count,
-    gd_type_t data_type, int pad __gd_unused)
+off64_t _GD_SlimSeek(struct gd_raw_file_* file, off64_t count,
+    gd_type_t data_type, unsigned int mode gd_unused_)
 {
   off64_t n;
 
-  dtrace("%p, %lli, %x, <unused>", file, (long long)count, data_type);
+  dtrace("%p, %lli, 0x%X, <unused>", file, (long long)count, data_type);
 
   n = (off64_t)slimseek((SLIMFILE *)file->edata, (off_t)count *
       GD_SIZE(data_type), SEEK_SET);
@@ -77,20 +82,20 @@ off64_t _GD_SlimSeek(struct _gd_raw_file* file, off64_t count,
   return n;
 }
 
-ssize_t _GD_SlimRead(struct _gd_raw_file *file, void *ptr, gd_type_t data_type,
-    size_t nmemb)
+ssize_t _GD_SlimRead(struct gd_raw_file_ *restrict file, void *restrict ptr,
+    gd_type_t data_type, size_t nmemb)
 {
   ssize_t n;
 
-  dtrace("%p, %p, %x, %zu", file, ptr, data_type, nmemb);
+  dtrace("%p, %p, 0x%X, %" PRNsize_t, file, ptr, data_type, nmemb);
 
   n = slimread(ptr, GD_SIZE(data_type), nmemb, (SLIMFILE *)file->edata);
 
-  dreturn("%zu", n);
+  dreturn("%" PRNsize_t, n);
   return n;
 }
 
-int _GD_SlimClose(struct _gd_raw_file *file)
+int _GD_SlimClose(struct gd_raw_file_ *file)
 {
   int ret;
 
@@ -98,27 +103,38 @@ int _GD_SlimClose(struct _gd_raw_file *file)
 
   ret = slimclose((SLIMFILE *)file->edata);
   if (!ret) {
-    file->fp = -1;
+    file->idata = -1;
     file->edata = NULL;
+    file->mode = 0;
   }
 
   dreturn("%i", ret);
   return ret;
 }
 
-off64_t _GD_SlimSize(struct _gd_raw_file *file, gd_type_t data_type)
+off64_t _GD_SlimSize(int dirfd, struct gd_raw_file_ *file, gd_type_t data_type,
+    int swap gd_unused_)
 {
+  char *filepath;
   off64_t size;
 
-  dtrace("%p, %x", file, data_type);
+  dtrace("%i, %p, 0x%X", dirfd, file, data_type);
+
+  /* this is easily broken, but the best we can do for now... */
+  filepath = gd_MakeFullPathOnly(file->D, dirfd, file->name);
+  if (filepath == NULL) {
+    dreturn("%i", 1);
+    return 1;
+  }
 
-  size = slimrawsize(file->name);
+  size = slimrawsize(filepath);
+  free(filepath);
 
   if (size < 0) {
     dreturn("%i", -1);
     return -1;
   }
-  
+
   size /= GD_SIZE(data_type);
 
   dreturn("%lli", (long long)size);
diff --git a/src/spf.c b/src/spf.c
index 6abce8e..f6e7057 100644
--- a/src/spf.c
+++ b/src/spf.c
@@ -1,5 +1,5 @@
 /* Copyright (C) 2002-2005 C. Barth Netterfield
- * Copyright (C) 2005-2010 D. V. Wiebe
+ * Copyright (C) 2005-2012 D. V. Wiebe
  *
  ***************************************************************************
  *
@@ -21,21 +21,16 @@
  */
 #include "internal.h"
 
-#ifdef STDC_HEADERS
-#include <string.h>
-#include <stdlib.h>
-#endif
-
 /* _GD_GetSPF: Get samples per frame for field
 */
-gd_spf_t _GD_GetSPF(DIRFILE* D, gd_entry_t* E)
+unsigned int _GD_GetSPF(DIRFILE *D, gd_entry_t *E)
 {
-  gd_spf_t spf = 0;
+  unsigned int spf = 0;
 
   dtrace("%p, %p", D, E);
 
   if (++D->recurse_level >= GD_MAX_RECURSE_LEVEL) {
-    _GD_SetError(D, GD_E_RECURSE_LEVEL, 0, NULL, 0, E->field);
+    _GD_SetError(D, GD_E_RECURSE_LEVEL, GD_E_RECURSE_CODE, NULL, 0, E->field);
     dreturn("%u", 0);
     D->recurse_level--;
     return 0;
@@ -44,8 +39,9 @@ gd_spf_t _GD_GetSPF(DIRFILE* D, gd_entry_t* E)
   switch(E->field_type) {
     case GD_RAW_ENTRY:
       if (!E->e->calculated)
-        _GD_CalculateEntry(D, E);
-      spf = E->EN(raw,spf);
+        _GD_CalculateEntry(D, E, 1);
+      if (!D->error)
+        spf = E->EN(raw,spf);
       break;
     case GD_LINCOM_ENTRY:
     case GD_MULTIPLY_ENTRY:
@@ -56,7 +52,9 @@ gd_spf_t _GD_GetSPF(DIRFILE* D, gd_entry_t* E)
     case GD_LINTERP_ENTRY:
     case GD_POLYNOM_ENTRY:
     case GD_SBIT_ENTRY:
-      if (_GD_BadInput(D, E, 0))
+    case GD_WINDOW_ENTRY:
+    case GD_MPLEX_ENTRY:
+      if (_GD_BadInput(D, E, 0, 1))
         break;
 
       spf = _GD_GetSPF(D, E->e->entry[0]);
@@ -67,6 +65,7 @@ gd_spf_t _GD_GetSPF(DIRFILE* D, gd_entry_t* E)
     case GD_CONST_ENTRY:
     case GD_CARRAY_ENTRY:
     case GD_STRING_ENTRY:
+    case GD_ALIAS_ENTRY:
     case GD_NO_ENTRY:
       _GD_InternalError(D);
   }
@@ -78,9 +77,9 @@ gd_spf_t _GD_GetSPF(DIRFILE* D, gd_entry_t* E)
 
 /* Get the number of samples for each frame for the given field
 */
-gd_spf_t gd_spf(DIRFILE* D, const char *field_code_in) gd_nothrow
+unsigned int gd_spf(DIRFILE* D, const char *field_code_in) gd_nothrow
 {
-  gd_spf_t spf = 0;
+  unsigned int spf = 0;
   gd_entry_t* entry;
   char* field_code;
   int repr;
@@ -98,15 +97,16 @@ gd_spf_t gd_spf(DIRFILE* D, const char *field_code_in) gd_nothrow
   /* the representation is unimportant: it doesn't change the SPF of the field,
    * yet we have to run the field code through here to potentially remove it
    */
-  entry = _GD_FindFieldAndRepr(D, field_code_in, &field_code, &repr, NULL, 1);
+  entry = _GD_FindFieldAndRepr(D, field_code_in, &field_code, &repr, NULL, 1,
+      1);
 
   if (D->error) {
     dreturn("%u", 0);
     return 0;
   }
 
-  if (entry->field_type & GD_SCALAR_ENTRY)
-    _GD_SetError(D, GD_E_BAD_FIELD_TYPE, GD_E_FIELD_BAD, NULL, 0, field_code);
+  if (entry->field_type & GD_SCALAR_ENTRY_BIT)
+    _GD_SetError(D, GD_E_DIMENSION, GD_E_DIM_CALLER, NULL, 0, field_code);
   else 
     spf = _GD_GetSPF(D, entry);
 
diff --git a/src/string.c b/src/string.c
index 999ec84..d52fc59 100644
--- a/src/string.c
+++ b/src/string.c
@@ -20,14 +20,13 @@
  */
 #include "internal.h"
 
-/* this function is little more than a public boilerplate for _GD_DoField */
 size_t gd_get_string(DIRFILE* D, const char *field_code, size_t len,
     char *data_out) gd_nothrow
 {
   size_t n_read = 0;
   gd_entry_t *entry;
 
-  dtrace("%p, \"%s\", %zu, %p", D, field_code, len, data_out);
+  dtrace("%p, \"%s\", %" PRNsize_t ", %p", D, field_code, len, data_out);
 
   if (D->flags & GD_INVALID) {/* don't crash */
     _GD_SetError(D, GD_E_BAD_DIRFILE, 0, NULL, 0, NULL);
@@ -37,19 +36,51 @@ size_t gd_get_string(DIRFILE* D, const char *field_code, size_t len,
 
   _GD_ClearError(D);
 
-  entry = _GD_FindField(D, field_code, D->entry, D->n_entries, NULL);
+  entry = _GD_FindField(D, field_code, D->entry, D->n_entries, 1, NULL);
     
   if (entry == NULL)
-    _GD_SetError(D, GD_E_BAD_CODE, 0, NULL, 0, field_code);
+    _GD_SetError(D, GD_E_BAD_CODE, GD_E_CODE_MISSING, NULL, 0, field_code);
   else if (entry && entry->field_type != GD_STRING_ENTRY)
     _GD_SetError(D, GD_E_BAD_FIELD_TYPE, GD_E_FIELD_BAD, NULL, 0, field_code);
-  else
-    n_read = _GD_DoField(D, entry, 0, 0, len, GD_NULL, data_out);
+  else {
+    if (len > 0 && data_out != NULL)
+      strncpy(data_out, entry->e->u.string, len);
 
-  dreturn("%zu", n_read);
+    n_read = strlen(entry->e->u.string) + 1;
+  }
+
+  dreturn("%" PRNsize_t, n_read);
   return n_read;
 }
 
+size_t _GD_DoStringOut(DIRFILE *restrict D, gd_entry_t *restrict E,
+    const char *data_in)
+{
+  char* ptr = E->e->u.string;
+
+  dtrace("%p, %p, %p", D, E, data_in);
+
+  /* check protection */
+  if (D->fragment[E->fragment_index].protection & GD_PROTECT_FORMAT) {
+    _GD_SetError(D, GD_E_PROTECTED, GD_E_PROTECTED_FORMAT, NULL, 0,
+        D->fragment[E->fragment_index].cname);
+    dreturn("%i", 0);
+    return 0;
+  }
+
+  E->e->u.string = _GD_Strdup(D, data_in);
+  if (E->e->u.string == NULL) {
+    E->e->u.string = ptr;
+    dreturn("%i", 0);
+    return 0;
+  }
+  free(ptr);
+  D->fragment[E->fragment_index].modified = 1;
+
+  dreturn("%" PRNsize_t, strlen(E->e->u.string) + 1);
+  return strlen(E->e->u.string) + 1;
+}
+
 /* this function is little more than a public boilerplate for _GD_DoFieldOut */
 size_t gd_put_string(DIRFILE* D, const char *field_code, const char *data_in)
   gd_nothrow
@@ -73,16 +104,16 @@ size_t gd_put_string(DIRFILE* D, const char *field_code, const char *data_in)
 
   _GD_ClearError(D);
 
-  entry = _GD_FindField(D, field_code, D->entry, D->n_entries, NULL);
+  entry = _GD_FindField(D, field_code, D->entry, D->n_entries, 1, NULL);
 
   if (entry == NULL)
-    _GD_SetError(D, GD_E_BAD_CODE, 0, NULL, 0, field_code);
+    _GD_SetError(D, GD_E_BAD_CODE, GD_E_CODE_MISSING, NULL, 0, field_code);
   else if (entry->field_type != GD_STRING_ENTRY)
     _GD_SetError(D, GD_E_BAD_FIELD_TYPE, GD_E_FIELD_BAD, NULL, 0, field_code);
   else 
-    n_wrote = _GD_DoFieldOut(D, entry, 0, 0, 0, GD_NULL, data_in);
+    n_wrote = _GD_DoStringOut(D, entry, data_in);
 
-  dreturn("%zu", n_wrote);
+  dreturn("%" PRNsize_t, n_wrote);
   return n_wrote;
 }
 /* vim: ts=2 sw=2 et tw=80
diff --git a/src/types.c b/src/types.c
index b78b140..ba58d7c 100644
--- a/src/types.c
+++ b/src/types.c
@@ -21,15 +21,6 @@
  */
 #include "internal.h"
 
-#ifdef STDC_HEADERS
-#include <inttypes.h>
-#include <errno.h>
-#include <fcntl.h>
-#include <math.h>
-#include <stdlib.h>
-#include <string.h>
-#endif
-
 #ifdef GD_NO_C99_API
 
 #define TO_COMPLEX(ot,it) \
@@ -66,13 +57,14 @@
 
 /* _GD_ConvertType: copy data to output buffer while converting type.
 */
-void _GD_ConvertType(DIRFILE* D, const void *data_in, gd_type_t in_type,
-    void *data_out, gd_type_t out_type, size_t n) gd_nothrow
+void _GD_ConvertType(DIRFILE *restrict D, const void *restrict data_in,
+    gd_type_t in_type, void *restrict data_out, gd_type_t out_type, size_t n)
+gd_nothrow
 {
   size_t i;
 
-  dtrace("%p, %p, 0x%x, %p, 0x%x, %zu", D, data_in, in_type, data_out, out_type,
-      n);
+  dtrace("%p, %p, 0x%x, %p, 0x%x, %" PRNsize_t, D, data_in, in_type, data_out,
+      out_type, n);
   dreturnvoid();
 
   if (out_type == GD_NULL) /* null return type: don't return data */
diff --git a/src/zzip.c b/src/zzip.c
new file mode 100644
index 0000000..176e3a6
--- /dev/null
+++ b/src/zzip.c
@@ -0,0 +1,222 @@
+/* Copyright (C) 2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+#include "internal.h"
+
+#ifdef HAVE_ZZIP_LIB_H
+#include <zzip/lib.h>
+#endif
+
+#ifdef USE_MODULES
+#define _GD_ZzipName libgetdatazzip_LTX_GD_ZzipName
+#define _GD_ZzipOpen libgetdatazzip_LTX_GD_ZzipOpen
+#define _GD_ZzipSeek libgetdatazzip_LTX_GD_ZzipSeek
+#define _GD_ZzipRead libgetdatazzip_LTX_GD_ZzipRead
+#define _GD_ZzipClose libgetdatazzip_LTX_GD_ZzipClose
+#define _GD_ZzipSize libgetdatazzip_LTX_GD_ZzipSize
+#endif
+
+/* The zzip encoding scheme looks just like the regular ol' C IO. */
+
+int _GD_ZzipName(DIRFILE *restrict D, const char *restrict enc_data,
+    struct gd_raw_file_ *restrict file, const char *restrict base,
+    int temp gd_unused_, int resolv)
+{
+  size_t enc_len;
+
+  dtrace("%p, \"%s\", %p, \"%s\", <unused>, %i", D, enc_data, file, base,
+      resolv);
+
+  if (enc_data == NULL)
+    enc_data = "raw";
+
+  enc_len = strlen(enc_data);
+  
+  if (resolv) {
+    free(file->name);
+    file->name = (char*)malloc(enc_len + 5);
+    if (file->name == NULL) {
+      dreturn("%i", -1);
+      return -1;
+    }
+
+    strcpy(file->name, enc_data);
+    strcpy(file->name + enc_len, ".zip");
+
+    dreturn("%i (%s)", 0, file->name);
+    return 0;
+  }
+
+  if (file->name == NULL) {
+    file->D = D;
+    file->name = (char *)malloc(strlen(base) + strlen(enc_data) + 2);
+    if (file->name == NULL) {
+      _GD_SetError(D, GD_E_ALLOC, 0, NULL, 0, NULL);
+      dreturn("%i", -1);
+      return -1;
+    }
+
+    strcpy(file->name, enc_data);
+    file->name[enc_len] = '/';
+    strcpy(file->name + enc_len + 1, base);
+  }
+
+  dreturn("%i (%s)", 0, file->name);
+  return 0;
+}
+
+int _GD_ZzipOpen(int dirfd, struct gd_raw_file_* file, int swap gd_unused_,
+    unsigned int mode gd_unused_)
+{
+  char *ptr1, *ptr2;
+  size_t len;
+
+  dtrace("%i, %p, <unused>, <unused>", dirfd, file);
+
+  /* zziplib doesn't seem to have a way to do these path shenannigans nicely */
+  ptr1 = gd_MakeFullPathOnly(file->D, dirfd, "");
+  if (ptr1 == NULL) {
+    dreturn("%i", 1);
+    return 1;
+  }
+
+  len = strlen(ptr1);
+  ptr2 = (char*)realloc(ptr1, len + strlen(file->name) + 2);
+  if (ptr2 == NULL) {
+    dreturn("%i", 1);
+    return 1;
+  }
+
+  ptr2[len] = '/';
+  strcpy(ptr2 + len + 1, file->name);
+
+  file->edata = zzip_open(ptr2, O_RDONLY);
+  free(ptr2);
+
+  if (file->edata == NULL) {
+    file->idata = -1;
+    dreturn("%i", 1);
+    return 1;
+  }
+
+  file->idata = 0;
+  file->mode = GD_FILE_READ;
+  dreturn("%i", 0);
+  return 0;
+}
+
+off64_t _GD_ZzipSeek(struct gd_raw_file_* file, off64_t count,
+    gd_type_t data_type, unsigned int mode gd_unused_)
+{
+  off64_t n;
+
+  dtrace("%p, %lli, 0x%X, <unused>", file, (long long)count, data_type);
+
+  n = file->pos = (off64_t)zzip_seek((ZZIP_FILE*)file->edata,
+      (off_t)(count * GD_SIZE(data_type)), SEEK_SET);
+
+  if (n >= 0)
+    n /= GD_SIZE(data_type);
+
+  dreturn("%lli", (long long)n);
+  return n;
+}
+
+ssize_t _GD_ZzipRead(struct gd_raw_file_ *restrict file, void *restrict data,
+    gd_type_t data_type, size_t nmemb)
+{
+  ssize_t n;
+
+  dtrace("%p, %p, 0x%X, %" PRNsize_t, file, data, data_type, nmemb);
+
+  n = zzip_read((ZZIP_FILE*)file->edata, data, GD_SIZE(data_type) * nmemb);
+
+  if (n >= 0)
+    n /= GD_SIZE(data_type);
+
+  dreturn("%lli", (long long)n);
+  return n;
+}
+
+int _GD_ZzipClose(struct gd_raw_file_ *file)
+{
+  int ret;
+
+  dtrace("%p", file);
+
+  ret = zzip_close((ZZIP_FILE*)file->edata);
+
+  if (!ret) {
+    file->idata = -1;
+    file->edata = NULL;
+  }
+
+  dreturn("%i", ret);
+  return ret;
+}
+
+off64_t _GD_ZzipSize(int dirfd, struct gd_raw_file_ *file, gd_type_t data_type,
+    int swap gd_unused_)
+{
+  ssize_t len;
+  char *ptr1, *ptr2;
+  ZZIP_FILE *fp;
+  off64_t size = 0;
+
+  dtrace("%i, %p, 0x%X, <unused>", dirfd, file, data_type);
+
+  /* zziplib doesn't seem to have a way to do these path shenannigans nicely */
+  ptr1 = gd_MakeFullPathOnly(file->D, dirfd, "");
+  if (ptr1 == NULL) {
+    dreturn("%i", 1);
+    return 1;
+  }
+
+  len = strlen(ptr1);
+  ptr2 = (char*)realloc(ptr1, len + strlen(file->name) + 2);
+  if (ptr2 == NULL) {
+    dreturn("%i", 1);
+    return 1;
+  }
+
+  ptr2[len] = '/';
+  strcpy(ptr2 + len + 1, file->name);
+
+  fp = zzip_open(ptr2, O_RDONLY);
+  free(ptr2);
+
+  if (fp == NULL) {
+    file->idata = -1;
+    dreturn("%i", -1);
+    return -1;
+  }
+
+  if ((size = (off64_t)zzip_seek(fp, 0, SEEK_END)) == -1) {
+    dreturn("%i", -1);
+    return -1;
+  }
+
+  zzip_close(fp);
+
+  size /= GD_SIZE(data_type);
+
+  dreturn("%lli", (long long)size);
+  return size;
+}
diff --git a/src/zzslim.c b/src/zzslim.c
new file mode 100644
index 0000000..f126243
--- /dev/null
+++ b/src/zzslim.c
@@ -0,0 +1,181 @@
+/* Copyright (C) 2008, 2010, 2011, 2012 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+#include "internal.h"
+
+#ifdef HAVE_SLIMLIB_H
+#include <slimlib.h>
+#endif
+
+#ifdef USE_MODULES
+#define _GD_ZzslimName libgetdatazzslim_LTX_GD_ZzslimName
+#define _GD_ZzslimOpen libgetdatazzslim_LTX_GD_ZzslimOpen
+#define _GD_ZzslimSeek libgetdatazzslim_LTX_GD_ZzslimSeek
+#define _GD_ZzslimRead libgetdatazzslim_LTX_GD_ZzslimRead
+#define _GD_ZzslimClose libgetdatazzslim_LTX_GD_ZzslimClose
+#define _GD_ZzslimSize libgetdatazzslim_LTX_GD_ZzslimSize
+#endif
+
+/* The zzslim encoding scheme uses edata as a slimfile pointer.  If a file is
+ * open, idata = 0 otherwise idata = -1. */
+
+int _GD_ZzslimName(DIRFILE *restrict D, const char *restrict enc_data,
+    struct gd_raw_file_ *restrict file, const char *restrict base,
+    int temp gd_unused_, int resolv)
+{
+  size_t enc_len;
+
+  dtrace("%p, \"%s\", %p, \"%s\", <unused>, %i", D, enc_data, file, base,
+      resolv);
+
+  if (enc_data == NULL)
+    enc_data = "raw";
+
+  enc_len = strlen(enc_data);
+  
+  /* Resolution is degenerate with the zzip encoding; so skip it for now */
+  if (resolv) {
+    dreturn("%i", 1);
+    return 1;
+  }
+
+  if (file->name == NULL) {
+    file->D = D;
+    file->name = (char *)malloc(strlen(base) + strlen(enc_data) + 6);
+    if (file->name == NULL) {
+      _GD_SetError(D, GD_E_ALLOC, 0, NULL, 0, NULL);
+      dreturn("%i", -1);
+      return -1;
+    }
+
+    strcpy(file->name, enc_data);
+    file->name[enc_len] = '/';
+    strcat(strcpy(file->name + enc_len + 1, base), ".slm");
+  }
+
+  dreturn("%i (%s)", 0, file->name);
+  return 0;
+}
+
+int _GD_ZzslimOpen(int dirfd, struct gd_raw_file_* file, int swap gd_unused_,
+    unsigned int mode gd_unused_)
+{
+  char *filepath;
+
+  dtrace("%i, %p, <unused>, <unused>", dirfd, file);
+
+  /* this is easily broken, but the best we can do for now... */
+  filepath = gd_MakeFullPathOnly(file->D, dirfd, file->name);
+  if (filepath == NULL) {
+    dreturn("%i", 1);
+    return 1;
+  }
+
+  file->edata = slimopen(filepath, "r");
+  free(filepath);
+
+  if (file->edata == NULL) {
+    dreturn("%i", 1);
+    return 1;
+  }
+
+  file->mode = GD_RDONLY;
+  file->idata = 0;
+  dreturn("%i", 0);
+  return 0;
+}
+
+off64_t _GD_ZzslimSeek(struct gd_raw_file_* file, off64_t count,
+    gd_type_t data_type, unsigned int mode gd_unused_)
+{
+  off64_t n;
+
+  dtrace("%p, %lli, 0x%X, <unused>", file, (long long)count, data_type);
+
+  n = (off64_t)slimseek((SLIMFILE *)file->edata, (off_t)count *
+      GD_SIZE(data_type), SEEK_SET);
+
+  if (n == -1) {
+    dreturn("%i", -1);
+    return -1;
+  }
+
+  dreturn("%lli", (long long)(n / GD_SIZE(data_type)));
+  return n;
+}
+
+ssize_t _GD_ZzslimRead(struct gd_raw_file_ *restrict file, void *restrict ptr,
+    gd_type_t data_type, size_t nmemb)
+{
+  ssize_t n;
+
+  dtrace("%p, %p, 0x%X, %" PRNsize_t, file, ptr, data_type, nmemb);
+
+  n = slimread(ptr, GD_SIZE(data_type), nmemb, (SLIMFILE *)file->edata);
+
+  dreturn("%" PRNsize_t, n);
+  return n;
+}
+
+int _GD_ZzslimClose(struct gd_raw_file_ *file)
+{
+  int ret;
+
+  dtrace("%p", file);
+
+  ret = slimclose((SLIMFILE *)file->edata);
+  if (!ret) {
+    file->idata = -1;
+    file->edata = NULL;
+    file->mode = 0;
+  }
+
+  dreturn("%i", ret);
+  return ret;
+}
+
+off64_t _GD_ZzslimSize(int dirfd, struct gd_raw_file_ *file,
+    gd_type_t data_type, int swap gd_unused_)
+{
+  char *filepath;
+  off64_t size;
+
+  dtrace("%i, %p, 0x%X", dirfd, file, data_type);
+
+  /* this is easily broken, but the best we can do for now... */
+  filepath = gd_MakeFullPathOnly(file->D, dirfd, file->name);
+  if (filepath == NULL) {
+    dreturn("%i", 1);
+    return 1;
+  }
+
+  size = slimrawsize(filepath);
+  free(filepath);
+
+  if (size < 0) {
+    dreturn("%i", -1);
+    return -1;
+  }
+
+  size /= GD_SIZE(data_type);
+
+  dreturn("%lli", (long long)size);
+  return size;
+}
diff --git a/test/Makefile.am b/test/Makefile.am
index 9a547dc..d689f34 100644
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -1,4 +1,4 @@
-# (C) 2008-2010 D. V. Wiebe
+# (C) 2008-2012 D. V. Wiebe
 #
 ##########################################################################
 #
@@ -28,50 +28,53 @@ if CC_WEXTRA
 WEXTRA=-Wextra
 endif
 
-if LFS_TRANSITIONAL_API
-GET64=get64
-GET_OFF64=get_off64
-NFRAMES64=nframes64
-NFRAMES_OFF64=nframes_off64
-PUT64=put64
-PUT_OFF64=put_off64
-endif
-
 LDADD=../src/libgetdata.la
-INCLUDES=${WALL} $(WEXTRA) -I$(top_srcdir)/src -D__TEST__=\"$@\"
+INCLUDES=${WALL} $(WEXTRA) -I$(top_srcdir)/src
 
 EXTRA_DIST=test.h
 
-ADD_TESTS=add add_bit add_bit_bitnum add_bit_bitsize add_bit_invalid \
-					add_bit_numbits add_carray add_clincom add_code add_const \
-					add_cpolynom add_crecip add_crecip89 add_divide add_divide_invalid \
-					add_duplicate add_format add_invalid add_lincom add_lincom_invalid \
-					add_lincom_nfields add_linterp add_linterp_invalid add_multiply \
+ADD_TESTS=add add_affix add_alias add_alias_affix add_alias_meta add_bit \
+					add_bit_bitnum add_bit_bitsize add_bit_invalid add_bit_numbits \
+					add_carray add_clincom add_code add_const add_cpolynom add_crecip \
+					add_crecip89 add_divide add_divide_invalid add_duplicate add_format \
+					add_invalid add_lincom add_lincom_affix add_lincom_invalid \
+					add_lincom_nfields add_linterp add_linterp_invalid add_meta \
+					add_meta_alias add_mplex add_mplex_val add_multiply \
 					add_multiply_invalid add_phase add_phase_invalid add_polynom \
 					add_protect add_raw add_raw_include add_raw_invalid add_raw_spf \
-					add_raw_type add_rdonly add_recip add_sbit add_scalar add_sort \
-					add_spec add_spec_directive add_spec_invalid add_spec_meta \
-					add_string add_type
+					add_raw_type add_rdonly add_recip add_resolv add_sbit add_scalar \
+					add_scalar_carray add_scalar_carray_bad add_sort add_spec \
+					add_spec_directive add_spec_invalid add_spec_meta add_spec_resolv \
+					add_string add_string_affix add_type add_window add_window_op
+
+ALIAS_TESTS=alias_list alias_list_alias alias_list_missing alias_num \
+						alias_num_alias alias_num_missing alias_target alias_target_alias \
+						alias_target_missing
 
 ALTER_TESTS=alter_bit_bitnum alter_bit_numbits alter_carray_len \
-						alter_carray_type alter_const alter_cpolynom alter_crecip \
+						alter_carray_type alter_const alter_const_c2r alter_cpolynom \
+						alter_crecip \
 						alter_crecip89 alter_crecip_zero alter_divide alter_entry \
-						alter_entry_recode alter_entry_scalar2a alter_entry_scalar2n \
-						alter_entry_scalar3 alter_entry_scalar4 alter_lincom_23 \
-						alter_lincom_32 alter_lincom_input alter_lincom_offset \
-						alter_lincom_slope alter_linterp alter_linterp_move alter_mspec \
-						alter_multiply alter_phase alter_polynom_coeff alter_polynom_input \
-						alter_polynom_ord alter_raw_spf alter_raw_type alter_recip \
-						alter_recip_zero alter_spec alter_spec_meta
-
-ASCII_TESTS=ascii_get ascii_get_get ascii_nframes ascii_put
+						alter_entry_affix alter_entry_hidden alter_entry_recode \
+						alter_entry_scalar2a alter_entry_scalar2n alter_entry_scalar3 \
+						alter_entry_scalar4 alter_lincom_23 alter_lincom_32 \
+						alter_lincom_affix alter_lincom_input alter_lincom_offset \
+						alter_lincom_slope alter_linterp alter_linterp_move alter_mplex \
+						alter_mspec alter_mspec_affix alter_multiply alter_phase \
+						alter_polynom_coeff alter_polynom_input alter_polynom_ord \
+						alter_raw_spf alter_raw_type alter_recip alter_recip_zero \
+						alter_scalar_affix alter_spec alter_spec_affix alter_spec_meta \
+						alter_window
+
+ASCII_TESTS=ascii_add ascii_get ascii_get_get ascii_nframes ascii_put
 
 BOF_TESTS=bof bof_lincom bof_phase
 
 BZIP_TESTS=bzip_get bzip_get_get bzip_move_from bzip_nframes
 
-CVLIST_TESTS=cvlist cvlist_array cvlist_array_meta cvlist_invalid cvlist_meta \
-						 cvlist_meta_invalid
+CVLIST_TESTS=cvlist cvlist_array cvlist_array_hidden cvlist_array_meta \
+						 cvlist_array_meta_hidden cvlist_hidden cvlist_invalid cvlist_meta \
+						 cvlist_meta_hidden cvlist_meta_invalid
 
 CLOSE_TESTS=close close_bad close_discard close_null
 
@@ -127,38 +130,49 @@ CONVERT_TESTS=convert_complex128_complex64 convert_complex128_float64 \
 CREAT_TESTS=creat creat_excl creat_rdonly
 
 DEL_TESTS=del del_carray del_carray_deref del_const del_const_deref \
-					del_const_force del_data del_derived del_derived_force del_meta \
-					del_meta_force
+					del_const_force del_data del_derived del_derived_after \
+					del_derived_force del_meta del_meta_force
 
 DFES_TESTS=dfes_bit dfes_divide dfes_lincom dfes_linterp dfes_multiply \
 					 dfes_null dfes_phase dfes_raw dfes_recip dfes_zero
 
+DESYNC_TESTS=desync desync_flush desync_reopen desync_reopen_inv
+
+ELIST_TESTS=elist_alias elist_hidden elist_noalias elist_scalar
+
 ENCODE_TESTS=encode_alter encode_get encode_move
 
-ENDIAN_TESTS=endian_alter endian_get endian_move
+ENDIAN_TESTS=endian_alter endian_alter_sie endian_get endian_move
 
-ENTRY_TESTS=entry_bad_code entry_bit entry_bit_scalar entry_invalid \
-						entry_lincom entry_lincom_scalar entry_linterp entry_multiply \
-						entry_phase entry_phase_scalar entry_polynom entry_polynom_scalar \
-						entry_raw entry_raw_scalar entry_raw_scalar_code \
-						entry_raw_scalar_type entry_scalar_repr entry_type
+ENTRY_TESTS=entry_bad_code entry_bit entry_bit_scalar entry_divide \
+						entry_invalid entry_lincom entry_lincom_scalar entry_linterp \
+						entry_mplex entry_mplex_scalar entry_multiply entry_phase \
+						entry_phase_scalar entry_polynom entry_polynom_scalar entry_raw \
+						entry_raw_scalar entry_raw_scalar_code entry_raw_scalar_type \
+						entry_scalar_repr entry_recip entry_type entry_type_alias \
+						entry_window entry_window_scalar
 
 EOF_TESTS=eof eof_index eof_lincom eof_phase
 
-ERROR_TESTS=error error_error error_short
+ERROR_TESTS=error error_error error_num error_short error_verbose \
+						error_verbose_prefix
 
 FILE_TESTS=file file_code file_type
 
-FLIST_TESTS=flist flist_invalid flist_meta flist_meta_invalid flist_type \
-						flist_type_invalid flist_type_meta flist_type_meta_invalid
+FLIST_TESTS=flist flist_hidden flist_invalid flist_meta flist_meta_hidden \
+						flist_meta_invalid flist_type flist_type_hidden flist_type_invalid \
+						flist_type_meta flist_type_meta_hidden flist_type_meta_invalid
 
-FLUSH_TESTS=flush flush_all flush_bad_code flush_invalid flush_meta flush_spec
+FLUSH_TESTS=flush flush_all flush_bad_code flush_invalid flush_meta flush_ref \
+						flush_spec
 
 FOFFS_TESTS=foffs_alter foffs_get foffs_move
 
-FRAGMENT_TESTS=fragment_index fragment_name fragment_name_oor
+FRAGMENT_TESTS=fragment_affix fragment_affix_alter fragment_affix_alter2 \
+							 fragment_affix_dup fragment_index fragment_index_alias \
+							 fragment_name fragment_name_oor fragment_num fragment_parent
 
-GET_TESTS=${GET64} get_bad_code get_bit get_carray get_carray_len \
+GET_TESTS=get64 get_affix get_bad_code get_bit get_carray get_carray_len \
 					get_carray_slice get_char get_clincom get_complex128 \
 					get_complex64 get_const get_const_complex get_const_repr \
 					get_cpolynom get_divide get_endian8 get_endian16 get_endian32 \
@@ -168,23 +182,32 @@ GET_TESTS=${GET64} get_bad_code get_bit get_carray get_carray_len \
 					get_endian_float32_arm get_endian_float32_big \
 					get_endian_float32_little get_endian_float64_arm \
 					get_endian_float64_big get_endian_float64_little get_ff get_float32 \
-					get_float64 get_foffs get_fs get_int8 get_int16 get_int32 get_int64 \
-					get_invalid get_lincom1 get_lincom2 get_lincom3 get_lincom_noin \
-					get_lincom_non get_linterp get_linterp_noin get_linterp_notab \
-					get_linterp_sort get_multiply get_multiply_noin get_nonexistent \
-					get_null $(GET_OFF64) get_phase get_polynom get_polynom_noin \
-					get_recip get_recip_const get_recurse get_sbit get_sf get_ss \
-					get_type get_uint16 get_uint32 get_uint64 get_zero
-
-GLOBAL_TESTS=global_name global_ref global_ref_empty global_ref_set
-
-GZIP_TESTS=gzip_get gzip_get_get gzip_move_from gzip_nframes
+					get_float64 get_foffs get_fs get_here get_here_foffs get_heres \
+					get_int8 get_int16 get_int32 get_int64 get_invalid get_lincom1 \
+					get_lincom2 get_lincom3 get_lincom_noin get_lincom_non \
+					get_lincom_null get_lincom_spf get_linterp get_linterp_noin \
+					get_linterp_notab get_linterp_sort get_mplex get_mplex_bof \
+					get_mplex_lb get_mplex_lball get_mplex_nolb get_multiply \
+					get_multiply_noin get_nonexistent get_null get_off64 get_phase \
+					get_phase_affix get_polynom get_polynom_noin get_recip \
+					get_recip_const get_recurse get_rofs get_sbit get_sf get_ss get_type \
+					get_uint16 get_uint32 get_uint64 get_window get_window_clr \
+					get_window_ge get_window_gt get_window_le get_window_lt \
+					get_window_ne get_window_set get_zero
+
+GLOBAL_TESTS=global_flags global_name global_ref global_ref_empty global_ref_set
+
+GZIP_TESTS=gzip_add gzip_get gzip_get_get gzip_get_get2 gzip_get_put \
+					 gzip_move_from gzip_move_to gzip_nframes gzip_put gzip_put_get
 
 HEADER_TESTS=header_complex
 
-INCLUDE_TESTS=include include_accmode include_auto include_cb include_creat \
-							include_ignore include_index include_invalid include_nonexistent \
-							include_pc include_ref include_syntax
+HIDE_TESTS=hide hide_hidden hide_unhide
+
+INCLUDE_TESTS=include include_accmode include_affix include_auto include_cb \
+							include_creat include_ignore include_index include_invalid \
+							include_nonexistent include_pc include_ref include_sub \
+							include_syntax
 
 INDEX_TESTS=index index_domain index_range
 
@@ -195,67 +218,84 @@ endif
 
 LZMA_TESTS=lzma_get lzma_nframes
 
-MADD_TESTS=madd madd_bit madd_bit_invalid madd_carray madd_clincom madd_const \
-					 madd_cpolynom madd_crecip madd_crecip89 madd_divide madd_lincom \
-					 madd_lincom_invalid madd_linterp madd_linterp_invalid madd_multiply \
-					 madd_multiply_invalid madd_phase madd_phase_invalid madd_polynom \
-					 madd_recip madd_sbit madd_spec madd_spec_directive \
-					 madd_spec_invalid madd_string
+MADD_TESTS=madd madd_affix madd_alias madd_alias_affix madd_bit \
+					 madd_bit_invalid madd_carray madd_clincom madd_const madd_cpolynom \
+					 madd_crecip madd_crecip89 madd_divide madd_index madd_lincom \
+					 madd_lincom_invalid madd_linterp madd_linterp_invalid madd_mplex \
+					 madd_multiply madd_multiply_invalid madd_phase madd_phase_invalid \
+					 madd_polynom madd_recip madd_sbit madd_spec madd_spec_directive \
+					 madd_spec_invalid madd_spec_resolv madd_string madd_window
 
-MOVE_TESTS=move move_data_enc_ar move_data_enc_ra move_data_endian \
-					 move_data_foffs move_data_nop move_index move_meta move_protect \
-					 move_subdir
+MOVE_TESTS=move move_affix move_affix_dup move_alias move_data_enc_ar \
+					 move_data_enc_ra move_data_endian move_data_foffs move_data_nop \
+					 move_index move_meta move_protect move_subdir
 
-NAME_TESTS=name name_move
+NAME_TESTS=name name_affix name_affix_bad name_alias name_dup name_move \
+					 name_move_alias name_updb name_updb_alias name_updb_const \
+					 name_updb_const_alias
 
-NFIELDS_TESTS=nfields nfields_invalid nfields_type nfields_type_invalid
+NENTRIES_TESTS=nentries_alias nentries_hidden nentries_noalias nentries_scalar
 
-NFRAGMENTS_TESTS=nfragments
+NFIELDS_TESTS=nfields nfields_hidden nfields_invalid nfields_type \
+							nfields_type_hidden nfields_type_invalid nfields_vector \
+							nfields_vector_hidden nfields_vector_invalid
 
-NFRAMES_TESTS=nframes ${NFRAMES64} nframes_empty nframes_invalid \
-							$(NFRAMES_OFF64) nframes_spf
+NFRAMES_TESTS=nframes nframes64 nframes_empty nframes_invalid \
+							nframes_off64 nframes_spf
 
-NMETA_TESTS=nmeta nmeta_invalid nmeta_parent nmeta_type nmeta_type_invalid \
-						nmeta_type_parent nmeta_vectors nmeta_vectors_del \
+NMETA_TESTS=nmeta nmeta_hidden nmeta_invalid nmeta_parent nmeta_type \
+						nmeta_type_hidden nmeta_type_invalid nmeta_type_parent \
+						nmeta_vectors nmeta_vectors_del nmeta_vectors_hidden \
 						nmeta_vectors_invalid nmeta_vectors_parent
 
-NVECTORS_TESTS=nvectors nvectors_invalid
-
-OPEN_TESTS=open open_cb_abort open_cb_cont open_cb_ignore open_cb_invalid \
-					 open_cb_rescan open_eaccess open_nonexistent open_notdirfile
-
-PARENT_TESTS=parent
-
-PARSE_TESTS=parse_badline parse_bit parse_bit4 parse_bit_bitnum \
-						parse_bit_bitsize parse_bit_ncols parse_bit_numbits \
-						parse_bit_scalar parse_carray parse_carray_long parse_const \
-						parse_const_ncols parse_divide parse_duplicate \
-						parse_duplicate_ignore parse_endian_bad parse_endian_big \
-						parse_endian_force parse_endian_little parse_endian_slash \
-						parse_eol parse_foffs parse_foffs_include parse_foffs_slash \
-						parse_include parse_include_absolute parse_include_absrel \
-						parse_include_nonexistent parse_include_relabs \
-						parse_include_relrel parse_include_slash parse_index parse_lincom \
-						parse_lincom_ncols1 parse_lincom_ncols2 parse_lincom_nfields \
-						parse_lincom_nofields parse_lincom_non parse_lincom_non_ncols \
-						parse_lincom_scalar parse_linterp parse_linterp_ncols parse_meta \
-						parse_meta_implicit parse_meta_implicit2 parse_meta_index \
-						parse_meta_index2 parse_meta_parent parse_meta_raw parse_multiply \
-						parse_multiply_ncols parse_name parse_name_dot parse_name_ext \
-						parse_name_pedantic parse_ncols parse_phase parse_phase_ncols \
-						parse_phase_scalar parse_polynom parse_polynom_ncols1 \
-						parse_polynom_ncols2 parse_polynom_scalar parse_protect_all \
-						parse_protect_bad parse_protect_data parse_protect_format \
-						parse_protect_none parse_quote parse_quote_mismatch parse_raw \
-						parse_raw_char parse_raw_ncols parse_raw_scalar parse_raw_spf \
-						parse_raw_type parse_recip parse_ref parse_ref_nonexistent \
-						parse_sbit parse_sort parse_string parse_string_ncols \
-						parse_string_null parse_version parse_version_include \
-						parse_version_permissive parse_version_slash parse_whitespace
+OPEN_TESTS=open open_abs open_cb_abort open_cb_cont open_cb_ignore \
+					 open_cb_invalid open_cb_rescan open_eaccess open_nonexistent \
+					 open_notdirfile open_sym_a open_sym_al open_sym_at open_sym_c \
+					 open_sym_cl open_sym_ct open_sym_p open_sym_pl open_sym_pt
+
+PARSE_TESTS=parse_alias parse_alias_code parse_alias_dup parse_alias_meta \
+						parse_alias_missing parse_badline parse_bit parse_bit4 \
+						parse_bit_bitnum parse_bit_bitsize parse_bit_ncols \
+						parse_bit_numbits parse_bit_scalar parse_carray parse_carray_long \
+						parse_const parse_const_complex parse_const_ncols parse_divide \
+						parse_double parse_duplicate parse_duplicate_ignore \
+						parse_endian_bad parse_endian_big parse_endian_force \
+						parse_endian_little parse_endian_slash parse_eol parse_foffs \
+						parse_foffs_include parse_foffs_slash parse_hidden \
+						parse_hidden_field parse_hidden_meta parse_include \
+						parse_include_absolute parse_include_absrel \
+						parse_include_affix_ref parse_include_dir parse_include_loop \
+						parse_include_nonexistent parse_include_prefix \
+						parse_include_prefix_dup parse_include_preprefix \
+						parse_include_ref parse_include_relabs parse_include_relrel \
+						parse_include_slash parse_include_suffix parse_include_sufsuffix \
+						parse_index parse_lincom parse_lincom_ncols1 parse_lincom_ncols2 \
+						parse_lincom_nfields parse_lincom_nofields parse_lincom_non \
+						parse_lincom_non_ncols parse_lincom_scalar parse_linterp \
+						parse_linterp_ncols parse_malias parse_malias_dup \
+						parse_malias_meta parse_meta parse_meta_affix parse_meta_alias \
+						parse_meta_implicit parse_meta_implicit2 parse_meta_implicit_affix \
+						parse_meta_index parse_meta_index2 parse_meta_jump \
+						parse_meta_malias parse_meta_meta parse_meta_parent parse_meta_raw \
+						parse_mplex parse_mplex_ncols parse_mplex_nomax parse_mplex_scalar \
+						parse_multiply parse_multiply_ncols parse_name parse_name_dot \
+						parse_name_ext parse_name_pedantic parse_ncols parse_phase \
+						parse_phase_ncols parse_phase_scalar parse_polynom \
+						parse_polynom_ncols1 parse_polynom_ncols2 parse_polynom_scalar \
+						parse_protect_all parse_protect_bad parse_protect_data \
+						parse_protect_format parse_protect_none parse_quote \
+						parse_quote_mismatch parse_raw parse_raw_char parse_raw_ncols \
+						parse_raw_scalar parse_raw_spf parse_raw_type parse_recip \
+						parse_ref parse_ref_nonexistent parse_sbit parse_sort parse_string \
+						parse_string_ncols parse_string_null parse_version \
+						parse_version_89 parse_version_98 parse_version_include \
+						parse_version_permissive parse_version_p8 parse_version_p9 \
+						parse_version_slash parse_whitespace parse_window \
+						parse_window_ncols parse_window_op parse_window_scalar
 
 PROTECT_TESTS=protect_alter protect_get
 
-PUT_TESTS=${PUT64} put_bad_code put_bit put_bof put_carray put_carray_slice \
+PUT_TESTS=put64 put_bad_code put_bit put_bof put_carray put_carray_slice \
 					put_char put_complex128 put_complex64 put_const put_const_protect \
 					put_divide put_endian8 put_endian16 put_endian32 put_endian64 \
 					put_endian_complex128_arm put_endian_complex128_big \
@@ -264,14 +304,15 @@ PUT_TESTS=${PUT64} put_bad_code put_bit put_bof put_carray put_carray_slice \
 					put_endian_float32_arm put_endian_float32_big \
 					put_endian_float32_little put_endian_float64_arm \
 					put_endian_float64_big put_endian_float64_little put_ff put_float32 \
-					put_float64 put_foffs put_fs put_int8 put_int16 put_int32 put_int64 \
-					put_invalid put_lincom1 put_lincom2 put_lincom_noin put_linterp \
-					put_linterp_noin put_linterp_nomono put_linterp_notab \
-					put_linterp_reverse put_multiply put_null $(PUT_OFF64) \
-					put_phase put_phase_noin put_polynom1 put_polynom2 put_polynom_noin \
-					put_protect put_rdonly put_recip put_recurse put_repr put_rofs \
-					put_sbit put_sf put_ss put_string put_string_protect put_type \
-					put_uint16 put_uint32 put_uint64
+					put_float64 put_foffs put_fs put_here put_heres put_int8 put_int16 \
+					put_int32 put_int64 put_invalid put_lincom1 put_lincom2 \
+					put_lincom_noin put_linterp put_linterp_noin put_linterp_nomono \
+					put_linterp_notab put_linterp_reverse put_mplex put_multiply \
+					put_null put_off64 put_phase put_phase_noin put_polynom1 \
+					put_polynom2 put_polynom_noin put_protect put_rdonly put_recip \
+					put_recurse put_repr put_rofs put_sbit put_sf put_ss put_string \
+					put_string_protect put_type put_uint16 put_uint32 put_uint64 \
+					put_window put_zero
 
 REF_TESTS=ref ref_none ref_two
 
@@ -280,14 +321,27 @@ REPR_TESTS=repr_a repr_float32 repr_float64 repr_i repr_int16 repr_int32 \
 					 repr_real_m repr_real_r repr_uint16 repr_uint32 repr_uint64 \
 					 repr_uint8
 
+SEEK_TESTS=seek64 seek_cur seek_end seek_foffs seek_neg seek_set
+
+SIE_TESTS=sie_get_big sie_get_little sie_move_from sie_move_to sie_nframes_big \
+					sie_nframes_little sie_put_big sie_put_little
+
 SLIM_TESTS=slim_get slim_nframes
 
-SVLIST_TESTS=svlist svlist_invalid svlist_meta svlist_meta_invalid
+SVLIST_TESTS=svlist svlist_hidden svlist_invalid svlist_meta \
+						 svlist_meta_hidden svlist_meta_invalid
+
+SPF_TESTS=spf spf_alias spf_alias_missing spf_alias_meta \
+					spf_divide spf_lincom spf_multiply \
+					spf_polynom spf_recip spf_recurse
 
-SPF_TESTS=spf spf_divide spf_lincom spf_multiply spf_polynom spf_recip \
-					spf_recurse
+TABLE_TESTS=table table_code table_type
 
-TRUNC_TESTS=trunc trunc_rdonly trunc_rofs
+TELL_TESTS=tell tell64 tell_multidiv
+
+TOK_TESTS=tok_arg tok_escape tok_quote
+
+TRUNC_TESTS=trunc trunc_dir trunc_rdonly trunc_rofs trunc_truncsub
 
 UNCLUDE_TESTS=unclude unclude_del unclude_move
 
@@ -296,48 +350,57 @@ VERSION_TESTS=version_0 version_0_write version_1 version_1_write version_2 \
 							version_4_write version_5 version_5_strict version_5_write \
 							version_6 version_6_strict version_6_write version_7 \
 							version_7_strict version_7_write version_8 version_8_strict \
-							version_8_write
+							version_8_write version_9 version_9_strict version_9_write
 
-VLIST_TESTS=vlist vlist_invalid vlist_meta vlist_meta_invalid
+VLIST_TESTS=vlist vlist_alias vlist_hidden vlist_invalid vlist_meta \
+						vlist_meta_hidden vlist_meta_invalid
 
 XZ_TESTS=xz_get xz_nframes
 
-TESTS=$(ADD_TESTS)        $(ALTER_TESTS)      $(ASCII_TESTS)      \
-			$(BOF_TESTS)        $(BZIP_TESTS)       $(CLOSE_TESTS)      \
-			$(CONVERT_TESTS)    $(CREAT_TESTS)      $(CVLIST_TESTS)     \
-			$(DEL_TESTS)        $(DFES_TESTS)       $(ENCODE_TESTS)     \
-			$(ENDIAN_TESTS)     $(ENTRY_TESTS)      $(EOF_TESTS)        \
-			$(ERROR_TESTS)      $(FILE_TESTS)       $(FLIST_TESTS)      \
-			$(FLUSH_TESTS)      $(FOFFS_TESTS)      $(FRAGMENT_TESTS)   \
-			$(GET_TESTS)        $(GLOBAL_TESTS)     $(GZIP_TESTS)       \
-			$(HEADER_TESTS)     $(INCLUDE_TESTS)    $(INDEX_TESTS)      \
-			$(LEGACY_TESTS)     $(LZMA_TESTS)       $(MADD_TESTS)       \
-			$(MOVE_TESTS)       $(NAME_TESTS)       $(NFIELDS_TESTS)    \
-			$(NFRAGMENTS_TESTS) $(NFRAMES_TESTS)    $(NMETA_TESTS)      \
-			$(NVECTORS_TESTS)   $(OPEN_TESTS)       $(PARENT_TESTS)     \
-			$(PARSE_TESTS)      $(PROTECT_TESTS)    $(PUT_TESTS)        \
-			$(REF_TESTS)        $(REPR_TESTS)       $(SLIM_TESTS)       \
-			$(SPF_TESTS)        $(SVLIST_TESTS)     $(TRUNC_TESTS)      \
-			$(UNCLUDE_TESTS)    $(VERSION_TESTS)    $(VLIST_TESTS)      \
-			$(XZ_TESTS)
+ZZIP_TESTS=zzip_data zzip_get zzip_get_get zzip_nframes
+
+ZZSLIM_TESTS=zzslim_get zzslim_nframes
+
+TESTS=$(ADD_TESTS)      $(ALIAS_TESTS)    $(ALTER_TESTS)    $(ASCII_TESTS)    \
+			$(BOF_TESTS)      $(BZIP_TESTS)     $(CLOSE_TESTS)    $(CONVERT_TESTS)  \
+			$(CREAT_TESTS)    $(CVLIST_TESTS)   $(DEL_TESTS)      $(DFES_TESTS)     \
+			$(DESYNC_TESTS)   $(ELIST_TESTS)    $(ENCODE_TESTS)   $(ENDIAN_TESTS)   \
+			$(ENTRY_TESTS)    $(EOF_TESTS)      $(ERROR_TESTS)    $(FILE_TESTS)     \
+			$(FLIST_TESTS)    $(FLUSH_TESTS)    $(FOFFS_TESTS)    $(FRAGMENT_TESTS) \
+			$(GET_TESTS)      $(GLOBAL_TESTS)   $(GZIP_TESTS)     $(HEADER_TESTS)   \
+			$(HIDE_TESTS)     $(INCLUDE_TESTS)  $(INDEX_TESTS)    $(LEGACY_TESTS)   \
+			$(LZMA_TESTS)     $(MADD_TESTS)     $(MOVE_TESTS)     $(NAME_TESTS)     \
+			$(NENTRIES_TESTS) $(NFIELDS_TESTS)  $(NFRAMES_TESTS)  $(NMETA_TESTS)    \
+			$(OPEN_TESTS)     $(PARSE_TESTS)    $(PROTECT_TESTS)  $(PUT_TESTS)      \
+			$(REF_TESTS)      $(REPR_TESTS)     $(SEEK_TESTS)     $(SIE_TESTS)      \
+			$(SLIM_TESTS)     $(SPF_TESTS)      $(SVLIST_TESTS)   $(TABLE_TESTS)    \
+			$(TELL_TESTS)     $(TOK_TESTS)      $(TRUNC_TESTS)    $(UNCLUDE_TESTS)  \
+			$(VERSION_TESTS)  $(VLIST_TESTS)    $(XZ_TESTS)       $(ZZIP_TESTS)     \
+			$(ZZSLIM_TESTS)
 
 check_PROGRAMS=$(TESTS)
 
+# fast tests
+.PHONY: fastcheck
+fastcheck:
+	touch $(TESTS)
+	${MAKE} check
+
 # valgrind
 valgrind.log: $(TESTS)
 	rm -f $@; \
 		for x in $^; do ( \
 		echo $$x:; \
-		sed -e 's/exec "/exec valgrind --leak-check=full --track-origins=yes --track-fds=yes "/' $$x | sh; \
+		sed -e 's/exec "/exec valgrind --leak-check=full --track-origins=yes --track-fds=yes --suppressions=valgrind.suppressions "/' $$x | sh; \
 		echo $$x = $$? ); done &> $@;
 
 # clean up after the tests
 check-local: check-TESTS
-	$(MAKE) getdata-clean-dirs
+	$(MAKE) getdata-clean-dir
 
-getdata-clean-dirs:
-	rm -rvf *odirfile
+getdata-clean-dir:
+	rm -rf dirfile
 
 clean-local:
-	$(MAKE) getdata-clean-dirs
-	rm -rf *~ 
+	$(MAKE) getdata-clean-dir
+	rm -rf *~
diff --git a/test/Makefile.in b/test/Makefile.in
index 378b441..fc28c40 100644
--- a/test/Makefile.in
+++ b/test/Makefile.in
@@ -1,9 +1,9 @@
-# Makefile.in generated by automake 1.11.1 from Makefile.am.
+# Makefile.in generated by automake 1.11.5 from Makefile.am.
 # @configure_input@
 
 # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005, 2006, 2007, 2008, 2009  Free Software Foundation,
-# Inc.
+# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software
+# Foundation, Inc.
 # This Makefile.in is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
@@ -15,6 +15,23 @@
 
 @SET_MAKE@
 VPATH = @srcdir@
+am__make_dryrun = \
+  { \
+    am__dry=no; \
+    case $$MAKEFLAGS in \
+      *\\[\ \	]*) \
+        echo 'am--echo: ; @echo "AM"  OK' | $(MAKE) -f - 2>/dev/null \
+          | grep '^AM OK$$' >/dev/null || am__dry=yes;; \
+      *) \
+        for am__flg in $$MAKEFLAGS; do \
+          case $$am__flg in \
+            *=*|--*) ;; \
+            *n*) am__dry=yes; break;; \
+          esac; \
+        done;; \
+    esac; \
+    test $$am__dry = yes; \
+  }
 pkgdatadir = $(datadir)/@PACKAGE@
 pkgincludedir = $(includedir)/@PACKAGE@
 pkglibdir = $(libdir)/@PACKAGE@
@@ -40,36 +57,43 @@ TESTS = $(am__EXEEXT_1) $(am__EXEEXT_2) $(am__EXEEXT_3) \
 	$(am__EXEEXT_13) $(am__EXEEXT_14) $(am__EXEEXT_15) \
 	$(am__EXEEXT_16) $(am__EXEEXT_17) $(am__EXEEXT_18) \
 	$(am__EXEEXT_19) $(am__EXEEXT_20) $(am__EXEEXT_21) \
-	$(am__EXEEXT_24) $(am__EXEEXT_25) $(am__EXEEXT_26) \
-	$(am__EXEEXT_27) $(am__EXEEXT_28) $(am__EXEEXT_29) \
-	$(am__EXEEXT_30) $(am__EXEEXT_31) $(am__EXEEXT_32) \
-	$(am__EXEEXT_33) $(am__EXEEXT_34) $(am__EXEEXT_35) \
-	$(am__EXEEXT_36) $(am__EXEEXT_39) $(am__EXEEXT_40) \
-	$(am__EXEEXT_41) $(am__EXEEXT_42) $(am__EXEEXT_43) \
-	$(am__EXEEXT_44) $(am__EXEEXT_45) $(am__EXEEXT_48) \
+	$(am__EXEEXT_22) $(am__EXEEXT_23) $(am__EXEEXT_24) \
+	$(am__EXEEXT_25) $(am__EXEEXT_26) $(am__EXEEXT_27) \
+	$(am__EXEEXT_28) $(am__EXEEXT_29) $(am__EXEEXT_30) \
+	$(am__EXEEXT_31) $(am__EXEEXT_32) $(am__EXEEXT_33) \
+	$(am__EXEEXT_34) $(am__EXEEXT_35) $(am__EXEEXT_36) \
+	$(am__EXEEXT_37) $(am__EXEEXT_38) $(am__EXEEXT_39) \
+	$(am__EXEEXT_40) $(am__EXEEXT_41) $(am__EXEEXT_42) \
+	$(am__EXEEXT_43) $(am__EXEEXT_44) $(am__EXEEXT_45) \
+	$(am__EXEEXT_46) $(am__EXEEXT_47) $(am__EXEEXT_48) \
 	$(am__EXEEXT_49) $(am__EXEEXT_50) $(am__EXEEXT_51) \
 	$(am__EXEEXT_52) $(am__EXEEXT_53) $(am__EXEEXT_54) \
 	$(am__EXEEXT_55) $(am__EXEEXT_56) $(am__EXEEXT_57) \
-	$(am__EXEEXT_58)
-check_PROGRAMS = $(am__EXEEXT_59)
+	$(am__EXEEXT_58) $(am__EXEEXT_59) $(am__EXEEXT_60) \
+	$(am__EXEEXT_61)
+check_PROGRAMS = $(am__EXEEXT_62)
 subdir = test
 DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
 am__aclocal_m4_deps = $(top_srcdir)/m4/ax_compare_version.m4 \
 	$(top_srcdir)/m4/compiler.m4 $(top_srcdir)/m4/encoding.m4 \
-	$(top_srcdir)/m4/idl.m4 $(top_srcdir)/m4/libtool.m4 \
-	$(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \
-	$(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \
-	$(top_srcdir)/m4/python.m4 $(top_srcdir)/m4/win32.m4 \
-	$(top_srcdir)/m4/version.m4 $(top_srcdir)/configure.ac
+	$(top_srcdir)/m4/floatordering.m4 $(top_srcdir)/m4/idl.m4 \
+	$(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \
+	$(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \
+	$(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/m4/matlab.m4 \
+	$(top_srcdir)/m4/perl.m4 $(top_srcdir)/m4/python.m4 \
+	$(top_srcdir)/m4/win32.m4 $(top_srcdir)/m4/version.m4 \
+	$(top_srcdir)/configure.ac
 am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
 	$(ACLOCAL_M4)
 mkinstalldirs = $(install_sh) -d
-CONFIG_HEADER = $(top_builddir)/src/config.h \
+CONFIG_HEADER = $(top_builddir)/src/gd_config.h \
 	$(top_builddir)/src/getdata.h
 CONFIG_CLEAN_FILES =
 CONFIG_CLEAN_VPATH_FILES =
-am__EXEEXT_1 = add$(EXEEXT) add_bit$(EXEEXT) add_bit_bitnum$(EXEEXT) \
+am__EXEEXT_1 = add$(EXEEXT) add_affix$(EXEEXT) add_alias$(EXEEXT) \
+	add_alias_affix$(EXEEXT) add_alias_meta$(EXEEXT) \
+	add_bit$(EXEEXT) add_bit_bitnum$(EXEEXT) \
 	add_bit_bitsize$(EXEEXT) add_bit_invalid$(EXEEXT) \
 	add_bit_numbits$(EXEEXT) add_carray$(EXEEXT) \
 	add_clincom$(EXEEXT) add_code$(EXEEXT) add_const$(EXEEXT) \
@@ -77,43 +101,59 @@ am__EXEEXT_1 = add$(EXEEXT) add_bit$(EXEEXT) add_bit_bitnum$(EXEEXT) \
 	add_crecip89$(EXEEXT) add_divide$(EXEEXT) \
 	add_divide_invalid$(EXEEXT) add_duplicate$(EXEEXT) \
 	add_format$(EXEEXT) add_invalid$(EXEEXT) add_lincom$(EXEEXT) \
-	add_lincom_invalid$(EXEEXT) add_lincom_nfields$(EXEEXT) \
-	add_linterp$(EXEEXT) add_linterp_invalid$(EXEEXT) \
-	add_multiply$(EXEEXT) add_multiply_invalid$(EXEEXT) \
-	add_phase$(EXEEXT) add_phase_invalid$(EXEEXT) \
-	add_polynom$(EXEEXT) add_protect$(EXEEXT) add_raw$(EXEEXT) \
-	add_raw_include$(EXEEXT) add_raw_invalid$(EXEEXT) \
-	add_raw_spf$(EXEEXT) add_raw_type$(EXEEXT) add_rdonly$(EXEEXT) \
-	add_recip$(EXEEXT) add_sbit$(EXEEXT) add_scalar$(EXEEXT) \
+	add_lincom_affix$(EXEEXT) add_lincom_invalid$(EXEEXT) \
+	add_lincom_nfields$(EXEEXT) add_linterp$(EXEEXT) \
+	add_linterp_invalid$(EXEEXT) add_meta$(EXEEXT) \
+	add_meta_alias$(EXEEXT) add_mplex$(EXEEXT) \
+	add_mplex_val$(EXEEXT) add_multiply$(EXEEXT) \
+	add_multiply_invalid$(EXEEXT) add_phase$(EXEEXT) \
+	add_phase_invalid$(EXEEXT) add_polynom$(EXEEXT) \
+	add_protect$(EXEEXT) add_raw$(EXEEXT) add_raw_include$(EXEEXT) \
+	add_raw_invalid$(EXEEXT) add_raw_spf$(EXEEXT) \
+	add_raw_type$(EXEEXT) add_rdonly$(EXEEXT) add_recip$(EXEEXT) \
+	add_resolv$(EXEEXT) add_sbit$(EXEEXT) add_scalar$(EXEEXT) \
+	add_scalar_carray$(EXEEXT) add_scalar_carray_bad$(EXEEXT) \
 	add_sort$(EXEEXT) add_spec$(EXEEXT) \
 	add_spec_directive$(EXEEXT) add_spec_invalid$(EXEEXT) \
-	add_spec_meta$(EXEEXT) add_string$(EXEEXT) add_type$(EXEEXT)
-am__EXEEXT_2 = alter_bit_bitnum$(EXEEXT) alter_bit_numbits$(EXEEXT) \
+	add_spec_meta$(EXEEXT) add_spec_resolv$(EXEEXT) \
+	add_string$(EXEEXT) add_string_affix$(EXEEXT) \
+	add_type$(EXEEXT) add_window$(EXEEXT) add_window_op$(EXEEXT)
+am__EXEEXT_2 = alias_list$(EXEEXT) alias_list_alias$(EXEEXT) \
+	alias_list_missing$(EXEEXT) alias_num$(EXEEXT) \
+	alias_num_alias$(EXEEXT) alias_num_missing$(EXEEXT) \
+	alias_target$(EXEEXT) alias_target_alias$(EXEEXT) \
+	alias_target_missing$(EXEEXT)
+am__EXEEXT_3 = alter_bit_bitnum$(EXEEXT) alter_bit_numbits$(EXEEXT) \
 	alter_carray_len$(EXEEXT) alter_carray_type$(EXEEXT) \
-	alter_const$(EXEEXT) alter_cpolynom$(EXEEXT) \
-	alter_crecip$(EXEEXT) alter_crecip89$(EXEEXT) \
-	alter_crecip_zero$(EXEEXT) alter_divide$(EXEEXT) \
-	alter_entry$(EXEEXT) alter_entry_recode$(EXEEXT) \
-	alter_entry_scalar2a$(EXEEXT) alter_entry_scalar2n$(EXEEXT) \
-	alter_entry_scalar3$(EXEEXT) alter_entry_scalar4$(EXEEXT) \
-	alter_lincom_23$(EXEEXT) alter_lincom_32$(EXEEXT) \
+	alter_const$(EXEEXT) alter_const_c2r$(EXEEXT) \
+	alter_cpolynom$(EXEEXT) alter_crecip$(EXEEXT) \
+	alter_crecip89$(EXEEXT) alter_crecip_zero$(EXEEXT) \
+	alter_divide$(EXEEXT) alter_entry$(EXEEXT) \
+	alter_entry_affix$(EXEEXT) alter_entry_hidden$(EXEEXT) \
+	alter_entry_recode$(EXEEXT) alter_entry_scalar2a$(EXEEXT) \
+	alter_entry_scalar2n$(EXEEXT) alter_entry_scalar3$(EXEEXT) \
+	alter_entry_scalar4$(EXEEXT) alter_lincom_23$(EXEEXT) \
+	alter_lincom_32$(EXEEXT) alter_lincom_affix$(EXEEXT) \
 	alter_lincom_input$(EXEEXT) alter_lincom_offset$(EXEEXT) \
 	alter_lincom_slope$(EXEEXT) alter_linterp$(EXEEXT) \
-	alter_linterp_move$(EXEEXT) alter_mspec$(EXEEXT) \
+	alter_linterp_move$(EXEEXT) alter_mplex$(EXEEXT) \
+	alter_mspec$(EXEEXT) alter_mspec_affix$(EXEEXT) \
 	alter_multiply$(EXEEXT) alter_phase$(EXEEXT) \
 	alter_polynom_coeff$(EXEEXT) alter_polynom_input$(EXEEXT) \
 	alter_polynom_ord$(EXEEXT) alter_raw_spf$(EXEEXT) \
 	alter_raw_type$(EXEEXT) alter_recip$(EXEEXT) \
-	alter_recip_zero$(EXEEXT) alter_spec$(EXEEXT) \
-	alter_spec_meta$(EXEEXT)
-am__EXEEXT_3 = ascii_get$(EXEEXT) ascii_get_get$(EXEEXT) \
-	ascii_nframes$(EXEEXT) ascii_put$(EXEEXT)
-am__EXEEXT_4 = bof$(EXEEXT) bof_lincom$(EXEEXT) bof_phase$(EXEEXT)
-am__EXEEXT_5 = bzip_get$(EXEEXT) bzip_get_get$(EXEEXT) \
+	alter_recip_zero$(EXEEXT) alter_scalar_affix$(EXEEXT) \
+	alter_spec$(EXEEXT) alter_spec_affix$(EXEEXT) \
+	alter_spec_meta$(EXEEXT) alter_window$(EXEEXT)
+am__EXEEXT_4 = ascii_add$(EXEEXT) ascii_get$(EXEEXT) \
+	ascii_get_get$(EXEEXT) ascii_nframes$(EXEEXT) \
+	ascii_put$(EXEEXT)
+am__EXEEXT_5 = bof$(EXEEXT) bof_lincom$(EXEEXT) bof_phase$(EXEEXT)
+am__EXEEXT_6 = bzip_get$(EXEEXT) bzip_get_get$(EXEEXT) \
 	bzip_move_from$(EXEEXT) bzip_nframes$(EXEEXT)
-am__EXEEXT_6 = close$(EXEEXT) close_bad$(EXEEXT) \
+am__EXEEXT_7 = close$(EXEEXT) close_bad$(EXEEXT) \
 	close_discard$(EXEEXT) close_null$(EXEEXT)
-am__EXEEXT_7 = convert_complex128_complex64$(EXEEXT) \
+am__EXEEXT_8 = convert_complex128_complex64$(EXEEXT) \
 	convert_complex128_float64$(EXEEXT) \
 	convert_complex128_int64$(EXEEXT) \
 	convert_complex128_uint64$(EXEEXT) \
@@ -189,56 +229,71 @@ am__EXEEXT_7 = convert_complex128_complex64$(EXEEXT) \
 	convert_uint8_int64$(EXEEXT) convert_uint8_int8$(EXEEXT) \
 	convert_uint8_uint16$(EXEEXT) convert_uint8_uint32$(EXEEXT) \
 	convert_uint8_uint64$(EXEEXT)
-am__EXEEXT_8 = creat$(EXEEXT) creat_excl$(EXEEXT) \
+am__EXEEXT_9 = creat$(EXEEXT) creat_excl$(EXEEXT) \
 	creat_rdonly$(EXEEXT)
-am__EXEEXT_9 = cvlist$(EXEEXT) cvlist_array$(EXEEXT) \
-	cvlist_array_meta$(EXEEXT) cvlist_invalid$(EXEEXT) \
-	cvlist_meta$(EXEEXT) cvlist_meta_invalid$(EXEEXT)
-am__EXEEXT_10 = del$(EXEEXT) del_carray$(EXEEXT) \
+am__EXEEXT_10 = cvlist$(EXEEXT) cvlist_array$(EXEEXT) \
+	cvlist_array_hidden$(EXEEXT) cvlist_array_meta$(EXEEXT) \
+	cvlist_array_meta_hidden$(EXEEXT) cvlist_hidden$(EXEEXT) \
+	cvlist_invalid$(EXEEXT) cvlist_meta$(EXEEXT) \
+	cvlist_meta_hidden$(EXEEXT) cvlist_meta_invalid$(EXEEXT)
+am__EXEEXT_11 = del$(EXEEXT) del_carray$(EXEEXT) \
 	del_carray_deref$(EXEEXT) del_const$(EXEEXT) \
 	del_const_deref$(EXEEXT) del_const_force$(EXEEXT) \
 	del_data$(EXEEXT) del_derived$(EXEEXT) \
-	del_derived_force$(EXEEXT) del_meta$(EXEEXT) \
-	del_meta_force$(EXEEXT)
-am__EXEEXT_11 = dfes_bit$(EXEEXT) dfes_divide$(EXEEXT) \
+	del_derived_after$(EXEEXT) del_derived_force$(EXEEXT) \
+	del_meta$(EXEEXT) del_meta_force$(EXEEXT)
+am__EXEEXT_12 = dfes_bit$(EXEEXT) dfes_divide$(EXEEXT) \
 	dfes_lincom$(EXEEXT) dfes_linterp$(EXEEXT) \
 	dfes_multiply$(EXEEXT) dfes_null$(EXEEXT) dfes_phase$(EXEEXT) \
 	dfes_raw$(EXEEXT) dfes_recip$(EXEEXT) dfes_zero$(EXEEXT)
-am__EXEEXT_12 = encode_alter$(EXEEXT) encode_get$(EXEEXT) \
+am__EXEEXT_13 = desync$(EXEEXT) desync_flush$(EXEEXT) \
+	desync_reopen$(EXEEXT) desync_reopen_inv$(EXEEXT)
+am__EXEEXT_14 = elist_alias$(EXEEXT) elist_hidden$(EXEEXT) \
+	elist_noalias$(EXEEXT) elist_scalar$(EXEEXT)
+am__EXEEXT_15 = encode_alter$(EXEEXT) encode_get$(EXEEXT) \
 	encode_move$(EXEEXT)
-am__EXEEXT_13 = endian_alter$(EXEEXT) endian_get$(EXEEXT) \
-	endian_move$(EXEEXT)
-am__EXEEXT_14 = entry_bad_code$(EXEEXT) entry_bit$(EXEEXT) \
-	entry_bit_scalar$(EXEEXT) entry_invalid$(EXEEXT) \
-	entry_lincom$(EXEEXT) entry_lincom_scalar$(EXEEXT) \
-	entry_linterp$(EXEEXT) entry_multiply$(EXEEXT) \
-	entry_phase$(EXEEXT) entry_phase_scalar$(EXEEXT) \
-	entry_polynom$(EXEEXT) entry_polynom_scalar$(EXEEXT) \
-	entry_raw$(EXEEXT) entry_raw_scalar$(EXEEXT) \
-	entry_raw_scalar_code$(EXEEXT) entry_raw_scalar_type$(EXEEXT) \
-	entry_scalar_repr$(EXEEXT) entry_type$(EXEEXT)
-am__EXEEXT_15 = eof$(EXEEXT) eof_index$(EXEEXT) eof_lincom$(EXEEXT) \
+am__EXEEXT_16 = endian_alter$(EXEEXT) endian_alter_sie$(EXEEXT) \
+	endian_get$(EXEEXT) endian_move$(EXEEXT)
+am__EXEEXT_17 = entry_bad_code$(EXEEXT) entry_bit$(EXEEXT) \
+	entry_bit_scalar$(EXEEXT) entry_divide$(EXEEXT) \
+	entry_invalid$(EXEEXT) entry_lincom$(EXEEXT) \
+	entry_lincom_scalar$(EXEEXT) entry_linterp$(EXEEXT) \
+	entry_mplex$(EXEEXT) entry_mplex_scalar$(EXEEXT) \
+	entry_multiply$(EXEEXT) entry_phase$(EXEEXT) \
+	entry_phase_scalar$(EXEEXT) entry_polynom$(EXEEXT) \
+	entry_polynom_scalar$(EXEEXT) entry_raw$(EXEEXT) \
+	entry_raw_scalar$(EXEEXT) entry_raw_scalar_code$(EXEEXT) \
+	entry_raw_scalar_type$(EXEEXT) entry_scalar_repr$(EXEEXT) \
+	entry_recip$(EXEEXT) entry_type$(EXEEXT) \
+	entry_type_alias$(EXEEXT) entry_window$(EXEEXT) \
+	entry_window_scalar$(EXEEXT)
+am__EXEEXT_18 = eof$(EXEEXT) eof_index$(EXEEXT) eof_lincom$(EXEEXT) \
 	eof_phase$(EXEEXT)
-am__EXEEXT_16 = error$(EXEEXT) error_error$(EXEEXT) \
-	error_short$(EXEEXT)
-am__EXEEXT_17 = file$(EXEEXT) file_code$(EXEEXT) file_type$(EXEEXT)
-am__EXEEXT_18 = flist$(EXEEXT) flist_invalid$(EXEEXT) \
-	flist_meta$(EXEEXT) flist_meta_invalid$(EXEEXT) \
-	flist_type$(EXEEXT) flist_type_invalid$(EXEEXT) \
-	flist_type_meta$(EXEEXT) flist_type_meta_invalid$(EXEEXT)
-am__EXEEXT_19 = flush$(EXEEXT) flush_all$(EXEEXT) \
+am__EXEEXT_19 = error$(EXEEXT) error_error$(EXEEXT) error_num$(EXEEXT) \
+	error_short$(EXEEXT) error_verbose$(EXEEXT) \
+	error_verbose_prefix$(EXEEXT)
+am__EXEEXT_20 = file$(EXEEXT) file_code$(EXEEXT) file_type$(EXEEXT)
+am__EXEEXT_21 = flist$(EXEEXT) flist_hidden$(EXEEXT) \
+	flist_invalid$(EXEEXT) flist_meta$(EXEEXT) \
+	flist_meta_hidden$(EXEEXT) flist_meta_invalid$(EXEEXT) \
+	flist_type$(EXEEXT) flist_type_hidden$(EXEEXT) \
+	flist_type_invalid$(EXEEXT) flist_type_meta$(EXEEXT) \
+	flist_type_meta_hidden$(EXEEXT) \
+	flist_type_meta_invalid$(EXEEXT)
+am__EXEEXT_22 = flush$(EXEEXT) flush_all$(EXEEXT) \
 	flush_bad_code$(EXEEXT) flush_invalid$(EXEEXT) \
-	flush_meta$(EXEEXT) flush_spec$(EXEEXT)
-am__EXEEXT_20 = foffs_alter$(EXEEXT) foffs_get$(EXEEXT) \
+	flush_meta$(EXEEXT) flush_ref$(EXEEXT) flush_spec$(EXEEXT)
+am__EXEEXT_23 = foffs_alter$(EXEEXT) foffs_get$(EXEEXT) \
 	foffs_move$(EXEEXT)
-am__EXEEXT_21 = fragment_index$(EXEEXT) fragment_name$(EXEEXT) \
-	fragment_name_oor$(EXEEXT)
- at LFS_TRANSITIONAL_API_TRUE@am__EXEEXT_22 = get64$(EXEEXT)
- at LFS_TRANSITIONAL_API_TRUE@am__EXEEXT_23 = get_off64$(EXEEXT)
-am__EXEEXT_24 = $(am__EXEEXT_22) get_bad_code$(EXEEXT) \
-	get_bit$(EXEEXT) get_carray$(EXEEXT) get_carray_len$(EXEEXT) \
-	get_carray_slice$(EXEEXT) get_char$(EXEEXT) \
-	get_clincom$(EXEEXT) get_complex128$(EXEEXT) \
+am__EXEEXT_24 = fragment_affix$(EXEEXT) fragment_affix_alter$(EXEEXT) \
+	fragment_affix_alter2$(EXEEXT) fragment_affix_dup$(EXEEXT) \
+	fragment_index$(EXEEXT) fragment_index_alias$(EXEEXT) \
+	fragment_name$(EXEEXT) fragment_name_oor$(EXEEXT) \
+	fragment_num$(EXEEXT) fragment_parent$(EXEEXT)
+am__EXEEXT_25 = get64$(EXEEXT) get_affix$(EXEEXT) \
+	get_bad_code$(EXEEXT) get_bit$(EXEEXT) get_carray$(EXEEXT) \
+	get_carray_len$(EXEEXT) get_carray_slice$(EXEEXT) \
+	get_char$(EXEEXT) get_clincom$(EXEEXT) get_complex128$(EXEEXT) \
 	get_complex64$(EXEEXT) get_const$(EXEEXT) \
 	get_const_complex$(EXEEXT) get_const_repr$(EXEEXT) \
 	get_cpolynom$(EXEEXT) get_divide$(EXEEXT) get_endian8$(EXEEXT) \
@@ -256,134 +311,181 @@ am__EXEEXT_24 = $(am__EXEEXT_22) get_bad_code$(EXEEXT) \
 	get_endian_float64_big$(EXEEXT) \
 	get_endian_float64_little$(EXEEXT) get_ff$(EXEEXT) \
 	get_float32$(EXEEXT) get_float64$(EXEEXT) get_foffs$(EXEEXT) \
-	get_fs$(EXEEXT) get_int8$(EXEEXT) get_int16$(EXEEXT) \
+	get_fs$(EXEEXT) get_here$(EXEEXT) get_here_foffs$(EXEEXT) \
+	get_heres$(EXEEXT) get_int8$(EXEEXT) get_int16$(EXEEXT) \
 	get_int32$(EXEEXT) get_int64$(EXEEXT) get_invalid$(EXEEXT) \
 	get_lincom1$(EXEEXT) get_lincom2$(EXEEXT) get_lincom3$(EXEEXT) \
 	get_lincom_noin$(EXEEXT) get_lincom_non$(EXEEXT) \
+	get_lincom_null$(EXEEXT) get_lincom_spf$(EXEEXT) \
 	get_linterp$(EXEEXT) get_linterp_noin$(EXEEXT) \
 	get_linterp_notab$(EXEEXT) get_linterp_sort$(EXEEXT) \
-	get_multiply$(EXEEXT) get_multiply_noin$(EXEEXT) \
-	get_nonexistent$(EXEEXT) get_null$(EXEEXT) $(am__EXEEXT_23) \
-	get_phase$(EXEEXT) get_polynom$(EXEEXT) \
+	get_mplex$(EXEEXT) get_mplex_bof$(EXEEXT) \
+	get_mplex_lb$(EXEEXT) get_mplex_lball$(EXEEXT) \
+	get_mplex_nolb$(EXEEXT) get_multiply$(EXEEXT) \
+	get_multiply_noin$(EXEEXT) get_nonexistent$(EXEEXT) \
+	get_null$(EXEEXT) get_off64$(EXEEXT) get_phase$(EXEEXT) \
+	get_phase_affix$(EXEEXT) get_polynom$(EXEEXT) \
 	get_polynom_noin$(EXEEXT) get_recip$(EXEEXT) \
 	get_recip_const$(EXEEXT) get_recurse$(EXEEXT) \
-	get_sbit$(EXEEXT) get_sf$(EXEEXT) get_ss$(EXEEXT) \
-	get_type$(EXEEXT) get_uint16$(EXEEXT) get_uint32$(EXEEXT) \
-	get_uint64$(EXEEXT) get_zero$(EXEEXT)
-am__EXEEXT_25 = global_name$(EXEEXT) global_ref$(EXEEXT) \
-	global_ref_empty$(EXEEXT) global_ref_set$(EXEEXT)
-am__EXEEXT_26 = gzip_get$(EXEEXT) gzip_get_get$(EXEEXT) \
-	gzip_move_from$(EXEEXT) gzip_nframes$(EXEEXT)
-am__EXEEXT_27 = header_complex$(EXEEXT)
-am__EXEEXT_28 = include$(EXEEXT) include_accmode$(EXEEXT) \
-	include_auto$(EXEEXT) include_cb$(EXEEXT) \
-	include_creat$(EXEEXT) include_ignore$(EXEEXT) \
-	include_index$(EXEEXT) include_invalid$(EXEEXT) \
-	include_nonexistent$(EXEEXT) include_pc$(EXEEXT) \
-	include_ref$(EXEEXT) include_syntax$(EXEEXT)
-am__EXEEXT_29 = index$(EXEEXT) index_domain$(EXEEXT) \
+	get_rofs$(EXEEXT) get_sbit$(EXEEXT) get_sf$(EXEEXT) \
+	get_ss$(EXEEXT) get_type$(EXEEXT) get_uint16$(EXEEXT) \
+	get_uint32$(EXEEXT) get_uint64$(EXEEXT) get_window$(EXEEXT) \
+	get_window_clr$(EXEEXT) get_window_ge$(EXEEXT) \
+	get_window_gt$(EXEEXT) get_window_le$(EXEEXT) \
+	get_window_lt$(EXEEXT) get_window_ne$(EXEEXT) \
+	get_window_set$(EXEEXT) get_zero$(EXEEXT)
+am__EXEEXT_26 = global_flags$(EXEEXT) global_name$(EXEEXT) \
+	global_ref$(EXEEXT) global_ref_empty$(EXEEXT) \
+	global_ref_set$(EXEEXT)
+am__EXEEXT_27 = gzip_add$(EXEEXT) gzip_get$(EXEEXT) \
+	gzip_get_get$(EXEEXT) gzip_get_get2$(EXEEXT) \
+	gzip_get_put$(EXEEXT) gzip_move_from$(EXEEXT) \
+	gzip_move_to$(EXEEXT) gzip_nframes$(EXEEXT) gzip_put$(EXEEXT) \
+	gzip_put_get$(EXEEXT)
+am__EXEEXT_28 = header_complex$(EXEEXT)
+am__EXEEXT_29 = hide$(EXEEXT) hide_hidden$(EXEEXT) \
+	hide_unhide$(EXEEXT)
+am__EXEEXT_30 = include$(EXEEXT) include_accmode$(EXEEXT) \
+	include_affix$(EXEEXT) include_auto$(EXEEXT) \
+	include_cb$(EXEEXT) include_creat$(EXEEXT) \
+	include_ignore$(EXEEXT) include_index$(EXEEXT) \
+	include_invalid$(EXEEXT) include_nonexistent$(EXEEXT) \
+	include_pc$(EXEEXT) include_ref$(EXEEXT) include_sub$(EXEEXT) \
+	include_syntax$(EXEEXT)
+am__EXEEXT_31 = index$(EXEEXT) index_domain$(EXEEXT) \
 	index_range$(EXEEXT)
- at INCLUDE_LEGACY_API_TRUE@am__EXEEXT_30 = legacy_get$(EXEEXT) \
+ at INCLUDE_LEGACY_API_TRUE@am__EXEEXT_32 = legacy_get$(EXEEXT) \
 @INCLUDE_LEGACY_API_TRUE@	legacy_get_put$(EXEEXT) \
 @INCLUDE_LEGACY_API_TRUE@	legacy_get_rofs$(EXEEXT) \
 @INCLUDE_LEGACY_API_TRUE@	legacy_nframes$(EXEEXT) \
 @INCLUDE_LEGACY_API_TRUE@	legacy_nonexistent$(EXEEXT) \
 @INCLUDE_LEGACY_API_TRUE@	legacy_put$(EXEEXT) \
 @INCLUDE_LEGACY_API_TRUE@	legacy_spf$(EXEEXT)
-am__EXEEXT_31 = lzma_get$(EXEEXT) lzma_nframes$(EXEEXT)
-am__EXEEXT_32 = madd$(EXEEXT) madd_bit$(EXEEXT) \
+am__EXEEXT_33 = lzma_get$(EXEEXT) lzma_nframes$(EXEEXT)
+am__EXEEXT_34 = madd$(EXEEXT) madd_affix$(EXEEXT) madd_alias$(EXEEXT) \
+	madd_alias_affix$(EXEEXT) madd_bit$(EXEEXT) \
 	madd_bit_invalid$(EXEEXT) madd_carray$(EXEEXT) \
 	madd_clincom$(EXEEXT) madd_const$(EXEEXT) \
 	madd_cpolynom$(EXEEXT) madd_crecip$(EXEEXT) \
 	madd_crecip89$(EXEEXT) madd_divide$(EXEEXT) \
-	madd_lincom$(EXEEXT) madd_lincom_invalid$(EXEEXT) \
-	madd_linterp$(EXEEXT) madd_linterp_invalid$(EXEEXT) \
+	madd_index$(EXEEXT) madd_lincom$(EXEEXT) \
+	madd_lincom_invalid$(EXEEXT) madd_linterp$(EXEEXT) \
+	madd_linterp_invalid$(EXEEXT) madd_mplex$(EXEEXT) \
 	madd_multiply$(EXEEXT) madd_multiply_invalid$(EXEEXT) \
 	madd_phase$(EXEEXT) madd_phase_invalid$(EXEEXT) \
 	madd_polynom$(EXEEXT) madd_recip$(EXEEXT) madd_sbit$(EXEEXT) \
 	madd_spec$(EXEEXT) madd_spec_directive$(EXEEXT) \
-	madd_spec_invalid$(EXEEXT) madd_string$(EXEEXT)
-am__EXEEXT_33 = move$(EXEEXT) move_data_enc_ar$(EXEEXT) \
-	move_data_enc_ra$(EXEEXT) move_data_endian$(EXEEXT) \
-	move_data_foffs$(EXEEXT) move_data_nop$(EXEEXT) \
-	move_index$(EXEEXT) move_meta$(EXEEXT) move_protect$(EXEEXT) \
-	move_subdir$(EXEEXT)
-am__EXEEXT_34 = name$(EXEEXT) name_move$(EXEEXT)
-am__EXEEXT_35 = nfields$(EXEEXT) nfields_invalid$(EXEEXT) \
-	nfields_type$(EXEEXT) nfields_type_invalid$(EXEEXT)
-am__EXEEXT_36 = nfragments$(EXEEXT)
- at LFS_TRANSITIONAL_API_TRUE@am__EXEEXT_37 = nframes64$(EXEEXT)
- at LFS_TRANSITIONAL_API_TRUE@am__EXEEXT_38 = nframes_off64$(EXEEXT)
-am__EXEEXT_39 = nframes$(EXEEXT) $(am__EXEEXT_37) \
+	madd_spec_invalid$(EXEEXT) madd_spec_resolv$(EXEEXT) \
+	madd_string$(EXEEXT) madd_window$(EXEEXT)
+am__EXEEXT_35 = move$(EXEEXT) move_affix$(EXEEXT) \
+	move_affix_dup$(EXEEXT) move_alias$(EXEEXT) \
+	move_data_enc_ar$(EXEEXT) move_data_enc_ra$(EXEEXT) \
+	move_data_endian$(EXEEXT) move_data_foffs$(EXEEXT) \
+	move_data_nop$(EXEEXT) move_index$(EXEEXT) move_meta$(EXEEXT) \
+	move_protect$(EXEEXT) move_subdir$(EXEEXT)
+am__EXEEXT_36 = name$(EXEEXT) name_affix$(EXEEXT) \
+	name_affix_bad$(EXEEXT) name_alias$(EXEEXT) name_dup$(EXEEXT) \
+	name_move$(EXEEXT) name_move_alias$(EXEEXT) name_updb$(EXEEXT) \
+	name_updb_alias$(EXEEXT) name_updb_const$(EXEEXT) \
+	name_updb_const_alias$(EXEEXT)
+am__EXEEXT_37 = nentries_alias$(EXEEXT) nentries_hidden$(EXEEXT) \
+	nentries_noalias$(EXEEXT) nentries_scalar$(EXEEXT)
+am__EXEEXT_38 = nfields$(EXEEXT) nfields_hidden$(EXEEXT) \
+	nfields_invalid$(EXEEXT) nfields_type$(EXEEXT) \
+	nfields_type_hidden$(EXEEXT) nfields_type_invalid$(EXEEXT) \
+	nfields_vector$(EXEEXT) nfields_vector_hidden$(EXEEXT) \
+	nfields_vector_invalid$(EXEEXT)
+am__EXEEXT_39 = nframes$(EXEEXT) nframes64$(EXEEXT) \
 	nframes_empty$(EXEEXT) nframes_invalid$(EXEEXT) \
-	$(am__EXEEXT_38) nframes_spf$(EXEEXT)
-am__EXEEXT_40 = nmeta$(EXEEXT) nmeta_invalid$(EXEEXT) \
-	nmeta_parent$(EXEEXT) nmeta_type$(EXEEXT) \
+	nframes_off64$(EXEEXT) nframes_spf$(EXEEXT)
+am__EXEEXT_40 = nmeta$(EXEEXT) nmeta_hidden$(EXEEXT) \
+	nmeta_invalid$(EXEEXT) nmeta_parent$(EXEEXT) \
+	nmeta_type$(EXEEXT) nmeta_type_hidden$(EXEEXT) \
 	nmeta_type_invalid$(EXEEXT) nmeta_type_parent$(EXEEXT) \
 	nmeta_vectors$(EXEEXT) nmeta_vectors_del$(EXEEXT) \
-	nmeta_vectors_invalid$(EXEEXT) nmeta_vectors_parent$(EXEEXT)
-am__EXEEXT_41 = nvectors$(EXEEXT) nvectors_invalid$(EXEEXT)
-am__EXEEXT_42 = open$(EXEEXT) open_cb_abort$(EXEEXT) \
+	nmeta_vectors_hidden$(EXEEXT) nmeta_vectors_invalid$(EXEEXT) \
+	nmeta_vectors_parent$(EXEEXT)
+am__EXEEXT_41 = open$(EXEEXT) open_abs$(EXEEXT) open_cb_abort$(EXEEXT) \
 	open_cb_cont$(EXEEXT) open_cb_ignore$(EXEEXT) \
 	open_cb_invalid$(EXEEXT) open_cb_rescan$(EXEEXT) \
 	open_eaccess$(EXEEXT) open_nonexistent$(EXEEXT) \
-	open_notdirfile$(EXEEXT)
-am__EXEEXT_43 = parent$(EXEEXT)
-am__EXEEXT_44 = parse_badline$(EXEEXT) parse_bit$(EXEEXT) \
-	parse_bit4$(EXEEXT) parse_bit_bitnum$(EXEEXT) \
-	parse_bit_bitsize$(EXEEXT) parse_bit_ncols$(EXEEXT) \
-	parse_bit_numbits$(EXEEXT) parse_bit_scalar$(EXEEXT) \
-	parse_carray$(EXEEXT) parse_carray_long$(EXEEXT) \
-	parse_const$(EXEEXT) parse_const_ncols$(EXEEXT) \
-	parse_divide$(EXEEXT) parse_duplicate$(EXEEXT) \
-	parse_duplicate_ignore$(EXEEXT) parse_endian_bad$(EXEEXT) \
-	parse_endian_big$(EXEEXT) parse_endian_force$(EXEEXT) \
-	parse_endian_little$(EXEEXT) parse_endian_slash$(EXEEXT) \
-	parse_eol$(EXEEXT) parse_foffs$(EXEEXT) \
-	parse_foffs_include$(EXEEXT) parse_foffs_slash$(EXEEXT) \
+	open_notdirfile$(EXEEXT) open_sym_a$(EXEEXT) \
+	open_sym_al$(EXEEXT) open_sym_at$(EXEEXT) open_sym_c$(EXEEXT) \
+	open_sym_cl$(EXEEXT) open_sym_ct$(EXEEXT) open_sym_p$(EXEEXT) \
+	open_sym_pl$(EXEEXT) open_sym_pt$(EXEEXT)
+am__EXEEXT_42 = parse_alias$(EXEEXT) parse_alias_code$(EXEEXT) \
+	parse_alias_dup$(EXEEXT) parse_alias_meta$(EXEEXT) \
+	parse_alias_missing$(EXEEXT) parse_badline$(EXEEXT) \
+	parse_bit$(EXEEXT) parse_bit4$(EXEEXT) \
+	parse_bit_bitnum$(EXEEXT) parse_bit_bitsize$(EXEEXT) \
+	parse_bit_ncols$(EXEEXT) parse_bit_numbits$(EXEEXT) \
+	parse_bit_scalar$(EXEEXT) parse_carray$(EXEEXT) \
+	parse_carray_long$(EXEEXT) parse_const$(EXEEXT) \
+	parse_const_complex$(EXEEXT) parse_const_ncols$(EXEEXT) \
+	parse_divide$(EXEEXT) parse_double$(EXEEXT) \
+	parse_duplicate$(EXEEXT) parse_duplicate_ignore$(EXEEXT) \
+	parse_endian_bad$(EXEEXT) parse_endian_big$(EXEEXT) \
+	parse_endian_force$(EXEEXT) parse_endian_little$(EXEEXT) \
+	parse_endian_slash$(EXEEXT) parse_eol$(EXEEXT) \
+	parse_foffs$(EXEEXT) parse_foffs_include$(EXEEXT) \
+	parse_foffs_slash$(EXEEXT) parse_hidden$(EXEEXT) \
+	parse_hidden_field$(EXEEXT) parse_hidden_meta$(EXEEXT) \
 	parse_include$(EXEEXT) parse_include_absolute$(EXEEXT) \
-	parse_include_absrel$(EXEEXT) \
+	parse_include_absrel$(EXEEXT) parse_include_affix_ref$(EXEEXT) \
+	parse_include_dir$(EXEEXT) parse_include_loop$(EXEEXT) \
 	parse_include_nonexistent$(EXEEXT) \
+	parse_include_prefix$(EXEEXT) \
+	parse_include_prefix_dup$(EXEEXT) \
+	parse_include_preprefix$(EXEEXT) parse_include_ref$(EXEEXT) \
 	parse_include_relabs$(EXEEXT) parse_include_relrel$(EXEEXT) \
-	parse_include_slash$(EXEEXT) parse_index$(EXEEXT) \
+	parse_include_slash$(EXEEXT) parse_include_suffix$(EXEEXT) \
+	parse_include_sufsuffix$(EXEEXT) parse_index$(EXEEXT) \
 	parse_lincom$(EXEEXT) parse_lincom_ncols1$(EXEEXT) \
 	parse_lincom_ncols2$(EXEEXT) parse_lincom_nfields$(EXEEXT) \
 	parse_lincom_nofields$(EXEEXT) parse_lincom_non$(EXEEXT) \
 	parse_lincom_non_ncols$(EXEEXT) parse_lincom_scalar$(EXEEXT) \
 	parse_linterp$(EXEEXT) parse_linterp_ncols$(EXEEXT) \
-	parse_meta$(EXEEXT) parse_meta_implicit$(EXEEXT) \
-	parse_meta_implicit2$(EXEEXT) parse_meta_index$(EXEEXT) \
-	parse_meta_index2$(EXEEXT) parse_meta_parent$(EXEEXT) \
-	parse_meta_raw$(EXEEXT) parse_multiply$(EXEEXT) \
-	parse_multiply_ncols$(EXEEXT) parse_name$(EXEEXT) \
-	parse_name_dot$(EXEEXT) parse_name_ext$(EXEEXT) \
-	parse_name_pedantic$(EXEEXT) parse_ncols$(EXEEXT) \
-	parse_phase$(EXEEXT) parse_phase_ncols$(EXEEXT) \
-	parse_phase_scalar$(EXEEXT) parse_polynom$(EXEEXT) \
-	parse_polynom_ncols1$(EXEEXT) parse_polynom_ncols2$(EXEEXT) \
-	parse_polynom_scalar$(EXEEXT) parse_protect_all$(EXEEXT) \
-	parse_protect_bad$(EXEEXT) parse_protect_data$(EXEEXT) \
-	parse_protect_format$(EXEEXT) parse_protect_none$(EXEEXT) \
-	parse_quote$(EXEEXT) parse_quote_mismatch$(EXEEXT) \
-	parse_raw$(EXEEXT) parse_raw_char$(EXEEXT) \
-	parse_raw_ncols$(EXEEXT) parse_raw_scalar$(EXEEXT) \
-	parse_raw_spf$(EXEEXT) parse_raw_type$(EXEEXT) \
-	parse_recip$(EXEEXT) parse_ref$(EXEEXT) \
-	parse_ref_nonexistent$(EXEEXT) parse_sbit$(EXEEXT) \
-	parse_sort$(EXEEXT) parse_string$(EXEEXT) \
+	parse_malias$(EXEEXT) parse_malias_dup$(EXEEXT) \
+	parse_malias_meta$(EXEEXT) parse_meta$(EXEEXT) \
+	parse_meta_affix$(EXEEXT) parse_meta_alias$(EXEEXT) \
+	parse_meta_implicit$(EXEEXT) parse_meta_implicit2$(EXEEXT) \
+	parse_meta_implicit_affix$(EXEEXT) parse_meta_index$(EXEEXT) \
+	parse_meta_index2$(EXEEXT) parse_meta_jump$(EXEEXT) \
+	parse_meta_malias$(EXEEXT) parse_meta_meta$(EXEEXT) \
+	parse_meta_parent$(EXEEXT) parse_meta_raw$(EXEEXT) \
+	parse_mplex$(EXEEXT) parse_mplex_ncols$(EXEEXT) \
+	parse_mplex_nomax$(EXEEXT) parse_mplex_scalar$(EXEEXT) \
+	parse_multiply$(EXEEXT) parse_multiply_ncols$(EXEEXT) \
+	parse_name$(EXEEXT) parse_name_dot$(EXEEXT) \
+	parse_name_ext$(EXEEXT) parse_name_pedantic$(EXEEXT) \
+	parse_ncols$(EXEEXT) parse_phase$(EXEEXT) \
+	parse_phase_ncols$(EXEEXT) parse_phase_scalar$(EXEEXT) \
+	parse_polynom$(EXEEXT) parse_polynom_ncols1$(EXEEXT) \
+	parse_polynom_ncols2$(EXEEXT) parse_polynom_scalar$(EXEEXT) \
+	parse_protect_all$(EXEEXT) parse_protect_bad$(EXEEXT) \
+	parse_protect_data$(EXEEXT) parse_protect_format$(EXEEXT) \
+	parse_protect_none$(EXEEXT) parse_quote$(EXEEXT) \
+	parse_quote_mismatch$(EXEEXT) parse_raw$(EXEEXT) \
+	parse_raw_char$(EXEEXT) parse_raw_ncols$(EXEEXT) \
+	parse_raw_scalar$(EXEEXT) parse_raw_spf$(EXEEXT) \
+	parse_raw_type$(EXEEXT) parse_recip$(EXEEXT) \
+	parse_ref$(EXEEXT) parse_ref_nonexistent$(EXEEXT) \
+	parse_sbit$(EXEEXT) parse_sort$(EXEEXT) parse_string$(EXEEXT) \
 	parse_string_ncols$(EXEEXT) parse_string_null$(EXEEXT) \
-	parse_version$(EXEEXT) parse_version_include$(EXEEXT) \
-	parse_version_permissive$(EXEEXT) parse_version_slash$(EXEEXT) \
-	parse_whitespace$(EXEEXT)
-am__EXEEXT_45 = protect_alter$(EXEEXT) protect_get$(EXEEXT)
- at LFS_TRANSITIONAL_API_TRUE@am__EXEEXT_46 = put64$(EXEEXT)
- at LFS_TRANSITIONAL_API_TRUE@am__EXEEXT_47 = put_off64$(EXEEXT)
-am__EXEEXT_48 = $(am__EXEEXT_46) put_bad_code$(EXEEXT) \
-	put_bit$(EXEEXT) put_bof$(EXEEXT) put_carray$(EXEEXT) \
-	put_carray_slice$(EXEEXT) put_char$(EXEEXT) \
-	put_complex128$(EXEEXT) put_complex64$(EXEEXT) \
-	put_const$(EXEEXT) put_const_protect$(EXEEXT) \
-	put_divide$(EXEEXT) put_endian8$(EXEEXT) put_endian16$(EXEEXT) \
+	parse_version$(EXEEXT) parse_version_89$(EXEEXT) \
+	parse_version_98$(EXEEXT) parse_version_include$(EXEEXT) \
+	parse_version_permissive$(EXEEXT) parse_version_p8$(EXEEXT) \
+	parse_version_p9$(EXEEXT) parse_version_slash$(EXEEXT) \
+	parse_whitespace$(EXEEXT) parse_window$(EXEEXT) \
+	parse_window_ncols$(EXEEXT) parse_window_op$(EXEEXT) \
+	parse_window_scalar$(EXEEXT)
+am__EXEEXT_43 = protect_alter$(EXEEXT) protect_get$(EXEEXT)
+am__EXEEXT_44 = put64$(EXEEXT) put_bad_code$(EXEEXT) put_bit$(EXEEXT) \
+	put_bof$(EXEEXT) put_carray$(EXEEXT) put_carray_slice$(EXEEXT) \
+	put_char$(EXEEXT) put_complex128$(EXEEXT) \
+	put_complex64$(EXEEXT) put_const$(EXEEXT) \
+	put_const_protect$(EXEEXT) put_divide$(EXEEXT) \
+	put_endian8$(EXEEXT) put_endian16$(EXEEXT) \
 	put_endian32$(EXEEXT) put_endian64$(EXEEXT) \
 	put_endian_complex128_arm$(EXEEXT) \
 	put_endian_complex128_big$(EXEEXT) \
@@ -398,13 +500,14 @@ am__EXEEXT_48 = $(am__EXEEXT_46) put_bad_code$(EXEEXT) \
 	put_endian_float64_big$(EXEEXT) \
 	put_endian_float64_little$(EXEEXT) put_ff$(EXEEXT) \
 	put_float32$(EXEEXT) put_float64$(EXEEXT) put_foffs$(EXEEXT) \
-	put_fs$(EXEEXT) put_int8$(EXEEXT) put_int16$(EXEEXT) \
-	put_int32$(EXEEXT) put_int64$(EXEEXT) put_invalid$(EXEEXT) \
-	put_lincom1$(EXEEXT) put_lincom2$(EXEEXT) \
-	put_lincom_noin$(EXEEXT) put_linterp$(EXEEXT) \
-	put_linterp_noin$(EXEEXT) put_linterp_nomono$(EXEEXT) \
-	put_linterp_notab$(EXEEXT) put_linterp_reverse$(EXEEXT) \
-	put_multiply$(EXEEXT) put_null$(EXEEXT) $(am__EXEEXT_47) \
+	put_fs$(EXEEXT) put_here$(EXEEXT) put_heres$(EXEEXT) \
+	put_int8$(EXEEXT) put_int16$(EXEEXT) put_int32$(EXEEXT) \
+	put_int64$(EXEEXT) put_invalid$(EXEEXT) put_lincom1$(EXEEXT) \
+	put_lincom2$(EXEEXT) put_lincom_noin$(EXEEXT) \
+	put_linterp$(EXEEXT) put_linterp_noin$(EXEEXT) \
+	put_linterp_nomono$(EXEEXT) put_linterp_notab$(EXEEXT) \
+	put_linterp_reverse$(EXEEXT) put_mplex$(EXEEXT) \
+	put_multiply$(EXEEXT) put_null$(EXEEXT) put_off64$(EXEEXT) \
 	put_phase$(EXEEXT) put_phase_noin$(EXEEXT) \
 	put_polynom1$(EXEEXT) put_polynom2$(EXEEXT) \
 	put_polynom_noin$(EXEEXT) put_protect$(EXEEXT) \
@@ -412,26 +515,40 @@ am__EXEEXT_48 = $(am__EXEEXT_46) put_bad_code$(EXEEXT) \
 	put_repr$(EXEEXT) put_rofs$(EXEEXT) put_sbit$(EXEEXT) \
 	put_sf$(EXEEXT) put_ss$(EXEEXT) put_string$(EXEEXT) \
 	put_string_protect$(EXEEXT) put_type$(EXEEXT) \
-	put_uint16$(EXEEXT) put_uint32$(EXEEXT) put_uint64$(EXEEXT)
-am__EXEEXT_49 = ref$(EXEEXT) ref_none$(EXEEXT) ref_two$(EXEEXT)
-am__EXEEXT_50 = repr_a$(EXEEXT) repr_float32$(EXEEXT) \
+	put_uint16$(EXEEXT) put_uint32$(EXEEXT) put_uint64$(EXEEXT) \
+	put_window$(EXEEXT) put_zero$(EXEEXT)
+am__EXEEXT_45 = ref$(EXEEXT) ref_none$(EXEEXT) ref_two$(EXEEXT)
+am__EXEEXT_46 = repr_a$(EXEEXT) repr_float32$(EXEEXT) \
 	repr_float64$(EXEEXT) repr_i$(EXEEXT) repr_int16$(EXEEXT) \
 	repr_int32$(EXEEXT) repr_int64$(EXEEXT) repr_int8$(EXEEXT) \
 	repr_m$(EXEEXT) repr_r$(EXEEXT) repr_real_a$(EXEEXT) \
 	repr_real_i$(EXEEXT) repr_real_m$(EXEEXT) repr_real_r$(EXEEXT) \
 	repr_uint16$(EXEEXT) repr_uint32$(EXEEXT) repr_uint64$(EXEEXT) \
 	repr_uint8$(EXEEXT)
-am__EXEEXT_51 = slim_get$(EXEEXT) slim_nframes$(EXEEXT)
-am__EXEEXT_52 = spf$(EXEEXT) spf_divide$(EXEEXT) spf_lincom$(EXEEXT) \
-	spf_multiply$(EXEEXT) spf_polynom$(EXEEXT) spf_recip$(EXEEXT) \
-	spf_recurse$(EXEEXT)
-am__EXEEXT_53 = svlist$(EXEEXT) svlist_invalid$(EXEEXT) \
-	svlist_meta$(EXEEXT) svlist_meta_invalid$(EXEEXT)
-am__EXEEXT_54 = trunc$(EXEEXT) trunc_rdonly$(EXEEXT) \
-	trunc_rofs$(EXEEXT)
-am__EXEEXT_55 = unclude$(EXEEXT) unclude_del$(EXEEXT) \
+am__EXEEXT_47 = seek64$(EXEEXT) seek_cur$(EXEEXT) seek_end$(EXEEXT) \
+	seek_foffs$(EXEEXT) seek_neg$(EXEEXT) seek_set$(EXEEXT)
+am__EXEEXT_48 = sie_get_big$(EXEEXT) sie_get_little$(EXEEXT) \
+	sie_move_from$(EXEEXT) sie_move_to$(EXEEXT) \
+	sie_nframes_big$(EXEEXT) sie_nframes_little$(EXEEXT) \
+	sie_put_big$(EXEEXT) sie_put_little$(EXEEXT)
+am__EXEEXT_49 = slim_get$(EXEEXT) slim_nframes$(EXEEXT)
+am__EXEEXT_50 = spf$(EXEEXT) spf_alias$(EXEEXT) \
+	spf_alias_missing$(EXEEXT) spf_alias_meta$(EXEEXT) \
+	spf_divide$(EXEEXT) spf_lincom$(EXEEXT) spf_multiply$(EXEEXT) \
+	spf_polynom$(EXEEXT) spf_recip$(EXEEXT) spf_recurse$(EXEEXT)
+am__EXEEXT_51 = svlist$(EXEEXT) svlist_hidden$(EXEEXT) \
+	svlist_invalid$(EXEEXT) svlist_meta$(EXEEXT) \
+	svlist_meta_hidden$(EXEEXT) svlist_meta_invalid$(EXEEXT)
+am__EXEEXT_52 = table$(EXEEXT) table_code$(EXEEXT) table_type$(EXEEXT)
+am__EXEEXT_53 = tell$(EXEEXT) tell64$(EXEEXT) tell_multidiv$(EXEEXT)
+am__EXEEXT_54 = tok_arg$(EXEEXT) tok_escape$(EXEEXT) \
+	tok_quote$(EXEEXT)
+am__EXEEXT_55 = trunc$(EXEEXT) trunc_dir$(EXEEXT) \
+	trunc_rdonly$(EXEEXT) trunc_rofs$(EXEEXT) \
+	trunc_truncsub$(EXEEXT)
+am__EXEEXT_56 = unclude$(EXEEXT) unclude_del$(EXEEXT) \
 	unclude_move$(EXEEXT)
-am__EXEEXT_56 = version_0$(EXEEXT) version_0_write$(EXEEXT) \
+am__EXEEXT_57 = version_0$(EXEEXT) version_0_write$(EXEEXT) \
 	version_1$(EXEEXT) version_1_write$(EXEEXT) version_2$(EXEEXT) \
 	version_2_write$(EXEEXT) version_3$(EXEEXT) \
 	version_3_write$(EXEEXT) version_4$(EXEEXT) \
@@ -441,32 +558,57 @@ am__EXEEXT_56 = version_0$(EXEEXT) version_0_write$(EXEEXT) \
 	version_6_write$(EXEEXT) version_7$(EXEEXT) \
 	version_7_strict$(EXEEXT) version_7_write$(EXEEXT) \
 	version_8$(EXEEXT) version_8_strict$(EXEEXT) \
-	version_8_write$(EXEEXT)
-am__EXEEXT_57 = vlist$(EXEEXT) vlist_invalid$(EXEEXT) \
-	vlist_meta$(EXEEXT) vlist_meta_invalid$(EXEEXT)
-am__EXEEXT_58 = xz_get$(EXEEXT) xz_nframes$(EXEEXT)
-am__EXEEXT_59 = $(am__EXEEXT_1) $(am__EXEEXT_2) $(am__EXEEXT_3) \
+	version_8_write$(EXEEXT) version_9$(EXEEXT) \
+	version_9_strict$(EXEEXT) version_9_write$(EXEEXT)
+am__EXEEXT_58 = vlist$(EXEEXT) vlist_alias$(EXEEXT) \
+	vlist_hidden$(EXEEXT) vlist_invalid$(EXEEXT) \
+	vlist_meta$(EXEEXT) vlist_meta_hidden$(EXEEXT) \
+	vlist_meta_invalid$(EXEEXT)
+am__EXEEXT_59 = xz_get$(EXEEXT) xz_nframes$(EXEEXT)
+am__EXEEXT_60 = zzip_data$(EXEEXT) zzip_get$(EXEEXT) \
+	zzip_get_get$(EXEEXT) zzip_nframes$(EXEEXT)
+am__EXEEXT_61 = zzslim_get$(EXEEXT) zzslim_nframes$(EXEEXT)
+am__EXEEXT_62 = $(am__EXEEXT_1) $(am__EXEEXT_2) $(am__EXEEXT_3) \
 	$(am__EXEEXT_4) $(am__EXEEXT_5) $(am__EXEEXT_6) \
 	$(am__EXEEXT_7) $(am__EXEEXT_8) $(am__EXEEXT_9) \
 	$(am__EXEEXT_10) $(am__EXEEXT_11) $(am__EXEEXT_12) \
 	$(am__EXEEXT_13) $(am__EXEEXT_14) $(am__EXEEXT_15) \
 	$(am__EXEEXT_16) $(am__EXEEXT_17) $(am__EXEEXT_18) \
 	$(am__EXEEXT_19) $(am__EXEEXT_20) $(am__EXEEXT_21) \
-	$(am__EXEEXT_24) $(am__EXEEXT_25) $(am__EXEEXT_26) \
-	$(am__EXEEXT_27) $(am__EXEEXT_28) $(am__EXEEXT_29) \
-	$(am__EXEEXT_30) $(am__EXEEXT_31) $(am__EXEEXT_32) \
-	$(am__EXEEXT_33) $(am__EXEEXT_34) $(am__EXEEXT_35) \
-	$(am__EXEEXT_36) $(am__EXEEXT_39) $(am__EXEEXT_40) \
-	$(am__EXEEXT_41) $(am__EXEEXT_42) $(am__EXEEXT_43) \
-	$(am__EXEEXT_44) $(am__EXEEXT_45) $(am__EXEEXT_48) \
+	$(am__EXEEXT_22) $(am__EXEEXT_23) $(am__EXEEXT_24) \
+	$(am__EXEEXT_25) $(am__EXEEXT_26) $(am__EXEEXT_27) \
+	$(am__EXEEXT_28) $(am__EXEEXT_29) $(am__EXEEXT_30) \
+	$(am__EXEEXT_31) $(am__EXEEXT_32) $(am__EXEEXT_33) \
+	$(am__EXEEXT_34) $(am__EXEEXT_35) $(am__EXEEXT_36) \
+	$(am__EXEEXT_37) $(am__EXEEXT_38) $(am__EXEEXT_39) \
+	$(am__EXEEXT_40) $(am__EXEEXT_41) $(am__EXEEXT_42) \
+	$(am__EXEEXT_43) $(am__EXEEXT_44) $(am__EXEEXT_45) \
+	$(am__EXEEXT_46) $(am__EXEEXT_47) $(am__EXEEXT_48) \
 	$(am__EXEEXT_49) $(am__EXEEXT_50) $(am__EXEEXT_51) \
 	$(am__EXEEXT_52) $(am__EXEEXT_53) $(am__EXEEXT_54) \
 	$(am__EXEEXT_55) $(am__EXEEXT_56) $(am__EXEEXT_57) \
-	$(am__EXEEXT_58)
+	$(am__EXEEXT_58) $(am__EXEEXT_59) $(am__EXEEXT_60) \
+	$(am__EXEEXT_61)
 add_SOURCES = add.c
 add_OBJECTS = add.$(OBJEXT)
 add_LDADD = $(LDADD)
 add_DEPENDENCIES = ../src/libgetdata.la
+add_affix_SOURCES = add_affix.c
+add_affix_OBJECTS = add_affix.$(OBJEXT)
+add_affix_LDADD = $(LDADD)
+add_affix_DEPENDENCIES = ../src/libgetdata.la
+add_alias_SOURCES = add_alias.c
+add_alias_OBJECTS = add_alias.$(OBJEXT)
+add_alias_LDADD = $(LDADD)
+add_alias_DEPENDENCIES = ../src/libgetdata.la
+add_alias_affix_SOURCES = add_alias_affix.c
+add_alias_affix_OBJECTS = add_alias_affix.$(OBJEXT)
+add_alias_affix_LDADD = $(LDADD)
+add_alias_affix_DEPENDENCIES = ../src/libgetdata.la
+add_alias_meta_SOURCES = add_alias_meta.c
+add_alias_meta_OBJECTS = add_alias_meta.$(OBJEXT)
+add_alias_meta_LDADD = $(LDADD)
+add_alias_meta_DEPENDENCIES = ../src/libgetdata.la
 add_bit_SOURCES = add_bit.c
 add_bit_OBJECTS = add_bit.$(OBJEXT)
 add_bit_LDADD = $(LDADD)
@@ -539,6 +681,10 @@ add_lincom_SOURCES = add_lincom.c
 add_lincom_OBJECTS = add_lincom.$(OBJEXT)
 add_lincom_LDADD = $(LDADD)
 add_lincom_DEPENDENCIES = ../src/libgetdata.la
+add_lincom_affix_SOURCES = add_lincom_affix.c
+add_lincom_affix_OBJECTS = add_lincom_affix.$(OBJEXT)
+add_lincom_affix_LDADD = $(LDADD)
+add_lincom_affix_DEPENDENCIES = ../src/libgetdata.la
 add_lincom_invalid_SOURCES = add_lincom_invalid.c
 add_lincom_invalid_OBJECTS = add_lincom_invalid.$(OBJEXT)
 add_lincom_invalid_LDADD = $(LDADD)
@@ -555,6 +701,22 @@ add_linterp_invalid_SOURCES = add_linterp_invalid.c
 add_linterp_invalid_OBJECTS = add_linterp_invalid.$(OBJEXT)
 add_linterp_invalid_LDADD = $(LDADD)
 add_linterp_invalid_DEPENDENCIES = ../src/libgetdata.la
+add_meta_SOURCES = add_meta.c
+add_meta_OBJECTS = add_meta.$(OBJEXT)
+add_meta_LDADD = $(LDADD)
+add_meta_DEPENDENCIES = ../src/libgetdata.la
+add_meta_alias_SOURCES = add_meta_alias.c
+add_meta_alias_OBJECTS = add_meta_alias.$(OBJEXT)
+add_meta_alias_LDADD = $(LDADD)
+add_meta_alias_DEPENDENCIES = ../src/libgetdata.la
+add_mplex_SOURCES = add_mplex.c
+add_mplex_OBJECTS = add_mplex.$(OBJEXT)
+add_mplex_LDADD = $(LDADD)
+add_mplex_DEPENDENCIES = ../src/libgetdata.la
+add_mplex_val_SOURCES = add_mplex_val.c
+add_mplex_val_OBJECTS = add_mplex_val.$(OBJEXT)
+add_mplex_val_LDADD = $(LDADD)
+add_mplex_val_DEPENDENCIES = ../src/libgetdata.la
 add_multiply_SOURCES = add_multiply.c
 add_multiply_OBJECTS = add_multiply.$(OBJEXT)
 add_multiply_LDADD = $(LDADD)
@@ -607,6 +769,10 @@ add_recip_SOURCES = add_recip.c
 add_recip_OBJECTS = add_recip.$(OBJEXT)
 add_recip_LDADD = $(LDADD)
 add_recip_DEPENDENCIES = ../src/libgetdata.la
+add_resolv_SOURCES = add_resolv.c
+add_resolv_OBJECTS = add_resolv.$(OBJEXT)
+add_resolv_LDADD = $(LDADD)
+add_resolv_DEPENDENCIES = ../src/libgetdata.la
 add_sbit_SOURCES = add_sbit.c
 add_sbit_OBJECTS = add_sbit.$(OBJEXT)
 add_sbit_LDADD = $(LDADD)
@@ -615,6 +781,14 @@ add_scalar_SOURCES = add_scalar.c
 add_scalar_OBJECTS = add_scalar.$(OBJEXT)
 add_scalar_LDADD = $(LDADD)
 add_scalar_DEPENDENCIES = ../src/libgetdata.la
+add_scalar_carray_SOURCES = add_scalar_carray.c
+add_scalar_carray_OBJECTS = add_scalar_carray.$(OBJEXT)
+add_scalar_carray_LDADD = $(LDADD)
+add_scalar_carray_DEPENDENCIES = ../src/libgetdata.la
+add_scalar_carray_bad_SOURCES = add_scalar_carray_bad.c
+add_scalar_carray_bad_OBJECTS = add_scalar_carray_bad.$(OBJEXT)
+add_scalar_carray_bad_LDADD = $(LDADD)
+add_scalar_carray_bad_DEPENDENCIES = ../src/libgetdata.la
 add_sort_SOURCES = add_sort.c
 add_sort_OBJECTS = add_sort.$(OBJEXT)
 add_sort_LDADD = $(LDADD)
@@ -635,14 +809,66 @@ add_spec_meta_SOURCES = add_spec_meta.c
 add_spec_meta_OBJECTS = add_spec_meta.$(OBJEXT)
 add_spec_meta_LDADD = $(LDADD)
 add_spec_meta_DEPENDENCIES = ../src/libgetdata.la
+add_spec_resolv_SOURCES = add_spec_resolv.c
+add_spec_resolv_OBJECTS = add_spec_resolv.$(OBJEXT)
+add_spec_resolv_LDADD = $(LDADD)
+add_spec_resolv_DEPENDENCIES = ../src/libgetdata.la
 add_string_SOURCES = add_string.c
 add_string_OBJECTS = add_string.$(OBJEXT)
 add_string_LDADD = $(LDADD)
 add_string_DEPENDENCIES = ../src/libgetdata.la
+add_string_affix_SOURCES = add_string_affix.c
+add_string_affix_OBJECTS = add_string_affix.$(OBJEXT)
+add_string_affix_LDADD = $(LDADD)
+add_string_affix_DEPENDENCIES = ../src/libgetdata.la
 add_type_SOURCES = add_type.c
 add_type_OBJECTS = add_type.$(OBJEXT)
 add_type_LDADD = $(LDADD)
 add_type_DEPENDENCIES = ../src/libgetdata.la
+add_window_SOURCES = add_window.c
+add_window_OBJECTS = add_window.$(OBJEXT)
+add_window_LDADD = $(LDADD)
+add_window_DEPENDENCIES = ../src/libgetdata.la
+add_window_op_SOURCES = add_window_op.c
+add_window_op_OBJECTS = add_window_op.$(OBJEXT)
+add_window_op_LDADD = $(LDADD)
+add_window_op_DEPENDENCIES = ../src/libgetdata.la
+alias_list_SOURCES = alias_list.c
+alias_list_OBJECTS = alias_list.$(OBJEXT)
+alias_list_LDADD = $(LDADD)
+alias_list_DEPENDENCIES = ../src/libgetdata.la
+alias_list_alias_SOURCES = alias_list_alias.c
+alias_list_alias_OBJECTS = alias_list_alias.$(OBJEXT)
+alias_list_alias_LDADD = $(LDADD)
+alias_list_alias_DEPENDENCIES = ../src/libgetdata.la
+alias_list_missing_SOURCES = alias_list_missing.c
+alias_list_missing_OBJECTS = alias_list_missing.$(OBJEXT)
+alias_list_missing_LDADD = $(LDADD)
+alias_list_missing_DEPENDENCIES = ../src/libgetdata.la
+alias_num_SOURCES = alias_num.c
+alias_num_OBJECTS = alias_num.$(OBJEXT)
+alias_num_LDADD = $(LDADD)
+alias_num_DEPENDENCIES = ../src/libgetdata.la
+alias_num_alias_SOURCES = alias_num_alias.c
+alias_num_alias_OBJECTS = alias_num_alias.$(OBJEXT)
+alias_num_alias_LDADD = $(LDADD)
+alias_num_alias_DEPENDENCIES = ../src/libgetdata.la
+alias_num_missing_SOURCES = alias_num_missing.c
+alias_num_missing_OBJECTS = alias_num_missing.$(OBJEXT)
+alias_num_missing_LDADD = $(LDADD)
+alias_num_missing_DEPENDENCIES = ../src/libgetdata.la
+alias_target_SOURCES = alias_target.c
+alias_target_OBJECTS = alias_target.$(OBJEXT)
+alias_target_LDADD = $(LDADD)
+alias_target_DEPENDENCIES = ../src/libgetdata.la
+alias_target_alias_SOURCES = alias_target_alias.c
+alias_target_alias_OBJECTS = alias_target_alias.$(OBJEXT)
+alias_target_alias_LDADD = $(LDADD)
+alias_target_alias_DEPENDENCIES = ../src/libgetdata.la
+alias_target_missing_SOURCES = alias_target_missing.c
+alias_target_missing_OBJECTS = alias_target_missing.$(OBJEXT)
+alias_target_missing_LDADD = $(LDADD)
+alias_target_missing_DEPENDENCIES = ../src/libgetdata.la
 alter_bit_bitnum_SOURCES = alter_bit_bitnum.c
 alter_bit_bitnum_OBJECTS = alter_bit_bitnum.$(OBJEXT)
 alter_bit_bitnum_LDADD = $(LDADD)
@@ -663,6 +889,10 @@ alter_const_SOURCES = alter_const.c
 alter_const_OBJECTS = alter_const.$(OBJEXT)
 alter_const_LDADD = $(LDADD)
 alter_const_DEPENDENCIES = ../src/libgetdata.la
+alter_const_c2r_SOURCES = alter_const_c2r.c
+alter_const_c2r_OBJECTS = alter_const_c2r.$(OBJEXT)
+alter_const_c2r_LDADD = $(LDADD)
+alter_const_c2r_DEPENDENCIES = ../src/libgetdata.la
 alter_cpolynom_SOURCES = alter_cpolynom.c
 alter_cpolynom_OBJECTS = alter_cpolynom.$(OBJEXT)
 alter_cpolynom_LDADD = $(LDADD)
@@ -687,6 +917,14 @@ alter_entry_SOURCES = alter_entry.c
 alter_entry_OBJECTS = alter_entry.$(OBJEXT)
 alter_entry_LDADD = $(LDADD)
 alter_entry_DEPENDENCIES = ../src/libgetdata.la
+alter_entry_affix_SOURCES = alter_entry_affix.c
+alter_entry_affix_OBJECTS = alter_entry_affix.$(OBJEXT)
+alter_entry_affix_LDADD = $(LDADD)
+alter_entry_affix_DEPENDENCIES = ../src/libgetdata.la
+alter_entry_hidden_SOURCES = alter_entry_hidden.c
+alter_entry_hidden_OBJECTS = alter_entry_hidden.$(OBJEXT)
+alter_entry_hidden_LDADD = $(LDADD)
+alter_entry_hidden_DEPENDENCIES = ../src/libgetdata.la
 alter_entry_recode_SOURCES = alter_entry_recode.c
 alter_entry_recode_OBJECTS = alter_entry_recode.$(OBJEXT)
 alter_entry_recode_LDADD = $(LDADD)
@@ -715,6 +953,10 @@ alter_lincom_32_SOURCES = alter_lincom_32.c
 alter_lincom_32_OBJECTS = alter_lincom_32.$(OBJEXT)
 alter_lincom_32_LDADD = $(LDADD)
 alter_lincom_32_DEPENDENCIES = ../src/libgetdata.la
+alter_lincom_affix_SOURCES = alter_lincom_affix.c
+alter_lincom_affix_OBJECTS = alter_lincom_affix.$(OBJEXT)
+alter_lincom_affix_LDADD = $(LDADD)
+alter_lincom_affix_DEPENDENCIES = ../src/libgetdata.la
 alter_lincom_input_SOURCES = alter_lincom_input.c
 alter_lincom_input_OBJECTS = alter_lincom_input.$(OBJEXT)
 alter_lincom_input_LDADD = $(LDADD)
@@ -735,10 +977,18 @@ alter_linterp_move_SOURCES = alter_linterp_move.c
 alter_linterp_move_OBJECTS = alter_linterp_move.$(OBJEXT)
 alter_linterp_move_LDADD = $(LDADD)
 alter_linterp_move_DEPENDENCIES = ../src/libgetdata.la
+alter_mplex_SOURCES = alter_mplex.c
+alter_mplex_OBJECTS = alter_mplex.$(OBJEXT)
+alter_mplex_LDADD = $(LDADD)
+alter_mplex_DEPENDENCIES = ../src/libgetdata.la
 alter_mspec_SOURCES = alter_mspec.c
 alter_mspec_OBJECTS = alter_mspec.$(OBJEXT)
 alter_mspec_LDADD = $(LDADD)
 alter_mspec_DEPENDENCIES = ../src/libgetdata.la
+alter_mspec_affix_SOURCES = alter_mspec_affix.c
+alter_mspec_affix_OBJECTS = alter_mspec_affix.$(OBJEXT)
+alter_mspec_affix_LDADD = $(LDADD)
+alter_mspec_affix_DEPENDENCIES = ../src/libgetdata.la
 alter_multiply_SOURCES = alter_multiply.c
 alter_multiply_OBJECTS = alter_multiply.$(OBJEXT)
 alter_multiply_LDADD = $(LDADD)
@@ -775,14 +1025,30 @@ alter_recip_zero_SOURCES = alter_recip_zero.c
 alter_recip_zero_OBJECTS = alter_recip_zero.$(OBJEXT)
 alter_recip_zero_LDADD = $(LDADD)
 alter_recip_zero_DEPENDENCIES = ../src/libgetdata.la
+alter_scalar_affix_SOURCES = alter_scalar_affix.c
+alter_scalar_affix_OBJECTS = alter_scalar_affix.$(OBJEXT)
+alter_scalar_affix_LDADD = $(LDADD)
+alter_scalar_affix_DEPENDENCIES = ../src/libgetdata.la
 alter_spec_SOURCES = alter_spec.c
 alter_spec_OBJECTS = alter_spec.$(OBJEXT)
 alter_spec_LDADD = $(LDADD)
 alter_spec_DEPENDENCIES = ../src/libgetdata.la
+alter_spec_affix_SOURCES = alter_spec_affix.c
+alter_spec_affix_OBJECTS = alter_spec_affix.$(OBJEXT)
+alter_spec_affix_LDADD = $(LDADD)
+alter_spec_affix_DEPENDENCIES = ../src/libgetdata.la
 alter_spec_meta_SOURCES = alter_spec_meta.c
 alter_spec_meta_OBJECTS = alter_spec_meta.$(OBJEXT)
 alter_spec_meta_LDADD = $(LDADD)
 alter_spec_meta_DEPENDENCIES = ../src/libgetdata.la
+alter_window_SOURCES = alter_window.c
+alter_window_OBJECTS = alter_window.$(OBJEXT)
+alter_window_LDADD = $(LDADD)
+alter_window_DEPENDENCIES = ../src/libgetdata.la
+ascii_add_SOURCES = ascii_add.c
+ascii_add_OBJECTS = ascii_add.$(OBJEXT)
+ascii_add_LDADD = $(LDADD)
+ascii_add_DEPENDENCIES = ../src/libgetdata.la
 ascii_get_SOURCES = ascii_get.c
 ascii_get_OBJECTS = ascii_get.$(OBJEXT)
 ascii_get_LDADD = $(LDADD)
@@ -1347,10 +1613,22 @@ cvlist_array_SOURCES = cvlist_array.c
 cvlist_array_OBJECTS = cvlist_array.$(OBJEXT)
 cvlist_array_LDADD = $(LDADD)
 cvlist_array_DEPENDENCIES = ../src/libgetdata.la
+cvlist_array_hidden_SOURCES = cvlist_array_hidden.c
+cvlist_array_hidden_OBJECTS = cvlist_array_hidden.$(OBJEXT)
+cvlist_array_hidden_LDADD = $(LDADD)
+cvlist_array_hidden_DEPENDENCIES = ../src/libgetdata.la
 cvlist_array_meta_SOURCES = cvlist_array_meta.c
 cvlist_array_meta_OBJECTS = cvlist_array_meta.$(OBJEXT)
 cvlist_array_meta_LDADD = $(LDADD)
 cvlist_array_meta_DEPENDENCIES = ../src/libgetdata.la
+cvlist_array_meta_hidden_SOURCES = cvlist_array_meta_hidden.c
+cvlist_array_meta_hidden_OBJECTS = cvlist_array_meta_hidden.$(OBJEXT)
+cvlist_array_meta_hidden_LDADD = $(LDADD)
+cvlist_array_meta_hidden_DEPENDENCIES = ../src/libgetdata.la
+cvlist_hidden_SOURCES = cvlist_hidden.c
+cvlist_hidden_OBJECTS = cvlist_hidden.$(OBJEXT)
+cvlist_hidden_LDADD = $(LDADD)
+cvlist_hidden_DEPENDENCIES = ../src/libgetdata.la
 cvlist_invalid_SOURCES = cvlist_invalid.c
 cvlist_invalid_OBJECTS = cvlist_invalid.$(OBJEXT)
 cvlist_invalid_LDADD = $(LDADD)
@@ -1359,6 +1637,10 @@ cvlist_meta_SOURCES = cvlist_meta.c
 cvlist_meta_OBJECTS = cvlist_meta.$(OBJEXT)
 cvlist_meta_LDADD = $(LDADD)
 cvlist_meta_DEPENDENCIES = ../src/libgetdata.la
+cvlist_meta_hidden_SOURCES = cvlist_meta_hidden.c
+cvlist_meta_hidden_OBJECTS = cvlist_meta_hidden.$(OBJEXT)
+cvlist_meta_hidden_LDADD = $(LDADD)
+cvlist_meta_hidden_DEPENDENCIES = ../src/libgetdata.la
 cvlist_meta_invalid_SOURCES = cvlist_meta_invalid.c
 cvlist_meta_invalid_OBJECTS = cvlist_meta_invalid.$(OBJEXT)
 cvlist_meta_invalid_LDADD = $(LDADD)
@@ -1395,6 +1677,10 @@ del_derived_SOURCES = del_derived.c
 del_derived_OBJECTS = del_derived.$(OBJEXT)
 del_derived_LDADD = $(LDADD)
 del_derived_DEPENDENCIES = ../src/libgetdata.la
+del_derived_after_SOURCES = del_derived_after.c
+del_derived_after_OBJECTS = del_derived_after.$(OBJEXT)
+del_derived_after_LDADD = $(LDADD)
+del_derived_after_DEPENDENCIES = ../src/libgetdata.la
 del_derived_force_SOURCES = del_derived_force.c
 del_derived_force_OBJECTS = del_derived_force.$(OBJEXT)
 del_derived_force_LDADD = $(LDADD)
@@ -1407,6 +1693,22 @@ del_meta_force_SOURCES = del_meta_force.c
 del_meta_force_OBJECTS = del_meta_force.$(OBJEXT)
 del_meta_force_LDADD = $(LDADD)
 del_meta_force_DEPENDENCIES = ../src/libgetdata.la
+desync_SOURCES = desync.c
+desync_OBJECTS = desync.$(OBJEXT)
+desync_LDADD = $(LDADD)
+desync_DEPENDENCIES = ../src/libgetdata.la
+desync_flush_SOURCES = desync_flush.c
+desync_flush_OBJECTS = desync_flush.$(OBJEXT)
+desync_flush_LDADD = $(LDADD)
+desync_flush_DEPENDENCIES = ../src/libgetdata.la
+desync_reopen_SOURCES = desync_reopen.c
+desync_reopen_OBJECTS = desync_reopen.$(OBJEXT)
+desync_reopen_LDADD = $(LDADD)
+desync_reopen_DEPENDENCIES = ../src/libgetdata.la
+desync_reopen_inv_SOURCES = desync_reopen_inv.c
+desync_reopen_inv_OBJECTS = desync_reopen_inv.$(OBJEXT)
+desync_reopen_inv_LDADD = $(LDADD)
+desync_reopen_inv_DEPENDENCIES = ../src/libgetdata.la
 dfes_bit_SOURCES = dfes_bit.c
 dfes_bit_OBJECTS = dfes_bit.$(OBJEXT)
 dfes_bit_LDADD = $(LDADD)
@@ -1447,6 +1749,22 @@ dfes_zero_SOURCES = dfes_zero.c
 dfes_zero_OBJECTS = dfes_zero.$(OBJEXT)
 dfes_zero_LDADD = $(LDADD)
 dfes_zero_DEPENDENCIES = ../src/libgetdata.la
+elist_alias_SOURCES = elist_alias.c
+elist_alias_OBJECTS = elist_alias.$(OBJEXT)
+elist_alias_LDADD = $(LDADD)
+elist_alias_DEPENDENCIES = ../src/libgetdata.la
+elist_hidden_SOURCES = elist_hidden.c
+elist_hidden_OBJECTS = elist_hidden.$(OBJEXT)
+elist_hidden_LDADD = $(LDADD)
+elist_hidden_DEPENDENCIES = ../src/libgetdata.la
+elist_noalias_SOURCES = elist_noalias.c
+elist_noalias_OBJECTS = elist_noalias.$(OBJEXT)
+elist_noalias_LDADD = $(LDADD)
+elist_noalias_DEPENDENCIES = ../src/libgetdata.la
+elist_scalar_SOURCES = elist_scalar.c
+elist_scalar_OBJECTS = elist_scalar.$(OBJEXT)
+elist_scalar_LDADD = $(LDADD)
+elist_scalar_DEPENDENCIES = ../src/libgetdata.la
 encode_alter_SOURCES = encode_alter.c
 encode_alter_OBJECTS = encode_alter.$(OBJEXT)
 encode_alter_LDADD = $(LDADD)
@@ -1463,6 +1781,10 @@ endian_alter_SOURCES = endian_alter.c
 endian_alter_OBJECTS = endian_alter.$(OBJEXT)
 endian_alter_LDADD = $(LDADD)
 endian_alter_DEPENDENCIES = ../src/libgetdata.la
+endian_alter_sie_SOURCES = endian_alter_sie.c
+endian_alter_sie_OBJECTS = endian_alter_sie.$(OBJEXT)
+endian_alter_sie_LDADD = $(LDADD)
+endian_alter_sie_DEPENDENCIES = ../src/libgetdata.la
 endian_get_SOURCES = endian_get.c
 endian_get_OBJECTS = endian_get.$(OBJEXT)
 endian_get_LDADD = $(LDADD)
@@ -1483,6 +1805,10 @@ entry_bit_scalar_SOURCES = entry_bit_scalar.c
 entry_bit_scalar_OBJECTS = entry_bit_scalar.$(OBJEXT)
 entry_bit_scalar_LDADD = $(LDADD)
 entry_bit_scalar_DEPENDENCIES = ../src/libgetdata.la
+entry_divide_SOURCES = entry_divide.c
+entry_divide_OBJECTS = entry_divide.$(OBJEXT)
+entry_divide_LDADD = $(LDADD)
+entry_divide_DEPENDENCIES = ../src/libgetdata.la
 entry_invalid_SOURCES = entry_invalid.c
 entry_invalid_OBJECTS = entry_invalid.$(OBJEXT)
 entry_invalid_LDADD = $(LDADD)
@@ -1499,6 +1825,14 @@ entry_linterp_SOURCES = entry_linterp.c
 entry_linterp_OBJECTS = entry_linterp.$(OBJEXT)
 entry_linterp_LDADD = $(LDADD)
 entry_linterp_DEPENDENCIES = ../src/libgetdata.la
+entry_mplex_SOURCES = entry_mplex.c
+entry_mplex_OBJECTS = entry_mplex.$(OBJEXT)
+entry_mplex_LDADD = $(LDADD)
+entry_mplex_DEPENDENCIES = ../src/libgetdata.la
+entry_mplex_scalar_SOURCES = entry_mplex_scalar.c
+entry_mplex_scalar_OBJECTS = entry_mplex_scalar.$(OBJEXT)
+entry_mplex_scalar_LDADD = $(LDADD)
+entry_mplex_scalar_DEPENDENCIES = ../src/libgetdata.la
 entry_multiply_SOURCES = entry_multiply.c
 entry_multiply_OBJECTS = entry_multiply.$(OBJEXT)
 entry_multiply_LDADD = $(LDADD)
@@ -1535,6 +1869,10 @@ entry_raw_scalar_type_SOURCES = entry_raw_scalar_type.c
 entry_raw_scalar_type_OBJECTS = entry_raw_scalar_type.$(OBJEXT)
 entry_raw_scalar_type_LDADD = $(LDADD)
 entry_raw_scalar_type_DEPENDENCIES = ../src/libgetdata.la
+entry_recip_SOURCES = entry_recip.c
+entry_recip_OBJECTS = entry_recip.$(OBJEXT)
+entry_recip_LDADD = $(LDADD)
+entry_recip_DEPENDENCIES = ../src/libgetdata.la
 entry_scalar_repr_SOURCES = entry_scalar_repr.c
 entry_scalar_repr_OBJECTS = entry_scalar_repr.$(OBJEXT)
 entry_scalar_repr_LDADD = $(LDADD)
@@ -1543,6 +1881,18 @@ entry_type_SOURCES = entry_type.c
 entry_type_OBJECTS = entry_type.$(OBJEXT)
 entry_type_LDADD = $(LDADD)
 entry_type_DEPENDENCIES = ../src/libgetdata.la
+entry_type_alias_SOURCES = entry_type_alias.c
+entry_type_alias_OBJECTS = entry_type_alias.$(OBJEXT)
+entry_type_alias_LDADD = $(LDADD)
+entry_type_alias_DEPENDENCIES = ../src/libgetdata.la
+entry_window_SOURCES = entry_window.c
+entry_window_OBJECTS = entry_window.$(OBJEXT)
+entry_window_LDADD = $(LDADD)
+entry_window_DEPENDENCIES = ../src/libgetdata.la
+entry_window_scalar_SOURCES = entry_window_scalar.c
+entry_window_scalar_OBJECTS = entry_window_scalar.$(OBJEXT)
+entry_window_scalar_LDADD = $(LDADD)
+entry_window_scalar_DEPENDENCIES = ../src/libgetdata.la
 eof_SOURCES = eof.c
 eof_OBJECTS = eof.$(OBJEXT)
 eof_LDADD = $(LDADD)
@@ -1567,10 +1917,22 @@ error_error_SOURCES = error_error.c
 error_error_OBJECTS = error_error.$(OBJEXT)
 error_error_LDADD = $(LDADD)
 error_error_DEPENDENCIES = ../src/libgetdata.la
+error_num_SOURCES = error_num.c
+error_num_OBJECTS = error_num.$(OBJEXT)
+error_num_LDADD = $(LDADD)
+error_num_DEPENDENCIES = ../src/libgetdata.la
 error_short_SOURCES = error_short.c
 error_short_OBJECTS = error_short.$(OBJEXT)
 error_short_LDADD = $(LDADD)
 error_short_DEPENDENCIES = ../src/libgetdata.la
+error_verbose_SOURCES = error_verbose.c
+error_verbose_OBJECTS = error_verbose.$(OBJEXT)
+error_verbose_LDADD = $(LDADD)
+error_verbose_DEPENDENCIES = ../src/libgetdata.la
+error_verbose_prefix_SOURCES = error_verbose_prefix.c
+error_verbose_prefix_OBJECTS = error_verbose_prefix.$(OBJEXT)
+error_verbose_prefix_LDADD = $(LDADD)
+error_verbose_prefix_DEPENDENCIES = ../src/libgetdata.la
 file_SOURCES = file.c
 file_OBJECTS = file.$(OBJEXT)
 file_LDADD = $(LDADD)
@@ -1587,6 +1949,10 @@ flist_SOURCES = flist.c
 flist_OBJECTS = flist.$(OBJEXT)
 flist_LDADD = $(LDADD)
 flist_DEPENDENCIES = ../src/libgetdata.la
+flist_hidden_SOURCES = flist_hidden.c
+flist_hidden_OBJECTS = flist_hidden.$(OBJEXT)
+flist_hidden_LDADD = $(LDADD)
+flist_hidden_DEPENDENCIES = ../src/libgetdata.la
 flist_invalid_SOURCES = flist_invalid.c
 flist_invalid_OBJECTS = flist_invalid.$(OBJEXT)
 flist_invalid_LDADD = $(LDADD)
@@ -1595,6 +1961,10 @@ flist_meta_SOURCES = flist_meta.c
 flist_meta_OBJECTS = flist_meta.$(OBJEXT)
 flist_meta_LDADD = $(LDADD)
 flist_meta_DEPENDENCIES = ../src/libgetdata.la
+flist_meta_hidden_SOURCES = flist_meta_hidden.c
+flist_meta_hidden_OBJECTS = flist_meta_hidden.$(OBJEXT)
+flist_meta_hidden_LDADD = $(LDADD)
+flist_meta_hidden_DEPENDENCIES = ../src/libgetdata.la
 flist_meta_invalid_SOURCES = flist_meta_invalid.c
 flist_meta_invalid_OBJECTS = flist_meta_invalid.$(OBJEXT)
 flist_meta_invalid_LDADD = $(LDADD)
@@ -1603,6 +1973,10 @@ flist_type_SOURCES = flist_type.c
 flist_type_OBJECTS = flist_type.$(OBJEXT)
 flist_type_LDADD = $(LDADD)
 flist_type_DEPENDENCIES = ../src/libgetdata.la
+flist_type_hidden_SOURCES = flist_type_hidden.c
+flist_type_hidden_OBJECTS = flist_type_hidden.$(OBJEXT)
+flist_type_hidden_LDADD = $(LDADD)
+flist_type_hidden_DEPENDENCIES = ../src/libgetdata.la
 flist_type_invalid_SOURCES = flist_type_invalid.c
 flist_type_invalid_OBJECTS = flist_type_invalid.$(OBJEXT)
 flist_type_invalid_LDADD = $(LDADD)
@@ -1611,6 +1985,10 @@ flist_type_meta_SOURCES = flist_type_meta.c
 flist_type_meta_OBJECTS = flist_type_meta.$(OBJEXT)
 flist_type_meta_LDADD = $(LDADD)
 flist_type_meta_DEPENDENCIES = ../src/libgetdata.la
+flist_type_meta_hidden_SOURCES = flist_type_meta_hidden.c
+flist_type_meta_hidden_OBJECTS = flist_type_meta_hidden.$(OBJEXT)
+flist_type_meta_hidden_LDADD = $(LDADD)
+flist_type_meta_hidden_DEPENDENCIES = ../src/libgetdata.la
 flist_type_meta_invalid_SOURCES = flist_type_meta_invalid.c
 flist_type_meta_invalid_OBJECTS = flist_type_meta_invalid.$(OBJEXT)
 flist_type_meta_invalid_LDADD = $(LDADD)
@@ -1635,6 +2013,10 @@ flush_meta_SOURCES = flush_meta.c
 flush_meta_OBJECTS = flush_meta.$(OBJEXT)
 flush_meta_LDADD = $(LDADD)
 flush_meta_DEPENDENCIES = ../src/libgetdata.la
+flush_ref_SOURCES = flush_ref.c
+flush_ref_OBJECTS = flush_ref.$(OBJEXT)
+flush_ref_LDADD = $(LDADD)
+flush_ref_DEPENDENCIES = ../src/libgetdata.la
 flush_spec_SOURCES = flush_spec.c
 flush_spec_OBJECTS = flush_spec.$(OBJEXT)
 flush_spec_LDADD = $(LDADD)
@@ -1651,10 +2033,30 @@ foffs_move_SOURCES = foffs_move.c
 foffs_move_OBJECTS = foffs_move.$(OBJEXT)
 foffs_move_LDADD = $(LDADD)
 foffs_move_DEPENDENCIES = ../src/libgetdata.la
+fragment_affix_SOURCES = fragment_affix.c
+fragment_affix_OBJECTS = fragment_affix.$(OBJEXT)
+fragment_affix_LDADD = $(LDADD)
+fragment_affix_DEPENDENCIES = ../src/libgetdata.la
+fragment_affix_alter_SOURCES = fragment_affix_alter.c
+fragment_affix_alter_OBJECTS = fragment_affix_alter.$(OBJEXT)
+fragment_affix_alter_LDADD = $(LDADD)
+fragment_affix_alter_DEPENDENCIES = ../src/libgetdata.la
+fragment_affix_alter2_SOURCES = fragment_affix_alter2.c
+fragment_affix_alter2_OBJECTS = fragment_affix_alter2.$(OBJEXT)
+fragment_affix_alter2_LDADD = $(LDADD)
+fragment_affix_alter2_DEPENDENCIES = ../src/libgetdata.la
+fragment_affix_dup_SOURCES = fragment_affix_dup.c
+fragment_affix_dup_OBJECTS = fragment_affix_dup.$(OBJEXT)
+fragment_affix_dup_LDADD = $(LDADD)
+fragment_affix_dup_DEPENDENCIES = ../src/libgetdata.la
 fragment_index_SOURCES = fragment_index.c
 fragment_index_OBJECTS = fragment_index.$(OBJEXT)
 fragment_index_LDADD = $(LDADD)
 fragment_index_DEPENDENCIES = ../src/libgetdata.la
+fragment_index_alias_SOURCES = fragment_index_alias.c
+fragment_index_alias_OBJECTS = fragment_index_alias.$(OBJEXT)
+fragment_index_alias_LDADD = $(LDADD)
+fragment_index_alias_DEPENDENCIES = ../src/libgetdata.la
 fragment_name_SOURCES = fragment_name.c
 fragment_name_OBJECTS = fragment_name.$(OBJEXT)
 fragment_name_LDADD = $(LDADD)
@@ -1663,10 +2065,22 @@ fragment_name_oor_SOURCES = fragment_name_oor.c
 fragment_name_oor_OBJECTS = fragment_name_oor.$(OBJEXT)
 fragment_name_oor_LDADD = $(LDADD)
 fragment_name_oor_DEPENDENCIES = ../src/libgetdata.la
+fragment_num_SOURCES = fragment_num.c
+fragment_num_OBJECTS = fragment_num.$(OBJEXT)
+fragment_num_LDADD = $(LDADD)
+fragment_num_DEPENDENCIES = ../src/libgetdata.la
+fragment_parent_SOURCES = fragment_parent.c
+fragment_parent_OBJECTS = fragment_parent.$(OBJEXT)
+fragment_parent_LDADD = $(LDADD)
+fragment_parent_DEPENDENCIES = ../src/libgetdata.la
 get64_SOURCES = get64.c
 get64_OBJECTS = get64.$(OBJEXT)
 get64_LDADD = $(LDADD)
 get64_DEPENDENCIES = ../src/libgetdata.la
+get_affix_SOURCES = get_affix.c
+get_affix_OBJECTS = get_affix.$(OBJEXT)
+get_affix_LDADD = $(LDADD)
+get_affix_DEPENDENCIES = ../src/libgetdata.la
 get_bad_code_SOURCES = get_bad_code.c
 get_bad_code_OBJECTS = get_bad_code.$(OBJEXT)
 get_bad_code_LDADD = $(LDADD)
@@ -1813,6 +2227,18 @@ get_fs_SOURCES = get_fs.c
 get_fs_OBJECTS = get_fs.$(OBJEXT)
 get_fs_LDADD = $(LDADD)
 get_fs_DEPENDENCIES = ../src/libgetdata.la
+get_here_SOURCES = get_here.c
+get_here_OBJECTS = get_here.$(OBJEXT)
+get_here_LDADD = $(LDADD)
+get_here_DEPENDENCIES = ../src/libgetdata.la
+get_here_foffs_SOURCES = get_here_foffs.c
+get_here_foffs_OBJECTS = get_here_foffs.$(OBJEXT)
+get_here_foffs_LDADD = $(LDADD)
+get_here_foffs_DEPENDENCIES = ../src/libgetdata.la
+get_heres_SOURCES = get_heres.c
+get_heres_OBJECTS = get_heres.$(OBJEXT)
+get_heres_LDADD = $(LDADD)
+get_heres_DEPENDENCIES = ../src/libgetdata.la
 get_int16_SOURCES = get_int16.c
 get_int16_OBJECTS = get_int16.$(OBJEXT)
 get_int16_LDADD = $(LDADD)
@@ -1853,6 +2279,14 @@ get_lincom_non_SOURCES = get_lincom_non.c
 get_lincom_non_OBJECTS = get_lincom_non.$(OBJEXT)
 get_lincom_non_LDADD = $(LDADD)
 get_lincom_non_DEPENDENCIES = ../src/libgetdata.la
+get_lincom_null_SOURCES = get_lincom_null.c
+get_lincom_null_OBJECTS = get_lincom_null.$(OBJEXT)
+get_lincom_null_LDADD = $(LDADD)
+get_lincom_null_DEPENDENCIES = ../src/libgetdata.la
+get_lincom_spf_SOURCES = get_lincom_spf.c
+get_lincom_spf_OBJECTS = get_lincom_spf.$(OBJEXT)
+get_lincom_spf_LDADD = $(LDADD)
+get_lincom_spf_DEPENDENCIES = ../src/libgetdata.la
 get_linterp_SOURCES = get_linterp.c
 get_linterp_OBJECTS = get_linterp.$(OBJEXT)
 get_linterp_LDADD = $(LDADD)
@@ -1869,6 +2303,26 @@ get_linterp_sort_SOURCES = get_linterp_sort.c
 get_linterp_sort_OBJECTS = get_linterp_sort.$(OBJEXT)
 get_linterp_sort_LDADD = $(LDADD)
 get_linterp_sort_DEPENDENCIES = ../src/libgetdata.la
+get_mplex_SOURCES = get_mplex.c
+get_mplex_OBJECTS = get_mplex.$(OBJEXT)
+get_mplex_LDADD = $(LDADD)
+get_mplex_DEPENDENCIES = ../src/libgetdata.la
+get_mplex_bof_SOURCES = get_mplex_bof.c
+get_mplex_bof_OBJECTS = get_mplex_bof.$(OBJEXT)
+get_mplex_bof_LDADD = $(LDADD)
+get_mplex_bof_DEPENDENCIES = ../src/libgetdata.la
+get_mplex_lb_SOURCES = get_mplex_lb.c
+get_mplex_lb_OBJECTS = get_mplex_lb.$(OBJEXT)
+get_mplex_lb_LDADD = $(LDADD)
+get_mplex_lb_DEPENDENCIES = ../src/libgetdata.la
+get_mplex_lball_SOURCES = get_mplex_lball.c
+get_mplex_lball_OBJECTS = get_mplex_lball.$(OBJEXT)
+get_mplex_lball_LDADD = $(LDADD)
+get_mplex_lball_DEPENDENCIES = ../src/libgetdata.la
+get_mplex_nolb_SOURCES = get_mplex_nolb.c
+get_mplex_nolb_OBJECTS = get_mplex_nolb.$(OBJEXT)
+get_mplex_nolb_LDADD = $(LDADD)
+get_mplex_nolb_DEPENDENCIES = ../src/libgetdata.la
 get_multiply_SOURCES = get_multiply.c
 get_multiply_OBJECTS = get_multiply.$(OBJEXT)
 get_multiply_LDADD = $(LDADD)
@@ -1893,6 +2347,10 @@ get_phase_SOURCES = get_phase.c
 get_phase_OBJECTS = get_phase.$(OBJEXT)
 get_phase_LDADD = $(LDADD)
 get_phase_DEPENDENCIES = ../src/libgetdata.la
+get_phase_affix_SOURCES = get_phase_affix.c
+get_phase_affix_OBJECTS = get_phase_affix.$(OBJEXT)
+get_phase_affix_LDADD = $(LDADD)
+get_phase_affix_DEPENDENCIES = ../src/libgetdata.la
 get_polynom_SOURCES = get_polynom.c
 get_polynom_OBJECTS = get_polynom.$(OBJEXT)
 get_polynom_LDADD = $(LDADD)
@@ -1913,6 +2371,10 @@ get_recurse_SOURCES = get_recurse.c
 get_recurse_OBJECTS = get_recurse.$(OBJEXT)
 get_recurse_LDADD = $(LDADD)
 get_recurse_DEPENDENCIES = ../src/libgetdata.la
+get_rofs_SOURCES = get_rofs.c
+get_rofs_OBJECTS = get_rofs.$(OBJEXT)
+get_rofs_LDADD = $(LDADD)
+get_rofs_DEPENDENCIES = ../src/libgetdata.la
 get_sbit_SOURCES = get_sbit.c
 get_sbit_OBJECTS = get_sbit.$(OBJEXT)
 get_sbit_LDADD = $(LDADD)
@@ -1941,10 +2403,46 @@ get_uint64_SOURCES = get_uint64.c
 get_uint64_OBJECTS = get_uint64.$(OBJEXT)
 get_uint64_LDADD = $(LDADD)
 get_uint64_DEPENDENCIES = ../src/libgetdata.la
+get_window_SOURCES = get_window.c
+get_window_OBJECTS = get_window.$(OBJEXT)
+get_window_LDADD = $(LDADD)
+get_window_DEPENDENCIES = ../src/libgetdata.la
+get_window_clr_SOURCES = get_window_clr.c
+get_window_clr_OBJECTS = get_window_clr.$(OBJEXT)
+get_window_clr_LDADD = $(LDADD)
+get_window_clr_DEPENDENCIES = ../src/libgetdata.la
+get_window_ge_SOURCES = get_window_ge.c
+get_window_ge_OBJECTS = get_window_ge.$(OBJEXT)
+get_window_ge_LDADD = $(LDADD)
+get_window_ge_DEPENDENCIES = ../src/libgetdata.la
+get_window_gt_SOURCES = get_window_gt.c
+get_window_gt_OBJECTS = get_window_gt.$(OBJEXT)
+get_window_gt_LDADD = $(LDADD)
+get_window_gt_DEPENDENCIES = ../src/libgetdata.la
+get_window_le_SOURCES = get_window_le.c
+get_window_le_OBJECTS = get_window_le.$(OBJEXT)
+get_window_le_LDADD = $(LDADD)
+get_window_le_DEPENDENCIES = ../src/libgetdata.la
+get_window_lt_SOURCES = get_window_lt.c
+get_window_lt_OBJECTS = get_window_lt.$(OBJEXT)
+get_window_lt_LDADD = $(LDADD)
+get_window_lt_DEPENDENCIES = ../src/libgetdata.la
+get_window_ne_SOURCES = get_window_ne.c
+get_window_ne_OBJECTS = get_window_ne.$(OBJEXT)
+get_window_ne_LDADD = $(LDADD)
+get_window_ne_DEPENDENCIES = ../src/libgetdata.la
+get_window_set_SOURCES = get_window_set.c
+get_window_set_OBJECTS = get_window_set.$(OBJEXT)
+get_window_set_LDADD = $(LDADD)
+get_window_set_DEPENDENCIES = ../src/libgetdata.la
 get_zero_SOURCES = get_zero.c
 get_zero_OBJECTS = get_zero.$(OBJEXT)
 get_zero_LDADD = $(LDADD)
 get_zero_DEPENDENCIES = ../src/libgetdata.la
+global_flags_SOURCES = global_flags.c
+global_flags_OBJECTS = global_flags.$(OBJEXT)
+global_flags_LDADD = $(LDADD)
+global_flags_DEPENDENCIES = ../src/libgetdata.la
 global_name_SOURCES = global_name.c
 global_name_OBJECTS = global_name.$(OBJEXT)
 global_name_LDADD = $(LDADD)
@@ -1961,6 +2459,10 @@ global_ref_set_SOURCES = global_ref_set.c
 global_ref_set_OBJECTS = global_ref_set.$(OBJEXT)
 global_ref_set_LDADD = $(LDADD)
 global_ref_set_DEPENDENCIES = ../src/libgetdata.la
+gzip_add_SOURCES = gzip_add.c
+gzip_add_OBJECTS = gzip_add.$(OBJEXT)
+gzip_add_LDADD = $(LDADD)
+gzip_add_DEPENDENCIES = ../src/libgetdata.la
 gzip_get_SOURCES = gzip_get.c
 gzip_get_OBJECTS = gzip_get.$(OBJEXT)
 gzip_get_LDADD = $(LDADD)
@@ -1969,18 +2471,50 @@ gzip_get_get_SOURCES = gzip_get_get.c
 gzip_get_get_OBJECTS = gzip_get_get.$(OBJEXT)
 gzip_get_get_LDADD = $(LDADD)
 gzip_get_get_DEPENDENCIES = ../src/libgetdata.la
+gzip_get_get2_SOURCES = gzip_get_get2.c
+gzip_get_get2_OBJECTS = gzip_get_get2.$(OBJEXT)
+gzip_get_get2_LDADD = $(LDADD)
+gzip_get_get2_DEPENDENCIES = ../src/libgetdata.la
+gzip_get_put_SOURCES = gzip_get_put.c
+gzip_get_put_OBJECTS = gzip_get_put.$(OBJEXT)
+gzip_get_put_LDADD = $(LDADD)
+gzip_get_put_DEPENDENCIES = ../src/libgetdata.la
 gzip_move_from_SOURCES = gzip_move_from.c
 gzip_move_from_OBJECTS = gzip_move_from.$(OBJEXT)
 gzip_move_from_LDADD = $(LDADD)
 gzip_move_from_DEPENDENCIES = ../src/libgetdata.la
+gzip_move_to_SOURCES = gzip_move_to.c
+gzip_move_to_OBJECTS = gzip_move_to.$(OBJEXT)
+gzip_move_to_LDADD = $(LDADD)
+gzip_move_to_DEPENDENCIES = ../src/libgetdata.la
 gzip_nframes_SOURCES = gzip_nframes.c
 gzip_nframes_OBJECTS = gzip_nframes.$(OBJEXT)
 gzip_nframes_LDADD = $(LDADD)
 gzip_nframes_DEPENDENCIES = ../src/libgetdata.la
+gzip_put_SOURCES = gzip_put.c
+gzip_put_OBJECTS = gzip_put.$(OBJEXT)
+gzip_put_LDADD = $(LDADD)
+gzip_put_DEPENDENCIES = ../src/libgetdata.la
+gzip_put_get_SOURCES = gzip_put_get.c
+gzip_put_get_OBJECTS = gzip_put_get.$(OBJEXT)
+gzip_put_get_LDADD = $(LDADD)
+gzip_put_get_DEPENDENCIES = ../src/libgetdata.la
 header_complex_SOURCES = header_complex.c
 header_complex_OBJECTS = header_complex.$(OBJEXT)
 header_complex_LDADD = $(LDADD)
 header_complex_DEPENDENCIES = ../src/libgetdata.la
+hide_SOURCES = hide.c
+hide_OBJECTS = hide.$(OBJEXT)
+hide_LDADD = $(LDADD)
+hide_DEPENDENCIES = ../src/libgetdata.la
+hide_hidden_SOURCES = hide_hidden.c
+hide_hidden_OBJECTS = hide_hidden.$(OBJEXT)
+hide_hidden_LDADD = $(LDADD)
+hide_hidden_DEPENDENCIES = ../src/libgetdata.la
+hide_unhide_SOURCES = hide_unhide.c
+hide_unhide_OBJECTS = hide_unhide.$(OBJEXT)
+hide_unhide_LDADD = $(LDADD)
+hide_unhide_DEPENDENCIES = ../src/libgetdata.la
 include_SOURCES = include.c
 include_OBJECTS = include.$(OBJEXT)
 include_LDADD = $(LDADD)
@@ -1989,6 +2523,10 @@ include_accmode_SOURCES = include_accmode.c
 include_accmode_OBJECTS = include_accmode.$(OBJEXT)
 include_accmode_LDADD = $(LDADD)
 include_accmode_DEPENDENCIES = ../src/libgetdata.la
+include_affix_SOURCES = include_affix.c
+include_affix_OBJECTS = include_affix.$(OBJEXT)
+include_affix_LDADD = $(LDADD)
+include_affix_DEPENDENCIES = ../src/libgetdata.la
 include_auto_SOURCES = include_auto.c
 include_auto_OBJECTS = include_auto.$(OBJEXT)
 include_auto_LDADD = $(LDADD)
@@ -2025,6 +2563,10 @@ include_ref_SOURCES = include_ref.c
 include_ref_OBJECTS = include_ref.$(OBJEXT)
 include_ref_LDADD = $(LDADD)
 include_ref_DEPENDENCIES = ../src/libgetdata.la
+include_sub_SOURCES = include_sub.c
+include_sub_OBJECTS = include_sub.$(OBJEXT)
+include_sub_LDADD = $(LDADD)
+include_sub_DEPENDENCIES = ../src/libgetdata.la
 include_syntax_SOURCES = include_syntax.c
 include_syntax_OBJECTS = include_syntax.$(OBJEXT)
 include_syntax_LDADD = $(LDADD)
@@ -2081,6 +2623,18 @@ madd_SOURCES = madd.c
 madd_OBJECTS = madd.$(OBJEXT)
 madd_LDADD = $(LDADD)
 madd_DEPENDENCIES = ../src/libgetdata.la
+madd_affix_SOURCES = madd_affix.c
+madd_affix_OBJECTS = madd_affix.$(OBJEXT)
+madd_affix_LDADD = $(LDADD)
+madd_affix_DEPENDENCIES = ../src/libgetdata.la
+madd_alias_SOURCES = madd_alias.c
+madd_alias_OBJECTS = madd_alias.$(OBJEXT)
+madd_alias_LDADD = $(LDADD)
+madd_alias_DEPENDENCIES = ../src/libgetdata.la
+madd_alias_affix_SOURCES = madd_alias_affix.c
+madd_alias_affix_OBJECTS = madd_alias_affix.$(OBJEXT)
+madd_alias_affix_LDADD = $(LDADD)
+madd_alias_affix_DEPENDENCIES = ../src/libgetdata.la
 madd_bit_SOURCES = madd_bit.c
 madd_bit_OBJECTS = madd_bit.$(OBJEXT)
 madd_bit_LDADD = $(LDADD)
@@ -2117,6 +2671,10 @@ madd_divide_SOURCES = madd_divide.c
 madd_divide_OBJECTS = madd_divide.$(OBJEXT)
 madd_divide_LDADD = $(LDADD)
 madd_divide_DEPENDENCIES = ../src/libgetdata.la
+madd_index_SOURCES = madd_index.c
+madd_index_OBJECTS = madd_index.$(OBJEXT)
+madd_index_LDADD = $(LDADD)
+madd_index_DEPENDENCIES = ../src/libgetdata.la
 madd_lincom_SOURCES = madd_lincom.c
 madd_lincom_OBJECTS = madd_lincom.$(OBJEXT)
 madd_lincom_LDADD = $(LDADD)
@@ -2133,6 +2691,10 @@ madd_linterp_invalid_SOURCES = madd_linterp_invalid.c
 madd_linterp_invalid_OBJECTS = madd_linterp_invalid.$(OBJEXT)
 madd_linterp_invalid_LDADD = $(LDADD)
 madd_linterp_invalid_DEPENDENCIES = ../src/libgetdata.la
+madd_mplex_SOURCES = madd_mplex.c
+madd_mplex_OBJECTS = madd_mplex.$(OBJEXT)
+madd_mplex_LDADD = $(LDADD)
+madd_mplex_DEPENDENCIES = ../src/libgetdata.la
 madd_multiply_SOURCES = madd_multiply.c
 madd_multiply_OBJECTS = madd_multiply.$(OBJEXT)
 madd_multiply_LDADD = $(LDADD)
@@ -2173,14 +2735,34 @@ madd_spec_invalid_SOURCES = madd_spec_invalid.c
 madd_spec_invalid_OBJECTS = madd_spec_invalid.$(OBJEXT)
 madd_spec_invalid_LDADD = $(LDADD)
 madd_spec_invalid_DEPENDENCIES = ../src/libgetdata.la
+madd_spec_resolv_SOURCES = madd_spec_resolv.c
+madd_spec_resolv_OBJECTS = madd_spec_resolv.$(OBJEXT)
+madd_spec_resolv_LDADD = $(LDADD)
+madd_spec_resolv_DEPENDENCIES = ../src/libgetdata.la
 madd_string_SOURCES = madd_string.c
 madd_string_OBJECTS = madd_string.$(OBJEXT)
 madd_string_LDADD = $(LDADD)
 madd_string_DEPENDENCIES = ../src/libgetdata.la
+madd_window_SOURCES = madd_window.c
+madd_window_OBJECTS = madd_window.$(OBJEXT)
+madd_window_LDADD = $(LDADD)
+madd_window_DEPENDENCIES = ../src/libgetdata.la
 move_SOURCES = move.c
 move_OBJECTS = move.$(OBJEXT)
 move_LDADD = $(LDADD)
 move_DEPENDENCIES = ../src/libgetdata.la
+move_affix_SOURCES = move_affix.c
+move_affix_OBJECTS = move_affix.$(OBJEXT)
+move_affix_LDADD = $(LDADD)
+move_affix_DEPENDENCIES = ../src/libgetdata.la
+move_affix_dup_SOURCES = move_affix_dup.c
+move_affix_dup_OBJECTS = move_affix_dup.$(OBJEXT)
+move_affix_dup_LDADD = $(LDADD)
+move_affix_dup_DEPENDENCIES = ../src/libgetdata.la
+move_alias_SOURCES = move_alias.c
+move_alias_OBJECTS = move_alias.$(OBJEXT)
+move_alias_LDADD = $(LDADD)
+move_alias_DEPENDENCIES = ../src/libgetdata.la
 move_data_enc_ar_SOURCES = move_data_enc_ar.c
 move_data_enc_ar_OBJECTS = move_data_enc_ar.$(OBJEXT)
 move_data_enc_ar_LDADD = $(LDADD)
@@ -2221,14 +2803,70 @@ name_SOURCES = name.c
 name_OBJECTS = name.$(OBJEXT)
 name_LDADD = $(LDADD)
 name_DEPENDENCIES = ../src/libgetdata.la
+name_affix_SOURCES = name_affix.c
+name_affix_OBJECTS = name_affix.$(OBJEXT)
+name_affix_LDADD = $(LDADD)
+name_affix_DEPENDENCIES = ../src/libgetdata.la
+name_affix_bad_SOURCES = name_affix_bad.c
+name_affix_bad_OBJECTS = name_affix_bad.$(OBJEXT)
+name_affix_bad_LDADD = $(LDADD)
+name_affix_bad_DEPENDENCIES = ../src/libgetdata.la
+name_alias_SOURCES = name_alias.c
+name_alias_OBJECTS = name_alias.$(OBJEXT)
+name_alias_LDADD = $(LDADD)
+name_alias_DEPENDENCIES = ../src/libgetdata.la
+name_dup_SOURCES = name_dup.c
+name_dup_OBJECTS = name_dup.$(OBJEXT)
+name_dup_LDADD = $(LDADD)
+name_dup_DEPENDENCIES = ../src/libgetdata.la
 name_move_SOURCES = name_move.c
 name_move_OBJECTS = name_move.$(OBJEXT)
 name_move_LDADD = $(LDADD)
 name_move_DEPENDENCIES = ../src/libgetdata.la
+name_move_alias_SOURCES = name_move_alias.c
+name_move_alias_OBJECTS = name_move_alias.$(OBJEXT)
+name_move_alias_LDADD = $(LDADD)
+name_move_alias_DEPENDENCIES = ../src/libgetdata.la
+name_updb_SOURCES = name_updb.c
+name_updb_OBJECTS = name_updb.$(OBJEXT)
+name_updb_LDADD = $(LDADD)
+name_updb_DEPENDENCIES = ../src/libgetdata.la
+name_updb_alias_SOURCES = name_updb_alias.c
+name_updb_alias_OBJECTS = name_updb_alias.$(OBJEXT)
+name_updb_alias_LDADD = $(LDADD)
+name_updb_alias_DEPENDENCIES = ../src/libgetdata.la
+name_updb_const_SOURCES = name_updb_const.c
+name_updb_const_OBJECTS = name_updb_const.$(OBJEXT)
+name_updb_const_LDADD = $(LDADD)
+name_updb_const_DEPENDENCIES = ../src/libgetdata.la
+name_updb_const_alias_SOURCES = name_updb_const_alias.c
+name_updb_const_alias_OBJECTS = name_updb_const_alias.$(OBJEXT)
+name_updb_const_alias_LDADD = $(LDADD)
+name_updb_const_alias_DEPENDENCIES = ../src/libgetdata.la
+nentries_alias_SOURCES = nentries_alias.c
+nentries_alias_OBJECTS = nentries_alias.$(OBJEXT)
+nentries_alias_LDADD = $(LDADD)
+nentries_alias_DEPENDENCIES = ../src/libgetdata.la
+nentries_hidden_SOURCES = nentries_hidden.c
+nentries_hidden_OBJECTS = nentries_hidden.$(OBJEXT)
+nentries_hidden_LDADD = $(LDADD)
+nentries_hidden_DEPENDENCIES = ../src/libgetdata.la
+nentries_noalias_SOURCES = nentries_noalias.c
+nentries_noalias_OBJECTS = nentries_noalias.$(OBJEXT)
+nentries_noalias_LDADD = $(LDADD)
+nentries_noalias_DEPENDENCIES = ../src/libgetdata.la
+nentries_scalar_SOURCES = nentries_scalar.c
+nentries_scalar_OBJECTS = nentries_scalar.$(OBJEXT)
+nentries_scalar_LDADD = $(LDADD)
+nentries_scalar_DEPENDENCIES = ../src/libgetdata.la
 nfields_SOURCES = nfields.c
 nfields_OBJECTS = nfields.$(OBJEXT)
 nfields_LDADD = $(LDADD)
 nfields_DEPENDENCIES = ../src/libgetdata.la
+nfields_hidden_SOURCES = nfields_hidden.c
+nfields_hidden_OBJECTS = nfields_hidden.$(OBJEXT)
+nfields_hidden_LDADD = $(LDADD)
+nfields_hidden_DEPENDENCIES = ../src/libgetdata.la
 nfields_invalid_SOURCES = nfields_invalid.c
 nfields_invalid_OBJECTS = nfields_invalid.$(OBJEXT)
 nfields_invalid_LDADD = $(LDADD)
@@ -2237,14 +2875,26 @@ nfields_type_SOURCES = nfields_type.c
 nfields_type_OBJECTS = nfields_type.$(OBJEXT)
 nfields_type_LDADD = $(LDADD)
 nfields_type_DEPENDENCIES = ../src/libgetdata.la
+nfields_type_hidden_SOURCES = nfields_type_hidden.c
+nfields_type_hidden_OBJECTS = nfields_type_hidden.$(OBJEXT)
+nfields_type_hidden_LDADD = $(LDADD)
+nfields_type_hidden_DEPENDENCIES = ../src/libgetdata.la
 nfields_type_invalid_SOURCES = nfields_type_invalid.c
 nfields_type_invalid_OBJECTS = nfields_type_invalid.$(OBJEXT)
 nfields_type_invalid_LDADD = $(LDADD)
 nfields_type_invalid_DEPENDENCIES = ../src/libgetdata.la
-nfragments_SOURCES = nfragments.c
-nfragments_OBJECTS = nfragments.$(OBJEXT)
-nfragments_LDADD = $(LDADD)
-nfragments_DEPENDENCIES = ../src/libgetdata.la
+nfields_vector_SOURCES = nfields_vector.c
+nfields_vector_OBJECTS = nfields_vector.$(OBJEXT)
+nfields_vector_LDADD = $(LDADD)
+nfields_vector_DEPENDENCIES = ../src/libgetdata.la
+nfields_vector_hidden_SOURCES = nfields_vector_hidden.c
+nfields_vector_hidden_OBJECTS = nfields_vector_hidden.$(OBJEXT)
+nfields_vector_hidden_LDADD = $(LDADD)
+nfields_vector_hidden_DEPENDENCIES = ../src/libgetdata.la
+nfields_vector_invalid_SOURCES = nfields_vector_invalid.c
+nfields_vector_invalid_OBJECTS = nfields_vector_invalid.$(OBJEXT)
+nfields_vector_invalid_LDADD = $(LDADD)
+nfields_vector_invalid_DEPENDENCIES = ../src/libgetdata.la
 nframes_SOURCES = nframes.c
 nframes_OBJECTS = nframes.$(OBJEXT)
 nframes_LDADD = $(LDADD)
@@ -2273,6 +2923,10 @@ nmeta_SOURCES = nmeta.c
 nmeta_OBJECTS = nmeta.$(OBJEXT)
 nmeta_LDADD = $(LDADD)
 nmeta_DEPENDENCIES = ../src/libgetdata.la
+nmeta_hidden_SOURCES = nmeta_hidden.c
+nmeta_hidden_OBJECTS = nmeta_hidden.$(OBJEXT)
+nmeta_hidden_LDADD = $(LDADD)
+nmeta_hidden_DEPENDENCIES = ../src/libgetdata.la
 nmeta_invalid_SOURCES = nmeta_invalid.c
 nmeta_invalid_OBJECTS = nmeta_invalid.$(OBJEXT)
 nmeta_invalid_LDADD = $(LDADD)
@@ -2285,6 +2939,10 @@ nmeta_type_SOURCES = nmeta_type.c
 nmeta_type_OBJECTS = nmeta_type.$(OBJEXT)
 nmeta_type_LDADD = $(LDADD)
 nmeta_type_DEPENDENCIES = ../src/libgetdata.la
+nmeta_type_hidden_SOURCES = nmeta_type_hidden.c
+nmeta_type_hidden_OBJECTS = nmeta_type_hidden.$(OBJEXT)
+nmeta_type_hidden_LDADD = $(LDADD)
+nmeta_type_hidden_DEPENDENCIES = ../src/libgetdata.la
 nmeta_type_invalid_SOURCES = nmeta_type_invalid.c
 nmeta_type_invalid_OBJECTS = nmeta_type_invalid.$(OBJEXT)
 nmeta_type_invalid_LDADD = $(LDADD)
@@ -2301,6 +2959,10 @@ nmeta_vectors_del_SOURCES = nmeta_vectors_del.c
 nmeta_vectors_del_OBJECTS = nmeta_vectors_del.$(OBJEXT)
 nmeta_vectors_del_LDADD = $(LDADD)
 nmeta_vectors_del_DEPENDENCIES = ../src/libgetdata.la
+nmeta_vectors_hidden_SOURCES = nmeta_vectors_hidden.c
+nmeta_vectors_hidden_OBJECTS = nmeta_vectors_hidden.$(OBJEXT)
+nmeta_vectors_hidden_LDADD = $(LDADD)
+nmeta_vectors_hidden_DEPENDENCIES = ../src/libgetdata.la
 nmeta_vectors_invalid_SOURCES = nmeta_vectors_invalid.c
 nmeta_vectors_invalid_OBJECTS = nmeta_vectors_invalid.$(OBJEXT)
 nmeta_vectors_invalid_LDADD = $(LDADD)
@@ -2309,18 +2971,14 @@ nmeta_vectors_parent_SOURCES = nmeta_vectors_parent.c
 nmeta_vectors_parent_OBJECTS = nmeta_vectors_parent.$(OBJEXT)
 nmeta_vectors_parent_LDADD = $(LDADD)
 nmeta_vectors_parent_DEPENDENCIES = ../src/libgetdata.la
-nvectors_SOURCES = nvectors.c
-nvectors_OBJECTS = nvectors.$(OBJEXT)
-nvectors_LDADD = $(LDADD)
-nvectors_DEPENDENCIES = ../src/libgetdata.la
-nvectors_invalid_SOURCES = nvectors_invalid.c
-nvectors_invalid_OBJECTS = nvectors_invalid.$(OBJEXT)
-nvectors_invalid_LDADD = $(LDADD)
-nvectors_invalid_DEPENDENCIES = ../src/libgetdata.la
 open_SOURCES = open.c
 open_OBJECTS = open.$(OBJEXT)
 open_LDADD = $(LDADD)
 open_DEPENDENCIES = ../src/libgetdata.la
+open_abs_SOURCES = open_abs.c
+open_abs_OBJECTS = open_abs.$(OBJEXT)
+open_abs_LDADD = $(LDADD)
+open_abs_DEPENDENCIES = ../src/libgetdata.la
 open_cb_abort_SOURCES = open_cb_abort.c
 open_cb_abort_OBJECTS = open_cb_abort.$(OBJEXT)
 open_cb_abort_LDADD = $(LDADD)
@@ -2353,10 +3011,62 @@ open_notdirfile_SOURCES = open_notdirfile.c
 open_notdirfile_OBJECTS = open_notdirfile.$(OBJEXT)
 open_notdirfile_LDADD = $(LDADD)
 open_notdirfile_DEPENDENCIES = ../src/libgetdata.la
-parent_SOURCES = parent.c
-parent_OBJECTS = parent.$(OBJEXT)
-parent_LDADD = $(LDADD)
-parent_DEPENDENCIES = ../src/libgetdata.la
+open_sym_a_SOURCES = open_sym_a.c
+open_sym_a_OBJECTS = open_sym_a.$(OBJEXT)
+open_sym_a_LDADD = $(LDADD)
+open_sym_a_DEPENDENCIES = ../src/libgetdata.la
+open_sym_al_SOURCES = open_sym_al.c
+open_sym_al_OBJECTS = open_sym_al.$(OBJEXT)
+open_sym_al_LDADD = $(LDADD)
+open_sym_al_DEPENDENCIES = ../src/libgetdata.la
+open_sym_at_SOURCES = open_sym_at.c
+open_sym_at_OBJECTS = open_sym_at.$(OBJEXT)
+open_sym_at_LDADD = $(LDADD)
+open_sym_at_DEPENDENCIES = ../src/libgetdata.la
+open_sym_c_SOURCES = open_sym_c.c
+open_sym_c_OBJECTS = open_sym_c.$(OBJEXT)
+open_sym_c_LDADD = $(LDADD)
+open_sym_c_DEPENDENCIES = ../src/libgetdata.la
+open_sym_cl_SOURCES = open_sym_cl.c
+open_sym_cl_OBJECTS = open_sym_cl.$(OBJEXT)
+open_sym_cl_LDADD = $(LDADD)
+open_sym_cl_DEPENDENCIES = ../src/libgetdata.la
+open_sym_ct_SOURCES = open_sym_ct.c
+open_sym_ct_OBJECTS = open_sym_ct.$(OBJEXT)
+open_sym_ct_LDADD = $(LDADD)
+open_sym_ct_DEPENDENCIES = ../src/libgetdata.la
+open_sym_p_SOURCES = open_sym_p.c
+open_sym_p_OBJECTS = open_sym_p.$(OBJEXT)
+open_sym_p_LDADD = $(LDADD)
+open_sym_p_DEPENDENCIES = ../src/libgetdata.la
+open_sym_pl_SOURCES = open_sym_pl.c
+open_sym_pl_OBJECTS = open_sym_pl.$(OBJEXT)
+open_sym_pl_LDADD = $(LDADD)
+open_sym_pl_DEPENDENCIES = ../src/libgetdata.la
+open_sym_pt_SOURCES = open_sym_pt.c
+open_sym_pt_OBJECTS = open_sym_pt.$(OBJEXT)
+open_sym_pt_LDADD = $(LDADD)
+open_sym_pt_DEPENDENCIES = ../src/libgetdata.la
+parse_alias_SOURCES = parse_alias.c
+parse_alias_OBJECTS = parse_alias.$(OBJEXT)
+parse_alias_LDADD = $(LDADD)
+parse_alias_DEPENDENCIES = ../src/libgetdata.la
+parse_alias_code_SOURCES = parse_alias_code.c
+parse_alias_code_OBJECTS = parse_alias_code.$(OBJEXT)
+parse_alias_code_LDADD = $(LDADD)
+parse_alias_code_DEPENDENCIES = ../src/libgetdata.la
+parse_alias_dup_SOURCES = parse_alias_dup.c
+parse_alias_dup_OBJECTS = parse_alias_dup.$(OBJEXT)
+parse_alias_dup_LDADD = $(LDADD)
+parse_alias_dup_DEPENDENCIES = ../src/libgetdata.la
+parse_alias_meta_SOURCES = parse_alias_meta.c
+parse_alias_meta_OBJECTS = parse_alias_meta.$(OBJEXT)
+parse_alias_meta_LDADD = $(LDADD)
+parse_alias_meta_DEPENDENCIES = ../src/libgetdata.la
+parse_alias_missing_SOURCES = parse_alias_missing.c
+parse_alias_missing_OBJECTS = parse_alias_missing.$(OBJEXT)
+parse_alias_missing_LDADD = $(LDADD)
+parse_alias_missing_DEPENDENCIES = ../src/libgetdata.la
 parse_badline_SOURCES = parse_badline.c
 parse_badline_OBJECTS = parse_badline.$(OBJEXT)
 parse_badline_LDADD = $(LDADD)
@@ -2401,6 +3111,10 @@ parse_const_SOURCES = parse_const.c
 parse_const_OBJECTS = parse_const.$(OBJEXT)
 parse_const_LDADD = $(LDADD)
 parse_const_DEPENDENCIES = ../src/libgetdata.la
+parse_const_complex_SOURCES = parse_const_complex.c
+parse_const_complex_OBJECTS = parse_const_complex.$(OBJEXT)
+parse_const_complex_LDADD = $(LDADD)
+parse_const_complex_DEPENDENCIES = ../src/libgetdata.la
 parse_const_ncols_SOURCES = parse_const_ncols.c
 parse_const_ncols_OBJECTS = parse_const_ncols.$(OBJEXT)
 parse_const_ncols_LDADD = $(LDADD)
@@ -2409,6 +3123,10 @@ parse_divide_SOURCES = parse_divide.c
 parse_divide_OBJECTS = parse_divide.$(OBJEXT)
 parse_divide_LDADD = $(LDADD)
 parse_divide_DEPENDENCIES = ../src/libgetdata.la
+parse_double_SOURCES = parse_double.c
+parse_double_OBJECTS = parse_double.$(OBJEXT)
+parse_double_LDADD = $(LDADD)
+parse_double_DEPENDENCIES = ../src/libgetdata.la
 parse_duplicate_SOURCES = parse_duplicate.c
 parse_duplicate_OBJECTS = parse_duplicate.$(OBJEXT)
 parse_duplicate_LDADD = $(LDADD)
@@ -2453,6 +3171,18 @@ parse_foffs_slash_SOURCES = parse_foffs_slash.c
 parse_foffs_slash_OBJECTS = parse_foffs_slash.$(OBJEXT)
 parse_foffs_slash_LDADD = $(LDADD)
 parse_foffs_slash_DEPENDENCIES = ../src/libgetdata.la
+parse_hidden_SOURCES = parse_hidden.c
+parse_hidden_OBJECTS = parse_hidden.$(OBJEXT)
+parse_hidden_LDADD = $(LDADD)
+parse_hidden_DEPENDENCIES = ../src/libgetdata.la
+parse_hidden_field_SOURCES = parse_hidden_field.c
+parse_hidden_field_OBJECTS = parse_hidden_field.$(OBJEXT)
+parse_hidden_field_LDADD = $(LDADD)
+parse_hidden_field_DEPENDENCIES = ../src/libgetdata.la
+parse_hidden_meta_SOURCES = parse_hidden_meta.c
+parse_hidden_meta_OBJECTS = parse_hidden_meta.$(OBJEXT)
+parse_hidden_meta_LDADD = $(LDADD)
+parse_hidden_meta_DEPENDENCIES = ../src/libgetdata.la
 parse_include_SOURCES = parse_include.c
 parse_include_OBJECTS = parse_include.$(OBJEXT)
 parse_include_LDADD = $(LDADD)
@@ -2465,11 +3195,39 @@ parse_include_absrel_SOURCES = parse_include_absrel.c
 parse_include_absrel_OBJECTS = parse_include_absrel.$(OBJEXT)
 parse_include_absrel_LDADD = $(LDADD)
 parse_include_absrel_DEPENDENCIES = ../src/libgetdata.la
+parse_include_affix_ref_SOURCES = parse_include_affix_ref.c
+parse_include_affix_ref_OBJECTS = parse_include_affix_ref.$(OBJEXT)
+parse_include_affix_ref_LDADD = $(LDADD)
+parse_include_affix_ref_DEPENDENCIES = ../src/libgetdata.la
+parse_include_dir_SOURCES = parse_include_dir.c
+parse_include_dir_OBJECTS = parse_include_dir.$(OBJEXT)
+parse_include_dir_LDADD = $(LDADD)
+parse_include_dir_DEPENDENCIES = ../src/libgetdata.la
+parse_include_loop_SOURCES = parse_include_loop.c
+parse_include_loop_OBJECTS = parse_include_loop.$(OBJEXT)
+parse_include_loop_LDADD = $(LDADD)
+parse_include_loop_DEPENDENCIES = ../src/libgetdata.la
 parse_include_nonexistent_SOURCES = parse_include_nonexistent.c
 parse_include_nonexistent_OBJECTS =  \
 	parse_include_nonexistent.$(OBJEXT)
 parse_include_nonexistent_LDADD = $(LDADD)
 parse_include_nonexistent_DEPENDENCIES = ../src/libgetdata.la
+parse_include_prefix_SOURCES = parse_include_prefix.c
+parse_include_prefix_OBJECTS = parse_include_prefix.$(OBJEXT)
+parse_include_prefix_LDADD = $(LDADD)
+parse_include_prefix_DEPENDENCIES = ../src/libgetdata.la
+parse_include_prefix_dup_SOURCES = parse_include_prefix_dup.c
+parse_include_prefix_dup_OBJECTS = parse_include_prefix_dup.$(OBJEXT)
+parse_include_prefix_dup_LDADD = $(LDADD)
+parse_include_prefix_dup_DEPENDENCIES = ../src/libgetdata.la
+parse_include_preprefix_SOURCES = parse_include_preprefix.c
+parse_include_preprefix_OBJECTS = parse_include_preprefix.$(OBJEXT)
+parse_include_preprefix_LDADD = $(LDADD)
+parse_include_preprefix_DEPENDENCIES = ../src/libgetdata.la
+parse_include_ref_SOURCES = parse_include_ref.c
+parse_include_ref_OBJECTS = parse_include_ref.$(OBJEXT)
+parse_include_ref_LDADD = $(LDADD)
+parse_include_ref_DEPENDENCIES = ../src/libgetdata.la
 parse_include_relabs_SOURCES = parse_include_relabs.c
 parse_include_relabs_OBJECTS = parse_include_relabs.$(OBJEXT)
 parse_include_relabs_LDADD = $(LDADD)
@@ -2482,6 +3240,14 @@ parse_include_slash_SOURCES = parse_include_slash.c
 parse_include_slash_OBJECTS = parse_include_slash.$(OBJEXT)
 parse_include_slash_LDADD = $(LDADD)
 parse_include_slash_DEPENDENCIES = ../src/libgetdata.la
+parse_include_suffix_SOURCES = parse_include_suffix.c
+parse_include_suffix_OBJECTS = parse_include_suffix.$(OBJEXT)
+parse_include_suffix_LDADD = $(LDADD)
+parse_include_suffix_DEPENDENCIES = ../src/libgetdata.la
+parse_include_sufsuffix_SOURCES = parse_include_sufsuffix.c
+parse_include_sufsuffix_OBJECTS = parse_include_sufsuffix.$(OBJEXT)
+parse_include_sufsuffix_LDADD = $(LDADD)
+parse_include_sufsuffix_DEPENDENCIES = ../src/libgetdata.la
 parse_index_SOURCES = parse_index.c
 parse_index_OBJECTS = parse_index.$(OBJEXT)
 parse_index_LDADD = $(LDADD)
@@ -2526,10 +3292,30 @@ parse_linterp_ncols_SOURCES = parse_linterp_ncols.c
 parse_linterp_ncols_OBJECTS = parse_linterp_ncols.$(OBJEXT)
 parse_linterp_ncols_LDADD = $(LDADD)
 parse_linterp_ncols_DEPENDENCIES = ../src/libgetdata.la
+parse_malias_SOURCES = parse_malias.c
+parse_malias_OBJECTS = parse_malias.$(OBJEXT)
+parse_malias_LDADD = $(LDADD)
+parse_malias_DEPENDENCIES = ../src/libgetdata.la
+parse_malias_dup_SOURCES = parse_malias_dup.c
+parse_malias_dup_OBJECTS = parse_malias_dup.$(OBJEXT)
+parse_malias_dup_LDADD = $(LDADD)
+parse_malias_dup_DEPENDENCIES = ../src/libgetdata.la
+parse_malias_meta_SOURCES = parse_malias_meta.c
+parse_malias_meta_OBJECTS = parse_malias_meta.$(OBJEXT)
+parse_malias_meta_LDADD = $(LDADD)
+parse_malias_meta_DEPENDENCIES = ../src/libgetdata.la
 parse_meta_SOURCES = parse_meta.c
 parse_meta_OBJECTS = parse_meta.$(OBJEXT)
 parse_meta_LDADD = $(LDADD)
 parse_meta_DEPENDENCIES = ../src/libgetdata.la
+parse_meta_affix_SOURCES = parse_meta_affix.c
+parse_meta_affix_OBJECTS = parse_meta_affix.$(OBJEXT)
+parse_meta_affix_LDADD = $(LDADD)
+parse_meta_affix_DEPENDENCIES = ../src/libgetdata.la
+parse_meta_alias_SOURCES = parse_meta_alias.c
+parse_meta_alias_OBJECTS = parse_meta_alias.$(OBJEXT)
+parse_meta_alias_LDADD = $(LDADD)
+parse_meta_alias_DEPENDENCIES = ../src/libgetdata.la
 parse_meta_implicit_SOURCES = parse_meta_implicit.c
 parse_meta_implicit_OBJECTS = parse_meta_implicit.$(OBJEXT)
 parse_meta_implicit_LDADD = $(LDADD)
@@ -2538,6 +3324,11 @@ parse_meta_implicit2_SOURCES = parse_meta_implicit2.c
 parse_meta_implicit2_OBJECTS = parse_meta_implicit2.$(OBJEXT)
 parse_meta_implicit2_LDADD = $(LDADD)
 parse_meta_implicit2_DEPENDENCIES = ../src/libgetdata.la
+parse_meta_implicit_affix_SOURCES = parse_meta_implicit_affix.c
+parse_meta_implicit_affix_OBJECTS =  \
+	parse_meta_implicit_affix.$(OBJEXT)
+parse_meta_implicit_affix_LDADD = $(LDADD)
+parse_meta_implicit_affix_DEPENDENCIES = ../src/libgetdata.la
 parse_meta_index_SOURCES = parse_meta_index.c
 parse_meta_index_OBJECTS = parse_meta_index.$(OBJEXT)
 parse_meta_index_LDADD = $(LDADD)
@@ -2546,6 +3337,18 @@ parse_meta_index2_SOURCES = parse_meta_index2.c
 parse_meta_index2_OBJECTS = parse_meta_index2.$(OBJEXT)
 parse_meta_index2_LDADD = $(LDADD)
 parse_meta_index2_DEPENDENCIES = ../src/libgetdata.la
+parse_meta_jump_SOURCES = parse_meta_jump.c
+parse_meta_jump_OBJECTS = parse_meta_jump.$(OBJEXT)
+parse_meta_jump_LDADD = $(LDADD)
+parse_meta_jump_DEPENDENCIES = ../src/libgetdata.la
+parse_meta_malias_SOURCES = parse_meta_malias.c
+parse_meta_malias_OBJECTS = parse_meta_malias.$(OBJEXT)
+parse_meta_malias_LDADD = $(LDADD)
+parse_meta_malias_DEPENDENCIES = ../src/libgetdata.la
+parse_meta_meta_SOURCES = parse_meta_meta.c
+parse_meta_meta_OBJECTS = parse_meta_meta.$(OBJEXT)
+parse_meta_meta_LDADD = $(LDADD)
+parse_meta_meta_DEPENDENCIES = ../src/libgetdata.la
 parse_meta_parent_SOURCES = parse_meta_parent.c
 parse_meta_parent_OBJECTS = parse_meta_parent.$(OBJEXT)
 parse_meta_parent_LDADD = $(LDADD)
@@ -2554,6 +3357,22 @@ parse_meta_raw_SOURCES = parse_meta_raw.c
 parse_meta_raw_OBJECTS = parse_meta_raw.$(OBJEXT)
 parse_meta_raw_LDADD = $(LDADD)
 parse_meta_raw_DEPENDENCIES = ../src/libgetdata.la
+parse_mplex_SOURCES = parse_mplex.c
+parse_mplex_OBJECTS = parse_mplex.$(OBJEXT)
+parse_mplex_LDADD = $(LDADD)
+parse_mplex_DEPENDENCIES = ../src/libgetdata.la
+parse_mplex_ncols_SOURCES = parse_mplex_ncols.c
+parse_mplex_ncols_OBJECTS = parse_mplex_ncols.$(OBJEXT)
+parse_mplex_ncols_LDADD = $(LDADD)
+parse_mplex_ncols_DEPENDENCIES = ../src/libgetdata.la
+parse_mplex_nomax_SOURCES = parse_mplex_nomax.c
+parse_mplex_nomax_OBJECTS = parse_mplex_nomax.$(OBJEXT)
+parse_mplex_nomax_LDADD = $(LDADD)
+parse_mplex_nomax_DEPENDENCIES = ../src/libgetdata.la
+parse_mplex_scalar_SOURCES = parse_mplex_scalar.c
+parse_mplex_scalar_OBJECTS = parse_mplex_scalar.$(OBJEXT)
+parse_mplex_scalar_LDADD = $(LDADD)
+parse_mplex_scalar_DEPENDENCIES = ../src/libgetdata.la
 parse_multiply_SOURCES = parse_multiply.c
 parse_multiply_OBJECTS = parse_multiply.$(OBJEXT)
 parse_multiply_LDADD = $(LDADD)
@@ -2698,10 +3517,26 @@ parse_version_SOURCES = parse_version.c
 parse_version_OBJECTS = parse_version.$(OBJEXT)
 parse_version_LDADD = $(LDADD)
 parse_version_DEPENDENCIES = ../src/libgetdata.la
+parse_version_89_SOURCES = parse_version_89.c
+parse_version_89_OBJECTS = parse_version_89.$(OBJEXT)
+parse_version_89_LDADD = $(LDADD)
+parse_version_89_DEPENDENCIES = ../src/libgetdata.la
+parse_version_98_SOURCES = parse_version_98.c
+parse_version_98_OBJECTS = parse_version_98.$(OBJEXT)
+parse_version_98_LDADD = $(LDADD)
+parse_version_98_DEPENDENCIES = ../src/libgetdata.la
 parse_version_include_SOURCES = parse_version_include.c
 parse_version_include_OBJECTS = parse_version_include.$(OBJEXT)
 parse_version_include_LDADD = $(LDADD)
 parse_version_include_DEPENDENCIES = ../src/libgetdata.la
+parse_version_p8_SOURCES = parse_version_p8.c
+parse_version_p8_OBJECTS = parse_version_p8.$(OBJEXT)
+parse_version_p8_LDADD = $(LDADD)
+parse_version_p8_DEPENDENCIES = ../src/libgetdata.la
+parse_version_p9_SOURCES = parse_version_p9.c
+parse_version_p9_OBJECTS = parse_version_p9.$(OBJEXT)
+parse_version_p9_LDADD = $(LDADD)
+parse_version_p9_DEPENDENCIES = ../src/libgetdata.la
 parse_version_permissive_SOURCES = parse_version_permissive.c
 parse_version_permissive_OBJECTS = parse_version_permissive.$(OBJEXT)
 parse_version_permissive_LDADD = $(LDADD)
@@ -2714,6 +3549,22 @@ parse_whitespace_SOURCES = parse_whitespace.c
 parse_whitespace_OBJECTS = parse_whitespace.$(OBJEXT)
 parse_whitespace_LDADD = $(LDADD)
 parse_whitespace_DEPENDENCIES = ../src/libgetdata.la
+parse_window_SOURCES = parse_window.c
+parse_window_OBJECTS = parse_window.$(OBJEXT)
+parse_window_LDADD = $(LDADD)
+parse_window_DEPENDENCIES = ../src/libgetdata.la
+parse_window_ncols_SOURCES = parse_window_ncols.c
+parse_window_ncols_OBJECTS = parse_window_ncols.$(OBJEXT)
+parse_window_ncols_LDADD = $(LDADD)
+parse_window_ncols_DEPENDENCIES = ../src/libgetdata.la
+parse_window_op_SOURCES = parse_window_op.c
+parse_window_op_OBJECTS = parse_window_op.$(OBJEXT)
+parse_window_op_LDADD = $(LDADD)
+parse_window_op_DEPENDENCIES = ../src/libgetdata.la
+parse_window_scalar_SOURCES = parse_window_scalar.c
+parse_window_scalar_OBJECTS = parse_window_scalar.$(OBJEXT)
+parse_window_scalar_LDADD = $(LDADD)
+parse_window_scalar_DEPENDENCIES = ../src/libgetdata.la
 protect_alter_SOURCES = protect_alter.c
 protect_alter_OBJECTS = protect_alter.$(OBJEXT)
 protect_alter_LDADD = $(LDADD)
@@ -2860,6 +3711,14 @@ put_fs_SOURCES = put_fs.c
 put_fs_OBJECTS = put_fs.$(OBJEXT)
 put_fs_LDADD = $(LDADD)
 put_fs_DEPENDENCIES = ../src/libgetdata.la
+put_here_SOURCES = put_here.c
+put_here_OBJECTS = put_here.$(OBJEXT)
+put_here_LDADD = $(LDADD)
+put_here_DEPENDENCIES = ../src/libgetdata.la
+put_heres_SOURCES = put_heres.c
+put_heres_OBJECTS = put_heres.$(OBJEXT)
+put_heres_LDADD = $(LDADD)
+put_heres_DEPENDENCIES = ../src/libgetdata.la
 put_int16_SOURCES = put_int16.c
 put_int16_OBJECTS = put_int16.$(OBJEXT)
 put_int16_LDADD = $(LDADD)
@@ -2912,6 +3771,10 @@ put_linterp_reverse_SOURCES = put_linterp_reverse.c
 put_linterp_reverse_OBJECTS = put_linterp_reverse.$(OBJEXT)
 put_linterp_reverse_LDADD = $(LDADD)
 put_linterp_reverse_DEPENDENCIES = ../src/libgetdata.la
+put_mplex_SOURCES = put_mplex.c
+put_mplex_OBJECTS = put_mplex.$(OBJEXT)
+put_mplex_LDADD = $(LDADD)
+put_mplex_DEPENDENCIES = ../src/libgetdata.la
 put_multiply_SOURCES = put_multiply.c
 put_multiply_OBJECTS = put_multiply.$(OBJEXT)
 put_multiply_LDADD = $(LDADD)
@@ -3004,6 +3867,14 @@ put_uint64_SOURCES = put_uint64.c
 put_uint64_OBJECTS = put_uint64.$(OBJEXT)
 put_uint64_LDADD = $(LDADD)
 put_uint64_DEPENDENCIES = ../src/libgetdata.la
+put_window_SOURCES = put_window.c
+put_window_OBJECTS = put_window.$(OBJEXT)
+put_window_LDADD = $(LDADD)
+put_window_DEPENDENCIES = ../src/libgetdata.la
+put_zero_SOURCES = put_zero.c
+put_zero_OBJECTS = put_zero.$(OBJEXT)
+put_zero_LDADD = $(LDADD)
+put_zero_DEPENDENCIES = ../src/libgetdata.la
 ref_SOURCES = ref.c
 ref_OBJECTS = ref.$(OBJEXT)
 ref_LDADD = $(LDADD)
@@ -3088,6 +3959,62 @@ repr_uint8_SOURCES = repr_uint8.c
 repr_uint8_OBJECTS = repr_uint8.$(OBJEXT)
 repr_uint8_LDADD = $(LDADD)
 repr_uint8_DEPENDENCIES = ../src/libgetdata.la
+seek64_SOURCES = seek64.c
+seek64_OBJECTS = seek64.$(OBJEXT)
+seek64_LDADD = $(LDADD)
+seek64_DEPENDENCIES = ../src/libgetdata.la
+seek_cur_SOURCES = seek_cur.c
+seek_cur_OBJECTS = seek_cur.$(OBJEXT)
+seek_cur_LDADD = $(LDADD)
+seek_cur_DEPENDENCIES = ../src/libgetdata.la
+seek_end_SOURCES = seek_end.c
+seek_end_OBJECTS = seek_end.$(OBJEXT)
+seek_end_LDADD = $(LDADD)
+seek_end_DEPENDENCIES = ../src/libgetdata.la
+seek_foffs_SOURCES = seek_foffs.c
+seek_foffs_OBJECTS = seek_foffs.$(OBJEXT)
+seek_foffs_LDADD = $(LDADD)
+seek_foffs_DEPENDENCIES = ../src/libgetdata.la
+seek_neg_SOURCES = seek_neg.c
+seek_neg_OBJECTS = seek_neg.$(OBJEXT)
+seek_neg_LDADD = $(LDADD)
+seek_neg_DEPENDENCIES = ../src/libgetdata.la
+seek_set_SOURCES = seek_set.c
+seek_set_OBJECTS = seek_set.$(OBJEXT)
+seek_set_LDADD = $(LDADD)
+seek_set_DEPENDENCIES = ../src/libgetdata.la
+sie_get_big_SOURCES = sie_get_big.c
+sie_get_big_OBJECTS = sie_get_big.$(OBJEXT)
+sie_get_big_LDADD = $(LDADD)
+sie_get_big_DEPENDENCIES = ../src/libgetdata.la
+sie_get_little_SOURCES = sie_get_little.c
+sie_get_little_OBJECTS = sie_get_little.$(OBJEXT)
+sie_get_little_LDADD = $(LDADD)
+sie_get_little_DEPENDENCIES = ../src/libgetdata.la
+sie_move_from_SOURCES = sie_move_from.c
+sie_move_from_OBJECTS = sie_move_from.$(OBJEXT)
+sie_move_from_LDADD = $(LDADD)
+sie_move_from_DEPENDENCIES = ../src/libgetdata.la
+sie_move_to_SOURCES = sie_move_to.c
+sie_move_to_OBJECTS = sie_move_to.$(OBJEXT)
+sie_move_to_LDADD = $(LDADD)
+sie_move_to_DEPENDENCIES = ../src/libgetdata.la
+sie_nframes_big_SOURCES = sie_nframes_big.c
+sie_nframes_big_OBJECTS = sie_nframes_big.$(OBJEXT)
+sie_nframes_big_LDADD = $(LDADD)
+sie_nframes_big_DEPENDENCIES = ../src/libgetdata.la
+sie_nframes_little_SOURCES = sie_nframes_little.c
+sie_nframes_little_OBJECTS = sie_nframes_little.$(OBJEXT)
+sie_nframes_little_LDADD = $(LDADD)
+sie_nframes_little_DEPENDENCIES = ../src/libgetdata.la
+sie_put_big_SOURCES = sie_put_big.c
+sie_put_big_OBJECTS = sie_put_big.$(OBJEXT)
+sie_put_big_LDADD = $(LDADD)
+sie_put_big_DEPENDENCIES = ../src/libgetdata.la
+sie_put_little_SOURCES = sie_put_little.c
+sie_put_little_OBJECTS = sie_put_little.$(OBJEXT)
+sie_put_little_LDADD = $(LDADD)
+sie_put_little_DEPENDENCIES = ../src/libgetdata.la
 slim_get_SOURCES = slim_get.c
 slim_get_OBJECTS = slim_get.$(OBJEXT)
 slim_get_LDADD = $(LDADD)
@@ -3100,6 +4027,18 @@ spf_SOURCES = spf.c
 spf_OBJECTS = spf.$(OBJEXT)
 spf_LDADD = $(LDADD)
 spf_DEPENDENCIES = ../src/libgetdata.la
+spf_alias_SOURCES = spf_alias.c
+spf_alias_OBJECTS = spf_alias.$(OBJEXT)
+spf_alias_LDADD = $(LDADD)
+spf_alias_DEPENDENCIES = ../src/libgetdata.la
+spf_alias_meta_SOURCES = spf_alias_meta.c
+spf_alias_meta_OBJECTS = spf_alias_meta.$(OBJEXT)
+spf_alias_meta_LDADD = $(LDADD)
+spf_alias_meta_DEPENDENCIES = ../src/libgetdata.la
+spf_alias_missing_SOURCES = spf_alias_missing.c
+spf_alias_missing_OBJECTS = spf_alias_missing.$(OBJEXT)
+spf_alias_missing_LDADD = $(LDADD)
+spf_alias_missing_DEPENDENCIES = ../src/libgetdata.la
 spf_divide_SOURCES = spf_divide.c
 spf_divide_OBJECTS = spf_divide.$(OBJEXT)
 spf_divide_LDADD = $(LDADD)
@@ -3128,6 +4067,10 @@ svlist_SOURCES = svlist.c
 svlist_OBJECTS = svlist.$(OBJEXT)
 svlist_LDADD = $(LDADD)
 svlist_DEPENDENCIES = ../src/libgetdata.la
+svlist_hidden_SOURCES = svlist_hidden.c
+svlist_hidden_OBJECTS = svlist_hidden.$(OBJEXT)
+svlist_hidden_LDADD = $(LDADD)
+svlist_hidden_DEPENDENCIES = ../src/libgetdata.la
 svlist_invalid_SOURCES = svlist_invalid.c
 svlist_invalid_OBJECTS = svlist_invalid.$(OBJEXT)
 svlist_invalid_LDADD = $(LDADD)
@@ -3136,14 +4079,58 @@ svlist_meta_SOURCES = svlist_meta.c
 svlist_meta_OBJECTS = svlist_meta.$(OBJEXT)
 svlist_meta_LDADD = $(LDADD)
 svlist_meta_DEPENDENCIES = ../src/libgetdata.la
+svlist_meta_hidden_SOURCES = svlist_meta_hidden.c
+svlist_meta_hidden_OBJECTS = svlist_meta_hidden.$(OBJEXT)
+svlist_meta_hidden_LDADD = $(LDADD)
+svlist_meta_hidden_DEPENDENCIES = ../src/libgetdata.la
 svlist_meta_invalid_SOURCES = svlist_meta_invalid.c
 svlist_meta_invalid_OBJECTS = svlist_meta_invalid.$(OBJEXT)
 svlist_meta_invalid_LDADD = $(LDADD)
 svlist_meta_invalid_DEPENDENCIES = ../src/libgetdata.la
+table_SOURCES = table.c
+table_OBJECTS = table.$(OBJEXT)
+table_LDADD = $(LDADD)
+table_DEPENDENCIES = ../src/libgetdata.la
+table_code_SOURCES = table_code.c
+table_code_OBJECTS = table_code.$(OBJEXT)
+table_code_LDADD = $(LDADD)
+table_code_DEPENDENCIES = ../src/libgetdata.la
+table_type_SOURCES = table_type.c
+table_type_OBJECTS = table_type.$(OBJEXT)
+table_type_LDADD = $(LDADD)
+table_type_DEPENDENCIES = ../src/libgetdata.la
+tell_SOURCES = tell.c
+tell_OBJECTS = tell.$(OBJEXT)
+tell_LDADD = $(LDADD)
+tell_DEPENDENCIES = ../src/libgetdata.la
+tell64_SOURCES = tell64.c
+tell64_OBJECTS = tell64.$(OBJEXT)
+tell64_LDADD = $(LDADD)
+tell64_DEPENDENCIES = ../src/libgetdata.la
+tell_multidiv_SOURCES = tell_multidiv.c
+tell_multidiv_OBJECTS = tell_multidiv.$(OBJEXT)
+tell_multidiv_LDADD = $(LDADD)
+tell_multidiv_DEPENDENCIES = ../src/libgetdata.la
+tok_arg_SOURCES = tok_arg.c
+tok_arg_OBJECTS = tok_arg.$(OBJEXT)
+tok_arg_LDADD = $(LDADD)
+tok_arg_DEPENDENCIES = ../src/libgetdata.la
+tok_escape_SOURCES = tok_escape.c
+tok_escape_OBJECTS = tok_escape.$(OBJEXT)
+tok_escape_LDADD = $(LDADD)
+tok_escape_DEPENDENCIES = ../src/libgetdata.la
+tok_quote_SOURCES = tok_quote.c
+tok_quote_OBJECTS = tok_quote.$(OBJEXT)
+tok_quote_LDADD = $(LDADD)
+tok_quote_DEPENDENCIES = ../src/libgetdata.la
 trunc_SOURCES = trunc.c
 trunc_OBJECTS = trunc.$(OBJEXT)
 trunc_LDADD = $(LDADD)
 trunc_DEPENDENCIES = ../src/libgetdata.la
+trunc_dir_SOURCES = trunc_dir.c
+trunc_dir_OBJECTS = trunc_dir.$(OBJEXT)
+trunc_dir_LDADD = $(LDADD)
+trunc_dir_DEPENDENCIES = ../src/libgetdata.la
 trunc_rdonly_SOURCES = trunc_rdonly.c
 trunc_rdonly_OBJECTS = trunc_rdonly.$(OBJEXT)
 trunc_rdonly_LDADD = $(LDADD)
@@ -3152,6 +4139,10 @@ trunc_rofs_SOURCES = trunc_rofs.c
 trunc_rofs_OBJECTS = trunc_rofs.$(OBJEXT)
 trunc_rofs_LDADD = $(LDADD)
 trunc_rofs_DEPENDENCIES = ../src/libgetdata.la
+trunc_truncsub_SOURCES = trunc_truncsub.c
+trunc_truncsub_OBJECTS = trunc_truncsub.$(OBJEXT)
+trunc_truncsub_LDADD = $(LDADD)
+trunc_truncsub_DEPENDENCIES = ../src/libgetdata.la
 unclude_SOURCES = unclude.c
 unclude_OBJECTS = unclude.$(OBJEXT)
 unclude_LDADD = $(LDADD)
@@ -3252,10 +4243,30 @@ version_8_write_SOURCES = version_8_write.c
 version_8_write_OBJECTS = version_8_write.$(OBJEXT)
 version_8_write_LDADD = $(LDADD)
 version_8_write_DEPENDENCIES = ../src/libgetdata.la
+version_9_SOURCES = version_9.c
+version_9_OBJECTS = version_9.$(OBJEXT)
+version_9_LDADD = $(LDADD)
+version_9_DEPENDENCIES = ../src/libgetdata.la
+version_9_strict_SOURCES = version_9_strict.c
+version_9_strict_OBJECTS = version_9_strict.$(OBJEXT)
+version_9_strict_LDADD = $(LDADD)
+version_9_strict_DEPENDENCIES = ../src/libgetdata.la
+version_9_write_SOURCES = version_9_write.c
+version_9_write_OBJECTS = version_9_write.$(OBJEXT)
+version_9_write_LDADD = $(LDADD)
+version_9_write_DEPENDENCIES = ../src/libgetdata.la
 vlist_SOURCES = vlist.c
 vlist_OBJECTS = vlist.$(OBJEXT)
 vlist_LDADD = $(LDADD)
 vlist_DEPENDENCIES = ../src/libgetdata.la
+vlist_alias_SOURCES = vlist_alias.c
+vlist_alias_OBJECTS = vlist_alias.$(OBJEXT)
+vlist_alias_LDADD = $(LDADD)
+vlist_alias_DEPENDENCIES = ../src/libgetdata.la
+vlist_hidden_SOURCES = vlist_hidden.c
+vlist_hidden_OBJECTS = vlist_hidden.$(OBJEXT)
+vlist_hidden_LDADD = $(LDADD)
+vlist_hidden_DEPENDENCIES = ../src/libgetdata.la
 vlist_invalid_SOURCES = vlist_invalid.c
 vlist_invalid_OBJECTS = vlist_invalid.$(OBJEXT)
 vlist_invalid_LDADD = $(LDADD)
@@ -3264,6 +4275,10 @@ vlist_meta_SOURCES = vlist_meta.c
 vlist_meta_OBJECTS = vlist_meta.$(OBJEXT)
 vlist_meta_LDADD = $(LDADD)
 vlist_meta_DEPENDENCIES = ../src/libgetdata.la
+vlist_meta_hidden_SOURCES = vlist_meta_hidden.c
+vlist_meta_hidden_OBJECTS = vlist_meta_hidden.$(OBJEXT)
+vlist_meta_hidden_LDADD = $(LDADD)
+vlist_meta_hidden_DEPENDENCIES = ../src/libgetdata.la
 vlist_meta_invalid_SOURCES = vlist_meta_invalid.c
 vlist_meta_invalid_OBJECTS = vlist_meta_invalid.$(OBJEXT)
 vlist_meta_invalid_LDADD = $(LDADD)
@@ -3276,6 +4291,30 @@ xz_nframes_SOURCES = xz_nframes.c
 xz_nframes_OBJECTS = xz_nframes.$(OBJEXT)
 xz_nframes_LDADD = $(LDADD)
 xz_nframes_DEPENDENCIES = ../src/libgetdata.la
+zzip_data_SOURCES = zzip_data.c
+zzip_data_OBJECTS = zzip_data.$(OBJEXT)
+zzip_data_LDADD = $(LDADD)
+zzip_data_DEPENDENCIES = ../src/libgetdata.la
+zzip_get_SOURCES = zzip_get.c
+zzip_get_OBJECTS = zzip_get.$(OBJEXT)
+zzip_get_LDADD = $(LDADD)
+zzip_get_DEPENDENCIES = ../src/libgetdata.la
+zzip_get_get_SOURCES = zzip_get_get.c
+zzip_get_get_OBJECTS = zzip_get_get.$(OBJEXT)
+zzip_get_get_LDADD = $(LDADD)
+zzip_get_get_DEPENDENCIES = ../src/libgetdata.la
+zzip_nframes_SOURCES = zzip_nframes.c
+zzip_nframes_OBJECTS = zzip_nframes.$(OBJEXT)
+zzip_nframes_LDADD = $(LDADD)
+zzip_nframes_DEPENDENCIES = ../src/libgetdata.la
+zzslim_get_SOURCES = zzslim_get.c
+zzslim_get_OBJECTS = zzslim_get.$(OBJEXT)
+zzslim_get_LDADD = $(LDADD)
+zzslim_get_DEPENDENCIES = ../src/libgetdata.la
+zzslim_nframes_SOURCES = zzslim_nframes.c
+zzslim_nframes_OBJECTS = zzslim_nframes.$(OBJEXT)
+zzslim_nframes_LDADD = $(LDADD)
+zzslim_nframes_DEPENDENCIES = ../src/libgetdata.la
 DEFAULT_INCLUDES = -I. at am__isrc@ -I$(top_builddir)/src
 depcomp = $(SHELL) $(top_srcdir)/depcomp
 am__depfiles_maybe = depfiles
@@ -3289,34 +4328,45 @@ CCLD = $(CC)
 LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
 	--mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \
 	$(LDFLAGS) -o $@
-SOURCES = add.c add_bit.c add_bit_bitnum.c add_bit_bitsize.c \
+SOURCES = add.c add_affix.c add_alias.c add_alias_affix.c \
+	add_alias_meta.c add_bit.c add_bit_bitnum.c add_bit_bitsize.c \
 	add_bit_invalid.c add_bit_numbits.c add_carray.c add_clincom.c \
 	add_code.c add_const.c add_cpolynom.c add_crecip.c \
 	add_crecip89.c add_divide.c add_divide_invalid.c \
 	add_duplicate.c add_format.c add_invalid.c add_lincom.c \
-	add_lincom_invalid.c add_lincom_nfields.c add_linterp.c \
-	add_linterp_invalid.c add_multiply.c add_multiply_invalid.c \
-	add_phase.c add_phase_invalid.c add_polynom.c add_protect.c \
-	add_raw.c add_raw_include.c add_raw_invalid.c add_raw_spf.c \
-	add_raw_type.c add_rdonly.c add_recip.c add_sbit.c \
-	add_scalar.c add_sort.c add_spec.c add_spec_directive.c \
-	add_spec_invalid.c add_spec_meta.c add_string.c add_type.c \
+	add_lincom_affix.c add_lincom_invalid.c add_lincom_nfields.c \
+	add_linterp.c add_linterp_invalid.c add_meta.c \
+	add_meta_alias.c add_mplex.c add_mplex_val.c add_multiply.c \
+	add_multiply_invalid.c add_phase.c add_phase_invalid.c \
+	add_polynom.c add_protect.c add_raw.c add_raw_include.c \
+	add_raw_invalid.c add_raw_spf.c add_raw_type.c add_rdonly.c \
+	add_recip.c add_resolv.c add_sbit.c add_scalar.c \
+	add_scalar_carray.c add_scalar_carray_bad.c add_sort.c \
+	add_spec.c add_spec_directive.c add_spec_invalid.c \
+	add_spec_meta.c add_spec_resolv.c add_string.c \
+	add_string_affix.c add_type.c add_window.c add_window_op.c \
+	alias_list.c alias_list_alias.c alias_list_missing.c \
+	alias_num.c alias_num_alias.c alias_num_missing.c \
+	alias_target.c alias_target_alias.c alias_target_missing.c \
 	alter_bit_bitnum.c alter_bit_numbits.c alter_carray_len.c \
-	alter_carray_type.c alter_const.c alter_cpolynom.c \
-	alter_crecip.c alter_crecip89.c alter_crecip_zero.c \
-	alter_divide.c alter_entry.c alter_entry_recode.c \
+	alter_carray_type.c alter_const.c alter_const_c2r.c \
+	alter_cpolynom.c alter_crecip.c alter_crecip89.c \
+	alter_crecip_zero.c alter_divide.c alter_entry.c \
+	alter_entry_affix.c alter_entry_hidden.c alter_entry_recode.c \
 	alter_entry_scalar2a.c alter_entry_scalar2n.c \
 	alter_entry_scalar3.c alter_entry_scalar4.c alter_lincom_23.c \
-	alter_lincom_32.c alter_lincom_input.c alter_lincom_offset.c \
-	alter_lincom_slope.c alter_linterp.c alter_linterp_move.c \
-	alter_mspec.c alter_multiply.c alter_phase.c \
+	alter_lincom_32.c alter_lincom_affix.c alter_lincom_input.c \
+	alter_lincom_offset.c alter_lincom_slope.c alter_linterp.c \
+	alter_linterp_move.c alter_mplex.c alter_mspec.c \
+	alter_mspec_affix.c alter_multiply.c alter_phase.c \
 	alter_polynom_coeff.c alter_polynom_input.c \
 	alter_polynom_ord.c alter_raw_spf.c alter_raw_type.c \
-	alter_recip.c alter_recip_zero.c alter_spec.c \
-	alter_spec_meta.c ascii_get.c ascii_get_get.c ascii_nframes.c \
-	ascii_put.c bof.c bof_lincom.c bof_phase.c bzip_get.c \
-	bzip_get_get.c bzip_move_from.c bzip_nframes.c close.c \
-	close_bad.c close_discard.c close_null.c \
+	alter_recip.c alter_recip_zero.c alter_scalar_affix.c \
+	alter_spec.c alter_spec_affix.c alter_spec_meta.c \
+	alter_window.c ascii_add.c ascii_get.c ascii_get_get.c \
+	ascii_nframes.c ascii_put.c bof.c bof_lincom.c bof_phase.c \
+	bzip_get.c bzip_get_get.c bzip_move_from.c bzip_nframes.c \
+	close.c close_bad.c close_discard.c close_null.c \
 	convert_complex128_complex64.c convert_complex128_float64.c \
 	convert_complex128_int64.c convert_complex128_uint64.c \
 	convert_complex64_complex128.c convert_complex64_float64.c \
@@ -3377,28 +4427,39 @@ SOURCES = add.c add_bit.c add_bit_bitnum.c add_bit_bitsize.c \
 	convert_uint8_int8.c convert_uint8_uint16.c \
 	convert_uint8_uint32.c convert_uint8_uint64.c creat.c \
 	creat_excl.c creat_rdonly.c cvlist.c cvlist_array.c \
-	cvlist_array_meta.c cvlist_invalid.c cvlist_meta.c \
-	cvlist_meta_invalid.c del.c del_carray.c del_carray_deref.c \
-	del_const.c del_const_deref.c del_const_force.c del_data.c \
-	del_derived.c del_derived_force.c del_meta.c del_meta_force.c \
-	dfes_bit.c dfes_divide.c dfes_lincom.c dfes_linterp.c \
-	dfes_multiply.c dfes_null.c dfes_phase.c dfes_raw.c \
-	dfes_recip.c dfes_zero.c encode_alter.c encode_get.c \
-	encode_move.c endian_alter.c endian_get.c endian_move.c \
-	entry_bad_code.c entry_bit.c entry_bit_scalar.c \
-	entry_invalid.c entry_lincom.c entry_lincom_scalar.c \
-	entry_linterp.c entry_multiply.c entry_phase.c \
-	entry_phase_scalar.c entry_polynom.c entry_polynom_scalar.c \
-	entry_raw.c entry_raw_scalar.c entry_raw_scalar_code.c \
-	entry_raw_scalar_type.c entry_scalar_repr.c entry_type.c eof.c \
-	eof_index.c eof_lincom.c eof_phase.c error.c error_error.c \
-	error_short.c file.c file_code.c file_type.c flist.c \
-	flist_invalid.c flist_meta.c flist_meta_invalid.c flist_type.c \
-	flist_type_invalid.c flist_type_meta.c \
+	cvlist_array_hidden.c cvlist_array_meta.c \
+	cvlist_array_meta_hidden.c cvlist_hidden.c cvlist_invalid.c \
+	cvlist_meta.c cvlist_meta_hidden.c cvlist_meta_invalid.c del.c \
+	del_carray.c del_carray_deref.c del_const.c del_const_deref.c \
+	del_const_force.c del_data.c del_derived.c del_derived_after.c \
+	del_derived_force.c del_meta.c del_meta_force.c desync.c \
+	desync_flush.c desync_reopen.c desync_reopen_inv.c dfes_bit.c \
+	dfes_divide.c dfes_lincom.c dfes_linterp.c dfes_multiply.c \
+	dfes_null.c dfes_phase.c dfes_raw.c dfes_recip.c dfes_zero.c \
+	elist_alias.c elist_hidden.c elist_noalias.c elist_scalar.c \
+	encode_alter.c encode_get.c encode_move.c endian_alter.c \
+	endian_alter_sie.c endian_get.c endian_move.c entry_bad_code.c \
+	entry_bit.c entry_bit_scalar.c entry_divide.c entry_invalid.c \
+	entry_lincom.c entry_lincom_scalar.c entry_linterp.c \
+	entry_mplex.c entry_mplex_scalar.c entry_multiply.c \
+	entry_phase.c entry_phase_scalar.c entry_polynom.c \
+	entry_polynom_scalar.c entry_raw.c entry_raw_scalar.c \
+	entry_raw_scalar_code.c entry_raw_scalar_type.c entry_recip.c \
+	entry_scalar_repr.c entry_type.c entry_type_alias.c \
+	entry_window.c entry_window_scalar.c eof.c eof_index.c \
+	eof_lincom.c eof_phase.c error.c error_error.c error_num.c \
+	error_short.c error_verbose.c error_verbose_prefix.c file.c \
+	file_code.c file_type.c flist.c flist_hidden.c flist_invalid.c \
+	flist_meta.c flist_meta_hidden.c flist_meta_invalid.c \
+	flist_type.c flist_type_hidden.c flist_type_invalid.c \
+	flist_type_meta.c flist_type_meta_hidden.c \
 	flist_type_meta_invalid.c flush.c flush_all.c flush_bad_code.c \
-	flush_invalid.c flush_meta.c flush_spec.c foffs_alter.c \
-	foffs_get.c foffs_move.c fragment_index.c fragment_name.c \
-	fragment_name_oor.c get64.c get_bad_code.c get_bit.c \
+	flush_invalid.c flush_meta.c flush_ref.c flush_spec.c \
+	foffs_alter.c foffs_get.c foffs_move.c fragment_affix.c \
+	fragment_affix_alter.c fragment_affix_alter2.c \
+	fragment_affix_dup.c fragment_index.c fragment_index_alias.c \
+	fragment_name.c fragment_name_oor.c fragment_num.c \
+	fragment_parent.c get64.c get_affix.c get_bad_code.c get_bit.c \
 	get_carray.c get_carray_len.c get_carray_slice.c get_char.c \
 	get_clincom.c get_complex128.c get_complex64.c get_const.c \
 	get_const_complex.c get_const_repr.c get_cpolynom.c \
@@ -3410,61 +4471,95 @@ SOURCES = add.c add_bit.c add_bit_bitnum.c add_bit_bitsize.c \
 	get_endian_float32_big.c get_endian_float32_little.c \
 	get_endian_float64_arm.c get_endian_float64_big.c \
 	get_endian_float64_little.c get_ff.c get_float32.c \
-	get_float64.c get_foffs.c get_fs.c get_int16.c get_int32.c \
-	get_int64.c get_int8.c get_invalid.c get_lincom1.c \
-	get_lincom2.c get_lincom3.c get_lincom_noin.c get_lincom_non.c \
-	get_linterp.c get_linterp_noin.c get_linterp_notab.c \
-	get_linterp_sort.c get_multiply.c get_multiply_noin.c \
+	get_float64.c get_foffs.c get_fs.c get_here.c get_here_foffs.c \
+	get_heres.c get_int16.c get_int32.c get_int64.c get_int8.c \
+	get_invalid.c get_lincom1.c get_lincom2.c get_lincom3.c \
+	get_lincom_noin.c get_lincom_non.c get_lincom_null.c \
+	get_lincom_spf.c get_linterp.c get_linterp_noin.c \
+	get_linterp_notab.c get_linterp_sort.c get_mplex.c \
+	get_mplex_bof.c get_mplex_lb.c get_mplex_lball.c \
+	get_mplex_nolb.c get_multiply.c get_multiply_noin.c \
 	get_nonexistent.c get_null.c get_off64.c get_phase.c \
-	get_polynom.c get_polynom_noin.c get_recip.c get_recip_const.c \
-	get_recurse.c get_sbit.c get_sf.c get_ss.c get_type.c \
-	get_uint16.c get_uint32.c get_uint64.c get_zero.c \
-	global_name.c global_ref.c global_ref_empty.c global_ref_set.c \
-	gzip_get.c gzip_get_get.c gzip_move_from.c gzip_nframes.c \
-	header_complex.c include.c include_accmode.c include_auto.c \
-	include_cb.c include_creat.c include_ignore.c include_index.c \
-	include_invalid.c include_nonexistent.c include_pc.c \
-	include_ref.c include_syntax.c index.c index_domain.c \
-	index_range.c legacy_get.c legacy_get_put.c legacy_get_rofs.c \
-	legacy_nframes.c legacy_nonexistent.c legacy_put.c \
-	legacy_spf.c lzma_get.c lzma_nframes.c madd.c madd_bit.c \
-	madd_bit_invalid.c madd_carray.c madd_clincom.c madd_const.c \
-	madd_cpolynom.c madd_crecip.c madd_crecip89.c madd_divide.c \
-	madd_lincom.c madd_lincom_invalid.c madd_linterp.c \
-	madd_linterp_invalid.c madd_multiply.c madd_multiply_invalid.c \
+	get_phase_affix.c get_polynom.c get_polynom_noin.c get_recip.c \
+	get_recip_const.c get_recurse.c get_rofs.c get_sbit.c get_sf.c \
+	get_ss.c get_type.c get_uint16.c get_uint32.c get_uint64.c \
+	get_window.c get_window_clr.c get_window_ge.c get_window_gt.c \
+	get_window_le.c get_window_lt.c get_window_ne.c \
+	get_window_set.c get_zero.c global_flags.c global_name.c \
+	global_ref.c global_ref_empty.c global_ref_set.c gzip_add.c \
+	gzip_get.c gzip_get_get.c gzip_get_get2.c gzip_get_put.c \
+	gzip_move_from.c gzip_move_to.c gzip_nframes.c gzip_put.c \
+	gzip_put_get.c header_complex.c hide.c hide_hidden.c \
+	hide_unhide.c include.c include_accmode.c include_affix.c \
+	include_auto.c include_cb.c include_creat.c include_ignore.c \
+	include_index.c include_invalid.c include_nonexistent.c \
+	include_pc.c include_ref.c include_sub.c include_syntax.c \
+	index.c index_domain.c index_range.c legacy_get.c \
+	legacy_get_put.c legacy_get_rofs.c legacy_nframes.c \
+	legacy_nonexistent.c legacy_put.c legacy_spf.c lzma_get.c \
+	lzma_nframes.c madd.c madd_affix.c madd_alias.c \
+	madd_alias_affix.c madd_bit.c madd_bit_invalid.c madd_carray.c \
+	madd_clincom.c madd_const.c madd_cpolynom.c madd_crecip.c \
+	madd_crecip89.c madd_divide.c madd_index.c madd_lincom.c \
+	madd_lincom_invalid.c madd_linterp.c madd_linterp_invalid.c \
+	madd_mplex.c madd_multiply.c madd_multiply_invalid.c \
 	madd_phase.c madd_phase_invalid.c madd_polynom.c madd_recip.c \
 	madd_sbit.c madd_spec.c madd_spec_directive.c \
-	madd_spec_invalid.c madd_string.c move.c move_data_enc_ar.c \
-	move_data_enc_ra.c move_data_endian.c move_data_foffs.c \
-	move_data_nop.c move_index.c move_meta.c move_protect.c \
-	move_subdir.c name.c name_move.c nfields.c nfields_invalid.c \
-	nfields_type.c nfields_type_invalid.c nfragments.c nframes.c \
+	madd_spec_invalid.c madd_spec_resolv.c madd_string.c \
+	madd_window.c move.c move_affix.c move_affix_dup.c \
+	move_alias.c move_data_enc_ar.c move_data_enc_ra.c \
+	move_data_endian.c move_data_foffs.c move_data_nop.c \
+	move_index.c move_meta.c move_protect.c move_subdir.c name.c \
+	name_affix.c name_affix_bad.c name_alias.c name_dup.c \
+	name_move.c name_move_alias.c name_updb.c name_updb_alias.c \
+	name_updb_const.c name_updb_const_alias.c nentries_alias.c \
+	nentries_hidden.c nentries_noalias.c nentries_scalar.c \
+	nfields.c nfields_hidden.c nfields_invalid.c nfields_type.c \
+	nfields_type_hidden.c nfields_type_invalid.c nfields_vector.c \
+	nfields_vector_hidden.c nfields_vector_invalid.c nframes.c \
 	nframes64.c nframes_empty.c nframes_invalid.c nframes_off64.c \
-	nframes_spf.c nmeta.c nmeta_invalid.c nmeta_parent.c \
-	nmeta_type.c nmeta_type_invalid.c nmeta_type_parent.c \
-	nmeta_vectors.c nmeta_vectors_del.c nmeta_vectors_invalid.c \
-	nmeta_vectors_parent.c nvectors.c nvectors_invalid.c open.c \
-	open_cb_abort.c open_cb_cont.c open_cb_ignore.c \
+	nframes_spf.c nmeta.c nmeta_hidden.c nmeta_invalid.c \
+	nmeta_parent.c nmeta_type.c nmeta_type_hidden.c \
+	nmeta_type_invalid.c nmeta_type_parent.c nmeta_vectors.c \
+	nmeta_vectors_del.c nmeta_vectors_hidden.c \
+	nmeta_vectors_invalid.c nmeta_vectors_parent.c open.c \
+	open_abs.c open_cb_abort.c open_cb_cont.c open_cb_ignore.c \
 	open_cb_invalid.c open_cb_rescan.c open_eaccess.c \
-	open_nonexistent.c open_notdirfile.c parent.c parse_badline.c \
+	open_nonexistent.c open_notdirfile.c open_sym_a.c \
+	open_sym_al.c open_sym_at.c open_sym_c.c open_sym_cl.c \
+	open_sym_ct.c open_sym_p.c open_sym_pl.c open_sym_pt.c \
+	parse_alias.c parse_alias_code.c parse_alias_dup.c \
+	parse_alias_meta.c parse_alias_missing.c parse_badline.c \
 	parse_bit.c parse_bit4.c parse_bit_bitnum.c \
 	parse_bit_bitsize.c parse_bit_ncols.c parse_bit_numbits.c \
 	parse_bit_scalar.c parse_carray.c parse_carray_long.c \
-	parse_const.c parse_const_ncols.c parse_divide.c \
-	parse_duplicate.c parse_duplicate_ignore.c parse_endian_bad.c \
-	parse_endian_big.c parse_endian_force.c parse_endian_little.c \
+	parse_const.c parse_const_complex.c parse_const_ncols.c \
+	parse_divide.c parse_double.c parse_duplicate.c \
+	parse_duplicate_ignore.c parse_endian_bad.c parse_endian_big.c \
+	parse_endian_force.c parse_endian_little.c \
 	parse_endian_slash.c parse_eol.c parse_foffs.c \
-	parse_foffs_include.c parse_foffs_slash.c parse_include.c \
+	parse_foffs_include.c parse_foffs_slash.c parse_hidden.c \
+	parse_hidden_field.c parse_hidden_meta.c parse_include.c \
 	parse_include_absolute.c parse_include_absrel.c \
-	parse_include_nonexistent.c parse_include_relabs.c \
-	parse_include_relrel.c parse_include_slash.c parse_index.c \
-	parse_lincom.c parse_lincom_ncols1.c parse_lincom_ncols2.c \
+	parse_include_affix_ref.c parse_include_dir.c \
+	parse_include_loop.c parse_include_nonexistent.c \
+	parse_include_prefix.c parse_include_prefix_dup.c \
+	parse_include_preprefix.c parse_include_ref.c \
+	parse_include_relabs.c parse_include_relrel.c \
+	parse_include_slash.c parse_include_suffix.c \
+	parse_include_sufsuffix.c parse_index.c parse_lincom.c \
+	parse_lincom_ncols1.c parse_lincom_ncols2.c \
 	parse_lincom_nfields.c parse_lincom_nofields.c \
 	parse_lincom_non.c parse_lincom_non_ncols.c \
 	parse_lincom_scalar.c parse_linterp.c parse_linterp_ncols.c \
-	parse_meta.c parse_meta_implicit.c parse_meta_implicit2.c \
-	parse_meta_index.c parse_meta_index2.c parse_meta_parent.c \
-	parse_meta_raw.c parse_multiply.c parse_multiply_ncols.c \
+	parse_malias.c parse_malias_dup.c parse_malias_meta.c \
+	parse_meta.c parse_meta_affix.c parse_meta_alias.c \
+	parse_meta_implicit.c parse_meta_implicit2.c \
+	parse_meta_implicit_affix.c parse_meta_index.c \
+	parse_meta_index2.c parse_meta_jump.c parse_meta_malias.c \
+	parse_meta_meta.c parse_meta_parent.c parse_meta_raw.c \
+	parse_mplex.c parse_mplex_ncols.c parse_mplex_nomax.c \
+	parse_mplex_scalar.c parse_multiply.c parse_multiply_ncols.c \
 	parse_name.c parse_name_dot.c parse_name_ext.c \
 	parse_name_pedantic.c parse_ncols.c parse_phase.c \
 	parse_phase_ncols.c parse_phase_scalar.c parse_polynom.c \
@@ -3476,74 +4571,99 @@ SOURCES = add.c add_bit.c add_bit_bitnum.c add_bit_bitsize.c \
 	parse_raw_scalar.c parse_raw_spf.c parse_raw_type.c \
 	parse_recip.c parse_ref.c parse_ref_nonexistent.c parse_sbit.c \
 	parse_sort.c parse_string.c parse_string_ncols.c \
-	parse_string_null.c parse_version.c parse_version_include.c \
-	parse_version_permissive.c parse_version_slash.c \
-	parse_whitespace.c protect_alter.c protect_get.c put64.c \
-	put_bad_code.c put_bit.c put_bof.c put_carray.c \
-	put_carray_slice.c put_char.c put_complex128.c put_complex64.c \
-	put_const.c put_const_protect.c put_divide.c put_endian16.c \
-	put_endian32.c put_endian64.c put_endian8.c \
-	put_endian_complex128_arm.c put_endian_complex128_big.c \
-	put_endian_complex128_little.c put_endian_complex64_arm.c \
-	put_endian_complex64_big.c put_endian_complex64_little.c \
-	put_endian_float32_arm.c put_endian_float32_big.c \
-	put_endian_float32_little.c put_endian_float64_arm.c \
-	put_endian_float64_big.c put_endian_float64_little.c put_ff.c \
-	put_float32.c put_float64.c put_foffs.c put_fs.c put_int16.c \
-	put_int32.c put_int64.c put_int8.c put_invalid.c put_lincom1.c \
-	put_lincom2.c put_lincom_noin.c put_linterp.c \
+	parse_string_null.c parse_version.c parse_version_89.c \
+	parse_version_98.c parse_version_include.c parse_version_p8.c \
+	parse_version_p9.c parse_version_permissive.c \
+	parse_version_slash.c parse_whitespace.c parse_window.c \
+	parse_window_ncols.c parse_window_op.c parse_window_scalar.c \
+	protect_alter.c protect_get.c put64.c put_bad_code.c put_bit.c \
+	put_bof.c put_carray.c put_carray_slice.c put_char.c \
+	put_complex128.c put_complex64.c put_const.c \
+	put_const_protect.c put_divide.c put_endian16.c put_endian32.c \
+	put_endian64.c put_endian8.c put_endian_complex128_arm.c \
+	put_endian_complex128_big.c put_endian_complex128_little.c \
+	put_endian_complex64_arm.c put_endian_complex64_big.c \
+	put_endian_complex64_little.c put_endian_float32_arm.c \
+	put_endian_float32_big.c put_endian_float32_little.c \
+	put_endian_float64_arm.c put_endian_float64_big.c \
+	put_endian_float64_little.c put_ff.c put_float32.c \
+	put_float64.c put_foffs.c put_fs.c put_here.c put_heres.c \
+	put_int16.c put_int32.c put_int64.c put_int8.c put_invalid.c \
+	put_lincom1.c put_lincom2.c put_lincom_noin.c put_linterp.c \
 	put_linterp_noin.c put_linterp_nomono.c put_linterp_notab.c \
-	put_linterp_reverse.c put_multiply.c put_null.c put_off64.c \
-	put_phase.c put_phase_noin.c put_polynom1.c put_polynom2.c \
-	put_polynom_noin.c put_protect.c put_rdonly.c put_recip.c \
-	put_recurse.c put_repr.c put_rofs.c put_sbit.c put_sf.c \
-	put_ss.c put_string.c put_string_protect.c put_type.c \
-	put_uint16.c put_uint32.c put_uint64.c ref.c ref_none.c \
-	ref_two.c repr_a.c repr_float32.c repr_float64.c repr_i.c \
-	repr_int16.c repr_int32.c repr_int64.c repr_int8.c repr_m.c \
-	repr_r.c repr_real_a.c repr_real_i.c repr_real_m.c \
-	repr_real_r.c repr_uint16.c repr_uint32.c repr_uint64.c \
-	repr_uint8.c slim_get.c slim_nframes.c spf.c spf_divide.c \
-	spf_lincom.c spf_multiply.c spf_polynom.c spf_recip.c \
-	spf_recurse.c svlist.c svlist_invalid.c svlist_meta.c \
-	svlist_meta_invalid.c trunc.c trunc_rdonly.c trunc_rofs.c \
-	unclude.c unclude_del.c unclude_move.c version_0.c \
-	version_0_write.c version_1.c version_1_write.c version_2.c \
-	version_2_write.c version_3.c version_3_write.c version_4.c \
-	version_4_write.c version_5.c version_5_strict.c \
-	version_5_write.c version_6.c version_6_strict.c \
-	version_6_write.c version_7.c version_7_strict.c \
-	version_7_write.c version_8.c version_8_strict.c \
-	version_8_write.c vlist.c vlist_invalid.c vlist_meta.c \
-	vlist_meta_invalid.c xz_get.c xz_nframes.c
-DIST_SOURCES = add.c add_bit.c add_bit_bitnum.c add_bit_bitsize.c \
+	put_linterp_reverse.c put_mplex.c put_multiply.c put_null.c \
+	put_off64.c put_phase.c put_phase_noin.c put_polynom1.c \
+	put_polynom2.c put_polynom_noin.c put_protect.c put_rdonly.c \
+	put_recip.c put_recurse.c put_repr.c put_rofs.c put_sbit.c \
+	put_sf.c put_ss.c put_string.c put_string_protect.c put_type.c \
+	put_uint16.c put_uint32.c put_uint64.c put_window.c put_zero.c \
+	ref.c ref_none.c ref_two.c repr_a.c repr_float32.c \
+	repr_float64.c repr_i.c repr_int16.c repr_int32.c repr_int64.c \
+	repr_int8.c repr_m.c repr_r.c repr_real_a.c repr_real_i.c \
+	repr_real_m.c repr_real_r.c repr_uint16.c repr_uint32.c \
+	repr_uint64.c repr_uint8.c seek64.c seek_cur.c seek_end.c \
+	seek_foffs.c seek_neg.c seek_set.c sie_get_big.c \
+	sie_get_little.c sie_move_from.c sie_move_to.c \
+	sie_nframes_big.c sie_nframes_little.c sie_put_big.c \
+	sie_put_little.c slim_get.c slim_nframes.c spf.c spf_alias.c \
+	spf_alias_meta.c spf_alias_missing.c spf_divide.c spf_lincom.c \
+	spf_multiply.c spf_polynom.c spf_recip.c spf_recurse.c \
+	svlist.c svlist_hidden.c svlist_invalid.c svlist_meta.c \
+	svlist_meta_hidden.c svlist_meta_invalid.c table.c \
+	table_code.c table_type.c tell.c tell64.c tell_multidiv.c \
+	tok_arg.c tok_escape.c tok_quote.c trunc.c trunc_dir.c \
+	trunc_rdonly.c trunc_rofs.c trunc_truncsub.c unclude.c \
+	unclude_del.c unclude_move.c version_0.c version_0_write.c \
+	version_1.c version_1_write.c version_2.c version_2_write.c \
+	version_3.c version_3_write.c version_4.c version_4_write.c \
+	version_5.c version_5_strict.c version_5_write.c version_6.c \
+	version_6_strict.c version_6_write.c version_7.c \
+	version_7_strict.c version_7_write.c version_8.c \
+	version_8_strict.c version_8_write.c version_9.c \
+	version_9_strict.c version_9_write.c vlist.c vlist_alias.c \
+	vlist_hidden.c vlist_invalid.c vlist_meta.c \
+	vlist_meta_hidden.c vlist_meta_invalid.c xz_get.c xz_nframes.c \
+	zzip_data.c zzip_get.c zzip_get_get.c zzip_nframes.c \
+	zzslim_get.c zzslim_nframes.c
+DIST_SOURCES = add.c add_affix.c add_alias.c add_alias_affix.c \
+	add_alias_meta.c add_bit.c add_bit_bitnum.c add_bit_bitsize.c \
 	add_bit_invalid.c add_bit_numbits.c add_carray.c add_clincom.c \
 	add_code.c add_const.c add_cpolynom.c add_crecip.c \
 	add_crecip89.c add_divide.c add_divide_invalid.c \
 	add_duplicate.c add_format.c add_invalid.c add_lincom.c \
-	add_lincom_invalid.c add_lincom_nfields.c add_linterp.c \
-	add_linterp_invalid.c add_multiply.c add_multiply_invalid.c \
-	add_phase.c add_phase_invalid.c add_polynom.c add_protect.c \
-	add_raw.c add_raw_include.c add_raw_invalid.c add_raw_spf.c \
-	add_raw_type.c add_rdonly.c add_recip.c add_sbit.c \
-	add_scalar.c add_sort.c add_spec.c add_spec_directive.c \
-	add_spec_invalid.c add_spec_meta.c add_string.c add_type.c \
+	add_lincom_affix.c add_lincom_invalid.c add_lincom_nfields.c \
+	add_linterp.c add_linterp_invalid.c add_meta.c \
+	add_meta_alias.c add_mplex.c add_mplex_val.c add_multiply.c \
+	add_multiply_invalid.c add_phase.c add_phase_invalid.c \
+	add_polynom.c add_protect.c add_raw.c add_raw_include.c \
+	add_raw_invalid.c add_raw_spf.c add_raw_type.c add_rdonly.c \
+	add_recip.c add_resolv.c add_sbit.c add_scalar.c \
+	add_scalar_carray.c add_scalar_carray_bad.c add_sort.c \
+	add_spec.c add_spec_directive.c add_spec_invalid.c \
+	add_spec_meta.c add_spec_resolv.c add_string.c \
+	add_string_affix.c add_type.c add_window.c add_window_op.c \
+	alias_list.c alias_list_alias.c alias_list_missing.c \
+	alias_num.c alias_num_alias.c alias_num_missing.c \
+	alias_target.c alias_target_alias.c alias_target_missing.c \
 	alter_bit_bitnum.c alter_bit_numbits.c alter_carray_len.c \
-	alter_carray_type.c alter_const.c alter_cpolynom.c \
-	alter_crecip.c alter_crecip89.c alter_crecip_zero.c \
-	alter_divide.c alter_entry.c alter_entry_recode.c \
+	alter_carray_type.c alter_const.c alter_const_c2r.c \
+	alter_cpolynom.c alter_crecip.c alter_crecip89.c \
+	alter_crecip_zero.c alter_divide.c alter_entry.c \
+	alter_entry_affix.c alter_entry_hidden.c alter_entry_recode.c \
 	alter_entry_scalar2a.c alter_entry_scalar2n.c \
 	alter_entry_scalar3.c alter_entry_scalar4.c alter_lincom_23.c \
-	alter_lincom_32.c alter_lincom_input.c alter_lincom_offset.c \
-	alter_lincom_slope.c alter_linterp.c alter_linterp_move.c \
-	alter_mspec.c alter_multiply.c alter_phase.c \
+	alter_lincom_32.c alter_lincom_affix.c alter_lincom_input.c \
+	alter_lincom_offset.c alter_lincom_slope.c alter_linterp.c \
+	alter_linterp_move.c alter_mplex.c alter_mspec.c \
+	alter_mspec_affix.c alter_multiply.c alter_phase.c \
 	alter_polynom_coeff.c alter_polynom_input.c \
 	alter_polynom_ord.c alter_raw_spf.c alter_raw_type.c \
-	alter_recip.c alter_recip_zero.c alter_spec.c \
-	alter_spec_meta.c ascii_get.c ascii_get_get.c ascii_nframes.c \
-	ascii_put.c bof.c bof_lincom.c bof_phase.c bzip_get.c \
-	bzip_get_get.c bzip_move_from.c bzip_nframes.c close.c \
-	close_bad.c close_discard.c close_null.c \
+	alter_recip.c alter_recip_zero.c alter_scalar_affix.c \
+	alter_spec.c alter_spec_affix.c alter_spec_meta.c \
+	alter_window.c ascii_add.c ascii_get.c ascii_get_get.c \
+	ascii_nframes.c ascii_put.c bof.c bof_lincom.c bof_phase.c \
+	bzip_get.c bzip_get_get.c bzip_move_from.c bzip_nframes.c \
+	close.c close_bad.c close_discard.c close_null.c \
 	convert_complex128_complex64.c convert_complex128_float64.c \
 	convert_complex128_int64.c convert_complex128_uint64.c \
 	convert_complex64_complex128.c convert_complex64_float64.c \
@@ -3604,28 +4724,39 @@ DIST_SOURCES = add.c add_bit.c add_bit_bitnum.c add_bit_bitsize.c \
 	convert_uint8_int8.c convert_uint8_uint16.c \
 	convert_uint8_uint32.c convert_uint8_uint64.c creat.c \
 	creat_excl.c creat_rdonly.c cvlist.c cvlist_array.c \
-	cvlist_array_meta.c cvlist_invalid.c cvlist_meta.c \
-	cvlist_meta_invalid.c del.c del_carray.c del_carray_deref.c \
-	del_const.c del_const_deref.c del_const_force.c del_data.c \
-	del_derived.c del_derived_force.c del_meta.c del_meta_force.c \
-	dfes_bit.c dfes_divide.c dfes_lincom.c dfes_linterp.c \
-	dfes_multiply.c dfes_null.c dfes_phase.c dfes_raw.c \
-	dfes_recip.c dfes_zero.c encode_alter.c encode_get.c \
-	encode_move.c endian_alter.c endian_get.c endian_move.c \
-	entry_bad_code.c entry_bit.c entry_bit_scalar.c \
-	entry_invalid.c entry_lincom.c entry_lincom_scalar.c \
-	entry_linterp.c entry_multiply.c entry_phase.c \
-	entry_phase_scalar.c entry_polynom.c entry_polynom_scalar.c \
-	entry_raw.c entry_raw_scalar.c entry_raw_scalar_code.c \
-	entry_raw_scalar_type.c entry_scalar_repr.c entry_type.c eof.c \
-	eof_index.c eof_lincom.c eof_phase.c error.c error_error.c \
-	error_short.c file.c file_code.c file_type.c flist.c \
-	flist_invalid.c flist_meta.c flist_meta_invalid.c flist_type.c \
-	flist_type_invalid.c flist_type_meta.c \
+	cvlist_array_hidden.c cvlist_array_meta.c \
+	cvlist_array_meta_hidden.c cvlist_hidden.c cvlist_invalid.c \
+	cvlist_meta.c cvlist_meta_hidden.c cvlist_meta_invalid.c del.c \
+	del_carray.c del_carray_deref.c del_const.c del_const_deref.c \
+	del_const_force.c del_data.c del_derived.c del_derived_after.c \
+	del_derived_force.c del_meta.c del_meta_force.c desync.c \
+	desync_flush.c desync_reopen.c desync_reopen_inv.c dfes_bit.c \
+	dfes_divide.c dfes_lincom.c dfes_linterp.c dfes_multiply.c \
+	dfes_null.c dfes_phase.c dfes_raw.c dfes_recip.c dfes_zero.c \
+	elist_alias.c elist_hidden.c elist_noalias.c elist_scalar.c \
+	encode_alter.c encode_get.c encode_move.c endian_alter.c \
+	endian_alter_sie.c endian_get.c endian_move.c entry_bad_code.c \
+	entry_bit.c entry_bit_scalar.c entry_divide.c entry_invalid.c \
+	entry_lincom.c entry_lincom_scalar.c entry_linterp.c \
+	entry_mplex.c entry_mplex_scalar.c entry_multiply.c \
+	entry_phase.c entry_phase_scalar.c entry_polynom.c \
+	entry_polynom_scalar.c entry_raw.c entry_raw_scalar.c \
+	entry_raw_scalar_code.c entry_raw_scalar_type.c entry_recip.c \
+	entry_scalar_repr.c entry_type.c entry_type_alias.c \
+	entry_window.c entry_window_scalar.c eof.c eof_index.c \
+	eof_lincom.c eof_phase.c error.c error_error.c error_num.c \
+	error_short.c error_verbose.c error_verbose_prefix.c file.c \
+	file_code.c file_type.c flist.c flist_hidden.c flist_invalid.c \
+	flist_meta.c flist_meta_hidden.c flist_meta_invalid.c \
+	flist_type.c flist_type_hidden.c flist_type_invalid.c \
+	flist_type_meta.c flist_type_meta_hidden.c \
 	flist_type_meta_invalid.c flush.c flush_all.c flush_bad_code.c \
-	flush_invalid.c flush_meta.c flush_spec.c foffs_alter.c \
-	foffs_get.c foffs_move.c fragment_index.c fragment_name.c \
-	fragment_name_oor.c get64.c get_bad_code.c get_bit.c \
+	flush_invalid.c flush_meta.c flush_ref.c flush_spec.c \
+	foffs_alter.c foffs_get.c foffs_move.c fragment_affix.c \
+	fragment_affix_alter.c fragment_affix_alter2.c \
+	fragment_affix_dup.c fragment_index.c fragment_index_alias.c \
+	fragment_name.c fragment_name_oor.c fragment_num.c \
+	fragment_parent.c get64.c get_affix.c get_bad_code.c get_bit.c \
 	get_carray.c get_carray_len.c get_carray_slice.c get_char.c \
 	get_clincom.c get_complex128.c get_complex64.c get_const.c \
 	get_const_complex.c get_const_repr.c get_cpolynom.c \
@@ -3637,61 +4768,95 @@ DIST_SOURCES = add.c add_bit.c add_bit_bitnum.c add_bit_bitsize.c \
 	get_endian_float32_big.c get_endian_float32_little.c \
 	get_endian_float64_arm.c get_endian_float64_big.c \
 	get_endian_float64_little.c get_ff.c get_float32.c \
-	get_float64.c get_foffs.c get_fs.c get_int16.c get_int32.c \
-	get_int64.c get_int8.c get_invalid.c get_lincom1.c \
-	get_lincom2.c get_lincom3.c get_lincom_noin.c get_lincom_non.c \
-	get_linterp.c get_linterp_noin.c get_linterp_notab.c \
-	get_linterp_sort.c get_multiply.c get_multiply_noin.c \
+	get_float64.c get_foffs.c get_fs.c get_here.c get_here_foffs.c \
+	get_heres.c get_int16.c get_int32.c get_int64.c get_int8.c \
+	get_invalid.c get_lincom1.c get_lincom2.c get_lincom3.c \
+	get_lincom_noin.c get_lincom_non.c get_lincom_null.c \
+	get_lincom_spf.c get_linterp.c get_linterp_noin.c \
+	get_linterp_notab.c get_linterp_sort.c get_mplex.c \
+	get_mplex_bof.c get_mplex_lb.c get_mplex_lball.c \
+	get_mplex_nolb.c get_multiply.c get_multiply_noin.c \
 	get_nonexistent.c get_null.c get_off64.c get_phase.c \
-	get_polynom.c get_polynom_noin.c get_recip.c get_recip_const.c \
-	get_recurse.c get_sbit.c get_sf.c get_ss.c get_type.c \
-	get_uint16.c get_uint32.c get_uint64.c get_zero.c \
-	global_name.c global_ref.c global_ref_empty.c global_ref_set.c \
-	gzip_get.c gzip_get_get.c gzip_move_from.c gzip_nframes.c \
-	header_complex.c include.c include_accmode.c include_auto.c \
-	include_cb.c include_creat.c include_ignore.c include_index.c \
-	include_invalid.c include_nonexistent.c include_pc.c \
-	include_ref.c include_syntax.c index.c index_domain.c \
-	index_range.c legacy_get.c legacy_get_put.c legacy_get_rofs.c \
-	legacy_nframes.c legacy_nonexistent.c legacy_put.c \
-	legacy_spf.c lzma_get.c lzma_nframes.c madd.c madd_bit.c \
-	madd_bit_invalid.c madd_carray.c madd_clincom.c madd_const.c \
-	madd_cpolynom.c madd_crecip.c madd_crecip89.c madd_divide.c \
-	madd_lincom.c madd_lincom_invalid.c madd_linterp.c \
-	madd_linterp_invalid.c madd_multiply.c madd_multiply_invalid.c \
+	get_phase_affix.c get_polynom.c get_polynom_noin.c get_recip.c \
+	get_recip_const.c get_recurse.c get_rofs.c get_sbit.c get_sf.c \
+	get_ss.c get_type.c get_uint16.c get_uint32.c get_uint64.c \
+	get_window.c get_window_clr.c get_window_ge.c get_window_gt.c \
+	get_window_le.c get_window_lt.c get_window_ne.c \
+	get_window_set.c get_zero.c global_flags.c global_name.c \
+	global_ref.c global_ref_empty.c global_ref_set.c gzip_add.c \
+	gzip_get.c gzip_get_get.c gzip_get_get2.c gzip_get_put.c \
+	gzip_move_from.c gzip_move_to.c gzip_nframes.c gzip_put.c \
+	gzip_put_get.c header_complex.c hide.c hide_hidden.c \
+	hide_unhide.c include.c include_accmode.c include_affix.c \
+	include_auto.c include_cb.c include_creat.c include_ignore.c \
+	include_index.c include_invalid.c include_nonexistent.c \
+	include_pc.c include_ref.c include_sub.c include_syntax.c \
+	index.c index_domain.c index_range.c legacy_get.c \
+	legacy_get_put.c legacy_get_rofs.c legacy_nframes.c \
+	legacy_nonexistent.c legacy_put.c legacy_spf.c lzma_get.c \
+	lzma_nframes.c madd.c madd_affix.c madd_alias.c \
+	madd_alias_affix.c madd_bit.c madd_bit_invalid.c madd_carray.c \
+	madd_clincom.c madd_const.c madd_cpolynom.c madd_crecip.c \
+	madd_crecip89.c madd_divide.c madd_index.c madd_lincom.c \
+	madd_lincom_invalid.c madd_linterp.c madd_linterp_invalid.c \
+	madd_mplex.c madd_multiply.c madd_multiply_invalid.c \
 	madd_phase.c madd_phase_invalid.c madd_polynom.c madd_recip.c \
 	madd_sbit.c madd_spec.c madd_spec_directive.c \
-	madd_spec_invalid.c madd_string.c move.c move_data_enc_ar.c \
-	move_data_enc_ra.c move_data_endian.c move_data_foffs.c \
-	move_data_nop.c move_index.c move_meta.c move_protect.c \
-	move_subdir.c name.c name_move.c nfields.c nfields_invalid.c \
-	nfields_type.c nfields_type_invalid.c nfragments.c nframes.c \
+	madd_spec_invalid.c madd_spec_resolv.c madd_string.c \
+	madd_window.c move.c move_affix.c move_affix_dup.c \
+	move_alias.c move_data_enc_ar.c move_data_enc_ra.c \
+	move_data_endian.c move_data_foffs.c move_data_nop.c \
+	move_index.c move_meta.c move_protect.c move_subdir.c name.c \
+	name_affix.c name_affix_bad.c name_alias.c name_dup.c \
+	name_move.c name_move_alias.c name_updb.c name_updb_alias.c \
+	name_updb_const.c name_updb_const_alias.c nentries_alias.c \
+	nentries_hidden.c nentries_noalias.c nentries_scalar.c \
+	nfields.c nfields_hidden.c nfields_invalid.c nfields_type.c \
+	nfields_type_hidden.c nfields_type_invalid.c nfields_vector.c \
+	nfields_vector_hidden.c nfields_vector_invalid.c nframes.c \
 	nframes64.c nframes_empty.c nframes_invalid.c nframes_off64.c \
-	nframes_spf.c nmeta.c nmeta_invalid.c nmeta_parent.c \
-	nmeta_type.c nmeta_type_invalid.c nmeta_type_parent.c \
-	nmeta_vectors.c nmeta_vectors_del.c nmeta_vectors_invalid.c \
-	nmeta_vectors_parent.c nvectors.c nvectors_invalid.c open.c \
-	open_cb_abort.c open_cb_cont.c open_cb_ignore.c \
+	nframes_spf.c nmeta.c nmeta_hidden.c nmeta_invalid.c \
+	nmeta_parent.c nmeta_type.c nmeta_type_hidden.c \
+	nmeta_type_invalid.c nmeta_type_parent.c nmeta_vectors.c \
+	nmeta_vectors_del.c nmeta_vectors_hidden.c \
+	nmeta_vectors_invalid.c nmeta_vectors_parent.c open.c \
+	open_abs.c open_cb_abort.c open_cb_cont.c open_cb_ignore.c \
 	open_cb_invalid.c open_cb_rescan.c open_eaccess.c \
-	open_nonexistent.c open_notdirfile.c parent.c parse_badline.c \
+	open_nonexistent.c open_notdirfile.c open_sym_a.c \
+	open_sym_al.c open_sym_at.c open_sym_c.c open_sym_cl.c \
+	open_sym_ct.c open_sym_p.c open_sym_pl.c open_sym_pt.c \
+	parse_alias.c parse_alias_code.c parse_alias_dup.c \
+	parse_alias_meta.c parse_alias_missing.c parse_badline.c \
 	parse_bit.c parse_bit4.c parse_bit_bitnum.c \
 	parse_bit_bitsize.c parse_bit_ncols.c parse_bit_numbits.c \
 	parse_bit_scalar.c parse_carray.c parse_carray_long.c \
-	parse_const.c parse_const_ncols.c parse_divide.c \
-	parse_duplicate.c parse_duplicate_ignore.c parse_endian_bad.c \
-	parse_endian_big.c parse_endian_force.c parse_endian_little.c \
+	parse_const.c parse_const_complex.c parse_const_ncols.c \
+	parse_divide.c parse_double.c parse_duplicate.c \
+	parse_duplicate_ignore.c parse_endian_bad.c parse_endian_big.c \
+	parse_endian_force.c parse_endian_little.c \
 	parse_endian_slash.c parse_eol.c parse_foffs.c \
-	parse_foffs_include.c parse_foffs_slash.c parse_include.c \
+	parse_foffs_include.c parse_foffs_slash.c parse_hidden.c \
+	parse_hidden_field.c parse_hidden_meta.c parse_include.c \
 	parse_include_absolute.c parse_include_absrel.c \
-	parse_include_nonexistent.c parse_include_relabs.c \
-	parse_include_relrel.c parse_include_slash.c parse_index.c \
-	parse_lincom.c parse_lincom_ncols1.c parse_lincom_ncols2.c \
+	parse_include_affix_ref.c parse_include_dir.c \
+	parse_include_loop.c parse_include_nonexistent.c \
+	parse_include_prefix.c parse_include_prefix_dup.c \
+	parse_include_preprefix.c parse_include_ref.c \
+	parse_include_relabs.c parse_include_relrel.c \
+	parse_include_slash.c parse_include_suffix.c \
+	parse_include_sufsuffix.c parse_index.c parse_lincom.c \
+	parse_lincom_ncols1.c parse_lincom_ncols2.c \
 	parse_lincom_nfields.c parse_lincom_nofields.c \
 	parse_lincom_non.c parse_lincom_non_ncols.c \
 	parse_lincom_scalar.c parse_linterp.c parse_linterp_ncols.c \
-	parse_meta.c parse_meta_implicit.c parse_meta_implicit2.c \
-	parse_meta_index.c parse_meta_index2.c parse_meta_parent.c \
-	parse_meta_raw.c parse_multiply.c parse_multiply_ncols.c \
+	parse_malias.c parse_malias_dup.c parse_malias_meta.c \
+	parse_meta.c parse_meta_affix.c parse_meta_alias.c \
+	parse_meta_implicit.c parse_meta_implicit2.c \
+	parse_meta_implicit_affix.c parse_meta_index.c \
+	parse_meta_index2.c parse_meta_jump.c parse_meta_malias.c \
+	parse_meta_meta.c parse_meta_parent.c parse_meta_raw.c \
+	parse_mplex.c parse_mplex_ncols.c parse_mplex_nomax.c \
+	parse_mplex_scalar.c parse_multiply.c parse_multiply_ncols.c \
 	parse_name.c parse_name_dot.c parse_name_ext.c \
 	parse_name_pedantic.c parse_ncols.c parse_phase.c \
 	parse_phase_ncols.c parse_phase_scalar.c parse_polynom.c \
@@ -3703,46 +4868,65 @@ DIST_SOURCES = add.c add_bit.c add_bit_bitnum.c add_bit_bitsize.c \
 	parse_raw_scalar.c parse_raw_spf.c parse_raw_type.c \
 	parse_recip.c parse_ref.c parse_ref_nonexistent.c parse_sbit.c \
 	parse_sort.c parse_string.c parse_string_ncols.c \
-	parse_string_null.c parse_version.c parse_version_include.c \
-	parse_version_permissive.c parse_version_slash.c \
-	parse_whitespace.c protect_alter.c protect_get.c put64.c \
-	put_bad_code.c put_bit.c put_bof.c put_carray.c \
-	put_carray_slice.c put_char.c put_complex128.c put_complex64.c \
-	put_const.c put_const_protect.c put_divide.c put_endian16.c \
-	put_endian32.c put_endian64.c put_endian8.c \
-	put_endian_complex128_arm.c put_endian_complex128_big.c \
-	put_endian_complex128_little.c put_endian_complex64_arm.c \
-	put_endian_complex64_big.c put_endian_complex64_little.c \
-	put_endian_float32_arm.c put_endian_float32_big.c \
-	put_endian_float32_little.c put_endian_float64_arm.c \
-	put_endian_float64_big.c put_endian_float64_little.c put_ff.c \
-	put_float32.c put_float64.c put_foffs.c put_fs.c put_int16.c \
-	put_int32.c put_int64.c put_int8.c put_invalid.c put_lincom1.c \
-	put_lincom2.c put_lincom_noin.c put_linterp.c \
+	parse_string_null.c parse_version.c parse_version_89.c \
+	parse_version_98.c parse_version_include.c parse_version_p8.c \
+	parse_version_p9.c parse_version_permissive.c \
+	parse_version_slash.c parse_whitespace.c parse_window.c \
+	parse_window_ncols.c parse_window_op.c parse_window_scalar.c \
+	protect_alter.c protect_get.c put64.c put_bad_code.c put_bit.c \
+	put_bof.c put_carray.c put_carray_slice.c put_char.c \
+	put_complex128.c put_complex64.c put_const.c \
+	put_const_protect.c put_divide.c put_endian16.c put_endian32.c \
+	put_endian64.c put_endian8.c put_endian_complex128_arm.c \
+	put_endian_complex128_big.c put_endian_complex128_little.c \
+	put_endian_complex64_arm.c put_endian_complex64_big.c \
+	put_endian_complex64_little.c put_endian_float32_arm.c \
+	put_endian_float32_big.c put_endian_float32_little.c \
+	put_endian_float64_arm.c put_endian_float64_big.c \
+	put_endian_float64_little.c put_ff.c put_float32.c \
+	put_float64.c put_foffs.c put_fs.c put_here.c put_heres.c \
+	put_int16.c put_int32.c put_int64.c put_int8.c put_invalid.c \
+	put_lincom1.c put_lincom2.c put_lincom_noin.c put_linterp.c \
 	put_linterp_noin.c put_linterp_nomono.c put_linterp_notab.c \
-	put_linterp_reverse.c put_multiply.c put_null.c put_off64.c \
-	put_phase.c put_phase_noin.c put_polynom1.c put_polynom2.c \
-	put_polynom_noin.c put_protect.c put_rdonly.c put_recip.c \
-	put_recurse.c put_repr.c put_rofs.c put_sbit.c put_sf.c \
-	put_ss.c put_string.c put_string_protect.c put_type.c \
-	put_uint16.c put_uint32.c put_uint64.c ref.c ref_none.c \
-	ref_two.c repr_a.c repr_float32.c repr_float64.c repr_i.c \
-	repr_int16.c repr_int32.c repr_int64.c repr_int8.c repr_m.c \
-	repr_r.c repr_real_a.c repr_real_i.c repr_real_m.c \
-	repr_real_r.c repr_uint16.c repr_uint32.c repr_uint64.c \
-	repr_uint8.c slim_get.c slim_nframes.c spf.c spf_divide.c \
-	spf_lincom.c spf_multiply.c spf_polynom.c spf_recip.c \
-	spf_recurse.c svlist.c svlist_invalid.c svlist_meta.c \
-	svlist_meta_invalid.c trunc.c trunc_rdonly.c trunc_rofs.c \
-	unclude.c unclude_del.c unclude_move.c version_0.c \
-	version_0_write.c version_1.c version_1_write.c version_2.c \
-	version_2_write.c version_3.c version_3_write.c version_4.c \
-	version_4_write.c version_5.c version_5_strict.c \
-	version_5_write.c version_6.c version_6_strict.c \
-	version_6_write.c version_7.c version_7_strict.c \
-	version_7_write.c version_8.c version_8_strict.c \
-	version_8_write.c vlist.c vlist_invalid.c vlist_meta.c \
-	vlist_meta_invalid.c xz_get.c xz_nframes.c
+	put_linterp_reverse.c put_mplex.c put_multiply.c put_null.c \
+	put_off64.c put_phase.c put_phase_noin.c put_polynom1.c \
+	put_polynom2.c put_polynom_noin.c put_protect.c put_rdonly.c \
+	put_recip.c put_recurse.c put_repr.c put_rofs.c put_sbit.c \
+	put_sf.c put_ss.c put_string.c put_string_protect.c put_type.c \
+	put_uint16.c put_uint32.c put_uint64.c put_window.c put_zero.c \
+	ref.c ref_none.c ref_two.c repr_a.c repr_float32.c \
+	repr_float64.c repr_i.c repr_int16.c repr_int32.c repr_int64.c \
+	repr_int8.c repr_m.c repr_r.c repr_real_a.c repr_real_i.c \
+	repr_real_m.c repr_real_r.c repr_uint16.c repr_uint32.c \
+	repr_uint64.c repr_uint8.c seek64.c seek_cur.c seek_end.c \
+	seek_foffs.c seek_neg.c seek_set.c sie_get_big.c \
+	sie_get_little.c sie_move_from.c sie_move_to.c \
+	sie_nframes_big.c sie_nframes_little.c sie_put_big.c \
+	sie_put_little.c slim_get.c slim_nframes.c spf.c spf_alias.c \
+	spf_alias_meta.c spf_alias_missing.c spf_divide.c spf_lincom.c \
+	spf_multiply.c spf_polynom.c spf_recip.c spf_recurse.c \
+	svlist.c svlist_hidden.c svlist_invalid.c svlist_meta.c \
+	svlist_meta_hidden.c svlist_meta_invalid.c table.c \
+	table_code.c table_type.c tell.c tell64.c tell_multidiv.c \
+	tok_arg.c tok_escape.c tok_quote.c trunc.c trunc_dir.c \
+	trunc_rdonly.c trunc_rofs.c trunc_truncsub.c unclude.c \
+	unclude_del.c unclude_move.c version_0.c version_0_write.c \
+	version_1.c version_1_write.c version_2.c version_2_write.c \
+	version_3.c version_3_write.c version_4.c version_4_write.c \
+	version_5.c version_5_strict.c version_5_write.c version_6.c \
+	version_6_strict.c version_6_write.c version_7.c \
+	version_7_strict.c version_7_write.c version_8.c \
+	version_8_strict.c version_8_write.c version_9.c \
+	version_9_strict.c version_9_write.c vlist.c vlist_alias.c \
+	vlist_hidden.c vlist_invalid.c vlist_meta.c \
+	vlist_meta_hidden.c vlist_meta_invalid.c xz_get.c xz_nframes.c \
+	zzip_data.c zzip_get.c zzip_get_get.c zzip_nframes.c \
+	zzslim_get.c zzslim_nframes.c
+am__can_run_installinfo = \
+  case $$AM_UPDATE_INFO_DIR in \
+    n|no|NO) false;; \
+    *) (install-info --version) >/dev/null 2>&1;; \
+  esac
 ETAGS = etags
 CTAGS = ctags
 am__tty_colors = \
@@ -3756,10 +4940,13 @@ AUTOHEADER = @AUTOHEADER@
 AUTOMAKE = @AUTOMAKE@
 AWK = @AWK@
 BUILDCC = @BUILDCC@
-BUILD_DATE = @BUILD_DATE@
 BZIP2_CPPFLAGS = @BZIP2_CPPFLAGS@
 BZIP2_LDFLAGS = @BZIP2_LDFLAGS@
+BZIP2_LIBS = @BZIP2_LIBS@
 CC = @CC@
+CCAS = @CCAS@
+CCASDEPMODE = @CCASDEPMODE@
+CCASFLAGS = @CCASFLAGS@
 CCDEPMODE = @CCDEPMODE@
 CFLAGS = @CFLAGS@
 CPP = @CPP@
@@ -3775,6 +4962,7 @@ DEFINE_GD_NO_C99_API = @DEFINE_GD_NO_C99_API@
 DEFINE_gd_int16_t = @DEFINE_gd_int16_t@
 DEFINE_gd_int64_t = @DEFINE_gd_int64_t@
 DEFINE_gd_uint16_t = @DEFINE_gd_uint16_t@
+DEFINE_gd_uint64_t = @DEFINE_gd_uint64_t@
 DEFS = @DEFS@
 DEPDIR = @DEPDIR@
 DIFF = @DIFF@
@@ -3795,13 +4983,21 @@ FFLAGS = @FFLAGS@
 FGETDATA_VERSION = @FGETDATA_VERSION@
 FGREP = @FGREP@
 FLIBS = @FLIBS@
+GD_DIRSEP = @GD_DIRSEP@
+GD_FDIRSEP = @GD_FDIRSEP@
 GETDATAXX_VERSION = @GETDATAXX_VERSION@
+GETDATA_DEBUG = @GETDATA_DEBUG@
 GETDATA_IFACE_AGE = @GETDATA_IFACE_AGE@
 GETDATA_IFACE_VERSION = @GETDATA_IFACE_VERSION@
 GETDATA_IMPL_REVISION = @GETDATA_IMPL_REVISION@
+GETDATA_MAJOR = @GETDATA_MAJOR@
+GETDATA_MINOR = @GETDATA_MINOR@
+GETDATA_REVISION = @GETDATA_REVISION@
+GETDATA_VERSION_SUFFIX = @GETDATA_VERSION_SUFFIX@
 GREP = @GREP@
 GZIP_CPPFLAGS = @GZIP_CPPFLAGS@
 GZIP_LDFLAGS = @GZIP_LDFLAGS@
+GZIP_LIBS = @GZIP_LIBS@
 IDL = @IDL@
 IDL_CFLAGS = @IDL_CFLAGS@
 IDL_LIBS = @IDL_LIBS@
@@ -3824,8 +5020,13 @@ LTDLINCL = @LTDLINCL@
 LTLIBOBJS = @LTLIBOBJS@
 LZMA_CPPFLAGS = @LZMA_CPPFLAGS@
 LZMA_LDFLAGS = @LZMA_LDFLAGS@
+LZMA_LIBS = @LZMA_LIBS@
 MAKEINFO = @MAKEINFO@
 MANIFEST_TOOL = @MANIFEST_TOOL@
+MATLAB = @MATLAB@
+MATLABGETDATA_VERSION = @MATLABGETDATA_VERSION@
+MATLAB_CPPFLAGS = @MATLAB_CPPFLAGS@
+MEX = @MEX@
 MKDIR_P = @MKDIR_P@
 NM = @NM@
 NMEDIT = @NMEDIT@
@@ -3842,6 +5043,9 @@ PACKAGE_TARNAME = @PACKAGE_TARNAME@
 PACKAGE_URL = @PACKAGE_URL@
 PACKAGE_VERSION = @PACKAGE_VERSION@
 PATH_SEPARATOR = @PATH_SEPARATOR@
+PERL = @PERL@
+PERL_MAN3EXT = @PERL_MAN3EXT@
+PRINTF = @PRINTF@
 PRIVATE_LIBS = @PRIVATE_LIBS@
 PYTHON = @PYTHON@
 PYTHON_CPPFLAGS = @PYTHON_CPPFLAGS@
@@ -3853,8 +5057,12 @@ SET_MAKE = @SET_MAKE@
 SHELL = @SHELL@
 SLIM_CPPFLAGS = @SLIM_CPPFLAGS@
 SLIM_LDFLAGS = @SLIM_LDFLAGS@
+SLIM_LIBS = @SLIM_LIBS@
 STRIP = @STRIP@
 VERSION = @VERSION@
+ZZIP_CPPFLAGS = @ZZIP_CPPFLAGS@
+ZZIP_LDFLAGS = @ZZIP_LDFLAGS@
+ZZIP_LIBS = @ZZIP_LIBS@
 abs_builddir = @abs_builddir@
 abs_srcdir = @abs_srcdir@
 abs_top_builddir = @abs_top_builddir@
@@ -3898,6 +5106,8 @@ libexecdir = @libexecdir@
 localedir = @localedir@
 localstatedir = @localstatedir@
 mandir = @mandir@
+matlabbasedir = @matlabbasedir@
+mexext = @mexext@
 mkdir_p = @mkdir_p@
 moduledir = @moduledir@
 oldincludedir = @oldincludedir@
@@ -3907,8 +5117,12 @@ path_gunzip = @path_gunzip@
 path_gzip = @path_gzip@
 path_slim = @path_slim@
 path_unslim = @path_unslim@
+path_unzip = @path_unzip@
 path_xz = @path_xz@
+path_zip = @path_zip@
 pdfdir = @pdfdir@
+perldir = @perldir@
+perlmandir = @perlmandir@
 prefix = @prefix@
 program_transform_name = @program_transform_name@
 psdir = @psdir@
@@ -3922,7 +5136,7 @@ top_build_prefix = @top_build_prefix@
 top_builddir = @top_builddir@
 top_srcdir = @top_srcdir@
 
-# (C) 2008-2010 D. V. Wiebe
+# (C) 2008-2012 D. V. Wiebe
 #
 ##########################################################################
 #
@@ -3945,42 +5159,48 @@ top_srcdir = @top_srcdir@
 AUTOMAKE_OPTIONS = foreign
 @CC_WALL_TRUE at WALL = -Wall
 @CC_WEXTRA_TRUE at WEXTRA = -Wextra
- at LFS_TRANSITIONAL_API_TRUE@GET64 = get64
- at LFS_TRANSITIONAL_API_TRUE@GET_OFF64 = get_off64
- at LFS_TRANSITIONAL_API_TRUE@NFRAMES64 = nframes64
- at LFS_TRANSITIONAL_API_TRUE@NFRAMES_OFF64 = nframes_off64
- at LFS_TRANSITIONAL_API_TRUE@PUT64 = put64
- at LFS_TRANSITIONAL_API_TRUE@PUT_OFF64 = put_off64
 LDADD = ../src/libgetdata.la
-INCLUDES = ${WALL} $(WEXTRA) -I$(top_srcdir)/src -D__TEST__=\"$@\"
+INCLUDES = ${WALL} $(WEXTRA) -I$(top_srcdir)/src
 EXTRA_DIST = test.h
-ADD_TESTS = add add_bit add_bit_bitnum add_bit_bitsize add_bit_invalid \
-					add_bit_numbits add_carray add_clincom add_code add_const \
-					add_cpolynom add_crecip add_crecip89 add_divide add_divide_invalid \
-					add_duplicate add_format add_invalid add_lincom add_lincom_invalid \
-					add_lincom_nfields add_linterp add_linterp_invalid add_multiply \
+ADD_TESTS = add add_affix add_alias add_alias_affix add_alias_meta add_bit \
+					add_bit_bitnum add_bit_bitsize add_bit_invalid add_bit_numbits \
+					add_carray add_clincom add_code add_const add_cpolynom add_crecip \
+					add_crecip89 add_divide add_divide_invalid add_duplicate add_format \
+					add_invalid add_lincom add_lincom_affix add_lincom_invalid \
+					add_lincom_nfields add_linterp add_linterp_invalid add_meta \
+					add_meta_alias add_mplex add_mplex_val add_multiply \
 					add_multiply_invalid add_phase add_phase_invalid add_polynom \
 					add_protect add_raw add_raw_include add_raw_invalid add_raw_spf \
-					add_raw_type add_rdonly add_recip add_sbit add_scalar add_sort \
-					add_spec add_spec_directive add_spec_invalid add_spec_meta \
-					add_string add_type
+					add_raw_type add_rdonly add_recip add_resolv add_sbit add_scalar \
+					add_scalar_carray add_scalar_carray_bad add_sort add_spec \
+					add_spec_directive add_spec_invalid add_spec_meta add_spec_resolv \
+					add_string add_string_affix add_type add_window add_window_op
+
+ALIAS_TESTS = alias_list alias_list_alias alias_list_missing alias_num \
+						alias_num_alias alias_num_missing alias_target alias_target_alias \
+						alias_target_missing
 
 ALTER_TESTS = alter_bit_bitnum alter_bit_numbits alter_carray_len \
-						alter_carray_type alter_const alter_cpolynom alter_crecip \
+						alter_carray_type alter_const alter_const_c2r alter_cpolynom \
+						alter_crecip \
 						alter_crecip89 alter_crecip_zero alter_divide alter_entry \
-						alter_entry_recode alter_entry_scalar2a alter_entry_scalar2n \
-						alter_entry_scalar3 alter_entry_scalar4 alter_lincom_23 \
-						alter_lincom_32 alter_lincom_input alter_lincom_offset \
-						alter_lincom_slope alter_linterp alter_linterp_move alter_mspec \
-						alter_multiply alter_phase alter_polynom_coeff alter_polynom_input \
-						alter_polynom_ord alter_raw_spf alter_raw_type alter_recip \
-						alter_recip_zero alter_spec alter_spec_meta
+						alter_entry_affix alter_entry_hidden alter_entry_recode \
+						alter_entry_scalar2a alter_entry_scalar2n alter_entry_scalar3 \
+						alter_entry_scalar4 alter_lincom_23 alter_lincom_32 \
+						alter_lincom_affix alter_lincom_input alter_lincom_offset \
+						alter_lincom_slope alter_linterp alter_linterp_move alter_mplex \
+						alter_mspec alter_mspec_affix alter_multiply alter_phase \
+						alter_polynom_coeff alter_polynom_input alter_polynom_ord \
+						alter_raw_spf alter_raw_type alter_recip alter_recip_zero \
+						alter_scalar_affix alter_spec alter_spec_affix alter_spec_meta \
+						alter_window
 
-ASCII_TESTS = ascii_get ascii_get_get ascii_nframes ascii_put
+ASCII_TESTS = ascii_add ascii_get ascii_get_get ascii_nframes ascii_put
 BOF_TESTS = bof bof_lincom bof_phase
 BZIP_TESTS = bzip_get bzip_get_get bzip_move_from bzip_nframes
-CVLIST_TESTS = cvlist cvlist_array cvlist_array_meta cvlist_invalid cvlist_meta \
-						 cvlist_meta_invalid
+CVLIST_TESTS = cvlist cvlist_array cvlist_array_hidden cvlist_array_meta \
+						 cvlist_array_meta_hidden cvlist_hidden cvlist_invalid cvlist_meta \
+						 cvlist_meta_hidden cvlist_meta_invalid
 
 CLOSE_TESTS = close close_bad close_discard close_null
 CONVERT_TESTS = convert_complex128_complex64 convert_complex128_float64 \
@@ -4034,30 +5254,42 @@ CONVERT_TESTS = convert_complex128_complex64 convert_complex128_float64 \
 
 CREAT_TESTS = creat creat_excl creat_rdonly
 DEL_TESTS = del del_carray del_carray_deref del_const del_const_deref \
-					del_const_force del_data del_derived del_derived_force del_meta \
-					del_meta_force
+					del_const_force del_data del_derived del_derived_after \
+					del_derived_force del_meta del_meta_force
 
 DFES_TESTS = dfes_bit dfes_divide dfes_lincom dfes_linterp dfes_multiply \
 					 dfes_null dfes_phase dfes_raw dfes_recip dfes_zero
 
+DESYNC_TESTS = desync desync_flush desync_reopen desync_reopen_inv
+ELIST_TESTS = elist_alias elist_hidden elist_noalias elist_scalar
 ENCODE_TESTS = encode_alter encode_get encode_move
-ENDIAN_TESTS = endian_alter endian_get endian_move
-ENTRY_TESTS = entry_bad_code entry_bit entry_bit_scalar entry_invalid \
-						entry_lincom entry_lincom_scalar entry_linterp entry_multiply \
-						entry_phase entry_phase_scalar entry_polynom entry_polynom_scalar \
-						entry_raw entry_raw_scalar entry_raw_scalar_code \
-						entry_raw_scalar_type entry_scalar_repr entry_type
+ENDIAN_TESTS = endian_alter endian_alter_sie endian_get endian_move
+ENTRY_TESTS = entry_bad_code entry_bit entry_bit_scalar entry_divide \
+						entry_invalid entry_lincom entry_lincom_scalar entry_linterp \
+						entry_mplex entry_mplex_scalar entry_multiply entry_phase \
+						entry_phase_scalar entry_polynom entry_polynom_scalar entry_raw \
+						entry_raw_scalar entry_raw_scalar_code entry_raw_scalar_type \
+						entry_scalar_repr entry_recip entry_type entry_type_alias \
+						entry_window entry_window_scalar
 
 EOF_TESTS = eof eof_index eof_lincom eof_phase
-ERROR_TESTS = error error_error error_short
+ERROR_TESTS = error error_error error_num error_short error_verbose \
+						error_verbose_prefix
+
 FILE_TESTS = file file_code file_type
-FLIST_TESTS = flist flist_invalid flist_meta flist_meta_invalid flist_type \
-						flist_type_invalid flist_type_meta flist_type_meta_invalid
+FLIST_TESTS = flist flist_hidden flist_invalid flist_meta flist_meta_hidden \
+						flist_meta_invalid flist_type flist_type_hidden flist_type_invalid \
+						flist_type_meta flist_type_meta_hidden flist_type_meta_invalid
+
+FLUSH_TESTS = flush flush_all flush_bad_code flush_invalid flush_meta flush_ref \
+						flush_spec
 
-FLUSH_TESTS = flush flush_all flush_bad_code flush_invalid flush_meta flush_spec
 FOFFS_TESTS = foffs_alter foffs_get foffs_move
-FRAGMENT_TESTS = fragment_index fragment_name fragment_name_oor
-GET_TESTS = ${GET64} get_bad_code get_bit get_carray get_carray_len \
+FRAGMENT_TESTS = fragment_affix fragment_affix_alter fragment_affix_alter2 \
+							 fragment_affix_dup fragment_index fragment_index_alias \
+							 fragment_name fragment_name_oor fragment_num fragment_parent
+
+GET_TESTS = get64 get_affix get_bad_code get_bit get_carray get_carray_len \
 					get_carray_slice get_char get_clincom get_complex128 \
 					get_complex64 get_const get_const_complex get_const_repr \
 					get_cpolynom get_divide get_endian8 get_endian16 get_endian32 \
@@ -4067,81 +5299,111 @@ GET_TESTS = ${GET64} get_bad_code get_bit get_carray get_carray_len \
 					get_endian_float32_arm get_endian_float32_big \
 					get_endian_float32_little get_endian_float64_arm \
 					get_endian_float64_big get_endian_float64_little get_ff get_float32 \
-					get_float64 get_foffs get_fs get_int8 get_int16 get_int32 get_int64 \
-					get_invalid get_lincom1 get_lincom2 get_lincom3 get_lincom_noin \
-					get_lincom_non get_linterp get_linterp_noin get_linterp_notab \
-					get_linterp_sort get_multiply get_multiply_noin get_nonexistent \
-					get_null $(GET_OFF64) get_phase get_polynom get_polynom_noin \
-					get_recip get_recip_const get_recurse get_sbit get_sf get_ss \
-					get_type get_uint16 get_uint32 get_uint64 get_zero
+					get_float64 get_foffs get_fs get_here get_here_foffs get_heres \
+					get_int8 get_int16 get_int32 get_int64 get_invalid get_lincom1 \
+					get_lincom2 get_lincom3 get_lincom_noin get_lincom_non \
+					get_lincom_null get_lincom_spf get_linterp get_linterp_noin \
+					get_linterp_notab get_linterp_sort get_mplex get_mplex_bof \
+					get_mplex_lb get_mplex_lball get_mplex_nolb get_multiply \
+					get_multiply_noin get_nonexistent get_null get_off64 get_phase \
+					get_phase_affix get_polynom get_polynom_noin get_recip \
+					get_recip_const get_recurse get_rofs get_sbit get_sf get_ss get_type \
+					get_uint16 get_uint32 get_uint64 get_window get_window_clr \
+					get_window_ge get_window_gt get_window_le get_window_lt \
+					get_window_ne get_window_set get_zero
+
+GLOBAL_TESTS = global_flags global_name global_ref global_ref_empty global_ref_set
+GZIP_TESTS = gzip_add gzip_get gzip_get_get gzip_get_get2 gzip_get_put \
+					 gzip_move_from gzip_move_to gzip_nframes gzip_put gzip_put_get
 
-GLOBAL_TESTS = global_name global_ref global_ref_empty global_ref_set
-GZIP_TESTS = gzip_get gzip_get_get gzip_move_from gzip_nframes
 HEADER_TESTS = header_complex
-INCLUDE_TESTS = include include_accmode include_auto include_cb include_creat \
-							include_ignore include_index include_invalid include_nonexistent \
-							include_pc include_ref include_syntax
+HIDE_TESTS = hide hide_hidden hide_unhide
+INCLUDE_TESTS = include include_accmode include_affix include_auto include_cb \
+							include_creat include_ignore include_index include_invalid \
+							include_nonexistent include_pc include_ref include_sub \
+							include_syntax
 
 INDEX_TESTS = index index_domain index_range
 @INCLUDE_LEGACY_API_TRUE at LEGACY_TESTS = legacy_get legacy_get_put legacy_get_rofs legacy_nframes \
 @INCLUDE_LEGACY_API_TRUE@			legacy_nonexistent legacy_put legacy_spf
 
 LZMA_TESTS = lzma_get lzma_nframes
-MADD_TESTS = madd madd_bit madd_bit_invalid madd_carray madd_clincom madd_const \
-					 madd_cpolynom madd_crecip madd_crecip89 madd_divide madd_lincom \
-					 madd_lincom_invalid madd_linterp madd_linterp_invalid madd_multiply \
-					 madd_multiply_invalid madd_phase madd_phase_invalid madd_polynom \
-					 madd_recip madd_sbit madd_spec madd_spec_directive \
-					 madd_spec_invalid madd_string
+MADD_TESTS = madd madd_affix madd_alias madd_alias_affix madd_bit \
+					 madd_bit_invalid madd_carray madd_clincom madd_const madd_cpolynom \
+					 madd_crecip madd_crecip89 madd_divide madd_index madd_lincom \
+					 madd_lincom_invalid madd_linterp madd_linterp_invalid madd_mplex \
+					 madd_multiply madd_multiply_invalid madd_phase madd_phase_invalid \
+					 madd_polynom madd_recip madd_sbit madd_spec madd_spec_directive \
+					 madd_spec_invalid madd_spec_resolv madd_string madd_window
+
+MOVE_TESTS = move move_affix move_affix_dup move_alias move_data_enc_ar \
+					 move_data_enc_ra move_data_endian move_data_foffs move_data_nop \
+					 move_index move_meta move_protect move_subdir
 
-MOVE_TESTS = move move_data_enc_ar move_data_enc_ra move_data_endian \
-					 move_data_foffs move_data_nop move_index move_meta move_protect \
-					 move_subdir
+NAME_TESTS = name name_affix name_affix_bad name_alias name_dup name_move \
+					 name_move_alias name_updb name_updb_alias name_updb_const \
+					 name_updb_const_alias
 
-NAME_TESTS = name name_move
-NFIELDS_TESTS = nfields nfields_invalid nfields_type nfields_type_invalid
-NFRAGMENTS_TESTS = nfragments
-NFRAMES_TESTS = nframes ${NFRAMES64} nframes_empty nframes_invalid \
-							$(NFRAMES_OFF64) nframes_spf
+NENTRIES_TESTS = nentries_alias nentries_hidden nentries_noalias nentries_scalar
+NFIELDS_TESTS = nfields nfields_hidden nfields_invalid nfields_type \
+							nfields_type_hidden nfields_type_invalid nfields_vector \
+							nfields_vector_hidden nfields_vector_invalid
 
-NMETA_TESTS = nmeta nmeta_invalid nmeta_parent nmeta_type nmeta_type_invalid \
-						nmeta_type_parent nmeta_vectors nmeta_vectors_del \
+NFRAMES_TESTS = nframes nframes64 nframes_empty nframes_invalid \
+							nframes_off64 nframes_spf
+
+NMETA_TESTS = nmeta nmeta_hidden nmeta_invalid nmeta_parent nmeta_type \
+						nmeta_type_hidden nmeta_type_invalid nmeta_type_parent \
+						nmeta_vectors nmeta_vectors_del nmeta_vectors_hidden \
 						nmeta_vectors_invalid nmeta_vectors_parent
 
-NVECTORS_TESTS = nvectors nvectors_invalid
-OPEN_TESTS = open open_cb_abort open_cb_cont open_cb_ignore open_cb_invalid \
-					 open_cb_rescan open_eaccess open_nonexistent open_notdirfile
+OPEN_TESTS = open open_abs open_cb_abort open_cb_cont open_cb_ignore \
+					 open_cb_invalid open_cb_rescan open_eaccess open_nonexistent \
+					 open_notdirfile open_sym_a open_sym_al open_sym_at open_sym_c \
+					 open_sym_cl open_sym_ct open_sym_p open_sym_pl open_sym_pt
 
-PARENT_TESTS = parent
-PARSE_TESTS = parse_badline parse_bit parse_bit4 parse_bit_bitnum \
-						parse_bit_bitsize parse_bit_ncols parse_bit_numbits \
-						parse_bit_scalar parse_carray parse_carray_long parse_const \
-						parse_const_ncols parse_divide parse_duplicate \
-						parse_duplicate_ignore parse_endian_bad parse_endian_big \
-						parse_endian_force parse_endian_little parse_endian_slash \
-						parse_eol parse_foffs parse_foffs_include parse_foffs_slash \
-						parse_include parse_include_absolute parse_include_absrel \
-						parse_include_nonexistent parse_include_relabs \
-						parse_include_relrel parse_include_slash parse_index parse_lincom \
-						parse_lincom_ncols1 parse_lincom_ncols2 parse_lincom_nfields \
-						parse_lincom_nofields parse_lincom_non parse_lincom_non_ncols \
-						parse_lincom_scalar parse_linterp parse_linterp_ncols parse_meta \
-						parse_meta_implicit parse_meta_implicit2 parse_meta_index \
-						parse_meta_index2 parse_meta_parent parse_meta_raw parse_multiply \
-						parse_multiply_ncols parse_name parse_name_dot parse_name_ext \
-						parse_name_pedantic parse_ncols parse_phase parse_phase_ncols \
-						parse_phase_scalar parse_polynom parse_polynom_ncols1 \
-						parse_polynom_ncols2 parse_polynom_scalar parse_protect_all \
-						parse_protect_bad parse_protect_data parse_protect_format \
-						parse_protect_none parse_quote parse_quote_mismatch parse_raw \
-						parse_raw_char parse_raw_ncols parse_raw_scalar parse_raw_spf \
-						parse_raw_type parse_recip parse_ref parse_ref_nonexistent \
-						parse_sbit parse_sort parse_string parse_string_ncols \
-						parse_string_null parse_version parse_version_include \
-						parse_version_permissive parse_version_slash parse_whitespace
+PARSE_TESTS = parse_alias parse_alias_code parse_alias_dup parse_alias_meta \
+						parse_alias_missing parse_badline parse_bit parse_bit4 \
+						parse_bit_bitnum parse_bit_bitsize parse_bit_ncols \
+						parse_bit_numbits parse_bit_scalar parse_carray parse_carray_long \
+						parse_const parse_const_complex parse_const_ncols parse_divide \
+						parse_double parse_duplicate parse_duplicate_ignore \
+						parse_endian_bad parse_endian_big parse_endian_force \
+						parse_endian_little parse_endian_slash parse_eol parse_foffs \
+						parse_foffs_include parse_foffs_slash parse_hidden \
+						parse_hidden_field parse_hidden_meta parse_include \
+						parse_include_absolute parse_include_absrel \
+						parse_include_affix_ref parse_include_dir parse_include_loop \
+						parse_include_nonexistent parse_include_prefix \
+						parse_include_prefix_dup parse_include_preprefix \
+						parse_include_ref parse_include_relabs parse_include_relrel \
+						parse_include_slash parse_include_suffix parse_include_sufsuffix \
+						parse_index parse_lincom parse_lincom_ncols1 parse_lincom_ncols2 \
+						parse_lincom_nfields parse_lincom_nofields parse_lincom_non \
+						parse_lincom_non_ncols parse_lincom_scalar parse_linterp \
+						parse_linterp_ncols parse_malias parse_malias_dup \
+						parse_malias_meta parse_meta parse_meta_affix parse_meta_alias \
+						parse_meta_implicit parse_meta_implicit2 parse_meta_implicit_affix \
+						parse_meta_index parse_meta_index2 parse_meta_jump \
+						parse_meta_malias parse_meta_meta parse_meta_parent parse_meta_raw \
+						parse_mplex parse_mplex_ncols parse_mplex_nomax parse_mplex_scalar \
+						parse_multiply parse_multiply_ncols parse_name parse_name_dot \
+						parse_name_ext parse_name_pedantic parse_ncols parse_phase \
+						parse_phase_ncols parse_phase_scalar parse_polynom \
+						parse_polynom_ncols1 parse_polynom_ncols2 parse_polynom_scalar \
+						parse_protect_all parse_protect_bad parse_protect_data \
+						parse_protect_format parse_protect_none parse_quote \
+						parse_quote_mismatch parse_raw parse_raw_char parse_raw_ncols \
+						parse_raw_scalar parse_raw_spf parse_raw_type parse_recip \
+						parse_ref parse_ref_nonexistent parse_sbit parse_sort parse_string \
+						parse_string_ncols parse_string_null parse_version \
+						parse_version_89 parse_version_98 parse_version_include \
+						parse_version_permissive parse_version_p8 parse_version_p9 \
+						parse_version_slash parse_whitespace parse_window \
+						parse_window_ncols parse_window_op parse_window_scalar
 
 PROTECT_TESTS = protect_alter protect_get
-PUT_TESTS = ${PUT64} put_bad_code put_bit put_bof put_carray put_carray_slice \
+PUT_TESTS = put64 put_bad_code put_bit put_bof put_carray put_carray_slice \
 					put_char put_complex128 put_complex64 put_const put_const_protect \
 					put_divide put_endian8 put_endian16 put_endian32 put_endian64 \
 					put_endian_complex128_arm put_endian_complex128_big \
@@ -4150,14 +5412,15 @@ PUT_TESTS = ${PUT64} put_bad_code put_bit put_bof put_carray put_carray_slice \
 					put_endian_float32_arm put_endian_float32_big \
 					put_endian_float32_little put_endian_float64_arm \
 					put_endian_float64_big put_endian_float64_little put_ff put_float32 \
-					put_float64 put_foffs put_fs put_int8 put_int16 put_int32 put_int64 \
-					put_invalid put_lincom1 put_lincom2 put_lincom_noin put_linterp \
-					put_linterp_noin put_linterp_nomono put_linterp_notab \
-					put_linterp_reverse put_multiply put_null $(PUT_OFF64) \
-					put_phase put_phase_noin put_polynom1 put_polynom2 put_polynom_noin \
-					put_protect put_rdonly put_recip put_recurse put_repr put_rofs \
-					put_sbit put_sf put_ss put_string put_string_protect put_type \
-					put_uint16 put_uint32 put_uint64
+					put_float64 put_foffs put_fs put_here put_heres put_int8 put_int16 \
+					put_int32 put_int64 put_invalid put_lincom1 put_lincom2 \
+					put_lincom_noin put_linterp put_linterp_noin put_linterp_nomono \
+					put_linterp_notab put_linterp_reverse put_mplex put_multiply \
+					put_null put_off64 put_phase put_phase_noin put_polynom1 \
+					put_polynom2 put_polynom_noin put_protect put_rdonly put_recip \
+					put_recurse put_repr put_rofs put_sbit put_sf put_ss put_string \
+					put_string_protect put_type put_uint16 put_uint32 put_uint64 \
+					put_window put_zero
 
 REF_TESTS = ref ref_none ref_two
 REPR_TESTS = repr_a repr_float32 repr_float64 repr_i repr_int16 repr_int32 \
@@ -4165,22 +5428,36 @@ REPR_TESTS = repr_a repr_float32 repr_float64 repr_i repr_int16 repr_int32 \
 					 repr_real_m repr_real_r repr_uint16 repr_uint32 repr_uint64 \
 					 repr_uint8
 
+SEEK_TESTS = seek64 seek_cur seek_end seek_foffs seek_neg seek_set
+SIE_TESTS = sie_get_big sie_get_little sie_move_from sie_move_to sie_nframes_big \
+					sie_nframes_little sie_put_big sie_put_little
+
 SLIM_TESTS = slim_get slim_nframes
-SVLIST_TESTS = svlist svlist_invalid svlist_meta svlist_meta_invalid
-SPF_TESTS = spf spf_divide spf_lincom spf_multiply spf_polynom spf_recip \
-					spf_recurse
+SVLIST_TESTS = svlist svlist_hidden svlist_invalid svlist_meta \
+						 svlist_meta_hidden svlist_meta_invalid
+
+SPF_TESTS = spf spf_alias spf_alias_missing spf_alias_meta \
+					spf_divide spf_lincom spf_multiply \
+					spf_polynom spf_recip spf_recurse
 
-TRUNC_TESTS = trunc trunc_rdonly trunc_rofs
+TABLE_TESTS = table table_code table_type
+TELL_TESTS = tell tell64 tell_multidiv
+TOK_TESTS = tok_arg tok_escape tok_quote
+TRUNC_TESTS = trunc trunc_dir trunc_rdonly trunc_rofs trunc_truncsub
 UNCLUDE_TESTS = unclude unclude_del unclude_move
 VERSION_TESTS = version_0 version_0_write version_1 version_1_write version_2 \
 							version_2_write version_3 version_3_write version_4 \
 							version_4_write version_5 version_5_strict version_5_write \
 							version_6 version_6_strict version_6_write version_7 \
 							version_7_strict version_7_write version_8 version_8_strict \
-							version_8_write
+							version_8_write version_9 version_9_strict version_9_write
+
+VLIST_TESTS = vlist vlist_alias vlist_hidden vlist_invalid vlist_meta \
+						vlist_meta_hidden vlist_meta_invalid
 
-VLIST_TESTS = vlist vlist_invalid vlist_meta vlist_meta_invalid
 XZ_TESTS = xz_get xz_nframes
+ZZIP_TESTS = zzip_data zzip_get zzip_get_get zzip_nframes
+ZZSLIM_TESTS = zzslim_get zzslim_nframes
 all: all-am
 
 .SUFFIXES:
@@ -4224,2097 +5501,2781 @@ clean-checkPROGRAMS:
 	list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \
 	echo " rm -f" $$list; \
 	rm -f $$list
-add$(EXEEXT): $(add_OBJECTS) $(add_DEPENDENCIES) 
+add$(EXEEXT): $(add_OBJECTS) $(add_DEPENDENCIES) $(EXTRA_add_DEPENDENCIES) 
 	@rm -f add$(EXEEXT)
 	$(LINK) $(add_OBJECTS) $(add_LDADD) $(LIBS)
-add_bit$(EXEEXT): $(add_bit_OBJECTS) $(add_bit_DEPENDENCIES) 
+add_affix$(EXEEXT): $(add_affix_OBJECTS) $(add_affix_DEPENDENCIES) $(EXTRA_add_affix_DEPENDENCIES) 
+	@rm -f add_affix$(EXEEXT)
+	$(LINK) $(add_affix_OBJECTS) $(add_affix_LDADD) $(LIBS)
+add_alias$(EXEEXT): $(add_alias_OBJECTS) $(add_alias_DEPENDENCIES) $(EXTRA_add_alias_DEPENDENCIES) 
+	@rm -f add_alias$(EXEEXT)
+	$(LINK) $(add_alias_OBJECTS) $(add_alias_LDADD) $(LIBS)
+add_alias_affix$(EXEEXT): $(add_alias_affix_OBJECTS) $(add_alias_affix_DEPENDENCIES) $(EXTRA_add_alias_affix_DEPENDENCIES) 
+	@rm -f add_alias_affix$(EXEEXT)
+	$(LINK) $(add_alias_affix_OBJECTS) $(add_alias_affix_LDADD) $(LIBS)
+add_alias_meta$(EXEEXT): $(add_alias_meta_OBJECTS) $(add_alias_meta_DEPENDENCIES) $(EXTRA_add_alias_meta_DEPENDENCIES) 
+	@rm -f add_alias_meta$(EXEEXT)
+	$(LINK) $(add_alias_meta_OBJECTS) $(add_alias_meta_LDADD) $(LIBS)
+add_bit$(EXEEXT): $(add_bit_OBJECTS) $(add_bit_DEPENDENCIES) $(EXTRA_add_bit_DEPENDENCIES) 
 	@rm -f add_bit$(EXEEXT)
 	$(LINK) $(add_bit_OBJECTS) $(add_bit_LDADD) $(LIBS)
-add_bit_bitnum$(EXEEXT): $(add_bit_bitnum_OBJECTS) $(add_bit_bitnum_DEPENDENCIES) 
+add_bit_bitnum$(EXEEXT): $(add_bit_bitnum_OBJECTS) $(add_bit_bitnum_DEPENDENCIES) $(EXTRA_add_bit_bitnum_DEPENDENCIES) 
 	@rm -f add_bit_bitnum$(EXEEXT)
 	$(LINK) $(add_bit_bitnum_OBJECTS) $(add_bit_bitnum_LDADD) $(LIBS)
-add_bit_bitsize$(EXEEXT): $(add_bit_bitsize_OBJECTS) $(add_bit_bitsize_DEPENDENCIES) 
+add_bit_bitsize$(EXEEXT): $(add_bit_bitsize_OBJECTS) $(add_bit_bitsize_DEPENDENCIES) $(EXTRA_add_bit_bitsize_DEPENDENCIES) 
 	@rm -f add_bit_bitsize$(EXEEXT)
 	$(LINK) $(add_bit_bitsize_OBJECTS) $(add_bit_bitsize_LDADD) $(LIBS)
-add_bit_invalid$(EXEEXT): $(add_bit_invalid_OBJECTS) $(add_bit_invalid_DEPENDENCIES) 
+add_bit_invalid$(EXEEXT): $(add_bit_invalid_OBJECTS) $(add_bit_invalid_DEPENDENCIES) $(EXTRA_add_bit_invalid_DEPENDENCIES) 
 	@rm -f add_bit_invalid$(EXEEXT)
 	$(LINK) $(add_bit_invalid_OBJECTS) $(add_bit_invalid_LDADD) $(LIBS)
-add_bit_numbits$(EXEEXT): $(add_bit_numbits_OBJECTS) $(add_bit_numbits_DEPENDENCIES) 
+add_bit_numbits$(EXEEXT): $(add_bit_numbits_OBJECTS) $(add_bit_numbits_DEPENDENCIES) $(EXTRA_add_bit_numbits_DEPENDENCIES) 
 	@rm -f add_bit_numbits$(EXEEXT)
 	$(LINK) $(add_bit_numbits_OBJECTS) $(add_bit_numbits_LDADD) $(LIBS)
-add_carray$(EXEEXT): $(add_carray_OBJECTS) $(add_carray_DEPENDENCIES) 
+add_carray$(EXEEXT): $(add_carray_OBJECTS) $(add_carray_DEPENDENCIES) $(EXTRA_add_carray_DEPENDENCIES) 
 	@rm -f add_carray$(EXEEXT)
 	$(LINK) $(add_carray_OBJECTS) $(add_carray_LDADD) $(LIBS)
-add_clincom$(EXEEXT): $(add_clincom_OBJECTS) $(add_clincom_DEPENDENCIES) 
+add_clincom$(EXEEXT): $(add_clincom_OBJECTS) $(add_clincom_DEPENDENCIES) $(EXTRA_add_clincom_DEPENDENCIES) 
 	@rm -f add_clincom$(EXEEXT)
 	$(LINK) $(add_clincom_OBJECTS) $(add_clincom_LDADD) $(LIBS)
-add_code$(EXEEXT): $(add_code_OBJECTS) $(add_code_DEPENDENCIES) 
+add_code$(EXEEXT): $(add_code_OBJECTS) $(add_code_DEPENDENCIES) $(EXTRA_add_code_DEPENDENCIES) 
 	@rm -f add_code$(EXEEXT)
 	$(LINK) $(add_code_OBJECTS) $(add_code_LDADD) $(LIBS)
-add_const$(EXEEXT): $(add_const_OBJECTS) $(add_const_DEPENDENCIES) 
+add_const$(EXEEXT): $(add_const_OBJECTS) $(add_const_DEPENDENCIES) $(EXTRA_add_const_DEPENDENCIES) 
 	@rm -f add_const$(EXEEXT)
 	$(LINK) $(add_const_OBJECTS) $(add_const_LDADD) $(LIBS)
-add_cpolynom$(EXEEXT): $(add_cpolynom_OBJECTS) $(add_cpolynom_DEPENDENCIES) 
+add_cpolynom$(EXEEXT): $(add_cpolynom_OBJECTS) $(add_cpolynom_DEPENDENCIES) $(EXTRA_add_cpolynom_DEPENDENCIES) 
 	@rm -f add_cpolynom$(EXEEXT)
 	$(LINK) $(add_cpolynom_OBJECTS) $(add_cpolynom_LDADD) $(LIBS)
-add_crecip$(EXEEXT): $(add_crecip_OBJECTS) $(add_crecip_DEPENDENCIES) 
+add_crecip$(EXEEXT): $(add_crecip_OBJECTS) $(add_crecip_DEPENDENCIES) $(EXTRA_add_crecip_DEPENDENCIES) 
 	@rm -f add_crecip$(EXEEXT)
 	$(LINK) $(add_crecip_OBJECTS) $(add_crecip_LDADD) $(LIBS)
-add_crecip89$(EXEEXT): $(add_crecip89_OBJECTS) $(add_crecip89_DEPENDENCIES) 
+add_crecip89$(EXEEXT): $(add_crecip89_OBJECTS) $(add_crecip89_DEPENDENCIES) $(EXTRA_add_crecip89_DEPENDENCIES) 
 	@rm -f add_crecip89$(EXEEXT)
 	$(LINK) $(add_crecip89_OBJECTS) $(add_crecip89_LDADD) $(LIBS)
-add_divide$(EXEEXT): $(add_divide_OBJECTS) $(add_divide_DEPENDENCIES) 
+add_divide$(EXEEXT): $(add_divide_OBJECTS) $(add_divide_DEPENDENCIES) $(EXTRA_add_divide_DEPENDENCIES) 
 	@rm -f add_divide$(EXEEXT)
 	$(LINK) $(add_divide_OBJECTS) $(add_divide_LDADD) $(LIBS)
-add_divide_invalid$(EXEEXT): $(add_divide_invalid_OBJECTS) $(add_divide_invalid_DEPENDENCIES) 
+add_divide_invalid$(EXEEXT): $(add_divide_invalid_OBJECTS) $(add_divide_invalid_DEPENDENCIES) $(EXTRA_add_divide_invalid_DEPENDENCIES) 
 	@rm -f add_divide_invalid$(EXEEXT)
 	$(LINK) $(add_divide_invalid_OBJECTS) $(add_divide_invalid_LDADD) $(LIBS)
-add_duplicate$(EXEEXT): $(add_duplicate_OBJECTS) $(add_duplicate_DEPENDENCIES) 
+add_duplicate$(EXEEXT): $(add_duplicate_OBJECTS) $(add_duplicate_DEPENDENCIES) $(EXTRA_add_duplicate_DEPENDENCIES) 
 	@rm -f add_duplicate$(EXEEXT)
 	$(LINK) $(add_duplicate_OBJECTS) $(add_duplicate_LDADD) $(LIBS)
-add_format$(EXEEXT): $(add_format_OBJECTS) $(add_format_DEPENDENCIES) 
+add_format$(EXEEXT): $(add_format_OBJECTS) $(add_format_DEPENDENCIES) $(EXTRA_add_format_DEPENDENCIES) 
 	@rm -f add_format$(EXEEXT)
 	$(LINK) $(add_format_OBJECTS) $(add_format_LDADD) $(LIBS)
-add_invalid$(EXEEXT): $(add_invalid_OBJECTS) $(add_invalid_DEPENDENCIES) 
+add_invalid$(EXEEXT): $(add_invalid_OBJECTS) $(add_invalid_DEPENDENCIES) $(EXTRA_add_invalid_DEPENDENCIES) 
 	@rm -f add_invalid$(EXEEXT)
 	$(LINK) $(add_invalid_OBJECTS) $(add_invalid_LDADD) $(LIBS)
-add_lincom$(EXEEXT): $(add_lincom_OBJECTS) $(add_lincom_DEPENDENCIES) 
+add_lincom$(EXEEXT): $(add_lincom_OBJECTS) $(add_lincom_DEPENDENCIES) $(EXTRA_add_lincom_DEPENDENCIES) 
 	@rm -f add_lincom$(EXEEXT)
 	$(LINK) $(add_lincom_OBJECTS) $(add_lincom_LDADD) $(LIBS)
-add_lincom_invalid$(EXEEXT): $(add_lincom_invalid_OBJECTS) $(add_lincom_invalid_DEPENDENCIES) 
+add_lincom_affix$(EXEEXT): $(add_lincom_affix_OBJECTS) $(add_lincom_affix_DEPENDENCIES) $(EXTRA_add_lincom_affix_DEPENDENCIES) 
+	@rm -f add_lincom_affix$(EXEEXT)
+	$(LINK) $(add_lincom_affix_OBJECTS) $(add_lincom_affix_LDADD) $(LIBS)
+add_lincom_invalid$(EXEEXT): $(add_lincom_invalid_OBJECTS) $(add_lincom_invalid_DEPENDENCIES) $(EXTRA_add_lincom_invalid_DEPENDENCIES) 
 	@rm -f add_lincom_invalid$(EXEEXT)
 	$(LINK) $(add_lincom_invalid_OBJECTS) $(add_lincom_invalid_LDADD) $(LIBS)
-add_lincom_nfields$(EXEEXT): $(add_lincom_nfields_OBJECTS) $(add_lincom_nfields_DEPENDENCIES) 
+add_lincom_nfields$(EXEEXT): $(add_lincom_nfields_OBJECTS) $(add_lincom_nfields_DEPENDENCIES) $(EXTRA_add_lincom_nfields_DEPENDENCIES) 
 	@rm -f add_lincom_nfields$(EXEEXT)
 	$(LINK) $(add_lincom_nfields_OBJECTS) $(add_lincom_nfields_LDADD) $(LIBS)
-add_linterp$(EXEEXT): $(add_linterp_OBJECTS) $(add_linterp_DEPENDENCIES) 
+add_linterp$(EXEEXT): $(add_linterp_OBJECTS) $(add_linterp_DEPENDENCIES) $(EXTRA_add_linterp_DEPENDENCIES) 
 	@rm -f add_linterp$(EXEEXT)
 	$(LINK) $(add_linterp_OBJECTS) $(add_linterp_LDADD) $(LIBS)
-add_linterp_invalid$(EXEEXT): $(add_linterp_invalid_OBJECTS) $(add_linterp_invalid_DEPENDENCIES) 
+add_linterp_invalid$(EXEEXT): $(add_linterp_invalid_OBJECTS) $(add_linterp_invalid_DEPENDENCIES) $(EXTRA_add_linterp_invalid_DEPENDENCIES) 
 	@rm -f add_linterp_invalid$(EXEEXT)
 	$(LINK) $(add_linterp_invalid_OBJECTS) $(add_linterp_invalid_LDADD) $(LIBS)
-add_multiply$(EXEEXT): $(add_multiply_OBJECTS) $(add_multiply_DEPENDENCIES) 
+add_meta$(EXEEXT): $(add_meta_OBJECTS) $(add_meta_DEPENDENCIES) $(EXTRA_add_meta_DEPENDENCIES) 
+	@rm -f add_meta$(EXEEXT)
+	$(LINK) $(add_meta_OBJECTS) $(add_meta_LDADD) $(LIBS)
+add_meta_alias$(EXEEXT): $(add_meta_alias_OBJECTS) $(add_meta_alias_DEPENDENCIES) $(EXTRA_add_meta_alias_DEPENDENCIES) 
+	@rm -f add_meta_alias$(EXEEXT)
+	$(LINK) $(add_meta_alias_OBJECTS) $(add_meta_alias_LDADD) $(LIBS)
+add_mplex$(EXEEXT): $(add_mplex_OBJECTS) $(add_mplex_DEPENDENCIES) $(EXTRA_add_mplex_DEPENDENCIES) 
+	@rm -f add_mplex$(EXEEXT)
+	$(LINK) $(add_mplex_OBJECTS) $(add_mplex_LDADD) $(LIBS)
+add_mplex_val$(EXEEXT): $(add_mplex_val_OBJECTS) $(add_mplex_val_DEPENDENCIES) $(EXTRA_add_mplex_val_DEPENDENCIES) 
+	@rm -f add_mplex_val$(EXEEXT)
+	$(LINK) $(add_mplex_val_OBJECTS) $(add_mplex_val_LDADD) $(LIBS)
+add_multiply$(EXEEXT): $(add_multiply_OBJECTS) $(add_multiply_DEPENDENCIES) $(EXTRA_add_multiply_DEPENDENCIES) 
 	@rm -f add_multiply$(EXEEXT)
 	$(LINK) $(add_multiply_OBJECTS) $(add_multiply_LDADD) $(LIBS)
-add_multiply_invalid$(EXEEXT): $(add_multiply_invalid_OBJECTS) $(add_multiply_invalid_DEPENDENCIES) 
+add_multiply_invalid$(EXEEXT): $(add_multiply_invalid_OBJECTS) $(add_multiply_invalid_DEPENDENCIES) $(EXTRA_add_multiply_invalid_DEPENDENCIES) 
 	@rm -f add_multiply_invalid$(EXEEXT)
 	$(LINK) $(add_multiply_invalid_OBJECTS) $(add_multiply_invalid_LDADD) $(LIBS)
-add_phase$(EXEEXT): $(add_phase_OBJECTS) $(add_phase_DEPENDENCIES) 
+add_phase$(EXEEXT): $(add_phase_OBJECTS) $(add_phase_DEPENDENCIES) $(EXTRA_add_phase_DEPENDENCIES) 
 	@rm -f add_phase$(EXEEXT)
 	$(LINK) $(add_phase_OBJECTS) $(add_phase_LDADD) $(LIBS)
-add_phase_invalid$(EXEEXT): $(add_phase_invalid_OBJECTS) $(add_phase_invalid_DEPENDENCIES) 
+add_phase_invalid$(EXEEXT): $(add_phase_invalid_OBJECTS) $(add_phase_invalid_DEPENDENCIES) $(EXTRA_add_phase_invalid_DEPENDENCIES) 
 	@rm -f add_phase_invalid$(EXEEXT)
 	$(LINK) $(add_phase_invalid_OBJECTS) $(add_phase_invalid_LDADD) $(LIBS)
-add_polynom$(EXEEXT): $(add_polynom_OBJECTS) $(add_polynom_DEPENDENCIES) 
+add_polynom$(EXEEXT): $(add_polynom_OBJECTS) $(add_polynom_DEPENDENCIES) $(EXTRA_add_polynom_DEPENDENCIES) 
 	@rm -f add_polynom$(EXEEXT)
 	$(LINK) $(add_polynom_OBJECTS) $(add_polynom_LDADD) $(LIBS)
-add_protect$(EXEEXT): $(add_protect_OBJECTS) $(add_protect_DEPENDENCIES) 
+add_protect$(EXEEXT): $(add_protect_OBJECTS) $(add_protect_DEPENDENCIES) $(EXTRA_add_protect_DEPENDENCIES) 
 	@rm -f add_protect$(EXEEXT)
 	$(LINK) $(add_protect_OBJECTS) $(add_protect_LDADD) $(LIBS)
-add_raw$(EXEEXT): $(add_raw_OBJECTS) $(add_raw_DEPENDENCIES) 
+add_raw$(EXEEXT): $(add_raw_OBJECTS) $(add_raw_DEPENDENCIES) $(EXTRA_add_raw_DEPENDENCIES) 
 	@rm -f add_raw$(EXEEXT)
 	$(LINK) $(add_raw_OBJECTS) $(add_raw_LDADD) $(LIBS)
-add_raw_include$(EXEEXT): $(add_raw_include_OBJECTS) $(add_raw_include_DEPENDENCIES) 
+add_raw_include$(EXEEXT): $(add_raw_include_OBJECTS) $(add_raw_include_DEPENDENCIES) $(EXTRA_add_raw_include_DEPENDENCIES) 
 	@rm -f add_raw_include$(EXEEXT)
 	$(LINK) $(add_raw_include_OBJECTS) $(add_raw_include_LDADD) $(LIBS)
-add_raw_invalid$(EXEEXT): $(add_raw_invalid_OBJECTS) $(add_raw_invalid_DEPENDENCIES) 
+add_raw_invalid$(EXEEXT): $(add_raw_invalid_OBJECTS) $(add_raw_invalid_DEPENDENCIES) $(EXTRA_add_raw_invalid_DEPENDENCIES) 
 	@rm -f add_raw_invalid$(EXEEXT)
 	$(LINK) $(add_raw_invalid_OBJECTS) $(add_raw_invalid_LDADD) $(LIBS)
-add_raw_spf$(EXEEXT): $(add_raw_spf_OBJECTS) $(add_raw_spf_DEPENDENCIES) 
+add_raw_spf$(EXEEXT): $(add_raw_spf_OBJECTS) $(add_raw_spf_DEPENDENCIES) $(EXTRA_add_raw_spf_DEPENDENCIES) 
 	@rm -f add_raw_spf$(EXEEXT)
 	$(LINK) $(add_raw_spf_OBJECTS) $(add_raw_spf_LDADD) $(LIBS)
-add_raw_type$(EXEEXT): $(add_raw_type_OBJECTS) $(add_raw_type_DEPENDENCIES) 
+add_raw_type$(EXEEXT): $(add_raw_type_OBJECTS) $(add_raw_type_DEPENDENCIES) $(EXTRA_add_raw_type_DEPENDENCIES) 
 	@rm -f add_raw_type$(EXEEXT)
 	$(LINK) $(add_raw_type_OBJECTS) $(add_raw_type_LDADD) $(LIBS)
-add_rdonly$(EXEEXT): $(add_rdonly_OBJECTS) $(add_rdonly_DEPENDENCIES) 
+add_rdonly$(EXEEXT): $(add_rdonly_OBJECTS) $(add_rdonly_DEPENDENCIES) $(EXTRA_add_rdonly_DEPENDENCIES) 
 	@rm -f add_rdonly$(EXEEXT)
 	$(LINK) $(add_rdonly_OBJECTS) $(add_rdonly_LDADD) $(LIBS)
-add_recip$(EXEEXT): $(add_recip_OBJECTS) $(add_recip_DEPENDENCIES) 
+add_recip$(EXEEXT): $(add_recip_OBJECTS) $(add_recip_DEPENDENCIES) $(EXTRA_add_recip_DEPENDENCIES) 
 	@rm -f add_recip$(EXEEXT)
 	$(LINK) $(add_recip_OBJECTS) $(add_recip_LDADD) $(LIBS)
-add_sbit$(EXEEXT): $(add_sbit_OBJECTS) $(add_sbit_DEPENDENCIES) 
+add_resolv$(EXEEXT): $(add_resolv_OBJECTS) $(add_resolv_DEPENDENCIES) $(EXTRA_add_resolv_DEPENDENCIES) 
+	@rm -f add_resolv$(EXEEXT)
+	$(LINK) $(add_resolv_OBJECTS) $(add_resolv_LDADD) $(LIBS)
+add_sbit$(EXEEXT): $(add_sbit_OBJECTS) $(add_sbit_DEPENDENCIES) $(EXTRA_add_sbit_DEPENDENCIES) 
 	@rm -f add_sbit$(EXEEXT)
 	$(LINK) $(add_sbit_OBJECTS) $(add_sbit_LDADD) $(LIBS)
-add_scalar$(EXEEXT): $(add_scalar_OBJECTS) $(add_scalar_DEPENDENCIES) 
+add_scalar$(EXEEXT): $(add_scalar_OBJECTS) $(add_scalar_DEPENDENCIES) $(EXTRA_add_scalar_DEPENDENCIES) 
 	@rm -f add_scalar$(EXEEXT)
 	$(LINK) $(add_scalar_OBJECTS) $(add_scalar_LDADD) $(LIBS)
-add_sort$(EXEEXT): $(add_sort_OBJECTS) $(add_sort_DEPENDENCIES) 
+add_scalar_carray$(EXEEXT): $(add_scalar_carray_OBJECTS) $(add_scalar_carray_DEPENDENCIES) $(EXTRA_add_scalar_carray_DEPENDENCIES) 
+	@rm -f add_scalar_carray$(EXEEXT)
+	$(LINK) $(add_scalar_carray_OBJECTS) $(add_scalar_carray_LDADD) $(LIBS)
+add_scalar_carray_bad$(EXEEXT): $(add_scalar_carray_bad_OBJECTS) $(add_scalar_carray_bad_DEPENDENCIES) $(EXTRA_add_scalar_carray_bad_DEPENDENCIES) 
+	@rm -f add_scalar_carray_bad$(EXEEXT)
+	$(LINK) $(add_scalar_carray_bad_OBJECTS) $(add_scalar_carray_bad_LDADD) $(LIBS)
+add_sort$(EXEEXT): $(add_sort_OBJECTS) $(add_sort_DEPENDENCIES) $(EXTRA_add_sort_DEPENDENCIES) 
 	@rm -f add_sort$(EXEEXT)
 	$(LINK) $(add_sort_OBJECTS) $(add_sort_LDADD) $(LIBS)
-add_spec$(EXEEXT): $(add_spec_OBJECTS) $(add_spec_DEPENDENCIES) 
+add_spec$(EXEEXT): $(add_spec_OBJECTS) $(add_spec_DEPENDENCIES) $(EXTRA_add_spec_DEPENDENCIES) 
 	@rm -f add_spec$(EXEEXT)
 	$(LINK) $(add_spec_OBJECTS) $(add_spec_LDADD) $(LIBS)
-add_spec_directive$(EXEEXT): $(add_spec_directive_OBJECTS) $(add_spec_directive_DEPENDENCIES) 
+add_spec_directive$(EXEEXT): $(add_spec_directive_OBJECTS) $(add_spec_directive_DEPENDENCIES) $(EXTRA_add_spec_directive_DEPENDENCIES) 
 	@rm -f add_spec_directive$(EXEEXT)
 	$(LINK) $(add_spec_directive_OBJECTS) $(add_spec_directive_LDADD) $(LIBS)
-add_spec_invalid$(EXEEXT): $(add_spec_invalid_OBJECTS) $(add_spec_invalid_DEPENDENCIES) 
+add_spec_invalid$(EXEEXT): $(add_spec_invalid_OBJECTS) $(add_spec_invalid_DEPENDENCIES) $(EXTRA_add_spec_invalid_DEPENDENCIES) 
 	@rm -f add_spec_invalid$(EXEEXT)
 	$(LINK) $(add_spec_invalid_OBJECTS) $(add_spec_invalid_LDADD) $(LIBS)
-add_spec_meta$(EXEEXT): $(add_spec_meta_OBJECTS) $(add_spec_meta_DEPENDENCIES) 
+add_spec_meta$(EXEEXT): $(add_spec_meta_OBJECTS) $(add_spec_meta_DEPENDENCIES) $(EXTRA_add_spec_meta_DEPENDENCIES) 
 	@rm -f add_spec_meta$(EXEEXT)
 	$(LINK) $(add_spec_meta_OBJECTS) $(add_spec_meta_LDADD) $(LIBS)
-add_string$(EXEEXT): $(add_string_OBJECTS) $(add_string_DEPENDENCIES) 
+add_spec_resolv$(EXEEXT): $(add_spec_resolv_OBJECTS) $(add_spec_resolv_DEPENDENCIES) $(EXTRA_add_spec_resolv_DEPENDENCIES) 
+	@rm -f add_spec_resolv$(EXEEXT)
+	$(LINK) $(add_spec_resolv_OBJECTS) $(add_spec_resolv_LDADD) $(LIBS)
+add_string$(EXEEXT): $(add_string_OBJECTS) $(add_string_DEPENDENCIES) $(EXTRA_add_string_DEPENDENCIES) 
 	@rm -f add_string$(EXEEXT)
 	$(LINK) $(add_string_OBJECTS) $(add_string_LDADD) $(LIBS)
-add_type$(EXEEXT): $(add_type_OBJECTS) $(add_type_DEPENDENCIES) 
+add_string_affix$(EXEEXT): $(add_string_affix_OBJECTS) $(add_string_affix_DEPENDENCIES) $(EXTRA_add_string_affix_DEPENDENCIES) 
+	@rm -f add_string_affix$(EXEEXT)
+	$(LINK) $(add_string_affix_OBJECTS) $(add_string_affix_LDADD) $(LIBS)
+add_type$(EXEEXT): $(add_type_OBJECTS) $(add_type_DEPENDENCIES) $(EXTRA_add_type_DEPENDENCIES) 
 	@rm -f add_type$(EXEEXT)
 	$(LINK) $(add_type_OBJECTS) $(add_type_LDADD) $(LIBS)
-alter_bit_bitnum$(EXEEXT): $(alter_bit_bitnum_OBJECTS) $(alter_bit_bitnum_DEPENDENCIES) 
+add_window$(EXEEXT): $(add_window_OBJECTS) $(add_window_DEPENDENCIES) $(EXTRA_add_window_DEPENDENCIES) 
+	@rm -f add_window$(EXEEXT)
+	$(LINK) $(add_window_OBJECTS) $(add_window_LDADD) $(LIBS)
+add_window_op$(EXEEXT): $(add_window_op_OBJECTS) $(add_window_op_DEPENDENCIES) $(EXTRA_add_window_op_DEPENDENCIES) 
+	@rm -f add_window_op$(EXEEXT)
+	$(LINK) $(add_window_op_OBJECTS) $(add_window_op_LDADD) $(LIBS)
+alias_list$(EXEEXT): $(alias_list_OBJECTS) $(alias_list_DEPENDENCIES) $(EXTRA_alias_list_DEPENDENCIES) 
+	@rm -f alias_list$(EXEEXT)
+	$(LINK) $(alias_list_OBJECTS) $(alias_list_LDADD) $(LIBS)
+alias_list_alias$(EXEEXT): $(alias_list_alias_OBJECTS) $(alias_list_alias_DEPENDENCIES) $(EXTRA_alias_list_alias_DEPENDENCIES) 
+	@rm -f alias_list_alias$(EXEEXT)
+	$(LINK) $(alias_list_alias_OBJECTS) $(alias_list_alias_LDADD) $(LIBS)
+alias_list_missing$(EXEEXT): $(alias_list_missing_OBJECTS) $(alias_list_missing_DEPENDENCIES) $(EXTRA_alias_list_missing_DEPENDENCIES) 
+	@rm -f alias_list_missing$(EXEEXT)
+	$(LINK) $(alias_list_missing_OBJECTS) $(alias_list_missing_LDADD) $(LIBS)
+alias_num$(EXEEXT): $(alias_num_OBJECTS) $(alias_num_DEPENDENCIES) $(EXTRA_alias_num_DEPENDENCIES) 
+	@rm -f alias_num$(EXEEXT)
+	$(LINK) $(alias_num_OBJECTS) $(alias_num_LDADD) $(LIBS)
+alias_num_alias$(EXEEXT): $(alias_num_alias_OBJECTS) $(alias_num_alias_DEPENDENCIES) $(EXTRA_alias_num_alias_DEPENDENCIES) 
+	@rm -f alias_num_alias$(EXEEXT)
+	$(LINK) $(alias_num_alias_OBJECTS) $(alias_num_alias_LDADD) $(LIBS)
+alias_num_missing$(EXEEXT): $(alias_num_missing_OBJECTS) $(alias_num_missing_DEPENDENCIES) $(EXTRA_alias_num_missing_DEPENDENCIES) 
+	@rm -f alias_num_missing$(EXEEXT)
+	$(LINK) $(alias_num_missing_OBJECTS) $(alias_num_missing_LDADD) $(LIBS)
+alias_target$(EXEEXT): $(alias_target_OBJECTS) $(alias_target_DEPENDENCIES) $(EXTRA_alias_target_DEPENDENCIES) 
+	@rm -f alias_target$(EXEEXT)
+	$(LINK) $(alias_target_OBJECTS) $(alias_target_LDADD) $(LIBS)
+alias_target_alias$(EXEEXT): $(alias_target_alias_OBJECTS) $(alias_target_alias_DEPENDENCIES) $(EXTRA_alias_target_alias_DEPENDENCIES) 
+	@rm -f alias_target_alias$(EXEEXT)
+	$(LINK) $(alias_target_alias_OBJECTS) $(alias_target_alias_LDADD) $(LIBS)
+alias_target_missing$(EXEEXT): $(alias_target_missing_OBJECTS) $(alias_target_missing_DEPENDENCIES) $(EXTRA_alias_target_missing_DEPENDENCIES) 
+	@rm -f alias_target_missing$(EXEEXT)
+	$(LINK) $(alias_target_missing_OBJECTS) $(alias_target_missing_LDADD) $(LIBS)
+alter_bit_bitnum$(EXEEXT): $(alter_bit_bitnum_OBJECTS) $(alter_bit_bitnum_DEPENDENCIES) $(EXTRA_alter_bit_bitnum_DEPENDENCIES) 
 	@rm -f alter_bit_bitnum$(EXEEXT)
 	$(LINK) $(alter_bit_bitnum_OBJECTS) $(alter_bit_bitnum_LDADD) $(LIBS)
-alter_bit_numbits$(EXEEXT): $(alter_bit_numbits_OBJECTS) $(alter_bit_numbits_DEPENDENCIES) 
+alter_bit_numbits$(EXEEXT): $(alter_bit_numbits_OBJECTS) $(alter_bit_numbits_DEPENDENCIES) $(EXTRA_alter_bit_numbits_DEPENDENCIES) 
 	@rm -f alter_bit_numbits$(EXEEXT)
 	$(LINK) $(alter_bit_numbits_OBJECTS) $(alter_bit_numbits_LDADD) $(LIBS)
-alter_carray_len$(EXEEXT): $(alter_carray_len_OBJECTS) $(alter_carray_len_DEPENDENCIES) 
+alter_carray_len$(EXEEXT): $(alter_carray_len_OBJECTS) $(alter_carray_len_DEPENDENCIES) $(EXTRA_alter_carray_len_DEPENDENCIES) 
 	@rm -f alter_carray_len$(EXEEXT)
 	$(LINK) $(alter_carray_len_OBJECTS) $(alter_carray_len_LDADD) $(LIBS)
-alter_carray_type$(EXEEXT): $(alter_carray_type_OBJECTS) $(alter_carray_type_DEPENDENCIES) 
+alter_carray_type$(EXEEXT): $(alter_carray_type_OBJECTS) $(alter_carray_type_DEPENDENCIES) $(EXTRA_alter_carray_type_DEPENDENCIES) 
 	@rm -f alter_carray_type$(EXEEXT)
 	$(LINK) $(alter_carray_type_OBJECTS) $(alter_carray_type_LDADD) $(LIBS)
-alter_const$(EXEEXT): $(alter_const_OBJECTS) $(alter_const_DEPENDENCIES) 
+alter_const$(EXEEXT): $(alter_const_OBJECTS) $(alter_const_DEPENDENCIES) $(EXTRA_alter_const_DEPENDENCIES) 
 	@rm -f alter_const$(EXEEXT)
 	$(LINK) $(alter_const_OBJECTS) $(alter_const_LDADD) $(LIBS)
-alter_cpolynom$(EXEEXT): $(alter_cpolynom_OBJECTS) $(alter_cpolynom_DEPENDENCIES) 
+alter_const_c2r$(EXEEXT): $(alter_const_c2r_OBJECTS) $(alter_const_c2r_DEPENDENCIES) $(EXTRA_alter_const_c2r_DEPENDENCIES) 
+	@rm -f alter_const_c2r$(EXEEXT)
+	$(LINK) $(alter_const_c2r_OBJECTS) $(alter_const_c2r_LDADD) $(LIBS)
+alter_cpolynom$(EXEEXT): $(alter_cpolynom_OBJECTS) $(alter_cpolynom_DEPENDENCIES) $(EXTRA_alter_cpolynom_DEPENDENCIES) 
 	@rm -f alter_cpolynom$(EXEEXT)
 	$(LINK) $(alter_cpolynom_OBJECTS) $(alter_cpolynom_LDADD) $(LIBS)
-alter_crecip$(EXEEXT): $(alter_crecip_OBJECTS) $(alter_crecip_DEPENDENCIES) 
+alter_crecip$(EXEEXT): $(alter_crecip_OBJECTS) $(alter_crecip_DEPENDENCIES) $(EXTRA_alter_crecip_DEPENDENCIES) 
 	@rm -f alter_crecip$(EXEEXT)
 	$(LINK) $(alter_crecip_OBJECTS) $(alter_crecip_LDADD) $(LIBS)
-alter_crecip89$(EXEEXT): $(alter_crecip89_OBJECTS) $(alter_crecip89_DEPENDENCIES) 
+alter_crecip89$(EXEEXT): $(alter_crecip89_OBJECTS) $(alter_crecip89_DEPENDENCIES) $(EXTRA_alter_crecip89_DEPENDENCIES) 
 	@rm -f alter_crecip89$(EXEEXT)
 	$(LINK) $(alter_crecip89_OBJECTS) $(alter_crecip89_LDADD) $(LIBS)
-alter_crecip_zero$(EXEEXT): $(alter_crecip_zero_OBJECTS) $(alter_crecip_zero_DEPENDENCIES) 
+alter_crecip_zero$(EXEEXT): $(alter_crecip_zero_OBJECTS) $(alter_crecip_zero_DEPENDENCIES) $(EXTRA_alter_crecip_zero_DEPENDENCIES) 
 	@rm -f alter_crecip_zero$(EXEEXT)
 	$(LINK) $(alter_crecip_zero_OBJECTS) $(alter_crecip_zero_LDADD) $(LIBS)
-alter_divide$(EXEEXT): $(alter_divide_OBJECTS) $(alter_divide_DEPENDENCIES) 
+alter_divide$(EXEEXT): $(alter_divide_OBJECTS) $(alter_divide_DEPENDENCIES) $(EXTRA_alter_divide_DEPENDENCIES) 
 	@rm -f alter_divide$(EXEEXT)
 	$(LINK) $(alter_divide_OBJECTS) $(alter_divide_LDADD) $(LIBS)
-alter_entry$(EXEEXT): $(alter_entry_OBJECTS) $(alter_entry_DEPENDENCIES) 
+alter_entry$(EXEEXT): $(alter_entry_OBJECTS) $(alter_entry_DEPENDENCIES) $(EXTRA_alter_entry_DEPENDENCIES) 
 	@rm -f alter_entry$(EXEEXT)
 	$(LINK) $(alter_entry_OBJECTS) $(alter_entry_LDADD) $(LIBS)
-alter_entry_recode$(EXEEXT): $(alter_entry_recode_OBJECTS) $(alter_entry_recode_DEPENDENCIES) 
+alter_entry_affix$(EXEEXT): $(alter_entry_affix_OBJECTS) $(alter_entry_affix_DEPENDENCIES) $(EXTRA_alter_entry_affix_DEPENDENCIES) 
+	@rm -f alter_entry_affix$(EXEEXT)
+	$(LINK) $(alter_entry_affix_OBJECTS) $(alter_entry_affix_LDADD) $(LIBS)
+alter_entry_hidden$(EXEEXT): $(alter_entry_hidden_OBJECTS) $(alter_entry_hidden_DEPENDENCIES) $(EXTRA_alter_entry_hidden_DEPENDENCIES) 
+	@rm -f alter_entry_hidden$(EXEEXT)
+	$(LINK) $(alter_entry_hidden_OBJECTS) $(alter_entry_hidden_LDADD) $(LIBS)
+alter_entry_recode$(EXEEXT): $(alter_entry_recode_OBJECTS) $(alter_entry_recode_DEPENDENCIES) $(EXTRA_alter_entry_recode_DEPENDENCIES) 
 	@rm -f alter_entry_recode$(EXEEXT)
 	$(LINK) $(alter_entry_recode_OBJECTS) $(alter_entry_recode_LDADD) $(LIBS)
-alter_entry_scalar2a$(EXEEXT): $(alter_entry_scalar2a_OBJECTS) $(alter_entry_scalar2a_DEPENDENCIES) 
+alter_entry_scalar2a$(EXEEXT): $(alter_entry_scalar2a_OBJECTS) $(alter_entry_scalar2a_DEPENDENCIES) $(EXTRA_alter_entry_scalar2a_DEPENDENCIES) 
 	@rm -f alter_entry_scalar2a$(EXEEXT)
 	$(LINK) $(alter_entry_scalar2a_OBJECTS) $(alter_entry_scalar2a_LDADD) $(LIBS)
-alter_entry_scalar2n$(EXEEXT): $(alter_entry_scalar2n_OBJECTS) $(alter_entry_scalar2n_DEPENDENCIES) 
+alter_entry_scalar2n$(EXEEXT): $(alter_entry_scalar2n_OBJECTS) $(alter_entry_scalar2n_DEPENDENCIES) $(EXTRA_alter_entry_scalar2n_DEPENDENCIES) 
 	@rm -f alter_entry_scalar2n$(EXEEXT)
 	$(LINK) $(alter_entry_scalar2n_OBJECTS) $(alter_entry_scalar2n_LDADD) $(LIBS)
-alter_entry_scalar3$(EXEEXT): $(alter_entry_scalar3_OBJECTS) $(alter_entry_scalar3_DEPENDENCIES) 
+alter_entry_scalar3$(EXEEXT): $(alter_entry_scalar3_OBJECTS) $(alter_entry_scalar3_DEPENDENCIES) $(EXTRA_alter_entry_scalar3_DEPENDENCIES) 
 	@rm -f alter_entry_scalar3$(EXEEXT)
 	$(LINK) $(alter_entry_scalar3_OBJECTS) $(alter_entry_scalar3_LDADD) $(LIBS)
-alter_entry_scalar4$(EXEEXT): $(alter_entry_scalar4_OBJECTS) $(alter_entry_scalar4_DEPENDENCIES) 
+alter_entry_scalar4$(EXEEXT): $(alter_entry_scalar4_OBJECTS) $(alter_entry_scalar4_DEPENDENCIES) $(EXTRA_alter_entry_scalar4_DEPENDENCIES) 
 	@rm -f alter_entry_scalar4$(EXEEXT)
 	$(LINK) $(alter_entry_scalar4_OBJECTS) $(alter_entry_scalar4_LDADD) $(LIBS)
-alter_lincom_23$(EXEEXT): $(alter_lincom_23_OBJECTS) $(alter_lincom_23_DEPENDENCIES) 
+alter_lincom_23$(EXEEXT): $(alter_lincom_23_OBJECTS) $(alter_lincom_23_DEPENDENCIES) $(EXTRA_alter_lincom_23_DEPENDENCIES) 
 	@rm -f alter_lincom_23$(EXEEXT)
 	$(LINK) $(alter_lincom_23_OBJECTS) $(alter_lincom_23_LDADD) $(LIBS)
-alter_lincom_32$(EXEEXT): $(alter_lincom_32_OBJECTS) $(alter_lincom_32_DEPENDENCIES) 
+alter_lincom_32$(EXEEXT): $(alter_lincom_32_OBJECTS) $(alter_lincom_32_DEPENDENCIES) $(EXTRA_alter_lincom_32_DEPENDENCIES) 
 	@rm -f alter_lincom_32$(EXEEXT)
 	$(LINK) $(alter_lincom_32_OBJECTS) $(alter_lincom_32_LDADD) $(LIBS)
-alter_lincom_input$(EXEEXT): $(alter_lincom_input_OBJECTS) $(alter_lincom_input_DEPENDENCIES) 
+alter_lincom_affix$(EXEEXT): $(alter_lincom_affix_OBJECTS) $(alter_lincom_affix_DEPENDENCIES) $(EXTRA_alter_lincom_affix_DEPENDENCIES) 
+	@rm -f alter_lincom_affix$(EXEEXT)
+	$(LINK) $(alter_lincom_affix_OBJECTS) $(alter_lincom_affix_LDADD) $(LIBS)
+alter_lincom_input$(EXEEXT): $(alter_lincom_input_OBJECTS) $(alter_lincom_input_DEPENDENCIES) $(EXTRA_alter_lincom_input_DEPENDENCIES) 
 	@rm -f alter_lincom_input$(EXEEXT)
 	$(LINK) $(alter_lincom_input_OBJECTS) $(alter_lincom_input_LDADD) $(LIBS)
-alter_lincom_offset$(EXEEXT): $(alter_lincom_offset_OBJECTS) $(alter_lincom_offset_DEPENDENCIES) 
+alter_lincom_offset$(EXEEXT): $(alter_lincom_offset_OBJECTS) $(alter_lincom_offset_DEPENDENCIES) $(EXTRA_alter_lincom_offset_DEPENDENCIES) 
 	@rm -f alter_lincom_offset$(EXEEXT)
 	$(LINK) $(alter_lincom_offset_OBJECTS) $(alter_lincom_offset_LDADD) $(LIBS)
-alter_lincom_slope$(EXEEXT): $(alter_lincom_slope_OBJECTS) $(alter_lincom_slope_DEPENDENCIES) 
+alter_lincom_slope$(EXEEXT): $(alter_lincom_slope_OBJECTS) $(alter_lincom_slope_DEPENDENCIES) $(EXTRA_alter_lincom_slope_DEPENDENCIES) 
 	@rm -f alter_lincom_slope$(EXEEXT)
 	$(LINK) $(alter_lincom_slope_OBJECTS) $(alter_lincom_slope_LDADD) $(LIBS)
-alter_linterp$(EXEEXT): $(alter_linterp_OBJECTS) $(alter_linterp_DEPENDENCIES) 
+alter_linterp$(EXEEXT): $(alter_linterp_OBJECTS) $(alter_linterp_DEPENDENCIES) $(EXTRA_alter_linterp_DEPENDENCIES) 
 	@rm -f alter_linterp$(EXEEXT)
 	$(LINK) $(alter_linterp_OBJECTS) $(alter_linterp_LDADD) $(LIBS)
-alter_linterp_move$(EXEEXT): $(alter_linterp_move_OBJECTS) $(alter_linterp_move_DEPENDENCIES) 
+alter_linterp_move$(EXEEXT): $(alter_linterp_move_OBJECTS) $(alter_linterp_move_DEPENDENCIES) $(EXTRA_alter_linterp_move_DEPENDENCIES) 
 	@rm -f alter_linterp_move$(EXEEXT)
 	$(LINK) $(alter_linterp_move_OBJECTS) $(alter_linterp_move_LDADD) $(LIBS)
-alter_mspec$(EXEEXT): $(alter_mspec_OBJECTS) $(alter_mspec_DEPENDENCIES) 
+alter_mplex$(EXEEXT): $(alter_mplex_OBJECTS) $(alter_mplex_DEPENDENCIES) $(EXTRA_alter_mplex_DEPENDENCIES) 
+	@rm -f alter_mplex$(EXEEXT)
+	$(LINK) $(alter_mplex_OBJECTS) $(alter_mplex_LDADD) $(LIBS)
+alter_mspec$(EXEEXT): $(alter_mspec_OBJECTS) $(alter_mspec_DEPENDENCIES) $(EXTRA_alter_mspec_DEPENDENCIES) 
 	@rm -f alter_mspec$(EXEEXT)
 	$(LINK) $(alter_mspec_OBJECTS) $(alter_mspec_LDADD) $(LIBS)
-alter_multiply$(EXEEXT): $(alter_multiply_OBJECTS) $(alter_multiply_DEPENDENCIES) 
+alter_mspec_affix$(EXEEXT): $(alter_mspec_affix_OBJECTS) $(alter_mspec_affix_DEPENDENCIES) $(EXTRA_alter_mspec_affix_DEPENDENCIES) 
+	@rm -f alter_mspec_affix$(EXEEXT)
+	$(LINK) $(alter_mspec_affix_OBJECTS) $(alter_mspec_affix_LDADD) $(LIBS)
+alter_multiply$(EXEEXT): $(alter_multiply_OBJECTS) $(alter_multiply_DEPENDENCIES) $(EXTRA_alter_multiply_DEPENDENCIES) 
 	@rm -f alter_multiply$(EXEEXT)
 	$(LINK) $(alter_multiply_OBJECTS) $(alter_multiply_LDADD) $(LIBS)
-alter_phase$(EXEEXT): $(alter_phase_OBJECTS) $(alter_phase_DEPENDENCIES) 
+alter_phase$(EXEEXT): $(alter_phase_OBJECTS) $(alter_phase_DEPENDENCIES) $(EXTRA_alter_phase_DEPENDENCIES) 
 	@rm -f alter_phase$(EXEEXT)
 	$(LINK) $(alter_phase_OBJECTS) $(alter_phase_LDADD) $(LIBS)
-alter_polynom_coeff$(EXEEXT): $(alter_polynom_coeff_OBJECTS) $(alter_polynom_coeff_DEPENDENCIES) 
+alter_polynom_coeff$(EXEEXT): $(alter_polynom_coeff_OBJECTS) $(alter_polynom_coeff_DEPENDENCIES) $(EXTRA_alter_polynom_coeff_DEPENDENCIES) 
 	@rm -f alter_polynom_coeff$(EXEEXT)
 	$(LINK) $(alter_polynom_coeff_OBJECTS) $(alter_polynom_coeff_LDADD) $(LIBS)
-alter_polynom_input$(EXEEXT): $(alter_polynom_input_OBJECTS) $(alter_polynom_input_DEPENDENCIES) 
+alter_polynom_input$(EXEEXT): $(alter_polynom_input_OBJECTS) $(alter_polynom_input_DEPENDENCIES) $(EXTRA_alter_polynom_input_DEPENDENCIES) 
 	@rm -f alter_polynom_input$(EXEEXT)
 	$(LINK) $(alter_polynom_input_OBJECTS) $(alter_polynom_input_LDADD) $(LIBS)
-alter_polynom_ord$(EXEEXT): $(alter_polynom_ord_OBJECTS) $(alter_polynom_ord_DEPENDENCIES) 
+alter_polynom_ord$(EXEEXT): $(alter_polynom_ord_OBJECTS) $(alter_polynom_ord_DEPENDENCIES) $(EXTRA_alter_polynom_ord_DEPENDENCIES) 
 	@rm -f alter_polynom_ord$(EXEEXT)
 	$(LINK) $(alter_polynom_ord_OBJECTS) $(alter_polynom_ord_LDADD) $(LIBS)
-alter_raw_spf$(EXEEXT): $(alter_raw_spf_OBJECTS) $(alter_raw_spf_DEPENDENCIES) 
+alter_raw_spf$(EXEEXT): $(alter_raw_spf_OBJECTS) $(alter_raw_spf_DEPENDENCIES) $(EXTRA_alter_raw_spf_DEPENDENCIES) 
 	@rm -f alter_raw_spf$(EXEEXT)
 	$(LINK) $(alter_raw_spf_OBJECTS) $(alter_raw_spf_LDADD) $(LIBS)
-alter_raw_type$(EXEEXT): $(alter_raw_type_OBJECTS) $(alter_raw_type_DEPENDENCIES) 
+alter_raw_type$(EXEEXT): $(alter_raw_type_OBJECTS) $(alter_raw_type_DEPENDENCIES) $(EXTRA_alter_raw_type_DEPENDENCIES) 
 	@rm -f alter_raw_type$(EXEEXT)
 	$(LINK) $(alter_raw_type_OBJECTS) $(alter_raw_type_LDADD) $(LIBS)
-alter_recip$(EXEEXT): $(alter_recip_OBJECTS) $(alter_recip_DEPENDENCIES) 
+alter_recip$(EXEEXT): $(alter_recip_OBJECTS) $(alter_recip_DEPENDENCIES) $(EXTRA_alter_recip_DEPENDENCIES) 
 	@rm -f alter_recip$(EXEEXT)
 	$(LINK) $(alter_recip_OBJECTS) $(alter_recip_LDADD) $(LIBS)
-alter_recip_zero$(EXEEXT): $(alter_recip_zero_OBJECTS) $(alter_recip_zero_DEPENDENCIES) 
+alter_recip_zero$(EXEEXT): $(alter_recip_zero_OBJECTS) $(alter_recip_zero_DEPENDENCIES) $(EXTRA_alter_recip_zero_DEPENDENCIES) 
 	@rm -f alter_recip_zero$(EXEEXT)
 	$(LINK) $(alter_recip_zero_OBJECTS) $(alter_recip_zero_LDADD) $(LIBS)
-alter_spec$(EXEEXT): $(alter_spec_OBJECTS) $(alter_spec_DEPENDENCIES) 
+alter_scalar_affix$(EXEEXT): $(alter_scalar_affix_OBJECTS) $(alter_scalar_affix_DEPENDENCIES) $(EXTRA_alter_scalar_affix_DEPENDENCIES) 
+	@rm -f alter_scalar_affix$(EXEEXT)
+	$(LINK) $(alter_scalar_affix_OBJECTS) $(alter_scalar_affix_LDADD) $(LIBS)
+alter_spec$(EXEEXT): $(alter_spec_OBJECTS) $(alter_spec_DEPENDENCIES) $(EXTRA_alter_spec_DEPENDENCIES) 
 	@rm -f alter_spec$(EXEEXT)
 	$(LINK) $(alter_spec_OBJECTS) $(alter_spec_LDADD) $(LIBS)
-alter_spec_meta$(EXEEXT): $(alter_spec_meta_OBJECTS) $(alter_spec_meta_DEPENDENCIES) 
+alter_spec_affix$(EXEEXT): $(alter_spec_affix_OBJECTS) $(alter_spec_affix_DEPENDENCIES) $(EXTRA_alter_spec_affix_DEPENDENCIES) 
+	@rm -f alter_spec_affix$(EXEEXT)
+	$(LINK) $(alter_spec_affix_OBJECTS) $(alter_spec_affix_LDADD) $(LIBS)
+alter_spec_meta$(EXEEXT): $(alter_spec_meta_OBJECTS) $(alter_spec_meta_DEPENDENCIES) $(EXTRA_alter_spec_meta_DEPENDENCIES) 
 	@rm -f alter_spec_meta$(EXEEXT)
 	$(LINK) $(alter_spec_meta_OBJECTS) $(alter_spec_meta_LDADD) $(LIBS)
-ascii_get$(EXEEXT): $(ascii_get_OBJECTS) $(ascii_get_DEPENDENCIES) 
+alter_window$(EXEEXT): $(alter_window_OBJECTS) $(alter_window_DEPENDENCIES) $(EXTRA_alter_window_DEPENDENCIES) 
+	@rm -f alter_window$(EXEEXT)
+	$(LINK) $(alter_window_OBJECTS) $(alter_window_LDADD) $(LIBS)
+ascii_add$(EXEEXT): $(ascii_add_OBJECTS) $(ascii_add_DEPENDENCIES) $(EXTRA_ascii_add_DEPENDENCIES) 
+	@rm -f ascii_add$(EXEEXT)
+	$(LINK) $(ascii_add_OBJECTS) $(ascii_add_LDADD) $(LIBS)
+ascii_get$(EXEEXT): $(ascii_get_OBJECTS) $(ascii_get_DEPENDENCIES) $(EXTRA_ascii_get_DEPENDENCIES) 
 	@rm -f ascii_get$(EXEEXT)
 	$(LINK) $(ascii_get_OBJECTS) $(ascii_get_LDADD) $(LIBS)
-ascii_get_get$(EXEEXT): $(ascii_get_get_OBJECTS) $(ascii_get_get_DEPENDENCIES) 
+ascii_get_get$(EXEEXT): $(ascii_get_get_OBJECTS) $(ascii_get_get_DEPENDENCIES) $(EXTRA_ascii_get_get_DEPENDENCIES) 
 	@rm -f ascii_get_get$(EXEEXT)
 	$(LINK) $(ascii_get_get_OBJECTS) $(ascii_get_get_LDADD) $(LIBS)
-ascii_nframes$(EXEEXT): $(ascii_nframes_OBJECTS) $(ascii_nframes_DEPENDENCIES) 
+ascii_nframes$(EXEEXT): $(ascii_nframes_OBJECTS) $(ascii_nframes_DEPENDENCIES) $(EXTRA_ascii_nframes_DEPENDENCIES) 
 	@rm -f ascii_nframes$(EXEEXT)
 	$(LINK) $(ascii_nframes_OBJECTS) $(ascii_nframes_LDADD) $(LIBS)
-ascii_put$(EXEEXT): $(ascii_put_OBJECTS) $(ascii_put_DEPENDENCIES) 
+ascii_put$(EXEEXT): $(ascii_put_OBJECTS) $(ascii_put_DEPENDENCIES) $(EXTRA_ascii_put_DEPENDENCIES) 
 	@rm -f ascii_put$(EXEEXT)
 	$(LINK) $(ascii_put_OBJECTS) $(ascii_put_LDADD) $(LIBS)
-bof$(EXEEXT): $(bof_OBJECTS) $(bof_DEPENDENCIES) 
+bof$(EXEEXT): $(bof_OBJECTS) $(bof_DEPENDENCIES) $(EXTRA_bof_DEPENDENCIES) 
 	@rm -f bof$(EXEEXT)
 	$(LINK) $(bof_OBJECTS) $(bof_LDADD) $(LIBS)
-bof_lincom$(EXEEXT): $(bof_lincom_OBJECTS) $(bof_lincom_DEPENDENCIES) 
+bof_lincom$(EXEEXT): $(bof_lincom_OBJECTS) $(bof_lincom_DEPENDENCIES) $(EXTRA_bof_lincom_DEPENDENCIES) 
 	@rm -f bof_lincom$(EXEEXT)
 	$(LINK) $(bof_lincom_OBJECTS) $(bof_lincom_LDADD) $(LIBS)
-bof_phase$(EXEEXT): $(bof_phase_OBJECTS) $(bof_phase_DEPENDENCIES) 
+bof_phase$(EXEEXT): $(bof_phase_OBJECTS) $(bof_phase_DEPENDENCIES) $(EXTRA_bof_phase_DEPENDENCIES) 
 	@rm -f bof_phase$(EXEEXT)
 	$(LINK) $(bof_phase_OBJECTS) $(bof_phase_LDADD) $(LIBS)
-bzip_get$(EXEEXT): $(bzip_get_OBJECTS) $(bzip_get_DEPENDENCIES) 
+bzip_get$(EXEEXT): $(bzip_get_OBJECTS) $(bzip_get_DEPENDENCIES) $(EXTRA_bzip_get_DEPENDENCIES) 
 	@rm -f bzip_get$(EXEEXT)
 	$(LINK) $(bzip_get_OBJECTS) $(bzip_get_LDADD) $(LIBS)
-bzip_get_get$(EXEEXT): $(bzip_get_get_OBJECTS) $(bzip_get_get_DEPENDENCIES) 
+bzip_get_get$(EXEEXT): $(bzip_get_get_OBJECTS) $(bzip_get_get_DEPENDENCIES) $(EXTRA_bzip_get_get_DEPENDENCIES) 
 	@rm -f bzip_get_get$(EXEEXT)
 	$(LINK) $(bzip_get_get_OBJECTS) $(bzip_get_get_LDADD) $(LIBS)
-bzip_move_from$(EXEEXT): $(bzip_move_from_OBJECTS) $(bzip_move_from_DEPENDENCIES) 
+bzip_move_from$(EXEEXT): $(bzip_move_from_OBJECTS) $(bzip_move_from_DEPENDENCIES) $(EXTRA_bzip_move_from_DEPENDENCIES) 
 	@rm -f bzip_move_from$(EXEEXT)
 	$(LINK) $(bzip_move_from_OBJECTS) $(bzip_move_from_LDADD) $(LIBS)
-bzip_nframes$(EXEEXT): $(bzip_nframes_OBJECTS) $(bzip_nframes_DEPENDENCIES) 
+bzip_nframes$(EXEEXT): $(bzip_nframes_OBJECTS) $(bzip_nframes_DEPENDENCIES) $(EXTRA_bzip_nframes_DEPENDENCIES) 
 	@rm -f bzip_nframes$(EXEEXT)
 	$(LINK) $(bzip_nframes_OBJECTS) $(bzip_nframes_LDADD) $(LIBS)
-close$(EXEEXT): $(close_OBJECTS) $(close_DEPENDENCIES) 
+close$(EXEEXT): $(close_OBJECTS) $(close_DEPENDENCIES) $(EXTRA_close_DEPENDENCIES) 
 	@rm -f close$(EXEEXT)
 	$(LINK) $(close_OBJECTS) $(close_LDADD) $(LIBS)
-close_bad$(EXEEXT): $(close_bad_OBJECTS) $(close_bad_DEPENDENCIES) 
+close_bad$(EXEEXT): $(close_bad_OBJECTS) $(close_bad_DEPENDENCIES) $(EXTRA_close_bad_DEPENDENCIES) 
 	@rm -f close_bad$(EXEEXT)
 	$(LINK) $(close_bad_OBJECTS) $(close_bad_LDADD) $(LIBS)
-close_discard$(EXEEXT): $(close_discard_OBJECTS) $(close_discard_DEPENDENCIES) 
+close_discard$(EXEEXT): $(close_discard_OBJECTS) $(close_discard_DEPENDENCIES) $(EXTRA_close_discard_DEPENDENCIES) 
 	@rm -f close_discard$(EXEEXT)
 	$(LINK) $(close_discard_OBJECTS) $(close_discard_LDADD) $(LIBS)
-close_null$(EXEEXT): $(close_null_OBJECTS) $(close_null_DEPENDENCIES) 
+close_null$(EXEEXT): $(close_null_OBJECTS) $(close_null_DEPENDENCIES) $(EXTRA_close_null_DEPENDENCIES) 
 	@rm -f close_null$(EXEEXT)
 	$(LINK) $(close_null_OBJECTS) $(close_null_LDADD) $(LIBS)
-convert_complex128_complex64$(EXEEXT): $(convert_complex128_complex64_OBJECTS) $(convert_complex128_complex64_DEPENDENCIES) 
+convert_complex128_complex64$(EXEEXT): $(convert_complex128_complex64_OBJECTS) $(convert_complex128_complex64_DEPENDENCIES) $(EXTRA_convert_complex128_complex64_DEPENDENCIES) 
 	@rm -f convert_complex128_complex64$(EXEEXT)
 	$(LINK) $(convert_complex128_complex64_OBJECTS) $(convert_complex128_complex64_LDADD) $(LIBS)
-convert_complex128_float64$(EXEEXT): $(convert_complex128_float64_OBJECTS) $(convert_complex128_float64_DEPENDENCIES) 
+convert_complex128_float64$(EXEEXT): $(convert_complex128_float64_OBJECTS) $(convert_complex128_float64_DEPENDENCIES) $(EXTRA_convert_complex128_float64_DEPENDENCIES) 
 	@rm -f convert_complex128_float64$(EXEEXT)
 	$(LINK) $(convert_complex128_float64_OBJECTS) $(convert_complex128_float64_LDADD) $(LIBS)
-convert_complex128_int64$(EXEEXT): $(convert_complex128_int64_OBJECTS) $(convert_complex128_int64_DEPENDENCIES) 
+convert_complex128_int64$(EXEEXT): $(convert_complex128_int64_OBJECTS) $(convert_complex128_int64_DEPENDENCIES) $(EXTRA_convert_complex128_int64_DEPENDENCIES) 
 	@rm -f convert_complex128_int64$(EXEEXT)
 	$(LINK) $(convert_complex128_int64_OBJECTS) $(convert_complex128_int64_LDADD) $(LIBS)
-convert_complex128_uint64$(EXEEXT): $(convert_complex128_uint64_OBJECTS) $(convert_complex128_uint64_DEPENDENCIES) 
+convert_complex128_uint64$(EXEEXT): $(convert_complex128_uint64_OBJECTS) $(convert_complex128_uint64_DEPENDENCIES) $(EXTRA_convert_complex128_uint64_DEPENDENCIES) 
 	@rm -f convert_complex128_uint64$(EXEEXT)
 	$(LINK) $(convert_complex128_uint64_OBJECTS) $(convert_complex128_uint64_LDADD) $(LIBS)
-convert_complex64_complex128$(EXEEXT): $(convert_complex64_complex128_OBJECTS) $(convert_complex64_complex128_DEPENDENCIES) 
+convert_complex64_complex128$(EXEEXT): $(convert_complex64_complex128_OBJECTS) $(convert_complex64_complex128_DEPENDENCIES) $(EXTRA_convert_complex64_complex128_DEPENDENCIES) 
 	@rm -f convert_complex64_complex128$(EXEEXT)
 	$(LINK) $(convert_complex64_complex128_OBJECTS) $(convert_complex64_complex128_LDADD) $(LIBS)
-convert_complex64_float64$(EXEEXT): $(convert_complex64_float64_OBJECTS) $(convert_complex64_float64_DEPENDENCIES) 
+convert_complex64_float64$(EXEEXT): $(convert_complex64_float64_OBJECTS) $(convert_complex64_float64_DEPENDENCIES) $(EXTRA_convert_complex64_float64_DEPENDENCIES) 
 	@rm -f convert_complex64_float64$(EXEEXT)
 	$(LINK) $(convert_complex64_float64_OBJECTS) $(convert_complex64_float64_LDADD) $(LIBS)
-convert_complex64_int64$(EXEEXT): $(convert_complex64_int64_OBJECTS) $(convert_complex64_int64_DEPENDENCIES) 
+convert_complex64_int64$(EXEEXT): $(convert_complex64_int64_OBJECTS) $(convert_complex64_int64_DEPENDENCIES) $(EXTRA_convert_complex64_int64_DEPENDENCIES) 
 	@rm -f convert_complex64_int64$(EXEEXT)
 	$(LINK) $(convert_complex64_int64_OBJECTS) $(convert_complex64_int64_LDADD) $(LIBS)
-convert_complex64_uint64$(EXEEXT): $(convert_complex64_uint64_OBJECTS) $(convert_complex64_uint64_DEPENDENCIES) 
+convert_complex64_uint64$(EXEEXT): $(convert_complex64_uint64_OBJECTS) $(convert_complex64_uint64_DEPENDENCIES) $(EXTRA_convert_complex64_uint64_DEPENDENCIES) 
 	@rm -f convert_complex64_uint64$(EXEEXT)
 	$(LINK) $(convert_complex64_uint64_OBJECTS) $(convert_complex64_uint64_LDADD) $(LIBS)
-convert_float32_complex128$(EXEEXT): $(convert_float32_complex128_OBJECTS) $(convert_float32_complex128_DEPENDENCIES) 
+convert_float32_complex128$(EXEEXT): $(convert_float32_complex128_OBJECTS) $(convert_float32_complex128_DEPENDENCIES) $(EXTRA_convert_float32_complex128_DEPENDENCIES) 
 	@rm -f convert_float32_complex128$(EXEEXT)
 	$(LINK) $(convert_float32_complex128_OBJECTS) $(convert_float32_complex128_LDADD) $(LIBS)
-convert_float32_complex64$(EXEEXT): $(convert_float32_complex64_OBJECTS) $(convert_float32_complex64_DEPENDENCIES) 
+convert_float32_complex64$(EXEEXT): $(convert_float32_complex64_OBJECTS) $(convert_float32_complex64_DEPENDENCIES) $(EXTRA_convert_float32_complex64_DEPENDENCIES) 
 	@rm -f convert_float32_complex64$(EXEEXT)
 	$(LINK) $(convert_float32_complex64_OBJECTS) $(convert_float32_complex64_LDADD) $(LIBS)
-convert_float32_float64$(EXEEXT): $(convert_float32_float64_OBJECTS) $(convert_float32_float64_DEPENDENCIES) 
+convert_float32_float64$(EXEEXT): $(convert_float32_float64_OBJECTS) $(convert_float32_float64_DEPENDENCIES) $(EXTRA_convert_float32_float64_DEPENDENCIES) 
 	@rm -f convert_float32_float64$(EXEEXT)
 	$(LINK) $(convert_float32_float64_OBJECTS) $(convert_float32_float64_LDADD) $(LIBS)
-convert_float32_int16$(EXEEXT): $(convert_float32_int16_OBJECTS) $(convert_float32_int16_DEPENDENCIES) 
+convert_float32_int16$(EXEEXT): $(convert_float32_int16_OBJECTS) $(convert_float32_int16_DEPENDENCIES) $(EXTRA_convert_float32_int16_DEPENDENCIES) 
 	@rm -f convert_float32_int16$(EXEEXT)
 	$(LINK) $(convert_float32_int16_OBJECTS) $(convert_float32_int16_LDADD) $(LIBS)
-convert_float32_int32$(EXEEXT): $(convert_float32_int32_OBJECTS) $(convert_float32_int32_DEPENDENCIES) 
+convert_float32_int32$(EXEEXT): $(convert_float32_int32_OBJECTS) $(convert_float32_int32_DEPENDENCIES) $(EXTRA_convert_float32_int32_DEPENDENCIES) 
 	@rm -f convert_float32_int32$(EXEEXT)
 	$(LINK) $(convert_float32_int32_OBJECTS) $(convert_float32_int32_LDADD) $(LIBS)
-convert_float32_int64$(EXEEXT): $(convert_float32_int64_OBJECTS) $(convert_float32_int64_DEPENDENCIES) 
+convert_float32_int64$(EXEEXT): $(convert_float32_int64_OBJECTS) $(convert_float32_int64_DEPENDENCIES) $(EXTRA_convert_float32_int64_DEPENDENCIES) 
 	@rm -f convert_float32_int64$(EXEEXT)
 	$(LINK) $(convert_float32_int64_OBJECTS) $(convert_float32_int64_LDADD) $(LIBS)
-convert_float32_int8$(EXEEXT): $(convert_float32_int8_OBJECTS) $(convert_float32_int8_DEPENDENCIES) 
+convert_float32_int8$(EXEEXT): $(convert_float32_int8_OBJECTS) $(convert_float32_int8_DEPENDENCIES) $(EXTRA_convert_float32_int8_DEPENDENCIES) 
 	@rm -f convert_float32_int8$(EXEEXT)
 	$(LINK) $(convert_float32_int8_OBJECTS) $(convert_float32_int8_LDADD) $(LIBS)
-convert_float32_uint16$(EXEEXT): $(convert_float32_uint16_OBJECTS) $(convert_float32_uint16_DEPENDENCIES) 
+convert_float32_uint16$(EXEEXT): $(convert_float32_uint16_OBJECTS) $(convert_float32_uint16_DEPENDENCIES) $(EXTRA_convert_float32_uint16_DEPENDENCIES) 
 	@rm -f convert_float32_uint16$(EXEEXT)
 	$(LINK) $(convert_float32_uint16_OBJECTS) $(convert_float32_uint16_LDADD) $(LIBS)
-convert_float32_uint32$(EXEEXT): $(convert_float32_uint32_OBJECTS) $(convert_float32_uint32_DEPENDENCIES) 
+convert_float32_uint32$(EXEEXT): $(convert_float32_uint32_OBJECTS) $(convert_float32_uint32_DEPENDENCIES) $(EXTRA_convert_float32_uint32_DEPENDENCIES) 
 	@rm -f convert_float32_uint32$(EXEEXT)
 	$(LINK) $(convert_float32_uint32_OBJECTS) $(convert_float32_uint32_LDADD) $(LIBS)
-convert_float32_uint64$(EXEEXT): $(convert_float32_uint64_OBJECTS) $(convert_float32_uint64_DEPENDENCIES) 
+convert_float32_uint64$(EXEEXT): $(convert_float32_uint64_OBJECTS) $(convert_float32_uint64_DEPENDENCIES) $(EXTRA_convert_float32_uint64_DEPENDENCIES) 
 	@rm -f convert_float32_uint64$(EXEEXT)
 	$(LINK) $(convert_float32_uint64_OBJECTS) $(convert_float32_uint64_LDADD) $(LIBS)
-convert_float32_uint8$(EXEEXT): $(convert_float32_uint8_OBJECTS) $(convert_float32_uint8_DEPENDENCIES) 
+convert_float32_uint8$(EXEEXT): $(convert_float32_uint8_OBJECTS) $(convert_float32_uint8_DEPENDENCIES) $(EXTRA_convert_float32_uint8_DEPENDENCIES) 
 	@rm -f convert_float32_uint8$(EXEEXT)
 	$(LINK) $(convert_float32_uint8_OBJECTS) $(convert_float32_uint8_LDADD) $(LIBS)
-convert_float64_complex128$(EXEEXT): $(convert_float64_complex128_OBJECTS) $(convert_float64_complex128_DEPENDENCIES) 
+convert_float64_complex128$(EXEEXT): $(convert_float64_complex128_OBJECTS) $(convert_float64_complex128_DEPENDENCIES) $(EXTRA_convert_float64_complex128_DEPENDENCIES) 
 	@rm -f convert_float64_complex128$(EXEEXT)
 	$(LINK) $(convert_float64_complex128_OBJECTS) $(convert_float64_complex128_LDADD) $(LIBS)
-convert_float64_complex64$(EXEEXT): $(convert_float64_complex64_OBJECTS) $(convert_float64_complex64_DEPENDENCIES) 
+convert_float64_complex64$(EXEEXT): $(convert_float64_complex64_OBJECTS) $(convert_float64_complex64_DEPENDENCIES) $(EXTRA_convert_float64_complex64_DEPENDENCIES) 
 	@rm -f convert_float64_complex64$(EXEEXT)
 	$(LINK) $(convert_float64_complex64_OBJECTS) $(convert_float64_complex64_LDADD) $(LIBS)
-convert_float64_float32$(EXEEXT): $(convert_float64_float32_OBJECTS) $(convert_float64_float32_DEPENDENCIES) 
+convert_float64_float32$(EXEEXT): $(convert_float64_float32_OBJECTS) $(convert_float64_float32_DEPENDENCIES) $(EXTRA_convert_float64_float32_DEPENDENCIES) 
 	@rm -f convert_float64_float32$(EXEEXT)
 	$(LINK) $(convert_float64_float32_OBJECTS) $(convert_float64_float32_LDADD) $(LIBS)
-convert_float64_int16$(EXEEXT): $(convert_float64_int16_OBJECTS) $(convert_float64_int16_DEPENDENCIES) 
+convert_float64_int16$(EXEEXT): $(convert_float64_int16_OBJECTS) $(convert_float64_int16_DEPENDENCIES) $(EXTRA_convert_float64_int16_DEPENDENCIES) 
 	@rm -f convert_float64_int16$(EXEEXT)
 	$(LINK) $(convert_float64_int16_OBJECTS) $(convert_float64_int16_LDADD) $(LIBS)
-convert_float64_int32$(EXEEXT): $(convert_float64_int32_OBJECTS) $(convert_float64_int32_DEPENDENCIES) 
+convert_float64_int32$(EXEEXT): $(convert_float64_int32_OBJECTS) $(convert_float64_int32_DEPENDENCIES) $(EXTRA_convert_float64_int32_DEPENDENCIES) 
 	@rm -f convert_float64_int32$(EXEEXT)
 	$(LINK) $(convert_float64_int32_OBJECTS) $(convert_float64_int32_LDADD) $(LIBS)
-convert_float64_int64$(EXEEXT): $(convert_float64_int64_OBJECTS) $(convert_float64_int64_DEPENDENCIES) 
+convert_float64_int64$(EXEEXT): $(convert_float64_int64_OBJECTS) $(convert_float64_int64_DEPENDENCIES) $(EXTRA_convert_float64_int64_DEPENDENCIES) 
 	@rm -f convert_float64_int64$(EXEEXT)
 	$(LINK) $(convert_float64_int64_OBJECTS) $(convert_float64_int64_LDADD) $(LIBS)
-convert_float64_int8$(EXEEXT): $(convert_float64_int8_OBJECTS) $(convert_float64_int8_DEPENDENCIES) 
+convert_float64_int8$(EXEEXT): $(convert_float64_int8_OBJECTS) $(convert_float64_int8_DEPENDENCIES) $(EXTRA_convert_float64_int8_DEPENDENCIES) 
 	@rm -f convert_float64_int8$(EXEEXT)
 	$(LINK) $(convert_float64_int8_OBJECTS) $(convert_float64_int8_LDADD) $(LIBS)
-convert_float64_uint16$(EXEEXT): $(convert_float64_uint16_OBJECTS) $(convert_float64_uint16_DEPENDENCIES) 
+convert_float64_uint16$(EXEEXT): $(convert_float64_uint16_OBJECTS) $(convert_float64_uint16_DEPENDENCIES) $(EXTRA_convert_float64_uint16_DEPENDENCIES) 
 	@rm -f convert_float64_uint16$(EXEEXT)
 	$(LINK) $(convert_float64_uint16_OBJECTS) $(convert_float64_uint16_LDADD) $(LIBS)
-convert_float64_uint32$(EXEEXT): $(convert_float64_uint32_OBJECTS) $(convert_float64_uint32_DEPENDENCIES) 
+convert_float64_uint32$(EXEEXT): $(convert_float64_uint32_OBJECTS) $(convert_float64_uint32_DEPENDENCIES) $(EXTRA_convert_float64_uint32_DEPENDENCIES) 
 	@rm -f convert_float64_uint32$(EXEEXT)
 	$(LINK) $(convert_float64_uint32_OBJECTS) $(convert_float64_uint32_LDADD) $(LIBS)
-convert_float64_uint64$(EXEEXT): $(convert_float64_uint64_OBJECTS) $(convert_float64_uint64_DEPENDENCIES) 
+convert_float64_uint64$(EXEEXT): $(convert_float64_uint64_OBJECTS) $(convert_float64_uint64_DEPENDENCIES) $(EXTRA_convert_float64_uint64_DEPENDENCIES) 
 	@rm -f convert_float64_uint64$(EXEEXT)
 	$(LINK) $(convert_float64_uint64_OBJECTS) $(convert_float64_uint64_LDADD) $(LIBS)
-convert_float64_uint8$(EXEEXT): $(convert_float64_uint8_OBJECTS) $(convert_float64_uint8_DEPENDENCIES) 
+convert_float64_uint8$(EXEEXT): $(convert_float64_uint8_OBJECTS) $(convert_float64_uint8_DEPENDENCIES) $(EXTRA_convert_float64_uint8_DEPENDENCIES) 
 	@rm -f convert_float64_uint8$(EXEEXT)
 	$(LINK) $(convert_float64_uint8_OBJECTS) $(convert_float64_uint8_LDADD) $(LIBS)
-convert_int16_complex128$(EXEEXT): $(convert_int16_complex128_OBJECTS) $(convert_int16_complex128_DEPENDENCIES) 
+convert_int16_complex128$(EXEEXT): $(convert_int16_complex128_OBJECTS) $(convert_int16_complex128_DEPENDENCIES) $(EXTRA_convert_int16_complex128_DEPENDENCIES) 
 	@rm -f convert_int16_complex128$(EXEEXT)
 	$(LINK) $(convert_int16_complex128_OBJECTS) $(convert_int16_complex128_LDADD) $(LIBS)
-convert_int16_complex64$(EXEEXT): $(convert_int16_complex64_OBJECTS) $(convert_int16_complex64_DEPENDENCIES) 
+convert_int16_complex64$(EXEEXT): $(convert_int16_complex64_OBJECTS) $(convert_int16_complex64_DEPENDENCIES) $(EXTRA_convert_int16_complex64_DEPENDENCIES) 
 	@rm -f convert_int16_complex64$(EXEEXT)
 	$(LINK) $(convert_int16_complex64_OBJECTS) $(convert_int16_complex64_LDADD) $(LIBS)
-convert_int16_float32$(EXEEXT): $(convert_int16_float32_OBJECTS) $(convert_int16_float32_DEPENDENCIES) 
+convert_int16_float32$(EXEEXT): $(convert_int16_float32_OBJECTS) $(convert_int16_float32_DEPENDENCIES) $(EXTRA_convert_int16_float32_DEPENDENCIES) 
 	@rm -f convert_int16_float32$(EXEEXT)
 	$(LINK) $(convert_int16_float32_OBJECTS) $(convert_int16_float32_LDADD) $(LIBS)
-convert_int16_float64$(EXEEXT): $(convert_int16_float64_OBJECTS) $(convert_int16_float64_DEPENDENCIES) 
+convert_int16_float64$(EXEEXT): $(convert_int16_float64_OBJECTS) $(convert_int16_float64_DEPENDENCIES) $(EXTRA_convert_int16_float64_DEPENDENCIES) 
 	@rm -f convert_int16_float64$(EXEEXT)
 	$(LINK) $(convert_int16_float64_OBJECTS) $(convert_int16_float64_LDADD) $(LIBS)
-convert_int16_int32$(EXEEXT): $(convert_int16_int32_OBJECTS) $(convert_int16_int32_DEPENDENCIES) 
+convert_int16_int32$(EXEEXT): $(convert_int16_int32_OBJECTS) $(convert_int16_int32_DEPENDENCIES) $(EXTRA_convert_int16_int32_DEPENDENCIES) 
 	@rm -f convert_int16_int32$(EXEEXT)
 	$(LINK) $(convert_int16_int32_OBJECTS) $(convert_int16_int32_LDADD) $(LIBS)
-convert_int16_int64$(EXEEXT): $(convert_int16_int64_OBJECTS) $(convert_int16_int64_DEPENDENCIES) 
+convert_int16_int64$(EXEEXT): $(convert_int16_int64_OBJECTS) $(convert_int16_int64_DEPENDENCIES) $(EXTRA_convert_int16_int64_DEPENDENCIES) 
 	@rm -f convert_int16_int64$(EXEEXT)
 	$(LINK) $(convert_int16_int64_OBJECTS) $(convert_int16_int64_LDADD) $(LIBS)
-convert_int16_int8$(EXEEXT): $(convert_int16_int8_OBJECTS) $(convert_int16_int8_DEPENDENCIES) 
+convert_int16_int8$(EXEEXT): $(convert_int16_int8_OBJECTS) $(convert_int16_int8_DEPENDENCIES) $(EXTRA_convert_int16_int8_DEPENDENCIES) 
 	@rm -f convert_int16_int8$(EXEEXT)
 	$(LINK) $(convert_int16_int8_OBJECTS) $(convert_int16_int8_LDADD) $(LIBS)
-convert_int16_uint16$(EXEEXT): $(convert_int16_uint16_OBJECTS) $(convert_int16_uint16_DEPENDENCIES) 
+convert_int16_uint16$(EXEEXT): $(convert_int16_uint16_OBJECTS) $(convert_int16_uint16_DEPENDENCIES) $(EXTRA_convert_int16_uint16_DEPENDENCIES) 
 	@rm -f convert_int16_uint16$(EXEEXT)
 	$(LINK) $(convert_int16_uint16_OBJECTS) $(convert_int16_uint16_LDADD) $(LIBS)
-convert_int16_uint32$(EXEEXT): $(convert_int16_uint32_OBJECTS) $(convert_int16_uint32_DEPENDENCIES) 
+convert_int16_uint32$(EXEEXT): $(convert_int16_uint32_OBJECTS) $(convert_int16_uint32_DEPENDENCIES) $(EXTRA_convert_int16_uint32_DEPENDENCIES) 
 	@rm -f convert_int16_uint32$(EXEEXT)
 	$(LINK) $(convert_int16_uint32_OBJECTS) $(convert_int16_uint32_LDADD) $(LIBS)
-convert_int16_uint64$(EXEEXT): $(convert_int16_uint64_OBJECTS) $(convert_int16_uint64_DEPENDENCIES) 
+convert_int16_uint64$(EXEEXT): $(convert_int16_uint64_OBJECTS) $(convert_int16_uint64_DEPENDENCIES) $(EXTRA_convert_int16_uint64_DEPENDENCIES) 
 	@rm -f convert_int16_uint64$(EXEEXT)
 	$(LINK) $(convert_int16_uint64_OBJECTS) $(convert_int16_uint64_LDADD) $(LIBS)
-convert_int16_uint8$(EXEEXT): $(convert_int16_uint8_OBJECTS) $(convert_int16_uint8_DEPENDENCIES) 
+convert_int16_uint8$(EXEEXT): $(convert_int16_uint8_OBJECTS) $(convert_int16_uint8_DEPENDENCIES) $(EXTRA_convert_int16_uint8_DEPENDENCIES) 
 	@rm -f convert_int16_uint8$(EXEEXT)
 	$(LINK) $(convert_int16_uint8_OBJECTS) $(convert_int16_uint8_LDADD) $(LIBS)
-convert_int32_complex128$(EXEEXT): $(convert_int32_complex128_OBJECTS) $(convert_int32_complex128_DEPENDENCIES) 
+convert_int32_complex128$(EXEEXT): $(convert_int32_complex128_OBJECTS) $(convert_int32_complex128_DEPENDENCIES) $(EXTRA_convert_int32_complex128_DEPENDENCIES) 
 	@rm -f convert_int32_complex128$(EXEEXT)
 	$(LINK) $(convert_int32_complex128_OBJECTS) $(convert_int32_complex128_LDADD) $(LIBS)
-convert_int32_complex64$(EXEEXT): $(convert_int32_complex64_OBJECTS) $(convert_int32_complex64_DEPENDENCIES) 
+convert_int32_complex64$(EXEEXT): $(convert_int32_complex64_OBJECTS) $(convert_int32_complex64_DEPENDENCIES) $(EXTRA_convert_int32_complex64_DEPENDENCIES) 
 	@rm -f convert_int32_complex64$(EXEEXT)
 	$(LINK) $(convert_int32_complex64_OBJECTS) $(convert_int32_complex64_LDADD) $(LIBS)
-convert_int32_float32$(EXEEXT): $(convert_int32_float32_OBJECTS) $(convert_int32_float32_DEPENDENCIES) 
+convert_int32_float32$(EXEEXT): $(convert_int32_float32_OBJECTS) $(convert_int32_float32_DEPENDENCIES) $(EXTRA_convert_int32_float32_DEPENDENCIES) 
 	@rm -f convert_int32_float32$(EXEEXT)
 	$(LINK) $(convert_int32_float32_OBJECTS) $(convert_int32_float32_LDADD) $(LIBS)
-convert_int32_float64$(EXEEXT): $(convert_int32_float64_OBJECTS) $(convert_int32_float64_DEPENDENCIES) 
+convert_int32_float64$(EXEEXT): $(convert_int32_float64_OBJECTS) $(convert_int32_float64_DEPENDENCIES) $(EXTRA_convert_int32_float64_DEPENDENCIES) 
 	@rm -f convert_int32_float64$(EXEEXT)
 	$(LINK) $(convert_int32_float64_OBJECTS) $(convert_int32_float64_LDADD) $(LIBS)
-convert_int32_int16$(EXEEXT): $(convert_int32_int16_OBJECTS) $(convert_int32_int16_DEPENDENCIES) 
+convert_int32_int16$(EXEEXT): $(convert_int32_int16_OBJECTS) $(convert_int32_int16_DEPENDENCIES) $(EXTRA_convert_int32_int16_DEPENDENCIES) 
 	@rm -f convert_int32_int16$(EXEEXT)
 	$(LINK) $(convert_int32_int16_OBJECTS) $(convert_int32_int16_LDADD) $(LIBS)
-convert_int32_int64$(EXEEXT): $(convert_int32_int64_OBJECTS) $(convert_int32_int64_DEPENDENCIES) 
+convert_int32_int64$(EXEEXT): $(convert_int32_int64_OBJECTS) $(convert_int32_int64_DEPENDENCIES) $(EXTRA_convert_int32_int64_DEPENDENCIES) 
 	@rm -f convert_int32_int64$(EXEEXT)
 	$(LINK) $(convert_int32_int64_OBJECTS) $(convert_int32_int64_LDADD) $(LIBS)
-convert_int32_int8$(EXEEXT): $(convert_int32_int8_OBJECTS) $(convert_int32_int8_DEPENDENCIES) 
+convert_int32_int8$(EXEEXT): $(convert_int32_int8_OBJECTS) $(convert_int32_int8_DEPENDENCIES) $(EXTRA_convert_int32_int8_DEPENDENCIES) 
 	@rm -f convert_int32_int8$(EXEEXT)
 	$(LINK) $(convert_int32_int8_OBJECTS) $(convert_int32_int8_LDADD) $(LIBS)
-convert_int32_uint16$(EXEEXT): $(convert_int32_uint16_OBJECTS) $(convert_int32_uint16_DEPENDENCIES) 
+convert_int32_uint16$(EXEEXT): $(convert_int32_uint16_OBJECTS) $(convert_int32_uint16_DEPENDENCIES) $(EXTRA_convert_int32_uint16_DEPENDENCIES) 
 	@rm -f convert_int32_uint16$(EXEEXT)
 	$(LINK) $(convert_int32_uint16_OBJECTS) $(convert_int32_uint16_LDADD) $(LIBS)
-convert_int32_uint32$(EXEEXT): $(convert_int32_uint32_OBJECTS) $(convert_int32_uint32_DEPENDENCIES) 
+convert_int32_uint32$(EXEEXT): $(convert_int32_uint32_OBJECTS) $(convert_int32_uint32_DEPENDENCIES) $(EXTRA_convert_int32_uint32_DEPENDENCIES) 
 	@rm -f convert_int32_uint32$(EXEEXT)
 	$(LINK) $(convert_int32_uint32_OBJECTS) $(convert_int32_uint32_LDADD) $(LIBS)
-convert_int32_uint64$(EXEEXT): $(convert_int32_uint64_OBJECTS) $(convert_int32_uint64_DEPENDENCIES) 
+convert_int32_uint64$(EXEEXT): $(convert_int32_uint64_OBJECTS) $(convert_int32_uint64_DEPENDENCIES) $(EXTRA_convert_int32_uint64_DEPENDENCIES) 
 	@rm -f convert_int32_uint64$(EXEEXT)
 	$(LINK) $(convert_int32_uint64_OBJECTS) $(convert_int32_uint64_LDADD) $(LIBS)
-convert_int32_uint8$(EXEEXT): $(convert_int32_uint8_OBJECTS) $(convert_int32_uint8_DEPENDENCIES) 
+convert_int32_uint8$(EXEEXT): $(convert_int32_uint8_OBJECTS) $(convert_int32_uint8_DEPENDENCIES) $(EXTRA_convert_int32_uint8_DEPENDENCIES) 
 	@rm -f convert_int32_uint8$(EXEEXT)
 	$(LINK) $(convert_int32_uint8_OBJECTS) $(convert_int32_uint8_LDADD) $(LIBS)
-convert_int64_complex128$(EXEEXT): $(convert_int64_complex128_OBJECTS) $(convert_int64_complex128_DEPENDENCIES) 
+convert_int64_complex128$(EXEEXT): $(convert_int64_complex128_OBJECTS) $(convert_int64_complex128_DEPENDENCIES) $(EXTRA_convert_int64_complex128_DEPENDENCIES) 
 	@rm -f convert_int64_complex128$(EXEEXT)
 	$(LINK) $(convert_int64_complex128_OBJECTS) $(convert_int64_complex128_LDADD) $(LIBS)
-convert_int64_complex64$(EXEEXT): $(convert_int64_complex64_OBJECTS) $(convert_int64_complex64_DEPENDENCIES) 
+convert_int64_complex64$(EXEEXT): $(convert_int64_complex64_OBJECTS) $(convert_int64_complex64_DEPENDENCIES) $(EXTRA_convert_int64_complex64_DEPENDENCIES) 
 	@rm -f convert_int64_complex64$(EXEEXT)
 	$(LINK) $(convert_int64_complex64_OBJECTS) $(convert_int64_complex64_LDADD) $(LIBS)
-convert_int64_float32$(EXEEXT): $(convert_int64_float32_OBJECTS) $(convert_int64_float32_DEPENDENCIES) 
+convert_int64_float32$(EXEEXT): $(convert_int64_float32_OBJECTS) $(convert_int64_float32_DEPENDENCIES) $(EXTRA_convert_int64_float32_DEPENDENCIES) 
 	@rm -f convert_int64_float32$(EXEEXT)
 	$(LINK) $(convert_int64_float32_OBJECTS) $(convert_int64_float32_LDADD) $(LIBS)
-convert_int64_float64$(EXEEXT): $(convert_int64_float64_OBJECTS) $(convert_int64_float64_DEPENDENCIES) 
+convert_int64_float64$(EXEEXT): $(convert_int64_float64_OBJECTS) $(convert_int64_float64_DEPENDENCIES) $(EXTRA_convert_int64_float64_DEPENDENCIES) 
 	@rm -f convert_int64_float64$(EXEEXT)
 	$(LINK) $(convert_int64_float64_OBJECTS) $(convert_int64_float64_LDADD) $(LIBS)
-convert_int64_int16$(EXEEXT): $(convert_int64_int16_OBJECTS) $(convert_int64_int16_DEPENDENCIES) 
+convert_int64_int16$(EXEEXT): $(convert_int64_int16_OBJECTS) $(convert_int64_int16_DEPENDENCIES) $(EXTRA_convert_int64_int16_DEPENDENCIES) 
 	@rm -f convert_int64_int16$(EXEEXT)
 	$(LINK) $(convert_int64_int16_OBJECTS) $(convert_int64_int16_LDADD) $(LIBS)
-convert_int64_int32$(EXEEXT): $(convert_int64_int32_OBJECTS) $(convert_int64_int32_DEPENDENCIES) 
+convert_int64_int32$(EXEEXT): $(convert_int64_int32_OBJECTS) $(convert_int64_int32_DEPENDENCIES) $(EXTRA_convert_int64_int32_DEPENDENCIES) 
 	@rm -f convert_int64_int32$(EXEEXT)
 	$(LINK) $(convert_int64_int32_OBJECTS) $(convert_int64_int32_LDADD) $(LIBS)
-convert_int64_int8$(EXEEXT): $(convert_int64_int8_OBJECTS) $(convert_int64_int8_DEPENDENCIES) 
+convert_int64_int8$(EXEEXT): $(convert_int64_int8_OBJECTS) $(convert_int64_int8_DEPENDENCIES) $(EXTRA_convert_int64_int8_DEPENDENCIES) 
 	@rm -f convert_int64_int8$(EXEEXT)
 	$(LINK) $(convert_int64_int8_OBJECTS) $(convert_int64_int8_LDADD) $(LIBS)
-convert_int64_uint16$(EXEEXT): $(convert_int64_uint16_OBJECTS) $(convert_int64_uint16_DEPENDENCIES) 
+convert_int64_uint16$(EXEEXT): $(convert_int64_uint16_OBJECTS) $(convert_int64_uint16_DEPENDENCIES) $(EXTRA_convert_int64_uint16_DEPENDENCIES) 
 	@rm -f convert_int64_uint16$(EXEEXT)
 	$(LINK) $(convert_int64_uint16_OBJECTS) $(convert_int64_uint16_LDADD) $(LIBS)
-convert_int64_uint32$(EXEEXT): $(convert_int64_uint32_OBJECTS) $(convert_int64_uint32_DEPENDENCIES) 
+convert_int64_uint32$(EXEEXT): $(convert_int64_uint32_OBJECTS) $(convert_int64_uint32_DEPENDENCIES) $(EXTRA_convert_int64_uint32_DEPENDENCIES) 
 	@rm -f convert_int64_uint32$(EXEEXT)
 	$(LINK) $(convert_int64_uint32_OBJECTS) $(convert_int64_uint32_LDADD) $(LIBS)
-convert_int64_uint64$(EXEEXT): $(convert_int64_uint64_OBJECTS) $(convert_int64_uint64_DEPENDENCIES) 
+convert_int64_uint64$(EXEEXT): $(convert_int64_uint64_OBJECTS) $(convert_int64_uint64_DEPENDENCIES) $(EXTRA_convert_int64_uint64_DEPENDENCIES) 
 	@rm -f convert_int64_uint64$(EXEEXT)
 	$(LINK) $(convert_int64_uint64_OBJECTS) $(convert_int64_uint64_LDADD) $(LIBS)
-convert_int64_uint8$(EXEEXT): $(convert_int64_uint8_OBJECTS) $(convert_int64_uint8_DEPENDENCIES) 
+convert_int64_uint8$(EXEEXT): $(convert_int64_uint8_OBJECTS) $(convert_int64_uint8_DEPENDENCIES) $(EXTRA_convert_int64_uint8_DEPENDENCIES) 
 	@rm -f convert_int64_uint8$(EXEEXT)
 	$(LINK) $(convert_int64_uint8_OBJECTS) $(convert_int64_uint8_LDADD) $(LIBS)
-convert_int8_complex128$(EXEEXT): $(convert_int8_complex128_OBJECTS) $(convert_int8_complex128_DEPENDENCIES) 
+convert_int8_complex128$(EXEEXT): $(convert_int8_complex128_OBJECTS) $(convert_int8_complex128_DEPENDENCIES) $(EXTRA_convert_int8_complex128_DEPENDENCIES) 
 	@rm -f convert_int8_complex128$(EXEEXT)
 	$(LINK) $(convert_int8_complex128_OBJECTS) $(convert_int8_complex128_LDADD) $(LIBS)
-convert_int8_complex64$(EXEEXT): $(convert_int8_complex64_OBJECTS) $(convert_int8_complex64_DEPENDENCIES) 
+convert_int8_complex64$(EXEEXT): $(convert_int8_complex64_OBJECTS) $(convert_int8_complex64_DEPENDENCIES) $(EXTRA_convert_int8_complex64_DEPENDENCIES) 
 	@rm -f convert_int8_complex64$(EXEEXT)
 	$(LINK) $(convert_int8_complex64_OBJECTS) $(convert_int8_complex64_LDADD) $(LIBS)
-convert_int8_float32$(EXEEXT): $(convert_int8_float32_OBJECTS) $(convert_int8_float32_DEPENDENCIES) 
+convert_int8_float32$(EXEEXT): $(convert_int8_float32_OBJECTS) $(convert_int8_float32_DEPENDENCIES) $(EXTRA_convert_int8_float32_DEPENDENCIES) 
 	@rm -f convert_int8_float32$(EXEEXT)
 	$(LINK) $(convert_int8_float32_OBJECTS) $(convert_int8_float32_LDADD) $(LIBS)
-convert_int8_float64$(EXEEXT): $(convert_int8_float64_OBJECTS) $(convert_int8_float64_DEPENDENCIES) 
+convert_int8_float64$(EXEEXT): $(convert_int8_float64_OBJECTS) $(convert_int8_float64_DEPENDENCIES) $(EXTRA_convert_int8_float64_DEPENDENCIES) 
 	@rm -f convert_int8_float64$(EXEEXT)
 	$(LINK) $(convert_int8_float64_OBJECTS) $(convert_int8_float64_LDADD) $(LIBS)
-convert_int8_int16$(EXEEXT): $(convert_int8_int16_OBJECTS) $(convert_int8_int16_DEPENDENCIES) 
+convert_int8_int16$(EXEEXT): $(convert_int8_int16_OBJECTS) $(convert_int8_int16_DEPENDENCIES) $(EXTRA_convert_int8_int16_DEPENDENCIES) 
 	@rm -f convert_int8_int16$(EXEEXT)
 	$(LINK) $(convert_int8_int16_OBJECTS) $(convert_int8_int16_LDADD) $(LIBS)
-convert_int8_int32$(EXEEXT): $(convert_int8_int32_OBJECTS) $(convert_int8_int32_DEPENDENCIES) 
+convert_int8_int32$(EXEEXT): $(convert_int8_int32_OBJECTS) $(convert_int8_int32_DEPENDENCIES) $(EXTRA_convert_int8_int32_DEPENDENCIES) 
 	@rm -f convert_int8_int32$(EXEEXT)
 	$(LINK) $(convert_int8_int32_OBJECTS) $(convert_int8_int32_LDADD) $(LIBS)
-convert_int8_int64$(EXEEXT): $(convert_int8_int64_OBJECTS) $(convert_int8_int64_DEPENDENCIES) 
+convert_int8_int64$(EXEEXT): $(convert_int8_int64_OBJECTS) $(convert_int8_int64_DEPENDENCIES) $(EXTRA_convert_int8_int64_DEPENDENCIES) 
 	@rm -f convert_int8_int64$(EXEEXT)
 	$(LINK) $(convert_int8_int64_OBJECTS) $(convert_int8_int64_LDADD) $(LIBS)
-convert_int8_uint16$(EXEEXT): $(convert_int8_uint16_OBJECTS) $(convert_int8_uint16_DEPENDENCIES) 
+convert_int8_uint16$(EXEEXT): $(convert_int8_uint16_OBJECTS) $(convert_int8_uint16_DEPENDENCIES) $(EXTRA_convert_int8_uint16_DEPENDENCIES) 
 	@rm -f convert_int8_uint16$(EXEEXT)
 	$(LINK) $(convert_int8_uint16_OBJECTS) $(convert_int8_uint16_LDADD) $(LIBS)
-convert_int8_uint32$(EXEEXT): $(convert_int8_uint32_OBJECTS) $(convert_int8_uint32_DEPENDENCIES) 
+convert_int8_uint32$(EXEEXT): $(convert_int8_uint32_OBJECTS) $(convert_int8_uint32_DEPENDENCIES) $(EXTRA_convert_int8_uint32_DEPENDENCIES) 
 	@rm -f convert_int8_uint32$(EXEEXT)
 	$(LINK) $(convert_int8_uint32_OBJECTS) $(convert_int8_uint32_LDADD) $(LIBS)
-convert_int8_uint64$(EXEEXT): $(convert_int8_uint64_OBJECTS) $(convert_int8_uint64_DEPENDENCIES) 
+convert_int8_uint64$(EXEEXT): $(convert_int8_uint64_OBJECTS) $(convert_int8_uint64_DEPENDENCIES) $(EXTRA_convert_int8_uint64_DEPENDENCIES) 
 	@rm -f convert_int8_uint64$(EXEEXT)
 	$(LINK) $(convert_int8_uint64_OBJECTS) $(convert_int8_uint64_LDADD) $(LIBS)
-convert_int8_uint8$(EXEEXT): $(convert_int8_uint8_OBJECTS) $(convert_int8_uint8_DEPENDENCIES) 
+convert_int8_uint8$(EXEEXT): $(convert_int8_uint8_OBJECTS) $(convert_int8_uint8_DEPENDENCIES) $(EXTRA_convert_int8_uint8_DEPENDENCIES) 
 	@rm -f convert_int8_uint8$(EXEEXT)
 	$(LINK) $(convert_int8_uint8_OBJECTS) $(convert_int8_uint8_LDADD) $(LIBS)
-convert_uint16_complex128$(EXEEXT): $(convert_uint16_complex128_OBJECTS) $(convert_uint16_complex128_DEPENDENCIES) 
+convert_uint16_complex128$(EXEEXT): $(convert_uint16_complex128_OBJECTS) $(convert_uint16_complex128_DEPENDENCIES) $(EXTRA_convert_uint16_complex128_DEPENDENCIES) 
 	@rm -f convert_uint16_complex128$(EXEEXT)
 	$(LINK) $(convert_uint16_complex128_OBJECTS) $(convert_uint16_complex128_LDADD) $(LIBS)
-convert_uint16_complex64$(EXEEXT): $(convert_uint16_complex64_OBJECTS) $(convert_uint16_complex64_DEPENDENCIES) 
+convert_uint16_complex64$(EXEEXT): $(convert_uint16_complex64_OBJECTS) $(convert_uint16_complex64_DEPENDENCIES) $(EXTRA_convert_uint16_complex64_DEPENDENCIES) 
 	@rm -f convert_uint16_complex64$(EXEEXT)
 	$(LINK) $(convert_uint16_complex64_OBJECTS) $(convert_uint16_complex64_LDADD) $(LIBS)
-convert_uint16_float32$(EXEEXT): $(convert_uint16_float32_OBJECTS) $(convert_uint16_float32_DEPENDENCIES) 
+convert_uint16_float32$(EXEEXT): $(convert_uint16_float32_OBJECTS) $(convert_uint16_float32_DEPENDENCIES) $(EXTRA_convert_uint16_float32_DEPENDENCIES) 
 	@rm -f convert_uint16_float32$(EXEEXT)
 	$(LINK) $(convert_uint16_float32_OBJECTS) $(convert_uint16_float32_LDADD) $(LIBS)
-convert_uint16_float64$(EXEEXT): $(convert_uint16_float64_OBJECTS) $(convert_uint16_float64_DEPENDENCIES) 
+convert_uint16_float64$(EXEEXT): $(convert_uint16_float64_OBJECTS) $(convert_uint16_float64_DEPENDENCIES) $(EXTRA_convert_uint16_float64_DEPENDENCIES) 
 	@rm -f convert_uint16_float64$(EXEEXT)
 	$(LINK) $(convert_uint16_float64_OBJECTS) $(convert_uint16_float64_LDADD) $(LIBS)
-convert_uint16_int16$(EXEEXT): $(convert_uint16_int16_OBJECTS) $(convert_uint16_int16_DEPENDENCIES) 
+convert_uint16_int16$(EXEEXT): $(convert_uint16_int16_OBJECTS) $(convert_uint16_int16_DEPENDENCIES) $(EXTRA_convert_uint16_int16_DEPENDENCIES) 
 	@rm -f convert_uint16_int16$(EXEEXT)
 	$(LINK) $(convert_uint16_int16_OBJECTS) $(convert_uint16_int16_LDADD) $(LIBS)
-convert_uint16_int32$(EXEEXT): $(convert_uint16_int32_OBJECTS) $(convert_uint16_int32_DEPENDENCIES) 
+convert_uint16_int32$(EXEEXT): $(convert_uint16_int32_OBJECTS) $(convert_uint16_int32_DEPENDENCIES) $(EXTRA_convert_uint16_int32_DEPENDENCIES) 
 	@rm -f convert_uint16_int32$(EXEEXT)
 	$(LINK) $(convert_uint16_int32_OBJECTS) $(convert_uint16_int32_LDADD) $(LIBS)
-convert_uint16_int64$(EXEEXT): $(convert_uint16_int64_OBJECTS) $(convert_uint16_int64_DEPENDENCIES) 
+convert_uint16_int64$(EXEEXT): $(convert_uint16_int64_OBJECTS) $(convert_uint16_int64_DEPENDENCIES) $(EXTRA_convert_uint16_int64_DEPENDENCIES) 
 	@rm -f convert_uint16_int64$(EXEEXT)
 	$(LINK) $(convert_uint16_int64_OBJECTS) $(convert_uint16_int64_LDADD) $(LIBS)
-convert_uint16_int8$(EXEEXT): $(convert_uint16_int8_OBJECTS) $(convert_uint16_int8_DEPENDENCIES) 
+convert_uint16_int8$(EXEEXT): $(convert_uint16_int8_OBJECTS) $(convert_uint16_int8_DEPENDENCIES) $(EXTRA_convert_uint16_int8_DEPENDENCIES) 
 	@rm -f convert_uint16_int8$(EXEEXT)
 	$(LINK) $(convert_uint16_int8_OBJECTS) $(convert_uint16_int8_LDADD) $(LIBS)
-convert_uint16_uint32$(EXEEXT): $(convert_uint16_uint32_OBJECTS) $(convert_uint16_uint32_DEPENDENCIES) 
+convert_uint16_uint32$(EXEEXT): $(convert_uint16_uint32_OBJECTS) $(convert_uint16_uint32_DEPENDENCIES) $(EXTRA_convert_uint16_uint32_DEPENDENCIES) 
 	@rm -f convert_uint16_uint32$(EXEEXT)
 	$(LINK) $(convert_uint16_uint32_OBJECTS) $(convert_uint16_uint32_LDADD) $(LIBS)
-convert_uint16_uint64$(EXEEXT): $(convert_uint16_uint64_OBJECTS) $(convert_uint16_uint64_DEPENDENCIES) 
+convert_uint16_uint64$(EXEEXT): $(convert_uint16_uint64_OBJECTS) $(convert_uint16_uint64_DEPENDENCIES) $(EXTRA_convert_uint16_uint64_DEPENDENCIES) 
 	@rm -f convert_uint16_uint64$(EXEEXT)
 	$(LINK) $(convert_uint16_uint64_OBJECTS) $(convert_uint16_uint64_LDADD) $(LIBS)
-convert_uint16_uint8$(EXEEXT): $(convert_uint16_uint8_OBJECTS) $(convert_uint16_uint8_DEPENDENCIES) 
+convert_uint16_uint8$(EXEEXT): $(convert_uint16_uint8_OBJECTS) $(convert_uint16_uint8_DEPENDENCIES) $(EXTRA_convert_uint16_uint8_DEPENDENCIES) 
 	@rm -f convert_uint16_uint8$(EXEEXT)
 	$(LINK) $(convert_uint16_uint8_OBJECTS) $(convert_uint16_uint8_LDADD) $(LIBS)
-convert_uint32_complex128$(EXEEXT): $(convert_uint32_complex128_OBJECTS) $(convert_uint32_complex128_DEPENDENCIES) 
+convert_uint32_complex128$(EXEEXT): $(convert_uint32_complex128_OBJECTS) $(convert_uint32_complex128_DEPENDENCIES) $(EXTRA_convert_uint32_complex128_DEPENDENCIES) 
 	@rm -f convert_uint32_complex128$(EXEEXT)
 	$(LINK) $(convert_uint32_complex128_OBJECTS) $(convert_uint32_complex128_LDADD) $(LIBS)
-convert_uint32_complex64$(EXEEXT): $(convert_uint32_complex64_OBJECTS) $(convert_uint32_complex64_DEPENDENCIES) 
+convert_uint32_complex64$(EXEEXT): $(convert_uint32_complex64_OBJECTS) $(convert_uint32_complex64_DEPENDENCIES) $(EXTRA_convert_uint32_complex64_DEPENDENCIES) 
 	@rm -f convert_uint32_complex64$(EXEEXT)
 	$(LINK) $(convert_uint32_complex64_OBJECTS) $(convert_uint32_complex64_LDADD) $(LIBS)
-convert_uint32_float32$(EXEEXT): $(convert_uint32_float32_OBJECTS) $(convert_uint32_float32_DEPENDENCIES) 
+convert_uint32_float32$(EXEEXT): $(convert_uint32_float32_OBJECTS) $(convert_uint32_float32_DEPENDENCIES) $(EXTRA_convert_uint32_float32_DEPENDENCIES) 
 	@rm -f convert_uint32_float32$(EXEEXT)
 	$(LINK) $(convert_uint32_float32_OBJECTS) $(convert_uint32_float32_LDADD) $(LIBS)
-convert_uint32_float64$(EXEEXT): $(convert_uint32_float64_OBJECTS) $(convert_uint32_float64_DEPENDENCIES) 
+convert_uint32_float64$(EXEEXT): $(convert_uint32_float64_OBJECTS) $(convert_uint32_float64_DEPENDENCIES) $(EXTRA_convert_uint32_float64_DEPENDENCIES) 
 	@rm -f convert_uint32_float64$(EXEEXT)
 	$(LINK) $(convert_uint32_float64_OBJECTS) $(convert_uint32_float64_LDADD) $(LIBS)
-convert_uint32_int16$(EXEEXT): $(convert_uint32_int16_OBJECTS) $(convert_uint32_int16_DEPENDENCIES) 
+convert_uint32_int16$(EXEEXT): $(convert_uint32_int16_OBJECTS) $(convert_uint32_int16_DEPENDENCIES) $(EXTRA_convert_uint32_int16_DEPENDENCIES) 
 	@rm -f convert_uint32_int16$(EXEEXT)
 	$(LINK) $(convert_uint32_int16_OBJECTS) $(convert_uint32_int16_LDADD) $(LIBS)
-convert_uint32_int32$(EXEEXT): $(convert_uint32_int32_OBJECTS) $(convert_uint32_int32_DEPENDENCIES) 
+convert_uint32_int32$(EXEEXT): $(convert_uint32_int32_OBJECTS) $(convert_uint32_int32_DEPENDENCIES) $(EXTRA_convert_uint32_int32_DEPENDENCIES) 
 	@rm -f convert_uint32_int32$(EXEEXT)
 	$(LINK) $(convert_uint32_int32_OBJECTS) $(convert_uint32_int32_LDADD) $(LIBS)
-convert_uint32_int64$(EXEEXT): $(convert_uint32_int64_OBJECTS) $(convert_uint32_int64_DEPENDENCIES) 
+convert_uint32_int64$(EXEEXT): $(convert_uint32_int64_OBJECTS) $(convert_uint32_int64_DEPENDENCIES) $(EXTRA_convert_uint32_int64_DEPENDENCIES) 
 	@rm -f convert_uint32_int64$(EXEEXT)
 	$(LINK) $(convert_uint32_int64_OBJECTS) $(convert_uint32_int64_LDADD) $(LIBS)
-convert_uint32_int8$(EXEEXT): $(convert_uint32_int8_OBJECTS) $(convert_uint32_int8_DEPENDENCIES) 
+convert_uint32_int8$(EXEEXT): $(convert_uint32_int8_OBJECTS) $(convert_uint32_int8_DEPENDENCIES) $(EXTRA_convert_uint32_int8_DEPENDENCIES) 
 	@rm -f convert_uint32_int8$(EXEEXT)
 	$(LINK) $(convert_uint32_int8_OBJECTS) $(convert_uint32_int8_LDADD) $(LIBS)
-convert_uint32_uint16$(EXEEXT): $(convert_uint32_uint16_OBJECTS) $(convert_uint32_uint16_DEPENDENCIES) 
+convert_uint32_uint16$(EXEEXT): $(convert_uint32_uint16_OBJECTS) $(convert_uint32_uint16_DEPENDENCIES) $(EXTRA_convert_uint32_uint16_DEPENDENCIES) 
 	@rm -f convert_uint32_uint16$(EXEEXT)
 	$(LINK) $(convert_uint32_uint16_OBJECTS) $(convert_uint32_uint16_LDADD) $(LIBS)
-convert_uint32_uint64$(EXEEXT): $(convert_uint32_uint64_OBJECTS) $(convert_uint32_uint64_DEPENDENCIES) 
+convert_uint32_uint64$(EXEEXT): $(convert_uint32_uint64_OBJECTS) $(convert_uint32_uint64_DEPENDENCIES) $(EXTRA_convert_uint32_uint64_DEPENDENCIES) 
 	@rm -f convert_uint32_uint64$(EXEEXT)
 	$(LINK) $(convert_uint32_uint64_OBJECTS) $(convert_uint32_uint64_LDADD) $(LIBS)
-convert_uint32_uint8$(EXEEXT): $(convert_uint32_uint8_OBJECTS) $(convert_uint32_uint8_DEPENDENCIES) 
+convert_uint32_uint8$(EXEEXT): $(convert_uint32_uint8_OBJECTS) $(convert_uint32_uint8_DEPENDENCIES) $(EXTRA_convert_uint32_uint8_DEPENDENCIES) 
 	@rm -f convert_uint32_uint8$(EXEEXT)
 	$(LINK) $(convert_uint32_uint8_OBJECTS) $(convert_uint32_uint8_LDADD) $(LIBS)
-convert_uint64_complex128$(EXEEXT): $(convert_uint64_complex128_OBJECTS) $(convert_uint64_complex128_DEPENDENCIES) 
+convert_uint64_complex128$(EXEEXT): $(convert_uint64_complex128_OBJECTS) $(convert_uint64_complex128_DEPENDENCIES) $(EXTRA_convert_uint64_complex128_DEPENDENCIES) 
 	@rm -f convert_uint64_complex128$(EXEEXT)
 	$(LINK) $(convert_uint64_complex128_OBJECTS) $(convert_uint64_complex128_LDADD) $(LIBS)
-convert_uint64_complex64$(EXEEXT): $(convert_uint64_complex64_OBJECTS) $(convert_uint64_complex64_DEPENDENCIES) 
+convert_uint64_complex64$(EXEEXT): $(convert_uint64_complex64_OBJECTS) $(convert_uint64_complex64_DEPENDENCIES) $(EXTRA_convert_uint64_complex64_DEPENDENCIES) 
 	@rm -f convert_uint64_complex64$(EXEEXT)
 	$(LINK) $(convert_uint64_complex64_OBJECTS) $(convert_uint64_complex64_LDADD) $(LIBS)
-convert_uint64_float32$(EXEEXT): $(convert_uint64_float32_OBJECTS) $(convert_uint64_float32_DEPENDENCIES) 
+convert_uint64_float32$(EXEEXT): $(convert_uint64_float32_OBJECTS) $(convert_uint64_float32_DEPENDENCIES) $(EXTRA_convert_uint64_float32_DEPENDENCIES) 
 	@rm -f convert_uint64_float32$(EXEEXT)
 	$(LINK) $(convert_uint64_float32_OBJECTS) $(convert_uint64_float32_LDADD) $(LIBS)
-convert_uint64_float64$(EXEEXT): $(convert_uint64_float64_OBJECTS) $(convert_uint64_float64_DEPENDENCIES) 
+convert_uint64_float64$(EXEEXT): $(convert_uint64_float64_OBJECTS) $(convert_uint64_float64_DEPENDENCIES) $(EXTRA_convert_uint64_float64_DEPENDENCIES) 
 	@rm -f convert_uint64_float64$(EXEEXT)
 	$(LINK) $(convert_uint64_float64_OBJECTS) $(convert_uint64_float64_LDADD) $(LIBS)
-convert_uint64_int16$(EXEEXT): $(convert_uint64_int16_OBJECTS) $(convert_uint64_int16_DEPENDENCIES) 
+convert_uint64_int16$(EXEEXT): $(convert_uint64_int16_OBJECTS) $(convert_uint64_int16_DEPENDENCIES) $(EXTRA_convert_uint64_int16_DEPENDENCIES) 
 	@rm -f convert_uint64_int16$(EXEEXT)
 	$(LINK) $(convert_uint64_int16_OBJECTS) $(convert_uint64_int16_LDADD) $(LIBS)
-convert_uint64_int32$(EXEEXT): $(convert_uint64_int32_OBJECTS) $(convert_uint64_int32_DEPENDENCIES) 
+convert_uint64_int32$(EXEEXT): $(convert_uint64_int32_OBJECTS) $(convert_uint64_int32_DEPENDENCIES) $(EXTRA_convert_uint64_int32_DEPENDENCIES) 
 	@rm -f convert_uint64_int32$(EXEEXT)
 	$(LINK) $(convert_uint64_int32_OBJECTS) $(convert_uint64_int32_LDADD) $(LIBS)
-convert_uint64_int64$(EXEEXT): $(convert_uint64_int64_OBJECTS) $(convert_uint64_int64_DEPENDENCIES) 
+convert_uint64_int64$(EXEEXT): $(convert_uint64_int64_OBJECTS) $(convert_uint64_int64_DEPENDENCIES) $(EXTRA_convert_uint64_int64_DEPENDENCIES) 
 	@rm -f convert_uint64_int64$(EXEEXT)
 	$(LINK) $(convert_uint64_int64_OBJECTS) $(convert_uint64_int64_LDADD) $(LIBS)
-convert_uint64_int8$(EXEEXT): $(convert_uint64_int8_OBJECTS) $(convert_uint64_int8_DEPENDENCIES) 
+convert_uint64_int8$(EXEEXT): $(convert_uint64_int8_OBJECTS) $(convert_uint64_int8_DEPENDENCIES) $(EXTRA_convert_uint64_int8_DEPENDENCIES) 
 	@rm -f convert_uint64_int8$(EXEEXT)
 	$(LINK) $(convert_uint64_int8_OBJECTS) $(convert_uint64_int8_LDADD) $(LIBS)
-convert_uint64_uint16$(EXEEXT): $(convert_uint64_uint16_OBJECTS) $(convert_uint64_uint16_DEPENDENCIES) 
+convert_uint64_uint16$(EXEEXT): $(convert_uint64_uint16_OBJECTS) $(convert_uint64_uint16_DEPENDENCIES) $(EXTRA_convert_uint64_uint16_DEPENDENCIES) 
 	@rm -f convert_uint64_uint16$(EXEEXT)
 	$(LINK) $(convert_uint64_uint16_OBJECTS) $(convert_uint64_uint16_LDADD) $(LIBS)
-convert_uint64_uint32$(EXEEXT): $(convert_uint64_uint32_OBJECTS) $(convert_uint64_uint32_DEPENDENCIES) 
+convert_uint64_uint32$(EXEEXT): $(convert_uint64_uint32_OBJECTS) $(convert_uint64_uint32_DEPENDENCIES) $(EXTRA_convert_uint64_uint32_DEPENDENCIES) 
 	@rm -f convert_uint64_uint32$(EXEEXT)
 	$(LINK) $(convert_uint64_uint32_OBJECTS) $(convert_uint64_uint32_LDADD) $(LIBS)
-convert_uint64_uint8$(EXEEXT): $(convert_uint64_uint8_OBJECTS) $(convert_uint64_uint8_DEPENDENCIES) 
+convert_uint64_uint8$(EXEEXT): $(convert_uint64_uint8_OBJECTS) $(convert_uint64_uint8_DEPENDENCIES) $(EXTRA_convert_uint64_uint8_DEPENDENCIES) 
 	@rm -f convert_uint64_uint8$(EXEEXT)
 	$(LINK) $(convert_uint64_uint8_OBJECTS) $(convert_uint64_uint8_LDADD) $(LIBS)
-convert_uint8_complex128$(EXEEXT): $(convert_uint8_complex128_OBJECTS) $(convert_uint8_complex128_DEPENDENCIES) 
+convert_uint8_complex128$(EXEEXT): $(convert_uint8_complex128_OBJECTS) $(convert_uint8_complex128_DEPENDENCIES) $(EXTRA_convert_uint8_complex128_DEPENDENCIES) 
 	@rm -f convert_uint8_complex128$(EXEEXT)
 	$(LINK) $(convert_uint8_complex128_OBJECTS) $(convert_uint8_complex128_LDADD) $(LIBS)
-convert_uint8_complex64$(EXEEXT): $(convert_uint8_complex64_OBJECTS) $(convert_uint8_complex64_DEPENDENCIES) 
+convert_uint8_complex64$(EXEEXT): $(convert_uint8_complex64_OBJECTS) $(convert_uint8_complex64_DEPENDENCIES) $(EXTRA_convert_uint8_complex64_DEPENDENCIES) 
 	@rm -f convert_uint8_complex64$(EXEEXT)
 	$(LINK) $(convert_uint8_complex64_OBJECTS) $(convert_uint8_complex64_LDADD) $(LIBS)
-convert_uint8_float32$(EXEEXT): $(convert_uint8_float32_OBJECTS) $(convert_uint8_float32_DEPENDENCIES) 
+convert_uint8_float32$(EXEEXT): $(convert_uint8_float32_OBJECTS) $(convert_uint8_float32_DEPENDENCIES) $(EXTRA_convert_uint8_float32_DEPENDENCIES) 
 	@rm -f convert_uint8_float32$(EXEEXT)
 	$(LINK) $(convert_uint8_float32_OBJECTS) $(convert_uint8_float32_LDADD) $(LIBS)
-convert_uint8_float64$(EXEEXT): $(convert_uint8_float64_OBJECTS) $(convert_uint8_float64_DEPENDENCIES) 
+convert_uint8_float64$(EXEEXT): $(convert_uint8_float64_OBJECTS) $(convert_uint8_float64_DEPENDENCIES) $(EXTRA_convert_uint8_float64_DEPENDENCIES) 
 	@rm -f convert_uint8_float64$(EXEEXT)
 	$(LINK) $(convert_uint8_float64_OBJECTS) $(convert_uint8_float64_LDADD) $(LIBS)
-convert_uint8_int16$(EXEEXT): $(convert_uint8_int16_OBJECTS) $(convert_uint8_int16_DEPENDENCIES) 
+convert_uint8_int16$(EXEEXT): $(convert_uint8_int16_OBJECTS) $(convert_uint8_int16_DEPENDENCIES) $(EXTRA_convert_uint8_int16_DEPENDENCIES) 
 	@rm -f convert_uint8_int16$(EXEEXT)
 	$(LINK) $(convert_uint8_int16_OBJECTS) $(convert_uint8_int16_LDADD) $(LIBS)
-convert_uint8_int32$(EXEEXT): $(convert_uint8_int32_OBJECTS) $(convert_uint8_int32_DEPENDENCIES) 
+convert_uint8_int32$(EXEEXT): $(convert_uint8_int32_OBJECTS) $(convert_uint8_int32_DEPENDENCIES) $(EXTRA_convert_uint8_int32_DEPENDENCIES) 
 	@rm -f convert_uint8_int32$(EXEEXT)
 	$(LINK) $(convert_uint8_int32_OBJECTS) $(convert_uint8_int32_LDADD) $(LIBS)
-convert_uint8_int64$(EXEEXT): $(convert_uint8_int64_OBJECTS) $(convert_uint8_int64_DEPENDENCIES) 
+convert_uint8_int64$(EXEEXT): $(convert_uint8_int64_OBJECTS) $(convert_uint8_int64_DEPENDENCIES) $(EXTRA_convert_uint8_int64_DEPENDENCIES) 
 	@rm -f convert_uint8_int64$(EXEEXT)
 	$(LINK) $(convert_uint8_int64_OBJECTS) $(convert_uint8_int64_LDADD) $(LIBS)
-convert_uint8_int8$(EXEEXT): $(convert_uint8_int8_OBJECTS) $(convert_uint8_int8_DEPENDENCIES) 
+convert_uint8_int8$(EXEEXT): $(convert_uint8_int8_OBJECTS) $(convert_uint8_int8_DEPENDENCIES) $(EXTRA_convert_uint8_int8_DEPENDENCIES) 
 	@rm -f convert_uint8_int8$(EXEEXT)
 	$(LINK) $(convert_uint8_int8_OBJECTS) $(convert_uint8_int8_LDADD) $(LIBS)
-convert_uint8_uint16$(EXEEXT): $(convert_uint8_uint16_OBJECTS) $(convert_uint8_uint16_DEPENDENCIES) 
+convert_uint8_uint16$(EXEEXT): $(convert_uint8_uint16_OBJECTS) $(convert_uint8_uint16_DEPENDENCIES) $(EXTRA_convert_uint8_uint16_DEPENDENCIES) 
 	@rm -f convert_uint8_uint16$(EXEEXT)
 	$(LINK) $(convert_uint8_uint16_OBJECTS) $(convert_uint8_uint16_LDADD) $(LIBS)
-convert_uint8_uint32$(EXEEXT): $(convert_uint8_uint32_OBJECTS) $(convert_uint8_uint32_DEPENDENCIES) 
+convert_uint8_uint32$(EXEEXT): $(convert_uint8_uint32_OBJECTS) $(convert_uint8_uint32_DEPENDENCIES) $(EXTRA_convert_uint8_uint32_DEPENDENCIES) 
 	@rm -f convert_uint8_uint32$(EXEEXT)
 	$(LINK) $(convert_uint8_uint32_OBJECTS) $(convert_uint8_uint32_LDADD) $(LIBS)
-convert_uint8_uint64$(EXEEXT): $(convert_uint8_uint64_OBJECTS) $(convert_uint8_uint64_DEPENDENCIES) 
+convert_uint8_uint64$(EXEEXT): $(convert_uint8_uint64_OBJECTS) $(convert_uint8_uint64_DEPENDENCIES) $(EXTRA_convert_uint8_uint64_DEPENDENCIES) 
 	@rm -f convert_uint8_uint64$(EXEEXT)
 	$(LINK) $(convert_uint8_uint64_OBJECTS) $(convert_uint8_uint64_LDADD) $(LIBS)
-creat$(EXEEXT): $(creat_OBJECTS) $(creat_DEPENDENCIES) 
+creat$(EXEEXT): $(creat_OBJECTS) $(creat_DEPENDENCIES) $(EXTRA_creat_DEPENDENCIES) 
 	@rm -f creat$(EXEEXT)
 	$(LINK) $(creat_OBJECTS) $(creat_LDADD) $(LIBS)
-creat_excl$(EXEEXT): $(creat_excl_OBJECTS) $(creat_excl_DEPENDENCIES) 
+creat_excl$(EXEEXT): $(creat_excl_OBJECTS) $(creat_excl_DEPENDENCIES) $(EXTRA_creat_excl_DEPENDENCIES) 
 	@rm -f creat_excl$(EXEEXT)
 	$(LINK) $(creat_excl_OBJECTS) $(creat_excl_LDADD) $(LIBS)
-creat_rdonly$(EXEEXT): $(creat_rdonly_OBJECTS) $(creat_rdonly_DEPENDENCIES) 
+creat_rdonly$(EXEEXT): $(creat_rdonly_OBJECTS) $(creat_rdonly_DEPENDENCIES) $(EXTRA_creat_rdonly_DEPENDENCIES) 
 	@rm -f creat_rdonly$(EXEEXT)
 	$(LINK) $(creat_rdonly_OBJECTS) $(creat_rdonly_LDADD) $(LIBS)
-cvlist$(EXEEXT): $(cvlist_OBJECTS) $(cvlist_DEPENDENCIES) 
+cvlist$(EXEEXT): $(cvlist_OBJECTS) $(cvlist_DEPENDENCIES) $(EXTRA_cvlist_DEPENDENCIES) 
 	@rm -f cvlist$(EXEEXT)
 	$(LINK) $(cvlist_OBJECTS) $(cvlist_LDADD) $(LIBS)
-cvlist_array$(EXEEXT): $(cvlist_array_OBJECTS) $(cvlist_array_DEPENDENCIES) 
+cvlist_array$(EXEEXT): $(cvlist_array_OBJECTS) $(cvlist_array_DEPENDENCIES) $(EXTRA_cvlist_array_DEPENDENCIES) 
 	@rm -f cvlist_array$(EXEEXT)
 	$(LINK) $(cvlist_array_OBJECTS) $(cvlist_array_LDADD) $(LIBS)
-cvlist_array_meta$(EXEEXT): $(cvlist_array_meta_OBJECTS) $(cvlist_array_meta_DEPENDENCIES) 
+cvlist_array_hidden$(EXEEXT): $(cvlist_array_hidden_OBJECTS) $(cvlist_array_hidden_DEPENDENCIES) $(EXTRA_cvlist_array_hidden_DEPENDENCIES) 
+	@rm -f cvlist_array_hidden$(EXEEXT)
+	$(LINK) $(cvlist_array_hidden_OBJECTS) $(cvlist_array_hidden_LDADD) $(LIBS)
+cvlist_array_meta$(EXEEXT): $(cvlist_array_meta_OBJECTS) $(cvlist_array_meta_DEPENDENCIES) $(EXTRA_cvlist_array_meta_DEPENDENCIES) 
 	@rm -f cvlist_array_meta$(EXEEXT)
 	$(LINK) $(cvlist_array_meta_OBJECTS) $(cvlist_array_meta_LDADD) $(LIBS)
-cvlist_invalid$(EXEEXT): $(cvlist_invalid_OBJECTS) $(cvlist_invalid_DEPENDENCIES) 
+cvlist_array_meta_hidden$(EXEEXT): $(cvlist_array_meta_hidden_OBJECTS) $(cvlist_array_meta_hidden_DEPENDENCIES) $(EXTRA_cvlist_array_meta_hidden_DEPENDENCIES) 
+	@rm -f cvlist_array_meta_hidden$(EXEEXT)
+	$(LINK) $(cvlist_array_meta_hidden_OBJECTS) $(cvlist_array_meta_hidden_LDADD) $(LIBS)
+cvlist_hidden$(EXEEXT): $(cvlist_hidden_OBJECTS) $(cvlist_hidden_DEPENDENCIES) $(EXTRA_cvlist_hidden_DEPENDENCIES) 
+	@rm -f cvlist_hidden$(EXEEXT)
+	$(LINK) $(cvlist_hidden_OBJECTS) $(cvlist_hidden_LDADD) $(LIBS)
+cvlist_invalid$(EXEEXT): $(cvlist_invalid_OBJECTS) $(cvlist_invalid_DEPENDENCIES) $(EXTRA_cvlist_invalid_DEPENDENCIES) 
 	@rm -f cvlist_invalid$(EXEEXT)
 	$(LINK) $(cvlist_invalid_OBJECTS) $(cvlist_invalid_LDADD) $(LIBS)
-cvlist_meta$(EXEEXT): $(cvlist_meta_OBJECTS) $(cvlist_meta_DEPENDENCIES) 
+cvlist_meta$(EXEEXT): $(cvlist_meta_OBJECTS) $(cvlist_meta_DEPENDENCIES) $(EXTRA_cvlist_meta_DEPENDENCIES) 
 	@rm -f cvlist_meta$(EXEEXT)
 	$(LINK) $(cvlist_meta_OBJECTS) $(cvlist_meta_LDADD) $(LIBS)
-cvlist_meta_invalid$(EXEEXT): $(cvlist_meta_invalid_OBJECTS) $(cvlist_meta_invalid_DEPENDENCIES) 
+cvlist_meta_hidden$(EXEEXT): $(cvlist_meta_hidden_OBJECTS) $(cvlist_meta_hidden_DEPENDENCIES) $(EXTRA_cvlist_meta_hidden_DEPENDENCIES) 
+	@rm -f cvlist_meta_hidden$(EXEEXT)
+	$(LINK) $(cvlist_meta_hidden_OBJECTS) $(cvlist_meta_hidden_LDADD) $(LIBS)
+cvlist_meta_invalid$(EXEEXT): $(cvlist_meta_invalid_OBJECTS) $(cvlist_meta_invalid_DEPENDENCIES) $(EXTRA_cvlist_meta_invalid_DEPENDENCIES) 
 	@rm -f cvlist_meta_invalid$(EXEEXT)
 	$(LINK) $(cvlist_meta_invalid_OBJECTS) $(cvlist_meta_invalid_LDADD) $(LIBS)
-del$(EXEEXT): $(del_OBJECTS) $(del_DEPENDENCIES) 
+del$(EXEEXT): $(del_OBJECTS) $(del_DEPENDENCIES) $(EXTRA_del_DEPENDENCIES) 
 	@rm -f del$(EXEEXT)
 	$(LINK) $(del_OBJECTS) $(del_LDADD) $(LIBS)
-del_carray$(EXEEXT): $(del_carray_OBJECTS) $(del_carray_DEPENDENCIES) 
+del_carray$(EXEEXT): $(del_carray_OBJECTS) $(del_carray_DEPENDENCIES) $(EXTRA_del_carray_DEPENDENCIES) 
 	@rm -f del_carray$(EXEEXT)
 	$(LINK) $(del_carray_OBJECTS) $(del_carray_LDADD) $(LIBS)
-del_carray_deref$(EXEEXT): $(del_carray_deref_OBJECTS) $(del_carray_deref_DEPENDENCIES) 
+del_carray_deref$(EXEEXT): $(del_carray_deref_OBJECTS) $(del_carray_deref_DEPENDENCIES) $(EXTRA_del_carray_deref_DEPENDENCIES) 
 	@rm -f del_carray_deref$(EXEEXT)
 	$(LINK) $(del_carray_deref_OBJECTS) $(del_carray_deref_LDADD) $(LIBS)
-del_const$(EXEEXT): $(del_const_OBJECTS) $(del_const_DEPENDENCIES) 
+del_const$(EXEEXT): $(del_const_OBJECTS) $(del_const_DEPENDENCIES) $(EXTRA_del_const_DEPENDENCIES) 
 	@rm -f del_const$(EXEEXT)
 	$(LINK) $(del_const_OBJECTS) $(del_const_LDADD) $(LIBS)
-del_const_deref$(EXEEXT): $(del_const_deref_OBJECTS) $(del_const_deref_DEPENDENCIES) 
+del_const_deref$(EXEEXT): $(del_const_deref_OBJECTS) $(del_const_deref_DEPENDENCIES) $(EXTRA_del_const_deref_DEPENDENCIES) 
 	@rm -f del_const_deref$(EXEEXT)
 	$(LINK) $(del_const_deref_OBJECTS) $(del_const_deref_LDADD) $(LIBS)
-del_const_force$(EXEEXT): $(del_const_force_OBJECTS) $(del_const_force_DEPENDENCIES) 
+del_const_force$(EXEEXT): $(del_const_force_OBJECTS) $(del_const_force_DEPENDENCIES) $(EXTRA_del_const_force_DEPENDENCIES) 
 	@rm -f del_const_force$(EXEEXT)
 	$(LINK) $(del_const_force_OBJECTS) $(del_const_force_LDADD) $(LIBS)
-del_data$(EXEEXT): $(del_data_OBJECTS) $(del_data_DEPENDENCIES) 
+del_data$(EXEEXT): $(del_data_OBJECTS) $(del_data_DEPENDENCIES) $(EXTRA_del_data_DEPENDENCIES) 
 	@rm -f del_data$(EXEEXT)
 	$(LINK) $(del_data_OBJECTS) $(del_data_LDADD) $(LIBS)
-del_derived$(EXEEXT): $(del_derived_OBJECTS) $(del_derived_DEPENDENCIES) 
+del_derived$(EXEEXT): $(del_derived_OBJECTS) $(del_derived_DEPENDENCIES) $(EXTRA_del_derived_DEPENDENCIES) 
 	@rm -f del_derived$(EXEEXT)
 	$(LINK) $(del_derived_OBJECTS) $(del_derived_LDADD) $(LIBS)
-del_derived_force$(EXEEXT): $(del_derived_force_OBJECTS) $(del_derived_force_DEPENDENCIES) 
+del_derived_after$(EXEEXT): $(del_derived_after_OBJECTS) $(del_derived_after_DEPENDENCIES) $(EXTRA_del_derived_after_DEPENDENCIES) 
+	@rm -f del_derived_after$(EXEEXT)
+	$(LINK) $(del_derived_after_OBJECTS) $(del_derived_after_LDADD) $(LIBS)
+del_derived_force$(EXEEXT): $(del_derived_force_OBJECTS) $(del_derived_force_DEPENDENCIES) $(EXTRA_del_derived_force_DEPENDENCIES) 
 	@rm -f del_derived_force$(EXEEXT)
 	$(LINK) $(del_derived_force_OBJECTS) $(del_derived_force_LDADD) $(LIBS)
-del_meta$(EXEEXT): $(del_meta_OBJECTS) $(del_meta_DEPENDENCIES) 
+del_meta$(EXEEXT): $(del_meta_OBJECTS) $(del_meta_DEPENDENCIES) $(EXTRA_del_meta_DEPENDENCIES) 
 	@rm -f del_meta$(EXEEXT)
 	$(LINK) $(del_meta_OBJECTS) $(del_meta_LDADD) $(LIBS)
-del_meta_force$(EXEEXT): $(del_meta_force_OBJECTS) $(del_meta_force_DEPENDENCIES) 
+del_meta_force$(EXEEXT): $(del_meta_force_OBJECTS) $(del_meta_force_DEPENDENCIES) $(EXTRA_del_meta_force_DEPENDENCIES) 
 	@rm -f del_meta_force$(EXEEXT)
 	$(LINK) $(del_meta_force_OBJECTS) $(del_meta_force_LDADD) $(LIBS)
-dfes_bit$(EXEEXT): $(dfes_bit_OBJECTS) $(dfes_bit_DEPENDENCIES) 
+desync$(EXEEXT): $(desync_OBJECTS) $(desync_DEPENDENCIES) $(EXTRA_desync_DEPENDENCIES) 
+	@rm -f desync$(EXEEXT)
+	$(LINK) $(desync_OBJECTS) $(desync_LDADD) $(LIBS)
+desync_flush$(EXEEXT): $(desync_flush_OBJECTS) $(desync_flush_DEPENDENCIES) $(EXTRA_desync_flush_DEPENDENCIES) 
+	@rm -f desync_flush$(EXEEXT)
+	$(LINK) $(desync_flush_OBJECTS) $(desync_flush_LDADD) $(LIBS)
+desync_reopen$(EXEEXT): $(desync_reopen_OBJECTS) $(desync_reopen_DEPENDENCIES) $(EXTRA_desync_reopen_DEPENDENCIES) 
+	@rm -f desync_reopen$(EXEEXT)
+	$(LINK) $(desync_reopen_OBJECTS) $(desync_reopen_LDADD) $(LIBS)
+desync_reopen_inv$(EXEEXT): $(desync_reopen_inv_OBJECTS) $(desync_reopen_inv_DEPENDENCIES) $(EXTRA_desync_reopen_inv_DEPENDENCIES) 
+	@rm -f desync_reopen_inv$(EXEEXT)
+	$(LINK) $(desync_reopen_inv_OBJECTS) $(desync_reopen_inv_LDADD) $(LIBS)
+dfes_bit$(EXEEXT): $(dfes_bit_OBJECTS) $(dfes_bit_DEPENDENCIES) $(EXTRA_dfes_bit_DEPENDENCIES) 
 	@rm -f dfes_bit$(EXEEXT)
 	$(LINK) $(dfes_bit_OBJECTS) $(dfes_bit_LDADD) $(LIBS)
-dfes_divide$(EXEEXT): $(dfes_divide_OBJECTS) $(dfes_divide_DEPENDENCIES) 
+dfes_divide$(EXEEXT): $(dfes_divide_OBJECTS) $(dfes_divide_DEPENDENCIES) $(EXTRA_dfes_divide_DEPENDENCIES) 
 	@rm -f dfes_divide$(EXEEXT)
 	$(LINK) $(dfes_divide_OBJECTS) $(dfes_divide_LDADD) $(LIBS)
-dfes_lincom$(EXEEXT): $(dfes_lincom_OBJECTS) $(dfes_lincom_DEPENDENCIES) 
+dfes_lincom$(EXEEXT): $(dfes_lincom_OBJECTS) $(dfes_lincom_DEPENDENCIES) $(EXTRA_dfes_lincom_DEPENDENCIES) 
 	@rm -f dfes_lincom$(EXEEXT)
 	$(LINK) $(dfes_lincom_OBJECTS) $(dfes_lincom_LDADD) $(LIBS)
-dfes_linterp$(EXEEXT): $(dfes_linterp_OBJECTS) $(dfes_linterp_DEPENDENCIES) 
+dfes_linterp$(EXEEXT): $(dfes_linterp_OBJECTS) $(dfes_linterp_DEPENDENCIES) $(EXTRA_dfes_linterp_DEPENDENCIES) 
 	@rm -f dfes_linterp$(EXEEXT)
 	$(LINK) $(dfes_linterp_OBJECTS) $(dfes_linterp_LDADD) $(LIBS)
-dfes_multiply$(EXEEXT): $(dfes_multiply_OBJECTS) $(dfes_multiply_DEPENDENCIES) 
+dfes_multiply$(EXEEXT): $(dfes_multiply_OBJECTS) $(dfes_multiply_DEPENDENCIES) $(EXTRA_dfes_multiply_DEPENDENCIES) 
 	@rm -f dfes_multiply$(EXEEXT)
 	$(LINK) $(dfes_multiply_OBJECTS) $(dfes_multiply_LDADD) $(LIBS)
-dfes_null$(EXEEXT): $(dfes_null_OBJECTS) $(dfes_null_DEPENDENCIES) 
+dfes_null$(EXEEXT): $(dfes_null_OBJECTS) $(dfes_null_DEPENDENCIES) $(EXTRA_dfes_null_DEPENDENCIES) 
 	@rm -f dfes_null$(EXEEXT)
 	$(LINK) $(dfes_null_OBJECTS) $(dfes_null_LDADD) $(LIBS)
-dfes_phase$(EXEEXT): $(dfes_phase_OBJECTS) $(dfes_phase_DEPENDENCIES) 
+dfes_phase$(EXEEXT): $(dfes_phase_OBJECTS) $(dfes_phase_DEPENDENCIES) $(EXTRA_dfes_phase_DEPENDENCIES) 
 	@rm -f dfes_phase$(EXEEXT)
 	$(LINK) $(dfes_phase_OBJECTS) $(dfes_phase_LDADD) $(LIBS)
-dfes_raw$(EXEEXT): $(dfes_raw_OBJECTS) $(dfes_raw_DEPENDENCIES) 
+dfes_raw$(EXEEXT): $(dfes_raw_OBJECTS) $(dfes_raw_DEPENDENCIES) $(EXTRA_dfes_raw_DEPENDENCIES) 
 	@rm -f dfes_raw$(EXEEXT)
 	$(LINK) $(dfes_raw_OBJECTS) $(dfes_raw_LDADD) $(LIBS)
-dfes_recip$(EXEEXT): $(dfes_recip_OBJECTS) $(dfes_recip_DEPENDENCIES) 
+dfes_recip$(EXEEXT): $(dfes_recip_OBJECTS) $(dfes_recip_DEPENDENCIES) $(EXTRA_dfes_recip_DEPENDENCIES) 
 	@rm -f dfes_recip$(EXEEXT)
 	$(LINK) $(dfes_recip_OBJECTS) $(dfes_recip_LDADD) $(LIBS)
-dfes_zero$(EXEEXT): $(dfes_zero_OBJECTS) $(dfes_zero_DEPENDENCIES) 
+dfes_zero$(EXEEXT): $(dfes_zero_OBJECTS) $(dfes_zero_DEPENDENCIES) $(EXTRA_dfes_zero_DEPENDENCIES) 
 	@rm -f dfes_zero$(EXEEXT)
 	$(LINK) $(dfes_zero_OBJECTS) $(dfes_zero_LDADD) $(LIBS)
-encode_alter$(EXEEXT): $(encode_alter_OBJECTS) $(encode_alter_DEPENDENCIES) 
+elist_alias$(EXEEXT): $(elist_alias_OBJECTS) $(elist_alias_DEPENDENCIES) $(EXTRA_elist_alias_DEPENDENCIES) 
+	@rm -f elist_alias$(EXEEXT)
+	$(LINK) $(elist_alias_OBJECTS) $(elist_alias_LDADD) $(LIBS)
+elist_hidden$(EXEEXT): $(elist_hidden_OBJECTS) $(elist_hidden_DEPENDENCIES) $(EXTRA_elist_hidden_DEPENDENCIES) 
+	@rm -f elist_hidden$(EXEEXT)
+	$(LINK) $(elist_hidden_OBJECTS) $(elist_hidden_LDADD) $(LIBS)
+elist_noalias$(EXEEXT): $(elist_noalias_OBJECTS) $(elist_noalias_DEPENDENCIES) $(EXTRA_elist_noalias_DEPENDENCIES) 
+	@rm -f elist_noalias$(EXEEXT)
+	$(LINK) $(elist_noalias_OBJECTS) $(elist_noalias_LDADD) $(LIBS)
+elist_scalar$(EXEEXT): $(elist_scalar_OBJECTS) $(elist_scalar_DEPENDENCIES) $(EXTRA_elist_scalar_DEPENDENCIES) 
+	@rm -f elist_scalar$(EXEEXT)
+	$(LINK) $(elist_scalar_OBJECTS) $(elist_scalar_LDADD) $(LIBS)
+encode_alter$(EXEEXT): $(encode_alter_OBJECTS) $(encode_alter_DEPENDENCIES) $(EXTRA_encode_alter_DEPENDENCIES) 
 	@rm -f encode_alter$(EXEEXT)
 	$(LINK) $(encode_alter_OBJECTS) $(encode_alter_LDADD) $(LIBS)
-encode_get$(EXEEXT): $(encode_get_OBJECTS) $(encode_get_DEPENDENCIES) 
+encode_get$(EXEEXT): $(encode_get_OBJECTS) $(encode_get_DEPENDENCIES) $(EXTRA_encode_get_DEPENDENCIES) 
 	@rm -f encode_get$(EXEEXT)
 	$(LINK) $(encode_get_OBJECTS) $(encode_get_LDADD) $(LIBS)
-encode_move$(EXEEXT): $(encode_move_OBJECTS) $(encode_move_DEPENDENCIES) 
+encode_move$(EXEEXT): $(encode_move_OBJECTS) $(encode_move_DEPENDENCIES) $(EXTRA_encode_move_DEPENDENCIES) 
 	@rm -f encode_move$(EXEEXT)
 	$(LINK) $(encode_move_OBJECTS) $(encode_move_LDADD) $(LIBS)
-endian_alter$(EXEEXT): $(endian_alter_OBJECTS) $(endian_alter_DEPENDENCIES) 
+endian_alter$(EXEEXT): $(endian_alter_OBJECTS) $(endian_alter_DEPENDENCIES) $(EXTRA_endian_alter_DEPENDENCIES) 
 	@rm -f endian_alter$(EXEEXT)
 	$(LINK) $(endian_alter_OBJECTS) $(endian_alter_LDADD) $(LIBS)
-endian_get$(EXEEXT): $(endian_get_OBJECTS) $(endian_get_DEPENDENCIES) 
+endian_alter_sie$(EXEEXT): $(endian_alter_sie_OBJECTS) $(endian_alter_sie_DEPENDENCIES) $(EXTRA_endian_alter_sie_DEPENDENCIES) 
+	@rm -f endian_alter_sie$(EXEEXT)
+	$(LINK) $(endian_alter_sie_OBJECTS) $(endian_alter_sie_LDADD) $(LIBS)
+endian_get$(EXEEXT): $(endian_get_OBJECTS) $(endian_get_DEPENDENCIES) $(EXTRA_endian_get_DEPENDENCIES) 
 	@rm -f endian_get$(EXEEXT)
 	$(LINK) $(endian_get_OBJECTS) $(endian_get_LDADD) $(LIBS)
-endian_move$(EXEEXT): $(endian_move_OBJECTS) $(endian_move_DEPENDENCIES) 
+endian_move$(EXEEXT): $(endian_move_OBJECTS) $(endian_move_DEPENDENCIES) $(EXTRA_endian_move_DEPENDENCIES) 
 	@rm -f endian_move$(EXEEXT)
 	$(LINK) $(endian_move_OBJECTS) $(endian_move_LDADD) $(LIBS)
-entry_bad_code$(EXEEXT): $(entry_bad_code_OBJECTS) $(entry_bad_code_DEPENDENCIES) 
+entry_bad_code$(EXEEXT): $(entry_bad_code_OBJECTS) $(entry_bad_code_DEPENDENCIES) $(EXTRA_entry_bad_code_DEPENDENCIES) 
 	@rm -f entry_bad_code$(EXEEXT)
 	$(LINK) $(entry_bad_code_OBJECTS) $(entry_bad_code_LDADD) $(LIBS)
-entry_bit$(EXEEXT): $(entry_bit_OBJECTS) $(entry_bit_DEPENDENCIES) 
+entry_bit$(EXEEXT): $(entry_bit_OBJECTS) $(entry_bit_DEPENDENCIES) $(EXTRA_entry_bit_DEPENDENCIES) 
 	@rm -f entry_bit$(EXEEXT)
 	$(LINK) $(entry_bit_OBJECTS) $(entry_bit_LDADD) $(LIBS)
-entry_bit_scalar$(EXEEXT): $(entry_bit_scalar_OBJECTS) $(entry_bit_scalar_DEPENDENCIES) 
+entry_bit_scalar$(EXEEXT): $(entry_bit_scalar_OBJECTS) $(entry_bit_scalar_DEPENDENCIES) $(EXTRA_entry_bit_scalar_DEPENDENCIES) 
 	@rm -f entry_bit_scalar$(EXEEXT)
 	$(LINK) $(entry_bit_scalar_OBJECTS) $(entry_bit_scalar_LDADD) $(LIBS)
-entry_invalid$(EXEEXT): $(entry_invalid_OBJECTS) $(entry_invalid_DEPENDENCIES) 
+entry_divide$(EXEEXT): $(entry_divide_OBJECTS) $(entry_divide_DEPENDENCIES) $(EXTRA_entry_divide_DEPENDENCIES) 
+	@rm -f entry_divide$(EXEEXT)
+	$(LINK) $(entry_divide_OBJECTS) $(entry_divide_LDADD) $(LIBS)
+entry_invalid$(EXEEXT): $(entry_invalid_OBJECTS) $(entry_invalid_DEPENDENCIES) $(EXTRA_entry_invalid_DEPENDENCIES) 
 	@rm -f entry_invalid$(EXEEXT)
 	$(LINK) $(entry_invalid_OBJECTS) $(entry_invalid_LDADD) $(LIBS)
-entry_lincom$(EXEEXT): $(entry_lincom_OBJECTS) $(entry_lincom_DEPENDENCIES) 
+entry_lincom$(EXEEXT): $(entry_lincom_OBJECTS) $(entry_lincom_DEPENDENCIES) $(EXTRA_entry_lincom_DEPENDENCIES) 
 	@rm -f entry_lincom$(EXEEXT)
 	$(LINK) $(entry_lincom_OBJECTS) $(entry_lincom_LDADD) $(LIBS)
-entry_lincom_scalar$(EXEEXT): $(entry_lincom_scalar_OBJECTS) $(entry_lincom_scalar_DEPENDENCIES) 
+entry_lincom_scalar$(EXEEXT): $(entry_lincom_scalar_OBJECTS) $(entry_lincom_scalar_DEPENDENCIES) $(EXTRA_entry_lincom_scalar_DEPENDENCIES) 
 	@rm -f entry_lincom_scalar$(EXEEXT)
 	$(LINK) $(entry_lincom_scalar_OBJECTS) $(entry_lincom_scalar_LDADD) $(LIBS)
-entry_linterp$(EXEEXT): $(entry_linterp_OBJECTS) $(entry_linterp_DEPENDENCIES) 
+entry_linterp$(EXEEXT): $(entry_linterp_OBJECTS) $(entry_linterp_DEPENDENCIES) $(EXTRA_entry_linterp_DEPENDENCIES) 
 	@rm -f entry_linterp$(EXEEXT)
 	$(LINK) $(entry_linterp_OBJECTS) $(entry_linterp_LDADD) $(LIBS)
-entry_multiply$(EXEEXT): $(entry_multiply_OBJECTS) $(entry_multiply_DEPENDENCIES) 
+entry_mplex$(EXEEXT): $(entry_mplex_OBJECTS) $(entry_mplex_DEPENDENCIES) $(EXTRA_entry_mplex_DEPENDENCIES) 
+	@rm -f entry_mplex$(EXEEXT)
+	$(LINK) $(entry_mplex_OBJECTS) $(entry_mplex_LDADD) $(LIBS)
+entry_mplex_scalar$(EXEEXT): $(entry_mplex_scalar_OBJECTS) $(entry_mplex_scalar_DEPENDENCIES) $(EXTRA_entry_mplex_scalar_DEPENDENCIES) 
+	@rm -f entry_mplex_scalar$(EXEEXT)
+	$(LINK) $(entry_mplex_scalar_OBJECTS) $(entry_mplex_scalar_LDADD) $(LIBS)
+entry_multiply$(EXEEXT): $(entry_multiply_OBJECTS) $(entry_multiply_DEPENDENCIES) $(EXTRA_entry_multiply_DEPENDENCIES) 
 	@rm -f entry_multiply$(EXEEXT)
 	$(LINK) $(entry_multiply_OBJECTS) $(entry_multiply_LDADD) $(LIBS)
-entry_phase$(EXEEXT): $(entry_phase_OBJECTS) $(entry_phase_DEPENDENCIES) 
+entry_phase$(EXEEXT): $(entry_phase_OBJECTS) $(entry_phase_DEPENDENCIES) $(EXTRA_entry_phase_DEPENDENCIES) 
 	@rm -f entry_phase$(EXEEXT)
 	$(LINK) $(entry_phase_OBJECTS) $(entry_phase_LDADD) $(LIBS)
-entry_phase_scalar$(EXEEXT): $(entry_phase_scalar_OBJECTS) $(entry_phase_scalar_DEPENDENCIES) 
+entry_phase_scalar$(EXEEXT): $(entry_phase_scalar_OBJECTS) $(entry_phase_scalar_DEPENDENCIES) $(EXTRA_entry_phase_scalar_DEPENDENCIES) 
 	@rm -f entry_phase_scalar$(EXEEXT)
 	$(LINK) $(entry_phase_scalar_OBJECTS) $(entry_phase_scalar_LDADD) $(LIBS)
-entry_polynom$(EXEEXT): $(entry_polynom_OBJECTS) $(entry_polynom_DEPENDENCIES) 
+entry_polynom$(EXEEXT): $(entry_polynom_OBJECTS) $(entry_polynom_DEPENDENCIES) $(EXTRA_entry_polynom_DEPENDENCIES) 
 	@rm -f entry_polynom$(EXEEXT)
 	$(LINK) $(entry_polynom_OBJECTS) $(entry_polynom_LDADD) $(LIBS)
-entry_polynom_scalar$(EXEEXT): $(entry_polynom_scalar_OBJECTS) $(entry_polynom_scalar_DEPENDENCIES) 
+entry_polynom_scalar$(EXEEXT): $(entry_polynom_scalar_OBJECTS) $(entry_polynom_scalar_DEPENDENCIES) $(EXTRA_entry_polynom_scalar_DEPENDENCIES) 
 	@rm -f entry_polynom_scalar$(EXEEXT)
 	$(LINK) $(entry_polynom_scalar_OBJECTS) $(entry_polynom_scalar_LDADD) $(LIBS)
-entry_raw$(EXEEXT): $(entry_raw_OBJECTS) $(entry_raw_DEPENDENCIES) 
+entry_raw$(EXEEXT): $(entry_raw_OBJECTS) $(entry_raw_DEPENDENCIES) $(EXTRA_entry_raw_DEPENDENCIES) 
 	@rm -f entry_raw$(EXEEXT)
 	$(LINK) $(entry_raw_OBJECTS) $(entry_raw_LDADD) $(LIBS)
-entry_raw_scalar$(EXEEXT): $(entry_raw_scalar_OBJECTS) $(entry_raw_scalar_DEPENDENCIES) 
+entry_raw_scalar$(EXEEXT): $(entry_raw_scalar_OBJECTS) $(entry_raw_scalar_DEPENDENCIES) $(EXTRA_entry_raw_scalar_DEPENDENCIES) 
 	@rm -f entry_raw_scalar$(EXEEXT)
 	$(LINK) $(entry_raw_scalar_OBJECTS) $(entry_raw_scalar_LDADD) $(LIBS)
-entry_raw_scalar_code$(EXEEXT): $(entry_raw_scalar_code_OBJECTS) $(entry_raw_scalar_code_DEPENDENCIES) 
+entry_raw_scalar_code$(EXEEXT): $(entry_raw_scalar_code_OBJECTS) $(entry_raw_scalar_code_DEPENDENCIES) $(EXTRA_entry_raw_scalar_code_DEPENDENCIES) 
 	@rm -f entry_raw_scalar_code$(EXEEXT)
 	$(LINK) $(entry_raw_scalar_code_OBJECTS) $(entry_raw_scalar_code_LDADD) $(LIBS)
-entry_raw_scalar_type$(EXEEXT): $(entry_raw_scalar_type_OBJECTS) $(entry_raw_scalar_type_DEPENDENCIES) 
+entry_raw_scalar_type$(EXEEXT): $(entry_raw_scalar_type_OBJECTS) $(entry_raw_scalar_type_DEPENDENCIES) $(EXTRA_entry_raw_scalar_type_DEPENDENCIES) 
 	@rm -f entry_raw_scalar_type$(EXEEXT)
 	$(LINK) $(entry_raw_scalar_type_OBJECTS) $(entry_raw_scalar_type_LDADD) $(LIBS)
-entry_scalar_repr$(EXEEXT): $(entry_scalar_repr_OBJECTS) $(entry_scalar_repr_DEPENDENCIES) 
+entry_recip$(EXEEXT): $(entry_recip_OBJECTS) $(entry_recip_DEPENDENCIES) $(EXTRA_entry_recip_DEPENDENCIES) 
+	@rm -f entry_recip$(EXEEXT)
+	$(LINK) $(entry_recip_OBJECTS) $(entry_recip_LDADD) $(LIBS)
+entry_scalar_repr$(EXEEXT): $(entry_scalar_repr_OBJECTS) $(entry_scalar_repr_DEPENDENCIES) $(EXTRA_entry_scalar_repr_DEPENDENCIES) 
 	@rm -f entry_scalar_repr$(EXEEXT)
 	$(LINK) $(entry_scalar_repr_OBJECTS) $(entry_scalar_repr_LDADD) $(LIBS)
-entry_type$(EXEEXT): $(entry_type_OBJECTS) $(entry_type_DEPENDENCIES) 
+entry_type$(EXEEXT): $(entry_type_OBJECTS) $(entry_type_DEPENDENCIES) $(EXTRA_entry_type_DEPENDENCIES) 
 	@rm -f entry_type$(EXEEXT)
 	$(LINK) $(entry_type_OBJECTS) $(entry_type_LDADD) $(LIBS)
-eof$(EXEEXT): $(eof_OBJECTS) $(eof_DEPENDENCIES) 
+entry_type_alias$(EXEEXT): $(entry_type_alias_OBJECTS) $(entry_type_alias_DEPENDENCIES) $(EXTRA_entry_type_alias_DEPENDENCIES) 
+	@rm -f entry_type_alias$(EXEEXT)
+	$(LINK) $(entry_type_alias_OBJECTS) $(entry_type_alias_LDADD) $(LIBS)
+entry_window$(EXEEXT): $(entry_window_OBJECTS) $(entry_window_DEPENDENCIES) $(EXTRA_entry_window_DEPENDENCIES) 
+	@rm -f entry_window$(EXEEXT)
+	$(LINK) $(entry_window_OBJECTS) $(entry_window_LDADD) $(LIBS)
+entry_window_scalar$(EXEEXT): $(entry_window_scalar_OBJECTS) $(entry_window_scalar_DEPENDENCIES) $(EXTRA_entry_window_scalar_DEPENDENCIES) 
+	@rm -f entry_window_scalar$(EXEEXT)
+	$(LINK) $(entry_window_scalar_OBJECTS) $(entry_window_scalar_LDADD) $(LIBS)
+eof$(EXEEXT): $(eof_OBJECTS) $(eof_DEPENDENCIES) $(EXTRA_eof_DEPENDENCIES) 
 	@rm -f eof$(EXEEXT)
 	$(LINK) $(eof_OBJECTS) $(eof_LDADD) $(LIBS)
-eof_index$(EXEEXT): $(eof_index_OBJECTS) $(eof_index_DEPENDENCIES) 
+eof_index$(EXEEXT): $(eof_index_OBJECTS) $(eof_index_DEPENDENCIES) $(EXTRA_eof_index_DEPENDENCIES) 
 	@rm -f eof_index$(EXEEXT)
 	$(LINK) $(eof_index_OBJECTS) $(eof_index_LDADD) $(LIBS)
-eof_lincom$(EXEEXT): $(eof_lincom_OBJECTS) $(eof_lincom_DEPENDENCIES) 
+eof_lincom$(EXEEXT): $(eof_lincom_OBJECTS) $(eof_lincom_DEPENDENCIES) $(EXTRA_eof_lincom_DEPENDENCIES) 
 	@rm -f eof_lincom$(EXEEXT)
 	$(LINK) $(eof_lincom_OBJECTS) $(eof_lincom_LDADD) $(LIBS)
-eof_phase$(EXEEXT): $(eof_phase_OBJECTS) $(eof_phase_DEPENDENCIES) 
+eof_phase$(EXEEXT): $(eof_phase_OBJECTS) $(eof_phase_DEPENDENCIES) $(EXTRA_eof_phase_DEPENDENCIES) 
 	@rm -f eof_phase$(EXEEXT)
 	$(LINK) $(eof_phase_OBJECTS) $(eof_phase_LDADD) $(LIBS)
-error$(EXEEXT): $(error_OBJECTS) $(error_DEPENDENCIES) 
+error$(EXEEXT): $(error_OBJECTS) $(error_DEPENDENCIES) $(EXTRA_error_DEPENDENCIES) 
 	@rm -f error$(EXEEXT)
 	$(LINK) $(error_OBJECTS) $(error_LDADD) $(LIBS)
-error_error$(EXEEXT): $(error_error_OBJECTS) $(error_error_DEPENDENCIES) 
+error_error$(EXEEXT): $(error_error_OBJECTS) $(error_error_DEPENDENCIES) $(EXTRA_error_error_DEPENDENCIES) 
 	@rm -f error_error$(EXEEXT)
 	$(LINK) $(error_error_OBJECTS) $(error_error_LDADD) $(LIBS)
-error_short$(EXEEXT): $(error_short_OBJECTS) $(error_short_DEPENDENCIES) 
+error_num$(EXEEXT): $(error_num_OBJECTS) $(error_num_DEPENDENCIES) $(EXTRA_error_num_DEPENDENCIES) 
+	@rm -f error_num$(EXEEXT)
+	$(LINK) $(error_num_OBJECTS) $(error_num_LDADD) $(LIBS)
+error_short$(EXEEXT): $(error_short_OBJECTS) $(error_short_DEPENDENCIES) $(EXTRA_error_short_DEPENDENCIES) 
 	@rm -f error_short$(EXEEXT)
 	$(LINK) $(error_short_OBJECTS) $(error_short_LDADD) $(LIBS)
-file$(EXEEXT): $(file_OBJECTS) $(file_DEPENDENCIES) 
+error_verbose$(EXEEXT): $(error_verbose_OBJECTS) $(error_verbose_DEPENDENCIES) $(EXTRA_error_verbose_DEPENDENCIES) 
+	@rm -f error_verbose$(EXEEXT)
+	$(LINK) $(error_verbose_OBJECTS) $(error_verbose_LDADD) $(LIBS)
+error_verbose_prefix$(EXEEXT): $(error_verbose_prefix_OBJECTS) $(error_verbose_prefix_DEPENDENCIES) $(EXTRA_error_verbose_prefix_DEPENDENCIES) 
+	@rm -f error_verbose_prefix$(EXEEXT)
+	$(LINK) $(error_verbose_prefix_OBJECTS) $(error_verbose_prefix_LDADD) $(LIBS)
+file$(EXEEXT): $(file_OBJECTS) $(file_DEPENDENCIES) $(EXTRA_file_DEPENDENCIES) 
 	@rm -f file$(EXEEXT)
 	$(LINK) $(file_OBJECTS) $(file_LDADD) $(LIBS)
-file_code$(EXEEXT): $(file_code_OBJECTS) $(file_code_DEPENDENCIES) 
+file_code$(EXEEXT): $(file_code_OBJECTS) $(file_code_DEPENDENCIES) $(EXTRA_file_code_DEPENDENCIES) 
 	@rm -f file_code$(EXEEXT)
 	$(LINK) $(file_code_OBJECTS) $(file_code_LDADD) $(LIBS)
-file_type$(EXEEXT): $(file_type_OBJECTS) $(file_type_DEPENDENCIES) 
+file_type$(EXEEXT): $(file_type_OBJECTS) $(file_type_DEPENDENCIES) $(EXTRA_file_type_DEPENDENCIES) 
 	@rm -f file_type$(EXEEXT)
 	$(LINK) $(file_type_OBJECTS) $(file_type_LDADD) $(LIBS)
-flist$(EXEEXT): $(flist_OBJECTS) $(flist_DEPENDENCIES) 
+flist$(EXEEXT): $(flist_OBJECTS) $(flist_DEPENDENCIES) $(EXTRA_flist_DEPENDENCIES) 
 	@rm -f flist$(EXEEXT)
 	$(LINK) $(flist_OBJECTS) $(flist_LDADD) $(LIBS)
-flist_invalid$(EXEEXT): $(flist_invalid_OBJECTS) $(flist_invalid_DEPENDENCIES) 
+flist_hidden$(EXEEXT): $(flist_hidden_OBJECTS) $(flist_hidden_DEPENDENCIES) $(EXTRA_flist_hidden_DEPENDENCIES) 
+	@rm -f flist_hidden$(EXEEXT)
+	$(LINK) $(flist_hidden_OBJECTS) $(flist_hidden_LDADD) $(LIBS)
+flist_invalid$(EXEEXT): $(flist_invalid_OBJECTS) $(flist_invalid_DEPENDENCIES) $(EXTRA_flist_invalid_DEPENDENCIES) 
 	@rm -f flist_invalid$(EXEEXT)
 	$(LINK) $(flist_invalid_OBJECTS) $(flist_invalid_LDADD) $(LIBS)
-flist_meta$(EXEEXT): $(flist_meta_OBJECTS) $(flist_meta_DEPENDENCIES) 
+flist_meta$(EXEEXT): $(flist_meta_OBJECTS) $(flist_meta_DEPENDENCIES) $(EXTRA_flist_meta_DEPENDENCIES) 
 	@rm -f flist_meta$(EXEEXT)
 	$(LINK) $(flist_meta_OBJECTS) $(flist_meta_LDADD) $(LIBS)
-flist_meta_invalid$(EXEEXT): $(flist_meta_invalid_OBJECTS) $(flist_meta_invalid_DEPENDENCIES) 
+flist_meta_hidden$(EXEEXT): $(flist_meta_hidden_OBJECTS) $(flist_meta_hidden_DEPENDENCIES) $(EXTRA_flist_meta_hidden_DEPENDENCIES) 
+	@rm -f flist_meta_hidden$(EXEEXT)
+	$(LINK) $(flist_meta_hidden_OBJECTS) $(flist_meta_hidden_LDADD) $(LIBS)
+flist_meta_invalid$(EXEEXT): $(flist_meta_invalid_OBJECTS) $(flist_meta_invalid_DEPENDENCIES) $(EXTRA_flist_meta_invalid_DEPENDENCIES) 
 	@rm -f flist_meta_invalid$(EXEEXT)
 	$(LINK) $(flist_meta_invalid_OBJECTS) $(flist_meta_invalid_LDADD) $(LIBS)
-flist_type$(EXEEXT): $(flist_type_OBJECTS) $(flist_type_DEPENDENCIES) 
+flist_type$(EXEEXT): $(flist_type_OBJECTS) $(flist_type_DEPENDENCIES) $(EXTRA_flist_type_DEPENDENCIES) 
 	@rm -f flist_type$(EXEEXT)
 	$(LINK) $(flist_type_OBJECTS) $(flist_type_LDADD) $(LIBS)
-flist_type_invalid$(EXEEXT): $(flist_type_invalid_OBJECTS) $(flist_type_invalid_DEPENDENCIES) 
+flist_type_hidden$(EXEEXT): $(flist_type_hidden_OBJECTS) $(flist_type_hidden_DEPENDENCIES) $(EXTRA_flist_type_hidden_DEPENDENCIES) 
+	@rm -f flist_type_hidden$(EXEEXT)
+	$(LINK) $(flist_type_hidden_OBJECTS) $(flist_type_hidden_LDADD) $(LIBS)
+flist_type_invalid$(EXEEXT): $(flist_type_invalid_OBJECTS) $(flist_type_invalid_DEPENDENCIES) $(EXTRA_flist_type_invalid_DEPENDENCIES) 
 	@rm -f flist_type_invalid$(EXEEXT)
 	$(LINK) $(flist_type_invalid_OBJECTS) $(flist_type_invalid_LDADD) $(LIBS)
-flist_type_meta$(EXEEXT): $(flist_type_meta_OBJECTS) $(flist_type_meta_DEPENDENCIES) 
+flist_type_meta$(EXEEXT): $(flist_type_meta_OBJECTS) $(flist_type_meta_DEPENDENCIES) $(EXTRA_flist_type_meta_DEPENDENCIES) 
 	@rm -f flist_type_meta$(EXEEXT)
 	$(LINK) $(flist_type_meta_OBJECTS) $(flist_type_meta_LDADD) $(LIBS)
-flist_type_meta_invalid$(EXEEXT): $(flist_type_meta_invalid_OBJECTS) $(flist_type_meta_invalid_DEPENDENCIES) 
+flist_type_meta_hidden$(EXEEXT): $(flist_type_meta_hidden_OBJECTS) $(flist_type_meta_hidden_DEPENDENCIES) $(EXTRA_flist_type_meta_hidden_DEPENDENCIES) 
+	@rm -f flist_type_meta_hidden$(EXEEXT)
+	$(LINK) $(flist_type_meta_hidden_OBJECTS) $(flist_type_meta_hidden_LDADD) $(LIBS)
+flist_type_meta_invalid$(EXEEXT): $(flist_type_meta_invalid_OBJECTS) $(flist_type_meta_invalid_DEPENDENCIES) $(EXTRA_flist_type_meta_invalid_DEPENDENCIES) 
 	@rm -f flist_type_meta_invalid$(EXEEXT)
 	$(LINK) $(flist_type_meta_invalid_OBJECTS) $(flist_type_meta_invalid_LDADD) $(LIBS)
-flush$(EXEEXT): $(flush_OBJECTS) $(flush_DEPENDENCIES) 
+flush$(EXEEXT): $(flush_OBJECTS) $(flush_DEPENDENCIES) $(EXTRA_flush_DEPENDENCIES) 
 	@rm -f flush$(EXEEXT)
 	$(LINK) $(flush_OBJECTS) $(flush_LDADD) $(LIBS)
-flush_all$(EXEEXT): $(flush_all_OBJECTS) $(flush_all_DEPENDENCIES) 
+flush_all$(EXEEXT): $(flush_all_OBJECTS) $(flush_all_DEPENDENCIES) $(EXTRA_flush_all_DEPENDENCIES) 
 	@rm -f flush_all$(EXEEXT)
 	$(LINK) $(flush_all_OBJECTS) $(flush_all_LDADD) $(LIBS)
-flush_bad_code$(EXEEXT): $(flush_bad_code_OBJECTS) $(flush_bad_code_DEPENDENCIES) 
+flush_bad_code$(EXEEXT): $(flush_bad_code_OBJECTS) $(flush_bad_code_DEPENDENCIES) $(EXTRA_flush_bad_code_DEPENDENCIES) 
 	@rm -f flush_bad_code$(EXEEXT)
 	$(LINK) $(flush_bad_code_OBJECTS) $(flush_bad_code_LDADD) $(LIBS)
-flush_invalid$(EXEEXT): $(flush_invalid_OBJECTS) $(flush_invalid_DEPENDENCIES) 
+flush_invalid$(EXEEXT): $(flush_invalid_OBJECTS) $(flush_invalid_DEPENDENCIES) $(EXTRA_flush_invalid_DEPENDENCIES) 
 	@rm -f flush_invalid$(EXEEXT)
 	$(LINK) $(flush_invalid_OBJECTS) $(flush_invalid_LDADD) $(LIBS)
-flush_meta$(EXEEXT): $(flush_meta_OBJECTS) $(flush_meta_DEPENDENCIES) 
+flush_meta$(EXEEXT): $(flush_meta_OBJECTS) $(flush_meta_DEPENDENCIES) $(EXTRA_flush_meta_DEPENDENCIES) 
 	@rm -f flush_meta$(EXEEXT)
 	$(LINK) $(flush_meta_OBJECTS) $(flush_meta_LDADD) $(LIBS)
-flush_spec$(EXEEXT): $(flush_spec_OBJECTS) $(flush_spec_DEPENDENCIES) 
+flush_ref$(EXEEXT): $(flush_ref_OBJECTS) $(flush_ref_DEPENDENCIES) $(EXTRA_flush_ref_DEPENDENCIES) 
+	@rm -f flush_ref$(EXEEXT)
+	$(LINK) $(flush_ref_OBJECTS) $(flush_ref_LDADD) $(LIBS)
+flush_spec$(EXEEXT): $(flush_spec_OBJECTS) $(flush_spec_DEPENDENCIES) $(EXTRA_flush_spec_DEPENDENCIES) 
 	@rm -f flush_spec$(EXEEXT)
 	$(LINK) $(flush_spec_OBJECTS) $(flush_spec_LDADD) $(LIBS)
-foffs_alter$(EXEEXT): $(foffs_alter_OBJECTS) $(foffs_alter_DEPENDENCIES) 
+foffs_alter$(EXEEXT): $(foffs_alter_OBJECTS) $(foffs_alter_DEPENDENCIES) $(EXTRA_foffs_alter_DEPENDENCIES) 
 	@rm -f foffs_alter$(EXEEXT)
 	$(LINK) $(foffs_alter_OBJECTS) $(foffs_alter_LDADD) $(LIBS)
-foffs_get$(EXEEXT): $(foffs_get_OBJECTS) $(foffs_get_DEPENDENCIES) 
+foffs_get$(EXEEXT): $(foffs_get_OBJECTS) $(foffs_get_DEPENDENCIES) $(EXTRA_foffs_get_DEPENDENCIES) 
 	@rm -f foffs_get$(EXEEXT)
 	$(LINK) $(foffs_get_OBJECTS) $(foffs_get_LDADD) $(LIBS)
-foffs_move$(EXEEXT): $(foffs_move_OBJECTS) $(foffs_move_DEPENDENCIES) 
+foffs_move$(EXEEXT): $(foffs_move_OBJECTS) $(foffs_move_DEPENDENCIES) $(EXTRA_foffs_move_DEPENDENCIES) 
 	@rm -f foffs_move$(EXEEXT)
 	$(LINK) $(foffs_move_OBJECTS) $(foffs_move_LDADD) $(LIBS)
-fragment_index$(EXEEXT): $(fragment_index_OBJECTS) $(fragment_index_DEPENDENCIES) 
+fragment_affix$(EXEEXT): $(fragment_affix_OBJECTS) $(fragment_affix_DEPENDENCIES) $(EXTRA_fragment_affix_DEPENDENCIES) 
+	@rm -f fragment_affix$(EXEEXT)
+	$(LINK) $(fragment_affix_OBJECTS) $(fragment_affix_LDADD) $(LIBS)
+fragment_affix_alter$(EXEEXT): $(fragment_affix_alter_OBJECTS) $(fragment_affix_alter_DEPENDENCIES) $(EXTRA_fragment_affix_alter_DEPENDENCIES) 
+	@rm -f fragment_affix_alter$(EXEEXT)
+	$(LINK) $(fragment_affix_alter_OBJECTS) $(fragment_affix_alter_LDADD) $(LIBS)
+fragment_affix_alter2$(EXEEXT): $(fragment_affix_alter2_OBJECTS) $(fragment_affix_alter2_DEPENDENCIES) $(EXTRA_fragment_affix_alter2_DEPENDENCIES) 
+	@rm -f fragment_affix_alter2$(EXEEXT)
+	$(LINK) $(fragment_affix_alter2_OBJECTS) $(fragment_affix_alter2_LDADD) $(LIBS)
+fragment_affix_dup$(EXEEXT): $(fragment_affix_dup_OBJECTS) $(fragment_affix_dup_DEPENDENCIES) $(EXTRA_fragment_affix_dup_DEPENDENCIES) 
+	@rm -f fragment_affix_dup$(EXEEXT)
+	$(LINK) $(fragment_affix_dup_OBJECTS) $(fragment_affix_dup_LDADD) $(LIBS)
+fragment_index$(EXEEXT): $(fragment_index_OBJECTS) $(fragment_index_DEPENDENCIES) $(EXTRA_fragment_index_DEPENDENCIES) 
 	@rm -f fragment_index$(EXEEXT)
 	$(LINK) $(fragment_index_OBJECTS) $(fragment_index_LDADD) $(LIBS)
-fragment_name$(EXEEXT): $(fragment_name_OBJECTS) $(fragment_name_DEPENDENCIES) 
+fragment_index_alias$(EXEEXT): $(fragment_index_alias_OBJECTS) $(fragment_index_alias_DEPENDENCIES) $(EXTRA_fragment_index_alias_DEPENDENCIES) 
+	@rm -f fragment_index_alias$(EXEEXT)
+	$(LINK) $(fragment_index_alias_OBJECTS) $(fragment_index_alias_LDADD) $(LIBS)
+fragment_name$(EXEEXT): $(fragment_name_OBJECTS) $(fragment_name_DEPENDENCIES) $(EXTRA_fragment_name_DEPENDENCIES) 
 	@rm -f fragment_name$(EXEEXT)
 	$(LINK) $(fragment_name_OBJECTS) $(fragment_name_LDADD) $(LIBS)
-fragment_name_oor$(EXEEXT): $(fragment_name_oor_OBJECTS) $(fragment_name_oor_DEPENDENCIES) 
+fragment_name_oor$(EXEEXT): $(fragment_name_oor_OBJECTS) $(fragment_name_oor_DEPENDENCIES) $(EXTRA_fragment_name_oor_DEPENDENCIES) 
 	@rm -f fragment_name_oor$(EXEEXT)
 	$(LINK) $(fragment_name_oor_OBJECTS) $(fragment_name_oor_LDADD) $(LIBS)
-get64$(EXEEXT): $(get64_OBJECTS) $(get64_DEPENDENCIES) 
+fragment_num$(EXEEXT): $(fragment_num_OBJECTS) $(fragment_num_DEPENDENCIES) $(EXTRA_fragment_num_DEPENDENCIES) 
+	@rm -f fragment_num$(EXEEXT)
+	$(LINK) $(fragment_num_OBJECTS) $(fragment_num_LDADD) $(LIBS)
+fragment_parent$(EXEEXT): $(fragment_parent_OBJECTS) $(fragment_parent_DEPENDENCIES) $(EXTRA_fragment_parent_DEPENDENCIES) 
+	@rm -f fragment_parent$(EXEEXT)
+	$(LINK) $(fragment_parent_OBJECTS) $(fragment_parent_LDADD) $(LIBS)
+get64$(EXEEXT): $(get64_OBJECTS) $(get64_DEPENDENCIES) $(EXTRA_get64_DEPENDENCIES) 
 	@rm -f get64$(EXEEXT)
 	$(LINK) $(get64_OBJECTS) $(get64_LDADD) $(LIBS)
-get_bad_code$(EXEEXT): $(get_bad_code_OBJECTS) $(get_bad_code_DEPENDENCIES) 
+get_affix$(EXEEXT): $(get_affix_OBJECTS) $(get_affix_DEPENDENCIES) $(EXTRA_get_affix_DEPENDENCIES) 
+	@rm -f get_affix$(EXEEXT)
+	$(LINK) $(get_affix_OBJECTS) $(get_affix_LDADD) $(LIBS)
+get_bad_code$(EXEEXT): $(get_bad_code_OBJECTS) $(get_bad_code_DEPENDENCIES) $(EXTRA_get_bad_code_DEPENDENCIES) 
 	@rm -f get_bad_code$(EXEEXT)
 	$(LINK) $(get_bad_code_OBJECTS) $(get_bad_code_LDADD) $(LIBS)
-get_bit$(EXEEXT): $(get_bit_OBJECTS) $(get_bit_DEPENDENCIES) 
+get_bit$(EXEEXT): $(get_bit_OBJECTS) $(get_bit_DEPENDENCIES) $(EXTRA_get_bit_DEPENDENCIES) 
 	@rm -f get_bit$(EXEEXT)
 	$(LINK) $(get_bit_OBJECTS) $(get_bit_LDADD) $(LIBS)
-get_carray$(EXEEXT): $(get_carray_OBJECTS) $(get_carray_DEPENDENCIES) 
+get_carray$(EXEEXT): $(get_carray_OBJECTS) $(get_carray_DEPENDENCIES) $(EXTRA_get_carray_DEPENDENCIES) 
 	@rm -f get_carray$(EXEEXT)
 	$(LINK) $(get_carray_OBJECTS) $(get_carray_LDADD) $(LIBS)
-get_carray_len$(EXEEXT): $(get_carray_len_OBJECTS) $(get_carray_len_DEPENDENCIES) 
+get_carray_len$(EXEEXT): $(get_carray_len_OBJECTS) $(get_carray_len_DEPENDENCIES) $(EXTRA_get_carray_len_DEPENDENCIES) 
 	@rm -f get_carray_len$(EXEEXT)
 	$(LINK) $(get_carray_len_OBJECTS) $(get_carray_len_LDADD) $(LIBS)
-get_carray_slice$(EXEEXT): $(get_carray_slice_OBJECTS) $(get_carray_slice_DEPENDENCIES) 
+get_carray_slice$(EXEEXT): $(get_carray_slice_OBJECTS) $(get_carray_slice_DEPENDENCIES) $(EXTRA_get_carray_slice_DEPENDENCIES) 
 	@rm -f get_carray_slice$(EXEEXT)
 	$(LINK) $(get_carray_slice_OBJECTS) $(get_carray_slice_LDADD) $(LIBS)
-get_char$(EXEEXT): $(get_char_OBJECTS) $(get_char_DEPENDENCIES) 
+get_char$(EXEEXT): $(get_char_OBJECTS) $(get_char_DEPENDENCIES) $(EXTRA_get_char_DEPENDENCIES) 
 	@rm -f get_char$(EXEEXT)
 	$(LINK) $(get_char_OBJECTS) $(get_char_LDADD) $(LIBS)
-get_clincom$(EXEEXT): $(get_clincom_OBJECTS) $(get_clincom_DEPENDENCIES) 
+get_clincom$(EXEEXT): $(get_clincom_OBJECTS) $(get_clincom_DEPENDENCIES) $(EXTRA_get_clincom_DEPENDENCIES) 
 	@rm -f get_clincom$(EXEEXT)
 	$(LINK) $(get_clincom_OBJECTS) $(get_clincom_LDADD) $(LIBS)
-get_complex128$(EXEEXT): $(get_complex128_OBJECTS) $(get_complex128_DEPENDENCIES) 
+get_complex128$(EXEEXT): $(get_complex128_OBJECTS) $(get_complex128_DEPENDENCIES) $(EXTRA_get_complex128_DEPENDENCIES) 
 	@rm -f get_complex128$(EXEEXT)
 	$(LINK) $(get_complex128_OBJECTS) $(get_complex128_LDADD) $(LIBS)
-get_complex64$(EXEEXT): $(get_complex64_OBJECTS) $(get_complex64_DEPENDENCIES) 
+get_complex64$(EXEEXT): $(get_complex64_OBJECTS) $(get_complex64_DEPENDENCIES) $(EXTRA_get_complex64_DEPENDENCIES) 
 	@rm -f get_complex64$(EXEEXT)
 	$(LINK) $(get_complex64_OBJECTS) $(get_complex64_LDADD) $(LIBS)
-get_const$(EXEEXT): $(get_const_OBJECTS) $(get_const_DEPENDENCIES) 
+get_const$(EXEEXT): $(get_const_OBJECTS) $(get_const_DEPENDENCIES) $(EXTRA_get_const_DEPENDENCIES) 
 	@rm -f get_const$(EXEEXT)
 	$(LINK) $(get_const_OBJECTS) $(get_const_LDADD) $(LIBS)
-get_const_complex$(EXEEXT): $(get_const_complex_OBJECTS) $(get_const_complex_DEPENDENCIES) 
+get_const_complex$(EXEEXT): $(get_const_complex_OBJECTS) $(get_const_complex_DEPENDENCIES) $(EXTRA_get_const_complex_DEPENDENCIES) 
 	@rm -f get_const_complex$(EXEEXT)
 	$(LINK) $(get_const_complex_OBJECTS) $(get_const_complex_LDADD) $(LIBS)
-get_const_repr$(EXEEXT): $(get_const_repr_OBJECTS) $(get_const_repr_DEPENDENCIES) 
+get_const_repr$(EXEEXT): $(get_const_repr_OBJECTS) $(get_const_repr_DEPENDENCIES) $(EXTRA_get_const_repr_DEPENDENCIES) 
 	@rm -f get_const_repr$(EXEEXT)
 	$(LINK) $(get_const_repr_OBJECTS) $(get_const_repr_LDADD) $(LIBS)
-get_cpolynom$(EXEEXT): $(get_cpolynom_OBJECTS) $(get_cpolynom_DEPENDENCIES) 
+get_cpolynom$(EXEEXT): $(get_cpolynom_OBJECTS) $(get_cpolynom_DEPENDENCIES) $(EXTRA_get_cpolynom_DEPENDENCIES) 
 	@rm -f get_cpolynom$(EXEEXT)
 	$(LINK) $(get_cpolynom_OBJECTS) $(get_cpolynom_LDADD) $(LIBS)
-get_divide$(EXEEXT): $(get_divide_OBJECTS) $(get_divide_DEPENDENCIES) 
+get_divide$(EXEEXT): $(get_divide_OBJECTS) $(get_divide_DEPENDENCIES) $(EXTRA_get_divide_DEPENDENCIES) 
 	@rm -f get_divide$(EXEEXT)
 	$(LINK) $(get_divide_OBJECTS) $(get_divide_LDADD) $(LIBS)
-get_endian16$(EXEEXT): $(get_endian16_OBJECTS) $(get_endian16_DEPENDENCIES) 
+get_endian16$(EXEEXT): $(get_endian16_OBJECTS) $(get_endian16_DEPENDENCIES) $(EXTRA_get_endian16_DEPENDENCIES) 
 	@rm -f get_endian16$(EXEEXT)
 	$(LINK) $(get_endian16_OBJECTS) $(get_endian16_LDADD) $(LIBS)
-get_endian32$(EXEEXT): $(get_endian32_OBJECTS) $(get_endian32_DEPENDENCIES) 
+get_endian32$(EXEEXT): $(get_endian32_OBJECTS) $(get_endian32_DEPENDENCIES) $(EXTRA_get_endian32_DEPENDENCIES) 
 	@rm -f get_endian32$(EXEEXT)
 	$(LINK) $(get_endian32_OBJECTS) $(get_endian32_LDADD) $(LIBS)
-get_endian64$(EXEEXT): $(get_endian64_OBJECTS) $(get_endian64_DEPENDENCIES) 
+get_endian64$(EXEEXT): $(get_endian64_OBJECTS) $(get_endian64_DEPENDENCIES) $(EXTRA_get_endian64_DEPENDENCIES) 
 	@rm -f get_endian64$(EXEEXT)
 	$(LINK) $(get_endian64_OBJECTS) $(get_endian64_LDADD) $(LIBS)
-get_endian8$(EXEEXT): $(get_endian8_OBJECTS) $(get_endian8_DEPENDENCIES) 
+get_endian8$(EXEEXT): $(get_endian8_OBJECTS) $(get_endian8_DEPENDENCIES) $(EXTRA_get_endian8_DEPENDENCIES) 
 	@rm -f get_endian8$(EXEEXT)
 	$(LINK) $(get_endian8_OBJECTS) $(get_endian8_LDADD) $(LIBS)
-get_endian_complex128_arm$(EXEEXT): $(get_endian_complex128_arm_OBJECTS) $(get_endian_complex128_arm_DEPENDENCIES) 
+get_endian_complex128_arm$(EXEEXT): $(get_endian_complex128_arm_OBJECTS) $(get_endian_complex128_arm_DEPENDENCIES) $(EXTRA_get_endian_complex128_arm_DEPENDENCIES) 
 	@rm -f get_endian_complex128_arm$(EXEEXT)
 	$(LINK) $(get_endian_complex128_arm_OBJECTS) $(get_endian_complex128_arm_LDADD) $(LIBS)
-get_endian_complex128_big$(EXEEXT): $(get_endian_complex128_big_OBJECTS) $(get_endian_complex128_big_DEPENDENCIES) 
+get_endian_complex128_big$(EXEEXT): $(get_endian_complex128_big_OBJECTS) $(get_endian_complex128_big_DEPENDENCIES) $(EXTRA_get_endian_complex128_big_DEPENDENCIES) 
 	@rm -f get_endian_complex128_big$(EXEEXT)
 	$(LINK) $(get_endian_complex128_big_OBJECTS) $(get_endian_complex128_big_LDADD) $(LIBS)
-get_endian_complex128_little$(EXEEXT): $(get_endian_complex128_little_OBJECTS) $(get_endian_complex128_little_DEPENDENCIES) 
+get_endian_complex128_little$(EXEEXT): $(get_endian_complex128_little_OBJECTS) $(get_endian_complex128_little_DEPENDENCIES) $(EXTRA_get_endian_complex128_little_DEPENDENCIES) 
 	@rm -f get_endian_complex128_little$(EXEEXT)
 	$(LINK) $(get_endian_complex128_little_OBJECTS) $(get_endian_complex128_little_LDADD) $(LIBS)
-get_endian_complex64_arm$(EXEEXT): $(get_endian_complex64_arm_OBJECTS) $(get_endian_complex64_arm_DEPENDENCIES) 
+get_endian_complex64_arm$(EXEEXT): $(get_endian_complex64_arm_OBJECTS) $(get_endian_complex64_arm_DEPENDENCIES) $(EXTRA_get_endian_complex64_arm_DEPENDENCIES) 
 	@rm -f get_endian_complex64_arm$(EXEEXT)
 	$(LINK) $(get_endian_complex64_arm_OBJECTS) $(get_endian_complex64_arm_LDADD) $(LIBS)
-get_endian_complex64_big$(EXEEXT): $(get_endian_complex64_big_OBJECTS) $(get_endian_complex64_big_DEPENDENCIES) 
+get_endian_complex64_big$(EXEEXT): $(get_endian_complex64_big_OBJECTS) $(get_endian_complex64_big_DEPENDENCIES) $(EXTRA_get_endian_complex64_big_DEPENDENCIES) 
 	@rm -f get_endian_complex64_big$(EXEEXT)
 	$(LINK) $(get_endian_complex64_big_OBJECTS) $(get_endian_complex64_big_LDADD) $(LIBS)
-get_endian_complex64_little$(EXEEXT): $(get_endian_complex64_little_OBJECTS) $(get_endian_complex64_little_DEPENDENCIES) 
+get_endian_complex64_little$(EXEEXT): $(get_endian_complex64_little_OBJECTS) $(get_endian_complex64_little_DEPENDENCIES) $(EXTRA_get_endian_complex64_little_DEPENDENCIES) 
 	@rm -f get_endian_complex64_little$(EXEEXT)
 	$(LINK) $(get_endian_complex64_little_OBJECTS) $(get_endian_complex64_little_LDADD) $(LIBS)
-get_endian_float32_arm$(EXEEXT): $(get_endian_float32_arm_OBJECTS) $(get_endian_float32_arm_DEPENDENCIES) 
+get_endian_float32_arm$(EXEEXT): $(get_endian_float32_arm_OBJECTS) $(get_endian_float32_arm_DEPENDENCIES) $(EXTRA_get_endian_float32_arm_DEPENDENCIES) 
 	@rm -f get_endian_float32_arm$(EXEEXT)
 	$(LINK) $(get_endian_float32_arm_OBJECTS) $(get_endian_float32_arm_LDADD) $(LIBS)
-get_endian_float32_big$(EXEEXT): $(get_endian_float32_big_OBJECTS) $(get_endian_float32_big_DEPENDENCIES) 
+get_endian_float32_big$(EXEEXT): $(get_endian_float32_big_OBJECTS) $(get_endian_float32_big_DEPENDENCIES) $(EXTRA_get_endian_float32_big_DEPENDENCIES) 
 	@rm -f get_endian_float32_big$(EXEEXT)
 	$(LINK) $(get_endian_float32_big_OBJECTS) $(get_endian_float32_big_LDADD) $(LIBS)
-get_endian_float32_little$(EXEEXT): $(get_endian_float32_little_OBJECTS) $(get_endian_float32_little_DEPENDENCIES) 
+get_endian_float32_little$(EXEEXT): $(get_endian_float32_little_OBJECTS) $(get_endian_float32_little_DEPENDENCIES) $(EXTRA_get_endian_float32_little_DEPENDENCIES) 
 	@rm -f get_endian_float32_little$(EXEEXT)
 	$(LINK) $(get_endian_float32_little_OBJECTS) $(get_endian_float32_little_LDADD) $(LIBS)
-get_endian_float64_arm$(EXEEXT): $(get_endian_float64_arm_OBJECTS) $(get_endian_float64_arm_DEPENDENCIES) 
+get_endian_float64_arm$(EXEEXT): $(get_endian_float64_arm_OBJECTS) $(get_endian_float64_arm_DEPENDENCIES) $(EXTRA_get_endian_float64_arm_DEPENDENCIES) 
 	@rm -f get_endian_float64_arm$(EXEEXT)
 	$(LINK) $(get_endian_float64_arm_OBJECTS) $(get_endian_float64_arm_LDADD) $(LIBS)
-get_endian_float64_big$(EXEEXT): $(get_endian_float64_big_OBJECTS) $(get_endian_float64_big_DEPENDENCIES) 
+get_endian_float64_big$(EXEEXT): $(get_endian_float64_big_OBJECTS) $(get_endian_float64_big_DEPENDENCIES) $(EXTRA_get_endian_float64_big_DEPENDENCIES) 
 	@rm -f get_endian_float64_big$(EXEEXT)
 	$(LINK) $(get_endian_float64_big_OBJECTS) $(get_endian_float64_big_LDADD) $(LIBS)
-get_endian_float64_little$(EXEEXT): $(get_endian_float64_little_OBJECTS) $(get_endian_float64_little_DEPENDENCIES) 
+get_endian_float64_little$(EXEEXT): $(get_endian_float64_little_OBJECTS) $(get_endian_float64_little_DEPENDENCIES) $(EXTRA_get_endian_float64_little_DEPENDENCIES) 
 	@rm -f get_endian_float64_little$(EXEEXT)
 	$(LINK) $(get_endian_float64_little_OBJECTS) $(get_endian_float64_little_LDADD) $(LIBS)
-get_ff$(EXEEXT): $(get_ff_OBJECTS) $(get_ff_DEPENDENCIES) 
+get_ff$(EXEEXT): $(get_ff_OBJECTS) $(get_ff_DEPENDENCIES) $(EXTRA_get_ff_DEPENDENCIES) 
 	@rm -f get_ff$(EXEEXT)
 	$(LINK) $(get_ff_OBJECTS) $(get_ff_LDADD) $(LIBS)
-get_float32$(EXEEXT): $(get_float32_OBJECTS) $(get_float32_DEPENDENCIES) 
+get_float32$(EXEEXT): $(get_float32_OBJECTS) $(get_float32_DEPENDENCIES) $(EXTRA_get_float32_DEPENDENCIES) 
 	@rm -f get_float32$(EXEEXT)
 	$(LINK) $(get_float32_OBJECTS) $(get_float32_LDADD) $(LIBS)
-get_float64$(EXEEXT): $(get_float64_OBJECTS) $(get_float64_DEPENDENCIES) 
+get_float64$(EXEEXT): $(get_float64_OBJECTS) $(get_float64_DEPENDENCIES) $(EXTRA_get_float64_DEPENDENCIES) 
 	@rm -f get_float64$(EXEEXT)
 	$(LINK) $(get_float64_OBJECTS) $(get_float64_LDADD) $(LIBS)
-get_foffs$(EXEEXT): $(get_foffs_OBJECTS) $(get_foffs_DEPENDENCIES) 
+get_foffs$(EXEEXT): $(get_foffs_OBJECTS) $(get_foffs_DEPENDENCIES) $(EXTRA_get_foffs_DEPENDENCIES) 
 	@rm -f get_foffs$(EXEEXT)
 	$(LINK) $(get_foffs_OBJECTS) $(get_foffs_LDADD) $(LIBS)
-get_fs$(EXEEXT): $(get_fs_OBJECTS) $(get_fs_DEPENDENCIES) 
+get_fs$(EXEEXT): $(get_fs_OBJECTS) $(get_fs_DEPENDENCIES) $(EXTRA_get_fs_DEPENDENCIES) 
 	@rm -f get_fs$(EXEEXT)
 	$(LINK) $(get_fs_OBJECTS) $(get_fs_LDADD) $(LIBS)
-get_int16$(EXEEXT): $(get_int16_OBJECTS) $(get_int16_DEPENDENCIES) 
+get_here$(EXEEXT): $(get_here_OBJECTS) $(get_here_DEPENDENCIES) $(EXTRA_get_here_DEPENDENCIES) 
+	@rm -f get_here$(EXEEXT)
+	$(LINK) $(get_here_OBJECTS) $(get_here_LDADD) $(LIBS)
+get_here_foffs$(EXEEXT): $(get_here_foffs_OBJECTS) $(get_here_foffs_DEPENDENCIES) $(EXTRA_get_here_foffs_DEPENDENCIES) 
+	@rm -f get_here_foffs$(EXEEXT)
+	$(LINK) $(get_here_foffs_OBJECTS) $(get_here_foffs_LDADD) $(LIBS)
+get_heres$(EXEEXT): $(get_heres_OBJECTS) $(get_heres_DEPENDENCIES) $(EXTRA_get_heres_DEPENDENCIES) 
+	@rm -f get_heres$(EXEEXT)
+	$(LINK) $(get_heres_OBJECTS) $(get_heres_LDADD) $(LIBS)
+get_int16$(EXEEXT): $(get_int16_OBJECTS) $(get_int16_DEPENDENCIES) $(EXTRA_get_int16_DEPENDENCIES) 
 	@rm -f get_int16$(EXEEXT)
 	$(LINK) $(get_int16_OBJECTS) $(get_int16_LDADD) $(LIBS)
-get_int32$(EXEEXT): $(get_int32_OBJECTS) $(get_int32_DEPENDENCIES) 
+get_int32$(EXEEXT): $(get_int32_OBJECTS) $(get_int32_DEPENDENCIES) $(EXTRA_get_int32_DEPENDENCIES) 
 	@rm -f get_int32$(EXEEXT)
 	$(LINK) $(get_int32_OBJECTS) $(get_int32_LDADD) $(LIBS)
-get_int64$(EXEEXT): $(get_int64_OBJECTS) $(get_int64_DEPENDENCIES) 
+get_int64$(EXEEXT): $(get_int64_OBJECTS) $(get_int64_DEPENDENCIES) $(EXTRA_get_int64_DEPENDENCIES) 
 	@rm -f get_int64$(EXEEXT)
 	$(LINK) $(get_int64_OBJECTS) $(get_int64_LDADD) $(LIBS)
-get_int8$(EXEEXT): $(get_int8_OBJECTS) $(get_int8_DEPENDENCIES) 
+get_int8$(EXEEXT): $(get_int8_OBJECTS) $(get_int8_DEPENDENCIES) $(EXTRA_get_int8_DEPENDENCIES) 
 	@rm -f get_int8$(EXEEXT)
 	$(LINK) $(get_int8_OBJECTS) $(get_int8_LDADD) $(LIBS)
-get_invalid$(EXEEXT): $(get_invalid_OBJECTS) $(get_invalid_DEPENDENCIES) 
+get_invalid$(EXEEXT): $(get_invalid_OBJECTS) $(get_invalid_DEPENDENCIES) $(EXTRA_get_invalid_DEPENDENCIES) 
 	@rm -f get_invalid$(EXEEXT)
 	$(LINK) $(get_invalid_OBJECTS) $(get_invalid_LDADD) $(LIBS)
-get_lincom1$(EXEEXT): $(get_lincom1_OBJECTS) $(get_lincom1_DEPENDENCIES) 
+get_lincom1$(EXEEXT): $(get_lincom1_OBJECTS) $(get_lincom1_DEPENDENCIES) $(EXTRA_get_lincom1_DEPENDENCIES) 
 	@rm -f get_lincom1$(EXEEXT)
 	$(LINK) $(get_lincom1_OBJECTS) $(get_lincom1_LDADD) $(LIBS)
-get_lincom2$(EXEEXT): $(get_lincom2_OBJECTS) $(get_lincom2_DEPENDENCIES) 
+get_lincom2$(EXEEXT): $(get_lincom2_OBJECTS) $(get_lincom2_DEPENDENCIES) $(EXTRA_get_lincom2_DEPENDENCIES) 
 	@rm -f get_lincom2$(EXEEXT)
 	$(LINK) $(get_lincom2_OBJECTS) $(get_lincom2_LDADD) $(LIBS)
-get_lincom3$(EXEEXT): $(get_lincom3_OBJECTS) $(get_lincom3_DEPENDENCIES) 
+get_lincom3$(EXEEXT): $(get_lincom3_OBJECTS) $(get_lincom3_DEPENDENCIES) $(EXTRA_get_lincom3_DEPENDENCIES) 
 	@rm -f get_lincom3$(EXEEXT)
 	$(LINK) $(get_lincom3_OBJECTS) $(get_lincom3_LDADD) $(LIBS)
-get_lincom_noin$(EXEEXT): $(get_lincom_noin_OBJECTS) $(get_lincom_noin_DEPENDENCIES) 
+get_lincom_noin$(EXEEXT): $(get_lincom_noin_OBJECTS) $(get_lincom_noin_DEPENDENCIES) $(EXTRA_get_lincom_noin_DEPENDENCIES) 
 	@rm -f get_lincom_noin$(EXEEXT)
 	$(LINK) $(get_lincom_noin_OBJECTS) $(get_lincom_noin_LDADD) $(LIBS)
-get_lincom_non$(EXEEXT): $(get_lincom_non_OBJECTS) $(get_lincom_non_DEPENDENCIES) 
+get_lincom_non$(EXEEXT): $(get_lincom_non_OBJECTS) $(get_lincom_non_DEPENDENCIES) $(EXTRA_get_lincom_non_DEPENDENCIES) 
 	@rm -f get_lincom_non$(EXEEXT)
 	$(LINK) $(get_lincom_non_OBJECTS) $(get_lincom_non_LDADD) $(LIBS)
-get_linterp$(EXEEXT): $(get_linterp_OBJECTS) $(get_linterp_DEPENDENCIES) 
+get_lincom_null$(EXEEXT): $(get_lincom_null_OBJECTS) $(get_lincom_null_DEPENDENCIES) $(EXTRA_get_lincom_null_DEPENDENCIES) 
+	@rm -f get_lincom_null$(EXEEXT)
+	$(LINK) $(get_lincom_null_OBJECTS) $(get_lincom_null_LDADD) $(LIBS)
+get_lincom_spf$(EXEEXT): $(get_lincom_spf_OBJECTS) $(get_lincom_spf_DEPENDENCIES) $(EXTRA_get_lincom_spf_DEPENDENCIES) 
+	@rm -f get_lincom_spf$(EXEEXT)
+	$(LINK) $(get_lincom_spf_OBJECTS) $(get_lincom_spf_LDADD) $(LIBS)
+get_linterp$(EXEEXT): $(get_linterp_OBJECTS) $(get_linterp_DEPENDENCIES) $(EXTRA_get_linterp_DEPENDENCIES) 
 	@rm -f get_linterp$(EXEEXT)
 	$(LINK) $(get_linterp_OBJECTS) $(get_linterp_LDADD) $(LIBS)
-get_linterp_noin$(EXEEXT): $(get_linterp_noin_OBJECTS) $(get_linterp_noin_DEPENDENCIES) 
+get_linterp_noin$(EXEEXT): $(get_linterp_noin_OBJECTS) $(get_linterp_noin_DEPENDENCIES) $(EXTRA_get_linterp_noin_DEPENDENCIES) 
 	@rm -f get_linterp_noin$(EXEEXT)
 	$(LINK) $(get_linterp_noin_OBJECTS) $(get_linterp_noin_LDADD) $(LIBS)
-get_linterp_notab$(EXEEXT): $(get_linterp_notab_OBJECTS) $(get_linterp_notab_DEPENDENCIES) 
+get_linterp_notab$(EXEEXT): $(get_linterp_notab_OBJECTS) $(get_linterp_notab_DEPENDENCIES) $(EXTRA_get_linterp_notab_DEPENDENCIES) 
 	@rm -f get_linterp_notab$(EXEEXT)
 	$(LINK) $(get_linterp_notab_OBJECTS) $(get_linterp_notab_LDADD) $(LIBS)
-get_linterp_sort$(EXEEXT): $(get_linterp_sort_OBJECTS) $(get_linterp_sort_DEPENDENCIES) 
+get_linterp_sort$(EXEEXT): $(get_linterp_sort_OBJECTS) $(get_linterp_sort_DEPENDENCIES) $(EXTRA_get_linterp_sort_DEPENDENCIES) 
 	@rm -f get_linterp_sort$(EXEEXT)
 	$(LINK) $(get_linterp_sort_OBJECTS) $(get_linterp_sort_LDADD) $(LIBS)
-get_multiply$(EXEEXT): $(get_multiply_OBJECTS) $(get_multiply_DEPENDENCIES) 
+get_mplex$(EXEEXT): $(get_mplex_OBJECTS) $(get_mplex_DEPENDENCIES) $(EXTRA_get_mplex_DEPENDENCIES) 
+	@rm -f get_mplex$(EXEEXT)
+	$(LINK) $(get_mplex_OBJECTS) $(get_mplex_LDADD) $(LIBS)
+get_mplex_bof$(EXEEXT): $(get_mplex_bof_OBJECTS) $(get_mplex_bof_DEPENDENCIES) $(EXTRA_get_mplex_bof_DEPENDENCIES) 
+	@rm -f get_mplex_bof$(EXEEXT)
+	$(LINK) $(get_mplex_bof_OBJECTS) $(get_mplex_bof_LDADD) $(LIBS)
+get_mplex_lb$(EXEEXT): $(get_mplex_lb_OBJECTS) $(get_mplex_lb_DEPENDENCIES) $(EXTRA_get_mplex_lb_DEPENDENCIES) 
+	@rm -f get_mplex_lb$(EXEEXT)
+	$(LINK) $(get_mplex_lb_OBJECTS) $(get_mplex_lb_LDADD) $(LIBS)
+get_mplex_lball$(EXEEXT): $(get_mplex_lball_OBJECTS) $(get_mplex_lball_DEPENDENCIES) $(EXTRA_get_mplex_lball_DEPENDENCIES) 
+	@rm -f get_mplex_lball$(EXEEXT)
+	$(LINK) $(get_mplex_lball_OBJECTS) $(get_mplex_lball_LDADD) $(LIBS)
+get_mplex_nolb$(EXEEXT): $(get_mplex_nolb_OBJECTS) $(get_mplex_nolb_DEPENDENCIES) $(EXTRA_get_mplex_nolb_DEPENDENCIES) 
+	@rm -f get_mplex_nolb$(EXEEXT)
+	$(LINK) $(get_mplex_nolb_OBJECTS) $(get_mplex_nolb_LDADD) $(LIBS)
+get_multiply$(EXEEXT): $(get_multiply_OBJECTS) $(get_multiply_DEPENDENCIES) $(EXTRA_get_multiply_DEPENDENCIES) 
 	@rm -f get_multiply$(EXEEXT)
 	$(LINK) $(get_multiply_OBJECTS) $(get_multiply_LDADD) $(LIBS)
-get_multiply_noin$(EXEEXT): $(get_multiply_noin_OBJECTS) $(get_multiply_noin_DEPENDENCIES) 
+get_multiply_noin$(EXEEXT): $(get_multiply_noin_OBJECTS) $(get_multiply_noin_DEPENDENCIES) $(EXTRA_get_multiply_noin_DEPENDENCIES) 
 	@rm -f get_multiply_noin$(EXEEXT)
 	$(LINK) $(get_multiply_noin_OBJECTS) $(get_multiply_noin_LDADD) $(LIBS)
-get_nonexistent$(EXEEXT): $(get_nonexistent_OBJECTS) $(get_nonexistent_DEPENDENCIES) 
+get_nonexistent$(EXEEXT): $(get_nonexistent_OBJECTS) $(get_nonexistent_DEPENDENCIES) $(EXTRA_get_nonexistent_DEPENDENCIES) 
 	@rm -f get_nonexistent$(EXEEXT)
 	$(LINK) $(get_nonexistent_OBJECTS) $(get_nonexistent_LDADD) $(LIBS)
-get_null$(EXEEXT): $(get_null_OBJECTS) $(get_null_DEPENDENCIES) 
+get_null$(EXEEXT): $(get_null_OBJECTS) $(get_null_DEPENDENCIES) $(EXTRA_get_null_DEPENDENCIES) 
 	@rm -f get_null$(EXEEXT)
 	$(LINK) $(get_null_OBJECTS) $(get_null_LDADD) $(LIBS)
-get_off64$(EXEEXT): $(get_off64_OBJECTS) $(get_off64_DEPENDENCIES) 
+get_off64$(EXEEXT): $(get_off64_OBJECTS) $(get_off64_DEPENDENCIES) $(EXTRA_get_off64_DEPENDENCIES) 
 	@rm -f get_off64$(EXEEXT)
 	$(LINK) $(get_off64_OBJECTS) $(get_off64_LDADD) $(LIBS)
-get_phase$(EXEEXT): $(get_phase_OBJECTS) $(get_phase_DEPENDENCIES) 
+get_phase$(EXEEXT): $(get_phase_OBJECTS) $(get_phase_DEPENDENCIES) $(EXTRA_get_phase_DEPENDENCIES) 
 	@rm -f get_phase$(EXEEXT)
 	$(LINK) $(get_phase_OBJECTS) $(get_phase_LDADD) $(LIBS)
-get_polynom$(EXEEXT): $(get_polynom_OBJECTS) $(get_polynom_DEPENDENCIES) 
+get_phase_affix$(EXEEXT): $(get_phase_affix_OBJECTS) $(get_phase_affix_DEPENDENCIES) $(EXTRA_get_phase_affix_DEPENDENCIES) 
+	@rm -f get_phase_affix$(EXEEXT)
+	$(LINK) $(get_phase_affix_OBJECTS) $(get_phase_affix_LDADD) $(LIBS)
+get_polynom$(EXEEXT): $(get_polynom_OBJECTS) $(get_polynom_DEPENDENCIES) $(EXTRA_get_polynom_DEPENDENCIES) 
 	@rm -f get_polynom$(EXEEXT)
 	$(LINK) $(get_polynom_OBJECTS) $(get_polynom_LDADD) $(LIBS)
-get_polynom_noin$(EXEEXT): $(get_polynom_noin_OBJECTS) $(get_polynom_noin_DEPENDENCIES) 
+get_polynom_noin$(EXEEXT): $(get_polynom_noin_OBJECTS) $(get_polynom_noin_DEPENDENCIES) $(EXTRA_get_polynom_noin_DEPENDENCIES) 
 	@rm -f get_polynom_noin$(EXEEXT)
 	$(LINK) $(get_polynom_noin_OBJECTS) $(get_polynom_noin_LDADD) $(LIBS)
-get_recip$(EXEEXT): $(get_recip_OBJECTS) $(get_recip_DEPENDENCIES) 
+get_recip$(EXEEXT): $(get_recip_OBJECTS) $(get_recip_DEPENDENCIES) $(EXTRA_get_recip_DEPENDENCIES) 
 	@rm -f get_recip$(EXEEXT)
 	$(LINK) $(get_recip_OBJECTS) $(get_recip_LDADD) $(LIBS)
-get_recip_const$(EXEEXT): $(get_recip_const_OBJECTS) $(get_recip_const_DEPENDENCIES) 
+get_recip_const$(EXEEXT): $(get_recip_const_OBJECTS) $(get_recip_const_DEPENDENCIES) $(EXTRA_get_recip_const_DEPENDENCIES) 
 	@rm -f get_recip_const$(EXEEXT)
 	$(LINK) $(get_recip_const_OBJECTS) $(get_recip_const_LDADD) $(LIBS)
-get_recurse$(EXEEXT): $(get_recurse_OBJECTS) $(get_recurse_DEPENDENCIES) 
+get_recurse$(EXEEXT): $(get_recurse_OBJECTS) $(get_recurse_DEPENDENCIES) $(EXTRA_get_recurse_DEPENDENCIES) 
 	@rm -f get_recurse$(EXEEXT)
 	$(LINK) $(get_recurse_OBJECTS) $(get_recurse_LDADD) $(LIBS)
-get_sbit$(EXEEXT): $(get_sbit_OBJECTS) $(get_sbit_DEPENDENCIES) 
+get_rofs$(EXEEXT): $(get_rofs_OBJECTS) $(get_rofs_DEPENDENCIES) $(EXTRA_get_rofs_DEPENDENCIES) 
+	@rm -f get_rofs$(EXEEXT)
+	$(LINK) $(get_rofs_OBJECTS) $(get_rofs_LDADD) $(LIBS)
+get_sbit$(EXEEXT): $(get_sbit_OBJECTS) $(get_sbit_DEPENDENCIES) $(EXTRA_get_sbit_DEPENDENCIES) 
 	@rm -f get_sbit$(EXEEXT)
 	$(LINK) $(get_sbit_OBJECTS) $(get_sbit_LDADD) $(LIBS)
-get_sf$(EXEEXT): $(get_sf_OBJECTS) $(get_sf_DEPENDENCIES) 
+get_sf$(EXEEXT): $(get_sf_OBJECTS) $(get_sf_DEPENDENCIES) $(EXTRA_get_sf_DEPENDENCIES) 
 	@rm -f get_sf$(EXEEXT)
 	$(LINK) $(get_sf_OBJECTS) $(get_sf_LDADD) $(LIBS)
-get_ss$(EXEEXT): $(get_ss_OBJECTS) $(get_ss_DEPENDENCIES) 
+get_ss$(EXEEXT): $(get_ss_OBJECTS) $(get_ss_DEPENDENCIES) $(EXTRA_get_ss_DEPENDENCIES) 
 	@rm -f get_ss$(EXEEXT)
 	$(LINK) $(get_ss_OBJECTS) $(get_ss_LDADD) $(LIBS)
-get_type$(EXEEXT): $(get_type_OBJECTS) $(get_type_DEPENDENCIES) 
+get_type$(EXEEXT): $(get_type_OBJECTS) $(get_type_DEPENDENCIES) $(EXTRA_get_type_DEPENDENCIES) 
 	@rm -f get_type$(EXEEXT)
 	$(LINK) $(get_type_OBJECTS) $(get_type_LDADD) $(LIBS)
-get_uint16$(EXEEXT): $(get_uint16_OBJECTS) $(get_uint16_DEPENDENCIES) 
+get_uint16$(EXEEXT): $(get_uint16_OBJECTS) $(get_uint16_DEPENDENCIES) $(EXTRA_get_uint16_DEPENDENCIES) 
 	@rm -f get_uint16$(EXEEXT)
 	$(LINK) $(get_uint16_OBJECTS) $(get_uint16_LDADD) $(LIBS)
-get_uint32$(EXEEXT): $(get_uint32_OBJECTS) $(get_uint32_DEPENDENCIES) 
+get_uint32$(EXEEXT): $(get_uint32_OBJECTS) $(get_uint32_DEPENDENCIES) $(EXTRA_get_uint32_DEPENDENCIES) 
 	@rm -f get_uint32$(EXEEXT)
 	$(LINK) $(get_uint32_OBJECTS) $(get_uint32_LDADD) $(LIBS)
-get_uint64$(EXEEXT): $(get_uint64_OBJECTS) $(get_uint64_DEPENDENCIES) 
+get_uint64$(EXEEXT): $(get_uint64_OBJECTS) $(get_uint64_DEPENDENCIES) $(EXTRA_get_uint64_DEPENDENCIES) 
 	@rm -f get_uint64$(EXEEXT)
 	$(LINK) $(get_uint64_OBJECTS) $(get_uint64_LDADD) $(LIBS)
-get_zero$(EXEEXT): $(get_zero_OBJECTS) $(get_zero_DEPENDENCIES) 
+get_window$(EXEEXT): $(get_window_OBJECTS) $(get_window_DEPENDENCIES) $(EXTRA_get_window_DEPENDENCIES) 
+	@rm -f get_window$(EXEEXT)
+	$(LINK) $(get_window_OBJECTS) $(get_window_LDADD) $(LIBS)
+get_window_clr$(EXEEXT): $(get_window_clr_OBJECTS) $(get_window_clr_DEPENDENCIES) $(EXTRA_get_window_clr_DEPENDENCIES) 
+	@rm -f get_window_clr$(EXEEXT)
+	$(LINK) $(get_window_clr_OBJECTS) $(get_window_clr_LDADD) $(LIBS)
+get_window_ge$(EXEEXT): $(get_window_ge_OBJECTS) $(get_window_ge_DEPENDENCIES) $(EXTRA_get_window_ge_DEPENDENCIES) 
+	@rm -f get_window_ge$(EXEEXT)
+	$(LINK) $(get_window_ge_OBJECTS) $(get_window_ge_LDADD) $(LIBS)
+get_window_gt$(EXEEXT): $(get_window_gt_OBJECTS) $(get_window_gt_DEPENDENCIES) $(EXTRA_get_window_gt_DEPENDENCIES) 
+	@rm -f get_window_gt$(EXEEXT)
+	$(LINK) $(get_window_gt_OBJECTS) $(get_window_gt_LDADD) $(LIBS)
+get_window_le$(EXEEXT): $(get_window_le_OBJECTS) $(get_window_le_DEPENDENCIES) $(EXTRA_get_window_le_DEPENDENCIES) 
+	@rm -f get_window_le$(EXEEXT)
+	$(LINK) $(get_window_le_OBJECTS) $(get_window_le_LDADD) $(LIBS)
+get_window_lt$(EXEEXT): $(get_window_lt_OBJECTS) $(get_window_lt_DEPENDENCIES) $(EXTRA_get_window_lt_DEPENDENCIES) 
+	@rm -f get_window_lt$(EXEEXT)
+	$(LINK) $(get_window_lt_OBJECTS) $(get_window_lt_LDADD) $(LIBS)
+get_window_ne$(EXEEXT): $(get_window_ne_OBJECTS) $(get_window_ne_DEPENDENCIES) $(EXTRA_get_window_ne_DEPENDENCIES) 
+	@rm -f get_window_ne$(EXEEXT)
+	$(LINK) $(get_window_ne_OBJECTS) $(get_window_ne_LDADD) $(LIBS)
+get_window_set$(EXEEXT): $(get_window_set_OBJECTS) $(get_window_set_DEPENDENCIES) $(EXTRA_get_window_set_DEPENDENCIES) 
+	@rm -f get_window_set$(EXEEXT)
+	$(LINK) $(get_window_set_OBJECTS) $(get_window_set_LDADD) $(LIBS)
+get_zero$(EXEEXT): $(get_zero_OBJECTS) $(get_zero_DEPENDENCIES) $(EXTRA_get_zero_DEPENDENCIES) 
 	@rm -f get_zero$(EXEEXT)
 	$(LINK) $(get_zero_OBJECTS) $(get_zero_LDADD) $(LIBS)
-global_name$(EXEEXT): $(global_name_OBJECTS) $(global_name_DEPENDENCIES) 
+global_flags$(EXEEXT): $(global_flags_OBJECTS) $(global_flags_DEPENDENCIES) $(EXTRA_global_flags_DEPENDENCIES) 
+	@rm -f global_flags$(EXEEXT)
+	$(LINK) $(global_flags_OBJECTS) $(global_flags_LDADD) $(LIBS)
+global_name$(EXEEXT): $(global_name_OBJECTS) $(global_name_DEPENDENCIES) $(EXTRA_global_name_DEPENDENCIES) 
 	@rm -f global_name$(EXEEXT)
 	$(LINK) $(global_name_OBJECTS) $(global_name_LDADD) $(LIBS)
-global_ref$(EXEEXT): $(global_ref_OBJECTS) $(global_ref_DEPENDENCIES) 
+global_ref$(EXEEXT): $(global_ref_OBJECTS) $(global_ref_DEPENDENCIES) $(EXTRA_global_ref_DEPENDENCIES) 
 	@rm -f global_ref$(EXEEXT)
 	$(LINK) $(global_ref_OBJECTS) $(global_ref_LDADD) $(LIBS)
-global_ref_empty$(EXEEXT): $(global_ref_empty_OBJECTS) $(global_ref_empty_DEPENDENCIES) 
+global_ref_empty$(EXEEXT): $(global_ref_empty_OBJECTS) $(global_ref_empty_DEPENDENCIES) $(EXTRA_global_ref_empty_DEPENDENCIES) 
 	@rm -f global_ref_empty$(EXEEXT)
 	$(LINK) $(global_ref_empty_OBJECTS) $(global_ref_empty_LDADD) $(LIBS)
-global_ref_set$(EXEEXT): $(global_ref_set_OBJECTS) $(global_ref_set_DEPENDENCIES) 
+global_ref_set$(EXEEXT): $(global_ref_set_OBJECTS) $(global_ref_set_DEPENDENCIES) $(EXTRA_global_ref_set_DEPENDENCIES) 
 	@rm -f global_ref_set$(EXEEXT)
 	$(LINK) $(global_ref_set_OBJECTS) $(global_ref_set_LDADD) $(LIBS)
-gzip_get$(EXEEXT): $(gzip_get_OBJECTS) $(gzip_get_DEPENDENCIES) 
+gzip_add$(EXEEXT): $(gzip_add_OBJECTS) $(gzip_add_DEPENDENCIES) $(EXTRA_gzip_add_DEPENDENCIES) 
+	@rm -f gzip_add$(EXEEXT)
+	$(LINK) $(gzip_add_OBJECTS) $(gzip_add_LDADD) $(LIBS)
+gzip_get$(EXEEXT): $(gzip_get_OBJECTS) $(gzip_get_DEPENDENCIES) $(EXTRA_gzip_get_DEPENDENCIES) 
 	@rm -f gzip_get$(EXEEXT)
 	$(LINK) $(gzip_get_OBJECTS) $(gzip_get_LDADD) $(LIBS)
-gzip_get_get$(EXEEXT): $(gzip_get_get_OBJECTS) $(gzip_get_get_DEPENDENCIES) 
+gzip_get_get$(EXEEXT): $(gzip_get_get_OBJECTS) $(gzip_get_get_DEPENDENCIES) $(EXTRA_gzip_get_get_DEPENDENCIES) 
 	@rm -f gzip_get_get$(EXEEXT)
 	$(LINK) $(gzip_get_get_OBJECTS) $(gzip_get_get_LDADD) $(LIBS)
-gzip_move_from$(EXEEXT): $(gzip_move_from_OBJECTS) $(gzip_move_from_DEPENDENCIES) 
+gzip_get_get2$(EXEEXT): $(gzip_get_get2_OBJECTS) $(gzip_get_get2_DEPENDENCIES) $(EXTRA_gzip_get_get2_DEPENDENCIES) 
+	@rm -f gzip_get_get2$(EXEEXT)
+	$(LINK) $(gzip_get_get2_OBJECTS) $(gzip_get_get2_LDADD) $(LIBS)
+gzip_get_put$(EXEEXT): $(gzip_get_put_OBJECTS) $(gzip_get_put_DEPENDENCIES) $(EXTRA_gzip_get_put_DEPENDENCIES) 
+	@rm -f gzip_get_put$(EXEEXT)
+	$(LINK) $(gzip_get_put_OBJECTS) $(gzip_get_put_LDADD) $(LIBS)
+gzip_move_from$(EXEEXT): $(gzip_move_from_OBJECTS) $(gzip_move_from_DEPENDENCIES) $(EXTRA_gzip_move_from_DEPENDENCIES) 
 	@rm -f gzip_move_from$(EXEEXT)
 	$(LINK) $(gzip_move_from_OBJECTS) $(gzip_move_from_LDADD) $(LIBS)
-gzip_nframes$(EXEEXT): $(gzip_nframes_OBJECTS) $(gzip_nframes_DEPENDENCIES) 
+gzip_move_to$(EXEEXT): $(gzip_move_to_OBJECTS) $(gzip_move_to_DEPENDENCIES) $(EXTRA_gzip_move_to_DEPENDENCIES) 
+	@rm -f gzip_move_to$(EXEEXT)
+	$(LINK) $(gzip_move_to_OBJECTS) $(gzip_move_to_LDADD) $(LIBS)
+gzip_nframes$(EXEEXT): $(gzip_nframes_OBJECTS) $(gzip_nframes_DEPENDENCIES) $(EXTRA_gzip_nframes_DEPENDENCIES) 
 	@rm -f gzip_nframes$(EXEEXT)
 	$(LINK) $(gzip_nframes_OBJECTS) $(gzip_nframes_LDADD) $(LIBS)
-header_complex$(EXEEXT): $(header_complex_OBJECTS) $(header_complex_DEPENDENCIES) 
+gzip_put$(EXEEXT): $(gzip_put_OBJECTS) $(gzip_put_DEPENDENCIES) $(EXTRA_gzip_put_DEPENDENCIES) 
+	@rm -f gzip_put$(EXEEXT)
+	$(LINK) $(gzip_put_OBJECTS) $(gzip_put_LDADD) $(LIBS)
+gzip_put_get$(EXEEXT): $(gzip_put_get_OBJECTS) $(gzip_put_get_DEPENDENCIES) $(EXTRA_gzip_put_get_DEPENDENCIES) 
+	@rm -f gzip_put_get$(EXEEXT)
+	$(LINK) $(gzip_put_get_OBJECTS) $(gzip_put_get_LDADD) $(LIBS)
+header_complex$(EXEEXT): $(header_complex_OBJECTS) $(header_complex_DEPENDENCIES) $(EXTRA_header_complex_DEPENDENCIES) 
 	@rm -f header_complex$(EXEEXT)
 	$(LINK) $(header_complex_OBJECTS) $(header_complex_LDADD) $(LIBS)
-include$(EXEEXT): $(include_OBJECTS) $(include_DEPENDENCIES) 
+hide$(EXEEXT): $(hide_OBJECTS) $(hide_DEPENDENCIES) $(EXTRA_hide_DEPENDENCIES) 
+	@rm -f hide$(EXEEXT)
+	$(LINK) $(hide_OBJECTS) $(hide_LDADD) $(LIBS)
+hide_hidden$(EXEEXT): $(hide_hidden_OBJECTS) $(hide_hidden_DEPENDENCIES) $(EXTRA_hide_hidden_DEPENDENCIES) 
+	@rm -f hide_hidden$(EXEEXT)
+	$(LINK) $(hide_hidden_OBJECTS) $(hide_hidden_LDADD) $(LIBS)
+hide_unhide$(EXEEXT): $(hide_unhide_OBJECTS) $(hide_unhide_DEPENDENCIES) $(EXTRA_hide_unhide_DEPENDENCIES) 
+	@rm -f hide_unhide$(EXEEXT)
+	$(LINK) $(hide_unhide_OBJECTS) $(hide_unhide_LDADD) $(LIBS)
+include$(EXEEXT): $(include_OBJECTS) $(include_DEPENDENCIES) $(EXTRA_include_DEPENDENCIES) 
 	@rm -f include$(EXEEXT)
 	$(LINK) $(include_OBJECTS) $(include_LDADD) $(LIBS)
-include_accmode$(EXEEXT): $(include_accmode_OBJECTS) $(include_accmode_DEPENDENCIES) 
+include_accmode$(EXEEXT): $(include_accmode_OBJECTS) $(include_accmode_DEPENDENCIES) $(EXTRA_include_accmode_DEPENDENCIES) 
 	@rm -f include_accmode$(EXEEXT)
 	$(LINK) $(include_accmode_OBJECTS) $(include_accmode_LDADD) $(LIBS)
-include_auto$(EXEEXT): $(include_auto_OBJECTS) $(include_auto_DEPENDENCIES) 
+include_affix$(EXEEXT): $(include_affix_OBJECTS) $(include_affix_DEPENDENCIES) $(EXTRA_include_affix_DEPENDENCIES) 
+	@rm -f include_affix$(EXEEXT)
+	$(LINK) $(include_affix_OBJECTS) $(include_affix_LDADD) $(LIBS)
+include_auto$(EXEEXT): $(include_auto_OBJECTS) $(include_auto_DEPENDENCIES) $(EXTRA_include_auto_DEPENDENCIES) 
 	@rm -f include_auto$(EXEEXT)
 	$(LINK) $(include_auto_OBJECTS) $(include_auto_LDADD) $(LIBS)
-include_cb$(EXEEXT): $(include_cb_OBJECTS) $(include_cb_DEPENDENCIES) 
+include_cb$(EXEEXT): $(include_cb_OBJECTS) $(include_cb_DEPENDENCIES) $(EXTRA_include_cb_DEPENDENCIES) 
 	@rm -f include_cb$(EXEEXT)
 	$(LINK) $(include_cb_OBJECTS) $(include_cb_LDADD) $(LIBS)
-include_creat$(EXEEXT): $(include_creat_OBJECTS) $(include_creat_DEPENDENCIES) 
+include_creat$(EXEEXT): $(include_creat_OBJECTS) $(include_creat_DEPENDENCIES) $(EXTRA_include_creat_DEPENDENCIES) 
 	@rm -f include_creat$(EXEEXT)
 	$(LINK) $(include_creat_OBJECTS) $(include_creat_LDADD) $(LIBS)
-include_ignore$(EXEEXT): $(include_ignore_OBJECTS) $(include_ignore_DEPENDENCIES) 
+include_ignore$(EXEEXT): $(include_ignore_OBJECTS) $(include_ignore_DEPENDENCIES) $(EXTRA_include_ignore_DEPENDENCIES) 
 	@rm -f include_ignore$(EXEEXT)
 	$(LINK) $(include_ignore_OBJECTS) $(include_ignore_LDADD) $(LIBS)
-include_index$(EXEEXT): $(include_index_OBJECTS) $(include_index_DEPENDENCIES) 
+include_index$(EXEEXT): $(include_index_OBJECTS) $(include_index_DEPENDENCIES) $(EXTRA_include_index_DEPENDENCIES) 
 	@rm -f include_index$(EXEEXT)
 	$(LINK) $(include_index_OBJECTS) $(include_index_LDADD) $(LIBS)
-include_invalid$(EXEEXT): $(include_invalid_OBJECTS) $(include_invalid_DEPENDENCIES) 
+include_invalid$(EXEEXT): $(include_invalid_OBJECTS) $(include_invalid_DEPENDENCIES) $(EXTRA_include_invalid_DEPENDENCIES) 
 	@rm -f include_invalid$(EXEEXT)
 	$(LINK) $(include_invalid_OBJECTS) $(include_invalid_LDADD) $(LIBS)
-include_nonexistent$(EXEEXT): $(include_nonexistent_OBJECTS) $(include_nonexistent_DEPENDENCIES) 
+include_nonexistent$(EXEEXT): $(include_nonexistent_OBJECTS) $(include_nonexistent_DEPENDENCIES) $(EXTRA_include_nonexistent_DEPENDENCIES) 
 	@rm -f include_nonexistent$(EXEEXT)
 	$(LINK) $(include_nonexistent_OBJECTS) $(include_nonexistent_LDADD) $(LIBS)
-include_pc$(EXEEXT): $(include_pc_OBJECTS) $(include_pc_DEPENDENCIES) 
+include_pc$(EXEEXT): $(include_pc_OBJECTS) $(include_pc_DEPENDENCIES) $(EXTRA_include_pc_DEPENDENCIES) 
 	@rm -f include_pc$(EXEEXT)
 	$(LINK) $(include_pc_OBJECTS) $(include_pc_LDADD) $(LIBS)
-include_ref$(EXEEXT): $(include_ref_OBJECTS) $(include_ref_DEPENDENCIES) 
+include_ref$(EXEEXT): $(include_ref_OBJECTS) $(include_ref_DEPENDENCIES) $(EXTRA_include_ref_DEPENDENCIES) 
 	@rm -f include_ref$(EXEEXT)
 	$(LINK) $(include_ref_OBJECTS) $(include_ref_LDADD) $(LIBS)
-include_syntax$(EXEEXT): $(include_syntax_OBJECTS) $(include_syntax_DEPENDENCIES) 
+include_sub$(EXEEXT): $(include_sub_OBJECTS) $(include_sub_DEPENDENCIES) $(EXTRA_include_sub_DEPENDENCIES) 
+	@rm -f include_sub$(EXEEXT)
+	$(LINK) $(include_sub_OBJECTS) $(include_sub_LDADD) $(LIBS)
+include_syntax$(EXEEXT): $(include_syntax_OBJECTS) $(include_syntax_DEPENDENCIES) $(EXTRA_include_syntax_DEPENDENCIES) 
 	@rm -f include_syntax$(EXEEXT)
 	$(LINK) $(include_syntax_OBJECTS) $(include_syntax_LDADD) $(LIBS)
-index$(EXEEXT): $(index_OBJECTS) $(index_DEPENDENCIES) 
+index$(EXEEXT): $(index_OBJECTS) $(index_DEPENDENCIES) $(EXTRA_index_DEPENDENCIES) 
 	@rm -f index$(EXEEXT)
 	$(LINK) $(index_OBJECTS) $(index_LDADD) $(LIBS)
-index_domain$(EXEEXT): $(index_domain_OBJECTS) $(index_domain_DEPENDENCIES) 
+index_domain$(EXEEXT): $(index_domain_OBJECTS) $(index_domain_DEPENDENCIES) $(EXTRA_index_domain_DEPENDENCIES) 
 	@rm -f index_domain$(EXEEXT)
 	$(LINK) $(index_domain_OBJECTS) $(index_domain_LDADD) $(LIBS)
-index_range$(EXEEXT): $(index_range_OBJECTS) $(index_range_DEPENDENCIES) 
+index_range$(EXEEXT): $(index_range_OBJECTS) $(index_range_DEPENDENCIES) $(EXTRA_index_range_DEPENDENCIES) 
 	@rm -f index_range$(EXEEXT)
 	$(LINK) $(index_range_OBJECTS) $(index_range_LDADD) $(LIBS)
-legacy_get$(EXEEXT): $(legacy_get_OBJECTS) $(legacy_get_DEPENDENCIES) 
+legacy_get$(EXEEXT): $(legacy_get_OBJECTS) $(legacy_get_DEPENDENCIES) $(EXTRA_legacy_get_DEPENDENCIES) 
 	@rm -f legacy_get$(EXEEXT)
 	$(LINK) $(legacy_get_OBJECTS) $(legacy_get_LDADD) $(LIBS)
-legacy_get_put$(EXEEXT): $(legacy_get_put_OBJECTS) $(legacy_get_put_DEPENDENCIES) 
+legacy_get_put$(EXEEXT): $(legacy_get_put_OBJECTS) $(legacy_get_put_DEPENDENCIES) $(EXTRA_legacy_get_put_DEPENDENCIES) 
 	@rm -f legacy_get_put$(EXEEXT)
 	$(LINK) $(legacy_get_put_OBJECTS) $(legacy_get_put_LDADD) $(LIBS)
-legacy_get_rofs$(EXEEXT): $(legacy_get_rofs_OBJECTS) $(legacy_get_rofs_DEPENDENCIES) 
+legacy_get_rofs$(EXEEXT): $(legacy_get_rofs_OBJECTS) $(legacy_get_rofs_DEPENDENCIES) $(EXTRA_legacy_get_rofs_DEPENDENCIES) 
 	@rm -f legacy_get_rofs$(EXEEXT)
 	$(LINK) $(legacy_get_rofs_OBJECTS) $(legacy_get_rofs_LDADD) $(LIBS)
-legacy_nframes$(EXEEXT): $(legacy_nframes_OBJECTS) $(legacy_nframes_DEPENDENCIES) 
+legacy_nframes$(EXEEXT): $(legacy_nframes_OBJECTS) $(legacy_nframes_DEPENDENCIES) $(EXTRA_legacy_nframes_DEPENDENCIES) 
 	@rm -f legacy_nframes$(EXEEXT)
 	$(LINK) $(legacy_nframes_OBJECTS) $(legacy_nframes_LDADD) $(LIBS)
-legacy_nonexistent$(EXEEXT): $(legacy_nonexistent_OBJECTS) $(legacy_nonexistent_DEPENDENCIES) 
+legacy_nonexistent$(EXEEXT): $(legacy_nonexistent_OBJECTS) $(legacy_nonexistent_DEPENDENCIES) $(EXTRA_legacy_nonexistent_DEPENDENCIES) 
 	@rm -f legacy_nonexistent$(EXEEXT)
 	$(LINK) $(legacy_nonexistent_OBJECTS) $(legacy_nonexistent_LDADD) $(LIBS)
-legacy_put$(EXEEXT): $(legacy_put_OBJECTS) $(legacy_put_DEPENDENCIES) 
+legacy_put$(EXEEXT): $(legacy_put_OBJECTS) $(legacy_put_DEPENDENCIES) $(EXTRA_legacy_put_DEPENDENCIES) 
 	@rm -f legacy_put$(EXEEXT)
 	$(LINK) $(legacy_put_OBJECTS) $(legacy_put_LDADD) $(LIBS)
-legacy_spf$(EXEEXT): $(legacy_spf_OBJECTS) $(legacy_spf_DEPENDENCIES) 
+legacy_spf$(EXEEXT): $(legacy_spf_OBJECTS) $(legacy_spf_DEPENDENCIES) $(EXTRA_legacy_spf_DEPENDENCIES) 
 	@rm -f legacy_spf$(EXEEXT)
 	$(LINK) $(legacy_spf_OBJECTS) $(legacy_spf_LDADD) $(LIBS)
-lzma_get$(EXEEXT): $(lzma_get_OBJECTS) $(lzma_get_DEPENDENCIES) 
+lzma_get$(EXEEXT): $(lzma_get_OBJECTS) $(lzma_get_DEPENDENCIES) $(EXTRA_lzma_get_DEPENDENCIES) 
 	@rm -f lzma_get$(EXEEXT)
 	$(LINK) $(lzma_get_OBJECTS) $(lzma_get_LDADD) $(LIBS)
-lzma_nframes$(EXEEXT): $(lzma_nframes_OBJECTS) $(lzma_nframes_DEPENDENCIES) 
+lzma_nframes$(EXEEXT): $(lzma_nframes_OBJECTS) $(lzma_nframes_DEPENDENCIES) $(EXTRA_lzma_nframes_DEPENDENCIES) 
 	@rm -f lzma_nframes$(EXEEXT)
 	$(LINK) $(lzma_nframes_OBJECTS) $(lzma_nframes_LDADD) $(LIBS)
-madd$(EXEEXT): $(madd_OBJECTS) $(madd_DEPENDENCIES) 
+madd$(EXEEXT): $(madd_OBJECTS) $(madd_DEPENDENCIES) $(EXTRA_madd_DEPENDENCIES) 
 	@rm -f madd$(EXEEXT)
 	$(LINK) $(madd_OBJECTS) $(madd_LDADD) $(LIBS)
-madd_bit$(EXEEXT): $(madd_bit_OBJECTS) $(madd_bit_DEPENDENCIES) 
+madd_affix$(EXEEXT): $(madd_affix_OBJECTS) $(madd_affix_DEPENDENCIES) $(EXTRA_madd_affix_DEPENDENCIES) 
+	@rm -f madd_affix$(EXEEXT)
+	$(LINK) $(madd_affix_OBJECTS) $(madd_affix_LDADD) $(LIBS)
+madd_alias$(EXEEXT): $(madd_alias_OBJECTS) $(madd_alias_DEPENDENCIES) $(EXTRA_madd_alias_DEPENDENCIES) 
+	@rm -f madd_alias$(EXEEXT)
+	$(LINK) $(madd_alias_OBJECTS) $(madd_alias_LDADD) $(LIBS)
+madd_alias_affix$(EXEEXT): $(madd_alias_affix_OBJECTS) $(madd_alias_affix_DEPENDENCIES) $(EXTRA_madd_alias_affix_DEPENDENCIES) 
+	@rm -f madd_alias_affix$(EXEEXT)
+	$(LINK) $(madd_alias_affix_OBJECTS) $(madd_alias_affix_LDADD) $(LIBS)
+madd_bit$(EXEEXT): $(madd_bit_OBJECTS) $(madd_bit_DEPENDENCIES) $(EXTRA_madd_bit_DEPENDENCIES) 
 	@rm -f madd_bit$(EXEEXT)
 	$(LINK) $(madd_bit_OBJECTS) $(madd_bit_LDADD) $(LIBS)
-madd_bit_invalid$(EXEEXT): $(madd_bit_invalid_OBJECTS) $(madd_bit_invalid_DEPENDENCIES) 
+madd_bit_invalid$(EXEEXT): $(madd_bit_invalid_OBJECTS) $(madd_bit_invalid_DEPENDENCIES) $(EXTRA_madd_bit_invalid_DEPENDENCIES) 
 	@rm -f madd_bit_invalid$(EXEEXT)
 	$(LINK) $(madd_bit_invalid_OBJECTS) $(madd_bit_invalid_LDADD) $(LIBS)
-madd_carray$(EXEEXT): $(madd_carray_OBJECTS) $(madd_carray_DEPENDENCIES) 
+madd_carray$(EXEEXT): $(madd_carray_OBJECTS) $(madd_carray_DEPENDENCIES) $(EXTRA_madd_carray_DEPENDENCIES) 
 	@rm -f madd_carray$(EXEEXT)
 	$(LINK) $(madd_carray_OBJECTS) $(madd_carray_LDADD) $(LIBS)
-madd_clincom$(EXEEXT): $(madd_clincom_OBJECTS) $(madd_clincom_DEPENDENCIES) 
+madd_clincom$(EXEEXT): $(madd_clincom_OBJECTS) $(madd_clincom_DEPENDENCIES) $(EXTRA_madd_clincom_DEPENDENCIES) 
 	@rm -f madd_clincom$(EXEEXT)
 	$(LINK) $(madd_clincom_OBJECTS) $(madd_clincom_LDADD) $(LIBS)
-madd_const$(EXEEXT): $(madd_const_OBJECTS) $(madd_const_DEPENDENCIES) 
+madd_const$(EXEEXT): $(madd_const_OBJECTS) $(madd_const_DEPENDENCIES) $(EXTRA_madd_const_DEPENDENCIES) 
 	@rm -f madd_const$(EXEEXT)
 	$(LINK) $(madd_const_OBJECTS) $(madd_const_LDADD) $(LIBS)
-madd_cpolynom$(EXEEXT): $(madd_cpolynom_OBJECTS) $(madd_cpolynom_DEPENDENCIES) 
+madd_cpolynom$(EXEEXT): $(madd_cpolynom_OBJECTS) $(madd_cpolynom_DEPENDENCIES) $(EXTRA_madd_cpolynom_DEPENDENCIES) 
 	@rm -f madd_cpolynom$(EXEEXT)
 	$(LINK) $(madd_cpolynom_OBJECTS) $(madd_cpolynom_LDADD) $(LIBS)
-madd_crecip$(EXEEXT): $(madd_crecip_OBJECTS) $(madd_crecip_DEPENDENCIES) 
+madd_crecip$(EXEEXT): $(madd_crecip_OBJECTS) $(madd_crecip_DEPENDENCIES) $(EXTRA_madd_crecip_DEPENDENCIES) 
 	@rm -f madd_crecip$(EXEEXT)
 	$(LINK) $(madd_crecip_OBJECTS) $(madd_crecip_LDADD) $(LIBS)
-madd_crecip89$(EXEEXT): $(madd_crecip89_OBJECTS) $(madd_crecip89_DEPENDENCIES) 
+madd_crecip89$(EXEEXT): $(madd_crecip89_OBJECTS) $(madd_crecip89_DEPENDENCIES) $(EXTRA_madd_crecip89_DEPENDENCIES) 
 	@rm -f madd_crecip89$(EXEEXT)
 	$(LINK) $(madd_crecip89_OBJECTS) $(madd_crecip89_LDADD) $(LIBS)
-madd_divide$(EXEEXT): $(madd_divide_OBJECTS) $(madd_divide_DEPENDENCIES) 
+madd_divide$(EXEEXT): $(madd_divide_OBJECTS) $(madd_divide_DEPENDENCIES) $(EXTRA_madd_divide_DEPENDENCIES) 
 	@rm -f madd_divide$(EXEEXT)
 	$(LINK) $(madd_divide_OBJECTS) $(madd_divide_LDADD) $(LIBS)
-madd_lincom$(EXEEXT): $(madd_lincom_OBJECTS) $(madd_lincom_DEPENDENCIES) 
+madd_index$(EXEEXT): $(madd_index_OBJECTS) $(madd_index_DEPENDENCIES) $(EXTRA_madd_index_DEPENDENCIES) 
+	@rm -f madd_index$(EXEEXT)
+	$(LINK) $(madd_index_OBJECTS) $(madd_index_LDADD) $(LIBS)
+madd_lincom$(EXEEXT): $(madd_lincom_OBJECTS) $(madd_lincom_DEPENDENCIES) $(EXTRA_madd_lincom_DEPENDENCIES) 
 	@rm -f madd_lincom$(EXEEXT)
 	$(LINK) $(madd_lincom_OBJECTS) $(madd_lincom_LDADD) $(LIBS)
-madd_lincom_invalid$(EXEEXT): $(madd_lincom_invalid_OBJECTS) $(madd_lincom_invalid_DEPENDENCIES) 
+madd_lincom_invalid$(EXEEXT): $(madd_lincom_invalid_OBJECTS) $(madd_lincom_invalid_DEPENDENCIES) $(EXTRA_madd_lincom_invalid_DEPENDENCIES) 
 	@rm -f madd_lincom_invalid$(EXEEXT)
 	$(LINK) $(madd_lincom_invalid_OBJECTS) $(madd_lincom_invalid_LDADD) $(LIBS)
-madd_linterp$(EXEEXT): $(madd_linterp_OBJECTS) $(madd_linterp_DEPENDENCIES) 
+madd_linterp$(EXEEXT): $(madd_linterp_OBJECTS) $(madd_linterp_DEPENDENCIES) $(EXTRA_madd_linterp_DEPENDENCIES) 
 	@rm -f madd_linterp$(EXEEXT)
 	$(LINK) $(madd_linterp_OBJECTS) $(madd_linterp_LDADD) $(LIBS)
-madd_linterp_invalid$(EXEEXT): $(madd_linterp_invalid_OBJECTS) $(madd_linterp_invalid_DEPENDENCIES) 
+madd_linterp_invalid$(EXEEXT): $(madd_linterp_invalid_OBJECTS) $(madd_linterp_invalid_DEPENDENCIES) $(EXTRA_madd_linterp_invalid_DEPENDENCIES) 
 	@rm -f madd_linterp_invalid$(EXEEXT)
 	$(LINK) $(madd_linterp_invalid_OBJECTS) $(madd_linterp_invalid_LDADD) $(LIBS)
-madd_multiply$(EXEEXT): $(madd_multiply_OBJECTS) $(madd_multiply_DEPENDENCIES) 
+madd_mplex$(EXEEXT): $(madd_mplex_OBJECTS) $(madd_mplex_DEPENDENCIES) $(EXTRA_madd_mplex_DEPENDENCIES) 
+	@rm -f madd_mplex$(EXEEXT)
+	$(LINK) $(madd_mplex_OBJECTS) $(madd_mplex_LDADD) $(LIBS)
+madd_multiply$(EXEEXT): $(madd_multiply_OBJECTS) $(madd_multiply_DEPENDENCIES) $(EXTRA_madd_multiply_DEPENDENCIES) 
 	@rm -f madd_multiply$(EXEEXT)
 	$(LINK) $(madd_multiply_OBJECTS) $(madd_multiply_LDADD) $(LIBS)
-madd_multiply_invalid$(EXEEXT): $(madd_multiply_invalid_OBJECTS) $(madd_multiply_invalid_DEPENDENCIES) 
+madd_multiply_invalid$(EXEEXT): $(madd_multiply_invalid_OBJECTS) $(madd_multiply_invalid_DEPENDENCIES) $(EXTRA_madd_multiply_invalid_DEPENDENCIES) 
 	@rm -f madd_multiply_invalid$(EXEEXT)
 	$(LINK) $(madd_multiply_invalid_OBJECTS) $(madd_multiply_invalid_LDADD) $(LIBS)
-madd_phase$(EXEEXT): $(madd_phase_OBJECTS) $(madd_phase_DEPENDENCIES) 
+madd_phase$(EXEEXT): $(madd_phase_OBJECTS) $(madd_phase_DEPENDENCIES) $(EXTRA_madd_phase_DEPENDENCIES) 
 	@rm -f madd_phase$(EXEEXT)
 	$(LINK) $(madd_phase_OBJECTS) $(madd_phase_LDADD) $(LIBS)
-madd_phase_invalid$(EXEEXT): $(madd_phase_invalid_OBJECTS) $(madd_phase_invalid_DEPENDENCIES) 
+madd_phase_invalid$(EXEEXT): $(madd_phase_invalid_OBJECTS) $(madd_phase_invalid_DEPENDENCIES) $(EXTRA_madd_phase_invalid_DEPENDENCIES) 
 	@rm -f madd_phase_invalid$(EXEEXT)
 	$(LINK) $(madd_phase_invalid_OBJECTS) $(madd_phase_invalid_LDADD) $(LIBS)
-madd_polynom$(EXEEXT): $(madd_polynom_OBJECTS) $(madd_polynom_DEPENDENCIES) 
+madd_polynom$(EXEEXT): $(madd_polynom_OBJECTS) $(madd_polynom_DEPENDENCIES) $(EXTRA_madd_polynom_DEPENDENCIES) 
 	@rm -f madd_polynom$(EXEEXT)
 	$(LINK) $(madd_polynom_OBJECTS) $(madd_polynom_LDADD) $(LIBS)
-madd_recip$(EXEEXT): $(madd_recip_OBJECTS) $(madd_recip_DEPENDENCIES) 
+madd_recip$(EXEEXT): $(madd_recip_OBJECTS) $(madd_recip_DEPENDENCIES) $(EXTRA_madd_recip_DEPENDENCIES) 
 	@rm -f madd_recip$(EXEEXT)
 	$(LINK) $(madd_recip_OBJECTS) $(madd_recip_LDADD) $(LIBS)
-madd_sbit$(EXEEXT): $(madd_sbit_OBJECTS) $(madd_sbit_DEPENDENCIES) 
+madd_sbit$(EXEEXT): $(madd_sbit_OBJECTS) $(madd_sbit_DEPENDENCIES) $(EXTRA_madd_sbit_DEPENDENCIES) 
 	@rm -f madd_sbit$(EXEEXT)
 	$(LINK) $(madd_sbit_OBJECTS) $(madd_sbit_LDADD) $(LIBS)
-madd_spec$(EXEEXT): $(madd_spec_OBJECTS) $(madd_spec_DEPENDENCIES) 
+madd_spec$(EXEEXT): $(madd_spec_OBJECTS) $(madd_spec_DEPENDENCIES) $(EXTRA_madd_spec_DEPENDENCIES) 
 	@rm -f madd_spec$(EXEEXT)
 	$(LINK) $(madd_spec_OBJECTS) $(madd_spec_LDADD) $(LIBS)
-madd_spec_directive$(EXEEXT): $(madd_spec_directive_OBJECTS) $(madd_spec_directive_DEPENDENCIES) 
+madd_spec_directive$(EXEEXT): $(madd_spec_directive_OBJECTS) $(madd_spec_directive_DEPENDENCIES) $(EXTRA_madd_spec_directive_DEPENDENCIES) 
 	@rm -f madd_spec_directive$(EXEEXT)
 	$(LINK) $(madd_spec_directive_OBJECTS) $(madd_spec_directive_LDADD) $(LIBS)
-madd_spec_invalid$(EXEEXT): $(madd_spec_invalid_OBJECTS) $(madd_spec_invalid_DEPENDENCIES) 
+madd_spec_invalid$(EXEEXT): $(madd_spec_invalid_OBJECTS) $(madd_spec_invalid_DEPENDENCIES) $(EXTRA_madd_spec_invalid_DEPENDENCIES) 
 	@rm -f madd_spec_invalid$(EXEEXT)
 	$(LINK) $(madd_spec_invalid_OBJECTS) $(madd_spec_invalid_LDADD) $(LIBS)
-madd_string$(EXEEXT): $(madd_string_OBJECTS) $(madd_string_DEPENDENCIES) 
+madd_spec_resolv$(EXEEXT): $(madd_spec_resolv_OBJECTS) $(madd_spec_resolv_DEPENDENCIES) $(EXTRA_madd_spec_resolv_DEPENDENCIES) 
+	@rm -f madd_spec_resolv$(EXEEXT)
+	$(LINK) $(madd_spec_resolv_OBJECTS) $(madd_spec_resolv_LDADD) $(LIBS)
+madd_string$(EXEEXT): $(madd_string_OBJECTS) $(madd_string_DEPENDENCIES) $(EXTRA_madd_string_DEPENDENCIES) 
 	@rm -f madd_string$(EXEEXT)
 	$(LINK) $(madd_string_OBJECTS) $(madd_string_LDADD) $(LIBS)
-move$(EXEEXT): $(move_OBJECTS) $(move_DEPENDENCIES) 
+madd_window$(EXEEXT): $(madd_window_OBJECTS) $(madd_window_DEPENDENCIES) $(EXTRA_madd_window_DEPENDENCIES) 
+	@rm -f madd_window$(EXEEXT)
+	$(LINK) $(madd_window_OBJECTS) $(madd_window_LDADD) $(LIBS)
+move$(EXEEXT): $(move_OBJECTS) $(move_DEPENDENCIES) $(EXTRA_move_DEPENDENCIES) 
 	@rm -f move$(EXEEXT)
 	$(LINK) $(move_OBJECTS) $(move_LDADD) $(LIBS)
-move_data_enc_ar$(EXEEXT): $(move_data_enc_ar_OBJECTS) $(move_data_enc_ar_DEPENDENCIES) 
+move_affix$(EXEEXT): $(move_affix_OBJECTS) $(move_affix_DEPENDENCIES) $(EXTRA_move_affix_DEPENDENCIES) 
+	@rm -f move_affix$(EXEEXT)
+	$(LINK) $(move_affix_OBJECTS) $(move_affix_LDADD) $(LIBS)
+move_affix_dup$(EXEEXT): $(move_affix_dup_OBJECTS) $(move_affix_dup_DEPENDENCIES) $(EXTRA_move_affix_dup_DEPENDENCIES) 
+	@rm -f move_affix_dup$(EXEEXT)
+	$(LINK) $(move_affix_dup_OBJECTS) $(move_affix_dup_LDADD) $(LIBS)
+move_alias$(EXEEXT): $(move_alias_OBJECTS) $(move_alias_DEPENDENCIES) $(EXTRA_move_alias_DEPENDENCIES) 
+	@rm -f move_alias$(EXEEXT)
+	$(LINK) $(move_alias_OBJECTS) $(move_alias_LDADD) $(LIBS)
+move_data_enc_ar$(EXEEXT): $(move_data_enc_ar_OBJECTS) $(move_data_enc_ar_DEPENDENCIES) $(EXTRA_move_data_enc_ar_DEPENDENCIES) 
 	@rm -f move_data_enc_ar$(EXEEXT)
 	$(LINK) $(move_data_enc_ar_OBJECTS) $(move_data_enc_ar_LDADD) $(LIBS)
-move_data_enc_ra$(EXEEXT): $(move_data_enc_ra_OBJECTS) $(move_data_enc_ra_DEPENDENCIES) 
+move_data_enc_ra$(EXEEXT): $(move_data_enc_ra_OBJECTS) $(move_data_enc_ra_DEPENDENCIES) $(EXTRA_move_data_enc_ra_DEPENDENCIES) 
 	@rm -f move_data_enc_ra$(EXEEXT)
 	$(LINK) $(move_data_enc_ra_OBJECTS) $(move_data_enc_ra_LDADD) $(LIBS)
-move_data_endian$(EXEEXT): $(move_data_endian_OBJECTS) $(move_data_endian_DEPENDENCIES) 
+move_data_endian$(EXEEXT): $(move_data_endian_OBJECTS) $(move_data_endian_DEPENDENCIES) $(EXTRA_move_data_endian_DEPENDENCIES) 
 	@rm -f move_data_endian$(EXEEXT)
 	$(LINK) $(move_data_endian_OBJECTS) $(move_data_endian_LDADD) $(LIBS)
-move_data_foffs$(EXEEXT): $(move_data_foffs_OBJECTS) $(move_data_foffs_DEPENDENCIES) 
+move_data_foffs$(EXEEXT): $(move_data_foffs_OBJECTS) $(move_data_foffs_DEPENDENCIES) $(EXTRA_move_data_foffs_DEPENDENCIES) 
 	@rm -f move_data_foffs$(EXEEXT)
 	$(LINK) $(move_data_foffs_OBJECTS) $(move_data_foffs_LDADD) $(LIBS)
-move_data_nop$(EXEEXT): $(move_data_nop_OBJECTS) $(move_data_nop_DEPENDENCIES) 
+move_data_nop$(EXEEXT): $(move_data_nop_OBJECTS) $(move_data_nop_DEPENDENCIES) $(EXTRA_move_data_nop_DEPENDENCIES) 
 	@rm -f move_data_nop$(EXEEXT)
 	$(LINK) $(move_data_nop_OBJECTS) $(move_data_nop_LDADD) $(LIBS)
-move_index$(EXEEXT): $(move_index_OBJECTS) $(move_index_DEPENDENCIES) 
+move_index$(EXEEXT): $(move_index_OBJECTS) $(move_index_DEPENDENCIES) $(EXTRA_move_index_DEPENDENCIES) 
 	@rm -f move_index$(EXEEXT)
 	$(LINK) $(move_index_OBJECTS) $(move_index_LDADD) $(LIBS)
-move_meta$(EXEEXT): $(move_meta_OBJECTS) $(move_meta_DEPENDENCIES) 
+move_meta$(EXEEXT): $(move_meta_OBJECTS) $(move_meta_DEPENDENCIES) $(EXTRA_move_meta_DEPENDENCIES) 
 	@rm -f move_meta$(EXEEXT)
 	$(LINK) $(move_meta_OBJECTS) $(move_meta_LDADD) $(LIBS)
-move_protect$(EXEEXT): $(move_protect_OBJECTS) $(move_protect_DEPENDENCIES) 
+move_protect$(EXEEXT): $(move_protect_OBJECTS) $(move_protect_DEPENDENCIES) $(EXTRA_move_protect_DEPENDENCIES) 
 	@rm -f move_protect$(EXEEXT)
 	$(LINK) $(move_protect_OBJECTS) $(move_protect_LDADD) $(LIBS)
-move_subdir$(EXEEXT): $(move_subdir_OBJECTS) $(move_subdir_DEPENDENCIES) 
+move_subdir$(EXEEXT): $(move_subdir_OBJECTS) $(move_subdir_DEPENDENCIES) $(EXTRA_move_subdir_DEPENDENCIES) 
 	@rm -f move_subdir$(EXEEXT)
 	$(LINK) $(move_subdir_OBJECTS) $(move_subdir_LDADD) $(LIBS)
-name$(EXEEXT): $(name_OBJECTS) $(name_DEPENDENCIES) 
+name$(EXEEXT): $(name_OBJECTS) $(name_DEPENDENCIES) $(EXTRA_name_DEPENDENCIES) 
 	@rm -f name$(EXEEXT)
 	$(LINK) $(name_OBJECTS) $(name_LDADD) $(LIBS)
-name_move$(EXEEXT): $(name_move_OBJECTS) $(name_move_DEPENDENCIES) 
+name_affix$(EXEEXT): $(name_affix_OBJECTS) $(name_affix_DEPENDENCIES) $(EXTRA_name_affix_DEPENDENCIES) 
+	@rm -f name_affix$(EXEEXT)
+	$(LINK) $(name_affix_OBJECTS) $(name_affix_LDADD) $(LIBS)
+name_affix_bad$(EXEEXT): $(name_affix_bad_OBJECTS) $(name_affix_bad_DEPENDENCIES) $(EXTRA_name_affix_bad_DEPENDENCIES) 
+	@rm -f name_affix_bad$(EXEEXT)
+	$(LINK) $(name_affix_bad_OBJECTS) $(name_affix_bad_LDADD) $(LIBS)
+name_alias$(EXEEXT): $(name_alias_OBJECTS) $(name_alias_DEPENDENCIES) $(EXTRA_name_alias_DEPENDENCIES) 
+	@rm -f name_alias$(EXEEXT)
+	$(LINK) $(name_alias_OBJECTS) $(name_alias_LDADD) $(LIBS)
+name_dup$(EXEEXT): $(name_dup_OBJECTS) $(name_dup_DEPENDENCIES) $(EXTRA_name_dup_DEPENDENCIES) 
+	@rm -f name_dup$(EXEEXT)
+	$(LINK) $(name_dup_OBJECTS) $(name_dup_LDADD) $(LIBS)
+name_move$(EXEEXT): $(name_move_OBJECTS) $(name_move_DEPENDENCIES) $(EXTRA_name_move_DEPENDENCIES) 
 	@rm -f name_move$(EXEEXT)
 	$(LINK) $(name_move_OBJECTS) $(name_move_LDADD) $(LIBS)
-nfields$(EXEEXT): $(nfields_OBJECTS) $(nfields_DEPENDENCIES) 
+name_move_alias$(EXEEXT): $(name_move_alias_OBJECTS) $(name_move_alias_DEPENDENCIES) $(EXTRA_name_move_alias_DEPENDENCIES) 
+	@rm -f name_move_alias$(EXEEXT)
+	$(LINK) $(name_move_alias_OBJECTS) $(name_move_alias_LDADD) $(LIBS)
+name_updb$(EXEEXT): $(name_updb_OBJECTS) $(name_updb_DEPENDENCIES) $(EXTRA_name_updb_DEPENDENCIES) 
+	@rm -f name_updb$(EXEEXT)
+	$(LINK) $(name_updb_OBJECTS) $(name_updb_LDADD) $(LIBS)
+name_updb_alias$(EXEEXT): $(name_updb_alias_OBJECTS) $(name_updb_alias_DEPENDENCIES) $(EXTRA_name_updb_alias_DEPENDENCIES) 
+	@rm -f name_updb_alias$(EXEEXT)
+	$(LINK) $(name_updb_alias_OBJECTS) $(name_updb_alias_LDADD) $(LIBS)
+name_updb_const$(EXEEXT): $(name_updb_const_OBJECTS) $(name_updb_const_DEPENDENCIES) $(EXTRA_name_updb_const_DEPENDENCIES) 
+	@rm -f name_updb_const$(EXEEXT)
+	$(LINK) $(name_updb_const_OBJECTS) $(name_updb_const_LDADD) $(LIBS)
+name_updb_const_alias$(EXEEXT): $(name_updb_const_alias_OBJECTS) $(name_updb_const_alias_DEPENDENCIES) $(EXTRA_name_updb_const_alias_DEPENDENCIES) 
+	@rm -f name_updb_const_alias$(EXEEXT)
+	$(LINK) $(name_updb_const_alias_OBJECTS) $(name_updb_const_alias_LDADD) $(LIBS)
+nentries_alias$(EXEEXT): $(nentries_alias_OBJECTS) $(nentries_alias_DEPENDENCIES) $(EXTRA_nentries_alias_DEPENDENCIES) 
+	@rm -f nentries_alias$(EXEEXT)
+	$(LINK) $(nentries_alias_OBJECTS) $(nentries_alias_LDADD) $(LIBS)
+nentries_hidden$(EXEEXT): $(nentries_hidden_OBJECTS) $(nentries_hidden_DEPENDENCIES) $(EXTRA_nentries_hidden_DEPENDENCIES) 
+	@rm -f nentries_hidden$(EXEEXT)
+	$(LINK) $(nentries_hidden_OBJECTS) $(nentries_hidden_LDADD) $(LIBS)
+nentries_noalias$(EXEEXT): $(nentries_noalias_OBJECTS) $(nentries_noalias_DEPENDENCIES) $(EXTRA_nentries_noalias_DEPENDENCIES) 
+	@rm -f nentries_noalias$(EXEEXT)
+	$(LINK) $(nentries_noalias_OBJECTS) $(nentries_noalias_LDADD) $(LIBS)
+nentries_scalar$(EXEEXT): $(nentries_scalar_OBJECTS) $(nentries_scalar_DEPENDENCIES) $(EXTRA_nentries_scalar_DEPENDENCIES) 
+	@rm -f nentries_scalar$(EXEEXT)
+	$(LINK) $(nentries_scalar_OBJECTS) $(nentries_scalar_LDADD) $(LIBS)
+nfields$(EXEEXT): $(nfields_OBJECTS) $(nfields_DEPENDENCIES) $(EXTRA_nfields_DEPENDENCIES) 
 	@rm -f nfields$(EXEEXT)
 	$(LINK) $(nfields_OBJECTS) $(nfields_LDADD) $(LIBS)
-nfields_invalid$(EXEEXT): $(nfields_invalid_OBJECTS) $(nfields_invalid_DEPENDENCIES) 
+nfields_hidden$(EXEEXT): $(nfields_hidden_OBJECTS) $(nfields_hidden_DEPENDENCIES) $(EXTRA_nfields_hidden_DEPENDENCIES) 
+	@rm -f nfields_hidden$(EXEEXT)
+	$(LINK) $(nfields_hidden_OBJECTS) $(nfields_hidden_LDADD) $(LIBS)
+nfields_invalid$(EXEEXT): $(nfields_invalid_OBJECTS) $(nfields_invalid_DEPENDENCIES) $(EXTRA_nfields_invalid_DEPENDENCIES) 
 	@rm -f nfields_invalid$(EXEEXT)
 	$(LINK) $(nfields_invalid_OBJECTS) $(nfields_invalid_LDADD) $(LIBS)
-nfields_type$(EXEEXT): $(nfields_type_OBJECTS) $(nfields_type_DEPENDENCIES) 
+nfields_type$(EXEEXT): $(nfields_type_OBJECTS) $(nfields_type_DEPENDENCIES) $(EXTRA_nfields_type_DEPENDENCIES) 
 	@rm -f nfields_type$(EXEEXT)
 	$(LINK) $(nfields_type_OBJECTS) $(nfields_type_LDADD) $(LIBS)
-nfields_type_invalid$(EXEEXT): $(nfields_type_invalid_OBJECTS) $(nfields_type_invalid_DEPENDENCIES) 
+nfields_type_hidden$(EXEEXT): $(nfields_type_hidden_OBJECTS) $(nfields_type_hidden_DEPENDENCIES) $(EXTRA_nfields_type_hidden_DEPENDENCIES) 
+	@rm -f nfields_type_hidden$(EXEEXT)
+	$(LINK) $(nfields_type_hidden_OBJECTS) $(nfields_type_hidden_LDADD) $(LIBS)
+nfields_type_invalid$(EXEEXT): $(nfields_type_invalid_OBJECTS) $(nfields_type_invalid_DEPENDENCIES) $(EXTRA_nfields_type_invalid_DEPENDENCIES) 
 	@rm -f nfields_type_invalid$(EXEEXT)
 	$(LINK) $(nfields_type_invalid_OBJECTS) $(nfields_type_invalid_LDADD) $(LIBS)
-nfragments$(EXEEXT): $(nfragments_OBJECTS) $(nfragments_DEPENDENCIES) 
-	@rm -f nfragments$(EXEEXT)
-	$(LINK) $(nfragments_OBJECTS) $(nfragments_LDADD) $(LIBS)
-nframes$(EXEEXT): $(nframes_OBJECTS) $(nframes_DEPENDENCIES) 
+nfields_vector$(EXEEXT): $(nfields_vector_OBJECTS) $(nfields_vector_DEPENDENCIES) $(EXTRA_nfields_vector_DEPENDENCIES) 
+	@rm -f nfields_vector$(EXEEXT)
+	$(LINK) $(nfields_vector_OBJECTS) $(nfields_vector_LDADD) $(LIBS)
+nfields_vector_hidden$(EXEEXT): $(nfields_vector_hidden_OBJECTS) $(nfields_vector_hidden_DEPENDENCIES) $(EXTRA_nfields_vector_hidden_DEPENDENCIES) 
+	@rm -f nfields_vector_hidden$(EXEEXT)
+	$(LINK) $(nfields_vector_hidden_OBJECTS) $(nfields_vector_hidden_LDADD) $(LIBS)
+nfields_vector_invalid$(EXEEXT): $(nfields_vector_invalid_OBJECTS) $(nfields_vector_invalid_DEPENDENCIES) $(EXTRA_nfields_vector_invalid_DEPENDENCIES) 
+	@rm -f nfields_vector_invalid$(EXEEXT)
+	$(LINK) $(nfields_vector_invalid_OBJECTS) $(nfields_vector_invalid_LDADD) $(LIBS)
+nframes$(EXEEXT): $(nframes_OBJECTS) $(nframes_DEPENDENCIES) $(EXTRA_nframes_DEPENDENCIES) 
 	@rm -f nframes$(EXEEXT)
 	$(LINK) $(nframes_OBJECTS) $(nframes_LDADD) $(LIBS)
-nframes64$(EXEEXT): $(nframes64_OBJECTS) $(nframes64_DEPENDENCIES) 
+nframes64$(EXEEXT): $(nframes64_OBJECTS) $(nframes64_DEPENDENCIES) $(EXTRA_nframes64_DEPENDENCIES) 
 	@rm -f nframes64$(EXEEXT)
 	$(LINK) $(nframes64_OBJECTS) $(nframes64_LDADD) $(LIBS)
-nframes_empty$(EXEEXT): $(nframes_empty_OBJECTS) $(nframes_empty_DEPENDENCIES) 
+nframes_empty$(EXEEXT): $(nframes_empty_OBJECTS) $(nframes_empty_DEPENDENCIES) $(EXTRA_nframes_empty_DEPENDENCIES) 
 	@rm -f nframes_empty$(EXEEXT)
 	$(LINK) $(nframes_empty_OBJECTS) $(nframes_empty_LDADD) $(LIBS)
-nframes_invalid$(EXEEXT): $(nframes_invalid_OBJECTS) $(nframes_invalid_DEPENDENCIES) 
+nframes_invalid$(EXEEXT): $(nframes_invalid_OBJECTS) $(nframes_invalid_DEPENDENCIES) $(EXTRA_nframes_invalid_DEPENDENCIES) 
 	@rm -f nframes_invalid$(EXEEXT)
 	$(LINK) $(nframes_invalid_OBJECTS) $(nframes_invalid_LDADD) $(LIBS)
-nframes_off64$(EXEEXT): $(nframes_off64_OBJECTS) $(nframes_off64_DEPENDENCIES) 
+nframes_off64$(EXEEXT): $(nframes_off64_OBJECTS) $(nframes_off64_DEPENDENCIES) $(EXTRA_nframes_off64_DEPENDENCIES) 
 	@rm -f nframes_off64$(EXEEXT)
 	$(LINK) $(nframes_off64_OBJECTS) $(nframes_off64_LDADD) $(LIBS)
-nframes_spf$(EXEEXT): $(nframes_spf_OBJECTS) $(nframes_spf_DEPENDENCIES) 
+nframes_spf$(EXEEXT): $(nframes_spf_OBJECTS) $(nframes_spf_DEPENDENCIES) $(EXTRA_nframes_spf_DEPENDENCIES) 
 	@rm -f nframes_spf$(EXEEXT)
 	$(LINK) $(nframes_spf_OBJECTS) $(nframes_spf_LDADD) $(LIBS)
-nmeta$(EXEEXT): $(nmeta_OBJECTS) $(nmeta_DEPENDENCIES) 
+nmeta$(EXEEXT): $(nmeta_OBJECTS) $(nmeta_DEPENDENCIES) $(EXTRA_nmeta_DEPENDENCIES) 
 	@rm -f nmeta$(EXEEXT)
 	$(LINK) $(nmeta_OBJECTS) $(nmeta_LDADD) $(LIBS)
-nmeta_invalid$(EXEEXT): $(nmeta_invalid_OBJECTS) $(nmeta_invalid_DEPENDENCIES) 
+nmeta_hidden$(EXEEXT): $(nmeta_hidden_OBJECTS) $(nmeta_hidden_DEPENDENCIES) $(EXTRA_nmeta_hidden_DEPENDENCIES) 
+	@rm -f nmeta_hidden$(EXEEXT)
+	$(LINK) $(nmeta_hidden_OBJECTS) $(nmeta_hidden_LDADD) $(LIBS)
+nmeta_invalid$(EXEEXT): $(nmeta_invalid_OBJECTS) $(nmeta_invalid_DEPENDENCIES) $(EXTRA_nmeta_invalid_DEPENDENCIES) 
 	@rm -f nmeta_invalid$(EXEEXT)
 	$(LINK) $(nmeta_invalid_OBJECTS) $(nmeta_invalid_LDADD) $(LIBS)
-nmeta_parent$(EXEEXT): $(nmeta_parent_OBJECTS) $(nmeta_parent_DEPENDENCIES) 
+nmeta_parent$(EXEEXT): $(nmeta_parent_OBJECTS) $(nmeta_parent_DEPENDENCIES) $(EXTRA_nmeta_parent_DEPENDENCIES) 
 	@rm -f nmeta_parent$(EXEEXT)
 	$(LINK) $(nmeta_parent_OBJECTS) $(nmeta_parent_LDADD) $(LIBS)
-nmeta_type$(EXEEXT): $(nmeta_type_OBJECTS) $(nmeta_type_DEPENDENCIES) 
+nmeta_type$(EXEEXT): $(nmeta_type_OBJECTS) $(nmeta_type_DEPENDENCIES) $(EXTRA_nmeta_type_DEPENDENCIES) 
 	@rm -f nmeta_type$(EXEEXT)
 	$(LINK) $(nmeta_type_OBJECTS) $(nmeta_type_LDADD) $(LIBS)
-nmeta_type_invalid$(EXEEXT): $(nmeta_type_invalid_OBJECTS) $(nmeta_type_invalid_DEPENDENCIES) 
+nmeta_type_hidden$(EXEEXT): $(nmeta_type_hidden_OBJECTS) $(nmeta_type_hidden_DEPENDENCIES) $(EXTRA_nmeta_type_hidden_DEPENDENCIES) 
+	@rm -f nmeta_type_hidden$(EXEEXT)
+	$(LINK) $(nmeta_type_hidden_OBJECTS) $(nmeta_type_hidden_LDADD) $(LIBS)
+nmeta_type_invalid$(EXEEXT): $(nmeta_type_invalid_OBJECTS) $(nmeta_type_invalid_DEPENDENCIES) $(EXTRA_nmeta_type_invalid_DEPENDENCIES) 
 	@rm -f nmeta_type_invalid$(EXEEXT)
 	$(LINK) $(nmeta_type_invalid_OBJECTS) $(nmeta_type_invalid_LDADD) $(LIBS)
-nmeta_type_parent$(EXEEXT): $(nmeta_type_parent_OBJECTS) $(nmeta_type_parent_DEPENDENCIES) 
+nmeta_type_parent$(EXEEXT): $(nmeta_type_parent_OBJECTS) $(nmeta_type_parent_DEPENDENCIES) $(EXTRA_nmeta_type_parent_DEPENDENCIES) 
 	@rm -f nmeta_type_parent$(EXEEXT)
 	$(LINK) $(nmeta_type_parent_OBJECTS) $(nmeta_type_parent_LDADD) $(LIBS)
-nmeta_vectors$(EXEEXT): $(nmeta_vectors_OBJECTS) $(nmeta_vectors_DEPENDENCIES) 
+nmeta_vectors$(EXEEXT): $(nmeta_vectors_OBJECTS) $(nmeta_vectors_DEPENDENCIES) $(EXTRA_nmeta_vectors_DEPENDENCIES) 
 	@rm -f nmeta_vectors$(EXEEXT)
 	$(LINK) $(nmeta_vectors_OBJECTS) $(nmeta_vectors_LDADD) $(LIBS)
-nmeta_vectors_del$(EXEEXT): $(nmeta_vectors_del_OBJECTS) $(nmeta_vectors_del_DEPENDENCIES) 
+nmeta_vectors_del$(EXEEXT): $(nmeta_vectors_del_OBJECTS) $(nmeta_vectors_del_DEPENDENCIES) $(EXTRA_nmeta_vectors_del_DEPENDENCIES) 
 	@rm -f nmeta_vectors_del$(EXEEXT)
 	$(LINK) $(nmeta_vectors_del_OBJECTS) $(nmeta_vectors_del_LDADD) $(LIBS)
-nmeta_vectors_invalid$(EXEEXT): $(nmeta_vectors_invalid_OBJECTS) $(nmeta_vectors_invalid_DEPENDENCIES) 
+nmeta_vectors_hidden$(EXEEXT): $(nmeta_vectors_hidden_OBJECTS) $(nmeta_vectors_hidden_DEPENDENCIES) $(EXTRA_nmeta_vectors_hidden_DEPENDENCIES) 
+	@rm -f nmeta_vectors_hidden$(EXEEXT)
+	$(LINK) $(nmeta_vectors_hidden_OBJECTS) $(nmeta_vectors_hidden_LDADD) $(LIBS)
+nmeta_vectors_invalid$(EXEEXT): $(nmeta_vectors_invalid_OBJECTS) $(nmeta_vectors_invalid_DEPENDENCIES) $(EXTRA_nmeta_vectors_invalid_DEPENDENCIES) 
 	@rm -f nmeta_vectors_invalid$(EXEEXT)
 	$(LINK) $(nmeta_vectors_invalid_OBJECTS) $(nmeta_vectors_invalid_LDADD) $(LIBS)
-nmeta_vectors_parent$(EXEEXT): $(nmeta_vectors_parent_OBJECTS) $(nmeta_vectors_parent_DEPENDENCIES) 
+nmeta_vectors_parent$(EXEEXT): $(nmeta_vectors_parent_OBJECTS) $(nmeta_vectors_parent_DEPENDENCIES) $(EXTRA_nmeta_vectors_parent_DEPENDENCIES) 
 	@rm -f nmeta_vectors_parent$(EXEEXT)
 	$(LINK) $(nmeta_vectors_parent_OBJECTS) $(nmeta_vectors_parent_LDADD) $(LIBS)
-nvectors$(EXEEXT): $(nvectors_OBJECTS) $(nvectors_DEPENDENCIES) 
-	@rm -f nvectors$(EXEEXT)
-	$(LINK) $(nvectors_OBJECTS) $(nvectors_LDADD) $(LIBS)
-nvectors_invalid$(EXEEXT): $(nvectors_invalid_OBJECTS) $(nvectors_invalid_DEPENDENCIES) 
-	@rm -f nvectors_invalid$(EXEEXT)
-	$(LINK) $(nvectors_invalid_OBJECTS) $(nvectors_invalid_LDADD) $(LIBS)
-open$(EXEEXT): $(open_OBJECTS) $(open_DEPENDENCIES) 
+open$(EXEEXT): $(open_OBJECTS) $(open_DEPENDENCIES) $(EXTRA_open_DEPENDENCIES) 
 	@rm -f open$(EXEEXT)
 	$(LINK) $(open_OBJECTS) $(open_LDADD) $(LIBS)
-open_cb_abort$(EXEEXT): $(open_cb_abort_OBJECTS) $(open_cb_abort_DEPENDENCIES) 
+open_abs$(EXEEXT): $(open_abs_OBJECTS) $(open_abs_DEPENDENCIES) $(EXTRA_open_abs_DEPENDENCIES) 
+	@rm -f open_abs$(EXEEXT)
+	$(LINK) $(open_abs_OBJECTS) $(open_abs_LDADD) $(LIBS)
+open_cb_abort$(EXEEXT): $(open_cb_abort_OBJECTS) $(open_cb_abort_DEPENDENCIES) $(EXTRA_open_cb_abort_DEPENDENCIES) 
 	@rm -f open_cb_abort$(EXEEXT)
 	$(LINK) $(open_cb_abort_OBJECTS) $(open_cb_abort_LDADD) $(LIBS)
-open_cb_cont$(EXEEXT): $(open_cb_cont_OBJECTS) $(open_cb_cont_DEPENDENCIES) 
+open_cb_cont$(EXEEXT): $(open_cb_cont_OBJECTS) $(open_cb_cont_DEPENDENCIES) $(EXTRA_open_cb_cont_DEPENDENCIES) 
 	@rm -f open_cb_cont$(EXEEXT)
 	$(LINK) $(open_cb_cont_OBJECTS) $(open_cb_cont_LDADD) $(LIBS)
-open_cb_ignore$(EXEEXT): $(open_cb_ignore_OBJECTS) $(open_cb_ignore_DEPENDENCIES) 
+open_cb_ignore$(EXEEXT): $(open_cb_ignore_OBJECTS) $(open_cb_ignore_DEPENDENCIES) $(EXTRA_open_cb_ignore_DEPENDENCIES) 
 	@rm -f open_cb_ignore$(EXEEXT)
 	$(LINK) $(open_cb_ignore_OBJECTS) $(open_cb_ignore_LDADD) $(LIBS)
-open_cb_invalid$(EXEEXT): $(open_cb_invalid_OBJECTS) $(open_cb_invalid_DEPENDENCIES) 
+open_cb_invalid$(EXEEXT): $(open_cb_invalid_OBJECTS) $(open_cb_invalid_DEPENDENCIES) $(EXTRA_open_cb_invalid_DEPENDENCIES) 
 	@rm -f open_cb_invalid$(EXEEXT)
 	$(LINK) $(open_cb_invalid_OBJECTS) $(open_cb_invalid_LDADD) $(LIBS)
-open_cb_rescan$(EXEEXT): $(open_cb_rescan_OBJECTS) $(open_cb_rescan_DEPENDENCIES) 
+open_cb_rescan$(EXEEXT): $(open_cb_rescan_OBJECTS) $(open_cb_rescan_DEPENDENCIES) $(EXTRA_open_cb_rescan_DEPENDENCIES) 
 	@rm -f open_cb_rescan$(EXEEXT)
 	$(LINK) $(open_cb_rescan_OBJECTS) $(open_cb_rescan_LDADD) $(LIBS)
-open_eaccess$(EXEEXT): $(open_eaccess_OBJECTS) $(open_eaccess_DEPENDENCIES) 
+open_eaccess$(EXEEXT): $(open_eaccess_OBJECTS) $(open_eaccess_DEPENDENCIES) $(EXTRA_open_eaccess_DEPENDENCIES) 
 	@rm -f open_eaccess$(EXEEXT)
 	$(LINK) $(open_eaccess_OBJECTS) $(open_eaccess_LDADD) $(LIBS)
-open_nonexistent$(EXEEXT): $(open_nonexistent_OBJECTS) $(open_nonexistent_DEPENDENCIES) 
+open_nonexistent$(EXEEXT): $(open_nonexistent_OBJECTS) $(open_nonexistent_DEPENDENCIES) $(EXTRA_open_nonexistent_DEPENDENCIES) 
 	@rm -f open_nonexistent$(EXEEXT)
 	$(LINK) $(open_nonexistent_OBJECTS) $(open_nonexistent_LDADD) $(LIBS)
-open_notdirfile$(EXEEXT): $(open_notdirfile_OBJECTS) $(open_notdirfile_DEPENDENCIES) 
+open_notdirfile$(EXEEXT): $(open_notdirfile_OBJECTS) $(open_notdirfile_DEPENDENCIES) $(EXTRA_open_notdirfile_DEPENDENCIES) 
 	@rm -f open_notdirfile$(EXEEXT)
 	$(LINK) $(open_notdirfile_OBJECTS) $(open_notdirfile_LDADD) $(LIBS)
-parent$(EXEEXT): $(parent_OBJECTS) $(parent_DEPENDENCIES) 
-	@rm -f parent$(EXEEXT)
-	$(LINK) $(parent_OBJECTS) $(parent_LDADD) $(LIBS)
-parse_badline$(EXEEXT): $(parse_badline_OBJECTS) $(parse_badline_DEPENDENCIES) 
+open_sym_a$(EXEEXT): $(open_sym_a_OBJECTS) $(open_sym_a_DEPENDENCIES) $(EXTRA_open_sym_a_DEPENDENCIES) 
+	@rm -f open_sym_a$(EXEEXT)
+	$(LINK) $(open_sym_a_OBJECTS) $(open_sym_a_LDADD) $(LIBS)
+open_sym_al$(EXEEXT): $(open_sym_al_OBJECTS) $(open_sym_al_DEPENDENCIES) $(EXTRA_open_sym_al_DEPENDENCIES) 
+	@rm -f open_sym_al$(EXEEXT)
+	$(LINK) $(open_sym_al_OBJECTS) $(open_sym_al_LDADD) $(LIBS)
+open_sym_at$(EXEEXT): $(open_sym_at_OBJECTS) $(open_sym_at_DEPENDENCIES) $(EXTRA_open_sym_at_DEPENDENCIES) 
+	@rm -f open_sym_at$(EXEEXT)
+	$(LINK) $(open_sym_at_OBJECTS) $(open_sym_at_LDADD) $(LIBS)
+open_sym_c$(EXEEXT): $(open_sym_c_OBJECTS) $(open_sym_c_DEPENDENCIES) $(EXTRA_open_sym_c_DEPENDENCIES) 
+	@rm -f open_sym_c$(EXEEXT)
+	$(LINK) $(open_sym_c_OBJECTS) $(open_sym_c_LDADD) $(LIBS)
+open_sym_cl$(EXEEXT): $(open_sym_cl_OBJECTS) $(open_sym_cl_DEPENDENCIES) $(EXTRA_open_sym_cl_DEPENDENCIES) 
+	@rm -f open_sym_cl$(EXEEXT)
+	$(LINK) $(open_sym_cl_OBJECTS) $(open_sym_cl_LDADD) $(LIBS)
+open_sym_ct$(EXEEXT): $(open_sym_ct_OBJECTS) $(open_sym_ct_DEPENDENCIES) $(EXTRA_open_sym_ct_DEPENDENCIES) 
+	@rm -f open_sym_ct$(EXEEXT)
+	$(LINK) $(open_sym_ct_OBJECTS) $(open_sym_ct_LDADD) $(LIBS)
+open_sym_p$(EXEEXT): $(open_sym_p_OBJECTS) $(open_sym_p_DEPENDENCIES) $(EXTRA_open_sym_p_DEPENDENCIES) 
+	@rm -f open_sym_p$(EXEEXT)
+	$(LINK) $(open_sym_p_OBJECTS) $(open_sym_p_LDADD) $(LIBS)
+open_sym_pl$(EXEEXT): $(open_sym_pl_OBJECTS) $(open_sym_pl_DEPENDENCIES) $(EXTRA_open_sym_pl_DEPENDENCIES) 
+	@rm -f open_sym_pl$(EXEEXT)
+	$(LINK) $(open_sym_pl_OBJECTS) $(open_sym_pl_LDADD) $(LIBS)
+open_sym_pt$(EXEEXT): $(open_sym_pt_OBJECTS) $(open_sym_pt_DEPENDENCIES) $(EXTRA_open_sym_pt_DEPENDENCIES) 
+	@rm -f open_sym_pt$(EXEEXT)
+	$(LINK) $(open_sym_pt_OBJECTS) $(open_sym_pt_LDADD) $(LIBS)
+parse_alias$(EXEEXT): $(parse_alias_OBJECTS) $(parse_alias_DEPENDENCIES) $(EXTRA_parse_alias_DEPENDENCIES) 
+	@rm -f parse_alias$(EXEEXT)
+	$(LINK) $(parse_alias_OBJECTS) $(parse_alias_LDADD) $(LIBS)
+parse_alias_code$(EXEEXT): $(parse_alias_code_OBJECTS) $(parse_alias_code_DEPENDENCIES) $(EXTRA_parse_alias_code_DEPENDENCIES) 
+	@rm -f parse_alias_code$(EXEEXT)
+	$(LINK) $(parse_alias_code_OBJECTS) $(parse_alias_code_LDADD) $(LIBS)
+parse_alias_dup$(EXEEXT): $(parse_alias_dup_OBJECTS) $(parse_alias_dup_DEPENDENCIES) $(EXTRA_parse_alias_dup_DEPENDENCIES) 
+	@rm -f parse_alias_dup$(EXEEXT)
+	$(LINK) $(parse_alias_dup_OBJECTS) $(parse_alias_dup_LDADD) $(LIBS)
+parse_alias_meta$(EXEEXT): $(parse_alias_meta_OBJECTS) $(parse_alias_meta_DEPENDENCIES) $(EXTRA_parse_alias_meta_DEPENDENCIES) 
+	@rm -f parse_alias_meta$(EXEEXT)
+	$(LINK) $(parse_alias_meta_OBJECTS) $(parse_alias_meta_LDADD) $(LIBS)
+parse_alias_missing$(EXEEXT): $(parse_alias_missing_OBJECTS) $(parse_alias_missing_DEPENDENCIES) $(EXTRA_parse_alias_missing_DEPENDENCIES) 
+	@rm -f parse_alias_missing$(EXEEXT)
+	$(LINK) $(parse_alias_missing_OBJECTS) $(parse_alias_missing_LDADD) $(LIBS)
+parse_badline$(EXEEXT): $(parse_badline_OBJECTS) $(parse_badline_DEPENDENCIES) $(EXTRA_parse_badline_DEPENDENCIES) 
 	@rm -f parse_badline$(EXEEXT)
 	$(LINK) $(parse_badline_OBJECTS) $(parse_badline_LDADD) $(LIBS)
-parse_bit$(EXEEXT): $(parse_bit_OBJECTS) $(parse_bit_DEPENDENCIES) 
+parse_bit$(EXEEXT): $(parse_bit_OBJECTS) $(parse_bit_DEPENDENCIES) $(EXTRA_parse_bit_DEPENDENCIES) 
 	@rm -f parse_bit$(EXEEXT)
 	$(LINK) $(parse_bit_OBJECTS) $(parse_bit_LDADD) $(LIBS)
-parse_bit4$(EXEEXT): $(parse_bit4_OBJECTS) $(parse_bit4_DEPENDENCIES) 
+parse_bit4$(EXEEXT): $(parse_bit4_OBJECTS) $(parse_bit4_DEPENDENCIES) $(EXTRA_parse_bit4_DEPENDENCIES) 
 	@rm -f parse_bit4$(EXEEXT)
 	$(LINK) $(parse_bit4_OBJECTS) $(parse_bit4_LDADD) $(LIBS)
-parse_bit_bitnum$(EXEEXT): $(parse_bit_bitnum_OBJECTS) $(parse_bit_bitnum_DEPENDENCIES) 
+parse_bit_bitnum$(EXEEXT): $(parse_bit_bitnum_OBJECTS) $(parse_bit_bitnum_DEPENDENCIES) $(EXTRA_parse_bit_bitnum_DEPENDENCIES) 
 	@rm -f parse_bit_bitnum$(EXEEXT)
 	$(LINK) $(parse_bit_bitnum_OBJECTS) $(parse_bit_bitnum_LDADD) $(LIBS)
-parse_bit_bitsize$(EXEEXT): $(parse_bit_bitsize_OBJECTS) $(parse_bit_bitsize_DEPENDENCIES) 
+parse_bit_bitsize$(EXEEXT): $(parse_bit_bitsize_OBJECTS) $(parse_bit_bitsize_DEPENDENCIES) $(EXTRA_parse_bit_bitsize_DEPENDENCIES) 
 	@rm -f parse_bit_bitsize$(EXEEXT)
 	$(LINK) $(parse_bit_bitsize_OBJECTS) $(parse_bit_bitsize_LDADD) $(LIBS)
-parse_bit_ncols$(EXEEXT): $(parse_bit_ncols_OBJECTS) $(parse_bit_ncols_DEPENDENCIES) 
+parse_bit_ncols$(EXEEXT): $(parse_bit_ncols_OBJECTS) $(parse_bit_ncols_DEPENDENCIES) $(EXTRA_parse_bit_ncols_DEPENDENCIES) 
 	@rm -f parse_bit_ncols$(EXEEXT)
 	$(LINK) $(parse_bit_ncols_OBJECTS) $(parse_bit_ncols_LDADD) $(LIBS)
-parse_bit_numbits$(EXEEXT): $(parse_bit_numbits_OBJECTS) $(parse_bit_numbits_DEPENDENCIES) 
+parse_bit_numbits$(EXEEXT): $(parse_bit_numbits_OBJECTS) $(parse_bit_numbits_DEPENDENCIES) $(EXTRA_parse_bit_numbits_DEPENDENCIES) 
 	@rm -f parse_bit_numbits$(EXEEXT)
 	$(LINK) $(parse_bit_numbits_OBJECTS) $(parse_bit_numbits_LDADD) $(LIBS)
-parse_bit_scalar$(EXEEXT): $(parse_bit_scalar_OBJECTS) $(parse_bit_scalar_DEPENDENCIES) 
+parse_bit_scalar$(EXEEXT): $(parse_bit_scalar_OBJECTS) $(parse_bit_scalar_DEPENDENCIES) $(EXTRA_parse_bit_scalar_DEPENDENCIES) 
 	@rm -f parse_bit_scalar$(EXEEXT)
 	$(LINK) $(parse_bit_scalar_OBJECTS) $(parse_bit_scalar_LDADD) $(LIBS)
-parse_carray$(EXEEXT): $(parse_carray_OBJECTS) $(parse_carray_DEPENDENCIES) 
+parse_carray$(EXEEXT): $(parse_carray_OBJECTS) $(parse_carray_DEPENDENCIES) $(EXTRA_parse_carray_DEPENDENCIES) 
 	@rm -f parse_carray$(EXEEXT)
 	$(LINK) $(parse_carray_OBJECTS) $(parse_carray_LDADD) $(LIBS)
-parse_carray_long$(EXEEXT): $(parse_carray_long_OBJECTS) $(parse_carray_long_DEPENDENCIES) 
+parse_carray_long$(EXEEXT): $(parse_carray_long_OBJECTS) $(parse_carray_long_DEPENDENCIES) $(EXTRA_parse_carray_long_DEPENDENCIES) 
 	@rm -f parse_carray_long$(EXEEXT)
 	$(LINK) $(parse_carray_long_OBJECTS) $(parse_carray_long_LDADD) $(LIBS)
-parse_const$(EXEEXT): $(parse_const_OBJECTS) $(parse_const_DEPENDENCIES) 
+parse_const$(EXEEXT): $(parse_const_OBJECTS) $(parse_const_DEPENDENCIES) $(EXTRA_parse_const_DEPENDENCIES) 
 	@rm -f parse_const$(EXEEXT)
 	$(LINK) $(parse_const_OBJECTS) $(parse_const_LDADD) $(LIBS)
-parse_const_ncols$(EXEEXT): $(parse_const_ncols_OBJECTS) $(parse_const_ncols_DEPENDENCIES) 
+parse_const_complex$(EXEEXT): $(parse_const_complex_OBJECTS) $(parse_const_complex_DEPENDENCIES) $(EXTRA_parse_const_complex_DEPENDENCIES) 
+	@rm -f parse_const_complex$(EXEEXT)
+	$(LINK) $(parse_const_complex_OBJECTS) $(parse_const_complex_LDADD) $(LIBS)
+parse_const_ncols$(EXEEXT): $(parse_const_ncols_OBJECTS) $(parse_const_ncols_DEPENDENCIES) $(EXTRA_parse_const_ncols_DEPENDENCIES) 
 	@rm -f parse_const_ncols$(EXEEXT)
 	$(LINK) $(parse_const_ncols_OBJECTS) $(parse_const_ncols_LDADD) $(LIBS)
-parse_divide$(EXEEXT): $(parse_divide_OBJECTS) $(parse_divide_DEPENDENCIES) 
+parse_divide$(EXEEXT): $(parse_divide_OBJECTS) $(parse_divide_DEPENDENCIES) $(EXTRA_parse_divide_DEPENDENCIES) 
 	@rm -f parse_divide$(EXEEXT)
 	$(LINK) $(parse_divide_OBJECTS) $(parse_divide_LDADD) $(LIBS)
-parse_duplicate$(EXEEXT): $(parse_duplicate_OBJECTS) $(parse_duplicate_DEPENDENCIES) 
+parse_double$(EXEEXT): $(parse_double_OBJECTS) $(parse_double_DEPENDENCIES) $(EXTRA_parse_double_DEPENDENCIES) 
+	@rm -f parse_double$(EXEEXT)
+	$(LINK) $(parse_double_OBJECTS) $(parse_double_LDADD) $(LIBS)
+parse_duplicate$(EXEEXT): $(parse_duplicate_OBJECTS) $(parse_duplicate_DEPENDENCIES) $(EXTRA_parse_duplicate_DEPENDENCIES) 
 	@rm -f parse_duplicate$(EXEEXT)
 	$(LINK) $(parse_duplicate_OBJECTS) $(parse_duplicate_LDADD) $(LIBS)
-parse_duplicate_ignore$(EXEEXT): $(parse_duplicate_ignore_OBJECTS) $(parse_duplicate_ignore_DEPENDENCIES) 
+parse_duplicate_ignore$(EXEEXT): $(parse_duplicate_ignore_OBJECTS) $(parse_duplicate_ignore_DEPENDENCIES) $(EXTRA_parse_duplicate_ignore_DEPENDENCIES) 
 	@rm -f parse_duplicate_ignore$(EXEEXT)
 	$(LINK) $(parse_duplicate_ignore_OBJECTS) $(parse_duplicate_ignore_LDADD) $(LIBS)
-parse_endian_bad$(EXEEXT): $(parse_endian_bad_OBJECTS) $(parse_endian_bad_DEPENDENCIES) 
+parse_endian_bad$(EXEEXT): $(parse_endian_bad_OBJECTS) $(parse_endian_bad_DEPENDENCIES) $(EXTRA_parse_endian_bad_DEPENDENCIES) 
 	@rm -f parse_endian_bad$(EXEEXT)
 	$(LINK) $(parse_endian_bad_OBJECTS) $(parse_endian_bad_LDADD) $(LIBS)
-parse_endian_big$(EXEEXT): $(parse_endian_big_OBJECTS) $(parse_endian_big_DEPENDENCIES) 
+parse_endian_big$(EXEEXT): $(parse_endian_big_OBJECTS) $(parse_endian_big_DEPENDENCIES) $(EXTRA_parse_endian_big_DEPENDENCIES) 
 	@rm -f parse_endian_big$(EXEEXT)
 	$(LINK) $(parse_endian_big_OBJECTS) $(parse_endian_big_LDADD) $(LIBS)
-parse_endian_force$(EXEEXT): $(parse_endian_force_OBJECTS) $(parse_endian_force_DEPENDENCIES) 
+parse_endian_force$(EXEEXT): $(parse_endian_force_OBJECTS) $(parse_endian_force_DEPENDENCIES) $(EXTRA_parse_endian_force_DEPENDENCIES) 
 	@rm -f parse_endian_force$(EXEEXT)
 	$(LINK) $(parse_endian_force_OBJECTS) $(parse_endian_force_LDADD) $(LIBS)
-parse_endian_little$(EXEEXT): $(parse_endian_little_OBJECTS) $(parse_endian_little_DEPENDENCIES) 
+parse_endian_little$(EXEEXT): $(parse_endian_little_OBJECTS) $(parse_endian_little_DEPENDENCIES) $(EXTRA_parse_endian_little_DEPENDENCIES) 
 	@rm -f parse_endian_little$(EXEEXT)
 	$(LINK) $(parse_endian_little_OBJECTS) $(parse_endian_little_LDADD) $(LIBS)
-parse_endian_slash$(EXEEXT): $(parse_endian_slash_OBJECTS) $(parse_endian_slash_DEPENDENCIES) 
+parse_endian_slash$(EXEEXT): $(parse_endian_slash_OBJECTS) $(parse_endian_slash_DEPENDENCIES) $(EXTRA_parse_endian_slash_DEPENDENCIES) 
 	@rm -f parse_endian_slash$(EXEEXT)
 	$(LINK) $(parse_endian_slash_OBJECTS) $(parse_endian_slash_LDADD) $(LIBS)
-parse_eol$(EXEEXT): $(parse_eol_OBJECTS) $(parse_eol_DEPENDENCIES) 
+parse_eol$(EXEEXT): $(parse_eol_OBJECTS) $(parse_eol_DEPENDENCIES) $(EXTRA_parse_eol_DEPENDENCIES) 
 	@rm -f parse_eol$(EXEEXT)
 	$(LINK) $(parse_eol_OBJECTS) $(parse_eol_LDADD) $(LIBS)
-parse_foffs$(EXEEXT): $(parse_foffs_OBJECTS) $(parse_foffs_DEPENDENCIES) 
+parse_foffs$(EXEEXT): $(parse_foffs_OBJECTS) $(parse_foffs_DEPENDENCIES) $(EXTRA_parse_foffs_DEPENDENCIES) 
 	@rm -f parse_foffs$(EXEEXT)
 	$(LINK) $(parse_foffs_OBJECTS) $(parse_foffs_LDADD) $(LIBS)
-parse_foffs_include$(EXEEXT): $(parse_foffs_include_OBJECTS) $(parse_foffs_include_DEPENDENCIES) 
+parse_foffs_include$(EXEEXT): $(parse_foffs_include_OBJECTS) $(parse_foffs_include_DEPENDENCIES) $(EXTRA_parse_foffs_include_DEPENDENCIES) 
 	@rm -f parse_foffs_include$(EXEEXT)
 	$(LINK) $(parse_foffs_include_OBJECTS) $(parse_foffs_include_LDADD) $(LIBS)
-parse_foffs_slash$(EXEEXT): $(parse_foffs_slash_OBJECTS) $(parse_foffs_slash_DEPENDENCIES) 
+parse_foffs_slash$(EXEEXT): $(parse_foffs_slash_OBJECTS) $(parse_foffs_slash_DEPENDENCIES) $(EXTRA_parse_foffs_slash_DEPENDENCIES) 
 	@rm -f parse_foffs_slash$(EXEEXT)
 	$(LINK) $(parse_foffs_slash_OBJECTS) $(parse_foffs_slash_LDADD) $(LIBS)
-parse_include$(EXEEXT): $(parse_include_OBJECTS) $(parse_include_DEPENDENCIES) 
+parse_hidden$(EXEEXT): $(parse_hidden_OBJECTS) $(parse_hidden_DEPENDENCIES) $(EXTRA_parse_hidden_DEPENDENCIES) 
+	@rm -f parse_hidden$(EXEEXT)
+	$(LINK) $(parse_hidden_OBJECTS) $(parse_hidden_LDADD) $(LIBS)
+parse_hidden_field$(EXEEXT): $(parse_hidden_field_OBJECTS) $(parse_hidden_field_DEPENDENCIES) $(EXTRA_parse_hidden_field_DEPENDENCIES) 
+	@rm -f parse_hidden_field$(EXEEXT)
+	$(LINK) $(parse_hidden_field_OBJECTS) $(parse_hidden_field_LDADD) $(LIBS)
+parse_hidden_meta$(EXEEXT): $(parse_hidden_meta_OBJECTS) $(parse_hidden_meta_DEPENDENCIES) $(EXTRA_parse_hidden_meta_DEPENDENCIES) 
+	@rm -f parse_hidden_meta$(EXEEXT)
+	$(LINK) $(parse_hidden_meta_OBJECTS) $(parse_hidden_meta_LDADD) $(LIBS)
+parse_include$(EXEEXT): $(parse_include_OBJECTS) $(parse_include_DEPENDENCIES) $(EXTRA_parse_include_DEPENDENCIES) 
 	@rm -f parse_include$(EXEEXT)
 	$(LINK) $(parse_include_OBJECTS) $(parse_include_LDADD) $(LIBS)
-parse_include_absolute$(EXEEXT): $(parse_include_absolute_OBJECTS) $(parse_include_absolute_DEPENDENCIES) 
+parse_include_absolute$(EXEEXT): $(parse_include_absolute_OBJECTS) $(parse_include_absolute_DEPENDENCIES) $(EXTRA_parse_include_absolute_DEPENDENCIES) 
 	@rm -f parse_include_absolute$(EXEEXT)
 	$(LINK) $(parse_include_absolute_OBJECTS) $(parse_include_absolute_LDADD) $(LIBS)
-parse_include_absrel$(EXEEXT): $(parse_include_absrel_OBJECTS) $(parse_include_absrel_DEPENDENCIES) 
+parse_include_absrel$(EXEEXT): $(parse_include_absrel_OBJECTS) $(parse_include_absrel_DEPENDENCIES) $(EXTRA_parse_include_absrel_DEPENDENCIES) 
 	@rm -f parse_include_absrel$(EXEEXT)
 	$(LINK) $(parse_include_absrel_OBJECTS) $(parse_include_absrel_LDADD) $(LIBS)
-parse_include_nonexistent$(EXEEXT): $(parse_include_nonexistent_OBJECTS) $(parse_include_nonexistent_DEPENDENCIES) 
+parse_include_affix_ref$(EXEEXT): $(parse_include_affix_ref_OBJECTS) $(parse_include_affix_ref_DEPENDENCIES) $(EXTRA_parse_include_affix_ref_DEPENDENCIES) 
+	@rm -f parse_include_affix_ref$(EXEEXT)
+	$(LINK) $(parse_include_affix_ref_OBJECTS) $(parse_include_affix_ref_LDADD) $(LIBS)
+parse_include_dir$(EXEEXT): $(parse_include_dir_OBJECTS) $(parse_include_dir_DEPENDENCIES) $(EXTRA_parse_include_dir_DEPENDENCIES) 
+	@rm -f parse_include_dir$(EXEEXT)
+	$(LINK) $(parse_include_dir_OBJECTS) $(parse_include_dir_LDADD) $(LIBS)
+parse_include_loop$(EXEEXT): $(parse_include_loop_OBJECTS) $(parse_include_loop_DEPENDENCIES) $(EXTRA_parse_include_loop_DEPENDENCIES) 
+	@rm -f parse_include_loop$(EXEEXT)
+	$(LINK) $(parse_include_loop_OBJECTS) $(parse_include_loop_LDADD) $(LIBS)
+parse_include_nonexistent$(EXEEXT): $(parse_include_nonexistent_OBJECTS) $(parse_include_nonexistent_DEPENDENCIES) $(EXTRA_parse_include_nonexistent_DEPENDENCIES) 
 	@rm -f parse_include_nonexistent$(EXEEXT)
 	$(LINK) $(parse_include_nonexistent_OBJECTS) $(parse_include_nonexistent_LDADD) $(LIBS)
-parse_include_relabs$(EXEEXT): $(parse_include_relabs_OBJECTS) $(parse_include_relabs_DEPENDENCIES) 
+parse_include_prefix$(EXEEXT): $(parse_include_prefix_OBJECTS) $(parse_include_prefix_DEPENDENCIES) $(EXTRA_parse_include_prefix_DEPENDENCIES) 
+	@rm -f parse_include_prefix$(EXEEXT)
+	$(LINK) $(parse_include_prefix_OBJECTS) $(parse_include_prefix_LDADD) $(LIBS)
+parse_include_prefix_dup$(EXEEXT): $(parse_include_prefix_dup_OBJECTS) $(parse_include_prefix_dup_DEPENDENCIES) $(EXTRA_parse_include_prefix_dup_DEPENDENCIES) 
+	@rm -f parse_include_prefix_dup$(EXEEXT)
+	$(LINK) $(parse_include_prefix_dup_OBJECTS) $(parse_include_prefix_dup_LDADD) $(LIBS)
+parse_include_preprefix$(EXEEXT): $(parse_include_preprefix_OBJECTS) $(parse_include_preprefix_DEPENDENCIES) $(EXTRA_parse_include_preprefix_DEPENDENCIES) 
+	@rm -f parse_include_preprefix$(EXEEXT)
+	$(LINK) $(parse_include_preprefix_OBJECTS) $(parse_include_preprefix_LDADD) $(LIBS)
+parse_include_ref$(EXEEXT): $(parse_include_ref_OBJECTS) $(parse_include_ref_DEPENDENCIES) $(EXTRA_parse_include_ref_DEPENDENCIES) 
+	@rm -f parse_include_ref$(EXEEXT)
+	$(LINK) $(parse_include_ref_OBJECTS) $(parse_include_ref_LDADD) $(LIBS)
+parse_include_relabs$(EXEEXT): $(parse_include_relabs_OBJECTS) $(parse_include_relabs_DEPENDENCIES) $(EXTRA_parse_include_relabs_DEPENDENCIES) 
 	@rm -f parse_include_relabs$(EXEEXT)
 	$(LINK) $(parse_include_relabs_OBJECTS) $(parse_include_relabs_LDADD) $(LIBS)
-parse_include_relrel$(EXEEXT): $(parse_include_relrel_OBJECTS) $(parse_include_relrel_DEPENDENCIES) 
+parse_include_relrel$(EXEEXT): $(parse_include_relrel_OBJECTS) $(parse_include_relrel_DEPENDENCIES) $(EXTRA_parse_include_relrel_DEPENDENCIES) 
 	@rm -f parse_include_relrel$(EXEEXT)
 	$(LINK) $(parse_include_relrel_OBJECTS) $(parse_include_relrel_LDADD) $(LIBS)
-parse_include_slash$(EXEEXT): $(parse_include_slash_OBJECTS) $(parse_include_slash_DEPENDENCIES) 
+parse_include_slash$(EXEEXT): $(parse_include_slash_OBJECTS) $(parse_include_slash_DEPENDENCIES) $(EXTRA_parse_include_slash_DEPENDENCIES) 
 	@rm -f parse_include_slash$(EXEEXT)
 	$(LINK) $(parse_include_slash_OBJECTS) $(parse_include_slash_LDADD) $(LIBS)
-parse_index$(EXEEXT): $(parse_index_OBJECTS) $(parse_index_DEPENDENCIES) 
+parse_include_suffix$(EXEEXT): $(parse_include_suffix_OBJECTS) $(parse_include_suffix_DEPENDENCIES) $(EXTRA_parse_include_suffix_DEPENDENCIES) 
+	@rm -f parse_include_suffix$(EXEEXT)
+	$(LINK) $(parse_include_suffix_OBJECTS) $(parse_include_suffix_LDADD) $(LIBS)
+parse_include_sufsuffix$(EXEEXT): $(parse_include_sufsuffix_OBJECTS) $(parse_include_sufsuffix_DEPENDENCIES) $(EXTRA_parse_include_sufsuffix_DEPENDENCIES) 
+	@rm -f parse_include_sufsuffix$(EXEEXT)
+	$(LINK) $(parse_include_sufsuffix_OBJECTS) $(parse_include_sufsuffix_LDADD) $(LIBS)
+parse_index$(EXEEXT): $(parse_index_OBJECTS) $(parse_index_DEPENDENCIES) $(EXTRA_parse_index_DEPENDENCIES) 
 	@rm -f parse_index$(EXEEXT)
 	$(LINK) $(parse_index_OBJECTS) $(parse_index_LDADD) $(LIBS)
-parse_lincom$(EXEEXT): $(parse_lincom_OBJECTS) $(parse_lincom_DEPENDENCIES) 
+parse_lincom$(EXEEXT): $(parse_lincom_OBJECTS) $(parse_lincom_DEPENDENCIES) $(EXTRA_parse_lincom_DEPENDENCIES) 
 	@rm -f parse_lincom$(EXEEXT)
 	$(LINK) $(parse_lincom_OBJECTS) $(parse_lincom_LDADD) $(LIBS)
-parse_lincom_ncols1$(EXEEXT): $(parse_lincom_ncols1_OBJECTS) $(parse_lincom_ncols1_DEPENDENCIES) 
+parse_lincom_ncols1$(EXEEXT): $(parse_lincom_ncols1_OBJECTS) $(parse_lincom_ncols1_DEPENDENCIES) $(EXTRA_parse_lincom_ncols1_DEPENDENCIES) 
 	@rm -f parse_lincom_ncols1$(EXEEXT)
 	$(LINK) $(parse_lincom_ncols1_OBJECTS) $(parse_lincom_ncols1_LDADD) $(LIBS)
-parse_lincom_ncols2$(EXEEXT): $(parse_lincom_ncols2_OBJECTS) $(parse_lincom_ncols2_DEPENDENCIES) 
+parse_lincom_ncols2$(EXEEXT): $(parse_lincom_ncols2_OBJECTS) $(parse_lincom_ncols2_DEPENDENCIES) $(EXTRA_parse_lincom_ncols2_DEPENDENCIES) 
 	@rm -f parse_lincom_ncols2$(EXEEXT)
 	$(LINK) $(parse_lincom_ncols2_OBJECTS) $(parse_lincom_ncols2_LDADD) $(LIBS)
-parse_lincom_nfields$(EXEEXT): $(parse_lincom_nfields_OBJECTS) $(parse_lincom_nfields_DEPENDENCIES) 
+parse_lincom_nfields$(EXEEXT): $(parse_lincom_nfields_OBJECTS) $(parse_lincom_nfields_DEPENDENCIES) $(EXTRA_parse_lincom_nfields_DEPENDENCIES) 
 	@rm -f parse_lincom_nfields$(EXEEXT)
 	$(LINK) $(parse_lincom_nfields_OBJECTS) $(parse_lincom_nfields_LDADD) $(LIBS)
-parse_lincom_nofields$(EXEEXT): $(parse_lincom_nofields_OBJECTS) $(parse_lincom_nofields_DEPENDENCIES) 
+parse_lincom_nofields$(EXEEXT): $(parse_lincom_nofields_OBJECTS) $(parse_lincom_nofields_DEPENDENCIES) $(EXTRA_parse_lincom_nofields_DEPENDENCIES) 
 	@rm -f parse_lincom_nofields$(EXEEXT)
 	$(LINK) $(parse_lincom_nofields_OBJECTS) $(parse_lincom_nofields_LDADD) $(LIBS)
-parse_lincom_non$(EXEEXT): $(parse_lincom_non_OBJECTS) $(parse_lincom_non_DEPENDENCIES) 
+parse_lincom_non$(EXEEXT): $(parse_lincom_non_OBJECTS) $(parse_lincom_non_DEPENDENCIES) $(EXTRA_parse_lincom_non_DEPENDENCIES) 
 	@rm -f parse_lincom_non$(EXEEXT)
 	$(LINK) $(parse_lincom_non_OBJECTS) $(parse_lincom_non_LDADD) $(LIBS)
-parse_lincom_non_ncols$(EXEEXT): $(parse_lincom_non_ncols_OBJECTS) $(parse_lincom_non_ncols_DEPENDENCIES) 
+parse_lincom_non_ncols$(EXEEXT): $(parse_lincom_non_ncols_OBJECTS) $(parse_lincom_non_ncols_DEPENDENCIES) $(EXTRA_parse_lincom_non_ncols_DEPENDENCIES) 
 	@rm -f parse_lincom_non_ncols$(EXEEXT)
 	$(LINK) $(parse_lincom_non_ncols_OBJECTS) $(parse_lincom_non_ncols_LDADD) $(LIBS)
-parse_lincom_scalar$(EXEEXT): $(parse_lincom_scalar_OBJECTS) $(parse_lincom_scalar_DEPENDENCIES) 
+parse_lincom_scalar$(EXEEXT): $(parse_lincom_scalar_OBJECTS) $(parse_lincom_scalar_DEPENDENCIES) $(EXTRA_parse_lincom_scalar_DEPENDENCIES) 
 	@rm -f parse_lincom_scalar$(EXEEXT)
 	$(LINK) $(parse_lincom_scalar_OBJECTS) $(parse_lincom_scalar_LDADD) $(LIBS)
-parse_linterp$(EXEEXT): $(parse_linterp_OBJECTS) $(parse_linterp_DEPENDENCIES) 
+parse_linterp$(EXEEXT): $(parse_linterp_OBJECTS) $(parse_linterp_DEPENDENCIES) $(EXTRA_parse_linterp_DEPENDENCIES) 
 	@rm -f parse_linterp$(EXEEXT)
 	$(LINK) $(parse_linterp_OBJECTS) $(parse_linterp_LDADD) $(LIBS)
-parse_linterp_ncols$(EXEEXT): $(parse_linterp_ncols_OBJECTS) $(parse_linterp_ncols_DEPENDENCIES) 
+parse_linterp_ncols$(EXEEXT): $(parse_linterp_ncols_OBJECTS) $(parse_linterp_ncols_DEPENDENCIES) $(EXTRA_parse_linterp_ncols_DEPENDENCIES) 
 	@rm -f parse_linterp_ncols$(EXEEXT)
 	$(LINK) $(parse_linterp_ncols_OBJECTS) $(parse_linterp_ncols_LDADD) $(LIBS)
-parse_meta$(EXEEXT): $(parse_meta_OBJECTS) $(parse_meta_DEPENDENCIES) 
+parse_malias$(EXEEXT): $(parse_malias_OBJECTS) $(parse_malias_DEPENDENCIES) $(EXTRA_parse_malias_DEPENDENCIES) 
+	@rm -f parse_malias$(EXEEXT)
+	$(LINK) $(parse_malias_OBJECTS) $(parse_malias_LDADD) $(LIBS)
+parse_malias_dup$(EXEEXT): $(parse_malias_dup_OBJECTS) $(parse_malias_dup_DEPENDENCIES) $(EXTRA_parse_malias_dup_DEPENDENCIES) 
+	@rm -f parse_malias_dup$(EXEEXT)
+	$(LINK) $(parse_malias_dup_OBJECTS) $(parse_malias_dup_LDADD) $(LIBS)
+parse_malias_meta$(EXEEXT): $(parse_malias_meta_OBJECTS) $(parse_malias_meta_DEPENDENCIES) $(EXTRA_parse_malias_meta_DEPENDENCIES) 
+	@rm -f parse_malias_meta$(EXEEXT)
+	$(LINK) $(parse_malias_meta_OBJECTS) $(parse_malias_meta_LDADD) $(LIBS)
+parse_meta$(EXEEXT): $(parse_meta_OBJECTS) $(parse_meta_DEPENDENCIES) $(EXTRA_parse_meta_DEPENDENCIES) 
 	@rm -f parse_meta$(EXEEXT)
 	$(LINK) $(parse_meta_OBJECTS) $(parse_meta_LDADD) $(LIBS)
-parse_meta_implicit$(EXEEXT): $(parse_meta_implicit_OBJECTS) $(parse_meta_implicit_DEPENDENCIES) 
+parse_meta_affix$(EXEEXT): $(parse_meta_affix_OBJECTS) $(parse_meta_affix_DEPENDENCIES) $(EXTRA_parse_meta_affix_DEPENDENCIES) 
+	@rm -f parse_meta_affix$(EXEEXT)
+	$(LINK) $(parse_meta_affix_OBJECTS) $(parse_meta_affix_LDADD) $(LIBS)
+parse_meta_alias$(EXEEXT): $(parse_meta_alias_OBJECTS) $(parse_meta_alias_DEPENDENCIES) $(EXTRA_parse_meta_alias_DEPENDENCIES) 
+	@rm -f parse_meta_alias$(EXEEXT)
+	$(LINK) $(parse_meta_alias_OBJECTS) $(parse_meta_alias_LDADD) $(LIBS)
+parse_meta_implicit$(EXEEXT): $(parse_meta_implicit_OBJECTS) $(parse_meta_implicit_DEPENDENCIES) $(EXTRA_parse_meta_implicit_DEPENDENCIES) 
 	@rm -f parse_meta_implicit$(EXEEXT)
 	$(LINK) $(parse_meta_implicit_OBJECTS) $(parse_meta_implicit_LDADD) $(LIBS)
-parse_meta_implicit2$(EXEEXT): $(parse_meta_implicit2_OBJECTS) $(parse_meta_implicit2_DEPENDENCIES) 
+parse_meta_implicit2$(EXEEXT): $(parse_meta_implicit2_OBJECTS) $(parse_meta_implicit2_DEPENDENCIES) $(EXTRA_parse_meta_implicit2_DEPENDENCIES) 
 	@rm -f parse_meta_implicit2$(EXEEXT)
 	$(LINK) $(parse_meta_implicit2_OBJECTS) $(parse_meta_implicit2_LDADD) $(LIBS)
-parse_meta_index$(EXEEXT): $(parse_meta_index_OBJECTS) $(parse_meta_index_DEPENDENCIES) 
+parse_meta_implicit_affix$(EXEEXT): $(parse_meta_implicit_affix_OBJECTS) $(parse_meta_implicit_affix_DEPENDENCIES) $(EXTRA_parse_meta_implicit_affix_DEPENDENCIES) 
+	@rm -f parse_meta_implicit_affix$(EXEEXT)
+	$(LINK) $(parse_meta_implicit_affix_OBJECTS) $(parse_meta_implicit_affix_LDADD) $(LIBS)
+parse_meta_index$(EXEEXT): $(parse_meta_index_OBJECTS) $(parse_meta_index_DEPENDENCIES) $(EXTRA_parse_meta_index_DEPENDENCIES) 
 	@rm -f parse_meta_index$(EXEEXT)
 	$(LINK) $(parse_meta_index_OBJECTS) $(parse_meta_index_LDADD) $(LIBS)
-parse_meta_index2$(EXEEXT): $(parse_meta_index2_OBJECTS) $(parse_meta_index2_DEPENDENCIES) 
+parse_meta_index2$(EXEEXT): $(parse_meta_index2_OBJECTS) $(parse_meta_index2_DEPENDENCIES) $(EXTRA_parse_meta_index2_DEPENDENCIES) 
 	@rm -f parse_meta_index2$(EXEEXT)
 	$(LINK) $(parse_meta_index2_OBJECTS) $(parse_meta_index2_LDADD) $(LIBS)
-parse_meta_parent$(EXEEXT): $(parse_meta_parent_OBJECTS) $(parse_meta_parent_DEPENDENCIES) 
+parse_meta_jump$(EXEEXT): $(parse_meta_jump_OBJECTS) $(parse_meta_jump_DEPENDENCIES) $(EXTRA_parse_meta_jump_DEPENDENCIES) 
+	@rm -f parse_meta_jump$(EXEEXT)
+	$(LINK) $(parse_meta_jump_OBJECTS) $(parse_meta_jump_LDADD) $(LIBS)
+parse_meta_malias$(EXEEXT): $(parse_meta_malias_OBJECTS) $(parse_meta_malias_DEPENDENCIES) $(EXTRA_parse_meta_malias_DEPENDENCIES) 
+	@rm -f parse_meta_malias$(EXEEXT)
+	$(LINK) $(parse_meta_malias_OBJECTS) $(parse_meta_malias_LDADD) $(LIBS)
+parse_meta_meta$(EXEEXT): $(parse_meta_meta_OBJECTS) $(parse_meta_meta_DEPENDENCIES) $(EXTRA_parse_meta_meta_DEPENDENCIES) 
+	@rm -f parse_meta_meta$(EXEEXT)
+	$(LINK) $(parse_meta_meta_OBJECTS) $(parse_meta_meta_LDADD) $(LIBS)
+parse_meta_parent$(EXEEXT): $(parse_meta_parent_OBJECTS) $(parse_meta_parent_DEPENDENCIES) $(EXTRA_parse_meta_parent_DEPENDENCIES) 
 	@rm -f parse_meta_parent$(EXEEXT)
 	$(LINK) $(parse_meta_parent_OBJECTS) $(parse_meta_parent_LDADD) $(LIBS)
-parse_meta_raw$(EXEEXT): $(parse_meta_raw_OBJECTS) $(parse_meta_raw_DEPENDENCIES) 
+parse_meta_raw$(EXEEXT): $(parse_meta_raw_OBJECTS) $(parse_meta_raw_DEPENDENCIES) $(EXTRA_parse_meta_raw_DEPENDENCIES) 
 	@rm -f parse_meta_raw$(EXEEXT)
 	$(LINK) $(parse_meta_raw_OBJECTS) $(parse_meta_raw_LDADD) $(LIBS)
-parse_multiply$(EXEEXT): $(parse_multiply_OBJECTS) $(parse_multiply_DEPENDENCIES) 
+parse_mplex$(EXEEXT): $(parse_mplex_OBJECTS) $(parse_mplex_DEPENDENCIES) $(EXTRA_parse_mplex_DEPENDENCIES) 
+	@rm -f parse_mplex$(EXEEXT)
+	$(LINK) $(parse_mplex_OBJECTS) $(parse_mplex_LDADD) $(LIBS)
+parse_mplex_ncols$(EXEEXT): $(parse_mplex_ncols_OBJECTS) $(parse_mplex_ncols_DEPENDENCIES) $(EXTRA_parse_mplex_ncols_DEPENDENCIES) 
+	@rm -f parse_mplex_ncols$(EXEEXT)
+	$(LINK) $(parse_mplex_ncols_OBJECTS) $(parse_mplex_ncols_LDADD) $(LIBS)
+parse_mplex_nomax$(EXEEXT): $(parse_mplex_nomax_OBJECTS) $(parse_mplex_nomax_DEPENDENCIES) $(EXTRA_parse_mplex_nomax_DEPENDENCIES) 
+	@rm -f parse_mplex_nomax$(EXEEXT)
+	$(LINK) $(parse_mplex_nomax_OBJECTS) $(parse_mplex_nomax_LDADD) $(LIBS)
+parse_mplex_scalar$(EXEEXT): $(parse_mplex_scalar_OBJECTS) $(parse_mplex_scalar_DEPENDENCIES) $(EXTRA_parse_mplex_scalar_DEPENDENCIES) 
+	@rm -f parse_mplex_scalar$(EXEEXT)
+	$(LINK) $(parse_mplex_scalar_OBJECTS) $(parse_mplex_scalar_LDADD) $(LIBS)
+parse_multiply$(EXEEXT): $(parse_multiply_OBJECTS) $(parse_multiply_DEPENDENCIES) $(EXTRA_parse_multiply_DEPENDENCIES) 
 	@rm -f parse_multiply$(EXEEXT)
 	$(LINK) $(parse_multiply_OBJECTS) $(parse_multiply_LDADD) $(LIBS)
-parse_multiply_ncols$(EXEEXT): $(parse_multiply_ncols_OBJECTS) $(parse_multiply_ncols_DEPENDENCIES) 
+parse_multiply_ncols$(EXEEXT): $(parse_multiply_ncols_OBJECTS) $(parse_multiply_ncols_DEPENDENCIES) $(EXTRA_parse_multiply_ncols_DEPENDENCIES) 
 	@rm -f parse_multiply_ncols$(EXEEXT)
 	$(LINK) $(parse_multiply_ncols_OBJECTS) $(parse_multiply_ncols_LDADD) $(LIBS)
-parse_name$(EXEEXT): $(parse_name_OBJECTS) $(parse_name_DEPENDENCIES) 
+parse_name$(EXEEXT): $(parse_name_OBJECTS) $(parse_name_DEPENDENCIES) $(EXTRA_parse_name_DEPENDENCIES) 
 	@rm -f parse_name$(EXEEXT)
 	$(LINK) $(parse_name_OBJECTS) $(parse_name_LDADD) $(LIBS)
-parse_name_dot$(EXEEXT): $(parse_name_dot_OBJECTS) $(parse_name_dot_DEPENDENCIES) 
+parse_name_dot$(EXEEXT): $(parse_name_dot_OBJECTS) $(parse_name_dot_DEPENDENCIES) $(EXTRA_parse_name_dot_DEPENDENCIES) 
 	@rm -f parse_name_dot$(EXEEXT)
 	$(LINK) $(parse_name_dot_OBJECTS) $(parse_name_dot_LDADD) $(LIBS)
-parse_name_ext$(EXEEXT): $(parse_name_ext_OBJECTS) $(parse_name_ext_DEPENDENCIES) 
+parse_name_ext$(EXEEXT): $(parse_name_ext_OBJECTS) $(parse_name_ext_DEPENDENCIES) $(EXTRA_parse_name_ext_DEPENDENCIES) 
 	@rm -f parse_name_ext$(EXEEXT)
 	$(LINK) $(parse_name_ext_OBJECTS) $(parse_name_ext_LDADD) $(LIBS)
-parse_name_pedantic$(EXEEXT): $(parse_name_pedantic_OBJECTS) $(parse_name_pedantic_DEPENDENCIES) 
+parse_name_pedantic$(EXEEXT): $(parse_name_pedantic_OBJECTS) $(parse_name_pedantic_DEPENDENCIES) $(EXTRA_parse_name_pedantic_DEPENDENCIES) 
 	@rm -f parse_name_pedantic$(EXEEXT)
 	$(LINK) $(parse_name_pedantic_OBJECTS) $(parse_name_pedantic_LDADD) $(LIBS)
-parse_ncols$(EXEEXT): $(parse_ncols_OBJECTS) $(parse_ncols_DEPENDENCIES) 
+parse_ncols$(EXEEXT): $(parse_ncols_OBJECTS) $(parse_ncols_DEPENDENCIES) $(EXTRA_parse_ncols_DEPENDENCIES) 
 	@rm -f parse_ncols$(EXEEXT)
 	$(LINK) $(parse_ncols_OBJECTS) $(parse_ncols_LDADD) $(LIBS)
-parse_phase$(EXEEXT): $(parse_phase_OBJECTS) $(parse_phase_DEPENDENCIES) 
+parse_phase$(EXEEXT): $(parse_phase_OBJECTS) $(parse_phase_DEPENDENCIES) $(EXTRA_parse_phase_DEPENDENCIES) 
 	@rm -f parse_phase$(EXEEXT)
 	$(LINK) $(parse_phase_OBJECTS) $(parse_phase_LDADD) $(LIBS)
-parse_phase_ncols$(EXEEXT): $(parse_phase_ncols_OBJECTS) $(parse_phase_ncols_DEPENDENCIES) 
+parse_phase_ncols$(EXEEXT): $(parse_phase_ncols_OBJECTS) $(parse_phase_ncols_DEPENDENCIES) $(EXTRA_parse_phase_ncols_DEPENDENCIES) 
 	@rm -f parse_phase_ncols$(EXEEXT)
 	$(LINK) $(parse_phase_ncols_OBJECTS) $(parse_phase_ncols_LDADD) $(LIBS)
-parse_phase_scalar$(EXEEXT): $(parse_phase_scalar_OBJECTS) $(parse_phase_scalar_DEPENDENCIES) 
+parse_phase_scalar$(EXEEXT): $(parse_phase_scalar_OBJECTS) $(parse_phase_scalar_DEPENDENCIES) $(EXTRA_parse_phase_scalar_DEPENDENCIES) 
 	@rm -f parse_phase_scalar$(EXEEXT)
 	$(LINK) $(parse_phase_scalar_OBJECTS) $(parse_phase_scalar_LDADD) $(LIBS)
-parse_polynom$(EXEEXT): $(parse_polynom_OBJECTS) $(parse_polynom_DEPENDENCIES) 
+parse_polynom$(EXEEXT): $(parse_polynom_OBJECTS) $(parse_polynom_DEPENDENCIES) $(EXTRA_parse_polynom_DEPENDENCIES) 
 	@rm -f parse_polynom$(EXEEXT)
 	$(LINK) $(parse_polynom_OBJECTS) $(parse_polynom_LDADD) $(LIBS)
-parse_polynom_ncols1$(EXEEXT): $(parse_polynom_ncols1_OBJECTS) $(parse_polynom_ncols1_DEPENDENCIES) 
+parse_polynom_ncols1$(EXEEXT): $(parse_polynom_ncols1_OBJECTS) $(parse_polynom_ncols1_DEPENDENCIES) $(EXTRA_parse_polynom_ncols1_DEPENDENCIES) 
 	@rm -f parse_polynom_ncols1$(EXEEXT)
 	$(LINK) $(parse_polynom_ncols1_OBJECTS) $(parse_polynom_ncols1_LDADD) $(LIBS)
-parse_polynom_ncols2$(EXEEXT): $(parse_polynom_ncols2_OBJECTS) $(parse_polynom_ncols2_DEPENDENCIES) 
+parse_polynom_ncols2$(EXEEXT): $(parse_polynom_ncols2_OBJECTS) $(parse_polynom_ncols2_DEPENDENCIES) $(EXTRA_parse_polynom_ncols2_DEPENDENCIES) 
 	@rm -f parse_polynom_ncols2$(EXEEXT)
 	$(LINK) $(parse_polynom_ncols2_OBJECTS) $(parse_polynom_ncols2_LDADD) $(LIBS)
-parse_polynom_scalar$(EXEEXT): $(parse_polynom_scalar_OBJECTS) $(parse_polynom_scalar_DEPENDENCIES) 
+parse_polynom_scalar$(EXEEXT): $(parse_polynom_scalar_OBJECTS) $(parse_polynom_scalar_DEPENDENCIES) $(EXTRA_parse_polynom_scalar_DEPENDENCIES) 
 	@rm -f parse_polynom_scalar$(EXEEXT)
 	$(LINK) $(parse_polynom_scalar_OBJECTS) $(parse_polynom_scalar_LDADD) $(LIBS)
-parse_protect_all$(EXEEXT): $(parse_protect_all_OBJECTS) $(parse_protect_all_DEPENDENCIES) 
+parse_protect_all$(EXEEXT): $(parse_protect_all_OBJECTS) $(parse_protect_all_DEPENDENCIES) $(EXTRA_parse_protect_all_DEPENDENCIES) 
 	@rm -f parse_protect_all$(EXEEXT)
 	$(LINK) $(parse_protect_all_OBJECTS) $(parse_protect_all_LDADD) $(LIBS)
-parse_protect_bad$(EXEEXT): $(parse_protect_bad_OBJECTS) $(parse_protect_bad_DEPENDENCIES) 
+parse_protect_bad$(EXEEXT): $(parse_protect_bad_OBJECTS) $(parse_protect_bad_DEPENDENCIES) $(EXTRA_parse_protect_bad_DEPENDENCIES) 
 	@rm -f parse_protect_bad$(EXEEXT)
 	$(LINK) $(parse_protect_bad_OBJECTS) $(parse_protect_bad_LDADD) $(LIBS)
-parse_protect_data$(EXEEXT): $(parse_protect_data_OBJECTS) $(parse_protect_data_DEPENDENCIES) 
+parse_protect_data$(EXEEXT): $(parse_protect_data_OBJECTS) $(parse_protect_data_DEPENDENCIES) $(EXTRA_parse_protect_data_DEPENDENCIES) 
 	@rm -f parse_protect_data$(EXEEXT)
 	$(LINK) $(parse_protect_data_OBJECTS) $(parse_protect_data_LDADD) $(LIBS)
-parse_protect_format$(EXEEXT): $(parse_protect_format_OBJECTS) $(parse_protect_format_DEPENDENCIES) 
+parse_protect_format$(EXEEXT): $(parse_protect_format_OBJECTS) $(parse_protect_format_DEPENDENCIES) $(EXTRA_parse_protect_format_DEPENDENCIES) 
 	@rm -f parse_protect_format$(EXEEXT)
 	$(LINK) $(parse_protect_format_OBJECTS) $(parse_protect_format_LDADD) $(LIBS)
-parse_protect_none$(EXEEXT): $(parse_protect_none_OBJECTS) $(parse_protect_none_DEPENDENCIES) 
+parse_protect_none$(EXEEXT): $(parse_protect_none_OBJECTS) $(parse_protect_none_DEPENDENCIES) $(EXTRA_parse_protect_none_DEPENDENCIES) 
 	@rm -f parse_protect_none$(EXEEXT)
 	$(LINK) $(parse_protect_none_OBJECTS) $(parse_protect_none_LDADD) $(LIBS)
-parse_quote$(EXEEXT): $(parse_quote_OBJECTS) $(parse_quote_DEPENDENCIES) 
+parse_quote$(EXEEXT): $(parse_quote_OBJECTS) $(parse_quote_DEPENDENCIES) $(EXTRA_parse_quote_DEPENDENCIES) 
 	@rm -f parse_quote$(EXEEXT)
 	$(LINK) $(parse_quote_OBJECTS) $(parse_quote_LDADD) $(LIBS)
-parse_quote_mismatch$(EXEEXT): $(parse_quote_mismatch_OBJECTS) $(parse_quote_mismatch_DEPENDENCIES) 
+parse_quote_mismatch$(EXEEXT): $(parse_quote_mismatch_OBJECTS) $(parse_quote_mismatch_DEPENDENCIES) $(EXTRA_parse_quote_mismatch_DEPENDENCIES) 
 	@rm -f parse_quote_mismatch$(EXEEXT)
 	$(LINK) $(parse_quote_mismatch_OBJECTS) $(parse_quote_mismatch_LDADD) $(LIBS)
-parse_raw$(EXEEXT): $(parse_raw_OBJECTS) $(parse_raw_DEPENDENCIES) 
+parse_raw$(EXEEXT): $(parse_raw_OBJECTS) $(parse_raw_DEPENDENCIES) $(EXTRA_parse_raw_DEPENDENCIES) 
 	@rm -f parse_raw$(EXEEXT)
 	$(LINK) $(parse_raw_OBJECTS) $(parse_raw_LDADD) $(LIBS)
-parse_raw_char$(EXEEXT): $(parse_raw_char_OBJECTS) $(parse_raw_char_DEPENDENCIES) 
+parse_raw_char$(EXEEXT): $(parse_raw_char_OBJECTS) $(parse_raw_char_DEPENDENCIES) $(EXTRA_parse_raw_char_DEPENDENCIES) 
 	@rm -f parse_raw_char$(EXEEXT)
 	$(LINK) $(parse_raw_char_OBJECTS) $(parse_raw_char_LDADD) $(LIBS)
-parse_raw_ncols$(EXEEXT): $(parse_raw_ncols_OBJECTS) $(parse_raw_ncols_DEPENDENCIES) 
+parse_raw_ncols$(EXEEXT): $(parse_raw_ncols_OBJECTS) $(parse_raw_ncols_DEPENDENCIES) $(EXTRA_parse_raw_ncols_DEPENDENCIES) 
 	@rm -f parse_raw_ncols$(EXEEXT)
 	$(LINK) $(parse_raw_ncols_OBJECTS) $(parse_raw_ncols_LDADD) $(LIBS)
-parse_raw_scalar$(EXEEXT): $(parse_raw_scalar_OBJECTS) $(parse_raw_scalar_DEPENDENCIES) 
+parse_raw_scalar$(EXEEXT): $(parse_raw_scalar_OBJECTS) $(parse_raw_scalar_DEPENDENCIES) $(EXTRA_parse_raw_scalar_DEPENDENCIES) 
 	@rm -f parse_raw_scalar$(EXEEXT)
 	$(LINK) $(parse_raw_scalar_OBJECTS) $(parse_raw_scalar_LDADD) $(LIBS)
-parse_raw_spf$(EXEEXT): $(parse_raw_spf_OBJECTS) $(parse_raw_spf_DEPENDENCIES) 
+parse_raw_spf$(EXEEXT): $(parse_raw_spf_OBJECTS) $(parse_raw_spf_DEPENDENCIES) $(EXTRA_parse_raw_spf_DEPENDENCIES) 
 	@rm -f parse_raw_spf$(EXEEXT)
 	$(LINK) $(parse_raw_spf_OBJECTS) $(parse_raw_spf_LDADD) $(LIBS)
-parse_raw_type$(EXEEXT): $(parse_raw_type_OBJECTS) $(parse_raw_type_DEPENDENCIES) 
+parse_raw_type$(EXEEXT): $(parse_raw_type_OBJECTS) $(parse_raw_type_DEPENDENCIES) $(EXTRA_parse_raw_type_DEPENDENCIES) 
 	@rm -f parse_raw_type$(EXEEXT)
 	$(LINK) $(parse_raw_type_OBJECTS) $(parse_raw_type_LDADD) $(LIBS)
-parse_recip$(EXEEXT): $(parse_recip_OBJECTS) $(parse_recip_DEPENDENCIES) 
+parse_recip$(EXEEXT): $(parse_recip_OBJECTS) $(parse_recip_DEPENDENCIES) $(EXTRA_parse_recip_DEPENDENCIES) 
 	@rm -f parse_recip$(EXEEXT)
 	$(LINK) $(parse_recip_OBJECTS) $(parse_recip_LDADD) $(LIBS)
-parse_ref$(EXEEXT): $(parse_ref_OBJECTS) $(parse_ref_DEPENDENCIES) 
+parse_ref$(EXEEXT): $(parse_ref_OBJECTS) $(parse_ref_DEPENDENCIES) $(EXTRA_parse_ref_DEPENDENCIES) 
 	@rm -f parse_ref$(EXEEXT)
 	$(LINK) $(parse_ref_OBJECTS) $(parse_ref_LDADD) $(LIBS)
-parse_ref_nonexistent$(EXEEXT): $(parse_ref_nonexistent_OBJECTS) $(parse_ref_nonexistent_DEPENDENCIES) 
+parse_ref_nonexistent$(EXEEXT): $(parse_ref_nonexistent_OBJECTS) $(parse_ref_nonexistent_DEPENDENCIES) $(EXTRA_parse_ref_nonexistent_DEPENDENCIES) 
 	@rm -f parse_ref_nonexistent$(EXEEXT)
 	$(LINK) $(parse_ref_nonexistent_OBJECTS) $(parse_ref_nonexistent_LDADD) $(LIBS)
-parse_sbit$(EXEEXT): $(parse_sbit_OBJECTS) $(parse_sbit_DEPENDENCIES) 
+parse_sbit$(EXEEXT): $(parse_sbit_OBJECTS) $(parse_sbit_DEPENDENCIES) $(EXTRA_parse_sbit_DEPENDENCIES) 
 	@rm -f parse_sbit$(EXEEXT)
 	$(LINK) $(parse_sbit_OBJECTS) $(parse_sbit_LDADD) $(LIBS)
-parse_sort$(EXEEXT): $(parse_sort_OBJECTS) $(parse_sort_DEPENDENCIES) 
+parse_sort$(EXEEXT): $(parse_sort_OBJECTS) $(parse_sort_DEPENDENCIES) $(EXTRA_parse_sort_DEPENDENCIES) 
 	@rm -f parse_sort$(EXEEXT)
 	$(LINK) $(parse_sort_OBJECTS) $(parse_sort_LDADD) $(LIBS)
-parse_string$(EXEEXT): $(parse_string_OBJECTS) $(parse_string_DEPENDENCIES) 
+parse_string$(EXEEXT): $(parse_string_OBJECTS) $(parse_string_DEPENDENCIES) $(EXTRA_parse_string_DEPENDENCIES) 
 	@rm -f parse_string$(EXEEXT)
 	$(LINK) $(parse_string_OBJECTS) $(parse_string_LDADD) $(LIBS)
-parse_string_ncols$(EXEEXT): $(parse_string_ncols_OBJECTS) $(parse_string_ncols_DEPENDENCIES) 
+parse_string_ncols$(EXEEXT): $(parse_string_ncols_OBJECTS) $(parse_string_ncols_DEPENDENCIES) $(EXTRA_parse_string_ncols_DEPENDENCIES) 
 	@rm -f parse_string_ncols$(EXEEXT)
 	$(LINK) $(parse_string_ncols_OBJECTS) $(parse_string_ncols_LDADD) $(LIBS)
-parse_string_null$(EXEEXT): $(parse_string_null_OBJECTS) $(parse_string_null_DEPENDENCIES) 
+parse_string_null$(EXEEXT): $(parse_string_null_OBJECTS) $(parse_string_null_DEPENDENCIES) $(EXTRA_parse_string_null_DEPENDENCIES) 
 	@rm -f parse_string_null$(EXEEXT)
 	$(LINK) $(parse_string_null_OBJECTS) $(parse_string_null_LDADD) $(LIBS)
-parse_version$(EXEEXT): $(parse_version_OBJECTS) $(parse_version_DEPENDENCIES) 
+parse_version$(EXEEXT): $(parse_version_OBJECTS) $(parse_version_DEPENDENCIES) $(EXTRA_parse_version_DEPENDENCIES) 
 	@rm -f parse_version$(EXEEXT)
 	$(LINK) $(parse_version_OBJECTS) $(parse_version_LDADD) $(LIBS)
-parse_version_include$(EXEEXT): $(parse_version_include_OBJECTS) $(parse_version_include_DEPENDENCIES) 
+parse_version_89$(EXEEXT): $(parse_version_89_OBJECTS) $(parse_version_89_DEPENDENCIES) $(EXTRA_parse_version_89_DEPENDENCIES) 
+	@rm -f parse_version_89$(EXEEXT)
+	$(LINK) $(parse_version_89_OBJECTS) $(parse_version_89_LDADD) $(LIBS)
+parse_version_98$(EXEEXT): $(parse_version_98_OBJECTS) $(parse_version_98_DEPENDENCIES) $(EXTRA_parse_version_98_DEPENDENCIES) 
+	@rm -f parse_version_98$(EXEEXT)
+	$(LINK) $(parse_version_98_OBJECTS) $(parse_version_98_LDADD) $(LIBS)
+parse_version_include$(EXEEXT): $(parse_version_include_OBJECTS) $(parse_version_include_DEPENDENCIES) $(EXTRA_parse_version_include_DEPENDENCIES) 
 	@rm -f parse_version_include$(EXEEXT)
 	$(LINK) $(parse_version_include_OBJECTS) $(parse_version_include_LDADD) $(LIBS)
-parse_version_permissive$(EXEEXT): $(parse_version_permissive_OBJECTS) $(parse_version_permissive_DEPENDENCIES) 
+parse_version_p8$(EXEEXT): $(parse_version_p8_OBJECTS) $(parse_version_p8_DEPENDENCIES) $(EXTRA_parse_version_p8_DEPENDENCIES) 
+	@rm -f parse_version_p8$(EXEEXT)
+	$(LINK) $(parse_version_p8_OBJECTS) $(parse_version_p8_LDADD) $(LIBS)
+parse_version_p9$(EXEEXT): $(parse_version_p9_OBJECTS) $(parse_version_p9_DEPENDENCIES) $(EXTRA_parse_version_p9_DEPENDENCIES) 
+	@rm -f parse_version_p9$(EXEEXT)
+	$(LINK) $(parse_version_p9_OBJECTS) $(parse_version_p9_LDADD) $(LIBS)
+parse_version_permissive$(EXEEXT): $(parse_version_permissive_OBJECTS) $(parse_version_permissive_DEPENDENCIES) $(EXTRA_parse_version_permissive_DEPENDENCIES) 
 	@rm -f parse_version_permissive$(EXEEXT)
 	$(LINK) $(parse_version_permissive_OBJECTS) $(parse_version_permissive_LDADD) $(LIBS)
-parse_version_slash$(EXEEXT): $(parse_version_slash_OBJECTS) $(parse_version_slash_DEPENDENCIES) 
+parse_version_slash$(EXEEXT): $(parse_version_slash_OBJECTS) $(parse_version_slash_DEPENDENCIES) $(EXTRA_parse_version_slash_DEPENDENCIES) 
 	@rm -f parse_version_slash$(EXEEXT)
 	$(LINK) $(parse_version_slash_OBJECTS) $(parse_version_slash_LDADD) $(LIBS)
-parse_whitespace$(EXEEXT): $(parse_whitespace_OBJECTS) $(parse_whitespace_DEPENDENCIES) 
+parse_whitespace$(EXEEXT): $(parse_whitespace_OBJECTS) $(parse_whitespace_DEPENDENCIES) $(EXTRA_parse_whitespace_DEPENDENCIES) 
 	@rm -f parse_whitespace$(EXEEXT)
 	$(LINK) $(parse_whitespace_OBJECTS) $(parse_whitespace_LDADD) $(LIBS)
-protect_alter$(EXEEXT): $(protect_alter_OBJECTS) $(protect_alter_DEPENDENCIES) 
+parse_window$(EXEEXT): $(parse_window_OBJECTS) $(parse_window_DEPENDENCIES) $(EXTRA_parse_window_DEPENDENCIES) 
+	@rm -f parse_window$(EXEEXT)
+	$(LINK) $(parse_window_OBJECTS) $(parse_window_LDADD) $(LIBS)
+parse_window_ncols$(EXEEXT): $(parse_window_ncols_OBJECTS) $(parse_window_ncols_DEPENDENCIES) $(EXTRA_parse_window_ncols_DEPENDENCIES) 
+	@rm -f parse_window_ncols$(EXEEXT)
+	$(LINK) $(parse_window_ncols_OBJECTS) $(parse_window_ncols_LDADD) $(LIBS)
+parse_window_op$(EXEEXT): $(parse_window_op_OBJECTS) $(parse_window_op_DEPENDENCIES) $(EXTRA_parse_window_op_DEPENDENCIES) 
+	@rm -f parse_window_op$(EXEEXT)
+	$(LINK) $(parse_window_op_OBJECTS) $(parse_window_op_LDADD) $(LIBS)
+parse_window_scalar$(EXEEXT): $(parse_window_scalar_OBJECTS) $(parse_window_scalar_DEPENDENCIES) $(EXTRA_parse_window_scalar_DEPENDENCIES) 
+	@rm -f parse_window_scalar$(EXEEXT)
+	$(LINK) $(parse_window_scalar_OBJECTS) $(parse_window_scalar_LDADD) $(LIBS)
+protect_alter$(EXEEXT): $(protect_alter_OBJECTS) $(protect_alter_DEPENDENCIES) $(EXTRA_protect_alter_DEPENDENCIES) 
 	@rm -f protect_alter$(EXEEXT)
 	$(LINK) $(protect_alter_OBJECTS) $(protect_alter_LDADD) $(LIBS)
-protect_get$(EXEEXT): $(protect_get_OBJECTS) $(protect_get_DEPENDENCIES) 
+protect_get$(EXEEXT): $(protect_get_OBJECTS) $(protect_get_DEPENDENCIES) $(EXTRA_protect_get_DEPENDENCIES) 
 	@rm -f protect_get$(EXEEXT)
 	$(LINK) $(protect_get_OBJECTS) $(protect_get_LDADD) $(LIBS)
-put64$(EXEEXT): $(put64_OBJECTS) $(put64_DEPENDENCIES) 
+put64$(EXEEXT): $(put64_OBJECTS) $(put64_DEPENDENCIES) $(EXTRA_put64_DEPENDENCIES) 
 	@rm -f put64$(EXEEXT)
 	$(LINK) $(put64_OBJECTS) $(put64_LDADD) $(LIBS)
-put_bad_code$(EXEEXT): $(put_bad_code_OBJECTS) $(put_bad_code_DEPENDENCIES) 
+put_bad_code$(EXEEXT): $(put_bad_code_OBJECTS) $(put_bad_code_DEPENDENCIES) $(EXTRA_put_bad_code_DEPENDENCIES) 
 	@rm -f put_bad_code$(EXEEXT)
 	$(LINK) $(put_bad_code_OBJECTS) $(put_bad_code_LDADD) $(LIBS)
-put_bit$(EXEEXT): $(put_bit_OBJECTS) $(put_bit_DEPENDENCIES) 
+put_bit$(EXEEXT): $(put_bit_OBJECTS) $(put_bit_DEPENDENCIES) $(EXTRA_put_bit_DEPENDENCIES) 
 	@rm -f put_bit$(EXEEXT)
 	$(LINK) $(put_bit_OBJECTS) $(put_bit_LDADD) $(LIBS)
-put_bof$(EXEEXT): $(put_bof_OBJECTS) $(put_bof_DEPENDENCIES) 
+put_bof$(EXEEXT): $(put_bof_OBJECTS) $(put_bof_DEPENDENCIES) $(EXTRA_put_bof_DEPENDENCIES) 
 	@rm -f put_bof$(EXEEXT)
 	$(LINK) $(put_bof_OBJECTS) $(put_bof_LDADD) $(LIBS)
-put_carray$(EXEEXT): $(put_carray_OBJECTS) $(put_carray_DEPENDENCIES) 
+put_carray$(EXEEXT): $(put_carray_OBJECTS) $(put_carray_DEPENDENCIES) $(EXTRA_put_carray_DEPENDENCIES) 
 	@rm -f put_carray$(EXEEXT)
 	$(LINK) $(put_carray_OBJECTS) $(put_carray_LDADD) $(LIBS)
-put_carray_slice$(EXEEXT): $(put_carray_slice_OBJECTS) $(put_carray_slice_DEPENDENCIES) 
+put_carray_slice$(EXEEXT): $(put_carray_slice_OBJECTS) $(put_carray_slice_DEPENDENCIES) $(EXTRA_put_carray_slice_DEPENDENCIES) 
 	@rm -f put_carray_slice$(EXEEXT)
 	$(LINK) $(put_carray_slice_OBJECTS) $(put_carray_slice_LDADD) $(LIBS)
-put_char$(EXEEXT): $(put_char_OBJECTS) $(put_char_DEPENDENCIES) 
+put_char$(EXEEXT): $(put_char_OBJECTS) $(put_char_DEPENDENCIES) $(EXTRA_put_char_DEPENDENCIES) 
 	@rm -f put_char$(EXEEXT)
 	$(LINK) $(put_char_OBJECTS) $(put_char_LDADD) $(LIBS)
-put_complex128$(EXEEXT): $(put_complex128_OBJECTS) $(put_complex128_DEPENDENCIES) 
+put_complex128$(EXEEXT): $(put_complex128_OBJECTS) $(put_complex128_DEPENDENCIES) $(EXTRA_put_complex128_DEPENDENCIES) 
 	@rm -f put_complex128$(EXEEXT)
 	$(LINK) $(put_complex128_OBJECTS) $(put_complex128_LDADD) $(LIBS)
-put_complex64$(EXEEXT): $(put_complex64_OBJECTS) $(put_complex64_DEPENDENCIES) 
+put_complex64$(EXEEXT): $(put_complex64_OBJECTS) $(put_complex64_DEPENDENCIES) $(EXTRA_put_complex64_DEPENDENCIES) 
 	@rm -f put_complex64$(EXEEXT)
 	$(LINK) $(put_complex64_OBJECTS) $(put_complex64_LDADD) $(LIBS)
-put_const$(EXEEXT): $(put_const_OBJECTS) $(put_const_DEPENDENCIES) 
+put_const$(EXEEXT): $(put_const_OBJECTS) $(put_const_DEPENDENCIES) $(EXTRA_put_const_DEPENDENCIES) 
 	@rm -f put_const$(EXEEXT)
 	$(LINK) $(put_const_OBJECTS) $(put_const_LDADD) $(LIBS)
-put_const_protect$(EXEEXT): $(put_const_protect_OBJECTS) $(put_const_protect_DEPENDENCIES) 
+put_const_protect$(EXEEXT): $(put_const_protect_OBJECTS) $(put_const_protect_DEPENDENCIES) $(EXTRA_put_const_protect_DEPENDENCIES) 
 	@rm -f put_const_protect$(EXEEXT)
 	$(LINK) $(put_const_protect_OBJECTS) $(put_const_protect_LDADD) $(LIBS)
-put_divide$(EXEEXT): $(put_divide_OBJECTS) $(put_divide_DEPENDENCIES) 
+put_divide$(EXEEXT): $(put_divide_OBJECTS) $(put_divide_DEPENDENCIES) $(EXTRA_put_divide_DEPENDENCIES) 
 	@rm -f put_divide$(EXEEXT)
 	$(LINK) $(put_divide_OBJECTS) $(put_divide_LDADD) $(LIBS)
-put_endian16$(EXEEXT): $(put_endian16_OBJECTS) $(put_endian16_DEPENDENCIES) 
+put_endian16$(EXEEXT): $(put_endian16_OBJECTS) $(put_endian16_DEPENDENCIES) $(EXTRA_put_endian16_DEPENDENCIES) 
 	@rm -f put_endian16$(EXEEXT)
 	$(LINK) $(put_endian16_OBJECTS) $(put_endian16_LDADD) $(LIBS)
-put_endian32$(EXEEXT): $(put_endian32_OBJECTS) $(put_endian32_DEPENDENCIES) 
+put_endian32$(EXEEXT): $(put_endian32_OBJECTS) $(put_endian32_DEPENDENCIES) $(EXTRA_put_endian32_DEPENDENCIES) 
 	@rm -f put_endian32$(EXEEXT)
 	$(LINK) $(put_endian32_OBJECTS) $(put_endian32_LDADD) $(LIBS)
-put_endian64$(EXEEXT): $(put_endian64_OBJECTS) $(put_endian64_DEPENDENCIES) 
+put_endian64$(EXEEXT): $(put_endian64_OBJECTS) $(put_endian64_DEPENDENCIES) $(EXTRA_put_endian64_DEPENDENCIES) 
 	@rm -f put_endian64$(EXEEXT)
 	$(LINK) $(put_endian64_OBJECTS) $(put_endian64_LDADD) $(LIBS)
-put_endian8$(EXEEXT): $(put_endian8_OBJECTS) $(put_endian8_DEPENDENCIES) 
+put_endian8$(EXEEXT): $(put_endian8_OBJECTS) $(put_endian8_DEPENDENCIES) $(EXTRA_put_endian8_DEPENDENCIES) 
 	@rm -f put_endian8$(EXEEXT)
 	$(LINK) $(put_endian8_OBJECTS) $(put_endian8_LDADD) $(LIBS)
-put_endian_complex128_arm$(EXEEXT): $(put_endian_complex128_arm_OBJECTS) $(put_endian_complex128_arm_DEPENDENCIES) 
+put_endian_complex128_arm$(EXEEXT): $(put_endian_complex128_arm_OBJECTS) $(put_endian_complex128_arm_DEPENDENCIES) $(EXTRA_put_endian_complex128_arm_DEPENDENCIES) 
 	@rm -f put_endian_complex128_arm$(EXEEXT)
 	$(LINK) $(put_endian_complex128_arm_OBJECTS) $(put_endian_complex128_arm_LDADD) $(LIBS)
-put_endian_complex128_big$(EXEEXT): $(put_endian_complex128_big_OBJECTS) $(put_endian_complex128_big_DEPENDENCIES) 
+put_endian_complex128_big$(EXEEXT): $(put_endian_complex128_big_OBJECTS) $(put_endian_complex128_big_DEPENDENCIES) $(EXTRA_put_endian_complex128_big_DEPENDENCIES) 
 	@rm -f put_endian_complex128_big$(EXEEXT)
 	$(LINK) $(put_endian_complex128_big_OBJECTS) $(put_endian_complex128_big_LDADD) $(LIBS)
-put_endian_complex128_little$(EXEEXT): $(put_endian_complex128_little_OBJECTS) $(put_endian_complex128_little_DEPENDENCIES) 
+put_endian_complex128_little$(EXEEXT): $(put_endian_complex128_little_OBJECTS) $(put_endian_complex128_little_DEPENDENCIES) $(EXTRA_put_endian_complex128_little_DEPENDENCIES) 
 	@rm -f put_endian_complex128_little$(EXEEXT)
 	$(LINK) $(put_endian_complex128_little_OBJECTS) $(put_endian_complex128_little_LDADD) $(LIBS)
-put_endian_complex64_arm$(EXEEXT): $(put_endian_complex64_arm_OBJECTS) $(put_endian_complex64_arm_DEPENDENCIES) 
+put_endian_complex64_arm$(EXEEXT): $(put_endian_complex64_arm_OBJECTS) $(put_endian_complex64_arm_DEPENDENCIES) $(EXTRA_put_endian_complex64_arm_DEPENDENCIES) 
 	@rm -f put_endian_complex64_arm$(EXEEXT)
 	$(LINK) $(put_endian_complex64_arm_OBJECTS) $(put_endian_complex64_arm_LDADD) $(LIBS)
-put_endian_complex64_big$(EXEEXT): $(put_endian_complex64_big_OBJECTS) $(put_endian_complex64_big_DEPENDENCIES) 
+put_endian_complex64_big$(EXEEXT): $(put_endian_complex64_big_OBJECTS) $(put_endian_complex64_big_DEPENDENCIES) $(EXTRA_put_endian_complex64_big_DEPENDENCIES) 
 	@rm -f put_endian_complex64_big$(EXEEXT)
 	$(LINK) $(put_endian_complex64_big_OBJECTS) $(put_endian_complex64_big_LDADD) $(LIBS)
-put_endian_complex64_little$(EXEEXT): $(put_endian_complex64_little_OBJECTS) $(put_endian_complex64_little_DEPENDENCIES) 
+put_endian_complex64_little$(EXEEXT): $(put_endian_complex64_little_OBJECTS) $(put_endian_complex64_little_DEPENDENCIES) $(EXTRA_put_endian_complex64_little_DEPENDENCIES) 
 	@rm -f put_endian_complex64_little$(EXEEXT)
 	$(LINK) $(put_endian_complex64_little_OBJECTS) $(put_endian_complex64_little_LDADD) $(LIBS)
-put_endian_float32_arm$(EXEEXT): $(put_endian_float32_arm_OBJECTS) $(put_endian_float32_arm_DEPENDENCIES) 
+put_endian_float32_arm$(EXEEXT): $(put_endian_float32_arm_OBJECTS) $(put_endian_float32_arm_DEPENDENCIES) $(EXTRA_put_endian_float32_arm_DEPENDENCIES) 
 	@rm -f put_endian_float32_arm$(EXEEXT)
 	$(LINK) $(put_endian_float32_arm_OBJECTS) $(put_endian_float32_arm_LDADD) $(LIBS)
-put_endian_float32_big$(EXEEXT): $(put_endian_float32_big_OBJECTS) $(put_endian_float32_big_DEPENDENCIES) 
+put_endian_float32_big$(EXEEXT): $(put_endian_float32_big_OBJECTS) $(put_endian_float32_big_DEPENDENCIES) $(EXTRA_put_endian_float32_big_DEPENDENCIES) 
 	@rm -f put_endian_float32_big$(EXEEXT)
 	$(LINK) $(put_endian_float32_big_OBJECTS) $(put_endian_float32_big_LDADD) $(LIBS)
-put_endian_float32_little$(EXEEXT): $(put_endian_float32_little_OBJECTS) $(put_endian_float32_little_DEPENDENCIES) 
+put_endian_float32_little$(EXEEXT): $(put_endian_float32_little_OBJECTS) $(put_endian_float32_little_DEPENDENCIES) $(EXTRA_put_endian_float32_little_DEPENDENCIES) 
 	@rm -f put_endian_float32_little$(EXEEXT)
 	$(LINK) $(put_endian_float32_little_OBJECTS) $(put_endian_float32_little_LDADD) $(LIBS)
-put_endian_float64_arm$(EXEEXT): $(put_endian_float64_arm_OBJECTS) $(put_endian_float64_arm_DEPENDENCIES) 
+put_endian_float64_arm$(EXEEXT): $(put_endian_float64_arm_OBJECTS) $(put_endian_float64_arm_DEPENDENCIES) $(EXTRA_put_endian_float64_arm_DEPENDENCIES) 
 	@rm -f put_endian_float64_arm$(EXEEXT)
 	$(LINK) $(put_endian_float64_arm_OBJECTS) $(put_endian_float64_arm_LDADD) $(LIBS)
-put_endian_float64_big$(EXEEXT): $(put_endian_float64_big_OBJECTS) $(put_endian_float64_big_DEPENDENCIES) 
+put_endian_float64_big$(EXEEXT): $(put_endian_float64_big_OBJECTS) $(put_endian_float64_big_DEPENDENCIES) $(EXTRA_put_endian_float64_big_DEPENDENCIES) 
 	@rm -f put_endian_float64_big$(EXEEXT)
 	$(LINK) $(put_endian_float64_big_OBJECTS) $(put_endian_float64_big_LDADD) $(LIBS)
-put_endian_float64_little$(EXEEXT): $(put_endian_float64_little_OBJECTS) $(put_endian_float64_little_DEPENDENCIES) 
+put_endian_float64_little$(EXEEXT): $(put_endian_float64_little_OBJECTS) $(put_endian_float64_little_DEPENDENCIES) $(EXTRA_put_endian_float64_little_DEPENDENCIES) 
 	@rm -f put_endian_float64_little$(EXEEXT)
 	$(LINK) $(put_endian_float64_little_OBJECTS) $(put_endian_float64_little_LDADD) $(LIBS)
-put_ff$(EXEEXT): $(put_ff_OBJECTS) $(put_ff_DEPENDENCIES) 
+put_ff$(EXEEXT): $(put_ff_OBJECTS) $(put_ff_DEPENDENCIES) $(EXTRA_put_ff_DEPENDENCIES) 
 	@rm -f put_ff$(EXEEXT)
 	$(LINK) $(put_ff_OBJECTS) $(put_ff_LDADD) $(LIBS)
-put_float32$(EXEEXT): $(put_float32_OBJECTS) $(put_float32_DEPENDENCIES) 
+put_float32$(EXEEXT): $(put_float32_OBJECTS) $(put_float32_DEPENDENCIES) $(EXTRA_put_float32_DEPENDENCIES) 
 	@rm -f put_float32$(EXEEXT)
 	$(LINK) $(put_float32_OBJECTS) $(put_float32_LDADD) $(LIBS)
-put_float64$(EXEEXT): $(put_float64_OBJECTS) $(put_float64_DEPENDENCIES) 
+put_float64$(EXEEXT): $(put_float64_OBJECTS) $(put_float64_DEPENDENCIES) $(EXTRA_put_float64_DEPENDENCIES) 
 	@rm -f put_float64$(EXEEXT)
 	$(LINK) $(put_float64_OBJECTS) $(put_float64_LDADD) $(LIBS)
-put_foffs$(EXEEXT): $(put_foffs_OBJECTS) $(put_foffs_DEPENDENCIES) 
+put_foffs$(EXEEXT): $(put_foffs_OBJECTS) $(put_foffs_DEPENDENCIES) $(EXTRA_put_foffs_DEPENDENCIES) 
 	@rm -f put_foffs$(EXEEXT)
 	$(LINK) $(put_foffs_OBJECTS) $(put_foffs_LDADD) $(LIBS)
-put_fs$(EXEEXT): $(put_fs_OBJECTS) $(put_fs_DEPENDENCIES) 
+put_fs$(EXEEXT): $(put_fs_OBJECTS) $(put_fs_DEPENDENCIES) $(EXTRA_put_fs_DEPENDENCIES) 
 	@rm -f put_fs$(EXEEXT)
 	$(LINK) $(put_fs_OBJECTS) $(put_fs_LDADD) $(LIBS)
-put_int16$(EXEEXT): $(put_int16_OBJECTS) $(put_int16_DEPENDENCIES) 
+put_here$(EXEEXT): $(put_here_OBJECTS) $(put_here_DEPENDENCIES) $(EXTRA_put_here_DEPENDENCIES) 
+	@rm -f put_here$(EXEEXT)
+	$(LINK) $(put_here_OBJECTS) $(put_here_LDADD) $(LIBS)
+put_heres$(EXEEXT): $(put_heres_OBJECTS) $(put_heres_DEPENDENCIES) $(EXTRA_put_heres_DEPENDENCIES) 
+	@rm -f put_heres$(EXEEXT)
+	$(LINK) $(put_heres_OBJECTS) $(put_heres_LDADD) $(LIBS)
+put_int16$(EXEEXT): $(put_int16_OBJECTS) $(put_int16_DEPENDENCIES) $(EXTRA_put_int16_DEPENDENCIES) 
 	@rm -f put_int16$(EXEEXT)
 	$(LINK) $(put_int16_OBJECTS) $(put_int16_LDADD) $(LIBS)
-put_int32$(EXEEXT): $(put_int32_OBJECTS) $(put_int32_DEPENDENCIES) 
+put_int32$(EXEEXT): $(put_int32_OBJECTS) $(put_int32_DEPENDENCIES) $(EXTRA_put_int32_DEPENDENCIES) 
 	@rm -f put_int32$(EXEEXT)
 	$(LINK) $(put_int32_OBJECTS) $(put_int32_LDADD) $(LIBS)
-put_int64$(EXEEXT): $(put_int64_OBJECTS) $(put_int64_DEPENDENCIES) 
+put_int64$(EXEEXT): $(put_int64_OBJECTS) $(put_int64_DEPENDENCIES) $(EXTRA_put_int64_DEPENDENCIES) 
 	@rm -f put_int64$(EXEEXT)
 	$(LINK) $(put_int64_OBJECTS) $(put_int64_LDADD) $(LIBS)
-put_int8$(EXEEXT): $(put_int8_OBJECTS) $(put_int8_DEPENDENCIES) 
+put_int8$(EXEEXT): $(put_int8_OBJECTS) $(put_int8_DEPENDENCIES) $(EXTRA_put_int8_DEPENDENCIES) 
 	@rm -f put_int8$(EXEEXT)
 	$(LINK) $(put_int8_OBJECTS) $(put_int8_LDADD) $(LIBS)
-put_invalid$(EXEEXT): $(put_invalid_OBJECTS) $(put_invalid_DEPENDENCIES) 
+put_invalid$(EXEEXT): $(put_invalid_OBJECTS) $(put_invalid_DEPENDENCIES) $(EXTRA_put_invalid_DEPENDENCIES) 
 	@rm -f put_invalid$(EXEEXT)
 	$(LINK) $(put_invalid_OBJECTS) $(put_invalid_LDADD) $(LIBS)
-put_lincom1$(EXEEXT): $(put_lincom1_OBJECTS) $(put_lincom1_DEPENDENCIES) 
+put_lincom1$(EXEEXT): $(put_lincom1_OBJECTS) $(put_lincom1_DEPENDENCIES) $(EXTRA_put_lincom1_DEPENDENCIES) 
 	@rm -f put_lincom1$(EXEEXT)
 	$(LINK) $(put_lincom1_OBJECTS) $(put_lincom1_LDADD) $(LIBS)
-put_lincom2$(EXEEXT): $(put_lincom2_OBJECTS) $(put_lincom2_DEPENDENCIES) 
+put_lincom2$(EXEEXT): $(put_lincom2_OBJECTS) $(put_lincom2_DEPENDENCIES) $(EXTRA_put_lincom2_DEPENDENCIES) 
 	@rm -f put_lincom2$(EXEEXT)
 	$(LINK) $(put_lincom2_OBJECTS) $(put_lincom2_LDADD) $(LIBS)
-put_lincom_noin$(EXEEXT): $(put_lincom_noin_OBJECTS) $(put_lincom_noin_DEPENDENCIES) 
+put_lincom_noin$(EXEEXT): $(put_lincom_noin_OBJECTS) $(put_lincom_noin_DEPENDENCIES) $(EXTRA_put_lincom_noin_DEPENDENCIES) 
 	@rm -f put_lincom_noin$(EXEEXT)
 	$(LINK) $(put_lincom_noin_OBJECTS) $(put_lincom_noin_LDADD) $(LIBS)
-put_linterp$(EXEEXT): $(put_linterp_OBJECTS) $(put_linterp_DEPENDENCIES) 
+put_linterp$(EXEEXT): $(put_linterp_OBJECTS) $(put_linterp_DEPENDENCIES) $(EXTRA_put_linterp_DEPENDENCIES) 
 	@rm -f put_linterp$(EXEEXT)
 	$(LINK) $(put_linterp_OBJECTS) $(put_linterp_LDADD) $(LIBS)
-put_linterp_noin$(EXEEXT): $(put_linterp_noin_OBJECTS) $(put_linterp_noin_DEPENDENCIES) 
+put_linterp_noin$(EXEEXT): $(put_linterp_noin_OBJECTS) $(put_linterp_noin_DEPENDENCIES) $(EXTRA_put_linterp_noin_DEPENDENCIES) 
 	@rm -f put_linterp_noin$(EXEEXT)
 	$(LINK) $(put_linterp_noin_OBJECTS) $(put_linterp_noin_LDADD) $(LIBS)
-put_linterp_nomono$(EXEEXT): $(put_linterp_nomono_OBJECTS) $(put_linterp_nomono_DEPENDENCIES) 
+put_linterp_nomono$(EXEEXT): $(put_linterp_nomono_OBJECTS) $(put_linterp_nomono_DEPENDENCIES) $(EXTRA_put_linterp_nomono_DEPENDENCIES) 
 	@rm -f put_linterp_nomono$(EXEEXT)
 	$(LINK) $(put_linterp_nomono_OBJECTS) $(put_linterp_nomono_LDADD) $(LIBS)
-put_linterp_notab$(EXEEXT): $(put_linterp_notab_OBJECTS) $(put_linterp_notab_DEPENDENCIES) 
+put_linterp_notab$(EXEEXT): $(put_linterp_notab_OBJECTS) $(put_linterp_notab_DEPENDENCIES) $(EXTRA_put_linterp_notab_DEPENDENCIES) 
 	@rm -f put_linterp_notab$(EXEEXT)
 	$(LINK) $(put_linterp_notab_OBJECTS) $(put_linterp_notab_LDADD) $(LIBS)
-put_linterp_reverse$(EXEEXT): $(put_linterp_reverse_OBJECTS) $(put_linterp_reverse_DEPENDENCIES) 
+put_linterp_reverse$(EXEEXT): $(put_linterp_reverse_OBJECTS) $(put_linterp_reverse_DEPENDENCIES) $(EXTRA_put_linterp_reverse_DEPENDENCIES) 
 	@rm -f put_linterp_reverse$(EXEEXT)
 	$(LINK) $(put_linterp_reverse_OBJECTS) $(put_linterp_reverse_LDADD) $(LIBS)
-put_multiply$(EXEEXT): $(put_multiply_OBJECTS) $(put_multiply_DEPENDENCIES) 
+put_mplex$(EXEEXT): $(put_mplex_OBJECTS) $(put_mplex_DEPENDENCIES) $(EXTRA_put_mplex_DEPENDENCIES) 
+	@rm -f put_mplex$(EXEEXT)
+	$(LINK) $(put_mplex_OBJECTS) $(put_mplex_LDADD) $(LIBS)
+put_multiply$(EXEEXT): $(put_multiply_OBJECTS) $(put_multiply_DEPENDENCIES) $(EXTRA_put_multiply_DEPENDENCIES) 
 	@rm -f put_multiply$(EXEEXT)
 	$(LINK) $(put_multiply_OBJECTS) $(put_multiply_LDADD) $(LIBS)
-put_null$(EXEEXT): $(put_null_OBJECTS) $(put_null_DEPENDENCIES) 
+put_null$(EXEEXT): $(put_null_OBJECTS) $(put_null_DEPENDENCIES) $(EXTRA_put_null_DEPENDENCIES) 
 	@rm -f put_null$(EXEEXT)
 	$(LINK) $(put_null_OBJECTS) $(put_null_LDADD) $(LIBS)
-put_off64$(EXEEXT): $(put_off64_OBJECTS) $(put_off64_DEPENDENCIES) 
+put_off64$(EXEEXT): $(put_off64_OBJECTS) $(put_off64_DEPENDENCIES) $(EXTRA_put_off64_DEPENDENCIES) 
 	@rm -f put_off64$(EXEEXT)
 	$(LINK) $(put_off64_OBJECTS) $(put_off64_LDADD) $(LIBS)
-put_phase$(EXEEXT): $(put_phase_OBJECTS) $(put_phase_DEPENDENCIES) 
+put_phase$(EXEEXT): $(put_phase_OBJECTS) $(put_phase_DEPENDENCIES) $(EXTRA_put_phase_DEPENDENCIES) 
 	@rm -f put_phase$(EXEEXT)
 	$(LINK) $(put_phase_OBJECTS) $(put_phase_LDADD) $(LIBS)
-put_phase_noin$(EXEEXT): $(put_phase_noin_OBJECTS) $(put_phase_noin_DEPENDENCIES) 
+put_phase_noin$(EXEEXT): $(put_phase_noin_OBJECTS) $(put_phase_noin_DEPENDENCIES) $(EXTRA_put_phase_noin_DEPENDENCIES) 
 	@rm -f put_phase_noin$(EXEEXT)
 	$(LINK) $(put_phase_noin_OBJECTS) $(put_phase_noin_LDADD) $(LIBS)
-put_polynom1$(EXEEXT): $(put_polynom1_OBJECTS) $(put_polynom1_DEPENDENCIES) 
+put_polynom1$(EXEEXT): $(put_polynom1_OBJECTS) $(put_polynom1_DEPENDENCIES) $(EXTRA_put_polynom1_DEPENDENCIES) 
 	@rm -f put_polynom1$(EXEEXT)
 	$(LINK) $(put_polynom1_OBJECTS) $(put_polynom1_LDADD) $(LIBS)
-put_polynom2$(EXEEXT): $(put_polynom2_OBJECTS) $(put_polynom2_DEPENDENCIES) 
+put_polynom2$(EXEEXT): $(put_polynom2_OBJECTS) $(put_polynom2_DEPENDENCIES) $(EXTRA_put_polynom2_DEPENDENCIES) 
 	@rm -f put_polynom2$(EXEEXT)
 	$(LINK) $(put_polynom2_OBJECTS) $(put_polynom2_LDADD) $(LIBS)
-put_polynom_noin$(EXEEXT): $(put_polynom_noin_OBJECTS) $(put_polynom_noin_DEPENDENCIES) 
+put_polynom_noin$(EXEEXT): $(put_polynom_noin_OBJECTS) $(put_polynom_noin_DEPENDENCIES) $(EXTRA_put_polynom_noin_DEPENDENCIES) 
 	@rm -f put_polynom_noin$(EXEEXT)
 	$(LINK) $(put_polynom_noin_OBJECTS) $(put_polynom_noin_LDADD) $(LIBS)
-put_protect$(EXEEXT): $(put_protect_OBJECTS) $(put_protect_DEPENDENCIES) 
+put_protect$(EXEEXT): $(put_protect_OBJECTS) $(put_protect_DEPENDENCIES) $(EXTRA_put_protect_DEPENDENCIES) 
 	@rm -f put_protect$(EXEEXT)
 	$(LINK) $(put_protect_OBJECTS) $(put_protect_LDADD) $(LIBS)
-put_rdonly$(EXEEXT): $(put_rdonly_OBJECTS) $(put_rdonly_DEPENDENCIES) 
+put_rdonly$(EXEEXT): $(put_rdonly_OBJECTS) $(put_rdonly_DEPENDENCIES) $(EXTRA_put_rdonly_DEPENDENCIES) 
 	@rm -f put_rdonly$(EXEEXT)
 	$(LINK) $(put_rdonly_OBJECTS) $(put_rdonly_LDADD) $(LIBS)
-put_recip$(EXEEXT): $(put_recip_OBJECTS) $(put_recip_DEPENDENCIES) 
+put_recip$(EXEEXT): $(put_recip_OBJECTS) $(put_recip_DEPENDENCIES) $(EXTRA_put_recip_DEPENDENCIES) 
 	@rm -f put_recip$(EXEEXT)
 	$(LINK) $(put_recip_OBJECTS) $(put_recip_LDADD) $(LIBS)
-put_recurse$(EXEEXT): $(put_recurse_OBJECTS) $(put_recurse_DEPENDENCIES) 
+put_recurse$(EXEEXT): $(put_recurse_OBJECTS) $(put_recurse_DEPENDENCIES) $(EXTRA_put_recurse_DEPENDENCIES) 
 	@rm -f put_recurse$(EXEEXT)
 	$(LINK) $(put_recurse_OBJECTS) $(put_recurse_LDADD) $(LIBS)
-put_repr$(EXEEXT): $(put_repr_OBJECTS) $(put_repr_DEPENDENCIES) 
+put_repr$(EXEEXT): $(put_repr_OBJECTS) $(put_repr_DEPENDENCIES) $(EXTRA_put_repr_DEPENDENCIES) 
 	@rm -f put_repr$(EXEEXT)
 	$(LINK) $(put_repr_OBJECTS) $(put_repr_LDADD) $(LIBS)
-put_rofs$(EXEEXT): $(put_rofs_OBJECTS) $(put_rofs_DEPENDENCIES) 
+put_rofs$(EXEEXT): $(put_rofs_OBJECTS) $(put_rofs_DEPENDENCIES) $(EXTRA_put_rofs_DEPENDENCIES) 
 	@rm -f put_rofs$(EXEEXT)
 	$(LINK) $(put_rofs_OBJECTS) $(put_rofs_LDADD) $(LIBS)
-put_sbit$(EXEEXT): $(put_sbit_OBJECTS) $(put_sbit_DEPENDENCIES) 
+put_sbit$(EXEEXT): $(put_sbit_OBJECTS) $(put_sbit_DEPENDENCIES) $(EXTRA_put_sbit_DEPENDENCIES) 
 	@rm -f put_sbit$(EXEEXT)
 	$(LINK) $(put_sbit_OBJECTS) $(put_sbit_LDADD) $(LIBS)
-put_sf$(EXEEXT): $(put_sf_OBJECTS) $(put_sf_DEPENDENCIES) 
+put_sf$(EXEEXT): $(put_sf_OBJECTS) $(put_sf_DEPENDENCIES) $(EXTRA_put_sf_DEPENDENCIES) 
 	@rm -f put_sf$(EXEEXT)
 	$(LINK) $(put_sf_OBJECTS) $(put_sf_LDADD) $(LIBS)
-put_ss$(EXEEXT): $(put_ss_OBJECTS) $(put_ss_DEPENDENCIES) 
+put_ss$(EXEEXT): $(put_ss_OBJECTS) $(put_ss_DEPENDENCIES) $(EXTRA_put_ss_DEPENDENCIES) 
 	@rm -f put_ss$(EXEEXT)
 	$(LINK) $(put_ss_OBJECTS) $(put_ss_LDADD) $(LIBS)
-put_string$(EXEEXT): $(put_string_OBJECTS) $(put_string_DEPENDENCIES) 
+put_string$(EXEEXT): $(put_string_OBJECTS) $(put_string_DEPENDENCIES) $(EXTRA_put_string_DEPENDENCIES) 
 	@rm -f put_string$(EXEEXT)
 	$(LINK) $(put_string_OBJECTS) $(put_string_LDADD) $(LIBS)
-put_string_protect$(EXEEXT): $(put_string_protect_OBJECTS) $(put_string_protect_DEPENDENCIES) 
+put_string_protect$(EXEEXT): $(put_string_protect_OBJECTS) $(put_string_protect_DEPENDENCIES) $(EXTRA_put_string_protect_DEPENDENCIES) 
 	@rm -f put_string_protect$(EXEEXT)
 	$(LINK) $(put_string_protect_OBJECTS) $(put_string_protect_LDADD) $(LIBS)
-put_type$(EXEEXT): $(put_type_OBJECTS) $(put_type_DEPENDENCIES) 
+put_type$(EXEEXT): $(put_type_OBJECTS) $(put_type_DEPENDENCIES) $(EXTRA_put_type_DEPENDENCIES) 
 	@rm -f put_type$(EXEEXT)
 	$(LINK) $(put_type_OBJECTS) $(put_type_LDADD) $(LIBS)
-put_uint16$(EXEEXT): $(put_uint16_OBJECTS) $(put_uint16_DEPENDENCIES) 
+put_uint16$(EXEEXT): $(put_uint16_OBJECTS) $(put_uint16_DEPENDENCIES) $(EXTRA_put_uint16_DEPENDENCIES) 
 	@rm -f put_uint16$(EXEEXT)
 	$(LINK) $(put_uint16_OBJECTS) $(put_uint16_LDADD) $(LIBS)
-put_uint32$(EXEEXT): $(put_uint32_OBJECTS) $(put_uint32_DEPENDENCIES) 
+put_uint32$(EXEEXT): $(put_uint32_OBJECTS) $(put_uint32_DEPENDENCIES) $(EXTRA_put_uint32_DEPENDENCIES) 
 	@rm -f put_uint32$(EXEEXT)
 	$(LINK) $(put_uint32_OBJECTS) $(put_uint32_LDADD) $(LIBS)
-put_uint64$(EXEEXT): $(put_uint64_OBJECTS) $(put_uint64_DEPENDENCIES) 
+put_uint64$(EXEEXT): $(put_uint64_OBJECTS) $(put_uint64_DEPENDENCIES) $(EXTRA_put_uint64_DEPENDENCIES) 
 	@rm -f put_uint64$(EXEEXT)
 	$(LINK) $(put_uint64_OBJECTS) $(put_uint64_LDADD) $(LIBS)
-ref$(EXEEXT): $(ref_OBJECTS) $(ref_DEPENDENCIES) 
+put_window$(EXEEXT): $(put_window_OBJECTS) $(put_window_DEPENDENCIES) $(EXTRA_put_window_DEPENDENCIES) 
+	@rm -f put_window$(EXEEXT)
+	$(LINK) $(put_window_OBJECTS) $(put_window_LDADD) $(LIBS)
+put_zero$(EXEEXT): $(put_zero_OBJECTS) $(put_zero_DEPENDENCIES) $(EXTRA_put_zero_DEPENDENCIES) 
+	@rm -f put_zero$(EXEEXT)
+	$(LINK) $(put_zero_OBJECTS) $(put_zero_LDADD) $(LIBS)
+ref$(EXEEXT): $(ref_OBJECTS) $(ref_DEPENDENCIES) $(EXTRA_ref_DEPENDENCIES) 
 	@rm -f ref$(EXEEXT)
 	$(LINK) $(ref_OBJECTS) $(ref_LDADD) $(LIBS)
-ref_none$(EXEEXT): $(ref_none_OBJECTS) $(ref_none_DEPENDENCIES) 
+ref_none$(EXEEXT): $(ref_none_OBJECTS) $(ref_none_DEPENDENCIES) $(EXTRA_ref_none_DEPENDENCIES) 
 	@rm -f ref_none$(EXEEXT)
 	$(LINK) $(ref_none_OBJECTS) $(ref_none_LDADD) $(LIBS)
-ref_two$(EXEEXT): $(ref_two_OBJECTS) $(ref_two_DEPENDENCIES) 
+ref_two$(EXEEXT): $(ref_two_OBJECTS) $(ref_two_DEPENDENCIES) $(EXTRA_ref_two_DEPENDENCIES) 
 	@rm -f ref_two$(EXEEXT)
 	$(LINK) $(ref_two_OBJECTS) $(ref_two_LDADD) $(LIBS)
-repr_a$(EXEEXT): $(repr_a_OBJECTS) $(repr_a_DEPENDENCIES) 
+repr_a$(EXEEXT): $(repr_a_OBJECTS) $(repr_a_DEPENDENCIES) $(EXTRA_repr_a_DEPENDENCIES) 
 	@rm -f repr_a$(EXEEXT)
 	$(LINK) $(repr_a_OBJECTS) $(repr_a_LDADD) $(LIBS)
-repr_float32$(EXEEXT): $(repr_float32_OBJECTS) $(repr_float32_DEPENDENCIES) 
+repr_float32$(EXEEXT): $(repr_float32_OBJECTS) $(repr_float32_DEPENDENCIES) $(EXTRA_repr_float32_DEPENDENCIES) 
 	@rm -f repr_float32$(EXEEXT)
 	$(LINK) $(repr_float32_OBJECTS) $(repr_float32_LDADD) $(LIBS)
-repr_float64$(EXEEXT): $(repr_float64_OBJECTS) $(repr_float64_DEPENDENCIES) 
+repr_float64$(EXEEXT): $(repr_float64_OBJECTS) $(repr_float64_DEPENDENCIES) $(EXTRA_repr_float64_DEPENDENCIES) 
 	@rm -f repr_float64$(EXEEXT)
 	$(LINK) $(repr_float64_OBJECTS) $(repr_float64_LDADD) $(LIBS)
-repr_i$(EXEEXT): $(repr_i_OBJECTS) $(repr_i_DEPENDENCIES) 
+repr_i$(EXEEXT): $(repr_i_OBJECTS) $(repr_i_DEPENDENCIES) $(EXTRA_repr_i_DEPENDENCIES) 
 	@rm -f repr_i$(EXEEXT)
 	$(LINK) $(repr_i_OBJECTS) $(repr_i_LDADD) $(LIBS)
-repr_int16$(EXEEXT): $(repr_int16_OBJECTS) $(repr_int16_DEPENDENCIES) 
+repr_int16$(EXEEXT): $(repr_int16_OBJECTS) $(repr_int16_DEPENDENCIES) $(EXTRA_repr_int16_DEPENDENCIES) 
 	@rm -f repr_int16$(EXEEXT)
 	$(LINK) $(repr_int16_OBJECTS) $(repr_int16_LDADD) $(LIBS)
-repr_int32$(EXEEXT): $(repr_int32_OBJECTS) $(repr_int32_DEPENDENCIES) 
+repr_int32$(EXEEXT): $(repr_int32_OBJECTS) $(repr_int32_DEPENDENCIES) $(EXTRA_repr_int32_DEPENDENCIES) 
 	@rm -f repr_int32$(EXEEXT)
 	$(LINK) $(repr_int32_OBJECTS) $(repr_int32_LDADD) $(LIBS)
-repr_int64$(EXEEXT): $(repr_int64_OBJECTS) $(repr_int64_DEPENDENCIES) 
+repr_int64$(EXEEXT): $(repr_int64_OBJECTS) $(repr_int64_DEPENDENCIES) $(EXTRA_repr_int64_DEPENDENCIES) 
 	@rm -f repr_int64$(EXEEXT)
 	$(LINK) $(repr_int64_OBJECTS) $(repr_int64_LDADD) $(LIBS)
-repr_int8$(EXEEXT): $(repr_int8_OBJECTS) $(repr_int8_DEPENDENCIES) 
+repr_int8$(EXEEXT): $(repr_int8_OBJECTS) $(repr_int8_DEPENDENCIES) $(EXTRA_repr_int8_DEPENDENCIES) 
 	@rm -f repr_int8$(EXEEXT)
 	$(LINK) $(repr_int8_OBJECTS) $(repr_int8_LDADD) $(LIBS)
-repr_m$(EXEEXT): $(repr_m_OBJECTS) $(repr_m_DEPENDENCIES) 
+repr_m$(EXEEXT): $(repr_m_OBJECTS) $(repr_m_DEPENDENCIES) $(EXTRA_repr_m_DEPENDENCIES) 
 	@rm -f repr_m$(EXEEXT)
 	$(LINK) $(repr_m_OBJECTS) $(repr_m_LDADD) $(LIBS)
-repr_r$(EXEEXT): $(repr_r_OBJECTS) $(repr_r_DEPENDENCIES) 
+repr_r$(EXEEXT): $(repr_r_OBJECTS) $(repr_r_DEPENDENCIES) $(EXTRA_repr_r_DEPENDENCIES) 
 	@rm -f repr_r$(EXEEXT)
 	$(LINK) $(repr_r_OBJECTS) $(repr_r_LDADD) $(LIBS)
-repr_real_a$(EXEEXT): $(repr_real_a_OBJECTS) $(repr_real_a_DEPENDENCIES) 
+repr_real_a$(EXEEXT): $(repr_real_a_OBJECTS) $(repr_real_a_DEPENDENCIES) $(EXTRA_repr_real_a_DEPENDENCIES) 
 	@rm -f repr_real_a$(EXEEXT)
 	$(LINK) $(repr_real_a_OBJECTS) $(repr_real_a_LDADD) $(LIBS)
-repr_real_i$(EXEEXT): $(repr_real_i_OBJECTS) $(repr_real_i_DEPENDENCIES) 
+repr_real_i$(EXEEXT): $(repr_real_i_OBJECTS) $(repr_real_i_DEPENDENCIES) $(EXTRA_repr_real_i_DEPENDENCIES) 
 	@rm -f repr_real_i$(EXEEXT)
 	$(LINK) $(repr_real_i_OBJECTS) $(repr_real_i_LDADD) $(LIBS)
-repr_real_m$(EXEEXT): $(repr_real_m_OBJECTS) $(repr_real_m_DEPENDENCIES) 
+repr_real_m$(EXEEXT): $(repr_real_m_OBJECTS) $(repr_real_m_DEPENDENCIES) $(EXTRA_repr_real_m_DEPENDENCIES) 
 	@rm -f repr_real_m$(EXEEXT)
 	$(LINK) $(repr_real_m_OBJECTS) $(repr_real_m_LDADD) $(LIBS)
-repr_real_r$(EXEEXT): $(repr_real_r_OBJECTS) $(repr_real_r_DEPENDENCIES) 
+repr_real_r$(EXEEXT): $(repr_real_r_OBJECTS) $(repr_real_r_DEPENDENCIES) $(EXTRA_repr_real_r_DEPENDENCIES) 
 	@rm -f repr_real_r$(EXEEXT)
 	$(LINK) $(repr_real_r_OBJECTS) $(repr_real_r_LDADD) $(LIBS)
-repr_uint16$(EXEEXT): $(repr_uint16_OBJECTS) $(repr_uint16_DEPENDENCIES) 
+repr_uint16$(EXEEXT): $(repr_uint16_OBJECTS) $(repr_uint16_DEPENDENCIES) $(EXTRA_repr_uint16_DEPENDENCIES) 
 	@rm -f repr_uint16$(EXEEXT)
 	$(LINK) $(repr_uint16_OBJECTS) $(repr_uint16_LDADD) $(LIBS)
-repr_uint32$(EXEEXT): $(repr_uint32_OBJECTS) $(repr_uint32_DEPENDENCIES) 
+repr_uint32$(EXEEXT): $(repr_uint32_OBJECTS) $(repr_uint32_DEPENDENCIES) $(EXTRA_repr_uint32_DEPENDENCIES) 
 	@rm -f repr_uint32$(EXEEXT)
 	$(LINK) $(repr_uint32_OBJECTS) $(repr_uint32_LDADD) $(LIBS)
-repr_uint64$(EXEEXT): $(repr_uint64_OBJECTS) $(repr_uint64_DEPENDENCIES) 
+repr_uint64$(EXEEXT): $(repr_uint64_OBJECTS) $(repr_uint64_DEPENDENCIES) $(EXTRA_repr_uint64_DEPENDENCIES) 
 	@rm -f repr_uint64$(EXEEXT)
 	$(LINK) $(repr_uint64_OBJECTS) $(repr_uint64_LDADD) $(LIBS)
-repr_uint8$(EXEEXT): $(repr_uint8_OBJECTS) $(repr_uint8_DEPENDENCIES) 
+repr_uint8$(EXEEXT): $(repr_uint8_OBJECTS) $(repr_uint8_DEPENDENCIES) $(EXTRA_repr_uint8_DEPENDENCIES) 
 	@rm -f repr_uint8$(EXEEXT)
 	$(LINK) $(repr_uint8_OBJECTS) $(repr_uint8_LDADD) $(LIBS)
-slim_get$(EXEEXT): $(slim_get_OBJECTS) $(slim_get_DEPENDENCIES) 
+seek64$(EXEEXT): $(seek64_OBJECTS) $(seek64_DEPENDENCIES) $(EXTRA_seek64_DEPENDENCIES) 
+	@rm -f seek64$(EXEEXT)
+	$(LINK) $(seek64_OBJECTS) $(seek64_LDADD) $(LIBS)
+seek_cur$(EXEEXT): $(seek_cur_OBJECTS) $(seek_cur_DEPENDENCIES) $(EXTRA_seek_cur_DEPENDENCIES) 
+	@rm -f seek_cur$(EXEEXT)
+	$(LINK) $(seek_cur_OBJECTS) $(seek_cur_LDADD) $(LIBS)
+seek_end$(EXEEXT): $(seek_end_OBJECTS) $(seek_end_DEPENDENCIES) $(EXTRA_seek_end_DEPENDENCIES) 
+	@rm -f seek_end$(EXEEXT)
+	$(LINK) $(seek_end_OBJECTS) $(seek_end_LDADD) $(LIBS)
+seek_foffs$(EXEEXT): $(seek_foffs_OBJECTS) $(seek_foffs_DEPENDENCIES) $(EXTRA_seek_foffs_DEPENDENCIES) 
+	@rm -f seek_foffs$(EXEEXT)
+	$(LINK) $(seek_foffs_OBJECTS) $(seek_foffs_LDADD) $(LIBS)
+seek_neg$(EXEEXT): $(seek_neg_OBJECTS) $(seek_neg_DEPENDENCIES) $(EXTRA_seek_neg_DEPENDENCIES) 
+	@rm -f seek_neg$(EXEEXT)
+	$(LINK) $(seek_neg_OBJECTS) $(seek_neg_LDADD) $(LIBS)
+seek_set$(EXEEXT): $(seek_set_OBJECTS) $(seek_set_DEPENDENCIES) $(EXTRA_seek_set_DEPENDENCIES) 
+	@rm -f seek_set$(EXEEXT)
+	$(LINK) $(seek_set_OBJECTS) $(seek_set_LDADD) $(LIBS)
+sie_get_big$(EXEEXT): $(sie_get_big_OBJECTS) $(sie_get_big_DEPENDENCIES) $(EXTRA_sie_get_big_DEPENDENCIES) 
+	@rm -f sie_get_big$(EXEEXT)
+	$(LINK) $(sie_get_big_OBJECTS) $(sie_get_big_LDADD) $(LIBS)
+sie_get_little$(EXEEXT): $(sie_get_little_OBJECTS) $(sie_get_little_DEPENDENCIES) $(EXTRA_sie_get_little_DEPENDENCIES) 
+	@rm -f sie_get_little$(EXEEXT)
+	$(LINK) $(sie_get_little_OBJECTS) $(sie_get_little_LDADD) $(LIBS)
+sie_move_from$(EXEEXT): $(sie_move_from_OBJECTS) $(sie_move_from_DEPENDENCIES) $(EXTRA_sie_move_from_DEPENDENCIES) 
+	@rm -f sie_move_from$(EXEEXT)
+	$(LINK) $(sie_move_from_OBJECTS) $(sie_move_from_LDADD) $(LIBS)
+sie_move_to$(EXEEXT): $(sie_move_to_OBJECTS) $(sie_move_to_DEPENDENCIES) $(EXTRA_sie_move_to_DEPENDENCIES) 
+	@rm -f sie_move_to$(EXEEXT)
+	$(LINK) $(sie_move_to_OBJECTS) $(sie_move_to_LDADD) $(LIBS)
+sie_nframes_big$(EXEEXT): $(sie_nframes_big_OBJECTS) $(sie_nframes_big_DEPENDENCIES) $(EXTRA_sie_nframes_big_DEPENDENCIES) 
+	@rm -f sie_nframes_big$(EXEEXT)
+	$(LINK) $(sie_nframes_big_OBJECTS) $(sie_nframes_big_LDADD) $(LIBS)
+sie_nframes_little$(EXEEXT): $(sie_nframes_little_OBJECTS) $(sie_nframes_little_DEPENDENCIES) $(EXTRA_sie_nframes_little_DEPENDENCIES) 
+	@rm -f sie_nframes_little$(EXEEXT)
+	$(LINK) $(sie_nframes_little_OBJECTS) $(sie_nframes_little_LDADD) $(LIBS)
+sie_put_big$(EXEEXT): $(sie_put_big_OBJECTS) $(sie_put_big_DEPENDENCIES) $(EXTRA_sie_put_big_DEPENDENCIES) 
+	@rm -f sie_put_big$(EXEEXT)
+	$(LINK) $(sie_put_big_OBJECTS) $(sie_put_big_LDADD) $(LIBS)
+sie_put_little$(EXEEXT): $(sie_put_little_OBJECTS) $(sie_put_little_DEPENDENCIES) $(EXTRA_sie_put_little_DEPENDENCIES) 
+	@rm -f sie_put_little$(EXEEXT)
+	$(LINK) $(sie_put_little_OBJECTS) $(sie_put_little_LDADD) $(LIBS)
+slim_get$(EXEEXT): $(slim_get_OBJECTS) $(slim_get_DEPENDENCIES) $(EXTRA_slim_get_DEPENDENCIES) 
 	@rm -f slim_get$(EXEEXT)
 	$(LINK) $(slim_get_OBJECTS) $(slim_get_LDADD) $(LIBS)
-slim_nframes$(EXEEXT): $(slim_nframes_OBJECTS) $(slim_nframes_DEPENDENCIES) 
+slim_nframes$(EXEEXT): $(slim_nframes_OBJECTS) $(slim_nframes_DEPENDENCIES) $(EXTRA_slim_nframes_DEPENDENCIES) 
 	@rm -f slim_nframes$(EXEEXT)
 	$(LINK) $(slim_nframes_OBJECTS) $(slim_nframes_LDADD) $(LIBS)
-spf$(EXEEXT): $(spf_OBJECTS) $(spf_DEPENDENCIES) 
+spf$(EXEEXT): $(spf_OBJECTS) $(spf_DEPENDENCIES) $(EXTRA_spf_DEPENDENCIES) 
 	@rm -f spf$(EXEEXT)
 	$(LINK) $(spf_OBJECTS) $(spf_LDADD) $(LIBS)
-spf_divide$(EXEEXT): $(spf_divide_OBJECTS) $(spf_divide_DEPENDENCIES) 
+spf_alias$(EXEEXT): $(spf_alias_OBJECTS) $(spf_alias_DEPENDENCIES) $(EXTRA_spf_alias_DEPENDENCIES) 
+	@rm -f spf_alias$(EXEEXT)
+	$(LINK) $(spf_alias_OBJECTS) $(spf_alias_LDADD) $(LIBS)
+spf_alias_meta$(EXEEXT): $(spf_alias_meta_OBJECTS) $(spf_alias_meta_DEPENDENCIES) $(EXTRA_spf_alias_meta_DEPENDENCIES) 
+	@rm -f spf_alias_meta$(EXEEXT)
+	$(LINK) $(spf_alias_meta_OBJECTS) $(spf_alias_meta_LDADD) $(LIBS)
+spf_alias_missing$(EXEEXT): $(spf_alias_missing_OBJECTS) $(spf_alias_missing_DEPENDENCIES) $(EXTRA_spf_alias_missing_DEPENDENCIES) 
+	@rm -f spf_alias_missing$(EXEEXT)
+	$(LINK) $(spf_alias_missing_OBJECTS) $(spf_alias_missing_LDADD) $(LIBS)
+spf_divide$(EXEEXT): $(spf_divide_OBJECTS) $(spf_divide_DEPENDENCIES) $(EXTRA_spf_divide_DEPENDENCIES) 
 	@rm -f spf_divide$(EXEEXT)
 	$(LINK) $(spf_divide_OBJECTS) $(spf_divide_LDADD) $(LIBS)
-spf_lincom$(EXEEXT): $(spf_lincom_OBJECTS) $(spf_lincom_DEPENDENCIES) 
+spf_lincom$(EXEEXT): $(spf_lincom_OBJECTS) $(spf_lincom_DEPENDENCIES) $(EXTRA_spf_lincom_DEPENDENCIES) 
 	@rm -f spf_lincom$(EXEEXT)
 	$(LINK) $(spf_lincom_OBJECTS) $(spf_lincom_LDADD) $(LIBS)
-spf_multiply$(EXEEXT): $(spf_multiply_OBJECTS) $(spf_multiply_DEPENDENCIES) 
+spf_multiply$(EXEEXT): $(spf_multiply_OBJECTS) $(spf_multiply_DEPENDENCIES) $(EXTRA_spf_multiply_DEPENDENCIES) 
 	@rm -f spf_multiply$(EXEEXT)
 	$(LINK) $(spf_multiply_OBJECTS) $(spf_multiply_LDADD) $(LIBS)
-spf_polynom$(EXEEXT): $(spf_polynom_OBJECTS) $(spf_polynom_DEPENDENCIES) 
+spf_polynom$(EXEEXT): $(spf_polynom_OBJECTS) $(spf_polynom_DEPENDENCIES) $(EXTRA_spf_polynom_DEPENDENCIES) 
 	@rm -f spf_polynom$(EXEEXT)
 	$(LINK) $(spf_polynom_OBJECTS) $(spf_polynom_LDADD) $(LIBS)
-spf_recip$(EXEEXT): $(spf_recip_OBJECTS) $(spf_recip_DEPENDENCIES) 
+spf_recip$(EXEEXT): $(spf_recip_OBJECTS) $(spf_recip_DEPENDENCIES) $(EXTRA_spf_recip_DEPENDENCIES) 
 	@rm -f spf_recip$(EXEEXT)
 	$(LINK) $(spf_recip_OBJECTS) $(spf_recip_LDADD) $(LIBS)
-spf_recurse$(EXEEXT): $(spf_recurse_OBJECTS) $(spf_recurse_DEPENDENCIES) 
+spf_recurse$(EXEEXT): $(spf_recurse_OBJECTS) $(spf_recurse_DEPENDENCIES) $(EXTRA_spf_recurse_DEPENDENCIES) 
 	@rm -f spf_recurse$(EXEEXT)
 	$(LINK) $(spf_recurse_OBJECTS) $(spf_recurse_LDADD) $(LIBS)
-svlist$(EXEEXT): $(svlist_OBJECTS) $(svlist_DEPENDENCIES) 
+svlist$(EXEEXT): $(svlist_OBJECTS) $(svlist_DEPENDENCIES) $(EXTRA_svlist_DEPENDENCIES) 
 	@rm -f svlist$(EXEEXT)
 	$(LINK) $(svlist_OBJECTS) $(svlist_LDADD) $(LIBS)
-svlist_invalid$(EXEEXT): $(svlist_invalid_OBJECTS) $(svlist_invalid_DEPENDENCIES) 
+svlist_hidden$(EXEEXT): $(svlist_hidden_OBJECTS) $(svlist_hidden_DEPENDENCIES) $(EXTRA_svlist_hidden_DEPENDENCIES) 
+	@rm -f svlist_hidden$(EXEEXT)
+	$(LINK) $(svlist_hidden_OBJECTS) $(svlist_hidden_LDADD) $(LIBS)
+svlist_invalid$(EXEEXT): $(svlist_invalid_OBJECTS) $(svlist_invalid_DEPENDENCIES) $(EXTRA_svlist_invalid_DEPENDENCIES) 
 	@rm -f svlist_invalid$(EXEEXT)
 	$(LINK) $(svlist_invalid_OBJECTS) $(svlist_invalid_LDADD) $(LIBS)
-svlist_meta$(EXEEXT): $(svlist_meta_OBJECTS) $(svlist_meta_DEPENDENCIES) 
+svlist_meta$(EXEEXT): $(svlist_meta_OBJECTS) $(svlist_meta_DEPENDENCIES) $(EXTRA_svlist_meta_DEPENDENCIES) 
 	@rm -f svlist_meta$(EXEEXT)
 	$(LINK) $(svlist_meta_OBJECTS) $(svlist_meta_LDADD) $(LIBS)
-svlist_meta_invalid$(EXEEXT): $(svlist_meta_invalid_OBJECTS) $(svlist_meta_invalid_DEPENDENCIES) 
+svlist_meta_hidden$(EXEEXT): $(svlist_meta_hidden_OBJECTS) $(svlist_meta_hidden_DEPENDENCIES) $(EXTRA_svlist_meta_hidden_DEPENDENCIES) 
+	@rm -f svlist_meta_hidden$(EXEEXT)
+	$(LINK) $(svlist_meta_hidden_OBJECTS) $(svlist_meta_hidden_LDADD) $(LIBS)
+svlist_meta_invalid$(EXEEXT): $(svlist_meta_invalid_OBJECTS) $(svlist_meta_invalid_DEPENDENCIES) $(EXTRA_svlist_meta_invalid_DEPENDENCIES) 
 	@rm -f svlist_meta_invalid$(EXEEXT)
 	$(LINK) $(svlist_meta_invalid_OBJECTS) $(svlist_meta_invalid_LDADD) $(LIBS)
-trunc$(EXEEXT): $(trunc_OBJECTS) $(trunc_DEPENDENCIES) 
+table$(EXEEXT): $(table_OBJECTS) $(table_DEPENDENCIES) $(EXTRA_table_DEPENDENCIES) 
+	@rm -f table$(EXEEXT)
+	$(LINK) $(table_OBJECTS) $(table_LDADD) $(LIBS)
+table_code$(EXEEXT): $(table_code_OBJECTS) $(table_code_DEPENDENCIES) $(EXTRA_table_code_DEPENDENCIES) 
+	@rm -f table_code$(EXEEXT)
+	$(LINK) $(table_code_OBJECTS) $(table_code_LDADD) $(LIBS)
+table_type$(EXEEXT): $(table_type_OBJECTS) $(table_type_DEPENDENCIES) $(EXTRA_table_type_DEPENDENCIES) 
+	@rm -f table_type$(EXEEXT)
+	$(LINK) $(table_type_OBJECTS) $(table_type_LDADD) $(LIBS)
+tell$(EXEEXT): $(tell_OBJECTS) $(tell_DEPENDENCIES) $(EXTRA_tell_DEPENDENCIES) 
+	@rm -f tell$(EXEEXT)
+	$(LINK) $(tell_OBJECTS) $(tell_LDADD) $(LIBS)
+tell64$(EXEEXT): $(tell64_OBJECTS) $(tell64_DEPENDENCIES) $(EXTRA_tell64_DEPENDENCIES) 
+	@rm -f tell64$(EXEEXT)
+	$(LINK) $(tell64_OBJECTS) $(tell64_LDADD) $(LIBS)
+tell_multidiv$(EXEEXT): $(tell_multidiv_OBJECTS) $(tell_multidiv_DEPENDENCIES) $(EXTRA_tell_multidiv_DEPENDENCIES) 
+	@rm -f tell_multidiv$(EXEEXT)
+	$(LINK) $(tell_multidiv_OBJECTS) $(tell_multidiv_LDADD) $(LIBS)
+tok_arg$(EXEEXT): $(tok_arg_OBJECTS) $(tok_arg_DEPENDENCIES) $(EXTRA_tok_arg_DEPENDENCIES) 
+	@rm -f tok_arg$(EXEEXT)
+	$(LINK) $(tok_arg_OBJECTS) $(tok_arg_LDADD) $(LIBS)
+tok_escape$(EXEEXT): $(tok_escape_OBJECTS) $(tok_escape_DEPENDENCIES) $(EXTRA_tok_escape_DEPENDENCIES) 
+	@rm -f tok_escape$(EXEEXT)
+	$(LINK) $(tok_escape_OBJECTS) $(tok_escape_LDADD) $(LIBS)
+tok_quote$(EXEEXT): $(tok_quote_OBJECTS) $(tok_quote_DEPENDENCIES) $(EXTRA_tok_quote_DEPENDENCIES) 
+	@rm -f tok_quote$(EXEEXT)
+	$(LINK) $(tok_quote_OBJECTS) $(tok_quote_LDADD) $(LIBS)
+trunc$(EXEEXT): $(trunc_OBJECTS) $(trunc_DEPENDENCIES) $(EXTRA_trunc_DEPENDENCIES) 
 	@rm -f trunc$(EXEEXT)
 	$(LINK) $(trunc_OBJECTS) $(trunc_LDADD) $(LIBS)
-trunc_rdonly$(EXEEXT): $(trunc_rdonly_OBJECTS) $(trunc_rdonly_DEPENDENCIES) 
+trunc_dir$(EXEEXT): $(trunc_dir_OBJECTS) $(trunc_dir_DEPENDENCIES) $(EXTRA_trunc_dir_DEPENDENCIES) 
+	@rm -f trunc_dir$(EXEEXT)
+	$(LINK) $(trunc_dir_OBJECTS) $(trunc_dir_LDADD) $(LIBS)
+trunc_rdonly$(EXEEXT): $(trunc_rdonly_OBJECTS) $(trunc_rdonly_DEPENDENCIES) $(EXTRA_trunc_rdonly_DEPENDENCIES) 
 	@rm -f trunc_rdonly$(EXEEXT)
 	$(LINK) $(trunc_rdonly_OBJECTS) $(trunc_rdonly_LDADD) $(LIBS)
-trunc_rofs$(EXEEXT): $(trunc_rofs_OBJECTS) $(trunc_rofs_DEPENDENCIES) 
+trunc_rofs$(EXEEXT): $(trunc_rofs_OBJECTS) $(trunc_rofs_DEPENDENCIES) $(EXTRA_trunc_rofs_DEPENDENCIES) 
 	@rm -f trunc_rofs$(EXEEXT)
 	$(LINK) $(trunc_rofs_OBJECTS) $(trunc_rofs_LDADD) $(LIBS)
-unclude$(EXEEXT): $(unclude_OBJECTS) $(unclude_DEPENDENCIES) 
+trunc_truncsub$(EXEEXT): $(trunc_truncsub_OBJECTS) $(trunc_truncsub_DEPENDENCIES) $(EXTRA_trunc_truncsub_DEPENDENCIES) 
+	@rm -f trunc_truncsub$(EXEEXT)
+	$(LINK) $(trunc_truncsub_OBJECTS) $(trunc_truncsub_LDADD) $(LIBS)
+unclude$(EXEEXT): $(unclude_OBJECTS) $(unclude_DEPENDENCIES) $(EXTRA_unclude_DEPENDENCIES) 
 	@rm -f unclude$(EXEEXT)
 	$(LINK) $(unclude_OBJECTS) $(unclude_LDADD) $(LIBS)
-unclude_del$(EXEEXT): $(unclude_del_OBJECTS) $(unclude_del_DEPENDENCIES) 
+unclude_del$(EXEEXT): $(unclude_del_OBJECTS) $(unclude_del_DEPENDENCIES) $(EXTRA_unclude_del_DEPENDENCIES) 
 	@rm -f unclude_del$(EXEEXT)
 	$(LINK) $(unclude_del_OBJECTS) $(unclude_del_LDADD) $(LIBS)
-unclude_move$(EXEEXT): $(unclude_move_OBJECTS) $(unclude_move_DEPENDENCIES) 
+unclude_move$(EXEEXT): $(unclude_move_OBJECTS) $(unclude_move_DEPENDENCIES) $(EXTRA_unclude_move_DEPENDENCIES) 
 	@rm -f unclude_move$(EXEEXT)
 	$(LINK) $(unclude_move_OBJECTS) $(unclude_move_LDADD) $(LIBS)
-version_0$(EXEEXT): $(version_0_OBJECTS) $(version_0_DEPENDENCIES) 
+version_0$(EXEEXT): $(version_0_OBJECTS) $(version_0_DEPENDENCIES) $(EXTRA_version_0_DEPENDENCIES) 
 	@rm -f version_0$(EXEEXT)
 	$(LINK) $(version_0_OBJECTS) $(version_0_LDADD) $(LIBS)
-version_0_write$(EXEEXT): $(version_0_write_OBJECTS) $(version_0_write_DEPENDENCIES) 
+version_0_write$(EXEEXT): $(version_0_write_OBJECTS) $(version_0_write_DEPENDENCIES) $(EXTRA_version_0_write_DEPENDENCIES) 
 	@rm -f version_0_write$(EXEEXT)
 	$(LINK) $(version_0_write_OBJECTS) $(version_0_write_LDADD) $(LIBS)
-version_1$(EXEEXT): $(version_1_OBJECTS) $(version_1_DEPENDENCIES) 
+version_1$(EXEEXT): $(version_1_OBJECTS) $(version_1_DEPENDENCIES) $(EXTRA_version_1_DEPENDENCIES) 
 	@rm -f version_1$(EXEEXT)
 	$(LINK) $(version_1_OBJECTS) $(version_1_LDADD) $(LIBS)
-version_1_write$(EXEEXT): $(version_1_write_OBJECTS) $(version_1_write_DEPENDENCIES) 
+version_1_write$(EXEEXT): $(version_1_write_OBJECTS) $(version_1_write_DEPENDENCIES) $(EXTRA_version_1_write_DEPENDENCIES) 
 	@rm -f version_1_write$(EXEEXT)
 	$(LINK) $(version_1_write_OBJECTS) $(version_1_write_LDADD) $(LIBS)
-version_2$(EXEEXT): $(version_2_OBJECTS) $(version_2_DEPENDENCIES) 
+version_2$(EXEEXT): $(version_2_OBJECTS) $(version_2_DEPENDENCIES) $(EXTRA_version_2_DEPENDENCIES) 
 	@rm -f version_2$(EXEEXT)
 	$(LINK) $(version_2_OBJECTS) $(version_2_LDADD) $(LIBS)
-version_2_write$(EXEEXT): $(version_2_write_OBJECTS) $(version_2_write_DEPENDENCIES) 
+version_2_write$(EXEEXT): $(version_2_write_OBJECTS) $(version_2_write_DEPENDENCIES) $(EXTRA_version_2_write_DEPENDENCIES) 
 	@rm -f version_2_write$(EXEEXT)
 	$(LINK) $(version_2_write_OBJECTS) $(version_2_write_LDADD) $(LIBS)
-version_3$(EXEEXT): $(version_3_OBJECTS) $(version_3_DEPENDENCIES) 
+version_3$(EXEEXT): $(version_3_OBJECTS) $(version_3_DEPENDENCIES) $(EXTRA_version_3_DEPENDENCIES) 
 	@rm -f version_3$(EXEEXT)
 	$(LINK) $(version_3_OBJECTS) $(version_3_LDADD) $(LIBS)
-version_3_write$(EXEEXT): $(version_3_write_OBJECTS) $(version_3_write_DEPENDENCIES) 
+version_3_write$(EXEEXT): $(version_3_write_OBJECTS) $(version_3_write_DEPENDENCIES) $(EXTRA_version_3_write_DEPENDENCIES) 
 	@rm -f version_3_write$(EXEEXT)
 	$(LINK) $(version_3_write_OBJECTS) $(version_3_write_LDADD) $(LIBS)
-version_4$(EXEEXT): $(version_4_OBJECTS) $(version_4_DEPENDENCIES) 
+version_4$(EXEEXT): $(version_4_OBJECTS) $(version_4_DEPENDENCIES) $(EXTRA_version_4_DEPENDENCIES) 
 	@rm -f version_4$(EXEEXT)
 	$(LINK) $(version_4_OBJECTS) $(version_4_LDADD) $(LIBS)
-version_4_write$(EXEEXT): $(version_4_write_OBJECTS) $(version_4_write_DEPENDENCIES) 
+version_4_write$(EXEEXT): $(version_4_write_OBJECTS) $(version_4_write_DEPENDENCIES) $(EXTRA_version_4_write_DEPENDENCIES) 
 	@rm -f version_4_write$(EXEEXT)
 	$(LINK) $(version_4_write_OBJECTS) $(version_4_write_LDADD) $(LIBS)
-version_5$(EXEEXT): $(version_5_OBJECTS) $(version_5_DEPENDENCIES) 
+version_5$(EXEEXT): $(version_5_OBJECTS) $(version_5_DEPENDENCIES) $(EXTRA_version_5_DEPENDENCIES) 
 	@rm -f version_5$(EXEEXT)
 	$(LINK) $(version_5_OBJECTS) $(version_5_LDADD) $(LIBS)
-version_5_strict$(EXEEXT): $(version_5_strict_OBJECTS) $(version_5_strict_DEPENDENCIES) 
+version_5_strict$(EXEEXT): $(version_5_strict_OBJECTS) $(version_5_strict_DEPENDENCIES) $(EXTRA_version_5_strict_DEPENDENCIES) 
 	@rm -f version_5_strict$(EXEEXT)
 	$(LINK) $(version_5_strict_OBJECTS) $(version_5_strict_LDADD) $(LIBS)
-version_5_write$(EXEEXT): $(version_5_write_OBJECTS) $(version_5_write_DEPENDENCIES) 
+version_5_write$(EXEEXT): $(version_5_write_OBJECTS) $(version_5_write_DEPENDENCIES) $(EXTRA_version_5_write_DEPENDENCIES) 
 	@rm -f version_5_write$(EXEEXT)
 	$(LINK) $(version_5_write_OBJECTS) $(version_5_write_LDADD) $(LIBS)
-version_6$(EXEEXT): $(version_6_OBJECTS) $(version_6_DEPENDENCIES) 
+version_6$(EXEEXT): $(version_6_OBJECTS) $(version_6_DEPENDENCIES) $(EXTRA_version_6_DEPENDENCIES) 
 	@rm -f version_6$(EXEEXT)
 	$(LINK) $(version_6_OBJECTS) $(version_6_LDADD) $(LIBS)
-version_6_strict$(EXEEXT): $(version_6_strict_OBJECTS) $(version_6_strict_DEPENDENCIES) 
+version_6_strict$(EXEEXT): $(version_6_strict_OBJECTS) $(version_6_strict_DEPENDENCIES) $(EXTRA_version_6_strict_DEPENDENCIES) 
 	@rm -f version_6_strict$(EXEEXT)
 	$(LINK) $(version_6_strict_OBJECTS) $(version_6_strict_LDADD) $(LIBS)
-version_6_write$(EXEEXT): $(version_6_write_OBJECTS) $(version_6_write_DEPENDENCIES) 
+version_6_write$(EXEEXT): $(version_6_write_OBJECTS) $(version_6_write_DEPENDENCIES) $(EXTRA_version_6_write_DEPENDENCIES) 
 	@rm -f version_6_write$(EXEEXT)
 	$(LINK) $(version_6_write_OBJECTS) $(version_6_write_LDADD) $(LIBS)
-version_7$(EXEEXT): $(version_7_OBJECTS) $(version_7_DEPENDENCIES) 
+version_7$(EXEEXT): $(version_7_OBJECTS) $(version_7_DEPENDENCIES) $(EXTRA_version_7_DEPENDENCIES) 
 	@rm -f version_7$(EXEEXT)
 	$(LINK) $(version_7_OBJECTS) $(version_7_LDADD) $(LIBS)
-version_7_strict$(EXEEXT): $(version_7_strict_OBJECTS) $(version_7_strict_DEPENDENCIES) 
+version_7_strict$(EXEEXT): $(version_7_strict_OBJECTS) $(version_7_strict_DEPENDENCIES) $(EXTRA_version_7_strict_DEPENDENCIES) 
 	@rm -f version_7_strict$(EXEEXT)
 	$(LINK) $(version_7_strict_OBJECTS) $(version_7_strict_LDADD) $(LIBS)
-version_7_write$(EXEEXT): $(version_7_write_OBJECTS) $(version_7_write_DEPENDENCIES) 
+version_7_write$(EXEEXT): $(version_7_write_OBJECTS) $(version_7_write_DEPENDENCIES) $(EXTRA_version_7_write_DEPENDENCIES) 
 	@rm -f version_7_write$(EXEEXT)
 	$(LINK) $(version_7_write_OBJECTS) $(version_7_write_LDADD) $(LIBS)
-version_8$(EXEEXT): $(version_8_OBJECTS) $(version_8_DEPENDENCIES) 
+version_8$(EXEEXT): $(version_8_OBJECTS) $(version_8_DEPENDENCIES) $(EXTRA_version_8_DEPENDENCIES) 
 	@rm -f version_8$(EXEEXT)
 	$(LINK) $(version_8_OBJECTS) $(version_8_LDADD) $(LIBS)
-version_8_strict$(EXEEXT): $(version_8_strict_OBJECTS) $(version_8_strict_DEPENDENCIES) 
+version_8_strict$(EXEEXT): $(version_8_strict_OBJECTS) $(version_8_strict_DEPENDENCIES) $(EXTRA_version_8_strict_DEPENDENCIES) 
 	@rm -f version_8_strict$(EXEEXT)
 	$(LINK) $(version_8_strict_OBJECTS) $(version_8_strict_LDADD) $(LIBS)
-version_8_write$(EXEEXT): $(version_8_write_OBJECTS) $(version_8_write_DEPENDENCIES) 
+version_8_write$(EXEEXT): $(version_8_write_OBJECTS) $(version_8_write_DEPENDENCIES) $(EXTRA_version_8_write_DEPENDENCIES) 
 	@rm -f version_8_write$(EXEEXT)
 	$(LINK) $(version_8_write_OBJECTS) $(version_8_write_LDADD) $(LIBS)
-vlist$(EXEEXT): $(vlist_OBJECTS) $(vlist_DEPENDENCIES) 
+version_9$(EXEEXT): $(version_9_OBJECTS) $(version_9_DEPENDENCIES) $(EXTRA_version_9_DEPENDENCIES) 
+	@rm -f version_9$(EXEEXT)
+	$(LINK) $(version_9_OBJECTS) $(version_9_LDADD) $(LIBS)
+version_9_strict$(EXEEXT): $(version_9_strict_OBJECTS) $(version_9_strict_DEPENDENCIES) $(EXTRA_version_9_strict_DEPENDENCIES) 
+	@rm -f version_9_strict$(EXEEXT)
+	$(LINK) $(version_9_strict_OBJECTS) $(version_9_strict_LDADD) $(LIBS)
+version_9_write$(EXEEXT): $(version_9_write_OBJECTS) $(version_9_write_DEPENDENCIES) $(EXTRA_version_9_write_DEPENDENCIES) 
+	@rm -f version_9_write$(EXEEXT)
+	$(LINK) $(version_9_write_OBJECTS) $(version_9_write_LDADD) $(LIBS)
+vlist$(EXEEXT): $(vlist_OBJECTS) $(vlist_DEPENDENCIES) $(EXTRA_vlist_DEPENDENCIES) 
 	@rm -f vlist$(EXEEXT)
 	$(LINK) $(vlist_OBJECTS) $(vlist_LDADD) $(LIBS)
-vlist_invalid$(EXEEXT): $(vlist_invalid_OBJECTS) $(vlist_invalid_DEPENDENCIES) 
+vlist_alias$(EXEEXT): $(vlist_alias_OBJECTS) $(vlist_alias_DEPENDENCIES) $(EXTRA_vlist_alias_DEPENDENCIES) 
+	@rm -f vlist_alias$(EXEEXT)
+	$(LINK) $(vlist_alias_OBJECTS) $(vlist_alias_LDADD) $(LIBS)
+vlist_hidden$(EXEEXT): $(vlist_hidden_OBJECTS) $(vlist_hidden_DEPENDENCIES) $(EXTRA_vlist_hidden_DEPENDENCIES) 
+	@rm -f vlist_hidden$(EXEEXT)
+	$(LINK) $(vlist_hidden_OBJECTS) $(vlist_hidden_LDADD) $(LIBS)
+vlist_invalid$(EXEEXT): $(vlist_invalid_OBJECTS) $(vlist_invalid_DEPENDENCIES) $(EXTRA_vlist_invalid_DEPENDENCIES) 
 	@rm -f vlist_invalid$(EXEEXT)
 	$(LINK) $(vlist_invalid_OBJECTS) $(vlist_invalid_LDADD) $(LIBS)
-vlist_meta$(EXEEXT): $(vlist_meta_OBJECTS) $(vlist_meta_DEPENDENCIES) 
+vlist_meta$(EXEEXT): $(vlist_meta_OBJECTS) $(vlist_meta_DEPENDENCIES) $(EXTRA_vlist_meta_DEPENDENCIES) 
 	@rm -f vlist_meta$(EXEEXT)
 	$(LINK) $(vlist_meta_OBJECTS) $(vlist_meta_LDADD) $(LIBS)
-vlist_meta_invalid$(EXEEXT): $(vlist_meta_invalid_OBJECTS) $(vlist_meta_invalid_DEPENDENCIES) 
+vlist_meta_hidden$(EXEEXT): $(vlist_meta_hidden_OBJECTS) $(vlist_meta_hidden_DEPENDENCIES) $(EXTRA_vlist_meta_hidden_DEPENDENCIES) 
+	@rm -f vlist_meta_hidden$(EXEEXT)
+	$(LINK) $(vlist_meta_hidden_OBJECTS) $(vlist_meta_hidden_LDADD) $(LIBS)
+vlist_meta_invalid$(EXEEXT): $(vlist_meta_invalid_OBJECTS) $(vlist_meta_invalid_DEPENDENCIES) $(EXTRA_vlist_meta_invalid_DEPENDENCIES) 
 	@rm -f vlist_meta_invalid$(EXEEXT)
 	$(LINK) $(vlist_meta_invalid_OBJECTS) $(vlist_meta_invalid_LDADD) $(LIBS)
-xz_get$(EXEEXT): $(xz_get_OBJECTS) $(xz_get_DEPENDENCIES) 
+xz_get$(EXEEXT): $(xz_get_OBJECTS) $(xz_get_DEPENDENCIES) $(EXTRA_xz_get_DEPENDENCIES) 
 	@rm -f xz_get$(EXEEXT)
 	$(LINK) $(xz_get_OBJECTS) $(xz_get_LDADD) $(LIBS)
-xz_nframes$(EXEEXT): $(xz_nframes_OBJECTS) $(xz_nframes_DEPENDENCIES) 
+xz_nframes$(EXEEXT): $(xz_nframes_OBJECTS) $(xz_nframes_DEPENDENCIES) $(EXTRA_xz_nframes_DEPENDENCIES) 
 	@rm -f xz_nframes$(EXEEXT)
 	$(LINK) $(xz_nframes_OBJECTS) $(xz_nframes_LDADD) $(LIBS)
+zzip_data$(EXEEXT): $(zzip_data_OBJECTS) $(zzip_data_DEPENDENCIES) $(EXTRA_zzip_data_DEPENDENCIES) 
+	@rm -f zzip_data$(EXEEXT)
+	$(LINK) $(zzip_data_OBJECTS) $(zzip_data_LDADD) $(LIBS)
+zzip_get$(EXEEXT): $(zzip_get_OBJECTS) $(zzip_get_DEPENDENCIES) $(EXTRA_zzip_get_DEPENDENCIES) 
+	@rm -f zzip_get$(EXEEXT)
+	$(LINK) $(zzip_get_OBJECTS) $(zzip_get_LDADD) $(LIBS)
+zzip_get_get$(EXEEXT): $(zzip_get_get_OBJECTS) $(zzip_get_get_DEPENDENCIES) $(EXTRA_zzip_get_get_DEPENDENCIES) 
+	@rm -f zzip_get_get$(EXEEXT)
+	$(LINK) $(zzip_get_get_OBJECTS) $(zzip_get_get_LDADD) $(LIBS)
+zzip_nframes$(EXEEXT): $(zzip_nframes_OBJECTS) $(zzip_nframes_DEPENDENCIES) $(EXTRA_zzip_nframes_DEPENDENCIES) 
+	@rm -f zzip_nframes$(EXEEXT)
+	$(LINK) $(zzip_nframes_OBJECTS) $(zzip_nframes_LDADD) $(LIBS)
+zzslim_get$(EXEEXT): $(zzslim_get_OBJECTS) $(zzslim_get_DEPENDENCIES) $(EXTRA_zzslim_get_DEPENDENCIES) 
+	@rm -f zzslim_get$(EXEEXT)
+	$(LINK) $(zzslim_get_OBJECTS) $(zzslim_get_LDADD) $(LIBS)
+zzslim_nframes$(EXEEXT): $(zzslim_nframes_OBJECTS) $(zzslim_nframes_DEPENDENCIES) $(EXTRA_zzslim_nframes_DEPENDENCIES) 
+	@rm -f zzslim_nframes$(EXEEXT)
+	$(LINK) $(zzslim_nframes_OBJECTS) $(zzslim_nframes_LDADD) $(LIBS)
 
 mostlyclean-compile:
 	-rm -f *.$(OBJEXT)
@@ -6323,6 +8284,10 @@ distclean-compile:
 	-rm -f *.tab.c
 
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/add.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/add_affix.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/add_alias.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/add_alias_affix.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/add_alias_meta.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/add_bit.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/add_bit_bitnum.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/add_bit_bitsize.Po at am__quote@
@@ -6341,10 +8306,15 @@ distclean-compile:
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/add_format.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/add_invalid.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/add_lincom.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/add_lincom_affix.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/add_lincom_invalid.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/add_lincom_nfields.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/add_linterp.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/add_linterp_invalid.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/add_meta.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/add_meta_alias.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/add_mplex.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/add_mplex_val.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/add_multiply.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/add_multiply_invalid.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/add_phase.Po at am__quote@
@@ -6358,26 +8328,45 @@ distclean-compile:
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/add_raw_type.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/add_rdonly.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/add_recip.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/add_resolv.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/add_sbit.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/add_scalar.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/add_scalar_carray.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/add_scalar_carray_bad.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/add_sort.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/add_spec.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/add_spec_directive.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/add_spec_invalid.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/add_spec_meta.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/add_spec_resolv.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/add_string.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/add_string_affix.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/add_type.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/add_window.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/add_window_op.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/alias_list.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/alias_list_alias.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/alias_list_missing.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/alias_num.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/alias_num_alias.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/alias_num_missing.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/alias_target.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/alias_target_alias.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/alias_target_missing.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/alter_bit_bitnum.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/alter_bit_numbits.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/alter_carray_len.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/alter_carray_type.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/alter_const.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/alter_const_c2r.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/alter_cpolynom.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/alter_crecip.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/alter_crecip89.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/alter_crecip_zero.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/alter_divide.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/alter_entry.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/alter_entry_affix.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/alter_entry_hidden.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/alter_entry_recode.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/alter_entry_scalar2a.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/alter_entry_scalar2n.Po at am__quote@
@@ -6385,12 +8374,15 @@ distclean-compile:
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/alter_entry_scalar4.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/alter_lincom_23.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/alter_lincom_32.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/alter_lincom_affix.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/alter_lincom_input.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/alter_lincom_offset.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/alter_lincom_slope.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/alter_linterp.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/alter_linterp_move.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/alter_mplex.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/alter_mspec.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/alter_mspec_affix.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/alter_multiply.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/alter_phase.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/alter_polynom_coeff.Po at am__quote@
@@ -6400,8 +8392,12 @@ distclean-compile:
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/alter_raw_type.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/alter_recip.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/alter_recip_zero.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/alter_scalar_affix.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/alter_spec.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/alter_spec_affix.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/alter_spec_meta.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/alter_window.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/ascii_add.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/ascii_get.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/ascii_get_get.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/ascii_nframes.Po at am__quote@
@@ -6540,9 +8536,13 @@ distclean-compile:
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/creat_rdonly.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/cvlist.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/cvlist_array.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/cvlist_array_hidden.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/cvlist_array_meta.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/cvlist_array_meta_hidden.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/cvlist_hidden.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/cvlist_invalid.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/cvlist_meta.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/cvlist_meta_hidden.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/cvlist_meta_invalid.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/del.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/del_carray.Po at am__quote@
@@ -6552,9 +8552,14 @@ distclean-compile:
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/del_const_force.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/del_data.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/del_derived.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/del_derived_after.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/del_derived_force.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/del_meta.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/del_meta_force.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/desync.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/desync_flush.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/desync_reopen.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/desync_reopen_inv.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/dfes_bit.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/dfes_divide.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/dfes_lincom.Po at am__quote@
@@ -6565,19 +8570,27 @@ distclean-compile:
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/dfes_raw.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/dfes_recip.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/dfes_zero.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/elist_alias.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/elist_hidden.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/elist_noalias.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/elist_scalar.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/encode_alter.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/encode_get.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/encode_move.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/endian_alter.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/endian_alter_sie.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/endian_get.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/endian_move.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/entry_bad_code.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/entry_bit.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/entry_bit_scalar.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/entry_divide.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/entry_invalid.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/entry_lincom.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/entry_lincom_scalar.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/entry_linterp.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/entry_mplex.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/entry_mplex_scalar.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/entry_multiply.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/entry_phase.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/entry_phase_scalar.Po at am__quote@
@@ -6587,39 +8600,59 @@ distclean-compile:
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/entry_raw_scalar.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/entry_raw_scalar_code.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/entry_raw_scalar_type.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/entry_recip.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/entry_scalar_repr.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/entry_type.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/entry_type_alias.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/entry_window.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/entry_window_scalar.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/eof.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/eof_index.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/eof_lincom.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/eof_phase.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/error.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/error_error.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/error_num.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/error_short.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/error_verbose.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/error_verbose_prefix.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/file.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/file_code.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/file_type.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/flist.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/flist_hidden.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/flist_invalid.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/flist_meta.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/flist_meta_hidden.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/flist_meta_invalid.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/flist_type.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/flist_type_hidden.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/flist_type_invalid.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/flist_type_meta.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/flist_type_meta_hidden.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/flist_type_meta_invalid.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/flush.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/flush_all.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/flush_bad_code.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/flush_invalid.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/flush_meta.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/flush_ref.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/flush_spec.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/foffs_alter.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/foffs_get.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/foffs_move.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/fragment_affix.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/fragment_affix_alter.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/fragment_affix_alter2.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/fragment_affix_dup.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/fragment_index.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/fragment_index_alias.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/fragment_name.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/fragment_name_oor.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/fragment_num.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/fragment_parent.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/get64.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/get_affix.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/get_bad_code.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/get_bit.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/get_carray.Po at am__quote@
@@ -6655,6 +8688,9 @@ distclean-compile:
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/get_float64.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/get_foffs.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/get_fs.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/get_here.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/get_here_foffs.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/get_heres.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/get_int16.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/get_int32.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/get_int64.Po at am__quote@
@@ -6665,21 +8701,30 @@ distclean-compile:
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/get_lincom3.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/get_lincom_noin.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/get_lincom_non.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/get_lincom_null.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/get_lincom_spf.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/get_linterp.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/get_linterp_noin.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/get_linterp_notab.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/get_linterp_sort.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/get_mplex.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/get_mplex_bof.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/get_mplex_lb.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/get_mplex_lball.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/get_mplex_nolb.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/get_multiply.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/get_multiply_noin.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/get_nonexistent.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/get_null.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/get_off64.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/get_phase.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/get_phase_affix.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/get_polynom.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/get_polynom_noin.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/get_recip.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/get_recip_const.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/get_recurse.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/get_rofs.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/get_sbit.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/get_sf.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/get_ss.Po at am__quote@
@@ -6687,18 +8732,37 @@ distclean-compile:
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/get_uint16.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/get_uint32.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/get_uint64.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/get_window.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/get_window_clr.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/get_window_ge.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/get_window_gt.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/get_window_le.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/get_window_lt.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/get_window_ne.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/get_window_set.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/get_zero.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/global_flags.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/global_name.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/global_ref.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/global_ref_empty.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/global_ref_set.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/gzip_add.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/gzip_get.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/gzip_get_get.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/gzip_get_get2.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/gzip_get_put.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/gzip_move_from.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/gzip_move_to.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/gzip_nframes.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/gzip_put.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/gzip_put_get.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/header_complex.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/hide.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/hide_hidden.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/hide_unhide.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/include.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/include_accmode.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/include_affix.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/include_auto.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/include_cb.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/include_creat.Po at am__quote@
@@ -6708,6 +8772,7 @@ distclean-compile:
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/include_nonexistent.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/include_pc.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/include_ref.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/include_sub.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/include_syntax.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/index.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/index_domain.Po at am__quote@
@@ -6722,6 +8787,9 @@ distclean-compile:
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/lzma_get.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/lzma_nframes.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/madd.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/madd_affix.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/madd_alias.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/madd_alias_affix.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/madd_bit.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/madd_bit_invalid.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/madd_carray.Po at am__quote@
@@ -6731,10 +8799,12 @@ distclean-compile:
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/madd_crecip.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/madd_crecip89.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/madd_divide.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/madd_index.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/madd_lincom.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/madd_lincom_invalid.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/madd_linterp.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/madd_linterp_invalid.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/madd_mplex.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/madd_multiply.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/madd_multiply_invalid.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/madd_phase.Po at am__quote@
@@ -6745,8 +8815,13 @@ distclean-compile:
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/madd_spec.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/madd_spec_directive.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/madd_spec_invalid.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/madd_spec_resolv.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/madd_string.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/madd_window.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/move.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/move_affix.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/move_affix_dup.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/move_alias.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/move_data_enc_ar.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/move_data_enc_ra.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/move_data_endian.Po at am__quote@
@@ -6757,12 +8832,29 @@ distclean-compile:
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/move_protect.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/move_subdir.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/name.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/name_affix.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/name_affix_bad.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/name_alias.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/name_dup.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/name_move.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/name_move_alias.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/name_updb.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/name_updb_alias.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/name_updb_const.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/name_updb_const_alias.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/nentries_alias.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/nentries_hidden.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/nentries_noalias.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/nentries_scalar.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/nfields.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/nfields_hidden.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/nfields_invalid.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/nfields_type.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/nfields_type_hidden.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/nfields_type_invalid.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/nfragments.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/nfields_vector.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/nfields_vector_hidden.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/nfields_vector_invalid.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/nframes.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/nframes64.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/nframes_empty.Po at am__quote@
@@ -6770,18 +8862,20 @@ distclean-compile:
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/nframes_off64.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/nframes_spf.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/nmeta.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/nmeta_hidden.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/nmeta_invalid.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/nmeta_parent.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/nmeta_type.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/nmeta_type_hidden.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/nmeta_type_invalid.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/nmeta_type_parent.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/nmeta_vectors.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/nmeta_vectors_del.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/nmeta_vectors_hidden.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/nmeta_vectors_invalid.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/nmeta_vectors_parent.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/nvectors.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/nvectors_invalid.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/open.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/open_abs.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/open_cb_abort.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/open_cb_cont.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/open_cb_ignore.Po at am__quote@
@@ -6790,7 +8884,20 @@ distclean-compile:
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/open_eaccess.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/open_nonexistent.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/open_notdirfile.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/parent.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/open_sym_a.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/open_sym_al.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/open_sym_at.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/open_sym_c.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/open_sym_cl.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/open_sym_ct.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/open_sym_p.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/open_sym_pl.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/open_sym_pt.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/parse_alias.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/parse_alias_code.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/parse_alias_dup.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/parse_alias_meta.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/parse_alias_missing.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/parse_badline.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/parse_bit.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/parse_bit4.Po at am__quote@
@@ -6802,8 +8909,10 @@ distclean-compile:
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/parse_carray.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/parse_carray_long.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/parse_const.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/parse_const_complex.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/parse_const_ncols.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/parse_divide.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/parse_double.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/parse_duplicate.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/parse_duplicate_ignore.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/parse_endian_bad.Po at am__quote@
@@ -6815,13 +8924,25 @@ distclean-compile:
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/parse_foffs.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/parse_foffs_include.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/parse_foffs_slash.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/parse_hidden.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/parse_hidden_field.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/parse_hidden_meta.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/parse_include.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/parse_include_absolute.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/parse_include_absrel.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/parse_include_affix_ref.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/parse_include_dir.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/parse_include_loop.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/parse_include_nonexistent.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/parse_include_prefix.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/parse_include_prefix_dup.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/parse_include_preprefix.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/parse_include_ref.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/parse_include_relabs.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/parse_include_relrel.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/parse_include_slash.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/parse_include_suffix.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/parse_include_sufsuffix.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/parse_index.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/parse_lincom.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/parse_lincom_ncols1.Po at am__quote@
@@ -6833,13 +8954,26 @@ distclean-compile:
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/parse_lincom_scalar.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/parse_linterp.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/parse_linterp_ncols.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/parse_malias.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/parse_malias_dup.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/parse_malias_meta.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/parse_meta.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/parse_meta_affix.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/parse_meta_alias.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/parse_meta_implicit.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/parse_meta_implicit2.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/parse_meta_implicit_affix.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/parse_meta_index.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/parse_meta_index2.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/parse_meta_jump.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/parse_meta_malias.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/parse_meta_meta.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/parse_meta_parent.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/parse_meta_raw.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/parse_mplex.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/parse_mplex_ncols.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/parse_mplex_nomax.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/parse_mplex_scalar.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/parse_multiply.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/parse_multiply_ncols.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/parse_name.Po at am__quote@
@@ -6876,10 +9010,18 @@ distclean-compile:
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/parse_string_ncols.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/parse_string_null.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/parse_version.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/parse_version_89.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/parse_version_98.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/parse_version_include.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/parse_version_p8.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/parse_version_p9.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/parse_version_permissive.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/parse_version_slash.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/parse_whitespace.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/parse_window.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/parse_window_ncols.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/parse_window_op.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/parse_window_scalar.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/protect_alter.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/protect_get.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/put64.Po at am__quote@
@@ -6915,6 +9057,8 @@ distclean-compile:
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/put_float64.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/put_foffs.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/put_fs.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/put_here.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/put_heres.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/put_int16.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/put_int32.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/put_int64.Po at am__quote@
@@ -6928,6 +9072,7 @@ distclean-compile:
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/put_linterp_nomono.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/put_linterp_notab.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/put_linterp_reverse.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/put_mplex.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/put_multiply.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/put_null.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/put_off64.Po at am__quote@
@@ -6951,6 +9096,8 @@ distclean-compile:
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/put_uint16.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/put_uint32.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/put_uint64.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/put_window.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/put_zero.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/ref.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/ref_none.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/ref_two.Po at am__quote@
@@ -6972,9 +9119,26 @@ distclean-compile:
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/repr_uint32.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/repr_uint64.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/repr_uint8.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/seek64.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/seek_cur.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/seek_end.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/seek_foffs.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/seek_neg.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/seek_set.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/sie_get_big.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/sie_get_little.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/sie_move_from.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/sie_move_to.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/sie_nframes_big.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/sie_nframes_little.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/sie_put_big.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/sie_put_little.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/slim_get.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/slim_nframes.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/spf.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/spf_alias.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/spf_alias_meta.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/spf_alias_missing.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/spf_divide.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/spf_lincom.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/spf_multiply.Po at am__quote@
@@ -6982,12 +9146,25 @@ distclean-compile:
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/spf_recip.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/spf_recurse.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/svlist.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/svlist_hidden.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/svlist_invalid.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/svlist_meta.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/svlist_meta_hidden.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/svlist_meta_invalid.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/table.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/table_code.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/table_type.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tell.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tell64.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tell_multidiv.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tok_arg.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tok_escape.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/tok_quote.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/trunc.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/trunc_dir.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/trunc_rdonly.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/trunc_rofs.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/trunc_truncsub.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/unclude.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/unclude_del.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/unclude_move.Po at am__quote@
@@ -7013,12 +9190,24 @@ distclean-compile:
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/version_8.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/version_8_strict.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/version_8_write.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/version_9.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/version_9_strict.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/version_9_write.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/vlist.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/vlist_alias.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/vlist_hidden.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/vlist_invalid.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/vlist_meta.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/vlist_meta_hidden.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/vlist_meta_invalid.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/xz_get.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/xz_nframes.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/zzip_data.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/zzip_get.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/zzip_get_get.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/zzip_nframes.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/zzslim_get.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/zzslim_nframes.Po at am__quote@
 
 .c.o:
 @am__fastdepCC_TRUE@	$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
@@ -7180,14 +9369,15 @@ check-TESTS: $(TESTS)
 	  fi; \
 	  dashes=`echo "$$dashes" | sed s/./=/g`; \
 	  if test "$$failed" -eq 0; then \
-	    echo "$$grn$$dashes"; \
+	    col="$$grn"; \
 	  else \
-	    echo "$$red$$dashes"; \
+	    col="$$red"; \
 	  fi; \
-	  echo "$$banner"; \
-	  test -z "$$skipped" || echo "$$skipped"; \
-	  test -z "$$report" || echo "$$report"; \
-	  echo "$$dashes$$std"; \
+	  echo "$${col}$$dashes$${std}"; \
+	  echo "$${col}$$banner$${std}"; \
+	  test -z "$$skipped" || echo "$${col}$$skipped$${std}"; \
+	  test -z "$$report" || echo "$${col}$$report$${std}"; \
+	  echo "$${col}$$dashes$${std}"; \
 	  test "$$failed" -eq 0; \
 	else :; fi
 
@@ -7237,10 +9427,15 @@ install-am: all-am
 
 installcheck: installcheck-am
 install-strip:
-	$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
-	  install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
-	  `test -z '$(STRIP)' || \
-	    echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+	if test -z '$(STRIP)'; then \
+	  $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+	    install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+	      install; \
+	else \
+	  $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+	    install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+	    "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
+	fi
 mostlyclean-generic:
 
 clean-generic:
@@ -7340,24 +9535,30 @@ uninstall-am:
 	tags uninstall uninstall-am
 
 
+# fast tests
+.PHONY: fastcheck
+fastcheck:
+	touch $(TESTS)
+	${MAKE} check
+
 # valgrind
 valgrind.log: $(TESTS)
 	rm -f $@; \
 		for x in $^; do ( \
 		echo $$x:; \
-		sed -e 's/exec "/exec valgrind --leak-check=full --track-origins=yes --track-fds=yes "/' $$x | sh; \
+		sed -e 's/exec "/exec valgrind --leak-check=full --track-origins=yes --track-fds=yes --suppressions=valgrind.suppressions "/' $$x | sh; \
 		echo $$x = $$? ); done &> $@;
 
 # clean up after the tests
 check-local: check-TESTS
-	$(MAKE) getdata-clean-dirs
+	$(MAKE) getdata-clean-dir
 
-getdata-clean-dirs:
-	rm -rvf *odirfile
+getdata-clean-dir:
+	rm -rf dirfile
 
 clean-local:
-	$(MAKE) getdata-clean-dirs
-	rm -rf *~ 
+	$(MAKE) getdata-clean-dir
+	rm -rf *~
 
 # Tell versions [3.59,3.63) of GNU make to not export all variables.
 # Otherwise a system limit (for SysV at least) may be exceeded.
diff --git a/test/add.c b/test/add.c
index 7914886..c90b82b 100644
--- a/test/add.c
+++ b/test/add.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Add a dirfile field */
 #include "test.h"
 
@@ -11,24 +31,17 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* data = __TEST__ "dirfile/data";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *data = "dirfile/data";
   int error, r = 0;
   DIRFILE *D;
   gd_entry_t E, e;
 
-  // remove stuff of failed tests
-  unlink(data);
-  unlink(format);
-  rmdir(filedir);
-#ifdef _WIN32
-  system("rmdir /q/s "__TEST__"dirfile");
-#endif
-  printf(format);
+  rmdirfile();
+  memset(&E, 0, sizeof(E));
   E.field = "data";
   E.field_type = GD_RAW_ENTRY;
-  E.fragment_index = 0;
   E.EN(raw,spf) = 2;
   E.EN(raw,data_type) = GD_UINT8;
   E.scalar[0] = NULL;
diff --git a/test/add_affix.c b/test/add_affix.c
new file mode 100644
index 0000000..d15b05a
--- /dev/null
+++ b/test/add_affix.c
@@ -0,0 +1,105 @@
+/* Copyright (C) 2011-2012 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+#include "test.h"
+
+int main(void)
+{
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *format1 = "dirfile/format1";
+  const char *data = "dirfile/data";
+  const char *format_data = "AconstZ CONST UINT8 3\n/INCLUDE format1 A Z\n";
+  int n, fd, e1, e2, e3, e4, e5, r = 0;
+  DIRFILE *D;
+  gd_entry_t E, e;
+
+  rmdirfile();
+  mkdir(filedir, 0777);
+
+  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
+  write(fd, format_data, strlen(format_data));
+  close(fd);
+
+  close(open(format1, O_CREAT | O_EXCL | O_WRONLY, 0666));
+
+  D = gd_open(filedir, GD_RDWR | GD_UNENCODED);
+
+  memset(&E, 0, sizeof(E));
+  E.field = "Adata1Z";
+  E.field_type = GD_RAW_ENTRY;
+  E.fragment_index = 1;
+  E.EN(raw,spf) = 2;
+  E.EN(raw,data_type) = GD_UINT8;
+  E.scalar[0] = NULL;
+
+  gd_add(D, &E);
+  e1 = gd_error(D);
+
+  memset(&E, 0, sizeof(E));
+  E.field = "Adata2Z";
+  E.field_type = GD_RAW_ENTRY;
+  E.fragment_index = 1;
+  E.EN(raw,spf) = 2;
+  E.EN(raw,data_type) = GD_UINT8;
+  E.scalar[0] = "const";
+
+  gd_add(D, &E);
+  e2 = gd_error(D);
+
+  memset(&E, 0, sizeof(E));
+  E.field = "Adata3Z";
+  E.field_type = GD_RAW_ENTRY;
+  E.fragment_index = 1;
+  E.EN(raw,spf) = 2;
+  E.EN(raw,data_type) = GD_UINT8;
+  E.scalar[0] = "AconstZ";
+
+  gd_add(D, &E);
+  e3 = gd_error(D);
+
+  /* check */
+  gd_entry(D, "Adata1Z", &e);
+  e4 = gd_error(D);
+  n = gd_spf(D, "Adata3Z");
+  e5 = gd_error(D);
+
+  gd_discard(D);
+
+  unlink(data);
+  unlink(format);
+  unlink(format1);
+  rmdir(filedir);
+
+  CHECKI(e1, GD_E_OK);
+  CHECKI(e2, GD_E_BAD_CODE);
+  CHECKI(e3, GD_E_OK);
+  CHECKI(e4, GD_E_OK);
+  CHECKI(e5, GD_E_OK);
+  CHECKI(n, 3);
+  CHECKI(e.field_type, GD_RAW_ENTRY);
+  CHECKI(e.fragment_index, 1);
+  CHECKI(e.EN(raw,spf), 2);
+  CHECKI(e.EN(raw,data_type), GD_UINT8);
+  CHECKP(e.scalar[0]);
+  gd_free_entry_strings(&e);
+
+  return r;
+}
diff --git a/test/add_alias.c b/test/add_alias.c
new file mode 100644
index 0000000..43a3599
--- /dev/null
+++ b/test/add_alias.c
@@ -0,0 +1,57 @@
+/* Copyright (C) 2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+#include "test.h"
+
+int main(void)
+{
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *data = "dirfile/data";
+  const char *target;
+  int error, i, n, r = 0;
+  DIRFILE *D;
+
+  rmdirfile();
+
+  D = gd_open(filedir, GD_RDWR | GD_CREAT | GD_VERBOSE);
+
+  gd_add_raw(D, "data", GD_UINT8, 1, 0);
+  gd_add_alias(D, "alias", "data", 0);
+  error = gd_error(D);
+
+  /* check */
+  target = gd_alias_target(D, "alias");
+  CHECKS(target, "data");
+  i = gd_fragment_index(D, "alias");
+  n = gd_naliases(D, "alias");
+
+  gd_discard(D);
+
+  unlink(data);
+  unlink(format);
+  rmdir(filedir);
+
+  CHECKI(error, GD_E_OK);
+  CHECKI(i, 0);
+  CHECKI(n, 2);
+
+  return r;
+}
diff --git a/test/add_alias_affix.c b/test/add_alias_affix.c
new file mode 100644
index 0000000..e412207
--- /dev/null
+++ b/test/add_alias_affix.c
@@ -0,0 +1,66 @@
+/* Copyright (C) 2012 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+#include "test.h"
+
+int main(void)
+{
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *format1 = "dirfile/format";
+  const char *data = "dirfile/data";
+  const char *target;
+  int e1, e2, e3, i, n, r = 0;
+  DIRFILE *D;
+
+  rmdirfile();
+
+  D = gd_open(filedir, GD_RDWR | GD_CREAT);
+
+  gd_include_affix(D, "format1", 0, "A", "Z", GD_CREAT);
+  gd_add_raw(D, "AdataZ", GD_UINT8, 1, 1);
+  gd_add_alias(D, "alias", "AdataZ", 1);
+  e1 = gd_error(D);
+  gd_add_alias(D, "AaliasZ", "data", 1);
+  e2 = gd_error(D);
+  gd_add_alias(D, "AaliasZ", "AdataZ", 1);
+  e3 = gd_error(D);
+
+  /* check */
+  target = gd_alias_target(D, "AaliasZ");
+  CHECKS(target, "AdataZ");
+  i = gd_fragment_index(D, "AaliasZ");
+  n = gd_naliases(D, "AaliasZ");
+
+  gd_discard(D);
+
+  unlink(data);
+  unlink(format);
+  unlink(format1);
+  rmdir(filedir);
+
+  CHECKI(e1, GD_E_BAD_CODE);
+  CHECKI(e2, GD_E_BAD_CODE);
+  CHECKI(e3, GD_E_OK);
+  CHECKI(i, 1);
+  CHECKI(n, 2);
+
+  return r;
+}
diff --git a/test/add_alias_meta.c b/test/add_alias_meta.c
new file mode 100644
index 0000000..86af86d
--- /dev/null
+++ b/test/add_alias_meta.c
@@ -0,0 +1,57 @@
+/* Copyright (C) 2012 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+#include "test.h"
+
+int main(void)
+{
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *data = "dirfile/data";
+  const char *target;
+  int error, i, n, r = 0;
+  DIRFILE *D;
+
+  rmdirfile();
+
+  D = gd_open(filedir, GD_RDWR | GD_CREAT | GD_VERBOSE);
+
+  gd_add_raw(D, "data", GD_UINT8, 1, 0);
+  gd_add_alias(D, "data/alias", "data", 0);
+  error = gd_error(D);
+
+  /* check */
+  target = gd_alias_target(D, "data/alias");
+  CHECKS(target, "data");
+  i = gd_fragment_index(D, "data/alias");
+  n = gd_naliases(D, "data/alias");
+
+  gd_discard(D);
+
+  unlink(data);
+  unlink(format);
+  rmdir(filedir);
+
+  CHECKI(error, GD_E_OK);
+  CHECKI(i, 0);
+  CHECKI(n, 2);
+
+  return r;
+}
diff --git a/test/add_bit.c b/test/add_bit.c
index f89e5eb..5b32c2a 100644
--- a/test/add_bit.c
+++ b/test/add_bit.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Add a BIT field */
 #include "test.h"
 
@@ -11,11 +31,14 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
   int error, r = 0;
   gd_entry_t e;
-  DIRFILE* D = gd_open(filedir, GD_RDWR | GD_CREAT | GD_VERBOSE);
+  DIRFILE *D;
+
+  rmdirfile();
+  D = gd_open(filedir, GD_RDWR | GD_CREAT | GD_VERBOSE);
 
   gd_add_bit(D, "new", "input", 1, 1, 0);
   error = gd_error(D);
diff --git a/test/add_bit_bitnum.c b/test/add_bit_bitnum.c
index 954dbbd..fc47c8c 100644
--- a/test/add_bit_bitnum.c
+++ b/test/add_bit_bitnum.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Add a BIT field */
 #include "test.h"
 
@@ -10,10 +30,13 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
   int error, n, r = 0;
-  DIRFILE* D = gd_open(filedir, GD_RDWR | GD_CREAT);
+  DIRFILE *D;
+
+  rmdirfile();
+  D = gd_open(filedir, GD_RDWR | GD_CREAT);
 
   gd_add_bit(D, "new", "input", -1, 1, 0);
   error = gd_error(D);
diff --git a/test/add_bit_bitsize.c b/test/add_bit_bitsize.c
index dc707f0..c861d30 100644
--- a/test/add_bit_bitsize.c
+++ b/test/add_bit_bitsize.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Add a BIT field */
 #include "test.h"
 
@@ -10,10 +30,13 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
   int error, n, r = 0;
-  DIRFILE* D = gd_open(filedir, GD_RDWR | GD_CREAT);
+  DIRFILE *D;
+
+  rmdirfile();
+  D = gd_open(filedir, GD_RDWR | GD_CREAT);
 
   gd_add_bit(D, "new", "input", 1, 99, 0);
   error = gd_error(D);
diff --git a/test/add_bit_invalid.c b/test/add_bit_invalid.c
index 21b4a74..c62fa04 100644
--- a/test/add_bit_invalid.c
+++ b/test/add_bit_invalid.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Getting data from an invalid dirfile should fail cleanly */
 #include "test.h"
 
@@ -9,9 +29,12 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  DIRFILE* D = gd_open(filedir, GD_RDONLY);
+  const char *filedir = "dirfile";
   int error, r = 0;
+  DIRFILE *D;
+
+  rmdirfile();
+  D = gd_open(filedir, GD_RDONLY);
 
   gd_add_bit(D, "new", "input", 1, 1, 0);
   error = gd_error(D);
diff --git a/test/add_bit_numbits.c b/test/add_bit_numbits.c
index c4619e3..533a047 100644
--- a/test/add_bit_numbits.c
+++ b/test/add_bit_numbits.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Add a BIT field */
 #include "test.h"
 
@@ -10,10 +30,13 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
   int error, n, r = 0;
-  DIRFILE* D = gd_open(filedir, GD_RDWR | GD_CREAT);
+  DIRFILE *D;
+
+  rmdirfile();
+  D = gd_open(filedir, GD_RDWR | GD_CREAT);
 
   gd_add_bit(D, "new", "input", 1, 0, 0);
   error = gd_error(D);
diff --git a/test/add_carray.c b/test/add_carray.c
index 1e59989..27d5a3b 100644
--- a/test/add_carray.c
+++ b/test/add_carray.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2010-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 #include "test.h"
 
 #include <inttypes.h>
@@ -11,14 +31,17 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
   uint8_t val[] = {3, 4, 5, 6, 7};
   uint8_t data[5];
   int n, error;
   int r = 0;
   gd_entry_t e;
-  DIRFILE* D = gd_open(filedir, GD_RDWR | GD_CREAT | GD_VERBOSE);
+  DIRFILE *D;
+
+  rmdirfile();
+  D = gd_open(filedir, GD_RDWR | GD_CREAT | GD_VERBOSE);
 
   gd_add_carray(D, "data", GD_UINT8, 5, GD_UINT8, &val, 0);
   error = gd_error(D);
diff --git a/test/add_clincom.c b/test/add_clincom.c
index 91b955b..76258a0 100644
--- a/test/add_clincom.c
+++ b/test/add_clincom.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2009-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Add a complex LINCOM field */
 #include "test.h"
 
@@ -12,11 +32,10 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-
-  DIRFILE* D = gd_open(filedir, GD_RDWR | GD_CREAT | GD_VERBOSE);
-  const char* in_fields[2] = {"in1", "in2"};
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  DIRFILE *D;
+  const char *in_fields[2] = {"in1", "in2"};
 #ifdef GD_NO_C99_API
   const double m[4] = {1, 3.3, 0.3, 18.3};
   const double b[4] = {2, 3.8, 2.1, 9.8};
@@ -27,6 +46,9 @@ int main(void)
   int error, r = 0;
   gd_entry_t e;
 
+  rmdirfile();
+  D = gd_open(filedir, GD_RDWR | GD_CREAT | GD_VERBOSE);
+
   gd_add_clincom(D, "new", 2, in_fields, m, b, 0);
   error = gd_error(D);
 
diff --git a/test/add_code.c b/test/add_code.c
index f4f0418..49042d1 100644
--- a/test/add_code.c
+++ b/test/add_code.c
@@ -1,17 +1,29 @@
-/* Add a dirfile field with invalid characters */
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 #include "test.h"
 
-#include <stdlib.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-#include <string.h>
-#include <errno.h>
-
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
   int error, n, r = 0;
   gd_entry_t E;
   DIRFILE *D;
@@ -22,6 +34,7 @@ int main(void)
   E.EN(raw,spf) = 2;
   E.EN(raw,data_type) = GD_UINT8;
 
+  rmdirfile();
   D = gd_open(filedir, GD_RDWR | GD_CREAT);
   gd_add(D, &E);
   error = gd_error(D);
diff --git a/test/add_const.c b/test/add_const.c
index 203f193..dac48c8 100644
--- a/test/add_const.c
+++ b/test/add_const.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Add a CONST field */
 #include "test.h"
 
@@ -12,13 +32,15 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
   uint8_t val = 3;
   int error, r = 0;
   gd_entry_t e;
+  DIRFILE *D;
 
-  DIRFILE* D = gd_open(filedir, GD_RDWR | GD_CREAT | GD_VERBOSE);
+  rmdirfile();
+  D = gd_open(filedir, GD_RDWR | GD_CREAT | GD_VERBOSE);
   gd_add_const(D, "data", GD_UINT8, GD_UINT8, &val, 0);
   error = gd_error(D);
 
diff --git a/test/add_cpolynom.c b/test/add_cpolynom.c
index 4443697..4a99f53 100644
--- a/test/add_cpolynom.c
+++ b/test/add_cpolynom.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2009-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Add a complex POLYNOM field */
 #include "test.h"
 
@@ -12,19 +32,21 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
   int r = 0;
   int error, j;
   gd_entry_t e;
-
-  DIRFILE* D = gd_open(filedir, GD_RDWR | GD_CREAT | GD_VERBOSE);
+  DIRFILE *D;
 #ifdef GD_NO_C99_API
   const double a[8] = {1, 29.03, 0.3, 12.34, 0.5, 99.55, 1.8, 45.32};
 #else
   const double complex a[4] = {1 + _Complex_I * 29.03, 0.3 + _Complex_I * 12.34,
     0.5 + _Complex_I * 99.55, 1.8 + _Complex_I * 45.32};
 #endif
+
+  rmdirfile();
+  D = gd_open(filedir, GD_RDWR | GD_CREAT | GD_VERBOSE);
   gd_add_cpolynom(D, "new", 3, "in", a, 0);
   error = gd_error(D);
 
diff --git a/test/add_crecip.c b/test/add_crecip.c
index a68bd9c..c66d7fb 100644
--- a/test/add_crecip.c
+++ b/test/add_crecip.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2010-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 #include "test.h"
 
 #include <stdlib.h>
@@ -10,8 +30,8 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
   int error, r = 0;
 #ifdef GD_NO_C99_API
   const double cdividend[2] = {33.3, 44.4};
@@ -19,7 +39,10 @@ int main(void)
   const double complex cdividend = 33.3 + _Complex_I * 44.4;
 #endif
   gd_entry_t e;
-  DIRFILE* D = gd_open(filedir, GD_RDWR | GD_CREAT | GD_VERBOSE);
+  DIRFILE *D;
+
+  rmdirfile();
+  D = gd_open(filedir, GD_RDWR | GD_CREAT | GD_VERBOSE);
 
   gd_add_crecip(D, "new", "in", cdividend, 0);
   error = gd_error(D);
diff --git a/test/add_crecip89.c b/test/add_crecip89.c
index 10e4edd..909b086 100644
--- a/test/add_crecip89.c
+++ b/test/add_crecip89.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2010-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 #define GD_C89_API
 #include "test.h"
 
@@ -11,13 +31,15 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
   int error, r = 0;
   gd_entry_t e;
   double dividend[2] = {33.3, 44.4}; 
+  DIRFILE *D;
 
-  DIRFILE* D = gd_open(filedir, GD_RDWR | GD_CREAT | GD_VERBOSE);
+  rmdirfile();
+  D = gd_open(filedir, GD_RDWR | GD_CREAT | GD_VERBOSE);
   gd_add_crecip(D, "new", "in", dividend, 0);
   error = gd_error(D);
 
diff --git a/test/add_divide.c b/test/add_divide.c
index eb2ecd2..43e6941 100644
--- a/test/add_divide.c
+++ b/test/add_divide.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2010-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 #include "test.h"
 
 #include <stdlib.h>
@@ -10,11 +30,14 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
   int error, r = 0;
   gd_entry_t e;
-  DIRFILE* D = gd_open(filedir, GD_RDWR | GD_CREAT | GD_VERBOSE);
+  DIRFILE *D;
+
+  rmdirfile();
+  D = gd_open(filedir, GD_RDWR | GD_CREAT | GD_VERBOSE);
 
   gd_add_divide(D, "new", "in1", "in2", 0);
   error = gd_error(D);
diff --git a/test/add_divide_invalid.c b/test/add_divide_invalid.c
index ae089f4..c53bd8d 100644
--- a/test/add_divide_invalid.c
+++ b/test/add_divide_invalid.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2010-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Getting data from an invalid dirfile should fail cleanly */
 #include "test.h"
 
@@ -9,10 +29,12 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
+  const char *filedir = "dirfile";
   int error, r = 0;
+  DIRFILE *D;
 
-  DIRFILE* D = gd_open(filedir, GD_RDONLY);
+  rmdirfile();
+  D = gd_open(filedir, GD_RDONLY);
   gd_add_multiply(D, "new", "in1", "in2", 0);
   error = gd_error(D);
   gd_close(D);
diff --git a/test/add_duplicate.c b/test/add_duplicate.c
index a519060..4d378ce 100644
--- a/test/add_duplicate.c
+++ b/test/add_duplicate.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Add a dirfile field */
 #include "test.h"
 
@@ -10,9 +30,9 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* format_data = "data RAW UINT8 8\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *format_data = "data RAW UINT8 8\n";
   int r = 0;
   int fd, error, n;
   gd_entry_t E;
@@ -24,6 +44,7 @@ int main(void)
   E.EN(raw,spf) = 2;
   E.EN(raw,data_type) = GD_UINT8;
 
+  rmdirfile();
   mkdir(filedir, 0777);
 
   fd = open(format, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
diff --git a/test/add_format.c b/test/add_format.c
index 9eff799..6a99e90 100644
--- a/test/add_format.c
+++ b/test/add_format.c
@@ -1,17 +1,29 @@
-/* Add a dirfile field with to a bad fragment_index */
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 #include "test.h"
 
-#include <stdlib.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-#include <string.h>
-#include <errno.h>
-
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
   int error, n, r = 0;
   DIRFILE *D;
   gd_entry_t E;
@@ -22,6 +34,7 @@ int main(void)
   E.EN(raw,spf) = 2;
   E.EN(raw,data_type) = GD_UINT8;
 
+  rmdirfile();
   D = gd_open(filedir, GD_RDWR | GD_CREAT);
   gd_add(D, &E);
   error = gd_error(D);
diff --git a/test/add_invalid.c b/test/add_invalid.c
index 853705f..59e70f8 100644
--- a/test/add_invalid.c
+++ b/test/add_invalid.c
@@ -1,15 +1,28 @@
-/* Getting data from an invalid dirfile should fail cleanly */
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 #include "test.h"
 
-#include <stdlib.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-#include <string.h>
-
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
+  const char *filedir = "dirfile";
   int error, r = 0;
   DIRFILE *D;
 
@@ -20,6 +33,7 @@ int main(void)
   E.EN(raw,spf) = 2;
   E.EN(raw,data_type) = GD_UINT8;
 
+  rmdirfile();
   D = gd_open(filedir, GD_RDONLY);
   gd_add(D, &E);
   error = gd_error(D);
diff --git a/test/add_lincom.c b/test/add_lincom.c
index 74573e6..11f960f 100644
--- a/test/add_lincom.c
+++ b/test/add_lincom.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Add a LINCOM field */
 #include "test.h"
 
@@ -12,16 +32,18 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
   int error, r = 0;
-
-  DIRFILE* D = gd_open(filedir, GD_RDWR | GD_CREAT | GD_VERBOSE);
-  const char* in_fields[2] = {"in1", "in2"};
+  DIRFILE *D;
+  const char *in_fields[2] = {"in1", "in2"};
   const double m[2] = {1, 0.3};
   const double b[2] = {5, 0.9};
   gd_entry_t e;
 
+  rmdirfile();
+  D = gd_open(filedir, GD_RDWR | GD_CREAT | GD_VERBOSE);
+
   gd_add_lincom(D, "new", 2, in_fields, m, b, 0);
   error = gd_error(D);
 
diff --git a/test/add_lincom_affix.c b/test/add_lincom_affix.c
new file mode 100644
index 0000000..a87bd97
--- /dev/null
+++ b/test/add_lincom_affix.c
@@ -0,0 +1,86 @@
+/* Copyright (C) 2012 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+/* Add a LINCOM field */
+#include "test.h"
+
+#include <stdlib.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <string.h>
+#include <errno.h>
+#include <stdio.h>
+#include <math.h>
+
+int main(void)
+{
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *format1 = "dirfile/format1";
+  int e1, e2, e3, r = 0;
+  DIRFILE *D;
+  const char *in_fields[2] = {"in1", "in2"};
+  const char *Ain_fieldsZ[2] = {"Ain1Z", "Ain2Z"};
+  const double m[2] = {1, 0.3};
+  const double b[2] = {5, 0.9};
+  gd_entry_t e;
+
+  rmdirfile();
+  D = gd_open(filedir, GD_RDWR | GD_CREAT);
+  gd_include_affix(D, "format1", 0, "A", "Z", GD_CREAT);
+
+  gd_add_lincom(D, "new", 2, Ain_fieldsZ, m, b, 1);
+  e1 = gd_error(D);
+  gd_add_lincom(D, "AnewZ", 2, in_fields, m, b, 1);
+  e2 = gd_error(D);
+  gd_add_lincom(D, "AnewZ", 2, Ain_fieldsZ, m, b, 1);
+  e3 = gd_error(D);
+
+  /* check */
+  gd_entry(D, "AnewZ", &e);
+  if (gd_error(D))
+    r = 1;
+  else {
+    CHECKI(e.field_type, GD_LINCOM_ENTRY);
+    CHECKI(e.fragment_index, 1);
+    CHECKI(e.EN(lincom,n_fields), 2);
+    CHECKS(e.in_fields[0], "Ain1Z");
+    CHECKS(e.in_fields[1], "Ain2Z");
+    CHECKF(e.EN(lincom,m)[0], m[0]);
+    CHECKF(e.EN(lincom,m)[1], m[1]);
+    CHECKF(e.EN(lincom,b)[0], b[0]);
+    CHECKF(e.EN(lincom,b)[1], b[1]);
+    CHECKI(e.comp_scal, 0);
+    gd_free_entry_strings(&e);
+  }
+
+  gd_close(D);
+
+  unlink(format1);
+  unlink(format);
+  rmdir(filedir);
+
+  CHECKI(e1, GD_E_BAD_CODE);
+  CHECKI(e2, GD_E_BAD_CODE);
+  CHECKI(e3, GD_E_OK);
+  
+  return r;
+}
diff --git a/test/add_lincom_invalid.c b/test/add_lincom_invalid.c
index 8b915f4..8980ffd 100644
--- a/test/add_lincom_invalid.c
+++ b/test/add_lincom_invalid.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Getting data from an invalid dirfile should fail cleanly */
 #include "test.h"
 
@@ -9,13 +29,15 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
+  const char *filedir = "dirfile";
   int error, r = 0;
-
-  DIRFILE* D = gd_open(filedir, GD_RDONLY);
-  const char* in_fields[2] = {"in1", "in2"};
+  DIRFILE *D;
+  const char *in_fields[2] = {"in1", "in2"};
   const double m[2] = {1, 0.3};
   const double b[2] = {0, 0.9};
+
+  rmdirfile();
+  D = gd_open(filedir, GD_RDONLY);
   gd_add_lincom(D, "new", 2, in_fields, m, b, 0);
   error = gd_error(D);
   gd_close(D);
diff --git a/test/add_lincom_nfields.c b/test/add_lincom_nfields.c
index 5c83d86..cfe60ce 100644
--- a/test/add_lincom_nfields.c
+++ b/test/add_lincom_nfields.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Add a LINCOM field */
 #include "test.h"
 
@@ -10,14 +30,16 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
   int error, n, r = 0;
-
-  DIRFILE* D = gd_open(filedir, GD_RDWR | GD_CREAT);
-  const char* in_fields[2] = {"in1", "in2"};
+  DIRFILE *D;
+  const char *in_fields[2] = {"in1", "in2"};
   const double m[2] = {1, 0.3};
   const double b[2] = {0, 0.9};
+
+  rmdirfile();
+  D = gd_open(filedir, GD_RDWR | GD_CREAT);
   gd_add_lincom(D, "new", 0, in_fields, m, b, 0);
   error = gd_error(D);
 
diff --git a/test/add_linterp.c b/test/add_linterp.c
index 0a13609..514fcd3 100644
--- a/test/add_linterp.c
+++ b/test/add_linterp.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Add a LINTERP field */
 #include "test.h"
 
@@ -11,12 +31,14 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
   int error, r = 0;
   gd_entry_t e;
+  DIRFILE *D;
 
-  DIRFILE* D = gd_open(filedir, GD_RDWR | GD_CREAT | GD_VERBOSE);
+  rmdirfile();
+  D = gd_open(filedir, GD_RDWR | GD_CREAT | GD_VERBOSE);
   gd_add_linterp(D, "new", "in", "table", 0);
   error = gd_error(D);
 
diff --git a/test/add_linterp_invalid.c b/test/add_linterp_invalid.c
index ce8ff5b..11d1250 100644
--- a/test/add_linterp_invalid.c
+++ b/test/add_linterp_invalid.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Getting data from an invalid dirfile should fail cleanly */
 #include "test.h"
 
@@ -9,10 +29,12 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
+  const char *filedir = "dirfile";
   int error, r = 0;
+  DIRFILE *D;
 
-  DIRFILE* D = gd_open(filedir, GD_RDONLY);
+  rmdirfile();
+  D = gd_open(filedir, GD_RDONLY);
   gd_add_linterp(D, "new", "in", "table", 0);
   error = gd_error(D);
   gd_close(D);
diff --git a/test/add_meta.c b/test/add_meta.c
new file mode 100644
index 0000000..07c4c41
--- /dev/null
+++ b/test/add_meta.c
@@ -0,0 +1,76 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+/* Add a dirfile field */
+#include "test.h"
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <string.h>
+#include <errno.h>
+
+int main(void)
+{
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *data = "dirfile/data";
+  int e1, e2, r = 0;
+  DIRFILE *D;
+  gd_entry_t E, e;
+
+  rmdirfile();
+  memset(&E, 0, sizeof(E));
+  E.field = "data";
+  E.field_type = GD_CONST_ENTRY;
+  E.fragment_index = 0;
+  E.EN(scalar,const_type) = GD_UINT8;
+
+  D = gd_open(filedir, GD_RDWR | GD_CREAT | GD_VERBOSE);
+  gd_add(D, &E);
+  e1 = gd_error(D);
+  E.field = "data/data";
+  gd_add(D, &E);
+  e2 = gd_error(D);
+
+  /* check */
+  gd_entry(D, "data/data", &e);
+  if (gd_error(D))
+    r = 1;
+  else {
+    CHECKI(e.field_type, GD_CONST_ENTRY);
+    CHECKI(e.fragment_index, 0);
+    CHECKI(e.EN(scalar,const_type), GD_UINT8);
+    gd_free_entry_strings(&e);
+  }
+
+  gd_close(D);
+
+  unlink(data);
+  unlink(format);
+  rmdir(filedir);
+
+  CHECKI(e1, GD_E_OK);
+  CHECKI(e2, GD_E_OK);
+
+  return r;
+}
diff --git a/test/add_meta_alias.c b/test/add_meta_alias.c
new file mode 100644
index 0000000..96ab508
--- /dev/null
+++ b/test/add_meta_alias.c
@@ -0,0 +1,79 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+/* Add a dirfile field */
+#include "test.h"
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <string.h>
+#include <errno.h>
+
+int main(void)
+{
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *data = "dirfile/data";
+  int e1, e2, e3, r = 0;
+  DIRFILE *D;
+  gd_entry_t E, e;
+
+  rmdirfile();
+  memset(&E, 0, sizeof(E));
+  E.field = "data";
+  E.field_type = GD_CONST_ENTRY;
+  E.fragment_index = 0;
+  E.EN(scalar,const_type) = GD_UINT8;
+
+  D = gd_open(filedir, GD_RDWR | GD_CREAT | GD_VERBOSE);
+  gd_add(D, &E);
+  e1 = gd_error(D);
+  gd_add_alias(D, "alias", "data", 0);
+  e2 = gd_error(D);
+  E.field = "alias/data";
+  gd_add(D, &E);
+  e3 = gd_error(D);
+
+  /* check */
+  gd_entry(D, "data/data", &e);
+  if (gd_error(D))
+    r = 1;
+  else {
+    CHECKI(e.field_type, GD_CONST_ENTRY);
+    CHECKI(e.fragment_index, 0);
+    CHECKI(e.EN(scalar,const_type), GD_UINT8);
+    gd_free_entry_strings(&e);
+  }
+
+  gd_close(D);
+
+  unlink(data);
+  unlink(format);
+  rmdir(filedir);
+
+  CHECKI(e1, GD_E_OK);
+  CHECKI(e2, GD_E_OK);
+  CHECKI(e3, GD_E_OK);
+
+  return r;
+}
diff --git a/test/add_mplex.c b/test/add_mplex.c
new file mode 100644
index 0000000..68b116d
--- /dev/null
+++ b/test/add_mplex.c
@@ -0,0 +1,58 @@
+/* Copyright (C) 2012 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+#include "test.h"
+
+int main(void)
+{
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  int error, r = 0;
+  gd_entry_t e;
+  DIRFILE *D;
+
+  rmdirfile();
+  D = gd_open(filedir, GD_RDWR | GD_CREAT | GD_VERBOSE);
+  gd_add_mplex(D, "new", "in", "count", 3, 4, 0);
+  error = gd_error(D);
+
+  /* check */
+  gd_entry(D, "new", &e);
+  if (gd_error(D))
+    r = 1;
+  else {
+    CHECKI(e.field_type, GD_MPLEX_ENTRY);
+    CHECKS(e.in_fields[0], "in");
+    CHECKS(e.in_fields[1], "count");
+    CHECKI(e.fragment_index, 0);
+    CHECKI(e.EN(mplex,count_val), 3);
+    CHECKF(e.EN(mplex,period), 4);
+    gd_free_entry_strings(&e);
+  }
+
+  gd_close(D);
+
+  unlink(format);
+  rmdir(filedir);
+
+  CHECKI(error, GD_E_OK);
+
+  return r;
+}
diff --git a/test/add_mplex_val.c b/test/add_mplex_val.c
new file mode 100644
index 0000000..e497e0c
--- /dev/null
+++ b/test/add_mplex_val.c
@@ -0,0 +1,43 @@
+/* Copyright (C) 2012 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+#include "test.h"
+
+int main(void)
+{
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  int error, r = 0;
+  DIRFILE *D;
+
+  rmdirfile();
+  D = gd_open(filedir, GD_RDWR | GD_CREAT);
+  gd_add_mplex(D, "new", "in", "count", 4, -3, 0);
+  error = gd_error(D);
+
+  gd_close(D);
+
+  unlink(format);
+  rmdir(filedir);
+
+  CHECKI(error, GD_E_BAD_ENTRY);
+
+  return r;
+}
diff --git a/test/add_multiply.c b/test/add_multiply.c
index c1900f6..cc65a99 100644
--- a/test/add_multiply.c
+++ b/test/add_multiply.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Add a MULTIPLY field */
 #include "test.h"
 
@@ -11,12 +31,14 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
   int error, r = 0;
   gd_entry_t e;
+  DIRFILE *D;
 
-  DIRFILE* D = gd_open(filedir, GD_RDWR | GD_CREAT | GD_VERBOSE);
+  rmdirfile();
+  D = gd_open(filedir, GD_RDWR | GD_CREAT | GD_VERBOSE);
   gd_add_multiply(D, "new", "in1", "in2", 0);
   error = gd_error(D);
 
diff --git a/test/add_multiply_invalid.c b/test/add_multiply_invalid.c
index ae089f4..55a43ca 100644
--- a/test/add_multiply_invalid.c
+++ b/test/add_multiply_invalid.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Getting data from an invalid dirfile should fail cleanly */
 #include "test.h"
 
@@ -9,10 +29,12 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
+  const char *filedir = "dirfile";
   int error, r = 0;
+  DIRFILE *D;
 
-  DIRFILE* D = gd_open(filedir, GD_RDONLY);
+  rmdirfile();
+  D = gd_open(filedir, GD_RDONLY);
   gd_add_multiply(D, "new", "in1", "in2", 0);
   error = gd_error(D);
   gd_close(D);
diff --git a/test/add_phase.c b/test/add_phase.c
index e17a8b4..c801031 100644
--- a/test/add_phase.c
+++ b/test/add_phase.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Add a PHASE field */
 #include "test.h"
 
@@ -11,12 +31,14 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
   int error, r = 0;
   gd_entry_t e;
+  DIRFILE *D;
 
-  DIRFILE* D = gd_open(filedir, GD_RDWR | GD_CREAT | GD_VERBOSE);
+  rmdirfile();
+  D = gd_open(filedir, GD_RDWR | GD_CREAT | GD_VERBOSE);
   gd_add_phase(D, "new", "in", 3, 0);
   error = gd_error(D);
 
diff --git a/test/add_phase_invalid.c b/test/add_phase_invalid.c
index aae7e39..269e6ad 100644
--- a/test/add_phase_invalid.c
+++ b/test/add_phase_invalid.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Getting data from an invalid dirfile should fail cleanly */
 #include "test.h"
 
@@ -9,10 +29,12 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
+  const char *filedir = "dirfile";
   int error, r = 0;
+  DIRFILE *D;
 
-  DIRFILE* D = gd_open(filedir, GD_RDONLY);
+  rmdirfile();
+  D = gd_open(filedir, GD_RDONLY);
   gd_add_phase(D, "new", "in", 3, 0);
   error = gd_error(D);
   gd_close(D);
diff --git a/test/add_polynom.c b/test/add_polynom.c
index 8dbd9b1..9bb7437 100644
--- a/test/add_polynom.c
+++ b/test/add_polynom.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2009-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Add a POLYNOM field */
 #include "test.h"
 
@@ -12,14 +32,16 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
   int r = 0;
   int j, error;
   gd_entry_t e;
-
-  DIRFILE* D = gd_open(filedir, GD_RDWR | GD_CREAT | GD_VERBOSE);
+  DIRFILE *D;
   const double a[4] = {1, 0.3, 0.5, 1.8};
+
+  rmdirfile();
+  D = gd_open(filedir, GD_RDWR | GD_CREAT | GD_VERBOSE);
   gd_add_polynom(D, "new", 3, "in", a, 0);
   error = gd_error(D);
 
diff --git a/test/add_protect.c b/test/add_protect.c
index 7cb7437..2fcd142 100644
--- a/test/add_protect.c
+++ b/test/add_protect.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Add a dirfile field */
 #include "test.h"
 
@@ -10,9 +30,9 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* format_data = "data RAW UINT8 8\nPROTECT all\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *format_data = "data RAW UINT8 8\nPROTECT all\n";
   int fd, error, n, r = 0;
   DIRFILE *D;
   gd_entry_t E;
@@ -23,6 +43,7 @@ int main(void)
   E.EN(raw,spf) = 2;
   E.EN(raw,data_type) = GD_UINT8;
 
+  rmdirfile();
   mkdir(filedir, 0777);
 
   fd = open(format, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
diff --git a/test/add_raw.c b/test/add_raw.c
index 351050c..f2efa8c 100644
--- a/test/add_raw.c
+++ b/test/add_raw.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Add a RAW field */
 #include "test.h"
 
@@ -11,13 +31,15 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* data = __TEST__ "dirfile/data";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *data = "dirfile/data";
   gd_entry_t e;
   int error, r = 0;
+  DIRFILE *D;
 
-  DIRFILE* D = gd_open(filedir, GD_RDWR | GD_CREAT | GD_VERBOSE);
+  rmdirfile();
+  D = gd_open(filedir, GD_RDWR | GD_CREAT | GD_VERBOSE);
   gd_add_raw(D, "data", GD_UINT8, 2, 0);
   error = gd_error(D);
 
@@ -35,8 +57,10 @@ int main(void)
 
   gd_close(D);
 
-  if (unlink(data))
+  if (unlink(data)) {
+    perror("unlink");
     r = 1;
+  }
   unlink(format);
   rmdir(filedir);
 
diff --git a/test/add_raw_include.c b/test/add_raw_include.c
index c263982..d7fc411 100644
--- a/test/add_raw_include.c
+++ b/test/add_raw_include.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Add a RAW field */
 #include "test.h"
 
@@ -11,15 +31,17 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* format1 = __TEST__ "dirfile/format1";
-  const char* data = __TEST__ "dirfile/data";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *format1 = "dirfile/format1";
+  const char *data = "dirfile/data";
   gd_entry_t e;
-  int error, r = 0;
+  int frag, error, r = 0;
+  DIRFILE *D;
 
-  DIRFILE* D = gd_open(filedir, GD_RDWR | GD_CREAT | GD_UNENCODED | GD_VERBOSE);
-  int frag = gd_include(D, "format1", 0, GD_CREAT);
+  rmdirfile();
+  D = gd_open(filedir, GD_RDWR | GD_CREAT | GD_UNENCODED | GD_VERBOSE);
+  frag = gd_include(D, "format1", 0, GD_CREAT);
 
   gd_add_raw(D, "data", GD_UINT8, 2, frag);
   error = gd_error(D);
diff --git a/test/add_raw_invalid.c b/test/add_raw_invalid.c
index 33fb3e2..cfb66d6 100644
--- a/test/add_raw_invalid.c
+++ b/test/add_raw_invalid.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Getting data from an invalid dirfile should fail cleanly */
 #include "test.h"
 
@@ -9,10 +29,12 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
+  const char *filedir = "dirfile";
   int error, r = 0;
+  DIRFILE *D;
 
-  DIRFILE* D = gd_open(filedir, GD_RDONLY);
+  rmdirfile();
+  D = gd_open(filedir, GD_RDONLY);
   gd_add_raw(D, "data", GD_UINT8, 2, 0);
   error = gd_error(D);
   gd_close(D);
diff --git a/test/add_raw_spf.c b/test/add_raw_spf.c
index 55befc6..420c64b 100644
--- a/test/add_raw_spf.c
+++ b/test/add_raw_spf.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Add a RAW field */
 #include "test.h"
 
@@ -10,11 +30,13 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
   int error, n, r = 0;
+  DIRFILE *D;
 
-  DIRFILE* D = gd_open(filedir, GD_RDWR | GD_CREAT);
+  rmdirfile();
+  D = gd_open(filedir, GD_RDWR | GD_CREAT);
   gd_add_raw(D, "new", GD_UINT8, 0, 0);
   error = gd_error(D);
 
diff --git a/test/add_raw_type.c b/test/add_raw_type.c
index 2c18ded..d28b5c5 100644
--- a/test/add_raw_type.c
+++ b/test/add_raw_type.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Add a RAW field */
 #include "test.h"
 
@@ -10,11 +30,13 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
   int error, n, r = 0;
+  DIRFILE *D;
 
-  DIRFILE* D = gd_open(filedir, GD_RDWR | GD_CREAT);
+  rmdirfile();
+  D = gd_open(filedir, GD_RDWR | GD_CREAT);
   gd_add_raw(D, "new", (gd_type_t)'c', 2, 0);
   error = gd_error(D);
 
diff --git a/test/add_rdonly.c b/test/add_rdonly.c
index 52626ae..09232db 100644
--- a/test/add_rdonly.c
+++ b/test/add_rdonly.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Add a dirfile field to a read-only dirfile*/
 #include "test.h"
 
@@ -10,9 +30,9 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* format_data = "data RAW UINT8 8\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *format_data = "data RAW UINT8 8\n";
   int fd, error, n, r = 0;
   DIRFILE *D;
 
@@ -23,6 +43,7 @@ int main(void)
   E.EN(raw,spf) = 2;
   E.EN(raw,data_type) = GD_UINT8;
 
+  rmdirfile();
   mkdir(filedir, 0777);
 
   fd = open(format, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
diff --git a/test/add_recip.c b/test/add_recip.c
index 3ff76c7..e73b3b1 100644
--- a/test/add_recip.c
+++ b/test/add_recip.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2010-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 #include "test.h"
 
 #include <stdlib.h>
@@ -10,12 +30,14 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
   int error, r = 0;
   gd_entry_t e;
+  DIRFILE *D;
 
-  DIRFILE* D = gd_open(filedir, GD_RDWR | GD_CREAT | GD_VERBOSE);
+  rmdirfile();
+  D = gd_open(filedir, GD_RDWR | GD_CREAT | GD_VERBOSE);
   gd_add_recip(D, "new", "in", 33.3, 0);
   error = gd_error(D);
 
diff --git a/test/add_resolv.c b/test/add_resolv.c
new file mode 100644
index 0000000..8bd2fa4
--- /dev/null
+++ b/test/add_resolv.c
@@ -0,0 +1,57 @@
+/* Copyright (C) 2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+#include "test.h"
+
+int main(void)
+{
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *data = "dirfile/data";
+  int error, i, n, r = 0;
+  DIRFILE *D;
+  const char *target;
+
+  rmdirfile();
+
+  D = gd_open(filedir, GD_RDWR | GD_CREAT | GD_VERBOSE);
+
+  gd_add_alias(D, "alias", "data", 0);
+  gd_add_raw(D, "data", GD_UINT8, 1, 0);
+  error = gd_error(D);
+
+  /* check */
+  target = gd_alias_target(D, "alias");
+  CHECKS(target, "data");
+  i = gd_fragment_index(D, "alias");
+  n = gd_naliases(D, "alias");
+
+  gd_discard(D);
+
+  unlink(data);
+  unlink(format);
+  rmdir(filedir);
+
+  CHECKI(error, GD_E_OK);
+  CHECKI(i, 0);
+  CHECKI(n, 2);
+
+  return r;
+}
diff --git a/test/add_sbit.c b/test/add_sbit.c
index 1991bc8..da51dad 100644
--- a/test/add_sbit.c
+++ b/test/add_sbit.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2009-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Add a SBIT field */
 #include "test.h"
 
@@ -11,12 +31,14 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
   int error, r = 0;
   gd_entry_t e;
+  DIRFILE *D;
 
-  DIRFILE* D = gd_open(filedir, GD_RDWR | GD_CREAT | GD_VERBOSE);
+  rmdirfile();
+  D = gd_open(filedir, GD_RDWR | GD_CREAT | GD_VERBOSE);
   gd_add_sbit(D, "new", "input", 1, 1, 0);
   error = gd_error(D);
 
diff --git a/test/add_scalar.c b/test/add_scalar.c
index 2f09f54..bd79f6e 100644
--- a/test/add_scalar.c
+++ b/test/add_scalar.c
@@ -1,23 +1,34 @@
-/* Add a dirfile field */
+/* Copyright (C) 2009-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 #include "test.h"
 
-#include <stdlib.h>
-#include <stdio.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-#include <string.h>
-#include <errno.h>
-#include <math.h>
-
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
   int error, r = 0;
   DIRFILE *D;
 
   gd_entry_t E, e;
+  memset(&E, 0, sizeof(E));
   E.field = "data";
   E.field_type = GD_LINCOM_ENTRY;
   E.fragment_index = 0;
@@ -28,6 +39,7 @@ int main(void)
   E.scalar[0] = NULL;
   E.scalar[0 + GD_MAX_LINCOM] = "c";
 
+  rmdirfile();
   D = gd_open(filedir, GD_RDWR | GD_CREAT | GD_VERBOSE);
   gd_add_spec(D, "c CONST INT64 4", 0);
   gd_add(D, &E);
diff --git a/test/add_scalar_carray.c b/test/add_scalar_carray.c
new file mode 100644
index 0000000..7bd34ee
--- /dev/null
+++ b/test/add_scalar_carray.c
@@ -0,0 +1,73 @@
+/* Copyright (C) 2009-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+#include "test.h"
+
+int main(void)
+{
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  int error, r = 0;
+  DIRFILE *D;
+
+  gd_entry_t E, e;
+  memset(&E, 0, sizeof(E));
+  E.field = "data";
+  E.field_type = GD_LINCOM_ENTRY;
+  E.fragment_index = 0;
+  E.EN(lincom,n_fields) = 1;
+  E.comp_scal = 0;
+  E.in_fields[0] = "INDEX";
+  E.EN(lincom,m)[0] = 1.;
+  E.scalar[0] = NULL;
+  E.scalar[0 + GD_MAX_LINCOM] = "c";
+  E.scalar_ind[0 + GD_MAX_LINCOM] = 3;
+
+  rmdirfile();
+  D = gd_open(filedir, GD_RDWR | GD_CREAT | GD_VERBOSE);
+  gd_add_spec(D, "c CARRAY INT64 1 2 3 4", 0);
+  gd_add(D, &E);
+  error = gd_error(D);
+
+  /* check */
+  gd_entry(D, "data", &e);
+  if (gd_error(D))
+    r = 1;
+  else {
+    CHECKI(e.field_type, GD_LINCOM_ENTRY);
+    CHECKI(e.fragment_index, 0);
+    CHECKI(e.EN(lincom,n_fields), 1);
+    CHECKF(e.EN(lincom,m)[0], 1);
+    CHECKF(e.EN(lincom,b)[0], 4);
+    CHECKP(e.scalar[0]);
+    CHECKS(e.scalar[0 + GD_MAX_LINCOM], "c");
+    CHECKI(e.scalar_ind[0 + GD_MAX_LINCOM], 3);
+    gd_free_entry_strings(&e);
+  }
+
+  gd_close(D);
+
+  unlink(format);
+  rmdir(filedir);
+
+  CHECKI(error, GD_E_OK);
+
+  return r;
+}
diff --git a/test/add_scalar_carray_bad.c b/test/add_scalar_carray_bad.c
new file mode 100644
index 0000000..c410e42
--- /dev/null
+++ b/test/add_scalar_carray_bad.c
@@ -0,0 +1,73 @@
+/* Copyright (C) 2013 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+#include "test.h"
+
+int main(void)
+{
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  int error, r = 0;
+  DIRFILE *D;
+
+  gd_entry_t E, e;
+  memset(&E, 0, sizeof(E));
+  E.field = "data";
+  E.field_type = GD_LINCOM_ENTRY;
+  E.fragment_index = 0;
+  E.EN(lincom,n_fields) = 1;
+  E.comp_scal = 0;
+  E.in_fields[0] = "INDEX";
+  E.EN(lincom,m)[0] = 1.;
+  E.scalar[0] = NULL;
+  E.scalar[0 + GD_MAX_LINCOM] = "c";
+  E.scalar_ind[0 + GD_MAX_LINCOM] = -1;
+
+  rmdirfile();
+  D = gd_open(filedir, GD_RDWR | GD_CREAT | GD_VERBOSE);
+  gd_add_spec(D, "c CARRAY INT64 1 2 3 4", 0);
+  gd_add(D, &E);
+  error = gd_error(D);
+
+  /* check */
+  gd_entry(D, "data", &e);
+  if (gd_error(D))
+    r = 1;
+  else {
+    CHECKI(e.field_type, GD_LINCOM_ENTRY);
+    CHECKI(e.fragment_index, 0);
+    CHECKI(e.EN(lincom,n_fields), 1);
+    CHECKF(e.EN(lincom,m)[0], 1);
+    CHECKF(e.EN(lincom,b)[0], 1);
+    CHECKP(e.scalar[0]);
+    CHECKS(e.scalar[0 + GD_MAX_LINCOM], "c");
+    CHECKI(e.scalar_ind[0 + GD_MAX_LINCOM], 0);
+    gd_free_entry_strings(&e);
+  }
+
+  gd_close(D);
+
+  unlink(format);
+  rmdir(filedir);
+
+  CHECKI(error, GD_E_OK);
+
+  return r;
+}
diff --git a/test/add_sort.c b/test/add_sort.c
index 20f3175..cb8c1d8 100644
--- a/test/add_sort.c
+++ b/test/add_sort.c
@@ -1,11 +1,28 @@
-/* Field sort test for dirfile_add */
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 #include "test.h"
-#include <stdio.h>
-#include <stdlib.h>
 
 int r = 0;
 
-void CheckSPF(DIRFILE *D, const char* f, int v)
+void CheckSPF(DIRFILE *D, const char *f, unsigned int v)
 {
   gd_entry_t e;
 
@@ -23,22 +40,22 @@ void CheckSPF(DIRFILE *D, const char* f, int v)
 
 int main (void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* a = __TEST__ "dirfile/a";
-  const char* b = __TEST__ "dirfile/b";
-  const char* c = __TEST__ "dirfile/c";
-  const char* d = __TEST__ "dirfile/d";
-  const char* e = __TEST__ "dirfile/e";
-  const char* f = __TEST__ "dirfile/f";
-  const char* g = __TEST__ "dirfile/g";
-  const char* h = __TEST__ "dirfile/h";
-  const char* i = __TEST__ "dirfile/i";
-  const char* j = __TEST__ "dirfile/j";
-  const char* k = __TEST__ "dirfile/k";
-
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *a = "dirfile/a";
+  const char *b = "dirfile/b";
+  const char *c = "dirfile/c";
+  const char *d = "dirfile/d";
+  const char *e = "dirfile/e";
+  const char *f = "dirfile/f";
+  const char *g = "dirfile/g";
+  const char *h = "dirfile/h";
+  const char *i = "dirfile/i";
+  const char *j = "dirfile/j";
+  const char *k = "dirfile/k";
   DIRFILE *D;
 
+  rmdirfile();
   D = gd_open(filedir, GD_RDWR | GD_CREAT | GD_EXCL | GD_VERBOSE);
   gd_add_raw(D, "d", GD_FLOAT64, 1, 0);
   gd_add_raw(D, "b", GD_FLOAT64, 2, 0);
diff --git a/test/add_spec.c b/test/add_spec.c
index 37d4118..30cef8d 100644
--- a/test/add_spec.c
+++ b/test/add_spec.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Add a RAW field */
 #include "test.h"
 
@@ -11,13 +31,15 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* data = __TEST__ "dirfile/data";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *data = "dirfile/data";
   int error, r = 0;
   gd_entry_t e;
+  DIRFILE *D;
 
-  DIRFILE* D = gd_open(filedir, GD_RDWR | GD_CREAT | GD_VERBOSE);
+  rmdirfile();
+  D = gd_open(filedir, GD_RDWR | GD_CREAT | GD_VERBOSE);
   gd_add_spec(D, "data RAW UINT8 2", 0);
   error = gd_error(D);
 
diff --git a/test/add_spec_directive.c b/test/add_spec_directive.c
index 645a373..c775c13 100644
--- a/test/add_spec_directive.c
+++ b/test/add_spec_directive.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Add a RAW field */
 #include "test.h"
 
@@ -10,12 +30,14 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* data = __TEST__ "dirfile/INCLUDE";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *data = "dirfile/INCLUDE";
   int error, n, r = 0;
+  DIRFILE *D;
 
-  DIRFILE* D = gd_open(filedir, GD_RDWR | GD_CREAT);
+  rmdirfile();
+  D = gd_open(filedir, GD_RDWR | GD_CREAT);
   gd_dirfile_standards(D, 7);
   gd_add_spec(D, "INCLUDE RAW UINT8 2", 0);
   error = gd_error(D);
diff --git a/test/add_spec_invalid.c b/test/add_spec_invalid.c
index f71210c..755c948 100644
--- a/test/add_spec_invalid.c
+++ b/test/add_spec_invalid.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Getting data from an invalid dirfile should fail cleanly */
 #include "test.h"
 
@@ -9,10 +29,12 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
+  const char *filedir = "dirfile";
   int error, r = 0;
+  DIRFILE *D;
 
-  DIRFILE* D = gd_open(filedir, GD_RDONLY);
+  rmdirfile();
+  D = gd_open(filedir, GD_RDONLY);
   gd_add_spec(D, "data RAW UINT8 2", 0);
   error = gd_error(D);
   gd_close(D);
diff --git a/test/add_spec_meta.c b/test/add_spec_meta.c
index 48ca364..24e8340 100644
--- a/test/add_spec_meta.c
+++ b/test/add_spec_meta.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2009-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* add a barth-style meta field with add_spec */
 #include "test.h"
 
@@ -11,13 +31,15 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
   int error, n, r = 0;
   gd_entry_t e;
   unsigned char val;
+  DIRFILE *D;
 
-  DIRFILE* D = gd_open(filedir, GD_RDWR | GD_CREAT | GD_VERBOSE);
+  rmdirfile();
+  D = gd_open(filedir, GD_RDWR | GD_CREAT | GD_VERBOSE);
   gd_add_spec(D, "INDEX/meta CONST UINT8 2", 0);
   error = gd_error(D);
 
diff --git a/test/add_spec_resolv.c b/test/add_spec_resolv.c
new file mode 100644
index 0000000..c028be9
--- /dev/null
+++ b/test/add_spec_resolv.c
@@ -0,0 +1,57 @@
+/* Copyright (C) 2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+#include "test.h"
+
+int main(void)
+{
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *data = "dirfile/data";
+  int error, i, n, r = 0;
+  DIRFILE *D;
+  const char *target;
+
+  rmdirfile();
+
+  D = gd_open(filedir, GD_RDWR | GD_CREAT | GD_VERBOSE);
+
+  gd_add_alias(D, "alias", "data", 0);
+  gd_add_spec(D, "data RAW UINT8 1", 0);
+  error = gd_error(D);
+
+  /* check */
+  target = gd_alias_target(D, "alias");
+  CHECKS(target, "data");
+  i = gd_fragment_index(D, "alias");
+  n = gd_naliases(D, "alias");
+
+  gd_discard(D);
+
+  unlink(data);
+  unlink(format);
+  rmdir(filedir);
+
+  CHECKI(error, GD_E_OK);
+  CHECKI(i, 0);
+  CHECKI(n, 2);
+
+  return r;
+}
diff --git a/test/add_string.c b/test/add_string.c
index 7938ed5..b372406 100644
--- a/test/add_string.c
+++ b/test/add_string.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Add a RAW field */
 #include "test.h"
 
@@ -12,13 +32,15 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
   int error, r = 0;
   gd_entry_t e;
   char val[1000];
+  DIRFILE *D;
 
-  DIRFILE* D = gd_open(filedir, GD_RDWR | GD_CREAT | GD_VERBOSE);
+  rmdirfile();
+  D = gd_open(filedir, GD_RDWR | GD_CREAT | GD_VERBOSE);
   gd_add_string(D, "data", "A string.", 0);
   error = gd_error(D);
 
diff --git a/test/add_string_affix.c b/test/add_string_affix.c
new file mode 100644
index 0000000..02ead8e
--- /dev/null
+++ b/test/add_string_affix.c
@@ -0,0 +1,62 @@
+/* Copyright (C) 2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+#include "test.h"
+
+int main(void)
+{
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *format1 = "dirfile/format1";
+  const char *data = "dirfile/data";
+  const char *format_data = "/INCLUDE format1 A Z\n";
+  int fd, e1, e2, r = 0;
+  char val[1000];
+  DIRFILE *D;
+
+  rmdirfile();
+  mkdir(filedir, 0777);
+
+  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
+  write(fd, format_data, strlen(format_data));
+  close(fd);
+
+  close(open(format1, O_CREAT | O_EXCL | O_WRONLY, 0666));
+
+  D = gd_open(filedir, GD_RDWR | GD_UNENCODED | GD_VERBOSE);
+  gd_add_string(D, "AdataZ", "A string.", 1);
+  e1 = gd_error(D);
+
+  /* check */
+  gd_get_string(D, "AdataZ", 1000, val);
+  e2 = gd_error(D);
+  gd_close(D);
+
+  unlink(data);
+  unlink(format);
+  unlink(format1);
+  rmdir(filedir);
+
+  CHECKI(e1, GD_E_OK);
+  CHECKI(e2, GD_E_OK);
+  CHECKS(val, "A string.");
+
+  return r;
+}
diff --git a/test/add_type.c b/test/add_type.c
index 2b9e5f6..05135d7 100644
--- a/test/add_type.c
+++ b/test/add_type.c
@@ -1,17 +1,29 @@
-/* Add a dirfile field with bad entry type */
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 #include "test.h"
 
-#include <stdlib.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-#include <string.h>
-#include <errno.h>
-
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
   int error, n, r = 0;
   DIRFILE *D;
 
@@ -22,6 +34,7 @@ int main(void)
   E.EN(raw,spf) = 2;
   E.EN(raw,data_type) = GD_UINT8;
 
+  rmdirfile();
   D = gd_open(filedir, GD_RDWR | GD_CREAT);
   gd_add(D, &E);
   error = gd_error(D);
diff --git a/test/add_window.c b/test/add_window.c
new file mode 100644
index 0000000..8f0c871
--- /dev/null
+++ b/test/add_window.c
@@ -0,0 +1,60 @@
+/* Copyright (C) 2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+#include "test.h"
+
+int main(void)
+{
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  int error, r = 0;
+  gd_entry_t e;
+  gd_triplet_t threshold;
+  DIRFILE *D;
+
+  rmdirfile();
+  D = gd_open(filedir, GD_RDWR | GD_CREAT | GD_VERBOSE);
+  threshold.r = 3.4;
+  gd_add_window(D, "new", "in", "check", GD_WINDOP_GE, threshold, 0);
+  error = gd_error(D);
+
+  /* check */
+  gd_entry(D, "new", &e);
+  if (gd_error(D))
+    r = 1;
+  else {
+    CHECKI(e.field_type, GD_WINDOW_ENTRY);
+    CHECKS(e.in_fields[0], "in");
+    CHECKS(e.in_fields[1], "check");
+    CHECKI(e.fragment_index, 0);
+    CHECKI(e.EN(window,windop), GD_WINDOP_GE);
+    CHECKF(e.EN(window,threshold.r), 3.4);
+    gd_free_entry_strings(&e);
+  }
+
+  gd_close(D);
+
+  unlink(format);
+  rmdir(filedir);
+
+  CHECKI(error, GD_E_OK);
+
+  return r;
+}
diff --git a/test/add_window_op.c b/test/add_window_op.c
new file mode 100644
index 0000000..515c244
--- /dev/null
+++ b/test/add_window_op.c
@@ -0,0 +1,54 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+/* Add a WINDOW field */
+#include "test.h"
+
+#include <stdlib.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <string.h>
+#include <errno.h>
+#include <stdio.h>
+
+int main(void)
+{
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  int error, r = 0;
+  gd_triplet_t threshold;
+  DIRFILE *D;
+
+  rmdirfile();
+  D = gd_open(filedir, GD_RDWR | GD_CREAT);
+  threshold.r = 3.4;
+  gd_add_window(D, "new", "in", "check", (gd_windop_t)-1, threshold, 0);
+  error = gd_error(D);
+
+  gd_close(D);
+
+  unlink(format);
+  rmdir(filedir);
+
+  CHECKI(error, GD_E_BAD_ENTRY);
+
+  return r;
+}
diff --git a/test/alias_list.c b/test/alias_list.c
new file mode 100644
index 0000000..c7c3d62
--- /dev/null
+++ b/test/alias_list.c
@@ -0,0 +1,71 @@
+/* Copyright (C) 2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+#include "test.h"
+
+int main(void)
+{
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *format_data =
+    "/ALIAS e f\n"
+    "/ALIAS a b\n"
+    "/ALIAS b d\n"
+    "/ALIAS c d\n"
+    "/ALIAS d f\n"
+    "f CONST UINT8 1\n";
+  int fd, e, i = 0, r = 0;
+  int x[256];
+  DIRFILE *D;
+  const char **al;
+
+  rmdirfile();
+  mkdir(filedir, 0777);
+
+  memset(x, 0, 256 * sizeof(int));
+
+  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
+  write(fd, format_data, strlen(format_data));
+  close(fd);
+
+  D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
+
+  al = gd_aliases(D, "f");
+  e = gd_error(D);
+
+  CHECKI(e, GD_E_OK);
+  CHECKPN(al);
+
+  if (!r)
+    for (i = 0; al[i]; ++i) {
+      CHECKUi(i, al[i][1], 0);
+      x[(int)(al[i][0])]++;
+    }
+
+  CHECKI(i, 6);
+  for (i = 0; i < 256; ++i)
+    CHECKIi(i, x[i], (i >= 'a' && i <= 'f') ? 1 : 0);
+
+  gd_close(D);
+  unlink(format);
+  rmdir(filedir);
+
+  return r;
+}
diff --git a/test/alias_list_alias.c b/test/alias_list_alias.c
new file mode 100644
index 0000000..55991e7
--- /dev/null
+++ b/test/alias_list_alias.c
@@ -0,0 +1,71 @@
+/* Copyright (C) 2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+#include "test.h"
+
+int main(void)
+{
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *format_data =
+    "/ALIAS e f\n"
+    "/ALIAS a b\n"
+    "/ALIAS b d\n"
+    "/ALIAS c d\n"
+    "/ALIAS d f\n"
+    "f CONST UINT8 1\n";
+  int fd, e, i = 0, r = 0;
+  int x[256];
+  DIRFILE *D;
+  const char **al;
+
+  rmdirfile();
+  mkdir(filedir, 0777);
+
+  memset(x, 0, 256 * sizeof(int));
+
+  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
+  write(fd, format_data, strlen(format_data));
+  close(fd);
+
+  D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
+
+  al = gd_aliases(D, "a");
+  e = gd_error(D);
+
+  CHECKI(e, GD_E_OK);
+  CHECKPN(al);
+
+  if (!r)
+    for (i = 0; al[i]; ++i) {
+      CHECKUi(i, al[i][1], 0);
+      x[(int)(al[i][0])]++;
+    }
+
+  CHECKI(i, 6);
+  for (i = 0; i < 256; ++i)
+    CHECKIi(i, x[i], (i >= 'a' && i <= 'f') ? 1 : 0);
+
+  gd_close(D);
+  unlink(format);
+  rmdir(filedir);
+
+  return r;
+}
diff --git a/test/alias_list_missing.c b/test/alias_list_missing.c
new file mode 100644
index 0000000..4473365
--- /dev/null
+++ b/test/alias_list_missing.c
@@ -0,0 +1,57 @@
+/* Copyright (C) 2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+#include "test.h"
+
+int main(void)
+{
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *format_data =
+    "/ALIAS e f\n"
+    "/ALIAS a b\n"
+    "/ALIAS b d\n"
+    "/ALIAS c d\n"
+    "/ALIAS d f\n";
+  int fd, e, r = 0;
+  DIRFILE *D;
+  const char **al;
+
+  rmdirfile();
+  mkdir(filedir, 0777);
+
+  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
+  write(fd, format_data, strlen(format_data));
+  close(fd);
+
+  D = gd_open(filedir, GD_RDONLY);
+
+  al = gd_aliases(D, "a");
+  e = gd_error(D);
+
+  CHECKI(e, GD_E_BAD_CODE);
+  CHECKP(al);
+
+  gd_close(D);
+  unlink(format);
+  rmdir(filedir);
+
+  return r;
+}
diff --git a/test/alias_num.c b/test/alias_num.c
new file mode 100644
index 0000000..24a9d01
--- /dev/null
+++ b/test/alias_num.c
@@ -0,0 +1,57 @@
+/* Copyright (C) 2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+#include "test.h"
+
+int main(void)
+{
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *format_data =
+    "/ALIAS e f\n"
+    "/ALIAS a b\n"
+    "/ALIAS b d\n"
+    "/ALIAS c d\n"
+    "/ALIAS d f\n"
+    "f CONST UINT8 1\n";
+  int fd, e, n, r = 0;
+  DIRFILE *D;
+
+  rmdirfile();
+  mkdir(filedir, 0777);
+
+  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
+  write(fd, format_data, strlen(format_data));
+  close(fd);
+
+  D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
+
+  n = gd_naliases(D, "f");
+  e = gd_error(D);
+
+  CHECKI(e, GD_E_OK);
+  CHECKI(n, 6);
+
+  gd_close(D);
+  unlink(format);
+  rmdir(filedir);
+
+  return r;
+}
diff --git a/test/alias_num_alias.c b/test/alias_num_alias.c
new file mode 100644
index 0000000..6bc4d55
--- /dev/null
+++ b/test/alias_num_alias.c
@@ -0,0 +1,57 @@
+/* Copyright (C) 2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+#include "test.h"
+
+int main(void)
+{
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *format_data =
+    "/ALIAS e f\n"
+    "/ALIAS a b\n"
+    "/ALIAS b d\n"
+    "/ALIAS c d\n"
+    "/ALIAS d f\n"
+    "f CONST UINT8 1\n";
+  int fd, e, n, r = 0;
+  DIRFILE *D;
+
+  rmdirfile();
+  mkdir(filedir, 0777);
+
+  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
+  write(fd, format_data, strlen(format_data));
+  close(fd);
+
+  D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
+
+  n = gd_naliases(D, "a");
+  e = gd_error(D);
+
+  CHECKI(e, GD_E_OK);
+  CHECKI(n, 6);
+
+  gd_close(D);
+  unlink(format);
+  rmdir(filedir);
+
+  return r;
+}
diff --git a/test/alias_num_missing.c b/test/alias_num_missing.c
new file mode 100644
index 0000000..a81f00e
--- /dev/null
+++ b/test/alias_num_missing.c
@@ -0,0 +1,56 @@
+/* Copyright (C) 2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+#include "test.h"
+
+int main(void)
+{
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *format_data =
+    "/ALIAS e f\n"
+    "/ALIAS a b\n"
+    "/ALIAS b d\n"
+    "/ALIAS c d\n"
+    "/ALIAS d f\n";
+  int fd, e, n, r = 0;
+  DIRFILE *D;
+
+  rmdirfile();
+  mkdir(filedir, 0777);
+
+  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
+  write(fd, format_data, strlen(format_data));
+  close(fd);
+
+  D = gd_open(filedir, GD_RDONLY);
+
+  n = gd_naliases(D, "a");
+  e = gd_error(D);
+
+  CHECKI(e, GD_E_BAD_CODE);
+  CHECKI(n, -1);
+
+  gd_close(D);
+  unlink(format);
+  rmdir(filedir);
+
+  return r;
+}
diff --git a/test/alias_target.c b/test/alias_target.c
new file mode 100644
index 0000000..cb9ca02
--- /dev/null
+++ b/test/alias_target.c
@@ -0,0 +1,52 @@
+/* Copyright (C) 2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+#include "test.h"
+
+int main(void)
+{
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *format_data = "/ALIAS alias target\ntarget CONST UINT8 1\n";
+  int fd, e, r = 0;
+  DIRFILE *D;
+  const char *t;
+
+  rmdirfile();
+  mkdir(filedir, 0777);
+
+  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
+  write(fd, format_data, strlen(format_data));
+  close(fd);
+
+  D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
+
+  t = gd_alias_target(D, "alias");
+  CHECKS(t, "target");
+  e = gd_error(D);
+
+  CHECKI(e, GD_E_OK);
+
+  gd_close(D);
+  unlink(format);
+  rmdir(filedir);
+
+  return r;
+}
diff --git a/test/alias_target_alias.c b/test/alias_target_alias.c
new file mode 100644
index 0000000..fc147bc
--- /dev/null
+++ b/test/alias_target_alias.c
@@ -0,0 +1,52 @@
+/* Copyright (C) 2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+#include "test.h"
+
+int main(void)
+{
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *format_data = "/ALIAS alias target\n/ALIAS target next\n";
+  int fd, e, r = 0;
+  DIRFILE *D;
+  const char *t;
+
+  rmdirfile();
+  mkdir(filedir, 0777);
+
+  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
+  write(fd, format_data, strlen(format_data));
+  close(fd);
+
+  D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
+
+  t = gd_alias_target(D, "alias");
+  CHECKS(t, "target");
+  e = gd_error(D);
+
+  CHECKI(e, GD_E_OK);
+
+  gd_close(D);
+  unlink(format);
+  rmdir(filedir);
+
+  return r;
+}
diff --git a/test/alias_target_missing.c b/test/alias_target_missing.c
new file mode 100644
index 0000000..0a56170
--- /dev/null
+++ b/test/alias_target_missing.c
@@ -0,0 +1,52 @@
+/* Copyright (C) 2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+#include "test.h"
+
+int main(void)
+{
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *format_data = "/ALIAS alias target\n";
+  int fd, e, r = 0;
+  DIRFILE *D;
+  const char *t;
+
+  rmdirfile();
+  mkdir(filedir, 0777);
+
+  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
+  write(fd, format_data, strlen(format_data));
+  close(fd);
+
+  D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
+
+  t = gd_alias_target(D, "alias");
+  CHECKS(t, "target");
+  e = gd_error(D);
+
+  CHECKI(e, GD_E_OK);
+
+  gd_close(D);
+  unlink(format);
+  rmdir(filedir);
+
+  return r;
+}
diff --git a/test/alter_bit_bitnum.c b/test/alter_bit_bitnum.c
index dbf5b1f..a6f457d 100644
--- a/test/alter_bit_bitnum.c
+++ b/test/alter_bit_bitnum.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Test field modifying */
 #include "test.h"
 
@@ -12,15 +32,16 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* data = __TEST__ "dirfile/data";
-  const char* format_data = "data RAW UINT8 8\nbit BIT data 1 1\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *data = "dirfile/data";
+  const char *format_data = "data RAW UINT8 8\nbit BIT data 1 1\n";
   unsigned char data_data[256];
   unsigned char c[8];
   int fd, i, ret, error, n, r = 0;
   DIRFILE *D;
 
+  rmdirfile();
   mkdir(filedir, 0777);
 
   for (fd = 0; fd < 256; ++fd)
diff --git a/test/alter_bit_numbits.c b/test/alter_bit_numbits.c
index 48739e6..6ac9778 100644
--- a/test/alter_bit_numbits.c
+++ b/test/alter_bit_numbits.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Test field modifying */
 #include "test.h"
 
@@ -12,15 +32,16 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* data = __TEST__ "dirfile/data";
-  const char* format_data = "data RAW UINT8 8\nbit BIT data 1 1\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *data = "dirfile/data";
+  const char *format_data = "data RAW UINT8 8\nbit BIT data 1 1\n";
   unsigned char data_data[256];
   unsigned char c[8];
   int fd, i, ret, error, n, r = 0;
   DIRFILE *D;
 
+  rmdirfile();
   mkdir(filedir, 0777);
 
   for (fd = 0; fd < 256; ++fd)
diff --git a/test/alter_carray_len.c b/test/alter_carray_len.c
index 81d6621..8b1861b 100644
--- a/test/alter_carray_len.c
+++ b/test/alter_carray_len.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2010-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Test field modifying */
 #include "test.h"
 
@@ -12,14 +32,15 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* format_data = "carray CARRAY FLOAT32 8.3 7.2 6.1 5.0 3.9 2.8 1.7\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *format_data = "carray CARRAY FLOAT32 8.3 7.2 6.1 5.0 3.9 2.8 1.7\n";
   int fd, i, ret, error, n, r = 0;
   size_t z;
   DIRFILE *D;
   double d[5];
 
+  rmdirfile();
   mkdir(filedir, 0777);
 
   fd = open(format, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
diff --git a/test/alter_carray_type.c b/test/alter_carray_type.c
index bdd1f75..914ba2d 100644
--- a/test/alter_carray_type.c
+++ b/test/alter_carray_type.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2010-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Test field modifying */
 #include "test.h"
 
@@ -12,14 +32,15 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* format_data = "carray CARRAY FLOAT32 8.3 7.2 6.1 5.0 3.9 2.8 1.7\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *format_data = "carray CARRAY FLOAT32 8.3 7.2 6.1 5.0 3.9 2.8 1.7\n";
   int fd, i, ret, error, n, r = 0;
   size_t z;
   DIRFILE *D;
   double d[7];
 
+  rmdirfile();
   mkdir(filedir, 0777);
 
   fd = open(format, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
diff --git a/test/alter_const.c b/test/alter_const.c
index 4655e39..58a52db 100644
--- a/test/alter_const.c
+++ b/test/alter_const.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2013 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Test field modifying */
 #include "test.h"
 
@@ -12,13 +32,14 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* format_data = "const CONST FLOAT32 8.3\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *format_data = "const CONST FLOAT32 8.3\n";
   int fd, ret, error, n, r = 0;
   DIRFILE *D;
   double d;
 
+  rmdirfile();
   mkdir(filedir, 0777);
 
   fd = open(format, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
diff --git a/test/alter_const_c2r.c b/test/alter_const_c2r.c
new file mode 100644
index 0000000..dda81ab
--- /dev/null
+++ b/test/alter_const_c2r.c
@@ -0,0 +1,65 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+/* Test field modifying */
+#include "test.h"
+
+#include <stdlib.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <string.h>
+#include <inttypes.h>
+#include <errno.h>
+#include <stdio.h>
+
+int main(void)
+{
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *format_data = "const CONST COMPLEX128 8.3;9.4\n";
+  int fd, ret, error, n, r = 0;
+  DIRFILE *D;
+  double d;
+
+  rmdirfile();
+  mkdir(filedir, 0777);
+
+  fd = open(format, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
+  write(fd, format_data, strlen(format_data));
+  close(fd);
+
+  D = gd_open(filedir, GD_RDWR | GD_VERBOSE);
+  ret = gd_alter_const(D, "const", GD_FLOAT64);
+  error = gd_error(D);
+  n = gd_get_constant(D, "const", GD_FLOAT64, &d);
+
+  gd_close(D);
+
+  unlink(format);
+  rmdir(filedir);
+
+  CHECKI(error, 0);
+  CHECKI(n, 0);
+  CHECKI(ret, 0);
+  CHECKF(d, 8.3);
+
+  return r;
+}
diff --git a/test/alter_cpolynom.c b/test/alter_cpolynom.c
index ed6f3a3..b3c2bd5 100644
--- a/test/alter_cpolynom.c
+++ b/test/alter_cpolynom.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2009-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Test field modifying */
 #include "test.h"
 
@@ -12,10 +32,10 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* data = __TEST__ "dirfile/data";
-  const char* format_data = "data RAW INT32 8\n"
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *data = "dirfile/data";
+  const char *format_data = "data RAW INT32 8\n"
     "polynom POLYNOM data 1 2 1\n";
   int32_t data_data[256];
 #ifdef GD_NO_C99_API
@@ -29,6 +49,7 @@ int main(void)
   int fd, i, ret, error, n, r = 0;
   DIRFILE *D;
 
+  rmdirfile();
   mkdir(filedir, 0777);
 
   for (fd = 0; fd < 256; ++fd)
diff --git a/test/alter_crecip.c b/test/alter_crecip.c
index 77fae1b..e5490db 100644
--- a/test/alter_crecip.c
+++ b/test/alter_crecip.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2010-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Test field modifying */
 #include "test.h"
 
@@ -12,10 +32,10 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* data = __TEST__ "dirfile/data";
-  const char* format_data = "data RAW INT32 8\nphase PHASE data 1\n"
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *data = "dirfile/data";
+  const char *format_data = "data RAW INT32 8\nphase PHASE data 1\n"
     "div RECIP data 230.\n";
   int32_t data_data[256];
   double c[8];
@@ -27,6 +47,7 @@ int main(void)
   int fd, i, ret, error, n, r = 0;
   DIRFILE *D;
 
+  rmdirfile();
   mkdir(filedir, 0777);
 
   for (fd = 0; fd < 256; ++fd)
diff --git a/test/alter_crecip89.c b/test/alter_crecip89.c
index 3c05158..f10cf07 100644
--- a/test/alter_crecip89.c
+++ b/test/alter_crecip89.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2010-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Test field modifying */
 #define GD_C89_API
 #include "test.h"
@@ -13,10 +33,10 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* data = __TEST__ "dirfile/data";
-  const char* format_data = "data RAW INT32 8\nphase PHASE data 1\n"
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *data = "dirfile/data";
+  const char *format_data = "data RAW INT32 8\nphase PHASE data 1\n"
     "div RECIP data 230.\n";
   int32_t data_data[256];
   int fd, ret, error, n, r = 0;
@@ -24,6 +44,7 @@ int main(void)
   double div[2] = {1093., 3290.};
   gd_entry_t E;
 
+  rmdirfile();
   mkdir(filedir, 0777);
 
   for (fd = 0; fd < 256; ++fd)
diff --git a/test/alter_crecip_zero.c b/test/alter_crecip_zero.c
index 52745f9..1360596 100644
--- a/test/alter_crecip_zero.c
+++ b/test/alter_crecip_zero.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Test field modifying */
 #include "test.h"
 
@@ -12,21 +32,17 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* data = __TEST__ "dirfile/data";
-  const char* format_data = "data RAW INT32 8\nphase PHASE data 1\n"
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *data = "dirfile/data";
+  const char *format_data = "data RAW INT32 8\nphase PHASE data 1\n"
     "div RECIP data 230.\n";
   int32_t data_data[256];
   double c[8];
-#ifdef GD_NO_C99_API
-  double v[2] = {1093, 3290};
-#else
-  double complex v = 1093 + _Complex_I * 3290;
-#endif
   int fd, i, ret, error, n, r = 0;
   DIRFILE *D;
 
+  rmdirfile();
   mkdir(filedir, 0777);
 
   for (fd = 0; fd < 256; ++fd)
diff --git a/test/alter_divide.c b/test/alter_divide.c
index 61dd0cb..fcbffac 100644
--- a/test/alter_divide.c
+++ b/test/alter_divide.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2010-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Test field modifying */
 #include "test.h"
 
@@ -12,16 +32,17 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* data = __TEST__ "dirfile/data";
-  const char* format_data = "data RAW INT32 8\nphase PHASE data 1\n"
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *data = "dirfile/data";
+  const char *format_data = "data RAW INT32 8\nphase PHASE data 1\n"
     "div DIVIDE data data\n";
   int32_t data_data[256];
   double c[8];
   int fd, i, ret, error, n, r = 0;
   DIRFILE *D;
 
+  rmdirfile();
   mkdir(filedir, 0777);
 
   for (fd = 0; fd < 256; ++fd)
diff --git a/test/alter_entry.c b/test/alter_entry.c
index bc02463..ca27e51 100644
--- a/test/alter_entry.c
+++ b/test/alter_entry.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Test field modifying */
 #include "test.h"
 
@@ -11,16 +31,17 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* data = __TEST__ "dirfile/data";
-  const char* format_data = "data RAW UINT8 8\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *data = "dirfile/data";
+  const char *format_data = "data RAW UINT8 8\n";
   unsigned char data_data[256];
   int fd, ret, error, r = 0;
   off_t n;
   gd_entry_t E;
   DIRFILE *D;
 
+  rmdirfile();
   mkdir(filedir, 0777);
 
   for (fd = 0; fd < 256; ++fd)
diff --git a/test/alter_entry_affix.c b/test/alter_entry_affix.c
new file mode 100644
index 0000000..d9d312b
--- /dev/null
+++ b/test/alter_entry_affix.c
@@ -0,0 +1,75 @@
+/* Copyright (C) 2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+#include "test.h"
+
+int main(void)
+{
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *format1 = "dirfile/format1";
+  const char *data = "dirfile/data";
+  const char *format_data = "/INCLUDE format1 A\n";
+  const char *format1_data = "data RAW UINT8 8\n";
+  unsigned char data_data[256];
+  int fd, ret, error, r = 0;
+  off_t n;
+  gd_entry_t E;
+  DIRFILE *D;
+
+  rmdirfile();
+  mkdir(filedir, 0777);
+
+  for (fd = 0; fd < 256; ++fd)
+    data_data[fd] = (unsigned char)fd;
+
+  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
+  write(fd, format_data, strlen(format_data));
+  close(fd);
+
+  fd = open(format1, O_CREAT | O_EXCL | O_WRONLY, 0666);
+  write(fd, format1_data, strlen(format1_data));
+  close(fd);
+
+  fd = open(data, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
+  write(fd, data_data, 256);
+  close(fd);
+
+  D = gd_open(filedir, GD_RDWR | GD_VERBOSE);
+  gd_entry(D, "Adata", &E);
+  E.EN(raw,data_type) = GD_UINT16;
+  E.EN(raw,spf) = 11;
+  ret = gd_alter_entry(D, "Adata", &E, 0);
+  error = gd_error(D);
+  n = gd_nframes(D);
+
+  gd_close(D);
+
+  unlink(data);
+  unlink(format);
+  rmdir(filedir);
+
+  CHECKI(error, 0);
+  CHECKI(n, 11);
+  CHECKI(ret, 0);
+  gd_free_entry_strings(&E);
+
+  return r;
+}
diff --git a/test/alter_entry_hidden.c b/test/alter_entry_hidden.c
new file mode 100644
index 0000000..9712f80
--- /dev/null
+++ b/test/alter_entry_hidden.c
@@ -0,0 +1,69 @@
+/* Copyright (C) 2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+/* Test field modifying */
+#include "test.h"
+
+int main(void)
+{
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *data = "dirfile/data";
+  const char *format_data = "data RAW UINT8 8\n";
+  unsigned char data_data[256];
+  int fd, ret, error, r = 0;
+  off_t n;
+  gd_entry_t E;
+  DIRFILE *D;
+
+  rmdirfile();
+  mkdir(filedir, 0777);
+
+  for (fd = 0; fd < 256; ++fd)
+    data_data[fd] = (unsigned char)fd;
+
+  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
+  write(fd, format_data, strlen(format_data));
+  close(fd);
+
+  fd = open(data, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
+  write(fd, data_data, 256);
+  close(fd);
+
+  D = gd_open(filedir, GD_RDWR | GD_VERBOSE);
+  gd_entry(D, "data", &E);
+  E.hidden = 1;
+  ret = gd_alter_entry(D, "data", &E, 0);
+  error = gd_error(D);
+  n = gd_nfields(D);
+
+  gd_close(D);
+
+  unlink(data);
+  unlink(format);
+  rmdir(filedir);
+
+  CHECKI(error, 0);
+  CHECKI(n, 2);
+  CHECKI(ret, 0);
+  gd_free_entry_strings(&E);
+
+  return r;
+}
diff --git a/test/alter_entry_recode.c b/test/alter_entry_recode.c
index 5785b23..fcb7da2 100644
--- a/test/alter_entry_recode.c
+++ b/test/alter_entry_recode.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Test field modifying */
 #include "test.h"
 
@@ -12,10 +32,10 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* data = __TEST__ "dirfile/data";
-  const char* format_data = "data RAW UINT8 8\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *data = "dirfile/data";
+  const char *format_data = "data RAW UINT8 8\n";
   unsigned char data_data[256];
   uint16_t d;
   int fd, i, ret, error, r = 0;
@@ -23,6 +43,7 @@ int main(void)
   DIRFILE *D;
   gd_entry_t E;
 
+  rmdirfile();
   mkdir(filedir, 0777);
 
   for (fd = 0; fd < 256; ++fd)
@@ -51,7 +72,7 @@ int main(void)
 
   if (fd >= 0) {
     while (read(fd, &d, sizeof(uint16_t))) {
-      CHECKX(d, i * 8 / 11);
+      CHECKXi(i, d, i * 8 / 11);
       i++;
     }
     close(fd);
diff --git a/test/alter_entry_scalar2a.c b/test/alter_entry_scalar2a.c
index f474c69..92dad32 100644
--- a/test/alter_entry_scalar2a.c
+++ b/test/alter_entry_scalar2a.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2009-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Test field modifying */
 #include "test.h"
 
@@ -11,14 +31,15 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* format_data = "data BIT in c1 3\nc1 CONST INT64 3\n"
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *format_data = "data BIT in c1 3\nc1 CONST INT64 3\n"
     "c2 CONST INT64 11\n";
   int fd, ret, error, n, r = 0;
   DIRFILE *D;
   gd_entry_t E;
 
+  rmdirfile();
   mkdir(filedir, 0777);
 
   fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
diff --git a/test/alter_entry_scalar2n.c b/test/alter_entry_scalar2n.c
index 2645513..674c087 100644
--- a/test/alter_entry_scalar2n.c
+++ b/test/alter_entry_scalar2n.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2009-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Test field modifying */
 #include "test.h"
 
@@ -11,15 +31,16 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* data = __TEST__ "dirfile/data";
-  const char* format_data = "data RAW UINT8 8\nconst CONST INT64 11\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *data = "dirfile/data";
+  const char *format_data = "data RAW UINT8 8\nconst CONST INT64 11\n";
   unsigned char data_data[256];
   int fd, ret, error, n, r = 0;
   DIRFILE *D;
   gd_entry_t E;
 
+  rmdirfile();
   mkdir(filedir, 0777);
 
   for (fd = 0; fd < 256; ++fd)
diff --git a/test/alter_entry_scalar3.c b/test/alter_entry_scalar3.c
index 68f4b4f..12b1362 100644
--- a/test/alter_entry_scalar3.c
+++ b/test/alter_entry_scalar3.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2009-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Test field modifying */
 #include "test.h"
 
@@ -11,13 +31,14 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* format_data = "data BIT in c1 3\nc1 CONST INT64 3\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *format_data = "data BIT in c1 3\nc1 CONST INT64 3\n";
   int fd, ret, error, n, r = 0;
   DIRFILE *D;
   gd_entry_t E;
 
+  rmdirfile();
   mkdir(filedir, 0777);
 
   fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
diff --git a/test/alter_entry_scalar4.c b/test/alter_entry_scalar4.c
index fba5511..b85542c 100644
--- a/test/alter_entry_scalar4.c
+++ b/test/alter_entry_scalar4.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2009-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Test field modifying */
 #include "test.h"
 
@@ -11,13 +31,14 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* format_data = "data BIT in 3 c1\nc1 CONST INT64 3\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *format_data = "data BIT in 3 c1\nc1 CONST INT64 3\n";
   int fd, ret, error, n, r = 0;
   DIRFILE *D;
   gd_entry_t E;
 
+  rmdirfile();
   mkdir(filedir, 0777);
 
   fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
diff --git a/test/alter_lincom_23.c b/test/alter_lincom_23.c
index ebdc95b..7e270c8 100644
--- a/test/alter_lincom_23.c
+++ b/test/alter_lincom_23.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2009-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Test field modifying */
 #include "test.h"
 
@@ -12,19 +32,20 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* data = __TEST__ "dirfile/data";
-  const char* format_data = "data RAW INT32 8\nphase PHASE data 1\n"
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *data = "dirfile/data";
+  const char *format_data = "data RAW INT32 8\nphase PHASE data 1\n"
     "lincom LINCOM 2 data 1 0 data 1 0\n";
   int32_t data_data[256];
   int32_t c[8];
   int fd, i, ret, error, n, r = 0;
   DIRFILE *D;
-  const char* in_fields[3] = {"data", "phase", "data"};
+  const char *in_fields[3] = {"data", "phase", "data"};
   const double m[3] = {1, 2, 3};
   const double b[3] = {3, 0, 1};
 
+  rmdirfile();
   mkdir(filedir, 0777);
 
   for (fd = 0; fd < 256; ++fd)
diff --git a/test/alter_lincom_32.c b/test/alter_lincom_32.c
index e1c8386..7e4ba2a 100644
--- a/test/alter_lincom_32.c
+++ b/test/alter_lincom_32.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2010-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Test field modifying */
 #include "test.h"
 
@@ -12,19 +32,20 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* data = __TEST__ "dirfile/data";
-  const char* format_data = "data RAW INT32 8\nphase PHASE data 1\n"
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *data = "dirfile/data";
+  const char *format_data = "data RAW INT32 8\nphase PHASE data 1\n"
     "lincom LINCOM 3 data 1 3 phase 2 0 data 3 1\n";
   int32_t data_data[256];
   int32_t c[8];
   int fd, i, ret, error, n, r = 0;
   DIRFILE *D;
-  const char* in_fields[2] = {"data", "phase"};
+  const char *in_fields[2] = {"data", "phase"};
   const double m[2] = {2, 4};
   const double b[2] = {0, 2};
 
+  rmdirfile();
   mkdir(filedir, 0777);
 
   for (fd = 0; fd < 256; ++fd)
diff --git a/test/alter_lincom_affix.c b/test/alter_lincom_affix.c
new file mode 100644
index 0000000..4b32a8f
--- /dev/null
+++ b/test/alter_lincom_affix.c
@@ -0,0 +1,89 @@
+/* Copyright (C) 2012 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+/* Test field modifying */
+#include "test.h"
+
+#include <stdlib.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <string.h>
+#include <inttypes.h>
+#include <errno.h>
+#include <stdio.h>
+
+int main(void)
+{
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *format1 = "dirfile/format1";
+  const char *data = "dirfile/data";
+  const char *format_data = "INCLUDE format1 A Z\n";
+  const char *format1_data = "data RAW INT32 8\nphase PHASE data 1\n"
+    "lincom LINCOM 2 data 1 0 data 1 0\n";
+  int32_t data_data[256];
+  int32_t c[8];
+  int fd, i, e1, e2, n, r = 0;
+  DIRFILE *D;
+  const char *in_fields[3] = {"data", "phase", NULL};
+  const char *Ain_fieldsZ[3] = {"AdataZ", "AphaseZ", NULL};
+
+  rmdirfile();
+  mkdir(filedir, 0777);
+
+  for (fd = 0; fd < 256; ++fd)
+    data_data[fd] = (int32_t)fd;
+
+  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
+  write(fd, format_data, strlen(format_data));
+  close(fd);
+
+  fd = open(format1, O_CREAT | O_EXCL | O_WRONLY, 0666);
+  write(fd, format1_data, strlen(format1_data));
+  close(fd);
+
+  fd = open(data, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
+  write(fd, data_data, 256 * sizeof(int32_t));
+  close(fd);
+
+  D = gd_open(filedir, GD_RDWR);
+  gd_alter_lincom(D, "AlincomZ", 0, in_fields, NULL, NULL);
+  e1 = gd_error(D);
+  gd_alter_lincom(D, "AlincomZ", 0, Ain_fieldsZ, NULL, NULL);
+  e2 = gd_error(D);
+  n = gd_getdata(D, "AlincomZ", 5, 0, 1, 0, GD_INT32, c);
+
+  gd_discard(D);
+
+  for (i = 0; i < 8; ++i)
+    CHECKIi(i,c[i], i * 2 + 81);
+
+  unlink(data);
+  unlink(format1);
+  unlink(format);
+  rmdir(filedir);
+
+  CHECKI(e1, GD_E_BAD_CODE);
+  CHECKI(e2, 0);
+  CHECKI(n, 8);
+
+  return r;
+}
diff --git a/test/alter_lincom_input.c b/test/alter_lincom_input.c
index aedca91..d117db9 100644
--- a/test/alter_lincom_input.c
+++ b/test/alter_lincom_input.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Test field modifying */
 #include "test.h"
 
@@ -12,17 +32,18 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* data = __TEST__ "dirfile/data";
-  const char* format_data = "data RAW INT32 8\nphase PHASE data 1\n"
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *data = "dirfile/data";
+  const char *format_data = "data RAW INT32 8\nphase PHASE data 1\n"
     "lincom LINCOM 2 data 1 0 data 1 0\n";
   int32_t data_data[256];
   int32_t c[8];
   int fd, i, ret, error, n, r = 0;
   DIRFILE *D;
-  const char* in_fields[3] = {"data", "phase", NULL};
+  const char *in_fields[3] = {"data", "phase", NULL};
 
+  rmdirfile();
   mkdir(filedir, 0777);
 
   for (fd = 0; fd < 256; ++fd)
diff --git a/test/alter_lincom_offset.c b/test/alter_lincom_offset.c
index 5cf7951..87878b1 100644
--- a/test/alter_lincom_offset.c
+++ b/test/alter_lincom_offset.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Test field modifying */
 #include "test.h"
 
@@ -12,18 +32,19 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* data = __TEST__ "dirfile/data";
-  const char* format_data = "data RAW INT32 8\nphase PHASE data 1\n"
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *data = "dirfile/data";
+  const char *format_data = "data RAW INT32 8\nphase PHASE data 1\n"
     "lincom LINCOM 2 data 1 0 data 1 0\n";
   int32_t data_data[256];
   int32_t c[8];
   int fd, i, ret, error, n, r = 0;
   DIRFILE *D;
-  const char* in_fields[3] = {"data", "phase", NULL};
+  const char *in_fields[3] = {"data", "phase", NULL};
   double b[3] = {2, 3, 0};
 
+  rmdirfile();
   mkdir(filedir, 0777);
 
   for (fd = 0; fd < 256; ++fd)
diff --git a/test/alter_lincom_slope.c b/test/alter_lincom_slope.c
index a4f2fb2..a72de69 100644
--- a/test/alter_lincom_slope.c
+++ b/test/alter_lincom_slope.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Test field modifying */
 #include "test.h"
 
@@ -12,18 +32,19 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* data = __TEST__ "dirfile/data";
-  const char* format_data = "data RAW INT32 8\nphase PHASE data 1\n"
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *data = "dirfile/data";
+  const char *format_data = "data RAW INT32 8\nphase PHASE data 1\n"
     "lincom LINCOM 2 data 1 0 data 1 0\n";
   int32_t data_data[256];
   int32_t c[8];
   int fd, i, ret, error, n, r = 0;
   DIRFILE *D;
-  const char* in_fields[3] = {"data", "phase", NULL};
+  const char *in_fields[3] = {"data", "phase", NULL};
   double m[3] = {2, 3, 0};
 
+  rmdirfile();
   mkdir(filedir, 0777);
 
   for (fd = 0; fd < 256; ++fd)
diff --git a/test/alter_linterp.c b/test/alter_linterp.c
index 2a114ff..bed7d48 100644
--- a/test/alter_linterp.c
+++ b/test/alter_linterp.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Test field modifying */
 #include "test.h"
 
@@ -12,20 +32,21 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* table = __TEST__ "dirfile/table";
-  const char* table1 = __TEST__ "dirfile/table1";
-  const char* data = __TEST__ "dirfile/data";
-  const char* format_data = "data RAW INT32 8\nlut LINTERP data table\n";
-  const char* tabledata = "0 0\n1000 5000\n";
-  const char* table1data = "0 0\n1000 10000\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *table = "dirfile/table";
+  const char *table1 = "dirfile/table1";
+  const char *data = "dirfile/data";
+  const char *format_data = "data RAW INT32 8\nlut LINTERP data table\n";
+  const char *tabledata = "0 0\n1000 5000\n";
+  const char *table1data = "0 0\n1000 10000\n";
   int32_t data_data[256];
   int32_t c[8];
   gd_entry_t e;
   int fd, i, ret, error, error2, n, unlink_table, r = 0;
   DIRFILE *D;
 
+  rmdirfile();
   mkdir(filedir, 0777);
 
   for (fd = 0; fd < 256; ++fd)
diff --git a/test/alter_linterp_move.c b/test/alter_linterp_move.c
index 4515032..83d40f5 100644
--- a/test/alter_linterp_move.c
+++ b/test/alter_linterp_move.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Test field modifying */
 #include "test.h"
 
@@ -12,19 +32,20 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* table = __TEST__ "dirfile/table";
-  const char* table1 = __TEST__ "dirfile/table1";
-  const char* data = __TEST__ "dirfile/data";
-  const char* format_data = "data RAW INT32 8\nlut LINTERP data table\n";
-  const char* tabledata = "0 0\n1000 5000\n";
-  const char* table1data = "0 0\n1000 10000\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *table = "dirfile/table";
+  const char *table1 = "dirfile/table1";
+  const char *data = "dirfile/data";
+  const char *format_data = "data RAW INT32 8\nlut LINTERP data table\n";
+  const char *tabledata = "0 0\n1000 5000\n";
+  const char *table1data = "0 0\n1000 10000\n";
   int32_t data_data[256];
   int32_t c[8];
   int fd, i, ret, error, n, unlink_table, r = 0;
   DIRFILE *D;
 
+  rmdirfile();
   mkdir(filedir, 0777);
 
   for (fd = 0; fd < 256; ++fd)
diff --git a/test/alter_mplex.c b/test/alter_mplex.c
new file mode 100644
index 0000000..a7e7860
--- /dev/null
+++ b/test/alter_mplex.c
@@ -0,0 +1,79 @@
+/* Copyright (C) 2012 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+#include "test.h"
+
+int main(void)
+{
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *data = "dirfile/data";
+  const char *count = "dirfile/count";
+  const char *format_data =
+    "count RAW UINT8 8\n"
+    "data RAW UINT8 8\n"
+    "mplex MPLEX data count 1 3\n";
+  unsigned char data_data[256];
+  unsigned char c[8];
+  int fd, i, ret, error, n, r = 0;
+  DIRFILE *D;
+
+  rmdirfile();
+  mkdir(filedir, 0777);
+
+  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
+  write(fd, format_data, strlen(format_data));
+  close(fd);
+
+  for (fd = 0; fd < 256; ++fd)
+    data_data[fd] = (unsigned char)fd;
+
+  fd = open(data, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
+  write(fd, data_data, 256);
+  close(fd);
+
+  for (fd = 0; fd < 256; ++fd)
+    data_data[fd] %= 3;
+
+  fd = open(count, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
+  write(fd, data_data, 256);
+  close(fd);
+
+  D = gd_open(filedir, GD_RDWR | GD_VERBOSE);
+  ret = gd_alter_mplex(D, "mplex", NULL, NULL, 2, -1);
+  error = gd_error(D);
+  n = gd_getdata(D, "mplex", 5, 0, 1, 0, GD_UINT8, c);
+
+  gd_close(D);
+
+  for (i = 0; i < 8; ++i)
+    CHECKIi(i, c[i], 38 + 3 * ((i + 2) / 3));
+
+  unlink(count);
+  unlink(data);
+  unlink(format);
+  rmdir(filedir);
+
+  CHECKI(error,0);
+  CHECKI(n,8);
+  CHECKI(ret,0);
+
+  return r;
+}
diff --git a/test/alter_mspec.c b/test/alter_mspec.c
index 4b39ca8..c131ff6 100644
--- a/test/alter_mspec.c
+++ b/test/alter_mspec.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Test field modifying */
 #include "test.h"
 
@@ -12,15 +32,16 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* data = __TEST__ "dirfile/data";
-  const char* format_data = "data RAW UINT8 8\nMETA data phase PHASE data 1\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *data = "dirfile/data";
+  const char *format_data = "data RAW UINT8 8\nMETA data phase PHASE data 1\n";
   unsigned char data_data[256];
   unsigned char c[8];
   int fd, i, ret, error, n, r = 0;
   DIRFILE *D;
 
+  rmdirfile();
   mkdir(filedir, 0777);
 
   for (fd = 0; fd < 256; ++fd)
diff --git a/test/alter_mspec_affix.c b/test/alter_mspec_affix.c
new file mode 100644
index 0000000..3945c21
--- /dev/null
+++ b/test/alter_mspec_affix.c
@@ -0,0 +1,73 @@
+/* Copyright (C) 2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+#include "test.h"
+
+int main(void)
+{
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *format1 = "dirfile/format1";
+  const char *data = "dirfile/data";
+  const char *format_data = "/INCLUDE format1 A Z\n";
+  const char *format1_data = "data RAW UINT8 8\nMETA data phase PHASE data 1\n";
+  unsigned char data_data[256];
+  unsigned char c[8];
+  int fd, i, ret, error, n, r = 0;
+  DIRFILE *D;
+
+  rmdirfile();
+  mkdir(filedir, 0777);
+
+  for (fd = 0; fd < 256; ++fd)
+    data_data[fd] = (unsigned char)fd;
+
+  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
+  write(fd, format_data, strlen(format_data));
+  close(fd);
+
+  fd = open(format1, O_CREAT | O_EXCL | O_WRONLY, 0666);
+  write(fd, format1_data, strlen(format1_data));
+  close(fd);
+
+  fd = open(data, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
+  write(fd, data_data, 256);
+  close(fd);
+
+  D = gd_open(filedir, GD_RDWR | GD_VERBOSE);
+  ret = gd_malter_spec(D, "phase PHASE data 2", "AdataZ", 0);
+  error = gd_error(D);
+  n = gd_getdata(D, "AdataZ/phase", 5, 0, 1, 0, GD_UINT8, c);
+
+  gd_close(D);
+
+  for (i = 0; i < 8; ++i)
+    CHECKIi(i,c[i], i + 42);
+
+  unlink(data);
+  unlink(format);
+  rmdir(filedir);
+
+  CHECKI(error,0);
+  CHECKI(n,8);
+  CHECKI(ret,0);
+
+  return r;
+}
diff --git a/test/alter_multiply.c b/test/alter_multiply.c
index 29da56e..9854434 100644
--- a/test/alter_multiply.c
+++ b/test/alter_multiply.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Test field modifying */
 #include "test.h"
 
@@ -12,16 +32,17 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* data = __TEST__ "dirfile/data";
-  const char* format_data = "data RAW INT32 8\nphase PHASE data 1\n"
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *data = "dirfile/data";
+  const char *format_data = "data RAW INT32 8\nphase PHASE data 1\n"
     "mult MULTIPLY data data\n";
   int32_t data_data[256];
   int32_t c[8];
   int fd, i, ret, error, n, r = 0;
   DIRFILE *D;
 
+  rmdirfile();
   mkdir(filedir, 0777);
 
   for (fd = 0; fd < 256; ++fd)
diff --git a/test/alter_phase.c b/test/alter_phase.c
index 083dbca..82e873c 100644
--- a/test/alter_phase.c
+++ b/test/alter_phase.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Test field modifying */
 #include "test.h"
 
@@ -12,15 +32,16 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* data = __TEST__ "dirfile/data";
-  const char* format_data = "data RAW UINT8 8\nphase PHASE data 1\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *data = "dirfile/data";
+  const char *format_data = "data RAW UINT8 8\nphase PHASE data 1\n";
   unsigned char data_data[256];
   unsigned char c[8];
   int fd, i, ret, error, n, r = 0;
   DIRFILE *D;
 
+  rmdirfile();
   mkdir(filedir, 0777);
 
   for (fd = 0; fd < 256; ++fd)
diff --git a/test/alter_polynom_coeff.c b/test/alter_polynom_coeff.c
index 96794b4..0c44125 100644
--- a/test/alter_polynom_coeff.c
+++ b/test/alter_polynom_coeff.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2009-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Test field modifying */
 #include "test.h"
 
@@ -13,10 +33,10 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* data = __TEST__ "dirfile/data";
-  const char* format_data = "data RAW INT32 8\n"
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *data = "dirfile/data";
+  const char *format_data = "data RAW INT32 8\n"
     "polynom POLYNOM data 1 2 1\n";
   int32_t data_data[256];
   const double a[] = {2, 1, 3};
@@ -24,6 +44,7 @@ int main(void)
   gd_entry_t E;
   DIRFILE *D;
 
+  rmdirfile();
   mkdir(filedir, 0777);
 
   for (fd = 0; fd < 256; ++fd)
diff --git a/test/alter_polynom_input.c b/test/alter_polynom_input.c
index b96680d..3278372 100644
--- a/test/alter_polynom_input.c
+++ b/test/alter_polynom_input.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2009-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Test field modifying */
 #include "test.h"
 
@@ -12,16 +32,17 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* data = __TEST__ "dirfile/data";
-  const char* format_data = "data RAW INT32 8\nphase PHASE data 1\n"
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *data = "dirfile/data";
+  const char *format_data = "data RAW INT32 8\nphase PHASE data 1\n"
     "polynom POLYNOM data 1 2 1\n";
   int32_t data_data[256];
   int32_t c[8];
   int fd, i, ret, error, n, r = 0;
   DIRFILE *D;
 
+  rmdirfile();
   mkdir(filedir, 0777);
 
   for (fd = 0; fd < 256; ++fd)
diff --git a/test/alter_polynom_ord.c b/test/alter_polynom_ord.c
index 0030b2e..e7628b0 100644
--- a/test/alter_polynom_ord.c
+++ b/test/alter_polynom_ord.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2009-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Test field modifying */
 #include "test.h"
 
@@ -12,16 +32,17 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* data = __TEST__ "dirfile/data";
-  const char* format_data = "data RAW INT32 8\n"
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *data = "dirfile/data";
+  const char *format_data = "data RAW INT32 8\n"
     "polynom POLYNOM data 1 2 1\n";
   int32_t data_data[256];
   int32_t c[8];
   int fd, i, ret, error, n, r = 0;
   DIRFILE *D;
 
+  rmdirfile();
   mkdir(filedir, 0777);
 
   for (fd = 0; fd < 256; ++fd)
diff --git a/test/alter_raw_spf.c b/test/alter_raw_spf.c
index 043771f..afa51ce 100644
--- a/test/alter_raw_spf.c
+++ b/test/alter_raw_spf.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Test field modifying */
 #include "test.h"
 
@@ -12,16 +32,17 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* data = __TEST__ "dirfile/data";
-  const char* format_data = "data RAW UINT8 8\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *data = "dirfile/data";
+  const char *format_data = "data RAW UINT8 8\n";
   unsigned char data_data[256];
   uint8_t d;
   int fd, i, ret, error, r = 0;
   off_t n;
   DIRFILE *D;
 
+  rmdirfile();
   mkdir(filedir, 0777);
 
   for (fd = 0; fd < 256; ++fd)
diff --git a/test/alter_raw_type.c b/test/alter_raw_type.c
index 4b67d87..193a73f 100644
--- a/test/alter_raw_type.c
+++ b/test/alter_raw_type.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Test field modifying */
 #include "test.h"
 
@@ -12,16 +32,17 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* data = __TEST__ "dirfile/data";
-  const char* format_data = "data RAW UINT8 8\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *data = "dirfile/data";
+  const char *format_data = "data RAW UINT8 8\n";
   unsigned char data_data[256];
   uint16_t d;
   int fd, i, ret, error, r = 0;
   off_t n;
   DIRFILE *D;
 
+  rmdirfile();
   mkdir(filedir, 0777);
 
   for (fd = 0; fd < 256; ++fd)
diff --git a/test/alter_recip.c b/test/alter_recip.c
index c8e9eaf..113cfb1 100644
--- a/test/alter_recip.c
+++ b/test/alter_recip.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2010-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Test field modifying */
 #include "test.h"
 
@@ -12,16 +32,17 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* data = __TEST__ "dirfile/data";
-  const char* format_data = "data RAW INT32 8\nphase PHASE data 1\n"
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *data = "dirfile/data";
+  const char *format_data = "data RAW INT32 8\nphase PHASE data 1\n"
     "div RECIP data 230.\n";
   int32_t data_data[256];
   double c[8];
   int fd, i, ret, error, n, r = 0;
   DIRFILE *D;
 
+  rmdirfile();
   mkdir(filedir, 0777);
 
   for (fd = 0; fd < 256; ++fd)
diff --git a/test/alter_recip_zero.c b/test/alter_recip_zero.c
index f4871a7..159bd31 100644
--- a/test/alter_recip_zero.c
+++ b/test/alter_recip_zero.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Test field modifying */
 #include "test.h"
 
@@ -12,16 +32,17 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* data = __TEST__ "dirfile/data";
-  const char* format_data = "data RAW INT32 8\nphase PHASE data 1\n"
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *data = "dirfile/data";
+  const char *format_data = "data RAW INT32 8\nphase PHASE data 1\n"
     "div RECIP data 230.\n";
   int32_t data_data[256];
   double c[8];
   int fd, i, ret, error, n, r = 0;
   DIRFILE *D;
 
+  rmdirfile();
   mkdir(filedir, 0777);
 
   for (fd = 0; fd < 256; ++fd)
diff --git a/test/alter_scalar_affix.c b/test/alter_scalar_affix.c
new file mode 100644
index 0000000..eb92011
--- /dev/null
+++ b/test/alter_scalar_affix.c
@@ -0,0 +1,91 @@
+/* Copyright (C) 2012 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+#include "test.h"
+
+#include <stdlib.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <string.h>
+#include <errno.h>
+#include <stdio.h>
+
+int main(void)
+{
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *format1 = "dirfile/format1";
+  const char *data = "dirfile/data";
+  const char *format_data = "/INCLUDE format1 A Z\n";
+  const char *format1_data = "data RAW UINT8 8\nconst CONST INT64 11\n";
+  unsigned char data_data[256];
+  int fd, e1, e2, n, r = 0;
+  DIRFILE *D;
+  gd_entry_t E;
+
+  rmdirfile();
+  mkdir(filedir, 0777);
+
+  for (fd = 0; fd < 256; ++fd)
+    data_data[fd] = (unsigned char)fd;
+
+  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
+  write(fd, format_data, strlen(format_data));
+  close(fd);
+
+  fd = open(format1, O_CREAT | O_EXCL | O_WRONLY, 0666);
+  write(fd, format1_data, strlen(format1_data));
+  close(fd);
+
+  fd = open(data, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
+  write(fd, data_data, 256);
+  close(fd);
+
+  D = gd_open(filedir, GD_RDWR);
+  gd_entry(D, "AdataZ", &E);
+  E.scalar[0] = "const";
+  gd_alter_entry(D, "AdataZ", &E, 0);
+  e1 = gd_error(D);
+
+  E.scalar[0] = "AconstZ";
+  gd_alter_entry(D, "AdataZ", &E, 0);
+  e2 = gd_error(D);
+
+  E.scalar[0] = NULL;
+  gd_free_entry_strings(&E);
+
+  n = gd_entry(D, "AdataZ", &E);
+
+  gd_discard(D);
+
+  unlink(data);
+  unlink(format1);
+  unlink(format);
+  rmdir(filedir);
+
+  CHECKI(e1, GD_E_BAD_CODE);
+  CHECKI(e2, 0);
+  CHECKI(n, 0);
+  CHECKI(E.EN(raw,spf), 11);
+  gd_free_entry_strings(&E);
+
+  return r;
+}
diff --git a/test/alter_spec.c b/test/alter_spec.c
index 7a77c9a..c0c979b 100644
--- a/test/alter_spec.c
+++ b/test/alter_spec.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Test field modifying */
 #include "test.h"
 
@@ -12,16 +32,17 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* data = __TEST__ "dirfile/data";
-  const char* format_data = "data RAW UINT8 8\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *data = "dirfile/data";
+  const char *format_data = "data RAW UINT8 8\n";
   unsigned char data_data[256];
   uint8_t d;
   int fd, i, ret, error, r = 0;
   off_t n;
   DIRFILE *D;
 
+  rmdirfile();
   mkdir(filedir, 0777);
 
   for (fd = 0; fd < 256; ++fd)
diff --git a/test/alter_spec_affix.c b/test/alter_spec_affix.c
new file mode 100644
index 0000000..aba034c
--- /dev/null
+++ b/test/alter_spec_affix.c
@@ -0,0 +1,70 @@
+/* Copyright (C) 2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+#include "test.h"
+
+int main(void)
+{
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *format1 = "dirfile/format1";
+  const char *data = "dirfile/data";
+  const char *format_data = "/INCLUDE format1 A Z\n";
+  const char *format1_data = "data RAW UINT8 1\n";
+  unsigned char data_data[256];
+  int fd, ret, error, r = 0;
+  off64_t n;
+  DIRFILE *D;
+
+  rmdirfile();
+  mkdir(filedir, 0777);
+
+  for (fd = 0; fd < 256; ++fd)
+    data_data[fd] = (unsigned char)fd;
+
+  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
+  write(fd, format_data, strlen(format_data));
+  close(fd);
+
+  fd = open(format1, O_CREAT | O_EXCL | O_WRONLY, 0666);
+  write(fd, format1_data, strlen(format1_data));
+  close(fd);
+
+  fd = open(data, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
+  write(fd, data_data, 256);
+  close(fd);
+
+  D = gd_open(filedir, GD_RDWR | GD_VERBOSE);
+  ret = gd_alter_spec(D, "AdataZ RAW UINT16 4\n", 0);
+  error = gd_error(D);
+  n = gd_nframes(D);
+
+  gd_close(D);
+
+  unlink(data);
+  unlink(format);
+  rmdir(filedir);
+
+  CHECKI(error,0);
+  CHECKI(n,256 / 2 / 4);
+  CHECKI(ret,0);
+
+  return r;
+}
diff --git a/test/alter_spec_meta.c b/test/alter_spec_meta.c
index 8d2e2f1..1a3f32d 100644
--- a/test/alter_spec_meta.c
+++ b/test/alter_spec_meta.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2009-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Test field modifying */
 #include "test.h"
 
@@ -12,15 +32,16 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* data = __TEST__ "dirfile/data";
-  const char* format_data = "data RAW UINT8 8\nMETA data phase PHASE data 1\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *data = "dirfile/data";
+  const char *format_data = "data RAW UINT8 8\nMETA data phase PHASE data 1\n";
   unsigned char data_data[256];
   unsigned char c[8];
   int fd, i, ret, error, n, r = 0;
   DIRFILE *D;
 
+  rmdirfile();
   mkdir(filedir, 0777);
 
   for (fd = 0; fd < 256; ++fd)
diff --git a/test/alter_window.c b/test/alter_window.c
new file mode 100644
index 0000000..adc3c8c
--- /dev/null
+++ b/test/alter_window.c
@@ -0,0 +1,79 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+/* Test field modifying */
+#include "test.h"
+
+#include <stdlib.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <string.h>
+#include <inttypes.h>
+#include <errno.h>
+#include <stdio.h>
+
+int main(void)
+{
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *data = "dirfile/data";
+  const char *format_data = "data RAW UINT8 8\nwindow WINDOW data data LT 44\n";
+  unsigned char data_data[256];
+  unsigned char c[8];
+  gd_triplet_t threshold;
+  int fd, i, ret, error, n, r = 0;
+  DIRFILE *D;
+
+  rmdirfile();
+  mkdir(filedir, 0777);
+
+  for (fd = 0; fd < 256; ++fd)
+    data_data[fd] = (unsigned char)fd;
+
+  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
+  write(fd, format_data, strlen(format_data));
+  close(fd);
+
+  fd = open(data, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
+  write(fd, data_data, 256);
+  close(fd);
+
+  D = gd_open(filedir, GD_RDWR | GD_VERBOSE);
+  threshold.r = 43;
+  ret = gd_alter_window(D, "window", NULL, NULL, GD_WINDOP_GT, threshold);
+  error = gd_error(D);
+  n = gd_getdata(D, "window", 5, 0, 1, 0, GD_UINT8, c);
+
+  gd_close(D);
+
+  for (i = 0; i < 8; ++i)
+    CHECKIi(i,c[i], (i > 3) ? i + 40 : 0);
+
+  unlink(data);
+  unlink(format);
+  rmdir(filedir);
+
+  CHECKI(error,0);
+  CHECKI(n,8);
+  CHECKI(ret,0);
+
+  return r;
+}
diff --git a/test/ascii_add.c b/test/ascii_add.c
new file mode 100644
index 0000000..0a756f3
--- /dev/null
+++ b/test/ascii_add.c
@@ -0,0 +1,69 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+/* Add a RAW field */
+#include "test.h"
+
+#include <stdlib.h>
+#include <sys/types.h>
+#include <stdio.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <string.h>
+#include <errno.h>
+
+int main(void)
+{
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *data = "dirfile/data.txt";
+  gd_entry_t e;
+  int error, r = 0;
+  DIRFILE *D;
+
+  rmdirfile();
+  D = gd_open(filedir, GD_RDWR | GD_CREAT | GD_VERBOSE | GD_TEXT_ENCODED);
+  gd_add_raw(D, "data", GD_UINT8, 2, 0);
+  error = gd_error(D);
+
+  /* check */
+  gd_entry(D, "data", &e);
+  if (gd_error(D))
+    r = 1;
+  else {
+    CHECKI(e.field_type, GD_RAW_ENTRY);
+    CHECKI(e.fragment_index, 0);
+    CHECKI(e.EN(raw,spf), 2);
+    CHECKI(e.EN(raw,data_type), GD_UINT8);
+    gd_free_entry_strings(&e);
+  }
+
+  gd_close(D);
+
+  if (unlink(data)) {
+    perror("unlink");
+    r = 1;
+  }
+  unlink(format);
+  rmdir(filedir);
+
+  CHECKI(error, GD_E_OK);
+  return r;
+}
diff --git a/test/ascii_get.c b/test/ascii_get.c
index 52a1006..c96738d 100644
--- a/test/ascii_get.c
+++ b/test/ascii_get.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Attempt to read UINT8 */
 #include "test.h"
 
@@ -11,23 +31,24 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* data = __TEST__ "dirfile/data.txt";
-  const char* format_data = "data RAW UINT8 8\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *data = "dirfile/data.txt";
+  const char *format_data = "data RAW UINT8 8\n";
   unsigned char c[8];
   int fd, i, n, error, r = 0;
   DIRFILE *D;
   FILE* stream;
 
   memset(c, 0, 8);
+  rmdirfile();
   mkdir(filedir, 0777);
 
   fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
   write(fd, format_data, strlen(format_data));
   close(fd);
 
-  stream = fopen(data, "w" FOPEN_TEXT);
+  stream = fopen(data, "w");
   for (i = 0; i < 256; ++i)
     fprintf(stream, "%i\n", i);
   fclose(stream);
diff --git a/test/ascii_get_get.c b/test/ascii_get_get.c
index a905dbb..dded3ec 100644
--- a/test/ascii_get_get.c
+++ b/test/ascii_get_get.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2010-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Attempt to read UINT8 */
 #include "test.h"
 
@@ -11,23 +31,24 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* data = __TEST__ "dirfile/data.txt";
-  const char* format_data = "data RAW UINT8 8\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *data = "dirfile/data.txt";
+  const char *format_data = "data RAW UINT8 8\n";
   unsigned char c[8], d[8];
   int fd, i, n, error, n2, error2, r = 0;
   DIRFILE *D;
   FILE* stream;
 
   memset(c, 0, 8);
+  rmdirfile();
   mkdir(filedir, 0777);
 
   fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
   write(fd, format_data, strlen(format_data));
   close(fd);
 
-  stream = fopen(data, "w" FOPEN_TEXT);
+  stream = fopen(data, "w");
   for (i = 0; i < 256; ++i)
     fprintf(stream, "%i\n", i);
   fclose(stream);
diff --git a/test/ascii_nframes.c b/test/ascii_nframes.c
index bccd40a..a3a8b08 100644
--- a/test/ascii_nframes.c
+++ b/test/ascii_nframes.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Retreiving the number of frames should succeed cleanly */
 #include "test.h"
 
@@ -10,22 +30,23 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* data = __TEST__ "dirfile/data.txt";
-  const char* format_data = "data RAW UINT8 1\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *data = "dirfile/data.txt";
+  const char *format_data = "data RAW UINT8 1\n";
   int i, r = 0;
   FILE* stream;
   size_t n, m;
   DIRFILE *D;
 
+  rmdirfile();
   mkdir(filedir, 0777);
 
   i = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
   write(i, format_data, strlen(format_data));
   close(i);
 
-  stream = fopen(data, "w" FOPEN_TEXT);
+  stream = fopen(data, "w");
   for (i = 0; i < 256; ++i)
     fprintf(stream, "%i\n", i);
   fclose(stream);
diff --git a/test/ascii_put.c b/test/ascii_put.c
index 44bca2d..4bdc6c2 100644
--- a/test/ascii_put.c
+++ b/test/ascii_put.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Attempt to write UINT8 */
 #include "test.h"
 
@@ -12,10 +32,10 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* data = __TEST__ "dirfile/data.txt";
-  const char* format_data = "data RAW UINT8 8\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *data = "dirfile/data.txt";
+  const char *format_data = "data RAW UINT8 8\n";
   uint8_t c[8];
   int d, n, error;
   int fd, i, r = 0;
@@ -24,6 +44,7 @@ int main(void)
   DIRFILE *D;
 
   memset(c, 0, 8);
+  rmdirfile();
   mkdir(filedir, 0777);
 
   for (i = 0; i < 8; ++i)
@@ -42,7 +63,7 @@ int main(void)
   if (stat(data, &buf))
     return 1;
 
-  stream = fopen(data, "r" FOPEN_TEXT);
+  stream = fopen(data, "r");
   i = 0;
   for (;;) {
     fscanf(stream, "%i", &d);
diff --git a/test/bof.c b/test/bof.c
index 81f12ce..9a47fec 100644
--- a/test/bof.c
+++ b/test/bof.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2010-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 #include "test.h"
 
 #include <stdlib.h>
@@ -9,14 +29,15 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* data = __TEST__ "dirfile/data";
-  const char* format_data = "data RAW UINT16 2\n/FRAMEOFFSET 35\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *data = "dirfile/data";
+  const char *format_data = "data RAW UINT16 2\n/FRAMEOFFSET 35\n";
   int fd, error, r = 0;
   off_t n;
   DIRFILE *D;
 
+  rmdirfile();
   mkdir(filedir, 0777);
 
   fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
diff --git a/test/bof_lincom.c b/test/bof_lincom.c
index 970e1a5..4019260 100644
--- a/test/bof_lincom.c
+++ b/test/bof_lincom.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2010-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 #include "test.h"
 
 #include <stdlib.h>
@@ -9,20 +29,21 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* format1 = __TEST__ "dirfile/format1";
-  const char* format_data =
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *format1 = "dirfile/format1";
+  const char *format_data =
     "data RAW UINT16 2\n"
     "/FRAMEOFFSET 35\n"
     "lincom LINCOM 2 data2 1. 0. data 1. 0.\n"
     "lincom2 LINCOM 2 data 1. 0. data2 1. 0.\n"
     "INCLUDE format1\n";
-  const char* format1_data = "data2 RAW UINT8 3\nFRAMEOFFSET 33\n";
+  const char *format1_data = "data2 RAW UINT8 3\nFRAMEOFFSET 33\n";
   int fd, error1, error2, error3, error4, r = 0;
   off_t bof_data, bof_data2, bof_lincom, bof_lincom2;
   DIRFILE *D;
 
+  rmdirfile();
   mkdir(filedir, 0777);
 
   fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
diff --git a/test/bof_phase.c b/test/bof_phase.c
index 5cda96e..ba6075b 100644
--- a/test/bof_phase.c
+++ b/test/bof_phase.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2010-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 #include "test.h"
 
 #include <stdlib.h>
@@ -9,23 +29,24 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* format1 = __TEST__ "dirfile/format1";
-  const char* format_data =
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *format1 = "dirfile/format1";
+  const char *format_data =
     "data RAW UINT16 5\n"
     "phase PHASE data 3\n"
     "/FRAMEOFFSET 35\n"
     "lincom LINCOM 2 phase2 1. 0. phase 1. 0.\n"
     "lincom2 LINCOM 2 phase 1. 0. phase2 1. 0.\n"
     "INCLUDE format1\n";
-  const char* format1_data = "data2 RAW UINT8 3\n"
+  const char *format1_data = "data2 RAW UINT8 3\n"
     "FRAMEOFFSET 43\n"
     "phase2 PHASE data2 -7\n";
   int fd, error1, error2, error3, error4, r = 0;
   off_t bof_phase, bof_phase2, bof_lincom, bof_lincom2;
   DIRFILE *D;
 
+  rmdirfile();
   mkdir(filedir, 0777);
 
   fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
diff --git a/test/bzip_get.c b/test/bzip_get.c
index 05b9c9c..cda0558 100644
--- a/test/bzip_get.c
+++ b/test/bzip_get.c
@@ -1,5 +1,24 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Attempt to read UINT8 */
-#include "../src/config.h"
 #include "test.h"
 
 #include <inttypes.h>
@@ -16,11 +35,11 @@ int main(void)
 #ifndef TEST_BZIP2
   return 77;
 #else
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* data = __TEST__ "dirfile/data";
-  const char* bzip2data = __TEST__ "dirfile/data.bz2";
-  const char* format_data = "data RAW UINT16 8\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *data = "dirfile/data";
+  const char *bzip2data = "dirfile/data.bz2";
+  const char *format_data = "data RAW UINT16 8\n";
   uint16_t c[8];
   char command[4096];
   uint16_t data_data[256];
@@ -28,6 +47,7 @@ int main(void)
   DIRFILE *D;
 
   memset(c, 0, 8);
+  rmdirfile();
   mkdir(filedir, 0777);
 
   for (fd = 0; fd < 256; ++fd)
diff --git a/test/bzip_get_get.c b/test/bzip_get_get.c
index a97e69d..a5b311f 100644
--- a/test/bzip_get_get.c
+++ b/test/bzip_get_get.c
@@ -1,26 +1,35 @@
-/* Attempt to read UINT8 */
-#include "../src/config.h"
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 #include "test.h"
 
-#include <inttypes.h>
-#include <stdlib.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-#include <string.h>
-#include <stdio.h>
-#include <errno.h>
-
 int main(void)
 {
 #if !defined USE_BZIP2 || !defined TEST_BZIP2
   return 77; /* skip test */
 #else
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* data = __TEST__ "dirfile/data";
-  const char* gzipdata = __TEST__ "dirfile/data.bz2";
-  const char* format_data = "data RAW UINT16 8\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *data = "dirfile/data";
+  const char *gzipdata = "dirfile/data.bz2";
+  const char *format_data = "data RAW UINT16 8\n";
   uint16_t c1[8], c2[8];
   char command[4096];
   uint16_t data_data[256];
@@ -29,6 +38,7 @@ int main(void)
 
   memset(c1, 0, 16);
   memset(c2, 0, 16);
+  rmdirfile();
   mkdir(filedir, 0777);
 
   for (fd = 0; fd < 256; ++fd)
@@ -66,8 +76,8 @@ int main(void)
   CHECKI(n1, 8);
   CHECKI(n2, 8);
   for (i = 0; i < 8; ++i) {
-    CHECKIi(i,c1[i], 40 + i)
-    CHECKIi(i,c2[i], 40 + i)
+    CHECKIi(i,c1[i], 40 + i);
+    CHECKIi(i,c2[i], 40 + i);
   }
 
   return r;
diff --git a/test/bzip_move_from.c b/test/bzip_move_from.c
index a83aedf..e073f93 100644
--- a/test/bzip_move_from.c
+++ b/test/bzip_move_from.c
@@ -1,7 +1,24 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Test move */
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
 #include "test.h"
 
 #include <stdlib.h>
@@ -18,14 +35,14 @@ int main(void)
 #ifndef TEST_BZIP2
   return 77;
 #else
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* format1 = __TEST__ "dirfile/format1";
-  const char* data = __TEST__ "dirfile/data";
-  const char* bz2data = __TEST__ "dirfile/data.bz2";
-  const char* format_data =
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *format1 = "dirfile/format1";
+  const char *data = "dirfile/data";
+  const char *bz2data = "dirfile/data.bz2";
+  const char *format_data =
     "/INCLUDE format1\ndata RAW UINT16 11\nENCODING bzip2\n";
-  const char* format1_data = "ENCODING none\n";
+  const char *format1_data = "ENCODING none\n";
   uint16_t data_data[128];
   int fd, ret, error, ge_ret, unlink_data, unlink_bz2data, r = 0, i = 0;
   char command[4096];
@@ -33,6 +50,7 @@ int main(void)
   DIRFILE *D;
   uint16_t d;
 
+  rmdirfile();
   mkdir(filedir, 0777);
 
   for (fd = 0; fd < 128; ++fd)
diff --git a/test/bzip_nframes.c b/test/bzip_nframes.c
index de841a7..a45688c 100644
--- a/test/bzip_nframes.c
+++ b/test/bzip_nframes.c
@@ -1,5 +1,24 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Retreiving the number of frames should succeed cleanly */
-#include "../src/config.h"
 #include "test.h"
 
 #include <stdlib.h>
@@ -15,17 +34,18 @@ int main(void)
 #ifndef TEST_BZIP2
   return 77;
 #else
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* data = __TEST__ "dirfile/data";
-  const char* gzipdata = __TEST__ "dirfile/data.bz2";
-  const char* format_data = "data RAW UINT16 1\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *data = "dirfile/data";
+  const char *gzipdata = "dirfile/data.bz2";
+  const char *format_data = "data RAW UINT16 1\n";
   char command[4096];
   uint16_t data_data[256];
   int i, error, r = 0;
   size_t n;
   DIRFILE *D;
 
+  rmdirfile();
   mkdir(filedir, 0777);
 
   for (i = 0; i < 256; ++i)
diff --git a/test/close.c b/test/close.c
index e9c6acf..3560d56 100644
--- a/test/close.c
+++ b/test/close.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Closing a dirfile should succeed cleanly */
 #include "test.h"
 
@@ -9,11 +29,12 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
   int error, r = 0;
   DIRFILE *D;
 
+  rmdirfile();
   mkdir(filedir, 0777);
   close(open(format, O_CREAT | O_EXCL | O_WRONLY, 0666));
 
diff --git a/test/close_bad.c b/test/close_bad.c
index ec327eb..f0a9ede 100644
--- a/test/close_bad.c
+++ b/test/close_bad.c
@@ -1,9 +1,29 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Closing an invalid dirfile should succeed cleanly */
 #include "test.h"
 
 int main(void)
 {
-  DIRFILE* D = gd_open("a non_existant dirfile", 0);
+  DIRFILE *D = gd_open("a non_existant dirfile", 0);
   int r = 0;
 
   int ret = gd_close(D);
diff --git a/test/close_discard.c b/test/close_discard.c
index eaa1eea..0deaf91 100644
--- a/test/close_discard.c
+++ b/test/close_discard.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Closing a dirfile should succeed cleanly */
 #include "test.h"
 
@@ -10,12 +30,13 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* data = __TEST__ "dirfile/data";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *data = "dirfile/data";
   int ret, n, r = 0;
   DIRFILE *D;
 
+  rmdirfile();
   mkdir(filedir, 0777);
   close(open(format, O_CREAT | O_EXCL | O_WRONLY, 0666));
 
diff --git a/test/close_null.c b/test/close_null.c
index 78dc639..9ef6835 100644
--- a/test/close_null.c
+++ b/test/close_null.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Passing NULL to dirfile_close should succeed cleanly */
 #include "test.h"
 
diff --git a/test/convert_complex128_complex64.c b/test/convert_complex128_complex64.c
index 7f16437..2ad1ad1 100644
--- a/test/convert_complex128_complex64.c
+++ b/test/convert_complex128_complex64.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2009-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Attempt to read COMPLEX128 as COMPLEX64 */
 #include "test.h"
 
@@ -13,10 +33,10 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* data = __TEST__ "dirfile/data";
-  const char* format_data = "data RAW COMPLEX128 8\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *data = "dirfile/data";
+  const char *format_data = "data RAW COMPLEX128 8\n";
 #ifdef GD_NO_C99_API
   double data_data[512];
   float c[16];
@@ -28,6 +48,7 @@ int main(void)
   DIRFILE *D;
 
   memset(c, 0, 8);
+  rmdirfile();
   mkdir(filedir, 0777);
 
   for (fd = 0; fd < 256; ++fd) {
diff --git a/test/convert_complex128_float64.c b/test/convert_complex128_float64.c
index 884a249..8fed12e 100644
--- a/test/convert_complex128_float64.c
+++ b/test/convert_complex128_float64.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2009-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Attempt to read COMPLEX128 as FLOAT64 */
 #include "test.h"
 
@@ -12,9 +32,9 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* format_data = "data CONST FLOAT64 0\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *format_data = "data CONST FLOAT64 0\n";
   double c = 0;
 #ifdef GD_NO_C99_API
   double d[] = {8, 0};
@@ -24,6 +44,7 @@ int main(void)
   int fd, n1, n2, error, r = 0;
   DIRFILE *D;
 
+  rmdirfile();
   mkdir(filedir, 0777);
 
   fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
diff --git a/test/convert_complex128_int64.c b/test/convert_complex128_int64.c
index 71a4a1a..5593cb0 100644
--- a/test/convert_complex128_int64.c
+++ b/test/convert_complex128_int64.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2009-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Attempt to read COMPLEX128 as INT64 */
 #include "test.h"
 
@@ -11,9 +31,9 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* format_data = "data CONST INT64 0\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *format_data = "data CONST INT64 0\n";
   int64_t c = 0;
 #ifdef GD_NO_C99_API
   double d[] = {8, 0};
@@ -23,6 +43,7 @@ int main(void)
   int fd, n1, n2, error, r = 0;
   DIRFILE *D;
 
+  rmdirfile();
   mkdir(filedir, 0777);
 
   fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
diff --git a/test/convert_complex128_uint64.c b/test/convert_complex128_uint64.c
index b2a1403..c28e6fe 100644
--- a/test/convert_complex128_uint64.c
+++ b/test/convert_complex128_uint64.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2009-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Attempt to read COMPLEX128 as UINT64 */
 #include "test.h"
 
@@ -11,9 +31,9 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* format_data = "data CONST UINT64 0\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *format_data = "data CONST UINT64 0\n";
   uint64_t c = 0;
 #ifdef GD_NO_C99_API
   double d[] = {8, 0};
@@ -23,6 +43,7 @@ int main(void)
   int fd, n1, n2, error, r = 0;
   DIRFILE *D;
 
+  rmdirfile();
   mkdir(filedir, 0777);
 
   fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
diff --git a/test/convert_complex64_complex128.c b/test/convert_complex64_complex128.c
index 300b459..1992383 100644
--- a/test/convert_complex64_complex128.c
+++ b/test/convert_complex64_complex128.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2009-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Attempt to read COMPLEX64 as COMPLEX128 */
 #include "test.h"
 
@@ -12,10 +32,10 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* data = __TEST__ "dirfile/data";
-  const char* format_data = "data RAW COMPLEX64 8\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *data = "dirfile/data";
+  const char *format_data = "data RAW COMPLEX64 8\n";
 #ifdef GD_NO_C99_API
   float data_data[512];
   double c[16];
@@ -27,6 +47,7 @@ int main(void)
   DIRFILE *D;
 
   memset(c, 0, 8);
+  rmdirfile();
   mkdir(filedir, 0777);
 
   for (fd = 0; fd < 256; ++fd) {
diff --git a/test/convert_complex64_float64.c b/test/convert_complex64_float64.c
index 293ff96..a084481 100644
--- a/test/convert_complex64_float64.c
+++ b/test/convert_complex64_float64.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2009-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Attempt to read COMPLEX64 as FLOAT64 */
 #include "test.h"
 
@@ -12,9 +32,9 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* format_data = "data CONST FLOAT64 0\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *format_data = "data CONST FLOAT64 0\n";
   double c = 0;
 #ifdef GD_NO_C99_API
   float d[] = {8, 0};
@@ -24,6 +44,7 @@ int main(void)
   int fd, n1, n2, error, r = 0;
   DIRFILE *D;
 
+  rmdirfile();
   mkdir(filedir, 0777);
 
   fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
diff --git a/test/convert_complex64_int64.c b/test/convert_complex64_int64.c
index fd5712a..ba087cd 100644
--- a/test/convert_complex64_int64.c
+++ b/test/convert_complex64_int64.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2009-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Attempt to read COMPLEX64 as INT64 */
 #include "test.h"
 
@@ -11,9 +31,9 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* format_data = "data CONST INT64 0\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *format_data = "data CONST INT64 0\n";
   int64_t c = 0;
 #ifdef GD_NO_C99_API
   float d[] = {8, 0};
@@ -23,6 +43,7 @@ int main(void)
   int fd, n1, n2, error, r = 0;
   DIRFILE *D;
 
+  rmdirfile();
   mkdir(filedir, 0777);
 
   fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
diff --git a/test/convert_complex64_uint64.c b/test/convert_complex64_uint64.c
index cfeb79e..e749544 100644
--- a/test/convert_complex64_uint64.c
+++ b/test/convert_complex64_uint64.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2009-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Attempt to read COMPLEX64 as UINT64 */
 #include "test.h"
 
@@ -11,9 +31,9 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* format_data = "data CONST UINT64 0\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *format_data = "data CONST UINT64 0\n";
   uint64_t c = 0;
 #ifdef GD_NO_C99_API
   float d[] = {8, 0};
@@ -23,6 +43,7 @@ int main(void)
   int fd, error, n1, n2, r = 0;
   DIRFILE *D;
 
+  rmdirfile();
   mkdir(filedir, 0777);
 
   fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
diff --git a/test/convert_float32_complex128.c b/test/convert_float32_complex128.c
index 089f4e9..b515d78 100644
--- a/test/convert_float32_complex128.c
+++ b/test/convert_float32_complex128.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2009-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Attempt to read FLOAT32 as COMPLEX128 */
 #include "test.h"
 
@@ -12,10 +32,10 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* data = __TEST__ "dirfile/data";
-  const char* format_data = "data RAW FLOAT32 8\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *data = "dirfile/data";
+  const char *format_data = "data RAW FLOAT32 8\n";
   float data_data[256];
 #ifdef GD_NO_C99_API
   double c[16];
@@ -26,6 +46,7 @@ int main(void)
   DIRFILE *D;
 
   memset(c, 0, 8);
+  rmdirfile();
   mkdir(filedir, 0777);
 
   for (fd = 0; fd < 256; ++fd)
diff --git a/test/convert_float32_complex64.c b/test/convert_float32_complex64.c
index c51baa8..43bd1ee 100644
--- a/test/convert_float32_complex64.c
+++ b/test/convert_float32_complex64.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2009-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Attempt to read FLOAT32 as COMPLEX64 */
 #include "test.h"
 
@@ -12,10 +32,10 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* data = __TEST__ "dirfile/data";
-  const char* format_data = "data RAW FLOAT32 8\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *data = "dirfile/data";
+  const char *format_data = "data RAW FLOAT32 8\n";
   float data_data[256];
 #ifdef GD_NO_C99_API
   float c[16];
@@ -26,6 +46,7 @@ int main(void)
   DIRFILE *D;
 
   memset(c, 0, 8);
+  rmdirfile();
   mkdir(filedir, 0777);
 
   for (fd = 0; fd < 256; ++fd)
diff --git a/test/convert_float32_float64.c b/test/convert_float32_float64.c
index 8c7eab3..6d40682 100644
--- a/test/convert_float32_float64.c
+++ b/test/convert_float32_float64.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Attempt to read FLOAT32 as FLOAT64 */
 #include "test.h"
 
@@ -12,16 +32,17 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* data = __TEST__ "dirfile/data";
-  const char* format_data = "data RAW FLOAT32 8\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *data = "dirfile/data";
+  const char *format_data = "data RAW FLOAT32 8\n";
   float  data_data[256];
   double c[8];
   int fd, i, n, error, r = 0;
   DIRFILE *D;
 
   memset(c, 0, 8);
+  rmdirfile();
   mkdir(filedir, 0777);
 
   for (fd = 0; fd < 256; ++fd)
diff --git a/test/convert_float32_int16.c b/test/convert_float32_int16.c
index 3f3eaf1..49296b8 100644
--- a/test/convert_float32_int16.c
+++ b/test/convert_float32_int16.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Attempt to read FLOAT32 as INT16 */
 #include "test.h"
 
@@ -11,16 +31,17 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* data = __TEST__ "dirfile/data";
-  const char* format_data = "data RAW FLOAT32 8\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *data = "dirfile/data";
+  const char *format_data = "data RAW FLOAT32 8\n";
   float  data_data[256];
   int16_t c[8];
   int fd, i, n, error, r = 0;
   DIRFILE *D;
 
   memset(c, 0, 8);
+  rmdirfile();
   mkdir(filedir, 0777);
 
   for (fd = 0; fd < 256; ++fd)
diff --git a/test/convert_float32_int32.c b/test/convert_float32_int32.c
index d704072..1416b2c 100644
--- a/test/convert_float32_int32.c
+++ b/test/convert_float32_int32.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Attempt to read FLOAT32 as INT32 */
 #include "test.h"
 
@@ -11,16 +31,17 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* data = __TEST__ "dirfile/data";
-  const char* format_data = "data RAW FLOAT32 8\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *data = "dirfile/data";
+  const char *format_data = "data RAW FLOAT32 8\n";
   float  data_data[256];
   int32_t c[8];
   int fd, i, n, error, r = 0;
   DIRFILE *D;
 
   memset(c, 0, 8);
+  rmdirfile();
   mkdir(filedir, 0777);
 
   for (fd = 0; fd < 256; ++fd)
diff --git a/test/convert_float32_int64.c b/test/convert_float32_int64.c
index 43c6f1e..fe1af6b 100644
--- a/test/convert_float32_int64.c
+++ b/test/convert_float32_int64.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Attempt to read FLOAT32 as INT64 */
 #include "test.h"
 
@@ -11,16 +31,17 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* data = __TEST__ "dirfile/data";
-  const char* format_data = "data RAW FLOAT32 8\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *data = "dirfile/data";
+  const char *format_data = "data RAW FLOAT32 8\n";
   float  data_data[256];
   int64_t c[8];
   int fd, i, n, error, r = 0;
   DIRFILE *D;
 
   memset(c, 0, 8);
+  rmdirfile();
   mkdir(filedir, 0777);
 
   for (fd = 0; fd < 256; ++fd)
diff --git a/test/convert_float32_int8.c b/test/convert_float32_int8.c
index 5e63941..030cec1 100644
--- a/test/convert_float32_int8.c
+++ b/test/convert_float32_int8.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Attempt to read FLOAT32 as INT8 */
 #include "test.h"
 
@@ -11,16 +31,17 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* data = __TEST__ "dirfile/data";
-  const char* format_data = "data RAW FLOAT32 8\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *data = "dirfile/data";
+  const char *format_data = "data RAW FLOAT32 8\n";
   float  data_data[256];
   int8_t c[8];
   int fd, i, n, error, r = 0;
   DIRFILE *D;
 
   memset(c, 0, 8);
+  rmdirfile();
   mkdir(filedir, 0777);
 
   for (fd = 0; fd < 256; ++fd)
diff --git a/test/convert_float32_uint16.c b/test/convert_float32_uint16.c
index b378036..7d1cd74 100644
--- a/test/convert_float32_uint16.c
+++ b/test/convert_float32_uint16.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Attempt to read FLOAT32 as UINT16 */
 #include "test.h"
 
@@ -11,16 +31,17 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* data = __TEST__ "dirfile/data";
-  const char* format_data = "data RAW FLOAT32 8\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *data = "dirfile/data";
+  const char *format_data = "data RAW FLOAT32 8\n";
   float  data_data[256];
   uint16_t c[8], i;
   int fd, error, n, r = 0;
   DIRFILE *D;
 
   memset(c, 0, 8);
+  rmdirfile();
   mkdir(filedir, 0777);
 
   for (fd = 0; fd < 256; ++fd)
diff --git a/test/convert_float32_uint32.c b/test/convert_float32_uint32.c
index 155a79f..71244b8 100644
--- a/test/convert_float32_uint32.c
+++ b/test/convert_float32_uint32.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Attempt to read FLOAT32 as UINT32 */
 #include "test.h"
 
@@ -11,16 +31,17 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* data = __TEST__ "dirfile/data";
-  const char* format_data = "data RAW FLOAT32 8\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *data = "dirfile/data";
+  const char *format_data = "data RAW FLOAT32 8\n";
   float  data_data[256];
   uint32_t c[8], i;
   int fd, n, error, r = 0;
   DIRFILE *D;
 
   memset(c, 0, 8);
+  rmdirfile();
   mkdir(filedir, 0777);
 
   for (fd = 0; fd < 256; ++fd)
diff --git a/test/convert_float32_uint64.c b/test/convert_float32_uint64.c
index 580be7b..6bbc08a 100644
--- a/test/convert_float32_uint64.c
+++ b/test/convert_float32_uint64.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Attempt to read FLOAT32 as UINT64 */
 #include "test.h"
 
@@ -11,16 +31,17 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* data = __TEST__ "dirfile/data";
-  const char* format_data = "data RAW FLOAT32 8\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *data = "dirfile/data";
+  const char *format_data = "data RAW FLOAT32 8\n";
   float  data_data[256];
   uint64_t c[8], i;
   int fd, n, error, r = 0;
   DIRFILE *D;
 
   memset(c, 0, 8);
+  rmdirfile();
   mkdir(filedir, 0777);
 
   for (fd = 0; fd < 256; ++fd)
diff --git a/test/convert_float32_uint8.c b/test/convert_float32_uint8.c
index 6e938c2..6652fde 100644
--- a/test/convert_float32_uint8.c
+++ b/test/convert_float32_uint8.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Attempt to read FLOAT32 as UINT8 */
 #include "test.h"
 
@@ -11,16 +31,17 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* data = __TEST__ "dirfile/data";
-  const char* format_data = "data RAW FLOAT32 8\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *data = "dirfile/data";
+  const char *format_data = "data RAW FLOAT32 8\n";
   float  data_data[256];
   uint8_t c[8], i;
   int fd, n, error, r = 0;
   DIRFILE *D;
 
   memset(c, 0, 8);
+  rmdirfile();
   mkdir(filedir, 0777);
 
   for (fd = 0; fd < 256; ++fd)
diff --git a/test/convert_float64_complex128.c b/test/convert_float64_complex128.c
index 7713956..5576028 100644
--- a/test/convert_float64_complex128.c
+++ b/test/convert_float64_complex128.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2009-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Attempt to read FLOAT64 as COMPLEX128 */
 #include "test.h"
 
@@ -12,10 +32,10 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* data = __TEST__ "dirfile/data";
-  const char* format_data = "data RAW FLOAT64 8\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *data = "dirfile/data";
+  const char *format_data = "data RAW FLOAT64 8\n";
   double data_data[256];
 #ifdef GD_NO_C99_API
   double c[16];
@@ -26,6 +46,7 @@ int main(void)
   DIRFILE *D;
 
   memset(c, 0, 8);
+  rmdirfile();
   mkdir(filedir, 0777);
 
   for (fd = 0; fd < 256; ++fd)
diff --git a/test/convert_float64_complex64.c b/test/convert_float64_complex64.c
index b2a1c6c..99d5ef5 100644
--- a/test/convert_float64_complex64.c
+++ b/test/convert_float64_complex64.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2009-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Attempt to read FLOAT64 as COMPLEX64 */
 #include "test.h"
 
@@ -12,10 +32,10 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* data = __TEST__ "dirfile/data";
-  const char* format_data = "data RAW FLOAT64 8\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *data = "dirfile/data";
+  const char *format_data = "data RAW FLOAT64 8\n";
   double data_data[256];
 #ifdef GD_NO_C99_API
   float c[16];
@@ -26,6 +46,7 @@ int main(void)
   DIRFILE *D;
 
   memset(c, 0, 8);
+  rmdirfile();
   mkdir(filedir, 0777);
 
   for (fd = 0; fd < 256; ++fd)
diff --git a/test/convert_float64_float32.c b/test/convert_float64_float32.c
index ac1a86e..6986a01 100644
--- a/test/convert_float64_float32.c
+++ b/test/convert_float64_float32.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Attempt to read FLOAT64 as FLOAT32 */
 #include "test.h"
 
@@ -12,16 +32,17 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* data = __TEST__ "dirfile/data";
-  const char* format_data = "data RAW FLOAT64 8\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *data = "dirfile/data";
+  const char *format_data = "data RAW FLOAT64 8\n";
   double  data_data[256];
   float c[8];
   int fd, i, n, error, r = 0;
   DIRFILE *D;
 
   memset(c, 0, 8);
+  rmdirfile();
   mkdir(filedir, 0777);
 
   for (fd = 0; fd < 256; ++fd)
diff --git a/test/convert_float64_int16.c b/test/convert_float64_int16.c
index 1f008a3..5e7bcdf 100644
--- a/test/convert_float64_int16.c
+++ b/test/convert_float64_int16.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Attempt to read FLOAT64 as INT16 */
 #include "test.h"
 
@@ -11,16 +31,17 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* data = __TEST__ "dirfile/data";
-  const char* format_data = "data RAW FLOAT64 8\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *data = "dirfile/data";
+  const char *format_data = "data RAW FLOAT64 8\n";
   double  data_data[256];
   int16_t c[8];
   int fd, i, n, error, r = 0;
   DIRFILE *D;
 
   memset(c, 0, 8);
+  rmdirfile();
   mkdir(filedir, 0777);
 
   for (fd = 0; fd < 256; ++fd)
diff --git a/test/convert_float64_int32.c b/test/convert_float64_int32.c
index 1a3991e..909dd40 100644
--- a/test/convert_float64_int32.c
+++ b/test/convert_float64_int32.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Attempt to read FLOAT64 as INT32 */
 #include "test.h"
 
@@ -11,16 +31,17 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* data = __TEST__ "dirfile/data";
-  const char* format_data = "data RAW FLOAT64 8\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *data = "dirfile/data";
+  const char *format_data = "data RAW FLOAT64 8\n";
   double  data_data[256];
   int32_t c[8];
   int fd, i, n, error, r = 0;
   DIRFILE *D;
 
   memset(c, 0, 8);
+  rmdirfile();
   mkdir(filedir, 0777);
 
   for (fd = 0; fd < 256; ++fd)
diff --git a/test/convert_float64_int64.c b/test/convert_float64_int64.c
index eecee06..59a84c8 100644
--- a/test/convert_float64_int64.c
+++ b/test/convert_float64_int64.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Attempt to read FLOAT64 as UINT64 */
 #include "test.h"
 
@@ -11,16 +31,17 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* data = __TEST__ "dirfile/data";
-  const char* format_data = "data RAW FLOAT64 8\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *data = "dirfile/data";
+  const char *format_data = "data RAW FLOAT64 8\n";
   double  data_data[256];
   uint64_t c[8];
   int fd, i, n, error, r = 0;
   DIRFILE *D;
 
   memset(c, 0, 8);
+  rmdirfile();
   mkdir(filedir, 0777);
 
   for (fd = 0; fd < 256; ++fd)
diff --git a/test/convert_float64_int8.c b/test/convert_float64_int8.c
index d074593..7657f06 100644
--- a/test/convert_float64_int8.c
+++ b/test/convert_float64_int8.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Attempt to read FLOAT64 as INT8 */
 #include "test.h"
 
@@ -11,16 +31,17 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* data = __TEST__ "dirfile/data";
-  const char* format_data = "data RAW FLOAT64 8\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *data = "dirfile/data";
+  const char *format_data = "data RAW FLOAT64 8\n";
   double data_data[256];
   int8_t c[8];
   int fd, i, n, error, r = 0;
   DIRFILE *D;
 
   memset(c, 0, 8);
+  rmdirfile();
   mkdir(filedir, 0777);
 
   for (fd = 0; fd < 256; ++fd)
diff --git a/test/convert_float64_uint16.c b/test/convert_float64_uint16.c
index c914429..beaf983 100644
--- a/test/convert_float64_uint16.c
+++ b/test/convert_float64_uint16.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Attempt to read FLOAT64 as UINT16 */
 #include "test.h"
 
@@ -11,16 +31,17 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* data = __TEST__ "dirfile/data";
-  const char* format_data = "data RAW FLOAT64 8\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *data = "dirfile/data";
+  const char *format_data = "data RAW FLOAT64 8\n";
   double data_data[256];
   uint16_t c[8], i;
   int fd, n, error, r = 0;
   DIRFILE *D;
 
   memset(c, 0, 8);
+  rmdirfile();
   mkdir(filedir, 0777);
 
   for (fd = 0; fd < 256; ++fd)
diff --git a/test/convert_float64_uint32.c b/test/convert_float64_uint32.c
index 6840e78..9df3d8d 100644
--- a/test/convert_float64_uint32.c
+++ b/test/convert_float64_uint32.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Attempt to read FLOAT64 as UINT32 */
 #include "test.h"
 
@@ -11,16 +31,17 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* data = __TEST__ "dirfile/data";
-  const char* format_data = "data RAW FLOAT64 8\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *data = "dirfile/data";
+  const char *format_data = "data RAW FLOAT64 8\n";
   double  data_data[256];
   uint32_t c[8], i;
   int fd, n, error, r = 0;
   DIRFILE *D;
 
   memset(c, 0, 8);
+  rmdirfile();
   mkdir(filedir, 0777);
 
   for (fd = 0; fd < 256; ++fd)
diff --git a/test/convert_float64_uint64.c b/test/convert_float64_uint64.c
index 103d3ce..173ffc5 100644
--- a/test/convert_float64_uint64.c
+++ b/test/convert_float64_uint64.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Attempt to read FLOAT64 as UINT64 */
 #include "test.h"
 
@@ -11,16 +31,17 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* data = __TEST__ "dirfile/data";
-  const char* format_data = "data RAW FLOAT64 8\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *data = "dirfile/data";
+  const char *format_data = "data RAW FLOAT64 8\n";
   double  data_data[256];
   uint64_t c[8], i;
   int fd, n, error, r = 0;
   DIRFILE *D;
 
   memset(c, 0, 8);
+  rmdirfile();
   mkdir(filedir, 0777);
 
   for (fd = 0; fd < 256; ++fd)
diff --git a/test/convert_float64_uint8.c b/test/convert_float64_uint8.c
index 5fd3a0b..7785fc8 100644
--- a/test/convert_float64_uint8.c
+++ b/test/convert_float64_uint8.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Attempt to read FLOAT64 as UINT8 */
 #include "test.h"
 
@@ -11,16 +31,17 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* data = __TEST__ "dirfile/data";
-  const char* format_data = "data RAW FLOAT64 8\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *data = "dirfile/data";
+  const char *format_data = "data RAW FLOAT64 8\n";
   double data_data[256];
   uint8_t c[8], i;
   int fd, n, error, r = 0;
   DIRFILE *D;
 
   memset(c, 0, 8);
+  rmdirfile();
   mkdir(filedir, 0777);
 
   for (fd = 0; fd < 256; ++fd)
diff --git a/test/convert_int16_complex128.c b/test/convert_int16_complex128.c
index f9d4887..d9562b2 100644
--- a/test/convert_int16_complex128.c
+++ b/test/convert_int16_complex128.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2009-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Attempt to read INT16 as COMPLEX128 */
 #include "test.h"
 
@@ -12,10 +32,10 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* data = __TEST__ "dirfile/data";
-  const char* format_data = "data RAW INT16 8\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *data = "dirfile/data";
+  const char *format_data = "data RAW INT16 8\n";
   int16_t  data_data[256];
 #ifdef GD_NO_C99_API
   double c[16];
@@ -26,6 +46,7 @@ int main(void)
   DIRFILE *D;
 
   memset(c, 0, 8);
+  rmdirfile();
   mkdir(filedir, 0777);
 
   for (fd = 0; fd < 256; ++fd)
diff --git a/test/convert_int16_complex64.c b/test/convert_int16_complex64.c
index 6e85456..f00a3ce 100644
--- a/test/convert_int16_complex64.c
+++ b/test/convert_int16_complex64.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2009-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Attempt to read INT16 as COMPLEX64 */
 #include "test.h"
 
@@ -12,10 +32,10 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* data = __TEST__ "dirfile/data";
-  const char* format_data = "data RAW INT16 8\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *data = "dirfile/data";
+  const char *format_data = "data RAW INT16 8\n";
   int16_t data_data[256];
 #ifdef GD_NO_C99_API
   float c[16];
@@ -26,6 +46,7 @@ int main(void)
   DIRFILE *D;
 
   memset(c, 0, 8);
+  rmdirfile();
   mkdir(filedir, 0777);
 
   for (fd = 0; fd < 256; ++fd)
diff --git a/test/convert_int16_float32.c b/test/convert_int16_float32.c
index c9a6e83..70c3124 100644
--- a/test/convert_int16_float32.c
+++ b/test/convert_int16_float32.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Attempt to read INT16 as FLOAT32 */
 #include "test.h"
 
@@ -12,16 +32,17 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* data = __TEST__ "dirfile/data";
-  const char* format_data = "data RAW INT16 8\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *data = "dirfile/data";
+  const char *format_data = "data RAW INT16 8\n";
   int16_t  data_data[256];
   float c[8];
   int fd, i, n, error, r = 0;
   DIRFILE *D;
 
   memset(c, 0, 8);
+  rmdirfile();
   mkdir(filedir, 0777);
 
   for (fd = 0; fd < 256; ++fd)
diff --git a/test/convert_int16_float64.c b/test/convert_int16_float64.c
index 99916b8..fb32a2c 100644
--- a/test/convert_int16_float64.c
+++ b/test/convert_int16_float64.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Attempt to read INT16 as FLOAT64 */
 #include "test.h"
 
@@ -12,16 +32,17 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* data = __TEST__ "dirfile/data";
-  const char* format_data = "data RAW INT16 8\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *data = "dirfile/data";
+  const char *format_data = "data RAW INT16 8\n";
   int16_t data_data[256];
   double c[8];
   int fd, i, n, error, r = 0;
   DIRFILE *D;
 
   memset(c, 0, 8);
+  rmdirfile();
   mkdir(filedir, 0777);
 
   for (fd = 0; fd < 256; ++fd)
diff --git a/test/convert_int16_int32.c b/test/convert_int16_int32.c
index 8811fac..81fdb76 100644
--- a/test/convert_int16_int32.c
+++ b/test/convert_int16_int32.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Attempt to read INT16 as INT32 */
 #include "test.h"
 
@@ -11,16 +31,17 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* data = __TEST__ "dirfile/data";
-  const char* format_data = "data RAW INT16 8\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *data = "dirfile/data";
+  const char *format_data = "data RAW INT16 8\n";
   int16_t data_data[256];
   int32_t c[8];
   int fd, i, n, error, r = 0;
   DIRFILE *D;
 
   memset(c, 0, 8);
+  rmdirfile();
   mkdir(filedir, 0777);
 
   for (fd = 0; fd < 256; ++fd)
diff --git a/test/convert_int16_int64.c b/test/convert_int16_int64.c
index c2a6b08..41a5ced 100644
--- a/test/convert_int16_int64.c
+++ b/test/convert_int16_int64.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Attempt to read INT16 as INT64 */
 #include "test.h"
 
@@ -11,16 +31,17 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* data = __TEST__ "dirfile/data";
-  const char* format_data = "data RAW INT16 8\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *data = "dirfile/data";
+  const char *format_data = "data RAW INT16 8\n";
   int16_t  data_data[256];
   int64_t c[8];
   int fd, i, n, error, r = 0;
   DIRFILE *D;
 
   memset(c, 0, 8);
+  rmdirfile();
   mkdir(filedir, 0777);
 
   for (fd = 0; fd < 256; ++fd)
diff --git a/test/convert_int16_int8.c b/test/convert_int16_int8.c
index 75b7ad3..574ccb7 100644
--- a/test/convert_int16_int8.c
+++ b/test/convert_int16_int8.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Attempt to read INT16 as INT8 */
 #include "test.h"
 
@@ -11,16 +31,17 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* data = __TEST__ "dirfile/data";
-  const char* format_data = "data RAW INT16 8\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *data = "dirfile/data";
+  const char *format_data = "data RAW INT16 8\n";
   int16_t  data_data[256];
   int8_t c[8];
   int fd, i, n, error, r = 0;
   DIRFILE *D;
 
   memset(c, 0, 8);
+  rmdirfile();
   mkdir(filedir, 0777);
 
   for (fd = 0; fd < 256; ++fd)
diff --git a/test/convert_int16_uint16.c b/test/convert_int16_uint16.c
index 7614d97..d3cc2f5 100644
--- a/test/convert_int16_uint16.c
+++ b/test/convert_int16_uint16.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Attempt to read INT16 as UINT16 */
 #include "test.h"
 
@@ -11,16 +31,17 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* data = __TEST__ "dirfile/data";
-  const char* format_data = "data RAW INT16 8\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *data = "dirfile/data";
+  const char *format_data = "data RAW INT16 8\n";
   int16_t  data_data[256];
   uint16_t c[8], i;
   int fd, n, error, r = 0;
   DIRFILE *D;
 
   memset(c, 0, 8);
+  rmdirfile();
   mkdir(filedir, 0777);
 
   for (fd = 0; fd < 256; ++fd)
diff --git a/test/convert_int16_uint32.c b/test/convert_int16_uint32.c
index 4fd1124..678e647 100644
--- a/test/convert_int16_uint32.c
+++ b/test/convert_int16_uint32.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Attempt to read INT16 as UINT32 */
 #include "test.h"
 
@@ -11,16 +31,17 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* data = __TEST__ "dirfile/data";
-  const char* format_data = "data RAW INT16 8\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *data = "dirfile/data";
+  const char *format_data = "data RAW INT16 8\n";
   int16_t  data_data[256];
   uint32_t c[8], i;
   int fd, n, error, r = 0;
   DIRFILE *D;
 
   memset(c, 0, 8);
+  rmdirfile();
   mkdir(filedir, 0777);
 
   for (fd = 0; fd < 256; ++fd)
diff --git a/test/convert_int16_uint64.c b/test/convert_int16_uint64.c
index e2746e8..76f4233 100644
--- a/test/convert_int16_uint64.c
+++ b/test/convert_int16_uint64.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Attempt to read INT16 as UINT64 */
 #include "test.h"
 
@@ -11,16 +31,17 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* data = __TEST__ "dirfile/data";
-  const char* format_data = "data RAW INT16 8\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *data = "dirfile/data";
+  const char *format_data = "data RAW INT16 8\n";
   int16_t  data_data[256];
   uint64_t c[8], i;
   int fd, n, error, r = 0;
   DIRFILE *D;
 
   memset(c, 0, 8);
+  rmdirfile();
   mkdir(filedir, 0777);
 
   for (fd = 0; fd < 256; ++fd)
diff --git a/test/convert_int16_uint8.c b/test/convert_int16_uint8.c
index 1e8ae7f..31a65f9 100644
--- a/test/convert_int16_uint8.c
+++ b/test/convert_int16_uint8.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Attempt to read INT16 as UINT8 */
 #include "test.h"
 
@@ -11,16 +31,17 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* data = __TEST__ "dirfile/data";
-  const char* format_data = "data RAW INT16 8\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *data = "dirfile/data";
+  const char *format_data = "data RAW INT16 8\n";
   int16_t  data_data[256];
   uint8_t c[8];
   int fd, i, n, error, r = 0;
   DIRFILE *D;
 
   memset(c, 0, 8);
+  rmdirfile();
   mkdir(filedir, 0777);
 
   for (fd = 0; fd < 256; ++fd)
diff --git a/test/convert_int32_complex128.c b/test/convert_int32_complex128.c
index 891bfee..2c221e5 100644
--- a/test/convert_int32_complex128.c
+++ b/test/convert_int32_complex128.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2009-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Attempt to read INT32 as COMPLEX128 */
 #include "test.h"
 
@@ -12,10 +32,10 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* data = __TEST__ "dirfile/data";
-  const char* format_data = "data RAW INT32 8\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *data = "dirfile/data";
+  const char *format_data = "data RAW INT32 8\n";
   int32_t data_data[256];
 #ifdef GD_NO_C99_API
   double c[16];
@@ -26,6 +46,7 @@ int main(void)
   DIRFILE *D;
 
   memset(c, 0, 8);
+  rmdirfile();
   mkdir(filedir, 0777);
 
   for (fd = 0; fd < 256; ++fd)
diff --git a/test/convert_int32_complex64.c b/test/convert_int32_complex64.c
index 33ca68c..44e9ee0 100644
--- a/test/convert_int32_complex64.c
+++ b/test/convert_int32_complex64.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2009-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Attempt to read INT32 as COMPLEX64 */
 #include "test.h"
 
@@ -12,10 +32,10 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* data = __TEST__ "dirfile/data";
-  const char* format_data = "data RAW INT32 8\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *data = "dirfile/data";
+  const char *format_data = "data RAW INT32 8\n";
   int32_t  data_data[256];
 #ifdef GD_NO_C99_API
   float c[16];
@@ -26,6 +46,7 @@ int main(void)
   DIRFILE *D;
 
   memset(c, 0, 8);
+  rmdirfile();
   mkdir(filedir, 0777);
 
   for (fd = 0; fd < 256; ++fd)
diff --git a/test/convert_int32_float32.c b/test/convert_int32_float32.c
index f2ba994..fb891cb 100644
--- a/test/convert_int32_float32.c
+++ b/test/convert_int32_float32.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Attempt to read INT32 as FLOAT32 */
 #include "test.h"
 
@@ -12,16 +32,17 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* data = __TEST__ "dirfile/data";
-  const char* format_data = "data RAW INT32 8\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *data = "dirfile/data";
+  const char *format_data = "data RAW INT32 8\n";
   int32_t  data_data[256];
   float c[8];
   int fd, i, n, error, r = 0;
   DIRFILE *D;
 
   memset(c, 0, 8);
+  rmdirfile();
   mkdir(filedir, 0777);
 
   for (fd = 0; fd < 256; ++fd)
diff --git a/test/convert_int32_float64.c b/test/convert_int32_float64.c
index 8c44e46..1df0ede 100644
--- a/test/convert_int32_float64.c
+++ b/test/convert_int32_float64.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Attempt to read INT32 as FLOAT64 */
 #include "test.h"
 
@@ -12,16 +32,17 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* data = __TEST__ "dirfile/data";
-  const char* format_data = "data RAW INT32 8\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *data = "dirfile/data";
+  const char *format_data = "data RAW INT32 8\n";
   int32_t  data_data[256];
   double c[8];
   int fd, i, n, error, r = 0;
   DIRFILE *D;
 
   memset(c, 0, 8);
+  rmdirfile();
   mkdir(filedir, 0777);
 
   for (fd = 0; fd < 256; ++fd)
diff --git a/test/convert_int32_int16.c b/test/convert_int32_int16.c
index 0b6401e..b63131a 100644
--- a/test/convert_int32_int16.c
+++ b/test/convert_int32_int16.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Attempt to read INT32 as INT16 */
 #include "test.h"
 
@@ -11,16 +31,17 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* data = __TEST__ "dirfile/data";
-  const char* format_data = "data RAW INT32 8\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *data = "dirfile/data";
+  const char *format_data = "data RAW INT32 8\n";
   int32_t  data_data[256];
   int16_t c[8];
   int fd, i, n, error, r = 0;
   DIRFILE *D;
 
   memset(c, 0, 8);
+  rmdirfile();
   mkdir(filedir, 0777);
 
   for (fd = 0; fd < 256; ++fd)
diff --git a/test/convert_int32_int64.c b/test/convert_int32_int64.c
index 2b698d8..57d36dd 100644
--- a/test/convert_int32_int64.c
+++ b/test/convert_int32_int64.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Attempt to read INT32 as INT64 */
 #include "test.h"
 
@@ -11,16 +31,17 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* data = __TEST__ "dirfile/data";
-  const char* format_data = "data RAW INT32 8\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *data = "dirfile/data";
+  const char *format_data = "data RAW INT32 8\n";
   int32_t  data_data[256];
   int64_t c[8];
   int fd, i, n, error, r = 0;
   DIRFILE *D;
 
   memset(c, 0, 8);
+  rmdirfile();
   mkdir(filedir, 0777);
 
   for (fd = 0; fd < 256; ++fd)
diff --git a/test/convert_int32_int8.c b/test/convert_int32_int8.c
index 34a591a..1610c25 100644
--- a/test/convert_int32_int8.c
+++ b/test/convert_int32_int8.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Attempt to read INT32 as INT8 */
 #include "test.h"
 
@@ -11,16 +31,17 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* data = __TEST__ "dirfile/data";
-  const char* format_data = "data RAW INT32 8\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *data = "dirfile/data";
+  const char *format_data = "data RAW INT32 8\n";
   int32_t  data_data[256];
   int8_t c[8];
   int fd, i, n, error, r = 0;
   DIRFILE *D;
 
   memset(c, 0, 8);
+  rmdirfile();
   mkdir(filedir, 0777);
 
   for (fd = 0; fd < 256; ++fd)
diff --git a/test/convert_int32_uint16.c b/test/convert_int32_uint16.c
index bcc3e19..9790ff1 100644
--- a/test/convert_int32_uint16.c
+++ b/test/convert_int32_uint16.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Attempt to read INT32 as UINT16 */
 #include "test.h"
 
@@ -11,16 +31,17 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* data = __TEST__ "dirfile/data";
-  const char* format_data = "data RAW INT32 8\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *data = "dirfile/data";
+  const char *format_data = "data RAW INT32 8\n";
   int32_t data_data[256];
   uint16_t c[8];
   int fd, i, n, error, r = 0;
   DIRFILE *D;
 
   memset(c, 0, 8);
+  rmdirfile();
   mkdir(filedir, 0777);
 
   for (fd = 0; fd < 256; ++fd)
diff --git a/test/convert_int32_uint32.c b/test/convert_int32_uint32.c
index ed27918..433da6a 100644
--- a/test/convert_int32_uint32.c
+++ b/test/convert_int32_uint32.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Attempt to read INT32 as UINT32 */
 #include "test.h"
 
@@ -11,16 +31,17 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* data = __TEST__ "dirfile/data";
-  const char* format_data = "data RAW INT32 8\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *data = "dirfile/data";
+  const char *format_data = "data RAW INT32 8\n";
   int32_t data_data[256];
   uint32_t c[8];
   int fd, i, n, error, r = 0;
   DIRFILE *D;
 
   memset(c, 0, 8);
+  rmdirfile();
   mkdir(filedir, 0777);
 
   for (fd = 0; fd < 256; ++fd)
diff --git a/test/convert_int32_uint64.c b/test/convert_int32_uint64.c
index 59d8059..dc53606 100644
--- a/test/convert_int32_uint64.c
+++ b/test/convert_int32_uint64.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Attempt to read INT32 as UINT64 */
 #include "test.h"
 
@@ -11,16 +31,17 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* data = __TEST__ "dirfile/data";
-  const char* format_data = "data RAW INT32 8\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *data = "dirfile/data";
+  const char *format_data = "data RAW INT32 8\n";
   int32_t data_data[256];
   uint64_t c[8];
   int fd, i, n, error, r = 0;
   DIRFILE *D;
 
   memset(c, 0, 8);
+  rmdirfile();
   mkdir(filedir, 0777);
 
   for (fd = 0; fd < 256; ++fd)
diff --git a/test/convert_int32_uint8.c b/test/convert_int32_uint8.c
index 7b3f59a..345eae3 100644
--- a/test/convert_int32_uint8.c
+++ b/test/convert_int32_uint8.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Attempt to read INT32 as UINT8 */
 #include "test.h"
 
@@ -11,16 +31,17 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* data = __TEST__ "dirfile/data";
-  const char* format_data = "data RAW INT32 8\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *data = "dirfile/data";
+  const char *format_data = "data RAW INT32 8\n";
   int32_t data_data[256];
   uint8_t c[8];
   int fd, i, n, error, r = 0;
   DIRFILE *D;
 
   memset(c, 0, 8);
+  rmdirfile();
   mkdir(filedir, 0777);
 
   for (fd = 0; fd < 256; ++fd)
diff --git a/test/convert_int64_complex128.c b/test/convert_int64_complex128.c
index 2c2d916..9408b4f 100644
--- a/test/convert_int64_complex128.c
+++ b/test/convert_int64_complex128.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2009-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Attempt to read INT64 as COMPLEX128 */
 #include "test.h"
 
@@ -12,10 +32,10 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* data = __TEST__ "dirfile/data";
-  const char* format_data = "data RAW INT64 8\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *data = "dirfile/data";
+  const char *format_data = "data RAW INT64 8\n";
   int64_t data_data[256];
 #ifdef GD_NO_C99_API
   double c[16];
@@ -26,6 +46,7 @@ int main(void)
   DIRFILE *D;
 
   memset(c, 0, 8);
+  rmdirfile();
   mkdir(filedir, 0777);
 
   for (fd = 0; fd < 256; ++fd)
diff --git a/test/convert_int64_complex64.c b/test/convert_int64_complex64.c
index 4059c61..0828bcb 100644
--- a/test/convert_int64_complex64.c
+++ b/test/convert_int64_complex64.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2009-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Attempt to read INT64 as COMPLEX64 */
 #include "test.h"
 
@@ -12,10 +32,10 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* data = __TEST__ "dirfile/data";
-  const char* format_data = "data RAW INT64 8\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *data = "dirfile/data";
+  const char *format_data = "data RAW INT64 8\n";
   int64_t data_data[256];
 #ifdef GD_NO_C99_API
   float c[16];
@@ -26,6 +46,7 @@ int main(void)
   DIRFILE *D;
 
   memset(c, 0, 8);
+  rmdirfile();
   mkdir(filedir, 0777);
 
   for (fd = 0; fd < 256; ++fd)
diff --git a/test/convert_int64_float32.c b/test/convert_int64_float32.c
index 0d8b70e..05729cb 100644
--- a/test/convert_int64_float32.c
+++ b/test/convert_int64_float32.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Attempt to read INT64 as FLOAT32 */
 #include "test.h"
 
@@ -12,16 +32,17 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* data = __TEST__ "dirfile/data";
-  const char* format_data = "data RAW INT64 8\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *data = "dirfile/data";
+  const char *format_data = "data RAW INT64 8\n";
   int64_t  data_data[256];
   float c[8];
   int fd, i, n, error, r = 0;
   DIRFILE *D;
 
   memset(c, 0, 8);
+  rmdirfile();
   mkdir(filedir, 0777);
 
   for (fd = 0; fd < 256; ++fd)
diff --git a/test/convert_int64_float64.c b/test/convert_int64_float64.c
index cdee8ba..99ac47f 100644
--- a/test/convert_int64_float64.c
+++ b/test/convert_int64_float64.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Attempt to read INT64 as FLOAT64 */
 #include "test.h"
 
@@ -12,16 +32,17 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* data = __TEST__ "dirfile/data";
-  const char* format_data = "data RAW INT64 8\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *data = "dirfile/data";
+  const char *format_data = "data RAW INT64 8\n";
   int64_t  data_data[256];
   double c[8];
   int fd, i, n, error, r = 0;
   DIRFILE *D;
 
   memset(c, 0, 8);
+  rmdirfile();
   mkdir(filedir, 0777);
 
   for (fd = 0; fd < 256; ++fd)
diff --git a/test/convert_int64_int16.c b/test/convert_int64_int16.c
index 4af8eb4..1b02322 100644
--- a/test/convert_int64_int16.c
+++ b/test/convert_int64_int16.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Attempt to read INT64 as INT16 */
 #include "test.h"
 
@@ -11,16 +31,17 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* data = __TEST__ "dirfile/data";
-  const char* format_data = "data RAW INT64 8\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *data = "dirfile/data";
+  const char *format_data = "data RAW INT64 8\n";
   int64_t  data_data[256];
   int16_t c[8];
   int fd, i, n, error, r = 0;
   DIRFILE *D;
 
   memset(c, 0, 8);
+  rmdirfile();
   mkdir(filedir, 0777);
 
   for (fd = 0; fd < 256; ++fd)
diff --git a/test/convert_int64_int32.c b/test/convert_int64_int32.c
index 837ec6d..09a0616 100644
--- a/test/convert_int64_int32.c
+++ b/test/convert_int64_int32.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Attempt to read INT64 as INT32 */
 #include "test.h"
 
@@ -11,16 +31,17 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* data = __TEST__ "dirfile/data";
-  const char* format_data = "data RAW INT64 8\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *data = "dirfile/data";
+  const char *format_data = "data RAW INT64 8\n";
   int64_t  data_data[256];
   int32_t c[8];
   int fd, i, n, error, r = 0;
   DIRFILE *D;
 
   memset(c, 0, 8);
+  rmdirfile();
   mkdir(filedir, 0777);
 
   for (fd = 0; fd < 256; ++fd)
diff --git a/test/convert_int64_int8.c b/test/convert_int64_int8.c
index 0dd16d6..863917d 100644
--- a/test/convert_int64_int8.c
+++ b/test/convert_int64_int8.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Attempt to read INT64 as INT8 */
 #include "test.h"
 
@@ -11,16 +31,17 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* data = __TEST__ "dirfile/data";
-  const char* format_data = "data RAW INT64 8\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *data = "dirfile/data";
+  const char *format_data = "data RAW INT64 8\n";
   int64_t  data_data[256];
   int8_t c[8];
   int fd, i, n, error, r = 0;
   DIRFILE *D;
 
   memset(c, 0, 8);
+  rmdirfile();
   mkdir(filedir, 0777);
 
   for (fd = 0; fd < 256; ++fd)
diff --git a/test/convert_int64_uint16.c b/test/convert_int64_uint16.c
index 2002470..d94af54 100644
--- a/test/convert_int64_uint16.c
+++ b/test/convert_int64_uint16.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Attempt to read INT64 as UINT16 */
 #include "test.h"
 
@@ -11,16 +31,17 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* data = __TEST__ "dirfile/data";
-  const char* format_data = "data RAW INT64 8\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *data = "dirfile/data";
+  const char *format_data = "data RAW INT64 8\n";
   int64_t data_data[256];
   uint16_t c[8];
   int fd, i, n, error, r = 0;
   DIRFILE *D;
 
   memset(c, 0, 8);
+  rmdirfile();
   mkdir(filedir, 0777);
 
   for (fd = 0; fd < 256; ++fd)
diff --git a/test/convert_int64_uint32.c b/test/convert_int64_uint32.c
index 38d52fe..a0bef2b 100644
--- a/test/convert_int64_uint32.c
+++ b/test/convert_int64_uint32.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Attempt to read INT64 as UINT32 */
 #include "test.h"
 
@@ -11,16 +31,17 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* data = __TEST__ "dirfile/data";
-  const char* format_data = "data RAW INT64 8\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *data = "dirfile/data";
+  const char *format_data = "data RAW INT64 8\n";
   int64_t data_data[256];
   uint32_t c[8];
   int fd, i, n, error, r = 0;
   DIRFILE *D;
 
   memset(c, 0, 8);
+  rmdirfile();
   mkdir(filedir, 0777);
 
   for (fd = 0; fd < 256; ++fd)
diff --git a/test/convert_int64_uint64.c b/test/convert_int64_uint64.c
index 59c6a87..8f38764 100644
--- a/test/convert_int64_uint64.c
+++ b/test/convert_int64_uint64.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Attempt to read INT64 as UINT64 */
 #include "test.h"
 
@@ -11,16 +31,17 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* data = __TEST__ "dirfile/data";
-  const char* format_data = "data RAW INT64 8\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *data = "dirfile/data";
+  const char *format_data = "data RAW INT64 8\n";
   int64_t data_data[256];
   uint64_t c[8];
   int fd, i, n, error, r = 0;
   DIRFILE *D;
 
   memset(c, 0, 8);
+  rmdirfile();
   mkdir(filedir, 0777);
 
   for (fd = 0; fd < 256; ++fd)
diff --git a/test/convert_int64_uint8.c b/test/convert_int64_uint8.c
index 736d9fb..246ae3c 100644
--- a/test/convert_int64_uint8.c
+++ b/test/convert_int64_uint8.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Attempt to read INT64 as UINT8 */
 #include "test.h"
 
@@ -11,16 +31,17 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* data = __TEST__ "dirfile/data";
-  const char* format_data = "data RAW INT64 8\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *data = "dirfile/data";
+  const char *format_data = "data RAW INT64 8\n";
   int64_t data_data[256];
   uint8_t c[8];
   int fd, i, n, error, r = 0;
   DIRFILE *D;
 
   memset(c, 0, 8);
+  rmdirfile();
   mkdir(filedir, 0777);
 
   for (fd = 0; fd < 256; ++fd)
diff --git a/test/convert_int8_complex128.c b/test/convert_int8_complex128.c
index ebf5ee1..041d0af 100644
--- a/test/convert_int8_complex128.c
+++ b/test/convert_int8_complex128.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2009-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Attempt to read INT8 as COMPLEX128 */
 #include "test.h"
 
@@ -12,10 +32,10 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* data = __TEST__ "dirfile/data";
-  const char* format_data = "data RAW INT8 8\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *data = "dirfile/data";
+  const char *format_data = "data RAW INT8 8\n";
 #ifdef GD_NO_C99_API
   double c[16];
 #else
@@ -26,6 +46,7 @@ int main(void)
   DIRFILE *D;
 
   memset(c, 0, 8);
+  rmdirfile();
   mkdir(filedir, 0777);
 
   for (fd = 0; fd < 256; ++fd)
diff --git a/test/convert_int8_complex64.c b/test/convert_int8_complex64.c
index 9a231cd..a77049b 100644
--- a/test/convert_int8_complex64.c
+++ b/test/convert_int8_complex64.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2009-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Attempt to read INT8 as COMPLEX64 */
 #include "test.h"
 
@@ -12,10 +32,10 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* data = __TEST__ "dirfile/data";
-  const char* format_data = "data RAW INT8 8\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *data = "dirfile/data";
+  const char *format_data = "data RAW INT8 8\n";
 #ifdef GD_NO_C99_API
   float c[16];
 #else
@@ -26,6 +46,7 @@ int main(void)
   DIRFILE *D;
 
   memset(c, 0, 8);
+  rmdirfile();
   mkdir(filedir, 0777);
 
   for (fd = 0; fd < 256; ++fd)
diff --git a/test/convert_int8_float32.c b/test/convert_int8_float32.c
index 258b876..fa1b7f6 100644
--- a/test/convert_int8_float32.c
+++ b/test/convert_int8_float32.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Attempt to read INT8 as FLOAT32 */
 #include "test.h"
 
@@ -12,16 +32,17 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* data = __TEST__ "dirfile/data";
-  const char* format_data = "data RAW INT8 8\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *data = "dirfile/data";
+  const char *format_data = "data RAW INT8 8\n";
   float c[8];
   int8_t data_data[256];
   int fd, i, n, error, r = 0;
   DIRFILE *D;
 
   memset(c, 0, 8);
+  rmdirfile();
   mkdir(filedir, 0777);
 
   for (fd = 0; fd < 256; ++fd)
diff --git a/test/convert_int8_float64.c b/test/convert_int8_float64.c
index e55c805..b11420e 100644
--- a/test/convert_int8_float64.c
+++ b/test/convert_int8_float64.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Attempt to read INT8 as FLOAT64 */
 #include "test.h"
 
@@ -12,16 +32,17 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* data = __TEST__ "dirfile/data";
-  const char* format_data = "data RAW INT8 8\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *data = "dirfile/data";
+  const char *format_data = "data RAW INT8 8\n";
   double c[8];
   int8_t data_data[256];
   int fd, i, n, error, r = 0;
   DIRFILE *D;
 
   memset(c, 0, 8);
+  rmdirfile();
   mkdir(filedir, 0777);
 
   for (fd = 0; fd < 256; ++fd)
diff --git a/test/convert_int8_int16.c b/test/convert_int8_int16.c
index ecd25e6..8c0bc6e 100644
--- a/test/convert_int8_int16.c
+++ b/test/convert_int8_int16.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Attempt to read INT8 as INT16 */
 #include "test.h"
 
@@ -11,16 +31,17 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* data = __TEST__ "dirfile/data";
-  const char* format_data = "data RAW INT8 8\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *data = "dirfile/data";
+  const char *format_data = "data RAW INT8 8\n";
   int16_t c[8];
   int8_t data_data[256];
   int fd, i, n, error, r = 0;
   DIRFILE *D;
 
   memset(c, 0, 8);
+  rmdirfile();
   mkdir(filedir, 0777);
 
   for (fd = 0; fd < 256; ++fd)
diff --git a/test/convert_int8_int32.c b/test/convert_int8_int32.c
index b8c47cc..34993b8 100644
--- a/test/convert_int8_int32.c
+++ b/test/convert_int8_int32.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Attempt to read INT8 as INT32 */
 #include "test.h"
 
@@ -11,16 +31,17 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* data = __TEST__ "dirfile/data";
-  const char* format_data = "data RAW INT8 8\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *data = "dirfile/data";
+  const char *format_data = "data RAW INT8 8\n";
   int32_t c[8];
   int8_t data_data[256];
   int fd, i, n, error, r = 0;
   DIRFILE *D;
 
   memset(c, 0, 8);
+  rmdirfile();
   mkdir(filedir, 0777);
 
   for (fd = 0; fd < 256; ++fd)
diff --git a/test/convert_int8_int64.c b/test/convert_int8_int64.c
index 0a01154..19112cc 100644
--- a/test/convert_int8_int64.c
+++ b/test/convert_int8_int64.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Attempt to read INT8 as INT64 */
 #include "test.h"
 
@@ -11,16 +31,17 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* data = __TEST__ "dirfile/data";
-  const char* format_data = "data RAW INT8 8\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *data = "dirfile/data";
+  const char *format_data = "data RAW INT8 8\n";
   int64_t c[8];
   int8_t data_data[256];
   int fd, i, n, error, r = 0;
   DIRFILE *D;
 
   memset(c, 0, 8);
+  rmdirfile();
   mkdir(filedir, 0777);
 
   for (fd = 0; fd < 256; ++fd)
diff --git a/test/convert_int8_uint16.c b/test/convert_int8_uint16.c
index 67daa25..6c6b93a 100644
--- a/test/convert_int8_uint16.c
+++ b/test/convert_int8_uint16.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Attempt to read INT8 as UINT16 */
 #include "test.h"
 
@@ -11,16 +31,17 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* data = __TEST__ "dirfile/data";
-  const char* format_data = "data RAW INT8 8\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *data = "dirfile/data";
+  const char *format_data = "data RAW INT8 8\n";
   uint16_t c[8];
   int8_t data_data[256];
   int fd, i, n, error, r = 0;
   DIRFILE *D;
 
   memset(c, 0, 8);
+  rmdirfile();
   mkdir(filedir, 0777);
 
   for (fd = 0; fd < 256; ++fd)
diff --git a/test/convert_int8_uint32.c b/test/convert_int8_uint32.c
index b75d6d8..22efe90 100644
--- a/test/convert_int8_uint32.c
+++ b/test/convert_int8_uint32.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Attempt to read INT8 as UINT32 */
 #include "test.h"
 
@@ -11,16 +31,17 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* data = __TEST__ "dirfile/data";
-  const char* format_data = "data RAW INT8 8\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *data = "dirfile/data";
+  const char *format_data = "data RAW INT8 8\n";
   uint32_t c[8];
   int8_t data_data[256];
   int fd, i, n, error, r = 0;
   DIRFILE *D;
 
   memset(c, 0, 8);
+  rmdirfile();
   mkdir(filedir, 0777);
 
   for (fd = 0; fd < 256; ++fd)
diff --git a/test/convert_int8_uint64.c b/test/convert_int8_uint64.c
index 7b7c79e..26445c7 100644
--- a/test/convert_int8_uint64.c
+++ b/test/convert_int8_uint64.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Attempt to read INT8 as UINT64 */
 #include "test.h"
 
@@ -11,16 +31,17 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* data = __TEST__ "dirfile/data";
-  const char* format_data = "data RAW INT8 8\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *data = "dirfile/data";
+  const char *format_data = "data RAW INT8 8\n";
   uint64_t c[8], i;
   int8_t data_data[256];
   int fd, n, error, r = 0;
   DIRFILE *D;
 
   memset(c, 0, 8);
+  rmdirfile();
   mkdir(filedir, 0777);
 
   for (fd = 0; fd < 256; ++fd)
diff --git a/test/convert_int8_uint8.c b/test/convert_int8_uint8.c
index a985646..326d546 100644
--- a/test/convert_int8_uint8.c
+++ b/test/convert_int8_uint8.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Attempt to read INT8 as UINT8 */
 #include "test.h"
 
@@ -11,16 +31,17 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* data = __TEST__ "dirfile/data";
-  const char* format_data = "data RAW INT8 8\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *data = "dirfile/data";
+  const char *format_data = "data RAW INT8 8\n";
   uint8_t c[8], i;
   int8_t data_data[256];
   int fd, n, error, r = 0;
   DIRFILE *D;
 
   memset(c, 0, 8);
+  rmdirfile();
   mkdir(filedir, 0777);
 
   for (fd = 0; fd < 256; ++fd)
diff --git a/test/convert_uint16_complex128.c b/test/convert_uint16_complex128.c
index 802d312..178ec27 100644
--- a/test/convert_uint16_complex128.c
+++ b/test/convert_uint16_complex128.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2009-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Attempt to read UINT16 as COMPLEX128 */
 #include "test.h"
 
@@ -12,10 +32,10 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* data = __TEST__ "dirfile/data";
-  const char* format_data = "data RAW UINT16 8\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *data = "dirfile/data";
+  const char *format_data = "data RAW UINT16 8\n";
   uint16_t  data_data[256];
 #ifdef GD_NO_C99_API
   double c[16];
@@ -26,6 +46,7 @@ int main(void)
   DIRFILE *D;
 
   memset(c, 0, 8);
+  rmdirfile();
   mkdir(filedir, 0777);
 
   for (fd = 0; fd < 256; ++fd)
diff --git a/test/convert_uint16_complex64.c b/test/convert_uint16_complex64.c
index ab2be2b..c3dcedc 100644
--- a/test/convert_uint16_complex64.c
+++ b/test/convert_uint16_complex64.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2009-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Attempt to read UINT16 as COMPLEX64 */
 #include "test.h"
 
@@ -12,10 +32,10 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* data = __TEST__ "dirfile/data";
-  const char* format_data = "data RAW UINT16 8\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *data = "dirfile/data";
+  const char *format_data = "data RAW UINT16 8\n";
   uint16_t  data_data[256];
 #ifdef GD_NO_C99_API
   float c[16];
@@ -26,6 +46,7 @@ int main(void)
   DIRFILE *D;
 
   memset(c, 0, 8);
+  rmdirfile();
   mkdir(filedir, 0777);
 
   for (fd = 0; fd < 256; ++fd)
diff --git a/test/convert_uint16_float32.c b/test/convert_uint16_float32.c
index f0eedee..ee3cee9 100644
--- a/test/convert_uint16_float32.c
+++ b/test/convert_uint16_float32.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Attempt to read UINT16 as FLOAT32 */
 #include "test.h"
 
@@ -12,16 +32,17 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* data = __TEST__ "dirfile/data";
-  const char* format_data = "data RAW UINT16 8\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *data = "dirfile/data";
+  const char *format_data = "data RAW UINT16 8\n";
   uint16_t  data_data[256];
   float c[8];
   int fd, i, n, error, r = 0;
   DIRFILE *D;
 
   memset(c, 0, 8);
+  rmdirfile();
   mkdir(filedir, 0777);
 
   for (fd = 0; fd < 256; ++fd)
diff --git a/test/convert_uint16_float64.c b/test/convert_uint16_float64.c
index f706607..0731c7d 100644
--- a/test/convert_uint16_float64.c
+++ b/test/convert_uint16_float64.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Attempt to read UINT16 as FLOAT64 */
 #include "test.h"
 
@@ -12,16 +32,17 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* data = __TEST__ "dirfile/data";
-  const char* format_data = "data RAW UINT16 8\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *data = "dirfile/data";
+  const char *format_data = "data RAW UINT16 8\n";
   uint16_t  data_data[256];
   double c[8];
   int fd, i, n, error, r = 0;
   DIRFILE *D;
 
   memset(c, 0, 8);
+  rmdirfile();
   mkdir(filedir, 0777);
 
   for (fd = 0; fd < 256; ++fd)
diff --git a/test/convert_uint16_int16.c b/test/convert_uint16_int16.c
index 4f84679..e28eb72 100644
--- a/test/convert_uint16_int16.c
+++ b/test/convert_uint16_int16.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Attempt to read UINT16 as INT16 */
 #include "test.h"
 
@@ -11,16 +31,17 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* data = __TEST__ "dirfile/data";
-  const char* format_data = "data RAW UINT16 8\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *data = "dirfile/data";
+  const char *format_data = "data RAW UINT16 8\n";
   uint16_t  data_data[256];
   int16_t c[8];
   int fd, i, n, error, r = 0;
   DIRFILE *D;
 
   memset(c, 0, 8);
+  rmdirfile();
   mkdir(filedir, 0777);
 
   for (fd = 0; fd < 256; ++fd)
diff --git a/test/convert_uint16_int32.c b/test/convert_uint16_int32.c
index 4463022..147ccc5 100644
--- a/test/convert_uint16_int32.c
+++ b/test/convert_uint16_int32.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Attempt to read UINT16 as INT32 */
 #include "test.h"
 
@@ -11,16 +31,17 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* data = __TEST__ "dirfile/data";
-  const char* format_data = "data RAW UINT16 8\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *data = "dirfile/data";
+  const char *format_data = "data RAW UINT16 8\n";
   uint16_t  data_data[256];
   int32_t c[8];
   int fd, i, n, error, r = 0;
   DIRFILE *D;
 
   memset(c, 0, 8);
+  rmdirfile();
   mkdir(filedir, 0777);
 
   for (fd = 0; fd < 256; ++fd)
diff --git a/test/convert_uint16_int64.c b/test/convert_uint16_int64.c
index 7dbc943..4811ce0 100644
--- a/test/convert_uint16_int64.c
+++ b/test/convert_uint16_int64.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Attempt to read UINT16 as INT64 */
 #include "test.h"
 
@@ -11,16 +31,17 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* data = __TEST__ "dirfile/data";
-  const char* format_data = "data RAW UINT16 8\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *data = "dirfile/data";
+  const char *format_data = "data RAW UINT16 8\n";
   uint16_t  data_data[256];
   int64_t c[8];
   int fd, i, n, error, r = 0;
   DIRFILE *D;
 
   memset(c, 0, 8);
+  rmdirfile();
   mkdir(filedir, 0777);
 
   for (fd = 0; fd < 256; ++fd)
diff --git a/test/convert_uint16_int8.c b/test/convert_uint16_int8.c
index 1f0bca4..f2376ba 100644
--- a/test/convert_uint16_int8.c
+++ b/test/convert_uint16_int8.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Attempt to read UINT16 as INT8 */
 #include "test.h"
 
@@ -11,16 +31,17 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* data = __TEST__ "dirfile/data";
-  const char* format_data = "data RAW UINT16 8\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *data = "dirfile/data";
+  const char *format_data = "data RAW UINT16 8\n";
   uint16_t  data_data[256];
   int8_t c[8];
   int fd, i, n, error, r = 0;
   DIRFILE *D;
 
   memset(c, 0, 8);
+  rmdirfile();
   mkdir(filedir, 0777);
 
   for (fd = 0; fd < 256; ++fd)
diff --git a/test/convert_uint16_uint32.c b/test/convert_uint16_uint32.c
index 118c992..aca283c 100644
--- a/test/convert_uint16_uint32.c
+++ b/test/convert_uint16_uint32.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Attempt to read UINT16 as UINT32 */
 #include "test.h"
 
@@ -11,16 +31,17 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* data = __TEST__ "dirfile/data";
-  const char* format_data = "data RAW UINT16 8\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *data = "dirfile/data";
+  const char *format_data = "data RAW UINT16 8\n";
   uint16_t  data_data[256];
   uint32_t c[8];
   int fd, i, n, error, r = 0;
   DIRFILE *D;
 
   memset(c, 0, 8);
+  rmdirfile();
   mkdir(filedir, 0777);
 
   for (fd = 0; fd < 256; ++fd)
diff --git a/test/convert_uint16_uint64.c b/test/convert_uint16_uint64.c
index 5a0ba72..0b2c6d2 100644
--- a/test/convert_uint16_uint64.c
+++ b/test/convert_uint16_uint64.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Attempt to read UINT16 as UINT64 */
 #include "test.h"
 
@@ -11,16 +31,17 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* data = __TEST__ "dirfile/data";
-  const char* format_data = "data RAW UINT16 8\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *data = "dirfile/data";
+  const char *format_data = "data RAW UINT16 8\n";
   uint16_t  data_data[256];
   uint64_t c[8];
   int fd, i, n, error, r = 0;
   DIRFILE *D;
 
   memset(c, 0, 8);
+  rmdirfile();
   mkdir(filedir, 0777);
 
   for (fd = 0; fd < 256; ++fd)
diff --git a/test/convert_uint16_uint8.c b/test/convert_uint16_uint8.c
index 7778100..294ba5c 100644
--- a/test/convert_uint16_uint8.c
+++ b/test/convert_uint16_uint8.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Attempt to read UINT16 as UINT8 */
 #include "test.h"
 
@@ -11,16 +31,17 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* data = __TEST__ "dirfile/data";
-  const char* format_data = "data RAW UINT16 8\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *data = "dirfile/data";
+  const char *format_data = "data RAW UINT16 8\n";
   uint16_t  data_data[256];
   uint8_t c[8];
   int fd, i, n, error, r = 0;
   DIRFILE *D;
 
   memset(c, 0, 8);
+  rmdirfile();
   mkdir(filedir, 0777);
 
   for (fd = 0; fd < 256; ++fd)
diff --git a/test/convert_uint32_complex128.c b/test/convert_uint32_complex128.c
index 96b61b2..8861fdf 100644
--- a/test/convert_uint32_complex128.c
+++ b/test/convert_uint32_complex128.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2009-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Attempt to read UINT32 as COMPLEX128 */
 #include "test.h"
 
@@ -12,10 +32,10 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* data = __TEST__ "dirfile/data";
-  const char* format_data = "data RAW UINT32 8\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *data = "dirfile/data";
+  const char *format_data = "data RAW UINT32 8\n";
   uint32_t  data_data[256];
 #ifdef GD_NO_C99_API
   double c[16];
@@ -26,6 +46,7 @@ int main(void)
   DIRFILE *D;
 
   memset(c, 0, 8);
+  rmdirfile();
   mkdir(filedir, 0777);
 
   for (fd = 0; fd < 256; ++fd)
diff --git a/test/convert_uint32_complex64.c b/test/convert_uint32_complex64.c
index 3d9437e..6749c2a 100644
--- a/test/convert_uint32_complex64.c
+++ b/test/convert_uint32_complex64.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2009-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Attempt to read UINT32 as COMPLEX64 */
 #include "test.h"
 
@@ -12,10 +32,10 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* data = __TEST__ "dirfile/data";
-  const char* format_data = "data RAW UINT32 8\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *data = "dirfile/data";
+  const char *format_data = "data RAW UINT32 8\n";
   uint32_t  data_data[256];
 #ifdef GD_NO_C99_API
   float c[16];
@@ -26,6 +46,7 @@ int main(void)
   DIRFILE *D;
 
   memset(c, 0, 8);
+  rmdirfile();
   mkdir(filedir, 0777);
 
   for (fd = 0; fd < 256; ++fd)
diff --git a/test/convert_uint32_float32.c b/test/convert_uint32_float32.c
index 68ff3b1..a6ee729 100644
--- a/test/convert_uint32_float32.c
+++ b/test/convert_uint32_float32.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Attempt to read UINT32 as FLOAT32 */
 #include "test.h"
 
@@ -12,16 +32,17 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* data = __TEST__ "dirfile/data";
-  const char* format_data = "data RAW UINT32 8\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *data = "dirfile/data";
+  const char *format_data = "data RAW UINT32 8\n";
   uint32_t  data_data[256];
   float c[8];
   int fd, i, n, error, r = 0;
   DIRFILE *D;
 
   memset(c, 0, 8);
+  rmdirfile();
   mkdir(filedir, 0777);
 
   for (fd = 0; fd < 256; ++fd)
diff --git a/test/convert_uint32_float64.c b/test/convert_uint32_float64.c
index fe70280..056d90e 100644
--- a/test/convert_uint32_float64.c
+++ b/test/convert_uint32_float64.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Attempt to read UINT32 as FLOAT64 */
 #include "test.h"
 
@@ -12,16 +32,17 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* data = __TEST__ "dirfile/data";
-  const char* format_data = "data RAW UINT32 8\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *data = "dirfile/data";
+  const char *format_data = "data RAW UINT32 8\n";
   uint32_t  data_data[256];
   double c[8];
   int fd, i, n, error, r = 0;
   DIRFILE *D;
 
   memset(c, 0, 8);
+  rmdirfile();
   mkdir(filedir, 0777);
 
   for (fd = 0; fd < 256; ++fd)
diff --git a/test/convert_uint32_int16.c b/test/convert_uint32_int16.c
index 5438102..b0f288a 100644
--- a/test/convert_uint32_int16.c
+++ b/test/convert_uint32_int16.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Attempt to read UINT32 as INT16 */
 #include "test.h"
 
@@ -11,16 +31,17 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* data = __TEST__ "dirfile/data";
-  const char* format_data = "data RAW UINT32 8\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *data = "dirfile/data";
+  const char *format_data = "data RAW UINT32 8\n";
   uint32_t  data_data[256];
   int16_t c[8];
   int fd, i, n, error, r = 0;
   DIRFILE *D;
 
   memset(c, 0, 8);
+  rmdirfile();
   mkdir(filedir, 0777);
 
   for (fd = 0; fd < 256; ++fd)
diff --git a/test/convert_uint32_int32.c b/test/convert_uint32_int32.c
index a57f5a0..b0762f2 100644
--- a/test/convert_uint32_int32.c
+++ b/test/convert_uint32_int32.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Attempt to read UINT32 as INT32 */
 #include "test.h"
 
@@ -11,16 +31,17 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* data = __TEST__ "dirfile/data";
-  const char* format_data = "data RAW UINT32 8\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *data = "dirfile/data";
+  const char *format_data = "data RAW UINT32 8\n";
   uint32_t  data_data[256];
   int32_t c[8];
   int fd, i, n, error, r = 0;
   DIRFILE *D;
 
   memset(c, 0, 8);
+  rmdirfile();
   mkdir(filedir, 0777);
 
   for (fd = 0; fd < 256; ++fd)
diff --git a/test/convert_uint32_int64.c b/test/convert_uint32_int64.c
index fa585f9..165540f 100644
--- a/test/convert_uint32_int64.c
+++ b/test/convert_uint32_int64.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Attempt to read UINT32 as INT64 */
 #include "test.h"
 
@@ -11,16 +31,17 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* data = __TEST__ "dirfile/data";
-  const char* format_data = "data RAW UINT32 8\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *data = "dirfile/data";
+  const char *format_data = "data RAW UINT32 8\n";
   uint32_t  data_data[256];
   int64_t c[8];
   int fd, i, n, error, r = 0;
   DIRFILE *D;
 
   memset(c, 0, 8);
+  rmdirfile();
   mkdir(filedir, 0777);
 
   for (fd = 0; fd < 256; ++fd)
diff --git a/test/convert_uint32_int8.c b/test/convert_uint32_int8.c
index 1969e8c..072d48e 100644
--- a/test/convert_uint32_int8.c
+++ b/test/convert_uint32_int8.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Attempt to read UINT32 as INT8 */
 #include "test.h"
 
@@ -11,16 +31,17 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* data = __TEST__ "dirfile/data";
-  const char* format_data = "data RAW UINT32 8\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *data = "dirfile/data";
+  const char *format_data = "data RAW UINT32 8\n";
   uint32_t  data_data[256];
   int8_t c[8];
   int fd, i, n, error, r = 0;
   DIRFILE *D;
 
   memset(c, 0, 8);
+  rmdirfile();
   mkdir(filedir, 0777);
 
   for (fd = 0; fd < 256; ++fd)
diff --git a/test/convert_uint32_uint16.c b/test/convert_uint32_uint16.c
index ab4daf5..7b746f6 100644
--- a/test/convert_uint32_uint16.c
+++ b/test/convert_uint32_uint16.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Attempt to read UINT32 as UINT16 */
 #include "test.h"
 
@@ -11,16 +31,17 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* data = __TEST__ "dirfile/data";
-  const char* format_data = "data RAW UINT32 8\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *data = "dirfile/data";
+  const char *format_data = "data RAW UINT32 8\n";
   uint32_t  data_data[256];
   uint16_t c[8];
   int fd, i, n, error, r = 0;
   DIRFILE *D;
 
   memset(c, 0, 8);
+  rmdirfile();
   mkdir(filedir, 0777);
 
   for (fd = 0; fd < 256; ++fd)
diff --git a/test/convert_uint32_uint64.c b/test/convert_uint32_uint64.c
index 48a5179..073836e 100644
--- a/test/convert_uint32_uint64.c
+++ b/test/convert_uint32_uint64.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Attempt to read UINT32 as UINT64 */
 #include "test.h"
 
@@ -11,16 +31,17 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* data = __TEST__ "dirfile/data";
-  const char* format_data = "data RAW UINT32 8\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *data = "dirfile/data";
+  const char *format_data = "data RAW UINT32 8\n";
   uint32_t  data_data[256];
   uint64_t c[8];
   int fd, i, n, error, r = 0;
   DIRFILE *D;
 
   memset(c, 0, 8);
+  rmdirfile();
   mkdir(filedir, 0777);
 
   for (fd = 0; fd < 256; ++fd)
diff --git a/test/convert_uint32_uint8.c b/test/convert_uint32_uint8.c
index 5248c4d..b1d8112 100644
--- a/test/convert_uint32_uint8.c
+++ b/test/convert_uint32_uint8.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Attempt to read UINT32 as UINT8 */
 #include "test.h"
 
@@ -11,16 +31,17 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* data = __TEST__ "dirfile/data";
-  const char* format_data = "data RAW UINT32 8\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *data = "dirfile/data";
+  const char *format_data = "data RAW UINT32 8\n";
   uint32_t  data_data[256];
   uint8_t c[8];
   int fd, i, n, error, r = 0;
   DIRFILE *D;
 
   memset(c, 0, 8);
+  rmdirfile();
   mkdir(filedir, 0777);
 
   for (fd = 0; fd < 256; ++fd)
diff --git a/test/convert_uint64_complex128.c b/test/convert_uint64_complex128.c
index d6123ab..8c3deb0 100644
--- a/test/convert_uint64_complex128.c
+++ b/test/convert_uint64_complex128.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2009-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Attempt to read UINT64 as COMPLEX128 */
 #include "test.h"
 
@@ -12,10 +32,10 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* data = __TEST__ "dirfile/data";
-  const char* format_data = "data RAW UINT64 8\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *data = "dirfile/data";
+  const char *format_data = "data RAW UINT64 8\n";
   uint64_t  data_data[256];
 #ifdef GD_NO_C99_API
   double c[16];
@@ -26,6 +46,7 @@ int main(void)
   DIRFILE *D;
 
   memset(c, 0, 8);
+  rmdirfile();
   mkdir(filedir, 0777);
 
   for (fd = 0; fd < 256; ++fd)
diff --git a/test/convert_uint64_complex64.c b/test/convert_uint64_complex64.c
index 3d8f88b..dc4e06a 100644
--- a/test/convert_uint64_complex64.c
+++ b/test/convert_uint64_complex64.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2009-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Attempt to read UINT64 as COMPLEX64 */
 #include "test.h"
 
@@ -12,10 +32,10 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* data = __TEST__ "dirfile/data";
-  const char* format_data = "data RAW UINT64 8\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *data = "dirfile/data";
+  const char *format_data = "data RAW UINT64 8\n";
   uint64_t  data_data[256];
 #ifdef GD_NO_C99_API
   float c[16];
@@ -26,6 +46,7 @@ int main(void)
   DIRFILE *D;
 
   memset(c, 0, 8);
+  rmdirfile();
   mkdir(filedir, 0777);
 
   for (fd = 0; fd < 256; ++fd)
diff --git a/test/convert_uint64_float32.c b/test/convert_uint64_float32.c
index 508b3c3..83a60a4 100644
--- a/test/convert_uint64_float32.c
+++ b/test/convert_uint64_float32.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Attempt to read UINT64 as FLOAT32 */
 #include "test.h"
 
@@ -12,16 +32,17 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* data = __TEST__ "dirfile/data";
-  const char* format_data = "data RAW UINT64 8\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *data = "dirfile/data";
+  const char *format_data = "data RAW UINT64 8\n";
   uint64_t  data_data[256];
   float c[8];
   int fd, i, n, error, r = 0;
   DIRFILE *D;
 
   memset(c, 0, 8);
+  rmdirfile();
   mkdir(filedir, 0777);
 
   for (fd = 0; fd < 256; ++fd)
diff --git a/test/convert_uint64_float64.c b/test/convert_uint64_float64.c
index c5f46e1..6c7480e 100644
--- a/test/convert_uint64_float64.c
+++ b/test/convert_uint64_float64.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Attempt to read UINT64 as FLOAT64 */
 #include "test.h"
 
@@ -12,16 +32,17 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* data = __TEST__ "dirfile/data";
-  const char* format_data = "data RAW UINT64 8\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *data = "dirfile/data";
+  const char *format_data = "data RAW UINT64 8\n";
   uint64_t  data_data[256];
   double c[8];
   int fd, i, n, error, r = 0;
   DIRFILE *D;
 
   memset(c, 0, 8);
+  rmdirfile();
   mkdir(filedir, 0777);
 
   for (fd = 0; fd < 256; ++fd)
diff --git a/test/convert_uint64_int16.c b/test/convert_uint64_int16.c
index a927872..a18a32a 100644
--- a/test/convert_uint64_int16.c
+++ b/test/convert_uint64_int16.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Attempt to read UINT64 as INT16 */
 #include "test.h"
 
@@ -11,16 +31,17 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* data = __TEST__ "dirfile/data";
-  const char* format_data = "data RAW UINT64 8\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *data = "dirfile/data";
+  const char *format_data = "data RAW UINT64 8\n";
   uint64_t  data_data[256];
   int16_t c[8];
   int fd, i, n, error, r = 0;
   DIRFILE *D;
 
   memset(c, 0, 8);
+  rmdirfile();
   mkdir(filedir, 0777);
 
   for (fd = 0; fd < 256; ++fd)
diff --git a/test/convert_uint64_int32.c b/test/convert_uint64_int32.c
index f6718cd..cf3c960 100644
--- a/test/convert_uint64_int32.c
+++ b/test/convert_uint64_int32.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Attempt to read UINT64 as INT32 */
 #include "test.h"
 
@@ -11,16 +31,17 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* data = __TEST__ "dirfile/data";
-  const char* format_data = "data RAW UINT64 8\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *data = "dirfile/data";
+  const char *format_data = "data RAW UINT64 8\n";
   uint64_t  data_data[256];
   int32_t c[8];
   int fd, i, n, error, r = 0;
   DIRFILE *D;
 
   memset(c, 0, 8);
+  rmdirfile();
   mkdir(filedir, 0777);
 
   for (fd = 0; fd < 256; ++fd)
diff --git a/test/convert_uint64_int64.c b/test/convert_uint64_int64.c
index f903dc4..696f92e 100644
--- a/test/convert_uint64_int64.c
+++ b/test/convert_uint64_int64.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Attempt to read UINT64 as INT64 */
 #include "test.h"
 
@@ -11,16 +31,17 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* data = __TEST__ "dirfile/data";
-  const char* format_data = "data RAW UINT64 8\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *data = "dirfile/data";
+  const char *format_data = "data RAW UINT64 8\n";
   uint64_t  data_data[256];
   int64_t c[8];
   int fd, i, n, error, r = 0;
   DIRFILE *D;
 
   memset(c, 0, 8);
+  rmdirfile();
   mkdir(filedir, 0777);
 
   for (fd = 0; fd < 256; ++fd)
diff --git a/test/convert_uint64_int8.c b/test/convert_uint64_int8.c
index 4dfffd2..9f1039c 100644
--- a/test/convert_uint64_int8.c
+++ b/test/convert_uint64_int8.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Attempt to read UINT64 as INT8 */
 #include "test.h"
 
@@ -11,16 +31,17 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* data = __TEST__ "dirfile/data";
-  const char* format_data = "data RAW UINT64 8\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *data = "dirfile/data";
+  const char *format_data = "data RAW UINT64 8\n";
   uint64_t  data_data[256];
   int8_t c[8];
   int fd, i, n, error, r = 0;
   DIRFILE *D;
 
   memset(c, 0, 8);
+  rmdirfile();
   mkdir(filedir, 0777);
 
   for (fd = 0; fd < 256; ++fd)
diff --git a/test/convert_uint64_uint16.c b/test/convert_uint64_uint16.c
index e89ea2e..fd70f38 100644
--- a/test/convert_uint64_uint16.c
+++ b/test/convert_uint64_uint16.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Attempt to read UINT64 as UINT16 */
 #include "test.h"
 
@@ -11,16 +31,17 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* data = __TEST__ "dirfile/data";
-  const char* format_data = "data RAW UINT64 8\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *data = "dirfile/data";
+  const char *format_data = "data RAW UINT64 8\n";
   uint64_t  data_data[256];
   uint16_t c[8];
   int fd, i, n, error, r = 0;
   DIRFILE *D;
 
   memset(c, 0, 8);
+  rmdirfile();
   mkdir(filedir, 0777);
 
   for (fd = 0; fd < 256; ++fd)
diff --git a/test/convert_uint64_uint32.c b/test/convert_uint64_uint32.c
index 9376292..d01edf8 100644
--- a/test/convert_uint64_uint32.c
+++ b/test/convert_uint64_uint32.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Attempt to read UINT64 as UINT32 */
 #include "test.h"
 
@@ -11,16 +31,17 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* data = __TEST__ "dirfile/data";
-  const char* format_data = "data RAW UINT64 8\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *data = "dirfile/data";
+  const char *format_data = "data RAW UINT64 8\n";
   uint64_t  data_data[256];
   uint32_t c[8];
   int fd, i, n, error, r = 0;
   DIRFILE *D;
 
   memset(c, 0, 8);
+  rmdirfile();
   mkdir(filedir, 0777);
 
   for (fd = 0; fd < 256; ++fd)
diff --git a/test/convert_uint64_uint8.c b/test/convert_uint64_uint8.c
index aa8430a..2d2aa9d 100644
--- a/test/convert_uint64_uint8.c
+++ b/test/convert_uint64_uint8.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Attempt to read UINT64 as UINT8 */
 #include "test.h"
 
@@ -11,16 +31,17 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* data = __TEST__ "dirfile/data";
-  const char* format_data = "data RAW UINT64 8\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *data = "dirfile/data";
+  const char *format_data = "data RAW UINT64 8\n";
   uint64_t  data_data[256];
   uint8_t c[8];
   int fd, i, n, error, r = 0;
   DIRFILE *D;
 
   memset(c, 0, 8);
+  rmdirfile();
   mkdir(filedir, 0777);
 
   for (fd = 0; fd < 256; ++fd)
diff --git a/test/convert_uint8_complex128.c b/test/convert_uint8_complex128.c
index dccd703..f4f9d32 100644
--- a/test/convert_uint8_complex128.c
+++ b/test/convert_uint8_complex128.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2009-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Attempt to read UINT8 as COMPLEX128 */
 #include "test.h"
 
@@ -12,10 +32,10 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* data = __TEST__ "dirfile/data";
-  const char* format_data = "data RAW UINT8 8\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *data = "dirfile/data";
+  const char *format_data = "data RAW UINT8 8\n";
 #ifdef GD_NO_C99_API
   double c[16];
 #else
@@ -26,6 +46,7 @@ int main(void)
   DIRFILE *D;
 
   memset(c, 0, 8);
+  rmdirfile();
   mkdir(filedir, 0777);
 
   for (fd = 0; fd < 256; ++fd)
diff --git a/test/convert_uint8_complex64.c b/test/convert_uint8_complex64.c
index c50807c..b4fb472 100644
--- a/test/convert_uint8_complex64.c
+++ b/test/convert_uint8_complex64.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2009-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Attempt to read UINT8 as COMPLEX64 */
 #include "test.h"
 
@@ -12,10 +32,10 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* data = __TEST__ "dirfile/data";
-  const char* format_data = "data RAW UINT8 8\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *data = "dirfile/data";
+  const char *format_data = "data RAW UINT8 8\n";
 #ifdef GD_NO_C99_API
   float c[16];
 #else
@@ -26,6 +46,7 @@ int main(void)
   DIRFILE *D;
 
   memset(c, 0, 8);
+  rmdirfile();
   mkdir(filedir, 0777);
 
   for (fd = 0; fd < 256; ++fd)
diff --git a/test/convert_uint8_float32.c b/test/convert_uint8_float32.c
index e8e9c49..8775b6b 100644
--- a/test/convert_uint8_float32.c
+++ b/test/convert_uint8_float32.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Attempt to read UINT8 as FLOAT32 */
 #include "test.h"
 
@@ -12,16 +32,17 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* data = __TEST__ "dirfile/data";
-  const char* format_data = "data RAW UINT8 8\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *data = "dirfile/data";
+  const char *format_data = "data RAW UINT8 8\n";
   float c[8];
   unsigned char data_data[256];
   int fd, i, n, error, r = 0;
   DIRFILE *D;
 
   memset(c, 0, 8);
+  rmdirfile();
   mkdir(filedir, 0777);
 
   for (fd = 0; fd < 256; ++fd)
diff --git a/test/convert_uint8_float64.c b/test/convert_uint8_float64.c
index 1488146..ace524b 100644
--- a/test/convert_uint8_float64.c
+++ b/test/convert_uint8_float64.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Attempt to read UINT8 as FLOAT64 */
 #include "test.h"
 
@@ -12,16 +32,17 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* data = __TEST__ "dirfile/data";
-  const char* format_data = "data RAW UINT8 8\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *data = "dirfile/data";
+  const char *format_data = "data RAW UINT8 8\n";
   double c[8];
   unsigned char data_data[256];
   int fd, i, n, error, r = 0;
   DIRFILE *D;
 
   memset(c, 0, 8);
+  rmdirfile();
   mkdir(filedir, 0777);
 
   for (fd = 0; fd < 256; ++fd)
diff --git a/test/convert_uint8_int16.c b/test/convert_uint8_int16.c
index 6c4ff7d..2fa87b1 100644
--- a/test/convert_uint8_int16.c
+++ b/test/convert_uint8_int16.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Attempt to read UINT8 as INT16 */
 #include "test.h"
 
@@ -11,16 +31,17 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* data = __TEST__ "dirfile/data";
-  const char* format_data = "data RAW UINT8 8\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *data = "dirfile/data";
+  const char *format_data = "data RAW UINT8 8\n";
   int16_t c[8];
   unsigned char data_data[256];
   int fd, i, n, error, r = 0;
   DIRFILE *D;
 
   memset(c, 0, 8);
+  rmdirfile();
   mkdir(filedir, 0777);
 
   for (fd = 0; fd < 256; ++fd)
diff --git a/test/convert_uint8_int32.c b/test/convert_uint8_int32.c
index 4a13ee2..4299405 100644
--- a/test/convert_uint8_int32.c
+++ b/test/convert_uint8_int32.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Attempt to read UINT8 as INT32 */
 #include "test.h"
 
@@ -11,16 +31,17 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* data = __TEST__ "dirfile/data";
-  const char* format_data = "data RAW UINT8 8\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *data = "dirfile/data";
+  const char *format_data = "data RAW UINT8 8\n";
   int32_t c[8];
   unsigned char data_data[256];
   int fd, i, n, error, r = 0;
   DIRFILE *D;
 
   memset(c, 0, 8);
+  rmdirfile();
   mkdir(filedir, 0777);
 
   for (fd = 0; fd < 256; ++fd)
diff --git a/test/convert_uint8_int64.c b/test/convert_uint8_int64.c
index b735e0b..4c4ead4 100644
--- a/test/convert_uint8_int64.c
+++ b/test/convert_uint8_int64.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Attempt to read UINT8 as INT64 */
 #include "test.h"
 
@@ -11,16 +31,17 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* data = __TEST__ "dirfile/data";
-  const char* format_data = "data RAW UINT8 8\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *data = "dirfile/data";
+  const char *format_data = "data RAW UINT8 8\n";
   int64_t c[8];
   unsigned char data_data[256];
   int fd, i, n, error, r = 0;
   DIRFILE *D;
 
   memset(c, 0, 8);
+  rmdirfile();
   mkdir(filedir, 0777);
 
   for (fd = 0; fd < 256; ++fd)
diff --git a/test/convert_uint8_int8.c b/test/convert_uint8_int8.c
index f0d1452..7ea9bb6 100644
--- a/test/convert_uint8_int8.c
+++ b/test/convert_uint8_int8.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Attempt to read UINT8 as INT8 */
 #include "test.h"
 
@@ -11,16 +31,17 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* data = __TEST__ "dirfile/data";
-  const char* format_data = "data RAW UINT8 8\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *data = "dirfile/data";
+  const char *format_data = "data RAW UINT8 8\n";
   int8_t c[8];
   uint8_t data_data[256];
   int fd, i, n, error, r = 0;
   DIRFILE *D;
 
   memset(c, 0, 8);
+  rmdirfile();
   mkdir(filedir, 0777);
 
   for (fd = 0; fd < 256; ++fd)
diff --git a/test/convert_uint8_uint16.c b/test/convert_uint8_uint16.c
index 5fb532b..ce05591 100644
--- a/test/convert_uint8_uint16.c
+++ b/test/convert_uint8_uint16.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Attempt to read UINT8 as UINT16 */
 #include "test.h"
 
@@ -12,16 +32,17 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* data = __TEST__ "dirfile/data";
-  const char* format_data = "data RAW UINT8 8\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *data = "dirfile/data";
+  const char *format_data = "data RAW UINT8 8\n";
   uint16_t c[8];
   unsigned char data_data[256];
   int fd, i, n, error, r = 0;
   DIRFILE *D;
 
   memset(c, 0, 8);
+  rmdirfile();
   mkdir(filedir, 0777);
 
   for (fd = 0; fd < 256; ++fd)
diff --git a/test/convert_uint8_uint32.c b/test/convert_uint8_uint32.c
index 00d7302..9a470a5 100644
--- a/test/convert_uint8_uint32.c
+++ b/test/convert_uint8_uint32.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Attempt to read UINT8 as UINT32 */
 #include "test.h"
 
@@ -12,16 +32,17 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* data = __TEST__ "dirfile/data";
-  const char* format_data = "data RAW UINT8 8\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *data = "dirfile/data";
+  const char *format_data = "data RAW UINT8 8\n";
   uint32_t c[8];
   unsigned char data_data[256];
   int fd, i, n, error, r = 0;
   DIRFILE *D;
 
   memset(c, 0, 8);
+  rmdirfile();
   mkdir(filedir, 0777);
 
   for (fd = 0; fd < 256; ++fd)
diff --git a/test/convert_uint8_uint64.c b/test/convert_uint8_uint64.c
index 6687054..6c94a81 100644
--- a/test/convert_uint8_uint64.c
+++ b/test/convert_uint8_uint64.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Attempt to read UINT8 as UINT64 */
 #include "test.h"
 
@@ -12,16 +32,17 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* data = __TEST__ "dirfile/data";
-  const char* format_data = "data RAW UINT8 8\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *data = "dirfile/data";
+  const char *format_data = "data RAW UINT8 8\n";
   uint64_t c[8];
   unsigned char data_data[256];
   int fd, i, n, error, r = 0;
   DIRFILE *D;
 
   memset(c, 0, 8);
+  rmdirfile();
   mkdir(filedir, 0777);
 
   for (fd = 0; fd < 256; ++fd)
diff --git a/test/creat.c b/test/creat.c
index e15cf95..95d142b 100644
--- a/test/creat.c
+++ b/test/creat.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Creating a dirfile should succeed cleanly */
 #include "test.h"
 
@@ -10,12 +30,14 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  int unlink_ret, rmdir_ret, r = 0;
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  int error, unlink_ret, rmdir_ret, r = 0;
+  DIRFILE *D;
 
-  DIRFILE* D = gd_open(filedir, GD_RDWR | GD_CREAT | GD_VERBOSE);
-  int error = gd_error(D);
+  rmdirfile();
+  D = gd_open(filedir, GD_RDWR | GD_CREAT | GD_VERBOSE);
+  error = gd_error(D);
   gd_close(D);
 
   unlink_ret = unlink(format);
diff --git a/test/creat_excl.c b/test/creat_excl.c
index 0f5608f..6f854e9 100644
--- a/test/creat_excl.c
+++ b/test/creat_excl.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Exclusively creating an existing dirfile should fail cleanly */
 #include "test.h"
 
@@ -9,11 +29,12 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
   int error, r = 0;
   DIRFILE *D;
 
+  rmdirfile();
   mkdir(filedir, 0777);
   close(open(format, O_CREAT | O_EXCL | O_WRONLY, 0666));
 
@@ -24,7 +45,7 @@ int main(void)
   unlink(format);
   rmdir(filedir);
 
-  CHECKI(error, GD_E_CREAT);
+  CHECKI(error, GD_E_EXISTS);
 
   return r;
 }
diff --git a/test/creat_rdonly.c b/test/creat_rdonly.c
index c629f4a..33e2683 100644
--- a/test/creat_rdonly.c
+++ b/test/creat_rdonly.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Creating a read-only dirfile should fail cleanly */
 #include "test.h"
 
@@ -10,12 +30,14 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  int unlink_ret, rmdir_ret, r = 0;
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  int error, unlink_ret, rmdir_ret, r = 0;
+  DIRFILE *D;
 
-  DIRFILE* D = gd_open(filedir, GD_RDONLY | GD_CREAT);
-  int error = gd_error(D);
+  rmdirfile();
+  D = gd_open(filedir, GD_RDONLY | GD_CREAT);
+  error = gd_error(D);
   gd_close(D);
 
   unlink_ret = unlink(format);
diff --git a/test/cvlist.c b/test/cvlist.c
index 8ac6676..23b3331 100644
--- a/test/cvlist.c
+++ b/test/cvlist.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Retreiving the list of constant values should succeed cleanly */
 #include "test.h"
 
@@ -12,9 +32,9 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* format_data =
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *format_data =
     "data1 CONST UINT8 1\n"
     "data2 CONST UINT8 2\n"
     "data3 CONST UINT8 3\n"
@@ -23,6 +43,7 @@ int main(void)
   const uint8_t *field_list;
   DIRFILE *D;
 
+  rmdirfile();
   mkdir(filedir, 0777);
 
   fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
diff --git a/test/cvlist_array.c b/test/cvlist_array.c
index 9bf6f11..5080a1c 100644
--- a/test/cvlist_array.c
+++ b/test/cvlist_array.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2010-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 #include "test.h"
 
 #include <inttypes.h>
@@ -11,9 +31,9 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* format_data =
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *format_data =
     "data1 CARRAY UINT8 1 2 3 4 5\n"
     "data2 CARRAY UINT8 2 4 6 8 10 12\n"
     "data3 CARRAY UINT8 3 6 9 12 15 18 21\n"
@@ -26,6 +46,7 @@ int main(void)
   } *field_list;
   DIRFILE *D;
 
+  rmdirfile();
   mkdir(filedir, 0777);
 
   fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
diff --git a/test/cvlist_array_hidden.c b/test/cvlist_array_hidden.c
new file mode 100644
index 0000000..6db4de0
--- /dev/null
+++ b/test/cvlist_array_hidden.c
@@ -0,0 +1,67 @@
+/* Copyright (C) 2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+#include "test.h"
+
+int main(void)
+{
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *format_data =
+    "data1 CARRAY UINT8 1 2 3 4 5\n"
+    "data2 CARRAY UINT8 2 4 6 8 10 12\n"
+    "/HIDDEN data2\n"
+    "data3 CARRAY UINT8 3 6 9 12 15 18 21\n"
+    "data4 RAW UINT8 1\n";
+  int fd, error, r = 0;
+  size_t i;
+  struct uint8_carrays {
+    size_t n;
+    uint8_t *d;
+  } *field_list;
+  DIRFILE *D;
+
+  rmdirfile();
+  mkdir(filedir, 0777);
+
+  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
+  write(fd, format_data, strlen(format_data));
+  close(fd);
+
+  D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
+  field_list = (struct uint8_carrays*)gd_carrays(D, GD_UINT8);
+
+  error = gd_error(D);
+
+  CHECKI(error, 0);
+
+  if (!r)
+    for (fd = 0; fd < 2; ++fd) {
+      CHECKUi(fd,field_list[fd].n, (size_t)(5 + 2 * fd));
+      for (i = 0; i < field_list[fd].n; ++i)
+        CHECKUi(fd * 1000 + i,field_list[fd].d[i], (2 * fd + 1) * (i + 1));
+    }
+
+  gd_close(D);
+  unlink(format);
+  rmdir(filedir);
+
+  return r;
+}
diff --git a/test/cvlist_array_meta.c b/test/cvlist_array_meta.c
index a497d13..7b8e378 100644
--- a/test/cvlist_array_meta.c
+++ b/test/cvlist_array_meta.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2010-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 #include "test.h"
 
 #include <inttypes.h>
@@ -11,9 +31,9 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* format_data =
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *format_data =
     "parent CARRAY UINT8 1\n"
     "parent/data1 CARRAY UINT8 1 2 3 4 5\n"
     "parent/data2 CARRAY UINT8 2 4 6 8 10 12\n"
@@ -27,6 +47,7 @@ int main(void)
   } *field_list;
   DIRFILE *D;
 
+  rmdirfile();
   mkdir(filedir, 0777);
 
   fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
diff --git a/test/cvlist_array_meta_hidden.c b/test/cvlist_array_meta_hidden.c
new file mode 100644
index 0000000..6b19dd6
--- /dev/null
+++ b/test/cvlist_array_meta_hidden.c
@@ -0,0 +1,68 @@
+/* Copyright (C) 2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+#include "test.h"
+
+int main(void)
+{
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *format_data =
+    "parent CARRAY UINT8 1\n"
+    "parent/data1 CARRAY UINT8 1 2 3 4 5\n"
+    "parent/data2 CARRAY UINT8 2 4 6 8 10 12\n"
+    "/HIDDEN parent/data2\n"
+    "parent/data3 CARRAY UINT8 3 6 9 12 15 18 21\n"
+    "META parent data4 LINTERP UINT8 1\n";
+  int fd, r = 0;
+  size_t i, error;
+  struct uint8_carrays {
+    size_t n;
+    uint8_t *d;
+  } *field_list;
+  DIRFILE *D;
+
+  rmdirfile();
+  mkdir(filedir, 0777);
+
+  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
+  write(fd, format_data, strlen(format_data));
+  close(fd);
+
+  D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
+  field_list = (struct uint8_carrays *)gd_mcarrays(D, "parent", GD_UINT8);
+
+  error = gd_error(D);
+  CHECKI(error, 0);
+
+  if (!r)
+    for (fd = 0; fd < 2; ++fd) {
+      CHECKUi(fd,field_list[fd].n, (size_t)(5 + 2 * fd));
+      for (i = 0; i < field_list[fd].n; ++i)
+        CHECKUi(fd * 1000 + i,field_list[fd].d[i], (2 * fd + 1) * (i + 1));
+    }
+
+
+  gd_close(D);
+  unlink(format);
+  rmdir(filedir);
+
+  return r;
+}
diff --git a/test/cvlist_hidden.c b/test/cvlist_hidden.c
new file mode 100644
index 0000000..7ce56fd
--- /dev/null
+++ b/test/cvlist_hidden.c
@@ -0,0 +1,60 @@
+/* Copyright (C) 2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+#include "test.h"
+
+int main(void)
+{
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *format_data =
+    "data1 CONST UINT8 1\n"
+    "data2 CONST UINT8 2\n"
+    "/HIDDEN data2\n"
+    "data3 CONST UINT8 3\n"
+    "data4 RAW UINT8 1\n";
+  int fd, error, r = 0;
+  const uint8_t *field_list;
+  DIRFILE *D;
+
+  rmdirfile();
+  mkdir(filedir, 0777);
+
+  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
+  write(fd, format_data, strlen(format_data));
+  close(fd);
+
+  D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
+  field_list = (const uint8_t *)gd_constants(D, GD_UINT8);
+
+  error = gd_error(D);
+
+  CHECKI(error, 0);
+
+  if (!r)
+    for (fd = 0; fd < 2; ++fd)
+      CHECKUi(fd,field_list[fd], 2 * fd + 1);
+
+  gd_close(D);
+  unlink(format);
+  rmdir(filedir);
+
+  return r;
+}
diff --git a/test/cvlist_invalid.c b/test/cvlist_invalid.c
index f39e432..e5026e2 100644
--- a/test/cvlist_invalid.c
+++ b/test/cvlist_invalid.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Requesting the number of fields from an invalid dirfile should fail cleanly */
 #include "test.h"
 
@@ -9,12 +29,15 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  int r = 0;
+  const char *filedir = "dirfile";
+  int error, r = 0;
+  DIRFILE *D;
+  const void *fl;
 
-  DIRFILE* D = gd_open(filedir, GD_RDONLY);
-  const void* fl = gd_constants(D, GD_UINT8);
-  int error = gd_error(D);
+  rmdirfile();
+  D = gd_open(filedir, GD_RDONLY);
+  fl = gd_constants(D, GD_UINT8);
+  error = gd_error(D);
   gd_close(D);
 
   CHECKP(fl);
diff --git a/test/cvlist_meta.c b/test/cvlist_meta.c
index 3542667..7a89cdd 100644
--- a/test/cvlist_meta.c
+++ b/test/cvlist_meta.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 #include "test.h"
 
 #include <inttypes.h>
@@ -11,9 +31,9 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* format_data =
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *format_data =
     "parent CONST UINT8 1\n"
     "META parent data1 CONST UINT8 1\n"
     "META parent data2 CONST UINT8 2\n"
@@ -23,6 +43,7 @@ int main(void)
   uint8_t *field_list;
   DIRFILE *D;
 
+  rmdirfile();
   mkdir(filedir, 0777);
 
   fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
diff --git a/test/cvlist_meta_hidden.c b/test/cvlist_meta_hidden.c
new file mode 100644
index 0000000..e322008
--- /dev/null
+++ b/test/cvlist_meta_hidden.c
@@ -0,0 +1,60 @@
+/* Copyright (C) 2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+#include "test.h"
+
+int main(void)
+{
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *format_data =
+    "parent CONST UINT8 1\n"
+    "META parent data1 CONST UINT8 1\n"
+    "META parent data2 CONST UINT8 2\n"
+    "/HIDDEN parent/data2\n"
+    "META parent data3 CONST UINT8 3\n"
+    "META parent data4 LINTERP UINT8 1\n";
+  int fd, error, r = 0;
+  uint8_t *field_list;
+  DIRFILE *D;
+
+  rmdirfile();
+  mkdir(filedir, 0777);
+
+  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
+  write(fd, format_data, strlen(format_data));
+  close(fd);
+
+  D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
+  field_list = (uint8_t *)gd_mconstants(D, "parent", GD_UINT8);
+
+  error = gd_error(D);
+  CHECKI(error, 0);
+
+  if (!r)
+    for (fd = 0; fd < 2; ++fd)
+      CHECKUi(fd,field_list[fd], 2 * fd + 1);
+
+  gd_close(D);
+  unlink(format);
+  rmdir(filedir);
+
+  return r;
+}
diff --git a/test/cvlist_meta_invalid.c b/test/cvlist_meta_invalid.c
index c2175e5..aa01526 100644
--- a/test/cvlist_meta_invalid.c
+++ b/test/cvlist_meta_invalid.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Requesting the number of fields from an invalid dirfile should fail cleanly */
 #include "test.h"
 
@@ -9,12 +29,15 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  int r = 0;
+  const char *filedir = "dirfile";
+  int error, r = 0;
+  DIRFILE *D;
+  const void *fl;
 
-  DIRFILE* D = gd_open(filedir, GD_RDONLY);
-  const void* fl = gd_mconstants(D, "parent", GD_UINT8);
-  int error = gd_error(D);
+  rmdirfile();
+  D = gd_open(filedir, GD_RDONLY);
+  fl = gd_mconstants(D, "parent", GD_UINT8);
+  error = gd_error(D);
   gd_close(D);
 
   CHECKP(fl);
diff --git a/test/del.c b/test/del.c
index 561f096..4ce4d09 100644
--- a/test/del.c
+++ b/test/del.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Attempt to delete a field */
 #include "test.h"
 
@@ -11,16 +31,17 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* data = __TEST__ "dirfile/data";
-  const char* format_data = "data RAW UINT8 8\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *data = "dirfile/data";
+  const char *format_data = "data RAW UINT8 8\n";
   unsigned char c[8];
   unsigned char data_data[256];
   int fd, ret, error1, n, error2, r = 0;
   DIRFILE *D;
 
   memset(c, 0, 8);
+  rmdirfile();
   mkdir(filedir, 0777);
 
   for (fd = 0; fd < 256; ++fd)
diff --git a/test/del_carray.c b/test/del_carray.c
index 546f3ab..67cc416 100644
--- a/test/del_carray.c
+++ b/test/del_carray.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2010-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Attempt to delete a field */
 #include "test.h"
 
@@ -11,13 +31,14 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* format_data = "data CARRAY UINT8 1 2 3 4\n"
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *format_data = "data CARRAY UINT8 1 2 3 4\n"
     "raw RAW UINT8 data<2>\n";
   int fd, ret, error, r = 0;
   DIRFILE *D;
 
+  rmdirfile();
   mkdir(filedir, 0777);
 
   fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
diff --git a/test/del_carray_deref.c b/test/del_carray_deref.c
index ff622b8..43d6923 100644
--- a/test/del_carray_deref.c
+++ b/test/del_carray_deref.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2010-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Attempt to delete a field */
 #include "test.h"
 
@@ -11,14 +31,15 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* format_data = "data CARRAY UINT8 13 14 15 16 17\n"
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *format_data = "data CARRAY UINT8 13 14 15 16 17\n"
     "raw RAW UINT8 data<2>\n";
   int fd, ret, error, r = 0;
   DIRFILE *D;
-  gd_spf_t spf;
+  unsigned int spf;
 
+  rmdirfile();
   mkdir(filedir, 0777);
 
   fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
diff --git a/test/del_const.c b/test/del_const.c
index d31001e..f2bf6fa 100644
--- a/test/del_const.c
+++ b/test/del_const.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Attempt to delete a field */
 #include "test.h"
 
@@ -11,13 +31,14 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* format_data = "data CONST UINT8 1\n"
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *format_data = "data CONST UINT8 1\n"
     "raw RAW UINT8 data\n";
   int fd, ret, error, r = 0;
   DIRFILE *D;
 
+  rmdirfile();
   mkdir(filedir, 0777);
 
   fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
diff --git a/test/del_const_deref.c b/test/del_const_deref.c
index a77bad8..d23b611 100644
--- a/test/del_const_deref.c
+++ b/test/del_const_deref.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Attempt to delete a field */
 #include "test.h"
 
@@ -11,14 +31,15 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* format_data = "data CONST UINT8 13\n"
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *format_data = "data CONST UINT8 13\n"
     "raw RAW UINT8 data\n";
   int fd, ret, error, r = 0;
-  gd_spf_t spf;
+  unsigned int spf;
   DIRFILE *D;
 
+  rmdirfile();
   mkdir(filedir, 0777);
 
   fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
diff --git a/test/del_const_force.c b/test/del_const_force.c
index e8d45ee..f1802d7 100644
--- a/test/del_const_force.c
+++ b/test/del_const_force.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Attempt to delete a field */
 #include "test.h"
 
@@ -11,14 +31,15 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* format_data = "data CONST UINT8 13\n"
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *format_data = "data CONST UINT8 13\n"
     "raw RAW UINT8 data\n";
   int fd, ret, error1, error2, r = 0;
   DIRFILE *D;
-  gd_spf_t spf;
+  unsigned int spf;
 
+  rmdirfile();
   mkdir(filedir, 0777);
 
   fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
diff --git a/test/del_data.c b/test/del_data.c
index e766b29..8163983 100644
--- a/test/del_data.c
+++ b/test/del_data.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Attempt to delete a field */
 #include "test.h"
 
@@ -11,14 +31,15 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* data = __TEST__ "dirfile/data";
-  const char* format_data = "data RAW UINT8 8\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *data = "dirfile/data";
+  const char *format_data = "data RAW UINT8 8\n";
   unsigned char data_data[256];
   int fd, ret, error1, n, error2, unlink_data, r = 0;
   DIRFILE *D;
 
+  rmdirfile();
   mkdir(filedir, 0777);
 
   for (fd = 0; fd < 256; ++fd)
diff --git a/test/del_derived.c b/test/del_derived.c
index 7936dfb..baeba99 100644
--- a/test/del_derived.c
+++ b/test/del_derived.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Attempt to delete a field */
 #include "test.h"
 
@@ -11,12 +31,13 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* format_data = "data RAW UINT8 8\nlincom LINCOM 1 data 1 0\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *format_data = "data RAW UINT8 8\nlincom LINCOM 1 data 1 0\n";
   int fd, ret, error, r = 0;
   DIRFILE *D;
 
+  rmdirfile();
   mkdir(filedir, 0777);
 
   fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
diff --git a/test/del_derived_after.c b/test/del_derived_after.c
new file mode 100644
index 0000000..a77bad4
--- /dev/null
+++ b/test/del_derived_after.c
@@ -0,0 +1,59 @@
+/* Copyright (C) 2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+#include "test.h"
+
+int main(void)
+{
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *format_data = "data RAW UINT8 8\nlincom LINCOM 1 data 1 0\n";
+  int fd, ret, v, e1, e2, r = 0;
+  size_t n;
+  double c;
+  DIRFILE *D;
+
+  rmdirfile();
+  mkdir(filedir, 0777);
+
+  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
+  write(fd, format_data, strlen(format_data));
+  close(fd);
+
+  D = gd_open(filedir, GD_RDWR);
+  /* in order to initialise the lincom's entry cache */
+  v = gd_validate(D, "lincom");
+  ret = gd_delete(D, "data", GD_DEL_FORCE);
+  e1 = gd_error(D);
+  n = gd_getdata(D, "lincom", 0, 0, 0, 1, GD_FLOAT64, &c);
+  e2 = gd_error(D);
+  gd_close(D);
+
+  unlink(format);
+  rmdir(filedir);
+
+  CHECKI(e1, GD_E_OK);
+  CHECKI(e2, GD_E_BAD_CODE);
+  CHECKI(ret, 0);
+  CHECKI(n, 0);
+  CHECKI(v, 0);
+
+  return r;
+}
diff --git a/test/del_derived_force.c b/test/del_derived_force.c
index 680c63c..8110de7 100644
--- a/test/del_derived_force.c
+++ b/test/del_derived_force.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Attempt to delete a field */
 #include "test.h"
 
@@ -11,12 +31,13 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* format_data = "data RAW UINT8 8\nlincom LINCOM 1 data 1 0\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *format_data = "data RAW UINT8 8\nlincom LINCOM 1 data 1 0\n";
   int fd, ret, error, r = 0;
   DIRFILE *D;
 
+  rmdirfile();
   mkdir(filedir, 0777);
 
   fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
diff --git a/test/del_meta.c b/test/del_meta.c
index f6b96a4..13c5f7a 100644
--- a/test/del_meta.c
+++ b/test/del_meta.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Attempt to delete a field */
 #include "test.h"
 
@@ -11,9 +31,9 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* format_data = "data RAW UINT8 8\n"
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *format_data = "data RAW UINT8 8\n"
     "META data e CONST UINT8 1\n"
     "META data q CONST UINT8 2\n"
     "META data a CONST UINT8 3\n"
@@ -23,6 +43,7 @@ int main(void)
   int fd, ret, error, r = 0;
   DIRFILE *D;
 
+  rmdirfile();
   mkdir(filedir, 0777);
 
   fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
diff --git a/test/del_meta_force.c b/test/del_meta_force.c
index 564713d..04afc3f 100644
--- a/test/del_meta_force.c
+++ b/test/del_meta_force.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Attempt to delete a field */
 #include "test.h"
 
@@ -11,9 +31,9 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* format_data = "data RAW UINT8 8\n"
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *format_data = "data RAW UINT8 8\n"
     "META data e STRING 1\n"
     "META data q STRING 2\n"
     "META data a STRING 3\n"
@@ -24,6 +44,7 @@ int main(void)
   int fd, ret, error, nf, r = 0;
   DIRFILE *D;
 
+  rmdirfile();
   mkdir(filedir, 0777);
 
   fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
diff --git a/test/desync.c b/test/desync.c
new file mode 100644
index 0000000..704457c
--- /dev/null
+++ b/test/desync.c
@@ -0,0 +1,67 @@
+/* Copyright (C) 2012 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+#include "test.h"
+
+#include <stdlib.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <string.h>
+
+int main(void)
+{
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  int e1, e2, e3, n1, n2, fd, r = 0;
+  DIRFILE *D;
+
+  rmdirfile();
+  mkdir(filedir, 0777);
+  close(open(format, O_CREAT | O_EXCL | O_WRONLY, 0666));
+
+  D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
+  e1 = gd_error(D);
+  n1 = gd_desync(D, 0);
+  e2 = gd_error(D);
+  
+  /* ensure mtime ticks over */
+  sleep(1);
+
+  /* modify the format file */
+  fd = open(format, O_CREAT | O_TRUNC | O_WRONLY, 0666);
+  write(fd, "#\n", 2);
+  close(fd);
+
+  n2 = gd_desync(D, 0);
+  e3 = gd_error(D);
+
+  gd_close(D);
+
+  unlink(format);
+  rmdir(filedir);
+
+  CHECKI(e1, 0);
+  CHECKI(e2, 0);
+  CHECKI(e3, 0);
+  CHECKI(n1, 0);
+  CHECKI(n2, 1);
+  return r;
+}
diff --git a/test/desync_flush.c b/test/desync_flush.c
new file mode 100644
index 0000000..37e5b78
--- /dev/null
+++ b/test/desync_flush.c
@@ -0,0 +1,60 @@
+/* Copyright (C) 2012 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+#include "test.h"
+
+#include <stdlib.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <string.h>
+
+int main(void)
+{
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  int e1, e2, n1, r = 0;
+  DIRFILE *D;
+
+  rmdirfile();
+  mkdir(filedir, 0777);
+  close(open(format, O_CREAT | O_EXCL | O_WRONLY, 0666));
+
+  D = gd_open(filedir, GD_RDWR | GD_VERBOSE);
+  e1 = gd_error(D);
+
+  /* ensure mtime ticks over */
+  sleep(1);
+
+  gd_rewrite_fragment(D, 0);
+
+  n1 = gd_desync(D, 0);
+  e2 = gd_error(D);
+
+  gd_close(D);
+
+  unlink(format);
+  rmdir(filedir);
+
+  CHECKI(e1, 0);
+  CHECKI(e2, 0);
+  CHECKI(n1, 0);
+  return r;
+}
diff --git a/test/desync_reopen.c b/test/desync_reopen.c
new file mode 100644
index 0000000..476ee65
--- /dev/null
+++ b/test/desync_reopen.c
@@ -0,0 +1,68 @@
+/* Copyright (C) 2012 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+#include "test.h"
+
+#include <stdlib.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <string.h>
+
+int main(void)
+{
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *format_data = "data RAW UINT8 1\n";
+  int e1, e2, e3, n1, n2, fd, r = 0;
+  DIRFILE *D;
+
+  rmdirfile();
+  mkdir(filedir, 0777);
+  close(open(format, O_CREAT | O_EXCL | O_WRONLY, 0666));
+
+  D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
+  e1 = gd_error(D);
+  
+  /* ensure mtime ticks over */
+  sleep(1);
+
+  /* modify the format file */
+  fd = open(format, O_CREAT | O_TRUNC | O_WRONLY, 0666);
+  write(fd, format_data, strlen(format_data));
+  close(fd);
+
+  n1 = gd_desync(D, GD_DESYNC_REOPEN);
+  e2 = gd_error(D);
+  n2 = gd_validate(D, "data");
+  e3 = gd_error(D);
+
+  gd_close(D);
+
+  unlink(format);
+  rmdir(filedir);
+
+  CHECKI(e1, 0);
+  CHECKI(e2, 0);
+  CHECKI(e3, 0);
+  CHECKI(n1, 1);
+  CHECKI(n2, 0);
+  return r;
+}
diff --git a/test/desync_reopen_inv.c b/test/desync_reopen_inv.c
new file mode 100644
index 0000000..2dca079
--- /dev/null
+++ b/test/desync_reopen_inv.c
@@ -0,0 +1,68 @@
+/* Copyright (C) 2012 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+#include "test.h"
+
+#include <stdlib.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <string.h>
+
+int main(void)
+{
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *format_data = "bad format\n";
+  int e1, e2, e3, n1, n2, fd, r = 0;
+  DIRFILE *D;
+
+  rmdirfile();
+  mkdir(filedir, 0777);
+  close(open(format, O_CREAT | O_EXCL | O_WRONLY, 0666));
+
+  D = gd_open(filedir, GD_RDONLY);
+  e1 = gd_error(D);
+  
+  /* ensure mtime ticks over */
+  sleep(1);
+
+  /* modify the format file */
+  fd = open(format, O_CREAT | O_TRUNC | O_WRONLY, 0666);
+  write(fd, format_data, strlen(format_data));
+  close(fd);
+
+  n1 = gd_desync(D, GD_DESYNC_REOPEN);
+  e2 = gd_error(D);
+  n2 = gd_validate(D, "data");
+  e3 = gd_error(D);
+
+  gd_close(D);
+
+  unlink(format);
+  rmdir(filedir);
+
+  CHECKI(e1, GD_E_OK);
+  CHECKI(e2, GD_E_FORMAT);
+  CHECKI(e3, GD_E_BAD_DIRFILE);
+  CHECKI(n1, -1);
+  CHECKI(n2, -1);
+  return r;
+}
diff --git a/test/dfes_bit.c b/test/dfes_bit.c
index dc6ce90..d0bfee2 100644
--- a/test/dfes_bit.c
+++ b/test/dfes_bit.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Try to free the strings from a BIT entry */
 #include "test.h"
 
@@ -10,13 +30,14 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* format_data = "data BIT in 3 2\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *format_data = "data BIT in 3 2\n";
   int fd, r = 0;
   DIRFILE *D;
   gd_entry_t E;
 
+  rmdirfile();
   mkdir(filedir, 0777);
 
   fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
diff --git a/test/dfes_divide.c b/test/dfes_divide.c
index 8031007..556b920 100644
--- a/test/dfes_divide.c
+++ b/test/dfes_divide.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2010-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 #include "test.h"
 
 #include <stdlib.h>
@@ -9,13 +29,14 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* format_data = "data DIVIDE e b\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *format_data = "data DIVIDE e b\n";
   int fd;
   DIRFILE *D;
   gd_entry_t E;
 
+  rmdirfile();
   mkdir(filedir, 0777);
 
   fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
diff --git a/test/dfes_lincom.c b/test/dfes_lincom.c
index a100158..b9ba0ac 100644
--- a/test/dfes_lincom.c
+++ b/test/dfes_lincom.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Try to free the strings from a LINCOM entry */
 #include "test.h"
 
@@ -10,13 +30,14 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* format_data = "data LINCOM 2 in1 2 1 in2 2 1\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *format_data = "data LINCOM 2 in1 2 1 in2 2 1\n";
   int fd;
   DIRFILE *D;
   gd_entry_t E;
 
+  rmdirfile();
   mkdir(filedir, 0777);
 
   fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
diff --git a/test/dfes_linterp.c b/test/dfes_linterp.c
index 63e85de..4d251e4 100644
--- a/test/dfes_linterp.c
+++ b/test/dfes_linterp.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Try to free the strings from a LINTERP entry */
 #include "test.h"
 
@@ -10,13 +30,14 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* format_data = "data LINTERP in table\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *format_data = "data LINTERP in table\n";
   int fd;
   DIRFILE *D;
   gd_entry_t E;
 
+  rmdirfile();
   mkdir(filedir, 0777);
 
   fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
diff --git a/test/dfes_multiply.c b/test/dfes_multiply.c
index f467255..f1db758 100644
--- a/test/dfes_multiply.c
+++ b/test/dfes_multiply.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Try to free the strings from a MULTIPLY entry */
 #include "test.h"
 
@@ -10,13 +30,14 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* format_data = "data MULTIPLY e b\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *format_data = "data MULTIPLY e b\n";
   int fd;
   DIRFILE *D;
   gd_entry_t E;
 
+  rmdirfile();
   mkdir(filedir, 0777);
 
   fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
diff --git a/test/dfes_null.c b/test/dfes_null.c
index aa1d874..f4e0e7e 100644
--- a/test/dfes_null.c
+++ b/test/dfes_null.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Try to free the strings from NULL */
 #include "test.h"
 
diff --git a/test/dfes_phase.c b/test/dfes_phase.c
index eaffecb..d89e4d5 100644
--- a/test/dfes_phase.c
+++ b/test/dfes_phase.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Try to free the strings from a PHASE entry */
 #include "test.h"
 
@@ -10,13 +30,14 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* format_data = "data PHASE in 8\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *format_data = "data PHASE in 8\n";
   int fd;
   DIRFILE *D;
   gd_entry_t E;
 
+  rmdirfile();
   mkdir(filedir, 0777);
 
   fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
diff --git a/test/dfes_raw.c b/test/dfes_raw.c
index fa1c5b4..921e4dd 100644
--- a/test/dfes_raw.c
+++ b/test/dfes_raw.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Try to free the strings from a RAW entry */
 #include "test.h"
 
@@ -10,13 +30,14 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* format_data = "data RAW UINT8 8\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *format_data = "data RAW UINT8 8\n";
   int fd;
   DIRFILE *D;
   gd_entry_t E;
 
+  rmdirfile();
   mkdir(filedir, 0777);
 
   fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
diff --git a/test/dfes_recip.c b/test/dfes_recip.c
index add9530..da4d388 100644
--- a/test/dfes_recip.c
+++ b/test/dfes_recip.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2010-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 #include "test.h"
 
 #include <stdlib.h>
@@ -9,13 +29,14 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* format_data = "data RECIP b e\ne CONST UINT8 3";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *format_data = "data RECIP b e\ne CONST UINT8 3";
   int fd;
   DIRFILE *D;
   gd_entry_t E;
 
+  rmdirfile();
   mkdir(filedir, 0777);
 
   fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
diff --git a/test/dfes_zero.c b/test/dfes_zero.c
index 6b07446..b71701f 100644
--- a/test/dfes_zero.c
+++ b/test/dfes_zero.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Try to free the strings from a zeroed entry */
 #include "test.h"
 
diff --git a/test/elist_alias.c b/test/elist_alias.c
new file mode 100644
index 0000000..4a2974b
--- /dev/null
+++ b/test/elist_alias.c
@@ -0,0 +1,78 @@
+/* Copyright (C) 2012 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+#include "test.h"
+
+#include <stdlib.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <stdio.h>
+#include <string.h>
+#include <errno.h>
+
+int main(void)
+{
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *format_data =
+    "data1 RAW UINT8 1\n"
+    "/ALIAS data2 data1\n"
+    "/ALIAS data3 data4\n";
+  int fd, i, error, r = 0;
+  const char **field_list;
+  DIRFILE *D;
+
+  rmdirfile();
+  mkdir(filedir, 0777);
+
+  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
+  write(fd, format_data, strlen(format_data));
+  close(fd);
+
+  D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
+  field_list = gd_entry_list(D, NULL, GD_ALIAS_ENTRIES, 0);
+
+  error = gd_error(D);
+
+  CHECKI(error, 0);
+  CHECKPN(field_list);
+
+  for (i = 0; ; ++i) {
+    if (field_list[i] == NULL)
+      break;
+
+    if (strcmp(field_list[i], "data3") == 0)
+      continue;
+    else if (strcmp(field_list[i], "data2") == 0)
+      continue;
+
+    fprintf(stderr, "field_list[%i] = \"%s\"\n", i, field_list[i]);
+    r = 1;
+  }
+
+  CHECKI(i, 2);
+
+  gd_close(D);
+  unlink(format);
+  rmdir(filedir);
+
+  return r;
+}
diff --git a/test/elist_hidden.c b/test/elist_hidden.c
new file mode 100644
index 0000000..373e7b0
--- /dev/null
+++ b/test/elist_hidden.c
@@ -0,0 +1,75 @@
+/* Copyright (C) 2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+#include "test.h"
+
+int main(void)
+{
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *format_data =
+    "data1 RAW UINT8 1\n"
+    "data2 RAW UINT8 1\n"
+    "/HIDDEN data2\n"
+    "data3 RAW UINT8 1\n";
+  int fd, i, error, r = 0;
+  const char **entry_list;
+  DIRFILE *D;
+
+  rmdirfile();
+  mkdir(filedir, 0777);
+
+  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
+  write(fd, format_data, strlen(format_data));
+  close(fd);
+
+  D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
+  entry_list = gd_entry_list(D, NULL, GD_ALL_ENTRIES, GD_ENTRIES_HIDDEN);
+
+  error = gd_error(D);
+
+  CHECKI(error, 0);
+  CHECKPN(entry_list);
+
+  for (i = 0; ; ++i) {
+    if (entry_list[i] == NULL)
+      break;
+
+    if (strcmp(entry_list[i], "data1") == 0)
+      continue;
+    else if (strcmp(entry_list[i], "data2") == 0)
+      continue;
+    else if (strcmp(entry_list[i], "data3") == 0)
+      continue;
+    else if (strcmp(entry_list[i], "INDEX") == 0)
+      continue;
+
+    fprintf(stderr, "entry_list[%i] = \"%s\"\n", i, entry_list[i]);
+    r = 1;
+  }
+
+  CHECKI(i, 4);
+
+  gd_close(D);
+  unlink(format);
+  rmdir(filedir);
+
+  return r;
+}
diff --git a/test/elist_noalias.c b/test/elist_noalias.c
new file mode 100644
index 0000000..a938dca
--- /dev/null
+++ b/test/elist_noalias.c
@@ -0,0 +1,75 @@
+/* Copyright (C) 2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+#include "test.h"
+
+int main(void)
+{
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *format_data =
+    "data1 RAW UINT8 1\n"
+    "data2 RAW UINT8 1\n"
+    "data3 RAW UINT8 1\n"
+    "/ALIAS data4 data32\n";
+  int fd, i, error, r = 0;
+  const char **entry_list;
+  DIRFILE *D;
+
+  rmdirfile();
+  mkdir(filedir, 0777);
+
+  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
+  write(fd, format_data, strlen(format_data));
+  close(fd);
+
+  D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
+  entry_list = gd_entry_list(D, NULL, GD_ALL_ENTRIES, GD_ENTRIES_NOALIAS);
+
+  error = gd_error(D);
+
+  CHECKI(error, 0);
+  CHECKPN(entry_list);
+
+  for (i = 0; ; ++i) {
+    if (entry_list[i] == NULL)
+      break;
+
+    if (strcmp(entry_list[i], "data1") == 0)
+      continue;
+    else if (strcmp(entry_list[i], "data2") == 0)
+      continue;
+    else if (strcmp(entry_list[i], "data3") == 0)
+      continue;
+    else if (strcmp(entry_list[i], "INDEX") == 0)
+      continue;
+
+    fprintf(stderr, "entry_list[%i] = \"%s\"\n", i, entry_list[i]);
+    r = 1;
+  }
+
+  CHECKI(i, 4);
+
+  gd_close(D);
+  unlink(format);
+  rmdir(filedir);
+
+  return r;
+}
diff --git a/test/elist_scalar.c b/test/elist_scalar.c
new file mode 100644
index 0000000..d7d3819
--- /dev/null
+++ b/test/elist_scalar.c
@@ -0,0 +1,70 @@
+/* Copyright (C) 2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+#include "test.h"
+
+int main(void)
+{
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *format_data =
+    "data1 CONST UINT8 1\n"
+    "data2 RAW UINT8 1\n"
+    "data3 STRING UINT8\n";
+  int fd, i, error, r = 0;
+  const char **entry_list;
+  DIRFILE *D;
+
+  rmdirfile();
+  mkdir(filedir, 0777);
+
+  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
+  write(fd, format_data, strlen(format_data));
+  close(fd);
+
+  D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
+  entry_list = gd_entry_list(D, NULL, GD_SCALAR_ENTRIES, 0);
+
+  error = gd_error(D);
+
+  CHECKI(error, 0);
+  CHECKPN(entry_list);
+
+  for (i = 0; ; ++i) {
+    if (entry_list[i] == NULL)
+      break;
+
+    if (strcmp(entry_list[i], "data1") == 0)
+      continue;
+    else if (strcmp(entry_list[i], "data3") == 0)
+      continue;
+
+    fprintf(stderr, "entry_list[%i] = \"%s\"\n", i, entry_list[i]);
+    r = 1;
+  }
+
+  CHECKI(i, 2);
+
+  gd_close(D);
+  unlink(format);
+  rmdir(filedir);
+
+  return r;
+}
diff --git a/test/encode_alter.c b/test/encode_alter.c
index 2416f68..9a40e5d 100644
--- a/test/encode_alter.c
+++ b/test/encode_alter.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Test encoding */
 #include "test.h"
 
@@ -12,12 +32,12 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* data = __TEST__ "dirfile/data";
-  const char* txtdata = __TEST__ "dirfile/data.txt";
-  const char* format_data = "data RAW UINT16 8\nENCODING none\n";
-  const char* txt_data =
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *data = "dirfile/data";
+  const char *txtdata = "dirfile/data.txt";
+  const char *format_data = "data RAW UINT16 8\nENCODING none\n";
+  const char *txt_data =
     "0\n1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12\n13\n14\n15\n";
   uint16_t data_data[128];
   uint16_t c[8];
@@ -26,6 +46,7 @@ int main(void)
   DIRFILE *D;
 
   memset(c, 0, 8);
+  rmdirfile();
   mkdir(filedir, 0777);
 
   for (fd = 0; fd < 128; ++fd)
diff --git a/test/encode_get.c b/test/encode_get.c
index 554211a..a12443f 100644
--- a/test/encode_get.c
+++ b/test/encode_get.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Test endianness */
 #include "test.h"
 
@@ -11,15 +31,16 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* data = __TEST__ "dirfile/data";
-  const char* format_data = "data RAW UINT8 8\nFRAMEOFFSET 13\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *data = "dirfile/data";
+  const char *format_data = "data RAW UINT8 8\nFRAMEOFFSET 13\n";
   unsigned char data_data[256];
   int fd, error, r = 0;
   unsigned long n;
   DIRFILE *D;
 
+  rmdirfile();
   mkdir(filedir, 0777);
 
   for (fd = 0; fd < 256; ++fd)
diff --git a/test/encode_move.c b/test/encode_move.c
index b954408..8bdbf2a 100644
--- a/test/encode_move.c
+++ b/test/encode_move.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Test endianness */
 #include "test.h"
 
@@ -12,17 +32,18 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* data = __TEST__ "dirfile/data";
-  const char* txtdata = __TEST__ "dirfile/data.txt";
-  const char* format_data = "data RAW UINT16 8\nENCODING none\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *data = "dirfile/data";
+  const char *txtdata = "dirfile/data.txt";
+  const char *format_data = "data RAW UINT16 8\nENCODING none\n";
   uint16_t data_data[128];
   uint16_t c[8];
   int fd, i, ret, error, n, unlink_txtdata, unlink_data, r = 0;
   DIRFILE *D;
 
   memset(c, 0, 8);
+  rmdirfile();
   mkdir(filedir, 0777);
 
   for (fd = 0; fd < 128; ++fd)
diff --git a/test/endian_alter.c b/test/endian_alter.c
index 28ab919..3206814 100644
--- a/test/endian_alter.c
+++ b/test/endian_alter.c
@@ -1,5 +1,24 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Test endianness */
-#include "../src/config.h"
 #include "test.h"
 
 #include <stdlib.h>
@@ -13,16 +32,17 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* data = __TEST__ "dirfile/data";
-  const char* format_data = "data RAW UINT16 8\nENDIAN little\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *data = "dirfile/data";
+  const char *format_data = "data RAW UINT16 8\nENDIAN little\n";
   uint16_t data_data[128];
   uint16_t c[8], d;
   int fd, ret, error, n, i = 0, r = 0;
   DIRFILE *D;
 
   memset(c, 0, 8);
+  rmdirfile();
   mkdir(filedir, 0777);
 
   for (fd = 0; fd < 128; ++fd)
diff --git a/test/endian_alter_sie.c b/test/endian_alter_sie.c
new file mode 100644
index 0000000..5040b6f
--- /dev/null
+++ b/test/endian_alter_sie.c
@@ -0,0 +1,97 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+/* Test endianness */
+#include "test.h"
+
+#include <stdlib.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <string.h>
+#include <errno.h>
+#include <inttypes.h>
+#include <stdio.h>
+
+int main(void)
+{
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *data = "dirfile/data.sie";
+  const char *format_data = "data RAW UINT8 8\nENDIAN little\nENCODING sie\n";
+  const uint8_t data_in[] = {
+    0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x12,
+    0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x22,
+    0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x32
+  };
+  const uint8_t data_out[] = {
+    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x12,
+    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x22,
+    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x32
+  };
+  uint8_t c[8], d[3 * 9];
+  int fd, ret, error, n, i = 0, r = 0;
+  DIRFILE *D;
+
+  memset(c, 0, 8);
+  rmdirfile();
+  mkdir(filedir, 0777);
+
+  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
+  write(fd, format_data, strlen(format_data));
+  close(fd);
+
+  fd = open(data, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
+  write(fd, data_in, 3 * 9);
+  close(fd);
+
+  D = gd_open(filedir, GD_RDWR | GD_VERBOSE);
+  ret = gd_alter_endianness(D, GD_BIG_ENDIAN, 0, 1);
+  error = gd_error(D);
+  n = gd_getdata(D, "data", 3, 0, 1, 0, GD_UINT8, c);
+
+  gd_close(D);
+
+  fd = open(data, O_RDONLY | O_BINARY);
+
+  if (fd >= 0) {
+    read(fd, d, 3 * 9);
+    close(fd);
+  } else {
+    perror("open");
+    r = 1;
+  }
+
+  unlink(data);
+  unlink(format);
+  rmdir(filedir);
+
+  for (i = 0; i < 8; ++i)
+    CHECKXi(i,c[i], 0x22);
+
+  for (i = 0; i < 3 * 9; ++i)
+    CHECKXi(i,d[i], data_out[i]);
+
+  CHECKI(error,0);
+  CHECKI(ret, 0);
+  CHECKI(n, 8);
+
+  return r;
+}
diff --git a/test/endian_get.c b/test/endian_get.c
index f057e7e..43e7854 100644
--- a/test/endian_get.c
+++ b/test/endian_get.c
@@ -1,5 +1,24 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Test endianness */
-#include "../src/config.h"
 #include "test.h"
 
 #include <stdlib.h>
@@ -12,19 +31,20 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* format1 = __TEST__ "dirfile/format1";
-  const char* format2 = __TEST__ "dirfile/format2";
-  const char* format3 = __TEST__ "dirfile/format3";
-  const char* format_data = "ENDIAN little\nINCLUDE format1\n";
-  const char* format_data1 = "ENDIAN big\nINCLUDE format2\n";
-  const char* format_data2 = "ENDIAN big arm\nINCLUDE format3\n";
-  const char* format_data3 = "ENDIAN little arm\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *format1 = "dirfile/format1";
+  const char *format2 = "dirfile/format2";
+  const char *format3 = "dirfile/format3";
+  const char *format_data = "ENDIAN little\nINCLUDE format1\n";
+  const char *format_data1 = "ENDIAN big\nINCLUDE format2\n";
+  const char *format_data2 = "ENDIAN big arm\nINCLUDE format3\n";
+  const char *format_data3 = "ENDIAN little arm\n";
   int fd, error, r = 0;
   unsigned long n, m, l, k;
   DIRFILE *D;
 
+  rmdirfile();
   mkdir(filedir, 0777);
 
   fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
diff --git a/test/endian_move.c b/test/endian_move.c
index b65ffdf..8d35880 100644
--- a/test/endian_move.c
+++ b/test/endian_move.c
@@ -1,5 +1,24 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Test endianness */
-#include "../src/config.h"
 #include "test.h"
 
 #include <stdlib.h>
@@ -13,16 +32,17 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* data = __TEST__ "dirfile/data";
-  const char* format_data = "data RAW UINT16 8\nENDIAN little\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *data = "dirfile/data";
+  const char *format_data = "data RAW UINT16 8\nENDIAN little\n";
   uint16_t data_data[128];
   uint16_t c[8], d;
   int fd, ret, error, n, i = 0, r = 0;
   DIRFILE *D;
 
   memset(c, 0, 8);
+  rmdirfile();
   mkdir(filedir, 0777);
 
   for (fd = 0; fd < 128; ++fd)
diff --git a/test/entry_bad_code.c b/test/entry_bad_code.c
index 382c18b..02f44bb 100644
--- a/test/entry_bad_code.c
+++ b/test/entry_bad_code.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Try to read RAW entry */
 #include "test.h"
 
@@ -10,13 +30,14 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* format_data = "data RAW UINT8 8\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *format_data = "data RAW UINT8 8\n";
   int fd, n, error, r = 0;
   DIRFILE *D;
   gd_entry_t E;
 
+  rmdirfile();
   mkdir(filedir, 0777);
 
   fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
diff --git a/test/entry_bit.c b/test/entry_bit.c
index d71d697..2db4e5e 100644
--- a/test/entry_bit.c
+++ b/test/entry_bit.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Try to read BIT entry */
 #include "test.h"
 
@@ -11,13 +31,14 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* format_data = "data BIT in1 3 4\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *format_data = "data BIT in1 3 4\n";
   int fd, n, error, r = 0;
   DIRFILE *D;
   gd_entry_t E;
 
+  rmdirfile();
   mkdir(filedir, 0777);
 
   fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
diff --git a/test/entry_bit_scalar.c b/test/entry_bit_scalar.c
index 221f134..d4dac46 100644
--- a/test/entry_bit_scalar.c
+++ b/test/entry_bit_scalar.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Try to read BIT entry */
 #include "test.h"
 
@@ -11,9 +31,9 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* format_data =
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *format_data =
     "bitnum CONST UINT8 3\n"
     "numbits CONST UINT8 4\n"
     "data BIT in1 bitnum numbits\n";
@@ -21,6 +41,7 @@ int main(void)
   DIRFILE *D;
   gd_entry_t E;
 
+  rmdirfile();
   mkdir(filedir, 0777);
 
   fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
diff --git a/test/entry_divide.c b/test/entry_divide.c
new file mode 100644
index 0000000..1e83ff9
--- /dev/null
+++ b/test/entry_divide.c
@@ -0,0 +1,65 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+/* Try to read DIVIDE entry */
+#include "test.h"
+
+#include <stdlib.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <string.h>
+#include <errno.h>
+
+int main(void)
+{
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *format_data = "data DIVIDE in1 in2\n";
+  int fd, n, error, r = 0;
+  DIRFILE *D;
+  gd_entry_t E;
+
+  rmdirfile();
+  mkdir(filedir, 0777);
+
+  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
+  write(fd, format_data, strlen(format_data));
+  close(fd);
+
+  D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
+
+  n = gd_entry(D, "data", &E);
+  error = gd_error(D);
+
+  gd_close(D);
+  unlink(format);
+  rmdir(filedir);
+
+  CHECKI(error, GD_E_OK);
+  CHECKI(n, 0);
+  CHECKS(E.field, "data");
+  CHECKX(E.field_type, GD_DIVIDE_ENTRY);
+  CHECKS(E.in_fields[0], "in1");
+  CHECKS(E.in_fields[1], "in2");
+  gd_free_entry_strings(&E);
+
+  return r;
+}
diff --git a/test/entry_invalid.c b/test/entry_invalid.c
index 5b17f58..6c217be 100644
--- a/test/entry_invalid.c
+++ b/test/entry_invalid.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Try to read entry from an invalid DIRFILE */
 #include "test.h"
 
@@ -10,12 +30,12 @@
 
 int main(void)
 {
-  DIRFILE* D = gd_open("not a dirfile", GD_RDONLY);
+  DIRFILE *D = gd_open("not a dirfile", GD_RDONLY);
   gd_entry_t E;
-  int r = 0;
+  int error, r = 0;
 
   int n = gd_entry(D, "data", &E);
-  int error = gd_error(D);
+  error = gd_error(D);
   gd_close(D);
 
   CHECKI(error, GD_E_BAD_DIRFILE);
diff --git a/test/entry_lincom.c b/test/entry_lincom.c
index 0de3246..1ec1c99 100644
--- a/test/entry_lincom.c
+++ b/test/entry_lincom.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Try to read LINCOM entry */
 #include "test.h"
 
@@ -11,13 +31,14 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* format_data = "data LINCOM 3 in1 1 2 in2 3 4 in3 5 6\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *format_data = "data LINCOM 3 in1 1 2 in2 3 4 in3 5 6\n";
   int fd, n, error, r = 0;
   DIRFILE *D;
   gd_entry_t E;
 
+  rmdirfile();
   mkdir(filedir, 0777);
 
   fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
diff --git a/test/entry_lincom_scalar.c b/test/entry_lincom_scalar.c
index ae0999c..d441a27 100644
--- a/test/entry_lincom_scalar.c
+++ b/test/entry_lincom_scalar.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Try to read LINCOM entry */
 #include "test.h"
 
@@ -12,9 +32,9 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* format_data =
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *format_data =
     "m1 CONST FLOAT64 1\n"
     "b1 CONST FLOAT64 2\n"
     "m2 CONST FLOAT64 3\n"
@@ -26,6 +46,7 @@ int main(void)
   DIRFILE *D;
   gd_entry_t E;
 
+  rmdirfile();
   mkdir(filedir, 0777);
 
   fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
diff --git a/test/entry_linterp.c b/test/entry_linterp.c
index f7e521f..98838f6 100644
--- a/test/entry_linterp.c
+++ b/test/entry_linterp.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Try to read LINTERP entry */
 #include "test.h"
 
@@ -10,13 +30,14 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* format_data = "data LINTERP in1 ../tablefile\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *format_data = "data LINTERP in1 ../tablefile\n";
   int fd, n, error, r = 0;
   DIRFILE *D;
   gd_entry_t E;
 
+  rmdirfile();
   mkdir(filedir, 0777);
 
   fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
diff --git a/test/entry_mplex.c b/test/entry_mplex.c
new file mode 100644
index 0000000..b7a4c1b
--- /dev/null
+++ b/test/entry_mplex.c
@@ -0,0 +1,59 @@
+/* Copyright (C) 2012 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+#include "test.h"
+
+int main(void)
+{
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *format_data = "data MPLEX in1 in2 1 2\n";
+  int fd, n, error, r = 0;
+  DIRFILE *D;
+  gd_entry_t E;
+
+  rmdirfile();
+  mkdir(filedir, 0777);
+
+  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
+  write(fd, format_data, strlen(format_data));
+  close(fd);
+
+  D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
+
+  n = gd_entry(D, "data", &E);
+  error = gd_error(D);
+
+  gd_close(D);
+  unlink(format);
+  rmdir(filedir);
+
+  CHECKI(error, GD_E_OK);
+  CHECKI(n, 0);
+  CHECKS(E.field, "data");
+  CHECKX(E.field_type, GD_MPLEX_ENTRY);
+  CHECKS(E.in_fields[0], "in1");
+  CHECKS(E.in_fields[1], "in2");
+  CHECKI(E.EN(mplex,count_val), 1);
+  CHECKI(E.EN(mplex,period), 2);
+  gd_free_entry_strings(&E);
+
+  return r;
+}
diff --git a/test/entry_mplex_scalar.c b/test/entry_mplex_scalar.c
new file mode 100644
index 0000000..7836d37
--- /dev/null
+++ b/test/entry_mplex_scalar.c
@@ -0,0 +1,66 @@
+/* Copyright (C) 2012 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+#include "test.h"
+
+int main(void)
+{
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *format_data =
+    "a CONST UINT16 1\n"
+    "b CARRAY UINT16 2 3 4 5\n"
+    "data MPLEX in1 in2 a b<3>\n";
+  int fd, n, error, r = 0;
+  DIRFILE *D;
+  gd_entry_t E;
+
+  rmdirfile();
+  mkdir(filedir, 0777);
+
+  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
+  write(fd, format_data, strlen(format_data));
+  close(fd);
+
+  D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
+
+  n = gd_entry(D, "data", &E);
+  error = gd_error(D);
+
+  gd_close(D);
+  unlink(format);
+  rmdir(filedir);
+
+  CHECKI(error, GD_E_OK);
+  CHECKI(n, 0);
+  CHECKS(E.field, "data");
+  CHECKX(E.field_type, GD_MPLEX_ENTRY);
+  CHECKS(E.in_fields[0], "in1");
+  CHECKS(E.in_fields[1], "in2");
+  CHECKS(E.scalar[0], "a");
+  CHECKS(E.scalar[1], "b");
+  CHECKI(E.scalar_ind[0], -1);
+  CHECKI(E.scalar_ind[1], 3);
+  CHECKI(E.EN(mplex,count_val), 1);
+  CHECKI(E.EN(mplex,period), 5);
+  gd_free_entry_strings(&E);
+
+  return r;
+}
diff --git a/test/entry_multiply.c b/test/entry_multiply.c
index d46d707..4972f5c 100644
--- a/test/entry_multiply.c
+++ b/test/entry_multiply.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Try to read MULTIPLY entry */
 #include "test.h"
 
@@ -10,13 +30,14 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* format_data = "data MULTIPLY in1 in2\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *format_data = "data MULTIPLY in1 in2\n";
   int fd, n, error, r = 0;
   DIRFILE *D;
   gd_entry_t E;
 
+  rmdirfile();
   mkdir(filedir, 0777);
 
   fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
diff --git a/test/entry_phase.c b/test/entry_phase.c
index ed1c952..1270435 100644
--- a/test/entry_phase.c
+++ b/test/entry_phase.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Try to read PHASE entry */
 #include "test.h"
 
@@ -10,13 +30,14 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* format_data = "data PHASE in1 3\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *format_data = "data PHASE in1 3\n";
   int fd, n, error, r = 0;
   DIRFILE *D;
   gd_entry_t E;
 
+  rmdirfile();
   mkdir(filedir, 0777);
 
   fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
diff --git a/test/entry_phase_scalar.c b/test/entry_phase_scalar.c
index fe90773..b829142 100644
--- a/test/entry_phase_scalar.c
+++ b/test/entry_phase_scalar.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Try to read PHASE entry */
 #include "test.h"
 
@@ -11,13 +31,14 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* format_data = "shift CONST UINT8 3\ndata PHASE in1 shift\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *format_data = "shift CONST UINT8 3\ndata PHASE in1 shift\n";
   int fd, n, error, r = 0;
   DIRFILE *D;
   gd_entry_t E;
 
+  rmdirfile();
   mkdir(filedir, 0777);
 
   fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
diff --git a/test/entry_polynom.c b/test/entry_polynom.c
index 8c837a0..8693bcf 100644
--- a/test/entry_polynom.c
+++ b/test/entry_polynom.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2009-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Try to read POLYNOM entry */
 #include "test.h"
 
@@ -11,13 +31,14 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* format_data = "data POLYNOM in 1 2 3 4 5\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *format_data = "data POLYNOM in 1 2 3 4 5\n";
   int fd, n, error, r = 0;
   DIRFILE *D;
   gd_entry_t E;
 
+  rmdirfile();
   mkdir(filedir, 0777);
 
   fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
diff --git a/test/entry_polynom_scalar.c b/test/entry_polynom_scalar.c
index f806139..6cc3e45 100644
--- a/test/entry_polynom_scalar.c
+++ b/test/entry_polynom_scalar.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2009-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Try to read LINCOM entry */
 #include "test.h"
 
@@ -12,9 +32,9 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* format_data =
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *format_data =
     "a0 CONST FLOAT64 1\n"
     "a1 CONST FLOAT64 2\n"
     "a2 CONST FLOAT64 3\n"
@@ -25,6 +45,7 @@ int main(void)
   DIRFILE *D;
   gd_entry_t E;
 
+  rmdirfile();
   mkdir(filedir, 0777);
 
   fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
diff --git a/test/entry_raw.c b/test/entry_raw.c
index 859d7b8..c09a41e 100644
--- a/test/entry_raw.c
+++ b/test/entry_raw.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Try to read RAW entry */
 #include "test.h"
 
@@ -10,13 +30,14 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* format_data = "data RAW UINT8 8\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *format_data = "data RAW UINT8 8\n";
   int fd, n, error, r = 0;
   DIRFILE *D;
   gd_entry_t E;
 
+  rmdirfile();
   mkdir(filedir, 0777);
 
   fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
diff --git a/test/entry_raw_scalar.c b/test/entry_raw_scalar.c
index e33e4eb..07ddcb3 100644
--- a/test/entry_raw_scalar.c
+++ b/test/entry_raw_scalar.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Try to read RAW entry */
 #include "test.h"
 
@@ -11,13 +31,14 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* format_data = "const CONST UINT32 8\ndata RAW UINT8 const\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *format_data = "const CONST UINT32 8\ndata RAW UINT8 const\n";
   int fd, n, error, r = 0;
   DIRFILE *D;
   gd_entry_t E;
 
+  rmdirfile();
   mkdir(filedir, 0777);
 
   fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
diff --git a/test/entry_raw_scalar_code.c b/test/entry_raw_scalar_code.c
index b7e0caf..4a8624a 100644
--- a/test/entry_raw_scalar_code.c
+++ b/test/entry_raw_scalar_code.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Try to read RAW entry */
 #include "test.h"
 
@@ -10,13 +30,14 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* format_data = "data RAW UINT8 const\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *format_data = "data RAW UINT8 const\n";
   int fd, n, error, r = 0;
   DIRFILE *D;
   gd_entry_t E;
 
+  rmdirfile();
   mkdir(filedir, 0777);
 
   fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
diff --git a/test/entry_raw_scalar_type.c b/test/entry_raw_scalar_type.c
index 7ebcaf5..cea8cab 100644
--- a/test/entry_raw_scalar_type.c
+++ b/test/entry_raw_scalar_type.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Try to read RAW entry */
 #include "test.h"
 
@@ -10,13 +30,14 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* format_data = "const RAW UINT32 8\ndata RAW UINT8 const\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *format_data = "const RAW UINT32 8\ndata RAW UINT8 const\n";
   int fd, n, error, r = 0;
   DIRFILE *D;
   gd_entry_t E;
 
+  rmdirfile();
   mkdir(filedir, 0777);
 
   fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
diff --git a/test/entry_recip.c b/test/entry_recip.c
new file mode 100644
index 0000000..a03c16b
--- /dev/null
+++ b/test/entry_recip.c
@@ -0,0 +1,67 @@
+/* Copyright (C) 2009-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+/* Try to read POLYNOM entry */
+#include "test.h"
+
+#include <stdlib.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <string.h>
+#include <errno.h>
+#include <math.h>
+
+int main(void)
+{
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *format_data = "data RECIP in 2\n";
+  int fd, n, error, r = 0;
+  DIRFILE *D;
+  gd_entry_t E;
+
+  rmdirfile();
+  mkdir(filedir, 0777);
+
+  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
+  write(fd, format_data, strlen(format_data));
+  close(fd);
+
+  D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
+
+  n = gd_entry(D, "data", &E);
+  error = gd_error(D);
+
+  gd_close(D);
+  unlink(format);
+  rmdir(filedir);
+
+  CHECKI(error, GD_E_OK);
+  CHECKI(n, 0);
+  CHECKS(E.field, "data");
+  CHECKX(E.field_type, GD_RECIP_ENTRY);
+  CHECKI(E.comp_scal, 0);
+  CHECKI(E.EN(recip,dividend), 2);
+  CHECKS(E.in_fields[0], "in");
+  gd_free_entry_strings(&E);
+
+  return r;
+}
diff --git a/test/entry_scalar_repr.c b/test/entry_scalar_repr.c
index 1edd355..7a34695 100644
--- a/test/entry_scalar_repr.c
+++ b/test/entry_scalar_repr.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2009-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Try to read LINCOM entry */
 #include "test.h"
 
@@ -12,9 +32,9 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* format_data =
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *format_data =
     "m1 CONST COMPLEX128 1.1;3.2\n"
     "b1 CONST COMPLEX64 2.2;9.3\n"
     "data LINCOM 1 in1 m1.r b1.i\n";
@@ -22,6 +42,7 @@ int main(void)
   DIRFILE *D;
   gd_entry_t E;
 
+  rmdirfile();
   mkdir(filedir, 0777);
 
   fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
diff --git a/test/entry_type.c b/test/entry_type.c
index bb09de9..869784b 100644
--- a/test/entry_type.c
+++ b/test/entry_type.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Try to read entry type */
 #include "test.h"
 
@@ -10,13 +30,14 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* format_data = "data RAW UINT8 8\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *format_data = "data RAW UINT8 8\n";
   int fd, error, r = 0;
   gd_entype_t n;
   DIRFILE *D;
 
+  rmdirfile();
   mkdir(filedir, 0777);
 
   fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
diff --git a/test/entry_type_alias.c b/test/entry_type_alias.c
new file mode 100644
index 0000000..c8d362a
--- /dev/null
+++ b/test/entry_type_alias.c
@@ -0,0 +1,54 @@
+/* Copyright (C) 2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+#include "test.h"
+
+int main(void)
+{
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *format_data =
+    "data RAW UINT8 8\n"
+    "/ALIAS alias data\n";
+  int fd, error, r = 0;
+  gd_entype_t n;
+  DIRFILE *D;
+
+  rmdirfile();
+  mkdir(filedir, 0777);
+
+  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
+  write(fd, format_data, strlen(format_data));
+  close(fd);
+
+  D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
+
+  n = gd_entry_type(D, "alias");
+  error = gd_error(D);
+
+  gd_close(D);
+  unlink(format);
+  rmdir(filedir);
+
+  CHECKI(error, GD_E_OK);
+  CHECKI(n, GD_RAW_ENTRY);
+
+  return r;
+}
diff --git a/test/entry_window.c b/test/entry_window.c
new file mode 100644
index 0000000..5d9b041
--- /dev/null
+++ b/test/entry_window.c
@@ -0,0 +1,67 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+/* Try to read WINDOW entry */
+#include "test.h"
+
+#include <stdlib.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <string.h>
+#include <errno.h>
+
+int main(void)
+{
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *format_data = "data WINDOW in1 in2 NE 0\n";
+  int fd, n, error, r = 0;
+  DIRFILE *D;
+  gd_entry_t E;
+
+  rmdirfile();
+  mkdir(filedir, 0777);
+
+  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
+  write(fd, format_data, strlen(format_data));
+  close(fd);
+
+  D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
+
+  n = gd_entry(D, "data", &E);
+  error = gd_error(D);
+
+  gd_close(D);
+  unlink(format);
+  rmdir(filedir);
+
+  CHECKI(error, GD_E_OK);
+  CHECKI(n, 0);
+  CHECKS(E.field, "data");
+  CHECKX(E.field_type, GD_WINDOW_ENTRY);
+  CHECKS(E.in_fields[0], "in1");
+  CHECKS(E.in_fields[1], "in2");
+  CHECKI(E.EN(window,windop), GD_WINDOP_NE);
+  CHECKI(E.EN(window,threshold.i), 0);
+  gd_free_entry_strings(&E);
+
+  return r;
+}
diff --git a/test/entry_window_scalar.c b/test/entry_window_scalar.c
new file mode 100644
index 0000000..a259c85
--- /dev/null
+++ b/test/entry_window_scalar.c
@@ -0,0 +1,69 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+/* Try to read WINDOW entry */
+#include "test.h"
+
+#include <stdlib.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <string.h>
+#include <errno.h>
+#include <stdio.h>
+
+int main(void)
+{
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *format_data = "const CONST UINT8 3\ndata WINDOW in1 in2 GE const\n";
+  int fd, n, error, r = 0;
+  DIRFILE *D;
+  gd_entry_t E;
+
+  rmdirfile();
+  mkdir(filedir, 0777);
+
+  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
+  write(fd, format_data, strlen(format_data));
+  close(fd);
+
+  D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
+
+  n = gd_entry(D, "data", &E);
+  error = gd_error(D);
+
+  gd_close(D);
+  unlink(format);
+  rmdir(filedir);
+
+  CHECKI(error, GD_E_OK);
+  CHECKI(n, 0);
+  CHECKS(E.field, "data");
+  CHECKI(E.field_type, GD_WINDOW_ENTRY);
+  CHECKS(E.in_fields[0], "in1");
+  CHECKS(E.in_fields[1], "in2");
+  CHECKS(E.scalar[0], "const");
+  CHECKI(E.EN(window,windop), GD_WINDOP_GE);
+  CHECKF(E.EN(window,threshold.r), 3);
+  gd_free_entry_strings(&E);
+
+  return r;
+}
diff --git a/test/eof.c b/test/eof.c
index 4c875e4..fa1ec40 100644
--- a/test/eof.c
+++ b/test/eof.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2010-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 #include "test.h"
 
 #include <stdlib.h>
@@ -9,15 +29,16 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* data = __TEST__ "dirfile/data";
-  const char* format_data = "data RAW UINT16 1\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *data = "dirfile/data";
+  const char *format_data = "data RAW UINT16 1\n";
   int fd, error, r = 0;
   off_t n;
   const size_t len = strlen(data);
   DIRFILE *D;
 
+  rmdirfile();
   mkdir(filedir, 0777);
 
   fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
diff --git a/test/eof_index.c b/test/eof_index.c
index e9182d3..fb34479 100644
--- a/test/eof_index.c
+++ b/test/eof_index.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2010-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 #include "test.h"
 
 #include <stdlib.h>
@@ -9,10 +29,10 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* data = __TEST__ "dirfile/data";
-  const char* format_data =
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *data = "dirfile/data";
+  const char *format_data =
     "data RAW UINT16 1\n"
     "mult1 MULTIPLY data INDEX\n"
     "mult2 MULTIPLY INDEX INDEX\n"
@@ -22,6 +42,7 @@ int main(void)
   off_t eof_INDEX, eof_mult1, eof_mult2, eof_mult3;
   DIRFILE *D;
 
+  rmdirfile();
   mkdir(filedir, 0777);
 
   fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
diff --git a/test/eof_lincom.c b/test/eof_lincom.c
index 31b67c0..1f18e23 100644
--- a/test/eof_lincom.c
+++ b/test/eof_lincom.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2010-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 #include "test.h"
 
 #include <stdlib.h>
@@ -9,11 +29,11 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* data = __TEST__ "dirfile/data";
-  const char* data2 = __TEST__ "dirfile/data2";
-  const char* format_data =
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *data = "dirfile/data";
+  const char *data2 = "dirfile/data2";
+  const char *format_data =
     "data RAW UINT16 1\n"
     "data2 RAW UINT8 1\n"
     "lincom LINCOM 2 data2 1. 0. data 1. 0.\n"
@@ -23,6 +43,7 @@ int main(void)
   off_t n, m;
   DIRFILE *D;
 
+  rmdirfile();
   mkdir(filedir, 0777);
 
   fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
diff --git a/test/eof_phase.c b/test/eof_phase.c
index d60ade2..64a2e8f 100644
--- a/test/eof_phase.c
+++ b/test/eof_phase.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2010-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 #include "test.h"
 
 #include <stdlib.h>
@@ -9,15 +29,16 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* data = __TEST__ "dirfile/data";
-  const char* format_data = "data RAW UINT16 1\nphase PHASE data 3";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *data = "dirfile/data";
+  const char *format_data = "data RAW UINT16 1\nphase PHASE data 3";
   int fd, error, r = 0;
   off_t n;
   const size_t len = strlen(data);
   DIRFILE *D;
 
+  rmdirfile();
   mkdir(filedir, 0777);
 
   fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
diff --git a/test/error.c b/test/error.c
index 421b976..c3705de 100644
--- a/test/error.c
+++ b/test/error.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* attempt to obtain an error string */
 #include "test.h"
 
@@ -9,12 +29,13 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
   char string[1000] = "";
   int error, r = 0;
   DIRFILE *D;
 
+  rmdirfile();
   mkdir(filedir, 0777);
   close(open(format, O_CREAT | O_EXCL | O_WRONLY, 0666));
 
diff --git a/test/error_error.c b/test/error_error.c
index 896bc97..3dd8e81 100644
--- a/test/error_error.c
+++ b/test/error_error.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Opening a non-existent dirfile should fail cleanly */
 #include "test.h"
 
@@ -7,15 +27,14 @@ int main(void)
 {
   char string[1000];
   int error, r = 0;
-
-  DIRFILE* D = gd_open("a non_existant dirfile", 0);
+  DIRFILE *D = gd_open("a non_existant dirfile", 0);
 
   gd_error_string(D, string, 1000);
   error = gd_error(D);
   gd_close(D);
 
   CHECKI(error, GD_E_OPEN);
-  CHECKS(string, "Dirfile does not exist: a non_existant dirfile");
+  CHECKSp(string, "Dirfile does not exist");
 
   return r;
 }
diff --git a/test/error_num.c b/test/error_num.c
new file mode 100644
index 0000000..62c9d59
--- /dev/null
+++ b/test/error_num.c
@@ -0,0 +1,54 @@
+/* Copyright (C) 2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+#include "test.h"
+
+#include <stdlib.h>
+#include <sys/stat.h>
+#include <sys/types.h>
+#include <fcntl.h>
+
+int main(void)
+{
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  int ne1, ne2, r = 0;
+  DIRFILE *D;
+
+  rmdirfile();
+  mkdir(filedir, 0777);
+  close(open(format, O_CREAT | O_EXCL | O_WRONLY, 0666));
+
+  D = gd_open(filedir, GD_RDONLY);
+  gd_validate(D, "1");
+  gd_validate(D, "2");
+  gd_validate(D, "3");
+  ne1 = gd_error_count(D);
+  ne2 = gd_error_count(D);
+  gd_close(D);
+
+  unlink(format);
+  rmdir(filedir);
+
+  CHECKI(ne1, 3);
+  CHECKI(ne2, 0);
+
+  return r;
+}
diff --git a/test/error_short.c b/test/error_short.c
index a0c61ab..723af57 100644
--- a/test/error_short.c
+++ b/test/error_short.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* a short error string should still be NULL-terminated */
 #include "test.h"
 
@@ -9,12 +29,13 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
   char string[1000] = "abc";
   int r = 0;
   DIRFILE *D;
 
+  rmdirfile();
   mkdir(filedir, 0777);
   close(open(format, O_CREAT | O_EXCL | O_WRONLY, 0666));
 
diff --git a/test/error_verbose.c b/test/error_verbose.c
new file mode 100644
index 0000000..b7dac3b
--- /dev/null
+++ b/test/error_verbose.c
@@ -0,0 +1,79 @@
+/* Copyright (C) 2012 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+#include "test.h"
+
+#include <stdlib.h>
+#ifdef HAVE_SYS_WAIT_H
+#include <sys/wait.h>
+#endif
+#include <sys/stat.h>
+#include <sys/types.h>
+#include <fcntl.h>
+#include <string.h>
+
+int main(void)
+{
+#if !defined HAVE_MKFIFO || !defined HAVE_WORKING_FORK || defined __CYGWIN__
+  return 77; /* skip */
+#else
+  const char *fifo = "./dirfile";
+  int error, r = 0, status;
+  FILE *stream;
+  pid_t pid;
+  DIRFILE *D;
+
+  rmdirfile();
+  mkfifo(fifo, 0666);
+
+  /* read our standard error */
+  if ((pid = fork()) == 0) {
+    char string[1024];
+    stream = fopen(fifo, "r");
+
+    fgets(string, 1024, stream);
+    CHECKBOS(string, "libgetdata: Not a dirfile:");
+    return r;
+  }
+
+  /* retarget stderr */
+  freopen(fifo, "w", stderr);
+
+  D = gd_open("", GD_RDONLY | GD_VERBOSE);
+  error = gd_error(D);
+  gd_close(D);
+
+  fputs("\n", stderr);
+  fflush(stderr);
+
+  /* restore stderr */
+  freopen("/dev/stderr", "w", stderr);
+
+  unlink(fifo);
+
+  CHECKI(error, GD_E_OPEN);
+
+  wait(&status);
+  if (status)
+    r = 1;
+
+  return r;
+#endif
+}
diff --git a/test/error_verbose_prefix.c b/test/error_verbose_prefix.c
new file mode 100644
index 0000000..dab8d87
--- /dev/null
+++ b/test/error_verbose_prefix.c
@@ -0,0 +1,90 @@
+/* Copyright (C) 2012 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+#include "test.h"
+
+#include <stdlib.h>
+#ifdef HAVE_SYS_WAIT_H
+#include <sys/wait.h>
+#endif
+#include <sys/stat.h>
+#include <sys/types.h>
+#include <fcntl.h>
+#include <string.h>
+
+int main(void)
+{
+#if !defined HAVE_MKFIFO || !defined HAVE_WORKING_FORK || defined __CYGWIN__
+  return 77; /* skip */
+#else
+  const char *filedir = "dirfile";
+  const char *fifo = "dirfile/fifo";
+  const char *format = "dirfile/format";
+  int e1, e2, r = 0, status;
+  FILE *stream;
+  pid_t pid;
+  DIRFILE *D;
+
+  rmdirfile();
+  mkdir(filedir, 0777);
+  close(open(format, O_CREAT | O_EXCL | O_WRONLY, 0666));
+  mkfifo(fifo, 0666);
+
+  /* read our standard error */
+  if ((pid = fork()) == 0) {
+    char string[1024];
+    stream = fopen(fifo, "r");
+
+    fgets(string, 1024, stream);
+    CHECKS(string, "getdata-test: libgetdata: Field not found: data\n");
+    return r;
+  }
+
+  /* retarget stderr */
+  freopen(fifo, "w", stderr);
+
+  D = gd_open(filedir, GD_RDONLY);
+  e1 = gd_error(D);
+  gd_flags(D, GD_VERBOSE, 0);
+  gd_verbose_prefix(D, "getdata-test: ");
+  gd_validate(D, "data");
+  e2 = gd_error(D);
+  gd_close(D);
+
+  fputs("\n", stderr);
+  fflush(stderr);
+
+  /* restore stderr */
+  freopen("/dev/stderr", "w", stderr);
+
+  unlink(fifo);
+  unlink(format);
+  rmdir(filedir);
+
+  CHECKI(e1, 0);
+  CHECKI(e2, GD_E_BAD_CODE);
+
+  wait(&status);
+  if (status)
+    r = 1;
+
+  return r;
+#endif
+}
diff --git a/test/file.c b/test/file.c
index d9691ce..06befa2 100644
--- a/test/file.c
+++ b/test/file.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Attempt to get RAW filename */
 #include "test.h"
 
@@ -10,15 +30,16 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* data = __TEST__ "dirfile/data";
-  const char* format_data = "data RAW UINT8 8\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *data = "dirfile/data";
+  const char *format_data = "data RAW UINT8 8\n";
   unsigned char data_data[256];
   int fd, error, r = 0;
   char *path;
   DIRFILE *D;
 
+  rmdirfile();
   mkdir(filedir, 0777);
 
   for (fd = 0; fd < 256; ++fd)
@@ -33,7 +54,7 @@ int main(void)
   close(fd);
 
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
-  path = strdup(gd_raw_filename(D, "data"));
+  path = gd_raw_filename(D, "data");
   error = gd_error(D);
 
   gd_close(D);
@@ -43,7 +64,14 @@ int main(void)
   rmdir(filedir);
 
   CHECKI(error, 0);
-  CHECKS(path, __TEST__ "dirfile/data");
+  /* This only checks whether the end of the returned path is what we expect.
+   * This should work, since we can guarantee that both "dirfile" and "data"
+   * aren't symlinks. */
+#if GD_DIRSEP == '/'
+  CHECKEOS(path,"dirfile/data");
+#else
+  CHECKEOS(path,"dirfile\\data");
+#endif
   free(path);
 
   return r;
diff --git a/test/file_code.c b/test/file_code.c
index b46f818..1347258 100644
--- a/test/file_code.c
+++ b/test/file_code.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Attempt to get RAW filename */
 #include "test.h"
 
@@ -10,15 +30,16 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* data = __TEST__ "dirfile/data";
-  const char* format_data = "data RAW UINT8 8\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *data = "dirfile/data";
+  const char *format_data = "data RAW UINT8 8\n";
   unsigned char data_data[256];
   int fd, error, r = 0;
   const char *path;
   DIRFILE *D;
 
+  rmdirfile();
   mkdir(filedir, 0777);
 
   for (fd = 0; fd < 256; ++fd)
diff --git a/test/file_type.c b/test/file_type.c
index 09cf5d6..4f87f1d 100644
--- a/test/file_type.c
+++ b/test/file_type.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Attempt to get RAW filename */
 #include "test.h"
 
@@ -10,15 +30,16 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* data = __TEST__ "dirfile/data";
-  const char* format_data = "data CONST UINT8 8\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *data = "dirfile/data";
+  const char *format_data = "data CONST UINT8 8\n";
   unsigned char data_data[256];
   int fd, error, r = 0;
   const char *path;
   DIRFILE *D;
 
+  rmdirfile();
   mkdir(filedir, 0777);
 
   for (fd = 0; fd < 256; ++fd)
diff --git a/test/flist.c b/test/flist.c
index 0442f19..d16106c 100644
--- a/test/flist.c
+++ b/test/flist.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Retreiving the number of fields of a field should succeed cleanly */
 #include "test.h"
 
@@ -11,9 +31,9 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* format_data =
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *format_data =
     "data1 RAW UINT8 1\n"
     "data2 RAW UINT8 1\n"
     "data3 RAW UINT8 1\n";
@@ -21,6 +41,7 @@ int main(void)
   const char **field_list;
   DIRFILE *D;
 
+  rmdirfile();
   mkdir(filedir, 0777);
 
   fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
diff --git a/test/flist_hidden.c b/test/flist_hidden.c
new file mode 100644
index 0000000..110aa51
--- /dev/null
+++ b/test/flist_hidden.c
@@ -0,0 +1,73 @@
+/* Copyright (C) 2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+#include "test.h"
+
+int main(void)
+{
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *format_data =
+    "data1 RAW UINT8 1\n"
+    "data2 RAW UINT8 1\n"
+    "/HIDDEN data2\n"
+    "data3 RAW UINT8 1\n";
+  int fd, i, error, r = 0;
+  const char **field_list;
+  DIRFILE *D;
+
+  rmdirfile();
+  mkdir(filedir, 0777);
+
+  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
+  write(fd, format_data, strlen(format_data));
+  close(fd);
+
+  D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
+  field_list = gd_field_list(D);
+
+  error = gd_error(D);
+
+  CHECKI(error, 0);
+  CHECKPN(field_list);
+
+  for (i = 0; ; ++i) {
+    if (field_list[i] == NULL)
+      break;
+
+    if (strcmp(field_list[i], "data1") == 0)
+      continue;
+    else if (strcmp(field_list[i], "data3") == 0)
+      continue;
+    else if (strcmp(field_list[i], "INDEX") == 0)
+      continue;
+
+    fprintf(stderr, "field_list[%i] = \"%s\"\n", i, field_list[i]);
+    r = 1;
+  }
+
+  CHECKI(i, 3);
+
+  gd_close(D);
+  unlink(format);
+  rmdir(filedir);
+
+  return r;
+}
diff --git a/test/flist_invalid.c b/test/flist_invalid.c
index ea12e6b..87a205c 100644
--- a/test/flist_invalid.c
+++ b/test/flist_invalid.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Requesting the number of fields from an invalid dirfile should fail cleanly */
 #include "test.h"
 
@@ -9,12 +29,15 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  int r = 0;
+  const char *filedir = "dirfile";
+  int error, r = 0;
+  DIRFILE *D;
+  const char **fl;
 
-  DIRFILE* D = gd_open(filedir, GD_RDONLY);
-  const char** fl = gd_field_list(D);
-  int error = gd_error(D);
+  rmdirfile();
+  D = gd_open(filedir, GD_RDONLY);
+  fl = gd_field_list(D);
+  error = gd_error(D);
   gd_close(D);
 
   CHECKP(fl);
diff --git a/test/flist_meta.c b/test/flist_meta.c
index 57cc194..3103791 100644
--- a/test/flist_meta.c
+++ b/test/flist_meta.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Retreiving the number of fields of a field should succeed cleanly */
 #include "test.h"
 
@@ -11,9 +31,9 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* format_data =
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *format_data =
     "parent RAW UINT8 1\n"
     "META parent data1 LINTERP UINT8 1\n"
     "META parent data2 LINTERP UINT8 1\n"
@@ -22,6 +42,7 @@ int main(void)
   const char **field_list;
   DIRFILE *D;
 
+  rmdirfile();
   mkdir(filedir, 0777);
 
   fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
diff --git a/test/flist_meta_hidden.c b/test/flist_meta_hidden.c
new file mode 100644
index 0000000..cad3250
--- /dev/null
+++ b/test/flist_meta_hidden.c
@@ -0,0 +1,71 @@
+/* Copyright (C) 2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+#include "test.h"
+
+int main(void)
+{
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *format_data =
+    "parent RAW UINT8 1\n"
+    "META parent data1 LINTERP UINT8 1\n"
+    "META parent data2 LINTERP UINT8 1\n"
+    "/HIDDEN parent/data2\n"
+    "META parent data3 LINTERP UINT8 1\n";
+  int fd, i, error, r = 0;
+  const char **field_list;
+  DIRFILE *D;
+
+  rmdirfile();
+  mkdir(filedir, 0777);
+
+  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
+  write(fd, format_data, strlen(format_data));
+  close(fd);
+
+  D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
+  field_list = gd_mfield_list(D, "parent");
+
+  error = gd_error(D);
+  CHECKI(error, 0);
+  CHECKPN(field_list);
+
+  for (i = 0; field_list[i] != NULL; ++i) {
+    CHECKIi(i,strlen(field_list[i]), 5);
+    CHECKIi(i,field_list[i][0], 'd');
+    CHECKIi(i,field_list[i][1], 'a');
+    CHECKIi(i,field_list[i][2], 't');
+    CHECKIi(i,field_list[i][3], 'a');
+
+    if (field_list[i][4] != '1' && field_list[i][4] != '3') {
+      fprintf(stderr, "field_list[%i] = \"%s\"\n", i, field_list[i]);
+      r = 1;
+    }
+  }
+
+  CHECKI(i, 2);
+
+  gd_close(D);
+  unlink(format);
+  rmdir(filedir);
+
+  return r;
+}
diff --git a/test/flist_meta_invalid.c b/test/flist_meta_invalid.c
index c1b9337..02a83f4 100644
--- a/test/flist_meta_invalid.c
+++ b/test/flist_meta_invalid.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Requesting the number of fields from an invalid dirfile should fail cleanly */
 #include "test.h"
 
@@ -9,12 +29,15 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  int r = 0;
+  const char *filedir = "dirfile";
+  int error, r = 0;
+  DIRFILE *D;
+  const char **fl;
 
-  DIRFILE* D = gd_open(filedir, GD_RDONLY);
-  const char** fl = gd_mfield_list(D, "parent");
-  int error = gd_error(D);
+  rmdirfile();
+  D = gd_open(filedir, GD_RDONLY);
+  fl = gd_mfield_list(D, "parent");
+  error = gd_error(D);
   gd_close(D);
 
   CHECKP(fl);
diff --git a/test/flist_type.c b/test/flist_type.c
index c547e61..65ceacc 100644
--- a/test/flist_type.c
+++ b/test/flist_type.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Retreiving the number of fields of a field should succeed cleanly */
 #include "test.h"
 
@@ -11,9 +31,9 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* format_data =
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *format_data =
     "data1 STRING UINT8 1\n"
     "data2 STRING UINT8 1\n"
     "data3 STRING UINT8 1\n"
@@ -22,6 +42,7 @@ int main(void)
   const char **field_list;
   DIRFILE *D;
 
+  rmdirfile();
   mkdir(filedir, 0777);
 
   fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
diff --git a/test/flist_type_hidden.c b/test/flist_type_hidden.c
new file mode 100644
index 0000000..2835c10
--- /dev/null
+++ b/test/flist_type_hidden.c
@@ -0,0 +1,75 @@
+/* Copyright (C) 2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+#include "test.h"
+
+int main(void)
+{
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *format_data =
+    "data1 STRING UINT8 1\n"
+    "data2 STRING UINT8 1\n"
+    "/HIDDEN data2\n"
+    "data3 STRING UINT8 1\n"
+    "data4 CONST UINT8 1\n";
+  int fd, i, error, r = 0;
+  const char **field_list;
+  DIRFILE *D;
+
+  rmdirfile();
+  mkdir(filedir, 0777);
+
+  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
+  write(fd, format_data, strlen(format_data));
+  close(fd);
+
+  D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
+  field_list = gd_field_list_by_type(D, GD_STRING_ENTRY);
+
+  error = gd_error(D);
+  CHECKI(error, GD_E_OK);
+  CHECKPN(field_list);
+
+  if (field_list == NULL)
+    r = 1;
+
+  for (i = 0; field_list[i]; ++i) {
+    CHECKIi(i,strlen(field_list[i]), 5);
+
+    CHECKIi(i,field_list[i][0], 'd');
+    CHECKIi(i,field_list[i][1], 'a');
+    CHECKIi(i,field_list[i][2], 't');
+    CHECKIi(i,field_list[i][3], 'a');
+
+    if (field_list[i][4] != '1' && field_list[i][4] != '3') {
+      fprintf(stderr, "field_list[%i] = \"%s\"\n", i, field_list[i]);
+      r = 1;
+    }
+  }
+
+  CHECKI(i, 2);
+
+  gd_close(D);
+  unlink(format);
+  rmdir(filedir);
+
+  return r;
+}
diff --git a/test/flist_type_invalid.c b/test/flist_type_invalid.c
index 68621ae..33c2147 100644
--- a/test/flist_type_invalid.c
+++ b/test/flist_type_invalid.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Requesting the number of fields from an invalid dirfile should fail cleanly */
 #include "test.h"
 
@@ -9,12 +29,15 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  int r = 0;
+  const char *filedir = "dirfile";
+  int error, r = 0;
+  DIRFILE *D;
+  const char **fl;
 
-  DIRFILE* D = gd_open(filedir, GD_RDONLY);
-  const char** fl = gd_field_list_by_type(D, GD_STRING_ENTRY);
-  int error = gd_error(D);
+  rmdirfile();
+  D = gd_open(filedir, GD_RDONLY);
+  fl = gd_field_list_by_type(D, GD_STRING_ENTRY);
+  error = gd_error(D);
   gd_close(D);
 
   CHECKP(fl);
diff --git a/test/flist_type_meta.c b/test/flist_type_meta.c
index 7d0eb18..3fc6bd9 100644
--- a/test/flist_type_meta.c
+++ b/test/flist_type_meta.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Retreiving the number of fields of a field should succeed cleanly */
 #include "test.h"
 
@@ -11,9 +31,9 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* format_data =
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *format_data =
     "parent STRING UINT8 1\n"
     "META parent data1 STRING UINT8 1\n"
     "META parent data2 STRING UINT8 1\n"
@@ -23,6 +43,7 @@ int main(void)
   const char **field_list;
   DIRFILE *D;
 
+  rmdirfile();
   mkdir(filedir, 0777);
 
   fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
diff --git a/test/flist_type_meta_hidden.c b/test/flist_type_meta_hidden.c
new file mode 100644
index 0000000..496489f
--- /dev/null
+++ b/test/flist_type_meta_hidden.c
@@ -0,0 +1,74 @@
+/* Copyright (C) 2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+#include "test.h"
+
+int main(void)
+{
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *format_data =
+    "parent STRING UINT8 1\n"
+    "META parent data1 STRING UINT8 1\n"
+    "META parent data2 STRING UINT8 1\n"
+    "/HIDDEN parent/data2\n"
+    "META parent data3 STRING UINT8 1\n"
+    "META parent data4 CONST UINT8 1\n";
+  int fd, i, error, r = 0;
+  const char **field_list;
+  DIRFILE *D;
+
+  rmdirfile();
+  mkdir(filedir, 0777);
+
+  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
+  write(fd, format_data, strlen(format_data));
+  close(fd);
+
+  D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
+  field_list = gd_mfield_list_by_type(D, "parent", GD_STRING_ENTRY);
+
+  error = gd_error(D);
+  CHECKI(error, 0);
+
+  CHECKPN(field_list);
+
+  for (i = 0; field_list[i]; ++i) {
+    CHECKIi(i,strlen(field_list[i]), 5);
+
+    CHECKIi(i,field_list[i][0], 'd');
+    CHECKIi(i,field_list[i][1], 'a');
+    CHECKIi(i,field_list[i][2], 't');
+    CHECKIi(i,field_list[i][3], 'a');
+
+    if (field_list[i][4] != '1' && field_list[i][4] != '3') {
+      fprintf(stderr, "field_list[%i] = \"%s\"\n", i, field_list[i]);
+      r = 1;
+    }
+  }
+
+  CHECKI(i, 2);
+
+  gd_close(D);
+  unlink(format);
+  rmdir(filedir);
+
+  return r;
+}
diff --git a/test/flist_type_meta_invalid.c b/test/flist_type_meta_invalid.c
index be314c0..eb64d5a 100644
--- a/test/flist_type_meta_invalid.c
+++ b/test/flist_type_meta_invalid.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Requesting the number of fields from an invalid dirfile should fail cleanly */
 #include "test.h"
 
@@ -9,12 +29,15 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  int r = 0;
+  const char *filedir = "dirfile";
+  int error, r = 0;
+  DIRFILE *D;
+  const char **fl;
 
-  DIRFILE* D = gd_open(filedir, GD_RDONLY);
-  const char** fl = gd_mfield_list_by_type(D, "parent", GD_STRING_ENTRY);
-  int error = gd_error(D);
+  rmdirfile();
+  D = gd_open(filedir, GD_RDONLY);
+  fl = gd_mfield_list_by_type(D, "parent", GD_STRING_ENTRY);
+  error = gd_error(D);
   gd_close(D);
 
   CHECKP(fl);
diff --git a/test/flush.c b/test/flush.c
index 24f112a..ff75c67 100644
--- a/test/flush.c
+++ b/test/flush.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Attempt to flush */
 #include "test.h"
 
@@ -11,16 +31,17 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* data = __TEST__ "dirfile/data";
-  const char* format_data = "data RAW UINT8 8\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *data = "dirfile/data";
+  const char *format_data = "data RAW UINT8 8\n";
   uint8_t c[8], d;
   int fd, i, n, error;
   struct stat buf;
   DIRFILE *D;
 
   memset(c, 0, 8);
+  rmdirfile();
   mkdir(filedir, 0777);
 
   for (i = 0; i < 8; ++i)
diff --git a/test/flush_all.c b/test/flush_all.c
index 8c28129..c2a7fe5 100644
--- a/test/flush_all.c
+++ b/test/flush_all.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Attempt to flush */
 #include "test.h"
 
@@ -11,16 +31,17 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* data = __TEST__ "dirfile/data";
-  const char* format_data = "data RAW UINT8 8\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *data = "dirfile/data";
+  const char *format_data = "data RAW UINT8 8\n";
   uint8_t c[8], d;
   int fd, i, n, error;
   struct stat buf;
   DIRFILE *D;
 
   memset(c, 0, 8);
+  rmdirfile();
   mkdir(filedir, 0777);
 
   for (i = 0; i < 8; ++i)
diff --git a/test/flush_bad_code.c b/test/flush_bad_code.c
index fc57b46..2d8c713 100644
--- a/test/flush_bad_code.c
+++ b/test/flush_bad_code.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Attempt to flush a non-existant field */
 #include "test.h"
 
@@ -10,12 +30,13 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* format_data = "#\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *format_data = "#\n";
   int fd, error, r = 0;
   DIRFILE *D;
 
+  rmdirfile();
   mkdir(filedir, 0777);
 
   fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
diff --git a/test/flush_invalid.c b/test/flush_invalid.c
index 309d47d..60bac39 100644
--- a/test/flush_invalid.c
+++ b/test/flush_invalid.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Writing data to an invalid dirfile should fail cleanly */
 #include "test.h"
 
@@ -9,10 +29,12 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
+  const char *filedir = "dirfile";
   int error, r = 0;
+  DIRFILE *D;
 
-  DIRFILE* D = gd_open(filedir, GD_RDWR);
+  rmdirfile();
+  D = gd_open(filedir, GD_RDWR);
   gd_flush(D, NULL);
   error = gd_error(D);
   gd_close(D);
diff --git a/test/flush_meta.c b/test/flush_meta.c
index f882916..294a73e 100644
--- a/test/flush_meta.c
+++ b/test/flush_meta.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Attempt to flush meta data */
 #include "test.h"
 
@@ -11,13 +31,15 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* data = __TEST__ "dirfile/new";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *data = "dirfile/new";
   struct stat buf;
   int error, stat_format, r = 0;
+  DIRFILE *D;
 
-  DIRFILE* D = gd_open(filedir, GD_RDWR | GD_CREAT | GD_TRUNC |
+  rmdirfile();
+  D = gd_open(filedir, GD_RDWR | GD_CREAT | GD_TRUNC |
       GD_VERBOSE);
   gd_add_raw(D, "new", GD_UINT8, 2, 0);
   gd_metaflush(D);
diff --git a/test/flush_ref.c b/test/flush_ref.c
new file mode 100644
index 0000000..8786cd2
--- /dev/null
+++ b/test/flush_ref.c
@@ -0,0 +1,74 @@
+/* Copyright (C) 2013 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+/* Test include */
+#include "test.h"
+
+#include <stdlib.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <string.h>
+#include <errno.h>
+#include <stdio.h>
+
+int main(void)
+{
+  const char *filedir = "dirfile";
+  const char *subdir = "dirfile/sub";
+  const char *format = "dirfile/format";
+  const char *format1 = "dirfile/sub/format";
+  const char *format_data = "data RAW UINT8 1\nREFERENCE data\n";
+  const char *format1_data = "mata RAW UINT8 11\nREFERENCE mata\n";
+  int fd, e1, r = 0;
+  const char *r1;
+  unsigned int spf;
+  DIRFILE *D;
+
+  rmdirfile();
+  mkdir(filedir, 0777);
+  mkdir(subdir, 0777);
+
+  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
+  write(fd, format_data, strlen(format_data));
+  close(fd);
+
+  fd = open(format1, O_CREAT | O_EXCL | O_WRONLY, 0666);
+  write(fd, format1_data, strlen(format1_data));
+  close(fd);
+
+  D = gd_open(filedir, GD_RDWR | GD_VERBOSE);
+  gd_include_affix(D, "sub/format", 0, "prefix_", NULL, GD_IGNORE_REFS);
+  gd_rewrite_fragment(D, GD_ALL_FRAGMENTS);
+  gd_close(D);
+  D = gd_open(subdir, GD_RDONLY | GD_VERBOSE);
+  r1 = gd_reference(D, NULL);
+  CHECKS(r1, "mata");
+  e1 = gd_error(D);
+  gd_discard(D);
+
+  unlink(format1);
+  unlink(format);
+  rmdir(filedir);
+
+  CHECKI(e1, 0);
+
+  return r;
+}
diff --git a/test/flush_spec.c b/test/flush_spec.c
index 522de64..10fa57b 100644
--- a/test/flush_spec.c
+++ b/test/flush_spec.c
@@ -1,22 +1,32 @@
-/* Check the writing of field specs */
+/* Copyright (C) 2009-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 #include "test.h"
 
-#include <stdio.h>
-#include <inttypes.h>
-#include <stdlib.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-#include <string.h>
-#include <errno.h>
-
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* apath = __TEST__ "dirfile/a";
-  const char* jpath = __TEST__ "dirfile/j";
-  const char* spec[] = {
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *apath = "dirfile/a";
+  const char *jpath = "dirfile/j";
+  const char *spec[] = {
     "a RAW UINT8 1\n",
     "c CONST UINT64 1\n",
     "d CONST UINT64 2\n",
@@ -29,14 +39,20 @@ int main(void)
     "k PHASE h 3\n",
     "l SBIT a d 2\n",
     "m POLYNOM a 1 c 2 d\n",
-    "n STRING \"a b c \\x01 ÿ\"\n",
+    "n STRING a\\ b\\ c\\ \\x01\\ ÿ\n",
+    "o DIVIDE j k\n",
+    "p RECIP e d\n",
+    "q WINDOW i m EQ c\n",
+    "r CARRAY FLOAT64 1.2 3.4 5.6 7.8\n",
     NULL
   };
 
   int error, i = 0, r = 0;
   FILE *stream;
+  DIRFILE *D;
 
-  DIRFILE* D = gd_open(filedir, GD_RDWR | GD_CREAT | GD_TRUNC |
+  rmdirfile();
+  D = gd_open(filedir, GD_RDWR | GD_CREAT | GD_TRUNC |
       GD_VERBOSE);
   for (i = 0; spec[i] != NULL; ++i)
     gd_add_spec(D, spec[i], 0);
diff --git a/test/foffs_alter.c b/test/foffs_alter.c
index fb07e59..1b795c9 100644
--- a/test/foffs_alter.c
+++ b/test/foffs_alter.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Test frameoffset */
 #include "test.h"
 
@@ -11,15 +31,16 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* data = __TEST__ "dirfile/data";
-  const char* format_data = "data RAW UINT8 8\nFRAMEOFFSET 13\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *data = "dirfile/data";
+  const char *format_data = "data RAW UINT8 8\nFRAMEOFFSET 13\n";
   unsigned char data_data[256];
   int fd, ret, error, r = 0;
   off_t fo, nf;
   DIRFILE *D;
 
+  rmdirfile();
   mkdir(filedir, 0777);
 
   for (fd = 0; fd < 256; ++fd)
diff --git a/test/foffs_get.c b/test/foffs_get.c
index a6e1129..55470f1 100644
--- a/test/foffs_get.c
+++ b/test/foffs_get.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Test frameoffset */
 #include "test.h"
 
@@ -10,15 +30,16 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* data = __TEST__ "dirfile/data";
-  const char* format_data = "data RAW UINT8 8\nFRAMEOFFSET 13\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *data = "dirfile/data";
+  const char *format_data = "data RAW UINT8 8\nFRAMEOFFSET 13\n";
   unsigned char data_data[256];
   int fd, error, r = 0;
   off_t n;
   DIRFILE *D;
 
+  rmdirfile();
   mkdir(filedir, 0777);
 
   for (fd = 0; fd < 256; ++fd)
diff --git a/test/foffs_move.c b/test/foffs_move.c
index 2c03d6a..5271090 100644
--- a/test/foffs_move.c
+++ b/test/foffs_move.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Test frameoffset */
 #include "test.h"
 
@@ -11,15 +31,16 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* data = __TEST__ "dirfile/data";
-  const char* format_data = "data RAW UINT8 8\nFRAMEOFFSET 13\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *data = "dirfile/data";
+  const char *format_data = "data RAW UINT8 8\nFRAMEOFFSET 13\n";
   unsigned char data_data[256];
   int fd, ret, error, r = 0;
   off_t fo, nf;
   DIRFILE *D;
 
+  rmdirfile();
   mkdir(filedir, 0777);
 
   for (fd = 0; fd < 256; ++fd)
diff --git a/test/fragment_affix.c b/test/fragment_affix.c
new file mode 100644
index 0000000..2832bb8
--- /dev/null
+++ b/test/fragment_affix.c
@@ -0,0 +1,63 @@
+/* Copyright (C) 2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+#include "test.h"
+
+int main(void)
+{
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *format1 = "dirfile/format1";
+  const char *format_data = "INCLUDE format1 A Z\n";
+  const char *format1_data = "data RAW UINT8 11\n";
+  char *prefix;
+  char *suffix;
+  int fd, ret, error, r = 0;
+  DIRFILE *D;
+
+  rmdirfile();
+  mkdir(filedir, 0777);
+
+  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
+  write(fd, format_data, strlen(format_data));
+  close(fd);
+
+  fd = open(format1, O_CREAT | O_EXCL | O_WRONLY, 0666);
+  write(fd, format1_data, strlen(format1_data));
+  close(fd);
+
+  D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
+  ret = gd_fragment_affixes(D, 1, &prefix, &suffix);
+  error = gd_error(D);
+  gd_close(D);
+
+  unlink(format1);
+  unlink(format);
+  rmdir(filedir);
+
+  CHECKS(prefix,"A");
+  CHECKS(suffix,"Z");
+  CHECKI(ret,0);
+  CHECKI(error,0);
+  free(prefix);
+  free(suffix);
+
+  return r;
+}
diff --git a/test/fragment_affix_alter.c b/test/fragment_affix_alter.c
new file mode 100644
index 0000000..666813d
--- /dev/null
+++ b/test/fragment_affix_alter.c
@@ -0,0 +1,69 @@
+/* Copyright (C) 2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+#include "test.h"
+
+int main(void)
+{
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *format1 = "dirfile/format1";
+  const char *format_data = "B CONST UINT8 1\nINCLUDE format1 A Z\n";
+  const char *format1_data = "data RAW UINT8 11\n";
+  char *prefix;
+  char *suffix;
+  int fd, ret, e1, e2, e3, r = 0;
+  DIRFILE *D;
+
+  rmdirfile();
+  mkdir(filedir, 0777);
+
+  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
+  write(fd, format_data, strlen(format_data));
+  close(fd);
+
+  fd = open(format1, O_CREAT | O_EXCL | O_WRONLY, 0666);
+  write(fd, format1_data, strlen(format1_data));
+  close(fd);
+
+  D = gd_open(filedir, GD_RDWR);
+  ret = gd_alter_affixes(D, 1, "C", NULL);
+  e1 = gd_error(D);
+  gd_fragment_affixes(D, 1, &prefix, &suffix);
+  e2 = gd_error(D);
+  gd_spf(D, "CdataZ");
+  e3 = gd_error(D);
+  gd_close(D);
+
+  unlink(format1);
+  unlink(format);
+  rmdir(filedir);
+
+  CHECKS(prefix,"C");
+  CHECKS(suffix,"Z");
+  CHECKI(ret,0);
+  CHECKI(e1,0);
+  CHECKI(e2,0);
+  CHECKI(e3,0);
+  free(prefix);
+  free(suffix);
+
+  return r;
+}
diff --git a/test/fragment_affix_alter2.c b/test/fragment_affix_alter2.c
new file mode 100644
index 0000000..52f02ef
--- /dev/null
+++ b/test/fragment_affix_alter2.c
@@ -0,0 +1,67 @@
+/* Copyright (C) 2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+#include "test.h"
+
+int main(void)
+{
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *format1 = "dirfile/format1";
+  const char *format2 = "dirfile/format2";
+  const char *format_data = "B CONST UINT8 1\nINCLUDE format1 A Z\n";
+  const char *format1_data = "/INCLUDE format2 B Y\n";
+  const char *format2_data = "data RAW UINT8 11\n";
+  int fd, ret, e1, e2, r = 0;
+  DIRFILE *D;
+
+  rmdirfile();
+  mkdir(filedir, 0777);
+
+  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
+  write(fd, format_data, strlen(format_data));
+  close(fd);
+
+  fd = open(format1, O_CREAT | O_EXCL | O_WRONLY, 0666);
+  write(fd, format1_data, strlen(format1_data));
+  close(fd);
+
+  fd = open(format2, O_CREAT | O_EXCL | O_WRONLY, 0666);
+  write(fd, format2_data, strlen(format2_data));
+  close(fd);
+
+  D = gd_open(filedir, GD_RDWR);
+  ret = gd_alter_affixes(D, 1, NULL, "");
+  e1 = gd_error(D);
+  gd_spf(D, "ABdataY");
+  e2 = gd_error(D);
+  gd_close(D);
+
+  unlink(format2);
+  unlink(format1);
+  unlink(format);
+  rmdir(filedir);
+
+  CHECKI(ret,0);
+  CHECKI(e1,0);
+  CHECKI(e2,0);
+
+  return r;
+}
diff --git a/test/fragment_affix_dup.c b/test/fragment_affix_dup.c
new file mode 100644
index 0000000..d9fa28a
--- /dev/null
+++ b/test/fragment_affix_dup.c
@@ -0,0 +1,66 @@
+/* Copyright (C) 2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+#include "test.h"
+
+int main(void)
+{
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *format1 = "dirfile/format1";
+  const char *format_data = "CdataD CONST UINT8 1\nINCLUDE format1 A Z\n";
+  const char *format1_data = "data RAW UINT8 11\n";
+  char *prefix;
+  char *suffix;
+  int fd, ret, e1, e2, r = 0;
+  DIRFILE *D;
+
+  rmdirfile();
+  mkdir(filedir, 0777);
+
+  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
+  write(fd, format_data, strlen(format_data));
+  close(fd);
+
+  fd = open(format1, O_CREAT | O_EXCL | O_WRONLY, 0666);
+  write(fd, format1_data, strlen(format1_data));
+  close(fd);
+
+  D = gd_open(filedir, GD_RDWR);
+  ret = gd_alter_affixes(D, 1, "C", "D");
+  e1 = gd_error(D);
+  gd_fragment_affixes(D, 1, &prefix, &suffix);
+  e2 = gd_error(D);
+  gd_close(D);
+
+  unlink(format1);
+  unlink(format);
+  rmdir(filedir);
+
+  CHECKS(prefix,"A");
+  CHECKS(suffix,"Z");
+  CHECKI(ret,-1);
+  CHECKI(e1,GD_E_DUPLICATE);
+  CHECKI(e2,0);
+  free(prefix);
+  free(suffix);
+
+  return r;
+}
diff --git a/test/fragment_index.c b/test/fragment_index.c
index 92a03fb..f79e4bb 100644
--- a/test/fragment_index.c
+++ b/test/fragment_index.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Try to read fragment index */
 #include "test.h"
 
@@ -10,14 +30,15 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* format1 = __TEST__ "dirfile/format1";
-  const char* format_data = "INCLUDE format1\n";
-  const char* format1_data = "data RAW UINT8 8\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *format1 = "dirfile/format1";
+  const char *format_data = "INCLUDE format1\n";
+  const char *format1_data = "data RAW UINT8 8\n";
   int fd, n, error, r = 0;
   DIRFILE *D;
 
+  rmdirfile();
   mkdir(filedir, 0777);
 
   fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
diff --git a/test/fragment_index_alias.c b/test/fragment_index_alias.c
new file mode 100644
index 0000000..aed2b59
--- /dev/null
+++ b/test/fragment_index_alias.c
@@ -0,0 +1,58 @@
+/* Copyright (C) 2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+#include "test.h"
+
+int main(void)
+{
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *format1 = "dirfile/format1";
+  const char *format_data = "INCLUDE format1\n";
+  const char *format1_data = "/ALIAS alias target\n";
+  int fd, n, error, r = 0;
+  DIRFILE *D;
+
+  rmdirfile();
+  mkdir(filedir, 0777);
+
+  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
+  write(fd, format_data, strlen(format_data));
+  close(fd);
+
+  fd = open(format1, O_CREAT | O_EXCL | O_WRONLY, 0666);
+  write(fd, format1_data, strlen(format1_data));
+  close(fd);
+
+  D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
+
+  n = gd_fragment_index(D, "alias");
+  error = gd_error(D);
+
+  gd_close(D);
+  unlink(format1);
+  unlink(format);
+  rmdir(filedir);
+
+  CHECKI(error, GD_E_OK);
+  CHECKI(n, 1);
+
+  return r;
+}
diff --git a/test/fragment_name.c b/test/fragment_name.c
index c52bbe6..f1ba2c1 100644
--- a/test/fragment_name.c
+++ b/test/fragment_name.c
@@ -1,5 +1,23 @@
-/* Test gd_fragmentname */
-#define _SVID_SOURCE
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 #include "test.h"
 
 #include <stdlib.h>
@@ -12,16 +30,17 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* format1 = __TEST__ "dirfile/format1";
-  const char* format_data = "INCLUDE format1\n";
-  const char* format1_data = "data RAW UINT8 11\n";
-  char* form0 = NULL;
-  char* form1 = NULL;
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *format1 = "dirfile/format1";
+  const char *format_data = "INCLUDE format1\n";
+  const char *format1_data = "data RAW UINT8 11\n";
+  char *form0 = NULL;
+  char *form1 = NULL;
   int fd, r = 0;
   DIRFILE *D;
 
+  rmdirfile();
   mkdir(filedir, 0777);
 
   fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
@@ -41,8 +60,16 @@ int main(void)
   unlink(format);
   rmdir(filedir);
 
-  CHECKS(form0, __TEST__ "dirfile/format");
-  CHECKS(form1, __TEST__ "dirfile/format1");
+  /* This only checks whether the end of the returned path is what we expect.
+   * This should work, since we can guarantee that both "dirfile" and "format*"
+   * aren't symlinks. */
+#if GD_DIRSEP == '/'
+  CHECKEOS(form0,"dirfile/format");
+  CHECKEOS(form1,"dirfile/format1");
+#else
+  CHECKEOS(form0,"dirfile\\format");
+  CHECKEOS(form1,"dirfile\\format1");
+#endif
   free(form0);
   free(form1);
 
diff --git a/test/fragment_name_oor.c b/test/fragment_name_oor.c
index 6429398..b4e2680 100644
--- a/test/fragment_name_oor.c
+++ b/test/fragment_name_oor.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Test gd_fragmentname out-of-range handling */
 #include "test.h"
 
@@ -11,16 +31,17 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* format1 = __TEST__ "dirfile/format1";
-  const char* format_data = "INCLUDE format1\n";
-  const char* format1_data = "data RAW UINT8 11\n";
-  const char* form0 = NULL;
-  const char* form1 = NULL;
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *format1 = "dirfile/format1";
+  const char *format_data = "INCLUDE format1\n";
+  const char *format1_data = "data RAW UINT8 11\n";
+  const char *form0 = NULL;
+  const char *form1 = NULL;
   int fd, error, r = 0;
   DIRFILE *D;
 
+  rmdirfile();
   mkdir(filedir, 0777);
 
   fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
diff --git a/test/fragment_num.c b/test/fragment_num.c
new file mode 100644
index 0000000..e6cc8a9
--- /dev/null
+++ b/test/fragment_num.c
@@ -0,0 +1,55 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+#include "test.h"
+
+int main(void)
+{
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *format1 = "dirfile/format1";
+  const char *format_data = "INCLUDE format1\n";
+  const char *format1_data = "data RAW UINT8 11\n";
+  int fd, nfragments, r = 0;
+  DIRFILE *D;
+
+  rmdirfile();
+  mkdir(filedir, 0777);
+
+  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
+  write(fd, format_data, strlen(format_data));
+  close(fd);
+
+  fd = open(format1, O_CREAT | O_EXCL | O_WRONLY, 0666);
+  write(fd, format1_data, strlen(format1_data));
+  close(fd);
+
+  D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
+  nfragments = gd_nfragments(D);
+  gd_close(D);
+
+  unlink(format1);
+  unlink(format);
+  rmdir(filedir);
+
+  CHECKI(nfragments, 2);
+
+  return r;
+}
diff --git a/test/fragment_parent.c b/test/fragment_parent.c
new file mode 100644
index 0000000..ffbdddb
--- /dev/null
+++ b/test/fragment_parent.c
@@ -0,0 +1,64 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+#include "test.h"
+
+int main(void)
+{
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *format1 = "dirfile/format1";
+  const char *format2 = "dirfile/format2";
+  const char *format_data = "/INCLUDE format1\na CONST UINT8 1\n";
+  const char *format1_data = "b CONST UINT8 11\n/INCLUDE format2 UINT8 11";
+  const char *format2_data = "c CONST UINT8 11\n";
+  int fd, parent, error, r = 0;
+  DIRFILE *D;
+
+  rmdirfile();
+  mkdir(filedir, 0777);
+
+  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
+  write(fd, format_data, strlen(format_data));
+  close(fd);
+
+  fd = open(format1, O_CREAT | O_EXCL | O_WRONLY, 0666);
+  write(fd, format1_data, strlen(format1_data));
+  close(fd);
+
+  fd = open(format2, O_CREAT | O_EXCL | O_WRONLY, 0666);
+  write(fd, format2_data, strlen(format2_data));
+  close(fd);
+
+  D = gd_open(filedir, GD_RDWR | GD_VERBOSE);
+  parent = gd_parent_fragment(D, 2);
+  error = gd_error(D);
+  gd_close(D);
+
+  unlink(format2);
+  unlink(format1);
+  unlink(format);
+  rmdir(filedir);
+
+  CHECKI(error, 0);
+  CHECKI(parent, 1);
+
+  return r;
+}
diff --git a/test/get64.c b/test/get64.c
index 941fd9c..e05a589 100644
--- a/test/get64.c
+++ b/test/get64.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Attempt to read UINT8 */
 #define _LARGEFILE64_SOURCE 1
 
@@ -12,16 +32,17 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* data = __TEST__ "dirfile/data";
-  const char* format_data = "data RAW UINT8 8\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *data = "dirfile/data";
+  const char *format_data = "data RAW UINT8 8\n";
   unsigned char c[8];
   unsigned char data_data[256];
   int fd, i, n, error, r = 0;
   DIRFILE *D;
 
   memset(c, 0, 8);
+  rmdirfile();
   mkdir(filedir, 0777);
 
   for (fd = 0; fd < 256; ++fd)
diff --git a/test/get_affix.c b/test/get_affix.c
new file mode 100644
index 0000000..22193e7
--- /dev/null
+++ b/test/get_affix.c
@@ -0,0 +1,78 @@
+/* Copyright (C) 2012 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+#include "test.h"
+
+#include <stdlib.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <string.h>
+#include <errno.h>
+#include <stdio.h>
+
+int main(void)
+{
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *format1 = "dirfile/format1";
+  const char *data = "dirfile/data";
+  const char *format_data = "INCLUDE format1 A Z\n";
+  const char *format1_data = "phase PHASE data -2\ndata RAW UINT8 1\n";
+  unsigned char c = 0;
+  unsigned char data_data[256];
+  int fd, n, error, r = 0;
+  DIRFILE *D;
+
+  rmdirfile();
+  mkdir(filedir, 0777);
+
+  for (fd = 0; fd < 256; ++fd)
+    data_data[fd] = (unsigned char)fd;
+
+  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
+  write(fd, format_data, strlen(format_data));
+  close(fd);
+
+  fd = open(format1, O_CREAT | O_EXCL | O_WRONLY, 0666);
+  write(fd, format1_data, strlen(format1_data));
+  close(fd);
+
+  fd = open(data, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
+  write(fd, data_data, 256);
+  close(fd);
+
+  D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
+  n = gd_getdata(D, "AphaseZ", 5, 0, 1, 0, GD_UINT8, &c);
+  error = gd_error(D);
+
+  gd_close(D);
+
+  unlink(data);
+  unlink(format1);
+  unlink(format);
+  rmdir(filedir);
+
+  CHECKI(error, 0);
+  CHECKI(n, 1);
+  CHECKI(c, 3);
+
+  return r;
+}
diff --git a/test/get_bad_code.c b/test/get_bad_code.c
index 159459f..15af673 100644
--- a/test/get_bad_code.c
+++ b/test/get_bad_code.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Attempt to read a non-existant field */
 #include "test.h"
 
@@ -11,13 +31,14 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* format_data = "#\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *format_data = "#\n";
   unsigned char c = 0;
   int fd, n, error, r = 0;
   DIRFILE *D;
 
+  rmdirfile();
   mkdir(filedir, 0777);
 
   fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
diff --git a/test/get_bit.c b/test/get_bit.c
index 86e5160..bee8b52 100644
--- a/test/get_bit.c
+++ b/test/get_bit.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Attempt to read BIT */
 #include "test.h"
 
@@ -10,15 +30,16 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* data = __TEST__ "dirfile/data";
-  const char* format_data = "bit BIT data 1 3\ndata RAW UINT8 1\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *data = "dirfile/data";
+  const char *format_data = "bit BIT data 1 3\ndata RAW UINT8 1\n";
   unsigned char c = 0;
   unsigned char data_data[256];
   int fd, n, error, r = 0;
   DIRFILE *D;
 
+  rmdirfile();
   mkdir(filedir, 0777);
 
   for (fd = 0; fd < 256; ++fd)
diff --git a/test/get_carray.c b/test/get_carray.c
index 2b9881c..146f183 100644
--- a/test/get_carray.c
+++ b/test/get_carray.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2010-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Attempt to read constant */
 #include "test.h"
 
@@ -11,13 +31,14 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* format_data = "carray CARRAY FLOAT64 8.3 7.2 6.1 5.0 3.9 2.8 1.7\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *format_data = "carray CARRAY FLOAT64 8.3 7.2 6.1 5.0 3.9 2.8 1.7\n";
   double c[7];
   int fd, i, n, error, r = 0;
   DIRFILE *D;
 
+  rmdirfile();
   mkdir(filedir, 0777);
 
   fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
diff --git a/test/get_carray_len.c b/test/get_carray_len.c
index ffd61c0..e0bf34e 100644
--- a/test/get_carray_len.c
+++ b/test/get_carray_len.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2010-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Attempt to read constant */
 #include "test.h"
 
@@ -11,13 +31,14 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* format_data = "carray CARRAY FLOAT64 8.3 7.2 6.1 5.0 3.9 2.8 1.7\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *format_data = "carray CARRAY FLOAT64 8.3 7.2 6.1 5.0 3.9 2.8 1.7\n";
   int fd, error, r = 0;
   size_t n;
   DIRFILE *D;
 
+  rmdirfile();
   mkdir(filedir, 0777);
 
   fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
diff --git a/test/get_carray_slice.c b/test/get_carray_slice.c
index 3f28ec3..129c1bb 100644
--- a/test/get_carray_slice.c
+++ b/test/get_carray_slice.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2010-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Attempt to read constant */
 #include "test.h"
 
@@ -11,13 +31,14 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* format_data = "carray CARRAY FLOAT64 8.3 7.2 6.1 5.0 3.9 2.8 1.7\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *format_data = "carray CARRAY FLOAT64 8.3 7.2 6.1 5.0 3.9 2.8 1.7\n";
   double c[4];
   int fd, i, n, error, r = 0;
   DIRFILE *D;
 
+  rmdirfile();
   mkdir(filedir, 0777);
 
   fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
diff --git a/test/get_char.c b/test/get_char.c
index f83d207..9f98677 100644
--- a/test/get_char.c
+++ b/test/get_char.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Attempt to use a old-style type character should fail cleanly */
 #include "test.h"
 
@@ -10,16 +30,17 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* data = __TEST__ "dirfile/data";
-  const char* format_data = "data RAW UINT8 8\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *data = "dirfile/data";
+  const char *format_data = "data RAW UINT8 8\n";
   unsigned char c[8];
   unsigned char data_data[256];
   int fd, n, error, r = 0;
   DIRFILE *D;
 
   memset(c, 0, 8);
+  rmdirfile();
   mkdir(filedir, 0777);
 
   for (fd = 0; fd < 256; ++fd)
diff --git a/test/get_clincom.c b/test/get_clincom.c
index 79ae4c8..4eff3f8 100644
--- a/test/get_clincom.c
+++ b/test/get_clincom.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2009-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Attempt to read LINCOM */
 #include "test.h"
 
@@ -11,10 +31,10 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* data = __TEST__ "dirfile/data";
-  const char* format_data = "lincom LINCOM 2 data 2;3 3;2 data 0;1 0\ndata RAW UINT8 1\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *data = "dirfile/data";
+  const char *format_data = "lincom LINCOM 2 data 2;3 3;2 data 0;1 0\ndata RAW UINT8 1\n";
 #ifdef GD_NO_C99_API
   double c[2] = {0, 0};
   const double v[2] = {13, 22};
@@ -26,6 +46,7 @@ int main(void)
   int fd, n, error, r = 0;
   DIRFILE *D;
 
+  rmdirfile();
   mkdir(filedir, 0777);
 
   for (fd = 0; fd < 256; ++fd)
diff --git a/test/get_complex128.c b/test/get_complex128.c
index b149bbc..18c2057 100644
--- a/test/get_complex128.c
+++ b/test/get_complex128.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2009-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Attempt to read COMPLEX128 */
 #include "test.h"
 
@@ -11,10 +31,10 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* data = __TEST__ "dirfile/data";
-  const char* format_data = "data RAW COMPLEX128 8\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *data = "dirfile/data";
+  const char *format_data = "data RAW COMPLEX128 8\n";
 #ifdef GD_NO_C99_API
   double c[16];
   double data_data[256];
@@ -26,6 +46,7 @@ int main(void)
   DIRFILE *D;
 
   memset(c, 0, 8);
+  rmdirfile();
   mkdir(filedir, 0777);
 
   for (fd = 0; fd < 128; ++fd) {
diff --git a/test/get_complex64.c b/test/get_complex64.c
index 68222c2..91b64ae 100644
--- a/test/get_complex64.c
+++ b/test/get_complex64.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2009-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Attempt to read COMPLEX64 */
 #include "test.h"
 
@@ -11,10 +31,10 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* data = __TEST__ "dirfile/data";
-  const char* format_data = "data RAW COMPLEX64 8\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *data = "dirfile/data";
+  const char *format_data = "data RAW COMPLEX64 8\n";
 #ifdef GD_NO_C99_API
   float c[16];
   float data_data[256];
@@ -26,6 +46,7 @@ int main(void)
   DIRFILE *D;
 
   memset(c, 0, 8);
+  rmdirfile();
   mkdir(filedir, 0777);
 
   for (fd = 0; fd < 128; ++fd) {
diff --git a/test/get_const.c b/test/get_const.c
index 6c8884e..9c1358a 100644
--- a/test/get_const.c
+++ b/test/get_const.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2009-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Attempt to read constant */
 #include "test.h"
 
@@ -11,13 +31,14 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* format_data = "const CONST FLOAT64 8.3\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *format_data = "const CONST FLOAT64 8.3\n";
   double c;
   int fd, n, error, r = 0;
   DIRFILE *D;
 
+  rmdirfile();
   mkdir(filedir, 0777);
 
   fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
diff --git a/test/get_const_complex.c b/test/get_const_complex.c
index 8d1a61f..13b5687 100644
--- a/test/get_const_complex.c
+++ b/test/get_const_complex.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2009-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Attempt to read complex constant */
 #include "test.h"
 
@@ -11,9 +31,9 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* format_data = "const CONST COMPLEX128 8.3;9.2\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *format_data = "const CONST COMPLEX128 8.3;9.2\n";
 #ifdef GD_NO_C99_API
   double c[2];
   const double v[2] = {8.3, 9.2};
@@ -24,6 +44,7 @@ int main(void)
   int fd, n, error, r = 0;
   DIRFILE *D;
 
+  rmdirfile();
   mkdir(filedir, 0777);
 
   fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
diff --git a/test/get_const_repr.c b/test/get_const_repr.c
index 626dc40..96a669c 100644
--- a/test/get_const_repr.c
+++ b/test/get_const_repr.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2009-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Attempt to read constant with repr */
 #include "test.h"
 
@@ -11,13 +31,14 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* format_data = "const CONST COMPLEX128 8.3;9.2\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *format_data = "const CONST COMPLEX128 8.3;9.2\n";
   double c;
   int fd, n, error, r = 0;
   DIRFILE *D;
 
+  rmdirfile();
   mkdir(filedir, 0777);
 
   fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
diff --git a/test/get_cpolynom.c b/test/get_cpolynom.c
index 1654b14..c195a15 100644
--- a/test/get_cpolynom.c
+++ b/test/get_cpolynom.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2009-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Attempt to read POLYNOM */
 #include "test.h"
 
@@ -11,10 +31,10 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* data = __TEST__ "dirfile/data";
-  const char* format_data = "polynom POLYNOM data 3;2 2;4 0;1\ndata RAW UINT8 1\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *data = "dirfile/data";
+  const char *format_data = "polynom POLYNOM data 3;2 2;4 0;1\ndata RAW UINT8 1\n";
 #ifdef GD_NO_C99_API
   double c[2] = {0, 0};
   const double v[2] = {13, 47};
@@ -26,6 +46,7 @@ int main(void)
   int fd, n, error, r = 0;
   DIRFILE *D;
 
+  rmdirfile();
   mkdir(filedir, 0777);
 
   for (fd = 0; fd < 256; ++fd)
diff --git a/test/get_divide.c b/test/get_divide.c
index cffb0a3..1f54191 100644
--- a/test/get_divide.c
+++ b/test/get_divide.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2010-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Attempt to read DIVIDE */
 #include "test.h"
 
@@ -10,10 +30,10 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* data = __TEST__ "dirfile/data";
-  const char* format_data =
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *data = "dirfile/data";
+  const char *format_data =
     "div DIVIDE data INDEX\n"
     "data RAW UINT8 1\n";
   double c = 0;
@@ -21,6 +41,7 @@ int main(void)
   int fd, n, error, r = 0;
   DIRFILE *D;
 
+  rmdirfile();
   mkdir(filedir, 0777);
 
   for (fd = 0; fd < 256; ++fd)
diff --git a/test/get_endian16.c b/test/get_endian16.c
index 403f34d..0871c50 100644
--- a/test/get_endian16.c
+++ b/test/get_endian16.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Attempt to read UINT16 with the opposite endianness */
 #include "test.h"
 
@@ -22,9 +42,9 @@ static int BigEndian(void)
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* data = __TEST__ "dirfile/data";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *data = "dirfile/data";
   char format_data[1000];
   uint16_t c = 0;
   uint16_t data_data[128];
@@ -32,6 +52,7 @@ int main(void)
   int fd, n, error, r = 0;
   DIRFILE *D;
 
+  rmdirfile();
   mkdir(filedir, 0777); 
 
   sprintf(format_data, "data RAW UINT16 1\nENDIAN %s\n", (big_endian)
diff --git a/test/get_endian32.c b/test/get_endian32.c
index 8748fc6..0bd5fcf 100644
--- a/test/get_endian32.c
+++ b/test/get_endian32.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Attempt to read UINT32 with the opposite endianness */
 #include "test.h"
 
@@ -22,9 +42,9 @@ static int BigEndian(void)
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* data = __TEST__ "dirfile/data";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *data = "dirfile/data";
   char format_data[1000];
   uint32_t c = 0;
   uint32_t data_data[128];
@@ -32,6 +52,7 @@ int main(void)
   int fd, n, error, r = 0;
   DIRFILE *D;
 
+  rmdirfile();
   mkdir(filedir, 0777); 
 
   sprintf(format_data, "data RAW UINT32 1\nENDIAN %s\n", (big_endian)
diff --git a/test/get_endian64.c b/test/get_endian64.c
index 2e8f9f3..b750944 100644
--- a/test/get_endian64.c
+++ b/test/get_endian64.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Attempt to read UINT64 with the opposite endianness */
 #include "test.h"
 
@@ -22,9 +42,9 @@ static int BigEndian(void)
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* data = __TEST__ "dirfile/data";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *data = "dirfile/data";
   char format_data[1000];
   uint64_t c = 0;
   uint64_t data_data[128];
@@ -32,13 +52,14 @@ int main(void)
   int fd, n, error, r = 0;
   DIRFILE *D;
 
+  rmdirfile();
   mkdir(filedir, 0777); 
 
   sprintf(format_data, "data RAW UINT64 1\nENDIAN %s\n", (big_endian)
       ? "little" : "big");
 
   for (fd = 0; fd < 128; ++fd)
-    data_data[fd] = fd * (0x020100000201LLU);
+    data_data[fd] = fd * (0x020100000201);
 
   fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
   write(fd, format_data, strlen(format_data));
@@ -60,7 +81,7 @@ int main(void)
 
   CHECKI(error, 0);
   CHECKI(n, 1);
-  CHECKX(c, 0x50a0000050a0000LLU);
+  CHECKX(c, 0x50a0000050a0000);
 
   return r;
 }
diff --git a/test/get_endian8.c b/test/get_endian8.c
index e796b16..fca7168 100644
--- a/test/get_endian8.c
+++ b/test/get_endian8.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Attempt to read UINT8 with the opposite endianness */
 #include "test.h"
 
@@ -22,9 +42,9 @@ static int BigEndian(void)
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* data = __TEST__ "dirfile/data";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *data = "dirfile/data";
   char format_data[1000];
   uint8_t c = 0;
   uint8_t data_data[128];
@@ -32,6 +52,7 @@ int main(void)
   int fd, n, error, r = 0;
   DIRFILE *D;
 
+  rmdirfile();
   mkdir(filedir, 0777); 
 
   sprintf(format_data, "data RAW UINT8 1\nENDIAN %s\n", (big_endian)
diff --git a/test/get_endian_complex128_arm.c b/test/get_endian_complex128_arm.c
index 243b230..181567b 100644
--- a/test/get_endian_complex128_arm.c
+++ b/test/get_endian_complex128_arm.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2009-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Attempt to read arm-endian COMPLEX128 */
 #include "test.h"
 
@@ -13,10 +33,10 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* data = __TEST__ "dirfile/data";
-  const char* format_data = "data RAW COMPLEX128 1\nENDIAN little arm\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *data = "dirfile/data";
+  const char *format_data = "data RAW COMPLEX128 1\nENDIAN little arm\n";
 #ifdef GD_NO_C99_API
   double u[20];
   double v[20][2];
@@ -157,6 +177,7 @@ int main(void)
   int fd, i, n, error, r = 0;
   DIRFILE *D;
 
+  rmdirfile();
   mkdir(filedir, 0777); 
 
 #ifdef GD_NO_C99_API
diff --git a/test/get_endian_complex128_big.c b/test/get_endian_complex128_big.c
index 11bb61a..b44246f 100644
--- a/test/get_endian_complex128_big.c
+++ b/test/get_endian_complex128_big.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2009-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Attempt to read big-endian COMPLEX128 */
 #include "test.h"
 
@@ -13,10 +33,10 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* data = __TEST__ "dirfile/data";
-  const char* format_data = "data RAW COMPLEX128 1\nENDIAN big\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *data = "dirfile/data";
+  const char *format_data = "data RAW COMPLEX128 1\nENDIAN big\n";
 #ifdef GD_NO_C99_API
   double u[20];
   double v[20][2];
@@ -157,6 +177,7 @@ int main(void)
   int fd, i, n, error, r = 0;
   DIRFILE *D;
 
+  rmdirfile();
   mkdir(filedir, 0777); 
 
 #ifdef GD_NO_C99_API
diff --git a/test/get_endian_complex128_little.c b/test/get_endian_complex128_little.c
index bbeae90..8ffb539 100644
--- a/test/get_endian_complex128_little.c
+++ b/test/get_endian_complex128_little.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2009-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Attempt to read little-endian COMPLEX128 */
 #include "test.h"
 
@@ -13,10 +33,10 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* data = __TEST__ "dirfile/data";
-  const char* format_data = "data RAW COMPLEX128 1\nENDIAN little\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *data = "dirfile/data";
+  const char *format_data = "data RAW COMPLEX128 1\nENDIAN little\n";
 #ifdef GD_NO_C99_API
   double u[20];
   double v[20][2];
@@ -157,6 +177,7 @@ int main(void)
   int fd, i, n, error, r = 0;
   DIRFILE *D;
 
+  rmdirfile();
   mkdir(filedir, 0777); 
 
 #ifdef GD_NO_C99_API
diff --git a/test/get_endian_complex64_arm.c b/test/get_endian_complex64_arm.c
index e7eab7b..5aa8a07 100644
--- a/test/get_endian_complex64_arm.c
+++ b/test/get_endian_complex64_arm.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2009-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Attempt to read arm-endian COMPLEX64 (which is just little endian) */
 #include "test.h"
 
@@ -13,10 +33,10 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* data = __TEST__ "dirfile/data";
-  const char* format_data = "data RAW COMPLEX64 1\nENDIAN little arm\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *data = "dirfile/data";
+  const char *format_data = "data RAW COMPLEX64 1\nENDIAN little arm\n";
 #ifdef GD_NO_C99_API
   float u[20];
   float v[20][2];
@@ -93,6 +113,7 @@ int main(void)
   int fd, i, n, error, r = 0;
   DIRFILE *D;
 
+  rmdirfile();
   mkdir(filedir, 0777); 
 
 #ifdef GD_NO_C99_API
diff --git a/test/get_endian_complex64_big.c b/test/get_endian_complex64_big.c
index dd4294b..930d29c 100644
--- a/test/get_endian_complex64_big.c
+++ b/test/get_endian_complex64_big.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2009-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Attempt to read big-endian COMPLEX64 */
 #include "test.h"
 
@@ -13,10 +33,10 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* data = __TEST__ "dirfile/data";
-  const char* format_data = "data RAW COMPLEX64 1\nENDIAN big\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *data = "dirfile/data";
+  const char *format_data = "data RAW COMPLEX64 1\nENDIAN big\n";
 #ifdef GD_NO_C99_API
   float u[20];
   float v[20][2];
@@ -93,6 +113,7 @@ int main(void)
   int fd, i, n, error, r = 0;
   DIRFILE *D;
 
+  rmdirfile();
   mkdir(filedir, 0777); 
 
 #ifdef GD_NO_C99_API
diff --git a/test/get_endian_complex64_little.c b/test/get_endian_complex64_little.c
index 5ee74b1..191fcd9 100644
--- a/test/get_endian_complex64_little.c
+++ b/test/get_endian_complex64_little.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2009-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Attempt to read little-endian COMPLEX64 */
 #include "test.h"
 
@@ -13,10 +33,10 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* data = __TEST__ "dirfile/data";
-  const char* format_data = "data RAW COMPLEX64 1\nENDIAN little\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *data = "dirfile/data";
+  const char *format_data = "data RAW COMPLEX64 1\nENDIAN little\n";
 #ifdef GD_NO_C99_API
   float u[20];
   float v[20][2];
@@ -93,6 +113,7 @@ int main(void)
   int fd, i, n, error, r = 0;
   DIRFILE *D;
 
+  rmdirfile();
   mkdir(filedir, 0777); 
 
 #ifdef GD_NO_C99_API
diff --git a/test/get_endian_float32_arm.c b/test/get_endian_float32_arm.c
index 91df1d0..c76b6c9 100644
--- a/test/get_endian_float32_arm.c
+++ b/test/get_endian_float32_arm.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Attempt to read arm-endian FLOAT32 (which is just little endian) */
 #include "test.h"
 
@@ -13,10 +33,10 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* data = __TEST__ "dirfile/data";
-  const char* format_data = "data RAW FLOAT32 1\nENDIAN little arm\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *data = "dirfile/data";
+  const char *format_data = "data RAW FLOAT32 1\nENDIAN little arm\n";
   float u[10];
   float v[20];
   const unsigned char data_data[128 * 4] = {
@@ -88,6 +108,7 @@ int main(void)
   int fd, i, n, error, r = 0;
   DIRFILE *D;
 
+  rmdirfile();
   mkdir(filedir, 0777); 
 
   v[0] = 1.5;
diff --git a/test/get_endian_float32_big.c b/test/get_endian_float32_big.c
index 25c1d29..f84c496 100644
--- a/test/get_endian_float32_big.c
+++ b/test/get_endian_float32_big.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Attempt to read big-endian FLOAT32 */
 #include "test.h"
 
@@ -13,10 +33,10 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* data = __TEST__ "dirfile/data";
-  const char* format_data = "data RAW FLOAT32 1\nENDIAN big\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *data = "dirfile/data";
+  const char *format_data = "data RAW FLOAT32 1\nENDIAN big\n";
   float u[10];
   float v[20];
   const unsigned char data_data[128 * 4] = {
@@ -88,6 +108,7 @@ int main(void)
   int fd, i, n, error, r = 0;
   DIRFILE *D;
 
+  rmdirfile();
   mkdir(filedir, 0777); 
 
   v[0] = 1.5;
diff --git a/test/get_endian_float32_little.c b/test/get_endian_float32_little.c
index 4f5468a..535e1db 100644
--- a/test/get_endian_float32_little.c
+++ b/test/get_endian_float32_little.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Attempt to read little-endian FLOAT32 */
 #include "test.h"
 
@@ -13,10 +33,10 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* data = __TEST__ "dirfile/data";
-  const char* format_data = "data RAW FLOAT32 1\nENDIAN little\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *data = "dirfile/data";
+  const char *format_data = "data RAW FLOAT32 1\nENDIAN little\n";
   float u[10];
   float v[20];
   const unsigned char data_data[128 * 4] = {
@@ -88,6 +108,7 @@ int main(void)
   int fd, i, n, error, r = 0;
   DIRFILE *D;
 
+  rmdirfile();
   mkdir(filedir, 0777); 
 
   v[0] = 1.5;
diff --git a/test/get_endian_float64_arm.c b/test/get_endian_float64_arm.c
index 302dd67..ee554b6 100644
--- a/test/get_endian_float64_arm.c
+++ b/test/get_endian_float64_arm.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Attempt to read arm-endian FLOAT64 */
 #include "test.h"
 
@@ -13,10 +33,10 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* data = __TEST__ "dirfile/data";
-  const char* format_data = "data RAW FLOAT64 1\nENDIAN little arm\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *data = "dirfile/data";
+  const char *format_data = "data RAW FLOAT64 1\nENDIAN little arm\n";
   double u[10];
   double v[20];
   const unsigned char data_data[128 * 8] = {
@@ -152,6 +172,7 @@ int main(void)
   int fd, i, n, error, r = 0;
   DIRFILE *D;
 
+  rmdirfile();
   mkdir(filedir, 0777); 
 
   v[0] = 1.5;
diff --git a/test/get_endian_float64_big.c b/test/get_endian_float64_big.c
index 0aff9b4..7d3c7fe 100644
--- a/test/get_endian_float64_big.c
+++ b/test/get_endian_float64_big.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Attempt to read big-endian FLOAT64 */
 #include "test.h"
 
@@ -13,10 +33,10 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* data = __TEST__ "dirfile/data";
-  const char* format_data = "data RAW FLOAT64 1\nENDIAN big\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *data = "dirfile/data";
+  const char *format_data = "data RAW FLOAT64 1\nENDIAN big\n";
   double u[10];
   double v[20];
   const unsigned char data_data[128 * 8] = {
@@ -152,6 +172,7 @@ int main(void)
   int fd, i, n, error, r = 0;
   DIRFILE *D;
 
+  rmdirfile();
   mkdir(filedir, 0777); 
 
   v[0] = 1.5;
diff --git a/test/get_endian_float64_little.c b/test/get_endian_float64_little.c
index 09d5d30..970aa46 100644
--- a/test/get_endian_float64_little.c
+++ b/test/get_endian_float64_little.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Attempt to read little-endian FLOAT64 */
 #include "test.h"
 
@@ -13,10 +33,10 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* data = __TEST__ "dirfile/data";
-  const char* format_data = "data RAW FLOAT64 1\nENDIAN little\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *data = "dirfile/data";
+  const char *format_data = "data RAW FLOAT64 1\nENDIAN little\n";
   double u[10];
   double v[20];
   const unsigned char data_data[128 * 8] = {
@@ -152,6 +172,7 @@ int main(void)
   int fd, i, n, error, r = 0;
   DIRFILE *D;
 
+  rmdirfile();
   mkdir(filedir, 0777); 
 
   v[0] = 1.5;
diff --git a/test/get_ff.c b/test/get_ff.c
index 31f3e1d..5217c54 100644
--- a/test/get_ff.c
+++ b/test/get_ff.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Attempt to read UINT8 */
 #include "test.h"
 
@@ -10,16 +30,17 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* data = __TEST__ "dirfile/data";
-  const char* format_data = "data RAW UINT8 8\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *data = "dirfile/data";
+  const char *format_data = "data RAW UINT8 8\n";
   unsigned char c[8];
   unsigned char data_data[256];
   int fd, i, n, error, r = 0;
   DIRFILE *D;
 
   memset(c, 0, 8);
+  rmdirfile();
   mkdir(filedir, 0777);
 
   for (fd = 0; fd < 256; ++fd)
diff --git a/test/get_float32.c b/test/get_float32.c
index 1e0e26c..ed16c3c 100644
--- a/test/get_float32.c
+++ b/test/get_float32.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Attempt to read FLOAT32 */
 #include "test.h"
 
@@ -11,16 +31,17 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* data = __TEST__ "dirfile/data";
-  const char* format_data = "data RAW FLOAT32 8\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *data = "dirfile/data";
+  const char *format_data = "data RAW FLOAT32 8\n";
   float c[8];
   float data_data[128];
   int fd, i, n, error, r = 0;
   DIRFILE *D;
 
   memset(c, 0, 8);
+  rmdirfile();
   mkdir(filedir, 0777);
 
   for (fd = 0; fd < 128; ++fd)
diff --git a/test/get_float64.c b/test/get_float64.c
index 9d2045f..b2e1688 100644
--- a/test/get_float64.c
+++ b/test/get_float64.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Attempt to read FLOAT64 */
 #include "test.h"
 
@@ -11,16 +31,17 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* data = __TEST__ "dirfile/data";
-  const char* format_data = "data RAW FLOAT64 8\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *data = "dirfile/data";
+  const char *format_data = "data RAW FLOAT64 8\n";
   double c[8];
   double data_data[128];
   int fd, i, n, error, r = 0;
   DIRFILE *D;
 
   memset(c, 0, 8);
+  rmdirfile();
   mkdir(filedir, 0777);
 
   for (fd = 0; fd < 128; ++fd)
diff --git a/test/get_foffs.c b/test/get_foffs.c
index a6af64b..15a8c94 100644
--- a/test/get_foffs.c
+++ b/test/get_foffs.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Attempt to read UINT8 with a FRAMEOFFSET */
 #include "test.h"
 
@@ -10,15 +30,16 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* data = __TEST__ "dirfile/data";
-  const char* format_data = "FRAMEOFFSET 1\ndata RAW UINT8 1\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *data = "dirfile/data";
+  const char *format_data = "FRAMEOFFSET 1\ndata RAW UINT8 1\n";
   unsigned char c;
   unsigned char data_data[256];
   int fd, n, error, r = 0;
   DIRFILE *D;
 
+  rmdirfile();
   mkdir(filedir, 0777);
 
   for (fd = 0; fd < 256; ++fd)
diff --git a/test/get_fs.c b/test/get_fs.c
index 851157a..2c428e4 100644
--- a/test/get_fs.c
+++ b/test/get_fs.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Attempt to read UINT8 */
 #include "test.h"
 
@@ -10,16 +30,17 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* data = __TEST__ "dirfile/data";
-  const char* format_data = "data RAW UINT8 8\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *data = "dirfile/data";
+  const char *format_data = "data RAW UINT8 8\n";
   unsigned char c[8];
   unsigned char data_data[256];
   int fd, i, n, error, r = 0;
   DIRFILE *D;
 
   memset(c, 0, 8);
+  rmdirfile();
   mkdir(filedir, 0777);
 
   for (fd = 0; fd < 256; ++fd)
diff --git a/test/get_here.c b/test/get_here.c
new file mode 100644
index 0000000..b0868fc
--- /dev/null
+++ b/test/get_here.c
@@ -0,0 +1,76 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+/* Attempt to read UINT8 */
+#include "test.h"
+
+#include <stdlib.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <string.h>
+#include <errno.h>
+
+int main(void)
+{
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *data = "dirfile/data";
+  const char *format_data = "data RAW UINT8 8\n";
+  unsigned char c[8];
+  unsigned char data_data[256];
+  int fd, i, m, n, error, r = 0;
+  DIRFILE *D;
+
+  memset(c, 0, 8);
+  rmdirfile();
+  mkdir(filedir, 0777);
+
+  for (fd = 0; fd < 256; ++fd)
+    data_data[fd] = (unsigned char)fd;
+
+  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
+  write(fd, format_data, strlen(format_data));
+  close(fd);
+
+  fd = open(data, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
+  write(fd, data_data, 256);
+  close(fd);
+
+  D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
+  m = gd_seek(D, "data", 5, 0, GD_SEEK_SET);
+  n = gd_getdata(D, "data", GD_HERE, 0, 0, 8, GD_UINT8, c);
+  error = gd_error(D);
+
+  gd_close(D);
+
+  unlink(data);
+  unlink(format);
+  rmdir(filedir);
+
+  CHECKI(error, 0);
+  CHECKI(m, 40);
+  CHECKI(n, 8);
+
+  for (i = 0; i < 8; ++i)
+    CHECKUi(i, c[i], 40 + i);
+
+  return r;
+}
diff --git a/test/get_here_foffs.c b/test/get_here_foffs.c
new file mode 100644
index 0000000..6074ac9
--- /dev/null
+++ b/test/get_here_foffs.c
@@ -0,0 +1,85 @@
+/* Copyright (C) 2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+/* Check GD_HERE and FRAMEOFFSET */
+#include "test.h"
+
+#include <stdlib.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <string.h>
+#include <errno.h>
+
+int main(void)
+{
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *data = "dirfile/data";
+  const char *format_data = "FRAMEOFFSET 2\ndata RAW UINT8 8\n";
+  unsigned char c[8], d[8];
+  unsigned char data_data[256];
+  int fd, i, j, k, l, m, n, e1, e2, r = 0;
+  DIRFILE *D;
+
+  rmdirfile();
+  mkdir(filedir, 0777);
+
+  for (fd = 0; fd < 256; ++fd)
+    data_data[fd] = (unsigned char)fd;
+
+  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
+  write(fd, format_data, strlen(format_data));
+  close(fd);
+
+  fd = open(data, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
+  write(fd, data_data, 256);
+  close(fd);
+
+  D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
+  n = gd_seek(D, "data", 0, 4, GD_SEEK_SET);
+  m = gd_getdata(D, "data", GD_HERE, 0, 1, 0, GD_UINT8, c);
+  e1 = gd_error(D);
+  l = gd_tell(D, "data");
+  k = gd_getdata(D, "data", GD_HERE, 0, 1, 0, GD_UINT8, d);
+  e2 = gd_error(D);
+  j = gd_tell(D, "data");
+
+  gd_close(D);
+
+  unlink(data);
+  unlink(format);
+  rmdir(filedir);
+
+  CHECKI(e1, 0);
+  CHECKI(e2, 0);
+  CHECKI(n, 4);
+  CHECKI(m, 8);
+  CHECKI(l, 12);
+  CHECKI(k, 8);
+  CHECKI(j, 20);
+
+  for (i = 0; i < 8; ++i) {
+    CHECKUi(i, c[i], 0);
+    CHECKUi(i, d[i], (i < 4) ? 0 : i - 4);
+  }
+
+  return r;
+}
diff --git a/test/get_heres.c b/test/get_heres.c
new file mode 100644
index 0000000..49ad86f
--- /dev/null
+++ b/test/get_heres.c
@@ -0,0 +1,76 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+/* Attempt to read UINT8 */
+#include "test.h"
+
+#include <stdlib.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <string.h>
+#include <errno.h>
+
+int main(void)
+{
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *data = "dirfile/data";
+  const char *format_data = "data RAW UINT8 8\n";
+  unsigned char c[8];
+  unsigned char data_data[256];
+  int fd, i, m, n, error, r = 0;
+  DIRFILE *D;
+
+  memset(c, 0, 8);
+  rmdirfile();
+  mkdir(filedir, 0777);
+
+  for (fd = 0; fd < 256; ++fd)
+    data_data[fd] = (unsigned char)fd;
+
+  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
+  write(fd, format_data, strlen(format_data));
+  close(fd);
+
+  fd = open(data, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
+  write(fd, data_data, 256);
+  close(fd);
+
+  D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
+  m = gd_seek(D, "data", 5, 0, GD_SEEK_SET);
+  n = gd_getdata(D, "data", 0, GD_HERE, 0, 8, GD_UINT8, c);
+  error = gd_error(D);
+
+  gd_close(D);
+
+  unlink(data);
+  unlink(format);
+  rmdir(filedir);
+
+  CHECKI(error, 0);
+  CHECKI(m, 40);
+  CHECKI(n, 8);
+
+  for (i = 0; i < 8; ++i)
+    CHECKUi(i, c[i], 40 + i);
+
+  return r;
+}
diff --git a/test/get_int16.c b/test/get_int16.c
index 146cc56..88e6b1b 100644
--- a/test/get_int16.c
+++ b/test/get_int16.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Attempt to read INT16 */
 #include "test.h"
 
@@ -11,16 +31,17 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* data = __TEST__ "dirfile/data";
-  const char* format_data = "data RAW INT16 8\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *data = "dirfile/data";
+  const char *format_data = "data RAW INT16 8\n";
   int16_t c[8];
   int16_t data_data[64];
   int fd, i, n, error, r = 0;
   DIRFILE *D;
 
   memset(c, 0, 8);
+  rmdirfile();
   mkdir(filedir, 0777);
 
   for (fd = 0; fd < 64; ++fd)
diff --git a/test/get_int32.c b/test/get_int32.c
index ec7c77b..3419fbc 100644
--- a/test/get_int32.c
+++ b/test/get_int32.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Attempt to read INT32 */
 #include "test.h"
 
@@ -11,16 +31,17 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* data = __TEST__ "dirfile/data";
-  const char* format_data = "data RAW INT32 8\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *data = "dirfile/data";
+  const char *format_data = "data RAW INT32 8\n";
   int32_t c[8];
   int32_t data_data[64];
   int fd, i, n, error, r = 0;
   DIRFILE *D;
 
   memset(c, 0, 8);
+  rmdirfile();
   mkdir(filedir, 0777);
 
   for (fd = 0; fd < 64; ++fd)
diff --git a/test/get_int64.c b/test/get_int64.c
index 8a8d430..87ccf25 100644
--- a/test/get_int64.c
+++ b/test/get_int64.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Attempt to read INT64 */
 #include "test.h"
 
@@ -11,20 +31,21 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* data = __TEST__ "dirfile/data";
-  const char* format_data = "data RAW INT64 8\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *data = "dirfile/data";
+  const char *format_data = "data RAW INT64 8\n";
   int64_t c[8];
   int64_t data_data[64];
   int fd, i, n, error, r = 0;
   DIRFILE *D;
 
   memset(c, 0, 8);
+  rmdirfile();
   mkdir(filedir, 0777);
 
   for (fd = 0; fd < 64; ++fd)
-    data_data[fd] = fd * (0x0200000000000001LLU) * (2 * (fd % 2) - 1);
+    data_data[fd] = fd * (0x0200000000000001) * (2 * (fd % 2) - 1);
 
   fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
   write(fd, format_data, strlen(format_data));
@@ -42,7 +63,7 @@ int main(void)
   CHECKI(n, 8);
 
   for (i = 0; i < 8; ++i)
-    CHECKIi(i,c[i], (0x5000000000000028LL + i * 0x0200000000000001LL)
+    CHECKIi(i,c[i], (0x5000000000000028 + i * 0x0200000000000001)
         * (2 * (i % 2) - 1));
 
   gd_close(D);
diff --git a/test/get_int8.c b/test/get_int8.c
index a96a586..3ed6a84 100644
--- a/test/get_int8.c
+++ b/test/get_int8.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Attempt to read INT8 */
 #include "test.h"
 
@@ -10,16 +30,17 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* data = __TEST__ "dirfile/data";
-  const char* format_data = "data RAW INT8 8\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *data = "dirfile/data";
+  const char *format_data = "data RAW INT8 8\n";
   signed char c[8];
   signed char data_data[128];
   int fd, i, n, error, r = 0;
   DIRFILE *D;
 
   memset(c, 0, 8);
+  rmdirfile();
   mkdir(filedir, 0777);
 
   for (fd = 0; fd < 128; ++fd)
diff --git a/test/get_invalid.c b/test/get_invalid.c
index 2cd39c0..2c680bb 100644
--- a/test/get_invalid.c
+++ b/test/get_invalid.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Getting data from an invalid dirfile should fail cleanly */
 #include "test.h"
 
@@ -9,13 +29,16 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
+  const char *filedir = "dirfile";
   char c[8];
-  int r = 0;
+  int error, r = 0;
+  size_t n;
+  DIRFILE *D;
 
-  DIRFILE* D = gd_open(filedir, GD_RDONLY);
-  size_t n = gd_getdata(D, "data", 5, 0, 1, 0, GD_UINT8, c);
-  int error = gd_error(D);
+  rmdirfile();
+  D = gd_open(filedir, GD_RDONLY);
+  n = gd_getdata(D, "data", 5, 0, 1, 0, GD_UINT8, c);
+  error = gd_error(D);
   gd_close(D);
 
   CHECKI(n, 0);
diff --git a/test/get_lincom1.c b/test/get_lincom1.c
index bf363b6..3402c1d 100644
--- a/test/get_lincom1.c
+++ b/test/get_lincom1.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Attempt to read LINCOM1 */
 #include "test.h"
 
@@ -10,15 +30,16 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* data = __TEST__ "dirfile/data";
-  const char* format_data = "lincom LINCOM 1 data 2 3\ndata RAW UINT8 1\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *data = "dirfile/data";
+  const char *format_data = "lincom LINCOM 1 data 2 3\ndata RAW UINT8 1\n";
   unsigned char c = 0;
   unsigned char data_data[256];
   int fd, n, error, r = 0;
   DIRFILE *D;
 
+  rmdirfile();
   mkdir(filedir, 0777);
 
   for (fd = 0; fd < 256; ++fd)
diff --git a/test/get_lincom2.c b/test/get_lincom2.c
index 0501670..ed0cb97 100644
--- a/test/get_lincom2.c
+++ b/test/get_lincom2.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Attempt to read LINCOM */
 #include "test.h"
 
@@ -10,15 +30,16 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* data = __TEST__ "dirfile/data";
-  const char* format_data = "lincom LINCOM 2 data 2 3 data 1 0\ndata RAW UINT8 1\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *data = "dirfile/data";
+  const char *format_data = "lincom LINCOM 2 data 2 3 data 1 0\ndata RAW UINT8 1\n";
   unsigned char c = 0;
   unsigned char data_data[256];
   int fd, n, error, r = 0;
   DIRFILE *D;
 
+  rmdirfile();
   mkdir(filedir, 0777);
 
   for (fd = 0; fd < 256; ++fd)
diff --git a/test/get_lincom3.c b/test/get_lincom3.c
index 5bb3545..28153e8 100644
--- a/test/get_lincom3.c
+++ b/test/get_lincom3.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Attempt to read LINCOM */
 #include "test.h"
 
@@ -10,15 +30,16 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* data = __TEST__ "dirfile/data";
-  const char* format_data = "lincom LINCOM 3 data 2 3 data 1 0 data 10 4\ndata RAW UINT8 1\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *data = "dirfile/data";
+  const char *format_data = "lincom LINCOM 3 data 2 3 data 1 0 data 10 4\ndata RAW UINT8 1\n";
   unsigned char c = 0;
   unsigned char data_data[256];
   int fd, n, error, r = 0;
   DIRFILE *D;
 
+  rmdirfile();
   mkdir(filedir, 0777);
 
   for (fd = 0; fd < 256; ++fd)
diff --git a/test/get_lincom_noin.c b/test/get_lincom_noin.c
index 0738bd7..8315f4e 100644
--- a/test/get_lincom_noin.c
+++ b/test/get_lincom_noin.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Attempt to read LINCOM1 */
 #include "test.h"
 
@@ -10,13 +30,14 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* format_data = "lincom LINCOM 1 data 2 3\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *format_data = "lincom LINCOM 1 data 2 3\n";
   unsigned char c = 0;
   int fd, n, error, r = 0;
   DIRFILE *D;
 
+  rmdirfile();
   mkdir(filedir, 0777);
 
   fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
diff --git a/test/get_lincom_non.c b/test/get_lincom_non.c
index a5c8e00..e6bcaab 100644
--- a/test/get_lincom_non.c
+++ b/test/get_lincom_non.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2009-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Attempt to read LINCOM */
 #include "test.h"
 
@@ -10,15 +30,16 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* data = __TEST__ "dirfile/data";
-  const char* format_data = "lincom LINCOM data 2 3 data 1 0\ndata RAW UINT8 1\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *data = "dirfile/data";
+  const char *format_data = "lincom LINCOM data 2 3 data 1 0\ndata RAW UINT8 1\n";
   unsigned char c = 0;
   unsigned char data_data[256];
   int fd, n, error, r = 0;
   DIRFILE *D;
 
+  rmdirfile();
   mkdir(filedir, 0777);
 
   for (fd = 0; fd < 256; ++fd)
diff --git a/test/get_lincom_null.c b/test/get_lincom_null.c
new file mode 100644
index 0000000..9e1f422
--- /dev/null
+++ b/test/get_lincom_null.c
@@ -0,0 +1,68 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+#include "test.h"
+
+#include <stdlib.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <string.h>
+#include <errno.h>
+
+int main(void)
+{
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *data = "dirfile/data";
+  const char *format_data = "lincom LINCOM 2 data 2 3 data 1 0\ndata RAW UINT8 1\n";
+  unsigned char data_data[256];
+  int fd, n, error, r = 0;
+  DIRFILE *D;
+
+  rmdirfile();
+  mkdir(filedir, 0777);
+
+  for (fd = 0; fd < 256; ++fd)
+    data_data[fd] = (unsigned char)fd;
+
+  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
+  write(fd, format_data, strlen(format_data));
+  close(fd);
+
+  fd = open(data, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
+  write(fd, data_data, 256);
+  close(fd);
+
+  D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
+  n = gd_getdata(D, "lincom", 5, 0, 10, 0, GD_NULL, NULL);
+  error = gd_error(D);
+
+  gd_close(D);
+
+  unlink(data);
+  unlink(format);
+  rmdir(filedir);
+
+  CHECKI(error, 0);
+  CHECKI(n, 10);
+
+  return r;
+}
diff --git a/test/get_lincom_spf.c b/test/get_lincom_spf.c
new file mode 100644
index 0000000..1544870
--- /dev/null
+++ b/test/get_lincom_spf.c
@@ -0,0 +1,82 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+/* Attempt to read LINCOM */
+#include "test.h"
+
+#include <stdlib.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <string.h>
+#include <errno.h>
+
+int main(void)
+{
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *data = "dirfile/data";
+  const char *cata = "dirfile/cata";
+  const char *format_data = "lincom LINCOM 2 data 2 3 cata 1 0\n"
+    "data RAW UINT8 2\n"
+    "cata RAW UINT8 3\n";
+  unsigned char c[10];
+  unsigned char data_data[256];
+  int fd, n, error, r = 0;
+  DIRFILE *D;
+
+  memset(c, 0, 10);
+
+  rmdirfile();
+  mkdir(filedir, 0777);
+
+  for (fd = 0; fd < 256; ++fd)
+    data_data[fd] = (unsigned char)fd;
+
+  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
+  write(fd, format_data, strlen(format_data));
+  close(fd);
+
+  fd = open(data, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
+  write(fd, data_data, 256);
+  close(fd);
+
+  fd = open(cata, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
+  write(fd, data_data, 256);
+  close(fd);
+
+  D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
+  n = gd_getdata(D, "lincom", 5, 0, 5, 0, GD_UINT8, &c);
+  error = gd_error(D);
+
+  gd_close(D);
+
+  unlink(cata);
+  unlink(data);
+  unlink(format);
+  rmdir(filedir);
+
+  CHECKI(error, 0);
+  CHECKI(n, 10);
+  for (n = 0; n < 10; ++n)
+    CHECKUi(n, c[n], 38 + n * 7 / 2);
+
+  return r;
+}
diff --git a/test/get_linterp.c b/test/get_linterp.c
index b16d58f..f7a9a1a 100644
--- a/test/get_linterp.c
+++ b/test/get_linterp.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Attempt to read LINTERP */
 #include "test.h"
 
@@ -11,17 +31,18 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* data = __TEST__ "dirfile/data";
-  const char* table = __TEST__ "dirfile/table";
-  const char* format_data = "linterp LINTERP data ./table\ndata RAW UINT8 1\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *data = "dirfile/data";
+  const char *table = "dirfile/table";
+  const char *format_data = "linterp LINTERP data ./table\ndata RAW UINT8 1\n";
   unsigned char c = 0;
   unsigned char data_data[64];
   int fd, i, n, error, r = 0;
   DIRFILE *D;
   FILE *t;
 
+  rmdirfile();
   mkdir(filedir, 0777);
 
   for (fd = 0; fd < 64; ++fd)
diff --git a/test/get_linterp_noin.c b/test/get_linterp_noin.c
index f8f0ba8..c291b8d 100644
--- a/test/get_linterp_noin.c
+++ b/test/get_linterp_noin.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Attempt to read LINTERP */
 #include "test.h"
 
@@ -11,15 +31,16 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* table = __TEST__ "dirfile/table";
-  const char* format_data = "linterp LINTERP data ./table\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *table = "dirfile/table";
+  const char *format_data = "linterp LINTERP data ./table\n";
   unsigned char c = 0;
   int fd, i, n, error, r = 0;
   DIRFILE *D;
   FILE *t;
 
+  rmdirfile();
   mkdir(filedir, 0777);
 
   fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
diff --git a/test/get_linterp_notab.c b/test/get_linterp_notab.c
index 18067d0..86b7733 100644
--- a/test/get_linterp_notab.c
+++ b/test/get_linterp_notab.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Attempt to read LINTERP */
 #include "test.h"
 
@@ -11,15 +31,16 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* data = __TEST__ "dirfile/data";
-  const char* format_data = "linterp LINTERP data ./table\ndata RAW UINT8 1\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *data = "dirfile/data";
+  const char *format_data = "linterp LINTERP data ./table\ndata RAW UINT8 1\n";
   unsigned char c = 0;
   unsigned char data_data[64];
   int fd, n1, error1, n2, error2, r = 0;
   DIRFILE *D;
 
+  rmdirfile();
   mkdir(filedir, 0777);
 
   for (fd = 0; fd < 64; ++fd)
diff --git a/test/get_linterp_sort.c b/test/get_linterp_sort.c
index 2e1a26e..a07a1e5 100644
--- a/test/get_linterp_sort.c
+++ b/test/get_linterp_sort.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2010-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Attempt to read LINTERP */
 #include "test.h"
 
@@ -11,17 +31,18 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* data = __TEST__ "dirfile/data";
-  const char* table = __TEST__ "dirfile/table";
-  const char* format_data = "linterp LINTERP data ./table\ndata RAW UINT8 1\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *data = "dirfile/data";
+  const char *table = "dirfile/table";
+  const char *format_data = "linterp LINTERP data ./table\ndata RAW UINT8 1\n";
   unsigned char c = 0;
   unsigned char data_data[64];
   int fd, n, error, r = 0;
   DIRFILE *D;
   FILE *t;
 
+  rmdirfile();
   mkdir(filedir, 0777);
 
   for (fd = 0; fd < 64; ++fd)
diff --git a/test/get_mplex.c b/test/get_mplex.c
new file mode 100644
index 0000000..c5638af
--- /dev/null
+++ b/test/get_mplex.c
@@ -0,0 +1,76 @@
+/* Copyright (C) 2012 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+#include "test.h"
+
+int main(void)
+{
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *data = "dirfile/data";
+  const char *count = "dirfile/count";
+  const char *format_data =
+    "mplex MPLEX data count 1 3\n"
+    "count RAW UINT8 8\n"
+    "data RAW UINT8 8\n";
+  unsigned char c[8];
+  unsigned char data_data[256];
+  int fd, n, i, error, r = 0;
+  DIRFILE *D;
+
+  rmdirfile();
+  mkdir(filedir, 0777);
+
+  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
+  write(fd, format_data, strlen(format_data));
+  close(fd);
+
+  for (fd = 0; fd < 256; ++fd)
+    data_data[fd] = (unsigned char)fd;
+
+  fd = open(data, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
+  write(fd, data_data, 256);
+  close(fd);
+
+  for (fd = 0; fd < 256; ++fd)
+    data_data[fd] %= 3;
+
+  fd = open(count, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
+  write(fd, data_data, 256);
+  close(fd);
+
+  D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
+  n = gd_getdata(D, "mplex", 5, 0, 1, 0, GD_UINT8, &c);
+  error = gd_error(D);
+
+  gd_close(D);
+
+  unlink(count);
+  unlink(data);
+  unlink(format);
+  rmdir(filedir);
+
+  CHECKI(error, 0);
+  CHECKI(n, 8);
+  for (i = 0; i < 8; ++i)
+    CHECKIi(i, c[i], 40 + 3 * (i / 3));
+
+  return r;
+}
diff --git a/test/get_mplex_bof.c b/test/get_mplex_bof.c
new file mode 100644
index 0000000..1fd7fd2
--- /dev/null
+++ b/test/get_mplex_bof.c
@@ -0,0 +1,76 @@
+/* Copyright (C) 2012 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+#include "test.h"
+
+int main(void)
+{
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *data = "dirfile/data";
+  const char *count = "dirfile/count";
+  const char *format_data =
+    "mplex MPLEX data count 2 3\n"
+    "count RAW UINT8 8\n"
+    "data RAW UINT8 8\n";
+  unsigned char c[8];
+  unsigned char data_data[256];
+  int fd, n, i, error, r = 0;
+  DIRFILE *D;
+
+  rmdirfile();
+  mkdir(filedir, 0777);
+
+  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
+  write(fd, format_data, strlen(format_data));
+  close(fd);
+
+  for (fd = 0; fd < 256; ++fd)
+    data_data[fd] = (unsigned char)fd;
+
+  fd = open(data, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
+  write(fd, data_data, 256);
+  close(fd);
+
+  for (fd = 0; fd < 256; ++fd)
+    data_data[fd] %= 3;
+
+  fd = open(count, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
+  write(fd, data_data, 256);
+  close(fd);
+
+  D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
+  n = gd_getdata(D, "mplex", 0, 0, 1, 0, GD_UINT8, &c);
+  error = gd_error(D);
+
+  gd_close(D);
+
+  unlink(count);
+  unlink(data);
+  unlink(format);
+  rmdir(filedir);
+
+  CHECKI(error, 0);
+  CHECKI(n, 8);
+  for (i = 0; i < 8; ++i)
+    CHECKIi(i, c[i], (i < 2) ? 0 : 3 * ((i + 1) / 3) - 1);
+
+  return r;
+}
diff --git a/test/get_mplex_lb.c b/test/get_mplex_lb.c
new file mode 100644
index 0000000..b4ebdfe
--- /dev/null
+++ b/test/get_mplex_lb.c
@@ -0,0 +1,76 @@
+/* Copyright (C) 2012 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+#include "test.h"
+
+int main(void)
+{
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *data = "dirfile/data";
+  const char *count = "dirfile/count";
+  const char *format_data =
+    "mplex MPLEX data count 2 3\n"
+    "count RAW UINT8 8\n"
+    "data RAW UINT8 8\n";
+  unsigned char c[8];
+  unsigned char data_data[256];
+  int fd, n, i, error, r = 0;
+  DIRFILE *D;
+
+  rmdirfile();
+  mkdir(filedir, 0777);
+
+  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
+  write(fd, format_data, strlen(format_data));
+  close(fd);
+
+  for (fd = 0; fd < 256; ++fd)
+    data_data[fd] = (unsigned char)fd;
+
+  fd = open(data, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
+  write(fd, data_data, 256);
+  close(fd);
+
+  for (fd = 0; fd < 256; ++fd)
+    data_data[fd] %= 3;
+
+  fd = open(count, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
+  write(fd, data_data, 256);
+  close(fd);
+
+  D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
+  n = gd_getdata(D, "mplex", 5, 0, 1, 0, GD_UINT8, &c);
+  error = gd_error(D);
+
+  gd_close(D);
+
+  unlink(count);
+  unlink(data);
+  unlink(format);
+  rmdir(filedir);
+
+  CHECKI(error, 0);
+  CHECKI(n, 8);
+  for (i = 0; i < 8; ++i)
+    CHECKIi(i, c[i], 38 + 3 * ((i + 2) / 3));
+
+  return r;
+}
diff --git a/test/get_mplex_lball.c b/test/get_mplex_lball.c
new file mode 100644
index 0000000..74768a2
--- /dev/null
+++ b/test/get_mplex_lball.c
@@ -0,0 +1,81 @@
+/* Copyright (C) 2012 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+#include "test.h"
+
+int main(void)
+{
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *data = "dirfile/data";
+  const char *count = "dirfile/count";
+  const char *format_data =
+    "mplex MPLEX data count 7 8\n"
+    "count RAW UINT8 8\n"
+    "data RAW UINT8 8\n";
+  unsigned char c[8];
+  unsigned char data_data[256];
+  int fd, n, i, e1, e2, r = 0;
+  DIRFILE *D;
+
+  rmdirfile();
+  mkdir(filedir, 0777);
+
+  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
+  write(fd, format_data, strlen(format_data));
+  close(fd);
+
+  for (fd = 0; fd < 256; ++fd)
+    data_data[fd] = (unsigned char)fd;
+  data_data[0] = 111;
+
+  fd = open(data, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
+  write(fd, data_data, 256);
+  close(fd);
+
+  for (fd = 0; fd < 256; ++fd)
+    data_data[fd] %= 3;
+  data_data[0] = 7;
+
+  fd = open(count, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
+  write(fd, data_data, 256);
+  close(fd);
+
+  D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
+  gd_mplex_lookback(D, GD_LOOKBACK_ALL);
+  e1 = gd_error(D);
+  n = gd_getdata(D, "mplex", 12, 0, 1, 0, GD_UINT8, &c);
+  e2 = gd_error(D);
+
+  gd_close(D);
+
+  unlink(count);
+  unlink(data);
+  unlink(format);
+  rmdir(filedir);
+
+  CHECKI(e1, 0);
+  CHECKI(e2, 0);
+  CHECKI(n, 8);
+  for (i = 0; i < 8; ++i)
+    CHECKIi(i, c[i], 111);
+
+  return r;
+}
diff --git a/test/get_mplex_nolb.c b/test/get_mplex_nolb.c
new file mode 100644
index 0000000..f914e51
--- /dev/null
+++ b/test/get_mplex_nolb.c
@@ -0,0 +1,79 @@
+/* Copyright (C) 2012 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+#include "test.h"
+
+int main(void)
+{
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *data = "dirfile/data";
+  const char *count = "dirfile/count";
+  const char *format_data =
+    "mplex MPLEX data count 2 3\n"
+    "count RAW UINT8 8\n"
+    "data RAW UINT8 8\n";
+  unsigned char c[8];
+  unsigned char data_data[256];
+  int fd, n, i, e1, e2, r = 0;
+  DIRFILE *D;
+
+  rmdirfile();
+  mkdir(filedir, 0777);
+
+  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
+  write(fd, format_data, strlen(format_data));
+  close(fd);
+
+  for (fd = 0; fd < 256; ++fd)
+    data_data[fd] = (unsigned char)fd;
+
+  fd = open(data, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
+  write(fd, data_data, 256);
+  close(fd);
+
+  for (fd = 0; fd < 256; ++fd)
+    data_data[fd] %= 3;
+
+  fd = open(count, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
+  write(fd, data_data, 256);
+  close(fd);
+
+  D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
+  gd_mplex_lookback(D, 0);
+  e1 = gd_error(D);
+  n = gd_getdata(D, "mplex", 5, 0, 1, 0, GD_UINT8, &c);
+  e2 = gd_error(D);
+
+  gd_close(D);
+
+  unlink(count);
+  unlink(data);
+  unlink(format);
+  rmdir(filedir);
+
+  CHECKI(e1, 0);
+  CHECKI(e2, 0);
+  CHECKI(n, 8);
+  for (i = 0; i < 8; ++i)
+    CHECKIi(i, c[i], (i == 0) ? 0 : 38 + 3 * ((i + 2) / 3));
+
+  return r;
+}
diff --git a/test/get_multiply.c b/test/get_multiply.c
index 2cc73e8..fe312b2 100644
--- a/test/get_multiply.c
+++ b/test/get_multiply.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Attempt to read MULTIPLY */
 #include "test.h"
 
@@ -10,15 +30,16 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* data = __TEST__ "dirfile/data";
-  const char* format_data = "mult MULTIPLY data data\ndata RAW UINT8 1\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *data = "dirfile/data";
+  const char *format_data = "mult MULTIPLY data data\ndata RAW UINT8 1\n";
   unsigned char c = 0;
   unsigned char data_data[256];
   int fd, n, error, r = 0;
   DIRFILE *D;
 
+  rmdirfile();
   mkdir(filedir, 0777);
 
   for (fd = 0; fd < 256; ++fd)
diff --git a/test/get_multiply_noin.c b/test/get_multiply_noin.c
index 552e6b6..8753364 100644
--- a/test/get_multiply_noin.c
+++ b/test/get_multiply_noin.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Attempt to read MULTIPLY */
 #include "test.h"
 
@@ -10,15 +30,16 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* data = __TEST__ "dirfile/data";
-  const char* format_data = "mult MULTIPLY data data\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *data = "dirfile/data";
+  const char *format_data = "mult MULTIPLY data data\n";
   unsigned char c = 0;
   unsigned char data_data[256];
   int fd, n, error, r = 0;
   DIRFILE *D;
 
+  rmdirfile();
   mkdir(filedir, 0777);
 
   for (fd = 0; fd < 256; ++fd)
diff --git a/test/get_nonexistent.c b/test/get_nonexistent.c
index 9c9470a..a03eca1 100644
--- a/test/get_nonexistent.c
+++ b/test/get_nonexistent.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Attempt to read UINT8 */
 #include "test.h"
 
@@ -10,14 +30,15 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* format_data = "data RAW UINT8 1\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *format_data = "data RAW UINT8 1\n";
   unsigned char c[8];
   int fd, n, error, r = 0;
   DIRFILE *D;
 
   memset(c, 0, 8);
+  rmdirfile();
   mkdir(filedir, 0777);
 
   fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
diff --git a/test/get_null.c b/test/get_null.c
index 0e81128..e9d7796 100644
--- a/test/get_null.c
+++ b/test/get_null.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Attempt to read returning GD_NULL */
 #include "test.h"
 
@@ -10,14 +30,15 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* data = __TEST__ "dirfile/data";
-  const char* format_data = "data RAW UINT8 8\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *data = "dirfile/data";
+  const char *format_data = "data RAW UINT8 8\n";
   unsigned char data_data[256];
   int fd, n, error, r = 0;
   DIRFILE *D;
 
+  rmdirfile();
   mkdir(filedir, 0777);
 
   for (fd = 0; fd < 256; ++fd)
diff --git a/test/get_off64.c b/test/get_off64.c
index 0dcb5d9..6bb1fc9 100644
--- a/test/get_off64.c
+++ b/test/get_off64.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Attempt to read UINT8 */
 #if (defined _FILE_OFFSET_BITS && _FILE_OFFSET_BITS == 64) || __MSVCRT__
 #  define SKIP_TEST
@@ -19,16 +39,17 @@ int main(void)
 #ifdef SKIP_TEST
   return 77;
 #else
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* data = __TEST__ "dirfile/data";
-  const char* format_data = "data RAW UINT8 8\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *data = "dirfile/data";
+  const char *format_data = "data RAW UINT8 8\n";
   unsigned char c[8];
   unsigned char data_data[256];
   int fd, i, n, error, r = 0;
   DIRFILE *D;
 
   memset(c, 0, 8);
+  rmdirfile();
   mkdir(filedir, 0777);
 
   for (fd = 0; fd < 256; ++fd)
diff --git a/test/get_phase.c b/test/get_phase.c
index 9a6406a..453707d 100644
--- a/test/get_phase.c
+++ b/test/get_phase.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Attempt to read PHASE */
 #include "test.h"
 
@@ -11,15 +31,16 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* data = __TEST__ "dirfile/data";
-  const char* format_data = "phase PHASE data -2\ndata RAW UINT8 1\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *data = "dirfile/data";
+  const char *format_data = "phase PHASE data -2\ndata RAW UINT8 1\n";
   unsigned char c = 0;
   unsigned char data_data[256];
   int fd, n, error, r = 0;
   DIRFILE *D;
 
+  rmdirfile();
   mkdir(filedir, 0777);
 
   for (fd = 0; fd < 256; ++fd)
@@ -43,18 +64,6 @@ int main(void)
   unlink(format);
   rmdir(filedir);
 
-  if (error) {
-    fprintf(stderr, "error=%i\n", error);
-    r = 1;
-  }
-  if (n != 1) {
-    fprintf(stderr, "n=%i\n", n);
-    r = 1;
-  }
-  if (c != 3) {
-    fprintf(stderr, "c=%i\n", c);
-    r = 1;
-  }
   CHECKI(error, 0);
   CHECKI(n, 1);
   CHECKI(c, 3);
diff --git a/test/get_phase_affix.c b/test/get_phase_affix.c
new file mode 100644
index 0000000..6b30a7d
--- /dev/null
+++ b/test/get_phase_affix.c
@@ -0,0 +1,73 @@
+/* Copyright (C) 2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+#include "test.h"
+
+int main(void)
+{
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *format1 = "dirfile/format1";
+  const char *data = "dirfile/data";
+  const char *format_data = "/INCLUDE format1 pre post\n";
+  const char *format1_data =
+    "shift CONST INT32 -2\n"
+    "phase PHASE data shift\n"
+    "data RAW UINT8 1\n";
+  unsigned char c = 0;
+  unsigned char data_data[256];
+  int fd, n, error, r = 0;
+  DIRFILE *D;
+
+  rmdirfile();
+  mkdir(filedir, 0777);
+
+  for (fd = 0; fd < 256; ++fd)
+    data_data[fd] = (unsigned char)fd;
+
+  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
+  write(fd, format_data, strlen(format_data));
+  close(fd);
+
+  fd = open(format1, O_CREAT | O_EXCL | O_WRONLY, 0666);
+  write(fd, format1_data, strlen(format1_data));
+  close(fd);
+
+  fd = open(data, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
+  write(fd, data_data, 256);
+  close(fd);
+
+  D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
+  n = gd_getdata(D, "prephasepost", 5, 0, 1, 0, GD_UINT8, &c);
+  error = gd_error(D);
+
+  gd_close(D);
+
+  unlink(data);
+  unlink(format1);
+  unlink(format);
+  rmdir(filedir);
+
+  CHECKI(error, 0);
+  CHECKI(n, 1);
+  CHECKI(c, 3);
+
+  return r;
+}
diff --git a/test/get_polynom.c b/test/get_polynom.c
index 48c265c..84bb6f7 100644
--- a/test/get_polynom.c
+++ b/test/get_polynom.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2009-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Attempt to read POLYNOM */
 #include "test.h"
 
@@ -11,15 +31,16 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* data = __TEST__ "dirfile/data";
-  const char* format_data = "polynom POLYNOM data 3 2 1\ndata RAW UINT8 1\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *data = "dirfile/data";
+  const char *format_data = "polynom POLYNOM data 3 2 1\ndata RAW UINT8 1\n";
   unsigned char c = 0;
   unsigned char data_data[256];
   int fd, n, error, r = 0;
   DIRFILE *D;
 
+  rmdirfile();
   mkdir(filedir, 0777);
 
   for (fd = 0; fd < 256; ++fd)
diff --git a/test/get_polynom_noin.c b/test/get_polynom_noin.c
index ee9c729..05b74ff 100644
--- a/test/get_polynom_noin.c
+++ b/test/get_polynom_noin.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2009-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Attempt to read POLYNOM */
 #include "test.h"
 
@@ -10,13 +30,14 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* format_data = "polynom POLYNOM data 2 3\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *format_data = "polynom POLYNOM data 2 3\n";
   unsigned char c = 0;
   int fd, n, error, r = 0;
   DIRFILE *D;
 
+  rmdirfile();
   mkdir(filedir, 0777);
 
   fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
diff --git a/test/get_recip.c b/test/get_recip.c
index 0db7e06..5815f0c 100644
--- a/test/get_recip.c
+++ b/test/get_recip.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2010-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Attempt to read DIVIDE */
 #include "test.h"
 
@@ -10,10 +30,10 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* data = __TEST__ "dirfile/data";
-  const char* format_data =
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *data = "dirfile/data";
+  const char *format_data =
     "div RECIP data 2.\n"
     "data RAW UINT8 1\n";
   double c = 0;
@@ -21,6 +41,7 @@ int main(void)
   int fd, n, error, r = 0;
   DIRFILE *D;
 
+  rmdirfile();
   mkdir(filedir, 0777);
 
   for (fd = 0; fd < 256; ++fd)
diff --git a/test/get_recip_const.c b/test/get_recip_const.c
index b9b4b38..d8eb64c 100644
--- a/test/get_recip_const.c
+++ b/test/get_recip_const.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2010-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Attempt to read DIVIDE */
 #include "test.h"
 
@@ -10,10 +30,10 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* data = __TEST__ "dirfile/data";
-  const char* format_data =
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *data = "dirfile/data";
+  const char *format_data =
     "div RECIP data const\n"
     "const CONST FLOAT64 2.\n"
     "data RAW UINT8 1\n";
@@ -22,6 +42,7 @@ int main(void)
   int fd, n, error, r = 0;
   DIRFILE *D;
 
+  rmdirfile();
   mkdir(filedir, 0777);
 
   for (fd = 0; fd < 256; ++fd)
diff --git a/test/get_recurse.c b/test/get_recurse.c
index cdaa5af..51adc9d 100644
--- a/test/get_recurse.c
+++ b/test/get_recurse.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Attempting to resove a recursively defined field should fail cleanly */
 #include "test.h"
 
@@ -10,15 +30,16 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* format_data =
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *format_data =
     "in1 RAW UINT8 11\n"
     "lincom LINCOM 2 lincom 1 0 in1 1 0\n";
   unsigned char c[8];
   int fd, n, error, r = 0;
   DIRFILE *D;
 
+  rmdirfile();
   mkdir(filedir, 0777);
 
   fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
diff --git a/test/get_rofs.c b/test/get_rofs.c
new file mode 100644
index 0000000..90a2287
--- /dev/null
+++ b/test/get_rofs.c
@@ -0,0 +1,83 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+/* Should be able to read from a R/O dirfile */
+#include "test.h"
+
+#include <stdlib.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <string.h>
+#include <errno.h>
+
+int main(void)
+{
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *data = "dirfile/data";
+  const char *format_data = "data RAW UINT8 8\n";
+  unsigned char c[8];
+  unsigned char data_data[256];
+  int i, fd, n, error, r = 0;
+  DIRFILE *D;
+
+  rmdirfile();
+  mkdir(filedir, 0777);
+
+  for (fd = 0; fd < 256; ++fd)
+    data_data[fd] = (unsigned char)fd;
+
+  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
+  write(fd, format_data, strlen(format_data));
+  close(fd);
+
+  fd = open(data, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
+  write(fd, data_data, 256);
+  close(fd);
+  chmod(data, 0555);
+
+  /* ensure filesystem honours read-onlyness */
+  if ((fd = open(data, O_RDWR)) >= 0 || errno != EACCES) {
+    if (fd >= 0)
+      close(fd);
+    unlink(format);
+    unlink(data);
+    rmdir(filedir);
+    return 77;
+  }
+
+  D = gd_open(filedir, GD_RDWR | GD_UNENCODED | GD_VERBOSE);
+  n = gd_getdata(D, "data", 5, 0, 1, 0, GD_UINT8, c);
+
+  error = gd_error(D);
+  gd_close(D);
+
+  unlink(data);
+  unlink(format);
+  rmdir(filedir);
+
+  CHECKI(error, 0);
+  CHECKI(n, 8);
+  for (i = 0; i < 8; ++i)
+    CHECKUi(i, c[i], 40 + i);
+
+  return r;
+}
diff --git a/test/get_sbit.c b/test/get_sbit.c
index cf2d41e..00a31ed 100644
--- a/test/get_sbit.c
+++ b/test/get_sbit.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2009-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Attempt to read SBIT */
 #include "test.h"
 
@@ -12,15 +32,16 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* data = __TEST__ "dirfile/data";
-  const char* format_data = "bit SBIT data 7 4\ndata RAW UINT16 1\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *data = "dirfile/data";
+  const char *format_data = "bit SBIT data 7 4\ndata RAW UINT16 1\n";
   int16_t c[10];
   uint16_t data_data[256];
   int fd, n, error, r = 0;
   DIRFILE *D;
 
+  rmdirfile();
   mkdir(filedir, 0777);
 
   for (fd = 0; fd < 256; ++fd)
diff --git a/test/get_sf.c b/test/get_sf.c
index 892f3d2..ade4922 100644
--- a/test/get_sf.c
+++ b/test/get_sf.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Attempt to read UINT8 */
 #include "test.h"
 
@@ -10,16 +30,17 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* data = __TEST__ "dirfile/data";
-  const char* format_data = "data RAW UINT8 8\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *data = "dirfile/data";
+  const char *format_data = "data RAW UINT8 8\n";
   unsigned char c[8];
   unsigned char data_data[256];
   int fd, i, n, error, r = 0;
   DIRFILE *D;
 
   memset(c, 0, 8);
+  rmdirfile();
   mkdir(filedir, 0777);
 
   for (fd = 0; fd < 256; ++fd)
diff --git a/test/get_ss.c b/test/get_ss.c
index a51863e..0d7cd83 100644
--- a/test/get_ss.c
+++ b/test/get_ss.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Attempt to read UINT8 */
 #include "test.h"
 
@@ -10,16 +30,17 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* data = __TEST__ "dirfile/data";
-  const char* format_data = "data RAW UINT8 8\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *data = "dirfile/data";
+  const char *format_data = "data RAW UINT8 8\n";
   unsigned char c[8];
   unsigned char data_data[256];
   int fd, i, n, error, r = 0;
   DIRFILE *D;
 
   memset(c, 0, 8);
+  rmdirfile();
   mkdir(filedir, 0777);
 
   for (fd = 0; fd < 256; ++fd)
diff --git a/test/get_type.c b/test/get_type.c
index 7d59814..7a17bcc 100644
--- a/test/get_type.c
+++ b/test/get_type.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Attempt to read UINT8 */
 #include "test.h"
 
@@ -10,16 +30,17 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* data = __TEST__ "dirfile/data";
-  const char* format_data = "data RAW UINT8 8\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *data = "dirfile/data";
+  const char *format_data = "data RAW UINT8 8\n";
   unsigned char c[8];
   unsigned char data_data[256];
   int fd, n, error, r = 0;
   DIRFILE *D;
 
   memset(c, 0, 8);
+  rmdirfile();
   mkdir(filedir, 0777);
 
   for (fd = 0; fd < 256; ++fd)
diff --git a/test/get_uint16.c b/test/get_uint16.c
index 1e0c8b5..f2caac8 100644
--- a/test/get_uint16.c
+++ b/test/get_uint16.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Attempt to read UINT16 */
 #include "test.h"
 
@@ -11,16 +31,17 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* data = __TEST__ "dirfile/data";
-  const char* format_data = "data RAW UINT16 8\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *data = "dirfile/data";
+  const char *format_data = "data RAW UINT16 8\n";
   uint16_t c[8], i;
   uint16_t data_data[128];
   int fd, n, error, r = 0;
   DIRFILE *D;
 
   memset(c, 0, 8);
+  rmdirfile();
   mkdir(filedir, 0777);
 
   for (fd = 0; fd < 128; ++fd)
diff --git a/test/get_uint32.c b/test/get_uint32.c
index 6078890..d285246 100644
--- a/test/get_uint32.c
+++ b/test/get_uint32.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Attempt to read UINT32 */
 #include "test.h"
 
@@ -11,16 +31,17 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* data = __TEST__ "dirfile/data";
-  const char* format_data = "data RAW UINT32 8\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *data = "dirfile/data";
+  const char *format_data = "data RAW UINT32 8\n";
   uint32_t c[8], i;
   uint32_t data_data[128];
   int fd, n, error, r = 0;
   DIRFILE *D;
 
   memset(c, 0, 8);
+  rmdirfile();
   mkdir(filedir, 0777);
 
   for (fd = 0; fd < 128; ++fd)
diff --git a/test/get_uint64.c b/test/get_uint64.c
index 14b9c3b..deb544c 100644
--- a/test/get_uint64.c
+++ b/test/get_uint64.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Attempt to read UINT64 */
 #include "test.h"
 
@@ -11,20 +31,21 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* data = __TEST__ "dirfile/data";
-  const char* format_data = "data RAW UINT64 8\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *data = "dirfile/data";
+  const char *format_data = "data RAW UINT64 8\n";
   uint64_t c[8];
   uint64_t data_data[128];
   int fd, i, n, error, r = 0;
   DIRFILE *D;
 
   memset(c, 0, 8);
+  rmdirfile();
   mkdir(filedir, 0777);
 
   for (fd = 0; fd < 128; ++fd)
-    data_data[fd] = fd * (0x0200000000000001LLU);
+    data_data[fd] = fd * (0x0200000000000001);
 
   fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
   write(fd, format_data, strlen(format_data));
@@ -41,7 +62,7 @@ int main(void)
   CHECKI(error, 0);
   CHECKI(n, 8);
   for (i = 0; i < 8; ++i)
-    CHECKUi(i,c[i],0x5000000000000028LLU + i * 0x0200000000000001LLU);
+    CHECKUi(i,c[i],0x5000000000000028U + i * 0x0200000000000001U);
 
   gd_close(D);
 
diff --git a/test/get_window.c b/test/get_window.c
new file mode 100644
index 0000000..19d44cb
--- /dev/null
+++ b/test/get_window.c
@@ -0,0 +1,73 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+/* Attempt to read WINDOW */
+#include "test.h"
+
+#include <stdlib.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <string.h>
+#include <errno.h>
+#include <stdio.h>
+
+int main(void)
+{
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *data = "dirfile/data";
+  const char *format_data = "window WINDOW data data EQ 44\ndata RAW UINT8 8\n";
+  unsigned char c[8];
+  unsigned char data_data[256];
+  int fd, n, i, error, r = 0;
+  DIRFILE *D;
+
+  rmdirfile();
+  mkdir(filedir, 0777);
+
+  for (fd = 0; fd < 256; ++fd)
+    data_data[fd] = (unsigned char)fd;
+
+  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
+  write(fd, format_data, strlen(format_data));
+  close(fd);
+
+  fd = open(data, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
+  write(fd, data_data, 256);
+  close(fd);
+
+  D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
+  n = gd_getdata(D, "window", 5, 0, 1, 0, GD_UINT8, &c);
+  error = gd_error(D);
+
+  gd_close(D);
+
+  unlink(data);
+  unlink(format);
+  rmdir(filedir);
+
+  CHECKI(error, 0);
+  CHECKI(n, 8);
+  for (i = 0; i < 8; ++i)
+    CHECKIi(i, c[i], (i == 4) ? 40 + i : 0);
+
+  return r;
+}
diff --git a/test/get_window_clr.c b/test/get_window_clr.c
new file mode 100644
index 0000000..aeda830
--- /dev/null
+++ b/test/get_window_clr.c
@@ -0,0 +1,73 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+/* Attempt to read WINDOW */
+#include "test.h"
+
+#include <stdlib.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <string.h>
+#include <errno.h>
+#include <stdio.h>
+
+int main(void)
+{
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *data = "dirfile/data";
+  const char *format_data = "window WINDOW data data CLR 0x2\ndata RAW UINT8 8\n";
+  unsigned char c[8];
+  unsigned char data_data[256];
+  int fd, n, i, error, r = 0;
+  DIRFILE *D;
+
+  rmdirfile();
+  mkdir(filedir, 0777);
+
+  for (fd = 0; fd < 256; ++fd)
+    data_data[fd] = (unsigned char)fd;
+
+  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
+  write(fd, format_data, strlen(format_data));
+  close(fd);
+
+  fd = open(data, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
+  write(fd, data_data, 256);
+  close(fd);
+
+  D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
+  n = gd_getdata(D, "window", 5, 0, 1, 0, GD_UINT8, &c);
+  error = gd_error(D);
+
+  gd_close(D);
+
+  unlink(data);
+  unlink(format);
+  rmdir(filedir);
+
+  CHECKI(error, 0);
+  CHECKI(n, 8);
+  for (i = 0; i < 8; ++i)
+    CHECKIi(i, c[i], (~i & 2) ? 40 + i : 0);
+
+  return r;
+}
diff --git a/test/get_window_ge.c b/test/get_window_ge.c
new file mode 100644
index 0000000..cf2e637
--- /dev/null
+++ b/test/get_window_ge.c
@@ -0,0 +1,73 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+/* Attempt to read WINDOW */
+#include "test.h"
+
+#include <stdlib.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <string.h>
+#include <errno.h>
+#include <stdio.h>
+
+int main(void)
+{
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *data = "dirfile/data";
+  const char *format_data = "window WINDOW data data GE 44\ndata RAW UINT8 8\n";
+  unsigned char c[8];
+  unsigned char data_data[256];
+  int fd, n, i, error, r = 0;
+  DIRFILE *D;
+
+  rmdirfile();
+  mkdir(filedir, 0777);
+
+  for (fd = 0; fd < 256; ++fd)
+    data_data[fd] = (unsigned char)fd;
+
+  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
+  write(fd, format_data, strlen(format_data));
+  close(fd);
+
+  fd = open(data, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
+  write(fd, data_data, 256);
+  close(fd);
+
+  D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
+  n = gd_getdata(D, "window", 5, 0, 1, 0, GD_UINT8, &c);
+  error = gd_error(D);
+
+  gd_close(D);
+
+  unlink(data);
+  unlink(format);
+  rmdir(filedir);
+
+  CHECKI(error, 0);
+  CHECKI(n, 8);
+  for (i = 0; i < 8; ++i)
+    CHECKIi(i, c[i], (i >= 4) ? 40 + i : 0);
+
+  return r;
+}
diff --git a/test/get_window_gt.c b/test/get_window_gt.c
new file mode 100644
index 0000000..23198db
--- /dev/null
+++ b/test/get_window_gt.c
@@ -0,0 +1,73 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+/* Attempt to read WINDOW */
+#include "test.h"
+
+#include <stdlib.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <string.h>
+#include <errno.h>
+#include <stdio.h>
+
+int main(void)
+{
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *data = "dirfile/data";
+  const char *format_data = "window WINDOW data data GT 44\ndata RAW UINT8 8\n";
+  unsigned char c[8];
+  unsigned char data_data[256];
+  int fd, n, i, error, r = 0;
+  DIRFILE *D;
+
+  rmdirfile();
+  mkdir(filedir, 0777);
+
+  for (fd = 0; fd < 256; ++fd)
+    data_data[fd] = (unsigned char)fd;
+
+  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
+  write(fd, format_data, strlen(format_data));
+  close(fd);
+
+  fd = open(data, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
+  write(fd, data_data, 256);
+  close(fd);
+
+  D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
+  n = gd_getdata(D, "window", 5, 0, 1, 0, GD_UINT8, &c);
+  error = gd_error(D);
+
+  gd_close(D);
+
+  unlink(data);
+  unlink(format);
+  rmdir(filedir);
+
+  CHECKI(error, 0);
+  CHECKI(n, 8);
+  for (i = 0; i < 8; ++i)
+    CHECKIi(i, c[i], (i > 4) ? 40 + i : 0);
+
+  return r;
+}
diff --git a/test/get_window_le.c b/test/get_window_le.c
new file mode 100644
index 0000000..61ce7a7
--- /dev/null
+++ b/test/get_window_le.c
@@ -0,0 +1,73 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+/* Attempt to read WINDOW */
+#include "test.h"
+
+#include <stdlib.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <string.h>
+#include <errno.h>
+#include <stdio.h>
+
+int main(void)
+{
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *data = "dirfile/data";
+  const char *format_data = "window WINDOW data data LE 44\ndata RAW UINT8 8\n";
+  unsigned char c[8];
+  unsigned char data_data[256];
+  int fd, n, i, error, r = 0;
+  DIRFILE *D;
+
+  rmdirfile();
+  mkdir(filedir, 0777);
+
+  for (fd = 0; fd < 256; ++fd)
+    data_data[fd] = (unsigned char)fd;
+
+  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
+  write(fd, format_data, strlen(format_data));
+  close(fd);
+
+  fd = open(data, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
+  write(fd, data_data, 256);
+  close(fd);
+
+  D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
+  n = gd_getdata(D, "window", 5, 0, 1, 0, GD_UINT8, &c);
+  error = gd_error(D);
+
+  gd_close(D);
+
+  unlink(data);
+  unlink(format);
+  rmdir(filedir);
+
+  CHECKI(error, 0);
+  CHECKI(n, 8);
+  for (i = 0; i < 8; ++i)
+    CHECKIi(i, c[i], (i <= 4) ? 40 + i : 0);
+
+  return r;
+}
diff --git a/test/get_window_lt.c b/test/get_window_lt.c
new file mode 100644
index 0000000..54b3c6c
--- /dev/null
+++ b/test/get_window_lt.c
@@ -0,0 +1,73 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+/* Attempt to read WINDOW */
+#include "test.h"
+
+#include <stdlib.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <string.h>
+#include <errno.h>
+#include <stdio.h>
+
+int main(void)
+{
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *data = "dirfile/data";
+  const char *format_data = "window WINDOW data data LT 44\ndata RAW UINT8 8\n";
+  unsigned char c[8];
+  unsigned char data_data[256];
+  int fd, n, i, error, r = 0;
+  DIRFILE *D;
+
+  rmdirfile();
+  mkdir(filedir, 0777);
+
+  for (fd = 0; fd < 256; ++fd)
+    data_data[fd] = (unsigned char)fd;
+
+  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
+  write(fd, format_data, strlen(format_data));
+  close(fd);
+
+  fd = open(data, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
+  write(fd, data_data, 256);
+  close(fd);
+
+  D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
+  n = gd_getdata(D, "window", 5, 0, 1, 0, GD_UINT8, &c);
+  error = gd_error(D);
+
+  gd_close(D);
+
+  unlink(data);
+  unlink(format);
+  rmdir(filedir);
+
+  CHECKI(error, 0);
+  CHECKI(n, 8);
+  for (i = 0; i < 8; ++i)
+    CHECKIi(i, c[i], (i < 4) ? 40 + i : 0);
+
+  return r;
+}
diff --git a/test/get_window_ne.c b/test/get_window_ne.c
new file mode 100644
index 0000000..3cc6938
--- /dev/null
+++ b/test/get_window_ne.c
@@ -0,0 +1,73 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+/* Attempt to read WINDOW */
+#include "test.h"
+
+#include <stdlib.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <string.h>
+#include <errno.h>
+#include <stdio.h>
+
+int main(void)
+{
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *data = "dirfile/data";
+  const char *format_data = "window WINDOW data data NE 44\ndata RAW UINT8 8\n";
+  unsigned char c[8];
+  unsigned char data_data[256];
+  int fd, n, i, error, r = 0;
+  DIRFILE *D;
+
+  rmdirfile();
+  mkdir(filedir, 0777);
+
+  for (fd = 0; fd < 256; ++fd)
+    data_data[fd] = (unsigned char)fd;
+
+  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
+  write(fd, format_data, strlen(format_data));
+  close(fd);
+
+  fd = open(data, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
+  write(fd, data_data, 256);
+  close(fd);
+
+  D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
+  n = gd_getdata(D, "window", 5, 0, 1, 0, GD_UINT8, &c);
+  error = gd_error(D);
+
+  gd_close(D);
+
+  unlink(data);
+  unlink(format);
+  rmdir(filedir);
+
+  CHECKI(error, 0);
+  CHECKI(n, 8);
+  for (i = 0; i < 8; ++i)
+    CHECKIi(i, c[i], (i != 4) ? 40 + i : 0);
+
+  return r;
+}
diff --git a/test/get_window_set.c b/test/get_window_set.c
new file mode 100644
index 0000000..3d0de94
--- /dev/null
+++ b/test/get_window_set.c
@@ -0,0 +1,73 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+/* Attempt to read WINDOW */
+#include "test.h"
+
+#include <stdlib.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <string.h>
+#include <errno.h>
+#include <stdio.h>
+
+int main(void)
+{
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *data = "dirfile/data";
+  const char *format_data = "window WINDOW data data SET 2\ndata RAW UINT8 8\n";
+  unsigned char c[8];
+  unsigned char data_data[256];
+  int fd, n, i, error, r = 0;
+  DIRFILE *D;
+
+  rmdirfile();
+  mkdir(filedir, 0777);
+
+  for (fd = 0; fd < 256; ++fd)
+    data_data[fd] = (unsigned char)fd;
+
+  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
+  write(fd, format_data, strlen(format_data));
+  close(fd);
+
+  fd = open(data, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
+  write(fd, data_data, 256);
+  close(fd);
+
+  D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
+  n = gd_getdata(D, "window", 5, 0, 1, 0, GD_UINT8, &c);
+  error = gd_error(D);
+
+  gd_close(D);
+
+  unlink(data);
+  unlink(format);
+  rmdir(filedir);
+
+  CHECKI(error, 0);
+  CHECKI(n, 8);
+  for (i = 0; i < 8; ++i)
+    CHECKIi(i, c[i], (i & 2) ? 40 + i : 0);
+
+  return r;
+}
diff --git a/test/get_zero.c b/test/get_zero.c
index 571f56b..2f20b4f 100644
--- a/test/get_zero.c
+++ b/test/get_zero.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2009-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Attempt to read from before the BOF */
 #include "test.h"
 
@@ -11,16 +31,17 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* data = __TEST__ "dirfile/data";
-  const char* format_data = "/FRAMEOFFSET 100\ndata RAW UINT8 8\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *data = "dirfile/data";
+  const char *format_data = "/FRAMEOFFSET 100\ndata RAW UINT8 8\n";
   unsigned char c[8];
   unsigned char data_data[256];
   int fd, i, n, error, r = 0;
   DIRFILE *D;
 
   memset(c, 0, 8);
+  rmdirfile();
   mkdir(filedir, 0777);
 
   for (fd = 0; fd < 256; ++fd)
diff --git a/test/global_flags.c b/test/global_flags.c
new file mode 100644
index 0000000..4b109dd
--- /dev/null
+++ b/test/global_flags.c
@@ -0,0 +1,88 @@
+/* Copyright (C) :e2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+#include "test.h"
+
+#include <inttypes.h>
+#include <stdlib.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <string.h>
+#include <errno.h>
+#include <stdio.h>
+
+int main(void)
+{
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  int i, r = 0;
+  int n[7], e[7];
+  const int v[7] = {
+             0 | GD_PRETTY_PRINT,
+    GD_VERBOSE | GD_PRETTY_PRINT,
+    GD_VERBOSE | 0,
+             0 | GD_PRETTY_PRINT,
+    GD_VERBOSE | 0,
+             0 | GD_PRETTY_PRINT,
+    GD_VERBOSE | 0
+  };
+  DIRFILE *D;
+
+  rmdirfile();
+  mkdir(filedir, 0777);
+
+  close(open(format, O_CREAT | O_EXCL | O_WRONLY, 0666));
+
+  D = gd_open(filedir, GD_RDONLY | GD_PRETTY_PRINT);
+  n[0] = gd_flags(D, 0, 0);
+  e[0] = gd_error(D);
+
+  n[1] = gd_flags(D, GD_VERBOSE, 0);
+  e[1] = gd_error(D);
+
+  n[2] = gd_flags(D, 0, GD_PRETTY_PRINT);
+  e[2] = gd_error(D);
+
+  n[3] = gd_flags(D, GD_VERBOSE | GD_PRETTY_PRINT,
+      GD_VERBOSE | GD_PRETTY_PRINT);
+  e[3] = gd_error(D);
+
+  n[4] = gd_flags(D, GD_VERBOSE, GD_PRETTY_PRINT);
+  e[4] = gd_error(D);
+
+  n[5] = gd_flags(D, GD_VERBOSE | GD_PRETTY_PRINT, GD_VERBOSE);
+  e[5] = gd_error(D);
+
+  n[6] = gd_flags(D, GD_VERBOSE, GD_VERBOSE | GD_PRETTY_PRINT);
+  e[6] = gd_error(D);
+
+  gd_close(D);
+
+  unlink(format);
+  rmdir(filedir);
+
+  for (i = 0; i < 7; ++i) {
+    CHECKIi(i, e[i], 0);
+    CHECKXi(i, n[i], v[i]);
+  }
+
+  return r;
+}
diff --git a/test/global_name.c b/test/global_name.c
index 91f4250..cf0701a 100644
--- a/test/global_name.c
+++ b/test/global_name.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2012 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Global metadata check */
 #include "test.h"
 
@@ -12,13 +32,14 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* format_data = "data1 CONST UINT8 1\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *format_data = "data1 CONST UINT8 1\n";
   int fd, error, r = 0;
   DIRFILE *D;
   char *name;
 
+  rmdirfile();
   mkdir(filedir, 0777);
 
   fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
@@ -34,7 +55,7 @@ int main(void)
   rmdir(filedir);
 
   CHECKI(error, GD_E_OK);
-  CHECKS(name, filedir);
+  CHECKEOS(name, "dirfile");
   free(name);
 
   return r;
diff --git a/test/global_ref.c b/test/global_ref.c
index 6cf8817..bd4e461 100644
--- a/test/global_ref.c
+++ b/test/global_ref.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Global metadata check */
 #include "test.h"
 
@@ -12,13 +32,14 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* format_data = "data RAW UINT8 1\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *format_data = "data RAW UINT8 1\n";
   int fd, error, r = 0;
   char *ref;
   DIRFILE *D;
 
+  rmdirfile();
   mkdir(filedir, 0777);
 
   fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
diff --git a/test/global_ref_empty.c b/test/global_ref_empty.c
index 954b66d..7a7471b 100644
--- a/test/global_ref_empty.c
+++ b/test/global_ref_empty.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Global metadata check */
 #include "test.h"
 
@@ -12,13 +32,14 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* format_data = "data CONST UINT8 1\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *format_data = "data CONST UINT8 1\n";
   int fd, error, r = 0;
   const char *ref;
   DIRFILE *D;
 
+  rmdirfile();
   mkdir(filedir, 0777);
 
   fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
diff --git a/test/global_ref_set.c b/test/global_ref_set.c
index 85175eb..9c368f7 100644
--- a/test/global_ref_set.c
+++ b/test/global_ref_set.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Global metadata check */
 #include "test.h"
 
@@ -12,14 +32,15 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* format_data = "data1 RAW UINT8 1\n"
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *format_data = "data1 RAW UINT8 1\n"
                             "data2 RAW UINT8 1\n";
   int fd, error, r = 0;
   char *ref;
   DIRFILE *D;
 
+  rmdirfile();
   mkdir(filedir, 0777);
 
   fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
diff --git a/test/gzip_add.c b/test/gzip_add.c
new file mode 100644
index 0000000..9e8e8f7
--- /dev/null
+++ b/test/gzip_add.c
@@ -0,0 +1,84 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+/* Add a RAW field */
+#include "test.h"
+
+#include <stdlib.h>
+#include <sys/types.h>
+#include <stdio.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <string.h>
+#include <errno.h>
+
+int main(void)
+{
+#ifndef TEST_GZIP
+  return 77;
+#else
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *data = "dirfile/data.gz";
+  gd_entry_t e;
+  int e1, e2, unlink_data, r = 0;
+  DIRFILE *D;
+
+  rmdirfile();
+#ifdef USE_GZIP
+  D = gd_open(filedir, GD_RDWR | GD_CREAT | GD_VERBOSE | GD_GZIP_ENCODED);
+#else
+  D = gd_open(filedir, GD_RDWR | GD_CREAT | GD_GZIP_ENCODED);
+#endif
+  gd_add_raw(D, "data", GD_UINT8, 2, 0);
+  e1 = gd_error(D);
+
+  /* check */
+  e2 = gd_entry(D, "data", &e);
+#ifdef USE_GZIP
+  CHECKI(e2, 0);
+  if (e2 == 0) {
+    CHECKI(e.field_type, GD_RAW_ENTRY);
+    CHECKI(e.fragment_index, 0);
+    CHECKI(e.EN(raw,spf), 2);
+    CHECKI(e.EN(raw,data_type), GD_UINT8);
+    gd_free_entry_strings(&e);
+  }
+#else
+  CHECKI(e2, -1);
+#endif
+
+  gd_close(D);
+  unlink_data = unlink(data);
+
+#ifdef USE_GZIP
+  CHECKI(unlink_data, 0);
+  CHECKI(e1, GD_E_OK);
+#else
+  CHECKI(unlink_data, -1);
+  CHECKI(e1, GD_E_UNSUPPORTED);
+#endif
+
+  unlink(format);
+  rmdir(filedir);
+
+  return r;
+#endif
+}
diff --git a/test/gzip_get.c b/test/gzip_get.c
index cce454f..863485a 100644
--- a/test/gzip_get.c
+++ b/test/gzip_get.c
@@ -1,7 +1,24 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Attempt to read UINT8 */
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
 #include "test.h"
 
 #include <inttypes.h>
@@ -18,11 +35,11 @@ int main(void)
 #ifndef TEST_GZIP
   return 77;
 #else
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* data = __TEST__ "dirfile/data";
-  const char* gzipdata = __TEST__ "dirfile/data.gz";
-  const char* format_data = "data RAW UINT16 8\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *data = "dirfile/data";
+  const char *gzipdata = "dirfile/data.gz";
+  const char *format_data = "data RAW UINT16 8\n";
   uint16_t c[8];
   char command[4096];
   uint16_t data_data[256];
@@ -30,6 +47,7 @@ int main(void)
   DIRFILE *D;
 
   memset(c, 0, 8);
+  rmdirfile();
   mkdir(filedir, 0777);
 
   for (fd = 0; fd < 256; ++fd)
diff --git a/test/gzip_get_get.c b/test/gzip_get_get.c
index 38d4af5..5f9f36f 100644
--- a/test/gzip_get_get.c
+++ b/test/gzip_get_get.c
@@ -1,5 +1,24 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Attempt to read UINT8 */
-#include "../src/config.h"
 #include "test.h"
 
 #include <inttypes.h>
@@ -16,11 +35,11 @@ int main(void)
 #if !defined USE_GZIP || !defined TEST_GZIP
   return 77; /* skip test */
 #else
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* data = __TEST__ "dirfile/data";
-  const char* gzipdata = __TEST__ "dirfile/data.gz";
-  const char* format_data = "data RAW UINT16 8\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *data = "dirfile/data";
+  const char *gzipdata = "dirfile/data.gz";
+  const char *format_data = "data RAW UINT16 8\n";
   uint16_t c1[8], c2[8];
   char command[4096];
   uint16_t data_data[256];
@@ -29,6 +48,7 @@ int main(void)
 
   memset(c1, 0, 16);
   memset(c2, 0, 16);
+  rmdirfile();
   mkdir(filedir, 0777);
 
   for (fd = 0; fd < 256; ++fd)
diff --git a/test/gzip_get_get2.c b/test/gzip_get_get2.c
new file mode 100644
index 0000000..f2ed632
--- /dev/null
+++ b/test/gzip_get_get2.c
@@ -0,0 +1,92 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+/* Attempt to read UINT8 */
+#include "test.h"
+
+#include <inttypes.h>
+#include <stdlib.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <string.h>
+#include <stdio.h>
+#include <errno.h>
+
+int main(void)
+{
+#if !defined USE_GZIP || !defined TEST_GZIP
+  return 77; /* skip test */
+#else
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *data = "dirfile/data";
+  const char *gzipdata = "dirfile/data.gz";
+  const char *format_data = "data RAW UINT16 8\n";
+  uint16_t c1[8], c2[8];
+  char command[4096];
+  uint16_t data_data[256];
+  int fd, i, n1, error1, n2, error2, r = 0;
+  DIRFILE *D;
+
+  memset(c1, 0, 16);
+  memset(c2, 0, 16);
+  rmdirfile();
+  mkdir(filedir, 0777);
+
+  for (fd = 0; fd < 256; ++fd)
+    data_data[fd] = (unsigned char)fd;
+
+  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
+  write(fd, format_data, strlen(format_data));
+  close(fd);
+
+  fd = open(data, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
+  write(fd, data_data, 256 * sizeof(uint16_t));
+  close(fd);
+
+  /* compress */
+  snprintf(command, 4096, "%s -f %s > /dev/null", GZIP, data);
+  if (gd_system(command))
+    return 1;
+
+  D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
+  n1 = gd_getdata(D, "data", 0, 0, 1, 0, GD_UINT16, c1);
+  error1 = gd_error(D);
+  n2 = gd_getdata(D, "data", 0, 0, 1, 0, GD_UINT16, c2);
+  error2 = gd_error(D);
+  gd_close(D);
+
+  unlink(gzipdata);
+  unlink(format);
+  rmdir(filedir);
+
+  CHECKI(error1, 0);
+  CHECKI(error2, 0);
+  CHECKI(n1, 8);
+  CHECKI(n2, 8);
+  for (i = 0; i < 8; ++i) {
+    CHECKUi(i,c1[i], i);
+    CHECKUi(i,c2[i], i);
+  }
+
+  return r;
+#endif
+}
diff --git a/test/gzip_get_put.c b/test/gzip_get_put.c
new file mode 100644
index 0000000..68969e3
--- /dev/null
+++ b/test/gzip_get_put.c
@@ -0,0 +1,160 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+/* Attempt to write UINT8 */
+#include "test.h"
+
+#include <inttypes.h>
+#include <stdlib.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <string.h>
+#include <errno.h>
+#include <stdio.h>
+
+int main(void)
+{
+#ifndef TEST_GZIP
+  return 77;
+#else
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *data_gz = "dirfile/data.gz";
+  const char *data = "dirfile/data";
+  const char *format_data = "data RAW UINT8 8\n";
+  const unsigned char gzdata[279] = {
+    0x1f, 0x8b, 0x08, 0x00, 0x0d, 0x87, 0xb0, 0x4e,
+    0x00, 0x03, 0x01, 0x00, 0x01, 0xff, 0xfe, 0x00,
+    0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08,
+    0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 0x10,
+    0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18,
+    0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, 0x20,
+    0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, 0x28,
+    0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f, 0x30,
+    0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38,
+    0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f, 0x40,
+    0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48,
+    0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f, 0x50,
+    0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58,
+    0x59, 0x5a, 0x5b, 0x5c, 0x5d, 0x5e, 0x5f, 0x60,
+    0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68,
+    0x69, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f, 0x70,
+    0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78,
+    0x79, 0x7a, 0x7b, 0x7c, 0x7d, 0x7e, 0x7f, 0x80,
+    0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, 0x88,
+    0x89, 0x8a, 0x8b, 0x8c, 0x8d, 0x8e, 0x8f, 0x90,
+    0x91, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97, 0x98,
+    0x99, 0x9a, 0x9b, 0x9c, 0x9d, 0x9e, 0x9f, 0xa0,
+    0xa1, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7, 0xa8,
+    0xa9, 0xaa, 0xab, 0xac, 0xad, 0xae, 0xaf, 0xb0,
+    0xb1, 0xb2, 0xb3, 0xb4, 0xb5, 0xb6, 0xb7, 0xb8,
+    0xb9, 0xba, 0xbb, 0xbc, 0xbd, 0xbe, 0xbf, 0xc0,
+    0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7, 0xc8,
+    0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf, 0xd0,
+    0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xd7, 0xd8,
+    0xd9, 0xda, 0xdb, 0xdc, 0xdd, 0xde, 0xdf, 0xe0,
+    0xe1, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0xe7, 0xe8,
+    0xe9, 0xea, 0xeb, 0xec, 0xed, 0xee, 0xef, 0xf0,
+    0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, 0xf8,
+    0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff, 0x73,
+    0x8c, 0x05, 0x29, 0x00, 0x01, 0x00, 0x00
+  };
+  uint8_t b, c[8], d[8];
+  char command[4096];
+  int fd, i, m, n, e1, e2, unlink_data, unlink_datagz, r = 0;
+  DIRFILE *D;
+
+  memset(c, 0, 8);
+  rmdirfile();
+  mkdir(filedir, 0777);
+
+  for (i = 0; i < 8; ++i)
+    d[i] = (uint8_t)(80 + i);
+
+  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
+  write(fd, format_data, strlen(format_data));
+  close(fd);
+
+  fd = open(data_gz, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
+  write(fd, gzdata, 279);
+  close(fd);
+
+#ifdef USE_GZIP
+  D = gd_open(filedir, GD_RDWR | GD_GZIP_ENCODED | GD_VERBOSE);
+#else
+  D = gd_open(filedir, GD_RDWR | GD_GZIP_ENCODED);
+#endif
+  n = gd_getdata(D, "data", 5, 0, 1, 0, GD_UINT8, c);
+  e1 = gd_error(D);
+  m = gd_putdata(D, "data", 5, 0, 1, 0, GD_UINT8, d);
+  e2 = gd_error(D);
+
+  gd_close(D);
+
+#ifdef USE_GZIP
+  /* uncompress */
+  snprintf(command, 4096, "%s -f %s > /dev/null", GUNZIP, data);
+  if (gd_system(command)) {
+    r = 1;
+  } else {
+    fd = open(data, O_RDONLY | O_BINARY);
+    if (fd >= 0) {
+      i = 0;
+      while (read(fd, &b, sizeof(uint8_t))) {
+        if (i < 40 || i >= 48) {
+          CHECKIi(i, b, i);
+        } else
+          CHECKIi(i, b, i + 40);
+        i++;
+      }
+      CHECKI(i, 256);
+      close(fd);
+    }
+  }
+
+  for (i = 0; i < 8; ++i)
+    CHECKIi(i, c[i], 40 + i);
+#endif
+
+  unlink_data = unlink(data);
+  unlink_datagz = unlink(data_gz);
+  unlink(format);
+  rmdir(filedir);
+
+#ifdef USE_GZIP
+  CHECKI(unlink_data, 0);
+  CHECKI(unlink_datagz, -1);
+  CHECKI(e1, GD_E_OK);
+  CHECKI(e2, GD_E_OK);
+  CHECKI(n, 8);
+  CHECKI(m, 8);
+#else
+  CHECKI(unlink_data, -1);
+  CHECKI(unlink_datagz, 0);
+  CHECKI(e1, GD_E_UNSUPPORTED);
+  CHECKI(e2, GD_E_UNSUPPORTED);
+  CHECKI(n, 0);
+  CHECKI(m, 0);
+#endif
+
+  return r;
+#endif
+}
diff --git a/test/gzip_move_from.c b/test/gzip_move_from.c
index 9f3c08d..321f8a1 100644
--- a/test/gzip_move_from.c
+++ b/test/gzip_move_from.c
@@ -1,7 +1,24 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Test move */
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
 #include "test.h"
 
 #include <stdlib.h>
@@ -18,14 +35,14 @@ int main(void)
 #ifndef TEST_GZIP
   return 77;
 #else
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* format1 = __TEST__ "dirfile/format1";
-  const char* data = __TEST__ "dirfile/data";
-  const char* gzdata = __TEST__ "dirfile/data.gz";
-  const char* format_data =
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *format1 = "dirfile/format1";
+  const char *data = "dirfile/data";
+  const char *gzdata = "dirfile/data.gz";
+  const char *format_data =
     "/INCLUDE format1\ndata RAW UINT16 11\nENCODING gzip\n";
-  const char* format1_data = "ENCODING none\n";
+  const char *format1_data = "ENCODING none\n";
   uint16_t data_data[128];
   char command[4096];
   int fd, ret, ge_ret, unlink_data, unlink_gzdata, error, i = 0, r = 0;
@@ -33,6 +50,7 @@ int main(void)
   gd_entry_t E;
   uint16_t d;
 
+  rmdirfile();
   mkdir(filedir, 0777);
 
   for (fd = 0; fd < 128; ++fd)
diff --git a/test/gzip_move_to.c b/test/gzip_move_to.c
new file mode 100644
index 0000000..5d689b1
--- /dev/null
+++ b/test/gzip_move_to.c
@@ -0,0 +1,116 @@
+/* Copyright (C) 2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+/* Attempt to gzip compress a file */
+#include "test.h"
+
+#include <stdlib.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+
+int main(void)
+{
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *data_gz = "dirfile/data.gz";
+  const char *data_raw = "dirfile/data";
+  const char *format_data = "data RAW UINT8 8\n/ENCODING none\n/ENDIAN little\n";
+  uint8_t data_in[256];
+  DIRFILE *D;
+#ifdef USE_GZIP
+  uint8_t d;
+  char command[4096];
+  int i;
+#endif
+  int fd, error, unlink_raw, r = 0;
+  struct stat buf;
+
+  rmdirfile();
+  mkdir(filedir, 0777); 
+
+  for (fd = 0; fd < 256; ++fd)
+    data_in[fd] = (unsigned char)fd;
+
+  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
+  write(fd, format_data, strlen(format_data));
+  close(fd);
+
+  fd = open(data_raw, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
+  write(fd, data_in, 256);
+  close(fd);
+
+#ifdef USE_GZIP
+  D = gd_open(filedir, GD_RDWR | GD_VERBOSE);
+#else
+  D = gd_open(filedir, GD_RDWR);
+#endif
+  gd_alter_encoding(D, GD_GZIP_ENCODED, 0, 1);
+  error = gd_error(D);
+
+  gd_discard(D);
+
+#ifdef USE_GZIP
+  if (stat(data_gz, &buf)) {
+    perror("stat");
+    r = 1;
+  }
+  CHECKI(stat(data_raw, &buf), -1);
+#else
+  if (stat(data_raw, &buf)) {
+    perror("stat");
+    r = 1;
+  }
+  CHECKI(stat(data_gz, &buf), -1);
+#endif
+
+#ifdef USE_GZIP
+  /* uncompress */
+  snprintf(command, 4096, "%s -f %s > /dev/null", GUNZIP, data_gz);
+  if (gd_system(command)) {
+    fprintf(stderr, "command failed: %s\n", command);
+    r = 1;
+  } else {
+    fd = open(data_raw, O_RDONLY | O_BINARY);
+    if (fd >= 0) {
+      i = 0;
+      while (read(fd, &d, sizeof(uint8_t))) {
+        CHECKIi(i, d, i);
+        i++;
+      }
+      CHECKI(i, 256);
+      close(fd);
+    }
+  }
+#endif
+
+  unlink_raw = unlink(data_raw);
+  unlink(format);
+  rmdir(filedir);
+
+  CHECKI(unlink_raw, 0);
+#ifdef USE_GZIP
+  CHECKI(error, GD_E_OK);
+#else
+  CHECKI(error, GD_E_UNSUPPORTED);
+#endif
+
+  return r;
+}
diff --git a/test/gzip_nframes.c b/test/gzip_nframes.c
index 81a3f19..3680857 100644
--- a/test/gzip_nframes.c
+++ b/test/gzip_nframes.c
@@ -1,7 +1,25 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Retreiving the number of frames should succeed cleanly */
-#include "../src/config.h"
 #include "test.h"
-
 #include <stdlib.h>
 #include <sys/types.h>
 #include <stdio.h>
@@ -15,17 +33,18 @@ int main(void)
 #ifndef TEST_GZIP
   return 77;
 #else
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* data = __TEST__ "dirfile/data";
-  const char* gzipdata = __TEST__ "dirfile/data.gz";
-  const char* format_data = "data RAW UINT16 1\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *data = "dirfile/data";
+  const char *gzipdata = "dirfile/data.gz";
+  const char *format_data = "data RAW UINT16 1\n";
   char command[4096];
   uint16_t data_data[256];
   int i, error, r = 0;
   size_t n;
   DIRFILE *D;
 
+  rmdirfile();
   mkdir(filedir, 0777);
 
   for (i = 0; i < 256; ++i)
diff --git a/test/gzip_put.c b/test/gzip_put.c
new file mode 100644
index 0000000..f88b3af
--- /dev/null
+++ b/test/gzip_put.c
@@ -0,0 +1,121 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+/* Attempt to write UINT8 */
+#include "test.h"
+
+#include <inttypes.h>
+#include <stdlib.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <string.h>
+#include <errno.h>
+#include <stdio.h>
+
+int main(void)
+{
+#ifndef TEST_GZIP
+  return 77;
+#else
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *data_gz = "dirfile/data.gz";
+  const char *data = "dirfile/data";
+  const char *format_data = "data RAW UINT8 8\n";
+  uint8_t c[8];
+#ifdef USE_GZIP
+  char command[4096];
+  uint8_t d;
+#endif
+  struct stat buf;
+  int fd, i, n, error, stat_data, unlink_data, r = 0;
+  DIRFILE *D;
+
+  memset(c, 0, 8);
+  rmdirfile();
+  mkdir(filedir, 0777);
+
+  for (i = 0; i < 8; ++i)
+    c[i] = (uint8_t)(40 + i);
+
+  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
+  write(fd, format_data, strlen(format_data));
+  close(fd);
+
+#ifdef USE_GZIP
+  D = gd_open(filedir, GD_RDWR | GD_GZIP_ENCODED | GD_VERBOSE);
+#else
+  D = gd_open(filedir, GD_RDWR | GD_GZIP_ENCODED);
+#endif
+  n = gd_putdata(D, "data", 5, 0, 1, 0, GD_UINT8, c);
+  error = gd_error(D);
+
+  gd_discard(D);
+
+  stat_data = stat(data_gz, &buf);
+#ifdef USE_GZIP
+  if (stat_data) {
+    perror("stat");
+  }
+  CHECKI(stat_data, 0);
+#else
+  CHECKI(stat_data, -1);
+#endif
+
+#ifdef USE_GZIP
+  /* uncompress */
+  snprintf(command, 4096, "%s -f %s > /dev/null", GUNZIP, data);
+  if (gd_system(command)) {
+    r = 1;
+  } else {
+    fd = open(data, O_RDONLY | O_BINARY);
+    if (fd >= 0) {
+      i = 0;
+      while (read(fd, &d, sizeof(uint8_t))) {
+        if (i < 40 || i > 48) {
+          CHECKIi(i, d, 0);
+        } else
+          CHECKIi(i, d, i);
+        i++;
+      }
+      CHECKI(i, 48);
+      close(fd);
+    }
+  }
+#endif
+
+  unlink_data = unlink(data);
+  unlink(format);
+  rmdir(filedir);
+
+#ifdef USE_GZIP
+  CHECKI(unlink_data, 0);
+  CHECKI(error, GD_E_OK);
+  CHECKI(n, 8);
+#else
+  CHECKI(unlink_data, -1);
+  CHECKI(error, GD_E_UNSUPPORTED);
+  CHECKI(n, 0);
+#endif
+
+  return r;
+#endif
+}
diff --git a/test/gzip_put_get.c b/test/gzip_put_get.c
new file mode 100644
index 0000000..3d0fe9c
--- /dev/null
+++ b/test/gzip_put_get.c
@@ -0,0 +1,92 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+/* Attempt to write UINT8 */
+#include "test.h"
+
+#include <inttypes.h>
+#include <stdlib.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <string.h>
+#include <errno.h>
+#include <stdio.h>
+
+int main(void)
+{
+#ifndef TEST_GZIP
+  return 77;
+#else
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *data = "dirfile/data.gz";
+  const char *format_data = "data RAW UINT8 8\n";
+  uint8_t c[8], d[8];
+  int fd, i, m, n, e1, e2, unlink_data, r = 0;
+  DIRFILE *D;
+
+  memset(c, 0, 8);
+  rmdirfile();
+  mkdir(filedir, 0777);
+
+  for (i = 0; i < 8; ++i)
+    c[i] = (uint8_t)(40 + i);
+
+  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
+  write(fd, format_data, strlen(format_data));
+  close(fd);
+
+#ifdef USE_GZIP
+  D = gd_open(filedir, GD_RDWR | GD_GZIP_ENCODED | GD_VERBOSE);
+#else
+  D = gd_open(filedir, GD_RDWR | GD_GZIP_ENCODED);
+#endif
+  n = gd_putdata(D, "data", 5, 0, 1, 0, GD_UINT8, c);
+  e1 = gd_error(D);
+  m = gd_getdata(D, "data", 5, 0, 1, 0, GD_UINT8, d);
+  e2 = gd_error(D);
+
+  gd_close(D);
+
+  unlink_data = unlink(data);
+  unlink(format);
+  rmdir(filedir);
+
+#ifdef USE_GZIP
+  CHECKI(unlink_data, 0);
+  CHECKI(e1, GD_E_OK);
+  CHECKI(e2, GD_E_OK);
+  CHECKI(n, 8);
+  CHECKI(m, 8);
+#else
+  CHECKI(unlink_data, -1);
+  CHECKI(e1, GD_E_UNSUPPORTED);
+  CHECKI(e2, GD_E_UNSUPPORTED);
+  CHECKI(n, 0);
+  CHECKI(m, 0);
+#endif
+  
+  for (i = 0; i < m; ++i)
+    CHECKIi(i, d[i], c[i]);
+
+  return r;
+#endif
+}
diff --git a/test/header_complex.c b/test/header_complex.c
index dcfd769..7a55814 100644
--- a/test/header_complex.c
+++ b/test/header_complex.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2009-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Check if GD_C89_API produces a useable API */
 #define GD_C89_API
 #include "test.h"
@@ -13,15 +33,16 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* format_data =
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *format_data =
     "lincom LINCOM data 3.3;4.4 5.5;6.6 data 7.7;8.8 9.9;1.1\n";
   int fd, error, error2, error3, r = 0;
   const double ca[] = { 2.1, 3.2, 4.3, 5.4, 6.5, 7.6 };
   gd_entry_t E;
   DIRFILE *D;
 
+  rmdirfile();
   mkdir(filedir, 0777);
 
   fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
diff --git a/test/hide.c b/test/hide.c
new file mode 100644
index 0000000..f13d228
--- /dev/null
+++ b/test/hide.c
@@ -0,0 +1,54 @@
+/* Copyright (C) 2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+#include "test.h"
+
+int main(void)
+{
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *format_data = "data RAW UINT8 8\n";
+  int fd, n, h, m, error, r = 0;
+  DIRFILE *D;
+
+  rmdirfile();
+  mkdir(filedir, 0777);
+
+  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
+  write(fd, format_data, strlen(format_data));
+  close(fd);
+
+  D = gd_open(filedir, GD_RDWR | GD_VERBOSE);
+  n = gd_nfields(D);
+  h = gd_hide(D, "data");
+  error = gd_error(D);
+  m = gd_nfields(D);
+
+  gd_close(D);
+  unlink(format);
+  rmdir(filedir);
+
+  CHECKI(error, GD_E_OK);
+  CHECKI(n, 2);
+  CHECKI(h, 0);
+  CHECKI(m, 1);
+
+  return r;
+}
diff --git a/test/hide_hidden.c b/test/hide_hidden.c
new file mode 100644
index 0000000..67c9da6
--- /dev/null
+++ b/test/hide_hidden.c
@@ -0,0 +1,57 @@
+/* Copyright (C) 2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+#include "test.h"
+
+int main(void)
+{
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *format_data =
+    "data RAW UINT8 8\n"
+    "hata RAW UINT8 8\n"
+    "/HIDDEN hata\n";
+  int fd, h1, h2, e1, e2, r = 0;
+  DIRFILE *D;
+
+  rmdirfile();
+  mkdir(filedir, 0777);
+
+  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
+  write(fd, format_data, strlen(format_data));
+  close(fd);
+
+  D = gd_open(filedir, GD_RDWR | GD_VERBOSE);
+  h1 = gd_hidden(D, "data");
+  e1 = gd_error(D);
+  h2 = gd_hidden(D, "hata");
+  e2 = gd_error(D);
+
+  gd_close(D);
+  unlink(format);
+  rmdir(filedir);
+
+  CHECKI(e1, GD_E_OK);
+  CHECKI(h1, 0);
+  CHECKI(e2, GD_E_OK);
+  CHECKI(h2, 1);
+
+  return r;
+}
diff --git a/test/hide_unhide.c b/test/hide_unhide.c
new file mode 100644
index 0000000..784b011
--- /dev/null
+++ b/test/hide_unhide.c
@@ -0,0 +1,54 @@
+/* Copyright (C) 2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+#include "test.h"
+
+int main(void)
+{
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *format_data = "data RAW UINT8 8\n/HIDDEN data\n";
+  int fd, n, h, m, error, r = 0;
+  DIRFILE *D;
+
+  rmdirfile();
+  mkdir(filedir, 0777);
+
+  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
+  write(fd, format_data, strlen(format_data));
+  close(fd);
+
+  D = gd_open(filedir, GD_RDWR | GD_VERBOSE);
+  n = gd_nfields(D);
+  h = gd_unhide(D, "data");
+  error = gd_error(D);
+  m = gd_nfields(D);
+
+  gd_close(D);
+  unlink(format);
+  rmdir(filedir);
+
+  CHECKI(error, GD_E_OK);
+  CHECKI(n, 1);
+  CHECKI(h, 0);
+  CHECKI(m, 2);
+
+  return r;
+}
diff --git a/test/include.c b/test/include.c
index 51927b2..48ae58b 100644
--- a/test/include.c
+++ b/test/include.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Test include */
 #include "test.h"
 
@@ -10,15 +30,16 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* format1 = __TEST__ "dirfile/format1";
-  const char* format_data = "#\n";
-  const char* format1_data = "data RAW UINT8 11\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *format1 = "dirfile/format1";
+  const char *format_data = "#\n";
+  const char *format1_data = "data RAW UINT8 11\n";
   int fd, error, r = 0;
-  gd_spf_t spf;
+  unsigned int spf;
   DIRFILE *D;
 
+  rmdirfile();
   mkdir(filedir, 0777);
 
   fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
diff --git a/test/include_accmode.c b/test/include_accmode.c
index fdf79c5..5a5afc4 100644
--- a/test/include_accmode.c
+++ b/test/include_accmode.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Test include */
 #include "test.h"
 
@@ -10,11 +30,12 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
   int fd, error, r = 0;
   DIRFILE *D;
 
+  rmdirfile();
   mkdir(filedir, 0777);
 
   fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
diff --git a/test/include_affix.c b/test/include_affix.c
new file mode 100644
index 0000000..c8e8573
--- /dev/null
+++ b/test/include_affix.c
@@ -0,0 +1,59 @@
+/* Copyright (C) 2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+#include "test.h"
+
+int main(void)
+{
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *format1 = "dirfile/format1";
+  const char *format_data = "#\n";
+  const char *format1_data = "data RAW UINT8 11\n";
+  int fd, error, r = 0;
+  unsigned int spf;
+  DIRFILE *D;
+
+  rmdirfile();
+  mkdir(filedir, 0777);
+
+  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
+  write(fd, format_data, strlen(format_data));
+  close(fd);
+
+  fd = open(format1, O_CREAT | O_EXCL | O_WRONLY, 0666);
+  write(fd, format1_data, strlen(format1_data));
+  close(fd);
+
+  D = gd_open(filedir, GD_RDWR | GD_VERBOSE);
+  gd_include_affix(D, "format1", 0, "A", "Z", 0);
+  error = gd_error(D);
+  spf = gd_spf(D, "AdataZ");
+  gd_close(D);
+
+  unlink(format1);
+  unlink(format);
+  rmdir(filedir);
+
+  CHECKI(error, 0);
+  CHECKU(spf, 11);
+
+  return r;
+}
diff --git a/test/include_auto.c b/test/include_auto.c
index 06646d8..c77bd98 100644
--- a/test/include_auto.c
+++ b/test/include_auto.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Test include */
 #include "test.h"
 
@@ -11,17 +31,18 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* format1 = __TEST__ "dirfile/format1";
-  const char* format_data = "#\n";
-  const char* format1_data = "data RAW UINT8 11\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *format1 = "dirfile/format1";
+  const char *format_data = "#\n";
+  const char *format1_data = "data RAW UINT8 11\n";
   int fd, error1, error2, r = 0;
   const char *ptr;
   char *reference;
-  gd_spf_t spf;
+  unsigned int spf;
   DIRFILE *D;
 
+  rmdirfile();
   mkdir(filedir, 0777);
 
   fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
diff --git a/test/include_cb.c b/test/include_cb.c
index 02d214c..8355b1c 100644
--- a/test/include_cb.c
+++ b/test/include_cb.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Test include */
 #include "test.h"
 
@@ -10,8 +30,7 @@
 #include <stdio.h>
 
 int saw_callback = 0;
-int callback(gd_parser_data_t *pdata __attribute__ (( unused )), 
-    void *extra __attribute__ (( unused )))
+int callback(gd_parser_data_t *pdata gd_unused_, void *extra gd_unused_)
 {
   saw_callback++;
 
@@ -20,14 +39,15 @@ int callback(gd_parser_data_t *pdata __attribute__ (( unused )),
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* format1 = __TEST__ "dirfile/format1";
-  const char* format_data = "#\n";
-  const char* format1_data = "data ROW UINT8 11\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *format1 = "dirfile/format1";
+  const char *format_data = "#\n";
+  const char *format1_data = "data ROW UINT8 11\n";
   int fd, error, r = 0;
   DIRFILE *D;
 
+  rmdirfile();
   mkdir(filedir, 0777);
 
   fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
diff --git a/test/include_creat.c b/test/include_creat.c
index 912e7a1..e74f98e 100644
--- a/test/include_creat.c
+++ b/test/include_creat.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Test include */
 #include "test.h"
 
@@ -10,12 +30,13 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* format1 = __TEST__ "dirfile/format1";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *format1 = "dirfile/format1";
   int fd, error, unlink_format1, r = 0;
   DIRFILE *D;
 
+  rmdirfile();
   mkdir(filedir, 0777);
 
   fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
diff --git a/test/include_ignore.c b/test/include_ignore.c
index f927bd7..6b2099f 100644
--- a/test/include_ignore.c
+++ b/test/include_ignore.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Test include */
 #include "test.h"
 
@@ -11,16 +31,17 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* format1 = __TEST__ "dirfile/format1";
-  const char* format_data = "data1 RAW UINT8 1\n";
-  const char* format1_data = "data RAW UINT8 11\nREFERENCE data\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *format1 = "dirfile/format1";
+  const char *format_data = "data1 RAW UINT8 1\n";
+  const char *format1_data = "data RAW UINT8 11\nREFERENCE data\n";
   int fd, error1, error2, r = 0;
   char *reference;
-  gd_spf_t spf;
+  unsigned int spf;
   DIRFILE *D;
 
+  rmdirfile();
   mkdir(filedir, 0777);
 
   fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
diff --git a/test/include_index.c b/test/include_index.c
index 5e27ea9..bb7efb6 100644
--- a/test/include_index.c
+++ b/test/include_index.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Test include */
 #include "test.h"
 
@@ -10,12 +30,13 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* format_data = "#\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *format_data = "#\n";
   int fd, error, r = 0;
   DIRFILE *D;
 
+  rmdirfile();
   mkdir(filedir, 0777);
 
   fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
diff --git a/test/include_invalid.c b/test/include_invalid.c
index f99834b..d11d95e 100644
--- a/test/include_invalid.c
+++ b/test/include_invalid.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Test include */
 #include "test.h"
 
@@ -10,12 +30,13 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format1 = __TEST__ "dirfile/format1";
-  const char* format1_data = "data RAW UINT8 11\n";
+  const char *filedir = "dirfile";
+  const char *format1 = "dirfile/format1";
+  const char *format1_data = "data RAW UINT8 11\n";
   int fd, error, r = 0;
   DIRFILE *D;
 
+  rmdirfile();
   mkdir(filedir, 0777);
 
   fd = open(format1, O_CREAT | O_EXCL | O_WRONLY, 0666);
diff --git a/test/include_nonexistent.c b/test/include_nonexistent.c
index 115f597..248a980 100644
--- a/test/include_nonexistent.c
+++ b/test/include_nonexistent.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Test include */
 #include "test.h"
 
@@ -10,12 +30,13 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* format_data = "#\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *format_data = "#\n";
   int fd, error, r = 0;
   DIRFILE *D;
 
+  rmdirfile();
   mkdir(filedir, 0777);
 
   fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
diff --git a/test/include_pc.c b/test/include_pc.c
index e38f5b9..829b510 100644
--- a/test/include_pc.c
+++ b/test/include_pc.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Test include */
 #include "test.h"
 
@@ -10,8 +30,7 @@
 #include <stdio.h>
 
 int saw_callback = 0;
-int callback(gd_parser_data_t *pdata __attribute__ (( unused )),
-    void *extra __attribute__ (( unused )))
+int callback(gd_parser_data_t *pdata gd_unused_, void *extra gd_unused_)
 {
   saw_callback++;
 
@@ -20,14 +39,15 @@ int callback(gd_parser_data_t *pdata __attribute__ (( unused )),
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* format1 = __TEST__ "dirfile/format1";
-  const char* format_data = "data PAW UINT8 1\n";
-  const char* format1_data = "data ROW UINT8 11\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *format1 = "dirfile/format1";
+  const char *format_data = "data PAW UINT8 1\n";
+  const char *format1_data = "data ROW UINT8 11\n";
   int fd, error, r = 0;
   DIRFILE *D;
 
+  rmdirfile();
   mkdir(filedir, 0777);
 
   fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
diff --git a/test/include_ref.c b/test/include_ref.c
index ec8e826..8cecba0 100644
--- a/test/include_ref.c
+++ b/test/include_ref.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Test include */
 #include "test.h"
 
@@ -11,16 +31,17 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* format1 = __TEST__ "dirfile/format1";
-  const char* format_data = "data1 RAW UINT8 1\n";
-  const char* format1_data = "data RAW UINT8 11\nREFERENCE data\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *format1 = "dirfile/format1";
+  const char *format_data = "data1 RAW UINT8 1\n";
+  const char *format1_data = "data RAW UINT8 11\nREFERENCE data\n";
   int fd, error1, error2, r = 0;
   char *reference;
-  gd_spf_t spf;
+  unsigned int spf;
   DIRFILE *D;
 
+  rmdirfile();
   mkdir(filedir, 0777);
 
   fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
diff --git a/test/include_sub.c b/test/include_sub.c
new file mode 100644
index 0000000..a1eeaea
--- /dev/null
+++ b/test/include_sub.c
@@ -0,0 +1,77 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+/* Test include */
+#include "test.h"
+
+#include <stdlib.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <string.h>
+#include <errno.h>
+
+int main(void)
+{
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *format1 = "dirfile/format1";
+  const char *format2 = "dirfile/format2";
+  const char *format_data = "#\n";
+  const char *format1_data = "data RAW UINT8 11\nINCLUDE format2";
+  const char *format2_data = "#\n";
+  int fd, n, error, r = 0;
+  gd_entry_t E;
+  DIRFILE *D;
+
+  rmdirfile();
+  mkdir(filedir, 0777);
+
+  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
+  write(fd, format_data, strlen(format_data));
+  close(fd);
+
+  fd = open(format1, O_CREAT | O_EXCL | O_WRONLY, 0666);
+  write(fd, format1_data, strlen(format1_data));
+  close(fd);
+
+  fd = open(format2, O_CREAT | O_EXCL | O_WRONLY, 0666);
+  write(fd, format2_data, strlen(format2_data));
+  close(fd);
+
+  D = gd_open(filedir, GD_RDWR | GD_VERBOSE);
+
+  n = gd_include(D, "format1", 0, 0);
+  error = gd_error(D);
+  CHECKI(error, 0);
+
+  gd_entry(D, "data", &E);
+  CHECKI(n, E.fragment_index);
+
+  gd_free_entry_strings(&E);
+  gd_close(D);
+
+  unlink(format2);
+  unlink(format1);
+  unlink(format);
+  rmdir(filedir);
+
+  return r;
+}
diff --git a/test/include_syntax.c b/test/include_syntax.c
index 1e119fc..ad870de 100644
--- a/test/include_syntax.c
+++ b/test/include_syntax.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Test include */
 #include "test.h"
 
@@ -11,14 +31,15 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* format1 = __TEST__ "dirfile/format1";
-  const char* format_data = "#\n";
-  const char* format1_data = "data ROW UINT8 11\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *format1 = "dirfile/format1";
+  const char *format_data = "#\n";
+  const char *format1_data = "data ROW UINT8 11\n";
   int fd, error, r = 0;
   DIRFILE *D;
 
+  rmdirfile();
   mkdir(filedir, 0777);
 
   fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
diff --git a/test/index.c b/test/index.c
index dc41b51..969a6de 100644
--- a/test/index.c
+++ b/test/index.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2009-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Frameindex look-up */
 #include "test.h"
 
@@ -12,14 +32,15 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* data = __TEST__ "dirfile/data";
-  const char* format_data = "data RAW FLOAT64 1\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *data = "dirfile/data";
+  const char *format_data = "data RAW FLOAT64 1\n";
   double d[1000], f1, f2, f3;
   int i, error, r = 0;
   DIRFILE *D;
 
+  rmdirfile();
   mkdir(filedir, 0777);
 
   for (i = 0; i < 1000; ++i)
diff --git a/test/index_domain.c b/test/index_domain.c
index c3479e0..ba59817 100644
--- a/test/index_domain.c
+++ b/test/index_domain.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2009-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Frameindex look-up */
 #include "test.h"
 
@@ -12,14 +32,15 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* data = __TEST__ "dirfile/data";
-  const char* format_data = "data RAW FLOAT64 1\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *data = "dirfile/data";
+  const char *format_data = "data RAW FLOAT64 1\n";
   double d[1000], f1;
   int i, error, r = 0;
   DIRFILE *D;
 
+  rmdirfile();
   mkdir(filedir, 0777);
 
   for (i = 0; i < 1000; ++i)
diff --git a/test/index_range.c b/test/index_range.c
index 8c1b9ec..bb11399 100644
--- a/test/index_range.c
+++ b/test/index_range.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2009-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Frameindex look-up */
 #include "test.h"
 
@@ -12,14 +32,15 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* data = __TEST__ "dirfile/data";
-  const char* format_data = "data RAW FLOAT64 1\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *data = "dirfile/data";
+  const char *format_data = "data RAW FLOAT64 1\n";
   double d[1000], f1;
   int i, error, r = 0;
   DIRFILE *D;
 
+  rmdirfile();
   mkdir(filedir, 0777);
 
   for (i = 0; i < 1000; ++i)
diff --git a/test/legacy_get.c b/test/legacy_get.c
index 7463526..017ca6d 100644
--- a/test/legacy_get.c
+++ b/test/legacy_get.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Attempt to read UINT8 via the legacy interface */
 #include "test.h"
 
@@ -13,15 +33,16 @@ int main(void)
 #ifndef GD_LEGACY_API
   return 77; /* skipped */
 #else
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* data = __TEST__ "dirfile/data";
-  const char* format_data = "data RAW UINT8 8\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *data = "dirfile/data";
+  const char *format_data = "data RAW UINT8 8\n";
   unsigned char c[8];
   unsigned char data_data[256];
   int fd, i, n, error, r = 0;
 
   memset(c, 0, 8);
+  rmdirfile();
   mkdir(filedir, 0777);
 
   for (fd = 0; fd < 256; ++fd)
diff --git a/test/legacy_get_put.c b/test/legacy_get_put.c
index 9b30c43..33bb05d 100644
--- a/test/legacy_get_put.c
+++ b/test/legacy_get_put.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Attempt a write following a read via the legacy API -- this requires
  * closing and then re-opening the legacy dirfile */
 #include "test.h"
@@ -15,15 +35,16 @@ int main(void)
 #ifndef GD_LEGACY_API
   return 77; /* skipped */
 #else
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* data = __TEST__ "dirfile/data";
-  const char* format_data = "data RAW UINT8 8\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *data = "dirfile/data";
+  const char *format_data = "data RAW UINT8 8\n";
   uint8_t c[8];
   unsigned char data_data[256];
   int fd, i, get_error, put_error, n, r = 0;
 
   memset(c, 0, 8);
+  rmdirfile();
   mkdir(filedir, 0777);
 
   for (i = 0; i < 8; ++i)
diff --git a/test/legacy_get_rofs.c b/test/legacy_get_rofs.c
index 87f9f51..7efbe3e 100644
--- a/test/legacy_get_rofs.c
+++ b/test/legacy_get_rofs.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Attempt to read UINT8 from a read-only filesystem via the legacy interface */
 #include "test.h"
 
@@ -13,15 +33,16 @@ int main(void)
 #ifndef GD_LEGACY_API
   return 77; /* skipped */
 #else
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* data = __TEST__ "dirfile/data";
-  const char* format_data = "data RAW UINT8 8\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *data = "dirfile/data";
+  const char *format_data = "data RAW UINT8 8\n";
   unsigned char c[8];
   unsigned char data_data[256];
   int fd, i, n, error, r = 0;
 
   memset(c, 0, 8);
+  rmdirfile();
   mkdir(filedir, 0777);
 
   for (fd = 0; fd < 256; ++fd)
diff --git a/test/legacy_nframes.c b/test/legacy_nframes.c
index 2481800..5447eaf 100644
--- a/test/legacy_nframes.c
+++ b/test/legacy_nframes.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Retreiving the number of frames via the legacy API should succeed cleanly */
 #include "test.h"
 
@@ -13,14 +33,15 @@ int main(void)
 #ifndef GD_LEGACY_API
   return 77; /* skipped */
 #else
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* data = __TEST__ "dirfile/data";
-  const char* format_data = "data RAW UINT8 1\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *data = "dirfile/data";
+  const char *format_data = "data RAW UINT8 1\n";
   int fd, error, r = 0;
   const size_t len = strlen(data);
   size_t n;
 
+  rmdirfile();
   mkdir(filedir, 0777);
 
   fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
diff --git a/test/legacy_nonexistent.c b/test/legacy_nonexistent.c
index 7726c9f..b0660e4 100644
--- a/test/legacy_nonexistent.c
+++ b/test/legacy_nonexistent.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Reference to a non-existent dirfile from the legacy API should fail cleanly
  */
 #include "test.h"
diff --git a/test/legacy_put.c b/test/legacy_put.c
index 1e362a7..8782620 100644
--- a/test/legacy_put.c
+++ b/test/legacy_put.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Attempt to write UINT8 via the legacy interface*/
 #include "test.h"
 
@@ -14,14 +34,15 @@ int main(void)
 #ifndef GD_LEGACY_API
   return 77; /* skipped */
 #else
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* data = __TEST__ "dirfile/data";
-  const char* format_data = "data RAW UINT8 8\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *data = "dirfile/data";
+  const char *format_data = "data RAW UINT8 8\n";
   uint8_t c[8], d;
   int fd, i, n, error, r = 0;
 
   memset(c, 0, 8);
+  rmdirfile();
   mkdir(filedir, 0777);
 
   for (i = 0; i < 8; ++i)
@@ -35,14 +56,19 @@ int main(void)
 
   fd = open(data, O_RDONLY | O_BINARY);
   i = 0;
-  while (read(fd, &d, sizeof(uint8_t))) {
-    if (i < 40 || i > 48) {
-      CHECKUi(i,d,0);
-    } else
-      CHECKUi(i,d,i);
-    i++;
+  if (fd >= 0) {
+    while (read(fd, &d, sizeof(uint8_t))) {
+      if (i < 40 || i > 48) {
+        CHECKUi(i,d,0);
+      } else
+        CHECKUi(i,d,i);
+      i++;
+    }
+    close(fd);
+  } else {
+    perror("open");
+    r = 1;
   }
-  close(fd);
 
   unlink(data);
   unlink(format);
diff --git a/test/legacy_spf.c b/test/legacy_spf.c
index 62ffc77..32e616e 100644
--- a/test/legacy_spf.c
+++ b/test/legacy_spf.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Retreiving the samples-per-frame of a field via the legacy API should
  * succeed cleanly */
 #include "test.h"
@@ -14,12 +34,13 @@ int main(void)
 #ifndef GD_LEGACY_API
   return 77; /* skip */
 #else
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* format_data = "data RAW UINT8 11\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *format_data = "data RAW UINT8 11\n";
   int fd, error, r = 0;
   unsigned int spf;
 
+  rmdirfile();
   mkdir(filedir, 0777);
 
   fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
diff --git a/test/lzma_get.c b/test/lzma_get.c
index ff8a088..bbd8041 100644
--- a/test/lzma_get.c
+++ b/test/lzma_get.c
@@ -1,33 +1,45 @@
-/* Attempt to read UINT8 */
-#include "../src/config.h"
+/* Copyright (C) 2009-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 #include "test.h"
-
-#include <inttypes.h>
-#include <stdlib.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-#include <string.h>
-#include <stdio.h>
-#include <errno.h>
-
 int main(void)
 {
 #ifndef TEST_LZMA
   return 77;
 #else
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* data = __TEST__ "dirfile/data";
-  const char* lzmadata = __TEST__ "dirfile/data.lzma";
-  const char* format_data = "data RAW UINT16 8\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *data = "dirfile/data";
+  const char *lzmadata = "dirfile/data.lzma";
+  const char *format_data = "data RAW UINT16 8\n";
   uint16_t c[8];
   char command[4096];
   uint16_t data_data[256];
-  int fd, i, n, error, r = 0;
+#ifdef USE_LZMA
+  int i;
+#endif
+  int fd, n, error, r = 0;
   DIRFILE *D;
 
   memset(c, 0, 8);
+  rmdirfile();
   mkdir(filedir, 0777);
 
   for (fd = 0; fd < 256; ++fd)
diff --git a/test/lzma_nframes.c b/test/lzma_nframes.c
index 3806c53..8849c74 100644
--- a/test/lzma_nframes.c
+++ b/test/lzma_nframes.c
@@ -1,5 +1,24 @@
+/* Copyright (C) 2009-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Retreiving the number of frames should succeed cleanly */
-#include "../src/config.h"
 #include "test.h"
 
 #include <stdlib.h>
@@ -15,17 +34,18 @@ int main(void)
 #ifndef TEST_LZMA
   return 77;
 #else
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* data = __TEST__ "dirfile/data";
-  const char* xzdata = __TEST__ "dirfile/data.lzma";
-  const char* format_data = "data RAW UINT16 1\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *data = "dirfile/data";
+  const char *xzdata = "dirfile/data.lzma";
+  const char *format_data = "data RAW UINT16 1\n";
   char command[4096];
   uint16_t data_data[256];
   int i, error, r = 0;
   DIRFILE *D;
   size_t n;
 
+  rmdirfile();
   mkdir(filedir, 0777);
 
   for (i = 0; i < 256; ++i)
diff --git a/test/madd.c b/test/madd.c
index e3d2c3d..c104547 100644
--- a/test/madd.c
+++ b/test/madd.c
@@ -1,19 +1,30 @@
-/* Add a dirfile field */
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 #include "test.h"
 
-#include <stdlib.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-#include <string.h>
-#include <errno.h>
-#include <stdio.h>
-
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* data = __TEST__ "dirfile/data";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *data = "dirfile/data";
   int error, ge_error, n, r = 0;
   gd_entry_t e;
   DIRFILE *D;
@@ -26,6 +37,7 @@ int main(void)
   E.EN(raw,spf) = 2;
   E.EN(raw,data_type) = GD_UINT8;
 
+  rmdirfile();
   D = gd_open(filedir, GD_RDWR | GD_CREAT | GD_VERBOSE);
   gd_add(D, &E);
   E.field_type = GD_CONST_ENTRY;
diff --git a/test/madd_affix.c b/test/madd_affix.c
new file mode 100644
index 0000000..1ac1fbf
--- /dev/null
+++ b/test/madd_affix.c
@@ -0,0 +1,84 @@
+/* Copyright (C) 2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+#include "test.h"
+
+int main(void)
+{
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *format1 = "dirfile/format1";
+  const char *data = "dirfile/data";
+  const char *format_data = "/INCLUDE format1 A Z\n";
+  int fd, e1, e2, e3, r = 0;
+  DIRFILE *D;
+  gd_entry_t E, e;
+
+  rmdirfile();
+  mkdir(filedir, 0777);
+
+  memset(&E, 0, sizeof(E));
+  E.field = "AdataZ";
+  E.field_type = GD_RAW_ENTRY;
+  E.fragment_index = 1;
+  E.EN(raw,spf) = 2;
+  E.EN(raw,data_type) = GD_UINT8;
+  E.scalar[0] = NULL;
+
+  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
+  write(fd, format_data, strlen(format_data));
+  close(fd);
+
+  close(open(format1, O_CREAT | O_EXCL | O_WRONLY, 0666));
+
+  D = gd_open(filedir, GD_RDWR | GD_UNENCODED | GD_VERBOSE);
+  gd_add(D, &E);
+  e1 = gd_error(D);
+
+  E.field = "data";
+  E.field_type = GD_CONST_ENTRY;
+  E.EN(scalar,const_type) = GD_UINT8;
+  E.fragment_index = 99; /* ignored */
+
+  gd_madd(D, &E, "AdataZ");
+  e2 = gd_error(D);
+
+  /* check */
+  gd_entry(D, "AdataZ/data", &e);
+  e3 = gd_error(D);
+  gd_close(D);
+
+  unlink(data);
+  unlink(format);
+  unlink(format1);
+  rmdir(filedir);
+
+  CHECKI(e1, GD_E_OK);
+  CHECKI(e2, GD_E_OK);
+  CHECKI(e3, GD_E_OK);
+  if (e3 == 0) {
+    CHECKI(e.field_type, GD_CONST_ENTRY);
+    CHECKI(e.fragment_index, 1);
+    CHECKI(e.EN(scalar,const_type), GD_UINT8);
+    gd_free_entry_strings(&e);
+  }
+
+  return r;
+}
diff --git a/test/madd_alias.c b/test/madd_alias.c
new file mode 100644
index 0000000..aaf1336
--- /dev/null
+++ b/test/madd_alias.c
@@ -0,0 +1,57 @@
+/* Copyright (C) 2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+#include "test.h"
+
+int main(void)
+{
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *data = "dirfile/data";
+  int error, i, n, r = 0;
+  DIRFILE *D;
+  const char *target;
+
+  rmdirfile();
+
+  D = gd_open(filedir, GD_RDWR | GD_CREAT | GD_VERBOSE);
+
+  gd_add_raw(D, "data", GD_UINT8, 1, 0);
+  gd_madd_alias(D, "data", "alias", "data");
+  error = gd_error(D);
+
+  /* check */
+  target = gd_alias_target(D, "data/alias");
+  CHECKS(target, "data");
+  i = gd_fragment_index(D, "data/alias");
+  n = gd_naliases(D, "data/alias");
+
+  gd_discard(D);
+
+  unlink(data);
+  unlink(format);
+  rmdir(filedir);
+
+  CHECKI(error, GD_E_OK);
+  CHECKI(i, 0);
+  CHECKI(n, 2);
+
+  return r;
+}
diff --git a/test/madd_alias_affix.c b/test/madd_alias_affix.c
new file mode 100644
index 0000000..4a5952c
--- /dev/null
+++ b/test/madd_alias_affix.c
@@ -0,0 +1,75 @@
+/* Copyright (C) 2012 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+#include "test.h"
+
+int main(void)
+{
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *format1 = "dirfile/format";
+  const char *data = "dirfile/data";
+  const char *target1, *target2;
+  int e1, e2, e3, e4, e5, i, n, r = 0;
+  DIRFILE *D;
+
+  rmdirfile();
+
+  D = gd_open(filedir, GD_RDWR | GD_CREAT);
+
+  gd_include_affix(D, "format1", 0, "A", "Z", GD_CREAT);
+  gd_add_raw(D, "AdataZ", GD_UINT8, 1, 1);
+  gd_madd_alias(D, "data", "AaliasZ", "AdataZ");
+  e1 = gd_error(D);
+  gd_madd_alias(D, "AdataZ", "alias", "AdataZ");
+  e2 = gd_error(D);
+  gd_madd_alias(D, "AdataZ", "AaliasZ", "data");
+  e3 = gd_error(D);
+  gd_madd_alias(D, "AdataZ", "AaliasZ", "AdataZ");
+  e4 = gd_error(D);
+  gd_add_alias(D, "AdataZ/alias2", "AdataZ", 1);
+  e5 = gd_error(D);
+
+  /* check */
+  target1 = gd_alias_target(D, "AdataZ/AaliasZ");
+  CHECKS(target1, "AdataZ");
+  target2 = gd_alias_target(D, "AdataZ/alias2");
+  CHECKS(target2, "AdataZ");
+
+  i = gd_fragment_index(D, "AdataZ/AaliasZ");
+  n = gd_naliases(D, "AdataZ/AaliasZ");
+
+  gd_discard(D);
+
+  unlink(data);
+  unlink(format);
+  unlink(format1);
+  rmdir(filedir);
+
+  CHECKI(e1, GD_E_BAD_CODE);
+  CHECKI(e2, GD_E_OK);
+  CHECKI(e3, GD_E_BAD_CODE);
+  CHECKI(e4, GD_E_OK);
+  CHECKI(e5, GD_E_OK);
+  CHECKI(i, 1);
+  CHECKI(n, 4);
+
+  return r;
+}
diff --git a/test/madd_bit.c b/test/madd_bit.c
index d921ed4..96dd068 100644
--- a/test/madd_bit.c
+++ b/test/madd_bit.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Add a BIT field */
 #include "test.h"
 
@@ -11,12 +31,14 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
   int ge_error, error, r = 0;
   gd_entry_t e;
+  DIRFILE *D;
 
-  DIRFILE* D = gd_open(filedir, GD_RDWR | GD_CREAT | GD_VERBOSE);
+  rmdirfile();
+  D = gd_open(filedir, GD_RDWR | GD_CREAT | GD_VERBOSE);
   gd_add_phase(D, "new", "in", 3, 0);
   gd_madd_bit(D, "new", "meta", "input", 1, 1);
   error = gd_error(D);
diff --git a/test/madd_bit_invalid.c b/test/madd_bit_invalid.c
index 373209e..ac57ac7 100644
--- a/test/madd_bit_invalid.c
+++ b/test/madd_bit_invalid.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Getting data from an invalid dirfile should fail cleanly */
 #include "test.h"
 
@@ -9,10 +29,12 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
+  const char *filedir = "dirfile";
   int error, r = 0;
+  DIRFILE *D;
 
-  DIRFILE* D = gd_open(filedir, GD_RDONLY);
+  rmdirfile();
+  D = gd_open(filedir, GD_RDONLY);
   gd_madd_bit(D, "new", "meta", "input", 1, 1);
   error = gd_error(D);
   gd_close(D);
diff --git a/test/madd_carray.c b/test/madd_carray.c
index 3e2f7b6..427c1e7 100644
--- a/test/madd_carray.c
+++ b/test/madd_carray.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2010-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 #include "test.h"
 
 #include <inttypes.h>
@@ -11,14 +31,16 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
   uint8_t val[] = {3, 4, 5, 6, 7};
   uint8_t data[5];
   int error, n, r = 0;
   gd_entry_t e;
+  DIRFILE *D;
 
-  DIRFILE* D = gd_open(filedir, GD_RDWR | GD_CREAT | GD_VERBOSE);
+  rmdirfile();
+  D = gd_open(filedir, GD_RDWR | GD_CREAT | GD_VERBOSE);
   gd_add_phase(D, "new", "in", 3, 0);
   gd_madd_carray(D, "new", "data", GD_UINT8, 5, GD_UINT8, &val);
   error = gd_error(D);
diff --git a/test/madd_clincom.c b/test/madd_clincom.c
index 7187997..93c301a 100644
--- a/test/madd_clincom.c
+++ b/test/madd_clincom.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2009-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Add a LINCOM field */
 #include "test.h"
 
@@ -11,11 +31,11 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
   int error, ge_error, r = 0;
   gd_entry_t e;
-  const char* in_fields[2] = {"in1", "in2"};
+  const char *in_fields[2] = {"in1", "in2"};
 #ifdef GD_NO_C99_API
   const double m[2][2] = {{1, 3.3}, {0.3, 18.3}};
   const double b[2][2] = {{2, 3.8}, {2.1, 9.8}};
@@ -23,8 +43,10 @@ int main(void)
   const double complex m[2] = {1 + _Complex_I * 3.3, 0.3 + _Complex_I * 18.3};
   const double complex b[2] = {2 + _Complex_I * 3.8, 2.1 + _Complex_I * 9.8};
 #endif
+  DIRFILE *D;
 
-  DIRFILE* D = gd_open(filedir, GD_RDWR | GD_CREAT | GD_VERBOSE);
+  rmdirfile();
+  D = gd_open(filedir, GD_RDWR | GD_CREAT | GD_VERBOSE);
   gd_add_phase(D, "new", "in", 3, 0);
 #ifdef GD_NO_C99_API
   gd_madd_clincom(D, "new", "meta", 2, in_fields, (double*)m, (double*)b);
diff --git a/test/madd_const.c b/test/madd_const.c
index 6691706..609a1d9 100644
--- a/test/madd_const.c
+++ b/test/madd_const.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2009-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Add a CONST field */
 #include "test.h"
 
@@ -12,13 +32,15 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
   uint8_t val = 3;
   int error, ge_error, r = 0;
   gd_entry_t e;
+  DIRFILE *D;
 
-  DIRFILE* D = gd_open(filedir, GD_RDWR | GD_CREAT | GD_VERBOSE);
+  rmdirfile();
+  D = gd_open(filedir, GD_RDWR | GD_CREAT | GD_VERBOSE);
   gd_add_phase(D, "new", "in", 3, 0);
   gd_madd_const(D, "new", "data", GD_UINT8, GD_UINT8, &val);
   error = gd_error(D);
diff --git a/test/madd_cpolynom.c b/test/madd_cpolynom.c
index f610dce..beb649b 100644
--- a/test/madd_cpolynom.c
+++ b/test/madd_cpolynom.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2009-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Add a complex POLYNOM field */
 #include "test.h"
 
@@ -12,8 +32,8 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
   int j, error, ge_error, r = 0;
   gd_entry_t e;
 #ifdef GD_NO_C99_API
@@ -22,8 +42,10 @@ int main(void)
   const double complex a[4] = {1 + _Complex_I * 29.03, 0.3 + _Complex_I * 12.34,
     0.5 + _Complex_I * 99.55, 1.8 + _Complex_I * 45.32};
 #endif
+  DIRFILE *D;
 
-  DIRFILE* D = gd_open(filedir, GD_RDWR | GD_CREAT | GD_VERBOSE);
+  rmdirfile();
+  D = gd_open(filedir, GD_RDWR | GD_CREAT | GD_VERBOSE);
   gd_add_phase(D, "new", "in", 3, 0);
 #ifdef GD_NO_C99_API
   gd_madd_cpolynom(D, "new", "meta", 3, "in", (const double *)a);
diff --git a/test/madd_crecip.c b/test/madd_crecip.c
index 76a16c6..abdef86 100644
--- a/test/madd_crecip.c
+++ b/test/madd_crecip.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2010-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 #include "test.h"
 
 #include <stdlib.h>
@@ -10,8 +30,8 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
   int error, ge_error, r = 0;
   gd_entry_t e;
 #ifdef GD_NO_C99_API
@@ -19,8 +39,10 @@ int main(void)
 #else
   const double complex v = 3.2 + _Complex_I * 3.1;
 #endif
+  DIRFILE *D;
 
-  DIRFILE* D = gd_open(filedir, GD_RDWR | GD_CREAT | GD_VERBOSE);
+  rmdirfile();
+  D = gd_open(filedir, GD_RDWR | GD_CREAT | GD_VERBOSE);
   gd_add_phase(D, "new", "in", 3, 0);
   gd_madd_crecip(D, "new", "meta", "in1", v);
   error = gd_error(D);
diff --git a/test/madd_crecip89.c b/test/madd_crecip89.c
index 38fb65c..7610f08 100644
--- a/test/madd_crecip89.c
+++ b/test/madd_crecip89.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2010-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 #define GD_C89_API
 #include "test.h"
 
@@ -11,13 +31,15 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
   int error, ge_error, r = 0;
   gd_entry_t e;
   double div[2] = {3.2, 3.1};
+  DIRFILE *D;
 
-  DIRFILE* D = gd_open(filedir, GD_RDWR | GD_CREAT | GD_VERBOSE);
+  rmdirfile();
+  D = gd_open(filedir, GD_RDWR | GD_CREAT | GD_VERBOSE);
   gd_add_phase(D, "new", "in", 3, 0);
   gd_madd_crecip(D, "new", "meta", "in1", div);
   error = gd_error(D);
diff --git a/test/madd_divide.c b/test/madd_divide.c
index b7fe3f0..41ab1eb 100644
--- a/test/madd_divide.c
+++ b/test/madd_divide.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2010-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 #include "test.h"
 
 #include <stdlib.h>
@@ -10,12 +30,14 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
   int error, ge_error, r = 0;
   gd_entry_t e;
+  DIRFILE *D;
 
-  DIRFILE* D = gd_open(filedir, GD_RDWR | GD_CREAT | GD_VERBOSE);
+  rmdirfile();
+  D = gd_open(filedir, GD_RDWR | GD_CREAT | GD_VERBOSE);
   gd_add_phase(D, "new", "in", 3, 0);
   gd_madd_divide(D, "new", "meta", "in1", "in2");
   error = gd_error(D);
diff --git a/test/madd_index.c b/test/madd_index.c
new file mode 100644
index 0000000..731a714
--- /dev/null
+++ b/test/madd_index.c
@@ -0,0 +1,72 @@
+/* Copyright (C) 2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+#include "test.h"
+
+int main(void)
+{
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *data = "dirfile/data";
+  int error, ge_error, n, r = 0;
+  gd_entry_t e;
+  DIRFILE *D;
+
+  gd_entry_t E;
+  memset(&E, 0, sizeof(E));
+  E.field = "data";
+  E.field_type = GD_RAW_ENTRY;
+  E.fragment_index = 0;
+  E.EN(raw,spf) = 2;
+  E.EN(raw,data_type) = GD_UINT8;
+
+  rmdirfile();
+  D = gd_open(filedir, GD_RDWR | GD_CREAT | GD_VERBOSE);
+  gd_add(D, &E);
+  E.field_type = GD_CONST_ENTRY;
+  E.EN(scalar,const_type) = GD_UINT8;
+  E.fragment_index = 99;
+  gd_madd(D, &E, "data");
+  error = gd_error(D);
+
+  /* check */
+  n = gd_nfields(D);
+  gd_entry(D, "data/data", &e);
+  ge_error = gd_error(D);
+
+  gd_close(D);
+
+  unlink(data);
+  unlink(format);
+  rmdir(filedir);
+
+  CHECKI(error, GD_E_OK);
+  CHECKI(ge_error, 0);
+  CHECKI(n, 2);
+
+  if (!r) {
+    CHECKI(e.field_type, GD_CONST_ENTRY);
+    CHECKI(e.fragment_index, 0);
+    CHECKI(e.EN(scalar,const_type), GD_UINT8);
+    gd_free_entry_strings(&e);
+  }
+
+  return r;
+}
diff --git a/test/madd_lincom.c b/test/madd_lincom.c
index 88dcf41..e5fb6f8 100644
--- a/test/madd_lincom.c
+++ b/test/madd_lincom.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Add a LINCOM field */
 #include "test.h"
 
@@ -12,15 +32,17 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
   int error, ge_error, r = 0;
   gd_entry_t e;
-  const char* in_fields[2] = {"in1", "in2"};
+  const char *in_fields[2] = {"in1", "in2"};
   const double m[2] = {1, 0.3};
   const double b[2] = {0, 0.9};
+  DIRFILE *D;
 
-  DIRFILE* D = gd_open(filedir, GD_RDWR | GD_CREAT | GD_VERBOSE);
+  rmdirfile();
+  D = gd_open(filedir, GD_RDWR | GD_CREAT | GD_VERBOSE);
   gd_add_phase(D, "new", "in", 3, 0);
   gd_madd_lincom(D, "new", "meta", 2, in_fields, m, b);
   error = gd_error(D);
diff --git a/test/madd_lincom_invalid.c b/test/madd_lincom_invalid.c
index 02940e8..7e72a52 100644
--- a/test/madd_lincom_invalid.c
+++ b/test/madd_lincom_invalid.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Getting data from an invalid dirfile should fail cleanly */
 #include "test.h"
 
@@ -9,13 +29,15 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
+  const char *filedir = "dirfile";
   int error, r = 0;
-
-  DIRFILE* D = gd_open(filedir, GD_RDONLY);
-  const char* in_fields[2] = {"in1", "in2"};
+  DIRFILE *D;
+  const char *in_fields[2] = {"in1", "in2"};
   const double m[2] = {1, 0.3};
   const double b[2] = {0, 0.9};
+
+  rmdirfile();
+  D = gd_open(filedir, GD_RDONLY);
   gd_madd_lincom(D, "new", "meta", 2, in_fields, m, b);
   error = gd_error(D);
   gd_close(D);
diff --git a/test/madd_linterp.c b/test/madd_linterp.c
index 5abf216..ccb4400 100644
--- a/test/madd_linterp.c
+++ b/test/madd_linterp.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Add a LINTERP field */
 #include "test.h"
 
@@ -11,12 +31,14 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
   int error, ge_error, r = 0;
   gd_entry_t e;
+  DIRFILE *D;
 
-  DIRFILE* D = gd_open(filedir, GD_RDWR | GD_CREAT | GD_VERBOSE);
+  rmdirfile();
+  D = gd_open(filedir, GD_RDWR | GD_CREAT | GD_VERBOSE);
   gd_add_phase(D, "new", "in", 3, 0);
   gd_madd_linterp(D, "new", "meta", "in", "table");
   error = gd_error(D);
diff --git a/test/madd_linterp_invalid.c b/test/madd_linterp_invalid.c
index 8cf4f3c..0d5b054 100644
--- a/test/madd_linterp_invalid.c
+++ b/test/madd_linterp_invalid.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Getting data from an invalid dirfile should fail cleanly */
 #include "test.h"
 
@@ -9,10 +29,12 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
+  const char *filedir = "dirfile";
   int error, r = 0;
+  DIRFILE *D;
 
-  DIRFILE* D = gd_open(filedir, GD_RDONLY);
+  rmdirfile();
+  D = gd_open(filedir, GD_RDONLY);
   gd_madd_linterp(D, "new", "meta", "in", "table");
   error = gd_error(D);
   gd_close(D);
diff --git a/test/madd_mplex.c b/test/madd_mplex.c
new file mode 100644
index 0000000..bdee8b1
--- /dev/null
+++ b/test/madd_mplex.c
@@ -0,0 +1,59 @@
+/* Copyright (C) 2012 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+#include "test.h"
+
+int main(void)
+{
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  int error, r = 0;
+  gd_entry_t e;
+  DIRFILE *D;
+
+  rmdirfile();
+  D = gd_open(filedir, GD_RDWR | GD_CREAT | GD_VERBOSE);
+  gd_add_mplex(D, "new", "in", "count", 3, 4, 0);
+  gd_madd_mplex(D, "new", "meta", "in", "count", 5, 6);
+  error = gd_error(D);
+
+  /* check */
+  gd_entry(D, "new/meta", &e);
+  if (gd_error(D))
+    r = 1;
+  else {
+    CHECKI(e.field_type, GD_MPLEX_ENTRY);
+    CHECKS(e.in_fields[0], "in");
+    CHECKS(e.in_fields[1], "count");
+    CHECKI(e.fragment_index, 0);
+    CHECKI(e.EN(mplex,count_val), 5);
+    CHECKF(e.EN(mplex,period), 6);
+    gd_free_entry_strings(&e);
+  }
+
+  gd_close(D);
+
+  unlink(format);
+  rmdir(filedir);
+
+  CHECKI(error, GD_E_OK);
+
+  return r;
+}
diff --git a/test/madd_multiply.c b/test/madd_multiply.c
index a09669d..47f2c1e 100644
--- a/test/madd_multiply.c
+++ b/test/madd_multiply.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Add a MULTIPLY field */
 #include "test.h"
 
@@ -11,12 +31,14 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
   int error, ge_error, r = 0;
   gd_entry_t e;
+  DIRFILE *D;
 
-  DIRFILE* D = gd_open(filedir, GD_RDWR | GD_CREAT | GD_VERBOSE);
+  rmdirfile();
+  D = gd_open(filedir, GD_RDWR | GD_CREAT | GD_VERBOSE);
   gd_add_phase(D, "new", "in", 3, 0);
   gd_madd_multiply(D, "new", "meta", "in1", "in2");
   error = gd_error(D);
diff --git a/test/madd_multiply_invalid.c b/test/madd_multiply_invalid.c
index f9ee9e7..91d57f1 100644
--- a/test/madd_multiply_invalid.c
+++ b/test/madd_multiply_invalid.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Getting data from an invalid dirfile should fail cleanly */
 #include "test.h"
 
@@ -9,10 +29,12 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
+  const char *filedir = "dirfile";
   int error, r = 0;
+  DIRFILE *D;
 
-  DIRFILE* D = gd_open(filedir, GD_RDONLY);
+  rmdirfile();
+  D = gd_open(filedir, GD_RDONLY);
   gd_madd_multiply(D, "new", "meta", "in1", "in2");
   error = gd_error(D);
   gd_close(D);
diff --git a/test/madd_phase.c b/test/madd_phase.c
index f0d65e5..e322dde 100644
--- a/test/madd_phase.c
+++ b/test/madd_phase.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Add a PHASE field */
 #include "test.h"
 
@@ -11,18 +31,20 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
   int error, ge_error, r = 0;
   gd_entry_t e;
+  DIRFILE *D;
 
-  DIRFILE *D = gd_open(filedir, GD_RDWR | GD_CREAT | GD_VERBOSE);
+  rmdirfile();
+  D = gd_open(filedir, GD_RDWR | GD_CREAT | GD_VERBOSE);
   gd_add_phase(D, "new", "in", 3, 0);
   gd_madd_phase(D, "new", "meta", "in", 3);
   error = gd_error(D);
 
   /* check */
-  gd_entry(D, "new", &e);
+  gd_entry(D, "new/meta", &e);
   ge_error = gd_error(D);
   CHECKI(ge_error, 0);
   if (!r) {
diff --git a/test/madd_phase_invalid.c b/test/madd_phase_invalid.c
index e759cc6..54fa983 100644
--- a/test/madd_phase_invalid.c
+++ b/test/madd_phase_invalid.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Getting data from an invalid dirfile should fail cleanly */
 #include "test.h"
 
@@ -9,10 +29,12 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
+  const char *filedir = "dirfile";
   int error, r = 0;
+  DIRFILE *D;
 
-  DIRFILE* D = gd_open(filedir, GD_RDONLY);
+  rmdirfile();
+  D = gd_open(filedir, GD_RDONLY);
   gd_madd_phase(D, "new", "meta", "in", 3);
   error = gd_error(D);
   gd_close(D);
diff --git a/test/madd_polynom.c b/test/madd_polynom.c
index 5392c2c..e1a45a8 100644
--- a/test/madd_polynom.c
+++ b/test/madd_polynom.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2009-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Add a POLYNOM field */
 #include "test.h"
 
@@ -12,14 +32,16 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
   int j, error, ge_error, r = 0;
   gd_entry_t e;
-  const char* in_field = "in";
+  const char *in_field = "in";
   const double a[4] = {1, 0.3, 0.5, 1.8};
+  DIRFILE *D;
 
-  DIRFILE* D = gd_open(filedir, GD_RDWR | GD_CREAT | GD_VERBOSE);
+  rmdirfile();
+  D = gd_open(filedir, GD_RDWR | GD_CREAT | GD_VERBOSE);
   gd_add_phase(D, "new", "in", 3, 0);
   gd_madd_polynom(D, "new", "meta", 3, in_field, a);
   error = gd_error(D);
diff --git a/test/madd_recip.c b/test/madd_recip.c
index 2cba2d7..4d56a1b 100644
--- a/test/madd_recip.c
+++ b/test/madd_recip.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2010-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 #include "test.h"
 
 #include <stdlib.h>
@@ -10,12 +30,14 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
   int error, ge_error, r = 0;
   gd_entry_t e;
+  DIRFILE *D;
 
-  DIRFILE* D = gd_open(filedir, GD_RDWR | GD_CREAT | GD_VERBOSE);
+  rmdirfile();
+  D = gd_open(filedir, GD_RDWR | GD_CREAT | GD_VERBOSE);
   gd_add_phase(D, "new", "in", 3, 0);
   gd_madd_recip(D, "new", "meta", "in1", 3.2);
   error = gd_error(D);
diff --git a/test/madd_sbit.c b/test/madd_sbit.c
index 96f6006..fa2e393 100644
--- a/test/madd_sbit.c
+++ b/test/madd_sbit.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2009-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Add a BIT field */
 #include "test.h"
 
@@ -11,12 +31,14 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
   int error, ge_error, r = 0;
   gd_entry_t e;
+  DIRFILE *D;
 
-  DIRFILE* D = gd_open(filedir, GD_RDWR | GD_CREAT | GD_VERBOSE);
+  rmdirfile();
+  D = gd_open(filedir, GD_RDWR | GD_CREAT | GD_VERBOSE);
   gd_add_phase(D, "new", "in", 3, 0);
   gd_madd_sbit(D, "new", "meta", "input", 1, 1);
   error = gd_error(D);
diff --git a/test/madd_spec.c b/test/madd_spec.c
index dd213af..515f37c 100644
--- a/test/madd_spec.c
+++ b/test/madd_spec.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* gd_madd_spec() */
 #include "test.h"
 
@@ -11,13 +31,15 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
   int error, ge_error, n, r = 0;
   unsigned char val;
   gd_entry_t e;
+  DIRFILE *D;
 
-  DIRFILE* D = gd_open(filedir, GD_RDWR | GD_CREAT | GD_VERBOSE);
+  rmdirfile();
+  D = gd_open(filedir, GD_RDWR | GD_CREAT | GD_VERBOSE);
   gd_madd_spec(D, "meta CONST UINT8 2", "INDEX");
   error = gd_error(D);
 
diff --git a/test/madd_spec_directive.c b/test/madd_spec_directive.c
index 0ee076c..3692b2f 100644
--- a/test/madd_spec_directive.c
+++ b/test/madd_spec_directive.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Add a RAW field */
 #include "test.h"
 
@@ -10,11 +30,13 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
   int error, n, m, r = 0;
+  DIRFILE *D;
 
-  DIRFILE* D = gd_open(filedir, GD_RDWR | GD_CREAT);
+  rmdirfile();
+  D = gd_open(filedir, GD_RDWR | GD_CREAT);
   gd_madd_spec(D, "META INDEX RAW UINT8 2", "INDEX");
   error = gd_error(D);
 
diff --git a/test/madd_spec_invalid.c b/test/madd_spec_invalid.c
index 7b07996..0faca57 100644
--- a/test/madd_spec_invalid.c
+++ b/test/madd_spec_invalid.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Getting data from an invalid dirfile should fail cleanly */
 #include "test.h"
 
@@ -9,10 +29,12 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
+  const char *filedir = "dirfile";
   int error, r = 0;
+  DIRFILE *D;
 
-  DIRFILE* D = gd_open(filedir, GD_RDONLY);
+  rmdirfile();
+  D = gd_open(filedir, GD_RDONLY);
   gd_madd_spec(D, "data RAW UINT8 2", "INDEX");
   error = gd_error(D);
   gd_close(D);
diff --git a/test/madd_spec_resolv.c b/test/madd_spec_resolv.c
new file mode 100644
index 0000000..34a63f7
--- /dev/null
+++ b/test/madd_spec_resolv.c
@@ -0,0 +1,58 @@
+/* Copyright (C) 2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+#include "test.h"
+
+int main(void)
+{
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *data = "dirfile/data";
+  int error, i, n, r = 0;
+  DIRFILE *D;
+  const char *target;
+
+  rmdirfile();
+
+  D = gd_open(filedir, GD_RDWR | GD_CREAT | GD_VERBOSE);
+
+  gd_add_spec(D, "data RAW UINT8 1", 0);
+  gd_add_alias(D, "alias", "data/data", 0);
+  gd_madd_spec(D, "data CONST UINT8 1", "data");
+  error = gd_error(D);
+
+  /* check */
+  target = gd_alias_target(D, "alias");
+  CHECKS(target, "data/data");
+  i = gd_fragment_index(D, "alias");
+  n = gd_naliases(D, "alias");
+
+  gd_discard(D);
+
+  unlink(data);
+  unlink(format);
+  rmdir(filedir);
+
+  CHECKI(error, GD_E_OK);
+  CHECKI(i, 0);
+  CHECKI(n, 2);
+
+  return r;
+}
diff --git a/test/madd_string.c b/test/madd_string.c
index 67a29f7..f43f3e6 100644
--- a/test/madd_string.c
+++ b/test/madd_string.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2009-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Add a RAW field */
 #include "test.h"
 
@@ -12,13 +32,15 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
   int error, ge_error, r = 0;
   gd_entry_t e;
   char val[1000];
+  DIRFILE *D;
 
-  DIRFILE* D = gd_open(filedir, GD_RDWR | GD_CREAT | GD_VERBOSE);
+  rmdirfile();
+  D = gd_open(filedir, GD_RDWR | GD_CREAT | GD_VERBOSE);
   gd_add_phase(D, "new", "in", 3, 0);
   gd_madd_string(D, "new", "meta", "A string.");
   error = gd_error(D);
diff --git a/test/madd_window.c b/test/madd_window.c
new file mode 100644
index 0000000..2c9aa40
--- /dev/null
+++ b/test/madd_window.c
@@ -0,0 +1,70 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+/* Add a WINDOW field */
+#include "test.h"
+
+#include <stdlib.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <string.h>
+#include <errno.h>
+#include <stdio.h>
+
+int main(void)
+{
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  int error, ge_error, r = 0;
+  gd_entry_t e;
+  gd_triplet_t thresh;
+  DIRFILE *D;
+
+  rmdirfile();
+  D = gd_open(filedir, GD_RDWR | GD_CREAT | GD_VERBOSE);
+  thresh.r = 0.1;
+  gd_add_window(D, "new", "in", "check", GD_WINDOP_GT, thresh, 0);
+  thresh.u = 0x1F000;
+  gd_madd_window(D, "new", "meta", "in", "check", GD_WINDOP_CLR, thresh);
+  error = gd_error(D);
+
+  /* check */
+  gd_entry(D, "new/meta", &e);
+  ge_error = gd_error(D);
+  CHECKI(ge_error, 0);
+  if (!r) {
+    CHECKI(e.field_type, GD_WINDOW_ENTRY);
+    CHECKS(e.in_fields[0], "in");
+    CHECKS(e.in_fields[1], "check");
+    CHECKI(e.fragment_index, 0);
+    CHECKI(e.EN(window,windop), GD_WINDOP_CLR);
+    CHECKI(e.EN(window,threshold.u), 0x1F000);
+    gd_free_entry_strings(&e);
+  }
+
+  gd_close(D);
+
+  unlink(format);
+  rmdir(filedir);
+
+  CHECKI(error, GD_E_OK);
+  return r;
+}
diff --git a/test/move.c b/test/move.c
index 0a453e5..44eb725 100644
--- a/test/move.c
+++ b/test/move.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Test move */
 #include "test.h"
 
@@ -11,15 +31,16 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* format1 = __TEST__ "dirfile/format1";
-  const char* format_data = "INCLUDE format1\ndata RAW UINT8 11";
-  const char* format1_data = "#\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *format1 = "dirfile/format1";
+  const char *format_data = "INCLUDE format1\ndata RAW UINT8 11";
+  const char *format1_data = "#\n";
   int fd, ret, error, ge_ret, r = 0;
   gd_entry_t E;
   DIRFILE *D;
 
+  rmdirfile();
   mkdir(filedir, 0777);
 
   fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
diff --git a/test/move_affix.c b/test/move_affix.c
new file mode 100644
index 0000000..b719ea7
--- /dev/null
+++ b/test/move_affix.c
@@ -0,0 +1,71 @@
+/* Copyright (C) 2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+#include "test.h"
+
+int main(void)
+{
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *format1 = "dirfile/format1";
+  const char *format2 = "dirfile/format2";
+  const char *format_data =
+    "INCLUDE format1 A B\n"
+    "INCLUDE format2 C D\n";
+  const char *format1_data = "data RAW UINT8 11\n";
+  const char *format2_data = "#\n";
+  int fd, ret, error, ge_ret, r = 0;
+  gd_entry_t E;
+  DIRFILE *D;
+
+  rmdirfile();
+  mkdir(filedir, 0777);
+
+  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
+  write(fd, format_data, strlen(format_data));
+  close(fd);
+
+  fd = open(format1, O_CREAT | O_EXCL | O_WRONLY, 0666);
+  write(fd, format1_data, strlen(format1_data));
+  close(fd);
+
+  fd = open(format2, O_CREAT | O_EXCL | O_WRONLY, 0666);
+  write(fd, format2_data, strlen(format2_data));
+  close(fd);
+
+  D = gd_open(filedir, GD_RDWR | GD_UNENCODED | GD_VERBOSE);
+  ret = gd_move(D, "AdataB", 2, 0);
+  error = gd_error(D);
+  ge_ret =  gd_entry(D, "CdataD", &E);
+  gd_close(D);
+
+  unlink(format2);
+  unlink(format1);
+  unlink(format);
+  rmdir(filedir);
+
+  CHECKI(ret, 0);
+  CHECKI(error, GD_E_OK);
+  CHECKI(ge_ret, 0);
+  CHECKI(E.fragment_index, 2);
+  gd_free_entry_strings(&E);
+
+  return r;
+}
diff --git a/test/move_affix_dup.c b/test/move_affix_dup.c
new file mode 100644
index 0000000..f0ac7f3
--- /dev/null
+++ b/test/move_affix_dup.c
@@ -0,0 +1,59 @@
+/* Copyright (C) 2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+#include "test.h"
+
+int main(void)
+{
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *format1 = "dirfile/format1";
+  const char *format_data =
+    "INCLUDE format1 A B\n"
+    "INCLUDE format1 C D\n";
+  const char *format1_data = "data RAW UINT8 11\n";
+  int fd, ret, error, r = 0;
+  DIRFILE *D;
+
+  rmdirfile();
+  mkdir(filedir, 0777);
+
+  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
+  write(fd, format_data, strlen(format_data));
+  close(fd);
+
+  fd = open(format1, O_CREAT | O_EXCL | O_WRONLY, 0666);
+  write(fd, format1_data, strlen(format1_data));
+  close(fd);
+
+  D = gd_open(filedir, GD_RDWR | GD_UNENCODED);
+  ret = gd_move(D, "AdataB", 2, 0);
+  error = gd_error(D);
+  gd_close(D);
+
+  unlink(format1);
+  unlink(format);
+  rmdir(filedir);
+
+  CHECKI(ret, -1);
+  CHECKI(error, GD_E_DUPLICATE);
+
+  return r;
+}
diff --git a/test/move_alias.c b/test/move_alias.c
new file mode 100644
index 0000000..bf88eb4
--- /dev/null
+++ b/test/move_alias.c
@@ -0,0 +1,64 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+#include "test.h"
+
+int main(void)
+{
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *format1 = "dirfile/format1";
+  const char *format_data =
+    "INCLUDE format1\n"
+    "/ALIAS alias data\n"
+    "data RAW UINT8 11\n";
+  const char *format1_data = "#\n";
+  int fd, ret, error, fa, r = 0;
+  DIRFILE *D;
+
+  rmdirfile();
+  mkdir(filedir, 0777);
+
+  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
+  write(fd, format_data, strlen(format_data));
+  close(fd);
+
+  fd = open(format1, O_CREAT | O_EXCL | O_WRONLY, 0666);
+  write(fd, format1_data, strlen(format1_data));
+  close(fd);
+
+  D = gd_open(filedir, GD_RDWR | GD_UNENCODED | GD_VERBOSE);
+  ret = gd_move_alias(D, "alias", 1);
+  error = gd_error(D);
+  fa =  gd_fragment_index(D, "alias");
+  fd =  gd_fragment_index(D, "data");
+  gd_close(D);
+
+  unlink(format1);
+  unlink(format);
+  rmdir(filedir);
+
+  CHECKI(ret, 0);
+  CHECKI(error, GD_E_OK);
+  CHECKI(fa, 1);
+  CHECKI(fd, 0);
+
+  return r;
+}
diff --git a/test/move_data_enc_ar.c b/test/move_data_enc_ar.c
index 3e4fee4..30657ec 100644
--- a/test/move_data_enc_ar.c
+++ b/test/move_data_enc_ar.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Test move */
 #include "test.h"
 
@@ -12,14 +32,14 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* format1 = __TEST__ "dirfile/format1";
-  const char* data = __TEST__ "dirfile/data";
-  const char* txtdata = __TEST__ "dirfile/data.txt";
-  const char* format_data =
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *format1 = "dirfile/format1";
+  const char *data = "dirfile/data";
+  const char *txtdata = "dirfile/data.txt";
+  const char *format_data =
     "/INCLUDE format1\ndata RAW UINT16 11\nENCODING text\n";
-  const char* format1_data = "ENCODING none\n";
+  const char *format1_data = "ENCODING none\n";
   int r = 0;
   uint16_t d;
   int fd, i, ret, error, ge_ret, unlink_data, unlink_txtdata;
@@ -27,6 +47,7 @@ int main(void)
   gd_entry_t E;
   DIRFILE *D;
 
+  rmdirfile();
   mkdir(filedir, 0777);
 
   fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
diff --git a/test/move_data_enc_ra.c b/test/move_data_enc_ra.c
index 4973822..f84d8a7 100644
--- a/test/move_data_enc_ra.c
+++ b/test/move_data_enc_ra.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Test move */
 #include "test.h"
 
@@ -12,13 +32,13 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* format1 = __TEST__ "dirfile/format1";
-  const char* data = __TEST__ "dirfile/data";
-  const char* txtdata = __TEST__ "dirfile/data.txt";
-  const char* format_data = "/INCLUDE format1\ndata RAW UINT16 11";
-  const char* format1_data = "ENCODING text\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *format1 = "dirfile/format1";
+  const char *data = "dirfile/data";
+  const char *txtdata = "dirfile/data.txt";
+  const char *format_data = "/INCLUDE format1\ndata RAW UINT16 11";
+  const char *format1_data = "ENCODING text\n";
   uint16_t data_data[128];
   int r = 0;
   uint16_t d;
@@ -28,6 +48,7 @@ int main(void)
   gd_entry_t E;
   DIRFILE *D;
 
+  rmdirfile();
   mkdir(filedir, 0777);
 
   for (fd = 0; fd < 128; ++fd)
diff --git a/test/move_data_endian.c b/test/move_data_endian.c
index f3453ca..ebe7f69 100644
--- a/test/move_data_endian.c
+++ b/test/move_data_endian.c
@@ -1,5 +1,24 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Test move */
-#include "../src/config.h"
 #include "test.h"
 
 #include <stdlib.h>
@@ -13,21 +32,22 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* format1 = __TEST__ "dirfile/format1";
-  const char* data = __TEST__ "dirfile/data";
-  const char* format_data = "/INCLUDE format1\ndata RAW UINT16 11";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *format1 = "dirfile/format1";
+  const char *data = "dirfile/data";
+  const char *format_data = "/INCLUDE format1\ndata RAW UINT16 11";
 #ifdef WORDS_BIGENDIAN
-  const char* format1_data = "ENDIAN little\n";
+  const char *format1_data = "ENDIAN little\n";
 #else
-  const char* format1_data = "ENDIAN big\n";
+  const char *format1_data = "ENDIAN big\n";
 #endif
   uint16_t d, data_data[128];
   int fd, i, ret, error, ge_ret, r = 0;
   gd_entry_t E;
   DIRFILE *D;
 
+  rmdirfile();
   mkdir(filedir, 0777);
 
   for (fd = 0; fd < 128; ++fd)
diff --git a/test/move_data_foffs.c b/test/move_data_foffs.c
index 6f46d9f..fe0615a 100644
--- a/test/move_data_foffs.c
+++ b/test/move_data_foffs.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Test move */
 #include "test.h"
 
@@ -12,17 +32,18 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* format1 = __TEST__ "dirfile/format1";
-  const char* data = __TEST__ "dirfile/data";
-  const char* format_data = "/INCLUDE format1\ndata RAW UINT8 11";
-  const char* format1_data = "FRAMEOFFSET 1\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *format1 = "dirfile/format1";
+  const char *data = "dirfile/data";
+  const char *format_data = "/INCLUDE format1\ndata RAW UINT8 11";
+  const char *format1_data = "FRAMEOFFSET 1\n";
   uint8_t d, data_data[256];
   int fd, i, ret, error, ge_ret, r = 0;
   gd_entry_t E;
   DIRFILE *D;
 
+  rmdirfile();
   mkdir(filedir, 0777);
 
   for (fd = 0; fd < 256; ++fd)
diff --git a/test/move_data_nop.c b/test/move_data_nop.c
index 6eb10e6..7d778b5 100644
--- a/test/move_data_nop.c
+++ b/test/move_data_nop.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Test move */
 #include "test.h"
 
@@ -11,17 +31,18 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* format1 = __TEST__ "dirfile/format1";
-  const char* data = __TEST__ "dirfile/data";
-  const char* format_data = "/INCLUDE format1\ndata RAW UINT8 11";
-  const char* format1_data = "#\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *format1 = "dirfile/format1";
+  const char *data = "dirfile/data";
+  const char *format_data = "/INCLUDE format1\ndata RAW UINT8 11";
+  const char *format1_data = "#\n";
   unsigned char data_data[256];
   int fd, ret, error, ge_ret, r = 0;
   gd_entry_t E;
   DIRFILE *D;
 
+  rmdirfile();
   mkdir(filedir, 0777);
 
   for (fd = 0; fd < 256; ++fd)
diff --git a/test/move_index.c b/test/move_index.c
index d34df1c..8dc9a00 100644
--- a/test/move_index.c
+++ b/test/move_index.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Test move */
 #include "test.h"
 
@@ -11,15 +31,16 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* format1 = __TEST__ "dirfile/format1";
-  const char* format_data = "INCLUDE format1\ndata RAW UINT8 11";
-  const char* format1_data = "#\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *format1 = "dirfile/format1";
+  const char *format_data = "INCLUDE format1\ndata RAW UINT8 11";
+  const char *format1_data = "#\n";
   int fd, ret, error, ge_ret, r = 0;
   gd_entry_t E;
   DIRFILE *D;
 
+  rmdirfile();
   mkdir(filedir, 0777);
 
   fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
diff --git a/test/move_meta.c b/test/move_meta.c
index 134839d..3d26f68 100644
--- a/test/move_meta.c
+++ b/test/move_meta.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2009-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Test move */
 #include "test.h"
 
@@ -11,16 +31,17 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* format1 = __TEST__ "dirfile/format1";
-  const char* format_data = "INCLUDE format1\ndata RAW UINT8 11\n"
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *format1 = "dirfile/format1";
+  const char *format_data = "INCLUDE format1\ndata RAW UINT8 11\n"
     "data/meta CONST UINT8 11\n";
-  const char* format1_data = "#\n";
+  const char *format1_data = "#\n";
   int fd, ret, error, ge_ret, r = 0;
   gd_entry_t E;
   DIRFILE *D;
 
+  rmdirfile();
   mkdir(filedir, 0777);
 
   fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
diff --git a/test/move_protect.c b/test/move_protect.c
index 5e6ae1f..8a04e58 100644
--- a/test/move_protect.c
+++ b/test/move_protect.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Test move */
 #include "test.h"
 
@@ -11,15 +31,16 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* format1 = __TEST__ "dirfile/format1";
-  const char* format_data = "INCLUDE format1\ndata RAW UINT8 11";
-  const char* format1_data = "/PROTECT all\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *format1 = "dirfile/format1";
+  const char *format_data = "INCLUDE format1\ndata RAW UINT8 11";
+  const char *format1_data = "/PROTECT all\n";
   int fd, ret, error, ge_ret, r = 0;
   gd_entry_t E;
   DIRFILE *D;
 
+  rmdirfile();
   mkdir(filedir, 0777);
 
   fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
diff --git a/test/move_subdir.c b/test/move_subdir.c
index e8ba6a3..5c6b004 100644
--- a/test/move_subdir.c
+++ b/test/move_subdir.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Test move */
 #include "test.h"
 
@@ -11,20 +31,21 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* subdir = __TEST__ "dirfile/subdir";
-  const char* format = __TEST__ "dirfile/format";
-  const char* format1 = __TEST__ "dirfile/subdir/format1";
-  const char* data = __TEST__ "dirfile/data";
-  const char* new_data = __TEST__ "dirfile/subdir/data";
-  const char* format_data = "INCLUDE subdir/format1\ndata RAW UINT8 11\n";
-  const char* format1_data = "#\n";
+  const char *filedir = "dirfile";
+  const char *subdir = "dirfile/subdir";
+  const char *format = "dirfile/format";
+  const char *format1 = "dirfile/subdir/format1";
+  const char *data = "dirfile/data";
+  const char *new_data = "dirfile/subdir/data";
+  const char *format_data = "INCLUDE subdir/format1\ndata RAW UINT8 11\n";
+  const char *format1_data = "#\n";
   int fd, ret, error, ge_ret, unlink_data, unlink_new_data, r = 0;
   gd_entry_t E;
   DIRFILE *D;
 
+  rmdirfile();
   mkdir(filedir, 0777);
-  mkdirsub(subdir, 0777);
+  mkdir(subdir, 0777);
 
   fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
   write(fd, format_data, strlen(format_data));
diff --git a/test/name.c b/test/name.c
index 07ab0a1..7ddc93b 100644
--- a/test/name.c
+++ b/test/name.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2012 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Attempt to rename a field */
 #include "test.h"
 
@@ -11,18 +31,26 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* data = __TEST__ "dirfile/data";
-  const char* zata = __TEST__ "dirfile/zata";
-  const char* format_data = "cata RAW UINT8 8\ndata RAW UINT8 8\n"
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *data = "dirfile/data";
+  const char *zata = "dirfile/zata";
+  const char *format_data =
+    "early PHASE data 0\n"
+    "late PHASE data 0\n"
+    "/ALIAS bata data\n"
+    "cata RAW UINT8 8\n"
+    "data RAW UINT8 8\n"
     "eata RAW UINT8 8\n";
   unsigned char data_data[256];
-  int fd, ret, error, unlink_data, unlink_zata, r = 0;
+  int fd, ret, e1, e2, e3, e4, unlink_data, unlink_zata, r = 0;
   const char **fl;
-  char *field_list[4];
+  char *field_list[6];
+  char *s1, *s2, *s3;
   DIRFILE *D;
+  gd_entry_t E;
 
+  rmdirfile();
   mkdir(filedir, 0777);
 
   for (fd = 0; fd < 256; ++fd)
@@ -36,15 +64,36 @@ int main(void)
   write(fd, data_data, 256);
   close(fd);
 
-  D = gd_open(filedir, GD_RDWR | GD_VERBOSE);
+  D = gd_open(filedir, GD_RDWR);
+  gd_validate(D, "early");
   ret = gd_rename(D, "data", "zata", 0);
-  error = gd_error(D);
+  e1 = gd_error(D);
+  gd_spf(D, "early");
+  e2 = gd_error(D);
+  gd_spf(D, "late");
+  e3 = gd_error(D);
   fl = gd_field_list(D);
 
   field_list[0] = strdup(fl[0]);
   field_list[1] = strdup(fl[1]);
   field_list[2] = strdup(fl[2]);
   field_list[3] = strdup(fl[3]);
+  field_list[4] = strdup(fl[4]);
+  field_list[5] = strdup(fl[5]);
+
+  gd_entry(D, "early", &E);
+  s1 = E.in_fields[0];
+  E.in_fields[0] = NULL;
+  gd_free_entry_strings(&E);
+
+  gd_entry(D, "late", &E);
+  s2 = E.in_fields[0];
+  E.in_fields[0] = NULL;
+  gd_free_entry_strings(&E);
+
+  gd_entry(D, "bata", &E);
+  e4 = gd_error(D);
+  s3 = strdup(gd_alias_target(D, "bata"));
 
   gd_close(D);
 
@@ -53,18 +102,32 @@ int main(void)
   unlink(format);
   rmdir(filedir);
 
-  CHECKI(error,0);
+  CHECKI(e1,0);
+  CHECKI(e2,GD_E_BAD_CODE);
+  CHECKI(e3,GD_E_BAD_CODE);
+  CHECKI(e4,GD_E_BAD_CODE);
   CHECKI(ret,0);
   CHECKS(field_list[0], "INDEX");
   CHECKS(field_list[1], "cata");
-  CHECKS(field_list[2], "eata");
-  CHECKS(field_list[3], "zata");
+  CHECKS(field_list[2], "early");
+  CHECKS(field_list[3], "eata");
+  CHECKS(field_list[4], "late");
+  CHECKS(field_list[5], "zata");
   CHECKI(unlink_data, 0);
   CHECKI(unlink_zata, -1);
+  CHECKS(s1, "data");
+  CHECKS(s2, "data");
+  CHECKS(s3, "data");
+
+  free(s1);
+  free(s2);
+  free(s3);
   free(field_list[0]);
   free(field_list[1]);
   free(field_list[2]);
   free(field_list[3]);
+  free(field_list[4]);
+  free(field_list[5]);
 
   return r;
 }
diff --git a/test/name_affix.c b/test/name_affix.c
new file mode 100644
index 0000000..0c64a4e
--- /dev/null
+++ b/test/name_affix.c
@@ -0,0 +1,63 @@
+/* Copyright (C) 2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+#include "test.h"
+
+int main(void)
+{
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *format1 = "dirfile/format1";
+  const char *format_data = "/INCLUDE format1 A Z\n";
+  const char *format1_data = "data RAW UINT8 8\n";
+  int fd, ret, e1, e2, r = 0;
+  gd_entype_t type;
+  DIRFILE *D;
+
+  rmdirfile();
+  mkdir(filedir, 0777);
+
+  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
+  write(fd, format_data, strlen(format_data));
+  close(fd);
+
+  fd = open(format1, O_CREAT | O_EXCL | O_WRONLY, 0666);
+  write(fd, format1_data, strlen(format1_data));
+  close(fd);
+
+  D = gd_open(filedir, GD_RDWR | GD_VERBOSE);
+  ret = gd_rename(D, "AdataZ", "AzataZ", 0);
+  e1 = gd_error(D);
+  type = gd_entry_type(D, "AzataZ");
+  e2 = gd_error(D);
+
+  gd_close(D);
+
+  unlink(format);
+  unlink(format1);
+  rmdir(filedir);
+
+  CHECKI(e1,0);
+  CHECKI(e2,0);
+  CHECKI(ret,0);
+  CHECKI(type,GD_RAW_ENTRY);
+
+  return r;
+}
diff --git a/test/name_affix_bad.c b/test/name_affix_bad.c
new file mode 100644
index 0000000..d2a4aad
--- /dev/null
+++ b/test/name_affix_bad.c
@@ -0,0 +1,58 @@
+/* Copyright (C) 2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+#include "test.h"
+
+int main(void)
+{
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *format1 = "dirfile/format1";
+  const char *format_data = "/INCLUDE format1 A Z\n";
+  const char *format1_data = "data RAW UINT8 8\n";
+  int fd, ret, e1, r = 0;
+  DIRFILE *D;
+
+  rmdirfile();
+  mkdir(filedir, 0777);
+
+  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
+  write(fd, format_data, strlen(format_data));
+  close(fd);
+
+  fd = open(format1, O_CREAT | O_EXCL | O_WRONLY, 0666);
+  write(fd, format1_data, strlen(format1_data));
+  close(fd);
+
+  D = gd_open(filedir, GD_RDWR);
+  ret = gd_rename(D, "AdataZ", "zata", 0);
+  e1 = gd_error(D);
+
+  gd_close(D);
+
+  unlink(format);
+  unlink(format1);
+  rmdir(filedir);
+
+  CHECKI(e1,GD_E_BAD_CODE);
+  CHECKI(ret,-1);
+
+  return r;
+}
diff --git a/test/name_alias.c b/test/name_alias.c
new file mode 100644
index 0000000..67aba75
--- /dev/null
+++ b/test/name_alias.c
@@ -0,0 +1,173 @@
+/* Copyright (C) 2012 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+#include "test.h"
+
+#include <stdlib.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <string.h>
+#include <errno.h>
+#include <stdio.h>
+
+int main(void)
+{
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *data = "dirfile/data";
+  const char *zata = "dirfile/zata";
+  const char *format_data =
+    "early PHASE cata 0\n"
+    "earlya PHASE data 0\n"
+    "/ALIAS aata cata\n"
+    "/ALIAS bata data\n"
+    "late PHASE cata 0\n"
+    "latea PHASE data 0\n"
+    "cata RAW UINT8 8\n"
+    "/ALIAS data cata\n"
+    "eata RAW UINT8 8\n";
+  unsigned char data_data[256];
+  int fd, ret, e0, e1, e2, e3, e4, e5, e6, unlink_data, unlink_zata, r = 0;
+  const char **fl;
+  char *field_list[9];
+  char *s1, *s2, *s3, *s4, *s5, *s6;
+  DIRFILE *D;
+  gd_entry_t E;
+
+  rmdirfile();
+  mkdir(filedir, 0777);
+
+  for (fd = 0; fd < 256; ++fd)
+    data_data[fd] = (unsigned char)fd;
+
+  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
+  write(fd, format_data, strlen(format_data));
+  close(fd);
+
+  fd = open(data, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
+  write(fd, data_data, 256);
+  close(fd);
+
+  D = gd_open(filedir, GD_RDWR);
+  gd_validate(D, "early");
+  gd_validate(D, "earlya");
+  ret = gd_rename(D, "data", "zata", 0);
+  e0 = gd_error(D);
+  gd_spf(D, "early");
+  e1 = gd_error(D);
+  gd_spf(D, "late");
+  e2 = gd_error(D);
+  gd_spf(D, "earlya");
+  e3 = gd_error(D);
+  gd_spf(D, "latea");
+  e4 = gd_error(D);
+  fl = gd_field_list(D);
+
+  field_list[0] = strdup(fl[0]);
+  field_list[1] = strdup(fl[1]);
+  field_list[2] = strdup(fl[2]);
+  field_list[3] = strdup(fl[3]);
+  field_list[4] = strdup(fl[4]);
+  field_list[5] = strdup(fl[5]);
+  field_list[6] = strdup(fl[6]);
+  field_list[7] = strdup(fl[7]);
+  field_list[8] = strdup(fl[8]);
+
+  gd_entry(D, "early", &E);
+  s1 = E.in_fields[0];
+  E.in_fields[0] = NULL;
+  gd_free_entry_strings(&E);
+
+  gd_entry(D, "earlya", &E);
+  s2 = E.in_fields[0];
+  E.in_fields[0] = NULL;
+  gd_free_entry_strings(&E);
+
+  gd_entry(D, "late", &E);
+  s3 = E.in_fields[0];
+  E.in_fields[0] = NULL;
+  gd_free_entry_strings(&E);
+
+  gd_entry(D, "latea", &E);
+  s4 = E.in_fields[0];
+  E.in_fields[0] = NULL;
+  gd_free_entry_strings(&E);
+
+  gd_entry(D, "aata", &E);
+  e5 = gd_error(D);
+  s5 = strdup(gd_alias_target(D, "aata"));
+  gd_free_entry_strings(&E);
+
+  gd_entry(D, "bata", &E);
+  e6 = gd_error(D);
+  s6 = strdup(gd_alias_target(D, "bata"));
+
+  gd_close(D);
+
+  unlink_data = unlink(data);
+  unlink_zata = unlink(zata);
+  unlink(format);
+  rmdir(filedir);
+
+  CHECKI(e0,0);
+  CHECKI(e1,0);
+  CHECKI(e2,0);
+  CHECKI(e3,GD_E_BAD_CODE);
+  CHECKI(e4,GD_E_BAD_CODE);
+  CHECKI(e5,0);
+  CHECKI(e6,GD_E_BAD_CODE);
+  CHECKI(ret,0);
+  CHECKS(field_list[0], "INDEX");
+  CHECKS(field_list[1], "aata");
+  CHECKS(field_list[2], "cata");
+  CHECKS(field_list[3], "early");
+  CHECKS(field_list[4], "earlya");
+  CHECKS(field_list[5], "eata");
+  CHECKS(field_list[6], "late");
+  CHECKS(field_list[7], "latea");
+  CHECKS(field_list[8], "zata");
+  CHECKI(unlink_data, 0);
+  CHECKI(unlink_zata, -1);
+  CHECKS(s1, "cata");
+  CHECKS(s2, "data");
+  CHECKS(s3, "cata");
+  CHECKS(s4, "data");
+  CHECKS(s5, "cata");
+  CHECKS(s6, "data");
+
+  free(field_list[0]);
+  free(field_list[1]);
+  free(field_list[2]);
+  free(field_list[3]);
+  free(field_list[4]);
+  free(field_list[5]);
+  free(field_list[6]);
+  free(field_list[7]);
+  free(field_list[8]);
+  free(s1);
+  free(s2);
+  free(s3);
+  free(s4);
+  free(s5);
+  free(s6);
+
+  return r;
+}
diff --git a/test/name_dup.c b/test/name_dup.c
new file mode 100644
index 0000000..d654a21
--- /dev/null
+++ b/test/name_dup.c
@@ -0,0 +1,51 @@
+/* Copyright (C) 2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+#include "test.h"
+
+int main(void)
+{
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *format_data = "data RAW UINT8 8\nzata RAW UINT8 1\n";
+  int fd, ret, e1, r = 0;
+  DIRFILE *D;
+
+  rmdirfile();
+  mkdir(filedir, 0777);
+
+  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
+  write(fd, format_data, strlen(format_data));
+  close(fd);
+
+  D = gd_open(filedir, GD_RDWR);
+  ret = gd_rename(D, "data", "zata", 0);
+  e1 = gd_error(D);
+
+  gd_close(D);
+
+  unlink(format);
+  rmdir(filedir);
+
+  CHECKI(e1,GD_E_DUPLICATE);
+  CHECKI(ret,-1);
+
+  return r;
+}
diff --git a/test/name_move.c b/test/name_move.c
index 5b0a4c3..3b0c9ee 100644
--- a/test/name_move.c
+++ b/test/name_move.c
@@ -1,21 +1,32 @@
-/* Attempt to rename a field */
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 #include "test.h"
 
-#include <stdlib.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-#include <string.h>
-#include <errno.h>
-#include <stdio.h>
-
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* data = __TEST__ "dirfile/data";
-  const char* zata = __TEST__ "dirfile/zata";
-  const char* format_data = "cata RAW UINT8 8\ndata RAW UINT8 8\n"
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *data = "dirfile/data";
+  const char *zata = "dirfile/zata";
+  const char *format_data = "cata RAW UINT8 8\ndata RAW UINT8 8\n"
     "eata RAW UINT8 8\n";
   unsigned char data_data[256];
   int fd, ret, error, unlink_data, unlink_zata, r = 0;
@@ -23,6 +34,7 @@ int main(void)
   char *field_list[4];
   DIRFILE *D;
 
+  rmdirfile();
   mkdir(filedir, 0777);
 
   for (fd = 0; fd < 256; ++fd)
@@ -37,7 +49,7 @@ int main(void)
   close(fd);
 
   D = gd_open(filedir, GD_RDWR | GD_VERBOSE);
-  ret = gd_rename(D, "data", "zata", 1);
+  ret = gd_rename(D, "data", "zata", GD_REN_DATA);
   error = gd_error(D);
   fl = gd_field_list(D);
 
diff --git a/test/name_move_alias.c b/test/name_move_alias.c
new file mode 100644
index 0000000..95325b9
--- /dev/null
+++ b/test/name_move_alias.c
@@ -0,0 +1,82 @@
+/* Copyright (C) 2012 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+#include "test.h"
+
+int main(void)
+{
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *data = "dirfile/data";
+  const char *zata = "dirfile/zata";
+  const char *format_data = "cata RAW UINT8 8\n/ALIAS data cata\n"
+    "eata RAW UINT8 8\n";
+  unsigned char data_data[256];
+  int fd, ret, error, unlink_data, unlink_zata, r = 0;
+  const char **fl;
+  char *field_list[4];
+  DIRFILE *D;
+
+  rmdirfile();
+  mkdir(filedir, 0777);
+
+  for (fd = 0; fd < 256; ++fd)
+    data_data[fd] = (unsigned char)fd;
+
+  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
+  write(fd, format_data, strlen(format_data));
+  close(fd);
+
+  fd = open(data, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
+  write(fd, data_data, 256);
+  close(fd);
+
+  D = gd_open(filedir, GD_RDWR | GD_VERBOSE);
+  ret = gd_rename(D, "data", "zata", GD_REN_DATA);
+  error = gd_error(D);
+  fl = gd_field_list(D);
+
+  field_list[0] = strdup(fl[0]);
+  field_list[1] = strdup(fl[1]);
+  field_list[2] = strdup(fl[2]);
+  field_list[3] = strdup(fl[3]);
+
+  gd_close(D);
+
+  unlink_data = unlink(data);
+  unlink_zata = unlink(zata);
+  unlink(format);
+  rmdir(filedir);
+
+  CHECKI(error, 0);
+  CHECKI(ret, 0);
+  CHECKS(field_list[0], "INDEX");
+  CHECKS(field_list[1], "cata");
+  CHECKS(field_list[2], "eata");
+  CHECKS(field_list[3], "zata");
+  CHECKI(unlink_data, 0);
+  CHECKI(unlink_zata, -1);
+  free(field_list[0]);
+  free(field_list[1]);
+  free(field_list[2]);
+  free(field_list[3]);
+
+  return r;
+}
diff --git a/test/name_updb.c b/test/name_updb.c
new file mode 100644
index 0000000..f3d8524
--- /dev/null
+++ b/test/name_updb.c
@@ -0,0 +1,86 @@
+/* Copyright (C) 2011-2012 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+#include "test.h"
+
+int main(void)
+{
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *format_data = 
+    "early PHASE data 0\n"
+    "late PHASE data 0\n"
+    "/ALIAS bata data\n"
+    "data RAW UINT8 8\n";
+  int fd, e1, e2, e3, e4, r = 0;
+  char *s1, *s2, *s3;
+  DIRFILE *D;
+  gd_entry_t E;
+
+  rmdirfile();
+  mkdir(filedir, 0777);
+
+  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
+  write(fd, format_data, strlen(format_data));
+  close(fd);
+
+  D = gd_open(filedir, GD_RDWR);
+  gd_validate(D, "early");
+  gd_rename(D, "data", "zata", GD_REN_UPDB);
+  e1 = gd_error(D);
+  gd_spf(D, "early");
+  e2 = gd_error(D);
+  gd_spf(D, "late");
+  e3 = gd_error(D);
+
+  gd_entry(D, "early", &E);
+  s1 = E.in_fields[0];
+  E.in_fields[0] = NULL;
+  gd_free_entry_strings(&E);
+
+  gd_entry(D, "late", &E);
+  s2 = E.in_fields[0];
+  E.in_fields[0] = NULL;
+  gd_free_entry_strings(&E);
+
+  gd_entry(D, "bata", &E);
+  e4 = gd_error(D);
+  s3 = strdup(gd_alias_target(D, "bata"));
+  gd_free_entry_strings(&E);
+
+  gd_discard(D);
+
+  unlink(format);
+  rmdir(filedir);
+
+  CHECKI(e1,0);
+  CHECKI(e2,0);
+  CHECKI(e3,0);
+  CHECKI(e4,0);
+  CHECKS(s1, "zata");
+  CHECKS(s2, "zata");
+  CHECKS(s3, "zata");
+
+  free(s1);
+  free(s2);
+  free(s3);
+
+  return r;
+}
diff --git a/test/name_updb_alias.c b/test/name_updb_alias.c
new file mode 100644
index 0000000..ba471f4
--- /dev/null
+++ b/test/name_updb_alias.c
@@ -0,0 +1,119 @@
+/* Copyright (C) 2012 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+#include "test.h"
+
+int main(void)
+{
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *format_data = 
+    "early  PHASE cata 0\n"
+    "earlya PHASE data 0\n"
+    "/ALIAS aata cata\n"
+    "/ALIAS bata data\n"
+    "late   PHASE cata 0\n"
+    "latea  PHASE data 0\n"
+    "cata RAW UINT8 8\n"
+    "/ALIAS data cata\n";
+  int fd, e0, e1, e2, e3, e4, e5, e6, r = 0;
+  char *s1, *s2, *s3, *s4, *s5, *s6;
+  gd_entry_t E;
+  DIRFILE *D;
+
+  rmdirfile();
+  mkdir(filedir, 0777);
+
+  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
+  write(fd, format_data, strlen(format_data));
+  close(fd);
+
+  D = gd_open(filedir, GD_RDWR);
+  gd_validate(D, "early");
+  gd_validate(D, "earlya");
+  gd_rename(D, "data", "zata", GD_REN_UPDB);
+  e0 = gd_error(D);
+  gd_spf(D, "early");
+  e1 = gd_error(D);
+  gd_spf(D, "earlya");
+  e2 = gd_error(D);
+  gd_spf(D, "late");
+  e3 = gd_error(D);
+  gd_spf(D, "latea");
+  e4 = gd_error(D);
+
+  gd_entry(D, "early", &E);
+  s1 = E.in_fields[0];
+  E.in_fields[0] = NULL;
+  gd_free_entry_strings(&E);
+
+  gd_entry(D, "earlya", &E);
+  s2 = E.in_fields[0];
+  E.in_fields[0] = NULL;
+  gd_free_entry_strings(&E);
+
+  gd_entry(D, "late", &E);
+  s3 = E.in_fields[0];
+  E.in_fields[0] = NULL;
+  gd_free_entry_strings(&E);
+
+  gd_entry(D, "latea", &E);
+  s4 = E.in_fields[0];
+  E.in_fields[0] = NULL;
+  gd_free_entry_strings(&E);
+
+  gd_entry(D, "aata", &E);
+  e5 = gd_error(D);
+  s5 = strdup(gd_alias_target(D, "aata"));
+  gd_free_entry_strings(&E);
+
+  gd_entry(D, "bata", &E);
+  e6 = gd_error(D);
+  s6 = strdup(gd_alias_target(D, "bata"));
+  gd_free_entry_strings(&E);
+
+  gd_discard(D);
+
+  unlink(format);
+  rmdir(filedir);
+
+  CHECKI(e0,0);
+  CHECKI(e1,0);
+  CHECKI(e2,0);
+  CHECKI(e3,0);
+  CHECKI(e4,0);
+  CHECKI(e5,0);
+  CHECKI(e6,0);
+  CHECKS(s1, "cata");
+  CHECKS(s2, "zata");
+  CHECKS(s3, "cata");
+  CHECKS(s4, "zata");
+  CHECKS(s5, "cata");
+  CHECKS(s6, "zata");
+
+  free(s1);
+  free(s2);
+  free(s3);
+  free(s4);
+  free(s5);
+  free(s6);
+
+  return r;
+}
diff --git a/test/name_updb_const.c b/test/name_updb_const.c
new file mode 100644
index 0000000..f366e4a
--- /dev/null
+++ b/test/name_updb_const.c
@@ -0,0 +1,86 @@
+/* Copyright (C) 2011-2012 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+#include "test.h"
+
+int main(void)
+{
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *format_data = 
+    "early RAW UINT8 c\n"
+    "late RAW UINT8 c\n"
+    "/ALIAS b c\n"
+    "c CONST UINT8 2\n";
+  int fd, e1, e2, e3, e4, r = 0;
+  char *s1, *s2, *s3;
+  DIRFILE *D;
+  gd_entry_t E;
+
+  rmdirfile();
+  mkdir(filedir, 0777);
+
+  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
+  write(fd, format_data, strlen(format_data));
+  close(fd);
+
+  D = gd_open(filedir, GD_RDWR);
+  gd_validate(D, "early");
+  gd_rename(D, "c", "d", GD_REN_UPDB);
+  e1 = gd_error(D);
+  gd_spf(D, "early");
+  e2 = gd_error(D);
+  gd_spf(D, "late");
+  e3 = gd_error(D);
+
+  gd_entry(D, "early", &E);
+  s1 = E.scalar[0];
+  E.scalar[0] = NULL;
+  gd_free_entry_strings(&E);
+
+  gd_entry(D, "late", &E);
+  s2 = E.scalar[0];
+  E.scalar[0] = NULL;
+  gd_free_entry_strings(&E);
+
+  gd_entry(D, "b", &E);
+  e4 = gd_error(D);
+  s3 = strdup(gd_alias_target(D, "b"));
+  gd_free_entry_strings(&E);
+
+  gd_discard(D);
+
+  unlink(format);
+  rmdir(filedir);
+
+  CHECKI(e1,0);
+  CHECKI(e2,0);
+  CHECKI(e3,0);
+  CHECKI(e4,0);
+  CHECKS(s1, "d");
+  CHECKS(s2, "d");
+  CHECKS(s3, "d");
+
+  free(s1);
+  free(s2);
+  free(s3);
+
+  return r;
+}
diff --git a/test/name_updb_const_alias.c b/test/name_updb_const_alias.c
new file mode 100644
index 0000000..1ea7c00
--- /dev/null
+++ b/test/name_updb_const_alias.c
@@ -0,0 +1,87 @@
+/* Copyright (C) 2012 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+#include "test.h"
+
+int main(void)
+{
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *format_data = 
+    "early RAW UINT8 c\n"
+    "late RAW UINT8 c\n"
+    "/ALIAS b c\n"
+    "e CONST UINT8 2\n"
+    "/ALIAS c e\n";
+  int fd, e1, e2, e3, e4, r = 0;
+  char *s1, *s2, *s3;
+  DIRFILE *D;
+  gd_entry_t E;
+
+  rmdirfile();
+  mkdir(filedir, 0777);
+
+  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
+  write(fd, format_data, strlen(format_data));
+  close(fd);
+
+  D = gd_open(filedir, GD_RDWR);
+  gd_validate(D, "early");
+  gd_rename(D, "c", "d", GD_REN_UPDB);
+  e1 = gd_error(D);
+  gd_spf(D, "early");
+  e2 = gd_error(D);
+  gd_spf(D, "late");
+  e3 = gd_error(D);
+
+  gd_entry(D, "early", &E);
+  s1 = E.scalar[0];
+  E.scalar[0] = NULL;
+  gd_free_entry_strings(&E);
+
+  gd_entry(D, "late", &E);
+  s2 = E.scalar[0];
+  E.scalar[0] = NULL;
+  gd_free_entry_strings(&E);
+
+  gd_entry(D, "b", &E);
+  e4 = gd_error(D);
+  s3 = strdup(gd_alias_target(D, "b"));
+  gd_free_entry_strings(&E);
+
+  gd_discard(D);
+
+  unlink(format);
+  rmdir(filedir);
+
+  CHECKI(e1,0);
+  CHECKI(e2,0);
+  CHECKI(e3,0);
+  CHECKI(e4,0);
+  CHECKS(s1, "d");
+  CHECKS(s2, "d");
+  CHECKS(s3, "d");
+
+  free(s1);
+  free(s2);
+  free(s3);
+
+  return r;
+}
diff --git a/test/nentries_alias.c b/test/nentries_alias.c
new file mode 100644
index 0000000..0ee52a0
--- /dev/null
+++ b/test/nentries_alias.c
@@ -0,0 +1,61 @@
+/* Copyright (C) 2012 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+#include "test.h"
+
+#include <stdlib.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <string.h>
+#include <errno.h>
+
+int main(void)
+{
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *format_data =
+    "data1 RAW UINT8 1\n"
+    "/ALIAS data2 data1\n"
+    "/ALIAS data3 data4\n";
+  int fd, error, r = 0;
+  unsigned int nfields;
+  DIRFILE *D;
+
+  rmdirfile();
+  mkdir(filedir, 0777);
+
+  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
+  write(fd, format_data, strlen(format_data));
+  close(fd);
+
+  D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
+  nfields = gd_nentries(D, NULL, GD_ALIAS_ENTRIES, 0);
+  error = gd_error(D);
+  gd_close(D);
+
+  unlink(format);
+  rmdir(filedir);
+
+  CHECKI(error, 0);
+  CHECKI(nfields, 2);
+
+  return r;
+}
diff --git a/test/nentries_hidden.c b/test/nentries_hidden.c
new file mode 100644
index 0000000..90a2d42
--- /dev/null
+++ b/test/nentries_hidden.c
@@ -0,0 +1,66 @@
+/* Copyright (C) 2012 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+#include "test.h"
+
+int main(void)
+{
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *format_data =
+    "raw1 RAW UINT8 1\n"
+    "META raw1 linterp1 LINTERP raw2 table\n"
+    "META raw1 linterp2 LINTERP raw3 table\n"
+    "META raw1 linterp3 LINTERP raw4 table\n"
+    "META raw1 const CONST UINT8 1\n"
+    "META raw1 string STRING value\n"
+    "META raw1 string2 STRING value\n"
+    "/HIDDEN raw1\n"
+    "/HIDDEN raw1/const\n"
+    "raw2 RAW UINT8 1\n"
+    "raw3 RAW UINT8 1\n"
+    "raw4 RAW UINT8 1\n"
+    "const CONST UINT8 1\n"
+    "string STRING value\n"
+    "string2 STRING value\n";
+  int fd, error, r = 0;
+  unsigned int nfields;
+  DIRFILE *D;
+
+  rmdirfile();
+  mkdir(filedir, 0777);
+
+  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
+  write(fd, format_data, strlen(format_data));
+  close(fd);
+
+  D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
+  nfields = gd_nentries(D, NULL, GD_ALL_ENTRIES, GD_ENTRIES_HIDDEN);
+  error = gd_error(D);
+  gd_close(D);
+
+  unlink(format);
+  rmdir(filedir);
+
+  CHECKI(error, 0);
+  CHECKI(nfields, 8);
+
+  return r;
+}
diff --git a/test/nentries_noalias.c b/test/nentries_noalias.c
new file mode 100644
index 0000000..d27ece8
--- /dev/null
+++ b/test/nentries_noalias.c
@@ -0,0 +1,66 @@
+/* Copyright (C) 2012 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+#include "test.h"
+
+int main(void)
+{
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *format_data =
+    "raw1 RAW UINT8 1\n"
+    "META raw1 linterp1 LINTERP raw2 table\n"
+    "META raw1 linterp2 LINTERP raw3 table\n"
+    "META raw1 linterp3 LINTERP raw4 table\n"
+    "META raw1 const CONST UINT8 1\n"
+    "META raw1 string STRING value\n"
+    "META raw1 string2 STRING value\n"
+    "/ALIAS raw0 raw1\n"
+    "/ALIAS raw1/const2 raw1/const\n"
+    "raw2 RAW UINT8 1\n"
+    "raw3 RAW UINT8 1\n"
+    "raw4 RAW UINT8 1\n"
+    "const CONST UINT8 1\n"
+    "string STRING value\n"
+    "string2 STRING value\n";
+  int fd, error, r = 0;
+  unsigned int nfields;
+  DIRFILE *D;
+
+  rmdirfile();
+  mkdir(filedir, 0777);
+
+  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
+  write(fd, format_data, strlen(format_data));
+  close(fd);
+
+  D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
+  nfields = gd_nentries(D, NULL, GD_ALL_ENTRIES, GD_ENTRIES_NOALIAS);
+  error = gd_error(D);
+  gd_close(D);
+
+  unlink(format);
+  rmdir(filedir);
+
+  CHECKI(error, 0);
+  CHECKI(nfields, 8);
+
+  return r;
+}
diff --git a/test/nentries_scalar.c b/test/nentries_scalar.c
new file mode 100644
index 0000000..aa0e240
--- /dev/null
+++ b/test/nentries_scalar.c
@@ -0,0 +1,66 @@
+/* Copyright (C) 2012 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+#include "test.h"
+
+int main(void)
+{
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *format_data =
+    "raw1 RAW UINT8 1\n"
+    "META raw1 linterp1 LINTERP raw2 table\n"
+    "META raw1 linterp2 LINTERP raw3 table\n"
+    "META raw1 linterp3 LINTERP raw4 table\n"
+    "META raw1 const CONST UINT8 1\n"
+    "META raw1 string STRING value\n"
+    "META raw1 string2 STRING value\n"
+    "/HIDDEN raw1\n"
+    "/HIDDEN raw1/const\n"
+    "raw2 RAW UINT8 1\n"
+    "raw3 RAW UINT8 1\n"
+    "raw4 RAW UINT8 1\n"
+    "const CONST UINT8 1\n"
+    "string STRING value\n"
+    "string2 STRING value\n";
+  int fd, error, r = 0;
+  unsigned int nfields;
+  DIRFILE *D;
+
+  rmdirfile();
+  mkdir(filedir, 0777);
+
+  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
+  write(fd, format_data, strlen(format_data));
+  close(fd);
+
+  D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
+  nfields = gd_nentries(D, NULL, GD_SCALAR_ENTRIES, 0);
+  error = gd_error(D);
+  gd_close(D);
+
+  unlink(format);
+  rmdir(filedir);
+
+  CHECKI(error, 0);
+  CHECKI(nfields, 3);
+
+  return r;
+}
diff --git a/test/nfields.c b/test/nfields.c
index db02a27..a3cc2fd 100644
--- a/test/nfields.c
+++ b/test/nfields.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Retreiving the number of fields of a field should succeed cleanly */
 #include "test.h"
 
@@ -10,9 +30,9 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* format_data =
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *format_data =
     "raw1 RAW UINT8 1\n"
     "META raw1 linterp1 LINTERP raw2 table\n"
     "META raw1 linterp2 LINTERP raw3 table\n"
@@ -30,6 +50,7 @@ int main(void)
   unsigned int nfields;
   DIRFILE *D;
 
+  rmdirfile();
   mkdir(filedir, 0777);
 
   fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
diff --git a/test/nfields_hidden.c b/test/nfields_hidden.c
new file mode 100644
index 0000000..eb1c6ea
--- /dev/null
+++ b/test/nfields_hidden.c
@@ -0,0 +1,66 @@
+/* Copyright (C) 2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+#include "test.h"
+
+int main(void)
+{
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *format_data =
+    "raw1 RAW UINT8 1\n"
+    "META raw1 linterp1 LINTERP raw2 table\n"
+    "META raw1 linterp2 LINTERP raw3 table\n"
+    "META raw1 linterp3 LINTERP raw4 table\n"
+    "META raw1 const CONST UINT8 1\n"
+    "META raw1 string STRING value\n"
+    "META raw1 string2 STRING value\n"
+    "/HIDDEN raw1\n"
+    "/HIDDEN raw1/const\n"
+    "raw2 RAW UINT8 1\n"
+    "raw3 RAW UINT8 1\n"
+    "raw4 RAW UINT8 1\n"
+    "const CONST UINT8 1\n"
+    "string STRING value\n"
+    "string2 STRING value\n";
+  int fd, error, r = 0;
+  unsigned int nfields;
+  DIRFILE *D;
+
+  rmdirfile();
+  mkdir(filedir, 0777);
+
+  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
+  write(fd, format_data, strlen(format_data));
+  close(fd);
+
+  D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
+  nfields = gd_nfields(D);
+  error = gd_error(D);
+  gd_close(D);
+
+  unlink(format);
+  rmdir(filedir);
+
+  CHECKI(error, 0);
+  CHECKI(nfields, 7);
+
+  return r;
+}
diff --git a/test/nfields_invalid.c b/test/nfields_invalid.c
index fdad67a..ba1d615 100644
--- a/test/nfields_invalid.c
+++ b/test/nfields_invalid.c
@@ -1,4 +1,25 @@
-/* Requesting the number of fields from an invalid dirfile should fail cleanly */
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+/* Requesting the number of fields from an invalid dirfile should fail cleanly
+ */
 #include "test.h"
 
 #include <stdlib.h>
@@ -9,12 +30,15 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  int r = 0;
+  const char *filedir = "dirfile";
+  int error, r = 0;
+  DIRFILE *D;
+  unsigned int n;
 
-  DIRFILE* D = gd_open(filedir, GD_RDONLY);
-  unsigned int n = gd_nfields(D);
-  int error = gd_error(D);
+  rmdirfile();
+  D = gd_open(filedir, GD_RDONLY);
+  n = gd_nfields(D);
+  error = gd_error(D);
   gd_close(D);
 
   CHECKI(n, 0);
diff --git a/test/nfields_type.c b/test/nfields_type.c
index a220fec..010ff59 100644
--- a/test/nfields_type.c
+++ b/test/nfields_type.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Retreiving the number of fields of a field should succeed cleanly */
 #include "test.h"
 
@@ -10,9 +30,9 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* format_data =
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *format_data =
     "raw1 RAW UINT8 1\n"
     "META raw1 linterp1 LINTERP raw2 table\n"
     "META raw1 linterp2 LINTERP raw3 table\n"
@@ -30,6 +50,7 @@ int main(void)
   unsigned int nfields;
   DIRFILE *D;
 
+  rmdirfile();
   mkdir(filedir, 0777);
 
   fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
diff --git a/test/nfields_type_hidden.c b/test/nfields_type_hidden.c
new file mode 100644
index 0000000..c9fdd03
--- /dev/null
+++ b/test/nfields_type_hidden.c
@@ -0,0 +1,65 @@
+/* Copyright (C) 2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+#include "test.h"
+
+int main(void)
+{
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *format_data =
+    "raw1 RAW UINT8 1\n"
+    "META raw1 linterp1 LINTERP raw2 table\n"
+    "META raw1 linterp2 LINTERP raw3 table\n"
+    "META raw1 linterp3 LINTERP raw4 table\n"
+    "META raw1 const CONST UINT8 1\n"
+    "META raw1 string STRING value\n"
+    "META raw1 string2 STRING value\n"
+    "raw2 RAW UINT8 1\n"
+    "raw3 RAW UINT8 1\n"
+    "raw4 RAW UINT8 1\n"
+    "const CONST UINT8 1\n"
+    "string STRING value\n"
+    "/HIDDEN string\n"
+    "string2 STRING value\n";
+  int fd, error, r = 0;
+  unsigned int nfields;
+  DIRFILE *D;
+
+  rmdirfile();
+  mkdir(filedir, 0777);
+
+  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
+  write(fd, format_data, strlen(format_data));
+  close(fd);
+
+  D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
+  nfields = gd_nfields_by_type(D, GD_STRING_ENTRY);
+  error = gd_error(D);
+  gd_close(D);
+
+  unlink(format);
+  rmdir(filedir);
+
+  CHECKI(error, 0);
+  CHECKI(nfields, 1);
+
+  return r;
+}
diff --git a/test/nfields_type_invalid.c b/test/nfields_type_invalid.c
index 081ec9d..3377e25 100644
--- a/test/nfields_type_invalid.c
+++ b/test/nfields_type_invalid.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Requesting the number of fields from an invalid dirfile should fail cleanly */
 #include "test.h"
 
@@ -9,12 +29,15 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  int r = 0;
+  const char *filedir = "dirfile";
+  int error, r = 0;
+  DIRFILE *D;
+  unsigned int n;
 
-  DIRFILE* D = gd_open(filedir, GD_RDONLY);
-  unsigned int n = gd_nfields_by_type(D, GD_RAW_ENTRY);
-  int error = gd_error(D);
+  rmdirfile();
+  D = gd_open(filedir, GD_RDONLY);
+  n = gd_nfields_by_type(D, GD_RAW_ENTRY);
+  error = gd_error(D);
   gd_close(D);
 
   CHECKI(n, 0);
diff --git a/test/nfields_vector.c b/test/nfields_vector.c
new file mode 100644
index 0000000..0563790
--- /dev/null
+++ b/test/nfields_vector.c
@@ -0,0 +1,65 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+#include "test.h"
+
+int main(void)
+{
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *format_data =
+    "raw1 RAW UINT8 1\n"
+    "META raw1 linterp1 LINTERP raw2 table\n"
+    "META raw1 linterp2 LINTERP raw3 table\n"
+    "META raw1 linterp3 LINTERP raw4 table\n"
+    "META raw1 const CONST UINT8 1\n"
+    "META raw1 string STRING value\n"
+    "META raw1 string2 STRING value\n"
+    "raw2 RAW UINT8 1\n"
+    "raw3 RAW UINT8 1\n"
+    "raw4 RAW UINT8 1\n"
+    "const CONST UINT8 1\n"
+    "carray CARRAY UINT8 1\n"
+    "string STRING value\n"
+    "string2 STRING value\n";
+  int fd, error, r = 0;
+  unsigned int nfields;
+  DIRFILE *D;
+
+  rmdirfile();
+  mkdir(filedir, 0777);
+
+  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
+  write(fd, format_data, strlen(format_data));
+  close(fd);
+
+  D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
+  nfields = gd_nvectors(D);
+  error = gd_error(D);
+  gd_close(D);
+
+  unlink(format);
+  rmdir(filedir);
+
+  CHECKI(error, 0);
+  CHECKI(nfields, 5);
+
+  return r;
+}
diff --git a/test/nfields_vector_hidden.c b/test/nfields_vector_hidden.c
new file mode 100644
index 0000000..42d4ffc
--- /dev/null
+++ b/test/nfields_vector_hidden.c
@@ -0,0 +1,66 @@
+/* Copyright (C) 2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+#include "test.h"
+
+int main(void)
+{
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *format_data =
+    "raw1 RAW UINT8 1\n"
+    "META raw1 linterp1 LINTERP raw2 table\n"
+    "META raw1 linterp2 LINTERP raw3 table\n"
+    "META raw1 linterp3 LINTERP raw4 table\n"
+    "META raw1 const CONST UINT8 1\n"
+    "META raw1 string STRING value\n"
+    "META raw1 string2 STRING value\n"
+    "/HIDDEN raw1\n"
+    "raw2 RAW UINT8 1\n"
+    "raw3 RAW UINT8 1\n"
+    "raw4 RAW UINT8 1\n"
+    "const CONST UINT8 1\n"
+    "carray CARRAY UINT8 1\n"
+    "string STRING value\n"
+    "string2 STRING value\n";
+  int fd, error, r = 0;
+  unsigned int nfields;
+  DIRFILE *D;
+
+  rmdirfile();
+  mkdir(filedir, 0777);
+
+  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
+  write(fd, format_data, strlen(format_data));
+  close(fd);
+
+  D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
+  nfields = gd_nvectors(D);
+  error = gd_error(D);
+  gd_close(D);
+
+  unlink(format);
+  rmdir(filedir);
+
+  CHECKI(error, 0);
+  CHECKI(nfields, 4);
+
+  return r;
+}
diff --git a/test/nfields_vector_invalid.c b/test/nfields_vector_invalid.c
new file mode 100644
index 0000000..e3b8bf5
--- /dev/null
+++ b/test/nfields_vector_invalid.c
@@ -0,0 +1,40 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+#include "test.h"
+
+int main(void)
+{
+  const char *filedir = "dirfile";
+  int error, r = 0;
+  DIRFILE *D;
+  unsigned int n;
+
+  rmdirfile();
+  D = gd_open(filedir, GD_RDONLY);
+  n = gd_nvectors(D);
+  error = gd_error(D);
+  gd_close(D);
+
+  CHECKI(n, 0);
+  CHECKI(error, GD_E_BAD_DIRFILE);
+
+  return r;
+}
diff --git a/test/nframes.c b/test/nframes.c
index e58950e..9cb1124 100644
--- a/test/nframes.c
+++ b/test/nframes.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Retreiving the number of frames should succeed cleanly */
 #include "test.h"
 
@@ -10,15 +30,16 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* data = __TEST__ "dirfile/data";
-  const char* format_data = "data RAW UINT16 1\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *data = "dirfile/data";
+  const char *format_data = "data RAW UINT16 1\n";
   int fd, error, r = 0;
   const size_t len = strlen(data);
   off_t n;
   DIRFILE *D;
 
+  rmdirfile();
   mkdir(filedir, 0777);
 
   fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
diff --git a/test/nframes64.c b/test/nframes64.c
index 37567e1..eff713d 100644
--- a/test/nframes64.c
+++ b/test/nframes64.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Retreiving the number of frames should succeed cleanly */
 #define _LARGEFILE64_SOURCE 1
 
@@ -12,15 +32,16 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* data = __TEST__ "dirfile/data";
-  const char* format_data = "data RAW UINT8 1\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *data = "dirfile/data";
+  const char *format_data = "data RAW UINT8 1\n";
   int fd, r = 0;
   size_t n;
   const size_t len = strlen(data);
   DIRFILE *D;
 
+  rmdirfile();
   mkdir(filedir, 0777);
 
   fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
diff --git a/test/nframes_empty.c b/test/nframes_empty.c
index 516d8bb..3dcd0eb 100644
--- a/test/nframes_empty.c
+++ b/test/nframes_empty.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Requesting the number of frames from an empty dirfile should fail cleanly */
 #include "test.h"
 
@@ -9,12 +29,13 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
   int error, r = 0;
   DIRFILE *D;
   size_t n;
 
+  rmdirfile();
   mkdir(filedir, 0777);
   close(open(format, O_CREAT | O_EXCL | O_WRONLY, 0666));
 
diff --git a/test/nframes_invalid.c b/test/nframes_invalid.c
index 7cd4ce8..e4d7f1d 100644
--- a/test/nframes_invalid.c
+++ b/test/nframes_invalid.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Requesting the number of frames from an invalid dirfile should fail cleanly */
 #include "test.h"
 
@@ -9,11 +29,15 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  int r = 0;
-  DIRFILE* D = gd_open(filedir, GD_RDONLY);
-  size_t n = gd_nframes(D);
-  int error = gd_error(D);
+  const char *filedir = "dirfile";
+  int error, r = 0;
+  DIRFILE *D;
+  size_t n;
+
+  rmdirfile();
+  D = gd_open(filedir, GD_RDONLY);
+  n = gd_nframes(D);
+  error = gd_error(D);
   gd_close(D);
 
   CHECKU(n, 0);
diff --git a/test/nframes_off64.c b/test/nframes_off64.c
index 336ad72..cf78345 100644
--- a/test/nframes_off64.c
+++ b/test/nframes_off64.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Retreiving the number of frames should succeed cleanly */
 #if defined _FILE_OFFSET_BITS && _FILE_OFFSET_BITS == 64
 #  define SKIP_TEST
@@ -19,15 +39,16 @@ int main(void)
 #ifdef SKIP_TEST
   return 77;
 #else
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* data = __TEST__ "dirfile/data";
-  const char* format_data = "data RAW UINT8 1\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *data = "dirfile/data";
+  const char *format_data = "data RAW UINT8 1\n";
   int fd, r = 0;
   size_t n;
   const size_t len = strlen(data);
   DIRFILE *D;
 
+  rmdirfile();
   mkdir(filedir, 0777);
 
   fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
diff --git a/test/nframes_spf.c b/test/nframes_spf.c
index 3ed769d..875897c 100644
--- a/test/nframes_spf.c
+++ b/test/nframes_spf.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* The number of frames should track the samples per frame */
 #include "test.h"
 
@@ -9,7 +29,7 @@
 #include <string.h>
 #include <errno.h>
 
-static void write_format(const char* format, int spf)
+static void write_format(const char *format, int spf)
 {
   char format_data[100];
   int fd;
@@ -22,12 +42,13 @@ static void write_format(const char* format, int spf)
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* data = __TEST__ "dirfile/data";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *data = "dirfile/data";
   int fd, i, r = 0;
   const size_t len = strlen(data);
 
+  rmdirfile();
   mkdir(filedir, 0777);
 
   fd = open(data, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
@@ -36,7 +57,7 @@ int main(void)
 
   for (i = 1; i < (int)len + 1; ++i) {
     DIRFILE *D;
-    gd_spf_t spf;
+    unsigned int spf;
     size_t n;
 
     write_format(format, i);
diff --git a/test/nmeta.c b/test/nmeta.c
index 0969bb0..58fa577 100644
--- a/test/nmeta.c
+++ b/test/nmeta.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Retreiving the number of fields of a field should succeed cleanly */
 #include "test.h"
 
@@ -10,9 +30,9 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* format_data =
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *format_data =
     "raw1 RAW UINT8 1\n"
     "META raw1 linterp1 LINTERP raw2 table\n"
     "META raw1 linterp2 LINTERP raw3 table\n"
@@ -30,6 +50,7 @@ int main(void)
   unsigned int nfields;
   DIRFILE *D;
 
+  rmdirfile();
   mkdir(filedir, 0777);
 
   fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
diff --git a/test/nmeta_hidden.c b/test/nmeta_hidden.c
new file mode 100644
index 0000000..0f4a43e
--- /dev/null
+++ b/test/nmeta_hidden.c
@@ -0,0 +1,65 @@
+/* Copyright (C) 2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+#include "test.h"
+
+int main(void)
+{
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *format_data =
+    "raw1 RAW UINT8 1\n"
+    "META raw1 linterp1 LINTERP raw2 table\n"
+    "META raw1 linterp2 LINTERP raw3 table\n"
+    "META raw1 linterp3 LINTERP raw4 table\n"
+    "META raw1 const CONST UINT8 1\n"
+    "META raw1 string STRING value\n"
+    "META raw1 string2 STRING value\n"
+    "/HIDDEN raw1/const\n"
+    "raw2 RAW UINT8 1\n"
+    "raw3 RAW UINT8 1\n"
+    "raw4 RAW UINT8 1\n"
+    "const CONST UINT8 1\n"
+    "string STRING value\n"
+    "string2 STRING value\n";
+  int fd, error, r = 0;
+  unsigned int nfields;
+  DIRFILE *D;
+
+  rmdirfile();
+  mkdir(filedir, 0777);
+
+  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
+  write(fd, format_data, strlen(format_data));
+  close(fd);
+
+  D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
+  nfields = gd_nmfields(D, "raw1");
+  error = gd_error(D);
+  gd_close(D);
+
+  unlink(format);
+  rmdir(filedir);
+
+  CHECKI(error, 0);
+  CHECKU(nfields, 5);
+
+  return r;
+}
diff --git a/test/nmeta_invalid.c b/test/nmeta_invalid.c
index e4f1f9a..f045afc 100644
--- a/test/nmeta_invalid.c
+++ b/test/nmeta_invalid.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Requesting the number of fields from an invalid dirfile should fail cleanly */
 #include "test.h"
 
@@ -9,11 +29,15 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  int r = 0;
-  DIRFILE* D = gd_open(filedir, GD_RDONLY);
-  unsigned int n = gd_nmfields(D, "raw1");
-  int error = gd_error(D);
+  const char *filedir = "dirfile";
+  int error, r = 0;
+  DIRFILE *D;
+  unsigned int n;
+
+  rmdirfile();
+  D = gd_open(filedir, GD_RDONLY);
+  n = gd_nmfields(D, "raw1");
+  error = gd_error(D);
   gd_close(D);
 
   CHECKU(n, 0);
diff --git a/test/nmeta_parent.c b/test/nmeta_parent.c
index 3db381f..0d2e01a 100644
--- a/test/nmeta_parent.c
+++ b/test/nmeta_parent.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Retreiving the number of fields of a field should succeed cleanly */
 #include "test.h"
 
@@ -10,9 +30,9 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* format_data =
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *format_data =
     "raw1 RAW UINT8 1\n"
     "META raw1 linterp1 LINTERP raw2 table\n"
     "META raw1 linterp2 LINTERP raw3 table\n"
@@ -30,6 +50,7 @@ int main(void)
   unsigned int nfields;
   DIRFILE *D;
 
+  rmdirfile();
   mkdir(filedir, 0777);
 
   fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
diff --git a/test/nmeta_type.c b/test/nmeta_type.c
index fe44a69..1c0780a 100644
--- a/test/nmeta_type.c
+++ b/test/nmeta_type.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Retreiving the number of fields of a field should succeed cleanly */
 #include "test.h"
 
@@ -10,9 +30,9 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* format_data =
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *format_data =
     "raw1 RAW UINT8 1\n"
     "META raw1 linterp1 LINTERP raw2 table\n"
     "META raw1 linterp2 LINTERP raw3 table\n"
@@ -30,6 +50,7 @@ int main(void)
   unsigned int nfields;
   DIRFILE *D;
 
+  rmdirfile();
   mkdir(filedir, 0777);
 
   fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
diff --git a/test/nmeta_type_hidden.c b/test/nmeta_type_hidden.c
new file mode 100644
index 0000000..4a45b9c
--- /dev/null
+++ b/test/nmeta_type_hidden.c
@@ -0,0 +1,65 @@
+/* Copyright (C) 2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+#include "test.h"
+
+int main(void)
+{
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *format_data =
+    "raw1 RAW UINT8 1\n"
+    "META raw1 linterp1 LINTERP raw2 table\n"
+    "META raw1 linterp2 LINTERP raw3 table\n"
+    "META raw1 linterp3 LINTERP raw4 table\n"
+    "META raw1 const CONST UINT8 1\n"
+    "META raw1 string STRING value\n"
+    "META raw1 string2 STRING value\n"
+    "/HIDDEN raw1/string\n"
+    "raw2 RAW UINT8 1\n"
+    "raw3 RAW UINT8 1\n"
+    "raw4 RAW UINT8 1\n"
+    "const CONST UINT8 1\n"
+    "string STRING value\n"
+    "string2 STRING value\n";
+  int fd, error, r = 0;
+  unsigned int nfields;
+  DIRFILE *D;
+
+  rmdirfile();
+  mkdir(filedir, 0777);
+
+  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
+  write(fd, format_data, strlen(format_data));
+  close(fd);
+
+  D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
+  nfields = gd_nmfields_by_type(D, "raw1", GD_STRING_ENTRY);
+  error = gd_error(D);
+  gd_close(D);
+
+  unlink(format);
+  rmdir(filedir);
+
+  CHECKI(error, 0);
+  CHECKU(nfields, 1);
+
+  return r;
+}
diff --git a/test/nmeta_type_invalid.c b/test/nmeta_type_invalid.c
index 819960f..2cb6187 100644
--- a/test/nmeta_type_invalid.c
+++ b/test/nmeta_type_invalid.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Requesting the number of fields from an invalid dirfile should fail cleanly */
 #include "test.h"
 
@@ -9,11 +29,15 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  int r = 0;
-  DIRFILE* D = gd_open(filedir, GD_RDONLY);
-  unsigned int n = gd_nmfields_by_type(D, "raw1", GD_STRING_ENTRY);
-  int error = gd_error(D);
+  const char *filedir = "dirfile";
+  int error, r = 0;
+  DIRFILE *D;
+  unsigned int n;
+
+  rmdirfile();
+  D = gd_open(filedir, GD_RDONLY);
+  n = gd_nmfields_by_type(D, "raw1", GD_STRING_ENTRY);
+  error = gd_error(D);
   gd_close(D);
 
   CHECKU(n, 0);
diff --git a/test/nmeta_type_parent.c b/test/nmeta_type_parent.c
index 6046048..0611137 100644
--- a/test/nmeta_type_parent.c
+++ b/test/nmeta_type_parent.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Retreiving the number of fields of a field should succeed cleanly */
 #include "test.h"
 
@@ -10,9 +30,9 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* format_data =
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *format_data =
     "raw1 RAW UINT8 1\n"
     "META raw1 linterp1 LINTERP raw2 table\n"
     "META raw1 linterp2 LINTERP raw3 table\n"
@@ -30,6 +50,7 @@ int main(void)
   unsigned int nfields;
   DIRFILE *D;
 
+  rmdirfile();
   mkdir(filedir, 0777);
 
   fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
diff --git a/test/nmeta_vectors.c b/test/nmeta_vectors.c
index 88d6577..4b2c222 100644
--- a/test/nmeta_vectors.c
+++ b/test/nmeta_vectors.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Retreiving the number of fields of a field should succeed cleanly */
 #include "test.h"
 
@@ -10,9 +30,9 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* format_data =
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *format_data =
     "raw1 RAW UINT8 1\n"
     "META raw1 linterp1 LINTERP raw2 table\n"
     "META raw1 linterp2 LINTERP raw3 table\n"
@@ -30,6 +50,7 @@ int main(void)
   unsigned int nfields;
   DIRFILE *D;
 
+  rmdirfile();
   mkdir(filedir, 0777);
 
   fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
diff --git a/test/nmeta_vectors_del.c b/test/nmeta_vectors_del.c
index 2288fd9..5d95c91 100644
--- a/test/nmeta_vectors_del.c
+++ b/test/nmeta_vectors_del.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2010-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 #include "test.h"
 
 #include <stdlib.h>
@@ -9,9 +29,9 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* format_data =
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *format_data =
     "raw1 RAW UINT8 1\n"
     "META raw1 linterp1 LINTERP raw2 table\n"
     "META raw1 linterp2 LINTERP raw3 table\n"
@@ -29,6 +49,7 @@ int main(void)
   unsigned int nvec, nvec2, nvec3;
   DIRFILE *D;
 
+  rmdirfile();
   mkdir(filedir, 0777);
 
   fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
diff --git a/test/nmeta_vectors_hidden.c b/test/nmeta_vectors_hidden.c
new file mode 100644
index 0000000..ecd2b18
--- /dev/null
+++ b/test/nmeta_vectors_hidden.c
@@ -0,0 +1,65 @@
+/* Copyright (C) 2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+#include "test.h"
+
+int main(void)
+{
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *format_data =
+    "raw1 RAW UINT8 1\n"
+    "META raw1 linterp1 LINTERP raw2 table\n"
+    "META raw1 linterp2 LINTERP raw3 table\n"
+    "META raw1 linterp3 LINTERP raw4 table\n"
+    "META raw1 const CONST UINT8 1\n"
+    "META raw1 string STRING value\n"
+    "META raw1 string2 STRING value\n"
+    "/HIDDEN raw1/linterp2\n"
+    "raw2 RAW UINT8 1\n"
+    "raw3 RAW UINT8 1\n"
+    "raw4 RAW UINT8 1\n"
+    "const CONST UINT8 1\n"
+    "string STRING value\n"
+    "string2 STRING value\n";
+  int fd, error, r = 0;
+  unsigned int nfields;
+  DIRFILE *D;
+
+  rmdirfile();
+  mkdir(filedir, 0777);
+
+  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
+  write(fd, format_data, strlen(format_data));
+  close(fd);
+
+  D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
+  nfields = gd_nmvectors(D, "raw1");
+  error = gd_error(D);
+  gd_close(D);
+
+  unlink(format);
+  rmdir(filedir);
+
+  CHECKI(error, 0);
+  CHECKU(nfields, 2);
+
+  return r;
+}
diff --git a/test/nmeta_vectors_invalid.c b/test/nmeta_vectors_invalid.c
index 4440b29..14b2884 100644
--- a/test/nmeta_vectors_invalid.c
+++ b/test/nmeta_vectors_invalid.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Requesting the number of fields from an invalid dirfile should fail cleanly */
 #include "test.h"
 
@@ -9,11 +29,15 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  int r = 0;
-  DIRFILE* D = gd_open(filedir, GD_RDONLY);
-  unsigned int n = gd_nmvectors(D, "raw1");
-  int error = gd_error(D);
+  const char *filedir = "dirfile";
+  int error, r = 0;
+  DIRFILE *D;
+  unsigned int n;
+
+  rmdirfile();
+  D = gd_open(filedir, GD_RDONLY);
+  n = gd_nmvectors(D, "raw1");
+  error = gd_error(D);
   gd_close(D);
 
   CHECKU(n, 0);
diff --git a/test/nmeta_vectors_parent.c b/test/nmeta_vectors_parent.c
index 1c2ff90..c64b2c7 100644
--- a/test/nmeta_vectors_parent.c
+++ b/test/nmeta_vectors_parent.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Retreiving the number of fields of a field should succeed cleanly */
 #include "test.h"
 
@@ -10,9 +30,9 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* format_data =
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *format_data =
     "raw1 RAW UINT8 1\n"
     "META raw1 linterp1 LINTERP raw2 table\n"
     "META raw1 linterp2 LINTERP raw3 table\n"
@@ -30,6 +50,7 @@ int main(void)
   unsigned int nfields;
   DIRFILE *D;
 
+  rmdirfile();
   mkdir(filedir, 0777);
 
   fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
diff --git a/test/open.c b/test/open.c
index 2c77a99..f0d03ed 100644
--- a/test/open.c
+++ b/test/open.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Opening an empty  dirfile should succeed cleanly */
 #include "test.h"
 
@@ -9,11 +29,12 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
   int error, r = 0;
   DIRFILE *D;
 
+  rmdirfile();
   mkdir(filedir, 0777);
   close(open(format, O_CREAT | O_EXCL | O_WRONLY, 0666));
 
diff --git a/test/open_abs.c b/test/open_abs.c
new file mode 100644
index 0000000..a054aae
--- /dev/null
+++ b/test/open_abs.c
@@ -0,0 +1,53 @@
+/* Copyright (C) 2012 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+#include "test.h"
+
+#include <stdlib.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <string.h>
+
+int main(void)
+{
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  char path[4096];
+  int error, r = 0;
+  DIRFILE *D;
+
+  rmdirfile();
+  mkdir(filedir, 0777);
+  close(open(format, O_CREAT | O_EXCL | O_WRONLY, 0666));
+
+  getcwd(path, 4096);
+  strcat(path, "/");
+  strcat(path, filedir);
+  D = gd_open(path, GD_RDONLY | GD_VERBOSE);
+  error = gd_error(D);
+  gd_close(D);
+
+  unlink(format);
+  rmdir(filedir);
+
+  CHECKI(error, 0);
+  return r;
+}
diff --git a/test/open_cb_abort.c b/test/open_cb_abort.c
index 53514df..366c3d3 100644
--- a/test/open_cb_abort.c
+++ b/test/open_cb_abort.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Parser check */
 #include "test.h"
 
@@ -11,8 +31,7 @@
 
 static int saw_callback = 0;
 
-int callback(gd_parser_data_t *pdata __attribute__ (( unused )),
-    void* extra __attribute__ (( unused )))
+int callback(gd_parser_data_t *pdata gd_unused_, void *extra gd_unused_)
 {
   saw_callback++;
 
@@ -21,15 +40,16 @@ int callback(gd_parser_data_t *pdata __attribute__ (( unused )),
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* format_data =
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *format_data =
     "BADDIRECTIVE BADTYPE\n"
     "BADDIRECTIVE BADTYPE\n"
     "BADDIRECTIVE BADTYPE\n";
   int fd, error, r = 0;
   DIRFILE *D;
 
+  rmdirfile();
   mkdir(filedir, 0777);
 
   fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
diff --git a/test/open_cb_cont.c b/test/open_cb_cont.c
index af31978..05b8d9a 100644
--- a/test/open_cb_cont.c
+++ b/test/open_cb_cont.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Parser check */
 #include "test.h"
 
@@ -10,8 +30,7 @@
 
 static int saw_callback = 0;
 
-int callback(gd_parser_data_t *pdata __attribute__ (( unused )),
-    void* extra __attribute__ (( unused )))
+int callback(gd_parser_data_t *pdata gd_unused_, void *extra gd_unused_)
 {
   saw_callback++;
 
@@ -20,15 +39,16 @@ int callback(gd_parser_data_t *pdata __attribute__ (( unused )),
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* format_data =
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *format_data =
     "BADDIRECTIVE BADTYPE\n"
     "BADDIRECTIVE BADTYPE\n"
     "BADDIRECTIVE BADTYPE\n";
   int fd, error, r = 0;
   DIRFILE *D;
 
+  rmdirfile();
   mkdir(filedir, 0777);
 
   fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
diff --git a/test/open_cb_ignore.c b/test/open_cb_ignore.c
index afbe47f..198ba6b 100644
--- a/test/open_cb_ignore.c
+++ b/test/open_cb_ignore.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Parser check */
 #include "test.h"
 
@@ -10,8 +30,7 @@
 
 static int saw_callback = 0;
 
-int callback(gd_parser_data_t *pdata __attribute__ (( unused )),
-    void* extra __attribute__ (( unused )))
+int callback(gd_parser_data_t *pdata gd_unused_, void *extra gd_unused_)
 {
   saw_callback = 1;
 
@@ -20,12 +39,13 @@ int callback(gd_parser_data_t *pdata __attribute__ (( unused )),
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* format_data = "BADDIRECTIVE BADTYPE\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *format_data = "BADDIRECTIVE BADTYPE\n";
   int fd, error, r = 0;
   DIRFILE *D;
 
+  rmdirfile();
   mkdir(filedir, 0777);
 
   fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
diff --git a/test/open_cb_invalid.c b/test/open_cb_invalid.c
index 3d89374..119d805 100644
--- a/test/open_cb_invalid.c
+++ b/test/open_cb_invalid.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Parser check */
 #include "test.h"
 
@@ -11,8 +31,7 @@
 
 static int saw_callback = 0;
 
-int callback(gd_parser_data_t *pdata __attribute__ (( unused )),
-    void* extra __attribute__ (( unused )))
+int callback(gd_parser_data_t *pdata gd_unused_, void *extra gd_unused_)
 {
   saw_callback++;
 
@@ -21,15 +40,16 @@ int callback(gd_parser_data_t *pdata __attribute__ (( unused )),
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* format_data =
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *format_data =
     "BADDIRECTIVE BADTYPE\n"
     "BADDIRECTIVE BADTYPE\n"
     "BADDIRECTIVE BADTYPE\n";
   int fd, error, r = 0;
   DIRFILE *D;
 
+  rmdirfile();
   mkdir(filedir, 0777);
 
   fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
diff --git a/test/open_cb_rescan.c b/test/open_cb_rescan.c
index f79b7f8..95c8409 100644
--- a/test/open_cb_rescan.c
+++ b/test/open_cb_rescan.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Parser check */
 #include "test.h"
 
@@ -11,7 +31,7 @@
 
 static int saw_callback = 0;
 
-int callback(gd_parser_data_t *pdata, void *extra __attribute__ (( unused )))
+int callback(gd_parser_data_t *pdata, void *extra gd_unused_)
 {
   if (saw_callback)
     return GD_SYNTAX_ABORT;
@@ -25,12 +45,13 @@ int callback(gd_parser_data_t *pdata, void *extra __attribute__ (( unused )))
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* format_data = "BADDIRECTIVE BADTYPE\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *format_data = "BADDIRECTIVE BADTYPE\n";
   int fd, error, r = 0;
   DIRFILE *D;
 
+  rmdirfile();
   mkdir(filedir, 0777);
 
   fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
diff --git a/test/open_eaccess.c b/test/open_eaccess.c
index 2903bfe..25052b9 100644
--- a/test/open_eaccess.c
+++ b/test/open_eaccess.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Opening an dirfile with no read permission should fail cleanly */
 #include "test.h"
 
@@ -10,11 +30,12 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
   int fd, error, r = 0;
   DIRFILE *D;
 
+  rmdirfile();
   mkdir(filedir, 0777);
   close(open(format, O_CREAT | O_EXCL | O_WRONLY, 0000));
 
diff --git a/test/open_nonexistent.c b/test/open_nonexistent.c
index b2ceb1a..af91ccf 100644
--- a/test/open_nonexistent.c
+++ b/test/open_nonexistent.c
@@ -1,12 +1,32 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Opening a non-existent dirfile should fail cleanly */
 #include "test.h"
 
 int main(void)
 {
-  DIRFILE* D = gd_open("a non_existant dirfile", 0);
-  int r = 0;
+  DIRFILE *D = gd_open("a non_existant dirfile", 0);
+  int error, r = 0;
 
-  int error = gd_error(D);
+  error = gd_error(D);
   CHECKI(error, GD_E_OPEN);
   gd_discard(D);
 
diff --git a/test/open_notdirfile.c b/test/open_notdirfile.c
index 601131e..6ab64ff 100644
--- a/test/open_notdirfile.c
+++ b/test/open_notdirfile.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Opening an non-dirfile should fail cleanly */
 #include "test.h"
 
@@ -9,10 +29,11 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
+  const char *filedir = "dirfile";
   int error, r = 0;
   DIRFILE *D;
 
+  rmdirfile();
   mkdir(filedir, 0777);
 
   D = gd_open(filedir, GD_RDONLY);
diff --git a/test/open_sym_a.c b/test/open_sym_a.c
new file mode 100644
index 0000000..eaec514
--- /dev/null
+++ b/test/open_sym_a.c
@@ -0,0 +1,65 @@
+/* Copyright (C) 2012 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+#include "test.h"
+
+#include <stdlib.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <string.h>
+
+int main(void)
+{
+#if ! defined HAVE_SYMLINK || defined GD_NO_GETCWD
+  return 77;
+#else
+  const char *filedir = "dirfile/link";
+  const char *format = "dirfile/format";
+  char *targ;
+  int error, r = 0;
+  int cwd_size = 2048;
+  char *ptr, *cwd = NULL;
+  DIRFILE *D;
+
+  gdtest_getcwd(ptr, cwd, cwd_size);
+
+  rmdirfile();
+  mkdir("dirfile", 0777);
+  close(open(format, O_CREAT | O_EXCL | O_WRONLY, 0666));
+
+  /* make a symlink */
+  targ = (char*)malloc(cwd_size + 8);
+  sprintf(targ, "%s/dirfile", cwd);
+
+  symlink(targ, filedir);
+
+  D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
+  error = gd_error(D);
+  gd_close(D);
+
+  unlink(format);
+  rmdir(filedir);
+
+  CHECKI(error, 0);
+  free(cwd);
+  return r;
+#endif
+}
diff --git a/test/open_sym_al.c b/test/open_sym_al.c
new file mode 100644
index 0000000..76ac654
--- /dev/null
+++ b/test/open_sym_al.c
@@ -0,0 +1,65 @@
+/* Copyright (C) 2012 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+#include "test.h"
+
+#include <stdlib.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <string.h>
+
+int main(void)
+{
+#if ! defined HAVE_SYMLINK || defined GD_NO_GETCWD
+  return 77;
+#else
+  const char *filedir = "dirfile/link";
+  const char *format = "dirfile/format";
+  char *targ;
+  int error, r = 0;
+  int cwd_size = 2048;
+  char *ptr, *cwd = NULL;
+  DIRFILE *D;
+
+  gdtest_getcwd(ptr, cwd, cwd_size);
+
+  rmdirfile();
+  mkdir("dirfile", 0777);
+  close(open(format, O_CREAT | O_EXCL | O_WRONLY, 0666));
+
+  /* make a symlink */
+  targ = (char*)malloc(cwd_size + 8);
+  sprintf(targ, "%s/dirfile/", cwd);
+
+  symlink(targ, filedir);
+
+  D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
+  error = gd_error(D);
+  gd_close(D);
+
+  unlink(format);
+  rmdir(filedir);
+
+  CHECKI(error, 0);
+  free(cwd);
+  return r;
+#endif
+}
diff --git a/test/open_sym_at.c b/test/open_sym_at.c
new file mode 100644
index 0000000..9ed1506
--- /dev/null
+++ b/test/open_sym_at.c
@@ -0,0 +1,65 @@
+/* Copyright (C) 2012 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+#include "test.h"
+
+#include <stdlib.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <string.h>
+
+int main(void)
+{
+#if ! defined HAVE_SYMLINK || defined GD_NO_GETCWD
+  return 77;
+#else
+  const char *filedir = "dirfile/link/";
+  const char *format = "dirfile/format";
+  char *targ;
+  int error, r = 0;
+  int cwd_size = 2048;
+  char *ptr, *cwd = NULL;
+  DIRFILE *D;
+
+  gdtest_getcwd(ptr, cwd, cwd_size);
+
+  rmdirfile();
+  mkdir("dirfile", 0777);
+  close(open(format, O_CREAT | O_EXCL | O_WRONLY, 0666));
+
+  /* make a symlink */
+  targ = (char*)malloc(cwd_size + 8);
+  sprintf(targ, "%s/dirfile", cwd);
+
+  symlink(targ, "dirfile/link");
+
+  D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
+  error = gd_error(D);
+  gd_close(D);
+
+  unlink(format);
+  rmdir(filedir);
+
+  CHECKI(error, 0);
+  free(cwd);
+  return r;
+#endif
+}
diff --git a/test/open_sym_c.c b/test/open_sym_c.c
new file mode 100644
index 0000000..57afe87
--- /dev/null
+++ b/test/open_sym_c.c
@@ -0,0 +1,57 @@
+/* Copyright (C) 2012 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+#include "test.h"
+
+#include <stdlib.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <string.h>
+
+int main(void)
+{
+#if ! defined HAVE_SYMLINK
+  return 77;
+#else
+  const char *filedir = "dirfile/link";
+  const char *format = "dirfile/format";
+  const char *targ = ".";
+  int error, r = 0;
+  DIRFILE *D;
+
+  rmdirfile();
+  mkdir("dirfile", 0777);
+  close(open(format, O_CREAT | O_EXCL | O_WRONLY, 0666));
+
+  /* make a symlink */
+  symlink(targ, filedir);
+
+  D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
+  error = gd_error(D);
+  gd_close(D);
+
+  unlink(format);
+  rmdir(filedir);
+
+  CHECKI(error, 0);
+  return r;
+#endif
+}
diff --git a/test/open_sym_cl.c b/test/open_sym_cl.c
new file mode 100644
index 0000000..e40db2c
--- /dev/null
+++ b/test/open_sym_cl.c
@@ -0,0 +1,57 @@
+/* Copyright (C) 2012 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+#include "test.h"
+
+#include <stdlib.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <string.h>
+
+int main(void)
+{
+#if ! defined HAVE_SYMLINK
+  return 77;
+#else
+  const char *filedir = "dirfile/link";
+  const char *format = "dirfile/format";
+  const char *targ = "./";
+  int error, r = 0;
+  DIRFILE *D;
+
+  rmdirfile();
+  mkdir("dirfile", 0777);
+  close(open(format, O_CREAT | O_EXCL | O_WRONLY, 0666));
+
+  /* make a symlink */
+  symlink(targ, filedir);
+
+  D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
+  error = gd_error(D);
+  gd_close(D);
+
+  unlink(format);
+  rmdir(filedir);
+
+  CHECKI(error, 0);
+  return r;
+#endif
+}
diff --git a/test/open_sym_ct.c b/test/open_sym_ct.c
new file mode 100644
index 0000000..cac53ee
--- /dev/null
+++ b/test/open_sym_ct.c
@@ -0,0 +1,57 @@
+/* Copyright (C) 2012 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+#include "test.h"
+
+#include <stdlib.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <string.h>
+
+int main(void)
+{
+#if ! defined HAVE_SYMLINK
+  return 77;
+#else
+  const char *filedir = "dirfile/link/";
+  const char *format = "dirfile/format";
+  const char *targ = ".";
+  int error, r = 0;
+  DIRFILE *D;
+
+  rmdirfile();
+  mkdir("dirfile", 0777);
+  close(open(format, O_CREAT | O_EXCL | O_WRONLY, 0666));
+
+  /* make a symlink */
+  symlink(targ, "dirfile/link");
+
+  D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
+  error = gd_error(D);
+  gd_close(D);
+
+  unlink(format);
+  rmdir(filedir);
+
+  CHECKI(error, 0);
+  return r;
+#endif
+}
diff --git a/test/open_sym_p.c b/test/open_sym_p.c
new file mode 100644
index 0000000..4520568
--- /dev/null
+++ b/test/open_sym_p.c
@@ -0,0 +1,57 @@
+/* Copyright (C) 2012 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+#include "test.h"
+
+#include <stdlib.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <string.h>
+
+int main(void)
+{
+#if ! defined HAVE_SYMLINK
+  return 77;
+#else
+  const char *filedir = "dirfile/link";
+  const char *format = "dirfile/format";
+  const char *targ = "../dirfile";
+  int error, r = 0;
+  DIRFILE *D;
+
+  rmdirfile();
+  mkdir("dirfile", 0777);
+  close(open(format, O_CREAT | O_EXCL | O_WRONLY, 0666));
+
+  /* make a symlink */
+  symlink(targ, filedir);
+
+  D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
+  error = gd_error(D);
+  gd_close(D);
+
+  unlink(format);
+  rmdir(filedir);
+
+  CHECKI(error, 0);
+  return r;
+#endif
+}
diff --git a/test/open_sym_pl.c b/test/open_sym_pl.c
new file mode 100644
index 0000000..fd2e3a3
--- /dev/null
+++ b/test/open_sym_pl.c
@@ -0,0 +1,57 @@
+/* Copyright (C) 2012 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+#include "test.h"
+
+#include <stdlib.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <string.h>
+
+int main(void)
+{
+#if ! defined HAVE_SYMLINK
+  return 77;
+#else
+  const char *filedir = "dirfile/link";
+  const char *format = "dirfile/format";
+  const char *targ = "../dirfile/";
+  int error, r = 0;
+  DIRFILE *D;
+
+  rmdirfile();
+  mkdir("dirfile", 0777);
+  close(open(format, O_CREAT | O_EXCL | O_WRONLY, 0666));
+
+  /* make a symlink */
+  symlink(targ, filedir);
+
+  D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
+  error = gd_error(D);
+  gd_close(D);
+
+  unlink(format);
+  rmdir(filedir);
+
+  CHECKI(error, 0);
+  return r;
+#endif
+}
diff --git a/test/open_sym_pt.c b/test/open_sym_pt.c
new file mode 100644
index 0000000..09a4ac4
--- /dev/null
+++ b/test/open_sym_pt.c
@@ -0,0 +1,57 @@
+/* Copyright (C) 2012 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+#include "test.h"
+
+#include <stdlib.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <string.h>
+
+int main(void)
+{
+#if ! defined HAVE_SYMLINK
+  return 77;
+#else
+  const char *filedir = "dirfile/link/";
+  const char *format = "dirfile/format";
+  const char *targ = "../dirfile";
+  int error, r = 0;
+  DIRFILE *D;
+
+  rmdirfile();
+  mkdir("dirfile", 0777);
+  close(open(format, O_CREAT | O_EXCL | O_WRONLY, 0666));
+
+  /* make a symlink */
+  symlink(targ, "dirfile/link");
+
+  D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
+  error = gd_error(D);
+  gd_close(D);
+
+  unlink(format);
+  rmdir(filedir);
+
+  CHECKI(error, 0);
+  return r;
+#endif
+}
diff --git a/test/parse_alias.c b/test/parse_alias.c
new file mode 100644
index 0000000..ecfa88d
--- /dev/null
+++ b/test/parse_alias.c
@@ -0,0 +1,48 @@
+/* Copyright (C) 2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+/* Parser check */
+#include "test.h"
+
+int main(void)
+{
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *format_data = "data RAW UINT8 1\n/ALIAS rata data\n";
+  int fd, error, r = 0;
+  DIRFILE *D;
+
+  rmdirfile();
+  mkdir(filedir, 0777);
+
+  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
+  write(fd, format_data, strlen(format_data));
+  close(fd);
+
+  D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
+  error = gd_error(D);
+  gd_discard(D);
+
+  unlink(format);
+  rmdir(filedir);
+
+  CHECKI(error,GD_E_OK);
+  return r;
+}
diff --git a/test/parse_alias_code.c b/test/parse_alias_code.c
new file mode 100644
index 0000000..3860eed
--- /dev/null
+++ b/test/parse_alias_code.c
@@ -0,0 +1,48 @@
+/* Copyright (C) 2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+/* Parser check */
+#include "test.h"
+
+int main(void)
+{
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *format_data = "data RAW UINT8 1\n/ALIAS ra.ta data\n";
+  int fd, error, r = 0;
+  DIRFILE *D;
+
+  rmdirfile();
+  mkdir(filedir, 0777);
+
+  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
+  write(fd, format_data, strlen(format_data));
+  close(fd);
+
+  D = gd_open(filedir, GD_RDONLY);
+  error = gd_error(D);
+  gd_discard(D);
+
+  unlink(format);
+  rmdir(filedir);
+
+  CHECKI(error,GD_E_FORMAT);
+  return r;
+}
diff --git a/test/parse_alias_dup.c b/test/parse_alias_dup.c
new file mode 100644
index 0000000..a1cc501
--- /dev/null
+++ b/test/parse_alias_dup.c
@@ -0,0 +1,51 @@
+/* Copyright (C) 2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+/* Parser check */
+#include "test.h"
+
+int main(void)
+{
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *format_data =
+    "data RAW UINT8 1\n"
+    "cata RAW UINT8 1\n"
+    "/ALIAS cata data\n";
+  int fd, error, r = 0;
+  DIRFILE *D;
+
+  rmdirfile();
+  mkdir(filedir, 0777);
+
+  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
+  write(fd, format_data, strlen(format_data));
+  close(fd);
+
+  D = gd_open(filedir, GD_RDONLY);
+  error = gd_error(D);
+  gd_discard(D);
+
+  unlink(format);
+  rmdir(filedir);
+
+  CHECKI(error,GD_E_FORMAT);
+  return r;
+}
diff --git a/test/parse_alias_meta.c b/test/parse_alias_meta.c
new file mode 100644
index 0000000..de0fbde
--- /dev/null
+++ b/test/parse_alias_meta.c
@@ -0,0 +1,51 @@
+/* Copyright (C) 2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+/* Parser check */
+#include "test.h"
+
+int main(void)
+{
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *format_data =
+    "data RAW UINT8 1\n"
+    "data/cata CONST UINT8 1\n"
+    "/ALIAS data/eata data\n";
+  int fd, error, r = 0;
+  DIRFILE *D;
+
+  rmdirfile();
+  mkdir(filedir, 0777);
+
+  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
+  write(fd, format_data, strlen(format_data));
+  close(fd);
+
+  D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
+  error = gd_error(D);
+  gd_discard(D);
+
+  unlink(format);
+  rmdir(filedir);
+
+  CHECKI(error,0);
+  return r;
+}
diff --git a/test/parse_alias_missing.c b/test/parse_alias_missing.c
new file mode 100644
index 0000000..f662a78
--- /dev/null
+++ b/test/parse_alias_missing.c
@@ -0,0 +1,48 @@
+/* Copyright (C) 2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+/* Parser check */
+#include "test.h"
+
+int main(void)
+{
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *format_data = "/ALIAS alias target\n";
+  int fd, error, r = 0;
+  DIRFILE *D;
+
+  rmdirfile();
+  mkdir(filedir, 0777);
+
+  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
+  write(fd, format_data, strlen(format_data));
+  close(fd);
+
+  D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
+  error = gd_error(D);
+  gd_discard(D);
+
+  unlink(format);
+  rmdir(filedir);
+
+  CHECKI(error,GD_E_OK);
+  return r;
+}
diff --git a/test/parse_badline.c b/test/parse_badline.c
index aec63a0..8218dea 100644
--- a/test/parse_badline.c
+++ b/test/parse_badline.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Parser check */
 #include "test.h"
 
@@ -10,12 +30,13 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* format_data = "BADDIRECTIVE BADTYPE\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *format_data = "BADDIRECTIVE BADTYPE\n";
   int fd, error, r = 0;
   DIRFILE *D;
 
+  rmdirfile();
   mkdir(filedir, 0777);
 
   fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
diff --git a/test/parse_bit.c b/test/parse_bit.c
index 175dda9..52dfdf0 100644
--- a/test/parse_bit.c
+++ b/test/parse_bit.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Parser check */
 #include "test.h"
 
@@ -10,12 +30,13 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* format_data = "data BIT in1 3\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *format_data = "data BIT in1 3\n";
   int fd, error, r = 0;
   DIRFILE *D;
 
+  rmdirfile();
   mkdir(filedir, 0777);
 
   fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
diff --git a/test/parse_bit4.c b/test/parse_bit4.c
index 18819aa..4fbd65b 100644
--- a/test/parse_bit4.c
+++ b/test/parse_bit4.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Parser check */
 #include "test.h"
 
@@ -10,12 +30,13 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* format_data = "data BIT in1 3 4\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *format_data = "data BIT in1 3 4\n";
   int fd, error, r = 0;
   DIRFILE *D;
 
+  rmdirfile();
   mkdir(filedir, 0777);
 
   fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
diff --git a/test/parse_bit_bitnum.c b/test/parse_bit_bitnum.c
index 9b695d6..542557f 100644
--- a/test/parse_bit_bitnum.c
+++ b/test/parse_bit_bitnum.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Parser check */
 #include "test.h"
 
@@ -10,12 +30,13 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* format_data = "data BIT in1 -1\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *format_data = "data BIT in1 -1\n";
   int fd, error, r = 0;
   DIRFILE *D;
 
+  rmdirfile();
   mkdir(filedir, 0777);
 
   fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
diff --git a/test/parse_bit_bitsize.c b/test/parse_bit_bitsize.c
index 7264b47..66dc66d 100644
--- a/test/parse_bit_bitsize.c
+++ b/test/parse_bit_bitsize.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Parser check */
 #include "test.h"
 
@@ -10,12 +30,13 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* format_data = "data BIT in1 63 2\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *format_data = "data BIT in1 63 2\n";
   int fd, error, r = 0;
   DIRFILE *D;
 
+  rmdirfile();
   mkdir(filedir, 0777);
 
   fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
diff --git a/test/parse_bit_ncols.c b/test/parse_bit_ncols.c
index bdd0559..a8da6e4 100644
--- a/test/parse_bit_ncols.c
+++ b/test/parse_bit_ncols.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Parser check */
 #include "test.h"
 
@@ -10,12 +30,13 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* format_data = "data BIT in1\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *format_data = "data BIT in1\n";
   int fd, error, r = 0;
   DIRFILE *D;
 
+  rmdirfile();
   mkdir(filedir, 0777);
 
   fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
diff --git a/test/parse_bit_numbits.c b/test/parse_bit_numbits.c
index 9a8ed33..ef84c53 100644
--- a/test/parse_bit_numbits.c
+++ b/test/parse_bit_numbits.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Parser check */
 #include "test.h"
 
@@ -10,12 +30,13 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* format_data = "data BIT in1 1 0\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *format_data = "data BIT in1 1 0\n";
   int fd, error, r = 0;
   DIRFILE *D;
 
+  rmdirfile();
   mkdir(filedir, 0777);
 
   fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
diff --git a/test/parse_bit_scalar.c b/test/parse_bit_scalar.c
index 0dce204..e042c11 100644
--- a/test/parse_bit_scalar.c
+++ b/test/parse_bit_scalar.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Parser check */
 #include "test.h"
 
@@ -10,12 +30,13 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* format_data = "const CONST INT32 3\ndata BIT in1 const\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *format_data = "const CONST INT32 3\ndata BIT in1 const\n";
   int fd, error, r = 0;
   DIRFILE *D;
 
+  rmdirfile();
   mkdir(filedir, 0777);
 
   fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
diff --git a/test/parse_carray.c b/test/parse_carray.c
index 6e935fb..070b2a0 100644
--- a/test/parse_carray.c
+++ b/test/parse_carray.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2010-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Parser check */
 #include "test.h"
 
@@ -10,12 +30,13 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* format_data = "c CARRAY UINT8 1 2 3 4\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *format_data = "c CARRAY UINT8 1 2 3 4\n";
   int fd, error, r = 0;
   DIRFILE *D;
 
+  rmdirfile();
   mkdir(filedir, 0777);
 
   fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
diff --git a/test/parse_carray_long.c b/test/parse_carray_long.c
index 1d5b4d4..55c7206 100644
--- a/test/parse_carray_long.c
+++ b/test/parse_carray_long.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2010-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Parser check */
 #include "test.h"
 
@@ -10,12 +30,13 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* format_data = "c CARRAY UINT8 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *format_data = "c CARRAY UINT8 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41\n";
   int fd, error, r = 0;
   DIRFILE *D;
 
+  rmdirfile();
   mkdir(filedir, 0777);
 
   fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
diff --git a/test/parse_const.c b/test/parse_const.c
index 98ca38d..dbe3579 100644
--- a/test/parse_const.c
+++ b/test/parse_const.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Parser check */
 #include "test.h"
 
@@ -10,12 +30,13 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* format_data = "const CONST UINT8 1\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *format_data = "const CONST UINT8 1\n";
   int fd, error, r = 0;
   DIRFILE *D;
 
+  rmdirfile();
   mkdir(filedir, 0777);
 
   fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
diff --git a/test/parse_const_complex.c b/test/parse_const_complex.c
new file mode 100644
index 0000000..cd28c66
--- /dev/null
+++ b/test/parse_const_complex.c
@@ -0,0 +1,74 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+#include "test.h"
+
+#include <stdlib.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <string.h>
+#include <errno.h>
+
+int main(void)
+{
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *format_data = "const CONST COMPLEX128 1;2\n";
+  int fd, e1, e2, r = 0;
+#ifdef GD_NO_C99_API
+  double c[2];
+  const double v[2] = {1, 2};
+#else
+  complex double c;
+#endif
+  DIRFILE *D;
+
+  rmdirfile();
+  mkdir(filedir, 0777);
+
+  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
+  write(fd, format_data, strlen(format_data));
+  close(fd);
+
+  D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
+  e1 = gd_error(D);
+
+#ifdef GD_NO_C99_API
+  gd_get_constant(D, "const", GD_COMPLEX128, c);
+#else
+  gd_get_constant(D, "const", GD_COMPLEX128, &c);
+#endif
+  e2 = gd_error(D);
+  
+  gd_close(D);
+
+  unlink(format);
+  rmdir(filedir);
+
+  CHECKI(e1,GD_E_OK);
+  CHECKI(e2,GD_E_OK);
+#ifdef GD_NO_C99_API
+  CHECKC(c,v);
+#else
+  CHECKC(c,1 + _Complex_I * 2);
+#endif
+  return r;
+}
diff --git a/test/parse_const_ncols.c b/test/parse_const_ncols.c
index 4d8fc53..9c617d8 100644
--- a/test/parse_const_ncols.c
+++ b/test/parse_const_ncols.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Parser check */
 #include "test.h"
 
@@ -10,12 +30,13 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* format_data = "const RAW UINT8\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *format_data = "const RAW UINT8\n";
   int fd, error, r = 0;
   DIRFILE *D;
 
+  rmdirfile();
   mkdir(filedir, 0777);
 
   fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
diff --git a/test/parse_divide.c b/test/parse_divide.c
index d28c94b..15a9014 100644
--- a/test/parse_divide.c
+++ b/test/parse_divide.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2010-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Parser check */
 #include "test.h"
 
@@ -10,12 +30,13 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* format_data = "data DIVIDE in1 in2\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *format_data = "data DIVIDE in1 in2\n";
   int fd, error, r = 0;
   DIRFILE *D;
 
+  rmdirfile();
   mkdir(filedir, 0777);
 
   fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
diff --git a/test/parse_double.c b/test/parse_double.c
new file mode 100644
index 0000000..3f9dd7f
--- /dev/null
+++ b/test/parse_double.c
@@ -0,0 +1,86 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+#include "test.h"
+
+#include <stdlib.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <string.h>
+#include <math.h>
+
+int main(void)
+{
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *format_data =
+    "hex CONST FLOAT64 0xABC\n"
+    "dec CONST FLOAT64 1.3e3\n"
+    "flt CONST FLOAT64 -0x1.3p+3\n"
+    "inf CONST FLOAT64 INF\n"
+    "nan CONST FLOAT64 NAN\n";
+  int fd, e1, e2, e3, e4, e5, e6, r = 0;
+  double d, h, i, n, p;
+  DIRFILE *D;
+
+  rmdirfile();
+  mkdir(filedir, 0777);
+
+  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
+  write(fd, format_data, strlen(format_data));
+  close(fd);
+
+  D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
+  e1 = gd_error(D);
+
+  gd_get_constant(D, "dec", GD_FLOAT64, &d);
+  e2 = gd_error(D);
+  
+  gd_get_constant(D, "flt", GD_FLOAT64, &p);
+  e3 = gd_error(D);
+  
+  gd_get_constant(D, "inf", GD_FLOAT64, &i);
+  e4 = gd_error(D);
+  
+  gd_get_constant(D, "nan", GD_FLOAT64, &n);
+  e5 = gd_error(D);
+  
+  gd_get_constant(D, "hex", GD_FLOAT64, &h);
+  e6 = gd_error(D);
+  
+  gd_close(D);
+
+  unlink(format);
+  rmdir(filedir);
+
+  CHECKI(e1,GD_E_OK);
+  CHECKI(e2,GD_E_OK);
+  CHECKI(e3,GD_E_OK);
+  CHECKI(e4,GD_E_OK);
+  CHECKI(e5,GD_E_OK);
+  CHECKI(e6,GD_E_OK);
+  CHECKF(h,2748.);
+  CHECKF(d,1300.);
+  CHECKF(p,-9.5);
+  CHECK(isfinite(i),i,"%g","infinity",i);
+  CHECKNAN(n);
+  return r;
+}
diff --git a/test/parse_duplicate.c b/test/parse_duplicate.c
index 287272c..520d4f8 100644
--- a/test/parse_duplicate.c
+++ b/test/parse_duplicate.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Parser check */
 #include "test.h"
 
@@ -10,12 +30,13 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* format_data = "data RAW UINT8 1\ndata RAW UINT8 1\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *format_data = "data RAW UINT8 1\ndata RAW UINT8 1\n";
   int fd, error, r = 0;
   DIRFILE *D;
 
+  rmdirfile();
   mkdir(filedir, 0777);
 
   fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
diff --git a/test/parse_duplicate_ignore.c b/test/parse_duplicate_ignore.c
index 3f63a8a..ab8f2c1 100644
--- a/test/parse_duplicate_ignore.c
+++ b/test/parse_duplicate_ignore.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Parser check */
 #include "test.h"
 
@@ -10,12 +30,13 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* format_data = "data RAW UINT8 1\ndata RAW UINT8 1\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *format_data = "data RAW UINT8 1\ndata RAW UINT8 1\n";
   int fd, error, r = 0;
   DIRFILE *D;
 
+  rmdirfile();
   mkdir(filedir, 0777);
 
   fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
diff --git a/test/parse_endian_bad.c b/test/parse_endian_bad.c
index b524b89..746b5c4 100644
--- a/test/parse_endian_bad.c
+++ b/test/parse_endian_bad.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Parser check */
 #include "test.h"
 
@@ -10,12 +30,13 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* format_data = "ENDIAN badendianness\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *format_data = "ENDIAN badendianness\n";
   int fd, error, r = 0;
   DIRFILE *D;
 
+  rmdirfile();
   mkdir(filedir, 0777);
 
   fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
diff --git a/test/parse_endian_big.c b/test/parse_endian_big.c
index 6b74a0e..b6c2bdf 100644
--- a/test/parse_endian_big.c
+++ b/test/parse_endian_big.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Parser check */
 #include "test.h"
 
@@ -10,12 +30,13 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* format_data = "ENDIAN big\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *format_data = "ENDIAN big\n";
   int fd, error, r = 0;
   DIRFILE *D;
 
+  rmdirfile();
   mkdir(filedir, 0777);
 
   fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
diff --git a/test/parse_endian_force.c b/test/parse_endian_force.c
index 68fae20..be406f1 100644
--- a/test/parse_endian_force.c
+++ b/test/parse_endian_force.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Parser check */
 #include "test.h"
 
@@ -10,12 +30,13 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* format_data = "ENDIAN badendianness\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *format_data = "ENDIAN badendianness\n";
   int fd, error, r = 0;
   DIRFILE *D;
 
+  rmdirfile();
   mkdir(filedir, 0777);
 
   fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
diff --git a/test/parse_endian_little.c b/test/parse_endian_little.c
index 54cfd57..baa7c55 100644
--- a/test/parse_endian_little.c
+++ b/test/parse_endian_little.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Parser check */
 #include "test.h"
 
@@ -10,12 +30,13 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* format_data = "ENDIAN little\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *format_data = "ENDIAN little\n";
   int fd, error, r = 0;
   DIRFILE *D;
 
+  rmdirfile();
   mkdir(filedir, 0777);
 
   fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
diff --git a/test/parse_endian_slash.c b/test/parse_endian_slash.c
index ff9ae40..77f53fd 100644
--- a/test/parse_endian_slash.c
+++ b/test/parse_endian_slash.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Parser check */
 #include "test.h"
 
@@ -10,12 +30,13 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* format_data = "/ENDIAN big\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *format_data = "/ENDIAN big\n";
   int fd, error, r = 0;
   DIRFILE *D;
 
+  rmdirfile();
   mkdir(filedir, 0777);
 
   fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
diff --git a/test/parse_eol.c b/test/parse_eol.c
index df1dabe..c43e7b2 100644
--- a/test/parse_eol.c
+++ b/test/parse_eol.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Parser check */
 #include "test.h"
 
@@ -10,12 +30,13 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* format_data = "data RAW UINT8 1\\\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *format_data = "data RAW UINT8 1\\\n";
   int fd, error, r = 0;
   DIRFILE *D;
 
+  rmdirfile();
   mkdir(filedir, 0777);
 
   fd = open(format, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
diff --git a/test/parse_foffs.c b/test/parse_foffs.c
index f235b9b..7d7cd60 100644
--- a/test/parse_foffs.c
+++ b/test/parse_foffs.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Parser check */
 #include "test.h"
 
@@ -10,12 +30,13 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* format_data = "FRAMEOFFSET 73\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *format_data = "FRAMEOFFSET 73\n";
   int fd, error, r = 0;
   DIRFILE *D;
 
+  rmdirfile();
   mkdir(filedir, 0777);
 
   fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
diff --git a/test/parse_foffs_include.c b/test/parse_foffs_include.c
index fadd6b3..0389757 100644
--- a/test/parse_foffs_include.c
+++ b/test/parse_foffs_include.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Parser check */
 #include "test.h"
 
@@ -12,22 +32,23 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* format_data = "FRAMEOFFSET 1\nINCLUDE format1\nINCLUDE format2";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *format_data = "FRAMEOFFSET 1\nINCLUDE format1\nINCLUDE format2";
 
-  const char* data1 = __TEST__ "dirfile/data1";
-  const char* format1 = __TEST__ "dirfile/format1";
-  const char* format1_data = "data1 RAW UINT8 1\n";
+  const char *data1 = "dirfile/data1";
+  const char *format1 = "dirfile/format1";
+  const char *format1_data = "data1 RAW UINT8 1\n";
 
-  const char* data2 = __TEST__ "dirfile/data2";
-  const char* format2 = __TEST__ "dirfile/format2";
-  const char* format2_data = "data2 RAW UINT8 1\nFRAMEOFFSET 2";
+  const char *data2 = "dirfile/data2";
+  const char *format2 = "dirfile/format2";
+  const char *format2_data = "data2 RAW UINT8 1\nFRAMEOFFSET 2";
 
   int fd, error, error2, error3, r = 0;
   uint8_t data_data[4] = { 0, 1, 2, 3 };
   DIRFILE *D;
 
+  rmdirfile();
   mkdir(filedir, 0777);
 
   fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
diff --git a/test/parse_foffs_slash.c b/test/parse_foffs_slash.c
index 9568a83..5a235f0 100644
--- a/test/parse_foffs_slash.c
+++ b/test/parse_foffs_slash.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Parser check */
 #include "test.h"
 
@@ -10,12 +30,13 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* format_data = "/FRAMEOFFSET 73\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *format_data = "/FRAMEOFFSET 73\n";
   int fd, error, r = 0;
   DIRFILE *D;
 
+  rmdirfile();
   mkdir(filedir, 0777);
 
   fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
diff --git a/test/parse_hidden.c b/test/parse_hidden.c
new file mode 100644
index 0000000..c2b8773
--- /dev/null
+++ b/test/parse_hidden.c
@@ -0,0 +1,48 @@
+/* Copyright (C) 2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+/* Parser check */
+#include "test.h"
+
+int main(void)
+{
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *format_data = "data RAW UINT8 1\n/HIDDEN data\n";
+  int fd, error, r = 0;
+  DIRFILE *D;
+
+  rmdirfile();
+  mkdir(filedir, 0777);
+
+  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
+  write(fd, format_data, strlen(format_data));
+  close(fd);
+
+  D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
+  error = gd_error(D);
+  gd_close(D);
+
+  unlink(format);
+  rmdir(filedir);
+
+  CHECKI(error,GD_E_OK);
+  return r;
+}
diff --git a/test/parse_hidden_field.c b/test/parse_hidden_field.c
new file mode 100644
index 0000000..12ac204
--- /dev/null
+++ b/test/parse_hidden_field.c
@@ -0,0 +1,48 @@
+/* Copyright (C) 2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+/* Parser check */
+#include "test.h"
+
+int main(void)
+{
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *format_data = "/HIDDEN data\n";
+  int fd, error, r = 0;
+  DIRFILE *D;
+
+  rmdirfile();
+  mkdir(filedir, 0777);
+
+  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
+  write(fd, format_data, strlen(format_data));
+  close(fd);
+
+  D = gd_open(filedir, GD_RDONLY);
+  error = gd_error(D);
+  gd_close(D);
+
+  unlink(format);
+  rmdir(filedir);
+
+  CHECKI(error,GD_E_FORMAT);
+  return r;
+}
diff --git a/test/parse_hidden_meta.c b/test/parse_hidden_meta.c
new file mode 100644
index 0000000..6873f02
--- /dev/null
+++ b/test/parse_hidden_meta.c
@@ -0,0 +1,51 @@
+/* Copyright (C) 2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+/* Parser check */
+#include "test.h"
+
+int main(void)
+{
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *format_data =
+    "data RAW UINT8 1\n"
+    "data/meta CONST UINT8 1\n"
+    "/HIDDEN data/meta\n";
+  int fd, error, r = 0;
+  DIRFILE *D;
+
+  rmdirfile();
+  mkdir(filedir, 0777);
+
+  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
+  write(fd, format_data, strlen(format_data));
+  close(fd);
+
+  D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
+  error = gd_error(D);
+  gd_close(D);
+
+  unlink(format);
+  rmdir(filedir);
+
+  CHECKI(error,GD_E_OK);
+  return r;
+}
diff --git a/test/parse_include.c b/test/parse_include.c
index e77f040..f0d40e8 100644
--- a/test/parse_include.c
+++ b/test/parse_include.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Test include */
 #include "test.h"
 
@@ -10,15 +30,16 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* format1 = __TEST__ "dirfile/format1";
-  const char* format_data = "INCLUDE format1\n";
-  const char* format1_data = "data RAW UINT8 11\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *format1 = "dirfile/format1";
+  const char *format_data = "INCLUDE format1\n";
+  const char *format1_data = "data RAW UINT8 11\n";
   int fd, r = 0;
   DIRFILE *D;
-  gd_spf_t spf;
+  unsigned int spf;
 
+  rmdirfile();
   mkdir(filedir, 0777);
 
   fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
diff --git a/test/parse_include_absolute.c b/test/parse_include_absolute.c
index dec8097..097bce5 100644
--- a/test/parse_include_absolute.c
+++ b/test/parse_include_absolute.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2011-2012 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Test include */
 #include "test.h"
 
@@ -11,31 +31,25 @@
 
 int main(void)
 {
-#if defined HAVE_GETCWD || defined HAVE__GETCWD
-#ifdef HAVE__GETCWD
-#define getcwd _getcwd
-#endif
-  const char *filedir = __TEST__ "dirfile";
-  const char *format = __TEST__ "dirfile/format";
-  const char *format1 = __TEST__ "dirfile/format1";
+#if defined GD_NO_GETCWD
+  return 77;
+#else
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *format1 = "dirfile/format1";
   const char *format_data1 = "INCLUDE ";
-  const char *format_data2 = "/" __TEST__ "dirfile/format1\n";
+  const char *format_data2 = "/dirfile/format1\n";
   const char *format1_data = "data RAW UINT8 11\n";
   int cwd_size = 2048;
   char *ptr, *cwd = NULL;
   int fd, r = 0;
   DIRFILE *D;
-  gd_spf_t spf;
+  unsigned int spf;
 
+  rmdirfile();
   mkdir(filedir, 0777);
 
-  do {
-    ptr = (char*)realloc(cwd, cwd_size *= 2);
-    if (ptr == NULL) {
-      fprintf(stderr, "out of memory for cwd!\n");
-      exit(1);
-    }
-  } while (!getcwd(cwd = ptr, cwd_size));
+  gdtest_getcwd(ptr, cwd, cwd_size);
 
   fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
   write(fd, format_data1, strlen(format_data1));
@@ -58,7 +72,5 @@ int main(void)
   CHECKU(spf, 11);
   free(cwd);
   return r;
-#else
-  return 77;
 #endif
 }
diff --git a/test/parse_include_absrel.c b/test/parse_include_absrel.c
index 6fd4e7f..566fac6 100644
--- a/test/parse_include_absrel.c
+++ b/test/parse_include_absrel.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2011-2012 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Test include */
 #include "test.h"
 
@@ -11,33 +31,27 @@
 
 int main(void)
 {
-#if defined HAVE_GETCWD || defined HAVE__GETCWD
-#ifdef HAVE__GETCWD
-#define getcwd _getcwd
-#endif
-  const char *filedir = __TEST__ "dirfile";
-  const char *format = __TEST__ "dirfile/format";
-  const char *format1 = __TEST__ "dirfile/format1";
-  const char *format2 = __TEST__ "dirfile/format2";
+#if defined GD_NO_GETCWD
+  return 77;
+#else
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *format1 = "dirfile/format1";
+  const char *format2 = "dirfile/format2";
   const char *format_data1 = "INCLUDE ";
-  const char *format_data2 = "/" __TEST__ "dirfile/format1\n";
+  const char *format_data2 = "/dirfile/format1\n";
   const char *format1_data = "INCLUDE format2\n";
   const char *format2_data = "data RAW UINT8 11\n";
   int cwd_size = 2048;
   char *ptr, *cwd = NULL;
   int fd, r = 0;
   DIRFILE *D;
-  gd_spf_t spf;
+  unsigned int spf;
 
+  rmdirfile();
   mkdir(filedir, 0777);
 
-  do {
-    ptr = (char*)realloc(cwd, cwd_size *= 2);
-    if (ptr == NULL) {
-      fprintf(stderr, "out of memory for cwd!\n");
-      exit(1);
-    }
-  } while (!getcwd(cwd = ptr, cwd_size));
+  gdtest_getcwd(ptr, cwd, cwd_size);
 
   fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
   write(fd, format_data1, strlen(format_data1));
@@ -65,7 +79,5 @@ int main(void)
   CHECKU(spf, 11);
   free(cwd);
   return r;
-#else
-  return 77;
 #endif
 }
diff --git a/test/parse_include_affix_ref.c b/test/parse_include_affix_ref.c
new file mode 100644
index 0000000..6130a00
--- /dev/null
+++ b/test/parse_include_affix_ref.c
@@ -0,0 +1,65 @@
+/* Copyright (C) 2013 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+/* Test include */
+#include "test.h"
+
+#include <stdlib.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <string.h>
+#include <errno.h>
+
+int main(void)
+{
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *format1 = "dirfile/format1";
+  const char *format_data =
+    "data RAW UINT8 1\n"
+    "INCLUDE format1 A B\n";
+  const char *format1_data = "zata RAW UINT8 11\n/REFERENCE zata\n";
+  int fd, r = 0;
+  DIRFILE *D;
+  const char *ref;
+
+  rmdirfile();
+  mkdir(filedir, 0777);
+
+  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
+  write(fd, format_data, strlen(format_data));
+  close(fd);
+
+  fd = open(format1, O_CREAT | O_EXCL | O_WRONLY, 0666);
+  write(fd, format1_data, strlen(format1_data));
+  close(fd);
+
+  D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
+  ref = gd_reference(D, NULL);
+  CHECKS(ref, "AzataB");
+  gd_close(D);
+
+  unlink(format1);
+  unlink(format);
+  rmdir(filedir);
+
+  return r;
+}
diff --git a/test/parse_include_dir.c b/test/parse_include_dir.c
new file mode 100644
index 0000000..741fd41
--- /dev/null
+++ b/test/parse_include_dir.c
@@ -0,0 +1,58 @@
+/* Copyright (C) 2012 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+#include "test.h"
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <string.h>
+#include <errno.h>
+
+int main(void)
+{
+  const char *filedir = "dirfile";
+  const char *subdir = "dirfile/sub";
+  const char *format = "dirfile/format";
+  const char *format_data = "INCLUDE sub\n";
+  int fd, error, r = 0;
+  DIRFILE *D;
+
+  rmdirfile();
+  mkdir(filedir, 0777);
+  mkdir(subdir, 0777);
+
+  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
+  write(fd, format_data, strlen(format_data));
+  close(fd);
+
+  D = gd_open(filedir, GD_RDONLY);
+  error = gd_error(D);
+  gd_close(D);
+
+  unlink(format);
+  rmdir(subdir);
+  rmdir(filedir);
+
+  CHECKI(error, GD_E_OPEN_FRAGMENT);
+  return r;
+}
diff --git a/test/parse_include_loop.c b/test/parse_include_loop.c
new file mode 100644
index 0000000..9241cf3
--- /dev/null
+++ b/test/parse_include_loop.c
@@ -0,0 +1,55 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+/* Test include */
+#include "test.h"
+
+#include <stdlib.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <string.h>
+#include <errno.h>
+
+int main(void)
+{
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *format_data = "INCLUDE format\n";
+  int fd, e, r = 0;
+  DIRFILE *D;
+
+  rmdirfile();
+  mkdir(filedir, 0777);
+
+  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
+  write(fd, format_data, strlen(format_data));
+  close(fd);
+
+  D = gd_open(filedir, GD_RDONLY);
+  e = gd_error(D);
+  gd_close(D);
+
+  unlink(format);
+  rmdir(filedir);
+
+  CHECKI(e, GD_E_RECURSE_LEVEL);
+  return r;
+}
diff --git a/test/parse_include_nonexistent.c b/test/parse_include_nonexistent.c
index dfb86db..16f14ed 100644
--- a/test/parse_include_nonexistent.c
+++ b/test/parse_include_nonexistent.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Parser check */
 #include "test.h"
 
@@ -10,12 +30,13 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* format_data = "INCLUDE non_existent_file\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *format_data = "INCLUDE non_existent_file\n";
   int fd, error, r = 0;
   DIRFILE *D;
 
+  rmdirfile();
   mkdir(filedir, 0777);
 
   fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
diff --git a/test/parse_include_prefix.c b/test/parse_include_prefix.c
new file mode 100644
index 0000000..89971ea
--- /dev/null
+++ b/test/parse_include_prefix.c
@@ -0,0 +1,57 @@
+/* Copyright (C) 2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+#include "test.h"
+
+int main(void)
+{
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *format1 = "dirfile/format1";
+  const char *format_data = "INCLUDE format1 pre\n";
+  const char *format1_data = "data RAW UINT8 11\n";
+  int fd, r = 0;
+  DIRFILE *D;
+  unsigned int spf, spfaff;
+
+  rmdirfile();
+  mkdir(filedir, 0777);
+
+  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
+  write(fd, format_data, strlen(format_data));
+  close(fd);
+
+  fd = open(format1, O_CREAT | O_EXCL | O_WRONLY, 0666);
+  write(fd, format1_data, strlen(format1_data));
+  close(fd);
+
+  D = gd_open(filedir, GD_RDONLY);
+  spf = gd_spf(D, "data");
+  spfaff = gd_spf(D, "predata");
+  gd_close(D);
+
+  unlink(format1);
+  unlink(format);
+  rmdir(filedir);
+
+  CHECKU(spf, 0);
+  CHECKU(spfaff, 11);
+  return r;
+}
diff --git a/test/parse_include_prefix_dup.c b/test/parse_include_prefix_dup.c
new file mode 100644
index 0000000..0404872
--- /dev/null
+++ b/test/parse_include_prefix_dup.c
@@ -0,0 +1,54 @@
+/* Copyright (C) 2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+#include "test.h"
+
+int main(void)
+{
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *format1 = "dirfile/format1";
+  const char *format_data = "INCLUDE format1 pre\npredata RAW UINT8 1\n";
+  const char *format1_data = "data RAW UINT8 11\n";
+  int fd, e, r = 0;
+  DIRFILE *D;
+
+  rmdirfile();
+  mkdir(filedir, 0777);
+
+  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
+  write(fd, format_data, strlen(format_data));
+  close(fd);
+
+  fd = open(format1, O_CREAT | O_EXCL | O_WRONLY, 0666);
+  write(fd, format1_data, strlen(format1_data));
+  close(fd);
+
+  D = gd_open(filedir, GD_RDONLY);
+  e = gd_error(D);
+  gd_close(D);
+
+  unlink(format1);
+  unlink(format);
+  rmdir(filedir);
+
+  CHECKI(e, GD_E_FORMAT);
+  return r;
+}
diff --git a/test/parse_include_preprefix.c b/test/parse_include_preprefix.c
new file mode 100644
index 0000000..3187ec5
--- /dev/null
+++ b/test/parse_include_preprefix.c
@@ -0,0 +1,66 @@
+/* Copyright (C) 2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+#include "test.h"
+
+int main(void)
+{
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *format1 = "dirfile/format1";
+  const char *format2 = "dirfile/format2";
+  const char *format_data = "INCLUDE format1 pre\n";
+  const char *format1_data = "INCLUDE format2 PRE\n";
+  const char *format2_data = "data RAW UINT8 11\n";
+  int fd, r = 0;
+  DIRFILE *D;
+  unsigned int spf, spf1, spf2;
+
+  rmdirfile();
+  mkdir(filedir, 0777);
+
+  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
+  write(fd, format_data, strlen(format_data));
+  close(fd);
+
+  fd = open(format1, O_CREAT | O_EXCL | O_WRONLY, 0666);
+  write(fd, format1_data, strlen(format1_data));
+  close(fd);
+
+  fd = open(format2, O_CREAT | O_EXCL | O_WRONLY, 0666);
+  write(fd, format2_data, strlen(format2_data));
+  close(fd);
+
+  D = gd_open(filedir, GD_RDONLY);
+  spf = gd_spf(D, "data");
+  spf1 = gd_spf(D, "predata");
+  spf2 = gd_spf(D, "prePREdata");
+  gd_close(D);
+
+  unlink(format2);
+  unlink(format1);
+  unlink(format);
+  rmdir(filedir);
+
+  CHECKU(spf, 0);
+  CHECKU(spf1, 0);
+  CHECKU(spf2, 11);
+  return r;
+}
diff --git a/test/parse_include_ref.c b/test/parse_include_ref.c
new file mode 100644
index 0000000..6dcadd4
--- /dev/null
+++ b/test/parse_include_ref.c
@@ -0,0 +1,66 @@
+/* Copyright (C) 2012 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+/* Test include */
+#include "test.h"
+
+#include <stdlib.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <string.h>
+#include <errno.h>
+
+int main(void)
+{
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *format1 = "dirfile/format1";
+  const char *format_data =
+    "data RAW UINT8 1\n"
+    "/REFERENCE data\n"
+    "INCLUDE format1\n";
+  const char *format1_data = "zata RAW UINT8 11\n/REFERENCE zata\n";
+  int fd, r = 0;
+  DIRFILE *D;
+  const char *ref;
+
+  rmdirfile();
+  mkdir(filedir, 0777);
+
+  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
+  write(fd, format_data, strlen(format_data));
+  close(fd);
+
+  fd = open(format1, O_CREAT | O_EXCL | O_WRONLY, 0666);
+  write(fd, format1_data, strlen(format1_data));
+  close(fd);
+
+  D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
+  ref = gd_reference(D, NULL);
+  CHECKS(ref, "zata");
+  gd_close(D);
+
+  unlink(format1);
+  unlink(format);
+  rmdir(filedir);
+
+  return r;
+}
diff --git a/test/parse_include_relabs.c b/test/parse_include_relabs.c
index a562863..2cf28b9 100644
--- a/test/parse_include_relabs.c
+++ b/test/parse_include_relabs.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2011-2012 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Test include */
 #include "test.h"
 
@@ -11,35 +31,29 @@
 
 int main(void)
 {
-#if defined HAVE_GETCWD || defined HAVE__GETCWD
-#ifdef HAVE__GETCWD
-#define getcwd _getcwd
-#endif
-  const char *filedir = __TEST__ "dirfile";
-  const char *subdir = __TEST__ "dirfile/sub";
-  const char *format = __TEST__ "dirfile/format";
-  const char *format1 = __TEST__ "dirfile/sub/format1";
-  const char *format2 = __TEST__ "dirfile/sub/format2";
+#if defined GD_NO_GETCWD
+  return 77;
+#else
+  const char *filedir = "dirfile";
+  const char *subdir = "dirfile/sub";
+  const char *format = "dirfile/format";
+  const char *format1 = "dirfile/sub/format1";
+  const char *format2 = "dirfile/sub/format2";
   const char *format_data = "INCLUDE sub/format1\n";
   const char *format1_data1 = "INCLUDE ";
-  const char *format1_data2 = "/" __TEST__ "dirfile/sub/format2\n";
+  const char *format1_data2 = "/dirfile/sub/format2\n";
   const char *format2_data = "data RAW UINT8 11\n";
   int cwd_size = 2048;
   char *ptr, *cwd = NULL;
   int fd, r = 0;
   DIRFILE *D;
-  gd_spf_t spf;
+  unsigned int spf;
 
+  rmdirfile();
   mkdir(filedir, 0777);
-  mkdirsub(subdir, 0777);
+  mkdir(subdir, 0777);
 
-  do {
-    ptr = (char*)realloc(cwd, cwd_size *= 2);
-    if (ptr == NULL) {
-      fprintf(stderr, "out of memory for cwd!\n");
-      exit(1);
-    }
-  } while (!getcwd(cwd = ptr, cwd_size));
+  gdtest_getcwd(ptr, cwd, cwd_size);
 
   fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
   write(fd, format_data, strlen(format_data));
@@ -68,7 +82,5 @@ int main(void)
   CHECKU(spf, 11);
   free(cwd);
   return r;
-#else
-  return 77;
 #endif
 }
diff --git a/test/parse_include_relrel.c b/test/parse_include_relrel.c
index 08e3eec..adadc35 100644
--- a/test/parse_include_relrel.c
+++ b/test/parse_include_relrel.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Test include */
 #include "test.h"
 
@@ -11,20 +31,21 @@
 
 int main(void)
 {
-  const char *filedir = __TEST__ "dirfile";
-  const char *subdir = __TEST__ "dirfile/sub";
-  const char *format = __TEST__ "dirfile/format";
-  const char *format1 = __TEST__ "dirfile/sub/format1";
-  const char *format2 = __TEST__ "dirfile/sub/format2";
+  const char *filedir = "dirfile";
+  const char *subdir = "dirfile/sub";
+  const char *format = "dirfile/format";
+  const char *format1 = "dirfile/sub/format1";
+  const char *format2 = "dirfile/sub/format2";
   const char *format_data = "INCLUDE sub/format1\n";
   const char *format1_data = "INCLUDE format2\n";
   const char *format2_data = "data RAW UINT8 11\n";
   int fd, r = 0;
   DIRFILE *D;
-  gd_spf_t spf;
+  unsigned int spf;
 
+  rmdirfile();
   mkdir(filedir, 0777);
-  mkdirsub(subdir, 0777);
+  mkdir(subdir, 0777);
 
   fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
   write(fd, format_data, strlen(format_data));
diff --git a/test/parse_include_slash.c b/test/parse_include_slash.c
index 7baf7ee..2a500fb 100644
--- a/test/parse_include_slash.c
+++ b/test/parse_include_slash.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Test include */
 #include "test.h"
 
@@ -10,15 +30,16 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* format1 = __TEST__ "dirfile/format1";
-  const char* format_data = "/INCLUDE format1\n";
-  const char* format1_data = "data RAW UINT8 11\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *format1 = "dirfile/format1";
+  const char *format_data = "/INCLUDE format1\n";
+  const char *format1_data = "data RAW UINT8 11\n";
   int fd, r = 0;
   DIRFILE *D;
-  gd_spf_t spf;
+  unsigned int spf;
 
+  rmdirfile();
   mkdir(filedir, 0777);
 
   fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
diff --git a/test/parse_include_suffix.c b/test/parse_include_suffix.c
new file mode 100644
index 0000000..6d0738f
--- /dev/null
+++ b/test/parse_include_suffix.c
@@ -0,0 +1,57 @@
+/* Copyright (C) 2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+#include "test.h"
+
+int main(void)
+{
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *format1 = "dirfile/format1";
+  const char *format_data = "INCLUDE format1 pre post\n";
+  const char *format1_data = "data RAW UINT8 11\n";
+  int fd, r = 0;
+  DIRFILE *D;
+  unsigned int spf, spfaff;
+
+  rmdirfile();
+  mkdir(filedir, 0777);
+
+  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
+  write(fd, format_data, strlen(format_data));
+  close(fd);
+
+  fd = open(format1, O_CREAT | O_EXCL | O_WRONLY, 0666);
+  write(fd, format1_data, strlen(format1_data));
+  close(fd);
+
+  D = gd_open(filedir, GD_RDONLY);
+  spf = gd_spf(D, "data");
+  spfaff = gd_spf(D, "predatapost");
+  gd_close(D);
+
+  unlink(format1);
+  unlink(format);
+  rmdir(filedir);
+
+  CHECKU(spf, 0);
+  CHECKU(spfaff, 11);
+  return r;
+}
diff --git a/test/parse_include_sufsuffix.c b/test/parse_include_sufsuffix.c
new file mode 100644
index 0000000..2b6136a
--- /dev/null
+++ b/test/parse_include_sufsuffix.c
@@ -0,0 +1,66 @@
+/* Copyright (C) 2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+#include "test.h"
+
+int main(void)
+{
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *format1 = "dirfile/format1";
+  const char *format2 = "dirfile/format2";
+  const char *format_data = "INCLUDE format1 pre post\n";
+  const char *format1_data = "INCLUDE format2 \"\" POST\n";
+  const char *format2_data = "data RAW UINT8 11\n";
+  int fd, r = 0;
+  DIRFILE *D;
+  unsigned int spf, spf1, spf2;
+
+  rmdirfile();
+  mkdir(filedir, 0777);
+
+  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
+  write(fd, format_data, strlen(format_data));
+  close(fd);
+
+  fd = open(format1, O_CREAT | O_EXCL | O_WRONLY, 0666);
+  write(fd, format1_data, strlen(format1_data));
+  close(fd);
+
+  fd = open(format2, O_CREAT | O_EXCL | O_WRONLY, 0666);
+  write(fd, format2_data, strlen(format2_data));
+  close(fd);
+
+  D = gd_open(filedir, GD_RDONLY);
+  spf = gd_spf(D, "data");
+  spf1 = gd_spf(D, "predatapost");
+  spf2 = gd_spf(D, "predataPOSTpost");
+  gd_close(D);
+
+  unlink(format2);
+  unlink(format1);
+  unlink(format);
+  rmdir(filedir);
+
+  CHECKU(spf, 0);
+  CHECKU(spf1, 0);
+  CHECKU(spf2, 11);
+  return r;
+}
diff --git a/test/parse_index.c b/test/parse_index.c
index 6fb9401..a61e346 100644
--- a/test/parse_index.c
+++ b/test/parse_index.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Parser check */
 #include "test.h"
 
@@ -10,12 +30,13 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* format_data = "INDEX RAW UINT8 1\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *format_data = "INDEX RAW UINT8 1\n";
   int fd, error, r = 0;
   DIRFILE *D;
 
+  rmdirfile();
   mkdir(filedir, 0777);
 
   fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
diff --git a/test/parse_lincom.c b/test/parse_lincom.c
index 1cf8f2d..9ad7060 100644
--- a/test/parse_lincom.c
+++ b/test/parse_lincom.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Parser check */
 #include "test.h"
 
@@ -10,12 +30,13 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* format_data = "lincom LINCOM 2 in1 1 0 in2 1 0\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *format_data = "lincom LINCOM 2 in1 1 0 in2 1 0\n";
   int fd, error, r = 0;
   DIRFILE *D;
 
+  rmdirfile();
   mkdir(filedir, 0777);
 
   fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
diff --git a/test/parse_lincom_ncols1.c b/test/parse_lincom_ncols1.c
index ff3029e..8562cba 100644
--- a/test/parse_lincom_ncols1.c
+++ b/test/parse_lincom_ncols1.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Parser check */
 #include "test.h"
 
@@ -10,12 +30,13 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* format_data = "lincom LINCOM\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *format_data = "lincom LINCOM\n";
   int fd, error, r = 0;
   DIRFILE *D;
 
+  rmdirfile();
   mkdir(filedir, 0777);
 
   fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
diff --git a/test/parse_lincom_ncols2.c b/test/parse_lincom_ncols2.c
index 78b2c1b..211f589 100644
--- a/test/parse_lincom_ncols2.c
+++ b/test/parse_lincom_ncols2.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Parser check */
 #include "test.h"
 
@@ -10,12 +30,13 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* format_data = "lincom LINCOM 2 in1 1 0\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *format_data = "lincom LINCOM 2 in1 1 0\n";
   int fd, error, r = 0;
   DIRFILE *D;
 
+  rmdirfile();
   mkdir(filedir, 0777);
 
   fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
diff --git a/test/parse_lincom_nfields.c b/test/parse_lincom_nfields.c
index 0157915..2d4c4fe 100644
--- a/test/parse_lincom_nfields.c
+++ b/test/parse_lincom_nfields.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Parser check */
 #include "test.h"
 
@@ -10,12 +30,13 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* format_data = "lincom LINCOM 4 in1 1 0 in2 1 0 in1 1 0 in2 1 0\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *format_data = "lincom LINCOM 4 in1 1 0 in2 1 0 in1 1 0 in2 1 0\n";
   int fd, error, r = 0;
   DIRFILE *D;
 
+  rmdirfile();
   mkdir(filedir, 0777);
 
   fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
diff --git a/test/parse_lincom_nofields.c b/test/parse_lincom_nofields.c
index 9453494..23d5d7c 100644
--- a/test/parse_lincom_nofields.c
+++ b/test/parse_lincom_nofields.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Parser check */
 #include "test.h"
 
@@ -10,12 +30,13 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* format_data = "lincom LINCOM 0\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *format_data = "lincom LINCOM 0\n";
   int fd, error, r = 0;
   DIRFILE *D;
 
+  rmdirfile();
   mkdir(filedir, 0777);
 
   fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
diff --git a/test/parse_lincom_non.c b/test/parse_lincom_non.c
index 43996dd..0f656b6 100644
--- a/test/parse_lincom_non.c
+++ b/test/parse_lincom_non.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2009-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Parser check */
 #include "test.h"
 
@@ -10,12 +30,13 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* format_data = "lincom LINCOM in1 1 0 in2 1 0\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *format_data = "lincom LINCOM in1 1 0 in2 1 0\n";
   int fd, error, r = 0;
   DIRFILE *D;
 
+  rmdirfile();
   mkdir(filedir, 0777);
 
   fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
diff --git a/test/parse_lincom_non_ncols.c b/test/parse_lincom_non_ncols.c
index 1c60ed0..42c41a0 100644
--- a/test/parse_lincom_non_ncols.c
+++ b/test/parse_lincom_non_ncols.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2009-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Parser check */
 #include "test.h"
 
@@ -10,12 +30,13 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* format_data = "lincom LINCOM in1 1 0 in2\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *format_data = "lincom LINCOM in1 1 0 in2\n";
   int fd, error, r = 0;
   DIRFILE *D;
 
+  rmdirfile();
   mkdir(filedir, 0777);
 
   fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
diff --git a/test/parse_lincom_scalar.c b/test/parse_lincom_scalar.c
index d5cee85..9d2481f 100644
--- a/test/parse_lincom_scalar.c
+++ b/test/parse_lincom_scalar.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Parser check */
 #include "test.h"
 
@@ -10,14 +30,15 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* format_data =
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *format_data =
     "const  CONST FLOAT64 3.2\n"
     "lincom LINCOM 1 in1 const 0\n";
   int fd, error, r = 0;
   DIRFILE *D;
 
+  rmdirfile();
   mkdir(filedir, 0777);
 
   fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
diff --git a/test/parse_linterp.c b/test/parse_linterp.c
index 0a3df3f..6184cb2 100644
--- a/test/parse_linterp.c
+++ b/test/parse_linterp.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Parser check */
 #include "test.h"
 
@@ -10,12 +30,13 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* format_data = "data LINTERP in1 lut\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *format_data = "data LINTERP in1 lut\n";
   int fd, error, r = 0;
   DIRFILE *D;
 
+  rmdirfile();
   mkdir(filedir, 0777);
 
   fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
diff --git a/test/parse_linterp_ncols.c b/test/parse_linterp_ncols.c
index e4da8e7..25dba8c 100644
--- a/test/parse_linterp_ncols.c
+++ b/test/parse_linterp_ncols.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Parser check */
 #include "test.h"
 
@@ -10,12 +30,13 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* format_data = "data LINTERP in1\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *format_data = "data LINTERP in1\n";
   int fd, error, r = 0;
   DIRFILE *D;
 
+  rmdirfile();
   mkdir(filedir, 0777);
 
   fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
diff --git a/test/parse_malias.c b/test/parse_malias.c
new file mode 100644
index 0000000..d084bf3
--- /dev/null
+++ b/test/parse_malias.c
@@ -0,0 +1,51 @@
+/* Copyright (C) 2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+/* Parser check */
+#include "test.h"
+
+int main(void)
+{
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *format_data =
+    "data RAW UINT8 1\n"
+    "cata CONST UINT8 1\n"
+    "/ALIAS data/eata cata\n";
+  int fd, error, r = 0;
+  DIRFILE *D;
+
+  rmdirfile();
+  mkdir(filedir, 0777);
+
+  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
+  write(fd, format_data, strlen(format_data));
+  close(fd);
+
+  D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
+  error = gd_error(D);
+  gd_discard(D);
+
+  unlink(format);
+  rmdir(filedir);
+
+  CHECKI(error,0);
+  return r;
+}
diff --git a/test/parse_malias_dup.c b/test/parse_malias_dup.c
new file mode 100644
index 0000000..7c506f3
--- /dev/null
+++ b/test/parse_malias_dup.c
@@ -0,0 +1,52 @@
+/* Copyright (C) 2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+/* Parser check */
+#include "test.h"
+
+int main(void)
+{
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *format_data =
+    "data RAW UINT8 1\n"
+    "data/cata CONST UINT8 1\n"
+    "/ALIAS eata data\n"
+    "/ALIAS eata/cata data/cata\n";
+  int fd, error, r = 0;
+  DIRFILE *D;
+
+  rmdirfile();
+  mkdir(filedir, 0777);
+
+  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
+  write(fd, format_data, strlen(format_data));
+  close(fd);
+
+  D = gd_open(filedir, GD_RDONLY);
+  error = gd_error(D);
+  gd_discard(D);
+
+  unlink(format);
+  rmdir(filedir);
+
+  CHECKI(error,GD_E_FORMAT);
+  return r;
+}
diff --git a/test/parse_malias_meta.c b/test/parse_malias_meta.c
new file mode 100644
index 0000000..db5c642
--- /dev/null
+++ b/test/parse_malias_meta.c
@@ -0,0 +1,53 @@
+/* Copyright (C) 2011-2012 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+/* Parser check */
+#include "test.h"
+
+int main(void)
+{
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *format_data =
+    "data RAW UINT8 1\n"
+    "data/cata CONST UINT8 1\n"
+    "/ALIAS data/eata data\n";
+  int fd, e1, e2, r = 0;
+  DIRFILE *D;
+
+  rmdirfile();
+  mkdir(filedir, 0777);
+
+  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
+  write(fd, format_data, strlen(format_data));
+  close(fd);
+
+  D = gd_open(filedir, GD_RDONLY);
+  e1 = gd_error(D);
+  e2 = gd_validate(D, "data/eata/cata");
+  gd_discard(D);
+
+  unlink(format);
+  rmdir(filedir);
+
+  CHECKI(e1,0);
+  CHECKI(e2,-1);
+  return r;
+}
diff --git a/test/parse_meta.c b/test/parse_meta.c
index 90f80be..e759261 100644
--- a/test/parse_meta.c
+++ b/test/parse_meta.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Parser check */
 #include "test.h"
 
@@ -10,14 +30,15 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* format_data =
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *format_data =
     "parent RAW UINT8 1\n"
     "META parent child CONST UINT8 1\n";
   int fd, error, r = 0;
   DIRFILE *D;
 
+  rmdirfile();
   mkdir(filedir, 0777);
 
   fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
diff --git a/test/parse_meta_affix.c b/test/parse_meta_affix.c
new file mode 100644
index 0000000..ba47031
--- /dev/null
+++ b/test/parse_meta_affix.c
@@ -0,0 +1,56 @@
+/* Copyright (C) 2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+#include "test.h"
+
+int main(void)
+{
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *format1 = "dirfile/format1";
+  const char *format_data = "/INCLUDE format1 A Z\n";
+  const char *format1_data =
+    "parent RAW UINT8 1\n"
+    "META parent child CONST UINT8 1\n";
+  int fd, error, r = 0;
+  DIRFILE *D;
+
+  rmdirfile();
+  mkdir(filedir, 0777);
+
+  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
+  write(fd, format_data, strlen(format_data));
+  close(fd);
+
+  fd = open(format1, O_CREAT | O_EXCL | O_WRONLY, 0666);
+  write(fd, format1_data, strlen(format1_data));
+  close(fd);
+
+  D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
+  error = gd_error(D);
+  gd_close(D);
+
+  unlink(format1);
+  unlink(format);
+  rmdir(filedir);
+
+  CHECKI(error,GD_E_OK);
+  return r;
+}
diff --git a/test/parse_meta_alias.c b/test/parse_meta_alias.c
new file mode 100644
index 0000000..04eb6c3
--- /dev/null
+++ b/test/parse_meta_alias.c
@@ -0,0 +1,58 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+/* Parser check */
+#include "test.h"
+
+#include <stdlib.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <string.h>
+#include <errno.h>
+
+int main(void)
+{
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *format_data =
+    "parent RAW UINT8 1\n"
+    "/ALIAS alias parent\n"
+    "META alias child CONST UINT8 1\n";
+  int fd, error, r = 0;
+  DIRFILE *D;
+
+  rmdirfile();
+  mkdir(filedir, 0777);
+
+  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
+  write(fd, format_data, strlen(format_data));
+  close(fd);
+
+  D = gd_open(filedir, GD_RDONLY);
+  error = gd_error(D);
+  gd_close(D);
+
+  unlink(format);
+  rmdir(filedir);
+
+  CHECKI(error,GD_E_FORMAT);
+  return r;
+}
diff --git a/test/parse_meta_implicit.c b/test/parse_meta_implicit.c
index 588d4ee..c2b63b2 100644
--- a/test/parse_meta_implicit.c
+++ b/test/parse_meta_implicit.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2009-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Parser check */
 #include "test.h"
 
@@ -10,15 +30,16 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* format_data =
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *format_data =
     "parent RAW UINT8 1\n"
     "parent/child CONST UINT8 1\n";
   signed char c;
   int fd, error, error2, r = 0;
   DIRFILE *D;
 
+  rmdirfile();
   mkdir(filedir, 0777);
 
   fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
diff --git a/test/parse_meta_implicit2.c b/test/parse_meta_implicit2.c
index 2fc1948..862c1bf 100644
--- a/test/parse_meta_implicit2.c
+++ b/test/parse_meta_implicit2.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2009-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Parser check */
 #include "test.h"
 
@@ -10,14 +30,15 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* format_data =
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *format_data =
     "parent RAW UINT8 1\n"
     "parent/child/extra CONST UINT8 1\n";
   int fd, error, r = 0;
   DIRFILE *D;
 
+  rmdirfile();
   mkdir(filedir, 0777);
 
   fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
diff --git a/test/parse_meta_implicit_affix.c b/test/parse_meta_implicit_affix.c
new file mode 100644
index 0000000..cceb277
--- /dev/null
+++ b/test/parse_meta_implicit_affix.c
@@ -0,0 +1,56 @@
+/* Copyright (C) 2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+#include "test.h"
+
+int main(void)
+{
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *format1 = "dirfile/format1";
+  const char *format_data = "/INCLUDE format1 A Z\n";
+  const char *format1_data =
+    "parent RAW UINT8 1\n"
+    "parent/child CONST UINT8 1\n";
+  int fd, error, r = 0;
+  DIRFILE *D;
+
+  rmdirfile();
+  mkdir(filedir, 0777);
+
+  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
+  write(fd, format_data, strlen(format_data));
+  close(fd);
+
+  fd = open(format1, O_CREAT | O_EXCL | O_WRONLY, 0666);
+  write(fd, format1_data, strlen(format1_data));
+  close(fd);
+
+  D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
+  error = gd_error(D);
+  gd_close(D);
+
+  unlink(format1);
+  unlink(format);
+  rmdir(filedir);
+
+  CHECKI(error,GD_E_OK);
+  return r;
+}
diff --git a/test/parse_meta_index.c b/test/parse_meta_index.c
index 08808cd..9c6a8d6 100644
--- a/test/parse_meta_index.c
+++ b/test/parse_meta_index.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Parser check */
 #include "test.h"
 
@@ -10,13 +30,14 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* format_data =
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *format_data =
     "META INDEX child CONST UINT8 1\n";
   int fd, error, r = 0;
   DIRFILE *D;
 
+  rmdirfile();
   mkdir(filedir, 0777);
 
   fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
diff --git a/test/parse_meta_index2.c b/test/parse_meta_index2.c
index d9d4b5e..bc17fba 100644
--- a/test/parse_meta_index2.c
+++ b/test/parse_meta_index2.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2009-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Parser check */
 #include "test.h"
 
@@ -10,14 +30,15 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* format_data =
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *format_data =
     "parent RAW UINT8 1\n"
     "META parent INDEX CONST UINT8 1\n";
   int fd, error, r = 0;
   DIRFILE *D;
 
+  rmdirfile();
   mkdir(filedir, 0777);
 
   fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
diff --git a/test/parse_meta_jump.c b/test/parse_meta_jump.c
new file mode 100644
index 0000000..ef5f29c
--- /dev/null
+++ b/test/parse_meta_jump.c
@@ -0,0 +1,52 @@
+/* Copyright (C) 2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+/* Parser check */
+#include "test.h"
+
+int main(void)
+{
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *format_data =
+    "parent RAW UINT8 1\n"
+    "META parent child CONST UINT8 1\n"
+    "ALIAS alias parent/child\n"
+    "META alias grandchild CONST UINT8 1\n";
+  int fd, error, r = 0;
+  DIRFILE *D;
+
+  rmdirfile();
+  mkdir(filedir, 0777);
+
+  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
+  write(fd, format_data, strlen(format_data));
+  close(fd);
+
+  D = gd_open(filedir, GD_RDONLY);
+  error = gd_error(D);
+  gd_close(D);
+
+  unlink(format);
+  rmdir(filedir);
+
+  CHECKI(error,GD_E_FORMAT);
+  return r;
+}
diff --git a/test/parse_meta_malias.c b/test/parse_meta_malias.c
new file mode 100644
index 0000000..e560afb
--- /dev/null
+++ b/test/parse_meta_malias.c
@@ -0,0 +1,52 @@
+/* Copyright (C) 2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+/* Parser check */
+#include "test.h"
+
+int main(void)
+{
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *format_data =
+    "parent RAW UINT8 1\n"
+    "const CONST UINT8 1\n"
+    "ALIAS parent/alias const\n"
+    "META parent/alias grandchild CONST UINT8 1\n";
+  int fd, error, r = 0;
+  DIRFILE *D;
+
+  rmdirfile();
+  mkdir(filedir, 0777);
+
+  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
+  write(fd, format_data, strlen(format_data));
+  close(fd);
+
+  D = gd_open(filedir, GD_RDONLY);
+  error = gd_error(D);
+  gd_close(D);
+
+  unlink(format);
+  rmdir(filedir);
+
+  CHECKI(error,GD_E_FORMAT);
+  return r;
+}
diff --git a/test/parse_meta_meta.c b/test/parse_meta_meta.c
new file mode 100644
index 0000000..bd11235
--- /dev/null
+++ b/test/parse_meta_meta.c
@@ -0,0 +1,51 @@
+/* Copyright (C) 2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+/* Parser check */
+#include "test.h"
+
+int main(void)
+{
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *format_data =
+    "parent RAW UINT8 1\n"
+    "META parent child CONST UINT8 1\n"
+    "META parent/child grandchild CONST UINT8 1\n";
+  int fd, error, r = 0;
+  DIRFILE *D;
+
+  rmdirfile();
+  mkdir(filedir, 0777);
+
+  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
+  write(fd, format_data, strlen(format_data));
+  close(fd);
+
+  D = gd_open(filedir, GD_RDONLY);
+  error = gd_error(D);
+  gd_close(D);
+
+  unlink(format);
+  rmdir(filedir);
+
+  CHECKI(error,GD_E_FORMAT);
+  return r;
+}
diff --git a/test/parse_meta_parent.c b/test/parse_meta_parent.c
index 16961b8..f723a64 100644
--- a/test/parse_meta_parent.c
+++ b/test/parse_meta_parent.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Parser check */
 #include "test.h"
 
@@ -10,12 +30,13 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* format_data = "META parent child CONST UINT8 1\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *format_data = "META parent child CONST UINT8 1\n";
   int fd, error, r = 0;
   DIRFILE *D;
 
+  rmdirfile();
   mkdir(filedir, 0777);
 
   fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
diff --git a/test/parse_meta_raw.c b/test/parse_meta_raw.c
index 415d8f3..894759f 100644
--- a/test/parse_meta_raw.c
+++ b/test/parse_meta_raw.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Parser check */
 #include "test.h"
 
@@ -10,14 +30,15 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* format_data =
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *format_data =
     "parent RAW UINT8 1\n"
     "META parent child RAW UINT8 1\n";
   int fd, error, r = 0;
   DIRFILE *D;
 
+  rmdirfile();
   mkdir(filedir, 0777);
 
   fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
diff --git a/test/parse_mplex.c b/test/parse_mplex.c
new file mode 100644
index 0000000..2d65c50
--- /dev/null
+++ b/test/parse_mplex.c
@@ -0,0 +1,47 @@
+/* Copyright (C) 2012 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+#include "test.h"
+
+int main(void)
+{
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *format_data = "data MPLEX in1 in2 1 2\n";
+  int fd, error, r = 0;
+  DIRFILE *D;
+
+  rmdirfile();
+  mkdir(filedir, 0777);
+
+  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
+  write(fd, format_data, strlen(format_data));
+  close(fd);
+
+  D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
+  error = gd_error(D);
+  gd_close(D);
+
+  unlink(format);
+  rmdir(filedir);
+
+  CHECKI(error,GD_E_OK);
+  return r;
+}
diff --git a/test/parse_mplex_ncols.c b/test/parse_mplex_ncols.c
new file mode 100644
index 0000000..a07889e
--- /dev/null
+++ b/test/parse_mplex_ncols.c
@@ -0,0 +1,47 @@
+/* Copyright (C) 2012 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+#include "test.h"
+
+int main(void)
+{
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *format_data = "data MPLEX in1 in2\n";
+  int fd, error, r = 0;
+  DIRFILE *D;
+
+  rmdirfile();
+  mkdir(filedir, 0777);
+
+  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
+  write(fd, format_data, strlen(format_data));
+  close(fd);
+
+  D = gd_open(filedir, GD_RDONLY);
+  error = gd_error(D);
+  gd_close(D);
+
+  unlink(format);
+  rmdir(filedir);
+
+  CHECKI(error,GD_E_FORMAT);
+  return r;
+}
diff --git a/test/parse_mplex_nomax.c b/test/parse_mplex_nomax.c
new file mode 100644
index 0000000..1f6b26a
--- /dev/null
+++ b/test/parse_mplex_nomax.c
@@ -0,0 +1,53 @@
+/* Copyright (C) 2012 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+#include "test.h"
+
+int main(void)
+{
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *format_data = "data MPLEX in1 in2 6\n";
+  int fd, e1, e2, r = 0;
+  gd_entry_t E;
+  DIRFILE *D;
+
+  rmdirfile();
+  mkdir(filedir, 0777);
+
+  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
+  write(fd, format_data, strlen(format_data));
+  close(fd);
+
+  D = gd_open(filedir, GD_RDONLY);
+  e1 = gd_error(D);
+  e2 = gd_entry(D, "data", &E);
+  gd_close(D);
+  gd_free_entry_strings(&E);
+
+  unlink(format);
+  rmdir(filedir);
+
+  CHECKI(e1,0);
+  CHECKI(e2,0);
+  CHECKI(E.EN(mplex,period),0);
+  CHECKI(E.EN(mplex,count_val),6);
+  return r;
+}
diff --git a/test/parse_mplex_scalar.c b/test/parse_mplex_scalar.c
new file mode 100644
index 0000000..a3aa0be
--- /dev/null
+++ b/test/parse_mplex_scalar.c
@@ -0,0 +1,47 @@
+/* Copyright (C) 2012 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+#include "test.h"
+
+int main(void)
+{
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *format_data = "data MPLEX in1 in2 a b\n";
+  int fd, error, r = 0;
+  DIRFILE *D;
+
+  rmdirfile();
+  mkdir(filedir, 0777);
+
+  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
+  write(fd, format_data, strlen(format_data));
+  close(fd);
+
+  D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
+  error = gd_error(D);
+  gd_close(D);
+
+  unlink(format);
+  rmdir(filedir);
+
+  CHECKI(error,GD_E_OK);
+  return r;
+}
diff --git a/test/parse_multiply.c b/test/parse_multiply.c
index 0a3f2be..161a7dd 100644
--- a/test/parse_multiply.c
+++ b/test/parse_multiply.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Parser check */
 #include "test.h"
 
@@ -10,12 +30,13 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* format_data = "data MULTIPLY in1 in2\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *format_data = "data MULTIPLY in1 in2\n";
   int fd, error, r = 0;
   DIRFILE *D;
 
+  rmdirfile();
   mkdir(filedir, 0777);
 
   fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
diff --git a/test/parse_multiply_ncols.c b/test/parse_multiply_ncols.c
index 14568ae..36eca45 100644
--- a/test/parse_multiply_ncols.c
+++ b/test/parse_multiply_ncols.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Parser check */
 #include "test.h"
 
@@ -10,12 +30,13 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* format_data = "data MULTIPLY in1\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *format_data = "data MULTIPLY in1\n";
   int fd, error, r = 0;
   DIRFILE *D;
 
+  rmdirfile();
   mkdir(filedir, 0777);
 
   fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
diff --git a/test/parse_name.c b/test/parse_name.c
index b71aad2..31d3f36 100644
--- a/test/parse_name.c
+++ b/test/parse_name.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Parser check */
 #include "test.h"
 
@@ -10,12 +30,13 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* format_data = "d/ta RAW UINT8 1\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *format_data = "d/ta RAW UINT8 1\n";
   int fd, error, r = 0;
   DIRFILE *D;
 
+  rmdirfile();
   mkdir(filedir, 0777);
 
   fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
diff --git a/test/parse_name_dot.c b/test/parse_name_dot.c
index 360ee03..e3d2704 100644
--- a/test/parse_name_dot.c
+++ b/test/parse_name_dot.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Parser check */
 #include "test.h"
 
@@ -10,12 +30,13 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* format_data = "d.ta RAW UINT8 1\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *format_data = "d.ta RAW UINT8 1\n";
   int fd, error, r = 0;
   DIRFILE *D;
 
+  rmdirfile();
   mkdir(filedir, 0777);
 
   fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
diff --git a/test/parse_name_ext.c b/test/parse_name_ext.c
index 25885ac..62b2eab 100644
--- a/test/parse_name_ext.c
+++ b/test/parse_name_ext.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Parser check */
 #include "test.h"
 
@@ -11,12 +31,13 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* format_data = "data.txt RAW UINT8 1\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *format_data = "data.txt RAW UINT8 1\n";
   int fd, error, r = 0;
   DIRFILE *D;
 
+  rmdirfile();
   mkdir(filedir, 0777);
 
   fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
diff --git a/test/parse_name_pedantic.c b/test/parse_name_pedantic.c
index 3638f8a..ec2abf1 100644
--- a/test/parse_name_pedantic.c
+++ b/test/parse_name_pedantic.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Parser check */
 #include "test.h"
 
@@ -10,12 +30,13 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* format_data = "d.ta RAW UINT8 1\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *format_data = "d.ta RAW UINT8 1\n";
   int fd, error, r = 0;
   DIRFILE *D;
 
+  rmdirfile();
   mkdir(filedir, 0777);
 
   fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
diff --git a/test/parse_ncols.c b/test/parse_ncols.c
index c2af494..878ed41 100644
--- a/test/parse_ncols.c
+++ b/test/parse_ncols.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Parser check */
 #include "test.h"
 
@@ -10,12 +30,13 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* format_data = "ENDIAN\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *format_data = "ENDIAN\n";
   int fd, error, r = 0;
   DIRFILE *D;
 
+  rmdirfile();
   mkdir(filedir, 0777);
 
   fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
diff --git a/test/parse_phase.c b/test/parse_phase.c
index 7574ec7..646de17 100644
--- a/test/parse_phase.c
+++ b/test/parse_phase.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Parser check */
 #include "test.h"
 
@@ -10,12 +30,13 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* format_data = "data PHASE in1 1\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *format_data = "data PHASE in1 1\n";
   int fd, error, r = 0;
   DIRFILE *D;
 
+  rmdirfile();
   mkdir(filedir, 0777);
 
   fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
diff --git a/test/parse_phase_ncols.c b/test/parse_phase_ncols.c
index a8ae96f..0007bd9 100644
--- a/test/parse_phase_ncols.c
+++ b/test/parse_phase_ncols.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Parser check */
 #include "test.h"
 
@@ -10,12 +30,13 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* format_data = "data PHASE in1\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *format_data = "data PHASE in1\n";
   int fd, error, r = 0;
   DIRFILE *D;
 
+  rmdirfile();
   mkdir(filedir, 0777);
 
   fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
diff --git a/test/parse_phase_scalar.c b/test/parse_phase_scalar.c
index 60d81dc..fda3b0a 100644
--- a/test/parse_phase_scalar.c
+++ b/test/parse_phase_scalar.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Parser check */
 #include "test.h"
 
@@ -10,12 +30,13 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* format_data = "const CONST INT32 1\ndata PHASE in1 const\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *format_data = "const CONST INT32 1\ndata PHASE in1 const\n";
   int fd, error, r = 0;
   DIRFILE *D;
 
+  rmdirfile();
   mkdir(filedir, 0777);
 
   fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
diff --git a/test/parse_polynom.c b/test/parse_polynom.c
index a437f81..81863f6 100644
--- a/test/parse_polynom.c
+++ b/test/parse_polynom.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2009-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Parser check */
 #include "test.h"
 
@@ -10,12 +30,13 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* format_data = "polynom POLYNOM in 1 2 3 4\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *format_data = "polynom POLYNOM in 1 2 3 4\n";
   int fd, error, r = 0;
   DIRFILE *D;
 
+  rmdirfile();
   mkdir(filedir, 0777);
 
   fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
diff --git a/test/parse_polynom_ncols1.c b/test/parse_polynom_ncols1.c
index b1c8590..edea942 100644
--- a/test/parse_polynom_ncols1.c
+++ b/test/parse_polynom_ncols1.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2009-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Parser check */
 #include "test.h"
 
@@ -10,12 +30,13 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* format_data = "polynom POLYNOM in 1\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *format_data = "polynom POLYNOM in 1\n";
   int fd, error, r = 0;
   DIRFILE *D;
 
+  rmdirfile();
   mkdir(filedir, 0777);
 
   fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
diff --git a/test/parse_polynom_ncols2.c b/test/parse_polynom_ncols2.c
index 117e21d..2d6d214 100644
--- a/test/parse_polynom_ncols2.c
+++ b/test/parse_polynom_ncols2.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2009-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Parser check */
 #include "test.h"
 
@@ -10,12 +30,13 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* format_data = "polynom POLYNOM in 1 2 3 4 5 6 7 8 9\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *format_data = "polynom POLYNOM in 1 2 3 4 5 6 7 8 9\n";
   int fd, error, r = 0;
   DIRFILE *D;
 
+  rmdirfile();
   mkdir(filedir, 0777);
 
   fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
diff --git a/test/parse_polynom_scalar.c b/test/parse_polynom_scalar.c
index 67f82d3..6f93483 100644
--- a/test/parse_polynom_scalar.c
+++ b/test/parse_polynom_scalar.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2009-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Parser check */
 #include "test.h"
 
@@ -10,14 +30,15 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* format_data =
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *format_data =
     "const  CONST FLOAT64 3.2\n"
     "polynom POLYNOM in const 0\n";
   int fd, error, r = 0;
   DIRFILE *D;
 
+  rmdirfile();
   mkdir(filedir, 0777);
 
   fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
diff --git a/test/parse_protect_all.c b/test/parse_protect_all.c
index 55e34a3..70d0b18 100644
--- a/test/parse_protect_all.c
+++ b/test/parse_protect_all.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Parser check */
 #include "test.h"
 
@@ -10,12 +30,13 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* format_data = "PROTECT all\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *format_data = "PROTECT all\n";
   int fd, error, r = 0;
   DIRFILE *D;
 
+  rmdirfile();
   mkdir(filedir, 0777);
 
   fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
diff --git a/test/parse_protect_bad.c b/test/parse_protect_bad.c
index 44278d9..52d501d 100644
--- a/test/parse_protect_bad.c
+++ b/test/parse_protect_bad.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Parser check */
 #include "test.h"
 
@@ -10,12 +30,13 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* format_data = "PROTECT badprotection\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *format_data = "PROTECT badprotection\n";
   int fd, error, r = 0;
   DIRFILE *D;
 
+  rmdirfile();
   mkdir(filedir, 0777);
 
   fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
diff --git a/test/parse_protect_data.c b/test/parse_protect_data.c
index 77201a5..cb4d98d 100644
--- a/test/parse_protect_data.c
+++ b/test/parse_protect_data.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Parser check */
 #include "test.h"
 
@@ -10,12 +30,13 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* format_data = "PROTECT data\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *format_data = "PROTECT data\n";
   int fd, error, r = 0;
   DIRFILE *D;
 
+  rmdirfile();
   mkdir(filedir, 0777);
 
   fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
diff --git a/test/parse_protect_format.c b/test/parse_protect_format.c
index 029db5e..ea76b9e 100644
--- a/test/parse_protect_format.c
+++ b/test/parse_protect_format.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Parser check */
 #include "test.h"
 
@@ -10,12 +30,13 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* format_data = "PROTECT format\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *format_data = "PROTECT format\n";
   int fd, error, r = 0;
   DIRFILE *D;
 
+  rmdirfile();
   mkdir(filedir, 0777);
 
   fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
diff --git a/test/parse_protect_none.c b/test/parse_protect_none.c
index 0c648d0..ec2b84d 100644
--- a/test/parse_protect_none.c
+++ b/test/parse_protect_none.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Parser check */
 #include "test.h"
 
@@ -10,12 +30,13 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* format_data = "PROTECT none\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *format_data = "PROTECT none\n";
   int fd, error, r = 0;
   DIRFILE *D;
 
+  rmdirfile();
   mkdir(filedir, 0777);
 
   fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
diff --git a/test/parse_quote.c b/test/parse_quote.c
index c7bd022..57f19e5 100644
--- a/test/parse_quote.c
+++ b/test/parse_quote.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Parser check */
 #include "test.h"
 
@@ -10,12 +30,13 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* format_data = "\"da ta\" RAW UINT8 1\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *format_data = "\"da ta\" RAW UINT8 1\n";
   int fd, error, r = 0;
   DIRFILE *D;
 
+  rmdirfile();
   mkdir(filedir, 0777);
 
   fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
diff --git a/test/parse_quote_mismatch.c b/test/parse_quote_mismatch.c
index dfe7bed..64a1261 100644
--- a/test/parse_quote_mismatch.c
+++ b/test/parse_quote_mismatch.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Parser check */
 #include "test.h"
 
@@ -10,12 +30,13 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* format_data = "data RAW UINT8 \"1\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *format_data = "data RAW UINT8 \"1\n";
   int fd, error, r = 0;
   DIRFILE *D;
 
+  rmdirfile();
   mkdir(filedir, 0777);
 
   fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
diff --git a/test/parse_raw.c b/test/parse_raw.c
index 1e3b4dd..1f4ceac 100644
--- a/test/parse_raw.c
+++ b/test/parse_raw.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Parser check */
 #include "test.h"
 
@@ -10,12 +30,13 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* format_data = "data RAW UINT8 1\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *format_data = "data RAW UINT8 1\n";
   int fd, error, r = 0;
   DIRFILE *D;
 
+  rmdirfile();
   mkdir(filedir, 0777);
 
   fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
diff --git a/test/parse_raw_char.c b/test/parse_raw_char.c
index c8c94be..e323a39 100644
--- a/test/parse_raw_char.c
+++ b/test/parse_raw_char.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Parser check */
 #include "test.h"
 
@@ -10,12 +30,13 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* format_data = "data RAW c 1\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *format_data = "data RAW c 1\n";
   int fd, error, r = 0;
   DIRFILE *D;
 
+  rmdirfile();
   mkdir(filedir, 0777);
 
   fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
diff --git a/test/parse_raw_ncols.c b/test/parse_raw_ncols.c
index a3f61ce..ef97312 100644
--- a/test/parse_raw_ncols.c
+++ b/test/parse_raw_ncols.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Parser check */
 #include "test.h"
 
@@ -10,12 +30,13 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* format_data = "data RAW UINT8\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *format_data = "data RAW UINT8\n";
   int fd, error, r = 0;
   DIRFILE *D;
 
+  rmdirfile();
   mkdir(filedir, 0777);
 
   fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
diff --git a/test/parse_raw_scalar.c b/test/parse_raw_scalar.c
index 3b1d5e3..39a1dc5 100644
--- a/test/parse_raw_scalar.c
+++ b/test/parse_raw_scalar.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Parser check */
 #include "test.h"
 
@@ -10,12 +30,13 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* format_data = "const CONST INT8 1\ndata RAW UINT8 const\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *format_data = "const CONST INT8 1\ndata RAW UINT8 const\n";
   int fd, error, r = 0;
   DIRFILE *D;
 
+  rmdirfile();
   mkdir(filedir, 0777);
 
   fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
diff --git a/test/parse_raw_spf.c b/test/parse_raw_spf.c
index 97e0e0c..b4793f4 100644
--- a/test/parse_raw_spf.c
+++ b/test/parse_raw_spf.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Parser check */
 #include "test.h"
 
@@ -10,12 +30,13 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* format_data = "data RAW UINT8 0\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *format_data = "data RAW UINT8 0\n";
   int fd, error, r = 0;
   DIRFILE *D;
 
+  rmdirfile();
   mkdir(filedir, 0777);
 
   fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
diff --git a/test/parse_raw_type.c b/test/parse_raw_type.c
index ac1547d..4d2ca56 100644
--- a/test/parse_raw_type.c
+++ b/test/parse_raw_type.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Parser check */
 #include "test.h"
 
@@ -10,12 +30,13 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* format_data = "data RAW BADTYPE 11\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *format_data = "data RAW BADTYPE 11\n";
   int fd, error, r = 0;
   DIRFILE *D;
 
+  rmdirfile();
   mkdir(filedir, 0777);
 
   fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
diff --git a/test/parse_recip.c b/test/parse_recip.c
index 054109d..984c22d 100644
--- a/test/parse_recip.c
+++ b/test/parse_recip.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2010-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Parser check */
 #include "test.h"
 
@@ -10,12 +30,13 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* format_data = "data RECIP in2 1\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *format_data = "data RECIP in2 1\n";
   int fd, error, r = 0;
   DIRFILE *D;
 
+  rmdirfile();
   mkdir(filedir, 0777);
 
   fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
diff --git a/test/parse_ref.c b/test/parse_ref.c
index 263ba93..c7956e4 100644
--- a/test/parse_ref.c
+++ b/test/parse_ref.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Parser check */
 #include "test.h"
 
@@ -10,12 +30,13 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* format_data = "REFERENCE data\ndata RAW UINT8 1";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *format_data = "REFERENCE data\ndata RAW UINT8 1";
   int fd, error, r = 0;
   DIRFILE *D;
 
+  rmdirfile();
   mkdir(filedir, 0777);
 
   fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
diff --git a/test/parse_ref_nonexistent.c b/test/parse_ref_nonexistent.c
index c88f0d6..90af2fa 100644
--- a/test/parse_ref_nonexistent.c
+++ b/test/parse_ref_nonexistent.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Parser check */
 #include "test.h"
 
@@ -10,12 +30,13 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* format_data = "REFERENCE data\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *format_data = "REFERENCE data\n";
   int fd, error, r = 0;
   DIRFILE *D;
 
+  rmdirfile();
   mkdir(filedir, 0777);
 
   fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
diff --git a/test/parse_sbit.c b/test/parse_sbit.c
index bccbd5e..370c10d 100644
--- a/test/parse_sbit.c
+++ b/test/parse_sbit.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2009-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Parser check */
 #include "test.h"
 
@@ -10,12 +30,13 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* format_data = "data SBIT in1 3\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *format_data = "data SBIT in1 3\n";
   int fd, error, r = 0;
   DIRFILE *D;
 
+  rmdirfile();
   mkdir(filedir, 0777);
 
   fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
diff --git a/test/parse_sort.c b/test/parse_sort.c
index 55150eb..6b367f1 100644
--- a/test/parse_sort.c
+++ b/test/parse_sort.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Field sort check */
 #include "test.h"
 
@@ -11,9 +31,9 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* format_data =
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *format_data =
     "c RAW UINT8 1\n"
     "d RAW UINT8 1\n"
     "g RAW UINT8 1\n"
@@ -29,6 +49,7 @@ int main(void)
   const char **field_list;
   DIRFILE *D;
 
+  rmdirfile();
   mkdir(filedir, 0777);
 
   fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
diff --git a/test/parse_string.c b/test/parse_string.c
index 2c6862b..179b33f 100644
--- a/test/parse_string.c
+++ b/test/parse_string.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Parser check */
 #include "test.h"
 
@@ -10,12 +30,13 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* format_data = "string STRING value\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *format_data = "string STRING value\n";
   int fd, error, r = 0;
   DIRFILE *D;
 
+  rmdirfile();
   mkdir(filedir, 0777);
 
   fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
diff --git a/test/parse_string_ncols.c b/test/parse_string_ncols.c
index e9f0146..57f5012 100644
--- a/test/parse_string_ncols.c
+++ b/test/parse_string_ncols.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Parser check */
 #include "test.h"
 
@@ -10,12 +30,13 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* format_data = "string STRING\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *format_data = "string STRING\n";
   int fd, error, r = 0;
   DIRFILE *D;
 
+  rmdirfile();
   mkdir(filedir, 0777);
 
   fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
diff --git a/test/parse_string_null.c b/test/parse_string_null.c
index 101a110..3dc31fe 100644
--- a/test/parse_string_null.c
+++ b/test/parse_string_null.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Parser check */
 #include "test.h"
 
@@ -10,12 +30,13 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* format_data = "string STRING \"\"\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *format_data = "string STRING \"\"\n";
   int fd, error, r = 0;
   DIRFILE *D;
 
+  rmdirfile();
   mkdir(filedir, 0777);
 
   fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
diff --git a/test/parse_version.c b/test/parse_version.c
index 6ee8b6e..3d5648d 100644
--- a/test/parse_version.c
+++ b/test/parse_version.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Parser check */
 #include "test.h"
 
@@ -11,12 +31,13 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* format_data = "VERSION 999999\nBADDIRECTIVE BADTYPE\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *format_data = "VERSION 999999\nBADDIRECTIVE BADTYPE\n";
   int fd, error, r = 0;
   DIRFILE *D;
 
+  rmdirfile();
   mkdir(filedir, 0777);
 
   fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
diff --git a/test/parse_version_89.c b/test/parse_version_89.c
new file mode 100644
index 0000000..a6859d3
--- /dev/null
+++ b/test/parse_version_89.c
@@ -0,0 +1,62 @@
+/* Copyright (C) 2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+/* Test version leakage */
+#include "test.h"
+
+int main(void)
+{
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *format1 = "dirfile/format1";
+  const char *data = "dirfile/ar";
+  const char *format_data =
+    "/VERSION 8\n"
+    "/INCLUDE format1\n"
+    "r WINDOW a b EQ 1.\n";
+  const char *format1_data = "/VERSION 9\n";
+  int fd, error, r = 0;
+  DIRFILE *D;
+
+  rmdirfile();
+  mkdir(filedir, 0777);
+
+  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
+  write(fd, format_data, strlen(format_data));
+  close(fd);
+
+  fd = open(format1, O_CREAT | O_EXCL | O_WRONLY, 0666);
+  write(fd, format1_data, strlen(format1_data));
+  close(fd);
+
+  D = gd_open(filedir, GD_RDONLY);
+  error = gd_error(D);
+
+  gd_close(D);
+
+  unlink(data);
+  unlink(format1);
+  unlink(format);
+  rmdir(filedir);
+
+  CHECKI(error,GD_E_FORMAT);
+
+  return r;
+}
diff --git a/test/parse_version_98.c b/test/parse_version_98.c
new file mode 100644
index 0000000..f318f26
--- /dev/null
+++ b/test/parse_version_98.c
@@ -0,0 +1,62 @@
+/* Copyright (C) 2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+/* Test version leakage */
+#include "test.h"
+
+int main(void)
+{
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *format1 = "dirfile/format1";
+  const char *data = "dirfile/ar";
+  const char *format_data =
+    "/VERSION 9\n"
+    "/INCLUDE format1\n"
+    "r WINDOW a b EQ 1.\n";
+  const char *format1_data = "/VERSION 8\n";
+  int fd, error, r = 0;
+  DIRFILE *D;
+
+  rmdirfile();
+  mkdir(filedir, 0777);
+
+  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
+  write(fd, format_data, strlen(format_data));
+  close(fd);
+
+  fd = open(format1, O_CREAT | O_EXCL | O_WRONLY, 0666);
+  write(fd, format1_data, strlen(format1_data));
+  close(fd);
+
+  D = gd_open(filedir, GD_RDONLY);
+  error = gd_error(D);
+
+  gd_close(D);
+
+  unlink(data);
+  unlink(format1);
+  unlink(format);
+  rmdir(filedir);
+
+  CHECKI(error,GD_E_OK);
+
+  return r;
+}
diff --git a/test/parse_version_include.c b/test/parse_version_include.c
index be77717..d6019a1 100644
--- a/test/parse_version_include.c
+++ b/test/parse_version_include.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* VERSION should cross INCLUDEs */
 #include "test.h"
 
@@ -10,14 +30,15 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* format1 = __TEST__ "dirfile/format1";
-  const char* format_data = "VERSION 999999\nINCLUDE format1\n";
-  const char* format1_data = "BADDIRECTIVE BADTYPE\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *format1 = "dirfile/format1";
+  const char *format_data = "VERSION 999999\nINCLUDE format1\n";
+  const char *format1_data = "BADDIRECTIVE BADTYPE\n";
   int fd, error, r = 0;
   DIRFILE *D;
 
+  rmdirfile();
   mkdir(filedir, 0777);
 
   fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
diff --git a/test/parse_version_p8.c b/test/parse_version_p8.c
new file mode 100644
index 0000000..f1aea59
--- /dev/null
+++ b/test/parse_version_p8.c
@@ -0,0 +1,61 @@
+/* Copyright (C) 2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+/* Test version leakage */
+#include "test.h"
+
+int main(void)
+{
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *format1 = "dirfile/format1";
+  const char *data = "dirfile/ar";
+  const char *format_data =
+    "/INCLUDE format1\n"
+    "r.d RECIP a b EQ 1.\n";
+  const char *format1_data = "/VERSION 8\n";
+  int fd, error, r = 0;
+  DIRFILE *D;
+
+  rmdirfile();
+  mkdir(filedir, 0777);
+
+  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
+  write(fd, format_data, strlen(format_data));
+  close(fd);
+
+  fd = open(format1, O_CREAT | O_EXCL | O_WRONLY, 0666);
+  write(fd, format1_data, strlen(format1_data));
+  close(fd);
+
+  D = gd_open(filedir, GD_RDONLY);
+  error = gd_error(D);
+
+  gd_close(D);
+
+  unlink(data);
+  unlink(format1);
+  unlink(format);
+  rmdir(filedir);
+
+  CHECKI(error,GD_E_FORMAT);
+
+  return r;
+}
diff --git a/test/parse_version_p9.c b/test/parse_version_p9.c
new file mode 100644
index 0000000..0039221
--- /dev/null
+++ b/test/parse_version_p9.c
@@ -0,0 +1,61 @@
+/* Copyright (C) 2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+/* Test version leakage */
+#include "test.h"
+
+int main(void)
+{
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *format1 = "dirfile/format1";
+  const char *data = "dirfile/ar";
+  const char *format_data =
+    "/INCLUDE format1\n"
+    "r.d WINDOW a b EQ 1.\n";
+  const char *format1_data = "/VERSION 9\n";
+  int fd, error, r = 0;
+  DIRFILE *D;
+
+  rmdirfile();
+  mkdir(filedir, 0777);
+
+  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
+  write(fd, format_data, strlen(format_data));
+  close(fd);
+
+  fd = open(format1, O_CREAT | O_EXCL | O_WRONLY, 0666);
+  write(fd, format1_data, strlen(format1_data));
+  close(fd);
+
+  D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
+  error = gd_error(D);
+
+  gd_close(D);
+
+  unlink(data);
+  unlink(format1);
+  unlink(format);
+  rmdir(filedir);
+
+  CHECKI(error,GD_E_OK);
+
+  return r;
+}
diff --git a/test/parse_version_permissive.c b/test/parse_version_permissive.c
index 0976b33..5a6a86e 100644
--- a/test/parse_version_permissive.c
+++ b/test/parse_version_permissive.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2010-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Parser check */
 #include "test.h"
 
@@ -11,12 +31,13 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* format_data = "VERSION 999999\nBADDIRECTIVE BADTYPE\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *format_data = "VERSION 999999\nBADDIRECTIVE BADTYPE\n";
   int fd, error, r = 0;
   DIRFILE *D;
 
+  rmdirfile();
   mkdir(filedir, 0777);
 
   fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
diff --git a/test/parse_version_slash.c b/test/parse_version_slash.c
index b7bb0d6..36c88ce 100644
--- a/test/parse_version_slash.c
+++ b/test/parse_version_slash.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Parser check */
 #include "test.h"
 
@@ -11,12 +31,13 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* format_data = "/VERSION 999999\nBADDIRECTIVE BADTYPE\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *format_data = "/VERSION 999999\nBADDIRECTIVE BADTYPE\n";
   int fd, error, r = 0;
   DIRFILE *D;
 
+  rmdirfile();
   mkdir(filedir, 0777);
 
   fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
diff --git a/test/parse_whitespace.c b/test/parse_whitespace.c
index 5be589d..580d0f5 100644
--- a/test/parse_whitespace.c
+++ b/test/parse_whitespace.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Parser check */
 #include "test.h"
 
@@ -10,12 +30,13 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* format_data = "da\\ ta RAW UINT8 1\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *format_data = "da\\ ta RAW UINT8 1\n";
   int fd, error, r = 0;
   DIRFILE *D;
 
+  rmdirfile();
   mkdir(filedir, 0777);
 
   fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
diff --git a/test/parse_window.c b/test/parse_window.c
new file mode 100644
index 0000000..0fe7ecf
--- /dev/null
+++ b/test/parse_window.c
@@ -0,0 +1,55 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+/* Parser check */
+#include "test.h"
+
+#include <stdlib.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <string.h>
+#include <errno.h>
+
+int main(void)
+{
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *format_data = "data WINDOW in1 in2 EQ 1\n";
+  int fd, error, r = 0;
+  DIRFILE *D;
+
+  rmdirfile();
+  mkdir(filedir, 0777);
+
+  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
+  write(fd, format_data, strlen(format_data));
+  close(fd);
+
+  D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
+  error = gd_error(D);
+  gd_close(D);
+
+  unlink(format);
+  rmdir(filedir);
+
+  CHECKI(error,GD_E_OK);
+  return r;
+}
diff --git a/test/parse_window_ncols.c b/test/parse_window_ncols.c
new file mode 100644
index 0000000..e805008
--- /dev/null
+++ b/test/parse_window_ncols.c
@@ -0,0 +1,55 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+/* Parser check */
+#include "test.h"
+
+#include <stdlib.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <string.h>
+#include <errno.h>
+
+int main(void)
+{
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *format_data = "data WINDOW in1 XOR 0x10\n";
+  int fd, error, r = 0;
+  DIRFILE *D;
+
+  rmdirfile();
+  mkdir(filedir, 0777);
+
+  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
+  write(fd, format_data, strlen(format_data));
+  close(fd);
+
+  D = gd_open(filedir, GD_RDONLY);
+  error = gd_error(D);
+  gd_close(D);
+
+  unlink(format);
+  rmdir(filedir);
+
+  CHECKI(error,GD_E_FORMAT);
+  return r;
+}
diff --git a/test/parse_window_op.c b/test/parse_window_op.c
new file mode 100644
index 0000000..04b4ff7
--- /dev/null
+++ b/test/parse_window_op.c
@@ -0,0 +1,55 @@
+/* Copyright (C) 2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+/* Parser check */
+#include "test.h"
+
+#include <stdlib.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <string.h>
+#include <errno.h>
+
+int main(void)
+{
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *format_data = "data WINDOW in1 in2 = 1\n";
+  int fd, error, r = 0;
+  DIRFILE *D;
+
+  rmdirfile();
+  mkdir(filedir, 0777);
+
+  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
+  write(fd, format_data, strlen(format_data));
+  close(fd);
+
+  D = gd_open(filedir, GD_RDONLY);
+  error = gd_error(D);
+  gd_close(D);
+
+  unlink(format);
+  rmdir(filedir);
+
+  CHECKI(error,GD_E_FORMAT);
+  return r;
+}
diff --git a/test/parse_window_scalar.c b/test/parse_window_scalar.c
new file mode 100644
index 0000000..aa2cbc1
--- /dev/null
+++ b/test/parse_window_scalar.c
@@ -0,0 +1,55 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+/* Parser check */
+#include "test.h"
+
+#include <stdlib.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <string.h>
+#include <errno.h>
+
+int main(void)
+{
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *format_data = "const CONST INT32 1\ndata WINDOW a b LT const\n";
+  int fd, error, r = 0;
+  DIRFILE *D;
+
+  rmdirfile();
+  mkdir(filedir, 0777);
+
+  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
+  write(fd, format_data, strlen(format_data));
+  close(fd);
+
+  D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
+  error = gd_error(D);
+  gd_close(D);
+
+  unlink(format);
+  rmdir(filedir);
+
+  CHECKI(error,GD_E_OK);
+  return r;
+}
diff --git a/test/protect_alter.c b/test/protect_alter.c
index 03e0a7b..260044f 100644
--- a/test/protect_alter.c
+++ b/test/protect_alter.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Test frameoffset */
 #include "test.h"
 
@@ -11,14 +31,15 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* data = __TEST__ "dirfile/data";
-  const char* format_data = "data RAW UINT8 8\nPROTECT format\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *data = "dirfile/data";
+  const char *format_data = "data RAW UINT8 8\nPROTECT format\n";
   unsigned char data_data[256];
   int fd, ret, p, error, r = 0;
   DIRFILE *D;
 
+  rmdirfile();
   mkdir(filedir, 0777);
 
   for (fd = 0; fd < 256; ++fd)
diff --git a/test/protect_get.c b/test/protect_get.c
index ca47057..fb66993 100644
--- a/test/protect_get.c
+++ b/test/protect_get.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Test protection */
 #include "test.h"
 
@@ -10,14 +30,15 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* data = __TEST__ "dirfile/data";
-  const char* format_data = "data RAW UINT8 8\nPROTECT format\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *data = "dirfile/data";
+  const char *format_data = "data RAW UINT8 8\nPROTECT format\n";
   unsigned char data_data[256];
   int fd, p, error, r = 0;
   DIRFILE *D;
 
+  rmdirfile();
   mkdir(filedir, 0777);
 
   for (fd = 0; fd < 256; ++fd)
diff --git a/test/put64.c b/test/put64.c
index d05afbe..cb30f93 100644
--- a/test/put64.c
+++ b/test/put64.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Attempt to write UINT8 */
 #define _LARGEFILE64_SOURCE 1
 
@@ -13,16 +33,17 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* data = __TEST__ "dirfile/data";
-  const char* format_data = "data RAW UINT8 8\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *data = "dirfile/data";
+  const char *format_data = "data RAW UINT8 8\n";
   uint8_t c[8], d;
   int fd, n, error, i;
   struct stat buf;
   DIRFILE *D;
 
   memset(c, 0, 8);
+  rmdirfile();
   mkdir(filedir, 0777);
 
   for (i = 0; i < 8; ++i)
diff --git a/test/put_bad_code.c b/test/put_bad_code.c
index ebdf1fd..aaaa267 100644
--- a/test/put_bad_code.c
+++ b/test/put_bad_code.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Attempt to write a non-existant field */
 #include "test.h"
 
@@ -10,13 +30,14 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* format_data = "#\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *format_data = "#\n";
   unsigned char c = 0;
   int fd, n, error, r = 0;
   DIRFILE *D;
 
+  rmdirfile();
   mkdir(filedir, 0777);
 
   fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
diff --git a/test/put_bit.c b/test/put_bit.c
index f5741d1..50c8e6d 100644
--- a/test/put_bit.c
+++ b/test/put_bit.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Attempt to write BIT */
 #include "test.h"
 
@@ -12,15 +32,16 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* data = __TEST__ "dirfile/data";
-  const char* format_data = "bit BIT data 2 3\ndata RAW UINT8 8\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *data = "dirfile/data";
+  const char *format_data = "bit BIT data 2 3\ndata RAW UINT8 8\n";
   uint8_t c[8];
   uint8_t d = 0xA5;
   int fd, i, n, error, r = 0;
   DIRFILE *D;
 
+  rmdirfile();
   mkdir(filedir, 0777);
 
   for (i = 0; i < 8; ++i)
diff --git a/test/put_bof.c b/test/put_bof.c
index 1f3a7b5..229a61f 100644
--- a/test/put_bof.c
+++ b/test/put_bof.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Attempt to write UINT8 past the beginning-of-field*/
 #include "test.h"
 
@@ -11,13 +31,14 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* format_data = "data RAW UINT8 8\nFRAMEOFFSET 10000";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *format_data = "data RAW UINT8 8\nFRAMEOFFSET 10000";
   uint8_t c[8];
   int fd, n, error, r = 0;
   DIRFILE *D;
 
+  rmdirfile();
   mkdir(filedir, 0777);
 
   fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
diff --git a/test/put_carray.c b/test/put_carray.c
index dc0abc6..f8607c1 100644
--- a/test/put_carray.c
+++ b/test/put_carray.c
@@ -1,23 +1,34 @@
-/* Add a RAW field */
+/* Copyright (C) 2010-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 #include "test.h"
 
-#include <inttypes.h>
-#include <stdlib.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-#include <string.h>
-#include <errno.h>
-#include <stdio.h>
-
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
   uint8_t val[] = {0, 0, 0, 0, 0, 0, 0, 0};
   int error, r = 0, i;
   DIRFILE *D;
 
+  rmdirfile();
   D = gd_open(filedir, GD_RDWR | GD_CREAT | GD_VERBOSE);
   gd_add_carray(D, "data", GD_UINT8, 8, GD_UINT8, &val, 0);
   for (i = 0; i < 8; ++i)
diff --git a/test/put_carray_slice.c b/test/put_carray_slice.c
index d0b2f36..519029c 100644
--- a/test/put_carray_slice.c
+++ b/test/put_carray_slice.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2010-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Add a RAW field */
 #include "test.h"
 
@@ -12,12 +32,14 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
   uint8_t val[] = {0, 0, 0, 0, 0, 0, 0, 0};
   int r = 0, error, i;
+  DIRFILE *D;
 
-  DIRFILE* D = gd_open(filedir, GD_RDWR | GD_CREAT | GD_VERBOSE);
+  rmdirfile();
+  D = gd_open(filedir, GD_RDWR | GD_CREAT | GD_VERBOSE);
   gd_add_carray(D, "data", GD_UINT8, 8, GD_UINT8, &val, 0);
   for (i = 0; i < 8; ++i)
     val[i] = i * (i + 1);
diff --git a/test/put_char.c b/test/put_char.c
index 16f37e8..315ec98 100644
--- a/test/put_char.c
+++ b/test/put_char.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Attempt to write UINT8 c/ an old-style type character should fail cleanly */
 #include "test.h"
 
@@ -11,14 +31,15 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* format_data = "data RAW UINT8 8\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *format_data = "data RAW UINT8 8\n";
   uint8_t c[8];
   int fd, i, n, error, r = 0;
   DIRFILE *D;
 
   memset(c, 0, 8);
+  rmdirfile();
   mkdir(filedir, 0777);
 
   for (i = 0; i < 8; ++i)
diff --git a/test/put_complex128.c b/test/put_complex128.c
index ab5d516..e1f9fc5 100644
--- a/test/put_complex128.c
+++ b/test/put_complex128.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2009-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Attempt to write COMPLEX128 */
 #include "test.h"
 
@@ -13,10 +33,10 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* data = __TEST__ "dirfile/data";
-  const char* format_data = "data RAW COMPLEX128 8\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *data = "dirfile/data";
+  const char *format_data = "data RAW COMPLEX128 8\n";
 #ifdef GD_NO_C99_API
   double c[8][2], d[2];
   const double zero[] = {0, 0};
@@ -29,6 +49,7 @@ int main(void)
   DIRFILE *D;
 
   memset(c, 0, 8);
+  rmdirfile();
   mkdir(filedir, 0777);
 
   for (i = 0; i < 8; ++i) {
@@ -57,26 +78,31 @@ int main(void)
   CHECKI(buf.st_size, 48 * 2 * sizeof(double));
 
   fd = open(data, O_RDONLY | O_BINARY);
-  i = 0;
+  if (fd < 0) {
+    perror("open");
+    r = 1;
+  } else {
+    i = 0;
 #ifdef GD_NO_C99_API
-  while (read(fd, d, 2 * sizeof(double)))
+    while (read(fd, d, 2 * sizeof(double)))
 #else
-  while (read(fd, &d, sizeof(double complex)))
+      while (read(fd, &d, sizeof(double complex)))
 #endif
-  {
-    if (i < 40 || i > 48) {
-      CHECKCi(i,d,zero);
-    } else {
+      {
+        if (i < 40 || i > 48) {
+          CHECKCi(i,d,zero);
+        } else {
 #ifdef GD_NO_C99_API
-      double v[] = {i, i - 40};
+          double v[] = {i, i - 40};
 #else
-      double complex v = i + _Complex_I * (i - 40);
+          double complex v = i + _Complex_I * (i - 40);
 #endif
-      CHECKCi(i,d,v);
-    }
-    i++;
+          CHECKCi(i,d,v);
+        }
+        i++;
+      }
+    close(fd);
   }
-  close(fd);
 
   unlink(data);
   unlink(format);
diff --git a/test/put_complex64.c b/test/put_complex64.c
index a7e37ba..56afedf 100644
--- a/test/put_complex64.c
+++ b/test/put_complex64.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2009-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Attempt to write COMPLEX64 */
 #include "test.h"
 
@@ -13,10 +33,10 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* data = __TEST__ "dirfile/data";
-  const char* format_data = "data RAW COMPLEX64 8\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *data = "dirfile/data";
+  const char *format_data = "data RAW COMPLEX64 8\n";
 #ifdef GD_NO_C99_API
   float c[8][2], d[2];
   const float zero[] = {0, 0};
@@ -29,6 +49,7 @@ int main(void)
   DIRFILE *D;
 
   memset(c, 0, 8);
+  rmdirfile();
   mkdir(filedir, 0777);
 
   for (i = 0; i < 8; ++i) {
@@ -53,30 +74,31 @@ int main(void)
   if (stat(data, &buf)) {
     perror("stat");
     r = 1;
-  }
-  CHECKI(buf.st_size, 48 * 2 * sizeof(float));
+  } else {
+    CHECKI(buf.st_size, 48 * 2 * sizeof(float));
 
-  fd = open(data, O_RDONLY | O_BINARY);
-  i = 0;
+    fd = open(data, O_RDONLY | O_BINARY);
+    i = 0;
 #ifdef GD_NO_C99_API
-  while (read(fd, d, 2 * sizeof(float)))
+    while (read(fd, d, 2 * sizeof(float)))
 #else
-  while (read(fd, &d, sizeof(float complex)))
+      while (read(fd, &d, sizeof(float complex)))
 #endif
-  {
-    if (i < 40 || i > 48) {
-      CHECKCi(i,d,zero);
-    } else {
+      {
+        if (i < 40 || i > 48) {
+          CHECKCi(i,d,zero);
+        } else {
 #ifdef GD_NO_C99_API
-      float v[] = {i, i - 40};
+          float v[] = {i, i - 40};
 #else
-      float complex v = i + _Complex_I * (i - 40);
+          float complex v = i + _Complex_I * (i - 40);
 #endif
-      CHECKCi(i,d,v);
-    }
-    i++;
+          CHECKCi(i,d,v);
+        }
+        i++;
+      }
+    close(fd);
   }
-  close(fd);
 
   unlink(data);
   unlink(format);
diff --git a/test/put_const.c b/test/put_const.c
index dd51079..151af3d 100644
--- a/test/put_const.c
+++ b/test/put_const.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Add a RAW field */
 #include "test.h"
 
@@ -12,12 +32,14 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
   uint8_t val = 0;
   int error, r = 0;
+  DIRFILE *D;
 
-  DIRFILE* D = gd_open(filedir, GD_RDWR | GD_CREAT | GD_VERBOSE);
+  rmdirfile();
+  D = gd_open(filedir, GD_RDWR | GD_CREAT | GD_VERBOSE);
   gd_add_const(D, "data", GD_UINT8, GD_UINT8, &val, 0);
   val = 23;
   gd_put_constant(D, "data", GD_UINT8, &val);
diff --git a/test/put_const_protect.c b/test/put_const_protect.c
index cce0f71..1f89d82 100644
--- a/test/put_const_protect.c
+++ b/test/put_const_protect.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Attempt to write UINT8 */
 #include "test.h"
 
@@ -12,13 +32,14 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* format_data = "data CONST UINT8 8\nPROTECT all\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *format_data = "data CONST UINT8 8\nPROTECT all\n";
   uint8_t d = 3;
   int fd, n, error, r = 0;
   DIRFILE *D;
 
+  rmdirfile();
   mkdir(filedir, 0777);
 
   fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
diff --git a/test/put_divide.c b/test/put_divide.c
index defdece..795bb7b 100644
--- a/test/put_divide.c
+++ b/test/put_divide.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2010-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Attempt to write DIVIDE */
 #include "test.h"
 
@@ -11,16 +31,17 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* data = __TEST__ "dirfile/data";
-  const char* format_data = "div DIVIDE data data\ndata RAW INT8 8\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *data = "dirfile/data";
+  const char *format_data = "div DIVIDE data data\ndata RAW INT8 8\n";
   int8_t c[8];
   struct stat buf;
   int fd, i, n, error, r = 0;
   DIRFILE *D;
 
   memset(c, 0, 8);
+  rmdirfile();
   mkdir(filedir, 0777);
 
   for (i = 0; i < 8; ++i)
diff --git a/test/put_endian16.c b/test/put_endian16.c
index 4811e6b..a5092ce 100644
--- a/test/put_endian16.c
+++ b/test/put_endian16.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Attempt to write UINT16 with the opposite endianness */
 #include "test.h"
 
@@ -22,15 +42,16 @@ static int BigEndian(void)
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* data = __TEST__ "dirfile/data";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *data = "dirfile/data";
   char format_data[1000];
   uint16_t c = 0x201, d = 0;
   const int big_endian = BigEndian();
   int fd, n, error, r = 0;
   DIRFILE *D;
 
+  rmdirfile();
   mkdir(filedir, 0777); 
 
   sprintf(format_data, "data RAW UINT16 1\nENDIAN %s\n", (big_endian)
diff --git a/test/put_endian32.c b/test/put_endian32.c
index 2c78ba9..977ca86 100644
--- a/test/put_endian32.c
+++ b/test/put_endian32.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Attempt to write UINT32 with the opposite endianness */
 #include "test.h"
 
@@ -22,15 +42,16 @@ static int BigEndian(void)
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* data = __TEST__ "dirfile/data";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *data = "dirfile/data";
   char format_data[1000];
   uint32_t c = 0x2000001, d = 0;
   const int big_endian = BigEndian();
   int fd, n, error, r = 0;
   DIRFILE *D;
 
+  rmdirfile();
   mkdir(filedir, 0777); 
 
   sprintf(format_data, "data RAW UINT32 1\nENDIAN %s\n", (big_endian)
diff --git a/test/put_endian64.c b/test/put_endian64.c
index f83639e..b1defaa 100644
--- a/test/put_endian64.c
+++ b/test/put_endian64.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Attempt to write UINT64 with the opposite endianness */
 #include "test.h"
 
@@ -22,15 +42,16 @@ static int BigEndian(void)
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* data = __TEST__ "dirfile/data";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *data = "dirfile/data";
   char format_data[1000];
-  uint64_t c = 0x0203000000040001LLU, d = 0;
+  uint64_t c = 0x0203000000040001, d = 0;
   const int big_endian = BigEndian();
   int fd, n, error, r = 0;
   DIRFILE *D;
 
+  rmdirfile();
   mkdir(filedir, 0777); 
 
   sprintf(format_data, "data RAW UINT64 1\nENDIAN %s\n", (big_endian)
@@ -55,7 +76,7 @@ int main(void)
   unlink(format);
   rmdir(filedir);
 
-  CHECKX(d,0x0100040000000302LLU);
+  CHECKX(d,0x0100040000000302);
   CHECKI(n,1);
   CHECKI(error,0);
 
diff --git a/test/put_endian8.c b/test/put_endian8.c
index cc6adff..ca26ab3 100644
--- a/test/put_endian8.c
+++ b/test/put_endian8.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Attempt to write UINT8 with the opposite endianness */
 #include "test.h"
 
@@ -22,15 +42,16 @@ static int BigEndian(void)
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* data = __TEST__ "dirfile/data";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *data = "dirfile/data";
   char format_data[1000];
   uint8_t c = 0x21, d = 0;
   const int big_endian = BigEndian();
   int fd, n, error, r = 0;
   DIRFILE *D;
 
+  rmdirfile();
   mkdir(filedir, 0777); 
 
   sprintf(format_data, "data RAW UINT8 1\nENDIAN %s\n", (big_endian)
diff --git a/test/put_endian_complex128_arm.c b/test/put_endian_complex128_arm.c
index c4c376b..af292cc 100644
--- a/test/put_endian_complex128_arm.c
+++ b/test/put_endian_complex128_arm.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2009-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Attempt to write arm-endian COMPLEX128 */
 #include "test.h"
 
@@ -12,10 +32,10 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* data = __TEST__ "dirfile/data";
-  const char* format_data = "data RAW COMPLEX128 1\nENDIAN little arm\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *data = "dirfile/data";
+  const char *format_data = "data RAW COMPLEX128 1\nENDIAN little arm\n";
   unsigned int i;
 #ifdef GD_NO_C99_API
   const double c[] = {1.5, 2.25};
@@ -30,6 +50,7 @@ int main(void)
   int fd, n, error, r = 0;
   DIRFILE *D;
 
+  rmdirfile();
   mkdir(filedir, 0777); 
 
   fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
diff --git a/test/put_endian_complex128_big.c b/test/put_endian_complex128_big.c
index 801bfad..6c4ce04 100644
--- a/test/put_endian_complex128_big.c
+++ b/test/put_endian_complex128_big.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2009-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Attempt to write big-endian COMPLEX128 */
 #include "test.h"
 
@@ -12,10 +32,10 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* data = __TEST__ "dirfile/data";
-  const char* format_data = "data RAW COMPLEX128 1\nENDIAN big\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *data = "dirfile/data";
+  const char *format_data = "data RAW COMPLEX128 1\nENDIAN big\n";
   unsigned int i;
 #ifdef GD_NO_C99_API
   const double c[] = {1.5, 2.25};
@@ -30,6 +50,7 @@ int main(void)
   int fd, n, error, r = 0;
   DIRFILE *D;
 
+  rmdirfile();
   mkdir(filedir, 0777); 
 
   fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
diff --git a/test/put_endian_complex128_little.c b/test/put_endian_complex128_little.c
index 10127ac..8f8dcdb 100644
--- a/test/put_endian_complex128_little.c
+++ b/test/put_endian_complex128_little.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2009-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Attempt to write little-endian COMPLEX128 */
 #include "test.h"
 
@@ -12,10 +32,10 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* data = __TEST__ "dirfile/data";
-  const char* format_data = "data RAW COMPLEX128 1\nENDIAN little\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *data = "dirfile/data";
+  const char *format_data = "data RAW COMPLEX128 1\nENDIAN little\n";
   unsigned int i;
 #ifdef GD_NO_C99_API
   const double c[] = {1.5, 2.25};
@@ -30,6 +50,7 @@ int main(void)
   int fd, n, error, r = 0;
   DIRFILE *D;
 
+  rmdirfile();
   mkdir(filedir, 0777); 
 
   fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
diff --git a/test/put_endian_complex64_arm.c b/test/put_endian_complex64_arm.c
index 1124730..bcd8ae4 100644
--- a/test/put_endian_complex64_arm.c
+++ b/test/put_endian_complex64_arm.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2009-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Attempt to write arm-endian COMPLEX64 */
 #include "test.h"
 
@@ -12,10 +32,10 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* data = __TEST__ "dirfile/data";
-  const char* format_data = "data RAW COMPLEX64 1\nENDIAN little arm\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *data = "dirfile/data";
+  const char *format_data = "data RAW COMPLEX64 1\nENDIAN little arm\n";
   unsigned int i;
 #ifdef GD_NO_C99_API
   const float c[] = {1.5, 2.25};
@@ -29,6 +49,7 @@ int main(void)
   int fd, n, error, r = 0;
   DIRFILE *D;
 
+  rmdirfile();
   mkdir(filedir, 0777); 
 
   fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
diff --git a/test/put_endian_complex64_big.c b/test/put_endian_complex64_big.c
index 62ed613..507558a 100644
--- a/test/put_endian_complex64_big.c
+++ b/test/put_endian_complex64_big.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2009-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Attempt to write big-endian COMPLEX64 */
 #include "test.h"
 
@@ -12,10 +32,10 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* data = __TEST__ "dirfile/data";
-  const char* format_data = "data RAW COMPLEX64 1\nENDIAN big\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *data = "dirfile/data";
+  const char *format_data = "data RAW COMPLEX64 1\nENDIAN big\n";
   unsigned int i;
 #ifdef GD_NO_C99_API
   const float c[] = {1.5, 2.25};
@@ -29,6 +49,7 @@ int main(void)
   int fd, n, error, r = 0;
   DIRFILE *D;
 
+  rmdirfile();
   mkdir(filedir, 0777); 
 
   fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
diff --git a/test/put_endian_complex64_little.c b/test/put_endian_complex64_little.c
index e5b4cc1..393b29b 100644
--- a/test/put_endian_complex64_little.c
+++ b/test/put_endian_complex64_little.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2009-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Attempt to write little-endian COMPLEX64 */
 #include "test.h"
 
@@ -12,10 +32,10 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* data = __TEST__ "dirfile/data";
-  const char* format_data = "data RAW COMPLEX64 1\nENDIAN little\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *data = "dirfile/data";
+  const char *format_data = "data RAW COMPLEX64 1\nENDIAN little\n";
   unsigned int i;
 #ifdef GD_NO_C99_API
   const float c[] = {1.5, 2.25};
@@ -29,6 +49,7 @@ int main(void)
   int fd, n, error, r = 0;
   DIRFILE *D;
 
+  rmdirfile();
   mkdir(filedir, 0777); 
 
   fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
diff --git a/test/put_endian_float32_arm.c b/test/put_endian_float32_arm.c
index 38274f5..7f5a9c7 100644
--- a/test/put_endian_float32_arm.c
+++ b/test/put_endian_float32_arm.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Attempt to write arm-endian FLOAT32 (which is just little endian) */
 #include "test.h"
 
@@ -12,10 +32,10 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* data = __TEST__ "dirfile/data";
-  const char* format_data = "data RAW FLOAT32 1\nENDIAN little arm\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *data = "dirfile/data";
+  const char *format_data = "data RAW FLOAT32 1\nENDIAN little arm\n";
   unsigned int i;
   const float c = 1.5;
   unsigned char x[sizeof(float)] = { 0x00, 0x00, 0xC0, 0x3F };
@@ -23,6 +43,7 @@ int main(void)
   int fd, n, error, r = 0;
   DIRFILE *D;
 
+  rmdirfile();
   mkdir(filedir, 0777); 
 
   fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
diff --git a/test/put_endian_float32_big.c b/test/put_endian_float32_big.c
index 3dcbad8..240c6b4 100644
--- a/test/put_endian_float32_big.c
+++ b/test/put_endian_float32_big.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Attempt to write big-endian FLOAT32 */
 #include "test.h"
 
@@ -12,10 +32,10 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* data = __TEST__ "dirfile/data";
-  const char* format_data = "data RAW FLOAT32 1\nENDIAN big\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *data = "dirfile/data";
+  const char *format_data = "data RAW FLOAT32 1\nENDIAN big\n";
   unsigned int i;
   const float c = 1.5;
   unsigned char x[sizeof(float)] = { 0x3F, 0xC0, 0x00, 0x00 };
@@ -23,6 +43,7 @@ int main(void)
   int fd, n, error, r = 0;
   DIRFILE *D;
 
+  rmdirfile();
   mkdir(filedir, 0777); 
 
   fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
diff --git a/test/put_endian_float32_little.c b/test/put_endian_float32_little.c
index 27f3110..a451e9e 100644
--- a/test/put_endian_float32_little.c
+++ b/test/put_endian_float32_little.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Attempt to write little-endian FLOAT32 */
 #include "test.h"
 
@@ -12,10 +32,10 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* data = __TEST__ "dirfile/data";
-  const char* format_data = "data RAW FLOAT32 1\nENDIAN little\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *data = "dirfile/data";
+  const char *format_data = "data RAW FLOAT32 1\nENDIAN little\n";
   unsigned int i;
   const float c = 1.5;
   unsigned char x[sizeof(float)] = { 0x00, 0x00, 0xC0, 0x3F };
@@ -23,6 +43,7 @@ int main(void)
   int fd, n, error, r = 0;
   DIRFILE *D;
 
+  rmdirfile();
   mkdir(filedir, 0777); 
 
   fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
diff --git a/test/put_endian_float64_arm.c b/test/put_endian_float64_arm.c
index e5efc61..e580285 100644
--- a/test/put_endian_float64_arm.c
+++ b/test/put_endian_float64_arm.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Attempt to write arm-endian FLOAT64 */
 #include "test.h"
 
@@ -12,10 +32,10 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* data = __TEST__ "dirfile/data";
-  const char* format_data = "data RAW FLOAT64 1\nENDIAN little arm\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *data = "dirfile/data";
+  const char *format_data = "data RAW FLOAT64 1\nENDIAN little arm\n";
   unsigned int i;
   const double c = 1.5;
   unsigned char x[sizeof(double)] = {
@@ -25,6 +45,7 @@ int main(void)
   int fd, n, error, r = 0;
   DIRFILE *D;
 
+  rmdirfile();
   mkdir(filedir, 0777); 
 
   fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
diff --git a/test/put_endian_float64_big.c b/test/put_endian_float64_big.c
index 6b88b9c..869d749 100644
--- a/test/put_endian_float64_big.c
+++ b/test/put_endian_float64_big.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Attempt to write big-endian FLOAT64 */
 #include "test.h"
 
@@ -12,10 +32,10 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* data = __TEST__ "dirfile/data";
-  const char* format_data = "data RAW FLOAT64 1\nENDIAN big\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *data = "dirfile/data";
+  const char *format_data = "data RAW FLOAT64 1\nENDIAN big\n";
   unsigned int i;
   const double c = 1.5;
   unsigned char x[sizeof(double)] = {
@@ -25,6 +45,7 @@ int main(void)
   int fd, n, error, r = 0;
   DIRFILE *D;
 
+  rmdirfile();
   mkdir(filedir, 0777); 
 
   fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
diff --git a/test/put_endian_float64_little.c b/test/put_endian_float64_little.c
index 11ea8bb..89e4007 100644
--- a/test/put_endian_float64_little.c
+++ b/test/put_endian_float64_little.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Attempt to write little-endian FLOAT64 */
 #include "test.h"
 
@@ -12,10 +32,10 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* data = __TEST__ "dirfile/data";
-  const char* format_data = "data RAW FLOAT64 1\nENDIAN little\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *data = "dirfile/data";
+  const char *format_data = "data RAW FLOAT64 1\nENDIAN little\n";
   unsigned int i;
   const double c = 1.5;
   unsigned char x[sizeof(double)] = {
@@ -25,6 +45,7 @@ int main(void)
   int fd, n, error, r = 0;
   DIRFILE *D;
 
+  rmdirfile();
   mkdir(filedir, 0777); 
 
   fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
diff --git a/test/put_ff.c b/test/put_ff.c
index bf33c28..192328b 100644
--- a/test/put_ff.c
+++ b/test/put_ff.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Attempt to write UINT8 */
 #include "test.h"
 
@@ -11,16 +31,17 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* data = __TEST__ "dirfile/data";
-  const char* format_data = "data RAW UINT8 8\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *data = "dirfile/data";
+  const char *format_data = "data RAW UINT8 8\n";
   uint8_t c[8], d;
   int fd, i, n, error, r = 0;
   DIRFILE *D;
   struct stat buf;
 
   memset(c, 0, 8);
+  rmdirfile();
   mkdir(filedir, 0777);
 
   for (i = 0; i < 8; ++i)
@@ -43,15 +64,20 @@ int main(void)
   CHECKI(buf.st_size, 48 * sizeof(uint8_t));
 
   fd = open(data, O_RDONLY | O_BINARY);
-  i = 0;
-  while (read(fd, &d, sizeof(uint8_t))) {
-    if (i < 40 || i > 48) {
-      CHECKUi(i,d,0);
-    } else
-      CHECKUi(i,d,i);
-    i++;
+  if (fd < 0) {
+    perror("open");
+    r = 1;
+  } else {
+    i = 0;
+    while (read(fd, &d, sizeof(uint8_t))) {
+      if (i < 40 || i > 48) {
+        CHECKUi(i,d,0);
+      } else
+        CHECKUi(i,d,i);
+      i++;
+    }
+    close(fd);
   }
-  close(fd);
 
   unlink(data);
   unlink(format);
diff --git a/test/put_float32.c b/test/put_float32.c
index 9d10437..bfb51d8 100644
--- a/test/put_float32.c
+++ b/test/put_float32.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Attempt to write FLOAT32 */
 #include "test.h"
 
@@ -12,16 +32,17 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* data = __TEST__ "dirfile/data";
-  const char* format_data = "data RAW FLOAT32 8\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *data = "dirfile/data";
+  const char *format_data = "data RAW FLOAT32 8\n";
   float c[8], d;
   struct stat buf;
   int fd, i, n, error, r = 0;
   DIRFILE *D;
 
   memset(c, 0, 8);
+  rmdirfile();
   mkdir(filedir, 0777);
 
   for (i = 0; i < 8; ++i)
@@ -40,19 +61,20 @@ int main(void)
   if (stat(data, &buf)) {
     perror("stat");
     r = 1;
-  }
-  CHECKI(buf.st_size, 48 * sizeof(float));
+  } else {
+    CHECKI(buf.st_size, 48 * sizeof(float));
 
-  fd = open(data, O_RDONLY | O_BINARY);
-  i = 0;
-  while (read(fd, &d, sizeof(float))) {
-    if (i < 40 || i > 48) {
-      CHECKFi(i,d,0);
-    } else
-      CHECKFi(i,d,i);
-    i++;
+    fd = open(data, O_RDONLY | O_BINARY);
+    i = 0;
+    while (read(fd, &d, sizeof(float))) {
+      if (i < 40 || i > 48) {
+        CHECKFi(i,d,0);
+      } else
+        CHECKFi(i,d,i);
+      i++;
+    }
+    close(fd);
   }
-  close(fd);
 
   unlink(data);
   unlink(format);
diff --git a/test/put_float64.c b/test/put_float64.c
index 92dd752..16cd776 100644
--- a/test/put_float64.c
+++ b/test/put_float64.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Attempt to write FLOAT64 */
 #include "test.h"
 
@@ -12,16 +32,17 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* data = __TEST__ "dirfile/data";
-  const char* format_data = "data RAW FLOAT64 8\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *data = "dirfile/data";
+  const char *format_data = "data RAW FLOAT64 8\n";
   double c[8], d;
   struct stat buf;
   int fd, i, n, error, r = 0;
   DIRFILE *D;
 
   memset(c, 0, 8);
+  rmdirfile();
   mkdir(filedir, 0777);
 
   for (i = 0; i < 8; ++i)
@@ -40,19 +61,20 @@ int main(void)
   if (stat(data, &buf)) {
     perror("stat");
     r = 1;
-  }
-  CHECKI(buf.st_size, 48 * sizeof(double));
+  } else {
+    CHECKI(buf.st_size, 48 * sizeof(double));
 
-  fd = open(data, O_RDONLY | O_BINARY);
-  i = 0;
-  while (read(fd, &d, sizeof(double))) {
-    if (i < 40 || i > 48) {
-      CHECKFi(i,d,0);
-    } else
-      CHECKFi(i,d,i);
-    i++;
+    fd = open(data, O_RDONLY | O_BINARY);
+    i = 0;
+    while (read(fd, &d, sizeof(double))) {
+      if (i < 40 || i > 48) {
+        CHECKFi(i,d,0);
+      } else
+        CHECKFi(i,d,i);
+      i++;
+    }
+    close(fd);
   }
-  close(fd);
 
   unlink(data);
   unlink(format);
diff --git a/test/put_foffs.c b/test/put_foffs.c
index 253d472..3557a26 100644
--- a/test/put_foffs.c
+++ b/test/put_foffs.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Attempt to write UINT8 with FRAMEOFFSET */
 #include "test.h"
 
@@ -12,15 +32,16 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* data = __TEST__ "dirfile/data";
-  const char* format_data = "data RAW UINT8 8\nFRAMEOFFSET 2\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *data = "dirfile/data";
+  const char *format_data = "data RAW UINT8 8\nFRAMEOFFSET 2\n";
   uint8_t c[8], d;
   struct stat buf;
   int fd, i, n, error, r = 0;
   DIRFILE *D;
 
+  rmdirfile();
   mkdir(filedir, 0777);
 
   for (i = 0; i < 8; ++i)
@@ -39,19 +60,20 @@ int main(void)
   if (stat(data, &buf)) {
     perror("stat");
     r = 1;
-  }
-  CHECKI(buf.st_size, 32 * sizeof(uint8_t));
+  } else {
+    CHECKI(buf.st_size, 32 * sizeof(uint8_t));
 
-  fd = open(data, O_RDONLY | O_BINARY);
-  i = 0;
-  while (read(fd, &d, sizeof(uint8_t))) {
-    if (i < 24 || i >= 32) {
-      CHECKUi(i,d,0);
-    } else
-      CHECKUi(i,d,i+16);
-    i++;
+    fd = open(data, O_RDONLY | O_BINARY);
+    i = 0;
+    while (read(fd, &d, sizeof(uint8_t))) {
+      if (i < 24 || i >= 32) {
+        CHECKUi(i,d,0);
+      } else
+        CHECKUi(i,d,i+16);
+      i++;
+    }
+    close(fd);
   }
-  close(fd);
 
   unlink(data);
   unlink(format);
diff --git a/test/put_fs.c b/test/put_fs.c
index 4c92520..7057a6b 100644
--- a/test/put_fs.c
+++ b/test/put_fs.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Attempt to write UINT8 */
 #include "test.h"
 
@@ -11,16 +31,17 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* data = __TEST__ "dirfile/data";
-  const char* format_data = "data RAW UINT8 8\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *data = "dirfile/data";
+  const char *format_data = "data RAW UINT8 8\n";
   uint8_t c[8], d;
   struct stat buf;
   int fd, i, n, error, r = 0;
   DIRFILE *D;
 
   memset(c, 0, 8);
+  rmdirfile();
   mkdir(filedir, 0777);
 
   for (i = 0; i < 8; ++i)
@@ -39,19 +60,20 @@ int main(void)
   if (stat(data, &buf)) {
     perror("stat");
     r = 1;
-  }
-  CHECKI(buf.st_size, 48 * sizeof(uint8_t));
+  } else {
+    CHECKI(buf.st_size, 48 * sizeof(uint8_t));
 
-  fd = open(data, O_RDONLY | O_BINARY);
-  i = 0;
-  while (read(fd, &d, sizeof(uint8_t))) {
-    if (i < 40 || i > 48) {
-      CHECKUi(i,d,0);
-    } else
-      CHECKUi(i,d,i);
-    i++;
+    fd = open(data, O_RDONLY | O_BINARY);
+    i = 0;
+    while (read(fd, &d, sizeof(uint8_t))) {
+      if (i < 40 || i > 48) {
+        CHECKUi(i,d,0);
+      } else
+        CHECKUi(i,d,i);
+      i++;
+    }
+    close(fd);
   }
-  close(fd);
 
   unlink(data);
   unlink(format);
diff --git a/test/put_here.c b/test/put_here.c
new file mode 100644
index 0000000..d187a41
--- /dev/null
+++ b/test/put_here.c
@@ -0,0 +1,88 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+/* Attempt to write UINT8 */
+#include "test.h"
+
+#include <inttypes.h>
+#include <stdlib.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <string.h>
+#include <errno.h>
+
+int main(void)
+{
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *data = "dirfile/data";
+  const char *format_data = "data RAW UINT8 8\n";
+  uint8_t c[8], d;
+  struct stat buf;
+  int fd, i, m, n, error, r = 0;
+  DIRFILE *D;
+
+  memset(c, 0, 8);
+  rmdirfile();
+  mkdir(filedir, 0777);
+
+  for (i = 0; i < 8; ++i)
+    c[i] = (uint8_t)(40 + i);
+
+  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
+  write(fd, format_data, strlen(format_data));
+  close(fd);
+
+  D = gd_open(filedir, GD_RDWR | GD_UNENCODED | GD_VERBOSE);
+  m = gd_seek(D, "data", 5, 0, GD_SEEK_WRITE | GD_SEEK_SET);
+  n = gd_putdata(D, "data", GD_HERE, 0, 0, 8, GD_UINT8, c);
+  error = gd_error(D);
+
+  gd_close(D);
+
+  if (stat(data, &buf)) {
+    perror("stat");
+    r = 1;
+  } else {
+    CHECKI(buf.st_size, 48 * sizeof(uint8_t));
+
+    fd = open(data, O_RDONLY | O_BINARY);
+    i = 0;
+    while (read(fd, &d, sizeof(uint8_t))) {
+      if (i < 40 || i > 48) {
+        CHECKUi(i,d,0);
+      } else
+        CHECKUi(i,d,i);
+      i++;
+    }
+    close(fd);
+  }
+
+  unlink(data);
+  unlink(format);
+  rmdir(filedir);
+
+  CHECKI(m,40);
+  CHECKI(n,8);
+  CHECKI(error, 0);
+
+  return r;
+}
diff --git a/test/put_heres.c b/test/put_heres.c
new file mode 100644
index 0000000..7ae7a36
--- /dev/null
+++ b/test/put_heres.c
@@ -0,0 +1,88 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+/* Attempt to write UINT8 */
+#include "test.h"
+
+#include <inttypes.h>
+#include <stdlib.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <string.h>
+#include <errno.h>
+
+int main(void)
+{
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *data = "dirfile/data";
+  const char *format_data = "data RAW UINT8 8\n";
+  uint8_t c[8], d;
+  struct stat buf;
+  int fd, i, m, n, error, r = 0;
+  DIRFILE *D;
+
+  memset(c, 0, 8);
+  rmdirfile();
+  mkdir(filedir, 0777);
+
+  for (i = 0; i < 8; ++i)
+    c[i] = (uint8_t)(40 + i);
+
+  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
+  write(fd, format_data, strlen(format_data));
+  close(fd);
+
+  D = gd_open(filedir, GD_RDWR | GD_UNENCODED | GD_VERBOSE);
+  m = gd_seek(D, "data", 5, 0, GD_SEEK_WRITE | GD_SEEK_SET);
+  n = gd_putdata(D, "data", 0, GD_HERE, 0, 8, GD_UINT8, c);
+  error = gd_error(D);
+
+  gd_close(D);
+
+  if (stat(data, &buf)) {
+    perror("stat");
+    r = 1;
+  } else {
+    CHECKI(buf.st_size, 48 * sizeof(uint8_t));
+
+    fd = open(data, O_RDONLY | O_BINARY);
+    i = 0;
+    while (read(fd, &d, sizeof(uint8_t))) {
+      if (i < 40 || i > 48) {
+        CHECKUi(i,d,0);
+      } else
+        CHECKUi(i,d,i);
+      i++;
+    }
+    close(fd);
+  }
+
+  unlink(data);
+  unlink(format);
+  rmdir(filedir);
+
+  CHECKI(m,40);
+  CHECKI(n,8);
+  CHECKI(error, 0);
+
+  return r;
+}
diff --git a/test/put_int16.c b/test/put_int16.c
index 38b1238..cd30069 100644
--- a/test/put_int16.c
+++ b/test/put_int16.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Attempt to write INT16 */
 #include "test.h"
 
@@ -11,16 +31,17 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* data = __TEST__ "dirfile/data";
-  const char* format_data = "data RAW INT16 8\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *data = "dirfile/data";
+  const char *format_data = "data RAW INT16 8\n";
   int16_t c[8], d;
   struct stat buf;
   int fd, i, n, error, r = 0;
   DIRFILE *D;
 
   memset(c, 0, 8);
+  rmdirfile();
   mkdir(filedir, 0777);
 
   for (i = 0; i < 8; ++i)
@@ -39,19 +60,20 @@ int main(void)
   if (stat(data, &buf)) {
     perror("stat");
     r = 1;
-  }
-  CHECKI(buf.st_size, 48 * sizeof(int16_t));
+  } else {
+    CHECKI(buf.st_size, 48 * sizeof(int16_t));
 
-  fd = open(data, O_RDONLY | O_BINARY);
-  i = 0;
-  while (read(fd, &d, sizeof(int16_t))) {
-    if (i < 40 || i > 48) {
-      CHECKIi(i,d,0);
-    } else
-      CHECKIi(i,d,i);
-    i++;
+    fd = open(data, O_RDONLY | O_BINARY);
+    i = 0;
+    while (read(fd, &d, sizeof(int16_t))) {
+      if (i < 40 || i > 48) {
+        CHECKIi(i,d,0);
+      } else
+        CHECKIi(i,d,i);
+      i++;
+    }
+    close(fd);
   }
-  close(fd);
 
   unlink(data);
   unlink(format);
diff --git a/test/put_int32.c b/test/put_int32.c
index de23887..9d1673f 100644
--- a/test/put_int32.c
+++ b/test/put_int32.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Attempt to write INT32 */
 #include "test.h"
 
@@ -11,16 +31,17 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* data = __TEST__ "dirfile/data";
-  const char* format_data = "data RAW INT32 8\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *data = "dirfile/data";
+  const char *format_data = "data RAW INT32 8\n";
   int32_t c[8], d;
   struct stat buf;
   int fd, i, n, error, r = 0;
   DIRFILE *D;
 
   memset(c, 0, 8);
+  rmdirfile();
   mkdir(filedir, 0777);
 
   for (i = 0; i < 8; ++i)
@@ -39,19 +60,20 @@ int main(void)
   if (stat(data, &buf)) {
     perror("stat");
     r = 1;
-  }
-  CHECKI(buf.st_size, 48 * sizeof(int32_t));
+  } else {
+    CHECKI(buf.st_size, 48 * sizeof(int32_t));
 
-  fd = open(data, O_RDONLY | O_BINARY);
-  i = 0;
-  while (read(fd, &d, sizeof(int32_t))) {
-    if (i < 40 || i > 48) {
-      CHECKIi(i,d,0);
-    } else
-      CHECKIi(i,d,i);
-    i++;
+    fd = open(data, O_RDONLY | O_BINARY);
+    i = 0;
+    while (read(fd, &d, sizeof(int32_t))) {
+      if (i < 40 || i > 48) {
+        CHECKIi(i,d,0);
+      } else
+        CHECKIi(i,d,i);
+      i++;
+    }
+    close(fd);
   }
-  close(fd);
 
   unlink(data);
   unlink(format);
diff --git a/test/put_int64.c b/test/put_int64.c
index 803c592..5aab118 100644
--- a/test/put_int64.c
+++ b/test/put_int64.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Attempt to write INT64 */
 #include "test.h"
 
@@ -11,16 +31,17 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* data = __TEST__ "dirfile/data";
-  const char* format_data = "data RAW INT64 8\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *data = "dirfile/data";
+  const char *format_data = "data RAW INT64 8\n";
   int64_t c[8], d;
   struct stat buf;
   int fd, i, n, error, r = 0;
   DIRFILE *D;
 
   memset(c, 0, 8);
+  rmdirfile();
   mkdir(filedir, 0777);
 
   for (i = 0; i < 8; ++i)
@@ -39,19 +60,20 @@ int main(void)
   if (stat(data, &buf)) {
     perror("stat");
     r = 1;
-  }
-  CHECKI(buf.st_size, 48 * sizeof(int64_t));
+  } else {
+    CHECKI(buf.st_size, 48 * sizeof(int64_t));
 
-  fd = open(data, O_RDONLY | O_BINARY);
-  i = 0;
-  while (read(fd, &d, sizeof(int64_t))) {
-    if (i < 40 || i > 48) {
-      CHECKIi(i,d,0);
-    } else
-      CHECKIi(i,d,i);
-    i++;
+    fd = open(data, O_RDONLY | O_BINARY);
+    i = 0;
+    while (read(fd, &d, sizeof(int64_t))) {
+      if (i < 40 || i > 48) {
+        CHECKIi(i,d,0);
+      } else
+        CHECKIi(i,d,i);
+      i++;
+    }
+    close(fd);
   }
-  close(fd);
 
   unlink(data);
   unlink(format);
diff --git a/test/put_int8.c b/test/put_int8.c
index 0596537..3560589 100644
--- a/test/put_int8.c
+++ b/test/put_int8.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Attempt to write INT8 */
 #include "test.h"
 
@@ -11,16 +31,17 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* data = __TEST__ "dirfile/data";
-  const char* format_data = "data RAW INT8 8\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *data = "dirfile/data";
+  const char *format_data = "data RAW INT8 8\n";
   int8_t c[8], d;
   struct stat buf;
   int fd, i, n, error, r = 0;
   DIRFILE *D;
 
   memset(c, 0, 8);
+  rmdirfile();
   mkdir(filedir, 0777);
 
   for (i = 0; i < 8; ++i)
@@ -39,19 +60,20 @@ int main(void)
   if (stat(data, &buf)) {
     perror("stat");
     r = 1;
-  }
-  CHECKI(buf.st_size, 48 * sizeof(int8_t));
+  } else {
+    CHECKI(buf.st_size, 48 * sizeof(int8_t));
 
-  fd = open(data, O_RDONLY | O_BINARY);
-  i = 0;
-  while (read(fd, &d, sizeof(int8_t))) {
-    if (i < 40 || i > 48) {
-      CHECKIi(i,d,0);
-    } else
-      CHECKIi(i,d,i);
-    i++;
+    fd = open(data, O_RDONLY | O_BINARY);
+    i = 0;
+    while (read(fd, &d, sizeof(int8_t))) {
+      if (i < 40 || i > 48) {
+        CHECKIi(i,d,0);
+      } else
+        CHECKIi(i,d,i);
+      i++;
+    }
+    close(fd);
   }
-  close(fd);
 
   unlink(data);
   unlink(format);
diff --git a/test/put_invalid.c b/test/put_invalid.c
index c0bd989..1df11eb 100644
--- a/test/put_invalid.c
+++ b/test/put_invalid.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Writing data to an invalid dirfile should fail cleanly */
 #include "test.h"
 
@@ -9,13 +29,16 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
+  const char *filedir = "dirfile";
   char c[8];
-  int r = 0;
+  int error, r = 0;
+  DIRFILE *D;
+  size_t n;
 
-  DIRFILE* D = gd_open(filedir, GD_RDWR | GD_UNENCODED);
-  size_t n = gd_putdata(D, "data", 5, 0, 1, 0, GD_UINT8, c);
-  int error = gd_error(D);
+  rmdirfile();
+  D = gd_open(filedir, GD_RDWR | GD_UNENCODED);
+  n = gd_putdata(D, "data", 5, 0, 1, 0, GD_UINT8, c);
+  error = gd_error(D);
   gd_close(D);
 
   CHECKI(n,0);
diff --git a/test/put_lincom1.c b/test/put_lincom1.c
index e15c000..8dc81a2 100644
--- a/test/put_lincom1.c
+++ b/test/put_lincom1.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Attempt to write LINCOM 1 */
 #include "test.h"
 
@@ -11,16 +31,17 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* data = __TEST__ "dirfile/data";
-  const char* format_data = "lincom LINCOM 1 data 0.5 3.0\ndata RAW INT8 8\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *data = "dirfile/data";
+  const char *format_data = "lincom LINCOM 1 data 0.5 3.0\ndata RAW INT8 8\n";
   int8_t c[8], d;
   struct stat buf;
   int fd, i, n, error, r = 0;
   DIRFILE *D;
 
   memset(c, 0, 8);
+  rmdirfile();
   mkdir(filedir, 0777);
 
   for (i = 0; i < 8; ++i)
@@ -39,19 +60,20 @@ int main(void)
   if (stat(data, &buf)) {
     perror("stat");
     r = 1;
-  }
-  CHECKI(buf.st_size, 48 * sizeof(int8_t));
+  } else {
+    CHECKI(buf.st_size, 48 * sizeof(int8_t));
 
-  fd = open(data, O_RDONLY | O_BINARY);
-  i = 0;
-  while (read(fd, &d, sizeof(int8_t))) {
-    if (i < 40 || i > 48) {
-      CHECKIi(i,d,0);
-    } else
-      CHECKIi(i,d, (i - 3) * 2);
-    i++;
+    fd = open(data, O_RDONLY | O_BINARY);
+    i = 0;
+    while (read(fd, &d, sizeof(int8_t))) {
+      if (i < 40 || i > 48) {
+        CHECKIi(i,d,0);
+      } else
+        CHECKIi(i,d, (i - 3) * 2);
+      i++;
+    }
+    close(fd);
   }
-  close(fd);
 
   unlink(data);
   unlink(format);
diff --git a/test/put_lincom2.c b/test/put_lincom2.c
index aac3a36..8112546 100644
--- a/test/put_lincom2.c
+++ b/test/put_lincom2.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Attempt to write LINCOM 2 */
 #include "test.h"
 
@@ -11,16 +31,17 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* data = __TEST__ "dirfile/data";
-  const char* format_data = "lincom LINCOM 2 data 0.5 3.0 data 1.0 2.0\ndata RAW INT8 8\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *data = "dirfile/data";
+  const char *format_data = "lincom LINCOM 2 data 0.5 3.0 data 1.0 2.0\ndata RAW INT8 8\n";
   int8_t c[8];
   struct stat buf;
   int fd, i, n, error, r = 0;
   DIRFILE *D;
 
   memset(c, 0, 8);
+  rmdirfile();
   mkdir(filedir, 0777);
 
   for (i = 0; i < 8; ++i)
diff --git a/test/put_lincom_noin.c b/test/put_lincom_noin.c
index 31f383d..ef81809 100644
--- a/test/put_lincom_noin.c
+++ b/test/put_lincom_noin.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Attempt to write LINCOM 1 */
 #include "test.h"
 
@@ -11,14 +31,15 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* format_data = "lincom LINCOM 1 data 0.5 3.0\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *format_data = "lincom LINCOM 1 data 0.5 3.0\n";
   int8_t c[8];
   int fd, i, n, error, r = 0;
   DIRFILE *D;
 
   memset(c, 0, 8);
+  rmdirfile();
   mkdir(filedir, 0777);
 
   for (i = 0; i < 8; ++i)
diff --git a/test/put_linterp.c b/test/put_linterp.c
index 0f8939a..3d00d2f 100644
--- a/test/put_linterp.c
+++ b/test/put_linterp.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Attempt to write LINTERP */
 #include "test.h"
 
@@ -12,11 +32,11 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* data = __TEST__ "dirfile/data";
-  const char* table = __TEST__ "dirfile/table";
-  const char* format_data = "linterp LINTERP data ./table\ndata RAW INT8 8\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *data = "dirfile/data";
+  const char *table = "dirfile/table";
+  const char *format_data = "linterp LINTERP data ./table\ndata RAW INT8 8\n";
   int8_t c[8], d;
   struct stat buf;
   int fd, i, n, error, r = 0;
@@ -24,6 +44,7 @@ int main(void)
   FILE *t;
 
   memset(c, 0, 8);
+  rmdirfile();
   mkdir(filedir, 0777);
 
   for (i = 0; i < 8; ++i)
@@ -47,19 +68,20 @@ int main(void)
   if (stat(data, &buf)) {
     perror("stat");
     r = 1;
-  }
-  CHECKI(buf.st_size, 48 * sizeof(int8_t));
+  } else {
+    CHECKI(buf.st_size, 48 * sizeof(int8_t));
 
-  fd = open(data, O_RDONLY | O_BINARY);
-  i = 0;
-  while (read(fd, &d, sizeof(int8_t))) {
-    if (i < 40 || i > 48) {
-      CHECKIi(i,d,0);
-    } else
-      CHECKIi(i,d,i * 2);
-    i++;
+    fd = open(data, O_RDONLY | O_BINARY);
+    i = 0;
+    while (read(fd, &d, sizeof(int8_t))) {
+      if (i < 40 || i > 48) {
+        CHECKIi(i,d,0);
+      } else
+        CHECKIi(i,d,i * 2);
+      i++;
+    }
+    close(fd);
   }
-  close(fd);
 
   unlink(table);
   unlink(data);
diff --git a/test/put_linterp_noin.c b/test/put_linterp_noin.c
index c24e4af..eae7c6c 100644
--- a/test/put_linterp_noin.c
+++ b/test/put_linterp_noin.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Attempt to write LINTERP */
 #include "test.h"
 
@@ -12,16 +32,17 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* table = __TEST__ "dirfile/table";
-  const char* format_data = "linterp LINTERP data ./table\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *table = "dirfile/table";
+  const char *format_data = "linterp LINTERP data ./table\n";
   int8_t c[8];
   int fd, i, n, error, r = 0;
   DIRFILE *D;
   FILE *t;
 
   memset(c, 0, 8);
+  rmdirfile();
   mkdir(filedir, 0777);
 
   for (i = 0; i < 8; ++i)
diff --git a/test/put_linterp_nomono.c b/test/put_linterp_nomono.c
index 8b7e225..52c2933 100644
--- a/test/put_linterp_nomono.c
+++ b/test/put_linterp_nomono.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2010-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Attempt to write LINTERP */
 #include "test.h"
 
@@ -12,17 +32,18 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* data = __TEST__ "dirfile/data";
-  const char* table = __TEST__ "dirfile/table";
-  const char* format_data = "linterp LINTERP data ./table\ndata RAW INT8 8\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *data = "dirfile/data";
+  const char *table = "dirfile/table";
+  const char *format_data = "linterp LINTERP data ./table\ndata RAW INT8 8\n";
   int8_t c[8];
   int fd, i, n, error, r = 0;
   DIRFILE *D;
   FILE *t;
 
   memset(c, 0, 8);
+  rmdirfile();
   mkdir(filedir, 0777);
 
   for (i = 0; i < 8; ++i)
diff --git a/test/put_linterp_notab.c b/test/put_linterp_notab.c
index 8a8979b..e07ea60 100644
--- a/test/put_linterp_notab.c
+++ b/test/put_linterp_notab.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Attempt to write LINCOM 1 */
 #include "test.h"
 
@@ -11,15 +31,16 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* data = __TEST__ "dirfile/data";
-  const char* format_data = "linterp LINTERP data ./table\ndata RAW INT8 8\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *data = "dirfile/data";
+  const char *format_data = "linterp LINTERP data ./table\ndata RAW INT8 8\n";
   int8_t c[8];
   int fd, i, n, error, r = 0;
   DIRFILE *D;
 
   memset(c, 0, 8);
+  rmdirfile();
   mkdir(filedir, 0777);
 
   for (i = 0; i < 8; ++i)
diff --git a/test/put_linterp_reverse.c b/test/put_linterp_reverse.c
index a47524f..6830597 100644
--- a/test/put_linterp_reverse.c
+++ b/test/put_linterp_reverse.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2010-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Attempt to write LINTERP */
 #include "test.h"
 
@@ -12,11 +32,11 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* data = __TEST__ "dirfile/data";
-  const char* table = __TEST__ "dirfile/table";
-  const char* format_data = "linterp LINTERP data ./table\ndata RAW INT8 8\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *data = "dirfile/data";
+  const char *table = "dirfile/table";
+  const char *format_data = "linterp LINTERP data ./table\ndata RAW INT8 8\n";
   int8_t c[8], d;
   struct stat buf;
   int fd, i, n, error, r = 0;
@@ -24,6 +44,7 @@ int main(void)
   FILE *t;
 
   memset(c, 0, 8);
+  rmdirfile();
   mkdir(filedir, 0777);
 
   for (i = 0; i < 8; ++i)
@@ -47,19 +68,20 @@ int main(void)
   if (stat(data, &buf)) {
     perror("stat");
     r = 1;
-  }
-  CHECKI(buf.st_size, 48 * sizeof(int8_t));
+  } else {
+    CHECKI(buf.st_size, 48 * sizeof(int8_t));
 
-  fd = open(data, O_RDONLY | O_BINARY);
-  i = 0;
-  while (read(fd, &d, sizeof(int8_t))) {
-    if (i < 40 || i > 48) {
-      CHECKIi(i,d,0);
-    } else
-      CHECKIi(i,d,100 - i);
-    i++;
+    fd = open(data, O_RDONLY | O_BINARY);
+    i = 0;
+    while (read(fd, &d, sizeof(int8_t))) {
+      if (i < 40 || i > 48) {
+        CHECKIi(i,d,0);
+      } else
+        CHECKIi(i,d,100 - i);
+      i++;
+    }
+    close(fd);
   }
-  close(fd);
 
   unlink(table);
   unlink(data);
diff --git a/test/put_mplex.c b/test/put_mplex.c
new file mode 100644
index 0000000..d2488ab
--- /dev/null
+++ b/test/put_mplex.c
@@ -0,0 +1,81 @@
+/* Copyright (C) 2012 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+#include "test.h"
+
+int main(void)
+{
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *data = "dirfile/data";
+  const char *count = "dirfile/count";
+  const char *format_data =
+    "mplex MPLEX data count 1 3\n"
+    "count RAW UINT8 8\n"
+    "data RAW UINT8 8\n";
+  unsigned char c[8], d[8];
+  unsigned char data_data[256];
+  int i, n, m, error, r = 0;
+  DIRFILE *D;
+
+  rmdirfile();
+  mkdir(filedir, 0777);
+
+  i = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
+  write(i, format_data, strlen(format_data));
+  close(i);
+
+  for (i = 0; i < 256; ++i)
+    data_data[i] = (unsigned char)i;
+
+  i = open(data, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
+  write(i, data_data, 256);
+  close(i);
+
+  for (i = 0; i < 256; ++i)
+    data_data[i] %= 3;
+
+  i = open(count, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
+  write(i, data_data, 256);
+  close(i);
+
+  for (i = 0; i < 8; ++i)
+    d[i] = 80 + i;
+
+  D = gd_open(filedir, GD_RDWR | GD_VERBOSE);
+  n = gd_putdata(D, "mplex", 5, 0, 1, 0, GD_UINT8, &d);
+  error = gd_error(D);
+  m = gd_getdata(D, "data", 5, 0, 1, 0, GD_UINT8, &c);
+
+  gd_close(D);
+
+  unlink(count);
+  unlink(data);
+  unlink(format);
+  rmdir(filedir);
+
+  CHECKI(error, 0);
+  CHECKI(n, 8);
+  CHECKI(m, 8);
+  for (i = 0; i < 8; ++i)
+    CHECKIi(i, c[i], ((i % 3) == 0) ? 80 + i : 40 + i);
+
+  return r;
+}
diff --git a/test/put_multiply.c b/test/put_multiply.c
index bd9d0b8..8c43588 100644
--- a/test/put_multiply.c
+++ b/test/put_multiply.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Attempt to write MULTIPLY */
 #include "test.h"
 
@@ -11,16 +31,17 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* data = __TEST__ "dirfile/data";
-  const char* format_data = "mult MULTIPLY data data\ndata RAW INT8 8\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *data = "dirfile/data";
+  const char *format_data = "mult MULTIPLY data data\ndata RAW INT8 8\n";
   int8_t c[8];
   struct stat buf;
   int fd, i, n, error, r = 0;
   DIRFILE *D;
 
   memset(c, 0, 8);
+  rmdirfile();
   mkdir(filedir, 0777);
 
   for (i = 0; i < 8; ++i)
diff --git a/test/put_null.c b/test/put_null.c
index a5b93dd..55eef54 100644
--- a/test/put_null.c
+++ b/test/put_null.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Attempt to write NULL */
 #include "test.h"
 
@@ -11,12 +31,13 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* format_data = "data RAW UINT8 8\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *format_data = "data RAW UINT8 8\n";
   int fd, n, error, r = 0;
   DIRFILE *D;
 
+  rmdirfile();
   mkdir(filedir, 0777);
 
   fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
diff --git a/test/put_off64.c b/test/put_off64.c
index da4aa08..d19e139 100644
--- a/test/put_off64.c
+++ b/test/put_off64.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Attempt to write UINT8 */
 #if (defined _FILE_OFFSET_BITS && _FILE_OFFSET_BITS == 64) || __MSVCRT__
 #  define SKIP_TEST
@@ -20,16 +40,17 @@ int main(void)
 #ifdef SKIP_TEST
   return 77;
 #else
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* data = __TEST__ "dirfile/data";
-  const char* format_data = "data RAW UINT8 8\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *data = "dirfile/data";
+  const char *format_data = "data RAW UINT8 8\n";
   uint8_t c[8], d;
   struct stat buf;
   int fd, i, n, error, r = 0;
   DIRFILE *D;
 
   memset(c, 0, 8);
+  rmdirfile();
   mkdir(filedir, 0777);
 
   for (i = 0; i < 8; ++i)
@@ -48,19 +69,20 @@ int main(void)
   if (stat(data, &buf)) {
     perror("stat");
     r = 1;
-  }
-  CHECKI(buf.st_size, 48 * sizeof(uint8_t));
+  } else {
+    CHECKI(buf.st_size, 48 * sizeof(uint8_t));
 
-  fd = open(data, O_RDONLY | O_BINARY);
-  i = 0;
-  while (read(fd, &d, sizeof(uint8_t))) {
-    if (i < 40 || i > 48) {
-      CHECKIi(i,d,0);
-    } else
-      CHECKIi(i,d,i);
-    i++;
+    fd = open(data, O_RDONLY | O_BINARY);
+    i = 0;
+    while (read(fd, &d, sizeof(uint8_t))) {
+      if (i < 40 || i > 48) {
+        CHECKIi(i,d,0);
+      } else
+        CHECKIi(i,d,i);
+      i++;
+    }
+    close(fd);
   }
-  close(fd);
 
   unlink(data);
   unlink(format);
diff --git a/test/put_phase.c b/test/put_phase.c
index 017a18e..8109c04 100644
--- a/test/put_phase.c
+++ b/test/put_phase.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Attempt to write PHASE */
 #include "test.h"
 
@@ -11,16 +31,17 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* data = __TEST__ "dirfile/data";
-  const char* format_data = "phase PHASE data -2\ndata RAW INT8 8\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *data = "dirfile/data";
+  const char *format_data = "phase PHASE data -2\ndata RAW INT8 8\n";
   int8_t c[8], d;
   struct stat buf;
   int fd, i, n, error, r = 0;
   DIRFILE *D;
 
   memset(c, 0, 8);
+  rmdirfile();
   mkdir(filedir, 0777);
 
   for (i = 0; i < 8; ++i)
@@ -39,19 +60,20 @@ int main(void)
   if (stat(data, &buf)) {
     perror("stat");
     r = 1;
-  }
-  CHECKI(buf.st_size, 46 * sizeof(int8_t));
+  } else {
+    CHECKI(buf.st_size, 46 * sizeof(int8_t));
 
-  fd = open(data, O_RDONLY | O_BINARY);
-  i = 0;
-  while (read(fd, &d, sizeof(int8_t))) {
-    if (i < 38 || i > 46) {
-      CHECKIi(i,d,0);
-    } else
-      CHECKIi(i,d,i + 2);
-    i++;
+    fd = open(data, O_RDONLY | O_BINARY);
+    i = 0;
+    while (read(fd, &d, sizeof(int8_t))) {
+      if (i < 38 || i > 46) {
+        CHECKIi(i,d,0);
+      } else
+        CHECKIi(i,d,i + 2);
+      i++;
+    }
+    close(fd);
   }
-  close(fd);
 
   unlink(data);
   unlink(format);
diff --git a/test/put_phase_noin.c b/test/put_phase_noin.c
index abafb28..8e9adef 100644
--- a/test/put_phase_noin.c
+++ b/test/put_phase_noin.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Attempt to write PHASE */
 #include "test.h"
 
@@ -11,14 +31,15 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* format_data = "phase PHASE data -2\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *format_data = "phase PHASE data -2\n";
   int8_t c[8];
   int fd, i, n, error, r = 0;
   DIRFILE *D;
 
   memset(c, 0, 8);
+  rmdirfile();
   mkdir(filedir, 0777);
 
   for (i = 0; i < 8; ++i)
diff --git a/test/put_polynom1.c b/test/put_polynom1.c
index e7739a2..8dbcdc8 100644
--- a/test/put_polynom1.c
+++ b/test/put_polynom1.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2009-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Attempt to write POLYNOM 1 */
 #include "test.h"
 
@@ -11,16 +31,17 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* data = __TEST__ "dirfile/data";
-  const char* format_data = "polynom POLYNOM data 3.0 0.5\ndata RAW INT8 8\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *data = "dirfile/data";
+  const char *format_data = "polynom POLYNOM data 3.0 0.5\ndata RAW INT8 8\n";
   int8_t c[8], d;
   struct stat buf;
   int fd, i, n, error, r = 0;
   DIRFILE *D;
 
   memset(c, 0, 8);
+  rmdirfile();
   mkdir(filedir, 0777);
 
   for (i = 0; i < 8; ++i)
@@ -39,19 +60,20 @@ int main(void)
   if (stat(data, &buf)) {
     perror("stat");
     r = 1;
-  }
-  CHECKI(buf.st_size, 48 * sizeof(int8_t));
+  } else {
+    CHECKI(buf.st_size, 48 * sizeof(int8_t));
 
-  fd = open(data, O_RDONLY | O_BINARY);
-  i = 0;
-  while (read(fd, &d, sizeof(int8_t))) {
-    if (i < 40 || i > 48) {
-      CHECKIi(i,d,0);
-    } else
-      CHECKIi(i,d,(i - 3) * 2);
-    i++;
+    fd = open(data, O_RDONLY | O_BINARY);
+    i = 0;
+    while (read(fd, &d, sizeof(int8_t))) {
+      if (i < 40 || i > 48) {
+        CHECKIi(i,d,0);
+      } else
+        CHECKIi(i,d,(i - 3) * 2);
+      i++;
+    }
+    close(fd);
   }
-  close(fd);
 
   unlink(data);
   unlink(format);
diff --git a/test/put_polynom2.c b/test/put_polynom2.c
index ad40e6b..5eedc4e 100644
--- a/test/put_polynom2.c
+++ b/test/put_polynom2.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2009-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Attempt to write POLYNOM */
 #include "test.h"
 
@@ -11,16 +31,17 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* data = __TEST__ "dirfile/data";
-  const char* format_data = "polynom POLYNOM data 3.0 2.0 1.0 0.5\ndata RAW INT8 8\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *data = "dirfile/data";
+  const char *format_data = "polynom POLYNOM data 3.0 2.0 1.0 0.5\ndata RAW INT8 8\n";
   int8_t c[8];
   struct stat buf;
   int fd, i, n, error, r = 0;
   DIRFILE *D;
 
   memset(c, 0, 8);
+  rmdirfile();
   mkdir(filedir, 0777);
 
   for (i = 0; i < 8; ++i)
diff --git a/test/put_polynom_noin.c b/test/put_polynom_noin.c
index 93af75a..4ad2a3b 100644
--- a/test/put_polynom_noin.c
+++ b/test/put_polynom_noin.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2009-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Attempt to write POLYNOM */
 #include "test.h"
 
@@ -11,14 +31,15 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* format_data = "polynom POLYNOM data 0.5 3.0\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *format_data = "polynom POLYNOM data 0.5 3.0\n";
   int8_t c[8];
   int fd, i, n, error, r = 0;
   DIRFILE *D;
 
   memset(c, 0, 8);
+  rmdirfile();
   mkdir(filedir, 0777);
 
   for (i = 0; i < 8; ++i)
diff --git a/test/put_protect.c b/test/put_protect.c
index a91b411..0f0017b 100644
--- a/test/put_protect.c
+++ b/test/put_protect.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Attempt to write UINT8 */
 #include "test.h"
 
@@ -11,14 +31,15 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* format_data = "data RAW UINT8 8\nPROTECT all\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *format_data = "data RAW UINT8 8\nPROTECT all\n";
   uint8_t c[8];
   int fd, i, n, error, r = 0;
   DIRFILE *D;
 
   memset(c, 0, 8);
+  rmdirfile();
   mkdir(filedir, 0777);
 
   for (i = 0; i < 8; ++i)
diff --git a/test/put_rdonly.c b/test/put_rdonly.c
index 28e64e3..ccd6d8c 100644
--- a/test/put_rdonly.c
+++ b/test/put_rdonly.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Attempt to write to a read only dirfile */
 #include "test.h"
 
@@ -10,15 +30,16 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* data = __TEST__ "dirfile/data";
-  const char* format_data = "data RAW UINT8 8\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *data = "dirfile/data";
+  const char *format_data = "data RAW UINT8 8\n";
   unsigned char c[8];
   int fd, n, error, unlink_data, r = 0;
   DIRFILE *D;
 
   memset(c, 0, 8);
+  rmdirfile();
   mkdir(filedir, 0777);
 
   fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
diff --git a/test/put_recip.c b/test/put_recip.c
index 7b9c907..897cbd8 100644
--- a/test/put_recip.c
+++ b/test/put_recip.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2010-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Attempt to write DIVIDE */
 #include "test.h"
 
@@ -11,16 +31,17 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* data = __TEST__ "dirfile/data";
-  const char* format_data = "div RECIP data 1000.\ndata RAW INT8 8\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *data = "dirfile/data";
+  const char *format_data = "div RECIP data 1000.\ndata RAW INT8 8\n";
   int8_t c[8], d;
   struct stat buf;
   int fd, i, n, error, r = 0;
   DIRFILE *D;
 
   memset(c, 0, 8);
+  rmdirfile();
   mkdir(filedir, 0777);
 
   for (i = 0; i < 8; ++i)
@@ -39,19 +60,20 @@ int main(void)
   if (stat(data, &buf)) {
     perror("stat");
     r = 1;
-  }
-  CHECKI(buf.st_size, 48 * sizeof(int8_t));
+  } else {
+    CHECKI(buf.st_size, 48 * sizeof(int8_t));
 
-  fd = open(data, O_RDONLY | O_BINARY);
-  i = 0;
-  while (read(fd, &d, sizeof(int8_t))) {
-    if (i < 40 || i > 48) {
-      CHECKIi(i,d,0);
-    } else
-      CHECKIi(i,d, 1000. / i);
-    i++;
+    fd = open(data, O_RDONLY | O_BINARY);
+    i = 0;
+    while (read(fd, &d, sizeof(int8_t))) {
+      if (i < 40 || i > 48) {
+        CHECKIi(i,d,0);
+      } else
+        CHECKIi(i,d, 1000. / i);
+      i++;
+    }
+    close(fd);
   }
-  close(fd);
 
   unlink(data);
   unlink(format);
diff --git a/test/put_recurse.c b/test/put_recurse.c
index aae6391..bb9e56b 100644
--- a/test/put_recurse.c
+++ b/test/put_recurse.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Attempting to resove a recursively defined field should fail cleanly */
 #include "test.h"
 
@@ -10,15 +30,16 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* format_data =
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *format_data =
     "in1 RAW UINT8 11\n"
     "lincom LINCOM 1 lincom 1 0\n";
   unsigned char c[8];
   int fd, n, error, r = 0;
   DIRFILE *D;
 
+  rmdirfile();
   mkdir(filedir, 0777);
 
   fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
diff --git a/test/put_repr.c b/test/put_repr.c
index d0c7599..8db10a0 100644
--- a/test/put_repr.c
+++ b/test/put_repr.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2009-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Attempt to write COMPLEX64 */
 #include "test.h"
 
@@ -13,15 +33,16 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* data = __TEST__ "dirfile/data";
-  const char* format_data = "data RAW COMPLEX64 8\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *data = "dirfile/data";
+  const char *format_data = "data RAW COMPLEX64 8\n";
   float c[8];
   int fd, i, n, error, r = 0;
   DIRFILE *D;
 
   memset(c, 0, 8);
+  rmdirfile();
   mkdir(filedir, 0777);
 
   for (i = 0; i < 8; ++i)
diff --git a/test/put_rofs.c b/test/put_rofs.c
index ad661ce..576e646 100644
--- a/test/put_rofs.c
+++ b/test/put_rofs.c
@@ -1,4 +1,24 @@
-/* Attempt to write a non-existant field */
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+/* Attempt to write a read-only dirfile */
 #include "test.h"
 
 #include <stdlib.h>
@@ -10,21 +30,32 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* data = __TEST__ "dirfile/data";
-  const char* format_data = "data RAW UINT8 1\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *data = "dirfile/data";
+  const char *format_data = "data RAW UINT8 1\n";
   unsigned char c = 0;
   int fd, n, error, r = 0;
   DIRFILE *D;
 
+  rmdirfile();
   mkdir(filedir, 0777);
 
   fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
   write(fd, format_data, strlen(format_data));
   close(fd);
 
-  close(open(data, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0444));
+  close(open(data, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0555));
+
+  /* ensure filesystem honours read-onlyness */
+  if ((fd = open(data, O_RDWR)) >= 0 || errno != EACCES) {
+    if (fd >= 0)
+      close(fd);
+    unlink(format);
+    unlink(data);
+    rmdir(filedir);
+    return 77;
+  }
 
   D = gd_open(filedir, GD_RDWR | GD_UNENCODED);
   n = gd_putdata(D, "data", 5, 0, 1, 0, GD_UINT8, &c);
diff --git a/test/put_sbit.c b/test/put_sbit.c
index 9b5d86c..bbe8a3b 100644
--- a/test/put_sbit.c
+++ b/test/put_sbit.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2009-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Attempt to write BIT */
 #include "test.h"
 
@@ -12,15 +32,16 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* data = __TEST__ "dirfile/data";
-  const char* format_data = "bit SBIT data 2 3\ndata RAW INT8 8\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *data = "dirfile/data";
+  const char *format_data = "bit SBIT data 2 3\ndata RAW INT8 8\n";
   int8_t c[8];
   int8_t d = 0xA5;
   int fd, i, n, error, r = 0;
   DIRFILE *D;
 
+  rmdirfile();
   mkdir(filedir, 0777);
 
   for (i = 0; i < 8; ++i)
diff --git a/test/put_sf.c b/test/put_sf.c
index 754d32f..4970cb5 100644
--- a/test/put_sf.c
+++ b/test/put_sf.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Attempt to write UINT8 */
 #include "test.h"
 
@@ -11,16 +31,17 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* data = __TEST__ "dirfile/data";
-  const char* format_data = "data RAW UINT8 8\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *data = "dirfile/data";
+  const char *format_data = "data RAW UINT8 8\n";
   uint8_t c[8], d;
   struct stat buf;
   int fd, i, n, error, r = 0;
   DIRFILE *D;
 
   memset(c, 0, 8);
+  rmdirfile();
   mkdir(filedir, 0777);
 
   for (i = 0; i < 8; ++i)
@@ -39,19 +60,20 @@ int main(void)
   if (stat(data, &buf)) {
     perror("stat");
     r = 1;
-  }
-  CHECKI(buf.st_size, 40 + 8 * sizeof(uint8_t));
+  } else {
+    CHECKI(buf.st_size, 40 + 8 * sizeof(uint8_t));
 
-  fd = open(data, O_RDONLY | O_BINARY);
-  i = 0;
-  while (read(fd, &d, sizeof(uint8_t))) {
-    if (i < 40 || i > 48) {
-      CHECKIi(i,d,0);
-    } else
-      CHECKIi(i,d,i);
-    i++;
+    fd = open(data, O_RDONLY | O_BINARY);
+    i = 0;
+    while (read(fd, &d, sizeof(uint8_t))) {
+      if (i < 40 || i > 48) {
+        CHECKIi(i,d,0);
+      } else
+        CHECKIi(i,d,i);
+      i++;
+    }
+    close(fd);
   }
-  close(fd);
 
   unlink(data);
   unlink(format);
diff --git a/test/put_ss.c b/test/put_ss.c
index eb6528e..24028d5 100644
--- a/test/put_ss.c
+++ b/test/put_ss.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Attempt to write UINT8 */
 #include "test.h"
 
@@ -11,16 +31,17 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* data = __TEST__ "dirfile/data";
-  const char* format_data = "data RAW UINT8 8\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *data = "dirfile/data";
+  const char *format_data = "data RAW UINT8 8\n";
   uint8_t c[8], d;
   struct stat buf;
   int fd, i, n, error, r = 0;
   DIRFILE *D;
 
   memset(c, 0, 8);
+  rmdirfile();
   mkdir(filedir, 0777);
 
   for (i = 0; i < 8; ++i)
@@ -39,19 +60,20 @@ int main(void)
   if (stat(data, &buf)) {
     perror("stat");
     r = 1;
-  }
-  CHECKI(buf.st_size, 40 + 8 * sizeof(uint8_t));
+  } else {
+    CHECKI(buf.st_size, 40 + 8 * sizeof(uint8_t));
 
-  fd = open(data, O_RDONLY | O_BINARY);
-  i = 0;
-  while (read(fd, &d, sizeof(uint8_t))) {
-    if (i < 40 || i > 48) {
-      CHECKIi(i,d,0);
-    } else
-      CHECKIi(i,d,i);
-    i++;
+    fd = open(data, O_RDONLY | O_BINARY);
+    i = 0;
+    while (read(fd, &d, sizeof(uint8_t))) {
+      if (i < 40 || i > 48) {
+        CHECKIi(i,d,0);
+      } else
+        CHECKIi(i,d,i);
+      i++;
+    }
+    close(fd);
   }
-  close(fd);
 
   unlink(data);
   unlink(format);
diff --git a/test/put_string.c b/test/put_string.c
index 554e157..978dbc9 100644
--- a/test/put_string.c
+++ b/test/put_string.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Add a RAW field */
 #include "test.h"
 
@@ -12,12 +32,14 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
   char string[1024] = "";
   int error, r = 0;
+  DIRFILE *D;
 
-  DIRFILE* D = gd_open(filedir, GD_RDWR | GD_CREAT | GD_VERBOSE);
+  rmdirfile();
+  D = gd_open(filedir, GD_RDWR | GD_CREAT | GD_VERBOSE);
   gd_add_string(D, "data", "some string", 0);
   gd_put_string(D, "data", "some other string");
   error = gd_error(D);
diff --git a/test/put_string_protect.c b/test/put_string_protect.c
index 5465534..cd06187 100644
--- a/test/put_string_protect.c
+++ b/test/put_string_protect.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Attempt to write UINT8 */
 #include "test.h"
 
@@ -11,12 +31,13 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* format_data = "data STRING UINT8\nPROTECT all\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *format_data = "data STRING UINT8\nPROTECT all\n";
   int fd, n, error, r = 0;
   DIRFILE *D;
 
+  rmdirfile();
   mkdir(filedir, 0777);
 
   fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
diff --git a/test/put_type.c b/test/put_type.c
index b2fe788..ac3db8b 100644
--- a/test/put_type.c
+++ b/test/put_type.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Attempt to write an invalid type */
 #include "test.h"
 
@@ -11,12 +31,13 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* format_data = "data RAW UINT8 8\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *format_data = "data RAW UINT8 8\n";
   int fd, n, error, r = 0;
   DIRFILE *D;
 
+  rmdirfile();
   mkdir(filedir, 0777);
 
   fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
diff --git a/test/put_uint16.c b/test/put_uint16.c
index ef2a13c..30f4f44 100644
--- a/test/put_uint16.c
+++ b/test/put_uint16.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Attempt to write UINT16 */
 #include "test.h"
 
@@ -12,16 +32,17 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* data = __TEST__ "dirfile/data";
-  const char* format_data = "data RAW UINT16 8\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *data = "dirfile/data";
+  const char *format_data = "data RAW UINT16 8\n";
   uint16_t c[8], d;
   struct stat buf;
   int fd, i, n, error, r = 0;
   DIRFILE *D;
 
   memset(c, 0, 8);
+  rmdirfile();
   mkdir(filedir, 0777);
 
   for (i = 0; i < 8; ++i)
@@ -40,19 +61,20 @@ int main(void)
   if (stat(data, &buf)) {
     perror("stat");
     r = 1;
-  }
-  CHECKI(buf.st_size, 48 * sizeof(uint16_t));
+  } else {
+    CHECKI(buf.st_size, 48 * sizeof(uint16_t));
 
-  fd = open(data, O_RDONLY | O_BINARY);
-  i = 0;
-  while (read(fd, &d, sizeof(uint16_t))) {
-    if (i < 40 || i > 48) {
-      CHECKIi(i,d,0);
-    } else
-      CHECKIi(i,d,i);
-    i++;
+    fd = open(data, O_RDONLY | O_BINARY);
+    i = 0;
+    while (read(fd, &d, sizeof(uint16_t))) {
+      if (i < 40 || i > 48) {
+        CHECKIi(i,d,0);
+      } else
+        CHECKIi(i,d,i);
+      i++;
+    }
+    close(fd);
   }
-  close(fd);
 
   unlink(data);
   unlink(format);
diff --git a/test/put_uint32.c b/test/put_uint32.c
index 7d7841a..2f184df 100644
--- a/test/put_uint32.c
+++ b/test/put_uint32.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Attempt to write UINT32 */
 #include "test.h"
 
@@ -11,16 +31,17 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* data = __TEST__ "dirfile/data";
-  const char* format_data = "data RAW UINT32 8\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *data = "dirfile/data";
+  const char *format_data = "data RAW UINT32 8\n";
   uint32_t c[8], d, i;
   struct stat buf;
   int fd, n, error, r = 0;
   DIRFILE *D;
 
   memset(c, 0, 8);
+  rmdirfile();
   mkdir(filedir, 0777);
 
   for (i = 0; i < 8; ++i)
@@ -39,19 +60,20 @@ int main(void)
   if (stat(data, &buf)) {
     perror("stat");
     r = 1;
-  }
-  CHECKI(buf.st_size, 48 * sizeof(uint32_t));
+  } else {
+    CHECKI(buf.st_size, 48 * sizeof(uint32_t));
 
-  fd = open(data, O_RDONLY | O_BINARY);
-  i = 0;
-  while (read(fd, &d, sizeof(uint32_t))) {
-    if (i < 40 || i > 48) {
-      CHECKIi(i,d,0);
-    } else
-      CHECKIi(i,d,i);
-    i++;
+    fd = open(data, O_RDONLY | O_BINARY);
+    i = 0;
+    while (read(fd, &d, sizeof(uint32_t))) {
+      if (i < 40 || i > 48) {
+        CHECKIi(i,d,0);
+      } else
+        CHECKIi(i,d,i);
+      i++;
+    }
+    close(fd);
   }
-  close(fd);
 
   unlink(data);
   unlink(format);
diff --git a/test/put_uint64.c b/test/put_uint64.c
index 2189050..5953e4f 100644
--- a/test/put_uint64.c
+++ b/test/put_uint64.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Attempt to write UINT64 */
 #include "test.h"
 
@@ -11,16 +31,17 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* data = __TEST__ "dirfile/data";
-  const char* format_data = "data RAW UINT64 8\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *data = "dirfile/data";
+  const char *format_data = "data RAW UINT64 8\n";
   uint64_t c[8], d, i;
   struct stat buf;
   int fd, n, error, r = 0;
   DIRFILE *D;
 
   memset(c, 0, 8);
+  rmdirfile();
   mkdir(filedir, 0777);
 
   for (i = 0; i < 8; ++i)
@@ -39,19 +60,20 @@ int main(void)
   if (stat(data, &buf)) {
     perror("stat");
     r = 1;
-  }
-  CHECKI(buf.st_size, 48 * sizeof(uint64_t));
+  } else {
+    CHECKI(buf.st_size, 48 * sizeof(uint64_t));
 
-  fd = open(data, O_RDONLY | O_BINARY);
-  i = 0;
-  while (read(fd, &d, sizeof(uint64_t))) {
-    if (i < 40 || i > 48) {
-      CHECKUi(i,d,0);
-    } else
-      CHECKUi(i,d,i);
-    i++;
+    fd = open(data, O_RDONLY | O_BINARY);
+    i = 0;
+    while (read(fd, &d, sizeof(uint64_t))) {
+      if (i < 40 || i > 48) {
+        CHECKUi(i,d,0);
+      } else
+        CHECKUi(i,d,i);
+      i++;
+    }
+    close(fd);
   }
-  close(fd);
 
   unlink(data);
   unlink(format);
diff --git a/test/put_window.c b/test/put_window.c
new file mode 100644
index 0000000..d158d69
--- /dev/null
+++ b/test/put_window.c
@@ -0,0 +1,71 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+/* Attempt to write WINDOW */
+#include "test.h"
+
+#include <inttypes.h>
+#include <stdlib.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <string.h>
+#include <errno.h>
+
+int main(void)
+{
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *data = "dirfile/data";
+  const char *format_data = "window WINDOW data data EQ 3\ndata RAW INT8 8\n";
+  int8_t c[8];
+  struct stat buf;
+  int fd, i, n, error, r = 0;
+  DIRFILE *D;
+
+  memset(c, 0, 8);
+  rmdirfile();
+  mkdir(filedir, 0777);
+
+  for (i = 0; i < 8; ++i)
+    c[i] = (int8_t)(40 + i);
+
+  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
+  write(fd, format_data, strlen(format_data));
+  close(fd);
+
+  D = gd_open(filedir, GD_RDWR | GD_UNENCODED);
+  n = gd_putdata(D, "window", 5, 0, 1, 0, GD_INT8, c);
+  error = gd_error(D);
+
+  gd_close(D);
+
+  if (!stat(data, &buf)) {
+    perror("stat");
+    r = 1;
+  }
+
+  unlink(format);
+  rmdir(filedir);
+
+  CHECKI(n,0);
+  CHECKI(error,GD_E_BAD_FIELD_TYPE);
+  return r;
+}
diff --git a/test/put_zero.c b/test/put_zero.c
new file mode 100644
index 0000000..e99d71b
--- /dev/null
+++ b/test/put_zero.c
@@ -0,0 +1,60 @@
+/* Copyright (C) 2012 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+#include "test.h"
+
+#include <stdlib.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <string.h>
+#include <stdio.h>
+
+int main(void)
+{
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *data = "dirfile/data";
+  const char *format_data = "data RAW UINT16 8\n";
+  int fd, n, error, r = 0;
+  DIRFILE *D;
+
+  rmdirfile();
+  mkdir(filedir, 0777);
+
+  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
+  write(fd, format_data, strlen(format_data));
+  close(fd);
+
+  D = gd_open(filedir, GD_RDWR | GD_UNENCODED | GD_VERBOSE);
+  n = gd_putdata(D, "data", 0, 0, 0, 0, GD_UINT8, NULL);
+  error = gd_error(D);
+
+  gd_close(D);
+
+  unlink(data);
+  unlink(format);
+  rmdir(filedir);
+
+  CHECKI(n,0);
+  CHECKI(error, 0);
+
+  return r;
+}
diff --git a/test/ref.c b/test/ref.c
index 52549ff..a751ecd 100644
--- a/test/ref.c
+++ b/test/ref.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Parser check */
 #include "test.h"
 
@@ -12,22 +32,23 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* format_data =
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *format_data =
     "data1 RAW UINT8 1\n"
     "data2 RAW UINT8 1\n"
     "REFERENCE data2\n"
     ;
 
-  const char* data1 = __TEST__ "dirfile/data1";
-  const char* data2 = __TEST__ "dirfile/data2";
+  const char *data1 = "dirfile/data1";
+  const char *data2 = "dirfile/data2";
 
   uint8_t data_data[4] = { 0, 1, 2, 3 };
   int fd, error, error2, r = 0;
   DIRFILE *D;
   off_t nf;
 
+  rmdirfile();
   mkdir(filedir, 0777);
 
   fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
diff --git a/test/ref_none.c b/test/ref_none.c
index 0087c16..debe297 100644
--- a/test/ref_none.c
+++ b/test/ref_none.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Parser check */
 #include "test.h"
 
@@ -12,21 +32,22 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* format_data =
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *format_data =
     "data1 RAW UINT8 1\n"
     "data2 RAW UINT8 1\n"
     ;
 
-  const char* data1 = __TEST__ "dirfile/data1";
-  const char* data2 = __TEST__ "dirfile/data2";
+  const char *data1 = "dirfile/data1";
+  const char *data2 = "dirfile/data2";
 
   uint8_t data_data[4] = { 0, 1, 2, 3 };
   int fd, error, error2, r = 0;
   DIRFILE *D;
   off_t nf;
 
+  rmdirfile();
   mkdir(filedir, 0777);
 
   fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
diff --git a/test/ref_two.c b/test/ref_two.c
index 42e352e..00a1116 100644
--- a/test/ref_two.c
+++ b/test/ref_two.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Parser check */
 #include "test.h"
 
@@ -12,23 +32,24 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* format_data =
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *format_data =
     "REFERENCE data1\n"
     "data1 RAW UINT8 1\n"
     "data2 RAW UINT8 1\n"
     "REFERENCE data2\n"
     ;
 
-  const char* data1 = __TEST__ "dirfile/data1";
-  const char* data2 = __TEST__ "dirfile/data2";
+  const char *data1 = "dirfile/data1";
+  const char *data2 = "dirfile/data2";
 
   uint8_t data_data[4] = { 0, 1, 2, 3 };
   int fd, error, error2, r = 0;
   DIRFILE *D;
   off_t nf;
 
+  rmdirfile();
   mkdir(filedir, 0777);
 
   fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
diff --git a/test/repr_a.c b/test/repr_a.c
index 3f5b10c..d8f6f83 100644
--- a/test/repr_a.c
+++ b/test/repr_a.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2009-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Attempt to read argument representation */
 #include "test.h"
 
@@ -12,10 +32,10 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* data = __TEST__ "dirfile/data";
-  const char* format_data = "data RAW COMPLEX128 1\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *data = "dirfile/data";
+  const char *format_data = "data RAW COMPLEX128 1\n";
   double c[8];
 #ifdef GD_NO_C99_API
   double data_data[100][2];
@@ -25,6 +45,7 @@ int main(void)
   int i, n, error, r = 0;
   DIRFILE *D;
 
+  rmdirfile();
   mkdir(filedir, 0777);
 
   for (i = 0; i < 100; ++i) {
diff --git a/test/repr_float32.c b/test/repr_float32.c
index cf41892..54f871b 100644
--- a/test/repr_float32.c
+++ b/test/repr_float32.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2009-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Attempt to read COMPLEX128 as FLOAT32 */
 #include "test.h"
 
@@ -12,10 +32,10 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* data = __TEST__ "dirfile/data";
-  const char* format_data = "data RAW COMPLEX128 8\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *data = "dirfile/data";
+  const char *format_data = "data RAW COMPLEX128 8\n";
 #ifdef GD_NO_C99_API
   double data_data[256][2];
 #else
@@ -26,6 +46,7 @@ int main(void)
   DIRFILE *D;
 
   memset(c, 0, 8);
+  rmdirfile();
   mkdir(filedir, 0777);
 
   for (fd = 0; fd < 256; ++fd) {
diff --git a/test/repr_float64.c b/test/repr_float64.c
index dd85b4d..a7c6f07 100644
--- a/test/repr_float64.c
+++ b/test/repr_float64.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2009-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Attempt to read COMPLEX128 as FLOAT64 */
 #include "test.h"
 
@@ -12,10 +32,10 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* data = __TEST__ "dirfile/data";
-  const char* format_data = "data RAW COMPLEX128 8\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *data = "dirfile/data";
+  const char *format_data = "data RAW COMPLEX128 8\n";
 #ifdef GD_NO_C99_API
   double data_data[256][2];
 #else
@@ -26,6 +46,7 @@ int main(void)
   DIRFILE *D;
 
   memset(c, 0, 8);
+  rmdirfile();
   mkdir(filedir, 0777);
 
   for (fd = 0; fd < 256; ++fd) {
diff --git a/test/repr_i.c b/test/repr_i.c
index 9d3f5d9..4d3e3e8 100644
--- a/test/repr_i.c
+++ b/test/repr_i.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2009-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Attempt to read argument representation */
 #include "test.h"
 
@@ -12,10 +32,10 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* data = __TEST__ "dirfile/data";
-  const char* format_data = "data RAW COMPLEX128 1\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *data = "dirfile/data";
+  const char *format_data = "data RAW COMPLEX128 1\n";
   double c[8];
 #ifdef GD_NO_C99_API
   double data_data[100][2];
@@ -25,6 +45,7 @@ int main(void)
   int i, n, error, r = 0;
   DIRFILE *D;
 
+  rmdirfile();
   mkdir(filedir, 0777);
 
   for (i = 0; i < 100; ++i) {
diff --git a/test/repr_int16.c b/test/repr_int16.c
index 3787809..bbb4972 100644
--- a/test/repr_int16.c
+++ b/test/repr_int16.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2009-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Attempt to read COMPLEX128 as INT16 */
 #include "test.h"
 
@@ -11,10 +31,10 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* data = __TEST__ "dirfile/data";
-  const char* format_data = "data RAW COMPLEX128 8\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *data = "dirfile/data";
+  const char *format_data = "data RAW COMPLEX128 8\n";
 #ifdef GD_NO_C99_API
   double data_data[256][2];
 #else
@@ -25,6 +45,7 @@ int main(void)
   DIRFILE *D;
 
   memset(c, 0, 8);
+  rmdirfile();
   mkdir(filedir, 0777);
 
   for (fd = 0; fd < 256; ++fd) {
diff --git a/test/repr_int32.c b/test/repr_int32.c
index d141f55..0530b60 100644
--- a/test/repr_int32.c
+++ b/test/repr_int32.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2009-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Attempt to read COMPLEX128 as INT32 */
 #include "test.h"
 
@@ -11,10 +31,10 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* data = __TEST__ "dirfile/data";
-  const char* format_data = "data RAW COMPLEX128 8\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *data = "dirfile/data";
+  const char *format_data = "data RAW COMPLEX128 8\n";
 #ifdef GD_NO_C99_API
   double data_data[256][2];
 #else
@@ -25,6 +45,7 @@ int main(void)
   DIRFILE *D;
 
   memset(c, 0, 8);
+  rmdirfile();
   mkdir(filedir, 0777);
 
   for (fd = 0; fd < 256; ++fd) {
diff --git a/test/repr_int64.c b/test/repr_int64.c
index 93c82e0..1a3adfa 100644
--- a/test/repr_int64.c
+++ b/test/repr_int64.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2009-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Attempt to read COMPLEX128 as UINT64 */
 #include "test.h"
 
@@ -11,10 +31,10 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* data = __TEST__ "dirfile/data";
-  const char* format_data = "data RAW COMPLEX128 8\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *data = "dirfile/data";
+  const char *format_data = "data RAW COMPLEX128 8\n";
 #ifdef GD_NO_C99_API
   double data_data[256][2];
 #else
@@ -25,6 +45,7 @@ int main(void)
   DIRFILE *D;
 
   memset(c, 0, 8);
+  rmdirfile();
   mkdir(filedir, 0777);
 
   for (fd = 0; fd < 256; ++fd) {
diff --git a/test/repr_int8.c b/test/repr_int8.c
index 8607cc8..66ee8e8 100644
--- a/test/repr_int8.c
+++ b/test/repr_int8.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2009-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Attempt to read COMPLEX128 as INT8 */
 #include "test.h"
 
@@ -11,10 +31,10 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* data = __TEST__ "dirfile/data";
-  const char* format_data = "data RAW COMPLEX128 8\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *data = "dirfile/data";
+  const char *format_data = "data RAW COMPLEX128 8\n";
 #ifdef GD_NO_C99_API
   double data_data[256][2];
 #else
@@ -25,6 +45,7 @@ int main(void)
   DIRFILE *D;
 
   memset(c, 0, 8);
+  rmdirfile();
   mkdir(filedir, 0777);
 
   for (fd = 0; fd < 256; ++fd) {
diff --git a/test/repr_m.c b/test/repr_m.c
index 36946ae..105d9ce 100644
--- a/test/repr_m.c
+++ b/test/repr_m.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2009-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Attempt to read argument representation */
 #include "test.h"
 
@@ -12,10 +32,10 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* data = __TEST__ "dirfile/data";
-  const char* format_data = "data RAW COMPLEX128 1\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *data = "dirfile/data";
+  const char *format_data = "data RAW COMPLEX128 1\n";
   double c[8];
 #ifdef GD_NO_C99_API
   double data_data[100][2];
@@ -25,6 +45,7 @@ int main(void)
   int i, n, error, r = 0;
   DIRFILE *D;
 
+  rmdirfile();
   mkdir(filedir, 0777);
 
   for (i = 0; i < 100; ++i) {
diff --git a/test/repr_r.c b/test/repr_r.c
index 92a31c6..2ea466d 100644
--- a/test/repr_r.c
+++ b/test/repr_r.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2009-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Attempt to read argument representation */
 #include "test.h"
 
@@ -12,10 +32,10 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* data = __TEST__ "dirfile/data";
-  const char* format_data = "data RAW COMPLEX128 1\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *data = "dirfile/data";
+  const char *format_data = "data RAW COMPLEX128 1\n";
   double c[8];
 #ifdef GD_NO_C99_API
   double data_data[100][2];
@@ -25,6 +45,7 @@ int main(void)
   int i, n, error, r = 0;
   DIRFILE *D;
 
+  rmdirfile();
   mkdir(filedir, 0777);
 
   for (i = 0; i < 100; ++i) {
diff --git a/test/repr_real_a.c b/test/repr_real_a.c
index 9bc5087..3fd9624 100644
--- a/test/repr_real_a.c
+++ b/test/repr_real_a.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2009-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Attempt to read argument representation */
 #include "test.h"
 
@@ -12,15 +32,16 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* data = __TEST__ "dirfile/data";
-  const char* format_data = "data RAW FLOAT64 1\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *data = "dirfile/data";
+  const char *format_data = "data RAW FLOAT64 1\n";
   double c[8];
   double data_data[100];
   int i, n, error, r = 0;
   DIRFILE *D;
 
+  rmdirfile();
   mkdir(filedir, 0777);
 
   for (i = 0; i < 100; ++i)
diff --git a/test/repr_real_i.c b/test/repr_real_i.c
index a150ed0..48aa323 100644
--- a/test/repr_real_i.c
+++ b/test/repr_real_i.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2009-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Attempt to read imaginary representation */
 #include "test.h"
 
@@ -12,15 +32,16 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* data = __TEST__ "dirfile/data";
-  const char* format_data = "data RAW FLOAT64 1\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *data = "dirfile/data";
+  const char *format_data = "data RAW FLOAT64 1\n";
   double c[8];
   double data_data[100];
   int i, n, error, r = 0;
   DIRFILE *D;
 
+  rmdirfile();
   mkdir(filedir, 0777);
 
   for (i = 0; i < 100; ++i)
diff --git a/test/repr_real_m.c b/test/repr_real_m.c
index e441088..a927d9c 100644
--- a/test/repr_real_m.c
+++ b/test/repr_real_m.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2009-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Attempt to read modulus representation */
 #include "test.h"
 
@@ -12,15 +32,16 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* data = __TEST__ "dirfile/data";
-  const char* format_data = "data RAW FLOAT64 1\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *data = "dirfile/data";
+  const char *format_data = "data RAW FLOAT64 1\n";
   double c[8];
   double data_data[100];
   int i, n, error, r = 0;
   DIRFILE *D;
 
+  rmdirfile();
   mkdir(filedir, 0777);
 
   for (i = 0; i < 100; ++i)
diff --git a/test/repr_real_r.c b/test/repr_real_r.c
index 38761d5..1743387 100644
--- a/test/repr_real_r.c
+++ b/test/repr_real_r.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2009-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Attempt to read real representation */
 #include "test.h"
 
@@ -12,15 +32,16 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* data = __TEST__ "dirfile/data";
-  const char* format_data = "data RAW FLOAT64 1\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *data = "dirfile/data";
+  const char *format_data = "data RAW FLOAT64 1\n";
   double c[8];
   double data_data[100];
   int i, n, error, r = 0;
   DIRFILE *D;
 
+  rmdirfile();
   mkdir(filedir, 0777);
 
   for (i = 0; i < 100; ++i)
diff --git a/test/repr_uint16.c b/test/repr_uint16.c
index d8da637..5d2b4f9 100644
--- a/test/repr_uint16.c
+++ b/test/repr_uint16.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2009-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Attempt to read COMPLEX128 as UINT16 */
 #include "test.h"
 
@@ -11,10 +31,10 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* data = __TEST__ "dirfile/data";
-  const char* format_data = "data RAW COMPLEX128 8\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *data = "dirfile/data";
+  const char *format_data = "data RAW COMPLEX128 8\n";
 #ifdef GD_NO_C99_API
   double data_data[256][2];
 #else
@@ -25,6 +45,7 @@ int main(void)
   DIRFILE *D;
 
   memset(c, 0, 8);
+  rmdirfile();
   mkdir(filedir, 0777);
 
   for (fd = 0; fd < 256; ++fd) {
diff --git a/test/repr_uint32.c b/test/repr_uint32.c
index 8c82cfa..9fa0e02 100644
--- a/test/repr_uint32.c
+++ b/test/repr_uint32.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2009-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Attempt to read COMPLEX128 as UINT32 */
 #include "test.h"
 
@@ -11,10 +31,10 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* data = __TEST__ "dirfile/data";
-  const char* format_data = "data RAW COMPLEX128 8\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *data = "dirfile/data";
+  const char *format_data = "data RAW COMPLEX128 8\n";
 #ifdef GD_NO_C99_API
   double data_data[256][2];
 #else
@@ -25,6 +45,7 @@ int main(void)
   DIRFILE *D;
 
   memset(c, 0, 8);
+  rmdirfile();
   mkdir(filedir, 0777);
 
   for (fd = 0; fd < 256; ++fd) {
diff --git a/test/repr_uint64.c b/test/repr_uint64.c
index f5cf421..b4e4a6d 100644
--- a/test/repr_uint64.c
+++ b/test/repr_uint64.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2009-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Attempt to read COMPLEX128 as UINT64 */
 #include "test.h"
 
@@ -11,10 +31,10 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* data = __TEST__ "dirfile/data";
-  const char* format_data = "data RAW COMPLEX128 8\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *data = "dirfile/data";
+  const char *format_data = "data RAW COMPLEX128 8\n";
 #ifdef GD_NO_C99_API
   double data_data[256][2];
 #else
@@ -25,6 +45,7 @@ int main(void)
   DIRFILE *D;
 
   memset(c, 0, 8);
+  rmdirfile();
   mkdir(filedir, 0777);
 
   for (fd = 0; fd < 256; ++fd) {
diff --git a/test/repr_uint8.c b/test/repr_uint8.c
index 8b17a85..66c0727 100644
--- a/test/repr_uint8.c
+++ b/test/repr_uint8.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2009-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Attempt to read COMPLEX128 as UINT8 */
 #include "test.h"
 
@@ -11,10 +31,10 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* data = __TEST__ "dirfile/data";
-  const char* format_data = "data RAW COMPLEX128 8\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *data = "dirfile/data";
+  const char *format_data = "data RAW COMPLEX128 8\n";
 #ifdef GD_NO_C99_API
   double data_data[256][2];
 #else
@@ -25,6 +45,7 @@ int main(void)
   DIRFILE *D;
 
   memset(c, 0, 8);
+  rmdirfile();
   mkdir(filedir, 0777);
 
   for (fd = 0; fd < 256; ++fd) {
diff --git a/test/seek64.c b/test/seek64.c
new file mode 100644
index 0000000..4c4365d
--- /dev/null
+++ b/test/seek64.c
@@ -0,0 +1,76 @@
+/* Copyright (C) 2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+/* gd_seek() */
+#define _LARGEFILE64_SOURCE 1
+
+#include "test.h"
+
+#include <stdlib.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <string.h>
+#include <errno.h>
+
+int main(void)
+{
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *data = "dirfile/data";
+  const char *format_data = "data RAW UINT8 8\n";
+  unsigned char data_data[256];
+  int fd, e1, e2, r = 0;
+  off64_t m, n;
+  DIRFILE *D;
+
+  rmdirfile();
+  mkdir(filedir, 0777);
+
+  for (fd = 0; fd < 256; ++fd)
+    data_data[fd] = (unsigned char)fd;
+
+  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
+  write(fd, format_data, strlen(format_data));
+  close(fd);
+
+  fd = open(data, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
+  write(fd, data_data, 256);
+  close(fd);
+
+  D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
+  m = gd_seek64(D, "data", 6, 0, GD_SEEK_SET);
+  e1 = gd_error(D);
+  n = gd_tell64(D, "data");
+  e2 = gd_error(D);
+
+  gd_close(D);
+
+  unlink(data);
+  unlink(format);
+  rmdir(filedir);
+
+  CHECKI(e1, 0);
+  CHECKI(e2, 0);
+  CHECKI(m, 48);
+  CHECKI(n, 48);
+
+  return r;
+}
diff --git a/test/seek_cur.c b/test/seek_cur.c
new file mode 100644
index 0000000..427ab7d
--- /dev/null
+++ b/test/seek_cur.c
@@ -0,0 +1,75 @@
+/* Copyright (C) 2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+/* gd_seek() */
+#include "test.h"
+
+#include <stdlib.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <string.h>
+#include <errno.h>
+
+int main(void)
+{
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *data = "dirfile/data";
+  const char *format_data = "data RAW UINT8 8\n";
+  unsigned char data_data[256];
+  int fd, e1, e2, r = 0;
+  off_t m, n;
+  DIRFILE *D;
+
+  rmdirfile();
+  mkdir(filedir, 0777);
+
+  for (fd = 0; fd < 256; ++fd)
+    data_data[fd] = (unsigned char)fd;
+
+  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
+  write(fd, format_data, strlen(format_data));
+  close(fd);
+
+  fd = open(data, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
+  write(fd, data_data, 256);
+  close(fd);
+
+  D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
+  gd_seek(D, "data", 6, 0, GD_SEEK_SET);
+  m = gd_seek(D, "data", -3, 0, GD_SEEK_CUR);
+  e1 = gd_error(D);
+  n = gd_tell(D, "data");
+  e2 = gd_error(D);
+
+  gd_close(D);
+
+  unlink(data);
+  unlink(format);
+  rmdir(filedir);
+
+  CHECKI(e1, 0);
+  CHECKI(e2, 0);
+  CHECKI(m, 24);
+  CHECKI(n, 24);
+
+  return r;
+}
diff --git a/test/seek_end.c b/test/seek_end.c
new file mode 100644
index 0000000..b8e8743
--- /dev/null
+++ b/test/seek_end.c
@@ -0,0 +1,74 @@
+/* Copyright (C) 2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+/* gd_seek() */
+#include "test.h"
+
+#include <stdlib.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <string.h>
+#include <errno.h>
+
+int main(void)
+{
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *data = "dirfile/data";
+  const char *format_data = "data RAW UINT8 8\n";
+  unsigned char data_data[256];
+  int fd, e1, e2, r = 0;
+  off_t m, n;
+  DIRFILE *D;
+
+  rmdirfile();
+  mkdir(filedir, 0777);
+
+  for (fd = 0; fd < 256; ++fd)
+    data_data[fd] = (unsigned char)fd;
+
+  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
+  write(fd, format_data, strlen(format_data));
+  close(fd);
+
+  fd = open(data, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
+  write(fd, data_data, 256);
+  close(fd);
+
+  D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
+  m = gd_seek(D, "data", -2, 0, GD_SEEK_END);
+  e1 = gd_error(D);
+  n = gd_tell(D, "data");
+  e2 = gd_error(D);
+
+  gd_close(D);
+
+  unlink(data);
+  unlink(format);
+  rmdir(filedir);
+
+  CHECKI(e1, 0);
+  CHECKI(e2, 0);
+  CHECKI(m, 240);
+  CHECKI(n, 240);
+
+  return r;
+}
diff --git a/test/seek_foffs.c b/test/seek_foffs.c
new file mode 100644
index 0000000..48cf0a2
--- /dev/null
+++ b/test/seek_foffs.c
@@ -0,0 +1,74 @@
+/* Copyright (C) 2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+/* gd_seek() */
+#include "test.h"
+
+#include <stdlib.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <string.h>
+#include <errno.h>
+
+int main(void)
+{
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *data = "dirfile/data";
+  const char *format_data = "data RAW UINT8 8\nFRAMEOFFSET 5\n";
+  unsigned char data_data[256];
+  int fd, e1, e2, r = 0;
+  off_t m, n;
+  DIRFILE *D;
+
+  rmdirfile();
+  mkdir(filedir, 0777);
+
+  for (fd = 0; fd < 256; ++fd)
+    data_data[fd] = (unsigned char)fd;
+
+  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
+  write(fd, format_data, strlen(format_data));
+  close(fd);
+
+  fd = open(data, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
+  write(fd, data_data, 256);
+  close(fd);
+
+  D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
+  m = gd_seek(D, "data", 6, 0, GD_SEEK_SET);
+  e1 = gd_error(D);
+  n = gd_tell(D, "data");
+  e2 = gd_error(D);
+
+  gd_close(D);
+
+  unlink(data);
+  unlink(format);
+  rmdir(filedir);
+
+  CHECKI(e1, 0);
+  CHECKI(e2, 0);
+  CHECKI(m, 48);
+  CHECKI(n, 48);
+
+  return r;
+}
diff --git a/test/seek_neg.c b/test/seek_neg.c
new file mode 100644
index 0000000..4d31067
--- /dev/null
+++ b/test/seek_neg.c
@@ -0,0 +1,70 @@
+/* Copyright (C) 2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+/* gd_seek() */
+#include "test.h"
+
+#include <stdlib.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <string.h>
+#include <errno.h>
+
+int main(void)
+{
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *data = "dirfile/data";
+  const char *format_data = "data RAW UINT8 8\n";
+  unsigned char data_data[256];
+  int fd, e1, r = 0;
+  off_t m;
+  DIRFILE *D;
+
+  rmdirfile();
+  mkdir(filedir, 0777);
+
+  for (fd = 0; fd < 256; ++fd)
+    data_data[fd] = (unsigned char)fd;
+
+  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
+  write(fd, format_data, strlen(format_data));
+  close(fd);
+
+  fd = open(data, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
+  write(fd, data_data, 256);
+  close(fd);
+
+  D = gd_open(filedir, GD_RDONLY);
+  m = gd_seek(D, "data", -3, 0, GD_SEEK_CUR);
+  e1 = gd_error(D);
+
+  gd_close(D);
+
+  unlink(data);
+  unlink(format);
+  rmdir(filedir);
+
+  CHECKI(e1, GD_E_RANGE);
+  CHECKI(m, -1);
+
+  return r;
+}
diff --git a/test/seek_set.c b/test/seek_set.c
new file mode 100644
index 0000000..4c7158e
--- /dev/null
+++ b/test/seek_set.c
@@ -0,0 +1,74 @@
+/* Copyright (C) 2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+/* gd_seek() */
+#include "test.h"
+
+#include <stdlib.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <string.h>
+#include <errno.h>
+
+int main(void)
+{
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *data = "dirfile/data";
+  const char *format_data = "data RAW UINT8 8\n";
+  unsigned char data_data[256];
+  int fd, e1, e2, r = 0;
+  off_t m, n;
+  DIRFILE *D;
+
+  rmdirfile();
+  mkdir(filedir, 0777);
+
+  for (fd = 0; fd < 256; ++fd)
+    data_data[fd] = (unsigned char)fd;
+
+  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
+  write(fd, format_data, strlen(format_data));
+  close(fd);
+
+  fd = open(data, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
+  write(fd, data_data, 256);
+  close(fd);
+
+  D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
+  m = gd_seek(D, "data", 6, 0, GD_SEEK_SET);
+  e1 = gd_error(D);
+  n = gd_tell(D, "data");
+  e2 = gd_error(D);
+
+  gd_close(D);
+
+  unlink(data);
+  unlink(format);
+  rmdir(filedir);
+
+  CHECKI(e1, 0);
+  CHECKI(e2, 0);
+  CHECKI(m, 48);
+  CHECKI(n, 48);
+
+  return r;
+}
diff --git a/test/sie_get_big.c b/test/sie_get_big.c
new file mode 100644
index 0000000..1671a86
--- /dev/null
+++ b/test/sie_get_big.c
@@ -0,0 +1,68 @@
+/* Copyright (C) 2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+/* Attempt to read big-endian SIE data */
+#include "test.h"
+
+#include <stdlib.h>
+
+int main(void)
+{
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *data = "dirfile/data.sie";
+  const char *format_data = "data RAW UINT8 8\n/ENCODING sie\n/ENDIAN big\n";
+  unsigned char c[16];
+  const uint8_t data_data[] = {
+    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x12,
+    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x22,
+    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x32
+  };
+  DIRFILE *D;
+  int fd, i, n, error, r = 0;
+
+  rmdirfile();
+  mkdir(filedir, 0777); 
+
+  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
+  write(fd, format_data, strlen(format_data));
+  close(fd);
+
+  fd = open(data, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
+  write(fd, data_data, 3 * 9 * sizeof(unsigned char));
+  close(fd);
+
+  D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
+  n = gd_getdata(D, "data", 3, 0, 2, 0, GD_UINT8, c);
+  error = gd_error(D);
+
+  gd_close(D);
+
+  unlink(data);
+  unlink(format);
+  rmdir(filedir);
+
+  CHECKI(error, 0);
+  CHECKI(n, 16);
+  for (i = 0; i < 16; ++i)
+    CHECKIi(i,c[i], (i <= 8) ? 0x22 : 0x32);
+
+  return r;
+}
diff --git a/test/sie_get_little.c b/test/sie_get_little.c
new file mode 100644
index 0000000..bc83c48
--- /dev/null
+++ b/test/sie_get_little.c
@@ -0,0 +1,68 @@
+/* Copyright (C) 2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+/* Attempt to read little-endian SIE data */
+#include "test.h"
+
+#include <stdlib.h>
+
+int main(void)
+{
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *data = "dirfile/data.sie";
+  const char *format_data = "data RAW UINT8 8\n/ENCODING sie\n/ENDIAN little\n";
+  unsigned char c[16];
+  const uint8_t data_data[] = {
+    0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x12,
+    0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x22,
+    0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x32
+  };
+  DIRFILE *D;
+  int fd, i, n, error, r = 0;
+
+  rmdirfile();
+  mkdir(filedir, 0777); 
+
+  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
+  write(fd, format_data, strlen(format_data));
+  close(fd);
+
+  fd = open(data, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
+  write(fd, data_data, 3 * 9 * sizeof(unsigned char));
+  close(fd);
+
+  D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
+  n = gd_getdata(D, "data", 3, 0, 2, 0, GD_UINT8, c);
+  error = gd_error(D);
+
+  gd_close(D);
+
+  unlink(data);
+  unlink(format);
+  rmdir(filedir);
+
+  CHECKI(error, 0);
+  CHECKI(n, 16);
+  for (i = 0; i < 16; ++i)
+    CHECKIi(i,c[i], (i <= 8) ? 0x22 : 0x32);
+
+  return r;
+}
diff --git a/test/sie_move_from.c b/test/sie_move_from.c
new file mode 100644
index 0000000..7e61aec
--- /dev/null
+++ b/test/sie_move_from.c
@@ -0,0 +1,84 @@
+/* Copyright (C) 2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+/* Attempt to decompress an SIE file */
+#include "test.h"
+
+#include <stdlib.h>
+
+int main(void)
+{
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *data_sie = "dirfile/data.sie";
+  const char *data_raw = "dirfile/data";
+  const char *format_data = "data RAW UINT8 8\n/ENCODING sie\n/ENDIAN little\n";
+  uint8_t check[0x31];
+  const uint8_t data_in[] = {
+    0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x12,
+    0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x22,
+    0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x32
+  };
+  const uint8_t data_out[] = {
+    0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12,
+    0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12,
+    0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22,
+    0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22,
+    0x32, 0x32, 0x32, 0x32, 0x32, 0x32, 0x32, 0x32,
+    0x32, 0x32, 0x32, 0x32, 0x32, 0x32, 0x32, 0x32
+  };
+  DIRFILE *D;
+  int fd, i, error, r = 0, unlink_data_sie, unlink_data_raw;
+
+  rmdirfile();
+  mkdir(filedir, 0777); 
+
+  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
+  write(fd, format_data, strlen(format_data));
+  close(fd);
+
+  fd = open(data_sie, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
+  write(fd, data_in, 3 * 9 * sizeof(unsigned char));
+  close(fd);
+
+  D = gd_open(filedir, GD_RDWR | GD_VERBOSE);
+  gd_alter_encoding(D, GD_UNENCODED, 0, 1);
+  error = gd_error(D);
+
+  gd_close(D);
+
+  fd = open(data_raw, O_RDONLY | O_BINARY);
+  read(fd, check, 0x31);
+  close(fd);
+
+  unlink_data_sie = unlink(data_sie);
+  unlink_data_raw = unlink(data_raw);
+  unlink(format);
+  rmdir(filedir);
+
+  CHECKI(error, 0);
+  CHECKI(unlink_data_sie, -1);
+  CHECKI(unlink_data_raw, 0);
+
+  for (i = 0; i < 0x31; ++i)
+    CHECKUi(i, check[i], data_out[i]);
+
+  return r;
+}
diff --git a/test/sie_move_to.c b/test/sie_move_to.c
new file mode 100644
index 0000000..738b514
--- /dev/null
+++ b/test/sie_move_to.c
@@ -0,0 +1,84 @@
+/* Copyright (C) 2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+/* Attempt to compress an SIE file */
+#include "test.h"
+
+#include <stdlib.h>
+
+int main(void)
+{
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *data_sie = "dirfile/data.sie";
+  const char *data_raw = "dirfile/data";
+  const char *format_data = "data RAW UINT8 8\n/ENCODING none\n/ENDIAN little\n";
+  uint8_t check[27];
+  const uint8_t data_out[] = {
+    0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x12,
+    0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x22,
+    0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x32
+  };
+  const uint8_t data_in[] = {
+    0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12,
+    0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12,
+    0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22,
+    0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22,
+    0x32, 0x32, 0x32, 0x32, 0x32, 0x32, 0x32, 0x32,
+    0x32, 0x32, 0x32, 0x32, 0x32, 0x32, 0x32, 0x32
+  };
+  DIRFILE *D;
+  int fd, i, error, r = 0, unlink_data_sie, unlink_data_raw;
+
+  rmdirfile();
+  mkdir(filedir, 0777); 
+
+  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
+  write(fd, format_data, strlen(format_data));
+  close(fd);
+
+  fd = open(data_raw, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
+  write(fd, data_in, 0x31 * sizeof(unsigned char));
+  close(fd);
+
+  D = gd_open(filedir, GD_RDWR | GD_VERBOSE);
+  gd_alter_encoding(D, GD_SIE_ENCODED, 0, 1);
+  error = gd_error(D);
+
+  gd_close(D);
+
+  fd = open(data_sie, O_RDONLY | O_BINARY);
+  read(fd, check, 27);
+  close(fd);
+
+  unlink_data_sie = unlink(data_sie);
+  unlink_data_raw = unlink(data_raw);
+  unlink(format);
+  rmdir(filedir);
+
+  CHECKI(error, 0);
+  CHECKI(unlink_data_sie, 0);
+  CHECKI(unlink_data_raw, -1);
+
+  for (i = 0; i < 27; ++i)
+    CHECKUi(i, check[i], data_out[i]);
+
+  return r;
+}
diff --git a/test/sie_nframes_big.c b/test/sie_nframes_big.c
new file mode 100644
index 0000000..8c6026a
--- /dev/null
+++ b/test/sie_nframes_big.c
@@ -0,0 +1,62 @@
+/* Copyright (C) 2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+/* Attempt to read little-endian SIE data */
+#include "test.h"
+
+#include <stdlib.h>
+
+int main(void)
+{
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *data = "dirfile/data.sie";
+  const char *format_data = "data RAW UINT8 8\n/ENCODING sie\n/ENDIAN big\n";
+  const uint8_t data_data[] = {
+    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x12,
+    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x22,
+    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x32
+  };
+  DIRFILE *D;
+  off_t n;
+  int fd, error, r = 0;
+
+  rmdirfile();
+  mkdir(filedir, 0777); 
+
+  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
+  write(fd, format_data, strlen(format_data));
+  close(fd);
+
+  fd = open(data, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
+  write(fd, data_data, 9 * 3 * sizeof(uint8_t));
+  close(fd);
+
+  D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
+  n = gd_nframes(D);
+  error = gd_error(D);
+
+  gd_close(D);
+
+  CHECKI(error, 0);
+  CHECKI(n, 6);
+
+  return r;
+}
diff --git a/test/sie_nframes_little.c b/test/sie_nframes_little.c
new file mode 100644
index 0000000..1e8ea0e
--- /dev/null
+++ b/test/sie_nframes_little.c
@@ -0,0 +1,62 @@
+/* Copyright (C) 2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+/* Attempt to read little-endian SIE data */
+#include "test.h"
+
+#include <stdlib.h>
+
+int main(void)
+{
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *data = "dirfile/data.sie";
+  const char *format_data = "data RAW UINT8 8\n/ENCODING sie\n/ENDIAN little\n";
+  const uint8_t data_data[] = {
+    0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x12,
+    0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x22,
+    0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x32
+  };
+  DIRFILE *D;
+  off_t n;
+  int fd, error, r = 0;
+
+  rmdirfile();
+  mkdir(filedir, 0777); 
+
+  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
+  write(fd, format_data, strlen(format_data));
+  close(fd);
+
+  fd = open(data, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
+  write(fd, data_data, 9 * 3 * sizeof(uint8_t));
+  close(fd);
+
+  D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
+  n = gd_nframes(D);
+  error = gd_error(D);
+
+  gd_close(D);
+
+  CHECKI(error, 0);
+  CHECKI(n, 6);
+
+  return r;
+}
diff --git a/test/sie_put_big.c b/test/sie_put_big.c
new file mode 100644
index 0000000..b9018f9
--- /dev/null
+++ b/test/sie_put_big.c
@@ -0,0 +1,83 @@
+/* Copyright (C) 2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+/* Attempt to write little-endian SIE data */
+#include "test.h"
+
+#include <stdlib.h>
+
+int main(void)
+{
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *data = "dirfile/data.sie";
+  const char *format_data = "data RAW UINT8 8\n/ENCODING sie\n/ENDIAN big\n";
+  unsigned char c[16] = {
+    0x23, 0x23, 0x23, 0x34, 0x34, 0x34, 0x34, 0x34,
+    0x34, 0x34, 0x34, 0x34, 0x34, 0x34, 0x34, 0x34
+  };
+  const uint8_t data_data[] = {
+    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x12,
+    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x22,
+    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x32
+  };
+  const uint8_t data_out[] = {
+    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x12,
+    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x13, 0x23,
+    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x34,
+    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x32
+  };
+  uint8_t check[4 * 9];
+  DIRFILE *D;
+  int fd, i, n, error, r = 0;
+
+  rmdirfile();
+  mkdir(filedir, 0777); 
+
+  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
+  write(fd, format_data, strlen(format_data));
+  close(fd);
+
+  fd = open(data, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
+  write(fd, data_data, 3 * 9 * sizeof(unsigned char));
+  close(fd);
+
+  D = gd_open(filedir, GD_RDWR | GD_VERBOSE);
+  n = gd_putdata(D, "data", 0, 0x11, 2, 0, GD_UINT8, c);
+  error = gd_error(D);
+
+  gd_close(D);
+
+  fd = open(data, O_RDONLY | O_BINARY);
+  read(fd, check, 4 * 9);
+  close(fd);
+
+  unlink(data);
+  unlink(format);
+  rmdir(filedir);
+
+  CHECKI(error, 0);
+  CHECKI(n, 16);
+
+  for (i = 0; i < 4 * 9; ++i)
+    CHECKIi(i, check[i], data_out[i]);
+
+  return r;
+}
diff --git a/test/sie_put_little.c b/test/sie_put_little.c
new file mode 100644
index 0000000..c6bc389
--- /dev/null
+++ b/test/sie_put_little.c
@@ -0,0 +1,83 @@
+/* Copyright (C) 2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+/* Attempt to write little-endian SIE data */
+#include "test.h"
+
+#include <stdlib.h>
+
+int main(void)
+{
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *data = "dirfile/data.sie";
+  const char *format_data = "data RAW UINT8 8\n/ENCODING sie\n/ENDIAN little\n";
+  unsigned char c[16] = {
+    0x22, 0x22, 0x22, 0x34, 0x34, 0x34, 0x34, 0x34,
+    0x34, 0x34, 0x34, 0x34, 0x34, 0x34, 0x34, 0x34
+  };
+  const uint8_t data_data[] = {
+    0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x12,
+    0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x22,
+    0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x32
+  };
+  const uint8_t data_out[] = {
+    0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x12,
+    0x1A, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x22,
+    0x27, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x34,
+    0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x32
+  };
+  uint8_t check[4 * 9];
+  DIRFILE *D;
+  int fd, i, n, error, r = 0;
+
+  rmdirfile();
+  mkdir(filedir, 0777); 
+
+  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
+  write(fd, format_data, strlen(format_data));
+  close(fd);
+
+  fd = open(data, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
+  write(fd, data_data, 3 * 9 * sizeof(unsigned char));
+  close(fd);
+
+  D = gd_open(filedir, GD_RDWR | GD_VERBOSE);
+  n = gd_putdata(D, "data", 3, 0, 2, 0, GD_UINT8, c);
+  error = gd_error(D);
+
+  gd_close(D);
+
+  fd = open(data, O_RDONLY | O_BINARY);
+  read(fd, check, 4 * 9);
+  close(fd);
+
+  unlink(data);
+  unlink(format);
+  rmdir(filedir);
+
+  CHECKI(error, 0);
+  CHECKI(n, 16);
+
+  for (i = 0; i < 4 * 9; ++i)
+    CHECKIi(i, check[i], data_out[i]);
+
+  return r;
+}
diff --git a/test/slim_get.c b/test/slim_get.c
index 89b5c8d..95adca3 100644
--- a/test/slim_get.c
+++ b/test/slim_get.c
@@ -1,5 +1,24 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Attempt to read UINT8 */
-#include "../src/config.h"
 #include "test.h"
 
 #include <inttypes.h>
@@ -16,11 +35,11 @@ int main(void)
 #ifndef TEST_SLIM
   return 77;
 #else
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* data = __TEST__ "dirfile/data";
-  const char* slimdata = __TEST__ "dirfile/data.slm";
-  const char* format_data = "data RAW UINT16 8\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *data = "dirfile/data";
+  const char *slimdata = "dirfile/data.slm";
+  const char *format_data = "data RAW UINT16 8\n";
   uint16_t c[8];
   char command[4096];
   uint16_t data_data[256];
@@ -28,6 +47,7 @@ int main(void)
   DIRFILE *D;
 
   memset(c, 0, 8);
+  rmdirfile();
   mkdir(filedir, 0777);
 
   for (fd = 0; fd < 256; ++fd)
diff --git a/test/slim_nframes.c b/test/slim_nframes.c
index ff71644..388e187 100644
--- a/test/slim_nframes.c
+++ b/test/slim_nframes.c
@@ -1,5 +1,24 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Retreiving the number of frames should succeed cleanly */
-#include "../src/config.h"
 #include "test.h"
 
 #include <stdlib.h>
@@ -15,17 +34,18 @@ int main(void)
 #ifndef TEST_SLIM
   return 77;
 #else
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* data = __TEST__ "dirfile/data";
-  const char* slimdata = __TEST__ "dirfile/data.slm";
-  const char* format_data = "data RAW UINT16 1\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *data = "dirfile/data";
+  const char *slimdata = "dirfile/data.slm";
+  const char *format_data = "data RAW UINT16 1\n";
   char command[4096];
   uint16_t data_data[256];
   int i, error, r = 0;
   size_t n;
   DIRFILE *D;
 
+  rmdirfile();
   mkdir(filedir, 0777);
 
   for (i = 0; i < 256; ++i)
@@ -49,7 +69,7 @@ int main(void)
 #ifdef USE_SLIM
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
 #else
-  * D = gd_open(filedir, GD_RDONLY);
+  D = gd_open(filedir, GD_RDONLY);
 #endif
   n = gd_nframes(D);
   error = gd_error(D);
diff --git a/test/spf.c b/test/spf.c
index d141ecd..127314e 100644
--- a/test/spf.c
+++ b/test/spf.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Retreiving the samples-per-frame of a field should succeed cleanly */
 #include "test.h"
 
@@ -10,13 +30,14 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* format_data = "data RAW UINT8 11\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *format_data = "data RAW UINT8 11\n";
   int fd, error, r = 0;
-  gd_spf_t spf;
+  unsigned int spf;
   DIRFILE *D;
 
+  rmdirfile();
   mkdir(filedir, 0777);
 
   fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
diff --git a/test/spf_alias.c b/test/spf_alias.c
new file mode 100644
index 0000000..d3c5121
--- /dev/null
+++ b/test/spf_alias.c
@@ -0,0 +1,50 @@
+/* Copyright (C) 2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+#include "test.h"
+
+int main(void)
+{
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *format_data = "data RAW UINT8 11\n/ALIAS alias data\n";
+  int fd, error, r = 0;
+  unsigned int spf;
+  DIRFILE *D;
+
+  rmdirfile();
+  mkdir(filedir, 0777);
+
+  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
+  write(fd, format_data, strlen(format_data));
+  close(fd);
+
+  D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
+  spf = gd_spf(D, "alias");
+  error = gd_error(D);
+  gd_close(D);
+
+  unlink(format);
+  rmdir(filedir);
+
+  CHECKI(error,0);
+  CHECKI(spf,11);
+  return r;
+}
diff --git a/test/spf_alias_meta.c b/test/spf_alias_meta.c
new file mode 100644
index 0000000..f8620ba
--- /dev/null
+++ b/test/spf_alias_meta.c
@@ -0,0 +1,53 @@
+/* Copyright (C) 2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+#include "test.h"
+
+int main(void)
+{
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *format_data =
+    "data RAW UINT8 11\n"
+    "data/sub PHASE data 0\n"
+    "/ALIAS alias data\n";
+  int fd, error, r = 0;
+  unsigned int spf;
+  DIRFILE *D;
+
+  rmdirfile();
+  mkdir(filedir, 0777);
+
+  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
+  write(fd, format_data, strlen(format_data));
+  close(fd);
+
+  D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
+  spf = gd_spf(D, "alias/sub");
+  error = gd_error(D);
+  gd_close(D);
+
+  unlink(format);
+  rmdir(filedir);
+
+  CHECKI(error,0);
+  CHECKI(spf,11);
+  return r;
+}
diff --git a/test/spf_alias_missing.c b/test/spf_alias_missing.c
new file mode 100644
index 0000000..53620cf
--- /dev/null
+++ b/test/spf_alias_missing.c
@@ -0,0 +1,50 @@
+/* Copyright (C) 2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+#include "test.h"
+
+int main(void)
+{
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *format_data = "/ALIAS alias data\n";
+  int fd, error, r = 0;
+  unsigned int spf;
+  DIRFILE *D;
+
+  rmdirfile();
+  mkdir(filedir, 0777);
+
+  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
+  write(fd, format_data, strlen(format_data));
+  close(fd);
+
+  D = gd_open(filedir, GD_RDONLY);
+  spf = gd_spf(D, "alias");
+  error = gd_error(D);
+  gd_close(D);
+
+  unlink(format);
+  rmdir(filedir);
+
+  CHECKI(error,GD_E_BAD_CODE);
+  CHECKI(spf,0);
+  return r;
+}
diff --git a/test/spf_divide.c b/test/spf_divide.c
index be43475..562d993 100644
--- a/test/spf_divide.c
+++ b/test/spf_divide.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2010-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 #include "test.h"
 
 #include <stdlib.h>
@@ -9,16 +29,17 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* format_data =
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *format_data =
     "in1 RAW UINT8 11\n"
     "in2 RAW UINT8 13\n"
     "div DIVIDE in1 in2\n";
   int fd, r = 0;
   DIRFILE *D;
-  gd_spf_t spf;
+  unsigned int spf;
 
+  rmdirfile();
   mkdir(filedir, 0777);
 
   fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
diff --git a/test/spf_lincom.c b/test/spf_lincom.c
index 4840671..bc59139 100644
--- a/test/spf_lincom.c
+++ b/test/spf_lincom.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* The SPF of a lincom should equal the SPF of the first field */
 #include "test.h"
 
@@ -10,16 +30,17 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* format_data =
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *format_data =
     "in1 RAW UINT8 11\n"
     "in2 RAW UINT8 13\n"
     "lincom LINCOM 2 in1 1 0 in2 1 0\n";
   int fd, r = 0;
-  gd_spf_t spf;
+  unsigned int spf;
   DIRFILE *D;
 
+  rmdirfile();
   mkdir(filedir, 0777);
 
   fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
diff --git a/test/spf_multiply.c b/test/spf_multiply.c
index 9579a81..8f24821 100644
--- a/test/spf_multiply.c
+++ b/test/spf_multiply.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* The SPF of a MULTIPLY should equal the SPF of the first field */
 #include "test.h"
 
@@ -10,16 +30,17 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* format_data =
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *format_data =
     "in1 RAW UINT8 11\n"
     "in2 RAW UINT8 13\n"
     "lincom MULTIPLY in1 in2\n";
   int fd, r = 0;
-  gd_spf_t spf;
+  unsigned int spf;
   DIRFILE *D;
 
+  rmdirfile();
   mkdir(filedir, 0777);
 
   fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
diff --git a/test/spf_polynom.c b/test/spf_polynom.c
index dc38bea..80018ac 100644
--- a/test/spf_polynom.c
+++ b/test/spf_polynom.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2009-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* The SPF of a polynom should equal the SPF of its input field */
 #include "test.h"
 
@@ -10,15 +30,16 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* format_data =
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *format_data =
     "in RAW UINT8 11\n"
     "polynom POLYNOM in 1 2 1 3\n";
   int fd, r = 0;
-  gd_spf_t spf;
+  unsigned int spf;
   DIRFILE *D;
 
+  rmdirfile();
   mkdir(filedir, 0777);
 
   fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
diff --git a/test/spf_recip.c b/test/spf_recip.c
index 412aadb..b896d83 100644
--- a/test/spf_recip.c
+++ b/test/spf_recip.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2010-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 #include "test.h"
 
 #include <stdlib.h>
@@ -9,15 +29,16 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* format_data =
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *format_data =
     "in2 RAW UINT8 13\n"
     "div RECIP in2 3.\n";
   int fd, r = 0;
-  gd_spf_t spf;
+  unsigned int spf;
   DIRFILE *D;
 
+  rmdirfile();
   mkdir(filedir, 0777);
 
   fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
diff --git a/test/spf_recurse.c b/test/spf_recurse.c
index 4d37f2f..ee4872f 100644
--- a/test/spf_recurse.c
+++ b/test/spf_recurse.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Attempting to resove a recursively defined field should fail cleanly */
 #include "test.h"
 
@@ -10,15 +30,16 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* format_data =
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *format_data =
     "in1 RAW UINT8 11\n"
     "lincom LINCOM 2 lincom 1 0 in1 1 0\n";
   int fd, error, r = 0;
-  gd_spf_t spf;
+  unsigned int spf;
   DIRFILE *D;
 
+  rmdirfile();
   mkdir(filedir, 0777);
 
   fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
diff --git a/test/svlist.c b/test/svlist.c
index c5566d7..1ec5039 100644
--- a/test/svlist.c
+++ b/test/svlist.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Retreiving the number of fields of a field should succeed cleanly */
 #include "test.h"
 
@@ -11,9 +31,9 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* format_data =
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *format_data =
     "data1 STRING valu1\n"
     "data2 STRING valu2\n"
     "data3 STRING valu3\n"
@@ -22,6 +42,7 @@ int main(void)
   const char **field_list;
   DIRFILE *D;
 
+  rmdirfile();
   mkdir(filedir, 0777);
 
   fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
diff --git a/test/svlist_hidden.c b/test/svlist_hidden.c
new file mode 100644
index 0000000..98f53ed
--- /dev/null
+++ b/test/svlist_hidden.c
@@ -0,0 +1,73 @@
+/* Copyright (C) 2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+#include "test.h"
+
+int main(void)
+{
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *format_data =
+    "data1 STRING valu1\n"
+    "data2 STRING valu2\n"
+    "/HIDDEN data2\n"
+    "data3 STRING valu3\n"
+    "data4 CONST UINT8 1\n";
+  int fd, i, error, r = 0;
+  const char **field_list;
+  DIRFILE *D;
+
+  rmdirfile();
+  mkdir(filedir, 0777);
+
+  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
+  write(fd, format_data, strlen(format_data));
+  close(fd);
+
+  D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
+  field_list = gd_strings(D);
+
+  error = gd_error(D);
+  CHECKI(error, 0);
+  CHECKPN(field_list);
+
+  for (i = 0; field_list[i]; ++i) {
+    int len = strlen(field_list[i]);
+    CHECKIi(i,len,5);
+
+    CHECKIi(i,field_list[i][0], 'v');
+    CHECKIi(i,field_list[i][1], 'a');
+    CHECKIi(i,field_list[i][2], 'l');
+    CHECKIi(i,field_list[i][3], 'u');
+
+    if (field_list[i][4] != '1' && field_list[i][4] != '3') {
+      fprintf(stderr, "field_list[%i] = \"%s\"\n", i, field_list[i]);
+      r = 1;
+    }
+  }
+
+  CHECKI(i,2);
+
+  gd_close(D);
+  unlink(format);
+  rmdir(filedir);
+
+  return r;
+}
diff --git a/test/svlist_invalid.c b/test/svlist_invalid.c
index b51bcbe..4e70717 100644
--- a/test/svlist_invalid.c
+++ b/test/svlist_invalid.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Requesting the number of fields from an invalid dirfile should fail cleanly */
 #include "test.h"
 
@@ -9,12 +29,15 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  int r = 0;
+  const char *filedir = "dirfile";
+  int error, r = 0;
+  DIRFILE *D;
+  const char **fl;
 
-  DIRFILE* D = gd_open(filedir, GD_RDONLY);
-  const char** fl = gd_strings(D);
-  int error = gd_error(D);
+  rmdirfile();
+  D = gd_open(filedir, GD_RDONLY);
+  fl = gd_strings(D);
+  error = gd_error(D);
   gd_close(D);
 
   CHECKP(fl);
diff --git a/test/svlist_meta.c b/test/svlist_meta.c
index bf9f375..3ad1484 100644
--- a/test/svlist_meta.c
+++ b/test/svlist_meta.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Retrieve a list of string metafields */
 #include "test.h"
 
@@ -11,9 +31,9 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* format_data =
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *format_data =
     "parent STRING valu1\n"
     "META parent data1 STRING valu1\n"
     "META parent data2 STRING valu2\n"
@@ -23,6 +43,7 @@ int main(void)
   const char **field_list;
   DIRFILE *D;
 
+  rmdirfile();
   mkdir(filedir, 0777);
 
   fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
diff --git a/test/svlist_meta_hidden.c b/test/svlist_meta_hidden.c
new file mode 100644
index 0000000..94bcacd
--- /dev/null
+++ b/test/svlist_meta_hidden.c
@@ -0,0 +1,77 @@
+/* Copyright (C) 2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+#include "test.h"
+
+int main(void)
+{
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *format_data =
+    "parent STRING valu1\n"
+    "META parent data1 STRING valu1\n"
+    "META parent data2 STRING valu2\n"
+    "/HIDDEN parent/data2\n"
+    "META parent data3 STRING valu3\n"
+    "META parent data4 CONST UINT8 1\n";
+  int fd, i, error, r = 0;
+  const char **field_list;
+  DIRFILE *D;
+
+  rmdirfile();
+  mkdir(filedir, 0777);
+
+  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
+  write(fd, format_data, strlen(format_data));
+  close(fd);
+
+  D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
+  gd_nfields(D);
+  gd_nmfields(D, "parent");
+  gd_nmfields_by_type(D, "parent", GD_STRING_ENTRY);
+  field_list = gd_mstrings(D, "parent");
+
+  error = gd_error(D);
+  CHECKI(error, 0);
+  CHECKPN(field_list);
+
+  for (i = 0; field_list[i]; ++i) {
+    int len = strlen(field_list[i]);
+    CHECKIi(i,len,5);
+
+    CHECKIi(i,field_list[i][0], 'v');
+    CHECKIi(i,field_list[i][1], 'a');
+    CHECKIi(i,field_list[i][2], 'l');
+    CHECKIi(i,field_list[i][3], 'u');
+
+    if (field_list[i][4] != '1' && field_list[i][4] != '3') {
+      fprintf(stderr, "field_list[%i] = \"%s\"\n", i, field_list[i]);
+      r = 1;
+    }
+  }
+
+  CHECKI(i,2);
+
+  gd_close(D);
+  unlink(format);
+  rmdir(filedir);
+
+  return r;
+}
diff --git a/test/svlist_meta_invalid.c b/test/svlist_meta_invalid.c
index 0ee4c9f..30fc116 100644
--- a/test/svlist_meta_invalid.c
+++ b/test/svlist_meta_invalid.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Requesting the number of fields from an invalid dirfile should fail cleanly */
 #include "test.h"
 
@@ -9,12 +29,15 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  int r = 0;
+  const char *filedir = "dirfile";
+  int error, r = 0;
+  DIRFILE *D;
+  const char **fl;
 
-  DIRFILE* D = gd_open(filedir, GD_RDONLY);
-  const char** fl = gd_mstrings(D, "parent");
-  int error = gd_error(D);
+  rmdirfile();
+  D = gd_open(filedir, GD_RDONLY);
+  fl = gd_mstrings(D, "parent");
+  error = gd_error(D);
   gd_close(D);
 
   CHECKP(fl);
diff --git a/test/table.c b/test/table.c
new file mode 100644
index 0000000..5d25843
--- /dev/null
+++ b/test/table.c
@@ -0,0 +1,67 @@
+/* Copyright (C) 2012 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+#include "test.h"
+
+#include <stdlib.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <string.h>
+#include <errno.h>
+
+int main(void)
+{
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *format_data = "linterp LINTERP INDEX table\n";
+  int fd, error, r = 0;
+  char *path;
+  DIRFILE *D;
+
+  rmdirfile();
+  mkdir(filedir, 0777);
+
+  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
+  write(fd, format_data, strlen(format_data));
+  close(fd);
+
+  D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
+  path = gd_linterp_tablename(D, "linterp");
+  error = gd_error(D);
+
+  gd_close(D);
+
+  unlink(format);
+  rmdir(filedir);
+
+  CHECKI(error, 0);
+  /* This only checks whether the end of the returned path is what we expect.
+   * This should work, since we can guarantee that both "dirfile" and "data"
+   * aren't symlinks. */
+#if GD_DIRSEP == '/'
+  CHECKEOS(path,"dirfile/table");
+#else
+  CHECKEOS(path,"dirfile\\table");
+#endif
+  free(path);
+
+  return r;
+}
diff --git a/test/table_code.c b/test/table_code.c
new file mode 100644
index 0000000..0121fa0
--- /dev/null
+++ b/test/table_code.c
@@ -0,0 +1,59 @@
+/* Copyright (C) 2012 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+#include "test.h"
+
+#include <stdlib.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <string.h>
+#include <errno.h>
+
+int main(void)
+{
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *format_data = "linterp LINTERP INDEX table\n";
+  int fd, error, r = 0;
+  const char *path;
+  DIRFILE *D;
+
+  rmdirfile();
+  mkdir(filedir, 0777);
+
+  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
+  write(fd, format_data, strlen(format_data));
+  close(fd);
+
+  D = gd_open(filedir, GD_RDONLY);
+  path = gd_linterp_tablename(D, "bata");
+  error = gd_error(D);
+
+  gd_close(D);
+
+  unlink(format);
+  rmdir(filedir);
+
+  CHECKI(error, GD_E_BAD_CODE);
+  CHECKP(path);
+
+  return r;
+}
diff --git a/test/table_type.c b/test/table_type.c
new file mode 100644
index 0000000..4d4bc2f
--- /dev/null
+++ b/test/table_type.c
@@ -0,0 +1,59 @@
+/* Copyright (C) 2012 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+#include "test.h"
+
+#include <stdlib.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <string.h>
+#include <errno.h>
+
+int main(void)
+{
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *format_data = "data CONST UINT8 8\n";
+  int fd, error, r = 0;
+  const char *path;
+  DIRFILE *D;
+
+  rmdirfile();
+  mkdir(filedir, 0777);
+
+  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
+  write(fd, format_data, strlen(format_data));
+  close(fd);
+
+  D = gd_open(filedir, GD_RDONLY);
+  path = gd_linterp_tablename(D, "data");
+  error = gd_error(D);
+
+  gd_close(D);
+
+  unlink(format);
+  rmdir(filedir);
+
+  CHECKI(error, GD_E_BAD_FIELD_TYPE);
+  CHECKP(path);
+
+  return r;
+}
diff --git a/test/tell.c b/test/tell.c
new file mode 100644
index 0000000..c9e5029
--- /dev/null
+++ b/test/tell.c
@@ -0,0 +1,73 @@
+/* Copyright (C) 2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+/* gd_tell() */
+#include "test.h"
+
+#include <stdlib.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <string.h>
+#include <errno.h>
+
+int main(void)
+{
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *data = "dirfile/data";
+  const char *format_data = "data RAW UINT8 8\n";
+  unsigned char data_data[256];
+  int fd, e1, e2, r = 0;
+  off_t n;
+  DIRFILE *D;
+
+  rmdirfile();
+  mkdir(filedir, 0777);
+
+  for (fd = 0; fd < 256; ++fd)
+    data_data[fd] = (unsigned char)fd;
+
+  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
+  write(fd, format_data, strlen(format_data));
+  close(fd);
+
+  fd = open(data, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
+  write(fd, data_data, 256);
+  close(fd);
+
+  D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
+  gd_getdata(D, "data", 5, 0, 1, 0, GD_NULL, NULL);
+  e1 = gd_error(D);
+  n = gd_tell(D, "data");
+  e2 = gd_error(D);
+
+  gd_close(D);
+
+  unlink(data);
+  unlink(format);
+  rmdir(filedir);
+
+  CHECKI(e1, 0);
+  CHECKI(e2, 0);
+  CHECKI(n, 48);
+
+  return r;
+}
diff --git a/test/tell64.c b/test/tell64.c
new file mode 100644
index 0000000..79ada4a
--- /dev/null
+++ b/test/tell64.c
@@ -0,0 +1,75 @@
+/* Copyright (C) 2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+/* gd_tell() */
+#define _LARGEFILE64_SOURCE 1
+
+#include "test.h"
+
+#include <stdlib.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <string.h>
+#include <errno.h>
+
+int main(void)
+{
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *data = "dirfile/data";
+  const char *format_data = "data RAW UINT8 8\n";
+  unsigned char data_data[256];
+  int fd, e1, e2, r = 0;
+  off64_t n;
+  DIRFILE *D;
+
+  rmdirfile();
+  mkdir(filedir, 0777);
+
+  for (fd = 0; fd < 256; ++fd)
+    data_data[fd] = (unsigned char)fd;
+
+  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
+  write(fd, format_data, strlen(format_data));
+  close(fd);
+
+  fd = open(data, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
+  write(fd, data_data, 256);
+  close(fd);
+
+  D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
+  gd_getdata(D, "data", 5, 0, 1, 0, GD_NULL, NULL);
+  e1 = gd_error(D);
+  n = gd_tell64(D, "data");
+  e2 = gd_error(D);
+
+  gd_close(D);
+
+  unlink(data);
+  unlink(format);
+  rmdir(filedir);
+
+  CHECKI(e1, 0);
+  CHECKI(e2, 0);
+  CHECKI(n, 48);
+
+  return r;
+}
diff --git a/test/tell_multidiv.c b/test/tell_multidiv.c
new file mode 100644
index 0000000..6d260af
--- /dev/null
+++ b/test/tell_multidiv.c
@@ -0,0 +1,70 @@
+/* Copyright (C) 2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+/* gd_seek() */
+#include "test.h"
+
+#include <stdlib.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <string.h>
+#include <errno.h>
+
+int main(void)
+{
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *data = "dirfile/data";
+  const char *format_data = "data RAW UINT8 8\nphase PHASE data 1\ndiv DIVIDE phase data";
+  unsigned char data_data[256];
+  int fd, error, r = 0;
+  off_t n;
+  DIRFILE *D;
+
+  rmdirfile();
+  mkdir(filedir, 0777);
+
+  for (fd = 0; fd < 256; ++fd)
+    data_data[fd] = (unsigned char)fd;
+
+  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
+  write(fd, format_data, strlen(format_data));
+  close(fd);
+
+  fd = open(data, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
+  write(fd, data_data, 256);
+  close(fd);
+
+  D = gd_open(filedir, GD_RDONLY);
+  n = gd_tell(D, "div");
+  error = gd_error(D);
+
+  gd_close(D);
+
+  unlink(data);
+  unlink(format);
+  rmdir(filedir);
+
+  CHECKI(error, GD_E_DOMAIN);
+  CHECKI(n, -1);
+
+  return r;
+}
diff --git a/test/test.h b/test/test.h
index 3dc4e18..bba416c 100644
--- a/test/test.h
+++ b/test/test.h
@@ -1,14 +1,42 @@
+/* Copyright (C) 2010-2012 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 #define GD_TEST
-#include "../src/internal.h"
+#include "internal.h"
 #include <inttypes.h>
 #include <math.h>
 #include <stdio.h>
 #include <string.h>
 #include <stdlib.h>
 
-/* for MSVCRT _getcwd */
-#ifdef HAVE_DIRECT_H
-#include <direct.h>
+#ifdef HAVE_FLOAT_H
+#include <float.h>
+#endif
+
+#if defined HAVE__ISNAN && ! defined HAVE_ISNAN
+#define isnan _isnan
+#endif
+
+#if defined HAVE__FINITE && \
+  (! defined HAVE_DECL_ISFINITE || HAVE_DECL_ISFINITE == 0)
+#define isfinite _finite
 #endif
 
 /* System call kludge for Win32 */
@@ -30,15 +58,17 @@ int gd_system(const char* command)
 #define gd_system system
 #endif
 
-/* mkdir for MSVC */
-#ifdef _MSC_VER
-#define mkdir(x,y) \
-  system("rmdir /q/s "__TEST__"dirfile"); \
-  _mkdir(x)
-// when using msvc the macro mkdir removes dirfile
-#define mkdirsub(x,y) _mkdir(x)
+/* rm for MSVC */
+#ifdef _WIN32
+#define rmdirfile() system("rmdir /q/s dirfile");
 #else
-#define mkdirsub(x,y) mkdir(x,y)
+#define rmdirfile() chmod("dirfile", 0755); system("rm -rf dirfile");
+#endif
+
+/* sleep for WIN32/64 */
+#if defined _WIN32 || defined _WIN64
+#include <windows.h>
+#define sleep(x) Sleep(1000 * (x))
 #endif
 
 /* path munging for WIN32/64 */
@@ -54,14 +84,36 @@ int gd_system(const char* command)
 #define gd_pathwrite(x,y) write(x,y,strlen(y))
 #endif
 
+/* getcwd abstraction */
+#if defined HAVE_GETCWD || defined HAVE__GETCWD
+# ifdef HAVE__GETCWD
+#  define getcwd _getcwd
+# endif
+# define gdtest_getcwd(ptr,cwd,cwd_size) \
+  do { \
+    ptr = (char*)realloc(cwd, cwd_size *= 2); \
+    if (ptr == NULL) { \
+      fprintf(stderr, "out of memory for cwd!\n"); \
+      exit(1); \
+    } \
+  } while (!getcwd(cwd = ptr, cwd_size));
+#else
+# define GD_NO_GETCWD
+#endif
+
+
 #define CHECK(e,n,nf,vf,...) \
-  if (e) { r = 1; \
-    fprintf(stderr, #n " = " nf " (expected " vf ")\n", __VA_ARGS__); }
+  do { if (e) { r = 1; \
+    fprintf(stderr, #n " = " nf " (expected " vf ")\n", __VA_ARGS__); } \
+  } while(0)
 
 #define CHECKi(i,e,n,nf,vf,...) \
-  if (e) { r = 1; \
+  do { if (e) { r = 1; \
     fprintf(stderr, #i ":%i " #n " = " nf " (expected " vf ")\n", (int)(i), \
-        __VA_ARGS__); }
+        __VA_ARGS__); } \
+  } while(0)
+
+#define strcmpn(n,v) (((n) == NULL) ? 1 : strcmp((n),(v)))
 
 #ifdef GD_NO_C99_API
 #define CHECKC(n,v)    CHECK(sqrt(((n)[0]-(v)[0])*((n)[0]-(v)[0]) + \
@@ -85,12 +137,20 @@ int gd_system(const char* command)
     (long long)(v))
 #define CHECKIi(i,n,v) CHECKi(i,(long long)(n) != (long long)(v),n,"%lli",\
     "%lli", (long long)(n),(long long)(v))
+#define CHECKNAN(n)    CHECK(!isnan(n),n,"%.15g","%s",(double)(n),"nan")
+#define CHECKNANi(i,n) CHECKi(i,!isnan(n),n,"%.15g","%s",(double)(n),"nan")
 #define CHECKP(n)      CHECK((n) != NULL,n,"%p","%s",n,"NULL")
 #define CHECKPi(i,n)   CHECKi(i,(n) != NULL,n,"%p","%s",n,"NULL")
 #define CHECKPN(n)     CHECK((n) == NULL,n,"%p","%s",n,"non-NULL")
 #define CHECKPNi(i,n)  CHECKi(i,(n) == NULL,n,"%p","%s",n,"non-NULL")
-#define CHECKS(n,v)    CHECK(strcmp((n),(v)),n,"\"%s\"","\"%s\"",(n),(v));
-#define CHECKSi(n,v)   CHECKi(i,strcmp((n),(v)),n,"\"%s\"","\"%s\"",(n),(v));
+#define CHECKS(n,v)    CHECK(strcmpn((n),(v)),n,"\"%s\"","\"%s\"",(n),(v));
+#define CHECKSi(n,v)   CHECKi(i,strcmpn((n),(v)),n,"\"%s\"","\"%s\"",(n),(v));
+#define CHECKSp(n,v)   CHECK(strncmp((n),(v), sizeof(v) - 1),n,"\"%s\"",\
+    "\"%s\"",(n),(v));
+#define CHECKBOS(n,v)  CHECK(strncmp((n),(v),strlen(v)-1),n,"\"%s\"","\"%s\"",\
+    (n),(v));
+#define CHECKEOS(n,v)  CHECK(strcmp((n) + strlen(n) - sizeof(v) + 1,(v)),n,\
+    "...\"%s\"","\"%s\"",(n) + strlen(n) - sizeof(v) + 1,(v));
 #define CHECKU(n,v)    CHECK((n) != (v),n,"%llu","%llu",\
     (unsigned long long)(n),(unsigned long long)(v))
 #define CHECKUi(i,n,v) CHECKi(i,(n) != (v),n,"%llu","%llu",\
diff --git a/test/tok_arg.c b/test/tok_arg.c
new file mode 100644
index 0000000..7659683
--- /dev/null
+++ b/test/tok_arg.c
@@ -0,0 +1,56 @@
+/* Copyright (C) 2013 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+/* Parser check */
+#include "test.h"
+
+#include <stdlib.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <string.h>
+#include <errno.h>
+
+int main(void)
+{
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  int e1, e2, r = 0;
+  char *tok;
+  DIRFILE *D;
+
+  rmdirfile();
+
+  D = gd_open(filedir, GD_RDWR | GD_CREAT | GD_EXCL);
+  e1 = gd_error(D);
+
+  tok = gd_strtok(D, NULL);
+  e2 = gd_error(D);
+
+  gd_close(D);
+
+  unlink(format);
+  rmdir(filedir);
+
+  CHECKI(e1,GD_E_OK);
+  CHECKI(e2,GD_E_ARGUMENT);
+  CHECKP(tok);
+  return r;
+}
diff --git a/test/tok_escape.c b/test/tok_escape.c
new file mode 100644
index 0000000..c3b2f0b
--- /dev/null
+++ b/test/tok_escape.c
@@ -0,0 +1,69 @@
+/* Copyright (C) 2013 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+/* Parser check */
+#include "test.h"
+
+#include <stdlib.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <string.h>
+#include <errno.h>
+
+int main(void)
+{
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *spec = "string STRING \\ value";
+  int e1, e2, e3, e4, e5, r = 0;
+  char *tok1, *tok2, *tok3, *tok4;
+  DIRFILE *D;
+
+  rmdirfile();
+
+  D = gd_open(filedir, GD_RDWR | GD_CREAT | GD_EXCL | GD_VERBOSE);
+  e1 = gd_error(D);
+
+  tok1 = gd_strtok(D, spec);
+  e2 = gd_error(D);
+  tok2 = gd_strtok(D, NULL);
+  e3 = gd_error(D);
+  tok3 = gd_strtok(D, NULL);
+  e4 = gd_error(D);
+  tok4 = gd_strtok(D, NULL);
+  e5 = gd_error(D);
+
+  gd_close(D);
+
+  unlink(format);
+  rmdir(filedir);
+
+  CHECKI(e1,GD_E_OK);
+  CHECKI(e2,GD_E_OK);
+  CHECKI(e3,GD_E_OK);
+  CHECKI(e4,GD_E_OK);
+  CHECKI(e5,GD_E_OK);
+  CHECKS(tok1,"string");
+  CHECKS(tok2,"STRING");
+  CHECKS(tok3," value");
+  CHECKP(tok4);
+  return r;
+}
diff --git a/test/tok_quote.c b/test/tok_quote.c
new file mode 100644
index 0000000..6ff5f29
--- /dev/null
+++ b/test/tok_quote.c
@@ -0,0 +1,69 @@
+/* Copyright (C) 2013 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+/* Parser check */
+#include "test.h"
+
+#include <stdlib.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <string.h>
+#include <errno.h>
+
+int main(void)
+{
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *spec = "string STRING \"value\"";
+  int e1, e2, e3, e4, e5, r = 0;
+  char *tok1, *tok2, *tok3, *tok4;
+  DIRFILE *D;
+
+  rmdirfile();
+
+  D = gd_open(filedir, GD_RDWR | GD_CREAT | GD_EXCL | GD_VERBOSE);
+  e1 = gd_error(D);
+
+  tok1 = gd_strtok(D, spec);
+  e2 = gd_error(D);
+  tok2 = gd_strtok(D, NULL);
+  e3 = gd_error(D);
+  tok3 = gd_strtok(D, NULL);
+  e4 = gd_error(D);
+  tok4 = gd_strtok(D, NULL);
+  e5 = gd_error(D);
+
+  gd_close(D);
+
+  unlink(format);
+  rmdir(filedir);
+
+  CHECKI(e1,GD_E_OK);
+  CHECKI(e2,GD_E_OK);
+  CHECKI(e3,GD_E_OK);
+  CHECKI(e4,GD_E_OK);
+  CHECKI(e5,GD_E_OK);
+  CHECKS(tok1,"string");
+  CHECKS(tok2,"STRING");
+  CHECKS(tok3,"value");
+  CHECKP(tok4);
+  return r;
+}
diff --git a/test/trunc.c b/test/trunc.c
index aa99928..8e7a241 100644
--- a/test/trunc.c
+++ b/test/trunc.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Truncating a dirfile should succeed cleanly */
 #include "test.h"
 
@@ -10,13 +30,14 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* data = __TEST__ "dirfile/data";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *data = "dirfile/data";
   int fd, error, unlink_data, stat_format, r = 0;
   struct stat buf;
   DIRFILE *D;
 
+  rmdirfile();
   mkdir(filedir, 0777);
 
   fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
diff --git a/test/trunc_dir.c b/test/trunc_dir.c
new file mode 100644
index 0000000..bd55c3a
--- /dev/null
+++ b/test/trunc_dir.c
@@ -0,0 +1,70 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+/* Truncating a dirfile should succeed cleanly */
+#include "test.h"
+
+#include <stdlib.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <string.h>
+#include <errno.h>
+
+int main(void)
+{
+  const char *filedir = "dirfile";
+  const char *subdir = "dirfile/sub";
+  const char *format = "dirfile/format";
+  const char *data = "dirfile/data";
+  int fd, error, unlink_data, rmdir_sub, stat_format, r = 0;
+  struct stat buf;
+  DIRFILE *D;
+
+  rmdirfile();
+  mkdir(filedir, 0777);
+  mkdir(subdir, 0777);
+
+  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
+  write(fd, format, strlen(format));
+  close(fd);
+
+  close(open(data, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666));
+
+  D = gd_open(filedir, GD_RDWR | GD_TRUNC | GD_VERBOSE);
+  error = gd_error(D);
+  gd_close(D);
+
+  unlink_data = unlink(data);
+  CHECKI(unlink_data, -1);
+
+  stat_format = stat(format, &buf);
+  CHECKI(stat_format, 0);
+  CHECK((buf.st_size > 0),buf.st_size,"%lli","%s",(long long)buf.st_size,"> 0");
+
+  rmdir_sub = rmdir(subdir);
+  CHECKI(rmdir_sub, 0);
+
+  unlink(format);
+  rmdir(filedir);
+
+  CHECKI(error,GD_E_OK);
+  return r;
+}
diff --git a/test/trunc_rdonly.c b/test/trunc_rdonly.c
index fb86749..f0e1c0f 100644
--- a/test/trunc_rdonly.c
+++ b/test/trunc_rdonly.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Truncating a read-only dirfile should fail cleanly */
 #include "test.h"
 
@@ -10,12 +30,13 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* data = __TEST__ "dirfile/data";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *data = "dirfile/data";
   int fd, error, unlink_data, r = 0;
   DIRFILE *D;
 
+  rmdirfile();
   mkdir(filedir, 0777);
 
   fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
diff --git a/test/trunc_rofs.c b/test/trunc_rofs.c
index a15aacb..a707d78 100644
--- a/test/trunc_rofs.c
+++ b/test/trunc_rofs.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Truncating a read-only dirfile should fail cleanly */
 #include "test.h"
 
@@ -10,17 +30,21 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *data = "dirfile/data";
   int error, r = 0;
   DIRFILE *D;
 
+  rmdirfile();
   mkdir(filedir, 0777);
   close(open(format, O_CREAT | O_EXCL | O_WRONLY, 0666));
+  close(open(data, O_CREAT | O_EXCL | O_WRONLY, 0666));
   chmod(filedir, 0555);
 
   /* ensure filesystem honours read-onlyness */
-  if (!unlink(format) || errno != EACCES) {
+  if (!unlink(data) || errno != EACCES) {
+    unlink(format);
     rmdir(filedir);
     return 77;
   }
@@ -30,6 +54,7 @@ int main(void)
   gd_discard(D);
 
   chmod(filedir, 0777);
+  unlink(data);
   unlink(format);
   rmdir(filedir);
 
diff --git a/test/trunc_truncsub.c b/test/trunc_truncsub.c
new file mode 100644
index 0000000..3294564
--- /dev/null
+++ b/test/trunc_truncsub.c
@@ -0,0 +1,70 @@
+/* Copyright (C) 2008-2012 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+/* Truncating a dirfile should succeed cleanly */
+#include "test.h"
+
+#include <stdlib.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <string.h>
+#include <errno.h>
+
+int main(void)
+{
+  const char *filedir = "dirfile";
+  const char *subdir = "dirfile/sub";
+  const char *format = "dirfile/format";
+  const char *data = "dirfile/data";
+  int fd, error, unlink_data, rmdir_sub, stat_format, r = 0;
+  struct stat buf;
+  DIRFILE *D;
+
+  rmdirfile();
+  mkdir(filedir, 0777);
+  mkdir(subdir, 0777);
+
+  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
+  write(fd, format, strlen(format));
+  close(fd);
+
+  close(open(data, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666));
+
+  D = gd_open(filedir, GD_RDWR | GD_TRUNC | GD_TRUNCSUB | GD_VERBOSE);
+  error = gd_error(D);
+  gd_close(D);
+
+  unlink_data = unlink(data);
+  CHECKI(unlink_data, -1);
+
+  stat_format = stat(format, &buf);
+  CHECKI(stat_format, 0);
+  CHECK((buf.st_size > 0),buf.st_size,"%lli","%s",(long long)buf.st_size,"> 0");
+
+  rmdir_sub = rmdir(subdir);
+  CHECKI(rmdir_sub, -1);
+
+  unlink(format);
+  rmdir(filedir);
+
+  CHECKI(error,GD_E_OK);
+  return r;
+}
diff --git a/test/unclude.c b/test/unclude.c
index c582deb..bec2d1d 100644
--- a/test/unclude.c
+++ b/test/unclude.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Test include */
 #include "test.h"
 
@@ -11,17 +31,18 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* format1 = __TEST__ "dirfile/format1";
-  const char* format2 = __TEST__ "dirfile/format2";
-  const char* format_data = "/INCLUDE format1\na CONST UINT8 1\n";
-  const char* format1_data = "b CONST UINT8 11\n/INCLUDE format2\n";
-  const char* format2_data = "c CONST UINT8 11\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *format1 = "dirfile/format1";
+  const char *format2 = "dirfile/format2";
+  const char *format_data = "/INCLUDE format1\na CONST UINT8 1\n";
+  const char *format1_data = "b CONST UINT8 11\n/INCLUDE format2\n";
+  const char *format2_data = "c CONST UINT8 11\n";
   int fd, ret, error, unlink_format1, unlink_format2, r = 0;
   unsigned int nfields, nfragments;
   DIRFILE *D;
 
+  rmdirfile();
   mkdir(filedir, 0777);
 
   fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
diff --git a/test/unclude_del.c b/test/unclude_del.c
index f93a1c7..7ff463a 100644
--- a/test/unclude_del.c
+++ b/test/unclude_del.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Test include */
 #include "test.h"
 
@@ -11,17 +31,18 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* format1 = __TEST__ "dirfile/format1";
-  const char* format2 = __TEST__ "dirfile/format2";
-  const char* format_data = "/INCLUDE format1\na CONST UINT8 1\n";
-  const char* format1_data = "b CONST UINT8 11\n/INCLUDE format2\n";
-  const char* format2_data = "c CONST UINT8 11\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *format1 = "dirfile/format1";
+  const char *format2 = "dirfile/format2";
+  const char *format_data = "/INCLUDE format1\na CONST UINT8 1\n";
+  const char *format1_data = "b CONST UINT8 11\n/INCLUDE format2\n";
+  const char *format2_data = "c CONST UINT8 11\n";
   int fd, ret, error, unlink_format1, unlink_format2, r = 0;
   unsigned int nfields, nfragments;
   DIRFILE *D;
 
+  rmdirfile();
   mkdir(filedir, 0777);
 
   fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
diff --git a/test/unclude_move.c b/test/unclude_move.c
index 56c70e9..6231eed 100644
--- a/test/unclude_move.c
+++ b/test/unclude_move.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Test include */
 #include "test.h"
 
@@ -11,17 +31,18 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* format1 = __TEST__ "dirfile/format1";
-  const char* format2 = __TEST__ "dirfile/format2";
-  const char* format_data = "/INCLUDE format1\na CONST UINT8 1\n";
-  const char* format1_data = "b CONST UINT8 11\n/INCLUDE format2\n";
-  const char* format2_data = "c CONST UINT8 11\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *format1 = "dirfile/format1";
+  const char *format2 = "dirfile/format2";
+  const char *format_data = "/INCLUDE format1\na CONST UINT8 1\n";
+  const char *format1_data = "b CONST UINT8 11\n/INCLUDE format2\n";
+  const char *format2_data = "c CONST UINT8 11\n";
   int fd, ret1, ret2, error1, error2, r = 0;
   unsigned int nfields, nfragments;
   DIRFILE *D;
 
+  rmdirfile();
   mkdir(filedir, 0777);
 
   fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
diff --git a/test/version_0.c b/test/version_0.c
index 140b827..172736a 100644
--- a/test/version_0.c
+++ b/test/version_0.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2010-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Open a Standards Version 0 conformant dirfile */
 #include "test.h"
 
@@ -11,16 +31,17 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* data = __TEST__ "dirfile/FRAMEOFFSET";
-  const char* format_data = "FRAMEOFFSET RAW c 8\na&b RAW c 8";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *data = "dirfile/FRAMEOFFSET";
+  const char *format_data = "FRAMEOFFSET RAW c 8\na&b RAW c 8";
   unsigned char c[8];
   unsigned char data_data[256];
   int fd, i, n, error, v, l, e, r = 0;
   DIRFILE *D;
 
   memset(c, 0, 8);
+  rmdirfile();
   mkdir(filedir, 0777);
 
   for (fd = 0; fd < 256; ++fd)
diff --git a/test/version_0_write.c b/test/version_0_write.c
index b1615c7..ffe8726 100644
--- a/test/version_0_write.c
+++ b/test/version_0_write.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2010-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 #include "test.h"
 
 #include <stdlib.h>
@@ -10,12 +30,13 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* format_data = "FRAMEOFFSET RAW c 8\na&b RAW c 8";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *format_data = "FRAMEOFFSET RAW c 8\na&b RAW c 8";
   int fd, e, q, c, r = 0;
   DIRFILE *D;
 
+  rmdirfile();
   mkdir(filedir, 0777);
 
   fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
diff --git a/test/version_1.c b/test/version_1.c
index 791b323..da67d69 100644
--- a/test/version_1.c
+++ b/test/version_1.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2010-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Open a Standards Version 1 conformant dirfile */
 #include "test.h"
 
@@ -11,16 +31,17 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* data = __TEST__ "dirfile/INCLUDE";
-  const char* format_data = "INCLUDE RAW c 8\nFRAMEOFFSET 1\na&b RAW c 8\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *data = "dirfile/INCLUDE";
+  const char *format_data = "INCLUDE RAW c 8\nFRAMEOFFSET 1\na&b RAW c 8\n";
   unsigned char c[8];
   unsigned char data_data[256];
   int fd, i, n, error, v, l, e, r = 0;
   DIRFILE *D;
 
   memset(c, 0, 8);
+  rmdirfile();
   mkdir(filedir, 0777);
 
   for (fd = 0; fd < 256; ++fd)
diff --git a/test/version_1_write.c b/test/version_1_write.c
index 069e4ae..d828f88 100644
--- a/test/version_1_write.c
+++ b/test/version_1_write.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2010-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 #include "test.h"
 
 #include <stdlib.h>
@@ -10,12 +30,13 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* format_data = "INCLUDE RAW c 8\nFRAMEOFFSET 1\na&b RAW c 8\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *format_data = "INCLUDE RAW c 8\nFRAMEOFFSET 1\na&b RAW c 8\n";
   int fd, e, q, c, r = 0;
   DIRFILE *D;
 
+  rmdirfile();
   mkdir(filedir, 0777);
 
   fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
diff --git a/test/version_2.c b/test/version_2.c
index 551ab3f..6ab2190 100644
--- a/test/version_2.c
+++ b/test/version_2.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2010-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Open a Standards Version 2 conformant dirfile */
 #include "test.h"
 
@@ -11,10 +31,10 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* data = __TEST__ "dirfile/INCLUDE";
-  const char* format_data =
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *data = "dirfile/INCLUDE";
+  const char *format_data =
     "INCLUDE RAW c 8\n"
     "a&b RAW c 8\n"
     "m MULTIPLY INCLUDE INCLUDE\n";
@@ -24,6 +44,7 @@ int main(void)
   DIRFILE *D;
 
   memset(c, 0, 8);
+  rmdirfile();
   mkdir(filedir, 0777);
 
   for (fd = 0; fd < 256; ++fd)
diff --git a/test/version_2_write.c b/test/version_2_write.c
index 7b55088..84c239d 100644
--- a/test/version_2_write.c
+++ b/test/version_2_write.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2010-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 #include "test.h"
 
 #include <stdlib.h>
@@ -10,15 +30,16 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* format_data =
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *format_data =
     "INCLUDE RAW c 8\n"
     "a&b RAW c 8\n"
     "m MULTIPLY INCLUDE INCLUDE\n";
   int fd, e, q, c, r = 0;
   DIRFILE *D;
 
+  rmdirfile();
   mkdir(filedir, 0777);
 
   fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
diff --git a/test/version_3.c b/test/version_3.c
index 66d8f83..2f10c90 100644
--- a/test/version_3.c
+++ b/test/version_3.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2010-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Open a Standards Version 3 conformant dirfile */
 #include "test.h"
 
@@ -11,18 +31,19 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* format1 = __TEST__ "dirfile/RAW";
-  const char* data = __TEST__ "dirfile/ENDIAN";
-  const char* format_data = "ENDIAN RAW c 8\nINCLUDE RAW\n";
-  const char* format_data1 = "m MULTIPLY ENDIAN ENDIAN\na&b RAW c 8\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *format1 = "dirfile/RAW";
+  const char *data = "dirfile/ENDIAN";
+  const char *format_data = "ENDIAN RAW c 8\nINCLUDE RAW\n";
+  const char *format_data1 = "m MULTIPLY ENDIAN ENDIAN\na&b RAW c 8\n";
   uint16_t c[8];
   unsigned char data_data[256];
   int fd, i, n, error, v, l, e, r = 0;
   DIRFILE *D;
 
   memset(c, 0, 8);
+  rmdirfile();
   mkdir(filedir, 0777);
 
   for (fd = 0; fd < 256; ++fd)
diff --git a/test/version_3_write.c b/test/version_3_write.c
index f72caef..66adccb 100644
--- a/test/version_3_write.c
+++ b/test/version_3_write.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2010-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 #include "test.h"
 
 #include <stdlib.h>
@@ -10,14 +30,15 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* format1 = __TEST__ "dirfile/RAW";
-  const char* format_data = "ENDIAN RAW c 8\nINCLUDE RAW\n";
-  const char* format_data1 = "m MULTIPLY ENDIAN ENDIAN\na&b RAW c 8\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *format1 = "dirfile/RAW";
+  const char *format_data = "ENDIAN RAW c 8\nINCLUDE RAW\n";
+  const char *format_data1 = "m MULTIPLY ENDIAN ENDIAN\na&b RAW c 8\n";
   int fd, e, q, c, r = 0;
   DIRFILE *D;
 
+  rmdirfile();
   mkdir(filedir, 0777);
 
   fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
diff --git a/test/version_4.c b/test/version_4.c
index edd9302..1be5a35 100644
--- a/test/version_4.c
+++ b/test/version_4.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2010-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Open a Standards Version 4 conformant dirfile */
 #include "test.h"
 
@@ -11,18 +31,19 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* format1 = __TEST__ "dirfile/RAW";
-  const char* data = __TEST__ "dirfile/ENDIAN";
-  const char* format_data = "ENDIAN RAW c 8\nINCLUDE RAW\n";
-  const char* format_data1 = "VERSION PHASE ENDIAN 1\na&b RAW c 8\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *format1 = "dirfile/RAW";
+  const char *data = "dirfile/ENDIAN";
+  const char *format_data = "ENDIAN RAW c 8\nINCLUDE RAW\n";
+  const char *format_data1 = "VERSION PHASE ENDIAN 1\na&b RAW c 8\n";
   uint16_t c[8];
   unsigned char data_data[256];
   int fd, i, n, error, v, l, e, r = 0;
   DIRFILE *D;
 
   memset(c, 0, 8);
+  rmdirfile();
   mkdir(filedir, 0777);
 
   for (fd = 0; fd < 256; ++fd)
diff --git a/test/version_4_write.c b/test/version_4_write.c
index 5d7a26f..16d8464 100644
--- a/test/version_4_write.c
+++ b/test/version_4_write.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2010-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 #include "test.h"
 
 #include <stdlib.h>
@@ -10,14 +30,15 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* format1 = __TEST__ "dirfile/RAW";
-  const char* format_data = "ENDIAN RAW c 8\nINCLUDE RAW\n";
-  const char* format_data1 = "VERSION PHASE ENDIAN 1\na&b RAW c 8\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *format1 = "dirfile/RAW";
+  const char *format_data = "ENDIAN RAW c 8\nINCLUDE RAW\n";
+  const char *format_data1 = "VERSION PHASE ENDIAN 1\na&b RAW c 8\n";
   int fd, e, q, c, r = 0;
   DIRFILE *D;
 
+  rmdirfile();
   mkdir(filedir, 0777);
 
   fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
diff --git a/test/version_5.c b/test/version_5.c
index 659eba3..9140ceb 100644
--- a/test/version_5.c
+++ b/test/version_5.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2010-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Open a Standards Version 5 conformant dirfile */
 #include "test.h"
 
@@ -11,10 +31,10 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* data = __TEST__ "dirfile/a.r";
-  const char* format_data =
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *data = "dirfile/a.r";
+  const char *format_data =
     "/VERSION 5\n"
 #ifdef WORDS_BIGENDIAN
     "/ENDIAN little\n"
@@ -29,6 +49,7 @@ int main(void)
   DIRFILE *D;
 
   memset(c, 0, 8);
+  rmdirfile();
   mkdir(filedir, 0777);
 
   for (fd = 0; fd < 256; ++fd)
diff --git a/test/version_5_strict.c b/test/version_5_strict.c
index dc210bb..05882e9 100644
--- a/test/version_5_strict.c
+++ b/test/version_5_strict.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2010-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* CheckStandards Version 5 strictness */
 #include "test.h"
 
@@ -9,7 +29,7 @@
 #include <string.h>
 #include <errno.h>
 
-int cb(gd_parser_data_t* pdata, void* ll)
+int cb(gd_parser_data_t *pdata, void *ll)
 {
   ((int*)ll)[pdata->linenum - 1] = 1;
   return GD_SYNTAX_IGNORE;
@@ -17,10 +37,10 @@ int cb(gd_parser_data_t* pdata, void* ll)
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* data = __TEST__ "dirfile/ar";
-  const char* format_data =
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *data = "dirfile/ar";
+  const char *format_data =
     "/VERSION 5\n"
     "ENDIAN little\n"
     "X<r RAW UINT8 8\n"
@@ -36,6 +56,7 @@ int main(void)
   DIRFILE *D;
 
   memset(c, 0, 8);
+  rmdirfile();
   mkdir(filedir, 0777);
 
   for (fd = 0; fd < 256; ++fd)
diff --git a/test/version_5_write.c b/test/version_5_write.c
index 5b0cb66..915b90b 100644
--- a/test/version_5_write.c
+++ b/test/version_5_write.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2010-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 #include "test.h"
 
 #include <stdlib.h>
@@ -10,9 +30,9 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* format_data =
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *format_data =
     "/VERSION 5\n"
     "/ENDIAN big\n"
     "a.r RAW UINT8 8\n"
@@ -20,6 +40,7 @@ int main(void)
   int fd, e, q, c, r = 0;
   DIRFILE *D;
 
+  rmdirfile();
   mkdir(filedir, 0777);
 
   fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
diff --git a/test/version_6.c b/test/version_6.c
index de77557..b7db38a 100644
--- a/test/version_6.c
+++ b/test/version_6.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2010-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Open a Standards Version 6 conformant dirfile */
 #include "test.h"
 
@@ -11,16 +31,17 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* data = __TEST__ "dirfile/a#r";
-  const char* format_data = "/VERSION 6\na\\#r RAW UINT8 8\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *data = "dirfile/a#r";
+  const char *format_data = "/VERSION 6\na\\#r RAW UINT8 8\n";
   uint16_t c[8];
   unsigned char data_data[256];
   int fd, i, n, error, v, l, e, r = 0;
   DIRFILE *D;
 
   memset(c, 0, 8);
+  rmdirfile();
   mkdir(filedir, 0777);
 
   for (fd = 0; fd < 256; ++fd)
@@ -56,7 +77,7 @@ int main(void)
 
   /* Version 6 is forward compatible with versions 7 and 8 */
   CHECKI(v,6);
-  CHECKI(l,8);
+  CHECKI(l,GD_DIRFILE_STANDARDS_VERSION);
   CHECKI(e,6);
 
   return r;
diff --git a/test/version_6_strict.c b/test/version_6_strict.c
index 044590e..c9e1a59 100644
--- a/test/version_6_strict.c
+++ b/test/version_6_strict.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2010-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Check Standards Version 6 strictness */
 #include "test.h"
 
@@ -9,7 +29,7 @@
 #include <string.h>
 #include <errno.h>
 
-int cb(gd_parser_data_t* pdata, void* ll)
+int cb(gd_parser_data_t *pdata, void *ll)
 {
   ((int*)ll)[pdata->linenum - 1] = 1;
   return GD_SYNTAX_IGNORE;
@@ -17,10 +37,10 @@ int cb(gd_parser_data_t* pdata, void* ll)
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* data = __TEST__ "dirfile/ar";
-  const char* format_data =
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *data = "dirfile/ar";
+  const char *format_data =
     "/VERSION 6\n"
     "X<r RAW UINT8 8\n"
     "X#r RAW COMPLEX128 8\n"
@@ -39,6 +59,7 @@ int main(void)
   DIRFILE *D;
 
   memset(c, 0, 8);
+  rmdirfile();
   mkdir(filedir, 0777);
 
   for (fd = 0; fd < 256; ++fd)
diff --git a/test/version_6_write.c b/test/version_6_write.c
index 42dcc1a..44df61a 100644
--- a/test/version_6_write.c
+++ b/test/version_6_write.c
@@ -1,21 +1,39 @@
+/* Copyright (C) 2010-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 #include "test.h"
 
-#include <stdlib.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-#include <stdio.h>
-#include <string.h>
-#include <errno.h>
-
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* format_data = "/VERSION 6\na\\#r RAW UINT8 8\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *format_data =
+    "/VERSION 6\n"
+    "b\\ c CONST UINT8 8\n"
+    "\"a \\#r\" RAW UINT8 b\\ c\n"
+    "/META \"a \\#r\" \\x64\\c\\157 PHASE \"a \\#r\" 0\n";
   int fd, e, q, c, r = 0;
   DIRFILE *D;
+  unsigned int s;
 
+  rmdirfile();
   mkdir(filedir, 0777);
 
   fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
@@ -29,6 +47,7 @@ int main(void)
 
   D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
   c = gd_dirfile_standards(D, GD_VERSION_CURRENT);
+  s = gd_spf(D, "a #r/dco");
   gd_close(D);
 
   unlink(format);
@@ -37,6 +56,7 @@ int main(void)
   CHECKI(e,6);
   CHECKI(q,0);
   CHECKI(c,6);
+  CHECKU(s,8);
 
   return r;
 }
diff --git a/test/version_7.c b/test/version_7.c
index 109b127..109a578 100644
--- a/test/version_7.c
+++ b/test/version_7.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2010-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Open a Standards Version 7 conformant dirfile */
 #include "test.h"
 
@@ -11,16 +31,17 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* data = __TEST__ "dirfile/ar";
-  const char* format_data = "/VERSION 7\nar RAW UINT8 8\nar/q SBIT ar 0 10\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *data = "dirfile/ar";
+  const char *format_data = "/VERSION 7\nar RAW UINT8 8\nar/q SBIT ar 0 10\n";
   uint16_t c[8];
   unsigned char data_data[256];
   int fd, i, n, error, v, l, e, r = 0;
   DIRFILE *D;
 
   memset(c, 0, 8);
+  rmdirfile();
   mkdir(filedir, 0777);
 
   for (fd = 0; fd < 256; ++fd)
@@ -56,7 +77,7 @@ int main(void)
 
   /* Version 7 is forward compatible with version 8 */
   CHECKI(v,7);
-  CHECKI(l,8);
+  CHECKI(l,GD_DIRFILE_STANDARDS_VERSION);
   CHECKI(e,7);
 
   return r;
diff --git a/test/version_7_strict.c b/test/version_7_strict.c
index e7c12d6..9919a02 100644
--- a/test/version_7_strict.c
+++ b/test/version_7_strict.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2010-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Check Standards Version 6 strictness */
 #include "test.h"
 
@@ -9,7 +29,7 @@
 #include <string.h>
 #include <errno.h>
 
-int cb(gd_parser_data_t* pdata, void* ll)
+int cb(gd_parser_data_t *pdata, void *ll)
 {
   ((int*)ll)[pdata->linenum - 1] = 1;
   return GD_SYNTAX_IGNORE;
@@ -17,10 +37,10 @@ int cb(gd_parser_data_t* pdata, void* ll)
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* data = __TEST__ "dirfile/ar";
-  const char* format_data =
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *data = "dirfile/ar";
+  const char *format_data =
     "/VERSION 7\n"
     "X<r RAW UINT8 8\n"
     "X.r RAW UINT8 8\n"
@@ -35,6 +55,7 @@ int main(void)
   DIRFILE *D;
 
   memset(c, 0, 8);
+  rmdirfile();
   mkdir(filedir, 0777);
 
   for (fd = 0; fd < 256; ++fd)
diff --git a/test/version_7_write.c b/test/version_7_write.c
index e39e833..7bb038a 100644
--- a/test/version_7_write.c
+++ b/test/version_7_write.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2010-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 #include "test.h"
 
 #include <stdlib.h>
@@ -10,12 +30,13 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* format_data = "/VERSION 7\nar RAW UINT8 8\nar/q SBIT ar 0 10\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *format_data = "/VERSION 7\nar RAW UINT8 8\nar/q SBIT ar 0 10\n";
   int fd, e, q, c, r = 0;
   DIRFILE *D;
 
+  rmdirfile();
   mkdir(filedir, 0777);
 
   fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
diff --git a/test/version_8.c b/test/version_8.c
index 2528391..520d526 100644
--- a/test/version_8.c
+++ b/test/version_8.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2010-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Open a Standards Version 8 conformant dirfile */
 #include "test.h"
 
@@ -11,10 +31,10 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* data = __TEST__ "dirfile/ar";
-  const char* format_data =
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *data = "dirfile/ar";
+  const char *format_data =
     "/VERSION 8\n"
     "ar RAW UINT8 8\n"
     "FRAMEOFFSET DIVIDE ar ar\n"
@@ -25,6 +45,7 @@ int main(void)
   DIRFILE *D;
 
   memset(c, 0, 8);
+  rmdirfile();
   mkdir(filedir, 0777);
 
   for (fd = 0; fd < 256; ++fd)
@@ -59,7 +80,7 @@ int main(void)
     CHECKFi(i,c[i],1. / (40 + i));
 
   CHECKI(v,8);
-  CHECKI(l,8);
+  CHECKI(l,GD_DIRFILE_STANDARDS_VERSION);
   CHECKI(e,8);
 
   return r;
diff --git a/test/version_8_strict.c b/test/version_8_strict.c
index be549a3..2e48f12 100644
--- a/test/version_8_strict.c
+++ b/test/version_8_strict.c
@@ -1,15 +1,26 @@
-/* Check Standards Version 6 strictness */
+/* Copyright (C) 2010-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 #include "test.h"
 
-#include <stdlib.h>
-#include <sys/types.h>
-#include <stdio.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-#include <string.h>
-#include <errno.h>
-
-int cb(gd_parser_data_t* pdata, void* ll)
+int cb(gd_parser_data_t *pdata, void *ll)
 {
   ((int*)ll)[pdata->linenum - 1] = 1;
   return GD_SYNTAX_IGNORE;
@@ -18,10 +29,10 @@ int cb(gd_parser_data_t* pdata, void* ll)
 #define NLINES 13
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* data = __TEST__ "dirfile/ar";
-  const char* format_data =
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *data = "dirfile/ar";
+  const char *format_data =
     "/VERSION 8\n"
     "X<r RAW UINT8 8\n"
     "X.r RAW UINT8 8\n"
@@ -41,8 +52,9 @@ int main(void)
   int fd, i, n, error, r = 0;
   DIRFILE *D;
 
-  memset(c, 0, 8);
+  memset(c, 0, 16);
   memset(ll, 0, NLINES * sizeof(int));
+  rmdirfile();
   mkdir(filedir, 0777);
 
   for (fd = 0; fd < 256; ++fd)
diff --git a/test/version_8_write.c b/test/version_8_write.c
index e8b008a..e5217d5 100644
--- a/test/version_8_write.c
+++ b/test/version_8_write.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2010-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 #include "test.h"
 
 #include <stdlib.h>
@@ -10,9 +30,9 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* format_data =
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *format_data =
     "/VERSION 8\n"
     "ar RAW UINT8 8\n"
     "FRAMEOFFSET DIVIDE ar ar\n"
@@ -20,6 +40,7 @@ int main(void)
   int fd, e, q, c, r = 0;
   DIRFILE *D;
 
+  rmdirfile();
   mkdir(filedir, 0777);
 
   fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
diff --git a/test/version_9.c b/test/version_9.c
new file mode 100644
index 0000000..b81e72a
--- /dev/null
+++ b/test/version_9.c
@@ -0,0 +1,89 @@
+/* Copyright (C) 2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+#include "test.h"
+
+#include <stdlib.h>
+#include <sys/types.h>
+#include <stdio.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <string.h>
+#include <errno.h>
+
+int main(void)
+{
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *data = "dirfile/ar";
+  const char *format_data =
+    "/VERSION 9\n"
+    "ar RAW UINT8 8\n"
+    "/HIDDEN ar\n"
+    "r WINDOW ar ar LT 0x2C\n";
+  double c[8];
+  unsigned char data_data[256];
+  int fd, i, n, error, v, l, e, r = 0;
+  DIRFILE *D;
+
+  memset(c, 0, 8);
+  rmdirfile();
+  mkdir(filedir, 0777);
+
+  for (fd = 0; fd < 256; ++fd)
+    data_data[fd] = (unsigned char)fd;
+
+  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
+  write(fd, format_data, strlen(format_data));
+  close(fd);
+
+  fd = open(data, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
+  write(fd, data_data, 256);
+  close(fd);
+
+  D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
+  n = gd_getdata(D, "r", 5, 0, 1, 0, GD_FLOAT64, c);
+  error = gd_error(D);
+
+  v = gd_dirfile_standards(D, GD_VERSION_CURRENT);
+  l = gd_dirfile_standards(D, GD_VERSION_LATEST);
+  e = gd_dirfile_standards(D, GD_VERSION_EARLIEST);
+
+  gd_close(D);
+
+  unlink(data);
+  unlink(format);
+  rmdir(filedir);
+
+  CHECKI(error,0);
+  CHECKI(n,8);
+
+  for (i = 0; i < 8; ++i)
+    if (i >= 4)
+      CHECKNANi(i,c[i]);
+    else
+      CHECKFi(i,c[i],(40 + i));
+
+  CHECKI(v,9);
+  CHECKI(l,GD_DIRFILE_STANDARDS_VERSION);
+  CHECKI(e,9);
+
+  return r;
+}
diff --git a/test/version_9_strict.c b/test/version_9_strict.c
new file mode 100644
index 0000000..8feefcc
--- /dev/null
+++ b/test/version_9_strict.c
@@ -0,0 +1,121 @@
+/* Copyright (C) 2010-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+#include "test.h"
+
+int cb(gd_parser_data_t *pdata, void *ll)
+{
+  ((int*)ll)[pdata->linenum - 1] = 1;
+  return GD_SYNTAX_IGNORE;
+}
+
+#define NLINES 18
+int main(void)
+{
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *format1 = "dirfile/format1";
+  const char *format2 = "dirfile/format2";
+  const char *data = "dirfile/ar";
+  const char *format_data =
+    "/VERSION 8\n"  /* 0 */
+    "/INCLUDE format1\n" /* 1 */
+    "w WINDOW INDEX INDEX SET 0x1\n"; /* 2 */
+  const char *format1_data =
+    "\n\n\n"
+    "/VERSION 9\n" /* 3 */
+    "/INCLUDE format2 A Z\n" /* 4 */
+    "/INCLUDE format2 A.Z\n" /* 5 */
+    "Xr RAW COMPLEX128 0xA\n" /* 6 */
+    "Xy POLYNOM INDEX 8 055 0xAE 2\n" /* 7 */
+    "ar WINDOW AdZ INDEX SET 0x1\n" /* 8 */
+    "AINDEXZ PHASE INDEX 0\n" /* 9 */
+    "/HIDDEN Xy\n"; /* 10 */
+  const char *format2_data =
+    "\n\n\n"
+    "\n\n\n\n\n\n\n\n"
+    "c RAW UINT8 1\n" /* 11 */
+    "/HIDDEN c\n" /* 12 */
+    "/REFERENCE c\n" /* 13 */
+    "/VERSION 8\n" /* 14 */
+    "d PHASE INDEX 0\n" /* 15 */
+    "d/c CONST FLOAT64 1\n" /* 16 */
+    "/META d d CONST FLOAT64 1\n"; /* 17 */
+  uint16_t c[8];
+  int ll[NLINES];
+  unsigned char data_data[256];
+  int fd, i, n, v, error, r = 0;
+  DIRFILE *D;
+
+  memset(c, 0, 16);
+  memset(ll, 0, NLINES * sizeof(int));
+  rmdirfile();
+  mkdir(filedir, 0777);
+
+  for (fd = 0; fd < 256; ++fd)
+    data_data[fd] = (unsigned char)fd;
+
+  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
+  write(fd, format_data, strlen(format_data));
+  close(fd);
+
+  fd = open(format1, O_CREAT | O_EXCL | O_WRONLY, 0666);
+  write(fd, format1_data, strlen(format1_data));
+  close(fd);
+
+  fd = open(format2, O_CREAT | O_EXCL | O_WRONLY, 0666);
+  write(fd, format2_data, strlen(format2_data));
+  close(fd);
+
+  fd = open(data, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
+  write(fd, data_data, 256);
+  close(fd);
+
+  D = gd_cbopen(filedir, GD_RDONLY | GD_PEDANTIC, cb, ll);
+  error = gd_error(D);
+  v = gd_dirfile_standards(D, GD_VERSION_CURRENT);
+  n = gd_getdata(D, "ar", 4, 0, 8, 0, GD_UINT16, c);
+
+  gd_close(D);
+
+  unlink(data);
+  unlink(format);
+  unlink(format1);
+  unlink(format2);
+  rmdir(filedir);
+
+  CHECKI(error,0);
+
+  for (i = 0; i < NLINES; ++i) {
+    if (i == 2 || i == 5) {
+      CHECKIi(i,ll[i], 1);
+    } else {
+      CHECKIi(i,ll[i],0);
+    }
+  }
+
+  CHECKI(n,8);
+  CHECKI(v,9);
+
+  for (i = 0; i < n; ++i)
+    CHECKUi(i,c[i], (i & 1) ? 4 + i : 0);
+
+  return r;
+}
diff --git a/test/version_9_write.c b/test/version_9_write.c
new file mode 100644
index 0000000..e1918a8
--- /dev/null
+++ b/test/version_9_write.c
@@ -0,0 +1,104 @@
+/* Copyright (C) 2010-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+#include "test.h"
+
+int main(void)
+{
+  const char *filedir = "dirfile";
+  const char *format[] = {
+    "dirfile/format",
+    "dirfile/format1",
+    "dirfile/format2",
+    "dirfile/format3",
+    "dirfile/format4"
+  };
+  const char *data = "dirfile/ar";
+  const char *format_data[] = {
+    "/VERSION 8\n"
+      "/INCLUDE format1\n",
+    "\n\n\n\n\n"
+      "/VERSION 9\n"
+      "Xr RAW COMPLEX128 0xA\n"
+      "Xy POLYNOM INDEX 8 055 0xAE 2\n"
+      "ar WINDOW d INDEX SET 0x1\n"
+      "/ALIAS BINDEX INDEX\n"
+      "/ALIAS AINDEXYZ BINDEX\n"
+      "/INCLUDE format2 A Z\n"
+      "/ALIAS m AdYZ\n"
+      "/INCLUDE format4\n"
+      "/ALIAS z n\n"
+      "/ALIAS d z\n"
+      "/HIDDEN Xy\n",
+    "/INCLUDE format3 \"\" Y\n",
+    "/ALIAS d INDEX\n/HIDDEN d\n",
+    "/ALIAS n m\n"
+  };
+  uint16_t c[8];
+  unsigned char data_data[256];
+  int fd, i, error, n, v, h1, h2, r = 0;
+  DIRFILE *D;
+
+  memset(c, 0, 16);
+  rmdirfile();
+  mkdir(filedir, 0777);
+
+  for (fd = 0; fd < 256; ++fd)
+    data_data[fd] = (unsigned char)fd;
+
+  for (i = 0; i < 5; ++i) {
+    fd = open(format[i], O_CREAT | O_EXCL | O_WRONLY, 0666);
+    write(fd, format_data[i], strlen(format_data[i]));
+    close(fd);
+  }
+
+  fd = open(data, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
+  write(fd, data_data, 256);
+  close(fd);
+
+  D = gd_open(filedir, GD_RDWR | GD_VERBOSE);
+  h1 = gd_hidden(D, "AdYZ");
+  gd_rewrite_fragment(D, GD_ALL_FRAGMENTS);
+  error = gd_error(D);
+  gd_close(D);
+
+  D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
+  v = gd_dirfile_standards(D, GD_VERSION_CURRENT);
+  n = gd_getdata(D, "ar", 4, 0, 8, 0, GD_UINT16, c);
+  h2 = gd_hidden(D, "AdYZ");
+
+  gd_close(D);
+
+  unlink(data);
+  for (i = 0; i < 5; ++i)
+    unlink(format[i]);
+  rmdir(filedir);
+
+  CHECKI(error,0);
+  CHECKI(h1,1);
+  CHECKI(h2,1);
+  CHECKI(n,8);
+  CHECKI(v,9);
+
+  for (i = 0; i < n; ++i)
+    CHECKUi(i,c[i], (i & 1) ? 4 + i : 0);
+
+  return r;
+}
diff --git a/test/vlist.c b/test/vlist.c
index ceed10d..46d7cd7 100644
--- a/test/vlist.c
+++ b/test/vlist.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Retreiving the number of fields of a field should succeed cleanly */
 #include "test.h"
 
@@ -11,9 +31,9 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* format_data =
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *format_data =
     "data1 RAW UINT8 1\n"
     "data2 RAW UINT8 1\n"
     "data3 RAW UINT8 1\n"
@@ -22,6 +42,7 @@ int main(void)
   const char **field_list;
   DIRFILE *D;
 
+  rmdirfile();
   mkdir(filedir, 0777);
 
   fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
diff --git a/test/vlist_alias.c b/test/vlist_alias.c
new file mode 100644
index 0000000..6b47255
--- /dev/null
+++ b/test/vlist_alias.c
@@ -0,0 +1,83 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+/* Retreiving the number of fields of a field should succeed cleanly */
+#include "test.h"
+
+#include <stdlib.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <stdio.h>
+#include <string.h>
+#include <errno.h>
+
+int main(void)
+{
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *format_data =
+    "data1 RAW UINT8 1\n"
+    "data2 RAW UINT8 1\n"
+    "data3 RAW UINT8 1\n"
+    "/ALIAS alias1 data3\n"
+    "/ALIAS alias2 data4\n"
+    "data4 CONST UINT8 1\n";
+  int fd, i, error, r = 0;
+  const char **field_list;
+  DIRFILE *D;
+
+  rmdirfile();
+  mkdir(filedir, 0777);
+
+  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
+  write(fd, format_data, strlen(format_data));
+  close(fd);
+
+  D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
+  field_list = gd_vector_list(D);
+
+  error = gd_error(D);
+  CHECKI(error,0);
+  CHECKPN(field_list);
+
+  for (i = 0; field_list[i]; ++i) {
+    if (strcmp(field_list[i], "data1") == 0)
+      continue;
+    else if (strcmp(field_list[i], "data2") == 0)
+      continue;
+    else if (strcmp(field_list[i], "data3") == 0)
+      continue;
+    else if (strcmp(field_list[i], "alias1") == 0)
+      continue;
+    else if (strcmp(field_list[i], "INDEX") == 0)
+      continue;
+
+    r = 1;
+  }
+
+  CHECKI(i,5);
+
+  gd_close(D);
+  unlink(format);
+  rmdir(filedir);
+
+  return r;
+}
diff --git a/test/vlist_hidden.c b/test/vlist_hidden.c
new file mode 100644
index 0000000..c0c7fb0
--- /dev/null
+++ b/test/vlist_hidden.c
@@ -0,0 +1,69 @@
+/* Copyright (C) 2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+#include "test.h"
+
+int main(void)
+{
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *format_data =
+    "data1 RAW UINT8 1\n"
+    "data2 RAW UINT8 1\n"
+    "/HIDDEN data2\n"
+    "data3 RAW UINT8 1\n"
+    "data4 CONST UINT8 1\n";
+  int fd, i, error, r = 0;
+  const char **field_list;
+  DIRFILE *D;
+
+  rmdirfile();
+  mkdir(filedir, 0777);
+
+  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
+  write(fd, format_data, strlen(format_data));
+  close(fd);
+
+  D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
+  field_list = gd_vector_list(D);
+
+  error = gd_error(D);
+  CHECKI(error,0);
+  CHECKPN(field_list);
+
+  for (i = 0; field_list[i]; ++i) {
+    if (strcmp(field_list[i], "data1") == 0)
+      continue;
+    else if (strcmp(field_list[i], "data3") == 0)
+      continue;
+    else if (strcmp(field_list[i], "INDEX") == 0)
+      continue;
+
+    r = 1;
+  }
+
+  CHECKI(i,3);
+
+  gd_close(D);
+  unlink(format);
+  rmdir(filedir);
+
+  return r;
+}
diff --git a/test/vlist_invalid.c b/test/vlist_invalid.c
index 34f96d8..01c2219 100644
--- a/test/vlist_invalid.c
+++ b/test/vlist_invalid.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Requesting the number of fields from an invalid dirfile should fail cleanly */
 #include "test.h"
 
@@ -9,12 +29,15 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  int r = 0;
+  const char *filedir = "dirfile";
+  int error, r = 0;
+  DIRFILE *D;
+  const char **fl;
 
-  DIRFILE* D = gd_open(filedir, GD_RDONLY);
-  const char** fl = gd_vector_list(D);
-  int error = gd_error(D);
+  rmdirfile();
+  D = gd_open(filedir, GD_RDONLY);
+  fl = gd_vector_list(D);
+  error = gd_error(D);
   gd_close(D);
 
   CHECKP(fl);
diff --git a/test/vlist_meta.c b/test/vlist_meta.c
index 38974f8..9cf8853 100644
--- a/test/vlist_meta.c
+++ b/test/vlist_meta.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Retreiving the number of fields of a field should succeed cleanly */
 #include "test.h"
 
@@ -11,9 +31,9 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* format_data =
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *format_data =
     "parent RAW UINT8 1\n"
     "META parent data1 LINTERP UINT8 1\n"
     "META parent data2 LINTERP UINT8 1\n"
@@ -23,6 +43,7 @@ int main(void)
   const char **field_list;
   DIRFILE *D;
 
+  rmdirfile();
   mkdir(filedir, 0777);
 
   fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
diff --git a/test/vlist_meta_hidden.c b/test/vlist_meta_hidden.c
new file mode 100644
index 0000000..5b0282a
--- /dev/null
+++ b/test/vlist_meta_hidden.c
@@ -0,0 +1,74 @@
+/* Copyright (C) 2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+#include "test.h"
+
+int main(void)
+{
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *format_data =
+    "parent RAW UINT8 1\n"
+    "META parent data1 LINTERP UINT8 1\n"
+    "META parent data2 LINTERP UINT8 1\n"
+    "/HIDDEN parent/data2\n"
+    "META parent data3 LINTERP UINT8 1\n"
+    "META parent data4 CONST UINT8 1\n";
+  int fd, i, error, r = 0;
+  const char **field_list;
+  DIRFILE *D;
+
+  rmdirfile();
+  mkdir(filedir, 0777);
+
+  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
+  write(fd, format_data, strlen(format_data));
+  close(fd);
+
+  D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
+  field_list = gd_mvector_list(D, "parent");
+
+  error = gd_error(D);
+  CHECKI(error,0);
+  CHECKPN(field_list);
+
+  for (i = 0; field_list[i]; ++i) {
+    int len = strlen(field_list[i]);
+    CHECKIi(i,len,5);
+
+    CHECKIi(i,field_list[i][0], 'd');
+    CHECKIi(i,field_list[i][1], 'a');
+    CHECKIi(i,field_list[i][2], 't');
+    CHECKIi(i,field_list[i][3], 'a');
+
+    if (field_list[i][4] != '1' && field_list[i][4] != '3') {
+      fprintf(stderr, "field_list[%i] = \"%s\"\n", i, field_list[i]);
+      r = 1;
+    }
+  }
+
+  CHECKI(i,2);
+
+  gd_close(D);
+  unlink(format);
+  rmdir(filedir);
+
+  return r;
+}
diff --git a/test/vlist_meta_invalid.c b/test/vlist_meta_invalid.c
index c6d9d94..8fb6930 100644
--- a/test/vlist_meta_invalid.c
+++ b/test/vlist_meta_invalid.c
@@ -1,3 +1,23 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Requesting the number of fields from an invalid dirfile should fail cleanly */
 #include "test.h"
 
@@ -9,12 +29,15 @@
 
 int main(void)
 {
-  const char* filedir = __TEST__ "dirfile";
-  int r = 0;
+  const char *filedir = "dirfile";
+  int error, r = 0;
+  DIRFILE *D;
+  const char **fl;
 
-  DIRFILE* D = gd_open(filedir, GD_RDONLY);
-  const char** fl = gd_mvector_list(D, "parent");
-  int error = gd_error(D);
+  rmdirfile();
+  D = gd_open(filedir, GD_RDONLY);
+  fl = gd_mvector_list(D, "parent");
+  error = gd_error(D);
   gd_close(D);
 
   CHECKP(fl);
diff --git a/test/xz_get.c b/test/xz_get.c
index 220ab0b..1dc678a 100644
--- a/test/xz_get.c
+++ b/test/xz_get.c
@@ -1,33 +1,46 @@
-/* Attempt to read UINT8 */
-#include "../src/config.h"
+/* Copyright (C) 2009-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 #include "test.h"
 
-#include <inttypes.h>
-#include <stdlib.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-#include <string.h>
-#include <stdio.h>
-#include <errno.h>
-
 int main(void)
 {
 #ifndef TEST_LZMA
   return 77;
 #else
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* data = __TEST__ "dirfile/data";
-  const char* xzdata = __TEST__ "dirfile/data.xz";
-  const char* format_data = "data RAW UINT16 8\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *data = "dirfile/data";
+  const char *xzdata = "dirfile/data.xz";
+  const char *format_data = "data RAW UINT16 8\n";
   uint16_t c[8];
   char command[4096];
   uint16_t data_data[256];
-  int fd, i, n, error, r = 0;
+#ifdef USE_LZMA
+  int i;
+#endif
+  int fd, n, error, r = 0;
   DIRFILE *D;
 
   memset(c, 0, 8);
+  rmdirfile();
   mkdir(filedir, 0777);
 
   for (fd = 0; fd < 256; ++fd)
diff --git a/test/xz_nframes.c b/test/xz_nframes.c
index f7f117c..a36d9ee 100644
--- a/test/xz_nframes.c
+++ b/test/xz_nframes.c
@@ -1,5 +1,24 @@
+/* Copyright (C) 2009-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 /* Retrieving the number of frames should succeed cleanly */
-#include "../src/config.h"
 #include "test.h"
 
 #include <stdlib.h>
@@ -15,17 +34,18 @@ int main(void)
 #ifndef TEST_LZMA
   return 77;
 #else
-  const char* filedir = __TEST__ "dirfile";
-  const char* format = __TEST__ "dirfile/format";
-  const char* data = __TEST__ "dirfile/data";
-  const char* xzdata = __TEST__ "dirfile/data.xz";
-  const char* format_data = "data RAW UINT16 1\n";
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *data = "dirfile/data";
+  const char *xzdata = "dirfile/data.xz";
+  const char *format_data = "data RAW UINT16 1\n";
   char command[4096];
   uint16_t data_data[256];
   int i, error, r = 0;
   DIRFILE *D;
   size_t n;
 
+  rmdirfile();
   mkdir(filedir, 0777);
 
   for (i = 0; i < 256; ++i)
diff --git a/test/zzip_data.c b/test/zzip_data.c
new file mode 100644
index 0000000..67fdbeb
--- /dev/null
+++ b/test/zzip_data.c
@@ -0,0 +1,90 @@
+/* Copyright (C) 2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+#include "test.h"
+
+int main(void)
+{
+#ifndef TEST_ZZIP
+  return 77;
+#else
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *data = "dirfile/data";
+  const char *testzip = "dirfile/test.zip";
+  const char *format_data =
+    "data RAW UINT16 8\n"
+    "/ENCODING zzip test\n";
+  uint16_t c[8];
+  char command[4096];
+  uint16_t data_data[256];
+  int fd, n, error, i, r = 0;
+  DIRFILE *D;
+
+  memset(c, 0, 8);
+  rmdirfile();
+  mkdir(filedir, 0777);
+
+  for (fd = 0; fd < 256; ++fd)
+    data_data[fd] = (unsigned char)fd;
+
+  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
+  write(fd, format_data, strlen(format_data));
+  close(fd);
+
+  fd = open(data, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
+  write(fd, data_data, 256 * sizeof(uint16_t));
+  close(fd);
+
+  /* compress */
+  chdir(filedir);
+  snprintf(command, 4096, "%s test data > /dev/null", ZIP);
+  if (gd_system(command))
+    return 1;
+  chdir("..");
+  unlink(data);
+
+#ifdef USE_ZZIP
+  D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
+#else
+  D = gd_open(filedir, GD_RDONLY);
+#endif
+  n = gd_getdata(D, "data", 5, 0, 1, 0, GD_UINT16, c);
+  error = gd_error(D);
+
+  gd_close(D);
+
+  unlink(testzip);
+  unlink(format);
+  rmdir(filedir);
+
+#ifdef USE_ZZIP
+  CHECKI(error, 0);
+  CHECKI(n, 8);
+  for (i = 0; i < 8; ++i)
+    CHECKIi(i,c[i], 40 + i);
+#else
+  CHECKI(error, GD_E_UNSUPPORTED);
+  CHECKI(n,0);
+#endif
+
+  return r;
+#endif
+}
diff --git a/test/zzip_get.c b/test/zzip_get.c
new file mode 100644
index 0000000..d014873
--- /dev/null
+++ b/test/zzip_get.c
@@ -0,0 +1,88 @@
+/* Copyright (C) 2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+#include "test.h"
+
+int main(void)
+{
+#ifndef TEST_ZZIP
+  return 77;
+#else
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *data = "dirfile/data";
+  const char *rawzip = "dirfile/raw.zip";
+  const char *format_data = "data RAW UINT16 8\n";
+  uint16_t c[8];
+  char command[4096];
+  uint16_t data_data[256];
+  int fd, n, error, i, r = 0;
+  DIRFILE *D;
+
+  memset(c, 0, 8);
+  rmdirfile();
+  mkdir(filedir, 0777);
+
+  for (fd = 0; fd < 256; ++fd)
+    data_data[fd] = (unsigned char)fd;
+
+  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
+  write(fd, format_data, strlen(format_data));
+  close(fd);
+
+  fd = open(data, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
+  write(fd, data_data, 256 * sizeof(uint16_t));
+  close(fd);
+
+  /* compress */
+  chdir(filedir);
+  snprintf(command, 4096, "%s raw data > /dev/null", ZIP);
+  if (gd_system(command))
+    return 1;
+  chdir("..");
+  unlink(data);
+
+#ifdef USE_ZZIP
+  D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
+#else
+  D = gd_open(filedir, GD_RDONLY);
+#endif
+  n = gd_getdata(D, "data", 5, 0, 1, 0, GD_UINT16, c);
+  error = gd_error(D);
+
+  gd_close(D);
+
+  unlink(rawzip);
+  unlink(format);
+  rmdir(filedir);
+
+#ifdef USE_ZZIP
+  CHECKI(error, 0);
+  CHECKI(n, 8);
+  for (i = 0; i < 8; ++i)
+    CHECKIi(i,c[i], 40 + i);
+#else
+  CHECKI(error, GD_E_UNKNOWN_ENCODING);
+  CHECKI(n,0);
+#endif
+
+  return r;
+#endif
+}
diff --git a/test/zzip_get_get.c b/test/zzip_get_get.c
new file mode 100644
index 0000000..5fe5c1e
--- /dev/null
+++ b/test/zzip_get_get.c
@@ -0,0 +1,88 @@
+/* Copyright (C) 2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+#include "test.h"
+
+int main(void)
+{
+#if !defined USE_ZZIP || !defined TEST_ZZIP
+  return 77; /* skip test */
+#else
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *data = "dirfile/data";
+  const char *rawzip = "dirfile/raw.zip";
+  const char *format_data = "data RAW UINT16 8\n";
+  uint16_t c1[8], c2[8];
+  char command[4096];
+  uint16_t data_data[256];
+  int fd, i, n1, error1, n2, error2, r = 0;
+  DIRFILE *D;
+
+  memset(c1, 0, 16);
+  memset(c2, 0, 16);
+  rmdirfile();
+  mkdir(filedir, 0777);
+
+  for (fd = 0; fd < 256; ++fd)
+    data_data[fd] = (unsigned char)fd;
+
+  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
+  write(fd, format_data, strlen(format_data));
+  close(fd);
+
+  fd = open(data, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
+  write(fd, data_data, 256 * sizeof(uint16_t));
+  close(fd);
+
+  /* compress */
+  chdir(filedir);
+  snprintf(command, 4096, "%s raw data > /dev/null", ZIP);
+  if (gd_system(command))
+    return 1;
+  chdir("..");
+  unlink(data);
+
+  D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
+  n1 = gd_getdata(D, "data", 5, 0, 1, 0, GD_UINT16, c1);
+  error1 = gd_error(D);
+  gd_close(D);
+
+  D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
+  n2 = gd_getdata(D, "data", 5, 0, 1, 0, GD_UINT16, c2);
+  error2 = gd_error(D);
+  gd_close(D);
+
+  unlink(rawzip);
+  unlink(format);
+  rmdir(filedir);
+
+  CHECKI(error1, 0);
+  CHECKI(error2, 0);
+  CHECKI(n1, 8);
+  CHECKI(n2, 8);
+  for (i = 0; i < 8; ++i) {
+    CHECKIi(i,c1[i], 40 + i);
+    CHECKIi(i,c2[i], 40 + i);
+  }
+
+  return r;
+#endif
+}
diff --git a/test/zzip_nframes.c b/test/zzip_nframes.c
new file mode 100644
index 0000000..b98d3aa
--- /dev/null
+++ b/test/zzip_nframes.c
@@ -0,0 +1,93 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+/* Retreiving the number of frames should succeed cleanly */
+#include "test.h"
+
+#include <stdlib.h>
+#include <sys/types.h>
+#include <stdio.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <string.h>
+#include <inttypes.h>
+
+int main(void)
+{
+#ifndef TEST_ZZIP
+  return 77;
+#else
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *data = "dirfile/data";
+  const char *rawzip = "dirfile/raw.zip";
+  const char *format_data = "data RAW UINT16 1\n";
+  char command[4096];
+  uint16_t data_data[256];
+  int i, error, r = 0;
+  size_t n;
+  DIRFILE *D;
+
+  rmdirfile();
+  mkdir(filedir, 0777);
+
+  for (i = 0; i < 256; ++i)
+    data_data[i] = (uint16_t)i;
+
+  i = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
+  write(i, format_data, strlen(format_data));
+  close(i);
+
+  i = open(data, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
+  write(i, data_data, 256 * sizeof(uint16_t));
+  close(i);
+
+  /* compress */
+  chdir(filedir);
+  snprintf(command, 4096, "%s raw data > /dev/null", ZIP);
+  if (gd_system(command))
+    return 1;
+  chdir("..");
+  unlink(data);
+
+#ifdef USE_ZZIP
+  D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
+#else
+  D = gd_open(filedir, GD_RDONLY);
+#endif
+  n = gd_nframes(D);
+  error = gd_error(D);
+  gd_close(D);
+
+  unlink(rawzip);
+  unlink(format);
+  rmdir(filedir);
+
+#ifdef USE_ZZIP
+  CHECKI(error, 0);
+  CHECKI(n, 256);
+#else
+  CHECKI(error, GD_E_UNKNOWN_ENCODING);
+  CHECKI(n, 0);
+#endif
+
+  return r;
+#endif
+}
diff --git a/test/zzslim_get.c b/test/zzslim_get.c
new file mode 100644
index 0000000..c2b84ea
--- /dev/null
+++ b/test/zzslim_get.c
@@ -0,0 +1,95 @@
+/* Copyright (C) 2012 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+#include "test.h"
+
+int main(void)
+{
+#if !defined(TEST_ZZIP) || !defined(TEST_SLIM)
+  return 77;
+#else
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *data = "dirfile/data";
+  const char *dataslm = "dirfile/data.slm";
+  const char *testzip = "dirfile/test.zip";
+  const char *format_data =
+    "data RAW UINT16 8\n"
+    "/ENCODING zzslim test\n";
+  uint16_t c[8];
+  char command[4096];
+  uint16_t data_data[256];
+  int fd, n, error, i, r = 0;
+  DIRFILE *D;
+
+  memset(c, 0, 8);
+  rmdirfile();
+  mkdir(filedir, 0777);
+
+  for (fd = 0; fd < 256; ++fd)
+    data_data[fd] = (unsigned char)fd;
+
+  fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
+  write(fd, format_data, strlen(format_data));
+  close(fd);
+
+  fd = open(data, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
+  write(fd, data_data, 256 * sizeof(uint16_t));
+  close(fd);
+
+  /* compress, twice */
+  snprintf(command, 4096, "%s -k %s > /dev/null", SLIM, data);
+  if (gd_system(command))
+    return 1;
+  chdir(filedir);
+  snprintf(command, 4096, "%s test data.slm > /dev/null", ZIP);
+  if (gd_system(command))
+    return 1;
+  chdir("..");
+  unlink(dataslm);
+  unlink(data);
+
+#ifdef USE_ZZSLIM
+  D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
+#else
+  D = gd_open(filedir, GD_RDONLY);
+#endif
+  n = gd_getdata(D, "data", 5, 0, 1, 0, GD_UINT16, c);
+  error = gd_error(D);
+
+  gd_close(D);
+
+  unlink(testzip);
+  unlink(format);
+  rmdir(filedir);
+
+#ifdef USE_ZZSLIM
+  CHECKI(error, 0);
+  CHECKI(n, 8);
+  for (i = 0; i < 8; ++i)
+    CHECKIi(i,c[i], 40 + i);
+#else
+  CHECKI(error, GD_E_UNSUPPORTED);
+  CHECKI(n,0);
+#endif
+
+  return r;
+#endif
+}
diff --git a/test/zzslim_nframes.c b/test/zzslim_nframes.c
new file mode 100644
index 0000000..31bb5bc
--- /dev/null
+++ b/test/zzslim_nframes.c
@@ -0,0 +1,98 @@
+/* Copyright (C) 2008-2011 D. V. Wiebe
+ *
+ ***************************************************************************
+ *
+ * This file is part of the GetData project.
+ *
+ * GetData is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * GetData is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GetData; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+/* Retreiving the number of frames should succeed cleanly */
+#include "test.h"
+
+#include <stdlib.h>
+#include <sys/types.h>
+#include <stdio.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <string.h>
+#include <inttypes.h>
+
+int main(void)
+{
+#if !defined(TEST_ZZIP) || !defined(TEST_SLIM)
+  return 77;
+#else
+  const char *filedir = "dirfile";
+  const char *format = "dirfile/format";
+  const char *data = "dirfile/data";
+  const char *dataslm = "dirfile/data.slm";
+  const char *rawzip = "dirfile/raw.zip";
+  const char *format_data = "data RAW UINT16 1\n/ENCODING zzslim\n";
+  char command[4096];
+  uint16_t data_data[256];
+  int i, error, r = 0;
+  size_t n;
+  DIRFILE *D;
+
+  rmdirfile();
+  mkdir(filedir, 0777);
+
+  for (i = 0; i < 256; ++i)
+    data_data[i] = (uint16_t)i;
+
+  i = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
+  write(i, format_data, strlen(format_data));
+  close(i);
+
+  i = open(data, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
+  write(i, data_data, 256 * sizeof(uint16_t));
+  close(i);
+
+  /* compress, twice */
+  snprintf(command, 4096, "%s -k %s > /dev/null", SLIM, data);
+  if (gd_system(command))
+    return 1;
+  chdir(filedir);
+  snprintf(command, 4096, "%s raw data.slm > /dev/null", ZIP);
+  if (gd_system(command))
+    return 1;
+  chdir("..");
+  unlink(dataslm);
+  unlink(data);
+
+#ifdef USE_ZZSLIM
+  D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
+#else
+  D = gd_open(filedir, GD_RDONLY);
+#endif
+  n = gd_nframes(D);
+  error = gd_error(D);
+  gd_close(D);
+
+  unlink(rawzip);
+  unlink(format);
+  rmdir(filedir);
+
+#ifdef USE_ZZSLIM
+  CHECKI(error, 0);
+  CHECKI(n, 256);
+#else
+  CHECKI(error, GD_E_UNSUPPORTED);
+  CHECKI(n, 0);
+#endif
+
+  return r;
+#endif
+}
diff --git a/util/Makefile.in b/util/Makefile.in
index bccf27f..aefa4ba 100644
--- a/util/Makefile.in
+++ b/util/Makefile.in
@@ -1,9 +1,9 @@
-# Makefile.in generated by automake 1.11.1 from Makefile.am.
+# Makefile.in generated by automake 1.11.5 from Makefile.am.
 # @configure_input@
 
 # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005, 2006, 2007, 2008, 2009  Free Software Foundation,
-# Inc.
+# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software
+# Foundation, Inc.
 # This Makefile.in is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
@@ -16,6 +16,23 @@
 @SET_MAKE@
 
 VPATH = @srcdir@
+am__make_dryrun = \
+  { \
+    am__dry=no; \
+    case $$MAKEFLAGS in \
+      *\\[\ \	]*) \
+        echo 'am--echo: ; @echo "AM"  OK' | $(MAKE) -f - 2>/dev/null \
+          | grep '^AM OK$$' >/dev/null || am__dry=yes;; \
+      *) \
+        for am__flg in $$MAKEFLAGS; do \
+          case $$am__flg in \
+            *=*|--*) ;; \
+            *n*) am__dry=yes; break;; \
+          esac; \
+        done;; \
+    esac; \
+    test $$am__dry = yes; \
+  }
 pkgdatadir = $(datadir)/@PACKAGE@
 pkgincludedir = $(includedir)/@PACKAGE@
 pkglibdir = $(libdir)/@PACKAGE@
@@ -40,15 +57,17 @@ DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
 am__aclocal_m4_deps = $(top_srcdir)/m4/ax_compare_version.m4 \
 	$(top_srcdir)/m4/compiler.m4 $(top_srcdir)/m4/encoding.m4 \
-	$(top_srcdir)/m4/idl.m4 $(top_srcdir)/m4/libtool.m4 \
-	$(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \
-	$(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \
-	$(top_srcdir)/m4/python.m4 $(top_srcdir)/m4/win32.m4 \
-	$(top_srcdir)/m4/version.m4 $(top_srcdir)/configure.ac
+	$(top_srcdir)/m4/floatordering.m4 $(top_srcdir)/m4/idl.m4 \
+	$(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \
+	$(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \
+	$(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/m4/matlab.m4 \
+	$(top_srcdir)/m4/perl.m4 $(top_srcdir)/m4/python.m4 \
+	$(top_srcdir)/m4/win32.m4 $(top_srcdir)/m4/version.m4 \
+	$(top_srcdir)/configure.ac
 am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
 	$(ACLOCAL_M4)
 mkinstalldirs = $(install_sh) -d
-CONFIG_HEADER = $(top_builddir)/src/config.h \
+CONFIG_HEADER = $(top_builddir)/src/gd_config.h \
 	$(top_builddir)/src/getdata.h
 CONFIG_CLEAN_FILES =
 CONFIG_CLEAN_VPATH_FILES =
@@ -77,6 +96,11 @@ LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
 	$(LDFLAGS) -o $@
 SOURCES = $(checkdirfile_SOURCES) $(dirfile2ascii_SOURCES)
 DIST_SOURCES = $(checkdirfile_SOURCES) $(dirfile2ascii_SOURCES)
+am__can_run_installinfo = \
+  case $$AM_UPDATE_INFO_DIR in \
+    n|no|NO) false;; \
+    *) (install-info --version) >/dev/null 2>&1;; \
+  esac
 ETAGS = etags
 CTAGS = ctags
 DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
@@ -88,10 +112,13 @@ AUTOHEADER = @AUTOHEADER@
 AUTOMAKE = @AUTOMAKE@
 AWK = @AWK@
 BUILDCC = @BUILDCC@
-BUILD_DATE = @BUILD_DATE@
 BZIP2_CPPFLAGS = @BZIP2_CPPFLAGS@
 BZIP2_LDFLAGS = @BZIP2_LDFLAGS@
+BZIP2_LIBS = @BZIP2_LIBS@
 CC = @CC@
+CCAS = @CCAS@
+CCASDEPMODE = @CCASDEPMODE@
+CCASFLAGS = @CCASFLAGS@
 CCDEPMODE = @CCDEPMODE@
 CFLAGS = @CFLAGS@
 CPP = @CPP@
@@ -107,6 +134,7 @@ DEFINE_GD_NO_C99_API = @DEFINE_GD_NO_C99_API@
 DEFINE_gd_int16_t = @DEFINE_gd_int16_t@
 DEFINE_gd_int64_t = @DEFINE_gd_int64_t@
 DEFINE_gd_uint16_t = @DEFINE_gd_uint16_t@
+DEFINE_gd_uint64_t = @DEFINE_gd_uint64_t@
 DEFS = @DEFS@
 DEPDIR = @DEPDIR@
 DIFF = @DIFF@
@@ -127,13 +155,21 @@ FFLAGS = @FFLAGS@
 FGETDATA_VERSION = @FGETDATA_VERSION@
 FGREP = @FGREP@
 FLIBS = @FLIBS@
+GD_DIRSEP = @GD_DIRSEP@
+GD_FDIRSEP = @GD_FDIRSEP@
 GETDATAXX_VERSION = @GETDATAXX_VERSION@
+GETDATA_DEBUG = @GETDATA_DEBUG@
 GETDATA_IFACE_AGE = @GETDATA_IFACE_AGE@
 GETDATA_IFACE_VERSION = @GETDATA_IFACE_VERSION@
 GETDATA_IMPL_REVISION = @GETDATA_IMPL_REVISION@
+GETDATA_MAJOR = @GETDATA_MAJOR@
+GETDATA_MINOR = @GETDATA_MINOR@
+GETDATA_REVISION = @GETDATA_REVISION@
+GETDATA_VERSION_SUFFIX = @GETDATA_VERSION_SUFFIX@
 GREP = @GREP@
 GZIP_CPPFLAGS = @GZIP_CPPFLAGS@
 GZIP_LDFLAGS = @GZIP_LDFLAGS@
+GZIP_LIBS = @GZIP_LIBS@
 IDL = @IDL@
 IDL_CFLAGS = @IDL_CFLAGS@
 IDL_LIBS = @IDL_LIBS@
@@ -156,8 +192,13 @@ LTDLINCL = @LTDLINCL@
 LTLIBOBJS = @LTLIBOBJS@
 LZMA_CPPFLAGS = @LZMA_CPPFLAGS@
 LZMA_LDFLAGS = @LZMA_LDFLAGS@
+LZMA_LIBS = @LZMA_LIBS@
 MAKEINFO = @MAKEINFO@
 MANIFEST_TOOL = @MANIFEST_TOOL@
+MATLAB = @MATLAB@
+MATLABGETDATA_VERSION = @MATLABGETDATA_VERSION@
+MATLAB_CPPFLAGS = @MATLAB_CPPFLAGS@
+MEX = @MEX@
 MKDIR_P = @MKDIR_P@
 NM = @NM@
 NMEDIT = @NMEDIT@
@@ -174,6 +215,9 @@ PACKAGE_TARNAME = @PACKAGE_TARNAME@
 PACKAGE_URL = @PACKAGE_URL@
 PACKAGE_VERSION = @PACKAGE_VERSION@
 PATH_SEPARATOR = @PATH_SEPARATOR@
+PERL = @PERL@
+PERL_MAN3EXT = @PERL_MAN3EXT@
+PRINTF = @PRINTF@
 PRIVATE_LIBS = @PRIVATE_LIBS@
 PYTHON = @PYTHON@
 PYTHON_CPPFLAGS = @PYTHON_CPPFLAGS@
@@ -185,8 +229,12 @@ SET_MAKE = @SET_MAKE@
 SHELL = @SHELL@
 SLIM_CPPFLAGS = @SLIM_CPPFLAGS@
 SLIM_LDFLAGS = @SLIM_LDFLAGS@
+SLIM_LIBS = @SLIM_LIBS@
 STRIP = @STRIP@
 VERSION = @VERSION@
+ZZIP_CPPFLAGS = @ZZIP_CPPFLAGS@
+ZZIP_LDFLAGS = @ZZIP_LDFLAGS@
+ZZIP_LIBS = @ZZIP_LIBS@
 abs_builddir = @abs_builddir@
 abs_srcdir = @abs_srcdir@
 abs_top_builddir = @abs_top_builddir@
@@ -230,6 +278,8 @@ libexecdir = @libexecdir@
 localedir = @localedir@
 localstatedir = @localstatedir@
 mandir = @mandir@
+matlabbasedir = @matlabbasedir@
+mexext = @mexext@
 mkdir_p = @mkdir_p@
 moduledir = @moduledir@
 oldincludedir = @oldincludedir@
@@ -239,8 +289,12 @@ path_gunzip = @path_gunzip@
 path_gzip = @path_gzip@
 path_slim = @path_slim@
 path_unslim = @path_unslim@
+path_unzip = @path_unzip@
 path_xz = @path_xz@
+path_zip = @path_zip@
 pdfdir = @pdfdir@
+perldir = @perldir@
+perlmandir = @perlmandir@
 prefix = @prefix@
 program_transform_name = @program_transform_name@
 psdir = @psdir@
@@ -317,8 +371,11 @@ $(ACLOCAL_M4):  $(am__aclocal_m4_deps)
 $(am__aclocal_m4_deps):
 install-binPROGRAMS: $(bin_PROGRAMS)
 	@$(NORMAL_INSTALL)
-	test -z "$(bindir)" || $(MKDIR_P) "$(DESTDIR)$(bindir)"
 	@list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \
+	if test -n "$$list"; then \
+	  echo " $(MKDIR_P) '$(DESTDIR)$(bindir)'"; \
+	  $(MKDIR_P) "$(DESTDIR)$(bindir)" || exit 1; \
+	fi; \
 	for p in $$list; do echo "$$p $$p"; done | \
 	sed 's/$(EXEEXT)$$//' | \
 	while read p p1; do if test -f $$p || test -f $$p1; \
@@ -358,10 +415,10 @@ clean-binPROGRAMS:
 	list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \
 	echo " rm -f" $$list; \
 	rm -f $$list
-checkdirfile$(EXEEXT): $(checkdirfile_OBJECTS) $(checkdirfile_DEPENDENCIES) 
+checkdirfile$(EXEEXT): $(checkdirfile_OBJECTS) $(checkdirfile_DEPENDENCIES) $(EXTRA_checkdirfile_DEPENDENCIES) 
 	@rm -f checkdirfile$(EXEEXT)
 	$(LINK) $(checkdirfile_OBJECTS) $(checkdirfile_LDADD) $(LIBS)
-dirfile2ascii$(EXEEXT): $(dirfile2ascii_OBJECTS) $(dirfile2ascii_DEPENDENCIES) 
+dirfile2ascii$(EXEEXT): $(dirfile2ascii_OBJECTS) $(dirfile2ascii_DEPENDENCIES) $(EXTRA_dirfile2ascii_DEPENDENCIES) 
 	@rm -f dirfile2ascii$(EXEEXT)
 	$(LINK) $(dirfile2ascii_OBJECTS) $(dirfile2ascii_LDADD) $(LIBS)
 
@@ -500,10 +557,15 @@ install-am: all-am
 
 installcheck: installcheck-am
 install-strip:
-	$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
-	  install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
-	  `test -z '$(STRIP)' || \
-	    echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+	if test -z '$(STRIP)'; then \
+	  $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+	    install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+	      install; \
+	else \
+	  $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+	    install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+	    "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
+	fi
 mostlyclean-generic:
 
 clean-generic:
diff --git a/util/checkdirfile.c b/util/checkdirfile.c
index 10b449a..a124f30 100644
--- a/util/checkdirfile.c
+++ b/util/checkdirfile.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2007-2010 D. V. Wiebe
+/* Copyright (C) 2007-2010, 2012 D. V. Wiebe
  *
  ***************************************************************************
  *
@@ -17,7 +17,13 @@
  * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
 #ifdef HAVE_CONFIG_H
-#include "config.h"
+#include "gd_config.h"
+#endif
+
+#ifndef HAVE_SNPRINTF
+#ifdef HAVE__SNPRINTF
+#define snprintf _snprintf
+#endif
 #endif
 
 #include <stdlib.h>
@@ -25,6 +31,10 @@
 #include <stdio.h>
 #include "getdata.h"
 
+#ifndef PACKAGE_STRING
+#define PACKAGE_STRING PACKAGE_NAME " " PACKAGE_VERSION
+#endif
+
 static int callback(gd_parser_data_t *pdata, void* ne)
 {
   char getdata_error[2048];
@@ -43,18 +53,19 @@ int main(int argc, char* argv[])
   char getdata_error[2048];
   off_t n;
   int ne = 0;
-  unsigned int nfields;
+  unsigned int nfields = 0;
   const char **flist, **mflist;
 
   if (argc < 2 || !strcmp(argv[1], "--version") || !strcmp(argv[1], "--help")) {
     printf("Usage:\n"
-        "  checkdirfile DIRFILE                Check the DirFile database "
+        "  checkdirfile DIRFILE                 Check the DirFile database "
         "DIRFILE for\n"
-        "                                        errors.\n"
-        "  checkdirfile [ --help | --version]  Print this message and exit.\n"
+        "                                         errors.\n"
+        "  checkdirfile [ --help | --version ]  Print this message and exit.\n"
         "\n\n"
-        "This program is part of %s.  Copyright (C) 2008-2010  D. V. Wiebe\n"
-        "Please send reports of bugs and other communication to:\n  %s\n\n"
+        "This program is part of %s.\n"
+        "Copyright (C) 2008-2010, 2012  D. V. Wiebe\n"
+        "Please send reports of bugs and other communication to:\n\n  %s\n\n"
         "This program comes with NO WARRANTY, not even for MERCHANTABILITY "
         "or FITNESS\n"
         "FOR A PARTICULAR PURPOSE. You may redistribute it under the terms of "
@@ -153,14 +164,17 @@ int main(int argc, char* argv[])
   /* Check the validity of each field defined */
   ne = 0;
   puts("\nChecking fields...");
-  flist = gd_field_list(dirfile);
+  flist = gd_entry_list(dirfile, NULL, 0, GD_ENTRIES_HIDDEN |
+      GD_ENTRIES_NOALIAS);
   for (i = 0; flist[i] != NULL; ++i) {
     if (gd_validate(dirfile, flist[i])) {
       printf("  getdata error checking %s: %s\n", flist[i],
           gd_error_string(dirfile, getdata_error, 2048));
       ne++;
     }
-    mflist = gd_mfield_list(dirfile, flist[i]);
+    nfields++;
+    mflist = gd_entry_list(dirfile, flist[i], 0, GD_ENTRIES_HIDDEN | 
+        GD_ENTRIES_NOALIAS);
     for (j = 0; mflist[j] != NULL; ++j) {
       char code[GD_MAX_LINE_LENGTH];
       snprintf(code, GD_MAX_LINE_LENGTH, "%s/%s", flist[i], mflist[j]);
@@ -169,17 +183,50 @@ int main(int argc, char* argv[])
             gd_error_string(dirfile, getdata_error, 2048));
         ne++;
       }
+      nfields++;
+    }
+
+    mflist = gd_entry_list(dirfile, flist[i], GD_ALIAS_ENTRIES,
+        GD_ENTRIES_HIDDEN);
+    for (j = 0; mflist[j] != NULL; ++j) {
+      char code[GD_MAX_LINE_LENGTH];
+      snprintf(code, GD_MAX_LINE_LENGTH, "%s/%s", flist[i], mflist[j]);
+      if (gd_entry_type(dirfile, code) == GD_NO_ENTRY) {
+        if (gd_error(dirfile) == GD_E_BAD_CODE) {
+          printf("  dangling alias %s pointing to non-existent %s\n", code,
+              gd_alias_target(dirfile, code));
+        } else {
+          printf("  getdata error checking alias %s: %s\n", code,
+              gd_error_string(dirfile, getdata_error, 2048));
+        }
+        ne++;
+      }
+      nfields++;
     }
   }
 
-  nfields = gd_nfields(dirfile);
+  /* look for dangling aliases */
+  flist = gd_entry_list(dirfile, NULL, GD_ALIAS_ENTRIES, GD_ENTRIES_HIDDEN);
+  for (i = 0; flist[i] != NULL; ++i) {
+    if (gd_entry_type(dirfile, flist[i]) == GD_NO_ENTRY) {
+      if (gd_error(dirfile) == GD_E_BAD_CODE) {
+        printf("  dangling alias %s pointing to non-existent %s\n", flist[i],
+            gd_alias_target(dirfile, flist[i]));
+      } else {
+        printf("  getdata error checking alias %s: %s\n", flist[i],
+            gd_error_string(dirfile, getdata_error, 2048));
+      }
+      ne++;
+    }
+    nfields++;
+  }
 
   if (ne > 0)
     printf("  Found %i problems in %u %s.\n", ne, nfields,
-        nfields > 1 ? "fields" : "field");
+        nfields > 1 ? "entries" : "entry");
   else
     printf("  No problems found in %u %s.\n", nfields,
-        nfields > 1 ? "fields" : "field");
+        nfields > 1 ? "entries" : "entry");
 
   /* try to retrieve the number of frames in the dirfile */
   puts("\nChecking frames...");
@@ -192,7 +239,8 @@ int main(int argc, char* argv[])
     return 1;
   }
 
-  printf("  Found %llu frames.\n", (unsigned long long)n);
+  printf("  Found %llu %s.\n", (unsigned long long)n,
+        n == 1 ? "frame" : "frames");
 
   gd_close(dirfile);
   return 0;
diff --git a/util/dirfile2ascii.c b/util/dirfile2ascii.c
index 9dc892e..649d959 100644
--- a/util/dirfile2ascii.c
+++ b/util/dirfile2ascii.c
@@ -18,7 +18,7 @@
  * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
 #ifdef HAVE_CONFIG_H
-#include "config.h"
+#include "gd_config.h"
 #endif
 
 #define _XOPEN_SOURCE 1000
@@ -28,6 +28,7 @@
 #include <stdlib.h>
 #include <string.h>
 #include <unistd.h>
+#include <limits.h>
 #include <stdint.h>
 #include <inttypes.h>
 #include <getopt.h>
@@ -47,7 +48,7 @@ struct field
 {
   char *name;
   int type;
-  gd_spf_t spf;
+  unsigned int spf;
   union {
     double *dbl;
     int64_t *i64;
@@ -159,9 +160,9 @@ int main (int argc, char **argv)
   size_t nf = 0;
   off64_t ff = 0;
   size_t n_want;
-  gd_spf_t j;
-  gd_spf_t max_spf = 0;
-  gd_spf_t min_spf = UINT16_MAX;
+  unsigned int j;
+  unsigned int max_spf = 0;
+  unsigned int min_spf = INT_MAX;
   int c, i;
   int numfields = 0;
   struct field fields[BUF_LEN];
@@ -481,10 +482,10 @@ int main (int argc, char **argv)
           /*                 val= y0 +  diff  *     slope       */
           /* Note that if max_spfs isn't a multiple of all spfs then some of  */
           /* the data will only be approximated (except at frame boundaries). */
-          gd_spf_t prev_samp, next_samp, offset;
+          unsigned int prev_samp, next_samp, offset;
           double slope, diff, val;
 
-          prev_samp = (gd_spf_t)floor((double)j * (double)fields[i].spf /
+          prev_samp = (unsigned int)floor((double)j * (double)fields[i].spf /
               (double)max_spf);
           next_samp = prev_samp + 1;
           diff = ((double)prev_samp + (double)(j % (max_spf / fields[i].spf)) /

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-science/packages/libgetdata.git



More information about the debian-science-commits mailing list